~mmach/netext73/mesa-ryzen

« back to all changes in this revision

Viewing changes to src/gallium/include/pipe/p_video_state.h

  • Committer: mmach
  • Date: 2023-11-02 21:31:35 UTC
  • Revision ID: netbit73@gmail.com-20231102213135-18d4tzh7tj0uz752
2023-11-02 22:11:57

Show diffs side-by-side

added added

removed removed

Lines of Context:
41
41
#endif
42
42
 
43
43
#define PIPE_H265_MAX_REFERENCES      15
 
44
#define PIPE_AV1_MAX_REFERENCES       8
44
45
#define PIPE_DEFAULT_FRAME_RATE_DEN   1
45
46
#define PIPE_DEFAULT_FRAME_RATE_NUM   30
 
47
#define PIPE_DEFAULT_INTRA_IDR_PERIOD 30
46
48
#define PIPE_H2645_EXTENDED_SAR       255
47
49
#define PIPE_DEFAULT_DECODER_FEEDBACK_TIMEOUT_NS 1000000000
48
50
 
127
129
   PIPE_H265_SLICE_TYPE_I = 0x2,
128
130
};
129
131
 
 
132
/* To be used on each encoding feature bit field */
 
133
enum pipe_enc_feature
 
134
{
 
135
   PIPE_ENC_FEATURE_NOT_SUPPORTED = 0x0,
 
136
   PIPE_ENC_FEATURE_SUPPORTED = 0x1,
 
137
   PIPE_ENC_FEATURE_REQUIRED = 0x2,
 
138
};
 
139
 
130
140
/* Same enum for h264/h265 */
131
141
enum pipe_h2645_enc_picture_type
132
142
{
137
147
   PIPE_H2645_ENC_PICTURE_TYPE_SKIP = 0x04
138
148
};
139
149
 
 
150
enum pipe_av1_enc_frame_type
 
151
{
 
152
   PIPE_AV1_ENC_FRAME_TYPE_KEY = 0x00,
 
153
   PIPE_AV1_ENC_FRAME_TYPE_INTER = 0x01,
 
154
   PIPE_AV1_ENC_FRAME_TYPE_INTRA_ONLY = 0x02,
 
155
   PIPE_AV1_ENC_FRAME_TYPE_SWITCH = 0x03,
 
156
   PIPE_AV1_ENC_FRAME_TYPE_SHOW_EXISTING = 0x04
 
157
};
 
158
 
140
159
enum pipe_h2645_enc_rate_control_method
141
160
{
142
161
   PIPE_H2645_ENC_RATE_CONTROL_METHOD_DISABLE = 0x00,
143
162
   PIPE_H2645_ENC_RATE_CONTROL_METHOD_CONSTANT_SKIP = 0x01,
144
163
   PIPE_H2645_ENC_RATE_CONTROL_METHOD_VARIABLE_SKIP = 0x02,
145
164
   PIPE_H2645_ENC_RATE_CONTROL_METHOD_CONSTANT = 0x03,
146
 
   PIPE_H2645_ENC_RATE_CONTROL_METHOD_VARIABLE = 0x04
 
165
   PIPE_H2645_ENC_RATE_CONTROL_METHOD_VARIABLE = 0x04,
 
166
   PIPE_H2645_ENC_RATE_CONTROL_METHOD_QUALITY_VARIABLE = 0x05
147
167
};
148
168
 
149
169
enum pipe_slice_buffer_placement_type
167
187
   uint32_t key_size;
168
188
   enum pipe_format input_format;
169
189
   enum pipe_format output_format;
170
 
   /* A fence used on PIPE_VIDEO_ENTRYPOINT_DECODE to signal job completion */
 
190
   /* A fence used on PIPE_VIDEO_ENTRYPOINT_DECODE/PROCESSING to signal job completion */
171
191
   struct pipe_fence_handle **fence;
172
192
};
173
193
 
382
402
   uint32_t frame_num_list[16];
383
403
 
384
404
   struct pipe_video_buffer *ref[16];
 
405
 
 
406
   struct
 
