/* intra / predictive decision */
pix = c->src[0][0];
sum = s->dsp.pix_sum(pix, s->linesize);
- varc = (s->dsp.pix_norm1(pix, s->linesize) - (((unsigned)(sum*sum))>>8) + 500 + 128)>>8;
+ varc = s->dsp.pix_norm1(pix, s->linesize) - (((unsigned)(sum*sum))>>8) + 500;
pic->mb_mean[s->mb_stride * mb_y + mb_x] = (sum+128)>>8;
- pic->mb_var [s->mb_stride * mb_y + mb_x] = varc;
- c->mb_var_sum_temp += varc;
+ pic->mb_var [s->mb_stride * mb_y + mb_x] = (varc+128)>>8;
+ c->mb_var_sum_temp += (varc+128)>>8;
if(c->avctx->me_threshold){
- vard= (check_input_motion(s, mb_x, mb_y, 1)+128)>>8;
+ vard= check_input_motion(s, mb_x, mb_y, 1);
- if(vard<c->avctx->me_threshold){
- pic->mc_mb_var[s->mb_stride * mb_y + mb_x] = vard;
- c->mc_mb_var_sum_temp += vard;
- if (vard <= 64 || vard < varc) { //FIXME
- c->scene_change_score+= ff_sqrt(vard<<8) - ff_sqrt(varc<<8);
+ if((vard+128)>>8 < c->avctx->me_threshold){
+ pic->mc_mb_var[s->mb_stride * mb_y + mb_x] = (vard+128)>>8;
+ c->mc_mb_var_sum_temp += (vard+128)>>8;
+ if (vard <= 64<<8 || vard < varc) { //FIXME
+ c->scene_change_score+= ff_sqrt(vard) - ff_sqrt(varc);
}else{
c->scene_change_score+= s->qscale;
}
return;
}
- if(vard<c->avctx->mb_threshold)
+ if((vard+128)>>8 < c->avctx->mb_threshold)
mb_type= s->mb_type[mb_x + mb_y*s->mb_stride];
}
/* At this point (mx,my) are full-pell and the relative displacement */
ppix = c->ref[0][0] + (my * s->linesize) + mx;
- vard = (s->dsp.sse[0](NULL, pix, ppix, s->linesize, 16)+128)>>8;
+ vard = s->dsp.sse[0](NULL, pix, ppix, s->linesize, 16);
- pic->mc_mb_var[s->mb_stride * mb_y + mb_x] = vard;
+ pic->mc_mb_var[s->mb_stride * mb_y + mb_x] = (vard+128)>>8;
// pic->mb_cmp_score[s->mb_stride * mb_y + mb_x] = dmin;
- c->mc_mb_var_sum_temp += vard;
+ c->mc_mb_var_sum_temp += (vard+128)>>8;
#if 0
printf("varc=%4d avg_var=%4d (sum=%4d) vard=%4d mx=%2d my=%2d\n",
varc, s->avg_mb_var, sum, vard, mx - xx, my - yy);
#endif
if(mb_type){
- if (vard <= 64 || vard < varc)
- c->scene_change_score+= ff_sqrt(vard<<8) - ff_sqrt(varc<<8);
+ if (vard <= 64<<8 || vard < varc)
+ c->scene_change_score+= ff_sqrt(vard) - ff_sqrt(varc);
else
c->scene_change_score+= s->qscale;
interlaced_search(s, 0, s->p_field_mv_table, s->p_field_select_table, mx, my, 1);
}
}else if(c->avctx->mb_decision > FF_MB_DECISION_SIMPLE){
- if (vard <= 64 || vard < varc)
- c->scene_change_score+= ff_sqrt(vard<<8) - ff_sqrt(varc<<8);
+ if (vard <= 64<<8 || vard < varc)
+ c->scene_change_score+= ff_sqrt(vard) - ff_sqrt(varc);
else
c->scene_change_score+= s->qscale;
- if (vard*2 + 200 > varc)
+ if (vard*2 + 200*256 > varc)
mb_type|= CANDIDATE_MB_TYPE_INTRA;
- if (varc*2 + 200 > vard){
+ if (varc*2 + 200*256 > vard){
mb_type|= CANDIDATE_MB_TYPE_INTER;
c->sub_motion_search(s, &mx, &my, dmin, 0, 0, 0, 16);
if(s->flags&CODEC_FLAG_MV0)
my <<=shift;
}
if((s->flags&CODEC_FLAG_4MV)
- && !c->skip && varc>50 && vard>10){
+ && !c->skip && varc>50<<8 && vard>10<<8){
if(h263_mv4_search(s, mx, my, shift) < INT_MAX)
mb_type|=CANDIDATE_MB_TYPE_INTER4V;
dmin= ff_get_mb_score(s, mx, my, 0, 0, 0, 16, 1);
if((s->flags&CODEC_FLAG_4MV)
- && !c->skip && varc>50 && vard>10){
+ && !c->skip && varc>50<<8 && vard>10<<8){
int dmin4= h263_mv4_search(s, mx, my, shift);
if(dmin4 < dmin){
mb_type= CANDIDATE_MB_TYPE_INTER4V;
/* get intra luma score */
if((c->avctx->mb_cmp&0xFF)==FF_CMP_SSE){
- intra_score= (varc<<8) - 500; //FIXME dont scale it down so we dont have to fix it
+ intra_score= varc - 500;
}else{
int mean= (sum+128)>>8;
mean*= 0x01010101;
}else
s->current_picture.mb_type[mb_y*s->mb_stride + mb_x]= 0;
- if (vard <= 64 || vard < varc) { //FIXME
- c->scene_change_score+= ff_sqrt(vard<<8) - ff_sqrt(varc<<8);
+ if (vard <= 64<<8 || vard < varc) { //FIXME
+ c->scene_change_score+= ff_sqrt(vard) - ff_sqrt(varc);
}else{
c->scene_change_score+= s->qscale;
}
c->skip=0;
if(c->avctx->me_threshold){
- int vard= (check_input_motion(s, mb_x, mb_y, 0)+128)>>8;
+ int vard= check_input_motion(s, mb_x, mb_y, 0);
- if(vard<c->avctx->me_threshold){
+ if((vard+128)>>8 < c->avctx->me_threshold){
// pix = c->src[0][0];
// sum = s->dsp.pix_sum(pix, s->linesize);
-// varc = (s->dsp.pix_norm1(pix, s->linesize) - (((unsigned)(sum*sum))>>8) + 500 + 128)>>8;
+// varc = s->dsp.pix_norm1(pix, s->linesize) - (((unsigned)(sum*sum))>>8) + 500;
-// pic->mb_var [s->mb_stride * mb_y + mb_x] = varc;
- s->current_picture.mc_mb_var[s->mb_stride * mb_y + mb_x] = vard;
+// pic->mb_var [s->mb_stride * mb_y + mb_x] = (varc+128)>>8;
+ s->current_picture.mc_mb_var[s->mb_stride * mb_y + mb_x] = (vard+128)>>8;
/* pic->mb_mean [s->mb_stride * mb_y + mb_x] = (sum+128)>>8;
- c->mb_var_sum_temp += varc;*/
- c->mc_mb_var_sum_temp += vard;
-/* if (vard <= 64 || vard < varc) {
- c->scene_change_score+= ff_sqrt(vard<<8) - ff_sqrt(varc<<8);
+ c->mb_var_sum_temp += (varc+128)>>8;*/
+ c->mc_mb_var_sum_temp += (vard+128)>>8;
+/* if (vard <= 64<<8 || vard < varc) {
+ c->scene_change_score+= ff_sqrt(vard) - ff_sqrt(varc);
}else{
c->scene_change_score+= s->qscale;
}*/
return;
}
- if(vard<c->avctx->mb_threshold){
+ if((vard+128)>>8 < c->avctx->mb_threshold){
type= s->mb_type[mb_y*s->mb_stride + mb_x];
if(type == CANDIDATE_MB_TYPE_DIRECT){
direct_search(s, mb_x, mb_y);
868164 ./data/a-h263p.avi
80fb224bebbe2e04f228da7485b905c5 *./data/out.yuv
stddev: 1.91 PSNR:42.49 bytes:7602176
-0c19edbe67bfbb521569ee95ebdd3fa5 *./data/a-odivx.mp4
-120196 ./data/a-odivx.mp4
-8b7657a7f9fc7298cc016abb466d1d19 *./data/out.yuv
+c23f4022c3af937da7200b3ce8547910 *./data/a-odivx.mp4
+120178 ./data/a-odivx.mp4
+e8c90899c32e11e7e4d1354dab0b8f28 *./data/out.yuv
stddev: 5.34 PSNR:33.56 bytes:7602176
4a8912deb0182471aaaf4fc3ece39fb2 *./data/a-huffyuv.avi
6454196 ./data/a-huffyuv.avi
227834 ./data/a-mpeg4-rc.avi
2e02fa0261c21268d568ddde74f9431e *./data/out.yuv
stddev: 4.26 PSNR:35.51 bytes:7602176
-6844785bcca74b4b9dc77ce6d21a3871 *./data/a-mpeg4-adv.avi
-172538 ./data/a-mpeg4-adv.avi
-49fecc1105d25ff1c2fc9c0d4cb821b0 *./data/out.yuv
-stddev: 4.84 PSNR:34.41 bytes:7602176
-9f7f5a7da720ba720aa35d72ed062959 *./data/a-mpeg4-thread.avi
-253448 ./data/a-mpeg4-thread.avi
-672eff5de3b19df7b82ed3e6bed8642d *./data/out.yuv
+49bb293a098ebf88870f663d590a02d9 *./data/a-mpeg4-adv.avi
+172526 ./data/a-mpeg4-adv.avi
+e3445dab9a3fa83a0f86457e24cb0cea *./data/out.yuv
+stddev: 4.84 PSNR:34.42 bytes:7602176
+66de0faff3660a0893996b39742a4c02 *./data/a-mpeg4-thread.avi
+253428 ./data/a-mpeg4-thread.avi
+0f23dbeb37f14b71cfae86dfe6c0b0e4 *./data/out.yuv
stddev: 4.05 PSNR:35.96 bytes:7602176
-1d39759d16065aeb96cc81aabd735f78 *./data/a-mpeg4-Q.avi
-165034 ./data/a-mpeg4-Q.avi
-b15dac581c3ba6e5e016df5dea360dc0 *./data/out.yuv
+bb7f7889f0694a1c499041f3ee5e234d *./data/a-mpeg4-Q.avi
+164998 ./data/a-mpeg4-Q.avi
+b078f22c66083f0537bd3581509684d8 *./data/out.yuv
stddev: 4.01 PSNR:36.05 bytes:7602176
-217c694a61eea2dd8896d558fed3fc05 *./data/a-error-mpeg4-adv.avi
-175778 ./data/a-error-mpeg4-adv.avi
-62106b2ae4c1cfc985face2dadb90cbc *./data/out.yuv
-stddev: 10.05 PSNR:28.08 bytes:7602176
-75aeb8364b81a458af5523c4a2bfdb39 *./data/a-mpeg4-nr.avi
-154392 ./data/a-mpeg4-nr.avi
-33a6f702049ef4e074c6266b9d17d3e9 *./data/out.yuv
-stddev: 4.73 PSNR:34.61 bytes:7602176
+74b9ddde044f90c8ee25042e9faaef68 *./data/a-error-mpeg4-adv.avi
+177212 ./data/a-error-mpeg4-adv.avi
+9fa0943825f364d6fb700dc75cf5d8bb *./data/out.yuv
+stddev: 9.71 PSNR:28.37 bytes:7602176
+edf6bf425e6e5f78bdd1b992003aee9a *./data/a-mpeg4-nr.avi
+154302 ./data/a-mpeg4-nr.avi
+b69fc415185075bdb21bedeae03d20b8 *./data/out.yuv
+stddev: 4.73 PSNR:34.62 bytes:7602176
1286f6db500a739f724994991be211b0 *./data/a-mpeg1b.mpg
231292 ./data/a-mpeg1b.mpg
a0eeed27d5123995b32210dc35052cfe *./data/out.yuv