New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

YUV format support is incomplete #22

Open
sailfish009 opened this Issue Sep 8, 2016 · 2 comments

Comments

Projects
None yet
2 participants
@sailfish009

sailfish009 commented Sep 8, 2016

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);
 }
@grimfang4

This comment has been minimized.

Show comment
Hide comment
@grimfang4

grimfang4 Sep 8, 2016

Owner

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.

Owner

grimfang4 commented Sep 8, 2016

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.

@sailfish009

This comment has been minimized.

Show comment
Hide comment
@sailfish009

sailfish009 Sep 8, 2016

Thanks for the answer! :)

i will look at libyuv.
https://chromium.googlesource.com/libyuv/libyuv/

sailfish009 commented Sep 8, 2016

Thanks for the answer! :)

i will look at libyuv.
https://chromium.googlesource.com/libyuv/libyuv/

@grimfang4 grimfang4 changed the title from SDL_UpdateYUVTexture() to YUV format support is incomplete Jul 22, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment