comparison libmpcodecs/native/decode144.h @ 10260:597ad4eb02fc

RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from a public domain player for Amiga at http://www.honeypot.net/audio
author rtognimp
date Sun, 08 Jun 2003 20:25:28 +0000
parents
children
comparison
equal deleted inserted replaced
10259:b60e89268837 10260:597ad4eb02fc
1 #ifndef DECODE144_H
2 #define DECODE144_H
3
4 /* internal globals */
5 typedef struct {
6 unsigned int resetflag, val, oldval;
7 unsigned int unpacked[28]; /* buffer for unpacked input */
8 unsigned int *iptr; /* pointer to current input (from unpacked) */
9 unsigned int gval;
10 unsigned short *gsp;
11 unsigned int gbuf1[8];
12 unsigned short gbuf2[120];
13 signed short output_buffer[40];
14 unsigned int *decptr; /* decoder ptr */
15 signed short *decsp;
16
17 /* the swapped buffers */
18 unsigned int swapb1a[10];
19 unsigned int swapb2a[10];
20 unsigned int swapb1b[10];
21 unsigned int swapb2b[10];
22 unsigned int *swapbuf1;
23 unsigned int *swapbuf2;
24 unsigned int *swapbuf1alt;
25 unsigned int *swapbuf2alt;
26
27 unsigned int buffer[5];
28 unsigned short int buffer_2[148];
29 unsigned short int buffer_a[40];
30 unsigned short int buffer_b[40];
31 unsigned short int buffer_c[40];
32 unsigned short int buffer_d[40];
33
34 unsigned short int work[50];
35 unsigned short *sptr;
36
37 int buffer1[10];
38 int buffer2[10];
39
40 signed short wavtable1[2304];
41 unsigned short wavtable2[2304];
42 } Real_internal;
43
44 /* consts */
45 #define NBLOCKS 4 /* number of segments within a block */
46 #define BLOCKSIZE 40 /* (quarter) block size in 16-bit words (80 bytes) */
47 #define HALFBLOCK 20 /* BLOCKSIZE/2 */
48 #define BUFFERSIZE 146 /* for do_output */
49
50 /* prototypes */
51 static int t_sqrt (unsigned int x);
52 static void do_voice (int *a1, int *a2);
53 static void do_output_subblock (Real_internal *glob, int x);
54 static void rotate_block (short *source, short *target, int offset);
55 static int irms (short *data, int factor);
56 static void add_wav (Real_internal *glob, int n, int f, int m1, int m2, int m3, short *s1, short *s2, short *s3, short *dest);
57 static void final (Real_internal *glob, short *i1, short *i2, void *out, int *statbuf, int len);
58 static void unpack_input (unsigned char *input, unsigned int *output);
59 static unsigned int rms (int *data, int f);
60 static void dec1 (Real_internal *glob, int *data, int *inp, int n, int f);
61 static void dec2 (Real_internal *glob, int *data, int *inp, int n, int f, int *inp2, int l);
62 static int eq (Real_internal *glob, short *in, int *target);
63
64 #endif /* !DECODE144_H */