Fixed bug 3964 - YUV to RGB in video/SDL_yuv.c is broken for any output format of type ABGR8888 or BGR888
authorSam Lantinga <slouken@libsdl.org>
Fri, 17 Nov 2017 11:03:02 -0800
changeset 1170588462f00ffac
parent 11704 ddc0bae7ca1a
child 11706 d5d95b296cb0
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.
src/video/SDL_yuv.c
     1.1 --- a/src/video/SDL_yuv.c	Fri Nov 17 10:55:58 2017 -0800
     1.2 +++ b/src/video/SDL_yuv.c	Fri Nov 17 11:03:02 2017 -0800
     1.3 @@ -214,7 +214,7 @@
     1.4              return SDL_TRUE;
     1.5          case SDL_PIXELFORMAT_BGR888:
     1.6          case SDL_PIXELFORMAT_ABGR8888:
     1.7 -            yuv420_bgra_sseu(width, height, y, u, v, y_stride, uv_stride, rgb, rgb_stride, yuv_type);
     1.8 +            yuv420_abgr_sseu(width, height, y, u, v, y_stride, uv_stride, rgb, rgb_stride, yuv_type);
     1.9              return SDL_TRUE;
    1.10          default:
    1.11              break;
    1.12 @@ -246,7 +246,7 @@
    1.13              return SDL_TRUE;
    1.14          case SDL_PIXELFORMAT_BGR888:
    1.15          case SDL_PIXELFORMAT_ABGR8888:
    1.16 -            yuv422_bgra_sseu(width, height, y, u, v, y_stride, uv_stride, rgb, rgb_stride, yuv_type);
    1.17 +            yuv422_abgr_sseu(width, height, y, u, v, y_stride, uv_stride, rgb, rgb_stride, yuv_type);
    1.18              return SDL_TRUE;
    1.19          default:
    1.20              break;
    1.21 @@ -277,7 +277,7 @@
    1.22              return SDL_TRUE;
    1.23          case SDL_PIXELFORMAT_BGR888:
    1.24          case SDL_PIXELFORMAT_ABGR8888:
    1.25 -            yuvnv12_bgra_sseu(width, height, y, u, v, y_stride, uv_stride, rgb, rgb_stride, yuv_type);
    1.26 +            yuvnv12_abgr_sseu(width, height, y, u, v, y_stride, uv_stride, rgb, rgb_stride, yuv_type);
    1.27              return SDL_TRUE;
    1.28          default:
    1.29              break;
    1.30 @@ -318,7 +318,7 @@
    1.31              return SDL_TRUE;
    1.32          case SDL_PIXELFORMAT_BGR888:
    1.33          case SDL_PIXELFORMAT_ABGR8888:
    1.34 -            yuv420_bgra_std(width, height, y, u, v, y_stride, uv_stride, rgb, rgb_stride, yuv_type);
    1.35 +            yuv420_abgr_std(width, height, y, u, v, y_stride, uv_stride, rgb, rgb_stride, yuv_type);
    1.36              return SDL_TRUE;
    1.37          default:
    1.38              break;
    1.39 @@ -350,7 +350,7 @@
    1.40              return SDL_TRUE;
    1.41          case SDL_PIXELFORMAT_BGR888:
    1.42          case SDL_PIXELFORMAT_ABGR8888:
    1.43 -            yuv422_bgra_std(width, height, y, u, v, y_stride, uv_stride, rgb, rgb_stride, yuv_type);
    1.44 +            yuv422_abgr_std(width, height, y, u, v, y_stride, uv_stride, rgb, rgb_stride, yuv_type);
    1.45              return SDL_TRUE;
    1.46          default:
    1.47              break;
    1.48 @@ -381,7 +381,7 @@
    1.49              return SDL_TRUE;
    1.50          case SDL_PIXELFORMAT_BGR888:
    1.51          case SDL_PIXELFORMAT_ABGR8888:
    1.52 -            yuvnv12_bgra_std(width, height, y, u, v, y_stride, uv_stride, rgb, rgb_stride, yuv_type);
    1.53 +            yuvnv12_abgr_std(width, height, y, u, v, y_stride, uv_stride, rgb, rgb_stride, yuv_type);
    1.54              return SDL_TRUE;
    1.55          default:
    1.56              break;