Commit Graph

23 Commits

Author SHA1 Message Date
Andreas Rheinhardt 1ea3650823 Replace all occurences of av_mallocz_array() by av_calloc()
They do the same.

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-09-20 01:03:52 +02:00
Andreas Rheinhardt 2934a4b9a5 Remove unnecessary avassert.h inclusions
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-07-22 15:02:30 +02:00
Andreas Rheinhardt 56e9e0273a avcodec/encode: Always use intermediate buffer in ff_alloc_packet2()
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>
2021-06-08 12:52:50 +02:00
Andreas Rheinhardt e44e41edce avcodec/cfhdenc: Mark encoder as init-threadsafe
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2021-05-02 05:14:42 +02:00
Andreas Rheinhardt a247ac640d avcodec: Constify AVCodecs
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>
2021-04-27 10:43:15 -03:00
Andreas Rheinhardt c81b8e04aa Avoid intermediate bitcount for number of bytes in PutBitContext
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2021-03-30 12:36:32 +02:00
Paul B Mahol 33025ab976 avcodec/cfhdenc: do not try to encode junk 2021-02-24 17:14:03 +01:00
Paul B Mahol fbfa78508b avcodec/cfhdenc: add padding to each decomposition 2021-02-24 17:14:03 +01:00
Paul B Mahol d69f4be1c6 avcodec/cfhdenc: refactor DSP code for CFHD encoder
This is needed to implement x86 SIMD.
2021-02-24 17:14:03 +01:00
Paul B Mahol 82472afe18 avcodec/cfhdenc: use pts instead of frame number
Makes encodes bitexact with different number of threads.
2021-02-19 21:15:35 +01:00
Andreas Rheinhardt a489b6a8e3 avcodec/cfhdenc: Fix leaks on allocation errors
The CineForm HD encoder attempts to allocate several buffers in its init
function; yet if only some of these allocations succeed, the
successfully allocated buffers leak. This is fixed 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>
2020-09-14 15:11:27 +02:00
Paul B Mahol 9f702fc8f4 avcodec: extend CFHD description 2020-08-14 10:52:28 +02:00
Paul B Mahol 3f58dbca72 avcodec/cfhdenc: mark filter as always inline 2020-08-11 10:01:05 +02:00
Paul B Mahol ba0825626a avcodec/cfhdenc: optimize writting of small runcodes 2020-08-11 10:01:05 +02:00
Paul B Mahol 16b79f3d3a avcodec/cfhdenc: improve quality vs size ratio 2020-08-11 10:01:04 +02:00
Paul B Mahol 14b84a2e99 avcodec/cfhdenc: free alpha buffer on closing 2020-08-08 19:59:06 +02:00
Paul B Mahol 0a8742a1e6 avcodec/cfhdenc: add gbrap12 pixel format support 2020-08-08 19:40:34 +02:00
Paul B Mahol 8d48e8d251 avcodec/cfhdenc: compand coefficients
Also use -quality private option and add more modes.
2020-08-08 12:05:39 +02:00
Paul B Mahol a96506f017 avcodec/cfhdenc: also write FrameNumber tag 2020-08-08 12:03:43 +02:00
Paul B Mahol d2b9cb1132 avcodec/cfhdenc: fix setting default compression level 2020-08-03 22:22:08 +02:00
Paul B Mahol 65516b2cd0 avcodec/cfhdenc: extend quantization table
Should give better quality.
2020-08-03 22:22:08 +02:00
Paul B Mahol b4ae780693 avcodec/cfhdenc: fix PrescaleTable for YUV422P10 2020-08-03 19:34:23 +02:00
Paul B Mahol 4e27817629 avcodec: add CFHD encoder 2020-08-02 09:33:24 +02:00