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

Side by Side Diff: celt/fixed_generic.h

Issue 107243004: Updating Opus to release 1.1 (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/deps/third_party/opus
Patch Set: Created 7 years 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 | « celt/fixed_debug.h ('k') | celt/float_cast.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* Copyright (C) 2007-2009 Xiph.Org Foundation 1 /* Copyright (C) 2007-2009 Xiph.Org Foundation
2 Copyright (C) 2003-2008 Jean-Marc Valin 2 Copyright (C) 2003-2008 Jean-Marc Valin
3 Copyright (C) 2007-2008 CSIRO */ 3 Copyright (C) 2007-2008 CSIRO */
4 /** 4 /**
5 @file fixed_generic.h 5 @file fixed_generic.h
6 @brief Generic fixed-point operations 6 @brief Generic fixed-point operations
7 */ 7 */
8 /* 8 /*
9 Redistribution and use in source and binary forms, with or without 9 Redistribution and use in source and binary forms, with or without
10 modification, are permitted provided that the following conditions 10 modification, are permitted provided that the following conditions
(...skipping 22 matching lines...) Expand all
33 #ifndef FIXED_GENERIC_H 33 #ifndef FIXED_GENERIC_H
34 #define FIXED_GENERIC_H 34 #define FIXED_GENERIC_H
35 35
36 /** Multiply a 16-bit signed value by a 16-bit unsigned value. The result is a 3 2-bit signed value */ 36 /** Multiply a 16-bit signed value by a 16-bit unsigned value. The result is a 3 2-bit signed value */
37 #define MULT16_16SU(a,b) ((opus_val32)(opus_val16)(a)*(opus_val32)(opus_uint16)( b)) 37 #define MULT16_16SU(a,b) ((opus_val32)(opus_val16)(a)*(opus_val32)(opus_uint16)( b))
38 38
39 /** 16x32 multiplication, followed by a 16-bit shift right. Results fits in 32 b its */ 39 /** 16x32 multiplication, followed by a 16-bit shift right. Results fits in 32 b its */
40 #define MULT16_32_Q16(a,b) ADD32(MULT16_16((a),SHR((b),16)), SHR(MULT16_16SU((a) ,((b)&0x0000ffff)),16)) 40 #define MULT16_32_Q16(a,b) ADD32(MULT16_16((a),SHR((b),16)), SHR(MULT16_16SU((a) ,((b)&0x0000ffff)),16))
41 41
42 /** 16x32 multiplication, followed by a 16-bit shift right (round-to-nearest). R esults fits in 32 bits */ 42 /** 16x32 multiplication, followed by a 16-bit shift right (round-to-nearest). R esults fits in 32 bits */
43 #define MULT16_32_P16(a,b) ADD32(MULT16_16((a),SHR((b),16)), PSHR(MULT16_16((a), ((b)&0x0000ffff)),16)) 43 #define MULT16_32_P16(a,b) ADD32(MULT16_16((a),SHR((b),16)), PSHR(MULT16_16SU((a ),((b)&0x0000ffff)),16))
44 44
45 /** 16x32 multiplication, followed by a 15-bit shift right. Results fits in 32 b its */ 45 /** 16x32 multiplication, followed by a 15-bit shift right. Results fits in 32 b its */
46 #define MULT16_32_Q15(a,b) ADD32(SHL(MULT16_16((a),SHR((b),16)),1), SHR(MULT16_1 6SU((a),((b)&0x0000ffff)),15)) 46 #define MULT16_32_Q15(a,b) ADD32(SHL(MULT16_16((a),SHR((b),16)),1), SHR(MULT16_1 6SU((a),((b)&0x0000ffff)),15))
47 47
48 /** 32x32 multiplication, followed by a 31-bit shift right. Results fits in 32 b its */ 48 /** 32x32 multiplication, followed by a 31-bit shift right. Results fits in 32 b its */
49 #define MULT32_32_Q31(a,b) ADD32(ADD32(SHL(MULT16_16(SHR((a),16),SHR((b),16)),1) , SHR(MULT16_16SU(SHR((a),16),((b)&0x0000ffff)),15)), SHR(MULT16_16SU(SHR((b),16 ),((a)&0x0000ffff)),15)) 49 #define MULT32_32_Q31(a,b) ADD32(ADD32(SHL(MULT16_16(SHR((a),16),SHR((b),16)),1) , SHR(MULT16_16SU(SHR((a),16),((b)&0x0000ffff)),15)), SHR(MULT16_16SU(SHR((b),16 ),((a)&0x0000ffff)),15))
50 50
51 /** Compile-time conversion of float constant to 16-bit value */ 51 /** Compile-time conversion of float constant to 16-bit value */
52 #define QCONST16(x,bits) ((opus_val16)(.5+(x)*(((opus_val32)1)<<(bits)))) 52 #define QCONST16(x,bits) ((opus_val16)(.5+(x)*(((opus_val32)1)<<(bits))))
53 53
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
125 #define MULT16_16_P14(a,b) (SHR(ADD32(8192,MULT16_16((a),(b))),14)) 125 #define MULT16_16_P14(a,b) (SHR(ADD32(8192,MULT16_16((a),(b))),14))
126 #define MULT16_16_P15(a,b) (SHR(ADD32(16384,MULT16_16((a),(b))),15)) 126 #define MULT16_16_P15(a,b) (SHR(ADD32(16384,MULT16_16((a),(b))),15))
127 127
128 /** Divide a 32-bit value by a 16-bit value. Result fits in 16 bits */ 128 /** Divide a 32-bit value by a 16-bit value. Result fits in 16 bits */
129 #define DIV32_16(a,b) ((opus_val16)(((opus_val32)(a))/((opus_val16)(b)))) 129 #define DIV32_16(a,b) ((opus_val16)(((opus_val32)(a))/((opus_val16)(b))))
130 130
131 /** Divide a 32-bit value by a 32-bit value. Result fits in 32 bits */ 131 /** Divide a 32-bit value by a 32-bit value. Result fits in 32 bits */
132 #define DIV32(a,b) (((opus_val32)(a))/((opus_val32)(b))) 132 #define DIV32(a,b) (((opus_val32)(a))/((opus_val32)(b)))
133 133
134 #endif 134 #endif
OLDNEW
« no previous file with comments | « celt/fixed_debug.h ('k') | celt/float_cast.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698