| 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 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 80 } | 80 } |
| 81 if( k == MAX_ITERATIONS_RESIDUAL_NRG ) { | 81 if( k == MAX_ITERATIONS_RESIDUAL_NRG ) { |
| 82 silk_assert( nrg == 0 ); | 82 silk_assert( nrg == 0 ); |
| 83 nrg = 1.0f; | 83 nrg = 1.0f; |
| 84 } | 84 } |
| 85 | 85 |
| 86 return nrg; | 86 return nrg; |
| 87 } | 87 } |
| 88 | 88 |
| 89 /* Calculates residual energies of input subframes where all subframes have LPC_
order */ | 89 /* Calculates residual energies of input subframes where all subframes have LPC_
order */ |
| 90 /* of preceeding samples
*/ | 90 /* of preceding samples
*/ |
| 91 void silk_residual_energy_FLP( | 91 void silk_residual_energy_FLP( |
| 92 silk_float nrgs[ MAX_NB_SUBFR ], /* O
Residual energy per subframe */ | 92 silk_float nrgs[ MAX_NB_SUBFR ], /* O
Residual energy per subframe */ |
| 93 const silk_float x[], /* I
Input signal */ | 93 const silk_float x[], /* I
Input signal */ |
| 94 silk_float a[ 2 ][ MAX_LPC_ORDER ], /* I
AR coefs for each frame half */ | 94 silk_float a[ 2 ][ MAX_LPC_ORDER ], /* I
AR coefs for each frame half */ |
| 95 const silk_float gains[], /* I
Quantization gains */ | 95 const silk_float gains[], /* I
Quantization gains */ |
| 96 const opus_int subfr_length, /* I
Subframe length */ | 96 const opus_int subfr_length, /* I
Subframe length */ |
| 97 const opus_int nb_subfr, /* I
number of subframes */ | 97 const opus_int nb_subfr, /* I
number of subframes */ |
| 98 const opus_int LPC_order /* I
LPC order */ | 98 const opus_int LPC_order /* I
LPC order */ |
| 99 ) | 99 ) |
| 100 { | 100 { |
| 101 opus_int shift; | 101 opus_int shift; |
| 102 silk_float *LPC_res_ptr, LPC_res[ ( MAX_FRAME_LENGTH + MAX_NB_SUBFR * MAX_
LPC_ORDER ) / 2 ]; | 102 silk_float *LPC_res_ptr, LPC_res[ ( MAX_FRAME_LENGTH + MAX_NB_SUBFR * MAX_
LPC_ORDER ) / 2 ]; |
| 103 | 103 |
| 104 LPC_res_ptr = LPC_res + LPC_order; | 104 LPC_res_ptr = LPC_res + LPC_order; |
| 105 shift = LPC_order + subfr_length; | 105 shift = LPC_order + subfr_length; |
| 106 | 106 |
| 107 /* Filter input to create the LPC residual for each frame half, and measure
subframe energies */ | 107 /* Filter input to create the LPC residual for each frame half, and measure
subframe energies */ |
| 108 silk_LPC_analysis_filter_FLP( LPC_res, a[ 0 ], x + 0 * shift, 2 * shift, LPC
_order ); | 108 silk_LPC_analysis_filter_FLP( LPC_res, a[ 0 ], x + 0 * shift, 2 * shift, LPC
_order ); |
| 109 nrgs[ 0 ] = ( silk_float )( gains[ 0 ] * gains[ 0 ] * silk_energy_FLP( LPC_r
es_ptr + 0 * shift, subfr_length ) ); | 109 nrgs[ 0 ] = ( silk_float )( gains[ 0 ] * gains[ 0 ] * silk_energy_FLP( LPC_r
es_ptr + 0 * shift, subfr_length ) ); |
| 110 nrgs[ 1 ] = ( silk_float )( gains[ 1 ] * gains[ 1 ] * silk_energy_FLP( LPC_r
es_ptr + 1 * shift, subfr_length ) ); | 110 nrgs[ 1 ] = ( silk_float )( gains[ 1 ] * gains[ 1 ] * silk_energy_FLP( LPC_r
es_ptr + 1 * shift, subfr_length ) ); |
| 111 | 111 |
| 112 if( nb_subfr == MAX_NB_SUBFR ) { | 112 if( nb_subfr == MAX_NB_SUBFR ) { |
| 113 silk_LPC_analysis_filter_FLP( LPC_res, a[ 1 ], x + 2 * shift, 2 * shift,
LPC_order ); | 113 silk_LPC_analysis_filter_FLP( LPC_res, a[ 1 ], x + 2 * shift, 2 * shift,
LPC_order ); |
| 114 nrgs[ 2 ] = ( silk_float )( gains[ 2 ] * gains[ 2 ] * silk_energy_FLP( L
PC_res_ptr + 0 * shift, subfr_length ) ); | 114 nrgs[ 2 ] = ( silk_float )( gains[ 2 ] * gains[ 2 ] * silk_energy_FLP( L
PC_res_ptr + 0 * shift, subfr_length ) ); |
| 115 nrgs[ 3 ] = ( silk_float )( gains[ 3 ] * gains[ 3 ] * silk_energy_FLP( L
PC_res_ptr + 1 * shift, subfr_length ) ); | 115 nrgs[ 3 ] = ( silk_float )( gains[ 3 ] * gains[ 3 ] * silk_energy_FLP( L
PC_res_ptr + 1 * shift, subfr_length ) ); |
| 116 } | 116 } |
| 117 } | 117 } |
| OLD | NEW |