diff options
Diffstat (limited to 'apps')
-rw-r--r-- | apps/dsp.c | 23 |
1 files changed, 10 insertions, 13 deletions
diff --git a/apps/dsp.c b/apps/dsp.c index fad5f4d496..5aa93ccc7c 100644 --- a/apps/dsp.c +++ b/apps/dsp.c | |||
@@ -1934,21 +1934,18 @@ static int limiter_process(int count, int32_t *buf[]) | |||
1934 | } | 1934 | } |
1935 | /* Implement the limiter: adjust gain of the outbound samples by the gain | 1935 | /* Implement the limiter: adjust gain of the outbound samples by the gain |
1936 | * amounts in the gain steps array corresponding to the peak values. */ | 1936 | * amounts in the gain steps array corresponding to the peak values. */ |
1937 | for (ch = 0; ch < AUDIO_DSP.data.num_channels; ch++) | 1937 | for (i = 0; i < count; i++) |
1938 | { | 1938 | { |
1939 | int32_t *d = buf[ch]; | 1939 | if (out_buf_peak[i] > 0) |
1940 | for (i = 0; i < count; i++) | ||
1941 | { | 1940 | { |
1942 | if (out_buf_peak[i] > 0) | 1941 | gain_peak = (out_buf_peak[i] + 1) / 90; |
1943 | { | 1942 | gain_rem = (out_buf_peak[i] + 1) % 90; |
1944 | gain_peak = (out_buf_peak[i] + 1) / 90; | 1943 | gain = gain_steps[gain_peak]; |
1945 | gain_rem = (out_buf_peak[i] + 1) % 90; | 1944 | if ((gain_peak < 48) && (gain_rem > 0)) |
1946 | gain = gain_steps[gain_peak]; | 1945 | gain -= gain_rem * ((gain_steps[gain_peak] - |
1947 | if ((gain_peak < 48) && (gain_rem > 0)) | 1946 | gain_steps[gain_peak + 1]) / 90); |
1948 | gain -= gain_rem * ((gain_steps[gain_peak] - | 1947 | for (ch = 0; ch < AUDIO_DSP.data.num_channels; ch++) |
1949 | gain_steps[gain_peak + 1]) / 90); | 1948 | buf[ch][i] = FRACMUL_SHL(buf[ch][i], gain, 3); |
1950 | d[i] = FRACMUL_SHL(d[i], gain, 3); | ||
1951 | } | ||
1952 | } | 1949 | } |
1953 | } | 1950 | } |
1954 | return count; | 1951 | return count; |