diff snow.c @ 3338:937f14bb0f23 libavcodec

support doing motion estimation and compensation without any residual transform or coding this is usefull for filters which need ME/MC
author michael
date Sun, 04 Jun 2006 21:54:58 +0000
parents 955096780e7c
children 6805c1e5507e
line wrap: on
line diff
--- a/snow.c	Sat Jun 03 22:18:03 2006 +0000
+++ b/snow.c	Sun Jun 04 21:54:58 2006 +0000
@@ -4261,6 +4261,7 @@
         int x, y;
 //        int bits= put_bits_count(&s->c.pb);
 
+    if(!(avctx->flags2 & CODEC_FLAG2_MEMC_ONLY)){
         //FIXME optimize
      if(pict->data[plane_index]) //FIXME gray hack
         for(y=0; y<h; y++){
@@ -4330,6 +4331,20 @@
 {START_TIMER
         predict_plane(s, s->spatial_dwt_buffer, plane_index, 1);
 STOP_TIMER("pred-conv")}
+      }else{
+            //ME/MC only
+            if(pict->pict_type == I_TYPE){
+                for(y=0; y<h; y++){
+                    for(x=0; x<w; x++){
+                        s->current_picture.data[plane_index][y*s->current_picture.linesize[plane_index] + x]=
+                            pict->data[plane_index][y*pict->linesize[plane_index] + x];
+                    }
+                }
+            }else{
+                memset(s->spatial_dwt_buffer, 0, sizeof(DWTELEM)*w*h);
+                predict_plane(s, s->spatial_dwt_buffer, plane_index, 1);
+            }
+      }
         if(s->avctx->flags&CODEC_FLAG_PSNR){
             int64_t error= 0;