[FFmpeg-devel] [PATCH] avfilter: add format_cuda filter

Timo Rothenpieler timo at rothenpieler.org
Sat Jun 12 01:26:58 EEST 2021


On 11.06.2021 17:33, Steven Liu wrote:
> 
> 
>> 在 2021年6月11日,22:43,Timo Rothenpieler <timo at rothenpieler.org> 写道:
> Hi Timo,
>>
>> ---
>> configure                           |   2 +
>> doc/filters.texi                    |  46 ++
>> libavfilter/Makefile                |   1 +
>> libavfilter/allfilters.c            |   1 +
>> libavfilter/cuda/vector_helpers.cuh |  14 +-
>> libavfilter/version.h               |   2 +-
>> libavfilter/vf_format_cuda.c        | 433 ++++++++++++++
>> libavfilter/vf_format_cuda.cu       | 849 ++++++++++++++++++++++++++++
>> 8 files changed, 1345 insertions(+), 3 deletions(-)
>> create mode 100644 libavfilter/vf_format_cuda.c
>> create mode 100644 libavfilter/vf_format_cuda.cu
>>
>> diff --git a/configure b/configure
>> index 6bfd98b384..7041c09177 100755
>> --- a/configure
>> +++ b/configure
>> @@ -3078,6 +3078,8 @@ qsvvpp_select="qsv"
>> vaapi_encode_deps="vaapi"
>> v4l2_m2m_deps="linux_videodev2_h sem_timedwait"
>>
>> +format_cuda_filter_deps="ffnvcodec"
>> +format_cuda_filter_deps_any="cuda_nvcc cuda_llvm"
>> hwupload_cuda_filter_deps="ffnvcodec"
>> scale_npp_filter_deps="ffnvcodec libnpp"
>> scale_cuda_filter_deps="ffnvcodec"
>> diff --git a/doc/filters.texi b/doc/filters.texi
>> index 78faf767cf..27a0184cb3 100644
>> --- a/doc/filters.texi
>> +++ b/doc/filters.texi
>> @@ -12324,6 +12324,52 @@ format=pix_fmts=yuv420p|yuv444p|yuv410p
>> @end example
>> @end itemize
>>
>> + at anchor{format_cuda}
>> + at section format_cuda
>> +
>> +Convert the input video to one of the specified pixel formats.
>> +Libavfilter will try to pick one that is suitable as input to
>> +the next filter.
>> +
>> +It accepts the following parameters:
>> + at table @option
>> +
>> + at item format
>> +The name of the desired output format.
>> +If none is specified, the input format will be used.
>> +
>> + at item passthrough
>> +If true, input frames matching the output format will be passed
>> +through as-is.
>> +If false, every input frame is processed. Frames matching the
>> +output format will be copied without data modification. This is
>> +the default mode.
>> +
>> + at end table
>> +
>> + at subsection Examples
>> +
>> + at itemize
>> + at item
>> +Convert the input video to the @var{yuv420p} format.
>> + at example
>> +format_cuda=yuv420p
> maybe need an format for alpha blend, be used in overlay_cuda for colorkey linkly feature.

I had this lying around for a long time. It's also lacking support for 
the RGB formats.
Planned to enhance this, but never got around to it.

Kinda just want to get this merged as-is now, to enable work on 
enhancements of the filter.

Adding the alpha formats should be fairly simple, though I'm not sure 
what to do in the conversion. Should it just discard the alpha channel 
in the one direction, and add a fully opaque one the other way around?

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 4494 bytes
Desc: S/MIME Cryptographic Signature
URL: <https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20210612/87aaa5c3/attachment.bin>


More information about the ffmpeg-devel mailing list