Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(327)

Side by Side Diff: flac/src/libFLAC/include/private/float.h

Issue 6122009: Add FLAC to trunk/deps/third_party/.... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/deps/third_party/
Patch Set: '' Created 9 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « flac/src/libFLAC/include/private/fixed.h ('k') | flac/src/libFLAC/include/private/format.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Property Changes:
Added: svn:eol-style
+ LF
OLDNEW
(Empty)
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)*(FLA C__int64)(y)) >> 16 ) )
73
74 #define FLAC__fixedpoint_div(x, y) ( (FLAC__fixedpoint) ( ( ((FLAC__int64)(x)<<3 2) / (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 p recision);
94
95 #endif
96
97 #endif
OLDNEW
« no previous file with comments | « flac/src/libFLAC/include/private/fixed.h ('k') | flac/src/libFLAC/include/private/format.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698