From 1a4acc9d1eebd8e3dba9045a5047a4229567453e Mon Sep 17 00:00:00 2001 From: Michael Sevakis Date: Sat, 4 May 2013 14:23:21 -0400 Subject: Fix missed optimization opportunity in dsp_process. Input type can only change once per call because the DSP parameters are only copied at the start and input is always taken from the src buffer which means sample input format switching can be once per call instead of once per loop. Change-Id: Ifa3521753428fb0e6997e4934f24a3b915628cc7 --- lib/rbcodec/dsp/dsp_core.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/rbcodec/dsp/dsp_core.c b/lib/rbcodec/dsp/dsp_core.c index c54bda17a9..5e365eb08d 100644 --- a/lib/rbcodec/dsp/dsp_core.c +++ b/lib/rbcodec/dsp/dsp_core.c @@ -414,15 +414,15 @@ void dsp_process(struct dsp_config *dsp, struct dsp_buffer *src, /* Tag input with codec-specified sample format */ src->format = dsp->io_data.format; + if (src->format.version != dsp->io_data.sample_buf.format.version) + dsp_sample_input_format_change(&dsp->io_data, &src->format); + while (1) { /* Out-of-place-processing stages take the current buf as input * and switch the buffer to their own output buffer */ struct dsp_buffer *buf = src; - if (UNLIKELY(buf->format.version != dsp->io_data.sample_buf.format.version)) - dsp_sample_input_format_change(&dsp->io_data, &buf->format); - /* Convert input samples to internal format */ dsp->io_data.input_samples(&dsp->io_data, &buf); -- cgit v1.2.3