summaryrefslogtreecommitdiff
path: root/libavcodec/cinepakenc.c
Commit message (Collapse)AuthorAge
* avutil/common: Don't auto-include mem.hAndreas Rheinhardt2024-03-31
| | | | | | | | | | | There are lots of files that don't need it: The number of object files that actually need it went down from 2011 to 884 here. Keep it for external users in order to not cause breakages. Also improve the other headers a bit while just at it. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* Revert "all: Don't set AVClass.item_name to its default value"Anton Khirnov2024-01-20
| | | | | | | Some callers assume that item_name is always set, so this may be considered an API break. This reverts commit 0c6203c97a99f69dbaa6e4011d48c331e1111f5e.
* all: Don't set AVClass.item_name to its default valueAndreas Rheinhardt2023-12-22
| | | | | | | | Unnecessary since acf63d5350adeae551d412db699f8ca03f7e76b9; also avoids relocations. Reviewed-by: Anton Khirnov <anton@khirnov.net> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* lavc: support AV_CODEC_CAP_ENCODER_REORDERED_OPAQUE in all no-delay encodersAnton Khirnov2023-01-29
| | | | Including fake-delay encoders marked with FF_CODEC_CAP_EOF_FLUSH.
* avcodec/codec_internal: Add macro to set AVCodec.long_nameAndreas Rheinhardt2022-09-03
| | | | | | | | 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-27
| | | | | | | | | | | | | | | | | | 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-05
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/cinepakenc: Avoid casting const awayAndreas Rheinhardt2022-07-31
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* 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>
* libavcodec/cinepakenc: Mark no-skip frames as keyframesTomas Härdin2022-05-12
| | | | | Reset curframe whenever we generate a keyframe. Use -g instead of -keyint_min.
* 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>
* all: Remove unused-but-set variablesAndreas Rheinhardt2021-12-03
| | | | | | Newer versions of Clang detect this and emit warnings for it. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/elbg: Add flags to avpriv_elbg_do()Andreas Rheinhardt2021-09-24
| | | | | | | | | This is currently unused and it is only added to enable changes while maintaining ABI compatibility. The type is uintptr_t in order to potentially accept a pointer argument. Reviewed-by: Paul B Mahol <onemda@gmail.com> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/cinepakenc: Check all calls to avpriv_elbg_do()Andreas Rheinhardt2021-09-24
| | | | | Reviewed-by: Paul B Mahol <onemda@gmail.com> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/elbg: Add persistent ELBGContextAndreas Rheinhardt2021-09-20
| | | | | | | | It will be used in future commits to avoid having to allocate and free all the buffers used. Reviewed-by: Paul B Mahol <onemda@gmail.com> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/elbg: Merge avpriv_init_elbg() into avpriv_do_elbg()Andreas Rheinhardt2021-09-20
| | | | | | | | | These functions are always called directly after another with the exact same arguments. This avoids exporting a symbol; it also avoids having to perform two calls for every caller. Reviewed-by: Paul B Mahol <onemda@gmail.com> 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: 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>
* Remove double ';'Andreas Rheinhardt2021-03-01
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avcodec/cinepakenc: Mark encoder as init-threadsafeAndreas Rheinhardt2020-12-10
| | | | | Reviewed-by: Tomas Härdin <tjoppen@acc.umu.se> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avcodec/cinepakenc: Cleanup generically after init failureAndreas Rheinhardt2020-08-30
| | | | | Reviewed-by: Tomas Härdin <tjoppen@acc.umu.se> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avcodec/cinepakenc: Fix invalid shiftsAndreas Rheinhardt2019-10-06
| | | | | | | | | | Fixes: left shift of 1 by 31 places cannot be represented in type 'int'. Affected the FATE-tests vsynth1-cinepak, vsynth2-cinepak and vsynth_lena-cinepak. Also fixes ticket #8220. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com> Reviewed-by: Paul B Mahol <onemda@gmail.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* Merge commit 'ed3b2a999d189771c9b0ada9a9200117595fa474'James Almer2017-11-07
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * commit 'ed3b2a999d189771c9b0ada9a9200117595fa474': cinepakenc: misc small changes cinepakenc: K&R formatting cosmetics cinepakenc: Stop using AVPicture cinepakenc: Drop broken debug code cinepakenc: add option handling for flexibility cinepakenc: fixes and improvements Add Cinepak encoder See 59dbc36f49db5cfd9d2ad4b00ef2e3336173ee8d 762c4dc082764896e27f3c53c14a65871d8fe910 bf23642dcc86890fa2e32697c3b930b3f1ac0d88 0ab25dac2f0b170ecc0e37530cf15f83b9f9e56d Merged-by: James Almer <jamrial@gmail.com>
| * cinepakenc: misc small changesDiego Biurrun2017-07-05
| | | | | | | | | | | | Avoid anonymously typedeffed structs and enums, drop an unused context member, fix a small wording mishap, sizeof(type) ---> sizeof(*variable), drop a needlessly verbose log message, use av_malloc_array() where appropriate.
| * cinepakenc: K&R formatting cosmeticsDiego Biurrun2017-07-05
| |
| * cinepakenc: Stop using AVPictureTimothy Gu2017-07-05
| |
| * cinepakenc: Drop broken debug codeDiego Biurrun2017-07-05
| |
| * cinepakenc: add option handling for flexibilityaddr-see-the-website@aetey.se2017-07-05
| | | | | | | | | | | | | | Now it is possible to adjust compression speed vs R/D when needed and also skip vintage player compatibility at will. Signed-off-by: Diego Biurrun <diego@biurrun.de>
| * cinepakenc: fixes and improvementsaddr-see-the-website@aetey.se2017-07-05
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | version 2013-02-08 Rl - fixes/optimization in multistrip encoding and codebook size choice, quality/bitrate is now better than that of the binary proprietary encoder version 2013-02-12 Rl - separated codebook training sets, avoided the transfer of wasted bytes, which yields both better quality and smaller files - now using the correct colorspace (TODO: move conversion to libswscale) version 2013-02-14 Rl "Valentine's Day" version: - made strip division more robust - minimized bruteforcing the number of strips, (costs some R/D but speeds up compession a lot), the heuristic assumption is that score as a function of the number of strips has one wide minimum which moves slowly, of course not fully true - simplified codebook generation, the old code was meant for other optimizations than we actually do - optimized the codebook generation / error estimation for MODE_MC version 2013-04-28 Rl - bugfixed codebook optimization logic version 2014-01-20 Rl - made the encoder compatible with vintage decoders and added some yet unused code for possible future incremental codebook updates - fixed a small memory leak version 2014-01-21 Rl - believe it or not, now we get even smaller files, with better quality (which means I missed an optimization earlier :) Signed-off-by: Diego Biurrun <diego@biurrun.de>
| * Add Cinepak encoderTomas Härdin2017-07-05
| | | | | | With permission of Tomas Härdin applied by Rl aetey.se Signed-off-by: Diego Biurrun <diego@biurrun.de>
* cinepakenc: Move declaration out of for initialisation statementMark Thompson2017-10-21
| | | | (cherry picked from commit 92f0aceb36c6e4412d4cf346e70dc74b5a4069e9)
* libavcodec/cinepakenc.c: comments cleanup (contents)addr-see-the-website@aetey.se2017-02-02
| | | | | | | | Change the encoding of the original developer name from ISO-8859-1 to UTF-8. Remove the stale/completed TODO list. Fix two small typos. Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/cinepakenc: remove CVID from long descriptionPaul B Mahol2017-01-14
| | | | Signed-off-by: Paul B Mahol <onemda@gmail.com>
* cinepakenc: Stop using AVPictureTimothy Gu2016-02-02
|
* avcodec: use AV_OPT_TYPE_BOOL in a bunch of placesClément Bœsch2015-12-04
|
* avcodec: Add a min size parameter to ff_alloc_packet2()Michael Niedermayer2015-07-27
| | | | | | | | This parameter can be used to inform the allocation code about how much downsizing might occur, and can be used to optimize how to allocate the packet Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* Remove a few occurences of "long long" from the libraries.Carl Eugen Hoyos2015-06-13
|
* avcodec/cinepakenc: use av_malloc_array()Michael Niedermayer2014-05-11
| | | | Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* avcodec/cinepakenc: Fix "may be used uninitialized in this function" warningsMichael Niedermayer2014-05-08
| | | | Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* avcodec/cinepakenc: drop coded_frame initMichael Niedermayer2014-05-07
| | | | | | Fixes const being lost warning Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* avcodec/cinepakenc: Zero AVPictures, silence "may be used uninitialized" ↵Michael Niedermayer2014-05-07
| | | | | | warnings Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* Cinepak encoder: adding option handling for flexibilityaddr-see-the-website@aetey.se2014-01-23
| | | | | | | Now it is possible to adjust compression speed vs R/D when needed and also skip vintage players compatibility at will. Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* avcodec/cinepakenc: fixes and improvementsaddr-see-the-website@aetey.se2014-01-22
| | | | | | | | | Fixed/improved multistrip adaptivity. Improved R/D by optimized codebook generation. Support for the correct color space. Vintage compatibility. Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* Adding Cinepak encoderTomas Härdin2014-01-22
With permission of Tomas Härdin applied by Rl aetey.se Signed-off-by: Michael Niedermayer <michaelni@gmx.at>