summaryrefslogtreecommitdiff
path: root/libavcodec/dnxhddec.c
Commit message (Collapse)AuthorAge
* 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).
* libavcodec, libpostproc: Remove outcommented START/STOP_TIMERAndreas Rheinhardt2020-03-14
| | | | | | | 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-29
|
* avcodec/dnxhddec: fix block alignmentRamiro Polla2018-12-26
| | | | | | blockdsp requires 32 byte alignment. Signed-off-by: James Almer <jamrial@gmail.com>
* avcodec/dnxhddec: use init_get_bits8()Paul B Mahol2018-12-03
|
* avcodec/dnxhddec: ask for samples with alphaPaul B Mahol2018-09-06
|
* avcodec/dnxhddec: Check dc vlcMichael Niedermayer2018-01-05
| | | | | | | | | 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-30
| | | | | | | | | | | | | | | | | | | | | 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-27
| | | | | | | | 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-11
| | | | | | | 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-11
| | | | Signed-off-by: Paul B Mahol <onemda@gmail.com>
* dnxhd: initialize DNXHDContext::avctx to each thread's respective one.Ronald S. Bultje2017-03-31
| | | | | | | | 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-29
|
* Merge commit '1263b2039eb5aaf1522e9de9f07c787ab30a5f50'Clément Bœsch2017-03-24
|\ | | | | | | | | | | | | * 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-28
| |
| * dnxhddec: Enable frame threadingVittorio Giovara2015-09-29
| | | | | | | | Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
* | avcodec/dnxhddec: fix decoding of DNxHR HQX 10-bitPaul B Mahol2017-02-22
| | | | | | | | Signed-off-by: Paul B Mahol <onemda@gmail.com>
* | lavc: Remove CR/LF from avpriv_request_sample() calls.Carl Eugen Hoyos2016-12-03
| |
* | libavcodec/dnxhd: Enable 12-bit DNxHR support.Steven Robertson2016-08-03
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-25
| | | | | | | | | | | | | | | | | | 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-20
| | | | | | | | Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* | libavcodec/dnxhd: add support more dnxhr header prefixesMark Reid2016-07-16
| | | | | | | | Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* | libavcodec/dnxhd_parser: add parser and probe support raw 444 and dnxhr formatsMark Reid2016-02-14
| | | | | | | | Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* | avcodec/dnxhddec: Fix runtime error: left shift of negative valueMichael Niedermayer2015-12-04
| | | | | | | | | | | | | | 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-29
| | | | | | | | | | | | | | | | | | | | | | | | | | 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-06
| | | | | | | | | | | | | | | | 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-15
| | | | | | | | | | | | | | 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-07
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-05
| | | | | | | | | | | | | | | | | | | | | | 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-05
| | | | | | | | | | | | | | | | | | | | 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-05
| | | | | | | | | | Signed-off-by: Christophe Gisquet <christophe.gisquet@gmail.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* | dnxhddec: Introduce DNXHD_VARIABLEChristophe Gisquet2015-10-05
| | | | | | | | | | | | | | Currently not used, but will be used to indicate that a CIDEntry field is not set, because it is variable, and that checks should be adapted. Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* | dnxhddec: cleanup frame header parsingChristophe Gisquet2015-10-05
| | | | | | | | | | | | | | Rely more on the actual syntax from the specs (also seen in the encoder code). Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* | dnxhddec: init scantable once permutation is setChristophe Gisquet2015-10-02
| | | | | | | | | | | | Otherwise, the dsp may change without its permuation being applied. Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* | dnxhddec: use dequantization formula from specsChristophe Gisquet2015-10-02
| | | | | | | | | | | | | | | | | | The current one, while correct, does not yield the best possible results. The specificiations suggest another formula, which results in quality gains in the decoded output from fate tests. This justifies changing said formula. Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* | dnxhddec: initialize with mb-aligned dimensionsChristophe Gisquet2015-10-02
| | | | | | | | | | | | The coded size is a multiple of the macroblock size, which is 16. Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* | Merge commit 'c49cbecbae5a42f4ca004197b0118cc50aaaca2e'Hendrik Leppkes2015-09-29
|\| | | | | | | | | | | | | * commit 'c49cbecbae5a42f4ca004197b0118cc50aaaca2e': dnxhddec: Decode and use interlace mb flag Merged-by: Hendrik Leppkes <h.leppkes@gmail.com>
| * dnxhddec: Decode and use interlace mb flagChristophe Gisquet2015-09-29
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This bit is 1 in some samples, and seems to coincide with interlaced mbs and CID1260. 2008 specs do not know about it, and maintain qscale is 11 bits. This looks oversized, but may help larger bitdepths. Currently, it leads to an obviously incorrect qscale value, meaning its syntax is shifted by 1. However, reading 11 bits also leads to obviously incorrect decoding: qscale seems to be 10 bits. However, as most profiles still have 11bits qscale, the feature is restricted to the CID1260 profile (this flag is dependent on a higher-level flag located in the header). The encoder writes 12 bits of syntax, last and first bits always 0, which is now somewhat inconsistent with the decoder, but ends up with the same effect (progressive + reserved bit). Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
* | dnxhddec: add my contributionsChristophe Gisquet2015-09-28
| | | | | | | | Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* | dnxhddec: reindent/cosmeticsChristophe Gisquet2015-09-28
| | | | | | | | Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* | dnxhddec: use unsafe bitstream readerChristophe Gisquet2015-09-28
| | | | | | | | | | | | | | Each line is padded by the format, and errors are now reported and stop the decoding. Around 5% speedup. Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* | dnxhddec: check and report bitstream errorsChristophe Gisquet2015-09-27
| | | | | | | | | | | | | | This only occur when an overrun in coefficient decoding is detected. Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* | dnxhddec: simplify block parsing callsChristophe Gisquet2015-09-27
| | | | | | | | | | | | Fewer arguments, less duplicated code. Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* | dnxhddec: remove unused qscale parameterChristophe Gisquet2015-09-27
| | | | | | | | Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* | dnxhddec: implement slice multithreadingChristophe Gisquet2015-09-27
| | | | | | | | | | | | | | Around 3x speedup with 4 threads. Maybe more mb lines should be batched per thread, but that's good enough for a first try. Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* | dnxhddec: parse and print adaptive color transformChristophe Gisquet2015-09-26
| | | | | | | | | | | | | | | | | | | | | | | | Indicates a YCbCr->RGB transform at the block level. Although nothing explicitly states it, this would assume the actual content is planar RGB. Currently unsupported, but the one sequence I found using it flagged every mb that way, actually meaning the content was YCbCr, and thus best left to the output format to decide what to do of it. Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* | dnxhddec: proper rule for interlaced mb flagChristophe Gisquet2015-09-26
| | | | | | | | | | | | | | It currently only applies to CID 1260, but this flag is dependent on a higher-level flag located in the header. Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* | dnxhddec: indicate colorspaceChristophe Gisquet2015-09-26
| | | | | | | | | | | | It is supposed to only old BT.709 colorspaces. Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* | dnxhddec: decode and use interlace mb flagChristophe Gisquet2015-09-25
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This bit is 1 in some samples, and seems to coincide with interlaced mbs and CID1260. 2008 specs do not know about it, and maintain qscale is 11 bits. This looks oversized, but may help larger bitdepths. Currently, it leads to an obviously incorrect qscale value, meaning its syntax is shifted by 1. However, reading 11 bits also leads to obviously incorrect decoding: qscale seems to be 10 bits. However, as most profiles still have 11bits qscale, the feature is restricted to the CID1260 profile. The encoder writes 12 bits of syntax, last and first bits always 0, which is now somewhat inconsistent with the decoder, but ends up with the same effect (progressive + reserved bit). Partially fixes ticket #4876. Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* | Merge commit 'def97856de6021965db86c25a732d78689bd6bb0'Michael Niedermayer2015-07-27
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * commit 'def97856de6021965db86c25a732d78689bd6bb0': lavc: AV-prefix all codec capabilities Conflicts: cmdutils.c ffmpeg.c ffplay.c libavcodec/8svx.c libavcodec/aacenc.c libavcodec/ac3dec.c libavcodec/adpcm.c libavcodec/alac.c libavcodec/atrac3plusdec.c libavcodec/bink.c libavcodec/dnxhddec.c libavcodec/dvdec.c libavcodec/dvenc.c libavcodec/ffv1dec.c libavcodec/ffv1enc.c libavcodec/fic.c libavcodec/flacdec.c libavcodec/flacenc.c libavcodec/flvdec.c libavcodec/fraps.c libavcodec/frwu.c libavcodec/gifdec.c libavcodec/h261dec.c libavcodec/hevc.c libavcodec/iff.c libavcodec/imc.c libavcodec/libopenjpegdec.c libavcodec/libvo-aacenc.c libavcodec/libvorbisenc.c libavcodec/libvpxdec.c libavcodec/libvpxenc.c libavcodec/libx264.c libavcodec/mjpegbdec.c libavcodec/mjpegdec.c libavcodec/mpegaudiodec_float.c libavcodec/msmpeg4dec.c libavcodec/mxpegdec.c libavcodec/nvenc_h264.c libavcodec/nvenc_hevc.c libavcodec/pngdec.c libavcodec/qpeg.c libavcodec/ra288.c libavcodec/rv10.c libavcodec/s302m.c libavcodec/sp5xdec.c libavcodec/takdec.c libavcodec/tiff.c libavcodec/tta.c libavcodec/utils.c libavcodec/v210dec.c libavcodec/vp6.c libavcodec/vp9.c libavcodec/wavpack.c libavcodec/yop.c Merged-by: Michael Niedermayer <michael@niedermayer.cc>