[FFmpeg-cvslog] avcodec/g2meet: Pre-permute quantization tables

Andreas Rheinhardt git at videolan.org
Mon Oct 24 02:41:28 EEST 2022


ffmpeg | branch: master | Andreas Rheinhardt <andreas.rheinhardt at outlook.com> | Thu Oct 20 10:07:46 2022 +0200| [9f64b067580105afa82dc04fa3b985c20ef17971] | committer: Andreas Rheinhardt

avcodec/g2meet: Pre-permute quantization tables

Allows to avoid a permutation lateron.

Reviewed-by: Peter Ross <pross at xvid.org>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at outlook.com>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=9f64b067580105afa82dc04fa3b985c20ef17971
---

 libavcodec/g2meet.c | 27 ++++++++++++++-------------
 1 file changed, 14 insertions(+), 13 deletions(-)

diff --git a/libavcodec/g2meet.c b/libavcodec/g2meet.c
index 1973ed0741..761fd22fc3 100644
--- a/libavcodec/g2meet.c
+++ b/libavcodec/g2meet.c
@@ -59,22 +59,23 @@ enum Compression {
     COMPR_KEMPF_J_B,
 };
 
+/* These tables are already permuted according to ff_zigzag_direct */
 static const uint8_t luma_quant[64] = {
-     8,  6,  5,  8, 12, 20, 26, 31,
-     6,  6,  7, 10, 13, 29, 30, 28,
-     7,  7,  8, 12, 20, 29, 35, 28,
-     7,  9, 11, 15, 26, 44, 40, 31,
-     9, 11, 19, 28, 34, 55, 52, 39,
-    12, 18, 28, 32, 41, 52, 57, 46,
-    25, 32, 39, 44, 52, 61, 60, 51,
-    36, 46, 48, 49, 56, 50, 52, 50
+     8,  6,  6,  7,  6,  5,  8,  7,
+     7,  7,  9,  9,  8, 10, 12, 20,
+    13, 12, 11, 11, 12, 25, 18, 19,
+    15, 20, 29, 26, 31, 30, 29, 26,
+    28, 28, 32, 36, 46, 39, 32, 34,
+    44, 35, 28, 28, 40, 55, 41, 44,
+    48, 49, 52, 52, 52, 31, 39, 57,
+    61, 56, 50, 60, 46, 51, 52, 50,
 };
 
 static const uint8_t chroma_quant[64] = {
-     9,  9, 12, 24, 50, 50, 50, 50,
-     9, 11, 13, 33, 50, 50, 50, 50,
-    12, 13, 28, 50, 50, 50, 50, 50,
-    24, 33, 50, 50, 50, 50, 50, 50,
+     9,  9,  9, 12, 11, 12, 24, 13,
+    13, 24, 50, 33, 28, 33, 50, 50,
+    50, 50, 50, 50, 50, 50, 50, 50,
+    50, 50, 50, 50, 50, 50, 50, 50,
     50, 50, 50, 50, 50, 50, 50, 50,
     50, 50, 50, 50, 50, 50, 50, 50,
     50, 50, 50, 50, 50, 50, 50, 50,
@@ -250,7 +251,7 @@ static int jpg_decode_block(JPGContext *c, GetBitContext *gb,
             int nbits = val;
 
             val                                 = get_xbits(gb, nbits);
-            val                                *= qmat[ff_zigzag_direct[pos]];
+            val                                *= qmat[pos];
             block[c->permutated_scantable[pos]] = val;
         }
     }



More information about the ffmpeg-cvslog mailing list