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

Side by Side Diff: celt/fixed_generic.h

Issue 882843002: Update to opus-HEAD-66611f1. (Closed) Base URL: https://chromium.googlesource.com/chromium/deps/opus.git@master
Patch Set: Add the contents of Makefile.mips back. Created 5 years, 10 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
« 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 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 106
107 /* (opus_val32)(opus_val16) gives TI compiler a hint that it's 16x16->32 multipl y */ 107 /* (opus_val32)(opus_val16) gives TI compiler a hint that it's 16x16->32 multipl y */
108 /** 16x16 multiplication where the result fits in 32 bits */ 108 /** 16x16 multiplication where the result fits in 32 bits */
109 #define MULT16_16(a,b) (((opus_val32)(opus_val16)(a))*((opus_val32)(opus_val 16)(b))) 109 #define MULT16_16(a,b) (((opus_val32)(opus_val16)(a))*((opus_val32)(opus_val 16)(b)))
110 110
111 /** 16x16 multiply-add where the result fits in 32 bits */ 111 /** 16x16 multiply-add where the result fits in 32 bits */
112 #define MAC16_16(c,a,b) (ADD32((c),MULT16_16((a),(b)))) 112 #define MAC16_16(c,a,b) (ADD32((c),MULT16_16((a),(b))))
113 /** 16x32 multiply, followed by a 15-bit shift right and 32-bit add. 113 /** 16x32 multiply, followed by a 15-bit shift right and 32-bit add.
114 b must fit in 31 bits. 114 b must fit in 31 bits.
115 Result fits in 32 bits. */ 115 Result fits in 32 bits. */
116 #define MAC16_32_Q15(c,a,b) ADD32(c,ADD32(MULT16_16((a),SHR((b),15)), SHR(MULT16 _16((a),((b)&0x00007fff)),15))) 116 #define MAC16_32_Q15(c,a,b) ADD32((c),ADD32(MULT16_16((a),SHR((b),15)), SHR(MULT 16_16((a),((b)&0x00007fff)),15)))
117
118 /** 16x32 multiplication, followed by a 16-bit shift right and 32-bit add.
119 Results fits in 32 bits */
120 #define MAC16_32_Q16(c,a,b) ADD32((c),ADD32(MULT16_16((a),SHR((b),16)), SHR(MULT 16_16SU((a),((b)&0x0000ffff)),16)))
117 121
118 #define MULT16_16_Q11_32(a,b) (SHR(MULT16_16((a),(b)),11)) 122 #define MULT16_16_Q11_32(a,b) (SHR(MULT16_16((a),(b)),11))
119 #define MULT16_16_Q11(a,b) (SHR(MULT16_16((a),(b)),11)) 123 #define MULT16_16_Q11(a,b) (SHR(MULT16_16((a),(b)),11))
120 #define MULT16_16_Q13(a,b) (SHR(MULT16_16((a),(b)),13)) 124 #define MULT16_16_Q13(a,b) (SHR(MULT16_16((a),(b)),13))
121 #define MULT16_16_Q14(a,b) (SHR(MULT16_16((a),(b)),14)) 125 #define MULT16_16_Q14(a,b) (SHR(MULT16_16((a),(b)),14))
122 #define MULT16_16_Q15(a,b) (SHR(MULT16_16((a),(b)),15)) 126 #define MULT16_16_Q15(a,b) (SHR(MULT16_16((a),(b)),15))
123 127
124 #define MULT16_16_P13(a,b) (SHR(ADD32(4096,MULT16_16((a),(b))),13)) 128 #define MULT16_16_P13(a,b) (SHR(ADD32(4096,MULT16_16((a),(b))),13))
125 #define MULT16_16_P14(a,b) (SHR(ADD32(8192,MULT16_16((a),(b))),14)) 129 #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)) 130 #define MULT16_16_P15(a,b) (SHR(ADD32(16384,MULT16_16((a),(b))),15))
127 131
128 /** Divide a 32-bit value by a 16-bit value. Result fits in 16 bits */ 132 /** 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)))) 133 #define DIV32_16(a,b) ((opus_val16)(((opus_val32)(a))/((opus_val16)(b))))
130 134
131 /** Divide a 32-bit value by a 32-bit value. Result fits in 32 bits */ 135 /** 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))) 136 #define DIV32(a,b) (((opus_val32)(a))/((opus_val32)(b)))
133 137
138 #if defined(MIPSr1_ASM)
139 #include "mips/fixed_generic_mipsr1.h"
134 #endif 140 #endif
141
142 static OPUS_INLINE opus_val16 SIG2WORD16_generic(celt_sig x)
143 {
144 x = PSHR32(x, SIG_SHIFT);
145 x = MAX32(x, -32768);
146 x = MIN32(x, 32767);
147 return EXTRACT16(x);
148 }
149 #define SIG2WORD16(x) (SIG2WORD16_generic(x))
150
151 #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