]> granicus.if.org Git - libvpx/commitdiff
Only support improved quant
authorPaul Wilkins <paulwilkins@google.com>
Wed, 21 Mar 2012 18:22:33 +0000 (18:22 +0000)
committerPaul Wilkins <paulwilkins@google.com>
Wed, 21 Mar 2012 18:22:33 +0000 (18:22 +0000)
Deprecate fast quant and strict_quant code.
Small effect on quality as fast was used in first pass but the
effect is basically neutral across the derf set.

The rationale here is to reduce the number of code paths for
now to make experimentation easier. Optimized and fast code
options can be re-introduced later along with other  encode
speed options.

Change-Id: Ia30c5daf3dbc52e72c83b277a1d281e3c934cdad

vp8/encoder/encodeframe.c
vp8/encoder/encodemb.c
vp8/encoder/generic/csystemdependent.c
vp8/encoder/onyx_if.c
vp8/encoder/onyx_int.h
vp8/encoder/quantize.c
vp8/encoder/quantize.h
vp8/encoder/x86/quantize_x86.h
vp8/encoder/x86/x86_csystemdependent.c

index fdc66c0c65a06e197190e33651aa46ca68997730..8feea41a655a294bebf244351a65b203e4f3bd2d 100644 (file)
@@ -1168,18 +1168,6 @@ int vp8cx_encode_inter_macroblock
         int zbin_mode_boost_enabled = cpi->zbin_mode_boost_enabled;
         int single, compound, hybrid;
 
-        /* Are we using the fast quantizer for the mode selection? */
-        if(cpi->sf.use_fastquant_for_pick)
-        {
-            cpi->mb.quantize_b      = QUANTIZE_INVOKE(&cpi->rtcd.quantize,
-                                                      fastquantb);
-            cpi->mb.quantize_b_pair = QUANTIZE_INVOKE(&cpi->rtcd.quantize,
-                                                      fastquantb_pair);
-
-            /* the fast quantizer does not use zbin_extra, so
-             * do not recalculate */
-            cpi->zbin_mode_boost_enabled = 0;
-        }
         vp8_rd_pick_inter_mode(cpi, x, recon_yoffset, recon_uvoffset, &rate,
                                &distortion, &intra_error, &single, &compound, &hybrid);
 
@@ -1215,14 +1203,6 @@ int vp8cx_encode_inter_macroblock
             cpi->t4x4_count++;
         }
 
-        /* switch back to the regular quantizer for the encode */
-        if (cpi->sf.improved_quant)
-        {
-            cpi->mb.quantize_b      = QUANTIZE_INVOKE(&cpi->rtcd.quantize,
-                                                      quantb);
-            cpi->mb.quantize_b_pair = QUANTIZE_INVOKE(&cpi->rtcd.quantize,
-                                                      quantb_pair);
-        }
         /* restore cpi->zbin_mode_boost_enabled */
         cpi->zbin_mode_boost_enabled = zbin_mode_boost_enabled;
 
@@ -1263,10 +1243,7 @@ int vp8cx_encode_inter_macroblock
             }
         }
 
-        /* The fast quantizer doesn't use zbin_extra, only do so with
-         * the regular quantizer. */
-        if (cpi->sf.improved_quant)
-            vp8_update_zbin_extra(cpi, x);
+        vp8_update_zbin_extra(cpi, x);
     }
 
     seg_ref_active = segfeature_active( xd, *segment_id, SEG_LVL_REF_FRAME );
