On Sat, Jan 07, 2012 at 05:13:21PM +0200, доналд овчаров wrote: > I didn't make the local variable changes because I'm afraid I could broke > the code. Rest is done ...
Did you compile to find out whether or not you broke the code? > >From 7b7b19631a44a7ecccdc22fd9c06a565cd27b881 Mon Sep 17 00:00:00 2001 > From: Donald Ovcharov <[email protected]> > Date: Sat, 17 Dec 2011 21:30:01 +0200 > Subject: [PATCH] error_resilience:cosmetics > > --- > libavcodec/error_resilience.c | 1476 > +++++++++++++++++++++++------------------ > 1 files changed, 825 insertions(+), 651 deletions(-) error_resilience: K&R formatting cosmetics > --- a/libavcodec/error_resilience.c > +++ b/libavcodec/error_resilience.c > @@ -67,82 +83,92 @@ static void decode_mb(MpegEncContext *s, int ref){ > assert(s->quarter_sample); > - *mv_step= 4; > - *stride= h->b_stride; > - }else{ > - *mv_step= 2; > - *stride= s->b8_stride; > + *mv_step = 4; > + *stride = h->b_stride; > + } else { > + *mv_step = 2; > + *stride = s->b8_stride; > } Align the '='. > @@ -152,81 +178,84 @@ static void filter181(int16_t *data, int width, int > height, int stride){ > > /* right block */ > - for(j=b_x+1; j<w; j++){ > - int mb_index_j= (j>>is_luma) + (b_y>>is_luma)*s->mb_stride; > - int error_j= s->error_status_table[mb_index_j]; > - int intra_j = > IS_INTRA(s->current_picture.f.mb_type[mb_index_j]); > - if(intra_j==0 || !(error_j&ER_DC_ERROR)){ > - color[0]= dc[j + b_y*stride]; > - distance[0]= j-b_x; > + for (j = b_x + 1; j < w; j++) { > + int mb_index_j = (j >> is_luma) + > + (b_y >> is_luma) * s->mb_stride; > + int error_j = s->error_status_table[mb_index_j]; > + int intra_j = > IS_INTRA(s->current_picture.f.mb_type[mb_index_j]); > + if (intra_j == 0 || !(error_j & ER_DC_ERROR)) { > + color[0] = dc[j + b_y * stride]; > + distance[0] = j - b_x; Align the last two '=', more in the similar blocks below. > @@ -299,230 +334,277 @@ static void h_block_filter(MpegEncContext *s, uint8_t > *dst, int w, int h, int st > > - num_avail=0; > - for(i=0; i<s->mb_num; i++){ > - const int mb_xy= s->mb_index2xy[ i ]; > - int f=0; > - int error= s->error_status_table[mb_xy]; > + num_avail = 0; > + for (i = 0; i < s->mb_num; i++) { > + const int mb_xy = s->mb_index2xy[i]; > + int f = 0; > + int error = s->error_status_table[mb_xy]; > > - changed=0; > - for(mb_y=0; mb_y<s->mb_height; mb_y++){ > - for(mb_x=0; mb_x<s->mb_width; mb_x++){ > - const int mb_xy= mb_x + mb_y*s->mb_stride; > - int mv_predictor[8][2]={{0}}; > - int ref[8]={0}; > - int pred_count=0; > + int score_sum = 0; > + > + changed = 0; > + for (mb_y = 0; mb_y < s->mb_height; mb_y++) { > + for (mb_x = 0; mb_x < s->mb_width; mb_x++) { > + const int mb_xy = mb_x + mb_y * s->mb_stride; > + int mv_predictor[8][2] = {{ 0 }}; spaces inside {}, i.e. { { 0 } }; > - if(mb_y>0 && fixed[mb_xy-mb_stride]){ > - mv_predictor[pred_count][0]= > s->current_picture.f.motion_val[0][mot_index - mot_stride*mot_step][0]; > - mv_predictor[pred_count][1]= > s->current_picture.f.motion_val[0][mot_index - mot_stride*mot_step][1]; > - ref [pred_count] = > s->current_picture.f.ref_index[0][4*(mb_xy-s->mb_stride)]; > + if (mb_y > 0 && fixed[mb_xy - mb_stride]) { > + mv_predictor[pred_count][0] = > + s->current_picture.f.motion_val[0][mot_index - > mot_stride * mot_step][0]; > + mv_predictor[pred_count][1] = > + s->current_picture.f.motion_val[0][mot_index - > mot_stride * mot_step][1]; > + ref [pred_count] = > + s->current_picture.f.ref_index[0][4 * > (mb_xy-s->mb_stride)]; Drop the spaces before [. > - if(mb_y+1<mb_height && fixed[mb_xy+mb_stride]){ > - mv_predictor[pred_count][0]= > s->current_picture.f.motion_val[0][mot_index + mot_stride*mot_step][0]; > - mv_predictor[pred_count][1]= > s->current_picture.f.motion_val[0][mot_index + mot_stride*mot_step][1]; > - ref [pred_count] = > s->current_picture.f.ref_index[0][4*(mb_xy+s->mb_stride)]; > + if (mb_y + 1<mb_height && fixed[mb_xy + mb_stride]) { > + mv_predictor[pred_count][0] = > + s->current_picture.f.motion_val[0][mot_index + > mot_stride * mot_step][0]; > + mv_predictor[pred_count][1] = > + s->current_picture.f.motion_val[0][mot_index + > mot_stride * mot_step][1]; > + ref [pred_count] = > + s->current_picture.f.ref_index[0][4 * (mb_xy + > s->mb_stride)]; same > - if(pred_count>=3){ > - min_y= min_x= min_r= 99999; > - max_y= max_x= max_r=-99999; > - }else{ > - min_x=min_y=max_x=max_y=min_r=max_r=0; > + if (pred_count >= 3) { > + min_y = min_x = min_r = 99999; > + max_y = max_x = max_r = -99999; Right-align the numbers. > -skip_mean_and_median: > + skip_mean_and_median: goto labels should be placed in the first column. Fix that everywhere else as well. > @@ -537,150 +619,171 @@ skip_mean_and_median: > > - skip_amount= FFMAX(undamaged_count/50, 1); //check only upto 50 MBs > - is_intra_likely=0; > + skip_amount = FFMAX(undamaged_count / 50, 1); // check only upto 50 MBs > + is_intra_likely = 0; Align the '='. I notice that you still have the "upto" typo, which is no longer present in Libav HEAD. You need to make patches against the HEAD version of Libav, not some outdated version. > - if((j%skip_amount) != 0) continue; //skip a few to speed things > up > + if ((j % skip_amount) != 0) > + continue; // skip a few to speed things up Move the comment before the if-condition, same in other places. That's it for now, should keep you busy for a while, I don't have time to continue reviewing right now. Diego _______________________________________________ libav-devel mailing list [email protected] https://lists.libav.org/mailman/listinfo/libav-devel
