From cc7ac88830edd58af9c4c552658319706e396e5b Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Mon, 30 Sep 2002 09:19:54 +0000 Subject: [PATCH] convert only needed matrixes in convert_matrix() (mjpeg calls it for every frame) Originally committed as revision 983 to svn://svn.ffmpeg.org/ffmpeg/trunk --- libavcodec/mpegvideo.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/libavcodec/mpegvideo.c b/libavcodec/mpegvideo.c index 77a296fdbf..1134774b6c 100644 --- a/libavcodec/mpegvideo.c +++ b/libavcodec/mpegvideo.c @@ -80,11 +80,11 @@ static UINT8 default_fcode_tab[MAX_MV*2+1]; int motion_estimation_method = ME_EPZS; static void convert_matrix(MpegEncContext *s, int (*qmat)[64], uint16_t (*qmat16)[64], uint16_t (*qmat16_bias)[64], - const UINT16 *quant_matrix, int bias) + const UINT16 *quant_matrix, int bias, int qmin, int qmax) { int qscale; - for(qscale=1; qscale<32; qscale++){ + for(qscale=qmin; qscale<=qmax; qscale++){ int i; if (s->fdct == ff_jpeg_fdct_islow) { for(i=0;i<64;i++) { @@ -680,9 +680,9 @@ int MPV_encode_init(AVCodecContext *avctx) /* for mjpeg, we do include qscale in the matrix */ if (s->out_format != FMT_MJPEG) { convert_matrix(s, s->q_intra_matrix, s->q_intra_matrix16, s->q_intra_matrix16_bias, - s->intra_matrix, s->intra_quant_bias); + s->intra_matrix, s->intra_quant_bias, 1, 31); convert_matrix(s, s->q_inter_matrix, s->q_inter_matrix16, s->q_inter_matrix16_bias, - s->inter_matrix, s->inter_quant_bias); + s->inter_matrix, s->inter_quant_bias, 1, 31); } if(ff_rate_control_init(s) < 0) @@ -2462,7 +2462,7 @@ static void encode_picture(MpegEncContext *s, int picture_number) s->intra_matrix[j] = CLAMP_TO_8BIT((ff_mpeg1_default_intra_matrix[i] * s->qscale) >> 3); } convert_matrix(s, s->q_intra_matrix, s->q_intra_matrix16, - s->q_intra_matrix16_bias, s->intra_matrix, s->intra_quant_bias); + s->q_intra_matrix16_bias, s->intra_matrix, s->intra_quant_bias, 8, 8); } s->last_bits= get_bit_count(&s->pb);