How did you create this patch?
On Mon, Sep 02, 2013 at 06:08:42PM +0200, Vittorio Giovara wrote:
> --- a/libavcodec/mpeg12enc.c
> +++ b/libavcodec/mpeg12enc.c
> @@ -37,29 +37,23 @@
>
> -static void mpeg1_encode_block(MpegEncContext *s,
> - int16_t *block,
> - int component);
> +static void mpeg1_encode_block(MpegEncContext *s, int16_t *block, int
> component);
> static void mpeg1_encode_motion(MpegEncContext *s, int val, int
> f_or_b_code); // RAL: f_code parameter added
These forward declarations should be eliminated instead.
> -static uint8_t uni_mpeg1_ac_vlc_len [64*64*2];
> -static uint8_t uni_mpeg2_ac_vlc_len [64*64*2];
> +static uint8_t uni_mpeg1_ac_vlc_len [64 * 64 * 2];
> +static uint8_t uni_mpeg2_ac_vlc_len [64 * 64 * 2];
Drop the space before the [].
> @@ -72,26 +66,26 @@ static av_cold void init_uni_ac_vlc(RLTable *rl, uint8_t
> *uni_ac_vlc_len)
> if (alevel > rl->max_level[0][run])
> - code= 111; /*rl->n*/
> + code = 111;
> else
> - code= rl->index_run[0][run] + alevel - 1;
> + code = rl->index_run[0][run] + alevel - 1;
>
> - if (code < 111 /* rl->n */) {
> + if (code < 111) {
> /* length of vlc and sign */
> - len= rl->table_vlc[code][1]+1;
> + len = rl->table_vlc[code][1] + 1;
> } else {
> - len= rl->table_vlc[111/*rl->n*/][1]+6;
> + len = rl->table_vlc[111][1] + 6;
Why drop those comments?
> @@ -100,29 +94,30 @@ static av_cold void init_uni_ac_vlc(RLTable *rl, uint8_t
> *uni_ac_vlc_len)
> -static int find_frame_rate_index(MpegEncContext *s){
> +static int find_frame_rate_index(MpegEncContext *s) {
No, { should be moved to the next line instead.
> @@ -132,38 +127,46 @@ static av_cold int encode_init(AVCodecContext *avctx)
> - 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);
> + 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 breaking after the second argument instead.
> @@ -189,11 +192,12 @@ static void mpeg1_encode_sequence_header(MpegEncContext
> *s)
> - 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)
space after //
> @@ -201,54 +205,54 @@ static void mpeg1_encode_sequence_header(MpegEncContext
> *s)
>
> - if(error < best_aspect_error){
> - best_aspect_error= error;
> - s->aspect_ratio_info= i;
> + if (error < best_aspect_error) {
> + best_aspect_error = error;
> + s->aspect_ratio_info = i;
These = could be aligned.
> if (v > 0x3ffff && s->codec_id == AV_CODEC_ID_MPEG1VIDEO)
> v = 0x3ffff;
> - }else{
> - v= 0x3FFFF;
> + }else {
> + v = 0x3FFFF;
missing space after }
I'm skipping reviewing the rest; I think this is better done by
uncrustify instead of manually.
> @@ -877,7 +885,7 @@ static void mpeg1_encode_block(MpegEncContext *s,
>
> - for(;i<=last_index;i++) {
> + for ( ; i <= last_index; i++) {
I wouldn't add a space after (.
> @@ -921,10 +929,13 @@ static void mpeg1_encode_block(MpegEncContext *s,
>
> #define OFFSET(x) offsetof(MpegEncContext, x)
> #define VE AV_OPT_FLAG_ENCODING_PARAM | AV_OPT_FLAG_VIDEO_PARAM
> -#define COMMON_OPTS\
> - { "intra_vlc", "Use MPEG-2 intra VLC table.",
> OFFSET(intra_vlc_format), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 1, VE },\
> - { "drop_frame_timecode", "Timecode is in drop frame format.",
> OFFSET(drop_frame_timecode), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 1, VE}, \
> - { "scan_offset", "Reserve space for SVCD scan offset user
> data.", OFFSET(scan_offset), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 1, VE },
> +#define COMMON_OPTS
> \
> + { "intra_vlc", "Use MPEG-2 intra VLC table.",
> \
> + OFFSET(intra_vlc_format), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 1, VE
> }, \
> + { "drop_frame_timecode", "Timecode is in drop frame format.",
> \
> + OFFSET(drop_frame_timecode), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 1, VE
> }, \
> + { "scan_offset", "Reserve space for SVCD scan offset user
> data.", \
> + OFFSET(scan_offset), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 1, VE
> },
Many files keep these as long lines. I have no opinion.
> @@ -934,18 +945,20 @@ static const AVOption mpeg1_options[] = {
>
> static const AVOption mpeg2_options[] = {
> COMMON_OPTS
> - { "non_linear_quant", "Use nonlinear quantizer.",
> OFFSET(q_scale_type), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 1, VE },
> - { "alternate_scan", "Enable alternate scantable.",
> OFFSET(alternate_scan), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 1, VE },
> + { "non_linear_quant", "Use nonlinear quantizer.", \
> + OFFSET(q_scale_type), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 1,
> VE },
> + { "alternate_scan", "Enable alternate scantable.", \
> + OFFSET(alternate_scan), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 1,
> VE },
This is not a macro, drop the backslashes.
Diego
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel