summaryrefslogtreecommitdiff
path: root/libavcodec/sheervideo.c
Commit message (Collapse)AuthorAge
* 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: Make FFCodec.decode use AVFrame*Andreas Rheinhardt2022-04-05
| | | | | | | | 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/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/thread: Don't use ThreadFrame when unnecessaryAndreas Rheinhardt2022-02-09
| | | | | | | | | | | | | | | | | | | | | | | 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>
* all: Remove unnecessary libavcodec/internal.h inclusionsAndreas Rheinhardt2022-02-08
| | | | 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>
* avcodec/sheervideo: Simplify creating VLC tableAndreas Rheinhardt2020-12-08
| | | | | | | | ff_init_vlc_from_lengths() can be used to offload the computation of the codes; it also needn't check whether the codes are already properly ordered (they are). Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avcodec/sheervideo: Add av_cold to build_vlc()Andreas Rheinhardt2020-11-24
| | | | | | It is an init function even when called from decode_frame(). Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avcodec/sheervideo: Avoid code duplication when creating VLC tablesAndreas Rheinhardt2020-10-10
| | | | | | | | | The SheerVideo decoder uses two VLC tables and these are in turn created from structures (called SheerTable) that are naturally paired. This commit unifies these pairs of SheerTables to arrays and unifies creating the VLC tables. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avcodec/sheervideo: Reduce the size of static arraysAndreas Rheinhardt2020-10-10
| | | | | | | | | | | | | | | The SheerVideo decoder uses VLC tables which are currently stored in large arrays that contain the length of each leaf of the corresponding tree from left to right, taking 15.5KB of space. But all these arrays follow a common pattern: First the entries are ascending and then they are descending with lots of successive entries have the same value. Therefore it makes sense to use a run-length encoding to store them, as this commit does. Notice that the length 16 has to be treated specially because there are arrays with more than 256 consecutive entries with value 16 and because the length of the entries start to descend from this length onward. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avcodec/sheervideo: Don't leave context in inconsistent state upon errorAndreas Rheinhardt2020-10-10
| | | | | | | | | | | | This has happened if the format changed midstream and if the new packet is so small that it is instantaneously rejected: In this case the VLC tables were for the new format, although the context says that they are still the ones for the old format. It can also happen if the format changed midstream and the allocation of the new tables fails. If the next packet is a packet for the old format, the decoder thinks it already has the correct VLC tables, leading to a segfault. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avcodec/sheervideo: Inline compile-time constantsAndreas Rheinhardt2020-10-10
| | | | | Reviewed-by: Paul B Mahol <onemda@gmail.com> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avcodec/sheervideo: Improve creating VLC tablesAndreas Rheinhardt2020-10-10
| | | | | | | | | Don't needlessly copy an array around; don't create a table with default symbols; and use smaller types to save stack space: The longest code here is 16 bits, so one can store the codes in this type. Reviewed-by: Paul B Mahol <onemda@gmail.com> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avcodec/sheervideo: use cached bitstream reader except for x32Paul B Mahol2020-08-31
|
* avcodec/sheervideo: reduce size of vlc tables to normal valuesPaul B Mahol2020-08-12
|
* pthread_frame: merge the functionality for normal decoder init and ↵Anton Khirnov2020-04-10
| | | | | | | | | | | | | | | | 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).
* avcodec/sheervideo: move tables to own headerPaul B Mahol2018-04-03
| | | | Signed-off-by: Paul B Mahol <onemda@gmail.com>
* avcodec/sheervideo: Check input buffer size before allocating and decodingMichael Niedermayer2017-05-28
| | | | | | | | Fixes: Timeout Fixes: 1858/clusterfuzz-testcase-minimized-6450473802399744 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* lavc: fix usages of av_get_codec_tag_string()Clément Bœsch2017-03-29
|
* lavc/sheervideo: Fix Y prediction for interlaced frames with transparency.Carl Eugen Hoyos2017-03-02
| | | | | Based on 260de8a2 by Paul B Mahol. Fixes ticket #6210.
* lavc/sheervideo: Increase av_get_codec_tag_string() input buffer size.Carl Eugen Hoyos2016-10-20
| | | | A size of 32 is typically used.
* avcodec/sheervideo: print internal format in debug logPaul B Mahol2016-09-18
| | | | Signed-off-by: Paul B Mahol <onemda@gmail.com>
* avcodec/sheervideo: fix Y prediction in decode_ybr(i) for older formatsPaul B Mahol2016-09-18
| | | | Signed-off-by: Paul B Mahol <onemda@gmail.com>
* avcodec/sheervideo: fix YbYr format decodingPaul B Mahol2016-06-23
| | | | Signed-off-by: Paul B Mahol <onemda@gmail.com>
* avcodec/sheervideo: check build_vlc for failurePaul B Mahol2016-06-16
| | | | Signed-off-by: Paul B Mahol <onemda@gmail.com>
* avcodec/sheervideo: add 10-bit interlaced RGB(A) supportPaul B Mahol2016-06-12
| | | | Signed-off-by: Paul B Mahol <onemda@gmail.com>
* avcodec/sheervideo: add support for 10-bit interlaced YCbCr(A) 4:2:2Paul B Mahol2016-06-10
| | | | Signed-off-by: Paul B Mahol <onemda@gmail.com>
* avcodec/sheervideo: fix argx format supportPaul B Mahol2016-06-10
| | | | Signed-off-by: Paul B Mahol <onemda@gmail.com>
* avcodec/sheervideo: add support for 10-bit interlaced YCbCr(A) 4:4:4(:4)Paul B Mahol2016-06-10
| | | | Signed-off-by: Paul B Mahol <onemda@gmail.com>
* avcodec/sheervideo: fix prediction for ybyr formatPaul B Mahol2016-06-10
| | | | Signed-off-by: Paul B Mahol <onemda@gmail.com>
* avcodec/sheervideo: fix predictions for c82p formatPaul B Mahol2016-06-10
| | | | Signed-off-by: Paul B Mahol <onemda@gmail.com>
* avcodec/sheervideo: supports some other 8bit formatsPaul B Mahol2016-06-09
| | | | Signed-off-by: Paul B Mahol <onemda@gmail.com>
* avcodec/sheervideo: add interlaced YCbCr(A) 4:2:2:4 8-bit supportPaul B Mahol2016-06-09
| | | | Signed-off-by: Paul B Mahol <onemda@gmail.com>
* avcodec/sheervideo: add interlaced YCbCr(A) 4:4:4:4 8-bit supportPaul B Mahol2016-06-09
| | | | Signed-off-by: Paul B Mahol <onemda@gmail.com>
* avcodec/sheervideo: fix order of operations for raw linesPaul B Mahol2016-06-07
| | | | Signed-off-by: Paul B Mahol <onemda@gmail.com>
* avcodec/sheervideo: add support for 8-bit interlaced (A)RGBPaul B Mahol2016-06-07
| | | | Signed-off-by: Paul B Mahol <onemda@gmail.com>
* avcodec: add BitJazz SheerVideo decoderPaul B Mahol2016-06-07
Signed-off-by: Paul B Mahol <onemda@gmail.com>