| 1 | /* Copyright (c) 2010 Xiph.Org Foundation, Skype Limited |
| 2 | Written by Jean-Marc Valin and Koen Vos */ |
| 3 | /* |
| 4 | Redistribution and use in source and binary forms, with or without |
| 5 | modification, are permitted provided that the following conditions |
| 6 | are met: |
| 7 | |
| 8 | - Redistributions of source code must retain the above copyright |
| 9 | notice, this list of conditions and the following disclaimer. |
| 10 | |
| 11 | - Redistributions in binary form must reproduce the above copyright |
| 12 | notice, this list of conditions and the following disclaimer in the |
| 13 | documentation and/or other materials provided with the distribution. |
| 14 | |
| 15 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
| 16 | ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
| 17 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
| 18 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER |
| 19 | OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, |
| 20 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, |
| 21 | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR |
| 22 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF |
| 23 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING |
| 24 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
| 25 | SOFTWARE, EVEN IF ADVISED OF THE 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 | #ifndef OPUS_BUILDcxx . . $ `opus/opus__config.h:128:9`! |
| 33 | # error "OPUS_BUILD _MUST_ be defined to build Opus. This probably means you need other defines as well, as in a config.h. See the included build files for details." |
| 34 | #endif |
| 35 | |
| 36 | #if defined(__GNUC__cxx . . $ `<built-in>:8:9`!) && (__GNUC__cxx . . $ `<built-in>:8:9`! >= 2) && !defined(__OPTIMIZE__cxx . . $ `<built-in>:44:9`!) && !defined(OPUS_WILL_BE_SLOW) |
| 37 | # pragma message "You appear to be compiling without optimization, if so opus will be very slow." |
| 38 | #endif |
| 39 | |
| 40 | #include <stdarg.h> |
| 41 | #include "celt.h"cxx . . $ `<file>/external/opusfile/opus/celt/celt.h`/ |
| 42 | #include "opus.h"cxx . . $ `<file>/external/opusfile/opus/opus.h`/ |
| 43 | #include "entdec.h"cxx . . $ `<file>/external/opusfile/opus/celt/entdec.h`/ |
| 44 | #include "modes.h"cxx . . $ `<file>/external/opusfile/opus/celt/modes.h`/ |
| 45 | #include "API.h"cxx . . $ `<file>/external/opusfile/opus/silk/API.h`/ |
| 46 | #include "stack_alloc.h"cxx . . $ `<file>/external/opusfile/opus/celt/stack_alloc.h`/ |
| 47 | #include "float_cast.h"cxx . . $ `<file>/external/opusfile/opus/celt/float_cast.h`/ |
| 48 | #include "opus_private.h"cxx . . $ `<file>/external/opusfile/opus/opus_private.h`/ |
| 49 | #include "os_support.h"cxx . . $ `<file>/external/opusfile/opus/celt/os_support.h`/ |
| 50 | #include "structs.h"cxx . . $ `<file>/external/opusfile/opus/silk/structs.h`/ |
| 51 | #include "define.h"cxx . . $ `<file>/external/opusfile/opus/silk/define.h`/ |
| 52 | #include "mathops.h"cxx . . $ `<file>/external/opusfile/opus/celt/mathops.h`/ |
| 53 | #include "cpu_support.h"cxx . . $ `<file>/external/opusfile/opus/celt/cpu_support.h`/ |
| 54 | |
| 55 | struct OpusDecodercxx . . $ OpusDecoder# { |
| 56 | int celt_dec_offsetcxx . . $ OpusDecoder#celt_dec_offset.; |
| 57 | int silk_dec_offsetcxx . . $ OpusDecoder#silk_dec_offset.; |
| 58 | int channelscxx . . $ OpusDecoder#channels.; |
| 59 | opus_int32cxx . . $ opus_int32# Fscxx . . $ OpusDecoder#Fs.; /** Sampling rate (at the API level) */ |
| 60 | silk_DecControlStructcxx . . $ silk_DecControlStruct# DecControlcxx . . $ OpusDecoder#DecControl.; |
| 61 | int decode_gaincxx . . $ OpusDecoder#decode_gain.; |
| 62 | int archcxx . . $ OpusDecoder#arch.; |
| 63 | |
| 64 | /* Everything beyond this point gets cleared on a reset */ |
| 65 | #define OPUS_DECODER_RESET_STARTcxx . . $ `external/opusfile/opus/opus_decoder.c:65:9`! stream_channels |
| 66 | int stream_channelscxx . . $ OpusDecoder#stream_channels.; |
| 67 | |
| 68 | int bandwidthcxx . . $ OpusDecoder#bandwidth.; |
| 69 | int modecxx . . $ OpusDecoder#mode.; |
| 70 | int prev_modecxx . . $ OpusDecoder#prev_mode.; |
| 71 | int frame_sizecxx . . $ OpusDecoder#frame_size.; |
| 72 | int prev_redundancycxx . . $ OpusDecoder#prev_redundancy.; |
| 73 | int last_packet_durationcxx . . $ OpusDecoder#last_packet_duration.; |
| 74 | #ifndef FIXED_POINT |
| 75 | opus_val16cxx . . $ opus_val16# softclip_memcxx . . $ OpusDecoder#softclip_mem.[2]; |
| 76 | #endif |
| 77 | |
| 78 | opus_uint32cxx . . $ opus_uint32# rangeFinalcxx . . $ OpusDecoder#rangeFinal.; |
| 79 | }; |
| 80 | |
| 81 | #if defined(ENABLE_HARDENINGcxx . . $ `opus/opus__config.h:23:9`!) || defined(ENABLE_ASSERTIONS) |
| 82 | static void validate_opus_decodercxx . . $ validate_opus_decoder(88f685c4e7a21aca).(OpusDecodercxx . . $ OpusDecoder# *st) |
| 83 | { |
| 84 | celt_assertcxx . . $ `external/opusfile/opus/celt/arch.h:80:9`!(st->channels == 1 || st->channels == 2); |
| 85 | celt_assertcxx . . $ `external/opusfile/opus/celt/arch.h:80:9`!(st->Fs == 48000 || st->Fs == 24000 || st->Fs == 16000 || st->Fs == 12000 || st->Fs == 8000); |
| 86 | celt_assertcxx . . $ `external/opusfile/opus/celt/arch.h:80:9`!(st->DecControl.API_sampleRate == st->Fs); |
| 87 | celt_assertcxx . . $ `external/opusfile/opus/celt/arch.h:80:9`!(st->DecControl.internalSampleRate == 0 || st->DecControl.internalSampleRate == 16000 || st->DecControl.internalSampleRate == 12000 || st->DecControl.internalSampleRate == 8000); |
| 88 | celt_assertcxx . . $ `external/opusfile/opus/celt/arch.h:80:9`!(st->DecControl.nChannelsAPI == st->channels); |
| 89 | celt_assertcxx . . $ `external/opusfile/opus/celt/arch.h:80:9`!(st->DecControl.nChannelsInternal == 0 || st->DecControl.nChannelsInternal == 1 || st->DecControl.nChannelsInternal == 2); |
| 90 | celt_assertcxx . . $ `external/opusfile/opus/celt/arch.h:80:9`!(st->DecControl.payloadSize_ms == 0 || st->DecControl.payloadSize_ms == 10 || st->DecControl.payloadSize_ms == 20 || st->DecControl.payloadSize_ms == 40 || st->DecControl.payloadSize_ms == 60); |
| 91 | #ifdef OPUS_ARCHMASKcxx . . $ `external/opusfile/opus/celt/cpu_support.h:63:9`! |
| 92 | celt_assertcxx . . $ `external/opusfile/opus/celt/arch.h:80:9`!(st->arch >= 0); |
| 93 | celt_assertcxx . . $ `external/opusfile/opus/celt/arch.h:80:9`!(st->arch <= OPUS_ARCHMASKcxx . . $ `external/opusfile/opus/celt/cpu_support.h:63:9`!); |
| 94 | #endif |
| 95 | celt_assertcxx . . $ `external/opusfile/opus/celt/arch.h:80:9`!(st->stream_channels == 1 || st->stream_channels == 2); |
| 96 | } |
| 97 | #define VALIDATE_OPUS_DECODERcxx . . $ `external/opusfile/opus/opus_decoder.c:97:9`!(st) validate_opus_decoder(st) |
| 98 | #else |
| 99 | #define VALIDATE_OPUS_DECODER(st) |
| 100 | #endif |
| 101 | |
| 102 | int opus_decoder_get_sizecxx . . $ opus_decoder_get_size(7864480464b09eea).(int channels) |
| 103 | { |
| 104 | int silkDecSizeBytes, celtDecSizeBytes; |
| 105 | int ret; |
| 106 | if (channels<1 || channels > 2) |
| 107 | return 0; |
| 108 | ret = silk_Get_Decoder_Sizecxx . . $ silk_Get_Decoder_Size(a5f7824ee4986326).( &silkDecSizeBytes ); |
| 109 | if(ret) |
| 110 | return 0; |
| 111 | silkDecSizeBytes = aligncxx . . $ align(7864480464b09eea).(silkDecSizeBytes); |
| 112 | celtDecSizeBytes = celt_decoder_get_sizecxx . . $ celt_decoder_get_size(7864480464b09eea).(channels); |
| 113 | return aligncxx . . $ align(7864480464b09eea).(sizeof(OpusDecodercxx . . $ OpusDecoder#))+silkDecSizeBytes+celtDecSizeBytes; |
| 114 | } |
| 115 | |
| 116 | int opus_decoder_initcxx . . $ opus_decoder_init(9510fc33f634cb6e).(OpusDecodercxx . . $ OpusDecoder# *st, opus_int32cxx . . $ opus_int32# Fs, int channels) |
| 117 | { |
| 118 | void *silk_dec; |
| 119 | CELTDecodercxx . . $ `external/opusfile/opus/celt/celt.h:50:9`! *celt_dec; |
| 120 | int ret, silkDecSizeBytes; |
| 121 | |
| 122 | if ((Fs!=48000&&Fs!=24000&&Fs!=16000&&Fs!=12000&&Fs!=8000) |
| 123 | || (channels!=1&&channels!=2)) |
| 124 | return OPUS_BAD_ARGcxx . . $ `external/opusfile/opus/opus_defines.h:48:9`!; |
| 125 | |
| 126 | OPUS_CLEARcxx . . $ `external/opusfile/opus/celt/os_support.h:83:9`!((char*)st, opus_decoder_get_size(channels)); |
| 127 | /* Initialize SILK decoder */ |
| 128 | ret = silk_Get_Decoder_Sizecxx . . $ silk_Get_Decoder_Size(a5f7824ee4986326).(&silkDecSizeBytes); |
| 129 | if (ret) |
| 130 | return OPUS_INTERNAL_ERRORcxx . . $ `external/opusfile/opus/opus_defines.h:52:9`!; |
| 131 | |
| 132 | silkDecSizeBytes = aligncxx . . $ align(7864480464b09eea).(silkDecSizeBytes); |
| 133 | st->silk_dec_offsetcxx . . $ OpusDecoder#silk_dec_offset. = aligncxx . . $ align(7864480464b09eea).(sizeof(OpusDecodercxx . . $ OpusDecoder#)); |
| 134 | st->celt_dec_offsetcxx . . $ OpusDecoder#celt_dec_offset. = st->silk_dec_offsetcxx . . $ OpusDecoder#silk_dec_offset.+silkDecSizeBytes; |
| 135 | silk_dec = (char*)st+st->silk_dec_offsetcxx . . $ OpusDecoder#silk_dec_offset.; |
| 136 | celt_dec = (CELTDecodercxx . . $ `external/opusfile/opus/celt/celt.h:50:9`!*)((char*)st+st->celt_dec_offsetcxx . . $ OpusDecoder#celt_dec_offset.); |
| 137 | st->stream_channelscxx . . $ OpusDecoder#stream_channels. = st->channelscxx . . $ OpusDecoder#channels. = channels; |
| 138 | |
| 139 | st->Fscxx . . $ OpusDecoder#Fs. = Fs; |
| 140 | st->DecControlcxx . . $ OpusDecoder#DecControl..API_sampleRatecxx . . $ $anonymous_type_1138ce94d7cabe34_1#API_sampleRate. = st->Fscxx . . $ OpusDecoder#Fs.; |
| 141 | st->DecControlcxx . . $ OpusDecoder#DecControl..nChannelsAPIcxx . . $ $anonymous_type_1138ce94d7cabe34_1#nChannelsAPI. = st->channelscxx . . $ OpusDecoder#channels.; |
| 142 | |
| 143 | /* Reset decoder */ |
| 144 | ret = silk_InitDecodercxx . . $ silk_InitDecoder(dedf1e9b1c614a07).( silk_dec ); |
| 145 | if(ret)return OPUS_INTERNAL_ERRORcxx . . $ `external/opusfile/opus/opus_defines.h:52:9`!; |
| 146 | |
| 147 | /* Initialize CELT decoder */ |
| 148 | ret = celt_decoder_initcxx . . $ celt_decoder_init(27423e1ca630a3b0).(celt_dec, Fs, channels); |
| 149 | if(ret!=OPUS_OKcxx . . $ `external/opusfile/opus/opus_defines.h:46:9`!)return OPUS_INTERNAL_ERRORcxx . . $ `external/opusfile/opus/opus_defines.h:52:9`!; |
| 150 | |
| 151 | celt_decoder_ctlcxx . . $ `external/opusfile/opus/celt/celt.h:156:9`!(celt_dec, CELT_SET_SIGNALLINGcxx . . $ `external/opusfile/opus/celt/celt.h:115:9`!(0)); |
| 152 | |
| 153 | st->prev_modecxx . . $ OpusDecoder#prev_mode. = 0; |
| 154 | st->frame_sizecxx . . $ OpusDecoder#frame_size. = Fs/400; |
| 155 | st->archcxx . . $ OpusDecoder#arch. = opus_select_archcxx . . $ opus_select_arch(b126dc7c1de90089).(); |
| 156 | return OPUS_OKcxx . . $ `external/opusfile/opus/opus_defines.h:46:9`!; |
| 157 | } |
| 158 | |
| 159 | OpusDecodercxx . . $ OpusDecoder# *opus_decoder_createcxx . . $ opus_decoder_create(dcc98db5c809fdac).(opus_int32cxx . . $ opus_int32# Fs, int channels, int *error) |
| 160 | { |
| 161 | int ret; |
| 162 | OpusDecodercxx . . $ OpusDecoder# *st; |
| 163 | if ((Fs!=48000&&Fs!=24000&&Fs!=16000&&Fs!=12000&&Fs!=8000) |
| 164 | || (channels!=1&&channels!=2)) |
| 165 | { |
| 166 | if (error) |
| 167 | *error = OPUS_BAD_ARGcxx . . $ `external/opusfile/opus/opus_defines.h:48:9`!; |
| 168 | return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 169 | } |
| 170 | st = (OpusDecodercxx . . $ OpusDecoder# *)opus_alloccxx . . $ opus_alloc(bfcfa4d6b7f7ef64).(opus_decoder_get_sizecxx . . $ opus_decoder_get_size(7864480464b09eea).(channels)); |
| 171 | if (st == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) |
| 172 | { |
| 173 | if (error) |
| 174 | *error = OPUS_ALLOC_FAILcxx . . $ `external/opusfile/opus/opus_defines.h:60:9`!; |
| 175 | return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 176 | } |
| 177 | ret = opus_decoder_initcxx . . $ opus_decoder_init(9510fc33f634cb6e).(st, Fs, channels); |
| 178 | if (error) |
| 179 | *error = ret; |
| 180 | if (ret != OPUS_OKcxx . . $ `external/opusfile/opus/opus_defines.h:46:9`!) |
| 181 | { |
| 182 | opus_freecxx . . $ opus_free(5d22bdacc48458e8).(st); |
| 183 | st = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 184 | } |
| 185 | return st; |
| 186 | } |
| 187 | |
| 188 | static void smooth_fadecxx . . $ smooth_fade(86cac40a1a0ef7).(const opus_val16cxx . . $ opus_val16# *in1, const opus_val16cxx . . $ opus_val16# *in2, |
| 189 | opus_val16cxx . . $ opus_val16# *out, int overlap, int channels, |
| 190 | const opus_val16cxx . . $ opus_val16# *window, opus_int32cxx . . $ opus_int32# Fs) |
| 191 | { |
| 192 | int i, c; |
| 193 | int inc = 48000/Fs; |
| 194 | for (c=0;c<channels;c++) |
| 195 | { |
| 196 | for (i=0;i<overlap;i++) |
| 197 | { |
| 198 | opus_val16cxx . . $ opus_val16# w = MULT16_16_Q15cxx . . $ `external/opusfile/opus/celt/arch.h:264:9`!(window[i*inc], window[i*inc]); |
| 199 | out[i*channels+c] = SHR32cxx . . $ `external/opusfile/opus/celt/arch.h:226:9`!(MAC16_16cxx . . $ `external/opusfile/opus/celt/arch.h:250:9`!(MULT16_16cxx . . $ `external/opusfile/opus/celt/arch.h:249:9`!(w,in2[i*channels+c]), |
| 200 | Q15ONEcxx . . $ `external/opusfile/opus/celt/arch.h:203:9`!-w, in1[i*channels+c]), 15); |
| 201 | } |
| 202 | } |
| 203 | } |
| 204 | |
| 205 | static int opus_packet_get_modecxx . . $ opus_packet_get_mode(b84ccf4e0bb14b06).(const unsigned char *data) |
| 206 | { |
| 207 | int mode; |
| 208 | if (data[0]&0x80) |
| 209 | { |
| 210 | mode = MODE_CELT_ONLYcxx . . $ `external/opusfile/opus/opus_private.h:110:9`!; |
| 211 | } else if ((data[0]&0x60) == 0x60) |
| 212 | { |
| 213 | mode = MODE_HYBRIDcxx . . $ `external/opusfile/opus/opus_private.h:109:9`!; |
| 214 | } else { |
| 215 | mode = MODE_SILK_ONLYcxx . . $ `external/opusfile/opus/opus_private.h:108:9`!; |
| 216 | } |
| 217 | return mode; |
| 218 | } |
| 219 | |
| 220 | static int opus_decode_framecxx . . $ opus_decode_frame(2eaeb09d95f20e3).(OpusDecodercxx . . $ OpusDecoder# *st, const unsigned char *data, |
| 221 | opus_int32cxx . . $ opus_int32# len, opus_val16cxx . . $ opus_val16# *pcm, int frame_size, int decode_fec) |
| 222 | { |
| 223 | void *silk_dec; |
| 224 | CELTDecodercxx . . $ `external/opusfile/opus/celt/celt.h:50:9`! *celt_dec; |
| 225 | int i, silk_ret=0, celt_ret=0; |
| 226 | ec_deccxx . . $ ec_dec# dec; |
| 227 | opus_int32cxx . . $ opus_int32# silk_frame_size; |
| 228 | int pcm_silk_size; |
| 229 | VARDECLcxx . . $ `external/opusfile/opus/celt/stack_alloc.h:94:9`!(opus_int16, pcm_silk); |
| 230 | int pcm_transition_silk_size; |
| 231 | VARDECLcxx . . $ `external/opusfile/opus/celt/stack_alloc.h:94:9`!(opus_val16, pcm_transition_silk); |
| 232 | int pcm_transition_celt_size; |
| 233 | VARDECLcxx . . $ `external/opusfile/opus/celt/stack_alloc.h:94:9`!(opus_val16, pcm_transition_celt); |
| 234 | opus_val16cxx . . $ opus_val16# *pcm_transition=NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 235 | int redundant_audio_size; |
| 236 | VARDECLcxx . . $ `external/opusfile/opus/celt/stack_alloc.h:94:9`!(opus_val16, redundant_audio); |
| 237 | |
| 238 | int audiosize; |
| 239 | int mode; |
| 240 | int bandwidth; |
| 241 | int transition=0; |
| 242 | int start_band; |
| 243 | int redundancy=0; |
| 244 | int redundancy_bytes = 0; |
| 245 | int celt_to_silk=0; |
| 246 | int c; |
| 247 | int F2_5, F5, F10, F20; |
| 248 | const opus_val16cxx . . $ opus_val16# *window; |
| 249 | opus_uint32cxx . . $ opus_uint32# redundant_rng = 0; |
| 250 | int celt_accum; |
| 251 | ALLOC_STACKcxx . . $ `external/opusfile/opus/celt/stack_alloc.h:98:9`!; |
| 252 | |
| 253 | silk_dec = (char*)st+st->silk_dec_offsetcxx . . $ OpusDecoder#silk_dec_offset.; |
| 254 | celt_dec = (CELTDecodercxx . . $ `external/opusfile/opus/celt/celt.h:50:9`!*)((char*)st+st->celt_dec_offsetcxx . . $ OpusDecoder#celt_dec_offset.); |
| 255 | F20 = st->Fscxx . . $ OpusDecoder#Fs./50; |
| 256 | F10 = F20>>1; |
| 257 | F5 = F10>>1; |
| 258 | F2_5 = F5>>1; |
| 259 | if (frame_size < F2_5) |
| 260 | { |
| 261 | RESTORE_STACKcxx . . $ `external/opusfile/opus/celt/stack_alloc.h:97:9`!; |
| 262 | return OPUS_BUFFER_TOO_SMALLcxx . . $ `external/opusfile/opus/opus_defines.h:50:9`!; |
| 263 | } |
| 264 | /* Limit frame_size to avoid excessive stack allocations. */ |
| 265 | frame_size = IMINcxx . . $ `external/opusfile/opus/celt/arch.h:101:9`!(frame_size, st->Fs/25*3); |
| 266 | /* Payloads of 1 (2 including ToC) or 0 trigger the PLC/DTX */ |
| 267 | if (len<=1) |
| 268 | { |
| 269 | data = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 270 | /* In that case, don't conceal more than what the ToC says */ |
| 271 | frame_size = IMINcxx . . $ `external/opusfile/opus/celt/arch.h:101:9`!(frame_size, st->frame_size); |
| 272 | } |
| 273 | if (data != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) |
| 274 | { |
| 275 | audiosize = st->frame_sizecxx . . $ OpusDecoder#frame_size.; |
| 276 | mode = st->modecxx . . $ OpusDecoder#mode.; |
| 277 | bandwidth = st->bandwidthcxx . . $ OpusDecoder#bandwidth.; |
| 278 | ec_dec_initcxx . . $ ec_dec_init(ca189ec876992986).(&dec,(unsigned char*)data,len); |
| 279 | } else { |
| 280 | audiosize = frame_size; |
| 281 | mode = st->prev_modecxx . . $ OpusDecoder#prev_mode.; |
| 282 | bandwidth = 0; |
| 283 | |
| 284 | if (mode == 0) |
| 285 | { |
| 286 | /* If we haven't got any packet yet, all we can do is return zeros */ |
| 287 | for (i=0;i<audiosize*st->channelscxx . . $ OpusDecoder#channels.;i++) |
| 288 | pcm[i] = 0; |
| 289 | RESTORE_STACKcxx . . $ `external/opusfile/opus/celt/stack_alloc.h:97:9`!; |
| 290 | return audiosize; |
| 291 | } |
| 292 | |
| 293 | /* Avoids trying to run the PLC on sizes other than 2.5 (CELT), 5 (CELT), |
| 294 | 10, or 20 (e.g. 12.5 or 30 ms). */ |
| 295 | if (audiosize > F20) |
| 296 | { |
| 297 | do { |
| 298 | int ret = opus_decode_framecxx . . $ opus_decode_frame(2eaeb09d95f20e3).(st, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, 0, pcm, IMINcxx . . $ `external/opusfile/opus/celt/arch.h:101:9`!(audiosize, F20), 0); |
| 299 | if (ret<0) |
| 300 | { |
| 301 | RESTORE_STACKcxx . . $ `external/opusfile/opus/celt/stack_alloc.h:97:9`!; |
| 302 | return ret; |
| 303 | } |
| 304 | pcm += ret*st->channelscxx . . $ OpusDecoder#channels.; |
| 305 | audiosize -= ret; |
| 306 | } while (audiosize > 0); |
| 307 | RESTORE_STACKcxx . . $ `external/opusfile/opus/celt/stack_alloc.h:97:9`!; |
| 308 | return frame_size; |
| 309 | } else if (audiosize < F20) |
| 310 | { |
| 311 | if (audiosize > F10) |
| 312 | audiosize = F10; |
| 313 | else if (mode != MODE_SILK_ONLYcxx . . $ `external/opusfile/opus/opus_private.h:108:9`! && audiosize > F5 && audiosize < F10) |
| 314 | audiosize = F5; |
| 315 | } |
| 316 | } |
| 317 | |
| 318 | /* In fixed-point, we can tell CELT to do the accumulation on top of the |
| 319 | SILK PCM buffer. This saves some stack space. */ |
| 320 | #ifdef FIXED_POINT |
| 321 | celt_accum = (mode != MODE_CELT_ONLY) && (frame_size >= F10); |
| 322 | #else |
| 323 | celt_accum = 0; |
| 324 | #endif |
| 325 | |
| 326 | pcm_transition_silk_size = ALLOC_NONEcxx . . $ `external/opusfile/opus/celt/stack_alloc.h:100:9`!; |
| 327 | pcm_transition_celt_size = ALLOC_NONEcxx . . $ `external/opusfile/opus/celt/stack_alloc.h:100:9`!; |
| 328 | if (data!=NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`! && st->prev_modecxx . . $ OpusDecoder#prev_mode. > 0 && ( |
| 329 | (mode == MODE_CELT_ONLYcxx . . $ `external/opusfile/opus/opus_private.h:110:9`! && st->prev_modecxx . . $ OpusDecoder#prev_mode. != MODE_CELT_ONLYcxx . . $ `external/opusfile/opus/opus_private.h:110:9`! && !st->prev_redundancycxx . . $ OpusDecoder#prev_redundancy.) |
| 330 | || (mode != MODE_CELT_ONLYcxx . . $ `external/opusfile/opus/opus_private.h:110:9`! && st->prev_modecxx . . $ OpusDecoder#prev_mode. == MODE_CELT_ONLYcxx . . $ `external/opusfile/opus/opus_private.h:110:9`!) ) |
| 331 | ) |
| 332 | { |
| 333 | transition = 1; |
| 334 | /* Decide where to allocate the stack memory for pcm_transition */ |
| 335 | if (mode == MODE_CELT_ONLYcxx . . $ `external/opusfile/opus/opus_private.h:110:9`!) |
| 336 | pcm_transition_celt_size = F5*st->channelscxx . . $ OpusDecoder#channels.; |
| 337 | else |
| 338 | pcm_transition_silk_size = F5*st->channelscxx . . $ OpusDecoder#channels.; |
| 339 | } |
| 340 | ALLOCcxx . . $ `external/opusfile/opus/celt/stack_alloc.h:95:9`!(pcm_transition_celt, pcm_transition_celt_size, opus_val16); |
| 341 | if (transition && mode == MODE_CELT_ONLYcxx . . $ `external/opusfile/opus/opus_private.h:110:9`!) |
| 342 | { |
| 343 | pcm_transition = pcm_transition_celt; |
| 344 | opus_decode_framecxx . . $ opus_decode_frame(2eaeb09d95f20e3).(st, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, 0, pcm_transition, IMINcxx . . $ `external/opusfile/opus/celt/arch.h:101:9`!(F5, audiosize), 0); |
| 345 | } |
| 346 | if (audiosize > frame_size) |
| 347 | { |
| 348 | /*fprintf(stderr, "PCM buffer too small: %d vs %d (mode = %d)\n", audiosize, frame_size, mode);*/ |
| 349 | RESTORE_STACKcxx . . $ `external/opusfile/opus/celt/stack_alloc.h:97:9`!; |
| 350 | return OPUS_BAD_ARGcxx . . $ `external/opusfile/opus/opus_defines.h:48:9`!; |
| 351 | } else { |
| 352 | frame_size = audiosize; |
| 353 | } |
| 354 | |
| 355 | /* Don't allocate any memory when in CELT-only mode */ |
| 356 | pcm_silk_size = (mode != MODE_CELT_ONLYcxx . . $ `external/opusfile/opus/opus_private.h:110:9`! && !celt_accum) ? IMAXcxx . . $ `external/opusfile/opus/celt/arch.h:102:9`!(F10, frame_size)*st->channelscxx . . $ OpusDecoder#channels. : ALLOC_NONEcxx . . $ `external/opusfile/opus/celt/stack_alloc.h:100:9`!; |
| 357 | ALLOCcxx . . $ `external/opusfile/opus/celt/stack_alloc.h:95:9`!(pcm_silk, pcm_silk_size, opus_int16); |
| 358 | |
| 359 | /* SILK processing */ |
| 360 | if (mode != MODE_CELT_ONLYcxx . . $ `external/opusfile/opus/opus_private.h:110:9`!) |
| 361 | { |
| 362 | int lost_flag, decoded_samples; |
| 363 | opus_int16cxx . . $ opus_int16# *pcm_ptr; |
| 364 | #ifdef FIXED_POINT |
| 365 | if (celt_accum) |
| 366 | pcm_ptr = pcm; |
| 367 | else |
| 368 | #endif |
| 369 | pcm_ptr = pcm_silk; |
| 370 | |
| 371 | if (st->prev_modecxx . . $ OpusDecoder#prev_mode.==MODE_CELT_ONLYcxx . . $ `external/opusfile/opus/opus_private.h:110:9`!) |
| 372 | silk_InitDecodercxx . . $ silk_InitDecoder(dedf1e9b1c614a07).( silk_dec ); |
| 373 | |
| 374 | /* The SILK PLC cannot produce frames of less than 10 ms */ |
| 375 | st->DecControlcxx . . $ OpusDecoder#DecControl..payloadSize_mscxx . . $ $anonymous_type_1138ce94d7cabe34_1#payloadSize_ms. = IMAXcxx . . $ `external/opusfile/opus/celt/arch.h:102:9`!(10, 1000 * audiosize / st->Fs); |
| 376 | |
| 377 | if (data != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) |
| 378 | { |
| 379 | st->DecControlcxx . . $ OpusDecoder#DecControl..nChannelsInternalcxx . . $ $anonymous_type_1138ce94d7cabe34_1#nChannelsInternal. = st->stream_channelscxx . . $ OpusDecoder#stream_channels.; |
| 380 | if( mode == MODE_SILK_ONLYcxx . . $ `external/opusfile/opus/opus_private.h:108:9`! ) { |
| 381 | if( bandwidth == OPUS_BANDWIDTH_NARROWBANDcxx . . $ `external/opusfile/opus/opus_defines.h:203:9`! ) { |
| 382 | st->DecControlcxx . . $ OpusDecoder#DecControl..internalSampleRatecxx . . $ $anonymous_type_1138ce94d7cabe34_1#internalSampleRate. = 8000; |
| 383 | } else if( bandwidth == OPUS_BANDWIDTH_MEDIUMBANDcxx . . $ `external/opusfile/opus/opus_defines.h:204:9`! ) { |
| 384 | st->DecControlcxx . . $ OpusDecoder#DecControl..internalSampleRatecxx . . $ $anonymous_type_1138ce94d7cabe34_1#internalSampleRate. = 12000; |
| 385 | } else if( bandwidth == OPUS_BANDWIDTH_WIDEBANDcxx . . $ `external/opusfile/opus/opus_defines.h:205:9`! ) { |
| 386 | st->DecControlcxx . . $ OpusDecoder#DecControl..internalSampleRatecxx . . $ $anonymous_type_1138ce94d7cabe34_1#internalSampleRate. = 16000; |
| 387 | } else { |
| 388 | st->DecControlcxx . . $ OpusDecoder#DecControl..internalSampleRatecxx . . $ $anonymous_type_1138ce94d7cabe34_1#internalSampleRate. = 16000; |
| 389 | celt_assertcxx . . $ `external/opusfile/opus/celt/arch.h:80:9`!( 0 ); |
| 390 | } |
| 391 | } else { |
| 392 | /* Hybrid mode */ |
| 393 | st->DecControlcxx . . $ OpusDecoder#DecControl..internalSampleRatecxx . . $ $anonymous_type_1138ce94d7cabe34_1#internalSampleRate. = 16000; |
| 394 | } |
| 395 | } |
| 396 | |
| 397 | lost_flag = data == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`! ? 1 : 2 * decode_fec; |
| 398 | decoded_samples = 0; |
| 399 | do { |
| 400 | /* Call SILK decoder */ |
| 401 | int first_frame = decoded_samples == 0; |
| 402 | silk_ret = silk_Decodecxx . . $ silk_Decode(e7dc7d902a4e7c30).( silk_dec, &st->DecControlcxx . . $ OpusDecoder#DecControl., |
| 403 | lost_flag, first_frame, &dec, pcm_ptr, &silk_frame_size, st->archcxx . . $ OpusDecoder#arch. ); |
| 404 | if( silk_ret ) { |
| 405 | if (lost_flag) { |
| 406 | /* PLC failure should not be fatal */ |
| 407 | silk_frame_size = frame_size; |
| 408 | for (i=0;i<frame_size*st->channelscxx . . $ OpusDecoder#channels.;i++) |
| 409 | pcm_ptr[i] = 0; |
| 410 | } else { |
| 411 | RESTORE_STACKcxx . . $ `external/opusfile/opus/celt/stack_alloc.h:97:9`!; |
| 412 | return OPUS_INTERNAL_ERRORcxx . . $ `external/opusfile/opus/opus_defines.h:52:9`!; |
| 413 | } |
| 414 | } |
| 415 | pcm_ptr += silk_frame_size * st->channelscxx . . $ OpusDecoder#channels.; |
| 416 | decoded_samples += silk_frame_size; |
| 417 | } while( decoded_samples < frame_size ); |
| 418 | } |
| 419 | |
| 420 | start_band = 0; |
| 421 | if (!decode_fec && mode != MODE_CELT_ONLYcxx . . $ `external/opusfile/opus/opus_private.h:110:9`! && data != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`! |
| 422 | && ec_tellcxx . . $ ec_tell(d262775a7bafb6a0).(&dec)+17+20*(st->modecxx . . $ OpusDecoder#mode. == MODE_HYBRIDcxx . . $ `external/opusfile/opus/opus_private.h:109:9`!) <= 8*len) |
| 423 | { |
| 424 | /* Check if we have a redundant 0-8 kHz band */ |
| 425 | if (mode == MODE_HYBRIDcxx . . $ `external/opusfile/opus/opus_private.h:109:9`!) |
| 426 | redundancy = ec_dec_bit_logpcxx . . $ ec_dec_bit_logp(fb67670de84eabc5).(&dec, 12); |
| 427 | else |
| 428 | redundancy = 1; |
| 429 | if (redundancy) |
| 430 | { |
| 431 | celt_to_silk = ec_dec_bit_logpcxx . . $ ec_dec_bit_logp(fb67670de84eabc5).(&dec, 1); |
| 432 | /* redundancy_bytes will be at least two, in the non-hybrid |
| 433 | case due to the ec_tell() check above */ |
| 434 | redundancy_bytes = mode==MODE_HYBRIDcxx . . $ `external/opusfile/opus/opus_private.h:109:9`! ? |
| 435 | (opus_int32cxx . . $ opus_int32#)ec_dec_uintcxx . . $ ec_dec_uint(ce44d6763753db26).(&dec, 256)+2 : |
| 436 | len-((ec_tellcxx . . $ ec_tell(d262775a7bafb6a0).(&dec)+7)>>3); |
| 437 | len -= redundancy_bytes; |
| 438 | /* This is a sanity check. It should never happen for a valid |
| 439 | packet, so the exact behaviour is not normative. */ |
| 440 | if (len*8 < ec_tellcxx . . $ ec_tell(d262775a7bafb6a0).(&dec)) |
| 441 | { |
| 442 | len = 0; |
| 443 | redundancy_bytes = 0; |
| 444 | redundancy = 0; |
| 445 | } |
| 446 | /* Shrink decoder because of raw bits */ |
| 447 | dec.storagecxx . . $ ec_ctx#storage. -= redundancy_bytes; |
| 448 | } |
| 449 | } |
| 450 | if (mode != MODE_CELT_ONLYcxx . . $ `external/opusfile/opus/opus_private.h:110:9`!) |
| 451 | start_band = 17; |
| 452 | |
| 453 | if (redundancy) |
| 454 | { |
| 455 | transition = 0; |
| 456 | pcm_transition_silk_size=ALLOC_NONEcxx . . $ `external/opusfile/opus/celt/stack_alloc.h:100:9`!; |
| 457 | } |
| 458 | |
| 459 | ALLOCcxx . . $ `external/opusfile/opus/celt/stack_alloc.h:95:9`!(pcm_transition_silk, pcm_transition_silk_size, opus_val16); |
| 460 | |
| 461 | if (transition && mode != MODE_CELT_ONLYcxx . . $ `external/opusfile/opus/opus_private.h:110:9`!) |
| 462 | { |
| 463 | pcm_transition = pcm_transition_silk; |
| 464 | opus_decode_framecxx . . $ opus_decode_frame(2eaeb09d95f20e3).(st, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, 0, pcm_transition, IMINcxx . . $ `external/opusfile/opus/celt/arch.h:101:9`!(F5, audiosize), 0); |
| 465 | } |
| 466 | |
| 467 | |
| 468 | if (bandwidth) |
| 469 | { |
| 470 | int endband=21; |
| 471 | |
| 472 | switch(bandwidth) |
| 473 | { |
| 474 | case OPUS_BANDWIDTH_NARROWBANDcxx . . $ `external/opusfile/opus/opus_defines.h:203:9`!: |
| 475 | endband = 13; |
| 476 | break; |
| 477 | case OPUS_BANDWIDTH_MEDIUMBANDcxx . . $ `external/opusfile/opus/opus_defines.h:204:9`!: |
| 478 | case OPUS_BANDWIDTH_WIDEBANDcxx . . $ `external/opusfile/opus/opus_defines.h:205:9`!: |
| 479 | endband = 17; |
| 480 | break; |
| 481 | case OPUS_BANDWIDTH_SUPERWIDEBANDcxx . . $ `external/opusfile/opus/opus_defines.h:206:9`!: |
| 482 | endband = 19; |
| 483 | break; |
| 484 | case OPUS_BANDWIDTH_FULLBANDcxx . . $ `external/opusfile/opus/opus_defines.h:207:9`!: |
| 485 | endband = 21; |
| 486 | break; |
| 487 | default: |
| 488 | celt_assertcxx . . $ `external/opusfile/opus/celt/arch.h:80:9`!(0); |
| 489 | break; |
| 490 | } |
| 491 | MUST_SUCCEEDcxx . . $ `external/opusfile/opus/celt/arch.h:82:9`!(celt_decoder_ctlcxx . . $ `external/opusfile/opus/celt/celt.h:156:9`!(celt_dec, CELT_SET_END_BANDcxx . . $ `external/opusfile/opus/celt/celt.h:108:9`!(endband))); |
| 492 | } |
| 493 | MUST_SUCCEEDcxx . . $ `external/opusfile/opus/celt/arch.h:82:9`!(celt_decoder_ctlcxx . . $ `external/opusfile/opus/celt/celt.h:156:9`!(celt_dec, CELT_SET_CHANNELScxx . . $ `external/opusfile/opus/celt/celt.h:100:9`!(st->stream_channels))); |
| 494 | |
| 495 | /* Only allocation memory for redundancy if/when needed */ |
| 496 | redundant_audio_size = redundancy ? F5*st->channelscxx . . $ OpusDecoder#channels. : ALLOC_NONEcxx . . $ `external/opusfile/opus/celt/stack_alloc.h:100:9`!; |
| 497 | ALLOCcxx . . $ `external/opusfile/opus/celt/stack_alloc.h:95:9`!(redundant_audio, redundant_audio_size, opus_val16); |
| 498 | |
| 499 | /* 5 ms redundant frame for CELT->SILK*/ |
| 500 | if (redundancy && celt_to_silk) |
| 501 | { |
| 502 | MUST_SUCCEEDcxx . . $ `external/opusfile/opus/celt/arch.h:82:9`!(celt_decoder_ctlcxx . . $ `external/opusfile/opus/celt/celt.h:156:9`!(celt_dec, CELT_SET_START_BANDcxx . . $ `external/opusfile/opus/celt/celt.h:105:9`!(0))); |
| 503 | celt_decode_with_eccxx . . $ celt_decode_with_ec(f094f6999cb7947e).(celt_dec, data+len, redundancy_bytes, |
| 504 | redundant_audio, F5, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, 0); |
| 505 | MUST_SUCCEEDcxx . . $ `external/opusfile/opus/celt/arch.h:82:9`!(celt_decoder_ctlcxx . . $ `external/opusfile/opus/celt/celt.h:156:9`!(celt_dec, OPUS_GET_FINAL_RANGEcxx . . $ `external/opusfile/opus/opus_defines.h:672:9`!(&redundant_rng))); |
| 506 | } |
| 507 | |
| 508 | /* MUST be after PLC */ |
| 509 | MUST_SUCCEEDcxx . . $ `external/opusfile/opus/celt/arch.h:82:9`!(celt_decoder_ctlcxx . . $ `external/opusfile/opus/celt/celt.h:156:9`!(celt_dec, CELT_SET_START_BANDcxx . . $ `external/opusfile/opus/celt/celt.h:105:9`!(start_band))); |
| 510 | |
| 511 | if (mode != MODE_SILK_ONLYcxx . . $ `external/opusfile/opus/opus_private.h:108:9`!) |
| 512 | { |
| 513 | int celt_frame_size = IMINcxx . . $ `external/opusfile/opus/celt/arch.h:101:9`!(F20, frame_size); |
| 514 | /* Make sure to discard any previous CELT state */ |
| 515 | if (mode != st->prev_modecxx . . $ OpusDecoder#prev_mode. && st->prev_modecxx . . $ OpusDecoder#prev_mode. > 0 && !st->prev_redundancycxx . . $ OpusDecoder#prev_redundancy.) |
| 516 | MUST_SUCCEEDcxx . . $ `external/opusfile/opus/celt/arch.h:82:9`!(celt_decoder_ctlcxx . . $ `external/opusfile/opus/celt/celt.h:156:9`!(celt_dec, OPUS_RESET_STATEcxx . . $ `external/opusfile/opus/opus_defines.h:662:9`!)); |
| 517 | /* Decode CELT */ |
| 518 | celt_ret = celt_decode_with_eccxx . . $ celt_decode_with_ec(f094f6999cb7947e).(celt_dec, decode_fec ? NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`! : data, |
| 519 | len, pcm, celt_frame_size, &dec, celt_accum); |
| 520 | } else { |
| 521 | unsigned char silence[2] = {0xFF, 0xFF}; |
| 522 | if (!celt_accum) |
| 523 | { |
| 524 | for (i=0;i<frame_size*st->channelscxx . . $ OpusDecoder#channels.;i++) |
| 525 | pcm[i] = 0; |
| 526 | } |
| 527 | /* For hybrid -> SILK transitions, we let the CELT MDCT |
| 528 | do a fade-out by decoding a silence frame */ |
| 529 | if (st->prev_modecxx . . $ OpusDecoder#prev_mode. == MODE_HYBRIDcxx . . $ `external/opusfile/opus/opus_private.h:109:9`! && !(redundancy && celt_to_silk && st->prev_redundancycxx . . $ OpusDecoder#prev_redundancy.) ) |
| 530 | { |
| 531 | MUST_SUCCEEDcxx . . $ `external/opusfile/opus/celt/arch.h:82:9`!(celt_decoder_ctlcxx . . $ `external/opusfile/opus/celt/celt.h:156:9`!(celt_dec, CELT_SET_START_BANDcxx . . $ `external/opusfile/opus/celt/celt.h:105:9`!(0))); |
| 532 | celt_decode_with_eccxx . . $ celt_decode_with_ec(f094f6999cb7947e).(celt_dec, silence, 2, pcm, F2_5, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, celt_accum); |
| 533 | } |
| 534 | } |
| 535 | |
| 536 | if (mode != MODE_CELT_ONLYcxx . . $ `external/opusfile/opus/opus_private.h:110:9`! && !celt_accum) |
| 537 | { |
| 538 | #ifdef FIXED_POINT |
| 539 | for (i=0;i<frame_size*st->channels;i++) |
| 540 | pcm[i] = SAT16(ADD32(pcm[i], pcm_silk[i])); |
| 541 | #else |
| 542 | for (i=0;i<frame_size*st->channelscxx . . $ OpusDecoder#channels.;i++) |
| 543 | pcm[i] = pcm[i] + (opus_val16cxx . . $ opus_val16#)((1.f/32768.f)*pcm_silk[i]); |
| 544 | #endif |
| 545 | } |
| 546 | |
| 547 | { |
| 548 | const CELTModecxx . . $ `external/opusfile/opus/celt/celt.h:51:9`! *celt_mode; |
| 549 | MUST_SUCCEEDcxx . . $ `external/opusfile/opus/celt/arch.h:82:9`!(celt_decoder_ctlcxx . . $ `external/opusfile/opus/celt/celt.h:156:9`!(celt_dec, CELT_GET_MODEcxx . . $ `external/opusfile/opus/celt/celt.h:112:9`!(&celt_mode))); |
| 550 | window = celt_mode->windowcxx . . $ OpusCustomMode#window.; |
| 551 | } |
| 552 | |
| 553 | /* 5 ms redundant frame for SILK->CELT */ |
| 554 | if (redundancy && !celt_to_silk) |
| 555 | { |
| 556 | MUST_SUCCEEDcxx . . $ `external/opusfile/opus/celt/arch.h:82:9`!(celt_decoder_ctlcxx . . $ `external/opusfile/opus/celt/celt.h:156:9`!(celt_dec, OPUS_RESET_STATEcxx . . $ `external/opusfile/opus/opus_defines.h:662:9`!)); |
| 557 | MUST_SUCCEEDcxx . . $ `external/opusfile/opus/celt/arch.h:82:9`!(celt_decoder_ctlcxx . . $ `external/opusfile/opus/celt/celt.h:156:9`!(celt_dec, CELT_SET_START_BANDcxx . . $ `external/opusfile/opus/celt/celt.h:105:9`!(0))); |
| 558 | |
| 559 | celt_decode_with_eccxx . . $ celt_decode_with_ec(f094f6999cb7947e).(celt_dec, data+len, redundancy_bytes, redundant_audio, F5, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, 0); |
| 560 | MUST_SUCCEEDcxx . . $ `external/opusfile/opus/celt/arch.h:82:9`!(celt_decoder_ctlcxx . . $ `external/opusfile/opus/celt/celt.h:156:9`!(celt_dec, OPUS_GET_FINAL_RANGEcxx . . $ `external/opusfile/opus/opus_defines.h:672:9`!(&redundant_rng))); |
| 561 | smooth_fadecxx . . $ smooth_fade(86cac40a1a0ef7).(pcm+st->channelscxx . . $ OpusDecoder#channels.*(frame_size-F2_5), redundant_audio+st->channelscxx . . $ OpusDecoder#channels.*F2_5, |
| 562 | pcm+st->channelscxx . . $ OpusDecoder#channels.*(frame_size-F2_5), F2_5, st->channelscxx . . $ OpusDecoder#channels., window, st->Fscxx . . $ OpusDecoder#Fs.); |
| 563 | } |
| 564 | if (redundancy && celt_to_silk) |
| 565 | { |
| 566 | for (c=0;c<st->channelscxx . . $ OpusDecoder#channels.;c++) |
| 567 | { |
| 568 | for (i=0;i<F2_5;i++) |
| 569 | pcm[st->channelscxx . . $ OpusDecoder#channels.*i+c] = redundant_audio[st->channelscxx . . $ OpusDecoder#channels.*i+c]; |
| 570 | } |
| 571 | smooth_fadecxx . . $ smooth_fade(86cac40a1a0ef7).(redundant_audio+st->channelscxx . . $ OpusDecoder#channels.*F2_5, pcm+st->channelscxx . . $ OpusDecoder#channels.*F2_5, |
| 572 | pcm+st->channelscxx . . $ OpusDecoder#channels.*F2_5, F2_5, st->channelscxx . . $ OpusDecoder#channels., window, st->Fscxx . . $ OpusDecoder#Fs.); |
| 573 | } |
| 574 | if (transition) |
| 575 | { |
| 576 | if (audiosize >= F5) |
| 577 | { |
| 578 | for (i=0;i<st->channelscxx . . $ OpusDecoder#channels.*F2_5;i++) |
| 579 | pcm[i] = pcm_transition[i]; |
| 580 | smooth_fadecxx . . $ smooth_fade(86cac40a1a0ef7).(pcm_transition+st->channelscxx . . $ OpusDecoder#channels.*F2_5, pcm+st->channelscxx . . $ OpusDecoder#channels.*F2_5, |
| 581 | pcm+st->channelscxx . . $ OpusDecoder#channels.*F2_5, F2_5, |
| 582 | st->channelscxx . . $ OpusDecoder#channels., window, st->Fscxx . . $ OpusDecoder#Fs.); |
| 583 | } else { |
| 584 | /* Not enough time to do a clean transition, but we do it anyway |
| 585 | This will not preserve amplitude perfectly and may introduce |
| 586 | a bit of temporal aliasing, but it shouldn't be too bad and |
| 587 | that's pretty much the best we can do. In any case, generating this |
| 588 | transition it pretty silly in the first place */ |
| 589 | smooth_fadecxx . . $ smooth_fade(86cac40a1a0ef7).(pcm_transition, pcm, |
| 590 | pcm, F2_5, |
| 591 | st->channelscxx . . $ OpusDecoder#channels., window, st->Fscxx . . $ OpusDecoder#Fs.); |
| 592 | } |
| 593 | } |
| 594 | |
| 595 | if(st->decode_gaincxx . . $ OpusDecoder#decode_gain.) |
| 596 | { |
| 597 | opus_val32cxx . . $ opus_val32# gain; |
| 598 | gain = celt_exp2cxx . . $ `external/opusfile/opus/celt/mathops.h:169:9`!(MULT16_16_P15cxx . . $ `external/opusfile/opus/celt/arch.h:265:9`!(QCONST16cxx . . $ `external/opusfile/opus/celt/arch.h:216:9`!(6.48814081e-4f, 25), st->decode_gain)); |
| 599 | for (i=0;i<frame_size*st->channelscxx . . $ OpusDecoder#channels.;i++) |
| 600 | { |
| 601 | opus_val32cxx . . $ opus_val32# x; |
| 602 | x = MULT16_32_P16cxx . . $ `external/opusfile/opus/celt/arch.h:268:9`!(pcm[i],gain); |
| 603 | pcm[i] = SATURATEcxx . . $ `external/opusfile/opus/celt/arch.h:234:9`!(x, 32767); |
| 604 | } |
| 605 | } |
| 606 | |
| 607 | if (len <= 1) |
| 608 | st->rangeFinalcxx . . $ OpusDecoder#rangeFinal. = 0; |
| 609 | else |
| 610 | st->rangeFinalcxx . . $ OpusDecoder#rangeFinal. = dec.rngcxx . . $ ec_ctx#rng. ^ redundant_rng; |
| 611 | |
| 612 | st->prev_modecxx . . $ OpusDecoder#prev_mode. = mode; |
| 613 | st->prev_redundancycxx . . $ OpusDecoder#prev_redundancy. = redundancy && !celt_to_silk; |
| 614 | |
| 615 | if (celt_ret>=0) |
| 616 | { |
| 617 | if (OPUS_CHECK_ARRAYcxx . . $ `external/opusfile/opus/celt/stack_alloc.h:177:9`!(pcm, audiosize*st->channels)) |
| 618 | OPUS_PRINT_INTcxx . . $ `external/opusfile/opus/celt/stack_alloc.h:179:9`!(audiosize); |
| 619 | } |
| 620 | |
| 621 | RESTORE_STACKcxx . . $ `external/opusfile/opus/celt/stack_alloc.h:97:9`!; |
| 622 | return celt_ret < 0 ? celt_ret : audiosize; |
| 623 | |
| 624 | } |
| 625 | |
| 626 | int opus_decode_nativecxx . . $ opus_decode_native(6e6dc8054156a6af).(OpusDecodercxx . . $ OpusDecoder# *st, const unsigned char *data, |
| 627 | opus_int32cxx . . $ opus_int32# len, opus_val16cxx . . $ opus_val16# *pcm, int frame_size, int decode_fec, |
| 628 | int self_delimited, opus_int32cxx . . $ opus_int32# *packet_offset, int soft_clip) |
| 629 | { |
| 630 | int i, nb_samples; |
| 631 | int count, offset; |
| 632 | unsigned char toc; |
| 633 | int packet_frame_size, packet_bandwidth, packet_mode, packet_stream_channels; |
| 634 | /* 48 x 2.5 ms = 120 ms */ |
| 635 | opus_int16cxx . . $ opus_int16# size[48]; |
| 636 | VALIDATE_OPUS_DECODERcxx . . $ `external/opusfile/opus/opus_decoder.c:97:9`!(st); |
| 637 | if (decode_fec<0 || decode_fec>1) |
| 638 | return OPUS_BAD_ARGcxx . . $ `external/opusfile/opus/opus_defines.h:48:9`!; |
| 639 | /* For FEC/PLC, frame_size has to be to have a multiple of 2.5 ms */ |
| 640 | if ((decode_fec || len==0 || data==NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) && frame_size%(st->Fscxx . . $ OpusDecoder#Fs./400)!=0) |
| 641 | return OPUS_BAD_ARGcxx . . $ `external/opusfile/opus/opus_defines.h:48:9`!; |
| 642 | if (len==0 || data==NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) |
| 643 | { |
| 644 | int pcm_count=0; |
| 645 | do { |
| 646 | int ret; |
| 647 | ret = opus_decode_framecxx . . $ opus_decode_frame(2eaeb09d95f20e3).(st, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, 0, pcm+pcm_count*st->channelscxx . . $ OpusDecoder#channels., frame_size-pcm_count, 0); |
| 648 | if (ret<0) |
| 649 | return ret; |
| 650 | pcm_count += ret; |
| 651 | } while (pcm_count < frame_size); |
| 652 | celt_assertcxx . . $ `external/opusfile/opus/celt/arch.h:80:9`!(pcm_count == frame_size); |
| 653 | if (OPUS_CHECK_ARRAYcxx . . $ `external/opusfile/opus/celt/stack_alloc.h:177:9`!(pcm, pcm_count*st->channels)) |
| 654 | OPUS_PRINT_INTcxx . . $ `external/opusfile/opus/celt/stack_alloc.h:179:9`!(pcm_count); |
| 655 | st->last_packet_durationcxx . . $ OpusDecoder#last_packet_duration. = pcm_count; |
| 656 | return pcm_count; |
| 657 | } else if (len<0) |
| 658 | return OPUS_BAD_ARGcxx . . $ `external/opusfile/opus/opus_defines.h:48:9`!; |
| 659 | |
| 660 | packet_mode = opus_packet_get_modecxx . . $ opus_packet_get_mode(b84ccf4e0bb14b06).(data); |
| 661 | packet_bandwidth = opus_packet_get_bandwidthcxx . . $ opus_packet_get_bandwidth(b84ccf4e0bb14b06).(data); |
| 662 | packet_frame_size = opus_packet_get_samples_per_framecxx . . $ opus_packet_get_samples_per_frame(87fdc3b2e2b212a8).(data, st->Fscxx . . $ OpusDecoder#Fs.); |
| 663 | packet_stream_channels = opus_packet_get_nb_channelscxx . . $ opus_packet_get_nb_channels(b84ccf4e0bb14b06).(data); |
| 664 | |
| 665 | count = opus_packet_parse_implcxx . . $ opus_packet_parse_impl(58cc79780d799092).(data, len, self_delimited, &toc, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, |
| 666 | size, &offset, packet_offset); |
| 667 | if (count<0) |
| 668 | return count; |
| 669 | |
| 670 | data += offset; |
| 671 | |
| 672 | if (decode_fec) |
| 673 | { |
| 674 | int duration_copy; |
| 675 | int ret; |
| 676 | /* If no FEC can be present, run the PLC (recursive call) */ |
| 677 | if (frame_size < packet_frame_size || packet_mode == MODE_CELT_ONLYcxx . . $ `external/opusfile/opus/opus_private.h:110:9`! || st->modecxx . . $ OpusDecoder#mode. == MODE_CELT_ONLYcxx . . $ `external/opusfile/opus/opus_private.h:110:9`!) |
| 678 | return opus_decode_nativecxx . . $ opus_decode_native(6e6dc8054156a6af).(st, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, 0, pcm, frame_size, 0, 0, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, soft_clip); |
| 679 | /* Otherwise, run the PLC on everything except the size for which we might have FEC */ |
| 680 | duration_copy = st->last_packet_durationcxx . . $ OpusDecoder#last_packet_duration.; |
| 681 | if (frame_size-packet_frame_size!=0) |
| 682 | { |
| 683 | ret = opus_decode_nativecxx . . $ opus_decode_native(6e6dc8054156a6af).(st, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, 0, pcm, frame_size-packet_frame_size, 0, 0, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, soft_clip); |
| 684 | if (ret<0) |
| 685 | { |
| 686 | st->last_packet_durationcxx . . $ OpusDecoder#last_packet_duration. = duration_copy; |
| 687 | return ret; |
| 688 | } |
| 689 | celt_assertcxx . . $ `external/opusfile/opus/celt/arch.h:80:9`!(ret==frame_size-packet_frame_size); |
| 690 | } |
| 691 | /* Complete with FEC */ |
| 692 | st->modecxx . . $ OpusDecoder#mode. = packet_mode; |
| 693 | st->bandwidthcxx . . $ OpusDecoder#bandwidth. = packet_bandwidth; |
| 694 | st->frame_sizecxx . . $ OpusDecoder#frame_size. = packet_frame_size; |
| 695 | st->stream_channelscxx . . $ OpusDecoder#stream_channels. = packet_stream_channels; |
| 696 | ret = opus_decode_framecxx . . $ opus_decode_frame(2eaeb09d95f20e3).(st, data, size[0], pcm+st->channelscxx . . $ OpusDecoder#channels.*(frame_size-packet_frame_size), |
| 697 | packet_frame_size, 1); |
| 698 | if (ret<0) |
| 699 | return ret; |
| 700 | else { |
| 701 | if (OPUS_CHECK_ARRAYcxx . . $ `external/opusfile/opus/celt/stack_alloc.h:177:9`!(pcm, frame_size*st->channels)) |
| 702 | OPUS_PRINT_INTcxx . . $ `external/opusfile/opus/celt/stack_alloc.h:179:9`!(frame_size); |
| 703 | st->last_packet_durationcxx . . $ OpusDecoder#last_packet_duration. = frame_size; |
| 704 | return frame_size; |
| 705 | } |
| 706 | } |
| 707 | |
| 708 | if (count*packet_frame_size > frame_size) |
| 709 | return OPUS_BUFFER_TOO_SMALLcxx . . $ `external/opusfile/opus/opus_defines.h:50:9`!; |
| 710 | |
| 711 | /* Update the state as the last step to avoid updating it on an invalid packet */ |
| 712 | st->modecxx . . $ OpusDecoder#mode. = packet_mode; |
| 713 | st->bandwidthcxx . . $ OpusDecoder#bandwidth. = packet_bandwidth; |
| 714 | st->frame_sizecxx . . $ OpusDecoder#frame_size. = packet_frame_size; |
| 715 | st->stream_channelscxx . . $ OpusDecoder#stream_channels. = packet_stream_channels; |
| 716 | |
| 717 | nb_samples=0; |
| 718 | for (i=0;i<count;i++) |
| 719 | { |
| 720 | int ret; |
| 721 | ret = opus_decode_framecxx . . $ opus_decode_frame(2eaeb09d95f20e3).(st, data, size[i], pcm+nb_samples*st->channelscxx . . $ OpusDecoder#channels., frame_size-nb_samples, 0); |
| 722 | if (ret<0) |
| 723 | return ret; |
| 724 | celt_assertcxx . . $ `external/opusfile/opus/celt/arch.h:80:9`!(ret==packet_frame_size); |
| 725 | data += size[i]; |
| 726 | nb_samples += ret; |
| 727 | } |
| 728 | st->last_packet_durationcxx . . $ OpusDecoder#last_packet_duration. = nb_samples; |
| 729 | if (OPUS_CHECK_ARRAYcxx . . $ `external/opusfile/opus/celt/stack_alloc.h:177:9`!(pcm, nb_samples*st->channels)) |
| 730 | OPUS_PRINT_INTcxx . . $ `external/opusfile/opus/celt/stack_alloc.h:179:9`!(nb_samples); |
| 731 | #ifndef FIXED_POINT |
| 732 | if (soft_clip) |
| 733 | opus_pcm_soft_clipcxx . . $ opus_pcm_soft_clip(fc9418eed466797e).(pcm, nb_samples, st->channelscxx . . $ OpusDecoder#channels., st->softclip_memcxx . . $ OpusDecoder#softclip_mem.); |
| 734 | else |
| 735 | st->softclip_memcxx . . $ OpusDecoder#softclip_mem.[0]=st->softclip_memcxx . . $ OpusDecoder#softclip_mem.[1]=0; |
| 736 | #endif |
| 737 | return nb_samples; |
| 738 | } |
| 739 | |
| 740 | #ifdef FIXED_POINT |
| 741 | |
| 742 | int opus_decode(OpusDecoder *st, const unsigned char *data, |
| 743 | opus_int32 len, opus_val16 *pcm, int frame_size, int decode_fec) |
| 744 | { |
| 745 | if(frame_size<=0) |
| 746 | return OPUS_BAD_ARG; |
| 747 | return opus_decode_native(st, data, len, pcm, frame_size, decode_fec, 0, NULL, 0); |
| 748 | } |
| 749 | |
| 750 | #ifndef DISABLE_FLOAT_API |
| 751 | int opus_decode_float(OpusDecoder *st, const unsigned char *data, |
| 752 | opus_int32 len, float *pcm, int frame_size, int decode_fec) |
| 753 | { |
| 754 | VARDECL(opus_int16, out); |
| 755 | int ret, i; |
| 756 | int nb_samples; |
| 757 | ALLOC_STACK; |
| 758 | |
| 759 | if(frame_size<=0) |
| 760 | { |
| 761 | RESTORE_STACK; |
| 762 | return OPUS_BAD_ARG; |
| 763 | } |
| 764 | if (data != NULL && len > 0 && !decode_fec) |
| 765 | { |
| 766 | nb_samples = opus_decoder_get_nb_samples(st, data, len); |
| 767 | if (nb_samples>0) |
| 768 | frame_size = IMIN(frame_size, nb_samples); |
| 769 | else |
| 770 | return OPUS_INVALID_PACKET; |
| 771 | } |
| 772 | celt_assert(st->channels == 1 || st->channels == 2); |
| 773 | ALLOC(out, frame_size*st->channels, opus_int16); |
| 774 | |
| 775 | ret = opus_decode_native(st, data, len, out, frame_size, decode_fec, 0, NULL, 0); |
| 776 | if (ret > 0) |
| 777 | { |
| 778 | for (i=0;i<ret*st->channels;i++) |
| 779 | pcm[i] = (1.f/32768.f)*(out[i]); |
| 780 | } |
| 781 | RESTORE_STACK; |
| 782 | return ret; |
| 783 | } |
| 784 | #endif |
| 785 | |
| 786 | |
| 787 | #else |
| 788 | int opus_decodecxx . . $ opus_decode(37ea2c04ee58593f).(OpusDecodercxx . . $ OpusDecoder# *st, const unsigned char *data, |
| 789 | opus_int32cxx . . $ opus_int32# len, opus_int16cxx . . $ opus_int16# *pcm, int frame_size, int decode_fec) |
| 790 | { |
| 791 | VARDECLcxx . . $ `external/opusfile/opus/celt/stack_alloc.h:94:9`!(float, out); |
| 792 | int ret, i; |
| 793 | int nb_samples; |
| 794 | ALLOC_STACKcxx . . $ `external/opusfile/opus/celt/stack_alloc.h:98:9`!; |
| 795 | |
| 796 | if(frame_size<=0) |
| 797 | { |
| 798 | RESTORE_STACKcxx . . $ `external/opusfile/opus/celt/stack_alloc.h:97:9`!; |
| 799 | return OPUS_BAD_ARGcxx . . $ `external/opusfile/opus/opus_defines.h:48:9`!; |
| 800 | } |
| 801 | |
| 802 | if (data != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`! && len > 0 && !decode_fec) |
| 803 | { |
| 804 | nb_samples = opus_decoder_get_nb_samplescxx . . $ opus_decoder_get_nb_samples(b2b31e84acb6b70e).(st, data, len); |
| 805 | if (nb_samples>0) |
| 806 | frame_size = IMINcxx . . $ `external/opusfile/opus/celt/arch.h:101:9`!(frame_size, nb_samples); |
| 807 | else |
| 808 | return OPUS_INVALID_PACKETcxx . . $ `external/opusfile/opus/opus_defines.h:54:9`!; |
| 809 | } |
| 810 | celt_assertcxx . . $ `external/opusfile/opus/celt/arch.h:80:9`!(st->channels == 1 || st->channels == 2); |
| 811 | ALLOCcxx . . $ `external/opusfile/opus/celt/stack_alloc.h:95:9`!(out, frame_size*st->channels, float); |
| 812 | |
| 813 | ret = opus_decode_nativecxx . . $ opus_decode_native(6e6dc8054156a6af).(st, data, len, out, frame_size, decode_fec, 0, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, 1); |
| 814 | if (ret > 0) |
| 815 | { |
| 816 | for (i=0;i<ret*st->channelscxx . . $ OpusDecoder#channels.;i++) |
| 817 | pcm[i] = FLOAT2INT16cxx . . $ FLOAT2INT16(16fe5f45793b5599).(out[i]); |
| 818 | } |
| 819 | RESTORE_STACKcxx . . $ `external/opusfile/opus/celt/stack_alloc.h:97:9`!; |
| 820 | return ret; |
| 821 | } |
| 822 | |
| 823 | int opus_decode_floatcxx . . $ opus_decode_float(2eaeb09d95f20e3).(OpusDecodercxx . . $ OpusDecoder# *st, const unsigned char *data, |
| 824 | opus_int32cxx . . $ opus_int32# len, opus_val16cxx . . $ opus_val16# *pcm, int frame_size, int decode_fec) |
| 825 | { |
| 826 | if(frame_size<=0) |
| 827 | return OPUS_BAD_ARGcxx . . $ `external/opusfile/opus/opus_defines.h:48:9`!; |
| 828 | return opus_decode_nativecxx . . $ opus_decode_native(6e6dc8054156a6af).(st, data, len, pcm, frame_size, decode_fec, 0, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, 0); |
| 829 | } |
| 830 | |
| 831 | #endif |
| 832 | |
| 833 | int opus_decoder_ctlcxx . . $ opus_decoder_ctl(f96ea19e1ec6253).(OpusDecodercxx . . $ OpusDecoder# *st, int request, ...) |
| 834 | { |
| 835 | int ret = OPUS_OKcxx . . $ `external/opusfile/opus/opus_defines.h:46:9`!; |
| 836 | va_listcxx . . $ va_list# ap; |
| 837 | void *silk_dec; |
| 838 | CELTDecodercxx . . $ `external/opusfile/opus/celt/celt.h:50:9`! *celt_dec; |
| 839 | |
| 840 | silk_dec = (char*)st+st->silk_dec_offsetcxx . . $ OpusDecoder#silk_dec_offset.; |
| 841 | celt_dec = (CELTDecodercxx . . $ `external/opusfile/opus/celt/celt.h:50:9`!*)((char*)st+st->celt_dec_offsetcxx . . $ OpusDecoder#celt_dec_offset.); |
| 842 | |
| 843 | |
| 844 | va_startcxx . . $ `<external>/8105065126723003039/stdarg.h:50:9`!(ap, request); |
| 845 | |
| 846 | switch (request) |
| 847 | { |
| 848 | case OPUS_GET_BANDWIDTH_REQUESTcxx . . $ `external/opusfile/opus/opus_defines.h:139:9`!: |
| 849 | { |
| 850 | opus_int32cxx . . $ opus_int32# *value = va_argcxx . . $ `<external>/8105065126723003039/stdarg.h:53:9`!(ap, opus_int32*); |
| 851 | if (!value) |
| 852 | { |
| 853 | goto bad_arg; |
| 854 | } |
| 855 | *value = st->bandwidthcxx . . $ OpusDecoder#bandwidth.; |
| 856 | } |
| 857 | break; |
| 858 | case OPUS_GET_FINAL_RANGE_REQUESTcxx . . $ `external/opusfile/opus/opus_defines.h:157:9`!: |
| 859 | { |
| 860 | opus_uint32cxx . . $ opus_uint32# *value = va_argcxx . . $ `<external>/8105065126723003039/stdarg.h:53:9`!(ap, opus_uint32*); |
| 861 | if (!value) |
| 862 | { |
| 863 | goto bad_arg; |
| 864 | } |
| 865 | *value = st->rangeFinalcxx . . $ OpusDecoder#rangeFinal.; |
| 866 | } |
| 867 | break; |
| 868 | case OPUS_RESET_STATEcxx . . $ `external/opusfile/opus/opus_defines.h:662:9`!: |
| 869 | { |
| 870 | OPUS_CLEARcxx . . $ `external/opusfile/opus/celt/os_support.h:83:9`!((char*)&st->OPUS_DECODER_RESET_STARTcxx . . $ `external/opusfile/opus/opus_decoder.c:65:9`!, |
| 871 | sizeof(OpusDecoder)- |
| 872 | ((char*)&st->OPUS_DECODER_RESET_STARTcxx . . $ `external/opusfile/opus/opus_decoder.c:65:9`! - (char*)st)); |
| 873 | |
| 874 | celt_decoder_ctlcxx . . $ `external/opusfile/opus/celt/celt.h:156:9`!(celt_dec, OPUS_RESET_STATEcxx . . $ `external/opusfile/opus/opus_defines.h:662:9`!); |
| 875 | silk_InitDecodercxx . . $ silk_InitDecoder(dedf1e9b1c614a07).( silk_dec ); |
| 876 | st->stream_channelscxx . . $ OpusDecoder#stream_channels. = st->channelscxx . . $ OpusDecoder#channels.; |
| 877 | st->frame_sizecxx . . $ OpusDecoder#frame_size. = st->Fscxx . . $ OpusDecoder#Fs./400; |
| 878 | } |
| 879 | break; |
| 880 | case OPUS_GET_SAMPLE_RATE_REQUESTcxx . . $ `external/opusfile/opus/opus_defines.h:156:9`!: |
| 881 | { |
| 882 | opus_int32cxx . . $ opus_int32# *value = va_argcxx . . $ `<external>/8105065126723003039/stdarg.h:53:9`!(ap, opus_int32*); |
| 883 | if (!value) |
| 884 | { |
| 885 | goto bad_arg; |
| 886 | } |
| 887 | *value = st->Fscxx . . $ OpusDecoder#Fs.; |
| 888 | } |
| 889 | break; |
| 890 | case OPUS_GET_PITCH_REQUESTcxx . . $ `external/opusfile/opus/opus_defines.h:158:9`!: |
| 891 | { |
| 892 | opus_int32cxx . . $ opus_int32# *value = va_argcxx . . $ `<external>/8105065126723003039/stdarg.h:53:9`!(ap, opus_int32*); |
| 893 | if (!value) |
| 894 | { |
| 895 | goto bad_arg; |
| 896 | } |
| 897 | if (st->prev_modecxx . . $ OpusDecoder#prev_mode. == MODE_CELT_ONLYcxx . . $ `external/opusfile/opus/opus_private.h:110:9`!) |
| 898 | ret = celt_decoder_ctlcxx . . $ `external/opusfile/opus/celt/celt.h:156:9`!(celt_dec, OPUS_GET_PITCHcxx . . $ `external/opusfile/opus/opus_defines.h:769:9`!(value)); |
| 899 | else |
| 900 | *value = st->DecControlcxx . . $ OpusDecoder#DecControl..prevPitchLagcxx . . $ $anonymous_type_1138ce94d7cabe34_1#prevPitchLag.; |
| 901 | } |
| 902 | break; |
| 903 | case OPUS_GET_GAIN_REQUESTcxx . . $ `external/opusfile/opus/opus_defines.h:160:9`!: |
| 904 | { |
| 905 | opus_int32cxx . . $ opus_int32# *value = va_argcxx . . $ `<external>/8105065126723003039/stdarg.h:53:9`!(ap, opus_int32*); |
| 906 | if (!value) |
| 907 | { |
| 908 | goto bad_arg; |
| 909 | } |
| 910 | *value = st->decode_gaincxx . . $ OpusDecoder#decode_gain.; |
| 911 | } |
| 912 | break; |
| 913 | case OPUS_SET_GAIN_REQUESTcxx . . $ `external/opusfile/opus/opus_defines.h:159:9`!: |
| 914 | { |
| 915 | opus_int32cxx . . $ opus_int32# value = va_argcxx . . $ `<external>/8105065126723003039/stdarg.h:53:9`!(ap, opus_int32); |
| 916 | if (value<-32768 || value>32767) |
| 917 | { |
| 918 | goto bad_arg; |
| 919 | } |
| 920 | st->decode_gaincxx . . $ OpusDecoder#decode_gain. = value; |
| 921 | } |
| 922 | break; |
| 923 | case OPUS_GET_LAST_PACKET_DURATION_REQUESTcxx . . $ `external/opusfile/opus/opus_defines.h:163:9`!: |
| 924 | { |
| 925 | opus_int32cxx . . $ opus_int32# *value = va_argcxx . . $ `<external>/8105065126723003039/stdarg.h:53:9`!(ap, opus_int32*); |
| 926 | if (!value) |
| 927 | { |
| 928 | goto bad_arg; |
| 929 | } |
| 930 | *value = st->last_packet_durationcxx . . $ OpusDecoder#last_packet_duration.; |
| 931 | } |
| 932 | break; |
| 933 | case OPUS_SET_PHASE_INVERSION_DISABLED_REQUESTcxx . . $ `external/opusfile/opus/opus_defines.h:169:9`!: |
| 934 | { |
| 935 | opus_int32cxx . . $ opus_int32# value = va_argcxx . . $ `<external>/8105065126723003039/stdarg.h:53:9`!(ap, opus_int32); |
| 936 | if(value<0 || value>1) |
| 937 | { |
| 938 | goto bad_arg; |
| 939 | } |
| 940 | ret = celt_decoder_ctlcxx . . $ `external/opusfile/opus/celt/celt.h:156:9`!(celt_dec, OPUS_SET_PHASE_INVERSION_DISABLEDcxx . . $ `external/opusfile/opus/opus_defines.h:709:9`!(value)); |
| 941 | } |
| 942 | break; |
| 943 | case OPUS_GET_PHASE_INVERSION_DISABLED_REQUESTcxx . . $ `external/opusfile/opus/opus_defines.h:170:9`!: |
| 944 | { |
| 945 | opus_int32cxx . . $ opus_int32# *value = va_argcxx . . $ `<external>/8105065126723003039/stdarg.h:53:9`!(ap, opus_int32*); |
| 946 | if (!value) |
| 947 | { |
| 948 | goto bad_arg; |
| 949 | } |
| 950 | ret = celt_decoder_ctlcxx . . $ `external/opusfile/opus/celt/celt.h:156:9`!(celt_dec, OPUS_GET_PHASE_INVERSION_DISABLEDcxx . . $ `external/opusfile/opus/opus_defines.h:718:9`!(value)); |
| 951 | } |
| 952 | break; |
| 953 | default: |
| 954 | /*fprintf(stderr, "unknown opus_decoder_ctl() request: %d", request);*/ |
| 955 | ret = OPUS_UNIMPLEMENTEDcxx . . $ `external/opusfile/opus/opus_defines.h:56:9`!; |
| 956 | break; |
| 957 | } |
| 958 | |
| 959 | va_endcxx . . $ `<external>/8105065126723003039/stdarg.h:52:9`!(ap); |
| 960 | return ret; |
| 961 | bad_arg: |
| 962 | va_endcxx . . $ `<external>/8105065126723003039/stdarg.h:52:9`!(ap); |
| 963 | return OPUS_BAD_ARGcxx . . $ `external/opusfile/opus/opus_defines.h:48:9`!; |
| 964 | } |
| 965 | |
| 966 | void opus_decoder_destroycxx . . $ opus_decoder_destroy(88f685c4e7a21aca).(OpusDecodercxx . . $ OpusDecoder# *st) |
| 967 | { |
| 968 | opus_freecxx . . $ opus_free(5d22bdacc48458e8).(st); |
| 969 | } |
| 970 | |
| 971 | |
| 972 | int opus_packet_get_bandwidthcxx . . $ opus_packet_get_bandwidth(b84ccf4e0bb14b06).(const unsigned char *data) |
| 973 | { |
| 974 | int bandwidth; |
| 975 | if (data[0]&0x80) |
| 976 | { |
| 977 | bandwidth = OPUS_BANDWIDTH_MEDIUMBANDcxx . . $ `external/opusfile/opus/opus_defines.h:204:9`! + ((data[0]>>5)&0x3); |
| 978 | if (bandwidth == OPUS_BANDWIDTH_MEDIUMBANDcxx . . $ `external/opusfile/opus/opus_defines.h:204:9`!) |
| 979 | bandwidth = OPUS_BANDWIDTH_NARROWBANDcxx . . $ `external/opusfile/opus/opus_defines.h:203:9`!; |
| 980 | } else if ((data[0]&0x60) == 0x60) |
| 981 | { |
| 982 | bandwidth = (data[0]&0x10) ? OPUS_BANDWIDTH_FULLBANDcxx . . $ `external/opusfile/opus/opus_defines.h:207:9`! : |
| 983 | OPUS_BANDWIDTH_SUPERWIDEBANDcxx . . $ `external/opusfile/opus/opus_defines.h:206:9`!; |
| 984 | } else { |
| 985 | bandwidth = OPUS_BANDWIDTH_NARROWBANDcxx . . $ `external/opusfile/opus/opus_defines.h:203:9`! + ((data[0]>>5)&0x3); |
| 986 | } |
| 987 | return bandwidth; |
| 988 | } |
| 989 | |
| 990 | int opus_packet_get_nb_channelscxx . . $ opus_packet_get_nb_channels(b84ccf4e0bb14b06).(const unsigned char *data) |
| 991 | { |
| 992 | return (data[0]&0x4) ? 2 : 1; |
| 993 | } |
| 994 | |
| 995 | int opus_packet_get_nb_framescxx . . $ opus_packet_get_nb_frames(87fdc3b2e2b212a8).(const unsigned char packet[], opus_int32cxx . . $ opus_int32# len) |
| 996 | { |
| 997 | int count; |
| 998 | if (len<1) |
| 999 | return OPUS_BAD_ARGcxx . . $ `external/opusfile/opus/opus_defines.h:48:9`!; |
| 1000 | count = packet[0]&0x3; |
| 1001 | if (count==0) |
| 1002 | return 1; |
| 1003 | else if (count!=3) |
| 1004 | return 2; |
| 1005 | else if (len<2) |
| 1006 | return OPUS_INVALID_PACKETcxx . . $ `external/opusfile/opus/opus_defines.h:54:9`!; |
| 1007 | else |
| 1008 | return packet[1]&0x3F; |
| 1009 | } |
| 1010 | |
| 1011 | int opus_packet_get_nb_samplescxx . . $ opus_packet_get_nb_samples(98fdf16c90fffe93).(const unsigned char packet[], opus_int32cxx . . $ opus_int32# len, |
| 1012 | opus_int32cxx . . $ opus_int32# Fs) |
| 1013 | { |
| 1014 | int samples; |
| 1015 | int count = opus_packet_get_nb_framescxx . . $ opus_packet_get_nb_frames(87fdc3b2e2b212a8).(packet, len); |
| 1016 | |
| 1017 | if (count<0) |
| 1018 | return count; |
| 1019 | |
| 1020 | samples = count*opus_packet_get_samples_per_framecxx . . $ opus_packet_get_samples_per_frame(87fdc3b2e2b212a8).(packet, Fs); |
| 1021 | /* Can't have more than 120 ms */ |
| 1022 | if (samples*25 > Fs*3) |
| 1023 | return OPUS_INVALID_PACKETcxx . . $ `external/opusfile/opus/opus_defines.h:54:9`!; |
| 1024 | else |
| 1025 | return samples; |
| 1026 | } |
| 1027 | |
| 1028 | int opus_decoder_get_nb_samplescxx . . $ opus_decoder_get_nb_samples(b2b31e84acb6b70e).(const OpusDecodercxx . . $ OpusDecoder# *dec, |
| 1029 | const unsigned char packet[], opus_int32cxx . . $ opus_int32# len) |
| 1030 | { |
| 1031 | return opus_packet_get_nb_samplescxx . . $ opus_packet_get_nb_samples(98fdf16c90fffe93).(packet, len, dec->Fscxx . . $ OpusDecoder#Fs.); |
| 1032 | } |