| 1 |
/* |
| 2 |
libheif integration tests for uncompressed decoder |
| 3 |
|
| 4 |
MIT License |
| 5 |
|
| 6 |
Copyright (c) 2023 Brad Hards <[email protected]> |
| 7 |
|
| 8 |
Permission is hereby granted, free of charge, to any person obtaining a copy |
| 9 |
of this software and associated documentation files (the "Software"), to deal |
| 10 |
in the Software without restriction, including without limitation the rights |
| 11 |
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
| 12 |
copies of the Software, and to permit persons to whom the Software is |
| 13 |
furnished to do so, subject to the following conditions: |
| 14 |
|
| 15 |
The above copyright notice and this permission notice shall be included in all |
| 16 |
copies or substantial portions of the Software. |
| 17 |
|
| 18 |
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
| 19 |
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
| 20 |
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
| 21 |
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
| 22 |
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
| 23 |
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE |
| 24 |
SOFTWARE. |
| 25 |
*/ |
| 26 |
#include "catch_amalgamated.hpp" |
| 27 |
#include "libheif/heif.h" |
| 28 |
#include "api_structs.h" |
| 29 |
#include <cstdint> |
| 30 |
#include <stdio.h> |
| 31 |
#include "test_utils.h" |
| 32 |
#include <string.h> |
| 33 |
|
| 34 |
#include "uncompressed_decode.h" |
| 35 |
|
| 36 |
void check_image_size_ycbcr(struct heif_context *&context) { |
| 37 |
heif_image_handle *handle = get_primary_image_handle(context); |
| 38 |
heif_image *img = get_primary_image_ycbcr(handle, heif_chroma_444); |
| 39 |
|
| 40 |
REQUIRE(heif_image_has_channel(img, heif_channel_Y) == 1); |
| 41 |
REQUIRE(heif_image_has_channel(img, heif_channel_Cb) == 1); |
| 42 |
REQUIRE(heif_image_has_channel(img, heif_channel_Cr) == 1); |
| 43 |
REQUIRE(heif_image_has_channel(img, heif_channel_R) == 0); |
| 44 |
REQUIRE(heif_image_has_channel(img, heif_channel_G) == 0); |
| 45 |
REQUIRE(heif_image_has_channel(img, heif_channel_B) == 0); |
| 46 |
REQUIRE(heif_image_has_channel(img, heif_channel_Alpha) == 0); |
| 47 |
REQUIRE(heif_image_has_channel(img, heif_channel_interleaved) == 0); |
| 48 |
int width = heif_image_get_primary_width(img); |
| 49 |
REQUIRE(width == 30); |
| 50 |
int height = heif_image_get_primary_height(img); |
| 51 |
REQUIRE(height == 20); |
| 52 |
width = heif_image_get_width(img, heif_channel_Y); |
| 53 |
REQUIRE(width == 30); |
| 54 |
height = heif_image_get_height(img, heif_channel_Y); |
| 55 |
REQUIRE(height == 20); |
| 56 |
width = heif_image_get_width(img, heif_channel_Cb); |
| 57 |
REQUIRE(width == 30); |
| 58 |
height = heif_image_get_height(img, heif_channel_Cr); |
| 59 |
REQUIRE(height == 20); |
| 60 |
width = heif_image_get_width(img, heif_channel_Cr); |
| 61 |
REQUIRE(width == 30); |
| 62 |
height = heif_image_get_height(img, heif_channel_Cr); |
| 63 |
REQUIRE(height == 20); |
| 64 |
|
| 65 |
int pixel_depth = heif_image_get_bits_per_pixel(img, heif_channel_Y); |
| 66 |
REQUIRE(pixel_depth == 8); |
| 67 |
pixel_depth = heif_image_get_bits_per_pixel(img, heif_channel_Cb); |
| 68 |
REQUIRE(pixel_depth == 8); |
| 69 |
pixel_depth = heif_image_get_bits_per_pixel(img, heif_channel_Cr); |
| 70 |
REQUIRE(pixel_depth == 8); |
| 71 |
int pixel_range = heif_image_get_bits_per_pixel_range(img, heif_channel_Y); |
| 72 |
REQUIRE(pixel_range == 8); |
| 73 |
pixel_range = heif_image_get_bits_per_pixel_range(img, heif_channel_Cb); |
| 74 |
REQUIRE(pixel_range == 8); |
| 75 |
pixel_range = heif_image_get_bits_per_pixel_range(img, heif_channel_Cr); |
| 76 |
REQUIRE(pixel_range == 8); |
| 77 |
|
| 78 |
heif_image_release(img); |
| 79 |
heif_image_handle_release(handle); |
| 80 |
} |
| 81 |
|
| 82 |
TEST_CASE("check image size YCbCr") { |
| 83 |
auto file = GENERATE(YUV_FILES); |
| 84 |
auto context = get_context_for_test_file(file); |
| 85 |
INFO("file name: " << file); |
| 86 |
check_image_size_ycbcr(context); |
| 87 |
heif_context_free(context); |
| 88 |
} |
| 89 |
|
| 90 |
|
| 91 |
void check_image_content_ycbcr(struct heif_context *&context) { |
| 92 |
heif_image_handle *handle = get_primary_image_handle(context); |
| 93 |
heif_image *img = get_primary_image_ycbcr(handle, heif_chroma_444); |
| 94 |
|
| 95 |
int stride; |
| 96 |
const uint8_t *img_plane = |
| 97 |
heif_image_get_plane_readonly(img, heif_channel_Y, &stride); |
| 98 |
REQUIRE(stride == 64); |
| 99 |
for (int row = 0; row < 4; row++) { |
| 100 |
INFO("row: " << row); |
| 101 |
REQUIRE(((int)(img_plane[stride * row + 0])) == 76); |
| 102 |
REQUIRE(((int)(img_plane[stride * row + 3])) == 76); |
| 103 |
REQUIRE(((int)(img_plane[stride * row + 4])) == 75); |
| 104 |
REQUIRE(((int)(img_plane[stride * row + 7])) == 75); |
| 105 |
REQUIRE(((int)(img_plane[stride * row + 8])) == 29); |
| 106 |
REQUIRE(((int)(img_plane[stride * row + 11])) == 29); |
| 107 |
REQUIRE(((int)(img_plane[stride * row + 12])) == 254); |
| 108 |
REQUIRE(((int)(img_plane[stride * row + 15])) == 254); |
| 109 |
REQUIRE(((int)(img_plane[stride * row + 16])) == 0); |
| 110 |
REQUIRE(((int)(img_plane[stride * row + 19])) == 0); |
| 111 |
REQUIRE(((int)(img_plane[stride * row + 20])) == 225); |
| 112 |
REQUIRE(((int)(img_plane[stride * row + 23])) == 225); |
| 113 |
REQUIRE(((int)(img_plane[stride * row + 24])) == 178); |
| 114 |
REQUIRE(((int)(img_plane[stride * row + 27])) == 178); |
| 115 |
REQUIRE(((int)(img_plane[stride * row + 28])) == 128); |
| 116 |
REQUIRE(((int)(img_plane[stride * row + 29])) == 128); |
| 117 |
} |
| 118 |
for (int row = 4; row < 8; row++) { |
| 119 |
INFO("row: " << row); |
| 120 |
REQUIRE(((int)(img_plane[stride * row + 0])) == 75); |
| 121 |
REQUIRE(((int)(img_plane[stride * row + 3])) == 75); |
| 122 |
REQUIRE(((int)(img_plane[stride * row + 4])) == 29); |
| 123 |
REQUIRE(((int)(img_plane[stride * row + 7])) == 29); |
| 124 |
REQUIRE(((int)(img_plane[stride * row + 8])) == 254); |
| 125 |
REQUIRE(((int)(img_plane[stride * row + 11])) == 254); |
| 126 |
REQUIRE(((int)(img_plane[stride * row + 12])) == 0); |
| 127 |
REQUIRE(((int)(img_plane[stride * row + 15])) == 0); |
| 128 |
REQUIRE(((int)(img_plane[stride * row + 16])) == 225); |
| 129 |
REQUIRE(((int)(img_plane[stride * row + 19])) == 225); |
| 130 |
REQUIRE(((int)(img_plane[stride * row + 20])) == 178); |
| 131 |
REQUIRE(((int)(img_plane[stride * row + 23])) == 178); |
| 132 |
REQUIRE(((int)(img_plane[stride * row + 24])) == 128); |
| 133 |
REQUIRE(((int)(img_plane[stride * row + 27])) == 128); |
| 134 |
REQUIRE(((int)(img_plane[stride * row + 28])) == 173); |
| 135 |
REQUIRE(((int)(img_plane[stride * row + 29])) == 173); |
| 136 |
} |
| 137 |
for (int row = 8; row < 12; row++) { |
| 138 |
INFO("row: " << row); |
| 139 |
REQUIRE(((int)(img_plane[stride * row + 0])) == 29); |
| 140 |
REQUIRE(((int)(img_plane[stride * row + 3])) == 29); |
| 141 |
REQUIRE(((int)(img_plane[stride * row + 4])) == 254); |
| 142 |
REQUIRE(((int)(img_plane[stride * row + 7])) == 254); |
| 143 |
REQUIRE(((int)(img_plane[stride * row + 8])) == 0); |
| 144 |
REQUIRE(((int)(img_plane[stride * row + 11])) == 0); |
| 145 |
REQUIRE(((int)(img_plane[stride * row + 12])) == 225); |
| 146 |
REQUIRE(((int)(img_plane[stride * row + 15])) == 225); |
| 147 |
REQUIRE(((int)(img_plane[stride * row + 16])) == 178); |
| 148 |
REQUIRE(((int)(img_plane[stride * row + 19])) == 178); |
| 149 |
REQUIRE(((int)(img_plane[stride * row + 20])) == 128); |
| 150 |
REQUIRE(((int)(img_plane[stride * row + 23])) == 128); |
| 151 |
REQUIRE(((int)(img_plane[stride * row + 24])) == 173); |
| 152 |
REQUIRE(((int)(img_plane[stride * row + 27])) == 173); |
| 153 |
REQUIRE(((int)(img_plane[stride * row + 28])) == 174); |
| 154 |
REQUIRE(((int)(img_plane[stride * row + 29])) == 174); |
| 155 |
} |
| 156 |
for (int row = 12; row < 16; row++) { |
| 157 |
INFO("row: " << row); |
| 158 |
REQUIRE(((int)(img_plane[stride * row + 0])) == 254); |
| 159 |
REQUIRE(((int)(img_plane[stride * row + 3])) == 254); |
| 160 |
REQUIRE(((int)(img_plane[stride * row + 4])) == 0); |
| 161 |
REQUIRE(((int)(img_plane[stride * row + 7])) == 0); |
| 162 |
REQUIRE(((int)(img_plane[stride * row + 8])) == 225); |
| 163 |
REQUIRE(((int)(img_plane[stride * row + 11])) == 225); |
| 164 |
REQUIRE(((int)(img_plane[stride * row + 12])) == 178); |
| 165 |
REQUIRE(((int)(img_plane[stride * row + 15])) == 178); |
| 166 |
REQUIRE(((int)(img_plane[stride * row + 16])) == 128); |
| 167 |
REQUIRE(((int)(img_plane[stride * row + 19])) == 128); |
| 168 |
REQUIRE(((int)(img_plane[stride * row + 20])) == 173); |
| 169 |
REQUIRE(((int)(img_plane[stride * row + 23])) == 173); |
| 170 |
REQUIRE(((int)(img_plane[stride * row + 24])) == 174); |
| 171 |
REQUIRE(((int)(img_plane[stride * row + 27])) == 174); |
| 172 |
REQUIRE(((int)(img_plane[stride * row + 28])) == 76); |
| 173 |
REQUIRE(((int)(img_plane[stride * row + 29])) == 76); |
| 174 |
} |
| 175 |
for (int row = 16; row < 20; row++) { |
| 176 |
INFO("row: " << row); |
| 177 |
REQUIRE(((int)(img_plane[stride * row + 0])) == 0); |
| 178 |
REQUIRE(((int)(img_plane[stride * row + 3])) == 0); |
| 179 |
REQUIRE(((int)(img_plane[stride * row + 4])) == 225); |
| 180 |
REQUIRE(((int)(img_plane[stride * row + 7])) == 225); |
| 181 |
REQUIRE(((int)(img_plane[stride * row + 8])) == 178); |
| 182 |
REQUIRE(((int)(img_plane[stride * row + 9])) == 178); |
| 183 |
REQUIRE(((int)(img_plane[stride * row + 12])) == 128); |
| 184 |
REQUIRE(((int)(img_plane[stride * row + 15])) == 128); |
| 185 |
REQUIRE(((int)(img_plane[stride * row + 16])) == 173); |
| 186 |
REQUIRE(((int)(img_plane[stride * row + 19])) == 173); |
| 187 |
REQUIRE(((int)(img_plane[stride * row + 20])) == 174); |
| 188 |
REQUIRE(((int)(img_plane[stride * row + 23])) == 174); |
| 189 |
REQUIRE(((int)(img_plane[stride * row + 24])) == 76); |
| 190 |
REQUIRE(((int)(img_plane[stride * row + 27])) == 76); |
| 191 |
REQUIRE(((int)(img_plane[stride * row + 28])) == 75); |
| 192 |
REQUIRE(((int)(img_plane[stride * row + 29])) == 75); |
| 193 |
} |
| 194 |
img_plane = heif_image_get_plane_readonly(img, heif_channel_Cb, &stride); |
| 195 |
REQUIRE(stride == 64); |
| 196 |
for (int row = 0; row < 4; row++) { |
| 197 |
INFO("row: " << row); |
| 198 |
REQUIRE(((int)(img_plane[stride * row + 0])) == 84); |
| 199 |
REQUIRE(((int)(img_plane[stride * row + 3])) == 84); |
| 200 |
REQUIRE(((int)(img_plane[stride * row + 4])) == 85); |
| 201 |
REQUIRE(((int)(img_plane[stride * row + 7])) == 85); |
| 202 |
REQUIRE(((int)(img_plane[stride * row + 8])) == 254); |
| 203 |
REQUIRE(((int)(img_plane[stride * row + 11])) == 254); |
| 204 |
REQUIRE(((int)(img_plane[stride * row + 12])) == 127); |
| 205 |
REQUIRE(((int)(img_plane[stride * row + 15])) == 127); |
| 206 |
REQUIRE(((int)(img_plane[stride * row + 16])) == 127); |
| 207 |
REQUIRE(((int)(img_plane[stride * row + 19])) == 127); |
| 208 |
REQUIRE(((int)(img_plane[stride * row + 20])) == 0); |
| 209 |
REQUIRE(((int)(img_plane[stride * row + 23])) == 0); |
| 210 |
REQUIRE(((int)(img_plane[stride * row + 24])) == 170); |
| 211 |
REQUIRE(((int)(img_plane[stride * row + 27])) == 170); |
| 212 |
REQUIRE(((int)(img_plane[stride * row + 28])) == 127); |
| 213 |
REQUIRE(((int)(img_plane[stride * row + 29])) == 127); |
| 214 |
} |
| 215 |
for (int row = 4; row < 8; row++) { |
| 216 |
INFO("row: " << row); |
| 217 |
REQUIRE(((int)(img_plane[stride * row + 0])) == 85); |
| 218 |
REQUIRE(((int)(img_plane[stride * row + 3])) == 85); |
| 219 |
REQUIRE(((int)(img_plane[stride * row + 4])) == 254); |
| 220 |
REQUIRE(((int)(img_plane[stride * row + 7])) == 254); |
| 221 |
REQUIRE(((int)(img_plane[stride * row + 8])) == 127); |
| 222 |
REQUIRE(((int)(img_plane[stride * row + 11])) == 127); |
| 223 |
REQUIRE(((int)(img_plane[stride * row + 12])) == 127); |
| 224 |
REQUIRE(((int)(img_plane[stride * row + 15])) == 127); |
| 225 |
REQUIRE(((int)(img_plane[stride * row + 16])) == 0); |
| 226 |
REQUIRE(((int)(img_plane[stride * row + 19])) == 0); |
| 227 |
REQUIRE(((int)(img_plane[stride * row + 20])) == 170); |
| 228 |
REQUIRE(((int)(img_plane[stride * row + 23])) == 170); |
| 229 |
REQUIRE(((int)(img_plane[stride * row + 24])) == 127); |
| 230 |
REQUIRE(((int)(img_plane[stride * row + 27])) == 127); |
| 231 |
REQUIRE(((int)(img_plane[stride * row + 28])) == 29); |
| 232 |
REQUIRE(((int)(img_plane[stride * row + 29])) == 29); |
| 233 |
} |
| 234 |
for (int row = 8; row < 12; row++) { |
| 235 |
INFO("row: " << row); |
| 236 |
REQUIRE(((int)(img_plane[stride * row + 0])) == 254); |
| 237 |
REQUIRE(((int)(img_plane[stride * row + 3])) == 254); |
| 238 |
REQUIRE(((int)(img_plane[stride * row + 4])) == 127); |
| 239 |
REQUIRE(((int)(img_plane[stride * row + 7])) == 127); |
| 240 |
REQUIRE(((int)(img_plane[stride * row + 8])) == 127); |
| 241 |
REQUIRE(((int)(img_plane[stride * row + 11])) == 127); |
| 242 |
REQUIRE(((int)(img_plane[stride * row + 12])) == 0); |
| 243 |
REQUIRE(((int)(img_plane[stride * row + 15])) == 0); |
| 244 |
REQUIRE(((int)(img_plane[stride * row + 16])) == 170); |
| 245 |
REQUIRE(((int)(img_plane[stride * row + 19])) == 170); |
| 246 |
REQUIRE(((int)(img_plane[stride * row + 20])) == 127); |
| 247 |
REQUIRE(((int)(img_plane[stride * row + 23])) == 127); |
| 248 |
REQUIRE(((int)(img_plane[stride * row + 24])) == 29); |
| 249 |
REQUIRE(((int)(img_plane[stride * row + 27])) == 29); |
| 250 |
REQUIRE(((int)(img_plane[stride * row + 28])) == 163); |
| 251 |
REQUIRE(((int)(img_plane[stride * row + 29])) == 163); |
| 252 |
} |
| 253 |
for (int row = 12; row < 16; row++) { |
| 254 |
INFO("row: " << row); |
| 255 |
REQUIRE(((int)(img_plane[stride * row + 0])) == 127); |
| 256 |
REQUIRE(((int)(img_plane[stride * row + 3])) == 127); |
| 257 |
REQUIRE(((int)(img_plane[stride * row + 4])) == 127); |
| 258 |
REQUIRE(((int)(img_plane[stride * row + 7])) == 127); |
| 259 |
REQUIRE(((int)(img_plane[stride * row + 8])) == 0); |
| 260 |
REQUIRE(((int)(img_plane[stride * row + 11])) == 0); |
| 261 |
REQUIRE(((int)(img_plane[stride * row + 12])) == 170); |
| 262 |
REQUIRE(((int)(img_plane[stride * row + 15])) == 170); |
| 263 |
REQUIRE(((int)(img_plane[stride * row + 16])) == 127); |
| 264 |
REQUIRE(((int)(img_plane[stride * row + 19])) == 127); |
| 265 |
REQUIRE(((int)(img_plane[stride * row + 20])) == 29); |
| 266 |
REQUIRE(((int)(img_plane[stride * row + 23])) == 29); |
| 267 |
REQUIRE(((int)(img_plane[stride * row + 24])) == 163); |
| 268 |
REQUIRE(((int)(img_plane[stride * row + 27])) == 163); |
| 269 |
REQUIRE(((int)(img_plane[stride * row + 28])) == 84); |
| 270 |
REQUIRE(((int)(img_plane[stride * row + 29])) == 84); |
| 271 |
} |
| 272 |
for (int row = 16; row < 20; row++) { |
| 273 |
INFO("row: " << row); |
| 274 |
REQUIRE(((int)(img_plane[stride * row + 0])) == 127); |
| 275 |
REQUIRE(((int)(img_plane[stride * row + 3])) == 127); |
| 276 |
REQUIRE(((int)(img_plane[stride * row + 4])) == 0); |
| 277 |
REQUIRE(((int)(img_plane[stride * row + 7])) == 0); |
| 278 |
REQUIRE(((int)(img_plane[stride * row + 8])) == 170); |
| 279 |
REQUIRE(((int)(img_plane[stride * row + 9])) == 170); |
| 280 |
REQUIRE(((int)(img_plane[stride * row + 12])) == 127); |
| 281 |
REQUIRE(((int)(img_plane[stride * row + 15])) == 127); |
| 282 |
REQUIRE(((int)(img_plane[stride * row + 16])) == 29); |
| 283 |
REQUIRE(((int)(img_plane[stride * row + 19])) == 29); |
| 284 |
REQUIRE(((int)(img_plane[stride * row + 20])) == 163); |
| 285 |
REQUIRE(((int)(img_plane[stride * row + 23])) == 163); |
| 286 |
REQUIRE(((int)(img_plane[stride * row + 24])) == 84); |
| 287 |
REQUIRE(((int)(img_plane[stride * row + 27])) == 84); |
| 288 |
REQUIRE(((int)(img_plane[stride * row + 28])) == 85); |
| 289 |
REQUIRE(((int)(img_plane[stride * row + 29])) == 85); |
| 290 |
} |
| 291 |
img_plane = heif_image_get_plane_readonly(img, heif_channel_Cr, &stride); |
| 292 |
REQUIRE(stride == 64); |
| 293 |
for (int row = 0; row < 4; row++) { |
| 294 |
INFO("row: " << row); |
| 295 |
REQUIRE(((int)(img_plane[stride * row + 0])) == 254); |
| 296 |
REQUIRE(((int)(img_plane[stride * row + 3])) == 254); |
| 297 |
REQUIRE(((int)(img_plane[stride * row + 4])) == 73); |
| 298 |
REQUIRE(((int)(img_plane[stride * row + 7])) == 73); |
| 299 |
REQUIRE(((int)(img_plane[stride * row + 8])) == 106); |
| 300 |
REQUIRE(((int)(img_plane[stride * row + 11])) == 106); |
| 301 |
REQUIRE(((int)(img_plane[stride * row + 12])) == 127); |
| 302 |
REQUIRE(((int)(img_plane[stride * row + 15])) == 127); |
| 303 |
REQUIRE(((int)(img_plane[stride * row + 16])) == 127); |
| 304 |
REQUIRE(((int)(img_plane[stride * row + 19])) == 127); |
| 305 |
REQUIRE(((int)(img_plane[stride * row + 20])) == 148); |
| 306 |
REQUIRE(((int)(img_plane[stride * row + 23])) == 148); |
| 307 |
REQUIRE(((int)(img_plane[stride * row + 24])) == 0); |
| 308 |
REQUIRE(((int)(img_plane[stride * row + 27])) == 0); |
| 309 |
REQUIRE(((int)(img_plane[stride * row + 28])) == 127); |
| 310 |
REQUIRE(((int)(img_plane[stride * row + 29])) == 127); |
| 311 |
} |
| 312 |
for (int row = 4; row < 8; row++) { |
| 313 |
INFO("row: " << row); |
| 314 |
REQUIRE(((int)(img_plane[stride * row + 0])) == 73); |
| 315 |
REQUIRE(((int)(img_plane[stride * row + 3])) == 73); |
| 316 |
REQUIRE(((int)(img_plane[stride * row + 4])) == 106); |
| 317 |
REQUIRE(((int)(img_plane[stride * row + 7])) == 106); |
| 318 |
REQUIRE(((int)(img_plane[stride * row + 8])) == 127); |
| 319 |
REQUIRE(((int)(img_plane[stride * row + 11])) == 127); |
| 320 |
REQUIRE(((int)(img_plane[stride * row + 12])) == 127); |
| 321 |
REQUIRE(((int)(img_plane[stride * row + 15])) == 127); |
| 322 |
REQUIRE(((int)(img_plane[stride * row + 16])) == 148); |
| 323 |
REQUIRE(((int)(img_plane[stride * row + 19])) == 148); |
| 324 |
REQUIRE(((int)(img_plane[stride * row + 20])) == 0); |
| 325 |
REQUIRE(((int)(img_plane[stride * row + 23])) == 0); |
| 326 |
REQUIRE(((int)(img_plane[stride * row + 24])) == 127); |
| 327 |
REQUIRE(((int)(img_plane[stride * row + 27])) == 127); |
| 328 |
REQUIRE(((int)(img_plane[stride * row + 28])) == 185); |
| 329 |
REQUIRE(((int)(img_plane[stride * row + 29])) == 185); |
| 330 |
} |
| 331 |
for (int row = 8; row < 12; row++) { |
| 332 |
INFO("row: " << row); |
| 333 |
REQUIRE(((int)(img_plane[stride * row + 0])) == 106); |
| 334 |
REQUIRE(((int)(img_plane[stride * row + 3])) == 106); |
| 335 |
REQUIRE(((int)(img_plane[stride * row + 4])) == 127); |
| 336 |
REQUIRE(((int)(img_plane[stride * row + 7])) == 127); |
| 337 |
REQUIRE(((int)(img_plane[stride * row + 8])) == 127); |
| 338 |
REQUIRE(((int)(img_plane[stride * row + 11])) == 127); |
| 339 |
REQUIRE(((int)(img_plane[stride * row + 12])) == 148); |
| 340 |
REQUIRE(((int)(img_plane[stride * row + 15])) == 148); |
| 341 |
REQUIRE(((int)(img_plane[stride * row + 16])) == 0); |
| 342 |
REQUIRE(((int)(img_plane[stride * row + 19])) == 0); |
| 343 |
REQUIRE(((int)(img_plane[stride * row + 20])) == 127); |
| 344 |
REQUIRE(((int)(img_plane[stride * row + 23])) == 127); |
| 345 |
REQUIRE(((int)(img_plane[stride * row + 24])) == 185); |
| 346 |
REQUIRE(((int)(img_plane[stride * row + 27])) == 185); |
| 347 |
REQUIRE(((int)(img_plane[stride * row + 28])) == 172); |
| 348 |
REQUIRE(((int)(img_plane[stride * row + 29])) == 172); |
| 349 |
} |
| 350 |
for (int row = 12; row < 16; row++) { |
| 351 |
INFO("row: " << row); |
| 352 |
REQUIRE(((int)(img_plane[stride * row + 0])) == 127); |
| 353 |
REQUIRE(((int)(img_plane[stride * row + 3])) == 127); |
| 354 |
REQUIRE(((int)(img_plane[stride * row + 4])) == 127); |
| 355 |
REQUIRE(((int)(img_plane[stride * row + 7])) == 127); |
| 356 |
REQUIRE(((int)(img_plane[stride * row + 8])) == 148); |
| 357 |
REQUIRE(((int)(img_plane[stride * row + 11])) == 148); |
| 358 |
REQUIRE(((int)(img_plane[stride * row + 12])) == 0); |
| 359 |
REQUIRE(((int)(img_plane[stride * row + 15])) == 0); |
| 360 |
REQUIRE(((int)(img_plane[stride * row + 16])) == 127); |
| 361 |
REQUIRE(((int)(img_plane[stride * row + 19])) == 127); |
| 362 |
REQUIRE(((int)(img_plane[stride * row + 20])) == 185); |
| 363 |
REQUIRE(((int)(img_plane[stride * row + 23])) == 185); |
| 364 |
REQUIRE(((int)(img_plane[stride * row + 24])) == 172); |
| 365 |
REQUIRE(((int)(img_plane[stride * row + 27])) == 172); |
| 366 |
REQUIRE(((int)(img_plane[stride * row + 28])) == 254); |
| 367 |
REQUIRE(((int)(img_plane[stride * row + 29])) == 254); |
| 368 |
} |
| 369 |
for (int row = 16; row < 20; row++) { |
| 370 |
INFO("row: " << row); |
| 371 |
REQUIRE(((int)(img_plane[stride * row + 0])) == 127); |
| 372 |
REQUIRE(((int)(img_plane[stride * row + 3])) == 127); |
| 373 |
REQUIRE(((int)(img_plane[stride * row + 4])) == 148); |
| 374 |
REQUIRE(((int)(img_plane[stride * row + 7])) == 148); |
| 375 |
REQUIRE(((int)(img_plane[stride * row + 8])) == 0); |
| 376 |
REQUIRE(((int)(img_plane[stride * row + 9])) == 0); |
| 377 |
REQUIRE(((int)(img_plane[stride * row + 12])) == 127); |
| 378 |
REQUIRE(((int)(img_plane[stride * row + 15])) == 127); |
| 379 |
REQUIRE(((int)(img_plane[stride * row + 16])) == 185); |
| 380 |
REQUIRE(((int)(img_plane[stride * row + 19])) == 185); |
| 381 |
REQUIRE(((int)(img_plane[stride * row + 20])) == 172); |
| 382 |
REQUIRE(((int)(img_plane[stride * row + 23])) == 172); |
| 383 |
REQUIRE(((int)(img_plane[stride * row + 24])) == 254); |
| 384 |
REQUIRE(((int)(img_plane[stride * row + 27])) == 254); |
| 385 |
REQUIRE(((int)(img_plane[stride * row + 28])) == 73); |
| 386 |
REQUIRE(((int)(img_plane[stride * row + 29])) == 73); |
| 387 |
} |
| 388 |
|
| 389 |
heif_image_release(img); |
| 390 |
heif_image_handle_release(handle); |
| 391 |
} |
| 392 |
|
| 393 |
TEST_CASE("check image content YCbCr") { |
| 394 |
auto file = GENERATE(YUV_FILES); |
| 395 |
auto context = get_context_for_test_file(file); |
| 396 |
INFO("file name: " << file); |
| 397 |
check_image_content_ycbcr(context); |
| 398 |
heif_context_free(context); |
| 399 |
} |
| 400 |
|
| 401 |
|