Mercurial > libavcodec.hg
comparison motion_est.c @ 2986:83934bcab3cc libavcodec
hmm did i mess the scaling of these up at some point?
anyway, this change decreases bitrate and increase PSNR by ~1.00 on my test file, other files also benefit significantly
author | michael |
---|---|
date | Sat, 24 Dec 2005 23:47:29 +0000 |
parents | fedb0854bd07 |
children | 8f9eab06237b |
comparison
equal
deleted
inserted
replaced
2985:7de97d3ac7ef | 2986:83934bcab3cc |
---|---|
1175 | 1175 |
1176 if(vard<c->avctx->me_threshold){ | 1176 if(vard<c->avctx->me_threshold){ |
1177 pic->mc_mb_var[s->mb_stride * mb_y + mb_x] = vard; | 1177 pic->mc_mb_var[s->mb_stride * mb_y + mb_x] = vard; |
1178 c->mc_mb_var_sum_temp += vard; | 1178 c->mc_mb_var_sum_temp += vard; |
1179 if (vard <= 64 || vard < varc) { //FIXME | 1179 if (vard <= 64 || vard < varc) { //FIXME |
1180 c->scene_change_score+= ff_sqrt(vard) - ff_sqrt(varc); | 1180 c->scene_change_score+= ff_sqrt(vard<<8) - ff_sqrt(varc<<8); |
1181 }else{ | 1181 }else{ |
1182 c->scene_change_score+= s->qscale; | 1182 c->scene_change_score+= s->qscale; |
1183 } | 1183 } |
1184 return; | 1184 return; |
1185 } | 1185 } |
1266 printf("varc=%4d avg_var=%4d (sum=%4d) vard=%4d mx=%2d my=%2d\n", | 1266 printf("varc=%4d avg_var=%4d (sum=%4d) vard=%4d mx=%2d my=%2d\n", |
1267 varc, s->avg_mb_var, sum, vard, mx - xx, my - yy); | 1267 varc, s->avg_mb_var, sum, vard, mx - xx, my - yy); |
1268 #endif | 1268 #endif |
1269 if(mb_type){ | 1269 if(mb_type){ |
1270 if (vard <= 64 || vard < varc) | 1270 if (vard <= 64 || vard < varc) |
1271 c->scene_change_score+= ff_sqrt(vard) - ff_sqrt(varc); | 1271 c->scene_change_score+= ff_sqrt(vard<<8) - ff_sqrt(varc<<8); |
1272 else | 1272 else |
1273 c->scene_change_score+= s->qscale; | 1273 c->scene_change_score+= s->qscale; |
1274 | 1274 |
1275 if(mb_type == CANDIDATE_MB_TYPE_INTER){ | 1275 if(mb_type == CANDIDATE_MB_TYPE_INTER){ |
1276 c->sub_motion_search(s, &mx, &my, dmin, 0, 0, 0, 16); | 1276 c->sub_motion_search(s, &mx, &my, dmin, 0, 0, 0, 16); |
1287 if(mb_type == CANDIDATE_MB_TYPE_INTER_I){ | 1287 if(mb_type == CANDIDATE_MB_TYPE_INTER_I){ |
1288 interlaced_search(s, 0, s->p_field_mv_table, s->p_field_select_table, mx, my, 1); | 1288 interlaced_search(s, 0, s->p_field_mv_table, s->p_field_select_table, mx, my, 1); |
1289 } | 1289 } |
1290 }else if(c->avctx->mb_decision > FF_MB_DECISION_SIMPLE){ | 1290 }else if(c->avctx->mb_decision > FF_MB_DECISION_SIMPLE){ |
1291 if (vard <= 64 || vard < varc) | 1291 if (vard <= 64 || vard < varc) |
1292 c->scene_change_score+= ff_sqrt(vard) - ff_sqrt(varc); | 1292 c->scene_change_score+= ff_sqrt(vard<<8) - ff_sqrt(varc<<8); |
1293 else | 1293 else |
1294 c->scene_change_score+= s->qscale; | 1294 c->scene_change_score+= s->qscale; |
1295 | 1295 |
1296 if (vard*2 + 200 > varc) | 1296 if (vard*2 + 200 > varc) |
1297 mb_type|= CANDIDATE_MB_TYPE_INTRA; | 1297 mb_type|= CANDIDATE_MB_TYPE_INTRA; |
1393 s->current_picture.mb_type[mb_y*s->mb_stride + mb_x]= CANDIDATE_MB_TYPE_INTRA; //FIXME cleanup | 1393 s->current_picture.mb_type[mb_y*s->mb_stride + mb_x]= CANDIDATE_MB_TYPE_INTRA; //FIXME cleanup |
1394 }else | 1394 }else |
1395 s->current_picture.mb_type[mb_y*s->mb_stride + mb_x]= 0; | 1395 s->current_picture.mb_type[mb_y*s->mb_stride + mb_x]= 0; |
1396 | 1396 |
1397 if (vard <= 64 || vard < varc) { //FIXME | 1397 if (vard <= 64 || vard < varc) { //FIXME |
1398 c->scene_change_score+= ff_sqrt(vard) - ff_sqrt(varc); | 1398 c->scene_change_score+= ff_sqrt(vard<<8) - ff_sqrt(varc<<8); |
1399 }else{ | 1399 }else{ |
1400 c->scene_change_score+= s->qscale; | 1400 c->scene_change_score+= s->qscale; |
1401 } | 1401 } |
1402 } | 1402 } |
1403 | 1403 |
1826 s->current_picture.mc_mb_var[s->mb_stride * mb_y + mb_x] = vard; | 1826 s->current_picture.mc_mb_var[s->mb_stride * mb_y + mb_x] = vard; |
1827 /* pic->mb_mean [s->mb_stride * mb_y + mb_x] = (sum+128)>>8; | 1827 /* pic->mb_mean [s->mb_stride * mb_y + mb_x] = (sum+128)>>8; |
1828 c->mb_var_sum_temp += varc;*/ | 1828 c->mb_var_sum_temp += varc;*/ |
1829 c->mc_mb_var_sum_temp += vard; | 1829 c->mc_mb_var_sum_temp += vard; |
1830 /* if (vard <= 64 || vard < varc) { | 1830 /* if (vard <= 64 || vard < varc) { |
1831 c->scene_change_score+= ff_sqrt(vard) - ff_sqrt(varc); | 1831 c->scene_change_score+= ff_sqrt(vard<<8) - ff_sqrt(varc<<8); |
1832 }else{ | 1832 }else{ |
1833 c->scene_change_score+= s->qscale; | 1833 c->scene_change_score+= s->qscale; |
1834 }*/ | 1834 }*/ |
1835 return; | 1835 return; |
1836 } | 1836 } |