diff options
| author | Magnus Auvinen <magnus.auvinen@gmail.com> | 2008-11-29 06:39:22 +0000 |
|---|---|---|
| committer | Magnus Auvinen <magnus.auvinen@gmail.com> | 2008-11-29 06:39:22 +0000 |
| commit | 4004d13b48fd303c982dbcf7c432add64d128637 (patch) | |
| tree | fb67a18724bb8e1435b0938abe56c24d68fa2dce /src/engine/external/wavpack/float.c | |
| parent | 61d18702f63cc4731c923e9ca8cd8d98cdaca4ad (diff) | |
| download | zcatch-4004d13b48fd303c982dbcf7c432add64d128637.tar.gz zcatch-4004d13b48fd303c982dbcf7c432add64d128637.zip | |
applied patch from Richie Nyhus to convert CRLF to LF, as it should be
Diffstat (limited to 'src/engine/external/wavpack/float.c')
| -rw-r--r-- | src/engine/external/wavpack/float.c | 100 |
1 files changed, 50 insertions, 50 deletions
diff --git a/src/engine/external/wavpack/float.c b/src/engine/external/wavpack/float.c index 4b9b44ee..09f0e4c3 100644 --- a/src/engine/external/wavpack/float.c +++ b/src/engine/external/wavpack/float.c @@ -1,50 +1,50 @@ -//////////////////////////////////////////////////////////////////////////// -// **** WAVPACK **** // -// Hybrid Lossless Wavefile Compressor // -// Copyright (c) 1998 - 2006 Conifer Software. // -// All Rights Reserved. // -// Distributed under the BSD Software License (see license.txt) // -//////////////////////////////////////////////////////////////////////////// - -// float.c - -#include "wavpack.h" - -int read_float_info (WavpackStream *wps, WavpackMetadata *wpmd) -{ - int bytecnt = wpmd->byte_length; - char *byteptr = wpmd->data; - - if (bytecnt != 4) - return FALSE; - - wps->float_flags = *byteptr++; - wps->float_shift = *byteptr++; - wps->float_max_exp = *byteptr++; - wps->float_norm_exp = *byteptr; - return TRUE; -} - -void float_values (WavpackStream *wps, int32_t *values, int32_t num_values) -{ - int shift = wps->float_max_exp - wps->float_norm_exp + wps->float_shift; - - if (shift > 32) - shift = 32; - else if (shift < -32) - shift = -32; - - while (num_values--) { - if (shift > 0) - *values <<= shift; - else if (shift < 0) - *values >>= -shift; - - if (*values > 8388607L) - *values = 8388607L; - else if (*values < -8388608L) - *values = -8388608L; - - values++; - } -} +//////////////////////////////////////////////////////////////////////////// +// **** WAVPACK **** // +// Hybrid Lossless Wavefile Compressor // +// Copyright (c) 1998 - 2006 Conifer Software. // +// All Rights Reserved. // +// Distributed under the BSD Software License (see license.txt) // +//////////////////////////////////////////////////////////////////////////// + +// float.c + +#include "wavpack.h" + +int read_float_info (WavpackStream *wps, WavpackMetadata *wpmd) +{ + int bytecnt = wpmd->byte_length; + char *byteptr = wpmd->data; + + if (bytecnt != 4) + return FALSE; + + wps->float_flags = *byteptr++; + wps->float_shift = *byteptr++; + wps->float_max_exp = *byteptr++; + wps->float_norm_exp = *byteptr; + return TRUE; +} + +void float_values (WavpackStream *wps, int32_t *values, int32_t num_values) +{ + int shift = wps->float_max_exp - wps->float_norm_exp + wps->float_shift; + + if (shift > 32) + shift = 32; + else if (shift < -32) + shift = -32; + + while (num_values--) { + if (shift > 0) + *values <<= shift; + else if (shift < 0) + *values >>= -shift; + + if (*values > 8388607L) + *values = 8388607L; + else if (*values < -8388608L) + *values = -8388608L; + + values++; + } +} |