Commit 9015b095 authored by Michael Niedermayer's avatar Michael Niedermayer
Browse files

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
parent bdcc13f2
......@@ -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)
*/
......
......@@ -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 */
......
......@@ -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;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment