mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-01-23 23:30:22 +01:00
frontends/va: pass in film_grain_target as new output
In av1 film grain case, to use the film_grain_target as the output, instead of target buffer, which is kept as the input for DPB processing in film_grain output scenario. CC: 22.3 Reviewed-by: Leo Liu <leo.liu@amd.com> Signed-off-by: Ruijing Dong <ruijing.dong@amd.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20139>
This commit is contained in:
parent
7e91f94864
commit
af695149e9
1 changed files with 38 additions and 3 deletions
|
|
@ -815,6 +815,25 @@ vlVaRenderPicture(VADriverContextP ctx, VAContextID context_id, VABufferID *buff
|
|||
return vaStatus;
|
||||
}
|
||||
|
||||
static bool vlVaQueryApplyFilmGrainAV1(vlVaContext *context,
|
||||
int *output_id,
|
||||
struct pipe_video_buffer ***out_target)
|
||||
{
|
||||
struct pipe_av1_picture_desc *av1 = NULL;
|
||||
|
||||
if (u_reduce_video_profile(context->templat.profile) != PIPE_VIDEO_FORMAT_AV1 ||
|
||||
context->decoder->entrypoint != PIPE_VIDEO_ENTRYPOINT_BITSTREAM)
|
||||
return false;
|
||||
|
||||
av1 = &context->desc.av1;
|
||||
if (!av1->picture_parameter.film_grain_info.film_grain_info_fields.apply_grain)
|
||||
return false;
|
||||
|
||||
*output_id = av1->picture_parameter.current_frame_id;
|
||||
*out_target = &av1->film_grain_target;
|
||||
return true;
|
||||
}
|
||||
|
||||
VAStatus
|
||||
vlVaEndPicture(VADriverContextP ctx, VAContextID context_id)
|
||||
{
|
||||
|
|
@ -826,7 +845,10 @@ vlVaEndPicture(VADriverContextP ctx, VAContextID context_id)
|
|||
struct pipe_screen *screen;
|
||||
bool supported;
|
||||
bool realloc = false;
|
||||
bool apply_av1_fg = false;
|
||||
enum pipe_format format;
|
||||
struct pipe_video_buffer **out_target;
|
||||
int output_id;
|
||||
|
||||
if (!ctx)
|
||||
return VA_STATUS_ERROR_INVALID_CONTEXT;
|
||||
|
|
@ -849,8 +871,20 @@ vlVaEndPicture(VADriverContextP ctx, VAContextID context_id)
|
|||
return VA_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
output_id = context->target_id;
|
||||
out_target = &context->target;
|
||||
apply_av1_fg = vlVaQueryApplyFilmGrainAV1(context, &output_id, &out_target);
|
||||
|
||||
mtx_lock(&drv->mutex);
|
||||
surf = handle_table_get(drv->htab, context->target_id);
|
||||
surf = handle_table_get(drv->htab, output_id);
|
||||
if (!surf || !surf->buffer)
|
||||
return VA_STATUS_ERROR_INVALID_SURFACE;
|
||||
|
||||
if (apply_av1_fg) {
|
||||
surf->ctx = context_id;
|
||||
*out_target = surf->buffer;
|
||||
}
|
||||
|
||||
context->mpeg4.frame_num++;
|
||||
|
||||
screen = context->decoder->context->screen;
|
||||
|
|
@ -924,7 +958,8 @@ vlVaEndPicture(VADriverContextP ctx, VAContextID context_id)
|
|||
}
|
||||
|
||||
if (u_reduce_video_profile(context->templat.profile) == PIPE_VIDEO_FORMAT_AV1 &&
|
||||
surf->buffer->buffer_format == PIPE_FORMAT_NV12) {
|
||||
surf->buffer->buffer_format == PIPE_FORMAT_NV12 &&
|
||||
context->decoder->entrypoint == PIPE_VIDEO_ENTRYPOINT_BITSTREAM) {
|
||||
if (context->desc.av1.picture_parameter.bit_depth_idx == 1) {
|
||||
surf->templat.buffer_format = PIPE_FORMAT_P010;
|
||||
realloc = true;
|
||||
|
|
@ -958,7 +993,7 @@ vlVaEndPicture(VADriverContextP ctx, VAContextID context_id)
|
|||
}
|
||||
|
||||
old_buf->destroy(old_buf);
|
||||
context->target = surf->buffer;
|
||||
*out_target = surf->buffer;
|
||||
}
|
||||
|
||||
if (context->decoder->entrypoint == PIPE_VIDEO_ENTRYPOINT_ENCODE) {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue