Mercurial > libavcodec.hg
comparison snow.c @ 3324:dbb617c134ff libavcodec
Snow: cosmetics
author | lorenm |
---|---|
date | Tue, 30 May 2006 06:49:15 +0000 |
parents | 87c54a3f8d19 |
children | c2a017de6bea |
comparison
equal
deleted
inserted
replaced
3323:87c54a3f8d19 | 3324:dbb617c134ff |
---|---|
2657 } | 2657 } |
2658 #endif | 2658 #endif |
2659 } | 2659 } |
2660 | 2660 |
2661 //FIXME name clenup (b_w, block_w, b_width stuff) | 2661 //FIXME name clenup (b_w, block_w, b_width stuff) |
2662 static always_inline void add_yblock(SnowContext *s, DWTELEM *dst, uint8_t *dst8, uint8_t *obmc, int src_x, int src_y, int b_w, int b_h, int w, int h, int dst_stride, int src_stride, int obmc_stride, int b_x, int b_y, int add, int offset_dst, int plane_index){ | 2662 static always_inline void add_yblock(SnowContext *s, DWTELEM *dst, uint8_t *dst8, const uint8_t *obmc, int src_x, int src_y, int b_w, int b_h, int w, int h, int dst_stride, int src_stride, int obmc_stride, int b_x, int b_y, int add, int offset_dst, int plane_index){ |
2663 const int b_width = s->b_width << s->block_max_depth; | 2663 const int b_width = s->b_width << s->block_max_depth; |
2664 const int b_height= s->b_height << s->block_max_depth; | 2664 const int b_height= s->b_height << s->block_max_depth; |
2665 const int b_stride= b_width; | 2665 const int b_stride= b_width; |
2666 BlockNode *lt= &s->block[b_x + b_y*b_stride]; | 2666 BlockNode *lt= &s->block[b_x + b_y*b_stride]; |
2667 BlockNode *rt= lt+1; | 2667 BlockNode *rt= lt+1; |
3301 int dia_change, i, j, ref; | 3301 int dia_change, i, j, ref; |
3302 int best_rd= INT_MAX, ref_rd; | 3302 int best_rd= INT_MAX, ref_rd; |
3303 BlockNode backup, ref_b; | 3303 BlockNode backup, ref_b; |
3304 const int index= mb_x + mb_y * b_stride; | 3304 const int index= mb_x + mb_y * b_stride; |
3305 BlockNode *block= &s->block[index]; | 3305 BlockNode *block= &s->block[index]; |
3306 BlockNode *tb = mb_y ? &s->block[index-b_stride ] : &null_block; | 3306 BlockNode *tb = mb_y ? &s->block[index-b_stride ] : NULL; |
3307 BlockNode *lb = mb_x ? &s->block[index -1] : &null_block; | 3307 BlockNode *lb = mb_x ? &s->block[index -1] : NULL; |
3308 BlockNode *rb = mb_x+1<b_width ? &s->block[index +1] : &null_block; | 3308 BlockNode *rb = mb_x+1<b_width ? &s->block[index +1] : NULL; |
3309 BlockNode *bb = mb_y+1<b_height ? &s->block[index+b_stride ] : &null_block; | 3309 BlockNode *bb = mb_y+1<b_height ? &s->block[index+b_stride ] : NULL; |
3310 BlockNode *tlb= mb_x && mb_y ? &s->block[index-b_stride-1] : &null_block; | 3310 BlockNode *tlb= mb_x && mb_y ? &s->block[index-b_stride-1] : NULL; |
3311 BlockNode *trb= mb_x+1<b_width && mb_y ? &s->block[index-b_stride+1] : &null_block; | 3311 BlockNode *trb= mb_x+1<b_width && mb_y ? &s->block[index-b_stride+1] : NULL; |
3312 BlockNode *blb= mb_x && mb_y+1<b_height ? &s->block[index+b_stride-1] : &null_block; | 3312 BlockNode *blb= mb_x && mb_y+1<b_height ? &s->block[index+b_stride-1] : NULL; |
3313 BlockNode *brb= mb_x+1<b_width && mb_y+1<b_height ? &s->block[index+b_stride+1] : &null_block; | 3313 BlockNode *brb= mb_x+1<b_width && mb_y+1<b_height ? &s->block[index+b_stride+1] : NULL; |
3314 const int b_w= (MB_SIZE >> s->block_max_depth); | 3314 const int b_w= (MB_SIZE >> s->block_max_depth); |
3315 uint8_t obmc_edged[b_w*2][b_w*2]; | 3315 uint8_t obmc_edged[b_w*2][b_w*2]; |
3316 | 3316 |
3317 if(pass && (block->type & BLOCK_OPT)) | 3317 if(pass && (block->type & BLOCK_OPT)) |
3318 continue; | 3318 continue; |
3395 block->ref= ref; | 3395 block->ref= ref; |
3396 best_rd= INT_MAX; | 3396 best_rd= INT_MAX; |
3397 | 3397 |
3398 check_block_inter(s, mb_x, mb_y, mvr[0][0], mvr[0][1], *obmc_edged, &best_rd); | 3398 check_block_inter(s, mb_x, mb_y, mvr[0][0], mvr[0][1], *obmc_edged, &best_rd); |
3399 check_block_inter(s, mb_x, mb_y, 0, 0, *obmc_edged, &best_rd); | 3399 check_block_inter(s, mb_x, mb_y, 0, 0, *obmc_edged, &best_rd); |
3400 if(tb!=&null_block) | 3400 if(tb) |
3401 check_block_inter(s, mb_x, mb_y, mvr[-b_stride][0], mvr[-b_stride][1], *obmc_edged, &best_rd); | 3401 check_block_inter(s, mb_x, mb_y, mvr[-b_stride][0], mvr[-b_stride][1], *obmc_edged, &best_rd); |
3402 if(lb!=&null_block) | 3402 if(lb) |
3403 check_block_inter(s, mb_x, mb_y, mvr[-1][0], mvr[-1][1], *obmc_edged, &best_rd); | 3403 check_block_inter(s, mb_x, mb_y, mvr[-1][0], mvr[-1][1], *obmc_edged, &best_rd); |
3404 if(rb!=&null_block) | 3404 if(rb) |
3405 check_block_inter(s, mb_x, mb_y, mvr[1][0], mvr[1][1], *obmc_edged, &best_rd); | 3405 check_block_inter(s, mb_x, mb_y, mvr[1][0], mvr[1][1], *obmc_edged, &best_rd); |
3406 if(bb!=&null_block) | 3406 if(bb) |
3407 check_block_inter(s, mb_x, mb_y, mvr[b_stride][0], mvr[b_stride][1], *obmc_edged, &best_rd); | 3407 check_block_inter(s, mb_x, mb_y, mvr[b_stride][0], mvr[b_stride][1], *obmc_edged, &best_rd); |
3408 | 3408 |
3409 /* fullpel ME */ | 3409 /* fullpel ME */ |
3410 //FIXME avoid subpel interpol / round to nearest integer | 3410 //FIXME avoid subpel interpol / round to nearest integer |
3411 do{ | 3411 do{ |
3440 #if 1 | 3440 #if 1 |
3441 check_block(s, mb_x, mb_y, color, 1, *obmc_edged, &best_rd); | 3441 check_block(s, mb_x, mb_y, color, 1, *obmc_edged, &best_rd); |
3442 //FIXME RD style color selection | 3442 //FIXME RD style color selection |
3443 #endif | 3443 #endif |
3444 if(!same_block(block, &backup)){ | 3444 if(!same_block(block, &backup)){ |
3445 if(tb != &null_block) tb ->type &= ~BLOCK_OPT; | 3445 if(tb ) tb ->type &= ~BLOCK_OPT; |
3446 if(lb != &null_block) lb ->type &= ~BLOCK_OPT; | 3446 if(lb ) lb ->type &= ~BLOCK_OPT; |
3447 if(rb != &null_block) rb ->type &= ~BLOCK_OPT; | 3447 if(rb ) rb ->type &= ~BLOCK_OPT; |
3448 if(bb != &null_block) bb ->type &= ~BLOCK_OPT; | 3448 if(bb ) bb ->type &= ~BLOCK_OPT; |
3449 if(tlb!= &null_block) tlb->type &= ~BLOCK_OPT; | 3449 if(tlb) tlb->type &= ~BLOCK_OPT; |
3450 if(trb!= &null_block) trb->type &= ~BLOCK_OPT; | 3450 if(trb) trb->type &= ~BLOCK_OPT; |
3451 if(blb!= &null_block) blb->type &= ~BLOCK_OPT; | 3451 if(blb) blb->type &= ~BLOCK_OPT; |
3452 if(brb!= &null_block) brb->type &= ~BLOCK_OPT; | 3452 if(brb) brb->type &= ~BLOCK_OPT; |
3453 change ++; | 3453 change ++; |
3454 } | 3454 } |
3455 } | 3455 } |
3456 } | 3456 } |
3457 av_log(NULL, AV_LOG_ERROR, "pass:%d changed:%d\n", pass, change); | 3457 av_log(NULL, AV_LOG_ERROR, "pass:%d changed:%d\n", pass, change); |
3461 | 3461 |
3462 if(s->block_max_depth == 1){ | 3462 if(s->block_max_depth == 1){ |
3463 int change= 0; | 3463 int change= 0; |
3464 for(mb_y= 0; mb_y<b_height; mb_y+=2){ | 3464 for(mb_y= 0; mb_y<b_height; mb_y+=2){ |
3465 for(mb_x= 0; mb_x<b_width; mb_x+=2){ | 3465 for(mb_x= 0; mb_x<b_width; mb_x+=2){ |
3466 int dia_change, i, j; | 3466 int i; |
3467 int best_rd, init_rd; | 3467 int best_rd, init_rd; |
3468 const int index= mb_x + mb_y * b_stride; | 3468 const int index= mb_x + mb_y * b_stride; |
3469 BlockNode *b[4]; | 3469 BlockNode *b[4]; |
3470 | 3470 |
3471 b[0]= &s->block[index]; | 3471 b[0]= &s->block[index]; |