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

Muppavarapu, Sirisha sirisha.muppavarapu at intel.com
Thu Mar 5 11:45:02 PST 2015


+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 2/3] jpeg_enc: Fix the quatisation matrix scaling.

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 698dcae..fbd3a80 100644
--- a/src/gen8_mfc.c
+++ b/src/gen8_mfc.c
@@ -2721,7 +2721,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; @@ -2752,7 +2752,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

_______________________________________________
Libva mailing list
Libva at lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libva


More information about the Libva mailing list