[xiph-cvs] cvs commit: Tremor floor_lookup.c Makefile.am bitwise.c codebook.c floor0.c floor1.c lsp_lookup.h

Monty xiphmont at xiph.org
Wed Apr 23 14:53:11 PDT 2003



xiphmont    03/04/23 17:53:11

  Modified:    .        Tag: lowmem-branch Makefile.am bitwise.c codebook.c
                        floor0.c floor1.c lsp_lookup.h
  Added:       .        Tag: lowmem-branch floor_lookup.c
  Log:
  Eliminate two small (redundant) dB lookups in floor0 and use the
  version in floor1.

Revision  Changes    Path
No                   revision

<p>No                   revision

<p>1.8.2.5   +1 -1      Tremor/Makefile.am

Index: Makefile.am
===================================================================
RCS file: /usr/local/cvsroot/Tremor/Makefile.am,v
retrieving revision 1.8.2.4
retrieving revision 1.8.2.5
diff -u -r1.8.2.4 -r1.8.2.5
--- Makefile.am	22 Apr 2003 09:00:49 -0000	1.8.2.4
+++ Makefile.am	23 Apr 2003 21:53:11 -0000	1.8.2.5
@@ -10,7 +10,7 @@
                         framing.c bitwise.c \
                         codebook.h misc.h mdct_lookup.h\
                         os.h mdct.h ivorbisfile.h lsp_lookup.h\
-                        window_lookup.h\
+                        window_lookup.h floor_lookup.c \
                         codec_internal.h ogg.h \
                         asm_arm.h ivorbiscodec.h
 libvorbisidec_la_LDFLAGS = -version-info @V_LIB_CURRENT@:@V_LIB_REVISION@:@V_LIB_AGE@

<p><p>1.4.2.2   +3 -98     Tremor/bitwise.c

Index: bitwise.c
===================================================================
RCS file: /usr/local/cvsroot/Tremor/bitwise.c,v
retrieving revision 1.4.2.1
retrieving revision 1.4.2.2
diff -u -r1.4.2.1 -r1.4.2.2
--- bitwise.c	5 Apr 2003 01:45:15 -0000	1.4.2.1
+++ bitwise.c	23 Apr 2003 21:53:11 -0000	1.4.2.2
@@ -147,27 +147,6 @@
   if((b->headend-=bits/8)<1)_span(b);
 }
 
