pipe: Add PIPE_VIDEO_CAP_ENC_MOVE_RECTS and pipe_enc_move_rects for H264/H265 encode

Reviewed-By: Pohsiang Hsu <pohhsu@microsoft.com>
Reviewed-by: Ruijing Dong <ruijing.dong@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/34844>
This commit is contained in:
Sil Vilerino 2024-09-12 14:57:36 -04:00 committed by Marge Bot
parent 6d81bc0cdd
commit 7c490bb860
2 changed files with 62 additions and 1 deletions

View file

@ -185,6 +185,10 @@ enum pipe_video_cap
* Support for dirty rects in encoder picture params pipe_enc_cap_dirty_rect
*/
PIPE_VIDEO_CAP_ENC_DIRTY_RECTS = 57,
/*
* Support for move rects in encoder picture params pipe_enc_cap_move_rect
*/
PIPE_VIDEO_CAP_ENC_MOVE_RECTS = 58,
};
enum pipe_video_h264_enc_dbk_filter_mode_flags

View file

@ -56,7 +56,7 @@ extern "C" {
#define PIPE_ENC_ROI_REGION_NUM_MAX 32
#define PIPE_ENC_DIRTY_RECTS_NUM_MAX 256
#define PIPE_ENC_MOVE_RECTS_NUM_MAX 256
#define PIPE_ENC_MOVE_MAP_MAX_HINTS 256
#define PIPE_ENC_MOVE_MAP_MAX_HINTS 31
#define PIPE_H2645_LIST_REF_INVALID_ENTRY 0xff
#define PIPE_H265_MAX_LONG_TERM_REF_PICS_SPS 32
#define PIPE_H265_MAX_LONG_TERM_PICS 16
@ -545,6 +545,34 @@ struct pipe_enc_dirty_rects
} rects[PIPE_ENC_DIRTY_RECTS_NUM_MAX];
};
enum pipe_enc_move_rects_precision_unit
{
PIPE_ENC_MOVE_RECTS_PRECISION_UNIT_FULL_PIXEL = 0,
PIPE_ENC_MOVE_RECTS_PRECISION_UNIT_HALF_PIXEL = 1,
PIPE_ENC_MOVE_RECTS_PRECISION_UNIT_QUARTER_PIXEL = 2,
};
struct pipe_enc_move_rects
{
unsigned int num_rects;
struct
{
struct {
uint32_t x;
uint32_t y;
} source_point;
struct {
uint32_t top;
uint32_t left;
uint32_t right;
uint32_t bottom;
} dest_rect;
} rects[PIPE_ENC_MOVE_RECTS_NUM_MAX];
uint8_t dpb_reference_index; /* index in dpb for the recon pic the rects refer to */
enum pipe_enc_move_rects_precision_unit precision;
bool overlapping_rects;
};
struct pipe_enc_raw_header
{
uint8_t type; /* nal_unit_type or obu_type */
@ -827,6 +855,7 @@ struct pipe_h264_enc_picture_desc
struct pipe_enc_intra_refresh intra_refresh;
struct pipe_enc_roi roi;
struct pipe_enc_dirty_rects dirty_rects;
struct pipe_enc_move_rects move_rects;
bool not_referenced;
bool is_ltr;
@ -1211,6 +1240,7 @@ struct pipe_h265_enc_picture_desc
struct pipe_enc_intra_refresh intra_refresh;
struct pipe_enc_roi roi;
struct pipe_enc_dirty_rects dirty_rects;
struct pipe_enc_move_rects move_rects;
unsigned num_ref_idx_l0_active_minus1;
unsigned num_ref_idx_l1_active_minus1;
unsigned ref_idx_l0_list[PIPE_H265_MAX_NUM_LIST_REF];
@ -2569,6 +2599,33 @@ union pipe_enc_cap_dirty_rect {
uint32_t value;
};
/* Used with PIPE_VIDEO_CAP_ENC_MOVE_RECTS */
union pipe_enc_cap_move_rect {
struct {
/*
* Driver Output. Indicates support for setting up to max_motion_hints in pipe_enc_move_rects.rects when max_motion_hints > 0.
*/
uint32_t max_motion_hints: 16;
/*
* Driver Output. Indicates support for sending overlapped rects in pipe_enc_move_rects.rects
*/
uint32_t supports_overlapped_rects: 1;
/*
* Driver Output. Indicates support for setting in pipe_enc_move_rects.precision = PIPE_ENC_MOVE_RECTS_PRECISION_UNIT_FULL_PIXEL
*/
uint32_t supports_precision_full_pixel: 1;
/*
* Driver Output. Indicates support for setting in pipe_enc_move_rects.precision = PIPE_ENC_MOVE_RECTS_PRECISION_UNIT_HALF_PIXEL
*/
uint32_t supports_precision_half_pixel: 1;
/*
* Driver Output. Indicates support for setting in pipe_enc_move_rects.precision = PIPE_ENC_MOVE_RECTS_PRECISION_UNIT_QUARTER_PIXEL
*/
uint32_t supports_precision_quarter_pixel: 1;
} bits;
uint32_t value;
};
#ifdef __cplusplus
}
#endif