Commit Graph

48 Commits

Author SHA1 Message Date
Lynne e0661fc805
dca_core: convert to lavu/tx
Thanks to Martin Storsjö <martin@martin.st> for fixing and testing the
arm32 and aarch64 changes.
2022-11-06 14:39:36 +01:00
Andreas Rheinhardt 40e6575aa3 all: Replace if (ARCH_FOO) checks by #if ARCH_FOO
This is more spec-compliant because it does not rely
on dead-code elimination by the compiler. Especially
MSVC has problems with this, as can be seen in
https://ffmpeg.org/pipermail/ffmpeg-devel/2022-May/296373.html
or
https://ffmpeg.org/pipermail/ffmpeg-devel/2022-May/297022.html

This commit does not eliminate every instance where we rely
on dead code elimination: It only tackles branching to
the initialization of arch-specific dsp code, not e.g. all
uses of CONFIG_ and HAVE_ checks. But maybe it is already
enough to compile FFmpeg with MSVC with whole-programm-optimizations
enabled (if one does not disable too many components).

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-06-15 04:56:37 +02:00
Andreas Rheinhardt 4608f7cc6a Remove unnecessary mem.h inclusions
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-07-22 14:47:57 +02:00
Michael Niedermayer b4ebf483bc avcodec/dcadsp: Fix integer overflow in dmix_add_c()
Fixes: signed integer overflow: 1515225320 + 759416059 cannot be represented in type 'int'
Fixes: 29256/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_DCA_fuzzer-5719088561258496

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2021-03-08 22:08:49 +01:00
Anton Khirnov c8c2dfbc37 lavu: move LOCAL_ALIGNED from internal.h to mem_internal.h
That is a more appropriate place for it.
2021-01-01 14:11:01 +01:00
Michael Niedermayer 9244b839b7 avcodec/dcadsp: Fix runtime error: signed integer overflow
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/targets/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-04-09 03:51:19 +02:00
Michael Niedermayer 29638d4db9 avcodec/dcadsp: Fix 2 runtime error: signed integer overflow: -1958094138 - 1078906344 cannot be represented in type 'int'
Fixes: 722/clusterfuzz-testcase-5711268868521984

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/targets/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-03-05 12:01:48 +01:00
Michael Niedermayer 949d2176ef avcodec/dca: Fix multiple runtime error: signed integer overflow
Fixes: 680/clusterfuzz-testcase-5416627266912256
Fixes: 681/clusterfuzz-testcase-5013323462475776

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/targets/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-02-28 01:13:52 +01:00
Michael Niedermayer 92188c8f57 avcodec/dcadsp: Fix runtime error: signed integer overflow: 394625024 * 8 cannot be represented in type 'int'
Fixes: 643/clusterfuzz-testcase-5209078743695360

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/targets/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-02-22 02:42:48 +01:00
foo86 6c44696b3d avcodec/dca: add DTS Express (LBR) decoder
Signed-off-by: James Almer <jamrial@gmail.com>
2016-05-10 20:33:28 -03:00
James Almer bd63ecec78 avcodec/dcadsp: use LOCAL_ALIGNED_32 instead of LOCAL_ALIGNED(32, ...) 2016-05-06 00:47:55 -03:00
James Almer 8ae7447941 x86/dcadec: add ff_lfe_fir0_float_{sse,sse2,avx,fma3}
Up to ~4 times faster on x86_64, ~8 times on x86_32 if compiling using x87 fp math.

