Commit Graph

130 Commits

Author SHA1 Message Date
Michael Niedermayer
b054054c9b avcodec/dcadec: Use avpriv_float_dsp_alloc()
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-11-20 22:46:08 +01:00
Michael Niedermayer
785f71fcd5 Merge commit 'd5d2d6c3b8cff61eb26c18bbd977881cf6d5524a'
* commit 'd5d2d6c3b8cff61eb26c18bbd977881cf6d5524a':
  dcadec: initialize variables before use

Conflicts:
	libavcodec/dcadec.c

See: 53918a1c54
Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-11-13 14:21:18 +01:00
Vittorio Giovara
d5d2d6c3b8 dcadec: initialize variables before use
CC: libav-stable@libav.org
Bug-Id: CID 700751 / CID 700752
2014-11-13 01:41:26 +01:00
Michael Niedermayer
950ce21d4a Merge commit '103391ca90b2f7c56ae756d76c76f7c3dfa28dd4'
* commit '103391ca90b2f7c56ae756d76c76f7c3dfa28dd4':
  dca: Remove some commented-out cruft

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-09-21 11:51:34 +02:00
Diego Biurrun
103391ca90 dca: Remove some commented-out cruft 2014-09-20 13:49:52 +02: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
7a34b7d80f avcodec/dca: Make ff_dca_convert_bitstream() available to libavformat, needed for dts_probe()
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-08-06 22:28:35 +02:00
Michael Niedermayer
a740cae4a0 avcodec/dcadec: remove unsignedness from constant
POSIX gurantees >=32bit so it all fits in signed int
Also >=32bit ints are assumed througout the codebase

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-06-18 13:46:51 +02:00
Michael Niedermayer
118d84b7e9 Merge commit 'f2ce63246f5c934429f9cb857a794e07624d7912'
* commit 'f2ce63246f5c934429f9cb857a794e07624d7912':
  dcadec: replace ldexpf with a multiplication by a constant

Conflicts:
	libavcodec/dcadec.c

See: 6da06ef6bb
See: 9ccb5455ca
See: 6b88f22e89
Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-06-18 13:06:09 +02:00
Niels Möller
f2ce63246f dcadec: replace ldexpf with a multiplication by a constant
Signed-off-by: Anton Khirnov <anton@khirnov.net>
2014-06-18 08:23:15 +02:00
Michael Niedermayer
98ff07d1c6 avcodec/dcadec: Check dca_dmixtable index
Found-by: Niels Möller <nisse@lysator.liu.se>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-06-04 22:13:39 +02:00
Michael Niedermayer
47313bbb5f avcodec/dcadec: remove fishy FFMAX()
These where intended to maintain the previous behavior before dca_dmix_code()
but it is unclear (to me) which way is correct and no sample seem to trigger
the case, also they are incomplete for the purprose of error checking

Found-by: Niels Möller <nisse@lysator.liu.se>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-06-04 22:11:03 +02:00
Lou Logan
88f2586adb fix various typos
Signed-off-by: Lou Logan <lou@lrcd.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-06-03 10:58:19 -08:00
Michael Niedermayer
6b88f22e89 avcodec/dcadec: dont use hex float, msvc doesnt support it
Found-by: nevcairiel
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-05-23 22:39:14 +02:00
Michael Niedermayer
9ccb5455ca avcodec/dcadec: use a constant instead of assuming every compiler can optimize pow(2,-15)
Idea-by: nevcairiel and wm4
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-05-23 22:19:11 +02:00
Michael Niedermayer
6da06ef6bb avcodec/dcadec: make dca_dmix_code() 650% faster
This effectively replaces the ldexpf() function call by a multiplication
with a constant.

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-05-23 22:08:41 +02:00
Michael Niedermayer
4e4dbb9983 dcadec: fix xxch_dmix_coeff and xxch_dmix_sf after merge
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-05-23 20:39:21 +02:00
Michael Niedermayer
c867be03f6 Merge commit '6b7b8585d73548f08b98959df39d80b97677662f'
* commit '6b7b8585d73548f08b98959df39d80b97677662f':
  dca: Convert dca_dmixtable to integers

Conflicts:
	libavcodec/dcadec.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-05-23 19:01:12 +02:00
Niels Möller
6b7b8585d7 dca: Convert dca_dmixtable to integers
Also include zero in the table, eliminating a special case in the
decoder.

