Description
In src/ee_audiomark.c, the main loop simulates acoustic feedback by adding the downlink audio (speaker output) to the microphone capture buffers. This is done using simple addition on int16_t values.
left_capture[i] = left_capture[i] + audio_input[i];
right_capture[i] = right_capture[i] + audio_input[i];
In C, signed integer overflow is undefined behavior. In most environments, this wraps around (e.g., 20000 + 20000 becomes -25536). This behavior is acoustically incorrect: real microphones clip (saturate) when sound pressure exceeds their limit, they do not wrap around phase-inverting the signal.
Location
src/ee_audiomark.c
:
ee_audiomark_run
function (lines 223-224).
Impact
Undefined Behavior: Violates the C standard.
Benchmark Validity: Wrapping introduces severe non-linear distortion. The Acoustic Echo Canceller (AEC) relies on a linear model of the echo path (Speaker -> Room -> Mic). If the echo simulation wraps, it invalidates this linear relationship, potentially causing the AEC to fail or converge poorly, causing the benchmark to report incorrect scores or fail quality checks.
Suggested Fix Use saturating arithmetic to simulate microphone clipping.
int32_t sum = left_capture[i] + audio_input[i];
if (sum > 32767) sum = 32767;
if (sum < -32768) sum = -32768;
left_capture[i] = (int16_t)sum;
Description
In
src/ee_audiomark.c, the main loop simulates acoustic feedback by adding the downlink audio (speaker output) to the microphone capture buffers. This is done using simple addition onint16_tvalues.In C, signed integer overflow is undefined behavior. In most environments, this wraps around (e.g., 20000 + 20000 becomes -25536). This behavior is acoustically incorrect: real microphones clip (saturate) when sound pressure exceeds their limit, they do not wrap around phase-inverting the signal.
Location
src/ee_audiomark.c
:
ee_audiomark_run
function (lines 223-224).
Impact
Undefined Behavior: Violates the C standard.
Benchmark Validity: Wrapping introduces severe non-linear distortion. The Acoustic Echo Canceller (AEC) relies on a linear model of the echo path (Speaker -> Room -> Mic). If the echo simulation wraps, it invalidates this linear relationship, potentially causing the AEC to fail or converge poorly, causing the benchmark to report incorrect scores or fail quality checks.
Suggested Fix Use saturating arithmetic to simulate microphone clipping.