summaryrefslogtreecommitdiff
path: root/libavcodec/ffv1enc.c
Commit message (Collapse)AuthorAgeFilesLines
* 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/ffv1enc: Mark encoder as init-threadsafeAndreas Rheinhardt2021-05-021-1/+1
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avcodec: Constify AVCodecsAndreas Rheinhardt2021-04-271-1/+1
| | | | | | | | | | 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>
* avcodec: Remove deprecated AVCodecContext.coded_frameAndreas Rheinhardt2021-04-271-17/+0
| | | | | | | | | | Deprecated in 40cf1bbacc6220a0aa6bed5c331871d43f9ce370. (The currently disabled filter vf_mcdeint and vf_uspp were users of this field; they have not been changed, so that whoever wants to fix them can see the state of these filters when they were disabled.) Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com> Signed-off-by: James Almer <jamrial@gmail.com>
* avcodec: Remove private options from AVCodecContextAndreas Rheinhardt2021-04-271-10/+0
| | | | | | | | | Several options that were too codec-specific were deprecated between 0e6c8532215790bbe560a9eea4f3cc82bb55cf92 and 0e9c4fe254073b209970df3e3cb84531bc388e99. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com> Signed-off-by: James Almer <jamrial@gmail.com>
* avcodec: Remove deprecated coder type optionsAndreas Rheinhardt2021-04-271-17/+0
| | | | | | | Deprecated in be00ec832c519427cd92218abac77dafdc1d5487. 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-1/+1
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avcodec/ffv1enc: Fix memleaks on init failureAndreas Rheinhardt2020-09-171-0/+1
| | | | | | | | The FFV1 encoder has so far not cleaned up after itself in this case; but it can be done easily by setting the FF_CODEC_CAP_INIT_CLEANUP flag. Reviewed-by: Michael Niedermayer <michael@niedermayer.cc> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* libavcodec, libpostproc: Remove outcommented START/STOP_TIMERAndreas Rheinhardt2020-03-141-3/+0
| | | | | | | as well as includes of libavutil/timer.h. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/ffv1enc: Fix out-of-bounds-array accessAndreas Rheinhardt2019-09-281-4/+13
| | | | | | | | | | | | | | | | libavcodec/ffv1enc.c accessed an array of uint8_t [32] via array[0][j] in order to loop over all the uint8_t in this array of arrays. Of course this implied an out-of-bounds access for array[0] and UBSan complained about this. So replace this with nested loops; furthermore, factor this out into a function of its own to easily break out of the nested loops. This affected the FATE-tests vsynth1-ffv1, vsynth1-ffv1-v3-yuv420p, vsynth1-ffv1-v3-yuv422p10, vsynth1-ffv1-v3-yuv444p16, vsynth1-ffv1-v3-bgr0, vsynth1-ffv1-ffv1-v3-rgb48 as well as the corresponding vsynth2-*, vsynth3-* and the vsynth_lena-* tests. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/rangecoder: factorize termination version codeMichael Niedermayer2018-12-311-7/+3
| | | | Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* libavcodec/ffv1enc: minor cosmetic fixMichael Niedermayer2018-06-231-1/+1
| | | | Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* Use AV_PIX_FMT_FLAG_ALPHA for detecting transparency where nb_components was ↵Marton Balint2018-04-301-2/+2
| | | | | | | | | | used Temporarily keep the old method for ffmpeg_filters.c choose_pix_fmt and avfiltergraph.c pick_format() until a paletted pixel format without alpha is introduced. Signed-off-by: Marton Balint <cus@passwd.hu>
* avcodec/ffv1enc: Check that the crc + version combination is supportedMichael Niedermayer2018-04-241-0/+4
| | | | | | | The crc flag is only stored since version 3 thus before this crcs do not work. We increase the version as needed same as we do with pix_fmts Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/ffv1: support of more pix_fmtJérôme Martinez2018-03-101-1/+12
| | | | | | | | Without direct support of such pix_fmt, content is padded to 16-bit and it is not possible to know that the source file was with a smaller bit depth so framemd5 is different Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/ffv1enc: remove warning about transparencyJérôme Martinez2018-03-091-3/+0
| | | | Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/ffv1: Support for GBRAP10 and GBRAP12Jérôme Martinez2018-02-151-0/+3
| | | | Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/ffv1: Support for RGBA64 and GBRAP16Jérôme Martinez2018-02-061-2/+14
| | | | Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/ffv1enc: mark RGB48 support as non-experimentalJérôme Martinez2018-02-031-4/+0
| | | | | | Remove the 2nd mark, 1st mark was removed in 58e16a4 Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/ffv1enc: mark RGB48 support as non-experimentalJérôme Martinez2018-01-121-4/+0
| | | | | | | | | | | | | Resulting bitstream was tested with a conformance checker using the last draft of FFV1 specifications. Signed-off-by: Michael Niedermayer <michael@niedermayer.cc> Also the files are already in the wild, and decoder support is thus needed. And with decoders widely supporting it, there is no advantage in not allowing it in the encoder. The exact bitstream format may change in future versions of the spec, if improvments are found.
* avcodec: remove remaining uses of avcodec_get_chroma_sub_sampleMartin Vignali2017-11-061-1/+4
| | | | | | Replace them with av_pix_fmt_get_chroma_sub_sample. Signed-off-by: James Almer <jamrial@gmail.com>
* avcodec/ffv1enc: compute the max number of slices and limit by thatMichael Niedermayer2017-06-271-3/+4
| | | | Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/ffv1enc: Allow less than 2 rows of slices for low vertical resolutionMichael Niedermayer2017-06-271-0/+4
| | | | | | Fixes: Ticket5548 Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/ffv1enc: Try to choose slice count so that slice packet sizes are ↵Michael Niedermayer2017-06-261-2/+9
| | | | | | | | within the supported size Fixes assertion failure Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* Merge commit '17cb56b35672a2cd6ad7abe926e6cc772b8f4710'Clément Bœsch2017-03-191-7/+0
|\ | | | | | | | | | | | | * commit '17cb56b35672a2cd6ad7abe926e6cc772b8f4710': ffv1: Remove broken disabled cruft Merged-by: Clément Bœsch <u@pkh.me>
| * ffv1: Remove broken disabled cruftDiego Biurrun2016-08-171-7/+0
| |
| * ffv1: Remove version 2 and mark version 3 as non-experimentalLuca Barbato2016-06-291-37/+35
| | | | | | | | | | The encoder produces bitstream compatible with the current specification and version 2 is set as reserved (non-standardizable).
* | avcodec/ffv1enc: Allocate smaller packet if the worst case size cannot be ↵Michael Niedermayer2016-12-091-0/+5
| | | | | | | | | | | | | | | | | | | | | | allocated We are checking during encoding if there is enough space as version 4 needs that check. Fixes Ticket6005 Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* | avcodec/ffv1enc: Fix size of first sliceMichael Niedermayer2016-12-091-4/+9
| | | | | | | | Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* | lavc/ffv1: Support YUV4xxP12 and GRAY12.Carl Eugen Hoyos2016-11-201-2/+9
| |
* | lavc/ffv1enc: Support pix_fmt GRAY10.Carl Eugen Hoyos2016-11-171-0/+2
| |
* | avcodec/ffv1enc: Fix storing RGB48 without explicitly set levelMichael Niedermayer2016-10-251-0/+1
| | | | | | | | | | | | | | | | | | the bps value is only stored with level >= 1, using rgb48 with level 0 requires the user app to keep track of the bps by external means, which does not always happen also we force level >= 1 for other 16bps formats, so this is consistent. Found-by: Jerome Martinez <jerome@mediaarea.net> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* | avcodec/ffv1enc: Add RGB48 supportMichael Niedermayer2016-08-161-1/+11
| | | | | | | | Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* | avcodec/ffv1enc: do not offset null pointersMichael Niedermayer2016-08-161-2/+2
| | | | | | | | Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* | avcodec/ffv1enc: Factor rice high depth check outMichael Niedermayer2016-08-161-10/+7
| | | | | | | | Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* | avcodec/ffv1: add AV_PIX_FMT_GBRP16 supportMichael Niedermayer2016-08-081-1/+17
| | | | | | | | Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* | avcodec/ffv1: template functions to allow data types different from int16_tMichael Niedermayer2016-08-081-162/+5
| | | | | | | | | | | | | | This is required for >= 16bit RGB support I tried it without templates but its too much duplicated code Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* | avcodec/ffv1enc: Fix assertion failure with non zero bits per sampleMichael Niedermayer2016-08-061-4/+2
| | | | | | | | | | Fixes Ticket5736 Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* | Merge commit '5c31eaa9998b2185e0aa04d11adff128498dc14a'Clément Bœsch2016-06-211-0/+1
|\ \ | |/ | | | | | | | | | | * commit '5c31eaa9998b2185e0aa04d11adff128498dc14a': Remove unnecessary get_bits.h #includes and add missing headers where needed. Merged-by: Clément Bœsch <clement@stupeflix.com>
| * Remove unnecessary get_bits.h #includes and add missing headers where needed.Alexandra Hájková2016-05-041-1/+1
| | | | | | | | Signed-off-by: Diego Biurrun <diego@biurrun.de>
* | avcodec/ffv1enc: silence warning about deprecated coded_frameJames Almer2016-06-171-0/+4
| | | | | | | | | | Reviewed-by: Michael Niedermayer <michael@niedermayer.cc> Signed-off-by: James Almer <jamrial@gmail.com>
* | Merge commit '96c373c7704aeb1cc1d2c275fbb5d71777665589'Derek Buitenhuis2016-01-281-6/+14
|\ \ | |/ | | | | | | | | | | * commit '96c373c7704aeb1cc1d2c275fbb5d71777665589': lavc: Move context_model to codec private options Merged-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
| * lavc: Move context_model to codec private optionsVittorio Giovara2016-01-211-6/+14
| | | | | | | | | | | | | | | | This option is only used by ffv1 and ffvhuff. It is a very codec-specific option, so deprecate the global variant. Improve documentation a little. Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
| * lavu: add AV_CEIL_RSHIFT and use it in various placesClément Bœsch2016-01-111-2/+2
| | | | | | | | Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
* | avutil: Rename FF_CEIL_COMPAT to AV_CEIL_COMPATDerek Buitenhuis2016-01-271-2/+2
| | | | | | | | | | | | | | | | | | | | Libav, for some reason, merged this as a public API function. This will aid in future merges. A define is left for backwards compat, just in case some person used it, since it is in a public header. Signed-off-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
* | avcodec/ffv1enc: Support AV_PIX_FMT_YA8Michael Niedermayer2016-01-011-8/+13
| | | | | | | | Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* | avcodec/ffv1enc: Fix 2 pass mode with the default rc tableMichael Niedermayer2015-12-191-2/+13
| | | | | | | | Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* | avcodec/ffv1enc: unbreak -coder optionMichael Niedermayer2015-12-181-2/+9
| | | | | | | | | | | | This fixes a segfault caused by moving the coder option and changing its semantics Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* | Merge commit 'be00ec832c519427cd92218abac77dafdc1d5487'Hendrik Leppkes2015-12-181-1/+19
|\ \ | |/ | | | | | | | | | | * commit 'be00ec832c519427cd92218abac77dafdc1d5487': lavc: Deprecate coder_type and its symbols Merged-by: Hendrik Leppkes <h.leppkes@gmail.com>
| * lavc: Deprecate coder_type and its symbolsVittorio Giovara2015-12-071-1/+19
| | | | | | | | | | | | | | | | | | | | Most option values are simply unused or ignored and in practice the majory of codecs only need to check whether to enable rle or not. Add appropriate codec private options which better expose the allowed features. Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>