-/* spans forward and finds next byte.  Never halts */
-static void _span_one(oggpack_buffer *b){
-  while(b->headend<1){
-    if(b->head->next){
-      b->count+=b->head->length;
-      b->head=b->head->next;
-      b->headptr=b->head->buffer->data+b->head->begin; 
-      b->headend=b->head->length;      
-    }else
-      break;
-  }
-}
-
-static int _halt_one(oggpack_buffer *b){
-  if(b->headend<1){
-    _adv_halt(b);
-    return -1;
-  }
-  return 0;
-}
-
 int oggpack_eop(oggpack_buffer *b){
   if(b->headend<0)return -1;
   return 0;
@@ -175,83 +154,9 @@
 
 /* bits <= 32 */
 long oggpack_read(oggpack_buffer *b,int bits){
-  unsigned long m=mask[bits];
-  ogg_uint32_t ret;
-
-  bits+=b->headbit;
-
-  if(bits >= b->headend<<3){
-
-    if(b->headend<0)return -1;
-    
-    if(bits){
-      if (_halt_one(b)) return -1;
-      ret=*b->headptr>>b->headbit;
-      
-      if(bits>=8){
-        ++b->headptr;
-        --b->headend;
-        _span_one(b);
-        if(bits>8){
-          if (_halt_one(b)) return -1;
-          ret|=*b->headptr<<(8-b->headbit);   
-          
-          if(bits>=16){
-            ++b->headptr;
-            --b->headend;
-            _span_one(b);
-            if(bits>16){
-              if (_halt_one(b)) return -1;
-              ret|=*b->headptr<<(16-b->headbit);  
-              
-              if(bits>=24){
-                ++b->headptr;
-                --b->headend;
-                _span_one(b);
-                if(bits>24){
-                  if (_halt_one(b)) return -1;
-                  ret|=*b->headptr<<(24-b->headbit);
-                  
-                  if(bits>=32){
-                    ++b->headptr;
-                    --b->headend;
-                    _span_one(b);
-                    if(bits>32){
-                      if (_halt_one(b)) return -1;
-                      if(b->headbit)ret|=*b->headptr<<(32-b->headbit);
-                      
-                    }
-                  }
-                }
-              }
-            }
-          }
-        }
-      }
-    }
-  }else{
-  
-    ret=b->headptr[0]>>b->headbit;
-    if(bits>8){
-      ret|=b->headptr[1]<<(8-b->headbit);  
-      if(bits>16){
-        ret|=b->headptr[2]<<(16-b->headbit);  
-        if(bits>24){
-          ret|=b->headptr[3]<<(24-b->headbit);  
-          if(bits>32 && b->headbit){
-            ret|=b->headptr[4]<<(32-b->headbit);
-          }
-        }
-      }
-    }
-    
-    b->headptr+=bits/8;
-    b->headend-=bits/8;
-  }
-
-  ret&=m;
-  b->headbit=bits&7;   
-  return ret;
+  long ret=oggpack_look(b,bits);
+  oggpack_adv(b,bits);
+  return(ret);
 }
 
 long oggpack_bytes(oggpack_buffer *b){

<p><p>1.2.6.6   +0 -6      Tremor/codebook.c

Index: codebook.c
===================================================================
RCS file: /usr/local/cvsroot/Tremor/codebook.c,v
retrieving revision 1.2.6.5
retrieving revision 1.2.6.6
diff -u -r1.2.6.5 -r1.2.6.6
--- codebook.c	10 Apr 2003 12:03:13 -0000	1.2.6.5
+++ codebook.c	23 Apr 2003 21:53:11 -0000	1.2.6.6
@@ -15,7 +15,6 @@
 
  ********************************************************************/
 
-#include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
 #include <math.h>
@@ -529,11 +528,6 @@
   }
 
   if(oggpack_eop(opb))goto _eofout;
-  
-  fprintf(stderr,"%d/%d x%d b%d dec_type%d (%d/%d)\n",
-	  s->used_entries,s->entries,s->dim,s->q_bits,s->dec_type,
-	  s->dec_nodeb*8,s->dec_nodeb*s->dec_leafw*8);
-  
 
   return 0;
  _errout:

<p><p>1.4.6.8   +17 -0     Tremor/floor0.c

Index: floor0.c
===================================================================
RCS file: /usr/local/cvsroot/Tremor/floor0.c,v
retrieving revision 1.4.6.7
retrieving revision 1.4.6.8
diff -u -r1.4.6.7 -r1.4.6.8
--- floor0.c	22 Apr 2003 09:00:49 -0000	1.4.6.7
+++ floor0.c	23 Apr 2003 21:53:11 -0000	1.4.6.8
@@ -26,6 +26,7 @@
 #include "os.h"
 
 #define LSP_FRACBITS 14
+extern const ogg_int32_t FLOOR_fromdB_LOOKUP[];
 
 /*************** LSP decode ********************/
 
@@ -48,6 +49,21 @@
 
 /* interpolated lookup based fromdB function, domain -140dB to 0dB only */
 /* a is in n.12 format */
+#ifdef _LOW_ACCURACY_
+static inline ogg_int32_t vorbis_fromdBlook_i(long a){
+  if(a>0) return 0x7fffffff;
+  if(a<(-140<<12)) return 0;
+  return FLOOR_fromdB_LOOKUP[((a+140)*467)>>20]<<9;
+}
+#else
+static inline ogg_int32_t vorbis_fromdBlook_i(long a){
+  if(a>0) return 0x7fffffff;
+  if(a<(-140<<12)) return 0;
+  return FLOOR_fromdB_LOOKUP[((a+(140<<12))*467)>>20];
+}
+#endif
+
+#if 0
 static inline ogg_int32_t vorbis_fromdBlook_i(long a){
   int i=(-a)>>(12-FROMdB2_SHIFT);
   if(i<0) return 0x7fffffff;
@@ -55,6 +71,7 @@
   
   return FROMdB_LOOKUP[i>>FROMdB_SHIFT] * FROMdB2_LOOKUP[i&FROMdB2_MASK];
 }
+#endif
 
 /* interpolated lookup based cos function, domain 0 to PI only */
 /* a is in 0.16 format, where 0==0, 2^^16-1==PI, return 0.14 */

<p><p>1.6.6.9   +2 -74     Tremor/floor1.c

Index: floor1.c
===================================================================
RCS file: /usr/local/cvsroot/Tremor/floor1.c,v
retrieving revision 1.6.6.8
retrieving revision 1.6.6.9
diff -u -r1.6.6.8 -r1.6.6.9
--- floor1.c	22 Apr 2003 09:13:32 -0000	1.6.6.8
+++ floor1.c	23 Apr 2003 21:53:11 -0000	1.6.6.9
@@ -24,6 +24,7 @@
 #include "codebook.h"
 #include "misc.h"
 
+extern const ogg_int32_t FLOOR_fromdB_LOOKUP[];
 #define floor1_rangedB 140 /* floor 1 fixed at -140dB to 0dB range */
 #define VIF_POSIT 63
 
@@ -60,7 +61,7 @@
   codec_setup_info     *ci=(codec_setup_info *)vi->codec_setup;
   int j,k,count=0,maxclass=-1,rangebits;
   ogg_uint16_t *sortpointer[VIF_POSIT+2];
-
+  
   vorbis_info_floor1 *info=(vorbis_info_floor1 *)_ogg_calloc(1,sizeof(*info));
   /* read partitions */
   info->partitions=oggpack_read(opb,5); /* only 0 to 31 legal */
@@ -170,79 +171,6 @@
   }
 }
 
