aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec/vmixdec.c
diff options
context:
space:
mode:
authorPaul B Mahol <onemda@gmail.com>2023-09-17 12:51:16 +0200
committerPaul B Mahol <onemda@gmail.com>2023-09-17 12:55:56 +0200
commit5acc3c4cff88de1ced1c4d9c6070b708613b43c1 (patch)
treeef2f3cf9b234e64bd5a613a0218708605dadd35c /libavcodec/vmixdec.c
parent9e1ea3caba5effaf9c7596dc178bd457439d638f (diff)
downloadffmpeg-5acc3c4cff88de1ced1c4d9c6070b708613b43c1.tar.gz
avcodec/vmixdec: improve quality factors
Diffstat (limited to 'libavcodec/vmixdec.c')
-rw-r--r--libavcodec/vmixdec.c29
1 files changed, 12 insertions, 17 deletions
diff --git a/libavcodec/vmixdec.c b/libavcodec/vmixdec.c
index 61f97c1bb4..962ab8339b 100644
--- a/libavcodec/vmixdec.c
+++ b/libavcodec/vmixdec.c
@@ -55,22 +55,17 @@ typedef struct VMIXContext {
IDCTDSPContext idsp;
} VMIXContext;
-static const uint8_t quality[256] = {
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 64, 56, 52, 48, 44,
- 12, 36, 32, 28, 24, 22, 20, 18, 16, 14, 12, 10, 8, 7, 6, 5,
- 4, 3, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+static const uint8_t quality[] = {
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1,64,63,62,61,
+ 60,59,58,57,56,55,54,53,52,51,
+ 50,49,48,47,46,45,44,43,42,41,
+ 40,39,38,37,36,35,34,33,32,31,
+ 30,29,28,27,26,25,24,23,22,21,
+ 20,19,18,17,16,15,14,13,12,11,
+ 10, 9, 8, 7, 6, 5, 4, 3, 2, 1,
};
static const uint8_t quant[64] = {
@@ -240,7 +235,7 @@ static int decode_frame(AVCodecContext *avctx,
else if (offset != 3)
return AVERROR_INVALIDDATA;
- q = quality[avpkt->data[offset - 2]];
+ q = quality[FFMIN(avpkt->data[offset - 2], FF_ARRAY_ELEMS(quality)-1)];
for (int n = 0; n < 64; n++)
s->factors[n] = quant[n] * q;