qsv: Update SDK version to v2022.2.4
[platform/upstream/gstreamer.git] / subprojects / gst-plugins-bad / sys / qsv / libmfx / api / vpl / mfxjpeg.h
1 /*############################################################################
2   # Copyright Intel Corporation
3   #
4   # SPDX-License-Identifier: MIT
5   ############################################################################*/
6
7 #ifndef __MFX_JPEG_H__
8 #define __MFX_JPEG_H__
9
10 #include "mfxdefs.h"
11 #include "mfxstructures.h"
12
13 #ifdef __cplusplus
14 extern "C"
15 {
16 #endif /* __cplusplus */
17
18 /* CodecId */
19 enum {
20     MFX_CODEC_JPEG    = MFX_MAKEFOURCC('J','P','E','G') /*!< JPEG codec */
21 };
22
23 /* CodecProfile, CodecLevel */
24 enum
25 {
26     MFX_PROFILE_JPEG_BASELINE      = 1 /*!< Baseline JPEG profile. */
27 };
28
29 /*! The Rotation enumerator itemizes the JPEG rotation options. */
30 enum
31 {
32     MFX_ROTATION_0      = 0, /*!< No rotation. */
33     MFX_ROTATION_90     = 1, /*!< 90 degree rotation. */
34     MFX_ROTATION_180    = 2, /*!< 180 degree rotation. */
35     MFX_ROTATION_270    = 3  /*!< 270 degree rotation. */
36 };
37
38 enum {
39     MFX_EXTBUFF_JPEG_QT      = MFX_MAKEFOURCC('J','P','G','Q'), /*!< This extended buffer defines quantization tables for JPEG encoder. */
40     MFX_EXTBUFF_JPEG_HUFFMAN = MFX_MAKEFOURCC('J','P','G','H')  /*!< This extended buffer defines Huffman tables for JPEG encoder. */
41 };
42
43 /*! The JPEGColorFormat enumerator itemizes the JPEG color format options. */
44 enum {
45     MFX_JPEG_COLORFORMAT_UNKNOWN = 0, /*! Unknown color format. The decoder tries to determine color format from available in bitstream information.
46                                           If such information is not present, then MFX_JPEG_COLORFORMAT_YCbCr color format is assumed. */
47     MFX_JPEG_COLORFORMAT_YCbCr   = 1, /*! Bitstream contains Y, Cb and Cr components. */
48     MFX_JPEG_COLORFORMAT_RGB     = 2  /*! Bitstream contains R, G and B components. */
49 };
50
51 /*! The JPEGScanType enumerator itemizes the JPEG scan types. */
52 enum {
53     MFX_SCANTYPE_UNKNOWN        = 0, /*!< Unknown scan type. */
54     MFX_SCANTYPE_INTERLEAVED    = 1, /*!< Interleaved scan. */
55     MFX_SCANTYPE_NONINTERLEAVED = 2  /*!< Non-interleaved scan. */
56 };
57
58 enum {
59     MFX_CHROMAFORMAT_JPEG_SAMPLING = 6 /*!< Color sampling specified via mfxInfoMFX::SamplingFactorH and SamplingFactorV. */
60 };
61
62 MFX_PACK_BEGIN_USUAL_STRUCT()
63 /*!
64    Specifies quantization tables. The application may specify up to 4 quantization tables. The encoder assigns an ID to each table.
65    That ID is equal to the table index in the Qm array. Table "0" is used for encoding of the Y component, table "1" for the U component, and table "2"
66    for the V component. The application may specify fewer tables than the number of components in the image. If two tables are specified,
67    then table "1" is used for both U and V components. If only one table is specified then it is used for all components in the image.
68    The following table illustrates this behavior.
69
70    @internal
71    +------------------+---------+------+---+
72    | Table ID         | 0       | 1    | 2 |
73    +------------------+---------+------+---+
74    | Number of tables |         |      |   |
75    +==================+=========+======+===+
76    | 0                | Y, U, V |      |   |
77    +------------------+---------+------+---+
78    | 1                | Y       | U, V |   |
79    +------------------+---------+------+---+
80    | 2                | Y       | U    | V |
81    +------------------+---------+------+---+
82    @endinternal
83 */
84 typedef struct {
85     mfxExtBuffer    Header; /*!< Extension buffer header. Header.BufferId must be equal to MFX_EXTBUFF_JPEG_QT. */
86
87     mfxU16  reserved[7];
88     mfxU16  NumTable;       /*!< Number of quantization tables defined in Qmarray. */
89
90     mfxU16    Qm[4][64];    /*!< Quantization table values. */
91 } mfxExtJPEGQuantTables;
92 MFX_PACK_END()
93
94 MFX_PACK_BEGIN_USUAL_STRUCT()
95 /*!
96    Specifies Huffman tables. The application may specify up to 2 quantization table pairs for baseline process. The encoder
97    assigns an ID to each table. That ID is equal to the table index in the DCTables and ACTables arrays. Table "0" is used for encoding of the Y component and 
98    table "1" is used for encoding of the U and V component. The application may specify only one table, in which case the table will be used for all components in the image.
99    The following table illustrates this behavior.
100
101    @internal
102    +------------------+---------+------+
103    | Table ID         | 0       | 1    |
104    +------------------+---------+------+
105    | Number of tables |         |      |
106    +==================+=========+======+
107    | 0                | Y, U, V |      |
108    +------------------+---------+------+
109    | 1                | Y       | U, V |
110    +------------------+---------+------+
111    @endinternal
112 */
113 typedef struct {
114     mfxExtBuffer    Header; /*!< Extension buffer header. Header.BufferId must be equal to MFX_EXTBUFF_JPEG_HUFFMAN. */
115
116     mfxU16  reserved[2];
117     mfxU16  NumDCTable;      /*!< Number of DC quantization table in DCTables array. */
118     mfxU16  NumACTable;      /*!< Number of AC quantization table in ACTables array. */
119
120     struct {
121         mfxU8   Bits[16];    /*!< Number of codes for each code length. */
122         mfxU8   Values[12];  /*!< List of the 8-bit symbol values. */
123     } DCTables[4];           /*!< Array of DC tables. */
124
125     struct {
126         mfxU8   Bits[16];    /*!< Number of codes for each code length. */
127         mfxU8   Values[162]; /*!< Array of AC tables. */
128     } ACTables[4];           /*!< List of the 8-bit symbol values. */
129 } mfxExtJPEGHuffmanTables;
130 MFX_PACK_END()
131
132 #ifdef __cplusplus
133 } // extern "C"
134 #endif /* __cplusplus */
135
136 #endif // __MFX_JPEG_H__