summaryrefslogtreecommitdiff
path: root/libavcodec/mlpenc.c
Commit message (Collapse)AuthorAgeFilesLines
* avcodec: add AVCodecContext.frame_num as 64 bit variant to frame_numberMarton Balint2023-02-131-3/+3
| | | | | | | | | | Frame counters can overflow relatively easily (INT_MAX number of frames is slightly more than 1 year for 60 fps content), so make sure we use 64 bit values for them. Also deprecate the old 32 bit frame_number attribute. Signed-off-by: Marton Balint <cus@passwd.hu>
* avcodec/codec_internal: Avoid deprecation warnings for channel_layoutsAndreas Rheinhardt2022-09-281-6/+2
| | | | | | | | | | | | | | | | | | AVCodec.channel_layouts is deprecated and Clang (unlike GCC) warns when setting this field in a codec definition. Fortunately, Clang (unlike GCC) allows to use FF_DISABLE_DEPRECATION_WARNINGS inside a definition (of an FFCodec), so that one can create simple macros to set AVCodec.channel_layouts that also suppress deprecation warnings for Clang. (Notice that some of the codec definitions were already inside FF_DISABLE/ENABLE_DEPRECATION_WARNINGS (that were not guarded by FF_API_OLD_CHANNEL_LAYOUT); these have been removed. Also notice that setting AVCodec.channel_layouts was not guarded by FF_API_OLD_CHANNEL_LAYOUT either, so testing disabling it it without removing all the codeblocks would not have worked.) Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/mlpenc: Remove dead channel layout checksAndreas Rheinhardt2022-09-221-6/+5
| | | | | | | | ff_encode_preinit() has already checked that the channel layout is equivalent to one of the layouts in AVCodec.ch_layouts. Reviewed-by: Paul B Mahol <onemda@gmail.com> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/mlpenc: Simplify channel layout comparisonsAndreas Rheinhardt2022-09-221-16/+14
| | | | | | | | | | | | | These encoders have AVCodec.ch_layouts set, so ff_encode_preinit() has already checked that the used channel layout is equivalent to one of these native layouts. Therefore one can simply compare the channel masks (with the added complication that one has to use av_channel_layout_subset() to get it, because the channel layout is not guaranteed to have AV_CHANNEL_ORDER_NATIVE). Reviewed-by: Paul B Mahol <onemda@gmail.com> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/mlpenc: Fix channel layoutsAndreas Rheinhardt2022-09-221-5/+5
| | | | | | | | The encoder actually creates files with side channels, not back channels. See thd_layout in mlp_parse.h. Reviewed-by: Paul B Mahol <onemda@gmail.com> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/mlpenc: analyze only if there are samplesPaul B Mahol2022-09-211-1/+2
|
* avcodec/mlpenc: improve encoding of stereo TrueHD and add mono supportPaul B Mahol2022-09-181-19/+53
|
* avcodec/mlpenc: rename some variables to better alternativesPaul B Mahol2022-09-181-8/+8
|
* avcodec/codec_internal: Add macro to set AVCodec.long_nameAndreas Rheinhardt2022-09-031-2/+2
| | | | | | | | It reduces typing: Before this patch, there were 105 codecs whose long_name-definition exceeded the 80 char line length limit. Now there are only nine of them. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec: Make ff_alloc_packet() based encoders accept user buffersAndreas Rheinhardt2022-08-271-2/+5
| | | | | | | | | | | | | | | | | | Up until now, these encoders received non-refcounted packets (whose data was owned by the corresponding AVCodecContext) from ff_alloc_packet(); these packets were made refcounted lateron by av_packet_make_refcounted() generically. This commit makes these encoders accept user-supplied buffers by replacing av_packet_make_refcounted() with an equivalent function that is based upon get_encode_buffer(). (I am pretty certain that one can also set the flag for mpegvideo- based encoders, but I want to double-check this later. What is certain is that it reallocates the buffer owned by the AVCodecContext which should maybe be moved to encode.c, so that proresenc_kostya.c and ttaenc.c can make use of it, too.) Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec: Constify frame->data pointers for encoders where possibleAndreas Rheinhardt2022-08-051-2/+2
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec: Make init-threadsafety the defaultAndreas Rheinhardt2022-07-181-2/+2
| | | | | | | | | | | and remove FF_CODEC_CAP_INIT_THREADSAFE All our native codecs are already init-threadsafe (only wrappers for external libraries and hwaccels are typically not marked as init-threadsafe yet), so it is only natural for this to also be the default state. Reviewed-by: Anton Khirnov <anton@khirnov.net> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/mlpenc: fix encoding after receiving last framePaul B Mahol2022-04-131-4/+5
| | | | | This happened when major header needed to be written after input EOF.
* avcodec/mlpenc: simplify calling functionPaul B Mahol2022-04-121-4/+1
|
* avcodec/mlpenc: use FFMAX()Paul B Mahol2022-04-121-2/+1
|
* avcodec/mlpenc: improve handling of last samplesPaul B Mahol2022-04-121-7/+12
|
* avcodec/codec_internal: Use union for FFCodec decode/encode callbacksAndreas Rheinhardt2022-04-051-2/+2
| | | | | | | | | | | This is possible, because every given FFCodec has to implement exactly one of these. Doing so decreases sizeof(FFCodec) and therefore decreases the size of the binary. Notice that in case of position-independent code the decrease is in .data.rel.ro, so that this translates to decreased memory consumption. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/codec_internal: Add FFCodec, hide internal part of AVCodecAndreas Rheinhardt2022-03-211-20/+20
| | | | | | | | | | | | | | | | Up until now, codec.h contains both public and private parts of AVCodec. This exposes the internals of AVCodec to users and leads them into the temptation of actually using them and forces us to forward-declare structures and types that users can't use at all. This commit changes this by adding a new structure FFCodec to codec_internal.h that extends AVCodec, i.e. contains the public AVCodec as first member; the private fields of AVCodec are moved to this structure, leaving codec.h clean. Reviewed-by: Anton Khirnov <anton@khirnov.net> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/internal: Move FF_CODEC_CAP_* to a new header codec_internal.hAndreas Rheinhardt2022-03-211-1/+1
| | | | | | | | | | Also move FF_CODEC_TAGS_END as well as struct AVCodecDefault. This reduces the amount of files that have to include internal.h (which comes with quite a lot of indirect inclusions), as e.g. most encoders don't need it. It is furthemore in preparation for moving the private part of AVCodec out of the public codec.h. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* configure: Use a separate config_components.h header for $ALL_COMPONENTSMartin Storsjö2022-03-161-0/+2
| | | | | | | | This avoids unnecessary rebuilds of most source files if only the list of enabled components has changed, but not the other properties of the build, set in config.h. Signed-off-by: Martin Storsjö <martin@martin.st>
* mlp: convert to new channel layout APIAnton Khirnov2022-03-151-52/+54
| | | | Signed-off-by: James Almer <jamrial@gmail.com>
* 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>