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 AVFrame *framep[4];
00089 AVFrame *next_framep[4];
00090 uint8_t *edge_emu_buffer;
00091
00092 uint16_t mb_width;
00093 uint16_t mb_height;
00094 int linesize;
00095 int uvlinesize;
00096
00097 uint8_t keyframe;
00098 uint8_t deblock_filter;
00099 uint8_t mbskip_enabled;
00100 uint8_t segment;
00101 uint8_t chroma_pred_mode;
00102 uint8_t profile;
00103 VP56mv mv_min;
00104 VP56mv mv_max;
00105
00106 int8_t sign_bias[4];
00107 int ref_count[3];
00108
00114 struct {
00115 uint8_t enabled;
00116 uint8_t absolute_vals;
00117 uint8_t update_map;
00118 int8_t base_quant[4];
00119 int8_t filter_level[4];
00120 } segmentation;
00121
00122 struct {
00123 uint8_t simple;
00124 uint8_t level;
00125 uint8_t sharpness;
00126 } filter;
00127
00128 VP8Macroblock *macroblocks;
00129 VP8FilterStrength *filter_strength;
00130
00131 uint8_t *intra4x4_pred_mode_top;
00132 uint8_t intra4x4_pred_mode_left[4];
00133
00139 struct {
00140
00141 int16_t luma_qmul[2];
00142 int16_t luma_dc_qmul[2];
00143 int16_t chroma_qmul[2];
00144 } qmat[4];
00145
00146 struct {
00147 uint8_t enabled;
00148
00158 int8_t mode[VP8_MVMODE_SPLIT+1];
00159
00167 int8_t ref[4];
00168 } lf_delta;
00169
00174 uint8_t (*top_border)[16+8+8];
00175
00182 uint8_t (*top_nnz)[9];
00183 DECLARE_ALIGNED(8, uint8_t, left_nnz)[9];
00184
00192 DECLARE_ALIGNED(16, uint8_t, non_zero_count_cache)[6][4];
00193 VP56RangeCoder c;
00194 DECLARE_ALIGNED(16, DCTELEM, block)[6][4][16];
00195 DECLARE_ALIGNED(16, DCTELEM, block_dc)[16];
00196 uint8_t intra4x4_pred_mode_mb[16];
00197
00204 struct {
00205 uint8_t segmentid[3];
00206 uint8_t mbskip;
00207 uint8_t intra;
00208 uint8_t last;
00209 uint8_t golden;
00210 uint8_t pred16x16[4];
00211 uint8_t pred8x8c[3];
00212 uint8_t token[4][16][3][NUM_DCT_TOKENS-1];
00213 uint8_t mvc[2][19];
00214 } prob[2];
00215
00216 VP8Macroblock *macroblocks_base;
00217 int invisible;
00218 int update_last;
00219 int update_golden;
00220 int update_altref;
00221
00226 int update_probabilities;
00227
00232 int num_coeff_partitions;
00233 VP56RangeCoder coeff_partition[8];
00234 DSPContext dsp;
00235 VP8DSPContext vp8dsp;
00236 H264PredContext hpc;
00237 vp8_mc_func put_pixels_tab[3][3][3];
00238 AVFrame frames[5];
00239
00246 uint8_t *segmentation_maps[5];
00247 int num_maps_to_be_freed;
00248 int maps_are_invalid;
00249 } VP8Context;
00250
00251 #endif