Mercurial > libavcodec.hg
comparison mpegaudiodec.c @ 11708:8d2e66ba12cf libavcodec
Make lsf_sf_expand() 4 times faster.
author | michael |
---|---|
date | Tue, 11 May 2010 20:33:48 +0000 |
parents | eb9e142ea51f |
children | 6f9b4c452130 |
comparison
equal
deleted
inserted
replaced
11707:eb9e142ea51f | 11708:8d2e66ba12cf |
---|---|
1316 } | 1316 } |
1317 } | 1317 } |
1318 return 3 * 12; | 1318 return 3 * 12; |
1319 } | 1319 } |
1320 | 1320 |
1321 //FIXME optimze this shit | 1321 #define SPLIT(dst,sf,n)\ |
1322 static inline void lsf_sf_expand(int *slen, | 1322 if(n==3){\ |
1323 int m= (sf*171)>>9;\ | |
1324 dst= sf - 3*m;\ | |
1325 sf=m;\ | |
1326 }else if(n==4){\ | |
1327 dst= sf&3;\ | |
1328 sf>>=2;\ | |
1329 }else if(n==5){\ | |
1330 int m= (sf*205)>>10;\ | |
1331 dst= sf - 5*m;\ | |
1332 sf=m;\ | |
1333 }else if(n==6){\ | |
1334 int m= (sf*171)>>10;\ | |
1335 dst= sf - 6*m;\ | |
1336 sf=m;\ | |
1337 }else{\ | |
1338 dst=0;\ | |
1339 } | |
1340 | |
1341 static av_always_inline void lsf_sf_expand(int *slen, | |
1323 int sf, int n1, int n2, int n3) | 1342 int sf, int n1, int n2, int n3) |
1324 { | 1343 { |
1325 if (n3) { | 1344 SPLIT(slen[3], sf, n3) |
1326 slen[3] = sf % n3; | 1345 SPLIT(slen[2], sf, n2) |
1327 sf /= n3; | 1346 SPLIT(slen[1], sf, n1) |
1328 } else { | |
1329 slen[3] = 0; | |
1330 } | |
1331 if (n2) { | |
1332 slen[2] = sf % n2; | |
1333 sf /= n2; | |
1334 } else { | |
1335 slen[2] = 0; | |
1336 } | |
1337 slen[1] = sf % n1; | |
1338 sf /= n1; | |
1339 slen[0] = sf; | 1347 slen[0] = sf; |
1340 } | 1348 } |
1341 | 1349 |
1342 static void exponents_from_scale_factors(MPADecodeContext *s, | 1350 static void exponents_from_scale_factors(MPADecodeContext *s, |
1343 GranuleDef *g, | 1351 GranuleDef *g, |