wmadec: Remove two pointless variables.
authorAndre Noll <maan@tuebingen.mpg.de>
Thu, 8 Dec 2016 23:22:57 +0000 (00:22 +0100)
committerAndre Noll <maan@tuebingen.mpg.de>
Sun, 11 Dec 2016 12:13:33 +0000 (13:13 +0100)
The local variables n and incr of wma_decode_frame() shadow the
values of their counterparts in struct private_wmadec_data, and they
remain constant within the function. Referring directly to the private
structure instead makes the code shorter and improves readability.

wmadec_filter.c

index cb3660571a5c5cd27cbaab4bd7d3a9f20d82ae28..31a13c5094a239fca2ebd519553821933b838ba7 100644 (file)
@@ -1028,7 +1028,7 @@ static inline int16_t av_clip_int16(int a)
 /* Decode a frame of frame_len samples. */
 static int wma_decode_frame(struct private_wmadec_data *pwd, int16_t *samples)
 {
 /* Decode a frame of frame_len samples. */
 static int wma_decode_frame(struct private_wmadec_data *pwd, int16_t *samples)
 {
-       int ret, i, n, ch, incr;
+       int ret, i, ch;
        int16_t *ptr;
        float *iptr;
 
        int16_t *ptr;
        float *iptr;
 
@@ -1043,15 +1043,13 @@ static int wma_decode_frame(struct private_wmadec_data *pwd, int16_t *samples)
        }
 
        /* convert frame to integer */
        }
 
        /* convert frame to integer */
-       n = pwd->frame_len;
-       incr = pwd->ahi.channels;
        for (ch = 0; ch < pwd->ahi.channels; ch++) {
                ptr = samples + ch;
                iptr = pwd->frame_out[ch];
 
        for (ch = 0; ch < pwd->ahi.channels; ch++) {
                ptr = samples + ch;
                iptr = pwd->frame_out[ch];
 
-               for (i = 0; i < n; i++) {
+               for (i = 0; i < pwd->frame_len; i++) {
                        *ptr = av_clip_int16(lrintf(*iptr++));
                        *ptr = av_clip_int16(lrintf(*iptr++));
-                       ptr += incr;
+                       ptr += pwd->ahi.channels;
                }
                /* prepare for next block */
                memmove(&pwd->frame_out[ch][0], &pwd->frame_out[ch][pwd->frame_len],
                }
                /* prepare for next block */
                memmove(&pwd->frame_out[ch][0], &pwd->frame_out[ch][pwd->frame_len],