Commit Graph

168 Commits

Author SHA1 Message Date
Diego Biurrun cc8163e1a3 avcodec: more correct printf specifiers 2014-03-22 14:08:20 +01:00
Diego Biurrun b2bed9325d cosmetics: Group .name and .long_name together in codec/format declarations 2013-10-03 23:32:01 +02:00
Martin Storsjö 59480abce7 alac: Do bounds checking of lpc_order read from the bitstream
In lpc_prediction(), we write up to array element 'lpc_order' in
an array allocated to hold 'max_samples_per_frame' elements.

Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
Signed-off-by: Martin Storsjö <martin@martin.st>
2013-09-29 19:57:10 +03:00
Martin Storsjö 35cbc98b72 alac: Check that the channels fit at the given offset
The code tries to decode a number of channels at the
offset given by the ff_alac_channel_layout_offsets table.
Even if the number of channels decoded so far doesn't
exceed the total number of channels, we need to check that
we actually can decode that number of channels at this offset
as well.

Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
Signed-off-by: Martin Storsjö <martin@martin.st>
2013-09-03 22:57:52 +03:00
Martin Storsjö f7c5883126 alac: Limit max_samples_per_frame
Otherwise buffer size calculations in allocate_buffers could
overflow later, making the code think a large enough buffer
actually was allocated.

Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
Signed-off-by: Martin Storsjö <martin@martin.st>
2013-09-03 22:56:36 +03:00
Diego Biurrun 6d97484d72 avcodec: av_log_ask_for_sample() ---> avpriv_request_sample() 2013-03-13 21:20:12 +01:00
Anton Khirnov 759001c534 lavc decoders: work with refcounted frames. 2013-03-08 07:38:30 +01:00
Justin Ruggles 5cd597f22f alac: decode directly to the user-provided AVFrame 2013-02-12 12:21:21 -05:00
Justin Ruggles 68a04b0cce alacdec: do not be too strict about the extradata size
Sometimes the extradata has duplicate atoms, but that shouldn't prevent
decoding. Just ensure that it is at least 36 bytes as a sanity check.

