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
This commit is contained in:
Michael Niedermayer 2009-12-03 21:36:58 +00:00
parent bdcc13f2bf
commit 9015b095bc
3 changed files with 15 additions and 14 deletions

View File

@ -503,20 +503,6 @@ static inline void restore_ac_coeffs(MpegEncContext * s, DCTELEM block[6][64], i
}
}
/**
* init s->current_picture.qscale_table from s->lambda_table
*/
static 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);
}
}
/**
* modify qscale so that encoding is acually possible in h263 (limit difference to -2..2)
*/

View File

@ -855,6 +855,7 @@ int ff_h263_get_gob_height(MpegEncContext *s);
void ff_mpeg4_init_direct_mv(MpegEncContext *s);
int ff_mpeg4_set_direct_mv(MpegEncContext *s, int mx, int my);
void ff_h263_encode_motion(MpegEncContext * s, int val, int f_code);
void ff_init_qscale_tab(MpegEncContext *s);
/* rv10.c */

View File

@ -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;