#include "src/codec/SkJpegMetadataDecoderImpl.h"
#include "include/core/SkData.h"
#include "include/private/base/SkTemplates.h"
#include "src/codec/SkCodecPriv.h"
#include "src/codec/SkJpegConstants.h"
#include <cstdint>
#include <cstring>
#include <memory>
#include <utility>
#ifdef SK_CODEC_DECODES_JPEG_GAINMAPS
#include "include/core/SkStream.h"
#include "include/private/SkExif.h"
#include "include/private/SkGainmapInfo.h"
#include "include/private/SkXmp.h"
#include "src/base/SkEndian.h"
#include "src/codec/SkJpegMultiPicture.h"
#include "src/codec/SkJpegSegmentScan.h"
#include "src/codec/SkJpegSourceMgr.h"
#include "src/codec/SkJpegXmp.h"
#else
struct SkGainmapInfo;
#endif
#ifdef SK_CODEC_DECODES_JPEG_GAINMAPS
std::unique_ptr<SkXmp> SkJpegMetadataDecoderImpl::getXmpMetadata() const { … }
static std::unique_ptr<SkJpegMultiPictureParameters> find_mp_params(
const SkJpegMarkerList& markerList,
SkJpegSourceMgr* sourceMgr,
SkJpegSegment* outMpParamsSegment) { … }
static bool extract_gainmap(SkJpegSourceMgr* decoderSource,
size_t offset,
size_t size,
bool baseImageHasIsoVersion,
bool baseImageHasAdobeXmp,
std::optional<float> baseImageAppleHdrHeadroom,
SkGainmapInfo& outInfo,
sk_sp<SkData>& outData) { … }
#endif
bool SkJpegMetadataDecoderImpl::findGainmapImage(SkJpegSourceMgr* sourceMgr,
sk_sp<SkData>& outData,
SkGainmapInfo& outInfo) const { … }
static bool marker_has_signature(const SkJpegMarker& marker,
const uint32_t targetMarker,
const uint8_t* signature,
size_t signatureSize) { … }
static sk_sp<SkData> read_metadata(const SkJpegMarkerList& markerList,
const uint32_t targetMarker,
const uint8_t* signature,
size_t signatureSize,
size_t signaturePadding,
size_t bytesInIndex,
bool alwaysCopyData) { … }
SkJpegMetadataDecoderImpl::SkJpegMetadataDecoderImpl(SkJpegMarkerList markerList)
: … { … }
SkJpegMetadataDecoderImpl::SkJpegMetadataDecoderImpl(sk_sp<SkData> data) { … }
sk_sp<SkData> SkJpegMetadataDecoderImpl::getExifMetadata(bool copyData) const { … }
sk_sp<SkData> SkJpegMetadataDecoderImpl::getICCProfileData(bool copyData) const { … }
sk_sp<SkData> SkJpegMetadataDecoderImpl::getISOGainmapMetadata(bool copyData) const { … }
bool SkJpegMetadataDecoderImpl::mightHaveGainmapImage() const { … }
bool SkJpegMetadataDecoderImpl::findGainmapImage(sk_sp<SkData> baseImageData,
sk_sp<SkData>& outGainmapImageData,
SkGainmapInfo& outGainmapInfo) { … }
std::unique_ptr<SkJpegMetadataDecoder> SkJpegMetadataDecoder::Make(std::vector<Segment> segments) { … }
std::unique_ptr<SkJpegMetadataDecoder> SkJpegMetadataDecoder::Make(sk_sp<SkData> data) { … }