Commit f677718b authored by Aurelien Jacobs's avatar Aurelien Jacobs

sbcenc: add armv6 and neon asm optimizations

This was originally based on libsbc, and was fully integrated into ffmpeg.
parent f1e490b1
......@@ -42,6 +42,7 @@ OBJS-$(CONFIG_DCA_DECODER) += arm/synth_filter_init_arm.o
OBJS-$(CONFIG_HEVC_DECODER) += arm/hevcdsp_init_arm.o
OBJS-$(CONFIG_MLP_DECODER) += arm/mlpdsp_init_arm.o
OBJS-$(CONFIG_RV40_DECODER) += arm/rv40dsp_init_arm.o
OBJS-$(CONFIG_SBC_ENCODER) += arm/sbcdsp_init_arm.o
OBJS-$(CONFIG_VORBIS_DECODER) += arm/vorbisdsp_init_arm.o
OBJS-$(CONFIG_VP6_DECODER) += arm/vp6dsp_init_arm.o
OBJS-$(CONFIG_VP9_DECODER) += arm/vp9dsp_init_10bpp_arm.o \
......@@ -81,6 +82,7 @@ ARMV6-OBJS-$(CONFIG_VP8DSP) += arm/vp8_armv6.o \
# decoders/encoders
ARMV6-OBJS-$(CONFIG_MLP_DECODER) += arm/mlpdsp_armv6.o
ARMV6-OBJS-$(CONFIG_SBC_ENCODER) += arm/sbcdsp_armv6.o
# VFP optimizations
......@@ -140,6 +142,7 @@ NEON-OBJS-$(CONFIG_HEVC_DECODER) += arm/hevcdsp_init_neon.o \
NEON-OBJS-$(CONFIG_RV30_DECODER) += arm/rv34dsp_neon.o
NEON-OBJS-$(CONFIG_RV40_DECODER) += arm/rv34dsp_neon.o \
arm/rv40dsp_neon.o
NEON-OBJS-$(CONFIG_SBC_ENCODER) += arm/sbcdsp_neon.o
NEON-OBJS-$(CONFIG_VORBIS_DECODER) += arm/vorbisdsp_neon.o
NEON-OBJS-$(CONFIG_VP6_DECODER) += arm/vp6dsp_neon.o
NEON-OBJS-$(CONFIG_VP9_DECODER) += arm/vp9itxfm_16bpp_neon.o \
......
This diff is collapsed.
/*
* Bluetooth low-complexity, subband codec (SBC)
*
* Copyright (C) 2017 Aurelien Jacobs <aurel@gnuage.org>
* Copyright (C) 2008-2010 Nokia Corporation
* Copyright (C) 2004-2010 Marcel Holtmann <marcel@holtmann.org>
* Copyright (C) 2004-2005 Henryk Ploetz <henryk@ploetzli.ch>
* Copyright (C) 2005-2006 Brad Midgley <bmidgley@xmission.com>
*
* 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
*/
/**
* @file
* SBC ARMv6 optimization for some basic "building bricks"
*/
#include "libavutil/cpu.h"
#include "libavutil/arm/cpu.h"
#include "libavcodec/sbcdsp.h"
void ff_sbc_analyze_4_armv6(const int16_t *in, int32_t *out, const int16_t *consts);
void ff_sbc_analyze_8_armv6(const int16_t *in, int32_t *out, const int16_t *consts);
void ff_sbc_analyze_4_neon(const int16_t *in, int32_t *out, const int16_t *consts);
void ff_sbc_analyze_8_neon(const int16_t *in, int32_t *out, const int16_t *consts);
void ff_sbc_calc_scalefactors_neon(int32_t sb_sample_f[16][2][8],
uint32_t scale_factor[2][8],
int blocks, int channels, int subbands);
int ff_sbc_calc_scalefactors_j_neon(int32_t sb_sample_f[16][2][8],
uint32_t scale_factor[2][8],
int blocks, int subbands);
int ff_sbc_enc_process_input_4s_neon(int position, const uint8_t *pcm,
int16_t X[2][SBC_X_BUFFER_SIZE],
int nsamples, int nchannels);
int ff_sbc_enc_process_input_8s_neon(int position, const uint8_t *pcm,
int16_t X[2][SBC_X_BUFFER_SIZE],
int nsamples, int nchannels);
DECLARE_ALIGNED(SBC_ALIGN, int32_t, ff_sbcdsp_joint_bits_mask)[8] = {
8, 4, 2, 1, 128, 64, 32, 16
};
#if HAVE_BIGENDIAN
#define PERM(a, b, c, d) { \
(a * 2) + 1, (a * 2) + 0, \
(b * 2) + 1, (b * 2) + 0, \
(c * 2) + 1, (c * 2) + 0, \
(d * 2) + 1, (d * 2) + 0 \
}
#else
#define PERM(a, b, c, d) { \
(a * 2) + 0, (a * 2) + 1, \
(b * 2) + 0, (b * 2) + 1, \
(c * 2) + 0, (c * 2) + 1, \
(d * 2) + 0, (d * 2) + 1 \
}
#endif
DECLARE_ALIGNED(SBC_ALIGN, uint8_t, ff_sbc_input_perm_4)[2][8] = {
PERM(7, 3, 6, 4),
PERM(0, 2, 1, 5)
};
DECLARE_ALIGNED(SBC_ALIGN, uint8_t, ff_sbc_input_perm_8)[4][8] = {
PERM(15, 7, 14, 8),
PERM(13, 9, 12, 10),
PERM(11, 3, 6, 0),
PERM( 5, 1, 4, 2)
};
av_cold void ff_sbcdsp_init_arm(SBCDSPContext *s)
{
int cpu_flags = av_get_cpu_flags();
if (have_armv6(cpu_flags)) {
s->sbc_analyze_4 = ff_sbc_analyze_4_armv6;
s->sbc_analyze_8 = ff_sbc_analyze_8_armv6;
}
if (have_neon(cpu_flags)) {
s->sbc_analyze_4 = ff_sbc_analyze_4_neon;
s->sbc_analyze_8 = ff_sbc_analyze_8_neon;
s->sbc_calc_scalefactors = ff_sbc_calc_scalefactors_neon;
s->sbc_calc_scalefactors_j = ff_sbc_calc_scalefactors_j_neon;
if (s->increment != 1) {
s->sbc_enc_process_input_4s = ff_sbc_enc_process_input_4s_neon;
s->sbc_enc_process_input_8s = ff_sbc_enc_process_input_8s_neon;
}
}
}
This diff is collapsed.
......@@ -380,6 +380,8 @@ av_cold void ff_sbcdsp_init(SBCDSPContext *s)
s->sbc_calc_scalefactors = sbc_calc_scalefactors;
s->sbc_calc_scalefactors_j = sbc_calc_scalefactors_j;
if (ARCH_ARM)
ff_sbcdsp_init_arm(s);
if (ARCH_X86)
ff_sbcdsp_init_x86(s);
}
......@@ -80,6 +80,7 @@ struct sbc_dsp_context {
*/
void ff_sbcdsp_init(SBCDSPContext *s);
void ff_sbcdsp_init_arm(SBCDSPContext *s);
void ff_sbcdsp_init_x86(SBCDSPContext *s);
#endif /* AVCODEC_SBCDSP_H */
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