react-native-tiny-wavpack-decoder 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +20 -0
- package/README.md +148 -0
- package/android/build.gradle +112 -0
- package/android/generated/java/com/tinywavpackdecoder/NativeTinyWavPackDecoderSpec.java +47 -0
- package/android/generated/jni/CMakeLists.txt +36 -0
- package/android/generated/jni/RNTinyWavPackDecoderSpec-generated.cpp +44 -0
- package/android/generated/jni/RNTinyWavPackDecoderSpec.h +31 -0
- package/android/generated/jni/react/renderer/components/RNTinyWavPackDecoderSpec/RNTinyWavPackDecoderSpecJSI-generated.cpp +46 -0
- package/android/generated/jni/react/renderer/components/RNTinyWavPackDecoderSpec/RNTinyWavPackDecoderSpecJSI.h +89 -0
- package/android/gradle.properties +5 -0
- package/android/src/main/AndroidManifest.xml +3 -0
- package/android/src/main/AndroidManifestNew.xml +2 -0
- package/android/src/main/cpp/CMakeLists.txt +54 -0
- package/android/src/main/cpp/TinyWavPackDecoderModule.cpp +118 -0
- package/android/src/main/java/com/tinywavpackdecoder/TinyWavPackDecoderModule.kt +114 -0
- package/android/src/main/java/com/tinywavpackdecoder/TinyWavPackDecoderPackage.kt +18 -0
- package/ios/TinyWavPackDecoder.h +8 -0
- package/ios/TinyWavPackDecoder.mm +83 -0
- package/ios/generated/RNTinyWavPackDecoderSpec/RNTinyWavPackDecoderSpec-generated.mm +53 -0
- package/ios/generated/RNTinyWavPackDecoderSpec/RNTinyWavPackDecoderSpec.h +69 -0
- package/ios/generated/RNTinyWavPackDecoderSpecJSI-generated.cpp +46 -0
- package/ios/generated/RNTinyWavPackDecoderSpecJSI.h +89 -0
- package/lib/module/NativeTinyWavPackDecoder.ts +19 -0
- package/lib/module/index.js +38 -0
- package/lib/module/index.js.map +1 -0
- package/lib/module/package.json +1 -0
- package/lib/module/tiny-wavpack/common/TinyWavPackDecoderInterface.c +414 -0
- package/lib/module/tiny-wavpack/common/TinyWavPackDecoderInterface.h +52 -0
- package/lib/module/tiny-wavpack/common/test.c +45 -0
- package/lib/module/tiny-wavpack/common/wv2wav +0 -0
- package/lib/module/tiny-wavpack/lib/bits.c +140 -0
- package/lib/module/tiny-wavpack/lib/float.c +50 -0
- package/lib/module/tiny-wavpack/lib/license.txt +25 -0
- package/lib/module/tiny-wavpack/lib/metadata.c +105 -0
- package/lib/module/tiny-wavpack/lib/readme.txt +68 -0
- package/lib/module/tiny-wavpack/lib/unpack.c +785 -0
- package/lib/module/tiny-wavpack/lib/wavpack.h +384 -0
- package/lib/module/tiny-wavpack/lib/words.c +560 -0
- package/lib/module/tiny-wavpack/lib/wputils.c +351 -0
- package/lib/typescript/package.json +1 -0
- package/lib/typescript/src/NativeTinyWavPackDecoder.d.ts +9 -0
- package/lib/typescript/src/NativeTinyWavPackDecoder.d.ts.map +1 -0
- package/lib/typescript/src/index.d.ts +18 -0
- package/lib/typescript/src/index.d.ts.map +1 -0
- package/package.json +195 -0
- package/react-native-wavpack-decoder.podspec +35 -0
- package/react-native.config.js +12 -0
- package/src/NativeTinyWavPackDecoder.ts +19 -0
- package/src/index.tsx +57 -0
- package/src/tiny-wavpack/common/TinyWavPackDecoderInterface.c +414 -0
- package/src/tiny-wavpack/common/TinyWavPackDecoderInterface.h +52 -0
- package/src/tiny-wavpack/common/test.c +45 -0
- package/src/tiny-wavpack/common/wv2wav +0 -0
- package/src/tiny-wavpack/lib/bits.c +140 -0
- package/src/tiny-wavpack/lib/float.c +50 -0
- package/src/tiny-wavpack/lib/license.txt +25 -0
- package/src/tiny-wavpack/lib/metadata.c +105 -0
- package/src/tiny-wavpack/lib/readme.txt +68 -0
- package/src/tiny-wavpack/lib/unpack.c +785 -0
- package/src/tiny-wavpack/lib/wavpack.h +384 -0
- package/src/tiny-wavpack/lib/words.c +560 -0
- package/src/tiny-wavpack/lib/wputils.c +351 -0
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
////////////////////////////////////////////////////////////////////////////
|
|
2
|
+
// **** WAVPACK **** //
|
|
3
|
+
// Hybrid Lossless Wavefile Compressor //
|
|
4
|
+
// Copyright (c) 1998 - 2006 Conifer Software. //
|
|
5
|
+
// All Rights Reserved. //
|
|
6
|
+
// Distributed under the BSD Software License (see license.txt) //
|
|
7
|
+
////////////////////////////////////////////////////////////////////////////
|
|
8
|
+
|
|
9
|
+
// bits.c
|
|
10
|
+
|
|
11
|
+
// This module provides utilities to support the BitStream structure which is
|
|
12
|
+
// used to read and write all WavPack audio data streams. It also contains a
|
|
13
|
+
// wrapper for the stream I/O functions and a set of functions dealing with
|
|
14
|
+
// endian-ness, both for enhancing portability. Finally, a debug wrapper for
|
|
15
|
+
// the malloc() system is provided.
|
|
16
|
+
|
|
17
|
+
#include "wavpack.h"
|
|
18
|
+
|
|
19
|
+
#include <string.h>
|
|
20
|
+
#include <ctype.h>
|
|
21
|
+
|
|
22
|
+
////////////////////////// Bitstream functions ////////////////////////////////
|
|
23
|
+
|
|
24
|
+
// Open the specified BitStream and associate with the specified buffer.
|
|
25
|
+
|
|
26
|
+
static void bs_read (Bitstream *bs);
|
|
27
|
+
|
|
28
|
+
void bs_open_read (Bitstream *bs, uchar *buffer_start, uchar *buffer_end, read_stream file, uint32_t file_bytes)
|
|
29
|
+
{
|
|
30
|
+
CLEAR (*bs);
|
|
31
|
+
bs->buf = buffer_start;
|
|
32
|
+
bs->end = buffer_end;
|
|
33
|
+
|
|
34
|
+
if (file) {
|
|
35
|
+
bs->ptr = bs->end - 1;
|
|
36
|
+
bs->file_bytes = file_bytes;
|
|
37
|
+
bs->file = file;
|
|
38
|
+
}
|
|
39
|
+
else
|
|
40
|
+
bs->ptr = bs->buf - 1;
|
|
41
|
+
|
|
42
|
+
bs->wrap = bs_read;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
// This function is only called from the getbit() and getbits() macros when
|
|
46
|
+
// the BitStream has been exhausted and more data is required. Sinve these
|
|
47
|
+
// bistreams no longer access files, this function simple sets an error and
|
|
48
|
+
// resets the buffer.
|
|
49
|
+
|
|
50
|
+
static void bs_read (Bitstream *bs)
|
|
51
|
+
{
|
|
52
|
+
if (bs->file && bs->file_bytes) {
|
|
53
|
+
uint32_t bytes_read, bytes_to_read = bs->end - bs->buf;
|
|
54
|
+
|
|
55
|
+
if (bytes_to_read > bs->file_bytes)
|
|
56
|
+
bytes_to_read = bs->file_bytes;
|
|
57
|
+
|
|
58
|
+
bytes_read = bs->file (bs->buf, bytes_to_read);
|
|
59
|
+
|
|
60
|
+
if (bytes_read) {
|
|
61
|
+
bs->end = bs->buf + bytes_read;
|
|
62
|
+
bs->file_bytes -= bytes_read;
|
|
63
|
+
}
|
|
64
|
+
else {
|
|
65
|
+
memset (bs->buf, -1, bs->end - bs->buf);
|
|
66
|
+
bs->error = 1;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
else
|
|
70
|
+
bs->error = 1;
|
|
71
|
+
|
|
72
|
+
if (bs->error)
|
|
73
|
+
memset (bs->buf, -1, bs->end - bs->buf);
|
|
74
|
+
|
|
75
|
+
bs->ptr = bs->buf;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
/////////////////////// Endian Correction Routines ////////////////////////////
|
|
79
|
+
|
|
80
|
+
void little_endian_to_native (void *data, char *format)
|
|
81
|
+
{
|
|
82
|
+
uchar *cp = (uchar *) data;
|
|
83
|
+
int32_t temp;
|
|
84
|
+
|
|
85
|
+
while (*format) {
|
|
86
|
+
switch (*format) {
|
|
87
|
+
case 'L':
|
|
88
|
+
temp = cp [0] + ((int32_t) cp [1] << 8) + ((int32_t) cp [2] << 16) + ((int32_t) cp [3] << 24);
|
|
89
|
+
* (int32_t *) cp = temp;
|
|
90
|
+
cp += 4;
|
|
91
|
+
break;
|
|
92
|
+
|
|
93
|
+
case 'S':
|
|
94
|
+
temp = cp [0] + (cp [1] << 8);
|
|
95
|
+
* (short *) cp = (short) temp;
|
|
96
|
+
cp += 2;
|
|
97
|
+
break;
|
|
98
|
+
|
|
99
|
+
default:
|
|
100
|
+
if (isdigit (*format))
|
|
101
|
+
cp += *format - '0';
|
|
102
|
+
|
|
103
|
+
break;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
format++;
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
void native_to_little_endian (void *data, char *format)
|
|
111
|
+
{
|
|
112
|
+
uchar *cp = (uchar *) data;
|
|
113
|
+
int32_t temp;
|
|
114
|
+
|
|
115
|
+
while (*format) {
|
|
116
|
+
switch (*format) {
|
|
117
|
+
case 'L':
|
|
118
|
+
temp = * (int32_t *) cp;
|
|
119
|
+
*cp++ = (uchar) temp;
|
|
120
|
+
*cp++ = (uchar) (temp >> 8);
|
|
121
|
+
*cp++ = (uchar) (temp >> 16);
|
|
122
|
+
*cp++ = (uchar) (temp >> 24);
|
|
123
|
+
break;
|
|
124
|
+
|
|
125
|
+
case 'S':
|
|
126
|
+
temp = * (short *) cp;
|
|
127
|
+
*cp++ = (uchar) temp;
|
|
128
|
+
*cp++ = (uchar) (temp >> 8);
|
|
129
|
+
break;
|
|
130
|
+
|
|
131
|
+
default:
|
|
132
|
+
if (isdigit (*format))
|
|
133
|
+
cp += *format - '0';
|
|
134
|
+
|
|
135
|
+
break;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
format++;
|
|
139
|
+
}
|
|
140
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
////////////////////////////////////////////////////////////////////////////
|
|
2
|
+
// **** WAVPACK **** //
|
|
3
|
+
// Hybrid Lossless Wavefile Compressor //
|
|
4
|
+
// Copyright (c) 1998 - 2006 Conifer Software. //
|
|
5
|
+
// All Rights Reserved. //
|
|
6
|
+
// Distributed under the BSD Software License (see license.txt) //
|
|
7
|
+
////////////////////////////////////////////////////////////////////////////
|
|
8
|
+
|
|
9
|
+
// float.c
|
|
10
|
+
|
|
11
|
+
#include "wavpack.h"
|
|
12
|
+
|
|
13
|
+
int read_float_info (WavpackStream *wps, WavpackMetadata *wpmd)
|
|
14
|
+
{
|
|
15
|
+
int bytecnt = wpmd->byte_length;
|
|
16
|
+
char *byteptr = wpmd->data;
|
|
17
|
+
|
|
18
|
+
if (bytecnt != 4)
|
|
19
|
+
return FALSE;
|
|
20
|
+
|
|
21
|
+
wps->float_flags = *byteptr++;
|
|
22
|
+
wps->float_shift = *byteptr++;
|
|
23
|
+
wps->float_max_exp = *byteptr++;
|
|
24
|
+
wps->float_norm_exp = *byteptr;
|
|
25
|
+
return TRUE;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
void float_values (WavpackStream *wps, int32_t *values, int32_t num_values)
|
|
29
|
+
{
|
|
30
|
+
int shift = wps->float_max_exp - wps->float_norm_exp + wps->float_shift;
|
|
31
|
+
|
|
32
|
+
if (shift > 32)
|
|
33
|
+
shift = 32;
|
|
34
|
+
else if (shift < -32)
|
|
35
|
+
shift = -32;
|
|
36
|
+
|
|
37
|
+
while (num_values--) {
|
|
38
|
+
if (shift > 0)
|
|
39
|
+
*values <<= shift;
|
|
40
|
+
else if (shift < 0)
|
|
41
|
+
*values >>= -shift;
|
|
42
|
+
|
|
43
|
+
if (*values > 8388607L)
|
|
44
|
+
*values = 8388607L;
|
|
45
|
+
else if (*values < -8388608L)
|
|
46
|
+
*values = -8388608L;
|
|
47
|
+
|
|
48
|
+
values++;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
Copyright (c) 1998 - 2006 Conifer Software
|
|
2
|
+
All rights reserved.
|
|
3
|
+
|
|
4
|
+
Redistribution and use in source and binary forms, with or without
|
|
5
|
+
modification, are permitted provided that the following conditions are met:
|
|
6
|
+
|
|
7
|
+
* Redistributions of source code must retain the above copyright notice,
|
|
8
|
+
this list of conditions and the following disclaimer.
|
|
9
|
+
* Redistributions in binary form must reproduce the above copyright notice,
|
|
10
|
+
this list of conditions and the following disclaimer in the
|
|
11
|
+
documentation and/or other materials provided with the distribution.
|
|
12
|
+
* Neither the name of Conifer Software nor the names of its contributors
|
|
13
|
+
may be used to endorse or promote products derived from this software
|
|
14
|
+
without specific prior written permission.
|
|
15
|
+
|
|
16
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
17
|
+
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
18
|
+
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
19
|
+
ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR
|
|
20
|
+
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
21
|
+
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
22
|
+
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
23
|
+
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
24
|
+
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
25
|
+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
////////////////////////////////////////////////////////////////////////////
|
|
2
|
+
// **** WAVPACK **** //
|
|
3
|
+
// Hybrid Lossless Wavefile Compressor //
|
|
4
|
+
// Copyright (c) 1998 - 2006 Conifer Software. //
|
|
5
|
+
// All Rights Reserved. //
|
|
6
|
+
// Distributed under the BSD Software License (see license.txt) //
|
|
7
|
+
////////////////////////////////////////////////////////////////////////////
|
|
8
|
+
|
|
9
|
+
// metadata.c
|
|
10
|
+
|
|
11
|
+
// This module handles the metadata structure introduced in WavPack 4.0
|
|
12
|
+
|
|
13
|
+
#include "wavpack.h"
|
|
14
|
+
|
|
15
|
+
int read_metadata_buff (WavpackContext *wpc, WavpackMetadata *wpmd)
|
|
16
|
+
{
|
|
17
|
+
uchar tchar;
|
|
18
|
+
|
|
19
|
+
if (!wpc->infile (&wpmd->id, 1) || !wpc->infile (&tchar, 1))
|
|
20
|
+
return FALSE;
|
|
21
|
+
|
|
22
|
+
wpmd->byte_length = tchar << 1;
|
|
23
|
+
|
|
24
|
+
if (wpmd->id & ID_LARGE) {
|
|
25
|
+
wpmd->id &= ~ID_LARGE;
|
|
26
|
+
|
|
27
|
+
if (!wpc->infile (&tchar, 1))
|
|
28
|
+
return FALSE;
|
|
29
|
+
|
|
30
|
+
wpmd->byte_length += (int32_t) tchar << 9;
|
|
31
|
+
|
|
32
|
+
if (!wpc->infile (&tchar, 1))
|
|
33
|
+
return FALSE;
|
|
34
|
+
|
|
35
|
+
wpmd->byte_length += (int32_t) tchar << 17;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
if (wpmd->id & ID_ODD_SIZE) {
|
|
39
|
+
wpmd->id &= ~ID_ODD_SIZE;
|
|
40
|
+
wpmd->byte_length--;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
if (wpmd->byte_length && wpmd->byte_length <= sizeof (wpc->read_buffer)) {
|
|
44
|
+
uint32_t bytes_to_read = wpmd->byte_length + (wpmd->byte_length & 1);
|
|
45
|
+
|
|
46
|
+
if (wpc->infile (wpc->read_buffer, bytes_to_read) != (int32_t) bytes_to_read) {
|
|
47
|
+
wpmd->data = NULL;
|
|
48
|
+
return FALSE;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
wpmd->data = wpc->read_buffer;
|
|
52
|
+
}
|
|
53
|
+
else
|
|
54
|
+
wpmd->data = NULL;
|
|
55
|
+
|
|
56
|
+
return TRUE;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
int process_metadata (WavpackContext *wpc, WavpackMetadata *wpmd)
|
|
60
|
+
{
|
|
61
|
+
WavpackStream *wps = &wpc->stream;
|
|
62
|
+
|
|
63
|
+
switch (wpmd->id) {
|
|
64
|
+
case ID_DUMMY:
|
|
65
|
+
return TRUE;
|
|
66
|
+
|
|
67
|
+
case ID_DECORR_TERMS:
|
|
68
|
+
return read_decorr_terms (wps, wpmd);
|
|
69
|
+
|
|
70
|
+
case ID_DECORR_WEIGHTS:
|
|
71
|
+
return read_decorr_weights (wps, wpmd);
|
|
72
|
+
|
|
73
|
+
case ID_DECORR_SAMPLES:
|
|
74
|
+
return read_decorr_samples (wps, wpmd);
|
|
75
|
+
|
|
76
|
+
case ID_ENTROPY_VARS:
|
|
77
|
+
return read_entropy_vars (wps, wpmd);
|
|
78
|
+
|
|
79
|
+
case ID_HYBRID_PROFILE:
|
|
80
|
+
return read_hybrid_profile (wps, wpmd);
|
|
81
|
+
|
|
82
|
+
case ID_FLOAT_INFO:
|
|
83
|
+
return read_float_info (wps, wpmd);
|
|
84
|
+
|
|
85
|
+
case ID_INT32_INFO:
|
|
86
|
+
return read_int32_info (wps, wpmd);
|
|
87
|
+
|
|
88
|
+
case ID_CHANNEL_INFO:
|
|
89
|
+
return read_channel_info (wpc, wpmd);
|
|
90
|
+
|
|
91
|
+
case ID_CONFIG_BLOCK:
|
|
92
|
+
return read_config_info (wpc, wpmd);
|
|
93
|
+
|
|
94
|
+
case ID_WV_BITSTREAM:
|
|
95
|
+
return init_wv_bitstream (wpc, wpmd);
|
|
96
|
+
|
|
97
|
+
case ID_SHAPING_WEIGHTS:
|
|
98
|
+
case ID_WVC_BITSTREAM:
|
|
99
|
+
case ID_WVX_BITSTREAM:
|
|
100
|
+
return TRUE;
|
|
101
|
+
|
|
102
|
+
default:
|
|
103
|
+
return (wpmd->id & ID_OPTIONAL_DATA) ? TRUE : FALSE;
|
|
104
|
+
}
|
|
105
|
+
}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
////////////////////////////////////////////////////////////////////////////
|
|
2
|
+
// **** WAVPACK **** //
|
|
3
|
+
// Hybrid Lossless Wavefile Compressor //
|
|
4
|
+
// Copyright (c) 1998 - 2006 Conifer Software. //
|
|
5
|
+
// All Rights Reserved. //
|
|
6
|
+
// Distributed under the BSD Software License (see license.txt) //
|
|
7
|
+
////////////////////////////////////////////////////////////////////////////
|
|
8
|
+
|
|
9
|
+
This package contains a tiny version of the WavPack 4.40 decoder that might
|
|
10
|
+
be used in a "resource limited" CPU environment or form the basis for a
|
|
11
|
+
hardware decoding implementation. It is packaged with a demo command-line
|
|
12
|
+
program that accepts a WavPack audio file on stdin and outputs a RIFF wav
|
|
13
|
+
file to stdout. The program is standard C, and a win32 executable is
|
|
14
|
+
included which was compiled under MS Visual C++ 6.0 using this command:
|
|
15
|
+
|
|
16
|
+
cl /O1 /DWIN32 wvfilter.c wputils.c unpack.c float.c metadata.c words.c bits.c
|
|
17
|
+
|
|
18
|
+
WavPack data is read with a stream reading callback. No direct seeking is
|
|
19
|
+
provided for, but it is possible to start decoding anywhere in a WavPack
|
|
20
|
+
stream. In this case, WavPack will be able to provide the sample-accurate
|
|
21
|
+
position when it synchs with the data and begins decoding. The WIN32 macro
|
|
22
|
+
is used for Windows to force the stdin and stdout streams to be binary mode.
|
|
23
|
+
|
|
24
|
+
Compared to the previous version, this library has been optimized somewhat
|
|
25
|
+
for improved performance in exchange for slightly larger code size. The
|
|
26
|
+
library also now includes hand-optimized assembly language versions of the
|
|
27
|
+
decorrelation functions for both the ColdFire (w/EMAC) and ARM processors.
|
|
28
|
+
|
|
29
|
+
For demonstration purposes this uses a single static copy of the
|
|
30
|
+
WavpackContext structure, so obviously it cannot be used for more than one
|
|
31
|
+
file at a time. Also, this decoder will not handle "correction" files, plays
|
|
32
|
+
only the first two channels of multi-channel files, and is limited in
|
|
33
|
+
resolution in some large integer or floating point files (but always
|
|
34
|
+
provides at least 24 bits of resolution). It also will not accept WavPack
|
|
35
|
+
files from before version 4.0.
|
|
36
|
+
|
|
37
|
+
The previous version of this library would handle float files by returning
|
|
38
|
+
32-bit floating-point data (even though no floating point math was used).
|
|
39
|
+
Because this library would normally be used for simply playing WavPack
|
|
40
|
+
files where lossless performance (beyond 24-bits) is not relevant, I have
|
|
41
|
+
changed this behavior. Now, these files will generate clipped 24-bit data.
|
|
42
|
+
The MODE_FLOAT flag will still be returned by WavpackGetMode(), but the
|
|
43
|
+
BitsPerSample and BytesPerSample queries will be 24 and 3, respectfully.
|
|
44
|
+
What this means is that an application that can handle 24-bit data will
|
|
45
|
+
now be able to handle floating point data (assuming that the MODE_FLOAT
|
|
46
|
+
flag is ignored).
|
|
47
|
+
|
|
48
|
+
To make this code viable on the greatest number of hardware platforms, the
|
|
49
|
+
following are true:
|
|
50
|
+
|
|
51
|
+
speed is about 5x realtime on an AMD K6 300 MHz
|
|
52
|
+
("high" mode 16/44 stereo; normal mode is about twice that fast)
|
|
53
|
+
|
|
54
|
+
no floating-point math required; just 32b * 32b = 32b int multiply
|
|
55
|
+
|
|
56
|
+
large data areas are static and less than 4K total
|
|
57
|
+
executable code and tables are less than 40K
|
|
58
|
+
no malloc / free usage
|
|
59
|
+
|
|
60
|
+
To maintain compatibility on various platforms, the following conventions
|
|
61
|
+
are used:
|
|
62
|
+
|
|
63
|
+
a "char" must be exactly 8-bits
|
|
64
|
+
a "short" must be exactly 16-bits
|
|
65
|
+
an "int" must be at least 16-bits, but may be larger
|
|
66
|
+
the "long" type is not used to avoid problems with 64-bit compilers
|
|
67
|
+
|
|
68
|
+
Questions or comments should be directed to david@wavpack.com
|