Bladeren bron

SDL_COLORSPACE_JPEG is the default YUV colorspace

Sam Lantinga 1 jaar geleden
bovenliggende
commit
327b976bc4
4 gewijzigde bestanden met toevoegingen van 12 en 5 verwijderingen
  1. 1 1
      docs/README-migration.md
  2. 9 1
      include/SDL3/SDL_pixels.h
  3. 1 2
      include/SDL3/SDL_render.h
  4. 1 1
      test/testyuv.c

+ 1 - 1
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

+ 9 - 1
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;
 

+ 1 - 2
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

+ 1 - 1
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
     };