| 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 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 67 } | 67 } |
| 68 } | 68 } |
| 69 } | 69 } |
| 70 q_ptr += SHELL_CODEC_FRAME_LENGTH; | 70 q_ptr += SHELL_CODEC_FRAME_LENGTH; |
| 71 } | 71 } |
| 72 } | 72 } |
| 73 | 73 |
| 74 /* Decodes signs of excitation */ | 74 /* Decodes signs of excitation */ |
| 75 void silk_decode_signs( | 75 void silk_decode_signs( |
| 76 ec_dec *psRangeDec, /* I/O Comp
ressor data structure */ | 76 ec_dec *psRangeDec, /* I/O Comp
ressor data structure */ |
| 77 opus_int pulses[], /* I/O puls
e signal */ | 77 opus_int16 pulses[], /* I/O puls
e signal */ |
| 78 opus_int length, /* I leng
th of input */ | 78 opus_int length, /* I leng
th of input */ |
| 79 const opus_int signalType, /* I Sign
al type */ | 79 const opus_int signalType, /* I Sign
al type */ |
| 80 const opus_int quantOffsetType, /* I Quan
tization offset type */ | 80 const opus_int quantOffsetType, /* I Quan
tization offset type */ |
| 81 const opus_int sum_pulses[ MAX_NB_SHELL_BLOCKS ] /* I Sum
of absolute pulses per block */ | 81 const opus_int sum_pulses[ MAX_NB_SHELL_BLOCKS ] /* I Sum
of absolute pulses per block */ |
| 82 ) | 82 ) |
| 83 { | 83 { |
| 84 opus_int i, j, p; | 84 opus_int i, j, p; |
| 85 opus_uint8 icdf[ 2 ]; | 85 opus_uint8 icdf[ 2 ]; |
| 86 opus_int *q_ptr; | 86 opus_int16 *q_ptr; |
| 87 const opus_uint8 *icdf_ptr; | 87 const opus_uint8 *icdf_ptr; |
| 88 | 88 |
| 89 icdf[ 1 ] = 0; | 89 icdf[ 1 ] = 0; |
| 90 q_ptr = pulses; | 90 q_ptr = pulses; |
| 91 i = silk_SMULBB( 7, silk_ADD_LSHIFT( quantOffsetType, signalType, 1 ) ); | 91 i = silk_SMULBB( 7, silk_ADD_LSHIFT( quantOffsetType, signalType, 1 ) ); |
| 92 icdf_ptr = &silk_sign_iCDF[ i ]; | 92 icdf_ptr = &silk_sign_iCDF[ i ]; |
| 93 length = silk_RSHIFT( length + SHELL_CODEC_FRAME_LENGTH/2, LOG2_SHELL_CODEC_
FRAME_LENGTH ); | 93 length = silk_RSHIFT( length + SHELL_CODEC_FRAME_LENGTH/2, LOG2_SHELL_CODEC_
FRAME_LENGTH ); |
| 94 for( i = 0; i < length; i++ ) { | 94 for( i = 0; i < length; i++ ) { |
| 95 p = sum_pulses[ i ]; | 95 p = sum_pulses[ i ]; |
| 96 if( p > 0 ) { | 96 if( p > 0 ) { |
| 97 icdf[ 0 ] = icdf_ptr[ silk_min( p & 0x1F, 6 ) ]; | 97 icdf[ 0 ] = icdf_ptr[ silk_min( p & 0x1F, 6 ) ]; |
| 98 for( j = 0; j < SHELL_CODEC_FRAME_LENGTH; j++ ) { | 98 for( j = 0; j < SHELL_CODEC_FRAME_LENGTH; j++ ) { |
| 99 if( q_ptr[ j ] > 0 ) { | 99 if( q_ptr[ j ] > 0 ) { |
| 100 /* attach sign */ | 100 /* attach sign */ |
| 101 #if 0 | 101 #if 0 |
| 102 /* conditional implementation */ | 102 /* conditional implementation */ |
| 103 if( ec_dec_icdf( psRangeDec, icdf, 8 ) == 0 ) { | 103 if( ec_dec_icdf( psRangeDec, icdf, 8 ) == 0 ) { |
| 104 q_ptr[ j ] = -q_ptr[ j ]; | 104 q_ptr[ j ] = -q_ptr[ j ]; |
| 105 } | 105 } |
| 106 #else | 106 #else |
| 107 /* implementation with shift, subtraction, multiplication */ | 107 /* implementation with shift, subtraction, multiplication */ |
| 108 q_ptr[ j ] *= silk_dec_map( ec_dec_icdf( psRangeDec, icdf, 8
) ); | 108 q_ptr[ j ] *= silk_dec_map( ec_dec_icdf( psRangeDec, icdf, 8
) ); |
| 109 #endif | 109 #endif |
| 110 } | 110 } |
| 111 } | 111 } |
| 112 } | 112 } |
| 113 q_ptr += SHELL_CODEC_FRAME_LENGTH; | 113 q_ptr += SHELL_CODEC_FRAME_LENGTH; |
| 114 } | 114 } |
| 115 } | 115 } |
| OLD | NEW |