Commit c0a27f94 authored by Wan-Teh Chang's avatar Wan-Teh Chang Committed by Commit Bot

Remove DCHECKs in GetYUVSubsampling().

Do not DCHECK CanDecodeToYUV() is true in GetYUVSubsampling(), because
GetYUVSubsampling() is called by the hardware decoding code paths, not
by the decoding-to-YUV code paths.

Do not assert that the AVIF_PIXEL_FORMAT_YUV400 case is not reached,
because that is the YUV format of monochrome AVIF images.

Please refer to https://crrev.com/c/2327461.

Bug: 915972
Change-Id: Iced2abe0f86b0f407855c371dbf5e6abef561946
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2340071Reviewed-by: default avatarDale Curtis <dalecurtis@chromium.org>
Reviewed-by: default avatarPeter Kasting <pkasting@chromium.org>
Commit-Queue: Peter Kasting <pkasting@chromium.org>
Cr-Commit-Position: refs/heads/master@{#795387}
parent 6894aca6
......@@ -534,7 +534,6 @@ bool AVIFImageDecoder::CanReusePreviousFrameBuffer(size_t index) const {
}
cc::YUVSubsampling AVIFImageDecoder::GetYUVSubsampling() const {
DCHECK(CanDecodeToYUV());
switch (decoder_->image->yuvFormat) {
case AVIF_PIXEL_FORMAT_YUV420:
return cc::YUVSubsampling::k420;
......@@ -543,6 +542,7 @@ cc::YUVSubsampling AVIFImageDecoder::GetYUVSubsampling() const {
case AVIF_PIXEL_FORMAT_YUV444:
return cc::YUVSubsampling::k444;
case AVIF_PIXEL_FORMAT_YUV400:
return cc::YUVSubsampling::kUnknown;
case AVIF_PIXEL_FORMAT_NONE:
NOTREACHED();
return cc::YUVSubsampling::kUnknown;
......
......@@ -733,11 +733,14 @@ TEST_P(StaticAVIFColorTests, InspectImage) {
decoder->SetData(data.get(), true);
EXPECT_EQ(1u, decoder->FrameCount());
EXPECT_EQ(kAnimationNone, decoder->RepetitionCount());
EXPECT_EQ(param.bit_depth > 8, decoder->ImageIsHighBitDepth());
auto metadata = decoder->MakeMetadataForDecodeAcceleration();
EXPECT_EQ(cc::ImageType::kAVIF, metadata.image_type);
// TODO(wtc): Check metadata.yuv_subsampling.
ImageFrame* frame = decoder->DecodeFrameBufferAtIndex(0);
ASSERT_TRUE(frame);
EXPECT_EQ(ImageFrame::kFrameComplete, frame->GetStatus());
EXPECT_FALSE(decoder->Failed());
EXPECT_EQ(param.bit_depth > 8, decoder->ImageIsHighBitDepth());
// TODO(ryoh): How should we treat imir(mirroring), irot(rotation) and
// clap(cropping)?
// EXPECT_EQ(xxxx, decoder->Orientation());
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment