[FFmpeg-cvslog] vp9: maintain lf_delta values if feature is turned off.

Ronald S. Bultje git at videolan.org
Thu Apr 23 17:00:34 CEST 2015


ffmpeg | branch: master | Ronald S. Bultje <rsbultje at gmail.com> | Wed Apr 22 11:51:02 2015 -0400| [c82e870c12b263efe8c1b850c5c289bea6cb45a6] | committer: Michael Niedermayer

vp9: maintain lf_delta values if feature is turned off.

This is required if it's subsequently re-enabled with no value updates
(which means, use values that were previously set).

Signed-off-by: Michael Niedermayer <michaelni at gmx.at>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=c82e870c12b263efe8c1b850c5c289bea6cb45a6
---

 libavcodec/vp9.c |   27 +++++++++++++++------------
 1 file changed, 15 insertions(+), 12 deletions(-)

diff --git a/libavcodec/vp9.c b/libavcodec/vp9.c
index ee73325..b3d6d86 100644
--- a/libavcodec/vp9.c
+++ b/libavcodec/vp9.c
@@ -622,8 +622,6 @@ static int decode_frame_header(AVCodecContext *ctx,
                 if (get_bits1(&s->gb))
                     s->lf_delta.mode[i] = get_sbits_inv(&s->gb, 6);
         }
-    } else {
-        memset(&s->lf_delta, 0, sizeof(s->lf_delta));
     }
 
     /* quantization header data */
@@ -705,16 +703,21 @@ static int decode_frame_header(AVCodecContext *ctx,
         } else {
             lflvl  = s->filter.level;
         }
-        s->segmentation.feat[i].lflvl[0][0] =
-        s->segmentation.feat[i].lflvl[0][1] =
-            av_clip_uintp2(lflvl + (s->lf_delta.ref[0] << sh), 6);
-        for (j = 1; j < 4; j++) {
-            s->segmentation.feat[i].lflvl[j][0] =
-                av_clip_uintp2(lflvl + ((s->lf_delta.ref[j] +
-                                         s->lf_delta.mode[0]) * (1 << sh)), 6);
-            s->segmentation.feat[i].lflvl[j][1] =
-                av_clip_uintp2(lflvl + ((s->lf_delta.ref[j] +
-                                         s->lf_delta.mode[1]) * (1 << sh)), 6);
+        if (s->lf_delta.enabled) {
+            s->segmentation.feat[i].lflvl[0][0] =
+            s->segmentation.feat[i].lflvl[0][1] =
+                av_clip_uintp2(lflvl + (s->lf_delta.ref[0] << sh), 6);
+            for (j = 1; j < 4; j++) {
+                s->segmentation.feat[i].lflvl[j][0] =
+                    av_clip_uintp2(lflvl + ((s->lf_delta.ref[j] +
+                                             s->lf_delta.mode[0]) * (1 << sh)), 6);
+                s->segmentation.feat[i].lflvl[j][1] =
+                    av_clip_uintp2(lflvl + ((s->lf_delta.ref[j] +
+                                             s->lf_delta.mode[1]) * (1 << sh)), 6);
+            }
+        } else {
+            memset(s->segmentation.feat[i].lflvl, lflvl,
+                   sizeof(s->segmentation.feat[i].lflvl));
         }
     }
 



More information about the ffmpeg-cvslog mailing list