aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec/mpeg12enc.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2015-07-30 04:42:16 +0200
committerMichael Niedermayer <michael@niedermayer.cc>2015-07-30 05:00:54 +0200
commitbf2474c74f2c0b956c069f50483c7d104d856d8b (patch)
tree0e5f7d92192a97779396c430b78c847be1069850 /libavcodec/mpeg12enc.c
parent9723d439fdebe7c9fd3819785173fc28509c434b (diff)
downloadffmpeg-bf2474c74f2c0b956c069f50483c7d104d856d8b.tar.gz
avcodec/mpeg12enc: extend QP range to 28 for non linear quantizers
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Diffstat (limited to 'libavcodec/mpeg12enc.c')
-rw-r--r--libavcodec/mpeg12enc.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/libavcodec/mpeg12enc.c b/libavcodec/mpeg12enc.c
index 8bf8e516e2..6f87117058 100644
--- a/libavcodec/mpeg12enc.c
+++ b/libavcodec/mpeg12enc.c
@@ -42,9 +42,10 @@
#include "mpegutils.h"
#include "mpegvideo.h"
-
-static const uint8_t inv_non_linear_qscale[] = {
+static const int8_t inv_non_linear_qscale[] = {
0, 2, 4, 6, 8, 9, 10, 11, 12, 13, 14, 15, 16,
+ -1,17,-1,18,-1,19, -1, 20, -1, 21, -1, 22, -1,
+ 23,-1,24,-1,-1,-1
};
static const uint8_t svcd_scan_offset_placeholder[] = {
@@ -402,8 +403,9 @@ static inline void encode_mb_skip_run(MpegEncContext *s, int run)
static av_always_inline void put_qscale(MpegEncContext *s)
{
if (s->q_scale_type) {
- av_assert2(s->qscale >= 1 && s->qscale <= 12);
- put_bits(&s->pb, 5, inv_non_linear_qscale[s->qscale]);
+ int qp = inv_non_linear_qscale[s->qscale];
+ av_assert2(s->qscale >= 1 && qp > 0);
+ put_bits(&s->pb, 5, qp);
} else {
put_bits(&s->pb, 5, s->qscale);
}