[Scummvm-cvs-logs] SF.net SVN: scummvm:[52097] tools/trunk/compress.cpp

criezy at users.sourceforge.net criezy at users.sourceforge.net
Sun Aug 15 13:20:24 CEST 2010


Revision: 52097
          http://scummvm.svn.sourceforge.net/scummvm/?rev=52097&view=rev
Author:   criezy
Date:     2010-08-15 11:20:23 +0000 (Sun, 15 Aug 2010)

Log Message:
-----------
TOOLS: Accept quality of -1 for ogg compression

The tool was only accepting integer quality between 0 and 10.
However the documentation for oggenc and libvorbisenc states
that the valid range is between -1 and 10 and that fractional values
are also valid. Now the CLI tools does the same. I have not changed
the GUI.

Modified Paths:
--------------
    tools/trunk/compress.cpp

Modified: tools/trunk/compress.cpp
===================================================================
--- tools/trunk/compress.cpp	2010-08-15 08:15:28 UTC (rev 52096)
+++ tools/trunk/compress.cpp	2010-08-15 11:20:23 UTC (rev 52097)
@@ -372,7 +372,7 @@
 		} else {
 			int result = 0;
 
-			/* Quality input is 1 - 10, function takes -0.1 through 1.0 */
+			/* Quality input is -1 - 10, function takes -0.1 through 1.0 */
 			result = vorbis_encode_setup_vbr(&vi, numChannels, samplerate, oggparms.quality * 0.1f);
 
 			if (result == OV_EFAULT) {
@@ -885,13 +885,13 @@
 
 // vorbis
 void CompressionTool::setOggQuality(const std::string& arg) {
-	oggparms.quality = (float)atoi(arg.c_str());
+	oggparms.quality = (float)atof(arg.c_str());
 
 	if (oggparms.quality == 0. && arg != "0")
 		throw ToolException("Quality (-q) must be a number.");
 
-	if (oggparms.quality < 0. || oggparms.quality > 10.)
-		throw ToolException("Quality out of bounds (-q), must be between 0 and 10.");
+	if (oggparms.quality < -1.f || oggparms.quality > 10.f)
+		throw ToolException("Quality out of bounds (-q), must be between -1 and 10.");
 }
 
 void CompressionTool::setOggMinBitrate(const std::string& arg) {
@@ -1169,7 +1169,7 @@
 		os << " -b <rate>    <rate> is the nominal bitrate (default:unset)\n";
 		os << " -m <rate>    <rate> is the minimum bitrate (default:unset)\n";
 		os << " -M <rate>    <rate> is the maximum bitrate (default:unset)\n";
-		os << " -q <value>   specifies the value (0 - 10) of VBR quality (10=best) (default:" << oggqualDef << ")\n";
+		os << " -q <value>   specifies the value (-1 - 10) of VBR quality (10=best) (default:" << oggqualDef << ")\n";
 		os << " --silent     the output of oggenc is hidden (default:disabled)\n";
 	}
 


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Scummvm-git-logs mailing list