00001
00025 #ifndef AVCODEC_VP8_H
00026 #define AVCODEC_VP8_H
00027
00028 #include "vp56.h"
00029 #include "vp56data.h"
00030 #include "vp8dsp.h"
00031 #include "h264pred.h"
00032
00033 #define VP8_MAX_QUANT 127
00034
00035 enum dct_token {
00036 DCT_0,
00037 DCT_1,
00038 DCT_2,
00039 DCT_3,
00040 DCT_4,
00041 DCT_CAT1,
00042 DCT_CAT2,
00043 DCT_CAT3,
00044 DCT_CAT4,
00045 DCT_CAT5,
00046 DCT_CAT6,
00047 DCT_EOB,
00048
00049 NUM_DCT_TOKENS
00050 };
00051
00052
00053 #define MODE_I4x4 4
00054
00055 enum inter_mvmode {
00056 VP8_MVMODE_ZERO = MODE_I4x4 + 1,
00057 VP8_MVMODE_MV,
00058 VP8_MVMODE_SPLIT
00059 };
00060
00061 enum inter_splitmvmode {
00062 VP8_SPLITMVMODE_16x8 = 0,
00063 VP8_SPLITMVMODE_8x16,
00064 VP8_SPLITMVMODE_8x8,
00065 VP8_SPLITMVMODE_4x4,
00066 VP8_SPLITMVMODE_NONE,
00067 };
00068
00069 typedef struct {
00070 uint8_t filter_level;
00071 uint8_t inner_limit;
00072 uint8_t inner_filter;
00073 } VP8FilterStrength;
00074
00075 typedef struct {
00076 uint8_t skip;
00077
00078
00079 uint8_t mode;
00080 uint8_t ref_frame;
00081 uint8_t partitioning;
00082 VP56mv mv;
00083 VP56mv bmv[16];
00084 } VP8Macroblock;
00085
00086 typedef struct {
00087 AVCodecContext *avctx;
00088 DSPContext dsp;
00089 VP8DSPContext vp8dsp;
00090 H264PredContext hpc;
00091 vp8_mc_func put_pixels_tab[3][3][3];
00092 AVFrame frames[4];
00093 AVFrame *framep[4];
00094 uint8_t *edge_emu_buffer;
00095 VP56RangeCoder c;
00096 int profile;
00097
00098 int mb_width;
00099 int mb_height;
00100 int linesize;
00101 int uvlinesize;
00102
00103 int keyframe;
00104 int invisible;
00105 int update_last;
00106 int update_golden;
00107 int update_altref;
00108 int deblock_filter;
00109
00114 int update_probabilities;
00115
00120 int num_coeff_partitions;
00121 VP56RangeCoder coeff_partition[8];
00122
00123 VP8Macroblock *macroblocks;
00124 VP8Macroblock *macroblocks_base;
00125 VP8FilterStrength *filter_strength;
00126
00127 uint8_t *intra4x4_pred_mode_top;
00128 uint8_t intra4x4_pred_mode_left[4];
00129 uint8_t *segmentation_map;
00130
00135 uint8_t (*top_border)[16+8+8];
00136
00143 uint8_t (*top_nnz)[9];
00144 DECLARE_ALIGNED(8, uint8_t, left_nnz)[9];
00145
00153 DECLARE_ALIGNED(16, uint8_t, non_zero_count_cache)[6][4];
00154 DECLARE_ALIGNED(16, DCTELEM, block)[6][4][16];
00155 DECLARE_ALIGNED(16, DCTELEM, block_dc)[16];
00156 uint8_t intra4x4_pred_mode_mb[16];
00157
00158 int chroma_pred_mode;
00159 int segment;
00160 VP56mv mv_min;
00161 VP56mv mv_max;
00162
00163 int mbskip_enabled;
00164 int sign_bias[4];
00165 int ref_count[3];
00166
00172 struct {
00173 int enabled;
00174 int absolute_vals;
00175 int update_map;
00176 int8_t base_quant[4];
00177 int8_t filter_level[4];
00178 } segmentation;
00179
00185 struct {
00186
00187 int16_t luma_qmul[2];
00188 int16_t luma_dc_qmul[2];
00189 int16_t chroma_qmul[2];
00190 } qmat[4];
00191
00192 struct {
00193 int simple;
00194 int level;
00195 int sharpness;
00196 } filter;
00197
00198 struct {
00199 int enabled;
00200
00210 int8_t mode[VP8_MVMODE_SPLIT+1];
00211
00219 int8_t ref[4];
00220 } lf_delta;
00221
00228 struct {
00229 uint8_t segmentid[3];
00230 uint8_t mbskip;
00231 uint8_t intra;
00232 uint8_t last;
00233 uint8_t golden;
00234 uint8_t pred16x16[4];
00235 uint8_t pred8x8c[3];
00236
00237 uint8_t token[4][17][3][NUM_DCT_TOKENS-1];
00238 uint8_t mvc[2][19];
00239 } prob[2];
00240 } VP8Context;
00241
00242 #endif