blob: 1f02fd595855aca6a83030ffa6b842b6036e2ecc [file] [log] [blame]
John Koleszar0ea50ce2010-05-18 11:58:33 -04001/*
John Koleszarc2140b82010-09-09 08:16:39 -04002 * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
John Koleszar0ea50ce2010-05-18 11:58:33 -04003 *
John Koleszar94c52e42010-06-18 12:39:21 -04004 * Use of this source code is governed by a BSD-style license
John Koleszar09202d82010-06-04 16:19:40 -04005 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found
John Koleszar94c52e42010-06-18 12:39:21 -04007 * in the file PATENTS. All contributing project authors may
John Koleszar09202d82010-06-04 16:19:40 -04008 * be found in the AUTHORS file in the root of the source tree.
John Koleszar0ea50ce2010-05-18 11:58:33 -04009 */
10
11
Yaowu Xuf5bbe242015-01-15 14:32:42 -080012/*!\defgroup vp8_decoder WebM VP8/VP9 Decoder
John Koleszar0ea50ce2010-05-18 11:58:33 -040013 * \ingroup vp8
14 *
15 * @{
16 */
James Zernf42d52e2011-02-16 17:54:49 -080017/*!\file
Yaowu Xuf5bbe242015-01-15 14:32:42 -080018 * \brief Provides definitions for using VP8 or VP9 within the vpx Decoder
John Koleszar0ea50ce2010-05-18 11:58:33 -040019 * interface.
20 */
James Zern7386bde2013-12-15 18:26:15 -080021#ifndef VPX_VP8DX_H_
22#define VPX_VP8DX_H_
Dmitry Kovaleve288c602013-09-29 18:00:15 -070023
24#ifdef __cplusplus
25extern "C" {
26#endif
John Koleszar0ea50ce2010-05-18 11:58:33 -040027
Johanne883c742013-12-16 13:15:26 -080028/* Include controls common to both the encoder and decoder */
29#include "./vp8.h"
30
James Zern8e17e822011-02-24 14:12:57 -080031/*!\name Algorithm interface for VP8
John Koleszar0ea50ce2010-05-18 11:58:33 -040032 *
Yaowu Xuf5bbe242015-01-15 14:32:42 -080033 * This interface provides the capability to decode VP8 streams.
James Zern8e17e822011-02-24 14:12:57 -080034 * @{
John Koleszar0ea50ce2010-05-18 11:58:33 -040035 */
John Koleszarfa7a55b2010-09-21 10:35:52 -040036extern vpx_codec_iface_t vpx_codec_vp8_dx_algo;
John Koleszarc6b90392012-07-13 15:21:29 -070037extern vpx_codec_iface_t *vpx_codec_vp8_dx(void);
Yaowu Xuf5bbe242015-01-15 14:32:42 -080038/*!@} - end algorithm interface member group*/
John Koleszara9c75972012-11-08 17:09:30 -080039
Yaowu Xuf5bbe242015-01-15 14:32:42 -080040/*!\name Algorithm interface for VP9
41 *
42 * This interface provides the capability to decode VP9 streams.
43 * @{
44 */
John Koleszara9c75972012-11-08 17:09:30 -080045extern vpx_codec_iface_t vpx_codec_vp9_dx_algo;
46extern vpx_codec_iface_t *vpx_codec_vp9_dx(void);
James Zern8e17e822011-02-24 14:12:57 -080047/*!@} - end algorithm interface member group*/
John Koleszar0ea50ce2010-05-18 11:58:33 -040048
Jingning Han3ee6db62015-08-05 19:00:31 -070049/*!\name Algorithm interface for VP10
50 *
51 * This interface provides the capability to decode VP10 streams.
52 * @{
53 */
54extern vpx_codec_iface_t vpx_codec_vp10_dx_algo;
55extern vpx_codec_iface_t *vpx_codec_vp10_dx(void);
56/*!@} - end algorithm interface member group*/
John Koleszar0ea50ce2010-05-18 11:58:33 -040057
Adrian Grangef58eca92013-10-24 15:11:36 -070058/*!\enum vp8_dec_control_id
59 * \brief VP8 decoder control functions
Henrik Lundin2a874912010-12-14 14:05:06 +010060 *
James Zern8e17e822011-02-24 14:12:57 -080061 * This set of macros define the control functions available for the VP8
62 * decoder interface.
63 *
64 * \sa #vpx_codec_control
Henrik Lundin2a874912010-12-14 14:05:06 +010065 */
John Koleszarc6b90392012-07-13 15:21:29 -070066enum vp8_dec_control_id {
67 /** control function to get info on which reference frames were updated
68 * by the last decode
69 */
70 VP8D_GET_LAST_REF_UPDATES = VP8_DECODER_CTRL_ID_START,
John Koleszar4a742e52011-03-04 08:51:39 -050071
John Koleszarc6b90392012-07-13 15:21:29 -070072 /** check if the indicated frame is corrupted */
73 VP8D_GET_FRAME_CORRUPTED,
John Koleszar4a742e52011-03-04 08:51:39 -050074
John Koleszar83b1d902012-11-05 12:37:14 -080075 /** control function to get info on which reference frames were used
76 * by the last decode
77 */
78 VP8D_GET_LAST_REF_USED,
79
Jeff Petkau368c7232013-06-13 12:16:58 -070080 /** decryption function to decrypt encoded buffer data immediately
Joey Parrish18c08602014-04-15 14:10:58 -070081 * before decoding. Takes a vpx_decrypt_init, which contains
Jeff Petkau368c7232013-06-13 12:16:58 -070082 * a callback function and opaque context pointer.
Dmitry Kovalev26cec5c2013-03-15 18:21:55 -070083 */
Joey Parrish18c08602014-04-15 14:10:58 -070084 VPXD_SET_DECRYPTOR,
85 VP8D_SET_DECRYPTOR = VPXD_SET_DECRYPTOR,
Dmitry Kovalev26cec5c2013-03-15 18:21:55 -070086
Adrian Grangecf54b882015-02-13 08:14:44 -080087 /** control function to get the dimensions that the current frame is decoded
88 * at. This may be different to the intended display size for the frame as
89 * specified in the wrapper or frame header (see VP9D_GET_DISPLAY_SIZE). */
90 VP9D_GET_FRAME_SIZE,
91
92 /** control function to get the current frame's intended display dimensions
93 * (as specified in the wrapper or frame header). This may be different to
94 * the decoded dimensions of this frame (see VP9D_GET_FRAME_SIZE). */
Adrian Grange2117fe02013-11-19 14:01:44 -080095 VP9D_GET_DISPLAY_SIZE,
96
Deb Mukherjee5acfafb2014-08-26 12:35:15 -070097 /** control function to get the bit depth of the stream. */
98 VP9D_GET_BIT_DEPTH,
99
Frank Galliganc4f70792014-12-15 12:00:09 -0800100 /** control function to set the byte alignment of the planes in the reference
101 * buffers. Valid values are power of 2, from 32 to 1024. A value of 0 sets
102 * legacy alignment. I.e. Y plane is aligned to 32 bytes, U plane directly
103 * follows Y plane, and V plane directly follows U plane. Default value is 0.
104 */
105 VP9_SET_BYTE_ALIGNMENT,
106
Yaowu Xu6f4d29c2015-01-13 12:19:46 -0800107 /** control function to invert the decoding order to from right to left. The
108 * function is used in a test to confirm the decoding independence of tile
109 * columns. The function may be used in application where this order
110 * of decoding is desired.
111 *
112 * TODO(yaowu): Rework the unit test that uses this control, and in a future
113 * release, this test-only control shall be removed.
114 */
John Koleszar672b75a2013-03-27 11:22:20 -0700115 VP9_INVERT_TILE_DECODE_ORDER,
116
Frank Galliganbfb6d482015-05-21 11:49:11 -0700117 /** control function to set the skip loop filter flag. Valid values are
118 * integers. The decoder will skip the loop filter when its value is set to
119 * nonzero. If the loop filter is skipped the decoder may accumulate decode
120 * artifacts. The default value is 0.
121 */
122 VP9_SET_SKIP_LOOP_FILTER,
123
John Koleszarc6b90392012-07-13 15:21:29 -0700124 VP8_DECODER_CTRL_ID_MAX
125};
Henrik Lundin2a874912010-12-14 14:05:06 +0100126
Joey Parrish18c08602014-04-15 14:10:58 -0700127/** Decrypt n bytes of data from input -> output, using the decrypt_state
128 * passed in VPXD_SET_DECRYPTOR.
129 */
130typedef void (*vpx_decrypt_cb)(void *decrypt_state, const unsigned char *input,
131 unsigned char *output, int count);
132
Adrian Grangef58eca92013-10-24 15:11:36 -0700133/*!\brief Structure to hold decryption state
134 *
135 * Defines a structure to hold the decryption state and access function.
136 */
Joey Parrish18c08602014-04-15 14:10:58 -0700137typedef struct vpx_decrypt_init {
138 /*! Decrypt callback. */
139 vpx_decrypt_cb decrypt_cb;
140
Adrian Grangef58eca92013-10-24 15:11:36 -0700141 /*! Decryption state. */
Jeff Petkau368c7232013-06-13 12:16:58 -0700142 void *decrypt_state;
Joey Parrish18c08602014-04-15 14:10:58 -0700143} vpx_decrypt_init;
144
145/*!\brief A deprecated alias for vpx_decrypt_init.
146 */
147typedef vpx_decrypt_init vp8_decrypt_init;
148
Jeff Petkau368c7232013-06-13 12:16:58 -0700149
James Zern7dd7a7d2015-10-09 16:31:17 -0700150/*!\cond */
John Koleszar4a742e52011-03-04 08:51:39 -0500151/*!\brief VP8 decoder control function parameter type
Henrik Lundin2a874912010-12-14 14:05:06 +0100152 *
John Koleszar4a742e52011-03-04 08:51:39 -0500153 * Defines the data types that VP8D control functions take. Note that
Henrik Lundin2a874912010-12-14 14:05:06 +0100154 * additional common controls are defined in vp8.h
155 *
156 */
157
158
Joey Parrish18c08602014-04-15 14:10:58 -0700159VPX_CTRL_USE_TYPE(VP8D_GET_LAST_REF_UPDATES, int *)
James Zern7dd7a7d2015-10-09 16:31:17 -0700160#define VPX_CTRL_VP8D_GET_LAST_REF_UPDATES
Joey Parrish18c08602014-04-15 14:10:58 -0700161VPX_CTRL_USE_TYPE(VP8D_GET_FRAME_CORRUPTED, int *)
James Zern7dd7a7d2015-10-09 16:31:17 -0700162#define VPX_CTRL_VP8D_GET_FRAME_CORRUPTED
Joey Parrish18c08602014-04-15 14:10:58 -0700163VPX_CTRL_USE_TYPE(VP8D_GET_LAST_REF_USED, int *)
James Zern7dd7a7d2015-10-09 16:31:17 -0700164#define VPX_CTRL_VP8D_GET_LAST_REF_USED
Joey Parrish18c08602014-04-15 14:10:58 -0700165VPX_CTRL_USE_TYPE(VPXD_SET_DECRYPTOR, vpx_decrypt_init *)
James Zern7dd7a7d2015-10-09 16:31:17 -0700166#define VPX_CTRL_VPXD_SET_DECRYPTOR
Joey Parrish18c08602014-04-15 14:10:58 -0700167VPX_CTRL_USE_TYPE(VP8D_SET_DECRYPTOR, vpx_decrypt_init *)
James Zern7dd7a7d2015-10-09 16:31:17 -0700168#define VPX_CTRL_VP8D_SET_DECRYPTOR
Joey Parrish18c08602014-04-15 14:10:58 -0700169VPX_CTRL_USE_TYPE(VP9D_GET_DISPLAY_SIZE, int *)
James Zern7dd7a7d2015-10-09 16:31:17 -0700170#define VPX_CTRL_VP9D_GET_DISPLAY_SIZE
Deb Mukherjee5acfafb2014-08-26 12:35:15 -0700171VPX_CTRL_USE_TYPE(VP9D_GET_BIT_DEPTH, unsigned int *)
James Zern7dd7a7d2015-10-09 16:31:17 -0700172#define VPX_CTRL_VP9D_GET_BIT_DEPTH
Adrian Grangecf54b882015-02-13 08:14:44 -0800173VPX_CTRL_USE_TYPE(VP9D_GET_FRAME_SIZE, int *)
James Zern7dd7a7d2015-10-09 16:31:17 -0700174#define VPX_CTRL_VP9D_GET_FRAME_SIZE
John Koleszar672b75a2013-03-27 11:22:20 -0700175VPX_CTRL_USE_TYPE(VP9_INVERT_TILE_DECODE_ORDER, int)
James Zern7dd7a7d2015-10-09 16:31:17 -0700176#define VPX_CTRL_VP9_INVERT_TILE_DECODE_ORDER
Henrik Lundin2a874912010-12-14 14:05:06 +0100177
James Zern7dd7a7d2015-10-09 16:31:17 -0700178/*!\endcond */
John Koleszar0ea50ce2010-05-18 11:58:33 -0400179/*! @} - end defgroup vp8_decoder */
180
Dmitry Kovaleve288c602013-09-29 18:00:15 -0700181#ifdef __cplusplus
182} // extern "C"
183#endif
John Koleszar0ea50ce2010-05-18 11:58:33 -0400184
James Zern7386bde2013-12-15 18:26:15 -0800185#endif // VPX_VP8DX_H_