enable svt-av1 encoder option
enable the support to use svt-av1 as the encoder for CTC test
Change-Id: If8116cd9dcc8b198bf2011cb345c729a4d0da558
diff --git a/tools/convexhull_framework/src/AV2CTCTest.py b/tools/convexhull_framework/src/AV2CTCTest.py
index 6e31e70..7302363 100644
--- a/tools/convexhull_framework/src/AV2CTCTest.py
+++ b/tools/convexhull_framework/src/AV2CTCTest.py
@@ -20,7 +20,8 @@
GetRDResultCsvFile, GatherPerframeStat, GatherInstrCycleInfo
import Utils
from Config import LogLevels, FrameNum, TEST_CONFIGURATIONS, QPs, WorkPath, \
- Path_RDResults, LoggerName, QualityList, MIN_GOP_LENGTH, UsePerfUtil
+ Path_RDResults, LoggerName, QualityList, MIN_GOP_LENGTH, UsePerfUtil, \
+ EnableTimingInfo
from EncDecUpscale import Encode, Decode
###############################################################################
@@ -59,7 +60,7 @@
for folder in folders:
Cleanfolder(folder)
-def Run_Encode_Test(test_cfg, clip, preset, LogCmdOnly = False):
+def Run_Encode_Test(test_cfg, clip, method, preset, LogCmdOnly = False):
Utils.Logger.info("start running %s encode tests with %s"
% (test_cfg, clip.file_name))
for QP in QPs[test_cfg]:
@@ -67,12 +68,12 @@
#encode
if LogCmdOnly:
Utils.CmdLogger.write("============== Job Start =================\n")
- bsFile = Encode('aom', 'av1', preset, clip, test_cfg, QP,
+ bsFile = Encode(method, 'av1', preset, clip, test_cfg, QP,
FrameNum[test_cfg], Path_Bitstreams, Path_TimingLog,
Path_EncLog, LogCmdOnly)
Utils.Logger.info("start decode file %s" % os.path.basename(bsFile))
#decode
- decodedYUV = Decode(test_cfg, 'av1', bsFile, Path_DecodedYuv, Path_TimingLog,
+ decodedYUV = Decode(method, test_cfg, 'av1', bsFile, Path_DecodedYuv, Path_TimingLog,
False, LogCmdOnly)
#calcualte quality distortion
Utils.Logger.info("start quality metric calculation")
@@ -155,9 +156,11 @@
if UsePerfUtil:
enc_instr, enc_cycles, dec_instr, dec_cycles = GatherInstrCycleInfo(bs, Path_TimingLog)
csv.write(",%s,%s,%s,%s,\n" % (enc_instr, enc_cycles, dec_instr, dec_cycles))
- else:
+ elif EnableTimingInfo:
enc_time, dec_time = GatherPerfInfo(bs, Path_TimingLog)
csv.write(",%.2f,%.2f,\n"%(enc_time,dec_time))
+ else:
+ csv.write(",,,\n")
if (EncodeMethod == 'aom'):
enc_log = GetEncLogFile(bs, log_path)
@@ -191,24 +194,27 @@
" 3: Warning, 4: Info, 5: Debug")
parser.add_argument('-p', "--EncodePreset", dest='EncodePreset', type=str,
metavar='', help="EncodePreset: 0,1,2... for aom")
+ parser.add_argument('-m', "--EncodeMethod", dest='EncodeMethod', type=str,
+ metavar='', help="EncodeMethod: aom, svt for av1")
if len(raw_args) == 1:
parser.print_help()
sys.exit(1)
args = parser.parse_args(raw_args[1:])
- global Function, SaveMemory, LogLevel, EncodePreset, LogCmdOnly
+ global Function, SaveMemory, LogLevel, EncodePreset, EncodeMethod, LogCmdOnly
Function = args.Function
SaveMemory = args.SaveMemory
LogLevel = args.LogLevel
EncodePreset = args.EncodePreset
+ EncodeMethod = args.EncodeMethod
LogCmdOnly = args.LogCmdOnly
######################################
# main
######################################
if __name__ == "__main__":
- #sys.argv = ["", "-f", "encode", "-p","1"]
- #sys.argv = ["", "-f", "summary", "-p","1"]
+ #sys.argv = ["", "-f", "encode", "-m", "aom", "-p", "6"]
+ #sys.argv = ["", "-f", "summary", "-m", "aom", "-p", "6"]
ParseArguments(sys.argv)
# preparation for executing functions
@@ -223,11 +229,11 @@
for test_cfg in TEST_CONFIGURATIONS:
clip_list = CreateClipList(test_cfg)
for clip in clip_list:
- Run_Encode_Test(test_cfg, clip, EncodePreset, LogCmdOnly)
+ Run_Encode_Test(test_cfg, clip, EncodeMethod, EncodePreset, LogCmdOnly)
elif Function == 'summary':
for test_cfg in TEST_CONFIGURATIONS:
clip_list = CreateClipList(test_cfg)
- GenerateSummaryRDDataFile('aom', 'av1', EncodePreset,
+ GenerateSummaryRDDataFile(EncodeMethod, 'av1', EncodePreset,
test_cfg, clip_list, Path_EncLog)
Utils.Logger.info("RD data summary file generated")
else:
diff --git a/tools/convexhull_framework/src/Config.py b/tools/convexhull_framework/src/Config.py
index 1c09b07..fc8afab 100644
--- a/tools/convexhull_framework/src/Config.py
+++ b/tools/convexhull_framework/src/Config.py
@@ -57,6 +57,7 @@
FFMPEG = os.path.join(BinPath, 'ffmpeg.exe')
AOMENC = os.path.join(BinPath, 'aomenc.exe')
SVTAV1 = os.path.join(BinPath, 'SvtAv1EncApp.exe')
+AV1DEC = os.path.join(BinPath, 'av1dec.exe')
AOMDEC = os.path.join(BinPath, 'aomdec.exe')
QPs = {
"LD" : [23, 31, 39, 47, 55, 63],
diff --git a/tools/convexhull_framework/src/EncDecUpscale.py b/tools/convexhull_framework/src/EncDecUpscale.py
index 600a58b..fe97ad5 100644
--- a/tools/convexhull_framework/src/EncDecUpscale.py
+++ b/tools/convexhull_framework/src/EncDecUpscale.py
@@ -52,11 +52,11 @@
enc_log, LogCmdOnly)
return bsfile
-def Decode(test_cfg, codec, bsfile, path, perf_path, decode_to_yuv, LogCmdOnly=False):
+def Decode(method, test_cfg, codec, bsfile, path, perf_path, decode_to_yuv, LogCmdOnly=False):
decodedfile = GetDecodedFile(bsfile, path, decode_to_yuv)
dec_perf = GetDecPerfFile(bsfile, perf_path)
#call VideoDecoder to do the decoding
- VideoDecode(test_cfg, codec, bsfile, decodedfile, dec_perf, decode_to_yuv, LogCmdOnly)
+ VideoDecode(method, test_cfg, codec, bsfile, decodedfile, dec_perf, decode_to_yuv, LogCmdOnly)
return decodedfile
def Run_EncDec_Upscale(method, codec, preset, clip, test_cfg, QP, num, outw,
@@ -67,7 +67,7 @@
bsFile = Encode(method, codec, preset, clip, test_cfg, QP, num, path_bs,
path_perf, path_enc_log, LogCmdOnly)
logger.info("start decode file %s" % os.path.basename(bsFile))
- decodedYUV = Decode(test_cfg, codec, bsFile, path_decoded, path_perf, False,
+ decodedYUV = Decode(method, test_cfg, codec, bsFile, path_decoded, path_perf, False,
LogCmdOnly)
logger.info("start upscale file %s" % os.path.basename(decodedYUV))
#hard code frame rate to 0 before upscaling.
diff --git a/tools/convexhull_framework/src/VideoDecoder.py b/tools/convexhull_framework/src/VideoDecoder.py
index af0dd05..f01ef5c 100644
--- a/tools/convexhull_framework/src/VideoDecoder.py
+++ b/tools/convexhull_framework/src/VideoDecoder.py
@@ -11,7 +11,7 @@
__author__ = "maggie.sun@intel.com, ryan.lei@intel.com"
import Utils
-from Config import AOMDEC, EnableTimingInfo, Platform, UsePerfUtil
+from Config import AOMDEC, AV1DEC, EnableTimingInfo, Platform, UsePerfUtil
from Utils import ExecuteCmd
def DecodeWithAOM(test_cfg, infile, outfile, dec_perf, decode_to_yuv, LogCmdOnly=False):
@@ -33,9 +33,30 @@
ExecuteCmd(cmd, LogCmdOnly)
-def VideoDecode(test_cfg, codec, infile, outfile, dec_perf, decode_to_yuv, LogCmdOnly=False):
+def DecodeWithAV1(test_cfg, infile, outfile, dec_perf, decode_to_yuv, LogCmdOnly=False):
+ if decode_to_yuv:
+ args = " --codec=av1 --summary --rawvideo -o %s %s" % (outfile, infile)
+ else:
+ args = " --codec=av1 --summary -o %s %s" % (outfile, infile)
+ cmd = AV1DEC + args
+ if EnableTimingInfo:
+ if Platform == "Windows":
+ cmd = "ptime " + cmd + " >%s" % dec_perf
+ elif Platform == "Darwin":
+ cmd = "gtime --verbose --output=%s " % dec_perf + cmd
+ else:
+ if UsePerfUtil:
+ cmd = "3>%s perf stat --log-fd 3 " % dec_perf + cmd
+ else:
+ cmd = "/usr/bin/time --verbose --output=%s " % dec_perf + cmd
+
+ ExecuteCmd(cmd, LogCmdOnly)
+
+def VideoDecode(method, test_cfg, codec, infile, outfile, dec_perf, decode_to_yuv, LogCmdOnly=False):
Utils.CmdLogger.write("::Decode\n")
- if codec == 'av1':
+ if codec == 'av1' and method == 'aom':
DecodeWithAOM(test_cfg, infile, outfile, dec_perf, decode_to_yuv, LogCmdOnly)
+ elif codec == 'av1' and method == 'svt':
+ DecodeWithAV1(test_cfg, infile, outfile, dec_perf, decode_to_yuv, LogCmdOnly)
else:
raise ValueError("invalid parameter for decode.")
diff --git a/tools/convexhull_framework/src/VideoEncoder.py b/tools/convexhull_framework/src/VideoEncoder.py
index 32d169c..b4a8b10 100644
--- a/tools/convexhull_framework/src/VideoEncoder.py
+++ b/tools/convexhull_framework/src/VideoEncoder.py
@@ -55,6 +55,11 @@
" --gf-max-pyr-height=4 --subgop-config-str=ld "
else:
print("Unsupported Test Configuration %s" % test_cfg)
+
+ if (clip.file_class == 'G1' or clip.file_class == 'G2'):
+ args += "--color-primaries=bt2020 --transfer-characteristics=smpte2084 "\
+ "--matrix-coefficients=bt2020ncl --chroma-sample-position=colocated "
+
args += " -o %s %s" % (outfile, clip.file_path)
cmd = AOMENC + args + "> %s 2>&1"%enc_log
if (EnableTimingInfo):
@@ -72,10 +77,33 @@
def EncodeWithSVT_AV1(clip, test_cfg, QP, framenum, outfile, preset, enc_perf,
enc_log, LogCmdOnly=False):
#TODO: update svt parameters
- args = " --preset %s --scm 2 --lookahead 0 --hierarchical-levels 3 -n %d" \
- " --keyint 255 -rc 0 -q %d -w %d -h %d -b %s -i %s"\
- % (str(preset), framenum, QP, clip.width, clip.height, outfile,
- clip.file_path)
+ args = " --preset %s --scm 2 --lookahead 0 -n %d " \
+ " --rc 0 -q %d -w %d -h %d --irefresh-type 2 "\
+ " --fps-num %d --fps-denom %d --input-depth %d " \
+ " --aq-mode 0 " \
+ % (str(preset), framenum, QP, clip.width, clip.height,
+ clip.fps_num, clip.fps_denom, clip.bit_depth)
+
+ # For 4K clip, encode with 2 tile columns using two threads.
+ # --tile-columns value is in log2.
+ if (clip.width >= 3840 and clip.height >= 2160):
+ args += " --tile-columns 1 "
+ else:
+ args += " --tile-columns 0 "
+
+ if test_cfg == "AI" or test_cfg == "STILL":
+ args += " --keyint 255 "
+ elif test_cfg == "RA" or test_cfg == "AS":
+ args += " --keyint 64 --hierarchical-levels 4 --pred-struct 2 "
+ elif test_cfg == "LD":
+ args += " --keyint 9999 --hierarchical-levels 4 --pred-struct 1 "
+ else:
+ print("Unsupported Test Configuration %s" % test_cfg)
+
+ if (clip.file_class == 'G1' or clip.file_class == 'G2'):
+ args += "--enable-hdr 1 "
+
+ args += "-i %s -b %s"%(clip.file_path, outfile)
cmd = SVTAV1 + args + "> %s 2>&1"%enc_log
if EnableTimingInfo:
if Platform == "Windows":