| 1 | /* -*- mode: C; mode: fold -*- */cxx . . $ `<file>/external/lame/lame.c`/ |
| 2 | /* |
| 3 | * LAME MP3 encoding engine |
| 4 | * |
| 5 | * Copyright (c) 1999-2000 Mark Taylor |
| 6 | * Copyright (c) 2000-2005 Takehiro Tominaga |
| 7 | * Copyright (c) 2000-2017 Robert Hegemann |
| 8 | * Copyright (c) 2000-2005 Gabriel Bouvigne |
| 9 | * Copyright (c) 2000-2004 Alexander Leidinger |
| 10 | * |
| 11 | * This library is free software; you can redistribute it and/or |
| 12 | * modify it under the terms of the GNU Library General Public |
| 13 | * License as published by the Free Software Foundation; either |
| 14 | * version 2 of the License, or (at your option) any later version. |
| 15 | * |
| 16 | * This library is distributed in the hope that it will be useful, |
| 17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 19 | * Library General Public License for more details. |
| 20 | * |
| 21 | * You should have received a copy of the GNU Library General Public |
| 22 | * License along with this library; if not, write to the |
| 23 | * Free Software Fhipoundation, Inc., 59 Temple Place - Suite 330, |
| 24 | * Boston, MA 02111-1307, USA. |
| 25 | */ |
| 26 | |
| 27 | /* $Id: lame.c,v 1.377 2017/09/26 12:14:02 robert Exp $ */ |
| 28 | |
| 29 | //#ifdef HAVE_CONFIG_H |
| 30 | #include "lame__config.h"cxx . . $ `<file>/external/lame/lame__config.h`/ |
| 31 | //#endif |
| 32 | |
| 33 | |
| 34 | #include "lame.h"cxx . . $ `<file>/external/lame/lame.h`/ |
| 35 | #include "machine.h"cxx . . $ `<file>/external/lame/machine.h`/ |
| 36 | |
| 37 | #include "encoder.h"cxx . . $ `<file>/external/lame/encoder.h`/ |
| 38 | #include "util.h"cxx . . $ `<file>/external/lame/util.h`/ |
| 39 | #include "lame_global_flags.h"cxx . . $ `<file>/external/lame/lame_global_flags.h`/ |
| 40 | #include "gain_analysis.h"cxx . . $ `<file>/external/lame/gain_analysis.h`/ |
| 41 | #include "bitstream.h"cxx . . $ `<file>/external/lame/bitstream.h`/ |
| 42 | #include "quantize_pvt.h"cxx . . $ `<file>/external/lame/quantize_pvt.h`/ |
| 43 | #include "set_get.h"cxx . . $ `<file>/external/lame/set_get.h`/ |
| 44 | #include "quantize.h"cxx . . $ `<file>/external/lame/quantize.h`/ |
| 45 | #include "psymodel.h"cxx . . $ `<file>/external/lame/psymodel.h`/ |
| 46 | #include "version.h"cxx . . $ `<file>/external/lame/version.h`/ |
| 47 | #include "VbrTag.h"cxx . . $ `<file>/external/lame/VbrTag.h`/ |
| 48 | #include "tables.h"cxx . . $ `<file>/external/lame/tables.h`/ |
| 49 | |
| 50 | |
| 51 | #if defined(__FreeBSD__) && !defined(__alpha__) |
| 52 | #include <floatingpoint.h> |
| 53 | #endif |
| 54 | #ifdef __riscos__ |
| 55 | #include "asmstuff.h" |
| 56 | #endif |
| 57 | |
| 58 | #ifdef __sun__ |
| 59 | /* woraround for SunOS 4.x, it has SEEK_* defined here */ |
| 60 | #include <unistd.h> |
| 61 | #endif |
| 62 | |
| 63 | |
| 64 | #define LAME_DEFAULT_QUALITYcxx . . $ `external/lame/lame.c:64:9`! 3 |
| 65 | |
| 66 | |
| 67 | |
| 68 | int |
| 69 | is_lame_global_flags_validcxx . . $ is_lame_global_flags_valid(a5abb0ff158568ac).(const lame_global_flagscxx . . $ lame_global_flags# * gfp) |
| 70 | { |
| 71 | if (gfp == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) |
| 72 | return 0; |
| 73 | if (gfp->class_idcxx . . $ lame_global_struct#class_id. != LAME_IDcxx . . $ `external/lame/util.h:483:12`!) |
| 74 | return 0; |
| 75 | return 1; |
| 76 | } |
| 77 | |
| 78 | |
| 79 | int |
| 80 | is_lame_internal_flags_validcxx . . $ is_lame_internal_flags_valid(b815612886108da).(const lame_internal_flagscxx . . $ lame_internal_flags# * gfc) |
| 81 | { |
| 82 | if (gfc == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) |
| 83 | return 0; |
| 84 | if (gfc->class_idcxx . . $ lame_internal_flags#class_id. != LAME_IDcxx . . $ `external/lame/util.h:483:12`!) |
| 85 | return 0; |
| 86 | if (gfc->lame_init_params_successfulcxx . . $ lame_internal_flags#lame_init_params_successful. <=0) |
| 87 | return 0; |
| 88 | return 1; |
| 89 | } |
| 90 | |
| 91 | |
| 92 | |
| 93 | static FLOATcxx . . $ FLOAT# |
| 94 | filter_coefcxx . . $ filter_coef(fbcf3211dfe1bfd1).(FLOATcxx . . $ FLOAT# x) |
| 95 | { |
| 96 | if (x > 1.0) |
| 97 | return 0.0; |
| 98 | if (x <= 0.0) |
| 99 | return 1.0; |
| 100 | |
| 101 | return cos(PIcxx . . $ `external/lame/util.h:56:17`! / 2 * x); |
| 102 | } |
| 103 | |
| 104 | static void |
| 105 | lame_init_params_ppfltcxx . . $ lame_init_params_ppflt(4f558d83b2842a93).(lame_internal_flagscxx . . $ lame_internal_flags# * gfc) |
| 106 | { |
| 107 | SessionConfig_tcxx . . $ SessionConfig_t# *const cfg = &gfc->cfgcxx . . $ lame_internal_flags#cfg.; |
| 108 | |
| 109 | /***************************************************************/ |
| 110 | /* compute info needed for polyphase filter (filter type==0, default) */ |
| 111 | /***************************************************************/ |
| 112 | |
| 113 | int band, maxband, minband; |
| 114 | FLOATcxx . . $ FLOAT# freq; |
| 115 | int lowpass_band = 32; |
| 116 | int highpass_band = -1; |
| 117 | |
| 118 | if (cfg->lowpass1cxx . . $ $anonymous_type_fa6ce02aa65ebf3c_13#lowpass1. > 0) { |
| 119 | minband = 999; |
| 120 | for (band = 0; band <= 31; band++) { |
| 121 | freq = band / 31.0; |
| 122 | /* this band and above will be zeroed: */ |
| 123 | if (freq >= cfg->lowpass2cxx . . $ $anonymous_type_fa6ce02aa65ebf3c_13#lowpass2.) { |
| 124 | lowpass_band = Mincxx . . $ `external/lame/util.h:91:17`!(lowpass_band, band); |
| 125 | } |
| 126 | if (cfg->lowpass1cxx . . $ $anonymous_type_fa6ce02aa65ebf3c_13#lowpass1. < freq && freq < cfg->lowpass2cxx . . $ $anonymous_type_fa6ce02aa65ebf3c_13#lowpass2.) { |
| 127 | minband = Mincxx . . $ `external/lame/util.h:91:17`!(minband, band); |
| 128 | } |
| 129 | } |
| 130 | |
| 131 | /* compute the *actual* transition band implemented by |
| 132 | * the polyphase filter */ |
| 133 | if (minband == 999) { |
| 134 | cfg->lowpass1cxx . . $ $anonymous_type_fa6ce02aa65ebf3c_13#lowpass1. = (lowpass_band - .75) / 31.0; |
| 135 | } |
| 136 | else { |
| 137 | cfg->lowpass1cxx . . $ $anonymous_type_fa6ce02aa65ebf3c_13#lowpass1. = (minband - .75) / 31.0; |
| 138 | } |
| 139 | cfg->lowpass2cxx . . $ $anonymous_type_fa6ce02aa65ebf3c_13#lowpass2. = lowpass_band / 31.0; |
| 140 | } |
| 141 | |
| 142 | /* make sure highpass filter is within 90% of what the effective |
| 143 | * highpass frequency will be */ |
| 144 | if (cfg->highpass2cxx . . $ $anonymous_type_fa6ce02aa65ebf3c_13#highpass2. > 0) { |
| 145 | if (cfg->highpass2cxx . . $ $anonymous_type_fa6ce02aa65ebf3c_13#highpass2. < .9 * (.75 / 31.0)) { |
| 146 | cfg->highpass1cxx . . $ $anonymous_type_fa6ce02aa65ebf3c_13#highpass1. = 0; |
| 147 | cfg->highpass2cxx . . $ $anonymous_type_fa6ce02aa65ebf3c_13#highpass2. = 0; |
| 148 | MSGFcxx . . $ `external/lame/util.h:607:9`!(gfc, "Warning: highpass filter disabled. " "highpass frequency too small\n"); |
| 149 | } |
| 150 | } |
| 151 | |
| 152 | if (cfg->highpass2cxx . . $ $anonymous_type_fa6ce02aa65ebf3c_13#highpass2. > 0) { |
| 153 | maxband = -1; |
| 154 | for (band = 0; band <= 31; band++) { |
| 155 | freq = band / 31.0; |
| 156 | /* this band and below will be zereod */ |
| 157 | if (freq <= cfg->highpass1cxx . . $ $anonymous_type_fa6ce02aa65ebf3c_13#highpass1.) { |
| 158 | highpass_band = Maxcxx . . $ `external/lame/util.h:92:17`!(highpass_band, band); |
| 159 | } |
| 160 | if (cfg->highpass1cxx . . $ $anonymous_type_fa6ce02aa65ebf3c_13#highpass1. < freq && freq < cfg->highpass2cxx . . $ $anonymous_type_fa6ce02aa65ebf3c_13#highpass2.) { |
| 161 | maxband = Maxcxx . . $ `external/lame/util.h:92:17`!(maxband, band); |
| 162 | } |
| 163 | } |
| 164 | /* compute the *actual* transition band implemented by |
| 165 | * the polyphase filter */ |
| 166 | cfg->highpass1cxx . . $ $anonymous_type_fa6ce02aa65ebf3c_13#highpass1. = highpass_band / 31.0; |
| 167 | if (maxband == -1) { |
| 168 | cfg->highpass2cxx . . $ $anonymous_type_fa6ce02aa65ebf3c_13#highpass2. = (highpass_band + .75) / 31.0; |
| 169 | } |
| 170 | else { |
| 171 | cfg->highpass2cxx . . $ $anonymous_type_fa6ce02aa65ebf3c_13#highpass2. = (maxband + .75) / 31.0; |
| 172 | } |
| 173 | } |
| 174 | |
| 175 | for (band = 0; band < 32; band++) { |
| 176 | FLOATcxx . . $ FLOAT# fc1, fc2; |
| 177 | freq = band / 31.0f; |
| 178 | if (cfg->highpass2cxx . . $ $anonymous_type_fa6ce02aa65ebf3c_13#highpass2. > cfg->highpass1cxx . . $ $anonymous_type_fa6ce02aa65ebf3c_13#highpass1.) { |
| 179 | fc1 = filter_coefcxx . . $ filter_coef(fbcf3211dfe1bfd1).((cfg->highpass2cxx . . $ $anonymous_type_fa6ce02aa65ebf3c_13#highpass2. - freq) / (cfg->highpass2cxx . . $ $anonymous_type_fa6ce02aa65ebf3c_13#highpass2. - cfg->highpass1cxx . . $ $anonymous_type_fa6ce02aa65ebf3c_13#highpass1. + 1e-20)); |
| 180 | } |
| 181 | else { |
| 182 | fc1 = 1.0f; |
| 183 | } |
| 184 | if (cfg->lowpass2cxx . . $ $anonymous_type_fa6ce02aa65ebf3c_13#lowpass2. > cfg->lowpass1cxx . . $ $anonymous_type_fa6ce02aa65ebf3c_13#lowpass1.) { |
| 185 | fc2 = filter_coefcxx . . $ filter_coef(fbcf3211dfe1bfd1).((freq - cfg->lowpass1cxx . . $ $anonymous_type_fa6ce02aa65ebf3c_13#lowpass1.) / (cfg->lowpass2cxx . . $ $anonymous_type_fa6ce02aa65ebf3c_13#lowpass2. - cfg->lowpass1cxx . . $ $anonymous_type_fa6ce02aa65ebf3c_13#lowpass1. + 1e-20)); |
| 186 | } |
| 187 | else { |
| 188 | fc2 = 1.0f; |
| 189 | } |
| 190 | gfc->sv_enccxx . . $ lame_internal_flags#sv_enc..amp_filtercxx . . $ $anonymous_type_fa6ce02aa65ebf3c_7#amp_filter.[band] = fc1 * fc2; |
| 191 | } |
| 192 | } |
| 193 | |
| 194 | |
| 195 | static void |
| 196 | optimum_bandwidthcxx . . $ optimum_bandwidth(dd9a7e323dfc3594).(double *const lowerlimit, double *const upperlimit, const unsigned bitrate) |
| 197 | { |
| 198 | /* |
| 199 | * Input: |
| 200 | * bitrate total bitrate in kbps |
| 201 | * |
| 202 | * Output: |
| 203 | * lowerlimit: best lowpass frequency limit for input filter in Hz |
| 204 | * upperlimit: best highpass frequency limit for input filter in Hz |
| 205 | */ |
| 206 | int table_index; |
| 207 | |
| 208 | typedef structcxx . . $ optimum_bandwidth(dd9a7e323dfc3594).$anonymous_type_0# { |
| 209 | int bitratecxx . . $ optimum_bandwidth(dd9a7e323dfc3594).$anonymous_type_0#bitrate.; /* only indicative value */ |
| 210 | int lowpasscxx . . $ optimum_bandwidth(dd9a7e323dfc3594).$anonymous_type_0#lowpass.; |
| 211 | } band_pass_tcxx . . $ optimum_bandwidth(dd9a7e323dfc3594).band_pass_t#; |
| 212 | |
| 213 | const band_pass_tcxx . . $ optimum_bandwidth(dd9a7e323dfc3594).band_pass_t# freq_map[] = { |
| 214 | {8, 2000}, |
| 215 | {16, 3700}, |
| 216 | {24, 3900}, |
| 217 | {32, 5500}, |
| 218 | {40, 7000}, |
| 219 | {48, 7500}, |
| 220 | {56, 10000}, |
| 221 | {64, 11000}, |
| 222 | {80, 13500}, |
| 223 | {96, 15100}, |
| 224 | {112, 15600}, |
| 225 | {128, 17000}, |
| 226 | {160, 17500}, |
| 227 | {192, 18600}, |
| 228 | {224, 19400}, |
| 229 | {256, 19700}, |
| 230 | {320, 20500} |
| 231 | }; |
| 232 | |
| 233 | |
| 234 | table_index = nearestBitrateFullIndexcxx . . $ nearestBitrateFullIndex(377f6a3136964dac).(bitrate); |
| 235 | |
| 236 | (void) freq_map[table_index].bitratecxx . . $ optimum_bandwidth(dd9a7e323dfc3594).$anonymous_type_0#bitrate.; |
| 237 | *lowerlimit = freq_map[table_index].lowpasscxx . . $ optimum_bandwidth(dd9a7e323dfc3594).$anonymous_type_0#lowpass.; |
| 238 | |
| 239 | |
| 240 | /* |
| 241 | * Now we try to choose a good high pass filtering frequency. |
| 242 | * This value is currently not used. |
| 243 | * For fu < 16 kHz: sqrt(fu*fl) = 560 Hz |
| 244 | * For fu = 18 kHz: no high pass filtering |
| 245 | * This gives: |
| 246 | * |
| 247 | * 2 kHz => 160 Hz |
| 248 | * 3 kHz => 107 Hz |
| 249 | * 4 kHz => 80 Hz |
| 250 | * 8 kHz => 40 Hz |
| 251 | * 16 kHz => 20 Hz |
| 252 | * 17 kHz => 10 Hz |
| 253 | * 18 kHz => 0 Hz |
| 254 | * |
| 255 | * These are ad hoc values and these can be optimized if a high pass is available. |
| 256 | */ |
| 257 | /* if (f_low <= 16000) |
| 258 | f_high = 16000. * 20. / f_low; |
| 259 | else if (f_low <= 18000) |
| 260 | f_high = 180. - 0.01 * f_low; |
| 261 | else |
| 262 | f_high = 0.;*/ |
| 263 | |
| 264 | /* |
| 265 | * When we sometimes have a good highpass filter, we can add the highpass |
| 266 | * frequency to the lowpass frequency |
| 267 | */ |
| 268 | |
| 269 | /*if (upperlimit != NULL) |
| 270 | *upperlimit = f_high;*/ |
| 271 | (void) upperlimit; |
| 272 | } |
| 273 | |
| 274 | |
| 275 | static int |
| 276 | optimum_samplefreqcxx . . $ optimum_samplefreq(9b79fb6aee4c0440).(int lowpassfreq, int input_samplefreq) |
| 277 | { |
| 278 | /* |
| 279 | * Rules: |
| 280 | * - if possible, sfb21 should NOT be used |
| 281 | * |
| 282 | */ |
| 283 | int suggested_samplefreq = 44100; |
| 284 | |
| 285 | if (input_samplefreq >= 48000) |
| 286 | suggested_samplefreq = 48000; |
| 287 | else if (input_samplefreq >= 44100) |
| 288 | suggested_samplefreq = 44100; |
| 289 | else if (input_samplefreq >= 32000) |
| 290 | suggested_samplefreq = 32000; |
| 291 | else if (input_samplefreq >= 24000) |
| 292 | suggested_samplefreq = 24000; |
| 293 | else if (input_samplefreq >= 22050) |
| 294 | suggested_samplefreq = 22050; |
| 295 | else if (input_samplefreq >= 16000) |
| 296 | suggested_samplefreq = 16000; |
| 297 | else if (input_samplefreq >= 12000) |
| 298 | suggested_samplefreq = 12000; |
| 299 | else if (input_samplefreq >= 11025) |
| 300 | suggested_samplefreq = 11025; |
| 301 | else if (input_samplefreq >= 8000) |
| 302 | suggested_samplefreq = 8000; |
| 303 | |
| 304 | if (lowpassfreq == -1) |
| 305 | return suggested_samplefreq; |
| 306 | |
| 307 | if (lowpassfreq <= 15960) |
| 308 | suggested_samplefreq = 44100; |
| 309 | if (lowpassfreq <= 15250) |
| 310 | suggested_samplefreq = 32000; |
| 311 | if (lowpassfreq <= 11220) |
| 312 | suggested_samplefreq = 24000; |
| 313 | if (lowpassfreq <= 9970) |
| 314 | suggested_samplefreq = 22050; |
| 315 | if (lowpassfreq <= 7230) |
| 316 | suggested_samplefreq = 16000; |
| 317 | if (lowpassfreq <= 5420) |
| 318 | suggested_samplefreq = 12000; |
| 319 | if (lowpassfreq <= 4510) |
| 320 | suggested_samplefreq = 11025; |
| 321 | if (lowpassfreq <= 3970) |
| 322 | suggested_samplefreq = 8000; |
| 323 | |
| 324 | if (input_samplefreq < suggested_samplefreq) { |
| 325 | /* choose a valid MPEG sample frequency above the input sample frequency |
| 326 | to avoid SFB21/12 bitrate bloat |
| 327 | rh 061115 |
| 328 | */ |
| 329 | if (input_samplefreq > 44100) { |
| 330 | return 48000; |
| 331 | } |
| 332 | if (input_samplefreq > 32000) { |
| 333 | return 44100; |
| 334 | } |
| 335 | if (input_samplefreq > 24000) { |
| 336 | return 32000; |
| 337 | } |
| 338 | if (input_samplefreq > 22050) { |
| 339 | return 24000; |
| 340 | } |
| 341 | if (input_samplefreq > 16000) { |
| 342 | return 22050; |
| 343 | } |
| 344 | if (input_samplefreq > 12000) { |
| 345 | return 16000; |
| 346 | } |
| 347 | if (input_samplefreq > 11025) { |
| 348 | return 12000; |
| 349 | } |
| 350 | if (input_samplefreq > 8000) { |
| 351 | return 11025; |
| 352 | } |
| 353 | return 8000; |
| 354 | } |
| 355 | return suggested_samplefreq; |
| 356 | } |
| 357 | |
| 358 | |
| 359 | |
| 360 | |
| 361 | |
| 362 | /* set internal feature flags. USER should not access these since |
| 363 | * some combinations will produce strange results */ |
| 364 | static void |
| 365 | lame_init_qvalcxx . . $ lame_init_qval(a7aecbfd39053bc4).(lame_global_flagscxx . . $ lame_global_flags# * gfp) |
| 366 | { |
| 367 | lame_internal_flagscxx . . $ lame_internal_flags# *const gfc = gfp->internal_flagscxx . . $ lame_global_struct#internal_flags.; |
| 368 | SessionConfig_tcxx . . $ SessionConfig_t# *const cfg = &gfc->cfgcxx . . $ lame_internal_flags#cfg.; |
| 369 | |
| 370 | switch (gfp->qualitycxx . . $ lame_global_struct#quality.) { |
| 371 | default: |
| 372 | case 9: /* no psymodel, no noise shaping */ |
| 373 | cfg->noise_shapingcxx . . $ $anonymous_type_fa6ce02aa65ebf3c_13#noise_shaping. = 0; |
| 374 | cfg->noise_shaping_ampcxx . . $ $anonymous_type_fa6ce02aa65ebf3c_13#noise_shaping_amp. = 0; |
| 375 | cfg->noise_shaping_stopcxx . . $ $anonymous_type_fa6ce02aa65ebf3c_13#noise_shaping_stop. = 0; |
| 376 | cfg->use_best_huffmancxx . . $ $anonymous_type_fa6ce02aa65ebf3c_13#use_best_huffman. = 0; |
| 377 | cfg->full_outer_loopcxx . . $ $anonymous_type_fa6ce02aa65ebf3c_13#full_outer_loop. = 0; |
| 378 | break; |
| 379 | |
| 380 | case 8: |
| 381 | gfp->qualitycxx . . $ lame_global_struct#quality. = 7; |
| 382 | /*lint --fallthrough */ |
| 383 | case 7: /* use psymodel (for short block and m/s switching), but no noise shapping */ |
| 384 | cfg->noise_shapingcxx . . $ $anonymous_type_fa6ce02aa65ebf3c_13#noise_shaping. = 0; |
| 385 | cfg->noise_shaping_ampcxx . . $ $anonymous_type_fa6ce02aa65ebf3c_13#noise_shaping_amp. = 0; |
| 386 | cfg->noise_shaping_stopcxx . . $ $anonymous_type_fa6ce02aa65ebf3c_13#noise_shaping_stop. = 0; |
| 387 | cfg->use_best_huffmancxx . . $ $anonymous_type_fa6ce02aa65ebf3c_13#use_best_huffman. = 0; |
| 388 | cfg->full_outer_loopcxx . . $ $anonymous_type_fa6ce02aa65ebf3c_13#full_outer_loop. = 0; |
| 389 | if (cfg->vbrcxx . . $ $anonymous_type_fa6ce02aa65ebf3c_13#vbr. == vbr_mtcxx . . $ vbr_mt. || cfg->vbrcxx . . $ $anonymous_type_fa6ce02aa65ebf3c_13#vbr. == vbr_mtrhcxx . . $ vbr_mtrh.) { |
| 390 | cfg->full_outer_loopcxx . . $ $anonymous_type_fa6ce02aa65ebf3c_13#full_outer_loop. = -1; |
| 391 | } |
| 392 | break; |
| 393 | |
| 394 | case 6: |
| 395 | if (cfg->noise_shapingcxx . . $ $anonymous_type_fa6ce02aa65ebf3c_13#noise_shaping. == 0) |
| 396 | cfg->noise_shapingcxx . . $ $anonymous_type_fa6ce02aa65ebf3c_13#noise_shaping. = 1; |
| 397 | cfg->noise_shaping_ampcxx . . $ $anonymous_type_fa6ce02aa65ebf3c_13#noise_shaping_amp. = 0; |
| 398 | cfg->noise_shaping_stopcxx . . $ $anonymous_type_fa6ce02aa65ebf3c_13#noise_shaping_stop. = 0; |
| 399 | if (cfg->subblock_gaincxx . . $ $anonymous_type_fa6ce02aa65ebf3c_13#subblock_gain. == -1) |
| 400 | cfg->subblock_gaincxx . . $ $anonymous_type_fa6ce02aa65ebf3c_13#subblock_gain. = 1; |
| 401 | cfg->use_best_huffmancxx . . $ $anonymous_type_fa6ce02aa65ebf3c_13#use_best_huffman. = 0; |
| 402 | cfg->full_outer_loopcxx . . $ $anonymous_type_fa6ce02aa65ebf3c_13#full_outer_loop. = 0; |
| 403 | break; |
| 404 | |
| 405 | case 5: |
| 406 | if (cfg->noise_shapingcxx . . $ $anonymous_type_fa6ce02aa65ebf3c_13#noise_shaping. == 0) |
| 407 | cfg->noise_shapingcxx . . $ $anonymous_type_fa6ce02aa65ebf3c_13#noise_shaping. = 1; |
| 408 | cfg->noise_shaping_ampcxx . . $ $anonymous_type_fa6ce02aa65ebf3c_13#noise_shaping_amp. = 0; |
| 409 | cfg->noise_shaping_stopcxx . . $ $anonymous_type_fa6ce02aa65ebf3c_13#noise_shaping_stop. = 0; |
| 410 | if (cfg->subblock_gaincxx . . $ $anonymous_type_fa6ce02aa65ebf3c_13#subblock_gain. == -1) |
| 411 | cfg->subblock_gaincxx . . $ $anonymous_type_fa6ce02aa65ebf3c_13#subblock_gain. = 1; |
| 412 | cfg->use_best_huffmancxx . . $ $anonymous_type_fa6ce02aa65ebf3c_13#use_best_huffman. = 0; |
| 413 | cfg->full_outer_loopcxx . . $ $anonymous_type_fa6ce02aa65ebf3c_13#full_outer_loop. = 0; |
| 414 | break; |
| 415 | |
| 416 | case 4: |
| 417 | if (cfg->noise_shapingcxx . . $ $anonymous_type_fa6ce02aa65ebf3c_13#noise_shaping. == 0) |
| 418 | cfg->noise_shapingcxx . . $ $anonymous_type_fa6ce02aa65ebf3c_13#noise_shaping. = 1; |
| 419 | cfg->noise_shaping_ampcxx . . $ $anonymous_type_fa6ce02aa65ebf3c_13#noise_shaping_amp. = 0; |
| 420 | cfg->noise_shaping_stopcxx . . $ $anonymous_type_fa6ce02aa65ebf3c_13#noise_shaping_stop. = 0; |
| 421 | if (cfg->subblock_gaincxx . . $ $anonymous_type_fa6ce02aa65ebf3c_13#subblock_gain. == -1) |
| 422 | cfg->subblock_gaincxx . . $ $anonymous_type_fa6ce02aa65ebf3c_13#subblock_gain. = 1; |
| 423 | cfg->use_best_huffmancxx . . $ $anonymous_type_fa6ce02aa65ebf3c_13#use_best_huffman. = 1; |
| 424 | cfg->full_outer_loopcxx . . $ $anonymous_type_fa6ce02aa65ebf3c_13#full_outer_loop. = 0; |
| 425 | break; |
| 426 | |
| 427 | case 3: |
| 428 | if (cfg->noise_shapingcxx . . $ $anonymous_type_fa6ce02aa65ebf3c_13#noise_shaping. == 0) |
| 429 | cfg->noise_shapingcxx . . $ $anonymous_type_fa6ce02aa65ebf3c_13#noise_shaping. = 1; |
| 430 | cfg->noise_shaping_ampcxx . . $ $anonymous_type_fa6ce02aa65ebf3c_13#noise_shaping_amp. = 1; |
| 431 | cfg->noise_shaping_stopcxx . . $ $anonymous_type_fa6ce02aa65ebf3c_13#noise_shaping_stop. = 1; |
| 432 | if (cfg->subblock_gaincxx . . $ $anonymous_type_fa6ce02aa65ebf3c_13#subblock_gain. == -1) |
| 433 | cfg->subblock_gaincxx . . $ $anonymous_type_fa6ce02aa65ebf3c_13#subblock_gain. = 1; |
| 434 | cfg->use_best_huffmancxx . . $ $anonymous_type_fa6ce02aa65ebf3c_13#use_best_huffman. = 1; |
| 435 | cfg->full_outer_loopcxx . . $ $anonymous_type_fa6ce02aa65ebf3c_13#full_outer_loop. = 0; |
| 436 | break; |
| 437 | |
| 438 | case 2: |
| 439 | if (cfg->noise_shapingcxx . . $ $anonymous_type_fa6ce02aa65ebf3c_13#noise_shaping. == 0) |
| 440 | cfg->noise_shapingcxx . . $ $anonymous_type_fa6ce02aa65ebf3c_13#noise_shaping. = 1; |
| 441 | if (gfc->sv_qntcxx . . $ lame_internal_flags#sv_qnt..substep_shapingcxx . . $ $anonymous_type_fa6ce02aa65ebf3c_10#substep_shaping. == 0) |
| 442 | gfc->sv_qntcxx . . $ lame_internal_flags#sv_qnt..substep_shapingcxx . . $ $anonymous_type_fa6ce02aa65ebf3c_10#substep_shaping. = 2; |
| 443 | cfg->noise_shaping_ampcxx . . $ $anonymous_type_fa6ce02aa65ebf3c_13#noise_shaping_amp. = 1; |
| 444 | cfg->noise_shaping_stopcxx . . $ $anonymous_type_fa6ce02aa65ebf3c_13#noise_shaping_stop. = 1; |
| 445 | if (cfg->subblock_gaincxx . . $ $anonymous_type_fa6ce02aa65ebf3c_13#subblock_gain. == -1) |
| 446 | cfg->subblock_gaincxx . . $ $anonymous_type_fa6ce02aa65ebf3c_13#subblock_gain. = 1; |
| 447 | cfg->use_best_huffmancxx . . $ $anonymous_type_fa6ce02aa65ebf3c_13#use_best_huffman. = 1; /* inner loop */ |
| 448 | cfg->full_outer_loopcxx . . $ $anonymous_type_fa6ce02aa65ebf3c_13#full_outer_loop. = 0; |
| 449 | break; |
| 450 | |
| 451 | case 1: |
| 452 | if (cfg->noise_shapingcxx . . $ $anonymous_type_fa6ce02aa65ebf3c_13#noise_shaping. == 0) |
| 453 | cfg->noise_shapingcxx . . $ $anonymous_type_fa6ce02aa65ebf3c_13#noise_shaping. = 1; |
| 454 | if (gfc->sv_qntcxx . . $ lame_internal_flags#sv_qnt..substep_shapingcxx . . $ $anonymous_type_fa6ce02aa65ebf3c_10#substep_shaping. == 0) |
| 455 | gfc->sv_qntcxx . . $ lame_internal_flags#sv_qnt..substep_shapingcxx . . $ $anonymous_type_fa6ce02aa65ebf3c_10#substep_shaping. = 2; |
| 456 | cfg->noise_shaping_ampcxx . . $ $anonymous_type_fa6ce02aa65ebf3c_13#noise_shaping_amp. = 2; |
| 457 | cfg->noise_shaping_stopcxx . . $ $anonymous_type_fa6ce02aa65ebf3c_13#noise_shaping_stop. = 1; |
| 458 | if (cfg->subblock_gaincxx . . $ $anonymous_type_fa6ce02aa65ebf3c_13#subblock_gain. == -1) |
| 459 | cfg->subblock_gaincxx . . $ $anonymous_type_fa6ce02aa65ebf3c_13#subblock_gain. = 1; |
| 460 | cfg->use_best_huffmancxx . . $ $anonymous_type_fa6ce02aa65ebf3c_13#use_best_huffman. = 1; |
| 461 | cfg->full_outer_loopcxx . . $ $anonymous_type_fa6ce02aa65ebf3c_13#full_outer_loop. = 0; |
| 462 | break; |
| 463 | |
| 464 | case 0: |
| 465 | if (cfg->noise_shapingcxx . . $ $anonymous_type_fa6ce02aa65ebf3c_13#noise_shaping. == 0) |
| 466 | cfg->noise_shapingcxx . . $ $anonymous_type_fa6ce02aa65ebf3c_13#noise_shaping. = 1; |
| 467 | if (gfc->sv_qntcxx . . $ lame_internal_flags#sv_qnt..substep_shapingcxx . . $ $anonymous_type_fa6ce02aa65ebf3c_10#substep_shaping. == 0) |
| 468 | gfc->sv_qntcxx . . $ lame_internal_flags#sv_qnt..substep_shapingcxx . . $ $anonymous_type_fa6ce02aa65ebf3c_10#substep_shaping. = 2; |
| 469 | cfg->noise_shaping_ampcxx . . $ $anonymous_type_fa6ce02aa65ebf3c_13#noise_shaping_amp. = 2; |
| 470 | cfg->noise_shaping_stopcxx . . $ $anonymous_type_fa6ce02aa65ebf3c_13#noise_shaping_stop. = 1; |
| 471 | if (cfg->subblock_gaincxx . . $ $anonymous_type_fa6ce02aa65ebf3c_13#subblock_gain. == -1) |
| 472 | cfg->subblock_gaincxx . . $ $anonymous_type_fa6ce02aa65ebf3c_13#subblock_gain. = 1; |
| 473 | cfg->use_best_huffmancxx . . $ $anonymous_type_fa6ce02aa65ebf3c_13#use_best_huffman. = 1; /*type 2 disabled because of it slowness, |
| 474 | in favor of full outer loop search */ |
| 475 | cfg->full_outer_loopcxx . . $ $anonymous_type_fa6ce02aa65ebf3c_13#full_outer_loop. = 1; |
| 476 | break; |
| 477 | } |
| 478 | |
| 479 | } |
| 480 | |
| 481 | |
| 482 | |
| 483 | static double |
| 484 | linear_intcxx . . $ linear_int(7678bba071383ab).(double a, double b, double m) |
| 485 | { |
| 486 | return a + m * (b - a); |
| 487 | } |
| 488 | |
| 489 | |
| 490 | |
| 491 | /******************************************************************** |
| 492 | * initialize internal params based on data in gf |
| 493 | * (globalflags struct filled in by calling program) |
| 494 | * |
| 495 | * OUTLINE: |
| 496 | * |
| 497 | * We first have some complex code to determine bitrate, |
| 498 | * output samplerate and mode. It is complicated by the fact |
| 499 | * that we allow the user to set some or all of these parameters, |
| 500 | * and need to determine best possible values for the rest of them: |
| 501 | * |
| 502 | * 1. set some CPU related flags |
| 503 | * 2. check if we are mono->mono, stereo->mono or stereo->stereo |
| 504 | * 3. compute bitrate and output samplerate: |
| 505 | * user may have set compression ratio |
| 506 | * user may have set a bitrate |
| 507 | * user may have set a output samplerate |
| 508 | * 4. set some options which depend on output samplerate |
| 509 | * 5. compute the actual compression ratio |
| 510 | * 6. set mode based on compression ratio |
| 511 | * |
| 512 | * The remaining code is much simpler - it just sets options |
| 513 | * based on the mode & compression ratio: |
| 514 | * |
| 515 | * set allow_diff_short based on mode |
| 516 | * select lowpass filter based on compression ratio & mode |
| 517 | * set the bitrate index, and min/max bitrates for VBR modes |
| 518 | * disable VBR tag if it is not appropriate |
| 519 | * initialize the bitstream |
| 520 | * initialize scalefac_band data |
| 521 | * set sideinfo_len (based on channels, CRC, out_samplerate) |
| 522 | * write an id3v2 tag into the bitstream |
| 523 | * write VBR tag into the bitstream |
| 524 | * set mpeg1/2 flag |
| 525 | * estimate the number of frames (based on a lot of data) |
| 526 | * |
| 527 | * now we set more flags: |
| 528 | * nspsytune: |
| 529 | * see code |
| 530 | * VBR modes |
| 531 | * see code |
| 532 | * CBR/ABR |
| 533 | * see code |
| 534 | * |
| 535 | * Finally, we set the algorithm flags based on the gfp->quality value |
| 536 | * lame_init_qval(gfp); |
| 537 | * |
| 538 | ********************************************************************/ |
| 539 | int |
| 540 | lame_init_paramscxx . . $ lame_init_params(12e50c934c2e73e2).(lame_global_flagscxx . . $ lame_global_flags# * gfp) |
| 541 | { |
| 542 | |
| 543 | int i; |
| 544 | int j; |
| 545 | lame_internal_flagscxx . . $ lame_internal_flags# *gfc; |
| 546 | SessionConfig_tcxx . . $ SessionConfig_t# *cfg; |
| 547 | |
| 548 | if (!is_lame_global_flags_validcxx . . $ is_lame_global_flags_valid(a5abb0ff158568ac).(gfp)) |
| 549 | return -1; |
| 550 | |
| 551 | gfc = gfp->internal_flagscxx . . $ lame_global_struct#internal_flags.; |
| 552 | if (gfc == 0) |
| 553 | return -1; |
| 554 | |
| 555 | if (is_lame_internal_flags_validcxx . . $ is_lame_internal_flags_valid(b815612886108da).(gfc)) |
| 556 | return -1; /* already initialized */ |
| 557 | |
| 558 | /* start updating lame internal flags */ |
| 559 | gfc->class_idcxx . . $ lame_internal_flags#class_id. = LAME_IDcxx . . $ `external/lame/util.h:483:12`!; |
| 560 | gfc->lame_init_params_successfulcxx . . $ lame_internal_flags#lame_init_params_successful. = 0; /* will be set to one, when we get through until the end */ |
| 561 | |
| 562 | if (gfp->samplerate_incxx . . $ lame_global_struct#samplerate_in. < 1) |
| 563 | return -1; /* input sample rate makes no sense */ |
| 564 | if (gfp->num_channelscxx . . $ lame_global_struct#num_channels. < 1 || 2 < gfp->num_channelscxx . . $ lame_global_struct#num_channels.) |
| 565 | return -1; /* number of input channels makes no sense */ |
| 566 | if (gfp->samplerate_outcxx . . $ lame_global_struct#samplerate_out. != 0) { |
| 567 | int v=0; |
| 568 | if (SmpFrqIndexcxx . . $ SmpFrqIndex(ac48f4a6ffa9e770).(gfp->samplerate_outcxx . . $ lame_global_struct#samplerate_out., &v) < 0) |
| 569 | return -1; /* output sample rate makes no sense */ |
| 570 | } |
| 571 | |
| 572 | cfg = &gfc->cfgcxx . . $ lame_internal_flags#cfg.; |
| 573 | |
| 574 | cfg->enforce_min_bitratecxx . . $ $anonymous_type_fa6ce02aa65ebf3c_13#enforce_min_bitrate. = gfp->VBR_hard_mincxx . . $ lame_global_struct#VBR_hard_min.; |
| 575 | cfg->analysiscxx . . $ $anonymous_type_fa6ce02aa65ebf3c_13#analysis. = gfp->analysiscxx . . $ lame_global_struct#analysis.; |
| 576 | if (cfg->analysiscxx . . $ $anonymous_type_fa6ce02aa65ebf3c_13#analysis.) |
| 577 | gfp->write_lame_tagcxx . . $ lame_global_struct#write_lame_tag. = 0; |
| 578 | |
| 579 | /* some file options not allowed if output is: not specified or stdout */ |
| 580 | if (gfc->pinfocxx . . $ lame_internal_flags#pinfo. != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) |
| 581 | gfp->write_lame_tagcxx . . $ lame_global_struct#write_lame_tag. = 0; /* disable Xing VBR tag */ |
| 582 | |
| 583 | /* report functions */ |
| 584 | gfc->report_msgcxx . . $ lame_internal_flags#report_msg. = gfp->reportcxx . . $ lame_global_struct#report..msgfcxx . . $ lame_global_struct#$anonymous_type_0#msgf.; |
| 585 | gfc->report_dbgcxx . . $ lame_internal_flags#report_dbg. = gfp->reportcxx . . $ lame_global_struct#report..debugfcxx . . $ lame_global_struct#$anonymous_type_0#debugf.; |
| 586 | gfc->report_errcxx . . $ lame_internal_flags#report_err. = gfp->reportcxx . . $ lame_global_struct#report..errorfcxx . . $ lame_global_struct#$anonymous_type_0#errorf.; |
| 587 | |
| 588 | if (gfp->asm_optimizationscxx . . $ lame_global_struct#asm_optimizations..amd3dnowcxx . . $ lame_global_struct#$anonymous_type_1#amd3dnow.) |
| 589 | gfc->CPU_featurescxx . . $ lame_internal_flags#CPU_features..AMD_3DNowcxx . . $ lame_internal_flags#$anonymous_type_14#AMD_3DNow. = has_3DNowcxx . . $ has_3DNow(b126dc7c1de90089).(); |
| 590 | else |
| 591 | gfc->CPU_featurescxx . . $ lame_internal_flags#CPU_features..AMD_3DNowcxx . . $ lame_internal_flags#$anonymous_type_14#AMD_3DNow. = 0; |
| 592 | |
| 593 | if (gfp->asm_optimizationscxx . . $ lame_global_struct#asm_optimizations..mmxcxx . . $ lame_global_struct#$anonymous_type_1#mmx.) |
| 594 | gfc->CPU_featurescxx . . $ lame_internal_flags#CPU_features..MMXcxx . . $ lame_internal_flags#$anonymous_type_14#MMX. = has_MMXcxx . . $ has_MMX(b126dc7c1de90089).(); |
| 595 | else |
| 596 | gfc->CPU_featurescxx . . $ lame_internal_flags#CPU_features..MMXcxx . . $ lame_internal_flags#$anonymous_type_14#MMX. = 0; |
| 597 | |
| 598 | if (gfp->asm_optimizationscxx . . $ lame_global_struct#asm_optimizations..ssecxx . . $ lame_global_struct#$anonymous_type_1#sse.) { |
| 599 | gfc->CPU_featurescxx . . $ lame_internal_flags#CPU_features..SSEcxx . . $ lame_internal_flags#$anonymous_type_14#SSE. = has_SSEcxx . . $ has_SSE(b126dc7c1de90089).(); |
| 600 | gfc->CPU_featurescxx . . $ lame_internal_flags#CPU_features..SSE2cxx . . $ lame_internal_flags#$anonymous_type_14#SSE2. = has_SSE2cxx . . $ has_SSE2(b126dc7c1de90089).(); |
| 601 | } |
| 602 | else { |
| 603 | gfc->CPU_featurescxx . . $ lame_internal_flags#CPU_features..SSEcxx . . $ lame_internal_flags#$anonymous_type_14#SSE. = 0; |
| 604 | gfc->CPU_featurescxx . . $ lame_internal_flags#CPU_features..SSE2cxx . . $ lame_internal_flags#$anonymous_type_14#SSE2. = 0; |
| 605 | } |
| 606 | |
| 607 | |
| 608 | cfg->vbrcxx . . $ $anonymous_type_fa6ce02aa65ebf3c_13#vbr. = gfp->VBRcxx . . $ lame_global_struct#VBR.; |
| 609 | cfg->error_protectioncxx . . $ $anonymous_type_fa6ce02aa65ebf3c_13#error_protection. = gfp->error_protectioncxx . . $ lame_global_struct#error_protection.; |
| 610 | cfg->copyrightcxx . . $ $anonymous_type_fa6ce02aa65ebf3c_13#copyright. = gfp->copyrightcxx . . $ lame_global_struct#copyright.; |
| 611 | cfg->originalcxx . . $ $anonymous_type_fa6ce02aa65ebf3c_13#original. = gfp->originalcxx . . $ lame_global_struct#original.; |
| 612 | cfg->extensioncxx . . $ $anonymous_type_fa6ce02aa65ebf3c_13#extension. = gfp->extensioncxx . . $ lame_global_struct#extension.; |
| 613 | cfg->emphasiscxx . . $ $anonymous_type_fa6ce02aa65ebf3c_13#emphasis. = gfp->emphasiscxx . . $ lame_global_struct#emphasis.; |
| 614 | |
| 615 | cfg->channels_incxx . . $ $anonymous_type_fa6ce02aa65ebf3c_13#channels_in. = gfp->num_channelscxx . . $ lame_global_struct#num_channels.; |
| 616 | if (cfg->channels_incxx . . $ $anonymous_type_fa6ce02aa65ebf3c_13#channels_in. == 1) |
| 617 | gfp->modecxx . . $ lame_global_struct#mode. = MONOcxx . . $ MONO.; |
| 618 | cfg->channels_outcxx . . $ $anonymous_type_fa6ce02aa65ebf3c_13#channels_out. = (gfp->modecxx . . $ lame_global_struct#mode. == MONOcxx . . $ MONO.) ? 1 : 2; |
| 619 | if (gfp->modecxx . . $ lame_global_struct#mode. != JOINT_STEREOcxx . . $ JOINT_STEREO.) |
| 620 | gfp->force_mscxx . . $ lame_global_struct#force_ms. = 0; /* forced mid/side stereo for j-stereo only */ |
| 621 | cfg->force_mscxx . . $ $anonymous_type_fa6ce02aa65ebf3c_13#force_ms. = gfp->force_mscxx . . $ lame_global_struct#force_ms.; |
| 622 | |
| 623 | if (cfg->vbrcxx . . $ $anonymous_type_fa6ce02aa65ebf3c_13#vbr. == vbr_offcxx . . $ vbr_off. && gfp->VBR_mean_bitrate_kbpscxx . . $ lame_global_struct#VBR_mean_bitrate_kbps. != 128 && gfp->bratecxx . . $ lame_global_struct#brate. == 0) |
| 624 | gfp->bratecxx . . $ lame_global_struct#brate. = gfp->VBR_mean_bitrate_kbpscxx . . $ lame_global_struct#VBR_mean_bitrate_kbps.; |
| 625 | |
| 626 | switch (cfg->vbrcxx . . $ $anonymous_type_fa6ce02aa65ebf3c_13#vbr.) { |
| 627 | case vbr_offcxx . . $ vbr_off.: |
| 628 | case vbr_mtrhcxx . . $ vbr_mtrh.: |
| 629 | case vbr_mtcxx . . $ vbr_mt.: |
| 630 | /* these modes can handle free format condition */ |
| 631 | break; |
| 632 | default: |
| 633 | gfp->free_formatcxx . . $ lame_global_struct#free_format. = 0; /* mode can't be mixed with free format */ |
| 634 | break; |
| 635 | } |
| 636 | |
| 637 | cfg->free_formatcxx . . $ $anonymous_type_fa6ce02aa65ebf3c_13#free_format. = gfp->free_formatcxx . . $ lame_global_struct#free_format.; |
| 638 | |
| 639 | if (cfg->vbrcxx . . $ $anonymous_type_fa6ce02aa65ebf3c_13#vbr. == vbr_offcxx . . $ vbr_off. && gfp->bratecxx . . $ lame_global_struct#brate. == 0) { |
| 640 | /* no bitrate or compression ratio specified, use 11.025 */ |
| 641 | if (EQcxx . . $ `external/lame/machine.h:169:9`!(gfp->compression_ratio, 0)) |
| 642 | gfp->compression_ratiocxx . . $ lame_global_struct#compression_ratio. = 11.025; /* rate to compress a CD down to exactly 128000 bps */ |
| 643 | } |
| 644 | |
| 645 | /* find bitrate if user specify a compression ratio */ |
| 646 | if (cfg->vbrcxx . . $ $anonymous_type_fa6ce02aa65ebf3c_13#vbr. == vbr_offcxx . . $ vbr_off. && gfp->compression_ratiocxx . . $ lame_global_struct#compression_ratio. > 0) { |
| 647 | |
| 648 | if (gfp->samplerate_outcxx . . $ lame_global_struct#samplerate_out. == 0) |
| 649 | gfp->samplerate_outcxx . . $ lame_global_struct#samplerate_out. = map2MP3Frequencycxx . . $ map2MP3Frequency(7864480464b09eea).((int) (0.97 * gfp->samplerate_incxx . . $ lame_global_struct#samplerate_in.)); /* round up with a margin of 3% */ |
| 650 | |
| 651 | /* choose a bitrate for the output samplerate which achieves |
| 652 | * specified compression ratio |
| 653 | */ |
| 654 | gfp->bratecxx . . $ lame_global_struct#brate. = gfp->samplerate_outcxx . . $ lame_global_struct#samplerate_out. * 16 * cfg->channels_outcxx . . $ $anonymous_type_fa6ce02aa65ebf3c_13#channels_out. / (1.e3 * gfp->compression_ratiocxx . . $ lame_global_struct#compression_ratio.); |
| 655 | |
| 656 | /* we need the version for the bitrate table look up */ |
| 657 | cfg->samplerate_indexcxx . . $ $anonymous_type_fa6ce02aa65ebf3c_13#samplerate_index. = SmpFrqIndexcxx . . $ SmpFrqIndex(ac48f4a6ffa9e770).(gfp->samplerate_outcxx . . $ lame_global_struct#samplerate_out., &cfg->versioncxx . . $ $anonymous_type_fa6ce02aa65ebf3c_13#version.); |
| 658 | assertcxx . . $ `<external>/4398592474888995393/assert.h:118:11`!(cfg->samplerate_index >=0); |
| 659 | |
| 660 | if (!cfg->free_formatcxx . . $ $anonymous_type_fa6ce02aa65ebf3c_13#free_format.) /* for non Free Format find the nearest allowed bitrate */ |
| 661 | gfp->bratecxx . . $ lame_global_struct#brate. = FindNearestBitratecxx . . $ FindNearestBitrate(2326284602b0bb2d).(gfp->bratecxx . . $ lame_global_struct#brate., cfg->versioncxx . . $ $anonymous_type_fa6ce02aa65ebf3c_13#version., gfp->samplerate_outcxx . . $ lame_global_struct#samplerate_out.); |
| 662 | } |
| 663 | if (gfp->samplerate_outcxx . . $ lame_global_struct#samplerate_out.) { |
| 664 | if (gfp->samplerate_outcxx . . $ lame_global_struct#samplerate_out. < 16000) { |
| 665 | gfp->VBR_mean_bitrate_kbpscxx . . $ lame_global_struct#VBR_mean_bitrate_kbps. = Maxcxx . . $ `external/lame/util.h:92:17`!(gfp->VBR_mean_bitrate_kbps, 8); |
| 666 | gfp->VBR_mean_bitrate_kbpscxx . . $ lame_global_struct#VBR_mean_bitrate_kbps. = Mincxx . . $ `external/lame/util.h:91:17`!(gfp->VBR_mean_bitrate_kbps, 64); |
| 667 | } |
| 668 | else if (gfp->samplerate_outcxx . . $ lame_global_struct#samplerate_out. < 32000) { |
| 669 | gfp->VBR_mean_bitrate_kbpscxx . . $ lame_global_struct#VBR_mean_bitrate_kbps. = Maxcxx . . $ `external/lame/util.h:92:17`!(gfp->VBR_mean_bitrate_kbps, 8); |
| 670 | gfp->VBR_mean_bitrate_kbpscxx . . $ lame_global_struct#VBR_mean_bitrate_kbps. = Mincxx . . $ `external/lame/util.h:91:17`!(gfp->VBR_mean_bitrate_kbps, 160); |
| 671 | } |
| 672 | else { |
| 673 | gfp->VBR_mean_bitrate_kbpscxx . . $ lame_global_struct#VBR_mean_bitrate_kbps. = Maxcxx . . $ `external/lame/util.h:92:17`!(gfp->VBR_mean_bitrate_kbps, 32); |
| 674 | gfp->VBR_mean_bitrate_kbpscxx . . $ lame_global_struct#VBR_mean_bitrate_kbps. = Mincxx . . $ `external/lame/util.h:91:17`!(gfp->VBR_mean_bitrate_kbps, 320); |
| 675 | } |
| 676 | } |
| 677 | /* WORK IN PROGRESS */ |
| 678 | /* mapping VBR scale to internal VBR quality settings */ |
| 679 | if (gfp->samplerate_outcxx . . $ lame_global_struct#samplerate_out. == 0 && (cfg->vbrcxx . . $ $anonymous_type_fa6ce02aa65ebf3c_13#vbr. == vbr_mtcxx . . $ vbr_mt. || cfg->vbrcxx . . $ $anonymous_type_fa6ce02aa65ebf3c_13#vbr. == vbr_mtrhcxx . . $ vbr_mtrh.)) { |
| 680 | float const qval = gfp->VBR_qcxx . . $ lame_global_struct#VBR_q. + gfp->VBR_q_fraccxx . . $ lame_global_struct#VBR_q_frac.; |
| 681 | struct q_mapcxx . . $ lame_init_params(12e50c934c2e73e2).q_map# { int sr_acxx . . $ lame_init_params(12e50c934c2e73e2).q_map#sr_a.; float qacxx . . $ lame_init_params(12e50c934c2e73e2).q_map#qa., qbcxx . . $ lame_init_params(12e50c934c2e73e2).q_map#qb., tacxx . . $ lame_init_params(12e50c934c2e73e2).q_map#ta., tbcxx . . $ lame_init_params(12e50c934c2e73e2).q_map#tb.; int lpcxx . . $ lame_init_params(12e50c934c2e73e2).q_map#lp.; }; |
| 682 | struct q_mapcxx . . $ lame_init_params(12e50c934c2e73e2).q_map# const m[9] |
| 683 | = { {48000, 0.0,6.5, 0.0,6.5, 23700} |
| 684 | , {44100, 0.0,6.5, 0.0,6.5, 21780} |
| 685 | , {32000, 6.5,8.0, 5.2,6.5, 15800} |
| 686 | , {24000, 8.0,8.5, 5.2,6.0, 11850} |
| 687 | , {22050, 8.5,9.01, 5.2,6.5, 10892} |
| 688 | , {16000, 9.01,9.4, 4.9,6.5, 7903} |
| 689 | , {12000, 9.4,9.6, 4.5,6.0, 5928} |
| 690 | , {11025, 9.6,9.9, 5.1,6.5, 5446} |
| 691 | , { 8000, 9.9,10., 4.9,6.5, 3952} |
| 692 | }; |
| 693 | for (i = 2; i < 9; ++i) { |
| 694 | if (gfp->samplerate_incxx . . $ lame_global_struct#samplerate_in. == m[i].sr_acxx . . $ lame_init_params(12e50c934c2e73e2).q_map#sr_a.) { |
| 695 | if (qval < m[i].qacxx . . $ lame_init_params(12e50c934c2e73e2).q_map#qa.) { |
| 696 | double d = qval / m[i].qacxx . . $ lame_init_params(12e50c934c2e73e2).q_map#qa.; |
| 697 | d = d * m[i].tacxx . . $ lame_init_params(12e50c934c2e73e2).q_map#ta.; |
| 698 | gfp->VBR_qcxx . . $ lame_global_struct#VBR_q. = (int)d; |
| 699 | gfp->VBR_q_fraccxx . . $ lame_global_struct#VBR_q_frac. = d - gfp->VBR_qcxx . . $ lame_global_struct#VBR_q.; |
| 700 | } |
| 701 | } |
| 702 | if (gfp->samplerate_incxx . . $ lame_global_struct#samplerate_in. >= m[i].sr_acxx . . $ lame_init_params(12e50c934c2e73e2).q_map#sr_a.) { |
| 703 | if (m[i].qacxx . . $ lame_init_params(12e50c934c2e73e2).q_map#qa. <= qval && qval < m[i].qbcxx . . $ lame_init_params(12e50c934c2e73e2).q_map#qb.) { |
| 704 | float const q_ = m[i].qbcxx . . $ lame_init_params(12e50c934c2e73e2).q_map#qb.-m[i].qacxx . . $ lame_init_params(12e50c934c2e73e2).q_map#qa.; |
| 705 | float const t_ = m[i].tbcxx . . $ lame_init_params(12e50c934c2e73e2).q_map#tb.-m[i].tacxx . . $ lame_init_params(12e50c934c2e73e2).q_map#ta.; |
| 706 | double d = m[i].tacxx . . $ lame_init_params(12e50c934c2e73e2).q_map#ta. + t_ * (qval-m[i].qacxx . . $ lame_init_params(12e50c934c2e73e2).q_map#qa.) / q_; |
| 707 | gfp->VBR_qcxx . . $ lame_global_struct#VBR_q. = (int)d; |
| 708 | gfp->VBR_q_fraccxx . . $ lame_global_struct#VBR_q_frac. = d - gfp->VBR_qcxx . . $ lame_global_struct#VBR_q.; |
| 709 | gfp->samplerate_outcxx . . $ lame_global_struct#samplerate_out. = m[i].sr_acxx . . $ lame_init_params(12e50c934c2e73e2).q_map#sr_a.; |
| 710 | if (gfp->lowpassfreqcxx . . $ lame_global_struct#lowpassfreq. == 0) { |
| 711 | gfp->lowpassfreqcxx . . $ lame_global_struct#lowpassfreq. = -1; |
| 712 | } |
| 713 | break; |
| 714 | } |
| 715 | } |
| 716 | } |
| 717 | } |
| 718 | |
| 719 | /****************************************************************/ |
| 720 | /* if a filter has not been enabled, see if we should add one: */ |
| 721 | /****************************************************************/ |
| 722 | if (gfp->lowpassfreqcxx . . $ lame_global_struct#lowpassfreq. == 0) { |
| 723 | double lowpass = 16000; |
| 724 | double highpass; |
| 725 | |
| 726 | switch (cfg->vbrcxx . . $ $anonymous_type_fa6ce02aa65ebf3c_13#vbr.) { |
| 727 | case vbr_offcxx . . $ vbr_off.:{ |
| 728 | optimum_bandwidthcxx . . $ optimum_bandwidth(dd9a7e323dfc3594).(&lowpass, &highpass, gfp->bratecxx . . $ lame_global_struct#brate.); |
| 729 | break; |
| 730 | } |
| 731 | case vbr_abrcxx . . $ vbr_abr.:{ |
| 732 | optimum_bandwidthcxx . . $ optimum_bandwidth(dd9a7e323dfc3594).(&lowpass, &highpass, gfp->VBR_mean_bitrate_kbpscxx . . $ lame_global_struct#VBR_mean_bitrate_kbps.); |
| 733 | break; |
| 734 | } |
| 735 | case vbr_rhcxx . . $ vbr_rh.:{ |
| 736 | int const x[11] = { |
| 737 | 19500, 19000, 18600, 18000, 17500, 16000, 15600, 14900, 12500, 10000, 3950 |
| 738 | }; |
| 739 | if (0 <= gfp->VBR_qcxx . . $ lame_global_struct#VBR_q. && gfp->VBR_qcxx . . $ lame_global_struct#VBR_q. <= 9) { |
| 740 | double a = x[gfp->VBR_qcxx . . $ lame_global_struct#VBR_q.], b = x[gfp->VBR_qcxx . . $ lame_global_struct#VBR_q. + 1], m = gfp->VBR_q_fraccxx . . $ lame_global_struct#VBR_q_frac.; |
| 741 | lowpass = linear_intcxx . . $ linear_int(7678bba071383ab).(a, b, m); |
| 742 | } |
| 743 | else { |
| 744 | lowpass = 19500; |
| 745 | } |
| 746 | break; |
| 747 | } |
| 748 | case vbr_mtrhcxx . . $ vbr_mtrh.: |
| 749 | case vbr_mtcxx . . $ vbr_mt.:{ |
| 750 | int const x[11] = { |
| 751 | 24000, 19500, 18500, 18000, 17500, 17000, 16500, 15600, 15200, 7230, 3950 |
| 752 | }; |
| 753 | if (0 <= gfp->VBR_qcxx . . $ lame_global_struct#VBR_q. && gfp->VBR_qcxx . . $ lame_global_struct#VBR_q. <= 9) { |
| 754 | double a = x[gfp->VBR_qcxx . . $ lame_global_struct#VBR_q.], b = x[gfp->VBR_qcxx . . $ lame_global_struct#VBR_q. + 1], m = gfp->VBR_q_fraccxx . . $ lame_global_struct#VBR_q_frac.; |
| 755 | lowpass = linear_intcxx . . $ linear_int(7678bba071383ab).(a, b, m); |
| 756 | } |
| 757 | else { |
| 758 | lowpass = 21500; |
| 759 | } |
| 760 | break; |
| 761 | } |
| 762 | default:{ |
| 763 | int const x[11] = { |
| 764 | 19500, 19000, 18500, 18000, 17500, 16500, 15500, 14500, 12500, 9500, 3950 |
| 765 | }; |
| 766 | if (0 <= gfp->VBR_qcxx . . $ lame_global_struct#VBR_q. && gfp->VBR_qcxx . . $ lame_global_struct#VBR_q. <= 9) { |
| 767 | double a = x[gfp->VBR_qcxx . . $ lame_global_struct#VBR_q.], b = x[gfp->VBR_qcxx . . $ lame_global_struct#VBR_q. + 1], m = gfp->VBR_q_fraccxx . . $ lame_global_struct#VBR_q_frac.; |
| 768 | lowpass = linear_intcxx . . $ linear_int(7678bba071383ab).(a, b, m); |
| 769 | } |
| 770 | else { |
| 771 | lowpass = 19500; |
| 772 | } |
| 773 | } |
| 774 | } |
| 775 | |
| 776 | if (gfp->modecxx . . $ lame_global_struct#mode. == MONOcxx . . $ MONO. && (cfg->vbrcxx . . $ $anonymous_type_fa6ce02aa65ebf3c_13#vbr. == vbr_offcxx . . $ vbr_off. || cfg->vbrcxx . . $ $anonymous_type_fa6ce02aa65ebf3c_13#vbr. == vbr_abrcxx . . $ vbr_abr.)) |
| 777 | lowpass *= 1.5; |
| 778 | |
| 779 | gfp->lowpassfreqcxx . . $ lame_global_struct#lowpassfreq. = lowpass; |
| 780 | } |
| 781 | |
| 782 | if (gfp->samplerate_outcxx . . $ lame_global_struct#samplerate_out. == 0) { |
| 783 | if (2 * gfp->lowpassfreqcxx . . $ lame_global_struct#lowpassfreq. > gfp->samplerate_incxx . . $ lame_global_struct#samplerate_in.) { |
| 784 | gfp->lowpassfreqcxx . . $ lame_global_struct#lowpassfreq. = gfp->samplerate_incxx . . $ lame_global_struct#samplerate_in. / 2; |
| 785 | } |
| 786 | gfp->samplerate_outcxx . . $ lame_global_struct#samplerate_out. = optimum_samplefreqcxx . . $ optimum_samplefreq(9b79fb6aee4c0440).((int) gfp->lowpassfreqcxx . . $ lame_global_struct#lowpassfreq., gfp->samplerate_incxx . . $ lame_global_struct#samplerate_in.); |
| 787 | } |
| 788 | if (cfg->vbrcxx . . $ $anonymous_type_fa6ce02aa65ebf3c_13#vbr. == vbr_mtcxx . . $ vbr_mt. || cfg->vbrcxx . . $ $anonymous_type_fa6ce02aa65ebf3c_13#vbr. == vbr_mtrhcxx . . $ vbr_mtrh.) { |
| 789 | gfp->lowpassfreqcxx . . $ lame_global_struct#lowpassfreq. = Mincxx . . $ `external/lame/util.h:91:17`!(24000, gfp->lowpassfreq); |
| 790 | } |
| 791 | else { |
| 792 | gfp->lowpassfreqcxx . . $ lame_global_struct#lowpassfreq. = Mincxx . . $ `external/lame/util.h:91:17`!(20500, gfp->lowpassfreq); |
| 793 | } |
| 794 | gfp->lowpassfreqcxx . . $ lame_global_struct#lowpassfreq. = Mincxx . . $ `external/lame/util.h:91:17`!(gfp->samplerate_out / 2, gfp->lowpassfreq); |
| 795 | |
| 796 | if (cfg->vbrcxx . . $ $anonymous_type_fa6ce02aa65ebf3c_13#vbr. == vbr_offcxx . . $ vbr_off.) { |
| 797 | gfp->compression_ratiocxx . . $ lame_global_struct#compression_ratio. = gfp->samplerate_outcxx . . $ lame_global_struct#samplerate_out. * 16 * cfg->channels_outcxx . . $ $anonymous_type_fa6ce02aa65ebf3c_13#channels_out. / (1.e3 * gfp->bratecxx . . $ lame_global_struct#brate.); |
| 798 | } |
| 799 | if (cfg->vbrcxx . . $ $anonymous_type_fa6ce02aa65ebf3c_13#vbr. == vbr_abrcxx . . $ vbr_abr.) { |
| 800 | gfp->compression_ratiocxx . . $ lame_global_struct#compression_ratio. = |
| 801 | gfp->samplerate_outcxx . . $ lame_global_struct#samplerate_out. * 16 * cfg->channels_outcxx . . $ $anonymous_type_fa6ce02aa65ebf3c_13#channels_out. / (1.e3 * gfp->VBR_mean_bitrate_kbpscxx . . $ lame_global_struct#VBR_mean_bitrate_kbps.); |
| 802 | } |
| 803 | |
| 804 | cfg->disable_reservoircxx . . $ $anonymous_type_fa6ce02aa65ebf3c_13#disable_reservoir. = gfp->disable_reservoircxx . . $ lame_global_struct#disable_reservoir.; |
| 805 | cfg->lowpassfreqcxx . . $ $anonymous_type_fa6ce02aa65ebf3c_13#lowpassfreq. = gfp->lowpassfreqcxx . . $ lame_global_struct#lowpassfreq.; |
| 806 | cfg->highpassfreqcxx . . $ $anonymous_type_fa6ce02aa65ebf3c_13#highpassfreq. = gfp->highpassfreqcxx . . $ lame_global_struct#highpassfreq.; |
| 807 | cfg->samplerate_incxx . . $ $anonymous_type_fa6ce02aa65ebf3c_13#samplerate_in. = gfp->samplerate_incxx . . $ lame_global_struct#samplerate_in.; |
| 808 | cfg->samplerate_outcxx . . $ $anonymous_type_fa6ce02aa65ebf3c_13#samplerate_out. = gfp->samplerate_outcxx . . $ lame_global_struct#samplerate_out.; |
| 809 | cfg->mode_grcxx . . $ $anonymous_type_fa6ce02aa65ebf3c_13#mode_gr. = cfg->samplerate_outcxx . . $ $anonymous_type_fa6ce02aa65ebf3c_13#samplerate_out. <= 24000 ? 1 : 2; /* Number of granules per frame */ |
| 810 | |
| 811 | |
| 812 | /* |
| 813 | * sample freq bitrate compression ratio |
| 814 | * [kHz] [kbps/channel] for 16 bit input |
| 815 | * 44.1 56 12.6 |
| 816 | * 44.1 64 11.025 |
| 817 | * 44.1 80 8.82 |
| 818 | * 22.05 24 14.7 |
| 819 | * 22.05 32 11.025 |
| 820 | * 22.05 40 8.82 |
| 821 | * 16 16 16.0 |
| 822 | * 16 24 10.667 |
| 823 | * |
| 824 | */ |
| 825 | /* |
| 826 | * For VBR, take a guess at the compression_ratio. |
| 827 | * For example: |
| 828 | * |
| 829 | * VBR_q compression like |
| 830 | * - 4.4 320 kbps/44 kHz |
| 831 | * 0...1 5.5 256 kbps/44 kHz |
| 832 | * 2 7.3 192 kbps/44 kHz |
| 833 | * 4 8.8 160 kbps/44 kHz |
| 834 | * 6 11 128 kbps/44 kHz |
| 835 | * 9 14.7 96 kbps |
| 836 | * |
| 837 | * for lower bitrates, downsample with --resample |
| 838 | */ |
| 839 | |
| 840 | switch (cfg->vbrcxx . . $ $anonymous_type_fa6ce02aa65ebf3c_13#vbr.) { |
| 841 | case vbr_mtcxx . . $ vbr_mt.: |
| 842 | case vbr_rhcxx . . $ vbr_rh.: |
| 843 | case vbr_mtrhcxx . . $ vbr_mtrh.: |
| 844 | { |
| 845 | /*numbers are a bit strange, but they determine the lowpass value */ |
| 846 | FLOATcxx . . $ FLOAT# const cmp[] = { 5.7, 6.5, 7.3, 8.2, 10, 11.9, 13, 14, 15, 16.5 }; |
| 847 | gfp->compression_ratiocxx . . $ lame_global_struct#compression_ratio. = cmp[gfp->VBR_qcxx . . $ lame_global_struct#VBR_q.]; |
| 848 | } |
| 849 | break; |
| 850 | case vbr_abrcxx . . $ vbr_abr.: |
| 851 | gfp->compression_ratiocxx . . $ lame_global_struct#compression_ratio. = |
| 852 | cfg->samplerate_outcxx . . $ $anonymous_type_fa6ce02aa65ebf3c_13#samplerate_out. * 16 * cfg->channels_outcxx . . $ $anonymous_type_fa6ce02aa65ebf3c_13#channels_out. / (1.e3 * gfp->VBR_mean_bitrate_kbpscxx . . $ lame_global_struct#VBR_mean_bitrate_kbps.); |
| 853 | break; |
| 854 | default: |
| 855 | gfp->compression_ratiocxx . . $ lame_global_struct#compression_ratio. = cfg->samplerate_outcxx . . $ $anonymous_type_fa6ce02aa65ebf3c_13#samplerate_out. * 16 * cfg->channels_outcxx . . $ $anonymous_type_fa6ce02aa65ebf3c_13#channels_out. / (1.e3 * gfp->bratecxx . . $ lame_global_struct#brate.); |
| 856 | break; |
| 857 | } |
| 858 | |
| 859 | |
| 860 | /* mode = -1 (not set by user) or |
| 861 | * mode = MONO (because of only 1 input channel). |
| 862 | * If mode has not been set, then select J-STEREO |
| 863 | */ |
| 864 | if (gfp->modecxx . . $ lame_global_struct#mode. == NOT_SETcxx . . $ NOT_SET.) { |
| 865 | gfp->modecxx . . $ lame_global_struct#mode. = JOINT_STEREOcxx . . $ JOINT_STEREO.; |
| 866 | } |
| 867 | |
| 868 | cfg->modecxx . . $ $anonymous_type_fa6ce02aa65ebf3c_13#mode. = gfp->modecxx . . $ lame_global_struct#mode.; |
| 869 | |
| 870 | |
| 871 | /* apply user driven high pass filter */ |
| 872 | if (cfg->highpassfreqcxx . . $ $anonymous_type_fa6ce02aa65ebf3c_13#highpassfreq. > 0) { |
| 873 | cfg->highpass1cxx . . $ $anonymous_type_fa6ce02aa65ebf3c_13#highpass1. = 2. * cfg->highpassfreqcxx . . $ $anonymous_type_fa6ce02aa65ebf3c_13#highpassfreq.; |
| 874 | |
| 875 | if (gfp->highpasswidthcxx . . $ lame_global_struct#highpasswidth. >= 0) |
| 876 | cfg->highpass2cxx . . $ $anonymous_type_fa6ce02aa65ebf3c_13#highpass2. = 2. * (cfg->highpassfreqcxx . . $ $anonymous_type_fa6ce02aa65ebf3c_13#highpassfreq. + gfp->highpasswidthcxx . . $ lame_global_struct#highpasswidth.); |
| 877 | else /* 0% above on default */ |
| 878 | cfg->highpass2cxx . . $ $anonymous_type_fa6ce02aa65ebf3c_13#highpass2. = (1 + 0.00) * 2. * cfg->highpassfreqcxx . . $ $anonymous_type_fa6ce02aa65ebf3c_13#highpassfreq.; |
| 879 | |
| 880 | cfg->highpass1cxx . . $ $anonymous_type_fa6ce02aa65ebf3c_13#highpass1. /= cfg->samplerate_outcxx . . $ $anonymous_type_fa6ce02aa65ebf3c_13#samplerate_out.; |
| 881 | cfg->highpass2cxx . . $ $anonymous_type_fa6ce02aa65ebf3c_13#highpass2. /= cfg->samplerate_outcxx . . $ $anonymous_type_fa6ce02aa65ebf3c_13#samplerate_out.; |
| 882 | } |
| 883 | else { |
| 884 | cfg->highpass1cxx . . $ $anonymous_type_fa6ce02aa65ebf3c_13#highpass1. = 0; |
| 885 | cfg->highpass2cxx . . $ $anonymous_type_fa6ce02aa65ebf3c_13#highpass2. = 0; |
| 886 | } |
| 887 | /* apply user driven low pass filter */ |
| 888 | cfg->lowpass1cxx . . $ $anonymous_type_fa6ce02aa65ebf3c_13#lowpass1. = 0; |
| 889 | cfg->lowpass2cxx . . $ $anonymous_type_fa6ce02aa65ebf3c_13#lowpass2. = 0; |
| 890 | if (cfg->lowpassfreqcxx . . $ $anonymous_type_fa6ce02aa65ebf3c_13#lowpassfreq. > 0 && cfg->lowpassfreqcxx . . $ $anonymous_type_fa6ce02aa65ebf3c_13#lowpassfreq. < (cfg->samplerate_outcxx . . $ $anonymous_type_fa6ce02aa65ebf3c_13#samplerate_out. / 2) ) { |
| 891 | cfg->lowpass2cxx . . $ $anonymous_type_fa6ce02aa65ebf3c_13#lowpass2. = 2. * cfg->lowpassfreqcxx . . $ $anonymous_type_fa6ce02aa65ebf3c_13#lowpassfreq.; |
| 892 | if (gfp->lowpasswidthcxx . . $ lame_global_struct#lowpasswidth. >= 0) { |
| 893 | cfg->lowpass1cxx . . $ $anonymous_type_fa6ce02aa65ebf3c_13#lowpass1. = 2. * (cfg->lowpassfreqcxx . . $ $anonymous_type_fa6ce02aa65ebf3c_13#lowpassfreq. - gfp->lowpasswidthcxx . . $ lame_global_struct#lowpasswidth.); |
| 894 | if (cfg->lowpass1cxx . . $ $anonymous_type_fa6ce02aa65ebf3c_13#lowpass1. < 0) /* has to be >= 0 */ |
| 895 | cfg->lowpass1cxx . . $ $anonymous_type_fa6ce02aa65ebf3c_13#lowpass1. = 0; |
| 896 | } |
| 897 | else { /* 0% below on default */ |
| 898 | cfg->lowpass1cxx . . $ $anonymous_type_fa6ce02aa65ebf3c_13#lowpass1. = (1 - 0.00) * 2. * cfg->lowpassfreqcxx . . $ $anonymous_type_fa6ce02aa65ebf3c_13#lowpassfreq.; |
| 899 | } |
| 900 | cfg->lowpass1cxx . . $ $anonymous_type_fa6ce02aa65ebf3c_13#lowpass1. /= cfg->samplerate_outcxx . . $ $anonymous_type_fa6ce02aa65ebf3c_13#samplerate_out.; |
| 901 | cfg->lowpass2cxx . . $ $anonymous_type_fa6ce02aa65ebf3c_13#lowpass2. /= cfg->samplerate_outcxx . . $ $anonymous_type_fa6ce02aa65ebf3c_13#samplerate_out.; |
| 902 | } |
| 903 | |
| 904 | |
| 905 | |
| 906 | |
| 907 | /**********************************************************************/ |
| 908 | /* compute info needed for polyphase filter (filter type==0, default) */ |
| 909 | /**********************************************************************/ |
| 910 | lame_init_params_ppfltcxx . . $ lame_init_params_ppflt(4f558d83b2842a93).(gfc); |
| 911 | |
| 912 | |
| 913 | /******************************************************* |
| 914 | * samplerate and bitrate index |
| 915 | *******************************************************/ |
| 916 | cfg->samplerate_indexcxx . . $ $anonymous_type_fa6ce02aa65ebf3c_13#samplerate_index. = SmpFrqIndexcxx . . $ SmpFrqIndex(ac48f4a6ffa9e770).(cfg->samplerate_outcxx . . $ $anonymous_type_fa6ce02aa65ebf3c_13#samplerate_out., &cfg->versioncxx . . $ $anonymous_type_fa6ce02aa65ebf3c_13#version.); |
| 917 | assertcxx . . $ `<external>/4398592474888995393/assert.h:118:11`!(cfg->samplerate_index >= 0); |
| 918 | |
| 919 | if (cfg->vbrcxx . . $ $anonymous_type_fa6ce02aa65ebf3c_13#vbr. == vbr_offcxx . . $ vbr_off.) { |
| 920 | if (cfg->free_formatcxx . . $ $anonymous_type_fa6ce02aa65ebf3c_13#free_format.) { |
| 921 | gfc->ov_enccxx . . $ lame_internal_flags#ov_enc..bitrate_indexcxx . . $ $anonymous_type_fa6ce02aa65ebf3c_9#bitrate_index. = 0; |
| 922 | } |
| 923 | else { |
| 924 | gfp->bratecxx . . $ lame_global_struct#brate. = FindNearestBitratecxx . . $ FindNearestBitrate(2326284602b0bb2d).(gfp->bratecxx . . $ lame_global_struct#brate., cfg->versioncxx . . $ $anonymous_type_fa6ce02aa65ebf3c_13#version., cfg->samplerate_outcxx . . $ $anonymous_type_fa6ce02aa65ebf3c_13#samplerate_out.); |
| 925 | gfc->ov_enccxx . . $ lame_internal_flags#ov_enc..bitrate_indexcxx . . $ $anonymous_type_fa6ce02aa65ebf3c_9#bitrate_index. = BitrateIndexcxx . . $ BitrateIndex(2326284602b0bb2d).(gfp->bratecxx . . $ lame_global_struct#brate., cfg->versioncxx . . $ $anonymous_type_fa6ce02aa65ebf3c_13#version., cfg->samplerate_outcxx . . $ $anonymous_type_fa6ce02aa65ebf3c_13#samplerate_out.); |
| 926 | if (gfc->ov_enccxx . . $ lame_internal_flags#ov_enc..bitrate_indexcxx . . $ $anonymous_type_fa6ce02aa65ebf3c_9#bitrate_index. <= 0) { |
| 927 | /* This never happens, because of preceding FindNearestBitrate! |
| 928 | * But, set a sane value, just in case |
| 929 | */ |
| 930 | assertcxx . . $ `<external>/4398592474888995393/assert.h:118:11`!(0); |
| 931 | gfc->ov_enccxx . . $ lame_internal_flags#ov_enc..bitrate_indexcxx . . $ $anonymous_type_fa6ce02aa65ebf3c_9#bitrate_index. = 8; |
| 932 | } |
| 933 | } |
| 934 | } |
| 935 | else { |
| 936 | gfc->ov_enccxx . . $ lame_internal_flags#ov_enc..bitrate_indexcxx . . $ $anonymous_type_fa6ce02aa65ebf3c_9#bitrate_index. = 1; |
| 937 | } |
| 938 | |
| 939 | init_bit_stream_wcxx . . $ init_bit_stream_w(4f558d83b2842a93).(gfc); |
| 940 | |
| 941 | j = cfg->samplerate_indexcxx . . $ $anonymous_type_fa6ce02aa65ebf3c_13#samplerate_index. + (3 * cfg->versioncxx . . $ $anonymous_type_fa6ce02aa65ebf3c_13#version.) + 6 * (cfg->samplerate_outcxx . . $ $anonymous_type_fa6ce02aa65ebf3c_13#samplerate_out. < 16000); |
| 942 | for (i = 0; i < SBMAX_lcxx . . $ `external/lame/encoder.h:103:9`! + 1; i++) |
| 943 | gfc->scalefac_bandcxx . . $ lame_internal_flags#scalefac_band..lcxx . . $ $anonymous_type_fdda207d22d8fb07_0#l.[i] = sfBandIndexcxx . . $ sfBandIndex.[j].lcxx . . $ $anonymous_type_fdda207d22d8fb07_0#l.[i]; |
| 944 | |
| 945 | for (i = 0; i < PSFB21cxx . . $ `external/lame/encoder.h:105:9`! + 1; i++) { |
| 946 | int const size = (gfc->scalefac_bandcxx . . $ lame_internal_flags#scalefac_band..lcxx . . $ $anonymous_type_fdda207d22d8fb07_0#l.[22] - gfc->scalefac_bandcxx . . $ lame_internal_flags#scalefac_band..lcxx . . $ $anonymous_type_fdda207d22d8fb07_0#l.[21]) / PSFB21cxx . . $ `external/lame/encoder.h:105:9`!; |
| 947 | int const start = gfc->scalefac_bandcxx . . $ lame_internal_flags#scalefac_band..lcxx . . $ $anonymous_type_fdda207d22d8fb07_0#l.[21] + i * size; |
| 948 | gfc->scalefac_bandcxx . . $ lame_internal_flags#scalefac_band..psfb21cxx . . $ $anonymous_type_fdda207d22d8fb07_0#psfb21.[i] = start; |
| 949 | } |
| 950 | gfc->scalefac_bandcxx . . $ lame_internal_flags#scalefac_band..psfb21cxx . . $ $anonymous_type_fdda207d22d8fb07_0#psfb21.[PSFB21cxx . . $ `external/lame/encoder.h:105:9`!] = 576; |
| 951 | |
| 952 | for (i = 0; i < SBMAX_scxx . . $ `external/lame/encoder.h:104:9`! + 1; i++) |
| 953 | gfc->scalefac_bandcxx . . $ lame_internal_flags#scalefac_band..scxx . . $ $anonymous_type_fdda207d22d8fb07_0#s.[i] = sfBandIndexcxx . . $ sfBandIndex.[j].scxx . . $ $anonymous_type_fdda207d22d8fb07_0#s.[i]; |
| 954 | |
| 955 | for (i = 0; i < PSFB12cxx . . $ `external/lame/encoder.h:106:9`! + 1; i++) { |
| 956 | int const size = (gfc->scalefac_bandcxx . . $ lame_internal_flags#scalefac_band..scxx . . $ $anonymous_type_fdda207d22d8fb07_0#s.[13] - gfc->scalefac_bandcxx . . $ lame_internal_flags#scalefac_band..scxx . . $ $anonymous_type_fdda207d22d8fb07_0#s.[12]) / PSFB12cxx . . $ `external/lame/encoder.h:106:9`!; |
| 957 | int const start = gfc->scalefac_bandcxx . . $ lame_internal_flags#scalefac_band..scxx . . $ $anonymous_type_fdda207d22d8fb07_0#s.[12] + i * size; |
| 958 | gfc->scalefac_bandcxx . . $ lame_internal_flags#scalefac_band..psfb12cxx . . $ $anonymous_type_fdda207d22d8fb07_0#psfb12.[i] = start; |
| 959 | } |
| 960 | gfc->scalefac_bandcxx . . $ lame_internal_flags#scalefac_band..psfb12cxx . . $ $anonymous_type_fdda207d22d8fb07_0#psfb12.[PSFB12cxx . . $ `external/lame/encoder.h:106:9`!] = 192; |
| 961 | |
| 962 | /* determine the mean bitrate for main data */ |
| 963 | if (cfg->mode_grcxx . . $ $anonymous_type_fa6ce02aa65ebf3c_13#mode_gr. == 2) /* MPEG 1 */ |
| 964 | cfg->sideinfo_lencxx . . $ $anonymous_type_fa6ce02aa65ebf3c_13#sideinfo_len. = (cfg->channels_outcxx . . $ $anonymous_type_fa6ce02aa65ebf3c_13#channels_out. == 1) ? 4 + 17 : 4 + 32; |
| 965 | else /* MPEG 2 */ |
| 966 | cfg->sideinfo_lencxx . . $ $anonymous_type_fa6ce02aa65ebf3c_13#sideinfo_len. = (cfg->channels_outcxx . . $ $anonymous_type_fa6ce02aa65ebf3c_13#channels_out. == 1) ? 4 + 9 : 4 + 17; |
| 967 | |
| 968 | if (cfg->error_protectioncxx . . $ $anonymous_type_fa6ce02aa65ebf3c_13#error_protection.) |
| 969 | cfg->sideinfo_lencxx . . $ $anonymous_type_fa6ce02aa65ebf3c_13#sideinfo_len. += 2; |
| 970 | |
| 971 | { |
| 972 | int k; |
| 973 | |
| 974 | for (k = 0; k < 19; k++) |
| 975 | gfc->sv_enccxx . . $ lame_internal_flags#sv_enc..pefirbufcxx . . $ $anonymous_type_fa6ce02aa65ebf3c_7#pefirbuf.[k] = 700 * cfg->mode_grcxx . . $ $anonymous_type_fa6ce02aa65ebf3c_13#mode_gr. * cfg->channels_outcxx . . $ $anonymous_type_fa6ce02aa65ebf3c_13#channels_out.; |
| 976 | |
| 977 | if (gfp->ATHtypecxx . . $ lame_global_struct#ATHtype. == -1) |
| 978 | gfp->ATHtypecxx . . $ lame_global_struct#ATHtype. = 4; |
| 979 | } |
| 980 | |
| 981 | assertcxx . . $ `<external>/4398592474888995393/assert.h:118:11`!(gfp->VBR_q <= 9); |
| 982 | assertcxx . . $ `<external>/4398592474888995393/assert.h:118:11`!(gfp->VBR_q >= 0); |
| 983 | |
| 984 | switch (cfg->vbrcxx . . $ $anonymous_type_fa6ce02aa65ebf3c_13#vbr.) { |
| 985 | |
| 986 | case vbr_mtcxx . . $ vbr_mt.: |
| 987 | case vbr_mtrhcxx . . $ vbr_mtrh.:{ |
| 988 | if (gfp->strict_ISOcxx . . $ lame_global_struct#strict_ISO. < 0) { |
| 989 | gfp->strict_ISOcxx . . $ lame_global_struct#strict_ISO. = MDB_MAXIMUMcxx . . $ MDB_MAXIMUM.; |
| 990 | } |
| 991 | if (gfp->useTemporalcxx . . $ lame_global_struct#useTemporal. < 0) { |
| 992 | gfp->useTemporalcxx . . $ lame_global_struct#useTemporal. = 0; /* off by default for this VBR mode */ |
| 993 | } |
| 994 | |
| 995 | (void) apply_presetcxx . . $ apply_preset(bc3aa82e4f3f190c).(gfp, 500 - (gfp->VBR_qcxx . . $ lame_global_struct#VBR_q. * 10), 0); |
| 996 | /* The newer VBR code supports only a limited |
| 997 | subset of quality levels: |
| 998 | 9-5=5 are the same, uses x^3/4 quantization |
| 999 | 4-0=0 are the same 5 plus best huffman divide code |
| 1000 | */ |
| 1001 | if (gfp->qualitycxx . . $ lame_global_struct#quality. < 0) |
| 1002 | gfp->qualitycxx . . $ lame_global_struct#quality. = LAME_DEFAULT_QUALITYcxx . . $ `external/lame/lame.c:64:9`!; |
| 1003 | if (gfp->qualitycxx . . $ lame_global_struct#quality. < 5) |
| 1004 | gfp->qualitycxx . . $ lame_global_struct#quality. = 0; |
| 1005 | if (gfp->qualitycxx . . $ lame_global_struct#quality. > 7) |
| 1006 | gfp->qualitycxx . . $ lame_global_struct#quality. = 7; |
| 1007 | |
| 1008 | /* sfb21 extra only with MPEG-1 at higher sampling rates |
| 1009 | */ |
| 1010 | if (gfp->experimentalYcxx . . $ lame_global_struct#experimentalY.) |
| 1011 | gfc->sv_qntcxx . . $ lame_internal_flags#sv_qnt..sfb21_extracxx . . $ $anonymous_type_fa6ce02aa65ebf3c_10#sfb21_extra. = 0; |
| 1012 | else |
| 1013 | gfc->sv_qntcxx . . $ lame_internal_flags#sv_qnt..sfb21_extracxx . . $ $anonymous_type_fa6ce02aa65ebf3c_10#sfb21_extra. = (cfg->samplerate_outcxx . . $ $anonymous_type_fa6ce02aa65ebf3c_13#samplerate_out. > 44000); |
| 1014 | |
| 1015 | break; |
| 1016 | |
| 1017 | } |
| 1018 | case vbr_rhcxx . . $ vbr_rh.:{ |
| 1019 | |
| 1020 | (void) apply_presetcxx . . $ apply_preset(bc3aa82e4f3f190c).(gfp, 500 - (gfp->VBR_qcxx . . $ lame_global_struct#VBR_q. * 10), 0); |
| 1021 | |
| 1022 | /* sfb21 extra only with MPEG-1 at higher sampling rates |
| 1023 | */ |
| 1024 | if (gfp->experimentalYcxx . . $ lame_global_struct#experimentalY.) |
| 1025 | gfc->sv_qntcxx . . $ lame_internal_flags#sv_qnt..sfb21_extracxx . . $ $anonymous_type_fa6ce02aa65ebf3c_10#sfb21_extra. = 0; |
| 1026 | else |
| 1027 | gfc->sv_qntcxx . . $ lame_internal_flags#sv_qnt..sfb21_extracxx . . $ $anonymous_type_fa6ce02aa65ebf3c_10#sfb21_extra. = (cfg->samplerate_outcxx . . $ $anonymous_type_fa6ce02aa65ebf3c_13#samplerate_out. > 44000); |
| 1028 | |
| 1029 | /* VBR needs at least the output of GPSYCHO, |
| 1030 | * so we have to garantee that by setting a minimum |
| 1031 | * quality level, actually level 6 does it. |
| 1032 | * down to level 6 |
| 1033 | */ |
| 1034 | if (gfp->qualitycxx . . $ lame_global_struct#quality. > 6) |
| 1035 | gfp->qualitycxx . . $ lame_global_struct#quality. = 6; |
| 1036 | |
| 1037 | |
| 1038 | if (gfp->qualitycxx . . $ lame_global_struct#quality. < 0) |
| 1039 | gfp->qualitycxx . . $ lame_global_struct#quality. = LAME_DEFAULT_QUALITYcxx . . $ `external/lame/lame.c:64:9`!; |
| 1040 | |
| 1041 | break; |
| 1042 | } |
| 1043 | |
| 1044 | default: /* cbr/abr */ { |
| 1045 | |
| 1046 | /* no sfb21 extra with CBR code |
| 1047 | */ |
| 1048 | gfc->sv_qntcxx . . $ lame_internal_flags#sv_qnt..sfb21_extracxx . . $ $anonymous_type_fa6ce02aa65ebf3c_10#sfb21_extra. = 0; |
| 1049 | |
| 1050 | if (gfp->qualitycxx . . $ lame_global_struct#quality. < 0) |
| 1051 | gfp->qualitycxx . . $ lame_global_struct#quality. = LAME_DEFAULT_QUALITYcxx . . $ `external/lame/lame.c:64:9`!; |
| 1052 | |
| 1053 | |
| 1054 | if (cfg->vbrcxx . . $ $anonymous_type_fa6ce02aa65ebf3c_13#vbr. == vbr_offcxx . . $ vbr_off.) |
| 1055 | (void) lame_set_VBR_mean_bitrate_kbpscxx . . $ lame_set_VBR_mean_bitrate_kbps(3f7580c1167cd249).(gfp, gfp->bratecxx . . $ lame_global_struct#brate.); |
| 1056 | /* second, set parameters depending on bitrate */ |
| 1057 | (void) apply_presetcxx . . $ apply_preset(bc3aa82e4f3f190c).(gfp, gfp->VBR_mean_bitrate_kbpscxx . . $ lame_global_struct#VBR_mean_bitrate_kbps., 0); |
| 1058 | gfp->VBRcxx . . $ lame_global_struct#VBR. = cfg->vbrcxx . . $ $anonymous_type_fa6ce02aa65ebf3c_13#vbr.; |
| 1059 | |
| 1060 | break; |
| 1061 | } |
| 1062 | } |
| 1063 | |
| 1064 | /*initialize default values common for all modes */ |
| 1065 | |
| 1066 | gfc->sv_qntcxx . . $ lame_internal_flags#sv_qnt..mask_adjustcxx . . $ $anonymous_type_fa6ce02aa65ebf3c_10#mask_adjust. = gfp->maskingadjustcxx . . $ lame_global_struct#maskingadjust.; |
| 1067 | gfc->sv_qntcxx . . $ lame_internal_flags#sv_qnt..mask_adjust_shortcxx . . $ $anonymous_type_fa6ce02aa65ebf3c_10#mask_adjust_short. = gfp->maskingadjust_shortcxx . . $ lame_global_struct#maskingadjust_short.; |
| 1068 | |
| 1069 | /* just another daily changing developer switch */ |
| 1070 | if (gfp->tunecxx . . $ lame_global_struct#tune.) { |
| 1071 | gfc->sv_qntcxx . . $ lame_internal_flags#sv_qnt..mask_adjustcxx . . $ $anonymous_type_fa6ce02aa65ebf3c_10#mask_adjust. += gfp->tune_value_acxx . . $ lame_global_struct#tune_value_a.; |
| 1072 | gfc->sv_qntcxx . . $ lame_internal_flags#sv_qnt..mask_adjust_shortcxx . . $ $anonymous_type_fa6ce02aa65ebf3c_10#mask_adjust_short. += gfp->tune_value_acxx . . $ lame_global_struct#tune_value_a.; |
| 1073 | } |
| 1074 | |
| 1075 | |
| 1076 | if (cfg->vbrcxx . . $ $anonymous_type_fa6ce02aa65ebf3c_13#vbr. != vbr_offcxx . . $ vbr_off.) { /* choose a min/max bitrate for VBR */ |
| 1077 | /* if the user didn't specify VBR_max_bitrate: */ |
| 1078 | cfg->vbr_min_bitrate_indexcxx . . $ $anonymous_type_fa6ce02aa65ebf3c_13#vbr_min_bitrate_index. = 1; /* default: allow 8 kbps (MPEG-2) or 32 kbps (MPEG-1) */ |
| 1079 | cfg->vbr_max_bitrate_indexcxx . . $ $anonymous_type_fa6ce02aa65ebf3c_13#vbr_max_bitrate_index. = 14; /* default: allow 160 kbps (MPEG-2) or 320 kbps (MPEG-1) */ |
| 1080 | if (cfg->samplerate_outcxx . . $ $anonymous_type_fa6ce02aa65ebf3c_13#samplerate_out. < 16000) |
| 1081 | cfg->vbr_max_bitrate_indexcxx . . $ $anonymous_type_fa6ce02aa65ebf3c_13#vbr_max_bitrate_index. = 8; /* default: allow 64 kbps (MPEG-2.5) */ |
| 1082 | if (gfp->VBR_min_bitrate_kbpscxx . . $ lame_global_struct#VBR_min_bitrate_kbps.) { |
| 1083 | gfp->VBR_min_bitrate_kbpscxx . . $ lame_global_struct#VBR_min_bitrate_kbps. = |
| 1084 | FindNearestBitratecxx . . $ FindNearestBitrate(2326284602b0bb2d).(gfp->VBR_min_bitrate_kbpscxx . . $ lame_global_struct#VBR_min_bitrate_kbps., cfg->versioncxx . . $ $anonymous_type_fa6ce02aa65ebf3c_13#version., cfg->samplerate_outcxx . . $ $anonymous_type_fa6ce02aa65ebf3c_13#samplerate_out.); |
| 1085 | cfg->vbr_min_bitrate_indexcxx . . $ $anonymous_type_fa6ce02aa65ebf3c_13#vbr_min_bitrate_index. = |
| 1086 | BitrateIndexcxx . . $ BitrateIndex(2326284602b0bb2d).(gfp->VBR_min_bitrate_kbpscxx . . $ lame_global_struct#VBR_min_bitrate_kbps., cfg->versioncxx . . $ $anonymous_type_fa6ce02aa65ebf3c_13#version., cfg->samplerate_outcxx . . $ $anonymous_type_fa6ce02aa65ebf3c_13#samplerate_out.); |
| 1087 | if (cfg->vbr_min_bitrate_indexcxx . . $ $anonymous_type_fa6ce02aa65ebf3c_13#vbr_min_bitrate_index. < 0) { |
| 1088 | /* This never happens, because of preceding FindNearestBitrate! |
| 1089 | * But, set a sane value, just in case |
| 1090 | */ |
| 1091 | assertcxx . . $ `<external>/4398592474888995393/assert.h:118:11`!(0); |
| 1092 | cfg->vbr_min_bitrate_indexcxx . . $ $anonymous_type_fa6ce02aa65ebf3c_13#vbr_min_bitrate_index. = 1; |
| 1093 | } |
| 1094 | } |
| 1095 | if (gfp->VBR_max_bitrate_kbpscxx . . $ lame_global_struct#VBR_max_bitrate_kbps.) { |
| 1096 | gfp->VBR_max_bitrate_kbpscxx . . $ lame_global_struct#VBR_max_bitrate_kbps. = |
| 1097 | FindNearestBitratecxx . . $ FindNearestBitrate(2326284602b0bb2d).(gfp->VBR_max_bitrate_kbpscxx . . $ lame_global_struct#VBR_max_bitrate_kbps., cfg->versioncxx . . $ $anonymous_type_fa6ce02aa65ebf3c_13#version., cfg->samplerate_outcxx . . $ $anonymous_type_fa6ce02aa65ebf3c_13#samplerate_out.); |
| 1098 | cfg->vbr_max_bitrate_indexcxx . . $ $anonymous_type_fa6ce02aa65ebf3c_13#vbr_max_bitrate_index. = |
| 1099 | BitrateIndexcxx . . $ BitrateIndex(2326284602b0bb2d).(gfp->VBR_max_bitrate_kbpscxx . . $ lame_global_struct#VBR_max_bitrate_kbps., cfg->versioncxx . . $ $anonymous_type_fa6ce02aa65ebf3c_13#version., cfg->samplerate_outcxx . . $ $anonymous_type_fa6ce02aa65ebf3c_13#samplerate_out.); |
| 1100 | if (cfg->vbr_max_bitrate_indexcxx . . $ $anonymous_type_fa6ce02aa65ebf3c_13#vbr_max_bitrate_index. < 0) { |
| 1101 | /* This never happens, because of preceding FindNearestBitrate! |
| 1102 | * But, set a sane value, just in case |
| 1103 | */ |
| 1104 | assertcxx . . $ `<external>/4398592474888995393/assert.h:118:11`!(0); |
| 1105 | cfg->vbr_max_bitrate_indexcxx . . $ $anonymous_type_fa6ce02aa65ebf3c_13#vbr_max_bitrate_index. = cfg->samplerate_outcxx . . $ $anonymous_type_fa6ce02aa65ebf3c_13#samplerate_out. < 16000 ? 8 : 14; |
| 1106 | } |
| 1107 | } |
| 1108 | gfp->VBR_min_bitrate_kbpscxx . . $ lame_global_struct#VBR_min_bitrate_kbps. = bitrate_tablecxx . . $ bitrate_table.[cfg->versioncxx . . $ $anonymous_type_fa6ce02aa65ebf3c_13#version.][cfg->vbr_min_bitrate_indexcxx . . $ $anonymous_type_fa6ce02aa65ebf3c_13#vbr_min_bitrate_index.]; |
| 1109 | gfp->VBR_max_bitrate_kbpscxx . . $ lame_global_struct#VBR_max_bitrate_kbps. = bitrate_tablecxx . . $ bitrate_table.[cfg->versioncxx . . $ $anonymous_type_fa6ce02aa65ebf3c_13#version.][cfg->vbr_max_bitrate_indexcxx . . $ $anonymous_type_fa6ce02aa65ebf3c_13#vbr_max_bitrate_index.]; |
| 1110 | gfp->VBR_mean_bitrate_kbpscxx . . $ lame_global_struct#VBR_mean_bitrate_kbps. = |
| 1111 | Mincxx . . $ `external/lame/util.h:91:17`!(bitrate_table[cfg->version][cfg->vbr_max_bitrate_index], |
| 1112 | gfp->VBR_mean_bitrate_kbps); |
| 1113 | gfp->VBR_mean_bitrate_kbpscxx . . $ lame_global_struct#VBR_mean_bitrate_kbps. = |
| 1114 | Maxcxx . . $ `external/lame/util.h:92:17`!(bitrate_table[cfg->version][cfg->vbr_min_bitrate_index], |
| 1115 | gfp->VBR_mean_bitrate_kbps); |
| 1116 | } |
| 1117 | |
| 1118 | cfg->presetcxx . . $ $anonymous_type_fa6ce02aa65ebf3c_13#preset. = gfp->presetcxx . . $ lame_global_struct#preset.; |
| 1119 | cfg->write_lame_tagcxx . . $ $anonymous_type_fa6ce02aa65ebf3c_13#write_lame_tag. = gfp->write_lame_tagcxx . . $ lame_global_struct#write_lame_tag.; |
| 1120 | gfc->sv_qntcxx . . $ lame_internal_flags#sv_qnt..substep_shapingcxx . . $ $anonymous_type_fa6ce02aa65ebf3c_10#substep_shaping. = gfp->substep_shapingcxx . . $ lame_global_struct#substep_shaping.; |
| 1121 | cfg->noise_shapingcxx . . $ $anonymous_type_fa6ce02aa65ebf3c_13#noise_shaping. = gfp->noise_shapingcxx . . $ lame_global_struct#noise_shaping.; |
| 1122 | cfg->subblock_gaincxx . . $ $anonymous_type_fa6ce02aa65ebf3c_13#subblock_gain. = gfp->subblock_gaincxx . . $ lame_global_struct#subblock_gain.; |
| 1123 | cfg->use_best_huffmancxx . . $ $anonymous_type_fa6ce02aa65ebf3c_13#use_best_huffman. = gfp->use_best_huffmancxx . . $ lame_global_struct#use_best_huffman.; |
| 1124 | cfg->avg_bitratecxx . . $ $anonymous_type_fa6ce02aa65ebf3c_13#avg_bitrate. = gfp->bratecxx . . $ lame_global_struct#brate.; |
| 1125 | cfg->vbr_avg_bitrate_kbpscxx . . $ $anonymous_type_fa6ce02aa65ebf3c_13#vbr_avg_bitrate_kbps. = gfp->VBR_mean_bitrate_kbpscxx . . $ lame_global_struct#VBR_mean_bitrate_kbps.; |
| 1126 | cfg->compression_ratiocxx . . $ $anonymous_type_fa6ce02aa65ebf3c_13#compression_ratio. = gfp->compression_ratiocxx . . $ lame_global_struct#compression_ratio.; |
| 1127 | |
| 1128 | /* initialize internal qval settings */ |
| 1129 | lame_init_qvalcxx . . $ lame_init_qval(a7aecbfd39053bc4).(gfp); |
| 1130 | |
| 1131 | |
| 1132 | /* automatic ATH adjustment on |
| 1133 | */ |
| 1134 | if (gfp->athaa_typecxx . . $ lame_global_struct#athaa_type. < 0) |
| 1135 | gfc->ATHcxx . . $ lame_internal_flags#ATH.->use_adjustcxx . . $ $anonymous_type_fa6ce02aa65ebf3c_2#use_adjust. = 3; |
| 1136 | else |
| 1137 | gfc->ATHcxx . . $ lame_internal_flags#ATH.->use_adjustcxx . . $ $anonymous_type_fa6ce02aa65ebf3c_2#use_adjust. = gfp->athaa_typecxx . . $ lame_global_struct#athaa_type.; |
| 1138 | |
| 1139 | |
| 1140 | /* initialize internal adaptive ATH settings -jd */ |
| 1141 | gfc->ATHcxx . . $ lame_internal_flags#ATH.->aa_sensitivity_pcxx . . $ $anonymous_type_fa6ce02aa65ebf3c_2#aa_sensitivity_p. = pow(10.0, gfp->athaa_sensitivitycxx . . $ lame_global_struct#athaa_sensitivity. / -10.0); |
| 1142 | |
| 1143 | |
| 1144 | if (gfp->short_blockscxx . . $ lame_global_struct#short_blocks. == short_block_not_setcxx . . $ short_block_not_set.) { |
| 1145 | gfp->short_blockscxx . . $ lame_global_struct#short_blocks. = short_block_allowedcxx . . $ short_block_allowed.; |
| 1146 | } |
| 1147 | |
| 1148 | /*Note Jan/2003: Many hardware decoders cannot handle short blocks in regular |
| 1149 | stereo mode unless they are coupled (same type in both channels) |
| 1150 | it is a rare event (1 frame per min. or so) that LAME would use |
| 1151 | uncoupled short blocks, so lets turn them off until we decide |
| 1152 | how to handle this. No other encoders allow uncoupled short blocks, |
| 1153 | even though it is in the standard. */ |
| 1154 | /* rh 20040217: coupling makes no sense for mono and dual-mono streams |
| 1155 | */ |
| 1156 | if (gfp->short_blockscxx . . $ lame_global_struct#short_blocks. == short_block_allowedcxx . . $ short_block_allowed. |
| 1157 | && (cfg->modecxx . . $ $anonymous_type_fa6ce02aa65ebf3c_13#mode. == JOINT_STEREOcxx . . $ JOINT_STEREO. || cfg->modecxx . . $ $anonymous_type_fa6ce02aa65ebf3c_13#mode. == STEREOcxx . . $ STEREO.)) { |
| 1158 | gfp->short_blockscxx . . $ lame_global_struct#short_blocks. = short_block_coupledcxx . . $ short_block_coupled.; |
| 1159 | } |
| 1160 | |
| 1161 | cfg->short_blockscxx . . $ $anonymous_type_fa6ce02aa65ebf3c_13#short_blocks. = gfp->short_blockscxx . . $ lame_global_struct#short_blocks.; |
| 1162 | |
| 1163 | |
| 1164 | if (lame_get_quant_compcxx . . $ lame_get_quant_comp(a5abb0ff158568ac).(gfp) < 0) |
| 1165 | (void) lame_set_quant_compcxx . . $ lame_set_quant_comp(3f7580c1167cd249).(gfp, 1); |
| 1166 | if (lame_get_quant_comp_shortcxx . . $ lame_get_quant_comp_short(a5abb0ff158568ac).(gfp) < 0) |
| 1167 | (void) lame_set_quant_comp_shortcxx . . $ lame_set_quant_comp_short(3f7580c1167cd249).(gfp, 0); |
| 1168 | |
| 1169 | if (lame_get_msfixcxx . . $ lame_get_msfix(20fdb60ca712131b).(gfp) < 0) |
| 1170 | lame_set_msfixcxx . . $ lame_set_msfix(404f7e20968e6842).(gfp, 0); |
| 1171 | |
| 1172 | /* select psychoacoustic model */ |
| 1173 | (void) lame_set_exp_nspsytunecxx . . $ lame_set_exp_nspsytune(3f7580c1167cd249).(gfp, lame_get_exp_nspsytunecxx . . $ lame_get_exp_nspsytune(a5abb0ff158568ac).(gfp) | 1); |
| 1174 | |
| 1175 | if (gfp->ATHtypecxx . . $ lame_global_struct#ATHtype. < 0) |
| 1176 | gfp->ATHtypecxx . . $ lame_global_struct#ATHtype. = 4; |
| 1177 | |
| 1178 | if (gfp->ATHcurvecxx . . $ lame_global_struct#ATHcurve. < 0) |
| 1179 | gfp->ATHcurvecxx . . $ lame_global_struct#ATHcurve. = 4; |
| 1180 | |
| 1181 | if (gfp->interChRatiocxx . . $ lame_global_struct#interChRatio. < 0) |
| 1182 | gfp->interChRatiocxx . . $ lame_global_struct#interChRatio. = 0; |
| 1183 | |
| 1184 | if (gfp->useTemporalcxx . . $ lame_global_struct#useTemporal. < 0) |
| 1185 | gfp->useTemporalcxx . . $ lame_global_struct#useTemporal. = 1; /* on by default */ |
| 1186 | |
| 1187 | |
| 1188 | cfg->interChRatiocxx . . $ $anonymous_type_fa6ce02aa65ebf3c_13#interChRatio. = gfp->interChRatiocxx . . $ lame_global_struct#interChRatio.; |
| 1189 | cfg->msfixcxx . . $ $anonymous_type_fa6ce02aa65ebf3c_13#msfix. = gfp->msfixcxx . . $ lame_global_struct#msfix.; |
| 1190 | cfg->ATH_offset_dbcxx . . $ $anonymous_type_fa6ce02aa65ebf3c_13#ATH_offset_db. = 0-gfp->ATH_lower_dbcxx . . $ lame_global_struct#ATH_lower_db.; |
| 1191 | cfg->ATH_offset_factorcxx . . $ $anonymous_type_fa6ce02aa65ebf3c_13#ATH_offset_factor. = powfcxx . . $ powf(d59a45cd3bfd2eda).(10.f, cfg->ATH_offset_dbcxx . . $ $anonymous_type_fa6ce02aa65ebf3c_13#ATH_offset_db. * 0.1f); |
| 1192 | cfg->ATHcurvecxx . . $ $anonymous_type_fa6ce02aa65ebf3c_13#ATHcurve. = gfp->ATHcurvecxx . . $ lame_global_struct#ATHcurve.; |
| 1193 | cfg->ATHtypecxx . . $ $anonymous_type_fa6ce02aa65ebf3c_13#ATHtype. = gfp->ATHtypecxx . . $ lame_global_struct#ATHtype.; |
| 1194 | cfg->ATHonlycxx . . $ $anonymous_type_fa6ce02aa65ebf3c_13#ATHonly. = gfp->ATHonlycxx . . $ lame_global_struct#ATHonly.; |
| 1195 | cfg->ATHshortcxx . . $ $anonymous_type_fa6ce02aa65ebf3c_13#ATHshort. = gfp->ATHshortcxx . . $ lame_global_struct#ATHshort.; |
| 1196 | cfg->noATHcxx . . $ $anonymous_type_fa6ce02aa65ebf3c_13#noATH. = gfp->noATHcxx . . $ lame_global_struct#noATH.; |
| 1197 | |
| 1198 | cfg->quant_compcxx . . $ $anonymous_type_fa6ce02aa65ebf3c_13#quant_comp. = gfp->quant_compcxx . . $ lame_global_struct#quant_comp.; |
| 1199 | cfg->quant_comp_shortcxx . . $ $anonymous_type_fa6ce02aa65ebf3c_13#quant_comp_short. = gfp->quant_comp_shortcxx . . $ lame_global_struct#quant_comp_short.; |
| 1200 | |
| 1201 | cfg->use_temporal_masking_effectcxx . . $ $anonymous_type_fa6ce02aa65ebf3c_13#use_temporal_masking_effect. = gfp->useTemporalcxx . . $ lame_global_struct#useTemporal.; |
| 1202 | if (cfg->modecxx . . $ $anonymous_type_fa6ce02aa65ebf3c_13#mode. == JOINT_STEREOcxx . . $ JOINT_STEREO.) { |
| 1203 | cfg->use_safe_joint_stereocxx . . $ $anonymous_type_fa6ce02aa65ebf3c_13#use_safe_joint_stereo. = gfp->exp_nspsytunecxx . . $ lame_global_struct#exp_nspsytune. & 2; |
| 1204 | } |
| 1205 | else { |
| 1206 | cfg->use_safe_joint_stereocxx . . $ $anonymous_type_fa6ce02aa65ebf3c_13#use_safe_joint_stereo. = 0; |
| 1207 | } |
| 1208 | { |
| 1209 | cfg->adjust_bass_dbcxx . . $ $anonymous_type_fa6ce02aa65ebf3c_13#adjust_bass_db. = (gfp->exp_nspsytunecxx . . $ lame_global_struct#exp_nspsytune. >> 2) & 63; |
| 1210 | if (cfg->adjust_bass_dbcxx . . $ $anonymous_type_fa6ce02aa65ebf3c_13#adjust_bass_db. >= 32.f) |
| 1211 | cfg->adjust_bass_dbcxx . . $ $anonymous_type_fa6ce02aa65ebf3c_13#adjust_bass_db. -= 64.f; |
| 1212 | cfg->adjust_bass_dbcxx . . $ $anonymous_type_fa6ce02aa65ebf3c_13#adjust_bass_db. *= 0.25f; |
| 1213 | |
| 1214 | cfg->adjust_alto_dbcxx . . $ $anonymous_type_fa6ce02aa65ebf3c_13#adjust_alto_db. = (gfp->exp_nspsytunecxx . . $ lame_global_struct#exp_nspsytune. >> 8) & 63; |
| 1215 | if (cfg->adjust_alto_dbcxx . . $ $anonymous_type_fa6ce02aa65ebf3c_13#adjust_alto_db. >= 32.f) |
| 1216 | cfg->adjust_alto_dbcxx . . $ $anonymous_type_fa6ce02aa65ebf3c_13#adjust_alto_db. -= 64.f; |
| 1217 | cfg->adjust_alto_dbcxx . . $ $anonymous_type_fa6ce02aa65ebf3c_13#adjust_alto_db. *= 0.25f; |
| 1218 | |
| 1219 | cfg->adjust_treble_dbcxx . . $ $anonymous_type_fa6ce02aa65ebf3c_13#adjust_treble_db. = (gfp->exp_nspsytunecxx . . $ lame_global_struct#exp_nspsytune. >> 14) & 63; |
| 1220 | if (cfg->adjust_treble_dbcxx . . $ $anonymous_type_fa6ce02aa65ebf3c_13#adjust_treble_db. >= 32.f) |
| 1221 | cfg->adjust_treble_dbcxx . . $ $anonymous_type_fa6ce02aa65ebf3c_13#adjust_treble_db. -= 64.f; |
| 1222 | cfg->adjust_treble_dbcxx . . $ $anonymous_type_fa6ce02aa65ebf3c_13#adjust_treble_db. *= 0.25f; |
| 1223 | |
| 1224 | /* to be compatible with Naoki's original code, the next 6 bits |
| 1225 | * define only the amount of changing treble for sfb21 */ |
| 1226 | cfg->adjust_sfb21_dbcxx . . $ $anonymous_type_fa6ce02aa65ebf3c_13#adjust_sfb21_db. = (gfp->exp_nspsytunecxx . . $ lame_global_struct#exp_nspsytune. >> 20) & 63; |
| 1227 | if (cfg->adjust_sfb21_dbcxx . . $ $anonymous_type_fa6ce02aa65ebf3c_13#adjust_sfb21_db. >= 32.f) |
| 1228 | cfg->adjust_sfb21_dbcxx . . $ $anonymous_type_fa6ce02aa65ebf3c_13#adjust_sfb21_db. -= 64.f; |
| 1229 | cfg->adjust_sfb21_dbcxx . . $ $anonymous_type_fa6ce02aa65ebf3c_13#adjust_sfb21_db. *= 0.25f; |
| 1230 | cfg->adjust_sfb21_dbcxx . . $ $anonymous_type_fa6ce02aa65ebf3c_13#adjust_sfb21_db. += cfg->adjust_treble_dbcxx . . $ $anonymous_type_fa6ce02aa65ebf3c_13#adjust_treble_db.; |
| 1231 | } |
| 1232 | |
| 1233 | /* Setting up the PCM input data transform matrix, to apply |
| 1234 | * user defined re-scaling, and or two-to-one channel downmix. |
| 1235 | */ |
| 1236 | { |
| 1237 | FLOATcxx . . $ FLOAT# m[2][2] = { {1.0f, 0.0f}, {0.0f, 1.0f} }; |
| 1238 | |
| 1239 | /* user selected scaling of the samples */ |
| 1240 | m[0][0] *= gfp->scalecxx . . $ lame_global_struct#scale.; |
| 1241 | m[0][1] *= gfp->scalecxx . . $ lame_global_struct#scale.; |
| 1242 | m[1][0] *= gfp->scalecxx . . $ lame_global_struct#scale.; |
| 1243 | m[1][1] *= gfp->scalecxx . . $ lame_global_struct#scale.; |
| 1244 | /* user selected scaling of the channel 0 (left) samples */ |
| 1245 | m[0][0] *= gfp->scale_leftcxx . . $ lame_global_struct#scale_left.; |
| 1246 | m[0][1] *= gfp->scale_leftcxx . . $ lame_global_struct#scale_left.; |
| 1247 | /* user selected scaling of the channel 1 (right) samples */ |
| 1248 | m[1][0] *= gfp->scale_rightcxx . . $ lame_global_struct#scale_right.; |
| 1249 | m[1][1] *= gfp->scale_rightcxx . . $ lame_global_struct#scale_right.; |
| 1250 | /* Downsample to Mono if 2 channels in and 1 channel out */ |
| 1251 | if (cfg->channels_incxx . . $ $anonymous_type_fa6ce02aa65ebf3c_13#channels_in. == 2 && cfg->channels_outcxx . . $ $anonymous_type_fa6ce02aa65ebf3c_13#channels_out. == 1) { |
| 1252 | m[0][0] = 0.5f * (m[0][0] + m[1][0]); |
| 1253 | m[0][1] = 0.5f * (m[0][1] + m[1][1]); |
| 1254 | m[1][0] = 0; |
| 1255 | m[1][1] = 0; |
| 1256 | } |
| 1257 | cfg->pcm_transformcxx . . $ $anonymous_type_fa6ce02aa65ebf3c_13#pcm_transform.[0][0] = m[0][0]; |
| 1258 | cfg->pcm_transformcxx . . $ $anonymous_type_fa6ce02aa65ebf3c_13#pcm_transform.[0][1] = m[0][1]; |
| 1259 | cfg->pcm_transformcxx . . $ $anonymous_type_fa6ce02aa65ebf3c_13#pcm_transform.[1][0] = m[1][0]; |
| 1260 | cfg->pcm_transformcxx . . $ $anonymous_type_fa6ce02aa65ebf3c_13#pcm_transform.[1][1] = m[1][1]; |
| 1261 | } |
| 1262 | |
| 1263 | /* padding method as described in |
| 1264 | * "MPEG-Layer3 / Bitstream Syntax and Decoding" |
| 1265 | * by Martin Sieler, Ralph Sperschneider |
| 1266 | * |
| 1267 | * note: there is no padding for the very first frame |
| 1268 | * |
| 1269 | * Robert Hegemann 2000-06-22 |
| 1270 | */ |
| 1271 | gfc->sv_enccxx . . $ lame_internal_flags#sv_enc..slot_lagcxx . . $ $anonymous_type_fa6ce02aa65ebf3c_7#slot_lag. = gfc->sv_enccxx . . $ lame_internal_flags#sv_enc..frac_SpFcxx . . $ $anonymous_type_fa6ce02aa65ebf3c_7#frac_SpF. = 0; |
| 1272 | if (cfg->vbrcxx . . $ $anonymous_type_fa6ce02aa65ebf3c_13#vbr. == vbr_offcxx . . $ vbr_off.) |
| 1273 | gfc->sv_enccxx . . $ lame_internal_flags#sv_enc..slot_lagcxx . . $ $anonymous_type_fa6ce02aa65ebf3c_7#slot_lag. = gfc->sv_enccxx . . $ lame_internal_flags#sv_enc..frac_SpFcxx . . $ $anonymous_type_fa6ce02aa65ebf3c_7#frac_SpF. |
| 1274 | = ((cfg->versioncxx . . $ $anonymous_type_fa6ce02aa65ebf3c_13#version. + 1) * 72000L * cfg->avg_bitratecxx . . $ $anonymous_type_fa6ce02aa65ebf3c_13#avg_bitrate.) % cfg->samplerate_outcxx . . $ $anonymous_type_fa6ce02aa65ebf3c_13#samplerate_out.; |
| 1275 | |
| 1276 | (void) lame_init_bitstreamcxx . . $ lame_init_bitstream(12e50c934c2e73e2).(gfp); |
| 1277 | |
| 1278 | iteration_initcxx . . $ iteration_init(4f558d83b2842a93).(gfc); |
| 1279 | (void) psymodel_initcxx . . $ psymodel_init(a5abb0ff158568ac).(gfp); |
| 1280 | |
| 1281 | cfg->buffer_constraintcxx . . $ $anonymous_type_fa6ce02aa65ebf3c_13#buffer_constraint. = get_max_frame_buffer_size_by_constraintcxx . . $ get_max_frame_buffer_size_by_constraint(10808010e3d809b5).(cfg, gfp->strict_ISOcxx . . $ lame_global_struct#strict_ISO.); |
| 1282 | |
| 1283 | |
| 1284 | cfg->findReplayGaincxx . . $ $anonymous_type_fa6ce02aa65ebf3c_13#findReplayGain. = gfp->findReplayGaincxx . . $ lame_global_struct#findReplayGain.; |
| 1285 | cfg->decode_on_the_flycxx . . $ $anonymous_type_fa6ce02aa65ebf3c_13#decode_on_the_fly. = gfp->decode_on_the_flycxx . . $ lame_global_struct#decode_on_the_fly.; |
| 1286 | |
| 1287 | if (cfg->decode_on_the_flycxx . . $ $anonymous_type_fa6ce02aa65ebf3c_13#decode_on_the_fly.) |
| 1288 | cfg->findPeakSamplecxx . . $ $anonymous_type_fa6ce02aa65ebf3c_13#findPeakSample. = 1; |
| 1289 | |
| 1290 | if (cfg->findReplayGaincxx . . $ $anonymous_type_fa6ce02aa65ebf3c_13#findReplayGain.) { |
| 1291 | if (InitGainAnalysiscxx . . $ InitGainAnalysis(a484823feb468863).(gfc->sv_rpgcxx . . $ lame_internal_flags#sv_rpg..rgdatacxx . . $ $anonymous_type_fa6ce02aa65ebf3c_11#rgdata., cfg->samplerate_outcxx . . $ $anonymous_type_fa6ce02aa65ebf3c_13#samplerate_out.) == INIT_GAIN_ANALYSIS_ERRORcxx . . $ INIT_GAIN_ANALYSIS_ERROR.) { |
| 1292 | /* Actually this never happens, our samplerates are the ones RG accepts! |
| 1293 | * But just in case, turn RG off |
| 1294 | */ |
| 1295 | assertcxx . . $ `<external>/4398592474888995393/assert.h:118:11`!(0); |
| 1296 | cfg->findReplayGaincxx . . $ $anonymous_type_fa6ce02aa65ebf3c_13#findReplayGain. = 0; |
| 1297 | } |
| 1298 | } |
| 1299 | |
| 1300 | #ifdef DECODE_ON_THE_FLY |
| 1301 | if (cfg->decode_on_the_fly && !gfp->decode_only) { |
| 1302 | if (gfc->hip) { |
| 1303 | hip_decode_exit(gfc->hip); |
| 1304 | } |
| 1305 | gfc->hip = hip_decode_init(); |
| 1306 | /* report functions */ |
| 1307 | hip_set_errorf(gfc->hip, gfp->report.errorf); |
| 1308 | hip_set_debugf(gfc->hip, gfp->report.debugf); |
| 1309 | hip_set_msgf(gfc->hip, gfp->report.msgf); |
| 1310 | } |
| 1311 | #endif |
| 1312 | /* updating lame internal flags finished successful */ |
| 1313 | gfc->lame_init_params_successfulcxx . . $ lame_internal_flags#lame_init_params_successful. = 1; |
| 1314 | return 0; |
| 1315 | } |
| 1316 | |
| 1317 | static void |
| 1318 | concatSepcxx . . $ concatSep(1c63c3373ac92ead).(char* dest, char const* sep, char const* str) |
| 1319 | { |
| 1320 | if (*dest != 0) strcatcxx . . $ strcat(b7b3a83273496486).(dest, sep); |
| 1321 | strcatcxx . . $ strcat(b7b3a83273496486).(dest, str); |
| 1322 | } |
| 1323 | |
| 1324 | /* |
| 1325 | * print_config |
| 1326 | * |
| 1327 | * Prints some selected information about the coding parameters via |
| 1328 | * the macro command MSGF(), which is currently mapped to lame_errorf |
| 1329 | * (reports via a error function?), which is a printf-like function |
| 1330 | * for <stderr>. |
| 1331 | */ |
| 1332 | |
| 1333 | void |
| 1334 | lame_print_configcxx . . $ lame_print_config(aff43f4d8bc962d7).(const lame_global_flagscxx . . $ lame_global_flags# * gfp) |
| 1335 | { |
| 1336 | lame_internal_flagscxx . . $ lame_internal_flags# const *const gfc = gfp->internal_flagscxx . . $ lame_global_struct#internal_flags.; |
| 1337 | SessionConfig_tcxx . . $ SessionConfig_t# const *const cfg = &gfc->cfgcxx . . $ lame_internal_flags#cfg.; |
| 1338 | double const out_samplerate = cfg->samplerate_outcxx . . $ $anonymous_type_fa6ce02aa65ebf3c_13#samplerate_out.; |
| 1339 | double const in_samplerate = cfg->samplerate_incxx . . $ $anonymous_type_fa6ce02aa65ebf3c_13#samplerate_in.; |
| 1340 | |
| 1341 | MSGFcxx . . $ `external/lame/util.h:607:9`!(gfc, "LAME %s %s (%s)\n", get_lame_versioncxx . . $ get_lame_version(33a1f659e94feb42).(), get_lame_os_bitnesscxx . . $ get_lame_os_bitness(33a1f659e94feb42).(), get_lame_urlcxx . . $ get_lame_url(33a1f659e94feb42).()); |
| 1342 | |
| 1343 | #if (LAME_ALPHA_VERSIONcxx . . $ `external/lame/version.h:41:10`!) |
| 1344 | MSGF(gfc, "warning: alpha versions should be used for testing only\n"); |
| 1345 | #endif |
| 1346 | if (gfc->CPU_featurescxx . . $ lame_internal_flags#CPU_features..MMXcxx . . $ lame_internal_flags#$anonymous_type_14#MMX. |
| 1347 | || gfc->CPU_featurescxx . . $ lame_internal_flags#CPU_features..AMD_3DNowcxx . . $ lame_internal_flags#$anonymous_type_14#AMD_3DNow. || gfc->CPU_featurescxx . . $ lame_internal_flags#CPU_features..SSEcxx . . $ lame_internal_flags#$anonymous_type_14#SSE. || gfc->CPU_featurescxx . . $ lame_internal_flags#CPU_features..SSE2cxx . . $ lame_internal_flags#$anonymous_type_14#SSE2.) { |
| 1348 | char text[256] = { 0 }; |
| 1349 | int fft_asm_used = 0; |
| 1350 | #ifdef HAVE_NASM |
| 1351 | if (gfc->CPU_features.AMD_3DNow) { |
| 1352 | fft_asm_used = 1; |
| 1353 | } |
| 1354 | else if (gfc->CPU_features.SSE) { |
| 1355 | fft_asm_used = 2; |
| 1356 | } |
| 1357 | #else |
| 1358 | # if defined( HAVE_XMMINTRIN_H ) && defined( MIN_ARCH_SSE ) |
| 1359 | { |
| 1360 | fft_asm_used = 3; |
| 1361 | } |
| 1362 | # endif |
| 1363 | #endif |
| 1364 | if (gfc->CPU_featurescxx . . $ lame_internal_flags#CPU_features..MMXcxx . . $ lame_internal_flags#$anonymous_type_14#MMX.) { |
| 1365 | #ifdef MMX_choose_table |
| 1366 | concatSep(text, ", ", "MMX (ASM used)"); |
| 1367 | #else |
| 1368 | concatSepcxx . . $ concatSep(1c63c3373ac92ead).(text, ", ", "MMX"); |
| 1369 | #endif |
| 1370 | } |
| 1371 | if (gfc->CPU_featurescxx . . $ lame_internal_flags#CPU_features..AMD_3DNowcxx . . $ lame_internal_flags#$anonymous_type_14#AMD_3DNow.) { |
| 1372 | concatSepcxx . . $ concatSep(1c63c3373ac92ead).(text, ", ", (fft_asm_used == 1) ? "3DNow! (ASM used)" : "3DNow!"); |
| 1373 | } |
| 1374 | if (gfc->CPU_featurescxx . . $ lame_internal_flags#CPU_features..SSEcxx . . $ lame_internal_flags#$anonymous_type_14#SSE.) { |
| 1375 | #if defined(HAVE_XMMINTRIN_H) |
| 1376 | concatSep(text, ", ", "SSE (ASM used)"); |
| 1377 | #else |
| 1378 | concatSepcxx . . $ concatSep(1c63c3373ac92ead).(text, ", ", (fft_asm_used == 2) ? "SSE (ASM used)" : "SSE"); |
| 1379 | #endif |
| 1380 | } |
| 1381 | if (gfc->CPU_featurescxx . . $ lame_internal_flags#CPU_features..SSE2cxx . . $ lame_internal_flags#$anonymous_type_14#SSE2.) { |
| 1382 | concatSepcxx . . $ concatSep(1c63c3373ac92ead).(text, ", ", (fft_asm_used == 3) ? "SSE2 (ASM used)" : "SSE2"); |
| 1383 | } |
| 1384 | MSGFcxx . . $ `external/lame/util.h:607:9`!(gfc, "CPU features: %s\n", text); |
| 1385 | } |
| 1386 | |
| 1387 | if (cfg->channels_incxx . . $ $anonymous_type_fa6ce02aa65ebf3c_13#channels_in. == 2 && cfg->channels_outcxx . . $ $anonymous_type_fa6ce02aa65ebf3c_13#channels_out. == 1 /* mono */ ) { |
| 1388 | MSGFcxx . . $ `external/lame/util.h:607:9`!(gfc, "Autoconverting from stereo to mono. Setting encoding to mono mode.\n"); |
| 1389 | } |
| 1390 | |
| 1391 | if (isResamplingNecessarycxx . . $ isResamplingNecessary(3353a2dd70c7b2e6).(cfg)) { |
| 1392 | MSGFcxx . . $ `external/lame/util.h:607:9`!(gfc, "Resampling: input %g kHz output %g kHz\n", |
| 1393 | 1.e-3 * in_samplerate, 1.e-3 * out_samplerate); |
| 1394 | } |
| 1395 | |
| 1396 | if (cfg->highpass2cxx . . $ $anonymous_type_fa6ce02aa65ebf3c_13#highpass2. > 0.) |
| 1397 | MSGFcxx . . $ `external/lame/util.h:607:9`!(gfc, |
| 1398 | "Using polyphase highpass filter, transition band: %5.0f Hz - %5.0f Hz\n", |
| 1399 | 0.5 * cfg->highpass1cxx . . $ $anonymous_type_fa6ce02aa65ebf3c_13#highpass1. * out_samplerate, 0.5 * cfg->highpass2cxx . . $ $anonymous_type_fa6ce02aa65ebf3c_13#highpass2. * out_samplerate); |
| 1400 | if (0. < cfg->lowpass1cxx . . $ $anonymous_type_fa6ce02aa65ebf3c_13#lowpass1. || 0. < cfg->lowpass2cxx . . $ $anonymous_type_fa6ce02aa65ebf3c_13#lowpass2.) { |
| 1401 | MSGFcxx . . $ `external/lame/util.h:607:9`!(gfc, |
| 1402 | "Using polyphase lowpass filter, transition band: %5.0f Hz - %5.0f Hz\n", |
| 1403 | 0.5 * cfg->lowpass1cxx . . $ $anonymous_type_fa6ce02aa65ebf3c_13#lowpass1. * out_samplerate, 0.5 * cfg->lowpass2cxx . . $ $anonymous_type_fa6ce02aa65ebf3c_13#lowpass2. * out_samplerate); |
| 1404 | } |
| 1405 | else { |
| 1406 | MSGFcxx . . $ `external/lame/util.h:607:9`!(gfc, "polyphase lowpass filter disabled\n"); |
| 1407 | } |
| 1408 | |
| 1409 | if (cfg->free_formatcxx . . $ $anonymous_type_fa6ce02aa65ebf3c_13#free_format.) { |
| 1410 | MSGFcxx . . $ `external/lame/util.h:607:9`!(gfc, "Warning: many decoders cannot handle free format bitstreams\n"); |
| 1411 | if (cfg->avg_bitratecxx . . $ $anonymous_type_fa6ce02aa65ebf3c_13#avg_bitrate. > 320) { |
| 1412 | MSGFcxx . . $ `external/lame/util.h:607:9`!(gfc, |
| 1413 | "Warning: many decoders cannot handle free format bitrates >320 kbps (see documentation)\n"); |
| 1414 | } |
| 1415 | } |
| 1416 | } |
| 1417 | |
| 1418 | |
| 1419 | /** rh: |
| 1420 | * some pretty printing is very welcome at this point! |
| 1421 | * so, if someone is willing to do so, please do it! |
| 1422 | * add more, if you see more... |
| 1423 | */ |
| 1424 | void |
| 1425 | lame_print_internalscxx . . $ lame_print_internals(aff43f4d8bc962d7).(const lame_global_flagscxx . . $ lame_global_flags# * gfp) |
| 1426 | { |
| 1427 | lame_internal_flagscxx . . $ lame_internal_flags# const *const gfc = gfp->internal_flagscxx . . $ lame_global_struct#internal_flags.; |
| 1428 | SessionConfig_tcxx . . $ SessionConfig_t# const *const cfg = &gfc->cfgcxx . . $ lame_internal_flags#cfg.; |
| 1429 | const char *pc = ""; |
| 1430 | |
| 1431 | /* compiler/processor optimizations, operational, etc. |
| 1432 | */ |
| 1433 | MSGFcxx . . $ `external/lame/util.h:607:9`!(gfc, "\nmisc:\n\n"); |
| 1434 | |
| 1435 | MSGFcxx . . $ `external/lame/util.h:607:9`!(gfc, "\tscaling: %g\n", gfp->scalecxx . . $ lame_global_struct#scale.); |
| 1436 | MSGFcxx . . $ `external/lame/util.h:607:9`!(gfc, "\tch0 (left) scaling: %g\n", gfp->scale_leftcxx . . $ lame_global_struct#scale_left.); |
| 1437 | MSGFcxx . . $ `external/lame/util.h:607:9`!(gfc, "\tch1 (right) scaling: %g\n", gfp->scale_rightcxx . . $ lame_global_struct#scale_right.); |
| 1438 | switch (cfg->use_best_huffmancxx . . $ $anonymous_type_fa6ce02aa65ebf3c_13#use_best_huffman.) { |
| 1439 | default: |
| 1440 | pc = "normal"; |
| 1441 | break; |
| 1442 | case 1: |
| 1443 | pc = "best (outside loop)"; |
| 1444 | break; |
| 1445 | case 2: |
| 1446 | pc = "best (inside loop, slow)"; |
| 1447 | break; |
| 1448 | } |
| 1449 | MSGFcxx . . $ `external/lame/util.h:607:9`!(gfc, "\thuffman search: %s\n", pc); |
| 1450 | MSGFcxx . . $ `external/lame/util.h:607:9`!(gfc, "\texperimental Y=%d\n", gfp->experimentalYcxx . . $ lame_global_struct#experimentalY.); |
| 1451 | MSGFcxx . . $ `external/lame/util.h:607:9`!(gfc, "\t...\n"); |
| 1452 | |
| 1453 | /* everything controlling the stream format |
| 1454 | */ |
| 1455 | MSGFcxx . . $ `external/lame/util.h:607:9`!(gfc, "\nstream format:\n\n"); |
| 1456 | switch (cfg->versioncxx . . $ $anonymous_type_fa6ce02aa65ebf3c_13#version.) { |
| 1457 | case 0: |
| 1458 | pc = "2.5"; |
| 1459 | break; |
| 1460 | case 1: |
| 1461 | pc = "1"; |
| 1462 | break; |
| 1463 | case 2: |
| 1464 | pc = "2"; |
| 1465 | break; |
| 1466 | default: |
| 1467 | pc = "?"; |
| 1468 | break; |
| 1469 | } |
| 1470 | MSGFcxx . . $ `external/lame/util.h:607:9`!(gfc, "\tMPEG-%s Layer 3\n", pc); |
| 1471 | switch (cfg->modecxx . . $ $anonymous_type_fa6ce02aa65ebf3c_13#mode.) { |
| 1472 | case JOINT_STEREOcxx . . $ JOINT_STEREO.: |
| 1473 | pc = "joint stereo"; |
| 1474 | break; |
| 1475 | case STEREOcxx . . $ STEREO.: |
| 1476 | pc = "stereo"; |
| 1477 | break; |
| 1478 | case DUAL_CHANNELcxx . . $ DUAL_CHANNEL.: |
| 1479 | pc = "dual channel"; |
| 1480 | break; |
| 1481 | case MONOcxx . . $ MONO.: |
| 1482 | pc = "mono"; |
| 1483 | break; |
| 1484 | case NOT_SETcxx . . $ NOT_SET.: |
| 1485 | pc = "not set (error)"; |
| 1486 | break; |
| 1487 | default: |
| 1488 | pc = "unknown (error)"; |
| 1489 | break; |
| 1490 | } |
| 1491 | MSGFcxx . . $ `external/lame/util.h:607:9`!(gfc, "\t%d channel - %s\n", cfg->channels_outcxx . . $ $anonymous_type_fa6ce02aa65ebf3c_13#channels_out., pc); |
| 1492 | |
| 1493 | switch (cfg->vbrcxx . . $ $anonymous_type_fa6ce02aa65ebf3c_13#vbr.) { |
| 1494 | case vbr_offcxx . . $ vbr_off.: |
| 1495 | pc = "off"; |
| 1496 | break; |
| 1497 | default: |
| 1498 | pc = "all"; |
| 1499 | break; |
| 1500 | } |
| 1501 | MSGFcxx . . $ `external/lame/util.h:607:9`!(gfc, "\tpadding: %s\n", pc); |
| 1502 | |
| 1503 | if (vbr_defaultcxx . . $ vbr_default. == cfg->vbrcxx . . $ $anonymous_type_fa6ce02aa65ebf3c_13#vbr.) |
| 1504 | pc = "(default)"; |
| 1505 | else if (cfg->free_formatcxx . . $ $anonymous_type_fa6ce02aa65ebf3c_13#free_format.) |
| 1506 | pc = "(free format)"; |
| 1507 | else |
| 1508 | pc = ""; |
| 1509 | switch (cfg->vbrcxx . . $ $anonymous_type_fa6ce02aa65ebf3c_13#vbr.) { |
| 1510 | case vbr_offcxx . . $ vbr_off.: |
| 1511 | MSGFcxx . . $ `external/lame/util.h:607:9`!(gfc, "\tconstant bitrate - CBR %s\n", pc); |
| 1512 | break; |
| 1513 | case vbr_abrcxx . . $ vbr_abr.: |
| 1514 | MSGFcxx . . $ `external/lame/util.h:607:9`!(gfc, "\tvariable bitrate - ABR %s\n", pc); |
| 1515 | break; |
| 1516 | case vbr_rhcxx . . $ vbr_rh.: |
| 1517 | MSGFcxx . . $ `external/lame/util.h:607:9`!(gfc, "\tvariable bitrate - VBR rh %s\n", pc); |
| 1518 | break; |
| 1519 | case vbr_mtcxx . . $ vbr_mt.: |
| 1520 | MSGFcxx . . $ `external/lame/util.h:607:9`!(gfc, "\tvariable bitrate - VBR mt %s\n", pc); |
| 1521 | break; |
| 1522 | case vbr_mtrhcxx . . $ vbr_mtrh.: |
| 1523 | MSGFcxx . . $ `external/lame/util.h:607:9`!(gfc, "\tvariable bitrate - VBR mtrh %s\n", pc); |
| 1524 | break; |
| 1525 | default: |
| 1526 | MSGFcxx . . $ `external/lame/util.h:607:9`!(gfc, "\t ?? oops, some new one ?? \n"); |
| 1527 | break; |
| 1528 | } |
| 1529 | if (cfg->write_lame_tagcxx . . $ $anonymous_type_fa6ce02aa65ebf3c_13#write_lame_tag.) |
| 1530 | MSGFcxx . . $ `external/lame/util.h:607:9`!(gfc, "\tusing LAME Tag\n"); |
| 1531 | MSGFcxx . . $ `external/lame/util.h:607:9`!(gfc, "\t...\n"); |
| 1532 | |
| 1533 | /* everything controlling psychoacoustic settings, like ATH, etc. |
| 1534 | */ |
| 1535 | MSGFcxx . . $ `external/lame/util.h:607:9`!(gfc, "\npsychoacoustic:\n\n"); |
| 1536 | |
| 1537 | switch (cfg->short_blockscxx . . $ $anonymous_type_fa6ce02aa65ebf3c_13#short_blocks.) { |
| 1538 | default: |
| 1539 | case short_block_not_setcxx . . $ short_block_not_set.: |
| 1540 | pc = "?"; |
| 1541 | break; |
| 1542 | case short_block_allowedcxx . . $ short_block_allowed.: |
| 1543 | pc = "allowed"; |
| 1544 | break; |
| 1545 | case short_block_coupledcxx . . $ short_block_coupled.: |
| 1546 | pc = "channel coupled"; |
| 1547 | break; |
| 1548 | case short_block_dispensedcxx . . $ short_block_dispensed.: |
| 1549 | pc = "dispensed"; |
| 1550 | break; |
| 1551 | case short_block_forcedcxx . . $ short_block_forced.: |
| 1552 | pc = "forced"; |
| 1553 | break; |
| 1554 | } |
| 1555 | MSGFcxx . . $ `external/lame/util.h:607:9`!(gfc, "\tusing short blocks: %s\n", pc); |
| 1556 | MSGFcxx . . $ `external/lame/util.h:607:9`!(gfc, "\tsubblock gain: %d\n", cfg->subblock_gaincxx . . $ $anonymous_type_fa6ce02aa65ebf3c_13#subblock_gain.); |
| 1557 | MSGFcxx . . $ `external/lame/util.h:607:9`!(gfc, "\tadjust masking: %g dB\n", gfc->sv_qntcxx . . $ lame_internal_flags#sv_qnt..mask_adjustcxx . . $ $anonymous_type_fa6ce02aa65ebf3c_10#mask_adjust.); |
| 1558 | MSGFcxx . . $ `external/lame/util.h:607:9`!(gfc, "\tadjust masking short: %g dB\n", gfc->sv_qntcxx . . $ lame_internal_flags#sv_qnt..mask_adjust_shortcxx . . $ $anonymous_type_fa6ce02aa65ebf3c_10#mask_adjust_short.); |
| 1559 | MSGFcxx . . $ `external/lame/util.h:607:9`!(gfc, "\tquantization comparison: %d\n", cfg->quant_compcxx . . $ $anonymous_type_fa6ce02aa65ebf3c_13#quant_comp.); |
| 1560 | MSGFcxx . . $ `external/lame/util.h:607:9`!(gfc, "\t ^ comparison short blocks: %d\n", cfg->quant_comp_shortcxx . . $ $anonymous_type_fa6ce02aa65ebf3c_13#quant_comp_short.); |
| 1561 | MSGFcxx . . $ `external/lame/util.h:607:9`!(gfc, "\tnoise shaping: %d\n", cfg->noise_shapingcxx . . $ $anonymous_type_fa6ce02aa65ebf3c_13#noise_shaping.); |
| 1562 | MSGFcxx . . $ `external/lame/util.h:607:9`!(gfc, "\t ^ amplification: %d\n", cfg->noise_shaping_ampcxx . . $ $anonymous_type_fa6ce02aa65ebf3c_13#noise_shaping_amp.); |
| 1563 | MSGFcxx . . $ `external/lame/util.h:607:9`!(gfc, "\t ^ stopping: %d\n", cfg->noise_shaping_stopcxx . . $ $anonymous_type_fa6ce02aa65ebf3c_13#noise_shaping_stop.); |
| 1564 | |
| 1565 | pc = "using"; |
| 1566 | if (cfg->ATHshortcxx . . $ $anonymous_type_fa6ce02aa65ebf3c_13#ATHshort.) |
| 1567 | pc = "the only masking for short blocks"; |
| 1568 | if (cfg->ATHonlycxx . . $ $anonymous_type_fa6ce02aa65ebf3c_13#ATHonly.) |
| 1569 | pc = "the only masking"; |
| 1570 | if (cfg->noATHcxx . . $ $anonymous_type_fa6ce02aa65ebf3c_13#noATH.) |
| 1571 | pc = "not used"; |
| 1572 | MSGFcxx . . $ `external/lame/util.h:607:9`!(gfc, "\tATH: %s\n", pc); |
| 1573 | MSGFcxx . . $ `external/lame/util.h:607:9`!(gfc, "\t ^ type: %d\n", cfg->ATHtypecxx . . $ $anonymous_type_fa6ce02aa65ebf3c_13#ATHtype.); |
| 1574 | MSGFcxx . . $ `external/lame/util.h:607:9`!(gfc, "\t ^ shape: %g%s\n", cfg->ATHcurvecxx . . $ $anonymous_type_fa6ce02aa65ebf3c_13#ATHcurve., " (only for type 4)"); |
| 1575 | MSGFcxx . . $ `external/lame/util.h:607:9`!(gfc, "\t ^ level adjustement: %g dB\n", cfg->ATH_offset_dbcxx . . $ $anonymous_type_fa6ce02aa65ebf3c_13#ATH_offset_db.); |
| 1576 | MSGFcxx . . $ `external/lame/util.h:607:9`!(gfc, "\t ^ adjust type: %d\n", gfc->ATHcxx . . $ lame_internal_flags#ATH.->use_adjustcxx . . $ $anonymous_type_fa6ce02aa65ebf3c_2#use_adjust.); |
| 1577 | MSGFcxx . . $ `external/lame/util.h:607:9`!(gfc, "\t ^ adjust sensitivity power: %f\n", gfc->ATHcxx . . $ lame_internal_flags#ATH.->aa_sensitivity_pcxx . . $ $anonymous_type_fa6ce02aa65ebf3c_2#aa_sensitivity_p.); |
| 1578 | |
| 1579 | MSGFcxx . . $ `external/lame/util.h:607:9`!(gfc, "\texperimental psy tunings by Naoki Shibata\n"); |
| 1580 | MSGFcxx . . $ `external/lame/util.h:607:9`!(gfc, "\t adjust masking bass=%g dB, alto=%g dB, treble=%g dB, sfb21=%g dB\n", |
| 1581 | 10 * log10(gfc->sv_qntcxx . . $ lame_internal_flags#sv_qnt..longfactcxx . . $ $anonymous_type_fa6ce02aa65ebf3c_10#longfact.[0]), |
| 1582 | 10 * log10(gfc->sv_qntcxx . . $ lame_internal_flags#sv_qnt..longfactcxx . . $ $anonymous_type_fa6ce02aa65ebf3c_10#longfact.[7]), |
| 1583 | 10 * log10(gfc->sv_qntcxx . . $ lame_internal_flags#sv_qnt..longfactcxx . . $ $anonymous_type_fa6ce02aa65ebf3c_10#longfact.[14]), 10 * log10(gfc->sv_qntcxx . . $ lame_internal_flags#sv_qnt..longfactcxx . . $ $anonymous_type_fa6ce02aa65ebf3c_10#longfact.[21])); |
| 1584 | |
| 1585 | pc = cfg->use_temporal_masking_effectcxx . . $ $anonymous_type_fa6ce02aa65ebf3c_13#use_temporal_masking_effect. ? "yes" : "no"; |
| 1586 | MSGFcxx . . $ `external/lame/util.h:607:9`!(gfc, "\tusing temporal masking effect: %s\n", pc); |
| 1587 | MSGFcxx . . $ `external/lame/util.h:607:9`!(gfc, "\tinterchannel masking ratio: %g\n", cfg->interChRatiocxx . . $ $anonymous_type_fa6ce02aa65ebf3c_13#interChRatio.); |
| 1588 | MSGFcxx . . $ `external/lame/util.h:607:9`!(gfc, "\t...\n"); |
| 1589 | |
| 1590 | /* that's all ? |
| 1591 | */ |
| 1592 | MSGFcxx . . $ `external/lame/util.h:607:9`!(gfc, "\n"); |
| 1593 | return; |
| 1594 | } |
| 1595 | |
| 1596 | |
| 1597 | static void |
| 1598 | save_gain_valuescxx . . $ save_gain_values(4f558d83b2842a93).(lame_internal_flagscxx . . $ lame_internal_flags# * gfc) |
| 1599 | { |
| 1600 | SessionConfig_tcxx . . $ SessionConfig_t# const *const cfg = &gfc->cfgcxx . . $ lame_internal_flags#cfg.; |
| 1601 | RpgStateVar_tcxx . . $ RpgStateVar_t# const *const rsv = &gfc->sv_rpgcxx . . $ lame_internal_flags#sv_rpg.; |
| 1602 | RpgResult_tcxx . . $ RpgResult_t# *const rov = &gfc->ov_rpgcxx . . $ lame_internal_flags#ov_rpg.; |
| 1603 | /* save the ReplayGain value */ |
| 1604 | if (cfg->findReplayGaincxx . . $ $anonymous_type_fa6ce02aa65ebf3c_13#findReplayGain.) { |
| 1605 | FLOATcxx . . $ FLOAT# const RadioGain = (FLOATcxx . . $ FLOAT#) GetTitleGaincxx . . $ GetTitleGain(55f8604f8dde2563).(rsv->rgdatacxx . . $ $anonymous_type_fa6ce02aa65ebf3c_11#rgdata.); |
| 1606 | if (NEQcxx . . $ `external/lame/machine.h:177:9`!(RadioGain, GAIN_NOT_ENOUGH_SAMPLES)) { |
| 1607 | rov->RadioGaincxx . . $ $anonymous_type_fa6ce02aa65ebf3c_12#RadioGain. = (int) floor(RadioGain * 10.0 + 0.5); /* round to nearest */ |
| 1608 | } |
| 1609 | else { |
| 1610 | rov->RadioGaincxx . . $ $anonymous_type_fa6ce02aa65ebf3c_12#RadioGain. = 0; |
| 1611 | } |
| 1612 | } |
| 1613 | |
| 1614 | /* find the gain and scale change required for no clipping */ |
| 1615 | if (cfg->findPeakSamplecxx . . $ $anonymous_type_fa6ce02aa65ebf3c_13#findPeakSample.) { |
| 1616 | rov->noclipGainChangecxx . . $ $anonymous_type_fa6ce02aa65ebf3c_12#noclipGainChange. = (int) ceil(log10(rov->PeakSamplecxx . . $ $anonymous_type_fa6ce02aa65ebf3c_12#PeakSample. / 32767.0) * 20.0 * 10.0); /* round up */ |
| 1617 | |
| 1618 | if (rov->noclipGainChangecxx . . $ $anonymous_type_fa6ce02aa65ebf3c_12#noclipGainChange. > 0) { /* clipping occurs */ |
| 1619 | rov->noclipScalecxx . . $ $anonymous_type_fa6ce02aa65ebf3c_12#noclipScale. = floor((32767.0f / rov->PeakSamplecxx . . $ $anonymous_type_fa6ce02aa65ebf3c_12#PeakSample.) * 100.0f) / 100.0f; /* round down */ |
| 1620 | } |
| 1621 | else /* no clipping */ |
| 1622 | rov->noclipScalecxx . . $ $anonymous_type_fa6ce02aa65ebf3c_12#noclipScale. = -1.0f; |
| 1623 | } |
| 1624 | } |
| 1625 | |
| 1626 | |
| 1627 | |
| 1628 | static int |
| 1629 | update_inbuffer_sizecxx . . $ update_inbuffer_size(574deb7cf065bccc).(lame_internal_flagscxx . . $ lame_internal_flags# * gfc, const int nsamples) |
| 1630 | { |
| 1631 | EncStateVar_tcxx . . $ EncStateVar_t# *const esv = &gfc->sv_enccxx . . $ lame_internal_flags#sv_enc.; |
| 1632 | if (esv->in_buffer_0cxx . . $ $anonymous_type_fa6ce02aa65ebf3c_7#in_buffer_0. == 0 || esv->in_buffer_nsamplescxx . . $ $anonymous_type_fa6ce02aa65ebf3c_7#in_buffer_nsamples. < nsamples) { |
| 1633 | if (esv->in_buffer_0cxx . . $ $anonymous_type_fa6ce02aa65ebf3c_7#in_buffer_0.) { |
| 1634 | freecxx . . $ free(5d22bdacc48458e8).(esv->in_buffer_0cxx . . $ $anonymous_type_fa6ce02aa65ebf3c_7#in_buffer_0.); |
| 1635 | } |
| 1636 | if (esv->in_buffer_1cxx . . $ $anonymous_type_fa6ce02aa65ebf3c_7#in_buffer_1.) { |
| 1637 | freecxx . . $ free(5d22bdacc48458e8).(esv->in_buffer_1cxx . . $ $anonymous_type_fa6ce02aa65ebf3c_7#in_buffer_1.); |
| 1638 | } |
| 1639 | esv->in_buffer_0cxx . . $ $anonymous_type_fa6ce02aa65ebf3c_7#in_buffer_0. = lame_calloccxx . . $ `external/lame/machine.h:161:9`!(sample_t, nsamples); |
| 1640 | esv->in_buffer_1cxx . . $ $anonymous_type_fa6ce02aa65ebf3c_7#in_buffer_1. = lame_calloccxx . . $ `external/lame/machine.h:161:9`!(sample_t, nsamples); |
| 1641 | esv->in_buffer_nsamplescxx . . $ $anonymous_type_fa6ce02aa65ebf3c_7#in_buffer_nsamples. = nsamples; |
| 1642 | } |
| 1643 | if (esv->in_buffer_0cxx . . $ $anonymous_type_fa6ce02aa65ebf3c_7#in_buffer_0. == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`! || esv->in_buffer_1cxx . . $ $anonymous_type_fa6ce02aa65ebf3c_7#in_buffer_1. == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) { |
| 1644 | if (esv->in_buffer_0cxx . . $ $anonymous_type_fa6ce02aa65ebf3c_7#in_buffer_0.) { |
| 1645 | freecxx . . $ free(5d22bdacc48458e8).(esv->in_buffer_0cxx . . $ $anonymous_type_fa6ce02aa65ebf3c_7#in_buffer_0.); |
| 1646 | } |
| 1647 | if (esv->in_buffer_1cxx . . $ $anonymous_type_fa6ce02aa65ebf3c_7#in_buffer_1.) { |
| 1648 | freecxx . . $ free(5d22bdacc48458e8).(esv->in_buffer_1cxx . . $ $anonymous_type_fa6ce02aa65ebf3c_7#in_buffer_1.); |
| 1649 | } |
| 1650 | esv->in_buffer_0cxx . . $ $anonymous_type_fa6ce02aa65ebf3c_7#in_buffer_0. = 0; |
| 1651 | esv->in_buffer_1cxx . . $ $anonymous_type_fa6ce02aa65ebf3c_7#in_buffer_1. = 0; |
| 1652 | esv->in_buffer_nsamplescxx . . $ $anonymous_type_fa6ce02aa65ebf3c_7#in_buffer_nsamples. = 0; |
| 1653 | ERRORFcxx . . $ `external/lame/util.h:606:9`!(gfc, "Error: can't allocate in_buffer buffer\n"); |
| 1654 | return -2; |
| 1655 | } |
| 1656 | return 0; |
| 1657 | } |
| 1658 | |
| 1659 | |
| 1660 | static int |
| 1661 | calcNeededcxx . . $ calcNeeded(3353a2dd70c7b2e6).(SessionConfig_tcxx . . $ SessionConfig_t# const * cfg) |
| 1662 | { |
| 1663 | int mf_needed; |
| 1664 | int pcm_samples_per_frame = 576 * cfg->mode_grcxx . . $ $anonymous_type_fa6ce02aa65ebf3c_13#mode_gr.; |
| 1665 | |
| 1666 | /* some sanity checks */ |
| 1667 | #if ENCDELAYcxx . . $ `external/lame/encoder.h:57:9`! < MDCTDELAYcxx . . $ `external/lame/encoder.h:82:9`! |
| 1668 | # error ENCDELAY is less than MDCTDELAY, see encoder.h |
| 1669 | #endif |
| 1670 | #if FFTOFFSETcxx . . $ `external/lame/encoder.h:83:9`! > BLKSIZEcxx . . $ `external/lame/encoder.h:111:9`! |
| 1671 | # error FFTOFFSET is greater than BLKSIZE, see encoder.h |
| 1672 | #endif |
| 1673 | |
| 1674 | mf_needed = BLKSIZEcxx . . $ `external/lame/encoder.h:111:9`! + pcm_samples_per_frame - FFTOFFSETcxx . . $ `external/lame/encoder.h:83:9`!; /* amount needed for FFT */ |
| 1675 | /*mf_needed = Max(mf_needed, 286 + 576 * (1 + gfc->mode_gr)); */ |
| 1676 | mf_needed = Maxcxx . . $ `external/lame/util.h:92:17`!(mf_needed, 512 + pcm_samples_per_frame - 32); |
| 1677 | |
| 1678 | assertcxx . . $ `<external>/4398592474888995393/assert.h:118:11`!(MFSIZEcxx . . $ `external/lame/util.h:294:10`! >= mf_needed); |
| 1679 | |
| 1680 | return mf_needed; |
| 1681 | } |
| 1682 | |
| 1683 | |
| 1684 | /* |
| 1685 | * THE MAIN LAME ENCODING INTERFACE |
| 1686 | * mt 3/00 |
| 1687 | * |
| 1688 | * input pcm data, output (maybe) mp3 frames. |
| 1689 | * This routine handles all buffering, resampling and filtering for you. |
| 1690 | * The required mp3buffer_size can be computed from num_samples, |
| 1691 | * samplerate and encoding rate, but here is a worst case estimate: |
| 1692 | * |
| 1693 | * mp3buffer_size in bytes = 1.25*num_samples + 7200 |
| 1694 | * |
| 1695 | * return code = number of bytes output in mp3buffer. can be 0 |
| 1696 | * |
| 1697 | * NOTE: this routine uses LAME's internal PCM data representation, |
| 1698 | * 'sample_t'. It should not be used by any application. |
| 1699 | * applications should use lame_encode_buffer(), |
| 1700 | * lame_encode_buffer_float() |
| 1701 | * lame_encode_buffer_int() |
| 1702 | * etc... depending on what type of data they are working with. |
| 1703 | */ |
| 1704 | static int |
| 1705 | lame_encode_buffer_sample_tcxx . . $ lame_encode_buffer_sample_t(382aaab3ae1f375e).(lame_internal_flagscxx . . $ lame_internal_flags# * gfc, |
| 1706 | int nsamples, unsigned char *mp3buf, const int mp3buf_size) |
| 1707 | { |
| 1708 | SessionConfig_tcxx . . $ SessionConfig_t# const *const cfg = &gfc->cfgcxx . . $ lame_internal_flags#cfg.; |
| 1709 | EncStateVar_tcxx . . $ EncStateVar_t# *const esv = &gfc->sv_enccxx . . $ lame_internal_flags#sv_enc.; |
| 1710 | int pcm_samples_per_frame = 576 * cfg->mode_grcxx . . $ $anonymous_type_fa6ce02aa65ebf3c_13#mode_gr.; |
| 1711 | int mp3size = 0, ret, i, ch, mf_needed; |
| 1712 | int mp3out; |
| 1713 | sample_tcxx . . $ sample_t# *mfbuf[2]; |
| 1714 | sample_tcxx . . $ sample_t# *in_buffer[2]; |
| 1715 | |
| 1716 | if (gfc->class_idcxx . . $ lame_internal_flags#class_id. != LAME_IDcxx . . $ `external/lame/util.h:483:12`!) |
| 1717 | return -3; |
| 1718 | |
| 1719 | if (nsamples == 0) |
| 1720 | return 0; |
| 1721 | |
| 1722 | /* copy out any tags that may have been written into bitstream */ |
| 1723 | { /* if user specifed buffer size = 0, dont check size */ |
| 1724 | int const buf_size = mp3buf_size == 0 ? INT_MAXcxx . . $ `<external>/67164224788392828/limits.h:120:9`! : mp3buf_size; |
| 1725 | mp3out = copy_buffercxx . . $ copy_buffer(f6fd3c9cde6b7d1d).(gfc, mp3buf, buf_size, 0); |
| 1726 | } |
| 1727 | if (mp3out < 0) |
| 1728 | return mp3out; /* not enough buffer space */ |
| 1729 | mp3buf += mp3out; |
| 1730 | mp3size += mp3out; |
| 1731 | |
| 1732 | in_buffer[0] = esv->in_buffer_0cxx . . $ $anonymous_type_fa6ce02aa65ebf3c_7#in_buffer_0.; |
| 1733 | in_buffer[1] = esv->in_buffer_1cxx . . $ $anonymous_type_fa6ce02aa65ebf3c_7#in_buffer_1.; |
| 1734 | |
| 1735 | mf_needed = calcNeededcxx . . $ calcNeeded(3353a2dd70c7b2e6).(cfg); |
| 1736 | |
| 1737 | mfbuf[0] = esv->mfbufcxx . . $ $anonymous_type_fa6ce02aa65ebf3c_7#mfbuf.[0]; |
| 1738 | mfbuf[1] = esv->mfbufcxx . . $ $anonymous_type_fa6ce02aa65ebf3c_7#mfbuf.[1]; |
| 1739 | |
| 1740 | while (nsamples > 0) { |
| 1741 | sample_tcxx . . $ sample_t# const *in_buffer_ptr[2]; |
| 1742 | int n_in = 0; /* number of input samples processed with fill_buffer */ |
| 1743 | int n_out = 0; /* number of samples output with fill_buffer */ |
| 1744 | /* n_in <> n_out if we are resampling */ |
| 1745 | |
| 1746 | in_buffer_ptr[0] = in_buffer[0]; |
| 1747 | in_buffer_ptr[1] = in_buffer[1]; |
| 1748 | /* copy in new samples into mfbuf, with resampling */ |
| 1749 | fill_buffercxx . . $ fill_buffer(a28439526dc95a64).(gfc, mfbuf, &in_buffer_ptr[0], nsamples, &n_in, &n_out); |
| 1750 | |
| 1751 | /* compute ReplayGain of resampled input if requested */ |
| 1752 | if (cfg->findReplayGaincxx . . $ $anonymous_type_fa6ce02aa65ebf3c_13#findReplayGain. && !cfg->decode_on_the_flycxx . . $ $anonymous_type_fa6ce02aa65ebf3c_13#decode_on_the_fly.) |
| 1753 | if (AnalyzeSamplescxx . . $ AnalyzeSamples(b9e75bfeaec731f0). |
| 1754 | (gfc->sv_rpgcxx . . $ lame_internal_flags#sv_rpg..rgdatacxx . . $ $anonymous_type_fa6ce02aa65ebf3c_11#rgdata., &mfbuf[0][esv->mf_sizecxx . . $ $anonymous_type_fa6ce02aa65ebf3c_7#mf_size.], &mfbuf[1][esv->mf_sizecxx . . $ $anonymous_type_fa6ce02aa65ebf3c_7#mf_size.], n_out, |
| 1755 | cfg->channels_outcxx . . $ $anonymous_type_fa6ce02aa65ebf3c_13#channels_out.) == GAIN_ANALYSIS_ERRORcxx . . $ GAIN_ANALYSIS_ERROR.) |
| 1756 | return -6; |
| 1757 | |
| 1758 | |
| 1759 | |
| 1760 | /* update in_buffer counters */ |
| 1761 | nsamples -= n_in; |
| 1762 | in_buffer[0] += n_in; |
| 1763 | if (cfg->channels_outcxx . . $ $anonymous_type_fa6ce02aa65ebf3c_13#channels_out. == 2) |
| 1764 | in_buffer[1] += n_in; |
| 1765 | |
| 1766 | /* update mfbuf[] counters */ |
| 1767 | esv->mf_sizecxx . . $ $anonymous_type_fa6ce02aa65ebf3c_7#mf_size. += n_out; |
| 1768 | assertcxx . . $ `<external>/4398592474888995393/assert.h:118:11`!(esv->mf_size <= MFSIZEcxx . . $ `external/lame/util.h:294:10`!); |
| 1769 | |
| 1770 | /* lame_encode_flush may have set gfc->mf_sample_to_encode to 0 |
| 1771 | * so we have to reinitialize it here when that happened. |
| 1772 | */ |
| 1773 | if (esv->mf_samples_to_encodecxx . . $ $anonymous_type_fa6ce02aa65ebf3c_7#mf_samples_to_encode. < 1) { |
| 1774 | esv->mf_samples_to_encodecxx . . $ $anonymous_type_fa6ce02aa65ebf3c_7#mf_samples_to_encode. = ENCDELAYcxx . . $ `external/lame/encoder.h:57:9`! + POSTDELAYcxx . . $ `external/lame/encoder.h:72:9`!; |
| 1775 | } |
| 1776 | esv->mf_samples_to_encodecxx . . $ $anonymous_type_fa6ce02aa65ebf3c_7#mf_samples_to_encode. += n_out; |
| 1777 | |
| 1778 | |
| 1779 | if (esv->mf_sizecxx . . $ $anonymous_type_fa6ce02aa65ebf3c_7#mf_size. >= mf_needed) { |
| 1780 | /* encode the frame. */ |
| 1781 | /* mp3buf = pointer to current location in buffer */ |
| 1782 | /* mp3buf_size = size of original mp3 output buffer */ |
| 1783 | /* = 0 if we should not worry about the */ |
| 1784 | /* buffer size because calling program is */ |
| 1785 | /* to lazy to compute it */ |
| 1786 | /* mp3size = size of data written to buffer so far */ |
| 1787 | /* mp3buf_size-mp3size = amount of space avalable */ |
| 1788 | |
| 1789 | int buf_size = mp3buf_size - mp3size; |
| 1790 | if (mp3buf_size == 0) |
| 1791 | buf_size = INT_MAXcxx . . $ `<external>/67164224788392828/limits.h:120:9`!; |
| 1792 | |
| 1793 | ret = lame_encode_mp3_framecxx . . $ lame_encode_mp3_frame(c6499b4c1c47202c).(gfc, mfbuf[0], mfbuf[1], mp3buf, buf_size); |
| 1794 | |
| 1795 | if (ret < 0) |
| 1796 | return ret; |
| 1797 | mp3buf += ret; |
| 1798 | mp3size += ret; |
| 1799 | |
| 1800 | /* shift out old samples */ |
| 1801 | esv->mf_sizecxx . . $ $anonymous_type_fa6ce02aa65ebf3c_7#mf_size. -= pcm_samples_per_frame; |
| 1802 | esv->mf_samples_to_encodecxx . . $ $anonymous_type_fa6ce02aa65ebf3c_7#mf_samples_to_encode. -= pcm_samples_per_frame; |
| 1803 | for (ch = 0; ch < cfg->channels_outcxx . . $ $anonymous_type_fa6ce02aa65ebf3c_13#channels_out.; ch++) |
| 1804 | for (i = 0; i < esv->mf_sizecxx . . $ $anonymous_type_fa6ce02aa65ebf3c_7#mf_size.; i++) |
| 1805 | mfbuf[ch][i] = mfbuf[ch][i + pcm_samples_per_frame]; |
| 1806 | } |
| 1807 | } |
| 1808 | assertcxx . . $ `<external>/4398592474888995393/assert.h:118:11`!(nsamples == 0); |
| 1809 | |
| 1810 | return mp3size; |
| 1811 | } |
| 1812 | |
| 1813 | enum PCMSampleTypecxx . . $ PCMSampleType# |
| 1814 | { pcm_short_typecxx . . $ pcm_short_type. |
| 1815 | , pcm_int_typecxx . . $ pcm_int_type. |
| 1816 | , pcm_long_typecxx . . $ pcm_long_type. |
| 1817 | , pcm_float_typecxx . . $ pcm_float_type. |
| 1818 | , pcm_double_typecxx . . $ pcm_double_type. |
| 1819 | }; |
| 1820 | |
| 1821 | static void |
| 1822 | lame_copy_inbuffercxx . . $ lame_copy_inbuffer(b6ddd1cc8f6e158a).(lame_internal_flagscxx . . $ lame_internal_flags#* gfc, |
| 1823 | void const* l, void const* r, int nsamples, |
| 1824 | enum PCMSampleTypecxx . . $ PCMSampleType# pcm_type, int jump, FLOATcxx . . $ FLOAT# s) |
| 1825 | { |
| 1826 | SessionConfig_tcxx . . $ SessionConfig_t# const *const cfg = &gfc->cfgcxx . . $ lame_internal_flags#cfg.; |
| 1827 | EncStateVar_tcxx . . $ EncStateVar_t# *const esv = &gfc->sv_enccxx . . $ lame_internal_flags#sv_enc.; |
| 1828 | sample_tcxx . . $ sample_t#* ib0 = esv->in_buffer_0cxx . . $ $anonymous_type_fa6ce02aa65ebf3c_7#in_buffer_0.; |
| 1829 | sample_tcxx . . $ sample_t#* ib1 = esv->in_buffer_1cxx . . $ $anonymous_type_fa6ce02aa65ebf3c_7#in_buffer_1.; |
| 1830 | FLOATcxx . . $ FLOAT# m[2][2]; |
| 1831 | |
| 1832 | /* Apply user defined re-scaling */ |
| 1833 | m[0][0] = s * cfg->pcm_transformcxx . . $ $anonymous_type_fa6ce02aa65ebf3c_13#pcm_transform.[0][0]; |
| 1834 | m[0][1] = s * cfg->pcm_transformcxx . . $ $anonymous_type_fa6ce02aa65ebf3c_13#pcm_transform.[0][1]; |
| 1835 | m[1][0] = s * cfg->pcm_transformcxx . . $ $anonymous_type_fa6ce02aa65ebf3c_13#pcm_transform.[1][0]; |
| 1836 | m[1][1] = s * cfg->pcm_transformcxx . . $ $anonymous_type_fa6ce02aa65ebf3c_13#pcm_transform.[1][1]; |
| 1837 | |
| 1838 | /* make a copy of input buffer, changing type to sample_t */ |
| 1839 | #define COPY_AND_TRANSFORMcxx . . $ `external/lame/lame.c:1839:9`!(T) \ |
| 1840 | { \ |
| 1841 | T const *bl = l, *br = r; \ |
| 1842 | int i; \ |
| 1843 | for (i = 0; i < nsamples; i++) { \ |
| 1844 | sample_t const xl = *bl; \ |
| 1845 | sample_t const xr = *br; \ |
| 1846 | sample_t const u = xl * m[0][0] + xr * m[0][1]; \ |
| 1847 | sample_t const v = xl * m[1][0] + xr * m[1][1]; \ |
| 1848 | ib0[i] = u; \ |
| 1849 | ib1[i] = v; \ |
| 1850 | bl += jump; \ |
| 1851 | br += jump; \ |
| 1852 | } \ |
| 1853 | } |
| 1854 | switch ( pcm_type ) { |
| 1855 | case pcm_short_typecxx . . $ pcm_short_type.: |
| 1856 | COPY_AND_TRANSFORMcxx . . $ `external/lame/lame.c:1839:9`!(short int); |
| 1857 | break; |
| 1858 | case pcm_int_typecxx . . $ pcm_int_type.: |
| 1859 | COPY_AND_TRANSFORMcxx . . $ `external/lame/lame.c:1839:9`!(int); |
| 1860 | break; |
| 1861 | case pcm_long_typecxx . . $ pcm_long_type.: |
| 1862 | COPY_AND_TRANSFORMcxx . . $ `external/lame/lame.c:1839:9`!(long int); |
| 1863 | break; |
| 1864 | case pcm_float_typecxx . . $ pcm_float_type.: |
| 1865 | COPY_AND_TRANSFORMcxx . . $ `external/lame/lame.c:1839:9`!(float); |
| 1866 | break; |
| 1867 | case pcm_double_typecxx . . $ pcm_double_type.: |
| 1868 | COPY_AND_TRANSFORMcxx . . $ `external/lame/lame.c:1839:9`!(double); |
| 1869 | break; |
| 1870 | } |
| 1871 | } |
| 1872 | |
| 1873 | |
| 1874 | static int |
| 1875 | lame_encode_buffer_templatecxx . . $ lame_encode_buffer_template(5723ca0f9f13c6b2).(lame_global_flagscxx . . $ lame_global_flags# * gfp, |
| 1876 | void const* buffer_l, void const* buffer_r, const int nsamples, |
| 1877 | unsigned char *mp3buf, const int mp3buf_size, enum PCMSampleTypecxx . . $ PCMSampleType# pcm_type, int aa, FLOATcxx . . $ FLOAT# norm) |
| 1878 | { |
| 1879 | if (is_lame_global_flags_validcxx . . $ is_lame_global_flags_valid(a5abb0ff158568ac).(gfp)) { |
| 1880 | lame_internal_flagscxx . . $ lame_internal_flags# *const gfc = gfp->internal_flagscxx . . $ lame_global_struct#internal_flags.; |
| 1881 | if (is_lame_internal_flags_validcxx . . $ is_lame_internal_flags_valid(b815612886108da).(gfc)) { |
| 1882 | SessionConfig_tcxx . . $ SessionConfig_t# const *const cfg = &gfc->cfgcxx . . $ lame_internal_flags#cfg.; |
| 1883 | |
| 1884 | if (nsamples == 0) |
| 1885 | return 0; |
| 1886 | |
| 1887 | if (update_inbuffer_sizecxx . . $ update_inbuffer_size(574deb7cf065bccc).(gfc, nsamples) != 0) { |
| 1888 | return -2; |
| 1889 | } |
| 1890 | /* make a copy of input buffer, changing type to sample_t */ |
| 1891 | if (cfg->channels_incxx . . $ $anonymous_type_fa6ce02aa65ebf3c_13#channels_in. > 1) { |
| 1892 | if (buffer_l == 0 || buffer_r == 0) { |
| 1893 | return 0; |
| 1894 | } |
| 1895 | lame_copy_inbuffercxx . . $ lame_copy_inbuffer(b6ddd1cc8f6e158a).(gfc, buffer_l, buffer_r, nsamples, pcm_type, aa, norm); |
| 1896 | } |
| 1897 | else { |
| 1898 | if (buffer_l == 0) { |
| 1899 | return 0; |
| 1900 | } |
| 1901 | lame_copy_inbuffercxx . . $ lame_copy_inbuffer(b6ddd1cc8f6e158a).(gfc, buffer_l, buffer_l, nsamples, pcm_type, aa, norm); |
| 1902 | } |
| 1903 | |
| 1904 | return lame_encode_buffer_sample_tcxx . . $ lame_encode_buffer_sample_t(382aaab3ae1f375e).(gfc, nsamples, mp3buf, mp3buf_size); |
| 1905 | } |
| 1906 | } |
| 1907 | return -3; |
| 1908 | } |
| 1909 | |
| 1910 | int |
| 1911 | lame_encode_buffercxx . . $ lame_encode_buffer(7ed5c536065fe00e).(lame_global_flagscxx . . $ lame_global_flags# * gfp, |
| 1912 | const short int pcm_l[], const short int pcm_r[], const int nsamples, |
| 1913 | unsigned char *mp3buf, const int mp3buf_size) |
| 1914 | { |
| 1915 | return lame_encode_buffer_templatecxx . . $ lame_encode_buffer_template(5723ca0f9f13c6b2).(gfp, pcm_l, pcm_r, nsamples, mp3buf, mp3buf_size, pcm_short_typecxx . . $ pcm_short_type., 1, 1.0); |
| 1916 | } |
| 1917 | |
| 1918 | |
| 1919 | int |
| 1920 | lame_encode_buffer_floatcxx . . $ lame_encode_buffer_float(b451860e1b6aaf4).(lame_global_flagscxx . . $ lame_global_flags# * gfp, |
| 1921 | const float pcm_l[], const float pcm_r[], const int nsamples, |
| 1922 | unsigned char *mp3buf, const int mp3buf_size) |
| 1923 | { |
| 1924 | /* input is assumed to be normalized to +/- 32768 for full scale */ |
| 1925 | return lame_encode_buffer_templatecxx . . $ lame_encode_buffer_template(5723ca0f9f13c6b2).(gfp, pcm_l, pcm_r, nsamples, mp3buf, mp3buf_size, pcm_float_typecxx . . $ pcm_float_type., 1, 1.0); |
| 1926 | } |
| 1927 | |
| 1928 | |
| 1929 | int |
| 1930 | lame_encode_buffer_ieee_floatcxx . . $ lame_encode_buffer_ieee_float(b451860e1b6aaf4).(lame_tcxx . . $ lame_t# gfp, |
| 1931 | const float pcm_l[], const float pcm_r[], const int nsamples, |
| 1932 | unsigned char *mp3buf, const int mp3buf_size) |
| 1933 | { |
| 1934 | /* input is assumed to be normalized to +/- 1.0 for full scale */ |
| 1935 | return lame_encode_buffer_templatecxx . . $ lame_encode_buffer_template(5723ca0f9f13c6b2).(gfp, pcm_l, pcm_r, nsamples, mp3buf, mp3buf_size, pcm_float_typecxx . . $ pcm_float_type., 1, 32767.0); |
| 1936 | } |
| 1937 | |
| 1938 | |
| 1939 | int |
| 1940 | lame_encode_buffer_interleaved_ieee_floatcxx . . $ lame_encode_buffer_interleaved_ieee_float(de038d5318111fc8).(lame_tcxx . . $ lame_t# gfp, |
| 1941 | const float pcm[], const int nsamples, |
| 1942 | unsigned char *mp3buf, const int mp3buf_size) |
| 1943 | { |
| 1944 | /* input is assumed to be normalized to +/- 1.0 for full scale */ |
| 1945 | return lame_encode_buffer_templatecxx . . $ lame_encode_buffer_template(5723ca0f9f13c6b2).(gfp, pcm, pcm+1, nsamples, mp3buf, mp3buf_size, pcm_float_typecxx . . $ pcm_float_type., 2, 32767.0); |
| 1946 | } |
| 1947 | |
| 1948 | |
| 1949 | int |
| 1950 | lame_encode_buffer_ieee_doublecxx . . $ lame_encode_buffer_ieee_double(4eda97da346fc3fa).(lame_tcxx . . $ lame_t# gfp, |
| 1951 | const double pcm_l[], const double pcm_r[], const int nsamples, |
| 1952 | unsigned char *mp3buf, const int mp3buf_size) |
| 1953 | { |
| 1954 | /* input is assumed to be normalized to +/- 1.0 for full scale */ |
| 1955 | return lame_encode_buffer_templatecxx . . $ lame_encode_buffer_template(5723ca0f9f13c6b2).(gfp, pcm_l, pcm_r, nsamples, mp3buf, mp3buf_size, pcm_double_typecxx . . $ pcm_double_type., 1, 32767.0); |
| 1956 | } |
| 1957 | |
| 1958 | |
| 1959 | int |
| 1960 | lame_encode_buffer_interleaved_ieee_doublecxx . . $ lame_encode_buffer_interleaved_ieee_double(40bfc300c7c3c6a9).(lame_tcxx . . $ lame_t# gfp, |
| 1961 | const double pcm[], const int nsamples, |
| 1962 | unsigned char *mp3buf, const int mp3buf_size) |
| 1963 | { |
| 1964 | /* input is assumed to be normalized to +/- 1.0 for full scale */ |
| 1965 | return lame_encode_buffer_templatecxx . . $ lame_encode_buffer_template(5723ca0f9f13c6b2).(gfp, pcm, pcm+1, nsamples, mp3buf, mp3buf_size, pcm_double_typecxx . . $ pcm_double_type., 2, 32767.0); |
| 1966 | } |
| 1967 | |
| 1968 | |
| 1969 | int |
| 1970 | lame_encode_buffer_intcxx . . $ lame_encode_buffer_int(652b69fb18b6274d).(lame_global_flagscxx . . $ lame_global_flags# * gfp, |
| 1971 | const int pcm_l[], const int pcm_r[], const int nsamples, |
| 1972 | unsigned char *mp3buf, const int mp3buf_size) |
| 1973 | { |
| 1974 | /* input is assumed to be normalized to +/- MAX_INT for full scale */ |
| 1975 | FLOATcxx . . $ FLOAT# const norm = (1.0 / (1L << (8 * sizeof(int) - 16))); |
| 1976 | return lame_encode_buffer_templatecxx . . $ lame_encode_buffer_template(5723ca0f9f13c6b2).(gfp, pcm_l, pcm_r, nsamples, mp3buf, mp3buf_size, pcm_int_typecxx . . $ pcm_int_type., 1, norm); |
| 1977 | } |
| 1978 | |
| 1979 | |
| 1980 | int |
| 1981 | lame_encode_buffer_long2cxx . . $ lame_encode_buffer_long2(36d95240c7a8cfa0).(lame_global_flagscxx . . $ lame_global_flags# * gfp, |
| 1982 | const long pcm_l[], const long pcm_r[], const int nsamples, |
| 1983 | unsigned char *mp3buf, const int mp3buf_size) |
| 1984 | { |
| 1985 | /* input is assumed to be normalized to +/- MAX_LONG for full scale */ |
| 1986 | FLOATcxx . . $ FLOAT# const norm = (1.0 / (1L << (8 * sizeof(long) - 16))); |
| 1987 | return lame_encode_buffer_templatecxx . . $ lame_encode_buffer_template(5723ca0f9f13c6b2).(gfp, pcm_l, pcm_r, nsamples, mp3buf, mp3buf_size, pcm_long_typecxx . . $ pcm_long_type., 1, norm); |
| 1988 | } |
| 1989 | |
| 1990 | |
| 1991 | int |
| 1992 | lame_encode_buffer_longcxx . . $ lame_encode_buffer_long(36d95240c7a8cfa0).(lame_global_flagscxx . . $ lame_global_flags# * gfp, |
| 1993 | const long pcm_l[], const long pcm_r[], const int nsamples, |
| 1994 | unsigned char *mp3buf, const int mp3buf_size) |
| 1995 | { |
| 1996 | /* input is assumed to be normalized to +/- 32768 for full scale */ |
| 1997 | return lame_encode_buffer_templatecxx . . $ lame_encode_buffer_template(5723ca0f9f13c6b2).(gfp, pcm_l, pcm_r, nsamples, mp3buf, mp3buf_size, pcm_long_typecxx . . $ pcm_long_type., 1, 1.0); |
| 1998 | } |
| 1999 | |
| 2000 | |
| 2001 | |
| 2002 | int |
| 2003 | lame_encode_buffer_interleavedcxx . . $ lame_encode_buffer_interleaved(d2f4e6d1c36e453c).(lame_global_flagscxx . . $ lame_global_flags# * gfp, |
| 2004 | short int pcm[], int nsamples, |
| 2005 | unsigned char *mp3buf, int mp3buf_size) |
| 2006 | { |
| 2007 | /* input is assumed to be normalized to +/- MAX_SHORT for full scale */ |
| 2008 | return lame_encode_buffer_templatecxx . . $ lame_encode_buffer_template(5723ca0f9f13c6b2).(gfp, pcm, pcm+1, nsamples, mp3buf, mp3buf_size, pcm_short_typecxx . . $ pcm_short_type., 2, 1.0); |
| 2009 | } |
| 2010 | |
| 2011 | |
| 2012 | int |
| 2013 | lame_encode_buffer_interleaved_intcxx . . $ lame_encode_buffer_interleaved_int(70b451e6fac34381).(lame_tcxx . . $ lame_t# gfp, |
| 2014 | const int pcm[], const int nsamples, |
| 2015 | unsigned char *mp3buf, const int mp3buf_size) |
| 2016 | { |
| 2017 | /* input is assumed to be normalized to +/- MAX(int) for full scale */ |
| 2018 | FLOATcxx . . $ FLOAT# const norm = (1.0 / (1L << (8 * sizeof(int)-16))); |
| 2019 | return lame_encode_buffer_templatecxx . . $ lame_encode_buffer_template(5723ca0f9f13c6b2).(gfp, pcm, pcm + 1, nsamples, mp3buf, mp3buf_size, pcm_int_typecxx . . $ pcm_int_type., 2, norm); |
| 2020 | } |
| 2021 | |
| 2022 | |
| 2023 | |
| 2024 | |
| 2025 | /***************************************************************** |
| 2026 | Flush mp3 buffer, pad with ancillary data so last frame is complete. |
| 2027 | Reset reservoir size to 0 |
| 2028 | but keep all PCM samples and MDCT data in memory |
| 2029 | This option is used to break a large file into several mp3 files |
| 2030 | that when concatenated together will decode with no gaps |
| 2031 | Because we set the reservoir=0, they will also decode seperately |
| 2032 | with no errors. |
| 2033 | *********************************************************************/ |
| 2034 | int |
| 2035 | lame_encode_flush_nogapcxx . . $ lame_encode_flush_nogap(98c3573b9bf9324f).(lame_global_flagscxx . . $ lame_global_flags# * gfp, unsigned char *mp3buffer, int mp3buffer_size) |
| 2036 | { |
| 2037 | int rc = -3; |
| 2038 | if (is_lame_global_flags_validcxx . . $ is_lame_global_flags_valid(a5abb0ff158568ac).(gfp)) { |
| 2039 | lame_internal_flagscxx . . $ lame_internal_flags# *const gfc = gfp->internal_flagscxx . . $ lame_global_struct#internal_flags.; |
| 2040 | if (is_lame_internal_flags_validcxx . . $ is_lame_internal_flags_valid(b815612886108da).(gfc)) { |
| 2041 | flush_bitstreamcxx . . $ flush_bitstream(4f558d83b2842a93).(gfc); |
| 2042 | /* if user specifed buffer size = 0, dont check size */ |
| 2043 | if (mp3buffer_size == 0) |
| 2044 | mp3buffer_size = INT_MAXcxx . . $ `<external>/67164224788392828/limits.h:120:9`!; |
| 2045 | rc = copy_buffercxx . . $ copy_buffer(f6fd3c9cde6b7d1d).(gfc, mp3buffer, mp3buffer_size, 1); |
| 2046 | save_gain_valuescxx . . $ save_gain_values(4f558d83b2842a93).(gfc); |
| 2047 | } |
| 2048 | } |
| 2049 | return rc; |
| 2050 | } |
| 2051 | |
| 2052 | |
| 2053 | /* called by lame_init_params. You can also call this after flush_nogap |
| 2054 | if you want to write new id3v2 and Xing VBR tags into the bitstream */ |
| 2055 | int |
| 2056 | lame_init_bitstreamcxx . . $ lame_init_bitstream(12e50c934c2e73e2).(lame_global_flagscxx . . $ lame_global_flags# * gfp) |
| 2057 | { |
| 2058 | if (is_lame_global_flags_validcxx . . $ is_lame_global_flags_valid(a5abb0ff158568ac).(gfp)) { |
| 2059 | lame_internal_flagscxx . . $ lame_internal_flags# *const gfc = gfp->internal_flagscxx . . $ lame_global_struct#internal_flags.; |
| 2060 | if (gfc != 0) { |
| 2061 | gfc->ov_enccxx . . $ lame_internal_flags#ov_enc..frame_numbercxx . . $ $anonymous_type_fa6ce02aa65ebf3c_9#frame_number. = 0; |
| 2062 | |
| 2063 | if (gfp->write_id3tag_automaticcxx . . $ lame_global_struct#write_id3tag_automatic.) { |
| 2064 | (void) id3tag_write_v2cxx . . $ id3tag_write_v2(12e50c934c2e73e2).(gfp); |
| 2065 | } |
| 2066 | /* initialize histogram data optionally used by frontend */ |
| 2067 | memsetcxx . . $ memset(d1de1e4fb215f1c6).(gfc->ov_enccxx . . $ lame_internal_flags#ov_enc..bitrate_channelmode_histcxx . . $ $anonymous_type_fa6ce02aa65ebf3c_9#bitrate_channelmode_hist., 0, |
| 2068 | sizeof(gfc->ov_enccxx . . $ lame_internal_flags#ov_enc..bitrate_channelmode_histcxx . . $ $anonymous_type_fa6ce02aa65ebf3c_9#bitrate_channelmode_hist.)); |
| 2069 | memsetcxx . . $ memset(d1de1e4fb215f1c6).(gfc->ov_enccxx . . $ lame_internal_flags#ov_enc..bitrate_blocktype_histcxx . . $ $anonymous_type_fa6ce02aa65ebf3c_9#bitrate_blocktype_hist., 0, |
| 2070 | sizeof(gfc->ov_enccxx . . $ lame_internal_flags#ov_enc..bitrate_blocktype_histcxx . . $ $anonymous_type_fa6ce02aa65ebf3c_9#bitrate_blocktype_hist.)); |
| 2071 | |
| 2072 | gfc->ov_rpgcxx . . $ lame_internal_flags#ov_rpg..PeakSamplecxx . . $ $anonymous_type_fa6ce02aa65ebf3c_12#PeakSample. = 0.0; |
| 2073 | |
| 2074 | /* Write initial VBR Header to bitstream and init VBR data */ |
| 2075 | if (gfc->cfgcxx . . $ lame_internal_flags#cfg..write_lame_tagcxx . . $ $anonymous_type_fa6ce02aa65ebf3c_13#write_lame_tag.) |
| 2076 | (void) InitVbrTagcxx . . $ InitVbrTag(12e50c934c2e73e2).(gfp); |
| 2077 | |
| 2078 | |
| 2079 | return 0; |
| 2080 | } |
| 2081 | } |
| 2082 | return -3; |
| 2083 | } |
| 2084 | |
| 2085 | |
| 2086 | /*****************************************************************/ |
| 2087 | /* flush internal PCM sample buffers, then mp3 buffers */ |
| 2088 | /* then write id3 v1 tags into bitstream. */ |
| 2089 | /*****************************************************************/ |
| 2090 | |
| 2091 | int |
| 2092 | lame_encode_flushcxx . . $ lame_encode_flush(98c3573b9bf9324f).(lame_global_flagscxx . . $ lame_global_flags# * gfp, unsigned char *mp3buffer, int mp3buffer_size) |
| 2093 | { |
| 2094 | lame_internal_flagscxx . . $ lame_internal_flags# *gfc; |
| 2095 | SessionConfig_tcxx . . $ SessionConfig_t# const *cfg; |
| 2096 | EncStateVar_tcxx . . $ EncStateVar_t# *esv; |
| 2097 | short int buffer[2][1152]; |
| 2098 | int imp3 = 0, mp3count, mp3buffer_size_remaining; |
| 2099 | |
| 2100 | /* we always add POSTDELAY=288 padding to make sure granule with real |
| 2101 | * data can be complety decoded (because of 50% overlap with next granule */ |
| 2102 | int end_padding; |
| 2103 | int frames_left; |
| 2104 | int samples_to_encode; |
| 2105 | int pcm_samples_per_frame; |
| 2106 | int mf_needed; |
| 2107 | int is_resampling_necessary; |
| 2108 | double resample_ratio = 1; |
| 2109 | |
| 2110 | if (!is_lame_global_flags_validcxx . . $ is_lame_global_flags_valid(a5abb0ff158568ac).(gfp)) { |
| 2111 | return -3; |
| 2112 | } |
| 2113 | gfc = gfp->internal_flagscxx . . $ lame_global_struct#internal_flags.; |
| 2114 | if (!is_lame_internal_flags_validcxx . . $ is_lame_internal_flags_valid(b815612886108da).(gfc)) { |
| 2115 | return -3; |
| 2116 | } |
| 2117 | cfg = &gfc->cfgcxx . . $ lame_internal_flags#cfg.; |
| 2118 | esv = &gfc->sv_enccxx . . $ lame_internal_flags#sv_enc.; |
| 2119 | |
| 2120 | /* Was flush already called? */ |
| 2121 | if (esv->mf_samples_to_encodecxx . . $ $anonymous_type_fa6ce02aa65ebf3c_7#mf_samples_to_encode. < 1) { |
| 2122 | return 0; |
| 2123 | } |
| 2124 | pcm_samples_per_frame = 576 * cfg->mode_grcxx . . $ $anonymous_type_fa6ce02aa65ebf3c_13#mode_gr.; |
| 2125 | mf_needed = calcNeededcxx . . $ calcNeeded(3353a2dd70c7b2e6).(cfg); |
| 2126 | |
| 2127 | samples_to_encode = esv->mf_samples_to_encodecxx . . $ $anonymous_type_fa6ce02aa65ebf3c_7#mf_samples_to_encode. - POSTDELAYcxx . . $ `external/lame/encoder.h:72:9`!; |
| 2128 | |
| 2129 | memsetcxx . . $ memset(d1de1e4fb215f1c6).(buffer, 0, sizeof(buffer)); |
| 2130 | mp3count = 0; |
| 2131 | |
| 2132 | is_resampling_necessary = isResamplingNecessarycxx . . $ isResamplingNecessary(3353a2dd70c7b2e6).(cfg); |
| 2133 | if (is_resampling_necessary) { |
| 2134 | resample_ratio = (double)cfg->samplerate_incxx . . $ $anonymous_type_fa6ce02aa65ebf3c_13#samplerate_in. / (double)cfg->samplerate_outcxx . . $ $anonymous_type_fa6ce02aa65ebf3c_13#samplerate_out.; |
| 2135 | /* delay due to resampling; needs to be fixed, if resampling code gets changed */ |
| 2136 | samples_to_encode += 16. / resample_ratio; |
| 2137 | } |
| 2138 | end_padding = pcm_samples_per_frame - (samples_to_encode % pcm_samples_per_frame); |
| 2139 | if (end_padding < 576) |
| 2140 | end_padding += pcm_samples_per_frame; |
| 2141 | gfc->ov_enccxx . . $ lame_internal_flags#ov_enc..encoder_paddingcxx . . $ $anonymous_type_fa6ce02aa65ebf3c_9#encoder_padding. = end_padding; |
| 2142 | |
| 2143 | frames_left = (samples_to_encode + end_padding) / pcm_samples_per_frame; |
| 2144 | while (frames_left > 0 && imp3 >= 0) { |
| 2145 | int const frame_num = gfc->ov_enccxx . . $ lame_internal_flags#ov_enc..frame_numbercxx . . $ $anonymous_type_fa6ce02aa65ebf3c_9#frame_number.; |
| 2146 | int bunch = mf_needed - esv->mf_sizecxx . . $ $anonymous_type_fa6ce02aa65ebf3c_7#mf_size.; |
| 2147 | |
| 2148 | bunch *= resample_ratio; |
| 2149 | if (bunch > 1152) bunch = 1152; |
| 2150 | if (bunch < 1) bunch = 1; |
| 2151 | |
| 2152 | mp3buffer_size_remaining = mp3buffer_size - mp3count; |
| 2153 | |
| 2154 | /* if user specifed buffer size = 0, dont check size */ |
| 2155 | if (mp3buffer_size == 0) |
| 2156 | mp3buffer_size_remaining = 0; |
| 2157 | |
| 2158 | /* send in a frame of 0 padding until all internal sample buffers |
| 2159 | * are flushed |
| 2160 | */ |
| 2161 | imp3 = lame_encode_buffercxx . . $ lame_encode_buffer(7ed5c536065fe00e).(gfp, buffer[0], buffer[1], bunch, |
| 2162 | mp3buffer, mp3buffer_size_remaining); |
| 2163 | |
| 2164 | mp3buffer += imp3; |
| 2165 | mp3count += imp3; |
| 2166 | { /* even a single pcm sample can produce several frames! |
| 2167 | * for example: 1 Hz input file resampled to 8 kHz mpeg2.5 |
| 2168 | */ |
| 2169 | int const new_frames = gfc->ov_enccxx . . $ lame_internal_flags#ov_enc..frame_numbercxx . . $ $anonymous_type_fa6ce02aa65ebf3c_9#frame_number. - frame_num; |
| 2170 | if (new_frames > 0) |
| 2171 | frames_left -= new_frames; |
| 2172 | } |
| 2173 | } |
| 2174 | /* Set esv->mf_samples_to_encode to 0, so we may detect |
| 2175 | * and break loops calling it more than once in a row. |
| 2176 | */ |
| 2177 | esv->mf_samples_to_encodecxx . . $ $anonymous_type_fa6ce02aa65ebf3c_7#mf_samples_to_encode. = 0; |
| 2178 | |
| 2179 | if (imp3 < 0) { |
| 2180 | /* some type of fatal error */ |
| 2181 | return imp3; |
| 2182 | } |
| 2183 | |
| 2184 | mp3buffer_size_remaining = mp3buffer_size - mp3count; |
| 2185 | /* if user specifed buffer size = 0, dont check size */ |
| 2186 | if (mp3buffer_size == 0) |
| 2187 | mp3buffer_size_remaining = INT_MAXcxx . . $ `<external>/67164224788392828/limits.h:120:9`!; |
| 2188 | |
| 2189 | /* mp3 related stuff. bit buffer might still contain some mp3 data */ |
| 2190 | flush_bitstreamcxx . . $ flush_bitstream(4f558d83b2842a93).(gfc); |
| 2191 | imp3 = copy_buffercxx . . $ copy_buffer(f6fd3c9cde6b7d1d).(gfc, mp3buffer, mp3buffer_size_remaining, 1); |
| 2192 | save_gain_valuescxx . . $ save_gain_values(4f558d83b2842a93).(gfc); |
| 2193 | if (imp3 < 0) { |
| 2194 | /* some type of fatal error */ |
| 2195 | return imp3; |
| 2196 | } |
| 2197 | mp3buffer += imp3; |
| 2198 | mp3count += imp3; |
| 2199 | mp3buffer_size_remaining = mp3buffer_size - mp3count; |
| 2200 | /* if user specifed buffer size = 0, dont check size */ |
| 2201 | if (mp3buffer_size == 0) |
| 2202 | mp3buffer_size_remaining = INT_MAXcxx . . $ `<external>/67164224788392828/limits.h:120:9`!; |
| 2203 | |
| 2204 | if (gfp->write_id3tag_automaticcxx . . $ lame_global_struct#write_id3tag_automatic.) { |
| 2205 | /* write a id3 tag to the bitstream */ |
| 2206 | (void) id3tag_write_v1cxx . . $ id3tag_write_v1(12e50c934c2e73e2).(gfp); |
| 2207 | |
| 2208 | imp3 = copy_buffercxx . . $ copy_buffer(f6fd3c9cde6b7d1d).(gfc, mp3buffer, mp3buffer_size_remaining, 0); |
| 2209 | |
| 2210 | if (imp3 < 0) { |
| 2211 | return imp3; |
| 2212 | } |
| 2213 | mp3count += imp3; |
| 2214 | } |
| 2215 | #if 0 |
| 2216 | { |
| 2217 | int const ed = gfc->ov_enc.encoder_delay; |
| 2218 | int const ep = gfc->ov_enc.encoder_padding; |
| 2219 | int const ns = (gfc->ov_enc.frame_number * pcm_samples_per_frame) - (ed + ep); |
| 2220 | double duration = ns; |
| 2221 | duration /= cfg->samplerate_out; |
| 2222 | MSGF(gfc, "frames=%d\n", gfc->ov_enc.frame_number); |
| 2223 | MSGF(gfc, "pcm_samples_per_frame=%d\n", pcm_samples_per_frame); |
| 2224 | MSGF(gfc, "encoder delay=%d\n", ed); |
| 2225 | MSGF(gfc, "encoder padding=%d\n", ep); |
| 2226 | MSGF(gfc, "sample count=%d (%g)\n", ns, cfg->samplerate_in * duration); |
| 2227 | MSGF(gfc, "duration=%g sec\n", duration); |
| 2228 | } |
| 2229 | #endif |
| 2230 | return mp3count; |
| 2231 | } |
| 2232 | |
| 2233 | /*********************************************************************** |
| 2234 | * |
| 2235 | * lame_close () |
| 2236 | * |
| 2237 | * frees internal buffers |
| 2238 | * |
| 2239 | ***********************************************************************/ |
| 2240 | |
| 2241 | int |
| 2242 | lame_closecxx . . $ lame_close(12e50c934c2e73e2).(lame_global_flagscxx . . $ lame_global_flags# * gfp) |
| 2243 | { |
| 2244 | int ret = 0; |
| 2245 | if (gfp && gfp->class_idcxx . . $ lame_global_struct#class_id. == LAME_IDcxx . . $ `external/lame/util.h:483:12`!) { |
| 2246 | lame_internal_flagscxx . . $ lame_internal_flags# *const gfc = gfp->internal_flagscxx . . $ lame_global_struct#internal_flags.; |
| 2247 | gfp->class_idcxx . . $ lame_global_struct#class_id. = 0; |
| 2248 | if (NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`! == gfc || gfc->class_idcxx . . $ lame_internal_flags#class_id. != LAME_IDcxx . . $ `external/lame/util.h:483:12`!) { |
| 2249 | ret = -3; |
| 2250 | } |
| 2251 | if (NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`! != gfc) { |
| 2252 | gfc->lame_init_params_successfulcxx . . $ lame_internal_flags#lame_init_params_successful. = 0; |
| 2253 | gfc->class_idcxx . . $ lame_internal_flags#class_id. = 0; |
| 2254 | /* this routine will free all malloc'd data in gfc, and then free gfc: */ |
| 2255 | freegfccxx . . $ freegfc(4f558d83b2842a93).(gfc); |
| 2256 | gfp->internal_flagscxx . . $ lame_global_struct#internal_flags. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 2257 | } |
| 2258 | if (gfp->lame_allocated_gfpcxx . . $ lame_global_struct#lame_allocated_gfp.) { |
| 2259 | gfp->lame_allocated_gfpcxx . . $ lame_global_struct#lame_allocated_gfp. = 0; |
| 2260 | freecxx . . $ free(5d22bdacc48458e8).(gfp); |
| 2261 | } |
| 2262 | } |
| 2263 | return ret; |
| 2264 | } |
| 2265 | |
| 2266 | /*****************************************************************/ |
| 2267 | /* flush internal mp3 buffers, and free internal buffers */ |
| 2268 | /*****************************************************************/ |
| 2269 | #if DEPRECATED_OR_OBSOLETE_CODE_REMOVEDcxx . . $ `external/lame/lame.h:49:9`! |
| 2270 | int CDECLcxx . . $ `external/lame/lame.h:46:9`! |
| 2271 | lame_encode_finishcxx . . $ lame_encode_finish(98c3573b9bf9324f).(lame_global_flagscxx . . $ lame_global_flags# * gfp, unsigned char *mp3buffer, int mp3buffer_size); |
| 2272 | #else |
| 2273 | #endif |
| 2274 | |
| 2275 | int |
| 2276 | lame_encode_finishcxx . . $ lame_encode_finish(98c3573b9bf9324f).(lame_global_flagscxx . . $ lame_global_flags# * gfp, unsigned char *mp3buffer, int mp3buffer_size) |
| 2277 | { |
| 2278 | int const ret = lame_encode_flushcxx . . $ lame_encode_flush(98c3573b9bf9324f).(gfp, mp3buffer, mp3buffer_size); |
| 2279 | |
| 2280 | (void) lame_closecxx . . $ lame_close(12e50c934c2e73e2).(gfp); |
| 2281 | |
| 2282 | return ret; |
| 2283 | } |
| 2284 | |
| 2285 | /*****************************************************************/ |
| 2286 | /* write VBR Xing header, and ID3 version 1 tag, if asked for */ |
| 2287 | /*****************************************************************/ |
| 2288 | void lame_mp3_tags_fidcxx . . $ lame_mp3_tags_fid(d6fd87adb061eeb1).(lame_global_flagscxx . . $ lame_global_flags# * gfp, FILEcxx . . $ FILE# * fpStream); |
| 2289 | |
| 2290 | void |
| 2291 | lame_mp3_tags_fidcxx . . $ lame_mp3_tags_fid(d6fd87adb061eeb1).(lame_global_flagscxx . . $ lame_global_flags# * gfp, FILEcxx . . $ FILE# * fpStream) |
| 2292 | { |
| 2293 | lame_internal_flagscxx . . $ lame_internal_flags# *gfc; |
| 2294 | SessionConfig_tcxx . . $ SessionConfig_t# const *cfg; |
| 2295 | if (!is_lame_global_flags_validcxx . . $ is_lame_global_flags_valid(a5abb0ff158568ac).(gfp)) { |
| 2296 | return; |
| 2297 | } |
| 2298 | gfc = gfp->internal_flagscxx . . $ lame_global_struct#internal_flags.; |
| 2299 | if (!is_lame_internal_flags_validcxx . . $ is_lame_internal_flags_valid(b815612886108da).(gfc)) { |
| 2300 | return; |
| 2301 | } |
| 2302 | cfg = &gfc->cfgcxx . . $ lame_internal_flags#cfg.; |
| 2303 | if (!cfg->write_lame_tagcxx . . $ $anonymous_type_fa6ce02aa65ebf3c_13#write_lame_tag.) { |
| 2304 | return; |
| 2305 | } |
| 2306 | /* Write Xing header again */ |
| 2307 | if (fpStream && !fseekcxx . . $ fseek(543fae30d249f6b1).(fpStream, 0, SEEK_SETcxx . . $ `<external>/232824719582829767/stdio.h:110:9`!)) { |
| 2308 | int rc = PutVbrTagcxx . . $ PutVbrTag(fb438155f9919c1f).(gfp, fpStream); |
| 2309 | switch (rc) { |
| 2310 | default: |
| 2311 | /* OK */ |
| 2312 | break; |
| 2313 | |
| 2314 | case -1: |
| 2315 | ERRORFcxx . . $ `external/lame/util.h:606:9`!(gfc, "Error: could not update LAME tag.\n"); |
| 2316 | break; |
| 2317 | |
| 2318 | case -2: |
| 2319 | ERRORFcxx . . $ `external/lame/util.h:606:9`!(gfc, "Error: could not update LAME tag, file not seekable.\n"); |
| 2320 | break; |
| 2321 | |
| 2322 | case -3: |
| 2323 | ERRORFcxx . . $ `external/lame/util.h:606:9`!(gfc, "Error: could not update LAME tag, file not readable.\n"); |
| 2324 | break; |
| 2325 | } |
| 2326 | } |
| 2327 | } |
| 2328 | |
| 2329 | |
| 2330 | static int |
| 2331 | lame_init_internal_flagscxx . . $ lame_init_internal_flags(42b75628a052f811).(lame_internal_flagscxx . . $ lame_internal_flags#* gfc) |
| 2332 | { |
| 2333 | if (NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`! == gfc) |
| 2334 | return -1; |
| 2335 | |
| 2336 | gfc->cfgcxx . . $ lame_internal_flags#cfg..vbr_min_bitrate_indexcxx . . $ $anonymous_type_fa6ce02aa65ebf3c_13#vbr_min_bitrate_index. = 1; /* not 0 ????? */ |
| 2337 | gfc->cfgcxx . . $ lame_internal_flags#cfg..vbr_max_bitrate_indexcxx . . $ $anonymous_type_fa6ce02aa65ebf3c_13#vbr_max_bitrate_index. = 13; /* not 14 ????? */ |
| 2338 | gfc->cfgcxx . . $ lame_internal_flags#cfg..decode_on_the_flycxx . . $ $anonymous_type_fa6ce02aa65ebf3c_13#decode_on_the_fly. = 0; |
| 2339 | gfc->cfgcxx . . $ lame_internal_flags#cfg..findReplayGaincxx . . $ $anonymous_type_fa6ce02aa65ebf3c_13#findReplayGain. = 0; |
| 2340 | gfc->cfgcxx . . $ lame_internal_flags#cfg..findPeakSamplecxx . . $ $anonymous_type_fa6ce02aa65ebf3c_13#findPeakSample. = 0; |
| 2341 | |
| 2342 | gfc->sv_qntcxx . . $ lame_internal_flags#sv_qnt..OldValuecxx . . $ $anonymous_type_fa6ce02aa65ebf3c_10#OldValue.[0] = 180; |
| 2343 | gfc->sv_qntcxx . . $ lame_internal_flags#sv_qnt..OldValuecxx . . $ $anonymous_type_fa6ce02aa65ebf3c_10#OldValue.[1] = 180; |
| 2344 | gfc->sv_qntcxx . . $ lame_internal_flags#sv_qnt..CurrentStepcxx . . $ $anonymous_type_fa6ce02aa65ebf3c_10#CurrentStep.[0] = 4; |
| 2345 | gfc->sv_qntcxx . . $ lame_internal_flags#sv_qnt..CurrentStepcxx . . $ $anonymous_type_fa6ce02aa65ebf3c_10#CurrentStep.[1] = 4; |
| 2346 | gfc->sv_qntcxx . . $ lame_internal_flags#sv_qnt..masking_lowercxx . . $ $anonymous_type_fa6ce02aa65ebf3c_10#masking_lower. = 1; |
| 2347 | |
| 2348 | /* The reason for |
| 2349 | * int mf_samples_to_encode = ENCDELAY + POSTDELAY; |
| 2350 | * ENCDELAY = internal encoder delay. And then we have to add POSTDELAY=288 |
| 2351 | * because of the 50% MDCT overlap. A 576 MDCT granule decodes to |
| 2352 | * 1152 samples. To synthesize the 576 samples centered under this granule |
| 2353 | * we need the previous granule for the first 288 samples (no problem), and |
| 2354 | * the next granule for the next 288 samples (not possible if this is last |
| 2355 | * granule). So we need to pad with 288 samples to make sure we can |
| 2356 | * encode the 576 samples we are interested in. |
| 2357 | */ |
| 2358 | gfc->sv_enccxx . . $ lame_internal_flags#sv_enc..mf_samples_to_encodecxx . . $ $anonymous_type_fa6ce02aa65ebf3c_7#mf_samples_to_encode. = ENCDELAYcxx . . $ `external/lame/encoder.h:57:9`! + POSTDELAYcxx . . $ `external/lame/encoder.h:72:9`!; |
| 2359 | gfc->sv_enccxx . . $ lame_internal_flags#sv_enc..mf_sizecxx . . $ $anonymous_type_fa6ce02aa65ebf3c_7#mf_size. = ENCDELAYcxx . . $ `external/lame/encoder.h:57:9`! - MDCTDELAYcxx . . $ `external/lame/encoder.h:82:9`!; /* we pad input with this many 0's */ |
| 2360 | gfc->ov_enccxx . . $ lame_internal_flags#ov_enc..encoder_paddingcxx . . $ $anonymous_type_fa6ce02aa65ebf3c_9#encoder_padding. = 0; |
| 2361 | gfc->ov_enccxx . . $ lame_internal_flags#ov_enc..encoder_delaycxx . . $ $anonymous_type_fa6ce02aa65ebf3c_9#encoder_delay. = ENCDELAYcxx . . $ `external/lame/encoder.h:57:9`!; |
| 2362 | |
| 2363 | gfc->ov_rpgcxx . . $ lame_internal_flags#ov_rpg..RadioGaincxx . . $ $anonymous_type_fa6ce02aa65ebf3c_12#RadioGain. = 0; |
| 2364 | gfc->ov_rpgcxx . . $ lame_internal_flags#ov_rpg..noclipGainChangecxx . . $ $anonymous_type_fa6ce02aa65ebf3c_12#noclipGainChange. = 0; |
| 2365 | gfc->ov_rpgcxx . . $ lame_internal_flags#ov_rpg..noclipScalecxx . . $ $anonymous_type_fa6ce02aa65ebf3c_12#noclipScale. = -1.0; |
| 2366 | |
| 2367 | gfc->ATHcxx . . $ lame_internal_flags#ATH. = lame_calloccxx . . $ `external/lame/machine.h:161:9`!(ATH_t, 1); |
| 2368 | if (NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`! == gfc->ATHcxx . . $ lame_internal_flags#ATH.) |
| 2369 | return -2; /* maybe error codes should be enumerated in lame.h ?? */ |
| 2370 | |
| 2371 | gfc->sv_rpgcxx . . $ lame_internal_flags#sv_rpg..rgdatacxx . . $ $anonymous_type_fa6ce02aa65ebf3c_11#rgdata. = lame_calloccxx . . $ `external/lame/machine.h:161:9`!(replaygain_t, 1); |
| 2372 | if (NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`! == gfc->sv_rpgcxx . . $ lame_internal_flags#sv_rpg..rgdatacxx . . $ $anonymous_type_fa6ce02aa65ebf3c_11#rgdata.) { |
| 2373 | return -2; |
| 2374 | } |
| 2375 | return 0; |
| 2376 | } |
| 2377 | |
| 2378 | /* initialize mp3 encoder */ |
| 2379 | #if DEPRECATED_OR_OBSOLETE_CODE_REMOVEDcxx . . $ `external/lame/lame.h:49:9`! |
| 2380 | static |
| 2381 | #else |
| 2382 | #endif |
| 2383 | int |
| 2384 | lame_init_oldcxx . . $ lame_init_old(12e50c934c2e73e2).(lame_global_flagscxx . . $ lame_global_flags# * gfp) |
| 2385 | { |
| 2386 | disable_FPEcxx . . $ disable_FPE(49f6e7a06ebc5aa8).(); /* disable floating point exceptions */ |
| 2387 | |
| 2388 | memsetcxx . . $ memset(d1de1e4fb215f1c6).(gfp, 0, sizeof(lame_global_flagscxx . . $ lame_global_flags#)); |
| 2389 | |
| 2390 | gfp->class_idcxx . . $ lame_global_struct#class_id. = LAME_IDcxx . . $ `external/lame/util.h:483:12`!; |
| 2391 | |
| 2392 | /* Global flags. set defaults here for non-zero values */ |
| 2393 | /* see lame.h for description */ |
| 2394 | /* set integer values to -1 to mean that LAME will compute the |
| 2395 | * best value, UNLESS the calling program as set it |
| 2396 | * (and the value is no longer -1) |
| 2397 | */ |
| 2398 | gfp->strict_ISOcxx . . $ lame_global_struct#strict_ISO. = MDB_MAXIMUMcxx . . $ MDB_MAXIMUM.; |
| 2399 | |
| 2400 | gfp->modecxx . . $ lame_global_struct#mode. = NOT_SETcxx . . $ NOT_SET.; |
| 2401 | gfp->originalcxx . . $ lame_global_struct#original. = 1; |
| 2402 | gfp->samplerate_incxx . . $ lame_global_struct#samplerate_in. = 44100; |
| 2403 | gfp->num_channelscxx . . $ lame_global_struct#num_channels. = 2; |
| 2404 | gfp->num_samplescxx . . $ lame_global_struct#num_samples. = MAX_U_32_NUMcxx . . $ `external/lame/util.h:49:18`!; |
| 2405 | |
| 2406 | gfp->write_lame_tagcxx . . $ lame_global_struct#write_lame_tag. = 1; |
| 2407 | gfp->qualitycxx . . $ lame_global_struct#quality. = -1; |
| 2408 | gfp->short_blockscxx . . $ lame_global_struct#short_blocks. = short_block_not_setcxx . . $ short_block_not_set.; |
| 2409 | gfp->subblock_gaincxx . . $ lame_global_struct#subblock_gain. = -1; |
| 2410 | |
| 2411 | gfp->lowpassfreqcxx . . $ lame_global_struct#lowpassfreq. = 0; |
| 2412 | gfp->highpassfreqcxx . . $ lame_global_struct#highpassfreq. = 0; |
| 2413 | gfp->lowpasswidthcxx . . $ lame_global_struct#lowpasswidth. = -1; |
| 2414 | gfp->highpasswidthcxx . . $ lame_global_struct#highpasswidth. = -1; |
| 2415 | |
| 2416 | gfp->VBRcxx . . $ lame_global_struct#VBR. = vbr_offcxx . . $ vbr_off.; |
| 2417 | gfp->VBR_qcxx . . $ lame_global_struct#VBR_q. = 4; |
| 2418 | gfp->VBR_mean_bitrate_kbpscxx . . $ lame_global_struct#VBR_mean_bitrate_kbps. = 128; |
| 2419 | gfp->VBR_min_bitrate_kbpscxx . . $ lame_global_struct#VBR_min_bitrate_kbps. = 0; |
| 2420 | gfp->VBR_max_bitrate_kbpscxx . . $ lame_global_struct#VBR_max_bitrate_kbps. = 0; |
| 2421 | gfp->VBR_hard_mincxx . . $ lame_global_struct#VBR_hard_min. = 0; |
| 2422 | |
| 2423 | gfp->quant_compcxx . . $ lame_global_struct#quant_comp. = -1; |
| 2424 | gfp->quant_comp_shortcxx . . $ lame_global_struct#quant_comp_short. = -1; |
| 2425 | |
| 2426 | gfp->msfixcxx . . $ lame_global_struct#msfix. = -1; |
| 2427 | |
| 2428 | gfp->attackthrecxx . . $ lame_global_struct#attackthre. = -1; |
| 2429 | gfp->attackthre_scxx . . $ lame_global_struct#attackthre_s. = -1; |
| 2430 | |
| 2431 | gfp->scalecxx . . $ lame_global_struct#scale. = 1; |
| 2432 | gfp->scale_leftcxx . . $ lame_global_struct#scale_left. = 1; |
| 2433 | gfp->scale_rightcxx . . $ lame_global_struct#scale_right. = 1; |
| 2434 | |
| 2435 | gfp->ATHcurvecxx . . $ lame_global_struct#ATHcurve. = -1; |
| 2436 | gfp->ATHtypecxx . . $ lame_global_struct#ATHtype. = -1; /* default = -1 = set in lame_init_params */ |
| 2437 | /* 2 = equal loudness curve */ |
| 2438 | gfp->athaa_sensitivitycxx . . $ lame_global_struct#athaa_sensitivity. = 0.0; /* no offset */ |
| 2439 | gfp->athaa_typecxx . . $ lame_global_struct#athaa_type. = -1; |
| 2440 | gfp->useTemporalcxx . . $ lame_global_struct#useTemporal. = -1; |
| 2441 | gfp->interChRatiocxx . . $ lame_global_struct#interChRatio. = -1; |
| 2442 | |
| 2443 | gfp->findReplayGaincxx . . $ lame_global_struct#findReplayGain. = 0; |
| 2444 | gfp->decode_on_the_flycxx . . $ lame_global_struct#decode_on_the_fly. = 0; |
| 2445 | |
| 2446 | gfp->asm_optimizationscxx . . $ lame_global_struct#asm_optimizations..mmxcxx . . $ lame_global_struct#$anonymous_type_1#mmx. = 1; |
| 2447 | gfp->asm_optimizationscxx . . $ lame_global_struct#asm_optimizations..amd3dnowcxx . . $ lame_global_struct#$anonymous_type_1#amd3dnow. = 1; |
| 2448 | gfp->asm_optimizationscxx . . $ lame_global_struct#asm_optimizations..ssecxx . . $ lame_global_struct#$anonymous_type_1#sse. = 1; |
| 2449 | |
| 2450 | gfp->presetcxx . . $ lame_global_struct#preset. = 0; |
| 2451 | |
| 2452 | gfp->write_id3tag_automaticcxx . . $ lame_global_struct#write_id3tag_automatic. = 1; |
| 2453 | |
| 2454 | gfp->reportcxx . . $ lame_global_struct#report..debugfcxx . . $ lame_global_struct#$anonymous_type_0#debugf. = &lame_report_defcxx . . $ lame_report_def(ac175dd46a4e4d7f).; |
| 2455 | gfp->reportcxx . . $ lame_global_struct#report..errorfcxx . . $ lame_global_struct#$anonymous_type_0#errorf. = &lame_report_defcxx . . $ lame_report_def(ac175dd46a4e4d7f).; |
| 2456 | gfp->reportcxx . . $ lame_global_struct#report..msgfcxx . . $ lame_global_struct#$anonymous_type_0#msgf. = &lame_report_defcxx . . $ lame_report_def(ac175dd46a4e4d7f).; |
| 2457 | |
| 2458 | gfp->internal_flagscxx . . $ lame_global_struct#internal_flags. = lame_calloccxx . . $ `external/lame/machine.h:161:9`!(lame_internal_flags, 1); |
| 2459 | |
| 2460 | if (lame_init_internal_flagscxx . . $ lame_init_internal_flags(42b75628a052f811).(gfp->internal_flagscxx . . $ lame_global_struct#internal_flags.) < 0) { |
| 2461 | freegfccxx . . $ freegfc(4f558d83b2842a93).(gfp->internal_flagscxx . . $ lame_global_struct#internal_flags.); |
| 2462 | gfp->internal_flagscxx . . $ lame_global_struct#internal_flags. = 0; |
| 2463 | return -1; |
| 2464 | } |
| 2465 | return 0; |
| 2466 | } |
| 2467 | |
| 2468 | |
| 2469 | lame_global_flagscxx . . $ lame_global_flags# * |
| 2470 | lame_initcxx . . $ lame_init(ef5cb5c0f4a7b507).(void) |
| 2471 | { |
| 2472 | lame_global_flagscxx . . $ lame_global_flags# *gfp; |
| 2473 | int ret; |
| 2474 | |
| 2475 | init_log_tablecxx . . $ init_log_table(49f6e7a06ebc5aa8).(); |
| 2476 | |
| 2477 | gfp = lame_calloccxx . . $ `external/lame/machine.h:161:9`!(lame_global_flags, 1); |
| 2478 | if (gfp == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) |
| 2479 | return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 2480 | |
| 2481 | ret = lame_init_oldcxx . . $ lame_init_old(12e50c934c2e73e2).(gfp); |
| 2482 | if (ret != 0) { |
| 2483 | freecxx . . $ free(5d22bdacc48458e8).(gfp); |
| 2484 | return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 2485 | } |
| 2486 | |
| 2487 | gfp->lame_allocated_gfpcxx . . $ lame_global_struct#lame_allocated_gfp. = 1; |
| 2488 | return gfp; |
| 2489 | } |
| 2490 | |
| 2491 | |
| 2492 | /*********************************************************************** |
| 2493 | * |
| 2494 | * some simple statistics |
| 2495 | * |
| 2496 | * Robert Hegemann 2000-10-11 |
| 2497 | * |
| 2498 | ***********************************************************************/ |
| 2499 | |
| 2500 | /* histogram of used bitrate indexes: |
| 2501 | * One has to weight them to calculate the average bitrate in kbps |
| 2502 | * |
| 2503 | * bitrate indices: |
| 2504 | * there are 14 possible bitrate indices, 0 has the special meaning |
| 2505 | * "free format" which is not possible to mix with VBR and 15 is forbidden |
| 2506 | * anyway. |
| 2507 | * |
| 2508 | * stereo modes: |
| 2509 | * 0: LR number of left-right encoded frames |
| 2510 | * 1: LR-I number of left-right and intensity encoded frames |
| 2511 | * 2: MS number of mid-side encoded frames |
| 2512 | * 3: MS-I number of mid-side and intensity encoded frames |
| 2513 | * |
| 2514 | * 4: number of encoded frames |
| 2515 | * |
| 2516 | */ |
| 2517 | |
| 2518 | void |
| 2519 | lame_bitrate_kbpscxx . . $ lame_bitrate_kbps(704bf7c9b257a909).(const lame_global_flagscxx . . $ lame_global_flags# * gfp, int bitrate_kbps[14]) |
| 2520 | { |
| 2521 | if (is_lame_global_flags_validcxx . . $ is_lame_global_flags_valid(a5abb0ff158568ac).(gfp)) { |
| 2522 | lame_internal_flagscxx . . $ lame_internal_flags# const *const gfc = gfp->internal_flagscxx . . $ lame_global_struct#internal_flags.; |
| 2523 | if (is_lame_internal_flags_validcxx . . $ is_lame_internal_flags_valid(b815612886108da).(gfc)) { |
| 2524 | SessionConfig_tcxx . . $ SessionConfig_t# const *const cfg = &gfc->cfgcxx . . $ lame_internal_flags#cfg.; |
| 2525 | int i; |
| 2526 | if (cfg->free_formatcxx . . $ $anonymous_type_fa6ce02aa65ebf3c_13#free_format.) { |
| 2527 | for (i = 0; i < 14; i++) |
| 2528 | bitrate_kbps[i] = -1; |
| 2529 | bitrate_kbps[0] = cfg->avg_bitratecxx . . $ $anonymous_type_fa6ce02aa65ebf3c_13#avg_bitrate.; |
| 2530 | } |
| 2531 | else { |
| 2532 | for (i = 0; i < 14; i++) |
| 2533 | bitrate_kbps[i] = bitrate_tablecxx . . $ bitrate_table.[cfg->versioncxx . . $ $anonymous_type_fa6ce02aa65ebf3c_13#version.][i + 1]; |
| 2534 | } |
| 2535 | } |
| 2536 | } |
| 2537 | } |
| 2538 | |
| 2539 | |
| 2540 | void |
| 2541 | lame_bitrate_histcxx . . $ lame_bitrate_hist(704bf7c9b257a909).(const lame_global_flagscxx . . $ lame_global_flags# * gfp, int bitrate_count[14]) |
| 2542 | { |
| 2543 | if (is_lame_global_flags_validcxx . . $ is_lame_global_flags_valid(a5abb0ff158568ac).(gfp)) { |
| 2544 | lame_internal_flagscxx . . $ lame_internal_flags# const *const gfc = gfp->internal_flagscxx . . $ lame_global_struct#internal_flags.; |
| 2545 | if (is_lame_internal_flags_validcxx . . $ is_lame_internal_flags_valid(b815612886108da).(gfc)) { |
| 2546 | SessionConfig_tcxx . . $ SessionConfig_t# const *const cfg = &gfc->cfgcxx . . $ lame_internal_flags#cfg.; |
| 2547 | EncResult_tcxx . . $ EncResult_t# const *const eov = &gfc->ov_enccxx . . $ lame_internal_flags#ov_enc.; |
| 2548 | int i; |
| 2549 | |
| 2550 | if (cfg->free_formatcxx . . $ $anonymous_type_fa6ce02aa65ebf3c_13#free_format.) { |
| 2551 | for (i = 0; i < 14; i++) { |
| 2552 | bitrate_count[i] = 0; |
| 2553 | } |
| 2554 | bitrate_count[0] = eov->bitrate_channelmode_histcxx . . $ $anonymous_type_fa6ce02aa65ebf3c_9#bitrate_channelmode_hist.[0][4]; |
| 2555 | } |
| 2556 | else { |
| 2557 | for (i = 0; i < 14; i++) { |
| 2558 | bitrate_count[i] = eov->bitrate_channelmode_histcxx . . $ $anonymous_type_fa6ce02aa65ebf3c_9#bitrate_channelmode_hist.[i + 1][4]; |
| 2559 | } |
| 2560 | } |
| 2561 | } |
| 2562 | } |
| 2563 | } |
| 2564 | |
| 2565 | |
| 2566 | void |
| 2567 | lame_stereo_mode_histcxx . . $ lame_stereo_mode_hist(704bf7c9b257a909).(const lame_global_flagscxx . . $ lame_global_flags# * gfp, int stmode_count[4]) |
| 2568 | { |
| 2569 | if (is_lame_global_flags_validcxx . . $ is_lame_global_flags_valid(a5abb0ff158568ac).(gfp)) { |
| 2570 | lame_internal_flagscxx . . $ lame_internal_flags# const *const gfc = gfp->internal_flagscxx . . $ lame_global_struct#internal_flags.; |
| 2571 | if (is_lame_internal_flags_validcxx . . $ is_lame_internal_flags_valid(b815612886108da).(gfc)) { |
| 2572 | EncResult_tcxx . . $ EncResult_t# const *const eov = &gfc->ov_enccxx . . $ lame_internal_flags#ov_enc.; |
| 2573 | int i; |
| 2574 | |
| 2575 | for (i = 0; i < 4; i++) { |
| 2576 | stmode_count[i] = eov->bitrate_channelmode_histcxx . . $ $anonymous_type_fa6ce02aa65ebf3c_9#bitrate_channelmode_hist.[15][i]; |
| 2577 | } |
| 2578 | } |
| 2579 | } |
| 2580 | } |
| 2581 | |
| 2582 | |
| 2583 | |
| 2584 | void |
| 2585 | lame_bitrate_stereo_mode_histcxx . . $ lame_bitrate_stereo_mode_hist(20d4999050404de8).(const lame_global_flagscxx . . $ lame_global_flags# * gfp, int bitrate_stmode_count[14][4]) |
| 2586 | { |
| 2587 | if (is_lame_global_flags_validcxx . . $ is_lame_global_flags_valid(a5abb0ff158568ac).(gfp)) { |
| 2588 | lame_internal_flagscxx . . $ lame_internal_flags# const *const gfc = gfp->internal_flagscxx . . $ lame_global_struct#internal_flags.; |
| 2589 | if (is_lame_internal_flags_validcxx . . $ is_lame_internal_flags_valid(b815612886108da).(gfc)) { |
| 2590 | SessionConfig_tcxx . . $ SessionConfig_t# const *const cfg = &gfc->cfgcxx . . $ lame_internal_flags#cfg.; |
| 2591 | EncResult_tcxx . . $ EncResult_t# const *const eov = &gfc->ov_enccxx . . $ lame_internal_flags#ov_enc.; |
| 2592 | int i; |
| 2593 | int j; |
| 2594 | |
| 2595 | if (cfg->free_formatcxx . . $ $anonymous_type_fa6ce02aa65ebf3c_13#free_format.) { |
| 2596 | for (j = 0; j < 14; j++) |
| 2597 | for (i = 0; i < 4; i++) { |
| 2598 | bitrate_stmode_count[j][i] = 0; |
| 2599 | } |
| 2600 | for (i = 0; i < 4; i++) { |
| 2601 | bitrate_stmode_count[0][i] = eov->bitrate_channelmode_histcxx . . $ $anonymous_type_fa6ce02aa65ebf3c_9#bitrate_channelmode_hist.[0][i]; |
| 2602 | } |
| 2603 | } |
| 2604 | else { |
| 2605 | for (j = 0; j < 14; j++) { |
| 2606 | for (i = 0; i < 4; i++) { |
| 2607 | bitrate_stmode_count[j][i] = eov->bitrate_channelmode_histcxx . . $ $anonymous_type_fa6ce02aa65ebf3c_9#bitrate_channelmode_hist.[j + 1][i]; |
| 2608 | } |
| 2609 | } |
| 2610 | } |
| 2611 | } |
| 2612 | } |
| 2613 | } |
| 2614 | |
| 2615 | |
| 2616 | void |
| 2617 | lame_block_type_histcxx . . $ lame_block_type_hist(704bf7c9b257a909).(const lame_global_flagscxx . . $ lame_global_flags# * gfp, int btype_count[6]) |
| 2618 | { |
| 2619 | if (is_lame_global_flags_validcxx . . $ is_lame_global_flags_valid(a5abb0ff158568ac).(gfp)) { |
| 2620 | lame_internal_flagscxx . . $ lame_internal_flags# const *const gfc = gfp->internal_flagscxx . . $ lame_global_struct#internal_flags.; |
| 2621 | if (is_lame_internal_flags_validcxx . . $ is_lame_internal_flags_valid(b815612886108da).(gfc)) { |
| 2622 | EncResult_tcxx . . $ EncResult_t# const *const eov = &gfc->ov_enccxx . . $ lame_internal_flags#ov_enc.; |
| 2623 | int i; |
| 2624 | |
| 2625 | for (i = 0; i < 6; ++i) { |
| 2626 | btype_count[i] = eov->bitrate_blocktype_histcxx . . $ $anonymous_type_fa6ce02aa65ebf3c_9#bitrate_blocktype_hist.[15][i]; |
| 2627 | } |
| 2628 | } |
| 2629 | } |
| 2630 | } |
| 2631 | |
| 2632 | |
| 2633 | |
| 2634 | void |
| 2635 | lame_bitrate_block_type_histcxx . . $ lame_bitrate_block_type_hist(eec6e70246f9fef1).(const lame_global_flagscxx . . $ lame_global_flags# * gfp, int bitrate_btype_count[14][6]) |
| 2636 | { |
| 2637 | if (is_lame_global_flags_validcxx . . $ is_lame_global_flags_valid(a5abb0ff158568ac).(gfp)) { |
| 2638 | lame_internal_flagscxx . . $ lame_internal_flags# const *const gfc = gfp->internal_flagscxx . . $ lame_global_struct#internal_flags.; |
| 2639 | if (is_lame_internal_flags_validcxx . . $ is_lame_internal_flags_valid(b815612886108da).(gfc)) { |
| 2640 | SessionConfig_tcxx . . $ SessionConfig_t# const *const cfg = &gfc->cfgcxx . . $ lame_internal_flags#cfg.; |
| 2641 | EncResult_tcxx . . $ EncResult_t# const *const eov = &gfc->ov_enccxx . . $ lame_internal_flags#ov_enc.; |
| 2642 | int i, j; |
| 2643 | |
| 2644 | if (cfg->free_formatcxx . . $ $anonymous_type_fa6ce02aa65ebf3c_13#free_format.) { |
| 2645 | for (j = 0; j < 14; ++j) { |
| 2646 | for (i = 0; i < 6; ++i) { |
| 2647 | bitrate_btype_count[j][i] = 0; |
| 2648 | } |
| 2649 | } |
| 2650 | for (i = 0; i < 6; ++i) { |
| 2651 | bitrate_btype_count[0][i] = eov->bitrate_blocktype_histcxx . . $ $anonymous_type_fa6ce02aa65ebf3c_9#bitrate_blocktype_hist.[0][i]; |
| 2652 | } |
| 2653 | } |
| 2654 | else { |
| 2655 | for (j = 0; j < 14; ++j) { |
| 2656 | for (i = 0; i < 6; ++i) { |
| 2657 | bitrate_btype_count[j][i] = eov->bitrate_blocktype_histcxx . . $ $anonymous_type_fa6ce02aa65ebf3c_9#bitrate_blocktype_hist.[j + 1][i]; |
| 2658 | } |
| 2659 | } |
| 2660 | } |
| 2661 | } |
| 2662 | } |
| 2663 | } |
| 2664 | |
| 2665 | /* end of lame.c */ |