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

giles at svn.xiph.org giles at svn.xiph.org
Mon Jul 25 14:21:10 PDT 2005


Author: giles
Date: 2005-07-25 14:21:08 -0700 (Mon, 25 Jul 2005)
New Revision: 9623

Modified:
   trunk/theora/lib/codec_internal.h
   trunk/theora/lib/quant.c
Log:
Rewrite CopyQTables to read the range table from codec_setup_info
as best it can instead of just blindly copying the first three
matricies. We still only support the Y, UV and Inter slots.


Modified: trunk/theora/lib/codec_internal.h
===================================================================
--- trunk/theora/lib/codec_internal.h	2005-07-25 10:26:15 UTC (rev 9622)
+++ trunk/theora/lib/codec_internal.h	2005-07-25 21:21:08 UTC (rev 9623)
@@ -268,10 +268,6 @@
   Q_LIST_ENTRY *qmats;
   qmat_range_table *range_table[6];
 
-  Q_LIST_ENTRY Y_coeffs[64];
-  Q_LIST_ENTRY UV_coeffs[64];
-  Q_LIST_ENTRY Inter_coeffs[64];
-
   HUFF_ENTRY *HuffRoot[NUM_HUFF_TABLES];
 
   unsigned char LoopFilterLimitValues[Q_TABLE_SIZE];
@@ -455,7 +451,11 @@
   Q_LIST_ENTRY   Y_coeffs[64];
   Q_LIST_ENTRY   UV_coeffs[64];
   Q_LIST_ENTRY   Inter_coeffs[64];
+  Q_LIST_ENTRY  *dequant_Y_coeffs;
+  Q_LIST_ENTRY  *dequant_UV_coeffs;
+  Q_LIST_ENTRY  *dequant_Inter_coeffs;
   Q_LIST_ENTRY  *dequant_InterUV_coeffs;
+  Q_LIST_ENTRY  *dequant_coeffs;
   unsigned int   zigzag_index[64];
   ogg_int32_t    quant_Y_coeffs[64];
   ogg_int32_t    quant_UV_coeffs[64];
@@ -478,10 +478,6 @@
   ogg_int32_t   *fquant_coeffs;
   ogg_int32_t   *fquant_round;
   ogg_int32_t   *fquant_ZbSize;
-  Q_LIST_ENTRY  *dequant_Y_coeffs;
-  Q_LIST_ENTRY  *dequant_UV_coeffs;
-  Q_LIST_ENTRY  *dequant_Inter_coeffs;
-  Q_LIST_ENTRY  *dequant_coeffs;
 
   /* Predictor used in choosing entropy table for decoding block patterns. */
   unsigned char  BlockPatternPredictor;

Modified: trunk/theora/lib/quant.c
===================================================================
--- trunk/theora/lib/quant.c	2005-07-25 10:26:15 UTC (rev 9622)
+++ trunk/theora/lib/quant.c	2005-07-25 21:21:08 UTC (rev 9623)
@@ -300,21 +300,27 @@
     }
   }
   
-  /* ignore the range table and reference the matricies we use */
-  memcpy(ci->Y_coeffs, &ci->qmats[0], sizeof(ci->Y_coeffs));
-  memcpy(ci->UV_coeffs, &ci->qmats[64], sizeof(ci->UV_coeffs));
-  memcpy(ci->Inter_coeffs, &ci->qmats[2*64], sizeof(ci->Inter_coeffs));
-
   return 0;
 }
 
 void CopyQTables(PB_INSTANCE *pbi, codec_setup_info *ci) {
+  Q_LIST_ENTRY *qmat;
+
   memcpy(pbi->QThreshTable, ci->QThreshTable, sizeof(pbi->QThreshTable));
   memcpy(pbi->DcScaleFactorTable, ci->DcScaleFactorTable,
          sizeof(pbi->DcScaleFactorTable));
-  memcpy(pbi->Y_coeffs, ci->Y_coeffs, sizeof(pbi->Y_coeffs));
-  memcpy(pbi->UV_coeffs, ci->UV_coeffs, sizeof(pbi->UV_coeffs));
-  memcpy(pbi->Inter_coeffs, ci->Inter_coeffs, sizeof(pbi->Inter_coeffs));
+
+  /* the decoder only supports 3 different base matricies; do the
+     best we can with the range table. We assume the first range
+     entry for Intra U is also good for V, and that the first 
+     Inter Y is good for all the Inter channels. A NULL range 
+     table entry indicates we fall back to the previous value. */
+  qmat = ci->range_table[0]->qmat;
+  memcpy(pbi->Y_coeffs, qmat, sizeof(pbi->Y_coeffs));
+  if (ci->range_table[1]) qmat = ci->range_table[1]->qmat;
+  memcpy(pbi->UV_coeffs, qmat, sizeof(pbi->UV_coeffs));
+  if (ci->range_table[3]) qmat = ci->range_table[3]->qmat;
+  memcpy(pbi->Inter_coeffs, qmat, sizeof(pbi->Inter_coeffs));
 }
 
 /* Initialize custom qtables using the VP31 values.



More information about the commits mailing list