[FFmpeg-devel] [PATCH] K&R style format of submitted code in g729* files (cosmetics)

Diego Biurrun diego
Fri Jun 5 12:17:49 CEST 2009


On Fri, Jun 05, 2009 at 04:51:24PM +0700, Vladimir Voroshilov wrote:
> 2009/6/5 Diego Biurrun <diego at biurrun.de>:
> > On Fri, Jun 05, 2009 at 02:11:21PM +0700, Vladimir Voroshilov wrote:
> >>
> >> Here is reformatting patch for g729dec.c and g729data.h
> >
> > OK, but note that this does not make g729dec.c comply with K&R
> > completely.
> 
> Spaces after "if", "switch", structures, etc and braces at the same line.
> No spaces after routine name before parenthesis.
> Spaces around operators.
> 
> What did i miss ? I'll try to fix it in other patches too.

  }
  else
  {

-->

  } else {

Your function calls still look quite idiosyncratic.  You could change

  ff_acelp_weighted_vector_sum(
          fc + pitch_delay_int[i],
          fc + pitch_delay_int[i],
          fc,
          1 << 14,
          av_clip(ctx->gain_pitch, SHARP_MIN, SHARP_MAX),
          0,
          14,
          ctx->subframe_size - pitch_delay_int[i]);

to something like

  ff_acelp_weighted_vector_sum(fc + pitch_delay_int[i],
                               fc + pitch_delay_int[i],
                               fc, 1 << 14,
                               av_clip(ctx->gain_pitch, SHARP_MIN, SHARP_MAX),
                               0, 14,
                               ctx->subframe_size - pitch_delay_int[i]);

or similar, depending on where you wish to break the lines.

Also, you could align things like

  ctx->gain_pitch = (29491 * ctx->gain_pitch) >> 15; // 0.9 (0.15)
  ctx->gain_code  = (2007 * ctx->gain_code) >> 11;   // 0.98 in (0.11)

to

  ctx->gain_pitch = (29491 * ctx->gain_pitch) >> 15; // 0.9 (0.15)
  ctx->gain_code  = ( 2007 * ctx->gain_code)  >> 11; // 0.98 in (0.11)

in order to improve readability.

Diego



More information about the ffmpeg-devel mailing list