frontends/va: Handle dynamic resolution/SVC for VP9

VP9 allows frame to use another resolution frame as reference
frames so updating the resolution for decoder when there is a
resolution change.

Signed-off-by: Satyajit Sahu <satyajit.sahu@amd.com>
Reviewed-by: Leo Liu <leo.liu@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5646>
This commit is contained in:
Satyajit Sahu 2020-06-24 16:01:01 +05:30 committed by Marge Bot
parent 653dff949e
commit c425ca5566
2 changed files with 16 additions and 6 deletions

View File

@ -109,8 +109,10 @@ static VAStatus
handlePictureParameterBuffer(vlVaDriver *drv, vlVaContext *context, vlVaBuffer *buf)
{
VAStatus vaStatus = VA_STATUS_SUCCESS;
enum pipe_video_format format =
u_reduce_video_profile(context->templat.profile);
switch (u_reduce_video_profile(context->templat.profile)) {
switch (format) {
case PIPE_VIDEO_FORMAT_MPEG12:
vlVaHandlePictureParameterBufferMPEG12(drv, context, buf);
break;
@ -145,9 +147,6 @@ handlePictureParameterBuffer(vlVaDriver *drv, vlVaContext *context, vlVaBuffer *
/* Create the decoder once max_references is known. */
if (!context->decoder) {
enum pipe_video_format format =
u_reduce_video_profile(context->templat.profile);
if (!context->target)
return VA_STATUS_ERROR_INVALID_CONTEXT;
@ -168,6 +167,13 @@ handlePictureParameterBuffer(vlVaDriver *drv, vlVaContext *context, vlVaBuffer *
context->needs_begin_frame = true;
}
if (format == PIPE_VIDEO_FORMAT_VP9) {
context->decoder->width =
context->desc.vp9.picture_parameter.frame_width;
context->decoder->height =
context->desc.vp9.picture_parameter.frame_height;
}
return vaStatus;
}

View File

@ -81,8 +81,12 @@ void vlVaHandlePictureParameterBufferVP9(vlVaDriver *drv, vlVaContext *context,
context->desc.vp9.picture_parameter.bit_depth = vp9->bit_depth;
for (i = 0 ; i < NUM_VP9_REFS ; i++)
vlVaGetReferenceFrame(drv, vp9->reference_frames[i], &context->desc.vp9.ref[i]);
for (i = 0 ; i < NUM_VP9_REFS ; i++) {
if (vp9->pic_fields.bits.frame_type == 0)
context->desc.vp9.ref[i] = NULL;
else
vlVaGetReferenceFrame(drv, vp9->reference_frames[i], &context->desc.vp9.ref[i]);
}
if (!context->decoder && !context->templat.max_references)
context->templat.max_references = NUM_VP9_REFS;