[FFmpeg-cvslog] mpegvideo: Refactor emulated_edge_mc calls
Luca Barbato
git at videolan.org
Wed Apr 13 17:31:54 CEST 2016
ffmpeg | branch: master | Luca Barbato <lu_zero at gentoo.org> | Fri Mar 4 16:57:30 2016 +0100| [39a2d3288e82e4e576c03efb32179ef5a19fff50] | committer: Vittorio Giovara
mpegvideo: Refactor emulated_edge_mc calls
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=39a2d3288e82e4e576c03efb32179ef5a19fff50
---
libavcodec/mpegvideo_motion.c | 78 +++++++++++++++++++----------------------
1 file changed, 36 insertions(+), 42 deletions(-)
diff --git a/libavcodec/mpegvideo_motion.c b/libavcodec/mpegvideo_motion.c
index aaa6e61..42e2612 100644
--- a/libavcodec/mpegvideo_motion.c
+++ b/libavcodec/mpegvideo_motion.c
@@ -227,6 +227,38 @@ static inline int hpel_motion(MpegEncContext *s,
}
static av_always_inline
+void emulated_edge_mc(MpegEncContext *s,
+ int src_x, int src_y,
+ int uvsrc_x, int uvsrc_y,
+ int field_based,
+ uint8_t **ptr_y,
+ uint8_t **ptr_cb,
+ uint8_t **ptr_cr)
+{
+ s->vdsp.emulated_edge_mc(s->sc.edge_emu_buffer, *ptr_y,
+ s->linesize, s->linesize,
+ 17, 17 + field_based,
+ src_x, src_y * (1 << field_based),
+ s->h_edge_pos, s->v_edge_pos);
+ *ptr_y = s->sc.edge_emu_buffer;
+ if (!CONFIG_GRAY || !(s->avctx->flags & AV_CODEC_FLAG_GRAY)) {
+ uint8_t *uvbuf = s->sc.edge_emu_buffer + 18 * s->linesize;
+ s->vdsp.emulated_edge_mc(uvbuf, *ptr_cb,
+ s->uvlinesize, s->uvlinesize,
+ 9, 9 + field_based,
+ uvsrc_x, uvsrc_y * (1 << field_based),
+ s->h_edge_pos >> 1, s->v_edge_pos >> 1);
+ s->vdsp.emulated_edge_mc(uvbuf + 16, *ptr_cr,
+ s->uvlinesize, s->uvlinesize,
+ 9, 9 + field_based,
+ uvsrc_x, uvsrc_y * (1 << field_based),
+ s->h_edge_pos >> 1, s->v_edge_pos >> 1);
+ *ptr_cb = uvbuf;
+ *ptr_cr = uvbuf + 16;
+ }
+}
+
+static av_always_inline
void mpeg_motion_internal(MpegEncContext *s,
uint8_t *dest_y,
uint8_t *dest_cb,
@@ -318,27 +350,8 @@ void mpeg_motion_internal(MpegEncContext *s,
src_y);
return;
}
- s->vdsp.emulated_edge_mc(s->sc.edge_emu_buffer, ptr_y,
- s->linesize, s->linesize,
- 17, 17 + field_based,
- src_x, src_y * (1 << field_based),
- s->h_edge_pos, s->v_edge_pos);
- ptr_y = s->sc.edge_emu_buffer;
- if (!CONFIG_GRAY || !(s->avctx->flags & AV_CODEC_FLAG_GRAY)) {
- uint8_t *uvbuf = s->sc.edge_emu_buffer + 18 * s->linesize;
- s->vdsp.emulated_edge_mc(uvbuf, ptr_cb,
- s->uvlinesize, s->uvlinesize,
- 9, 9 + field_based,
- uvsrc_x, uvsrc_y * (1 << field_based),
- s->h_edge_pos >> 1, s->v_edge_pos >> 1);
- s->vdsp.emulated_edge_mc(uvbuf + 16, ptr_cr,
- s->uvlinesize, s->uvlinesize,
- 9, 9 + field_based,
- uvsrc_x, uvsrc_y * (1 << field_based),
- s->h_edge_pos >> 1, s->v_edge_pos >> 1);
- ptr_cb = uvbuf;
- ptr_cr = uvbuf + 16;
- }
+ emulated_edge_mc(s, src_x, src_y, uvsrc_x, uvsrc_y, field_based,
+ &ptr_y, &ptr_cb, &ptr_cr);
}
/* FIXME use this for field pix too instead of the obnoxious hack which
@@ -539,27 +552,8 @@ 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->sc.edge_emu_buffer, ptr_y,
- s->linesize, s->linesize,
- 17, 17 + field_based,
- src_x, src_y * (1 << field_based),
- s->h_edge_pos, s->v_edge_pos);
- ptr_y = s->sc.edge_emu_buffer;
- if (!CONFIG_GRAY || !(s->avctx->flags & AV_CODEC_FLAG_GRAY)) {
- uint8_t *uvbuf = s->sc.edge_emu_buffer + 18 * s->linesize;
- s->vdsp.emulated_edge_mc(uvbuf, ptr_cb,
- s->uvlinesize, s->uvlinesize,
- 9, 9 + field_based,
- uvsrc_x, uvsrc_y * (1 << field_based),
- s->h_edge_pos >> 1, s->v_edge_pos >> 1);
- s->vdsp.emulated_edge_mc(uvbuf + 16, ptr_cr,
- s->uvlinesize, s->uvlinesize,
- 9, 9 + field_based,
- uvsrc_x, uvsrc_y * (1 << field_based),
- s->h_edge_pos >> 1, s->v_edge_pos >> 1);
- ptr_cb = uvbuf;
- ptr_cr = uvbuf + 16;
- }
+ emulated_edge_mc(s, src_x, src_y, uvsrc_x, uvsrc_y, field_based,
+ &ptr_y, &ptr_cb, &ptr_cr);
}
if (!field_based)
More information about the ffmpeg-cvslog
mailing list