Mercurial > libavcodec.hg
comparison snow.c @ 3323:87c54a3f8d19 libavcodec
Snow: fix subband weighting in wavelet cmp functions. use 32x32 cmp in iterative motion estimation.
author | lorenm |
---|---|
date | Tue, 30 May 2006 05:44:22 +0000 |
parents | 0b4f548dfb44 |
children | dbb617c134ff |
comparison
equal
deleted
inserted
replaced
3322:0b4f548dfb44 | 3323:87c54a3f8d19 |
---|---|
3090 y0 = block_w; | 3090 y0 = block_w; |
3091 for(y=y0; y<y1; y++) | 3091 for(y=y0; y<y1; y++) |
3092 memcpy(dst + sx+x0 + (sy+y)*ref_stride, cur + x0 + y*ref_stride, x1-x0); | 3092 memcpy(dst + sx+x0 + (sy+y)*ref_stride, cur + x0 + y*ref_stride, x1-x0); |
3093 } | 3093 } |
3094 | 3094 |
3095 //FIXME sad/ssd can be broken up, but wavelet cmp should be one 32x32 block | |
3096 if(block_w==16){ | 3095 if(block_w==16){ |
3097 distortion = 0; | 3096 /* FIXME rearrange dsputil to fit 32x32 cmp functions */ |
3098 for(i=0; i<4; i++){ | 3097 /* FIXME check alignment of the cmp wavelet vs the encoding wavelet */ |
3099 int off = sx+16*(i&1) + (sy+16*(i>>1))*ref_stride; | 3098 /* FIXME cmps overlap but don't cover the wavelet's whole support, |
3100 distortion += s->dsp.me_cmp[0](&s->m, src + off, dst + off, ref_stride, 16); | 3099 * so improving the score of one block is not strictly guaranteed to |
3100 * improve the score of the whole frame, so iterative motion est | |
3101 * doesn't always converge. */ | |
3102 if(s->avctx->me_cmp == FF_CMP_W97) | |
3103 distortion = w97_32_c(&s->m, src + sx + sy*ref_stride, dst + sx + sy*ref_stride, ref_stride, 32); | |
3104 else if(s->avctx->me_cmp == FF_CMP_W53) | |
3105 distortion = w53_32_c(&s->m, src + sx + sy*ref_stride, dst + sx + sy*ref_stride, ref_stride, 32); | |
3106 else{ | |
3107 distortion = 0; | |
3108 for(i=0; i<4; i++){ | |
3109 int off = sx+16*(i&1) + (sy+16*(i>>1))*ref_stride; | |
3110 distortion += s->dsp.me_cmp[0](&s->m, src + off, dst + off, ref_stride, 16); | |
3111 } | |
3101 } | 3112 } |
3102 }else{ | 3113 }else{ |
3103 assert(block_w==8); | 3114 assert(block_w==8); |
3104 distortion = s->dsp.me_cmp[0](&s->m, src + sx + sy*ref_stride, dst + sx + sy*ref_stride, ref_stride, block_w*2); | 3115 distortion = s->dsp.me_cmp[0](&s->m, src + sx + sy*ref_stride, dst + sx + sy*ref_stride, ref_stride, block_w*2); |
3105 } | 3116 } |
3280 encode_q_branch(s, 0, mb_x, mb_y); | 3291 encode_q_branch(s, 0, mb_x, mb_y); |
3281 s->c = r; | 3292 s->c = r; |
3282 memcpy(s->block_state, state, sizeof(s->block_state)); | 3293 memcpy(s->block_state, state, sizeof(s->block_state)); |
3283 } | 3294 } |
3284 | 3295 |
3285 for(pass=0; pass<50; pass++){ | 3296 for(pass=0; pass<25; pass++){ |
3286 int change= 0; | 3297 int change= 0; |
3287 | 3298 |
3288 for(mb_y= 0; mb_y<b_height; mb_y++){ | 3299 for(mb_y= 0; mb_y<b_height; mb_y++){ |
3289 for(mb_x= 0; mb_x<b_width; mb_x++){ | 3300 for(mb_x= 0; mb_x<b_width; mb_x++){ |
3290 int dia_change, i, j, ref; | 3301 int dia_change, i, j, ref; |