@@ -83,8 +83,15 @@ TEST_P(SampleTransformTest, Avif16bit) {
8383 }
8484 ASSERT_EQ (avifEncoderFinish (encoder.get (), &encoded), AVIF_RESULT_OK);
8585
86- const ImagePtr decoded = testutil::Decode (encoded. data , encoded. size );
86+ ImagePtr decoded ( avifImageCreateEmpty () );
8787 ASSERT_NE (decoded, nullptr );
88+ DecoderPtr decoder (avifDecoderCreate ());
89+ ASSERT_NE (decoder, nullptr );
90+ decoder->imageContentToDecode =
91+ AVIF_IMAGE_CONTENT_COLOR_AND_ALPHA | AVIF_IMAGE_CONTENT_SAMPLE_TRANSFORMS;
92+ ASSERT_EQ (avifDecoderReadMemory (decoder.get (), decoded.get (), encoded.data ,
93+ encoded.size ),
94+ AVIF_RESULT_OK);
8895
8996 ASSERT_EQ (image->depth , decoded->depth );
9097 ASSERT_EQ (image->width , decoded->width );
@@ -100,8 +107,14 @@ TEST_P(SampleTransformTest, Avif16bit) {
100107 std::memcpy (&encoded.data [i], " zzzz" , 4 );
101108 }
102109 }
103- const ImagePtr decoded_no_sato = testutil::Decode (encoded. data , encoded. size );
110+ ImagePtr decoded_no_sato ( avifImageCreateEmpty () );
104111 ASSERT_NE (decoded_no_sato, nullptr );
112+ DecoderPtr decoder_no_sato (avifDecoderCreate ());
113+ ASSERT_NE (decoder_no_sato, nullptr );
114+ decoder_no_sato->imageContentToDecode = decoder->imageContentToDecode ;
115+ ASSERT_EQ (avifDecoderReadMemory (decoder_no_sato.get (), decoded_no_sato.get (),
116+ encoded.data , encoded.size ),
117+ AVIF_RESULT_OK);
105118 // Only the most significant bits of each sample can be retrieved.
106119 // They should be encoded losslessly no matter the quantizer settings.
107120 ImagePtr image_no_sato = testutil::CreateImage (
@@ -297,12 +310,13 @@ TEST_P(GainmapSampleTransformTest, ImageContentToDecode) {
297310 ASSERT_NE (decoded, nullptr );
298311 DecoderPtr decoder (avifDecoderCreate ());
299312 ASSERT_NE (decoder, nullptr );
300- decoder->imageContentToDecode = content_to_decode;
313+ decoder->imageContentToDecode =
314+ content_to_decode | AVIF_IMAGE_CONTENT_SAMPLE_TRANSFORMS;
301315 ASSERT_EQ (avifDecoderReadMemory (decoder.get (), decoded.get (), encoded.data ,
302316 encoded.size ),
303- content_to_decode & AVIF_IMAGE_CONTENT_COLOR_AND_ALPHA ||
317+ ( content_to_decode & AVIF_IMAGE_CONTENT_COLOR_AND_ALPHA) ||
304318 (create_gainmap &&
305- content_to_decode & AVIF_IMAGE_CONTENT_GAIN_MAP)
319+ ( content_to_decode & AVIF_IMAGE_CONTENT_GAIN_MAP) )
306320 ? AVIF_RESULT_OK
307321 : AVIF_RESULT_NO_CONTENT);
308322
@@ -331,6 +345,7 @@ INSTANTIATE_TEST_SUITE_P(
331345 // Gain maps are not supported in the same file as 'sato' items.
332346 /* create_gainmap=*/ testing::Values(false ),
333347 /* use_grid=*/ testing::Values(true ),
348+ // AVIF_IMAGE_CONTENT_SAMPLE_TRANSFORMS is always set in this test.
334349 testing::Values(AVIF_IMAGE_CONTENT_NONE,
335350 AVIF_IMAGE_CONTENT_COLOR_AND_ALPHA,
336351 AVIF_IMAGE_CONTENT_GAIN_MAP, AVIF_IMAGE_CONTENT_ALL)));
0 commit comments