vk_video_samples
vk_video_samples copied to clipboard
Consider using boyer-more algorithm to optimize start code scanning
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
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 :).