summaryrefslogtreecommitdiff
path: root/libavcodec/dnxhddec.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: use the new AVFrame interlace flags in all decoders and encodersJames Almer2023-05-041-7/+8
| | | | Signed-off-by: James Almer <jamrial@gmail.com>
* avcodec/dnxhddec: Only keep what is used from ScanTableAndreas Rheinhardt2022-10-241-4/+4
| | | | | | | Namely ScanTable.permutated. Reviewed-by: Peter Ross <pross@xvid.org> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/blockdsp: Remove unused AVCodecContext parameterAndreas Rheinhardt2022-09-211-1/+1
| | | | | | | Possible since be95df12bb06b183c8d2aea3b0831fdf05466cf3. Reviewed-by: Rémi Denis-Courmont <remi@remlab.net> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.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-2/+2
| | | | | | | | | 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-1/+0
| | | | | | | | | | | 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-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/codec_internal: Add FFCodec, hide internal part of AVCodecAndreas Rheinhardt2022-03-211-7/+7
| | | | | | | | | | | | | | | | 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-2/+1
| | | | | | | | | | | | | | | | | | | | | | | 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>
* Replace all occurences of av_mallocz_array() by av_calloc()Andreas Rheinhardt2021-09-201-1/+1
| | | | | | | They do the same. Reviewed-by: Paul B Mahol <onemda@gmail.com> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/dnxhddec: ignore second flag for encoded fieldPaul B Mahol2021-08-251-1/+1
| | | | | | And instead use previous field flag. Fixes decoding files produced by non-compliant encoders.
* avcodec/dnxhddec: check and propagate function return valuemaryam ebr2021-08-031-7/+15
| | | | | | | | Similar to CVE-2013-0868, here return value check for 'init_vlc' is needed. crafted DNxHD data can cause unspecified impact. Reviewed-by: Paul B Mahol <onemda@gmail.com> Signed-off-by: James Almer <jamrial@gmail.com>
* avcodec/dnxhddec: Mark decoder as init-threadsafeAndreas Rheinhardt2021-05-101-0/+1
| | | | 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/dnxhd: Make ff_dxnhd_get_cid_table return a pointer, not indexAndreas Rheinhardt2021-01-261-6/+7
| | | | | | | All callers only use the index into ff_dnxhd_cid_table to get a pointer to the desired entry. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* lavu/mem: move the DECLARE_ALIGNED macro family to mem_internal on next+1 bumpAnton Khirnov2021-01-011-0/+2
| | | | They are not properly namespaced and not intended for public use.
* 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).
* libavcodec, libpostproc: Remove outcommented START/STOP_TIMERAndreas Rheinhardt2020-03-141-3/+0
| | | | | | | as well as includes of libavutil/timer.h. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/dnxhddec: properly set colorspacePaul B Mahol2020-01-291-1/+8
|
* avcodec/dnxhddec: fix block alignmentRamiro Polla2018-12-261-1/+1
| | | | | | blockdsp requires 32 byte alignment. Signed-off-by: James Almer <jamrial@gmail.com>
* avcodec/dnxhddec: use init_get_bits8()Paul B Mahol2018-12-031-2/+6
|
* avcodec/dnxhddec: ask for samples with alphaPaul B Mahol2018-09-061-0/+6
|
* avcodec/dnxhddec: Check dc vlcMichael Niedermayer2018-01-051-1/+5
| | | | | | | | | Fixes: signed integer overflow: 1024 + 2147483640 cannot be represented in type 'int' Fixes: 4671/clusterfuzz-testcase-minimized-6027464343027712 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/dnxhddec: Do not overwrite colorspace if the container has set it.Steven Robertson2017-11-301-1/+3
| | | | | | | | | | | | | | | | | | | | | The existing logic overrides container metadata even in cases where the container metadata must be trusted (e.g. HDR). The original spec had no provision for specifying color volume, so many files rely on the assumption of Rec. 709. An update to the spec included a 'clv' field for explicitly signaling that the container should be trusted in an existing bitfield in the frame header, but the default of 0 from old encoders forces Rec. 709, which would break any HDR stream. Because there is no place in DNxHR for specifying a transfer function, DNxHR HDR files must include container-level color information. This patch maintains the existing behavior of choosing the 709 over the 601 matrix when container-level information is missing, and allows container-level information to win if present. Signed-off-by: Steven Robertson <steven@strobe.cc> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/dnxhddec: Move mb height check out of non hr branchMichael Niedermayer2017-07-271-2/+6
| | | | | | | | Fixes: out of array access Fixes: poc.dnxhd Found-by: Bingchang, Liu@VARAS of IIE Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/dnxhddec: fix -Wformat warning raised by DJGPPJames Almer2017-04-111-1/+1
| | | | | | | FF_ARRAY_ELEMS returns a size_t value. Reviewed-by: ubitux Signed-off-by: James Almer <jamrial@gmail.com>
* avcodec/dnxhddec: add support for very big resolutionsPaul B Mahol2017-04-111-3/+7
| | | | Signed-off-by: Paul B Mahol <onemda@gmail.com>
* dnxhd: initialize DNXHDContext::avctx to each thread's respective one.Ronald S. Bultje2017-03-311-0/+1
| | | | | | | | Otherwise all thread's private contexts have the avctx pointer set to the AVCodecContext of the first thread, which means all writes to ctx->avctx->* (in e.g. read_header) are effectively race conditions. Fixes fate-dnxhd under tsan.
* Fix all -Wformat warnings raised by DJGPPClément Bœsch2017-03-291-4/+5
|
* Merge commit '1263b2039eb5aaf1522e9de9f07c787ab30a5f50'Clément Bœsch2017-03-241-2/+2
|\ | | | | | | | | | | | | * commit '1263b2039eb5aaf1522e9de9f07c787ab30a5f50': Adjust printf conversion specifiers to match variable signedness Merged-by: Clément Bœsch <u@pkh.me>
| * Adjust printf conversion specifiers to match variable signednessDiego Biurrun2016-10-281-5/+5
| |
| * dnxhddec: Enable frame threadingVittorio Giovara2015-09-291-8/+11
| | | | | | | | Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
* | avcodec/dnxhddec: fix decoding of DNxHR HQX 10-bitPaul B Mahol2017-02-221-1/+4
| | | | | | | | Signed-off-by: Paul B Mahol <onemda@gmail.com>
* | lavc: Remove CR/LF from avpriv_request_sample() calls.Carl Eugen Hoyos2016-12-031-1/+1
| |
* | libavcodec/dnxhd: Enable 12-bit DNxHR support.Steven Robertson2016-08-031-6/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 10- and 12-bit DNxHR use the same DC coefficient decoding process and VLC table, just with a different shift value. From SMPTE 2019-1:2016, 8.2.4 DC Coefficient Decoding: "For 8-bit video sampling, the maximum value of η=11 and for 10-/12-bit video sampling, the maximum value of η=13." A sample file will be uploaded to show that with this patch, things decode correctly: dnxhr_hqx_12bit_1080p_smpte_colorbars_davinci_resolve.mov Signed-off-by: Steven Robertson <steven@strobe.cc> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* | avcodec/dnxhddata: move avpriv_dnxhd_parse_header_prefix to a headerJames Almer2016-07-251-1/+1
| | | | | | | | | | | | | | | | | | It's a small and simple function that can be inlined. This removes one private symbol and should reduce object dependencies with the next major bump Signed-off-by: James Almer <jamrial@gmail.com>
* | libavcodec/dnxhd: add dnxhr profilesMark Reid2016-07-201-0/+22
| | | | | | | | Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* | libavcodec/dnxhd: add support more dnxhr header prefixesMark Reid2016-07-161-1/+1
| | | | | | | | Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* | libavcodec/dnxhd_parser: add parser and probe support raw 444 and dnxhr formatsMark Reid2016-02-141-8/+4
| | | | | | | | Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* | avcodec/dnxhddec: Fix runtime error: left shift of negative valueMichael Niedermayer2015-12-041-1/+1
| | | | | | | | | | | | | | Fixes: 2abd25478c62a675f335fac00b467023/asan_static-oob_10aff98_1227_8811480c6ef1e970a7977ceb7e5a9958.mxf Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* | avcodec/dnxhddec: Disable 12bit by defaultMichael Niedermayer2015-11-291-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | The DC VLC table used is too small, fixing this requires a sample, thus request a sample. Some samples are said to work even though the table has the wrong size, thus this is left enabled if the user enables experimental features. Fixes: 2abd25478c62a675f335fac00b467023/asan_static-oob_10aff98_1227_8811480c6ef1e970a7977ceb7e5a9958.mxf Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind Approved-by: kurosu Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* | avcodec/dnxhddec: Make mb_scan_index a fixed length arrayMichael Niedermayer2015-11-061-10/+2
| | | | | | | | | | | | | | | | Fixes null pointer dereference Fixes: 5c9d1a6f74a12763fc7c9dd7834022b9/signal_sigsegv_11f78d9_1461_ecee3c5e7205457498e79b3ffaf21d0c.mxf Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* | dnxhd: interleave AC levels and flagsChristophe Gisquet2015-10-151-4/+3
| | | | | | | | | | | | | | This allows more efficient access to the array as the level and flags are contiguous. Around 4% faster coefficient decoding. Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* | dnxhddec: better support for 4:4:4Christophe Gisquet2015-10-071-33/+76
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Profiles 1256 & 1270 (currently) signal at the frame header and MB levels the colorspace used, either RGB or YUV. While a MB-level varying colorspace is not supported, whether it is constant can be tracked so as to determine the exact colorspace. This requires having bitdepth and the ACT and 4:4:4 flags, in turn needing the CID. Because setting those before having validated enough things may result in invalid/unset DSP fucntions, setting the bitdepth in the context is delayed. It is not tested against a true RGB sequence, though. Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* | dnxhd: add better support for CIDs 1270 to 1274Jeremy James2015-10-051-21/+71
| | | | | | | | | | | | | | | | | | | | | | These are DNxHR profiles with the following properties: - Variable size in a profile (property added in a previous commit), requiring variable-sized macroblock table; - Variable bitdepth, up to 12 bits. - Better validation of buffer sizes and positions Signed-off-by: Christophe Gisquet <christophe.gisquet@gmail.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* | dnxhd: add CID 1270Christophe Gisquet2015-10-051-1/+1
| | | | | | | | | | | | | | | | | | | | This a 4:4:4 10 bits profile, where image size is not fixed by the profile, and which strays a bit outside the old frame header parsing code. Fixes ticket #4581 (DNxHR is not stricly supported, but that sequence is). Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* | dnxhd: add decoder support for DNxHRJeremy James2015-10-051-1/+2
| | | | | | | | | | Signed-off-by: Christophe Gisquet <christophe.gisquet@gmail.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>