[Libva] [PATCH 2/3] jpeg_enc: Fix the quatisation matrix scaling.

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


From: Sreerenj Balachandran <sreerenj.balachandran at intel.com>

The misplaced parentheses are causing wrong value assignment
to the quatization matrix.

This will allow the ecoding when quality > 50.
Otherwise it will simply generate garbage in encoded video
for any quality factor greater than 50
---
 src/gen8_mfc.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/gen8_mfc.c b/src/gen8_mfc.c
index 7754b70..14a9692 100644
--- a/src/gen8_mfc.c
+++ b/src/gen8_mfc.c
@@ -2722,7 +2722,7 @@ gen8_mfc_jpeg_fqm_state(VADriverContextP ctx,
     if(qmatrix->load_lum_quantiser_matrix) {
         //apply quality to lum_quantiser_matrix
         for(i=0; i < 64; i++) {
-            temp = qmatrix->lum_quantiser_matrix[i] * (quality/100);
+            temp = (qmatrix->lum_quantiser_matrix[i] * quality)/100;
             //clamp to range [1,255]
             temp = (temp > 255) ? 255 : temp;
             temp = (temp < 1) ? 1 : temp;
@@ -2753,7 +2753,7 @@ gen8_mfc_jpeg_fqm_state(VADriverContextP ctx,
     if(qmatrix->load_chroma_quantiser_matrix) {
         //apply quality to chroma_quantiser_matrix
         for(i=0; i < 64; i++) {
-            temp = qmatrix->chroma_quantiser_matrix[i] * (quality/100);
+            temp = (qmatrix->chroma_quantiser_matrix[i] * quality)/100;
             //clamp to range [1,255]
             temp = (temp > 255) ? 255 : temp;
             temp = (temp < 1) ? 1 : temp;
-- 
1.9.1



More information about the Libva mailing list