sdl-gpu
sdl-gpu copied to clipboard
YUV format support is incomplete
Hi,
how do i replace SDL_UpdateYUVTexture() with sdl-gpu functions?
with GPU_UpdateImageBytes(), i can only copy Y planar pixels to GPU_image. so i can see gray image/stream only, no color image.
while (1) {
GPU_Clear(screen);
for (int i = 0; i < 4; ++i) {
fread(yPlane[i], 1, pixel_w * pixel_h, fp[i]);
fread(uPlane[i], 1, pixel_w * pixel_h / 4, fp[i]);
fread(vPlane[i], 1, pixel_w * pixel_h / 4, fp[i]);
GPU_UpdateImageBytes(texture, &rect[i], yPlane[i], pixel_w);
GPU_Blit(texture, NULL, screen, pixel_w / 2, pixel_h / 2);
}
GPU_Flip(screen);
SDL_Delay(33);
}
//SDL2 version
while (1) {
SDL_RenderClear(renderer);
for (int i = 0; i < 4; ++i) {
fread(yPlane[i], 1, pixel_w * pixel_h, fp[i]);
fread(uPlane[i], 1, pixel_w * pixel_h / 4, fp[i]);
fread(vPlane[i], 1, pixel_w * pixel_h / 4, fp[i]);
SDL_UpdateYUVTexture(texture, NULL, yPlane[i], pixel_w, uPlane[i],
uvPitch, vPlane[i], uvPitch);
SDL_RenderCopy(renderer, texture, NULL, &(rect[i]));
}
SDL_RenderPresent(renderer);
SDL_Delay(33);
}
Unfortunately, SDL_gpu's YUV support is not complete. I started it a long time ago and never did finish it. As it is, I think you'd have to write your own shader to combine planes from 3 individual GPU_Images.
My personal obligations are pressing lately, so I can't commit to finishing YUV support any time soon.
Thanks for the answer! :)
i will look at libyuv. https://chromium.googlesource.com/libyuv/libyuv/