On Fri, Dec 23, 2011 at 09:58:33PM +0530, Aneesh Dogra wrote: > > --- a/libavcodec/mpegvideo_enc.c > +++ b/libavcodec/mpegvideo_enc.c > @@ -59,16 +59,16 @@ static int dct_quantize_trellis_c(MpegEncContext *s, > DCTELEM *block, int n, int > > void ff_convert_matrix(DSPContext *dsp, int (*qmat)[64], uint16_t > (*qmat16)[2][64], > const uint16_t *quant_matrix, int bias, int qmin, > int qmax, int intra)
These lines could easily be broken and indentation is off. > @@ -113,64 +113,69 @@ void ff_convert_matrix(DSPContext *dsp, int > (*qmat)[64], uint16_t (*qmat16)[2][6 > > if (dsp->fdct == fdct_ifast > #ifndef FAAN_POSTSCALE > || dsp->fdct == ff_faandct > #endif > ) { This is admittedly slightly tricky because of the #ifdef, but there are 4 spaces too much indentation in the second and third line. > - for(i=0; i<s->mb_num; i++){ > - unsigned int lam= s->lambda_table[ s->mb_index2xy[i] ]; > - int qp= (lam*139 + FF_LAMBDA_SCALE*64) >> (FF_LAMBDA_SHIFT + 7); > - qscale_table[ s->mb_index2xy[i] ]= av_clip(qp, s->avctx->qmin, > s->avctx->qmax); > + for (i = 0; i < s->mb_num; i++) { > + unsigned int lam = s->lambda_table[ s->mb_index2xy[i] ]; > + int qp = (lam * 139 + FF_LAMBDA_SCALE * 64) >> (FF_LAMBDA_SHIFT + 7); > + qscale_table[ s->mb_index2xy[i] ] = av_clip(qp, s->avctx->qmin, > s->avctx->qmax); Drop the spaces inside []. > -static void copy_picture_attributes(MpegEncContext *s, AVFrame *dst, AVFrame > *src){ > +static void copy_picture_attributes(MpegEncContext *s, AVFrame *dst, AVFrame > *src) > +{ long line > @@ -182,34 +187,35 @@ static void copy_picture_attributes(MpegEncContext *s, > AVFrame *dst, AVFrame *sr > memcpy(dst->mb_type, src->mb_type, s->mb_stride * s->mb_height * > sizeof(dst->mb_type[0])); This line could be shortened. > - for(i=0; i<2; i++){ > - int stride= ((16*s->mb_width )>>src->motion_subsample_log2) + 1; > - int height= ((16*s->mb_height)>>src->motion_subsample_log2); > + for (i = 0; i < 2; i++) { > + int stride= ((16 * s->mb_width )>>src->motion_subsample_log2) + > 1; > + int height= ((16 * s->mb_height)>>src->motion_subsample_log2); space around = > @@ -230,15 +236,16 @@ static void > update_duplicate_context_after_me(MpegEncContext *dst, MpegEncContex > - s->me.mv_penalty= default_mv_penalty; > - s->fcode_tab= default_fcode_tab; > + s->me.mv_penalty = default_mv_penalty; > + s->fcode_tab = default_fcode_tab; Align the =. > @@ -293,27 +307,27 @@ av_cold int MPV_encode_init(AVCodecContext *avctx) > s->bit_rate = avctx->bit_rate; > s->width = avctx->width; > s->height = avctx->height; > - if(avctx->gop_size > 600 && > avctx->strict_std_compliance>FF_COMPLIANCE_EXPERIMENTAL){ > + if (avctx->gop_size > 600 && avctx->strict_std_compliance > > FF_COMPLIANCE_EXPERIMENTAL) { > av_log(avctx, AV_LOG_ERROR, "Warning keyframe interval too large! > reducing it ...\n"); > - avctx->gop_size=600; > + avctx->gop_size = 600; > } > s->gop_size = avctx->gop_size; > - s->avctx = avctx; > - s->flags= avctx->flags; > - s->flags2= avctx->flags2; > - s->max_b_frames= avctx->max_b_frames; > - s->codec_id= avctx->codec->id; > - s->luma_elim_threshold = avctx->luma_elim_threshold; > - s->chroma_elim_threshold= avctx->chroma_elim_threshold; > - s->strict_std_compliance= avctx->strict_std_compliance; > + s->avctx = avctx; > + s->flags = avctx->flags; > + s->flags2 = avctx->flags2; > + s->max_b_frames = avctx->max_b_frames; > + s->codec_id = avctx->codec->id; > + s->luma_elim_threshold = avctx->luma_elim_threshold; > + s->chroma_elim_threshold = avctx->chroma_elim_threshold; > + s->strict_std_compliance = avctx->strict_std_compliance; > #if FF_API_MPEGVIDEO_GLOBAL_OPTS > if (avctx->flags & CODEC_FLAG_PART) > s->data_partitioning = 1; > #endif > - s->quarter_sample= (avctx->flags & CODEC_FLAG_QPEL)!=0; > - s->mpeg_quant= avctx->mpeg_quant; > - s->rtp_mode= !!avctx->rtp_payload_size; > - s->intra_dc_precision= avctx->intra_dc_precision; > + s->quarter_sample = (avctx->flags & CODEC_FLAG_QPEL) != 0; > + s->mpeg_quant = avctx->mpeg_quant; > + s->rtp_mode = !!avctx->rtp_payload_size; > + s->intra_dc_precision = avctx->intra_dc_precision; > s->user_specified_pts = AV_NOPTS_VALUE; ditto > @@ -345,77 +359,77 @@ av_cold int MPV_encode_init(AVCodecContext *avctx) > > - if( s->avctx->rc_max_rate && s->avctx->rc_min_rate == > s->avctx->rc_max_rate > + if ( s->avctx->rc_max_rate && s->avctx->rc_min_rate == > s->avctx->rc_max_rate > && (s->codec_id == CODEC_ID_MPEG1VIDEO || s->codec_id == > CODEC_ID_MPEG2VIDEO) > - && 90000LL * (avctx->rc_buffer_size-1) > > s->avctx->rc_max_rate*0xFFFFLL){ > + && 90000LL * (avctx->rc_buffer_size-1) > > s->avctx->rc_max_rate*0xFFFFLL) { > > av_log(avctx, AV_LOG_INFO, "Warning vbv_delay will be set to 0xFFFF > (=VBR) as the specified vbv buffer is too large for the given bitrate!\n"); > } Drop the empty line before av_log and the spaces inside (). > - if(s->avctx->thread_count > 1 && s->codec_id != CODEC_ID_MPEG4 > + if (s->avctx->thread_count > 1 && s->codec_id != CODEC_ID_MPEG4 > && s->codec_id != CODEC_ID_MPEG1VIDEO && s->codec_id != > CODEC_ID_MPEG2VIDEO > - && (s->codec_id != CODEC_ID_H263P || !(s->flags & > CODEC_FLAG_H263P_SLICE_STRUCT))){ > + && (s->codec_id != CODEC_ID_H263P || !(s->flags & > CODEC_FLAG_H263P_SLICE_STRUCT))) { && are indented by only 3 spaces > - if(s->mpeg_quant || s->codec_id==CODEC_ID_MPEG1VIDEO || > s->codec_id==CODEC_ID_MPEG2VIDEO || s->codec_id==CODEC_ID_MJPEG){ > - s->intra_quant_bias= 3<<(QUANT_BIAS_SHIFT-3); //(a + x*3/8)/x > - s->inter_quant_bias= 0; > - }else{ > - s->intra_quant_bias=0; > - s->inter_quant_bias=-(1<<(QUANT_BIAS_SHIFT-2)); //(a - x/4)/x > + if (s->mpeg_quant || s->codec_id==CODEC_ID_MPEG1VIDEO || > s->codec_id==CODEC_ID_MPEG2VIDEO || s->codec_id==CODEC_ID_MJPEG) { > + s->intra_quant_bias = 3 << (QUANT_BIAS_SHIFT - 3); //(a + x*3/8)/x > + s->inter_quant_bias = 0; > + } else { > + s->intra_quant_bias = 0; > + s->inter_quant_bias = -(1 << (QUANT_BIAS_SHIFT-2)); //(a - x/4)/x Please adjust the commented expressions as well and leave a space after //. > - if(avctx->codec_id == CODEC_ID_MPEG4 && s->avctx->time_base.den > > (1<<16)-1){ > + if (avctx->codec_id == CODEC_ID_MPEG4 && s->avctx->time_base.den > (1 << > 16) - 1) { > av_log(avctx, AV_LOG_ERROR, "timebase %d/%d not supported by MPEG 4 > standard, " > "the maximum admitted value for the timebase denominator is > %d\n", > s->avctx->time_base.num, s->avctx->time_base.den, (1<<16)-1); space around << and - Enough for now, please doublecheck the file again. Diego _______________________________________________ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel