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

conrad at dactyl.lonelymoon.com conrad
Tue Jul 27 00:04:54 PDT 2004


Author: conrad
Date: Tue Jul 27 00:04:54 2004
New Revision: 7366

Modified:
trunk/theora/lib/block_inline.h
trunk/theora/lib/encoder_internal.h
trunk/theora/lib/huffman.c
trunk/theora/lib/hufftables.h
trunk/theora/lib/pp.c
trunk/theora/lib/quant.c
trunk/theora/lib/quant_lookup.h
trunk/theora/lib/toplevel_lookup.h
Log:
add const keyword in front of static table definitions in libtheora;
patch from Colin Ward


Modified: trunk/theora/lib/block_inline.h
===================================================================
--- trunk/theora/lib/block_inline.h	2004-07-27 05:35:49 UTC (rev 7365)
+++ trunk/theora/lib/block_inline.h	2004-07-27 07:04:52 UTC (rev 7366)
@@ -17,8 +17,8 @@

#include "encoder_internal.h"

-static ogg_int32_t MBOrderMap[4] = { 0, 2, 3, 1 };
-static ogg_int32_t BlockOrderMap1[4][4] = {
+static const ogg_int32_t MBOrderMap[4] = { 0, 2, 3, 1 };
+static const ogg_int32_t BlockOrderMap1[4][4] = {
{ 0, 1, 3, 2 },
{ 0, 2, 3, 1 },
{ 0, 2, 3, 1 },

Modified: trunk/theora/lib/encoder_internal.h
===================================================================
--- trunk/theora/lib/encoder_internal.h	2004-07-27 05:35:49 UTC (rev 7365)
+++ trunk/theora/lib/encoder_internal.h	2004-07-27 07:04:52 UTC (rev 7366)
@@ -450,7 +450,7 @@
HUFF_ENTRY    *HuffRoot_VP3x[NUM_HUFF_TABLES];
ogg_uint32_t  *HuffCodeArray_VP3x[NUM_HUFF_TABLES];
unsigned char *HuffCodeLengthArray_VP3x[NUM_HUFF_TABLES];
-  unsigned char *ExtraBitLengths_VP3x;
+  const unsigned char *ExtraBitLengths_VP3x;

/* Quantiser and rounding tables */
ogg_int32_t    fp_quant_UV_coeffs[64];

Modified: trunk/theora/lib/huffman.c
===================================================================
--- trunk/theora/lib/huffman.c	2004-07-27 05:35:49 UTC (rev 7365)
+++ trunk/theora/lib/huffman.c	2004-07-27 07:04:52 UTC (rev 7366)
@@ -21,7 +21,8 @@
#include "hufftables.h"

static void CreateHuffmanList(HUFF_ENTRY ** HuffRoot,
-                              ogg_uint32_t HIndex, ogg_uint32_t *FreqList ) {
+                              ogg_uint32_t HIndex,
+                              const ogg_uint32_t *FreqList ) {
int i;
HUFF_ENTRY *entry_ptr;
HUFF_ENTRY *search_ptr;
@@ -102,7 +103,7 @@
ogg_uint32_t *HuffCodeArray,
unsigned char *HuffCodeLengthArray,
ogg_uint32_t HIndex,
-                        ogg_uint32_t *FreqList ){
+                        const ogg_uint32_t *FreqList ){

HUFF_ENTRY *entry_ptr;
HUFF_ENTRY *search_ptr;

Modified: trunk/theora/lib/hufftables.h
===================================================================
--- trunk/theora/lib/hufftables.h	2004-07-27 05:35:49 UTC (rev 7365)
+++ trunk/theora/lib/hufftables.h	2004-07-27 07:04:52 UTC (rev 7366)
@@ -18,7 +18,7 @@
#include "huffman.h"
#include "encoder_internal.h"

-unsigned char ExtraBitLengths_VP31[MAX_ENTROPY_TOKENS] = {
+const unsigned char ExtraBitLengths_VP31[MAX_ENTROPY_TOKENS] = {
0, 0, 0, 2, 3, 4, 12,3, 6,                 /* EOB and Zero-run tokens. */
0, 0, 0, 0,                                /* Very low value tokens. */
1, 1, 1, 1, 2, 3, 4, 5, 6, 10,             /* Other value tokens */
@@ -30,7 +30,7 @@

#if NEW_FREQS
/* New baseline frequency tables for encoder version >= 2 */
-ogg_uint32_t FrequencyCounts_VP3[NUM_HUFF_TABLES][MAX_ENTROPY_TOKENS] = {
+const ogg_uint32_t FrequencyCounts_VP3[NUM_HUFF_TABLES][MAX_ENTROPY_TOKENS] = {
/* DC Intra bias  */
{  272,    84,    31,    36,    10,    2,    1,    92,    1,
701,   872,   410,   478,
@@ -531,7 +531,7 @@

#else /* Frequency tables for encoder version < 2 */

-ogg_uint32_t FrequencyCounts_VP3[NUM_HUFF_TABLES][MAX_ENTROPY_TOKENS] = {
+const ogg_uint32_t FrequencyCounts_VP3[NUM_HUFF_TABLES][MAX_ENTROPY_TOKENS] = {
/* DC Intra bias */
{  198,    62,    22,    31,    14,     6,     6,   205,     3,
843,   843,   415,   516,

Modified: trunk/theora/lib/pp.c
===================================================================
--- trunk/theora/lib/pp.c	2004-07-27 05:35:49 UTC (rev 7365)
+++ trunk/theora/lib/pp.c	2004-07-27 07:04:52 UTC (rev 7366)
@@ -24,7 +24,7 @@
#define MIN(a, b) ((a<b)?a:b)
#define PP_QUALITY_THRESH   49

-static ogg_int32_t SharpenModifier[ Q_TABLE_SIZE ] =
+static const ogg_int32_t SharpenModifier[ Q_TABLE_SIZE ] =
{  -12, -11, -10, -10,  -9,  -9,  -9,  -9,
-6,  -6,  -6,  -6,  -6,  -6,  -6,  -6,
-4,  -4,  -4,  -4,  -4,  -4,  -4,  -4,
@@ -35,7 +35,7 @@
0,  0,  0,  0,  0,  0,  0,  0
};

-static ogg_uint32_t DcQuantScaleV1[ Q_TABLE_SIZE ] = {
+static const ogg_uint32_t DcQuantScaleV1[ Q_TABLE_SIZE ] = {
22, 20, 19, 18, 17, 17, 16, 16,
15, 15, 14, 14, 13, 13, 12, 12,
11, 11, 10, 10, 9,  9,  9,  8,
@@ -46,7 +46,7 @@
2,  1,  1,  1,  1,  1,  1,  1
};

-static ogg_uint32_t *DeringModifierV1=DcQuantScaleV1;
+static const ogg_uint32_t *DeringModifierV1=DcQuantScaleV1;

static void PClearFrameInfo(PP_INSTANCE * ppi){
int i;
@@ -185,7 +185,7 @@
unsigned char *DstPtr,
ogg_int32_t Pitch,
ogg_uint32_t FragQIndex,
-                              ogg_uint32_t *QuantScale){
+                              const ogg_uint32_t *QuantScale){

ogg_int16_t UDMod[72];
ogg_int16_t LRMod[72];
@@ -311,7 +311,7 @@
unsigned char *DstPtr,
ogg_int32_t Pitch,
ogg_uint32_t FragQIndex,
-                            ogg_uint32_t *QuantScale){
+                            const ogg_uint32_t *QuantScale){

ogg_int16_t UDMod[72];
ogg_int16_t LRMod[72];
@@ -434,7 +434,7 @@
unsigned char  *SrcPtr;
unsigned char  *DestPtr;
ogg_uint32_t BlocksAcross,BlocksDown;
-  ogg_uint32_t *QuantScale;
+  const ogg_uint32_t *QuantScale;
ogg_uint32_t Block;
ogg_uint32_t LineLength;

@@ -600,7 +600,7 @@
ogg_uint32_t PlaneLineStep,
ogg_uint32_t FragsAcross,
ogg_uint32_t StartFrag,
-                             ogg_uint32_t *QuantScale){
+                             const ogg_uint32_t *QuantScale){
ogg_uint32_t j,k;
ogg_uint32_t CurrentFrag=StartFrag;
ogg_int32_t QStep;
@@ -743,7 +743,7 @@
ogg_uint32_t PlaneLineStep,
ogg_uint32_t FragsAcross,
ogg_uint32_t StartFrag,
-                                            ogg_uint32_t *QuantScale){
+                                            const ogg_uint32_t *QuantScale){
ogg_uint32_t j,k;
ogg_uint32_t CurrentFrag=StartFrag;
ogg_int32_t QStep;
@@ -818,7 +818,7 @@
unsigned char * SrcPtr=0, * DesPtr=0;
ogg_uint32_t FragsAcross=0;
ogg_uint32_t FragsDown=0;
-  ogg_uint32_t *QuantScale=0;
+  const ogg_uint32_t *QuantScale=0;

switch( Channel ){
case 0:

Modified: trunk/theora/lib/quant.c
===================================================================
--- trunk/theora/lib/quant.c	2004-07-27 05:35:49 UTC (rev 7365)
+++ trunk/theora/lib/quant.c	2004-07-27 07:04:52 UTC (rev 7366)
@@ -21,7 +21,7 @@
#include "encoder_internal.h"
#include "quant_lookup.h"

-static ogg_uint32_t QThreshTableV1[Q_TABLE_SIZE] = {
+static const ogg_uint32_t QThreshTableV1[Q_TABLE_SIZE] = {
500,  450,  400,  370,  340,  310, 285, 265,
245,  225,  210,  195,  185,  180, 170, 160,
150,  145,  135,  130,  125,  115, 110, 107,
@@ -32,7 +32,7 @@
21,   19,   18,   17,   15,   13,  12,  10
};

-static Q_LIST_ENTRY DcScaleFactorTableV1[ Q_TABLE_SIZE ] = {
+static const Q_LIST_ENTRY DcScaleFactorTableV1[ Q_TABLE_SIZE ] = {
220, 200, 190, 180, 170, 170, 160, 160,
150, 150, 140, 140, 130, 130, 120, 120,
110, 110, 100, 100, 90,  90,  90,  80,
@@ -47,7 +47,7 @@
#define NEW_QTABLES 0
#if NEW_QTABLES

-static Q_LIST_ENTRY Y_coeffsV1[64] =
+static const Q_LIST_ENTRY Y_coeffsV1[64] =
{
8,  16,  16,  16,  20,  20,  20,  20,
16,  16,  16,  16,  20,  20,  20,  20,
@@ -59,7 +59,7 @@
20,  20,  22,  22,  24,  24,  24,  24
};

-static Q_LIST_ENTRY UV_coeffsV1[64] =
+static const Q_LIST_ENTRY UV_coeffsV1[64] =
{       17,     18,     24,     47,     99,     99,     99,     99,
18,     21,     26,     66,     99,     99,     99,     99,
24,     26,     56,     99,     99,     99,     99,     99,
@@ -71,7 +71,7 @@
};

/* Different matrices for different encoder versions */
-static Q_LIST_ENTRY Inter_coeffsV1[64] =
+static const Q_LIST_ENTRY Inter_coeffsV1[64] =
{
12, 16,  16,  16,  20,  20,  20,  20,
16,  16,  16,  16,  20,  20,  20,  20,
@@ -85,7 +85,7 @@

#else /* these are the old VP3 values: */

-static Q_LIST_ENTRY Y_coeffsV1[64] ={
+static const Q_LIST_ENTRY Y_coeffsV1[64] ={
16,  11,  10,  16,  24,  40,  51,  61,
12,  12,  14,  19,  26,  58,  60,  55,
14,  13,  16,  24,  40,  57,  69,  56,
@@ -96,7 +96,7 @@
72,  92,  95,  98, 112, 100, 103,  99
};

-static Q_LIST_ENTRY UV_coeffsV1[64] ={
+static const Q_LIST_ENTRY UV_coeffsV1[64] ={
17,   18,     24,     47,     99,     99,     99,     99,
18,   21,     26,     66,     99,     99,     99,     99,
24,   26,     56,     99,     99,     99,     99,     99,
@@ -108,7 +108,7 @@
};

/* Different matrices for different encoder versions */
-static Q_LIST_ENTRY Inter_coeffsV1[64] ={
+static const Q_LIST_ENTRY Inter_coeffsV1[64] ={
16,  16,  16,  20,  24,  28,  32,  40,
16,  16,  20,  24,  28,  32,  40,  48,
16,  20,  24,  28,  32,  40,  48,  64,
@@ -359,11 +359,11 @@
double temp_fp_ZeroBinSize;
PB_INSTANCE *pbi = &cpi->pb;

-    Q_LIST_ENTRY * Inter_coeffs;
-    Q_LIST_ENTRY * Y_coeffs;
-    Q_LIST_ENTRY * UV_coeffs;
-    Q_LIST_ENTRY * DcScaleFactorTable;
-    Q_LIST_ENTRY * UVDcScaleFactorTable;
+    const Q_LIST_ENTRY * Inter_coeffs;
+    const Q_LIST_ENTRY * Y_coeffs;
+    const Q_LIST_ENTRY * UV_coeffs;
+    const Q_LIST_ENTRY * DcScaleFactorTable;
+    const Q_LIST_ENTRY * UVDcScaleFactorTable;

/* Notes on setup of quantisers.  The initial multiplication by
the scale factor is done in the ogg_int32_t domain to insure that the

Modified: trunk/theora/lib/quant_lookup.h
===================================================================
--- trunk/theora/lib/quant_lookup.h	2004-07-27 05:35:49 UTC (rev 7365)
+++ trunk/theora/lib/quant_lookup.h	2004-07-27 07:04:52 UTC (rev 7366)
@@ -25,7 +25,7 @@
#define IDCT_SCALE_FACTOR     2 /* Shift left bits to improve IDCT precision */
#define OLD_SCHEME            1

-static ogg_uint32_t dequant_index[64] = {
+static const ogg_uint32_t dequant_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,

Modified: trunk/theora/lib/toplevel_lookup.h
===================================================================
--- trunk/theora/lib/toplevel_lookup.h	2004-07-27 05:35:49 UTC (rev 7365)
+++ trunk/theora/lib/toplevel_lookup.h	2004-07-27 07:04:52 UTC (rev 7366)
@@ -17,10 +17,10 @@

#include "encoder_internal.h"

-ogg_uint32_t PriorKeyFrameWeight[KEY_FRAME_CONTEXT] = { 1,2,3,4,5 };
+const ogg_uint32_t PriorKeyFrameWeight[KEY_FRAME_CONTEXT] = { 1,2,3,4,5 };

/* Data structures controlling addition of residue blocks */
-ogg_uint32_t ResidueErrorThresh[Q_TABLE_SIZE] =  {
+const ogg_uint32_t ResidueErrorThresh[Q_TABLE_SIZE] =  {
750, 700, 650, 600, 590, 580, 570, 560,
550, 540, 530, 520, 510, 500, 490, 480,
470, 460, 450, 440, 430, 420, 410, 400,
@@ -29,7 +29,7 @@
240, 235, 230, 225, 220, 215, 210, 205,
200, 195, 190, 185, 180, 175, 170, 165,
160, 155, 150, 145, 140, 135, 130, 130 };
-ogg_uint32_t ResidueBlockFactor[Q_TABLE_SIZE] =  {
+const ogg_uint32_t ResidueBlockFactor[Q_TABLE_SIZE] =  {
3,   3,   3,   3,   3,   3,   3,   3,
3,   3,   3,   3,   3,   3,   3,   3,
3,   3,   3,   3,   3,   3,   3,   3,



More information about the commits mailing list