aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec/mpegvideo_motion.c
diff options
context:
space:
mode:
authorRonald S. Bultje <rsbultje@gmail.com>2013-09-20 08:01:19 -0400
committerRonald S. Bultje <rsbultje@gmail.com>2013-09-28 20:28:08 -0400
commitface578d56c2d1375e40d5e2a28acc122132bc55 (patch)
tree8a4fe63c8066b59ea41dd09285b4a82587a65030 /libavcodec/mpegvideo_motion.c
parentf574b4da567cc1c175ab5463fb5b3901cbaa5595 (diff)
downloadffmpeg-face578d56c2d1375e40d5e2a28acc122132bc55.tar.gz
Rewrite emu_edge functions to have separate src/dst_stride arguments.
This allows supporting files for which the image stride is smaller than the max. block size + number of subpel mc taps, e.g. a 64x64 VP9 file or a 16x16 VP8 file with -fflags +emu_edge.
Diffstat (limited to 'libavcodec/mpegvideo_motion.c')
-rw-r--r--libavcodec/mpegvideo_motion.c74
1 files changed, 42 insertions, 32 deletions
diff --git a/libavcodec/mpegvideo_motion.c b/libavcodec/mpegvideo_motion.c
index e5b7e4648a..09061d8dfe 100644
--- a/libavcodec/mpegvideo_motion.c
+++ b/libavcodec/mpegvideo_motion.c
@@ -63,7 +63,9 @@ static void gmc1_motion(MpegEncContext *s,
if( (unsigned)src_x >= FFMAX(s->h_edge_pos - 17, 0)
|| (unsigned)src_y >= FFMAX(s->v_edge_pos - 17, 0)){
- s->vdsp.emulated_edge_mc(s->edge_emu_buffer, ptr, linesize, 17, 17, src_x, src_y, s->h_edge_pos, s->v_edge_pos);
+ s->vdsp.emulated_edge_mc(s->edge_emu_buffer, linesize,
+ ptr, linesize, 17, 17, src_x, src_y,
+ s->h_edge_pos, s->v_edge_pos);
ptr= s->edge_emu_buffer;
}
@@ -100,7 +102,9 @@ static void gmc1_motion(MpegEncContext *s,
ptr = ref_picture[1] + offset;
if( (unsigned)src_x >= FFMAX((s->h_edge_pos>>1) - 9, 0)
|| (unsigned)src_y >= FFMAX((s->v_edge_pos>>1) - 9, 0)){
- s->vdsp.emulated_edge_mc(s->edge_emu_buffer, ptr, uvlinesize, 9, 9, src_x, src_y, s->h_edge_pos>>1, s->v_edge_pos>>1);
+ s->vdsp.emulated_edge_mc(s->edge_emu_buffer, uvlinesize,
+ ptr, uvlinesize, 9, 9, src_x, src_y,
+ s->h_edge_pos>>1, s->v_edge_pos>>1);
ptr= s->edge_emu_buffer;
emu=1;
}
@@ -108,7 +112,9 @@ static void gmc1_motion(MpegEncContext *s,
ptr = ref_picture[2] + offset;
if(emu){
- s->vdsp.emulated_edge_mc(s->edge_emu_buffer, ptr, uvlinesize, 9, 9, src_x, src_y, s->h_edge_pos>>1, s->v_edge_pos>>1);
+ s->vdsp.emulated_edge_mc(s->edge_emu_buffer, uvlinesize,
+ ptr, uvlinesize, 9, 9, src_x, src_y,
+ s->h_edge_pos>>1, s->v_edge_pos>>1);
ptr= s->edge_emu_buffer;
}
s->dsp.gmc1(dest_cr, ptr, uvlinesize, 8, motion_x&15, motion_y&15, 128 - s->no_rounding);
@@ -196,8 +202,9 @@ static inline int hpel_motion(MpegEncContext *s,
if(s->unrestricted_mv && (s->flags&CODEC_FLAG_EMU_EDGE)){
if( (unsigned)src_x > FFMAX(s->h_edge_pos - (motion_x&1) - 8, 0)
|| (unsigned)src_y > FFMAX(s->v_edge_pos - (motion_y&1) - 8, 0)){
- s->vdsp.emulated_edge_mc(s->edge_emu_buffer, src, s->linesize, 9, 9,
- src_x, src_y, s->h_edge_pos, s->v_edge_pos);
+ s->vdsp.emulated_edge_mc(s->edge_emu_buffer, s->linesize,
+ src, s->linesize, 9, 9,
+ src_x, src_y, s->h_edge_pos, s->v_edge_pos);
src= s->edge_emu_buffer;
emu=1;
}
@@ -287,19 +294,19 @@ if(s->quarter_sample)
"MPEG motion vector out of boundary (%d %d)\n", src_x, src_y);
return;
}
- s->vdsp.emulated_edge_mc(s->edge_emu_buffer, ptr_y, s->linesize,
- 17, 17+field_based,
- src_x, src_y<<field_based,
- s->h_edge_pos, s->v_edge_pos);
+ s->vdsp.emulated_edge_mc(s->edge_emu_buffer, s->linesize,
+ ptr_y, s->linesize, 17, 17+field_based,
+ src_x, src_y<<field_based,
+ s->h_edge_pos, s->v_edge_pos);
ptr_y = s->edge_emu_buffer;
if(!CONFIG_GRAY || !(s->flags&CODEC_FLAG_GRAY)){
uint8_t *uvbuf= s->edge_emu_buffer+18*s->linesize;
- s->vdsp.emulated_edge_mc(uvbuf ,
+ s->vdsp.emulated_edge_mc(uvbuf, s->uvlinesize,
ptr_cb, s->uvlinesize,
9, 9+field_based,
uvsrc_x, uvsrc_y<<field_based,
s->h_edge_pos>>1, s->v_edge_pos>>1);
- s->vdsp.emulated_edge_mc(uvbuf+16,
+ s->vdsp.emulated_edge_mc(uvbuf+16, s->uvlinesize,
ptr_cr, s->uvlinesize,
9, 9+field_based,
uvsrc_x, uvsrc_y<<field_based,
@@ -501,20 +508,23 @@ static inline void qpel_motion(MpegEncContext *s,
if( (unsigned)src_x > FFMAX(s->h_edge_pos - (motion_x&3) - 16, 0)
|| (unsigned)src_y > FFMAX( v_edge_pos - (motion_y&3) - h , 0)){
- s->vdsp.emulated_edge_mc(s->edge_emu_buffer, ptr_y, s->linesize,
- 17, 17+field_based, src_x, src_y<<field_based,
- s->h_edge_pos, s->v_edge_pos);
+ s->vdsp.emulated_edge_mc(s->edge_emu_buffer, s->linesize,
+ ptr_y, s->linesize,
+ 17, 17+field_based, src_x, src_y<<field_based,
+ s->h_edge_pos, s->v_edge_pos);
ptr_y= s->edge_emu_buffer;
if(!CONFIG_GRAY || !(s->flags&CODEC_FLAG_GRAY)){
uint8_t *uvbuf= s->edge_emu_buffer + 18*s->linesize;
- s->vdsp.emulated_edge_mc(uvbuf, ptr_cb, s->uvlinesize,
- 9, 9 + field_based,
- uvsrc_x, uvsrc_y<<field_based,
- s->h_edge_pos>>1, s->v_edge_pos>>1);
- s->vdsp.emulated_edge_mc(uvbuf + 16, ptr_cr, s->uvlinesize,
- 9, 9 + field_based,
- uvsrc_x, uvsrc_y<<field_based,
- s->h_edge_pos>>1, s->v_edge_pos>>1);
+ s->vdsp.emulated_edge_mc(uvbuf, s->uvlinesize,
+ ptr_cb, s->uvlinesize,
+ 9, 9 + field_based,
+ uvsrc_x, uvsrc_y<<field_based,
+ s->h_edge_pos>>1, s->v_edge_pos>>1);
+ s->vdsp.emulated_edge_mc(uvbuf + 16, s->uvlinesize,
+ ptr_cr, s->uvlinesize,
+ 9, 9 + field_based,
+ uvsrc_x, uvsrc_y<<field_based,
+ s->h_edge_pos>>1, s->v_edge_pos>>1);
ptr_cb= uvbuf;
ptr_cr= uvbuf + 16;
}
@@ -581,9 +591,9 @@ static void chroma_4mv_motion(MpegEncContext *s,
if(s->flags&CODEC_FLAG_EMU_EDGE){
if( (unsigned)src_x > FFMAX((s->h_edge_pos>>1) - (dxy &1) - 8, 0)
|| (unsigned)src_y > FFMAX((s->v_edge_pos>>1) - (dxy>>1) - 8, 0)){
- s->vdsp.emulated_edge_mc(s->edge_emu_buffer, ptr, s->uvlinesize,
- 9, 9, src_x, src_y,
- s->h_edge_pos>>1, s->v_edge_pos>>1);
+ s->vdsp.emulated_edge_mc(s->edge_emu_buffer, s->uvlinesize,
+ ptr, s->uvlinesize, 9, 9, src_x, src_y,
+ s->h_edge_pos>>1, s->v_edge_pos>>1);
ptr= s->edge_emu_buffer;
emu=1;
}
@@ -592,9 +602,9 @@ static void chroma_4mv_motion(MpegEncContext *s,
ptr = ref_picture[2] + offset;
if(emu){
- s->vdsp.emulated_edge_mc(s->edge_emu_buffer, ptr, s->uvlinesize,
- 9, 9, src_x, src_y,
- s->h_edge_pos>>1, s->v_edge_pos>>1);
+ s->vdsp.emulated_edge_mc(s->edge_emu_buffer, s->uvlinesize,
+ ptr, s->uvlinesize, 9, 9, src_x, src_y,
+ s->h_edge_pos>>1, s->v_edge_pos>>1);
ptr= s->edge_emu_buffer;
}
pix_op[dxy](dest_cr, ptr, s->uvlinesize, 8);
@@ -761,10 +771,10 @@ static av_always_inline void MPV_motion_internal(MpegEncContext *s,
if(s->flags&CODEC_FLAG_EMU_EDGE){
if( (unsigned)src_x > FFMAX(s->h_edge_pos - (motion_x&3) - 8, 0)
|| (unsigned)src_y > FFMAX(s->v_edge_pos - (motion_y&3) - 8, 0)){
- s->vdsp.emulated_edge_mc(s->edge_emu_buffer, ptr,
- s->linesize, 9, 9,
- src_x, src_y,
- s->h_edge_pos, s->v_edge_pos);
+ s->vdsp.emulated_edge_mc(s->edge_emu_buffer, s->linesize,
+ ptr, s->linesize, 9, 9,
+ src_x, src_y,
+ s->h_edge_pos, s->v_edge_pos);
ptr= s->edge_emu_buffer;
}
}