From c10470035e607bb3586e31bb32d7b840d5abe49b Mon Sep 17 00:00:00 2001 From: "Ronald S. Bultje" Date: Sun, 10 Mar 2013 13:32:10 -0700 Subject: [PATCH 1/4] mimic: Use hpeldsp instead of dsputil for half-pel functions MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Martin Storsjö --- configure | 2 +- libavcodec/mimic.c | 7 +++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/configure b/configure index a7e8cdf875..65ee8c8fc9 100755 --- a/configure +++ b/configure @@ -1587,7 +1587,7 @@ lagarith_decoder_select="dsputil" ljpeg_encoder_select="aandcttables mpegvideoenc" loco_decoder_select="golomb" mdec_decoder_select="dsputil error_resilience mpegvideo" -mimic_decoder_select="dsputil" +mimic_decoder_select="dsputil hpeldsp" mjpeg_decoder_select="dsputil" mjpegb_decoder_select="dsputil" mjpeg_encoder_select="aandcttables dsputil mpegvideoenc" diff --git a/libavcodec/mimic.c b/libavcodec/mimic.c index 0fe83137bb..84e33914cd 100644 --- a/libavcodec/mimic.c +++ b/libavcodec/mimic.c @@ -28,6 +28,7 @@ #include "get_bits.h" #include "bytestream.h" #include "dsputil.h" +#include "hpeldsp.h" #include "thread.h" #define MIMIC_HEADER_SIZE 20 @@ -52,6 +53,7 @@ typedef struct { GetBitContext gb; ScanTable scantable; DSPContext dsp; + HpelDSPContext hdsp; VLC vlc; /* Kept in the context so multithreading can have a constant to read from */ @@ -144,6 +146,7 @@ static av_cold int mimic_decode_init(AVCodecContext *avctx) return ret; } ff_dsputil_init(&ctx->dsp, avctx); + ff_hpeldsp_init(&ctx->hdsp, avctx->flags); ff_init_scantable(ctx->dsp.idct_permutation, &ctx->scantable, col_zag); for (i = 0; i < FF_ARRAY_ELEMS(ctx->frames); i++) { @@ -304,7 +307,7 @@ static int decode(MimicContext *ctx, int quality, int num_coeffs, cur_row, 0); p += src - ctx->flipped_ptrs[ctx->prev_index].data[plane]; - ctx->dsp.put_pixels_tab[1][0](dst, p, stride, 8); + ctx->hdsp.put_pixels_tab[1][0](dst, p, stride, 8); } else { av_log(ctx->avctx, AV_LOG_ERROR, "No such backreference! Buggy sample.\n"); @@ -313,7 +316,7 @@ static int decode(MimicContext *ctx, int quality, int num_coeffs, } else { ff_thread_await_progress(&ctx->frames[ctx->prev_index], cur_row, 0); - ctx->dsp.put_pixels_tab[1][0](dst, src, stride, 8); + ctx->hdsp.put_pixels_tab[1][0](dst, src, stride, 8); } src += 8; dst += 8; From 6caa44aa7df0ee5aba94f4cfc26a5d2cdcba8115 Mon Sep 17 00:00:00 2001 From: "Ronald S. Bultje" Date: Sun, 10 Mar 2013 13:38:45 -0700 Subject: [PATCH 2/4] svq1: Use hpeldsp instead of dsputil for half-pel functions MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This makes svq1 independent of dsputil. Signed-off-by: Martin Storsjö --- configure | 2 +- libavcodec/svq1dec.c | 22 +++++++++++----------- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/configure b/configure index 65ee8c8fc9..c9013724b2 100755 --- a/configure +++ b/configure @@ -1640,7 +1640,7 @@ rv40_decoder_select="error_resilience golomb h264chroma h264pred h264qpel mpegvi shorten_decoder_select="golomb" sipr_decoder_select="lsp" sp5x_decoder_select="dsputil" -svq1_decoder_select="dsputil" +svq1_decoder_select="hpeldsp" svq1_encoder_select="aandcttables dsputil mpegvideoenc" svq3_decoder_select="golomb h264chroma h264dsp h264pred h264qpel mpegvideo videodsp" svq3_decoder_suggest="error_resilience zlib" diff --git a/libavcodec/svq1dec.c b/libavcodec/svq1dec.c index 4d03bac21d..4b8b6568ac 100644 --- a/libavcodec/svq1dec.c +++ b/libavcodec/svq1dec.c @@ -33,8 +33,8 @@ */ #include "avcodec.h" -#include "dsputil.h" #include "get_bits.h" +#include "hpeldsp.h" #include "internal.h" #include "mathops.h" #include "svq1.h" @@ -58,7 +58,7 @@ typedef struct svq1_pmv_s { } svq1_pmv; typedef struct SVQ1Context { - DSPContext dsp; + HpelDSPContext hdsp; GetBitContext gb; AVFrame *prev; int width; @@ -320,7 +320,7 @@ static void svq1_skip_block(uint8_t *current, uint8_t *previous, } } -static int svq1_motion_inter_block(DSPContext *dsp, GetBitContext *bitbuf, +static int svq1_motion_inter_block(HpelDSPContext *hdsp, GetBitContext *bitbuf, uint8_t *current, uint8_t *previous, int pitch, svq1_pmv *motion, int x, int y, int width, int height) @@ -359,12 +359,12 @@ static int svq1_motion_inter_block(DSPContext *dsp, GetBitContext *bitbuf, src = &previous[(x + (mv.x >> 1)) + (y + (mv.y >> 1)) * pitch]; dst = current; - dsp->put_pixels_tab[0][(mv.y & 1) << 1 | (mv.x & 1)](dst, src, pitch, 16); + hdsp->put_pixels_tab[0][(mv.y & 1) << 1 | (mv.x & 1)](dst, src, pitch, 16); return 0; } -static int svq1_motion_inter_4v_block(DSPContext *dsp, GetBitContext *bitbuf, +static int svq1_motion_inter_4v_block(HpelDSPContext *hdsp, GetBitContext *bitbuf, uint8_t *current, uint8_t *previous, int pitch, svq1_pmv *motion, int x, int y, int width, int height) @@ -433,7 +433,7 @@ static int svq1_motion_inter_4v_block(DSPContext *dsp, GetBitContext *bitbuf, src = &previous[(x + (mvx >> 1)) + (y + (mvy >> 1)) * pitch]; dst = current; - dsp->put_pixels_tab[1][((mvy & 1) << 1) | (mvx & 1)](dst, src, pitch, 8); + hdsp->put_pixels_tab[1][((mvy & 1) << 1) | (mvx & 1)](dst, src, pitch, 8); /* select next block */ if (i & 1) @@ -445,7 +445,7 @@ static int svq1_motion_inter_4v_block(DSPContext *dsp, GetBitContext *bitbuf, return 0; } -static int svq1_decode_delta_block(AVCodecContext *avctx, DSPContext *dsp, +static int svq1_decode_delta_block(AVCodecContext *avctx, HpelDSPContext *hdsp, GetBitContext *bitbuf, uint8_t *current, uint8_t *previous, int pitch, svq1_pmv *motion, int x, int y, @@ -473,7 +473,7 @@ static int svq1_decode_delta_block(AVCodecContext *avctx, DSPContext *dsp, break; case SVQ1_BLOCK_INTER: - result = svq1_motion_inter_block(dsp, bitbuf, current, previous, + result = svq1_motion_inter_block(hdsp, bitbuf, current, previous, pitch, motion, x, y, width, height); if (result != 0) { @@ -484,7 +484,7 @@ static int svq1_decode_delta_block(AVCodecContext *avctx, DSPContext *dsp, break; case SVQ1_BLOCK_INTER_4V: - result = svq1_motion_inter_4v_block(dsp, bitbuf, current, previous, + result = svq1_motion_inter_4v_block(hdsp, bitbuf, current, previous, pitch, motion, x, y, width, height); if (result != 0) { @@ -699,7 +699,7 @@ static int svq1_decode_frame(AVCodecContext *avctx, void *data, for (y = 0; y < height; y += 16) { for (x = 0; x < width; x += 16) { - result = svq1_decode_delta_block(avctx, &s->dsp, + result = svq1_decode_delta_block(avctx, &s->hdsp, &s->gb, ¤t[x], previous, linesize, pmv, x, y, width, height); @@ -748,7 +748,7 @@ static av_cold int svq1_decode_init(AVCodecContext *avctx) s->height = avctx->height + 3 & ~3; avctx->pix_fmt = AV_PIX_FMT_YUV410P; - ff_dsputil_init(&s->dsp, avctx); + ff_hpeldsp_init(&s->hdsp, avctx->flags); INIT_VLC_STATIC(&svq1_block_type, 2, 4, &ff_svq1_block_type_vlc[0][1], 2, 1, From f4fed5a2f97ec843c04af6b91a86dd237a655361 Mon Sep 17 00:00:00 2001 From: "Ronald S. Bultje" Date: Sun, 10 Mar 2013 13:55:07 -0700 Subject: [PATCH 3/4] mpegvideo: Use hpeldsp instead of dsputil for half-pel functions MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This also converts vc1, since that is mpegvideo-based. Signed-off-by: Martin Storsjö --- configure | 2 +- libavcodec/motion_est.c | 28 +++++++++++++++------------- libavcodec/mpegvideo.c | 13 +++++++------ libavcodec/mpegvideo.h | 2 ++ libavcodec/mpegvideo_enc.c | 12 ++++++------ libavcodec/mpegvideo_motion.c | 8 ++++---- libavcodec/vc1dec.c | 13 ++++++------- 7 files changed, 41 insertions(+), 37 deletions(-) diff --git a/configure b/configure index c9013724b2..429bf1f99b 100755 --- a/configure +++ b/configure @@ -1511,7 +1511,7 @@ mdct_select="fft" rdft_select="fft" mpegaudio_select="mpegaudiodsp" mpegaudiodsp_select="dct" -mpegvideo_select="dsputil videodsp" +mpegvideo_select="dsputil hpeldsp videodsp" mpegvideoenc_select="mpegvideo" # decoders / encoders diff --git a/libavcodec/motion_est.c b/libavcodec/motion_est.c index 99c5564544..91304c5377 100644 --- a/libavcodec/motion_est.c +++ b/libavcodec/motion_est.c @@ -339,9 +339,11 @@ int ff_init_me(MpegEncContext *s){ else c->sub_motion_search= hpel_motion_search; } - c->hpel_avg= s->dsp.avg_pixels_tab; - if(s->no_rounding) c->hpel_put= s->dsp.put_no_rnd_pixels_tab; - else c->hpel_put= s->dsp.put_pixels_tab; + c->hpel_avg = s->hdsp.avg_pixels_tab; + if (s->no_rounding) + c->hpel_put = s->hdsp.put_no_rnd_pixels_tab; + else + c->hpel_put = s->hdsp.put_pixels_tab; if(s->linesize){ c->stride = s->linesize; @@ -625,9 +627,9 @@ static inline int h263_mv4_search(MpegEncContext *s, int mx, int my, int shift) dxy = ((my4 & 1) << 1) | (mx4 & 1); if(s->no_rounding) - s->dsp.put_no_rnd_pixels_tab[1][dxy](dest_y , ref , stride, h); + s->hdsp.put_no_rnd_pixels_tab[1][dxy](dest_y , ref , stride, h); else - s->dsp.put_pixels_tab [1][dxy](dest_y , ref , stride, h); + s->hdsp.put_pixels_tab [1][dxy](dest_y , ref , stride, h); } dmin_sum+= (mv_penalty[mx4-pred_x4] + mv_penalty[my4-pred_y4])*c->mb_penalty_factor; }else @@ -666,11 +668,11 @@ static inline int h263_mv4_search(MpegEncContext *s, int mx, int my, int shift) offset= (s->mb_x*8 + (mx>>1)) + (s->mb_y*8 + (my>>1))*s->uvlinesize; if(s->no_rounding){ - s->dsp.put_no_rnd_pixels_tab[1][dxy](c->scratchpad , s->last_picture.f.data[1] + offset, s->uvlinesize, 8); - s->dsp.put_no_rnd_pixels_tab[1][dxy](c->scratchpad + 8, s->last_picture.f.data[2] + offset, s->uvlinesize, 8); + s->hdsp.put_no_rnd_pixels_tab[1][dxy](c->scratchpad , s->last_picture.f.data[1] + offset, s->uvlinesize, 8); + s->hdsp.put_no_rnd_pixels_tab[1][dxy](c->scratchpad + 8, s->last_picture.f.data[2] + offset, s->uvlinesize, 8); }else{ - s->dsp.put_pixels_tab [1][dxy](c->scratchpad , s->last_picture.f.data[1] + offset, s->uvlinesize, 8); - s->dsp.put_pixels_tab [1][dxy](c->scratchpad + 8, s->last_picture.f.data[2] + offset, s->uvlinesize, 8); + s->hdsp.put_pixels_tab [1][dxy](c->scratchpad , s->last_picture.f.data[1] + offset, s->uvlinesize, 8); + s->hdsp.put_pixels_tab [1][dxy](c->scratchpad + 8, s->last_picture.f.data[2] + offset, s->uvlinesize, 8); } dmin_sum += s->dsp.mb_cmp[1](s, s->new_picture.f.data[1] + s->mb_x*8 + s->mb_y*8*s->uvlinesize, c->scratchpad , s->uvlinesize, 8); @@ -778,9 +780,9 @@ static int interlaced_search(MpegEncContext *s, int ref_index, dxy = ((my_i & 1) << 1) | (mx_i & 1); if(s->no_rounding){ - s->dsp.put_no_rnd_pixels_tab[size][dxy](c->scratchpad, ref , stride, h); + s->hdsp.put_no_rnd_pixels_tab[size][dxy](c->scratchpad, ref , stride, h); }else{ - s->dsp.put_pixels_tab [size][dxy](c->scratchpad, ref , stride, h); + s->hdsp.put_pixels_tab [size][dxy](c->scratchpad, ref , stride, h); } dmin= s->dsp.mb_cmp[size](s, c->src[block][0], c->scratchpad, stride, h); dmin+= (mv_penalty[mx_i-c->pred_x] + mv_penalty[my_i-c->pred_y] + 1)*c->mb_penalty_factor; @@ -1217,14 +1219,14 @@ static inline int check_bidir_mv(MpegEncContext * s, src_y = motion_fy >> 1; ptr = ref_data[0] + (src_y * stride) + src_x; - s->dsp.put_pixels_tab[size][dxy](dest_y , ptr , stride, h); + s->hdsp.put_pixels_tab[size][dxy](dest_y , ptr , stride, h); dxy = ((motion_by & 1) << 1) | (motion_bx & 1); src_x = motion_bx >> 1; src_y = motion_by >> 1; ptr = ref2_data[0] + (src_y * stride) + src_x; - s->dsp.avg_pixels_tab[size][dxy](dest_y , ptr , stride, h); + s->hdsp.avg_pixels_tab[size][dxy](dest_y , ptr , stride, h); } fbmin = (mv_penalty_f[motion_fx-pred_fx] + mv_penalty_f[motion_fy-pred_fy])*c->mb_penalty_factor diff --git a/libavcodec/mpegvideo.c b/libavcodec/mpegvideo.c index 5635c26c83..87605fa4fc 100644 --- a/libavcodec/mpegvideo.c +++ b/libavcodec/mpegvideo.c @@ -162,6 +162,7 @@ static void mpeg_er_decode_mb(void *opaque, int ref, int mv_dir, int mv_type, av_cold int ff_dct_common_init(MpegEncContext *s) { ff_dsputil_init(&s->dsp, s->avctx); + ff_hpeldsp_init(&s->hdsp, s->avctx->flags); ff_videodsp_init(&s->vdsp, s->avctx->bits_per_raw_sample); s->dct_unquantize_h263_intra = dct_unquantize_h263_intra_c; @@ -2056,13 +2057,13 @@ void MPV_decode_mb_internal(MpegEncContext *s, int16_t block[12][64], op_qpix= s->me.qpel_put; if ((!s->no_rounding) || s->pict_type==AV_PICTURE_TYPE_B){ - op_pix = s->dsp.put_pixels_tab; + op_pix = s->hdsp.put_pixels_tab; }else{ - op_pix = s->dsp.put_no_rnd_pixels_tab; + op_pix = s->hdsp.put_no_rnd_pixels_tab; } if (s->mv_dir & MV_DIR_FORWARD) { ff_MPV_motion(s, dest_y, dest_cb, dest_cr, 0, s->last_picture.f.data, op_pix, op_qpix); - op_pix = s->dsp.avg_pixels_tab; + op_pix = s->hdsp.avg_pixels_tab; op_qpix= s->me.qpel_avg; } if (s->mv_dir & MV_DIR_BACKWARD) { @@ -2182,9 +2183,9 @@ void MPV_decode_mb_internal(MpegEncContext *s, int16_t block[12][64], } skip_idct: if(!readable){ - s->dsp.put_pixels_tab[0][0](s->dest[0], dest_y , linesize,16); - s->dsp.put_pixels_tab[s->chroma_x_shift][0](s->dest[1], dest_cb, uvlinesize,16 >> s->chroma_y_shift); - s->dsp.put_pixels_tab[s->chroma_x_shift][0](s->dest[2], dest_cr, uvlinesize,16 >> s->chroma_y_shift); + s->hdsp.put_pixels_tab[0][0](s->dest[0], dest_y , linesize,16); + s->hdsp.put_pixels_tab[s->chroma_x_shift][0](s->dest[1], dest_cb, uvlinesize,16 >> s->chroma_y_shift); + s->hdsp.put_pixels_tab[s->chroma_x_shift][0](s->dest[2], dest_cr, uvlinesize,16 >> s->chroma_y_shift); } } } diff --git a/libavcodec/mpegvideo.h b/libavcodec/mpegvideo.h index 5596b77feb..2474bda3bc 100644 --- a/libavcodec/mpegvideo.h +++ b/libavcodec/mpegvideo.h @@ -32,6 +32,7 @@ #include "dsputil.h" #include "error_resilience.h" #include "get_bits.h" +#include "hpeldsp.h" #include "put_bits.h" #include "ratecontrol.h" #include "parser.h" @@ -380,6 +381,7 @@ typedef struct MpegEncContext { int h263_long_vectors; ///< use horrible h263v1 long vector mode DSPContext dsp; ///< pointers for accelerated dsp functions + HpelDSPContext hdsp; VideoDSPContext vdsp; int f_code; ///< forward MV resolution int b_code; ///< backward MV resolution for B Frames (mpeg4) diff --git a/libavcodec/mpegvideo_enc.c b/libavcodec/mpegvideo_enc.c index 86c05d5d7e..b2078e9488 100644 --- a/libavcodec/mpegvideo_enc.c +++ b/libavcodec/mpegvideo_enc.c @@ -1771,10 +1771,10 @@ static av_always_inline void encode_mb_internal(MpegEncContext *s, dest_cr = s->dest[2]; if ((!s->no_rounding) || s->pict_type == AV_PICTURE_TYPE_B) { - op_pix = s->dsp.put_pixels_tab; + op_pix = s->hdsp.put_pixels_tab; op_qpix = s->dsp.put_qpel_pixels_tab; } else { - op_pix = s->dsp.put_no_rnd_pixels_tab; + op_pix = s->hdsp.put_no_rnd_pixels_tab; op_qpix = s->dsp.put_no_rnd_qpel_pixels_tab; } @@ -1782,7 +1782,7 @@ static av_always_inline void encode_mb_internal(MpegEncContext *s, ff_MPV_motion(s, dest_y, dest_cb, dest_cr, 0, s->last_picture.f.data, op_pix, op_qpix); - op_pix = s->dsp.avg_pixels_tab; + op_pix = s->hdsp.avg_pixels_tab; op_qpix = s->dsp.avg_qpel_pixels_tab; } if (s->mv_dir & MV_DIR_BACKWARD) { @@ -2759,9 +2759,9 @@ static int encode_thread(AVCodecContext *c, void *arg){ ff_h263_update_motion_val(s); if(next_block==0){ //FIXME 16 vs linesize16 - s->dsp.put_pixels_tab[0][0](s->dest[0], s->rd_scratchpad , s->linesize ,16); - s->dsp.put_pixels_tab[1][0](s->dest[1], s->rd_scratchpad + 16*s->linesize , s->uvlinesize, 8); - s->dsp.put_pixels_tab[1][0](s->dest[2], s->rd_scratchpad + 16*s->linesize + 8, s->uvlinesize, 8); + s->hdsp.put_pixels_tab[0][0](s->dest[0], s->rd_scratchpad , s->linesize ,16); + s->hdsp.put_pixels_tab[1][0](s->dest[1], s->rd_scratchpad + 16*s->linesize , s->uvlinesize, 8); + s->hdsp.put_pixels_tab[1][0](s->dest[2], s->rd_scratchpad + 16*s->linesize + 8, s->uvlinesize, 8); } if(s->avctx->mb_decision == FF_MB_DECISION_BITS) diff --git a/libavcodec/mpegvideo_motion.c b/libavcodec/mpegvideo_motion.c index a524fa3064..c8109b12d9 100644 --- a/libavcodec/mpegvideo_motion.c +++ b/libavcodec/mpegvideo_motion.c @@ -75,9 +75,9 @@ static void gmc1_motion(MpegEncContext *s, dxy= ((motion_x>>3)&1) | ((motion_y>>2)&2); if (s->no_rounding){ - s->dsp.put_no_rnd_pixels_tab[0][dxy](dest_y, ptr, linesize, 16); + s->hdsp.put_no_rnd_pixels_tab[0][dxy](dest_y, ptr, linesize, 16); }else{ - s->dsp.put_pixels_tab [0][dxy](dest_y, ptr, linesize, 16); + s->hdsp.put_pixels_tab [0][dxy](dest_y, ptr, linesize, 16); } } @@ -853,7 +853,7 @@ static av_always_inline void MPV_motion_internal(MpegEncContext *s, s->mv[dir][2*i + j][0], s->mv[dir][2*i + j][1], 8, mb_y); } - pix_op = s->dsp.avg_pixels_tab; + pix_op = s->hdsp.avg_pixels_tab; } }else{ for(i=0; i<2; i++){ @@ -863,7 +863,7 @@ static av_always_inline void MPV_motion_internal(MpegEncContext *s, s->mv[dir][2*i][0],s->mv[dir][2*i][1],16, mb_y>>1); // after put we make avg of the same block - pix_op=s->dsp.avg_pixels_tab; + pix_op=s->hdsp.avg_pixels_tab; //opposite parity is always in the same frame if this is second field if(!s->first_field){ diff --git a/libavcodec/vc1dec.c b/libavcodec/vc1dec.c index db4b87b48a..ef65e32154 100644 --- a/libavcodec/vc1dec.c +++ b/libavcodec/vc1dec.c @@ -511,9 +511,9 @@ static void vc1_mc_1mv(VC1Context *v, int dir) } else { // hpel mc - always used for luma dxy = (my & 2) | ((mx & 2) >> 1); if (!v->rnd) - dsp->put_pixels_tab[0][dxy](s->dest[0] + off, srcY, s->linesize, 16); + s->hdsp.put_pixels_tab[0][dxy](s->dest[0] + off, srcY, s->linesize, 16); else - dsp->put_no_rnd_pixels_tab[0][dxy](s->dest[0] + off, srcY, s->linesize, 16); + s->hdsp.put_no_rnd_pixels_tab[0][dxy](s->dest[0] + off, srcY, s->linesize, 16); } if (s->flags & CODEC_FLAG_GRAY) return; @@ -545,7 +545,6 @@ static inline int median4(int a, int b, int c, int d) static void vc1_mc_4mv_luma(VC1Context *v, int n, int dir) { MpegEncContext *s = &v->s; - DSPContext *dsp = &v->s.dsp; uint8_t *srcY; int dxy, mx, my, src_x, src_y; int off; @@ -707,9 +706,9 @@ static void vc1_mc_4mv_luma(VC1Context *v, int n, int dir) } else { // hpel mc - always used for luma dxy = (my & 2) | ((mx & 2) >> 1); if (!v->rnd) - dsp->put_pixels_tab[1][dxy](s->dest[0] + off, srcY, s->linesize, 8); + s->hdsp.put_pixels_tab[1][dxy](s->dest[0] + off, srcY, s->linesize, 8); else - dsp->put_no_rnd_pixels_tab[1][dxy](s->dest[0] + off, srcY, s->linesize, 8); + s->hdsp.put_no_rnd_pixels_tab[1][dxy](s->dest[0] + off, srcY, s->linesize, 8); } } @@ -1950,9 +1949,9 @@ static void vc1_interp_mc(VC1Context *v) dxy = (my & 2) | ((mx & 2) >> 1); if (!v->rnd) - dsp->avg_pixels_tab[0][dxy](s->dest[0] + off, srcY, s->linesize, 16); + s->hdsp.avg_pixels_tab[0][dxy](s->dest[0] + off, srcY, s->linesize, 16); else - dsp->avg_no_rnd_pixels_tab[dxy](s->dest[0] + off, srcY, s->linesize, 16); + s->hdsp.avg_no_rnd_pixels_tab[dxy](s->dest[0] + off, srcY, s->linesize, 16); } if (s->flags & CODEC_FLAG_GRAY) return; From 2f6bc5f7c193477c2ebc0acce8f2d5551445e129 Mon Sep 17 00:00:00 2001 From: "Ronald S. Bultje" Date: Sun, 10 Mar 2013 14:12:58 -0700 Subject: [PATCH 4/4] svq3: Use hpeldsp instead of dsputil for half-pel functions MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Martin Storsjö --- configure | 2 +- libavcodec/svq3.c | 17 ++++++++++------- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/configure b/configure index 429bf1f99b..50d2cc8fa3 100755 --- a/configure +++ b/configure @@ -1642,7 +1642,7 @@ sipr_decoder_select="lsp" sp5x_decoder_select="dsputil" svq1_decoder_select="hpeldsp" svq1_encoder_select="aandcttables dsputil mpegvideoenc" -svq3_decoder_select="golomb h264chroma h264dsp h264pred h264qpel mpegvideo videodsp" +svq3_decoder_select="golomb h264chroma h264dsp h264pred h264qpel hpeldsp mpegvideo videodsp" svq3_decoder_suggest="error_resilience zlib" tak_decoder_select="dsputil" theora_decoder_select="vp3_decoder" diff --git a/libavcodec/svq3.c b/libavcodec/svq3.c index 0c3af86560..1ecc1b29d1 100644 --- a/libavcodec/svq3.c +++ b/libavcodec/svq3.c @@ -48,6 +48,7 @@ #include "h264_mvpred.h" #include "golomb.h" +#include "hpeldsp.h" #include "rectangle.h" #include "vdpau_internal.h" @@ -65,6 +66,7 @@ typedef struct { H264Context h; + HpelDSPContext hdsp; Picture *cur_pic; Picture *next_pic; Picture *last_pic; @@ -312,9 +314,9 @@ static inline void svq3_mc_dir_part(SVQ3Context *s, : h->dsp.put_tpel_pixels_tab)[dxy](dest, src, h->linesize, width, height); else - (avg ? h->dsp.avg_pixels_tab - : h->dsp.put_pixels_tab)[blocksize][dxy](dest, src, h->linesize, - height); + (avg ? s->hdsp.avg_pixels_tab + : s->hdsp.put_pixels_tab)[blocksize][dxy](dest, src, h->linesize, + height); if (!(h->flags & CODEC_FLAG_GRAY)) { mx = mx + (mx < (int) x) >> 1; @@ -340,10 +342,10 @@ static inline void svq3_mc_dir_part(SVQ3Context *s, h->uvlinesize, width, height); else - (avg ? h->dsp.avg_pixels_tab - : h->dsp.put_pixels_tab)[blocksize][dxy](dest, src, - h->uvlinesize, - height); + (avg ? s->hdsp.avg_pixels_tab + : s->hdsp.put_pixels_tab)[blocksize][dxy](dest, src, + h->uvlinesize, + height); } } } @@ -865,6 +867,7 @@ static av_cold int svq3_decode_init(AVCodecContext *avctx) if (ff_h264_decode_init(avctx) < 0) return -1; + ff_hpeldsp_init(&s->hdsp, avctx->flags); h->flags = avctx->flags; h->is_complex = 1; h->picture_structure = PICT_FRAME;