aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJason Garrett-Glaser <jason@x264.com>2011-02-03 19:17:13 -0800
committerMichael Niedermayer <michaelni@gmx.at>2011-02-06 20:31:43 +0100
commit8cde1b7997b92a2be01f2c0e2c88b9b10e799756 (patch)
tree844b10a15e553bf7970b37609c365c99b2f75888
parentab543afe47c5bc63622acce775189bb920638126 (diff)
downloadffmpeg-8cde1b7997b92a2be01f2c0e2c88b9b10e799756.tar.gz
VP8: simplify lf_delta mb mode logic
(cherry picked from commit dd18c9a050ac1f1437151ceb2d2afbc96c5602d8)
-rw-r--r--libavcodec/vp8.c36
-rw-r--r--libavcodec/vp8data.h6
2 files changed, 13 insertions, 29 deletions
diff --git a/libavcodec/vp8.c b/libavcodec/vp8.c
index effeb4ed2f..bcf623790c 100644
--- a/libavcodec/vp8.c
+++ b/libavcodec/vp8.c
@@ -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);
diff --git a/libavcodec/vp8data.h b/libavcodec/vp8data.h
index 775472e8e8..5326e21c0c 100644
--- a/libavcodec/vp8data.h
+++ b/libavcodec/vp8data.h
@@ -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
};