static void apply_vbr_preset(lame_global_flags * gfp, int a, int enforce) { vbr_presets_t const *vbr_preset = get_vbr_preset(lame_get_VBR(gfp)); float x = gfp->VBR_q_frac; vbr_presets_t p = vbr_preset[a]; vbr_presets_t q = vbr_preset[a + 1]; vbr_presets_t const *set = &p; NOOP(vbr_q); NOOP(quant_comp); NOOP(quant_comp_s); NOOP(expY); LERP(st_lrm); LERP(st_s); LERP(masking_adj); LERP(masking_adj_short); LERP(ath_lower); LERP(ath_curve); LERP(ath_sensitivity); LERP(interch); NOOP(safejoint); LERP(sfb21mod); LERP(msfix); LERP(minval); LERP(ath_fixpoint); (void) lame_set_VBR_q(gfp, set->vbr_q); SET_OPTION(quant_comp, set->quant_comp, -1); SET_OPTION(quant_comp_short, set->quant_comp_s, -1); if (set->expY) { (void) lame_set_experimentalY(gfp, set->expY); } SET_OPTION(short_threshold_lrm, set->st_lrm, -1); SET_OPTION(short_threshold_s, set->st_s, -1); SET_OPTION(maskingadjust, set->masking_adj, 0); SET_OPTION(maskingadjust_short, set->masking_adj_short, 0); if (lame_get_VBR(gfp) == vbr_mt || lame_get_VBR(gfp) == vbr_mtrh) { lame_set_ATHtype(gfp, 5); } SET_OPTION(ATHlower, set->ath_lower, 0); SET_OPTION(ATHcurve, set->ath_curve, -1); SET_OPTION(athaa_sensitivity, set->ath_sensitivity, 0); if (set->interch > 0) { SET_OPTION(interChRatio, set->interch, -1); } /* parameters for which there is no proper set/get interface */ if (set->safejoint > 0) { (void) lame_set_exp_nspsytune(gfp, lame_get_exp_nspsytune(gfp) | 2); } if (set->sfb21mod > 0) { int const nsp = lame_get_exp_nspsytune(gfp); int const val = (nsp >> 20) & 63; if (val == 0) { int const sf21mod = (set->sfb21mod << 20) | nsp; (void) lame_set_exp_nspsytune(gfp, sf21mod); } }
int lame_set_preset_expopts( lame_global_flags* gfp, int preset_expopts ) { lame_internal_flags *gfc = gfp->internal_flags; gfc->presetTune.use = 1; /* default = 0 (disabled) */ gfp->preset_expopts = preset_expopts; switch (preset_expopts) { case 1: lame_set_exp_nspsytune(gfp, lame_get_exp_nspsytune(gfp) | 1); lame_set_experimentalX(gfp, 3); lame_set_exp_nspsytune(gfp, lame_get_exp_nspsytune(gfp) | 2); // safejoint lame_set_ATHtype(gfp, 2); gfc->presetTune.attackthre = 35; gfc->presetTune.attackthre_s = 150; gfc->presetTune.ms_maskadjust = .5; gfc->presetTune.quantcomp_type_s = 3; gfc->presetTune.quantcomp_alt_type = 3; gfc->presetTune.athadjust_switch_level = 2; // Always switch break; case 2: if (gfp->VBR == vbr_mtrh) { lame_set_experimentalX(gfp, 2); gfc->presetTune.quantcomp_adjust_mtrh = 9; gfc->presetTune.quantcomp_type_s = 4; gfc->presetTune.quantcomp_alt_type = 0; gfc->presetTune.athadjust_safe_noiseshaping_thre = 0.0; gfc->presetTune.athadjust_safe_athaasensitivity = 8.0; } else { lame_set_experimentalX(gfp, 3); gfc->presetTune.quantcomp_adjust_rh_tot = 600; gfc->presetTune.quantcomp_adjust_rh_max = 60; gfc->presetTune.quantcomp_type_s = 3; gfc->presetTune.quantcomp_alt_type = 1; } lame_set_exp_nspsytune(gfp, lame_get_exp_nspsytune(gfp) | 1); lame_set_experimentalZ(gfp, 1); lame_set_VBR_q(gfp, 2); lame_set_exp_nspsytune(gfp, lame_get_exp_nspsytune(gfp) | 2); // safejoint lame_set_ATHtype(gfp, 2); // modify sfb21 by 3 dB plus ns-treble=0 lame_set_exp_nspsytune(gfp, lame_get_exp_nspsytune(gfp) | (12 << 20)); gfc->presetTune.attackthre = 35; gfc->presetTune.attackthre_s = 150; gfc->presetTune.ms_maskadjust = .5; gfc->presetTune.athadjust_switch_level = 1; gfc->presetTune.athadjust_msfix = 2.13; break; case 3: if (gfp->VBR == vbr_mtrh) { gfc->presetTune.quantcomp_type_s = 4; gfc->presetTune.quantcomp_adjust_mtrh = 9; gfc->presetTune.quantcomp_alt_type = 0; (void) lame_set_ATHlower( gfp, -2 ); gfc->presetTune.athadjust_safe_noiseshaping_thre = 0.0; gfc->presetTune.athadjust_safe_athaasensitivity = 8.0; } else { gfc->presetTune.quantcomp_type_s = 3; gfc->presetTune.quantcomp_adjust_rh_tot = 600; gfc->presetTune.quantcomp_adjust_rh_max = 60; (void) lame_set_ATHlower( gfp, -1 ); } lame_set_exp_nspsytune(gfp, lame_get_exp_nspsytune(gfp) | 1); lame_set_experimentalZ(gfp, 1); lame_set_experimentalX(gfp, 1); lame_set_VBR_q(gfp, 2); lame_set_exp_nspsytune(gfp, lame_get_exp_nspsytune(gfp) | 2); // safejoint (void) lame_set_msfix( gfp, 2.13 ); lame_set_ATHtype(gfp, 4); // modify sfb21 by 3.75 dB plus ns-treble=0 lame_set_exp_nspsytune(gfp, lame_get_exp_nspsytune(gfp) | (15 << 20)); gfc->presetTune.attackthre = 35; gfc->presetTune.attackthre_s = 150; gfc->presetTune.ms_maskadjust = .5; gfc->presetTune.athadjust_switch_level = 1; break; } return 0; }