comparison mpegvideo_enc.c @ 10636:703cfed31320 libavcodec

Move ff_init_qscale_tab() from h263.c to mpegvideo, the function is not h263 specific.
author michael
date Thu, 03 Dec 2009 21:36:58 +0000
parents 8cf141fae2f3
children afd44c3040f5
comparison
equal deleted inserted replaced
10635:2938c3bc34c7 10636:703cfed31320
142 for(i=0;i<64;i++) { 142 for(i=0;i<64;i++) {
143 put_bits(pb, 8, matrix[ ff_zigzag_direct[i] ]); 143 put_bits(pb, 8, matrix[ ff_zigzag_direct[i] ]);
144 } 144 }
145 }else 145 }else
146 put_bits(pb, 1, 0); 146 put_bits(pb, 1, 0);
147 }
148
149 /**
150 * init s->current_picture.qscale_table from s->lambda_table
151 */
152 void ff_init_qscale_tab(MpegEncContext *s){
153 int8_t * const qscale_table= s->current_picture.qscale_table;
154 int i;
155
156 for(i=0; i<s->mb_num; i++){
157 unsigned int lam= s->lambda_table[ s->mb_index2xy[i] ];
158 int qp= (lam*139 + FF_LAMBDA_SCALE*64) >> (FF_LAMBDA_SHIFT + 7);
159 qscale_table[ s->mb_index2xy[i] ]= av_clip(qp, s->avctx->qmin, s->avctx->qmax);
160 }
147 } 161 }
148 162
149 static void copy_picture_attributes(MpegEncContext *s, AVFrame *dst, AVFrame *src){ 163 static void copy_picture_attributes(MpegEncContext *s, AVFrame *dst, AVFrame *src){
150 int i; 164 int i;
151 165