CC: libav-stable@libav.org
2012-12-22 12:18:41 -05:00
Justin Ruggles 5e1bbb8c7e alacenc: add support for multi-channel encoding 2012-12-05 16:13:37 -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
Justin Ruggles 46a86c6194 alacdec: set bits_per_raw_sample 2012-10-21 23:54:51 -04:00
Anton Khirnov 36ef5369ee Replace all CODEC_ID_* with AV_CODEC_ID_* 2012-08-07 16:00:24 +02:00
Justin Ruggles 81f548de57 alac: check for truncated packets
This will give a clearer error message when the error is caused by a
truncated packet.
2012-07-27 13:52:20 -04:00
Justin Ruggles fb57e913e1 alac: reverse lpc coeff order, simplify filter
Reversing the lpc coefficient order simplifies indexing in the filter.
2012-07-27 13:52:19 -04:00
Justin Ruggles 4cd22b7738 alac: fix channel pointer assignment for 24 and 32-bit
Needs to be done separately for each element.
2012-07-19 20:14:29 -04:00
Justin Ruggles eeb55f5f2f alac: cosmetics: general pretty-printing and comment clean up 2012-07-19 13:26:48 -04:00
Justin Ruggles f3e5a7844b alac: calculate buffer size outside the loop in allocate_buffers() 2012-07-19 13:26:48 -04:00
Justin Ruggles bae83f2c74 alac: change some data types to plain int 2012-07-19 13:26:48 -04:00
Justin Ruggles 2aebac6918 alac: cosmetics: rename some variables and function names 2012-07-19 13:26:48 -04:00
Andrew D'Addesio 1b3ef155d7 alac: multi-channel decoding support
Signed-off-by: Justin Ruggles <justin.ruggles@gmail.com>
2012-07-19 13:26:48 -04:00
Justin Ruggles 81c9e2e6d0 alac: split element parsing into a separate function
This will make multi-channel implementation simpler.
Based partially on a patch by Andrew D'Addesio <modchipv12@gmail.com>.
2012-07-19 13:26:48 -04:00
Justin Ruggles cd632619d9 alac: support a read sample size of up to 32
Use get_bits_long() in decode_scalar().
Use unsigned int for decoded value.
2012-07-19 13:26:48 -04:00
Justin Ruggles 73dc0db486 alac: output in planar sample format
Avoids unneeded interleaving and allows for reusing the AVFrame output buffer
as the internal buffer for 24-bit and 32-bit sample size.
2012-07-19 13:26:48 -04:00
Justin Ruggles 6482bd8831 alac: add 32-bit decoding support 2012-07-19 13:26:48 -04:00
Andrew D'Addesio 6cda74c155 alac: simplify channel interleaving
Signed-off-by: Justin Ruggles <justin.ruggles@gmail.com>
2012-07-19 13:26:48 -04:00
Justin Ruggles 5138ff143f alac: use AVPacket fields directly in alac_decode_frame() 2012-07-19 13:26:47 -04:00
Justin Ruggles 7a206eb32f alac: fix check for valid max_samples_per_frame 2012-07-19 13:26:47 -04:00
Justin Ruggles 1193d3fedd alac: use get_sbits() to read LPC coefficients instead of casting 2012-07-19 13:26:47 -04:00
Justin Ruggles 7a50ec6799 alac: move the current samples per frame to the ALACContext
This will simplify the multi-channel implementation.
2012-07-19 13:26:47 -04:00
Justin Ruggles 46043962ea alac: avoid using a double-negative when checking if the frame is compressed 2012-07-19 13:26:47 -04:00
Justin Ruggles 9a6c528e08 alac: factor out output_size check in predictor_decompress_fir_adapt() 2012-07-19 13:26:47 -04:00
Justin Ruggles ebd4c3add1 alac: factor out loading of next decoded sample in LPC prediction 2012-07-19 13:26:47 -04:00
Justin Ruggles a4ecd41442 alac: use index into buffer_out instead of incrementing the pointer 2012-07-19 13:26:47 -04:00
Justin Ruggles f2515cd629 alac: simplify lpc coefficient adaptation 2012-07-19 13:26:47 -04:00
Justin Ruggles abc4376b31 alac: reduce the number of local variables needed in lpc prediction 2012-07-19 13:26:47 -04:00
Justin Ruggles 01880d287b alac: simplify 1st order prediction and reading of warm-up samples 2012-07-19 13:26:46 -04:00
Justin Ruggles d0c0bf0d3e alac: cosmetics: reindent after last commit 2012-07-19 13:26:46 -04:00
Justin Ruggles 79def4c523 alac: remove unneeded conditionals in predictor_decompress_fir_adapt() 2012-07-19 13:26:46 -04:00
Justin Ruggles 4bcd637dcb alac: use sizeof() instead of hardcoded data sizes 2012-07-19 13:26:46 -04:00
Justin Ruggles 91620a04f1 alac: make block_size signed
It does not need to be unsigned.
2012-07-19 13:26:46 -04:00
Justin Ruggles 2fc24b3273 alac: remove a duplicate local variable 2012-07-19 13:26:46 -04:00
Justin Ruggles 5177413d20 alac: conditionally set sign_modifier to 1
It is already unconditionally set to 0 prior to this, so we can modify it
only when needed.
2012-07-19 13:26:46 -04:00
Justin Ruggles 7e6593e977 alac: eliminate 2 unneeded local variables in bastardized_rice_decompress()
x_modified is just unnecessary, and final_val can be removed by simplifying
the unsigned-to-signed conversion.
2012-07-19 13:26:46 -04:00
Justin Ruggles 6fd8a28b59 alac: adjust conditions for updating entropy decoder history
avoids some unnecessary arithmetic in certain situations
2012-07-19 13:26:46 -04:00
Justin Ruggles a06fdadd97 alac: cosmetics: reindent after last commit 2012-07-19 13:26:46 -04:00
Justin Ruggles d9837434a9 alac: limit the rice param before passing to decode_scalar()
reduces the number of parameters to decode_scalar() and slightly simplifies
the code
2012-07-19 13:26:45 -04:00
Justin Ruggles 6e91f62256 alac: reduce the number of parameters to bastardized_rice_decompress()
Use the ALACContext fields directly instead.
2012-07-19 13:26:45 -04:00
Justin Ruggles 836e8b9ba0 alac: cosmetics: rename some ALACContext parameters 2012-07-19 13:26:45 -04:00