summaryrefslogtreecommitdiff
path: root/libavcodec/pixlet.c
Commit message (Collapse)AuthorAgeFilesLines
* avcodec: use the new AVFrame key_frame flag in all decoders and encodersJames Almer2023-05-041-1/+1
| | | | Signed-off-by: James Almer <jamrial@gmail.com>
* avcodec/codec_internal: Add macro to set AVCodec.long_nameAndreas Rheinhardt2022-09-031-1/+1
| | | | | | | | 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/internal: Move ff_set_dimensions() to decode.hAndreas Rheinhardt2022-08-271-3/+1
| | | | | | | | | Decoder-only, as the dimensions are set by the user when encoding. Also fixup the other headers a bit while removing unnecessary internal.h inclusions. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec: Make init-threadsafety the defaultAndreas Rheinhardt2022-07-181-2/+1
| | | | | | | | | | | 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/pixlet: consider minimum plane header in the minimal packet sizeMichael Niedermayer2022-07-121-1/+1
| | | | | | | | Fixes: Timeout Fixes: 46956/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_PIXLET_fuzzer-5698161106092032 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec: Add const to decoder packet data pointersAndreas Rheinhardt2022-07-091-2/+2
| | | | | | | The packets given to decoder need not be writable, so it is best to access them via const uint8_t*. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/codec_internal: Use union for FFCodec decode/encode callbacksAndreas Rheinhardt2022-04-051-1/+1
| | | | | | | | | | | 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: Make FFCodec.decode use AVFrame*Andreas Rheinhardt2022-04-051-2/+1
| | | | | | | | This increases type-safety by avoiding conversions from/through void*. It also avoids the boilerplate "AVFrame *frame = data;" line for non-subtitle decoders. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/pixlet: Avoid signed integer overflow in scaling in filterfn()Michael Niedermayer2022-03-211-2/+2
| | | | | | | | Fixes: signed integer overflow: 11494 * 1073741824000000 cannot be represented in type 'long' Fixes: 26586/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_PIXLET_fuzzer-5752633970917376 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/codec_internal: Add FFCodec, hide internal part of AVCodecAndreas Rheinhardt2022-03-211-6/+6
| | | | | | | | | | | | | | | | 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-211-0/+1
| | | | | | | | | | 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/thread: Don't use ThreadFrame when unnecessaryAndreas Rheinhardt2022-02-091-5/+4
| | | | | | | | | | | | | | | | | | | | | | | The majority of frame-threaded decoders (mainly the intra-only) need exactly one part of ThreadFrame: The AVFrame. They don't need the owners nor the progress, yet they had to use it because ff_thread_(get|release)_buffer() requires it. This commit changes this and makes these functions work with ordinary AVFrames; the decoders that need the extra fields for progress use ff_thread_(get|release)_ext_buffer() which work exactly as ff_thread_(get|release)_buffer() used to do. This also avoids some unnecessary allocations of progress AVBuffers, namely for H.264 and HEVC film grain frames: These frames are not used for synchronization and therefore don't need a ThreadFrame. Also move the ThreadFrame structure as well as ff_thread_ref_frame() to threadframe.h, the header for frame-threaded decoders with inter-frame dependencies. Reviewed-by: Anton Khirnov <anton@khirnov.net> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.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: Constify some AVPacketsAndreas Rheinhardt2021-03-091-1/+1
| | | | | Reviewed-by: James Almer <jamrial@gmail.com> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avcodec/pixlet: postprocess luma using precalculated lutPaul B Mahol2020-09-061-8/+26
| | | | | Realtime decoding speed raises from 1.08 to 1.84 for 1504x846, 25391 kb/s, 24 fps video.
* avcodec/pixlet: Fix log(0) checkMichael Niedermayer2020-06-141-1/+1
| | | | | | | | Fixes: passing zero to clz(), which is not a valid argument Fixes: 23337/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_PIXLET_fuzzer-5179131989065728 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* pthread_frame: merge the functionality for normal decoder init and ↵Anton Khirnov2020-04-101-16/+0
| | | | | | | | | | | | | | | | init_thread_copy The current design, where - proper init is called for the first per-thread context - first thread's private data is copied into private data for all the other threads - a "fixup" function is called for all the other threads to e.g. allocate dynamically allocated data is very fragile and hard to follow, so it is abandoned. Instead, the same init function is used to init each per-thread context. Where necessary, AVCodecInternal.is_copy can be used to differentiate between the first thread and the other ones (e.g. for decoding the extradata just once).
* lavc/pixlet: remove unecessary intermediate nb_levels variableClément Bœsch2017-10-131-5/+5
| | | | This is a change imported from Libav.
* lavc/pixlet: reduce diff with Libav (cosmetics only)Clément Bœsch2017-10-131-127/+144
|
* avcodec/pixlet: Fixes: undefined shift in av_mod_uintp2()Michael Niedermayer2017-08-201-1/+1
| | | | | | | | Fixes: runtime error: shift exponent 4294967289 is too large for 32-bit type 'int' Fixes: 3030/clusterfuzz-testcase-minimized-4649809254285312 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/pixlet: fixes integer overflow in read_highpass()Michael Niedermayer2017-08-181-0/+3
| | | | | | | | Fixes: runtime error: negation of -2147483648 cannot be represented in type 'int32_t' (aka 'int'); cast to an unsigned type to negate this value to itself Fixes: 2879/clusterfuzz-testcase-minimized-6317542639403008 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/pixlet: Simplify nbits computationMichael Niedermayer2017-07-281-2/+2
| | | | | | | | | Fixes multiple integer overflows Fixes: runtime error: signed integer overflow: 1 + 2147483647 cannot be represented in type 'int' Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Reviewed-by: Paul B Mahol <onemda@gmail.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/pixlet: Fix runtime error: signed integer overflow: 2147483647 + 32 ↵Michael Niedermayer2017-05-271-0/+4
| | | | | | | | | cannot be represented in type 'int' Fixes: 1829/clusterfuzz-testcase-minimized-5527165321871360 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/pixlet: Fix reading invalid numbers of bitsMichael Niedermayer2017-05-181-0/+2
| | | | | | | | Fixes: asertion failure Fixes: 1664/clusterfuzz-testcase-minimized-6587801187385344 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/targets/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/pixlet: Fixes: runtime error: signed integer overflow: ↵Michael Niedermayer2017-05-141-1/+1
| | | | | | | | | 9203954323419769657 + 29897660706736950 cannot be represented in type 'long' Fixes: 1569/clusterfuzz-testcase-minimized-6328690508038144 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/targets/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/pixlet: Fix runtime error: signed integer overflow: 436207616 * ↵Michael Niedermayer2017-05-111-1/+1
| | | | | | | | | -5160230545260541 cannot be represented in type 'long' Fixes: 1462/clusterfuzz-testcase-minimized-6558894463647744 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/targets/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/pixlet: Fix shift exponent 4294967268 is too large for 32-bit type 'int'Michael Niedermayer2017-05-051-2/+2
| | | | | | | Fixes: 1336/clusterfuzz-testcase-minimized-4761381930795008 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/targets/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/pixlet: Reorder rlen checkMichael Niedermayer2017-04-101-1/+1
| | | | | | | | This changes nothing but is nicer looking as this checks rlen Maybe this helps coverity remove CID1397743 Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* Fix all -Wformat warnings raised by DJGPPClément Bœsch2017-03-291-2/+3
|
* avcodec/pixlet: fix architecture-dependent code and valuesVittorio Giovara2017-03-071-27/+30
| | | | | | | | | | | | | The constants used in the decoder used floating point precision, and this caused different values to be generated on different architectures. So, eradicate floating point numbers and use fixed point (32.32) arithmetics everywhere, replacing constants with precomputed integer values. Signed-off-by: Vittorio Giovara <vittorio.giovara at gmail.com> Signed-off-by: Paul B Mahol <onemda@gmail.com>
* avcodec/pixlet: use av_clip_uintp2_c explicitlyPaul B Mahol2017-01-191-2/+2
| | | | | Found-by: Clément Bœsch <u@pkh.me> Signed-off-by: Paul B Mahol <onemda@gmail.com>
* avcodec/pixlet: use av_clip_uintp2()Paul B Mahol2017-01-191-2/+2
| | | | | Found-by: Clément Bœsch <u@pkh.me> Signed-off-by: Paul B Mahol <onemda@gmail.com>
* avcodec/pixlet: clip chroma before shiftingPaul B Mahol2017-01-191-2/+2
| | | | | | Fixes artifacts. Signed-off-by: Paul B Mahol <onemda@gmail.com>
* avcodec/pixlet: simplify lowpass_prediction() functionPaul B Mahol2016-12-241-10/+7
| | | | Signed-off-by: Paul B Mahol <onemda@gmail.com>
* avcodec/pixlet: make sure scaling factors are not zeroPaul B Mahol2016-12-241-2/+8
| | | | Signed-off-by: Paul B Mahol <onemda@gmail.com>
* avcodec/pixlet: avoid some overflowsPaul B Mahol2016-12-241-2/+2
| | | | Signed-off-by: Paul B Mahol <onemda@gmail.com>
* avcodec/pixlet: fix undefined behaviour in postprocess_chromaPaul B Mahol2016-12-241-2/+2
| | | | Signed-off-by: Paul B Mahol <onemda@gmail.com>
* avcodec/pixlet: check out of bounds pfx valuePaul B Mahol2016-12-231-0/+2
| | | | Signed-off-by: Paul B Mahol <onemda@gmail.com>
* avcodec/pixlet: remove unnecessary double to float conversionJames Almer2016-12-231-3/+3
| | | | Signed-off-by: James Almer <jamrial@gmail.com>
* avcodec: add Apple Pixlet decoderPaul B Mahol2016-12-221-0/+672
Signed-off-by: Paul B Mahol <onemda@gmail.com>