• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * This file is part of FFmpeg.
3  *
4  * FFmpeg is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Lesser General Public
6  * License as published by the Free Software Foundation; either
7  * version 2.1 of the License, or (at your option) any later version.
8  *
9  * FFmpeg is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12  * Lesser General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser General Public
15  * License along with FFmpeg; if not, write to the Free Software
16  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17  */
18 
19 #ifndef AVCODEC_CBS_JPEG_H
20 #define AVCODEC_CBS_JPEG_H
21 
22 #include <stddef.h>
23 #include <stdint.h>
24 
25 #include "libavutil/buffer.h"
26 
27 
28 enum {
29     JPEG_MARKER_SOF0    = 0xc0,
30     JPEG_MARKER_SOF1    = 0xc1,
31     JPEG_MARKER_SOF2    = 0xc2,
32     JPEG_MARKER_SOF3    = 0xc3,
33 
34     JPEG_MARKER_DHT     = 0xc4,
35     JPEG_MARKER_SOI     = 0xd8,
36     JPEG_MARKER_EOI     = 0xd9,
37     JPEG_MARKER_SOS     = 0xda,
38     JPEG_MARKER_DQT     = 0xdb,
39 
40     JPEG_MARKER_APPN    = 0xe0,
41     JPEG_MARKER_JPGN    = 0xf0,
42     JPEG_MARKER_COM     = 0xfe,
43 };
44 
45 enum {
46     JPEG_MAX_COMPONENTS = 255,
47 
48     JPEG_MAX_HEIGHT = 65535,
49     JPEG_MAX_WIDTH  = 65535,
50 };
51 
52 
53 typedef struct JPEGRawFrameHeader {
54     uint16_t Lf;
55     uint8_t  P;
56     uint16_t Y;
57     uint16_t X;
58     uint16_t Nf;
59 
60     uint8_t  C [JPEG_MAX_COMPONENTS];
61     uint8_t  H [JPEG_MAX_COMPONENTS];
62     uint8_t  V [JPEG_MAX_COMPONENTS];
63     uint8_t  Tq[JPEG_MAX_COMPONENTS];
64 } JPEGRawFrameHeader;
65 
66 typedef struct JPEGRawScanHeader {
67     uint16_t Ls;
68     uint8_t  Ns;
69 
70     uint8_t  Cs[JPEG_MAX_COMPONENTS];
71     uint8_t  Td[JPEG_MAX_COMPONENTS];
72     uint8_t  Ta[JPEG_MAX_COMPONENTS];
73 
74     uint8_t  Ss;
75     uint8_t  Se;
76     uint8_t  Ah;
77     uint8_t  Al;
78 } JPEGRawScanHeader;
79 
80 typedef struct JPEGRawScan {
81     JPEGRawScanHeader header;
82     uint8_t          *data;
83     AVBufferRef      *data_ref;
84     size_t            data_size;
85 } JPEGRawScan;
86 
87 typedef struct JPEGRawQuantisationTable {
88     uint8_t  Pq;
89     uint8_t  Tq;
90     uint16_t Q[64];
91 } JPEGRawQuantisationTable;
92 
93 typedef struct JPEGRawQuantisationTableSpecification {
94     uint16_t Lq;
95     JPEGRawQuantisationTable table[4];
96 } JPEGRawQuantisationTableSpecification;
97 
98 typedef struct JPEGRawHuffmanTable {
99     uint8_t  Tc;
100     uint8_t  Th;
101     uint8_t  L[16];
102     uint8_t  V[224];
103 } JPEGRawHuffmanTable;
104 
105 typedef struct JPEGRawHuffmanTableSpecification {
106     uint16_t Lh;
107     JPEGRawHuffmanTable table[8];
108 } JPEGRawHuffmanTableSpecification;
109 
110 typedef struct JPEGRawApplicationData {
111     uint16_t     Lp;
112     uint8_t     *Ap;
113     AVBufferRef *Ap_ref;
114 } JPEGRawApplicationData;
115 
116 typedef struct JPEGRawComment {
117     uint16_t     Lc;
118     uint8_t     *Cm;
119     AVBufferRef *Cm_ref;
120 } JPEGRawComment;
121 
122 
123 #endif /* AVCODEC_CBS_JPEG_H */
124