Reviewed-by: Ronald S. Bultje <rsbultje@gmail.com>
Signed-off-by: James Almer <jamrial@gmail.com>
2016-02-06 01:36:55 -03:00
James Almer 3e9b8ffc9b avcodec/dcadsp: rename lfe_fir_float functions
Reviewed-by: Ronald S. Bultje <rsbultje@gmail.com>
Signed-off-by: James Almer <jamrial@gmail.com>
2016-02-06 01:29:10 -03:00
James Almer 16af350ac5 avcodec/dcadsp: replace intptr_t with ptrdiff_t
Reviewed-by: Hendrik Leppkes <h.leppkes@gmail.com>
Signed-off-by: James Almer <jamrial@gmail.com>
2016-02-05 11:17:04 -03:00
foo86 ae5b2c5250 avcodec/dca: add new decoder based on libdcadec 2016-01-31 17:09:38 +01:00
foo86 4608996772 avcodec/dca: remove old decoder
Remove all files and functions which are not going to be reused,
and disable all functions and FATE tests temporarily which will be.
2016-01-31 17:09:38 +01:00
Hendrik Leppkes 7fe77aa62e Merge commit '40d949677335a564f769823f4afdb7e7a3da8d6b'
* commit '40d949677335a564f769823f4afdb7e7a3da8d6b':
  dca: use defines for subband related constants

Merged-by: Hendrik Leppkes <h.leppkes@gmail.com>
2016-01-02 17:52:34 +01:00
Hendrik Leppkes d03da3e240 Merge commit '2008f76054906e9ff6bf744800af0e5a5bfe61be'
* commit '2008f76054906e9ff6bf744800af0e5a5bfe61be':
  dca: remove unused decode_hf function and quant_d tables

Merged-by: Hendrik Leppkes <h.leppkes@gmail.com>
2016-01-02 13:17:48 +01:00
Hendrik Leppkes af1238f863 Merge commit 'aebf07075f4244caf591a3af71e5872fe314e87b'
* commit 'aebf07075f4244caf591a3af71e5872fe314e87b':
  dca: change the core to work with integer coefficients.

Merged-by: Hendrik Leppkes <h.leppkes@gmail.com>
2016-01-02 13:08:29 +01:00
Hendrik Leppkes de3a33784c Merge commit 'c33c1fa8af2b2e82418a06901b6ad17b3d61b73e'
* commit 'c33c1fa8af2b2e82418a06901b6ad17b3d61b73e':
  arm64: convert dcadsp neon asm from arm

Merged-by: Hendrik Leppkes <h.leppkes@gmail.com>
2016-01-02 11:10:24 +01:00
Alexandra Hájková 40d9496773 dca: use defines for subband related constants
Signed-off-by: Janne Grunau <janne-libav@jannau.net>
2015-12-31 11:40:32 +01:00
Alexandra Hájková 2008f76054 dca: remove unused decode_hf function and quant_d tables
They were superseded with their integer equivalents. Rename integer
decode_hf to decode_hf.
2015-12-24 13:58:18 +01:00
Alexandra Hájková aebf07075f dca: change the core to work with integer coefficients.
The DCA core decoder converts integer coefficients read from the
bitstream to floats just after reading them (along with dequantization).
All the other steps of the audio reconstruction are done with floats
which makes the output for the DTS lossless extension (XLL)
actually lossy.
This patch changes the DCA core to work with integer coefficients
until QMF. At this point the integer coefficients are converted to floats.
The coefficients for the LFE channel (lfe_data) are not touched.
This is the first step for the really lossless XLL decoding.
2015-12-23 11:50:18 +01:00
Janne Grunau c33c1fa8af arm64: convert dcadsp neon asm from arm
~2% faster dts decoding overall.

                    cortex-a57   cortex-a53
dca_decode_hf_c:    474.8        1659.9
dca_decode_hf_neon: 225.2         301.1
dca_lfe_fir0_c:     913.2        1537.7
dca_lfe_fir0_neon:  286.8         451.9
dca_lfe_fir1_c:     848.7        1711.5
dca_lfe_fir1_neon:  387.1         506.4
2015-12-14 16:45:01 +01:00
Michael Niedermayer 7d43fbe3ae Merge commit '45ff7c93dd84a254cc96acc589e5ac3d7bd16bce'
* commit '45ff7c93dd84a254cc96acc589e5ac3d7bd16bce':
  dca: K&R formatting cosmetics

Conflicts:
	libavcodec/dca_parser.c
	libavcodec/dcadec.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-09-16 20:31:02 +02:00
