Reputation: 1563
Is it possible to implement a video codec using GLSL shaders, and if practical, would it be any more efficient than a cpu codec?
Upvotes: 5
Views: 3745
Reputation: 31160
Well, All Turing complete systems are capable of accomplishing the same things, the only difference is speed and efficiency. So if you read this question as "are GLSL shaders Turing complete?" the answer can be found here:
Are GPU shaders Turing complete
TLDR; Shader model 3.0 Yes Others Maybe (but probably no)
As for more efficient, Probably not. Other GPGPU/CUDA/SIMD will most likely work better.
Upvotes: 0
Reputation: 3721
Since GPUs are parallel processors, the codecs would have to be designed to exploit the pipeline. Codecs are either encoders or decoders, shaders are vertex or fragment.
The pipeline architecture (stack diagram) would be:
The design should push as much of the work as possible into vertex shaders for efficient parallelism. A quadtree algorithm might be a good choice to isolate the fragments.
The implementation would depend on the GPU targets. Khronos Vulkan chipsets (GL5+) are particularly well suited to this problem, allowing for multithreaded pipelines.
A high end GPU codec implementation could easily outperform some hardware codecs, and certainly blow the doors off any similar CPU codecs (software codecs).
Dedicated hardware will always win eventually. Any good GPU codec could serve as a model for a much faster hardware codec, just as a good software codec could become a faster GPU codec.
Upvotes: 3