annotate libmpcodecs/native/decode144.c @ 10442:d532fa79b0be

inconsistency
author alex
date Sat, 19 Jul 2003 17:39:47 +0000
parents 597ad4eb02fc
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
10260
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
1 #include "common1428.h"
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
2 #include "decode144.h"
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
3 #include "tables144.h"
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
4
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
5 /* Initialize internal variable structure */
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
6 Real_144 *init_144(void)
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
7 {
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
8 Real_internal *glob;
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
9
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
10 if ((glob=malloc(sizeof(Real_internal))))
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
11 memset(glob,0,sizeof(Real_internal));
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
12
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
13 glob->resetflag=1;
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
14 glob->swapbuf1=glob->swapb1a;
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
15 glob->swapbuf2=glob->swapb2a;
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
16 glob->swapbuf1alt=glob->swapb1b;
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
17 glob->swapbuf2alt=glob->swapb2b;
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
18
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
19 memcpy(glob->wavtable1,wavtable1,sizeof(wavtable1));
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
20 memcpy(glob->wavtable2,wavtable2,sizeof(wavtable2));
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
21
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
22 return (Real_144 *)glob;
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
23 }
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
24
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
25 /* Free internal variable structure */
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
26 void free_144(Real_144 *global)
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
27 {
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
28 if (!global) return;
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
29 free(global);
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
30 }
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
31
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
32 /* Uncompress one block (20 bytes -> 160*2 bytes) */
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
33 void decode_144(Real_144 *global, unsigned char *source, signed short *target)
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
34 {
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
35 unsigned int a,b,c;
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
36 long s;
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
37 signed short *shptr;
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
38 unsigned int *lptr,*temp;
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
39 const short **dptr;
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
40 Real_internal *glob;
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
41
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
42 if (!global) return;
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
43 glob = (Real_internal *)global;
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
44
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
45 unpack_input(source,glob->unpacked);
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
46
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
47 glob->iptr=glob->unpacked;
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
48 glob->val=decodetable[0][(*(glob->iptr++))<<1];
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
49
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
50 dptr=decodetable+1;
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
51 lptr=glob->swapbuf1;
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
52 while (lptr<glob->swapbuf1+10)
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
53 *(lptr++)=(*(dptr++))[(*(glob->iptr++))<<1];
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
54
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
55 do_voice(glob->swapbuf1,glob->swapbuf2);
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
56
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
57 a=t_sqrt(glob->val*glob->oldval)>>12;
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
58
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
59 for (c=0;c<NBLOCKS;c++) {
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
60 if (c==(NBLOCKS-1)) {
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
61 dec1(glob,glob->swapbuf1,glob->swapbuf2,3,glob->val);
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
62 } else {
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
63 if (c*2==(NBLOCKS-2)) {
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
64 if (glob->oldval<glob->val) {
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
65 dec2(glob,glob->swapbuf1,glob->swapbuf2,3,a,glob->swapbuf2alt,c);
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
66 } else {
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
67 dec2(glob,glob->swapbuf1alt,glob->swapbuf2alt,3,a,glob->swapbuf2,c);
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
68 }
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
69 } else {
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
70 if (c*2<(NBLOCKS-2)) {
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
71 dec2(glob,glob->swapbuf1alt,glob->swapbuf2alt,3,glob->oldval,glob->swapbuf2,c);
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
72 } else {
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
73 dec2(glob,glob->swapbuf1,glob->swapbuf2,3,glob->val,glob->swapbuf2alt,c);
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
74 }
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
75 }
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
76 }
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
77 }
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
78
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
79 /* do output */
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
80 for (b=0,c=0;c<4;c++) {
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
81 glob->gval=glob->gbuf1[c*2];
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
82 glob->gsp=glob->gbuf2+b;
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
83 do_output_subblock(glob,glob->resetflag);
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
84 glob->resetflag=0;
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
85
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
86 shptr=glob->output_buffer;
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
87 while (shptr<glob->output_buffer+BLOCKSIZE) {
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
88 s=*(shptr++)<<2;
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
89 *target=s;
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
90 if (s>32767) *target=32767;
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
91 if (s<-32767) *target=-32768;
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
92 target++;
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
93 }
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
94 b+=30;
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
95 }
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
96
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
97 glob->oldval=glob->val;
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
98 temp=glob->swapbuf1alt;
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
99 glob->swapbuf1alt=glob->swapbuf1;
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
100 glob->swapbuf1=temp;
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
101 temp=glob->swapbuf2alt;
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
102 glob->swapbuf2alt=glob->swapbuf2;
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
103 glob->swapbuf2=temp;
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
104 }
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
105
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
106 /* lookup square roots in table */
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
107 static int t_sqrt(unsigned int x)
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
108 {
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
109 int s=0;
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
110 while (x>0xfff) { s++; x=x>>2; }
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
111 return (sqrt_table[x]<<s)<<2;
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
112 }
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
113
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
114 /* do 'voice' */
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
115 static void do_voice(int *a1, int *a2)
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
116 {
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
117 int buffer[10];
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
118 int *b1,*b2;
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
119 int x,y;
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
120 int *ptr,*tmp;
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
121
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
122 b1=buffer;
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
123 b2=a2;
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
124
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
125 for (x=0;x<10;x++) {
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
126 b1[x]=(*a1)<<4;
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
127
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
128 if(x>0) {
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
129 ptr=b2+x;
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
130 for (y=0;y<=x-1;y++)
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
131 b1[y]=(((*a1)*(*(--ptr)))>>12)+b2[y];
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
132 }
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
133 tmp=b1;
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
134 b1=b2;
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
135 b2=tmp;
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
136 a1++;
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
137 }
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
138 ptr=a2+10;
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
139 while (ptr>a2) (*a2++)>>=4;
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
140 }
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
141
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
142
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
143 /* do quarter-block output */
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
144 static void do_output_subblock(Real_internal *glob, int x)
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
145 {
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
146 int a,b,c,d,e,f,g;
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
147
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
148 if (x==1) memset(glob->buffer,0,20);
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
149 if ((*glob->iptr)==0) a=0;
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
150 else a=(*glob->iptr)+HALFBLOCK-1;
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
151 glob->iptr++;
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
152 b=*(glob->iptr++);
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
153 c=*(glob->iptr++);
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
154 d=*(glob->iptr++);
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
155 if (a) rotate_block(glob->buffer_2,glob->buffer_a,a);
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
156 memcpy(glob->buffer_b,etable1+b*BLOCKSIZE,BLOCKSIZE*2);
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
157 e=((ftable1[b]>>4)*glob->gval)>>8;
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
158 memcpy(glob->buffer_c,etable2+c*BLOCKSIZE,BLOCKSIZE*2);
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
159 f=((ftable2[c]>>4)*glob->gval)>>8;
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
160 if (a) g=irms(glob->buffer_a,glob->gval)>>12;
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
161 else g=0;
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
162 add_wav(glob,d,a,g,e,f,glob->buffer_a,glob->buffer_b,glob->buffer_c,glob->buffer_d);
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
163 memmove(glob->buffer_2,glob->buffer_2+BLOCKSIZE,(BUFFERSIZE-BLOCKSIZE)*2);
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
164 memcpy(glob->buffer_2+BUFFERSIZE-BLOCKSIZE,glob->buffer_d,BLOCKSIZE*2);
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
165 final(glob,glob->gsp,glob->buffer_d,glob->output_buffer,glob->buffer,BLOCKSIZE);
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
166 }
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
167
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
168 /* rotate block */
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
169 static void rotate_block(short *source, short *target, int offset)
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
170 {
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
171 short *end;
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
172 short *ptr1;
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
173 short *ptr2;
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
174 short *ptr3;
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
175 ptr2=source+BUFFERSIZE;
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
176 ptr3=ptr1=ptr2-offset;
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
177 end=target+BLOCKSIZE;
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
178 while (target<end) {
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
179 *(target++)=*(ptr3++);
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
180 if (ptr3==ptr2) ptr3=ptr1;
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
181 }
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
182 }
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
183
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
184 /* inverse root mean square */
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
185 static int irms(short *data, int factor)
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
186 {
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
187 short *p1,*p2;
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
188 unsigned int sum;
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
189 p2=(p1=data)+BLOCKSIZE;
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
190 for (sum=0;p2>p1;p1++) sum+=(*p1)*(*p1);
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
191 if (sum==0) return 0; /* OOPS - division by zero */
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
192 return (0x20000000/(t_sqrt(sum)>>8))*factor;
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
193 }
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
194
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
195 /* multiply/add wavetable */
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
196 static void add_wav(Real_internal *glob, int n, int f, int m1, int m2, int m3, short *s1, short *s2, short *s3, short *dest)
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
197 {
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
198 int a,b,c;
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
199 int x;
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
200 short *ptr,*ptr2;
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
201
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
202 ptr=glob->wavtable1+n*9;
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
203 ptr2=glob->wavtable2+n*9;
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
204 if (f!=0) {
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
205 a=((*ptr)*m1)>>((*ptr2)+1);
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
206 } else {
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
207 a=0;
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
208 }
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
209 ptr++;ptr2++;
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
210 b=((*ptr)*m2)>>((*ptr2)+1);
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
211 ptr++;ptr2++;
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
212 c=((*ptr)*m3)>>((*ptr2)+1);
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
213 ptr2=(ptr=dest)+BLOCKSIZE;
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
214 if (f!=0)
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
215 while (ptr<ptr2)
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
216 *(ptr++)=((*(s1++))*a+(*(s2++))*b+(*(s3++))*c)>>12;
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
217 else
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
218 while (ptr<ptr2)
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
219 *(ptr++)=((*(s2++))*b+(*(s3++))*c)>>12;
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
220 }
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
221
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
222
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
223 static void final(Real_internal *glob, short *i1, short *i2, void *out, int *statbuf, int len)
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
224 {
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
225 int x,sum;
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
226 int buffer[10];
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
227 short *ptr;
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
228 short *ptr2;
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
229
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
230 memcpy(glob->work,statbuf,20);
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
231 memcpy(glob->work+10,i2,len*2);
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
232
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
233 buffer[9]=i1[0];
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
234 buffer[8]=i1[1];
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
235 buffer[7]=i1[2];
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
236 buffer[6]=i1[3];
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
237 buffer[5]=i1[4];
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
238 buffer[4]=i1[5];
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
239 buffer[3]=i1[6];
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
240 buffer[2]=i1[7];
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
241 buffer[1]=i1[8];
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
242 buffer[0]=i1[9];
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
243
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
244 ptr2=(ptr=glob->work)+len;
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
245 while (ptr<ptr2) {
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
246 for(sum=0,x=0;x<=9;x++)
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
247 sum+=buffer[x]*(ptr[x]);
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
248 sum=sum>>12;
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
249 x=ptr[10]-sum;
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
250 if (x<-32768 || x>32767)
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
251 {
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
252 memset(out,0,len*2);
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
253 memset(statbuf,0,20);
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
254 return;
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
255 }
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
256 ptr[10]=x;
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
257 ptr++;
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
258 }
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
259 memcpy(out,ptr+10-len,len*2);
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
260 memcpy(statbuf,ptr,20);
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
261 }
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
262
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
263 /* Decode 20-byte input */
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
264 static void unpack_input(unsigned char *input, unsigned int *output)
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
265 {
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
266 unsigned int outbuffer[28];
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
267 unsigned short inbuffer[10];
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
268 unsigned int x;
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
269 unsigned int *ptr;
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
270
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
271 /* fix endianness */
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
272 for (x=0;x<20;x+=2)
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
273 inbuffer[x/2]=(input[x]<<8)+input[x+1];
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
274
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
275 /* unpack */
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
276 ptr=outbuffer;
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
277 *(ptr++)=27;
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
278 *(ptr++)=(inbuffer[0]>>10)&0x3f;
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
279 *(ptr++)=(inbuffer[0]>>5)&0x1f;
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
280 *(ptr++)=inbuffer[0]&0x1f;
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
281 *(ptr++)=(inbuffer[1]>>12)&0xf;
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
282 *(ptr++)=(inbuffer[1]>>8)&0xf;
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
283 *(ptr++)=(inbuffer[1]>>5)&7;
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
284 *(ptr++)=(inbuffer[1]>>2)&7;
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
285 *(ptr++)=((inbuffer[1]<<1)&6)|((inbuffer[2]>>15)&1);
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
286 *(ptr++)=(inbuffer[2]>>12)&7;
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
287 *(ptr++)=(inbuffer[2]>>10)&3;
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
288 *(ptr++)=(inbuffer[2]>>5)&0x1f;
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
289 *(ptr++)=((inbuffer[2]<<2)&0x7c)|((inbuffer[3]>>14)&3);
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
290 *(ptr++)=(inbuffer[3]>>6)&0xff;
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
291 *(ptr++)=((inbuffer[3]<<1)&0x7e)|((inbuffer[4]>>15)&1);
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
292 *(ptr++)=(inbuffer[4]>>8)&0x7f;
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
293 *(ptr++)=(inbuffer[4]>>1)&0x7f;
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
294 *(ptr++)=((inbuffer[4]<<7)&0x80)|((inbuffer[5]>>9)&0x7f);
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
295 *(ptr++)=(inbuffer[5]>>2)&0x7f;
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
296 *(ptr++)=((inbuffer[5]<<5)&0x60)|((inbuffer[6]>>11)&0x1f);
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
297 *(ptr++)=(inbuffer[6]>>4)&0x7f;
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
298 *(ptr++)=((inbuffer[6]<<4)&0xf0)|((inbuffer[7]>>12)&0xf);
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
299 *(ptr++)=(inbuffer[7]>>5)&0x7f;
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
300 *(ptr++)=((inbuffer[7]<<2)&0x7c)|((inbuffer[8]>>14)&3);
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
301 *(ptr++)=(inbuffer[8]>>7)&0x7f;
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
302 *(ptr++)=((inbuffer[8]<<1)&0xfe)|((inbuffer[9]>>15)&1);
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
303 *(ptr++)=(inbuffer[9]>>8)&0x7f;
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
304 *(ptr++)=(inbuffer[9]>>1)&0x7f;
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
305
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
306 *(output++)=outbuffer[11];
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
307 for (x=1;x<11;*(output++)=outbuffer[x++]);
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
308 ptr=outbuffer+12;
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
309 for (x=0;x<16;x+=4)
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
310 {
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
311 *(output++)=ptr[x];
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
312 *(output++)=ptr[x+2];
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
313 *(output++)=ptr[x+3];
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
314 *(output++)=ptr[x+1];
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
315 }
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
316 }
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
317
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
318 static unsigned int rms(int *data, int f)
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
319 {
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
320 int *c;
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
321 int x;
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
322 int d;
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
323 unsigned int res;
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
324 int b;
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
325
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
326 c=data;
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
327 b=0;
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
328 res=0x10000;
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
329 for (x=0;x<10;x++)
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
330 {
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
331 res=(((0x1000000-(*c)*(*c))>>12)*res)>>12;
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
332 if (res==0) return 0;
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
333 if (res<=0x3fff)
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
334 {
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
335 while (res<=0x3fff)
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
336 {
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
337 b++;
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
338 res<<=2;
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
339 }
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
340 } else {
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
341 if (res>0x10000)
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
342 return 0; /* We're screwed, might as well go out with a bang. :P */
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
343 }
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
344 c++;
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
345 }
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
346 if (res>0) res=t_sqrt(res);
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
347
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
348 res>>=(b+10);
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
349 res=(res*f)>>10;
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
350 return res;
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
351 }
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
352
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
353 static void dec1(Real_internal *glob, int *data, int *inp, int n, int f)
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
354 {
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
355 short *ptr,*end;
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
356
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
357 *(glob->decptr++)=rms(data,f);
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
358 glob->decptr++;
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
359 end=(ptr=glob->decsp)+(n*10);
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
360 while (ptr<end) *(ptr++)=*(inp++);
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
361 }
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
362
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
363 static void dec2(Real_internal *glob, int *data, int *inp, int n, int f, int *inp2, int l)
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
364 {
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
365 unsigned int *ptr1,*ptr2;
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
366 int work[10];
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
367 int a,b;
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
368 int x;
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
369 int result;
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
370
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
371 if(l+1<NBLOCKS/2) a=NBLOCKS-(l+1);
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
372 else a=l+1;
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
373 b=NBLOCKS-a;
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
374 if (l==0)
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
375 {
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
376 glob->decsp=glob->sptr=glob->gbuf2;
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
377 glob->decptr=glob->gbuf1;
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
378 }
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
379 ptr1=inp;
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
380 ptr2=inp2;
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
381 for (x=0;x<10*n;x++)
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
382 *(glob->sptr++)=(a*(*ptr1++)+b*(*ptr2++))>>2;
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
383 result=eq(glob,glob->decsp,work);
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
384 if (result==1)
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
385 {
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
386 dec1(glob,data,inp,n,f);
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
387 } else {
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
388 *(glob->decptr++)=rms(work,f);
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
389 glob->decptr++;
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
390 }
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
391 glob->decsp+=n*10;
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
392 }
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
393
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
394
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
395 static int eq(Real_internal *glob, short *in, int *target)
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
396 {
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
397 int retval;
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
398 int a;
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
399 int b;
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
400 int c;
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
401 unsigned int u;
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
402 short *sptr;
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
403 int *ptr1,*ptr2,*ptr3;
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
404 int *bp1,*bp2,*temp;
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
405
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
406 retval=0;
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
407 bp1=glob->buffer1;
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
408 bp2=glob->buffer2;
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
409 ptr2=(ptr3=glob->buffer2)+9;
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
410 sptr=in;
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
411 while (ptr2>=ptr3)
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
412 *(ptr3++)=*(sptr++);
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
413
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
414 target+=9;
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
415 a=bp2[9];
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
416 *target=a;
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
417 if (a+0x1000>0x1fff)
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
418 return 0; /* We're screwed, might as well go out with a bang. :P */
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
419 c=8;u=a;
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
420 while (c>=0)
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
421 {
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
422 if (u==0x1000) u++;
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
423 if (u==0xfffff000) u--;
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
424 b=0x1000-((u*u)>>12);
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
425 if (b==0) b++;
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
426 ptr2=bp1;
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
427 ptr1=(ptr3=bp2)+c;
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
428 for (u=0;u<=c;u++)
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
429 *(ptr2++)=((*(ptr3++)-(((*target)*(*(ptr1--)))>>12))*(0x1000000/b))>>12;
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
430 *(--target)=u=bp1[(c--)];
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
431 if ((u+0x1000)>0x1fff) retval=1;
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
432 temp=bp2;
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
433 bp2=bp1;
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
434 bp1=temp;
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
435 }
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
436 return retval;
597ad4eb02fc RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders.
rtognimp
parents:
diff changeset
437 }