summaryrefslogtreecommitdiff
path: root/libavcodec/av1dec.c
Commit message (Collapse)AuthorAge
* avcodec/av1dec: don't set aspect ratio when it's not yet knownJames Almer2023-09-06
| | | | | | | | Makes the output of the native decoder consistent with external decoders like libdav1d with fate-enhanced-flv-av1. Reviewed-by: Zhao Zhili <quinkblack@foxmail.com> Signed-off-by: James Almer <jamrial@gmail.com>
* avcodec/avcodec: Add FFHWAccel, hide internals of AVHWAccelAndreas Rheinhardt2023-08-07
| | | | | | | | | This commit is the AVHWAccel analogue of commit 20f972701806be20a77f808db332d9489343bb78: It moves the private fields of AVHWAccel to a new struct FFHWAccel extending AVHWAccel in an internal header (namely hwaccel_internal.h). Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/decode: Extend ff_hwaccel_frame_priv_alloc()'s taskAndreas Rheinhardt2023-08-07
| | | | | | | | | | | | | | | | All usages of ff_hwaccel_frame_priv_alloc() have the same pattern: Check for whether a hwaccel is in use; check whether it needs private frame-specific data; allocate the AVBuffer and set it. This commit modifies ff_hwaccel_frame_priv_alloc() to perform this task on its own. (It also seems that the H.264 decoder did not perform proper cleanup in case the buffer could not be allocated. This has been changed.) Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/av1dec: remove FF_CODEC_CAP_SETS_PKT_DTS flagJames Almer2023-07-11
| | | | | | It has no effect on receive_frame() decoders. Signed-off-by: James Almer <jamrial@gmail.com>
* avcodec/av1dec: reset the fragment on extradata reading failureJames Almer2023-06-02
| | | | Signed-off-by: James Almer <jamrial@gmail.com>
* avcodec/av1dec: reset the fragment on reading failureJames Almer2023-06-02
| | | | | | | | Fixes: NULL pointer dereference Fixes: 59359/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_AV1_fuzzer-6726080594313216 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: James Almer <jamrial@gmail.com>
* av1dec: add Vulkan hwaccelLynne2023-05-29
|
* av1: set skip mode frames properlyDave Airlie2023-05-29
| | | | | | | | There are circumstances where the flag isn't set but the skip mode frames are. So don't use the inferred bit which has other inputs when deciding to pass the skip mode frames to the device. This fixes some decoding bugs on intel av1
* avcodec: add AVHWAccel.flush callbackLynne2023-05-29
|
* avcodec: add AVHWAccel.free_frame_priv callbackLynne2023-05-29
|
* avcodec/av1dec: convert to receive_frame()James Almer2023-05-25
| | | | | | | This removes the overhead of inserting the av1_frame_split bsf as part of the decoding process. Signed-off-by: James Almer <jamrial@gmail.com>
* lavc/av1*: fix exporting framerateAnton Khirnov2023-05-15
| | | | | | | | | * take num_ticks_per_picture_minus_1 into account, since that is a part of the framerate computation * stop exporting num_ticks_per_picture_minus_1 into AVCodecContext.ticks_per_frame, as that field is used for other purposes (in conjunction with repeat_pict, which is not used at all by av1)
* avcodec: use the new AVFrame key_frame flag in all decoders and encodersJames Almer2023-05-04
| | | | Signed-off-by: James Almer <jamrial@gmail.com>
* avcodec/avutil: move dynamic HDR10+ metadata parsing to libavutilRaphaël Zumer2023-03-21
| | | | | Signed-off-by: Raphaël Zumer <rzumer@tebako.net> Signed-off-by: James Almer <jamrial@gmail.com>
* lavu/frame: deprecate AVFrame.pkt_{pos,size}Anton Khirnov2023-03-20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | These fields are supposed to store information about the packet the frame was decoded from, specifically the byte offset it was stored at and its size. However, - the fields are highly ad-hoc - there is no strong reason why specifically those (and not any other) packet properties should have a dedicated field in AVFrame; unlike e.g. the timestamps, there is no fundamental link between coded packet offset/size and decoded frames - they only make sense for frames produced by decoding demuxed packets, and even then it is not always the case that the encoded data was stored in the file as a contiguous sequence of bytes (in order for pos to be well-defined) - pkt_pos was added without much explanation, apparently to allow passthrough of this information through lavfi in order to handle byte seeking in ffplay. That is now implemented using arbitrary user data passthrough in AVFrame.opaque_ref. - several filters use pkt_pos as a variable available to user-supplied expressions, but there seems to be no established motivation for using them. - pkt_size was added for use in ffprobe, but that too is now handled without using this field. Additonally, the values of this field produced by libavcodec are flawed, as described in the previous ffprobe conversion commit. In summary - these fields are ill-defined and insufficiently motivated, so deprecate them.
* avcodec/av1dec: Fix unintended fallthroughAndreas Rheinhardt2023-03-15
| | | | | | | Fixes Coverity issue #1521982. Reviewed-by: James Almer <jamrial@gmail.com> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/av1dec: make CBS parse only the OBU types we care aboutJames Almer2023-03-10
| | | | Signed-off-by: James Almer <jamrial@gmail.com>
* avcodec/av1dec: parse and export Metadata OBUsJames Almer2023-03-10
| | | | | | | This includes Mastering Display, Content light level, and some ITU-T T35 metadata like closed captions and HDR10+. Signed-off-by: James Almer <jamrial@gmail.com>
* av1dec: fix comment typoTristan Matthews2022-12-13
| | | | Signed-off-by: Ronald S. Bultje <rsbultje@gmail.com>
* av1dec: fix typo in logged errorTristan Matthews2022-12-13
| | | | Signed-off-by: Ronald S. Bultje <rsbultje@gmail.com>
* avcodec/codec_internal: Add macro to set AVCodec.long_nameAndreas Rheinhardt2022-09-03
| | | | | | | | 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-27
| | | | | | | | | 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/internal: Move ff_set_sar() to decode.hAndreas Rheinhardt2022-08-27
| | | | | | | Only used by decoders, as the SAR has to be set by the user when encoding. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec: Make init-threadsafety the defaultAndreas Rheinhardt2022-07-18
| | | | | | | | | | | 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>
* AV1 VDPAU hwaccel Decode supportManojGuptaBonda2022-06-25
| | | | | | | | | | | | | | Support for VDPAU accelerated AV1 decoding was added with libvdpau-1.5. Support for the same in ffmpeg is added with this patch. Profiles related to VDPAU AV1 can be found in latest vdpau.h present in libvdpau-1.5. Add AV1 VDPAU to list of hwaccels and supported formats Added file vdpau_av1.c and Modified configure to add VDPAU AV1 support. Mapped AV1 profiles to VDPAU AV1 profiles. Populated the codec specific params that need to be passed to VDPAU. Signed-off-by: Philip Langdale <philipl@overt.org>
* 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>
* Revert "avcodec/av1dec: Check tile_cols"James Almer2022-03-23
| | | | | | | | This reverts commit 4fdfe430c12225e819f68993474bd2f473c7e8b1. The previous commit ensures this field will never be zero. Signed-off-by: James Almer <jamrial@gmail.com>
* avcodec/av1: only set the private context pix_fmt field if ↵James Almer2022-03-23
| | | | | | | | | | | | | | | | | get_pixel_format() succeeds Otherwise get_pixel_format() will not be called when parsing a subsequent Sequence Header in non hwaccel enabled scenarios, allowing frame parsing when it shouldn't. This prevents the scenario seqhdr -> frame_hdr/redundant_frame_hdr -> seqhdr -> redundant_frame_hdr from having the latter redundant frame header parsed as if it was a frame header by the decoder because the former was discarded. Since CBS did not discard it, the latter redundant frame header is output with a zeroed AV1RawFrameHeader struct, which can have undesired results, like division by zero with fields normally guaranteed to be anything else. Reviewed-by: Michael Niedermayer <michael@niedermayer.cc> Signed-off-by: James Almer <jamrial@gmail.com>
* avcodec/av1dec: Check tile_colsMichael Niedermayer2022-03-21
| | | | | | | | | Fixes: division by zero Fixes: 43769/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_AV1_fuzzer-5392562205097984 Fixes: 43950/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_AV1_fuzzer-5769210217758720 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 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/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/av1dec: honor the requested skip_frame levelJames Almer2022-01-11
| | | | | | | This supports dropping non-intra, non-key, or all frames. Tested-by: nevcairiel Signed-off-by: James Almer <jamrial@gmail.com>
* lavc/av1dec: use frame split bsfFei Wang2022-01-07
| | | | | | | | | Split packed data in case of its contains multiple show frame in some non-standard bitstream. This can benefit decoder which can decode continuously instead of interrupt with unexpected error. Signed-off-by: Fei Wang <fei.w.wang@intel.com> Signed-off-by: Haihao Xiang <haihao.xiang@intel.com>
* avcodec/av1dec: support setup shear processFei Wang2021-10-16
| | | | | | Defined in spec 7.11.3.6/7.11.3.7. Signed-off-by: Fei Wang <fei.w.wang@intel.com>
* avcodec/av1: signal the presence of Film Grain in the decoder contextJames Almer2021-08-24
| | | | Signed-off-by: James Almer <jamrial@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/av1dec: add an option to select an operating pointJames Almer2021-01-04
| | | | Signed-off-by: James Almer <jamrial@gmail.com>
* Mark some pointers as constAndreas Rheinhardt2021-01-01
| | | | | Reviewed-by: Lynne <dev@lynne.ee> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avcodec/av1dec: support exporting Film Grain params as frame side dataJames Almer2020-12-16
| | | | Signed-off-by: James Almer <jamrial@gmail.com>
* avcodec/nvdec: Add support for decoding monochrome av1Philip Langdale2020-12-06
| | | | | | | | | | | | | | The nvidia hardware explicitly supports decoding monochrome content, presumably for the AVIF alpha channel. Supporting this requires an adjustment in av1dec and explicit monochrome detection in nvdec. I'm not sure why the monochrome path in av1dec did what it did - it seems non-functional - YUV440P doesn't seem a logical pix_fmt for monochrome and conditioning on chroma sub-sampling doesn't make sense. So I changed it. I've tested 8bit content, but I haven't found a way to create a 10bit sample, so that path is untested for now.
* avcodec/av1dec: Fix leak in case of failureAndreas Rheinhardt2020-12-05
| | | | | | | | | | | | | A reference to an AV1RawFrameHeader and consequently the AV1RawFrameHeader itself and everything it has a reference to leak if the hardware has no AV1 decoding capabilities or if some other error happens. It happens e.g. in the cbs-av1-av1-1-b8-02-allintra FATE-test; it has just been masked because the return value of ffmpeg (which indicates failure when using Valgrind or ASAN) is ignored when doing tests of type md5. Reviewed-by: James Almer <jamrial@gmail.com> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avcodec/av1dec: infer and store film grain param values in AV1FrameJames Almer2020-11-30
| | | | | | | | | They are not always coded in the bistream for each frame. In some cases, the values need to be taken from a reference frame. See section 6.8.20 from the AV1 spec. Signed-off-by: James Almer <jamrial@gmail.com>
* avcodec/av1{dec,parser}: move to ff_cbs_read_extradata_from_codecJan Ekström2020-11-24
| | | | | | This lets us re-utilize the extradata-related checks in the CBS to add support for passing the AV1CodecConfigurationRecord as extradata as-is without further filtering.
* avcodec/av1dec: remove order_hint from AV1FrameJames Almer2020-11-13
| | | | | | We now have access to the raw frame header, so use that Signed-off-by: James Almer <jamrial@gmail.com>
* avcodec/av1dec: add a reference to the raw frame header to AV1FramesJames Almer2020-11-13
| | | | Signed-off-by: James Almer <jamrial@gmail.com>
* avcodec/dxva2: add AV1 decode supportHendrik Leppkes2020-11-12
| | | | Signed-off-by: Hendrik Leppkes <h.leppkes@gmail.com>
* avcodec/nvdec: add av1 hwaccelTimo Rothenpieler2020-11-11
| | | | | Signed-off-by: Timo Rothenpieler <timo@rothenpieler.org> Co-authored-by: James Almer <jamrial@gmail.com>