From 2e279598793133ee9c57fd0026d672f076fde4bf Mon Sep 17 00:00:00 2001 From: "Ronald S. Bultje" Date: Wed, 26 Jan 2011 22:35:56 -0500 Subject: [PATCH] Move ff_emulated_edge_mc() into DSPContext. --- libavcodec/cavs.c | 6 +++--- libavcodec/dsputil.c | 1 + libavcodec/dsputil.h | 15 +++++++++++++++ libavcodec/h264.c | 6 +++--- libavcodec/mpegvideo.c | 12 ++++++------ libavcodec/mpegvideo_common.h | 26 +++++++++++++------------- libavcodec/mpegvideo_enc.c | 6 +++--- libavcodec/rv34.c | 6 +++--- libavcodec/snow.c | 2 +- libavcodec/svq3.c | 4 ++-- libavcodec/vc1dec.c | 18 +++++++++--------- libavcodec/vp3.c | 2 +- libavcodec/vp56.c | 2 +- libavcodec/vp8.c | 2 +- libavcodec/wmv2.c | 6 +++--- 15 files changed, 65 insertions(+), 49 deletions(-) diff --git a/libavcodec/cavs.c b/libavcodec/cavs.c index 3958cf8093..db49ef3e67 100644 --- a/libavcodec/cavs.c +++ b/libavcodec/cavs.c @@ -353,7 +353,7 @@ static inline void mc_dir_part(AVSContext *h,Picture *pic,int square, || full_my < 0-extra_height || full_mx + 16/*FIXME*/ > pic_width + extra_width || full_my + 16/*FIXME*/ > pic_height + extra_height){ - ff_emulated_edge_mc(s->edge_emu_buffer, src_y - 2 - 2*h->l_stride, h->l_stride, + s->dsp.emulated_edge_mc(s->edge_emu_buffer, src_y - 2 - 2*h->l_stride, h->l_stride, 16+5, 16+5/*FIXME*/, full_mx-2, full_my-2, pic_width, pic_height); src_y= s->edge_emu_buffer + 2 + 2*h->l_stride; emu=1; @@ -365,14 +365,14 @@ static inline void mc_dir_part(AVSContext *h,Picture *pic,int square, } if(emu){ - ff_emulated_edge_mc(s->edge_emu_buffer, src_cb, h->c_stride, + s->dsp.emulated_edge_mc(s->edge_emu_buffer, src_cb, h->c_stride, 9, 9/*FIXME*/, (mx>>3), (my>>3), pic_width>>1, pic_height>>1); src_cb= s->edge_emu_buffer; } chroma_op(dest_cb, src_cb, h->c_stride, chroma_height, mx&7, my&7); if(emu){ - ff_emulated_edge_mc(s->edge_emu_buffer, src_cr, h->c_stride, + s->dsp.emulated_edge_mc(s->edge_emu_buffer, src_cr, h->c_stride, 9, 9/*FIXME*/, (mx>>3), (my>>3), pic_width>>1, pic_height>>1); src_cr= s->edge_emu_buffer; } diff --git a/libavcodec/dsputil.c b/libavcodec/dsputil.c index fafe5f52d7..f604f0e7f9 100644 --- a/libavcodec/dsputil.c +++ b/libavcodec/dsputil.c @@ -4218,6 +4218,7 @@ av_cold void dsputil_init(DSPContext* c, AVCodecContext *avctx) c->add_pixels8 = add_pixels8_c; c->add_pixels4 = add_pixels4_c; c->sum_abs_dctelem = sum_abs_dctelem_c; + c->emulated_edge_mc = ff_emulated_edge_mc; c->gmc1 = gmc1_c; c->gmc = ff_gmc_c; c->clear_block = clear_block_c; diff --git a/libavcodec/dsputil.h b/libavcodec/dsputil.h index 74831cf41b..9a1172b1dc 100644 --- a/libavcodec/dsputil.h +++ b/libavcodec/dsputil.h @@ -215,6 +215,21 @@ typedef struct DSPContext { void (*add_pixels8)(uint8_t *pixels, DCTELEM *block, int line_size); void (*add_pixels4)(uint8_t *pixels, DCTELEM *block, int line_size); int (*sum_abs_dctelem)(DCTELEM *block/*align 16*/); + /** + * Motion estimation with emulated edge values. + * @param buf pointer to destination buffer (unaligned) + * @param src pointer to pixel source (unaligned) + * @param linesize width (in pixels) for src/buf + * @param block_w number of pixels (per row) to copy to buf + * @param block_h nummber of pixel rows to copy to buf + * @param src_x offset of src to start of row - this may be negative + * @param src_y offset of src to top of image - this may be negative + * @param w width of src in pixels + * @param h height of src in pixels + */ + void (*emulated_edge_mc)(uint8_t *buf, const uint8_t *src, int linesize, + int block_w, int block_h, + int src_x, int src_y, int w, int h); /** * translational global motion compensation. */ diff --git a/libavcodec/h264.c b/libavcodec/h264.c index 8ef9b76f44..2a3357b05c 100644 --- a/libavcodec/h264.c +++ b/libavcodec/h264.c @@ -361,7 +361,7 @@ static inline void mc_dir_part(H264Context *h, Picture *pic, int n, int square, || full_my < 0-extra_height || full_mx + 16/*FIXME*/ > pic_width + extra_width || full_my + 16/*FIXME*/ > pic_height + extra_height){ - ff_emulated_edge_mc(s->edge_emu_buffer, src_y - 2 - 2*h->mb_linesize, h->mb_linesize, 16+5, 16+5/*FIXME*/, full_mx-2, full_my-2, pic_width, pic_height); + s->dsp.emulated_edge_mc(s->edge_emu_buffer, src_y - 2 - 2*h->mb_linesize, h->mb_linesize, 16+5, 16+5/*FIXME*/, full_mx-2, full_my-2, pic_width, pic_height); src_y= s->edge_emu_buffer + 2 + 2*h->mb_linesize; emu=1; } @@ -382,13 +382,13 @@ static inline void mc_dir_part(H264Context *h, Picture *pic, int n, int square, src_cr= pic->data[2] + (mx>>3) + (my>>3)*h->mb_uvlinesize; if(emu){ - ff_emulated_edge_mc(s->edge_emu_buffer, src_cb, h->mb_uvlinesize, 9, 9/*FIXME*/, (mx>>3), (my>>3), pic_width>>1, pic_height>>1); + s->dsp.emulated_edge_mc(s->edge_emu_buffer, src_cb, h->mb_uvlinesize, 9, 9/*FIXME*/, (mx>>3), (my>>3), pic_width>>1, pic_height>>1); src_cb= s->edge_emu_buffer; } chroma_op(dest_cb, src_cb, h->mb_uvlinesize, chroma_height, mx&7, my&7); if(emu){ - ff_emulated_edge_mc(s->edge_emu_buffer, src_cr, h->mb_uvlinesize, 9, 9/*FIXME*/, (mx>>3), (my>>3), pic_width>>1, pic_height>>1); + s->dsp.emulated_edge_mc(s->edge_emu_buffer, src_cr, h->mb_uvlinesize, 9, 9/*FIXME*/, (mx>>3), (my>>3), pic_width>>1, pic_height>>1); src_cr= s->edge_emu_buffer; } chroma_op(dest_cr, src_cr, h->mb_uvlinesize, chroma_height, mx&7, my&7); diff --git a/libavcodec/mpegvideo.c b/libavcodec/mpegvideo.c index 65221f34f8..c8706bcf60 100644 --- a/libavcodec/mpegvideo.c +++ b/libavcodec/mpegvideo.c @@ -1479,7 +1479,7 @@ static inline int hpel_motion_lowres(MpegEncContext *s, if( (unsigned)src_x > h_edge_pos - (!!sx) - w || (unsigned)src_y >(v_edge_pos >> field_based) - (!!sy) - h){ - ff_emulated_edge_mc(s->edge_emu_buffer, src, s->linesize, w+1, (h+1)<dsp.emulated_edge_mc(s->edge_emu_buffer, src, s->linesize, w+1, (h+1)<edge_emu_buffer; emu=1; @@ -1552,14 +1552,14 @@ static av_always_inline void mpeg_motion_lowres(MpegEncContext *s, if( (unsigned)src_x > h_edge_pos - (!!sx) - 2*block_s || (unsigned)src_y >(v_edge_pos >> field_based) - (!!sy) - h){ - ff_emulated_edge_mc(s->edge_emu_buffer, ptr_y, s->linesize, 17, 17+field_based, + s->dsp.emulated_edge_mc(s->edge_emu_buffer, ptr_y, s->linesize, 17, 17+field_based, src_x, src_y<edge_emu_buffer; if(!CONFIG_GRAY || !(s->flags&CODEC_FLAG_GRAY)){ uint8_t *uvbuf= s->edge_emu_buffer+18*s->linesize; - ff_emulated_edge_mc(uvbuf , ptr_cb, s->uvlinesize, 9, 9+field_based, + s->dsp.emulated_edge_mc(uvbuf , ptr_cb, s->uvlinesize, 9, 9+field_based, uvsrc_x, uvsrc_y<>1, v_edge_pos>>1); - ff_emulated_edge_mc(uvbuf+16, ptr_cr, s->uvlinesize, 9, 9+field_based, + s->dsp.emulated_edge_mc(uvbuf+16, ptr_cr, s->uvlinesize, 9, 9+field_based, uvsrc_x, uvsrc_y<>1, v_edge_pos>>1); ptr_cb= uvbuf; ptr_cr= uvbuf+16; @@ -1625,7 +1625,7 @@ static inline void chroma_4mv_motion_lowres(MpegEncContext *s, if(s->flags&CODEC_FLAG_EMU_EDGE){ if( (unsigned)src_x > h_edge_pos - (!!sx) - block_s || (unsigned)src_y > v_edge_pos - (!!sy) - block_s){ - ff_emulated_edge_mc(s->edge_emu_buffer, ptr, s->uvlinesize, 9, 9, src_x, src_y, h_edge_pos, v_edge_pos); + s->dsp.emulated_edge_mc(s->edge_emu_buffer, ptr, s->uvlinesize, 9, 9, src_x, src_y, h_edge_pos, v_edge_pos); ptr= s->edge_emu_buffer; emu=1; } @@ -1636,7 +1636,7 @@ static inline void chroma_4mv_motion_lowres(MpegEncContext *s, ptr = ref_picture[2] + offset; if(emu){ - ff_emulated_edge_mc(s->edge_emu_buffer, ptr, s->uvlinesize, 9, 9, src_x, src_y, h_edge_pos, v_edge_pos); + s->dsp.emulated_edge_mc(s->edge_emu_buffer, ptr, s->uvlinesize, 9, 9, src_x, src_y, h_edge_pos, v_edge_pos); ptr= s->edge_emu_buffer; } pix_op[op_index](dest_cr, ptr, s->uvlinesize, block_s, sx, sy); diff --git a/libavcodec/mpegvideo_common.h b/libavcodec/mpegvideo_common.h index 135bd1f557..d607e45ae1 100644 --- a/libavcodec/mpegvideo_common.h +++ b/libavcodec/mpegvideo_common.h @@ -83,7 +83,7 @@ static inline void gmc1_motion(MpegEncContext *s, if(s->flags&CODEC_FLAG_EMU_EDGE){ if( (unsigned)src_x >= s->h_edge_pos - 17 || (unsigned)src_y >= s->v_edge_pos - 17){ - ff_emulated_edge_mc(s->edge_emu_buffer, ptr, linesize, 17, 17, src_x, src_y, s->h_edge_pos, s->v_edge_pos); + s->dsp.emulated_edge_mc(s->edge_emu_buffer, ptr, linesize, 17, 17, src_x, src_y, s->h_edge_pos, s->v_edge_pos); ptr= s->edge_emu_buffer; } } @@ -122,7 +122,7 @@ static inline void gmc1_motion(MpegEncContext *s, if(s->flags&CODEC_FLAG_EMU_EDGE){ if( (unsigned)src_x >= (s->h_edge_pos>>1) - 9 || (unsigned)src_y >= (s->v_edge_pos>>1) - 9){ - ff_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->dsp.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); ptr= s->edge_emu_buffer; emu=1; } @@ -131,7 +131,7 @@ static inline void gmc1_motion(MpegEncContext *s, ptr = ref_picture[2] + offset; if(emu){ - ff_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->dsp.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); ptr= s->edge_emu_buffer; } s->dsp.gmc1(dest_cr, ptr, uvlinesize, 8, motion_x&15, motion_y&15, 128 - s->no_rounding); @@ -223,7 +223,7 @@ static inline int hpel_motion(MpegEncContext *s, if(s->unrestricted_mv && (s->flags&CODEC_FLAG_EMU_EDGE)){ if( (unsigned)src_x > h_edge_pos - (motion_x&1) - w || (unsigned)src_y > v_edge_pos - (motion_y&1) - h){ - ff_emulated_edge_mc(s->edge_emu_buffer, src, s->linesize, w+1, (h+1)<dsp.emulated_edge_mc(s->edge_emu_buffer, src, s->linesize, w+1, (h+1)<v_edge_pos); src= s->edge_emu_buffer; emu=1; @@ -315,19 +315,19 @@ if(s->quarter_sample) "MPEG motion vector out of boundary (%d %d)\n", src_x, src_y); return; } - ff_emulated_edge_mc(s->edge_emu_buffer, ptr_y, s->linesize, + s->dsp.emulated_edge_mc(s->edge_emu_buffer, ptr_y, s->linesize, 17, 17+field_based, src_x, src_y<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; - ff_emulated_edge_mc(uvbuf , + s->dsp.emulated_edge_mc(uvbuf , ptr_cb, s->uvlinesize, 9, 9+field_based, uvsrc_x, uvsrc_y<h_edge_pos>>1, s->v_edge_pos>>1); - ff_emulated_edge_mc(uvbuf+16, + s->dsp.emulated_edge_mc(uvbuf+16, ptr_cr, s->uvlinesize, 9, 9+field_based, uvsrc_x, uvsrc_y< s->h_edge_pos - (motion_x&3) - 16 || (unsigned)src_y > v_edge_pos - (motion_y&3) - h ){ - ff_emulated_edge_mc(s->edge_emu_buffer, ptr_y, s->linesize, + s->dsp.emulated_edge_mc(s->edge_emu_buffer, ptr_y, s->linesize, 17, 17+field_based, src_x, src_y<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; - ff_emulated_edge_mc(uvbuf, ptr_cb, s->uvlinesize, + s->dsp.emulated_edge_mc(uvbuf, ptr_cb, s->uvlinesize, 9, 9 + field_based, uvsrc_x, uvsrc_y<h_edge_pos>>1, s->v_edge_pos>>1); - ff_emulated_edge_mc(uvbuf + 16, ptr_cr, s->uvlinesize, + s->dsp.emulated_edge_mc(uvbuf + 16, ptr_cr, s->uvlinesize, 9, 9 + field_based, uvsrc_x, uvsrc_y<h_edge_pos>>1, s->v_edge_pos>>1); @@ -590,7 +590,7 @@ static inline void chroma_4mv_motion(MpegEncContext *s, if(s->flags&CODEC_FLAG_EMU_EDGE){ if( (unsigned)src_x > (s->h_edge_pos>>1) - (dxy &1) - 8 || (unsigned)src_y > (s->v_edge_pos>>1) - (dxy>>1) - 8){ - ff_emulated_edge_mc(s->edge_emu_buffer, ptr, s->uvlinesize, + s->dsp.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); ptr= s->edge_emu_buffer; @@ -601,7 +601,7 @@ static inline void chroma_4mv_motion(MpegEncContext *s, ptr = ref_picture[2] + offset; if(emu){ - ff_emulated_edge_mc(s->edge_emu_buffer, ptr, s->uvlinesize, + s->dsp.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); ptr= s->edge_emu_buffer; @@ -762,7 +762,7 @@ static av_always_inline void MPV_motion_internal(MpegEncContext *s, if(s->flags&CODEC_FLAG_EMU_EDGE){ if( (unsigned)src_x > s->h_edge_pos - (motion_x&3) - 8 || (unsigned)src_y > s->v_edge_pos - (motion_y&3) - 8 ){ - ff_emulated_edge_mc(s->edge_emu_buffer, ptr, + s->dsp.emulated_edge_mc(s->edge_emu_buffer, ptr, s->linesize, 9, 9, src_x, src_y, s->h_edge_pos, s->v_edge_pos); diff --git a/libavcodec/mpegvideo_enc.c b/libavcodec/mpegvideo_enc.c index fa285ca371..6167a9b20e 100644 --- a/libavcodec/mpegvideo_enc.c +++ b/libavcodec/mpegvideo_enc.c @@ -1548,11 +1548,11 @@ static av_always_inline void encode_mb_internal(MpegEncContext *s, int motion_x, if(mb_x*16+16 > s->width || mb_y*16+16 > s->height){ uint8_t *ebuf= s->edge_emu_buffer + 32; - ff_emulated_edge_mc(ebuf , ptr_y , wrap_y,16,16,mb_x*16,mb_y*16, s->width , s->height); + s->dsp.emulated_edge_mc(ebuf , ptr_y , wrap_y,16,16,mb_x*16,mb_y*16, s->width , s->height); ptr_y= ebuf; - ff_emulated_edge_mc(ebuf+18*wrap_y , ptr_cb, wrap_c, 8, mb_block_height, mb_x*8, mb_y*8, s->width>>1, s->height>>1); + s->dsp.emulated_edge_mc(ebuf+18*wrap_y , ptr_cb, wrap_c, 8, mb_block_height, mb_x*8, mb_y*8, s->width>>1, s->height>>1); ptr_cb= ebuf+18*wrap_y; - ff_emulated_edge_mc(ebuf+18*wrap_y+8, ptr_cr, wrap_c, 8, mb_block_height, mb_x*8, mb_y*8, s->width>>1, s->height>>1); + s->dsp.emulated_edge_mc(ebuf+18*wrap_y+8, ptr_cr, wrap_c, 8, mb_block_height, mb_x*8, mb_y*8, s->width>>1, s->height>>1); ptr_cr= ebuf+18*wrap_y+8; } diff --git a/libavcodec/rv34.c b/libavcodec/rv34.c index b586aa0b86..08fa8a90ff 100644 --- a/libavcodec/rv34.c +++ b/libavcodec/rv34.c @@ -718,12 +718,12 @@ static inline void rv34_mc(RV34DecContext *r, const int block_type, uint8_t *uvbuf= s->edge_emu_buffer + 22 * s->linesize; srcY -= 2 + 2*s->linesize; - ff_emulated_edge_mc(s->edge_emu_buffer, srcY, s->linesize, (width<<3)+6, (height<<3)+6, + s->dsp.emulated_edge_mc(s->edge_emu_buffer, srcY, s->linesize, (width<<3)+6, (height<<3)+6, src_x - 2, src_y - 2, s->h_edge_pos, s->v_edge_pos); srcY = s->edge_emu_buffer + 2 + 2*s->linesize; - ff_emulated_edge_mc(uvbuf , srcU, s->uvlinesize, (width<<2)+1, (height<<2)+1, + s->dsp.emulated_edge_mc(uvbuf , srcU, s->uvlinesize, (width<<2)+1, (height<<2)+1, uvsrc_x, uvsrc_y, s->h_edge_pos >> 1, s->v_edge_pos >> 1); - ff_emulated_edge_mc(uvbuf + 16, srcV, s->uvlinesize, (width<<2)+1, (height<<2)+1, + s->dsp.emulated_edge_mc(uvbuf + 16, srcV, s->uvlinesize, (width<<2)+1, (height<<2)+1, uvsrc_x, uvsrc_y, s->h_edge_pos >> 1, s->v_edge_pos >> 1); srcU = uvbuf; srcV = uvbuf + 16; diff --git a/libavcodec/snow.c b/libavcodec/snow.c index 8a259af4dd..9ab9fed71f 100644 --- a/libavcodec/snow.c +++ b/libavcodec/snow.c @@ -1171,7 +1171,7 @@ static void pred_block(SnowContext *s, uint8_t *dst, uint8_t *tmp, int stride, i src += sx + sy*stride; if( (unsigned)sx >= w - b_w - (HTAPS_MAX-2) || (unsigned)sy >= h - b_h - (HTAPS_MAX-2)){ - ff_emulated_edge_mc(tmp + MB_SIZE, src, stride, b_w+HTAPS_MAX-1, b_h+HTAPS_MAX-1, sx, sy, w, h); + s->dsp.emulated_edge_mc(tmp + MB_SIZE, src, stride, b_w+HTAPS_MAX-1, b_h+HTAPS_MAX-1, sx, sy, w, h); src= tmp + MB_SIZE; } // assert(b_w == b_h || 2*b_w == b_h || b_w == 2*b_h); diff --git a/libavcodec/svq3.c b/libavcodec/svq3.c index 9d87710595..5162e99243 100644 --- a/libavcodec/svq3.c +++ b/libavcodec/svq3.c @@ -283,7 +283,7 @@ static inline void svq3_mc_dir_part(MpegEncContext *s, src = pic->data[0] + mx + my*s->linesize; if (emu) { - ff_emulated_edge_mc(s->edge_emu_buffer, src, s->linesize, (width + 1), (height + 1), + s->dsp.emulated_edge_mc(s->edge_emu_buffer, src, s->linesize, (width + 1), (height + 1), mx, my, s->h_edge_pos, s->v_edge_pos); src = s->edge_emu_buffer; } @@ -304,7 +304,7 @@ static inline void svq3_mc_dir_part(MpegEncContext *s, src = pic->data[i] + mx + my*s->uvlinesize; if (emu) { - ff_emulated_edge_mc(s->edge_emu_buffer, src, s->uvlinesize, (width + 1), (height + 1), + s->dsp.emulated_edge_mc(s->edge_emu_buffer, src, s->uvlinesize, (width + 1), (height + 1), mx, my, (s->h_edge_pos >> 1), (s->v_edge_pos >> 1)); src = s->edge_emu_buffer; } diff --git a/libavcodec/vc1dec.c b/libavcodec/vc1dec.c index 056b435055..3bd2cce297 100644 --- a/libavcodec/vc1dec.c +++ b/libavcodec/vc1dec.c @@ -288,12 +288,12 @@ static void vc1_mc_1mv(VC1Context *v, int dir) uint8_t *uvbuf= s->edge_emu_buffer + 19 * s->linesize; srcY -= s->mspel * (1 + s->linesize); - ff_emulated_edge_mc(s->edge_emu_buffer, srcY, s->linesize, 17+s->mspel*2, 17+s->mspel*2, + s->dsp.emulated_edge_mc(s->edge_emu_buffer, srcY, s->linesize, 17+s->mspel*2, 17+s->mspel*2, src_x - s->mspel, src_y - s->mspel, s->h_edge_pos, s->v_edge_pos); srcY = s->edge_emu_buffer; - ff_emulated_edge_mc(uvbuf , srcU, s->uvlinesize, 8+1, 8+1, + s->dsp.emulated_edge_mc(uvbuf , srcU, s->uvlinesize, 8+1, 8+1, uvsrc_x, uvsrc_y, s->h_edge_pos >> 1, s->v_edge_pos >> 1); - ff_emulated_edge_mc(uvbuf + 16, srcV, s->uvlinesize, 8+1, 8+1, + s->dsp.emulated_edge_mc(uvbuf + 16, srcV, s->uvlinesize, 8+1, 8+1, uvsrc_x, uvsrc_y, s->h_edge_pos >> 1, s->v_edge_pos >> 1); srcU = uvbuf; srcV = uvbuf + 16; @@ -403,7 +403,7 @@ static void vc1_mc_4mv_luma(VC1Context *v, int n) || (unsigned)(src_x - s->mspel) > s->h_edge_pos - (mx&3) - 8 - s->mspel*2 || (unsigned)(src_y - s->mspel) > s->v_edge_pos - (my&3) - 8 - s->mspel*2){ srcY -= s->mspel * (1 + s->linesize); - ff_emulated_edge_mc(s->edge_emu_buffer, srcY, s->linesize, 9+s->mspel*2, 9+s->mspel*2, + s->dsp.emulated_edge_mc(s->edge_emu_buffer, srcY, s->linesize, 9+s->mspel*2, 9+s->mspel*2, src_x - s->mspel, src_y - s->mspel, s->h_edge_pos, s->v_edge_pos); srcY = s->edge_emu_buffer; /* if we deal with range reduction we need to scale source blocks */ @@ -537,9 +537,9 @@ static void vc1_mc_4mv_chroma(VC1Context *v) if(v->rangeredfrm || (v->mv_mode == MV_PMODE_INTENSITY_COMP) || (unsigned)uvsrc_x > (s->h_edge_pos >> 1) - 9 || (unsigned)uvsrc_y > (s->v_edge_pos >> 1) - 9){ - ff_emulated_edge_mc(s->edge_emu_buffer , srcU, s->uvlinesize, 8+1, 8+1, + s->dsp.emulated_edge_mc(s->edge_emu_buffer , srcU, s->uvlinesize, 8+1, 8+1, uvsrc_x, uvsrc_y, s->h_edge_pos >> 1, s->v_edge_pos >> 1); - ff_emulated_edge_mc(s->edge_emu_buffer + 16, srcV, s->uvlinesize, 8+1, 8+1, + s->dsp.emulated_edge_mc(s->edge_emu_buffer + 16, srcV, s->uvlinesize, 8+1, 8+1, uvsrc_x, uvsrc_y, s->h_edge_pos >> 1, s->v_edge_pos >> 1); srcU = s->edge_emu_buffer; srcV = s->edge_emu_buffer + 16; @@ -872,12 +872,12 @@ static void vc1_interp_mc(VC1Context *v) uint8_t *uvbuf= s->edge_emu_buffer + 19 * s->linesize; srcY -= s->mspel * (1 + s->linesize); - ff_emulated_edge_mc(s->edge_emu_buffer, srcY, s->linesize, 17+s->mspel*2, 17+s->mspel*2, + s->dsp.emulated_edge_mc(s->edge_emu_buffer, srcY, s->linesize, 17+s->mspel*2, 17+s->mspel*2, src_x - s->mspel, src_y - s->mspel, s->h_edge_pos, s->v_edge_pos); srcY = s->edge_emu_buffer; - ff_emulated_edge_mc(uvbuf , srcU, s->uvlinesize, 8+1, 8+1, + s->dsp.emulated_edge_mc(uvbuf , srcU, s->uvlinesize, 8+1, 8+1, uvsrc_x, uvsrc_y, s->h_edge_pos >> 1, s->v_edge_pos >> 1); - ff_emulated_edge_mc(uvbuf + 16, srcV, s->uvlinesize, 8+1, 8+1, + s->dsp.emulated_edge_mc(uvbuf + 16, srcV, s->uvlinesize, 8+1, 8+1, uvsrc_x, uvsrc_y, s->h_edge_pos >> 1, s->v_edge_pos >> 1); srcU = uvbuf; srcV = uvbuf + 16; diff --git a/libavcodec/vp3.c b/libavcodec/vp3.c index 7ba878eeff..06f55f6d47 100644 --- a/libavcodec/vp3.c +++ b/libavcodec/vp3.c @@ -1432,7 +1432,7 @@ static void render_slice(Vp3DecodeContext *s, int slice) if(stride<0) temp -= 9*stride; else temp += 9*stride; - ff_emulated_edge_mc(temp, motion_source, stride, 9, 9, src_x, src_y, plane_width, plane_height); + s->dsp.emulated_edge_mc(temp, motion_source, stride, 9, 9, src_x, src_y, plane_width, plane_height); motion_source= temp; } } diff --git a/libavcodec/vp56.c b/libavcodec/vp56.c index 2e5f2d664a..3412e3dce2 100644 --- a/libavcodec/vp56.c +++ b/libavcodec/vp56.c @@ -337,7 +337,7 @@ static void vp56_mc(VP56Context *s, int b, int plane, uint8_t *src, if (x<0 || x+12>=s->plane_width[plane] || y<0 || y+12>=s->plane_height[plane]) { - ff_emulated_edge_mc(s->edge_emu_buffer, + s->dsp.emulated_edge_mc(s->edge_emu_buffer, src + s->block_offset[b] + (dy-2)*stride + (dx-2), stride, 12, 12, x, y, s->plane_width[plane], diff --git a/libavcodec/vp8.c b/libavcodec/vp8.c index 66a7c4dec4..ef4e270f6c 100644 --- a/libavcodec/vp8.c +++ b/libavcodec/vp8.c @@ -1234,7 +1234,7 @@ void vp8_mc(VP8Context *s, int luma, src += y_off * linesize + x_off; if (x_off < mx_idx || x_off >= width - block_w - idx[2][mx] || y_off < my_idx || y_off >= height - block_h - idx[2][my]) { - ff_emulated_edge_mc(s->edge_emu_buffer, src - my_idx * linesize - mx_idx, linesize, + s->dsp.emulated_edge_mc(s->edge_emu_buffer, src - my_idx * linesize - mx_idx, linesize, block_w + idx[1][mx], block_h + idx[1][my], x_off - mx_idx, y_off - my_idx, width, height); src = s->edge_emu_buffer + mx_idx + linesize * my_idx; diff --git a/libavcodec/wmv2.c b/libavcodec/wmv2.c index e872b44f93..32aaa8f6df 100644 --- a/libavcodec/wmv2.c +++ b/libavcodec/wmv2.c @@ -102,7 +102,7 @@ void ff_mspel_motion(MpegEncContext *s, if(s->flags&CODEC_FLAG_EMU_EDGE){ if(src_x<1 || src_y<1 || src_x + 17 >= s->h_edge_pos || src_y + h+1 >= v_edge_pos){ - ff_emulated_edge_mc(s->edge_emu_buffer, ptr - 1 - s->linesize, s->linesize, 19, 19, + s->dsp.emulated_edge_mc(s->edge_emu_buffer, ptr - 1 - s->linesize, s->linesize, 19, 19, src_x-1, src_y-1, s->h_edge_pos, s->v_edge_pos); ptr= s->edge_emu_buffer + 1 + s->linesize; emu=1; @@ -143,7 +143,7 @@ void ff_mspel_motion(MpegEncContext *s, offset = (src_y * uvlinesize) + src_x; ptr = ref_picture[1] + offset; if(emu){ - ff_emulated_edge_mc(s->edge_emu_buffer, ptr, s->uvlinesize, 9, 9, + s->dsp.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); ptr= s->edge_emu_buffer; } @@ -151,7 +151,7 @@ void ff_mspel_motion(MpegEncContext *s, ptr = ref_picture[2] + offset; if(emu){ - ff_emulated_edge_mc(s->edge_emu_buffer, ptr, s->uvlinesize, 9, 9, + s->dsp.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); ptr= s->edge_emu_buffer; }