vp8dx.h 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167
  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_VP8DX_H_
  20. #define 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. VP8_DECODER_CTRL_ID_MAX
  99. };
  100. /** Decrypt n bytes of data from input -> output, using the decrypt_state
  101. * passed in VPXD_SET_DECRYPTOR.
  102. */
  103. typedef void (*vpx_decrypt_cb)(void *decrypt_state, const unsigned char *input,
  104. unsigned char *output, int count);
  105. /*!\brief Structure to hold decryption state
  106. *
  107. * Defines a structure to hold the decryption state and access function.
  108. */
  109. typedef struct vpx_decrypt_init {
  110. /*! Decrypt callback. */
  111. vpx_decrypt_cb decrypt_cb;
  112. /*! Decryption state. */
  113. void *decrypt_state;
  114. } vpx_decrypt_init;
  115. /*!\brief A deprecated alias for vpx_decrypt_init.
  116. */
  117. typedef vpx_decrypt_init vp8_decrypt_init;
  118. /*!\brief VP8 decoder control function parameter type
  119. *
  120. * Defines the data types that VP8D control functions take. Note that
  121. * additional common controls are defined in vp8.h
  122. *
  123. */
  124. VPX_CTRL_USE_TYPE(VP8D_GET_LAST_REF_UPDATES, int *)
  125. VPX_CTRL_USE_TYPE(VP8D_GET_FRAME_CORRUPTED, int *)
  126. VPX_CTRL_USE_TYPE(VP8D_GET_LAST_REF_USED, int *)
  127. VPX_CTRL_USE_TYPE(VPXD_SET_DECRYPTOR, vpx_decrypt_init *)
  128. VPX_CTRL_USE_TYPE(VP8D_SET_DECRYPTOR, vpx_decrypt_init *)
  129. VPX_CTRL_USE_TYPE(VP9D_GET_DISPLAY_SIZE, int *)
  130. VPX_CTRL_USE_TYPE(VP9D_GET_BIT_DEPTH, unsigned int *)
  131. VPX_CTRL_USE_TYPE(VP9D_GET_FRAME_SIZE, int *)
  132. VPX_CTRL_USE_TYPE(VP9_INVERT_TILE_DECODE_ORDER, int)
  133. /*! @} - end defgroup vp8_decoder */
  134. #ifdef __cplusplus
  135. } // extern "C"
  136. #endif
  137. #endif // VPX_VP8DX_H_