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; diff --git a/tests/ref/fate/cfhd-3 b/tests/ref/fate/cfhd-3 index 60e13c64a7..59fdc92260 100644 --- a/tests/ref/fate/cfhd-3 +++ b/tests/ref/fate/cfhd-3 @@ -3,13 +3,13 @@ #codec_id 0: rawvideo #dimensions 0: 496x241 #sar 0: 0/1 -0, 0, 0, 1, 478144, 0x6ed01dcd -0, 1, 1, 1, 478144, 0x6ed01dcd -0, 2, 2, 1, 478144, 0x6ed01dcd -0, 3, 3, 1, 478144, 0xb1b4a74b -0, 4, 4, 1, 478144, 0x94c345c3 -0, 5, 5, 1, 478144, 0x05e0388d -0, 6, 6, 1, 478144, 0xe747476a -0, 7, 7, 1, 478144, 0x8c1561f1 -0, 8, 8, 1, 478144, 0x8c1561f1 -0, 9, 9, 1, 478144, 0x8c1561f1 +0, 0, 0, 1, 478144, 0x48a01dbb +0, 1, 1, 1, 478144, 0x48a01dbb +0, 2, 2, 1, 478144, 0x48a01dbb +0, 3, 3, 1, 478144, 0xb978a72f +0, 4, 4, 1, 478144, 0x7bbb4679 +0, 5, 5, 1, 478144, 0xc3fd3f59 +0, 6, 6, 1, 478144, 0xfd2a4816 +0, 7, 7, 1, 478144, 0x207f65d3 +0, 8, 8, 1, 478144, 0x207f65d3 +0, 9, 9, 1, 478144, 0x207f65d3