| 1 | /*********************************************************************** |
| 2 | Copyright (c) 2006-2011, Skype Limited. All rights reserved. |
| 3 | Redistribution and use in source and binary forms, with or without |
| 4 | modification, are permitted provided that the following conditions |
| 5 | are met: |
| 6 | - Redistributions of source code must retain the above copyright notice, |
| 7 | this list of conditions and the following disclaimer. |
| 8 | - Redistributions in binary form must reproduce the above copyright |
| 9 | notice, this list of conditions and the following disclaimer in the |
| 10 | documentation and/or other materials provided with the distribution. |
| 11 | - Neither the name of Internet Society, IETF or IETF Trust, nor the |
| 12 | names of specific contributors, may be used to endorse or promote |
| 13 | products derived from this software without specific prior written |
| 14 | permission. |
| 15 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
| 16 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
| 17 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
| 18 | ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE |
| 19 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
| 20 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
| 21 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
| 22 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
| 23 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
| 24 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
| 25 | POSSIBILITY OF SUCH DAMAGE. |
| 26 | ***********************************************************************/ |
| 27 | |
| 28 | //#ifdef HAVE_CONFIG_H |
| 29 | #include "opus__config.h"cxx . . $ `<file>/external/opusfile/opus/opus__config.h`/ |
| 30 | //#endif |
| 31 | |
| 32 | #include "main.h"cxx . . $ `<file>/external/opusfile/opus/silk/main.h`/ |
| 33 | |
| 34 | /*#define silk_enc_map(a) ((a) > 0 ? 1 : 0)*/ |
| 35 | /*#define silk_dec_map(a) ((a) > 0 ? 1 : -1)*/ |
| 36 | /* shifting avoids if-statement */ |
| 37 | #define silk_enc_mapcxx . . $ `external/opusfile/opus/silk/code_signs.c:37:9`!(a) ( silk_RSHIFTcxx . . $ `external/opusfile/opus/silk/SigProc_FIX.h:511:9`!( (a), 15 ) + 1 ) |
| 38 | #define silk_dec_mapcxx . . $ `external/opusfile/opus/silk/code_signs.c:38:9`!(a) ( silk_LSHIFTcxx . . $ `external/opusfile/opus/silk/SigProc_FIX.h:505:9`!( (a), 1 ) - 1 ) |
| 39 | |
| 40 | /* Encodes signs of excitation */ |
| 41 | void silk_encode_signscxx . . $ silk_encode_signs(dc938ed96e71bd5d).( |
| 42 | ec_enccxx . . $ ec_enc# *psRangeEnc, /* I/O Compressor data structure */ |
| 43 | const opus_int8cxx . . $ opus_int8# pulses[], /* I pulse signal */ |
| 44 | opus_intcxx . . $ `external/opusfile/opus/opus_types.h:36:9`! length, /* I length of input */ |
| 45 | const opus_intcxx . . $ `external/opusfile/opus/opus_types.h:36:9`! signalType, /* I Signal type */ |
| 46 | const opus_intcxx . . $ `external/opusfile/opus/opus_types.h:36:9`! quantOffsetType, /* I Quantization offset type */ |
| 47 | const opus_intcxx . . $ `external/opusfile/opus/opus_types.h:36:9`! sum_pulses[ MAX_NB_SHELL_BLOCKScxx . . $ `external/opusfile/opus/silk/define.h:170:9`! ] /* I Sum of absolute pulses per block */ |
| 48 | ) |
| 49 | { |
| 50 | opus_intcxx . . $ `external/opusfile/opus/opus_types.h:36:9`! i, j, p; |
| 51 | opus_uint8cxx . . $ opus_uint8# icdf[ 2 ]; |
| 52 | const opus_int8cxx . . $ opus_int8# *q_ptr; |
| 53 | const opus_uint8cxx . . $ opus_uint8# *icdf_ptr; |
| 54 | |
| 55 | icdf[ 1 ] = 0; |
| 56 | q_ptr = pulses; |
| 57 | i = silk_SMULBBcxx . . $ `external/opusfile/opus/silk/macros.h:70:9`!( 7, silk_ADD_LSHIFTcxx . . $ `external/opusfile/opus/silk/SigProc_FIX.h:521:9`!( quantOffsetType, signalType, 1 ) ); |
| 58 | icdf_ptr = &silk_sign_iCDFcxx . . $ silk_sign_iCDF.[ i ]; |
| 59 | length = silk_RSHIFTcxx . . $ `external/opusfile/opus/silk/SigProc_FIX.h:511:9`!( length + SHELL_CODEC_FRAME_LENGTHcxx . . $ `external/opusfile/opus/silk/define.h:168:9`!/2, LOG2_SHELL_CODEC_FRAME_LENGTHcxx . . $ `external/opusfile/opus/silk/define.h:169:9`! ); |
| 60 | for( i = 0; i < length; i++ ) { |
| 61 | p = sum_pulses[ i ]; |
| 62 | if( p > 0 ) { |
| 63 | icdf[ 0 ] = icdf_ptr[ silk_mincxx . . $ `external/opusfile/opus/silk/SigProc_FIX.h:539:9`!( p & 0x1F, 6 ) ]; |
| 64 | for( j = 0; j < SHELL_CODEC_FRAME_LENGTHcxx . . $ `external/opusfile/opus/silk/define.h:168:9`!; j++ ) { |
| 65 | if( q_ptr[ j ] != 0 ) { |
| 66 | ec_enc_icdfcxx . . $ ec_enc_icdf(aae3d6d7e5dce2b2).( psRangeEnc, silk_enc_mapcxx . . $ `external/opusfile/opus/silk/code_signs.c:37:9`!( q_ptr[ j ]), icdf, 8 ); |
| 67 | } |
| 68 | } |
| 69 | } |
| 70 | q_ptr += SHELL_CODEC_FRAME_LENGTHcxx . . $ `external/opusfile/opus/silk/define.h:168:9`!; |
| 71 | } |
| 72 | } |
| 73 | |
| 74 | /* Decodes signs of excitation */ |
| 75 | void silk_decode_signscxx . . $ silk_decode_signs(bdeb93d39a669314).( |
| 76 | ec_deccxx . . $ ec_dec# *psRangeDec, /* I/O Compressor data structure */ |
| 77 | opus_int16cxx . . $ opus_int16# pulses[], /* I/O pulse signal */ |
| 78 | opus_intcxx . . $ `external/opusfile/opus/opus_types.h:36:9`! length, /* I length of input */ |
| 79 | const opus_intcxx . . $ `external/opusfile/opus/opus_types.h:36:9`! signalType, /* I Signal type */ |
| 80 | const opus_intcxx . . $ `external/opusfile/opus/opus_types.h:36:9`! quantOffsetType, /* I Quantization offset type */ |
| 81 | const opus_intcxx . . $ `external/opusfile/opus/opus_types.h:36:9`! sum_pulses[ MAX_NB_SHELL_BLOCKScxx . . $ `external/opusfile/opus/silk/define.h:170:9`! ] /* I Sum of absolute pulses per block */ |
| 82 | ) |
| 83 | { |
| 84 | opus_intcxx . . $ `external/opusfile/opus/opus_types.h:36:9`! i, j, p; |
| 85 | opus_uint8cxx . . $ opus_uint8# icdf[ 2 ]; |
| 86 | opus_int16cxx . . $ opus_int16# *q_ptr; |
| 87 | const opus_uint8cxx . . $ opus_uint8# *icdf_ptr; |
| 88 | |
| 89 | icdf[ 1 ] = 0; |
| 90 | q_ptr = pulses; |
| 91 | i = silk_SMULBBcxx . . $ `external/opusfile/opus/silk/macros.h:70:9`!( 7, silk_ADD_LSHIFTcxx . . $ `external/opusfile/opus/silk/SigProc_FIX.h:521:9`!( quantOffsetType, signalType, 1 ) ); |
| 92 | icdf_ptr = &silk_sign_iCDFcxx . . $ silk_sign_iCDF.[ i ]; |
| 93 | length = silk_RSHIFTcxx . . $ `external/opusfile/opus/silk/SigProc_FIX.h:511:9`!( length + SHELL_CODEC_FRAME_LENGTHcxx . . $ `external/opusfile/opus/silk/define.h:168:9`!/2, LOG2_SHELL_CODEC_FRAME_LENGTHcxx . . $ `external/opusfile/opus/silk/define.h:169:9`! ); |
| 94 | for( i = 0; i < length; i++ ) { |
| 95 | p = sum_pulses[ i ]; |
| 96 | if( p > 0 ) { |
| 97 | icdf[ 0 ] = icdf_ptr[ silk_mincxx . . $ `external/opusfile/opus/silk/SigProc_FIX.h:539:9`!( p & 0x1F, 6 ) ]; |
| 98 | for( j = 0; j < SHELL_CODEC_FRAME_LENGTHcxx . . $ `external/opusfile/opus/silk/define.h:168:9`!; j++ ) { |
| 99 | if( q_ptr[ j ] > 0 ) { |
| 100 | /* attach sign */ |
| 101 | #if 0 |
| 102 | /* conditional implementation */ |
| 103 | if( ec_dec_icdf( psRangeDec, icdf, 8 ) == 0 ) { |
| 104 | q_ptr[ j ] = -q_ptr[ j ]; |
| 105 | } |
| 106 | #else |
| 107 | /* implementation with shift, subtraction, multiplication */ |
| 108 | q_ptr[ j ] *= silk_dec_mapcxx . . $ `external/opusfile/opus/silk/code_signs.c:38:9`!( ec_dec_icdf( psRangeDec, icdf, 8 ) ); |
| 109 | #endif |
| 110 | } |
| 111 | } |
| 112 | } |
| 113 | q_ptr += SHELL_CODEC_FRAME_LENGTHcxx . . $ `external/opusfile/opus/silk/define.h:168:9`!; |
| 114 | } |
| 115 | } |