From d451fcd7a7dbf1b0fe76892c3c584d4f3fbd964f Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Thu, 15 Feb 2024 16:39:13 -0800 Subject: [PATCH] Fixed HDR video content being too bright on Apple platforms This probably isn't the exact formula that we need, but it's much closer to correct. --- test/testffmpeg.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/test/testffmpeg.c b/test/testffmpeg.c index 448123972..d1b8e0901 100644 --- a/test/testffmpeg.c +++ b/test/testffmpeg.c @@ -800,6 +800,9 @@ static SDL_bool GetTextureForVideoToolboxFrame(AVFrame *frame, SDL_Texture **tex video_white_level = DEFAULT_HDR_WHITE_LEVEL; } SDL_SetRenderColorScale(renderer, SDR_white_level / video_white_level); + } else if (HDR_display) { + /* Apple platforms already scale up the brightness of content so we need to scale it down by the same amount for HDR video */ + SDL_SetRenderColorScale(renderer, SDR_white_level / DEFAULT_SDR_WHITE_LEVEL); } else { SDL_SetRenderColorScale(renderer, 1.0f); }