[libav-devel] [PATCH 5/5] wmv2: cosmetics: Fix coding styles inconsistencies

Diego Biurrun diego at biurrun.de
Tue Sep 2 12:32:54 CEST 2014


On Mon, Sep 01, 2014 at 03:19:01PM -0400, Gabriel Dume wrote:
> --- a/libavcodec/wmv2.c
> +++ b/libavcodec/wmv2.c
> @@ -51,84 +52,87 @@ av_cold void ff_wmv2_common_init(Wmv2Context * w){
> -    case 1:
> -        ff_simple_idct84_add(dst           , stride, block1);
> -        ff_simple_idct84_add(dst + 4*stride, stride, w->abt_block2[n]);
> -    case 2:
> -        ff_simple_idct48_add(dst           , stride, block1);
> -        ff_simple_idct48_add(dst + 4       , stride, w->abt_block2[n]);
> +      case 1:
> +          ff_simple_idct84_add(dst             , stride, block1);
> +          ff_simple_idct84_add(dst + 4 * stride, stride, w->abt_block2[n]);
> +      case 2:
> +          ff_simple_idct48_add(dst           , stride, block1);
> +          ff_simple_idct48_add(dst + 4       , stride, w->abt_block2[n]);

Get rid of the stray spaces before comma.

> -    wmv2_add_block(w, block1[0], dest_y                    , s->linesize, 0);
> -    wmv2_add_block(w, block1[1], dest_y + 8                , s->linesize, 1);
> +    wmv2_add_block(w, block1[0], dest_y                      , s->linesize, 0);
> +    wmv2_add_block(w, block1[1], dest_y + 8                  , s->linesize, 1);

same

> -    wmv2_add_block(w, block1[4], dest_cb                   , s->uvlinesize, 4);
> -    wmv2_add_block(w, block1[5], dest_cr                   , s->uvlinesize, 5);
> +    wmv2_add_block(w, block1[4], dest_cb                     , s->uvlinesize, 4);
> +    wmv2_add_block(w, block1[5], dest_cr                     , s->uvlinesize, 5);

ditto

> --- a/libavcodec/wmv2dec.c
> +++ b/libavcodec/wmv2dec.c
> @@ -291,70 +290,72 @@ static int16_t *wmv2_pred_motion(Wmv2Context *w, int *px, int *py){
>  
> -static inline int wmv2_decode_inter_block(Wmv2Context *w, int16_t *block, int n, int cbp){
> +static inline int wmv2_decode_inter_block(Wmv2Context *w,
> +                                          int16_t *block, int n, int cbp)

If easily possible and/or if it does not interfere with logical grouping,
keep the first line of function declarations longer

> -    if(w->abt_type){
> +    if (w->abt_type) {
>  //        const uint8_t *scantable= w->abt_scantable[w->abt_type-1].permutated;

space before =

> -        const uint8_t *scantable= w->abt_scantable[w->abt_type-1].scantable;
> +        const uint8_t *scantable = w->abt_scantable[w->abt_type - 1].scantable;
>  //        const uint8_t *scantable= w->abt_type-1 ? w->abt_scantable[1].permutated : w->abt_scantable[0].scantable;

same

> -        code = get_vlc2(&s->gb, ff_mb_non_intra_vlc[w->cbp_table_index].table, MB_NON_INTRA_VLC_BITS, 3);
> +        code = get_vlc2(&s->gb,
> +                        ff_mb_non_intra_vlc[w->cbp_table_index].table, MB_NON_INTRA_VLC_BITS, 3);

       code = get_vlc2(&s->gb, ff_mb_non_intra_vlc[w->cbp_table_index].table,
                       MB_NON_INTRA_VLC_BITS, 3);

> @@ -384,33 +385,35 @@ int ff_wmv2_decode_mb(MpegEncContext *s, int16_t block[6][64])
>  
>          for (i = 0; i < 6; i++) {
>              if (wmv2_decode_inter_block(w, block[i], i, (cbp >> (5 - i)) & 1) < 0)
>              {

if (...) {

> --- a/libavcodec/wmv2enc.c
> +++ b/libavcodec/wmv2enc.c
> @@ -51,94 +52,97 @@ static int encode_ext_header(Wmv2Context *w){
>  
> -        s->inter_intra_pred= 0;//(s->width*s->height < 320*240 && s->bit_rate<=II_BITRATE);
> +        s->inter_intra_pred = 0;//(s->width*s->height < 320*240 && s->bit_rate<=II_BITRATE);

space before and after //, spaces around operators

> @@ -146,11 +150,11 @@ int ff_wmv2_encode_picture_header(MpegEncContext * s, int picture_number)
>  /* Nearly identical to wmv1 but that is just because we do not use the
>   * useless M$ crap features. It is duplicated here in case someone wants
>   * to add support for these crap features. */
> -void ff_wmv2_encode_mb(MpegEncContext * s,
> +void ff_wmv2_encode_mb(MpegEncContext *s,
>                         int16_t block[6][64],
>                         int motion_x, int motion_y)

  void ff_wmv2_encode_mb(MpegEncContext *s, int16_t block[6][64],
                         int motion_x, int motion_y)

Diego


More information about the libav-devel mailing list