diff options
Diffstat (limited to 'chromium/third_party/ffmpeg/libavcodec/mpegvideo_motion.c')
-rw-r--r-- | chromium/third_party/ffmpeg/libavcodec/mpegvideo_motion.c | 93 |
1 files changed, 44 insertions, 49 deletions
diff --git a/chromium/third_party/ffmpeg/libavcodec/mpegvideo_motion.c b/chromium/third_party/ffmpeg/libavcodec/mpegvideo_motion.c index 9ec37890584..8a804e216e2 100644 --- a/chromium/third_party/ffmpeg/libavcodec/mpegvideo_motion.c +++ b/chromium/third_party/ffmpeg/libavcodec/mpegvideo_motion.c @@ -28,6 +28,7 @@ #include "avcodec.h" #include "dsputil.h" #include "h261.h" +#include "mpegutils.h" #include "mpegvideo.h" #include "mjpegenc.h" #include "msmpeg4.h" @@ -60,15 +61,15 @@ static void gmc1_motion(MpegEncContext *s, ptr = ref_picture[0] + src_y * linesize + src_x; - 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, linesize, - 17, 17, - src_x, src_y, - s->h_edge_pos, s->v_edge_pos); - ptr = s->edge_emu_buffer; - } + 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, linesize, + 17, 17, + src_x, src_y, + s->h_edge_pos, s->v_edge_pos); + ptr = s->edge_emu_buffer; + } if ((motion_x | motion_y) & 7) { s->dsp.gmc1(dest_y, ptr, linesize, 16, @@ -104,16 +105,16 @@ static void gmc1_motion(MpegEncContext *s, offset = (src_y * uvlinesize) + src_x; 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, uvlinesize, - 9, 9, - src_x, src_y, - s->h_edge_pos >> 1, s->v_edge_pos >> 1); - ptr = s->edge_emu_buffer; - emu = 1; - } + 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, uvlinesize, + 9, 9, + src_x, src_y, + s->h_edge_pos >> 1, s->v_edge_pos >> 1); + ptr = s->edge_emu_buffer; + emu = 1; + } s->dsp.gmc1(dest_cb, ptr, uvlinesize, 8, motion_x & 15, motion_y & 15, 128 - s->no_rounding); @@ -209,7 +210,6 @@ static inline int hpel_motion(MpegEncContext *s, dxy |= (motion_y & 1) << 1; src += src_y * s->linesize + src_x; - if (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, @@ -220,7 +220,6 @@ static inline int hpel_motion(MpegEncContext *s, src = s->edge_emu_buffer; emu = 1; } - } pix_op[dxy](dest, src, s->linesize, 8); return emu; } @@ -254,8 +253,8 @@ void mpeg_motion_internal(MpegEncContext *s, #endif v_edge_pos = s->v_edge_pos >> field_based; - linesize = s->current_picture.f.linesize[0] << field_based; - uvlinesize = s->current_picture.f.linesize[1] << field_based; + linesize = s->current_picture.f->linesize[0] << field_based; + uvlinesize = s->current_picture.f->linesize[1] << field_based; dxy = ((motion_y & 1) << 1) | (motion_x & 1); src_x = s->mb_x * 16 + (motion_x >> 1); @@ -405,7 +404,7 @@ static void mpeg_motion_field(MpegEncContext *s, uint8_t *dest_y, motion_x, motion_y, h, 0, mb_y); } -// FIXME move to dsputil, avg variant, 16x16 version +// FIXME: SIMDify, avg variant, 16x16 version static inline void put_obmc(uint8_t *dst, uint8_t *src[5], int stride) { int x; @@ -619,16 +618,14 @@ static void chroma_4mv_motion(MpegEncContext *s, offset = src_y * s->uvlinesize + src_x; ptr = ref_picture[1] + offset; - 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, 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; - } + 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, 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; } pix_op[dxy](dest_cb, ptr, s->uvlinesize, 8); @@ -779,17 +776,15 @@ static inline void apply_8x8(MpegEncContext *s, dxy &= ~12; ptr = ref_picture[0] + (src_y * s->linesize) + (src_x); - 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, s->linesize, - 9, 9, - src_x, src_y, - s->h_edge_pos, - s->v_edge_pos); - ptr = s->edge_emu_buffer; - } + 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, s->linesize, + 9, 9, + src_x, src_y, + s->h_edge_pos, + s->v_edge_pos); + ptr = s->edge_emu_buffer; } dest = dest_y + ((i & 1) * 8) + (i >> 1) * 8 * s->linesize; qpix_op[1][dxy](dest, ptr, s->linesize); @@ -904,7 +899,7 @@ static av_always_inline void MPV_motion_internal(MpegEncContext *s, } else { if ( s->picture_structure != s->field_select[dir][0] + 1 && s->pict_type != AV_PICTURE_TYPE_B && !s->first_field || !ref_picture[0]) { - ref_picture = s->current_picture_ptr->f.data; + ref_picture = s->current_picture_ptr->f->data; } mpeg_motion(s, dest_y, dest_cb, dest_cr, @@ -921,7 +916,7 @@ static av_always_inline void MPV_motion_internal(MpegEncContext *s, || s->pict_type == AV_PICTURE_TYPE_B || s->first_field) && ref_picture[0]) { ref2picture = ref_picture; } else { - ref2picture = s->current_picture_ptr->f.data; + ref2picture = s->current_picture_ptr->f->data; } mpeg_motion(s, dest_y, dest_cb, dest_cr, @@ -948,7 +943,7 @@ static av_always_inline void MPV_motion_internal(MpegEncContext *s, } } else { if (!ref_picture[0]) { - ref_picture = s->current_picture_ptr->f.data; + ref_picture = s->current_picture_ptr->f->data; } for (i = 0; i < 2; i++) { mpeg_motion(s, dest_y, dest_cb, dest_cr, @@ -963,7 +958,7 @@ static av_always_inline void MPV_motion_internal(MpegEncContext *s, /* opposite parity is always in the same frame if this is * second field */ if (!s->first_field) { - ref_picture = s->current_picture_ptr->f.data; + ref_picture = s->current_picture_ptr->f->data; } } } |