media/libvpx/vpx/vp8.h

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/media/libvpx/vpx/vp8.h	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,138 @@
     1.4 +/*
     1.5 + *  Copyright (c) 2010 The WebM project authors. All Rights Reserved.
     1.6 + *
     1.7 + *  Use of this source code is governed by a BSD-style license
     1.8 + *  that can be found in the LICENSE file in the root of the source
     1.9 + *  tree. An additional intellectual property rights grant can be found
    1.10 + *  in the file PATENTS.  All contributing project authors may
    1.11 + *  be found in the AUTHORS file in the root of the source tree.
    1.12 + */
    1.13 +
    1.14 +/*!\defgroup vp8 VP8
    1.15 + * \ingroup codecs
    1.16 + * VP8 is vpx's newest video compression algorithm that uses motion
    1.17 + * compensated prediction, Discrete Cosine Transform (DCT) coding of the
    1.18 + * prediction error signal and context dependent entropy coding techniques
    1.19 + * based on arithmetic principles. It features:
    1.20 + *  - YUV 4:2:0 image format
    1.21 + *  - Macro-block based coding (16x16 luma plus two 8x8 chroma)
    1.22 + *  - 1/4 (1/8) pixel accuracy motion compensated prediction
    1.23 + *  - 4x4 DCT transform
    1.24 + *  - 128 level linear quantizer
    1.25 + *  - In loop deblocking filter
    1.26 + *  - Context-based entropy coding
    1.27 + *
    1.28 + * @{
    1.29 + */
    1.30 +/*!\file
    1.31 + * \brief Provides controls common to both the VP8 encoder and decoder.
    1.32 + */
    1.33 +#ifndef VP8_H
    1.34 +#define VP8_H
    1.35 +
    1.36 +#include "./vpx_codec.h"
    1.37 +#include "./vpx_image.h"
    1.38 +
    1.39 +#ifdef __cplusplus
    1.40 +extern "C" {
    1.41 +#endif
    1.42 +
    1.43 +/*!\brief Control functions
    1.44 + *
    1.45 + * The set of macros define the control functions of VP8 interface
    1.46 + */
    1.47 +enum vp8_com_control_id {
    1.48 +  VP8_SET_REFERENCE           = 1,    /**< pass in an external frame into decoder to be used as reference frame */
    1.49 +  VP8_COPY_REFERENCE          = 2,    /**< get a copy of reference frame from the decoder */
    1.50 +  VP8_SET_POSTPROC            = 3,    /**< set the decoder's post processing settings  */
    1.51 +  VP8_SET_DBG_COLOR_REF_FRAME = 4,    /**< set the reference frames to color for each macroblock */
    1.52 +  VP8_SET_DBG_COLOR_MB_MODES  = 5,    /**< set which macro block modes to color */
    1.53 +  VP8_SET_DBG_COLOR_B_MODES   = 6,    /**< set which blocks modes to color */
    1.54 +  VP8_SET_DBG_DISPLAY_MV      = 7,    /**< set which motion vector modes to draw */
    1.55 +
    1.56 +  /* TODO(jkoleszar): The encoder incorrectly reuses some of these values (5+)
    1.57 +   * for its control ids. These should be migrated to something like the
    1.58 +   * VP8_DECODER_CTRL_ID_START range next time we're ready to break the ABI.
    1.59 +   */
    1.60 +  VP9_GET_REFERENCE           = 128,  /**< get a pointer to a reference frame */
    1.61 +  VP8_COMMON_CTRL_ID_MAX,
    1.62 +  VP8_DECODER_CTRL_ID_START   = 256
    1.63 +};
    1.64 +
    1.65 +/*!\brief post process flags
    1.66 + *
    1.67 + * The set of macros define VP8 decoder post processing flags
    1.68 + */
    1.69 +enum vp8_postproc_level {
    1.70 +  VP8_NOFILTERING             = 0,
    1.71 +  VP8_DEBLOCK                 = 1 << 0,
    1.72 +  VP8_DEMACROBLOCK            = 1 << 1,
    1.73 +  VP8_ADDNOISE                = 1 << 2,
    1.74 +  VP8_DEBUG_TXT_FRAME_INFO    = 1 << 3, /**< print frame information */
    1.75 +  VP8_DEBUG_TXT_MBLK_MODES    = 1 << 4, /**< print macro block modes over each macro block */
    1.76 +  VP8_DEBUG_TXT_DC_DIFF       = 1 << 5, /**< print dc diff for each macro block */
    1.77 +  VP8_DEBUG_TXT_RATE_INFO     = 1 << 6, /**< print video rate info (encoder only) */
    1.78 +  VP8_MFQE                    = 1 << 10
    1.79 +};
    1.80 +
    1.81 +/*!\brief post process flags
    1.82 + *
    1.83 + * This define a structure that describe the post processing settings. For
    1.84 + * the best objective measure (using the PSNR metric) set post_proc_flag
    1.85 + * to VP8_DEBLOCK and deblocking_level to 1.
    1.86 + */
    1.87 +
    1.88 +typedef struct vp8_postproc_cfg {
    1.89 +  int post_proc_flag;         /**< the types of post processing to be done, should be combination of "vp8_postproc_level" */
    1.90 +  int deblocking_level;       /**< the strength of deblocking, valid range [0, 16] */
    1.91 +  int noise_level;            /**< the strength of additive noise, valid range [0, 16] */
    1.92 +} vp8_postproc_cfg_t;
    1.93 +
    1.94 +/*!\brief reference frame type
    1.95 + *
    1.96 + * The set of macros define the type of VP8 reference frames
    1.97 + */
    1.98 +typedef enum vpx_ref_frame_type {
    1.99 +  VP8_LAST_FRAME = 1,
   1.100 +  VP8_GOLD_FRAME = 2,
   1.101 +  VP8_ALTR_FRAME = 4
   1.102 +} vpx_ref_frame_type_t;
   1.103 +
   1.104 +/*!\brief reference frame data struct
   1.105 + *
   1.106 + * Define the data struct to access vp8 reference frames.
   1.107 + */
   1.108 +typedef struct vpx_ref_frame {
   1.109 +  vpx_ref_frame_type_t  frame_type;   /**< which reference frame */
   1.110 +  vpx_image_t           img;          /**< reference frame data in image format */
   1.111 +} vpx_ref_frame_t;
   1.112 +
   1.113 +/*!\brief VP9 specific reference frame data struct
   1.114 + *
   1.115 + * Define the data struct to access vp9 reference frames.
   1.116 + */
   1.117 +typedef struct vp9_ref_frame {
   1.118 +  int idx; /**< frame index to get (input) */
   1.119 +  vpx_image_t  img; /**< img structure to populate (output) */
   1.120 +} vp9_ref_frame_t;
   1.121 +
   1.122 +/*!\brief vp8 decoder control function parameter type
   1.123 + *
   1.124 + * defines the data type for each of VP8 decoder control function requires
   1.125 + */
   1.126 +VPX_CTRL_USE_TYPE(VP8_SET_REFERENCE,           vpx_ref_frame_t *)
   1.127 +VPX_CTRL_USE_TYPE(VP8_COPY_REFERENCE,          vpx_ref_frame_t *)
   1.128 +VPX_CTRL_USE_TYPE(VP8_SET_POSTPROC,            vp8_postproc_cfg_t *)
   1.129 +VPX_CTRL_USE_TYPE(VP8_SET_DBG_COLOR_REF_FRAME, int)
   1.130 +VPX_CTRL_USE_TYPE(VP8_SET_DBG_COLOR_MB_MODES,  int)
   1.131 +VPX_CTRL_USE_TYPE(VP8_SET_DBG_COLOR_B_MODES,   int)
   1.132 +VPX_CTRL_USE_TYPE(VP8_SET_DBG_DISPLAY_MV,      int)
   1.133 +VPX_CTRL_USE_TYPE(VP9_GET_REFERENCE,           vp9_ref_frame_t *)
   1.134 +
   1.135 +/*! @} - end defgroup vp8 */
   1.136 +
   1.137 +#ifdef __cplusplus
   1.138 +}  // extern "C"
   1.139 +#endif
   1.140 +
   1.141 +#endif

mercurial