407
   {
 
408
      bool slice_info_present;
 
409
      uint32_t slice_count;
 
410
      uint32_t slice_data_size[128];
 
411
      uint32_t slice_data_offset[128];
 
412
      enum pipe_slice_buffer_placement_type slice_data_flag[128];
 
413
   } slice_parameter;
385
414
};
386
415
 
387
416
struct pipe_enc_quality_modes
401
430
   unsigned frame_rate_den;
402
431
   unsigned vbv_buffer_size;
403
432
   unsigned vbv_buf_lv;
 
433
   unsigned vbv_buf_initial_size;
 
434
   bool app_requested_hrd_buffer;
404
435
   unsigned target_bits_picture;
405
436
   unsigned peak_bits_picture_integer;
406
437
   unsigned peak_bits_picture_fraction;
410
441
   unsigned max_au_size;
411
442
   unsigned max_qp;
412
443
   unsigned min_qp;
 
444
   bool app_requested_qp_range;
 
445
 
 
446
   /* Used with PIPE_H2645_ENC_RATE_CONTROL_METHOD_QUALITY_VARIABLE */
 
447
   unsigned vbr_quality_factor;
413
448
};
414
449
 
415
450
struct pipe_h264_enc_motion_estimation
601
636
   unsigned quant_b_frames;
602
637
   unsigned vbv_buffer_size;
603
638
   unsigned vbv_buf_lv;
 
639
   unsigned vbv_buf_initial_size;
 
640
   bool app_requested_hrd_buffer;
604
641
   unsigned target_bits_picture;
605
642
   unsigned peak_bits_picture_integer;
606
643
   unsigned peak_bits_picture_fraction;
610
647
   unsigned max_au_size;
611
648
   unsigned max_qp;
612
649
   unsigned min_qp;
 
650
   bool app_requested_qp_range;
 
651
 
 
652
   /* Used with PIPE_H2645_ENC_RATE_CONTROL_METHOD_QUALITY_VARIABLE */
 
653
   unsigned vbr_quality_factor;
613
654
};
614
655
 
615
656
struct pipe_h265_enc_picture_desc
639
680
   struct h265_slice_descriptor slices_descriptors[128];
640
681
};
641
682
 
 
683
struct pipe_av1_enc_rate_control
 
684
{
 
685
   enum pipe_h2645_enc_rate_control_method rate_ctrl_method;
 
686
   unsigned target_bitrate;
 
687
   unsigned peak_bitrate;
 
688
   unsigned frame_rate_num;
 
689
   unsigned frame_rate_den;
 
690
   unsigned vbv_buffer_size;
 
691
   unsigned vbv_buf_lv;
 
692
   unsigned vbv_buf_initial_size;
 
693
   bool app_requested_hrd_buffer;
 
694
   unsigned target_bits_picture;
 
695
   unsigned peak_bits_picture_integer;
 
696
   unsigned peak_bits_picture_fraction;
 
697
   unsigned fill_data_enable;
 
698
   unsigned skip_frame_enable;
 
699
   unsigned enforce_hrd;
 
700
   unsigned max_au_size;
 
701
   unsigned qp; /* Initial QP */
 
702
   unsigned max_qp;
 
703
   unsigned min_qp;
 
704
   bool app_requested_qp_range;
 
705
   bool app_requested_initial_qp;
 
706
 
 
707
   /* Used with PIPE_H2645_ENC_RATE_CONTROL_METHOD_QUALITY_VARIABLE */
 
708
   unsigned vbr_quality_factor;
 
709
};
 
710
 
 
711
struct pipe_av1_enc_decoder_model_info
 
712
{
 
713
   uint32_t buffer_delay_length_minus1;
 
714
   uint32_t num_units_in_decoding_tick;
 
715
   uint32_t buffer_removal_time_length_minus1;
 
716
   uint32_t frame_presentation_time_length_minus1;
 
717
};
 
718
 
 
719
struct pipe_av1_enc_color_description
 
720
{
 
721
   uint32_t color_primaries;
 
722
   uint32_t transfer_characteristics;
 
723
   uint32_t matrix_coefficients;
 
724
   uint32_t color_range;
 
725
   uint32_t chroma_sample_position;
 
726
};
 