Signed-off-by: Niels Möller <nisse@southpole.se>
Signed-off-by: Anton Khirnov <anton@khirnov.net>
2014-05-23 15:07:05 +02:00
Michael Niedermayer
62a9725bc9 avcodec/dcadec: add an assert to silence a uninitialized variable warning
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-05-08 16:48:41 +02:00
Michael Niedermayer
7e79d72c28 avcodec/dcadec: remove always true if()
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-05-08 16:47:20 +02:00
Michael Niedermayer
f202af29c9 avcodec/dcadec: fix error message suppression code
Fixes part of Ticket3466
Found-by: Andrey_Karpov / PVS-Studio
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-04-16 02:24:12 +02:00
Michael Niedermayer
9468e9e5a2 Merge commit 'b3d905b702dcdda9e3ae2bcb7b5580ca77a96ab7'
* commit 'b3d905b702dcdda9e3ae2bcb7b5580ca77a96ab7':
  dcadec: Delete redundant init_get_bits call

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-04-14 14:44:58 +02:00
Niels Möller
b3d905b702 dcadec: Delete redundant init_get_bits call
No initialization is needed in dca_decode_frame, because the next
thing it does is calling dca_parse_frame_header, which takes care of
the needed initialization.

Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2014-04-14 11:56:26 +02:00
Michael Niedermayer
a676e48d39 Merge commit '801c39e1e3058fc4ba822bfb5d8612d777111e32'
* commit '801c39e1e3058fc4ba822bfb5d8612d777111e32':
  dcadec: Use correct channel count in stereo downmix check

Conflicts:
	libavcodec/dcadec.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-04-13 04:23:56 +02:00
Michael Niedermayer
952614b899 Merge commit 'c8cf461c19e8e35df4b7364d9b90aa42f1ab4560'
* commit 'c8cf461c19e8e35df4b7364d9b90aa42f1ab4560':
  dcadec: Do not decode the XCh extension when downmixing to stereo

Conflicts:
	libavcodec/dcadec.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-04-13 04:07:27 +02:00
Tim Walker
801c39e1e3 dcadec: Use correct channel count in stereo downmix check
s->prim_channels is greater than num_core_channels
when an XCh extension is present in the bitstream.

Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2014-04-12 23:05:37 +02:00
Tim Walker
c8cf461c19 dcadec: Do not decode the XCh extension when downmixing to stereo
This is neither necessary nor currently supported.

Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2014-04-12 23:05:07 +02:00
Andreas Cadhalpun
eeb3baf7f7 Fix spelling error 'Inconsistant -> Inconsistent'
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-03-06 20:44:45 +01: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
ffb7d7195b avcodec/dcadec: use brackets to ensure that no slow division is used
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-02-28 21:32:24 +01:00
Michael Niedermayer
747b0337e7 Merge commit '7686afd049be98d18663682b92d983340fa2c305'
* commit '7686afd049be98d18663682b92d983340fa2c305':
  dca: factorize scaling in inverse ADPCM

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-02-28 21:32:14 +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
Janne Grunau
7686afd049 dca: factorize scaling in inverse ADPCM
Based on a patch from Christophe Gisquet.

Unrolling of the m == 0 case avoids a possible use of the uninitilized
value sum when s->predictor_history is not set. I failed to find a
sample for it. It also reduced the cycle count from 220 to 150 on
sandy bridge, x86_64 linux, gcc 4.8.2 compared to his patch.
2014-02-28 13:00:48 +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
ef010f08ae dca: replace some memcpy by AV_COPY128
Signed-off-by: Janne Grunau <janne-libav@jannau.net>
2014-02-20 14:16:43 +01:00
Christophe Gisquet
5a48caa34b dca: replace some memcpy by AV_COPY128
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-02-15 19:03:10 +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
ae01af2475 Merge commit '30d70e79a6b4ac7f4eb66446a9da275161ef6ea7'
* commit '30d70e79a6b4ac7f4eb66446a9da275161ef6ea7':
  dcadec: set AV_FRAME_DATA_MATRIXENCODING side data.

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-01-05 22:34:21 +01:00
Michael Niedermayer
bc7f76377c Merge commit '6bfdb2de881372048be7fbda643417e1fd3ce93c'
* commit '6bfdb2de881372048be7fbda643417e1fd3ce93c':
  dcadec: set the output channel mode more accurately.

Conflicts:
	libavcodec/dcadec.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-01-05 22:27:34 +01:00
Tim Walker
30d70e79a6 dcadec: set AV_FRAME_DATA_MATRIXENCODING side data. 2014-01-05 16:41:56 +01:00
Tim Walker
6bfdb2de88 dcadec: set the output channel mode more accurately.
When downmixing 2.1 to 2-channel, if the 2.0 portion is Lt/Rt, sum-difference or dual mono, the actual output will be the same (with the LFE either mixed-in or discarded).

Also, when downmixing an arbitrary layout to 2-channel, if the bitstream contains custom downmix coefficients targeting Lt/Rt, then the output will be Lt/Rt rather than regular Stereo.
2014-01-05 16:41:56 +01:00
Michael Niedermayer
b6a9719941 dcadec: Decode LFE to avoid adding random data when downmixing with LFE
Signed-off-by: Tim Walker <tdskywalker@gmail.com>
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2013-12-06 23:37:05 +01:00