From 7db26934e4156597cb0586bb4d2e44dccdde1a59 Mon Sep 17 00:00:00 2001 From: Jan Buethe Date: Wed, 16 Oct 2024 10:51:45 +0200 Subject: [PATCH] fix for buffer size calculation in osce.c update to osce evaluation script --- dnn/osce.c | 2 +- dnn/torch/osce/stndrd/evaluation/run_osce_test.py | 11 +++++++---- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/dnn/osce.c b/dnn/osce.c index c412d5a10..e6fb5ce3b 100644 --- a/dnn/osce.c +++ b/dnn/osce.c @@ -110,7 +110,7 @@ static void lace_feature_net( int arch ) { - float input_buffer[4 * IMAX(LACE_COND_DIM, LACE_HIDDEN_FEATURE_DIM)]; + float input_buffer[IMAX(4 * IMAX(LACE_COND_DIM, LACE_HIDDEN_FEATURE_DIM), LACE_NUM_FEATURES + LACE_PITCH_EMBEDDING_DIM + 2*LACE_NUMBITS_EMBEDDING_DIM)]; float output_buffer[4 * IMAX(LACE_COND_DIM, LACE_HIDDEN_FEATURE_DIM)]; float numbits_embedded[2 * LACE_NUMBITS_EMBEDDING_DIM]; int i_subframe; diff --git a/dnn/torch/osce/stndrd/evaluation/run_osce_test.py b/dnn/torch/osce/stndrd/evaluation/run_osce_test.py index 728a209fd..59bff833e 100644 --- a/dnn/torch/osce/stndrd/evaluation/run_osce_test.py +++ b/dnn/torch/osce/stndrd/evaluation/run_osce_test.py @@ -15,6 +15,7 @@ parser.add_argument('outputdir', type=str, help='Output folder') parser.add_argument('bitrate', type=int, help='bitrate to test') parser.add_argument('--reference_opus_demo', type=str, default='./opus_demo', help='reference opus_demo binary for generating bitstreams and reference output') +parser.add_argument('--encoder_options', type=str, default="", help='encoder options (e.g. -complexity 5)') parser.add_argument('--test_opus_demo', type=str, default='./opus_demo', help='opus_demo binary under test') parser.add_argument('--test_opus_demo_options', type=str, default='-dec_complexity 7', help='options for test opus_demo (e.g. "-dec_complexity 7")') parser.add_argument('--verbose', type=int, default=0, help='verbosity level: 0 for quiet (default), 1 for reporting individual test results, 2 for reporting per-item scores in failed tests') @@ -94,7 +95,7 @@ def sox(*call_args): except: return 1 -def process_clip_factory(ref_opus_demo, test_opus_demo, test_options): +def process_clip_factory(ref_opus_demo, test_opus_demo, enc_options, test_options): def process_clip(clip_path, processdir, bitrate): # derive paths clipname = os.path.splitext(os.path.split(clip_path)[1])[0] @@ -107,7 +108,7 @@ def process_clip(clip_path, processdir, bitrate): sox(clip_path, pcm_path) # run encoder - run_opus_encoder(ref_opus_demo, pcm_path, bitstream_path, "voip", 16000, 1, bitrate) + run_opus_encoder(ref_opus_demo, pcm_path, bitstream_path, "voip", 16000, 1, bitrate, enc_options) # run decoder run_opus_decoder(ref_opus_demo, bitstream_path, ref_path, 16000, 1) @@ -121,16 +122,17 @@ def process_clip(clip_path, processdir, bitrate): return process_clip -def main(inputdir, outputdir, bitrate, reference_opus_demo, test_opus_demo, test_option_string, verbose): +def main(inputdir, outputdir, bitrate, reference_opus_demo, test_opus_demo, enc_option_string, test_option_string, verbose): # load clips list with open(os.path.join(inputdir, 'clips.yml'), "r") as f: clips = yaml.safe_load(f) # parse test options + enc_options = enc_option_string.split() test_options = test_option_string.split() - process_clip = process_clip_factory(reference_opus_demo, test_opus_demo, test_options) + process_clip = process_clip_factory(reference_opus_demo, test_opus_demo, enc_options, test_options) os.makedirs(outputdir, exist_ok=True) processdir = os.path.join(outputdir, 'process') @@ -189,5 +191,6 @@ def main(inputdir, outputdir, bitrate, reference_opus_demo, test_opus_demo, test args.bitrate, args.reference_opus_demo, args.test_opus_demo, + args.encoder_options, args.test_opus_demo_options, args.verbose)