Commit Graph

13 Commits

Author SHA1 Message Date
James Almer
5cd2169344 wavpackenc: use put_sbits()
Reviewed-by: Michael Niedermayer <michaelni@gmx.at>
Signed-off-by: James Almer <jamrial@gmail.com>
2015-04-18 18:07:54 -03:00
Michael Niedermayer
6e95c67330 avcodec/wavpackenc: remove unneeded L suffixes
Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-02-02 13:34:31 +01:00
Christophe Gisquet
4adad5a19a wavpackenc: reset trailer info on block encoding
In some cases, in particular if several blocks are needed because of
the channel layout (e.g. 2.1), the information used to write the
trailing bits terminating the sample data was not reset.

This would cause potential desync on the decoder, although decoded
samples were actually mostly fine.

Fixes ticket #3879.
2014-08-22 18:44:16 +00:00
Christophe Gisquet
e32eddaa51 wavpackenc: make assert more thorough
It was only validating that normal data wasn't filling the buffer.
However, extra data may be written afterwards.

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-08-22 12:30:10 +02:00
Christophe Gisquet
ddad093972 wavpackenc: fix number of samples per block
Currently, the encoder will try to reduce it down to 150000, but the
decoder will complain starting at 131072 (WV_MAX_SAMPLES). Therefore,
change the loop limit.

Fixes ticket #3881.

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-08-22 12:18:08 +02:00
Christophe Gisquet
4a5cc34b46 wavpackenc: assert on too small buffer
bytestream2_* will not cause buffer overflow, but in that case, this means
the allocation would be incorrect and the encoded result invalid. Therefore,
assert no overflow occurred.

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-08-21 17:59:06 +02:00
Christophe Gisquet
2ba58bec20 wavpackenc: proper buffer allocation
The allocation didn't account for headers, that can be easily 79 bytes.
As a result, buffers allocated for a few samples (e.g. 5 in the original
bug) could be undersized.

Fixed ticket #2881.

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-08-19 18:04:25 +02:00
Michael Niedermayer
e706fe7640 avcodec/wavpackenc: Fix log2sample() result value
Found-by: CSA
Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-08-02 18:15:12 +02:00
Michael Niedermayer
40cbad9ff7 avcodec/wavpackenc: fix () in macros
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-06-20 21:36:17 +02:00
Michael Niedermayer
2e9b79fc00 avcodec/wavpackenc: fix uninitialized ret
Fixes CID1108609

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-10-20 02:39:32 +02:00
Paul B Mahol
02eb15a6c1 wavpackenc: do not copy samples if they are not available
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2013-08-17 22:25:49 +00:00
Michael Niedermayer
bfbe07670b wavpackenc: simplify "sign = ((sample) < 0) ? 1 : 0;"
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-08-14 23:20:25 +02:00
Paul B Mahol
93f4277714 WavPack encoder
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2013-08-14 14:04:05 +00:00