Commit Graph

99 Commits

Author SHA1 Message Date
Anton Khirnov
78f75b6fa4 wavpack: extract sample rate from the bitstream
This way we don't require the caller to parse the block header. It also
allows the sample rate to change mid-stream.
2013-05-28 17:46:03 +02:00
Anton Khirnov
9b6f47c448 matroskadec: export full wavpack blocks.
This allows us to get rid of demuxer-specific hacks in the decoder and
will allow streamcopy from matroska once we have a wavpack muxer.
2013-05-28 08:14:35 +02:00
Anton Khirnov
5074f4545c wavpack demuxer: export full wavpack blocks.
Currently the demuxer shaves the blocks and exports only the
information that is useful to the decoder.

Exporting the blocks just as they are stored is simpler to understand
and will make remuxing wavpack easier.
2013-05-28 08:14:05 +02:00
Anton Khirnov
72dee5f40b wavpack: don't set sample format in init.
We don't know whether it will be float until we look at the data.
2013-05-28 08:04:07 +02:00
Anton Khirnov
35596bd4f4 wavpack: remove a useless parameter from wavpack_decode_block().
The decoder always returns output if an error does not occur.
2013-05-28 08:03:57 +02:00
Anton Khirnov
d1bec4be22 wavpack: return an error on 0-sized blocks
Such blocks are not valid.
2013-05-28 08:03:37 +02:00
Anton Khirnov
1d177200ce wavpack: remove a useless check.
Number of samples in the first block is checked to be strictly positive
earlier in wavpack_decode_frame() and number of samples in all the other
blocks is checked to be equal to the first one.
2013-05-28 08:03:24 +02:00
Anton Khirnov
0f3a0b24dd wavpack: add an error message to a failure. 2013-05-28 08:03:13 +02:00
Anton Khirnov
474fb0c9d9 wavpack: return 0 instead of samples count from decoding functions
The caller never cares about the number of decoded samples, so this only
confuses the reader.
2013-05-28 08:03:02 +02:00
Anton Khirnov
528daa3990 wavpack: switch to planar output
This simplifies the code and makes it faster.
2013-05-28 08:01:30 +02:00
Anton Khirnov
a7ec3a9a4e wavpack: drop redundant if/else blocks 2013-05-28 08:01:16 +02:00
Anton Khirnov
7b44c99180 wavpack: remove the subframes codec cap
The decoder always consumes full packets.
2013-05-28 08:01:08 +02:00
Luca Barbato
fd06291239 wavpack: check packet size early
Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
2013-05-22 22:02:57 +02:00
Luca Barbato
3f0b6d7a62 wavpack: use bytestream2 in wavpack_decode_block
Prevent most out of buffer reads.

Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
2013-05-22 22:02:55 +02:00
Luca Barbato
ed50673066 wavpack: validate samples size parsed in wavpack_decode_block
Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
2013-05-18 20:39:32 +02:00
Luca Barbato
8c34558131 wavpack: return meaningful errors
And forward those that were already meaningful.
2013-05-18 20:37:18 +02:00
Luca Barbato
0f689a3d97 wavpack: K&R formatting cosmetics
Signed-off-by: Diego Biurrun <diego@biurrun.de>
2013-05-18 17:19:43 +02:00
Anton Khirnov
759001c534 lavc decoders: work with refcounted frames. 2013-03-08 07:38:30 +01:00
Justin Ruggles
9873d71f31 wavpack: decode directly to the user-provided AVFrame 2013-02-12 12:22:39 -05:00
Anton Khirnov
594d4d5df3 lavc: add a wrapper for AVCodecContext.get_buffer().
It will be useful in the upcoming transition to refcounted AVFrames.
2012-12-04 21:41:59 +01:00
Justin Ruggles
a903f8f087 Include libavutil/channel_layout.h instead of libavutil/audioconvert.h
Also reorder some other #include when applicable.
2012-11-11 13:35:12 -05:00
Anton Khirnov
36ef5369ee Replace all CODEC_ID_* with AV_CODEC_ID_* 2012-08-07 16:00:24 +02:00
Hendrik Leppkes
37c6ad2345 wavpack: set bits_per_raw_sample for S32 samples to properly identify 24-bit
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Signed-off-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
2012-07-23 11:33:58 -04:00
Derek Buitenhuis
f604eab30a wavpack: Fix an integer overflow
Integer Overflow Checker detected an integer
overflow while FATE was running.

See: http://fate.libav.org/x86_64-linux-ioc/

Signed-off-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
Signed-off-by: Kostya Shishkov <kostya.shishkov@gmail.com>
2012-03-02 08:26:36 +01:00
Derek Buitenhuis
480b133e6f wavpack: Don't shift minclip/maxclip
Since we are clipping before we shift the values to
16 or 32 bits, we should not shift the min/max clip
values to compensate.

Fixes 8 and 24 bit lossy decoding.

