lavc,lavfi: fix calculating the plane size in the AVBufferRef wrappers
authorAnton Khirnov <anton@khirnov.net>
Sat, 16 Mar 2013 17:09:17 +0000 (18:09 +0100)
committerAnton Khirnov <anton@khirnov.net>
Sun, 17 Mar 2013 08:10:04 +0000 (09:10 +0100)
It is supposed to be height * linesize, not width * linesize.
Thanks to Hendrik Leppkes for pointing out the bug.

libavcodec/utils.c
libavfilter/buffersrc.c

index 818dc5773e42720095e721e0cf49fd74cd868f51..4d57865629120f1ffc7b315c9b413c70a9099e6a 100644 (file)
@@ -667,8 +667,8 @@ do {                                                                    \
             planes = (desc->flags & PIX_FMT_PLANAR) ? desc->nb_components : 1;
 
             for (i = 0; i < planes; i++) {
-                int h_shift    = (i == 1 || i == 2) ? desc->log2_chroma_h : 0;
-                int plane_size = (frame->width >> h_shift) * frame->linesize[i];
+                int v_shift    = (i == 1 || i == 2) ? desc->log2_chroma_h : 0;
+                int plane_size = (frame->height >> v_shift) * frame->linesize[i];
 
                 WRAP_PLANE(frame->buf[i], frame->data[i], plane_size);
             }
index d35b302a9e70c74bfeb83d8651a5cb7ce53a572c..65cacf7d8514e14b8d5fb10eb27cc74876252509 100644 (file)
@@ -193,8 +193,8 @@ do {                                                                    \
         planes = (desc->flags & PIX_FMT_PLANAR) ? desc->nb_components : 1;
 
         for (i = 0; i < planes; i++) {
-            int h_shift    = (i == 1 || i == 2) ? desc->log2_chroma_h : 0;
-            int plane_size = (frame->width >> h_shift) * frame->linesize[i];
+            int v_shift    = (i == 1 || i == 2) ? desc->log2_chroma_w : 0;
+            int plane_size = (frame->height >> v_shift) * frame->linesize[i];
 
             WRAP_PLANE(frame->buf[i], frame->data[i], plane_size);
         }