Gabriel Dume 45ff7c93dd dca: K&R formatting cosmetics
Signed-off-by: Diego Biurrun <diego@biurrun.de>
2014-09-16 04:42:32 -07:00
Michael Niedermayer fb3c33f3cd Merge commit '4cb6964244fd6c099383d8b7e99731e72cc844b9'
* commit '4cb6964244fd6c099383d8b7e99731e72cc844b9':
  dcadec: simplify decoding of VQ high frequencies

Conflicts:
	configure
	libavcodec/dcadec.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-02-28 21:41:19 +01:00
Michael Niedermayer 5333e0dd66 Merge commit '57b1eb9f75b04571063ddec316e290c216c114ac'
* commit '57b1eb9f75b04571063ddec316e290c216c114ac':
  dcadsp: scan coefficients linearly in dca_lfe_fir

Conflicts:
	libavcodec/dcadsp.c

See: 9ae8e23188
Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-02-28 19:40:40 +01:00
Michael Niedermayer 90f674d55b Merge commit '87ec849fe9acba075c843e67bcd01f256f481a18'
* commit '87ec849fe9acba075c843e67bcd01f256f481a18':
  dcadec: remove scaling in lfe_interpolation_fir

Conflicts:
	libavcodec/dcadec.c
	libavcodec/dcadsp.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-02-28 18:14:12 +01:00
Christophe Gisquet 4cb6964244 dcadec: simplify decoding of VQ high frequencies
The vector dequantization has a test in a loop preventing effective SIMD
implementation. By moving it out of the loop, this loop can be DSPized.

Therefore, modify the current DSP implementation. In particular, the
DSP implementation no longer has to handle null loop sizes.

The decode_hf implementations have following timings:

For x86 Arrandale:
        C  SSE SSE2 SSE4
win32: 260 162  119  104
win64: 242 N/A   89   72

The arm NEON optimizations follow in a later patch as external asm. The
now unused check for the y modifier in arm inline asm is removed from
configure.
2014-02-28 13:03:22 +01:00
Christophe Gisquet 57b1eb9f75 dcadsp: scan coefficients linearly in dca_lfe_fir
This change is inspired by x86 asm where it frees a register.

Signed-off-by: Janne Grunau <janne-libav@jannau.net>
2014-02-28 13:00:47 +01:00
Christophe Gisquet 87ec849fe9 dcadec: remove scaling in lfe_interpolation_fir
The scaling factor is constant so it is faster to scale the
FIR coefficients in the tables during compilation.

Signed-off-by: Janne Grunau <janne-libav@jannau.net>
2014-02-28 13:00:47 +01:00
Christophe Gisquet 9ae8e23188 dcadsp: scan coefficients linearly instead.
This change is inspired by x86 asm, where this frees a register.

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-02-15 20:08:08 +01:00
Christophe Gisquet 45854df9a5 dcadsp: split lfe_dir cases
The x86 runs short on registers because numerous elements are not static.
In addition, splitting them allows more optimized code, at least for x86.

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-02-08 02:04:12 +01:00
Michael Niedermayer 82ae8a44e6 Merge commit '5b59a9fc6152169599561f04b4f66370edda5c9c'
* commit '5b59a9fc6152169599561f04b4f66370edda5c9c':
  x86: dcadsp: implement int8x8_fmul_int32

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-02-08 01:20:33 +01:00
Christophe Gisquet 481a46a462 dcadsp: add int8x8_fmul_int32 to DSP context
It is currently declared as a macro who is set to inlinable functions,
among which a Neon and a default C implementations.

Add a DSP parameter to each inline function, unused except by the
default C implementation which calls a function from the DSP context.

On an Arrandale CPU, gain for an inlined SSE2 function vs. a call:
- Win32: 29 to 26 cycles
- Win64: 25 to 23 cycles

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-02-08 00:55:42 +01:00
Christophe Gisquet 5fdbfcb5b7 dcadsp: split lfe_dir cases
The x86 runs short on registers because numerous elements are not static.
In addition, splitting them allows more optimized code, at least for x86.

Arm asm changes by Janne Grunau.

Signed-off-by: Janne Grunau <janne-libav@jannau.net>
2014-02-07 22:54:18 +01:00
Christophe Gisquet 5b59a9fc61 x86: dcadsp: implement int8x8_fmul_int32
For the callable function (as opposed to the inline one):
         C  SSE  SSE2  SSE4
