summaryrefslogtreecommitdiff
path: root/libavcodec/gdv.c
Commit message (Collapse)AuthorAge
* 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>
* 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/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>
* 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: Factor updating palette outAndreas Rheinhardt2021-03-22
| | | | | | | | | Because the properties of frames returned from ff_get/reget_buffer are not reset at all, lots of returned frames had palette_has_changed wrongly set to 1. This has been changed, too. Reviewed-by: James Almer <jamrial@gmail.com> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avcodec: use the buffer_size_t typedef where requiredJames Almer2021-03-10
| | | | Signed-off-by: James Almer <jamrial@gmail.com>
* avcodec/gdv: Remove dead checkAndreas Rheinhardt2020-11-10
| | | | | | | | | | | | | At the end of its decode function, the decoder sets *got_frame to 1 and then checks whether ret is < 0; if so, it is returned, otherwise avpkt->size is. But it is impossible for ret to be < 0 here and if it were, it would be nonsense to set *got_frame to 1 before this. Therefore just return avpkt->size unconditionally. Fixes Coverity issue #1439730. Reviewed-by: Paul B Mahol <onemda@gmail.com> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avcodec/gdv: Replace assert() checking bitstream by if()Michael Niedermayer2019-09-16
| | | | Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/gdv: Check remaining output after decode 5/6/8/Michael Niedermayer2019-05-31
| | | | | | | | Improves: Timeout (355sec -> 97sec) Improves: 14709/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_GDV_fuzzer-5704215281795072 Reviewed-by: Paul B Mahol <onemda@gmail.com> Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
* avcodec/gdv: Check input palette size before rescale()Michael Niedermayer2019-04-26
| | | | | | | | | Fixes: Timeout (22sec -> 11sec) Fixes: 13576/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_GDV_fuzzer-5681024577568768 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/gdv: Check for truncated tags in decompress_5()Michael Niedermayer2019-03-03
| | | | | | | Testcase: 13169/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_GDV_fuzzer-5666354038833152 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/gdv: Optimize and factorize scaling loopsMichael Niedermayer2019-01-14
| | | | | | | | | | | Fixes: Timeout Fixes: 11067/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_GDV_fuzzer-5686623711264768 Before change: Executed clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_GDV_fuzzer-5686623711264768 in 34386 ms After change: Executed clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_GDV_fuzzer-5686623711264768 in 24327 ms Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/gdv: Optimize unscaled loopMichael Niedermayer2019-01-05
| | | | | Reviewed-by: Paul B Mahol <onemda@gmail.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/gdv: Remove unused variableMichael Niedermayer2018-09-30
| | | | Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/gdv: Error out if we had insufficent input for the output frame in ↵Michael Niedermayer2018-09-28
| | | | | | | | | | decompress_2() Fixes: Timeout (with the previous commits to gdv.c) Fixes: 9422/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_GDV_fuzzer-5143490001371136 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/gdv: Optimize 2x scaling loop a little in gdv_decode_frame()Michael Niedermayer2018-09-28
| | | | Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/gdv: Replace loop in gdv_decode_frame() by memcpy()Michael Niedermayer2018-09-28
| | | | Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/gdv: Eliminate 50% of the reads in the first inner loop in rescale()Michael Niedermayer2018-09-28
| | | | Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/gdv: Simplify first inner loop in rescale()Michael Niedermayer2018-09-28
| | | | Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/gdv: Combine first and 3rd case in rescale()Michael Niedermayer2018-09-28
| | | | | | Simplifies code Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/gdv: Factor terms out of inner loops in rescale()Michael Niedermayer2018-09-28
| | | | | | This also replaces some loops by memcpy() Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/gdv: Replace divisions by shifts in rescale()Michael Niedermayer2018-09-28
| | | | | | | Divisions tend to be slower than shifts unless the compiler optimizes them out. And some of these are in inner loops. Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/gdv: Check compression before allocating frameMichael Niedermayer2017-11-03
| | | | | | | | | | | | Fixes: 2926/clusterfuzz-testcase-4987110014582784 This reduces decoding time from 7 to 4 seconds The timeout should have been fixed in 0561bd2fc2bff0dbe651d5998e9f129c43d25eb3 but ossfuzz did not close this issue 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/gdv: Check available space before reading paletteMichael Niedermayer2017-08-11
| | | | | | | | Fixes: Timeout Fixes: 2926/clusterfuzz-testcase-498711001458278 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/gdv: add decompression for 2 and 5 methodPaul B Mahol2017-06-29
| | | | Signed-off-by: Paul B Mahol <onemda@gmail.com>
* avcodec/gdv: Fix undefined shiftMichael Niedermayer2017-06-16
| | | | | | | | Fixes: runtime error: left shift of 255 by 24 places cannot be represented in type 'int' Fixes: 2249/clusterfuzz-testcase-minimized-5388542379294720 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/gdv: fix compiler warningsPaul B Mahol2017-06-11
| | | | Signed-off-by: Paul B Mahol <onemda@gmail.com>
* avcodec: add Gremlin Digital Video decoderPaul B Mahol2017-06-11
Signed-off-by: Paul B Mahol <onemda@gmail.com>