summaryrefslogtreecommitdiff
path: root/libavcodec/cuviddec.c
Commit message (Collapse)AuthorAge
* 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.
* lavc: Delete all fake hwaccelsMark Thompson2017-11-26
| | | | They are now unused.
* lavc: Use hardware config information in ff_get_format()Mark Thompson2017-11-26
| | | | | | | | | | | | | | | This removes the dependency that hardware pixel formats previously had on AVHWAccel instances, meaning only those which actually do something need exist after this patch. Also updates avcodec_default_get_format() to be able to choose hardware formats if either a matching device has been supplied or no additional external configuration is required, and avcodec_get_hw_frames_parameters() to use the hardware config rather than searching the old hwaccel list. The FF_CODEC_CAP_HWACCEL_REQUIRE_CLASS mechanism is deleted because it no longer does anything (the codec already contains the pointers to the matching hwaccels).
* lavc: Add hardware config metadata for decoders supporting hardware outputMark Thompson2017-11-26
| | | | | | | | | This includes a pointer to the associated hwaccel for decoders using hwaccels - these will be used later to implement the hwaccel setup without needing a global list. Also added is a new file listing all hwaccels as external declarations - this will be used later to generate the hwaccel list at configure time.
* compat/cuda: Pass a logging context to load functionsMark Thompson2017-11-20
| | | | Reviewed-by: Timo Rothenpieler <timo@rothenpieler.org>
* avcodec: allow multiple hwaccels for the same codec/pixfmtwm42017-11-10
| | | | | | | | | | | | | | | Currently, AVHWAccels are looked up using a (codec_id, pixfmt) tuple. This means it's impossible to have 2 decoders for the same codec and using the same opaque hardware pixel format. This breaks merging Libav's CUVID hwaccel. FFmpeg has its own CUVID support, but it's a full stream decoder, using NVIDIA's codec parser. The Libav one is a true hwaccel, which is based on the builtin software decoders. Fix this by introducing another field to disambiguate AVHWAccels, and use it for our CUVID decoders. FF_CODEC_CAP_HWACCEL_REQUIRE_CLASS makes this mechanism backwards compatible and optional.
* avcodec/cuvid: rename cuvid.c to cuviddec.cwm42017-11-10
cuvid.c is used by Libav's CUVID hwaccel. Resolve the conflict and avoid future merge problems by renaming our decoder. Signed-off-by: Timo Rothenpieler <timo@rothenpieler.org>