Mercurial > libavcodec.hg
annotate ra144.c @ 3194:c30e9bcbb716 libavcodec
seed iterative_me with mvs from conventional search.
+15% speed, +.1 dB
author | lorenm |
---|---|
date | Mon, 13 Mar 2006 01:27:13 +0000 |
parents | 0b546eab515d |
children | c8c591fe26f8 |
rev | line source |
---|---|
1304
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
1 /* |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
2 * Real Audio 1.0 (14.4K) |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
3 * Copyright (c) 2003 the ffmpeg project |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
4 * |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
5 * This library is free software; you can redistribute it and/or |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
6 * modify it under the terms of the GNU Lesser General Public |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
7 * License as published by the Free Software Foundation; either |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
8 * version 2 of the License, or (at your option) any later version. |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
9 * |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
10 * This library is distributed in the hope that it will be useful, |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
13 * Lesser General Public License for more details. |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
14 * |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
15 * You should have received a copy of the GNU Lesser General Public |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
16 * License along with this library; if not, write to the Free Software |
3036
0b546eab515d
Update licensing information: The FSF changed postal address.
diego
parents:
2979
diff
changeset
|
17 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
1304
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
18 */ |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
19 |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
20 #include "avcodec.h" |
1335
b4a72edb3a71
moved the tables into header files (and applied the 'static' patch). Nick: why do you like mergeing tables and code into one file, so making it unusable big?
al3x
parents:
1305
diff
changeset
|
21 #include "ra144.h" |
1304
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
22 |
2979 | 23 #define DATABLOCK1 20 /* size of 14.4 input block in bytes */ |
24 #define DATACHUNK1 1440 /* size of 14.4 input chunk in bytes */ | |
25 #define AUDIOBLOCK 160 /* size of output block in 16-bit words (320 bytes) */ | |
26 #define AUDIOBUFFER 12288 /* size of output buffer in 16-bit words (24576 bytes) */ | |
1304
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
27 /* consts */ |
2979 | 28 #define NBLOCKS 4 /* number of segments within a block */ |
29 #define BLOCKSIZE 40 /* (quarter) block size in 16-bit words (80 bytes) */ | |
30 #define HALFBLOCK 20 /* BLOCKSIZE/2 */ | |
31 #define BUFFERSIZE 146 /* for do_output */ | |
1304
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
32 |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
33 |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
34 /* internal globals */ |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
35 typedef struct { |
2979 | 36 unsigned int resetflag, val, oldval; |
37 unsigned int unpacked[28]; /* buffer for unpacked input */ | |
38 unsigned int *iptr; /* pointer to current input (from unpacked) */ | |
39 unsigned int gval; | |
40 unsigned short *gsp; | |
41 unsigned int gbuf1[8]; | |
42 unsigned short gbuf2[120]; | |
43 signed short output_buffer[40]; | |
44 unsigned int *decptr; /* decoder ptr */ | |
45 signed short *decsp; | |
1304
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
46 |
2979 | 47 /* the swapped buffers */ |
48 unsigned int swapb1a[10]; | |
49 unsigned int swapb2a[10]; | |
50 unsigned int swapb1b[10]; | |
51 unsigned int swapb2b[10]; | |
52 unsigned int *swapbuf1; | |
53 unsigned int *swapbuf2; | |
54 unsigned int *swapbuf1alt; | |
55 unsigned int *swapbuf2alt; | |
1304
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
56 |
2979 | 57 unsigned int buffer[5]; |
58 unsigned short int buffer_2[148]; | |
59 unsigned short int buffer_a[40]; | |
60 unsigned short int buffer_b[40]; | |
61 unsigned short int buffer_c[40]; | |
62 unsigned short int buffer_d[40]; | |
1304
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
63 |
2979 | 64 unsigned short int work[50]; |
65 unsigned short *sptr; | |
1304
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
66 |
2979 | 67 int buffer1[10]; |
68 int buffer2[10]; | |
1304
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
69 |
2979 | 70 signed short wavtable1[2304]; |
71 unsigned short wavtable2[2304]; | |
1304
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
72 } Real144_internal; |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
73 |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
74 static int ra144_decode_init(AVCodecContext * avctx) |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
75 { |
2979 | 76 Real144_internal *glob=avctx->priv_data; |
1304
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
77 |
2979 | 78 memset(glob,0,sizeof(Real144_internal)); |
79 glob->resetflag=1; | |
80 glob->swapbuf1=glob->swapb1a; | |
81 glob->swapbuf2=glob->swapb2a; | |
82 glob->swapbuf1alt=glob->swapb1b; | |
83 glob->swapbuf2alt=glob->swapb2b; | |
1304
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
84 |
2979 | 85 memcpy(glob->wavtable1,wavtable1,sizeof(wavtable1)); |
86 memcpy(glob->wavtable2,wavtable2,sizeof(wavtable2)); | |
1304
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
87 |
2979 | 88 return 0; |
1304
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
89 } |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
90 |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
91 static void final(Real144_internal *glob, short *i1, short *i2, void *out, int *statbuf, int len); |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
92 static void add_wav(Real144_internal *glob, int n, int f, int m1, int m2, int m3, short *s1, short *s2, short *s3, short *dest); |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
93 static int irms(short *data, int factor); |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
94 static void rotate_block(short *source, short *target, int offset); |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
95 /* lookup square roots in table */ |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
96 static int t_sqrt(unsigned int x) |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
97 { |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
98 int s=0; |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
99 while (x>0xfff) { s++; x=x>>2; } |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
100 return (sqrt_table[x]<<s)<<2; |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
101 } |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
102 |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
103 /* do 'voice' */ |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
104 static void do_voice(int *a1, int *a2) |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
105 { |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
106 int buffer[10]; |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
107 int *b1,*b2; |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
108 int x,y; |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
109 int *ptr,*tmp; |
2967 | 110 |
1304
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
111 b1=buffer; |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
112 b2=a2; |
2967 | 113 |
1304
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
114 for (x=0;x<10;x++) { |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
115 b1[x]=(*a1)<<4; |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
116 |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
117 if(x>0) { |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
118 ptr=b2+x; |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
119 for (y=0;y<=x-1;y++) |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
120 b1[y]=(((*a1)*(*(--ptr)))>>12)+b2[y]; |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
121 } |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
122 tmp=b1; |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
123 b1=b2; |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
124 b2=tmp; |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
125 a1++; |
2967 | 126 } |
1304
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
127 ptr=a2+10; |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
128 while (ptr>a2) (*a2++)>>=4; |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
129 } |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
130 |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
131 |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
132 /* do quarter-block output */ |
2288 | 133 static void do_output_subblock(Real144_internal *glob, unsigned int x) |
1304
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
134 { |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
135 int a,b,c,d,e,f,g; |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
136 |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
137 if (x==1) memset(glob->buffer,0,20); |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
138 if ((*glob->iptr)==0) a=0; |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
139 else a=(*glob->iptr)+HALFBLOCK-1; |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
140 glob->iptr++; |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
141 b=*(glob->iptr++); |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
142 c=*(glob->iptr++); |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
143 d=*(glob->iptr++); |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
144 if (a) rotate_block(glob->buffer_2,glob->buffer_a,a); |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
145 memcpy(glob->buffer_b,etable1+b*BLOCKSIZE,BLOCKSIZE*2); |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
146 e=((ftable1[b]>>4)*glob->gval)>>8; |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
147 memcpy(glob->buffer_c,etable2+c*BLOCKSIZE,BLOCKSIZE*2); |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
148 f=((ftable2[c]>>4)*glob->gval)>>8; |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
149 if (a) g=irms(glob->buffer_a,glob->gval)>>12; |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
150 else g=0; |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
151 add_wav(glob,d,a,g,e,f,glob->buffer_a,glob->buffer_b,glob->buffer_c,glob->buffer_d); |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
152 memmove(glob->buffer_2,glob->buffer_2+BLOCKSIZE,(BUFFERSIZE-BLOCKSIZE)*2); |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
153 memcpy(glob->buffer_2+BUFFERSIZE-BLOCKSIZE,glob->buffer_d,BLOCKSIZE*2); |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
154 final(glob,glob->gsp,glob->buffer_d,glob->output_buffer,glob->buffer,BLOCKSIZE); |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
155 } |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
156 |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
157 /* rotate block */ |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
158 static void rotate_block(short *source, short *target, int offset) |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
159 { |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
160 short *end; |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
161 short *ptr1; |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
162 short *ptr2; |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
163 short *ptr3; |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
164 ptr2=source+BUFFERSIZE; |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
165 ptr3=ptr1=ptr2-offset; |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
166 end=target+BLOCKSIZE; |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
167 while (target<end) { |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
168 *(target++)=*(ptr3++); |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
169 if (ptr3==ptr2) ptr3=ptr1; |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
170 } |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
171 } |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
172 |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
173 /* inverse root mean square */ |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
174 static int irms(short *data, int factor) |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
175 { |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
176 short *p1,*p2; |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
177 unsigned int sum; |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
178 p2=(p1=data)+BLOCKSIZE; |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
179 for (sum=0;p2>p1;p1++) sum+=(*p1)*(*p1); |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
180 if (sum==0) return 0; /* OOPS - division by zero */ |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
181 return (0x20000000/(t_sqrt(sum)>>8))*factor; |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
182 } |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
183 |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
184 /* multiply/add wavetable */ |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
185 static void add_wav(Real144_internal *glob, int n, int f, int m1, int m2, int m3, short *s1, short *s2, short *s3, short *dest) |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
186 { |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
187 int a,b,c; |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
188 short *ptr,*ptr2; |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
189 |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
190 ptr=glob->wavtable1+n*9; |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
191 ptr2=glob->wavtable2+n*9; |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
192 if (f!=0) { |
2967 | 193 a=((*ptr)*m1)>>((*ptr2)+1); |
1304
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
194 } else { |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
195 a=0; |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
196 } |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
197 ptr++;ptr2++; |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
198 b=((*ptr)*m2)>>((*ptr2)+1); |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
199 ptr++;ptr2++; |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
200 c=((*ptr)*m3)>>((*ptr2)+1); |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
201 ptr2=(ptr=dest)+BLOCKSIZE; |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
202 if (f!=0) |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
203 while (ptr<ptr2) |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
204 *(ptr++)=((*(s1++))*a+(*(s2++))*b+(*(s3++))*c)>>12; |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
205 else |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
206 while (ptr<ptr2) |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
207 *(ptr++)=((*(s2++))*b+(*(s3++))*c)>>12; |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
208 } |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
209 |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
210 |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
211 static void final(Real144_internal *glob, short *i1, short *i2, void *out, int *statbuf, int len) |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
212 { |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
213 int x,sum; |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
214 int buffer[10]; |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
215 short *ptr; |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
216 short *ptr2; |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
217 |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
218 memcpy(glob->work,statbuf,20); |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
219 memcpy(glob->work+10,i2,len*2); |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
220 |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
221 buffer[9]=i1[0]; |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
222 buffer[8]=i1[1]; |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
223 buffer[7]=i1[2]; |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
224 buffer[6]=i1[3]; |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
225 buffer[5]=i1[4]; |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
226 buffer[4]=i1[5]; |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
227 buffer[3]=i1[6]; |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
228 buffer[2]=i1[7]; |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
229 buffer[1]=i1[8]; |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
230 buffer[0]=i1[9]; |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
231 |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
232 ptr2=(ptr=glob->work)+len; |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
233 while (ptr<ptr2) { |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
234 for(sum=0,x=0;x<=9;x++) |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
235 sum+=buffer[x]*(ptr[x]); |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
236 sum=sum>>12; |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
237 x=ptr[10]-sum; |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
238 if (x<-32768 || x>32767) |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
239 { |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
240 memset(out,0,len*2); |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
241 memset(statbuf,0,20); |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
242 return; |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
243 } |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
244 ptr[10]=x; |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
245 ptr++; |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
246 } |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
247 memcpy(out,ptr+10-len,len*2); |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
248 memcpy(statbuf,ptr,20); |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
249 } |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
250 |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
251 /* Decode 20-byte input */ |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
252 static void unpack_input(unsigned char *input, unsigned int *output) |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
253 { |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
254 unsigned int outbuffer[28]; |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
255 unsigned short inbuffer[10]; |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
256 unsigned int x; |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
257 unsigned int *ptr; |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
258 |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
259 /* fix endianness */ |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
260 for (x=0;x<20;x+=2) |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
261 inbuffer[x/2]=(input[x]<<8)+input[x+1]; |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
262 |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
263 /* unpack */ |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
264 ptr=outbuffer; |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
265 *(ptr++)=27; |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
266 *(ptr++)=(inbuffer[0]>>10)&0x3f; |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
267 *(ptr++)=(inbuffer[0]>>5)&0x1f; |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
268 *(ptr++)=inbuffer[0]&0x1f; |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
269 *(ptr++)=(inbuffer[1]>>12)&0xf; |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
270 *(ptr++)=(inbuffer[1]>>8)&0xf; |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
271 *(ptr++)=(inbuffer[1]>>5)&7; |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
272 *(ptr++)=(inbuffer[1]>>2)&7; |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
273 *(ptr++)=((inbuffer[1]<<1)&6)|((inbuffer[2]>>15)&1); |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
274 *(ptr++)=(inbuffer[2]>>12)&7; |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
275 *(ptr++)=(inbuffer[2]>>10)&3; |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
276 *(ptr++)=(inbuffer[2]>>5)&0x1f; |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
277 *(ptr++)=((inbuffer[2]<<2)&0x7c)|((inbuffer[3]>>14)&3); |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
278 *(ptr++)=(inbuffer[3]>>6)&0xff; |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
279 *(ptr++)=((inbuffer[3]<<1)&0x7e)|((inbuffer[4]>>15)&1); |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
280 *(ptr++)=(inbuffer[4]>>8)&0x7f; |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
281 *(ptr++)=(inbuffer[4]>>1)&0x7f; |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
282 *(ptr++)=((inbuffer[4]<<7)&0x80)|((inbuffer[5]>>9)&0x7f); |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
283 *(ptr++)=(inbuffer[5]>>2)&0x7f; |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
284 *(ptr++)=((inbuffer[5]<<5)&0x60)|((inbuffer[6]>>11)&0x1f); |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
285 *(ptr++)=(inbuffer[6]>>4)&0x7f; |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
286 *(ptr++)=((inbuffer[6]<<4)&0xf0)|((inbuffer[7]>>12)&0xf); |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
287 *(ptr++)=(inbuffer[7]>>5)&0x7f; |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
288 *(ptr++)=((inbuffer[7]<<2)&0x7c)|((inbuffer[8]>>14)&3); |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
289 *(ptr++)=(inbuffer[8]>>7)&0x7f; |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
290 *(ptr++)=((inbuffer[8]<<1)&0xfe)|((inbuffer[9]>>15)&1); |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
291 *(ptr++)=(inbuffer[9]>>8)&0x7f; |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
292 *(ptr++)=(inbuffer[9]>>1)&0x7f; |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
293 |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
294 *(output++)=outbuffer[11]; |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
295 for (x=1;x<11;*(output++)=outbuffer[x++]); |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
296 ptr=outbuffer+12; |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
297 for (x=0;x<16;x+=4) |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
298 { |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
299 *(output++)=ptr[x]; |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
300 *(output++)=ptr[x+2]; |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
301 *(output++)=ptr[x+3]; |
2967 | 302 *(output++)=ptr[x+1]; |
1304
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
303 } |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
304 } |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
305 |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
306 static unsigned int rms(int *data, int f) |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
307 { |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
308 int *c; |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
309 int x; |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
310 unsigned int res; |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
311 int b; |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
312 |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
313 c=data; |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
314 b=0; |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
315 res=0x10000; |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
316 for (x=0;x<10;x++) |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
317 { |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
318 res=(((0x1000000-(*c)*(*c))>>12)*res)>>12; |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
319 if (res==0) return 0; |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
320 if (res<=0x3fff) |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
321 { |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
322 while (res<=0x3fff) |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
323 { |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
324 b++; |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
325 res<<=2; |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
326 } |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
327 } else { |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
328 if (res>0x10000) |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
329 return 0; /* We're screwed, might as well go out with a bang. :P */ |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
330 } |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
331 c++; |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
332 } |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
333 if (res>0) res=t_sqrt(res); |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
334 |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
335 res>>=(b+10); |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
336 res=(res*f)>>10; |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
337 return res; |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
338 } |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
339 |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
340 static void dec1(Real144_internal *glob, int *data, int *inp, int n, int f) |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
341 { |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
342 short *ptr,*end; |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
343 |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
344 *(glob->decptr++)=rms(data,f); |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
345 glob->decptr++; |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
346 end=(ptr=glob->decsp)+(n*10); |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
347 while (ptr<end) *(ptr++)=*(inp++); |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
348 } |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
349 |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
350 static int eq(Real144_internal *glob, short *in, int *target) |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
351 { |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
352 int retval; |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
353 int a; |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
354 int b; |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
355 int c; |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
356 unsigned int u; |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
357 short *sptr; |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
358 int *ptr1,*ptr2,*ptr3; |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
359 int *bp1,*bp2,*temp; |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
360 |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
361 retval=0; |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
362 bp1=glob->buffer1; |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
363 bp2=glob->buffer2; |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
364 ptr2=(ptr3=glob->buffer2)+9; |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
365 sptr=in; |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
366 while (ptr2>=ptr3) |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
367 *(ptr3++)=*(sptr++); |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
368 |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
369 target+=9; |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
370 a=bp2[9]; |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
371 *target=a; |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
372 if (a+0x1000>0x1fff) |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
373 return 0; /* We're screwed, might as well go out with a bang. :P */ |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
374 c=8;u=a; |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
375 while (c>=0) |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
376 { |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
377 if (u==0x1000) u++; |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
378 if (u==0xfffff000) u--; |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
379 b=0x1000-((u*u)>>12); |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
380 if (b==0) b++; |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
381 ptr2=bp1; |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
382 ptr1=(ptr3=bp2)+c; |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
383 for (u=0;u<=c;u++) |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
384 *(ptr2++)=((*(ptr3++)-(((*target)*(*(ptr1--)))>>12))*(0x1000000/b))>>12; |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
385 *(--target)=u=bp1[(c--)]; |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
386 if ((u+0x1000)>0x1fff) retval=1; |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
387 temp=bp2; |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
388 bp2=bp1; |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
389 bp1=temp; |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
390 } |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
391 return retval; |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
392 } |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
393 |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
394 static void dec2(Real144_internal *glob, int *data, int *inp, int n, int f, int *inp2, int l) |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
395 { |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
396 unsigned int *ptr1,*ptr2; |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
397 int work[10]; |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
398 int a,b; |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
399 int x; |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
400 int result; |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
401 |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
402 if(l+1<NBLOCKS/2) a=NBLOCKS-(l+1); |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
403 else a=l+1; |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
404 b=NBLOCKS-a; |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
405 if (l==0) |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
406 { |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
407 glob->decsp=glob->sptr=glob->gbuf2; |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
408 glob->decptr=glob->gbuf1; |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
409 } |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
410 ptr1=inp; |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
411 ptr2=inp2; |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
412 for (x=0;x<10*n;x++) |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
413 *(glob->sptr++)=(a*(*ptr1++)+b*(*ptr2++))>>2; |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
414 result=eq(glob,glob->decsp,work); |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
415 if (result==1) |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
416 { |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
417 dec1(glob,data,inp,n,f); |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
418 } else { |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
419 *(glob->decptr++)=rms(work,f); |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
420 glob->decptr++; |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
421 } |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
422 glob->decsp+=n*10; |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
423 } |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
424 |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
425 /* Uncompress one block (20 bytes -> 160*2 bytes) */ |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
426 static int ra144_decode_frame(AVCodecContext * avctx, |
1781
bbb6e7667671
cleanup ugly code (also appearently works around a bug gcc 3.4 which fails compiling it) by (mru at kth dot se (Mns Rullgrd))
michael
parents:
1415
diff
changeset
|
427 void *vdata, int *data_size, |
1304
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
428 uint8_t * buf, int buf_size) |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
429 { |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
430 unsigned int a,b,c; |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
431 long s; |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
432 signed short *shptr; |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
433 unsigned int *lptr,*temp; |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
434 const short **dptr; |
1781
bbb6e7667671
cleanup ugly code (also appearently works around a bug gcc 3.4 which fails compiling it) by (mru at kth dot se (Mns Rullgrd))
michael
parents:
1415
diff
changeset
|
435 int16_t *datao; |
bbb6e7667671
cleanup ugly code (also appearently works around a bug gcc 3.4 which fails compiling it) by (mru at kth dot se (Mns Rullgrd))
michael
parents:
1415
diff
changeset
|
436 int16_t *data = vdata; |
1304
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
437 Real144_internal *glob=avctx->priv_data; |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
438 |
1788 | 439 if(buf_size==0) |
440 return 0; | |
2967 | 441 |
1304
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
442 datao = data; |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
443 unpack_input(buf,glob->unpacked); |
2967 | 444 |
1304
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
445 glob->iptr=glob->unpacked; |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
446 glob->val=decodetable[0][(*(glob->iptr++))<<1]; |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
447 |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
448 dptr=decodetable+1; |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
449 lptr=glob->swapbuf1; |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
450 while (lptr<glob->swapbuf1+10) |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
451 *(lptr++)=(*(dptr++))[(*(glob->iptr++))<<1]; |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
452 |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
453 do_voice(glob->swapbuf1,glob->swapbuf2); |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
454 |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
455 a=t_sqrt(glob->val*glob->oldval)>>12; |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
456 |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
457 for (c=0;c<NBLOCKS;c++) { |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
458 if (c==(NBLOCKS-1)) { |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
459 dec1(glob,glob->swapbuf1,glob->swapbuf2,3,glob->val); |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
460 } else { |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
461 if (c*2==(NBLOCKS-2)) { |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
462 if (glob->oldval<glob->val) { |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
463 dec2(glob,glob->swapbuf1,glob->swapbuf2,3,a,glob->swapbuf2alt,c); |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
464 } else { |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
465 dec2(glob,glob->swapbuf1alt,glob->swapbuf2alt,3,a,glob->swapbuf2,c); |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
466 } |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
467 } else { |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
468 if (c*2<(NBLOCKS-2)) { |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
469 dec2(glob,glob->swapbuf1alt,glob->swapbuf2alt,3,glob->oldval,glob->swapbuf2,c); |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
470 } else { |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
471 dec2(glob,glob->swapbuf1,glob->swapbuf2,3,glob->val,glob->swapbuf2alt,c); |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
472 } |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
473 } |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
474 } |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
475 } |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
476 |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
477 /* do output */ |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
478 for (b=0,c=0;c<4;c++) { |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
479 glob->gval=glob->gbuf1[c*2]; |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
480 glob->gsp=glob->gbuf2+b; |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
481 do_output_subblock(glob,glob->resetflag); |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
482 glob->resetflag=0; |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
483 |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
484 shptr=glob->output_buffer; |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
485 while (shptr<glob->output_buffer+BLOCKSIZE) { |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
486 s=*(shptr++)<<2; |
1781
bbb6e7667671
cleanup ugly code (also appearently works around a bug gcc 3.4 which fails compiling it) by (mru at kth dot se (Mns Rullgrd))
michael
parents:
1415
diff
changeset
|
487 *data=s; |
bbb6e7667671
cleanup ugly code (also appearently works around a bug gcc 3.4 which fails compiling it) by (mru at kth dot se (Mns Rullgrd))
michael
parents:
1415
diff
changeset
|
488 if (s>32767) *data=32767; |
bbb6e7667671
cleanup ugly code (also appearently works around a bug gcc 3.4 which fails compiling it) by (mru at kth dot se (Mns Rullgrd))
michael
parents:
1415
diff
changeset
|
489 if (s<-32767) *data=-32768; |
bbb6e7667671
cleanup ugly code (also appearently works around a bug gcc 3.4 which fails compiling it) by (mru at kth dot se (Mns Rullgrd))
michael
parents:
1415
diff
changeset
|
490 data++; |
1304
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
491 } |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
492 b+=30; |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
493 } |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
494 |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
495 glob->oldval=glob->val; |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
496 temp=glob->swapbuf1alt; |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
497 glob->swapbuf1alt=glob->swapbuf1; |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
498 glob->swapbuf1=temp; |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
499 temp=glob->swapbuf2alt; |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
500 glob->swapbuf2alt=glob->swapbuf2; |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
501 glob->swapbuf2=temp; |
1781
bbb6e7667671
cleanup ugly code (also appearently works around a bug gcc 3.4 which fails compiling it) by (mru at kth dot se (Mns Rullgrd))
michael
parents:
1415
diff
changeset
|
502 *data_size=(data-datao)*sizeof(*data); |
1304
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
503 return 20; |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
504 } |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
505 |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
506 |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
507 AVCodec ra_144_decoder = |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
508 { |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
509 "real_144", |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
510 CODEC_TYPE_AUDIO, |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
511 CODEC_ID_RA_144, |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
512 sizeof(Real144_internal), |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
513 ra144_decode_init, |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
514 NULL, |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
515 NULL, |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
516 ra144_decode_frame, |
e8543aab0cc9
RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a mplayerhq (originally from public domain player for Amiga
nickols_k
parents:
diff
changeset
|
517 }; |