diff options
author | Ronald S. Bultje <rsbultje@gmail.com> | 2015-09-02 20:36:37 -0400 |
---|---|---|
committer | Ronald S. Bultje <rsbultje@gmail.com> | 2015-09-04 09:33:45 -0400 |
commit | 4ecb8b4191838c01d888a6b3490b31241439eb65 (patch) | |
tree | 7cf4f52c1cea404be523b90463061d9361e4bd66 | |
parent | 8b45e87f64d5986220286e8276c3782157189294 (diff) | |
download | ffmpeg-4ecb8b4191838c01d888a6b3490b31241439eb65.tar.gz |
vp9: don't erase values for {lf,ref,skip,q}_enabled if segmentation=0.
Instead, use segmentation.enabled before accessing each of these values.
-rw-r--r-- | libavcodec/vp9.c | 15 |
1 files changed, 5 insertions, 10 deletions
diff --git a/libavcodec/vp9.c b/libavcodec/vp9.c index f0f54da153..238185af20 100644 --- a/libavcodec/vp9.c +++ b/libavcodec/vp9.c @@ -777,18 +777,13 @@ static int decode_frame_header(AVCodecContext *ctx, s->segmentation.feat[i].skip_enabled = get_bits1(&s->gb); } } - } else { - s->segmentation.feat[0].q_enabled = 0; - s->segmentation.feat[0].lf_enabled = 0; - s->segmentation.feat[0].skip_enabled = 0; - s->segmentation.feat[0].ref_enabled = 0; } // set qmul[] based on Y/UV, AC/DC and segmentation Q idx deltas for (i = 0; i < (s->segmentation.enabled ? 8 : 1); i++) { int qyac, qydc, quvac, quvdc, lflvl, sh; - if (s->segmentation.feat[i].q_enabled) { + if (s->segmentation.enabled && s->segmentation.feat[i].q_enabled) { if (s->segmentation.absolute_vals) qyac = av_clip_uintp2(s->segmentation.feat[i].q_val, 8); else @@ -807,7 +802,7 @@ static int decode_frame_header(AVCodecContext *ctx, s->segmentation.feat[i].qmul[1][1] = vp9_ac_qlookup[s->bpp_index][quvac]; sh = s->filter.level >= 32; - if (s->segmentation.feat[i].lf_enabled) { + if (s->segmentation.enabled && s->segmentation.feat[i].lf_enabled) { if (s->segmentation.absolute_vals) lflvl = av_clip_uintp2(s->segmentation.feat[i].lf_val, 6); else @@ -1537,7 +1532,7 @@ static void decode_mode(AVCodecContext *ctx) if (s->keyframe || s->intraonly) { b->intra = 1; - } else if (s->segmentation.feat[b->seg_id].ref_enabled) { + } else if (s->segmentation.enabled && s->segmentation.feat[b->seg_id].ref_enabled) { b->intra = !s->segmentation.feat[b->seg_id].ref_val; } else { int c, bit; @@ -1702,7 +1697,7 @@ static void decode_mode(AVCodecContext *ctx) { 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 3, 3, 3, 4 }, }; - if (s->segmentation.feat[b->seg_id].ref_enabled) { + if (s->segmentation.enabled && s->segmentation.feat[b->seg_id].ref_enabled) { av_assert2(s->segmentation.feat[b->seg_id].ref_val != 0); b->comp = 0; b->ref[0] = s->segmentation.feat[b->seg_id].ref_val - 1; @@ -1947,7 +1942,7 @@ static void decode_mode(AVCodecContext *ctx) } if (b->bs <= BS_8x8) { - if (s->segmentation.feat[b->seg_id].skip_enabled) { + if (s->segmentation.enabled && s->segmentation.feat[b->seg_id].skip_enabled) { b->mode[0] = b->mode[1] = b->mode[2] = b->mode[3] = ZEROMV; } else { static const uint8_t off[10] = { |