diff options
author | Zhao Yakui <yakui.zhao@intel.com> | 2013-07-05 10:46:25 +0800 |
---|---|---|
committer | Xiang, Haihao <haihao.xiang@intel.com> | 2013-09-13 11:31:39 +0800 |
commit | 73a11b3e249da35ede92560eb089239252721351 (patch) | |
tree | e9501347651c56f7a52c263968394c25d2b96983 | |
parent | 3003999c6e5717ff94be3e2a5ec7dff08c8cad5c (diff) |
MPEG2ENC: Initialize the f_code based on supported level instead of hacked setting
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@intel.com>
(cherry picked from commit 4fa9b3ba9d45a021e282f761d061e1151158c3ea)
-rw-r--r-- | test/encode/mpeg2vaenc.c | 28 |
1 files changed, 22 insertions, 6 deletions
diff --git a/test/encode/mpeg2vaenc.c b/test/encode/mpeg2vaenc.c index 0721b08..dc1c7f0 100644 --- a/test/encode/mpeg2vaenc.c +++ b/test/encode/mpeg2vaenc.c @@ -1013,6 +1013,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; @@ -1020,6 +1021,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; @@ -1029,17 +1045,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 { |