Commit 8fb3885c3c2bd7b933060336518a6db10117b49d

Sam Lantinga 2017-11-17T11:03:02

Fixed bug 3964 - YUV to RGB in video/SDL_yuv.c is broken for any output format of type ABGR8888 or BGR888 raist66676 Here is the bug in latest SDL 2.0.8 development repo. It is obvious and simple to fix by correcting typos on six lines of code. In src/video/SDL_yuv.c on lines 217, 249, 280, 321, 353, and 384 the wrong conversion functions are called for SDL_PIXELFORMAT_ABGR8888 and SDL_PIXELFORMAT_BGR888. Instead of ABGR functions, BGRA functions are called. These are typos.

diff --git a/src/video/SDL_yuv.c b/src/video/SDL_yuv.c
index 966de7f..d56f604 100644
--- a/src/video/SDL_yuv.c
+++ b/src/video/SDL_yuv.c
@@ -214,7 +214,7 @@ static SDL_bool yuv_rgb_sse(
             return SDL_TRUE;
         case SDL_PIXELFORMAT_BGR888:
         case SDL_PIXELFORMAT_ABGR8888:
-            yuv420_bgra_sseu(width, height, y, u, v, y_stride, uv_stride, rgb, rgb_stride, yuv_type);
+            yuv420_abgr_sseu(width, height, y, u, v, y_stride, uv_stride, rgb, rgb_stride, yuv_type);
             return SDL_TRUE;
         default:
             break;
@@ -246,7 +246,7 @@ static SDL_bool yuv_rgb_sse(
             return SDL_TRUE;
         case SDL_PIXELFORMAT_BGR888:
         case SDL_PIXELFORMAT_ABGR8888:
-            yuv422_bgra_sseu(width, height, y, u, v, y_stride, uv_stride, rgb, rgb_stride, yuv_type);
+            yuv422_abgr_sseu(width, height, y, u, v, y_stride, uv_stride, rgb, rgb_stride, yuv_type);
             return SDL_TRUE;
         default:
             break;
@@ -277,7 +277,7 @@ static SDL_bool yuv_rgb_sse(
             return SDL_TRUE;
         case SDL_PIXELFORMAT_BGR888:
         case SDL_PIXELFORMAT_ABGR8888:
-            yuvnv12_bgra_sseu(width, height, y, u, v, y_stride, uv_stride, rgb, rgb_stride, yuv_type);
+            yuvnv12_abgr_sseu(width, height, y, u, v, y_stride, uv_stride, rgb, rgb_stride, yuv_type);
             return SDL_TRUE;
         default:
             break;
@@ -318,7 +318,7 @@ static SDL_bool yuv_rgb_std(
             return SDL_TRUE;
         case SDL_PIXELFORMAT_BGR888:
         case SDL_PIXELFORMAT_ABGR8888:
-            yuv420_bgra_std(width, height, y, u, v, y_stride, uv_stride, rgb, rgb_stride, yuv_type);
+            yuv420_abgr_std(width, height, y, u, v, y_stride, uv_stride, rgb, rgb_stride, yuv_type);
             return SDL_TRUE;
         default:
             break;
@@ -350,7 +350,7 @@ static SDL_bool yuv_rgb_std(
             return SDL_TRUE;
         case SDL_PIXELFORMAT_BGR888:
         case SDL_PIXELFORMAT_ABGR8888:
-            yuv422_bgra_std(width, height, y, u, v, y_stride, uv_stride, rgb, rgb_stride, yuv_type);
+            yuv422_abgr_std(width, height, y, u, v, y_stride, uv_stride, rgb, rgb_stride, yuv_type);
             return SDL_TRUE;
         default:
             break;
@@ -381,7 +381,7 @@ static SDL_bool yuv_rgb_std(
             return SDL_TRUE;
         case SDL_PIXELFORMAT_BGR888:
         case SDL_PIXELFORMAT_ABGR8888:
-            yuvnv12_bgra_std(width, height, y, u, v, y_stride, uv_stride, rgb, rgb_stride, yuv_type);
+            yuvnv12_abgr_std(width, height, y, u, v, y_stride, uv_stride, rgb, rgb_stride, yuv_type);
             return SDL_TRUE;
         default:
             break;