Commit 2d604443 authored by Diego Biurrun's avatar Diego Biurrun

dsputil: Split motion estimation compare bits off into their own context

parent a578b040
...@@ -1533,7 +1533,6 @@ CONFIG_EXTRA=" ...@@ -1533,7 +1533,6 @@ CONFIG_EXTRA="
blockdsp blockdsp
bswapdsp bswapdsp
cabac cabac
dsputil
dvprofile dvprofile
fdctdsp fdctdsp
gcrypt gcrypt
...@@ -1552,6 +1551,7 @@ CONFIG_EXTRA=" ...@@ -1552,6 +1551,7 @@ CONFIG_EXTRA="
intrax8 intrax8
lgplv3 lgplv3
lpc lpc
me_cmp
mpeg_er mpeg_er
mpegaudio mpegaudio
mpegaudiodsp mpegaudiodsp
...@@ -1707,24 +1707,24 @@ threads_if_any="$THREADS_LIST" ...@@ -1707,24 +1707,24 @@ threads_if_any="$THREADS_LIST"
# subsystems # subsystems
dct_select="rdft" dct_select="rdft"
dsputil_select="fdctdsp idctdsp pixblockdsp" error_resilience_select="me_cmp"
error_resilience_select="dsputil"
intrax8_select="error_resilience" intrax8_select="error_resilience"
mdct_select="fft" mdct_select="fft"
rdft_select="fft" rdft_select="fft"
me_cmp_select="fdctdsp idctdsp pixblockdsp"
mpeg_er_select="error_resilience" mpeg_er_select="error_resilience"
mpegaudio_select="mpegaudiodsp" mpegaudio_select="mpegaudiodsp"
mpegaudiodsp_select="dct" mpegaudiodsp_select="dct"
mpegvideo_select="blockdsp dsputil hpeldsp idctdsp videodsp" mpegvideo_select="blockdsp hpeldsp idctdsp me_cmp videodsp"
mpegvideoenc_select="dsputil mpegvideo pixblockdsp qpeldsp" mpegvideoenc_select="me_cmp mpegvideo pixblockdsp qpeldsp"
# decoders / encoders # decoders / encoders
aac_decoder_select="mdct sinewin" aac_decoder_select="mdct sinewin"
aac_encoder_select="audio_frame_queue mdct sinewin" aac_encoder_select="audio_frame_queue mdct sinewin"
aac_latm_decoder_select="aac_decoder aac_latm_parser" aac_latm_decoder_select="aac_decoder aac_latm_parser"
ac3_decoder_select="ac3_parser ac3dsp bswapdsp mdct" ac3_decoder_select="ac3_parser ac3dsp bswapdsp mdct"
ac3_encoder_select="ac3dsp audiodsp dsputil mdct" ac3_encoder_select="ac3dsp audiodsp mdct me_cmp"
ac3_fixed_encoder_select="ac3dsp audiodsp dsputil mdct" ac3_fixed_encoder_select="ac3dsp audiodsp mdct me_cmp"
aic_decoder_select="golomb idctdsp" aic_decoder_select="golomb idctdsp"
alac_encoder_select="lpc" alac_encoder_select="lpc"
als_decoder_select="bswapdsp" als_decoder_select="bswapdsp"
...@@ -1752,7 +1752,7 @@ dca_decoder_select="mdct" ...@@ -1752,7 +1752,7 @@ dca_decoder_select="mdct"
dnxhd_decoder_select="blockdsp idctdsp" dnxhd_decoder_select="blockdsp idctdsp"
dnxhd_encoder_select="aandcttables blockdsp fdctdsp idctdsp mpegvideoenc pixblockdsp" dnxhd_encoder_select="aandcttables blockdsp fdctdsp idctdsp mpegvideoenc pixblockdsp"
dvvideo_decoder_select="dvprofile idctdsp" dvvideo_decoder_select="dvprofile idctdsp"
dvvideo_encoder_select="dsputil dvprofile fdctdsp pixblockdsp" dvvideo_encoder_select="dvprofile fdctdsp me_cmp pixblockdsp"
dxa_decoder_deps="zlib" dxa_decoder_deps="zlib"
eac3_decoder_select="ac3_decoder" eac3_decoder_select="ac3_decoder"
eac3_encoder_select="ac3_encoder" eac3_encoder_select="ac3_encoder"
...@@ -1856,7 +1856,7 @@ shorten_decoder_select="golomb" ...@@ -1856,7 +1856,7 @@ shorten_decoder_select="golomb"
sipr_decoder_select="lsp" sipr_decoder_select="lsp"
sp5x_decoder_select="mjpeg_decoder" sp5x_decoder_select="mjpeg_decoder"
svq1_decoder_select="hpeldsp" svq1_decoder_select="hpeldsp"
svq1_encoder_select="aandcttables dsputil hpeldsp mpegvideoenc" svq1_encoder_select="aandcttables hpeldsp me_cmp mpegvideoenc"
svq3_decoder_select="h264_decoder hpeldsp tpeldsp" svq3_decoder_select="h264_decoder hpeldsp tpeldsp"
svq3_decoder_suggest="zlib" svq3_decoder_suggest="zlib"
tak_decoder_select="audiodsp" tak_decoder_select="audiodsp"
......
...@@ -35,7 +35,6 @@ OBJS-$(CONFIG_BLOCKDSP) += blockdsp.o ...@@ -35,7 +35,6 @@ OBJS-$(CONFIG_BLOCKDSP) += blockdsp.o
OBJS-$(CONFIG_BSWAPDSP) += bswapdsp.o OBJS-$(CONFIG_BSWAPDSP) += bswapdsp.o
OBJS-$(CONFIG_CABAC) += cabac.o OBJS-$(CONFIG_CABAC) += cabac.o
OBJS-$(CONFIG_DCT) += dct.o dct32_fixed.o dct32_float.o OBJS-$(CONFIG_DCT) += dct.o dct32_fixed.o dct32_float.o
OBJS-$(CONFIG_DSPUTIL) += dsputil.o
OBJS-$(CONFIG_DXVA2) += dxva2.o OBJS-$(CONFIG_DXVA2) += dxva2.o
OBJS-$(CONFIG_ERROR_RESILIENCE) += error_resilience.o OBJS-$(CONFIG_ERROR_RESILIENCE) += error_resilience.o
OBJS-$(CONFIG_FDCTDSP) += fdctdsp.o faandct.o \ OBJS-$(CONFIG_FDCTDSP) += fdctdsp.o faandct.o \
...@@ -60,6 +59,7 @@ OBJS-$(CONFIG_LIBXVID) += libxvid_rc.o ...@@ -60,6 +59,7 @@ OBJS-$(CONFIG_LIBXVID) += libxvid_rc.o
OBJS-$(CONFIG_LPC) += lpc.o OBJS-$(CONFIG_LPC) += lpc.o
OBJS-$(CONFIG_LSP) += lsp.o OBJS-$(CONFIG_LSP) += lsp.o
OBJS-$(CONFIG_MDCT) += mdct_fixed.o mdct_float.o OBJS-$(CONFIG_MDCT) += mdct_fixed.o mdct_float.o
OBJS-$(CONFIG_ME_CMP) += me_cmp.o
OBJS-$(CONFIG_MPEG_ER) += mpeg_er.o OBJS-$(CONFIG_MPEG_ER) += mpeg_er.o
OBJS-$(CONFIG_MPEGAUDIO) += mpegaudio.o mpegaudiodata.o \ OBJS-$(CONFIG_MPEGAUDIO) += mpegaudio.o mpegaudiodata.o \
mpegaudiodecheader.o mpegaudiodecheader.o
......
...@@ -36,6 +36,7 @@ ...@@ -36,6 +36,7 @@
#include "libavutil/internal.h" #include "libavutil/internal.h"
#include "libavutil/opt.h" #include "libavutil/opt.h"
#include "avcodec.h" #include "avcodec.h"
#include "me_cmp.h"
#include "put_bits.h" #include "put_bits.h"
#include "audiodsp.h" #include "audiodsp.h"
#include "ac3dsp.h" #include "ac3dsp.h"
...@@ -379,7 +380,7 @@ static void compute_exp_strategy(AC3EncodeContext *s) ...@@ -379,7 +380,7 @@ static void compute_exp_strategy(AC3EncodeContext *s)
exp_strategy[blk] = EXP_NEW; exp_strategy[blk] = EXP_NEW;
continue; continue;
} }
exp_diff = s->dsp.sad[0](NULL, exp, exp - AC3_MAX_COEFS, 16, 16); exp_diff = s->mecc.sad[0](NULL, exp, exp - AC3_MAX_COEFS, 16, 16);
exp_strategy[blk] = EXP_REUSE; exp_strategy[blk] = EXP_REUSE;
if (ch == CPL_CH && exp_diff > (EXP_DIFF_THRESHOLD * (s->blocks[blk].end_freq[ch] - s->start_freq[ch]) / AC3_MAX_COEFS)) if (ch == CPL_CH && exp_diff > (EXP_DIFF_THRESHOLD * (s->blocks[blk].end_freq[ch] - s->start_freq[ch]) / AC3_MAX_COEFS))
exp_strategy[blk] = EXP_NEW; exp_strategy[blk] = EXP_NEW;
...@@ -2482,7 +2483,7 @@ av_cold int ff_ac3_encode_init(AVCodecContext *avctx) ...@@ -2482,7 +2483,7 @@ av_cold int ff_ac3_encode_init(AVCodecContext *avctx)
goto init_fail; goto init_fail;
ff_audiodsp_init(&s->adsp); ff_audiodsp_init(&s->adsp);
ff_dsputil_init(&s->dsp, avctx); ff_me_cmp_init(&s->mecc, avctx);
ff_ac3dsp_init(&s->ac3dsp, avctx->flags & CODEC_FLAG_BITEXACT); ff_ac3dsp_init(&s->ac3dsp, avctx->flags & CODEC_FLAG_BITEXACT);
dprint_options(s); dprint_options(s);
......
...@@ -35,9 +35,9 @@ ...@@ -35,9 +35,9 @@
#include "ac3.h" #include "ac3.h"
#include "ac3dsp.h" #include "ac3dsp.h"
#include "avcodec.h" #include "avcodec.h"
#include "dsputil.h"
#include "fft.h" #include "fft.h"
#include "mathops.h" #include "mathops.h"
#include "me_cmp.h"
#include "put_bits.h" #include "put_bits.h"
#include "audiodsp.h" #include "audiodsp.h"
...@@ -162,9 +162,9 @@ typedef struct AC3EncodeContext { ...@@ -162,9 +162,9 @@ typedef struct AC3EncodeContext {
AC3EncOptions options; ///< encoding options AC3EncOptions options; ///< encoding options
AVCodecContext *avctx; ///< parent AVCodecContext AVCodecContext *avctx; ///< parent AVCodecContext
PutBitContext pb; ///< bitstream writer context PutBitContext pb; ///< bitstream writer context
DSPContext dsp;
AudioDSPContext adsp; AudioDSPContext adsp;
AVFloatDSPContext fdsp; AVFloatDSPContext fdsp;
MECmpContext mecc;
AC3DSPContext ac3dsp; ///< AC-3 optimized functions AC3DSPContext ac3dsp; ///< AC-3 optimized functions
FFTContext mdct; ///< FFT context for MDCT calculation FFTContext mdct; ///< FFT context for MDCT calculation
const SampleType *mdct_window; ///< MDCT window function array const SampleType *mdct_window; ///< MDCT window function array
......
...@@ -6,7 +6,6 @@ OBJS-$(CONFIG_AC3DSP) += arm/ac3dsp_init_arm.o \ ...@@ -6,7 +6,6 @@ OBJS-$(CONFIG_AC3DSP) += arm/ac3dsp_init_arm.o \
arm/ac3dsp_arm.o arm/ac3dsp_arm.o
OBJS-$(CONFIG_AUDIODSP) += arm/audiodsp_init_arm.o OBJS-$(CONFIG_AUDIODSP) += arm/audiodsp_init_arm.o
OBJS-$(CONFIG_BLOCKDSP) += arm/blockdsp_init_arm.o OBJS-$(CONFIG_BLOCKDSP) += arm/blockdsp_init_arm.o
OBJS-$(CONFIG_DSPUTIL) += arm/dsputil_init_arm.o
OBJS-$(CONFIG_FFT) += arm/fft_init_arm.o \ OBJS-$(CONFIG_FFT) += arm/fft_init_arm.o \
arm/fft_fixed_init_arm.o arm/fft_fixed_init_arm.o
OBJS-$(CONFIG_H264CHROMA) += arm/h264chroma_init_arm.o OBJS-$(CONFIG_H264CHROMA) += arm/h264chroma_init_arm.o
...@@ -19,6 +18,7 @@ OBJS-$(CONFIG_IDCTDSP) += arm/idctdsp_init_arm.o \ ...@@ -19,6 +18,7 @@ OBJS-$(CONFIG_IDCTDSP) += arm/idctdsp_init_arm.o \
arm/idctdsp_arm.o \ arm/idctdsp_arm.o \
arm/jrevdct_arm.o \ arm/jrevdct_arm.o \
arm/simple_idct_arm.o arm/simple_idct_arm.o
OBJS-$(CONFIG_ME_CMP) += arm/me_cmp_init_arm.o
OBJS-$(CONFIG_MPEGAUDIODSP) += arm/mpegaudiodsp_init_arm.o OBJS-$(CONFIG_MPEGAUDIODSP) += arm/mpegaudiodsp_init_arm.o
OBJS-$(CONFIG_MPEGVIDEO) += arm/mpegvideo_arm.o OBJS-$(CONFIG_MPEGVIDEO) += arm/mpegvideo_arm.o
OBJS-$(CONFIG_MPEGVIDEOENC) += arm/mpegvideoencdsp_init_arm.o OBJS-$(CONFIG_MPEGVIDEOENC) += arm/mpegvideoencdsp_init_arm.o
...@@ -53,13 +53,13 @@ ARMV5TE-OBJS-$(CONFIG_VIDEODSP) += arm/videodsp_init_armv5te.o \ ...@@ -53,13 +53,13 @@ ARMV5TE-OBJS-$(CONFIG_VIDEODSP) += arm/videodsp_init_armv5te.o \
ARMV5TE-OBJS-$(CONFIG_MLP_DECODER) += arm/mlpdsp_armv5te.o ARMV5TE-OBJS-$(CONFIG_MLP_DECODER) += arm/mlpdsp_armv5te.o
ARMV6-OBJS-$(CONFIG_AC3DSP) += arm/ac3dsp_armv6.o ARMV6-OBJS-$(CONFIG_AC3DSP) += arm/ac3dsp_armv6.o
ARMV6-OBJS-$(CONFIG_DSPUTIL) += arm/dsputil_armv6.o
ARMV6-OBJS-$(CONFIG_H264DSP) += arm/h264dsp_armv6.o ARMV6-OBJS-$(CONFIG_H264DSP) += arm/h264dsp_armv6.o
ARMV6-OBJS-$(CONFIG_HPELDSP) += arm/hpeldsp_init_armv6.o \ ARMV6-OBJS-$(CONFIG_HPELDSP) += arm/hpeldsp_init_armv6.o \
arm/hpeldsp_armv6.o arm/hpeldsp_armv6.o
ARMV6-OBJS-$(CONFIG_IDCTDSP) += arm/idctdsp_init_armv6.o \ ARMV6-OBJS-$(CONFIG_IDCTDSP) += arm/idctdsp_init_armv6.o \
arm/idctdsp_armv6.o \ arm/idctdsp_armv6.o \
arm/simple_idct_armv6.o arm/simple_idct_armv6.o
ARMV6-OBJS-$(CONFIG_ME_CMP) += arm/me_cmp_armv6.o
ARMV6-OBJS-$(CONFIG_MPEGAUDIODSP) += arm/mpegaudiodsp_fixed_armv6.o ARMV6-OBJS-$(CONFIG_MPEGAUDIODSP) += arm/mpegaudiodsp_fixed_armv6.o
ARMV6-OBJS-$(CONFIG_MPEGVIDEOENC) += arm/mpegvideoencdsp_armv6.o ARMV6-OBJS-$(CONFIG_MPEGVIDEOENC) += arm/mpegvideoencdsp_armv6.o
ARMV6-OBJS-$(CONFIG_PIXBLOCKDSP) += arm/pixblockdsp_armv6.o ARMV6-OBJS-$(CONFIG_PIXBLOCKDSP) += arm/pixblockdsp_armv6.o
......
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
#include "libavutil/cpu.h" #include "libavutil/cpu.h"
#include "libavutil/arm/cpu.h" #include "libavutil/arm/cpu.h"
#include "libavcodec/avcodec.h" #include "libavcodec/avcodec.h"
#include "libavcodec/dsputil.h" #include "libavcodec/me_cmp.h"
#include "libavcodec/mpegvideo.h" #include "libavcodec/mpegvideo.h"
int ff_pix_abs16_armv6(MpegEncContext *s, uint8_t *blk1, uint8_t *blk2, int ff_pix_abs16_armv6(MpegEncContext *s, uint8_t *blk1, uint8_t *blk2,
...@@ -38,8 +38,7 @@ int ff_pix_abs8_armv6(MpegEncContext *s, uint8_t *blk1, uint8_t *blk2, ...@@ -38,8 +38,7 @@ int ff_pix_abs8_armv6(MpegEncContext *s, uint8_t *blk1, uint8_t *blk2,
int ff_sse16_armv6(MpegEncContext *s, uint8_t *blk1, uint8_t *blk2, int ff_sse16_armv6(MpegEncContext *s, uint8_t *blk1, uint8_t *blk2,
int line_size, int h); int line_size, int h);
av_cold void ff_me_cmp_init_arm(MECmpContext *c, AVCodecContext *avctx)
av_cold void ff_dsputil_init_arm(DSPContext *c, AVCodecContext *avctx)
{ {
int cpu_flags = av_get_cpu_flags(); int cpu_flags = av_get_cpu_flags();
......
...@@ -28,7 +28,7 @@ ...@@ -28,7 +28,7 @@
#define AVCODEC_DV_H #define AVCODEC_DV_H
#include "avcodec.h" #include "avcodec.h"
#include "dsputil.h" #include "me_cmp.h"
#include "get_bits.h" #include "get_bits.h"
#include "dv_profile.h" #include "dv_profile.h"
......
...@@ -28,9 +28,9 @@ ...@@ -28,9 +28,9 @@
#include "libavutil/pixdesc.h" #include "libavutil/pixdesc.h"
#include "config.h" #include "config.h"
#include "avcodec.h" #include "avcodec.h"
#include "dsputil.h"
#include "fdctdsp.h" #include "fdctdsp.h"
#include "internal.h" #include "internal.h"
#include "me_cmp.h"
#include "pixblockdsp.h" #include "pixblockdsp.h"
#include "put_bits.h" #include "put_bits.h"
#include "dv.h" #include "dv.h"
...@@ -40,8 +40,8 @@ ...@@ -40,8 +40,8 @@
static av_cold int dvvideo_encode_init(AVCodecContext *avctx) static av_cold int dvvideo_encode_init(AVCodecContext *avctx)
{ {
DVVideoContext *s = avctx->priv_data; DVVideoContext *s = avctx->priv_data;
DSPContext dsp;
FDCTDSPContext fdsp; FDCTDSPContext fdsp;
MECmpContext mecc;
PixblockDSPContext pdsp; PixblockDSPContext pdsp;
int ret; int ret;
...@@ -65,13 +65,13 @@ static av_cold int dvvideo_encode_init(AVCodecContext *avctx) ...@@ -65,13 +65,13 @@ static av_cold int dvvideo_encode_init(AVCodecContext *avctx)
dv_vlc_map_tableinit(); dv_vlc_map_tableinit();
ff_dsputil_init(&dsp, avctx);
ff_fdctdsp_init(&fdsp, avctx); ff_fdctdsp_init(&fdsp, avctx);
ff_me_cmp_init(&mecc, avctx);
ff_pixblockdsp_init(&pdsp, avctx); ff_pixblockdsp_init(&pdsp, avctx);
ff_set_cmp(&dsp, dsp.ildct_cmp, avctx->ildct_cmp); ff_set_cmp(&mecc, mecc.ildct_cmp, avctx->ildct_cmp);
s->get_pixels = pdsp.get_pixels; s->get_pixels = pdsp.get_pixels;
s->ildct_cmp = dsp.ildct_cmp[5]; s->ildct_cmp = mecc.ildct_cmp[5];
s->fdct[0] = fdsp.fdct; s->fdct[0] = fdsp.fdct;
s->fdct[1] = fdsp.fdct248; s->fdct[1] = fdsp.fdct248;
......
...@@ -715,11 +715,11 @@ FF_ENABLE_DEPRECATION_WARNINGS ...@@ -715,11 +715,11 @@ FF_ENABLE_DEPRECATION_WARNINGS
} else { } else {
ff_thread_await_progress(s->last_pic.tf, mb_y, 0); ff_thread_await_progress(s->last_pic.tf, mb_y, 0);
} }
is_intra_likely += s->dsp->sad[0](NULL, last_mb_ptr, mb_ptr, is_intra_likely += s->mecc->sad[0](NULL, last_mb_ptr, mb_ptr,
linesize[0], 16); linesize[0], 16);
is_intra_likely -= s->dsp->sad[0](NULL, last_mb_ptr, is_intra_likely -= s->mecc->sad[0](NULL, last_mb_ptr,
last_mb_ptr + linesize[0] * 16, last_mb_ptr + linesize[0] * 16,
linesize[0], 16); linesize[0], 16);
} else { } else {
if (IS_INTRA(s->cur_pic.mb_type[mb_xy])) if (IS_INTRA(s->cur_pic.mb_type[mb_xy]))
is_intra_likely++; is_intra_likely++;
......
...@@ -23,7 +23,7 @@ ...@@ -23,7 +23,7 @@
#include <stdint.h> #include <stdint.h>
#include "avcodec.h" #include "avcodec.h"
#include "dsputil.h" #include "me_cmp.h"
#include "thread.h" #include "thread.h"
///< current MB is the first after a resync marker ///< current MB is the first after a resync marker
...@@ -52,7 +52,7 @@ typedef struct ERPicture { ...@@ -52,7 +52,7 @@ typedef struct ERPicture {
typedef struct ERContext { typedef struct ERContext {
AVCodecContext *avctx; AVCodecContext *avctx;
DSPContext *dsp; MECmpContext *mecc;
int *mb_index2xy; int *mb_index2xy;
int mb_num; int mb_num;
......
...@@ -33,7 +33,6 @@ ...@@ -33,7 +33,6 @@
#include "internal.h" #include "internal.h"
#include "cabac.h" #include "cabac.h"
#include "cabac_functions.h" #include "cabac_functions.h"
#include "dsputil.h"
#include "error_resilience.h" #include "error_resilience.h"
#include "avcodec.h" #include "avcodec.h"
#include "h264.h" #include "h264.h"
...@@ -42,6 +41,7 @@ ...@@ -42,6 +41,7 @@
#include "h264_mvpred.h" #include "h264_mvpred.h"
#include "golomb.h" #include "golomb.h"
#include "mathops.h" #include "mathops.h"
#include "me_cmp.h"
#include "mpegutils.h" #include "mpegutils.h"
#include "rectangle.h" #include "rectangle.h"
#include "svq3.h" #include "svq3.h"
...@@ -490,7 +490,7 @@ int ff_h264_context_init(H264Context *h) ...@@ -490,7 +490,7 @@ int ff_h264_context_init(H264Context *h)
if (CONFIG_ERROR_RESILIENCE) { if (CONFIG_ERROR_RESILIENCE) {
/* init ER */ /* init ER */
er->avctx = h->avctx; er->avctx = h->avctx;
er->dsp = &h->dsp; er->mecc = &h->mecc;
er->decode_mb = h264_er_decode_mb; er->decode_mb = h264_er_decode_mb;
er->opaque = h; er->opaque = h;
er->quarter_sample = 1; er->quarter_sample = 1;
...@@ -620,7 +620,7 @@ av_cold int ff_h264_decode_init(AVCodecContext *avctx) ...@@ -620,7 +620,7 @@ av_cold int ff_h264_decode_init(AVCodecContext *avctx)
/* needed so that IDCT permutation is known early */ /* needed so that IDCT permutation is known early */
if (CONFIG_ERROR_RESILIENCE) if (CONFIG_ERROR_RESILIENCE)
ff_dsputil_init(&h->dsp, h->avctx); ff_me_cmp_init(&h->mecc, h->avctx);
ff_videodsp_init(&h->vdsp, 8); ff_videodsp_init(&h->vdsp, 8);
memset(h->pps.scaling_matrix4, 16, 6 * 16 * sizeof(uint8_t)); memset(h->pps.scaling_matrix4, 16, 6 * 16 * sizeof(uint8_t));
...@@ -1234,7 +1234,7 @@ int ff_h264_set_parameter_from_sps(H264Context *h) ...@@ -1234,7 +1234,7 @@ int ff_h264_set_parameter_from_sps(H264Context *h)
ff_h264_pred_init(&h->hpc, h->avctx->codec_id, h->sps.bit_depth_luma, ff_h264_pred_init(&h->hpc, h->avctx->codec_id, h->sps.bit_depth_luma,
h->sps.chroma_format_idc); h->sps.chroma_format_idc);
if (CONFIG_ERROR_RESILIENCE) if (CONFIG_ERROR_RESILIENCE)
ff_dsputil_init(&h->dsp, h->avctx); ff_me_cmp_init(&h->mecc, h->avctx);
ff_videodsp_init(&h->vdsp, h->sps.bit_depth_luma); ff_videodsp_init(&h->vdsp, h->sps.bit_depth_luma);
} else { } else {
av_log(h->avctx, AV_LOG_ERROR, "Unsupported bit depth %d\n", av_log(h->avctx, AV_LOG_ERROR, "Unsupported bit depth %d\n",
......
...@@ -30,13 +30,13 @@ ...@@ -30,13 +30,13 @@
#include "libavutil/intreadwrite.h" #include "libavutil/intreadwrite.h"
#include "cabac.h" #include "cabac.h"
#include "dsputil.h"
#include "error_resilience.h" #include "error_resilience.h"
#include "get_bits.h" #include "get_bits.h"
#include "h264chroma.h" #include "h264chroma.h"
#include "h264dsp.h" #include "h264dsp.h"
#include "h264pred.h" #include "h264pred.h"
#include "h264qpel.h" #include "h264qpel.h"
#include "me_cmp.h"
#include "mpegutils.h" #include "mpegutils.h"
#include "parser.h" #include "parser.h"
#include "qpeldsp.h" #include "qpeldsp.h"
...@@ -302,7 +302,7 @@ typedef struct H264Picture { ...@@ -302,7 +302,7 @@ typedef struct H264Picture {
*/ */
typedef struct H264Context { typedef struct H264Context {
AVCodecContext *avctx; AVCodecContext *avctx;
DSPContext dsp; MECmpContext mecc;
VideoDSPContext vdsp; VideoDSPContext vdsp;
H264DSPContext h264dsp; H264DSPContext h264dsp;
H264ChromaContext h264chroma; H264ChromaContext h264chroma;
......
...@@ -31,7 +31,6 @@ ...@@ -31,7 +31,6 @@
#include "internal.h" #include "internal.h"
#include "cabac.h" #include "cabac.h"
#include "cabac_functions.h" #include "cabac_functions.h"
#include "dsputil.h"
#include "error_resilience.h" #include "error_resilience.h"
#include "avcodec.h" #include "avcodec.h"
#include "h264.h" #include "h264.h"
...@@ -1119,7 +1118,7 @@ static int h264_slice_header_init(H264Context *h, int reinit) ...@@ -1119,7 +1118,7 @@ static int h264_slice_header_init(H264Context *h, int reinit)
if (!c) if (!c)
return AVERROR(ENOMEM); return AVERROR(ENOMEM);
c->avctx = h->avctx; c->avctx = h->avctx;
c->dsp = h->dsp; c->mecc = h->mecc;
c->vdsp = h->vdsp; c->vdsp = h->vdsp;
c->h264dsp = h->h264dsp; c->h264dsp = h->h264dsp;
c->h264qpel = h->h264qpel; c->h264qpel = h->h264qpel;
......
/* /*
* DSP utils
* Copyright (c) 2000, 2001 Fabrice Bellard
* Copyright (c) 2002-2004 Michael Niedermayer <michaelni@gmx.at>
*
* This file is part of Libav. * This file is part of Libav.
* *
* Libav is free software; you can redistribute it and/or * Libav is free software; you can redistribute it and/or
...@@ -20,16 +16,11 @@ ...@@ -20,16 +16,11 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/ */
/**
* @file
* DSP utils
*/
#include "libavutil/attributes.h" #include "libavutil/attributes.h"
#include "avcodec.h" #include "avcodec.h"
#include "copy_block.h" #include "copy_block.h"
#include "dsputil.h"
#include "simple_idct.h" #include "simple_idct.h"
#include "me_cmp.h"
#include "mpegvideo.h" #include "mpegvideo.h"
#include "config.h" #include "config.h"
...@@ -369,7 +360,7 @@ static int zero_cmp(MpegEncContext *s, uint8_t *a, uint8_t *b, ...@@ -369,7 +360,7 @@ static int zero_cmp(MpegEncContext *s, uint8_t *a, uint8_t *b,
return 0; return 0;
} }
void ff_set_cmp(DSPContext *c, me_cmp_func *cmp, int type) void ff_set_cmp(MECmpContext *c, me_cmp_func *cmp, int type)
{ {
int i; int i;
...@@ -551,7 +542,7 @@ static int dct_sad8x8_c(MpegEncContext *s, uint8_t *src1, ...@@ -551,7 +542,7 @@ static int dct_sad8x8_c(MpegEncContext *s, uint8_t *src1,
s->pdsp.diff_pixels(temp, src1, src2, stride); s->pdsp.diff_pixels(temp, src1, src2, stride);
s->fdsp.fdct(temp); s->fdsp.fdct(temp);
return s->dsp.sum_abs_dctelem(temp); return s->mecc.sum_abs_dctelem(temp);
} }
#if CONFIG_GPL #if CONFIG_GPL
...@@ -722,7 +713,7 @@ static int rd8x8_c(MpegEncContext *s, uint8_t *src1, uint8_t *src2, ...@@ -722,7 +713,7 @@ static int rd8x8_c(MpegEncContext *s, uint8_t *src1, uint8_t *src2,
s->idsp.idct_add(lsrc2, 8, temp); s->idsp.idct_add(lsrc2, 8, temp);
distortion = s->dsp.sse[1](NULL, lsrc2, lsrc1, 8, 8); distortion = s->mecc.sse[1](NULL, lsrc2, lsrc1, 8, 8);
return distortion + ((bits * s->qscale * s->qscale * 109 + 64) >> 7); return distortion + ((bits * s->qscale * s->qscale * 109 + 64) >> 7);
} }
...@@ -891,8 +882,7 @@ WRAPPER8_16_SQ(quant_psnr8x8_c, quant_psnr16_c) ...@@ -891,8 +882,7 @@ WRAPPER8_16_SQ(quant_psnr8x8_c, quant_psnr16_c)
WRAPPER8_16_SQ(rd8x8_c, rd16_c) WRAPPER8_16_SQ(rd8x8_c, rd16_c)
WRAPPER8_16_SQ(bit8x8_c, bit16_c) WRAPPER8_16_SQ(bit8x8_c, bit16_c)
/* init static data */ av_cold void ff_me_cmp_init_static(void)
av_cold void ff_dsputil_static_init(void)
{ {
int i; int i;
...@@ -900,7 +890,7 @@ av_cold void ff_dsputil_static_init(void) ...@@ -900,7 +890,7 @@ av_cold void ff_dsputil_static_init(void)
ff_square_tab[i] = (i - 256) * (i - 256); ff_square_tab[i] = (i - 256) * (i - 256);
} }
av_cold void ff_dsputil_init(DSPContext *c, AVCodecContext *avctx) av_cold void ff_me_cmp_init(MECmpContext *c, AVCodecContext *avctx)
{ {
c->sum_abs_dctelem = sum_abs_dctelem_c; c->sum_abs_dctelem = sum_abs_dctelem_c;
...@@ -944,9 +934,9 @@ av_cold void ff_dsputil_init(DSPContext *c, AVCodecContext *avctx) ...@@ -944,9 +934,9 @@ av_cold void ff_dsputil_init(DSPContext *c, AVCodecContext *avctx)
c->nsse[1] = nsse8_c; c->nsse[1] = nsse8_c;
if (ARCH_ARM) if (ARCH_ARM)
ff_dsputil_init_arm(c, avctx); ff_me_cmp_init_arm(c, avctx);
if (ARCH_PPC) if (ARCH_PPC)
ff_dsputil_init_ppc(c, avctx); ff_me_cmp_init_ppc(c, avctx);
if (ARCH_X86) if (ARCH_X86)
ff_dsputil_init_x86(c, avctx); ff_me_cmp_init_x86(c, avctx);
} }
/* /*
* DSP utils
* Copyright (c) 2000, 2001, 2002 Fabrice Bellard
* Copyright (c) 2002-2004 Michael Niedermayer <michaelni@gmx.at>
*
* This file is part of Libav. * This file is part of Libav.
* *
* Libav is free software; you can redistribute it and/or * Libav is free software; you can redistribute it and/or
...@@ -20,15 +16,10 @@ ...@@ -20,15 +16,10 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/ */
/** #ifndef AVCODEC_ME_CMP_H
* @file #define AVCODEC_ME_CMP_H
* DSP utils.
* Note, many functions in here may use MMX which trashes the FPU state, it is
* absolutely necessary to call emms_c() between DSP & float/double code.
*/
#ifndef AVCODEC_DSPUTIL_H #include <stdint.h>
#define AVCODEC_DSPUTIL_H
#include "avcodec.h" #include "avcodec.h"
...@@ -44,10 +35,7 @@ typedef int (*me_cmp_func)(struct MpegEncContext *c, ...@@ -44,10 +35,7 @@ typedef int (*me_cmp_func)(struct MpegEncContext *c,
uint8_t *blk1 /* align width (8 or 16) */, uint8_t *blk1 /* align width (8 or 16) */,
uint8_t *blk2 /* align 1 */, int line_size, int h); uint8_t *blk2 /* align 1 */, int line_size, int h);
/** typedef struct MECmpContext {
* DSPContext.
*/
typedef struct DSPContext {
int (*sum_abs_dctelem)(int16_t *block /* align 16 */); int (*sum_abs_dctelem)(int16_t *block /* align 16 */);
me_cmp_func sad[6]; /* identical to pix_absAxA except additional void * */ me_cmp_func sad[6]; /* identical to pix_absAxA except additional void * */
...@@ -71,15 +59,15 @@ typedef struct DSPContext { ...@@ -71,15 +59,15 @@ typedef struct DSPContext {
me_cmp_func frame_skip_cmp[6]; // only width 8 used me_cmp_func frame_skip_cmp[6]; // only width 8 used
me_cmp_func pix_abs[2][4]; me_cmp_func pix_abs[2][4];
} DSPContext; } MECmpContext;
void ff_dsputil_static_init(void); void ff_me_cmp_init_static(void);
void ff_dsputil_init(DSPContext *p, AVCodecContext *avctx);
void ff_set_cmp(DSPContext *c, me_cmp_func *cmp, int type); void ff_me_cmp_init(MECmpContext *c, AVCodecContext *avctx);
void ff_me_cmp_init_arm(MECmpContext *c, AVCodecContext *avctx);
void ff_me_cmp_init_ppc(MECmpContext *c, AVCodecContext *avctx);
void ff_me_cmp_init_x86(MECmpContext *c, AVCodecContext *avctx);
void ff_dsputil_init_arm(DSPContext *c, AVCodecContext *avctx); void ff_set_cmp(MECmpContext *c, me_cmp_func *cmp, int type);
void ff_dsputil_init_ppc(DSPContext *c, AVCodecContext *avctx);
void ff_dsputil_init_x86(DSPContext *c, AVCodecContext *avctx);
#endif /* AVCODEC_DSPUTIL_H */ #endif /* AVCODEC_ME_CMP_H */
...@@ -317,10 +317,10 @@ int ff_init_me(MpegEncContext *s){ ...@@ -317,10 +317,10 @@ int ff_init_me(MpegEncContext *s){
av_log(s->avctx, AV_LOG_INFO, "ME_MAP size may be a little small for the selected diamond size\n"); av_log(s->avctx, AV_LOG_INFO, "ME_MAP size may be a little small for the selected diamond size\n");
} }
ff_set_cmp(&s->dsp, s->dsp.me_pre_cmp, c->avctx->me_pre_cmp); ff_set_cmp(&s->mecc, s->mecc.me_pre_cmp, c->avctx->me_pre_cmp);
ff_set_cmp(&s->dsp, s->dsp.me_cmp, c->avctx->me_cmp); ff_set_cmp(&s->mecc, s->mecc.me_cmp, c->avctx->me_cmp);
ff_set_cmp(&s->dsp, s->dsp.me_sub_cmp, c->avctx->me_sub_cmp); ff_set_cmp(&s->mecc, s->mecc.me_sub_cmp, c->avctx->me_sub_cmp);
ff_set_cmp(&s->dsp, s->dsp.mb_cmp, c->avctx->mb_cmp); ff_set_cmp(&s->mecc, s->mecc.mb_cmp, c->avctx->mb_cmp);
c->flags = get_flags(c, 0, c->avctx->me_cmp &FF_CMP_CHROMA); c->flags = get_flags(c, 0, c->avctx->me_cmp &FF_CMP_CHROMA);
c->sub_flags= get_flags(c, 0, c->avctx->me_sub_cmp&FF_CMP_CHROMA); c->sub_flags= get_flags(c, 0, c->avctx->me_sub_cmp&FF_CMP_CHROMA);
...@@ -361,12 +361,10 @@ int ff_init_me(MpegEncContext *s){ ...@@ -361,12 +361,10 @@ int ff_init_me(MpegEncContext *s){
/* 8x8 fullpel search would need a 4x4 chroma compare, which we do /* 8x8 fullpel search would need a 4x4 chroma compare, which we do
* not have yet, and even if we had, the motion estimation code * not have yet, and even if we had, the motion estimation code
* does not expect it. */ * does not expect it. */
if((c->avctx->me_cmp&FF_CMP_CHROMA)/* && !s->dsp.me_cmp[2]*/){ if ((c->avctx->me_cmp & FF_CMP_CHROMA) /* && !s->mecc.me_cmp[2] */)
s->dsp.me_cmp[2]= zero_cmp; s->mecc.me_cmp[2] = zero_cmp;
} if ((c->avctx->me_sub_cmp & FF_CMP_CHROMA) && !s->mecc.me_sub_cmp[2])
if((c->avctx->me_sub_cmp&FF_CMP_CHROMA) && !s->dsp.me_sub_cmp[2]){ s->mecc.me_sub_cmp[2] = zero_cmp;
s->dsp.me_sub_cmp[2]= zero_cmp;
}
c->hpel_put[2][0]= c->hpel_put[2][1]= c->hpel_put[2][0]= c->hpel_put[2][1]=
c->hpel_put[2][2]= c->hpel_put[2][3]= zero_hpel; c->hpel_put[2][2]= c->hpel_put[2][3]= zero_hpel;
...@@ -379,7 +377,7 @@ int ff_init_me(MpegEncContext *s){ ...@@ -379,7 +377,7 @@ int ff_init_me(MpegEncContext *s){
#define CHECK_SAD_HALF_MV(suffix, x, y) \ #define CHECK_SAD_HALF_MV(suffix, x, y) \
{\ {\
d= s->dsp.pix_abs[size][(x?1:0)+(y?2:0)](NULL, pix, ptr+((x)>>1), stride, h);\ d = s->mecc.pix_abs[size][(x ? 1 : 0) + (y ? 2 : 0)](NULL, pix, ptr + ((x) >> 1), stride, h); \
d += (mv_penalty[pen_x + x] + mv_penalty[pen_y + y])*penalty_factor;\ d += (mv_penalty[pen_x + x] + mv_penalty[pen_y + y])*penalty_factor;\
COPY3_IF_LT(dminh, d, dx, x, dy, y)\ COPY3_IF_LT(dminh, d, dx, x, dy, y)\
} }
...@@ -615,7 +613,7 @@ static inline int h263_mv4_search(MpegEncContext *s, int mx, int my, int shift) ...@@ -615,7 +613,7 @@ static inline int h263_mv4_search(MpegEncContext *s, int mx, int my, int shift)
dmin4= c->sub_motion_search(s, &mx4, &my4, dmin4, block, block, size, h); dmin4= c->sub_motion_search(s, &mx4, &my4, dmin4, block, block, size, h);
if(s->dsp.me_sub_cmp[0] != s->dsp.mb_cmp[0]){ if (s->mecc.me_sub_cmp[0] != s->mecc.mb_cmp[0]) {
int dxy; int dxy;
const int offset= ((block&1) + (block>>1)*stride)*8; const int offset= ((block&1) + (block>>1)*stride)*8;
uint8_t *dest_y = c->scratchpad + offset; uint8_t *dest_y = c->scratchpad + offset;
...@@ -657,8 +655,11 @@ static inline int h263_mv4_search(MpegEncContext *s, int mx, int my, int shift) ...@@ -657,8 +655,11 @@ static inline int h263_mv4_search(MpegEncContext *s, int mx, int my, int shift)
if(same) if(same)
return INT_MAX; return INT_MAX;
if(s->dsp.me_sub_cmp[0] != s->dsp.mb_cmp[0]){ if (s->mecc.me_sub_cmp[0] != s->mecc.mb_cmp[0]) {
dmin_sum += s->dsp.mb_cmp[0](s, s->new_picture.f->data[0] + s->mb_x*16 + s->mb_y*16*stride, c->scratchpad, stride, 16); dmin_sum += s->mecc.mb_cmp[0](s,
s->new_picture.f->data[0] +
s->mb_x * 16 + s->mb_y * 16 * stride,
c->scratchpad, stride, 16);
} }
if(c->avctx->mb_cmp&FF_CMP_CHROMA){ if(c->avctx->mb_cmp&FF_CMP_CHROMA){
...@@ -680,8 +681,8 @@ static inline int h263_mv4_search(MpegEncContext *s, int mx, int my, int shift) ...@@ -680,8 +681,8 @@ static inline int h263_mv4_search(MpegEncContext *s, int mx, int my, int shift)
s->hdsp.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 + 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); dmin_sum += s->mecc.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);
dmin_sum += s->dsp.mb_cmp[1](s, s->new_picture.f->data[2] + s->mb_x*8 + s->mb_y*8*s->uvlinesize, c->scratchpad+8, s->uvlinesize, 8); dmin_sum += s->mecc.mb_cmp[1](s, s->new_picture.f->data[2] + s->mb_x * 8 + s->mb_y * 8 * s->uvlinesize, c->scratchpad + 8, s->uvlinesize, 8);
} }
c->pred_x= mx; c->pred_x= mx;
...@@ -777,7 +778,7 @@ static int interlaced_search(MpegEncContext *s, int ref_index, ...@@ -777,7 +778,7 @@ static int interlaced_search(MpegEncContext *s, int ref_index,
mv_table[xy][0]= mx_i; mv_table[xy][0]= mx_i;
mv_table[xy][1]= my_i; mv_table[xy][1]= my_i;
if(s->dsp.me_sub_cmp[0] != s->dsp.mb_cmp[0]){ if (s->mecc.me_sub_cmp[0] != s->mecc.mb_cmp[0]) {
int dxy; int dxy;
//FIXME chroma ME //FIXME chroma ME
...@@ -789,7 +790,7 @@ static int interlaced_search(MpegEncContext *s, int ref_index, ...@@ -789,7 +790,7 @@ static int interlaced_search(MpegEncContext *s, int ref_index,
}else{ }else{
s->hdsp.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 = s->mecc.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; dmin+= (mv_penalty[mx_i-c->pred_x] + mv_penalty[my_i-c->pred_y] + 1)*c->mb_penalty_factor;
}else }else
dmin+= c->mb_penalty_factor; //field_select bits dmin+= c->mb_penalty_factor; //field_select bits
...@@ -940,7 +941,7 @@ void ff_estimate_p_frame_motion(MpegEncContext * s, ...@@ -940,7 +941,7 @@ void ff_estimate_p_frame_motion(MpegEncContext * s,
/* At this point (mx,my) are full-pell and the relative displacement */ /* At this point (mx,my) are full-pell and the relative displacement */
ppix = c->ref[0][0] + (my * s->linesize) + mx; ppix = c->ref[0][0] + (my * s->linesize) + mx;
vard = s->dsp.sse[0](NULL, pix, ppix, s->linesize, 16); vard = s->mecc.sse[0](NULL, pix, ppix, s->linesize, 16);
pic->mc_mb_var[s->mb_stride * mb_y + mb_x] = (vard+128)>>8; pic->mc_mb_var[s->mb_stride * mb_y + mb_x] = (vard+128)>>8;
c->mc_mb_var_sum_temp += (vard+128)>>8; c->mc_mb_var_sum_temp += (vard+128)>>8;
...@@ -1037,7 +1038,7 @@ void ff_estimate_p_frame_motion(MpegEncContext * s, ...@@ -1037,7 +1038,7 @@ void ff_estimate_p_frame_motion(MpegEncContext * s,
*(uint32_t*)(&c->scratchpad[i*s->linesize+12]) = mean; *(uint32_t*)(&c->scratchpad[i*s->linesize+12]) = mean;
} }
intra_score= s->dsp.mb_cmp[0](s, c->scratchpad, pix, s->linesize, 16); intra_score= s->mecc.mb_cmp[0](s, c->scratchpad, pix, s->linesize, 16);
} }
intra_score += c->mb_penalty_factor*16; intra_score += c->mb_penalty_factor*16;
...@@ -1237,7 +1238,7 @@ static inline int check_bidir_mv(MpegEncContext * s, ...@@ -1237,7 +1238,7 @@ static inline int check_bidir_mv(MpegEncContext * s,
fbmin = (mv_penalty_f[motion_fx-pred_fx] + mv_penalty_f[motion_fy-pred_fy])*c->mb_penalty_factor fbmin = (mv_penalty_f[motion_fx-pred_fx] + mv_penalty_f[motion_fy-pred_fy])*c->mb_penalty_factor
+(mv_penalty_b[motion_bx-pred_bx] + mv_penalty_b[motion_by-pred_by])*c->mb_penalty_factor +(mv_penalty_b[motion_bx-pred_bx] + mv_penalty_b[motion_by-pred_by])*c->mb_penalty_factor
+ s->dsp.mb_cmp[size](s, src_data[0], dest_y, stride, h); //FIXME new_pic + s->mecc.mb_cmp[size](s, src_data[0], dest_y, stride, h); // FIXME new_pic
if(c->avctx->mb_cmp&FF_CMP_CHROMA){ if(c->avctx->mb_cmp&FF_CMP_CHROMA){
} }
......
...@@ -63,8 +63,8 @@ static int hpel_motion_search(MpegEncContext * s, ...@@ -63,8 +63,8 @@ static int hpel_motion_search(MpegEncContext * s,
//FIXME factorize //FIXME factorize
cmp_sub= s->dsp.me_sub_cmp[size]; cmp_sub = s->mecc.me_sub_cmp[size];
chroma_cmp_sub= s->dsp.me_sub_cmp[size+1]; chroma_cmp_sub = s->mecc.me_sub_cmp[size + 1];
if(c->skip){ //FIXME move out of hpel? if(c->skip){ //FIXME move out of hpel?
*mx_ptr = 0; *mx_ptr = 0;
...@@ -166,7 +166,6 @@ static inline int get_mb_score(MpegEncContext *s, int mx, int my, ...@@ -166,7 +166,6 @@ static inline int get_mb_score(MpegEncContext *s, int mx, int my,
int src_index, int ref_index, int size, int src_index, int ref_index, int size,
int h, int add_rate) int h, int add_rate)
{ {
// const int check_luma= s->dsp.me_sub_cmp != s->dsp.mb_cmp;
MotionEstContext * const c= &s->me; MotionEstContext * const c= &s->me;
const int penalty_factor= c->mb_penalty_factor; const int penalty_factor= c->mb_penalty_factor;
const int flags= c->mb_flags; const int flags= c->mb_flags;
...@@ -179,8 +178,8 @@ static inline int get_mb_score(MpegEncContext *s, int mx, int my, ...@@ -179,8 +178,8 @@ static inline int get_mb_score(MpegEncContext *s, int mx, int my,
//FIXME factorize //FIXME factorize
cmp_sub= s->dsp.mb_cmp[size]; cmp_sub = s->mecc.mb_cmp[size];
chroma_cmp_sub= s->dsp.mb_cmp[size+1]; chroma_cmp_sub = s->mecc.mb_cmp[size + 1];
// assert(!c->skip); // assert(!c->skip);
// assert(c->avctx->me_sub_cmp != c->avctx->mb_cmp); // assert(c->avctx->me_sub_cmp != c->avctx->mb_cmp);
...@@ -226,12 +225,12 @@ static int qpel_motion_search(MpegEncContext * s, ...@@ -226,12 +225,12 @@ static int qpel_motion_search(MpegEncContext * s,
LOAD_COMMON LOAD_COMMON
int flags= c->sub_flags; int flags= c->sub_flags;
cmpf= s->dsp.me_cmp[size]; cmpf = s->mecc.me_cmp[size];
chroma_cmpf= s->dsp.me_cmp[size+1]; //factorize FIXME chroma_cmpf = s->mecc.me_cmp[size + 1]; // FIXME: factorize
//FIXME factorize //FIXME factorize
cmp_sub= s->dsp.me_sub_cmp[size]; cmp_sub = s->mecc.me_sub_cmp[size];
chroma_cmp_sub= s->dsp.me_sub_cmp[size+1]; chroma_cmp_sub = s->mecc.me_sub_cmp[size + 1];
if(c->skip){ //FIXME somehow move up (benchmark) if(c->skip){ //FIXME somehow move up (benchmark)
*mx_ptr = 0; *mx_ptr = 0;
...@@ -427,8 +426,8 @@ static av_always_inline int small_diamond_search(MpegEncContext * s, int *best, ...@@ -427,8 +426,8 @@ static av_always_inline int small_diamond_search(MpegEncContext * s, int *best,
LOAD_COMMON2 LOAD_COMMON2
unsigned map_generation = c->map_generation; unsigned map_generation = c->map_generation;
cmpf= s->dsp.me_cmp[size]; cmpf = s->mecc.me_cmp[size];
chroma_cmpf= s->dsp.me_cmp[size+1]; chroma_cmpf = s->mecc.me_cmp[size + 1];
{ /* ensure that the best point is in the MAP as h/qpel refinement needs it */ { /* ensure that the best point is in the MAP as h/qpel refinement needs it */
const unsigned key = (best[1]<<ME_MAP_MV_BITS) + best[0] + map_generation; const unsigned key = (best[1]<<ME_MAP_MV_BITS) + best[0] + map_generation;
...@@ -468,8 +467,8 @@ static int funny_diamond_search(MpegEncContext * s, int *best, int dmin, ...@@ -468,8 +467,8 @@ static int funny_diamond_search(MpegEncContext * s, int *best, int dmin,
LOAD_COMMON2 LOAD_COMMON2
unsigned map_generation = c->map_generation; unsigned map_generation = c->map_generation;
cmpf= s->dsp.me_cmp[size]; cmpf = s->mecc.me_cmp[size];
chroma_cmpf= s->dsp.me_cmp[size+1]; chroma_cmpf = s->mecc.me_cmp[size + 1];
for(dia_size=1; dia_size<=4; dia_size++){ for(dia_size=1; dia_size<=4; dia_size++){
int dir; int dir;
...@@ -511,8 +510,8 @@ static int hex_search(MpegEncContext * s, int *best, int dmin, ...@@ -511,8 +510,8 @@ static int hex_search(MpegEncContext * s, int *best, int dmin,
int x,y,d; int x,y,d;
const int dec= dia_size & (dia_size-1); const int dec= dia_size & (dia_size-1);
cmpf= s->dsp.me_cmp[size]; cmpf = s->mecc.me_cmp[size];
chroma_cmpf= s->dsp.me_cmp[size+1]; chroma_cmpf = s->mecc.me_cmp[size + 1];
for(;dia_size; dia_size= dec ? dia_size-1 : dia_size>>1){ for(;dia_size; dia_size= dec ? dia_size-1 : dia_size>>1){
do{ do{
...@@ -548,8 +547,8 @@ static int l2s_dia_search(MpegEncContext * s, int *best, int dmin, ...@@ -548,8 +547,8 @@ static int l2s_dia_search(MpegEncContext * s, int *best, int dmin,
static const int hex[8][2]={{-2, 0}, {-1,-1}, { 0,-2}, { 1,-1}, static const int hex[8][2]={{-2, 0}, {-1,-1}, { 0,-2}, { 1,-1},
{ 2, 0}, { 1, 1}, { 0, 2}, {-1, 1}}; { 2, 0}, { 1, 1}, { 0, 2}, {-1, 1}};
cmpf= s->dsp.me_cmp[size]; cmpf = s->mecc.me_cmp[size];
chroma_cmpf= s->dsp.me_cmp[size+1]; chroma_cmpf = s->mecc.me_cmp[size + 1];
for(; dia_size; dia_size= dec ? dia_size-1 : dia_size>>1){ for(; dia_size; dia_size= dec ? dia_size-1 : dia_size>>1){
do{ do{
...@@ -587,8 +586,8 @@ static int umh_search(MpegEncContext * s, int *best, int dmin, ...@@ -587,8 +586,8 @@ static int umh_search(MpegEncContext * s, int *best, int dmin,
{-2, 3}, { 0, 4}, { 2, 3}, {-2, 3}, { 0, 4}, { 2, 3},
{-2,-3}, { 0,-4}, { 2,-3},}; {-2,-3}, { 0,-4}, { 2,-3},};
cmpf= s->dsp.me_cmp[size]; cmpf = s->mecc.me_cmp[size];
chroma_cmpf= s->dsp.me_cmp[size+1]; chroma_cmpf = s->mecc.me_cmp[size + 1];
x= best[0]; x= best[0];
y= best[1]; y= best[1];
...@@ -630,8 +629,8 @@ static int full_search(MpegEncContext * s, int *best, int dmin, ...@@ -630,8 +629,8 @@ static int full_search(MpegEncContext * s, int *best, int dmin,
int x,y, d; int x,y, d;
const int dia_size= c->dia_size&0xFF; const int dia_size= c->dia_size&0xFF;
cmpf= s->dsp.me_cmp[size]; cmpf = s->mecc.me_cmp[size];
chroma_cmpf= s->dsp.me_cmp[size+1]; chroma_cmpf = s->mecc.me_cmp[size + 1];
for(y=FFMAX(-dia_size, ymin); y<=FFMIN(dia_size,ymax); y++){ for(y=FFMAX(-dia_size, ymin); y<=FFMIN(dia_size,ymax); y++){
for(x=FFMAX(-dia_size, xmin); x<=FFMIN(dia_size,xmax); x++){ for(x=FFMAX(-dia_size, xmin); x<=FFMIN(dia_size,xmax); x++){
...@@ -694,8 +693,8 @@ static int sab_diamond_search(MpegEncContext * s, int *best, int dmin, ...@@ -694,8 +693,8 @@ static int sab_diamond_search(MpegEncContext * s, int *best, int dmin,
LOAD_COMMON2 LOAD_COMMON2
unsigned map_generation = c->map_generation; unsigned map_generation = c->map_generation;
cmpf= s->dsp.me_cmp[size]; cmpf = s->mecc.me_cmp[size];
chroma_cmpf= s->dsp.me_cmp[size+1]; chroma_cmpf = s->mecc.me_cmp[size + 1];
/*Note j<MAX_SAB_SIZE is needed if MAX_SAB_SIZE < ME_MAP_SIZE as j can /*Note j<MAX_SAB_SIZE is needed if MAX_SAB_SIZE < ME_MAP_SIZE as j can
become larger due to MVs overflowing their ME_MAP_MV_BITS bits space in map become larger due to MVs overflowing their ME_MAP_MV_BITS bits space in map
...@@ -779,8 +778,8 @@ static int var_diamond_search(MpegEncContext * s, int *best, int dmin, ...@@ -779,8 +778,8 @@ static int var_diamond_search(MpegEncContext * s, int *best, int dmin,
LOAD_COMMON2 LOAD_COMMON2
unsigned map_generation = c->map_generation; unsigned map_generation = c->map_generation;
cmpf= s->dsp.me_cmp[size]; cmpf = s->mecc.me_cmp[size];
chroma_cmpf= s->dsp.me_cmp[size+1]; chroma_cmpf = s->mecc.me_cmp[size + 1];
for(dia_size=1; dia_size<=c->dia_size; dia_size++){ for(dia_size=1; dia_size<=c->dia_size; dia_size++){
int dir, start, end; int dir, start, end;
...@@ -880,12 +879,12 @@ static av_always_inline int epzs_motion_search_internal(MpegEncContext * s, int ...@@ -880,12 +879,12 @@ static av_always_inline int epzs_motion_search_internal(MpegEncContext * s, int
if(c->pre_pass){ if(c->pre_pass){
penalty_factor= c->pre_penalty_factor; penalty_factor= c->pre_penalty_factor;
cmpf= s->dsp.me_pre_cmp[size]; cmpf = s->mecc.me_pre_cmp[size];
chroma_cmpf= s->dsp.me_pre_cmp[size+1]; chroma_cmpf = s->mecc.me_pre_cmp[size + 1];
}else{ }else{
penalty_factor= c->penalty_factor; penalty_factor= c->penalty_factor;
cmpf= s->dsp.me_cmp[size]; cmpf = s->mecc.me_cmp[size];
chroma_cmpf= s->dsp.me_cmp[size+1]; chroma_cmpf = s->mecc.me_cmp[size + 1];
} }
map_generation= update_map_generation(c); map_generation= update_map_generation(c);
...@@ -1009,8 +1008,8 @@ static int epzs_motion_search4(MpegEncContext * s, ...@@ -1009,8 +1008,8 @@ static int epzs_motion_search4(MpegEncContext * s,
int flags= c->flags; int flags= c->flags;
LOAD_COMMON2 LOAD_COMMON2
cmpf= s->dsp.me_cmp[size]; cmpf = s->mecc.me_cmp[size];
chroma_cmpf= s->dsp.me_cmp[size+1]; chroma_cmpf = s->mecc.me_cmp[size + 1];
map_generation= update_map_generation(c); map_generation= update_map_generation(c);
...@@ -1068,8 +1067,8 @@ static int epzs_motion_search2(MpegEncContext * s, ...@@ -1068,8 +1067,8 @@ static int epzs_motion_search2(MpegEncContext * s,
int flags= c->flags; int flags= c->flags;
LOAD_COMMON2 LOAD_COMMON2
cmpf= s->dsp.me_cmp[size]; cmpf = s->mecc.me_cmp[size];
chroma_cmpf= s->dsp.me_cmp[size+1]; chroma_cmpf = s->mecc.me_cmp[size + 1];
map_generation= update_map_generation(c); map_generation= update_map_generation(c);
......
...@@ -689,7 +689,7 @@ void ff_mpeg4_encode_mb(MpegEncContext *s, int16_t block[6][64], ...@@ -689,7 +689,7 @@ void ff_mpeg4_encode_mb(MpegEncContext *s, int16_t block[6][64],
b_pic = pic->f->data[0] + offset; b_pic = pic->f->data[0] + offset;
if (!pic->shared) if (!pic->shared)
b_pic += INPLACE_OFFSET; b_pic += INPLACE_OFFSET;
diff = s->dsp.sad[0](NULL, p_pic, b_pic, s->linesize, 16); diff = s->mecc.sad[0](NULL, p_pic, b_pic, s->linesize, 16);
if (diff > s->qscale * 70) { // FIXME check that 70 is optimal if (diff > s->qscale * 70) { // FIXME check that 70 is optimal
s->mb_skipped = 0; s->mb_skipped = 0;
break; break;
......
...@@ -378,9 +378,9 @@ static void mpeg_er_decode_mb(void *opaque, int ref, int mv_dir, int mv_type, ...@@ -378,9 +378,9 @@ 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) av_cold int ff_dct_common_init(MpegEncContext *s)
{ {
ff_blockdsp_init(&s->bdsp, s->avctx); ff_blockdsp_init(&s->bdsp, s->avctx);
ff_dsputil_init(&s->dsp, s->avctx);
ff_hpeldsp_init(&s->hdsp, s->avctx->flags); ff_hpeldsp_init(&s->hdsp, s->avctx->flags);
ff_idctdsp_init(&s->idsp, s->avctx); ff_idctdsp_init(&s->idsp, s->avctx);
ff_me_cmp_init(&s->mecc, s->avctx);
ff_mpegvideodsp_init(&s->mdsp); ff_mpegvideodsp_init(&s->mdsp);
ff_videodsp_init(&s->vdsp, s->avctx->bits_per_raw_sample); ff_videodsp_init(&s->vdsp, s->avctx->bits_per_raw_sample);
...@@ -1051,7 +1051,7 @@ static int init_er(MpegEncContext *s) ...@@ -1051,7 +1051,7 @@ static int init_er(MpegEncContext *s)
int i; int i;
er->avctx = s->avctx; er->avctx = s->avctx;
er->dsp = &s->dsp; er->mecc = &s->mecc;
er->mb_index2xy = s->mb_index2xy; er->mb_index2xy = s->mb_index2xy;
er->mb_num = s->mb_num; er->mb_num = s->mb_num;
......
...@@ -30,13 +30,13 @@ ...@@ -30,13 +30,13 @@
#include "avcodec.h" #include "avcodec.h"
#include "blockdsp.h" #include "blockdsp.h"
#include "dsputil.h"
#include "error_resilience.h" #include "error_resilience.h"
#include "fdctdsp.h" #include "fdctdsp.h"
#include "get_bits.h" #include "get_bits.h"
#include "h263dsp.h" #include "h263dsp.h"
#include "hpeldsp.h" #include "hpeldsp.h"
#include "idctdsp.h" #include "idctdsp.h"
#include "me_cmp.h"
#include "mpegvideodsp.h" #include "mpegvideodsp.h"
#include "mpegvideoencdsp.h" #include "mpegvideoencdsp.h"
#include "pixblockdsp.h" #include "pixblockdsp.h"
...@@ -356,10 +356,10 @@ typedef struct MpegEncContext { ...@@ -356,10 +356,10 @@ typedef struct MpegEncContext {
int h263_long_vectors; ///< use horrible h263v1 long vector mode int h263_long_vectors; ///< use horrible h263v1 long vector mode
BlockDSPContext bdsp; BlockDSPContext bdsp;
DSPContext dsp; ///< pointers for accelerated dsp functions
FDCTDSPContext fdsp; FDCTDSPContext fdsp;
HpelDSPContext hdsp; HpelDSPContext hdsp;
IDCTDSPContext idsp; IDCTDSPContext idsp;
MECmpContext mecc;
MpegVideoDSPContext mdsp; MpegVideoDSPContext mdsp;
MpegvideoEncDSPContext mpvencdsp; MpegvideoEncDSPContext mpvencdsp;
PixblockDSPContext pdsp; PixblockDSPContext pdsp;
......
This diff is collapsed.
...@@ -24,8 +24,8 @@ ...@@ -24,8 +24,8 @@
#include "libavutil/attributes.h" #include "libavutil/attributes.h"
#include "libavutil/imgutils.h" #include "libavutil/imgutils.h"
#include "avcodec.h" #include "avcodec.h"
#include "dsputil.h"
#include "imgconvert.h" #include "imgconvert.h"
#include "me_cmp.h"
#include "mpegvideoencdsp.h" #include "mpegvideoencdsp.h"
static int try_8x8basis_c(int16_t rem[64], int16_t weight[64], static int try_8x8basis_c(int16_t rem[64], int16_t weight[64],
......
...@@ -2,7 +2,6 @@ OBJS += ppc/fmtconvert_altivec.o \ ...@@ -2,7 +2,6 @@ OBJS += ppc/fmtconvert_altivec.o \
OBJS-$(CONFIG_AUDIODSP) += ppc/audiodsp.o OBJS-$(CONFIG_AUDIODSP) += ppc/audiodsp.o
OBJS-$(CONFIG_BLOCKDSP) += ppc/blockdsp.o OBJS-$(CONFIG_BLOCKDSP) += ppc/blockdsp.o
OBJS-$(CONFIG_DSPUTIL) += ppc/dsputil_altivec.o
OBJS-$(CONFIG_FFT) += ppc/fft_altivec.o OBJS-$(CONFIG_FFT) += ppc/fft_altivec.o
OBJS-$(CONFIG_H264CHROMA) += ppc/h264chroma_init.o OBJS-$(CONFIG_H264CHROMA) += ppc/h264chroma_init.o
OBJS-$(CONFIG_H264DSP) += ppc/h264dsp.o OBJS-$(CONFIG_H264DSP) += ppc/h264dsp.o
...@@ -11,6 +10,7 @@ OBJS-$(CONFIG_HPELDSP) += ppc/hpeldsp_altivec.o ...@@ -11,6 +10,7 @@ OBJS-$(CONFIG_HPELDSP) += ppc/hpeldsp_altivec.o
OBJS-$(CONFIG_HUFFYUVDSP) += ppc/huffyuvdsp_altivec.o OBJS-$(CONFIG_HUFFYUVDSP) += ppc/huffyuvdsp_altivec.o
OBJS-$(CONFIG_FDCTDSP) += ppc/fdctdsp.o OBJS-$(CONFIG_FDCTDSP) += ppc/fdctdsp.o
OBJS-$(CONFIG_IDCTDSP) += ppc/idctdsp.o OBJS-$(CONFIG_IDCTDSP) += ppc/idctdsp.o
OBJS-$(CONFIG_ME_CMP) += ppc/me_cmp.o
OBJS-$(CONFIG_MPEGAUDIODSP) += ppc/mpegaudiodsp_altivec.o OBJS-$(CONFIG_MPEGAUDIODSP) += ppc/mpegaudiodsp_altivec.o
OBJS-$(CONFIG_MPEGVIDEO) += ppc/mpegvideo_altivec.o \ OBJS-$(CONFIG_MPEGVIDEO) += ppc/mpegvideo_altivec.o \
ppc/mpegvideodsp.o ppc/mpegvideodsp.o
......
...@@ -31,8 +31,8 @@ ...@@ -31,8 +31,8 @@
#include "libavutil/ppc/types_altivec.h" #include "libavutil/ppc/types_altivec.h"
#include "libavutil/ppc/util_altivec.h" #include "libavutil/ppc/util_altivec.h"
#include "libavcodec/avcodec.h" #include "libavcodec/avcodec.h"
#include "libavcodec/dsputil.h"
#include "libavcodec/mpegvideo.h" #include "libavcodec/mpegvideo.h"
#include "libavcodec/me_cmp.h"
#if HAVE_ALTIVEC #if HAVE_ALTIVEC
static int sad16_x2_altivec(MpegEncContext *v, uint8_t *pix1, uint8_t *pix2, static int sad16_x2_altivec(MpegEncContext *v, uint8_t *pix1, uint8_t *pix2,
...@@ -744,7 +744,7 @@ static int hadamard8_diff16_altivec(MpegEncContext *s, uint8_t *dst, ...@@ -744,7 +744,7 @@ static int hadamard8_diff16_altivec(MpegEncContext *s, uint8_t *dst,
} }
#endif /* HAVE_ALTIVEC */ #endif /* HAVE_ALTIVEC */
av_cold void ff_dsputil_init_ppc(DSPContext *c, AVCodecContext *avctx) av_cold void ff_me_cmp_init_ppc(MECmpContext *c, AVCodecContext *avctx)
{ {
#if HAVE_ALTIVEC #if HAVE_ALTIVEC
if (!PPC_ALTIVEC(av_get_cpu_flags())) if (!PPC_ALTIVEC(av_get_cpu_flags()))
......
...@@ -27,8 +27,8 @@ ...@@ -27,8 +27,8 @@
*/ */
#include "avcodec.h" #include "avcodec.h"
#include "dsputil.h"
#include "hpeldsp.h" #include "hpeldsp.h"
#include "me_cmp.h"
#include "mpegvideo.h" #include "mpegvideo.h"
#include "h263.h" #include "h263.h"
#include "internal.h" #include "internal.h"
...@@ -306,7 +306,7 @@ static int svq1_encode_plane(SVQ1EncContext *s, int plane, ...@@ -306,7 +306,7 @@ static int svq1_encode_plane(SVQ1EncContext *s, int plane,
s->m.current_picture.motion_val[0] = s->motion_val8[plane] + 2; s->m.current_picture.motion_val[0] = s->motion_val8[plane] + 2;
s->m.p_mv_table = s->motion_val16[plane] + s->m.p_mv_table = s->motion_val16[plane] +
s->m.mb_stride + 1; s->m.mb_stride + 1;
s->m.dsp = s->dsp; // move s->m.mecc = s->mecc; // move
ff_init_me(&s->m); ff_init_me(&s->m);
s->m.me.dia_size = s->avctx->dia_size; s->m.me.dia_size = s->avctx->dia_size;
...@@ -431,8 +431,8 @@ static int svq1_encode_plane(SVQ1EncContext *s, int plane, ...@@ -431,8 +431,8 @@ static int svq1_encode_plane(SVQ1EncContext *s, int plane,
best = score[1] <= score[0]; best = score[1] <= score[0];
vlc = ff_svq1_block_type_vlc[SVQ1_BLOCK_SKIP]; vlc = ff_svq1_block_type_vlc[SVQ1_BLOCK_SKIP];
score[2] = s->dsp.sse[0](NULL, src + 16 * x, ref, score[2] = s->mecc.sse[0](NULL, src + 16 * x, ref,
stride, 16); stride, 16);
score[2] += vlc[1] * lambda; score[2] += vlc[1] * lambda;
if (score[2] < score[best] && mx == 0 && my == 0) { if (score[2] < score[best] && mx == 0 && my == 0) {
best = 2; best = 2;
...@@ -509,8 +509,8 @@ static av_cold int svq1_encode_init(AVCodecContext *avctx) ...@@ -509,8 +509,8 @@ static av_cold int svq1_encode_init(AVCodecContext *avctx)
SVQ1EncContext *const s = avctx->priv_data; SVQ1EncContext *const s = avctx->priv_data;
int ret; int ret;
ff_dsputil_init(&s->dsp, avctx);
ff_hpeldsp_init(&s->hdsp, avctx->flags); ff_hpeldsp_init(&s->hdsp, avctx->flags);
ff_me_cmp_init(&s->mecc, avctx);
ff_mpegvideoencdsp_init(&s->m.mpvencdsp, avctx); ff_mpegvideoencdsp_init(&s->m.mpvencdsp, avctx);
avctx->coded_frame = av_frame_alloc(); avctx->coded_frame = av_frame_alloc();
......
...@@ -25,9 +25,9 @@ ...@@ -25,9 +25,9 @@
#include "libavutil/frame.h" #include "libavutil/frame.h"
#include "avcodec.h" #include "avcodec.h"
#include "dsputil.h"
#include "get_bits.h" #include "get_bits.h"
#include "hpeldsp.h" #include "hpeldsp.h"
#include "me_cmp.h"
#include "mpegvideo.h" #include "mpegvideo.h"
#include "put_bits.h" #include "put_bits.h"
...@@ -37,7 +37,7 @@ typedef struct SVQ1EncContext { ...@@ -37,7 +37,7 @@ typedef struct SVQ1EncContext {
* of MpegEncContext, so this will be removed then. */ * of MpegEncContext, so this will be removed then. */
MpegEncContext m; MpegEncContext m;
AVCodecContext *avctx; AVCodecContext *avctx;
DSPContext dsp; MECmpContext mecc;
HpelDSPContext hdsp; HpelDSPContext hdsp;
AVFrame *current_picture; AVFrame *current_picture;
AVFrame *last_picture; AVFrame *last_picture;
......
...@@ -39,8 +39,8 @@ ...@@ -39,8 +39,8 @@
#include "libavutil/samplefmt.h" #include "libavutil/samplefmt.h"
#include "libavutil/dict.h" #include "libavutil/dict.h"
#include "avcodec.h" #include "avcodec.h"
#include "dsputil.h"
#include "libavutil/opt.h" #include "libavutil/opt.h"
#include "me_cmp.h"
#include "mpegvideo.h" #include "mpegvideo.h"
#include "thread.h" #include "thread.h"
#include "internal.h" #include "internal.h"
...@@ -100,8 +100,8 @@ static av_cold void avcodec_init(void) ...@@ -100,8 +100,8 @@ static av_cold void avcodec_init(void)
return; return;
initialized = 1; initialized = 1;
if (CONFIG_DSPUTIL) if (CONFIG_ME_CMP)
ff_dsputil_static_init(); ff_me_cmp_init_static();
} }
int av_codec_is_encoder(const AVCodec *codec) int av_codec_is_encoder(const AVCodec *codec)
......
...@@ -6,7 +6,6 @@ OBJS-$(CONFIG_AUDIODSP) += x86/audiodsp_init.o ...@@ -6,7 +6,6 @@ OBJS-$(CONFIG_AUDIODSP) += x86/audiodsp_init.o
OBJS-$(CONFIG_BLOCKDSP) += x86/blockdsp.o OBJS-$(CONFIG_BLOCKDSP) += x86/blockdsp.o
OBJS-$(CONFIG_BSWAPDSP) += x86/bswapdsp_init.o OBJS-$(CONFIG_BSWAPDSP) += x86/bswapdsp_init.o
OBJS-$(CONFIG_DCT) += x86/dct_init.o OBJS-$(CONFIG_DCT) += x86/dct_init.o
OBJS-$(CONFIG_DSPUTIL) += x86/dsputil_init.o
OBJS-$(CONFIG_FDCTDSP) += x86/fdctdsp_init.o OBJS-$(CONFIG_FDCTDSP) += x86/fdctdsp_init.o
OBJS-$(CONFIG_FFT) += x86/fft_init.o OBJS-$(CONFIG_FFT) += x86/fft_init.o
OBJS-$(CONFIG_H263DSP) += x86/h263dsp_init.o OBJS-$(CONFIG_H263DSP) += x86/h263dsp_init.o
...@@ -19,6 +18,7 @@ OBJS-$(CONFIG_HUFFYUVDSP) += x86/huffyuvdsp_init.o ...@@ -19,6 +18,7 @@ OBJS-$(CONFIG_HUFFYUVDSP) += x86/huffyuvdsp_init.o
OBJS-$(CONFIG_HUFFYUVENCDSP) += x86/huffyuvencdsp_mmx.o OBJS-$(CONFIG_HUFFYUVENCDSP) += x86/huffyuvencdsp_mmx.o
OBJS-$(CONFIG_IDCTDSP) += x86/idctdsp_init.o OBJS-$(CONFIG_IDCTDSP) += x86/idctdsp_init.o
OBJS-$(CONFIG_LPC) += x86/lpc.o OBJS-$(CONFIG_LPC) += x86/lpc.o
OBJS-$(CONFIG_ME_CMP) += x86/me_cmp_init.o
OBJS-$(CONFIG_MPEGAUDIODSP) += x86/mpegaudiodsp.o OBJS-$(CONFIG_MPEGAUDIODSP) += x86/mpegaudiodsp.o
OBJS-$(CONFIG_MPEGVIDEO) += x86/mpegvideo.o \ OBJS-$(CONFIG_MPEGVIDEO) += x86/mpegvideo.o \
x86/mpegvideodsp.o x86/mpegvideodsp.o
...@@ -70,7 +70,6 @@ YASM-OBJS-$(CONFIG_AUDIODSP) += x86/audiodsp.o ...@@ -70,7 +70,6 @@ YASM-OBJS-$(CONFIG_AUDIODSP) += x86/audiodsp.o
YASM-OBJS-$(CONFIG_BSWAPDSP) += x86/bswapdsp.o YASM-OBJS-$(CONFIG_BSWAPDSP) += x86/bswapdsp.o
YASM-OBJS-$(CONFIG_DCT) += x86/dct32.o YASM-OBJS-$(CONFIG_DCT) += x86/dct32.o
YASM-OBJS-$(CONFIG_DNXHD_ENCODER) += x86/dnxhdenc.o YASM-OBJS-$(CONFIG_DNXHD_ENCODER) += x86/dnxhdenc.o
YASM-OBJS-$(CONFIG_DSPUTIL) += x86/dsputilenc.o
YASM-OBJS-$(CONFIG_FFT) += x86/fft.o YASM-OBJS-$(CONFIG_FFT) += x86/fft.o
YASM-OBJS-$(CONFIG_H263DSP) += x86/h263_loopfilter.o YASM-OBJS-$(CONFIG_H263DSP) += x86/h263_loopfilter.o
YASM-OBJS-$(CONFIG_H264CHROMA) += x86/h264_chromamc.o \ YASM-OBJS-$(CONFIG_H264CHROMA) += x86/h264_chromamc.o \
...@@ -90,6 +89,7 @@ YASM-OBJS-$(CONFIG_H264QPEL) += x86/h264_qpel_8bit.o \ ...@@ -90,6 +89,7 @@ YASM-OBJS-$(CONFIG_H264QPEL) += x86/h264_qpel_8bit.o \
YASM-OBJS-$(CONFIG_HPELDSP) += x86/fpel.o \ YASM-OBJS-$(CONFIG_HPELDSP) += x86/fpel.o \
x86/hpeldsp.o x86/hpeldsp.o
YASM-OBJS-$(CONFIG_HUFFYUVDSP) += x86/huffyuvdsp.o YASM-OBJS-$(CONFIG_HUFFYUVDSP) += x86/huffyuvdsp.o
YASM-OBJS-$(CONFIG_ME_CMP) += x86/me_cmp.o
YASM-OBJS-$(CONFIG_MPEGAUDIODSP) += x86/imdct36.o YASM-OBJS-$(CONFIG_MPEGAUDIODSP) += x86/imdct36.o
YASM-OBJS-$(CONFIG_MPEGVIDEOENC) += x86/mpegvideoencdsp.o YASM-OBJS-$(CONFIG_MPEGVIDEOENC) += x86/mpegvideoencdsp.o
YASM-OBJS-$(CONFIG_PIXBLOCKDSP) += x86/pixblockdsp.o YASM-OBJS-$(CONFIG_PIXBLOCKDSP) += x86/pixblockdsp.o
......
;***************************************************************************** ;*****************************************************************************
;* MMX optimized DSP utils ;* SIMD-optimized motion compensation estimation
;***************************************************************************** ;*****************************************************************************
;* Copyright (c) 2000, 2001 Fabrice Bellard ;* Copyright (c) 2000, 2001 Fabrice Bellard
;* Copyright (c) 2002-2004 Michael Niedermayer <michaelni@gmx.at> ;* Copyright (c) 2002-2004 Michael Niedermayer <michaelni@gmx.at>
......
/* /*
* MMX optimized DSP utils * SIMD-optimized motion estimation
* Copyright (c) 2000, 2001 Fabrice Bellard * Copyright (c) 2000, 2001 Fabrice Bellard
* Copyright (c) 2002-2004 Michael Niedermayer <michaelni@gmx.at> * Copyright (c) 2002-2004 Michael Niedermayer <michaelni@gmx.at>
* *
...@@ -26,7 +26,7 @@ ...@@ -26,7 +26,7 @@
#include "libavutil/cpu.h" #include "libavutil/cpu.h"
#include "libavutil/x86/asm.h" #include "libavutil/x86/asm.h"
#include "libavutil/x86/cpu.h" #include "libavutil/x86/cpu.h"
#include "libavcodec/dsputil.h" #include "libavcodec/me_cmp.h"
#include "libavcodec/mpegvideo.h" #include "libavcodec/mpegvideo.h"
#if HAVE_INLINE_ASM #if HAVE_INLINE_ASM
...@@ -411,7 +411,7 @@ static int nsse16_mmx(MpegEncContext *c, uint8_t *pix1, uint8_t *pix2, ...@@ -411,7 +411,7 @@ static int nsse16_mmx(MpegEncContext *c, uint8_t *pix1, uint8_t *pix2,
int score1, score2; int score1, score2;
if (c) if (c)
score1 = c->dsp.sse[0](c, pix1, pix2, line_size, h); score1 = c->mecc.sse[0](c, pix1, pix2, line_size, h);
else else
score1 = sse16_mmx(c, pix1, pix2, line_size, h); score1 = sse16_mmx(c, pix1, pix2, line_size, h);
score2 = hf_noise16_mmx(pix1, line_size, h) - score2 = hf_noise16_mmx(pix1, line_size, h) -
...@@ -1225,7 +1225,7 @@ hadamard_func(mmxext) ...@@ -1225,7 +1225,7 @@ hadamard_func(mmxext)
hadamard_func(sse2) hadamard_func(sse2)
hadamard_func(ssse3) hadamard_func(ssse3)
av_cold void ff_dsputil_init_x86(DSPContext *c, AVCodecContext *avctx) av_cold void ff_me_cmp_init_x86(MECmpContext *c, AVCodecContext *avctx)
{ {
int cpu_flags = av_get_cpu_flags(); int cpu_flags = av_get_cpu_flags();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment