60 bool littleEndian =
false;
61 uint32_t ifdOffset = 0;
63 SkCodecPrintf(
"Failed to parse endian-ness and index IFD offset.\n");
76 uint16_t tagCount = ifd->getNumEntries();
79 uint32_t numberOfImages = 0;
86 uint16_t previousTag = 0;
87 for (uint16_t idfEntryIndex = 0; idfEntryIndex < tagCount; ++idfEntryIndex) {
88 uint16_t tag = ifd->getEntryTag(idfEntryIndex);
89 if (previousTag >= tag) {
115 if (!ifd->getEntryUnsignedLong(idfEntryIndex, 1, &numberOfImages)) {
116 SkCodecPrintf(
"Number of Images was not 1 unsigned long.\n");
118 if (numberOfImages < 1) {
125 mpEntriesData = ifd->getEntryUndefinedData(idfEntryIndex);
126 if (!mpEntriesData) {
131 SkCodecPrintf(
"MP entries data should be %ux%u bytes, was %u.\n",
134 static_cast<uint32_t
>(mpEntriesData->
size()));
156 uint32_t totalNumCapturedFrames = 0;
157 if (!ifd->getEntryUnsignedLong(idfEntryIndex, 1, &totalNumCapturedFrames)) {
158 SkCodecPrintf(
"Total Number of Captures Frames was not 1 unsigned long.\n");
166 if (!numberOfImages) {
167 SkCodecPrintf(
"Number of images must be greater than zero.\n");
170 if (!mpEntriesData) {
176 auto result = std::make_unique<SkJpegMultiPictureParameters>(numberOfImages);
181 for (uint32_t
i = 0;
i < numberOfImages; ++
i) {
183 const uint32_t attribute =
get_endian_int(mpEntryData + 0, littleEndian);
185 const uint32_t dataOffset =
get_endian_int(mpEntryData + 8, littleEndian);
187 const bool isPrimary =
192 if (isPrimary != (
i == 0)) {
193 SkCodecPrintf(
"Image must be primary iff it is the first image..\n");
201 if (
i == 0 && dataOffset != 0) {
202 SkCodecPrintf(
"First individual Image offset must be NULL.\n");
206 result->images[
i].dataOffset = dataOffset;
216 const uint32_t numberOfImages =
static_cast<uint32_t
>(
images.size());
232 if (individualImageNumber == 0) {
235 const uint32_t mpIndexIfdNumberOfTags = 3;
241 const uint16_t mpAttributeIfdNumberOfTags = 1;
251 if (individualImageNumber == 0) {
261 const uint32_t mpEntriesSize =
kMPEntrySize * numberOfImages;
263 const uint32_t mpEntryOffset =
static_cast<uint32_t
>(
275 for (
size_t i = 0;
i <
images.size(); ++
i) {
295 return s.detachAsData();
299 return mpSegmentOffset +
306 size_t mpSegmentOffset) {
308 if (dataOffset == 0) {
315 size_t mpSegmentOffset) {
317 if (imageAbsoluteOffset == 0) {
static uint32_t get_endian_int(const uint8_t *data, bool littleEndian)
#define SkCodecPrintf(...)
static constexpr uint8_t kMpfSig[]
static constexpr size_t kJpegSegmentParameterLengthSize
static constexpr size_t kJpegMarkerCodeSize
static size_t mp_header_absolute_offset(size_t mpSegmentOffset)
constexpr uint16_t kIndividualImageUniqueIDTag
constexpr uint32_t kNumberOfImagesCount
constexpr uint8_t kVersionExpected[kVersionSize]
constexpr uint16_t kVersionTag
constexpr uint16_t kMPEntryTag
constexpr uint32_t kVersionCount
constexpr size_t kVersionSize
constexpr uint32_t kMPEntryAttributeFormatJpeg
constexpr uint32_t kMPEntryAttributeTypeMask
constexpr uint32_t kMPEntrySize
constexpr uint16_t kTotalNumberCapturedFramesTag
constexpr uint32_t kMPEntryAttributeFormatMask
constexpr uint32_t kMPEntryAttributeTypePrimary
constexpr uint16_t kNumberOfImagesTag
constexpr uint32_t kIndividualImageUniqueIDSize
bool SkWStreamWriteU32BE(SkWStream *s, uint32_t value)
bool SkWStreamWriteU16BE(SkWStream *s, uint16_t value)
const uint8_t * bytes() const
const void * data() const
static sk_sp< SkData > MakeSubset(const SkData *src, size_t offset, size_t length)
static bool ParseHeader(const SkData *data, bool *outLittleEndian, uint32_t *outIfdOffset)
static std::unique_ptr< ImageFileDirectory > MakeFromOffset(sk_sp< SkData > data, bool littleEndian, uint32_t ifdOffset, bool allowTruncated=false)
sk_sp< const SkImage > image
constexpr uint8_t kEndianBig[kEndianSize]
constexpr uint16_t kTypeUnsignedLong
constexpr uint16_t kTypeUndefined
it will be possible to load the file into Perfetto s trace viewer disable asset Prevents usage of any non test fonts unless they were explicitly Loaded via prefetched default font Indicates whether the embedding started a prefetch of the default font manager before creating the engine run In non interactive keep the shell running after the Dart script has completed enable serial On low power devices with low core running concurrent GC tasks on threads can cause them to contend with the UI thread which could potentially lead to jank This option turns off all concurrent GC activities domain network JSON encoded network policy per domain This overrides the DisallowInsecureConnections switch Embedder can specify whether to allow or disallow insecure connections at a domain level old gen heap size
static uint32_t GetImageDataOffset(size_t imageAbsoluteOffset, size_t mpSegmentOffset)
sk_sp< SkData > serialize(uint32_t individualImageNumber) const
static size_t GetImageAbsoluteOffset(uint32_t dataOffset, size_t mpSegmentOffset)
static std::unique_ptr< SkJpegMultiPictureParameters > Make(const sk_sp< const SkData > &segmentParameters)
std::vector< Image > images
std::shared_ptr< const fml::Mapping > data