On Mon, Oct 28, 2013 at 06:31:09PM +0100, Vittorio Giovara wrote:
> --- a/libavcodec/mpeg4videodec.c
> +++ b/libavcodec/mpeg4videodec.c
> @@ -52,102 +51,98 @@ static const int mb_type_b_map[4]= {
>   * @param n block index (0-3 are luma, 4-5 are chroma)
>   * @param dir the ac prediction direction
>   */
> -void ff_mpeg4_pred_ac(MpegEncContext * s, int16_t *block, int n,
> +void ff_mpeg4_pred_ac(MpegEncContext *s, int16_t *block, int n,
>                        int dir)

You could coalesce these lines again.

> -    if(s->workaround_bugs&FF_BUG_NO_PADDING){
> +    if (s->workaround_bugs & FF_BUG_NO_PADDING) {
>          return 0;
>      }

Drop {}.

> @@ -157,193 +152,193 @@ static inline int mpeg4_is_resync(MpegEncContext *s){
>  
> -        length= get_vlc2(gb, sprite_trajectory.table, SPRITE_TRAJ_VLC_BITS, 
> 3);
> -        if(length){
> -            x= get_xbits(gb, length);
> +        length = get_vlc2(gb, sprite_trajectory.table, SPRITE_TRAJ_VLC_BITS, 
> 3);
> +        if (length) {
> +            x = get_xbits(gb, length);
>          }

Here as well..

> -        length= get_vlc2(gb, sprite_trajectory.table, SPRITE_TRAJ_VLC_BITS, 
> 3);
> -        if(length){
> -            y=get_xbits(gb, length);
> +        length = get_vlc2(gb, sprite_trajectory.table, SPRITE_TRAJ_VLC_BITS, 
> 3);
> +        if (length) {
> +            y = get_xbits(gb, length);
>          }

.. and here ..

>  /*    sprite_ref[3][0]= (a>>1)*(2*vop_ref[3][0] + d[0][0] + d[1][0] + 
> d[2][0] + d[3][0]);
> -    sprite_ref[3][1]= (a>>1)*(2*vop_ref[3][1] + d[0][1] + d[1][1] + d[2][1] 
> + d[3][1]); */
> + *  sprite_ref[3][1]= (a>>1)*(2*vop_ref[3][1] + d[0][1] + d[1][1] + d[2][1] 
> + d[3][1]); */

Fix this up manually please.

> -    virtual_ref[0][0]= 16*(vop_ref[0][0] + w2)
> -        + ROUNDED_DIV(((w - w2)*(r*sprite_ref[0][0] - 16*vop_ref[0][0]) + 
> w2*(r*sprite_ref[1][0] - 16*vop_ref[1][0])),w);
> -    virtual_ref[0][1]= 16*vop_ref[0][1]
> -        + ROUNDED_DIV(((w - w2)*(r*sprite_ref[0][1] - 16*vop_ref[0][1]) + 
> w2*(r*sprite_ref[1][1] - 16*vop_ref[1][1])),w);
> -    virtual_ref[1][0]= 16*vop_ref[0][0]
> -        + ROUNDED_DIV(((h - h2)*(r*sprite_ref[0][0] - 16*vop_ref[0][0]) + 
> h2*(r*sprite_ref[2][0] - 16*vop_ref[2][0])),h);
> -    virtual_ref[1][1]= 16*(vop_ref[0][1] + h2)
> -        + ROUNDED_DIV(((h - h2)*(r*sprite_ref[0][1] - 16*vop_ref[0][1]) + 
> h2*(r*sprite_ref[2][1] - 16*vop_ref[2][1])),h);
> -
> -        case 2:
> -            s->sprite_offset[0][0]= (sprite_ref[0][0]<<(alpha+rho))
> -                                                  + (-r*sprite_ref[0][0] + 
> virtual_ref[0][0])*(-vop_ref[0][0])
> -                                                  + ( r*sprite_ref[0][1] - 
> virtual_ref[0][1])*(-vop_ref[0][1])
> -                                                  + (1<<(alpha+rho-1));
> -            s->sprite_offset[0][1]= (sprite_ref[0][1]<<(alpha+rho))
> -                                                  + (-r*sprite_ref[0][1] + 
> virtual_ref[0][1])*(-vop_ref[0][0])
> -                                                  + (-r*sprite_ref[0][0] + 
> virtual_ref[0][0])*(-vop_ref[0][1])
> -                                                  + (1<<(alpha+rho-1));
> -            s->sprite_offset[1][0]= ( (-r*sprite_ref[0][0] + 
> virtual_ref[0][0])*(-2*vop_ref[0][0] + 1)
> -                                     +( r*sprite_ref[0][1] - 
> virtual_ref[0][1])*(-2*vop_ref[0][1] + 1)
> -                                     +2*w2*r*sprite_ref[0][0]
> -                                     - 16*w2
> -                                     + (1<<(alpha+rho+1)));
> -            s->sprite_offset[1][1]= ( (-r*sprite_ref[0][1] + 
> virtual_ref[0][1])*(-2*vop_ref[0][0] + 1)
> -                                     +(-r*sprite_ref[0][0] + 
> virtual_ref[0][0])*(-2*vop_ref[0][1] + 1)
> -                                     +2*w2*r*sprite_ref[0][1]
> -                                     - 16*w2
> -                                     + (1<<(alpha+rho+1)));
> -        case 3:
> -            min_ab= FFMIN(alpha, beta);
> -            w3= w2>>min_ab;
> -            h3= h2>>min_ab;
> -            s->sprite_offset[0][0]=  
> (sprite_ref[0][0]<<(alpha+beta+rho-min_ab))
> -                                   + (-r*sprite_ref[0][0] + 
> virtual_ref[0][0])*h3*(-vop_ref[0][0])
> -                                   + (-r*sprite_ref[0][0] + 
> virtual_ref[1][0])*w3*(-vop_ref[0][1])
> -                                   + (1<<(alpha+beta+rho-min_ab-1));
> -            s->sprite_offset[0][1]=  
> (sprite_ref[0][1]<<(alpha+beta+rho-min_ab))
> -                                   + (-r*sprite_ref[0][1] + 
> virtual_ref[0][1])*h3*(-vop_ref[0][0])
> -                                   + (-r*sprite_ref[0][1] + 
> virtual_ref[1][1])*w3*(-vop_ref[0][1])
> -                                   + (1<<(alpha+beta+rho-min_ab-1));
> -            s->sprite_offset[1][0]=  (-r*sprite_ref[0][0] + 
> virtual_ref[0][0])*h3*(-2*vop_ref[0][0] + 1)
> -                                   + (-r*sprite_ref[0][0] + 
> virtual_ref[1][0])*w3*(-2*vop_ref[0][1] + 1)
> -                                   + 2*w2*h3*r*sprite_ref[0][0]
> -                                   - 16*w2*h3
> -                                   + (1<<(alpha+beta+rho-min_ab+1));
> -            s->sprite_offset[1][1]=  (-r*sprite_ref[0][1] + 
> virtual_ref[0][1])*h3*(-2*vop_ref[0][0] + 1)
> -                                   + (-r*sprite_ref[0][1] + 
> virtual_ref[1][1])*w3*(-2*vop_ref[0][1] + 1)
> -                                   + 2*w2*h3*r*sprite_ref[0][1]
> -                                   - 16*w2*h3
> -                                   + (1<<(alpha+beta+rho-min_ab+1));
> +    virtual_ref[0][0] = 16 * (vop_ref[0][0] + w2)
> +                        + ROUNDED_DIV(((w - w2) * (r * sprite_ref[0][0] - 16 
> * vop_ref[0][0]) + w2 * (r * sprite_ref[1][0] - 16 * vop_ref[1][0])), w);
> +    virtual_ref[0][1] = 16 * vop_ref[0][1]
> +                        + ROUNDED_DIV(((w - w2) * (r * sprite_ref[0][1] - 16 
> * vop_ref[0][1]) + w2 * (r * sprite_ref[1][1] - 16 * vop_ref[1][1])), w);
> +    virtual_ref[1][0] = 16 * vop_ref[0][0]
> +                        + ROUNDED_DIV(((h - h2) * (r * sprite_ref[0][0] - 16 
> * vop_ref[0][0]) + h2 * (r * sprite_ref[2][0] - 16 * vop_ref[2][0])), h);
> +    virtual_ref[1][1] = 16 * (vop_ref[0][1] + h2)
> +                        + ROUNDED_DIV(((h - h2) * (r * sprite_ref[0][1] - 16 
> * vop_ref[0][1]) + h2 * (r * sprite_ref[2][1] - 16 * vop_ref[2][1])), h);
> +
> +    case 2:
> +        s->sprite_offset[0][0] = (sprite_ref[0][0] << (alpha + rho))
> +                                 + (-r * sprite_ref[0][0] + 
> virtual_ref[0][0]) * (-vop_ref[0][0])
> +                                 + (r * sprite_ref[0][1] - 
> virtual_ref[0][1]) * (-vop_ref[0][1])
> +                                 + (1 << (alpha + rho - 1));
> +        s->sprite_offset[0][1] = (sprite_ref[0][1] << (alpha + rho))
> +                                 + (-r * sprite_ref[0][1] + 
> virtual_ref[0][1]) * (-vop_ref[0][0])
> +                                 + (-r * sprite_ref[0][0] + 
> virtual_ref[0][0]) * (-vop_ref[0][1])
> +                                 + (1 << (alpha + rho - 1));
> +        s->sprite_offset[1][0] = ((-r * sprite_ref[0][0] + 
> virtual_ref[0][0]) * (-2 * vop_ref[0][0] + 1)
> +                                  + (r * sprite_ref[0][1] - 
> virtual_ref[0][1]) * (-2 * vop_ref[0][1] + 1)
> +                                  + 2 * w2 * r * sprite_ref[0][0]
> +                                  - 16 * w2
> +                                  + (1 << (alpha + rho + 1)));
> +        s->sprite_offset[1][1] = ((-r * sprite_ref[0][1] + 
> virtual_ref[0][1]) * (-2 * vop_ref[0][0] + 1)
> +                                  + (-r * sprite_ref[0][0] + 
> virtual_ref[0][0]) * (-2 * vop_ref[0][1] + 1)
> +                                  + 2 * w2 * r * sprite_ref[0][1]
> +                                  - 16 * w2
> +                                  + (1 << (alpha + rho + 1)));
> +    case 3:
> +        min_ab                 = FFMIN(alpha, beta);
> +        w3                     = w2 >> min_ab;
> +        h3                     = h2 >> min_ab;
> +        s->sprite_offset[0][0] = (sprite_ref[0][0] << (alpha + beta + rho - 
> min_ab))
> +                                 + (-r * sprite_ref[0][0] + 
> virtual_ref[0][0]) * h3 * (-vop_ref[0][0])
> +                                 + (-r * sprite_ref[0][0] + 
> virtual_ref[1][0]) * w3 * (-vop_ref[0][1])
> +                                 + (1 << (alpha + beta + rho - min_ab - 1));
> +        s->sprite_offset[0][1] = (sprite_ref[0][1] << (alpha + beta + rho - 
> min_ab))
> +                                 + (-r * sprite_ref[0][1] + 
> virtual_ref[0][1]) * h3 * (-vop_ref[0][0])
> +                                 + (-r * sprite_ref[0][1] + 
> virtual_ref[1][1]) * w3 * (-vop_ref[0][1])
> +                                 + (1 << (alpha + beta + rho - min_ab - 1));
> +        s->sprite_offset[1][0] = (-r * sprite_ref[0][0] + virtual_ref[0][0]) 
> * h3 * (-2 * vop_ref[0][0] + 1)
> +                                 + (-r * sprite_ref[0][0] + 
> virtual_ref[1][0]) * w3 * (-2 * vop_ref[0][1] + 1)
> +                                 + 2 * w2 * h3 * r * sprite_ref[0][0]
> +                                 - 16 * w2 * h3
> +                                 + (1 << (alpha + beta + rho - min_ab + 1));
> +        s->sprite_offset[1][1] = (-r * sprite_ref[0][1] + virtual_ref[0][1]) 
> * h3 * (-2 * vop_ref[0][0] + 1)
> +                                 + (-r * sprite_ref[0][1] + 
> virtual_ref[1][1]) * w3 * (-2 * vop_ref[0][1] + 1)
> +                                 + 2 * w2 * h3 * r * sprite_ref[0][1]
> +                                 - 16 * w2 * h3
> +                                 + (1 << (alpha + beta + rho - min_ab + 1));

Move the operators to the end of the line.

>      /* try to simplify the situation */
> -    if(   s->sprite_delta[0][0] == a<<s->sprite_shift[0]
> -       && s->sprite_delta[0][1] == 0
> -       && s->sprite_delta[1][0] == 0
> -       && s->sprite_delta[1][1] == a<<s->sprite_shift[0])
> -    {
> +    if (s->sprite_delta[0][0] == a << s->sprite_shift[0]
> +        && s->sprite_delta[0][1] == 0
> +        && s->sprite_delta[1][0] == 0
> +        && s->sprite_delta[1][1] == a << s->sprite_shift[0]) {

same

> @@ -354,57 +349,60 @@ static int 
> mpeg4_decode_sprite_trajectory(MpegEncContext *s, GetBitContext *gb)
> -    if(s->shape != RECT_SHAPE){
> -        header_extension= get_bits1(&s->gb);
> +    if (s->shape != RECT_SHAPE) {
> +        header_extension = get_bits1(&s->gb);
>          //FIXME more stuff here
>      }

space after //

> -    if(s->shape == RECT_SHAPE){
> -        header_extension= get_bits1(&s->gb);
> +    if (s->shape == RECT_SHAPE) {
> +        header_extension = get_bits1(&s->gb);
>      }

Drop {}

> @@ -416,10 +414,10 @@ int ff_mpeg4_decode_video_packet_header(MpegEncContext 
> *s)
>          skip_bits(&s->gb, 2); /* vop coding type */
>          //FIXME not rect stuff here
>  
> -        if(s->shape != BIN_ONLY_SHAPE){
> +        if (s->shape != BIN_ONLY_SHAPE) {
>              skip_bits(&s->gb, 3); /* intra dc vlc threshold */
>  //FIXME don't just ignore everything
> -            if(s->pict_type == AV_PICTURE_TYPE_S && 
> s->vol_sprite_usage==GMC_SPRITE){
> +            if (s->pict_type == AV_PICTURE_TYPE_S && s->vol_sprite_usage == 
> GMC_SPRITE) {
>                  if (mpeg4_decode_sprite_trajectory(s, &s->gb) < 0)
>                      return AVERROR_INVALIDDATA;

space after //

> @@ -429,13 +427,13 @@ int ff_mpeg4_decode_video_packet_header(MpegEncContext 
> *s)
>  
>              if (s->pict_type != AV_PICTURE_TYPE_I) {
>                  int f_code = get_bits(&s->gb, 3);       /* fcode_for */
> -                if(f_code==0){
> +                if (f_code == 0) {
>                      av_log(s->avctx, AV_LOG_ERROR, "Error, video packet 
> header damaged (f_code=0)\n");
>                  }
>              }
>              if (s->pict_type == AV_PICTURE_TYPE_B) {
>                  int b_code = get_bits(&s->gb, 3);
> -                if(b_code==0){
> +                if (b_code == 0) {
>                      av_log(s->avctx, AV_LOG_ERROR, "Error, video packet 
> header damaged (b_code=0)\n");
>                  }

Drop {}.

> @@ -543,124 +546,136 @@ static inline int mpeg4_decode_dc(MpegEncContext * s, 
> int n, int *dir_ptr)
>  
> -                do{
> -                    if(show_bits_long(&s->gb, 19)==DC_MARKER){
> -                        return mb_num-1;
> +                do {
> +                    if (show_bits_long(&s->gb, 19) == DC_MARKER) {
> +                        return mb_num - 1;
>                      }

ditto

> -                if(cbpc & 4) {
> +                if (cbpc & 4) {
>                      ff_set_qscale(s, s->qscale + quant_tab[get_bits(&s->gb, 
> 2)]);
>                  }

ditto

>  try_again:
> -                bits= show_bits(&s->gb, 17);
> -                if(bits==MOTION_MARKER){
> -                    return mb_num-1;
> +                bits = show_bits(&s->gb, 17);
> +                if (bits == MOTION_MARKER) {
> +                    return mb_num - 1;
>                  }

ditto

> -                    if(s->pict_type==AV_PICTURE_TYPE_S && 
> s->vol_sprite_usage==GMC_SPRITE){
> -                        s->current_picture.mb_type[xy] = MB_TYPE_SKIP | 
> MB_TYPE_16x16 | MB_TYPE_GMC | MB_TYPE_L0;
> -                        mx= get_amv(s, 0);
> -                        my= get_amv(s, 1);
> -                    }else{
> +                    if (s->pict_type == AV_PICTURE_TYPE_S && 
> s->vol_sprite_usage == GMC_SPRITE) {
> +                        s->current_picture.mb_type[xy] = MB_TYPE_SKIP | 
> MB_TYPE_16x16 |
> +                                                         MB_TYPE_GMC | 
> MB_TYPE_L0;
> +                        mx                             = get_amv(s, 0);
> +                        my                             = get_amv(s, 1);
> +                    } else {
>                          s->current_picture.mb_type[xy] = MB_TYPE_SKIP | 
> MB_TYPE_16x16 | MB_TYPE_L0;
> -                        mx=my=0;
> +                        mx                             = my = 0;
>                      }

IMO excessive alignment

> -                s->cbp_table[xy]= cbpc&(8+3); //8 is dquant
> +                s->cbp_table[xy] = cbpc & (8 + 3); //8 is dquant

space after //

> -                    s->mbintra_table[xy]= 1;
> -                    mot_val[0       ]= mot_val[2       ]=
> -                    mot_val[0+stride]= mot_val[2+stride]= 0;
> -                    mot_val[1       ]= mot_val[3       ]=
> -                    mot_val[1+stride]= mot_val[3+stride]= 0;
> -                }else{
> -                    if(s->mbintra_table[xy])
> +                    s->mbintra_table[xy]           = 1;
> +                    mot_val[0]          =
> +                    mot_val[2]          =
> +                    mot_val[0 + stride] =
> +                    mot_val[2 + stride] = 0;
> +                    mot_val[1]          =
> +                    mot_val[3]          =
> +                    mot_val[1 + stride] =
> +                    mot_val[3 + stride] = 0;

The first line is oddly off.

> @@ -798,47 +820,47 @@ static int mpeg4_decode_partition_b(MpegEncContext *s, 
> int mb_count){
>      int mb_num;
> -    const int part_a_error= s->pict_type==AV_PICTURE_TYPE_I ? 
> (ER_DC_ERROR|ER_MV_ERROR) : ER_MV_ERROR;
> -    const int part_a_end  = s->pict_type==AV_PICTURE_TYPE_I ? (ER_DC_END  
> |ER_MV_END)   : ER_MV_END;
> +    const int part_a_error = s->pict_type == AV_PICTURE_TYPE_I ? 
> (ER_DC_ERROR | ER_MV_ERROR) : ER_MV_ERROR;
> +    const int part_a_end   = s->pict_type == AV_PICTURE_TYPE_I ? (ER_DC_END 
> | ER_MV_END) : ER_MV_END;

The alignment was not bad here.

> @@ -848,215 +870,232 @@ int ff_mpeg4_decode_partitions(MpegEncContext *s)
> -
> -        block[scan_table[i]] = level;
> +        CLOSE_READER(re, &s->gb);
>      }
> -    CLOSE_READER(re, &s->gb);
> -  }
> - not_coded:
> +not_coded:
>      if (intra) {
> -        if(!s->use_intra_dc_vlc){
> +        if (!s->use_intra_dc_vlc) {
>              block[0] = ff_mpeg4_pred_dc(s, n, block[0], &dc_pred_dir, 0);

I'd add an empty line before the goto label.

> @@ -1155,97 +1194,98 @@ static int mpeg4_decode_partitioned_mb(MpegEncContext 
> *s, int16_t block[6][64])
>  
>  static int mpeg4_decode_mb(MpegEncContext *s,
> -                      int16_t block[6][64])
> +                           int16_t block[6][64])

These lines could be coalesced.

> @@ -1302,184 +1342,185 @@ static int mpeg4_decode_mb(MpegEncContext *s,
>  
> -        modb1= get_bits1(&s->gb);
> -        if(modb1){
> -            mb_type= MB_TYPE_DIRECT2 | MB_TYPE_SKIP | MB_TYPE_L0L1; //like 
> MB_TYPE_B_DIRECT but no vectors coded
> +        modb1 = get_bits1(&s->gb);
> +        if (modb1) {
> +            mb_type = MB_TYPE_DIRECT2 | MB_TYPE_SKIP | MB_TYPE_L0L1; //like 
> MB_TYPE_B_DIRECT but no vectors coded

space after //

>              if ((!IS_DIRECT(mb_type)) && cbp) {
> -                if(get_bits1(&s->gb)){
> -                    ff_set_qscale(s, s->qscale + get_bits1(&s->gb)*4 - 2);
> +                if (get_bits1(&s->gb)) {
> +                    ff_set_qscale(s, s->qscale + get_bits1(&s->gb) * 4 - 2);
>                  }

Drop {}.

> -                    mx = ff_h263_decode_motion(s, s->last_mv[0][0][0], 
> s->f_code);
> -                    my = ff_h263_decode_motion(s, s->last_mv[0][0][1], 
> s->f_code);
> -                    s->last_mv[0][1][0]= s->last_mv[0][0][0]= s->mv[0][0][0] 
> = mx;
> -                    s->last_mv[0][1][1]= s->last_mv[0][0][1]= s->mv[0][0][1] 
> = my;
> +                    mx                  = ff_h263_decode_motion(s, 
> s->last_mv[0][0][0], s->f_code);
> +                    my                  = ff_h263_decode_motion(s, 
> s->last_mv[0][0][1], s->f_code);
> +                    s->last_mv[0][1][0] = s->last_mv[0][0][0] = 
> s->mv[0][0][0] = mx;
> +                    s->last_mv[0][1][1] = s->last_mv[0][0][1] = 
> s->mv[0][0][1] = my;

I'd not align all four lines, but break the lower two

> -                    mx = ff_h263_decode_motion(s, s->last_mv[1][0][0], 
> s->b_code);
> -                    my = ff_h263_decode_motion(s, s->last_mv[1][0][1], 
> s->b_code);
> -                    s->last_mv[1][1][0]= s->last_mv[1][0][0]= s->mv[1][0][0] 
> = mx;
> -                    s->last_mv[1][1][1]= s->last_mv[1][0][1]= s->mv[1][0][1] 
> = my;
> +                    mx                  = ff_h263_decode_motion(s, 
> s->last_mv[1][0][0], s->b_code);
> +                    my                  = ff_h263_decode_motion(s, 
> s->last_mv[1][0][1], s->b_code);
> +                    s->last_mv[1][1][0] = s->last_mv[1][0][0] = 
> s->mv[1][0][0] = mx;
> +                    s->last_mv[1][1][1] = s->last_mv[1][0][1] = 
> s->mv[1][0][1] = my;
>                  }

ditto

> -                    for(i=0; i<2; i++){
> -                        mx = ff_h263_decode_motion(s, s->last_mv[0][i][0]  , 
> s->f_code);
> -                        my = ff_h263_decode_motion(s, s->last_mv[0][i][1]/2, 
> s->f_code);
> -                        s->last_mv[0][i][0]=  s->mv[0][i][0] = mx;
> -                        s->last_mv[0][i][1]= (s->mv[0][i][1] = my)*2;
> +                    for (i = 0; i < 2; i++) {
> +                        mx                  = ff_h263_decode_motion(s, 
> s->last_mv[0][i][0], s->f_code);
> +                        my                  = ff_h263_decode_motion(s, 
> s->last_mv[0][i][1] / 2, s->f_code);
> +                        s->last_mv[0][i][0] = s->mv[0][i][0] = mx;
> +                        s->last_mv[0][i][1] = (s->mv[0][i][1] = my) * 2;

same

> -                    for(i=0; i<2; i++){
> -                        mx = ff_h263_decode_motion(s, s->last_mv[1][i][0]  , 
> s->b_code);
> -                        my = ff_h263_decode_motion(s, s->last_mv[1][i][1]/2, 
> s->b_code);
> -                        s->last_mv[1][i][0]=  s->mv[1][i][0] = mx;
> -                        s->last_mv[1][i][1]= (s->mv[1][i][1] = my)*2;
> +                    for (i = 0; i < 2; i++) {
> +                        mx                  = ff_h263_decode_motion(s, 
> s->last_mv[1][i][0], s->b_code);
> +                        my                  = ff_h263_decode_motion(s, 
> s->last_mv[1][i][1] / 2, s->b_code);
> +                        s->last_mv[1][i][0] = s->mv[1][i][0] = mx;
> +                        s->last_mv[1][i][1] = (s->mv[1][i][1] = my) * 2;

ditto

> @@ -1606,226 +1650,232 @@ static int decode_vol_header(MpegEncContext *s, 
> GetBitContext *gb){
> -                    last= v;
> -                    j= s->dsp.idct_permutation[ ff_zigzag_direct[i] ];
> -                    s->inter_matrix[j]= v;
> -                    s->chroma_inter_matrix[j]= v;
> +                    v = get_bits(gb, 8);
> +                    last                      = v;
> +                    j                         = 
> s->dsp.idct_permutation[ff_zigzag_direct[i]];
> +                    s->inter_matrix[j]        = v;
> +                    s->chroma_inter_matrix[j] = v;

Maybe move the last assignment below the others and don't align j.

> -            if(   h_sampling_factor_n==0 || h_sampling_factor_m==0
> -               || v_sampling_factor_n==0 || v_sampling_factor_m==0){
> +            if (h_sampling_factor_n == 0 || h_sampling_factor_m == 0
> +                || v_sampling_factor_n == 0 || v_sampling_factor_m == 0) {

Move || to the end of the line.

> @@ -1838,129 +1888,137 @@ no_cplx_est:
> -    if(e!=4){
> -        if(strcmp(buf, "ffmpeg")==0){
> -            s->lavc_build= 4600;
> +    if (e != 4) {
> +        if (strcmp(buf, "ffmpeg") == 0) {
> +            s->lavc_build = 4600;
>          }
>      }
> -    if(e==4){
> -        s->lavc_build= build;
> +    if (e == 4) {
> +        s->lavc_build = build;
>      }
>      /* Xvid detection */
> -    e=sscanf(buf, "XviD%d", &build);
> -    if(e==1){
> -        s->xvid_build= build;
> +    e = sscanf(buf, "XviD%d", &build);
> +    if (e == 1) {
> +        s->xvid_build = build;
>      }

Drop some {}.

> @@ -1968,13 +2026,13 @@ static int decode_vop_header(MpegEncContext *s, 
> GetBitContext *gb){
> -    if (s->shape != BIN_ONLY_SHAPE && ( s->pict_type == AV_PICTURE_TYPE_P
> -                          || (s->pict_type == AV_PICTURE_TYPE_S && 
> s->vol_sprite_usage==GMC_SPRITE))) {
> +    if (s->shape != BIN_ONLY_SHAPE && (s->pict_type == AV_PICTURE_TYPE_P
> +                                       || (s->pict_type == AV_PICTURE_TYPE_S 
> && s->vol_sprite_usage == GMC_SPRITE))) {

Move || to the end of the line.

> @@ -1982,119 +2040,121 @@ static int decode_vop_header(MpegEncContext *s, 
> GetBitContext *gb){
> -         if (get_bits1(gb) != 0) {
> -             skip_bits(gb, 8); /* constant_alpha_value */
> -         }
> +        if (get_bits1(gb) != 0) {
> +            skip_bits(gb, 8);  /* constant_alpha_value */
> +        }

Drop {}.

>  //FIXME complexity estimation stuff

space after //

> @@ -2103,82 +2163,105 @@ static int decode_vop_header(MpegEncContext *s, 
> GetBitContext *gb){
> @@ -2186,9 +2269,9 @@ int ff_mpeg4_decode_picture_header(MpegEncContext * s, 
> GetBitContext *gb)
>          startcode = 0xff;
>      }
>  end:
> -    if(s->flags& CODEC_FLAG_LOW_DELAY)
> -        s->low_delay=1;
> -    s->avctx->has_b_frames= !s->low_delay;
> +    if (s->flags & CODEC_FLAG_LOW_DELAY)
> +        s->low_delay = 1;
> +    s->avctx->has_b_frames = !s->low_delay;
>      return decode_vop_header(s, gb);
>  }

I'd add an empty line before the goto label.

> @@ -2216,23 +2299,23 @@ static av_cold int decode_init(AVCodecContext *avctx)
> -    s->low_delay = 0; //default, might be overriden in the vol header during 
> header parsing
> +    s->low_delay                  = 0; //default, might be overriden in the 
> vol header during header parsing

space after //

>      avctx->internal->allocate_progress = 1;
> @@ -2241,22 +2324,22 @@ static av_cold int decode_init(AVCodecContext *avctx)
>  
>  static const AVProfile mpeg4_video_profiles[] = {
> -    { FF_PROFILE_MPEG4_SIMPLE,                    "Simple Profile" },
> -    { FF_PROFILE_MPEG4_SIMPLE_SCALABLE,           "Simple Scalable Profile" 
> },
> -    { FF_PROFILE_MPEG4_CORE,                      "Core Profile" },
> -    { FF_PROFILE_MPEG4_MAIN,                      "Main Profile" },
> -    { FF_PROFILE_MPEG4_N_BIT,                     "N-bit Profile" },
> -    { FF_PROFILE_MPEG4_SCALABLE_TEXTURE,          "Scalable Texture Profile" 
> },
> -    { FF_PROFILE_MPEG4_SIMPLE_FACE_ANIMATION,     "Simple Face Animation 
> Profile" },
> -    { FF_PROFILE_MPEG4_BASIC_ANIMATED_TEXTURE,    "Basic Animated Texture 
> Profile" },
> -    { FF_PROFILE_MPEG4_HYBRID,                    "Hybrid Profile" },
> +    { FF_PROFILE_MPEG4_SIMPLE,                    "Simple Profile"           
>          },
> +    { FF_PROFILE_MPEG4_SIMPLE_SCALABLE,           "Simple Scalable Profile"  
>          },
> +    { FF_PROFILE_MPEG4_CORE,                      "Core Profile"             
>          },
> +    { FF_PROFILE_MPEG4_MAIN,                      "Main Profile"             
>          },
> +    { FF_PROFILE_MPEG4_N_BIT,                     "N-bit Profile"            
>          },
> +    { FF_PROFILE_MPEG4_SCALABLE_TEXTURE,          "Scalable Texture Profile" 
>          },
> +    { FF_PROFILE_MPEG4_SIMPLE_FACE_ANIMATION,     "Simple Face Animation 
> Profile"     },
> +    { FF_PROFILE_MPEG4_BASIC_ANIMATED_TEXTURE,    "Basic Animated Texture 
> Profile"    },
> +    { FF_PROFILE_MPEG4_HYBRID,                    "Hybrid Profile"           
>          },
>      { FF_PROFILE_MPEG4_ADVANCED_REAL_TIME,        "Advanced Real Time Simple 
> Profile" },
> -    { FF_PROFILE_MPEG4_CORE_SCALABLE,             "Code Scalable Profile" },
> -    { FF_PROFILE_MPEG4_ADVANCED_CODING,           "Advanced Coding Profile" 
> },
> -    { FF_PROFILE_MPEG4_ADVANCED_CORE,             "Advanced Core Profile" },
> +    { FF_PROFILE_MPEG4_CORE_SCALABLE,             "Code Scalable Profile"    
>          },
> +    { FF_PROFILE_MPEG4_ADVANCED_CODING,           "Advanced Coding Profile"  
>          },
> +    { FF_PROFILE_MPEG4_ADVANCED_CORE,             "Advanced Core Profile"    
>          },
>      { FF_PROFILE_MPEG4_ADVANCED_SCALABLE_TEXTURE, "Advanced Scalable Texture 
> Profile" },
> -    { FF_PROFILE_MPEG4_SIMPLE_STUDIO,             "Simple Studio Profile" },
> -    { FF_PROFILE_MPEG4_ADVANCED_SIMPLE,           "Advanced Simple Profile" 
> },
> +    { FF_PROFILE_MPEG4_SIMPLE_STUDIO,             "Simple Studio Profile"    
>          },
> +    { FF_PROFILE_MPEG4_ADVANCED_SIMPLE,           "Advanced Simple Profile"  
>          },
>  };

There is no need for this IMO.

Diego
_______________________________________________
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to