summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorZhao Yakui <yakui.zhao@intel.com>2013-08-12 15:13:24 +0800
committerXiang, Haihao <haihao.xiang@intel.com>2013-09-06 15:33:35 +0800
commit5ae18f29106ffde1004b721013ebb81f7a273690 (patch)
treee4df0dbfa794df074b9800f08871cb4aca43097e /src
parent7264aeb6c682b0bc352303befdcec536cca02fec (diff)
downloadlibva-intel-driver-5ae18f29106ffde1004b721013ebb81f7a273690.tar.gz
libva-intel-driver-5ae18f29106ffde1004b721013ebb81f7a273690.tar.bz2
libva-intel-driver-5ae18f29106ffde1004b721013ebb81f7a273690.zip
Optimize quantization rounding precision for MPEG2 encoding on haswell
Signed-off-by: Zhao Yakui <yakui.zhao@intel.com> (cherry picked from commit 24d8bf31c8aeb326bc8b33c1ac9700ec1d169666)
Diffstat (limited to 'src')
-rw-r--r--src/gen75_mfc.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/gen75_mfc.c b/src/gen75_mfc.c
index e4cdca5..b3b6f88 100644
--- a/src/gen75_mfc.c
+++ b/src/gen75_mfc.c
@@ -1780,9 +1780,11 @@ gen75_mfc_mpeg2_pic_state(VADriverContextP ctx,
VAEncPictureParameterBufferMPEG2 *pic_param;
int width_in_mbs = (mfc_context->surface_state.width + 15) / 16;
int height_in_mbs = (mfc_context->surface_state.height + 15) / 16;
+ VAEncSliceParameterBufferMPEG2 *slice_param = NULL;
assert(encode_state->pic_param_ext && encode_state->pic_param_ext->buffer);
pic_param = (VAEncPictureParameterBufferMPEG2 *)encode_state->pic_param_ext->buffer;
+ slice_param = (VAEncSliceParameterBufferMPEG2 *)encode_state->slice_params_ext[0]->buffer;
BEGIN_BCS_BATCH(batch, 13);
OUT_BCS_BATCH(batch, MFX_MPEG2_PIC_STATE | (13 - 2));
@@ -1807,7 +1809,11 @@ gen75_mfc_mpeg2_pic_state(VADriverContextP ctx,
1 << 31 | /* slice concealment */
(height_in_mbs - 1) << 16 |
(width_in_mbs - 1));
- OUT_BCS_BATCH(batch, 0);
+ if (slice_param && slice_param->quantiser_scale_code >= 14)
+ OUT_BCS_BATCH(batch, (3 << 1) | (1 << 4) | (5 << 8) | (1 << 12));
+ else
+ OUT_BCS_BATCH(batch, 0);
+
OUT_BCS_BATCH(batch, 0);
OUT_BCS_BATCH(batch,
0xFFF << 16 | /* InterMBMaxSize */