summaryrefslogtreecommitdiff
path: root/libavcodec/cuviddec.c
Commit message (Collapse)AuthorAge
* avutil/common: Don't auto-include mem.hAndreas Rheinhardt2024-03-31
| | | | | | | | | | | There are lots of files that don't need it: The number of object files that actually need it went down from 2011 to 884 here. Keep it for external users in order to not cause breakages. Also improve the other headers a bit while just at it. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* all: use designated initializers for AVOption.unitAnton Khirnov2024-02-14
| | | | | | | | | | | | | | | | | | | | | | | | Makes it robust against adding fields before it, which will be useful in following commits. Majority of the patch generated by the following Coccinelle script: @@ typedef AVOption; identifier arr_name; initializer list il; initializer list[8] il1; expression tail; @@ AVOption arr_name[] = { il, { il1, - tail + .unit = tail }, ... }; with some manual changes, as the script: * has trouble with options defined inside macros * sometimes does not handle options under an #else branch * sometimes swallows whitespace
* avcodec: Remove redundant pix_fmts from decodersAndreas Rheinhardt2024-02-09
| | | | | | | | | | | | | | | AVCodec.pix_fmts is only intended for encoders (decoders use the get_format callback to let the user choose a pix fmt). So remove them for the decoders for which this is possible without further complications; keep them for now in the codecs that actually use them (by passing avctx->codec->pix_fmts to ff_get_formatt()). Also notice that some of these lists were wrong; e.g. 317b7b06fd97cd39feac7df57db22a30550351ff added support for YUV444P16 for cuviddec, but forgot to add it to pix_fmts. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* Revert "all: Don't set AVClass.item_name to its default value"Anton Khirnov2024-01-20
| | | | | | | Some callers assume that item_name is always set, so this may be considered an API break. This reverts commit 0c6203c97a99f69dbaa6e4011d48c331e1111f5e.
* all: Don't set AVClass.item_name to its default valueAndreas Rheinhardt2023-12-22
| | | | | | | | Unnecessary since acf63d5350adeae551d412db699f8ca03f7e76b9; also avoids relocations. Reviewed-by: Anton Khirnov <anton@khirnov.net> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/cuviddec: dynamically set max decode surfacesRandom Joe2023-08-13
|
* libavcodec/cuviddec: determine amount of decoded surfaces from within cuvid ↵Roman Arzumanyan2023-06-06
| | | | | | parser Signed-off-by: Timo Rothenpieler <timo@rothenpieler.org>
* 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: use the new AVFrame interlace flags in all decoders and encodersJames Almer2023-05-04
| | | | 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/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>
* lavc: use AVFrame.duration instead of AVFrame.pkt_durationAnton Khirnov2022-07-19
|
* avcodec: Add FF_CODEC_CAP_NOT_INIT_THREADSAFEAndreas Rheinhardt2022-07-18
| | | | | | | This is in preparation of switching the default init-thread-safety to a codec being init-thread-safe. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/cuviddec: fix null pointer dereferenceZhao Zhili2022-06-26
| | | | | | It can happened on error path of cuvid_decode_init(). Signed-off-by: Timo Rothenpieler <timo@rothenpieler.org>
* avcodec/cuviddec: fix AV1 decoding errorZhao Zhili2022-06-26
| | | | | | | | | | | cuvidParseVideoData only supports pure OBUs, it reports an unknown error with AV1CodecConfigurationRecord. Check whether extradata is AV1CodecConfigurationRecord and skip the first 4 bytes to fix the issue. The bug is revealed in ffmpeg cmd since 45e3b6a68 and ffd1316e. Signed-off-by: Timo Rothenpieler <timo@rothenpieler.org>
* avcodec/internal: Hide stuff only used by the core decode APIAndreas Rheinhardt2022-05-12
| | | | | | | | | | | | | | | | | | | | | | The general decoding API uses bitstream filters and an AVFifo and therefore AVCodecInternal contains pointers to an AVBSFContext and to an AVFifo and lavc/internal.h includes lavc/bsf.h and lavu/fifo.h. Yet actually, only two files are supposed to use these, namely avcodec.c and (mainly) decode.c. For all the other files, it should be an opaque type that they should not touch and that they need not know anything about. This can be achieved by not including these headers and using the structs instead of the corresponding typedefs. This also forces translation units that really use the BSF and the FIFO APIs themselves to include the relevant headers directly instead of relying on indirect inclusions (up until now, even avcodec.c and decode.c relied on fifo.h to be included by internal.h). Of course, it also avoids unnecessary rebuilds when bsf.h or fifo.h change. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* 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: 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>
* lavc/cuviddec: convert to the new FIFO APIAnton Khirnov2022-02-07
|
* lavc/cuviddec: do not reallocate the fifo unnecessarilyAnton Khirnov2022-02-07
|
* avcodec/cuviddec: Use AVCodecInternal.in_pkt instead of stack packetAndreas Rheinhardt2021-11-07
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/cuviddec: signal that the decoder sets all output frame propertiesJames Almer2021-06-21
| | | | | | Fixes memleaks described in ticket #9082. Signed-off-by: James Almer <jamrial@gmail.com>
* avcodec/cuviddec: remove unused AVCodec.decode() callbackJames Almer2021-06-21
| | | | | | The AVCodec.receive_frame() callback takes precedence. Signed-off-by: James Almer <jamrial@gmail.com>
* avcodec/cuviddec: correctly set key_frame with interlaced contentstuhlo2021-06-11
| | | | | | | | | | | Fixes #9283 This fixes setting of 'key_frame' flag in AVFrame when input h264 packets represents individual fields of interlaced video. In this case, pairs of two consecutive fields represents a single decoded picture and have identical 'CurrPicIdx', however, only the first field is entirely intra-coded and has the flag 'intra_pic_flag' set and the second field was resetting the flag before it was even read in the function 'cuvid_output_frame'. Signed-off-by: Timo Rothenpieler <timo@rothenpieler.org>
* 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>
* avutil/frame: Remove deprecated AVFrame.pkt_pts fieldAndreas Rheinhardt2021-04-27
| | | | | | | Deprecated in 32c8359093d1ff4f45ed19518b449b3ac3769d27. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com> Signed-off-by: James Almer <jamrial@gmail.com>
* avcodec/cuviddec: set ulMaxDisplayDelay to zero if low_delay flag is setMichal Novotny2021-02-22
| | | | | | | Zero is the recommended value in Nvidia coding samples for low latency use-cases. Signed-off-by: Michal Novotny <michal.novotny@comprimato.com> Signed-off-by: Timo Rothenpieler <timo@rothenpieler.org>
* avcodec/cuviddec: unref output frame on failureJames Almer2020-12-13
| | | | Signed-off-by: James Almer <jamrial@gmail.com>
* avcodec/cuviddec: check for av_buffer_ref() failureJames Almer2020-12-13
| | | | Signed-off-by: James Almer <jamrial@gmail.com>
* avcodec/cuviddec: fix missing context push/popleozhang2020-11-21
| | | | | | | | Test command like below: cuda-memcheck ./ffmpeg -hwaccel cuvid -c:v h264_cuvid -i input_file -c:v h264_nvenc -f null - Signed-off-by: leozhang <nowerzt@gmail.com> Signed-off-by: Timo Rothenpieler <timo@rothenpieler.org>
* lavc: Mark hw_config pointer arrays as constMark Thompson2020-11-08
| | | | They are read-only just like the HWConfig structures they point to.
* avcodec/cuviddec: add av1 supportRoman Arzumanyan2020-10-15
| | | | Signed-off-by: Timo Rothenpieler <timo@rothenpieler.org>
* avcodec/cuviddec: avoid copy of uninitialized extradata pointerTimo Rothenpieler2020-10-01
|
* avcodec/cuviddec: use correct type for extradata_sizeTimo Rothenpieler2020-10-01
|
* avcodec/cuviddec: fix copy&paste errorTimo Rothenpieler2020-10-01
|
* avcodec/cuviddec: handle arbitrarily sized extradataTimo Rothenpieler2020-09-29
|
* avcodec/decode: use a single list bsf for codec decode bsfsMarton Balint2020-05-02
| | | | Signed-off-by: Marton Balint <cus@passwd.hu>
* lavc: Rename hwaccel.h to hwconfig.hMark Thompson2020-04-26
| | | | | This already applied to decoders as well as hwaccels, and adding encoder support was going to make the name even more inaccurate.
* avcodec/cuviddec: use AVCodec.bsfs to filter packetsJames Almer2020-03-03
| | | | | | | | Simplifies code considerably. Reviewed-by: Anton Khirnov <anton@khirnov.net> Reviewed-by: Timo Rothenpieler <timo@rothenpieler.org> Signed-off-by: James Almer <jamrial@gmail.com>
* avcodec/cuviddec: add capability check for maximum macroblock countRuta Gadkari2019-05-08
| | | | | | | | | Cuvid supports clips with a limit on maximum number of macroblocks. This check was missing after cuvidGetDecoderCaps API call allowing unsupported clips to proceed. Added the missing check, same as the one in hwaccel nvdec implementation. Signed-off-by: Timo Rothenpieler <timo@rothenpieler.org>
* avcodec/cuviddec: improve progressive frame detectionSergey Svechnikov2019-04-23
| | | | | | | | | | | | | There are 2 types of problems when using adaptive deinterlace with cuvid: 1. Sometimes, in the middle of transcoding, cuvid outputs frames with visible horizontal lines (as though weave deinterlace method was chosen); 2. Occasionally, on scene changes, cuvid outputs a wrong frame, which should have been shown several seconds before (as if the frame was assigned some wrong PTS value). The reason is that sometimes CUVIDPARSERDISPINFO has property progressive_frame equal to 1 with interlaced videos. In order to fix the problem we should check if the video is interlaced or progressive in the beginning of a video sequence (cuvid_handle_video_sequence). And then we just use this information instead of the property progressive_frame in CUVIDPARSERDISPINFO (which is unreliable). Signed-off-by: Timo Rothenpieler <timo@rothenpieler.org>
* avcodec/cuviddec: Remove unnecessary stream synchronisationPhilip Langdale2019-03-30
| | | | | | | | We're also doing a sync here after copying the frame to be passed on down the pipleine. And it is also unnecessary. I was able to demonstrate a 33% speedup removing the sync from an example transcode pipeline.
* avcodec/cuviddec: Add support for decoding HEVC 4:4:4 contentPhilip Langdale2019-02-16
| | | | | | | | | | | This is the equivalent change for cuviddec after the previous change for nvdec. I made similar changes to the copying routines to handle pixel formats in a more generic way. Note that unlike with nvdec, there is no confusion about the ability of a codec to output 444 formats. This is because the cuvid parser is used, meaning that 444 JPEG content is still indicated as using a 420 output format.
* avutil/hwcontext_cuda: Define and use common CHECK_CU()Philip Langdale2018-11-14
| | | | | | | | | | | | | | | | | | We have a pattern of wrapping CUDA calls to print errors and normalise return values that is used in a couple of places. To avoid duplication and increase consistency, let's put the wrapper implementation in a shared place and use it everywhere. Affects: * avcodec/cuviddec * avcodec/nvdec * avcodec/nvenc * avfilter/vf_scale_cuda * avfilter/vf_scale_npp * avfilter/vf_thumbnail_cuda * avfilter/vf_transpose_npp * avfilter/vf_yadif_cuda
* avcodec/cuviddec: properly take deinterlacing and display delay into account ↵Timo Rothenpieler2018-10-14
| | | | | | for buffer_full check Signed-off-by: Timo Rothenpieler <timo@rothenpieler.org>
* avcodec/cuviddec: explicitly synchronize cuMemcpy callsTimo Rothenpieler2018-05-10
|
* avcodec/cuviddec: set key frame for decoded framesYogender Gupta2018-01-19
| | | | Signed-off-by: Timo Rothenpieler <timo@rothenpieler.org>
* avcodec: add metadata to identify wrappers and hardware decoderswm42017-12-14
| | | | | | | | | | | | | | | | | | | | | Explicitly identify decoder/encoder wrappers with a common name. This saves API users from guessing by the name suffix. For example, they don't have to guess that "h264_qsv" is the h264 QSV implementation, and instead they can just check the AVCodec .codec and .wrapper_name fields. Explicitly mark AVCodec entries that are hardware decoders or most likely hardware decoders with new AV_CODEC_CAPs. The purpose is allowing API users listing hardware decoders in a more generic way. The proposed AVCodecHWConfig does not provide this information fully, because it's concerned with decoder configuration, not information about the fact whether the hardware is used or not. AV_CODEC_CAP_HYBRID exists specifically for QSV, which can have software implementations in case the hardware is not capable. Based on a patch by Philip Langdale <philipl@overt.org>. Merges Libav commit 47687a2f8aca3f65b6fdd117b1cb66a7409a7fd1.