Mercurial > libavcodec.hg
comparison ra144.c @ 2979:bfabfdf9ce55 libavcodec
COSMETICS: tabs --> spaces, some prettyprinting
author | diego |
---|---|
date | Thu, 22 Dec 2005 01:10:11 +0000 |
parents | ef2149182f1c |
children | 0b546eab515d |
comparison
equal
deleted
inserted
replaced
2978:403183bbb505 | 2979:bfabfdf9ce55 |
---|---|
18 */ | 18 */ |
19 | 19 |
20 #include "avcodec.h" | 20 #include "avcodec.h" |
21 #include "ra144.h" | 21 #include "ra144.h" |
22 | 22 |
23 #define DATABLOCK1 20 /* size of 14.4 input block in bytes */ | 23 #define DATABLOCK1 20 /* size of 14.4 input block in bytes */ |
24 #define DATACHUNK1 1440 /* size of 14.4 input chunk 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) */ | 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) */ | 26 #define AUDIOBUFFER 12288 /* size of output buffer in 16-bit words (24576 bytes) */ |
27 /* consts */ | 27 /* consts */ |
28 #define NBLOCKS 4 /* number of segments within a block */ | 28 #define NBLOCKS 4 /* number of segments within a block */ |
29 #define BLOCKSIZE 40 /* (quarter) block size in 16-bit words (80 bytes) */ | 29 #define BLOCKSIZE 40 /* (quarter) block size in 16-bit words (80 bytes) */ |
30 #define HALFBLOCK 20 /* BLOCKSIZE/2 */ | 30 #define HALFBLOCK 20 /* BLOCKSIZE/2 */ |
31 #define BUFFERSIZE 146 /* for do_output */ | 31 #define BUFFERSIZE 146 /* for do_output */ |
32 | 32 |
33 | 33 |
34 /* internal globals */ | 34 /* internal globals */ |
35 typedef struct { | 35 typedef struct { |
36 unsigned int resetflag, val, oldval; | 36 unsigned int resetflag, val, oldval; |
37 unsigned int unpacked[28]; /* buffer for unpacked input */ | 37 unsigned int unpacked[28]; /* buffer for unpacked input */ |
38 unsigned int *iptr; /* pointer to current input (from unpacked) */ | 38 unsigned int *iptr; /* pointer to current input (from unpacked) */ |
39 unsigned int gval; | 39 unsigned int gval; |
40 unsigned short *gsp; | 40 unsigned short *gsp; |
41 unsigned int gbuf1[8]; | 41 unsigned int gbuf1[8]; |
42 unsigned short gbuf2[120]; | 42 unsigned short gbuf2[120]; |
43 signed short output_buffer[40]; | 43 signed short output_buffer[40]; |
44 unsigned int *decptr; /* decoder ptr */ | 44 unsigned int *decptr; /* decoder ptr */ |
45 signed short *decsp; | 45 signed short *decsp; |
46 | 46 |
47 /* the swapped buffers */ | 47 /* the swapped buffers */ |
48 unsigned int swapb1a[10]; | 48 unsigned int swapb1a[10]; |
49 unsigned int swapb2a[10]; | 49 unsigned int swapb2a[10]; |
50 unsigned int swapb1b[10]; | 50 unsigned int swapb1b[10]; |
51 unsigned int swapb2b[10]; | 51 unsigned int swapb2b[10]; |
52 unsigned int *swapbuf1; | 52 unsigned int *swapbuf1; |
53 unsigned int *swapbuf2; | 53 unsigned int *swapbuf2; |
54 unsigned int *swapbuf1alt; | 54 unsigned int *swapbuf1alt; |
55 unsigned int *swapbuf2alt; | 55 unsigned int *swapbuf2alt; |
56 | 56 |
57 unsigned int buffer[5]; | 57 unsigned int buffer[5]; |
58 unsigned short int buffer_2[148]; | 58 unsigned short int buffer_2[148]; |
59 unsigned short int buffer_a[40]; | 59 unsigned short int buffer_a[40]; |
60 unsigned short int buffer_b[40]; | 60 unsigned short int buffer_b[40]; |
61 unsigned short int buffer_c[40]; | 61 unsigned short int buffer_c[40]; |
62 unsigned short int buffer_d[40]; | 62 unsigned short int buffer_d[40]; |
63 | 63 |
64 unsigned short int work[50]; | 64 unsigned short int work[50]; |
65 unsigned short *sptr; | 65 unsigned short *sptr; |
66 | 66 |
67 int buffer1[10]; | 67 int buffer1[10]; |
68 int buffer2[10]; | 68 int buffer2[10]; |
69 | 69 |
70 signed short wavtable1[2304]; | 70 signed short wavtable1[2304]; |
71 unsigned short wavtable2[2304]; | 71 unsigned short wavtable2[2304]; |
72 } Real144_internal; | 72 } Real144_internal; |
73 | 73 |
74 static int ra144_decode_init(AVCodecContext * avctx) | 74 static int ra144_decode_init(AVCodecContext * avctx) |
75 { | 75 { |
76 Real144_internal *glob=avctx->priv_data; | 76 Real144_internal *glob=avctx->priv_data; |
77 | 77 |
78 memset(glob,0,sizeof(Real144_internal)); | 78 memset(glob,0,sizeof(Real144_internal)); |
79 glob->resetflag=1; | 79 glob->resetflag=1; |
80 glob->swapbuf1=glob->swapb1a; | 80 glob->swapbuf1=glob->swapb1a; |
81 glob->swapbuf2=glob->swapb2a; | 81 glob->swapbuf2=glob->swapb2a; |
82 glob->swapbuf1alt=glob->swapb1b; | 82 glob->swapbuf1alt=glob->swapb1b; |
83 glob->swapbuf2alt=glob->swapb2b; | 83 glob->swapbuf2alt=glob->swapb2b; |
84 | 84 |
85 memcpy(glob->wavtable1,wavtable1,sizeof(wavtable1)); | 85 memcpy(glob->wavtable1,wavtable1,sizeof(wavtable1)); |
86 memcpy(glob->wavtable2,wavtable2,sizeof(wavtable2)); | 86 memcpy(glob->wavtable2,wavtable2,sizeof(wavtable2)); |
87 | 87 |
88 return 0; | 88 return 0; |
89 } | 89 } |
90 | 90 |
91 static void final(Real144_internal *glob, short *i1, short *i2, void *out, int *statbuf, int len); | 91 static void final(Real144_internal *glob, short *i1, short *i2, void *out, int *statbuf, int len); |
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); | 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); |
93 static int irms(short *data, int factor); | 93 static int irms(short *data, int factor); |