mirror of
https://github.com/libsdl-org/SDL.git
synced 2025-10-05 09:26:25 +00:00
Added support for P010 pixel format in SDL_UpdateNVTexture()
This commit is contained in:
@@ -2475,7 +2475,7 @@ bool SDL_UpdateYUVTexture(SDL_Texture *texture, const SDL_Rect *rect,
|
|||||||
|
|
||||||
CHECK_PARAM(texture->format != SDL_PIXELFORMAT_YV12 &&
|
CHECK_PARAM(texture->format != SDL_PIXELFORMAT_YV12 &&
|
||||||
texture->format != SDL_PIXELFORMAT_IYUV) {
|
texture->format != SDL_PIXELFORMAT_IYUV) {
|
||||||
return SDL_SetError("Texture format must by YV12 or IYUV");
|
return SDL_SetError("Texture format must be YV12 or IYUV");
|
||||||
}
|
}
|
||||||
|
|
||||||
real_rect.x = 0;
|
real_rect.x = 0;
|
||||||
@@ -2534,8 +2534,9 @@ bool SDL_UpdateNVTexture(SDL_Texture *texture, const SDL_Rect *rect,
|
|||||||
}
|
}
|
||||||
|
|
||||||
CHECK_PARAM(texture->format != SDL_PIXELFORMAT_NV12 &&
|
CHECK_PARAM(texture->format != SDL_PIXELFORMAT_NV12 &&
|
||||||
texture->format != SDL_PIXELFORMAT_NV21) {
|
texture->format != SDL_PIXELFORMAT_NV21 &&
|
||||||
return SDL_SetError("Texture format must by NV12 or NV21");
|
texture->format != SDL_PIXELFORMAT_P010) {
|
||||||
|
return SDL_SetError("Texture format must be NV12, NV21, or P010");
|
||||||
}
|
}
|
||||||
|
|
||||||
real_rect.x = 0;
|
real_rect.x = 0;
|
||||||
|
@@ -685,11 +685,11 @@ int main(int argc, char **argv)
|
|||||||
SDL_free(plane0);
|
SDL_free(plane0);
|
||||||
SDL_free(plane1);
|
SDL_free(plane1);
|
||||||
SDL_free(plane2);
|
SDL_free(plane2);
|
||||||
} else if (planar && (yuv_format == SDL_PIXELFORMAT_NV12 || yuv_format == SDL_PIXELFORMAT_NV21)) {
|
} else if (planar && (yuv_format == SDL_PIXELFORMAT_NV12 || yuv_format == SDL_PIXELFORMAT_NV21 || yuv_format == SDL_PIXELFORMAT_P010)) {
|
||||||
const int Yrows = original->h;
|
const int Yrows = original->h;
|
||||||
const int UVrows = ((original->h + 1) / 2);
|
const int UVrows = ((original->h + 1) / 2);
|
||||||
const int src_Ypitch = pitch;
|
const int src_Ypitch = pitch;
|
||||||
const int src_UVpitch = ((pitch + 1) / 2) * 2;
|
const int src_UVpitch = (yuv_format == SDL_PIXELFORMAT_P010) ? ((pitch + 3) & ~3) : ((pitch + 1) & ~1);
|
||||||
const Uint8 *src_plane0 = (const Uint8 *)raw_yuv;
|
const Uint8 *src_plane0 = (const Uint8 *)raw_yuv;
|
||||||
const Uint8 *src_plane1 = src_plane0 + Yrows * src_Ypitch;
|
const Uint8 *src_plane1 = src_plane0 + Yrows * src_Ypitch;
|
||||||
const int Ypitch = pitch + 37;
|
const int Ypitch = pitch + 37;
|
||||||
|
Reference in New Issue
Block a user