On Tue, Sep 03, 2013 at 04:44:49PM +0200, Vittorio Giovara wrote:
> --- a/libavcodec/mpeg12enc.c
> +++ b/libavcodec/mpeg12enc.c
> @@ -95,70 +90,77 @@ static av_cold void init_uni_ac_vlc(RLTable *rl, uint8_t 
> *uni_ac_vlc_len)
>          }
>      }
> -    if(dmin)
> -        return -1;
> -    else
> -        return 0;
> +
> +    return dmin ? -1 : 0;

Please don't do such changes under a "K&R" label.

> -        }else{
> -            av_log(avctx, AV_LOG_INFO, "MPEG1/2 does not support %d/%d fps, 
> there may be AV sync issues\n", avctx->time_base.den, avctx->time_base.num);
> +        } else {
> +            av_log(avctx, AV_LOG_INFO, "MPEG1/2 does not support %d/%d fps, "
> +                   "there may be AV sync issues\n", avctx->time_base.den, 
> avctx->time_base.num);

I suggest trying to avoid breaking strings where possible.

> +        } else {
> +            if (avctx->profile != 1 && s->chroma_format != CHROMA_420) {
>                  av_log(avctx, AV_LOG_ERROR, "Only High(1) and 4:2:2(0) 
> profiles support 4:2:2 color sampling\n");

long line

> @@ -173,131 +175,130 @@ static av_cold int encode_init(AVCodecContext *avctx)
> -        if(aspect_ratio==0.0) aspect_ratio= 1.0; //pixel aspect 1:1 (VGA)
> +    if (aspect_ratio == 0.0)
> +        aspect_ratio = 1.0;                                         // pixel 
> aspect 1:1 (VGA)

This line is now too long.

> +        if (s->avctx->rc_buffer_size)
> +            vbv_buffer_size = s->avctx->rc_buffer_size;
> +        else
> +            /* VBV calculation: Scaled so that a VCD has the proper VBV size 
> of 40 kilobytes */

Maybe break this long line while you're at it.

> @@ -308,23 +309,24 @@ static inline void encode_mb_skip_run(MpegEncContext 
> *s, int run){
>      if (s->height > 2800) {
>          put_header(s, SLICE_MIN_START_CODE + (s->mb_y & 127));
> -        put_bits(&s->pb, 3, s->mb_y >> 7);  /* 
> slice_vertical_position_extension */
> +        put_bits(&s->pb, 3, s->mb_y >> 7);                          /* 
> slice_vertical_position_extension */
>      } else {
>          put_header(s, SLICE_MIN_START_CODE + s->mb_y);
>      }
>      put_qscale(s);
> -    put_bits(&s->pb, 1, 0); /* slice extra information */
> +    put_bits(&s->pb, 1, 0);                                         /* slice 
> extra information */

Please check all these weird things that are happening to comments.

> @@ -586,340 +575,349 @@ static void mpeg1_encode_motion(MpegEncContext *s, 
> int val, int f_or_b_code)
>                          put_bits(&s->pb, 1, s->field_select[0][i]);
> -                        mpeg1_encode_motion(s, s->mv[0][i][0] -  
> s->last_mv[0][i][0]    , s->f_code);
> -                        mpeg1_encode_motion(s, s->mv[0][i][1] - 
> (s->last_mv[0][i][1]>>1), s->f_code);
> +                        mpeg1_encode_motion(s, s->mv[0][i][0] - 
> s->last_mv[0][i][0], s->f_code);
> +                        mpeg1_encode_motion(s, s->mv[0][i][1] - 
> (s->last_mv[0][i][1] >> 1), s->f_code);

Here you might maintain some of the manual prettyprinting.

>                          put_bits(&s->pb, 1, s->field_select[1][i]);
> -                        mpeg1_encode_motion(s, s->mv[1][i][1] - 
> (s->last_mv[1][i][1]>>1), s->b_code);
> +                        mpeg1_encode_motion(s, s->mv[1][i][0] - 
> s->last_mv[1][i][0], s->b_code);
> +                        mpeg1_encode_motion(s, s->mv[1][i][1] - 
> (s->last_mv[1][i][1] >> 1), s->b_code);

same

> @@ -929,19 +927,19 @@ static const AVOption mpeg1_options[] = {
>  
> -#define mpeg12_class(x)\
> -static const AVClass mpeg## x ##_class = {\
> -    .class_name   = "mpeg" #x "video encoder",\
> -    .item_name    = av_default_item_name,\
> -    .option       = mpeg## x ##_options,\
> -    .version      = LIBAVUTIL_VERSION_INT,\
> -};
> +#define mpeg12_class(x) \
> +    static const AVClass mpeg ## x ## _class = { \
> +        .class_name = "mpeg" # x "video encoder", \
> +        .item_name  = av_default_item_name, \
> +        .option     = mpeg ## x ## _options, \
> +        .version    = LIBAVUTIL_VERSION_INT, \
> +    };

Please align the \ while you're at it, ideally on column 72.

> @@ -971,10 +969,11 @@ AVCodec ff_mpeg2video_encoder = {
>      .encode2              = ff_MPV_encode_picture,
>      .close                = ff_MPV_encode_end,
>      .supported_framerates = ff_mpeg12_frame_rate_tab + 1,
> -    .pix_fmts             = (const enum AVPixelFormat[]){
> -        AV_PIX_FMT_YUV420P, AV_PIX_FMT_YUV422P, AV_PIX_FMT_NONE
> -    },
> +    .pix_fmts             = (const enum AVPixelFormat[]) { 
> AV_PIX_FMT_YUV420P,
> +                                                           
> AV_PIX_FMT_YUV422P,
> +                                                           AV_PIX_FMT_NONE },
>      .capabilities         = CODEC_CAP_DELAY | CODEC_CAP_SLICE_THREADS,
>      .long_name            = NULL_IF_CONFIG_SMALL("MPEG-2 video"),
>      .priv_class           = &mpeg2_class,
>  };
> +

stray empty line added

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

Reply via email to