[xiph-commits] r9618 - trunk/theora/lib

giles at svn.xiph.org giles at svn.xiph.org
Sun Jul 24 14:16:08 PDT 2005


Author: giles
Date: 2005-07-24 14:16:06 -0700 (Sun, 24 Jul 2005)
New Revision: 9618

Modified:
   trunk/theora/lib/codec_internal.h
   trunk/theora/lib/idct.c
   trunk/theora/lib/quant.c
   trunk/theora/lib/quant_lookup.h
Log:
Rename the zigzag to row order block coefficient lookup table to
the more explicative name (de)zigzag_quant[].


Modified: trunk/theora/lib/codec_internal.h
===================================================================
--- trunk/theora/lib/codec_internal.h	2005-07-24 16:02:08 UTC (rev 9617)
+++ trunk/theora/lib/codec_internal.h	2005-07-24 21:16:06 UTC (rev 9618)
@@ -456,7 +456,7 @@
   Q_LIST_ENTRY   UV_coeffs[64];
   Q_LIST_ENTRY   Inter_coeffs[64];
   Q_LIST_ENTRY  *dequant_InterUV_coeffs;
-  unsigned int   quant_index[64];
+  unsigned int   zigzag_index[64];
   ogg_int32_t    quant_Y_coeffs[64];
   ogg_int32_t    quant_UV_coeffs[64];
   ogg_int32_t    fp_quant_Y_coeffs[64]; /* used in reiniting quantizers */

Modified: trunk/theora/lib/idct.c
===================================================================
--- trunk/theora/lib/idct.c	2005-07-24 16:02:08 UTC (rev 9617)
+++ trunk/theora/lib/idct.c	2005-07-24 21:16:06 UTC (rev 9618)
@@ -33,7 +33,7 @@
                    ogg_int32_t * DCT_block) {
   int i;
   for(i=0;i<64;i++)
-    DCT_block[dequant_index[i]] = quantized_list[i] * dequant_coeffs[i];
+    DCT_block[dezigzag_index[i]] = quantized_list[i] * dequant_coeffs[i];
 }
 
 void IDctSlow(  Q_LIST_ENTRY * InputData,
@@ -261,7 +261,7 @@
   int i;
   memset(DCT_block,0, 128);
   for(i=0;i<10;i++)
-    DCT_block[dequant_index[i]] = quantized_list[i] * dequant_coeffs[i];
+    DCT_block[dezigzag_index[i]] = quantized_list[i] * dequant_coeffs[i];
 
 }
 

Modified: trunk/theora/lib/quant.c
===================================================================
--- trunk/theora/lib/quant.c	2005-07-24 16:02:08 UTC (rev 9617)
+++ trunk/theora/lib/quant.c	2005-07-24 21:16:06 UTC (rev 9618)
@@ -334,8 +334,8 @@
 
   /* invert the dequant index into the quant index */
   for ( i = 0; i < BLOCK_SIZE; i++ ){
-    j = dequant_index[i];
-    pbi->quant_index[j] = i;
+    j = dezigzag_index[i];
+    pbi->zigzag_index[j] = i;
   }
 }
 
@@ -552,14 +552,14 @@
 void quantize( PB_INSTANCE *pbi,
                ogg_int16_t * DCT_block,
                Q_LIST_ENTRY * quantized_list){
-  ogg_uint32_t          i;              /*      Row index */
+  ogg_uint32_t  i;              /* Row index */
   Q_LIST_ENTRY  val;            /* Quantised value. */
 
   ogg_int32_t * FquantRoundPtr = pbi->fquant_round;
   ogg_int32_t * FquantCoeffsPtr = pbi->fquant_coeffs;
   ogg_int32_t * FquantZBinSizePtr = pbi->fquant_ZbSize;
   ogg_int16_t * DCT_blockPtr = DCT_block;
-  ogg_uint32_t * QIndexPtr = (ogg_uint32_t *)pbi->quant_index;
+  ogg_uint32_t * ZigZagPtr = (ogg_uint32_t *)pbi->zigzag_index;
   ogg_int32_t temp;
 
   /* Set the quantized_list to default to 0 */
@@ -571,12 +571,12 @@
     if ( DCT_blockPtr[0] >= FquantZBinSizePtr[0] ) {
       temp = FquantCoeffsPtr[0] * ( DCT_blockPtr[0] + FquantRoundPtr[0] ) ;
       val = (Q_LIST_ENTRY) (temp>>16);
-      quantized_list[QIndexPtr[0]] = ( val > 511 ) ? 511 : val;
+      quantized_list[ZigZagPtr[0]] = ( val > 511 ) ? 511 : val;
     } else if ( DCT_blockPtr[0] <= -FquantZBinSizePtr[0] ) {
       temp = FquantCoeffsPtr[0] *
         ( DCT_blockPtr[0] - FquantRoundPtr[0] ) + MIN16;
       val = (Q_LIST_ENTRY) (temp>>16);
-      quantized_list[QIndexPtr[0]] = ( val < -511 ) ? -511 : val;
+      quantized_list[ZigZagPtr[0]] = ( val < -511 ) ? -511 : val;
     }
 
     /* Column 1 */
@@ -584,12 +584,12 @@
       temp = FquantCoeffsPtr[1] *
         ( DCT_blockPtr[1] + FquantRoundPtr[1] ) ;
       val = (Q_LIST_ENTRY) (temp>>16);
-      quantized_list[QIndexPtr[1]] = ( val > 511 ) ? 511 : val;
+      quantized_list[ZigZagPtr[1]] = ( val > 511 ) ? 511 : val;
     } else if ( DCT_blockPtr[1] <= -FquantZBinSizePtr[1] ) {
       temp = FquantCoeffsPtr[1] *
         ( DCT_blockPtr[1] - FquantRoundPtr[1] ) + MIN16;
       val = (Q_LIST_ENTRY) (temp>>16);
-      quantized_list[QIndexPtr[1]] = ( val < -511 ) ? -511 : val;
+      quantized_list[ZigZagPtr[1]] = ( val < -511 ) ? -511 : val;
     }
 
     /* Column 2 */
@@ -597,12 +597,12 @@
       temp = FquantCoeffsPtr[2] *
         ( DCT_blockPtr[2] + FquantRoundPtr[2] ) ;
       val = (Q_LIST_ENTRY) (temp>>16);
-      quantized_list[QIndexPtr[2]] = ( val > 511 ) ? 511 : val;
+      quantized_list[ZigZagPtr[2]] = ( val > 511 ) ? 511 : val;
     } else if ( DCT_blockPtr[2] <= -FquantZBinSizePtr[2] ) {
       temp = FquantCoeffsPtr[2] *
         ( DCT_blockPtr[2] - FquantRoundPtr[2] ) + MIN16;
       val = (Q_LIST_ENTRY) (temp>>16);
-      quantized_list[QIndexPtr[2]] = ( val < -511 ) ? -511 : val;
+      quantized_list[ZigZagPtr[2]] = ( val < -511 ) ? -511 : val;
     }
 
     /* Column 3 */
@@ -610,12 +610,12 @@
       temp = FquantCoeffsPtr[3] *
         ( DCT_blockPtr[3] + FquantRoundPtr[3] ) ;
       val = (Q_LIST_ENTRY) (temp>>16);
-      quantized_list[QIndexPtr[3]] = ( val > 511 ) ? 511 : val;
+      quantized_list[ZigZagPtr[3]] = ( val > 511 ) ? 511 : val;
     } else if ( DCT_blockPtr[3] <= -FquantZBinSizePtr[3] ) {
       temp = FquantCoeffsPtr[3] *
         ( DCT_blockPtr[3] - FquantRoundPtr[3] ) + MIN16;
       val = (Q_LIST_ENTRY) (temp>>16);
-      quantized_list[QIndexPtr[3]] = ( val < -511 ) ? -511 : val;
+      quantized_list[ZigZagPtr[3]] = ( val < -511 ) ? -511 : val;
     }
 
     /* Column 4 */
@@ -623,12 +623,12 @@
       temp = FquantCoeffsPtr[4] *
         ( DCT_blockPtr[4] + FquantRoundPtr[4] ) ;
       val = (Q_LIST_ENTRY) (temp>>16);
-      quantized_list[QIndexPtr[4]] = ( val > 511 ) ? 511 : val;
+      quantized_list[ZigZagPtr[4]] = ( val > 511 ) ? 511 : val;
     } else if ( DCT_blockPtr[4] <= -FquantZBinSizePtr[4] ) {
       temp = FquantCoeffsPtr[4] *
         ( DCT_blockPtr[4] - FquantRoundPtr[4] ) + MIN16;
       val = (Q_LIST_ENTRY) (temp>>16);
-      quantized_list[QIndexPtr[4]] = ( val < -511 ) ? -511 : val;
+      quantized_list[ZigZagPtr[4]] = ( val < -511 ) ? -511 : val;
     }
 
     /* Column 5 */
@@ -636,12 +636,12 @@
       temp = FquantCoeffsPtr[5] *
         ( DCT_blockPtr[5] + FquantRoundPtr[5] ) ;
       val = (Q_LIST_ENTRY) (temp>>16);
