From 94b15d9879608e4c1bc763d204736841f4f2bde7 Mon Sep 17 00:00:00 2001 From: Dirk Farin Date: Tue, 29 Oct 2024 12:18:27 +0100 Subject: [PATCH] unci: fix tests for 16bit YCbCr 4:2:2 (#1256) --- tests/uncompressed_decode_ycbcr422.cc | 494 +++++++++----------------- 1 file changed, 168 insertions(+), 326 deletions(-) diff --git a/tests/uncompressed_decode_ycbcr422.cc b/tests/uncompressed_decode_ycbcr422.cc index 8baa983130..abcb399cdf 100644 --- a/tests/uncompressed_decode_ycbcr422.cc +++ b/tests/uncompressed_decode_ycbcr422.cc @@ -457,379 +457,221 @@ void check_image_content_ycbcr422_16bit(struct heif_context *&context) { heif_image *img = get_primary_image_ycbcr(handle, heif_chroma_422); int stride; - const uint8_t *img_plane = - heif_image_get_plane_readonly(img, heif_channel_Y, &stride); + const uint16_t *img_plane = + (const uint16_t*)heif_image_get_plane_readonly(img, heif_channel_Y, &stride); REQUIRE(stride == 128); + stride /= 2; for (int row = 0; row < 4; row++) { INFO("row: " << row); - REQUIRE(((int)(img_plane[stride * row + 0])) == 0x8A); - REQUIRE(((int)(img_plane[stride * row + 1])) == 0x4C); - REQUIRE(((int)(img_plane[stride * row + 2])) == 0x8A); - REQUIRE(((int)(img_plane[stride * row + 3])) == 0x4C); - REQUIRE(((int)(img_plane[stride * row + 4])) == 0x8A); - REQUIRE(((int)(img_plane[stride * row + 5])) == 0x4C); - REQUIRE(((int)(img_plane[stride * row + 6])) == 0x8A); - REQUIRE(((int)(img_plane[stride * row + 7])) == 0x4C); - REQUIRE(((int)(img_plane[stride * row + 8])) == 0x6D); - REQUIRE(((int)(img_plane[stride * row + 9])) == 0x4B); - REQUIRE(((int)(img_plane[stride * row + 10])) == 0x6D); - REQUIRE(((int)(img_plane[stride * row + 11])) == 0x4B); - REQUIRE(((int)(img_plane[stride * row + 12])) == 0x6D); - REQUIRE(((int)(img_plane[stride * row + 13])) == 0x4B); - REQUIRE(((int)(img_plane[stride * row + 14])) == 0x6D); - REQUIRE(((int)(img_plane[stride * row + 15])) == 0x4B); - REQUIRE(((int)(img_plane[stride * row + 16])) == 0x2E); - REQUIRE(((int)(img_plane[stride * row + 17])) == 0x1D); - REQUIRE(((int)(img_plane[stride * row + 18])) == 0x2E); - REQUIRE(((int)(img_plane[stride * row + 19])) == 0x1D); - REQUIRE(((int)(img_plane[stride * row + 20])) == 0x2E); - REQUIRE(((int)(img_plane[stride * row + 21])) == 0x1D); - REQUIRE(((int)(img_plane[stride * row + 22])) == 0x2E); - REQUIRE(((int)(img_plane[stride * row + 23])) == 0x1D); - REQUIRE(((int)(img_plane[stride * row + 24])) == 0xFE); - REQUIRE(((int)(img_plane[stride * row + 25])) == 0xFF); - REQUIRE(((int)(img_plane[stride * row + 26])) == 0xFE); - REQUIRE(((int)(img_plane[stride * row + 27])) == 0xFF); - REQUIRE(((int)(img_plane[stride * row + 28])) == 0xFE); - REQUIRE(((int)(img_plane[stride * row + 29])) == 0xFF); - REQUIRE(((int)(img_plane[stride * row + 30])) == 0xFE); - REQUIRE(((int)(img_plane[stride * row + 31])) == 0xFF); - REQUIRE(((int)(img_plane[stride * row + 32])) == 0x00); - REQUIRE(((int)(img_plane[stride * row + 33])) == 0x00); - REQUIRE(((int)(img_plane[stride * row + 34])) == 0x00); - REQUIRE(((int)(img_plane[stride * row + 35])) == 0x00); - REQUIRE(((int)(img_plane[stride * row + 36])) == 0x00); - REQUIRE(((int)(img_plane[stride * row + 37])) == 0x00); - REQUIRE(((int)(img_plane[stride * row + 38])) == 0x00); - REQUIRE(((int)(img_plane[stride * row + 39])) == 0x00); - REQUIRE(((int)(img_plane[stride * row + 40])) == 0xD0); - REQUIRE(((int)(img_plane[stride * row + 41])) == 0xE2); - REQUIRE(((int)(img_plane[stride * row + 42])) == 0xD0); - REQUIRE(((int)(img_plane[stride * row + 43])) == 0xE2); - REQUIRE(((int)(img_plane[stride * row + 44])) == 0xD0); - REQUIRE(((int)(img_plane[stride * row + 45])) == 0xE2); - REQUIRE(((int)(img_plane[stride * row + 46])) == 0xD0); - REQUIRE(((int)(img_plane[stride * row + 47])) == 0xE2); - REQUIRE(((int)(img_plane[stride * row + 48])) == 0x74); - REQUIRE(((int)(img_plane[stride * row + 49])) == 0xB3); - REQUIRE(((int)(img_plane[stride * row + 50])) == 0x74); - REQUIRE(((int)(img_plane[stride * row + 51])) == 0xB3); - REQUIRE(((int)(img_plane[stride * row + 52])) == 0x74); - REQUIRE(((int)(img_plane[stride * row + 53])) == 0xB3); - REQUIRE(((int)(img_plane[stride * row + 54])) == 0x74); - REQUIRE(((int)(img_plane[stride * row + 55])) == 0xB3); - REQUIRE(((int)(img_plane[stride * row + 56])) == 0x80); - REQUIRE(((int)(img_plane[stride * row + 57])) == 0x80); - REQUIRE(((int)(img_plane[stride * row + 59])) == 0x80); - REQUIRE(((int)(img_plane[stride * row + 59])) == 0x80); - REQUIRE(((int)(img_plane[stride * row + 60])) == 0x80); - REQUIRE(((int)(img_plane[stride * row + 61])) == 0x80); - REQUIRE(((int)(img_plane[stride * row + 62])) == 0x80); - REQUIRE(((int)(img_plane[stride * row + 63])) == 0x80); + REQUIRE(((int)(img_plane[stride * row + 0])) == 0x4C8A); + REQUIRE(((int)(img_plane[stride * row + 1])) == 0x4C8A); + REQUIRE(((int)(img_plane[stride * row + 2])) == 0x4C8A); + REQUIRE(((int)(img_plane[stride * row + 3])) == 0x4C8A); + REQUIRE(((int)(img_plane[stride * row + 4])) == 0x4B6D); + REQUIRE(((int)(img_plane[stride * row + 5])) == 0x4B6D); + REQUIRE(((int)(img_plane[stride * row + 6])) == 0x4B6D); + REQUIRE(((int)(img_plane[stride * row + 7])) == 0x4B6D); + REQUIRE(((int)(img_plane[stride * row + 8])) == 0x1D2E); + REQUIRE(((int)(img_plane[stride * row + 9])) == 0x1D2E); + REQUIRE(((int)(img_plane[stride * row + 10])) == 0x1D2E); + REQUIRE(((int)(img_plane[stride * row + 11])) == 0x1D2E); + REQUIRE(((int)(img_plane[stride * row + 12])) == 0xFFFE); + REQUIRE(((int)(img_plane[stride * row + 13])) == 0xFFFE); + REQUIRE(((int)(img_plane[stride * row + 14])) == 0xFFFE); + REQUIRE(((int)(img_plane[stride * row + 15])) == 0xFFFE); + REQUIRE(((int)(img_plane[stride * row + 16])) == 0x0000); + REQUIRE(((int)(img_plane[stride * row + 17])) == 0x0000); + REQUIRE(((int)(img_plane[stride * row + 18])) == 0x0000); + REQUIRE(((int)(img_plane[stride * row + 19])) == 0x0000); + REQUIRE(((int)(img_plane[stride * row + 20])) == 0xE2D0); + REQUIRE(((int)(img_plane[stride * row + 21])) == 0xE2D0); + REQUIRE(((int)(img_plane[stride * row + 22])) == 0xE2D0); + REQUIRE(((int)(img_plane[stride * row + 23])) == 0xE2D0); + REQUIRE(((int)(img_plane[stride * row + 24])) == 0xB374); + REQUIRE(((int)(img_plane[stride * row + 25])) == 0xB374); + REQUIRE(((int)(img_plane[stride * row + 26])) == 0xB374); + REQUIRE(((int)(img_plane[stride * row + 27])) == 0xB374); + REQUIRE(((int)(img_plane[stride * row + 28])) == 0x8080); + REQUIRE(((int)(img_plane[stride * row + 29])) == 0x8080); + REQUIRE(((int)(img_plane[stride * row + 30])) == 0x8080); + REQUIRE(((int)(img_plane[stride * row + 31])) == 0x8080); } for (int row = 4; row < 8; row++) { INFO("row: " << row); - REQUIRE(((int)(img_plane[stride * row + 0])) == 0x6D); - REQUIRE(((int)(img_plane[stride * row + 3])) == 0x4B); - REQUIRE(((int)(img_plane[stride * row + 4])) == 0x6D); - REQUIRE(((int)(img_plane[stride * row + 7])) == 0x4B); - REQUIRE(((int)(img_plane[stride * row + 8])) == 0x2E); - REQUIRE(((int)(img_plane[stride * row + 15])) == 0x1D); - REQUIRE(((int)(img_plane[stride * row + 16])) == 0xFE); - REQUIRE(((int)(img_plane[stride * row + 23])) == 0xFF); - REQUIRE(((int)(img_plane[stride * row + 24])) == 0x00); - REQUIRE(((int)(img_plane[stride * row + 31])) == 0x00); - REQUIRE(((int)(img_plane[stride * row + 32])) == 0xD0); - REQUIRE(((int)(img_plane[stride * row + 39])) == 0xE2); - REQUIRE(((int)(img_plane[stride * row + 40])) == 0x74); - REQUIRE(((int)(img_plane[stride * row + 47])) == 0xB3); - REQUIRE(((int)(img_plane[stride * row + 48])) == 0x80); - REQUIRE(((int)(img_plane[stride * row + 55])) == 0x80); - REQUIRE(((int)(img_plane[stride * row + 56])) == 0xC6); - REQUIRE(((int)(img_plane[stride * row + 63])) == 0xAD); + REQUIRE(((int)(img_plane[stride * row + 0])) == 0x4B6D); + REQUIRE(((int)(img_plane[stride * row + 2])) == 0x4B6D); + REQUIRE(((int)(img_plane[stride * row + 4])) == 0x1D2E); + REQUIRE(((int)(img_plane[stride * row + 8])) == 0xFFFE); + REQUIRE(((int)(img_plane[stride * row + 12])) == 0x0000); + REQUIRE(((int)(img_plane[stride * row + 16])) == 0xE2D0); + REQUIRE(((int)(img_plane[stride * row + 20])) == 0xB374); + REQUIRE(((int)(img_plane[stride * row + 24])) == 0x8080); + REQUIRE(((int)(img_plane[stride * row + 28])) == 0xADC6); } for (int row = 8; row < 12; row++) { INFO("row: " << row); - REQUIRE(((int)(img_plane[stride * row + 0])) == 0x2E); - REQUIRE(((int)(img_plane[stride * row + 7])) == 0x1D); - REQUIRE(((int)(img_plane[stride * row + 8])) == 0xFE); - REQUIRE(((int)(img_plane[stride * row + 15])) == 0xFF); - REQUIRE(((int)(img_plane[stride * row + 16])) == 0x00); - REQUIRE(((int)(img_plane[stride * row + 23])) == 0x00); - REQUIRE(((int)(img_plane[stride * row + 24])) == 0xD0); - REQUIRE(((int)(img_plane[stride * row + 31])) == 0xE2); - REQUIRE(((int)(img_plane[stride * row + 32])) == 0x74); - REQUIRE(((int)(img_plane[stride * row + 39])) == 0xB3); - REQUIRE(((int)(img_plane[stride * row + 40])) == 0x80); - REQUIRE(((int)(img_plane[stride * row + 47])) == 0x80); - REQUIRE(((int)(img_plane[stride * row + 48])) == 0xC6); - REQUIRE(((int)(img_plane[stride * row + 55])) == 0xAD); - REQUIRE(((int)(img_plane[stride * row + 56])) == 0x49); - REQUIRE(((int)(img_plane[stride * row + 63])) == 0xAF); + REQUIRE(((int)(img_plane[stride * row + 0])) == 0x1D2E); + REQUIRE(((int)(img_plane[stride * row + 4])) == 0xFFFE); + REQUIRE(((int)(img_plane[stride * row + 8])) == 0x0000); + REQUIRE(((int)(img_plane[stride * row + 12])) == 0xE2D0); + REQUIRE(((int)(img_plane[stride * row + 16])) == 0xB374); + REQUIRE(((int)(img_plane[stride * row + 20])) == 0x8080); + REQUIRE(((int)(img_plane[stride * row + 24])) == 0xADC6); + REQUIRE(((int)(img_plane[stride * row + 28])) == 0xAF49); } for (int row = 12; row < 16; row++) { INFO("row: " << row); - REQUIRE(((int)(img_plane[stride * row + 0])) == 0xFE); - REQUIRE(((int)(img_plane[stride * row + 7])) == 0xFF); - REQUIRE(((int)(img_plane[stride * row + 8])) == 0x00); - REQUIRE(((int)(img_plane[stride * row + 15])) == 0x00); - REQUIRE(((int)(img_plane[stride * row + 16])) == 0xD0); - REQUIRE(((int)(img_plane[stride * row + 23])) == 0xE2); - REQUIRE(((int)(img_plane[stride * row + 24])) == 0x74); - REQUIRE(((int)(img_plane[stride * row + 31])) == 0xB3); - REQUIRE(((int)(img_plane[stride * row + 32])) == 0x80); - REQUIRE(((int)(img_plane[stride * row + 39])) == 0x80); - REQUIRE(((int)(img_plane[stride * row + 40])) == 0xC6); - REQUIRE(((int)(img_plane[stride * row + 47])) == 0xAD); - REQUIRE(((int)(img_plane[stride * row + 48])) == 0x49); - REQUIRE(((int)(img_plane[stride * row + 55])) == 0xAF); - REQUIRE(((int)(img_plane[stride * row + 56])) == 0x8A); - REQUIRE(((int)(img_plane[stride * row + 63])) == 0x4C); + REQUIRE(((int)(img_plane[stride * row + 0])) == 0xFFFE); + REQUIRE(((int)(img_plane[stride * row + 4])) == 0x0000); + REQUIRE(((int)(img_plane[stride * row + 8])) == 0xE2D0); + REQUIRE(((int)(img_plane[stride * row + 12])) == 0xB374); + REQUIRE(((int)(img_plane[stride * row + 16])) == 0x8080); + REQUIRE(((int)(img_plane[stride * row + 20])) == 0xADC6); + REQUIRE(((int)(img_plane[stride * row + 24])) == 0xAF49); + REQUIRE(((int)(img_plane[stride * row + 28])) == 0x4C8A); } for (int row = 16; row < 20; row++) { INFO("row: " << row); - REQUIRE(((int)(img_plane[stride * row + 0])) == 0x00); - REQUIRE(((int)(img_plane[stride * row + 7])) == 0x00); - REQUIRE(((int)(img_plane[stride * row + 8])) == 0xD0); - REQUIRE(((int)(img_plane[stride * row + 15])) == 0xE2); - REQUIRE(((int)(img_plane[stride * row + 16])) == 0x74); - REQUIRE(((int)(img_plane[stride * row + 23])) == 0xB3); - REQUIRE(((int)(img_plane[stride * row + 24])) == 0x80); - REQUIRE(((int)(img_plane[stride * row + 31])) == 0x80); - REQUIRE(((int)(img_plane[stride * row + 32])) == 0xC6); - REQUIRE(((int)(img_plane[stride * row + 39])) == 0xAD); - REQUIRE(((int)(img_plane[stride * row + 40])) == 0x49); - REQUIRE(((int)(img_plane[stride * row + 47])) == 0xAF); - REQUIRE(((int)(img_plane[stride * row + 48])) == 0x8A); - REQUIRE(((int)(img_plane[stride * row + 55])) == 0x4C); - REQUIRE(((int)(img_plane[stride * row + 56])) == 0x6D); - REQUIRE(((int)(img_plane[stride * row + 63])) == 0x4B); + REQUIRE(((int)(img_plane[stride * row + 0])) == 0x0000); + REQUIRE(((int)(img_plane[stride * row + 4])) == 0xE2D0); + REQUIRE(((int)(img_plane[stride * row + 8])) == 0xB374); + REQUIRE(((int)(img_plane[stride * row + 12])) == 0x8080); + REQUIRE(((int)(img_plane[stride * row + 16])) == 0xADC6); + REQUIRE(((int)(img_plane[stride * row + 20])) == 0xAF49); + REQUIRE(((int)(img_plane[stride * row + 24])) == 0x4C8A); + REQUIRE(((int)(img_plane[stride * row + 28])) == 0x4B6D); } - img_plane = heif_image_get_plane_readonly(img, heif_channel_Cb, &stride); + img_plane = (const uint16_t*)heif_image_get_plane_readonly(img, heif_channel_Cb, &stride); REQUIRE(stride == 128); + stride /= 2; for (int row = 0; row < 4; row++) { INFO("row: " << row); - REQUIRE(((int)(img_plane[stride * row + 0])) == 0xBC); - REQUIRE(((int)(img_plane[stride * row + 1])) == 0x54); - REQUIRE(((int)(img_plane[stride * row + 2])) == 0xBC); - REQUIRE(((int)(img_plane[stride * row + 3])) == 0x54); - REQUIRE(((int)(img_plane[stride * row + 4])) == 0x76); - REQUIRE(((int)(img_plane[stride * row + 5])) == 0x55); - REQUIRE(((int)(img_plane[stride * row + 6])) == 0x76); - REQUIRE(((int)(img_plane[stride * row + 7])) == 0x55); - REQUIRE(((int)(img_plane[stride * row + 8])) == 0xBD); - REQUIRE(((int)(img_plane[stride * row + 9])) == 0xFF); - REQUIRE(((int)(img_plane[stride * row + 10])) == 0xBD); - REQUIRE(((int)(img_plane[stride * row + 11])) == 0xFF); - REQUIRE(((int)(img_plane[stride * row + 12])) == 0xBD); - REQUIRE(((int)(img_plane[stride * row + 13])) == 0x7F); - REQUIRE(((int)(img_plane[stride * row + 14])) == 0xBD); - REQUIRE(((int)(img_plane[stride * row + 15])) == 0x7F); - REQUIRE(((int)(img_plane[stride * row + 16])) == 0xFF); - REQUIRE(((int)(img_plane[stride * row + 17])) == 0x7F); - REQUIRE(((int)(img_plane[stride * row + 18])) == 0xFF); - REQUIRE(((int)(img_plane[stride * row + 19])) == 0x7F); - REQUIRE(((int)(img_plane[stride * row + 20])) == 0x00); - REQUIRE(((int)(img_plane[stride * row + 21])) == 0x00); - REQUIRE(((int)(img_plane[stride * row + 22])) == 0x00); - REQUIRE(((int)(img_plane[stride * row + 23])) == 0x00); - REQUIRE(((int)(img_plane[stride * row + 24])) == 0x01); - REQUIRE(((int)(img_plane[stride * row + 25])) == 0xAB); - REQUIRE(((int)(img_plane[stride * row + 26])) == 0x01); - REQUIRE(((int)(img_plane[stride * row + 27])) == 0xAB); - REQUIRE(((int)(img_plane[stride * row + 28])) == 0xDE); - REQUIRE(((int)(img_plane[stride * row + 29])) == 0x7F); - REQUIRE(((int)(img_plane[stride * row + 30])) == 0xDE); - REQUIRE(((int)(img_plane[stride * row + 31])) == 0x7F); + REQUIRE(((int)(img_plane[stride * row + 0])) == 0x54BC); + REQUIRE(((int)(img_plane[stride * row + 1])) == 0x54BC); + REQUIRE(((int)(img_plane[stride * row + 2])) == 0x5576); + REQUIRE(((int)(img_plane[stride * row + 3])) == 0x5576); + REQUIRE(((int)(img_plane[stride * row + 4])) == 0xFFBD); + REQUIRE(((int)(img_plane[stride * row + 5])) == 0xFFBD); + REQUIRE(((int)(img_plane[stride * row + 6])) == 0x7FBD); + REQUIRE(((int)(img_plane[stride * row + 7])) == 0x7FBD); + REQUIRE(((int)(img_plane[stride * row + 8])) == 0x7FFF); + REQUIRE(((int)(img_plane[stride * row + 9])) == 0x7FFF); + REQUIRE(((int)(img_plane[stride * row + 10])) == 0x0000); + REQUIRE(((int)(img_plane[stride * row + 11])) == 0x0000); + REQUIRE(((int)(img_plane[stride * row + 12])) == 0xAB01); + REQUIRE(((int)(img_plane[stride * row + 13])) == 0xAB01); + REQUIRE(((int)(img_plane[stride * row + 14])) == 0x7FDE); + REQUIRE(((int)(img_plane[stride * row + 15])) == 0x7FDE); } for (int row = 5; row < 8; row++) { INFO("row: " << row); - REQUIRE(((int)(img_plane[stride * row + 0])) == 0x76); - REQUIRE(((int)(img_plane[stride * row + 3])) == 0x55); - REQUIRE(((int)(img_plane[stride * row + 4])) == 0xBD); - REQUIRE(((int)(img_plane[stride * row + 7])) == 0xFF); - REQUIRE(((int)(img_plane[stride * row + 8])) == 0xBD); - REQUIRE(((int)(img_plane[stride * row + 11])) == 0x7F); - REQUIRE(((int)(img_plane[stride * row + 12])) == 0xFF); - REQUIRE(((int)(img_plane[stride * row + 15])) == 0x7F); - REQUIRE(((int)(img_plane[stride * row + 16])) == 0x00); - REQUIRE(((int)(img_plane[stride * row + 19])) == 0x00); - REQUIRE(((int)(img_plane[stride * row + 20])) == 0x01); - REQUIRE(((int)(img_plane[stride * row + 23])) == 0xAB); - REQUIRE(((int)(img_plane[stride * row + 24])) == 0xDE); - REQUIRE(((int)(img_plane[stride * row + 27])) == 0x7F); - REQUIRE(((int)(img_plane[stride * row + 28])) == 0xE8); - REQUIRE(((int)(img_plane[stride * row + 31])) == 0x1D); + REQUIRE(((int)(img_plane[stride * row + 0])) == 0x5576); + REQUIRE(((int)(img_plane[stride * row + 2])) == 0xFFBD); + REQUIRE(((int)(img_plane[stride * row + 4])) == 0x7FBD); + REQUIRE(((int)(img_plane[stride * row + 6])) == 0x7FFF); + REQUIRE(((int)(img_plane[stride * row + 8])) == 0x0000); + REQUIRE(((int)(img_plane[stride * row + 10])) == 0xAB01); + REQUIRE(((int)(img_plane[stride * row + 12])) == 0x7FDE); + REQUIRE(((int)(img_plane[stride * row + 14])) == 0x1DE8); } for (int row = 9; row < 12; row++) { INFO("row: " << row); - REQUIRE(((int)(img_plane[stride * row + 0])) == 0xBD); - REQUIRE(((int)(img_plane[stride * row + 3])) == 0xFF); - REQUIRE(((int)(img_plane[stride * row + 4])) == 0xBD); - REQUIRE(((int)(img_plane[stride * row + 7])) == 0x7F); - REQUIRE(((int)(img_plane[stride * row + 8])) == 0xFF); - REQUIRE(((int)(img_plane[stride * row + 11])) == 0x7F); - REQUIRE(((int)(img_plane[stride * row + 12])) == 0x00); - REQUIRE(((int)(img_plane[stride * row + 15])) == 0x00); - REQUIRE(((int)(img_plane[stride * row + 16])) == 0x01); - REQUIRE(((int)(img_plane[stride * row + 19])) == 0xAB); - REQUIRE(((int)(img_plane[stride * row + 20])) == 0xDE); - REQUIRE(((int)(img_plane[stride * row + 23])) == 0x7F); - REQUIRE(((int)(img_plane[stride * row + 24])) == 0xE8); - REQUIRE(((int)(img_plane[stride * row + 27])) == 0x1D); - REQUIRE(((int)(img_plane[stride * row + 28])) == 0xA5); - REQUIRE(((int)(img_plane[stride * row + 31])) == 0xA3); + REQUIRE(((int)(img_plane[stride * row + 0])) == 0xFFBD); + REQUIRE(((int)(img_plane[stride * row + 2])) == 0x7FBD); + REQUIRE(((int)(img_plane[stride * row + 4])) == 0x7FFF); + REQUIRE(((int)(img_plane[stride * row + 6])) == 0x0000); + REQUIRE(((int)(img_plane[stride * row + 8])) == 0xAB01); + REQUIRE(((int)(img_plane[stride * row + 10])) == 0x7FDE); + REQUIRE(((int)(img_plane[stride * row + 12])) == 0x1DE8); + REQUIRE(((int)(img_plane[stride * row + 14])) == 0xA3A5); } for (int row = 12; row < 16; row++) { INFO("row: " << row); - REQUIRE(((int)(img_plane[stride * row + 0])) == 0xBD); - REQUIRE(((int)(img_plane[stride * row + 3])) == 0x7F); - REQUIRE(((int)(img_plane[stride * row + 4])) == 0xFF); - REQUIRE(((int)(img_plane[stride * row + 7])) == 0x7F); - REQUIRE(((int)(img_plane[stride * row + 8])) == 0x00); - REQUIRE(((int)(img_plane[stride * row + 11])) == 0x00); - REQUIRE(((int)(img_plane[stride * row + 12])) == 0x01); - REQUIRE(((int)(img_plane[stride * row + 15])) == 0xAB); - REQUIRE(((int)(img_plane[stride * row + 16])) == 0xDE); - REQUIRE(((int)(img_plane[stride * row + 19])) == 0x7F); - REQUIRE(((int)(img_plane[stride * row + 20])) == 0xE8); - REQUIRE(((int)(img_plane[stride * row + 23])) == 0x1D); - REQUIRE(((int)(img_plane[stride * row + 24])) == 0xA5); - REQUIRE(((int)(img_plane[stride * row + 27])) == 0xA3); - REQUIRE(((int)(img_plane[stride * row + 28])) == 0xBC); - REQUIRE(((int)(img_plane[stride * row + 31])) == 0x54); + REQUIRE(((int)(img_plane[stride * row + 0])) == 0x7FBD); + REQUIRE(((int)(img_plane[stride * row + 2])) == 0x7FFF); + REQUIRE(((int)(img_plane[stride * row + 4])) == 0x0000); + REQUIRE(((int)(img_plane[stride * row + 6])) == 0xAB01); + REQUIRE(((int)(img_plane[stride * row + 8])) == 0x7FDE); + REQUIRE(((int)(img_plane[stride * row + 10])) == 0x1DE8); + REQUIRE(((int)(img_plane[stride * row + 12])) == 0xA3A5); + REQUIRE(((int)(img_plane[stride * row + 14])) == 0x54BC); } for (int row = 16; row < 20; row++) { INFO("row: " << row); - REQUIRE(((int)(img_plane[stride * row + 0])) == 0xFF); - REQUIRE(((int)(img_plane[stride * row + 3])) == 0x7F); - REQUIRE(((int)(img_plane[stride * row + 4])) == 0x00); - REQUIRE(((int)(img_plane[stride * row + 7])) == 0x00); - REQUIRE(((int)(img_plane[stride * row + 8])) == 0x01); - REQUIRE(((int)(img_plane[stride * row + 11])) == 0xAB); - REQUIRE(((int)(img_plane[stride * row + 12])) == 0xDE); - REQUIRE(((int)(img_plane[stride * row + 15])) == 0x7F); - REQUIRE(((int)(img_plane[stride * row + 16])) == 0xE8); - REQUIRE(((int)(img_plane[stride * row + 19])) == 0x1D); - REQUIRE(((int)(img_plane[stride * row + 20])) == 0xA5); - REQUIRE(((int)(img_plane[stride * row + 23])) == 0xA3); - REQUIRE(((int)(img_plane[stride * row + 24])) == 0xBC); - REQUIRE(((int)(img_plane[stride * row + 27])) == 0x54); - REQUIRE(((int)(img_plane[stride * row + 28])) == 0x76); - REQUIRE(((int)(img_plane[stride * row + 31])) == 0x55); + REQUIRE(((int)(img_plane[stride * row + 0])) == 0x7FFF); + REQUIRE(((int)(img_plane[stride * row + 2])) == 0x0000); + REQUIRE(((int)(img_plane[stride * row + 4])) == 0xAB01); + REQUIRE(((int)(img_plane[stride * row + 6])) == 0x7FDE); + REQUIRE(((int)(img_plane[stride * row + 8])) == 0x1DE8); + REQUIRE(((int)(img_plane[stride * row + 10])) == 0xA3A5); + REQUIRE(((int)(img_plane[stride * row + 12])) == 0x54BC); + REQUIRE(((int)(img_plane[stride * row + 14])) == 0x5576); } - img_plane = heif_image_get_plane_readonly(img, heif_channel_Cr, &stride); + img_plane = (const uint16_t*)heif_image_get_plane_readonly(img, heif_channel_Cr, &stride); REQUIRE(stride == 128); + stride /= 2; for (int row = 0; row < 4; row++) { INFO("row: " << row); - REQUIRE(((int)(img_plane[stride * row + 0])) == 0xBD); - REQUIRE(((int)(img_plane[stride * row + 1])) == 0xFF); - REQUIRE(((int)(img_plane[stride * row + 2])) == 0xBD); - REQUIRE(((int)(img_plane[stride * row + 3])) == 0xFF); - REQUIRE(((int)(img_plane[stride * row + 4])) == 0x48); - REQUIRE(((int)(img_plane[stride * row + 5])) == 0x4A); - REQUIRE(((int)(img_plane[stride * row + 6])) == 0x48); - REQUIRE(((int)(img_plane[stride * row + 7])) == 0x4A); - REQUIRE(((int)(img_plane[stride * row + 8])) == 0x2F); - REQUIRE(((int)(img_plane[stride * row + 9])) == 0x6B); - REQUIRE(((int)(img_plane[stride * row + 10])) == 0x2F); - REQUIRE(((int)(img_plane[stride * row + 11])) == 0x6B); - REQUIRE(((int)(img_plane[stride * row + 12])) == 0xEB); - REQUIRE(((int)(img_plane[stride * row + 13])) == 0x7F); - REQUIRE(((int)(img_plane[stride * row + 14])) == 0xEB); - REQUIRE(((int)(img_plane[stride * row + 15])) == 0x7F); - REQUIRE(((int)(img_plane[stride * row + 16])) == 0xFF); - REQUIRE(((int)(img_plane[stride * row + 17])) == 0x7F); - REQUIRE(((int)(img_plane[stride * row + 18])) == 0xFF); - REQUIRE(((int)(img_plane[stride * row + 19])) == 0x7F); - REQUIRE(((int)(img_plane[stride * row + 20])) == 0xBB); - REQUIRE(((int)(img_plane[stride * row + 21])) == 0x94); - REQUIRE(((int)(img_plane[stride * row + 22])) == 0xBB); - REQUIRE(((int)(img_plane[stride * row + 23])) == 0x94); - REQUIRE(((int)(img_plane[stride * row + 24])) == 0x2D); - REQUIRE(((int)(img_plane[stride * row + 25])) == 0x00); - REQUIRE(((int)(img_plane[stride * row + 26])) == 0x2D); - REQUIRE(((int)(img_plane[stride * row + 27])) == 0x00); - REQUIRE(((int)(img_plane[stride * row + 28])) == 0xF5); - REQUIRE(((int)(img_plane[stride * row + 29])) == 0x7F); - REQUIRE(((int)(img_plane[stride * row + 30])) == 0xF5); - REQUIRE(((int)(img_plane[stride * row + 31])) == 0x7F); + REQUIRE(((int)(img_plane[stride * row + 0])) == 0xFFBD); + REQUIRE(((int)(img_plane[stride * row + 1])) == 0xFFBD); + REQUIRE(((int)(img_plane[stride * row + 2])) == 0x4A48); + REQUIRE(((int)(img_plane[stride * row + 3])) == 0x4A48); + REQUIRE(((int)(img_plane[stride * row + 4])) == 0x6B2F); + REQUIRE(((int)(img_plane[stride * row + 5])) == 0x6B2F); + REQUIRE(((int)(img_plane[stride * row + 6])) == 0x7FEB); + REQUIRE(((int)(img_plane[stride * row + 7])) == 0x7FEB); + REQUIRE(((int)(img_plane[stride * row + 8])) == 0x7FFF); + REQUIRE(((int)(img_plane[stride * row + 9])) == 0x7FFF); + REQUIRE(((int)(img_plane[stride * row + 10])) == 0x94BB); + REQUIRE(((int)(img_plane[stride * row + 11])) == 0x94BB); + REQUIRE(((int)(img_plane[stride * row + 12])) == 0x002D); + REQUIRE(((int)(img_plane[stride * row + 13])) == 0x002D); + REQUIRE(((int)(img_plane[stride * row + 14])) == 0x7FF5); + REQUIRE(((int)(img_plane[stride * row + 15])) == 0x7FF5); } for (int row = 4; row < 8; row++) { INFO("row: " << row); - REQUIRE(((int)(img_plane[stride * row + 0])) == 0x48); - REQUIRE(((int)(img_plane[stride * row + 3])) == 0x4A); - REQUIRE(((int)(img_plane[stride * row + 4])) == 0x2F); - REQUIRE(((int)(img_plane[stride * row + 7])) == 0x6B); - REQUIRE(((int)(img_plane[stride * row + 8])) == 0xEB); - REQUIRE(((int)(img_plane[stride * row + 11])) == 0x7F); - REQUIRE(((int)(img_plane[stride * row + 12])) == 0xFF); - REQUIRE(((int)(img_plane[stride * row + 15])) == 0x7F); - REQUIRE(((int)(img_plane[stride * row + 16])) == 0xBB); - REQUIRE(((int)(img_plane[stride * row + 19])) == 0x94); - REQUIRE(((int)(img_plane[stride * row + 20])) == 0x2D); - REQUIRE(((int)(img_plane[stride * row + 23])) == 0x00); - REQUIRE(((int)(img_plane[stride * row + 24])) == 0xF5); - REQUIRE(((int)(img_plane[stride * row + 27])) == 0x7F); - REQUIRE(((int)(img_plane[stride * row + 28])) == 0x80); - REQUIRE(((int)(img_plane[stride * row + 31])) == 0xBA); + REQUIRE(((int)(img_plane[stride * row + 0])) == 0x4A48); + REQUIRE(((int)(img_plane[stride * row + 2])) == 0x6B2F); + REQUIRE(((int)(img_plane[stride * row + 4])) == 0x7FEB); + REQUIRE(((int)(img_plane[stride * row + 6])) == 0x7FFF); + REQUIRE(((int)(img_plane[stride * row + 8])) == 0x94BB); + REQUIRE(((int)(img_plane[stride * row + 10])) == 0x002D); + REQUIRE(((int)(img_plane[stride * row + 12])) == 0x7FF5); + REQUIRE(((int)(img_plane[stride * row + 14])) == 0xBA80); } for (int row = 8; row < 12; row++) { INFO("row: " << row); - REQUIRE(((int)(img_plane[stride * row + 0])) == 0x2F); - REQUIRE(((int)(img_plane[stride * row + 3])) == 0x6B); - REQUIRE(((int)(img_plane[stride * row + 4])) == 0xEB); - REQUIRE(((int)(img_plane[stride * row + 7])) == 0x7F); - REQUIRE(((int)(img_plane[stride * row + 8])) == 0xFF); - REQUIRE(((int)(img_plane[stride * row + 11])) == 0x7F); - REQUIRE(((int)(img_plane[stride * row + 12])) == 0xBB); - REQUIRE(((int)(img_plane[stride * row + 15])) == 0x94); - REQUIRE(((int)(img_plane[stride * row + 16])) == 0x2D); - REQUIRE(((int)(img_plane[stride * row + 19])) == 0x00); - REQUIRE(((int)(img_plane[stride * row + 20])) == 0xF5); - REQUIRE(((int)(img_plane[stride * row + 23])) == 0x7F); - REQUIRE(((int)(img_plane[stride * row + 24])) == 0x80); - REQUIRE(((int)(img_plane[stride * row + 27])) == 0xBA); - REQUIRE(((int)(img_plane[stride * row + 28])) == 0x3F); - REQUIRE(((int)(img_plane[stride * row + 31])) == 0xAD); + REQUIRE(((int)(img_plane[stride * row + 0])) == 0x6B2F); + REQUIRE(((int)(img_plane[stride * row + 2])) == 0x7FEB); + REQUIRE(((int)(img_plane[stride * row + 4])) == 0x7FFF); + REQUIRE(((int)(img_plane[stride * row + 6])) == 0x94BB); + REQUIRE(((int)(img_plane[stride * row + 8])) == 0x002D); + REQUIRE(((int)(img_plane[stride * row + 10])) == 0x7FF5); + REQUIRE(((int)(img_plane[stride * row + 12])) == 0xBA80); + REQUIRE(((int)(img_plane[stride * row + 14])) == 0xAD3F); } for (int row = 12; row < 16; row++) { INFO("row: " << row); - REQUIRE(((int)(img_plane[stride * row + 0])) == 0xEB); - REQUIRE(((int)(img_plane[stride * row + 3])) == 0x7F); - REQUIRE(((int)(img_plane[stride * row + 4])) == 0xFF); - REQUIRE(((int)(img_plane[stride * row + 7])) == 0x7F); - REQUIRE(((int)(img_plane[stride * row + 8])) == 0xBB); - REQUIRE(((int)(img_plane[stride * row + 11])) == 0x94); - REQUIRE(((int)(img_plane[stride * row + 12])) == 0x2D); - REQUIRE(((int)(img_plane[stride * row + 15])) == 0x00); - REQUIRE(((int)(img_plane[stride * row + 16])) == 0xF5); - REQUIRE(((int)(img_plane[stride * row + 19])) == 0x7F); - REQUIRE(((int)(img_plane[stride * row + 20])) == 0x80); - REQUIRE(((int)(img_plane[stride * row + 23])) == 0xBA); - REQUIRE(((int)(img_plane[stride * row + 24])) == 0x3F); - REQUIRE(((int)(img_plane[stride * row + 27])) == 0xAD); - REQUIRE(((int)(img_plane[stride * row + 28])) == 0xBD); - REQUIRE(((int)(img_plane[stride * row + 31])) == 0xFF); + REQUIRE(((int)(img_plane[stride * row + 0])) == 0x7FEB); + REQUIRE(((int)(img_plane[stride * row + 2])) == 0x7FFF); + REQUIRE(((int)(img_plane[stride * row + 4])) == 0x94BB); + REQUIRE(((int)(img_plane[stride * row + 6])) == 0x002D); + REQUIRE(((int)(img_plane[stride * row + 8])) == 0x7FF5); + REQUIRE(((int)(img_plane[stride * row + 10])) == 0xBA80); + REQUIRE(((int)(img_plane[stride * row + 12])) == 0xAD3F); + REQUIRE(((int)(img_plane[stride * row + 14])) == 0xFFBD); } for (int row = 16; row < 20; row++) { INFO("row: " << row); - REQUIRE(((int)(img_plane[stride * row + 0])) == 0xFF); - REQUIRE(((int)(img_plane[stride * row + 3])) == 0x7F); - REQUIRE(((int)(img_plane[stride * row + 4])) == 0xBB); - REQUIRE(((int)(img_plane[stride * row + 7])) == 0x94); - REQUIRE(((int)(img_plane[stride * row + 8])) == 0x2D); - REQUIRE(((int)(img_plane[stride * row + 11])) == 0x00); - REQUIRE(((int)(img_plane[stride * row + 12])) == 0xF5); - REQUIRE(((int)(img_plane[stride * row + 15])) == 0x7F); - REQUIRE(((int)(img_plane[stride * row + 16])) == 0x80); - REQUIRE(((int)(img_plane[stride * row + 19])) == 0xBA); - REQUIRE(((int)(img_plane[stride * row + 20])) == 0x3F); - REQUIRE(((int)(img_plane[stride * row + 23])) == 0xAD); - REQUIRE(((int)(img_plane[stride * row + 24])) == 0xBD); - REQUIRE(((int)(img_plane[stride * row + 27])) == 0xFF); - REQUIRE(((int)(img_plane[stride * row + 28])) == 0x48); - REQUIRE(((int)(img_plane[stride * row + 31])) == 0x4A); + REQUIRE(((int)(img_plane[stride * row + 0])) == 0x7FFF); + REQUIRE(((int)(img_plane[stride * row + 2])) == 0x94BB); + REQUIRE(((int)(img_plane[stride * row + 4])) == 0x002D); + REQUIRE(((int)(img_plane[stride * row + 6])) == 0x7FF5); + REQUIRE(((int)(img_plane[stride * row + 8])) == 0xBA80); + REQUIRE(((int)(img_plane[stride * row + 10])) == 0xAD3F); + REQUIRE(((int)(img_plane[stride * row + 12])) == 0xFFBD); + REQUIRE(((int)(img_plane[stride * row + 14])) == 0x4A48); } heif_image_release(img);