summaryrefslogtreecommitdiff
path: root/libavcodec/mlpenc.c
Commit message (Collapse)AuthorAgeFilesLines
* avcodec/thd: fix special stereo supportPaul B Mahol2021-12-181-1/+1
|
* avcodec/mlpenc: Set AV_PKT_FLAG_KEY manuallyAndreas Rheinhardt2021-09-281-0/+1
| | | | | | | | | | TrueHD/MLP is one of the audio formats with keyframes. Currently, the generic encoding code just sets the keyframe flag for all returned packets, yet this is wrong for these encoders and will be changed in a future commit. So set the flag here for those packets that ought to have it. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/mlpenc: fix encoding stereo single stream in TrueHDPaul B Mahol2021-09-231-1/+1
|
* avcodec/mlpenc: Fix mixed declarations and code warningAndreas Rheinhardt2021-09-091-2/+1
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/mlpenc: simplify some complicated expressions morePaul B Mahol2021-09-071-9/+2
|
* avcodec/mlpenc: simplify strange pointer initializationsPaul B Mahol2021-09-071-12/+4
|
* avcodec/mlpenc: remove convoluted incomplete multiple substreams support codePaul B Mahol2021-09-071-205/+180
| | | | | It is very hard to follow data structures indirections in current code, so just remove it for now.
* avcodec/mlpenc: use variables local to for loopsPaul B Mahol2021-09-071-142/+81
|
* avcodec/mlp: move sync defines to common headerPaul B Mahol2021-09-051-3/+0
|
* avcodec/mlpenc: remove frame_size array from private contextPaul B Mahol2021-09-051-23/+7
| | | | | | | It is supposed to be used with different bit depth and/or sample rates per each substream, but such currently not implemented feature is not important and current state causes problems when implementing variable restart interval to fix decoding with sample rates not multiple of 40.
* avcodec/mlpenc: stop using hardcoded valuePaul B Mahol2021-09-051-1/+1
|
* avcodec/mlpenc: use av_shrink_packet()Paul B Mahol2021-09-051-1/+2
|
* avcodec/mlpenc: remove no more needed gotoPaul B Mahol2021-09-051-5/+0
|
* avcodec/mlpenc: fix removal of packet timestamp/size from queuePaul B Mahol2021-09-051-10/+3
|
* avcodec/mlpenc: remove not needed buf_size checksPaul B Mahol2021-09-051-5/+0
|
* avcodec/mlpenc: fix indentationPaul B Mahol2021-09-051-29/+28
|
* avcodec/mlpenc: stop returning packets with no dataPaul B Mahol2021-09-051-5/+11
|
* avcodec/mlpenc: simplify compare_best_offset()Paul B Mahol2021-09-051-4/+1
|
* avcodec/mlpenc: use ff_ctz()Paul B Mahol2021-09-051-4/+3
|
* avcodec/mlpenc: remove unused itemPaul B Mahol2021-09-051-2/+0
|
* avcodec/mlpenc: remove log messages when allocation fails at initPaul B Mahol2021-09-041-24/+6
|
* avcodec/mlpenc: allocate filter buffers once at initPaul B Mahol2021-09-041-24/+19
|
* avcodec/mlpenc: simplify allocations in mlp_encode_init()Paul B Mahol2021-09-041-20/+13
|
* avcodec/mlpenc: add support for 24bit encodingPaul B Mahol2021-09-021-2/+2
|
* avcodec/mlpenc: fix encoding last samples when not within full intervalPaul B Mahol2021-08-311-37/+47
| | | | Also implement shorten_by in bitstream.
* avcodec/avcodec: Stop including channel_layout.h in avcodec.hAndreas Rheinhardt2021-07-221-0/+1
| | | | | | Also include channel_layout.h directly wherever used. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/encode: Always use intermediate buffer in ff_alloc_packet2()Andreas Rheinhardt2021-06-081-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | Up until now, ff_alloc_packet2() has a min_size parameter: It is supposed to be a lower bound on the final size of the packet to allocate. If it is not too far from the upper bound (namely, if it is at least half the upper bound), then ff_alloc_packet2() already allocates the final, already refcounted packet; if it is not, then the packet is not refcounted and its data only points to a buffer owned by the AVCodecContext (in this case, the packet will be made refcounted in encode_simple_internal() in libavcodec/encode.c). The goal of this was to avoid data copies and intermediate buffers if one has a precise lower bound. Yet those encoders for which precise lower bounds exist have recently been switched to ff_get_encode_buffer() (which automatically allocates final buffers), leaving only two encoders to actually set the min_size to something else than zero (namely aliaspixenc and hapenc). Both of these encoders use a very low lower bound that is not helpful in any nontrivial case. This commit therefore removes the min_size parameter as well as the codepath in ff_alloc_packet2() for the allocation of final buffers. Furthermore, the function has been renamed to ff_alloc_packet() and moved to encode.h alongside ff_get_encode_buffer(). Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/mlpenc: Make encoders init-threadsafeAndreas Rheinhardt2021-05-021-17/+19
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avcodec/mlpenc: Add const where appropriateAndreas Rheinhardt2021-05-021-10/+12
| | | | | | | | | | | | The MLP/TrueHD encoder uses pointers to non-const to access several static objects that are only initialized at runtime and are therefore not declared as const. This does not result in compiler warnings, but it is fragile, as these objects are really not to be modified as they are not owned by any encoder instance. Therefore this commit adds const to the pointed to type of the pointers used to access them after their initialization. One object has even been made const. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avcodec: Constify AVCodecsAndreas Rheinhardt2021-04-271-2/+2
| | | | | | | | | | Given that the AVCodec.next pointer has now been removed, most of the AVCodecs are not modified at all any more and can therefore be made const (as this patch does); the only exceptions are the very few codecs for external libraries that have a init_static_data callback. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com> Signed-off-by: James Almer <jamrial@gmail.com>
* Avoid intermediate bitcount for number of bytes in PutBitContextAndreas Rheinhardt2021-03-301-4/+4
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avcodec/mlpenc: Avoid redundant temporary PutBitContextAndreas Rheinhardt2021-03-301-4/+4
| | | | | | | We are already word-aligned here, so one can just as well flush the main PutBitContext. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avcodec/mlpenc: Simplify finding best codebookAndreas Rheinhardt2020-12-311-24/+10
| | | | | | | | | | | | Finding the best codebook involves comparing different paths, where each path is a sequence of several decisions (namely which codebook to use). Up until now, these sequence was encoded in a NUL-terminated string and the actual decisions were encoded as ’\0'..'\3' (which encoded 0..3). This commit modifies this to actually encode it via 0..3 by switching away from a C-string to a simple array with an explicit length field. Reviewed-by: Lynne <dev@lynne.ee> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avcodec/mlpenc: Fix memleak upon init failureAndreas Rheinhardt2020-09-151-0/+2
| | | | | | | | | If an error happens during init after an allocation has succeeded, the already allocated data leaked up until now. Fix this by setting the FF_CODEC_CAP_INIT_CLEANUP flag. Reviewed-by: Paul B Mahol <onemda@gmail.com> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avcodec/mlpenc: free filter state buffers on allocation failureJames Almer2020-07-011-1/+2
| | | | Signed-off-by: James Almer <jamrial@gmail.com>
* avcodec/mlpenc: propagate proper error valuesJames Almer2020-07-011-9/+9
| | | | Signed-off-by: James Almer <jamrial@gmail.com>
* avcodec/mlpenc: remove delay codec capabilityJames Almer2020-07-011-5/+2
| | | | | | | | | | The encoder has no delayed packets at the end of the encoding process, so signaling this capability is unnecessary. This also fixes an assertion failure introduced in 827d6fe73d, as return values higher than 0 are not expected. Signed-off-by: James Almer <jamrial@gmail.com>
* avcodec/mlpenc: fix small memory leakPaul B Mahol2020-02-041-0/+1
|
* mlp: check huff_lsbs only when codebook is usedJai Luthra2020-02-041-0/+3
| | | | | | | When no codebook is used, huff_lsbs can be more than 24 and still decode to original values once filters are applied. Signed-off-by: Jai Luthra <me@jailuthra.in>
* mlpenc: fix some -fsanitize=integer errorsJai Luthra2020-02-041-5/+5
| | | | Signed-off-by: Jai Luthra <me@jailuthra.in>
* mlpenc: clean upJai Luthra2020-02-041-16/+13
| | | | Signed-off-by: Jai Luthra <me@jailuthra.in>
* mlpenc: improve lpc filteringJai Luthra2020-02-041-13/+12
| | | | | | | | | * fix a possible memory leak (apply_filter returned before freeing) * use apply_filters in process_major_frame * revert back to checking bounds with 24 bitdepth, as huff offset takes care of it Signed-off-by: Jai Luthra <me@jailuthra.in>
* mlpenc: prevent negative lsb_bits lshiftJai Luthra2020-02-041-4/+7
| | | | | | Fixes Coverity CID 1396239. Signed-off-by: Jai Luthra <me@jailuthra.in>
* mlpenc: fix huff offset calculationJai Luthra2020-02-041-5/+1
| | | | | | | huff offset wasn't always within the bounds before, which lead to corrupt encoding that didn't always trigger lossless check failures Signed-off-by: Jai Luthra <me@jailuthra.in>
* mlpenc: fix lossless check error in number_sbitsJai Luthra2020-02-041-1/+1
| | | | | | we need two bits instead of one bit to represent -1 in bitstream Signed-off-by: Jai Luthra <me@jailuthra.in>
* lavc/mlpenc: remove the redundant condition checkJun Zhao2019-05-121-4/+2
| | | | | | remove the redundant condition check for 'frame' Signed-off-by: Jun Zhao <barryjzhao@tencent.com>
* mlpenc: Working MLP/TrueHD encoderJai Luthra2016-09-171-0/+2416
* Multichannel support for TrueHD is experimental There should be downmix substreams present for 2+ channel bitstreams, but ffmpeg decoder doesn't need it. Will add support for this soon. * There might be lossless check failures on LFE channels * 32-bit sample support has been removed for now, will add it later While testing, some samples gave lossless check failures when enforcing s32. Probably this will also get solved with the LFE issues. Signed-off-by: Jai Luthra <me@jailuthra.in>