diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2009-12-03 21:36:58 +0000 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2009-12-03 21:36:58 +0000 |
commit | 9015b095bc2407ebb009c1af0a1d1692ce72c46d (patch) | |
tree | 260ae5536e814d1ca978921dbc32c8198c9dddef /libavcodec/mpegvideo_enc.c | |
parent | bdcc13f2bf251f60bf5af33d5f88f78b63b1c81b (diff) | |
download | ffmpeg-9015b095bc2407ebb009c1af0a1d1692ce72c46d.tar.gz |
Move ff_init_qscale_tab() from h263.c to mpegvideo, the function is not h263 specific.
Originally committed as revision 20725 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec/mpegvideo_enc.c')
-rw-r--r-- | libavcodec/mpegvideo_enc.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/libavcodec/mpegvideo_enc.c b/libavcodec/mpegvideo_enc.c index 47db1edd91..9b4dad49ef 100644 --- a/libavcodec/mpegvideo_enc.c +++ b/libavcodec/mpegvideo_enc.c @@ -146,6 +146,20 @@ void ff_write_quant_matrix(PutBitContext *pb, uint16_t *matrix){ put_bits(pb, 1, 0); } +/** + * init s->current_picture.qscale_table from s->lambda_table + */ +void ff_init_qscale_tab(MpegEncContext *s){ + int8_t * const qscale_table= s->current_picture.qscale_table; + int i; + + for(i=0; i<s->mb_num; i++){ + unsigned int lam= s->lambda_table[ s->mb_index2xy[i] ]; + int qp= (lam*139 + FF_LAMBDA_SCALE*64) >> (FF_LAMBDA_SHIFT + 7); + qscale_table[ s->mb_index2xy[i] ]= av_clip(qp, s->avctx->qmin, s->avctx->qmax); + } +} + static void copy_picture_attributes(MpegEncContext *s, AVFrame *dst, AVFrame *src){ int i; |