727
struct pipe_av1_enc_seq_param
 
728
{
 
729
   uint32_t profile;
 
730
   uint32_t level;
 
731
   uint32_t tier;
 
732
   uint32_t num_temporal_layers;
 
733
   uint32_t intra_period;
 
734
   uint32_t ip_period;
 
735
   uint32_t bit_depth_minus8;
 
736
   uint32_t pic_width_in_luma_samples;
 
737
   uint32_t pic_height_in_luma_samples;
 
738
   struct
 
739
   {
 
740
      uint32_t use_128x128_superblock:1;
 
741
      uint32_t enable_filter_intra :1;
 
742
      uint32_t enable_intra_edge_filter :1;
 
743
      uint32_t enable_interintra_compound :1;
 
744
      uint32_t enable_masked_compound :1;
 
745
      uint32_t enable_warped_motion :1;
 
746
      uint32_t enable_dual_filter :1;
 
747
      uint32_t enable_cdef:1;
 
748
      uint32_t enable_restoration:1;
 
749
      uint32_t enable_superres:1;
 
750
      uint32_t enable_order_hint:1;
 
751
      uint32_t enable_jnt_comp:1;
 
752
      uint32_t color_description_present_flag:1;
 
753
      uint32_t enable_ref_frame_mvs:1;
 
754
      uint32_t frame_id_number_present_flag:1;
 
755
      uint32_t disable_screen_content_tools:1;
 
756
      uint32_t timing_info_present_flag:1;
 
757
      uint32_t equal_picture_interval:1;
 
758
      uint32_t decoder_model_info_present_flag:1;
 
759
      uint32_t force_screen_content_tools:2;
 
760
      uint32_t force_integer_mv:2;
 
761
   } seq_bits;
 
762
 
 
763
   /* timing info params */
 
764
   uint32_t num_units_in_display_tick;
 
765
   uint32_t time_scale;
 
766
   uint32_t num_tick_per_picture_minus1;
 
767
   uint32_t delta_frame_id_length;
 
768
   uint32_t additional_frame_id_length;
 
769
   uint32_t order_hint_bits;
 
770
   struct pipe_av1_enc_decoder_model_info decoder_model_info;
 
771
   struct pipe_av1_enc_color_description color_config;
 
772
   uint16_t frame_width_bits_minus1;
 
773
   uint16_t frame_height_bits_minus1;
 
774
   uint16_t operating_point_idc[32];
 
775
   uint8_t decoder_model_present_for_this_op[32];
 
776
};
 
777
 
 
778
struct pipe_av1_tile_group {
 
779
   uint8_t tile_group_start;
 
780
   uint8_t tile_group_end;
 
781
};
 
782
 
 
783
struct pipe_av1_enc_picture_desc
 
