frontends/va: change getEncParamPreset location

why:
getEncParamPreset functions overwrite the incoming
messages.

how:
To change a location after the decoder is created,
so that if no incoming message the default ones
will be used otherwise the new messages will
overwrite the default values.

Signed-off-by: Ruijing Dong <ruijing.dong@amd.com>
Reviewed-by: Sil Vilerino <sivileri@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18534>
This commit is contained in:
Ruijing Dong 2022-09-10 16:28:19 -04:00 committed by Marge Bot
parent 72fffa62d5
commit 6646ae2576
4 changed files with 17 additions and 4 deletions

View file

@ -859,12 +859,21 @@ vlVaEndPicture(VADriverContextP ctx, VAContextID context_id)
}
if (context->decoder->entrypoint == PIPE_VIDEO_ENTRYPOINT_ENCODE) {
struct pipe_screen *screen = context->decoder->context->screen;
coded_buf = context->coded_buf;
if (u_reduce_video_profile(context->templat.profile) == PIPE_VIDEO_FORMAT_MPEG4_AVC) {
getEncParamPresetH264(context);
if (u_reduce_video_profile(context->templat.profile) == PIPE_VIDEO_FORMAT_MPEG4_AVC)
context->desc.h264enc.frame_num_cnt++;
} else if (u_reduce_video_profile(context->templat.profile) == PIPE_VIDEO_FORMAT_HEVC)
getEncParamPresetH265(context);
/* keep other path the same way */
if (!screen->get_video_param(screen, PIPE_VIDEO_PROFILE_UNKNOWN,
context->decoder->entrypoint,
PIPE_VIDEO_CAP_ENC_QUALITY_LEVEL)) {
if (u_reduce_video_profile(context->templat.profile) == PIPE_VIDEO_FORMAT_MPEG4_AVC)
getEncParamPresetH264(context);
else if (u_reduce_video_profile(context->templat.profile) == PIPE_VIDEO_FORMAT_HEVC)
getEncParamPresetH265(context);
}
context->desc.base.input_format = surf->buffer->buffer_format;
context->desc.base.output_format = surf->encoder_format;

View file

@ -157,6 +157,8 @@ vlVaHandleVAEncSequenceParameterBufferTypeH264(vlVaDriver *drv, vlVaContext *con
context->decoder = drv->pipe->create_video_codec(drv->pipe, &context->templat);
if (!context->decoder)
return VA_STATUS_ERROR_ALLOCATION_FAILED;
getEncParamPresetH264(context);
}
context->gop_coeff = ((1024 + h264->intra_idr_period - 1) / h264->intra_idr_period + 1) / 2 * 2;

View file

@ -134,6 +134,8 @@ vlVaHandleVAEncSequenceParameterBufferTypeHEVC(vlVaDriver *drv, vlVaContext *con
if (!context->decoder)
return VA_STATUS_ERROR_ALLOCATION_FAILED;
getEncParamPresetH265(context);
}
context->desc.h265enc.seq.general_profile_idc = h265->general_profile_idc;

0
src/gallium/include/pipe/p_video_state.h Executable file → Normal file
View file