Ok, first off, a lot of functions are left empty with no prototype declared,
like f.ex. "void lame_init()", instead of doing it properly like
"void lame_init(void)" .. doing this will eliminate about half of the compiler
warnings (and also declaring prototypes in the appropriate .h file)...
..then there are lots and lots of dead assignments that probably are left over
from old code and never got removed...
..if you run LAME without arguments, you get two headers, which looks kinda
silly, due to the fact that both lame_init() and lame_usage() prints them. ;)
In get_audio.c at line 369 (and 210) "if ((".." && (samples_read >= 0))" ..
what is the purpose of this, as samples_read is a unsigned long, and thus can
never be less than zero?!
In the compute_ath() function in loop.c (line 219) Min() is called twice with
the function ATHformula() as one of it's arguments .. Calling min or max
functions with functions as arguments is generally a Bad-Thing(tm), as you
might end up changing values twice, or as in this case just wasting CPU time.
Suggested compute_ath() function would be:
void compute_ath(layer *info)
{
int sfb,i,start,end;
double ATH_f;
double samp_freq = s_freq[info->version][info->sampling_frequency];
/* last sfb is not used */
for ( sfb = 0; sfb < SFB_LMAX-1; sfb++ ) {
start = scalefac_band_long[ sfb ];
end = scalefac_band_long[ sfb+1 ];
ATH_l[sfb]=1e99;
for (i=start ; i < end; i++) {
ATH_f=ATHformula(samp_freq*i/(2*576)); /* freq in kHz, and compute */
ATH_l[sfb]=Min(ATH_l[sfb],ATH_f);
}
}
for ( sfb = 0; sfb < SFB_SMAX - 1; sfb++ ){
start = scalefac_band_short[ sfb ];
end = scalefac_band_short[ sfb+1 ];
ATH_s[sfb]=1e99;
for (i=start ; i < end; i++) {
ATH_f=ATHformula(samp_freq*i/(2*192)); /* freq in kHz, and compute */
ATH_s[sfb]=Min(ATH_s[sfb],ATH_f);
}
}
}
- CISC
--
MP3 ENCODER mailing list ( http://geek.rcc.se/mp3encoder/ )