diff mbox series

[FFmpeg-devel,v2,13/24] avcodec/g2meet: Pre-permute quantization tables

Message ID AS8P250MB074466E3EA1E5A13C6EE764F8F2D9@AS8P250MB0744.EURP250.PROD.OUTLOOK.COM
State Accepted
Commit 9f64b067580105afa82dc04fa3b985c20ef17971
Headers show
Series [FFmpeg-devel,v2,01/24] configure: Add idctdsp dependency to codecs that need it | expand

Checks

Context Check Description
yinshiyou/make_loongarch64 success Make finished
yinshiyou/make_fate_loongarch64 success Make fate finished
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished

Commit Message

Andreas Rheinhardt Oct. 21, 2022, 8:12 p.m. UTC
Allows to avoid a permutation lateron.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
 libavcodec/g2meet.c | 27 ++++++++++++++-------------
 1 file changed, 14 insertions(+), 13 deletions(-)
diff mbox series

Patch

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;
         }
     }