Hi folks, greetings from mac-land. May have tracked down a fast (-f)
encode bug in 3.13 over here, apparently should affect all platforms.
If I'm not mistaken, this has been lurking in LAME for awhile, at least
since 3.11. (For some reason, -f has continued to work all along on my
matching linux/x86 builds, apparently gambling on the contents of
uninitialized doubles).
In "musicin.c", function encodeframe(): if fast_mode==TRUE, the call to
L3psycho_anal() gets skipped... I assume that's the whole point of fast
mode. But perceptual energy pe[][] never gets initialized in the bypass
code. It gets passed down to iteration_loop(), still uninitialized. On
the mac, after awhile, we happen to see a large positive number
somewhere in pe[][]. Way down at bin_search_StepSize2(), this causes an
endless loop, because desired_rate comes in as a very large negative
number.
I haven't really looked at the psycho_anal code, so I don't know what a
good "default" pe would be. How about 0.0? Seems to stop the hangs and
produce listenable results. Somebody else ought to suggest something
better!
Anyhow, here's the patch to "musicin.c", inside encodeframe():
if (!fast_mode) {
/* psychoacoustic model
* psy model adds a 544 delay to sync with the filterbanks
* in addition to this delay, it also adds a 1 granule (576) delay
* that we must compensate for (mt 6/99).
*/
short int *bufp[2]; /* address of beginning of left & right granule
*/
int blocktype[2];
for (gr=0; gr < mode_gr ; gr++) {
for ( ch = 0; ch < stereo; ch++ ) bufp[ch]=&mfbuf[ch][576 +
gr*576];
L3psycho_anal( bufp, stereo, gr, info,
s_freq[info->version][info->sampling_frequency] * 1000.0,
check_ms_stereo,&ms_ener_ratio[gr],
ratio.l[gr], ratio.s[gr], pe[gr], blocktype);
for ( ch = 0; ch < stereo; ch++ )
l3_side.gr[gr].ch[ch].tt.block_type=blocktype[ch];
}
}else{
for (gr=0; gr < mode_gr ; gr++)
for ( ch = 0; ch < stereo; ch++ )
#ifndef MYFASTMODEPATCH
l3_side.gr[gr].ch[ch].tt.block_type=NORM_TYPE;
#else
{
l3_side.gr[gr].ch[ch].tt.block_type=NORM_TYPE;
pe[gr][ch]=0.0; // default pe (fast=skipped psycho)
}
#endif // MYFASTMODEPATCH
}
Hope this helps. Best,
-ben "jacobs" <mailto:[EMAIL PROTECTED]>
--
MP3 ENCODER mailing list ( http://geek.rcc.se/mp3encoder/ )