shithub: aacenc

Download patch

ref: 2e62951e6789db8b6b166c75f30632cf83ea7b8e
parent: 64f3b069d714421022d9c871084d8a466f4df558
author: Sigrid Solveig Haflínudóttir <ftrvxmtrx@gmail.com>
date: Fri Jul 16 06:14:51 EDT 2021

add quantization quality option

--- a/frontend/aacenc.c
+++ b/frontend/aacenc.c
@@ -29,7 +29,7 @@
 static void
 usage(void)
 {
-	fprint(2, "usage: %s [-r RATE] [-c CHAN] [-t low|main|ltp] [-B BITRATE]\n", argv0);
+	fprint(2, "usage: %s [-r RATE] [-c CHAN] [-q QUANT] [-t low|main|ltp] [-B BITRATE]\n", argv0);
 	exits("usage");
 }
 
@@ -36,7 +36,7 @@
 void
 main(int argc, char **argv)
 {
-	int nch, srate, type, brate, sz, n, r;
+	int nch, srate, type, brate, sz, n, r, q;
 	ulong insamples, outsz, insz;
 	faacEncConfigurationPtr fmt;
 	faacEncHandle e;
@@ -50,6 +50,7 @@
 	srate = 44100;
 	nch = 2;
 	type = LOW;
+	q = 0;
 	ARGBEGIN{
 	case 'B':
 		if((brate = atoi(EARGF(usage()))) < 0)
@@ -63,6 +64,10 @@
 		if((srate = atoi(EARGF(usage()))) < 1)
 			sysfatal("invalid samplerate %d", srate);
 		break;
+	case 'q':
+		if((q = atoi(EARGF(usage()))) < 1)
+			sysfatal("invalid quantization quality %d", q);
+		break;
 	case 't':
 		s = EARGF(usage());
 		if(cistrcmp(s, "low") == 0)
@@ -100,6 +105,8 @@
 	fmt->aacObjectType = type;
 	if(brate > 0)
 		fmt->bitRate = brate / nch;
+	if(q > 0)
+		fmt->quantqual = q;
 	if(!faacEncSetConfiguration(e, fmt))
 		sysfatal("invalid encoder configuration");