Commit 35bb7490 authored by Michael Niedermayer's avatar Michael Niedermayer

Merge commit 'c67b449b'

* commit 'c67b449b':
  dsputil: Split bswap*_buf() off into a separate context

Conflicts:
	configure
	libavcodec/4xm.c
	libavcodec/ac3dec.c
	libavcodec/ac3dec.h
	libavcodec/apedec.c
	libavcodec/eamad.c
	libavcodec/flacenc.c
	libavcodec/fraps.c
	libavcodec/huffyuv.c
	libavcodec/huffyuvdec.c
	libavcodec/motionpixels.c
	libavcodec/truemotion2.c
	libavcodec/x86/Makefile
	libavcodec/x86/dsputil_init.c
Merged-by: 's avatarMichael Niedermayer <michaelni@gmx.at>
parents 56afbe8d c67b449b
...@@ -1797,6 +1797,7 @@ CONFIG_EXTRA=" ...@@ -1797,6 +1797,7 @@ CONFIG_EXTRA="
audio_frame_queue audio_frame_queue
audiodsp audiodsp
blockdsp blockdsp
bswapdsp
cabac cabac
dsputil dsputil
exif exif
...@@ -2006,22 +2007,23 @@ mpegvideoenc_select="dsputil mpegvideo qpeldsp" ...@@ -2006,22 +2007,23 @@ mpegvideoenc_select="dsputil mpegvideo qpeldsp"
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="mdct ac3dsp ac3_parser dsputil" ac3_decoder_select="ac3_parser ac3dsp bswapdsp mdct"
ac3_fixed_decoder_select="mdct ac3dsp ac3_parser dsputil" ac3_fixed_decoder_select="ac3_parser ac3dsp bswapdsp mdct"
ac3_encoder_select="ac3dsp audiodsp dsputil mdct" ac3_encoder_select="ac3dsp audiodsp dsputil mdct"
ac3_fixed_encoder_select="ac3dsp audiodsp dsputil mdct" ac3_fixed_encoder_select="ac3dsp audiodsp dsputil mdct"
aic_decoder_select="dsputil golomb" aic_decoder_select="dsputil golomb"
alac_encoder_select="lpc" alac_encoder_select="lpc"
als_decoder_select="dsputil" als_decoder_select="bswapdsp"
amrnb_decoder_select="lsp" amrnb_decoder_select="lsp"
amrwb_decoder_select="lsp" amrwb_decoder_select="lsp"
amv_decoder_select="sp5x_decoder exif" amv_decoder_select="sp5x_decoder exif"
amv_encoder_select="aandcttables" amv_encoder_select="aandcttables"
ape_decoder_select="dsputil llauddsp" ape_decoder_select="bswapdsp llauddsp"
asv1_decoder_select="blockdsp dsputil" ape_decoder_select="bswapdsp"
asv1_encoder_select="dsputil" asv1_decoder_select="blockdsp bswapdsp dsputil"
asv2_decoder_select="blockdsp dsputil" asv1_encoder_select="bswapdsp dsputil"
asv2_encoder_select="dsputil" asv2_decoder_select="blockdsp bswapdsp dsputil"
asv2_encoder_select="bswapdsp dsputil"
atrac1_decoder_select="mdct sinewin" atrac1_decoder_select="mdct sinewin"
atrac3_decoder_select="mdct" atrac3_decoder_select="mdct"
atrac3p_decoder_select="mdct sinewin" atrac3p_decoder_select="mdct sinewin"
...@@ -2030,7 +2032,7 @@ bink_decoder_select="blockdsp hpeldsp" ...@@ -2030,7 +2032,7 @@ bink_decoder_select="blockdsp hpeldsp"
binkaudio_dct_decoder_select="mdct rdft dct sinewin" binkaudio_dct_decoder_select="mdct rdft dct sinewin"
binkaudio_rdft_decoder_select="mdct rdft sinewin" binkaudio_rdft_decoder_select="mdct rdft sinewin"
cavs_decoder_select="blockdsp dsputil golomb h264chroma qpeldsp videodsp" cavs_decoder_select="blockdsp dsputil golomb h264chroma qpeldsp videodsp"
cllc_decoder_select="dsputil" cllc_decoder_select="bswapdsp"
comfortnoise_encoder_select="lpc" comfortnoise_encoder_select="lpc"
cook_decoder_select="audiodsp mdct sinewin" cook_decoder_select="audiodsp mdct sinewin"
cscd_decoder_select="lzo" cscd_decoder_select="lzo"
...@@ -2044,9 +2046,9 @@ dvvideo_encoder_select="dsputil" ...@@ -2044,9 +2046,9 @@ dvvideo_encoder_select="dsputil"
dxa_decoder_select="zlib" dxa_decoder_select="zlib"
eac3_decoder_select="ac3_decoder" eac3_decoder_select="ac3_decoder"
eac3_encoder_select="ac3_encoder" eac3_encoder_select="ac3_encoder"
eamad_decoder_select="aandcttables blockdsp dsputil mpegvideo" eamad_decoder_select="aandcttables blockdsp bswapdsp dsputil mpegvideo"
eatgq_decoder_select="aandcttables" eatgq_decoder_select="aandcttables"
eatqi_decoder_select="aandcttables blockdsp dsputil mpeg1video_decoder" eatqi_decoder_select="aandcttables blockdsp bswapdsp dsputil mpeg1video_decoder"
exr_decoder_select="zlib" exr_decoder_select="zlib"
ffv1_decoder_select="golomb rangecoder" ffv1_decoder_select="golomb rangecoder"
ffv1_encoder_select="rangecoder" ffv1_encoder_select="rangecoder"
...@@ -2054,15 +2056,15 @@ ffvhuff_decoder_select="huffyuv_decoder" ...@@ -2054,15 +2056,15 @@ ffvhuff_decoder_select="huffyuv_decoder"
ffvhuff_encoder_select="huffyuv_encoder" ffvhuff_encoder_select="huffyuv_encoder"
fic_decoder_select="golomb" fic_decoder_select="golomb"
flac_decoder_select="golomb" flac_decoder_select="golomb"
flac_encoder_select="dsputil golomb lpc" flac_encoder_select="bswapdsp golomb lpc"
flashsv_decoder_select="zlib" flashsv_decoder_select="zlib"
flashsv_encoder_select="zlib" flashsv_encoder_select="zlib"
flashsv2_encoder_select="zlib" flashsv2_encoder_select="zlib"
flashsv2_decoder_select="zlib" flashsv2_decoder_select="zlib"
flv_decoder_select="h263_decoder" flv_decoder_select="h263_decoder"
flv_encoder_select="h263_encoder" flv_encoder_select="h263_encoder"
fourxm_decoder_select="blockdsp dsputil" fourxm_decoder_select="blockdsp bswapdsp"
fraps_decoder_select="dsputil huffman" fraps_decoder_select="bswapdsp huffman"
g2m_decoder_select="blockdsp dsputil zlib" g2m_decoder_select="blockdsp dsputil zlib"
g729_decoder_select="dsputil" g729_decoder_select="dsputil"
h261_decoder_select="mpeg_er mpegvideo" h261_decoder_select="mpeg_er mpegvideo"
...@@ -2073,11 +2075,11 @@ h263i_decoder_select="h263_decoder" ...@@ -2073,11 +2075,11 @@ h263i_decoder_select="h263_decoder"
h263p_encoder_select="h263_encoder" h263p_encoder_select="h263_encoder"
h264_decoder_select="cabac golomb h264chroma h264dsp h264pred h264qpel videodsp" h264_decoder_select="cabac golomb h264chroma h264dsp h264pred h264qpel videodsp"
h264_decoder_suggest="error_resilience" h264_decoder_suggest="error_resilience"
hevc_decoder_select="cabac dsputil golomb videodsp" hevc_decoder_select="bswapdsp cabac golomb videodsp"
huffyuv_decoder_select="dsputil huffyuvdsp llviddsp" huffyuv_decoder_select="bswapdsp huffyuvdsp llviddsp"
huffyuv_encoder_select="dsputil huffman huffyuvencdsp llviddsp" huffyuv_encoder_select="bswapdsp huffman huffyuvencdsp llviddsp"
iac_decoder_select="imc_decoder" iac_decoder_select="imc_decoder"
imc_decoder_select="dsputil fft mdct sinewin" imc_decoder_select="bswapdsp fft mdct sinewin"
indeo3_decoder_select="hpeldsp" indeo3_decoder_select="hpeldsp"
interplay_video_decoder_select="hpeldsp" interplay_video_decoder_select="hpeldsp"
jpegls_decoder_select="golomb mjpeg_decoder" jpegls_decoder_select="golomb mjpeg_decoder"
...@@ -2088,12 +2090,12 @@ ljpeg_encoder_select="aandcttables mpegvideoenc" ...@@ -2088,12 +2090,12 @@ ljpeg_encoder_select="aandcttables mpegvideoenc"
loco_decoder_select="golomb" loco_decoder_select="golomb"
mdec_decoder_select="blockdsp dsputil mpegvideo" mdec_decoder_select="blockdsp dsputil mpegvideo"
metasound_decoder_select="lsp mdct sinewin" metasound_decoder_select="lsp mdct sinewin"
mimic_decoder_select="blockdsp dsputil hpeldsp" mimic_decoder_select="blockdsp bswapdsp dsputil hpeldsp"
mjpeg_decoder_select="blockdsp dsputil hpeldsp exif" mjpeg_decoder_select="blockdsp dsputil hpeldsp exif"
mjpeg_encoder_select="aandcttables mpegvideoenc" mjpeg_encoder_select="aandcttables mpegvideoenc"
mjpegb_decoder_select="mjpeg_decoder" mjpegb_decoder_select="mjpeg_decoder"
mlp_decoder_select="mlp_parser" mlp_decoder_select="mlp_parser"
motionpixels_decoder_select="dsputil" motionpixels_decoder_select="bswapdsp"
mp1_decoder_select="mpegaudio" mp1_decoder_select="mpegaudio"
mp1float_decoder_select="mpegaudio" mp1float_decoder_select="mpegaudio"
mp2_decoder_select="mpegaudio" mp2_decoder_select="mpegaudio"
...@@ -2104,7 +2106,7 @@ mp3adufloat_decoder_select="mpegaudio" ...@@ -2104,7 +2106,7 @@ mp3adufloat_decoder_select="mpegaudio"
mp3float_decoder_select="mpegaudio" mp3float_decoder_select="mpegaudio"
mp3on4_decoder_select="mpegaudio" mp3on4_decoder_select="mpegaudio"
mp3on4float_decoder_select="mpegaudio" mp3on4float_decoder_select="mpegaudio"
mpc7_decoder_select="dsputil mpegaudiodsp" mpc7_decoder_select="bswapdsp mpegaudiodsp"
mpc8_decoder_select="mpegaudiodsp" mpc8_decoder_select="mpegaudiodsp"
mpeg_xvmc_decoder_deps="X11_extensions_XvMClib_h" mpeg_xvmc_decoder_deps="X11_extensions_XvMClib_h"
mpeg_xvmc_decoder_select="mpeg2video_decoder" mpeg_xvmc_decoder_select="mpeg2video_decoder"
...@@ -2160,12 +2162,12 @@ thp_decoder_select="mjpeg_decoder" ...@@ -2160,12 +2162,12 @@ thp_decoder_select="mjpeg_decoder"
tiff_decoder_suggest="zlib" tiff_decoder_suggest="zlib"
tiff_encoder_suggest="zlib" tiff_encoder_suggest="zlib"
truehd_decoder_select="mlp_parser" truehd_decoder_select="mlp_parser"
truemotion2_decoder_select="dsputil" truemotion2_decoder_select="bswapdsp"
truespeech_decoder_select="dsputil" truespeech_decoder_select="bswapdsp"
tscc_decoder_select="zlib" tscc_decoder_select="zlib"
twinvq_decoder_select="mdct lsp sinewin" twinvq_decoder_select="mdct lsp sinewin"
utvideo_decoder_select="dsputil" utvideo_decoder_select="bswapdsp"
utvideo_encoder_select="dsputil huffman huffyuvencdsp" utvideo_encoder_select="bswapdsp huffman huffyuvencdsp"
vble_decoder_select="huffyuvdsp" vble_decoder_select="huffyuvdsp"
vc1_decoder_select="blockdsp error_resilience h263_decoder h264chroma h264qpel intrax8 mpeg_er qpeldsp" vc1_decoder_select="blockdsp error_resilience h263_decoder h264chroma h264qpel intrax8 mpeg_er qpeldsp"
vc1image_decoder_select="vc1_decoder" vc1image_decoder_select="vc1_decoder"
......
...@@ -32,8 +32,8 @@ ...@@ -32,8 +32,8 @@
#include "libavutil/intreadwrite.h" #include "libavutil/intreadwrite.h"
#include "avcodec.h" #include "avcodec.h"
#include "blockdsp.h" #include "blockdsp.h"
#include "bswapdsp.h"
#include "bytestream.h" #include "bytestream.h"
#include "dsputil.h"
#include "get_bits.h" #include "get_bits.h"
#include "internal.h" #include "internal.h"
...@@ -134,8 +134,8 @@ typedef struct CFrameBuffer { ...@@ -134,8 +134,8 @@ typedef struct CFrameBuffer {
typedef struct FourXContext { typedef struct FourXContext {
AVCodecContext *avctx; AVCodecContext *avctx;
DSPContext dsp;
BlockDSPContext bdsp; BlockDSPContext bdsp;
BswapDSPContext bbdsp;
uint16_t *frame_buffer; uint16_t *frame_buffer;
uint16_t *last_frame_buffer; uint16_t *last_frame_buffer;
GetBitContext pre_gb; ///< ac/dc prefix GetBitContext pre_gb; ///< ac/dc prefix
...@@ -460,8 +460,8 @@ static int decode_p_frame(FourXContext *f, const uint8_t *buf, int length) ...@@ -460,8 +460,8 @@ static int decode_p_frame(FourXContext *f, const uint8_t *buf, int length)
bitstream_size); bitstream_size);
if (!f->bitstream_buffer) if (!f->bitstream_buffer)
return AVERROR(ENOMEM); return AVERROR(ENOMEM);
f->dsp.bswap_buf(f->bitstream_buffer, (const uint32_t*)(buf + extra), f->bbdsp.bswap_buf(f->bitstream_buffer, (const uint32_t *) (buf + extra),
bitstream_size / 4); bitstream_size / 4);
init_get_bits(&f->gb, f->bitstream_buffer, 8 * bitstream_size); init_get_bits(&f->gb, f->bitstream_buffer, 8 * bitstream_size);
wordstream_offset = extra + bitstream_size; wordstream_offset = extra + bitstream_size;
...@@ -799,8 +799,8 @@ static int decode_i_frame(FourXContext *f, const uint8_t *buf, int length) ...@@ -799,8 +799,8 @@ static int decode_i_frame(FourXContext *f, const uint8_t *buf, int length)
prestream_size); prestream_size);
if (!f->bitstream_buffer) if (!f->bitstream_buffer)
return AVERROR(ENOMEM); return AVERROR(ENOMEM);
f->dsp.bswap_buf(f->bitstream_buffer, (const uint32_t*)prestream, f->bbdsp.bswap_buf(f->bitstream_buffer, (const uint32_t *) prestream,
prestream_size / 4); prestream_size / 4);
init_get_bits(&f->pre_gb, f->bitstream_buffer, 8 * prestream_size); init_get_bits(&f->pre_gb, f->bitstream_buffer, 8 * prestream_size);
f->last_dc = 0 * 128 * 8 * 8; f->last_dc = 0 * 128 * 8 * 8;
...@@ -1001,7 +1001,7 @@ static av_cold int decode_init(AVCodecContext *avctx) ...@@ -1001,7 +1001,7 @@ static av_cold int decode_init(AVCodecContext *avctx)
f->version = AV_RL32(avctx->extradata) >> 16; f->version = AV_RL32(avctx->extradata) >> 16;
ff_blockdsp_init(&f->bdsp, avctx); ff_blockdsp_init(&f->bdsp, avctx);
ff_dsputil_init(&f->dsp, avctx); ff_bswapdsp_init(&f->bbdsp);
f->avctx = avctx; f->avctx = avctx;
init_vlcs(f); init_vlcs(f);
......
...@@ -35,6 +35,7 @@ OBJS-$(CONFIG_AC3DSP) += ac3dsp.o ...@@ -35,6 +35,7 @@ OBJS-$(CONFIG_AC3DSP) += ac3dsp.o
OBJS-$(CONFIG_AUDIO_FRAME_QUEUE) += audio_frame_queue.o OBJS-$(CONFIG_AUDIO_FRAME_QUEUE) += audio_frame_queue.o
OBJS-$(CONFIG_AUDIODSP) += audiodsp.o OBJS-$(CONFIG_AUDIODSP) += audiodsp.o
OBJS-$(CONFIG_BLOCKDSP) += blockdsp.o OBJS-$(CONFIG_BLOCKDSP) += blockdsp.o
OBJS-$(CONFIG_BSWAPDSP) += bswapdsp.o
OBJS-$(CONFIG_CABAC) += cabac.o OBJS-$(CONFIG_CABAC) += cabac.o
OBJS-$(CONFIG_CRYSTALHD) += crystalhd.o OBJS-$(CONFIG_CRYSTALHD) += crystalhd.o
OBJS-$(CONFIG_DCT) += dct.o dct32_fixed.o dct32_float.o OBJS-$(CONFIG_DCT) += dct.o dct32_fixed.o dct32_float.o
......
...@@ -33,6 +33,7 @@ ...@@ -33,6 +33,7 @@
#include "libavutil/crc.h" #include "libavutil/crc.h"
#include "libavutil/downmix_info.h" #include "libavutil/downmix_info.h"
#include "libavutil/opt.h" #include "libavutil/opt.h"
#include "bswapdsp.h"
#include "internal.h" #include "internal.h"
#include "aac_ac3_parser.h" #include "aac_ac3_parser.h"
#include "ac3_parser.h" #include "ac3_parser.h"
...@@ -180,7 +181,7 @@ static av_cold int ac3_decode_init(AVCodecContext *avctx) ...@@ -180,7 +181,7 @@ static av_cold int ac3_decode_init(AVCodecContext *avctx)
ff_mdct_init(&s->imdct_256, 8, 1, 1.0); ff_mdct_init(&s->imdct_256, 8, 1, 1.0);
ff_mdct_init(&s->imdct_512, 9, 1, 1.0); ff_mdct_init(&s->imdct_512, 9, 1, 1.0);
AC3_RENAME(ff_kbd_window_init)(s->window, 5.0, 256); AC3_RENAME(ff_kbd_window_init)(s->window, 5.0, 256);
ff_dsputil_init(&s->dsp, avctx); ff_bswapdsp_init(&s->bdsp);
#if (USE_FIXED) #if (USE_FIXED)
s->fdsp = avpriv_alloc_fixed_dsp(avctx->flags & CODEC_FLAG_BITEXACT); s->fdsp = avpriv_alloc_fixed_dsp(avctx->flags & CODEC_FLAG_BITEXACT);
...@@ -1397,7 +1398,8 @@ static int ac3_decode_frame(AVCodecContext * avctx, void *data, ...@@ -1397,7 +1398,8 @@ static int ac3_decode_frame(AVCodecContext * avctx, void *data,
if (buf_size >= 2 && AV_RB16(buf) == 0x770B) { if (buf_size >= 2 && AV_RB16(buf) == 0x770B) {
// seems to be byte-swapped AC-3 // seems to be byte-swapped AC-3
int cnt = FFMIN(buf_size, AC3_FRAME_BUFFER_SIZE) >> 1; int cnt = FFMIN(buf_size, AC3_FRAME_BUFFER_SIZE) >> 1;
s->dsp.bswap16_buf((uint16_t *)s->input_buffer, (const uint16_t *)buf, cnt); s->bdsp.bswap16_buf((uint16_t *) s->input_buffer,
(const uint16_t *) buf, cnt);
} else } else
memcpy(s->input_buffer, buf, FFMIN(buf_size, AC3_FRAME_BUFFER_SIZE)); memcpy(s->input_buffer, buf, FFMIN(buf_size, AC3_FRAME_BUFFER_SIZE));
buf = s->input_buffer; buf = s->input_buffer;
......
...@@ -55,8 +55,8 @@ ...@@ -55,8 +55,8 @@
#include "libavutil/lfg.h" #include "libavutil/lfg.h"
#include "ac3.h" #include "ac3.h"
#include "ac3dsp.h" #include "ac3dsp.h"
#include "bswapdsp.h"
#include "get_bits.h" #include "get_bits.h"
#include "dsputil.h"
#include "fft.h" #include "fft.h"
#include "fmtconvert.h" #include "fmtconvert.h"
...@@ -207,7 +207,7 @@ typedef struct AC3DecodeContext { ...@@ -207,7 +207,7 @@ typedef struct AC3DecodeContext {
///@} ///@}
///@name Optimization ///@name Optimization
DSPContext dsp; ///< for optimization BswapDSPContext bdsp;
#if USE_FIXED #if USE_FIXED
AVFixedDSPContext *fdsp; AVFixedDSPContext *fdsp;
#else #else
......
...@@ -33,7 +33,7 @@ ...@@ -33,7 +33,7 @@
#include "mpeg4audio.h" #include "mpeg4audio.h"
#include "bytestream.h" #include "bytestream.h"
#include "bgmc.h" #include "bgmc.h"
#include "dsputil.h" #include "bswapdsp.h"
#include "internal.h" #include "internal.h"
#include "libavutil/samplefmt.h" #include "libavutil/samplefmt.h"
#include "libavutil/crc.h" #include "libavutil/crc.h"
...@@ -192,7 +192,7 @@ typedef struct { ...@@ -192,7 +192,7 @@ typedef struct {
AVCodecContext *avctx; AVCodecContext *avctx;
ALSSpecificConfig sconf; ALSSpecificConfig sconf;
GetBitContext gb; GetBitContext gb;
DSPContext dsp; BswapDSPContext bdsp;
const AVCRC *crc_table; const AVCRC *crc_table;
uint32_t crc_org; ///< CRC value of the original input data uint32_t crc_org; ///< CRC value of the original input data
uint32_t crc; ///< CRC value calculated from decoded data uint32_t crc; ///< CRC value calculated from decoded data
...@@ -1560,9 +1560,9 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame_ptr, ...@@ -1560,9 +1560,9 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame_ptr,
sample++) sample++)
*dest++ = av_bswap16(src[sample]); *dest++ = av_bswap16(src[sample]);
} else { } else {
ctx->dsp.bswap_buf((uint32_t*)ctx->crc_buffer, ctx->bdsp.bswap_buf((uint32_t *) ctx->crc_buffer,
(uint32_t *)frame->data[0], (uint32_t *) frame->data[0],
ctx->cur_frame_length * avctx->channels); ctx->cur_frame_length * avctx->channels);
} }
crc_source = ctx->crc_buffer; crc_source = ctx->crc_buffer;
} else { } else {
...@@ -1780,7 +1780,7 @@ static av_cold int decode_init(AVCodecContext *avctx) ...@@ -1780,7 +1780,7 @@ static av_cold int decode_init(AVCodecContext *avctx)
} }
} }
ff_dsputil_init(&ctx->dsp, avctx); ff_bswapdsp_init(&ctx->bdsp);
return 0; return 0;
......
...@@ -27,7 +27,7 @@ ...@@ -27,7 +27,7 @@
#include "libavutil/opt.h" #include "libavutil/opt.h"
#include "lossless_audiodsp.h" #include "lossless_audiodsp.h"
#include "avcodec.h" #include "avcodec.h"
#include "dsputil.h" #include "bswapdsp.h"
#include "bytestream.h" #include "bytestream.h"
#include "internal.h" #include "internal.h"
#include "get_bits.h" #include "get_bits.h"
...@@ -136,7 +136,7 @@ typedef struct APEPredictor { ...@@ -136,7 +136,7 @@ typedef struct APEPredictor {
typedef struct APEContext { typedef struct APEContext {
AVClass *class; ///< class for AVOptions AVClass *class; ///< class for AVOptions
AVCodecContext *avctx; AVCodecContext *avctx;
DSPContext dsp; BswapDSPContext bdsp;
LLAudDSPContext adsp; LLAudDSPContext adsp;
int channels; int channels;
int samples; ///< samples left to decode in current frame int samples; ///< samples left to decode in current frame
...@@ -293,7 +293,7 @@ static av_cold int ape_decode_init(AVCodecContext *avctx) ...@@ -293,7 +293,7 @@ static av_cold int ape_decode_init(AVCodecContext *avctx)
s->predictor_decode_stereo = predictor_decode_stereo_3950; s->predictor_decode_stereo = predictor_decode_stereo_3950;
} }
ff_dsputil_init(&s->dsp, avctx); ff_bswapdsp_init(&s->bdsp);
ff_llauddsp_init(&s->adsp); ff_llauddsp_init(&s->adsp);
avctx->channel_layout = (avctx->channels==2) ? AV_CH_LAYOUT_STEREO : AV_CH_LAYOUT_MONO; avctx->channel_layout = (avctx->channels==2) ? AV_CH_LAYOUT_STEREO : AV_CH_LAYOUT_MONO;
...@@ -1443,7 +1443,8 @@ static int ape_decode_frame(AVCodecContext *avctx, void *data, ...@@ -1443,7 +1443,8 @@ static int ape_decode_frame(AVCodecContext *avctx, void *data,
av_fast_padded_malloc(&s->data, &s->data_size, buf_size); av_fast_padded_malloc(&s->data, &s->data_size, buf_size);
if (!s->data) if (!s->data)
return AVERROR(ENOMEM); return AVERROR(ENOMEM);
s->dsp.bswap_buf((uint32_t*)s->data, (const uint32_t*)buf, buf_size >> 2); s->bdsp.bswap_buf((uint32_t *) s->data, (const uint32_t *) buf,
buf_size >> 2);
memset(s->data + (buf_size & ~3), 0, buf_size & 3); memset(s->data + (buf_size & ~3), 0, buf_size & 3);
s->ptr = s->data; s->ptr = s->data;
s->data_end = s->data + buf_size; s->data_end = s->data + buf_size;
......
...@@ -27,6 +27,7 @@ ...@@ -27,6 +27,7 @@
#include "asv.h" #include "asv.h"
#include "avcodec.h" #include "avcodec.h"
#include "bswapdsp.h"
const uint8_t ff_asv_scantab[64] = { const uint8_t ff_asv_scantab[64] = {
0x00,0x08,0x01,0x09,0x10,0x18,0x11,0x19, 0x00,0x08,0x01,0x09,0x10,0x18,0x11,0x19,
...@@ -82,6 +83,7 @@ const uint8_t ff_asv2_level_tab[63][2] = { ...@@ -82,6 +83,7 @@ const uint8_t ff_asv2_level_tab[63][2] = {
av_cold void ff_asv_common_init(AVCodecContext *avctx) { av_cold void ff_asv_common_init(AVCodecContext *avctx) {
ASV1Context * const a = avctx->priv_data; ASV1Context * const a = avctx->priv_data;
ff_bswapdsp_init(&a->bbdsp);
ff_dsputil_init(&a->dsp, avctx); ff_dsputil_init(&a->dsp, avctx);
a->mb_width = (avctx->width + 15) / 16; a->mb_width = (avctx->width + 15) / 16;
......
...@@ -32,6 +32,7 @@ ...@@ -32,6 +32,7 @@
#include "avcodec.h" #include "avcodec.h"
#include "blockdsp.h" #include "blockdsp.h"
#include "bswapdsp.h"
#include "dsputil.h" #include "dsputil.h"
#include "get_bits.h" #include "get_bits.h"
#include "put_bits.h" #include "put_bits.h"
...@@ -39,6 +40,7 @@ ...@@ -39,6 +40,7 @@
typedef struct ASV1Context{ typedef struct ASV1Context{
AVCodecContext *avctx; AVCodecContext *avctx;
BlockDSPContext bdsp; BlockDSPContext bdsp;
BswapDSPContext bbdsp;
DSPContext dsp; DSPContext dsp;
PutBitContext pb; PutBitContext pb;
GetBitContext gb; GetBitContext gb;
......
...@@ -221,7 +221,8 @@ static int decode_frame(AVCodecContext *avctx, ...@@ -221,7 +221,8 @@ static int decode_frame(AVCodecContext *avctx,
return AVERROR(ENOMEM); return AVERROR(ENOMEM);
if (avctx->codec_id == AV_CODEC_ID_ASV1) if (avctx->codec_id == AV_CODEC_ID_ASV1)
a->dsp.bswap_buf((uint32_t*)a->bitstream_buffer, (const uint32_t*)buf, buf_size/4); a->bbdsp.bswap_buf((uint32_t *) a->bitstream_buffer,
(const uint32_t *) buf, buf_size / 4);
else { else {
int i; int i;
for (i = 0; i < buf_size; i++) for (i = 0; i < buf_size; i++)
......
...@@ -260,7 +260,8 @@ static int encode_frame(AVCodecContext *avctx, AVPacket *pkt, ...@@ -260,7 +260,8 @@ static int encode_frame(AVCodecContext *avctx, AVPacket *pkt,
size= put_bits_count(&a->pb)/32; size= put_bits_count(&a->pb)/32;
if(avctx->codec_id == AV_CODEC_ID_ASV1) if(avctx->codec_id == AV_CODEC_ID_ASV1)
a->dsp.bswap_buf((uint32_t*)pkt->data, (uint32_t*)pkt->data, size); a->bbdsp.bswap_buf((uint32_t *) pkt->data,
(uint32_t *) pkt->data, size);
else{ else{
int i; int i;
for(i=0; i<4*size; i++) for(i=0; i<4*size; i++)
......
/*
* This file is part of FFmpeg.
*
* FFmpeg is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* FFmpeg is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with FFmpeg; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include <stdint.h>
#include "libavutil/attributes.h"
#include "libavutil/bswap.h"
#include "bswapdsp.h"
static void bswap_buf(uint32_t *dst, const uint32_t *src, int w)
{
int i;
for (i = 0; i + 8 <= w; i += 8) {
dst[i + 0] = av_bswap32(src[i + 0]);
dst[i + 1] = av_bswap32(src[i + 1]);
dst[i + 2] = av_bswap32(src[i + 2]);
dst[i + 3] = av_bswap32(src[i + 3]);
dst[i + 4] = av_bswap32(src[i + 4]);
dst[i + 5] = av_bswap32(src[i + 5]);
dst[i + 6] = av_bswap32(src[i + 6]);
dst[i + 7] = av_bswap32(src[i + 7]);
}
for (; i < w; i++)
dst[i + 0] = av_bswap32(src[i + 0]);
}
static void bswap16_buf(uint16_t *dst, const uint16_t *src, int len)
{
while (len--)
*dst++ = av_bswap16(*src++);
}
av_cold void ff_bswapdsp_init(BswapDSPContext *c)
{
c->bswap_buf = bswap_buf;
c->bswap16_buf = bswap16_buf;
if (ARCH_X86)
ff_bswapdsp_init_x86(c);
}
/*
* This file is part of FFmpeg.
*
* FFmpeg is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* FFmpeg is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with FFmpeg; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef AVCODEC_BSWAP_BUF_H
#define AVCODEC_BSWAP_BUF_H
#include <stdint.h>
typedef struct BswapDSPContext {
void (*bswap_buf)(uint32_t *dst, const uint32_t *src, int w);
void (*bswap16_buf)(uint16_t *dst, const uint16_t *src, int len);
} BswapDSPContext;
void ff_bswapdsp_init(BswapDSPContext *c);
void ff_bswapdsp_init_x86(BswapDSPContext *c);
#endif /* AVCODEC_BSWAP_BUF_H */
...@@ -23,14 +23,14 @@ ...@@ -23,14 +23,14 @@
#include <inttypes.h> #include <inttypes.h>
#include "libavutil/intreadwrite.h" #include "libavutil/intreadwrite.h"
#include "dsputil.h" #include "bswapdsp.h"
#include "get_bits.h" #include "get_bits.h"
#include "avcodec.h" #include "avcodec.h"
#include "internal.h" #include "internal.h"
typedef struct CLLCContext { typedef struct CLLCContext {
DSPContext dsp;
AVCodecContext *avctx; AVCodecContext *avctx;
BswapDSPContext bdsp;
uint8_t *swapped_buf; uint8_t *swapped_buf;
int swapped_buf_size; int swapped_buf_size;
...@@ -391,8 +391,8 @@ static int cllc_decode_frame(AVCodecContext *avctx, void *data, ...@@ -391,8 +391,8 @@ static int cllc_decode_frame(AVCodecContext *avctx, void *data,
} }
/* bswap16 the buffer since CLLC's bitreader works in 16-bit words */ /* bswap16 the buffer since CLLC's bitreader works in 16-bit words */
ctx->dsp.bswap16_buf((uint16_t *) ctx->swapped_buf, (uint16_t *) src, ctx->bdsp.bswap16_buf((uint16_t *) ctx->swapped_buf, (uint16_t *) src,
data_size / 2); data_size / 2);
init_get_bits(&gb, ctx->swapped_buf, data_size * 8); init_get_bits(&gb, ctx->swapped_buf, data_size * 8);
...@@ -476,7 +476,7 @@ static av_cold int cllc_decode_init(AVCodecContext *avctx) ...@@ -476,7 +476,7 @@ static av_cold int cllc_decode_init(AVCodecContext *avctx)
ctx->swapped_buf = NULL; ctx->swapped_buf = NULL;
ctx->swapped_buf_size = 0; ctx->swapped_buf_size = 0;
ff_dsputil_init(&ctx->dsp, avctx); ff_bswapdsp_init(&ctx->bdsp);
return 0; return 0;
} }
......
...@@ -190,30 +190,6 @@ static int pix_norm1_c(uint8_t *pix, int line_size) ...@@ -190,30 +190,6 @@ static int pix_norm1_c(uint8_t *pix, int line_size)
return s; return s;
} }
static void bswap_buf(uint32_t *dst, const uint32_t *src, int w)
{
int i;
for (i = 0; i + 8 <= w; i += 8) {
dst[i + 0] = av_bswap32(src[i + 0]);
dst[i + 1] = av_bswap32(src[i + 1]);
dst[i + 2] = av_bswap32(src[i + 2]);
dst[i + 3] = av_bswap32(src[i + 3]);
dst[i + 4] = av_bswap32(src[i + 4]);
dst[i + 5] = av_bswap32(src[i + 5]);
dst[i + 6] = av_bswap32(src[i + 6]);
dst[i + 7] = av_bswap32(src[i + 7]);
}
for (; i < w; i++)
dst[i + 0] = av_bswap32(src[i + 0]);
}
static void bswap16_buf(uint16_t *dst, const uint16_t *src, int len)
{
while (len--)
*dst++ = av_bswap16(*src++);
}
static int sse4_c(MpegEncContext *v, uint8_t *pix1, uint8_t *pix2, static int sse4_c(MpegEncContext *v, uint8_t *pix1, uint8_t *pix2,
int line_size, int h) int line_size, int h)
{ {
...@@ -1574,9 +1550,6 @@ av_cold void ff_dsputil_init(DSPContext *c, AVCodecContext *avctx) ...@@ -1574,9 +1550,6 @@ av_cold void ff_dsputil_init(DSPContext *c, AVCodecContext *avctx)
ff_dsputil_init_dwt(c); ff_dsputil_init_dwt(c);
#endif #endif
c->bswap_buf = bswap_buf;
c->bswap16_buf = bswap16_buf;
c->try_8x8basis = try_8x8basis_c; c->try_8x8basis = try_8x8basis_c;
c->add_8x8basis = add_8x8basis_c; c->add_8x8basis = add_8x8basis_c;
......
...@@ -137,9 +137,6 @@ typedef struct DSPContext { ...@@ -137,9 +137,6 @@ typedef struct DSPContext {
me_cmp_func pix_abs[2][4]; me_cmp_func pix_abs[2][4];
void (*bswap_buf)(uint32_t *dst, const uint32_t *src, int w);
void (*bswap16_buf)(uint16_t *dst, const uint16_t *src, int len);
/* (I)DCT */ /* (I)DCT */
void (*fdct)(int16_t *block /* align 16 */); void (*fdct)(int16_t *block /* align 16 */);
void (*fdct248)(int16_t *block /* align 16 */); void (*fdct248)(int16_t *block /* align 16 */);
......
...@@ -29,6 +29,7 @@ ...@@ -29,6 +29,7 @@
*/ */
#include "avcodec.h" #include "avcodec.h"
#include "bswapdsp.h"
#include "get_bits.h" #include "get_bits.h"
#include "aandcttab.h" #include "aandcttab.h"
#include "eaidct.h" #include "eaidct.h"
...@@ -45,6 +46,7 @@ ...@@ -45,6 +46,7 @@
typedef struct MadContext { typedef struct MadContext {
AVCodecContext *avctx; AVCodecContext *avctx;
BlockDSPContext bdsp; BlockDSPContext bdsp;
BswapDSPContext bbdsp;
DSPContext dsp; DSPContext dsp;
AVFrame *last_frame; AVFrame *last_frame;
GetBitContext gb; GetBitContext gb;
...@@ -63,6 +65,7 @@ static av_cold int decode_init(AVCodecContext *avctx) ...@@ -63,6 +65,7 @@ static av_cold int decode_init(AVCodecContext *avctx)
s->avctx = avctx; s->avctx = avctx;
avctx->pix_fmt = AV_PIX_FMT_YUV420P; avctx->pix_fmt = AV_PIX_FMT_YUV420P;
ff_blockdsp_init(&s->bdsp, avctx); ff_blockdsp_init(&s->bdsp, avctx);
ff_bswapdsp_init(&s->bbdsp);
ff_dsputil_init(&s->dsp, avctx); ff_dsputil_init(&s->dsp, avctx);
ff_init_scantable_permutation(s->dsp.idct_permutation, FF_NO_IDCT_PERM); ff_init_scantable_permutation(s->dsp.idct_permutation, FF_NO_IDCT_PERM);
ff_init_scantable(s->dsp.idct_permutation, &s->scantable, ff_zigzag_direct); ff_init_scantable(s->dsp.idct_permutation, &s->scantable, ff_zigzag_direct);
...@@ -297,7 +300,8 @@ static int decode_frame(AVCodecContext *avctx, ...@@ -297,7 +300,8 @@ static int decode_frame(AVCodecContext *avctx,
buf_end - buf); buf_end - buf);
if (!s->bitstream_buf) if (!s->bitstream_buf)
return AVERROR(ENOMEM); return AVERROR(ENOMEM);
s->dsp.bswap16_buf(s->bitstream_buf, (const uint16_t*)buf, (buf_end-buf)/2); s->bbdsp.bswap16_buf(s->bitstream_buf, (const uint16_t *) buf,
(buf_end - buf) / 2);
memset((uint8_t*)s->bitstream_buf + (buf_end-buf), 0, FF_INPUT_BUFFER_PADDING_SIZE); memset((uint8_t*)s->bitstream_buf + (buf_end-buf), 0, FF_INPUT_BUFFER_PADDING_SIZE);
init_get_bits(&s->gb, s->bitstream_buf, 8*(buf_end-buf)); init_get_bits(&s->gb, s->bitstream_buf, 8*(buf_end-buf));
......
...@@ -28,6 +28,7 @@ ...@@ -28,6 +28,7 @@
#include "avcodec.h" #include "avcodec.h"
#include "blockdsp.h" #include "blockdsp.h"
#include "bswapdsp.h"
#include "get_bits.h" #include "get_bits.h"
#include "aandcttab.h" #include "aandcttab.h"
#include "eaidct.h" #include "eaidct.h"
...@@ -37,6 +38,7 @@ ...@@ -37,6 +38,7 @@
typedef struct TqiContext { typedef struct TqiContext {
MpegEncContext s; MpegEncContext s;
BswapDSPContext bsdsp;
void *bitstream_buf; void *bitstream_buf;
unsigned int bitstream_buf_size; unsigned int bitstream_buf_size;
DECLARE_ALIGNED(16, int16_t, block)[6][64]; DECLARE_ALIGNED(16, int16_t, block)[6][64];
...@@ -48,6 +50,7 @@ static av_cold int tqi_decode_init(AVCodecContext *avctx) ...@@ -48,6 +50,7 @@ static av_cold int tqi_decode_init(AVCodecContext *avctx)
MpegEncContext *s = &t->s; MpegEncContext *s = &t->s;
s->avctx = avctx; s->avctx = avctx;
ff_blockdsp_init(&s->bdsp, avctx); ff_blockdsp_init(&s->bdsp, avctx);
ff_bswapdsp_init(&t->bsdsp);
ff_dsputil_init(&s->dsp, avctx); ff_dsputil_init(&s->dsp, avctx);
ff_init_scantable_permutation(s->dsp.idct_permutation, FF_NO_IDCT_PERM); ff_init_scantable_permutation(s->dsp.idct_permutation, FF_NO_IDCT_PERM);
ff_init_scantable(s->dsp.idct_permutation, &s->intra_scantable, ff_zigzag_direct); ff_init_scantable(s->dsp.idct_permutation, &s->intra_scantable, ff_zigzag_direct);
...@@ -124,7 +127,8 @@ static int tqi_decode_frame(AVCodecContext *avctx, ...@@ -124,7 +127,8 @@ static int tqi_decode_frame(AVCodecContext *avctx,
buf_end - buf); buf_end - buf);
if (!t->bitstream_buf) if (!t->bitstream_buf)
return AVERROR(ENOMEM); return AVERROR(ENOMEM);
s->dsp.bswap_buf(t->bitstream_buf, (const uint32_t*)buf, (buf_end-buf)/4); t->bsdsp.bswap_buf(t->bitstream_buf, (const uint32_t *) buf,
(buf_end - buf) / 4);
init_get_bits(&s->gb, t->bitstream_buf, 8*(buf_end-buf)); init_get_bits(&s->gb, t->bitstream_buf, 8*(buf_end-buf));
s->last_dc[0] = s->last_dc[1] = s->last_dc[2] = 0; s->last_dc[0] = s->last_dc[1] = s->last_dc[2] = 0;
......
...@@ -25,7 +25,7 @@ ...@@ -25,7 +25,7 @@
#include "libavutil/md5.h" #include "libavutil/md5.h"
#include "libavutil/opt.h" #include "libavutil/opt.h"
#include "avcodec.h" #include "avcodec.h"
#include "dsputil.h" #include "bswapdsp.h"
#include "put_bits.h" #include "put_bits.h"
#include "golomb.h" #include "golomb.h"
#include "internal.h" #include "internal.h"
...@@ -113,7 +113,7 @@ typedef struct FlacEncodeContext { ...@@ -113,7 +113,7 @@ typedef struct FlacEncodeContext {
struct AVMD5 *md5ctx; struct AVMD5 *md5ctx;
uint8_t *md5_buffer; uint8_t *md5_buffer;
unsigned int md5_buffer_size; unsigned int md5_buffer_size;
DSPContext dsp; BswapDSPContext bdsp;
FLACDSPContext flac_dsp; FLACDSPContext flac_dsp;
int flushed; int flushed;
...@@ -427,7 +427,7 @@ static av_cold int flac_encode_init(AVCodecContext *avctx) ...@@ -427,7 +427,7 @@ static av_cold int flac_encode_init(AVCodecContext *avctx)
ret = ff_lpc_init(&s->lpc_ctx, avctx->frame_size, ret = ff_lpc_init(&s->lpc_ctx, avctx->frame_size,
s->options.max_prediction_order, FF_LPC_TYPE_LEVINSON); s->options.max_prediction_order, FF_LPC_TYPE_LEVINSON);
ff_dsputil_init(&s->dsp, avctx); ff_bswapdsp_init(&s->bdsp);
ff_flacdsp_init(&s->flac_dsp, avctx->sample_fmt, ff_flacdsp_init(&s->flac_dsp, avctx->sample_fmt,
avctx->bits_per_raw_sample); avctx->bits_per_raw_sample);
...@@ -1206,8 +1206,8 @@ static int update_md5_sum(FlacEncodeContext *s, const void *samples) ...@@ -1206,8 +1206,8 @@ static int update_md5_sum(FlacEncodeContext *s, const void *samples)
if (s->avctx->bits_per_raw_sample <= 16) { if (s->avctx->bits_per_raw_sample <= 16) {
buf = (const uint8_t *)samples; buf = (const uint8_t *)samples;
#if HAVE_BIGENDIAN #if HAVE_BIGENDIAN
s->dsp.bswap16_buf((uint16_t *)s->md5_buffer, s->bdsp.bswap16_buf((uint16_t *) s->md5_buffer,
(const uint16_t *)samples, buf_size / 2); (const uint16_t *) samples, buf_size / 2);
buf = s->md5_buffer; buf = s->md5_buffer;
#endif #endif
} else { } else {
......
...@@ -35,7 +35,7 @@ ...@@ -35,7 +35,7 @@
#include "get_bits.h" #include "get_bits.h"
#include "huffman.h" #include "huffman.h"
#include "bytestream.h" #include "bytestream.h"
#include "dsputil.h" #include "bswapdsp.h"
#include "internal.h" #include "internal.h"
#include "thread.h" #include "thread.h"
...@@ -47,9 +47,9 @@ ...@@ -47,9 +47,9 @@
*/ */
typedef struct FrapsContext { typedef struct FrapsContext {
AVCodecContext *avctx; AVCodecContext *avctx;
BswapDSPContext bdsp;
uint8_t *tmpbuf; uint8_t *tmpbuf;
int tmpbuf_size; int tmpbuf_size;
DSPContext dsp;
} FrapsContext; } FrapsContext;
...@@ -65,7 +65,7 @@ static av_cold int decode_init(AVCodecContext *avctx) ...@@ -65,7 +65,7 @@ static av_cold int decode_init(AVCodecContext *avctx)
s->avctx = avctx; s->avctx = avctx;
s->tmpbuf = NULL; s->tmpbuf = NULL;
ff_dsputil_init(&s->dsp, avctx); ff_bswapdsp_init(&s->bdsp);
return 0; return 0;
} }
...@@ -102,7 +102,8 @@ static int fraps2_decode_plane(FrapsContext *s, uint8_t *dst, int stride, int w, ...@@ -102,7 +102,8 @@ static int fraps2_decode_plane(FrapsContext *s, uint8_t *dst, int stride, int w,
/* we have built Huffman table and are ready to decode plane */ /* we have built Huffman table and are ready to decode plane */
/* convert bits so they may be used by standard bitreader */ /* convert bits so they may be used by standard bitreader */
s->dsp.bswap_buf((uint32_t *)s->tmpbuf, (const uint32_t *)src, size >> 2); s->bdsp.bswap_buf((uint32_t *) s->tmpbuf,
(const uint32_t *) src, size >> 2);
init_get_bits(&gb, s->tmpbuf, size * 8); init_get_bits(&gb, s->tmpbuf, size * 8);
for (j = 0; j < h; j++) { for (j = 0; j < h; j++) {
......
...@@ -32,9 +32,9 @@ ...@@ -32,9 +32,9 @@
#include "libavutil/pixdesc.h" #include "libavutil/pixdesc.h"
#include "libavutil/stereo3d.h" #include "libavutil/stereo3d.h"
#include "bswapdsp.h"
#include "bytestream.h" #include "bytestream.h"
#include "cabac_functions.h" #include "cabac_functions.h"
#include "dsputil.h"
#include "golomb.h" #include "golomb.h"
#include "hevc.h" #include "hevc.h"
...@@ -2803,8 +2803,8 @@ static int verify_md5(HEVCContext *s, AVFrame *frame) ...@@ -2803,8 +2803,8 @@ static int verify_md5(HEVCContext *s, AVFrame *frame)
const uint8_t *src = frame->data[i] + j * frame->linesize[i]; const uint8_t *src = frame->data[i] + j * frame->linesize[i];
#if HAVE_BIGENDIAN #if HAVE_BIGENDIAN
if (pixel_shift) { if (pixel_shift) {
s->dsp.bswap16_buf((uint16_t*)s->checksum_buf, s->bdsp.bswap16_buf((uint16_t *) s->checksum_buf,
(const uint16_t*)src, w); (const uint16_t *) src, w);
src = s->checksum_buf; src = s->checksum_buf;
} }
#endif #endif
...@@ -3005,7 +3005,7 @@ static av_cold int hevc_init_context(AVCodecContext *avctx) ...@@ -3005,7 +3005,7 @@ static av_cold int hevc_init_context(AVCodecContext *avctx)
if (!s->md5_ctx) if (!s->md5_ctx)
goto fail; goto fail;
ff_dsputil_init(&s->dsp, avctx); ff_bswapdsp_init(&s->bdsp);
s->context_initialized = 1; s->context_initialized = 1;
s->eos = 0; s->eos = 0;
......
...@@ -27,8 +27,8 @@ ...@@ -27,8 +27,8 @@
#include "libavutil/md5.h" #include "libavutil/md5.h"
#include "avcodec.h" #include "avcodec.h"
#include "bswapdsp.h"
#include "cabac.h" #include "cabac.h"
#include "dsputil.h"
#include "get_bits.h" #include "get_bits.h"
#include "hevcpred.h" #include "hevcpred.h"
#include "hevcdsp.h" #include "hevcdsp.h"
...@@ -814,7 +814,7 @@ typedef struct HEVCContext { ...@@ -814,7 +814,7 @@ typedef struct HEVCContext {
HEVCPredContext hpc; HEVCPredContext hpc;
HEVCDSPContext hevcdsp; HEVCDSPContext hevcdsp;
VideoDSPContext vdsp; VideoDSPContext vdsp;
DSPContext dsp; BswapDSPContext bdsp;
int8_t *qp_y_tab; int8_t *qp_y_tab;
uint8_t *split_cu_flag; uint8_t *split_cu_flag;
uint8_t *horizontal_bs; uint8_t *horizontal_bs;
......
...@@ -33,7 +33,7 @@ ...@@ -33,7 +33,7 @@
#include "libavutil/mem.h" #include "libavutil/mem.h"
#include "avcodec.h" #include "avcodec.h"
#include "dsputil.h" #include "bswapdsp.h"
#include "huffyuv.h" #include "huffyuv.h"
int ff_huffyuv_generate_bits_table(uint32_t *dst, const uint8_t *len_table, int n) int ff_huffyuv_generate_bits_table(uint32_t *dst, const uint8_t *len_table, int n)
...@@ -75,7 +75,7 @@ av_cold void ff_huffyuv_common_init(AVCodecContext *avctx) ...@@ -75,7 +75,7 @@ av_cold void ff_huffyuv_common_init(AVCodecContext *avctx)
s->avctx = avctx; s->avctx = avctx;
s->flags = avctx->flags; s->flags = avctx->flags;
ff_dsputil_init(&s->dsp, avctx); ff_bswapdsp_init(&s->bdsp);
ff_llviddsp_init(&s->llviddsp, avctx); ff_llviddsp_init(&s->llviddsp, avctx);
s->width = avctx->width; s->width = avctx->width;
......
...@@ -32,7 +32,7 @@ ...@@ -32,7 +32,7 @@
#include <stdint.h> #include <stdint.h>
#include "avcodec.h" #include "avcodec.h"
#include "dsputil.h" #include "bswapdsp.h"
#include "get_bits.h" #include "get_bits.h"
#include "huffyuvdsp.h" #include "huffyuvdsp.h"
#include "huffyuvencdsp.h" #include "huffyuvencdsp.h"
...@@ -84,7 +84,7 @@ typedef struct HYuvContext { ...@@ -84,7 +84,7 @@ typedef struct HYuvContext {
VLC vlc[8]; //Y,U,V,A,YY,YU,YV,AA VLC vlc[8]; //Y,U,V,A,YY,YU,YV,AA
uint8_t *bitstream_buffer; uint8_t *bitstream_buffer;
unsigned int bitstream_buffer_size; unsigned int bitstream_buffer_size;
DSPContext dsp; BswapDSPContext bdsp;
HuffYUVDSPContext hdsp; HuffYUVDSPContext hdsp;
HuffYUVEncDSPContext hencdsp; HuffYUVEncDSPContext hencdsp;
LLVidDSPContext llviddsp; LLVidDSPContext llviddsp;
......
...@@ -867,8 +867,8 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame, ...@@ -867,8 +867,8 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
if (!s->bitstream_buffer) if (!s->bitstream_buffer)
return AVERROR(ENOMEM); return AVERROR(ENOMEM);
s->dsp.bswap_buf((uint32_t*)s->bitstream_buffer, s->bdsp.bswap_buf((uint32_t *) s->bitstream_buffer,
(const uint32_t*)buf, buf_size / 4); (const uint32_t *) buf, buf_size / 4);
if ((ret = ff_thread_get_buffer(avctx, &frame, 0)) < 0) if ((ret = ff_thread_get_buffer(avctx, &frame, 0)) < 0)
return ret; return ret;
......
...@@ -964,7 +964,7 @@ static int encode_frame(AVCodecContext *avctx, AVPacket *pkt, ...@@ -964,7 +964,7 @@ static int encode_frame(AVCodecContext *avctx, AVPacket *pkt,
avctx->stats_out[0] = '\0'; avctx->stats_out[0] = '\0';
if (!(s->avctx->flags2 & CODEC_FLAG2_NO_OUTPUT)) { if (!(s->avctx->flags2 & CODEC_FLAG2_NO_OUTPUT)) {
flush_put_bits(&s->pb); flush_put_bits(&s->pb);
s->dsp.bswap_buf((uint32_t*)pkt->data, (uint32_t*)pkt->data, size); s->bdsp.bswap_buf((uint32_t *) pkt->data, (uint32_t *) pkt->data, size);
} }
s->picture_number++; s->picture_number++;
......
...@@ -40,8 +40,8 @@ ...@@ -40,8 +40,8 @@
#include "libavutil/internal.h" #include "libavutil/internal.h"
#include "libavutil/libm.h" #include "libavutil/libm.h"
#include "avcodec.h" #include "avcodec.h"
#include "bswapdsp.h"
#include "get_bits.h" #include "get_bits.h"
#include "dsputil.h"
#include "fft.h" #include "fft.h"
#include "internal.h" #include "internal.h"
#include "sinewin.h" #include "sinewin.h"
...@@ -95,7 +95,7 @@ typedef struct { ...@@ -95,7 +95,7 @@ typedef struct {
float sqrt_tab[30]; float sqrt_tab[30];
GetBitContext gb; GetBitContext gb;
DSPContext dsp; BswapDSPContext bdsp;
AVFloatDSPContext fdsp; AVFloatDSPContext fdsp;
FFTContext fft; FFTContext fft;
DECLARE_ALIGNED(32, FFTComplex, samples)[COEFFS / 2]; DECLARE_ALIGNED(32, FFTComplex, samples)[COEFFS / 2];
...@@ -247,7 +247,7 @@ static av_cold int imc_decode_init(AVCodecContext *avctx) ...@@ -247,7 +247,7 @@ static av_cold int imc_decode_init(AVCodecContext *avctx)
av_log(avctx, AV_LOG_INFO, "FFT init failed\n"); av_log(avctx, AV_LOG_INFO, "FFT init failed\n");
return ret; return ret;
} }
ff_dsputil_init(&q->dsp, avctx); ff_bswapdsp_init(&q->bdsp);
avpriv_float_dsp_init(&q->fdsp, avctx->flags & CODEC_FLAG_BITEXACT); avpriv_float_dsp_init(&q->fdsp, avctx->flags & CODEC_FLAG_BITEXACT);
avctx->sample_fmt = AV_SAMPLE_FMT_FLTP; avctx->sample_fmt = AV_SAMPLE_FMT_FLTP;
avctx->channel_layout = avctx->channels == 1 ? AV_CH_LAYOUT_MONO avctx->channel_layout = avctx->channels == 1 ? AV_CH_LAYOUT_MONO
...@@ -1025,7 +1025,7 @@ static int imc_decode_frame(AVCodecContext *avctx, void *data, ...@@ -1025,7 +1025,7 @@ static int imc_decode_frame(AVCodecContext *avctx, void *data,
for (i = 0; i < avctx->channels; i++) { for (i = 0; i < avctx->channels; i++) {
q->out_samples = (float *)frame->extended_data[i]; q->out_samples = (float *)frame->extended_data[i];
q->dsp.bswap16_buf(buf16, (const uint16_t*)buf, IMC_BLOCK_SIZE / 2); q->bdsp.bswap16_buf(buf16, (const uint16_t *) buf, IMC_BLOCK_SIZE / 2);
init_get_bits(&q->gb, (const uint8_t*)buf16, IMC_BLOCK_SIZE * 8); init_get_bits(&q->gb, (const uint8_t*)buf16, IMC_BLOCK_SIZE * 8);
......
...@@ -29,6 +29,7 @@ ...@@ -29,6 +29,7 @@
#include "avcodec.h" #include "avcodec.h"
#include "blockdsp.h" #include "blockdsp.h"
#include "bswapdsp.h"
#include "mpegvideo.h" #include "mpegvideo.h"
#include "mpeg12.h" #include "mpeg12.h"
#include "thread.h" #include "thread.h"
...@@ -36,6 +37,7 @@ ...@@ -36,6 +37,7 @@
typedef struct MDECContext { typedef struct MDECContext {
AVCodecContext *avctx; AVCodecContext *avctx;
BlockDSPContext bdsp; BlockDSPContext bdsp;
BswapDSPContext bbdsp;
DSPContext dsp; DSPContext dsp;
ThreadFrame frame; ThreadFrame frame;
GetBitContext gb; GetBitContext gb;
...@@ -175,7 +177,7 @@ static int decode_frame(AVCodecContext *avctx, ...@@ -175,7 +177,7 @@ static int decode_frame(AVCodecContext *avctx,
av_fast_padded_malloc(&a->bitstream_buffer, &a->bitstream_buffer_size, buf_size); av_fast_padded_malloc(&a->bitstream_buffer, &a->bitstream_buffer_size, buf_size);
if (!a->bitstream_buffer) if (!a->bitstream_buffer)
return AVERROR(ENOMEM); return AVERROR(ENOMEM);
a->dsp.bswap16_buf((uint16_t *)a->bitstream_buffer, (uint16_t *)buf, (buf_size + 1) / 2); a->bbdsp.bswap16_buf((uint16_t *)a->bitstream_buffer, (uint16_t *)buf, (buf_size + 1) / 2);
if ((ret = init_get_bits8(&a->gb, a->bitstream_buffer, buf_size)) < 0) if ((ret = init_get_bits8(&a->gb, a->bitstream_buffer, buf_size)) < 0)
return ret; return ret;
...@@ -211,6 +213,7 @@ static av_cold int decode_init(AVCodecContext *avctx) ...@@ -211,6 +213,7 @@ static av_cold int decode_init(AVCodecContext *avctx)
a->avctx = avctx; a->avctx = avctx;
ff_blockdsp_init(&a->bdsp, avctx); ff_blockdsp_init(&a->bdsp, avctx);
ff_bswapdsp_init(&a->bbdsp);
ff_dsputil_init(&a->dsp, avctx); ff_dsputil_init(&a->dsp, avctx);
ff_mpeg12_init_vlcs(); ff_mpeg12_init_vlcs();
ff_init_scantable(a->dsp.idct_permutation, &a->scantable, ff_zigzag_direct); ff_init_scantable(a->dsp.idct_permutation, &a->scantable, ff_zigzag_direct);
......
...@@ -28,6 +28,7 @@ ...@@ -28,6 +28,7 @@
#include "internal.h" #include "internal.h"
#include "get_bits.h" #include "get_bits.h"
#include "bytestream.h" #include "bytestream.h"
#include "bswapdsp.h"
#include "dsputil.h" #include "dsputil.h"
#include "hpeldsp.h" #include "hpeldsp.h"
#include "thread.h" #include "thread.h"
...@@ -54,6 +55,7 @@ typedef struct { ...@@ -54,6 +55,7 @@ typedef struct {
GetBitContext gb; GetBitContext gb;
ScanTable scantable; ScanTable scantable;
BlockDSPContext bdsp; BlockDSPContext bdsp;
BswapDSPContext bbdsp;
DSPContext dsp; DSPContext dsp;
HpelDSPContext hdsp; HpelDSPContext hdsp;
VLC vlc; VLC vlc;
...@@ -149,6 +151,7 @@ static av_cold int mimic_decode_init(AVCodecContext *avctx) ...@@ -149,6 +151,7 @@ static av_cold int mimic_decode_init(AVCodecContext *avctx)
return ret; return ret;
} }
ff_blockdsp_init(&ctx->bdsp, avctx); ff_blockdsp_init(&ctx->bdsp, avctx);
ff_bswapdsp_init(&ctx->bbdsp);
ff_dsputil_init(&ctx->dsp, avctx); ff_dsputil_init(&ctx->dsp, avctx);
ff_hpeldsp_init(&ctx->hdsp, avctx->flags); ff_hpeldsp_init(&ctx->hdsp, avctx->flags);
ff_init_scantable(ctx->dsp.idct_permutation, &ctx->scantable, col_zag); ff_init_scantable(ctx->dsp.idct_permutation, &ctx->scantable, col_zag);
...@@ -424,9 +427,9 @@ static int mimic_decode_frame(AVCodecContext *avctx, void *data, ...@@ -424,9 +427,9 @@ static int mimic_decode_frame(AVCodecContext *avctx, void *data,
if (!ctx->swap_buf) if (!ctx->swap_buf)
return AVERROR(ENOMEM); return AVERROR(ENOMEM);
ctx->dsp.bswap_buf(ctx->swap_buf, ctx->bbdsp.bswap_buf(ctx->swap_buf,
(const uint32_t*) (buf + MIMIC_HEADER_SIZE), (const uint32_t *) (buf + MIMIC_HEADER_SIZE),
swap_buf_size >> 2); swap_buf_size >> 2);
init_get_bits(&ctx->gb, ctx->swap_buf, swap_buf_size << 3); init_get_bits(&ctx->gb, ctx->swap_buf, swap_buf_size << 3);
res = decode(ctx, quality, num_coeffs, !is_pframe); res = decode(ctx, quality, num_coeffs, !is_pframe);
......
...@@ -21,7 +21,7 @@ ...@@ -21,7 +21,7 @@
#include "avcodec.h" #include "avcodec.h"
#include "get_bits.h" #include "get_bits.h"
#include "dsputil.h" #include "bswapdsp.h"
#include "internal.h" #include "internal.h"
#define MAX_HUFF_CODES 16 #define MAX_HUFF_CODES 16
...@@ -37,7 +37,7 @@ typedef struct HuffCode { ...@@ -37,7 +37,7 @@ typedef struct HuffCode {
typedef struct MotionPixelsContext { typedef struct MotionPixelsContext {
AVCodecContext *avctx; AVCodecContext *avctx;
AVFrame *frame; AVFrame *frame;
DSPContext dsp; BswapDSPContext bdsp;
uint8_t *changes_map; uint8_t *changes_map;
int offset_bits_len; int offset_bits_len;
int codes_count, current_codes_count; int codes_count, current_codes_count;
...@@ -76,7 +76,7 @@ static av_cold int mp_decode_init(AVCodecContext *avctx) ...@@ -76,7 +76,7 @@ static av_cold int mp_decode_init(AVCodecContext *avctx)
motionpixels_tableinit(); motionpixels_tableinit();
mp->avctx = avctx; mp->avctx = avctx;
ff_dsputil_init(&mp->dsp, avctx); ff_bswapdsp_init(&mp->bdsp);
mp->changes_map = av_mallocz_array(avctx->width, h4); mp->changes_map = av_mallocz_array(avctx->width, h4);
mp->offset_bits_len = av_log2(avctx->width * avctx->height) + 1; mp->offset_bits_len = av_log2(avctx->width * avctx->height) + 1;
mp->vpt = av_mallocz_array(avctx->height, sizeof(YuvPixel)); mp->vpt = av_mallocz_array(avctx->height, sizeof(YuvPixel));
...@@ -297,7 +297,8 @@ static int mp_decode_frame(AVCodecContext *avctx, ...@@ -297,7 +297,8 @@ static int mp_decode_frame(AVCodecContext *avctx,
av_fast_padded_malloc(&mp->bswapbuf, &mp->bswapbuf_size, buf_size); av_fast_padded_malloc(&mp->bswapbuf, &mp->bswapbuf_size, buf_size);
if (!mp->bswapbuf) if (!mp->bswapbuf)
return AVERROR(ENOMEM); return AVERROR(ENOMEM);
mp->dsp.bswap_buf((uint32_t *)mp->bswapbuf, (const uint32_t *)buf, buf_size / 4); mp->bdsp.bswap_buf((uint32_t *) mp->bswapbuf, (const uint32_t *) buf,
buf_size / 4);
if (buf_size & 3) if (buf_size & 3)
memcpy(mp->bswapbuf + (buf_size & ~3), buf + (buf_size & ~3), buf_size & 3); memcpy(mp->bswapbuf + (buf_size & ~3), buf + (buf_size & ~3), buf_size & 3);
init_get_bits(&gb, mp->bswapbuf, buf_size * 8); init_get_bits(&gb, mp->bswapbuf, buf_size * 8);
......
...@@ -31,8 +31,8 @@ ...@@ -31,8 +31,8 @@
#include "libavutil/lfg.h" #include "libavutil/lfg.h"
#include "avcodec.h" #include "avcodec.h"
#include "bswapdsp.h"
#include "get_bits.h" #include "get_bits.h"
#include "dsputil.h"
#include "mpegaudio.h" #include "mpegaudio.h"
#include "mpegaudiodsp.h" #include "mpegaudiodsp.h"
...@@ -50,7 +50,7 @@ typedef struct Band { ...@@ -50,7 +50,7 @@ typedef struct Band {
}Band; }Band;
typedef struct MPCContext { typedef struct MPCContext {
DSPContext dsp; BswapDSPContext bdsp;
MPADSPContext mpadsp; MPADSPContext mpadsp;
GetBitContext gb; GetBitContext gb;
int IS, MSS, gapless; int IS, MSS, gapless;
......
...@@ -30,7 +30,6 @@ ...@@ -30,7 +30,6 @@
#include "libavutil/lfg.h" #include "libavutil/lfg.h"
#include "avcodec.h" #include "avcodec.h"
#include "get_bits.h" #include "get_bits.h"
#include "dsputil.h"
#include "internal.h" #include "internal.h"
#include "mpegaudiodsp.h" #include "mpegaudiodsp.h"
...@@ -71,9 +70,9 @@ static av_cold int mpc7_decode_init(AVCodecContext * avctx) ...@@ -71,9 +70,9 @@ static av_cold int mpc7_decode_init(AVCodecContext * avctx)
} }
memset(c->oldDSCF, 0, sizeof(c->oldDSCF)); memset(c->oldDSCF, 0, sizeof(c->oldDSCF));
av_lfg_init(&c->rnd, 0xDEADBEEF); av_lfg_init(&c->rnd, 0xDEADBEEF);
ff_dsputil_init(&c->dsp, avctx); ff_bswapdsp_init(&c->bdsp);
ff_mpadsp_init(&c->mpadsp); ff_mpadsp_init(&c->mpadsp);
c->dsp.bswap_buf((uint32_t*)buf, (const uint32_t*)avctx->extradata, 4); c->bdsp.bswap_buf((uint32_t *) buf, (const uint32_t *) avctx->extradata, 4);
ff_mpc_init(); ff_mpc_init();
init_get_bits(&gb, buf, 128); init_get_bits(&gb, buf, 128);
...@@ -230,7 +229,8 @@ static int mpc7_decode_frame(AVCodecContext * avctx, void *data, ...@@ -230,7 +229,8 @@ static int mpc7_decode_frame(AVCodecContext * avctx, void *data,
av_fast_padded_malloc(&c->bits, &c->buf_size, buf_size); av_fast_padded_malloc(&c->bits, &c->buf_size, buf_size);
if (!c->bits) if (!c->bits)
return AVERROR(ENOMEM); return AVERROR(ENOMEM);
c->dsp.bswap_buf((uint32_t *)c->bits, (const uint32_t *)buf, buf_size >> 2); c->bdsp.bswap_buf((uint32_t *) c->bits, (const uint32_t *) buf,
buf_size >> 2);
init_get_bits(&gb, c->bits, buf_size * 8); init_get_bits(&gb, c->bits, buf_size * 8);
skip_bits_long(&gb, skip); skip_bits_long(&gb, skip);
......
...@@ -25,7 +25,7 @@ ...@@ -25,7 +25,7 @@
*/ */
#include "avcodec.h" #include "avcodec.h"
#include "dsputil.h" #include "bswapdsp.h"
#include "get_bits.h" #include "get_bits.h"
#include "internal.h" #include "internal.h"
#include "raw.h" #include "raw.h"
...@@ -46,7 +46,7 @@ typedef struct RawVideoContext { ...@@ -46,7 +46,7 @@ typedef struct RawVideoContext {
int is_lt_16bpp; // 16bpp pixfmt and bits_per_coded_sample < 16 int is_lt_16bpp; // 16bpp pixfmt and bits_per_coded_sample < 16
int tff; int tff;
DSPContext dsp; BswapDSPContext bbdsp;
void *bitstream_buf; void *bitstream_buf;
unsigned int bitstream_buf_size; unsigned int bitstream_buf_size;
} RawVideoContext; } RawVideoContext;
...@@ -74,7 +74,7 @@ static av_cold int raw_init_decoder(AVCodecContext *avctx) ...@@ -74,7 +74,7 @@ static av_cold int raw_init_decoder(AVCodecContext *avctx)
RawVideoContext *context = avctx->priv_data; RawVideoContext *context = avctx->priv_data;
const AVPixFmtDescriptor *desc; const AVPixFmtDescriptor *desc;
ff_dsputil_init(&context->dsp, avctx); ff_bswapdsp_init(&context->bbdsp);
if ( avctx->codec_tag == MKTAG('r','a','w',' ') if ( avctx->codec_tag == MKTAG('r','a','w',' ')
|| avctx->codec_tag == MKTAG('N','O','1','6')) || avctx->codec_tag == MKTAG('N','O','1','6'))
...@@ -237,9 +237,9 @@ static int raw_decode(AVCodecContext *avctx, void *data, int *got_frame, ...@@ -237,9 +237,9 @@ static int raw_decode(AVCodecContext *avctx, void *data, int *got_frame,
if (!context->bitstream_buf) if (!context->bitstream_buf)
return AVERROR(ENOMEM); return AVERROR(ENOMEM);
if (swap == 16) if (swap == 16)
context->dsp.bswap16_buf(context->bitstream_buf, (const uint16_t*)buf, buf_size / 2); context->bbdsp.bswap16_buf(context->bitstream_buf, (const uint16_t*)buf, buf_size / 2);
else if (swap == 32) else if (swap == 32)
context->dsp.bswap_buf(context->bitstream_buf, (const uint32_t*)buf, buf_size / 4); context->bbdsp.bswap_buf(context->bitstream_buf, (const uint32_t*)buf, buf_size / 4);
else else
return AVERROR_INVALIDDATA; return AVERROR_INVALIDDATA;
buf = context->bitstream_buf; buf = context->bitstream_buf;
......
...@@ -27,9 +27,9 @@ ...@@ -27,9 +27,9 @@
#include <inttypes.h> #include <inttypes.h>
#include "avcodec.h" #include "avcodec.h"
#include "bswapdsp.h"
#include "bytestream.h" #include "bytestream.h"
#include "get_bits.h" #include "get_bits.h"
#include "dsputil.h"
#include "internal.h" #include "internal.h"
#define TM2_ESCAPE 0x80000000 #define TM2_ESCAPE 0x80000000
...@@ -63,7 +63,7 @@ typedef struct TM2Context { ...@@ -63,7 +63,7 @@ typedef struct TM2Context {
AVFrame *pic; AVFrame *pic;
GetBitContext gb; GetBitContext gb;
DSPContext dsp; BswapDSPContext bdsp;
uint8_t *buffer; uint8_t *buffer;
int buffer_size; int buffer_size;
...@@ -889,7 +889,8 @@ static int decode_frame(AVCodecContext *avctx, ...@@ -889,7 +889,8 @@ static int decode_frame(AVCodecContext *avctx,
if ((ret = ff_reget_buffer(avctx, p)) < 0) if ((ret = ff_reget_buffer(avctx, p)) < 0)
return ret; return ret;
l->dsp.bswap_buf((uint32_t*)l->buffer, (const uint32_t*)buf, buf_size >> 2); l->bdsp.bswap_buf((uint32_t *) l->buffer, (const uint32_t *) buf,
buf_size >> 2);
if ((ret = tm2_read_header(l, l->buffer)) < 0) { if ((ret = tm2_read_header(l, l->buffer)) < 0) {
return ret; return ret;
...@@ -940,7 +941,7 @@ static av_cold int decode_init(AVCodecContext *avctx) ...@@ -940,7 +941,7 @@ static av_cold int decode_init(AVCodecContext *avctx)
if (!l->pic) if (!l->pic)
return AVERROR(ENOMEM); return AVERROR(ENOMEM);
ff_dsputil_init(&l->dsp, avctx); ff_bswapdsp_init(&l->bdsp);
l->last = av_malloc_array(w >> 2, 4 * sizeof(*l->last) ); l->last = av_malloc_array(w >> 2, 4 * sizeof(*l->last) );
l->clast = av_malloc_array(w >> 2, 4 * sizeof(*l->clast)); l->clast = av_malloc_array(w >> 2, 4 * sizeof(*l->clast));
......
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
#include "libavutil/channel_layout.h" #include "libavutil/channel_layout.h"
#include "libavutil/intreadwrite.h" #include "libavutil/intreadwrite.h"
#include "avcodec.h" #include "avcodec.h"
#include "dsputil.h" #include "bswapdsp.h"
#include "get_bits.h" #include "get_bits.h"
#include "internal.h" #include "internal.h"
...@@ -36,7 +36,7 @@ ...@@ -36,7 +36,7 @@
* TrueSpeech decoder context * TrueSpeech decoder context
*/ */
typedef struct { typedef struct {
DSPContext dsp; BswapDSPContext bdsp;
/* input data */ /* input data */
DECLARE_ALIGNED(16, uint8_t, buffer)[32]; DECLARE_ALIGNED(16, uint8_t, buffer)[32];
int16_t vector[8]; ///< input vector: 5/5/4/4/4/3/3/3 int16_t vector[8]; ///< input vector: 5/5/4/4/4/3/3/3
...@@ -70,7 +70,7 @@ static av_cold int truespeech_decode_init(AVCodecContext * avctx) ...@@ -70,7 +70,7 @@ static av_cold int truespeech_decode_init(AVCodecContext * avctx)
avctx->channel_layout = AV_CH_LAYOUT_MONO; avctx->channel_layout = AV_CH_LAYOUT_MONO;
avctx->sample_fmt = AV_SAMPLE_FMT_S16; avctx->sample_fmt = AV_SAMPLE_FMT_S16;
ff_dsputil_init(&c->dsp, avctx); ff_bswapdsp_init(&c->bdsp);
return 0; return 0;
} }
...@@ -79,7 +79,7 @@ static void truespeech_read_frame(TSContext *dec, const uint8_t *input) ...@@ -79,7 +79,7 @@ static void truespeech_read_frame(TSContext *dec, const uint8_t *input)
{ {
GetBitContext gb; GetBitContext gb;
dec->dsp.bswap_buf((uint32_t *)dec->buffer, (const uint32_t *)input, 8); dec->bdsp.bswap_buf((uint32_t *) dec->buffer, (const uint32_t *) input, 8);
init_get_bits(&gb, dec->buffer, 32 * 8); init_get_bits(&gb, dec->buffer, 32 * 8);
dec->vector[7] = ts_codebook[7][get_bits(&gb, 3)]; dec->vector[7] = ts_codebook[7][get_bits(&gb, 3)];
......
...@@ -29,7 +29,7 @@ ...@@ -29,7 +29,7 @@
#include "libavutil/common.h" #include "libavutil/common.h"
#include "avcodec.h" #include "avcodec.h"
#include "dsputil.h" #include "bswapdsp.h"
#include "huffyuvencdsp.h" #include "huffyuvencdsp.h"
enum { enum {
...@@ -66,7 +66,7 @@ extern const int ff_ut_rgb_order[4]; ...@@ -66,7 +66,7 @@ extern const int ff_ut_rgb_order[4];
typedef struct UtvideoContext { typedef struct UtvideoContext {
AVCodecContext *avctx; AVCodecContext *avctx;
DSPContext dsp; BswapDSPContext bdsp;
HuffYUVEncDSPContext hdsp; HuffYUVEncDSPContext hdsp;
uint32_t frame_info_size, flags, frame_info; uint32_t frame_info_size, flags, frame_info;
......
...@@ -29,9 +29,9 @@ ...@@ -29,9 +29,9 @@
#include "libavutil/intreadwrite.h" #include "libavutil/intreadwrite.h"
#include "avcodec.h" #include "avcodec.h"
#include "bswapdsp.h"
#include "bytestream.h" #include "bytestream.h"
#include "get_bits.h" #include "get_bits.h"
#include "dsputil.h"
#include "thread.h" #include "thread.h"
#include "utvideo.h" #include "utvideo.h"
...@@ -143,8 +143,9 @@ static int decode_plane(UtvideoContext *c, int plane_no, ...@@ -143,8 +143,9 @@ static int decode_plane(UtvideoContext *c, int plane_no,
memcpy(c->slice_bits, src + slice_data_start + c->slices * 4, memcpy(c->slice_bits, src + slice_data_start + c->slices * 4,
slice_size); slice_size);
memset(c->slice_bits + slice_size, 0, FF_INPUT_BUFFER_PADDING_SIZE); memset(c->slice_bits + slice_size, 0, FF_INPUT_BUFFER_PADDING_SIZE);
c->dsp.bswap_buf((uint32_t *) c->slice_bits, (uint32_t *) c->slice_bits, c->bdsp.bswap_buf((uint32_t *) c->slice_bits,
(slice_data_end - slice_data_start + 3) >> 2); (uint32_t *) c->slice_bits,
(slice_data_end - slice_data_start + 3) >> 2);
init_get_bits(&gb, c->slice_bits, slice_size * 8); init_get_bits(&gb, c->slice_bits, slice_size * 8);
prev = 0x80; prev = 0x80;
...@@ -471,7 +472,7 @@ static av_cold int decode_init(AVCodecContext *avctx) ...@@ -471,7 +472,7 @@ static av_cold int decode_init(AVCodecContext *avctx)
c->avctx = avctx; c->avctx = avctx;
ff_dsputil_init(&c->dsp, avctx); ff_bswapdsp_init(&c->bdsp);
if (avctx->extradata_size < 16) { if (avctx->extradata_size < 16) {
av_log(avctx, AV_LOG_ERROR, av_log(avctx, AV_LOG_ERROR,
......
...@@ -28,9 +28,9 @@ ...@@ -28,9 +28,9 @@
#include "libavutil/intreadwrite.h" #include "libavutil/intreadwrite.h"
#include "avcodec.h" #include "avcodec.h"
#include "internal.h" #include "internal.h"
#include "bswapdsp.h"
#include "bytestream.h" #include "bytestream.h"
#include "put_bits.h" #include "put_bits.h"
#include "dsputil.h"
#include "huffyuvencdsp.h" #include "huffyuvencdsp.h"
#include "mathops.h" #include "mathops.h"
#include "utvideo.h" #include "utvideo.h"
...@@ -109,7 +109,7 @@ static av_cold int utvideo_encode_init(AVCodecContext *avctx) ...@@ -109,7 +109,7 @@ static av_cold int utvideo_encode_init(AVCodecContext *avctx)
return AVERROR_INVALIDDATA; return AVERROR_INVALIDDATA;
} }
ff_dsputil_init(&c->dsp, avctx); ff_bswapdsp_init(&c->bdsp);
ff_huffyuvencdsp_init(&c->hdsp); ff_huffyuvencdsp_init(&c->hdsp);
/* Check the prediction method, and error out if unsupported */ /* Check the prediction method, and error out if unsupported */
...@@ -502,9 +502,9 @@ static int encode_plane(AVCodecContext *avctx, uint8_t *src, ...@@ -502,9 +502,9 @@ static int encode_plane(AVCodecContext *avctx, uint8_t *src,
slice_len = offset - slice_len; slice_len = offset - slice_len;
/* Byteswap the written huffman codes */ /* Byteswap the written huffman codes */
c->dsp.bswap_buf((uint32_t *) c->slice_bits, c->bdsp.bswap_buf((uint32_t *) c->slice_bits,
(uint32_t *) c->slice_bits, (uint32_t *) c->slice_bits,
slice_len >> 2); slice_len >> 2);
/* Write the offset to the stream */ /* Write the offset to the stream */
bytestream2_put_le32(pb, offset); bytestream2_put_le32(pb, offset);
......
...@@ -4,6 +4,7 @@ OBJS += x86/constants.o \ ...@@ -4,6 +4,7 @@ OBJS += x86/constants.o \
OBJS-$(CONFIG_AC3DSP) += x86/ac3dsp_init.o OBJS-$(CONFIG_AC3DSP) += x86/ac3dsp_init.o
OBJS-$(CONFIG_AUDIODSP) += x86/audiodsp_init.o OBJS-$(CONFIG_AUDIODSP) += x86/audiodsp_init.o
OBJS-$(CONFIG_BLOCKDSP) += x86/blockdsp_mmx.o OBJS-$(CONFIG_BLOCKDSP) += x86/blockdsp_mmx.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_DSPUTIL) += x86/dsputil_init.o
OBJS-$(CONFIG_ENCODERS) += x86/dsputilenc_mmx.o \ OBJS-$(CONFIG_ENCODERS) += x86/dsputilenc_mmx.o \
...@@ -72,11 +73,11 @@ YASM-OBJS += x86/deinterlace.o \ ...@@ -72,11 +73,11 @@ YASM-OBJS += x86/deinterlace.o \
YASM-OBJS-$(CONFIG_AC3DSP) += x86/ac3dsp.o YASM-OBJS-$(CONFIG_AC3DSP) += x86/ac3dsp.o
YASM-OBJS-$(CONFIG_AUDIODSP) += x86/audiodsp.o YASM-OBJS-$(CONFIG_AUDIODSP) += x86/audiodsp.o
YASM-OBJS-$(CONFIG_BLOCKDSP) += x86/blockdsp.o YASM-OBJS-$(CONFIG_BLOCKDSP) += x86/blockdsp.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_DIRAC_DECODER) += x86/diracdsp_mmx.o x86/diracdsp_yasm.o\ YASM-OBJS-$(CONFIG_DIRAC_DECODER) += x86/diracdsp_mmx.o x86/diracdsp_yasm.o\
x86/dwt_yasm.o x86/dwt_yasm.o
YASM-OBJS-$(CONFIG_DNXHD_ENCODER) += x86/dnxhdenc.o YASM-OBJS-$(CONFIG_DNXHD_ENCODER) += x86/dnxhdenc.o
YASM-OBJS-$(CONFIG_DSPUTIL) += x86/dsputil.o
YASM-OBJS-$(CONFIG_ENCODERS) += x86/dsputilenc.o YASM-OBJS-$(CONFIG_ENCODERS) += x86/dsputilenc.o
YASM-OBJS-$(CONFIG_FFT) += x86/fft.o YASM-OBJS-$(CONFIG_FFT) += x86/fft.o
YASM-OBJS-$(CONFIG_FLAC_DECODER) += x86/flacdsp.o YASM-OBJS-$(CONFIG_FLAC_DECODER) += x86/flacdsp.o
......
;****************************************************************************** ;******************************************************************************
;* MMX optimized DSP utils ;* optimized bswap buffer functions
;* Copyright (c) 2008 Loren Merritt ;* Copyright (c) 2008 Loren Merritt
;* Copyright (c) 2003-2013 Michael Niedermayer ;* Copyright (c) 2003-2013 Michael Niedermayer
;* Copyright (c) 2013 Daniel Kang ;* Copyright (c) 2013 Daniel Kang
......
/*
* This file is part of FFmpeg.
*
* FFmpeg is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* FFmpeg is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with FFmpeg; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include <stdint.h>
#include "libavutil/attributes.h"
#include "libavutil/cpu.h"
#include "libavutil/x86/cpu.h"
#include "libavcodec/bswapdsp.h"
void ff_bswap32_buf_sse2(uint32_t *dst, const uint32_t *src, int w);
void ff_bswap32_buf_ssse3(uint32_t *dst, const uint32_t *src, int w);
av_cold void ff_bswapdsp_init_x86(BswapDSPContext *c)
{
int cpu_flags = av_get_cpu_flags();
if (EXTERNAL_SSE2(cpu_flags))
c->bswap_buf = ff_bswap32_buf_sse2;
if (EXTERNAL_SSSE3(cpu_flags))
c->bswap_buf = ff_bswap32_buf_ssse3;
}
...@@ -29,9 +29,6 @@ ...@@ -29,9 +29,6 @@
#include "dsputil_x86.h" #include "dsputil_x86.h"
#include "idct_xvid.h" #include "idct_xvid.h"
void ff_bswap32_buf_ssse3(uint32_t *dst, const uint32_t *src, int w);
void ff_bswap32_buf_sse2(uint32_t *dst, const uint32_t *src, int w);
static av_cold void dsputil_init_mmx(DSPContext *c, AVCodecContext *avctx, static av_cold void dsputil_init_mmx(DSPContext *c, AVCodecContext *avctx,
int cpu_flags, unsigned high_bit_depth) int cpu_flags, unsigned high_bit_depth)
{ {
...@@ -96,19 +93,10 @@ static av_cold void dsputil_init_sse2(DSPContext *c, AVCodecContext *avctx, ...@@ -96,19 +93,10 @@ static av_cold void dsputil_init_sse2(DSPContext *c, AVCodecContext *avctx,
#endif /* HAVE_SSE2_INLINE */ #endif /* HAVE_SSE2_INLINE */
#if HAVE_SSE2_EXTERNAL #if HAVE_SSE2_EXTERNAL
c->bswap_buf = ff_bswap32_buf_sse2;
c->put_signed_pixels_clamped = ff_put_signed_pixels_clamped_sse2; c->put_signed_pixels_clamped = ff_put_signed_pixels_clamped_sse2;
#endif /* HAVE_SSE2_EXTERNAL */ #endif /* HAVE_SSE2_EXTERNAL */
} }
static av_cold void dsputil_init_ssse3(DSPContext *c, AVCodecContext *avctx,
int cpu_flags, unsigned high_bit_depth)
{
#if HAVE_SSSE3_EXTERNAL
c->bswap_buf = ff_bswap32_buf_ssse3;
#endif /* HAVE_SSSE3_EXTERNAL */
}
av_cold void ff_dsputil_init_x86(DSPContext *c, AVCodecContext *avctx, av_cold void ff_dsputil_init_x86(DSPContext *c, AVCodecContext *avctx,
unsigned high_bit_depth) unsigned high_bit_depth)
{ {
...@@ -123,9 +111,6 @@ av_cold void ff_dsputil_init_x86(DSPContext *c, AVCodecContext *avctx, ...@@ -123,9 +111,6 @@ av_cold void ff_dsputil_init_x86(DSPContext *c, AVCodecContext *avctx,
if (X86_SSE2(cpu_flags)) if (X86_SSE2(cpu_flags))
dsputil_init_sse2(c, avctx, cpu_flags, high_bit_depth); dsputil_init_sse2(c, avctx, cpu_flags, high_bit_depth);
if (EXTERNAL_SSSE3(cpu_flags))
dsputil_init_ssse3(c, avctx, cpu_flags, high_bit_depth);
if (CONFIG_ENCODERS) if (CONFIG_ENCODERS)
ff_dsputilenc_init_mmx(c, avctx, high_bit_depth); ff_dsputilenc_init_mmx(c, avctx, high_bit_depth);
} }
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