Win32:  47   42   29    26
Win64:  30   33   25    23
The SSE version is neither compiled nor set for ARCH_X86_64, as the
inlinable function takes over.

Signed-off-by: Janne Grunau <janne-libav@jannau.net>
2014-02-07 22:52:40 +01:00
Christophe Gisquet 2bd44cb705 dcadsp: add int8x8_fmul_int32 to dsp context
It is currently declared as a macro who is set to inlinable functions,
among which a Neon and a default C implementations.

Add a DSP parameter to each inline function, unused except by the
default C implementation which calls a function from the DSP context.

On an Arrandale CPU, gain for an inlined SSE2 function vs. a call:
- Win32: 29 to 26 cycles
- Win64: 25 to 23 cycles

Signed-off-by: Janne Grunau <janne-libav@jannau.net>
2014-02-07 22:51:59 +01:00
Michael Niedermayer 366e415836 Merge commit '800ffab48a7844dd5dc0a33b8f6b8e5ed718cf2e'
* commit '800ffab48a7844dd5dc0a33b8f6b8e5ed718cf2e':
  dcadsp: Add a new method, qmf_32_subbands

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-07-22 12:10:59 +02:00
Ben Avison 800ffab48a dcadsp: Add a new method, qmf_32_subbands
This does most of the work formerly carried out by
the static function qmf_32_subbands() in dcadec.c.

Signed-off-by: Martin Storsjö <martin@martin.st>
2013-07-22 10:15:42 +03:00
Michael Niedermayer 0aa095483d Merge commit '6fee1b90ce3bf4fbdfde7016e0890057c9000487'
* commit '6fee1b90ce3bf4fbdfde7016e0890057c9000487':
  avcodec: Add av_cold attributes to init functions missing them

Conflicts:
	libavcodec/aacpsy.c
	libavcodec/atrac3.c
	libavcodec/dvdsubdec.c
	libavcodec/ffv1.c
	libavcodec/ffv1enc.c
	libavcodec/h261enc.c
	libavcodec/h264_parser.c
	libavcodec/h264dsp.c
	libavcodec/h264pred.c
	libavcodec/libschroedingerenc.c
	libavcodec/libxvid_rc.c
	libavcodec/mpeg12.c
	libavcodec/mpeg12enc.c
	libavcodec/proresdsp.c
	libavcodec/rangecoder.c
	libavcodec/videodsp.c
	libavcodec/x86/proresdsp_init.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-05-05 11:34:29 +02:00
Diego Biurrun 6fee1b90ce avcodec: Add av_cold attributes to init functions missing them 2013-05-04 21:09:45 +02:00
Justin Ruggles a8ae4e0e7b Remove unneeded add bias from 3 functions.
DSPContext.vector_fmul_window()
DCADSPContext.lfe_fir()
SynthFilterContext.synth_filter_float()

Signed-off-by: Mans Rullgard <mans@mansr.com>
(cherry picked from commit 80ba1ddb58)
2011-02-02 03:40:48 +01:00
Måns Rullgård 08255107cf DCA: ARM/NEON optimised lfe_fir
Originally committed as revision 22863 to svn://svn.ffmpeg.org/ffmpeg/trunk
2010-04-12 20:45:33 +00:00
Måns Rullgård 309d16a4a0 DCA: break out lfe_interpolation_fir() inner loops to a function
This enables SIMD optimisations of this function.

Originally committed as revision 22861 to svn://svn.ffmpeg.org/ffmpeg/trunk
2010-04-12 20:45:25 +00:00
Mans Rullgard 2912e87a6c Replace FFmpeg with Libav in licence headers
Signed-off-by: Mans Rullgard <mans@mansr.com>
2011-03-19 13:33:20 +00:00
Justin Ruggles 80ba1ddb58 Remove unneeded add bias from 3 functions.
DSPContext.vector_fmul_window()
DCADSPContext.lfe_fir()
SynthFilterContext.synth_filter_float()

Signed-off-by: Mans Rullgard <mans@mansr.com>
2011-01-31 20:28:42 +00:00