pipe: Add video encode PSNR output stats

Reviewed-by: Ruijing Dong <ruijing.dong@amd.com>
Reviewed-by: Pohsiang (John) Hsu <pohhsu@microsoft.com>
Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35263>
This commit is contained in:
Sil Vilerino 2025-05-27 17:21:39 -04:00 committed by Marge Bot
parent 228a0a46a5
commit 1b801a95ae
2 changed files with 34 additions and 0 deletions

View file

@ -243,6 +243,18 @@ enum pipe_video_cap
* Support for two pass encode in encoder picture params pipe_enc_cap_two_pass
*/
PIPE_VIDEO_CAP_ENC_TWO_PASS = 66,
/*
* Support for the frame's PSNR to be written into a PIPE_BUFFER
* during the encoding of a frame
*
* Note that this may be written during the encode operation, before the
* get_feedback operation, since it's written into a GPU memory allocation
*
* The returned value is pipe_enc_cap_gpu_stats_psnr, which indicates
* more information about the number of PSNR components returned and their
* data layout
*/
PIPE_VIDEO_CAP_ENC_GPU_STATS_PSNR = 67,
};
enum pipe_video_h264_enc_dbk_filter_mode_flags

View file

@ -959,6 +959,8 @@ struct pipe_h264_enc_picture_desc
struct pipe_resource *gpu_stats_satd_map;
/* See PIPE_VIDEO_CAP_ENC_GPU_STATS_RATE_CONTROL_BITS_MAP */
struct pipe_resource *gpu_stats_rc_bitallocation_map;
/* See PIPE_VIDEO_CAP_ENC_GPU_STATS_PSNR */
struct pipe_resource *gpu_stats_psnr;
/* See PIPE_VIDEO_CAP_ENC_QP_MAPS */
struct pipe_resource *input_gpu_qpmap;
@ -1357,6 +1359,8 @@ struct pipe_h265_enc_picture_desc
struct pipe_resource *gpu_stats_satd_map;
/* See PIPE_VIDEO_CAP_ENC_GPU_STATS_RATE_CONTROL_BITS_MAP */
struct pipe_resource *gpu_stats_rc_bitallocation_map;
/* See PIPE_VIDEO_CAP_ENC_GPU_STATS_PSNR */
struct pipe_resource *gpu_stats_psnr;
/* See PIPE_VIDEO_CAP_ENC_QP_MAPS */
struct pipe_resource *input_gpu_qpmap;
@ -2792,6 +2796,24 @@ union pipe_enc_cap_gpu_stats_map {
uint32_t value;
};
/* Used with PIPE_VIDEO_CAP_ENC_GPU_STATS_PSNR */
union pipe_enc_cap_gpu_stats_psnr {
struct {
/*
* Driver Output. Indicates support for writing the frame's PSNR into a
* PIPE_BUFFER during encode frame execution as 32 bit float components
*
* The components are always written in Y, U, V order as packed
* 32 bit floats in the gpu_stats_psnr buffer sent down to the driver
* in the picture parameters. The unsupported channels are written as zero.
*/
uint32_t supports_y_channel: 1;
uint32_t supports_u_channel: 1;
uint32_t supports_v_channel: 1;
} bits;
uint32_t value;
};
/* Used with PIPE_VIDEO_CAP_ENC_SLICED_NOTIFICATIONS */
union pipe_enc_cap_sliced_notifications {
struct {