diff options
Diffstat (limited to 'apps/codecs/libwavpack/wavpack.h')
-rw-r--r-- | apps/codecs/libwavpack/wavpack.h | 67 |
1 files changed, 33 insertions, 34 deletions
diff --git a/apps/codecs/libwavpack/wavpack.h b/apps/codecs/libwavpack/wavpack.h index e26cac353a..593af7831d 100644 --- a/apps/codecs/libwavpack/wavpack.h +++ b/apps/codecs/libwavpack/wavpack.h | |||
@@ -16,7 +16,6 @@ | |||
16 | 16 | ||
17 | typedef unsigned char uchar; | 17 | typedef unsigned char uchar; |
18 | typedef unsigned short ushort; | 18 | typedef unsigned short ushort; |
19 | typedef unsigned long ulong; | ||
20 | typedef unsigned int uint; | 19 | typedef unsigned int uint; |
21 | 20 | ||
22 | // This structure is used to access the individual fields of 32-bit ieee | 21 | // This structure is used to access the individual fields of 32-bit ieee |
@@ -43,10 +42,10 @@ typedef struct { | |||
43 | 42 | ||
44 | typedef struct { | 43 | typedef struct { |
45 | char ckID [4]; | 44 | char ckID [4]; |
46 | ulong ckSize; | 45 | uint32_t ckSize; |
47 | short version; | 46 | short version; |
48 | uchar track_no, index_no; | 47 | uchar track_no, index_no; |
49 | ulong total_samples, block_index, block_samples, flags, crc; | 48 | uint32_t total_samples, block_index, block_samples, flags, crc; |
50 | } WavpackHeader; | 49 | } WavpackHeader; |
51 | 50 | ||
52 | #define WavpackHeaderFormat "4LS2LLLLL" | 51 | #define WavpackHeaderFormat "4LS2LLLLL" |
@@ -88,7 +87,7 @@ typedef struct { | |||
88 | 87 | ||
89 | typedef struct { | 88 | typedef struct { |
90 | uchar temp_data [64]; | 89 | uchar temp_data [64]; |
91 | long byte_length; | 90 | int32_t byte_length; |
92 | void *data; | 91 | void *data; |
93 | uchar id; | 92 | uchar id; |
94 | } WavpackMetadata; | 93 | } WavpackMetadata; |
@@ -128,7 +127,7 @@ typedef struct { | |||
128 | typedef struct { | 127 | typedef struct { |
129 | int bits_per_sample, bytes_per_sample; | 128 | int bits_per_sample, bytes_per_sample; |
130 | int flags, num_channels, float_norm_exp; | 129 | int flags, num_channels, float_norm_exp; |
131 | ulong sample_rate, channel_mask; | 130 | uint32_t sample_rate, channel_mask; |
132 | } WavpackConfig; | 131 | } WavpackConfig; |
133 | 132 | ||
134 | #define CONFIG_BYTES_STORED 3 // 1-4 bytes/sample | 133 | #define CONFIG_BYTES_STORED 3 // 1-4 bytes/sample |
@@ -169,12 +168,12 @@ typedef struct { | |||
169 | // pointers to hold a complete allocated block of WavPack data, although it's | 168 | // pointers to hold a complete allocated block of WavPack data, although it's |
170 | // possible to decode WavPack blocks without buffering an entire block. | 169 | // possible to decode WavPack blocks without buffering an entire block. |
171 | 170 | ||
172 | typedef long (*read_stream)(void *, long); | 171 | typedef int32_t (*read_stream)(void *, int32_t); |
173 | 172 | ||
174 | typedef struct bs { | 173 | typedef struct bs { |
175 | uchar *buf, *end, *ptr; | 174 | uchar *buf, *end, *ptr; |
176 | void (*wrap)(struct bs *bs); | 175 | void (*wrap)(struct bs *bs); |
177 | ulong file_bytes, sr; | 176 | uint32_t file_bytes, sr; |
178 | int error, bc; | 177 | int error, bc; |
179 | read_stream file; | 178 | read_stream file; |
180 | } Bitstream; | 179 | } Bitstream; |
@@ -184,16 +183,16 @@ typedef struct bs { | |||
184 | 183 | ||
185 | struct decorr_pass { | 184 | struct decorr_pass { |
186 | short term, delta, weight_A, weight_B; | 185 | short term, delta, weight_A, weight_B; |
187 | long samples_A [MAX_TERM], samples_B [MAX_TERM]; | 186 | int32_t samples_A [MAX_TERM], samples_B [MAX_TERM]; |
188 | }; | 187 | }; |
189 | 188 | ||
190 | struct entropy_data { | 189 | struct entropy_data { |
191 | ulong median [3], slow_level, error_limit; | 190 | uint32_t median [3], slow_level, error_limit; |
192 | }; | 191 | }; |
193 | 192 | ||
194 | struct words_data { | 193 | struct words_data { |
195 | ulong bitrate_delta [2], bitrate_acc [2]; | 194 | uint32_t bitrate_delta [2], bitrate_acc [2]; |
196 | ulong pend_data, holding_one, zeros_acc; | 195 | uint32_t pend_data, holding_one, zeros_acc; |
197 | int holding_zero, pend_count; | 196 | int holding_zero, pend_count; |
198 | struct entropy_data c [2]; | 197 | struct entropy_data c [2]; |
199 | }; | 198 | }; |
@@ -205,7 +204,7 @@ typedef struct { | |||
205 | struct words_data w; | 204 | struct words_data w; |
206 | 205 | ||
207 | int num_terms, mute_error; | 206 | int num_terms, mute_error; |
208 | ulong sample_index, crc; | 207 | uint32_t sample_index, crc; |
209 | 208 | ||
210 | uchar int32_sent_bits, int32_zeros, int32_ones, int32_dups; | 209 | uchar int32_sent_bits, int32_zeros, int32_ones, int32_dups; |
211 | uchar float_flags, float_shift, float_max_exp, float_norm_exp; | 210 | uchar float_flags, float_shift, float_max_exp, float_norm_exp; |
@@ -241,7 +240,7 @@ typedef struct { | |||
241 | char error_message [80]; | 240 | char error_message [80]; |
242 | 241 | ||
243 | read_stream infile; | 242 | read_stream infile; |
244 | ulong total_samples, crc_errors, first_flags; | 243 | uint32_t total_samples, crc_errors, first_flags; |
245 | int open_flags, norm_offset, reduced_channels, lossy_blocks; | 244 | int open_flags, norm_offset, reduced_channels, lossy_blocks; |
246 | 245 | ||
247 | } WavpackContext; | 246 | } WavpackContext; |
@@ -252,9 +251,9 @@ typedef struct { | |||
252 | 251 | ||
253 | // bits.c | 252 | // bits.c |
254 | 253 | ||
255 | void bs_open_read (Bitstream *bs, uchar *buffer_start, uchar *buffer_end, read_stream file, ulong file_bytes); | 254 | void bs_open_read (Bitstream *bs, uchar *buffer_start, uchar *buffer_end, read_stream file, uint32_t file_bytes); |
256 | void bs_open_write (Bitstream *bs, uchar *buffer_start, uchar *buffer_end); | 255 | void bs_open_write (Bitstream *bs, uchar *buffer_start, uchar *buffer_end); |
257 | ulong bs_close_write (Bitstream *bs); | 256 | uint32_t bs_close_write (Bitstream *bs); |
258 | 257 | ||
259 | #define bs_is_open(bs) ((bs)->ptr != NULL) | 258 | #define bs_is_open(bs) ((bs)->ptr != NULL) |
260 | 259 | ||
@@ -270,7 +269,7 @@ ulong bs_close_write (Bitstream *bs); | |||
270 | #define getbits(value, nbits, bs) { \ | 269 | #define getbits(value, nbits, bs) { \ |
271 | while ((nbits) > (bs)->bc) { \ | 270 | while ((nbits) > (bs)->bc) { \ |
272 | if (++((bs)->ptr) == (bs)->end) (bs)->wrap (bs); \ | 271 | if (++((bs)->ptr) == (bs)->end) (bs)->wrap (bs); \ |
273 | (bs)->sr |= (long)*((bs)->ptr) << (bs)->bc; \ | 272 | (bs)->sr |= (int32_t)*((bs)->ptr) << (bs)->bc; \ |
274 | (bs)->bc += 8; \ | 273 | (bs)->bc += 8; \ |
275 | } \ | 274 | } \ |
276 | *(value) = (bs)->sr; \ | 275 | *(value) = (bs)->sr; \ |
@@ -300,7 +299,7 @@ ulong bs_close_write (Bitstream *bs); | |||
300 | }} | 299 | }} |
301 | 300 | ||
302 | #define putbits(value, nbits, bs) { \ | 301 | #define putbits(value, nbits, bs) { \ |
303 | (bs)->sr |= (long)(value) << (bs)->bc; \ | 302 | (bs)->sr |= (int32_t)(value) << (bs)->bc; \ |
304 | if (((bs)->bc += (nbits)) >= 8) \ | 303 | if (((bs)->bc += (nbits)) >= 8) \ |
305 | do { \ | 304 | do { \ |
306 | *((bs)->ptr) = (bs)->sr; \ | 305 | *((bs)->ptr) = (bs)->sr; \ |
@@ -354,14 +353,14 @@ int read_float_info (WavpackStream *wps, WavpackMetadata *wpmd); | |||
354 | int read_int32_info (WavpackStream *wps, WavpackMetadata *wpmd); | 353 | int read_int32_info (WavpackStream *wps, WavpackMetadata *wpmd); |
355 | int read_channel_info (WavpackContext *wpc, WavpackMetadata *wpmd); | 354 | int read_channel_info (WavpackContext *wpc, WavpackMetadata *wpmd); |
356 | int read_config_info (WavpackContext *wpc, WavpackMetadata *wpmd); | 355 | int read_config_info (WavpackContext *wpc, WavpackMetadata *wpmd); |
357 | long unpack_samples (WavpackContext *wpc, long *buffer, ulong sample_count); | 356 | int32_t unpack_samples (WavpackContext *wpc, int32_t *buffer, uint32_t sample_count); |
358 | int check_crc_error (WavpackContext *wpc); | 357 | int check_crc_error (WavpackContext *wpc); |
359 | 358 | ||
360 | // pack.c | 359 | // pack.c |
361 | 360 | ||
362 | void pack_init (WavpackContext *wpc); | 361 | void pack_init (WavpackContext *wpc); |
363 | int pack_start_block (WavpackContext *wpc); | 362 | int pack_start_block (WavpackContext *wpc); |
364 | int pack_samples (WavpackContext *wpc, long *buffer, ulong sample_count); | 363 | int pack_samples (WavpackContext *wpc, int32_t *buffer, uint32_t sample_count); |
365 | int pack_finish_block (WavpackContext *wpc); | 364 | int pack_finish_block (WavpackContext *wpc); |
366 | 365 | ||
367 | // metadata.c stuff | 366 | // metadata.c stuff |
@@ -377,15 +376,15 @@ void init_words (WavpackStream *wps); | |||
377 | int read_entropy_vars (WavpackStream *wps, WavpackMetadata *wpmd); | 376 | int read_entropy_vars (WavpackStream *wps, WavpackMetadata *wpmd); |
378 | void write_entropy_vars (WavpackStream *wps, WavpackMetadata *wpmd); | 377 | void write_entropy_vars (WavpackStream *wps, WavpackMetadata *wpmd); |
379 | int read_hybrid_profile (WavpackStream *wps, WavpackMetadata *wpmd); | 378 | int read_hybrid_profile (WavpackStream *wps, WavpackMetadata *wpmd); |
380 | long get_words (long *buffer, int nsamples, ulong flags, | 379 | int32_t get_words (int32_t *buffer, int nsamples, uint32_t flags, |
381 | struct words_data *w, Bitstream *bs); | 380 | struct words_data *w, Bitstream *bs); |
382 | void send_word_lossless (long value, int chan, | 381 | void send_word_lossless (int32_t value, int chan, |
383 | struct words_data *w, Bitstream *bs); | 382 | struct words_data *w, Bitstream *bs); |
384 | void send_words (long *buffer, int nsamples, ulong flags, | 383 | void send_words (int32_t *buffer, int nsamples, uint32_t flags, |
385 | struct words_data *w, Bitstream *bs); | 384 | struct words_data *w, Bitstream *bs); |
386 | void flush_word (struct words_data *w, Bitstream *bs); | 385 | void flush_word (struct words_data *w, Bitstream *bs); |
387 | int log2s (long value); | 386 | int log2s (int32_t value); |
388 | long exp2s (int log); | 387 | int32_t exp2s (int log); |
389 | signed char store_weight (int weight); | 388 | signed char store_weight (int weight); |
390 | int restore_weight (signed char weight); | 389 | int restore_weight (signed char weight); |
391 | 390 | ||
@@ -394,8 +393,8 @@ int restore_weight (signed char weight); | |||
394 | // float.c | 393 | // float.c |
395 | 394 | ||
396 | int read_float_info (WavpackStream *wps, WavpackMetadata *wpmd); | 395 | int read_float_info (WavpackStream *wps, WavpackMetadata *wpmd); |
397 | void float_values (WavpackStream *wps, long *values, long num_values); | 396 | void float_values (WavpackStream *wps, int32_t *values, int32_t num_values); |
398 | void float_normalize (long *values, long num_values, int delta_exp); | 397 | void float_normalize (int32_t *values, int32_t num_values, int delta_exp); |
399 | 398 | ||
400 | // wputils.c | 399 | // wputils.c |
401 | 400 | ||
@@ -411,21 +410,21 @@ int WavpackGetMode (WavpackContext *wpc); | |||
411 | #define MODE_HIGH 0x20 | 410 | #define MODE_HIGH 0x20 |
412 | #define MODE_FAST 0x40 | 411 | #define MODE_FAST 0x40 |
413 | 412 | ||
414 | ulong WavpackUnpackSamples (WavpackContext *wpc, long *buffer, ulong samples); | 413 | uint32_t WavpackUnpackSamples (WavpackContext *wpc, int32_t *buffer, uint32_t samples); |
415 | ulong WavpackGetNumSamples (WavpackContext *wpc); | 414 | uint32_t WavpackGetNumSamples (WavpackContext *wpc); |
416 | ulong WavpackGetSampleIndex (WavpackContext *wpc); | 415 | uint32_t WavpackGetSampleIndex (WavpackContext *wpc); |
417 | int WavpackGetNumErrors (WavpackContext *wpc); | 416 | int WavpackGetNumErrors (WavpackContext *wpc); |
418 | int WavpackLossyBlocks (WavpackContext *wpc); | 417 | int WavpackLossyBlocks (WavpackContext *wpc); |
419 | ulong WavpackGetSampleRate (WavpackContext *wpc); | 418 | uint32_t WavpackGetSampleRate (WavpackContext *wpc); |
420 | int WavpackGetBitsPerSample (WavpackContext *wpc); | 419 | int WavpackGetBitsPerSample (WavpackContext *wpc); |
421 | int WavpackGetBytesPerSample (WavpackContext *wpc); | 420 | int WavpackGetBytesPerSample (WavpackContext *wpc); |
422 | int WavpackGetNumChannels (WavpackContext *wpc); | 421 | int WavpackGetNumChannels (WavpackContext *wpc); |
423 | int WavpackGetReducedChannels (WavpackContext *wpc); | 422 | int WavpackGetReducedChannels (WavpackContext *wpc); |
424 | WavpackContext *WavpackOpenFileOutput (void); | 423 | WavpackContext *WavpackOpenFileOutput (void); |
425 | int WavpackSetConfiguration (WavpackContext *wpc, WavpackConfig *config, ulong total_samples); | 424 | int WavpackSetConfiguration (WavpackContext *wpc, WavpackConfig *config, uint32_t total_samples); |
426 | void WavpackAddWrapper (WavpackContext *wpc, void *data, ulong bcount); | 425 | void WavpackAddWrapper (WavpackContext *wpc, void *data, uint32_t bcount); |
427 | int WavpackStartBlock (WavpackContext *wpc, uchar *begin, uchar *end); | 426 | int WavpackStartBlock (WavpackContext *wpc, uchar *begin, uchar *end); |
428 | int WavpackPackSamples (WavpackContext *wpc, long *sample_buffer, ulong sample_count); | 427 | int WavpackPackSamples (WavpackContext *wpc, int32_t *sample_buffer, uint32_t sample_count); |
429 | ulong WavpackFinishBlock (WavpackContext *wpc); | 428 | uint32_t WavpackFinishBlock (WavpackContext *wpc); |
430 | 429 | ||
431 | 430 | ||