On Thu, Dec 22, 2011 at 09:20:56PM +0200, доналд овчаров wrote:
> Ok it's done.
Please do not top-post.
> --- a/libavcodec/error_resilience.c
> +++ b/libavcodec/error_resilience.c
> @@ -40,26 +40,38 @@
>
> - if(ref >= h->ref_count[0]) //FIXME it is posible albeit uncommon
> that slice references differ between slices, we take the easy approuch and
> ignore it for now. If this turns out to have any relevance in practice then
> correct remapping should be added
> - ref=0;
> - fill_rectangle(&s->current_picture.f.ref_index[0][4*h->mb_xy], 2, 2,
> 2, ref, 1);
> + assert(ref >= 0);
> +
> + //FIXME it is posible albeit uncommon that slice references differ
> + //between slices, we take the easy approuch and ignore it for now.
> + //If this turns out to have any relevance in practice then correct
> + //remapping should be added
Add spaces between "//" and the first word of the comment line.
But for multiline comments better replace // by /* */.
> @@ -67,46 +79,52 @@ static void decode_mb(MpegEncContext *s, int ref){
> - *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;
Vertically align the '='.
> - for(x=0; x<8; x++){
> - dest_y[x + (i&1)*8 + (y + (i>>1)*8)*s->linesize]= dc/8;
> + for (x = 0; x < 8; x++) {
> + dest_y[ x + (i & 1) * 8 +
> + (y + (i >> 1) * 8) * s->linesize] = dc / 8;
If you are prettyprinting this much, vertically align the '*' as well.
> - if (dcu<0 ) dcu=0;
> - else if(dcu>2040) dcu=2040;
> - if (dcv<0 ) dcv=0;
> - else if(dcv>2040) dcv=2040;
> - for(y=0; y<8; y++){
> + if (dcu < 0 ) dcu = 0;
> + else if (dcu > 2040) dcu = 2040;
> + if (dcv < 0 ) dcv = 0;
> + else if (dcv > 2040) dcv = 2040;
Break these lines.
> - dc= - prev_dc
> - + data[x + y*stride]*8
> - - data[x + 1 + y*stride];
> + dc = -prev_dc +
> + data[x + y * stride] * 8 -
> + data[x + 1 + y * stride];
One more space before "data[".
> - dc= - prev_dc
> - + data[x + y *stride]*8
> - - data[x + (y+1)*stride];
> - dc= (dc*10923 + 32768)>>16;
> - prev_dc= data[x + y*stride];
> - data[x + y*stride]= dc;
> + dc = -prev_dc +
> + data[x + y * stride] * 8 -
> + data[x + (y+1) * stride];
> + dc = (dc * 10923 + 32768) >> 16;
> + prev_dc = data[x + y * stride];
> + data[x + y * stride] = dc;
same
> @@ -152,81 +169,83 @@ static void filter181(int16_t *data, int width, int
> height, int stride){
> - mb_index= (b_x>>is_luma) + (b_y>>is_luma)*s->mb_stride;
> -
> - error= s->error_status_table[mb_index];
> -
> - if(IS_INTER(s->current_picture.f.mb_type[mb_index])) continue;
> //inter
> - if(!(error&ER_DC_ERROR)) continue; //dc-ok
> + if (IS_INTER(s->current_picture.f.mb_type[mb_index]))
> + continue; //inter
> + if (!(error & ER_DC_ERROR))
> + continue; //dc-ok
space after //
> @@ -299,230 +324,277 @@ static void h_block_filter(MpegEncContext *s, uint8_t
> *dst, int w, int h, int st
> - none_left=1;
> - changed=1;
> - for(pass=0; (changed || pass<2) && pass<10; pass++){
> + none_left = 1;
> + changed = 1;
> + for (pass = 0; (changed || pass<2) && pass < 10; pass++) {
space around <
> - int best_score=256*256*256*64;
> - int best_pred=0;
> - const int mot_index= (mb_x + mb_y*mot_stride) * mot_step;
> + int best_score = 256 * 256 * 256 * 64;
> + int best_pred = 0;
> + const int mot_index = (mb_x + mb_y * mot_stride) *
> mot_step;
align the = while you're at it
> int k;
> - for(k=0; k<16; k++)
> - score += FFABS(src[k-s->linesize ]-src[k
> ]);
> + for (k = 0; k < 16; k++)
> + score += FFABS(src[k - s->linesize] -
> + src[k]);
no need to break this line
> - if(undamaged_count < 5) return 0; //almost all MBs damaged -> use
> temporal prediction
> + if (undamaged_count < 5)
> + return 0; //almost all MBs damaged -> use temporal prediction
space after //
> @@ -716,99 +810,112 @@ void ff_er_frame_start(MpegEncContext *s){
>
> - if(start_i > end_i || start_xy > end_xy){
> + if (start_i > end_i || start_xy > end_xy){
space before {
> - if(start_xy > 0 && s->avctx->thread_count <= 1 &&
> s->avctx->skip_top*s->mb_width < start_i){
> - int prev_status= s->error_status_table[ s->mb_index2xy[start_i - 1]
> ];
> + if (start_xy > 0 && s->avctx->thread_count <= 1 &&
> + s->avctx->skip_top * s->mb_width < start_i)
> + {
> + int prev_status = s->error_status_table[s->mb_index2xy[start_i - 1]];
Don't move the { to the next line
> - if(error&VP_START)
> + if (error&VP_START)
> end_ok=0;
space around & and =
This is not a complete review, I did as much as time currently permits.
Please doublecheck the file yourself and look for the above issues.
Diego
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel