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

Side by Side Diff: celt/entcode.c

Issue 12388030: Update Opus to 1.0.2. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/deps/third_party/opus
Patch Set: Created 7 years, 9 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 | « celt/ecintrin.h ('k') | celt/pitch.c » ('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) 2001-2011 Timothy B. Terriberry 1 /* Copyright (c) 2001-2011 Timothy B. Terriberry
2 */ 2 */
3 /* 3 /*
4 Redistribution and use in source and binary forms, with or without 4 Redistribution and use in source and binary forms, with or without
5 modification, are permitted provided that the following conditions 5 modification, are permitted provided that the following conditions
6 are met: 6 are met:
7 7
8 - Redistributions of source code must retain the above copyright 8 - Redistributions of source code must retain the above copyright
9 notice, this list of conditions and the following disclaimer. 9 notice, this list of conditions and the following disclaimer.
10 10
(...skipping 15 matching lines...) Expand all
26 */ 26 */
27 27
28 #ifdef HAVE_CONFIG_H 28 #ifdef HAVE_CONFIG_H
29 #include "config.h" 29 #include "config.h"
30 #endif 30 #endif
31 31
32 #include "entcode.h" 32 #include "entcode.h"
33 #include "arch.h" 33 #include "arch.h"
34 34
35 #if !defined(EC_CLZ) 35 #if !defined(EC_CLZ)
36 /*This is a fallback for systems where we don't know how to access
37 a BSR or CLZ instruction (see ecintrin.h).
38 If you are optimizing Opus on a new platform and it has a native CLZ or
39 BZR (e.g. cell, MIPS, x86, etc) then making it available to Opus will be
40 an easy performance win.*/
36 int ec_ilog(opus_uint32 _v){ 41 int ec_ilog(opus_uint32 _v){
37 /*On a Pentium M, this branchless version tested as the fastest on 42 /*On a Pentium M, this branchless version tested as the fastest on
38 1,000,000,000 random 32-bit integers, edging out a similar version with 43 1,000,000,000 random 32-bit integers, edging out a similar version with
39 branches, and a 256-entry LUT version.*/ 44 branches, and a 256-entry LUT version.*/
40 int ret; 45 int ret;
41 int m; 46 int m;
42 ret=!!_v; 47 ret=!!_v;
43 m=!!(_v&0xFFFF0000)<<4; 48 m=!!(_v&0xFFFF0000)<<4;
44 _v>>=m; 49 _v>>=m;
45 ret|=m; 50 ret|=m;
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 r=_this->rng>>(l-16); 84 r=_this->rng>>(l-16);
80 for(i=BITRES;i-->0;){ 85 for(i=BITRES;i-->0;){
81 int b; 86 int b;
82 r=r*r>>15; 87 r=r*r>>15;
83 b=(int)(r>>16); 88 b=(int)(r>>16);
84 l=l<<1|b; 89 l=l<<1|b;
85 r>>=b; 90 r>>=b;
86 } 91 }
87 return nbits-l; 92 return nbits-l;
88 } 93 }
OLDNEW
« no previous file with comments | « celt/ecintrin.h ('k') | celt/pitch.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698