[FFmpeg-cvslog] error_concealment: Use previous pictures motion vectors when the current ones have been lost.

Michael Niedermayer git at videolan.org
Wed May 11 01:15:40 CEST 2011


ffmpeg | branch: master | Michael Niedermayer <michaelni at gmx.at> | Wed May 11 00:47:55 2011 +0200| [3732c483040f0309505f1aa896fdefef5083ba34] | committer: Michael Niedermayer

error_concealment: Use previous pictures motion vectors when the current ones have been lost.

Looks better for some cases, worse for others, overall not much difference.
Its more correct though.
Signed-off-by: Michael Niedermayer <michaelni at gmx.at>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=3732c483040f0309505f1aa896fdefef5083ba34
---

 libavcodec/error_resilience.c |    8 ++++++++
 tests/ref/vsynth1/error       |    4 ++--
 tests/ref/vsynth2/error       |    4 ++--
 3 files changed, 12 insertions(+), 4 deletions(-)

diff --git a/libavcodec/error_resilience.c b/libavcodec/error_resilience.c
index 0320ed0..dac5559 100644
--- a/libavcodec/error_resilience.c
+++ b/libavcodec/error_resilience.c
@@ -381,6 +381,14 @@ static void guess_mv(MpegEncContext *s){
         fixed[mb_xy]= f;
         if(f==MV_FROZEN)
             num_avail++;
+        else if(s->last_picture.data[0]){
+            const int mb_y= mb_xy / s->mb_stride;
+            const int mb_x= mb_xy % s->mb_stride;
+            const int mot_index= (mb_x + mb_y*mot_stride) * mot_step;
+            s->current_picture.motion_val[0][mot_index][0]= s->last_picture.motion_val[0][mot_index][0];
+            s->current_picture.motion_val[0][mot_index][1]= s->last_picture.motion_val[0][mot_index][1];
+            s->current_picture.ref_index[0][4*mb_xy]      = s->last_picture.ref_index[0][4*mb_xy];
+        }
     }
 
     if((!(s->avctx->error_concealment&FF_EC_GUESS_MVS)) || num_avail <= mb_width/2){
diff --git a/tests/ref/vsynth1/error b/tests/ref/vsynth1/error
index c3543f9..4d1e9e5 100644
--- a/tests/ref/vsynth1/error
+++ b/tests/ref/vsynth1/error
@@ -1,4 +1,4 @@
 7416dfd319f04044d4575dc9d1b406e1 *./tests/data/vsynth1/error-mpeg4-adv.avi
 756836 ./tests/data/vsynth1/error-mpeg4-adv.avi
-ef8bfcd6e0883daba95d0f32486ebe2d *./tests/data/error.vsynth1.out.yuv
-stddev:   18.05 PSNR: 23.00 MAXDIFF:  245 bytes:  7603200/  7603200
+79e94ba32b37759397362cbcb479d4d3 *./tests/data/error.vsynth1.out.yuv
+stddev:   18.36 PSNR: 22.85 MAXDIFF:  243 bytes:  7603200/  7603200
diff --git a/tests/ref/vsynth2/error b/tests/ref/vsynth2/error
index 4181b2d..a6bfcd4 100644
--- a/tests/ref/vsynth2/error
+++ b/tests/ref/vsynth2/error
@@ -1,4 +1,4 @@
 90e65096aa9ebafa3fe3f44a5a47cdc4 *./tests/data/vsynth2/error-mpeg4-adv.avi
 176588 ./tests/data/vsynth2/error-mpeg4-adv.avi
-9fe1082179f80179439953c7397a46ef *./tests/data/error.vsynth2.out.yuv
-stddev:    9.00 PSNR: 29.04 MAXDIFF:  168 bytes:  7603200/  7603200
+96baa9e4c24c837a3ba5abd8dd2cdd30 *./tests/data/error.vsynth2.out.yuv
+stddev:    8.98 PSNR: 29.06 MAXDIFF:  184 bytes:  7603200/  7603200



More information about the ffmpeg-cvslog mailing list