[FFmpeg-cvslog] lavc, lavfi: fix calculating the plane size in the AVBufferRef wrappers

Anton Khirnov git at videolan.org
Sun Mar 17 13:04:36 CET 2013


ffmpeg | branch: master | Anton Khirnov <anton at khirnov.net> | Sat Mar 16 18:09:17 2013 +0100| [6552808014ae318c8feaa8effac6ee40ea6019ce] | committer: Anton Khirnov

lavc,lavfi: fix calculating the plane size in the AVBufferRef wrappers

It is supposed to be height * linesize, not width * linesize.
Thanks to Hendrik Leppkes for pointing out the bug.

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

 libavcodec/utils.c      |    4 ++--
 libavfilter/buffersrc.c |    4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/libavcodec/utils.c b/libavcodec/utils.c
index 818dc57..4d57865 100644
--- a/libavcodec/utils.c
+++ b/libavcodec/utils.c
@@ -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);
             }
diff --git a/libavfilter/buffersrc.c b/libavfilter/buffersrc.c
index d35b302..65cacf7 100644
--- a/libavfilter/buffersrc.c
+++ b/libavfilter/buffersrc.c
@@ -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);
         }



More information about the ffmpeg-cvslog mailing list