Home | History | Annotate | Download | only in vpx
      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 
     11 
     12 /*!\defgroup vp8_decoder WebM VP8 Decoder
     13  * \ingroup vp8
     14  *
     15  * @{
     16  */
     17 /*!\file
     18  * \brief Provides definitions for using the VP8 algorithm within the vpx Decoder
     19  *        interface.
     20  */
     21 #ifndef VPX_VP8DX_H_
     22 #define VPX_VP8DX_H_
     23 
     24 #ifdef __cplusplus
     25 extern "C" {
     26 #endif
     27 
     28 /* Include controls common to both the encoder and decoder */
     29 #include "./vp8.h"
     30 
     31 /*!\name Algorithm interface for VP8
     32  *
     33  * This interface provides the capability to decode raw VP8 streams, as would
     34  * be found in AVI files and other non-Flash uses.
     35  * @{
     36  */
     37 extern vpx_codec_iface_t  vpx_codec_vp8_dx_algo;
     38 extern vpx_codec_iface_t *vpx_codec_vp8_dx(void);
     39 
     40 /* TODO(jkoleszar): These move to VP9 in a later patch set. */
     41 extern vpx_codec_iface_t  vpx_codec_vp9_dx_algo;
     42 extern vpx_codec_iface_t *vpx_codec_vp9_dx(void);
     43 /*!@} - end algorithm interface member group*/
     44 
     45 
     46 /*!\enum vp8_dec_control_id
     47  * \brief VP8 decoder control functions
     48  *
     49  * This set of macros define the control functions available for the VP8
     50  * decoder interface.
     51  *
     52  * \sa #vpx_codec_control
     53  */
     54 enum vp8_dec_control_id {
     55   /** control function to get info on which reference frames were updated
     56    *  by the last decode
     57    */
     58   VP8D_GET_LAST_REF_UPDATES = VP8_DECODER_CTRL_ID_START,
     59 
     60   /** check if the indicated frame is corrupted */
     61   VP8D_GET_FRAME_CORRUPTED,
     62 
     63   /** control function to get info on which reference frames were used
     64    *  by the last decode
     65    */
     66   VP8D_GET_LAST_REF_USED,
     67 
     68   /** decryption function to decrypt encoded buffer data immediately
     69    * before decoding. Takes a vpx_decrypt_init, which contains
     70    * a callback function and opaque context pointer.
     71    */
     72   VPXD_SET_DECRYPTOR,
     73   VP8D_SET_DECRYPTOR = VPXD_SET_DECRYPTOR,
     74 
     75   /** control function to get the display dimensions for the current frame. */
     76   VP9D_GET_DISPLAY_SIZE,
     77 
     78   /** For testing. */
     79   VP9_INVERT_TILE_DECODE_ORDER,
     80 
     81   VP8_DECODER_CTRL_ID_MAX
     82 };
     83 
     84 /** Decrypt n bytes of data from input -> output, using the decrypt_state
     85  *  passed in VPXD_SET_DECRYPTOR.
     86  */
     87 typedef void (*vpx_decrypt_cb)(void *decrypt_state, const unsigned char *input,
     88                                unsigned char *output, int count);
     89 
     90 /*!\brief Structure to hold decryption state
     91  *
     92  * Defines a structure to hold the decryption state and access function.
     93  */
     94 typedef struct vpx_decrypt_init {
     95     /*! Decrypt callback. */
     96     vpx_decrypt_cb decrypt_cb;
     97 
     98     /*! Decryption state. */
     99     void *decrypt_state;
    100 } vpx_decrypt_init;
    101 
    102 /*!\brief A deprecated alias for vpx_decrypt_init.
    103  */
    104 typedef vpx_decrypt_init vp8_decrypt_init;
    105 
    106 
    107 /*!\brief VP8 decoder control function parameter type
    108  *
    109  * Defines the data types that VP8D control functions take. Note that
    110  * additional common controls are defined in vp8.h
    111  *
    112  */
    113 
    114 
    115 VPX_CTRL_USE_TYPE(VP8D_GET_LAST_REF_UPDATES,    int *)
    116 VPX_CTRL_USE_TYPE(VP8D_GET_FRAME_CORRUPTED,     int *)
    117 VPX_CTRL_USE_TYPE(VP8D_GET_LAST_REF_USED,       int *)
    118 VPX_CTRL_USE_TYPE(VPXD_SET_DECRYPTOR,           vpx_decrypt_init *)
    119 VPX_CTRL_USE_TYPE(VP8D_SET_DECRYPTOR,           vpx_decrypt_init *)
    120 VPX_CTRL_USE_TYPE(VP9D_GET_DISPLAY_SIZE,        int *)
    121 VPX_CTRL_USE_TYPE(VP9_INVERT_TILE_DECODE_ORDER, int)
    122 
    123 /*! @} - end defgroup vp8_decoder */
    124 
    125 #ifdef __cplusplus
    126 }  // extern "C"
    127 #endif
    128 
    129 #endif  // VPX_VP8DX_H_
    130