1/**************************************************************************
2 *
3 * Copyright 2009 Younes Manton.
4 * All Rights Reserved.
5 *
6 * Permission is hereby granted, free of charge, to any person obtaining a
7 * copy of this software and associated documentation files (the
8 * "Software"), to deal in the Software without restriction, including
9 * without limitation the rights to use, copy, modify, merge, publish,
10 * distribute, sub license, and/or sell copies of the Software, and to
11 * permit persons to whom the Software is furnished to do so, subject to
12 * the following conditions:
13 *
14 * The above copyright notice and this permission notice (including the
15 * next paragraph) shall be included in all copies or substantial portions
16 * of the Software.
17 *
18 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
19 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
20 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
21 * IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR
22 * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
23 * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
24 * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
25 *
26 **************************************************************************/
27
28#ifndef PIPE_VIDEO_STATE_H
29#define PIPE_VIDEO_STATE_H
30
31#include "pipe/p_defines.h"
32#include "pipe/p_format.h"
33#include "pipe/p_state.h"
34#include "pipe/p_screen.h"
35#include "util/u_hash_table.h"
36#include "util/u_inlines.h"
37
38#ifdef __cplusplus
39extern "C" {
40#endif
41
42/*
43 * see table 6-12 in the spec
44 */
45enum pipe_mpeg12_picture_coding_type
46{
47   PIPE_MPEG12_PICTURE_CODING_TYPE_I = 0x01,
48   PIPE_MPEG12_PICTURE_CODING_TYPE_P = 0x02,
49   PIPE_MPEG12_PICTURE_CODING_TYPE_B = 0x03,
50   PIPE_MPEG12_PICTURE_CODING_TYPE_D = 0x04
51};
52
53/*
54 * see table 6-14 in the spec
55 */
56enum pipe_mpeg12_picture_structure
57{
58   PIPE_MPEG12_PICTURE_STRUCTURE_RESERVED = 0x00,
59   PIPE_MPEG12_PICTURE_STRUCTURE_FIELD_TOP = 0x01,
60   PIPE_MPEG12_PICTURE_STRUCTURE_FIELD_BOTTOM = 0x02,
61   PIPE_MPEG12_PICTURE_STRUCTURE_FRAME = 0x03
62};
63
64/*
65 * flags for macroblock_type, see section 6.3.17.1 in the spec
66 */
67enum pipe_mpeg12_macroblock_type
68{
69   PIPE_MPEG12_MB_TYPE_QUANT = 0x01,
70   PIPE_MPEG12_MB_TYPE_MOTION_FORWARD = 0x02,
71   PIPE_MPEG12_MB_TYPE_MOTION_BACKWARD = 0x04,
72   PIPE_MPEG12_MB_TYPE_PATTERN = 0x08,
73   PIPE_MPEG12_MB_TYPE_INTRA = 0x10
74};
75
76/*
77 * flags for motion_type, see table 6-17 and 6-18 in the spec
78 */
79enum pipe_mpeg12_motion_type
80{
81   PIPE_MPEG12_MO_TYPE_RESERVED = 0x00,
82   PIPE_MPEG12_MO_TYPE_FIELD = 0x01,
83   PIPE_MPEG12_MO_TYPE_FRAME = 0x02,
84   PIPE_MPEG12_MO_TYPE_16x8 = 0x02,
85   PIPE_MPEG12_MO_TYPE_DUAL_PRIME = 0x03
86};
87
88/*
89 * see section 6.3.17.1 and table 6-19 in the spec
90 */
91enum pipe_mpeg12_dct_type
92{
93   PIPE_MPEG12_DCT_TYPE_FRAME = 0,
94   PIPE_MPEG12_DCT_TYPE_FIELD = 1
95};
96
97enum pipe_mpeg12_field_select
98{
99   PIPE_MPEG12_FS_FIRST_FORWARD = 0x01,
100   PIPE_MPEG12_FS_FIRST_BACKWARD = 0x02,
101   PIPE_MPEG12_FS_SECOND_FORWARD = 0x04,
102   PIPE_MPEG12_FS_SECOND_BACKWARD = 0x08
103};
104
105enum pipe_h264_slice_type
106{
107   PIPE_H264_SLICE_TYPE_P = 0x0,
108   PIPE_H264_SLICE_TYPE_B = 0x1,
109   PIPE_H264_SLICE_TYPE_I = 0x2,
110   PIPE_H264_SLICE_TYPE_SP = 0x3,
111   PIPE_H264_SLICE_TYPE_SI = 0x4
112};
113
114enum pipe_h264_enc_picture_type
115{
116   PIPE_H264_ENC_PICTURE_TYPE_P = 0x00,
117   PIPE_H264_ENC_PICTURE_TYPE_B = 0x01,
118   PIPE_H264_ENC_PICTURE_TYPE_I = 0x02,
119   PIPE_H264_ENC_PICTURE_TYPE_IDR = 0x03,
120   PIPE_H264_ENC_PICTURE_TYPE_SKIP = 0x04
121};
122
123enum pipe_h265_enc_picture_type
124{
125   PIPE_H265_ENC_PICTURE_TYPE_P = 0x00,
126   PIPE_H265_ENC_PICTURE_TYPE_B = 0x01,
127   PIPE_H265_ENC_PICTURE_TYPE_I = 0x02,
128   PIPE_H265_ENC_PICTURE_TYPE_IDR = 0x03,
129   PIPE_H265_ENC_PICTURE_TYPE_SKIP = 0x04
130};
131
132enum pipe_h264_enc_rate_control_method
133{
134   PIPE_H264_ENC_RATE_CONTROL_METHOD_DISABLE = 0x00,
135   PIPE_H264_ENC_RATE_CONTROL_METHOD_CONSTANT_SKIP = 0x01,
136   PIPE_H264_ENC_RATE_CONTROL_METHOD_VARIABLE_SKIP = 0x02,
137   PIPE_H264_ENC_RATE_CONTROL_METHOD_CONSTANT = 0x03,
138   PIPE_H264_ENC_RATE_CONTROL_METHOD_VARIABLE = 0x04
139};
140
141enum pipe_h265_enc_rate_control_method
142{
143   PIPE_H265_ENC_RATE_CONTROL_METHOD_DISABLE = 0x00,
144   PIPE_H265_ENC_RATE_CONTROL_METHOD_CONSTANT_SKIP = 0x01,
145   PIPE_H265_ENC_RATE_CONTROL_METHOD_VARIABLE_SKIP = 0x02,
146   PIPE_H265_ENC_RATE_CONTROL_METHOD_CONSTANT = 0x03,
147   PIPE_H265_ENC_RATE_CONTROL_METHOD_VARIABLE = 0x04
148};
149
150struct pipe_picture_desc
151{
152   enum pipe_video_profile profile;
153   enum pipe_video_entrypoint entry_point;
154};
155
156struct pipe_quant_matrix
157{
158   enum pipe_video_format codec;
159};
160
161struct pipe_macroblock
162{
163   enum pipe_video_format codec;
164};
165
166struct pipe_mpeg12_picture_desc
167{
168   struct pipe_picture_desc base;
169
170   unsigned picture_coding_type;
171   unsigned picture_structure;
172   unsigned frame_pred_frame_dct;
173   unsigned q_scale_type;
174   unsigned alternate_scan;
175   unsigned intra_vlc_format;
176   unsigned concealment_motion_vectors;
177   unsigned intra_dc_precision;
178   unsigned f_code[2][2];
179   unsigned top_field_first;
180   unsigned full_pel_forward_vector;
181   unsigned full_pel_backward_vector;
182   unsigned num_slices;
183
184   const uint8_t *intra_matrix;
185   const uint8_t *non_intra_matrix;
186
187   struct pipe_video_buffer *ref[2];
188};
189
190struct pipe_mpeg12_macroblock
191{
192   struct pipe_macroblock base;
193
194   /* see section 6.3.17 in the spec */
195   unsigned short x, y;
196
197   /* see section 6.3.17.1 in the spec */
198   unsigned char macroblock_type;
199
200   union {
201      struct {
202         /* see table 6-17 in the spec */
203         unsigned int frame_motion_type:2;
204
205         /* see table 6-18 in the spec */
206         unsigned int field_motion_type:2;
207
208         /* see table 6-19 in the spec */
209         unsigned int dct_type:1;
210      } bits;
211      unsigned int value;
212   } macroblock_modes;
213
214    /* see section 6.3.17.2 in the spec */
215   unsigned char motion_vertical_field_select;
216
217   /* see Table 7-7 in the spec */
218   short PMV[2][2][2];
219
220   /* see figure 6.10-12 in the spec */
221   unsigned short coded_block_pattern;
222
223   /* see figure 6.10-12 in the spec */
224   short *blocks;
225
226   /* Number of skipped macroblocks after this macroblock */
227   unsigned short num_skipped_macroblocks;
228};
229
230struct pipe_mpeg4_picture_desc
231{
232   struct pipe_picture_desc base;
233
234   int32_t trd[2];
235   int32_t trb[2];
236   uint16_t vop_time_increment_resolution;
237   uint8_t vop_coding_type;
238   uint8_t vop_fcode_forward;
239   uint8_t vop_fcode_backward;
240   uint8_t resync_marker_disable;
241   uint8_t interlaced;
242   uint8_t quant_type;
243   uint8_t quarter_sample;
244   uint8_t short_video_header;
245   uint8_t rounding_control;
246   uint8_t alternate_vertical_scan_flag;
247   uint8_t top_field_first;
248
249   const uint8_t *intra_matrix;
250   const uint8_t *non_intra_matrix;
251
252   struct pipe_video_buffer *ref[2];
253};
254
255struct pipe_vc1_picture_desc
256{
257   struct pipe_picture_desc base;
258
259   uint32_t slice_count;
260   uint8_t picture_type;
261   uint8_t frame_coding_mode;
262   uint8_t postprocflag;
263   uint8_t pulldown;
264   uint8_t interlace;
265   uint8_t tfcntrflag;
266   uint8_t finterpflag;
267   uint8_t psf;
268   uint8_t dquant;
269   uint8_t panscan_flag;
270   uint8_t refdist_flag;
271   uint8_t quantizer;
272   uint8_t extended_mv;
273   uint8_t extended_dmv;
274   uint8_t overlap;
275   uint8_t vstransform;
276   uint8_t loopfilter;
277   uint8_t fastuvmc;
278   uint8_t range_mapy_flag;
279   uint8_t range_mapy;
280   uint8_t range_mapuv_flag;
281   uint8_t range_mapuv;
282   uint8_t multires;
283   uint8_t syncmarker;
284   uint8_t rangered;
285   uint8_t maxbframes;
286   uint8_t deblockEnable;
287   uint8_t pquant;
288
289   struct pipe_video_buffer *ref[2];
290};
291
292struct pipe_h264_sps
293{
294   uint8_t  level_idc;
295   uint8_t  chroma_format_idc;
296   uint8_t  separate_colour_plane_flag;
297   uint8_t  bit_depth_luma_minus8;
298   uint8_t  bit_depth_chroma_minus8;
299   uint8_t  seq_scaling_matrix_present_flag;
300   uint8_t  ScalingList4x4[6][16];
301   uint8_t  ScalingList8x8[6][64];
302   uint8_t  log2_max_frame_num_minus4;
303   uint8_t  pic_order_cnt_type;
304   uint8_t  log2_max_pic_order_cnt_lsb_minus4;
305   uint8_t  delta_pic_order_always_zero_flag;
306   int32_t  offset_for_non_ref_pic;
307   int32_t  offset_for_top_to_bottom_field;
308   uint8_t  num_ref_frames_in_pic_order_cnt_cycle;
309   int32_t  offset_for_ref_frame[256];
310   uint8_t  max_num_ref_frames;
311   uint8_t  frame_mbs_only_flag;
312   uint8_t  mb_adaptive_frame_field_flag;
313   uint8_t  direct_8x8_inference_flag;
314};
315
316struct pipe_h264_pps
317{
318   struct pipe_h264_sps *sps;
319
320   uint8_t  entropy_coding_mode_flag;
321   uint8_t  bottom_field_pic_order_in_frame_present_flag;
322   uint8_t  num_slice_groups_minus1;
323   uint8_t  slice_group_map_type;
324   uint8_t  slice_group_change_rate_minus1;
325   uint8_t  num_ref_idx_l0_default_active_minus1;
326   uint8_t  num_ref_idx_l1_default_active_minus1;
327   uint8_t  weighted_pred_flag;
328   uint8_t  weighted_bipred_idc;
329   int8_t   pic_init_qp_minus26;
330   int8_t   chroma_qp_index_offset;
331   uint8_t  deblocking_filter_control_present_flag;
332   uint8_t  constrained_intra_pred_flag;
333   uint8_t  redundant_pic_cnt_present_flag;
334   uint8_t  ScalingList4x4[6][16];
335   uint8_t  ScalingList8x8[6][64];
336   uint8_t  transform_8x8_mode_flag;
337   int8_t   second_chroma_qp_index_offset;
338};
339
340struct pipe_h264_picture_desc
341{
342   struct pipe_picture_desc base;
343
344   struct pipe_h264_pps *pps;
345
346   /* slice header */
347   uint32_t frame_num;
348   uint8_t  field_pic_flag;
349   uint8_t  bottom_field_flag;
350   uint8_t  num_ref_idx_l0_active_minus1;
351   uint8_t  num_ref_idx_l1_active_minus1;
352
353   uint32_t slice_count;
354   int32_t  field_order_cnt[2];
355   bool     is_reference;
356   uint8_t  num_ref_frames;
357
358   bool     is_long_term[16];
359   bool     top_is_reference[16];
360   bool     bottom_is_reference[16];
361   uint32_t field_order_cnt_list[16][2];
362   uint32_t frame_num_list[16];
363
364   struct pipe_video_buffer *ref[16];
365};
366
367struct pipe_h264_enc_rate_control
368{
369   enum pipe_h264_enc_rate_control_method rate_ctrl_method;
370   unsigned target_bitrate;
371   unsigned peak_bitrate;
372   unsigned frame_rate_num;
373   unsigned frame_rate_den;
374   unsigned vbv_buffer_size;
375   unsigned vbv_buf_lv;
376   unsigned target_bits_picture;
377   unsigned peak_bits_picture_integer;
378   unsigned peak_bits_picture_fraction;
379   unsigned fill_data_enable;
380   unsigned enforce_hrd;
381};
382
383struct pipe_h264_enc_motion_estimation
384{
385   unsigned motion_est_quarter_pixel;
386   unsigned enc_disable_sub_mode;
387   unsigned lsmvert;
388   unsigned enc_en_ime_overw_dis_subm;
389   unsigned enc_ime_overw_dis_subm_no;
390   unsigned enc_ime2_search_range_x;
391   unsigned enc_ime2_search_range_y;
392};
393
394struct pipe_h264_enc_pic_control
395{
396   unsigned enc_cabac_enable;
397   unsigned enc_constraint_set_flags;
398   unsigned enc_frame_cropping_flag;
399   unsigned enc_frame_crop_left_offset;
400   unsigned enc_frame_crop_right_offset;
401   unsigned enc_frame_crop_top_offset;
402   unsigned enc_frame_crop_bottom_offset;
403};
404
405struct pipe_h264_enc_picture_desc
406{
407   struct pipe_picture_desc base;
408
409   struct pipe_h264_enc_rate_control rate_ctrl;
410
411   struct pipe_h264_enc_motion_estimation motion_est;
412   struct pipe_h264_enc_pic_control pic_ctrl;
413
414   unsigned quant_i_frames;
415   unsigned quant_p_frames;
416   unsigned quant_b_frames;
417
418   enum pipe_h264_enc_picture_type picture_type;
419   unsigned frame_num;
420   unsigned frame_num_cnt;
421   unsigned p_remain;
422   unsigned i_remain;
423   unsigned idr_pic_id;
424   unsigned gop_cnt;
425   unsigned pic_order_cnt;
426   unsigned pic_order_cnt_type;
427   unsigned ref_idx_l0;
428   unsigned ref_idx_l1;
429   unsigned gop_size;
430   unsigned ref_pic_mode;
431
432   bool not_referenced;
433   bool enable_vui;
434   struct util_hash_table *frame_idx;
435
436};
437
438struct pipe_h265_enc_seq_param
439{
440   uint8_t  general_profile_idc;
441   uint8_t  general_level_idc;
442   uint8_t  general_tier_flag;
443   uint32_t intra_period;
444   uint16_t pic_width_in_luma_samples;
445   uint16_t pic_height_in_luma_samples;
446   uint32_t chroma_format_idc;
447   uint32_t bit_depth_luma_minus8;
448   uint32_t bit_depth_chroma_minus8;
449   bool strong_intra_smoothing_enabled_flag;
450   bool amp_enabled_flag;
451   bool sample_adaptive_offset_enabled_flag;
452   bool pcm_enabled_flag;
453   bool sps_temporal_mvp_enabled_flag;
454   uint8_t  log2_min_luma_coding_block_size_minus3;
455   uint8_t  log2_diff_max_min_luma_coding_block_size;
456   uint8_t  log2_min_transform_block_size_minus2;
457   uint8_t  log2_diff_max_min_transform_block_size;
458   uint8_t  max_transform_hierarchy_depth_inter;
459   uint8_t  max_transform_hierarchy_depth_intra;
460};
461
462struct pipe_h265_enc_pic_param
463{
464   uint8_t log2_parallel_merge_level_minus2;
465   uint8_t nal_unit_type;
466   bool constrained_intra_pred_flag;
467};
468
469struct pipe_h265_enc_slice_param
470{
471   uint8_t max_num_merge_cand;
472   int8_t slice_cb_qp_offset;
473   int8_t slice_cr_qp_offset;
474   int8_t slice_beta_offset_div2;
475   int8_t slice_tc_offset_div2;
476   bool cabac_init_flag;
477   uint32_t slice_deblocking_filter_disabled_flag;
478   bool slice_loop_filter_across_slices_enabled_flag;
479};
480
481struct pipe_h265_enc_rate_control
482{
483   enum pipe_h265_enc_rate_control_method rate_ctrl_method;
484   unsigned target_bitrate;
485   unsigned peak_bitrate;
486   unsigned frame_rate_num;
487   unsigned frame_rate_den;
488   unsigned quant_i_frames;
489   unsigned vbv_buffer_size;
490   unsigned vbv_buf_lv;
491   unsigned target_bits_picture;
492   unsigned peak_bits_picture_integer;
493   unsigned peak_bits_picture_fraction;
494   unsigned fill_data_enable;
495   unsigned enforce_hrd;
496};
497
498struct pipe_h265_enc_picture_desc
499{
500   struct pipe_picture_desc base;
501
502   struct pipe_h265_enc_seq_param seq;
503   struct pipe_h265_enc_pic_param pic;
504   struct pipe_h265_enc_slice_param slice;
505   struct pipe_h265_enc_rate_control rc;
506
507   enum pipe_h265_enc_picture_type picture_type;
508   unsigned decoded_curr_pic;
509   unsigned reference_frames[16];
510   unsigned frame_num;
511   unsigned pic_order_cnt;
512   unsigned pic_order_cnt_type;
513   unsigned ref_idx_l0;
514   unsigned ref_idx_l1;
515   bool not_referenced;
516   struct util_hash_table *frame_idx;
517};
518
519struct pipe_h265_sps
520{
521   uint8_t chroma_format_idc;
522   uint8_t separate_colour_plane_flag;
523   uint32_t pic_width_in_luma_samples;
524   uint32_t pic_height_in_luma_samples;
525   uint8_t bit_depth_luma_minus8;
526   uint8_t bit_depth_chroma_minus8;
527   uint8_t log2_max_pic_order_cnt_lsb_minus4;
528   uint8_t sps_max_dec_pic_buffering_minus1;
529   uint8_t log2_min_luma_coding_block_size_minus3;
530   uint8_t log2_diff_max_min_luma_coding_block_size;
531   uint8_t log2_min_transform_block_size_minus2;
532   uint8_t log2_diff_max_min_transform_block_size;
533   uint8_t max_transform_hierarchy_depth_inter;
534   uint8_t max_transform_hierarchy_depth_intra;
535   uint8_t scaling_list_enabled_flag;
536   uint8_t ScalingList4x4[6][16];
537   uint8_t ScalingList8x8[6][64];
538   uint8_t ScalingList16x16[6][64];
539   uint8_t ScalingList32x32[2][64];
540   uint8_t ScalingListDCCoeff16x16[6];
541   uint8_t ScalingListDCCoeff32x32[2];
542   uint8_t amp_enabled_flag;
543   uint8_t sample_adaptive_offset_enabled_flag;
544   uint8_t pcm_enabled_flag;
545   uint8_t pcm_sample_bit_depth_luma_minus1;
546   uint8_t pcm_sample_bit_depth_chroma_minus1;
547   uint8_t log2_min_pcm_luma_coding_block_size_minus3;
548   uint8_t log2_diff_max_min_pcm_luma_coding_block_size;
549   uint8_t pcm_loop_filter_disabled_flag;
550   uint8_t num_short_term_ref_pic_sets;
551   uint8_t long_term_ref_pics_present_flag;
552   uint8_t num_long_term_ref_pics_sps;
553   uint8_t sps_temporal_mvp_enabled_flag;
554   uint8_t strong_intra_smoothing_enabled_flag;
555};
556
557struct pipe_h265_pps
558{
559   struct pipe_h265_sps *sps;
560
561   uint8_t dependent_slice_segments_enabled_flag;
562   uint8_t output_flag_present_flag;
563   uint8_t num_extra_slice_header_bits;
564   uint8_t sign_data_hiding_enabled_flag;
565   uint8_t cabac_init_present_flag;
566   uint8_t num_ref_idx_l0_default_active_minus1;
567   uint8_t num_ref_idx_l1_default_active_minus1;
568   int8_t init_qp_minus26;
569   uint8_t constrained_intra_pred_flag;
570   uint8_t transform_skip_enabled_flag;
571   uint8_t cu_qp_delta_enabled_flag;
572   uint8_t diff_cu_qp_delta_depth;
573   int8_t pps_cb_qp_offset;
574   int8_t pps_cr_qp_offset;
575   uint8_t pps_slice_chroma_qp_offsets_present_flag;
576   uint8_t weighted_pred_flag;
577   uint8_t weighted_bipred_flag;
578   uint8_t transquant_bypass_enabled_flag;
579   uint8_t tiles_enabled_flag;
580   uint8_t entropy_coding_sync_enabled_flag;
581   uint8_t num_tile_columns_minus1;
582   uint8_t num_tile_rows_minus1;
583   uint8_t uniform_spacing_flag;
584   uint16_t column_width_minus1[20];
585   uint16_t row_height_minus1[22];
586   uint8_t loop_filter_across_tiles_enabled_flag;
587   uint8_t pps_loop_filter_across_slices_enabled_flag;
588   uint8_t deblocking_filter_control_present_flag;
589   uint8_t deblocking_filter_override_enabled_flag;
590   uint8_t pps_deblocking_filter_disabled_flag;
591   int8_t pps_beta_offset_div2;
592   int8_t pps_tc_offset_div2;
593   uint8_t lists_modification_present_flag;
594   uint8_t log2_parallel_merge_level_minus2;
595   uint8_t slice_segment_header_extension_present_flag;
596};
597
598struct pipe_h265_picture_desc
599{
600   struct pipe_picture_desc base;
601
602   struct pipe_h265_pps *pps;
603
604   uint8_t IDRPicFlag;
605   uint8_t RAPPicFlag;
606   uint8_t CurrRpsIdx;
607   uint32_t NumPocTotalCurr;
608   uint32_t NumDeltaPocsOfRefRpsIdx;
609   uint32_t NumShortTermPictureSliceHeaderBits;
610   uint32_t NumLongTermPictureSliceHeaderBits;
611
612   int32_t CurrPicOrderCntVal;
613   struct pipe_video_buffer *ref[16];
614   int32_t PicOrderCntVal[16];
615   uint8_t IsLongTerm[16];
616   uint8_t NumPocStCurrBefore;
617   uint8_t NumPocStCurrAfter;
618   uint8_t NumPocLtCurr;
619   uint8_t RefPicSetStCurrBefore[8];
620   uint8_t RefPicSetStCurrAfter[8];
621   uint8_t RefPicSetLtCurr[8];
622   uint8_t RefPicList[2][15];
623   bool UseRefPicList;
624};
625
626struct pipe_mjpeg_picture_desc
627{
628   struct pipe_picture_desc base;
629
630   struct
631   {
632      uint16_t picture_width;
633      uint16_t picture_height;
634
635      struct {
636         uint8_t component_id;
637         uint8_t h_sampling_factor;
638         uint8_t v_sampling_factor;
639         uint8_t quantiser_table_selector;
640      } components[255];
641
642      uint8_t num_components;
643   } picture_parameter;
644
645   struct
646   {
647      uint8_t load_quantiser_table[4];
648      uint8_t quantiser_table[4][64];
649   } quantization_table;
650
651   struct
652   {
653      uint8_t load_huffman_table[2];
654
655      struct {
656         uint8_t   num_dc_codes[16];
657         uint8_t   dc_values[12];
658         uint8_t   num_ac_codes[16];
659         uint8_t   ac_values[162];
660         uint8_t   pad[2];
661      } table[2];
662   } huffman_table;
663
664   struct
665   {
666      unsigned slice_data_size;
667      unsigned slice_data_offset;
668      unsigned slice_data_flag;
669      unsigned slice_horizontal_position;
670      unsigned slice_vertical_position;
671
672      struct {
673         uint8_t component_selector;
674         uint8_t dc_table_selector;
675         uint8_t ac_table_selector;
676      } components[4];
677
678      uint8_t num_components;
679
680      uint16_t restart_interval;
681      unsigned num_mcus;
682   } slice_parameter;
683};
684
685struct vp9_segment_parameter
686{
687   struct {
688      uint16_t segment_reference_enabled:1;
689      uint16_t segment_reference:2;
690      uint16_t segment_reference_skipped:1;
691   } segment_flags;
692
693   bool alt_quant_enabled;
694   int16_t alt_quant;
695
696   bool alt_lf_enabled;
697   int16_t alt_lf;
698
699   uint8_t filter_level[4][2];
700
701   int16_t luma_ac_quant_scale;
702   int16_t luma_dc_quant_scale;
703
704   int16_t chroma_ac_quant_scale;
705   int16_t chroma_dc_quant_scale;
706};
707
708struct pipe_vp9_picture_desc
709{
710   struct pipe_picture_desc base;
711
712   struct pipe_video_buffer *ref[16];
713
714   struct {
715      uint16_t frame_width;
716      uint16_t frame_height;
717
718      struct {
719         uint32_t  subsampling_x:1;
720         uint32_t  subsampling_y:1;
721         uint32_t  frame_type:1;
722         uint32_t  show_frame:1;
723         uint32_t  error_resilient_mode:1;
724         uint32_t  intra_only:1;
725         uint32_t  allow_high_precision_mv:1;
726         uint32_t  mcomp_filter_type:3;
727         uint32_t  frame_parallel_decoding_mode:1;
728         uint32_t  reset_frame_context:2;
729         uint32_t  refresh_frame_context:1;
730         uint32_t  frame_context_idx:2;
731         uint32_t  segmentation_enabled:1;
732         uint32_t  segmentation_temporal_update:1;
733         uint32_t  segmentation_update_map:1;
734         uint32_t  last_ref_frame:3;
735         uint32_t  last_ref_frame_sign_bias:1;
736         uint32_t  golden_ref_frame:3;
737         uint32_t  golden_ref_frame_sign_bias:1;
738         uint32_t  alt_ref_frame:3;
739         uint32_t  alt_ref_frame_sign_bias:1;
740         uint32_t  lossless_flag:1;
741      } pic_fields;
742
743      uint8_t filter_level;
744      uint8_t sharpness_level;
745
746      uint8_t log2_tile_rows;
747      uint8_t log2_tile_columns;
748
749      uint8_t frame_header_length_in_bytes;
750
751      uint16_t first_partition_size;
752
753      uint8_t mb_segment_tree_probs[7];
754      uint8_t segment_pred_probs[3];
755
756      uint8_t profile;
757
758      uint8_t bit_depth;
759
760      bool mode_ref_delta_enabled;
761      bool mode_ref_delta_update;
762
763      uint8_t base_qindex;
764      int8_t y_dc_delta_q;
765      int8_t uv_ac_delta_q;
766      int8_t uv_dc_delta_q;
767   } picture_parameter;
768
769   struct {
770      uint32_t slice_data_size;
771      uint32_t slice_data_offset;
772
773      uint32_t slice_data_flag;
774
775      struct vp9_segment_parameter seg_param[8];
776   } slice_parameter;
777};
778
779#ifdef __cplusplus
780}
781#endif
782
783#endif /* PIPE_VIDEO_STATE_H */
784