changeset 763:339db642859d libavcodec

fixing interlaced MC & edge-emu
author michaelni
date Wed, 23 Oct 2002 08:14:12 +0000
parents 5da504c8c90e
children d4726182dfd2
files h263dec.c mpegvideo.c
diffstat 2 files changed, 21 insertions(+), 14 deletions(-) [+]
line wrap: on
line diff
--- a/h263dec.c	Tue Oct 22 23:43:25 2002 +0000
+++ b/h263dec.c	Wed Oct 23 08:14:12 2002 +0000
@@ -327,6 +327,8 @@
         return 0;
     }
 
+retry:
+    
     if(s->bitstream_buffer_size && buf_size<20){ //divx 5.01+ frame reorder
         init_get_bits(&s->gb, s->bitstream_buffer, s->bitstream_buffer_size);
     }else
@@ -431,8 +433,7 @@
 	    avctx->aspected_height = s->aspected_height;
 	}
 
-        if (MPV_common_init(s) < 0)
-            return -1;
+        goto retry;
     }
 
     if((s->codec_id==CODEC_ID_H263 || s->codec_id==CODEC_ID_H263P))
--- a/mpegvideo.c	Tue Oct 22 23:43:25 2002 +0000
+++ b/mpegvideo.c	Wed Oct 23 08:14:12 2002 +0000
@@ -1283,8 +1283,9 @@
     if(s->flags&CODEC_FLAG_EMU_EDGE){
         if(src_x<0 || src_y<0 || src_x + (motion_x&1) + 16 > s->h_edge_pos
                               || src_y + (motion_y&1) + h  > v_edge_pos){
-            emulated_edge_mc(s, ptr, linesize, 17, h+1, src_x, src_y, s->h_edge_pos, v_edge_pos);
-            ptr= s->edge_emu_buffer;
+            emulated_edge_mc(s, ptr - src_offset, s->linesize, 17, 17+field_based, 
+                             src_x, src_y<<field_based, s->h_edge_pos, s->v_edge_pos);
+            ptr= s->edge_emu_buffer + src_offset;
             emu=1;
         }
     }
@@ -1319,15 +1320,17 @@
     offset = (src_y * uvlinesize) + src_x + (src_offset >> 1);
     ptr = ref_picture[1] + offset;
     if(emu){
-        emulated_edge_mc(s, ptr, uvlinesize, 9, (h>>1)+1, src_x, src_y, s->h_edge_pos>>1, v_edge_pos>>1);
-        ptr= s->edge_emu_buffer;
+        emulated_edge_mc(s, ptr - (src_offset >> 1), s->uvlinesize, 9, 9+field_based, 
+                         src_x, src_y<<field_based, s->h_edge_pos>>1, s->v_edge_pos>>1);
+        ptr= s->edge_emu_buffer + (src_offset >> 1);
     }
     pix_op[1][dxy](dest_cb + (dest_offset >> 1), ptr, uvlinesize, h >> 1);
 
     ptr = ref_picture[2] + offset;
     if(emu){
-        emulated_edge_mc(s, ptr, uvlinesize, 9, (h>>1)+1, src_x, src_y, s->h_edge_pos>>1, v_edge_pos>>1);
-        ptr= s->edge_emu_buffer;
+        emulated_edge_mc(s, ptr - (src_offset >> 1), s->uvlinesize, 9, 9+field_based, 
+                         src_x, src_y<<field_based, s->h_edge_pos>>1, s->v_edge_pos>>1);
+        ptr= s->edge_emu_buffer + (src_offset >> 1);
     }
     pix_op[1][dxy](dest_cr + (dest_offset >> 1), ptr, uvlinesize, h >> 1);
 }
@@ -1365,8 +1368,9 @@
     if(s->flags&CODEC_FLAG_EMU_EDGE){
         if(src_x<0 || src_y<0 || src_x + (motion_x&3) + 16 > s->h_edge_pos
                               || src_y + (motion_y&3) + h  > v_edge_pos){
-            emulated_edge_mc(s, ptr, linesize, 17, h+1, src_x, src_y, s->h_edge_pos, v_edge_pos);
-            ptr= s->edge_emu_buffer;
+            emulated_edge_mc(s, ptr - src_offset, s->linesize, 17, 17+field_based, 
+                             src_x, src_y<<field_based, s->h_edge_pos, s->v_edge_pos);
+            ptr= s->edge_emu_buffer + src_offset;
             emu=1;
         }
     }
@@ -1409,15 +1413,17 @@
     offset = (src_y * uvlinesize) + src_x + (src_offset >> 1);
     ptr = ref_picture[1] + offset;
     if(emu){
-        emulated_edge_mc(s, ptr,  uvlinesize, 9, (h>>1)+1, src_x, src_y, s->h_edge_pos>>1, v_edge_pos>>1);
-        ptr= s->edge_emu_buffer;
+        emulated_edge_mc(s, ptr - (src_offset >> 1), s->uvlinesize, 9, 9 + field_based, 
+                         src_x, src_y<<field_based, s->h_edge_pos>>1, s->v_edge_pos>>1);
+        ptr= s->edge_emu_buffer + (src_offset >> 1);
     }
     pix_op[1][dxy](dest_cb + (dest_offset >> 1), ptr,  uvlinesize, h >> 1);
     
     ptr = ref_picture[2] + offset;
     if(emu){
-        emulated_edge_mc(s, ptr,  uvlinesize, 9, (h>>1)+1, src_x, src_y, s->h_edge_pos>>1, v_edge_pos>>1);
-        ptr= s->edge_emu_buffer;
+        emulated_edge_mc(s, ptr - (src_offset >> 1), s->uvlinesize, 9, 9 + field_based, 
+                         src_x, src_y<<field_based, s->h_edge_pos>>1, s->v_edge_pos>>1);
+        ptr= s->edge_emu_buffer + (src_offset >> 1);
     }
     pix_op[1][dxy](dest_cr + (dest_offset >> 1), ptr,  uvlinesize, h >> 1);
 }