[Libva] [PATCH 3/3] jpeg_enc: Fix the column raster conversion of quatization matrix.
Xiang, Haihao
haihao.xiang at intel.com
Sun Mar 8 19:25:16 PDT 2015
Applied.
Thanks
Haihao
> +1 LGTM
>
> -Sirisha
>
> -----Original Message-----
> From: Libva [mailto:libva-bounces at lists.freedesktop.org] On Behalf Of sreerenj.balachandran at intel.com
> Sent: Thursday, March 05, 2015 3:04 AM
> To: libva at lists.freedesktop.org
> Subject: [Libva] [PATCH 3/3] jpeg_enc: Fix the column raster conversion of quatization matrix.
>
> From: Sreerenj Balachandran <sreerenj.balachandran at intel.com>
>
> Use temp array for the new raster order calculation, otherwise it simply generate wrong values.
>
> Note: There is opportunity for more optimization, for eg we can avoid the usage of mulitple for loops here and there.
> ---
> src/gen8_mfc.c | 10 +++++-----
> 1 file changed, 5 insertions(+), 5 deletions(-)
>
> diff --git a/src/gen8_mfc.c b/src/gen8_mfc.c index fbd3a80..267536e 100644
> --- a/src/gen8_mfc.c
> +++ b/src/gen8_mfc.c
> @@ -2678,7 +2678,7 @@ gen8_mfc_jpeg_fqm_state(VADriverContextP ctx,
> uint32_t temp, i = 0, j = 0, dword_qm[32];
> VAEncPictureParameterBufferJPEG *pic_param;
> VAQMatrixBufferJPEG *qmatrix;
> - unsigned char raster_qm[64];
> + unsigned char raster_qm[64], column_raster_qm[64];
> struct gen6_mfc_context *mfc_context = encoder_context->mfc_context;
>
> assert(encode_state->pic_param_ext && encode_state->pic_param_ext->buffer);
> @@ -2738,11 +2738,11 @@ gen8_mfc_jpeg_fqm_state(VADriverContextP ctx,
> //Need to double check if our HW expects col or row raster.
> for (j = 0; j < 64; j++) {
> int row = j / 8, col = j % 8;
> - raster_qm[col * 8 + row] = raster_qm[j];
> + column_raster_qm[col * 8 + row] = raster_qm[j];
> }
>
> //Convert to raster QM to reciprocal. HW expects values in reciprocal.
> - get_reciprocal_dword_qm(raster_qm, dword_qm);
> + get_reciprocal_dword_qm(column_raster_qm, dword_qm);
>
> //send the luma qm to the command buffer
> gen8_mfc_fqm_state(ctx, MFX_QM_JPEG_LUMA_Y_QUANTIZER_MATRIX, dword_qm, 32, encoder_context); @@ -2769,12 +2769,12 @@ gen8_mfc_jpeg_fqm_state(VADriverContextP ctx,
> //Need to double check if our HW expects col or row raster.
> for (j = 0; j < 64; j++) {
> int row = j / 8, col = j % 8;
> - raster_qm[col * 8 + row] = raster_qm[j];
> + column_raster_qm[col * 8 + row] = raster_qm[j];
> }
>
>
> //Convert to raster QM to reciprocal. HW expects values in reciprocal.
> - get_reciprocal_dword_qm(raster_qm, dword_qm);
> + get_reciprocal_dword_qm(column_raster_qm, dword_qm);
>
> //send the same chroma qm to the command buffer (for both U,V or G,B)
> gen8_mfc_fqm_state(ctx, MFX_QM_JPEG_CHROMA_CB_QUANTIZER_MATRIX, dword_qm, 32, encoder_context);
> --
> 1.9.1
>
> _______________________________________________
> Libva mailing list
> Libva at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/libva
> _______________________________________________
> Libva mailing list
> Libva at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/libva
More information about the Libva
mailing list