summaryrefslogtreecommitdiff
path: root/libavcodec/hevc_refs.c
Commit message (Collapse)AuthorAge
* lavc/hevc_refs: exclude current frame from long term refsXu Guangxin2022-07-27
| | | | | | | | | | | | | suppose a. You have 3 frames, 0, 1, 4096. b. The ltMask is 0xfff and use_msb is 0. c. The 0, 1 are lt refs for 4096. d. you are decoding frame 4096, and get the 0 frame. Since 4096 & ltMask is 0 too, even you want get 0, find_ref_idx may give you 4096. add_candidate_ref will report an error for this Tested-by: Fei Wang <fei.w.wang@intel.com> Signed-off-by: Xu Guangxin <guangxin.xu@intel.com>
* lavc/hevcdec: do not let missing ref frames invovled in dpb processXu Guangxin2022-07-27
| | | | | | | | | | We will generate a new frame for a missed reference. The frame can only be used for reference. We assign an invalid decode sequence to it, so it will not be involved in any dpb process. Tested-by: Fei Wang <fei.w.wang@intel.com> Signed-off-by: Fei Wang <fei.w.wang@intel.com> Signed-off-by: Xu Guangxin <guangxin.xu@intel.com>
* lavc/hevc_refs: fix dpb logical for IRAPXu Guangxin2022-07-27
| | | | | | | | According to C.5.2.2, item 2. When we got an IRAP, and the NoOutputOfPriorPicsFlag = 0, we need bump all outputable frames. Tested-by: Fei Wang <fei.w.wang@intel.com> Signed-off-by: Xu Guangxin <guangxin.xu@intel.com>
* avcodec/hevc_refs: Constify ff_hevc_get_ref_list()Andreas Rheinhardt2022-07-09
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/hevc_refs: don't use the frame's AVBufferRef sizes when initializing ↵James Almer2022-03-15
| | | | | | | | | planes Use the actual plane sizes instead. Reviewed-by: Anton Khirnov <anton@khirnov.net> Signed-off-by: James Almer <jamrial@gmail.com>
* avcodec/thread: Don't use ThreadFrame when unnecessaryAndreas Rheinhardt2022-02-09
| | | | | | | | | | | | | | | | | | | | | | | 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>
* avcodec/threadframe: Add ff_thread_(get|release)_ext_buffer()Andreas Rheinhardt2022-02-09
| | | | | | | | | These will be used by the codecs that need allocated progress and is in preparation for no longer using ThreadFrame by the codecs that don't. Reviewed-by: Anton Khirnov <anton@khirnov.net> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/thread: Move ff_thread_(await|report)_progress to new headerAndreas Rheinhardt2022-02-09
| | | | | | | | | | This is in preparation for further commits that will stop using ThreadFrame for frame-threaded codecs that don't use ff_thread_(await|report)_progress(); the API for those codecs having inter-frame depdendencies will live in threadframe.h. Reviewed-by: Anton Khirnov <anton@khirnov.net> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* all: Remove unnecessary libavcodec/internal.h inclusionsAndreas Rheinhardt2022-02-08
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/hevcdec: apply H.274 film grainNiklas Haas2021-10-15
| | | | | | | | | | | | | | | | Similar in spirit and design to 66845cffc3bbb, but slightly simpler due to the lack of interlaced frames in HEVC. See that commit for more details. For the seed value, since no specification for this appears to exist, I semi-arbitrarily decided to base it off the POC id alone, since there's no analog of the idr_pic_id in HEVC's I-frames. This design is stable across remuxes and seeks, but changes for adjacent frames with a period that's typically long enough not to be noticeable, which makes it satisfy all of the requirements that a film grain seed should have. Tested with and without threading, using a patch to insert film grain metadata artificially (for lack of real files containing film grain).
* hevc_refs: reduce code duplication in find_ref_idx()Anton Khirnov2020-06-08
|
* lavc/hevc_refs: Fix the logic of find_ref_idx()Xu Guangxin2020-05-27
| | | | | | | | | | | | | | | | | | | | | | | | | Currently find_ref_idx() would trigger 2 scans in DPB to find the requested POC: 1. Firstly, ignore MSB of ref->poc and search for the requested POC; 2. Secondly, compare the entire ref->poc with requested POC; For long term reference, we are able to only check LSB if MSB is not presented(e.g. delta_poc_msb_present_flag == 0). However, for short term reference, we should never ignore poc's MSB and it should be kind of bit-exact. (Details in 8.3.2) Otherwise this leads to decoding failures like: [hevc @ 0x5638f4328600] Error constructing the frame RPS. [hevc @ 0x5638f4328600] Error parsing NAL unit #2. [hevc @ 0x5638f4338a80] Could not find ref with POC 21 Error while decoding stream #0:0: Invalid data found when processing input Search the requested POC based on whether MSB is used, and avoid the 2-times scan for DPB buffer. This benefits both native HEVC decoder and integrated HW decoders. Signed-off-by: Xu Guangxin <guangxin.xu@intel.com> Signed-off-by: Linjie Fu <linjie.fu@intel.com>
* avcodec/hevc_refs: Optimize 16bit generate_missing_ref()Michael Niedermayer2019-08-11
| | | | | | | | Fixes: Timeout (86sec -> 8sec) [these numbers assume also "[FFmpeg-devel] [PATCH 2/5] [RFC] avcodec/hevcdec: Check for overread in hls_decode_entry()"] Fixes: 15702/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_HEVC_fuzzer-5657764929470464 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/hevcdec: make ff_hevc_frame_nb_refs take a const pointerTimo Rothenpieler2018-05-10
|
* avcodec/hevc: remove videotoolbox hackAman Gupta2018-05-09
| | | | | | | No longer required since 63d875772d. The equivalent hack for h264 was removed in that commit, but this one was missed. Signed-off-by: Aman Gupta <aman@tmm1.net>
* avcodec/videotoolbox: add hevc supportAman Gupta2017-09-28
| | | | Signed-off-by: Aman Gupta <aman@tmm1.net>
* avcodec/hevc_refs: Check nb_refs in add_candidate_ref()Michael Niedermayer2017-06-15
| | | | | | | | Fixes: runtime error: index 16 out of bounds for type 'int [16]' Fixes: 2209/clusterfuzz-testcase-minimized-5012343912136704 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/hevcdec: export cropping information instead of handling it internallyJames Almer2017-05-26
| | | | | | | | | | | | | | | | This merges commit a02ae1c6837a54ed9e7735da2b1f789b2f4b6e13 from libav, originally written by Anton Khirnov and skipped in fc63d5ceb357c4b760cb02772de0b50d0557140f. libavcodec/hevc_parser.c | 6 ++++-- libavcodec/hevc_ps.c | 31 ++++++++++++------------------- libavcodec/hevc_ps.h | 2 -- libavcodec/hevc_refs.c | 18 +++++------------- libavcodec/hevcdec.c | 7 ++++--- libavcodec/hevcdec.h | 2 -- 6 files changed, 25 insertions(+), 41 deletions(-) Signed-off-by: James Almer <jamrial@gmail.com>
* avcodec/hevcdec: remove HEVCContext usage from ff_hevc_compute_poc()James Almer2017-05-05
| | | | | | | | Move it to hevc_ps as well. This is in preparation for a following patch. Reviewed-by: Hendrik Leppkes <h.leppkes@gmail.com> Reviewed-by: Aaron Levinson <alevinsn@aracnet.com> Signed-off-by: James Almer <jamrial@gmail.com>
* avcodec/hevcdec: remove HEVCContext usage from hevc_seiJames Almer2017-05-05
| | | | | | | | Based on the H264 SEI implementation. Reviewed-by: Hendrik Leppkes <h.leppkes@gmail.com> Reviewed-by: Aaron Levinson <alevinsn@aracnet.com> Signed-off-by: James Almer <jamrial@gmail.com>
* Merge commit '0bfdcce4d42a6e654c00ea5f9237dc987626457f'James Almer2017-03-23
|\ | | | | | | | | | | | | * commit '0bfdcce4d42a6e654c00ea5f9237dc987626457f': hevc: move the SliceType enum to hevc.h Merged-by: James Almer <jamrial@gmail.com>
| * hevc: move the SliceType enum to hevc.hAnton Khirnov2016-10-21
| | | | | | | | | | Those values are decoder-independent and are also use by the VA-API encoder.
* | Merge commit 'f6e2f8a9ffda2247bffba991450990d075ea68e3'James Almer2017-03-23
|\| | | | | | | | | | | | | * commit 'f6e2f8a9ffda2247bffba991450990d075ea68e3': hevcdec: move parameter set parsing into a separate header Merged-by: James Almer <jamrial@gmail.com>
| * hevcdec: move parameter set parsing into a separate headerAnton Khirnov2016-10-16
| | | | | | | | | | This code is independent from the decoder, so it makes more sense for it to to have its own header.
* | Merge commit 'c359d624d3efc3fd1d83210d78c4152bd329b765'James Almer2017-03-23
|\| | | | | | | | | | | | | * commit 'c359d624d3efc3fd1d83210d78c4152bd329b765': hevcdec: move decoder-independent declarations into a separate header Merged-by: James Almer <jamrial@gmail.com>
| * hevcdec: move decoder-independent declarations into a separate headerAnton Khirnov2016-10-16
| | | | | | | | | | | | | | This way they can be reused by other code without including the whole decoder-specific hevcdec.h Also, add the HEVC_ prefix to them, since similarly named values exist for H.264 as well and are sometimes used in the same code.
* | Merge commit '4abe3b049d987420eb891f74a35af2cebbf52144'Clément Bœsch2017-03-23
|\| | | | | | | | | | | | | * commit '4abe3b049d987420eb891f74a35af2cebbf52144': hevc: rename hevc.[ch] to hevcdec.[ch] Merged-by: Clément Bœsch <u@pkh.me>
| * hevc: rename hevc.[ch] to hevcdec.[ch]Anton Khirnov2016-10-16
| | | | | | | | | | This is more consistent with the rest of libav and frees up the hevc.h name for decoder-independent shared declarations.
* | hevc: properly handle no_rasl_output_flag when removing pictures from the DPBHendrik Leppkes2015-09-20
| | | | | | | | | | | | | | Fixes ticket #4185. Reviewed-By: Mickael Raulet <Mickael.Raulet@insa-rennes.fr> Signed-off-by: Hendrik Leppkes <h.leppkes@gmail.com>
* | Merge commit '2268db2cd052674fde55c7d48b7a5098ce89b4ba'Hendrik Leppkes2015-09-08
|\| | | | | | | | | | | | | * commit '2268db2cd052674fde55c7d48b7a5098ce89b4ba': lavu: Drop the {minus,plus}1 suffix from AVComponentDescriptor fields Merged-by: Hendrik Leppkes <h.leppkes@gmail.com>
| * lavu: Drop the {minus,plus}1 suffix from AVComponentDescriptor fieldsVittorio Giovara2015-09-07
| | | | | | | | | | | | The new fields can be accessed directly and are more intelligible. Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
* | Merge commit 'd82e1adc2019135a2fc45372e0ed0b5ef107cdd0'Michael Niedermayer2015-07-12
|\| | | | | | | | | | | | | | | | | | | | | | | * commit 'd82e1adc2019135a2fc45372e0ed0b5ef107cdd0': hevc: move splitting the packet into NALUs into a separate function Conflicts: libavcodec/hevc.c libavcodec/hevc.h libavcodec/hevc_parse.c Merged-by: Michael Niedermayer <michael@niedermayer.cc>
| * hevc: move splitting the packet into NALUs into a separate functionAnton Khirnov2015-07-12
| | | | | | | | | | This function is independent of the decoding context, so we'll be able to use it in the parser.
* | Merge commit 'b11acd57326db6c2cc1475dd0bea2a06fbc85aa2'Michael Niedermayer2015-07-12
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * commit 'b11acd57326db6c2cc1475dd0bea2a06fbc85aa2': hevc: remove HEVCContext usage from hevc_ps Conflicts: libavcodec/hevc.c libavcodec/hevc_cabac.c libavcodec/hevc_filter.c libavcodec/hevc_mvs.c libavcodec/hevc_ps.c libavcodec/hevc_refs.c libavcodec/hevcpred_template.c Merged-by: Michael Niedermayer <michael@niedermayer.cc>
| * hevc: remove HEVCContext usage from hevc_psAnton Khirnov2015-07-12
| | | | | | | | | | | | Factor out the parameter sets into a separate struct and use it instead. This will allow us to reuse this code in the parser.
| * hevc: reindent after previous commitHendrik Leppkes2015-01-27
| | | | | | | | Signed-off-by: Anton Khirnov <anton@khirnov.net>
| * hevc: add hwaccel hooksHendrik Leppkes2015-01-27
| | | | | | | | Signed-off-by: Anton Khirnov <anton@khirnov.net>
* | avcodec/hevc_refs: Silence "Could not find ref with POC" for CRA/BLAMichael Niedermayer2015-03-21
| | | | | | | | | | | | | | Avoids error messages during seeking Found-by: cousin_luigi Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* | Merge commit '1dd021929f8157b88529ce1e6ab6351dd2899e89'Michael Niedermayer2015-01-27
|\| | | | | | | | | | | | | * commit '1dd021929f8157b88529ce1e6ab6351dd2899e89': hevc: clear unused refs on failure Merged-by: Michael Niedermayer <michaelni@gmx.at>
| * hevc: clear unused refs on failureAnton Khirnov2015-01-27
| |
| * hevc_refs: drop the handling of negative coordinates in ff_hevc_get_ref_list()Anton Khirnov2014-08-09
| | | | | | | | | | It makes no sense and cannot happen in any place from which this function is called.
* | hevc: reindent after previous commitHendrik Leppkes2015-01-27
| | | | | | | | Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* | hevc: add hwaccel hooksHendrik Leppkes2015-01-27
| | | | | | | | Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* | avcodec/hevc_refs: fix potential use of uninitialized min_idxMichael Niedermayer2014-12-10
| | | | | | | | Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* | hevc: fix skip_flagMickaël Raulet2014-07-28
| | | | | | | | | | | | cherry picked from commit 509ae456551005b9bf9b4d9730b6247c97fdd990 Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* | hevc: add support for bumping processMickaël Raulet2014-07-26
| | | | | | | | | | | | cherry picked from commit 8aa2fb7df3cffc67a3fd03a3a7eb49dbed4094c7 Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* | Merge commit '458e7c94830d1522997e33a0b5e87bd709e8a349'Michael Niedermayer2014-07-11
|\| | | | | | | | | | | | | | | | | | | | | | | * commit '458e7c94830d1522997e33a0b5e87bd709e8a349': hevc: implement pic_output_flag handling Conflicts: libavcodec/hevc.c libavcodec/hevc_refs.c See: 2eddf3a6efd80aa6e9d7f42ad9a892a82c5ece70 Merged-by: Michael Niedermayer <michaelni@gmx.at>
| * hevc: implement pic_output_flag handlingGildas Cocherel2014-07-11
| | | | | | | | | | | | Sample-Id: OPFLAG_B_Qualcomm_1.bit, OPFLAG_C_Qualcomm_1.bit Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com> Signed-off-by: Anton Khirnov <anton@khirnov.net>
| * Add HEVC decoderGuillaume Martres2013-10-31
| | | | | | | | | | | | | | | | | | | | | | Initially written by Guillaume Martres <smarter@ubuntu.com> as a GSoC project. Further contributions by the OpenHEVC project and other developers, namely: Mickaël Raulet <mraulet@insa-rennes.fr> Seppo Tomperi <seppo.tomperi@vtt.fi> Gildas Cocherel <gildas.cocherel@laposte.net> Khaled Jerbi <khaled_jerbi@yahoo.fr> Wassim Hamidouche <wassim.hamidouche@insa-rennes.fr> Vittorio Giovara <vittorio.giovara@gmail.com> Jan Ekström <jeebjp@gmail.com> Anton Khirnov <anton@khirnov.net> Martin Storsjö <martin@martin.st> Luca Barbato <lu_zero@gentoo.org> Yusuke Nakamura <muken.the.vfrmaniac@gmail.com> Reimar Döffinger <Reimar.Doeffinger@gmx.de> Diego Biurrun <diego@biurrun.de> Signed-off-by: Anton Khirnov <anton@khirnov.net>
* Revert "avcodec/hevc: fix outputted AVFrame.key_frame"Michael Niedermayer2014-05-15
| | | | | | | This is not correct Requested-by: mraulet This reverts commit 973de9ebf8796bc2720a9959a9a535cf4023c58a.