aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2002-10-23 08:14:12 +0000
committerMichael Niedermayer <michaelni@gmx.at>2002-10-23 08:14:12 +0000
commit4a3d7fbcbcd38ae9684ee4bda92f293070710740 (patch)
tree18c687e1f138ab9c415a4b552db6582765940e91 /libavcodec
parent8d0e42cad06a5726146048359de46459df3fb675 (diff)
downloadffmpeg-4a3d7fbcbcd38ae9684ee4bda92f293070710740.tar.gz
fixing interlaced MC & edge-emu
Originally committed as revision 1066 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec')
-rw-r--r--libavcodec/h263dec.c5
-rw-r--r--libavcodec/mpegvideo.c30
2 files changed, 21 insertions, 14 deletions
diff --git a/libavcodec/h263dec.c b/libavcodec/h263dec.c
index 1e4345e623..040e59a6f6 100644
--- a/libavcodec/h263dec.c
+++ b/libavcodec/h263dec.c
@@ -327,6 +327,8 @@ uint64_t time= rdtsc();
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 @@ uint64_t time= rdtsc();
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))
diff --git a/libavcodec/mpegvideo.c b/libavcodec/mpegvideo.c
index 7fadcc2a0f..70bce2db20 100644
--- a/libavcodec/mpegvideo.c
+++ b/libavcodec/mpegvideo.c
@@ -1283,8 +1283,9 @@ if(s->quarter_sample)
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 @@ if(s->quarter_sample)
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 @@ static inline void qpel_motion(MpegEncContext *s,
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 @@ static inline void qpel_motion(MpegEncContext *s,
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);
}