On 13.09.2021 11:07, Roman Arzumanyan wrote:
This patch adds scale2ref_npp video filter which is similar to scale2ref, but 
accelerated by NPP. CLI sample:


./ffmpeg \

   -hwaccel cuda -hwaccel_output_format cuda \

   -i ./bbb_sunflower_1080p_30fps_normal.mp4 \

   -i ./920px-Wilber-huge-alpha.png \

   -filter_complex 
"[0:v]scale_npp=format=yuv420p[v0];[1:v]hwupload_cuda[v1];[v1][v0]scale2ref_npp=w=oh*mdar:h=ih/4[foreg][backg];[backg][foreg]overlay_cuda=x=(main_w-overlay_w),scale_npp=w=1280:720[out]"
 \

   -map "[out]" -c:v h264_nvenc -y ./output_overlay.mp4


Some nits first:
Please configure your editor to get rid of trailing white spaces.

The commit message of the actual patch does not follow the usual schema, even though the subject of the mail does.

Missing a libavfilter minor version bump.

Missing docs. Can just be a simple docstring header referring to software scale2ref and normal scale_npp for identical options.

configure bits are missing. Just a second line otherwise identical to the scale_npp_filter_deps one.


Then, why is there a bunch of swscale stuff in the filter, which is then never used?
I'd guess those are leftovers from software scale2ref?
For example the swscale.h include, and calls to sws_freeContext in nppscale_uninit, and likewise the variables they refer to, of type SwsContext. They don't seem to be used anywhere.

The interlaced variable also seems to be never actually used, outside of logging it once.


Generally, the filter logic looks sound to me, which isn't surprising, given it's the same logic software-scale2ref uses, just some missing cleanup.
Would also love to see the same done to scale_cuda.

On that subject: I do wonder if there is some better way to implement the pretty much identical logic in multiple filters. Duplicating all that code is rather ugly and creates quite some maintenance burden if it gets enhanced/fixed in one of the filters but not the others.

Attachment: smime.p7s
Description: S/MIME Cryptographic Signature

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Reply via email to