[Libva] [PATCH] MPEG2ENC: Initialize the f_code based on supported level instead of hacked setting
ykzhao
yakui.zhao at intel.com
Sun Jul 7 18:16:13 PDT 2013
On Fri, 2013-07-05 at 03:22 -0600, Gwenole Beauchesne wrote:
> LGTM.
hi, Gwenole
Thanks for your review.
Appreciate your ACK.
Thanks.
Yakui
> 2013/7/5 <yakui.zhao at intel.com>:
> > From: Zhao Yakui <yakui.zhao at intel.com>
> >
> > The f_code of MPEG2 picture parameter indicates the max search range of the
> > motion vector prediction. The small value will cause the unoptimized motion
> > vector prediction. So remove the hack setting.
> >
> > Signed-off-by: Zhao Yakui <yakui.zhao at intel.com>
> > ---
> > test/encode/mpeg2enc.c | 28 ++++++++++++++++++++++------
> > 1 file changed, 22 insertions(+), 6 deletions(-)
> >
> > diff --git a/test/encode/mpeg2enc.c b/test/encode/mpeg2enc.c
> > index 4e1776d..f49af27 100644
> > --- a/test/encode/mpeg2enc.c
> > +++ b/test/encode/mpeg2enc.c
> > @@ -1012,6 +1012,7 @@ mpeg2enc_update_picture_parameter(struct mpeg2enc_context *ctx,
> > int display_order)
> > {
> > VAEncPictureParameterBufferMPEG2 *pic_param = &ctx->pic_param;
> > + uint8_t f_code_x, f_code_y;
> >
> > pic_param->picture_type = picture_type;
> > pic_param->temporal_reference = (display_order - ctx->gop_header_in_display_order) & 0x3FF;
> > @@ -1019,6 +1020,21 @@ mpeg2enc_update_picture_parameter(struct mpeg2enc_context *ctx,
> > pic_param->forward_reference_picture = surface_ids[SID_REFERENCE_PICTURE_L0];
> > pic_param->backward_reference_picture = surface_ids[SID_REFERENCE_PICTURE_L1];
> >
> > + f_code_x = 0xf;
> > + f_code_y = 0xf;
> > + if (pic_param->picture_type != VAEncPictureTypeIntra) {
> > + if (ctx->level == MPEG2_LEVEL_LOW) {
> > + f_code_x = 7;
> > + f_code_y = 4;
> > + } else if (ctx->level == MPEG2_LEVEL_MAIN) {
> > + f_code_x = 8;
> > + f_code_y = 5;
> > + } else {
> > + f_code_x = 9;
> > + f_code_y = 5;
> > + }
> > + }
> > +
> > if (pic_param->picture_type == VAEncPictureTypeIntra) {
> > pic_param->f_code[0][0] = 0xf;
> > pic_param->f_code[0][1] = 0xf;
> > @@ -1028,17 +1044,17 @@ mpeg2enc_update_picture_parameter(struct mpeg2enc_context *ctx,
> > pic_param->backward_reference_picture = VA_INVALID_SURFACE;
> >
> > } else if (pic_param->picture_type == VAEncPictureTypePredictive) {
> > - pic_param->f_code[0][0] = 0x1;
> > - pic_param->f_code[0][1] = 0x1;
> > + pic_param->f_code[0][0] = f_code_x;
> > + pic_param->f_code[0][1] = f_code_y;
> > pic_param->f_code[1][0] = 0xf;
> > pic_param->f_code[1][1] = 0xf;
> > pic_param->forward_reference_picture = surface_ids[SID_REFERENCE_PICTURE_L0];
> > pic_param->backward_reference_picture = VA_INVALID_SURFACE;
> > } else if (pic_param->picture_type == VAEncPictureTypeBidirectional) {
> > - pic_param->f_code[0][0] = 0x1;
> > - pic_param->f_code[0][1] = 0x1;
> > - pic_param->f_code[1][0] = 0x1;
> > - pic_param->f_code[1][1] = 0x1;
> > + pic_param->f_code[0][0] = f_code_x;
> > + pic_param->f_code[0][1] = f_code_y;
> > + pic_param->f_code[1][0] = f_code_x;
> > + pic_param->f_code[1][1] = f_code_y;
> > pic_param->forward_reference_picture = surface_ids[SID_REFERENCE_PICTURE_L0];
> > pic_param->backward_reference_picture = surface_ids[SID_REFERENCE_PICTURE_L1];
> > } else {
> > --
> > 1.8.2-rc2
> >
> > _______________________________________________
> > Libva mailing list
> > Libva at lists.freedesktop.org
> > http://lists.freedesktop.org/mailman/listinfo/libva
More information about the Libva
mailing list