optimisation: Making it clear to the compiler that many of the loops in cwrs
need to iterate at least once.
This commit is contained in:
parent
57e004bf74
commit
558c50eb3d
4 changed files with 21 additions and 14 deletions
|
@ -54,22 +54,24 @@
|
||||||
static inline void unext32(celt_uint32_t *_ui,int _len,celt_uint32_t _ui0){
|
static inline void unext32(celt_uint32_t *_ui,int _len,celt_uint32_t _ui0){
|
||||||
celt_uint32_t ui1;
|
celt_uint32_t ui1;
|
||||||
int j;
|
int j;
|
||||||
for(j=1;j<_len;j++){
|
/* doing a do-while would overrun the array if we had less than 2 samples */
|
||||||
|
j=1; do {
|
||||||
ui1=_ui[j]+_ui[j-1]+_ui0;
|
ui1=_ui[j]+_ui[j-1]+_ui0;
|
||||||
_ui[j-1]=_ui0;
|
_ui[j-1]=_ui0;
|
||||||
_ui0=ui1;
|
_ui0=ui1;
|
||||||
}
|
} while (++j<_len);
|
||||||
_ui[j-1]=_ui0;
|
_ui[j-1]=_ui0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void unext64(celt_uint64_t *_ui,int _len,celt_uint64_t _ui0){
|
static inline void unext64(celt_uint64_t *_ui,int _len,celt_uint64_t _ui0){
|
||||||
celt_uint64_t ui1;
|
celt_uint64_t ui1;
|
||||||
int j;
|
int j;
|
||||||
for(j=1;j<_len;j++){
|
/* doing a do-while would overrun the array if we had less than 2 samples */
|
||||||
|
j=1; do {
|
||||||
ui1=_ui[j]+_ui[j-1]+_ui0;
|
ui1=_ui[j]+_ui[j-1]+_ui0;
|
||||||
_ui[j-1]=_ui0;
|
_ui[j-1]=_ui0;
|
||||||
_ui0=ui1;
|
_ui0=ui1;
|
||||||
}
|
} while (++j<_len);
|
||||||
_ui[j-1]=_ui0;
|
_ui[j-1]=_ui0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -79,22 +81,24 @@ static inline void unext64(celt_uint64_t *_ui,int _len,celt_uint64_t _ui0){
|
||||||
static inline void uprev32(celt_uint32_t *_ui,int _n,celt_uint32_t _ui0){
|
static inline void uprev32(celt_uint32_t *_ui,int _n,celt_uint32_t _ui0){
|
||||||
celt_uint32_t ui1;
|
celt_uint32_t ui1;
|
||||||
int j;
|
int j;
|
||||||
for(j=1;j<_n;j++){
|
/* doing a do-while would overrun the array if we had less than 2 samples */
|
||||||
|
j=1; do {
|
||||||
ui1=_ui[j]-_ui[j-1]-_ui0;
|
ui1=_ui[j]-_ui[j-1]-_ui0;
|
||||||
_ui[j-1]=_ui0;
|
_ui[j-1]=_ui0;
|
||||||
_ui0=ui1;
|
_ui0=ui1;
|
||||||
}
|
} while (++j<_n);
|
||||||
_ui[j-1]=_ui0;
|
_ui[j-1]=_ui0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void uprev64(celt_uint64_t *_ui,int _n,celt_uint64_t _ui0){
|
static inline void uprev64(celt_uint64_t *_ui,int _n,celt_uint64_t _ui0){
|
||||||
celt_uint64_t ui1;
|
celt_uint64_t ui1;
|
||||||
int j;
|
int j;
|
||||||
for(j=1;j<_n;j++){
|
/* doing a do-while would overrun the array if we had less than 2 samples */
|
||||||
|
j=1; do {
|
||||||
ui1=_ui[j]-_ui[j-1]-_ui0;
|
ui1=_ui[j]-_ui[j-1]-_ui0;
|
||||||
_ui[j-1]=_ui0;
|
_ui[j-1]=_ui0;
|
||||||
_ui0=ui1;
|
_ui0=ui1;
|
||||||
}
|
} while (++j<_n);
|
||||||
_ui[j-1]=_ui0;
|
_ui[j-1]=_ui0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -108,12 +112,13 @@ celt_uint32_t ncwrs_unext32(int _n,celt_uint32_t *_ui){
|
||||||
celt_uint32_t ui1;
|
celt_uint32_t ui1;
|
||||||
int j;
|
int j;
|
||||||
ret=ui0=2;
|
ret=ui0=2;
|
||||||
for(j=1;j<_n;j++){
|
celt_assert(_n>=2);
|
||||||
|
j=1; do {
|
||||||
ui1=_ui[j]+_ui[j-1]+ui0;
|
ui1=_ui[j]+_ui[j-1]+ui0;
|
||||||
_ui[j-1]=ui0;
|
_ui[j-1]=ui0;
|
||||||
ui0=ui1;
|
ui0=ui1;
|
||||||
ret+=ui0;
|
ret+=ui0;
|
||||||
}
|
} while (++j<_n);
|
||||||
_ui[j-1]=ui0;
|
_ui[j-1]=ui0;
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -124,12 +129,13 @@ celt_uint64_t ncwrs_unext64(int _n,celt_uint64_t *_ui){
|
||||||
celt_uint64_t ui1;
|
celt_uint64_t ui1;
|
||||||
int j;
|
int j;
|
||||||
ret=ui0=2;
|
ret=ui0=2;
|
||||||
for(j=1;j<_n;j++){
|
celt_assert(_n>=2);
|
||||||
|
j=1; do {
|
||||||
ui1=_ui[j]+_ui[j-1]+ui0;
|
ui1=_ui[j]+_ui[j-1]+ui0;
|
||||||
_ui[j-1]=ui0;
|
_ui[j-1]=ui0;
|
||||||
ui0=ui1;
|
ui0=ui1;
|
||||||
ret+=ui0;
|
ret+=ui0;
|
||||||
}
|
} while (++j<_n);
|
||||||
_ui[j-1]=ui0;
|
_ui[j-1]=ui0;
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,6 +37,7 @@
|
||||||
|
|
||||||
#include "arch.h"
|
#include "arch.h"
|
||||||
#include "entcode.h"
|
#include "entcode.h"
|
||||||
|
#include "os_support.h"
|
||||||
|
|
||||||
#ifndef OVERRIDE_CELT_ILOG2
|
#ifndef OVERRIDE_CELT_ILOG2
|
||||||
/** Integer log in base2. Undefined for zero and negative numbers */
|
/** Integer log in base2. Undefined for zero and negative numbers */
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
|
|
||||||
int main(int _argc,char **_argv){
|
int main(int _argc,char **_argv){
|
||||||
int n;
|
int n;
|
||||||
for(n=0;n<=NMAX;n++){
|
for(n=2;n<=NMAX;n++){
|
||||||
int m;
|
int m;
|
||||||
for(m=0;m<=MMAX;m++){
|
for(m=0;m<=MMAX;m++){
|
||||||
celt_uint32_t uu[NMAX];
|
celt_uint32_t uu[NMAX];
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
|
|
||||||
int main(int _argc,char **_argv){
|
int main(int _argc,char **_argv){
|
||||||
int n;
|
int n;
|
||||||
for(n=0;n<=NMAX;n+=3){
|
for(n=2;n<=NMAX;n+=3){
|
||||||
int m;
|
int m;
|
||||||
for(m=0;m<=MMAX;m++){
|
for(m=0;m<=MMAX;m++){
|
||||||
celt_uint64_t uu[NMAX];
|
celt_uint64_t uu[NMAX];
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue