Mercurial > libavcodec.hg
comparison snow.c @ 6474:e6995f3fbf7f libavcodec
cosmetics: Normalize {} placement after for, while, if.
author | diego |
---|---|
date | Sat, 08 Mar 2008 20:24:24 +0000 |
parents | 5154ab444372 |
children | e9431bea10dc |
comparison
equal
deleted
inserted
replaced
6473:e0cd9697ac6d | 6474:e6995f3fbf7f |
---|---|
512 buf->line_width = line_width; | 512 buf->line_width = line_width; |
513 buf->data_count = max_allocated_lines; | 513 buf->data_count = max_allocated_lines; |
514 buf->line = av_mallocz (sizeof(IDWTELEM *) * line_count); | 514 buf->line = av_mallocz (sizeof(IDWTELEM *) * line_count); |
515 buf->data_stack = av_malloc (sizeof(IDWTELEM *) * max_allocated_lines); | 515 buf->data_stack = av_malloc (sizeof(IDWTELEM *) * max_allocated_lines); |
516 | 516 |
517 for (i = 0; i < max_allocated_lines; i++) | 517 for(i = 0; i < max_allocated_lines; i++){ |
518 { | |
519 buf->data_stack[i] = av_malloc (sizeof(IDWTELEM) * line_width); | 518 buf->data_stack[i] = av_malloc (sizeof(IDWTELEM) * line_width); |
520 } | 519 } |
521 | 520 |
522 buf->data_stack_top = max_allocated_lines - 1; | 521 buf->data_stack_top = max_allocated_lines - 1; |
523 } | 522 } |
556 } | 555 } |
557 | 556 |
558 static void slice_buffer_flush(slice_buffer * buf) | 557 static void slice_buffer_flush(slice_buffer * buf) |
559 { | 558 { |
560 int i; | 559 int i; |
561 for (i = 0; i < buf->line_count; i++) | 560 for(i = 0; i < buf->line_count; i++){ |
562 { | |
563 if (buf->line[i]) | 561 if (buf->line[i]) |
564 slice_buffer_release(buf, i); | 562 slice_buffer_release(buf, i); |
565 } | 563 } |
566 } | 564 } |
567 | 565 |
568 static void slice_buffer_destroy(slice_buffer * buf) | 566 static void slice_buffer_destroy(slice_buffer * buf) |
569 { | 567 { |
570 int i; | 568 int i; |
571 slice_buffer_flush(buf); | 569 slice_buffer_flush(buf); |
572 | 570 |
573 for (i = buf->data_count - 1; i >= 0; i--) | 571 for(i = buf->data_count - 1; i >= 0; i--){ |
574 { | |
575 av_freep(&buf->data_stack[i]); | 572 av_freep(&buf->data_stack[i]); |
576 } | 573 } |
577 av_freep(&buf->data_stack); | 574 av_freep(&buf->data_stack); |
578 av_freep(&buf->line); | 575 av_freep(&buf->line); |
579 } | 576 } |
1587 int v; | 1584 int v; |
1588 IDWTELEM * line = slice_buffer_get_line(sb, y * b->stride_line + b->buf_y_offset) + b->buf_x_offset; | 1585 IDWTELEM * line = slice_buffer_get_line(sb, y * b->stride_line + b->buf_y_offset) + b->buf_x_offset; |
1589 memset(line, 0, b->width*sizeof(IDWTELEM)); | 1586 memset(line, 0, b->width*sizeof(IDWTELEM)); |
1590 v = b->x_coeff[new_index].coeff; | 1587 v = b->x_coeff[new_index].coeff; |
1591 x = b->x_coeff[new_index++].x; | 1588 x = b->x_coeff[new_index++].x; |
1592 while(x < w) | 1589 while(x < w){ |
1593 { | |
1594 register int t= ( (v>>1)*qmul + qadd)>>QEXPSHIFT; | 1590 register int t= ( (v>>1)*qmul + qadd)>>QEXPSHIFT; |
1595 register int u= -(v&1); | 1591 register int u= -(v&1); |
1596 line[x] = (t^u) - u; | 1592 line[x] = (t^u) - u; |
1597 | 1593 |
1598 v = b->x_coeff[new_index].coeff; | 1594 v = b->x_coeff[new_index].coeff; |
2590 if(s->keyframe || (s->avctx->debug&512)){ | 2586 if(s->keyframe || (s->avctx->debug&512)){ |
2591 if(mb_y==mb_h) | 2587 if(mb_y==mb_h) |
2592 return; | 2588 return; |
2593 | 2589 |
2594 if(add){ | 2590 if(add){ |
2595 for(y=block_w*mb_y; y<FFMIN(h,block_w*(mb_y+1)); y++) | 2591 for(y=block_w*mb_y; y<FFMIN(h,block_w*(mb_y+1)); y++){ |
2596 { | |
2597 // DWTELEM * line = slice_buffer_get_line(sb, y); | 2592 // DWTELEM * line = slice_buffer_get_line(sb, y); |
2598 IDWTELEM * line = sb->line[y]; | 2593 IDWTELEM * line = sb->line[y]; |
2599 for(x=0; x<w; x++) | 2594 for(x=0; x<w; x++){ |
2600 { | |
2601 // int v= buf[x + y*w] + (128<<FRAC_BITS) + (1<<(FRAC_BITS-1)); | 2595 // int v= buf[x + y*w] + (128<<FRAC_BITS) + (1<<(FRAC_BITS-1)); |
2602 int v= line[x] + (128<<FRAC_BITS) + (1<<(FRAC_BITS-1)); | 2596 int v= line[x] + (128<<FRAC_BITS) + (1<<(FRAC_BITS-1)); |
2603 v >>= FRAC_BITS; | 2597 v >>= FRAC_BITS; |
2604 if(v&(~255)) v= ~(v>>31); | 2598 if(v&(~255)) v= ~(v>>31); |
2605 dst8[x + y*ref_stride]= v; | 2599 dst8[x + y*ref_stride]= v; |
2606 } | 2600 } |
2607 } | 2601 } |
2608 }else{ | 2602 }else{ |
2609 for(y=block_w*mb_y; y<FFMIN(h,block_w*(mb_y+1)); y++) | 2603 for(y=block_w*mb_y; y<FFMIN(h,block_w*(mb_y+1)); y++){ |
2610 { | |
2611 // DWTELEM * line = slice_buffer_get_line(sb, y); | 2604 // DWTELEM * line = slice_buffer_get_line(sb, y); |
2612 IDWTELEM * line = sb->line[y]; | 2605 IDWTELEM * line = sb->line[y]; |
2613 for(x=0; x<w; x++) | 2606 for(x=0; x<w; x++){ |
2614 { | |
2615 line[x] -= 128 << FRAC_BITS; | 2607 line[x] -= 128 << FRAC_BITS; |
2616 // buf[x + y*w]-= 128<<FRAC_BITS; | 2608 // buf[x + y*w]-= 128<<FRAC_BITS; |
2617 } | 2609 } |
2618 } | 2610 } |
2619 } | 2611 } |
3101 memcpy(obmc_edged[y], obmc_edged[b_w*2-1], b_w*2); | 3093 memcpy(obmc_edged[y], obmc_edged[b_w*2-1], b_w*2); |
3102 } | 3094 } |
3103 } | 3095 } |
3104 | 3096 |
3105 //skip stuff outside the picture | 3097 //skip stuff outside the picture |
3106 if(mb_x==0 || mb_y==0 || mb_x==b_width-1 || mb_y==b_height-1) | 3098 if(mb_x==0 || mb_y==0 || mb_x==b_width-1 || mb_y==b_height-1){ |
3107 { | |
3108 uint8_t *src= s-> input_picture.data[0]; | 3099 uint8_t *src= s-> input_picture.data[0]; |
3109 uint8_t *dst= s->current_picture.data[0]; | 3100 uint8_t *dst= s->current_picture.data[0]; |
3110 const int stride= s->current_picture.linesize[0]; | 3101 const int stride= s->current_picture.linesize[0]; |
3111 const int block_w= MB_SIZE >> s->block_max_depth; | 3102 const int block_w= MB_SIZE >> s->block_max_depth; |
3112 const int sx= block_w*mb_x - block_w/2; | 3103 const int sx= block_w*mb_x - block_w/2; |