|
|
|
@ -123,10 +123,6 @@ typedef struct { |
|
|
|
|
int segment; ///< segment of the current macroblock
|
|
|
|
|
|
|
|
|
|
int mbskip_enabled; |
|
|
|
|
uint8_t mbskip_proba; |
|
|
|
|
uint8_t intra_proba; |
|
|
|
|
uint8_t last_proba; |
|
|
|
|
uint8_t golden_proba; |
|
|
|
|
int sign_bias[4]; ///< one state [0, 1] per ref frame type
|
|
|
|
|
int ref_count[3]; |
|
|
|
|
|
|
|
|
@ -192,6 +188,10 @@ typedef struct { |
|
|
|
|
*/ |
|
|
|
|
struct { |
|
|
|
|
uint8_t segmentid[3]; |
|
|
|
|
uint8_t mbskip; |
|
|
|
|
uint8_t intra; |
|
|
|
|
uint8_t last; |
|
|
|
|
uint8_t golden; |
|
|
|
|
uint8_t pred16x16[4]; |
|
|
|
|
uint8_t pred8x8c[3]; |
|
|
|
|
uint8_t token[4][8][3][NUM_DCT_TOKENS-1]; |
|
|
|
@ -343,9 +343,12 @@ static void get_quants(VP8Context *s) |
|
|
|
|
s->qmat[i].luma_qmul[0] = vp8_dc_qlookup[av_clip(base_qi + ydc_delta , 0, 127)]; |
|
|
|
|
s->qmat[i].luma_qmul[1] = vp8_ac_qlookup[av_clip(base_qi , 0, 127)]; |
|
|
|
|
s->qmat[i].luma_dc_qmul[0] = 2 * vp8_dc_qlookup[av_clip(base_qi + y2dc_delta, 0, 127)]; |
|
|
|
|
s->qmat[i].luma_dc_qmul[1] = 155 * vp8_ac_qlookup[av_clip(base_qi + y2ac_delta, 2, 127)] / 100; |
|
|
|
|
s->qmat[i].chroma_qmul[0] = vp8_dc_qlookup[av_clip(base_qi + uvdc_delta, 0, 117)]; |
|
|
|
|
s->qmat[i].luma_dc_qmul[1] = 155 * vp8_ac_qlookup[av_clip(base_qi + y2ac_delta, 0, 127)] / 100; |
|
|
|
|
s->qmat[i].chroma_qmul[0] = vp8_dc_qlookup[av_clip(base_qi + uvdc_delta, 0, 127)]; |
|
|
|
|
s->qmat[i].chroma_qmul[1] = vp8_ac_qlookup[av_clip(base_qi + uvac_delta, 0, 127)]; |
|
|
|
|
|
|
|
|
|
s->qmat[i].luma_dc_qmul[1] = FFMAX(s->qmat[i].luma_dc_qmul[1], 8); |
|
|
|
|
s->qmat[i].chroma_qmul[0] = FFMIN(s->qmat[i].chroma_qmul[0], 132); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -496,12 +499,12 @@ static int decode_frame_header(VP8Context *s, const uint8_t *buf, int buf_size) |
|
|
|
|
s->prob->token[i][j][k][l] = vp8_rac_get_uint(c, 8); |
|
|
|
|
|
|
|
|
|
if ((s->mbskip_enabled = vp8_rac_get(c))) |
|
|
|
|
s->mbskip_proba = vp8_rac_get_uint(c, 8); |
|
|
|
|
s->prob->mbskip = vp8_rac_get_uint(c, 8); |
|
|
|
|
|
|
|
|
|
if (!s->keyframe) { |
|
|
|
|
s->intra_proba = vp8_rac_get_uint(c, 8); |
|
|
|
|
s->last_proba = vp8_rac_get_uint(c, 8); |
|
|
|
|
s->golden_proba = vp8_rac_get_uint(c, 8); |
|
|
|
|
s->prob->intra = vp8_rac_get_uint(c, 8); |
|
|
|
|
s->prob->last = vp8_rac_get_uint(c, 8); |
|
|
|
|
s->prob->golden = vp8_rac_get_uint(c, 8); |
|
|
|
|
|
|
|
|
|
if (vp8_rac_get(c)) |
|
|
|
|
for (i = 0; i < 4; i++) |
|
|
|
@ -722,7 +725,7 @@ void decode_mb_mode(VP8Context *s, VP8Macroblock *mb, int mb_x, int mb_y, |
|
|
|
|
*segment = vp8_rac_get_tree(c, vp8_segmentid_tree, s->prob->segmentid); |
|
|
|
|
s->segment = *segment; |
|
|
|
|
|
|
|
|
|
mb->skip = s->mbskip_enabled ? vp56_rac_get_prob(c, s->mbskip_proba) : 0; |
|
|
|
|
mb->skip = s->mbskip_enabled ? vp56_rac_get_prob(c, s->prob->mbskip) : 0; |
|
|
|
|
|
|
|
|
|
if (s->keyframe) { |
|
|
|
|
mb->mode = vp8_rac_get_tree(c, vp8_pred16x16_tree_intra, vp8_pred16x16_prob_intra); |
|
|
|
@ -734,14 +737,14 @@ void decode_mb_mode(VP8Context *s, VP8Macroblock *mb, int mb_x, int mb_y, |
|
|
|
|
|
|
|
|
|
s->chroma_pred_mode = vp8_rac_get_tree(c, vp8_pred8x8c_tree, vp8_pred8x8c_prob_intra); |
|
|
|
|
mb->ref_frame = VP56_FRAME_CURRENT; |
|
|
|
|
} else if (vp56_rac_get_prob_branchy(c, s->intra_proba)) { |
|
|
|
|
} else if (vp56_rac_get_prob_branchy(c, s->prob->intra)) { |
|
|
|
|
VP56mv near[2], best; |
|
|
|
|
uint8_t cnt[4] = { 0 }; |
|
|
|
|
uint8_t p[4]; |
|
|
|
|
|
|
|
|
|
// inter MB, 16.2
|
|
|
|
|
if (vp56_rac_get_prob_branchy(c, s->last_proba)) |
|
|
|
|
mb->ref_frame = vp56_rac_get_prob(c, s->golden_proba) ? |
|
|
|
|
if (vp56_rac_get_prob_branchy(c, s->prob->last)) |
|
|
|
|
mb->ref_frame = vp56_rac_get_prob(c, s->prob->golden) ? |
|
|
|
|
VP56_FRAME_GOLDEN2 /* altref */ : VP56_FRAME_GOLDEN; |
|
|
|
|
else |
|
|
|
|
mb->ref_frame = VP56_FRAME_PREVIOUS; |
|
|
|
|