changeset 709:afeff6ccb7f5 libavcodec

convert only needed matrixes in convert_matrix() (mjpeg calls it for every frame)
author michaelni
date Mon, 30 Sep 2002 09:19:54 +0000
parents 1aa1cbb8c3c1
children 97377ab86647
files mpegvideo.c
diffstat 1 files changed, 5 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/mpegvideo.c	Sun Sep 29 23:39:30 2002 +0000
+++ b/mpegvideo.c	Mon Sep 30 09:19:54 2002 +0000
@@ -80,11 +80,11 @@
 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 @@
     /* 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 @@
             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);