From: <man...@us...> - 2014-10-21 15:08:16
|
Revision: 4456 http://sourceforge.net/p/modplug/code/4456 Author: manxorist Date: 2014-10-21 15:08:04 +0000 (Tue, 21 Oct 2014) Log Message: ----------- [Imp] Stream Export: For LAME and Vorbis, show an estimated target bitrate for VBR modes. Modified Paths: -------------- trunk/OpenMPT/mptrack/StreamEncoderMP3.cpp trunk/OpenMPT/mptrack/StreamEncoderVorbis.cpp Modified: trunk/OpenMPT/mptrack/StreamEncoderMP3.cpp =================================================================== --- trunk/OpenMPT/mptrack/StreamEncoderMP3.cpp 2014-10-21 10:58:54 UTC (rev 4455) +++ trunk/OpenMPT/mptrack/StreamEncoderMP3.cpp 2014-10-21 15:08:04 UTC (rev 4456) @@ -1481,14 +1481,15 @@ #ifdef MPT_MP3ENCODER_LAME if(m_Type == MP3EncoderLame) { - int q = static_cast<int>((1.0f - quality) * 10.0f); + static const int q_table[11] = { 240, 220, 190, 170, 160, 130, 120, 100, 80, 70, 50 }; // http://wiki.hydrogenaud.io/index.php?title=LAME + int q = Util::Round<int>((1.0f - quality) * 10.0f); if(q < 0) q = 0; if(q >= 10) { - return "VBR -V9.999"; + return mpt::String::Print("VBR -V%1 (~%2 kbit)", "9.999", q_table[q]); } else { - return mpt::String::Print("VBR -V%1", static_cast<int>((1.0f - quality) * 10.0f)); + return mpt::String::Print("VBR -V%1 (~%2 kbit)", Util::Round<int>((1.0f - quality) * 10.0f), q_table[q]); } } #endif // MPT_MP3ENCODER_LAME Modified: trunk/OpenMPT/mptrack/StreamEncoderVorbis.cpp =================================================================== --- trunk/OpenMPT/mptrack/StreamEncoderVorbis.cpp 2014-10-21 10:58:54 UTC (rev 4455) +++ trunk/OpenMPT/mptrack/StreamEncoderVorbis.cpp 2014-10-21 15:08:04 UTC (rev 4456) @@ -445,7 +445,9 @@ std::string VorbisEncoder::DescribeQuality(float quality) const //------------------------------------------------------------- { - return mpt::String::Print("Q%1", mpt::Format().ParsePrintf("%3.1f").ToString(quality * 10.0f)); + static const int q_table[11] = { 64, 80, 96, 112, 128, 160, 192, 224, 256, 320, 500 }; // http://wiki.hydrogenaud.io/index.php?title=Recommended_Ogg_Vorbis + int q = Clamp(Util::Round<int>(quality * 10.0f), 0, 10); + return mpt::String::Print("Q%1 (~%2 kbit)", mpt::fmt::f("%3.1f", quality * 10.0f), q_table[q]); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |