author | nemo |
Fri, 02 Nov 2012 18:50:03 -0400 | |
branch | 0.9.18 |
changeset 7936 | 9f44e39d856c |
parent 7849 | a12155461b34 |
permissions | -rw-r--r-- |
5170
f7e49eff3708
add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff
changeset
|
1 |
/******************************************************************** |
f7e49eff3708
add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff
changeset
|
2 |
* * |
f7e49eff3708
add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff
changeset
|
3 |
* THIS FILE IS PART OF THE OggVorbis 'TREMOR' CODEC SOURCE CODE. * |
f7e49eff3708
add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff
changeset
|
4 |
* * |
f7e49eff3708
add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff
changeset
|
5 |
* USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS * |
f7e49eff3708
add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff
changeset
|
6 |
* GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE * |
f7e49eff3708
add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff
changeset
|
7 |
* IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * |
f7e49eff3708
add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff
changeset
|
8 |
* * |
7849
a12155461b34
revert r767d3c4153a1 this tremor implementation is buggy
koda
parents:
7697
diff
changeset
|
9 |
* THE OggVorbis 'TREMOR' SOURCE CODE IS (C) COPYRIGHT 1994-2002 * |
5170
f7e49eff3708
add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff
changeset
|
10 |
* BY THE Xiph.Org FOUNDATION http://www.xiph.org/ * |
f7e49eff3708
add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff
changeset
|
11 |
* * |
f7e49eff3708
add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff
changeset
|
12 |
******************************************************************** |
f7e49eff3708
add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff
changeset
|
13 |
|
f7e49eff3708
add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff
changeset
|
14 |
function: residue backend 0, 1 and 2 implementation |
f7e49eff3708
add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff
changeset
|
15 |
|
f7e49eff3708
add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff
changeset
|
16 |
********************************************************************/ |
f7e49eff3708
add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff
changeset
|
17 |
|
f7e49eff3708
add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff
changeset
|
18 |
#include <stdlib.h> |
f7e49eff3708
add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff
changeset
|
19 |
#include <string.h> |
f7e49eff3708
add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff
changeset
|
20 |
#include <math.h> |
f7e49eff3708
add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff
changeset
|
21 |
#include "ogg.h" |
f7e49eff3708
add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff
changeset
|
22 |
#include "ivorbiscodec.h" |
f7e49eff3708
add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff
changeset
|
23 |
#include "codec_internal.h" |
7849
a12155461b34
revert r767d3c4153a1 this tremor implementation is buggy
koda
parents:
7697
diff
changeset
|
24 |
#include "registry.h" |
5170
f7e49eff3708
add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff
changeset
|
25 |
#include "codebook.h" |
f7e49eff3708
add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff
changeset
|
26 |
#include "misc.h" |
f7e49eff3708
add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff
changeset
|
27 |
#include "os.h" |
7849
a12155461b34
revert r767d3c4153a1 this tremor implementation is buggy
koda
parents:
7697
diff
changeset
|
28 |
#include "block.h" |
5170
f7e49eff3708
add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff
changeset
|
29 |
|
7849
a12155461b34
revert r767d3c4153a1 this tremor implementation is buggy
koda
parents:
7697
diff
changeset
|
30 |
typedef struct { |
a12155461b34
revert r767d3c4153a1 this tremor implementation is buggy
koda
parents:
7697
diff
changeset
|
31 |
vorbis_info_residue0 *info; |
a12155461b34
revert r767d3c4153a1 this tremor implementation is buggy
koda
parents:
7697
diff
changeset
|
32 |
int map; |
a12155461b34
revert r767d3c4153a1 this tremor implementation is buggy
koda
parents:
7697
diff
changeset
|
33 |
|
a12155461b34
revert r767d3c4153a1 this tremor implementation is buggy
koda
parents:
7697
diff
changeset
|
34 |
int parts; |
a12155461b34
revert r767d3c4153a1 this tremor implementation is buggy
koda
parents:
7697
diff
changeset
|
35 |
int stages; |
a12155461b34
revert r767d3c4153a1 this tremor implementation is buggy
koda
parents:
7697
diff
changeset
|
36 |
codebook *fullbooks; |
a12155461b34
revert r767d3c4153a1 this tremor implementation is buggy
koda
parents:
7697
diff
changeset
|
37 |
codebook *phrasebook; |
a12155461b34
revert r767d3c4153a1 this tremor implementation is buggy
koda
parents:
7697
diff
changeset
|
38 |
codebook ***partbooks; |
a12155461b34
revert r767d3c4153a1 this tremor implementation is buggy
koda
parents:
7697
diff
changeset
|
39 |
|
a12155461b34
revert r767d3c4153a1 this tremor implementation is buggy
koda
parents:
7697
diff
changeset
|
40 |
int partvals; |
a12155461b34
revert r767d3c4153a1 this tremor implementation is buggy
koda
parents:
7697
diff
changeset
|
41 |
int **decodemap; |
a12155461b34
revert r767d3c4153a1 this tremor implementation is buggy
koda
parents:
7697
diff
changeset
|
42 |
|
a12155461b34
revert r767d3c4153a1 this tremor implementation is buggy
koda
parents:
7697
diff
changeset
|
43 |
} vorbis_look_residue0; |
a12155461b34
revert r767d3c4153a1 this tremor implementation is buggy
koda
parents:
7697
diff
changeset
|
44 |
|
a12155461b34
revert r767d3c4153a1 this tremor implementation is buggy
koda
parents:
7697
diff
changeset
|
45 |
void res0_free_info(vorbis_info_residue *i){ |
a12155461b34
revert r767d3c4153a1 this tremor implementation is buggy
koda
parents:
7697
diff
changeset
|
46 |
vorbis_info_residue0 *info=(vorbis_info_residue0 *)i; |
5170
f7e49eff3708
add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff
changeset
|
47 |
if(info){ |
f7e49eff3708
add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff
changeset
|
48 |
memset(info,0,sizeof(*info)); |
7849
a12155461b34
revert r767d3c4153a1 this tremor implementation is buggy
koda
parents:
7697
diff
changeset
|
49 |
_ogg_free(info); |
a12155461b34
revert r767d3c4153a1 this tremor implementation is buggy
koda
parents:
7697
diff
changeset
|
50 |
} |
a12155461b34
revert r767d3c4153a1 this tremor implementation is buggy
koda
parents:
7697
diff
changeset
|
51 |
} |
a12155461b34
revert r767d3c4153a1 this tremor implementation is buggy
koda
parents:
7697
diff
changeset
|
52 |
|
a12155461b34
revert r767d3c4153a1 this tremor implementation is buggy
koda
parents:
7697
diff
changeset
|
53 |
void res0_free_look(vorbis_look_residue *i){ |
a12155461b34
revert r767d3c4153a1 this tremor implementation is buggy
koda
parents:
7697
diff
changeset
|
54 |
int j; |
a12155461b34
revert r767d3c4153a1 this tremor implementation is buggy
koda
parents:
7697
diff
changeset
|
55 |
if(i){ |
a12155461b34
revert r767d3c4153a1 this tremor implementation is buggy
koda
parents:
7697
diff
changeset
|
56 |
|
a12155461b34
revert r767d3c4153a1 this tremor implementation is buggy
koda
parents:
7697
diff
changeset
|
57 |
vorbis_look_residue0 *look=(vorbis_look_residue0 *)i; |
a12155461b34
revert r767d3c4153a1 this tremor implementation is buggy
koda
parents:
7697
diff
changeset
|
58 |
|
a12155461b34
revert r767d3c4153a1 this tremor implementation is buggy
koda
parents:
7697
diff
changeset
|
59 |
for(j=0;j<look->parts;j++) |
a12155461b34
revert r767d3c4153a1 this tremor implementation is buggy
koda
parents:
7697
diff
changeset
|
60 |
if(look->partbooks[j])_ogg_free(look->partbooks[j]); |
a12155461b34
revert r767d3c4153a1 this tremor implementation is buggy
koda
parents:
7697
diff
changeset
|
61 |
_ogg_free(look->partbooks); |
a12155461b34
revert r767d3c4153a1 this tremor implementation is buggy
koda
parents:
7697
diff
changeset
|
62 |
for(j=0;j<look->partvals;j++) |
a12155461b34
revert r767d3c4153a1 this tremor implementation is buggy
koda
parents:
7697
diff
changeset
|
63 |
_ogg_free(look->decodemap[j]); |
a12155461b34
revert r767d3c4153a1 this tremor implementation is buggy
koda
parents:
7697
diff
changeset
|
64 |
_ogg_free(look->decodemap); |
a12155461b34
revert r767d3c4153a1 this tremor implementation is buggy
koda
parents:
7697
diff
changeset
|
65 |
|
a12155461b34
revert r767d3c4153a1 this tremor implementation is buggy
koda
parents:
7697
diff
changeset
|
66 |
memset(look,0,sizeof(*look)); |
a12155461b34
revert r767d3c4153a1 this tremor implementation is buggy
koda
parents:
7697
diff
changeset
|
67 |
_ogg_free(look); |
5170
f7e49eff3708
add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff
changeset
|
68 |
} |
f7e49eff3708
add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff
changeset
|
69 |
} |
f7e49eff3708
add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff
changeset
|
70 |
|
f7e49eff3708
add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff
changeset
|
71 |
static int ilog(unsigned int v){ |
f7e49eff3708
add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff
changeset
|
72 |
int ret=0; |
f7e49eff3708
add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff
changeset
|
73 |
while(v){ |
f7e49eff3708
add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff
changeset
|
74 |
ret++; |
f7e49eff3708
add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff
changeset
|
75 |
v>>=1; |
f7e49eff3708
add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff
changeset
|
76 |
} |
f7e49eff3708
add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff
changeset
|
77 |
return(ret); |
f7e49eff3708
add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff
changeset
|
78 |
} |
f7e49eff3708
add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff
changeset
|
79 |
|
7849
a12155461b34
revert r767d3c4153a1 this tremor implementation is buggy
koda
parents:
7697
diff
changeset
|
80 |
static int icount(unsigned int v){ |
a12155461b34
revert r767d3c4153a1 this tremor implementation is buggy
koda
parents:
7697
diff
changeset
|
81 |
int ret=0; |
a12155461b34
revert r767d3c4153a1 this tremor implementation is buggy
koda
parents:
7697
diff
changeset
|
82 |
while(v){ |
a12155461b34
revert r767d3c4153a1 this tremor implementation is buggy
koda
parents:
7697
diff
changeset
|
83 |
ret+=v&1; |
a12155461b34
revert r767d3c4153a1 this tremor implementation is buggy
koda
parents:
7697
diff
changeset
|
84 |
v>>=1; |
a12155461b34
revert r767d3c4153a1 this tremor implementation is buggy
koda
parents:
7697
diff
changeset
|
85 |
} |
a12155461b34
revert r767d3c4153a1 this tremor implementation is buggy
koda
parents:
7697
diff
changeset
|
86 |
return(ret); |
a12155461b34
revert r767d3c4153a1 this tremor implementation is buggy
koda
parents:
7697
diff
changeset
|
87 |
} |
a12155461b34
revert r767d3c4153a1 this tremor implementation is buggy
koda
parents:
7697
diff
changeset
|
88 |
|
7697
767d3c4153a1
switch the Tremor implementation from the Cocos2D one to the lowmem-no-byte branch and let's see what happens
koda
parents:
6045
diff
changeset
|
89 |
/* vorbis_info is for range checking */ |
7849
a12155461b34
revert r767d3c4153a1 this tremor implementation is buggy
koda
parents:
7697
diff
changeset
|
90 |
vorbis_info_residue *res0_unpack(vorbis_info *vi,oggpack_buffer *opb){ |
a12155461b34
revert r767d3c4153a1 this tremor implementation is buggy
koda
parents:
7697
diff
changeset
|
91 |
int j,acc=0; |
a12155461b34
revert r767d3c4153a1 this tremor implementation is buggy
koda
parents:
7697
diff
changeset
|
92 |
vorbis_info_residue0 *info=(vorbis_info_residue0 *)_ogg_calloc(1,sizeof(*info)); |
7697
767d3c4153a1
switch the Tremor implementation from the Cocos2D one to the lowmem-no-byte branch and let's see what happens
koda
parents:
6045
diff
changeset
|
93 |
codec_setup_info *ci=(codec_setup_info *)vi->codec_setup; |
5170
f7e49eff3708
add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff
changeset
|
94 |
|
f7e49eff3708
add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff
changeset
|
95 |
info->begin=oggpack_read(opb,24); |
f7e49eff3708
add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff
changeset
|
96 |
info->end=oggpack_read(opb,24); |
f7e49eff3708
add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff
changeset
|
97 |
info->grouping=oggpack_read(opb,24)+1; |
f7e49eff3708
add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff
changeset
|
98 |
info->partitions=oggpack_read(opb,6)+1; |
f7e49eff3708
add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff
changeset
|
99 |
info->groupbook=oggpack_read(opb,8); |
f7e49eff3708
add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff
changeset
|
100 |
|
f7e49eff3708
add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff
changeset
|
101 |
for(j=0;j<info->partitions;j++){ |
f7e49eff3708
add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff
changeset
|
102 |
int cascade=oggpack_read(opb,3); |
f7e49eff3708
add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff
changeset
|
103 |
if(oggpack_read(opb,1)) |
f7e49eff3708
add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff
changeset
|
104 |
cascade|=(oggpack_read(opb,5)<<3); |
7849
a12155461b34
revert r767d3c4153a1 this tremor implementation is buggy
koda
parents:
7697
diff
changeset
|
105 |
info->secondstages[j]=cascade; |
a12155461b34
revert r767d3c4153a1 this tremor implementation is buggy
koda
parents:
7697
diff
changeset
|
106 |
|
a12155461b34
revert r767d3c4153a1 this tremor implementation is buggy
koda
parents:
7697
diff
changeset
|
107 |
acc+=icount(cascade); |
5170
f7e49eff3708
add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff
changeset
|
108 |
} |
7849
a12155461b34
revert r767d3c4153a1 this tremor implementation is buggy
koda
parents:
7697
diff
changeset
|
109 |
for(j=0;j<acc;j++) |
a12155461b34
revert r767d3c4153a1 this tremor implementation is buggy
koda
parents:
7697
diff
changeset
|
110 |
info->booklist[j]=oggpack_read(opb,8); |
a12155461b34
revert r767d3c4153a1 this tremor implementation is buggy
koda
parents:
7697
diff
changeset
|
111 |
|
a12155461b34
revert r767d3c4153a1 this tremor implementation is buggy
koda
parents:
7697
diff
changeset
|
112 |
if(info->groupbook>=ci->books)goto errout; |
a12155461b34
revert r767d3c4153a1 this tremor implementation is buggy
koda
parents:
7697
diff
changeset
|
113 |
for(j=0;j<acc;j++) |
a12155461b34
revert r767d3c4153a1 this tremor implementation is buggy
koda
parents:
7697
diff
changeset
|
114 |
if(info->booklist[j]>=ci->books)goto errout; |
a12155461b34
revert r767d3c4153a1 this tremor implementation is buggy
koda
parents:
7697
diff
changeset
|
115 |
|
a12155461b34
revert r767d3c4153a1 this tremor implementation is buggy
koda
parents:
7697
diff
changeset
|
116 |
return(info); |
a12155461b34
revert r767d3c4153a1 this tremor implementation is buggy
koda
parents:
7697
diff
changeset
|
117 |
errout: |
a12155461b34
revert r767d3c4153a1 this tremor implementation is buggy
koda
parents:
7697
diff
changeset
|
118 |
res0_free_info(info); |
a12155461b34
revert r767d3c4153a1 this tremor implementation is buggy
koda
parents:
7697
diff
changeset
|
119 |
return(NULL); |
a12155461b34
revert r767d3c4153a1 this tremor implementation is buggy
koda
parents:
7697
diff
changeset
|
120 |
} |
a12155461b34
revert r767d3c4153a1 this tremor implementation is buggy
koda
parents:
7697
diff
changeset
|
121 |
|
a12155461b34
revert r767d3c4153a1 this tremor implementation is buggy
koda
parents:
7697
diff
changeset
|
122 |
vorbis_look_residue *res0_look(vorbis_dsp_state *vd,vorbis_info_mode *vm, |
a12155461b34
revert r767d3c4153a1 this tremor implementation is buggy
koda
parents:
7697
diff
changeset
|
123 |
vorbis_info_residue *vr){ |
a12155461b34
revert r767d3c4153a1 this tremor implementation is buggy
koda
parents:
7697
diff
changeset
|
124 |
vorbis_info_residue0 *info=(vorbis_info_residue0 *)vr; |
a12155461b34
revert r767d3c4153a1 this tremor implementation is buggy
koda
parents:
7697
diff
changeset
|
125 |
vorbis_look_residue0 *look=(vorbis_look_residue0 *)_ogg_calloc(1,sizeof(*look)); |
a12155461b34
revert r767d3c4153a1 this tremor implementation is buggy
koda
parents:
7697
diff
changeset
|
126 |
codec_setup_info *ci=(codec_setup_info *)vd->vi->codec_setup; |
5170
f7e49eff3708
add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff
changeset
|
127 |
|
7849
a12155461b34
revert r767d3c4153a1 this tremor implementation is buggy
koda
parents:
7697
diff
changeset
|
128 |
int j,k,acc=0; |
a12155461b34
revert r767d3c4153a1 this tremor implementation is buggy
koda
parents:
7697
diff
changeset
|
129 |
int dim; |
a12155461b34
revert r767d3c4153a1 this tremor implementation is buggy
koda
parents:
7697
diff
changeset
|
130 |
int maxstage=0; |
a12155461b34
revert r767d3c4153a1 this tremor implementation is buggy
koda
parents:
7697
diff
changeset
|
131 |
look->info=info; |
a12155461b34
revert r767d3c4153a1 this tremor implementation is buggy
koda
parents:
7697
diff
changeset
|
132 |
look->map=vm->mapping; |
a12155461b34
revert r767d3c4153a1 this tremor implementation is buggy
koda
parents:
7697
diff
changeset
|
133 |
|
a12155461b34
revert r767d3c4153a1 this tremor implementation is buggy
koda
parents:
7697
diff
changeset
|
134 |
look->parts=info->partitions; |
a12155461b34
revert r767d3c4153a1 this tremor implementation is buggy
koda
parents:
7697
diff
changeset
|
135 |
look->fullbooks=ci->fullbooks; |
a12155461b34
revert r767d3c4153a1 this tremor implementation is buggy
koda
parents:
7697
diff
changeset
|
136 |
look->phrasebook=ci->fullbooks+info->groupbook; |
a12155461b34
revert r767d3c4153a1 this tremor implementation is buggy
koda
parents:
7697
diff
changeset
|
137 |
dim=look->phrasebook->dim; |
a12155461b34
revert r767d3c4153a1 this tremor implementation is buggy
koda
parents:
7697
diff
changeset
|
138 |
|
a12155461b34
revert r767d3c4153a1 this tremor implementation is buggy
koda
parents:
7697
diff
changeset
|
139 |
look->partbooks=(codebook ***)_ogg_calloc(look->parts,sizeof(*look->partbooks)); |
a12155461b34
revert r767d3c4153a1 this tremor implementation is buggy
koda
parents:
7697
diff
changeset
|
140 |
|
a12155461b34
revert r767d3c4153a1 this tremor implementation is buggy
koda
parents:
7697
diff
changeset
|
141 |
for(j=0;j<look->parts;j++){ |
a12155461b34
revert r767d3c4153a1 this tremor implementation is buggy
koda
parents:
7697
diff
changeset
|
142 |
int stages=ilog(info->secondstages[j]); |
a12155461b34
revert r767d3c4153a1 this tremor implementation is buggy
koda
parents:
7697
diff
changeset
|
143 |
if(stages){ |
a12155461b34
revert r767d3c4153a1 this tremor implementation is buggy
koda
parents:
7697
diff
changeset
|
144 |
if(stages>maxstage)maxstage=stages; |
a12155461b34
revert r767d3c4153a1 this tremor implementation is buggy
koda
parents:
7697
diff
changeset
|
145 |
look->partbooks[j]=(codebook **)_ogg_calloc(stages,sizeof(*look->partbooks[j])); |
a12155461b34
revert r767d3c4153a1 this tremor implementation is buggy
koda
parents:
7697
diff
changeset
|
146 |
for(k=0;k<stages;k++) |
a12155461b34
revert r767d3c4153a1 this tremor implementation is buggy
koda
parents:
7697
diff
changeset
|
147 |
if(info->secondstages[j]&(1<<k)){ |
a12155461b34
revert r767d3c4153a1 this tremor implementation is buggy
koda
parents:
7697
diff
changeset
|
148 |
look->partbooks[j][k]=ci->fullbooks+info->booklist[acc++]; |
a12155461b34
revert r767d3c4153a1 this tremor implementation is buggy
koda
parents:
7697
diff
changeset
|
149 |
#ifdef TRAIN_RES |
a12155461b34
revert r767d3c4153a1 this tremor implementation is buggy
koda
parents:
7697
diff
changeset
|
150 |
look->training_data[k][j]=calloc(look->partbooks[j][k]->entries, |
a12155461b34
revert r767d3c4153a1 this tremor implementation is buggy
koda
parents:
7697
diff
changeset
|
151 |
sizeof(***look->training_data)); |
a12155461b34
revert r767d3c4153a1 this tremor implementation is buggy
koda
parents:
7697
diff
changeset
|
152 |
#endif |
a12155461b34
revert r767d3c4153a1 this tremor implementation is buggy
koda
parents:
7697
diff
changeset
|
153 |
} |
5170
f7e49eff3708
add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff
changeset
|
154 |
} |
f7e49eff3708
add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff
changeset
|
155 |
} |
f7e49eff3708
add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff
changeset
|
156 |
|
7849
a12155461b34
revert r767d3c4153a1 this tremor implementation is buggy
koda
parents:
7697
diff
changeset
|
157 |
look->partvals=look->parts; |
a12155461b34
revert r767d3c4153a1 this tremor implementation is buggy
koda
parents:
7697
diff
changeset
|
158 |
for(j=1;j<dim;j++)look->partvals*=look->parts; |
a12155461b34
revert r767d3c4153a1 this tremor implementation is buggy
koda
parents:
7697
diff
changeset
|
159 |
look->stages=maxstage; |
a12155461b34
revert r767d3c4153a1 this tremor implementation is buggy
koda
parents:
7697
diff
changeset
|
160 |
look->decodemap=(int **)_ogg_malloc(look->partvals*sizeof(*look->decodemap)); |
a12155461b34
revert r767d3c4153a1 this tremor implementation is buggy
koda
parents:
7697
diff
changeset
|
161 |
for(j=0;j<look->partvals;j++){ |
a12155461b34
revert r767d3c4153a1 this tremor implementation is buggy
koda
parents:
7697
diff
changeset
|
162 |
long val=j; |
a12155461b34
revert r767d3c4153a1 this tremor implementation is buggy
koda
parents:
7697
diff
changeset
|
163 |
long mult=look->partvals/look->parts; |
a12155461b34
revert r767d3c4153a1 this tremor implementation is buggy
koda
parents:
7697
diff
changeset
|
164 |
look->decodemap[j]=(int *)_ogg_malloc(dim*sizeof(*look->decodemap[j])); |
a12155461b34
revert r767d3c4153a1 this tremor implementation is buggy
koda
parents:
7697
diff
changeset
|
165 |
for(k=0;k<dim;k++){ |
a12155461b34
revert r767d3c4153a1 this tremor implementation is buggy
koda
parents:
7697
diff
changeset
|
166 |
long deco=val/mult; |
a12155461b34
revert r767d3c4153a1 this tremor implementation is buggy
koda
parents:
7697
diff
changeset
|
167 |
val-=deco*mult; |
a12155461b34
revert r767d3c4153a1 this tremor implementation is buggy
koda
parents:
7697
diff
changeset
|
168 |
mult/=look->parts; |
a12155461b34
revert r767d3c4153a1 this tremor implementation is buggy
koda
parents:
7697
diff
changeset
|
169 |
look->decodemap[j][k]=deco; |
a12155461b34
revert r767d3c4153a1 this tremor implementation is buggy
koda
parents:
7697
diff
changeset
|
170 |
} |
a12155461b34
revert r767d3c4153a1 this tremor implementation is buggy
koda
parents:
7697
diff
changeset
|
171 |
} |
5170
f7e49eff3708
add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff
changeset
|
172 |
|
7849
a12155461b34
revert r767d3c4153a1 this tremor implementation is buggy
koda
parents:
7697
diff
changeset
|
173 |
return(look); |
5170
f7e49eff3708
add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff
changeset
|
174 |
} |
f7e49eff3708
add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff
changeset
|
175 |
|
7849
a12155461b34
revert r767d3c4153a1 this tremor implementation is buggy
koda
parents:
7697
diff
changeset
|
176 |
|
a12155461b34
revert r767d3c4153a1 this tremor implementation is buggy
koda
parents:
7697
diff
changeset
|
177 |
/* a truncated packet here just means 'stop working'; it's not an error */ |
a12155461b34
revert r767d3c4153a1 this tremor implementation is buggy
koda
parents:
7697
diff
changeset
|
178 |
static int _01inverse(vorbis_block *vb,vorbis_look_residue *vl, |
a12155461b34
revert r767d3c4153a1 this tremor implementation is buggy
koda
parents:
7697
diff
changeset
|
179 |
ogg_int32_t **in,int ch, |
a12155461b34
revert r767d3c4153a1 this tremor implementation is buggy
koda
parents:
7697
diff
changeset
|
180 |
long (*decodepart)(codebook *, ogg_int32_t *, |
a12155461b34
revert r767d3c4153a1 this tremor implementation is buggy
koda
parents:
7697
diff
changeset
|
181 |
oggpack_buffer *,int,int)){ |
a12155461b34
revert r767d3c4153a1 this tremor implementation is buggy
koda
parents:
7697
diff
changeset
|
182 |
|
a12155461b34
revert r767d3c4153a1 this tremor implementation is buggy
koda
parents:
7697
diff
changeset
|
183 |
long i,j,k,l,s; |
a12155461b34
revert r767d3c4153a1 this tremor implementation is buggy
koda
parents:
7697
diff
changeset
|
184 |
vorbis_look_residue0 *look=(vorbis_look_residue0 *)vl; |
a12155461b34
revert r767d3c4153a1 this tremor implementation is buggy
koda
parents:
7697
diff
changeset
|
185 |
vorbis_info_residue0 *info=look->info; |
a12155461b34
revert r767d3c4153a1 this tremor implementation is buggy
koda
parents:
7697
diff
changeset
|
186 |
|
a12155461b34
revert r767d3c4153a1 this tremor implementation is buggy
koda
parents:
7697
diff
changeset
|
187 |
/* move all this setup out later */ |
5170
f7e49eff3708
add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff
changeset
|
188 |
int samples_per_partition=info->grouping; |
7849
a12155461b34
revert r767d3c4153a1 this tremor implementation is buggy
koda
parents:
7697
diff
changeset
|
189 |
int partitions_per_word=look->phrasebook->dim; |
a12155461b34
revert r767d3c4153a1 this tremor implementation is buggy
koda
parents:
7697
diff
changeset
|
190 |
int max=vb->pcmend>>1; |
a12155461b34
revert r767d3c4153a1 this tremor implementation is buggy
koda
parents:
7697
diff
changeset
|
191 |
int end=(info->end<max?info->end:max); |
a12155461b34
revert r767d3c4153a1 this tremor implementation is buggy
koda
parents:
7697
diff
changeset
|
192 |
int n=end-info->begin; |
5170
f7e49eff3708
add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff
changeset
|
193 |
|
7849
a12155461b34
revert r767d3c4153a1 this tremor implementation is buggy
koda
parents:
7697
diff
changeset
|
194 |
if(n>0){ |
a12155461b34
revert r767d3c4153a1 this tremor implementation is buggy
koda
parents:
7697
diff
changeset
|
195 |
int partvals=n/samples_per_partition; |
a12155461b34
revert r767d3c4153a1 this tremor implementation is buggy
koda
parents:
7697
diff
changeset
|
196 |
int partwords=(partvals+partitions_per_word-1)/partitions_per_word; |
a12155461b34
revert r767d3c4153a1 this tremor implementation is buggy
koda
parents:
7697
diff
changeset
|
197 |
int ***partword=(int ***)alloca(ch*sizeof(*partword)); |
a12155461b34
revert r767d3c4153a1 this tremor implementation is buggy
koda
parents:
7697
diff
changeset
|
198 |
|
a12155461b34
revert r767d3c4153a1 this tremor implementation is buggy
koda
parents:
7697
diff
changeset
|
199 |
for(j=0;j<ch;j++) |
a12155461b34
revert r767d3c4153a1 this tremor implementation is buggy
koda
parents:
7697
diff
changeset
|
200 |
partword[j]=(int **)_vorbis_block_alloc(vb,partwords*sizeof(*partword[j])); |
5170
f7e49eff3708
add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff
changeset
|
201 |
|
7849
a12155461b34
revert r767d3c4153a1 this tremor implementation is buggy
koda
parents:
7697
diff
changeset
|
202 |
for(s=0;s<look->stages;s++){ |
7697
767d3c4153a1
switch the Tremor implementation from the Cocos2D one to the lowmem-no-byte branch and let's see what happens
koda
parents:
6045
diff
changeset
|
203 |
|
7849
a12155461b34
revert r767d3c4153a1 this tremor implementation is buggy
koda
parents:
7697
diff
changeset
|
204 |
/* each loop decodes on partition codeword containing |
a12155461b34
revert r767d3c4153a1 this tremor implementation is buggy
koda
parents:
7697
diff
changeset
|
205 |
partitions_pre_word partitions */ |
a12155461b34
revert r767d3c4153a1 this tremor implementation is buggy
koda
parents:
7697
diff
changeset
|
206 |
for(i=0,l=0;i<partvals;l++){ |
a12155461b34
revert r767d3c4153a1 this tremor implementation is buggy
koda
parents:
7697
diff
changeset
|
207 |
if(s==0){ |
a12155461b34
revert r767d3c4153a1 this tremor implementation is buggy
koda
parents:
7697
diff
changeset
|
208 |
/* fetch the partition word for each channel */ |
a12155461b34
revert r767d3c4153a1 this tremor implementation is buggy
koda
parents:
7697
diff
changeset
|
209 |
for(j=0;j<ch;j++){ |
a12155461b34
revert r767d3c4153a1 this tremor implementation is buggy
koda
parents:
7697
diff
changeset
|
210 |
int temp=vorbis_book_decode(look->phrasebook,&vb->opb); |
a12155461b34
revert r767d3c4153a1 this tremor implementation is buggy
koda
parents:
7697
diff
changeset
|
211 |
if(temp==-1)goto eopbreak; |
a12155461b34
revert r767d3c4153a1 this tremor implementation is buggy
koda
parents:
7697
diff
changeset
|
212 |
partword[j][l]=look->decodemap[temp]; |
a12155461b34
revert r767d3c4153a1 this tremor implementation is buggy
koda
parents:
7697
diff
changeset
|
213 |
if(partword[j][l]==NULL)goto errout; |
a12155461b34
revert r767d3c4153a1 this tremor implementation is buggy
koda
parents:
7697
diff
changeset
|
214 |
} |
a12155461b34
revert r767d3c4153a1 this tremor implementation is buggy
koda
parents:
7697
diff
changeset
|
215 |
} |
7697
767d3c4153a1
switch the Tremor implementation from the Cocos2D one to the lowmem-no-byte branch and let's see what happens
koda
parents:
6045
diff
changeset
|
216 |
|
7849
a12155461b34
revert r767d3c4153a1 this tremor implementation is buggy
koda
parents:
7697
diff
changeset
|
217 |
/* now we decode residual values for the partitions */ |
a12155461b34
revert r767d3c4153a1 this tremor implementation is buggy
koda
parents:
7697
diff
changeset
|
218 |
for(k=0;k<partitions_per_word && i<partvals;k++,i++) |
a12155461b34
revert r767d3c4153a1 this tremor implementation is buggy
koda
parents:
7697
diff
changeset
|
219 |
for(j=0;j<ch;j++){ |
a12155461b34
revert r767d3c4153a1 this tremor implementation is buggy
koda
parents:
7697
diff
changeset
|
220 |
long offset=info->begin+i*samples_per_partition; |
a12155461b34
revert r767d3c4153a1 this tremor implementation is buggy
koda
parents:
7697
diff
changeset
|
221 |
if(info->secondstages[partword[j][l][k]]&(1<<s)){ |
a12155461b34
revert r767d3c4153a1 this tremor implementation is buggy
koda
parents:
7697
diff
changeset
|
222 |
codebook *stagebook=look->partbooks[partword[j][l][k]][s]; |
a12155461b34
revert r767d3c4153a1 this tremor implementation is buggy
koda
parents:
7697
diff
changeset
|
223 |
if(stagebook){ |
a12155461b34
revert r767d3c4153a1 this tremor implementation is buggy
koda
parents:
7697
diff
changeset
|
224 |
if(decodepart(stagebook,in[j]+offset,&vb->opb, |
a12155461b34
revert r767d3c4153a1 this tremor implementation is buggy
koda
parents:
7697
diff
changeset
|
225 |
samples_per_partition,-8)==-1)goto eopbreak; |
7697
767d3c4153a1
switch the Tremor implementation from the Cocos2D one to the lowmem-no-byte branch and let's see what happens
koda
parents:
6045
diff
changeset
|
226 |
} |
767d3c4153a1
switch the Tremor implementation from the Cocos2D one to the lowmem-no-byte branch and let's see what happens
koda
parents:
6045
diff
changeset
|
227 |
} |
767d3c4153a1
switch the Tremor implementation from the Cocos2D one to the lowmem-no-byte branch and let's see what happens
koda
parents:
6045
diff
changeset
|
228 |
} |
5170
f7e49eff3708
add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff
changeset
|
229 |
} |
f7e49eff3708
add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff
changeset
|
230 |
} |
f7e49eff3708
add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff
changeset
|
231 |
} |
f7e49eff3708
add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff
changeset
|
232 |
errout: |
f7e49eff3708
add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff
changeset
|
233 |
eopbreak: |
7849
a12155461b34
revert r767d3c4153a1 this tremor implementation is buggy
koda
parents:
7697
diff
changeset
|
234 |
return(0); |
a12155461b34
revert r767d3c4153a1 this tremor implementation is buggy
koda
parents:
7697
diff
changeset
|
235 |
} |
a12155461b34
revert r767d3c4153a1 this tremor implementation is buggy
koda
parents:
7697
diff
changeset
|
236 |
|
a12155461b34
revert r767d3c4153a1 this tremor implementation is buggy
koda
parents:
7697
diff
changeset
|
237 |
int res0_inverse(vorbis_block *vb,vorbis_look_residue *vl, |
a12155461b34
revert r767d3c4153a1 this tremor implementation is buggy
koda
parents:
7697
diff
changeset
|
238 |
ogg_int32_t **in,int *nonzero,int ch){ |
a12155461b34
revert r767d3c4153a1 this tremor implementation is buggy
koda
parents:
7697
diff
changeset
|
239 |
int i,used=0; |
a12155461b34
revert r767d3c4153a1 this tremor implementation is buggy
koda
parents:
7697
diff
changeset
|
240 |
for(i=0;i<ch;i++) |
a12155461b34
revert r767d3c4153a1 this tremor implementation is buggy
koda
parents:
7697
diff
changeset
|
241 |
if(nonzero[i]) |
a12155461b34
revert r767d3c4153a1 this tremor implementation is buggy
koda
parents:
7697
diff
changeset
|
242 |
in[used++]=in[i]; |
a12155461b34
revert r767d3c4153a1 this tremor implementation is buggy
koda
parents:
7697
diff
changeset
|
243 |
if(used) |
a12155461b34
revert r767d3c4153a1 this tremor implementation is buggy
koda
parents:
7697
diff
changeset
|
244 |
return(_01inverse(vb,vl,in,used,vorbis_book_decodevs_add)); |
a12155461b34
revert r767d3c4153a1 this tremor implementation is buggy
koda
parents:
7697
diff
changeset
|
245 |
else |
a12155461b34
revert r767d3c4153a1 this tremor implementation is buggy
koda
parents:
7697
diff
changeset
|
246 |
return(0); |
a12155461b34
revert r767d3c4153a1 this tremor implementation is buggy
koda
parents:
7697
diff
changeset
|
247 |
} |
a12155461b34
revert r767d3c4153a1 this tremor implementation is buggy
koda
parents:
7697
diff
changeset
|
248 |
|
a12155461b34
revert r767d3c4153a1 this tremor implementation is buggy
koda
parents:
7697
diff
changeset
|
249 |
int res1_inverse(vorbis_block *vb,vorbis_look_residue *vl, |
a12155461b34
revert r767d3c4153a1 this tremor implementation is buggy
koda
parents:
7697
diff
changeset
|
250 |
ogg_int32_t **in,int *nonzero,int ch){ |
a12155461b34
revert r767d3c4153a1 this tremor implementation is buggy
koda
parents:
7697
diff
changeset
|
251 |
int i,used=0; |
a12155461b34
revert r767d3c4153a1 this tremor implementation is buggy
koda
parents:
7697
diff
changeset
|
252 |
for(i=0;i<ch;i++) |
a12155461b34
revert r767d3c4153a1 this tremor implementation is buggy
koda
parents:
7697
diff
changeset
|
253 |
if(nonzero[i]) |
a12155461b34
revert r767d3c4153a1 this tremor implementation is buggy
koda
parents:
7697
diff
changeset
|
254 |
in[used++]=in[i]; |
a12155461b34
revert r767d3c4153a1 this tremor implementation is buggy
koda
parents:
7697
diff
changeset
|
255 |
if(used) |
a12155461b34
revert r767d3c4153a1 this tremor implementation is buggy
koda
parents:
7697
diff
changeset
|
256 |
return(_01inverse(vb,vl,in,used,vorbis_book_decodev_add)); |
a12155461b34
revert r767d3c4153a1 this tremor implementation is buggy
koda
parents:
7697
diff
changeset
|
257 |
else |
a12155461b34
revert r767d3c4153a1 this tremor implementation is buggy
koda
parents:
7697
diff
changeset
|
258 |
return(0); |
a12155461b34
revert r767d3c4153a1 this tremor implementation is buggy
koda
parents:
7697
diff
changeset
|
259 |
} |
a12155461b34
revert r767d3c4153a1 this tremor implementation is buggy
koda
parents:
7697
diff
changeset
|
260 |
|
a12155461b34
revert r767d3c4153a1 this tremor implementation is buggy
koda
parents:
7697
diff
changeset
|
261 |
/* duplicate code here as speed is somewhat more important */ |
a12155461b34
revert r767d3c4153a1 this tremor implementation is buggy
koda
parents:
7697
diff
changeset
|
262 |
int res2_inverse(vorbis_block *vb,vorbis_look_residue *vl, |
a12155461b34
revert r767d3c4153a1 this tremor implementation is buggy
koda
parents:
7697
diff
changeset
|
263 |
ogg_int32_t **in,int *nonzero,int ch){ |
a12155461b34
revert r767d3c4153a1 this tremor implementation is buggy
koda
parents:
7697
diff
changeset
|
264 |
long i,k,l,s; |
a12155461b34
revert r767d3c4153a1 this tremor implementation is buggy
koda
parents:
7697
diff
changeset
|
265 |
vorbis_look_residue0 *look=(vorbis_look_residue0 *)vl; |
a12155461b34
revert r767d3c4153a1 this tremor implementation is buggy
koda
parents:
7697
diff
changeset
|
266 |
vorbis_info_residue0 *info=look->info; |
a12155461b34
revert r767d3c4153a1 this tremor implementation is buggy
koda
parents:
7697
diff
changeset
|
267 |
|
a12155461b34
revert r767d3c4153a1 this tremor implementation is buggy
koda
parents:
7697
diff
changeset
|
268 |
/* move all this setup out later */ |
a12155461b34
revert r767d3c4153a1 this tremor implementation is buggy
koda
parents:
7697
diff
changeset
|
269 |
int samples_per_partition=info->grouping; |
a12155461b34
revert r767d3c4153a1 this tremor implementation is buggy
koda
parents:
7697
diff
changeset
|
270 |
int partitions_per_word=look->phrasebook->dim; |
a12155461b34
revert r767d3c4153a1 this tremor implementation is buggy
koda
parents:
7697
diff
changeset
|
271 |
int max=(vb->pcmend*ch)>>1; |
a12155461b34
revert r767d3c4153a1 this tremor implementation is buggy
koda
parents:
7697
diff
changeset
|
272 |
int end=(info->end<max?info->end:max); |
a12155461b34
revert r767d3c4153a1 this tremor implementation is buggy
koda
parents:
7697
diff
changeset
|
273 |
int n=end-info->begin; |
5170
f7e49eff3708
add libTremor sources (integer-only libvorbis implementation) to repo and ios project
koda
parents:
diff
changeset
|
274 |
|
7849
a12155461b34
revert r767d3c4153a1 this tremor implementation is buggy
koda
parents:
7697
diff
changeset
|
275 |
if(n>0){ |
a12155461b34
revert r767d3c4153a1 this tremor implementation is buggy
koda
parents:
7697
diff
changeset
|
276 |
|
a12155461b34
revert r767d3c4153a1 this tremor implementation is buggy
koda
parents:
7697
diff
changeset
|
277 |
int partvals=n/samples_per_partition; |
a12155461b34
revert r767d3c4153a1 this tremor implementation is buggy
koda
parents:
7697
diff
changeset
|
278 |
int partwords=(partvals+partitions_per_word-1)/partitions_per_word; |
a12155461b34
revert r767d3c4153a1 this tremor implementation is buggy
koda
parents:
7697
diff
changeset
|
279 |
int **partword=(int **)_vorbis_block_alloc(vb,partwords*sizeof(*partword)); |
a12155461b34
revert r767d3c4153a1 this tremor implementation is buggy
koda
parents:
7697
diff
changeset
|
280 |
int beginoff=info->begin/ch; |
a12155461b34
revert r767d3c4153a1 this tremor implementation is buggy
koda
parents:
7697
diff
changeset
|
281 |
|
a12155461b34
revert r767d3c4153a1 this tremor implementation is buggy
koda
parents:
7697
diff
changeset
|
282 |
for(i=0;i<ch;i++)if(nonzero[i])break; |
a12155461b34
revert r767d3c4153a1 this tremor implementation is buggy
koda
parents:
7697
diff
changeset
|
283 |
if(i==ch)return(0); /* no nonzero vectors */ |
a12155461b34
revert r767d3c4153a1 this tremor implementation is buggy
koda
parents:
7697
diff
changeset
|
284 |
|
a12155461b34
revert r767d3c4153a1 this tremor implementation is buggy
koda
parents:
7697
diff
changeset
|
285 |
samples_per_partition/=ch; |
a12155461b34
revert r767d3c4153a1 this tremor implementation is buggy
koda
parents:
7697
diff
changeset
|
286 |
|
a12155461b34
revert r767d3c4153a1 this tremor implementation is buggy
koda
parents:
7697
diff
changeset
|
287 |
for(s=0;s<look->stages;s++){ |
a12155461b34
revert r767d3c4153a1 this tremor implementation is buggy
koda
parents:
7697
diff
changeset
|
288 |
for(i=0,l=0;i<partvals;l++){ |
a12155461b34
revert r767d3c4153a1 this tremor implementation is buggy
koda
parents:
7697
diff
changeset
|
289 |
|
a12155461b34
revert r767d3c4153a1 this tremor implementation is buggy
koda
parents:
7697
diff
changeset
|
290 |
if(s==0){ |
a12155461b34
revert r767d3c4153a1 this tremor implementation is buggy
koda
parents:
7697
diff
changeset
|
291 |
/* fetch the partition word */ |
a12155461b34
revert r767d3c4153a1 this tremor implementation is buggy
koda
parents:
7697
diff
changeset
|
292 |
int temp=vorbis_book_decode(look->phrasebook,&vb->opb); |
a12155461b34
revert r767d3c4153a1 this tremor implementation is buggy
koda
parents:
7697
diff
changeset
|
293 |
if(temp==-1)goto eopbreak; |
a12155461b34
revert r767d3c4153a1 this tremor implementation is buggy
koda
parents:
7697
diff
changeset
|
294 |
partword[l]=look->decodemap[temp]; |
a12155461b34
revert r767d3c4153a1 this tremor implementation is buggy
koda
parents:
7697
diff
changeset
|
295 |
if(partword[l]==NULL)goto errout; |
a12155461b34
revert r767d3c4153a1 this tremor implementation is buggy
koda
parents:
7697
diff
changeset
|
296 |
} |
a12155461b34
revert r767d3c4153a1 this tremor implementation is buggy
koda
parents:
7697
diff
changeset
|
297 |
|
a12155461b34
revert r767d3c4153a1 this tremor implementation is buggy
koda
parents:
7697
diff
changeset
|
298 |
/* now we decode residual values for the partitions */ |
a12155461b34
revert r767d3c4153a1 this tremor implementation is buggy
koda
parents:
7697
diff
changeset
|
299 |
for(k=0;k<partitions_per_word && i<partvals;k++,i++) |
a12155461b34
revert r767d3c4153a1 this tremor implementation is buggy
koda
parents:
7697
diff
changeset
|
300 |
if(info->secondstages[partword[l][k]]&(1<<s)){ |
a12155461b34
revert r767d3c4153a1 this tremor implementation is buggy
koda
parents:
7697
diff
changeset
|
301 |
codebook *stagebook=look->partbooks[partword[l][k]][s]; |
a12155461b34
revert r767d3c4153a1 this tremor implementation is buggy
koda
parents:
7697
diff
changeset
|
302 |
|
a12155461b34
revert r767d3c4153a1 this tremor implementation is buggy
koda
parents:
7697
diff
changeset
|
303 |
if(stagebook){ |
a12155461b34
revert r767d3c4153a1 this tremor implementation is buggy
koda
parents:
7697
diff
changeset
|
304 |
if(vorbis_book_decodevv_add(stagebook,in, |
a12155461b34
revert r767d3c4153a1 this tremor implementation is buggy
koda
parents:
7697
diff
changeset
|
305 |
i*samples_per_partition+beginoff,ch, |
a12155461b34
revert r767d3c4153a1 this tremor implementation is buggy
koda
parents:
7697
diff
changeset
|
306 |
&vb->opb, |
a12155461b34
revert r767d3c4153a1 this tremor implementation is buggy
koda
parents:
7697
diff
changeset
|
307 |
samples_per_partition,-8)==-1) |
a12155461b34
revert r767d3c4153a1 this tremor implementation is buggy
koda
parents:
7697
diff
changeset
|
308 |
goto eopbreak; |
a12155461b34
revert r767d3c4153a1 this tremor implementation is buggy
koda
parents:
7697
diff
changeset
|
309 |
} |
a12155461b34
revert r767d3c4153a1 this tremor implementation is buggy
koda
parents:
7697
diff
changeset
|
310 |
} |
a12155461b34
revert r767d3c4153a1 this tremor implementation is buggy
koda
parents:
7697
diff
changeset
|
311 |
} |
a12155461b34
revert r767d3c4153a1 this tremor implementation is buggy
koda
parents:
7697
diff
changeset
|
312 |
} |
a12155461b34
revert r767d3c4153a1 this tremor implementation is buggy
koda
parents:
7697
diff
changeset
|
313 |
} |
a12155461b34
revert r767d3c4153a1 this tremor implementation is buggy
koda
parents:
7697
diff
changeset
|
314 |
errout: |
a12155461b34
revert r767d3c4153a1 this tremor implementation is buggy
koda
parents:
7697
diff
changeset
|
315 |
eopbreak: |
a12155461b34
revert r767d3c4153a1 this tremor implementation is buggy
koda
parents:
7697
diff
changeset
|
316 |
return(0); |
a12155461b34
revert r767d3c4153a1 this tremor implementation is buggy
koda
parents:
7697
diff
changeset
|
317 |
} |
a12155461b34
revert r767d3c4153a1 this tremor implementation is buggy
koda
parents:
7697
diff
changeset
|
318 |
|
a12155461b34
revert r767d3c4153a1 this tremor implementation is buggy
koda
parents:
7697
diff
changeset
|
319 |
|
a12155461b34
revert r767d3c4153a1 this tremor implementation is buggy
koda
parents:
7697
diff
changeset
|
320 |
vorbis_func_residue residue0_exportbundle={ |
a12155461b34
revert r767d3c4153a1 this tremor implementation is buggy
koda
parents:
7697
diff
changeset
|
321 |
&res0_unpack, |
a12155461b34
revert r767d3c4153a1 this tremor implementation is buggy
koda
parents:
7697
diff
changeset
|
322 |
&res0_look, |
a12155461b34
revert r767d3c4153a1 this tremor implementation is buggy
koda
parents:
7697
diff
changeset
|
323 |
&res0_free_info, |
a12155461b34
revert r767d3c4153a1 this tremor implementation is buggy
koda
parents:
7697
diff
changeset
|
324 |
&res0_free_look, |
a12155461b34
revert r767d3c4153a1 this tremor implementation is buggy
koda
parents:
7697
diff
changeset
|
325 |
&res0_inverse |
a12155461b34
revert r767d3c4153a1 this tremor implementation is buggy
koda
parents:
7697
diff
changeset
|
326 |
}; |
a12155461b34
revert r767d3c4153a1 this tremor implementation is buggy
koda
parents:
7697
diff
changeset
|
327 |
|
a12155461b34
revert r767d3c4153a1 this tremor implementation is buggy
koda
parents:
7697
diff
changeset
|
328 |
vorbis_func_residue residue1_exportbundle={ |
a12155461b34
revert r767d3c4153a1 this tremor implementation is buggy
koda
parents:
7697
diff
changeset
|
329 |
&res0_unpack, |
a12155461b34
revert r767d3c4153a1 this tremor implementation is buggy
koda
parents:
7697
diff
changeset
|
330 |
&res0_look, |
a12155461b34
revert r767d3c4153a1 this tremor implementation is buggy
koda
parents:
7697
diff
changeset
|
331 |
&res0_free_info, |
a12155461b34
revert r767d3c4153a1 this tremor implementation is buggy
koda
parents:
7697
diff
changeset
|
332 |
&res0_free_look, |
a12155461b34
revert r767d3c4153a1 this tremor implementation is buggy
koda
parents:
7697
diff
changeset
|
333 |
&res1_inverse |
a12155461b34
revert r767d3c4153a1 this tremor implementation is buggy
koda
parents:
7697
diff
changeset
|
334 |
}; |
a12155461b34
revert r767d3c4153a1 this tremor implementation is buggy
koda
parents:
7697
diff
changeset
|
335 |
|
a12155461b34
revert r767d3c4153a1 this tremor implementation is buggy
koda
parents:
7697
diff
changeset
|
336 |
vorbis_func_residue residue2_exportbundle={ |
a12155461b34
revert r767d3c4153a1 this tremor implementation is buggy
koda
parents:
7697
diff
changeset
|
337 |
&res0_unpack, |
a12155461b34
revert r767d3c4153a1 this tremor implementation is buggy
koda
parents:
7697
diff
changeset
|
338 |
&res0_look, |
a12155461b34
revert r767d3c4153a1 this tremor implementation is buggy
koda
parents:
7697
diff
changeset
|
339 |
&res0_free_info, |
a12155461b34
revert r767d3c4153a1 this tremor implementation is buggy
koda
parents:
7697
diff
changeset
|
340 |
&res0_free_look, |
a12155461b34
revert r767d3c4153a1 this tremor implementation is buggy
koda
parents:
7697
diff
changeset
|
341 |
&res2_inverse |
a12155461b34
revert r767d3c4153a1 this tremor implementation is buggy
koda
parents:
7697
diff
changeset
|
342 |
}; |