#include "src/codec/SkJpegCodec.h"
#include "include/codec/SkCodec.h"
#include "include/codec/SkJpegDecoder.h"
#include "include/core/SkAlphaType.h"
#include "include/core/SkColorType.h"
#include "include/core/SkData.h"
#include "include/core/SkImageInfo.h"
#include "include/core/SkPixmap.h"
#include "include/core/SkRefCnt.h"
#include "include/core/SkStream.h"
#include "include/core/SkTypes.h"
#include "include/core/SkYUVAInfo.h"
#include "include/private/base/SkAlign.h"
#include "include/private/base/SkMalloc.h"
#include "include/private/base/SkTemplates.h"
#include "modules/skcms/skcms.h"
#include "src/codec/SkCodecPriv.h"
#include "src/codec/SkJpegConstants.h"
#include "src/codec/SkJpegDecoderMgr.h"
#include "src/codec/SkJpegMetadataDecoderImpl.h"
#include "src/codec/SkJpegPriv.h"
#include "src/codec/SkParseEncodedOrigin.h"
#include "src/codec/SkSwizzler.h"
#ifdef SK_CODEC_DECODES_JPEG_GAINMAPS
#include "include/private/SkGainmapInfo.h"
#endif
#include <array>
#include <csetjmp>
#include <cstring>
#include <utility>
usingnamespaceskia_private;
class SkSampler;
struct SkGainmapInfo;
#if defined(__GNUC__) && !defined(__clang__)
#pragma GCC diagnostic ignored "-Wclobbered"
#endif
extern "C" {
#include "jpeglib.h"
}
bool SkJpegCodec::IsJpeg(const void* buffer, size_t bytesRead) { … }
SkJpegMarkerList get_sk_marker_list(jpeg_decompress_struct* dinfo) { … }
static SkEncodedOrigin get_exif_orientation(sk_sp<SkData> exifData) { … }
SkCodec::Result SkJpegCodec::ReadHeader(
SkStream* stream,
SkCodec** codecOut,
JpegDecoderMgr** decoderMgrOut,
std::unique_ptr<SkEncodedInfo::ICCProfile> defaultColorProfile) { … }
std::unique_ptr<SkCodec> SkJpegCodec::MakeFromStream(std::unique_ptr<SkStream> stream,
Result* result) { … }
std::unique_ptr<SkCodec> SkJpegCodec::MakeFromStream(std::unique_ptr<SkStream> stream,
Result* result, std::unique_ptr<SkEncodedInfo::ICCProfile> defaultColorProfile) { … }
SkJpegCodec::SkJpegCodec(SkEncodedInfo&& info,
std::unique_ptr<SkStream> stream,
JpegDecoderMgr* decoderMgr,
SkEncodedOrigin origin)
: … { … }
SkJpegCodec::~SkJpegCodec() = default;
static size_t get_row_bytes(const j_decompress_ptr dinfo) { … }
void calc_output_dimensions(jpeg_decompress_struct* dinfo, unsigned int num, unsigned int denom) { … }
SkISize SkJpegCodec::onGetScaledDimensions(float desiredScale) const { … }
bool SkJpegCodec::onRewind() { … }
bool SkJpegCodec::conversionSupported(const SkImageInfo& dstInfo, bool srcIsOpaque,
bool needsColorXform) { … }
bool SkJpegCodec::onDimensionsSupported(const SkISize& size) { … }
int SkJpegCodec::readRows(const SkImageInfo& dstInfo, void* dst, size_t rowBytes, int count,
const Options& opts) { … }
static inline bool needs_swizzler_to_convert_from_cmyk(J_COLOR_SPACE jpegColorType,
const skcms_ICCProfile* srcProfile,
bool hasColorSpaceXform) { … }
SkCodec::Result SkJpegCodec::onGetPixels(const SkImageInfo& dstInfo,
void* dst, size_t dstRowBytes,
const Options& options,
int* rowsDecoded) { … }
bool SkJpegCodec::allocateStorage(const SkImageInfo& dstInfo) { … }
void SkJpegCodec::initializeSwizzler(const SkImageInfo& dstInfo, const Options& options,
bool needsCMYKToRGB) { … }
SkSampler* SkJpegCodec::getSampler(bool createIfNecessary) { … }
SkCodec::Result SkJpegCodec::onStartScanlineDecode(const SkImageInfo& dstInfo,
const Options& options) { … }
int SkJpegCodec::onGetScanlines(void* dst, int count, size_t dstRowBytes) { … }
bool SkJpegCodec::onSkipScanlines(int count) { … }
static bool is_yuv_supported(const jpeg_decompress_struct* dinfo,
const SkJpegCodec& codec,
const SkYUVAPixmapInfo::SupportedDataTypes* supportedDataTypes,
SkYUVAPixmapInfo* yuvaPixmapInfo) { … }
bool SkJpegCodec::onQueryYUVAInfo(const SkYUVAPixmapInfo::SupportedDataTypes& supportedDataTypes,
SkYUVAPixmapInfo* yuvaPixmapInfo) const { … }
SkCodec::Result SkJpegCodec::onGetYUVAPlanes(const SkYUVAPixmaps& yuvaPixmaps) { … }
bool SkJpegCodec::onGetGainmapInfo(SkGainmapInfo* info,
std::unique_ptr<SkStream>* gainmapImageStream) { … }
namespace SkJpegDecoder {
bool IsJpeg(const void* data, size_t len) { … }
std::unique_ptr<SkCodec> Decode(std::unique_ptr<SkStream> stream,
SkCodec::Result* outResult,
SkCodecs::DecodeContext) { … }
std::unique_ptr<SkCodec> Decode(sk_sp<SkData> data,
SkCodec::Result* outResult,
SkCodecs::DecodeContext) { … }
}