test DIRECT{0,0} too if flag mv0 is used
authorMichael Niedermayer <michaelni@gmx.at>
Fri, 22 Dec 2006 23:30:57 +0000 (23:30 +0000)
committerMichael Niedermayer <michaelni@gmx.at>
Fri, 22 Dec 2006 23:30:57 +0000 (23:30 +0000)
slight PSNR/bitrate increase

Originally committed as revision 7361 to svn://svn.ffmpeg.org/ffmpeg/trunk

libavcodec/motion_est.c
libavcodec/motion_est_template.c
tests/ffmpeg.regression.ref
tests/rotozoom.regression.ref

index 775544b26aa7fa91dbcd6b740dbe36a71cbf71f5..f9c0d0a601a23df59d0ef3b2d04a553456fecf49 100644 (file)
@@ -1978,6 +1978,8 @@ void ff_estimate_b_frame_motion(MpegEncContext * s,
         }
          //FIXME something smarter
         if(dmin>256*256*16) type&= ~CANDIDATE_MB_TYPE_DIRECT; //dont try direct mode if its invalid for this MB
+        if(s->codec_id == CODEC_ID_MPEG4 && type&CANDIDATE_MB_TYPE_DIRECT && s->flags&CODEC_FLAG_MV0 && *(uint32_t*)s->b_direct_mv_table[xy])
+            type |= CANDIDATE_MB_TYPE_DIRECT0;
 #if 0
         if(s->out_format == FMT_MPEG1)
             type |= CANDIDATE_MB_TYPE_INTRA;
index 1bfda1047208395436a1fa48035ed40084f428fd..897c08e3dfc0fd535fb2b034d3c91e8a525bc8e9 100644 (file)
@@ -1025,7 +1025,7 @@ static av_always_inline int epzs_motion_search_internal(MpegEncContext * s, int
     score_map[0]= dmin;
 
     //FIXME precalc first term below?
-    if((s->pict_type == B_TYPE  || s->flags&CODEC_FLAG_MV0) && !(c->flags & FLAG_DIRECT))
+    if((s->pict_type == B_TYPE && !(c->flags & FLAG_DIRECT)) || s->flags&CODEC_FLAG_MV0)
         dmin += (mv_penalty[pred_x] + mv_penalty[pred_y])*penalty_factor;
 
     /* first line */
index 06d2ca81fb699568f6c7b128471b9565a1f19501..8ff4c5e172d18e10f61246beff9341c9457b984c 100644 (file)
@@ -75,14 +75,14 @@ stddev: 10.40 PSNR:27.78 bytes:7602176
 600188 ./data/a-mpeg4-adv.avi
 60edc5a67271e425d0a2a52981895b81 *./data/out.yuv
 stddev: 10.25 PSNR:27.91 bytes:7602176
-8cbcdc72a33e5a8d624f38529efd93c8 *./data/a-mpeg4-qprd.avi
-657582 ./data/a-mpeg4-qprd.avi
-5b620f592a795b1caad323ab3fab0859 *./data/out.yuv
-stddev: 12.12 PSNR:26.45 bytes:7602176
-7573ec318b965cfb83da45daa23a9fc2 *./data/a-mpeg4-adap.avi
-400752 ./data/a-mpeg4-adap.avi
-820c4231d4fd192a93102f17f163d621 *./data/out.yuv
-stddev: 14.65 PSNR:24.80 bytes:7602176
+d099307d14c1a4daa145618ca0522888 *./data/a-mpeg4-qprd.avi
+657996 ./data/a-mpeg4-qprd.avi
+8a52c562082bad78cabb40ffa292ceec *./data/out.yuv
+stddev: 12.12 PSNR:26.44 bytes:7602176
+9192b10ae298ba325d53abf7b5b91ba3 *./data/a-mpeg4-adap.avi
+400650 ./data/a-mpeg4-adap.avi
+0ce1d1fbebc9e9178e1a1d4a32a5804c *./data/out.yuv
+stddev: 14.66 PSNR:24.80 bytes:7602176
 5fff534f0b958547dfdb811d4f289931 *./data/a-mpeg4-thread.avi
 761170 ./data/a-mpeg4-thread.avi
 fe1d119938f8a26174b38eeaa18dff85 *./data/out.yuv
index d1aac7073c45f293735c2016fe07d017ff9e8279..643ec3c4f618e3a272b210a6c19cce08f7138ba6 100644 (file)
@@ -75,14 +75,14 @@ stddev:  4.24 PSNR:35.56 bytes:7602176
 173590 ./data/a-mpeg4-adv.avi
 699edf05648fdc42196b7bebef9be269 *./data/out.yuv
 stddev:  4.84 PSNR:34.41 bytes:7602176
-edd969be2816c13ae078b7a0416a5715 *./data/a-mpeg4-qprd.avi
-234852 ./data/a-mpeg4-qprd.avi
-51fa46add28e145c1a5ce6b27a4c57b8 *./data/out.yuv
-stddev:  4.24 PSNR:35.57 bytes:7602176
-0784800b9914cf69a6a3dc950747d376 *./data/a-mpeg4-adap.avi
-204726 ./data/a-mpeg4-adap.avi
-3172924d9449b83586e30ae73c86be2a *./data/out.yuv
-stddev:  4.04 PSNR:35.98 bytes:7602176
+1e12bb209dae0ab4b64265b0a4262257 *./data/a-mpeg4-qprd.avi
+234048 ./data/a-mpeg4-qprd.avi
+1ec355ffb30d2adf302a550cf5812636 *./data/out.yuv
+stddev:  4.23 PSNR:35.58 bytes:7602176
+d581d6f4a331325905b8ffb05cd3bfd3 *./data/a-mpeg4-adap.avi
+204284 ./data/a-mpeg4-adap.avi
+c2c7f1c7844ab92d34247ccb70198c61 *./data/out.yuv
+stddev:  4.04 PSNR:35.99 bytes:7602176
 8cd8940d7451925784536fe9b2f2a5e3 *./data/a-mpeg4-thread.avi
 254260 ./data/a-mpeg4-thread.avi
 d160a4224ea1af66c85178912f8d3a7c *./data/out.yuv