784
{
 
785
   struct pipe_picture_desc base;
 
786
   enum pipe_av1_enc_frame_type frame_type;
 
787
   struct pipe_av1_enc_seq_param seq;
 
788
   struct pipe_av1_enc_rate_control rc[4];
 
789
   struct {
 
790
      uint32_t enable_frame_obu:1;
 
791
      uint32_t error_resilient_mode:1;
 
792
      uint32_t disable_cdf_update:1;
 
793
      uint32_t frame_size_override_flag:1;
 
794
      uint32_t allow_screen_content_tools:1;
 
795
      uint32_t allow_intrabc:1;
 
796
      uint32_t force_integer_mv:1;
 
797
      uint32_t disable_frame_end_update_cdf:1;
 
798
      uint32_t palette_mode_enable:1;
 
799
      uint32_t allow_high_precision_mv:1;
 
800
      uint32_t use_ref_frame_mvs;
 
801
      uint32_t show_existing_frame:1;
 
802
      uint32_t enable_render_size:1;
 
803
      uint32_t use_superres:1;
 
804
      uint32_t reduced_tx_set:1;
 
805
      uint32_t skip_mode_present:1;
 
806
   };
 
807
   struct pipe_enc_quality_modes quality_modes;
 
808
   uint32_t num_tiles_in_pic; /* [1, 32], */
 
809
   uint32_t tile_rows;
 
810
   uint32_t tile_cols;
 
811
   unsigned num_tile_groups;
 
812
   struct pipe_av1_tile_group tile_groups[256];
 
813
   uint32_t context_update_tile_id;
 
814
   uint16_t width_in_sbs_minus_1[63];
 
815
   uint16_t height_in_sbs_minus_1[63];
 
816
   uint32_t frame_num;
 
817
   uint32_t last_key_frame_num;
 
818
   uint32_t number_of_skips;
 
819
   uint32_t temporal_id;
 
820
   uint32_t spatial_id;
 
821
   uint16_t frame_width;
 
822
   uint16_t frame_height;
 
823
   uint16_t frame_width_sb;
 
824
   uint16_t frame_height_sb;
 
825
   uint16_t upscaled_width;
 
826
   uint16_t render_width;
 
827
   uint16_t render_height;
 
828
   uint32_t interpolation_filter;
 
829
   uint8_t tx_mode;
 
830
   uint8_t compound_reference_mode;
 
831
   uint32_t order_hint;
 
832
   uint8_t superres_scale_denominator;
 
833
   uint32_t primary_ref_frame;
 
834
   uint8_t refresh_frame_flags;
 
835
   uint8_t ref_frame_idx[7];
 
836
 
 
837
   struct {
 
838
      uint8_t cdef_damping_minus_3;
 
839
      uint8_t cdef_bits;
 
840
      uint8_t cdef_y_strengths[8];
 
841
      uint8_t cdef_uv_strengths[8];
 
842
   } cdef;
 
843
 
 
844
   struct {
 
845
      uint8_t yframe_restoration_type;
 
846
      uint8_t cbframe_restoration_type;
 
847
      uint8_t crframe_restoration_type;
 
848
      uint8_t lr_unit_shift;
 
849
      uint8_t lr_uv_shift;
 
850
   } restoration;
 
851
 
 
852
   struct {
 
853
      uint8_t filter_level[2];
 
854
      uint8_t filter_level_u;
 
855
      uint8_t filter_level_v;
 
856
      uint8_t sharpness_level;
 
857
      uint8_t mode_ref_delta_enabled;
 
858
      uint8_t mode_ref_delta_update;
 
859
      int8_t  ref_deltas[8];
 
860
      int8_t  mode_deltas[2];
 
861
      uint8_t delta_lf_present;
 
862
      uint8_t delta_lf_res;
 
863
      uint8_t delta_lf_multi;
 
864
   } loop_filter;
 
865
 
 
866
   struct {
 
867
      uint8_t base_qindex;
 
868
      int8_t y_dc_delta_q;
 
869
      int8_t u_dc_delta_q;
 
870
      int8_t u_ac_delta_q;
 
871
      int8_t v_dc_delta_q;
 
872
      int8_t v_ac_delta_q;
 
873
      uint8_t min_base_qindex;
 
874
      uint8_t max_base_qindex;
 
875
      uint8_t using_qmatrix;
 
876
      uint8_t qm_y;
 
877
      uint8_t qm_u;
 
878
      uint8_t qm_v;
 
879
      uint8_t delta_q_present;
 
880
      uint8_t delta_q_res;
 
881
   } quantization;
 
882
 
 
883
   struct {
 
884
      uint8_t obu_extension_flag;
 
885
      uint8_t obu_has_size_field;
 
886
      uint8_t temporal_id;
 
887
      uint8_t spatial_id;
 
888
   } tg_obu_header;
 
889
};
 
890
 
642
891
struct pipe_h265_sps
643
892
{
644
893
   uint8_t chroma_format_idc;
1130
1379
   struct u_rect dst_region;
1131
1380
   enum pipe_video_vpp_orientation orientation;
1132
1381
   struct pipe_vpp_blend blend;
 
1382
 
 
1383
   /* Fence to wait on for the src surface */
 
1384
   struct pipe_fence_handle *src_surface_fence;
1133
1385
};
1134
1386
 
1135
1387
 
1146
1398
   PIPE_H265_PRED_DIRECTION_BI_NOT_EMPTY = 0x4,
1147
1399
};
1148
1400
 
1149
 
