115 size_t sosSegmentCount;
116 size_t eoiSegmentCount;
117 size_t testSegmentIndex;
118 uint8_t testSegmentMarker;
119 size_t testSegmentOffset;
120 uint16_t testSegmentParameterLength;
122 {
"images/wide_gamut_yellow_224_224_64.jpeg", 11, 15, 10, 0xda, 9768, 12},
123 {
"images/CMYK.jpg", 7, 8, 1, 0xee, 2, 14},
124 {
"images/b78329453.jpeg", 10, 23, 3, 0xe2, 154, 540},
125 {
"images/brickwork-texture.jpg", 8, 28, 12, 0xc4, 34183, 42},
126 {
"images/brickwork_normal-map.jpg", 8, 28, 27, 0xd9, 180612, 0},
127 {
"images/cmyk_yellow_224_224_32.jpg", 19, 23, 2, 0xed, 854, 2828},
128 {
"images/color_wheel.jpg", 10, 11, 2, 0xdb, 20, 67},
129 {
"images/cropped_mandrill.jpg", 10, 11, 4, 0xc0, 158, 17},
130 {
"images/dog.jpg", 10, 11, 5, 0xc4, 177, 28},
131 {
"images/ducky.jpg", 12, 13, 10, 0xc4, 3718, 181},
132 {
"images/exif-orientation-2-ur.jpg", 11, 12, 2, 0xe1, 20, 130},
133 {
"images/flutter_logo.jpg", 9, 27, 21, 0xda, 5731, 8},
134 {
"images/grayscale.jpg", 6, 16, 9, 0xda, 327, 8},
135 {
"images/icc-v2-gbr.jpg", 12, 25, 24, 0xd9, 43832, 0},
136 {
"images/mandrill_512_q075.jpg", 10, 11, 7, 0xc4, 393, 31},
137 {
"images/mandrill_cmyk.jpg", 19, 35, 16, 0xdd, 574336, 4},
138 {
"images/mandrill_h1v1.jpg", 10, 11, 1, 0xe0, 2, 16},
139 {
"images/mandrill_h2v1.jpg", 10, 11, 0, 0xd8, 0, 0},
140 {
"images/randPixels.jpg", 10, 11, 6, 0xc4, 200, 30},
141 {
"images/wide_gamut_yellow_224_224_64.jpeg", 11, 15, 10, 0xda, 9768, 12},
144 for (
const auto& rec : recs) {
152 const auto& segments = sourceMgr->getAllSegments();
158 for (
size_t i = 0; i < segments.size(); ++i) {
166 const auto& segment = segments[rec.testSegmentIndex];
169 REPORTER_ASSERT(r, rec.testSegmentParameterLength == segment.parameterLength);
197 const uint8_t bytes[] = {
198 0x4d, 0x50, 0x46, 0x00, 0x49, 0x49, 0x2a, 0x00, 0x08, 0x00, 0x00, 0x00, 0x03,
199 0x00, 0x00, 0xb0, 0x07, 0x00, 0x04, 0x00, 0x00, 0x00, 0x30, 0x31, 0x30, 0x30,
200 0x01, 0xb0, 0x04, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x02,
201 0xb0, 0x07, 0x00, 0x20, 0x00, 0x00, 0x00, 0x32, 0x00, 0x00, 0x00, 0x00, 0x00,
202 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x20, 0xcf, 0x49, 0x00, 0x00, 0x00, 0x00,
203 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xee, 0x28, 0x01, 0x00,
204 0xf9, 0xb7, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x00,
218 const uint8_t bytes[] = {
219 0x4d, 0x50, 0x46, 0x00, 0x4d, 0x4d, 0x00, 0x2a, 0x00, 0x00, 0x00, 0x08, 0x00,
220 0x03, 0xb0, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x04, 0x30, 0x31, 0x30, 0x30,
221 0xb0, 0x01, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, 0xb0,
222 0x02, 0x00, 0x07, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x32, 0x00, 0x00,
223 0x00, 0x00, 0x20, 0x03, 0x00, 0x00, 0x00, 0x56, 0xda, 0x2f, 0x00, 0x00, 0x00,
224 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x14, 0xc6, 0x01,
225 0x00, 0x55, 0x7c, 0x1f, 0x00, 0x00, 0x00, 0x00,
239 const uint8_t bytes[] = {
240 0x4d, 0x50, 0x46, 0x00, 0x4d, 0x4d, 0x00, 0x2a, 0x00, 0x00, 0x00, 0x08, 0x00,
241 0x03, 0xb0, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x04, 0x30, 0x31, 0x30, 0x30,
242 0xb0, 0x01, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x03, 0xb0,
243 0x02, 0x00, 0x07, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x32, 0x00, 0x00,
244 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x1f, 0x1c, 0xc2, 0x00, 0x00, 0x00,
245 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x05, 0xb0,
246 0x00, 0x1f, 0x12, 0xec, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
247 0x00, 0x96, 0x6b, 0x00, 0x22, 0x18, 0x9c, 0x00, 0x00, 0x00, 0x00,
263 const uint8_t bytes[] = {
264 0x4d, 0x50, 0x46, 0x00,
265 0x4d, 0x4d, 0x00, 0x2a,
266 0x00, 0x00, 0x00, 0x08,
270 0x00, 0x00, 0x00, 0x04,
271 0x30, 0x31, 0x30, 0x30,
274 0x00, 0x00, 0x00, 0x01,
275 0x00, 0x00, 0x00, 0x02,
278 0x00, 0x00, 0x00, 0x20,
279 0x00, 0x00, 0x00, 0x32,
280 0x00, 0x00, 0x00, 0x00,
281 0x20, 0x03, 0x00, 0x00,
282 0x00, 0x56, 0xda, 0x2f,
283 0x00, 0x00, 0x00, 0x00,
284 0x00, 0x00, 0x00, 0x00,
285 0x00, 0x00, 0x00, 0x00,
286 0x00, 0x14, 0xc6, 0x01,
287 0x00, 0x55, 0x7c, 0x1f,
288 0x00, 0x00, 0x00, 0x00,
302 reinterpret_cast<uint8_t*
>(bytesInvalid->writable_data())[25] =
'1';
310 reinterpret_cast<uint8_t*
>(bytesInvalid->writable_data())[29] = 0x07;
318 reinterpret_cast<uint8_t*
>(bytesInvalid->writable_data())[49] = 0xFE;
326 reinterpret_cast<uint8_t*
>(bytesInvalid->writable_data())[45] = 0x1F;
333 const char* path =
"images/iphone_13_pro.jpeg";
338 std::unique_ptr<SkJpegMultiPictureParameters> mpParams;
344 auto mpParamsSerialized = mpParams->serialize();
348 REPORTER_ASSERT(r, mpParamsRoundTripped->images.size() == mpParams->images.size());
349 for (
size_t i = 0; i < mpParamsRoundTripped->images.size(); ++i) {
350 REPORTER_ASSERT(r, mpParamsRoundTripped->images[i].size == mpParams->images[i].size);
353 mpParamsRoundTripped->images[i].dataOffset == mpParams->images[i].dataOffset);
358 const TestStream::Type streamType;
359 const bool skipFirstImage;
360 const size_t bufferSize;
362 {TestStream::Type::kMemoryMapped,
false, 1024},
363 {TestStream::Type::kMemoryMapped,
true, 1024},
364 {TestStream::Type::kSeekable,
false, 1024},
365 {TestStream::Type::kSeekable,
true, 1024},
366 {TestStream::Type::kSeekable,
false, 7},
367 {TestStream::Type::kSeekable,
true, 13},
368 {TestStream::Type::kSeekable,
true, 1024 * 1024 * 16},
369 {TestStream::Type::kUnseekable,
false, 1024},
370 {TestStream::Type::kUnseekable,
true, 1024},
371 {TestStream::Type::kUnseekable,
false, 1},
372 {TestStream::Type::kUnseekable,
true, 1},
373 {TestStream::Type::kUnseekable,
false, 7},
374 {TestStream::Type::kUnseekable,
true, 13},
375 {TestStream::Type::kUnseekable,
false, 1024 * 1024 * 16},
376 {TestStream::Type::kUnseekable,
true, 1024 * 1024 * 16},
378 for (
const auto& rec : recs) {
380 TestStream testStream(rec.streamType, stream.get());
384 size_t numberOfImages = mpParams->images.size();
385 std::vector<SkBitmap> bitmaps(numberOfImages);
386 for (
size_t i = 0; i < numberOfImages; ++i) {
391 if (i == 1 && rec.skipFirstImage) {
394 auto imageData = sourceMgr->getSubsetData(
397 mpParams->images[i].size);
400 std::unique_ptr<SkCodec> codec =
413 if (!rec.skipFirstImage) {
700 const char* path =
"images/iphone_13_pro.jpeg";
714 baseBitmap[0].pixmap(),
716 gainmapBitmap[0].pixmap(),
723 auto decodeStream = std::make_unique<SkMemoryStream>(encodeData);
724 decode_all(r, std::move(decodeStream), baseBitmap[1], gainmapBitmap[1], gainmapInfo[1]);
730 gainmapInfo[0].fGainmapRatioMin, gainmapInfo[1].fGainmapRatioMin,
kEpsilon));
734 gainmapInfo[0].fGainmapRatioMax, gainmapInfo[1].fGainmapRatioMax,
kEpsilon));
738 gainmapInfo[0].fGainmapGamma, gainmapInfo[1].fGainmapGamma,
kEpsilon));
748 gainmapInfo[0].fDisplayRatioSdr,
749 gainmapInfo[1].fDisplayRatioSdr,
754 gainmapInfo[0].fDisplayRatioHdr,
755 gainmapInfo[1].fDisplayRatioHdr,
773 for (
const auto& rec : recs) {
781 gainmapBitmap0 = gainmapBitmap[0];
785 .makeColorType(rec.forcedColorType)
791 rec.hdrRatio, baseBitmap[0], gainmapBitmap0, gainmapInfo[0], rec.x, rec.y);
793 rec.hdrRatio, baseBitmap[1], gainmapBitmap[1], gainmapInfo[1], rec.x, rec.y);