vk_video_samples icon indicating copy to clipboard operation
vk_video_samples copied to clipboard

Consider using boyer-more algorithm to optimize start code scanning

Open ndufresne opened this issue 1 year ago • 1 comments

In https://github.com/nvpro-samples/vk_video_samples/blob/ff6ef40e25da75604eb550299b93c9671aac0b40/vk_video_decoder/libs/NvVideoParser/src/VulkanVideoDecoder.cpp#L266 it seems the scanner will read every bytes of the stream. This is commonly optimized with a reduce Boyer-More algorithm, allowing to read only a third of the bytes.

An example can be found here: https://gitlab.freedesktop.org/gstreamer/gstreamer/-/blob/main/subprojects/gstreamer/libs/gst/base/gstbytereader.c#L865 which has been reduced from https://en.wikipedia.org/wiki/Boyer%E2%80%93Moore_string-search_algorithm

ndufresne avatar Apr 24 '23 19:04 ndufresne

Thank you for bringing this parser performance issue to our attention, Nicolas. We are already aware of this issue and have an internal task (not started yet) to address it. We would also gladly take code contributions to the parser :).

zlatinski avatar Apr 26 '23 17:04 zlatinski