| 1 | /* Copyright (c) 2007-2008 CSIRO |
| 2 | Copyright (c) 2007-2010 Xiph.Org Foundation |
| 3 | Copyright (c) 2008 Gregory Maxwell |
| 4 | Written by Jean-Marc Valin and Gregory Maxwell */ |
| 5 | /* |
| 6 | Redistribution and use in source and binary forms, with or without |
| 7 | modification, are permitted provided that the following conditions |
| 8 | are met: |
| 9 | |
| 10 | - Redistributions of source code must retain the above copyright |
| 11 | notice, this list of conditions and the following disclaimer. |
| 12 | |
| 13 | - Redistributions in binary form must reproduce the above copyright |
| 14 | notice, this list of conditions and the following disclaimer in the |
| 15 | documentation and/or other materials provided with the distribution. |
| 16 | |
| 17 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
| 18 | ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
| 19 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
| 20 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER |
| 21 | OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, |
| 22 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, |
| 23 | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR |
| 24 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF |
| 25 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING |
| 26 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
| 27 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 28 | */ |
| 29 | |
| 30 | //#ifdef HAVE_CONFIG_H |
| 31 | #include "opus__config.h"cxx . . $ `<file>/external/opusfile/opus/opus__config.h`/ |
| 32 | //#endif |
| 33 | |
| 34 | #define CELT_DECODER_Ccxx . . $ `external/opusfile/opus/celt/celt_decoder.c:34:9`! |
| 35 | |
| 36 | #include "cpu_support.h"cxx . . $ `<file>/external/opusfile/opus/celt/cpu_support.h`/ |
| 37 | #include "os_support.h"cxx . . $ `<file>/external/opusfile/opus/celt/os_support.h`/ |
| 38 | #include "mdct.h"cxx . . $ `<file>/external/opusfile/opus/celt/mdct.h`/ |
| 39 | #include <math.h> |
| 40 | #include "celt.h"cxx . . $ `<file>/external/opusfile/opus/celt/celt.h`/ |
| 41 | #include "pitch_.h"cxx . . $ `<file>/external/opusfile/opus/celt/pitch_.h`/ |
| 42 | #include "bands.h"cxx . . $ `<file>/external/opusfile/opus/celt/bands.h`/ |
| 43 | #include "modes.h"cxx . . $ `<file>/external/opusfile/opus/celt/modes.h`/ |
| 44 | #include "entcode.h"cxx . . $ `<file>/external/opusfile/opus/celt/entcode.h`/ |
| 45 | #include "quant_bands.h"cxx . . $ `<file>/external/opusfile/opus/celt/quant_bands.h`/ |
| 46 | #include "rate.h"cxx . . $ `<file>/external/opusfile/opus/celt/rate.h`/ |
| 47 | #include "stack_alloc.h"cxx . . $ `<file>/external/opusfile/opus/celt/stack_alloc.h`/ |
| 48 | #include "mathops.h"cxx . . $ `<file>/external/opusfile/opus/celt/mathops.h`/ |
| 49 | #include "float_cast.h"cxx . . $ `<file>/external/opusfile/opus/celt/float_cast.h`/ |
| 50 | #include <stdarg.h> |
| 51 | #include "celt_lpc.h"cxx . . $ `<file>/external/opusfile/opus/celt/celt_lpc.h`/ |
| 52 | #include "vq.h"cxx . . $ `<file>/external/opusfile/opus/celt/vq.h`/ |
| 53 | |
| 54 | /* The maximum pitch lag to allow in the pitch-based PLC. It's possible to save |
| 55 | CPU time in the PLC pitch search by making this smaller than MAX_PERIOD. The |
| 56 | current value corresponds to a pitch of 66.67 Hz. */ |
| 57 | #define PLC_PITCH_LAG_MAXcxx . . $ `external/opusfile/opus/celt/celt_decoder.c:57:9`! (720) |
| 58 | /* The minimum pitch lag to allow in the pitch-based PLC. This corresponds to a |
| 59 | pitch of 480 Hz. */ |
| 60 | #define PLC_PITCH_LAG_MINcxx . . $ `external/opusfile/opus/celt/celt_decoder.c:60:9`! (100) |
| 61 | |
| 62 | #if defined(SMALL_FOOTPRINT) && defined(FIXED_POINT) |
| 63 | #define NORM_ALIASING_HACK |
| 64 | #endif |
| 65 | /**********************************************************************/ |
| 66 | /* */ |
| 67 | /* DECODER */ |
| 68 | /* */ |
| 69 | /**********************************************************************/ |
| 70 | #define DECODE_BUFFER_SIZEcxx . . $ `external/opusfile/opus/celt/celt_decoder.c:70:9`! 2048 |
| 71 | |
| 72 | /** Decoder state |
| 73 | @brief Decoder state |
| 74 | */ |
| 75 | struct OpusCustomDecodercxx . . $ OpusCustomDecoder# { |
| 76 | const OpusCustomModecxx . . $ OpusCustomMode# *modecxx . . $ OpusCustomDecoder#mode.; |
| 77 | int overlapcxx . . $ OpusCustomDecoder#overlap.; |
| 78 | int channelscxx . . $ OpusCustomDecoder#channels.; |
| 79 | int stream_channelscxx . . $ OpusCustomDecoder#stream_channels.; |
| 80 | |
| 81 | int downsamplecxx . . $ OpusCustomDecoder#downsample.; |
| 82 | int startcxx . . $ OpusCustomDecoder#start., endcxx . . $ OpusCustomDecoder#end.; |
| 83 | int signallingcxx . . $ OpusCustomDecoder#signalling.; |
| 84 | int disable_invcxx . . $ OpusCustomDecoder#disable_inv.; |
| 85 | int archcxx . . $ OpusCustomDecoder#arch.; |
| 86 | |
| 87 | /* Everything beyond this point gets cleared on a reset */ |
| 88 | #define DECODER_RESET_STARTcxx . . $ `external/opusfile/opus/celt/celt_decoder.c:88:9`! rng |
| 89 | |
| 90 | opus_uint32cxx . . $ opus_uint32# rngcxx . . $ OpusCustomDecoder#rng.; |
| 91 | int errorcxx . . $ OpusCustomDecoder#error.; |
| 92 | int last_pitch_indexcxx . . $ OpusCustomDecoder#last_pitch_index.; |
| 93 | int loss_countcxx . . $ OpusCustomDecoder#loss_count.; |
| 94 | int skip_plccxx . . $ OpusCustomDecoder#skip_plc.; |
| 95 | int postfilter_periodcxx . . $ OpusCustomDecoder#postfilter_period.; |
| 96 | int postfilter_period_oldcxx . . $ OpusCustomDecoder#postfilter_period_old.; |
| 97 | opus_val16cxx . . $ opus_val16# postfilter_gaincxx . . $ OpusCustomDecoder#postfilter_gain.; |
| 98 | opus_val16cxx . . $ opus_val16# postfilter_gain_oldcxx . . $ OpusCustomDecoder#postfilter_gain_old.; |
| 99 | int postfilter_tapsetcxx . . $ OpusCustomDecoder#postfilter_tapset.; |
| 100 | int postfilter_tapset_oldcxx . . $ OpusCustomDecoder#postfilter_tapset_old.; |
| 101 | |
| 102 | celt_sigcxx . . $ celt_sig# preemph_memDcxx . . $ OpusCustomDecoder#preemph_memD.[2]; |
| 103 | |
| 104 | celt_sigcxx . . $ celt_sig# _decode_memcxx . . $ OpusCustomDecoder#_decode_mem.[1]; /* Size = channels*(DECODE_BUFFER_SIZE+mode->overlap) */ |
| 105 | /* opus_val16 lpc[], Size = channels*LPC_ORDER */ |
| 106 | /* opus_val16 oldEBands[], Size = 2*mode->nbEBands */ |
| 107 | /* opus_val16 oldLogE[], Size = 2*mode->nbEBands */ |
| 108 | /* opus_val16 oldLogE2[], Size = 2*mode->nbEBands */ |
| 109 | /* opus_val16 backgroundLogE[], Size = 2*mode->nbEBands */ |
| 110 | }; |
| 111 | |
| 112 | #if defined(ENABLE_HARDENINGcxx . . $ `external/opusfile/opus/opus__config.h:23:9`!) || defined(ENABLE_ASSERTIONS) |
| 113 | /* Make basic checks on the CELT state to ensure we don't end |
| 114 | up writing all over memory. */ |
| 115 | void validate_celt_decodercxx . . $ validate_celt_decoder(ebfe4033180b6457).(CELTDecodercxx . . $ `external/opusfile/opus/celt/celt.h:50:9`! *st) |
| 116 | { |
| 117 | #ifndef CUSTOM_MODES |
| 118 | celt_assertcxx . . $ `external/opusfile/opus/celt/arch.h:80:9`!(st->mode == opus_custom_mode_create(48000, 960, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!)); |
| 119 | celt_assertcxx . . $ `external/opusfile/opus/celt/arch.h:80:9`!(st->overlap == 120); |
| 120 | #endif |
| 121 | celt_assertcxx . . $ `external/opusfile/opus/celt/arch.h:80:9`!(st->channels == 1 || st->channels == 2); |
| 122 | celt_assertcxx . . $ `external/opusfile/opus/celt/arch.h:80:9`!(st->stream_channels == 1 || st->stream_channels == 2); |
| 123 | celt_assertcxx . . $ `external/opusfile/opus/celt/arch.h:80:9`!(st->downsample > 0); |
| 124 | celt_assertcxx . . $ `external/opusfile/opus/celt/arch.h:80:9`!(st->start == 0 || st->start == 17); |
| 125 | celt_assertcxx . . $ `external/opusfile/opus/celt/arch.h:80:9`!(st->start < st->end); |
| 126 | celt_assertcxx . . $ `external/opusfile/opus/celt/arch.h:80:9`!(st->end <= 21); |
| 127 | #ifdef OPUS_ARCHMASKcxx . . $ `external/opusfile/opus/celt/cpu_support.h:63:9`! |
| 128 | celt_assertcxx . . $ `external/opusfile/opus/celt/arch.h:80:9`!(st->arch >= 0); |
| 129 | celt_assertcxx . . $ `external/opusfile/opus/celt/arch.h:80:9`!(st->arch <= OPUS_ARCHMASKcxx . . $ `external/opusfile/opus/celt/cpu_support.h:63:9`!); |
| 130 | #endif |
| 131 | celt_assertcxx . . $ `external/opusfile/opus/celt/arch.h:80:9`!(st->last_pitch_index <= PLC_PITCH_LAG_MAXcxx . . $ `external/opusfile/opus/celt/celt_decoder.c:57:9`!); |
| 132 | celt_assertcxx . . $ `external/opusfile/opus/celt/arch.h:80:9`!(st->last_pitch_index >= PLC_PITCH_LAG_MINcxx . . $ `external/opusfile/opus/celt/celt_decoder.c:60:9`! || st->last_pitch_index == 0); |
| 133 | celt_assertcxx . . $ `external/opusfile/opus/celt/arch.h:80:9`!(st->postfilter_period < MAX_PERIODcxx . . $ `external/opusfile/opus/celt/modes.h:40:9`!); |
| 134 | celt_assertcxx . . $ `external/opusfile/opus/celt/arch.h:80:9`!(st->postfilter_period >= COMBFILTER_MINPERIODcxx . . $ `external/opusfile/opus/celt/celt.h:208:9`! || st->postfilter_period == 0); |
| 135 | celt_assertcxx . . $ `external/opusfile/opus/celt/arch.h:80:9`!(st->postfilter_period_old < MAX_PERIODcxx . . $ `external/opusfile/opus/celt/modes.h:40:9`!); |
| 136 | celt_assertcxx . . $ `external/opusfile/opus/celt/arch.h:80:9`!(st->postfilter_period_old >= COMBFILTER_MINPERIODcxx . . $ `external/opusfile/opus/celt/celt.h:208:9`! || st->postfilter_period_old == 0); |
| 137 | celt_assertcxx . . $ `external/opusfile/opus/celt/arch.h:80:9`!(st->postfilter_tapset <= 2); |
| 138 | celt_assertcxx . . $ `external/opusfile/opus/celt/arch.h:80:9`!(st->postfilter_tapset >= 0); |
| 139 | celt_assertcxx . . $ `external/opusfile/opus/celt/arch.h:80:9`!(st->postfilter_tapset_old <= 2); |
| 140 | celt_assertcxx . . $ `external/opusfile/opus/celt/arch.h:80:9`!(st->postfilter_tapset_old >= 0); |
| 141 | } |
| 142 | #endif |
| 143 | |
| 144 | int celt_decoder_get_sizecxx . . $ celt_decoder_get_size(7864480464b09eea).(int channels) |
| 145 | { |
| 146 | const CELTModecxx . . $ `external/opusfile/opus/celt/celt.h:51:9`! *mode = opus_custom_mode_createcxx . . $ opus_custom_mode_create(8567a5e4653050c).(48000, 960, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!); |
| 147 | return opus_custom_decoder_get_sizecxx . . $ opus_custom_decoder_get_size(2a9dd9b2e455265d).(mode, channels); |
| 148 | } |
| 149 | |
| 150 | OPUS_CUSTOM_NOSTATICcxx . . $ `external/opusfile/opus/celt/celt.h:162:9`! int opus_custom_decoder_get_sizecxx . . $ opus_custom_decoder_get_size(2a9dd9b2e455265d).(const CELTModecxx . . $ `external/opusfile/opus/celt/celt.h:51:9`! *mode, int channels) |
| 151 | { |
| 152 | int size = sizeof(struct CELTDecodercxx . . $ `external/opusfile/opus/celt/celt.h:50:9`!) |
| 153 | + (channels*(DECODE_BUFFER_SIZEcxx . . $ `external/opusfile/opus/celt/celt_decoder.c:70:9`!+mode->overlapcxx . . $ OpusCustomMode#overlap.)-1)*sizeof(celt_sigcxx . . $ celt_sig#) |
| 154 | + channels*LPC_ORDERcxx . . $ `external/opusfile/opus/celt/celt_lpc.h:38:9`!*sizeof(opus_val16cxx . . $ opus_val16#) |
| 155 | + 4*2*mode->nbEBandscxx . . $ OpusCustomMode#nbEBands.*sizeof(opus_val16cxx . . $ opus_val16#); |
| 156 | return size; |
| 157 | } |
| 158 | |
| 159 | #ifdef CUSTOM_MODES |
| 160 | CELTDecoder *opus_custom_decoder_create(const CELTMode *mode, int channels, int *error) |
| 161 | { |
| 162 | int ret; |
| 163 | CELTDecoder *st = (CELTDecoder *)opus_alloc(opus_custom_decoder_get_size(mode, channels)); |
| 164 | ret = opus_custom_decoder_init(st, mode, channels); |
| 165 | if (ret != OPUS_OK) |
| 166 | { |
| 167 | opus_custom_decoder_destroy(st); |
| 168 | st = NULL; |
| 169 | } |
| 170 | if (error) |
| 171 | *error = ret; |
| 172 | return st; |
| 173 | } |
| 174 | #endif /* CUSTOM_MODES */ |
| 175 | |
| 176 | int celt_decoder_initcxx . . $ celt_decoder_init(27423e1ca630a3b0).(CELTDecodercxx . . $ `external/opusfile/opus/celt/celt.h:50:9`! *st, opus_int32cxx . . $ opus_int32# sampling_rate, int channels) |
| 177 | { |
| 178 | int ret; |
| 179 | ret = opus_custom_decoder_initcxx . . $ opus_custom_decoder_init(d8c12aa6044bd244).(st, opus_custom_mode_createcxx . . $ opus_custom_mode_create(8567a5e4653050c).(48000, 960, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!), channels); |
| 180 | if (ret != OPUS_OKcxx . . $ `external/opusfile/opus/opus_defines.h:46:9`!) |
| 181 | return ret; |
| 182 | st->downsamplecxx . . $ OpusCustomDecoder#downsample. = resampling_factorcxx . . $ resampling_factor(7864480464b09eea).(sampling_rate); |
| 183 | if (st->downsamplecxx . . $ OpusCustomDecoder#downsample.==0) |
| 184 | return OPUS_BAD_ARGcxx . . $ `external/opusfile/opus/opus_defines.h:48:9`!; |
| 185 | else |
| 186 | return OPUS_OKcxx . . $ `external/opusfile/opus/opus_defines.h:46:9`!; |
| 187 | } |
| 188 | |
| 189 | OPUS_CUSTOM_NOSTATICcxx . . $ `external/opusfile/opus/celt/celt.h:162:9`! int opus_custom_decoder_initcxx . . $ opus_custom_decoder_init(d8c12aa6044bd244).(CELTDecodercxx . . $ `external/opusfile/opus/celt/celt.h:50:9`! *st, const CELTModecxx . . $ `external/opusfile/opus/celt/celt.h:51:9`! *mode, int channels) |
| 190 | { |
| 191 | if (channels < 0 || channels > 2) |
| 192 | return OPUS_BAD_ARGcxx . . $ `external/opusfile/opus/opus_defines.h:48:9`!; |
| 193 | |
| 194 | if (st==NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) |
| 195 | return OPUS_ALLOC_FAILcxx . . $ `external/opusfile/opus/opus_defines.h:60:9`!; |
| 196 | |
| 197 | OPUS_CLEARcxx . . $ `external/opusfile/opus/celt/os_support.h:83:9`!((char*)st, opus_custom_decoder_get_size(mode, channels)); |
| 198 | |
| 199 | st->modecxx . . $ OpusCustomDecoder#mode. = mode; |
| 200 | st->overlapcxx . . $ OpusCustomDecoder#overlap. = mode->overlapcxx . . $ OpusCustomMode#overlap.; |
| 201 | st->stream_channelscxx . . $ OpusCustomDecoder#stream_channels. = st->channelscxx . . $ OpusCustomDecoder#channels. = channels; |
| 202 | |
| 203 | st->downsamplecxx . . $ OpusCustomDecoder#downsample. = 1; |
| 204 | st->startcxx . . $ OpusCustomDecoder#start. = 0; |
| 205 | st->endcxx . . $ OpusCustomDecoder#end. = st->modecxx . . $ OpusCustomDecoder#mode.->effEBandscxx . . $ OpusCustomMode#effEBands.; |
| 206 | st->signallingcxx . . $ OpusCustomDecoder#signalling. = 1; |
| 207 | #ifndef DISABLE_UPDATE_DRAFT |
| 208 | st->disable_invcxx . . $ OpusCustomDecoder#disable_inv. = channels == 1; |
| 209 | #else |
| 210 | st->disable_inv = 0; |
| 211 | #endif |
| 212 | st->archcxx . . $ OpusCustomDecoder#arch. = opus_select_archcxx . . $ opus_select_arch(b126dc7c1de90089).(); |
| 213 | |
| 214 | opus_custom_decoder_ctlcxx . . $ opus_custom_decoder_ctl(5306c2cb32f0ab07).(st, OPUS_RESET_STATEcxx . . $ `external/opusfile/opus/opus_defines.h:662:9`!); |
| 215 | |
| 216 | return OPUS_OKcxx . . $ `external/opusfile/opus/opus_defines.h:46:9`!; |
| 217 | } |
| 218 | |
| 219 | #ifdef CUSTOM_MODES |
| 220 | void opus_custom_decoder_destroy(CELTDecoder *st) |
| 221 | { |
| 222 | opus_free(st); |
| 223 | } |
| 224 | #endif /* CUSTOM_MODES */ |
| 225 | |
| 226 | #ifndef CUSTOM_MODES |
| 227 | /* Special case for stereo with no downsampling and no accumulation. This is |
| 228 | quite common and we can make it faster by processing both channels in the |
| 229 | same loop, reducing overhead due to the dependency loop in the IIR filter. */ |
| 230 | static void deemphasis_stereo_simplecxx . . $ deemphasis_stereo_simple(9c3c5e3076b242b).(celt_sigcxx . . $ celt_sig# *in[], opus_val16cxx . . $ opus_val16# *pcm, int N, const opus_val16cxx . . $ opus_val16# coef0, |
| 231 | celt_sigcxx . . $ celt_sig# *mem) |
| 232 | { |
| 233 | celt_sigcxx . . $ celt_sig# * OPUS_RESTRICTcxx . . $ `external/opusfile/opus/opus_defines.h:98:10`! x0; |
| 234 | celt_sigcxx . . $ celt_sig# * OPUS_RESTRICTcxx . . $ `external/opusfile/opus/opus_defines.h:98:10`! x1; |
| 235 | celt_sigcxx . . $ celt_sig# m0, m1; |
| 236 | int j; |
| 237 | x0=in[0]; |
| 238 | x1=in[1]; |
| 239 | m0 = mem[0]; |
| 240 | m1 = mem[1]; |
| 241 | for (j=0;j<N;j++) |
| 242 | { |
| 243 | celt_sigcxx . . $ celt_sig# tmp0, tmp1; |
| 244 | /* Add VERY_SMALL to x[] first to reduce dependency chain. */ |
| 245 | tmp0 = x0[j] + VERY_SMALLcxx . . $ `external/opusfile/opus/celt/arch.h:208:9`! + m0; |
| 246 | tmp1 = x1[j] + VERY_SMALLcxx . . $ `external/opusfile/opus/celt/arch.h:208:9`! + m1; |
| 247 | m0 = MULT16_32_Q15cxx . . $ `external/opusfile/opus/celt/arch.h:252:9`!(coef0, tmp0); |
| 248 | m1 = MULT16_32_Q15cxx . . $ `external/opusfile/opus/celt/arch.h:252:9`!(coef0, tmp1); |
| 249 | pcm[2*j ] = SCALEOUTcxx . . $ `external/opusfile/opus/celt/arch.h:274:9`!(SIG2WORD16cxx . . $ `external/opusfile/opus/celt/arch.h:276:9`!(tmp0)); |
| 250 | pcm[2*j+1] = SCALEOUTcxx . . $ `external/opusfile/opus/celt/arch.h:274:9`!(SIG2WORD16cxx . . $ `external/opusfile/opus/celt/arch.h:276:9`!(tmp1)); |
| 251 | } |
| 252 | mem[0] = m0; |
| 253 | mem[1] = m1; |
| 254 | } |
| 255 | #endif |
| 256 | |
| 257 | #ifndef RESYNTH |
| 258 | static |
| 259 | #endif |
| 260 | void deemphasiscxx . . $ deemphasis(a345f717e8dd8419).(celt_sigcxx . . $ celt_sig# *in[], opus_val16cxx . . $ opus_val16# *pcm, int N, int C, int downsample, const opus_val16cxx . . $ opus_val16# *coef, |
| 261 | celt_sigcxx . . $ celt_sig# *mem, int accum) |
| 262 | { |
| 263 | int c; |
| 264 | int Nd; |
| 265 | int apply_downsampling=0; |
| 266 | opus_val16cxx . . $ opus_val16# coef0; |
| 267 | VARDECLcxx . . $ `external/opusfile/opus/celt/stack_alloc.h:94:9`!(celt_sig, scratch); |
| 268 | SAVE_STACKcxx . . $ `external/opusfile/opus/celt/stack_alloc.h:96:9`!; |
| 269 | #ifndef CUSTOM_MODES |
| 270 | /* Short version for common case. */ |
| 271 | if (downsample == 1 && C == 2 && !accum) |
| 272 | { |
| 273 | deemphasis_stereo_simplecxx . . $ deemphasis_stereo_simple(9c3c5e3076b242b).(in, pcm, N, coef[0], mem); |
| 274 | return; |
| 275 | } |
| 276 | #endif |
| 277 | #ifndef FIXED_POINT |
| 278 | (void)accum; |
| 279 | celt_assertcxx . . $ `external/opusfile/opus/celt/arch.h:80:9`!(accum==0); |
| 280 | #endif |
| 281 | ALLOCcxx . . $ `external/opusfile/opus/celt/stack_alloc.h:95:9`!(scratch, N, celt_sig); |
| 282 | coef0 = coef[0]; |
| 283 | Nd = N/downsample; |
| 284 | c=0; do { |
| 285 | int j; |
| 286 | celt_sigcxx . . $ celt_sig# * OPUS_RESTRICTcxx . . $ `external/opusfile/opus/opus_defines.h:98:10`! x; |
| 287 | opus_val16cxx . . $ opus_val16# * OPUS_RESTRICTcxx . . $ `external/opusfile/opus/opus_defines.h:98:10`! y; |
| 288 | celt_sigcxx . . $ celt_sig# m = mem[c]; |
| 289 | x =in[c]; |
| 290 | y = pcm+c; |
| 291 | #ifdef CUSTOM_MODES |
| 292 | if (coef[1] != 0) |
| 293 | { |
| 294 | opus_val16 coef1 = coef[1]; |
| 295 | opus_val16 coef3 = coef[3]; |
| 296 | for (j=0;j<N;j++) |
| 297 | { |
| 298 | celt_sig tmp = x[j] + m + VERY_SMALL; |
| 299 | m = MULT16_32_Q15(coef0, tmp) |
| 300 | - MULT16_32_Q15(coef1, x[j]); |
| 301 | tmp = SHL32(MULT16_32_Q15(coef3, tmp), 2); |
| 302 | scratch[j] = tmp; |
| 303 | } |
| 304 | apply_downsampling=1; |
| 305 | } else |
| 306 | #endif |
| 307 | if (downsample>1) |
| 308 | { |
| 309 | /* Shortcut for the standard (non-custom modes) case */ |
| 310 | for (j=0;j<N;j++) |
| 311 | { |
| 312 | celt_sigcxx . . $ celt_sig# tmp = x[j] + VERY_SMALLcxx . . $ `external/opusfile/opus/celt/arch.h:208:9`! + m; |
| 313 | m = MULT16_32_Q15cxx . . $ `external/opusfile/opus/celt/arch.h:252:9`!(coef0, tmp); |
| 314 | scratch[j] = tmp; |
| 315 | } |
| 316 | apply_downsampling=1; |
| 317 | } else { |
| 318 | /* Shortcut for the standard (non-custom modes) case */ |
| 319 | #ifdef FIXED_POINT |
| 320 | if (accum) |
| 321 | { |
| 322 | for (j=0;j<N;j++) |
| 323 | { |
| 324 | celt_sig tmp = x[j] + m + VERY_SMALL; |
| 325 | m = MULT16_32_Q15(coef0, tmp); |
| 326 | y[j*C] = SAT16(ADD32(y[j*C], SCALEOUT(SIG2WORD16(tmp)))); |
| 327 | } |
| 328 | } else |
| 329 | #endif |
| 330 | { |
| 331 | for (j=0;j<N;j++) |
| 332 | { |
| 333 | celt_sigcxx . . $ celt_sig# tmp = x[j] + VERY_SMALLcxx . . $ `external/opusfile/opus/celt/arch.h:208:9`! + m; |
| 334 | m = MULT16_32_Q15cxx . . $ `external/opusfile/opus/celt/arch.h:252:9`!(coef0, tmp); |
| 335 | y[j*C] = SCALEOUTcxx . . $ `external/opusfile/opus/celt/arch.h:274:9`!(SIG2WORD16cxx . . $ `external/opusfile/opus/celt/arch.h:276:9`!(tmp)); |
| 336 | } |
| 337 | } |
| 338 | } |
| 339 | mem[c] = m; |
| 340 | |
| 341 | if (apply_downsampling) |
| 342 | { |
| 343 | /* Perform down-sampling */ |
| 344 | #ifdef FIXED_POINT |
| 345 | if (accum) |
| 346 | { |
| 347 | for (j=0;j<Nd;j++) |
| 348 | y[j*C] = SAT16(ADD32(y[j*C], SCALEOUT(SIG2WORD16(scratch[j*downsample])))); |
| 349 | } else |
| 350 | #endif |
| 351 | { |
| 352 | for (j=0;j<Nd;j++) |
| 353 | y[j*C] = SCALEOUTcxx . . $ `external/opusfile/opus/celt/arch.h:274:9`!(SIG2WORD16cxx . . $ `external/opusfile/opus/celt/arch.h:276:9`!(scratch[j*downsample])); |
| 354 | } |
| 355 | } |
| 356 | } while (++c<C); |
| 357 | RESTORE_STACKcxx . . $ `external/opusfile/opus/celt/stack_alloc.h:97:9`!; |
| 358 | } |
| 359 | |
| 360 | #ifndef RESYNTH |
| 361 | static |
| 362 | #endif |
| 363 | void celt_synthesiscxx . . $ celt_synthesis(41b2e8ebd1822e46).(const CELTModecxx . . $ `external/opusfile/opus/celt/celt.h:51:9`! *mode, celt_normcxx . . $ celt_norm# *X, celt_sigcxx . . $ celt_sig# * out_syn[], |
| 364 | opus_val16cxx . . $ opus_val16# *oldBandE, int start, int effEnd, int C, int CC, |
| 365 | int isTransient, int LM, int downsample, |
| 366 | int silence, int arch) |
| 367 | { |
| 368 | int c, i; |
| 369 | int M; |
| 370 | int b; |
| 371 | int B; |
| 372 | int N, NB; |
| 373 | int shift; |
| 374 | int nbEBands; |
| 375 | int overlap; |
| 376 | VARDECLcxx . . $ `external/opusfile/opus/celt/stack_alloc.h:94:9`!(celt_sig, freq); |
| 377 | SAVE_STACKcxx . . $ `external/opusfile/opus/celt/stack_alloc.h:96:9`!; |
| 378 | |
| 379 | overlap = mode->overlapcxx . . $ OpusCustomMode#overlap.; |
| 380 | nbEBands = mode->nbEBandscxx . . $ OpusCustomMode#nbEBands.; |
| 381 | N = mode->shortMdctSizecxx . . $ OpusCustomMode#shortMdctSize.<<LM; |
| 382 | ALLOCcxx . . $ `external/opusfile/opus/celt/stack_alloc.h:95:9`!(freq, N, celt_sig); /**< Interleaved signal MDCTs */ |
| 383 | M = 1<<LM; |
| 384 | |
| 385 | if (isTransient) |
| 386 | { |
| 387 | B = M; |
| 388 | NB = mode->shortMdctSizecxx . . $ OpusCustomMode#shortMdctSize.; |
| 389 | shift = mode->maxLMcxx . . $ OpusCustomMode#maxLM.; |
| 390 | } else { |
| 391 | B = 1; |
| 392 | NB = mode->shortMdctSizecxx . . $ OpusCustomMode#shortMdctSize.<<LM; |
| 393 | shift = mode->maxLMcxx . . $ OpusCustomMode#maxLM.-LM; |
| 394 | } |
| 395 | |
| 396 | if (CC==2&&C==1) |
| 397 | { |
| 398 | /* Copying a mono streams to two channels */ |
| 399 | celt_sigcxx . . $ celt_sig# *freq2; |
| 400 | denormalise_bandscxx . . $ denormalise_bands(643eeed255753992).(mode, X, freq, oldBandE, start, effEnd, M, |
| 401 | downsample, silence); |
| 402 | /* Store a temporary copy in the output buffer because the IMDCT destroys its input. */ |
| 403 | freq2 = out_syn[1]+overlap/2; |
| 404 | OPUS_COPYcxx . . $ `external/opusfile/opus/celt/os_support.h:72:9`!(freq2, freq, N); |
| 405 | for (b=0;b<B;b++) |
| 406 | clt_mdct_backwardcxx . . $ `external/opusfile/opus/celt/mdct.h:106:9`!(&mode->mdct, &freq2[b], out_syn[0]+NB*b, mode->window, overlap, shift, B, arch); |
| 407 | for (b=0;b<B;b++) |
| 408 | clt_mdct_backwardcxx . . $ `external/opusfile/opus/celt/mdct.h:106:9`!(&mode->mdct, &freq[b], out_syn[1]+NB*b, mode->window, overlap, shift, B, arch); |
| 409 | } else if (CC==1&&C==2) |
| 410 | { |
| 411 | /* Downmixing a stereo stream to mono */ |
| 412 | celt_sigcxx . . $ celt_sig# *freq2; |
| 413 | freq2 = out_syn[0]+overlap/2; |
| 414 | denormalise_bandscxx . . $ denormalise_bands(643eeed255753992).(mode, X, freq, oldBandE, start, effEnd, M, |
| 415 | downsample, silence); |
| 416 | /* Use the output buffer as temp array before downmixing. */ |
| 417 | denormalise_bandscxx . . $ denormalise_bands(643eeed255753992).(mode, X+N, freq2, oldBandE+nbEBands, start, effEnd, M, |
| 418 | downsample, silence); |
| 419 | for (i=0;i<N;i++) |
| 420 | freq[i] = ADD32cxx . . $ `external/opusfile/opus/celt/arch.h:244:9`!(HALF32cxx . . $ `external/opusfile/opus/celt/arch.h:240:9`!(freq[i]), HALF32cxx . . $ `external/opusfile/opus/celt/arch.h:240:9`!(freq2[i])); |
| 421 | for (b=0;b<B;b++) |
| 422 | clt_mdct_backwardcxx . . $ `external/opusfile/opus/celt/mdct.h:106:9`!(&mode->mdct, &freq[b], out_syn[0]+NB*b, mode->window, overlap, shift, B, arch); |
| 423 | } else { |
| 424 | /* Normal case (mono or stereo) */ |
| 425 | c=0; do { |
| 426 | denormalise_bandscxx . . $ denormalise_bands(643eeed255753992).(mode, X+c*N, freq, oldBandE+c*nbEBands, start, effEnd, M, |
| 427 | downsample, silence); |
| 428 | for (b=0;b<B;b++) |
| 429 | clt_mdct_backwardcxx . . $ `external/opusfile/opus/celt/mdct.h:106:9`!(&mode->mdct, &freq[b], out_syn[c]+NB*b, mode->window, overlap, shift, B, arch); |
| 430 | } while (++c<CC); |
| 431 | } |
| 432 | /* Saturate IMDCT output so that we can't overflow in the pitch postfilter |
| 433 | or in the */ |
| 434 | c=0; do { |
| 435 | for (i=0;i<N;i++) |
| 436 | out_syn[c][i] = SATURATEcxx . . $ `external/opusfile/opus/celt/arch.h:234:9`!(out_syn[c][i], SIG_SAT); |
| 437 | } while (++c<CC); |
| 438 | RESTORE_STACKcxx . . $ `external/opusfile/opus/celt/stack_alloc.h:97:9`!; |
| 439 | } |
| 440 | |
| 441 | static void tf_decodecxx . . $ tf_decode(5054dde3046e6a6f).(int start, int end, int isTransient, int *tf_res, int LM, ec_deccxx . . $ ec_dec# *dec) |
| 442 | { |
| 443 | int i, curr, tf_select; |
| 444 | int tf_select_rsv; |
| 445 | int tf_changed; |
| 446 | int logp; |
| 447 | opus_uint32cxx . . $ opus_uint32# budget; |
| 448 | opus_uint32cxx . . $ opus_uint32# tell; |
| 449 | |
| 450 | budget = dec->storagecxx . . $ ec_ctx#storage.*8; |
| 451 | tell = ec_tellcxx . . $ ec_tell(d262775a7bafb6a0).(dec); |
| 452 | logp = isTransient ? 2 : 4; |
| 453 | tf_select_rsv = LM>0 && tell+logp+1<=budget; |
| 454 | budget -= tf_select_rsv; |
| 455 | tf_changed = curr = 0; |
| 456 | for (i=start;i<end;i++) |
| 457 | { |
| 458 | if (tell+logp<=budget) |
| 459 | { |
| 460 | curr ^= ec_dec_bit_logpcxx . . $ ec_dec_bit_logp(fb67670de84eabc5).(dec, logp); |
| 461 | tell = ec_tellcxx . . $ ec_tell(d262775a7bafb6a0).(dec); |
| 462 | tf_changed |= curr; |
| 463 | } |
| 464 | tf_res[i] = curr; |
| 465 | logp = isTransient ? 4 : 5; |
| 466 | } |
| 467 | tf_select = 0; |
| 468 | if (tf_select_rsv && |
| 469 | tf_select_tablecxx . . $ tf_select_table.[LM][4*isTransient+0+tf_changed] != |
| 470 | tf_select_tablecxx . . $ tf_select_table.[LM][4*isTransient+2+tf_changed]) |
| 471 | { |
| 472 | tf_select = ec_dec_bit_logpcxx . . $ ec_dec_bit_logp(fb67670de84eabc5).(dec, 1); |
| 473 | } |
| 474 | for (i=start;i<end;i++) |
| 475 | { |
| 476 | tf_res[i] = tf_select_tablecxx . . $ tf_select_table.[LM][4*isTransient+2*tf_select+tf_res[i]]; |
| 477 | } |
| 478 | } |
| 479 | |
| 480 | static int celt_plc_pitch_searchcxx . . $ celt_plc_pitch_search(2d460ec42bf804e0).(celt_sigcxx . . $ celt_sig# *decode_mem[2], int C, int arch) |
| 481 | { |
| 482 | int pitch_index; |
| 483 | VARDECLcxx . . $ `external/opusfile/opus/celt/stack_alloc.h:94:9`!( opus_val16, lp_pitch_buf ); |
| 484 | SAVE_STACKcxx . . $ `external/opusfile/opus/celt/stack_alloc.h:96:9`!; |
| 485 | ALLOCcxx . . $ `external/opusfile/opus/celt/stack_alloc.h:95:9`!( lp_pitch_buf, DECODE_BUFFER_SIZEcxx . . $ `external/opusfile/opus/celt/celt_decoder.c:70:9`!>>1, opus_val16 ); |
| 486 | pitch_downsamplecxx . . $ pitch_downsample(a7c987759ed92094).(decode_mem, lp_pitch_buf, |
| 487 | DECODE_BUFFER_SIZEcxx . . $ `external/opusfile/opus/celt/celt_decoder.c:70:9`!, C, arch); |
| 488 | pitch_searchcxx . . $ pitch_search(f8fb282612242fa0).(lp_pitch_buf+(PLC_PITCH_LAG_MAXcxx . . $ `external/opusfile/opus/celt/celt_decoder.c:57:9`!>>1), lp_pitch_buf, |
| 489 | DECODE_BUFFER_SIZEcxx . . $ `external/opusfile/opus/celt/celt_decoder.c:70:9`!-PLC_PITCH_LAG_MAXcxx . . $ `external/opusfile/opus/celt/celt_decoder.c:57:9`!, |
| 490 | PLC_PITCH_LAG_MAXcxx . . $ `external/opusfile/opus/celt/celt_decoder.c:57:9`!-PLC_PITCH_LAG_MINcxx . . $ `external/opusfile/opus/celt/celt_decoder.c:60:9`!, &pitch_index, arch); |
| 491 | pitch_index = PLC_PITCH_LAG_MAXcxx . . $ `external/opusfile/opus/celt/celt_decoder.c:57:9`!-pitch_index; |
| 492 | RESTORE_STACKcxx . . $ `external/opusfile/opus/celt/stack_alloc.h:97:9`!; |
| 493 | return pitch_index; |
| 494 | } |
| 495 | |
| 496 | static void celt_decode_lostcxx . . $ celt_decode_lost(c1e7a401c3d100d4).(CELTDecodercxx . . $ `external/opusfile/opus/celt/celt.h:50:9`! * OPUS_RESTRICTcxx . . $ `external/opusfile/opus/opus_defines.h:98:10`! st, int N, int LM) |
| 497 | { |
| 498 | int c; |
| 499 | int i; |
| 500 | const int C = st->channelscxx . . $ OpusCustomDecoder#channels.; |
| 501 | celt_sigcxx . . $ celt_sig# *decode_mem[2]; |
| 502 | celt_sigcxx . . $ celt_sig# *out_syn[2]; |
| 503 | opus_val16cxx . . $ opus_val16# *lpc; |
| 504 | opus_val16cxx . . $ opus_val16# *oldBandE, *oldLogE, *oldLogE2, *backgroundLogE; |
| 505 | const OpusCustomModecxx . . $ OpusCustomMode# *mode; |
| 506 | int nbEBands; |
| 507 | int overlap; |
| 508 | int start; |
| 509 | int loss_count; |
| 510 | int noise_based; |
| 511 | const opus_int16cxx . . $ opus_int16# *eBands; |
| 512 | SAVE_STACKcxx . . $ `external/opusfile/opus/celt/stack_alloc.h:96:9`!; |
| 513 | |
| 514 | mode = st->modecxx . . $ OpusCustomDecoder#mode.; |
| 515 | nbEBands = mode->nbEBandscxx . . $ OpusCustomMode#nbEBands.; |
| 516 | overlap = mode->overlapcxx . . $ OpusCustomMode#overlap.; |
| 517 | eBands = mode->eBandscxx . . $ OpusCustomMode#eBands.; |
| 518 | |
| 519 | c=0; do { |
| 520 | decode_mem[c] = st->_decode_memcxx . . $ OpusCustomDecoder#_decode_mem. + c*(DECODE_BUFFER_SIZEcxx . . $ `external/opusfile/opus/celt/celt_decoder.c:70:9`!+overlap); |
| 521 | out_syn[c] = decode_mem[c]+DECODE_BUFFER_SIZEcxx . . $ `external/opusfile/opus/celt/celt_decoder.c:70:9`!-N; |
| 522 | } while (++c<C); |
| 523 | lpc = (opus_val16cxx . . $ opus_val16#*)(st->_decode_memcxx . . $ OpusCustomDecoder#_decode_mem.+(DECODE_BUFFER_SIZEcxx . . $ `external/opusfile/opus/celt/celt_decoder.c:70:9`!+overlap)*C); |
| 524 | oldBandE = lpc+C*LPC_ORDERcxx . . $ `external/opusfile/opus/celt/celt_lpc.h:38:9`!; |
| 525 | oldLogE = oldBandE + 2*nbEBands; |
| 526 | oldLogE2 = oldLogE + 2*nbEBands; |
| 527 | backgroundLogE = oldLogE2 + 2*nbEBands; |
| 528 | |
| 529 | loss_count = st->loss_countcxx . . $ OpusCustomDecoder#loss_count.; |
| 530 | start = st->startcxx . . $ OpusCustomDecoder#start.; |
| 531 | noise_based = loss_count >= 5 || start != 0 || st->skip_plccxx . . $ OpusCustomDecoder#skip_plc.; |
| 532 | if (noise_based) |
| 533 | { |
| 534 | /* Noise-based PLC/CNG */ |
| 535 | #ifdef NORM_ALIASING_HACK |
| 536 | celt_norm *X; |
| 537 | #else |
| 538 | VARDECLcxx . . $ `external/opusfile/opus/celt/stack_alloc.h:94:9`!(celt_norm, X); |
| 539 | #endif |
| 540 | opus_uint32cxx . . $ opus_uint32# seed; |
| 541 | int end; |
| 542 | int effEnd; |
| 543 | opus_val16cxx . . $ opus_val16# decay; |
| 544 | end = st->endcxx . . $ OpusCustomDecoder#end.; |
| 545 | effEnd = IMAXcxx . . $ `external/opusfile/opus/celt/arch.h:102:9`!(start, IMINcxx . . $ `external/opusfile/opus/celt/arch.h:101:9`!(end, mode->effEBands)); |
| 546 | |
| 547 | #ifdef NORM_ALIASING_HACK |
| 548 | /* This is an ugly hack that breaks aliasing rules and would be easily broken, |
| 549 | but it saves almost 4kB of stack. */ |
| 550 | X = (celt_norm*)(out_syn[C-1]+overlap/2); |
| 551 | #else |
| 552 | ALLOCcxx . . $ `external/opusfile/opus/celt/stack_alloc.h:95:9`!(X, C*N, celt_norm); /**< Interleaved normalised MDCTs */ |
| 553 | #endif |
| 554 | |
| 555 | /* Energy decay */ |
| 556 | decay = loss_count==0 ? QCONST16cxx . . $ `external/opusfile/opus/celt/arch.h:216:9`!(1.5f, DB_SHIFT) : QCONST16cxx . . $ `external/opusfile/opus/celt/arch.h:216:9`!(.5f, DB_SHIFT); |
| 557 | c=0; do |
| 558 | { |
| 559 | for (i=start;i<end;i++) |
| 560 | oldBandE[c*nbEBands+i] = MAX16cxx . . $ `external/opusfile/opus/celt/arch.h:98:9`!(backgroundLogE[c*nbEBands+i], oldBandE[c*nbEBands+i] - decay); |
| 561 | } while (++c<C); |
| 562 | seed = st->rngcxx . . $ OpusCustomDecoder#rng.; |
| 563 | for (c=0;c<C;c++) |
| 564 | { |
| 565 | for (i=start;i<effEnd;i++) |
| 566 | { |
| 567 | int j; |
| 568 | int boffs; |
| 569 | int blen; |
| 570 | boffs = N*c+(eBands[i]<<LM); |
| 571 | blen = (eBands[i+1]-eBands[i])<<LM; |
| 572 | for (j=0;j<blen;j++) |
| 573 | { |
| 574 | seed = celt_lcg_randcxx . . $ celt_lcg_rand(2141b656ce2cc063).(seed); |
| 575 | X[boffs+j] = (celt_normcxx . . $ celt_norm#)((opus_int32cxx . . $ opus_int32#)seed>>20); |
| 576 | } |
| 577 | renormalise_vectorcxx . . $ renormalise_vector(dd5ad41dfc502241).(X+boffs, blen, Q15ONEcxx . . $ `external/opusfile/opus/celt/arch.h:203:9`!, st->archcxx . . $ OpusCustomDecoder#arch.); |
| 578 | } |
| 579 | } |
| 580 | st->rngcxx . . $ OpusCustomDecoder#rng. = seed; |
| 581 | |
| 582 | c=0; do { |
| 583 | OPUS_MOVEcxx . . $ `external/opusfile/opus/celt/os_support.h:78:9`!(decode_mem[c], decode_mem[c]+N, |
| 584 | DECODE_BUFFER_SIZEcxx . . $ `external/opusfile/opus/celt/celt_decoder.c:70:9`!-N+(overlap>>1)); |
| 585 | } while (++c<C); |
| 586 | |
| 587 | celt_synthesiscxx . . $ celt_synthesis(41b2e8ebd1822e46).(mode, X, out_syn, oldBandE, start, effEnd, C, C, 0, LM, st->downsamplecxx . . $ OpusCustomDecoder#downsample., 0, st->archcxx . . $ OpusCustomDecoder#arch.); |
| 588 | } else { |
| 589 | int exc_length; |
| 590 | /* Pitch-based PLC */ |
| 591 | const opus_val16cxx . . $ opus_val16# *window; |
| 592 | opus_val16cxx . . $ opus_val16# *exc; |
| 593 | opus_val16cxx . . $ opus_val16# fade = Q15ONEcxx . . $ `external/opusfile/opus/celt/arch.h:203:9`!; |
| 594 | int pitch_index; |
| 595 | VARDECLcxx . . $ `external/opusfile/opus/celt/stack_alloc.h:94:9`!(opus_val32, etmp); |
| 596 | VARDECLcxx . . $ `external/opusfile/opus/celt/stack_alloc.h:94:9`!(opus_val16, _exc); |
| 597 | VARDECLcxx . . $ `external/opusfile/opus/celt/stack_alloc.h:94:9`!(opus_val16, fir_tmp); |
| 598 | |
| 599 | if (loss_count == 0) |
| 600 | { |
| 601 | st->last_pitch_indexcxx . . $ OpusCustomDecoder#last_pitch_index. = pitch_index = celt_plc_pitch_searchcxx . . $ celt_plc_pitch_search(2d460ec42bf804e0).(decode_mem, C, st->archcxx . . $ OpusCustomDecoder#arch.); |
| 602 | } else { |
| 603 | pitch_index = st->last_pitch_indexcxx . . $ OpusCustomDecoder#last_pitch_index.; |
| 604 | fade = QCONST16cxx . . $ `external/opusfile/opus/celt/arch.h:216:9`!(.8f,15); |
| 605 | } |
| 606 | |
| 607 | /* We want the excitation for 2 pitch periods in order to look for a |
| 608 | decaying signal, but we can't get more than MAX_PERIOD. */ |
| 609 | exc_length = IMINcxx . . $ `external/opusfile/opus/celt/arch.h:101:9`!(2*pitch_index, MAX_PERIODcxx . . $ `external/opusfile/opus/celt/modes.h:40:9`!); |
| 610 | |
| 611 | ALLOCcxx . . $ `external/opusfile/opus/celt/stack_alloc.h:95:9`!(etmp, overlap, opus_val32); |
| 612 | ALLOCcxx . . $ `external/opusfile/opus/celt/stack_alloc.h:95:9`!(_exc, MAX_PERIODcxx . . $ `external/opusfile/opus/celt/modes.h:40:9`!+LPC_ORDERcxx . . $ `external/opusfile/opus/celt/celt_lpc.h:38:9`!, opus_val16); |
| 613 | ALLOCcxx . . $ `external/opusfile/opus/celt/stack_alloc.h:95:9`!(fir_tmp, exc_length, opus_val16); |
| 614 | exc = _exc+LPC_ORDERcxx . . $ `external/opusfile/opus/celt/celt_lpc.h:38:9`!; |
| 615 | window = mode->windowcxx . . $ OpusCustomMode#window.; |
| 616 | c=0; do { |
| 617 | opus_val16cxx . . $ opus_val16# decay; |
| 618 | opus_val16cxx . . $ opus_val16# attenuation; |
| 619 | opus_val32cxx . . $ opus_val32# S1=0; |
| 620 | celt_sigcxx . . $ celt_sig# *buf; |
| 621 | int extrapolation_offset; |
| 622 | int extrapolation_len; |
| 623 | int j; |
| 624 | |
| 625 | buf = decode_mem[c]; |
| 626 | for (i=0;i<MAX_PERIODcxx . . $ `external/opusfile/opus/celt/modes.h:40:9`!+LPC_ORDERcxx . . $ `external/opusfile/opus/celt/celt_lpc.h:38:9`!;i++) |
| 627 | exc[i-LPC_ORDERcxx . . $ `external/opusfile/opus/celt/celt_lpc.h:38:9`!] = ROUND16cxx . . $ `external/opusfile/opus/celt/arch.h:237:9`!(buf[DECODE_BUFFER_SIZEcxx . . $ `external/opusfile/opus/celt/celt_decoder.c:70:9`!-MAX_PERIODcxx . . $ `external/opusfile/opus/celt/modes.h:40:9`!-LPC_ORDERcxx . . $ `external/opusfile/opus/celt/celt_lpc.h:38:9`!+i], SIG_SHIFT); |
| 628 | |
| 629 | if (loss_count == 0) |
| 630 | { |
| 631 | opus_val32cxx . . $ opus_val32# ac[LPC_ORDERcxx . . $ `external/opusfile/opus/celt/celt_lpc.h:38:9`!+1]; |
| 632 | /* Compute LPC coefficients for the last MAX_PERIOD samples before |
| 633 | the first loss so we can work in the excitation-filter domain. */ |
| 634 | _celt_autocorrcxx . . $ _celt_autocorr(dbfb84a18cfdfdee).(exc, ac, window, overlap, |
| 635 | LPC_ORDERcxx . . $ `external/opusfile/opus/celt/celt_lpc.h:38:9`!, MAX_PERIODcxx . . $ `external/opusfile/opus/celt/modes.h:40:9`!, st->archcxx . . $ OpusCustomDecoder#arch.); |
| 636 | /* Add a noise floor of -40 dB. */ |
| 637 | #ifdef FIXED_POINT |
| 638 | ac[0] += SHR32(ac[0],13); |
| 639 | #else |
| 640 | ac[0] *= 1.0001f; |
| 641 | #endif |
| 642 | /* Use lag windowing to stabilize the Levinson-Durbin recursion. */ |
| 643 | for (i=1;i<=LPC_ORDERcxx . . $ `external/opusfile/opus/celt/celt_lpc.h:38:9`!;i++) |
| 644 | { |
| 645 | /*ac[i] *= exp(-.5*(2*M_PI*.002*i)*(2*M_PI*.002*i));*/ |
| 646 | #ifdef FIXED_POINT |
| 647 | ac[i] -= MULT16_32_Q15(2*i*i, ac[i]); |
| 648 | #else |
| 649 | ac[i] -= ac[i]*(0.008f*0.008f)*i*i; |
| 650 | #endif |
| 651 | } |
| 652 | _celt_lpccxx . . $ _celt_lpc(8e5bb7dd50cd87b6).(lpc+c*LPC_ORDERcxx . . $ `external/opusfile/opus/celt/celt_lpc.h:38:9`!, ac, LPC_ORDERcxx . . $ `external/opusfile/opus/celt/celt_lpc.h:38:9`!); |
| 653 | #ifdef FIXED_POINT |
| 654 | /* For fixed-point, apply bandwidth expansion until we can guarantee that |
| 655 | no overflow can happen in the IIR filter. This means: |
| 656 | 32768*sum(abs(filter)) < 2^31 */ |
| 657 | while (1) { |
| 658 | opus_val16 tmp=Q15ONE; |
| 659 | opus_val32 sum=QCONST16(1., SIG_SHIFT); |
| 660 | for (i=0;i<LPC_ORDER;i++) |
| 661 | sum += ABS16(lpc[c*LPC_ORDER+i]); |
| 662 | if (sum < 65535) break; |
| 663 | for (i=0;i<LPC_ORDER;i++) |
| 664 | { |
| 665 | tmp = MULT16_16_Q15(QCONST16(.99f,15), tmp); |
| 666 | lpc[c*LPC_ORDER+i] = MULT16_16_Q15(lpc[c*LPC_ORDER+i], tmp); |
| 667 | } |
| 668 | } |
| 669 | #endif |
| 670 | } |
| 671 | /* Initialize the LPC history with the samples just before the start |
| 672 | of the region for which we're computing the excitation. */ |
| 673 | { |
| 674 | /* Compute the excitation for exc_length samples before the loss. We need the copy |
| 675 | because celt_fir() cannot filter in-place. */ |
| 676 | celt_fircxx . . $ `external/opusfile/opus/celt/celt_lpc.h:51:9`!(exc+MAX_PERIODcxx . . $ `external/opusfile/opus/celt/modes.h:40:9`!-exc_length, lpc+c*LPC_ORDERcxx . . $ `external/opusfile/opus/celt/celt_lpc.h:38:9`!, |
| 677 | fir_tmp, exc_length, LPC_ORDERcxx . . $ `external/opusfile/opus/celt/celt_lpc.h:38:9`!, st->arch); |
| 678 | OPUS_COPYcxx . . $ `external/opusfile/opus/celt/os_support.h:72:9`!(exc+MAX_PERIODcxx . . $ `external/opusfile/opus/celt/modes.h:40:9`!-exc_length, fir_tmp, exc_length); |
| 679 | } |
| 680 | |
| 681 | /* Check if the waveform is decaying, and if so how fast. |
| 682 | We do this to avoid adding energy when concealing in a segment |
| 683 | with decaying energy. */ |
| 684 | { |
| 685 | opus_val32cxx . . $ opus_val32# E1=1, E2=1; |
| 686 | int decay_length; |
| 687 | #ifdef FIXED_POINT |
| 688 | int shift = IMAX(0,2*celt_zlog2(celt_maxabs16(&exc[MAX_PERIOD-exc_length], exc_length))-20); |
| 689 | #endif |
| 690 | decay_length = exc_length>>1; |
| 691 | for (i=0;i<decay_length;i++) |
| 692 | { |
| 693 | opus_val16cxx . . $ opus_val16# e; |
| 694 | e = exc[MAX_PERIODcxx . . $ `external/opusfile/opus/celt/modes.h:40:9`!-decay_length+i]; |
| 695 | E1 += SHR32cxx . . $ `external/opusfile/opus/celt/arch.h:226:9`!(MULT16_16cxx . . $ `external/opusfile/opus/celt/arch.h:249:9`!(e, e), shift); |
| 696 | e = exc[MAX_PERIODcxx . . $ `external/opusfile/opus/celt/modes.h:40:9`!-2*decay_length+i]; |
| 697 | E2 += SHR32cxx . . $ `external/opusfile/opus/celt/arch.h:226:9`!(MULT16_16cxx . . $ `external/opusfile/opus/celt/arch.h:249:9`!(e, e), shift); |
| 698 | } |
| 699 | E1 = MIN32cxx . . $ `external/opusfile/opus/celt/arch.h:99:9`!(E1, E2); |
| 700 | decay = celt_sqrtcxx . . $ `external/opusfile/opus/celt/mathops.h:116:9`!(frac_div32cxx . . $ `external/opusfile/opus/celt/mathops.h:122:9`!(SHR32cxx . . $ `external/opusfile/opus/celt/arch.h:226:9`!(E1, 1), E2)); |
| 701 | } |
| 702 | |
| 703 | /* Move the decoder memory one frame to the left to give us room to |
| 704 | add the data for the new frame. We ignore the overlap that extends |
| 705 | past the end of the buffer, because we aren't going to use it. */ |
| 706 | OPUS_MOVEcxx . . $ `external/opusfile/opus/celt/os_support.h:78:9`!(buf, buf+N, DECODE_BUFFER_SIZEcxx . . $ `external/opusfile/opus/celt/celt_decoder.c:70:9`!-N); |
| 707 | |
| 708 | /* Extrapolate from the end of the excitation with a period of |
| 709 | "pitch_index", scaling down each period by an additional factor of |
| 710 | "decay". */ |
| 711 | extrapolation_offset = MAX_PERIODcxx . . $ `external/opusfile/opus/celt/modes.h:40:9`!-pitch_index; |
| 712 | /* We need to extrapolate enough samples to cover a complete MDCT |
| 713 | window (including overlap/2 samples on both sides). */ |
| 714 | extrapolation_len = N+overlap; |
| 715 | /* We also apply fading if this is not the first loss. */ |
| 716 | attenuation = MULT16_16_Q15cxx . . $ `external/opusfile/opus/celt/arch.h:264:9`!(fade, decay); |
| 717 | for (i=j=0;i<extrapolation_len;i++,j++) |
| 718 | { |
| 719 | opus_val16cxx . . $ opus_val16# tmp; |
| 720 | if (j >= pitch_index) { |
| 721 | j -= pitch_index; |
| 722 | attenuation = MULT16_16_Q15cxx . . $ `external/opusfile/opus/celt/arch.h:264:9`!(attenuation, decay); |
| 723 | } |
| 724 | buf[DECODE_BUFFER_SIZEcxx . . $ `external/opusfile/opus/celt/celt_decoder.c:70:9`!-N+i] = |
| 725 | SHL32cxx . . $ `external/opusfile/opus/celt/arch.h:227:9`!(EXTEND32cxx . . $ `external/opusfile/opus/celt/arch.h:223:9`!(MULT16_16_Q15cxx . . $ `external/opusfile/opus/celt/arch.h:264:9`!(attenuation, |
| 726 | exc[extrapolation_offset+j])), SIG_SHIFT); |
| 727 | /* Compute the energy of the previously decoded signal whose |
| 728 | excitation we're copying. */ |
| 729 | tmp = ROUND16cxx . . $ `external/opusfile/opus/celt/arch.h:237:9`!( |
| 730 | buf[DECODE_BUFFER_SIZEcxx . . $ `external/opusfile/opus/celt/celt_decoder.c:70:9`!-MAX_PERIODcxx . . $ `external/opusfile/opus/celt/modes.h:40:9`!-N+extrapolation_offset+j], |
| 731 | SIG_SHIFT); |
| 732 | S1 += SHR32cxx . . $ `external/opusfile/opus/celt/arch.h:226:9`!(MULT16_16cxx . . $ `external/opusfile/opus/celt/arch.h:249:9`!(tmp, tmp), 10); |
| 733 | } |
| 734 | { |
| 735 | opus_val16cxx . . $ opus_val16# lpc_mem[LPC_ORDERcxx . . $ `external/opusfile/opus/celt/celt_lpc.h:38:9`!]; |
| 736 | /* Copy the last decoded samples (prior to the overlap region) to |
| 737 | synthesis filter memory so we can have a continuous signal. */ |
| 738 | for (i=0;i<LPC_ORDERcxx . . $ `external/opusfile/opus/celt/celt_lpc.h:38:9`!;i++) |
| 739 | lpc_mem[i] = ROUND16cxx . . $ `external/opusfile/opus/celt/arch.h:237:9`!(buf[DECODE_BUFFER_SIZEcxx . . $ `external/opusfile/opus/celt/celt_decoder.c:70:9`!-N-1-i], SIG_SHIFT); |
| 740 | /* Apply the synthesis filter to convert the excitation back into |
| 741 | the signal domain. */ |
| 742 | celt_iircxx . . $ celt_iir(cc493c2a92d97e44).(buf+DECODE_BUFFER_SIZEcxx . . $ `external/opusfile/opus/celt/celt_decoder.c:70:9`!-N, lpc+c*LPC_ORDERcxx . . $ `external/opusfile/opus/celt/celt_lpc.h:38:9`!, |
| 743 | buf+DECODE_BUFFER_SIZEcxx . . $ `external/opusfile/opus/celt/celt_decoder.c:70:9`!-N, extrapolation_len, LPC_ORDERcxx . . $ `external/opusfile/opus/celt/celt_lpc.h:38:9`!, |
| 744 | lpc_mem, st->archcxx . . $ OpusCustomDecoder#arch.); |
| 745 | #ifdef FIXED_POINT |
| 746 | for (i=0; i < extrapolation_len; i++) |
| 747 | buf[DECODE_BUFFER_SIZE-N+i] = SATURATE(buf[DECODE_BUFFER_SIZE-N+i], SIG_SAT); |
| 748 | #endif |
| 749 | } |
| 750 | |
| 751 | /* Check if the synthesis energy is higher than expected, which can |
| 752 | happen with the signal changes during our window. If so, |
| 753 | attenuate. */ |
| 754 | { |
| 755 | opus_val32cxx . . $ opus_val32# S2=0; |
| 756 | for (i=0;i<extrapolation_len;i++) |
| 757 | { |
| 758 | opus_val16cxx . . $ opus_val16# tmp = ROUND16cxx . . $ `external/opusfile/opus/celt/arch.h:237:9`!(buf[DECODE_BUFFER_SIZEcxx . . $ `external/opusfile/opus/celt/celt_decoder.c:70:9`!-N+i], SIG_SHIFT); |
| 759 | S2 += SHR32cxx . . $ `external/opusfile/opus/celt/arch.h:226:9`!(MULT16_16cxx . . $ `external/opusfile/opus/celt/arch.h:249:9`!(tmp, tmp), 10); |
| 760 | } |
| 761 | /* This checks for an "explosion" in the synthesis. */ |
| 762 | #ifdef FIXED_POINT |
| 763 | if (!(S1 > SHR32(S2,2))) |
| 764 | #else |
| 765 | /* The float test is written this way to catch NaNs in the output |
| 766 | of the IIR filter at the same time. */ |
| 767 | if (!(S1 > 0.2f*S2)) |
| 768 | #endif |
| 769 | { |
| 770 | for (i=0;i<extrapolation_len;i++) |
| 771 | buf[DECODE_BUFFER_SIZEcxx . . $ `external/opusfile/opus/celt/celt_decoder.c:70:9`!-N+i] = 0; |
| 772 | } else if (S1 < S2) |
| 773 | { |
| 774 | opus_val16cxx . . $ opus_val16# ratio = celt_sqrtcxx . . $ `external/opusfile/opus/celt/mathops.h:116:9`!(frac_div32cxx . . $ `external/opusfile/opus/celt/mathops.h:122:9`!(SHR32cxx . . $ `external/opusfile/opus/celt/arch.h:226:9`!(S1,1)+1,S2+1)); |
| 775 | for (i=0;i<overlap;i++) |
| 776 | { |
| 777 | opus_val16cxx . . $ opus_val16# tmp_g = Q15ONEcxx . . $ `external/opusfile/opus/celt/arch.h:203:9`! |
| 778 | - MULT16_16_Q15cxx . . $ `external/opusfile/opus/celt/arch.h:264:9`!(window[i], Q15ONEcxx . . $ `external/opusfile/opus/celt/arch.h:203:9`!-ratio); |
| 779 | buf[DECODE_BUFFER_SIZEcxx . . $ `external/opusfile/opus/celt/celt_decoder.c:70:9`!-N+i] = |
| 780 | MULT16_32_Q15cxx . . $ `external/opusfile/opus/celt/arch.h:252:9`!(tmp_g, buf[DECODE_BUFFER_SIZEcxx . . $ `external/opusfile/opus/celt/celt_decoder.c:70:9`!-N+i]); |
| 781 | } |
| 782 | for (i=overlap;i<extrapolation_len;i++) |
| 783 | { |
| 784 | buf[DECODE_BUFFER_SIZEcxx . . $ `external/opusfile/opus/celt/celt_decoder.c:70:9`!-N+i] = |
| 785 | MULT16_32_Q15cxx . . $ `external/opusfile/opus/celt/arch.h:252:9`!(ratio, buf[DECODE_BUFFER_SIZEcxx . . $ `external/opusfile/opus/celt/celt_decoder.c:70:9`!-N+i]); |
| 786 | } |
| 787 | } |
| 788 | } |
| 789 | |
| 790 | /* Apply the pre-filter to the MDCT overlap for the next frame because |
| 791 | the post-filter will be re-applied in the decoder after the MDCT |
| 792 | overlap. */ |
| 793 | comb_filtercxx . . $ comb_filter(4a0820a333c3cac3).(etmp, buf+DECODE_BUFFER_SIZEcxx . . $ `external/opusfile/opus/celt/celt_decoder.c:70:9`!, |
| 794 | st->postfilter_periodcxx . . $ OpusCustomDecoder#postfilter_period., st->postfilter_periodcxx . . $ OpusCustomDecoder#postfilter_period., overlap, |
| 795 | -st->postfilter_gaincxx . . $ OpusCustomDecoder#postfilter_gain., -st->postfilter_gaincxx . . $ OpusCustomDecoder#postfilter_gain., |
| 796 | st->postfilter_tapsetcxx . . $ OpusCustomDecoder#postfilter_tapset., st->postfilter_tapsetcxx . . $ OpusCustomDecoder#postfilter_tapset., NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, 0, st->archcxx . . $ OpusCustomDecoder#arch.); |
| 797 | |
| 798 | /* Simulate TDAC on the concealed audio so that it blends with the |
| 799 | MDCT of the next frame. */ |
| 800 | for (i=0;i<overlap/2;i++) |
| 801 | { |
| 802 | buf[DECODE_BUFFER_SIZEcxx . . $ `external/opusfile/opus/celt/celt_decoder.c:70:9`!+i] = |
| 803 | MULT16_32_Q15cxx . . $ `external/opusfile/opus/celt/arch.h:252:9`!(window[i], etmp[overlap-1-i]) |
| 804 | + MULT16_32_Q15cxx . . $ `external/opusfile/opus/celt/arch.h:252:9`!(window[overlap-i-1], etmp[i]); |
| 805 | } |
| 806 | } while (++c<C); |
| 807 | } |
| 808 | |
| 809 | st->loss_countcxx . . $ OpusCustomDecoder#loss_count. = loss_count+1; |
| 810 | |
| 811 | RESTORE_STACKcxx . . $ `external/opusfile/opus/celt/stack_alloc.h:97:9`!; |
| 812 | } |
| 813 | |
| 814 | int celt_decode_with_eccxx . . $ celt_decode_with_ec(f094f6999cb7947e).(CELTDecodercxx . . $ `external/opusfile/opus/celt/celt.h:50:9`! * OPUS_RESTRICTcxx . . $ `external/opusfile/opus/opus_defines.h:98:10`! st, const unsigned char *data, |
| 815 | int len, opus_val16cxx . . $ opus_val16# * OPUS_RESTRICTcxx . . $ `external/opusfile/opus/opus_defines.h:98:10`! pcm, int frame_size, ec_deccxx . . $ ec_dec# *dec, int accum) |
| 816 | { |
| 817 | int c, i, N; |
| 818 | int spread_decision; |
| 819 | opus_int32cxx . . $ opus_int32# bits; |
| 820 | ec_deccxx . . $ ec_dec# _dec; |
| 821 | #ifdef NORM_ALIASING_HACK |
| 822 | celt_norm *X; |
| 823 | #else |
| 824 | VARDECLcxx . . $ `external/opusfile/opus/celt/stack_alloc.h:94:9`!(celt_norm, X); |
| 825 | #endif |
| 826 | VARDECLcxx . . $ `external/opusfile/opus/celt/stack_alloc.h:94:9`!(int, fine_quant); |
| 827 | VARDECLcxx . . $ `external/opusfile/opus/celt/stack_alloc.h:94:9`!(int, pulses); |
| 828 | VARDECLcxx . . $ `external/opusfile/opus/celt/stack_alloc.h:94:9`!(int, cap); |
| 829 | VARDECLcxx . . $ `external/opusfile/opus/celt/stack_alloc.h:94:9`!(int, offsets); |
| 830 | VARDECLcxx . . $ `external/opusfile/opus/celt/stack_alloc.h:94:9`!(int, fine_priority); |
| 831 | VARDECLcxx . . $ `external/opusfile/opus/celt/stack_alloc.h:94:9`!(int, tf_res); |
| 832 | VARDECLcxx . . $ `external/opusfile/opus/celt/stack_alloc.h:94:9`!(unsigned char, collapse_masks); |
| 833 | celt_sigcxx . . $ celt_sig# *decode_mem[2]; |
| 834 | celt_sigcxx . . $ celt_sig# *out_syn[2]; |
| 835 | opus_val16cxx . . $ opus_val16# *lpc; |
| 836 | opus_val16cxx . . $ opus_val16# *oldBandE, *oldLogE, *oldLogE2, *backgroundLogE; |
| 837 | |
| 838 | int shortBlocks; |
| 839 | int isTransient; |
| 840 | int intra_ener; |
| 841 | const int CC = st->channelscxx . . $ OpusCustomDecoder#channels.; |
| 842 | int LM, M; |
| 843 | int start; |
| 844 | int end; |
| 845 | int effEnd; |
| 846 | int codedBands; |
| 847 | int alloc_trim; |
| 848 | int postfilter_pitch; |
| 849 | opus_val16cxx . . $ opus_val16# postfilter_gain; |
| 850 | int intensity=0; |
| 851 | int dual_stereo=0; |
| 852 | opus_int32cxx . . $ opus_int32# total_bits; |
| 853 | opus_int32cxx . . $ opus_int32# balance; |
| 854 | opus_int32cxx . . $ opus_int32# tell; |
| 855 | int dynalloc_logp; |
| 856 | int postfilter_tapset; |
| 857 | int anti_collapse_rsv; |
| 858 | int anti_collapse_on=0; |
| 859 | int silence; |
| 860 | int C = st->stream_channelscxx . . $ OpusCustomDecoder#stream_channels.; |
| 861 | const OpusCustomModecxx . . $ OpusCustomMode# *mode; |
| 862 | int nbEBands; |
| 863 | int overlap; |
| 864 | const opus_int16cxx . . $ opus_int16# *eBands; |
| 865 | ALLOC_STACKcxx . . $ `external/opusfile/opus/celt/stack_alloc.h:98:9`!; |
| 866 | |
| 867 | VALIDATE_CELT_DECODERcxx . . $ `external/opusfile/opus/celt/celt.h:214:9`!(st); |
| 868 | mode = st->modecxx . . $ OpusCustomDecoder#mode.; |
| 869 | nbEBands = mode->nbEBandscxx . . $ OpusCustomMode#nbEBands.; |
| 870 | overlap = mode->overlapcxx . . $ OpusCustomMode#overlap.; |
| 871 | eBands = mode->eBandscxx . . $ OpusCustomMode#eBands.; |
| 872 | start = st->startcxx . . $ OpusCustomDecoder#start.; |
| 873 | end = st->endcxx . . $ OpusCustomDecoder#end.; |
| 874 | frame_size *= st->downsamplecxx . . $ OpusCustomDecoder#downsample.; |
| 875 | |
| 876 | lpc = (opus_val16cxx . . $ opus_val16#*)(st->_decode_memcxx . . $ OpusCustomDecoder#_decode_mem.+(DECODE_BUFFER_SIZEcxx . . $ `external/opusfile/opus/celt/celt_decoder.c:70:9`!+overlap)*CC); |
| 877 | oldBandE = lpc+CC*LPC_ORDERcxx . . $ `external/opusfile/opus/celt/celt_lpc.h:38:9`!; |
| 878 | oldLogE = oldBandE + 2*nbEBands; |
| 879 | oldLogE2 = oldLogE + 2*nbEBands; |
| 880 | backgroundLogE = oldLogE2 + 2*nbEBands; |
| 881 | |
| 882 | #ifdef CUSTOM_MODES |
| 883 | if (st->signalling && data!=NULL) |
| 884 | { |
| 885 | int data0=data[0]; |
| 886 | /* Convert "standard mode" to Opus header */ |
| 887 | if (mode->Fs==48000 && mode->shortMdctSize==120) |
| 888 | { |
| 889 | data0 = fromOpus(data0); |
| 890 | if (data0<0) |
| 891 | return OPUS_INVALID_PACKET; |
| 892 | } |
| 893 | st->end = end = IMAX(1, mode->effEBands-2*(data0>>5)); |
| 894 | LM = (data0>>3)&0x3; |
| 895 | C = 1 + ((data0>>2)&0x1); |
| 896 | data++; |
| 897 | len--; |
| 898 | if (LM>mode->maxLM) |
| 899 | return OPUS_INVALID_PACKET; |
| 900 | if (frame_size < mode->shortMdctSize<<LM) |
| 901 | return OPUS_BUFFER_TOO_SMALL; |
| 902 | else |
| 903 | frame_size = mode->shortMdctSize<<LM; |
| 904 | } else { |
| 905 | #else |
| 906 | { |
| 907 | #endif |
| 908 | for (LM=0;LM<=mode->maxLMcxx . . $ OpusCustomMode#maxLM.;LM++) |
| 909 | if (mode->shortMdctSizecxx . . $ OpusCustomMode#shortMdctSize.<<LM==frame_size) |
| 910 | break; |
| 911 | if (LM>mode->maxLMcxx . . $ OpusCustomMode#maxLM.) |
| 912 | return OPUS_BAD_ARGcxx . . $ `external/opusfile/opus/opus_defines.h:48:9`!; |
| 913 | } |
| 914 | M=1<<LM; |
| 915 | |
| 916 | if (len<0 || len>1275 || pcm==NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) |
| 917 | return OPUS_BAD_ARGcxx . . $ `external/opusfile/opus/opus_defines.h:48:9`!; |
| 918 | |
| 919 | N = M*mode->shortMdctSizecxx . . $ OpusCustomMode#shortMdctSize.; |
| 920 | c=0; do { |
| 921 | decode_mem[c] = st->_decode_memcxx . . $ OpusCustomDecoder#_decode_mem. + c*(DECODE_BUFFER_SIZEcxx . . $ `external/opusfile/opus/celt/celt_decoder.c:70:9`!+overlap); |
| 922 | out_syn[c] = decode_mem[c]+DECODE_BUFFER_SIZEcxx . . $ `external/opusfile/opus/celt/celt_decoder.c:70:9`!-N; |
| 923 | } while (++c<CC); |
| 924 | |
| 925 | effEnd = end; |
| 926 | if (effEnd > mode->effEBandscxx . . $ OpusCustomMode#effEBands.) |
| 927 | effEnd = mode->effEBandscxx . . $ OpusCustomMode#effEBands.; |
| 928 | |
| 929 | if (data == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`! || len<=1) |
| 930 | { |
| 931 | celt_decode_lostcxx . . $ celt_decode_lost(c1e7a401c3d100d4).(st, N, LM); |
| 932 | deemphasiscxx . . $ deemphasis(a345f717e8dd8419).(out_syn, pcm, N, CC, st->downsamplecxx . . $ OpusCustomDecoder#downsample., mode->preemphcxx . . $ OpusCustomMode#preemph., st->preemph_memDcxx . . $ OpusCustomDecoder#preemph_memD., accum); |
| 933 | RESTORE_STACKcxx . . $ `external/opusfile/opus/celt/stack_alloc.h:97:9`!; |
| 934 | return frame_size/st->downsamplecxx . . $ OpusCustomDecoder#downsample.; |
| 935 | } |
| 936 | |
| 937 | /* Check if there are at least two packets received consecutively before |
| 938 | * turning on the pitch-based PLC */ |
| 939 | st->skip_plccxx . . $ OpusCustomDecoder#skip_plc. = st->loss_countcxx . . $ OpusCustomDecoder#loss_count. != 0; |
| 940 | |
| 941 | if (dec == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) |
| 942 | { |
| 943 | ec_dec_initcxx . . $ ec_dec_init(ca189ec876992986).(&_dec,(unsigned char*)data,len); |
| 944 | dec = &_dec; |
| 945 | } |
| 946 | |
| 947 | if (C==1) |
| 948 | { |
| 949 | for (i=0;i<nbEBands;i++) |
| 950 | oldBandE[i]=MAX16cxx . . $ `external/opusfile/opus/celt/arch.h:98:9`!(oldBandE[i],oldBandE[nbEBands+i]); |
| 951 | } |
| 952 | |
| 953 | total_bits = len*8; |
| 954 | tell = ec_tellcxx . . $ ec_tell(d262775a7bafb6a0).(dec); |
| 955 | |
| 956 | if (tell >= total_bits) |
| 957 | silence = 1; |
| 958 | else if (tell==1) |
| 959 | silence = ec_dec_bit_logpcxx . . $ ec_dec_bit_logp(fb67670de84eabc5).(dec, 15); |
| 960 | else |
| 961 | silence = 0; |
| 962 | if (silence) |
| 963 | { |
| 964 | /* Pretend we've read all the remaining bits */ |
| 965 | tell = len*8; |
| 966 | dec->nbits_totalcxx . . $ ec_ctx#nbits_total.+=tell-ec_tellcxx . . $ ec_tell(d262775a7bafb6a0).(dec); |
| 967 | } |
| 968 | |
| 969 | postfilter_gain = 0; |
| 970 | postfilter_pitch = 0; |
| 971 | postfilter_tapset = 0; |
| 972 | if (start==0 && tell+16 <= total_bits) |
| 973 | { |
| 974 | if(ec_dec_bit_logpcxx . . $ ec_dec_bit_logp(fb67670de84eabc5).(dec, 1)) |
| 975 | { |
| 976 | int qg, octave; |
| 977 | octave = ec_dec_uintcxx . . $ ec_dec_uint(ce44d6763753db26).(dec, 6); |
| 978 | postfilter_pitch = (16<<octave)+ec_dec_bitscxx . . $ ec_dec_bits(ce44d6763753db26).(dec, 4+octave)-1; |
| 979 | qg = ec_dec_bitscxx . . $ ec_dec_bits(ce44d6763753db26).(dec, 3); |
| 980 | if (ec_tellcxx . . $ ec_tell(d262775a7bafb6a0).(dec)+2<=total_bits) |
| 981 | postfilter_tapset = ec_dec_icdfcxx . . $ ec_dec_icdf(ceb6fc38d8083835).(dec, tapset_icdfcxx . . $ tapset_icdf., 2); |
| 982 | postfilter_gain = QCONST16cxx . . $ `external/opusfile/opus/celt/arch.h:216:9`!(.09375f,15)*(qg+1); |
| 983 | } |
| 984 | tell = ec_tellcxx . . $ ec_tell(d262775a7bafb6a0).(dec); |
| 985 | } |
| 986 | |
| 987 | if (LM > 0 && tell+3 <= total_bits) |
| 988 | { |
| 989 | isTransient = ec_dec_bit_logpcxx . . $ ec_dec_bit_logp(fb67670de84eabc5).(dec, 3); |
| 990 | tell = ec_tellcxx . . $ ec_tell(d262775a7bafb6a0).(dec); |
| 991 | } |
| 992 | else |
| 993 | isTransient = 0; |
| 994 | |
| 995 | if (isTransient) |
| 996 | shortBlocks = M; |
| 997 | else |
| 998 | shortBlocks = 0; |
| 999 | |
| 1000 | /* Decode the global flags (first symbols in the stream) */ |
| 1001 | intra_ener = tell+3<=total_bits ? ec_dec_bit_logpcxx . . $ ec_dec_bit_logp(fb67670de84eabc5).(dec, 3) : 0; |
| 1002 | /* Get band energies */ |
| 1003 | unquant_coarse_energycxx . . $ unquant_coarse_energy(8e2b5cf678174b3a).(mode, start, end, oldBandE, |
| 1004 | intra_ener, dec, C, LM); |
| 1005 | |
| 1006 | ALLOCcxx . . $ `external/opusfile/opus/celt/stack_alloc.h:95:9`!(tf_res, nbEBands, int); |
| 1007 | tf_decodecxx . . $ tf_decode(5054dde3046e6a6f).(start, end, isTransient, tf_res, LM, dec); |
| 1008 | |
| 1009 | tell = ec_tellcxx . . $ ec_tell(d262775a7bafb6a0).(dec); |
| 1010 | spread_decision = SPREAD_NORMALcxx . . $ `external/opusfile/opus/celt/bands.h:70:9`!; |
| 1011 | if (tell+4 <= total_bits) |
| 1012 | spread_decision = ec_dec_icdfcxx . . $ ec_dec_icdf(ceb6fc38d8083835).(dec, spread_icdfcxx . . $ spread_icdf., 5); |
| 1013 | |
| 1014 | ALLOCcxx . . $ `external/opusfile/opus/celt/stack_alloc.h:95:9`!(cap, nbEBands, int); |
| 1015 | |
| 1016 | init_capscxx . . $ init_caps(54d4a0d7ae0b5d7e).(mode,cap,LM,C); |
| 1017 | |
| 1018 | ALLOCcxx . . $ `external/opusfile/opus/celt/stack_alloc.h:95:9`!(offsets, nbEBands, int); |
| 1019 | |
| 1020 | dynalloc_logp = 6; |
| 1021 | total_bits<<=BITREScxx . . $ `external/opusfile/opus/celt/entcode.h:57:10`!; |
| 1022 | tell = ec_tell_fraccxx . . $ ec_tell_frac(a5b02a39389d8341).(dec); |
| 1023 | for (i=start;i<end;i++) |
| 1024 | { |
| 1025 | int width, quanta; |
| 1026 | int dynalloc_loop_logp; |
| 1027 | int boost; |
| 1028 | width = C*(eBands[i+1]-eBands[i])<<LM; |
| 1029 | /* quanta is 6 bits, but no more than 1 bit/sample |
| 1030 | and no less than 1/8 bit/sample */ |
| 1031 | quanta = IMINcxx . . $ `external/opusfile/opus/celt/arch.h:101:9`!(width<<BITREScxx . . $ `external/opusfile/opus/celt/entcode.h:57:10`!, IMAXcxx . . $ `external/opusfile/opus/celt/arch.h:102:9`!(6<<BITREScxx . . $ `external/opusfile/opus/celt/entcode.h:57:10`!, width)); |
| 1032 | dynalloc_loop_logp = dynalloc_logp; |
| 1033 | boost = 0; |
| 1034 | while (tell+(dynalloc_loop_logp<<BITREScxx . . $ `external/opusfile/opus/celt/entcode.h:57:10`!) < total_bits && boost < cap[i]) |
| 1035 | { |
| 1036 | int flag; |
| 1037 | flag = ec_dec_bit_logpcxx . . $ ec_dec_bit_logp(fb67670de84eabc5).(dec, dynalloc_loop_logp); |
| 1038 | tell = ec_tell_fraccxx . . $ ec_tell_frac(a5b02a39389d8341).(dec); |
| 1039 | if (!flag) |
| 1040 | break; |
| 1041 | boost += quanta; |
| 1042 | total_bits -= quanta; |
| 1043 | dynalloc_loop_logp = 1; |
| 1044 | } |
| 1045 | offsets[i] = boost; |
| 1046 | /* Making dynalloc more likely */ |
| 1047 | if (boost>0) |
| 1048 | dynalloc_logp = IMAXcxx . . $ `external/opusfile/opus/celt/arch.h:102:9`!(2, dynalloc_logp-1); |
| 1049 | } |
| 1050 | |
| 1051 | ALLOCcxx . . $ `external/opusfile/opus/celt/stack_alloc.h:95:9`!(fine_quant, nbEBands, int); |
| 1052 | alloc_trim = tell+(6<<BITREScxx . . $ `external/opusfile/opus/celt/entcode.h:57:10`!) <= total_bits ? |
| 1053 | ec_dec_icdfcxx . . $ ec_dec_icdf(ceb6fc38d8083835).(dec, trim_icdfcxx . . $ trim_icdf., 7) : 5; |
| 1054 | |
| 1055 | bits = (((opus_int32cxx . . $ opus_int32#)len*8)<<BITREScxx . . $ `external/opusfile/opus/celt/entcode.h:57:10`!) - ec_tell_fraccxx . . $ ec_tell_frac(a5b02a39389d8341).(dec) - 1; |
| 1056 | anti_collapse_rsv = isTransient&&LM>=2&&bits>=((LM+2)<<BITREScxx . . $ `external/opusfile/opus/celt/entcode.h:57:10`!) ? (1<<BITREScxx . . $ `external/opusfile/opus/celt/entcode.h:57:10`!) : 0; |
| 1057 | bits -= anti_collapse_rsv; |
| 1058 | |
| 1059 | ALLOCcxx . . $ `external/opusfile/opus/celt/stack_alloc.h:95:9`!(pulses, nbEBands, int); |
| 1060 | ALLOCcxx . . $ `external/opusfile/opus/celt/stack_alloc.h:95:9`!(fine_priority, nbEBands, int); |
| 1061 | |
| 1062 | codedBands = clt_compute_allocationcxx . . $ clt_compute_allocation(a1d939ebf50a647d).(mode, start, end, offsets, cap, |
| 1063 | alloc_trim, &intensity, &dual_stereo, bits, &balance, pulses, |
| 1064 | fine_quant, fine_priority, C, LM, dec, 0, 0, 0); |
| 1065 | |
| 1066 | unquant_fine_energycxx . . $ unquant_fine_energy(b55a50a91bad39b2).(mode, start, end, oldBandE, fine_quant, dec, C); |
| 1067 | |
| 1068 | c=0; do { |
| 1069 | OPUS_MOVEcxx . . $ `external/opusfile/opus/celt/os_support.h:78:9`!(decode_mem[c], decode_mem[c]+N, DECODE_BUFFER_SIZEcxx . . $ `external/opusfile/opus/celt/celt_decoder.c:70:9`!-N+overlap/2); |
| 1070 | } while (++c<CC); |
| 1071 | |
| 1072 | /* Decode fixed codebook */ |
| 1073 | ALLOCcxx . . $ `external/opusfile/opus/celt/stack_alloc.h:95:9`!(collapse_masks, C*nbEBands, unsigned char); |
| 1074 | |
| 1075 | #ifdef NORM_ALIASING_HACK |
| 1076 | /* This is an ugly hack that breaks aliasing rules and would be easily broken, |
| 1077 | but it saves almost 4kB of stack. */ |
| 1078 | X = (celt_norm*)(out_syn[CC-1]+overlap/2); |
| 1079 | #else |
| 1080 | ALLOCcxx . . $ `external/opusfile/opus/celt/stack_alloc.h:95:9`!(X, C*N, celt_norm); /**< Interleaved normalised MDCTs */ |
| 1081 | #endif |
| 1082 | |
| 1083 | quant_all_bandscxx . . $ quant_all_bands(d2a71e937cf303f9).(0, mode, start, end, X, C==2 ? X+N : NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, collapse_masks, |
| 1084 | NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, pulses, shortBlocks, spread_decision, dual_stereo, intensity, tf_res, |
| 1085 | len*(8<<BITREScxx . . $ `external/opusfile/opus/celt/entcode.h:57:10`!)-anti_collapse_rsv, balance, dec, LM, codedBands, &st->rngcxx . . $ OpusCustomDecoder#rng., 0, |
| 1086 | st->archcxx . . $ OpusCustomDecoder#arch., st->disable_invcxx . . $ OpusCustomDecoder#disable_inv.); |
| 1087 | |
| 1088 | if (anti_collapse_rsv > 0) |
| 1089 | { |
| 1090 | anti_collapse_on = ec_dec_bitscxx . . $ ec_dec_bits(ce44d6763753db26).(dec, 1); |
| 1091 | } |
| 1092 | |
| 1093 | unquant_energy_finalisecxx . . $ unquant_energy_finalise(bc6a604191db4388).(mode, start, end, oldBandE, |
| 1094 | fine_quant, fine_priority, len*8-ec_tellcxx . . $ ec_tell(d262775a7bafb6a0).(dec), dec, C); |
| 1095 | |
| 1096 | if (anti_collapse_on) |
| 1097 | anti_collapsecxx . . $ anti_collapse(1cab749567f0d763).(mode, X, collapse_masks, LM, C, N, |
| 1098 | start, end, oldBandE, oldLogE, oldLogE2, pulses, st->rngcxx . . $ OpusCustomDecoder#rng., st->archcxx . . $ OpusCustomDecoder#arch.); |
| 1099 | |
| 1100 | if (silence) |
| 1101 | { |
| 1102 | for (i=0;i<C*nbEBands;i++) |
| 1103 | oldBandE[i] = -QCONST16cxx . . $ `external/opusfile/opus/celt/arch.h:216:9`!(28.f,DB_SHIFT); |
| 1104 | } |
| 1105 | |
| 1106 | celt_synthesiscxx . . $ celt_synthesis(41b2e8ebd1822e46).(mode, X, out_syn, oldBandE, start, effEnd, |
| 1107 | C, CC, isTransient, LM, st->downsamplecxx . . $ OpusCustomDecoder#downsample., silence, st->archcxx . . $ OpusCustomDecoder#arch.); |
| 1108 | |
| 1109 | c=0; do { |
| 1110 | st->postfilter_periodcxx . . $ OpusCustomDecoder#postfilter_period.=IMAXcxx . . $ `external/opusfile/opus/celt/arch.h:102:9`!(st->postfilter_period, COMBFILTER_MINPERIODcxx . . $ `external/opusfile/opus/celt/celt.h:208:9`!); |
| 1111 | st->postfilter_period_oldcxx . . $ OpusCustomDecoder#postfilter_period_old.=IMAXcxx . . $ `external/opusfile/opus/celt/arch.h:102:9`!(st->postfilter_period_old, COMBFILTER_MINPERIODcxx . . $ `external/opusfile/opus/celt/celt.h:208:9`!); |
| 1112 | comb_filtercxx . . $ comb_filter(4a0820a333c3cac3).(out_syn[c], out_syn[c], st->postfilter_period_oldcxx . . $ OpusCustomDecoder#postfilter_period_old., st->postfilter_periodcxx . . $ OpusCustomDecoder#postfilter_period., mode->shortMdctSizecxx . . $ OpusCustomMode#shortMdctSize., |
| 1113 | st->postfilter_gain_oldcxx . . $ OpusCustomDecoder#postfilter_gain_old., st->postfilter_gaincxx . . $ OpusCustomDecoder#postfilter_gain., st->postfilter_tapset_oldcxx . . $ OpusCustomDecoder#postfilter_tapset_old., st->postfilter_tapsetcxx . . $ OpusCustomDecoder#postfilter_tapset., |
| 1114 | mode->windowcxx . . $ OpusCustomMode#window., overlap, st->archcxx . . $ OpusCustomDecoder#arch.); |
| 1115 | if (LM!=0) |
| 1116 | comb_filtercxx . . $ comb_filter(4a0820a333c3cac3).(out_syn[c]+mode->shortMdctSizecxx . . $ OpusCustomMode#shortMdctSize., out_syn[c]+mode->shortMdctSizecxx . . $ OpusCustomMode#shortMdctSize., st->postfilter_periodcxx . . $ OpusCustomDecoder#postfilter_period., postfilter_pitch, N-mode->shortMdctSizecxx . . $ OpusCustomMode#shortMdctSize., |
| 1117 | st->postfilter_gaincxx . . $ OpusCustomDecoder#postfilter_gain., postfilter_gain, st->postfilter_tapsetcxx . . $ OpusCustomDecoder#postfilter_tapset., postfilter_tapset, |
| 1118 | mode->windowcxx . . $ OpusCustomMode#window., overlap, st->archcxx . . $ OpusCustomDecoder#arch.); |
| 1119 | |
| 1120 | } while (++c<CC); |
| 1121 | st->postfilter_period_oldcxx . . $ OpusCustomDecoder#postfilter_period_old. = st->postfilter_periodcxx . . $ OpusCustomDecoder#postfilter_period.; |
| 1122 | st->postfilter_gain_oldcxx . . $ OpusCustomDecoder#postfilter_gain_old. = st->postfilter_gaincxx . . $ OpusCustomDecoder#postfilter_gain.; |
| 1123 | st->postfilter_tapset_oldcxx . . $ OpusCustomDecoder#postfilter_tapset_old. = st->postfilter_tapsetcxx . . $ OpusCustomDecoder#postfilter_tapset.; |
| 1124 | st->postfilter_periodcxx . . $ OpusCustomDecoder#postfilter_period. = postfilter_pitch; |
| 1125 | st->postfilter_gaincxx . . $ OpusCustomDecoder#postfilter_gain. = postfilter_gain; |
| 1126 | st->postfilter_tapsetcxx . . $ OpusCustomDecoder#postfilter_tapset. = postfilter_tapset; |
| 1127 | if (LM!=0) |
| 1128 | { |
| 1129 | st->postfilter_period_oldcxx . . $ OpusCustomDecoder#postfilter_period_old. = st->postfilter_periodcxx . . $ OpusCustomDecoder#postfilter_period.; |
| 1130 | st->postfilter_gain_oldcxx . . $ OpusCustomDecoder#postfilter_gain_old. = st->postfilter_gaincxx . . $ OpusCustomDecoder#postfilter_gain.; |
| 1131 | st->postfilter_tapset_oldcxx . . $ OpusCustomDecoder#postfilter_tapset_old. = st->postfilter_tapsetcxx . . $ OpusCustomDecoder#postfilter_tapset.; |
| 1132 | } |
| 1133 | |
| 1134 | if (C==1) |
| 1135 | OPUS_COPYcxx . . $ `external/opusfile/opus/celt/os_support.h:72:9`!(&oldBandE[nbEBands], oldBandE, nbEBands); |
| 1136 | |
| 1137 | /* In case start or end were to change */ |
| 1138 | if (!isTransient) |
| 1139 | { |
| 1140 | opus_val16cxx . . $ opus_val16# max_background_increase; |
| 1141 | OPUS_COPYcxx . . $ `external/opusfile/opus/celt/os_support.h:72:9`!(oldLogE2, oldLogE, 2*nbEBands); |
| 1142 | OPUS_COPYcxx . . $ `external/opusfile/opus/celt/os_support.h:72:9`!(oldLogE, oldBandE, 2*nbEBands); |
| 1143 | /* In normal circumstances, we only allow the noise floor to increase by |
| 1144 | up to 2.4 dB/second, but when we're in DTX, we allow up to 6 dB |
| 1145 | increase for each update.*/ |
| 1146 | if (st->loss_countcxx . . $ OpusCustomDecoder#loss_count. < 10) |
| 1147 | max_background_increase = M*QCONST16cxx . . $ `external/opusfile/opus/celt/arch.h:216:9`!(0.001f,DB_SHIFT); |
| 1148 | else |
| 1149 | max_background_increase = QCONST16cxx . . $ `external/opusfile/opus/celt/arch.h:216:9`!(1.f,DB_SHIFT); |
| 1150 | for (i=0;i<2*nbEBands;i++) |
| 1151 | backgroundLogE[i] = MIN16cxx . . $ `external/opusfile/opus/celt/arch.h:97:9`!(backgroundLogE[i] + max_background_increase, oldBandE[i]); |
| 1152 | } else { |
| 1153 | for (i=0;i<2*nbEBands;i++) |
| 1154 | oldLogE[i] = MIN16cxx . . $ `external/opusfile/opus/celt/arch.h:97:9`!(oldLogE[i], oldBandE[i]); |
| 1155 | } |
| 1156 | c=0; do |
| 1157 | { |
| 1158 | for (i=0;i<start;i++) |
| 1159 | { |
| 1160 | oldBandE[c*nbEBands+i]=0; |
| 1161 | oldLogE[c*nbEBands+i]=oldLogE2[c*nbEBands+i]=-QCONST16cxx . . $ `external/opusfile/opus/celt/arch.h:216:9`!(28.f,DB_SHIFT); |
| 1162 | } |
| 1163 | for (i=end;i<nbEBands;i++) |
| 1164 | { |
| 1165 | oldBandE[c*nbEBands+i]=0; |
| 1166 | oldLogE[c*nbEBands+i]=oldLogE2[c*nbEBands+i]=-QCONST16cxx . . $ `external/opusfile/opus/celt/arch.h:216:9`!(28.f,DB_SHIFT); |
| 1167 | } |
| 1168 | } while (++c<2); |
| 1169 | st->rngcxx . . $ OpusCustomDecoder#rng. = dec->rngcxx . . $ ec_ctx#rng.; |
| 1170 | |
| 1171 | deemphasiscxx . . $ deemphasis(a345f717e8dd8419).(out_syn, pcm, N, CC, st->downsamplecxx . . $ OpusCustomDecoder#downsample., mode->preemphcxx . . $ OpusCustomMode#preemph., st->preemph_memDcxx . . $ OpusCustomDecoder#preemph_memD., accum); |
| 1172 | st->loss_countcxx . . $ OpusCustomDecoder#loss_count. = 0; |
| 1173 | RESTORE_STACKcxx . . $ `external/opusfile/opus/celt/stack_alloc.h:97:9`!; |
| 1174 | if (ec_tellcxx . . $ ec_tell(d262775a7bafb6a0).(dec) > 8*len) |
| 1175 | return OPUS_INTERNAL_ERRORcxx . . $ `external/opusfile/opus/opus_defines.h:52:9`!; |
| 1176 | if(ec_get_errorcxx . . $ ec_get_error(d262775a7bafb6a0).(dec)) |
| 1177 | st->errorcxx . . $ OpusCustomDecoder#error. = 1; |
| 1178 | return frame_size/st->downsamplecxx . . $ OpusCustomDecoder#downsample.; |
| 1179 | } |
| 1180 | |
| 1181 | |
| 1182 | #ifdef CUSTOM_MODES |
| 1183 | |
| 1184 | #ifdef FIXED_POINT |
| 1185 | int opus_custom_decode(CELTDecoder * OPUS_RESTRICT st, const unsigned char *data, int len, opus_int16 * OPUS_RESTRICT pcm, int frame_size) |
| 1186 | { |
| 1187 | return celt_decode_with_ec(st, data, len, pcm, frame_size, NULL, 0); |
| 1188 | } |
| 1189 | |
| 1190 | #ifndef DISABLE_FLOAT_API |
| 1191 | int opus_custom_decode_float(CELTDecoder * OPUS_RESTRICT st, const unsigned char *data, int len, float * OPUS_RESTRICT pcm, int frame_size) |
| 1192 | { |
| 1193 | int j, ret, C, N; |
| 1194 | VARDECL(opus_int16, out); |
| 1195 | ALLOC_STACK; |
| 1196 | |
| 1197 | if (pcm==NULL) |
| 1198 | return OPUS_BAD_ARG; |
| 1199 | |
| 1200 | C = st->channels; |
| 1201 | N = frame_size; |
| 1202 | |
| 1203 | ALLOC(out, C*N, opus_int16); |
| 1204 | ret=celt_decode_with_ec(st, data, len, out, frame_size, NULL, 0); |
| 1205 | if (ret>0) |
| 1206 | for (j=0;j<C*ret;j++) |
| 1207 | pcm[j]=out[j]*(1.f/32768.f); |
| 1208 | |
| 1209 | RESTORE_STACK; |
| 1210 | return ret; |
| 1211 | } |
| 1212 | #endif /* DISABLE_FLOAT_API */ |
| 1213 | |
| 1214 | #else |
| 1215 | |
| 1216 | int opus_custom_decode_float(CELTDecoder * OPUS_RESTRICT st, const unsigned char *data, int len, float * OPUS_RESTRICT pcm, int frame_size) |
| 1217 | { |
| 1218 | return celt_decode_with_ec(st, data, len, pcm, frame_size, NULL, 0); |
| 1219 | } |
| 1220 | |
| 1221 | int opus_custom_decode(CELTDecoder * OPUS_RESTRICT st, const unsigned char *data, int len, opus_int16 * OPUS_RESTRICT pcm, int frame_size) |
| 1222 | { |
| 1223 | int j, ret, C, N; |
| 1224 | VARDECL(celt_sig, out); |
| 1225 | ALLOC_STACK; |
| 1226 | |
| 1227 | if (pcm==NULL) |
| 1228 | return OPUS_BAD_ARG; |
| 1229 | |
| 1230 | C = st->channels; |
| 1231 | N = frame_size; |
| 1232 | ALLOC(out, C*N, celt_sig); |
| 1233 | |
| 1234 | ret=celt_decode_with_ec(st, data, len, out, frame_size, NULL, 0); |
| 1235 | |
| 1236 | if (ret>0) |
| 1237 | for (j=0;j<C*ret;j++) |
| 1238 | pcm[j] = FLOAT2INT16 (out[j]); |
| 1239 | |
| 1240 | RESTORE_STACK; |
| 1241 | return ret; |
| 1242 | } |
| 1243 | |
| 1244 | #endif |
| 1245 | #endif /* CUSTOM_MODES */ |
| 1246 | |
| 1247 | int opus_custom_decoder_ctlcxx . . $ opus_custom_decoder_ctl(5306c2cb32f0ab07).(CELTDecodercxx . . $ `external/opusfile/opus/celt/celt.h:50:9`! * OPUS_RESTRICTcxx . . $ `external/opusfile/opus/opus_defines.h:98:10`! st, int request, ...) |
| 1248 | { |
| 1249 | va_listcxx . . $ va_list# ap; |
| 1250 | |
| 1251 | va_startcxx . . $ `<external>/8105065126723003039/stdarg.h:50:9`!(ap, request); |
| 1252 | switch (request) |
| 1253 | { |
| 1254 | case CELT_SET_START_BAND_REQUESTcxx . . $ `external/opusfile/opus/celt/celt.h:104:9`!: |
| 1255 | { |
| 1256 | opus_int32cxx . . $ opus_int32# value = va_argcxx . . $ `<external>/8105065126723003039/stdarg.h:53:9`!(ap, opus_int32); |
| 1257 | if (value<0 || value>=st->modecxx . . $ OpusCustomDecoder#mode.->nbEBandscxx . . $ OpusCustomMode#nbEBands.) |
| 1258 | goto bad_arg; |
| 1259 | st->startcxx . . $ OpusCustomDecoder#start. = value; |
| 1260 | } |
| 1261 | break; |
| 1262 | case CELT_SET_END_BAND_REQUESTcxx . . $ `external/opusfile/opus/celt/celt.h:107:9`!: |
| 1263 | { |
| 1264 | opus_int32cxx . . $ opus_int32# value = va_argcxx . . $ `<external>/8105065126723003039/stdarg.h:53:9`!(ap, opus_int32); |
| 1265 | if (value<1 || value>st->modecxx . . $ OpusCustomDecoder#mode.->nbEBandscxx . . $ OpusCustomMode#nbEBands.) |
| 1266 | goto bad_arg; |
| 1267 | st->endcxx . . $ OpusCustomDecoder#end. = value; |
| 1268 | } |
| 1269 | break; |
| 1270 | case CELT_SET_CHANNELS_REQUESTcxx . . $ `external/opusfile/opus/celt/celt.h:99:9`!: |
| 1271 | { |
| 1272 | opus_int32cxx . . $ opus_int32# value = va_argcxx . . $ `<external>/8105065126723003039/stdarg.h:53:9`!(ap, opus_int32); |
| 1273 | if (value<1 || value>2) |
| 1274 | goto bad_arg; |
| 1275 | st->stream_channelscxx . . $ OpusCustomDecoder#stream_channels. = value; |
| 1276 | } |
| 1277 | break; |
| 1278 | case CELT_GET_AND_CLEAR_ERROR_REQUESTcxx . . $ `external/opusfile/opus/celt/celt.h:96:9`!: |
| 1279 | { |
| 1280 | opus_int32cxx . . $ opus_int32# *value = va_argcxx . . $ `<external>/8105065126723003039/stdarg.h:53:9`!(ap, opus_int32*); |
| 1281 | if (value==NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) |
| 1282 | goto bad_arg; |
| 1283 | *value=st->errorcxx . . $ OpusCustomDecoder#error.; |
| 1284 | st->errorcxx . . $ OpusCustomDecoder#error. = 0; |
| 1285 | } |
| 1286 | break; |
| 1287 | case OPUS_GET_LOOKAHEAD_REQUESTcxx . . $ `external/opusfile/opus/opus_defines.h:154:9`!: |
| 1288 | { |
| 1289 | opus_int32cxx . . $ opus_int32# *value = va_argcxx . . $ `<external>/8105065126723003039/stdarg.h:53:9`!(ap, opus_int32*); |
| 1290 | if (value==NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) |
| 1291 | goto bad_arg; |
| 1292 | *value = st->overlapcxx . . $ OpusCustomDecoder#overlap./st->downsamplecxx . . $ OpusCustomDecoder#downsample.; |
| 1293 | } |
| 1294 | break; |
| 1295 | case OPUS_RESET_STATEcxx . . $ `external/opusfile/opus/opus_defines.h:662:9`!: |
| 1296 | { |
| 1297 | int i; |
| 1298 | opus_val16cxx . . $ opus_val16# *lpc, *oldBandE, *oldLogE, *oldLogE2; |
| 1299 | lpc = (opus_val16cxx . . $ opus_val16#*)(st->_decode_memcxx . . $ OpusCustomDecoder#_decode_mem.+(DECODE_BUFFER_SIZEcxx . . $ `external/opusfile/opus/celt/celt_decoder.c:70:9`!+st->overlapcxx . . $ OpusCustomDecoder#overlap.)*st->channelscxx . . $ OpusCustomDecoder#channels.); |
| 1300 | oldBandE = lpc+st->channelscxx . . $ OpusCustomDecoder#channels.*LPC_ORDERcxx . . $ `external/opusfile/opus/celt/celt_lpc.h:38:9`!; |
| 1301 | oldLogE = oldBandE + 2*st->modecxx . . $ OpusCustomDecoder#mode.->nbEBandscxx . . $ OpusCustomMode#nbEBands.; |
| 1302 | oldLogE2 = oldLogE + 2*st->modecxx . . $ OpusCustomDecoder#mode.->nbEBandscxx . . $ OpusCustomMode#nbEBands.; |
| 1303 | OPUS_CLEARcxx . . $ `external/opusfile/opus/celt/os_support.h:83:9`!((char*)&st->DECODER_RESET_STARTcxx . . $ `external/opusfile/opus/celt/celt_decoder.c:88:9`!, |
| 1304 | opus_custom_decoder_get_size(st->mode, st->channels)- |
| 1305 | ((char*)&st->DECODER_RESET_STARTcxx . . $ `external/opusfile/opus/celt/celt_decoder.c:88:9`! - (char*)st)); |
| 1306 | for (i=0;i<2*st->modecxx . . $ OpusCustomDecoder#mode.->nbEBandscxx . . $ OpusCustomMode#nbEBands.;i++) |
| 1307 | oldLogE[i]=oldLogE2[i]=-QCONST16cxx . . $ `external/opusfile/opus/celt/arch.h:216:9`!(28.f,DB_SHIFT); |
| 1308 | st->skip_plccxx . . $ OpusCustomDecoder#skip_plc. = 1; |
| 1309 | } |
| 1310 | break; |
| 1311 | case OPUS_GET_PITCH_REQUESTcxx . . $ `external/opusfile/opus/opus_defines.h:158:9`!: |
| 1312 | { |
| 1313 | opus_int32cxx . . $ opus_int32# *value = va_argcxx . . $ `<external>/8105065126723003039/stdarg.h:53:9`!(ap, opus_int32*); |
| 1314 | if (value==NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) |
| 1315 | goto bad_arg; |
| 1316 | *value = st->postfilter_periodcxx . . $ OpusCustomDecoder#postfilter_period.; |
| 1317 | } |
| 1318 | break; |
| 1319 | case CELT_GET_MODE_REQUESTcxx . . $ `external/opusfile/opus/celt/celt.h:110:9`!: |
| 1320 | { |
| 1321 | const CELTModecxx . . $ `external/opusfile/opus/celt/celt.h:51:9`! ** value = va_argcxx . . $ `<external>/8105065126723003039/stdarg.h:53:9`!(ap, const CELTModecxx . . $ `external/opusfile/opus/celt/celt.h:51:9`!**); |
| 1322 | if (value==0) |
| 1323 | goto bad_arg; |
| 1324 | *value=st->modecxx . . $ OpusCustomDecoder#mode.; |
| 1325 | } |
| 1326 | break; |
| 1327 | case CELT_SET_SIGNALLING_REQUESTcxx . . $ `external/opusfile/opus/celt/celt.h:114:9`!: |
| 1328 | { |
| 1329 | opus_int32cxx . . $ opus_int32# value = va_argcxx . . $ `<external>/8105065126723003039/stdarg.h:53:9`!(ap, opus_int32); |
| 1330 | st->signallingcxx . . $ OpusCustomDecoder#signalling. = value; |
| 1331 | } |
| 1332 | break; |
| 1333 | case OPUS_GET_FINAL_RANGE_REQUESTcxx . . $ `external/opusfile/opus/opus_defines.h:157:9`!: |
| 1334 | { |
| 1335 | opus_uint32cxx . . $ opus_uint32# * value = va_argcxx . . $ `<external>/8105065126723003039/stdarg.h:53:9`!(ap, opus_uint32 *); |
| 1336 | if (value==0) |
| 1337 | goto bad_arg; |
| 1338 | *value=st->rngcxx . . $ OpusCustomDecoder#rng.; |
| 1339 | } |
| 1340 | break; |
| 1341 | case OPUS_SET_PHASE_INVERSION_DISABLED_REQUESTcxx . . $ `external/opusfile/opus/opus_defines.h:169:9`!: |
| 1342 | { |
| 1343 | opus_int32cxx . . $ opus_int32# value = va_argcxx . . $ `<external>/8105065126723003039/stdarg.h:53:9`!(ap, opus_int32); |
| 1344 | if(value<0 || value>1) |
| 1345 | { |
| 1346 | goto bad_arg; |
| 1347 | } |
| 1348 | st->disable_invcxx . . $ OpusCustomDecoder#disable_inv. = value; |
| 1349 | } |
| 1350 | break; |
| 1351 | case OPUS_GET_PHASE_INVERSION_DISABLED_REQUESTcxx . . $ `external/opusfile/opus/opus_defines.h:170:9`!: |
| 1352 | { |
| 1353 | opus_int32cxx . . $ opus_int32# *value = va_argcxx . . $ `<external>/8105065126723003039/stdarg.h:53:9`!(ap, opus_int32*); |
| 1354 | if (!value) |
| 1355 | { |
| 1356 | goto bad_arg; |
| 1357 | } |
| 1358 | *value = st->disable_invcxx . . $ OpusCustomDecoder#disable_inv.; |
| 1359 | } |
| 1360 | break; |
| 1361 | default: |
| 1362 | goto bad_request; |
| 1363 | } |
| 1364 | va_endcxx . . $ `<external>/8105065126723003039/stdarg.h:52:9`!(ap); |
| 1365 | return OPUS_OKcxx . . $ `external/opusfile/opus/opus_defines.h:46:9`!; |
| 1366 | bad_arg: |
| 1367 | va_endcxx . . $ `<external>/8105065126723003039/stdarg.h:52:9`!(ap); |
| 1368 | return OPUS_BAD_ARGcxx . . $ `external/opusfile/opus/opus_defines.h:48:9`!; |
| 1369 | bad_request: |
| 1370 | va_endcxx . . $ `<external>/8105065126723003039/stdarg.h:52:9`!(ap); |
| 1371 | return OPUS_UNIMPLEMENTEDcxx . . $ `external/opusfile/opus/opus_defines.h:56:9`!; |
| 1372 | } |