/* To be used on each h265 feature bit field
1150
 
   defined in pipe_h265_enc_cap_features
1151
 
*/
1152
 
enum pipe_h265_enc_feature
1153
 
{
1154
 
   PIPE_H265_ENC_FEATURE_NOT_SUPPORTED = 0x0,
1155
 
   PIPE_H265_ENC_FEATURE_SUPPORTED = 0x1,
1156
 
   PIPE_H265_ENC_FEATURE_REQUIRED = 0x2,
1157
 
};
1158
 
 
1159
1401
/* To be used with PIPE_VIDEO_CAP_ENC_HEVC_FEATURE_FLAGS
1160
1402
   the config_supported bit is used to differenciate a supported
1161
1403
   config with all bits as zero and unsupported by driver with value=0
1347
1589
      uint32_t value;
1348
1590
};
1349
1591
 
 
1592
union pipe_av1_enc_cap_features {
 
1593
    struct {
 
1594
        /**
 
1595
         * Use 128x128 superblock.
 
1596
         *
 
1597
         * Allows setting use_128x128_superblock in the SPS.
 
1598
         */
 
1599
        uint32_t support_128x128_superblock     : 2;
 
1600
        /**
 
1601
         * Intra  filter.
 
1602
         * Allows setting enable_filter_intra in the SPS.
 
1603
         */
 
1604
        uint32_t support_filter_intra           : 2;
 
1605
        /**
 
1606
         *  Intra edge filter.
 
1607
         * Allows setting enable_intra_edge_filter in the SPS.
 
1608
         */
 
1609
        uint32_t support_intra_edge_filter      : 2;
 
1610
        /**
 
1611
         *  Interintra compound.
 
1612
         * Allows setting enable_interintra_compound in the SPS.
 
1613
         */
 
1614
        uint32_t support_interintra_compound    : 2;
 
1615
        /**
 
1616
         *  Masked compound.
 
1617
         * Allows setting enable_masked_compound in the SPS.
 
1618
         */
 
1619
        uint32_t support_masked_compound        : 2;
 
1620
        /**
 
1621
         *  Warped motion.
 
1622
         * Allows setting enable_warped_motion in the SPS.
 
1623
         */
 
1624
        uint32_t support_warped_motion          : 2;
 
1625
        /**
 
1626
         *  Palette mode.
 
1627
         * Allows setting palette_mode in the PPS.
 
1628
         */
 
1629
        uint32_t support_palette_mode           : 2;
 
1630
        /**
 
1631
         *  Dual filter.
 
1632
         * Allows setting enable_dual_filter in the SPS.
 
1633
         */
 
1634
        uint32_t support_dual_filter            : 2;
 
1635
        /**
 
1636
         *  Jnt compound.
 
1637
         * Allows setting enable_jnt_comp in the SPS.
 
1638
         */
 
1639
        uint32_t support_jnt_comp               : 2;
 
1640
        /**
 
1641
         *  Refrence frame mvs.
 
1642
         * Allows setting enable_ref_frame_mvs in the SPS.
 
1643
         */
 
1644
        uint32_t support_ref_frame_mvs          : 2;
 
1645
        /**
 
1646
         *  Super resolution.
 
1647
         * Allows setting enable_superres in the SPS.
 
1648
         */
 
1649
        uint32_t support_superres               : 2;
 
1650
        /**
 
1651
         *  Restoration.
 
1652
         * Allows setting enable_restoration in the SPS.
 
1653
         */
 
1654
        uint32_t support_restoration            : 2;
 
1655
        /**
 
1656
         *  Allow intraBC.
 
1657
         * Allows setting allow_intrabc in the PPS.
 
1658
         */
 
1659
        uint32_t support_allow_intrabc          : 2;
 
1660
        /**
 
1661
         *  Cdef channel strength.
 
1662
         * Allows setting cdef_y_strengths and cdef_uv_strengths in PPS.
 
1663
         */
 
1664
        uint32_t support_cdef_channel_strength  : 2;
 
1665
        /** Reserved bits for future, must be zero. */
 
1666
        uint32_t reserved                       : 4;
 
1667
    } bits;
 
