trunk/src/lib/libflac/libFLAC/include/private/bitmath.h
| r0 | r242221 | |
| 1 | /* libFLAC - Free Lossless Audio Codec library |
| 2 | * Copyright (C) 2001,2002,2003,2004,2005,2006,2007 Josh Coalson |
| 3 | * |
| 4 | * Redistribution and use in source and binary forms, with or without |
| 5 | * modification, are permitted provided that the following conditions |
| 6 | * are met: |
| 7 | * |
| 8 | * - Redistributions of source code must retain the above copyright |
| 9 | * notice, this list of conditions and the following disclaimer. |
| 10 | * |
| 11 | * - Redistributions in binary form must reproduce the above copyright |
| 12 | * notice, this list of conditions and the following disclaimer in the |
| 13 | * documentation and/or other materials provided with the distribution. |
| 14 | * |
| 15 | * - Neither the name of the Xiph.org Foundation nor the names of its |
| 16 | * contributors may be used to endorse or promote products derived from |
| 17 | * this software without specific prior written permission. |
| 18 | * |
| 19 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
| 20 | * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
| 21 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
| 22 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR |
| 23 | * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, |
| 24 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, |
| 25 | * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR |
| 26 | * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF |
| 27 | * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING |
| 28 | * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
| 29 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 30 | */ |
| 31 | |
| 32 | #ifndef FLAC__PRIVATE__BITMATH_H |
| 33 | #define FLAC__PRIVATE__BITMATH_H |
| 34 | |
| 35 | #include "FLAC/ordinals.h" |
| 36 | |
| 37 | unsigned FLAC__bitmath_ilog2(FLAC__uint32 v); |
| 38 | unsigned FLAC__bitmath_ilog2_wide(FLAC__uint64 v); |
| 39 | unsigned FLAC__bitmath_silog2(int v); |
| 40 | unsigned FLAC__bitmath_silog2_wide(FLAC__int64 v); |
| 41 | |
| 42 | #endif |
trunk/src/lib/libflac/libFLAC/include/private/bitreader.h
| r0 | r242221 | |
| 1 | /* libFLAC - Free Lossless Audio Codec library |
| 2 | * Copyright (C) 2000,2001,2002,2003,2004,2005,2006,2007 Josh Coalson |
| 3 | * |
| 4 | * Redistribution and use in source and binary forms, with or without |
| 5 | * modification, are permitted provided that the following conditions |
| 6 | * are met: |
| 7 | * |
| 8 | * - Redistributions of source code must retain the above copyright |
| 9 | * notice, this list of conditions and the following disclaimer. |
| 10 | * |
| 11 | * - Redistributions in binary form must reproduce the above copyright |
| 12 | * notice, this list of conditions and the following disclaimer in the |
| 13 | * documentation and/or other materials provided with the distribution. |
| 14 | * |
| 15 | * - Neither the name of the Xiph.org Foundation nor the names of its |
| 16 | * contributors may be used to endorse or promote products derived from |
| 17 | * this software without specific prior written permission. |
| 18 | * |
| 19 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
| 20 | * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
| 21 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
| 22 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR |
| 23 | * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, |
| 24 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, |
| 25 | * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR |
| 26 | * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF |
| 27 | * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING |
| 28 | * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
| 29 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 30 | */ |
| 31 | |
| 32 | #ifndef FLAC__PRIVATE__BITREADER_H |
| 33 | #define FLAC__PRIVATE__BITREADER_H |
| 34 | |
| 35 | #include <stdio.h> /* for FILE */ |
| 36 | #include "FLAC/ordinals.h" |
| 37 | #include "cpu.h" |
| 38 | |
| 39 | /* |
| 40 | * opaque structure definition |
| 41 | */ |
| 42 | struct FLAC__BitReader; |
| 43 | typedef struct FLAC__BitReader FLAC__BitReader; |
| 44 | |
| 45 | typedef FLAC__bool (*FLAC__BitReaderReadCallback)(FLAC__byte buffer[], size_t *bytes, void *client_data); |
| 46 | |
| 47 | /* |
| 48 | * construction, deletion, initialization, etc functions |
| 49 | */ |
| 50 | FLAC__BitReader *FLAC__bitreader_new(void); |
| 51 | void FLAC__bitreader_delete(FLAC__BitReader *br); |
| 52 | FLAC__bool FLAC__bitreader_init(FLAC__BitReader *br, FLAC__CPUInfo cpu, FLAC__BitReaderReadCallback rcb, void *cd); |
| 53 | void FLAC__bitreader_free(FLAC__BitReader *br); /* does not 'free(br)' */ |
| 54 | FLAC__bool FLAC__bitreader_clear(FLAC__BitReader *br); |
| 55 | void FLAC__bitreader_dump(const FLAC__BitReader *br, FILE *out); |
| 56 | |
| 57 | /* |
| 58 | * CRC functions |
| 59 | */ |
| 60 | void FLAC__bitreader_reset_read_crc16(FLAC__BitReader *br, FLAC__uint16 seed); |
| 61 | FLAC__uint16 FLAC__bitreader_get_read_crc16(FLAC__BitReader *br); |
| 62 | |
| 63 | /* |
| 64 | * info functions |
| 65 | */ |
| 66 | FLAC__bool FLAC__bitreader_is_consumed_byte_aligned(const FLAC__BitReader *br); |
| 67 | unsigned FLAC__bitreader_bits_left_for_byte_alignment(const FLAC__BitReader *br); |
| 68 | unsigned FLAC__bitreader_get_input_bits_unconsumed(const FLAC__BitReader *br); |
| 69 | |
| 70 | /* |
| 71 | * read functions |
| 72 | */ |
| 73 | |
| 74 | FLAC__bool FLAC__bitreader_read_raw_uint32(FLAC__BitReader *br, FLAC__uint32 *val, unsigned bits); |
| 75 | FLAC__bool FLAC__bitreader_read_raw_int32(FLAC__BitReader *br, FLAC__int32 *val, unsigned bits); |
| 76 | FLAC__bool FLAC__bitreader_read_raw_uint64(FLAC__BitReader *br, FLAC__uint64 *val, unsigned bits); |
| 77 | FLAC__bool FLAC__bitreader_read_uint32_little_endian(FLAC__BitReader *br, FLAC__uint32 *val); /*only for bits=32*/ |
| 78 | FLAC__bool FLAC__bitreader_skip_bits_no_crc(FLAC__BitReader *br, unsigned bits); /* WATCHOUT: does not CRC the skipped data! */ /*@@@@ add to unit tests */ |
| 79 | FLAC__bool FLAC__bitreader_skip_byte_block_aligned_no_crc(FLAC__BitReader *br, unsigned nvals); /* WATCHOUT: does not CRC the read data! */ |
| 80 | FLAC__bool FLAC__bitreader_read_byte_block_aligned_no_crc(FLAC__BitReader *br, FLAC__byte *val, unsigned nvals); /* WATCHOUT: does not CRC the read data! */ |
| 81 | FLAC__bool FLAC__bitreader_read_unary_unsigned(FLAC__BitReader *br, unsigned *val); |
| 82 | FLAC__bool FLAC__bitreader_read_rice_signed(FLAC__BitReader *br, int *val, unsigned parameter); |
| 83 | FLAC__bool FLAC__bitreader_read_rice_signed_block(FLAC__BitReader *br, int vals[], unsigned nvals, unsigned parameter); |
| 84 | #ifndef FLAC__NO_ASM |
| 85 | # ifdef FLAC__CPU_IA32 |
| 86 | # ifdef FLAC__HAS_NASM |
| 87 | FLAC__bool FLAC__bitreader_read_rice_signed_block_asm_ia32_bswap(FLAC__BitReader *br, int vals[], unsigned nvals, unsigned parameter); |
| 88 | # endif |
| 89 | # endif |
| 90 | #endif |
| 91 | #if 0 /* UNUSED */ |
| 92 | FLAC__bool FLAC__bitreader_read_golomb_signed(FLAC__BitReader *br, int *val, unsigned parameter); |
| 93 | FLAC__bool FLAC__bitreader_read_golomb_unsigned(FLAC__BitReader *br, unsigned *val, unsigned parameter); |
| 94 | #endif |
| 95 | FLAC__bool FLAC__bitreader_read_utf8_uint32(FLAC__BitReader *br, FLAC__uint32 *val, FLAC__byte *raw, unsigned *rawlen); |
| 96 | FLAC__bool FLAC__bitreader_read_utf8_uint64(FLAC__BitReader *br, FLAC__uint64 *val, FLAC__byte *raw, unsigned *rawlen); |
| 97 | |
| 98 | FLAC__bool bitreader_read_from_client_(FLAC__BitReader *br); |
| 99 | #endif |
trunk/src/lib/libflac/libFLAC/include/private/bitwriter.h
| r0 | r242221 | |
| 1 | /* libFLAC - Free Lossless Audio Codec library |
| 2 | * Copyright (C) 2000,2001,2002,2003,2004,2005,2006,2007 Josh Coalson |
| 3 | * |
| 4 | * Redistribution and use in source and binary forms, with or without |
| 5 | * modification, are permitted provided that the following conditions |
| 6 | * are met: |
| 7 | * |
| 8 | * - Redistributions of source code must retain the above copyright |
| 9 | * notice, this list of conditions and the following disclaimer. |
| 10 | * |
| 11 | * - Redistributions in binary form must reproduce the above copyright |
| 12 | * notice, this list of conditions and the following disclaimer in the |
| 13 | * documentation and/or other materials provided with the distribution. |
| 14 | * |
| 15 | * - Neither the name of the Xiph.org Foundation nor the names of its |
| 16 | * contributors may be used to endorse or promote products derived from |
| 17 | * this software without specific prior written permission. |
| 18 | * |
| 19 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
| 20 | * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
| 21 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
| 22 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR |
| 23 | * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, |
| 24 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, |
| 25 | * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR |
| 26 | * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF |
| 27 | * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING |
| 28 | * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
| 29 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 30 | */ |
| 31 | |
| 32 | #ifndef FLAC__PRIVATE__BITWRITER_H |
| 33 | #define FLAC__PRIVATE__BITWRITER_H |
| 34 | |
| 35 | #include <stdio.h> /* for FILE */ |
| 36 | #include "FLAC/ordinals.h" |
| 37 | |
| 38 | /* |
| 39 | * opaque structure definition |
| 40 | */ |
| 41 | struct FLAC__BitWriter; |
| 42 | typedef struct FLAC__BitWriter FLAC__BitWriter; |
| 43 | |
| 44 | /* |
| 45 | * construction, deletion, initialization, etc functions |
| 46 | */ |
| 47 | FLAC__BitWriter *FLAC__bitwriter_new(void); |
| 48 | void FLAC__bitwriter_delete(FLAC__BitWriter *bw); |
| 49 | FLAC__bool FLAC__bitwriter_init(FLAC__BitWriter *bw); |
| 50 | void FLAC__bitwriter_free(FLAC__BitWriter *bw); /* does not 'free(buffer)' */ |
| 51 | void FLAC__bitwriter_clear(FLAC__BitWriter *bw); |
| 52 | void FLAC__bitwriter_dump(const FLAC__BitWriter *bw, FILE *out); |
| 53 | |
| 54 | /* |
| 55 | * CRC functions |
| 56 | * |
| 57 | * non-const *bw because they have to cal FLAC__bitwriter_get_buffer() |
| 58 | */ |
| 59 | FLAC__bool FLAC__bitwriter_get_write_crc16(FLAC__BitWriter *bw, FLAC__uint16 *crc); |
| 60 | FLAC__bool FLAC__bitwriter_get_write_crc8(FLAC__BitWriter *bw, FLAC__byte *crc); |
| 61 | |
| 62 | /* |
| 63 | * info functions |
| 64 | */ |
| 65 | FLAC__bool FLAC__bitwriter_is_byte_aligned(const FLAC__BitWriter *bw); |
| 66 | unsigned FLAC__bitwriter_get_input_bits_unconsumed(const FLAC__BitWriter *bw); /* can be called anytime, returns total # of bits unconsumed */ |
| 67 | |
| 68 | /* |
| 69 | * direct buffer access |
| 70 | * |
| 71 | * there may be no calls on the bitwriter between get and release. |
| 72 | * the bitwriter continues to own the returned buffer. |
| 73 | * before get, bitwriter MUST be byte aligned: check with FLAC__bitwriter_is_byte_aligned() |
| 74 | */ |
| 75 | FLAC__bool FLAC__bitwriter_get_buffer(FLAC__BitWriter *bw, const FLAC__byte **buffer, size_t *bytes); |
| 76 | void FLAC__bitwriter_release_buffer(FLAC__BitWriter *bw); |
| 77 | |
| 78 | /* |
| 79 | * write functions |
| 80 | */ |
| 81 | FLAC__bool FLAC__bitwriter_write_zeroes(FLAC__BitWriter *bw, unsigned bits); |
| 82 | FLAC__bool FLAC__bitwriter_write_raw_uint32(FLAC__BitWriter *bw, FLAC__uint32 val, unsigned bits); |
| 83 | FLAC__bool FLAC__bitwriter_write_raw_int32(FLAC__BitWriter *bw, FLAC__int32 val, unsigned bits); |
| 84 | FLAC__bool FLAC__bitwriter_write_raw_uint64(FLAC__BitWriter *bw, FLAC__uint64 val, unsigned bits); |
| 85 | FLAC__bool FLAC__bitwriter_write_raw_uint32_little_endian(FLAC__BitWriter *bw, FLAC__uint32 val); /*only for bits=32*/ |
| 86 | FLAC__bool FLAC__bitwriter_write_byte_block(FLAC__BitWriter *bw, const FLAC__byte vals[], unsigned nvals); |
| 87 | FLAC__bool FLAC__bitwriter_write_unary_unsigned(FLAC__BitWriter *bw, unsigned val); |
| 88 | unsigned FLAC__bitwriter_rice_bits(FLAC__int32 val, unsigned parameter); |
| 89 | #if 0 /* UNUSED */ |
| 90 | unsigned FLAC__bitwriter_golomb_bits_signed(int val, unsigned parameter); |
| 91 | unsigned FLAC__bitwriter_golomb_bits_unsigned(unsigned val, unsigned parameter); |
| 92 | #endif |
| 93 | FLAC__bool FLAC__bitwriter_write_rice_signed(FLAC__BitWriter *bw, FLAC__int32 val, unsigned parameter); |
| 94 | FLAC__bool FLAC__bitwriter_write_rice_signed_block(FLAC__BitWriter *bw, const FLAC__int32 *vals, unsigned nvals, unsigned parameter); |
| 95 | #if 0 /* UNUSED */ |
| 96 | FLAC__bool FLAC__bitwriter_write_golomb_signed(FLAC__BitWriter *bw, int val, unsigned parameter); |
| 97 | FLAC__bool FLAC__bitwriter_write_golomb_unsigned(FLAC__BitWriter *bw, unsigned val, unsigned parameter); |
| 98 | #endif |
| 99 | FLAC__bool FLAC__bitwriter_write_utf8_uint32(FLAC__BitWriter *bw, FLAC__uint32 val); |
| 100 | FLAC__bool FLAC__bitwriter_write_utf8_uint64(FLAC__BitWriter *bw, FLAC__uint64 val); |
| 101 | FLAC__bool FLAC__bitwriter_zero_pad_to_byte_boundary(FLAC__BitWriter *bw); |
| 102 | |
| 103 | #endif |
trunk/src/lib/libflac/libFLAC/include/private/cpu.h
| r0 | r242221 | |
| 1 | /* libFLAC - Free Lossless Audio Codec library |
| 2 | * Copyright (C) 2001,2002,2003,2004,2005,2006,2007 Josh Coalson |
| 3 | * |
| 4 | * Redistribution and use in source and binary forms, with or without |
| 5 | * modification, are permitted provided that the following conditions |
| 6 | * are met: |
| 7 | * |
| 8 | * - Redistributions of source code must retain the above copyright |
| 9 | * notice, this list of conditions and the following disclaimer. |
| 10 | * |
| 11 | * - Redistributions in binary form must reproduce the above copyright |
| 12 | * notice, this list of conditions and the following disclaimer in the |
| 13 | * documentation and/or other materials provided with the distribution. |
| 14 | * |
| 15 | * - Neither the name of the Xiph.org Foundation nor the names of its |
| 16 | * contributors may be used to endorse or promote products derived from |
| 17 | * this software without specific prior written permission. |
| 18 | * |
| 19 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
| 20 | * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
| 21 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
| 22 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR |
| 23 | * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, |
| 24 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, |
| 25 | * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR |
| 26 | * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF |
| 27 | * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING |
| 28 | * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
| 29 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 30 | */ |
| 31 | |
| 32 | #ifndef FLAC__PRIVATE__CPU_H |
| 33 | #define FLAC__PRIVATE__CPU_H |
| 34 | |
| 35 | #include "FLAC/ordinals.h" |
| 36 | |
| 37 | #ifdef HAVE_CONFIG_H |
| 38 | #include <config.h> |
| 39 | #endif |
| 40 | |
| 41 | typedef enum { |
| 42 | FLAC__CPUINFO_TYPE_IA32, |
| 43 | FLAC__CPUINFO_TYPE_PPC, |
| 44 | FLAC__CPUINFO_TYPE_UNKNOWN |
| 45 | } FLAC__CPUInfo_Type; |
| 46 | |
| 47 | typedef struct { |
| 48 | FLAC__bool cpuid; |
| 49 | FLAC__bool bswap; |
| 50 | FLAC__bool cmov; |
| 51 | FLAC__bool mmx; |
| 52 | FLAC__bool fxsr; |
| 53 | FLAC__bool sse; |
| 54 | FLAC__bool sse2; |
| 55 | FLAC__bool sse3; |
| 56 | FLAC__bool ssse3; |
| 57 | FLAC__bool _3dnow; |
| 58 | FLAC__bool ext3dnow; |
| 59 | FLAC__bool extmmx; |
| 60 | } FLAC__CPUInfo_IA32; |
| 61 | |
| 62 | typedef struct { |
| 63 | FLAC__bool altivec; |
| 64 | FLAC__bool ppc64; |
| 65 | } FLAC__CPUInfo_PPC; |
| 66 | |
| 67 | typedef struct { |
| 68 | FLAC__bool use_asm; |
| 69 | FLAC__CPUInfo_Type type; |
| 70 | union { |
| 71 | FLAC__CPUInfo_IA32 ia32; |
| 72 | FLAC__CPUInfo_PPC ppc; |
| 73 | } data; |
| 74 | } FLAC__CPUInfo; |
| 75 | |
| 76 | void FLAC__cpu_info(FLAC__CPUInfo *info); |
| 77 | |
| 78 | #ifndef FLAC__NO_ASM |
| 79 | #ifdef FLAC__CPU_IA32 |
| 80 | #ifdef FLAC__HAS_NASM |
| 81 | FLAC__uint32 FLAC__cpu_have_cpuid_asm_ia32(void); |
| 82 | void FLAC__cpu_info_asm_ia32(FLAC__uint32 *flags_edx, FLAC__uint32 *flags_ecx); |
| 83 | FLAC__uint32 FLAC__cpu_info_extended_amd_asm_ia32(void); |
| 84 | #endif |
| 85 | #endif |
| 86 | #endif |
| 87 | |
| 88 | #endif |
trunk/src/lib/libflac/libFLAC/include/private/crc.h
| r0 | r242221 | |
| 1 | /* libFLAC - Free Lossless Audio Codec library |
| 2 | * Copyright (C) 2000,2001,2002,2003,2004,2005,2006,2007 Josh Coalson |
| 3 | * |
| 4 | * Redistribution and use in source and binary forms, with or without |
| 5 | * modification, are permitted provided that the following conditions |
| 6 | * are met: |
| 7 | * |
| 8 | * - Redistributions of source code must retain the above copyright |
| 9 | * notice, this list of conditions and the following disclaimer. |
| 10 | * |
| 11 | * - Redistributions in binary form must reproduce the above copyright |
| 12 | * notice, this list of conditions and the following disclaimer in the |
| 13 | * documentation and/or other materials provided with the distribution. |
| 14 | * |
| 15 | * - Neither the name of the Xiph.org Foundation nor the names of its |
| 16 | * contributors may be used to endorse or promote products derived from |
| 17 | * this software without specific prior written permission. |
| 18 | * |
| 19 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
| 20 | * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
| 21 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
| 22 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR |
| 23 | * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, |
| 24 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, |
| 25 | * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR |
| 26 | * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF |
| 27 | * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING |
| 28 | * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
| 29 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 30 | */ |
| 31 | |
| 32 | #ifndef FLAC__PRIVATE__CRC_H |
| 33 | #define FLAC__PRIVATE__CRC_H |
| 34 | |
| 35 | #include "FLAC/ordinals.h" |
| 36 | |
| 37 | /* 8 bit CRC generator, MSB shifted first |
| 38 | ** polynomial = x^8 + x^2 + x^1 + x^0 |
| 39 | ** init = 0 |
| 40 | */ |
| 41 | extern FLAC__byte const FLAC__crc8_table[256]; |
| 42 | #define FLAC__CRC8_UPDATE(data, crc) (crc) = FLAC__crc8_table[(crc) ^ (data)]; |
| 43 | void FLAC__crc8_update(const FLAC__byte data, FLAC__uint8 *crc); |
| 44 | void FLAC__crc8_update_block(const FLAC__byte *data, unsigned len, FLAC__uint8 *crc); |
| 45 | FLAC__uint8 FLAC__crc8(const FLAC__byte *data, unsigned len); |
| 46 | |
| 47 | /* 16 bit CRC generator, MSB shifted first |
| 48 | ** polynomial = x^16 + x^15 + x^2 + x^0 |
| 49 | ** init = 0 |
| 50 | */ |
| 51 | extern unsigned FLAC__crc16_table[256]; |
| 52 | |
| 53 | #define FLAC__CRC16_UPDATE(data, crc) (((((crc)<<8) & 0xffff) ^ FLAC__crc16_table[((crc)>>8) ^ (data)])) |
| 54 | /* this alternate may be faster on some systems/compilers */ |
| 55 | #if 0 |
| 56 | #define FLAC__CRC16_UPDATE(data, crc) ((((crc)<<8) ^ FLAC__crc16_table[((crc)>>8) ^ (data)]) & 0xffff) |
| 57 | #endif |
| 58 | |
| 59 | unsigned FLAC__crc16(const FLAC__byte *data, unsigned len); |
| 60 | |
| 61 | #endif |
trunk/src/lib/libflac/libFLAC/include/private/fixed.h
| r0 | r242221 | |
| 1 | /* libFLAC - Free Lossless Audio Codec library |
| 2 | * Copyright (C) 2000,2001,2002,2003,2004,2005,2006,2007 Josh Coalson |
| 3 | * |
| 4 | * Redistribution and use in source and binary forms, with or without |
| 5 | * modification, are permitted provided that the following conditions |
| 6 | * are met: |
| 7 | * |
| 8 | * - Redistributions of source code must retain the above copyright |
| 9 | * notice, this list of conditions and the following disclaimer. |
| 10 | * |
| 11 | * - Redistributions in binary form must reproduce the above copyright |
| 12 | * notice, this list of conditions and the following disclaimer in the |
| 13 | * documentation and/or other materials provided with the distribution. |
| 14 | * |
| 15 | * - Neither the name of the Xiph.org Foundation nor the names of its |
| 16 | * contributors may be used to endorse or promote products derived from |
| 17 | * this software without specific prior written permission. |
| 18 | * |
| 19 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
| 20 | * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
| 21 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
| 22 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR |
| 23 | * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, |
| 24 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, |
| 25 | * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR |
| 26 | * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF |
| 27 | * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING |
| 28 | * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
| 29 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 30 | */ |
| 31 | |
| 32 | #ifndef FLAC__PRIVATE__FIXED_H |
| 33 | #define FLAC__PRIVATE__FIXED_H |
| 34 | |
| 35 | #ifdef HAVE_CONFIG_H |
| 36 | #include <config.h> |
| 37 | #endif |
| 38 | |
| 39 | #include "private/float.h" |
| 40 | #include "FLAC/format.h" |
| 41 | |
| 42 | /* |
| 43 | * FLAC__fixed_compute_best_predictor() |
| 44 | * -------------------------------------------------------------------- |
| 45 | * Compute the best fixed predictor and the expected bits-per-sample |
| 46 | * of the residual signal for each order. The _wide() version uses |
| 47 | * 64-bit integers which is statistically necessary when bits-per- |
| 48 | * sample + log2(blocksize) > 30 |
| 49 | * |
| 50 | * IN data[0,data_len-1] |
| 51 | * IN data_len |
| 52 | * OUT residual_bits_per_sample[0,FLAC__MAX_FIXED_ORDER] |
| 53 | */ |
| 54 | #ifndef FLAC__INTEGER_ONLY_LIBRARY |
| 55 | unsigned FLAC__fixed_compute_best_predictor(const FLAC__int32 data[], unsigned data_len, FLAC__float residual_bits_per_sample[FLAC__MAX_FIXED_ORDER+1]); |
| 56 | # ifndef FLAC__NO_ASM |
| 57 | # ifdef FLAC__CPU_IA32 |
| 58 | # ifdef FLAC__HAS_NASM |
| 59 | unsigned FLAC__fixed_compute_best_predictor_asm_ia32_mmx_cmov(const FLAC__int32 data[], unsigned data_len, FLAC__float residual_bits_per_sample[FLAC__MAX_FIXED_ORDER+1]); |
| 60 | # endif |
| 61 | # endif |
| 62 | # endif |
| 63 | unsigned FLAC__fixed_compute_best_predictor_wide(const FLAC__int32 data[], unsigned data_len, FLAC__float residual_bits_per_sample[FLAC__MAX_FIXED_ORDER+1]); |
| 64 | #else |
| 65 | unsigned FLAC__fixed_compute_best_predictor(const FLAC__int32 data[], unsigned data_len, FLAC__fixedpoint residual_bits_per_sample[FLAC__MAX_FIXED_ORDER+1]); |
| 66 | unsigned FLAC__fixed_compute_best_predictor_wide(const FLAC__int32 data[], unsigned data_len, FLAC__fixedpoint residual_bits_per_sample[FLAC__MAX_FIXED_ORDER+1]); |
| 67 | #endif |
| 68 | |
| 69 | /* |
| 70 | * FLAC__fixed_compute_residual() |
| 71 | * -------------------------------------------------------------------- |
| 72 | * Compute the residual signal obtained from sutracting the predicted |
| 73 | * signal from the original. |
| 74 | * |
| 75 | * IN data[-order,data_len-1] original signal (NOTE THE INDICES!) |
| 76 | * IN data_len length of original signal |
| 77 | * IN order <= FLAC__MAX_FIXED_ORDER fixed-predictor order |
| 78 | * OUT residual[0,data_len-1] residual signal |
| 79 | */ |
| 80 | void FLAC__fixed_compute_residual(const FLAC__int32 data[], unsigned data_len, unsigned order, FLAC__int32 residual[]); |
| 81 | |
| 82 | /* |
| 83 | * FLAC__fixed_restore_signal() |
| 84 | * -------------------------------------------------------------------- |
| 85 | * Restore the original signal by summing the residual and the |
| 86 | * predictor. |
| 87 | * |
| 88 | * IN residual[0,data_len-1] residual signal |
| 89 | * IN data_len length of original signal |
| 90 | * IN order <= FLAC__MAX_FIXED_ORDER fixed-predictor order |
| 91 | * *** IMPORTANT: the caller must pass in the historical samples: |
| 92 | * IN data[-order,-1] previously-reconstructed historical samples |
| 93 | * OUT data[0,data_len-1] original signal |
| 94 | */ |
| 95 | void FLAC__fixed_restore_signal(const FLAC__int32 residual[], unsigned data_len, unsigned order, FLAC__int32 data[]); |
| 96 | |
| 97 | #endif |
trunk/src/lib/libflac/libFLAC/include/private/float.h
| r0 | r242221 | |
| 1 | /* libFLAC - Free Lossless Audio Codec library |
| 2 | * Copyright (C) 2004,2005,2006,2007 Josh Coalson |
| 3 | * |
| 4 | * Redistribution and use in source and binary forms, with or without |
| 5 | * modification, are permitted provided that the following conditions |
| 6 | * are met: |
| 7 | * |
| 8 | * - Redistributions of source code must retain the above copyright |
| 9 | * notice, this list of conditions and the following disclaimer. |
| 10 | * |
| 11 | * - Redistributions in binary form must reproduce the above copyright |
| 12 | * notice, this list of conditions and the following disclaimer in the |
| 13 | * documentation and/or other materials provided with the distribution. |
| 14 | * |
| 15 | * - Neither the name of the Xiph.org Foundation nor the names of its |
| 16 | * contributors may be used to endorse or promote products derived from |
| 17 | * this software without specific prior written permission. |
| 18 | * |
| 19 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
| 20 | * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
| 21 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
| 22 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR |
| 23 | * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, |
| 24 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, |
| 25 | * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR |
| 26 | * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF |
| 27 | * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING |
| 28 | * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
| 29 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 30 | */ |
| 31 | |
| 32 | #ifndef FLAC__PRIVATE__FLOAT_H |
| 33 | #define FLAC__PRIVATE__FLOAT_H |
| 34 | |
| 35 | #ifdef HAVE_CONFIG_H |
| 36 | #include <config.h> |
| 37 | #endif |
| 38 | |
| 39 | #include "FLAC/ordinals.h" |
| 40 | |
| 41 | /* |
| 42 | * These typedefs make it easier to ensure that integer versions of |
| 43 | * the library really only contain integer operations. All the code |
| 44 | * in libFLAC should use FLAC__float and FLAC__double in place of |
| 45 | * float and double, and be protected by checks of the macro |
| 46 | * FLAC__INTEGER_ONLY_LIBRARY. |
| 47 | * |
| 48 | * FLAC__real is the basic floating point type used in LPC analysis. |
| 49 | */ |
| 50 | #ifndef FLAC__INTEGER_ONLY_LIBRARY |
| 51 | typedef double FLAC__double; |
| 52 | typedef float FLAC__float; |
| 53 | /* |
| 54 | * WATCHOUT: changing FLAC__real will change the signatures of many |
| 55 | * functions that have assembly language equivalents and break them. |
| 56 | */ |
| 57 | typedef float FLAC__real; |
| 58 | #else |
| 59 | /* |
| 60 | * The convention for FLAC__fixedpoint is to use the upper 16 bits |
| 61 | * for the integer part and lower 16 bits for the fractional part. |
| 62 | */ |
| 63 | typedef FLAC__int32 FLAC__fixedpoint; |
| 64 | extern const FLAC__fixedpoint FLAC__FP_ZERO; |
| 65 | extern const FLAC__fixedpoint FLAC__FP_ONE_HALF; |
| 66 | extern const FLAC__fixedpoint FLAC__FP_ONE; |
| 67 | extern const FLAC__fixedpoint FLAC__FP_LN2; |
| 68 | extern const FLAC__fixedpoint FLAC__FP_E; |
| 69 | |
| 70 | #define FLAC__fixedpoint_trunc(x) ((x)>>16) |
| 71 | |
| 72 | #define FLAC__fixedpoint_mul(x, y) ( (FLAC__fixedpoint) ( ((FLAC__int64)(x)*(FLAC__int64)(y)) >> 16 ) ) |
| 73 | |
| 74 | #define FLAC__fixedpoint_div(x, y) ( (FLAC__fixedpoint) ( ( ((FLAC__int64)(x)<<32) / (FLAC__int64)(y) ) >> 16 ) ) |
| 75 | |
| 76 | /* |
| 77 | * FLAC__fixedpoint_log2() |
| 78 | * -------------------------------------------------------------------- |
| 79 | * Returns the base-2 logarithm of the fixed-point number 'x' using an |
| 80 | * algorithm by Knuth for x >= 1.0 |
| 81 | * |
| 82 | * 'fracbits' is the number of fractional bits of 'x'. 'fracbits' must |
| 83 | * be < 32 and evenly divisible by 4 (0 is OK but not very precise). |
| 84 | * |
| 85 | * 'precision' roughly limits the number of iterations that are done; |
| 86 | * use (unsigned)(-1) for maximum precision. |
| 87 | * |
| 88 | * If 'x' is less than one -- that is, x < (1<<fracbits) -- then this |
| 89 | * function will punt and return 0. |
| 90 | * |
| 91 | * The return value will also have 'fracbits' fractional bits. |
| 92 | */ |
| 93 | FLAC__uint32 FLAC__fixedpoint_log2(FLAC__uint32 x, unsigned fracbits, unsigned precision); |
| 94 | |
| 95 | #endif |
| 96 | |
| 97 | #endif |
trunk/src/lib/libflac/libFLAC/include/private/format.h
| r0 | r242221 | |
| 1 | /* libFLAC - Free Lossless Audio Codec library |
| 2 | * Copyright (C) 2000,2001,2002,2003,2004,2005,2006,2007 Josh Coalson |
| 3 | * |
| 4 | * Redistribution and use in source and binary forms, with or without |
| 5 | * modification, are permitted provided that the following conditions |
| 6 | * are met: |
| 7 | * |
| 8 | * - Redistributions of source code must retain the above copyright |
| 9 | * notice, this list of conditions and the following disclaimer. |
| 10 | * |
| 11 | * - Redistributions in binary form must reproduce the above copyright |
| 12 | * notice, this list of conditions and the following disclaimer in the |
| 13 | * documentation and/or other materials provided with the distribution. |
| 14 | * |
| 15 | * - Neither the name of the Xiph.org Foundation nor the names of its |
| 16 | * contributors may be used to endorse or promote products derived from |
| 17 | * this software without specific prior written permission. |
| 18 | * |
| 19 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
| 20 | * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
| 21 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
| 22 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR |
| 23 | * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, |
| 24 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, |
| 25 | * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR |
| 26 | * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF |
| 27 | * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING |
| 28 | * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
| 29 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 30 | */ |
| 31 | |
| 32 | #ifndef FLAC__PRIVATE__FORMAT_H |
| 33 | #define FLAC__PRIVATE__FORMAT_H |
| 34 | |
| 35 | #include "FLAC/format.h" |
| 36 | |
| 37 | unsigned FLAC__format_get_max_rice_partition_order(unsigned blocksize, unsigned predictor_order); |
| 38 | unsigned FLAC__format_get_max_rice_partition_order_from_blocksize(unsigned blocksize); |
| 39 | unsigned FLAC__format_get_max_rice_partition_order_from_blocksize_limited_max_and_predictor_order(unsigned limit, unsigned blocksize, unsigned predictor_order); |
| 40 | void FLAC__format_entropy_coding_method_partitioned_rice_contents_init(FLAC__EntropyCodingMethod_PartitionedRiceContents *object); |
| 41 | void FLAC__format_entropy_coding_method_partitioned_rice_contents_clear(FLAC__EntropyCodingMethod_PartitionedRiceContents *object); |
| 42 | FLAC__bool FLAC__format_entropy_coding_method_partitioned_rice_contents_ensure_size(FLAC__EntropyCodingMethod_PartitionedRiceContents *object, unsigned max_partition_order); |
| 43 | |
| 44 | #endif |
trunk/src/lib/libflac/libFLAC/include/private/lpc.h
| r0 | r242221 | |
| 1 | /* libFLAC - Free Lossless Audio Codec library |
| 2 | * Copyright (C) 2000,2001,2002,2003,2004,2005,2006,2007 Josh Coalson |
| 3 | * |
| 4 | * Redistribution and use in source and binary forms, with or without |
| 5 | * modification, are permitted provided that the following conditions |
| 6 | * are met: |
| 7 | * |
| 8 | * - Redistributions of source code must retain the above copyright |
| 9 | * notice, this list of conditions and the following disclaimer. |
| 10 | * |
| 11 | * - Redistributions in binary form must reproduce the above copyright |
| 12 | * notice, this list of conditions and the following disclaimer in the |
| 13 | * documentation and/or other materials provided with the distribution. |
| 14 | * |
| 15 | * - Neither the name of the Xiph.org Foundation nor the names of its |
| 16 | * contributors may be used to endorse or promote products derived from |
| 17 | * this software without specific prior written permission. |
| 18 | * |
| 19 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
| 20 | * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
| 21 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
| 22 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR |
| 23 | * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, |
| 24 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, |
| 25 | * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR |
| 26 | * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF |
| 27 | * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING |
| 28 | * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
| 29 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 30 | */ |
| 31 | |
| 32 | #ifndef FLAC__PRIVATE__LPC_H |
| 33 | #define FLAC__PRIVATE__LPC_H |
| 34 | |
| 35 | #ifdef HAVE_CONFIG_H |
| 36 | #include <config.h> |
| 37 | #endif |
| 38 | |
| 39 | #include "private/float.h" |
| 40 | #include "FLAC/format.h" |
| 41 | |
| 42 | #ifndef FLAC__INTEGER_ONLY_LIBRARY |
| 43 | |
| 44 | /* |
| 45 | * FLAC__lpc_window_data() |
| 46 | * -------------------------------------------------------------------- |
| 47 | * Applies the given window to the data. |
| 48 | * OPT: asm implementation |
| 49 | * |
| 50 | * IN in[0,data_len-1] |
| 51 | * IN window[0,data_len-1] |
| 52 | * OUT out[0,lag-1] |
| 53 | * IN data_len |
| 54 | */ |
| 55 | void FLAC__lpc_window_data(const FLAC__int32 in[], const FLAC__real window[], FLAC__real out[], unsigned data_len); |
| 56 | |
| 57 | /* |
| 58 | * FLAC__lpc_compute_autocorrelation() |
| 59 | * -------------------------------------------------------------------- |
| 60 | * Compute the autocorrelation for lags between 0 and lag-1. |
| 61 | * Assumes data[] outside of [0,data_len-1] == 0. |
| 62 | * Asserts that lag > 0. |
| 63 | * |
| 64 | * IN data[0,data_len-1] |
| 65 | * IN data_len |
| 66 | * IN 0 < lag <= data_len |
| 67 | * OUT autoc[0,lag-1] |
| 68 | */ |
| 69 | void FLAC__lpc_compute_autocorrelation(const FLAC__real data[], unsigned data_len, unsigned lag, FLAC__real autoc[]); |
| 70 | #ifndef FLAC__NO_ASM |
| 71 | # ifdef FLAC__CPU_IA32 |
| 72 | # ifdef FLAC__HAS_NASM |
| 73 | void FLAC__lpc_compute_autocorrelation_asm_ia32(const FLAC__real data[], unsigned data_len, unsigned lag, FLAC__real autoc[]); |
| 74 | void FLAC__lpc_compute_autocorrelation_asm_ia32_sse_lag_4(const FLAC__real data[], unsigned data_len, unsigned lag, FLAC__real autoc[]); |
| 75 | void FLAC__lpc_compute_autocorrelation_asm_ia32_sse_lag_8(const FLAC__real data[], unsigned data_len, unsigned lag, FLAC__real autoc[]); |
| 76 | void FLAC__lpc_compute_autocorrelation_asm_ia32_sse_lag_12(const FLAC__real data[], unsigned data_len, unsigned lag, FLAC__real autoc[]); |
| 77 | void FLAC__lpc_compute_autocorrelation_asm_ia32_3dnow(const FLAC__real data[], unsigned data_len, unsigned lag, FLAC__real autoc[]); |
| 78 | # endif |
| 79 | # endif |
| 80 | #endif |
| 81 | |
| 82 | /* |
| 83 | * FLAC__lpc_compute_lp_coefficients() |
| 84 | * -------------------------------------------------------------------- |
| 85 | * Computes LP coefficients for orders 1..max_order. |
| 86 | * Do not call if autoc[0] == 0.0. This means the signal is zero |
| 87 | * and there is no point in calculating a predictor. |
| 88 | * |
| 89 | * IN autoc[0,max_order] autocorrelation values |
| 90 | * IN 0 < max_order <= FLAC__MAX_LPC_ORDER max LP order to compute |
| 91 | * OUT lp_coeff[0,max_order-1][0,max_order-1] LP coefficients for each order |
| 92 | * *** IMPORTANT: |
| 93 | * *** lp_coeff[0,max_order-1][max_order,FLAC__MAX_LPC_ORDER-1] are untouched |
| 94 | * OUT error[0,max_order-1] error for each order (more |
| 95 | * specifically, the variance of |
| 96 | * the error signal times # of |
| 97 | * samples in the signal) |
| 98 | * |
| 99 | * Example: if max_order is 9, the LP coefficients for order 9 will be |
| 100 | * in lp_coeff[8][0,8], the LP coefficients for order 8 will be |
| 101 | * in lp_coeff[7][0,7], etc. |
| 102 | */ |
| 103 | void FLAC__lpc_compute_lp_coefficients(const FLAC__real autoc[], unsigned *max_order, FLAC__real lp_coeff[][FLAC__MAX_LPC_ORDER], FLAC__double error[]); |
| 104 | |
| 105 | /* |
| 106 | * FLAC__lpc_quantize_coefficients() |
| 107 | * -------------------------------------------------------------------- |
| 108 | * Quantizes the LP coefficients. NOTE: precision + bits_per_sample |
| 109 | * must be less than 32 (sizeof(FLAC__int32)*8). |
| 110 | * |
| 111 | * IN lp_coeff[0,order-1] LP coefficients |
| 112 | * IN order LP order |
| 113 | * IN FLAC__MIN_QLP_COEFF_PRECISION < precision |
| 114 | * desired precision (in bits, including sign |
| 115 | * bit) of largest coefficient |
| 116 | * OUT qlp_coeff[0,order-1] quantized coefficients |
| 117 | * OUT shift # of bits to shift right to get approximated |
| 118 | * LP coefficients. NOTE: could be negative. |
| 119 | * RETURN 0 => quantization OK |
| 120 | * 1 => coefficients require too much shifting for *shift to |
| 121 | * fit in the LPC subframe header. 'shift' is unset. |
| 122 | * 2 => coefficients are all zero, which is bad. 'shift' is |
| 123 | * unset. |
| 124 | */ |
| 125 | int FLAC__lpc_quantize_coefficients(const FLAC__real lp_coeff[], unsigned order, unsigned precision, FLAC__int32 qlp_coeff[], int *shift); |
| 126 | |
| 127 | /* |
| 128 | * FLAC__lpc_compute_residual_from_qlp_coefficients() |
| 129 | * -------------------------------------------------------------------- |
| 130 | * Compute the residual signal obtained from sutracting the predicted |
| 131 | * signal from the original. |
| 132 | * |
| 133 | * IN data[-order,data_len-1] original signal (NOTE THE INDICES!) |
| 134 | * IN data_len length of original signal |
| 135 | * IN qlp_coeff[0,order-1] quantized LP coefficients |
| 136 | * IN order > 0 LP order |
| 137 | * IN lp_quantization quantization of LP coefficients in bits |
| 138 | * OUT residual[0,data_len-1] residual signal |
| 139 | */ |
| 140 | void FLAC__lpc_compute_residual_from_qlp_coefficients(const FLAC__int32 *data, unsigned data_len, const FLAC__int32 qlp_coeff[], unsigned order, int lp_quantization, FLAC__int32 residual[]); |
| 141 | void FLAC__lpc_compute_residual_from_qlp_coefficients_wide(const FLAC__int32 *data, unsigned data_len, const FLAC__int32 qlp_coeff[], unsigned order, int lp_quantization, FLAC__int32 residual[]); |
| 142 | #ifndef FLAC__NO_ASM |
| 143 | # ifdef FLAC__CPU_IA32 |
| 144 | # ifdef FLAC__HAS_NASM |
| 145 | void FLAC__lpc_compute_residual_from_qlp_coefficients_asm_ia32(const FLAC__int32 *data, unsigned data_len, const FLAC__int32 qlp_coeff[], unsigned order, int lp_quantization, FLAC__int32 residual[]); |
| 146 | void FLAC__lpc_compute_residual_from_qlp_coefficients_asm_ia32_mmx(const FLAC__int32 *data, unsigned data_len, const FLAC__int32 qlp_coeff[], unsigned order, int lp_quantization, FLAC__int32 residual[]); |
| 147 | # endif |
| 148 | # endif |
| 149 | #endif |
| 150 | |
| 151 | #endif /* !defined FLAC__INTEGER_ONLY_LIBRARY */ |
| 152 | |
| 153 | /* |
| 154 | * FLAC__lpc_restore_signal() |
| 155 | * -------------------------------------------------------------------- |
| 156 | * Restore the original signal by summing the residual and the |
| 157 | * predictor. |
| 158 | * |
| 159 | * IN residual[0,data_len-1] residual signal |
| 160 | * IN data_len length of original signal |
| 161 | * IN qlp_coeff[0,order-1] quantized LP coefficients |
| 162 | * IN order > 0 LP order |
| 163 | * IN lp_quantization quantization of LP coefficients in bits |
| 164 | * *** IMPORTANT: the caller must pass in the historical samples: |
| 165 | * IN data[-order,-1] previously-reconstructed historical samples |
| 166 | * OUT data[0,data_len-1] original signal |
| 167 | */ |
| 168 | void FLAC__lpc_restore_signal(const FLAC__int32 residual[], unsigned data_len, const FLAC__int32 qlp_coeff[], unsigned order, int lp_quantization, FLAC__int32 data[]); |
| 169 | void FLAC__lpc_restore_signal_wide(const FLAC__int32 residual[], unsigned data_len, const FLAC__int32 qlp_coeff[], unsigned order, int lp_quantization, FLAC__int32 data[]); |
| 170 | #ifndef FLAC__NO_ASM |
| 171 | # ifdef FLAC__CPU_IA32 |
| 172 | # ifdef FLAC__HAS_NASM |
| 173 | void FLAC__lpc_restore_signal_asm_ia32(const FLAC__int32 residual[], unsigned data_len, const FLAC__int32 qlp_coeff[], unsigned order, int lp_quantization, FLAC__int32 data[]); |
| 174 | void FLAC__lpc_restore_signal_asm_ia32_mmx(const FLAC__int32 residual[], unsigned data_len, const FLAC__int32 qlp_coeff[], unsigned order, int lp_quantization, FLAC__int32 data[]); |
| 175 | # endif /* FLAC__HAS_NASM */ |
| 176 | # elif defined FLAC__CPU_PPC |
| 177 | void FLAC__lpc_restore_signal_asm_ppc_altivec_16(const FLAC__int32 residual[], unsigned data_len, const FLAC__int32 qlp_coeff[], unsigned order, int lp_quantization, FLAC__int32 data[]); |
| 178 | void FLAC__lpc_restore_signal_asm_ppc_altivec_16_order8(const FLAC__int32 residual[], unsigned data_len, const FLAC__int32 qlp_coeff[], unsigned order, int lp_quantization, FLAC__int32 data[]); |
| 179 | # endif/* FLAC__CPU_IA32 || FLAC__CPU_PPC */ |
| 180 | #endif /* FLAC__NO_ASM */ |
| 181 | |
| 182 | #ifndef FLAC__INTEGER_ONLY_LIBRARY |
| 183 | |
| 184 | /* |
| 185 | * FLAC__lpc_compute_expected_bits_per_residual_sample() |
| 186 | * -------------------------------------------------------------------- |
| 187 | * Compute the expected number of bits per residual signal sample |
| 188 | * based on the LP error (which is related to the residual variance). |
| 189 | * |
| 190 | * IN lpc_error >= 0.0 error returned from calculating LP coefficients |
| 191 | * IN total_samples > 0 # of samples in residual signal |
| 192 | * RETURN expected bits per sample |
| 193 | */ |
| 194 | FLAC__double FLAC__lpc_compute_expected_bits_per_residual_sample(FLAC__double lpc_error, unsigned total_samples); |
| 195 | FLAC__double FLAC__lpc_compute_expected_bits_per_residual_sample_with_error_scale(FLAC__double lpc_error, FLAC__double error_scale); |
| 196 | |
| 197 | /* |
| 198 | * FLAC__lpc_compute_best_order() |
| 199 | * -------------------------------------------------------------------- |
| 200 | * Compute the best order from the array of signal errors returned |
| 201 | * during coefficient computation. |
| 202 | * |
| 203 | * IN lpc_error[0,max_order-1] >= 0.0 error returned from calculating LP coefficients |
| 204 | * IN max_order > 0 max LP order |
| 205 | * IN total_samples > 0 # of samples in residual signal |
| 206 | * IN overhead_bits_per_order # of bits overhead for each increased LP order |
| 207 | * (includes warmup sample size and quantized LP coefficient) |
| 208 | * RETURN [1,max_order] best order |
| 209 | */ |
| 210 | unsigned FLAC__lpc_compute_best_order(const FLAC__double lpc_error[], unsigned max_order, unsigned total_samples, unsigned overhead_bits_per_order); |
| 211 | |
| 212 | #endif /* !defined FLAC__INTEGER_ONLY_LIBRARY */ |
| 213 | |
| 214 | #endif |
trunk/src/lib/libflac/libFLAC/include/private/memory.h
| r0 | r242221 | |
| 1 | /* libFLAC - Free Lossless Audio Codec library |
| 2 | * Copyright (C) 2001,2002,2003,2004,2005,2006,2007 Josh Coalson |
| 3 | * |
| 4 | * Redistribution and use in source and binary forms, with or without |
| 5 | * modification, are permitted provided that the following conditions |
| 6 | * are met: |
| 7 | * |
| 8 | * - Redistributions of source code must retain the above copyright |
| 9 | * notice, this list of conditions and the following disclaimer. |
| 10 | * |
| 11 | * - Redistributions in binary form must reproduce the above copyright |
| 12 | * notice, this list of conditions and the following disclaimer in the |
| 13 | * documentation and/or other materials provided with the distribution. |
| 14 | * |
| 15 | * - Neither the name of the Xiph.org Foundation nor the names of its |
| 16 | * contributors may be used to endorse or promote products derived from |
| 17 | * this software without specific prior written permission. |
| 18 | * |
| 19 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
| 20 | * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
| 21 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
| 22 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR |
| 23 | * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, |
| 24 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, |
| 25 | * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR |
| 26 | * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF |
| 27 | * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING |
| 28 | * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
| 29 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 30 | */ |
| 31 | |
| 32 | #ifndef FLAC__PRIVATE__MEMORY_H |
| 33 | #define FLAC__PRIVATE__MEMORY_H |
| 34 | |
| 35 | #ifdef HAVE_CONFIG_H |
| 36 | #include <config.h> |
| 37 | #endif |
| 38 | |
| 39 | #include <stdlib.h> /* for size_t */ |
| 40 | |
| 41 | #include "private/float.h" |
| 42 | #include "FLAC/ordinals.h" /* for FLAC__bool */ |
| 43 | |
| 44 | /* Returns the unaligned address returned by malloc. |
| 45 | * Use free() on this address to deallocate. |
| 46 | */ |
| 47 | void *FLAC__memory_alloc_aligned(size_t bytes, void **aligned_address); |
| 48 | FLAC__bool FLAC__memory_alloc_aligned_int32_array(size_t elements, FLAC__int32 **unaligned_pointer, FLAC__int32 **aligned_pointer); |
| 49 | FLAC__bool FLAC__memory_alloc_aligned_uint32_array(size_t elements, FLAC__uint32 **unaligned_pointer, FLAC__uint32 **aligned_pointer); |
| 50 | FLAC__bool FLAC__memory_alloc_aligned_uint64_array(size_t elements, FLAC__uint64 **unaligned_pointer, FLAC__uint64 **aligned_pointer); |
| 51 | FLAC__bool FLAC__memory_alloc_aligned_unsigned_array(size_t elements, unsigned **unaligned_pointer, unsigned **aligned_pointer); |
| 52 | #ifndef FLAC__INTEGER_ONLY_LIBRARY |
| 53 | FLAC__bool FLAC__memory_alloc_aligned_real_array(size_t elements, FLAC__real **unaligned_pointer, FLAC__real **aligned_pointer); |
| 54 | #endif |
| 55 | |
| 56 | #endif |
trunk/src/lib/libflac/libFLAC/include/private/metadata.h
| r0 | r242221 | |
| 1 | /* libFLAC - Free Lossless Audio Codec library |
| 2 | * Copyright (C) 2002,2003,2004,2005,2006,2007 Josh Coalson |
| 3 | * |
| 4 | * Redistribution and use in source and binary forms, with or without |
| 5 | * modification, are permitted provided that the following conditions |
| 6 | * are met: |
| 7 | * |
| 8 | * - Redistributions of source code must retain the above copyright |
| 9 | * notice, this list of conditions and the following disclaimer. |
| 10 | * |
| 11 | * - Redistributions in binary form must reproduce the above copyright |
| 12 | * notice, this list of conditions and the following disclaimer in the |
| 13 | * documentation and/or other materials provided with the distribution. |
| 14 | * |
| 15 | * - Neither the name of the Xiph.org Foundation nor the names of its |
| 16 | * contributors may be used to endorse or promote products derived from |
| 17 | * this software without specific prior written permission. |
| 18 | * |
| 19 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
| 20 | * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
| 21 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
| 22 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR |
| 23 | * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, |
| 24 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, |
| 25 | * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR |
| 26 | * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF |
| 27 | * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING |
| 28 | * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
| 29 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 30 | */ |
| 31 | |
| 32 | #ifndef FLAC__PRIVATE__METADATA_H |
| 33 | #define FLAC__PRIVATE__METADATA_H |
| 34 | |
| 35 | #include "FLAC/metadata.h" |
| 36 | |
| 37 | /* WATCHOUT: all malloc()ed data in the block is free()ed; this may not |
| 38 | * be a consistent state (e.g. PICTURE) or equivalent to the initial |
| 39 | * state after FLAC__metadata_object_new() |
| 40 | */ |
| 41 | void FLAC__metadata_object_delete_data(FLAC__StreamMetadata *object); |
| 42 | |
| 43 | void FLAC__metadata_object_cuesheet_track_delete_data(FLAC__StreamMetadata_CueSheet_Track *object); |
| 44 | |
| 45 | #endif |
trunk/src/lib/libflac/libFLAC/include/private/stream_encoder_framing.h
| r0 | r242221 | |
| 1 | /* libFLAC - Free Lossless Audio Codec library |
| 2 | * Copyright (C) 2000,2001,2002,2003,2004,2005,2006,2007 Josh Coalson |
| 3 | * |
| 4 | * Redistribution and use in source and binary forms, with or without |
| 5 | * modification, are permitted provided that the following conditions |
| 6 | * are met: |
| 7 | * |
| 8 | * - Redistributions of source code must retain the above copyright |
| 9 | * notice, this list of conditions and the following disclaimer. |
| 10 | * |
| 11 | * - Redistributions in binary form must reproduce the above copyright |
| 12 | * notice, this list of conditions and the following disclaimer in the |
| 13 | * documentation and/or other materials provided with the distribution. |
| 14 | * |
| 15 | * - Neither the name of the Xiph.org Foundation nor the names of its |
| 16 | * contributors may be used to endorse or promote products derived from |
| 17 | * this software without specific prior written permission. |
| 18 | * |
| 19 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
| 20 | * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
| 21 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
| 22 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR |
| 23 | * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, |
| 24 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, |
| 25 | * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR |
| 26 | * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF |
| 27 | * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING |
| 28 | * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
| 29 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 30 | */ |
| 31 | |
| 32 | #ifndef FLAC__PRIVATE__STREAM_ENCODER_FRAMING_H |
| 33 | #define FLAC__PRIVATE__STREAM_ENCODER_FRAMING_H |
| 34 | |
| 35 | #include "FLAC/format.h" |
| 36 | #include "bitwriter.h" |
| 37 | |
| 38 | FLAC__bool FLAC__add_metadata_block(const FLAC__StreamMetadata *metadata, FLAC__BitWriter *bw); |
| 39 | FLAC__bool FLAC__frame_add_header(const FLAC__FrameHeader *header, FLAC__BitWriter *bw); |
| 40 | FLAC__bool FLAC__subframe_add_constant(const FLAC__Subframe_Constant *subframe, unsigned subframe_bps, unsigned wasted_bits, FLAC__BitWriter *bw); |
| 41 | FLAC__bool FLAC__subframe_add_fixed(const FLAC__Subframe_Fixed *subframe, unsigned residual_samples, unsigned subframe_bps, unsigned wasted_bits, FLAC__BitWriter *bw); |
| 42 | FLAC__bool FLAC__subframe_add_lpc(const FLAC__Subframe_LPC *subframe, unsigned residual_samples, unsigned subframe_bps, unsigned wasted_bits, FLAC__BitWriter *bw); |
| 43 | FLAC__bool FLAC__subframe_add_verbatim(const FLAC__Subframe_Verbatim *subframe, unsigned samples, unsigned subframe_bps, unsigned wasted_bits, FLAC__BitWriter *bw); |
| 44 | |
| 45 | #endif |
trunk/src/lib/libflac/libFLAC/include/private/window.h
| r0 | r242221 | |
| 1 | /* libFLAC - Free Lossless Audio Codec library |
| 2 | * Copyright (C) 2006,2007 Josh Coalson |
| 3 | * |
| 4 | * Redistribution and use in source and binary forms, with or without |
| 5 | * modification, are permitted provided that the following conditions |
| 6 | * are met: |
| 7 | * |
| 8 | * - Redistributions of source code must retain the above copyright |
| 9 | * notice, this list of conditions and the following disclaimer. |
| 10 | * |
| 11 | * - Redistributions in binary form must reproduce the above copyright |
| 12 | * notice, this list of conditions and the following disclaimer in the |
| 13 | * documentation and/or other materials provided with the distribution. |
| 14 | * |
| 15 | * - Neither the name of the Xiph.org Foundation nor the names of its |
| 16 | * contributors may be used to endorse or promote products derived from |
| 17 | * this software without specific prior written permission. |
| 18 | * |
| 19 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
| 20 | * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
| 21 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
| 22 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR |
| 23 | * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, |
| 24 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, |
| 25 | * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR |
| 26 | * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF |
| 27 | * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING |
| 28 | * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
| 29 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 30 | */ |
| 31 | |
| 32 | #ifndef FLAC__PRIVATE__WINDOW_H |
| 33 | #define FLAC__PRIVATE__WINDOW_H |
| 34 | |
| 35 | #ifdef HAVE_CONFIG_H |
| 36 | #include <config.h> |
| 37 | #endif |
| 38 | |
| 39 | #include "private/float.h" |
| 40 | #include "FLAC/format.h" |
| 41 | |
| 42 | #ifndef FLAC__INTEGER_ONLY_LIBRARY |
| 43 | |
| 44 | /* |
| 45 | * FLAC__window_*() |
| 46 | * -------------------------------------------------------------------- |
| 47 | * Calculates window coefficients according to different apodization |
| 48 | * functions. |
| 49 | * |
| 50 | * OUT window[0,L-1] |
| 51 | * IN L (number of points in window) |
| 52 | */ |
| 53 | void FLAC__window_bartlett(FLAC__real *window, const FLAC__int32 L); |
| 54 | void FLAC__window_bartlett_hann(FLAC__real *window, const FLAC__int32 L); |
| 55 | void FLAC__window_blackman(FLAC__real *window, const FLAC__int32 L); |
| 56 | void FLAC__window_blackman_harris_4term_92db_sidelobe(FLAC__real *window, const FLAC__int32 L); |
| 57 | void FLAC__window_connes(FLAC__real *window, const FLAC__int32 L); |
| 58 | void FLAC__window_flattop(FLAC__real *window, const FLAC__int32 L); |
| 59 | void FLAC__window_gauss(FLAC__real *window, const FLAC__int32 L, const FLAC__real stddev); /* 0.0 < stddev <= 0.5 */ |
| 60 | void FLAC__window_hamming(FLAC__real *window, const FLAC__int32 L); |
| 61 | void FLAC__window_hann(FLAC__real *window, const FLAC__int32 L); |
| 62 | void FLAC__window_kaiser_bessel(FLAC__real *window, const FLAC__int32 L); |
| 63 | void FLAC__window_nuttall(FLAC__real *window, const FLAC__int32 L); |
| 64 | void FLAC__window_rectangle(FLAC__real *window, const FLAC__int32 L); |
| 65 | void FLAC__window_triangle(FLAC__real *window, const FLAC__int32 L); |
| 66 | void FLAC__window_tukey(FLAC__real *window, const FLAC__int32 L, const FLAC__real p); |
| 67 | void FLAC__window_welch(FLAC__real *window, const FLAC__int32 L); |
| 68 | |
| 69 | #endif /* !defined FLAC__INTEGER_ONLY_LIBRARY */ |
| 70 | |
| 71 | #endif |
trunk/src/lib/libflac/libFLAC/include/protected/stream_decoder.h
| r0 | r242221 | |
| 1 | /* libFLAC - Free Lossless Audio Codec library |
| 2 | * Copyright (C) 2000,2001,2002,2003,2004,2005,2006,2007 Josh Coalson |
| 3 | * |
| 4 | * Redistribution and use in source and binary forms, with or without |
| 5 | * modification, are permitted provided that the following conditions |
| 6 | * are met: |
| 7 | * |
| 8 | * - Redistributions of source code must retain the above copyright |
| 9 | * notice, this list of conditions and the following disclaimer. |
| 10 | * |
| 11 | * - Redistributions in binary form must reproduce the above copyright |
| 12 | * notice, this list of conditions and the following disclaimer in the |
| 13 | * documentation and/or other materials provided with the distribution. |
| 14 | * |
| 15 | * - Neither the name of the Xiph.org Foundation nor the names of its |
| 16 | * contributors may be used to endorse or promote products derived from |
| 17 | * this software without specific prior written permission. |
| 18 | * |
| 19 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
| 20 | * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
| 21 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
| 22 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR |
| 23 | * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, |
| 24 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, |
| 25 | * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR |
| 26 | * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF |
| 27 | * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING |
| 28 | * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
| 29 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 30 | */ |
| 31 | |
| 32 | #ifndef FLAC__PROTECTED__STREAM_DECODER_H |
| 33 | #define FLAC__PROTECTED__STREAM_DECODER_H |
| 34 | |
| 35 | #include "FLAC/stream_decoder.h" |
| 36 | #if FLAC__HAS_OGG |
| 37 | #include "private/ogg_decoder_aspect.h" |
| 38 | #endif |
| 39 | |
| 40 | typedef struct FLAC__StreamDecoderProtected { |
| 41 | FLAC__StreamDecoderState state; |
| 42 | unsigned channels; |
| 43 | FLAC__ChannelAssignment channel_assignment; |
| 44 | unsigned bits_per_sample; |
| 45 | unsigned sample_rate; /* in Hz */ |
| 46 | unsigned blocksize; /* in samples (per channel) */ |
| 47 | FLAC__bool md5_checking; /* if true, generate MD5 signature of decoded data and compare against signature in the STREAMINFO metadata block */ |
| 48 | #if FLAC__HAS_OGG |
| 49 | FLAC__OggDecoderAspect ogg_decoder_aspect; |
| 50 | #endif |
| 51 | } FLAC__StreamDecoderProtected; |
| 52 | |
| 53 | /* |
| 54 | * return the number of input bytes consumed |
| 55 | */ |
| 56 | unsigned FLAC__stream_decoder_get_input_bytes_unconsumed(const FLAC__StreamDecoder *decoder); |
| 57 | |
| 58 | #endif |
trunk/src/lib/libflac/libFLAC/include/protected/stream_encoder.h
| r0 | r242221 | |
| 1 | /* libFLAC - Free Lossless Audio Codec library |
| 2 | * Copyright (C) 2001,2002,2003,2004,2005,2006,2007 Josh Coalson |
| 3 | * |
| 4 | * Redistribution and use in source and binary forms, with or without |
| 5 | * modification, are permitted provided that the following conditions |
| 6 | * are met: |
| 7 | * |
| 8 | * - Redistributions of source code must retain the above copyright |
| 9 | * notice, this list of conditions and the following disclaimer. |
| 10 | * |
| 11 | * - Redistributions in binary form must reproduce the above copyright |
| 12 | * notice, this list of conditions and the following disclaimer in the |
| 13 | * documentation and/or other materials provided with the distribution. |
| 14 | * |
| 15 | * - Neither the name of the Xiph.org Foundation nor the names of its |
| 16 | * contributors may be used to endorse or promote products derived from |
| 17 | * this software without specific prior written permission. |
| 18 | * |
| 19 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
| 20 | * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
| 21 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
| 22 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR |
| 23 | * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, |
| 24 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, |
| 25 | * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR |
| 26 | * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF |
| 27 | * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING |
| 28 | * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
| 29 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 30 | */ |
| 31 | |
| 32 | #ifndef FLAC__PROTECTED__STREAM_ENCODER_H |
| 33 | #define FLAC__PROTECTED__STREAM_ENCODER_H |
| 34 | |
| 35 | #include "FLAC/stream_encoder.h" |
| 36 | #if FLAC__HAS_OGG |
| 37 | #include "private/ogg_encoder_aspect.h" |
| 38 | #endif |
| 39 | |
| 40 | #ifndef FLAC__INTEGER_ONLY_LIBRARY |
| 41 | |
| 42 | #include "private/float.h" |
| 43 | |
| 44 | #define FLAC__MAX_APODIZATION_FUNCTIONS 32 |
| 45 | |
| 46 | typedef enum { |
| 47 | FLAC__APODIZATION_BARTLETT, |
| 48 | FLAC__APODIZATION_BARTLETT_HANN, |
| 49 | FLAC__APODIZATION_BLACKMAN, |
| 50 | FLAC__APODIZATION_BLACKMAN_HARRIS_4TERM_92DB_SIDELOBE, |
| 51 | FLAC__APODIZATION_CONNES, |
| 52 | FLAC__APODIZATION_FLATTOP, |
| 53 | FLAC__APODIZATION_GAUSS, |
| 54 | FLAC__APODIZATION_HAMMING, |
| 55 | FLAC__APODIZATION_HANN, |
| 56 | FLAC__APODIZATION_KAISER_BESSEL, |
| 57 | FLAC__APODIZATION_NUTTALL, |
| 58 | FLAC__APODIZATION_RECTANGLE, |
| 59 | FLAC__APODIZATION_TRIANGLE, |
| 60 | FLAC__APODIZATION_TUKEY, |
| 61 | FLAC__APODIZATION_WELCH |
| 62 | } FLAC__ApodizationFunction; |
| 63 | |
| 64 | typedef struct { |
| 65 | FLAC__ApodizationFunction type; |
| 66 | union { |
| 67 | struct { |
| 68 | FLAC__real stddev; |
| 69 | } gauss; |
| 70 | struct { |
| 71 | FLAC__real p; |
| 72 | } tukey; |
| 73 | } parameters; |
| 74 | } FLAC__ApodizationSpecification; |
| 75 | |
| 76 | #endif // #ifndef FLAC__INTEGER_ONLY_LIBRARY |
| 77 | |
| 78 | typedef struct FLAC__StreamEncoderProtected { |
| 79 | FLAC__StreamEncoderState state; |
| 80 | FLAC__bool verify; |
| 81 | FLAC__bool streamable_subset; |
| 82 | FLAC__bool do_md5; |
| 83 | FLAC__bool do_mid_side_stereo; |
| 84 | FLAC__bool loose_mid_side_stereo; |
| 85 | unsigned channels; |
| 86 | unsigned bits_per_sample; |
| 87 | unsigned sample_rate; |
| 88 | unsigned blocksize; |
| 89 | #ifndef FLAC__INTEGER_ONLY_LIBRARY |
| 90 | unsigned num_apodizations; |
| 91 | FLAC__ApodizationSpecification apodizations[FLAC__MAX_APODIZATION_FUNCTIONS]; |
| 92 | #endif |
| 93 | unsigned max_lpc_order; |
| 94 | unsigned qlp_coeff_precision; |
| 95 | FLAC__bool do_qlp_coeff_prec_search; |
| 96 | FLAC__bool do_exhaustive_model_search; |
| 97 | FLAC__bool do_escape_coding; |
| 98 | unsigned min_residual_partition_order; |
| 99 | unsigned max_residual_partition_order; |
| 100 | unsigned rice_parameter_search_dist; |
| 101 | FLAC__uint64 total_samples_estimate; |
| 102 | FLAC__StreamMetadata **metadata; |
| 103 | unsigned num_metadata_blocks; |
| 104 | FLAC__uint64 streaminfo_offset, seektable_offset, audio_offset; |
| 105 | #if FLAC__HAS_OGG |
| 106 | FLAC__OggEncoderAspect ogg_encoder_aspect; |
| 107 | #endif |
| 108 | } FLAC__StreamEncoderProtected; |
| 109 | |
| 110 | #endif |