00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #ifdef HAVE_CONFIG_H
00023 # include <config.h>
00024 #endif
00025
00026 #include "lame.h"
00027 #include "machine.h"
00028 #include "set_get.h"
00029 #include "encoder.h"
00030 #include "util.h"
00031 #include "lame_global_flags.h"
00032
00033 #define SET_OPTION(opt, val, def) if (enforce) \
00034 (void) lame_set_##opt(gfp, val); \
00035 else if (lame_get_##opt(gfp) == def) \
00036 (void) lame_set_##opt(gfp, val);
00037
00038 #undef Min
00039 #undef Max
00040
00041 static inline int
00042 min_int(int a, int b)
00043 {
00044 if (a < b) {
00045 return a;
00046 }
00047 return b;
00048 }
00049
00050 static inline int
00051 max_int(int a, int b)
00052 {
00053 if (a > b) {
00054 return a;
00055 }
00056 return b;
00057 }
00058
00059 int
00060 apply_abr_preset(lame_global_flags * gfp, int preset, int enforce)
00061 {
00062 int k;
00063
00064 typedef struct {
00065 int abr_kbps;
00066 int quant_comp;
00067 int quant_comp_s;
00068 int safejoint;
00069 FLOAT nsmsfix;
00070 FLOAT st_lrm;
00071 FLOAT st_s;
00072 FLOAT nsbass;
00073 FLOAT scale;
00074 FLOAT masking_adj;
00075 FLOAT ath_lower;
00076 FLOAT ath_curve;
00077 FLOAT interch;
00078 int sfscale;
00079 } abr_presets_t;
00080
00081
00082
00083
00084 const abr_presets_t abr_switch_map[] = {
00085
00086 {8, 9, 9, 0, 0, 6.60, 145, 0, 0.95, 0, -30.0, 11, 0.0012, 1},
00087 {16, 9, 9, 0, 0, 6.60, 145, 0, 0.95, 0, -25.0, 11, 0.0010, 1},
00088 {24, 9, 9, 0, 0, 6.60, 145, 0, 0.95, 0, -20.0, 11, 0.0010, 1},
00089 {32, 9, 9, 0, 0, 6.60, 145, 0, 0.95, 0, -15.0, 11, 0.0010, 1},
00090 {40, 9, 9, 0, 0, 6.60, 145, 0, 0.95, 0, -10.0, 11, 0.0009, 1},
00091 {48, 9, 9, 0, 0, 6.60, 145, 0, 0.95, 0, -10.0, 11, 0.0009, 1},
00092 {56, 9, 9, 0, 0, 6.60, 145, 0, 0.95, 0, -6.0, 11, 0.0008, 1},
00093 {64, 9, 9, 0, 0, 6.60, 145, 0, 0.95, 0, -2.0, 11, 0.0008, 1},
00094 {80, 9, 9, 0, 0, 6.60, 145, 0, 0.95, 0, .0, 8, 0.0007, 1},
00095 {96, 9, 9, 0, 2.50, 6.60, 145, 0, 0.95, 0, 1.0, 5.5, 0.0006, 1},
00096 {112, 9, 9, 0, 2.25, 6.60, 145, 0, 0.95, 0, 2.0, 4.5, 0.0005, 1},
00097 {128, 9, 9, 0, 1.95, 6.40, 140, 0, 0.95, 0, 3.0, 4, 0.0002, 1},
00098 {160, 9, 9, 1, 1.79, 6.00, 135, 0, 0.95, -2, 5.0, 3.5, 0, 1},
00099 {192, 9, 9, 1, 1.49, 5.60, 125, 0, 0.97, -4, 7.0, 3, 0, 0},
00100 {224, 9, 9, 1, 1.25, 5.20, 125, 0, 0.98, -6, 9.0, 2, 0, 0},
00101 {256, 9, 9, 1, 0.97, 5.20, 125, 0, 1.00, -8, 10.0, 1, 0, 0},
00102 {320, 9, 9, 1, 0.90, 5.20, 125, 0, 1.00, -10, 12.0, 0, 0, 0}
00103 };
00104
00105
00106
00107 int r;
00108 int actual_bitrate = preset;
00109
00110 r = nearestBitrateFullIndex(preset);
00111
00112
00113 (void) lame_set_VBR(gfp, vbr_abr);
00114 (void) lame_set_VBR_mean_bitrate_kbps(gfp, (actual_bitrate));
00115 (void) lame_set_VBR_mean_bitrate_kbps(gfp, min_int(lame_get_VBR_mean_bitrate_kbps(gfp), 320));
00116 (void) lame_set_VBR_mean_bitrate_kbps(gfp, max_int(lame_get_VBR_mean_bitrate_kbps(gfp), 8));
00117 (void) lame_set_brate(gfp, lame_get_VBR_mean_bitrate_kbps(gfp));
00118
00119
00120 SET_OPTION(psy_model, PSY_NSPSYTUNE, -1);
00121
00122
00123
00124 if (abr_switch_map[r].safejoint > 0)
00125 (void) lame_set_exp_nspsytune(gfp, lame_get_exp_nspsytune(gfp) | 2);
00126
00127 if (abr_switch_map[r].sfscale > 0)
00128 (void) lame_set_sfscale(gfp, 1);
00129
00130
00131 if (abr_switch_map[r].nsbass != 0) {
00132 k = (int) (abr_switch_map[r].nsbass * 4);
00133 if (k < 0)
00134 k += 64;
00135 (void) lame_set_exp_nspsytune(gfp, lame_get_exp_nspsytune(gfp) | (k << 2));
00136 }
00137
00138
00139
00140
00141 SET_OPTION(quant_comp, abr_switch_map[r].quant_comp, -1);
00142 SET_OPTION(quant_comp_short, abr_switch_map[r].quant_comp_s, -1);
00143
00144 SET_OPTION(msfix, abr_switch_map[r].nsmsfix, -1);
00145
00146 SET_OPTION(short_threshold_lrm, abr_switch_map[r].st_lrm, -1);
00147 SET_OPTION(short_threshold_s, abr_switch_map[r].st_s, -1);
00148
00149
00150
00151 SET_OPTION(scale, abr_switch_map[r].scale, -1);
00152
00153 SET_OPTION(maskingadjust, abr_switch_map[r].masking_adj, 0);
00154 if (abr_switch_map[r].masking_adj > 0) {
00155 SET_OPTION(maskingadjust_short, abr_switch_map[r].masking_adj * .9, 0);
00156 }
00157 else {
00158 SET_OPTION(maskingadjust_short, abr_switch_map[r].masking_adj * 1.1, 0);
00159 }
00160
00161
00162 SET_OPTION(ATHlower, abr_switch_map[r].ath_lower, 0);
00163 SET_OPTION(ATHcurve, abr_switch_map[r].ath_curve, -1);
00164
00165 SET_OPTION(interChRatio, abr_switch_map[r].interch, -1);
00166
00167
00168 return preset;
00169 }
00170
00171
00172
00173
00174
00175 int
00176 apply_preset(lame_global_flags * gfp, int preset, int enforce)
00177 {
00178
00179 switch (preset) {
00180 case R3MIX:{
00181 preset = V3;
00182 (void) lame_set_VBR(gfp, vbr_mtrh);
00183 break;
00184 }
00185 case MEDIUM:{
00186 preset = V4;
00187 (void) lame_set_VBR(gfp, vbr_rh);
00188 break;
00189 }
00190 case MEDIUM_FAST:{
00191 preset = V4;
00192 (void) lame_set_VBR(gfp, vbr_mtrh);
00193 break;
00194 }
00195 case STANDARD:{
00196 preset = V2;
00197 (void) lame_set_VBR(gfp, vbr_rh);
00198 break;
00199 }
00200 case STANDARD_FAST:{
00201 preset = V2;
00202 (void) lame_set_VBR(gfp, vbr_mtrh);
00203 break;
00204 }
00205 case EXTREME:{
00206 preset = V0;
00207 (void) lame_set_VBR(gfp, vbr_rh);
00208 break;
00209 }
00210 case EXTREME_FAST:{
00211 preset = V0;
00212 (void) lame_set_VBR(gfp, vbr_mtrh);
00213 break;
00214 }
00215 case INSANE:{
00216 preset = 320;
00217 break;
00218 }
00219 }
00220
00221
00222 gfp->preset = preset;
00223
00224 switch (preset) {
00225 case V9:{
00226 (void) lame_set_VBR_q(gfp, 9);
00227 switch (lame_get_VBR(gfp)) {
00228 case vbr_rh:{
00229 SET_OPTION(short_threshold_lrm, 6.60f, -1);
00230 SET_OPTION(short_threshold_s, 145.0f, -1);
00231 SET_OPTION(quant_comp, 9, -1);
00232 SET_OPTION(quant_comp_short, 9, -1);
00233 SET_OPTION(psy_model, PSY_NSPSYTUNE, -1);
00234 SET_OPTION(maskingadjust, 1.6, 0);
00235 SET_OPTION(maskingadjust_short, 1.6, 0);
00236 SET_OPTION(interChRatio, 0.0008, -1);
00237 SET_OPTION(ATHlower, -36, 0);
00238 SET_OPTION(ATHcurve, 11, -1);
00239 SET_OPTION(athaa_sensitivity, -25, 0);
00240
00241 (void) lame_set_experimentalY(gfp, 1);
00242
00243 return preset;
00244 }
00245 default:{
00246 SET_OPTION(short_threshold_lrm, 6.60f, -1);
00247 SET_OPTION(short_threshold_s, 145.0f, -1);
00248 SET_OPTION(quant_comp, 0, -1);
00249 SET_OPTION(quant_comp_short, 0, -1);
00250 SET_OPTION(psy_model, PSY_NSPSYTUNE, -1);
00251 SET_OPTION(maskingadjust, 1.75, 0);
00252 SET_OPTION(maskingadjust_short, 1.75, 0);
00253 SET_OPTION(interChRatio, 0.0008, -1);
00254 SET_OPTION(ATHlower, -39.5, 0);
00255 SET_OPTION(ATHcurve, 11, -1);
00256 SET_OPTION(athaa_sensitivity, -25, 0);
00257
00258 (void) lame_set_experimentalY(gfp, 1);
00259
00260 return preset;
00261 }
00262 }
00263 }
00264 case V8:{
00265 (void) lame_set_VBR_q(gfp, 8);
00266 switch (lame_get_VBR(gfp)) {
00267 case vbr_rh:{
00268 SET_OPTION(short_threshold_lrm, 6.60f, -1);
00269 SET_OPTION(short_threshold_s, 145.0f, -1);
00270 SET_OPTION(quant_comp, 9, -1);
00271 SET_OPTION(quant_comp_short, 9, -1);
00272 SET_OPTION(psy_model, PSY_NSPSYTUNE, -1);
00273 SET_OPTION(maskingadjust, 1.2, 0);
00274 SET_OPTION(maskingadjust_short, 1.15, 0);
00275 SET_OPTION(interChRatio, 0.0007, -1);
00276 SET_OPTION(ATHlower, -27.5, 0);
00277 SET_OPTION(ATHcurve, 10, -1);
00278 SET_OPTION(athaa_sensitivity, -23, 0);
00279
00280 (void) lame_set_experimentalY(gfp, 1);
00281
00282 return preset;
00283 }
00284 default:{
00285 SET_OPTION(short_threshold_lrm, 6.60f, -1);
00286 SET_OPTION(short_threshold_s, 145.0f, -1);
00287 SET_OPTION(quant_comp, 0, -1);
00288 SET_OPTION(quant_comp_short, 0, -1);
00289 SET_OPTION(psy_model, PSY_NSPSYTUNE, -1);
00290 SET_OPTION(maskingadjust, 1.2, 0);
00291 SET_OPTION(maskingadjust_short, 1.15, 0);
00292 SET_OPTION(interChRatio, 0.0007, -1);
00293 SET_OPTION(ATHlower, -30, 0);
00294 SET_OPTION(ATHcurve, 10, -1);
00295 SET_OPTION(athaa_sensitivity, -23, 0);
00296
00297 (void) lame_set_experimentalY(gfp, 1);
00298
00299 return preset;
00300 }
00301 }
00302 }
00303 case V7:{
00304 (void) lame_set_VBR_q(gfp, 7);
00305 switch (lame_get_VBR(gfp)) {
00306 case vbr_rh:{
00307 SET_OPTION(short_threshold_lrm, 6.60f, -1);
00308 SET_OPTION(short_threshold_s, 145.0f, -1);
00309 SET_OPTION(quant_comp, 9, -1);
00310 SET_OPTION(quant_comp_short, 9, -1);
00311 SET_OPTION(psy_model, PSY_NSPSYTUNE, -1);
00312 SET_OPTION(msfix, 2.70, -1);
00313 SET_OPTION(maskingadjust, .8, 0);
00314 SET_OPTION(maskingadjust_short, .75, 0);
00315 SET_OPTION(interChRatio, 0.0006, -1);
00316 SET_OPTION(ATHlower, -19.7, 0);
00317 SET_OPTION(ATHcurve, 8, -1);
00318 SET_OPTION(athaa_sensitivity, -22, 0);
00319
00320 (void) lame_set_experimentalY(gfp, 1);
00321
00322 return preset;
00323 }
00324 default:{
00325 SET_OPTION(short_threshold_lrm, 6.60f, -1);
00326 SET_OPTION(short_threshold_s, 145.0f, -1);
00327 SET_OPTION(quant_comp, 0, -1);
00328 SET_OPTION(quant_comp_short, 0, -1);
00329 SET_OPTION(psy_model, PSY_NSPSYTUNE, -1);
00330 SET_OPTION(msfix, 2.70, -1);
00331 SET_OPTION(maskingadjust, 0.8, 0);
00332 SET_OPTION(maskingadjust_short, 0.78, 0);
00333 SET_OPTION(interChRatio, 0.0006, -1);
00334 SET_OPTION(ATHlower, -22, 0);
00335 SET_OPTION(ATHcurve, 8, -1);
00336 SET_OPTION(athaa_sensitivity, -22, 0);
00337
00338 (void) lame_set_experimentalY(gfp, 1);
00339
00340 return preset;
00341 }
00342 }
00343 }
00344 case V6:{
00345 (void) lame_set_VBR_q(gfp, 6);
00346 switch (lame_get_VBR(gfp)) {
00347 case vbr_rh:{
00348 SET_OPTION(short_threshold_lrm, 6.60f, -1);
00349 SET_OPTION(short_threshold_s, 145.0f, -1);
00350 SET_OPTION(quant_comp, 9, -1);
00351 SET_OPTION(quant_comp_short, 9, -1);
00352 SET_OPTION(psy_model, PSY_NSPSYTUNE, -1);
00353 SET_OPTION(msfix, 2.30, -1);
00354 SET_OPTION(maskingadjust, .67, 0);
00355 SET_OPTION(maskingadjust_short, .65, 0);
00356 SET_OPTION(interChRatio, 0.0004, -1);
00357 SET_OPTION(ATHlower, -14.7, 0);
00358 SET_OPTION(ATHcurve, 6.5, -1);
00359 SET_OPTION(athaa_sensitivity, -19, 0);
00360
00361 (void) lame_set_experimentalY(gfp, 1);
00362
00363 return preset;
00364 }
00365 default:{
00366 SET_OPTION(short_threshold_lrm, 6.60f, -1);
00367 SET_OPTION(short_threshold_s, 145.0f, -1);
00368 SET_OPTION(quant_comp, 0, -1);
00369 SET_OPTION(quant_comp_short, 0, -1);
00370 SET_OPTION(psy_model, PSY_NSPSYTUNE, -1);
00371 SET_OPTION(msfix, 2.30, -1);
00372 SET_OPTION(maskingadjust, 0.67, 0);
00373 SET_OPTION(maskingadjust_short, 0.65, 0);
00374 SET_OPTION(interChRatio, 0.0004, -1);
00375 SET_OPTION(ATHlower, -14.5, 0);
00376 SET_OPTION(ATHcurve, 6.5, -1);
00377 SET_OPTION(athaa_sensitivity, -19, 0);
00378
00379 (void) lame_set_experimentalY(gfp, 1);
00380
00381 return preset;
00382 }
00383 }
00384 }
00385 case V5:{
00386 (void) lame_set_VBR_q(gfp, 5);
00387 switch (lame_get_VBR(gfp)) {
00388 case vbr_rh:{
00389 SET_OPTION(short_threshold_lrm, 6.40f, -1);
00390 SET_OPTION(short_threshold_s, 140.0f, -1);
00391 SET_OPTION(quant_comp, 9, -1);
00392 SET_OPTION(quant_comp_short, 9, -1);
00393 SET_OPTION(psy_model, PSY_NSPSYTUNE, -1);
00394 SET_OPTION(msfix, 1.95, -1);
00395 SET_OPTION(maskingadjust, .5, 0);
00396 SET_OPTION(maskingadjust_short, .4, 0);
00397 SET_OPTION(interChRatio, 0.0002, -1);
00398 SET_OPTION(ATHlower, -7.5, 0);
00399 SET_OPTION(ATHcurve, 4, -1);
00400 SET_OPTION(athaa_sensitivity, -12, 0);
00401
00402 (void) lame_set_experimentalY(gfp, 1);
00403
00404 return preset;
00405 }
00406 default:{
00407 SET_OPTION(short_threshold_lrm, 6.40f, -1);
00408 SET_OPTION(short_threshold_s, 140.0f, -1);
00409 SET_OPTION(quant_comp, 0, -1);
00410 SET_OPTION(quant_comp_short, 0, -1);
00411 SET_OPTION(psy_model, PSY_NSPSYTUNE, -1);
00412 SET_OPTION(msfix, 1.95, -1);
00413 SET_OPTION(maskingadjust, 0.45, 0);
00414 SET_OPTION(maskingadjust_short, 0.35, 0);
00415 SET_OPTION(interChRatio, 0.0002, -1);
00416 SET_OPTION(ATHlower, -7.7, 0);
00417 SET_OPTION(ATHcurve, 4, -1);
00418 SET_OPTION(athaa_sensitivity, -12, 0);
00419
00420 (void) lame_set_experimentalY(gfp, 1);
00421
00422 return preset;
00423 }
00424 }
00425 }
00426 case V4:{
00427 (void) lame_set_VBR_q(gfp, 4);
00428 switch (lame_get_VBR(gfp)) {
00429 case vbr_rh:{
00430 SET_OPTION(short_threshold_lrm, 6.00f, -1);
00431 SET_OPTION(short_threshold_s, 135.0f, -1);
00432 SET_OPTION(quant_comp, 9, -1);
00433 SET_OPTION(quant_comp_short, 9, -1);
00434 SET_OPTION(psy_model, PSY_NSPSYTUNE, -1);
00435 (void) lame_set_exp_nspsytune(gfp, lame_get_exp_nspsytune(gfp) | 2);
00436 SET_OPTION(msfix, 1.79, -1);
00437 SET_OPTION(maskingadjust, -.7, 0);
00438 SET_OPTION(maskingadjust_short, -1.1, 0);
00439 SET_OPTION(ATHlower, 1.1, 0);
00440 SET_OPTION(ATHcurve, 3.5, -1);
00441 SET_OPTION(athaa_sensitivity, -8, 0);
00442
00443 (void) lame_set_experimentalY(gfp, 1);
00444
00445 return preset;
00446 }
00447 default:{
00448 SET_OPTION(short_threshold_lrm, 6.00f, -1);
00449 SET_OPTION(short_threshold_s, 135.0f, -1);
00450 SET_OPTION(quant_comp, 0, -1);
00451 SET_OPTION(quant_comp_short, 0, -1);
00452 SET_OPTION(psy_model, PSY_NSPSYTUNE, -1);
00453 (void) lame_set_exp_nspsytune(gfp, lame_get_exp_nspsytune(gfp) | 2);
00454 SET_OPTION(msfix, 1.79, -1);
00455 SET_OPTION(maskingadjust, -.7, 0);
00456 SET_OPTION(maskingadjust_short, -1.1, 0);
00457 SET_OPTION(ATHlower, 0, 0);
00458 SET_OPTION(ATHcurve, 3.5, -1);
00459 SET_OPTION(athaa_sensitivity, -8, 0);
00460
00461 (void) lame_set_experimentalY(gfp, 1);
00462
00463 return preset;
00464 }
00465 }
00466 }
00467 case V3:{
00468 (void) lame_set_VBR_q(gfp, 3);
00469 switch (lame_get_VBR(gfp)) {
00470 case vbr_rh:{
00471 SET_OPTION(short_threshold_lrm, 5.80f, -1);
00472 SET_OPTION(short_threshold_s, 130.0f, -1);
00473 SET_OPTION(quant_comp, 9, -1);
00474 SET_OPTION(quant_comp_short, 9, -1);
00475 SET_OPTION(psy_model, PSY_NSPSYTUNE, -1);
00476 (void) lame_set_exp_nspsytune(gfp, lame_get_exp_nspsytune(gfp) | 2);
00477 SET_OPTION(msfix, 1.64, -1);
00478 SET_OPTION(maskingadjust, -1.8, 0);
00479 SET_OPTION(maskingadjust_short, -2.8, 0);
00480 SET_OPTION(ATHlower, 2.6, 0);
00481 SET_OPTION(ATHcurve, 3, -1);
00482 SET_OPTION(athaa_sensitivity, -4, 0);
00483
00484
00485 (void) lame_set_exp_nspsytune(gfp, lame_get_exp_nspsytune(gfp) | (20 << 20));
00486 (void) lame_set_experimentalY(gfp, 1);
00487
00488 return preset;
00489 }
00490 default:{
00491 SET_OPTION(short_threshold_lrm, 5.80f, -1);
00492 SET_OPTION(short_threshold_s, 130.0f, -1);
00493 SET_OPTION(quant_comp, 0, -1);
00494 SET_OPTION(quant_comp_short, 0, -1);
00495 SET_OPTION(psy_model, PSY_NSPSYTUNE, -1);
00496 (void) lame_set_exp_nspsytune(gfp, lame_get_exp_nspsytune(gfp) | 2);
00497 SET_OPTION(msfix, 1.64, -1);
00498 SET_OPTION(maskingadjust, -1.45, 0);
00499 SET_OPTION(maskingadjust_short, -2.45, 0);
00500 SET_OPTION(ATHlower, 1.1, 0);
00501 SET_OPTION(ATHcurve, 3, -1);
00502 SET_OPTION(athaa_sensitivity, -4, 0);
00503
00504
00505 (void) lame_set_exp_nspsytune(gfp, lame_get_exp_nspsytune(gfp) | (15 << 20));
00506 (void) lame_set_experimentalY(gfp, 1);
00507
00508 return preset;
00509 }
00510 }
00511 }
00512 case V2:{
00513 (void) lame_set_VBR_q(gfp, 2);
00514 switch (lame_get_VBR(gfp)) {
00515 case vbr_rh:{
00516 SET_OPTION(short_threshold_lrm, 5.6f, -1);
00517 SET_OPTION(short_threshold_s, 125.0f, -1);
00518 SET_OPTION(quant_comp, 9, -1);
00519 SET_OPTION(quant_comp_short, 9, -1);
00520 SET_OPTION(psy_model, PSY_NSPSYTUNE, -1);
00521 (void) lame_set_exp_nspsytune(gfp, lame_get_exp_nspsytune(gfp) | 2);
00522 SET_OPTION(msfix, 1.49, -1);
00523 SET_OPTION(maskingadjust, -2.2, 0);
00524 SET_OPTION(maskingadjust_short, -3.5, 0);
00525 SET_OPTION(ATHlower, 2.8, 0);
00526 SET_OPTION(ATHcurve, 2, -1);
00527
00528 (void) lame_set_exp_nspsytune(gfp, lame_get_exp_nspsytune(gfp) | (21 << 20));
00529
00530 return preset;
00531 }
00532 default:{
00533 SET_OPTION(short_threshold_lrm, 5.6f, -1);
00534 SET_OPTION(short_threshold_s, 125.0f, -1);
00535 SET_OPTION(quant_comp, 0, -1);
00536 SET_OPTION(quant_comp_short, 0, -1);
00537 SET_OPTION(psy_model, PSY_NSPSYTUNE, -1);
00538 (void) lame_set_exp_nspsytune(gfp, lame_get_exp_nspsytune(gfp) | 2);
00539 SET_OPTION(msfix, 1.49, -1);
00540 SET_OPTION(maskingadjust, -1.7, 0);
00541 SET_OPTION(maskingadjust_short, -3.2, 0);
00542 SET_OPTION(ATHlower, 2, 0);
00543 SET_OPTION(ATHcurve, 2, -1);
00544
00545 (void) lame_set_exp_nspsytune(gfp, lame_get_exp_nspsytune(gfp) | (18 << 20));
00546
00547 return preset;
00548 }
00549 }
00550 }
00551 case V1:{
00552 (void) lame_set_VBR_q(gfp, 1);
00553 switch (lame_get_VBR(gfp)) {
00554 case vbr_rh:{
00555 SET_OPTION(short_threshold_lrm, 5.3f, -1);
00556 SET_OPTION(short_threshold_s, 125.0f, -1);
00557 SET_OPTION(quant_comp, 9, -1);
00558 SET_OPTION(quant_comp_short, 9, -1);
00559 SET_OPTION(psy_model, PSY_NSPSYTUNE, -1);
00560 (void) lame_set_exp_nspsytune(gfp, lame_get_exp_nspsytune(gfp) | 2);
00561 SET_OPTION(msfix, 1.35, -1);
00562 SET_OPTION(maskingadjust, -3.6, 0);
00563 SET_OPTION(maskingadjust_short, -5.6, 0);
00564 SET_OPTION(ATHlower, 4.5, 0);
00565 SET_OPTION(ATHcurve, 1.5, -1);
00566
00567 (void) lame_set_exp_nspsytune(gfp, lame_get_exp_nspsytune(gfp) | (21 << 20));
00568
00569 return preset;
00570 }
00571 default:{
00572 SET_OPTION(short_threshold_lrm, 5.3f, -1);
00573 SET_OPTION(short_threshold_s, 125.0f, -1);
00574 SET_OPTION(quant_comp, 0, -1);
00575 SET_OPTION(quant_comp_short, 0, -1);
00576 SET_OPTION(psy_model, PSY_NSPSYTUNE, -1);
00577 (void) lame_set_exp_nspsytune(gfp, lame_get_exp_nspsytune(gfp) | 2);
00578 SET_OPTION(msfix, 1.35, -1);
00579 SET_OPTION(maskingadjust, -3.4, 0);
00580 SET_OPTION(maskingadjust_short, -5.4, 0);
00581 SET_OPTION(ATHlower, 4.5, 0);
00582 SET_OPTION(ATHcurve, 1.5, -1);
00583
00584 (void) lame_set_exp_nspsytune(gfp, lame_get_exp_nspsytune(gfp) | (21 << 20));
00585
00586 return preset;
00587 }
00588 }
00589 }
00590 case V0:{
00591 (void) lame_set_VBR_q(gfp, 0);
00592 switch (lame_get_VBR(gfp)) {
00593 case vbr_rh:{
00594 SET_OPTION(short_threshold_lrm, 5.2f, -1);
00595 SET_OPTION(short_threshold_s, 125.0f, -1);
00596 SET_OPTION(quant_comp, 9, -1);
00597 SET_OPTION(quant_comp_short, 9, -1);
00598 SET_OPTION(psy_model, PSY_NSPSYTUNE, -1);
00599 (void) lame_set_exp_nspsytune(gfp, lame_get_exp_nspsytune(gfp) | 2);
00600 SET_OPTION(msfix, .97, -1);
00601 SET_OPTION(maskingadjust, -4.2, 0);
00602 SET_OPTION(maskingadjust_short, -6.3, 0);
00603 SET_OPTION(ATHlower, 4.8, 0);
00604 SET_OPTION(ATHcurve, 1, -1);
00605
00606 (void) lame_set_exp_nspsytune(gfp, lame_get_exp_nspsytune(gfp) | (21 << 20));
00607
00608 return preset;
00609 }
00610 default:{
00611 SET_OPTION(short_threshold_lrm, 5.2f, -1);
00612 SET_OPTION(short_threshold_s, 125.0f, -1);
00613 SET_OPTION(quant_comp, 0, -1);
00614 SET_OPTION(quant_comp_short, 0, -1);
00615 SET_OPTION(psy_model, PSY_NSPSYTUNE, -1);
00616 (void) lame_set_exp_nspsytune(gfp, lame_get_exp_nspsytune(gfp) | 2);
00617 SET_OPTION(msfix, .97, -1);
00618 SET_OPTION(maskingadjust, -3.6, 0);
00619 SET_OPTION(maskingadjust_short, -5.6, 0);
00620 SET_OPTION(ATHlower, 7.5, 0);
00621 SET_OPTION(ATHcurve, 1, -1);
00622
00623 (void) lame_set_exp_nspsytune(gfp, lame_get_exp_nspsytune(gfp) | (26 << 20));
00624
00625 return preset;
00626 }
00627 }
00628 }
00629 default:
00630 break;
00631 }
00632
00633 if ((preset >= 8) && (preset <= 320))
00634 return apply_abr_preset(gfp, preset, enforce);
00635
00636
00637 gfp->preset = 0;
00638 return preset;
00639 }