Skip to content

Commit 295d0c1

Browse files
authored
Merge pull request #81 from tlauda/topic/volume_processing
volume: fix processing size in HiFi3 implementation
2 parents f9c597e + b56e6ac commit 295d0c1

1 file changed

Lines changed: 5 additions & 10 deletions

File tree

src/audio/volume_hifi3.c

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,6 @@ static void vol_s16_to_s16(struct comp_dev *dev, struct comp_buffer *sink,
6060
ae_f16x4 in_sample = AE_ZERO16();
6161
size_t channel;
6262
int i;
63-
int limit = source->size / (dev->params.channels << 1);
6463
ae_int16 *in = (ae_int16 *)source->r_ptr;
6564
ae_int16 *out = (ae_int16 *)sink->w_ptr;
6665

@@ -69,7 +68,7 @@ static void vol_s16_to_s16(struct comp_dev *dev, struct comp_buffer *sink,
6968
vol_scaled[channel] = cd->volume[channel] * VOL_SCALE;
7069

7170
/* Main processing loop */
72-
for (i = 0; i < limit; i++) {
71+
for (i = 0; i < dev->frames; i++) {
7372
/* Processing per channel */
7473
for (channel = 0; channel < dev->params.channels; channel++) {
7574
/* Load the input sample */
@@ -109,7 +108,6 @@ static void vol_s16_to_sX(struct comp_dev *dev, struct comp_buffer *sink,
109108
size_t channel;
110109
uint8_t shift_left = 0;
111110
int i;
112-
int limit = source->size / (dev->params.channels << 1);
113111
ae_int16 *in = (ae_int16 *)source->r_ptr;
114112
ae_int32 *out = (ae_int32 *)sink->w_ptr;
115113

@@ -124,7 +122,7 @@ static void vol_s16_to_sX(struct comp_dev *dev, struct comp_buffer *sink,
124122
vol_scaled[channel] = cd->volume[channel] * VOL_SCALE;
125123

126124
/* Main processing loop */
127-
for (i = 0; i < limit; i++) {
125+
for (i = 0; i < dev->frames; i++) {
128126
/* Processing per channel */
129127
for (channel = 0; channel < dev->params.channels; channel++) {
130128
/* Load the input sample */
@@ -166,7 +164,6 @@ static void vol_sX_to_s16(struct comp_dev *dev, struct comp_buffer *sink,
166164
size_t channel;
167165
uint8_t shift_left = 0;
168166
int i;
169-
int limit = source->size / (dev->params.channels << 2);
170167
ae_int32 *in = (ae_int32 *)source->r_ptr;
171168
ae_int16 *out = (ae_int16 *)sink->w_ptr;
172169

@@ -179,7 +176,7 @@ static void vol_sX_to_s16(struct comp_dev *dev, struct comp_buffer *sink,
179176
vol_scaled[channel] = cd->volume[channel] * VOL_SCALE;
180177

181178
/* Main processing loop */
182-
for (i = 0; i < limit; i++) {
179+
for (i = 0; i < dev->frames; i++) {
183180
/* Processing per channel */
184181
for (channel = 0; channel < dev->params.channels; channel++) {
185182
/* Load the input sample */
@@ -222,7 +219,6 @@ static void vol_s24_to_s24_s32(struct comp_dev *dev, struct comp_buffer *sink,
222219
size_t channel;
223220
uint8_t shift_left = 0;
224221
int i;
225-
int limit = source->size / (dev->params.channels << 2);
226222
ae_int32 *in = (ae_int32 *)source->r_ptr;
227223
ae_int32 *out = (ae_int32 *)sink->w_ptr;
228224

@@ -235,7 +231,7 @@ static void vol_s24_to_s24_s32(struct comp_dev *dev, struct comp_buffer *sink,
235231
vol_scaled[channel] = cd->volume[channel] * VOL_SCALE;
236232

237233
/* Main processing loop */
238-
for (i = 0; i < limit; i++) {
234+
for (i = 0; i < dev->frames; i++) {
239235
/* Processing per channel */
240236
for (channel = 0; channel < dev->params.channels; channel++) {
241237
/* Load the input sample */
@@ -277,7 +273,6 @@ static void vol_s32_to_s24_s32(struct comp_dev *dev, struct comp_buffer *sink,
277273
size_t channel;
278274
uint8_t shift_right = 0;
279275
int i;
280-
int limit = source->size / (dev->params.channels << 2);
281276
ae_int32 *in = (ae_int32 *)source->r_ptr;
282277
ae_int32 *out = (ae_int32 *)sink->w_ptr;
283278

@@ -290,7 +285,7 @@ static void vol_s32_to_s24_s32(struct comp_dev *dev, struct comp_buffer *sink,
290285
vol_scaled[channel] = cd->volume[channel] * VOL_SCALE;
291286

292287
/* Main processing loop */
293-
for (i = 0; i < limit; i++) {
288+
for (i = 0; i < dev->frames; i++) {
294289
/* Processing per channel */
295290
for (channel = 0; channel < dev->params.channels; channel++) {
296291
/* Load the input sample */

0 commit comments

Comments
 (0)