Skip to content

Commit

Permalink
fix for buffer size calculation in osce.c
Browse files Browse the repository at this point in the history
update to osce evaluation script
  • Loading branch information
TheGrumpySnail01 committed Oct 16, 2024
1 parent ff6dea5 commit 7db2693
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
2 changes: 1 addition & 1 deletion dnn/osce.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
11 changes: 7 additions & 4 deletions dnn/torch/osce/stndrd/evaluation/run_osce_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down Expand Up @@ -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]
Expand All @@ -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)
Expand All @@ -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')
Expand Down Expand Up @@ -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)

0 comments on commit 7db2693

Please sign in to comment.