Skip to content

Commit 8ad9eeb

Browse files
committed
review fixes
Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
1 parent 3615059 commit 8ad9eeb

4 files changed

Lines changed: 14 additions & 24 deletions

File tree

src/audio/stft_process/stft_process-generic.c

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,9 @@ int stft_process_source_s32(struct stft_comp_data *cd, struct sof_source *source
6464
}
6565

6666
/* One of the buffers needs a wrap (or end of data), so check for wrap */
67-
x = (x >= x_end) ? x - x_size : x;
6867
w = stft_process_buffer_wrap(ibuf, w);
68+
if (x >= x_end)
69+
x -= x_size;
6970

7071
/* Update processed samples count for next loop iteration. */
7172
frames_left -= n;
@@ -131,8 +132,9 @@ int stft_process_sink_s32(struct stft_comp_data *cd, struct sof_sink *sink, int
131132
}
132133

133134
/* One of the buffers needs a wrap (or end of data), so check for wrap */
134-
y = (y >= y_end) ? y - y_size : y;
135135
r = stft_process_buffer_wrap(obuf, r);
136+
if (y >= y_end)
137+
y -= y_size;
136138

137139
/* Update processed samples count for next loop iteration. */
138140
frames_remain -= n;
@@ -206,8 +208,9 @@ int stft_process_source_s16(struct stft_comp_data *cd, struct sof_source *source
206208
}
207209

208210
/* One of the buffers needs a wrap (or end of data), so check for wrap */
209-
x = (x >= x_end) ? x - x_size : x;
210211
w = stft_process_buffer_wrap(ibuf, w);
212+
if (x >= x_end)
213+
x -= x_size;
211214

212215
/* Update processed samples count for next loop iteration. */
213216
frames_left -= n;
@@ -273,8 +276,9 @@ int stft_process_sink_s16(struct stft_comp_data *cd, struct sof_sink *sink, int
273276
}
274277

275278
/* One of the buffers needs a wrap (or end of data), so check for wrap */
276-
y = (y >= y_end) ? y - y_size : y;
277279
r = stft_process_buffer_wrap(obuf, r);
280+
if (y >= y_end)
281+
y -= y_size;
278282

279283
/* Update processed samples count for next loop iteration. */
280284
frames_remain -= n;

src/audio/stft_process/stft_process.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,8 @@ __cold static int stft_process_init(struct processing_module *mod)
4444
struct comp_dev *dev = mod->dev;
4545
struct stft_comp_data *cd;
4646

47+
assert_can_be_cold();
48+
4749
comp_info(dev, "stft_process_init()");
4850

4951
cd = mod_alloc(mod, sizeof(*cd));

src/audio/stft_process/stft_process_common.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,8 @@ static int stft_process_output_zeros_s32(struct stft_comp_data *cd, struct sof_s
174174
y += samples_without_wrap;
175175

176176
/* Check for wrap */
177-
y = (y >= y_end) ? y - y_size : y;
177+
if (y >= y_end)
178+
y -= y_size;
178179

179180
/* Update processed samples count for next loop iteration. */
180181
samples -= samples_without_wrap;
@@ -234,7 +235,8 @@ static int stft_process_output_zeros_s16(struct stft_comp_data *cd, struct sof_s
234235
y += samples_without_wrap;
235236

236237
/* Check for wrap */
237-
y = (y >= y_end) ? y - y_size : y;
238+
if (y >= y_end)
239+
y -= y_size;
238240

239241
/* Update processed samples count for next loop iteration. */
240242
samples -= samples_without_wrap;

src/audio/stft_process/stft_process_setup.c

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -195,24 +195,6 @@ int stft_process_setup(struct processing_module *mod, int max_frames,
195195

196196
state->gain_comp = config->window_gain_comp;
197197

198-
/* Scratch overlay during runtime
199-
*
200-
* +--------------------------------------------------------+
201-
* | 1. fft_buf[], 16 bits,size x 4, e.g. 512 -> 2048 bytes |
202-
* +-------------------------------------+------------------+
203-
* | 3. power_spectra[], |
204-
* | 32 bits, e.g. x257 -> 1028 bytes |
205-
* +-------------------------------------+
206-
*
207-
* +---------------------------------------------------------------------------------+
208-
* | 2. fft_out[], 16 bits,size x 4, e.g. 512 -> 2048 bytes |
209-
* +----------------------------------+----------------------------------+-----------+
210-
* | 4. mel_spectra[], | 5. cepstral_coef[], |
211-
* | 16 bits, e.g. x23 -> 46 bytes | 16 bits, e.g. 13x -> 26 bytes |
212-
* +----------------------------------+----------------------------------+
213-
*
214-
*/
215-
216198
/* Use FFT buffer as scratch for later computed data */
217199
state->power_spectra = (int32_t *)&fft->fft_buf[0];
218200

0 commit comments

Comments
 (0)