diff --git a/docs/README-migration.md b/docs/README-migration.md index cdc3f0d734..689fd1757f 100644 --- a/docs/README-migration.md +++ b/docs/README-migration.md @@ -1386,7 +1386,7 @@ The following functions have been renamed: The following functions have been removed: * SDL_GetYUVConversionMode() * SDL_GetYUVConversionModeForResolution() -* SDL_SetYUVConversionMode() - use SDL_SetSurfaceColorspace() to set the surface colorspace and SDL_PROP_TEXTURE_CREATE_COLORSPACE_NUMBER with SDL_CreateTextureWithProperties() to set the texture colorspace. The default colorspace for YUV pixel formats is SDL_COLORSPACE_BT601_LIMITED. +* SDL_SetYUVConversionMode() - use SDL_SetSurfaceColorspace() to set the surface colorspace and SDL_PROP_TEXTURE_CREATE_COLORSPACE_NUMBER with SDL_CreateTextureWithProperties() to set the texture colorspace. The default colorspace for YUV pixel formats is SDL_COLORSPACE_JPEG. * SDL_SoftStretchLinear() - use SDL_SoftStretch() with SDL_SCALEMODE_LINEAR ## SDL_system.h diff --git a/include/SDL3/SDL_pixels.h b/include/SDL3/SDL_pixels.h index 112c6534f5..de695f81e6 100644 --- a/include/SDL3/SDL_pixels.h +++ b/include/SDL3/SDL_pixels.h @@ -591,6 +591,14 @@ typedef enum SDL_MATRIX_COEFFICIENTS_UNSPECIFIED, SDL_CHROMA_LOCATION_NONE), + SDL_COLORSPACE_JPEG = /**< Equivalent to DXGI_COLOR_SPACE_YCBCR_FULL_G22_NONE_P709_X601 */ + SDL_DEFINE_COLORSPACE(SDL_COLOR_TYPE_YCBCR, + SDL_COLOR_RANGE_FULL, + SDL_COLOR_PRIMARIES_BT709, + SDL_TRANSFER_CHARACTERISTICS_BT601, + SDL_MATRIX_COEFFICIENTS_BT601, + SDL_CHROMA_LOCATION_NONE), + SDL_COLORSPACE_BT601_LIMITED = /**< Equivalent to DXGI_COLOR_SPACE_YCBCR_STUDIO_G22_LEFT_P601 */ SDL_DEFINE_COLORSPACE(SDL_COLOR_TYPE_YCBCR, SDL_COLOR_RANGE_LIMITED, @@ -627,7 +635,7 @@ typedef enum SDL_COLORSPACE_RGB_DEFAULT = SDL_COLORSPACE_SRGB, /* The default colorspace for YUV surfaces if no colorspace is specified */ - SDL_COLORSPACE_YUV_DEFAULT = SDL_COLORSPACE_BT601_LIMITED, + SDL_COLORSPACE_YUV_DEFAULT = SDL_COLORSPACE_JPEG, } SDL_Colorspace; diff --git a/include/SDL3/SDL_render.h b/include/SDL3/SDL_render.h index 451c71ea03..01a127e169 100644 --- a/include/SDL3/SDL_render.h +++ b/include/SDL3/SDL_render.h @@ -458,8 +458,7 @@ extern DECLSPEC SDL_Texture *SDLCALL SDL_CreateTextureFromSurface(SDL_Renderer * * - `SDL_PROP_TEXTURE_CREATE_COLORSPACE_NUMBER`: an SDL_ColorSpace value * describing the texture colorspace, defaults to SDL_COLORSPACE_SCRGB for * floating point textures, SDL_COLORSPACE_HDR10 for 10-bit textures, - * SDL_COLORSPACE_SRGB for other RGB textures and - * SDL_COLORSPACE_BT601_LIMITED for YUV textures. + * SDL_COLORSPACE_SRGB for other RGB textures and SDL_COLORSPACE_JPEG for YUV textures. * - `SDL_PROP_TEXTURE_CREATE_FORMAT_NUMBER`: one of the enumerated values in * SDL_PixelFormatEnum, defaults to the best RGBA format for the renderer * - `SDL_PROP_TEXTURE_CREATE_ACCESS_NUMBER`: one of the enumerated values in diff --git a/test/testyuv.c b/test/testyuv.c index 83b6369e73..55503ef11f 100644 --- a/test/testyuv.c +++ b/test/testyuv.c @@ -117,7 +117,7 @@ static int run_automated_tests(int pattern_size, int extra_pitch) SDL_PIXELFORMAT_YVYU }; const SDL_Colorspace colorspaces[] = { - SDL_COLORSPACE_BT601_FULL, + SDL_COLORSPACE_JPEG, SDL_COLORSPACE_BT601_LIMITED, SDL_COLORSPACE_BT709_LIMITED };