On Thu, Sep 04, 2014 at 06:22:15PM -0400, Gabriel Dume wrote:
> --- a/libavcodec/dv.c
> +++ b/libavcodec/dv.c
> @@ -51,113 +51,119 @@
>  
> -                  if (x<90) {
> +                  if (x < 90)
>                        y = 0;
> -                  } else {
> -                      x = (x - 90)*2;
> +                  else {
> +                      x = (x - 90) * 2;
>                        y = 67;
>                    }

Maybe keep the {} for the if, the else has {} anyway.

> -                  x = shuf1[m] + (chan&1)*9 + k%9;
> -                  y = (i*3+k/9)*2 + (chan>>1) + 1;
> +                  x = shuf1[m] + (chan&1) * 9 + k % 9;
> +                  y = (i * 3 + k / 9) * 2 + (chan >> 1) + 1;

spaces around &

> -              tbl[m] = (x<<1)|(y<<9);
> +              tbl[m] = (x << 1)|(y << 9);

spaces around |

> --- a/libavcodec/dv.h
> +++ b/libavcodec/dv.h
> @@ -103,23 +103,24 @@ int ff_dvvideo_init(AVCodecContext *avctx);
>  
>       /* We work with 720p frames split in half. The odd half-frame 
> (chan==2,3) is displaced :-( */
> -     if (s->sys->height == 720 && !(s->buf[1]&0x0C)) {
> -         *mb_y -= (*mb_y>17)?18:-72; /* shifting the Y coordinate down by 
> 72/2 macro blocks */
> -     }
> +     if (s->sys->height == 720 && !(s->buf[1] & 0x0C))
> +         *mb_y -= (*mb_y > 17) ? 18 : -72; /* shifting the Y coordinate down 
> by 72/2 macro blocks */

I'd move the comment above the code.

> --- a/libavcodec/dv_tablegen.h
> +++ b/libavcodec/dv_tablegen.h
> @@ -28,8 +28,8 @@
>  
>  #if CONFIG_SMALL
> -#define DV_VLC_MAP_RUN_SIZE 15
> -#define DV_VLC_MAP_LEV_SIZE 23
> +#define DV_VLC_MAP_RUN_SIZE  15
> +#define DV_VLC_MAP_LEV_SIZE  23
>  #else
>  #define DV_VLC_MAP_RUN_SIZE  64
>  #define DV_VLC_MAP_LEV_SIZE 512 //FIXME sign was removed so this should be 
> /2 but needs check

space after //

> --- a/libavcodec/dvdec.c
> +++ b/libavcodec/dvdec.c
> @@ -199,13 +199,13 @@ static int dv_decode_video_segment(AVCodecContext 
> *avctx, void *arg)
>              } else {
>                  mb->idct_put     = s->idct_put[dct_mode && log2_blocksize == 
> 3];
>                  mb->scan_table   = s->dv_zigzag[dct_mode];
> -                mb->factor_table = &s->idct_factor[(class1 == 3)*2*22*64 + 
> dct_mode*22*64 +
> -                                                        (quant + 
> ff_dv_quant_offset[class1])*64];
> +                mb->factor_table = &s->idct_factor[(class1 == 3) * 2 * 22 * 
> 64 + dct_mode * 22 * 64 +
> +                                                        (quant + 
> ff_dv_quant_offset[class1]) * 64];

Indentation is off.

> --- a/libavcodec/dvenc.c
> +++ b/libavcodec/dvenc.c
> @@ -114,19 +114,17 @@ static av_always_inline int dv_rl2vlc_size(int run, int 
> level)
>  
> -    if (run < DV_VLC_MAP_RUN_SIZE && level < DV_VLC_MAP_LEV_SIZE) {
> +    if (run < DV_VLC_MAP_RUN_SIZE && level < DV_VLC_MAP_LEV_SIZE)
>          size = dv_vlc_map[run][level].size;
> -    }
>      else {

I suggest keeping the {} but moving the else to the same line as }.

> @@ -208,32 +208,33 @@ static av_always_inline int 
> dv_guess_dct_mode(DVVideoContext *s, uint8_t *data,
>  
> -static const int dv_weight_bits = 18;
> +static const int dv_weight_bits   = 18;
>  static const int dv_weight_88[64] = {

dv_weight_bits is not a table, maybe skip the alignment.

> -static av_always_inline int dv_init_enc_block(EncBlockInfo* bi, uint8_t 
> *data, int linesize, DVVideoContext *s, int bias)
> +static av_always_inline int dv_init_enc_block(EncBlockInfo *bi, uint8_t 
> *data,
> +                                              int linesize, DVVideoContext 
> *s, int bias)

long line

> @@ -249,17 +250,20 @@ static av_always_inline int 
> dv_init_enc_block(EncBlockInfo* bi, uint8_t *data, i
> -    bi->area_q[0] = bi->area_q[1] = bi->area_q[2] = bi->area_q[3] = 0;
> -    bi->partial_bit_count = 0;
> +    bi->area_q[0] =
> +    bi->area_q[1] =
> +    bi->area_q[2] =
> +    bi->area_q[3]          = 0;
> +    bi->partial_bit_count  = 0;
>      bi->partial_bit_buffer = 0;
> -    bi->cur_ac = 0;
> +    bi->cur_ac             = 0;

Align the =.

> @@ -267,13 +271,13 @@ static av_always_inline int 
> dv_init_enc_block(EncBlockInfo* bi, uint8_t *data, i
>      } else {
>          /* We rely on the fact that encoding all zeros leads to an immediate 
> EOB,
>             which is precisely what the spec calls for in the "dummy" blocks. 
> */

Add * to the front of all comment lines, i.e.

/* This is a comment that
 * spans multiple lines. */

> @@ -345,27 +353,27 @@ static inline void dv_guess_qnos(EncBlockInfo* blks, 
> int* qnos)
>                      prev = b->prev[a];
> -                    assert(b->next[prev] >= mb_area_start[a+1] || 
> b->mb[prev]);
> -                    for (k = b->next[prev] ; k < mb_area_start[a+1]; k = 
> b->next[k]) {
> +                    assert(b->next[prev] >= mb_area_start[a + 1] || 
> b->mb[prev]);
> +                    for (k = b->next[prev] ; k < mb_area_start[a + 1]; k = 
> b->next[k]) {

Drop the space before ;.

> @@ -545,60 +558,60 @@ static inline int dv_write_pack(enum dv_pack_type 
> pack_id, DVVideoContext *c,
>       *   2. It is not at all clear what STYPE is used for 4:2:0 PAL
>       *      compression scheme (if any).
>       */
> -    int apt   = (c->sys->pix_fmt == AV_PIX_FMT_YUV420P ? 0 : 1);
> +    int apt        = (c->sys->pix_fmt == AV_PIX_FMT_YUV420P ? 0 : 1);
>  
>      uint8_t aspect = 0;

This is excessive alignment, the assignments are not related in any way.

>      default:
> -          buf[1] = buf[2] = buf[3] = buf[4] = 0xff;
> +        buf[1] = buf[2] = buf[3] = buf[4] = 0xff;

I'd break those lines.

Diego
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to