Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
SkJpegConstants.h
Go to the documentation of this file.
1/*
2 * Copyright 2023 Google LLC
3 *
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
6 */
7
8#ifndef SkJpegConstants_codec_DEFINED
9#define SkJpegConstants_codec_DEFINED
10
11#include <cstddef>
12#include <cstdint>
13
14// The first marker of all JPEG files is StartOfImage.
15static constexpr uint8_t kJpegMarkerStartOfImage = 0xD8;
16
17// The last marker of all JPEG files (excluding auxiliary data, e.g, MPF images) is EndOfImage.
18static constexpr uint8_t kJpegMarkerEndOfImage = 0xD9;
19
20// The header of a JPEG file is the data in all segments before the first StartOfScan.
21static constexpr uint8_t kJpegMarkerStartOfScan = 0xDA;
22
23// Metadata and auxiliary images are stored in the APP1 through APP15 markers.
24static constexpr uint8_t kJpegMarkerAPP0 = 0xE0;
25
26// The number of bytes in a marker code is two. The first byte is all marker codes is 0xFF.
27static constexpr size_t kJpegMarkerCodeSize = 2;
28
29// The number of bytes used to specify the length of a segment's parameters is two. This length
30// value includes these two bytes.
31static constexpr size_t kJpegSegmentParameterLengthSize = 2;
32
33// The first three bytes of all JPEG files is a StartOfImage marker (two bytes) followed by the
34// first byte of the next marker.
35static constexpr uint8_t kJpegSig[] = {0xFF, kJpegMarkerStartOfImage, 0xFF};
36
37// ICC profile segment marker and signature.
38static constexpr uint32_t kICCMarker = kJpegMarkerAPP0 + 2;
39static constexpr uint32_t kICCMarkerHeaderSize = 14;
40static constexpr uint32_t kICCMarkerIndexSize = 1;
41static constexpr uint8_t kICCSig[] = {
42 'I', 'C', 'C', '_', 'P', 'R', 'O', 'F', 'I', 'L', 'E', '\0',
43};
44
45// HDR gainmap segment marker and signature.
46static constexpr uint32_t kGainmapMarker = kJpegMarkerAPP0 + 15;
47static constexpr uint32_t kGainmapMarkerIndexSize = 2;
48static constexpr uint8_t kGainmapSig[] = {
49 'H', 'D', 'R', '_', 'G', 'A', 'I', 'N', '_', 'M', 'A', 'P', '\0',
50};
51
52// XMP segment marker and signature.
53static constexpr uint32_t kXMPMarker = kJpegMarkerAPP0 + 1;
54static constexpr uint8_t kXMPStandardSig[] = {
55 'h', 't', 't', 'p', ':', '/', '/', 'n', 's', '.', 'a', 'd', 'o', 'b', 'e', '.', 'c', 'o',
56 'm', '/', 'x', 'a', 'p', '/', '1', '.', '0', '/', '\0'};
57static constexpr uint8_t kXMPExtendedSig[] = {
58 'h', 't', 't', 'p', ':', '/', '/', 'n', 's', '.', 'a', 'd', 'o', 'b', 'e', '.', 'c', 'o',
59 'm', '/', 'x', 'm', 'p', '/', 'e', 'x', 't', 'e', 'n', 's', 'i', 'o', 'n', '/', '\0'};
60
61// EXIF segment marker and signature.
62static constexpr uint32_t kExifMarker = kJpegMarkerAPP0 + 1;
63constexpr uint8_t kExifSig[] = {'E', 'x', 'i', 'f', '\0'};
64
65// MPF segment marker and signature.
66static constexpr uint32_t kMpfMarker = kJpegMarkerAPP0 + 2;
67static constexpr uint8_t kMpfSig[] = {'M', 'P', 'F', '\0'};
68
69#endif
static constexpr uint32_t kExifMarker
static constexpr uint8_t kICCSig[]
static constexpr uint32_t kMpfMarker
static constexpr uint8_t kMpfSig[]
static constexpr uint32_t kGainmapMarkerIndexSize
static constexpr uint8_t kJpegMarkerStartOfScan
static constexpr uint32_t kICCMarker
static constexpr uint32_t kXMPMarker
static constexpr uint8_t kJpegMarkerStartOfImage
static constexpr uint8_t kXMPStandardSig[]
static constexpr size_t kJpegSegmentParameterLengthSize
static constexpr uint8_t kJpegMarkerEndOfImage
static constexpr uint8_t kXMPExtendedSig[]
static constexpr uint32_t kGainmapMarker
static constexpr uint8_t kJpegMarkerAPP0
static constexpr size_t kJpegMarkerCodeSize
static constexpr uint8_t kJpegSig[]
constexpr uint8_t kExifSig[]
static constexpr uint32_t kICCMarkerIndexSize
static constexpr uint32_t kICCMarkerHeaderSize
static constexpr uint8_t kGainmapSig[]