aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec/scpr.c
Commit message (Collapse)AuthorAgeFilesLines
* avutil/common: Don't auto-include mem.hAndreas Rheinhardt2024-03-311-0/+1
| | | | | | | | | | | 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>
* avcodec: use the new AVFrame key_frame flag in all decoders and encodersJames Almer2023-05-041-6/+6
| | | | Signed-off-by: James Almer <jamrial@gmail.com>
* avcodec/scpr: Test bx before useMichael Niedermayer2023-01-111-0/+3
| | | | | | | | Fixes: out of array access on 32bit Fixes: 54850/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_SCPR_fuzzer-5302669294305280 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 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_get_buffer() to decode.hAndreas Rheinhardt2022-08-271-3/+0
| | | | | | | | | Only used by decoders (encoders have ff_encode_alloc_frame()). Also clean up the other headers a bit while removing now redundant internal.h inclusions. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/internal: Move ff_reget_buffer() to decode.hAndreas Rheinhardt2022-08-271-0/+1
| | | | | | | | | Only used by decoders. Also clean up the headers a bit while removing now 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/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-4/+3
| | | | | | | | 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-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: 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/scpr: Check minimum size of type 17Michael Niedermayer2019-10-101-0/+3
| | | | | | | | | Improves: Timeout (85sec -> 46sec) Improves: 17644/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_SCPR_fuzzer-5715704283660288 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/decode: add a flags parameter to ff_reget_buffer()James Almer2019-09-041-1/+1
| | | | | | | | | | Some decoders may not need a writable buffer in some specific cases, but only a reference to the existing buffer with updated frame properties instead, for the purpose of returning duplicate frames. For this, the FF_REGET_BUFFER_FLAG_READONLY flag is added, which will prevent potential allocations and buffer copies when they are not needed. Signed-off-by: James Almer <jamrial@gmail.com>
* avcodec/scpr: Use av_memcpy_backptr() in type 17 and 33Michael Niedermayer2019-08-111-4/+3
| | | | | | | | | | | | This makes the changed code-path faster. Change not tested except with the fuzzer testcase as I found no other testcase. Improves: Timeout (136sec -> 74sec) Improves: 16040/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_SCPR_fuzzer-5705876062601216 Reviewed-by: Paul B Mahol <onemda@gmail.com> Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
* avcodec/scpr: fix checking ret value of decode_run_iMarton Balint2019-05-241-1/+1
| | | | | | Fixes Coverity CID 1441460. Signed-off-by: Marton Balint <cus@passwd.hu>
* avcodec/scpr: check remaining data after decodeMichael Niedermayer2019-05-091-0/+3
| | | | | | | | Fixes Timeout (29sec -> 14sec) Fixes: 13713/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_SCPR_fuzzer-5756778069884928 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/scpr: avoid using uninitialized valuePaul B Mahol2019-04-281-1/+4
| | | | Fixes #7872.
* avcodec/scpr: Perform frame copy laterMichael Niedermayer2019-03-201-4/+4
| | | | | | | Optimization found while looking at 13442/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_SCPR_fuzzer-5758293933293568 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/scpr: Fix use of uninitialized variableMichael Niedermayer2019-03-061-1/+1
| | | | | | | | Fixes: Undefined shift Fixes: 12911/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_SCPR_fuzzer-5677102915911680 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/scpr: add version 3 supportPaul B Mahol2018-11-181-308/+58
| | | | Signed-off-by: Paul B Mahol <onemda@gmail.com>
* avcodec/scpr: Skip frames which change nothingMichael Niedermayer2018-09-301-1/+3
| | | | | | | | Fixes: Timeout Fixes: 10292/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_SCPR_fuzzer-5687943864254464 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/scpr: stop checking for overread twicePaul B Mahol2018-09-091-2/+2
|
* avcodec/scpr: make sure count and min are validPaul B Mahol2018-09-071-1/+3
|
* avcodec/scpr: refactor repeated code into decode_units()Paul B Mahol2018-09-011-48/+35
|
* avcodec/scpr: error out if run length is <= 0Paul B Mahol2018-08-291-0/+6
|
* avcodec/scpr: Check for min > max in decompress_p()Michael Niedermayer2018-08-161-0/+3
| | | | | | | | Fixes: Timeout Fixes: 9342/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_SCPR_fuzzer-4795990841229312 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/scpr: fix decoding of prev+top-topleft prediction in keyframesPaul B Mahol2018-04-021-3/+3
| | | | Signed-off-by: Paul B Mahol <onemda@gmail.com>
* avcodec/scpr: check for possible out of array accessPaul B Mahol2018-04-021-0/+4
| | | | Signed-off-by: Paul B Mahol <onemda@gmail.com>
* avcodec/scpr: Fix reading a pixel before the firstMichael Niedermayer2018-02-111-0/+4
| | | | | | | Fixes: 5540/clusterfuzz-testcase-minimized-6122458273808384 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/scpr: optimize shift loop.Michael Niedermayer2017-09-101-1/+12
| | | | | | | | | | | Speeds code up from 50sec to 15sec Fixes Timeout Fixes: 3242/clusterfuzz-testcase-5811951672229888 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Reviewed-by: James Almer <jamrial@gmail.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* scpr: Added missing error checkDerek Buitenhuis2017-07-071-0/+2
| | | | Signed-off-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
* avcodec/scpr: mask bits to prevent out of array readMichael Niedermayer2017-05-161-2/+2
| | | | | | | | Fixes: 1615/clusterfuzz-testcase-minimized-6625214647500800 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/targets/ffmpeg Reviewed-by: Paul B Mahol <onemda@gmail.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/scpr: Fix multiple runtime error: index 256 out of bounds for type ↵Michael Niedermayer2017-05-131-0/+3
| | | | | | | | | 'unsigned int [256]' Fixes: 1519/clusterfuzz-testcase-minimized-5286680976162816 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/targets/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/scpr: Check y in first line loop in decompress_i()Michael Niedermayer2017-05-111-0/+3
| | | | | | | | Fixes: out of array access Fixes: 1478/clusterfuzz-testcase-minimized-5285486908145664 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/targets/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/scpr: Fix multiple runtime error: signed integer overflow: ↵Michael Niedermayer2017-05-091-1/+1
| | | | | | | | | 2147483647 + 1 cannot be represented in type 'int' Fixes: 1422/clusterfuzz-testcase-minimized-5030993939398656 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/targets/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/scpr: use correct linesize for prev framePaul B Mahol2017-03-121-1/+1
| | | | Signed-off-by: Paul B Mahol <onemda@gmail.com>
* avcodec/scpr: fix top left prediction for special case when x is 0 for keyframesPaul B Mahol2017-03-031-10/+25
| | | | Signed-off-by: Paul B Mahol <onemda@gmail.com>
* avcodec/scpr: check if total_freq is 0 in decode0Paul B Mahol2017-02-271-6/+19
| | | | | | Fixes SIGFPE, closes #6196. Signed-off-by: Paul B Mahol <onemda@gmail.com>
* avcodec/scpr: add support for older versionPaul B Mahol2017-02-261-5/+46
| | | | Signed-off-by: Paul B Mahol <onemda@gmail.com>
* avcodec/scpr: remove 4 dead storePaul B Mahol2017-02-241-4/+0
| | | | Signed-off-by: Paul B Mahol <onemda@gmail.com>
* avcodec/scpr: improve motion vectors checking for out of buffer writePaul B Mahol2017-02-241-2/+2
| | | | Signed-off-by: Paul B Mahol <onemda@gmail.com>
* avcodec/scpr: make sure that component value is <= 0x1F for 16 bpcPaul B Mahol2017-02-241-1/+3
| | | | Signed-off-by: Paul B Mahol <onemda@gmail.com>
* avcodec/scpr: improve check for out of range motion vectorsPaul B Mahol2017-02-231-1/+2
| | | | Signed-off-by: Paul B Mahol <onemda@gmail.com>
* avcodec/scpr: check that current row is in valid rangePaul B Mahol2017-02-231-0/+16
| | | | | | Stops writing out of dst array. Signed-off-by: Paul B Mahol <onemda@gmail.com>
* avcodec/scpr: do not allow out of array access for 16bit casePaul B Mahol2017-02-231-2/+2
| | | | Signed-off-by: Paul B Mahol <onemda@gmail.com>
* avcodec: add ScreenPressor decoderPaul B Mahol2017-02-221-0/+813
Signed-off-by: Paul B Mahol <onemda@gmail.com>