Re: Flag for NSsafejoint
Elio Blanca <[email protected]>
| Newsgroups | gmane.comp.audio.mp3.lame |
|---|---|
| Message-ID | <[email protected]> |
Il 11/02/2017 00:17, Elio Blanca ha scritto:
> Hello, I downloaded the latest lame (3.100 alpha2) from sourceforge cvs repository for my personal
> build and I see strange usage of safe joint bit, I read it from lame tag using mp3guessenc.
I've found the issue.
It's into presets.c, where default settings are always used for any encoding, regardless of the
output channel configuration.
This patch fixes two issues. First, it gets the nssafejoint setup only for joint stereo encodings.
Two, the macro guards allow general users not to worry about safe joint activation (the code will
use it by default), whereas users enabling the macro _ALLOW_INTERNAL_OPTIONS (which enables
selection of '--nssafejoint' option) will remove those statements and decide whether have the flag
enabled or not.
Elio
diff -ur lame-orig/libmp3lame/presets.c lame-safejoint_fix/libmp3lame/presets.c
--- lame-orig/libmp3lame/presets.c 2012-10-06 13:44:56.000000000 +0200
+++ lame-safejoint_fix/libmp3lame/presets.c 2017-02-10 14:59:08.000000000 +0100
@@ -186,10 +186,11 @@
SET_OPTION(interChRatio, set->interch, -1);
}
+#ifndef _ALLOW_INTERNAL_OPTIONS
/* parameters for which there is no proper set/get interface */
- if (set->safejoint > 0) {
+ if (set->safejoint > 0 && lame_get_mode(gfp) == JOINT_STEREO)
(void) lame_set_exp_nspsytune(gfp, lame_get_exp_nspsytune(gfp) | 2);
- }
+#endif
if (set->sfb21mod > 0) {
int const nsp = lame_get_exp_nspsytune(gfp);
int const val = (nsp >> 20) & 63;
@@ -272,11 +273,11 @@
(void) lame_set_VBR_mean_bitrate_kbps(gfp, max_int(lame_get_VBR_mean_bitrate_kbps(gfp), 8));
(void) lame_set_brate(gfp, lame_get_VBR_mean_bitrate_kbps(gfp));
-
+#ifndef _ALLOW_INTERNAL_OPTIONS
/* parameters for which there is no proper set/get interface */
- if (abr_switch_map[r].safejoint > 0)
+ if (abr_switch_map[r].safejoint > 0 && lame_get_mode(gfp) == JOINT_STEREO)
(void) lame_set_exp_nspsytune(gfp, lame_get_exp_nspsytune(gfp) | 2); /* safejoint */
-
+#endif
if (abr_switch_map[r].sfscale > 0)
(void) lame_set_sfscale(gfp, 1);
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot