Mercurial > libavcodec.hg
comparison motion_est.c @ 2189:70b27300a496 libavcodec
quad tree based motion compensation (currently only 16x16 & 8x8 OBMC blocks, but can be extended to other block sizes easily)
different intra block coding (previous was just an ugly hack)
1.8% bitrate reduction -0.01PSNR (foreman@352x288 qscale=8)
1.5% bitrate reduction +0.05PSNR (foreman@352x288 qscale=1)
author | michael |
---|---|
date | Thu, 26 Aug 2004 20:04:54 +0000 |
parents | 3378d0677903 |
children | 857e16e85aea |
comparison
equal
deleted
inserted
replaced
2188:226d0a39347d | 2189:70b27300a496 |
---|---|
266 c->stride = 16*s->mb_width + 32; | 266 c->stride = 16*s->mb_width + 32; |
267 c->uvstride= 8*s->mb_width + 16; | 267 c->uvstride= 8*s->mb_width + 16; |
268 } | 268 } |
269 | 269 |
270 // 8x8 fullpel search would need a 4x4 chroma compare, which we dont have yet, and even if we had the motion estimation code doesnt expect it | 270 // 8x8 fullpel search would need a 4x4 chroma compare, which we dont have yet, and even if we had the motion estimation code doesnt expect it |
271 if((c->avctx->me_cmp&FF_CMP_CHROMA) && !s->dsp.me_cmp[2]){ | 271 if(s->codec_id != CODEC_ID_SNOW){ |
272 s->dsp.me_cmp[2]= zero_cmp; | 272 if((c->avctx->me_cmp&FF_CMP_CHROMA) && !s->dsp.me_cmp[2]){ |
273 } | 273 s->dsp.me_cmp[2]= zero_cmp; |
274 if((c->avctx->me_sub_cmp&FF_CMP_CHROMA) && !s->dsp.me_sub_cmp[2]){ | 274 } |
275 s->dsp.me_sub_cmp[2]= zero_cmp; | 275 if((c->avctx->me_sub_cmp&FF_CMP_CHROMA) && !s->dsp.me_sub_cmp[2]){ |
276 } | 276 s->dsp.me_sub_cmp[2]= zero_cmp; |
277 c->hpel_put[2][0]= c->hpel_put[2][1]= | 277 } |
278 c->hpel_put[2][2]= c->hpel_put[2][3]= zero_hpel; | 278 c->hpel_put[2][0]= c->hpel_put[2][1]= |
279 c->hpel_put[2][2]= c->hpel_put[2][3]= zero_hpel; | |
280 } | |
279 | 281 |
280 c->temp= c->scratchpad; | 282 c->temp= c->scratchpad; |
281 } | 283 } |
282 | 284 |
283 #if 0 | 285 #if 0 |
1311 int intra_score, i; | 1313 int intra_score, i; |
1312 mb_type= CANDIDATE_MB_TYPE_INTER; | 1314 mb_type= CANDIDATE_MB_TYPE_INTER; |
1313 | 1315 |
1314 dmin= c->sub_motion_search(s, &mx, &my, dmin, 0, 0, 0, 16); | 1316 dmin= c->sub_motion_search(s, &mx, &my, dmin, 0, 0, 0, 16); |
1315 if(c->avctx->me_sub_cmp != c->avctx->mb_cmp && !c->skip) | 1317 if(c->avctx->me_sub_cmp != c->avctx->mb_cmp && !c->skip) |
1316 dmin= get_mb_score(s, mx, my, 0, 0); | 1318 dmin= ff_get_mb_score(s, mx, my, 0, 0, 0, 16, 1); |
1317 | 1319 |
1318 if((s->flags&CODEC_FLAG_4MV) | 1320 if((s->flags&CODEC_FLAG_4MV) |
1319 && !c->skip && varc>50 && vard>10){ | 1321 && !c->skip && varc>50 && vard>10){ |
1320 int dmin4= h263_mv4_search(s, mx, my, shift); | 1322 int dmin4= h263_mv4_search(s, mx, my, shift); |
1321 if(dmin4 < dmin){ | 1323 if(dmin4 < dmin){ |
1527 } | 1529 } |
1528 | 1530 |
1529 dmin= c->sub_motion_search(s, &mx, &my, dmin, 0, ref_index, 0, 16); | 1531 dmin= c->sub_motion_search(s, &mx, &my, dmin, 0, ref_index, 0, 16); |
1530 | 1532 |
1531 if(c->avctx->me_sub_cmp != c->avctx->mb_cmp && !c->skip) | 1533 if(c->avctx->me_sub_cmp != c->avctx->mb_cmp && !c->skip) |
1532 dmin= get_mb_score(s, mx, my, 0, ref_index); | 1534 dmin= ff_get_mb_score(s, mx, my, 0, ref_index, 0, 16, 1); |
1533 | 1535 |
1534 //printf("%d %d %d %d//", s->mb_x, s->mb_y, mx, my); | 1536 //printf("%d %d %d %d//", s->mb_x, s->mb_y, mx, my); |
1535 // s->mb_type[mb_y*s->mb_width + mb_x]= mb_type; | 1537 // s->mb_type[mb_y*s->mb_width + mb_x]= mb_type; |
1536 mv_table[mot_xy][0]= mx; | 1538 mv_table[mot_xy][0]= mx; |
1537 mv_table[mot_xy][1]= my; | 1539 mv_table[mot_xy][1]= my; |
1717 dmin = qpel_motion_search(s, &mx, &my, dmin, 0, 0, 0, 16); | 1719 dmin = qpel_motion_search(s, &mx, &my, dmin, 0, 0, 0, 16); |
1718 else | 1720 else |
1719 dmin = hpel_motion_search(s, &mx, &my, dmin, 0, 0, 0, 16); | 1721 dmin = hpel_motion_search(s, &mx, &my, dmin, 0, 0, 0, 16); |
1720 | 1722 |
1721 if(c->avctx->me_sub_cmp != c->avctx->mb_cmp && !c->skip) | 1723 if(c->avctx->me_sub_cmp != c->avctx->mb_cmp && !c->skip) |
1722 dmin= get_mb_score(s, mx, my, 0, 0); | 1724 dmin= ff_get_mb_score(s, mx, my, 0, 0, 0, 16, 1); |
1723 | 1725 |
1724 get_limits(s, 16*mb_x, 16*mb_y); //restore c->?min/max, maybe not needed | 1726 get_limits(s, 16*mb_x, 16*mb_y); //restore c->?min/max, maybe not needed |
1725 | 1727 |
1726 s->b_direct_mv_table[mot_xy][0]= mx; | 1728 s->b_direct_mv_table[mot_xy][0]= mx; |
1727 s->b_direct_mv_table[mot_xy][1]= my; | 1729 s->b_direct_mv_table[mot_xy][1]= my; |