From 8bcd525c4e800d7943183e851d9047bc1d6e9e0c Mon Sep 17 00:00:00 2001 From: nilfm Date: Thu, 26 Oct 2023 23:10:42 +0100 Subject: [PATCH] Fix Y4M parsing --- libvmaf/tools/vmaf.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/libvmaf/tools/vmaf.c b/libvmaf/tools/vmaf.c index 6e0b1a7a7..de9e82b95 100644 --- a/libvmaf/tools/vmaf.c +++ b/libvmaf/tools/vmaf.c @@ -89,10 +89,9 @@ static int fetch_picture(video_input *vid, VmafPicture *pic) for (unsigned i = 0; i < 3; i++) { int xdec = i&&!(info.pixel_fmt&1); int ydec = i&&!(info.pixel_fmt&2); - int xstride = info.depth > 8 ? 2 : 1; uint8_t *ycbcr_data = ycbcr[i].data + (info.pic_y >> ydec) * ycbcr[i].stride + - (info.pic_x * xstride >> xdec); + (info.pic_x >> xdec); // ^ gross, but this is how the daala y4m API works. FIXME. uint8_t *pic_data = pic->data[i]; @@ -106,10 +105,9 @@ static int fetch_picture(video_input *vid, VmafPicture *pic) for (unsigned i = 0; i < 3; i++) { int xdec = i&&!(info.pixel_fmt&1); int ydec = i&&!(info.pixel_fmt&2); - int xstride = info.depth > 8 ? 2 : 1; uint16_t *ycbcr_data = (uint16_t*) ycbcr[i].data + (info.pic_y >> ydec) * (ycbcr[i].stride / 2) + - (info.pic_x * xstride >> xdec); + (info.pic_x >> xdec); // ^ gross, but this is how the daala y4m API works. FIXME. uint16_t *pic_data = pic->data[i];