-      quantized_list[QIndexPtr[5]] = ( val > 511 ) ? 511 : val;
+      quantized_list[ZigZagPtr[5]] = ( val > 511 ) ? 511 : val;
     } else if ( DCT_blockPtr[5] <= -FquantZBinSizePtr[5] ) {
       temp = FquantCoeffsPtr[5] *
         ( DCT_blockPtr[5] - FquantRoundPtr[5] ) + MIN16;
       val = (Q_LIST_ENTRY) (temp>>16);
-      quantized_list[QIndexPtr[5]] = ( val < -511 ) ? -511 : val;
+      quantized_list[ZigZagPtr[5]] = ( val < -511 ) ? -511 : val;
     }
 
     /* Column 6 */
@@ -649,12 +649,12 @@
       temp = FquantCoeffsPtr[6] *
         ( DCT_blockPtr[6] + FquantRoundPtr[6] ) ;
       val = (Q_LIST_ENTRY) (temp>>16);
-      quantized_list[QIndexPtr[6]] = ( val > 511 ) ? 511 : val;
+      quantized_list[ZigZagPtr[6]] = ( val > 511 ) ? 511 : val;
     } else if ( DCT_blockPtr[6] <= -FquantZBinSizePtr[6] ) {
       temp = FquantCoeffsPtr[6] *
         ( DCT_blockPtr[6] - FquantRoundPtr[6] ) + MIN16;
       val = (Q_LIST_ENTRY) (temp>>16);
-      quantized_list[QIndexPtr[6]] = ( val < -511 ) ? -511 : val;
+      quantized_list[ZigZagPtr[6]] = ( val < -511 ) ? -511 : val;
     }
 
     /* Column 7 */
@@ -662,19 +662,19 @@
       temp = FquantCoeffsPtr[7] *
         ( DCT_blockPtr[7] + FquantRoundPtr[7] ) ;
       val = (Q_LIST_ENTRY) (temp>>16);
-      quantized_list[QIndexPtr[7]] = ( val > 511 ) ? 511 : val;
+      quantized_list[ZigZagPtr[7]] = ( val > 511 ) ? 511 : val;
     } else if ( DCT_blockPtr[7] <= -FquantZBinSizePtr[7] ) {
       temp = FquantCoeffsPtr[7] *
         ( DCT_blockPtr[7] - FquantRoundPtr[7] ) + MIN16;
       val = (Q_LIST_ENTRY) (temp>>16);
-      quantized_list[QIndexPtr[7]] = ( val < -511 ) ? -511 : val;
+      quantized_list[ZigZagPtr[7]] = ( val < -511 ) ? -511 : val;
     }
 
     FquantRoundPtr += 8;
     FquantCoeffsPtr += 8;
     FquantZBinSizePtr += 8;
     DCT_blockPtr += 8;
-    QIndexPtr += 8;
+    ZigZagPtr += 8;
   }
 }
 
@@ -701,19 +701,19 @@
 
   /* Reorder dequantisation coefficients into dct zigzag order. */
   for ( i = 0; i < BLOCK_SIZE; i++ ) {
-    j = pbi->quant_index[i];
+    j = pbi->zigzag_index[i];
     pbi->dequant_Y_coeffs[j] = Y_coeffs[i];
   }
   for ( i = 0; i < BLOCK_SIZE; i++ ){
-    j = pbi->quant_index[i];
+    j = pbi->zigzag_index[i];
     pbi->dequant_Inter_coeffs[j] = Inter_coeffs[i];
   }
   for ( i = 0; i < BLOCK_SIZE; i++ ){
-    j = pbi->quant_index[i];
+    j = pbi->zigzag_index[i];
     pbi->dequant_UV_coeffs[j] = UV_coeffs[i];
   }
   for ( i = 0; i < BLOCK_SIZE; i++ ){
-    j = pbi->quant_index[i];
+    j = pbi->zigzag_index[i];
     pbi->dequant_InterUV_coeffs[j] = Inter_coeffs[i];
   }
 

Modified: trunk/theora/lib/quant_lookup.h
===================================================================
--- trunk/theora/lib/quant_lookup.h	2005-07-24 16:02:08 UTC (rev 9617)
+++ trunk/theora/lib/quant_lookup.h	2005-07-24 21:16:06 UTC (rev 9618)
@@ -25,7 +25,8 @@
 #define IDCT_SCALE_FACTOR     2 /* Shift left bits to improve IDCT precision */
 #define OLD_SCHEME            1
 
-static const ogg_uint32_t dequant_index[64] = {
+/* lookup table for DCT coefficient zig-zag ordering */
+static const ogg_uint32_t dezigzag_index[64] = {
   0,  1,  8,  16,  9,  2,  3, 10,
   17, 24, 32, 25, 18, 11,  4,  5,
   12, 19, 26, 33, 40, 48, 41, 34,



More information about the commits mailing list