libva: change the types of all fields in VABoolCoderContextVPX
[platform/upstream/libva.git] / va / va_dec_vp8.h
1 /*
2  * Copyright (c) 2007-2012 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_dec_vp.h
27  * \brief VP8 decoding API
28  *
29  * This file contains the \ref api_dec_vp8 "VP8 decoding API".
30  */
31
32 #ifndef VA_DEC_VP8_H
33 #define VA_DEC_VP8_H
34
35 #ifdef __cplusplus
36 extern "C" {
37 #endif
38
39 /**
40  * \defgroup api_dec_vp8 VP8 decoding API
41  *
42  * @{
43  */
44
45 /**
46  * \brief VPX Bool Coder Context structure 
47  *
48  * This common structure is defined for potential sharing by other VP formats
49  *
50  */
51 typedef struct _VABoolCoderContextVPX
52 {
53     /* partition 0 "range" */
54     unsigned char range;
55     /* partition 0 "value" */
56     unsigned char value;
57     /* partition 0 number of shifts before an output byte is available */
58     unsigned char count;
59 } VABoolCoderContextVPX;
60
61 /**
62  * \brief VP8 Decoding Picture Parameter Buffer Structure
63  *
64  * This structure conveys frame level parameters and should be sent once
65  * per frame.
66  *
67  */
68 typedef struct  _VAPictureParameterBufferVP8
69 {
70     /* frame width in pixels */
71     unsigned int frame_width;
72     /* frame height in pixels */
73     unsigned int frame_height;
74
75     /* specifies the "last" reference frame */
76     VASurfaceID last_ref_frame;
77     /* specifies the "golden" reference frame */
78     VASurfaceID golden_ref_frame;
79     /* specifies the "alternate" referrence frame */
80     VASurfaceID alt_ref_frame;
81     /* specifies the out-of-loop deblocked frame, not used currently */
82     VASurfaceID out_of_loop_frame;
83
84     union {
85         struct {
86             /* same as key_frame in bitstream syntax */
87             unsigned int key_frame                      : 1; 
88             /* same as version in bitstream syntax */
89             unsigned int version                        : 3;
90             /* same as segmentation_enabled in bitstream syntax */
91             unsigned int segmentation_enabled           : 1;
92             /* same as update_mb_segmentation_map in bitstream syntax */
93             unsigned int update_mb_segmentation_map     : 1;
94             /* same as update_segment_feature_data in bitstream syntax */
95             unsigned int update_segment_feature_data    : 1;
96             /* same as filter_type in bitstream syntax */
97             unsigned int filter_type                    : 1; 
98             /* same as sharpness_level in bitstream syntax */
99             unsigned int sharpness_level                : 3; 
100             /* same as loop_filter_adj_enable in bitstream syntax */
101             unsigned int loop_filter_adj_enable         : 1; 
102             /* same as mode_ref_lf_delta_update in bitstream syntax */
103             unsigned int mode_ref_lf_delta_update       : 1; 
104             /* same as sign_bias_golden in bitstream syntax */
105             unsigned int sign_bias_golden               : 1; 
106             /* same as sign_bias_alternate in bitstream syntax */
107             unsigned int sign_bias_alternate            : 1; 
108             /* same as mb_no_coeff_skip in bitstream syntax */
109             unsigned int mb_no_coeff_skip               : 1; 
110             /* see section 11.1 for mb_skip_coeff */
111             unsigned int mb_skip_coeff                  : 1; 
112             /* flag to indicate that loop filter should be disabled */
113             unsigned int loop_filter_disable            : 1; 
114         } bits;
115         unsigned int value;
116     } pic_fields;
117
118     /*
119      * probabilities of the segment_id decoding tree and same as 
120      * mb_segment_tree_probs in the spec.
121      */
122     unsigned char mb_segment_tree_probs[3];
123
124     /* Post-adjustment loop filter levels for the 4 segments */
125     unsigned char loop_filter_level[4];
126     /* loop filter deltas for reference frame based MB level adjustment */
127     char loop_filter_deltas_ref_frame[4];
128     /* loop filter deltas for coding mode based MB level adjustment */
129     char loop_filter_deltas_mode[4];
130
131     /* same as prob_skip_false in bitstream syntax */
132     unsigned char prob_skip_false;
133     /* same as prob_intra in bitstream syntax */
134     unsigned char prob_intra;
135     /* same as prob_last in bitstream syntax */
136     unsigned char prob_last;
137     /* same as prob_gf in bitstream syntax */
138     unsigned char prob_gf;
139
140     /* 
141      * list of 4 probabilities of the luma intra prediction mode decoding
142      * tree and same as y_mode_probs in frame header
143      */
144     unsigned char y_mode_probs[4]; 
145     /*
146      * list of 3 probabilities of the chroma intra prediction mode decoding
147      * tree and same as uv_mode_probs in frame header
148      */
149     unsigned char uv_mode_probs[3];
150     /* 
151      * updated mv decoding probabilities and same as mv_probs in 
152      * frame header
153      */
154     unsigned char mv_probs[2][19];
155
156     VABoolCoderContextVPX bool_coder_ctx;
157
158 } VAPictureParameterBufferVP8;
159
160 /**
161  * \brief VP8 Slice Parameter Buffer Structure
162  *
163  * This structure conveys parameters related to data partitions and should be 
164  * sent once per frame. Slice data buffer of VASliceDataBufferType is used
165  * to send the partition data.
166  *
167  */
168 typedef struct  _VASliceParameterBufferVP8
169 {
170     /*
171      * number of bytes in the slice data buffer for the partitions 
172      */
173     unsigned int slice_data_size;
174     /*
175      * offset to the first byte of partition data
176      */
177     unsigned int slice_data_offset;
178     /*
179      * see VA_SLICE_DATA_FLAG_XXX definitions
180      */
181     unsigned int slice_data_flag; 
182     /*
183      * offset to the first bit of MB from the first byte of partition data
184      */
185     unsigned int macroblock_offset;
186
187     /* Partitions */
188     unsigned char num_of_partitions;
189     unsigned int partition_size[9];
190 } VASliceParameterBufferVP8;
191
192 /**
193  * \brief VP8 Coefficient Probability Data Buffer Structure
194  *
195  * Contains the contents of the token probability table, which may be 
196  * incrementally modified in the frame header. There are four dimensions to 
197  * the token probability array. The outermost dimension is indexed by the 
198  * type of plane being decoded; the next dimension is selected by the 
199  * position of the coefficient being decoded; the third dimension, * roughly 
200  * speaking, measures the "local complexity" or extent to which nearby 
201  * coefficients are non-zero; the fourth, and final, dimension of the token 
202  * probability array is indexed by the position in the token tree structure, 
203  * as are all tree probability arrays. This structure is sent once per frame.
204  *
205  */
206 typedef struct _VAProbabilityDataBufferVP8
207 {
208     unsigned char dct_coeff_probs[4][8][3][11];
209 } VAProbabilityDataBufferVP8;
210
211 /**
212  * \brief VP8 Inverse Quantization Matrix Buffer Structure
213  *
214  * Contains quantization indices for yac(0),ydc(1),y2dc(2),y2ac(3),uvdc(4),
215  * uvac(5) for each segment (0-3). When segmentation is disabled, only  
216  * quantization_index[0][] will be used. This structure is sent once per frame.
217  */
218 typedef struct _VAIQMatrixBufferVP8
219 {
220     /* 
221      * array first dimensional is segment and 2nd dimensional is Q index
222      */
223     unsigned short quantization_index[4][6];
224 } VAIQMatrixBufferVP8;
225
226 /**@}*/
227
228 #ifdef __cplusplus
229 }
230 #endif
231
232 #endif /* VA_DEC_VP8_H */