strukturag / libheif

libheif is an HEIF and AVIF file format decoder and encoder.
Other
1.71k stars 298 forks source link

decode Grid image does not consider width or height is odd number #157

Open hongxiazhang opened 5 years ago

hongxiazhang commented 5 years ago

In function HeifContext::decode_full_grid_image and HeifContext::decode_and_paste_tile_image does not consider when original image width or height is odd number, when odd, for YUV420, one row or col UV is missing.

farindk commented 5 years ago

To make sure that we are talking about the same thing: do you mean that the full image has odd size or each of the tile images?

Odd sizes of the full image should of course be supported. I think I spotted the part of the code that has to be fixed, but I do not have an image to test against. Could you please attach a test image?

I checked the standard whether tile images may have odd sizes and strangely, I could not find any section that says that it is a requirement that the tile images have even size. In my view, having odd sized tiles is a very bad idea because it means that the color sampling grid changes for different parts of the image. I.e. we could only compose the tiled image in some 4:4:4 space or RGB. At the moment, I do not have a good idea how to support this such that it will not lead to false color edges. Hence, I'd prefer to consider this as a bug in the standard :-)

hongxiazhang commented 5 years ago

I mean the full image, for the tile all used 512x512. Here I attached a example image. image-00002485

farindk commented 5 years ago

Something went wrong with your image upload to github. Please have a look. You can also upload the image here: https://nextcloud.struktur.de/s/cwrZ41qozrPFaAg