[FFmpeg-devel] [PATCH v2 13/24] avcodec/g2meet: Pre-permute quantization tables
Andreas Rheinhardt
andreas.rheinhardt at outlook.com
Fri Oct 21 23:12:49 EEST 2022
Allows to avoid a permutation lateron.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at outlook.com>
---
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;
}
}
--
2.34.1
More information about the ffmpeg-devel
mailing list