Commit ccff45a0 authored by Christophe Gisquet's avatar Christophe Gisquet Committed by Michael Niedermayer

apedsp: move to llauddsp

APE is not the sole codec using scalarproduct_and_madd_int16.
Signed-off-by: 's avatarMichael Niedermayer <michaelni@gmx.at>
parent 151f88d5
...@@ -1811,6 +1811,7 @@ CONFIG_EXTRA=" ...@@ -1811,6 +1811,7 @@ CONFIG_EXTRA="
huffyuvencdsp huffyuvencdsp
intrax8 intrax8
lgplv3 lgplv3
llauddsp
llviddsp llviddsp
lpc lpc
mpegaudio mpegaudio
...@@ -2007,7 +2008,7 @@ amrnb_decoder_select="lsp" ...@@ -2007,7 +2008,7 @@ 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" ape_decoder_select="dsputil llauddsp"
asv1_decoder_select="dsputil" asv1_decoder_select="dsputil"
asv1_encoder_select="dsputil" asv1_encoder_select="dsputil"
asv2_decoder_select="dsputil" asv2_decoder_select="dsputil"
......
...@@ -58,6 +58,7 @@ OBJS-$(CONFIG_HUFFYUVDSP) += huffyuvdsp.o ...@@ -58,6 +58,7 @@ OBJS-$(CONFIG_HUFFYUVDSP) += huffyuvdsp.o
OBJS-$(CONFIG_HUFFYUVENCDSP) += huffyuvencdsp.o OBJS-$(CONFIG_HUFFYUVENCDSP) += huffyuvencdsp.o
OBJS-$(CONFIG_INTRAX8) += intrax8.o intrax8dsp.o OBJS-$(CONFIG_INTRAX8) += intrax8.o intrax8dsp.o
OBJS-$(CONFIG_LIBXVID) += libxvid_rc.o OBJS-$(CONFIG_LIBXVID) += libxvid_rc.o
OBJS-$(CONFIG_LLAUDDSP) += lossless_audiodsp.o
OBJS-$(CONFIG_LLVIDDSP) += lossless_videodsp.o OBJS-$(CONFIG_LLVIDDSP) += lossless_videodsp.o
OBJS-$(CONFIG_LPC) += lpc.o OBJS-$(CONFIG_LPC) += lpc.o
OBJS-$(CONFIG_LSP) += lsp.o OBJS-$(CONFIG_LSP) += lsp.o
......
...@@ -25,7 +25,7 @@ ...@@ -25,7 +25,7 @@
#include "libavutil/avassert.h" #include "libavutil/avassert.h"
#include "libavutil/channel_layout.h" #include "libavutil/channel_layout.h"
#include "libavutil/opt.h" #include "libavutil/opt.h"
#include "apedsp.h" #include "lossless_audiodsp.h"
#include "avcodec.h" #include "avcodec.h"
#include "dsputil.h" #include "dsputil.h"
#include "bytestream.h" #include "bytestream.h"
...@@ -137,7 +137,7 @@ typedef struct APEContext { ...@@ -137,7 +137,7 @@ typedef struct APEContext {
AVClass *class; ///< class for AVOptions AVClass *class; ///< class for AVOptions
AVCodecContext *avctx; AVCodecContext *avctx;
DSPContext dsp; DSPContext dsp;
APEDSPContext 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
int bps; int bps;
...@@ -212,19 +212,6 @@ static av_cold int ape_decode_close(AVCodecContext *avctx) ...@@ -212,19 +212,6 @@ static av_cold int ape_decode_close(AVCodecContext *avctx)
return 0; return 0;
} }
static int32_t scalarproduct_and_madd_int16_c(int16_t *v1, const int16_t *v2,
const int16_t *v3,
int order, int mul)
{
int res = 0;
while (order--) {
res += *v1 * *v2++;
*v1++ += mul * *v3++;
}
return res;
}
static av_cold int ape_decode_init(AVCodecContext *avctx) static av_cold int ape_decode_init(AVCodecContext *avctx)
{ {
APEContext *s = avctx->priv_data; APEContext *s = avctx->priv_data;
...@@ -306,16 +293,8 @@ static av_cold int ape_decode_init(AVCodecContext *avctx) ...@@ -306,16 +293,8 @@ 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;
} }
s->adsp.scalarproduct_and_madd_int16 = scalarproduct_and_madd_int16_c;
if (ARCH_ARM)
ff_apedsp_init_arm(&s->adsp);
if (ARCH_PPC)
ff_apedsp_init_ppc(&s->adsp);
if (ARCH_X86)
ff_apedsp_init_x86(&s->adsp);
ff_dsputil_init(&s->dsp, avctx); ff_dsputil_init(&s->dsp, avctx);
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;
return 0; return 0;
......
...@@ -16,6 +16,7 @@ OBJS-$(CONFIG_H264PRED) += arm/h264pred_init_arm.o ...@@ -16,6 +16,7 @@ OBJS-$(CONFIG_H264PRED) += arm/h264pred_init_arm.o
OBJS-$(CONFIG_H264QPEL) += arm/h264qpel_init_arm.o OBJS-$(CONFIG_H264QPEL) += arm/h264qpel_init_arm.o
OBJS-$(CONFIG_HPELDSP) += arm/hpeldsp_init_arm.o \ OBJS-$(CONFIG_HPELDSP) += arm/hpeldsp_init_arm.o \
arm/hpeldsp_arm.o arm/hpeldsp_arm.o
OBJS-$(CONFIG_LLAUDDSP) += arm/lossless_audiodsp_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_NEON_CLOBBER_TEST) += arm/neontest.o OBJS-$(CONFIG_NEON_CLOBBER_TEST) += arm/neontest.o
...@@ -24,7 +25,6 @@ OBJS-$(CONFIG_VP3DSP) += arm/vp3dsp_init_arm.o ...@@ -24,7 +25,6 @@ OBJS-$(CONFIG_VP3DSP) += arm/vp3dsp_init_arm.o
OBJS-$(CONFIG_AAC_DECODER) += arm/aacpsdsp_init_arm.o \ OBJS-$(CONFIG_AAC_DECODER) += arm/aacpsdsp_init_arm.o \
arm/sbrdsp_init_arm.o arm/sbrdsp_init_arm.o
OBJS-$(CONFIG_APE_DECODER) += arm/apedsp_init_arm.o
OBJS-$(CONFIG_DCA_DECODER) += arm/dcadsp_init_arm.o OBJS-$(CONFIG_DCA_DECODER) += arm/dcadsp_init_arm.o
OBJS-$(CONFIG_FLAC_DECODER) += arm/flacdsp_init_arm.o \ OBJS-$(CONFIG_FLAC_DECODER) += arm/flacdsp_init_arm.o \
arm/flacdsp_arm.o arm/flacdsp_arm.o
...@@ -101,7 +101,7 @@ NEON-OBJS-$(CONFIG_VP3DSP) += arm/vp3dsp_neon.o ...@@ -101,7 +101,7 @@ NEON-OBJS-$(CONFIG_VP3DSP) += arm/vp3dsp_neon.o
NEON-OBJS-$(CONFIG_AAC_DECODER) += arm/aacpsdsp_neon.o \ NEON-OBJS-$(CONFIG_AAC_DECODER) += arm/aacpsdsp_neon.o \
arm/sbrdsp_neon.o arm/sbrdsp_neon.o
NEON-OBJS-$(CONFIG_APE_DECODER) += arm/apedsp_neon.o NEON-OBJS-$(CONFIG_LLAUDDSP) += arm/lossless_audiodsp_neon.o
NEON-OBJS-$(CONFIG_DCA_DECODER) += arm/dcadsp_neon.o \ NEON-OBJS-$(CONFIG_DCA_DECODER) += arm/dcadsp_neon.o \
arm/synth_filter_neon.o arm/synth_filter_neon.o
NEON-OBJS-$(CONFIG_RV30_DECODER) += arm/rv34dsp_neon.o NEON-OBJS-$(CONFIG_RV30_DECODER) += arm/rv34dsp_neon.o
......
...@@ -23,12 +23,12 @@ ...@@ -23,12 +23,12 @@
#include "libavutil/attributes.h" #include "libavutil/attributes.h"
#include "libavutil/cpu.h" #include "libavutil/cpu.h"
#include "libavutil/arm/cpu.h" #include "libavutil/arm/cpu.h"
#include "libavcodec/apedsp.h" #include "libavcodec/lossless_audiodsp.h"
int32_t ff_scalarproduct_and_madd_int16_neon(int16_t *v1, const int16_t *v2, int32_t ff_scalarproduct_and_madd_int16_neon(int16_t *v1, const int16_t *v2,
const int16_t *v3, int len, int mul); const int16_t *v3, int len, int mul);
av_cold void ff_apedsp_init_arm(APEDSPContext *c) av_cold void ff_llauddsp_init_arm(LLAudDSPContext *c)
{ {
int cpu_flags = av_get_cpu_flags(); int cpu_flags = av_get_cpu_flags();
......
/*
* Monkey's Audio lossless audio decoder
* Copyright (c) 2007 Benjamin Zores <ben@geexbox.org>
* based upon libdemac from Dave Chapman.
*
* 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 "avcodec.h"
#include "lossless_audiodsp.h"
static int32_t scalarproduct_and_madd_int16_c(int16_t *v1, const int16_t *v2,
const int16_t *v3,
int order, int mul)
{
int res = 0;
while (order--) {
res += *v1 * *v2++;
*v1++ += mul * *v3++;
}
return res;
}
av_cold void ff_llauddsp_init(LLAudDSPContext *c)
{
c->scalarproduct_and_madd_int16 = scalarproduct_and_madd_int16_c;
if (ARCH_ARM)
ff_llauddsp_init_arm(c);
if (ARCH_PPC)
ff_llauddsp_init_ppc(c);
if (ARCH_X86)
ff_llauddsp_init_x86(c);
}
...@@ -20,12 +20,12 @@ ...@@ -20,12 +20,12 @@
* 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_APEDSP_H #ifndef AVCODEC_LLAUDDSP_H
#define AVCODEC_APEDSP_H #define AVCODEC_LLAUDDSP_H
#include <stdint.h> #include <stdint.h>
typedef struct APEDSPContext { typedef struct LLAudDSPContext {
/** /**
* Calculate scalar product of v1 and v2, * Calculate scalar product of v1 and v2,
* and v1[i] += v3[i] * mul * and v1[i] += v3[i] * mul
...@@ -35,10 +35,11 @@ typedef struct APEDSPContext { ...@@ -35,10 +35,11 @@ typedef struct APEDSPContext {
const int16_t *v2, const int16_t *v2,
const int16_t *v3, const int16_t *v3,
int len, int mul); int len, int mul);
} APEDSPContext; } LLAudDSPContext;
void ff_apedsp_init_arm(APEDSPContext *c); void ff_llauddsp_init(LLAudDSPContext *c);
void ff_apedsp_init_ppc(APEDSPContext *c); void ff_llauddsp_init_arm(LLAudDSPContext *c);
void ff_apedsp_init_x86(APEDSPContext *c); void ff_llauddsp_init_ppc(LLAudDSPContext *c);
void ff_llauddsp_init_x86(LLAudDSPContext *c);
#endif /* AVCODEC_APEDSP_H */ #endif /* AVCODEC_LLAUDDSP_H */
...@@ -12,7 +12,7 @@ OBJS-$(CONFIG_MPEGVIDEO) += ppc/mpegvideo_altivec.o ...@@ -12,7 +12,7 @@ OBJS-$(CONFIG_MPEGVIDEO) += ppc/mpegvideo_altivec.o
OBJS-$(CONFIG_VIDEODSP) += ppc/videodsp_ppc.o OBJS-$(CONFIG_VIDEODSP) += ppc/videodsp_ppc.o
OBJS-$(CONFIG_VP3DSP) += ppc/vp3dsp_altivec.o OBJS-$(CONFIG_VP3DSP) += ppc/vp3dsp_altivec.o
OBJS-$(CONFIG_APE_DECODER) += ppc/apedsp_altivec.o OBJS-$(CONFIG_LLAUDDSP) += ppc/lossless_audiodsp_altivec.o
OBJS-$(CONFIG_SVQ1_ENCODER) += ppc/svq1enc_altivec.o OBJS-$(CONFIG_SVQ1_ENCODER) += ppc/svq1enc_altivec.o
OBJS-$(CONFIG_VC1_DECODER) += ppc/vc1dsp_altivec.o OBJS-$(CONFIG_VC1_DECODER) += ppc/vc1dsp_altivec.o
OBJS-$(CONFIG_VORBIS_DECODER) += ppc/vorbisdsp_altivec.o OBJS-$(CONFIG_VORBIS_DECODER) += ppc/vorbisdsp_altivec.o
......
...@@ -25,7 +25,7 @@ ...@@ -25,7 +25,7 @@
#include "libavutil/attributes.h" #include "libavutil/attributes.h"
#include "libavutil/ppc/types_altivec.h" #include "libavutil/ppc/types_altivec.h"
#include "libavcodec/apedsp.h" #include "libavcodec/lossless_audiodsp.h"
#if HAVE_ALTIVEC #if HAVE_ALTIVEC
static int32_t scalarproduct_and_madd_int16_altivec(int16_t *v1, static int32_t scalarproduct_and_madd_int16_altivec(int16_t *v1,
...@@ -69,7 +69,7 @@ static int32_t scalarproduct_and_madd_int16_altivec(int16_t *v1, ...@@ -69,7 +69,7 @@ static int32_t scalarproduct_and_madd_int16_altivec(int16_t *v1,
} }
#endif /* HAVE_ALTIVEC */ #endif /* HAVE_ALTIVEC */
av_cold void ff_apedsp_init_ppc(APEDSPContext *c) av_cold void ff_llauddsp_init_ppc(LLAudDSPContext *c)
{ {
#if HAVE_ALTIVEC #if HAVE_ALTIVEC
c->scalarproduct_and_madd_int16 = scalarproduct_and_madd_int16_altivec; c->scalarproduct_and_madd_int16 = scalarproduct_and_madd_int16_altivec;
......
...@@ -17,6 +17,7 @@ OBJS-$(CONFIG_H264PRED) += x86/h264_intrapred_init.o ...@@ -17,6 +17,7 @@ OBJS-$(CONFIG_H264PRED) += x86/h264_intrapred_init.o
OBJS-$(CONFIG_H264QPEL) += x86/h264_qpel.o OBJS-$(CONFIG_H264QPEL) += x86/h264_qpel.o
OBJS-$(CONFIG_HEVC_DECODER) += x86/hevcdsp_init.o OBJS-$(CONFIG_HEVC_DECODER) += x86/hevcdsp_init.o
OBJS-$(CONFIG_HPELDSP) += x86/hpeldsp_init.o OBJS-$(CONFIG_HPELDSP) += x86/hpeldsp_init.o
OBJS-$(CONFIG_LLAUDDSP) += x86/lossless_audiodsp_init.o
OBJS-$(CONFIG_LLVIDDSP) += x86/lossless_videodsp_init.o OBJS-$(CONFIG_LLVIDDSP) += x86/lossless_videodsp_init.o
OBJS-$(CONFIG_HUFFYUVDSP) += x86/huffyuvdsp_init.o OBJS-$(CONFIG_HUFFYUVDSP) += x86/huffyuvdsp_init.o
OBJS-$(CONFIG_HUFFYUVENCDSP) += x86/huffyuvencdsp_mmx.o OBJS-$(CONFIG_HUFFYUVENCDSP) += x86/huffyuvencdsp_mmx.o
...@@ -30,7 +31,6 @@ OBJS-$(CONFIG_VP3DSP) += x86/vp3dsp_init.o ...@@ -30,7 +31,6 @@ OBJS-$(CONFIG_VP3DSP) += x86/vp3dsp_init.o
OBJS-$(CONFIG_XMM_CLOBBER_TEST) += x86/w64xmmtest.o OBJS-$(CONFIG_XMM_CLOBBER_TEST) += x86/w64xmmtest.o
OBJS-$(CONFIG_AAC_DECODER) += x86/sbrdsp_init.o OBJS-$(CONFIG_AAC_DECODER) += x86/sbrdsp_init.o
OBJS-$(CONFIG_APE_DECODER) += x86/apedsp_init.o
OBJS-$(CONFIG_CAVS_DECODER) += x86/cavsdsp.o OBJS-$(CONFIG_CAVS_DECODER) += x86/cavsdsp.o
OBJS-$(CONFIG_DCA_DECODER) += x86/dcadsp_init.o OBJS-$(CONFIG_DCA_DECODER) += x86/dcadsp_init.o
OBJS-$(CONFIG_DNXHD_ENCODER) += x86/dnxhdenc_init.o OBJS-$(CONFIG_DNXHD_ENCODER) += x86/dnxhdenc_init.o
...@@ -96,6 +96,7 @@ YASM-OBJS-$(CONFIG_HEVC_DECODER) += x86/hevc_mc.o \ ...@@ -96,6 +96,7 @@ YASM-OBJS-$(CONFIG_HEVC_DECODER) += x86/hevc_mc.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_LLAUDDSP) += x86/lossless_audiodsp.o
YASM-OBJS-$(CONFIG_LLVIDDSP) += x86/lossless_videodsp.o YASM-OBJS-$(CONFIG_LLVIDDSP) += x86/lossless_videodsp.o
YASM-OBJS-$(CONFIG_MPEGAUDIODSP) += x86/imdct36.o YASM-OBJS-$(CONFIG_MPEGAUDIODSP) += x86/imdct36.o
YASM-OBJS-$(CONFIG_QPELDSP) += x86/qpeldsp.o \ YASM-OBJS-$(CONFIG_QPELDSP) += x86/qpeldsp.o \
...@@ -105,7 +106,6 @@ YASM-OBJS-$(CONFIG_VIDEODSP) += x86/videodsp.o ...@@ -105,7 +106,6 @@ YASM-OBJS-$(CONFIG_VIDEODSP) += x86/videodsp.o
YASM-OBJS-$(CONFIG_VP3DSP) += x86/vp3dsp.o YASM-OBJS-$(CONFIG_VP3DSP) += x86/vp3dsp.o
YASM-OBJS-$(CONFIG_AAC_DECODER) += x86/sbrdsp.o YASM-OBJS-$(CONFIG_AAC_DECODER) += x86/sbrdsp.o
YASM-OBJS-$(CONFIG_APE_DECODER) += x86/apedsp.o
YASM-OBJS-$(CONFIG_DCA_DECODER) += x86/dcadsp.o YASM-OBJS-$(CONFIG_DCA_DECODER) += x86/dcadsp.o
YASM-OBJS-$(CONFIG_PNG_DECODER) += x86/pngdsp.o YASM-OBJS-$(CONFIG_PNG_DECODER) += x86/pngdsp.o
YASM-OBJS-$(CONFIG_PRORES_DECODER) += x86/proresdsp.o YASM-OBJS-$(CONFIG_PRORES_DECODER) += x86/proresdsp.o
......
...@@ -19,7 +19,7 @@ ...@@ -19,7 +19,7 @@
#include "libavutil/attributes.h" #include "libavutil/attributes.h"
#include "libavutil/cpu.h" #include "libavutil/cpu.h"
#include "libavutil/x86/cpu.h" #include "libavutil/x86/cpu.h"
#include "libavcodec/apedsp.h" #include "libavcodec/lossless_audiodsp.h"
int32_t ff_scalarproduct_and_madd_int16_mmxext(int16_t *v1, const int16_t *v2, int32_t ff_scalarproduct_and_madd_int16_mmxext(int16_t *v1, const int16_t *v2,
const int16_t *v3, const int16_t *v3,
...@@ -31,7 +31,7 @@ int32_t ff_scalarproduct_and_madd_int16_ssse3(int16_t *v1, const int16_t *v2, ...@@ -31,7 +31,7 @@ int32_t ff_scalarproduct_and_madd_int16_ssse3(int16_t *v1, const int16_t *v2,
const int16_t *v3, const int16_t *v3,
int order, int mul); int order, int mul);
av_cold void ff_apedsp_init_x86(APEDSPContext *c) av_cold void ff_llauddsp_init_x86(LLAudDSPContext *c)
{ {
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