Commit Graph

33 Commits

Author SHA1 Message Date
Andreas Rheinhardt 01d158d1c8 all: Remove unused-but-set variables
Newer versions of Clang detect this and emit warnings for it.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-12-03 16:09:14 +01:00
Andreas Rheinhardt 6b2c1d1018 avcodec/elbg: Add flags to avpriv_elbg_do()
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>
2021-09-24 00:01:27 +02:00
Andreas Rheinhardt ad27326e2b avcodec/cinepakenc: Check all calls to avpriv_elbg_do()
Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-09-24 00:00:13 +02:00
Andreas Rheinhardt 896c11687e avcodec/elbg: Add persistent ELBGContext
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>
2021-09-20 04:38:45 +02:00
Andreas Rheinhardt 05ccfcb7b0 avcodec/elbg: Merge avpriv_init_elbg() into avpriv_do_elbg()
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>
2021-09-20 04:09:22 +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 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 0e645b98c6 Remove double ';'
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2021-03-01 06:10:44 +01:00
Andreas Rheinhardt f79927990d avcodec/cinepakenc: Mark encoder as init-threadsafe
Reviewed-by: Tomas Härdin <tjoppen@acc.umu.se>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-12-10 01:15:03 +01:00
Andreas Rheinhardt fea984d5c7 avcodec/cinepakenc: Cleanup generically after init failure
Reviewed-by: Tomas Härdin <tjoppen@acc.umu.se>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-08-30 02:55:43 +02:00
Andreas Rheinhardt e3650dcfc9 avcodec/cinepakenc: Fix invalid shifts
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>
2019-10-06 20:00:59 +02:00
James Almer 5371274329 Merge commit 'ed3b2a999d189771c9b0ada9a9200117595fa474'
* 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
59dbc36f49
762c4dc082
bf23642dcc
0ab25dac2f

Merged-by: James Almer <jamrial@gmail.com>
2017-11-07 18:32:53 -03:00
Mark Thompson e0a967a405 cinepakenc: Move declaration out of for initialisation statement
(cherry picked from commit 92f0aceb36)
2017-10-21 22:19:50 +01:00
Diego Biurrun ed3b2a999d cinepakenc: misc small changes
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.
2017-07-05 13:05:54 +02:00
Diego Biurrun 47cde2eabc cinepakenc: K&R formatting cosmetics 2017-07-05 13:05:54 +02:00
Timothy Gu 1e12730e5d cinepakenc: Stop using AVPicture 2017-07-05 13:05:54 +02:00
Diego Biurrun b40236d954 cinepakenc: Drop broken debug code 2017-07-05 13:05:54 +02:00
addr-see-the-website@aetey.se 158d2e1545 cinepakenc: add option handling for flexibility
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>
2017-07-05 13:05:54 +02:00
addr-see-the-website@aetey.se 7da9f45231 cinepakenc: fixes and improvements
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>
2017-07-05 13:05:54 +02:00
Tomas Härdin 89e632de9b Add Cinepak encoder
With permission of Tomas Härdin applied by Rl aetey.se

Signed-off-by: Diego Biurrun <diego@biurrun.de>
2017-07-05 13:05:54 +02:00
addr-see-the-website@aetey.se 712ad6b661 libavcodec/cinepakenc.c: comments cleanup (contents)
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>
2017-02-02 16:31:13 +01:00
Paul B Mahol 743052ec5b avcodec/cinepakenc: remove CVID from long description
Signed-off-by: Paul B Mahol <onemda@gmail.com>
2017-01-14 16:56:47 +01:00
Timothy Gu 0ab25dac2f cinepakenc: Stop using AVPicture 2016-02-02 18:06:13 -08:00
Clément Bœsch fb99ef0bd3 avcodec: use AV_OPT_TYPE_BOOL in a bunch of places 2015-12-04 15:37:05 +01:00
Michael Niedermayer e36db49b7b avcodec: Add a min size parameter to ff_alloc_packet2()
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>
2015-07-27 19:57:52 +02:00
Carl Eugen Hoyos 3323c5f353 Remove a few occurences of "long long" from the libraries. 2015-06-13 09:28:41 +02:00
Michael Niedermayer e2c7816ab0 avcodec/cinepakenc: use av_malloc_array()
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-05-11 20:06:28 +02:00
Michael Niedermayer 364e8904ce avcodec/cinepakenc: Fix "may be used uninitialized in this function" warnings
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-05-08 16:40:58 +02:00
Michael Niedermayer 54ae58802e avcodec/cinepakenc: drop coded_frame init
Fixes const being lost warning

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-05-07 17:54:48 +02:00
Michael Niedermayer a6e9448dc6 avcodec/cinepakenc: Zero AVPictures, silence "may be used uninitialized" warnings
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-05-07 17:54:03 +02:00
addr-see-the-website@aetey.se bf23642dcc Cinepak encoder: adding option handling for flexibility
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>
2014-01-23 20:27:06 +01:00
addr-see-the-website@aetey.se 762c4dc082 avcodec/cinepakenc: fixes and improvements
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>
2014-01-22 15:23:53 +01:00
Tomas Härdin 59dbc36f49 Adding Cinepak encoder
With permission of Tomas Härdin applied by Rl aetey.se

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-01-22 14:41:24 +01:00