[FFmpeg-cvslog] avcodec/vmixdec: improve quality factors
Paul B Mahol
git at videolan.org
Sun Sep 17 13:49:19 EEST 2023
ffmpeg | branch: master | Paul B Mahol <onemda at gmail.com> | Sun Sep 17 12:51:16 2023 +0200| [5acc3c4cff88de1ced1c4d9c6070b708613b43c1] | committer: Paul B Mahol
avcodec/vmixdec: improve quality factors
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=5acc3c4cff88de1ced1c4d9c6070b708613b43c1
---
libavcodec/vmixdec.c | 29 ++++++++++++-----------------
1 file 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;
More information about the ffmpeg-cvslog
mailing list