OLD | NEW |
1 /*********************************************************************** | 1 /*********************************************************************** |
2 Copyright (c) 2006-2011, Skype Limited. All rights reserved. | 2 Copyright (c) 2006-2011, Skype Limited. All rights reserved. |
3 Redistribution and use in source and binary forms, with or without | 3 Redistribution and use in source and binary forms, with or without |
4 modification, are permitted provided that the following conditions | 4 modification, are permitted provided that the following conditions |
5 are met: | 5 are met: |
6 - Redistributions of source code must retain the above copyright notice, | 6 - Redistributions of source code must retain the above copyright notice, |
7 this list of conditions and the following disclaimer. | 7 this list of conditions and the following disclaimer. |
8 - Redistributions in binary form must reproduce the above copyright | 8 - Redistributions in binary form must reproduce the above copyright |
9 notice, this list of conditions and the following disclaimer in the | 9 notice, this list of conditions and the following disclaimer in the |
10 documentation and/or other materials provided with the distribution. | 10 documentation and/or other materials provided with the distribution. |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
46 nrg = 0; | 46 nrg = 0; |
47 shft = 0; | 47 shft = 0; |
48 len--; | 48 len--; |
49 for( i = 0; i < len; i += 2 ) { | 49 for( i = 0; i < len; i += 2 ) { |
50 nrg = silk_SMLABB_ovflw( nrg, x[ i ], x[ i ] ); | 50 nrg = silk_SMLABB_ovflw( nrg, x[ i ], x[ i ] ); |
51 nrg = silk_SMLABB_ovflw( nrg, x[ i + 1 ], x[ i + 1 ] ); | 51 nrg = silk_SMLABB_ovflw( nrg, x[ i + 1 ], x[ i + 1 ] ); |
52 if( nrg < 0 ) { | 52 if( nrg < 0 ) { |
53 /* Scale down */ | 53 /* Scale down */ |
54 nrg = (opus_int32)silk_RSHIFT_uint( (opus_uint32)nrg, 2 ); | 54 nrg = (opus_int32)silk_RSHIFT_uint( (opus_uint32)nrg, 2 ); |
55 shft = 2; | 55 shft = 2; |
| 56 i+=2; |
56 break; | 57 break; |
57 } | 58 } |
58 } | 59 } |
59 for( ; i < len; i += 2 ) { | 60 for( ; i < len; i += 2 ) { |
60 nrg_tmp = silk_SMULBB( x[ i ], x[ i ] ); | 61 nrg_tmp = silk_SMULBB( x[ i ], x[ i ] ); |
61 nrg_tmp = silk_SMLABB_ovflw( nrg_tmp, x[ i + 1 ], x[ i + 1 ] ); | 62 nrg_tmp = silk_SMLABB_ovflw( nrg_tmp, x[ i + 1 ], x[ i + 1 ] ); |
62 nrg = (opus_int32)silk_ADD_RSHIFT_uint( nrg, (opus_uint32)nrg_tmp, shft
); | 63 nrg = (opus_int32)silk_ADD_RSHIFT_uint( nrg, (opus_uint32)nrg_tmp, shft
); |
63 if( nrg < 0 ) { | 64 if( nrg < 0 ) { |
64 /* Scale down */ | 65 /* Scale down */ |
65 nrg = (opus_int32)silk_RSHIFT_uint( (opus_uint32)nrg, 2 ); | 66 nrg = (opus_int32)silk_RSHIFT_uint( (opus_uint32)nrg, 2 ); |
(...skipping 10 matching lines...) Expand all Loading... |
76 if( nrg & 0xC0000000 ) { | 77 if( nrg & 0xC0000000 ) { |
77 nrg = silk_RSHIFT_uint( (opus_uint32)nrg, 2 ); | 78 nrg = silk_RSHIFT_uint( (opus_uint32)nrg, 2 ); |
78 shft += 2; | 79 shft += 2; |
79 } | 80 } |
80 | 81 |
81 /* Output arguments */ | 82 /* Output arguments */ |
82 *shift = shft; | 83 *shift = shft; |
83 *energy = nrg; | 84 *energy = nrg; |
84 } | 85 } |
85 | 86 |
OLD | NEW |