summaryrefslogtreecommitdiff
path: root/libavcodec/magicyuvenc.c
Commit message (Collapse)AuthorAge
* avcodec: Make init-threadsafety the defaultAndreas Rheinhardt2022-07-18
| | | | | | | | | | | 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/codec_internal: Use union for FFCodec decode/encode callbacksAndreas Rheinhardt2022-04-05
| | | | | | | | | | | 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-21
| | | | | | | | | | | | | | | | 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-21
| | | | | | | | | | 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>
* avcodec/magicyuvenc: Remove unused context variableAndreas Rheinhardt2022-02-23
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/magicyuvenc: Don't modify input frameAndreas Rheinhardt2022-02-23
| | | | | | | | It need not be writable at all. Instead, use temporary buffers for decorrelation. Reviewed-by: Paul B Mahol <onemda@gmail.com> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/magicyuvenc: Add const where appropriateAndreas Rheinhardt2022-02-23
| | | | | Reviewed-by: Paul B Mahol <onemda@gmail.com> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/magicyuvenc: Avoid unnecessary av_frame_clone()Andreas Rheinhardt2022-02-23
| | | | | | | | | It is unnecessary and unchecked; the intention seems to be to ensure that the frame's data is writable, but it does not provide this. This will be fixed in a latter commit. Reviewed-by: Paul B Mahol <onemda@gmail.com> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/magicyuvenc: Remove redundant pixel format checkAndreas Rheinhardt2021-10-02
| | | | | | | ff_encode_preinit() already checked the pixel format via AVCodec.pix_fmts. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/magicyuvenc: Use immediate when knownAndreas Rheinhardt2021-10-02
| | | | | | It allows the compiler to optimize the bytestream2 checks away. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/encoders: Remove redundant setting of AV_PKT_FLAG_KEYAndreas Rheinhardt2021-09-28
| | | | | | | It is now set generically for all those encoders whose corresponding AVCodecDescriptor has the AV_CODEC_PROP_INTRA_ONLY. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/encode: Always use intermediate buffer in ff_alloc_packet2()Andreas Rheinhardt2021-06-08
| | | | | | | | | | | | | | | | | | | | | | | | | | | 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/magicyuvenc: Mark encoder as init-threadsafeAndreas Rheinhardt2021-05-02
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avcodec: Constify AVCodecsAndreas Rheinhardt2021-04-27
| | | | | | | | | | 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-30
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avcodec/magicyuvenc: Use more correct cast in compare functionAndreas Rheinhardt2020-10-09
| | | | | | | | There is no need to cast const away (even if it was harmless) and to copy the object at all. Reviewed-by: Paul B Mahol <onemda@gmail.com> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avcodec/magicyuvenc: Avoid sorting Huffman table unnecessarilyAndreas Rheinhardt2020-10-09
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avcodec/magicyuvenc: Fix memleak upon init failureAndreas Rheinhardt2020-09-15
| | | | | | | | | 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: deprecate Lossless and Intra Only encoder capabilitesJames Almer2020-05-21
| | | | | | | Both are codec properties and not encoder capabilities. The relevant AVCodecDescriptor.props flags exist for this purpose. Signed-off-by: James Almer <jamrial@gmail.com>
* avcodec/magicyuvenc: mark as not more experimentalPaul B Mahol2018-06-05
| | | | Signed-off-by: Paul B Mahol <onemda@gmail.com>
* avcodec/magicyuvenc: write max huffman length and extradata tooPaul B Mahol2018-06-05
| | | | Signed-off-by: Paul B Mahol <onemda@gmail.com>
* avcodec/magicyuvenc: mark as experimentalPaul B Mahol2018-04-13
| | | | Signed-off-by: Paul B Mahol <onemda@gmail.com>
* libavcodec/magicyuvenc : fix warningMartin Vignali2017-12-16
|
* avcodec/magicyuvenc: improve compressionPaul B Mahol2017-10-29
| | | | Signed-off-by: Paul B Mahol <onemda@gmail.com>
* avcodec: add MagicYUV encoderPaul B Mahol2017-10-28
Signed-off-by: Paul B Mahol <onemda@gmail.com>