ffmpeg: multithreaded conversion from RGBA into encoding format #116008

Merged
Aras Pranckevicius merged 1 commits from aras_p/blender:ffmpeg_threaded_conv into main 2023-12-15 12:36:10 +01:00

1 Commits

Author SHA1 Message Date
Aras Pranckevicius feddb39d72 ffmpeg: multithreaded conversion from RGBA into encoding format
buildbot/vexp-code-patch-lint Build done. Details
buildbot/vexp-code-patch-darwin-x86_64 Build done. Details
buildbot/vexp-code-patch-darwin-arm64 Build done. Details
buildbot/vexp-code-patch-linux-x86_64 Build done. Details
buildbot/vexp-code-patch-coordinator Build done. Details
Whenever movie frame encoding needs to be in non-RGBA format (pretty
much always, e.g. H.264 uses YUV etc.), the ffmpeg code has been
sws_scale() since 2007. But that one is completely single threaded.

It can be multi-threaded by passing "threads" option to SwsContext
(in a cumbersome way), and using `sws_scale_frame` API instead. Which
however requires frame data buffers to be allocated via AVBuffer
machinery.

Rendering a 300-frame part of Sprite Fright Edit (target H.264 Medium),
on Windows Ryzen 5950X: 16.1 -> 12.0 seconds (generate_video_frame
part 4.7 -> 0.7 sec).
2023-12-10 20:41:08 +02:00