Hi,
On Tue, Dec 27, 2011 at 1:55 PM, Aneesh Dogra <[email protected]> wrote:
> -static int estimate_best_b_count(MpegEncContext *s){
> - AVCodec *codec= avcodec_find_encoder(s->avctx->codec_id);
> +static int estimate_best_b_count(MpegEncContext *s)
[..]
This was already included in an earlier patch, please rebase.
> - if(pre_input_ptr && (!i || s->input_picture[i-1])) {
> - pre_input= *pre_input_ptr;
> + if (pre_input_ptr && (!i || s->input_picture[i-1])) {
Spaces around '-'.
> + out_size = avcodec_encode_video(c, outbuf, outbuf_size, &input[i
> + 1]);
80 characters.
> +static int select_input_picture(MpegEncContext *s)
[..]
> - s->avctx->release_buffer(s->avctx,
> (AVFrame*)s->input_picture[0]);
> + s->avctx->release_buffer(s->avctx, (AVFrame*)
> s->input_picture[0]);
(AVFrame *), 80 characters.
> @@ -1126,119 +1149,140 @@ static int select_input_picture(MpegEncContext *s){
[..]
> + for (i = 0; i < s->max_b_frames + 1; i++) {
> + if (s->input_picture[i] == NULL ||
> + s->input_picture[i]->b_frame_score - 1 >
> + s->mb_num / s->avctx->b_sensitivity)
Indent the last line 4 more spaces:
if (aaaaaa ||
bbbbbb >
cccccc) {
..
}
> + if (s->picture_in_gop_number + b_frames >= s->gop_size) {
> + if ((s->flags2 & CODEC_FLAG2_STRICT_GOP) &&
2 more spaces indenting.
> + s->gop_size > s->picture_in_gop_number) {
> + b_frames = s->gop_size - s->picture_in_gop_number - 1;
> + } else {
2 more spaces indenting.
> + if (s->flags & CODEC_FLAG_CLOSED_GOP)
> + b_frames = 0;
> s->input_picture[b_frames]->f.pict_type = AV_PICTURE_TYPE_I;
4 more spaces indenting each.
> }
2 more spaces indenting.
}
> - if (s->reordered_input_picture[0]->f.pict_type !=
> AV_PICTURE_TYPE_I)
> + if (s->reordered_input_picture[0]->f.pict_type !=
> + AV_PICTURE_TYPE_I)
That fit on 80 lines, why did you break it?
> - if(s->reordered_input_picture[0]){
> - s->reordered_input_picture[0]->f.reference =
> s->reordered_input_picture[0]->f.pict_type!=AV_PICTURE_TYPE_B ? 3 : 0;
> + if (s->reordered_input_picture[0]) {
> + s->reordered_input_picture[0]->f.reference =
> + s->reordered_input_picture[0]->f.pict_type !=
> + AV_PICTURE_TYPE_B ? 3 : 0;
if (aaaaaa) {
bbbbbb =
ccccc != dddddd ?
eee : fff;
[..]
or something like that. Diego may have additional comments, but they
can't all start at the same indent level.
> if (s->reordered_input_picture[0]->f.type == FF_BUFFER_TYPE_SHARED
> || s->avctx->rc_buffer_size) {
80 characters, split at ||.
> if (s->reordered_input_picture[0]->f.type ==
> FF_BUFFER_TYPE_INTERNAL)
> + s->avctx->release_buffer(s->avctx, (AVFrame *)
> + s->reordered_input_picture[0]);
General rule, if you can't split at the comma, try indenting less.
I.e., for:
function(a, b + c);
This is preferred:
function(a,
b + c);
But if that doesn't fit because b is too long, this is better:
function(a,
b + c);
This is less good and should only be used if the above still doesn't fit:
function(a,
b +
c);
Diego, additional comments?
> - copy_picture_attributes(s, (AVFrame*)pic,
> (AVFrame*)s->reordered_input_picture[0]);
> + copy_picture_attributes(s, (AVFrame *) pic, (AVFrame *)
> + s->reordered_input_picture[0]);
Same.
> - assert( s->reordered_input_picture[0]->f.type ==
> FF_BUFFER_TYPE_USER
> - || s->reordered_input_picture[0]->f.type ==
> FF_BUFFER_TYPE_INTERNAL);
> + assert(s->reordered_input_picture[0]->f.type ==
> + FF_BUFFER_TYPE_USER ||
> + s->reordered_input_picture[0]->f.type ==
> + FF_BUFFER_TYPE_INTERNAL);
assert(aaaaaaaa !=
bbbbbbbb ||
cccccccc !=
dddddddd);
> - }else{
> + //printf("dpn:%d\n", s->picture_number);
> + } else {
> memset(&s->new_picture, 0, sizeof(Picture));
1 more space indenting.
> @@ -1294,29 +1340,34 @@ vbv_retry:
[..]
> + if (put_bits_count(&s->pb) > max_size && s->lambda <
> s->avctx->lmax) {
80 characters.
> - s->lambda_table[i]= FFMAX(s->lambda_table[i]+1,
> s->lambda_table[i]*(s->qscale+1) / s->qscale);
> + s->lambda_table[i] = FFMAX(s->lambda_table[i] + 1,
> + s->lambda_table[i] * (s->qscale + 1) / s->qscale);
aaaaaaaa =
FFMAX(bbbbbbbb,
cccccccc);
> @@ -1325,30 +1376,33 @@ vbv_retry:
[..]
> - assert(avctx->header_bits + avctx->mv_bits + avctx->misc_bits +
> avctx->i_tex_bits + avctx->p_tex_bits == put_bits_count(&s->pb));
> + assert(avctx->header_bits + avctx->mv_bits + avctx->misc_bits +
> + avctx->i_tex_bits + avctx->p_tex_bits ==
> + put_bits_count(&s->pb));
assert(aaaaaaaa +
bbbbbbbb ==
cccccccc);
> + if (s->pb.buf_end - s->pb.buf - (put_bits_count(&s->pb) >> 3) <
> + stuffing_count + 50) {
if (aaaaaaaa <
bbbbbbbb) {
> @@ -1368,224 +1422,258 @@ vbv_retry:
[..]
> + if (s->avctx->rc_max_rate &&
> + s->avctx->rc_min_rate == s->avctx->rc_max_rate &&
> + s->out_format == FMT_MPEG1 &&
> + 90000LL * (avctx->rc_buffer_size - 1) <=
> + s->avctx->rc_max_rate * 0xFFFFLL) {
if (aaaaaaaa &&
bbbbbb <=
cccc) {
> + double inbits = s->avctx->rc_max_rate *
> + av_q2d(s->avctx->time_base);
> - vbv_delay= bits * 90000 /
> s->avctx->rc_max_rate;
> - min_delay= (minbits * 90000LL + s->avctx->rc_max_rate - 1)/
> s->avctx->rc_max_rate;
> + vbv_delay = bits * 90000 /
> + s->avctx->rc_max_rate;
> + min_delay = (minbits * 90000LL + s->avctx->rc_max_rate - 1) /
> + s->avctx->rc_max_rate;
Since vertical alignment is lost anyway, you can just as well merge
the vbv_delay line back to 1 line.
> vbv_delay= FFMAX(vbv_delay, min_delay);
Space before =.
> +static inline void dct_single_coeff_elimination(MpegEncContext *s,
> + int n, int threshold)
[..]
> + static const char tab[64] = {
> + 3, 2, 2, 1, 1, 1, 1, 1,
> + 1, 1, 1, 1, 1, 1, 1, 1,
> + 1, 1, 1, 1, 1, 1, 1, 1,
> + 0, 0, 0, 0, 0, 0, 0, 0,
> + 0, 0, 0, 0, 0, 0, 0, 0,
> + 0, 0, 0, 0, 0, 0, 0, 0,
> + 0, 0, 0, 0, 0, 0, 0, 0,
> + 0, 0, 0, 0, 0, 0, 0, 0 };
Weird 6-space indenting? Use 4. Also, "};" goes on a new line.
> +static inline void clip_coeffs(MpegEncContext *s, DCTELEM *block,
> + int last_index)
[..]
> + if (s->mb_intra) {
> + i = 1; //skip clipping of intra dc
Space between // and comment text.
Until line 1615, rest comes in a separate email.
Ronald
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel