xref: /aosp_15_r20/external/libva/va/va_enc_jpeg.h (revision 54e60f844a168e9a219354de272cd517ee8cd4b7)
1 /*
2  * Copyright (c) 2007-2013 Intel Corporation. All Rights Reserved.
3  *
4  * Permission is hereby granted, free of charge, to any person obtaining a
5  * copy of this software and associated documentation files (the
6  * "Software"), to deal in the Software without restriction, including
7  * without limitation the rights to use, copy, modify, merge, publish,
8  * distribute, sub license, and/or sell copies of the Software, and to
9  * permit persons to whom the Software is furnished to do so, subject to
10  * the following conditions:
11  *
12  * The above copyright notice and this permission notice (including the
13  * next paragraph) shall be included in all copies or substantial portions
14  * of the Software.
15  *
16  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
17  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
19  * IN NO EVENT SHALL INTEL AND/OR ITS SUPPLIERS BE LIABLE FOR
20  * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
21  * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
22  * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
23  */
24 
25 /**
26  * \file va_enc_jpeg.h
27  * \brief JPEG encoding API
28  *
29  * This file contains the \ref api_enc_jpeg "JPEG encoding API".
30  */
31 
32 #ifndef VA_ENC_JPEG_H
33 #define VA_ENC_JPEG_H
34 
35 #ifdef __cplusplus
36 extern "C" {
37 #endif
38 
39 /**
40  * \defgroup api_enc_jpeg JPEG encoding API
41  *
42  * @{
43  */
44 
45 /**
46  * \brief JPEG Encoding Picture Parameter Buffer Structure
47  *
48  * This structure conveys picture level parameters.
49  *
50  */
51 typedef struct  _VAEncPictureParameterBufferJPEG {
52     /** \brief holds reconstructed picture. */
53     VASurfaceID reconstructed_picture;
54     /** \brief picture width. */
55     uint16_t picture_width;
56     /** \brief picture height. */
57     uint16_t picture_height;
58     /** \brief holds coded data. */
59     VABufferID coded_buf;
60 
61     /**
62      * \brief pic_flags
63      *
64      */
65     union {
66         struct {
67             /**
68              * \brief profile:
69              * 0 - Baseline, 1 - Extended, 2 - Lossless, 3 - Hierarchical
70              */
71             uint32_t profile     : 2;
72             /**
73              * \brief progressive:
74              * 0 - sequential, 1 - extended, 2 - progressive
75              */
76             uint32_t progressive : 1;
77             /**
78              * \brief huffman:
79              * 0 - arithmetic, 1 - huffman
80              */
81             uint32_t huffman     : 1;
82             /**
83              * \brief interleaved:
84              * 0 - non interleaved, 1 - interleaved
85              */
86             uint32_t interleaved : 1;
87             /**
88              * \brief differential:
89              * 0 - non differential, 1 - differential
90              */
91             uint32_t differential   : 1;
92         } bits;
93         uint32_t value;
94     } pic_flags;
95 
96     /** \brief number of bits per sample. */
97     uint8_t    sample_bit_depth;
98     /** \brief total number of scans in image. */
99     uint8_t    num_scan;
100     /** \brief number of image components in frame. */
101     uint16_t   num_components;
102     /** \brief Component identifier (Ci). */
103     uint8_t    component_id[4];
104     /** \brief Quantization table selector (Tqi). */
105     uint8_t    quantiser_table_selector[4];
106     /** \brief number from 1 to 100 that specifies quality of image. */
107     uint8_t    quality;
108 
109     /** \brief Reserved bytes for future use, must be zero */
110     uint32_t                va_reserved[VA_PADDING_LOW];
111 } VAEncPictureParameterBufferJPEG;
112 
113 
114 /**
115  * \brief Slice parameter for JPEG encoding.
116  *
117  * This structure conveys slice (scan) level parameters.
118  *
119  */
120 typedef struct _VAEncSliceParameterBufferJPEG {
121     /** \brief Restart interval definition (Ri). */
122     uint16_t    restart_interval;
123     /** \brief number of image components in a scan. */
124     uint16_t    num_components;
125     struct {
126         /** \brief Scan component selector (Csj). */
127         uint8_t   component_selector;
128         /** \brief DC entropy coding table selector (Tdj). */
129         uint8_t   dc_table_selector;
130         /** \brief AC entropy coding table selector (Taj). */
131         uint8_t   ac_table_selector;
132     } components[4];
133 
134     /** \brief Reserved bytes for future use, must be zero */
135     uint32_t                va_reserved[VA_PADDING_LOW];
136 } VAEncSliceParameterBufferJPEG;
137 
138 /**
139  * \brief Quantization table for JPEG encoding.
140  *
141  */
142 typedef struct _VAQMatrixBufferJPEG {
143     /** \brief load luma quantization table. */
144     int32_t load_lum_quantiser_matrix;
145     /** \brief load chroma quantization table. */
146     int32_t load_chroma_quantiser_matrix;
147     /** \brief luma quantization table. */
148     uint8_t lum_quantiser_matrix[64];
149     /** \brief chroma quantization table. */
150     uint8_t chroma_quantiser_matrix[64];
151 
152     /** \brief Reserved bytes for future use, must be zero */
153     uint32_t                va_reserved[VA_PADDING_LOW];
154 } VAQMatrixBufferJPEG;
155 
156 /**@}*/
157 
158 #ifdef __cplusplus
159 }
160 #endif
161 
162 #endif /* VA_ENC_JPEG_H */
163