[FFmpeg-cvslog] avcodec/webp: Factor update_canvas_size() out

Michael Niedermayer git at videolan.org
Sun May 14 19:44:42 EEST 2017


ffmpeg | branch: release/3.3 | Michael Niedermayer <michael at niedermayer.cc> | Mon May  8 14:43:02 2017 +0200| [d93a5a8d11f2b48e00e9d4b176de84f9af101157] | committer: Michael Niedermayer

avcodec/webp: Factor update_canvas_size() out

Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
(cherry picked from commit c4f63b78b71e07dd2f5d49c032d9c3eef620c0f3)
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>

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

 libavcodec/webp.c | 27 +++++++++++++++++----------
 1 file changed, 17 insertions(+), 10 deletions(-)

diff --git a/libavcodec/webp.c b/libavcodec/webp.c
index 147d85f15b..3fef45603c 100644
--- a/libavcodec/webp.c
+++ b/libavcodec/webp.c
@@ -1099,6 +1099,21 @@ static int apply_color_indexing_transform(WebPContext *s)
     return 0;
 }
 
+static void update_canvas_size(AVCodecContext *avctx, int w, int h)
+{
+    WebPContext *s = avctx->priv_data;
+    if (s->width && s->width != w) {
+        av_log(avctx, AV_LOG_WARNING, "Width mismatch. %d != %d\n",
+               s->width, w);
+    }
+    s->width = w;
+    if (s->height && s->height != h) {
+        av_log(avctx, AV_LOG_WARNING, "Height mismatch. %d != %d\n",
+               s->height, h);
+    }
+    s->height = h;
+}
+
 static int vp8_lossless_decode_frame(AVCodecContext *avctx, AVFrame *p,
                                      int *got_frame, uint8_t *data_start,
                                      unsigned int data_size, int is_alpha_chunk)
@@ -1123,16 +1138,8 @@ static int vp8_lossless_decode_frame(AVCodecContext *avctx, AVFrame *p,
 
         w = get_bits(&s->gb, 14) + 1;
         h = get_bits(&s->gb, 14) + 1;
-        if (s->width && s->width != w) {
-            av_log(avctx, AV_LOG_WARNING, "Width mismatch. %d != %d\n",
-                   s->width, w);
-        }
-        s->width = w;
-        if (s->height && s->height != h) {
-            av_log(avctx, AV_LOG_WARNING, "Height mismatch. %d != %d\n",
-                   s->width, w);
-        }
-        s->height = h;
+
+        update_canvas_size(avctx, w, h);
 
         ret = ff_set_dimensions(avctx, s->width, s->height);
         if (ret < 0)



More information about the ffmpeg-cvslog mailing list