diff options
author | Mark Thompson <sw@jkqxz.net> | 2018-04-25 23:44:33 +0100 |
---|---|---|
committer | Xiang, Haihao <haihao.xiang@intel.com> | 2018-04-28 16:15:40 +0800 |
commit | 40b15a5c6c0103c23a5db810aef27cf75d0b6723 (patch) | |
tree | d0481f8945d6ce2a43968ed7a196286cdfc2132b | |
parent | fab8943a42d31293191a8365f8813365c2afc0ab (diff) | |
download | libva-intel-driver-40b15a5c6c0103c23a5db810aef27cf75d0b6723.tar.gz |
Use f_code to determine max MV length
The motion vector length is constrained by the level but not set by it -
we should instead use the f_code values to set the max MV length.
This fixes encoding when the f_code values are not set to the highest
allowed for the level, and also adds support for intermediate levels such
as High 1440 which were not previously handled here.
Signed-off-by: Mark Thompson <sw@jkqxz.net>
-rw-r--r-- | src/gen6_mfc_common.c | 18 |
1 files changed, 3 insertions, 15 deletions
diff --git a/src/gen6_mfc_common.c b/src/gen6_mfc_common.c index 54f3cd60..19f97937 100644 --- a/src/gen6_mfc_common.c +++ b/src/gen6_mfc_common.c @@ -1384,23 +1384,11 @@ void intel_vme_mpeg2_state_setup(VADriverContextP ctx, VAEncSliceParameterBufferMPEG2 *slice_param = NULL; VAEncPictureParameterBufferMPEG2 *pic_param = NULL; slice_param = (VAEncSliceParameterBufferMPEG2 *)encode_state->slice_params_ext[0]->buffer; + pic_param = (VAEncPictureParameterBufferMPEG2 *)encode_state->pic_param_ext->buffer; - if (vme_context->mpeg2_level == MPEG2_LEVEL_LOW) { - mv_x = 512; - mv_y = 64; - } else if (vme_context->mpeg2_level == MPEG2_LEVEL_MAIN) { - mv_x = 1024; - mv_y = 128; - } else if (vme_context->mpeg2_level == MPEG2_LEVEL_HIGH) { - mv_x = 2048; - mv_y = 128; - } else { - WARN_ONCE("Incorrect Mpeg2 level setting!\n"); - mv_x = 512; - mv_y = 64; - } + mv_x = 1 << (2 + pic_param->f_code[0][0]); + mv_y = 1 << (2 + pic_param->f_code[0][1]); - pic_param = (VAEncPictureParameterBufferMPEG2 *)encode_state->pic_param_ext->buffer; if (pic_param->picture_type != VAEncPictureTypeIntra) { int qp, m_cost, j, mv_count; float lambda, m_costf; |