summaryrefslogtreecommitdiff
path: root/libavcodec/speedhq.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/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>
* configure: Use a separate config_components.h header for $ALL_COMPONENTSMartin Storsjö2022-03-16
| | | | | | | | This avoids unnecessary rebuilds of most source files if only the list of enabled components has changed, but not the other properties of the build, set in config.h. Signed-off-by: Martin Storsjö <martin@martin.st>
* avcodec/mpeg12.h: Move decoder-only stuff to a new headerAndreas Rheinhardt2022-02-13
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/speedhq: Replace always-true check by assertAndreas Rheinhardt2021-12-16
| | | | | | Should fix Coverity tickets #1473572 and #1473504. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/speedhq, speedhqenc: Make codecs init-threadsafeAndreas Rheinhardt2021-05-05
| | | | | | | | | | | | The SpeedHQ decoder uses and initializes a RLTable's VLC, yet it also initializes other parts of the RLTable that it does not use. This has downsides besides being wasteful: Because the SpeedHQ encoder also initializes these additional fields, there is a potential for data races (and therefore undefined behaviour). In fact, removing the superfluous initializations from the decoder automatically makes both the decoder and the encoder init-threadsafe. This commit does so. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.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/speedhq: Width < 8 is not supportedMichael Niedermayer2021-03-19
| | | | | | | | | Fixes: out of array access Fixes: 31733/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_SPEEDHQ_fuzzer-4704307963363328 Fixes: 31736/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_SPEEDHQ_fuzzer-6190960292790272 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/speedhq: fix decoding non 444 subsampling when width is not multiple ↵Paul B Mahol2021-03-04
| | | | of 16
* lavu: move LOCAL_ALIGNED from internal.h to mem_internal.hAnton Khirnov2021-01-01
| | | | That is a more appropriate place for it.
* configure, libavcodec/speedhq: Fix compiling SpeedHQ encoderAndreas Rheinhardt2020-12-31
| | | | | Reviewed-by: Paul B Mahol <onemda@gmail.com> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avcodec/speedhq: Remove castAndreas Rheinhardt2020-12-31
| | | | | Reviewed-by: Anton Khirnov <anton@khirnov.net> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avcodec: add SpeedHQ encoderJean-Baptiste Kempf2020-11-24
|
* avcodec/speedhq: Avoid reversing BE codes for LE bitstream readerAndreas Rheinhardt2020-10-12
| | | | | Reviewed-by: Paul B Mahol <onemda@gmail.com> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avcodec/speedhq: Don't use ff_ prefix for static symbolsAndreas Rheinhardt2020-10-12
| | | | | Reviewed-by: Paul B Mahol <onemda@gmail.com> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avcodec/speedhq: Don't pretend reading DC can failAndreas Rheinhardt2020-10-12
| | | | | | | | It can't, because the tables used don't have any loose ends. This also fixes a bug in the only caller of decode_dc_le(): It didn't check the return value. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* Speedhq: Decode field 2 correctlyJean-Baptiste Kempf2020-07-06
| | | | This is similar to field 1 (effd2e72)
* avcodec/speedhq: Make speedhq_vlc constMichael Niedermayer2018-10-07
| | | | Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* libavcodec/blockdsp : add AVX versionMartin Vignali2017-10-03
| | | | | | | Also modify the required alignment, to 32 instead of 16 for several codecs Signed-off-by: James Almer <jamrial@gmail.com>
* speedhq: fix behavior of single-field decodingSteinar H. Gunderson2017-08-03
| | | | | | | | | | The height convention for decoding frames with only a single field made sense for compatibility with legacy decoders, but doesn't really match the convention used by NDI, which is the primary (only?) user. Thus, change it to simply assuming that if the two fields overlap, the frame is meant to be a single field and the frame height matches the field height. Signed-off-by: James Almer <jamrial@gmail.com>
* speedhq: fix decoding artifactsSteinar H. Gunderson2017-02-21
| | | | | | | | | | | | | | | | The quantization table is stored in the natural order, but when we access it, we use an index that's in zigzag order, causing us to read the wrong value. This causes artifacts, especially in areas with horizontal or vertical edges. The artifacts look a lot like the DCT ringing artifacts you'd expect to see from a low-bitrate file, but when comparing to NewTek's own decoder, it's obvious they're not supposed to be there. Fix by simply storing the scaled quantization table in zigzag order. Performance is unchanged. Reviewed-by: Paul B Mahol <onemda@gmail.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* speedhq: fix out-of-bounds writeSteinar H. Gunderson2017-02-02
| | | | | | | | | | | | | Certain alpha run lengths (for SHQ1/SHQ3/SHQ5) could be stored in both long and short versions, and we would only accept the short version, returning -1 (invalid code) for the others. This could cause an out-of-bounds write on malicious input, as discovered by Andreas Cadhalpun during fuzzing. Fix by simply allowing both versions, leaving no invalid codes in the alpha VLC. Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
* avcodec/speedhq: Fix warning about "initialization from incompatible pointer ↵Michael Niedermayer2017-01-19
| | | | | | type" Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* speedhq: Align blocks variable properly.Steinar H. Gunderson2017-01-13
| | | | | | | | | Seemingly ff_clear_block_sse assumed that the block array is aligned, so make sure it is. Fixes ticket #6079 Signed-off-by: James Almer <jamrial@gmail.com>
* avcodec: add Newtek SpeedHQ decoderSteinar H. Gunderson2017-01-11
This decoder can decode all existing SpeedHQ formats (SHQ0–5, 7, and 9), including correct decoding of the alpha channel. 1080p is decoded in 142 fps on one core of my i7-4600U (2.1 GHz Haswell), about evenly split between bitstream reader and IDCT. There is currently no attempt at slice or frame threading, even though the format trivially supports both. NewTek very helpfully provided a full set of SHQ samples, as well as source code for an SHQ2 encoder (not included) and assistance with understanding some details of the format.