[FFmpeg-devel] [PATCH] lavc/cfhd: error due to improper allocation of height in buffers

Gagandeep Singh deepgagan231197 at gmail.com
Sun Mar 25 17:20:42 EEST 2018


ticket #6675 the distortion in the bottom 8 pixels fixed
---
 libavcodec/cfhd.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/libavcodec/cfhd.c b/libavcodec/cfhd.c
index e35732df45..f10742f4fa 100644
--- a/libavcodec/cfhd.c
+++ b/libavcodec/cfhd.c
@@ -213,13 +213,14 @@ static int alloc_buffers(AVCodecContext *avctx)
         int width  = i ? avctx->width  >> chroma_x_shift : avctx->width;
         int height = i ? avctx->height >> chroma_y_shift : avctx->height;
         ptrdiff_t stride = FFALIGN(width  / 8, 8) * 8;
-        height           = FFALIGN(height / 8, 2) * 8;
+        if (chroma_y_shift)
+            height = FFALIGN(height / 8, 2) * 8;
         s->plane[i].width  = width;
         s->plane[i].height = height;
         s->plane[i].stride = stride;
 
         w8 = FFALIGN(s->plane[i].width  / 8, 8);
-        h8 = FFALIGN(s->plane[i].height / 8, 2);
+        h8 = height / 8;
         w4 = w8 * 2;
         h4 = h8 * 2;
         w2 = w4 * 2;
-- 
2.14.1



More information about the ffmpeg-devel mailing list