Commit Graph

108 Commits

Author SHA1 Message Date
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
Michael Niedermayer a3b9f53d7b Merge remote-tracking branch 'qatar/master'
* qatar/master:
  dcadec: Add some logging before returning on error

Conflicts:
	libavcodec/dcadec.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-11-30 21:09:42 +01:00
Tim Walker 7dc827b709 dcadec: Add some logging before returning on error
Based on a patch by Michael Niedermayer.

Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2013-11-30 13:01:35 +01:00
Michael Niedermayer 6e7de11444 avcodec/dcadec: decode LFE so we dont just add random data when downmixing with LFE
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-11-29 14:13:05 +01:00
Michael Niedermayer d2e46b11e4 avcodec/dcadec: set AV_CLASS_CATEGORY
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-11-29 04:56:37 +01:00
Michael Niedermayer 55bd20a841 avcodec/dcadec: AVClass is const
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-11-29 04:56:18 +01:00
Michael Niedermayer 5b3c684147 Merge remote-tracking branch 'qatar/master'
* qatar/master:
  dcadec: add disable_xch private option.

Conflicts:
	libavcodec/dcadec.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-11-29 04:39:52 +01:00
Michael Niedermayer 3f41e57fa8 Merge commit '220494ad0b2e9e980ef703b46b69308236f29be5'
* commit '220494ad0b2e9e980ef703b46b69308236f29be5':
  dcadec: treat all 2-channel modes as Stereo in dca_downmix.

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-11-29 04:21:34 +01:00
Michael Niedermayer 97468463a2 Merge commit 'aaa44d0299338e3bc90128816c21dbfab06cdb48'
* commit 'aaa44d0299338e3bc90128816c21dbfab06cdb48':
  dca: support mixing LFE in dca_downmix.

Conflicts:
	libavcodec/dcadec.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-11-29 04:00:59 +01:00
Michael Niedermayer 12235a3ed2 avcodec/dcadec: print more details about errors
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-11-29 03:42:03 +01:00
Michael Niedermayer 43ec456320 Merge commit '44b17d794aa508ae21f438ae80bfe8aaf4b426e1'
* commit '44b17d794aa508ae21f438ae80bfe8aaf4b426e1':
  dca: extract core substream's embedded downmix coeffcient codes, if present.

Conflicts:
	libavcodec/dcadata.h
	libavcodec/dcadec.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-11-29 03:28:15 +01:00
Michael Niedermayer c122e697fa Merge commit '27245b4e1bbb7a863341db321b5bdc5792e427d9'
* commit '27245b4e1bbb7a863341db321b5bdc5792e427d9':
  dca: remove embedded downmix coefficient extraction.

Conflicts:
	libavcodec/dcadata.h
	libavcodec/dcadec.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-11-29 01:12:02 +01:00
Michael Niedermayer a7f8817720 Merge commit 'b6d5e6aa10a2f09351f287e876f7ed4504e1f75d'
* commit 'b6d5e6aa10a2f09351f287e876f7ed4504e1f75d':
  dca: convert dca_default_coeffs to float.

Conflicts:
	libavcodec/dcadata.h

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-11-29 00:32:14 +01:00
Michael Niedermayer e9a47896a0 Merge commit '25609b63d2e07d26d610f485a22082d32c96c0f5'
* commit '25609b63d2e07d26d610f485a22082d32c96c0f5':
  dcadec: store the stereo downmix coefficients as float in the DCAContext.

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-11-29 00:24:41 +01:00
Michael Niedermayer cb751a6a96 Merge commit '89de5157b1cbe7807d3ec1d51bd56a75e98c002e'
* commit '89de5157b1cbe7807d3ec1d51bd56a75e98c002e':
  dcadec: implement request_channel_layout.

Conflicts:
	libavcodec/dcadec.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-11-29 00:18:42 +01:00
Tim Walker 3c8507a845 dcadec: add disable_xch private option.
This supplements the deprecated request_channels-based control of XCh decoding.

Signed-off-by: Anton Khirnov <anton@khirnov.net>
2013-11-28 22:02:53 +01:00
Tim Walker 220494ad0b dcadec: treat all 2-channel modes as Stereo in dca_downmix.
The check for (prim_channels > 2) before calling dca_downmix made these
cases unreachable, but now 2.1 layouts will go through the downmix code.
Having dual mono, Lt/Rt and sum-difference layouts print errors when
regular Stereo doesn't seems pointless.

Signed-off-by: Anton Khirnov <anton@khirnov.net>
2013-11-28 22:02:53 +01:00
Tim Walker aaa44d0299 dca: support mixing LFE in dca_downmix.
Embedded downmix coefficients can use this.

Signed-off-by: Anton Khirnov <anton@khirnov.net>
2013-11-28 22:02:53 +01:00
Tim Walker 44b17d794a dca: extract core substream's embedded downmix coeffcient codes, if present.
As per ETSI TS 102 114 V1.4.1 specification.

Signed-off-by: Anton Khirnov <anton@khirnov.net>
2013-11-28 22:02:53 +01:00
Tim Walker 27245b4e1b dca: remove embedded downmix coefficient extraction.
It was based on an old, seemingly incorrect specification, so default
coefficients were always used anyway.

Signed-off-by: Anton Khirnov <anton@khirnov.net>
2013-11-28 22:02:50 +01:00
Tim Walker b6d5e6aa10 dca: convert dca_default_coeffs to float.
Easier to read, modify, and avoids relying on an outdated table.

Signed-off-by: Anton Khirnov <anton@khirnov.net>
2013-11-28 21:38:22 +01:00
Tim Walker 25609b63d2 dcadec: store the stereo downmix coefficients as float in the DCAContext.
The 7-bit codes previously used are absent from the ETSI 102 114 V1.4.1 spec.

Signed-off-by: Anton Khirnov <anton@khirnov.net>
2013-11-28 21:35:22 +01:00
Tim Walker 89de5157b1 dcadec: implement request_channel_layout.
Signed-off-by: Anton Khirnov <anton@khirnov.net>
2013-11-28 21:10:29 +01:00