aboutsummaryrefslogtreecommitdiff
path: root/libavcodec/mpegvideo.c
diff options
context:
space:
mode:
Diffstat (limited to 'libavcodec/mpegvideo.c')
-rw-r--r--libavcodec/mpegvideo.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/libavcodec/mpegvideo.c b/libavcodec/mpegvideo.c
index 68ee6125d1..01369da8fc 100644
--- a/libavcodec/mpegvideo.c
+++ b/libavcodec/mpegvideo.c
@@ -2352,3 +2352,19 @@ static void dct_unquantize_h263_inter_c(MpegEncContext *s,
}
}
+/**
+ * set qscale and update qscale dependent variables.
+ */
+void ff_set_qscale(MpegEncContext * s, int qscale)
+{
+ if (qscale < 1)
+ qscale = 1;
+ else if (qscale > 31)
+ qscale = 31;
+
+ s->qscale = qscale;
+ s->chroma_qscale= s->chroma_qscale_table[qscale];
+
+ s->y_dc_scale= s->y_dc_scale_table[ qscale ];
+ s->c_dc_scale= s->c_dc_scale_table[ s->chroma_qscale ];
+}