#include "third_party/blink/renderer/modules/webcodecs/image_decoder_core.h"
#include "base/logging.h"
#include "base/metrics/histogram_functions.h"
#include "base/numerics/safe_conversions.h"
#include "base/time/time.h"
#include "media/base/timestamp_constants.h"
#include "media/base/video_frame.h"
#include "media/base/video_util.h"
#include "third_party/blink/public/platform/platform.h"
#include "third_party/blink/renderer/platform/graphics/bitmap_image_metrics.h"
#include "third_party/blink/renderer/platform/graphics/video_frame_image_util.h"
#include "third_party/blink/renderer/platform/image-decoders/segment_reader.h"
#include "third_party/blink/renderer/platform/wtf/shared_buffer.h"
#include "third_party/skia/include/core/SkColorSpace.h"
#include "third_party/skia/include/core/SkImage.h"
#include "third_party/skia/include/core/SkYUVAPixmaps.h"
namespace blink {
namespace {
media::VideoPixelFormat YUVSubsamplingToMediaPixelFormat(
cc::YUVSubsampling sampling,
int depth) { … }
gfx::ColorSpace YUVColorSpaceToGfxColorSpace(
SkYUVColorSpace yuv_cs,
gfx::ColorSpace::PrimaryID primary_id,
gfx::ColorSpace::TransferID transfer_id) { … }
}
ImageDecoderCore::ImageDecoderCore(
String mime_type,
scoped_refptr<SegmentReader> data,
bool data_complete,
ColorBehavior color_behavior,
const SkISize& desired_size,
ImageDecoder::AnimationOption animation_option)
: … { … }
ImageDecoderCore::~ImageDecoderCore() = default;
ImageDecoderCore::ImageMetadata ImageDecoderCore::DecodeMetadata() { … }
std::unique_ptr<ImageDecoderCore::ImageDecodeResult> ImageDecoderCore::Decode(
uint32_t frame_index,
bool complete_frames_only,
const base::AtomicFlag* abort_flag) { … }
void ImageDecoderCore::AppendData(size_t data_size,
std::unique_ptr<uint8_t[]> data,
bool data_complete) { … }
void ImageDecoderCore::Clear() { … }
void ImageDecoderCore::Reinitialize(
ImageDecoder::AnimationOption animation_option) { … }
bool ImageDecoderCore::FrameIsDecodedAtIndexForTesting(
uint32_t frame_index) const { … }
void ImageDecoderCore::MaybeDecodeToYuv() { … }
base::TimeDelta ImageDecoderCore::GetTimestampForFrame(uint32_t index) const { … }
}