mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-01-24 13:56:33 +02:00
VP8: simplify lf_delta mb mode logic
(cherry picked from commit dd18c9a050ac1f1437151ceb2d2afbc96c5602d8)
This commit is contained in:
parent
ab543afe47
commit
8cde1b7997
@ -162,13 +162,14 @@ typedef struct {
|
||||
|
||||
/**
|
||||
* filter strength adjustment for the following macroblock modes:
|
||||
* [0] - i4x4
|
||||
* [1] - zero mv
|
||||
* [2] - inter modes except for zero or split mv
|
||||
* [3] - split mv
|
||||
* [0-3] - i16x16 (always zero)
|
||||
* [4] - i4x4
|
||||
* [5] - zero mv
|
||||
* [6] - inter modes except for zero or split mv
|
||||
* [7] - split mv
|
||||
* i16x16 modes never have any adjustment
|
||||
*/
|
||||
int8_t mode[4];
|
||||
int8_t mode[VP8_MVMODE_SPLIT+1];
|
||||
|
||||
/**
|
||||
* filter strength adjustment for macroblocks that reference:
|
||||
@ -278,7 +279,7 @@ static void update_lf_deltas(VP8Context *s)
|
||||
for (i = 0; i < 4; i++)
|
||||
s->lf_delta.ref[i] = vp8_rac_get_sint(c, 6);
|
||||
|
||||
for (i = 0; i < 4; i++)
|
||||
for (i = MODE_I4x4; i <= VP8_MVMODE_SPLIT; i++)
|
||||
s->lf_delta.mode[i] = vp8_rac_get_sint(c, 6);
|
||||
}
|
||||
|
||||
@ -762,6 +763,7 @@ void decode_mb_mode(VP8Context *s, VP8Macroblock *mb, int mb_x, int mb_y, uint8_
|
||||
// motion vectors, 16.3
|
||||
find_near_mvs(s, mb, near, &best, cnt);
|
||||
if (vp56_rac_get_prob_branchy(c, vp8_mode_contexts[cnt[0]][0])) {
|
||||
mb->mode = VP8_MVMODE_MV;
|
||||
if (vp56_rac_get_prob_branchy(c, vp8_mode_contexts[cnt[1]][1])) {
|
||||
if (vp56_rac_get_prob_branchy(c, vp8_mode_contexts[cnt[2]][2])) {
|
||||
if (vp56_rac_get_prob_branchy(c, vp8_mode_contexts[cnt[3]][3])) {
|
||||
@ -769,19 +771,14 @@ void decode_mb_mode(VP8Context *s, VP8Macroblock *mb, int mb_x, int mb_y, uint8_
|
||||
clamp_mv(s, &mb->mv, &mb->mv, mb_x, mb_y);
|
||||
mb->mv = mb->bmv[decode_splitmvs(s, c, mb) - 1];
|
||||
} else {
|
||||
mb->mode = VP8_MVMODE_NEW;
|
||||
clamp_mv(s, &mb->mv, &mb->mv, mb_x, mb_y);
|
||||
mb->mv.y += read_mv_component(c, s->prob->mvc[0]);
|
||||
mb->mv.x += read_mv_component(c, s->prob->mvc[1]);
|
||||
}
|
||||
} else {
|
||||
mb->mode = VP8_MVMODE_NEAR;
|
||||
} else
|
||||
clamp_mv(s, &mb->mv, &near[1], mb_x, mb_y);
|
||||
}
|
||||
} else {
|
||||
mb->mode = VP8_MVMODE_NEAREST;
|
||||
} else
|
||||
clamp_mv(s, &mb->mv, &near[0], mb_x, mb_y);
|
||||
}
|
||||
} else {
|
||||
mb->mode = VP8_MVMODE_ZERO;
|
||||
AV_ZERO32(&mb->mv);
|
||||
@ -1481,18 +1478,7 @@ static av_always_inline void filter_level_for_mb(VP8Context *s, VP8Macroblock *m
|
||||
|
||||
if (s->lf_delta.enabled) {
|
||||
filter_level += s->lf_delta.ref[mb->ref_frame];
|
||||
|
||||
if (mb->ref_frame == VP56_FRAME_CURRENT) {
|
||||
if (mb->mode == MODE_I4x4)
|
||||
filter_level += s->lf_delta.mode[0];
|
||||
} else {
|
||||
if (mb->mode == VP8_MVMODE_ZERO)
|
||||
filter_level += s->lf_delta.mode[1];
|
||||
else if (mb->mode == VP8_MVMODE_SPLIT)
|
||||
filter_level += s->lf_delta.mode[3];
|
||||
else
|
||||
filter_level += s->lf_delta.mode[2];
|
||||
}
|
||||
filter_level += s->lf_delta.mode[mb->mode];
|
||||
}
|
||||
filter_level = av_clip(filter_level, 0, 63);
|
||||
|
||||
|
@ -48,10 +48,8 @@ enum dct_token {
|
||||
#define MODE_I4x4 4
|
||||
|
||||
enum inter_mvmode {
|
||||
VP8_MVMODE_NEAREST = MODE_I4x4 + 1,
|
||||
VP8_MVMODE_NEAR,
|
||||
VP8_MVMODE_ZERO,
|
||||
VP8_MVMODE_NEW,
|
||||
VP8_MVMODE_ZERO = MODE_I4x4 + 1,
|
||||
VP8_MVMODE_MV,
|
||||
VP8_MVMODE_SPLIT
|
||||
};
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user