[ lame-Bugs-3475583 ] lame+libsndfile reads and decodes input twice
SourceForge.net <[email protected]>
| Newsgroups | gmane.comp.audio.mp3.lame |
|---|---|
| Message-ID | <[email protected]> |
Bugs item #3475583, was opened at 2012-01-18 09:57
Message generated for change (Tracker Item Submitted) made by lvqcl
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=100290&aid=3475583&group_id=290
Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: None
Group: None
Status: Open
Resolution: None
Priority: 5
Private: No
Submitted By: lvqcl (lvqcl)
Assigned to: Nobody/Anonymous (nobody)
Summary: lame+libsndfile reads and decodes input twice
Initial Comment:
LAME now calls "sf_command(gs_pSndFileIn, SFC_SET_SCALE_FLOAT_INT_READ, NULL, SF_TRUE)" but it seems that libsndfile reads and decodes an input file during this call (to determine its peak value). Then LAME reads the input file again to encode it to MP3.
IMHO it is better to remove this call and maybe replace sf_read_int(...) with the following:
float insampflt[2 * 1152];
...
...
samples_read = sf_read_float(global.snd_file, insampflt, num_channels * samples_to_read);
for(i=0; i<samples_read; i++)
{
float x = insampflt[i] * ((float)INT_MAX + 1.0);
if (x > (float)INT_MAX) x = (float)INT_MAX;
else if (x < (float)INT_MIN) x = (float)INT_MIN;
insamp[i] = (int)x;
}
Usually it will result in double conversion (int->float->int) but it is better than reading+decoding an input file twice.
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=100290&aid=3475583&group_id=290
------------------------------------------------------------------------------
Keep Your Developer Skills Current with LearnDevNow!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-d2d