Signed-off-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
Signed-off-by: Anton Khirnov <anton@khirnov.net>
2012-02-23 20:43:39 +01:00
Justin Ruggles
9d7cee50aa wavpack: add needed braces for 2 statements inside an if block 2012-02-10 20:27:55 -05:00
Paul B Mahol
c388558d31 wavpack: allow user to disable CRC checking
Signed-off-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Justin Ruggles <justin.ruggles@gmail.com>
2012-02-10 15:54:08 -05:00
Kostya Shishkov
e6e7bfc11e wavpack: fix clipping for 32-bit lossy mode
Reference decoder clips data before shifting it to final range and also
forces 32-bit lossy mode to be actually 24-bit lossy mode in order to be
able to perform proper clipping.
2012-01-15 15:27:55 +01:00
Justin Ruggles
3a1867deac wavpack: fix typos in previous cosmetic clean-up commit 2012-01-02 08:54:30 -05:00
Justin Ruggles
513c238fa9 wavpack: cosmetics: K&R pretty-printing 2012-01-02 08:52:59 -05:00
Hendrik Leppkes
14165fe125 wavpack: determine sample_fmt before requesting a buffer
Signed-off-by: Justin Ruggles <justin.ruggles@gmail.com>
2012-01-01 23:24:15 -05:00
Diego Biurrun
aaf47bcde7 Drop ALT_ prefix from BITSTREAM_READER_LE name.
The prefix is a historic remnant that probably meant "alternative".
Now that the A32 bitstream reader has been dropped it makes no sense anymore.
2011-12-22 16:51:23 +01:00
Derek Buitenhuis
bb9747c8ee wavpack: Fix 32-bit clipping
In the case that (frame_flags & 0x03) == 3, hybrid_maxclip
may have had a signed integer overflow.

Signed-off-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
Signed-off-by: Anton Khirnov <anton@khirnov.net>
2011-12-16 20:55:53 +01:00
Derek Buitenhuis
365e1ec26d wavpack: Clip samples after shifting
It doesn't make much sense to clip pre-shift,
nor is it correct for proper decoding.

Signed-off-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
Signed-off-by: Anton Khirnov <anton@khirnov.net>
2011-12-16 20:55:46 +01:00
Derek Buitenhuis
a548b6cbfc wavpack: Properly clip samples during lossy decode
When decoding lossy WavPack samples, they are supposed
to be clipped, in order to be decoded correctly.

Signed-off-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
Signed-off-by: Ronald S. Bultje <rsbultje@gmail.com>
2011-12-03 15:32:21 -08:00
Justin Ruggles
0eea212943 Add avcodec_decode_audio4().
Deprecate avcodec_decode_audio3().
Implement audio support in avcodec_default_get_buffer().
Implement the new audio decoder API in all audio decoders.
2011-12-02 17:40:40 -05:00
Justin Ruggles
d2604f9260 wavpack: calculate bpp using av_get_bytes_per_sample() 2011-10-23 11:35:46 -04:00
Laurent Aimar
2c6cf13940 wavpack: Reset internal state on corrupted blocks
wavpack_decode_block() supposes that it is called back with the exact
same buffer unless it has returned with an error. With multi-channels
files, wavpack_decode_frame() was breaking this assumption.

Signed-off-by: Janne Grunau <janne-libav@jannau.net>
2011-10-07 16:25:31 +02:00
Laurent Aimar
8bfea4ab4e Fixed segfault with wavpack decoder on corrupted decorrelation terms sub-blocks.
Signed-off-by: Martin Storsjö <martin@martin.st>
2011-09-10 18:58:57 +03:00
Alex Converse
dba2b63a98 wavpack: Check error codes rather than working around error conditions. 2011-09-08 11:02:43 -07:00
Laurent Aimar
55354b7de2 Fixed invalid access in wavpack decoder on corrupted bitstream.
Signed-off-by: Martin Storsjö <martin@martin.st>
2011-09-08 12:04:06 +03:00
Laurent Aimar
0aedab0340 Fixed invalid writes in wavpack decoder on corrupted bitstreams.
Signed-off-by: Martin Storsjö <martin@martin.st>
2011-09-08 12:00:13 +03:00
Laurent Aimar
beefafda63 Fixed invalid access in wavpack decoder on corrupted extra bits sub-blocks.
Signed-off-by: Martin Storsjö <martin@martin.st>
2011-09-08 11:57:13 +03:00
Kostya Shishkov
bcd4aa8bec wavpack: fix wrong return value in wavpack_decode_block()
This function should return number of samples decoded, not number of bytes
decoded.
Spotted by Uoti Urpala.

Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2011-09-05 12:44:26 +02:00
Kostya Shishkov
9bc4e21a9b wavpack: use context reset in appropriate places
This fixes improper flushing in the cases when the same frame is decoded in
several iterations (for being too large to fit into output buffer) and flush is
called mid-decoding and it also resets context in case of decoding errors.

Signed-off-by: Anton Khirnov <anton@khirnov.net>
2011-09-05 11:18:27 +02:00
Kostya Shishkov
4ba8c521b1 WavPack decoder: implement flush function
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2011-08-21 12:54:34 +02:00
Anton Khirnov
ec6402b7c5 lavc: use designated initialisers for all codecs.
It's more readable and less prone to breakage.
2011-07-29 08:42:34 +02: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
Reinhard Tartler
737eb5976f Merge libavcore into libavutil
It is pretty hopeless that other considerable projects will adopt
libavutil alone in other projects. Projects that need small footprint
are better off with more specialized libraries such as gnulib or rather
just copy the necessary parts that they need. With this in mind, nobody
is helped by having libavutil and libavcore split. In order to ease
maintenance inside and around FFmpeg and to reduce confusion where to
put common code, avcore's functionality is merged (back) to avutil.

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2011-02-15 16:18:21 +01:00
Anton Khirnov
c2fcd0a7a4 Replace remaining occurrences of deprecated CH_* with AV_CH_*
Signed-off-by: Ronald S. Bultje <rsbultje@gmail.com>
2011-02-06 08:26:12 -05:00