Input
minimp4 reads the MP4 container. h264 interprets the stream and supplies metadata and picture order.
Overview
Two connected project paths: hardware-accelerated video with Vulkan and portable compute with OpenCL, each traced from API generation to a working application.
Small repositories separate API generation, data formats, memory, interface, and application code. The Vulkan Video path plays H.264; the OpenCL path computes and visualizes particles together with Vulkan.
v_vulkan_video
An H.264/AVC MP4 player written in V that decodes through Vulkan Video, selects a compatible GPU, and handles presentation, resizing, and looping.
minimp4 reads the MP4 container. h264 interprets the stream and supplies metadata and picture order.
The Vulkan bindings expose the native API to V. The player checks the video profile and selects a compatible GPU.
GLFW provides windowing and input, Dear ImGui supplies the interface, and VMA assists with GPU memory.
v_vulkan_video combines parsing, GPU selection, decoding, timing, resizing, presentation, and looping.
opencl
Generated OpenCL 1.0–3.0 bindings for V, typed helpers for buffers, images, and SVM, plus a particle system in which OpenCL and Vulkan share memory and synchronization.
v_opencl_bindings reads the canonical Khronos registry and produces traceable V bindings for OpenCL 1.0 through 3.0.
opencl keeps the complete low-level API and adds opt-in typed helpers for discovery, buffers, images, SVM, events, and lifecycles.
CI exercises runtime paths on Linux and ABI builds for macOS and Windows, covering GCC, Clang, MSVC, and TinyCC.
The particle example combines OpenCL compute with Vulkan presentation, shares memory and semaphores when available, and falls back to host staging.
A video player looks like one application. In practice it solves several very different problems, deliberately separated here into understandable and reusable projects.
minimp4
An MP4 file is a container. minimp4 locates pictures, timing, and technical metadata inside it—much like a table of contents.
h264
H.264 usually stores changes relative to other pictures. This project reads the rules, dependencies, and ordering needed to reconstruct them.
v_vulkan_bindings + vulkan
Vulkan is the language of the GPU. The generator keeps thousands of definitions current; the bindings expose them reproducibly to V.
vulkan_memory_allocator
Video pictures are large and must live in the right place. VMA removes much of the error-prone memory bookkeeping from the application.
glfw + imgui
GLFW connects windows, screens, and input. ImGui supplies controls and diagnostic interfaces, turning a pipeline into an operable program.
v_vulkan_video
The player coordinates file access, timing, reference pictures, GPU queues, presentation, and window changes into visible video.
opencl
The complete bindings stay accessible while an optional ownership and type layer simplifies buffers, images, SVM, events, and kernel calls.
v_opencl_bindings
The generator ties its output to fixed Khronos inputs and validates the generated surface across several platforms and compilers.
v_imgui_examples
A tested example connects V, Vulkan, GLFW, and Dear ImGui as a short path into the graphics toolchain.
For technical readers: one H.264 picture is not “displayed” with a single call. Metadata, reference pictures, GPU resources, and synchronization are described through a linked chain of Vulkan structures.
StdVideoDecodeH264PictureInfoPicture number, SPS/PPS IDs, Picture Order Count, and flags describe the H.264 picture independently of Vulkan resources.
VideoDecodeH264PictureInfoKHR → pNextAdds slice count and offsets, then attaches the codec-specific description to the general decode structure through pNext.
StdVideoDecodeH264ReferenceInfoDescribes every older reference picture on which P- or B-pictures depend. Without this history, the GPU cannot reconstruct the current picture.
VideoDecodeH264DpbSlotInfoKHR → VideoReferenceSlotInfoKHRConnects H.264 reference data to a Decoded Picture Buffer slot and its concrete image resource.
VideoPictureResourceInfoKHRPoints through imageViewBinding to the GPU image and states its coded extent and array layer—the physical destination or reference storage.
VideoBeginCodingInfoKHROpens the video coding scope with the session, session parameters, and active reference slots. An optional session reset follows.
VideoDecodeInfoKHR → vkCmdDecodeVideoKHRCollects the bitstream buffer and byte range, destination picture, current DPB slot, and every reference slot. Only now is the decode command recorded.
ImageMemoryBarrier2 + semaphoreBarriers transfer image layout and ownership between video and graphics queues; a semaphore prevents graphics from reading an unfinished picture.
SubmitInfo → draw → PresentInfoKHRThe video queue produces the picture, the graphics queue draws it into a swapchain image, and vkQueuePresentKHR hands that image to the display.