index ab0f1c13e6da6080a6aff5138d7fd871daea25fc..ae8ab8846fb9d6baa06d199dbcdf4d8770ae792d 100644 (file)
@@ -399,13 +399,6 @@ static void optimize_b(MACROBLOCK *mb, int ib, int type,
     b = &mb->block[ib];
     d = &mb->e_mbd.block[ib];
 
-    /* Enable this to test the effect of RDO as a replacement for the dynamic
-     *  zero bin instead of an augmentation of it.
-     */
-#if 0
-    vp8_strict_quantize_b(b, d);
-#endif
-
     dequant_ptr = d->dequant;
     coeff_ptr = b->coeff;
     qcoeff_ptr = d->qcoeff;
@@ -831,13 +824,6 @@ void optimize_b_8x8(MACROBLOCK *mb, int i, int type,
     b = &mb->block[i];
     d = &mb->e_mbd.block[i];
 
-    /* Enable this to test the effect of RDO as a replacement for the dynamic
-     *  zero bin instead of an augmentation of it.
-     */
-#if 0
-    vp8_strict_quantize_b(b, d);
-#endif
-
     dequant_ptr = d->dequant;
     coeff_ptr = b->coeff;
     qcoeff_ptr = d->qcoeff;
index ebb16e3f090cfa34dffc203a14fd59289cea50a5..59b30a7628c86ab46b508017014a128c14f869a3 100644 (file)
@@ -84,14 +84,6 @@ void vp8_cmachine_specific_config(VP8_COMP *cpi)
     cpi->rtcd.encodemb.submby                = vp8_subtract_mby_c;
     cpi->rtcd.encodemb.submbuv               = vp8_subtract_mbuv_c;
 
-    cpi->rtcd.quantize.quantb                = vp8_regular_quantize_b;
-    cpi->rtcd.quantize.quantb_pair           = vp8_regular_quantize_b_pair;
-    cpi->rtcd.quantize.fastquantb            = vp8_fast_quantize_b_c;
-    cpi->rtcd.quantize.fastquantb_pair       = vp8_fast_quantize_b_pair_c;
-    cpi->rtcd.quantize.quantb_8x8            = vp8_regular_quantize_b_8x8;
-    cpi->rtcd.quantize.fastquantb_8x8        = vp8_fast_quantize_b_8x8_c;
-    cpi->rtcd.quantize.quantb_2x2            = vp8_regular_quantize_b_2x2;
-    cpi->rtcd.quantize.fastquantb_2x2        = vp8_fast_quantize_b_2x2_c;
     cpi->rtcd.search.full_search             = vp8_full_search_sad;
     cpi->rtcd.search.refining_search         = vp8_refining_search_sad;
     cpi->rtcd.search.diamond_search          = vp8_diamond_search_sad;
index 6195c4c4856894e5fcac8a1705de761b080b4302..021c450be49653e9851dd4a14079eaaa2255989e 100644 (file)
@@ -652,7 +652,6 @@ void vp8_set_speed_features(VP8_COMP *cpi)
     int Speed = cpi->Speed;
     int i;
     VP8_COMMON *cm = &cpi->common;
-    int last_improved_quant = sf->improved_quant;
 
     // Only modes 0 and 1 supported for now in experimental code basae
     if ( Mode > 1 )
@@ -671,7 +670,6 @@ void vp8_set_speed_features(VP8_COMP *cpi)
     // best quality defaults
     sf->RD = 1;
     sf->search_method = NSTEP;
-    sf->improved_quant = 1;
     sf->improved_dct = 1;
     sf->auto_filter = 1;
     sf->recode_loop = 1;
@@ -679,7 +677,6 @@ void vp8_set_speed_features(VP8_COMP *cpi)
     sf->half_pixel_search = 1;
     sf->iterative_sub_pixel = 1;
     sf->optimize_coefficients = 1;
-    sf->use_fastquant_for_pick = 0;
     sf->no_skip_block4x4_search = 1;
 
     sf->first_step = 0;
@@ -791,7 +788,6 @@ void vp8_set_speed_features(VP8_COMP *cpi)
         {
             /* Disable coefficient optimization above speed 0 */
             sf->optimize_coefficients = 0;
-            sf->use_fastquant_for_pick = 1;
             sf->no_skip_block4x4_search = 0;
 
             sf->first_step = 1;
@@ -902,7 +898,6 @@ void vp8_set_speed_features(VP8_COMP *cpi)
             sf->thresh_mult[THR_COMP_NEWLA    ] = 2500;
             sf->thresh_mult[THR_COMP_NEWGA    ] = 2500;
 
-            sf->improved_quant = 0;
             sf->improved_dct = 0;
 
             // Only do recode loop on key frames, golden frames and
@@ -971,7 +966,6 @@ void vp8_set_speed_features(VP8_COMP *cpi)
     // so make sure they are always turned off.
     if ( cpi->pass == 1 )
     {
-        sf->improved_quant = 0;
         sf->optimize_coefficients = 0;
         sf->improved_dct = 0;
     }
@@ -1001,26 +995,13 @@ void vp8_set_speed_features(VP8_COMP *cpi)
     cpi->mb.short_walsh4x4 = FDCT_INVOKE(&cpi->rtcd.fdct, walsh_short4x4);
     cpi->mb.short_fhaar2x2 = FDCT_INVOKE(&cpi->rtcd.fdct, haar_short2x2);
 
-    if (cpi->sf.improved_quant)
-    {
-        cpi->mb.quantize_b      = QUANTIZE_INVOKE(&cpi->rtcd.quantize,
-                                                  quantb);
-        cpi->mb.quantize_b_pair = QUANTIZE_INVOKE(&cpi->rtcd.quantize,
-                                                  quantb_pair);
-        cpi->mb.quantize_b_8x8  = QUANTIZE_INVOKE(&cpi->rtcd.quantize, quantb_8x8);
-        cpi->mb.quantize_b_2x2  = QUANTIZE_INVOKE(&cpi->rtcd.quantize, quantb_2x2);
-    }
-    else
-    {
-        cpi->mb.quantize_b      = QUANTIZE_INVOKE(&cpi->rtcd.quantize,
-                                                  fastquantb);
-        cpi->mb.quantize_b_pair = QUANTIZE_INVOKE(&cpi->rtcd.quantize,
-                                                  fastquantb_pair);
-        cpi->mb.quantize_b_8x8  = QUANTIZE_INVOKE(&cpi->rtcd.quantize, fastquantb_8x8);
-        cpi->mb.quantize_b_2x2  = QUANTIZE_INVOKE(&cpi->rtcd.quantize, fastquantb_2x2);
-    }
-    if (cpi->sf.improved_quant != last_improved_quant)
-        vp8cx_init_quantizer(cpi);
+
+    cpi->mb.quantize_b      = vp8_regular_quantize_b;
+    cpi->mb.quantize_b_pair = vp8_regular_quantize_b_pair;
+    cpi->mb.quantize_b_8x8  = vp8_regular_quantize_b_8x8;
+    cpi->mb.quantize_b_2x2  = vp8_regular_quantize_b_2x2;
+
+    vp8cx_init_quantizer(cpi);
 
 #if CONFIG_RUNTIME_CPU_DETECT
     cpi->mb.e_mbd.rtcd = &cpi->common.rtcd;
index 158f5613f55794686ef47eb7201b22acd0c52f7f..ed3a8823439e99b9cba0dd4a397a9d234cf5f3e2 100644 (file)
@@ -220,7 +220,6 @@ typedef struct
 {
     int RD;
     SEARCH_METHODS search_method;
-    int improved_quant;
     int improved_dct;
     int auto_filter;
     int recode_loop;
@@ -231,8 +230,6 @@ typedef struct
     int max_step_search_steps;
     int first_step;
     int optimize_coefficients;
-
-    int use_fastquant_for_pick;
     int no_skip_block4x4_search;
     int improved_mv_pred;
 
@@ -269,7 +266,6 @@ typedef struct VP8_ENCODER_RTCD
     vp8_variance_rtcd_vtable_t  variance;
     vp8_fdct_rtcd_vtable_t      fdct;
     vp8_encodemb_rtcd_vtable_t  encodemb;
-    vp8_quantize_rtcd_vtable_t  quantize;
     vp8_search_rtcd_vtable_t    search;
     vp8_temporal_rtcd_vtable_t  temporal;
 } VP8_ENCODER_RTCD;
index b50a424344379ac10c8870c7c3836888fe3904a3..91b48eae7db876d04ad166029ef316e2206f339d 100644 (file)
 extern int enc_debug;
 #endif
 
-void vp8_fast_quantize_b_c(BLOCK *b, BLOCKD *d)
-{
-    int i, rc, eob;
-    int x, y, z, sz;
-    short *coeff_ptr   = b->coeff;
-    short *round_ptr   = b->round;
-    short *quant_ptr   = b->quant_fast;
-    short *qcoeff_ptr  = d->qcoeff;
-    short *dqcoeff_ptr = d->dqcoeff;
-    short *dequant_ptr = d->dequant;
-    vpx_memset(qcoeff_ptr, 0, 32);
-    vpx_memset(dqcoeff_ptr, 0, 32);
-
-    eob = -1;
-    for (i = 0; i < 16; i++)
-    {
-        rc   = vp8_default_zig_zag1d[i];
-        z    = coeff_ptr[rc];
-
-        sz = (z >> 31);                                 // sign of z
-        x  = (z ^ sz) - sz;                             // x = abs(z)
-
-        y  = ((x + round_ptr[rc]) * quant_ptr[rc]) >> 16; // quantize (x)
-        x  = (y ^ sz) - sz;                         // get the sign back
-        qcoeff_ptr[rc] = x;                          // write to destination
-        dqcoeff_ptr[rc] = x * dequant_ptr[rc];        // dequantized value
-
-        if (y)
-        {
-            eob = i;                                // last nonzero coeffs
-        }
-    }
-    d->eob = eob + 1;
-}
-
 void vp8_regular_quantize_b(BLOCK *b, BLOCKD *d)
 {
     int i, rc, eob;
@@ -109,66 +74,6 @@ void vp8_regular_quantize_b(BLOCK *b, BLOCKD *d)
     d->eob = eob + 1;
 }
 
-/* Perform regular quantization, with unbiased rounding and no zero bin. */
-void vp8_strict_quantize_b(BLOCK *b, BLOCKD *d)
-{
-    int i;
-    int rc;
-    int eob;
-    int x;
-    int y;
-    int z;
-    int sz;
-    short *coeff_ptr;
-    short *quant_ptr;
-    unsigned char *quant_shift_ptr;
-    short *qcoeff_ptr;
-    short *dqcoeff_ptr;
-    short *dequant_ptr;
-
-    coeff_ptr       = b->coeff;
-    quant_ptr       = b->quant;
-    quant_shift_ptr = b->quant_shift;
-    qcoeff_ptr      = d->qcoeff;
-    dqcoeff_ptr     = d->dqcoeff;
-    dequant_ptr     = d->dequant;
-    eob = - 1;
-    vpx_memset(qcoeff_ptr, 0, 32);
-    vpx_memset(dqcoeff_ptr, 0, 32);
-    for (i = 0; i < 16; i++)
-    {
-        int dq;
-        int round;
-
-        /*TODO: These arrays should be stored in zig-zag order.*/
-        rc = vp8_default_zig_zag1d[i];
-        z = coeff_ptr[rc];
-        dq = dequant_ptr[rc];
-        round = dq >> 1;
-        /* Sign of z. */
-        sz = -(z < 0);
-        x = (z + sz) ^ sz;
-        x += round;
-        if (x >= dq)
-        {
-            /* Quantize x. */
-            y  = (((x * quant_ptr[rc]) >> 16) + x) >> quant_shift_ptr[rc];
-            /* Put the sign back. */
-            x = (y + sz) ^ sz;
-            /* Save the coefficient and its dequantized value. */
-            qcoeff_ptr[rc] = x;
-            dqcoeff_ptr[rc] = x * dq;
-            /* Remember the last non-zero coefficient. */
-            if (y)
-            {
-                eob = i;
-            }
-        }
-    }
-
-    d->eob = eob + 1;
-}
-
 void vp8_quantize_mby_c(MACROBLOCK *x)
 {
     int i;
@@ -203,103 +108,6 @@ void vp8_quantize_mbuv_c(MACROBLOCK *x)
         x->quantize_b(&x->block[i], &x->e_mbd.block[i]);
 }
 
-void vp8_fast_quantize_b_2x2_c(BLOCK *b, BLOCKD *d)
-{
-  int i, rc, eob;
-  int zbin;
-  int x, y, z, sz;
-  short *coeff_ptr  = b->coeff;
-  short *zbin_ptr   = b->zbin;
-  short *round_ptr  = b->round;
-  short *quant_ptr  = b->quant;
-  short *qcoeff_ptr = d->qcoeff;
-  short *dqcoeff_ptr = d->dqcoeff;
-  short *dequant_ptr = d->dequant;
-  //double q2nd = 4;
-  vpx_memset(qcoeff_ptr, 0, 32);
-  vpx_memset(dqcoeff_ptr, 0, 32);
-
-  eob = -1;
-
-  for (i = 0; i < 4; i++)
-  {
-    rc   = vp8_default_zig_zag1d[i];
-    z    = coeff_ptr[rc];
-    //zbin = zbin_ptr[rc]/q2nd;
-    zbin = zbin_ptr[rc];
-
-    sz = (z >> 31);                                 // sign of z
-    x  = (z ^ sz) - sz;                             // x = abs(z)
-
-    if (x >= zbin)
-    {
-      //y  = ((int)((x + round_ptr[rc]/q2nd) * quant_ptr[rc] * q2nd)) >> 16; // quantize (x)
-      y  = ((int)((x + round_ptr[rc]) * quant_ptr[rc])) >> 16; // quantize (x)
-      x  = (y ^ sz) - sz;                         // get the sign back
-      qcoeff_ptr[rc] = x;                          // write to destination
-      //dqcoeff_ptr[rc] = x * dequant_ptr[rc] / q2nd;        // dequantized value
-      dqcoeff_ptr[rc] = x * dequant_ptr[rc];        // dequantized value
-      dqcoeff_ptr[rc] = (dqcoeff_ptr[rc]+2)>>2;
-
-      if (y)
-      {
-        eob = i;                                // last nonzero coeffs
-      }
-    }
-  }
-  d->eob = eob + 1;
-}
-
-void vp8_fast_quantize_b_8x8_c(BLOCK *b, BLOCKD *d)
-{
-    int i, rc, eob;
-    int zbin;
-    int x, y, z, sz;
-    short *coeff_ptr  = b->coeff;
-    short *zbin_ptr   = b->zbin;
-    short *round_ptr  = b->round;
-    short *quant_ptr  = b->quant;
-    short *qcoeff_ptr = d->qcoeff;
-    short *dqcoeff_ptr = d->dqcoeff;
-    short *dequant_ptr = d->dequant;
-    //double q1st = 2;
-    vpx_memset(qcoeff_ptr, 0, 64*sizeof(short));
-    vpx_memset(dqcoeff_ptr, 0, 64*sizeof(short));
-
-    eob = -1;
-
-
-
-    for (i = 0; i < 64; i++)
-    {
-
-        rc   = vp8_default_zig_zag1d_8x8[i];
-        z    = coeff_ptr[rc];
-        //zbin = zbin_ptr[rc!=0]/q1st ;
-        zbin = zbin_ptr[rc!=0] ;
-
-        sz = (z >> 31);                                 // sign of z
-        x  = (z ^ sz) - sz;                             // x = abs(z)
-
-        if (x >= zbin)
-        {
-            //y  = ((int)((x + round_ptr[rc!=0] / q1st) * quant_ptr[rc!=0] * q1st)) >> 16;
-            y  = ((int)((x + round_ptr[rc!=0]) * quant_ptr[rc!=0])) >> 16;
-            x  = (y ^ sz) - sz;                         // get the sign back
-            qcoeff_ptr[rc] = x;                         // write to destination
-            //dqcoeff_ptr[rc] = x * dequant_ptr[rc!=0] / q1st;        // dequantized value
-            dqcoeff_ptr[rc] = x * dequant_ptr[rc!=0];        // dequantized value
-            dqcoeff_ptr[rc] = (dqcoeff_ptr[rc]+2)>>2;
-
-            if (y)
-            {
-                eob = i;                                // last nonzero coeffs
-            }
-        }
-    }
-    d->eob = eob + 1;
-}
-
 
 
 
@@ -420,127 +228,6 @@ void vp8_regular_quantize_b_8x8(BLOCK *b, BLOCKD *d)
   d->eob = eob + 1;
 }
 
-void vp8_strict_quantize_b_2x2(BLOCK *b, BLOCKD *d)
-{
-  int i;
-  int rc;
-  int eob;
-  int x;
-  int y;
-  int z;
-  int sz;
-  short *coeff_ptr;
-  short *quant_ptr;
-  unsigned char *quant_shift_ptr;
-  short *qcoeff_ptr;
-  short *dqcoeff_ptr;
-  short *dequant_ptr;
-  //double q2nd = 4;
-  coeff_ptr = b->coeff;
-  quant_ptr = b->quant;
-  quant_shift_ptr = b->quant_shift;
-  qcoeff_ptr = d->qcoeff;
-  dqcoeff_ptr = d->dqcoeff;
-  dequant_ptr = d->dequant;
-  eob = - 1;
-  vpx_memset(qcoeff_ptr, 0, 32);
-  vpx_memset(dqcoeff_ptr, 0, 32);
-  for (i = 0; i < 4; i++)
-  {
-    int dq;
-    int round;
-
-    /*TODO: These arrays should be stored in zig-zag order.*/
-    rc = vp8_default_zig_zag1d[i];
-    z = coeff_ptr[rc];
-    //z = z * q2nd;
-    //dq = dequant_ptr[rc]/q2nd;
-    dq = dequant_ptr[rc];
-    round = dq >> 1;
-    /* Sign of z. */
-    sz = -(z < 0);
-    x = (z + sz) ^ sz;
-    x += round;
-    if (x >= dq)
-    {
-      /* Quantize x */
-      y  = (((x * quant_ptr[rc]) >> 16) + x) >> quant_shift_ptr[rc];
-      /* Put the sign back. */
-      x = (y + sz) ^ sz;
-      /* Save * the * coefficient and its dequantized value. */
-      qcoeff_ptr[rc] = x;
-      dqcoeff_ptr[rc] = x * dq;
-      /* Remember the last non-zero coefficient. */
-      if (y)
-      {
-        eob = i;
-      }
-    }
-  }
-  d->eob = eob + 1;
-}
-
-void vp8_strict_quantize_b_8x8(BLOCK *b, BLOCKD *d)
-{
-  int i;
-  int rc;
-  int eob;
-  int x;
-  int y;
-  int z;
-  int sz;
-  short *coeff_ptr;
-  short *quant_ptr;
-  unsigned char *quant_shift_ptr;
-  short *qcoeff_ptr;
-  short *dqcoeff_ptr;
-  short *dequant_ptr;
-  //double q1st = 2;
-  printf("call strict quantizer\n");
-  coeff_ptr = b->coeff;
-  quant_ptr = b->quant;
-  quant_shift_ptr = b->quant_shift;
-  qcoeff_ptr = d->qcoeff;
-  dqcoeff_ptr = d->dqcoeff;
-  dequant_ptr = d->dequant;
-  eob = - 1;
-  vpx_memset(qcoeff_ptr, 0, 64*sizeof(short));
-  vpx_memset(dqcoeff_ptr, 0, 64*sizeof(short));
-  for (i = 0; i < 64; i++)
-  {
-    int dq;
-    int round;
-
-    /*TODO: These arrays should be stored in zig-zag order.*/
-    rc = vp8_default_zig_zag1d_8x8[i];
-    z = coeff_ptr[rc];
-    //z = z * q1st;
-    //dq = dequant_ptr[rc!=0]/q1st;
-    dq = dequant_ptr[rc!=0];
-    round = dq >> 1;
-    /* Sign of z. */
-    sz = -(z < 0);
-    x = (z + sz) ^ sz;
-    x += round;
-    if (x >= dq)
-    {
-      /* Quantize x. */
-      y  = ((int)(((int)((x * quant_ptr[rc!=0])) >> 16) + x)) >> quant_shift_ptr[rc!=0];
-      /* Put the sign back. */
-      x = (y + sz) ^ sz;
-      /* Save the coefficient and its dequantized value.  * */
-      qcoeff_ptr[rc] = x;
-      dqcoeff_ptr[rc] = x * dq;
-      /* Remember the last non-zero coefficient. */
-      if (y)
-      {
-        eob = i;
-      }
-    }
-  }
-  d->eob = eob + 1;
-}
-
 void vp8_quantize_mby_8x8(MACROBLOCK *x)
 {
   int i;
@@ -599,32 +286,17 @@ void vp8_regular_quantize_b_pair(BLOCK *b1, BLOCK *b2, BLOCKD *d1, BLOCKD *d2)
     vp8_regular_quantize_b(b2, d2);
 }
 
-void vp8_fast_quantize_b_pair_c(BLOCK *b1, BLOCK *b2, BLOCKD *d1, BLOCKD *d2)
+static void invert_quant(short *quant,
+                         unsigned char *shift, short d)
 {
-    vp8_fast_quantize_b_c(b1, d1);
-    vp8_fast_quantize_b_c(b2, d2);
-}
-
-
-static void invert_quant(int improved_quant, short *quant,
-                               unsigned char *shift, short d)
-{
-    if(improved_quant)
-    {
-        unsigned t;
-        int l;
-        t = d;
-        for(l = 0; t > 1; l++)
-            t>>=1;
-        t = 1 + (1<<(16+l))/d;
-        *quant = (short)(t - (1<<16));
-        *shift = l;
-    }
-    else
-    {
-        *quant = (1 << 16) / d;
-        *shift = 0;
-    }
+    unsigned t;
+    int l;
+    t = d;
+    for(l = 0; t > 1; l++)
+        t>>=1;
+    t = 1 + (1<<(16+l))/d;
+    *quant = (short)(t - (1<<16));
+    *shift = l;
 }
 
 
@@ -644,7 +316,7 @@ void vp8cx_init_quantizer(VP8_COMP *cpi)
         // dc values
         quant_val = vp8_dc_quant(Q, cpi->common.y1dc_delta_q);
         cpi->Y1quant_fast[Q][0] = (1 << 16) / quant_val;
-        invert_quant(cpi->sf.improved_quant, cpi->Y1quant[Q] + 0,
+        invert_quant(cpi->Y1quant[Q] + 0,
                      cpi->Y1quant_shift[Q] + 0, quant_val);
         cpi->Y1zbin[Q][0] = ((qzbin_factor * quant_val) + 64) >> 7;
         cpi->Y1round[Q][0] = (qrounding_factor * quant_val) >> 7;
@@ -653,7 +325,7 @@ void vp8cx_init_quantizer(VP8_COMP *cpi)
 
         quant_val = vp8_dc2quant(Q, cpi->common.y2dc_delta_q);
         cpi->Y2quant_fast[Q][0] = (1 << 16) / quant_val;
-        invert_quant(cpi->sf.improved_quant, cpi->Y2quant[Q] + 0,
+        invert_quant(cpi->Y2quant[Q] + 0,
                      cpi->Y2quant_shift[Q] + 0, quant_val);
         cpi->Y2zbin[Q][0] = ((qzbin_factor * quant_val) + 64) >> 7;
         cpi->Y2round[Q][0] = (qrounding_factor * quant_val) >> 7;
@@ -662,7 +334,7 @@ void vp8cx_init_quantizer(VP8_COMP *cpi)
 
         quant_val = vp8_dc_uv_quant(Q, cpi->common.uvdc_delta_q);
         cpi->UVquant_fast[Q][0] = (1 << 16) / quant_val;
-        invert_quant(cpi->sf.improved_quant, cpi->UVquant[Q] + 0,
+        invert_quant(cpi->UVquant[Q] + 0,
                      cpi->UVquant_shift[Q] + 0, quant_val);
         cpi->UVzbin[Q][0] = ((qzbin_factor * quant_val) + 64) >> 7;;
         cpi->UVround[Q][0] = (qrounding_factor * quant_val) >> 7;
@@ -676,7 +348,7 @@ void vp8cx_init_quantizer(VP8_COMP *cpi)
 
             quant_val = vp8_ac_yquant(Q);
             cpi->Y1quant_fast[Q][rc] = (1 << 16) / quant_val;
-            invert_quant(cpi->sf.improved_quant, cpi->Y1quant[Q] + rc,
+            invert_quant(cpi->Y1quant[Q] + rc,
                          cpi->Y1quant_shift[Q] + rc, quant_val);
             cpi->Y1zbin[Q][rc] = ((qzbin_factor * quant_val) + 64) >> 7;
             cpi->Y1round[Q][rc] = (qrounding_factor * quant_val) >> 7;
@@ -685,7 +357,7 @@ void vp8cx_init_quantizer(VP8_COMP *cpi)
 
             quant_val = vp8_ac2quant(Q, cpi->common.y2ac_delta_q);
             cpi->Y2quant_fast[Q][rc] = (1 << 16) / quant_val;
-            invert_quant(cpi->sf.improved_quant, cpi->Y2quant[Q] + rc,
+            invert_quant(cpi->Y2quant[Q] + rc,
                          cpi->Y2quant_shift[Q] + rc, quant_val);
             cpi->Y2zbin[Q][rc] = ((qzbin_factor * quant_val) + 64) >> 7;
             cpi->Y2round[Q][rc] = (qrounding_factor * quant_val) >> 7;
@@ -694,7 +366,7 @@ void vp8cx_init_quantizer(VP8_COMP *cpi)
 
             quant_val = vp8_ac_uv_quant(Q, cpi->common.uvac_delta_q);
             cpi->UVquant_fast[Q][rc] = (1 << 16) / quant_val;
-            invert_quant(cpi->sf.improved_quant, cpi->UVquant[Q] + rc,
+            invert_quant(cpi->UVquant[Q] + rc,
                          cpi->UVquant_shift[Q] + rc, quant_val);
             cpi->UVzbin[Q][rc] = ((qzbin_factor * quant_val) + 64) >> 7;
             cpi->UVround[Q][rc] = (qrounding_factor * quant_val) >> 7;
index 37221839eea2e557396fb941371872abcd33c954..3d11634b58241793e2dc7eebd48f76992cc9c31f 100644 (file)
@@ -41,49 +41,16 @@ extern prototype_quantize_block(vp8_quantize_quantb);
 #endif
 extern prototype_quantize_block_pair(vp8_quantize_quantb_pair);
 
-#ifndef vp8_quantize_fastquantb
-#define vp8_quantize_fastquantb vp8_fast_quantize_b_c
-#endif
-extern prototype_quantize_block(vp8_quantize_fastquantb);
-
 #ifndef vp8_quantize_quantb_8x8
 #define vp8_quantize_quantb_8x8 vp8_regular_quantize_b_8x8
 #endif
 extern prototype_quantize_block(vp8_quantize_quantb_8x8);
 
-#ifndef vp8_quantize_fastquantb_8x8
-#define vp8_quantize_fastquantb_8x8 vp8_fast_quantize_b_8x8_c
-#endif
-extern prototype_quantize_block(vp8_quantize_fastquantb_8x8);
-
 #ifndef vp8_quantize_quantb_2x2
 #define vp8_quantize_quantb_2x2 vp8_regular_quantize_b_2x2
 #endif
 extern prototype_quantize_block(vp8_quantize_quantb_2x2);
 
-#ifndef vp8_quantize_fastquantb_2x2
-#define vp8_quantize_fastquantb_2x2 vp8_fast_quantize_b_2x2_c
-#endif
-extern prototype_quantize_block(vp8_quantize_fastquantb_2x2);
-
-
-#ifndef vp8_quantize_fastquantb_pair
-#define vp8_quantize_fastquantb_pair vp8_fast_quantize_b_pair_c
-#endif
-extern prototype_quantize_block_pair(vp8_quantize_fastquantb_pair);
-
-typedef struct
-{
-    prototype_quantize_block(*quantb);
-    prototype_quantize_block_pair(*quantb_pair);
-    prototype_quantize_block(*fastquantb);
-    prototype_quantize_block(*quantb_8x8);
-    prototype_quantize_block(*fastquantb_8x8);
-    prototype_quantize_block(*quantb_2x2);
-    prototype_quantize_block(*fastquantb_2x2);
-    prototype_quantize_block_pair(*fastquantb_pair);
-} vp8_quantize_rtcd_vtable_t;
-
 #ifndef vp8_quantize_mb
 #define vp8_quantize_mb vp8_quantize_mb_c
 #endif
@@ -99,15 +66,6 @@ extern prototype_quantize_mb(vp8_quantize_mbuv);
 #endif
 extern prototype_quantize_mb(vp8_quantize_mby);
 
-#if CONFIG_RUNTIME_CPU_DETECT
-#define QUANTIZE_INVOKE(ctx,fn) (ctx)->fn
-#else
-#define QUANTIZE_INVOKE(ctx,fn) vp8_quantize_##fn
-#endif
-
-extern void vp8_strict_quantize_b(BLOCK *b,BLOCKD *d);
-extern void vp8_strict_quantize_b_8x8(BLOCK *b,BLOCKD *d);
-extern void vp8_strict_quantize_b_2x2(BLOCK *b,BLOCKD *d);
 extern prototype_quantize_mb(vp8_quantize_mby_8x8);
 extern prototype_quantize_mb(vp8_quantize_mbuv_8x8);
 
index bbe475f8cc79065cc19566051bca5e2f67ee6be8..449a6bcac039b9b79a93e6ef41d7d38e0706923c 100644 (file)
 
 #if HAVE_SSE2
 extern prototype_quantize_block(vp8_regular_quantize_b_sse2);
-extern prototype_quantize_block(vp8_fast_quantize_b_sse2);
-
 #if !CONFIG_RUNTIME_CPU_DETECT
 
 #undef vp8_quantize_quantb
 #define vp8_quantize_quantb vp8_regular_quantize_b_sse2
-
-#undef vp8_quantize_fastquantb
-#define vp8_quantize_fastquantb vp8_fast_quantize_b_sse2
-
 #endif /* !CONFIG_RUNTIME_CPU_DETECT */
 
 #endif /* HAVE_SSE2 */
 
 
-#if HAVE_SSSE3
-extern prototype_quantize_block(vp8_fast_quantize_b_ssse3);
-
-#if !CONFIG_RUNTIME_CPU_DETECT
-
-#undef vp8_quantize_fastquantb
-#define vp8_quantize_fastquantb vp8_fast_quantize_b_ssse3
-
-#endif /* !CONFIG_RUNTIME_CPU_DETECT */
-
-#endif /* HAVE_SSSE3 */
-
-
 #if HAVE_SSE4_1
 extern prototype_quantize_block(vp8_regular_quantize_b_sse4);
 
index 0c30e370714c8acca881a636cdc5e2cb556b02ca..ae803f8608891772f6078e8815c27b9db5338347 100644 (file)
@@ -22,34 +22,6 @@ void vp8_short_fdct8x4_mmx(short *input, short *output, int pitch)
     vp8_short_fdct4x4_mmx(input + 4, output + 16, pitch);
 }
 
-int vp8_fast_quantize_b_impl_mmx(short *coeff_ptr, short *zbin_ptr,
-                                 short *qcoeff_ptr, short *dequant_ptr,
-                                 short *scan_mask, short *round_ptr,
-                                 short *quant_ptr, short *dqcoeff_ptr);
-void vp8_fast_quantize_b_mmx(BLOCK *b, BLOCKD *d)
-{
-    short *scan_mask   = vp8_default_zig_zag_mask;//d->scan_order_mask_ptr;
-    short *coeff_ptr   = b->coeff;
-    short *zbin_ptr    = b->zbin;
-    short *round_ptr   = b->round;
-    short *quant_ptr   = b->quant_fast;
-    short *qcoeff_ptr  = d->qcoeff;
-    short *dqcoeff_ptr = d->dqcoeff;
-    short *dequant_ptr = d->dequant;
-
-    d->eob = vp8_fast_quantize_b_impl_mmx(
-                 coeff_ptr,
-                 zbin_ptr,
-                 qcoeff_ptr,
-                 dequant_ptr,
-                 scan_mask,
-
-                 round_ptr,
-                 quant_ptr,
-                 dqcoeff_ptr
-             );
-}
-
 int vp8_mbblock_error_mmx_impl(short *coeff_ptr, short *dcoef_ptr, int dc);
 int vp8_mbblock_error_mmx(MACROBLOCK *mb, int dc)
 {
@@ -165,8 +137,6 @@ void vp8_arch_x86_encoder_init(VP8_COMP *cpi)
         cpi->rtcd.encodemb.subb                  = vp8_subtract_b_mmx;
         cpi->rtcd.encodemb.submby                = vp8_subtract_mby_mmx;
         cpi->rtcd.encodemb.submbuv               = vp8_subtract_mbuv_mmx;
-
-        /*cpi->rtcd.quantize.fastquantb            = vp8_fast_quantize_b_mmx;*/
     }
 #endif
 
@@ -212,8 +182,6 @@ void vp8_arch_x86_encoder_init(VP8_COMP *cpi)
         cpi->rtcd.encodemb.subb                  = vp8_subtract_b_sse2;
         cpi->rtcd.encodemb.submby                = vp8_subtract_mby_sse2;
         cpi->rtcd.encodemb.submbuv               = vp8_subtract_mbuv_sse2;
-
-        cpi->rtcd.quantize.fastquantb            = vp8_fast_quantize_b_sse2;
         cpi->rtcd.temporal.apply                 = vp8_temporal_filter_apply_sse2;
 
 #if CONFIG_INTERNAL_STATS
@@ -254,8 +222,6 @@ void vp8_arch_x86_encoder_init(VP8_COMP *cpi)
 
         cpi->rtcd.variance.subpixvar16x8         = vp8_sub_pixel_variance16x8_ssse3;
         cpi->rtcd.variance.subpixvar16x16        = vp8_sub_pixel_variance16x16_ssse3;
-
-        cpi->rtcd.quantize.fastquantb            = vp8_fast_quantize_b_ssse3;
     }
 #endif