-#ifdef _LOW_ACCURACY_
-#  define XdB(n) ((((n)>>8)+1)>>1)
-#else
-#  define XdB(n) (n)
-#endif
-
-static const ogg_int32_t FLOOR_fromdB_LOOKUP[256]={
-  XdB(0x000000e5), XdB(0x000000f4), XdB(0x00000103), XdB(0x00000114),
-  XdB(0x00000126), XdB(0x00000139), XdB(0x0000014e), XdB(0x00000163),
-  XdB(0x0000017a), XdB(0x00000193), XdB(0x000001ad), XdB(0x000001c9),
-  XdB(0x000001e7), XdB(0x00000206), XdB(0x00000228), XdB(0x0000024c),
-  XdB(0x00000272), XdB(0x0000029b), XdB(0x000002c6), XdB(0x000002f4),
-  XdB(0x00000326), XdB(0x0000035a), XdB(0x00000392), XdB(0x000003cd),
-  XdB(0x0000040c), XdB(0x00000450), XdB(0x00000497), XdB(0x000004e4),
-  XdB(0x00000535), XdB(0x0000058c), XdB(0x000005e8), XdB(0x0000064a),
-  XdB(0x000006b3), XdB(0x00000722), XdB(0x00000799), XdB(0x00000818),
-  XdB(0x0000089e), XdB(0x0000092e), XdB(0x000009c6), XdB(0x00000a69),
-  XdB(0x00000b16), XdB(0x00000bcf), XdB(0x00000c93), XdB(0x00000d64),
-  XdB(0x00000e43), XdB(0x00000f30), XdB(0x0000102d), XdB(0x0000113a),
-  XdB(0x00001258), XdB(0x0000138a), XdB(0x000014cf), XdB(0x00001629),
-  XdB(0x0000179a), XdB(0x00001922), XdB(0x00001ac4), XdB(0x00001c82),
-  XdB(0x00001e5c), XdB(0x00002055), XdB(0x0000226f), XdB(0x000024ac),
-  XdB(0x0000270e), XdB(0x00002997), XdB(0x00002c4b), XdB(0x00002f2c),
-  XdB(0x0000323d), XdB(0x00003581), XdB(0x000038fb), XdB(0x00003caf),
-  XdB(0x000040a0), XdB(0x000044d3), XdB(0x0000494c), XdB(0x00004e10),
-  XdB(0x00005323), XdB(0x0000588a), XdB(0x00005e4b), XdB(0x0000646b),
-  XdB(0x00006af2), XdB(0x000071e5), XdB(0x0000794c), XdB(0x0000812e),
-  XdB(0x00008993), XdB(0x00009283), XdB(0x00009c09), XdB(0x0000a62d),
-  XdB(0x0000b0f9), XdB(0x0000bc79), XdB(0x0000c8b9), XdB(0x0000d5c4),
-  XdB(0x0000e3a9), XdB(0x0000f274), XdB(0x00010235), XdB(0x000112fd),
-  XdB(0x000124dc), XdB(0x000137e4), XdB(0x00014c29), XdB(0x000161bf),
-  XdB(0x000178bc), XdB(0x00019137), XdB(0x0001ab4a), XdB(0x0001c70e),
-  XdB(0x0001e4a1), XdB(0x0002041f), XdB(0x000225aa), XdB(0x00024962),
-  XdB(0x00026f6d), XdB(0x000297f0), XdB(0x0002c316), XdB(0x0002f109),
-  XdB(0x000321f9), XdB(0x00035616), XdB(0x00038d97), XdB(0x0003c8b4),
-  XdB(0x000407a7), XdB(0x00044ab2), XdB(0x00049218), XdB(0x0004de23),
-  XdB(0x00052f1e), XdB(0x0005855c), XdB(0x0005e135), XdB(0x00064306),
-  XdB(0x0006ab33), XdB(0x00071a24), XdB(0x0007904b), XdB(0x00080e20),
-  XdB(0x00089422), XdB(0x000922da), XdB(0x0009bad8), XdB(0x000a5cb6),
-  XdB(0x000b091a), XdB(0x000bc0b1), XdB(0x000c8436), XdB(0x000d5471),
-  XdB(0x000e3233), XdB(0x000f1e5f), XdB(0x001019e4), XdB(0x001125c1),
-  XdB(0x00124306), XdB(0x001372d5), XdB(0x0014b663), XdB(0x00160ef7),
-  XdB(0x00177df0), XdB(0x001904c1), XdB(0x001aa4f9), XdB(0x001c603d),
-  XdB(0x001e384f), XdB(0x00202f0f), XdB(0x0022467a), XdB(0x002480b1),
-  XdB(0x0026dff7), XdB(0x002966b3), XdB(0x002c1776), XdB(0x002ef4fc),
-  XdB(0x0032022d), XdB(0x00354222), XdB(0x0038b828), XdB(0x003c67c2),
-  XdB(0x004054ae), XdB(0x004482e8), XdB(0x0048f6af), XdB(0x004db488),
-  XdB(0x0052c142), XdB(0x005821ff), XdB(0x005ddc33), XdB(0x0063f5b0),
-  XdB(0x006a74a7), XdB(0x00715faf), XdB(0x0078bdce), XdB(0x0080967f),
-  XdB(0x0088f1ba), XdB(0x0091d7f9), XdB(0x009b5247), XdB(0x00a56a41),
-  XdB(0x00b02a27), XdB(0x00bb9ce2), XdB(0x00c7ce12), XdB(0x00d4ca17),
-  XdB(0x00e29e20), XdB(0x00f15835), XdB(0x0101074b), XdB(0x0111bb4e),
-  XdB(0x01238531), XdB(0x01367704), XdB(0x014aa402), XdB(0x016020a7),
-  XdB(0x017702c3), XdB(0x018f6190), XdB(0x01a955cb), XdB(0x01c4f9cf),
-  XdB(0x01e269a8), XdB(0x0201c33b), XdB(0x0223265a), XdB(0x0246b4ea),
-  XdB(0x026c9302), XdB(0x0294e716), XdB(0x02bfda13), XdB(0x02ed9793),
-  XdB(0x031e4e09), XdB(0x03522ee4), XdB(0x03896ed0), XdB(0x03c445e2),
-  XdB(0x0402efd6), XdB(0x0445ac4b), XdB(0x048cbefc), XdB(0x04d87013),
-  XdB(0x05290c67), XdB(0x057ee5ca), XdB(0x05da5364), XdB(0x063bb204),
-  XdB(0x06a36485), XdB(0x0711d42b), XdB(0x0787710e), XdB(0x0804b299),
-  XdB(0x088a17ef), XdB(0x0918287e), XdB(0x09af747c), XdB(0x0a50957e),
-  XdB(0x0afc2f19), XdB(0x0bb2ef7f), XdB(0x0c759034), XdB(0x0d44d6ca),
-  XdB(0x0e2195bc), XdB(0x0f0cad0d), XdB(0x10070b62), XdB(0x1111aeea),
-  XdB(0x122da66c), XdB(0x135c120f), XdB(0x149e24d9), XdB(0x15f525b1),
-  XdB(0x176270e3), XdB(0x18e7794b), XdB(0x1a85c9ae), XdB(0x1c3f06d1),
-  XdB(0x1e14f07d), XdB(0x200963d7), XdB(0x221e5ccd), XdB(0x2455f870),
-  XdB(0x26b2770b), XdB(0x29363e2b), XdB(0x2be3db5c), XdB(0x2ebe06b6),
-  XdB(0x31c7a55b), XdB(0x3503ccd4), XdB(0x3875c5aa), XdB(0x3c210f44),
-  XdB(0x4009632b), XdB(0x4432b8cf), XdB(0x48a149bc), XdB(0x4d59959e),
-  XdB(0x52606733), XdB(0x57bad899), XdB(0x5d6e593a), XdB(0x6380b298),
-  XdB(0x69f80e9a), XdB(0x70dafda8), XdB(0x78307d76), XdB(0x7fffffff),
-};
-  
 static void render_line(int x0,int x1,int y0,int y1,ogg_int32_t *d){
   int dy=y1-y0;
   int adx=x1-x0;

<p><p>1.3.6.1   +0 -28     Tremor/lsp_lookup.h

Index: lsp_lookup.h
===================================================================
RCS file: /usr/local/cvsroot/Tremor/lsp_lookup.h,v
retrieving revision 1.3
retrieving revision 1.3.6.1
diff -u -r1.3 -r1.3.6.1
--- lsp_lookup.h	16 Oct 2002 08:10:08 -0000	1.3
+++ lsp_lookup.h	23 Apr 2003 21:53:11 -0000	1.3.6.1
@@ -20,34 +20,6 @@
 
 #include "os_types.h"
 
-#define FROMdB_LOOKUP_SZ 35
-#define FROMdB2_LOOKUP_SZ 32
-#define FROMdB_SHIFT 5
-#define FROMdB2_SHIFT 3
-#define FROMdB2_MASK 31
-
-static const ogg_int32_t FROMdB_LOOKUP[FROMdB_LOOKUP_SZ]={
-  0x003fffff, 0x0028619b, 0x00197a96, 0x0010137a,
-  0x000a24b0, 0x00066666, 0x000409c3, 0x00028c42,
-  0x00019b8c, 0x000103ab, 0x0000a3d7, 0x00006760,
-  0x0000413a, 0x00002928, 0x000019f8, 0x00001062,
-  0x00000a56, 0x00000686, 0x0000041e, 0x00000299,
-  0x000001a3, 0x00000109, 0x000000a7, 0x00000069,
-  0x00000042, 0x0000002a, 0x0000001a, 0x00000011,
-  0x0000000b, 0x00000007, 0x00000004, 0x00000003,
-  0x00000002, 0x00000001, 0x00000001};
-
-static const ogg_int32_t FROMdB2_LOOKUP[FROMdB2_LOOKUP_SZ]={
-  0x000001fc, 0x000001f5, 0x000001ee, 0x000001e7,
-  0x000001e0, 0x000001d9, 0x000001d2, 0x000001cc,
-  0x000001c5, 0x000001bf, 0x000001b8, 0x000001b2,
-  0x000001ac, 0x000001a6, 0x000001a0, 0x0000019a,
-  0x00000194, 0x0000018e, 0x00000188, 0x00000183,
-  0x0000017d, 0x00000178, 0x00000172, 0x0000016d,
-  0x00000168, 0x00000163, 0x0000015e, 0x00000159,
-  0x00000154, 0x0000014f, 0x0000014a, 0x00000145,
-};
-
 #define INVSQ_LOOKUP_I_SHIFT 10
 #define INVSQ_LOOKUP_I_MASK 1023
 static const long INVSQ_LOOKUP_I[64+1]={

<p><p>No                   revision

<p>No                   revision

<p>1.1.2.1   +92 -0     Tremor/Attic/floor_lookup.c

<p><p><p>--- >8 ----
List archives:  http://www.xiph.org/archives/
Ogg project homepage: http://www.xiph.org/ogg/
To unsubscribe from this list, send a message to 'cvs-request at xiph.org'
containing only the word 'unsubscribe' in the body.  No subject is needed.
Unsubscribe messages sent to the list will be ignored/filtered.



More information about the commits mailing list