1668
    uint32_t value;
 
1669
};
 
1670
 
 
1671
union pipe_av1_enc_cap_features_ext1 {
 
1672
    struct {
 
1673
        /**
 
1674
         * Fields indicate which types of interpolation filter are supported.
 
1675
         * (interpolation_filter & 0x01) == 1: eight_tap filter is supported, 0: not.
 
1676
         * (interpolation_filter & 0x02) == 1: eight_tap_smooth filter is supported, 0: not.
 
1677
         * (interpolation_filter & 0x04) == 1: eight_sharp filter is supported, 0: not.
 
1678
         * (interpolation_filter & 0x08) == 1: bilinear filter is supported, 0: not.
 
1679
         * (interpolation_filter & 0x10) == 1: switchable filter is supported, 0: not.
 
1680
         */
 
1681
        uint32_t interpolation_filter          : 5;
 
1682
        /**
 
1683
         * Min segmentId block size accepted.
 
1684
         * Application need to send seg_id_block_size in PPS equal or larger than this value.
 
1685
         */
 
1686
        uint32_t min_segid_block_size_accepted : 8;
 
1687
        /**
 
1688
         * Type of segment feature supported.
 
1689
         * (segment_feature_support & 0x01) == 1: SEG_LVL_ALT_Q is supported, 0: not.
 
1690
         * (segment_feature_support & 0x02) == 1: SEG_LVL_ALT_LF_Y_V is supported, 0: not.
 
1691
         * (segment_feature_support & 0x04) == 1: SEG_LVL_ALT_LF_Y_H is supported, 0: not.
 
1692
         * (segment_feature_support & 0x08) == 1: SEG_LVL_ALT_LF_U is supported, 0: not.
 
1693
         * (segment_feature_support & 0x10) == 1: SEG_LVL_ALT_LF_V is supported, 0: not.
 
1694
         * (segment_feature_support & 0x20) == 1: SEG_LVL_REF_FRAME is supported, 0: not.
 
1695
         * (segment_feature_support & 0x40) == 1: SEG_LVL_SKIP is supported, 0: not.
 
1696
         * (segment_feature_support & 0x80) == 1: SEG_LVL_GLOBALMV is supported, 0: not.
 
1697
         */
 
1698
        uint32_t segment_feature_support       : 8;
 
1699
        /** Reserved bits for future, must be zero. */
 
1700
        uint32_t reserved                      : 11;
 
1701
    } bits;
 
1702
    uint32_t value;
 
1703
};
 
1704
 
 
1705
union pipe_av1_enc_cap_features_ext2 {
 
1706
    struct {
 
1707
        /**
 
1708
        * Tile size bytes minus1.
 
1709
        * Specify the number of bytes needed to code tile size supported.
 
1710
        * This value need to be set in frame header obu.
 
1711
        */
 
1712
        uint32_t tile_size_bytes_minus1        : 2;
 
1713
        /**
 
1714
        * Tile size bytes minus1.
 
1715
        * Specify the fixed number of bytes needed to code syntax obu_size.
 
1716
        */
 
1717
        uint32_t obu_size_bytes_minus1         : 2;
 
1718
        /**
 
1719
         * tx_mode supported.
 
1720
         * (tx_mode_support & 0x01) == 1: ONLY_4X4 is supported, 0: not.
 
1721
         * (tx_mode_support & 0x02) == 1: TX_MODE_LARGEST is supported, 0: not.
 
1722
         * (tx_mode_support & 0x04) == 1: TX_MODE_SELECT is supported, 0: not.
 
1723
         */
 
1724
        uint32_t tx_mode_support               : 3;
 
1725
        /**
 
1726
         * Max tile num minus1.
 
1727
         * Specify the max number of tile supported by driver.
 
1728
         */
 
1729
        uint32_t max_tile_num_minus1           : 13;
 
1730
        /** Reserved bits for future, must be zero. */
 
1731
        uint32_t reserved                      : 12;
 
1732
    } bits;
 
1733
    uint32_t value;
 
1734
};
 
1735
 
1350
1736
#ifdef __cplusplus
1351
1737
}
1352
1738
#endif