vp8dx.h 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210
  1. /*
  2. * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
  3. *
  4. * Use of this source code is governed by a BSD-style license
  5. * 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
  7. * in the file PATENTS. All contributing project authors may
  8. * be found in the AUTHORS file in the root of the source tree.
  9. */
  10. /*!\defgroup vp8_decoder WebM VP8/VP9 Decoder
  11. * \ingroup vp8
  12. *
  13. * @{
  14. */
  15. /*!\file
  16. * \brief Provides definitions for using VP8 or VP9 within the vpx Decoder
  17. * interface.
  18. */
  19. #ifndef VPX_VPX_VP8DX_H_
  20. #define VPX_VPX_VP8DX_H_
  21. #ifdef __cplusplus
  22. extern "C" {
  23. #endif
  24. /* Include controls common to both the encoder and decoder */
  25. #include "./vp8.h"
  26. /*!\name Algorithm interface for VP8
  27. *
  28. * This interface provides the capability to decode VP8 streams.
  29. * @{
  30. */
  31. extern vpx_codec_iface_t vpx_codec_vp8_dx_algo;
  32. extern vpx_codec_iface_t *vpx_codec_vp8_dx(void);
  33. /*!@} - end algorithm interface member group*/
  34. /*!\name Algorithm interface for VP9
  35. *
  36. * This interface provides the capability to decode VP9 streams.
  37. * @{
  38. */
  39. extern vpx_codec_iface_t vpx_codec_vp9_dx_algo;
  40. extern vpx_codec_iface_t *vpx_codec_vp9_dx(void);
  41. /*!@} - end algorithm interface member group*/
  42. /*!\enum vp8_dec_control_id
  43. * \brief VP8 decoder control functions
  44. *
  45. * This set of macros define the control functions available for the VP8
  46. * decoder interface.
  47. *
  48. * \sa #vpx_codec_control
  49. */
  50. enum vp8_dec_control_id {
  51. /** control function to get info on which reference frames were updated
  52. * by the last decode
  53. */
  54. VP8D_GET_LAST_REF_UPDATES = VP8_DECODER_CTRL_ID_START,
  55. /** check if the indicated frame is corrupted */
  56. VP8D_GET_FRAME_CORRUPTED,
  57. /** control function to get info on which reference frames were used
  58. * by the last decode
  59. */
  60. VP8D_GET_LAST_REF_USED,
  61. /** decryption function to decrypt encoded buffer data immediately
  62. * before decoding. Takes a vpx_decrypt_init, which contains
  63. * a callback function and opaque context pointer.
  64. */
  65. VPXD_SET_DECRYPTOR,
  66. VP8D_SET_DECRYPTOR = VPXD_SET_DECRYPTOR,
  67. /** control function to get the dimensions that the current frame is decoded
  68. * at. This may be different to the intended display size for the frame as
  69. * specified in the wrapper or frame header (see VP9D_GET_DISPLAY_SIZE). */
  70. VP9D_GET_FRAME_SIZE,
  71. /** control function to get the current frame's intended display dimensions
  72. * (as specified in the wrapper or frame header). This may be different to
  73. * the decoded dimensions of this frame (see VP9D_GET_FRAME_SIZE). */
  74. VP9D_GET_DISPLAY_SIZE,
  75. /** control function to get the bit depth of the stream. */
  76. VP9D_GET_BIT_DEPTH,
  77. /** control function to set the byte alignment of the planes in the reference
  78. * buffers. Valid values are power of 2, from 32 to 1024. A value of 0 sets
  79. * legacy alignment. I.e. Y plane is aligned to 32 bytes, U plane directly
  80. * follows Y plane, and V plane directly follows U plane. Default value is 0.
  81. */
  82. VP9_SET_BYTE_ALIGNMENT,
  83. /** control function to invert the decoding order to from right to left. The
  84. * function is used in a test to confirm the decoding independence of tile
  85. * columns. The function may be used in application where this order
  86. * of decoding is desired.
  87. *
  88. * TODO(yaowu): Rework the unit test that uses this control, and in a future
  89. * release, this test-only control shall be removed.
  90. */
  91. VP9_INVERT_TILE_DECODE_ORDER,
  92. /** control function to set the skip loop filter flag. Valid values are
  93. * integers. The decoder will skip the loop filter when its value is set to
  94. * nonzero. If the loop filter is skipped the decoder may accumulate decode
  95. * artifacts. The default value is 0.
  96. */
  97. VP9_SET_SKIP_LOOP_FILTER,
  98. /** control function to decode SVC stream up to the x spatial layers,
  99. * where x is passed in through the control, and is 0 for base layer.
  100. */
  101. VP9_DECODE_SVC_SPATIAL_LAYER,
  102. /*!\brief Codec control function to get last decoded frame quantizer.
  103. *
  104. * Return value uses internal quantizer scale defined by the codec.
  105. *
  106. * Supported in codecs: VP8, VP9
  107. */
  108. VPXD_GET_LAST_QUANTIZER,
  109. /*!\brief Codec control function to set row level multi-threading.
  110. *
  111. * 0 : off, 1 : on
  112. *
  113. * Supported in codecs: VP9
  114. */
  115. VP9D_SET_ROW_MT,
  116. /*!\brief Codec control function to set loopfilter optimization.
  117. *
  118. * 0 : off, Loop filter is done after all tiles have been decoded
  119. * 1 : on, Loop filter is done immediately after decode without
  120. * waiting for all threads to sync.
  121. *
  122. * Supported in codecs: VP9
  123. */
  124. VP9D_SET_LOOP_FILTER_OPT,
  125. VP8_DECODER_CTRL_ID_MAX
  126. };
  127. /** Decrypt n bytes of data from input -> output, using the decrypt_state
  128. * passed in VPXD_SET_DECRYPTOR.
  129. */
  130. typedef void (*vpx_decrypt_cb)(void *decrypt_state, const unsigned char *input,
  131. unsigned char *output, int count);
  132. /*!\brief Structure to hold decryption state
  133. *
  134. * Defines a structure to hold the decryption state and access function.
  135. */
  136. typedef struct vpx_decrypt_init {
  137. /*! Decrypt callback. */
  138. vpx_decrypt_cb decrypt_cb;
  139. /*! Decryption state. */
  140. void *decrypt_state;
  141. } vpx_decrypt_init;
  142. /*!\cond */
  143. /*!\brief VP8 decoder control function parameter type
  144. *
  145. * Defines the data types that VP8D control functions take. Note that
  146. * additional common controls are defined in vp8.h
  147. *
  148. */
  149. VPX_CTRL_USE_TYPE(VP8D_GET_LAST_REF_UPDATES, int *)
  150. #define VPX_CTRL_VP8D_GET_LAST_REF_UPDATES
  151. VPX_CTRL_USE_TYPE(VP8D_GET_FRAME_CORRUPTED, int *)
  152. #define VPX_CTRL_VP8D_GET_FRAME_CORRUPTED
  153. VPX_CTRL_USE_TYPE(VP8D_GET_LAST_REF_USED, int *)
  154. #define VPX_CTRL_VP8D_GET_LAST_REF_USED
  155. VPX_CTRL_USE_TYPE(VPXD_GET_LAST_QUANTIZER, int *)
  156. #define VPX_CTRL_VPXD_GET_LAST_QUANTIZER
  157. VPX_CTRL_USE_TYPE(VPXD_SET_DECRYPTOR, vpx_decrypt_init *)
  158. #define VPX_CTRL_VPXD_SET_DECRYPTOR
  159. VPX_CTRL_USE_TYPE(VP8D_SET_DECRYPTOR, vpx_decrypt_init *)
  160. #define VPX_CTRL_VP8D_SET_DECRYPTOR
  161. VPX_CTRL_USE_TYPE(VP9D_GET_DISPLAY_SIZE, int *)
  162. #define VPX_CTRL_VP9D_GET_DISPLAY_SIZE
  163. VPX_CTRL_USE_TYPE(VP9D_GET_BIT_DEPTH, unsigned int *)
  164. #define VPX_CTRL_VP9D_GET_BIT_DEPTH
  165. VPX_CTRL_USE_TYPE(VP9D_GET_FRAME_SIZE, int *)
  166. #define VPX_CTRL_VP9D_GET_FRAME_SIZE
  167. VPX_CTRL_USE_TYPE(VP9_INVERT_TILE_DECODE_ORDER, int)
  168. #define VPX_CTRL_VP9_INVERT_TILE_DECODE_ORDER
  169. #define VPX_CTRL_VP9_DECODE_SVC_SPATIAL_LAYER
  170. VPX_CTRL_USE_TYPE(VP9_DECODE_SVC_SPATIAL_LAYER, int)
  171. #define VPX_CTRL_VP9_SET_SKIP_LOOP_FILTER
  172. VPX_CTRL_USE_TYPE(VP9_SET_SKIP_LOOP_FILTER, int)
  173. #define VPX_CTRL_VP9_DECODE_SET_ROW_MT
  174. VPX_CTRL_USE_TYPE(VP9D_SET_ROW_MT, int)
  175. #define VPX_CTRL_VP9_SET_LOOP_FILTER_OPT
  176. VPX_CTRL_USE_TYPE(VP9D_SET_LOOP_FILTER_OPT, int)
  177. /*!\endcond */
  178. /*! @} - end defgroup vp8_decoder */
  179. #ifdef __cplusplus
  180. } // extern "C"
  181. #endif
  182. #endif // VPX_VPX_VP8DX_H_