[Libva] [PATCH 3/3] jpeg_enc: Fix the column raster conversion of quatization matrix.

sreerenj.balachandran at intel.com sreerenj.balachandran at intel.com
Wed Mar 4 10:09:57 PST 2015


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 14a9692..236e1f8 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);
@@ -2739,11 +2739,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);
@@ -2770,12 +2770,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



More information about the Libva mailing list