Flutter Engine
The Flutter Engine
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// XMP segment marker and signature.
46static constexpr uint32_t kXMPMarker = kJpegMarkerAPP0 + 1;
47static constexpr uint8_t kXMPStandardSig[] = {
48 'h', 't', 't', 'p', ':', '/', '/', 'n', 's', '.', 'a', 'd', 'o', 'b', 'e', '.', 'c', 'o',
49 'm', '/', 'x', 'a', 'p', '/', '1', '.', '0', '/', '\0'};
50static constexpr uint8_t kXMPExtendedSig[] = {
51 'h', 't', 't', 'p', ':', '/', '/', 'n', 's', '.', 'a', 'd', 'o', 'b', 'e', '.', 'c', 'o',
52 'm', '/', 'x', 'm', 'p', '/', 'e', 'x', 't', 'e', 'n', 's', 'i', 'o', 'n', '/', '\0'};
53
54// EXIF segment marker and signature.
55static constexpr uint32_t kExifMarker = kJpegMarkerAPP0 + 1;
56constexpr uint8_t kExifSig[] = {'E', 'x', 'i', 'f', '\0'};
57
58// MPF segment marker and signature.
59static constexpr uint32_t kMpfMarker = kJpegMarkerAPP0 + 2;
60static constexpr uint8_t kMpfSig[] = {'M', 'P', 'F', '\0'};
61
62// ISO 21496-1 marker and signature.
63static constexpr uint32_t kISOGainmapMarker = kJpegMarkerAPP0 + 2;
64static constexpr uint8_t kISOGainmapSig[] = {'u', 'r', 'n', ':', 'i', 's', 'o', ':', 's', 't',
65 'd', ':', 'i', 's', 'o', ':', 't', 's', ':', '2',
66 '1', '4', '9', '6', ':', '-', '1', '\0'};
67
68#endif
static constexpr uint32_t kExifMarker
static constexpr uint8_t kICCSig[]
static constexpr uint32_t kMpfMarker
static constexpr uint8_t kMpfSig[]
static constexpr uint8_t kJpegMarkerStartOfScan
static constexpr uint32_t kICCMarker
static constexpr uint32_t kISOGainmapMarker
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 uint8_t kJpegMarkerAPP0
static constexpr size_t kJpegMarkerCodeSize
static constexpr uint8_t kJpegSig[]
static constexpr uint8_t kISOGainmapSig[]
constexpr uint8_t kExifSig[]
static constexpr uint32_t kICCMarkerIndexSize
static constexpr uint32_t kICCMarkerHeaderSize