[FFmpeg-soc] [PATCH 9/9] cosmetics: pretty printing

Ronald S. Bultje rsbultje at gmail.com
Mon Nov 15 17:11:45 CET 2010


Hi,

On Sun, Nov 14, 2010 at 8:43 PM, Justin Ruggles
<justin.ruggles at gmail.com> wrote:
> ---
>  libavcodec/ac3enc.c |  323 +++++++++++++++++++++++---------------------------
>  1 files changed, 149 insertions(+), 174 deletions(-)

(I'm only going to respond to those patches where I have anything to
add to, you're maintainer so feel free to commit after a standard 2-3
days of no comments or so.)

> @@ -110,7 +110,7 @@ static av_cold void fft_init(int ln)
>
>      n = 1 << ln;
>
> -    for(i=0;i<(n/2);i++) {
> +    for (i = 0; i < (n/2); i++) {

() unneeded.

> @@ -169,8 +169,8 @@ static void fft(IComplex *z, int ln)
>
>      /* pass 0 */
>
> -    p=&z[0];
> -    j=(np >> 1);
> +    p = &z[0];
> +    j = (np >> 1);

Same.

> @@ -227,13 +227,13 @@ static void mdct512(int32_t *out, int16_t *in)
>      IComplex x[MDCT_SAMPLES/4];
>
>      /* shift to simplify computations */
> -    for(i=0;i<MDCT_SAMPLES/4;i++)
> +    for (i = 0; i < MDCT_SAMPLES/4; i++)
>          rot[i] = -in[i + 3*MDCT_SAMPLES/4];
> -    for(i=MDCT_SAMPLES/4;i<MDCT_SAMPLES;i++)
> -        rot[i] = in[i - MDCT_SAMPLES/4];
> +    for (i = MDCT_SAMPLES/4; i < MDCT_SAMPLES; i++)
> +        rot[i] =  in[i -   MDCT_SAMPLES/4];

Initialization here is unneeded (i = MDCT_SAMPLES/4).

> @@ -361,16 +359,16 @@ static int encode_exp(uint8_t encoded_exp[AC3_MAX_COEFS],
>
>      /* Decrease the delta between each groups to within 2
>       * so that they can be differentially encoded */
> -    for (i=1;i<=nb_groups;i++)
> +    for (i = 1; i <= nb_groups; i++)
>          exp1[i] = FFMIN(exp1[i], exp1[i-1] + 2);
> -    for (i=nb_groups-1;i>=0;i--)
> +    for (i = nb_groups-1; i >= 0; i--)
>          exp1[i] = FFMIN(exp1[i], exp1[i+1] + 2);

while (--i >= 0) ...

(Note: I wonder if gcc is smart enough to figure this out on its own,
feel free to test and if gcc is smart, then ignore me.)

Ronald


More information about the FFmpeg-soc mailing list