Updated SDL's YUV support, many thanks to Adrien Descamps
authorSam Lantinga <slouken@libsdl.org>
Sun, 12 Nov 2017 22:51:12 -0800
changeset 11702cf166abbde4a
parent 11701 d131f3193794
child 11703 e8cd7b48dc0a
Updated SDL's YUV support, many thanks to Adrien Descamps

New functions get and set the YUV colorspace conversion mode:
SDL_SetYUVConversionMode()
SDL_GetYUVConversionMode()
SDL_GetYUVConversionModeForResolution()

SDL_ConvertPixels() converts between all supported RGB and YUV formats, with SSE acceleration for converting from planar YUV formats (YV12, NV12, etc) to common RGB/RGBA formats.

Added a new test program, testyuv, to verify correctness and speed of YUV conversion functionality.
.hgignore
Android.mk
CMakeLists.txt
VisualC-WinRT/UWP_VS2015/SDL-UWP.vcxproj
VisualC-WinRT/UWP_VS2015/SDL-UWP.vcxproj.filters
VisualC-WinRT/WinPhone80_VS2012/SDL-WinPhone80.vcxproj
VisualC-WinRT/WinPhone80_VS2012/SDL-WinPhone80.vcxproj.filters
VisualC-WinRT/WinPhone81_VS2013/SDL-WinPhone81.vcxproj
VisualC-WinRT/WinPhone81_VS2013/SDL-WinPhone81.vcxproj.filters
VisualC-WinRT/WinRT80_VS2012/SDL-WinRT80.vcxproj
VisualC-WinRT/WinRT80_VS2012/SDL-WinRT80.vcxproj.filters
VisualC-WinRT/WinRT81_VS2013/SDL-WinRT81.vcxproj
VisualC-WinRT/WinRT81_VS2013/SDL-WinRT81.vcxproj.filters
VisualC/SDL.sln
VisualC/SDL/SDL.vcxproj
VisualC/SDL/SDL.vcxproj.filters
VisualC/tests/testyuv/testyuv.vcxproj
Xcode-iOS/SDL/SDL.xcodeproj/project.pbxproj
Xcode-iOS/SDLtest/SDL2test.xcodeproj/project.pbxproj
Xcode-iOS/Test/Info.plist
Xcode-iOS/Test/TestiPhoneOS.xcodeproj/project.pbxproj
Xcode/SDL/SDL.xcodeproj/project.pbxproj
configure
configure.in
include/SDL_surface.h
src/dynapi/SDL_dynapi_overrides.h
src/dynapi/SDL_dynapi_procs.h
src/render/SDL_yuv_mmx.c
src/render/SDL_yuv_mmx_c.h
src/render/SDL_yuv_sw.c
src/render/SDL_yuv_sw_c.h
src/render/direct3d/SDL_render_d3d.c
src/render/direct3d/SDL_shaders_d3d.c
src/render/direct3d/SDL_shaders_d3d.h
src/render/direct3d11/SDL_render_d3d11.c
src/render/direct3d11/SDL_shaders_d3d11.c
src/render/direct3d11/SDL_shaders_d3d11.h
src/render/mmx.h
src/render/opengl/SDL_render_gl.c
src/render/opengl/SDL_shaders_gl.c
src/render/opengl/SDL_shaders_gl.h
src/render/opengles2/SDL_render_gles2.c
src/render/opengles2/SDL_shaders_gles2.c
src/render/opengles2/SDL_shaders_gles2.h
src/video/SDL_pixels.c
src/video/SDL_pixels_c.h
src/video/SDL_surface.c
src/video/SDL_yuv.c
src/video/SDL_yuv_c.h
src/video/yuv2rgb/LICENSE
src/video/yuv2rgb/README.md
src/video/yuv2rgb/yuv_rgb.c
src/video/yuv2rgb/yuv_rgb.h
src/video/yuv2rgb/yuv_rgb_sse_func.h
src/video/yuv2rgb/yuv_rgb_std_func.h
test/Makefile.in
test/testoverlay2.c
test/testyuv.bmp
test/testyuv.c
test/testyuv_cvt.c
test/testyuv_cvt.h
     1.1 --- a/.hgignore	Sun Nov 12 10:59:05 2017 -0800
     1.2 +++ b/.hgignore	Sun Nov 12 22:51:12 2017 -0800
     1.3 @@ -70,14 +70,19 @@
     1.4  test/loopwave
     1.5  test/loopwavequeue
     1.6  test/testatomic
     1.7 +test/testaudiocapture
     1.8  test/testaudiohotplug
     1.9  test/testaudioinfo
    1.10  test/testautomation
    1.11 +test/testbounds
    1.12 +test/testcustomcursor
    1.13 +test/testdisplayinfo
    1.14  test/testdraw2
    1.15  test/testdrawchessboard
    1.16  test/testdropfile
    1.17  test/testerror
    1.18  test/testfile
    1.19 +test/testfilesystem
    1.20  test/testgamecontroller
    1.21  test/testgesture
    1.22  test/testgl2
    1.23 @@ -99,7 +104,7 @@
    1.24  test/testoverlay2
    1.25  test/testplatform
    1.26  test/testpower
    1.27 -test/testfilesystem
    1.28 +test/testqsort
    1.29  test/testrelative
    1.30  test/testrendercopyex
    1.31  test/testrendertarget
    1.32 @@ -117,11 +122,8 @@
    1.33  test/testver
    1.34  test/testviewport
    1.35  test/testwm2
    1.36 -test/testbounds
    1.37 +test/testyuv
    1.38  test/torturethread
    1.39 -test/testdisplayinfo
    1.40 -test/testqsort
    1.41 -test/testaudiocapture
    1.42  test/*.exe
    1.43  test/*.dSYM
    1.44  buildbot
     2.1 --- a/Android.mk	Sun Nov 12 10:59:05 2017 -0800
     2.2 +++ b/Android.mk	Sun Nov 12 22:51:12 2017 -0800
     2.3 @@ -45,6 +45,7 @@
     2.4  	$(wildcard $(LOCAL_PATH)/src/timer/unix/*.c) \
     2.5  	$(wildcard $(LOCAL_PATH)/src/video/*.c) \
     2.6  	$(wildcard $(LOCAL_PATH)/src/video/android/*.c) \
     2.7 +	$(wildcard $(LOCAL_PATH)/src/video/yuv2rgb/*.c) \
     2.8  	$(wildcard $(LOCAL_PATH)/src/test/*.c))
     2.9  
    2.10  LOCAL_CFLAGS += -DGL_GLEXT_PROTOTYPES
     3.1 --- a/CMakeLists.txt	Sun Nov 12 10:59:05 2017 -0800
     3.2 +++ b/CMakeLists.txt	Sun Nov 12 22:51:12 2017 -0800
     3.3 @@ -357,6 +357,7 @@
     3.4    ${SDL2_SOURCE_DIR}/src/thread/*.c
     3.5    ${SDL2_SOURCE_DIR}/src/timer/*.c
     3.6    ${SDL2_SOURCE_DIR}/src/video/*.c)
     3.7 +  ${SDL2_SOURCE_DIR}/src/video/yuv2rgb/*.c)
     3.8  
     3.9  
    3.10  if(ASSERTIONS STREQUAL "auto")
     4.1 --- a/VisualC-WinRT/UWP_VS2015/SDL-UWP.vcxproj	Sun Nov 12 10:59:05 2017 -0800
     4.2 +++ b/VisualC-WinRT/UWP_VS2015/SDL-UWP.vcxproj	Sun Nov 12 22:51:12 2017 -0800
     4.3 @@ -117,7 +117,7 @@
     4.4      <ClInclude Include="..\..\src\joystick\windows\SDL_windowsjoystick_c.h" />
     4.5      <ClInclude Include="..\..\src\joystick\windows\SDL_xinputjoystick_c.h" />
     4.6      <ClInclude Include="..\..\src\render\direct3d11\SDL_render_winrt.h" />
     4.7 -    <ClInclude Include="..\..\src\render\mmx.h" />
     4.8 +    <ClInclude Include="..\..\src\render\direct3d11\SDL_shaders_d3d11.h" />
     4.9      <ClInclude Include="..\..\src\render\opengles2\SDL_gles2funcs.h" />
    4.10      <ClInclude Include="..\..\src\render\opengles2\SDL_shaders_gles2.h" />
    4.11      <ClInclude Include="..\..\src\render\SDL_d3dmath.h" />
    4.12 @@ -155,12 +155,14 @@
    4.13      <ClInclude Include="..\..\src\video\SDL_RLEaccel_c.h" />
    4.14      <ClInclude Include="..\..\src\video\SDL_shape_internals.h" />
    4.15      <ClInclude Include="..\..\src\video\SDL_sysvideo.h" />
    4.16 +    <ClInclude Include="..\..\src\video\SDL_yuv_c.h" />
    4.17      <ClInclude Include="..\..\src\video\winrt\SDL_winrtevents_c.h" />
    4.18      <ClInclude Include="..\..\src\video\winrt\SDL_winrtgamebar_cpp.h" />
    4.19      <ClInclude Include="..\..\src\video\winrt\SDL_winrtmessagebox.h" />
    4.20      <ClInclude Include="..\..\src\video\winrt\SDL_winrtmouse_c.h" />
    4.21      <ClInclude Include="..\..\src\video\winrt\SDL_winrtopengles.h" />
    4.22      <ClInclude Include="..\..\src\video\winrt\SDL_winrtvideo_cpp.h" />
    4.23 +    <ClInclude Include="..\..\src\video\yuv2rgb\yuv_rgb.h" />
    4.24    </ItemGroup>
    4.25    <ItemGroup>
    4.26      <ClCompile Include="..\..\src\atomic\SDL_atomic.c" />
    4.27 @@ -251,11 +253,11 @@
    4.28        <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">true</CompileAsWinRT>
    4.29        <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</CompileAsWinRT>
    4.30      </ClCompile>
    4.31 +    <ClCompile Include="..\..\src\render\direct3d11\SDL_shaders_d3d11.c" />
    4.32      <ClCompile Include="..\..\src\render\opengles2\SDL_render_gles2.c" />
    4.33      <ClCompile Include="..\..\src\render\opengles2\SDL_shaders_gles2.c" />
    4.34      <ClCompile Include="..\..\src\render\SDL_d3dmath.c" />
    4.35      <ClCompile Include="..\..\src\render\SDL_render.c" />
    4.36 -    <ClCompile Include="..\..\src\render\SDL_yuv_mmx.c" />
    4.37      <ClCompile Include="..\..\src\render\SDL_yuv_sw.c" />
    4.38      <ClCompile Include="..\..\src\render\software\SDL_blendfillrect.c" />
    4.39      <ClCompile Include="..\..\src\render\software\SDL_blendline.c" />
    4.40 @@ -305,6 +307,7 @@
    4.41      <ClCompile Include="..\..\src\video\SDL_stretch.c" />
    4.42      <ClCompile Include="..\..\src\video\SDL_surface.c" />
    4.43      <ClCompile Include="..\..\src\video\SDL_video.c" />
    4.44 +    <ClCompile Include="..\..\src\video\SDL_yuv.c" />
    4.45      <ClCompile Include="..\..\src\video\winrt\SDL_winrtevents.cpp">
    4.46        <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</CompileAsWinRT>
    4.47        <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">true</CompileAsWinRT>
    4.48 @@ -369,6 +372,7 @@
    4.49        <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">true</CompileAsWinRT>
    4.50        <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</CompileAsWinRT>
    4.51      </ClCompile>
    4.52 +    <ClCompile Include="..\..\src\video\yuv2rgb\yuv_rgb.c" />
    4.53    </ItemGroup>
    4.54    <PropertyGroup Label="Globals">
    4.55      <ProjectGuid>{89e9b32e-a86a-47c3-a948-d2b1622925ce}</ProjectGuid>
     5.1 --- a/VisualC-WinRT/UWP_VS2015/SDL-UWP.vcxproj.filters	Sun Nov 12 10:59:05 2017 -0800
     5.2 +++ b/VisualC-WinRT/UWP_VS2015/SDL-UWP.vcxproj.filters	Sun Nov 12 22:51:12 2017 -0800
     5.3 @@ -267,9 +267,6 @@
     5.4      <ClInclude Include="..\..\src\render\direct3d11\SDL_render_winrt.h">
     5.5        <Filter>Source Files</Filter>
     5.6      </ClInclude>
     5.7 -    <ClInclude Include="..\..\src\render\mmx.h">
     5.8 -      <Filter>Source Files</Filter>
     5.9 -    </ClInclude>
    5.10      <ClInclude Include="..\..\src\render\opengles2\SDL_gles2funcs.h">
    5.11        <Filter>Source Files</Filter>
    5.12      </ClInclude>
    5.13 @@ -411,6 +408,15 @@
    5.14      <ClInclude Include="..\..\src\haptic\windows\SDL_windowshaptic_c.h">
    5.15        <Filter>Source Files</Filter>
    5.16      </ClInclude>
    5.17 +    <ClInclude Include="..\..\src\video\SDL_yuv_c.h">
    5.18 +      <Filter>Source Files</Filter>
    5.19 +    </ClInclude>
    5.20 +    <ClInclude Include="..\..\src\video\yuv2rgb\yuv_rgb.h">
    5.21 +      <Filter>Source Files</Filter>
    5.22 +    </ClInclude>
    5.23 +    <ClInclude Include="..\..\src\render\direct3d11\SDL_shaders_d3d11.h">
    5.24 +      <Filter>Source Files</Filter>
    5.25 +    </ClInclude>
    5.26    </ItemGroup>
    5.27    <ItemGroup>
    5.28      <ClCompile Include="..\..\src\atomic\SDL_atomic.c">
    5.29 @@ -551,9 +557,6 @@
    5.30      <ClCompile Include="..\..\src\render\SDL_render.c">
    5.31        <Filter>Source Files</Filter>
    5.32      </ClCompile>
    5.33 -    <ClCompile Include="..\..\src\render\SDL_yuv_mmx.c">
    5.34 -      <Filter>Source Files</Filter>
    5.35 -    </ClCompile>
    5.36      <ClCompile Include="..\..\src\render\SDL_yuv_sw.c">
    5.37        <Filter>Source Files</Filter>
    5.38      </ClCompile>
    5.39 @@ -737,5 +740,14 @@
    5.40      <ClCompile Include="..\..\src\haptic\windows\SDL_xinputhaptic.c">
    5.41        <Filter>Source Files</Filter>
    5.42      </ClCompile>
    5.43 +    <ClCompile Include="..\..\src\video\SDL_yuv.c">
    5.44 +      <Filter>Source Files</Filter>
    5.45 +    </ClCompile>
    5.46 +    <ClCompile Include="..\..\src\video\yuv2rgb\yuv_rgb.c">
    5.47 +      <Filter>Source Files</Filter>
    5.48 +    </ClCompile>
    5.49 +    <ClCompile Include="..\..\src\render\direct3d11\SDL_shaders_d3d11.c">
    5.50 +      <Filter>Source Files</Filter>
    5.51 +    </ClCompile>
    5.52    </ItemGroup>
    5.53  </Project>
    5.54 \ No newline at end of file
     6.1 --- a/VisualC-WinRT/WinPhone80_VS2012/SDL-WinPhone80.vcxproj	Sun Nov 12 10:59:05 2017 -0800
     6.2 +++ b/VisualC-WinRT/WinPhone80_VS2012/SDL-WinPhone80.vcxproj	Sun Nov 12 22:51:12 2017 -0800
     6.3 @@ -235,7 +235,7 @@
     6.4      <ClInclude Include="..\..\src\joystick\SDL_sysjoystick.h" />
     6.5      <ClInclude Include="..\..\src\joystick\windows\SDL_xinputjoystick_c.h" />
     6.6      <ClInclude Include="..\..\src\render\direct3d11\SDL_render_winrt.h" />
     6.7 -    <ClInclude Include="..\..\src\render\mmx.h" />
     6.8 +    <ClInclude Include="..\..\src\render\direct3d11\SDL_shaders_d3d11.h" />
     6.9      <ClInclude Include="..\..\src\render\opengles2\SDL_gles2funcs.h" />
    6.10      <ClInclude Include="..\..\src\render\opengles2\SDL_shaders_gles2.h" />
    6.11      <ClInclude Include="..\..\src\render\SDL_d3dmath.h" />
    6.12 @@ -272,12 +272,14 @@
    6.13      <ClInclude Include="..\..\src\video\SDL_RLEaccel_c.h" />
    6.14      <ClInclude Include="..\..\src\video\SDL_shape_internals.h" />
    6.15      <ClInclude Include="..\..\src\video\SDL_sysvideo.h" />
    6.16 +    <ClInclude Include="..\..\src\video\SDL_yuv_c.h" />
    6.17      <ClInclude Include="..\..\src\video\winrt\SDL_winrtevents_c.h" />
    6.18      <ClInclude Include="..\..\src\video\winrt\SDL_winrtgamebar_cpp.h" />
    6.19      <ClInclude Include="..\..\src\video\winrt\SDL_winrtmessagebox.h" />
    6.20      <ClInclude Include="..\..\src\video\winrt\SDL_winrtmouse_c.h" />
    6.21      <ClInclude Include="..\..\src\video\winrt\SDL_winrtopengles.h" />
    6.22      <ClInclude Include="..\..\src\video\winrt\SDL_winrtvideo_cpp.h" />
    6.23 +    <ClInclude Include="..\..\src\video\yuv2rgb\yuv_rgb.h" />
    6.24    </ItemGroup>
    6.25    <ItemGroup>
    6.26      <ClCompile Include="..\..\src\atomic\SDL_atomic.c" />
    6.27 @@ -350,11 +352,11 @@
    6.28        <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</CompileAsWinRT>
    6.29        <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</CompileAsWinRT>
    6.30      </ClCompile>
    6.31 +    <ClCompile Include="..\..\src\render\direct3d11\SDL_shaders_d3d11.c" />
    6.32      <ClCompile Include="..\..\src\render\opengles2\SDL_render_gles2.c" />
    6.33      <ClCompile Include="..\..\src\render\opengles2\SDL_shaders_gles2.c" />
    6.34      <ClCompile Include="..\..\src\render\SDL_d3dmath.c" />
    6.35      <ClCompile Include="..\..\src\render\SDL_render.c" />
    6.36 -    <ClCompile Include="..\..\src\render\SDL_yuv_mmx.c" />
    6.37      <ClCompile Include="..\..\src\render\SDL_yuv_sw.c" />
    6.38      <ClCompile Include="..\..\src\render\software\SDL_blendfillrect.c" />
    6.39      <ClCompile Include="..\..\src\render\software\SDL_blendline.c" />
    6.40 @@ -404,6 +406,7 @@
    6.41      <ClCompile Include="..\..\src\video\SDL_stretch.c" />
    6.42      <ClCompile Include="..\..\src\video\SDL_surface.c" />
    6.43      <ClCompile Include="..\..\src\video\SDL_video.c" />
    6.44 +    <ClCompile Include="..\..\src\video\SDL_yuv.c" />
    6.45      <ClCompile Include="..\..\src\video\winrt\SDL_winrtevents.cpp">
    6.46        <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">true</CompileAsWinRT>
    6.47        <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">true</CompileAsWinRT>
    6.48 @@ -452,6 +455,7 @@
    6.49        <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</CompileAsWinRT>
    6.50        <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</CompileAsWinRT>
    6.51      </ClCompile>
    6.52 +    <ClCompile Include="..\..\src\video\yuv2rgb\yuv_rgb.c" />
    6.53    </ItemGroup>
    6.54    <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
    6.55    <Import Project="$(MSBuildExtensionsPath)\Microsoft\WindowsPhone\v$(TargetPlatformVersion)\Microsoft.Cpp.WindowsPhone.$(TargetPlatformVersion).targets" />
     7.1 --- a/VisualC-WinRT/WinPhone80_VS2012/SDL-WinPhone80.vcxproj.filters	Sun Nov 12 10:59:05 2017 -0800
     7.2 +++ b/VisualC-WinRT/WinPhone80_VS2012/SDL-WinPhone80.vcxproj.filters	Sun Nov 12 22:51:12 2017 -0800
     7.3 @@ -216,9 +216,6 @@
     7.4      <ClInclude Include="..\..\src\joystick\SDL_sysjoystick.h">
     7.5        <Filter>Source Files</Filter>
     7.6      </ClInclude>
     7.7 -    <ClInclude Include="..\..\src\render\mmx.h">
     7.8 -      <Filter>Source Files</Filter>
     7.9 -    </ClInclude>
    7.10      <ClInclude Include="..\..\src\render\SDL_sysrender.h">
    7.11        <Filter>Source Files</Filter>
    7.12      </ClInclude>
    7.13 @@ -375,6 +372,15 @@
    7.14      <ClInclude Include="..\..\src\SDL_dataqueue.h">
    7.15        <Filter>Source Files</Filter>
    7.16      </ClInclude>
    7.17 +    <ClInclude Include="..\..\src\video\SDL_yuv_c.h">
    7.18 +      <Filter>Source Files</Filter>
    7.19 +    </ClInclude>
    7.20 +    <ClInclude Include="..\..\src\video\yuv2rgb\yuv_rgb.h">
    7.21 +      <Filter>Source Files</Filter>
    7.22 +    </ClInclude>
    7.23 +    <ClInclude Include="..\..\src\render\direct3d11\SDL_shaders_d3d11.h">
    7.24 +      <Filter>Source Files</Filter>
    7.25 +    </ClInclude>
    7.26    </ItemGroup>
    7.27    <ItemGroup>
    7.28      <ClCompile Include="..\..\src\atomic\SDL_atomic.c">
    7.29 @@ -467,9 +473,6 @@
    7.30      <ClCompile Include="..\..\src\render\SDL_render.c">
    7.31        <Filter>Source Files</Filter>
    7.32      </ClCompile>
    7.33 -    <ClCompile Include="..\..\src\render\SDL_yuv_mmx.c">
    7.34 -      <Filter>Source Files</Filter>
    7.35 -    </ClCompile>
    7.36      <ClCompile Include="..\..\src\render\SDL_yuv_sw.c">
    7.37        <Filter>Source Files</Filter>
    7.38      </ClCompile>
    7.39 @@ -683,5 +686,14 @@
    7.40      <ClCompile Include="..\..\src\SDL_dataqueue.c">
    7.41        <Filter>Source Files</Filter>
    7.42      </ClCompile>
    7.43 +    <ClCompile Include="..\..\src\video\SDL_yuv.c">
    7.44 +      <Filter>Source Files</Filter>
    7.45 +    </ClCompile>
    7.46 +    <ClCompile Include="..\..\src\video\yuv2rgb\yuv_rgb.c">
    7.47 +      <Filter>Source Files</Filter>
    7.48 +    </ClCompile>
    7.49 +    <ClCompile Include="..\..\src\render\direct3d11\SDL_shaders_d3d11.c">
    7.50 +      <Filter>Source Files</Filter>
    7.51 +    </ClCompile>
    7.52    </ItemGroup>
    7.53  </Project>
    7.54 \ No newline at end of file
     8.1 --- a/VisualC-WinRT/WinPhone81_VS2013/SDL-WinPhone81.vcxproj	Sun Nov 12 10:59:05 2017 -0800
     8.2 +++ b/VisualC-WinRT/WinPhone81_VS2013/SDL-WinPhone81.vcxproj	Sun Nov 12 22:51:12 2017 -0800
     8.3 @@ -101,7 +101,7 @@
     8.4      <ClInclude Include="..\..\src\joystick\SDL_sysjoystick.h" />
     8.5      <ClInclude Include="..\..\src\joystick\windows\SDL_xinputjoystick_c.h" />
     8.6      <ClInclude Include="..\..\src\render\direct3d11\SDL_render_winrt.h" />
     8.7 -    <ClInclude Include="..\..\src\render\mmx.h" />
     8.8 +    <ClInclude Include="..\..\src\render\direct3d11\SDL_shaders_d3d11.h" />
     8.9      <ClInclude Include="..\..\src\render\opengles2\SDL_gles2funcs.h" />
    8.10      <ClInclude Include="..\..\src\render\opengles2\SDL_shaders_gles2.h" />
    8.11      <ClInclude Include="..\..\src\render\SDL_d3dmath.h" />
    8.12 @@ -138,12 +138,14 @@
    8.13      <ClInclude Include="..\..\src\video\SDL_RLEaccel_c.h" />
    8.14      <ClInclude Include="..\..\src\video\SDL_shape_internals.h" />
    8.15      <ClInclude Include="..\..\src\video\SDL_sysvideo.h" />
    8.16 +    <ClInclude Include="..\..\src\video\SDL_yuv_c.h" />
    8.17      <ClInclude Include="..\..\src\video\winrt\SDL_winrtevents_c.h" />
    8.18      <ClInclude Include="..\..\src\video\winrt\SDL_winrtgamebar_cpp.h" />
    8.19      <ClInclude Include="..\..\src\video\winrt\SDL_winrtmessagebox.h" />
    8.20      <ClInclude Include="..\..\src\video\winrt\SDL_winrtmouse_c.h" />
    8.21      <ClInclude Include="..\..\src\video\winrt\SDL_winrtopengles.h" />
    8.22      <ClInclude Include="..\..\src\video\winrt\SDL_winrtvideo_cpp.h" />
    8.23 +    <ClInclude Include="..\..\src\video\yuv2rgb\yuv_rgb.h" />
    8.24    </ItemGroup>
    8.25    <ItemGroup>
    8.26      <ClCompile Include="..\..\src\atomic\SDL_atomic.c" />
    8.27 @@ -216,11 +218,11 @@
    8.28        <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</CompileAsWinRT>
    8.29        <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">true</CompileAsWinRT>
    8.30      </ClCompile>
    8.31 +    <ClCompile Include="..\..\src\render\direct3d11\SDL_shaders_d3d11.c" />
    8.32      <ClCompile Include="..\..\src\render\opengles2\SDL_render_gles2.c" />
    8.33      <ClCompile Include="..\..\src\render\opengles2\SDL_shaders_gles2.c" />
    8.34      <ClCompile Include="..\..\src\render\SDL_d3dmath.c" />
    8.35      <ClCompile Include="..\..\src\render\SDL_render.c" />
    8.36 -    <ClCompile Include="..\..\src\render\SDL_yuv_mmx.c" />
    8.37      <ClCompile Include="..\..\src\render\SDL_yuv_sw.c" />
    8.38      <ClCompile Include="..\..\src\render\software\SDL_blendfillrect.c" />
    8.39      <ClCompile Include="..\..\src\render\software\SDL_blendline.c" />
    8.40 @@ -271,6 +273,7 @@
    8.41      <ClCompile Include="..\..\src\video\SDL_stretch.c" />
    8.42      <ClCompile Include="..\..\src\video\SDL_surface.c" />
    8.43      <ClCompile Include="..\..\src\video\SDL_video.c" />
    8.44 +    <ClCompile Include="..\..\src\video\SDL_yuv.c" />
    8.45      <ClCompile Include="..\..\src\video\winrt\SDL_winrtevents.cpp">
    8.46        <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</CompileAsWinRT>
    8.47        <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">true</CompileAsWinRT>
    8.48 @@ -319,6 +322,7 @@
    8.49        <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</CompileAsWinRT>
    8.50        <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">true</CompileAsWinRT>
    8.51      </ClCompile>
    8.52 +    <ClCompile Include="..\..\src\video\yuv2rgb\yuv_rgb.c" />
    8.53    </ItemGroup>
    8.54    <PropertyGroup Label="Globals">
    8.55      <ProjectGuid>{48fadc0e-964d-4dab-bced-372e0ad19577}</ProjectGuid>
     9.1 --- a/VisualC-WinRT/WinPhone81_VS2013/SDL-WinPhone81.vcxproj.filters	Sun Nov 12 10:59:05 2017 -0800
     9.2 +++ b/VisualC-WinRT/WinPhone81_VS2013/SDL-WinPhone81.vcxproj.filters	Sun Nov 12 22:51:12 2017 -0800
     9.3 @@ -252,9 +252,6 @@
     9.4      <ClInclude Include="..\..\src\render\direct3d11\SDL_render_winrt.h">
     9.5        <Filter>Source Files</Filter>
     9.6      </ClInclude>
     9.7 -    <ClInclude Include="..\..\src\render\mmx.h">
     9.8 -      <Filter>Source Files</Filter>
     9.9 -    </ClInclude>
    9.10      <ClInclude Include="..\..\src\render\opengles2\SDL_gles2funcs.h">
    9.11        <Filter>Source Files</Filter>
    9.12      </ClInclude>
    9.13 @@ -384,6 +381,13 @@
    9.14      <ClInclude Include="..\..\src\SDL_dataqueue.h">
    9.15        <Filter>Source Files</Filter>
    9.16      </ClInclude>
    9.17 +    <ClInclude Include="..\..\src\video\SDL_yuv_c.h">
    9.18 +      <Filter>Source Files</Filter>
    9.19 +    </ClInclude>
    9.20 +    <ClInclude Include="..\..\src\video\yuv2rgb\yuv_rgb.h">
    9.21 +      <Filter>Source Files</Filter>
    9.22 +    </ClInclude>
    9.23 +    <ClInclude Include="..\..\src\render\direct3d11\SDL_shaders_d3d11.h" />
    9.24    </ItemGroup>
    9.25    <ItemGroup>
    9.26      <ClCompile Include="..\..\src\atomic\SDL_atomic.c">
    9.27 @@ -515,9 +519,6 @@
    9.28      <ClCompile Include="..\..\src\render\SDL_render.c">
    9.29        <Filter>Source Files</Filter>
    9.30      </ClCompile>
    9.31 -    <ClCompile Include="..\..\src\render\SDL_yuv_mmx.c">
    9.32 -      <Filter>Source Files</Filter>
    9.33 -    </ClCompile>
    9.34      <ClCompile Include="..\..\src\render\SDL_yuv_sw.c">
    9.35        <Filter>Source Files</Filter>
    9.36      </ClCompile>
    9.37 @@ -695,5 +696,12 @@
    9.38      <ClCompile Include="..\..\src\SDL_dataqueue.c">
    9.39        <Filter>Source Files</Filter>
    9.40      </ClCompile>
    9.41 +    <ClCompile Include="..\..\src\video\SDL_yuv.c">
    9.42 +      <Filter>Source Files</Filter>
    9.43 +    </ClCompile>
    9.44 +    <ClCompile Include="..\..\src\video\yuv2rgb\yuv_rgb.c">
    9.45 +      <Filter>Source Files</Filter>
    9.46 +    </ClCompile>
    9.47 +    <ClCompile Include="..\..\src\render\direct3d11\SDL_shaders_d3d11.c" />
    9.48    </ItemGroup>
    9.49  </Project>
    9.50 \ No newline at end of file
    10.1 --- a/VisualC-WinRT/WinRT80_VS2012/SDL-WinRT80.vcxproj	Sun Nov 12 10:59:05 2017 -0800
    10.2 +++ b/VisualC-WinRT/WinRT80_VS2012/SDL-WinRT80.vcxproj	Sun Nov 12 22:51:12 2017 -0800
    10.3 @@ -114,11 +114,11 @@
    10.4        <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</CompileAsWinRT>
    10.5        <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</CompileAsWinRT>
    10.6      </ClCompile>
    10.7 +    <ClCompile Include="..\..\src\render\direct3d11\SDL_shaders_d3d11.c" />
    10.8      <ClCompile Include="..\..\src\render\opengles2\SDL_render_gles2.c" />
    10.9      <ClCompile Include="..\..\src\render\opengles2\SDL_shaders_gles2.c" />
   10.10      <ClCompile Include="..\..\src\render\SDL_d3dmath.c" />
   10.11      <ClCompile Include="..\..\src\render\SDL_render.c" />
   10.12 -    <ClCompile Include="..\..\src\render\SDL_yuv_mmx.c" />
   10.13      <ClCompile Include="..\..\src\render\SDL_yuv_sw.c" />
   10.14      <ClCompile Include="..\..\src\render\software\SDL_blendfillrect.c" />
   10.15      <ClCompile Include="..\..\src\render\software\SDL_blendline.c" />
   10.16 @@ -168,6 +168,7 @@
   10.17      <ClCompile Include="..\..\src\video\SDL_stretch.c" />
   10.18      <ClCompile Include="..\..\src\video\SDL_surface.c" />
   10.19      <ClCompile Include="..\..\src\video\SDL_video.c" />
   10.20 +    <ClCompile Include="..\..\src\video\SDL_yuv.c" />
   10.21      <ClCompile Include="..\..\src\video\winrt\SDL_winrtevents.cpp">
   10.22        <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">true</CompileAsWinRT>
   10.23        <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">true</CompileAsWinRT>
   10.24 @@ -232,6 +233,7 @@
   10.25        <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</CompileAsWinRT>
   10.26        <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</CompileAsWinRT>
   10.27      </ClCompile>
   10.28 +    <ClCompile Include="..\..\src\video\yuv2rgb\yuv_rgb.c" />
   10.29    </ItemGroup>
   10.30    <ItemGroup>
   10.31      <ClInclude Include="..\..\include\begin_code.h" />
   10.32 @@ -323,7 +325,7 @@
   10.33      <ClInclude Include="..\..\src\joystick\windows\SDL_windowsjoystick_c.h" />
   10.34      <ClInclude Include="..\..\src\joystick\windows\SDL_xinputjoystick_c.h" />
   10.35      <ClInclude Include="..\..\src\render\direct3d11\SDL_render_winrt.h" />
   10.36 -    <ClInclude Include="..\..\src\render\mmx.h" />
   10.37 +    <ClInclude Include="..\..\src\render\direct3d11\SDL_shaders_d3d11.h" />
   10.38      <ClInclude Include="..\..\src\render\opengles2\SDL_gles2funcs.h" />
   10.39      <ClInclude Include="..\..\src\render\opengles2\SDL_shaders_gles2.h" />
   10.40      <ClInclude Include="..\..\src\render\SDL_d3dmath.h" />
   10.41 @@ -361,12 +363,14 @@
   10.42      <ClInclude Include="..\..\src\video\SDL_RLEaccel_c.h" />
   10.43      <ClInclude Include="..\..\src\video\SDL_shape_internals.h" />
   10.44      <ClInclude Include="..\..\src\video\SDL_sysvideo.h" />
   10.45 +    <ClInclude Include="..\..\src\video\SDL_yuv_c.h" />
   10.46      <ClInclude Include="..\..\src\video\winrt\SDL_winrtevents_c.h" />
   10.47      <ClInclude Include="..\..\src\video\winrt\SDL_winrtgamebar_cpp.h" />
   10.48      <ClInclude Include="..\..\src\video\winrt\SDL_winrtmessagebox.h" />
   10.49      <ClInclude Include="..\..\src\video\winrt\SDL_winrtmouse_c.h" />
   10.50      <ClInclude Include="..\..\src\video\winrt\SDL_winrtopengles.h" />
   10.51      <ClInclude Include="..\..\src\video\winrt\SDL_winrtvideo_cpp.h" />
   10.52 +    <ClInclude Include="..\..\src\video\yuv2rgb\yuv_rgb.h" />
   10.53    </ItemGroup>
   10.54    <PropertyGroup Label="Globals">
   10.55      <ProjectGuid>{aeaea3a2-d4e6-45b1-8ec6-53d84287fc14}</ProjectGuid>
    11.1 --- a/VisualC-WinRT/WinRT80_VS2012/SDL-WinRT80.vcxproj.filters	Sun Nov 12 10:59:05 2017 -0800
    11.2 +++ b/VisualC-WinRT/WinRT80_VS2012/SDL-WinRT80.vcxproj.filters	Sun Nov 12 22:51:12 2017 -0800
    11.3 @@ -220,9 +220,6 @@
    11.4      <ClCompile Include="..\..\src\audio\xaudio2\SDL_xaudio2_winrthelpers.cpp">
    11.5        <Filter>Source Files</Filter>
    11.6      </ClCompile>
    11.7 -    <ClCompile Include="..\..\src\render\SDL_yuv_mmx.c">
    11.8 -      <Filter>Source Files</Filter>
    11.9 -    </ClCompile>
   11.10      <ClCompile Include="..\..\src\render\SDL_yuv_sw.c">
   11.11        <Filter>Source Files</Filter>
   11.12      </ClCompile>
   11.13 @@ -322,6 +319,15 @@
   11.14      <ClCompile Include="..\..\src\SDL_dataqueue.c">
   11.15        <Filter>Source Files</Filter>
   11.16      </ClCompile>
   11.17 +    <ClCompile Include="..\..\src\video\SDL_yuv.c">
   11.18 +      <Filter>Source Files</Filter>
   11.19 +    </ClCompile>
   11.20 +    <ClCompile Include="..\..\src\video\yuv2rgb\yuv_rgb.c">
   11.21 +      <Filter>Source Files</Filter>
   11.22 +    </ClCompile>
   11.23 +    <ClCompile Include="..\..\src\render\direct3d11\SDL_shaders_d3d11.c">
   11.24 +      <Filter>Source Files</Filter>
   11.25 +    </ClCompile>
   11.26    </ItemGroup>
   11.27    <ItemGroup>
   11.28      <ClInclude Include="..\..\include\begin_code.h">
   11.29 @@ -444,9 +450,6 @@
   11.30      <ClInclude Include="..\..\src\video\SDL_blit_slow.h">
   11.31        <Filter>Source Files</Filter>
   11.32      </ClInclude>
   11.33 -    <ClInclude Include="..\..\src\render\mmx.h">
   11.34 -      <Filter>Source Files</Filter>
   11.35 -    </ClInclude>
   11.36      <ClInclude Include="..\..\include\SDL_config.h">
   11.37        <Filter>Header Files</Filter>
   11.38      </ClInclude>
   11.39 @@ -723,6 +726,15 @@
   11.40      <ClInclude Include="..\..\src\SDL_dataqueue.h">
   11.41        <Filter>Source Files</Filter>
   11.42      </ClInclude>
   11.43 +    <ClInclude Include="..\..\src\video\SDL_yuv_c.h">
   11.44 +      <Filter>Source Files</Filter>
   11.45 +    </ClInclude>
   11.46 +    <ClInclude Include="..\..\src\video\yuv2rgb\yuv_rgb.h">
   11.47 +      <Filter>Source Files</Filter>
   11.48 +    </ClInclude>
   11.49 +    <ClInclude Include="..\..\src\render\direct3d11\SDL_shaders_d3d11.h">
   11.50 +      <Filter>Source Files</Filter>
   11.51 +    </ClInclude>
   11.52    </ItemGroup>
   11.53    <ItemGroup>
   11.54      <Filter Include="Header Files">
    12.1 --- a/VisualC-WinRT/WinRT81_VS2013/SDL-WinRT81.vcxproj	Sun Nov 12 10:59:05 2017 -0800
    12.2 +++ b/VisualC-WinRT/WinRT81_VS2013/SDL-WinRT81.vcxproj	Sun Nov 12 22:51:12 2017 -0800
    12.3 @@ -116,7 +116,7 @@
    12.4      <ClInclude Include="..\..\src\joystick\windows\SDL_windowsjoystick_c.h" />
    12.5      <ClInclude Include="..\..\src\joystick\windows\SDL_xinputjoystick_c.h" />
    12.6      <ClInclude Include="..\..\src\render\direct3d11\SDL_render_winrt.h" />
    12.7 -    <ClInclude Include="..\..\src\render\mmx.h" />
    12.8 +    <ClInclude Include="..\..\src\render\direct3d11\SDL_shaders_d3d11.h" />
    12.9      <ClInclude Include="..\..\src\render\opengles2\SDL_gles2funcs.h" />
   12.10      <ClInclude Include="..\..\src\render\opengles2\SDL_shaders_gles2.h" />
   12.11      <ClInclude Include="..\..\src\render\SDL_d3dmath.h" />
   12.12 @@ -152,12 +152,14 @@
   12.13      <ClInclude Include="..\..\src\video\SDL_RLEaccel_c.h" />
   12.14      <ClInclude Include="..\..\src\video\SDL_shape_internals.h" />
   12.15      <ClInclude Include="..\..\src\video\SDL_sysvideo.h" />
   12.16 +    <ClInclude Include="..\..\src\video\SDL_yuv_c.h" />
   12.17      <ClInclude Include="..\..\src\video\winrt\SDL_winrtevents_c.h" />
   12.18      <ClInclude Include="..\..\src\video\winrt\SDL_winrtgamebar_cpp.h" />
   12.19      <ClInclude Include="..\..\src\video\winrt\SDL_winrtmessagebox.h" />
   12.20      <ClInclude Include="..\..\src\video\winrt\SDL_winrtmouse_c.h" />
   12.21      <ClInclude Include="..\..\src\video\winrt\SDL_winrtopengles.h" />
   12.22      <ClInclude Include="..\..\src\video\winrt\SDL_winrtvideo_cpp.h" />
   12.23 +    <ClInclude Include="..\..\src\video\yuv2rgb\yuv_rgb.h" />
   12.24    </ItemGroup>
   12.25    <ItemGroup>
   12.26      <ClCompile Include="..\..\src\atomic\SDL_atomic.c" />
   12.27 @@ -248,11 +250,11 @@
   12.28        <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">true</CompileAsWinRT>
   12.29        <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</CompileAsWinRT>
   12.30      </ClCompile>
   12.31 +    <ClCompile Include="..\..\src\render\direct3d11\SDL_shaders_d3d11.c" />
   12.32      <ClCompile Include="..\..\src\render\opengles2\SDL_render_gles2.c" />
   12.33      <ClCompile Include="..\..\src\render\opengles2\SDL_shaders_gles2.c" />
   12.34      <ClCompile Include="..\..\src\render\SDL_d3dmath.c" />
   12.35      <ClCompile Include="..\..\src\render\SDL_render.c" />
   12.36 -    <ClCompile Include="..\..\src\render\SDL_yuv_mmx.c" />
   12.37      <ClCompile Include="..\..\src\render\SDL_yuv_sw.c" />
   12.38      <ClCompile Include="..\..\src\render\software\SDL_blendfillrect.c" />
   12.39      <ClCompile Include="..\..\src\render\software\SDL_blendline.c" />
   12.40 @@ -303,6 +305,7 @@
   12.41      <ClCompile Include="..\..\src\video\SDL_stretch.c" />
   12.42      <ClCompile Include="..\..\src\video\SDL_surface.c" />
   12.43      <ClCompile Include="..\..\src\video\SDL_video.c" />
   12.44 +    <ClCompile Include="..\..\src\video\SDL_yuv.c" />
   12.45      <ClCompile Include="..\..\src\video\winrt\SDL_winrtevents.cpp">
   12.46        <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</CompileAsWinRT>
   12.47        <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">true</CompileAsWinRT>
   12.48 @@ -367,6 +370,7 @@
   12.49        <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">true</CompileAsWinRT>
   12.50        <CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</CompileAsWinRT>
   12.51      </ClCompile>
   12.52 +    <ClCompile Include="..\..\src\video\yuv2rgb\yuv_rgb.c" />
   12.53    </ItemGroup>
   12.54    <PropertyGroup Label="Globals">
   12.55      <ProjectGuid>{c8df6173-06a1-4f56-a9bc-2002596b30e9}</ProjectGuid>
    13.1 --- a/VisualC-WinRT/WinRT81_VS2013/SDL-WinRT81.vcxproj.filters	Sun Nov 12 10:59:05 2017 -0800
    13.2 +++ b/VisualC-WinRT/WinRT81_VS2013/SDL-WinRT81.vcxproj.filters	Sun Nov 12 22:51:12 2017 -0800
    13.3 @@ -252,9 +252,6 @@
    13.4      <ClInclude Include="..\..\src\render\direct3d11\SDL_render_winrt.h">
    13.5        <Filter>Source Files</Filter>
    13.6      </ClInclude>
    13.7 -    <ClInclude Include="..\..\src\render\mmx.h">
    13.8 -      <Filter>Source Files</Filter>
    13.9 -    </ClInclude>
   13.10      <ClInclude Include="..\..\src\render\opengles2\SDL_gles2funcs.h">
   13.11        <Filter>Source Files</Filter>
   13.12      </ClInclude>
   13.13 @@ -384,9 +381,6 @@
   13.14      <ClInclude Include="..\..\src\joystick\windows\SDL_dinputjoystick_c.h">
   13.15        <Filter>Source Files</Filter>
   13.16      </ClInclude>
   13.17 -    <ClInclude Include="..\..\src\haptic\windows\SDL_windowshaptic_c.h" />
   13.18 -    <ClInclude Include="..\..\src\haptic\windows\SDL_dinputhaptic_c.h" />
   13.19 -    <ClInclude Include="..\..\src\haptic\windows\SDL_xinputhaptic_c.h" />
   13.20      <ClInclude Include="..\..\src\thread\windows\SDL_systhread_c.h">
   13.21        <Filter>Source Files</Filter>
   13.22      </ClInclude>
   13.23 @@ -396,6 +390,24 @@
   13.24      <ClInclude Include="..\..\src\SDL_dataqueue.h">
   13.25        <Filter>Source Files</Filter>
   13.26      </ClInclude>
   13.27 +    <ClInclude Include="..\..\src\haptic\windows\SDL_dinputhaptic_c.h">
   13.28 +      <Filter>Source Files</Filter>
   13.29 +    </ClInclude>
   13.30 +    <ClInclude Include="..\..\src\haptic\windows\SDL_windowshaptic_c.h">
   13.31 +      <Filter>Source Files</Filter>
   13.32 +    </ClInclude>
   13.33 +    <ClInclude Include="..\..\src\haptic\windows\SDL_xinputhaptic_c.h">
   13.34 +      <Filter>Source Files</Filter>
   13.35 +    </ClInclude>
   13.36 +    <ClInclude Include="..\..\src\video\SDL_yuv_c.h">
   13.37 +      <Filter>Source Files</Filter>
   13.38 +    </ClInclude>
   13.39 +    <ClInclude Include="..\..\src\video\yuv2rgb\yuv_rgb.h">
   13.40 +      <Filter>Source Files</Filter>
   13.41 +    </ClInclude>
   13.42 +    <ClInclude Include="..\..\src\render\direct3d11\SDL_shaders_d3d11.h">
   13.43 +      <Filter>Source Files</Filter>
   13.44 +    </ClInclude>
   13.45    </ItemGroup>
   13.46    <ItemGroup>
   13.47      <ClCompile Include="..\..\src\atomic\SDL_atomic.c">
   13.48 @@ -527,9 +539,6 @@
   13.49      <ClCompile Include="..\..\src\render\SDL_render.c">
   13.50        <Filter>Source Files</Filter>
   13.51      </ClCompile>
   13.52 -    <ClCompile Include="..\..\src\render\SDL_yuv_mmx.c">
   13.53 -      <Filter>Source Files</Filter>
   13.54 -    </ClCompile>
   13.55      <ClCompile Include="..\..\src\render\SDL_yuv_sw.c">
   13.56        <Filter>Source Files</Filter>
   13.57      </ClCompile>
   13.58 @@ -695,9 +704,6 @@
   13.59      <ClCompile Include="..\..\src\joystick\windows\SDL_dinputjoystick.c">
   13.60        <Filter>Source Files</Filter>
   13.61      </ClCompile>
   13.62 -    <ClCompile Include="..\..\src\haptic\windows\SDL_windowshaptic.c" />
   13.63 -    <ClCompile Include="..\..\src\haptic\windows\SDL_xinputhaptic.c" />
   13.64 -    <ClCompile Include="..\..\src\haptic\windows\SDL_dinputhaptic.c" />
   13.65      <ClCompile Include="..\..\src\thread\windows\SDL_sysmutex.c">
   13.66        <Filter>Source Files</Filter>
   13.67      </ClCompile>
   13.68 @@ -719,5 +725,23 @@
   13.69      <ClCompile Include="..\..\src\SDL_dataqueue.c">
   13.70        <Filter>Source Files</Filter>
   13.71      </ClCompile>
   13.72 +    <ClCompile Include="..\..\src\haptic\windows\SDL_dinputhaptic.c">
   13.73 +      <Filter>Source Files</Filter>
   13.74 +    </ClCompile>
   13.75 +    <ClCompile Include="..\..\src\haptic\windows\SDL_windowshaptic.c">
   13.76 +      <Filter>Source Files</Filter>
   13.77 +    </ClCompile>
   13.78 +    <ClCompile Include="..\..\src\haptic\windows\SDL_xinputhaptic.c">
   13.79 +      <Filter>Source Files</Filter>
   13.80 +    </ClCompile>
   13.81 +    <ClCompile Include="..\..\src\video\SDL_yuv.c">
   13.82 +      <Filter>Source Files</Filter>
   13.83 +    </ClCompile>
   13.84 +    <ClCompile Include="..\..\src\video\yuv2rgb\yuv_rgb.c">
   13.85 +      <Filter>Source Files</Filter>
   13.86 +    </ClCompile>
   13.87 +    <ClCompile Include="..\..\src\render\direct3d11\SDL_shaders_d3d11.c">
   13.88 +      <Filter>Source Files</Filter>
   13.89 +    </ClCompile>
   13.90    </ItemGroup>
   13.91  </Project>
   13.92 \ No newline at end of file
    14.1 --- a/VisualC/SDL.sln	Sun Nov 12 10:59:05 2017 -0800
    14.2 +++ b/VisualC/SDL.sln	Sun Nov 12 22:51:12 2017 -0800
    14.3 @@ -50,6 +50,8 @@
    14.4  EndProject
    14.5  Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "testvulkan", "tests\testvulkan\testvulkan.vcxproj", "{0D604DFD-AAB6-442C-9368-F91A344146AB}"
    14.6  EndProject
    14.7 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "testyuv", "tests\testyuv\testyuv.vcxproj", "{40FB7794-D3C3-4CFE-BCF4-A80C97635682}"
    14.8 +EndProject
    14.9  Global
   14.10  	GlobalSection(SolutionConfigurationPlatforms) = preSolution
   14.11  		Debug|Win32 = Debug|Win32
   14.12 @@ -250,6 +252,14 @@
   14.13  		{0D604DFD-AAB6-442C-9368-F91A344146AB}.Release|Win32.Build.0 = Release|Win32
   14.14  		{0D604DFD-AAB6-442C-9368-F91A344146AB}.Release|x64.ActiveCfg = Release|x64
   14.15  		{0D604DFD-AAB6-442C-9368-F91A344146AB}.Release|x64.Build.0 = Release|x64
   14.16 +		{40FB7794-D3C3-4CFE-BCF4-A80C97635682}.Debug|Win32.ActiveCfg = Debug|Win32
   14.17 +		{40FB7794-D3C3-4CFE-BCF4-A80C97635682}.Debug|Win32.Build.0 = Debug|Win32
   14.18 +		{40FB7794-D3C3-4CFE-BCF4-A80C97635682}.Debug|x64.ActiveCfg = Debug|x64
   14.19 +		{40FB7794-D3C3-4CFE-BCF4-A80C97635682}.Debug|x64.Build.0 = Debug|x64
   14.20 +		{40FB7794-D3C3-4CFE-BCF4-A80C97635682}.Release|Win32.ActiveCfg = Release|Win32
   14.21 +		{40FB7794-D3C3-4CFE-BCF4-A80C97635682}.Release|Win32.Build.0 = Release|Win32
   14.22 +		{40FB7794-D3C3-4CFE-BCF4-A80C97635682}.Release|x64.ActiveCfg = Release|x64
   14.23 +		{40FB7794-D3C3-4CFE-BCF4-A80C97635682}.Release|x64.Build.0 = Release|x64
   14.24  	EndGlobalSection
   14.25  	GlobalSection(SolutionProperties) = preSolution
   14.26  		HideSolutionNode = FALSE
   14.27 @@ -276,5 +286,6 @@
   14.28  		{E9558DFE-1961-4DD4-B09B-DD0EEFD5C315} = {D69D5741-611F-4E14-8541-1FEE94F50B5A}
   14.29  		{55812185-D13C-4022-9C81-32E0F4A08306} = {D69D5741-611F-4E14-8541-1FEE94F50B5A}
   14.30  		{0D604DFD-AAB6-442C-9368-F91A344146AB} = {D69D5741-611F-4E14-8541-1FEE94F50B5A}
   14.31 +		{40FB7794-D3C3-4CFE-BCF4-A80C97635682} = {D69D5741-611F-4E14-8541-1FEE94F50B5A}
   14.32  	EndGlobalSection
   14.33  EndGlobal
    15.1 --- a/VisualC/SDL/SDL.vcxproj	Sun Nov 12 10:59:05 2017 -0800
    15.2 +++ b/VisualC/SDL/SDL.vcxproj	Sun Nov 12 22:51:12 2017 -0800
    15.3 @@ -78,6 +78,7 @@
    15.4      <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|x64'">AllRules.ruleset</CodeAnalysisRuleSet>
    15.5      <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|x64'" />
    15.6      <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|x64'" />
    15.7 +    <LibraryPath Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">C:\Program Files %28x86%29\Microsoft DirectX SDK %28June 2010%29\Lib\x86;$(LibraryPath)</LibraryPath>
    15.8    </PropertyGroup>
    15.9    <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
   15.10      <PreBuildEvent>
   15.11 @@ -324,7 +325,8 @@
   15.12      <ClInclude Include="..\..\src\joystick\windows\SDL_xinputjoystick_c.h" />
   15.13      <ClInclude Include="..\..\src\libm\math_libm.h" />
   15.14      <ClInclude Include="..\..\src\libm\math_private.h" />
   15.15 -    <ClInclude Include="..\..\src\render\mmx.h" />
   15.16 +    <ClInclude Include="..\..\src\render\direct3d11\SDL_shaders_d3d11.h" />
   15.17 +    <ClInclude Include="..\..\src\render\direct3d\SDL_shaders_d3d.h" />
   15.18      <ClInclude Include="..\..\src\render\opengl\SDL_glfuncs.h" />
   15.19      <ClInclude Include="..\..\src\render\opengl\SDL_shaders_gl.h" />
   15.20      <ClInclude Include="..\..\src\render\opengles\SDL_glesfuncs.h" />
   15.21 @@ -358,6 +360,7 @@
   15.22      <ClInclude Include="..\..\src\video\SDL_shape_internals.h" />
   15.23      <ClInclude Include="..\..\src\video\SDL_sysvideo.h" />
   15.24      <ClInclude Include="..\..\src\video\SDL_vulkan_internal.h" />
   15.25 +    <ClInclude Include="..\..\src\video\SDL_yuv_c.h" />
   15.26      <ClInclude Include="..\..\src\video\windows\SDL_vkeys.h" />
   15.27      <ClInclude Include="..\..\src\video\windows\SDL_windowsclipboard.h" />
   15.28      <ClInclude Include="..\..\src\video\windows\SDL_windowsevents.h" />
   15.29 @@ -372,6 +375,7 @@
   15.30      <ClInclude Include="..\..\src\video\windows\SDL_windowsvulkan.h" />
   15.31      <ClInclude Include="..\..\src\video\windows\SDL_windowswindow.h" />
   15.32      <ClInclude Include="..\..\src\video\windows\wmmsg.h" />
   15.33 +    <ClInclude Include="..\..\src\video\yuv2rgb\yuv_rgb.h" />
   15.34    </ItemGroup>
   15.35    <ItemGroup>
   15.36      <ClCompile Include="..\..\src\atomic\SDL_atomic.c" />
   15.37 @@ -434,15 +438,16 @@
   15.38      <ClCompile Include="..\..\src\loadso\windows\SDL_sysloadso.c" />
   15.39      <ClCompile Include="..\..\src\power\SDL_power.c" />
   15.40      <ClCompile Include="..\..\src\power\windows\SDL_syspower.c" />
   15.41 +    <ClCompile Include="..\..\src\render\direct3d11\SDL_shaders_d3d11.c" />
   15.42      <ClCompile Include="..\..\src\render\direct3d\SDL_render_d3d.c" />
   15.43      <ClCompile Include="..\..\src\render\direct3d11\SDL_render_d3d11.c" />
   15.44 +    <ClCompile Include="..\..\src\render\direct3d\SDL_shaders_d3d.c" />
   15.45      <ClCompile Include="..\..\src\render\opengl\SDL_render_gl.c" />
   15.46      <ClCompile Include="..\..\src\render\opengl\SDL_shaders_gl.c" />
   15.47      <ClCompile Include="..\..\src\render\opengles2\SDL_render_gles2.c" />
   15.48      <ClCompile Include="..\..\src\render\opengles2\SDL_shaders_gles2.c" />
   15.49      <ClCompile Include="..\..\src\render\SDL_d3dmath.c" />
   15.50      <ClCompile Include="..\..\src\render\SDL_render.c" />
   15.51 -    <ClCompile Include="..\..\src\render\SDL_yuv_mmx.c" />
   15.52      <ClCompile Include="..\..\src\render\SDL_yuv_sw.c" />
   15.53      <ClCompile Include="..\..\src\render\software\SDL_blendfillrect.c" />
   15.54      <ClCompile Include="..\..\src\render\software\SDL_blendline.c" />
   15.55 @@ -494,6 +499,7 @@
   15.56      <ClCompile Include="..\..\src\video\SDL_surface.c" />
   15.57      <ClCompile Include="..\..\src\video\SDL_video.c" />
   15.58      <ClCompile Include="..\..\src\video\SDL_vulkan_utils.c" />
   15.59 +    <ClCompile Include="..\..\src\video\SDL_yuv.c" />
   15.60      <ClCompile Include="..\..\src\video\windows\SDL_windowsclipboard.c" />
   15.61      <ClCompile Include="..\..\src\video\windows\SDL_windowsevents.c" />
   15.62      <ClCompile Include="..\..\src\video\windows\SDL_windowsframebuffer.c" />
   15.63 @@ -507,6 +513,7 @@
   15.64      <ClCompile Include="..\..\src\video\windows\SDL_windowsvideo.c" />
   15.65      <ClCompile Include="..\..\src\video\windows\SDL_windowsvulkan.c" />
   15.66      <ClCompile Include="..\..\src\video\windows\SDL_windowswindow.c" />
   15.67 +    <ClCompile Include="..\..\src\video\yuv2rgb\yuv_rgb.c" />
   15.68    </ItemGroup>
   15.69    <ItemGroup>
   15.70      <ResourceCompile Include="..\..\src\main\windows\version.rc" />
    16.1 --- a/VisualC/SDL/SDL.vcxproj.filters	Sun Nov 12 10:59:05 2017 -0800
    16.2 +++ b/VisualC/SDL/SDL.vcxproj.filters	Sun Nov 12 22:51:12 2017 -0800
    16.3 @@ -262,7 +262,6 @@
    16.4      <ClInclude Include="..\..\src\joystick\windows\SDL_xinputjoystick_c.h" />
    16.5      <ClInclude Include="..\..\src\libm\math_libm.h" />
    16.6      <ClInclude Include="..\..\src\libm\math_private.h" />
    16.7 -    <ClInclude Include="..\..\src\render\mmx.h" />
    16.8      <ClInclude Include="..\..\src\render\opengl\SDL_glfuncs.h" />
    16.9      <ClInclude Include="..\..\src\render\opengl\SDL_shaders_gl.h" />
   16.10      <ClInclude Include="..\..\src\render\opengles\SDL_glesfuncs.h" />
   16.11 @@ -310,6 +309,10 @@
   16.12      <ClInclude Include="..\..\src\video\windows\SDL_windowsvulkan.h" />
   16.13      <ClInclude Include="..\..\src\video\windows\SDL_windowswindow.h" />
   16.14      <ClInclude Include="..\..\src\video\windows\wmmsg.h" />
   16.15 +    <ClInclude Include="..\..\src\video\SDL_yuv_c.h" />
   16.16 +    <ClInclude Include="..\..\src\video\yuv2rgb\yuv_rgb.h" />
   16.17 +    <ClInclude Include="..\..\src\render\direct3d11\SDL_shaders_d3d11.h" />
   16.18 +    <ClInclude Include="..\..\src\render\direct3d\SDL_shaders_d3d.h" />
   16.19    </ItemGroup>
   16.20    <ItemGroup>
   16.21      <ClCompile Include="..\..\src\libm\e_atan2.c" />
   16.22 @@ -439,12 +442,15 @@
   16.23      <ClCompile Include="..\..\src\core\windows\SDL_xinput.c" />
   16.24      <ClCompile Include="..\..\src\haptic\windows\SDL_xinputhaptic.c" />
   16.25      <ClCompile Include="..\..\src\joystick\windows\SDL_xinputjoystick.c" />
   16.26 -    <ClCompile Include="..\..\src\render\SDL_yuv_mmx.c" />
   16.27      <ClCompile Include="..\..\src\render\SDL_yuv_sw.c" />
   16.28      <ClCompile Include="..\..\src\audio\wasapi\SDL_wasapi.c" />
   16.29      <ClCompile Include="..\..\src\video\SDL_vulkan_utils.c" />
   16.30      <ClCompile Include="..\..\src\video\windows\SDL_windowsvulkan.c" />
   16.31      <ClCompile Include="..\..\src\libm\e_fmod.c" />
   16.32 +    <ClCompile Include="..\..\src\video\SDL_yuv.c" />
   16.33 +    <ClCompile Include="..\..\src\video\yuv2rgb\yuv_rgb.c" />
   16.34 +    <ClCompile Include="..\..\src\render\direct3d11\SDL_shaders_d3d11.c" />
   16.35 +    <ClCompile Include="..\..\src\render\direct3d\SDL_shaders_d3d.c" />
   16.36    </ItemGroup>
   16.37    <ItemGroup>
   16.38      <ResourceCompile Include="..\..\src\main\windows\version.rc" />
    17.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    17.2 +++ b/VisualC/tests/testyuv/testyuv.vcxproj	Sun Nov 12 22:51:12 2017 -0800
    17.3 @@ -0,0 +1,229 @@
    17.4 +<?xml version="1.0" encoding="utf-8"?>
    17.5 +<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
    17.6 +  <ItemGroup Label="ProjectConfigurations">
    17.7 +    <ProjectConfiguration Include="Debug|Win32">
    17.8 +      <Configuration>Debug</Configuration>
    17.9 +      <Platform>Win32</Platform>
   17.10 +    </ProjectConfiguration>
   17.11 +    <ProjectConfiguration Include="Debug|x64">
   17.12 +      <Configuration>Debug</Configuration>
   17.13 +      <Platform>x64</Platform>
   17.14 +    </ProjectConfiguration>
   17.15 +    <ProjectConfiguration Include="Release|Win32">
   17.16 +      <Configuration>Release</Configuration>
   17.17 +      <Platform>Win32</Platform>
   17.18 +    </ProjectConfiguration>
   17.19 +    <ProjectConfiguration Include="Release|x64">
   17.20 +      <Configuration>Release</Configuration>
   17.21 +      <Platform>x64</Platform>
   17.22 +    </ProjectConfiguration>
   17.23 +  </ItemGroup>
   17.24 +  <PropertyGroup Label="Globals">
   17.25 +    <ProjectGuid>{40FB7794-D3C3-4CFE-BCF4-A80C97635682}</ProjectGuid>
   17.26 +    <RootNamespace>testyuv</RootNamespace>
   17.27 +  </PropertyGroup>
   17.28 +  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
   17.29 +  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
   17.30 +    <ConfigurationType>Application</ConfigurationType>
   17.31 +  </PropertyGroup>
   17.32 +  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
   17.33 +    <ConfigurationType>Application</ConfigurationType>
   17.34 +  </PropertyGroup>
   17.35 +  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
   17.36 +    <ConfigurationType>Application</ConfigurationType>
   17.37 +  </PropertyGroup>
   17.38 +  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
   17.39 +    <ConfigurationType>Application</ConfigurationType>
   17.40 +  </PropertyGroup>
   17.41 +  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
   17.42 +  <ImportGroup Label="ExtensionSettings">
   17.43 +  </ImportGroup>
   17.44 +  <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
   17.45 +    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
   17.46 +    <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC70.props" />
   17.47 +  </ImportGroup>
   17.48 +  <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
   17.49 +    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
   17.50 +    <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC70.props" />
   17.51 +  </ImportGroup>
   17.52 +  <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
   17.53 +    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
   17.54 +    <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC70.props" />
   17.55 +  </ImportGroup>
   17.56 +  <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
   17.57 +    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
   17.58 +    <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC70.props" />
   17.59 +  </ImportGroup>
   17.60 +  <PropertyGroup Label="UserMacros" />
   17.61 +  <PropertyGroup>
   17.62 +    <_ProjectFileVersion>10.0.40219.1</_ProjectFileVersion>
   17.63 +    <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)$(Platform)\$(Configuration)\</OutDir>
   17.64 +    <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(Platform)\$(Configuration)\</IntDir>
   17.65 +    <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(SolutionDir)$(Platform)\$(Configuration)\</OutDir>
   17.66 +    <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(Platform)\$(Configuration)\</IntDir>
   17.67 +    <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)$(Platform)\$(Configuration)\</OutDir>
   17.68 +    <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(Platform)\$(Configuration)\</IntDir>
   17.69 +    <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(SolutionDir)$(Platform)\$(Configuration)\</OutDir>
   17.70 +    <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(Platform)\$(Configuration)\</IntDir>
   17.71 +    <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">AllRules.ruleset</CodeAnalysisRuleSet>
   17.72 +    <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" />
   17.73 +    <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" />
   17.74 +    <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">AllRules.ruleset</CodeAnalysisRuleSet>
   17.75 +    <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" />
   17.76 +    <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" />
   17.77 +    <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">AllRules.ruleset</CodeAnalysisRuleSet>
   17.78 +    <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" />
   17.79 +    <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" />
   17.80 +    <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|x64'">AllRules.ruleset</CodeAnalysisRuleSet>
   17.81 +    <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|x64'" />
   17.82 +    <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|x64'" />
   17.83 +  </PropertyGroup>
   17.84 +  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
   17.85 +    <Midl>
   17.86 +      <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
   17.87 +      <MkTypLibCompatible>true</MkTypLibCompatible>
   17.88 +      <SuppressStartupBanner>true</SuppressStartupBanner>
   17.89 +      <TargetEnvironment>Win32</TargetEnvironment>
   17.90 +      <TypeLibraryName>.\Release/testyuv.tlb</TypeLibraryName>
   17.91 +    </Midl>
   17.92 +    <ClCompile>
   17.93 +      <AdditionalIncludeDirectories>$(SolutionDir)/../include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
   17.94 +      <AdditionalUsingDirectories>%(AdditionalUsingDirectories)</AdditionalUsingDirectories>
   17.95 +      <PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
   17.96 +      <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
   17.97 +      <WarningLevel>Level3</WarningLevel>
   17.98 +    </ClCompile>
   17.99 +    <ResourceCompile>
  17.100 +      <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
  17.101 +      <Culture>0x0409</Culture>
  17.102 +    </ResourceCompile>
  17.103 +    <Link>
  17.104 +      <SubSystem>Windows</SubSystem>
  17.105 +    </Link>
  17.106 +  </ItemDefinitionGroup>
  17.107 +  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
  17.108 +    <Midl>
  17.109 +      <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
  17.110 +      <MkTypLibCompatible>true</MkTypLibCompatible>
  17.111 +      <SuppressStartupBanner>true</SuppressStartupBanner>
  17.112 +      <TargetEnvironment>X64</TargetEnvironment>
  17.113 +      <TypeLibraryName>.\Release/testyuv.tlb</TypeLibraryName>
  17.114 +    </Midl>
  17.115 +    <ClCompile>
  17.116 +      <AdditionalIncludeDirectories>$(SolutionDir)/../include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
  17.117 +      <AdditionalUsingDirectories>%(AdditionalUsingDirectories)</AdditionalUsingDirectories>
  17.118 +      <PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
  17.119 +      <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
  17.120 +      <WarningLevel>Level3</WarningLevel>
  17.121 +    </ClCompile>
  17.122 +    <ResourceCompile>
  17.123 +      <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
  17.124 +      <Culture>0x0409</Culture>
  17.125 +    </ResourceCompile>
  17.126 +    <Link>
  17.127 +      <SubSystem>Windows</SubSystem>
  17.128 +    </Link>
  17.129 +  </ItemDefinitionGroup>
  17.130 +  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
  17.131 +    <Midl>
  17.132 +      <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
  17.133 +      <MkTypLibCompatible>true</MkTypLibCompatible>
  17.134 +      <SuppressStartupBanner>true</SuppressStartupBanner>
  17.135 +      <TargetEnvironment>Win32</TargetEnvironment>
  17.136 +      <TypeLibraryName>.\Debug/testyuv.tlb</TypeLibraryName>
  17.137 +    </Midl>
  17.138 +    <ClCompile>
  17.139 +      <Optimization>Disabled</Optimization>
  17.140 +      <AdditionalIncludeDirectories>$(SolutionDir)/../include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
  17.141 +      <AdditionalUsingDirectories>%(AdditionalUsingDirectories)</AdditionalUsingDirectories>
  17.142 +      <PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
  17.143 +      <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
  17.144 +      <WarningLevel>Level3</WarningLevel>
  17.145 +      <DebugInformationFormat>OldStyle</DebugInformationFormat>
  17.146 +    </ClCompile>
  17.147 +    <ResourceCompile>
  17.148 +      <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
  17.149 +      <Culture>0x0409</Culture>
  17.150 +    </ResourceCompile>
  17.151 +    <Link>
  17.152 +      <GenerateDebugInformation>true</GenerateDebugInformation>
  17.153 +      <SubSystem>Windows</SubSystem>
  17.154 +    </Link>
  17.155 +  </ItemDefinitionGroup>
  17.156 +  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
  17.157 +    <Midl>
  17.158 +      <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
  17.159 +      <MkTypLibCompatible>true</MkTypLibCompatible>
  17.160 +      <SuppressStartupBanner>true</SuppressStartupBanner>
  17.161 +      <TargetEnvironment>X64</TargetEnvironment>
  17.162 +      <TypeLibraryName>.\Debug/testyuv.tlb</TypeLibraryName>
  17.163 +    </Midl>
  17.164 +    <ClCompile>
  17.165 +      <Optimization>Disabled</Optimization>
  17.166 +      <AdditionalIncludeDirectories>$(SolutionDir)/../include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
  17.167 +      <AdditionalUsingDirectories>%(AdditionalUsingDirectories)</AdditionalUsingDirectories>
  17.168 +      <PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
  17.169 +      <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
  17.170 +      <WarningLevel>Level3</WarningLevel>
  17.171 +      <DebugInformationFormat>OldStyle</DebugInformationFormat>
  17.172 +    </ClCompile>
  17.173 +    <ResourceCompile>
  17.174 +      <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
  17.175 +      <Culture>0x0409</Culture>
  17.176 +    </ResourceCompile>
  17.177 +    <Link>
  17.178 +      <GenerateDebugInformation>true</GenerateDebugInformation>
  17.179 +      <SubSystem>Windows</SubSystem>
  17.180 +    </Link>
  17.181 +  </ItemDefinitionGroup>
  17.182 +  <ItemGroup>
  17.183 +    <ProjectReference Include="..\..\SDL\SDL.vcxproj">
  17.184 +      <Project>{81ce8daf-ebb2-4761-8e45-b71abcca8c68}</Project>
  17.185 +      <Private>false</Private>
  17.186 +      <CopyLocalSatelliteAssemblies>false</CopyLocalSatelliteAssemblies>
  17.187 +      <ReferenceOutputAssembly>true</ReferenceOutputAssembly>
  17.188 +    </ProjectReference>
  17.189 +    <ProjectReference Include="..\..\SDLmain\SDLmain.vcxproj">
  17.190 +      <Project>{da956fd3-e142-46f2-9dd5-c78bebb56b7a}</Project>
  17.191 +      <Private>false</Private>
  17.192 +      <CopyLocalSatelliteAssemblies>false</CopyLocalSatelliteAssemblies>
  17.193 +      <ReferenceOutputAssembly>true</ReferenceOutputAssembly>
  17.194 +    </ProjectReference>
  17.195 +    <ProjectReference Include="..\..\SDLtest\SDLtest.vcxproj">
  17.196 +      <Project>{da956fd3-e143-46f2-9fe5-c77bebc56b1a}</Project>
  17.197 +      <Private>false</Private>
  17.198 +      <CopyLocalSatelliteAssemblies>false</CopyLocalSatelliteAssemblies>
  17.199 +      <ReferenceOutputAssembly>true</ReferenceOutputAssembly>
  17.200 +    </ProjectReference>
  17.201 +  </ItemGroup>
  17.202 +  <ItemGroup>
  17.203 +    <CustomBuild Include="..\..\..\test\testyuv.bmp">
  17.204 +      <Message Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Copying %(Filename)%(Extension)</Message>
  17.205 +      <Command Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">copy %(FullPath) $(ProjectDir)\
  17.206 +</Command>
  17.207 +      <Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(ProjectDir)\%(Filename)%(Extension);%(Outputs)</Outputs>
  17.208 +      <Message Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Copying %(Filename)%(Extension)</Message>
  17.209 +      <Command Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">copy %(FullPath) $(ProjectDir)\
  17.210 +</Command>
  17.211 +      <Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(ProjectDir)\%(Filename)%(Extension);%(Outputs)</Outputs>
  17.212 +      <Message Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Copying %(Filename)%(Extension)</Message>
  17.213 +      <Command Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">copy %(FullPath) $(ProjectDir)\
  17.214 +</Command>
  17.215 +      <Outputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(ProjectDir)\%(Filename)%(Extension);%(Outputs)</Outputs>
  17.216 +      <Message Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Copying %(Filename)%(Extension)</Message>
  17.217 +      <Command Condition="'$(Configuration)|$(Platform)'=='Release|x64'">copy %(FullPath) $(ProjectDir)\
  17.218 +</Command>
  17.219 +      <Outputs Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(ProjectDir)\%(Filename)%(Extension);%(Outputs)</Outputs>
  17.220 +    </CustomBuild>
  17.221 +  </ItemGroup>
  17.222 +  <ItemGroup>
  17.223 +    <ClCompile Include="..\..\..\test\testyuv.c" />
  17.224 +    <ClCompile Include="..\..\..\test\testyuv_cvt.c" />
  17.225 +  </ItemGroup>
  17.226 +  <ItemGroup>
  17.227 +    <ClInclude Include="..\..\..\test\testyuv_cvt.h" />
  17.228 +  </ItemGroup>
  17.229 +  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
  17.230 +  <ImportGroup Label="ExtensionTargets">
  17.231 +  </ImportGroup>
  17.232 +</Project>
    18.1 --- a/Xcode-iOS/SDL/SDL.xcodeproj/project.pbxproj	Sun Nov 12 10:59:05 2017 -0800
    18.2 +++ b/Xcode-iOS/SDL/SDL.xcodeproj/project.pbxproj	Sun Nov 12 22:51:12 2017 -0800
    18.3 @@ -52,8 +52,6 @@
    18.4  		041B2CF212FA0F680087D585 /* SDL_sysrender.h in Headers */ = {isa = PBXBuildFile; fileRef = 041B2CEB12FA0F680087D585 /* SDL_sysrender.h */; };
    18.5  		0420497011E6F03D007E7EC9 /* SDL_clipboardevents_c.h in Headers */ = {isa = PBXBuildFile; fileRef = 0420496E11E6F03D007E7EC9 /* SDL_clipboardevents_c.h */; };
    18.6  		0420497111E6F03D007E7EC9 /* SDL_clipboardevents.c in Sources */ = {isa = PBXBuildFile; fileRef = 0420496F11E6F03D007E7EC9 /* SDL_clipboardevents.c */; };
    18.7 -		04409BA612FA989600FB9AA8 /* mmx.h in Headers */ = {isa = PBXBuildFile; fileRef = 04409BA212FA989600FB9AA8 /* mmx.h */; };
    18.8 -		04409BA712FA989600FB9AA8 /* SDL_yuv_mmx.c in Sources */ = {isa = PBXBuildFile; fileRef = 04409BA312FA989600FB9AA8 /* SDL_yuv_mmx.c */; };
    18.9  		04409BA812FA989600FB9AA8 /* SDL_yuv_sw_c.h in Headers */ = {isa = PBXBuildFile; fileRef = 04409BA412FA989600FB9AA8 /* SDL_yuv_sw_c.h */; };
   18.10  		04409BA912FA989600FB9AA8 /* SDL_yuv_sw.c in Sources */ = {isa = PBXBuildFile; fileRef = 04409BA512FA989600FB9AA8 /* SDL_yuv_sw.c */; };
   18.11  		0442EC5012FE1C1E004C9285 /* SDL_render_sw_c.h in Headers */ = {isa = PBXBuildFile; fileRef = 0442EC4E12FE1C1E004C9285 /* SDL_render_sw_c.h */; };
   18.12 @@ -119,6 +117,17 @@
   18.13  		AA0F8495178D5F1A00823F9D /* SDL_systls.c in Sources */ = {isa = PBXBuildFile; fileRef = AA0F8494178D5F1A00823F9D /* SDL_systls.c */; };
   18.14  		AA126AD41617C5E7005ABC8F /* SDL_uikitmodes.h in Headers */ = {isa = PBXBuildFile; fileRef = AA126AD21617C5E6005ABC8F /* SDL_uikitmodes.h */; };
   18.15  		AA126AD51617C5E7005ABC8F /* SDL_uikitmodes.m in Sources */ = {isa = PBXBuildFile; fileRef = AA126AD31617C5E6005ABC8F /* SDL_uikitmodes.m */; };
   18.16 +		AA13B3491FB8B27800D9FEE6 /* SDL_egl_c.h in Headers */ = {isa = PBXBuildFile; fileRef = AA13B3431FB8B27700D9FEE6 /* SDL_egl_c.h */; };
   18.17 +		AA13B34A1FB8B27800D9FEE6 /* SDL_shape.c in Sources */ = {isa = PBXBuildFile; fileRef = AA13B3441FB8B27800D9FEE6 /* SDL_shape.c */; };
   18.18 +		AA13B34B1FB8B27800D9FEE6 /* SDL_shape_internals.h in Headers */ = {isa = PBXBuildFile; fileRef = AA13B3451FB8B27800D9FEE6 /* SDL_shape_internals.h */; };
   18.19 +		AA13B34C1FB8B27800D9FEE6 /* SDL_rect_c.h in Headers */ = {isa = PBXBuildFile; fileRef = AA13B3461FB8B27800D9FEE6 /* SDL_rect_c.h */; };
   18.20 +		AA13B34D1FB8B27800D9FEE6 /* SDL_egl.c in Sources */ = {isa = PBXBuildFile; fileRef = AA13B3471FB8B27800D9FEE6 /* SDL_egl.c */; };
   18.21 +		AA13B34E1FB8B27800D9FEE6 /* SDL_yuv_c.h in Headers */ = {isa = PBXBuildFile; fileRef = AA13B3481FB8B27800D9FEE6 /* SDL_yuv_c.h */; };
   18.22 +		AA13B3501FB8B3CC00D9FEE6 /* SDL_yuv.c in Sources */ = {isa = PBXBuildFile; fileRef = AA13B34F1FB8B3CC00D9FEE6 /* SDL_yuv.c */; };
   18.23 +		AA13B3571FB8B46400D9FEE6 /* yuv_rgb_std_func.h in Headers */ = {isa = PBXBuildFile; fileRef = AA13B3531FB8B46300D9FEE6 /* yuv_rgb_std_func.h */; };
   18.24 +		AA13B3581FB8B46400D9FEE6 /* yuv_rgb_sse_func.h in Headers */ = {isa = PBXBuildFile; fileRef = AA13B3541FB8B46300D9FEE6 /* yuv_rgb_sse_func.h */; };
   18.25 +		AA13B3591FB8B46400D9FEE6 /* yuv_rgb.h in Headers */ = {isa = PBXBuildFile; fileRef = AA13B3551FB8B46300D9FEE6 /* yuv_rgb.h */; };
   18.26 +		AA13B35A1FB8B46400D9FEE6 /* yuv_rgb.c in Sources */ = {isa = PBXBuildFile; fileRef = AA13B3561FB8B46300D9FEE6 /* yuv_rgb.c */; };
   18.27  		AA628ADB159369E3005138DD /* SDL_rotate.c in Sources */ = {isa = PBXBuildFile; fileRef = AA628AD9159369E3005138DD /* SDL_rotate.c */; };
   18.28  		AA628ADC159369E3005138DD /* SDL_rotate.h in Headers */ = {isa = PBXBuildFile; fileRef = AA628ADA159369E3005138DD /* SDL_rotate.h */; };
   18.29  		AA704DD6162AA90A0076D1C1 /* SDL_dropevents_c.h in Headers */ = {isa = PBXBuildFile; fileRef = AA704DD4162AA90A0076D1C1 /* SDL_dropevents_c.h */; };
   18.30 @@ -222,7 +231,6 @@
   18.31  		FAB598681BB5C31600BE72C5 /* SDL_render_sw.c in Sources */ = {isa = PBXBuildFile; fileRef = 0442EC4F12FE1C1E004C9285 /* SDL_render_sw.c */; };
   18.32  		FAB5986A1BB5C31600BE72C5 /* SDL_rotate.c in Sources */ = {isa = PBXBuildFile; fileRef = AA628AD9159369E3005138DD /* SDL_rotate.c */; };
   18.33  		FAB5986D1BB5C31600BE72C5 /* SDL_render.c in Sources */ = {isa = PBXBuildFile; fileRef = 041B2CEA12FA0F680087D585 /* SDL_render.c */; };
   18.34 -		FAB5986F1BB5C31600BE72C5 /* SDL_yuv_mmx.c in Sources */ = {isa = PBXBuildFile; fileRef = 04409BA312FA989600FB9AA8 /* SDL_yuv_mmx.c */; };
   18.35  		FAB598711BB5C31600BE72C5 /* SDL_yuv_sw.c in Sources */ = {isa = PBXBuildFile; fileRef = 04409BA512FA989600FB9AA8 /* SDL_yuv_sw.c */; };
   18.36  		FAB598721BB5C31600BE72C5 /* SDL_getenv.c in Sources */ = {isa = PBXBuildFile; fileRef = FD3F4A700DEA620800C5B771 /* SDL_getenv.c */; };
   18.37  		FAB598731BB5C31600BE72C5 /* SDL_iconv.c in Sources */ = {isa = PBXBuildFile; fileRef = FD3F4A710DEA620800C5B771 /* SDL_iconv.c */; };
   18.38 @@ -358,8 +366,6 @@
   18.39  		041B2CEB12FA0F680087D585 /* SDL_sysrender.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_sysrender.h; sourceTree = "<group>"; };
   18.40  		0420496E11E6F03D007E7EC9 /* SDL_clipboardevents_c.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_clipboardevents_c.h; sourceTree = "<group>"; };
   18.41  		0420496F11E6F03D007E7EC9 /* SDL_clipboardevents.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_clipboardevents.c; sourceTree = "<group>"; };
   18.42 -		04409BA212FA989600FB9AA8 /* mmx.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = mmx.h; sourceTree = "<group>"; };
   18.43 -		04409BA312FA989600FB9AA8 /* SDL_yuv_mmx.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_yuv_mmx.c; sourceTree = "<group>"; };
   18.44  		04409BA412FA989600FB9AA8 /* SDL_yuv_sw_c.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_yuv_sw_c.h; sourceTree = "<group>"; };
   18.45  		04409BA512FA989600FB9AA8 /* SDL_yuv_sw.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_yuv_sw.c; sourceTree = "<group>"; };
   18.46  		0442EC4E12FE1C1E004C9285 /* SDL_render_sw_c.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_render_sw_c.h; sourceTree = "<group>"; };
   18.47 @@ -424,6 +430,17 @@
   18.48  		AA0F8494178D5F1A00823F9D /* SDL_systls.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_systls.c; sourceTree = "<group>"; };
   18.49  		AA126AD21617C5E6005ABC8F /* SDL_uikitmodes.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_uikitmodes.h; sourceTree = "<group>"; };
   18.50  		AA126AD31617C5E6005ABC8F /* SDL_uikitmodes.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SDL_uikitmodes.m; sourceTree = "<group>"; };
   18.51 +		AA13B3431FB8B27700D9FEE6 /* SDL_egl_c.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_egl_c.h; sourceTree = "<group>"; };
   18.52 +		AA13B3441FB8B27800D9FEE6 /* SDL_shape.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_shape.c; sourceTree = "<group>"; };
   18.53 +		AA13B3451FB8B27800D9FEE6 /* SDL_shape_internals.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_shape_internals.h; sourceTree = "<group>"; };
   18.54 +		AA13B3461FB8B27800D9FEE6 /* SDL_rect_c.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_rect_c.h; sourceTree = "<group>"; };
   18.55 +		AA13B3471FB8B27800D9FEE6 /* SDL_egl.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_egl.c; sourceTree = "<group>"; };
   18.56 +		AA13B3481FB8B27800D9FEE6 /* SDL_yuv_c.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_yuv_c.h; sourceTree = "<group>"; };
   18.57 +		AA13B34F1FB8B3CC00D9FEE6 /* SDL_yuv.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_yuv.c; sourceTree = "<group>"; };
   18.58 +		AA13B3531FB8B46300D9FEE6 /* yuv_rgb_std_func.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = yuv_rgb_std_func.h; sourceTree = "<group>"; };
   18.59 +		AA13B3541FB8B46300D9FEE6 /* yuv_rgb_sse_func.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = yuv_rgb_sse_func.h; sourceTree = "<group>"; };
   18.60 +		AA13B3551FB8B46300D9FEE6 /* yuv_rgb.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = yuv_rgb.h; sourceTree = "<group>"; };
   18.61 +		AA13B3561FB8B46300D9FEE6 /* yuv_rgb.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = yuv_rgb.c; sourceTree = "<group>"; };
   18.62  		AA628AD9159369E3005138DD /* SDL_rotate.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_rotate.c; sourceTree = "<group>"; };
   18.63  		AA628ADA159369E3005138DD /* SDL_rotate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_rotate.h; sourceTree = "<group>"; };
   18.64  		AA704DD4162AA90A0076D1C1 /* SDL_dropevents_c.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_dropevents_c.h; sourceTree = "<group>"; };
   18.65 @@ -608,10 +625,8 @@
   18.66  				041B2CE812FA0F680087D585 /* opengles */,
   18.67  				0402A85412FE70C600CECEE3 /* opengles2 */,
   18.68  				041B2CEC12FA0F680087D585 /* software */,
   18.69 -				04409BA212FA989600FB9AA8 /* mmx.h */,
   18.70  				041B2CEA12FA0F680087D585 /* SDL_render.c */,
   18.71  				041B2CEB12FA0F680087D585 /* SDL_sysrender.h */,
   18.72 -				04409BA312FA989600FB9AA8 /* SDL_yuv_mmx.c */,
   18.73  				04409BA412FA989600FB9AA8 /* SDL_yuv_sw_c.h */,
   18.74  				04409BA512FA989600FB9AA8 /* SDL_yuv_sw.c */,
   18.75  			);
   18.76 @@ -760,6 +775,17 @@
   18.77  			path = steam;
   18.78  			sourceTree = "<group>";
   18.79  		};
   18.80 +		AA13B3521FB8B41700D9FEE6 /* yuv2rgb */ = {
   18.81 +			isa = PBXGroup;
   18.82 +			children = (
   18.83 +				AA13B3541FB8B46300D9FEE6 /* yuv_rgb_sse_func.h */,
   18.84 +				AA13B3531FB8B46300D9FEE6 /* yuv_rgb_std_func.h */,
   18.85 +				AA13B3561FB8B46300D9FEE6 /* yuv_rgb.c */,
   18.86 +				AA13B3551FB8B46300D9FEE6 /* yuv_rgb.h */,
   18.87 +			);
   18.88 +			path = yuv2rgb;
   18.89 +			sourceTree = "<group>";
   18.90 +		};
   18.91  		FD3F4A6F0DEA620800C5B771 /* stdlib */ = {
   18.92  			isa = PBXGroup;
   18.93  			children = (
   18.94 @@ -1070,10 +1096,9 @@
   18.95  		FDA682420DF2374D00F98A1A /* video */ = {
   18.96  			isa = PBXGroup;
   18.97  			children = (
   18.98 +				FDA685F40DF244C800F98A1A /* dummy */,
   18.99  				FD689F090E26E5D900F90B21 /* uikit */,
  18.100 -				FDA685F40DF244C800F98A1A /* dummy */,
  18.101 -				FDA683000DF2374E00F98A1A /* SDL_blit.c */,
  18.102 -				FDA683010DF2374E00F98A1A /* SDL_blit.h */,
  18.103 +				AA13B3521FB8B41700D9FEE6 /* yuv2rgb */,
  18.104  				FDA683020DF2374E00F98A1A /* SDL_blit_0.c */,
  18.105  				FDA683030DF2374E00F98A1A /* SDL_blit_1.c */,
  18.106  				FDA683040DF2374E00F98A1A /* SDL_blit_A.c */,
  18.107 @@ -1084,20 +1109,29 @@
  18.108  				FDA683090DF2374E00F98A1A /* SDL_blit_N.c */,
  18.109  				FDA6830A0DF2374E00F98A1A /* SDL_blit_slow.c */,
  18.110  				0463873A0F0B5B7D0041FD65 /* SDL_blit_slow.h */,
  18.111 +				FDA683000DF2374E00F98A1A /* SDL_blit.c */,
  18.112 +				FDA683010DF2374E00F98A1A /* SDL_blit.h */,
  18.113  				FDA6830B0DF2374E00F98A1A /* SDL_bmp.c */,
  18.114  				044E5FB711E606EB0076F181 /* SDL_clipboard.c */,
  18.115 +				AA13B3431FB8B27700D9FEE6 /* SDL_egl_c.h */,
  18.116 +				AA13B3471FB8B27800D9FEE6 /* SDL_egl.c */,
  18.117  				0463873E0F0B5B7D0041FD65 /* SDL_fillrect.c */,
  18.118 +				FDA683100DF2374E00F98A1A /* SDL_pixels_c.h */,
  18.119  				FDA6830F0DF2374E00F98A1A /* SDL_pixels.c */,
  18.120 -				FDA683100DF2374E00F98A1A /* SDL_pixels_c.h */,
  18.121 +				AA13B3461FB8B27800D9FEE6 /* SDL_rect_c.h */,
  18.122  				FDA683110DF2374E00F98A1A /* SDL_rect.c */,
  18.123 +				FDA683160DF2374E00F98A1A /* SDL_RLEaccel_c.h */,
  18.124  				FDA683150DF2374E00F98A1A /* SDL_RLEaccel.c */,
  18.125 -				FDA683160DF2374E00F98A1A /* SDL_RLEaccel_c.h */,
  18.126 +				AA13B3451FB8B27800D9FEE6 /* SDL_shape_internals.h */,
  18.127 +				AA13B3441FB8B27800D9FEE6 /* SDL_shape.c */,
  18.128  				FDA683170DF2374E00F98A1A /* SDL_stretch.c */,
  18.129  				FDA683190DF2374E00F98A1A /* SDL_surface.c */,
  18.130  				FDA6831A0DF2374E00F98A1A /* SDL_sysvideo.h */,
  18.131  				FDA6831B0DF2374E00F98A1A /* SDL_video.c */,
  18.132  				4D75171D1EE1D98200820EEA /* SDL_vulkan_internal.h */,
  18.133  				4D75171E1EE1D98200820EEA /* SDL_vulkan_utils.c */,
  18.134 +				AA13B34F1FB8B3CC00D9FEE6 /* SDL_yuv.c */,
  18.135 +				AA13B3481FB8B27800D9FEE6 /* SDL_yuv_c.h */,
  18.136  			);
  18.137  			name = video;
  18.138  			path = ../../src/video;
  18.139 @@ -1144,20 +1178,24 @@
  18.140  				56A6703818565E760007D20F /* SDL_dynapi.h in Headers */,
  18.141  				FD689FCF0E26E9D400F90B21 /* SDL_uikitappdelegate.h in Headers */,
  18.142  				56A6703518565E760007D20F /* SDL_dynapi_overrides.h in Headers */,
  18.143 +				AA13B3571FB8B46400D9FEE6 /* yuv_rgb_std_func.h in Headers */,
  18.144  				047677BD0EA76A31008ABAF1 /* SDL_syshaptic.h in Headers */,
  18.145  				046387420F0B5B7D0041FD65 /* SDL_blit_slow.h in Headers */,
  18.146  				006E9888119552DD001DE610 /* SDL_rwopsbundlesupport.h in Headers */,
  18.147  				0420497011E6F03D007E7EC9 /* SDL_clipboardevents_c.h in Headers */,
  18.148 +				AA13B34C1FB8B27800D9FEE6 /* SDL_rect_c.h in Headers */,
  18.149 +				AA13B3581FB8B46400D9FEE6 /* yuv_rgb_sse_func.h in Headers */,
  18.150  				04BA9D6311EF474A00B60E01 /* SDL_gesture_c.h in Headers */,
  18.151  				04BA9D6511EF474A00B60E01 /* SDL_touch_c.h in Headers */,
  18.152  				041B2CF212FA0F680087D585 /* SDL_sysrender.h in Headers */,
  18.153 -				04409BA612FA989600FB9AA8 /* mmx.h in Headers */,
  18.154  				04409BA812FA989600FB9AA8 /* SDL_yuv_sw_c.h in Headers */,
  18.155 +				AA13B3591FB8B46400D9FEE6 /* yuv_rgb.h in Headers */,
  18.156  				04F7807712FB751400FC43C0 /* SDL_blendfillrect.h in Headers */,
  18.157  				04F7807912FB751400FC43C0 /* SDL_blendline.h in Headers */,
  18.158  				04F7807B12FB751400FC43C0 /* SDL_blendpoint.h in Headers */,
  18.159  				04F7807C12FB751400FC43C0 /* SDL_draw.h in Headers */,
  18.160  				04F7807E12FB751400FC43C0 /* SDL_drawline.h in Headers */,
  18.161 +				AA13B34E1FB8B27800D9FEE6 /* SDL_yuv_c.h in Headers */,
  18.162  				04F7808012FB751400FC43C0 /* SDL_drawpoint.h in Headers */,
  18.163  				04F7808412FB753F00FC43C0 /* SDL_nullframebuffer_c.h in Headers */,
  18.164  				A7A9EEAA1F702631002A5589 /* SDL_steamcontroller.h in Headers */,
  18.165 @@ -1178,6 +1216,7 @@
  18.166  				AA75589F1595D55500BBD41B /* SDL_config_iphoneos.h in Headers */,
  18.167  				AA7558A01595D55500BBD41B /* SDL_config.h in Headers */,
  18.168  				AA7558A11595D55500BBD41B /* SDL_copying.h in Headers */,
  18.169 +				AA13B3491FB8B27800D9FEE6 /* SDL_egl_c.h in Headers */,
  18.170  				AA7558A21595D55500BBD41B /* SDL_cpuinfo.h in Headers */,
  18.171  				AA7558A31595D55500BBD41B /* SDL_endian.h in Headers */,
  18.172  				AA7558A41595D55500BBD41B /* SDL_error.h in Headers */,
  18.173 @@ -1188,6 +1227,7 @@
  18.174  				AA7558A81595D55500BBD41B /* SDL_hints.h in Headers */,
  18.175  				566726461DF72CF5001DD3DB /* SDL_dataqueue.h in Headers */,
  18.176  				AA7558AA1595D55500BBD41B /* SDL_joystick.h in Headers */,
  18.177 +				AA13B34B1FB8B27800D9FEE6 /* SDL_shape_internals.h in Headers */,
  18.178  				AA7558AB1595D55500BBD41B /* SDL_keyboard.h in Headers */,
  18.179  				AA7558AC1595D55500BBD41B /* SDL_keycode.h in Headers */,
  18.180  				AA7558AD1595D55500BBD41B /* SDL_loadso.h in Headers */,
  18.181 @@ -1407,7 +1447,6 @@
  18.182  				FAB598681BB5C31600BE72C5 /* SDL_render_sw.c in Sources */,
  18.183  				FAB5986A1BB5C31600BE72C5 /* SDL_rotate.c in Sources */,
  18.184  				FAB5986D1BB5C31600BE72C5 /* SDL_render.c in Sources */,
  18.185 -				FAB5986F1BB5C31600BE72C5 /* SDL_yuv_mmx.c in Sources */,
  18.186  				FAB598711BB5C31600BE72C5 /* SDL_yuv_sw.c in Sources */,
  18.187  				FAB598721BB5C31600BE72C5 /* SDL_getenv.c in Sources */,
  18.188  				FAB598731BB5C31600BE72C5 /* SDL_iconv.c in Sources */,
  18.189 @@ -1501,6 +1540,7 @@
  18.190  				FD3F4A7A0DEA620800C5B771 /* SDL_stdlib.c in Sources */,
  18.191  				FDA6844D0DF2374E00F98A1A /* SDL_blit.c in Sources */,
  18.192  				FDA6844F0DF2374E00F98A1A /* SDL_blit_0.c in Sources */,
  18.193 +				AA13B3501FB8B3CC00D9FEE6 /* SDL_yuv.c in Sources */,
  18.194  				FDA684500DF2374E00F98A1A /* SDL_blit_1.c in Sources */,
  18.195  				566726451DF72CF5001DD3DB /* SDL_dataqueue.c in Sources */,
  18.196  				FDA684510DF2374E00F98A1A /* SDL_blit_A.c in Sources */,
  18.197 @@ -1513,6 +1553,7 @@
  18.198  				FDA6845E0DF2374E00F98A1A /* SDL_rect.c in Sources */,
  18.199  				FDA684620DF2374E00F98A1A /* SDL_RLEaccel.c in Sources */,
  18.200  				FDA684640DF2374E00F98A1A /* SDL_stretch.c in Sources */,
  18.201 +				AA13B34D1FB8B27800D9FEE6 /* SDL_egl.c in Sources */,
  18.202  				FDA684660DF2374E00F98A1A /* SDL_surface.c in Sources */,
  18.203  				FDA684680DF2374E00F98A1A /* SDL_video.c in Sources */,
  18.204  				FDA685FB0DF244C800F98A1A /* SDL_nullevents.c in Sources */,
  18.205 @@ -1520,6 +1561,7 @@
  18.206  				FD5F9D2F0E0E08B3008E885B /* SDL_joystick.c in Sources */,
  18.207  				FD689F030E26E5B600F90B21 /* SDL_sysjoystick.m in Sources */,
  18.208  				FD689F1D0E26E5D900F90B21 /* SDL_uikitevents.m in Sources */,
  18.209 +				AA13B35A1FB8B46400D9FEE6 /* yuv_rgb.c in Sources */,
  18.210  				FD689F1F0E26E5D900F90B21 /* SDL_uikitopengles.m in Sources */,
  18.211  				FD689F210E26E5D900F90B21 /* SDL_uikitvideo.m in Sources */,
  18.212  				FD689F230E26E5D900F90B21 /* SDL_uikitview.m in Sources */,
  18.213 @@ -1542,7 +1584,6 @@
  18.214  				04FFAB8B12E23B8D00BA343D /* SDL_atomic.c in Sources */,
  18.215  				04FFAB8C12E23B8D00BA343D /* SDL_spinlock.c in Sources */,
  18.216  				041B2CF112FA0F680087D585 /* SDL_render.c in Sources */,
  18.217 -				04409BA712FA989600FB9AA8 /* SDL_yuv_mmx.c in Sources */,
  18.218  				04409BA912FA989600FB9AA8 /* SDL_yuv_sw.c in Sources */,
  18.219  				04F7807612FB751400FC43C0 /* SDL_blendfillrect.c in Sources */,
  18.220  				04F7807812FB751400FC43C0 /* SDL_blendline.c in Sources */,
  18.221 @@ -1553,6 +1594,7 @@
  18.222  				0442EC5112FE1C1E004C9285 /* SDL_render_sw.c in Sources */,
  18.223  				0442EC5312FE1C28004C9285 /* SDL_render_gles.c in Sources */,
  18.224  				0442EC5512FE1C3F004C9285 /* SDL_hints.c in Sources */,
  18.225 +				AA13B34A1FB8B27800D9FEE6 /* SDL_shape.c in Sources */,
  18.226  				0402A85812FE70C600CECEE3 /* SDL_render_gles2.c in Sources */,
  18.227  				0402A85912FE70C600CECEE3 /* SDL_shaders_gles2.c in Sources */,
  18.228  				04BAC09D1300C1290055DE28 /* SDL_log.c in Sources */,
    19.1 --- a/Xcode-iOS/SDLtest/SDL2test.xcodeproj/project.pbxproj	Sun Nov 12 10:59:05 2017 -0800
    19.2 +++ b/Xcode-iOS/SDLtest/SDL2test.xcodeproj/project.pbxproj	Sun Nov 12 22:51:12 2017 -0800
    19.3 @@ -318,6 +318,7 @@
    19.4  			isa = XCBuildConfiguration;
    19.5  			buildSettings = {
    19.6  				EXECUTABLE_PREFIX = lib;
    19.7 +				IPHONEOS_DEPLOYMENT_TARGET = 8.0;
    19.8  				PRODUCT_NAME = "$(TARGET_NAME)";
    19.9  			};
   19.10  			name = Debug;
   19.11 @@ -326,6 +327,7 @@
   19.12  			isa = XCBuildConfiguration;
   19.13  			buildSettings = {
   19.14  				EXECUTABLE_PREFIX = lib;
   19.15 +				IPHONEOS_DEPLOYMENT_TARGET = 8.0;
   19.16  				PRODUCT_NAME = "$(TARGET_NAME)";
   19.17  			};
   19.18  			name = Release;
    20.1 --- a/Xcode-iOS/Test/Info.plist	Sun Nov 12 10:59:05 2017 -0800
    20.2 +++ b/Xcode-iOS/Test/Info.plist	Sun Nov 12 22:51:12 2017 -0800
    20.3 @@ -22,7 +22,5 @@
    20.4  	<string>????</string>
    20.5  	<key>CFBundleVersion</key>
    20.6  	<string>1.0</string>
    20.7 -	<key>NSMainNibFile</key>
    20.8 -	<string></string>
    20.9  </dict>
   20.10  </plist>
    21.1 --- a/Xcode-iOS/Test/TestiPhoneOS.xcodeproj/project.pbxproj	Sun Nov 12 10:59:05 2017 -0800
    21.2 +++ b/Xcode-iOS/Test/TestiPhoneOS.xcodeproj/project.pbxproj	Sun Nov 12 22:51:12 2017 -0800
    21.3 @@ -36,6 +36,22 @@
    21.4  		56ED0508118A8FE400A56AA6 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FDA8A89D0E2D111A00EA573E /* Foundation.framework */; };
    21.5  		56ED0509118A8FE400A56AA6 /* CoreAudio.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FDA8A89E0E2D111A00EA573E /* CoreAudio.framework */; };
    21.6  		56ED0511118A904200A56AA6 /* testpower.c in Sources */ = {isa = PBXBuildFile; fileRef = 56ED0510118A904200A56AA6 /* testpower.c */; };
    21.7 +		AA13B3171FB8AEBC00D9FEE6 /* AVFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FABA34761D8B4EAD00915323 /* AVFoundation.framework */; };
    21.8 +		AA13B3181FB8AEBC00D9FEE6 /* libSDL2test.a in Frameworks */ = {isa = PBXBuildFile; fileRef = AA1EE452176059230029C7A5 /* libSDL2test.a */; };
    21.9 +		AA13B3191FB8AEBC00D9FEE6 /* libSDL2.a in Frameworks */ = {isa = PBXBuildFile; fileRef = FD1B48B80E3131CA007AB34E /* libSDL2.a */; };
   21.10 +		AA13B31A1FB8AEBC00D9FEE6 /* GameController.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA684F7A1BAF1A4400DCFD1A /* GameController.framework */; };
   21.11 +		AA13B31B1FB8AEBC00D9FEE6 /* CoreMotion.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA8B4BAC1967076F00F8EB7C /* CoreMotion.framework */; };
   21.12 +		AA13B31C1FB8AEBC00D9FEE6 /* AudioToolbox.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FDA8A8980E2D111A00EA573E /* AudioToolbox.framework */; };
   21.13 +		AA13B31D1FB8AEBC00D9FEE6 /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FDA8A8990E2D111A00EA573E /* QuartzCore.framework */; };
   21.14 +		AA13B31E1FB8AEBC00D9FEE6 /* OpenGLES.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FDA8A89A0E2D111A00EA573E /* OpenGLES.framework */; };
   21.15 +		AA13B31F1FB8AEBC00D9FEE6 /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FDA8A89B0E2D111A00EA573E /* CoreGraphics.framework */; };
   21.16 +		AA13B3201FB8AEBC00D9FEE6 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FDA8A89C0E2D111A00EA573E /* UIKit.framework */; };
   21.17 +		AA13B3211FB8AEBC00D9FEE6 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FDA8A89D0E2D111A00EA573E /* Foundation.framework */; };
   21.18 +		AA13B3221FB8AEBC00D9FEE6 /* CoreAudio.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FDA8A89E0E2D111A00EA573E /* CoreAudio.framework */; };
   21.19 +		AA13B32F1FB8AF0C00D9FEE6 /* testyuv.bmp in Resources */ = {isa = PBXBuildFile; fileRef = AA13B32E1FB8AF0C00D9FEE6 /* testyuv.bmp */; };
   21.20 +		AA13B3301FB8AF2300D9FEE6 /* testyuv.bmp in Resources */ = {isa = PBXBuildFile; fileRef = AA13B32E1FB8AF0C00D9FEE6 /* testyuv.bmp */; };
   21.21 +		AA13B35D1FB8B4E200D9FEE6 /* testyuv.c in Sources */ = {isa = PBXBuildFile; fileRef = AA13B35B1FB8B4D600D9FEE6 /* testyuv.c */; };
   21.22 +		AA13B3611FB8B52500D9FEE6 /* testyuv_cvt.c in Sources */ = {isa = PBXBuildFile; fileRef = AA13B35E1FB8B50D00D9FEE6 /* testyuv_cvt.c */; };
   21.23  		AA1EE470176059D00029C7A5 /* libSDL2test.a in Frameworks */ = {isa = PBXBuildFile; fileRef = AA1EE452176059230029C7A5 /* libSDL2test.a */; };
   21.24  		AA1EE47117605A7F0029C7A5 /* libSDL2test.a in Frameworks */ = {isa = PBXBuildFile; fileRef = AA1EE452176059230029C7A5 /* libSDL2test.a */; };
   21.25  		AA1EE47417605B5C0029C7A5 /* libSDL2test.a in Frameworks */ = {isa = PBXBuildFile; fileRef = AA1EE452176059230029C7A5 /* libSDL2test.a */; };
   21.26 @@ -407,6 +423,10 @@
   21.27  		1D6058910D05DD3D006BFB54 /* testwm2.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = testwm2.app; sourceTree = BUILT_PRODUCTS_DIR; };
   21.28  		56ED050D118A8FE400A56AA6 /* testpower.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = testpower.app; sourceTree = BUILT_PRODUCTS_DIR; };
   21.29  		56ED0510118A904200A56AA6 /* testpower.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = testpower.c; path = ../../test/testpower.c; sourceTree = SOURCE_ROOT; };
   21.30 +		AA13B3261FB8AEBC00D9FEE6 /* testyuv.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = testyuv.app; sourceTree = BUILT_PRODUCTS_DIR; };
   21.31 +		AA13B32E1FB8AF0C00D9FEE6 /* testyuv.bmp */ = {isa = PBXFileReference; lastKnownFileType = image.bmp; name = testyuv.bmp; path = ../../test/testyuv.bmp; sourceTree = "<group>"; };
   21.32 +		AA13B35B1FB8B4D600D9FEE6 /* testyuv.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = testyuv.c; path = ../../test/testyuv.c; sourceTree = "<group>"; };
   21.33 +		AA13B35E1FB8B50D00D9FEE6 /* testyuv_cvt.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = testyuv_cvt.c; path = ../../test/testyuv_cvt.c; sourceTree = "<group>"; };
   21.34  		AA1EE44D176059220029C7A5 /* SDL2test.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = SDL2test.xcodeproj; path = ../SDLtest/SDL2test.xcodeproj; sourceTree = "<group>"; };
   21.35  		AAE7DEEC14CBB1E100DF1A0E /* testscale.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = testscale.app; sourceTree = BUILT_PRODUCTS_DIR; };
   21.36  		AAE7DF4514CBB43900DF1A0E /* testscale.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = testscale.c; path = ../../test/testscale.c; sourceTree = "<group>"; };
   21.37 @@ -552,6 +572,25 @@
   21.38  			);
   21.39  			runOnlyForDeploymentPostprocessing = 0;
   21.40  		};
   21.41 +		AA13B3161FB8AEBC00D9FEE6 /* Frameworks */ = {
   21.42 +			isa = PBXFrameworksBuildPhase;
   21.43 +			buildActionMask = 2147483647;
   21.44 +			files = (
   21.45 +				AA13B3171FB8AEBC00D9FEE6 /* AVFoundation.framework in Frameworks */,
   21.46 +				AA13B3181FB8AEBC00D9FEE6 /* libSDL2test.a in Frameworks */,
   21.47 +				AA13B3191FB8AEBC00D9FEE6 /* libSDL2.a in Frameworks */,
   21.48 +				AA13B31A1FB8AEBC00D9FEE6 /* GameController.framework in Frameworks */,
   21.49 +				AA13B31B1FB8AEBC00D9FEE6 /* CoreMotion.framework in Frameworks */,
   21.50 +				AA13B31C1FB8AEBC00D9FEE6 /* AudioToolbox.framework in Frameworks */,
   21.51 +				AA13B31D1FB8AEBC00D9FEE6 /* QuartzCore.framework in Frameworks */,
   21.52 +				AA13B31E1FB8AEBC00D9FEE6 /* OpenGLES.framework in Frameworks */,
   21.53 +				AA13B31F1FB8AEBC00D9FEE6 /* CoreGraphics.framework in Frameworks */,
   21.54 +				AA13B3201FB8AEBC00D9FEE6 /* UIKit.framework in Frameworks */,
   21.55 +				AA13B3211FB8AEBC00D9FEE6 /* Foundation.framework in Frameworks */,
   21.56 +				AA13B3221FB8AEBC00D9FEE6 /* CoreAudio.framework in Frameworks */,
   21.57 +			);
   21.58 +			runOnlyForDeploymentPostprocessing = 0;
   21.59 +		};
   21.60  		AAE7DEE014CBB1E100DF1A0E /* Frameworks */ = {
   21.61  			isa = PBXFrameworksBuildPhase;
   21.62  			buildActionMask = 2147483647;
   21.63 @@ -1003,6 +1042,7 @@
   21.64  				FA3D99341BC4E644002C96C8 /* testgamecontroller-TV.app */,
   21.65  				FABA34911D8B575200915323 /* testaudiocapture.app */,
   21.66  				FABA34AA1D8B582100915323 /* loopwav-TV.app */,
   21.67 +				AA13B3261FB8AEBC00D9FEE6 /* testyuv.app */,
   21.68  			);
   21.69  			name = Products;
   21.70  			sourceTree = "<group>";
   21.71 @@ -1051,9 +1091,9 @@
   21.72  		FDA8A73B0E2D0F0400EA573E /* src */ = {
   21.73  			isa = PBXGroup;
   21.74  			children = (
   21.75 -				FABA34931D8B578200915323 /* testaudiocapture.c */,
   21.76  				047A63F013285CD100CD7973 /* checkkeys.c */,
   21.77  				FDA8A78B0E2D0F3D00EA573E /* loopwave.c */,
   21.78 +				FABA34931D8B578200915323 /* testaudiocapture.c */,
   21.79  				FDA8A7410E2D0F1600EA573E /* testaudioinfo.c */,
   21.80  				FDC430090F0D86BF009C87E1 /* testdraw2.c */,
   21.81  				FDA8A7470E2D0F1600EA573E /* testerror.c */,
   21.82 @@ -1076,6 +1116,8 @@
   21.83  				FDA8A75A0E2D0F1600EA573E /* testtimer.c */,
   21.84  				FDA8A75B0E2D0F1600EA573E /* testver.c */,
   21.85  				FDA8A75F0E2D0F1600EA573E /* testwm2.c */,
   21.86 +				AA13B35E1FB8B50D00D9FEE6 /* testyuv_cvt.c */,
   21.87 +				AA13B35B1FB8B4D600D9FEE6 /* testyuv.c */,
   21.88  				FDA8A7610E2D0F1600EA573E /* torturethread.c */,
   21.89  			);
   21.90  			name = src;
   21.91 @@ -1103,12 +1145,13 @@
   21.92  				FA0EF2281BAF4487000E07A6 /* axis.bmp */,
   21.93  				FA0EF2291BAF4487000E07A6 /* button.bmp */,
   21.94  				FA0EF22A1BAF4487000E07A6 /* controllermap.bmp */,
   21.95 -				FDD2C18A0E2E52FE00B7A85F /* utf8.txt */,
   21.96  				FDA8AAD90E2D33B000EA573E /* icon.bmp */,
   21.97  				FDA8AADA0E2D33BA00EA573E /* moose.dat */,
   21.98  				FDA8AADB0E2D33BA00EA573E /* picture.xbm */,
   21.99  				FDA8AADE0E2D33C100EA573E /* sample.bmp */,
  21.100  				FDA8AAE20E2D33C600EA573E /* sample.wav */,
  21.101 +				AA13B32E1FB8AF0C00D9FEE6 /* testyuv.bmp */,
  21.102 +				FDD2C18A0E2E52FE00B7A85F /* utf8.txt */,
  21.103  			);
  21.104  			name = Resources;
  21.105  			sourceTree = "<group>";
  21.106 @@ -1184,6 +1227,23 @@
  21.107  			productReference = 56ED050D118A8FE400A56AA6 /* testpower.app */;
  21.108  			productType = "com.apple.product-type.application";
  21.109  		};
  21.110 +		AA13B3111FB8AEBC00D9FEE6 /* testyuv */ = {
  21.111 +			isa = PBXNativeTarget;
  21.112 +			buildConfigurationList = AA13B3231FB8AEBC00D9FEE6 /* Build configuration list for PBXNativeTarget "testyuv" */;
  21.113 +			buildPhases = (
  21.114 +				AA13B3121FB8AEBC00D9FEE6 /* Resources */,
  21.115 +				AA13B3141FB8AEBC00D9FEE6 /* Sources */,
  21.116 +				AA13B3161FB8AEBC00D9FEE6 /* Frameworks */,
  21.117 +			);
  21.118 +			buildRules = (
  21.119 +			);
  21.120 +			dependencies = (
  21.121 +			);
  21.122 +			name = testyuv;
  21.123 +			productName = Test;
  21.124 +			productReference = AA13B3261FB8AEBC00D9FEE6 /* testyuv.app */;
  21.125 +			productType = "com.apple.product-type.application";
  21.126 +		};
  21.127  		AAE7DEDA14CBB1E100DF1A0E /* testscale */ = {
  21.128  			isa = PBXNativeTarget;
  21.129  			buildConfigurationList = AAE7DEE914CBB1E100DF1A0E /* Build configuration list for PBXNativeTarget "testscale" */;
  21.130 @@ -1584,6 +1644,9 @@
  21.131  			attributes = {
  21.132  				LastUpgradeCheck = 0630;
  21.133  				TargetAttributes = {
  21.134 +					AA13B3111FB8AEBC00D9FEE6 = {
  21.135 +						DevelopmentTeam = EH385AYQ6F;
  21.136 +					};
  21.137  					FA3D99331BC4E644002C96C8 = {
  21.138  						CreatedOnToolsVersion = 7.1;
  21.139  					};
  21.140 @@ -1643,6 +1706,7 @@
  21.141  				FDD2C5740E2E8C7400B7A85F /* testtimer */,
  21.142  				FDD2C5B30E2E8CFC00B7A85F /* testver */,
  21.143  				1D6058900D05DD3D006BFB54 /* testwm2 */,
  21.144 +				AA13B3111FB8AEBC00D9FEE6 /* testyuv */,
  21.145  				FDD2C6E20E2E959E00B7A85F /* torturethread */,
  21.146  			);
  21.147  		};
  21.148 @@ -1692,6 +1756,7 @@
  21.149  			isa = PBXResourcesBuildPhase;
  21.150  			buildActionMask = 2147483647;
  21.151  			files = (
  21.152 +				AA13B32F1FB8AF0C00D9FEE6 /* testyuv.bmp in Resources */,
  21.153  			);
  21.154  			runOnlyForDeploymentPostprocessing = 0;
  21.155  		};
  21.156 @@ -1710,6 +1775,14 @@
  21.157  			);
  21.158  			runOnlyForDeploymentPostprocessing = 0;
  21.159  		};
  21.160 +		AA13B3121FB8AEBC00D9FEE6 /* Resources */ = {
  21.161 +			isa = PBXResourcesBuildPhase;
  21.162 +			buildActionMask = 2147483647;
  21.163 +			files = (
  21.164 +				AA13B3301FB8AF2300D9FEE6 /* testyuv.bmp in Resources */,
  21.165 +			);
  21.166 +			runOnlyForDeploymentPostprocessing = 0;
  21.167 +		};
  21.168  		AAE7DEDB14CBB1E100DF1A0E /* Resources */ = {
  21.169  			isa = PBXResourcesBuildPhase;
  21.170  			buildActionMask = 2147483647;
  21.171 @@ -1926,6 +1999,15 @@
  21.172  			);
  21.173  			runOnlyForDeploymentPostprocessing = 0;
  21.174  		};
  21.175 +		AA13B3141FB8AEBC00D9FEE6 /* Sources */ = {
  21.176 +			isa = PBXSourcesBuildPhase;
  21.177 +			buildActionMask = 2147483647;
  21.178 +			files = (
  21.179 +				AA13B3611FB8B52500D9FEE6 /* testyuv_cvt.c in Sources */,
  21.180 +				AA13B35D1FB8B4E200D9FEE6 /* testyuv.c in Sources */,
  21.181 +			);
  21.182 +			runOnlyForDeploymentPostprocessing = 0;
  21.183 +		};
  21.184  		AAE7DEDD14CBB1E100DF1A0E /* Sources */ = {
  21.185  			isa = PBXSourcesBuildPhase;
  21.186  			buildActionMask = 2147483647;
  21.187 @@ -2185,6 +2267,24 @@
  21.188  			};
  21.189  			name = Release;
  21.190  		};
  21.191 +		AA13B3241FB8AEBC00D9FEE6 /* Debug */ = {
  21.192 +			isa = XCBuildConfiguration;
  21.193 +			buildSettings = {
  21.194 +				DEVELOPMENT_TEAM = EH385AYQ6F;
  21.195 +				INFOPLIST_FILE = Info.plist;
  21.196 +				PRODUCT_NAME = "$(TARGET_NAME)";
  21.197 +			};
  21.198 +			name = Debug;
  21.199 +		};
  21.200 +		AA13B3251FB8AEBC00D9FEE6 /* Release */ = {
  21.201 +			isa = XCBuildConfiguration;
  21.202 +			buildSettings = {
  21.203 +				DEVELOPMENT_TEAM = EH385AYQ6F;
  21.204 +				INFOPLIST_FILE = Info.plist;
  21.205 +				PRODUCT_NAME = "$(TARGET_NAME)";
  21.206 +			};
  21.207 +			name = Release;
  21.208 +		};
  21.209  		AAE7DEEA14CBB1E100DF1A0E /* Debug */ = {
  21.210  			isa = XCBuildConfiguration;
  21.211  			buildSettings = {
  21.212 @@ -2221,8 +2321,10 @@
  21.213  			isa = XCBuildConfiguration;
  21.214  			buildSettings = {
  21.215  				"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
  21.216 +				ENABLE_BITCODE = NO;
  21.217  				GCC_OPTIMIZATION_LEVEL = 0;
  21.218  				HEADER_SEARCH_PATHS = ../../include;
  21.219 +				IPHONEOS_DEPLOYMENT_TARGET = 8.0;
  21.220  				ONLY_ACTIVE_ARCH = YES;
  21.221  				OTHER_LDFLAGS = "-ObjC";
  21.222  				"PROVISIONING_PROFILE[sdk=iphoneos*]" = "";
  21.223 @@ -2235,7 +2337,9 @@
  21.224  			isa = XCBuildConfiguration;
  21.225  			buildSettings = {
  21.226  				"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
  21.227 +				ENABLE_BITCODE = NO;
  21.228  				HEADER_SEARCH_PATHS = ../../include;
  21.229 +				IPHONEOS_DEPLOYMENT_TARGET = 8.0;
  21.230  				OTHER_LDFLAGS = "-ObjC";
  21.231  				"PROVISIONING_PROFILE[sdk=iphoneos*]" = "";
  21.232  				SDKROOT = iphoneos;
  21.233 @@ -2696,6 +2800,15 @@
  21.234  			defaultConfigurationIsVisible = 0;
  21.235  			defaultConfigurationName = Release;
  21.236  		};
  21.237 +		AA13B3231FB8AEBC00D9FEE6 /* Build configuration list for PBXNativeTarget "testyuv" */ = {
  21.238 +			isa = XCConfigurationList;
  21.239 +			buildConfigurations = (
  21.240 +				AA13B3241FB8AEBC00D9FEE6 /* Debug */,
  21.241 +				AA13B3251FB8AEBC00D9FEE6 /* Release */,
  21.242 +			);
  21.243 +			defaultConfigurationIsVisible = 0;
  21.244 +			defaultConfigurationName = Release;
  21.245 +		};
  21.246  		AAE7DEE914CBB1E100DF1A0E /* Build configuration list for PBXNativeTarget "testscale" */ = {
  21.247  			isa = XCConfigurationList;
  21.248  			buildConfigurations = (
    22.1 --- a/Xcode/SDL/SDL.xcodeproj/project.pbxproj	Sun Nov 12 10:59:05 2017 -0800
    22.2 +++ b/Xcode/SDL/SDL.xcodeproj/project.pbxproj	Sun Nov 12 22:51:12 2017 -0800
    22.3 @@ -25,12 +25,8 @@
    22.4  		0435673F1303160F00BA5428 /* SDL_shaders_gl.h in Headers */ = {isa = PBXBuildFile; fileRef = 0435673D1303160F00BA5428 /* SDL_shaders_gl.h */; };
    22.5  		043567401303160F00BA5428 /* SDL_shaders_gl.c in Sources */ = {isa = PBXBuildFile; fileRef = 0435673C1303160F00BA5428 /* SDL_shaders_gl.c */; };
    22.6  		043567411303160F00BA5428 /* SDL_shaders_gl.h in Headers */ = {isa = PBXBuildFile; fileRef = 0435673D1303160F00BA5428 /* SDL_shaders_gl.h */; };
    22.7 -		04409B9112FA97ED00FB9AA8 /* mmx.h in Headers */ = {isa = PBXBuildFile; fileRef = 04409B8D12FA97ED00FB9AA8 /* mmx.h */; };
    22.8 -		04409B9212FA97ED00FB9AA8 /* SDL_yuv_mmx.c in Sources */ = {isa = PBXBuildFile; fileRef = 04409B8E12FA97ED00FB9AA8 /* SDL_yuv_mmx.c */; };
    22.9  		04409B9312FA97ED00FB9AA8 /* SDL_yuv_sw_c.h in Headers */ = {isa = PBXBuildFile; fileRef = 04409B8F12FA97ED00FB9AA8 /* SDL_yuv_sw_c.h */; };
   22.10  		04409B9412FA97ED00FB9AA8 /* SDL_yuv_sw.c in Sources */ = {isa = PBXBuildFile; fileRef = 04409B9012FA97ED00FB9AA8 /* SDL_yuv_sw.c */; };
   22.11 -		04409B9512FA97ED00FB9AA8 /* mmx.h in Headers */ = {isa = PBXBuildFile; fileRef = 04409B8D12FA97ED00FB9AA8 /* mmx.h */; };
   22.12 -		04409B9612FA97ED00FB9AA8 /* SDL_yuv_mmx.c in Sources */ = {isa = PBXBuildFile; fileRef = 04409B8E12FA97ED00FB9AA8 /* SDL_yuv_mmx.c */; };
   22.13  		04409B9712FA97ED00FB9AA8 /* SDL_yuv_sw_c.h in Headers */ = {isa = PBXBuildFile; fileRef = 04409B8F12FA97ED00FB9AA8 /* SDL_yuv_sw_c.h */; };
   22.14  		04409B9812FA97ED00FB9AA8 /* SDL_yuv_sw.c in Sources */ = {isa = PBXBuildFile; fileRef = 04409B9012FA97ED00FB9AA8 /* SDL_yuv_sw.c */; };
   22.15  		0442EC1812FE1BBA004C9285 /* SDL_render_gl.c in Sources */ = {isa = PBXBuildFile; fileRef = 0442EC1712FE1BBA004C9285 /* SDL_render_gl.c */; };
   22.16 @@ -540,6 +536,10 @@
   22.17  		AA75585E1595D4D800BBD41B /* SDL.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7557F91595D4D800BBD41B /* SDL.h */; settings = {ATTRIBUTES = (Public, ); }; };
   22.18  		AA75585F1595D4D800BBD41B /* SDL.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7557F91595D4D800BBD41B /* SDL.h */; settings = {ATTRIBUTES = (Public, ); }; };
   22.19  		AA8167541F5E727800518735 /* SDL_vulkan.h in Headers */ = {isa = PBXBuildFile; fileRef = 4D4820431F0F10B400EDC31C /* SDL_vulkan.h */; settings = {ATTRIBUTES = (Public, ); }; };
   22.20 +		AA9A7F111FB0206400FED37F /* yuv_rgb.h in Headers */ = {isa = PBXBuildFile; fileRef = AA9A7F0F1FB0206300FED37F /* yuv_rgb.h */; };
   22.21 +		AA9A7F121FB0206400FED37F /* yuv_rgb.c in Sources */ = {isa = PBXBuildFile; fileRef = AA9A7F101FB0206300FED37F /* yuv_rgb.c */; };
   22.22 +		AA9A7F151FB0209D00FED37F /* SDL_yuv.c in Sources */ = {isa = PBXBuildFile; fileRef = AA9A7F131FB0209C00FED37F /* SDL_yuv.c */; };
   22.23 +		AA9A7F161FB0209D00FED37F /* SDL_yuv_c.h in Headers */ = {isa = PBXBuildFile; fileRef = AA9A7F141FB0209C00FED37F /* SDL_yuv_c.h */; };
   22.24  		AA9E4093163BE51E007A2AD0 /* SDL_x11messagebox.c in Sources */ = {isa = PBXBuildFile; fileRef = AA9E4092163BE51E007A2AD0 /* SDL_x11messagebox.c */; };
   22.25  		AA9E4094163BE51E007A2AD0 /* SDL_x11messagebox.c in Sources */ = {isa = PBXBuildFile; fileRef = AA9E4092163BE51E007A2AD0 /* SDL_x11messagebox.c */; };
   22.26  		AA9FF95A1637CBF9000DF050 /* SDL_messagebox.h in Headers */ = {isa = PBXBuildFile; fileRef = AA9FF9591637CBF9000DF050 /* SDL_messagebox.h */; settings = {ATTRIBUTES = (Public, ); }; };
   22.27 @@ -644,7 +644,6 @@
   22.28  		DB313FB617554B71006C0E22 /* SDL_x11video.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFFD412E6671800899322 /* SDL_x11video.h */; };
   22.29  		DB313FB717554B71006C0E22 /* SDL_x11window.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFFD612E6671800899322 /* SDL_x11window.h */; };
   22.30  		DB313FB817554B71006C0E22 /* SDL_sysrender.h in Headers */ = {isa = PBXBuildFile; fileRef = 041B2C9F12FA0D680087D585 /* SDL_sysrender.h */; };
   22.31 -		DB313FB917554B71006C0E22 /* mmx.h in Headers */ = {isa = PBXBuildFile; fileRef = 04409B8D12FA97ED00FB9AA8 /* mmx.h */; };
   22.32  		DB313FBA17554B71006C0E22 /* SDL_yuv_sw_c.h in Headers */ = {isa = PBXBuildFile; fileRef = 04409B8F12FA97ED00FB9AA8 /* SDL_yuv_sw_c.h */; };
   22.33  		DB313FBB17554B71006C0E22 /* SDL_nullframebuffer_c.h in Headers */ = {isa = PBXBuildFile; fileRef = 04F7803712FB748500FC43C0 /* SDL_nullframebuffer_c.h */; };
   22.34  		DB313FBC17554B71006C0E22 /* SDL_blendfillrect.h in Headers */ = {isa = PBXBuildFile; fileRef = 04F7803E12FB74A200FC43C0 /* SDL_blendfillrect.h */; };
   22.35 @@ -801,7 +800,6 @@
   22.36  		DB31405617554B71006C0E22 /* SDL_x11video.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFFD312E6671800899322 /* SDL_x11video.c */; };
   22.37  		DB31405717554B71006C0E22 /* SDL_x11window.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFFD512E6671800899322 /* SDL_x11window.c */; };
   22.38  		DB31405817554B71006C0E22 /* SDL_render.c in Sources */ = {isa = PBXBuildFile; fileRef = 041B2C9E12FA0D680087D585 /* SDL_render.c */; };
   22.39 -		DB31405917554B71006C0E22 /* SDL_yuv_mmx.c in Sources */ = {isa = PBXBuildFile; fileRef = 04409B8E12FA97ED00FB9AA8 /* SDL_yuv_mmx.c */; };
   22.40  		DB31405A17554B71006C0E22 /* SDL_yuv_sw.c in Sources */ = {isa = PBXBuildFile; fileRef = 04409B9012FA97ED00FB9AA8 /* SDL_yuv_sw.c */; };
   22.41  		DB31405B17554B71006C0E22 /* SDL_nullframebuffer.c in Sources */ = {isa = PBXBuildFile; fileRef = 04F7803812FB748500FC43C0 /* SDL_nullframebuffer.c */; };
   22.42  		DB31405C17554B71006C0E22 /* SDL_blendfillrect.c in Sources */ = {isa = PBXBuildFile; fileRef = 04F7803D12FB74A200FC43C0 /* SDL_blendfillrect.c */; };
   22.43 @@ -852,8 +850,6 @@
   22.44  		041B2C9F12FA0D680087D585 /* SDL_sysrender.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_sysrender.h; sourceTree = "<group>"; };
   22.45  		0435673C1303160F00BA5428 /* SDL_shaders_gl.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_shaders_gl.c; sourceTree = "<group>"; };
   22.46  		0435673D1303160F00BA5428 /* SDL_shaders_gl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_shaders_gl.h; sourceTree = "<group>"; };
   22.47 -		04409B8D12FA97ED00FB9AA8 /* mmx.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = mmx.h; sourceTree = "<group>"; };
   22.48 -		04409B8E12FA97ED00FB9AA8 /* SDL_yuv_mmx.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_yuv_mmx.c; sourceTree = "<group>"; };
   22.49  		04409B8F12FA97ED00FB9AA8 /* SDL_yuv_sw_c.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_yuv_sw_c.h; sourceTree = "<group>"; };
   22.50  		04409B9012FA97ED00FB9AA8 /* SDL_yuv_sw.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_yuv_sw.c; sourceTree = "<group>"; };
   22.51  		0442EC1712FE1BBA004C9285 /* SDL_render_gl.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_render_gl.c; sourceTree = "<group>"; };
   22.52 @@ -1104,6 +1100,10 @@
   22.53  		AA7557F71595D4D800BBD41B /* SDL_version.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_version.h; sourceTree = "<group>"; };
   22.54  		AA7557F81595D4D800BBD41B /* SDL_video.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_video.h; sourceTree = "<group>"; };
   22.55  		AA7557F91595D4D800BBD41B /* SDL.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL.h; sourceTree = "<group>"; };
   22.56 +		AA9A7F0F1FB0206300FED37F /* yuv_rgb.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = yuv_rgb.h; sourceTree = "<group>"; };
   22.57 +		AA9A7F101FB0206300FED37F /* yuv_rgb.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = yuv_rgb.c; sourceTree = "<group>"; };
   22.58 +		AA9A7F131FB0209C00FED37F /* SDL_yuv.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_yuv.c; sourceTree = "<group>"; };
   22.59 +		AA9A7F141FB0209C00FED37F /* SDL_yuv_c.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_yuv_c.h; sourceTree = "<group>"; };
   22.60  		AA9E4092163BE51E007A2AD0 /* SDL_x11messagebox.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_x11messagebox.c; sourceTree = "<group>"; };
   22.61  		AA9FF9591637CBF9000DF050 /* SDL_messagebox.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_messagebox.h; sourceTree = "<group>"; };
   22.62  		AABCC38B164063D200AB8930 /* SDL_cocoamessagebox.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_cocoamessagebox.h; sourceTree = "<group>"; };
   22.63 @@ -1264,10 +1264,8 @@
   22.64  			children = (
   22.65  				041B2C9A12FA0D680087D585 /* opengl */,
   22.66  				041B2CA012FA0D680087D585 /* software */,
   22.67 -				04409B8D12FA97ED00FB9AA8 /* mmx.h */,
   22.68  				041B2C9E12FA0D680087D585 /* SDL_render.c */,
   22.69  				041B2C9F12FA0D680087D585 /* SDL_sysrender.h */,
   22.70 -				04409B8E12FA97ED00FB9AA8 /* SDL_yuv_mmx.c */,
   22.71  				04409B8F12FA97ED00FB9AA8 /* SDL_yuv_sw_c.h */,
   22.72  				04409B9012FA97ED00FB9AA8 /* SDL_yuv_sw.c */,
   22.73  			);
   22.74 @@ -1568,8 +1566,7 @@
   22.75  				04BDFEC112E6671800899322 /* cocoa */,
   22.76  				04BDFEE712E6671800899322 /* dummy */,
   22.77  				04BDFFB712E6671800899322 /* x11 */,
   22.78 -				04BDFF4E12E6671800899322 /* SDL_blit.c */,
   22.79 -				04BDFF4F12E6671800899322 /* SDL_blit.h */,
   22.80 +				AA9A7F0E1FB0200B00FED37F /* yuv2rgb */,
   22.81  				04BDFF5012E6671800899322 /* SDL_blit_0.c */,
   22.82  				04BDFF5112E6671800899322 /* SDL_blit_1.c */,
   22.83  				04BDFF5212E6671800899322 /* SDL_blit_A.c */,
   22.84 @@ -1580,22 +1577,26 @@
   22.85  				04BDFF5712E6671800899322 /* SDL_blit_N.c */,
   22.86  				04BDFF5812E6671800899322 /* SDL_blit_slow.c */,
   22.87  				04BDFF5912E6671800899322 /* SDL_blit_slow.h */,
   22.88 +				04BDFF4E12E6671800899322 /* SDL_blit.c */,
   22.89 +				04BDFF4F12E6671800899322 /* SDL_blit.h */,
   22.90  				04BDFF5A12E6671800899322 /* SDL_bmp.c */,
   22.91  				04BDFF5B12E6671800899322 /* SDL_clipboard.c */,
   22.92  				04BDFF6012E6671800899322 /* SDL_fillrect.c */,
   22.93 +				04BDFF6612E6671800899322 /* SDL_pixels_c.h */,
   22.94  				04BDFF6512E6671800899322 /* SDL_pixels.c */,
   22.95 -				04BDFF6612E6671800899322 /* SDL_pixels_c.h */,
   22.96  				04BDFF6712E6671800899322 /* SDL_rect.c */,
   22.97 +				04BDFF7012E6671800899322 /* SDL_RLEaccel_c.h */,
   22.98  				04BDFF6F12E6671800899322 /* SDL_RLEaccel.c */,
   22.99 -				04BDFF7012E6671800899322 /* SDL_RLEaccel_c.h */,
  22.100 +				04BDFF7212E6671800899322 /* SDL_shape_internals.h */,
  22.101  				04BDFF7112E6671800899322 /* SDL_shape.c */,
  22.102 -				04BDFF7212E6671800899322 /* SDL_shape_internals.h */,
  22.103  				04BDFF7312E6671800899322 /* SDL_stretch.c */,
  22.104  				04BDFF7412E6671800899322 /* SDL_surface.c */,
  22.105  				04BDFF7512E6671800899322 /* SDL_sysvideo.h */,
  22.106  				04BDFF7612E6671800899322 /* SDL_video.c */,
  22.107  				4D16644C1EDD6023003DE88E /* SDL_vulkan_internal.h */,
  22.108  				4D16644D1EDD6023003DE88E /* SDL_vulkan_utils.c */,
  22.109 +				AA9A7F141FB0209C00FED37F /* SDL_yuv_c.h */,
  22.110 +				AA9A7F131FB0209C00FED37F /* SDL_yuv.c */,
  22.111  			);
  22.112  			name = video;
  22.113  			path = ../../src/video;
  22.114 @@ -1763,6 +1764,16 @@
  22.115  			name = dynapi;
  22.116  			sourceTree = "<group>";
  22.117  		};
  22.118 +		AA9A7F0E1FB0200B00FED37F /* yuv2rgb */ = {
  22.119 +			isa = PBXGroup;
  22.120 +			children = (
  22.121 +				AA9A7F101FB0206300FED37F /* yuv_rgb.c */,
  22.122 +				AA9A7F0F1FB0206300FED37F /* yuv_rgb.h */,
  22.123 +			);
  22.124 +			name = yuv2rgb;
  22.125 +			path = ../../src/video/yuv2rgb;
  22.126 +			sourceTree = SOURCE_ROOT;
  22.127 +		};
  22.128  		BEC562FE0761C0E800A33029 /* Linked Frameworks */ = {
  22.129  			isa = PBXGroup;
  22.130  			children = (
  22.131 @@ -1882,6 +1893,7 @@
  22.132  				04BD004B12E6671800899322 /* SDL_events_c.h in Headers */,
  22.133  				04BD004D12E6671800899322 /* SDL_gesture_c.h in Headers */,
  22.134  				04BD004F12E6671800899322 /* SDL_keyboard_c.h in Headers */,
  22.135 +				AA9A7F111FB0206400FED37F /* yuv_rgb.h in Headers */,
  22.136  				04BD005112E6671800899322 /* SDL_mouse_c.h in Headers */,
  22.137  				04BD005312E6671800899322 /* SDL_sysevents.h in Headers */,
  22.138  				04BD005512E6671800899322 /* SDL_touch_c.h in Headers */,
  22.139 @@ -1937,7 +1949,7 @@
  22.140  				04BD01F712E6671800899322 /* SDL_x11video.h in Headers */,
  22.141  				04BD01F912E6671800899322 /* SDL_x11window.h in Headers */,
  22.142  				041B2CA612FA0D680087D585 /* SDL_sysrender.h in Headers */,
  22.143 -				04409B9112FA97ED00FB9AA8 /* mmx.h in Headers */,
  22.144 +				AA9A7F161FB0209D00FED37F /* SDL_yuv_c.h in Headers */,
  22.145  				04409B9312FA97ED00FB9AA8 /* SDL_yuv_sw_c.h in Headers */,
  22.146  				04F7803912FB748500FC43C0 /* SDL_nullframebuffer_c.h in Headers */,
  22.147  				04F7804A12FB74A200FC43C0 /* SDL_blendfillrect.h in Headers */,
  22.148 @@ -2094,7 +2106,6 @@
  22.149  				AAC07100195606770073DCDF /* SDL_opengles2_gl2ext.h in Headers */,
  22.150  				04BD041112E6671800899322 /* SDL_x11window.h in Headers */,
  22.151  				041B2CAC12FA0D680087D585 /* SDL_sysrender.h in Headers */,
  22.152 -				04409B9512FA97ED00FB9AA8 /* mmx.h in Headers */,
  22.153  				04409B9712FA97ED00FB9AA8 /* SDL_yuv_sw_c.h in Headers */,
  22.154  				04F7803B12FB748500FC43C0 /* SDL_nullframebuffer_c.h in Headers */,
  22.155  				04F7805612FB74A200FC43C0 /* SDL_blendfillrect.h in Headers */,
  22.156 @@ -2249,7 +2260,6 @@
  22.157  				AAC07101195606770073DCDF /* SDL_opengles2_gl2ext.h in Headers */,
  22.158  				DB313FB717554B71006C0E22 /* SDL_x11window.h in Headers */,
  22.159  				DB313FB817554B71006C0E22 /* SDL_sysrender.h in Headers */,
  22.160 -				DB313FB917554B71006C0E22 /* mmx.h in Headers */,
  22.161  				DB313FBA17554B71006C0E22 /* SDL_yuv_sw_c.h in Headers */,
  22.162  				DB313FBB17554B71006C0E22 /* SDL_nullframebuffer_c.h in Headers */,
  22.163  				DB313FBC17554B71006C0E22 /* SDL_blendfillrect.h in Headers */,
  22.164 @@ -2475,6 +2485,7 @@
  22.165  				04BD00F412E6671800899322 /* SDL_cocoaclipboard.m in Sources */,
  22.166  				04BD00F612E6671800899322 /* SDL_cocoaevents.m in Sources */,
  22.167  				04BD00F812E6671800899322 /* SDL_cocoakeyboard.m in Sources */,
  22.168 +				AA9A7F151FB0209D00FED37F /* SDL_yuv.c in Sources */,
  22.169  				04BD00FA12E6671800899322 /* SDL_cocoamodes.m in Sources */,
  22.170  				4D16644F1EDD6023003DE88E /* SDL_vulkan_utils.c in Sources */,
  22.171  				04BD00FC12E6671800899322 /* SDL_cocoamouse.m in Sources */,
  22.172 @@ -2487,6 +2498,7 @@
  22.173  				04BD017512E6671800899322 /* SDL_blit.c in Sources */,
  22.174  				04BD017712E6671800899322 /* SDL_blit_0.c in Sources */,
  22.175  				04BD017812E6671800899322 /* SDL_blit_1.c in Sources */,
  22.176 +				AA9A7F121FB0206400FED37F /* yuv_rgb.c in Sources */,
  22.177  				04BD017912E6671800899322 /* SDL_blit_A.c in Sources */,
  22.178  				04BD017A12E6671800899322 /* SDL_blit_auto.c in Sources */,
  22.179  				04BD017C12E6671800899322 /* SDL_blit_copy.c in Sources */,
  22.180 @@ -2516,7 +2528,6 @@
  22.181  				04BD01F612E6671800899322 /* SDL_x11video.c in Sources */,
  22.182  				04BD01F812E6671800899322 /* SDL_x11window.c in Sources */,
  22.183  				041B2CA512FA0D680087D585 /* SDL_render.c in Sources */,
  22.184 -				04409B9212FA97ED00FB9AA8 /* SDL_yuv_mmx.c in Sources */,
  22.185  				04409B9412FA97ED00FB9AA8 /* SDL_yuv_sw.c in Sources */,
  22.186  				04F7803A12FB748500FC43C0 /* SDL_nullframebuffer.c in Sources */,
  22.187  				04F7804912FB74A200FC43C0 /* SDL_blendfillrect.c in Sources */,
  22.188 @@ -2641,7 +2652,6 @@
  22.189  				04BD040E12E6671800899322 /* SDL_x11video.c in Sources */,
  22.190  				04BD041012E6671800899322 /* SDL_x11window.c in Sources */,
  22.191  				041B2CAB12FA0D680087D585 /* SDL_render.c in Sources */,
  22.192 -				04409B9612FA97ED00FB9AA8 /* SDL_yuv_mmx.c in Sources */,
  22.193  				04409B9812FA97ED00FB9AA8 /* SDL_yuv_sw.c in Sources */,
  22.194  				04F7803C12FB748500FC43C0 /* SDL_nullframebuffer.c in Sources */,
  22.195  				04F7805512FB74A200FC43C0 /* SDL_blendfillrect.c in Sources */,
  22.196 @@ -2764,7 +2774,6 @@
  22.197  				DB31405617554B71006C0E22 /* SDL_x11video.c in Sources */,
  22.198  				DB31405717554B71006C0E22 /* SDL_x11window.c in Sources */,
  22.199  				DB31405817554B71006C0E22 /* SDL_render.c in Sources */,
  22.200 -				DB31405917554B71006C0E22 /* SDL_yuv_mmx.c in Sources */,
  22.201  				DB31405A17554B71006C0E22 /* SDL_yuv_sw.c in Sources */,
  22.202  				DB31405B17554B71006C0E22 /* SDL_nullframebuffer.c in Sources */,
  22.203  				DB31405C17554B71006C0E22 /* SDL_blendfillrect.c in Sources */,
    23.1 --- a/configure	Sun Nov 12 10:59:05 2017 -0800
    23.2 +++ b/configure	Sun Nov 12 22:51:12 2017 -0800
    23.3 @@ -16874,6 +16874,7 @@
    23.4  SOURCES="$SOURCES $srcdir/src/thread/*.c"
    23.5  SOURCES="$SOURCES $srcdir/src/timer/*.c"
    23.6  SOURCES="$SOURCES $srcdir/src/video/*.c"
    23.7 +SOURCES="$SOURCES $srcdir/src/video/yuv2rgb/*.c"
    23.8  
    23.9  
   23.10  # Check whether --enable-atomic was given.
    24.1 --- a/configure.in	Sun Nov 12 10:59:05 2017 -0800
    24.2 +++ b/configure.in	Sun Nov 12 22:51:12 2017 -0800
    24.3 @@ -343,6 +343,7 @@
    24.4  SOURCES="$SOURCES $srcdir/src/thread/*.c"
    24.5  SOURCES="$SOURCES $srcdir/src/timer/*.c"
    24.6  SOURCES="$SOURCES $srcdir/src/video/*.c"
    24.7 +SOURCES="$SOURCES $srcdir/src/video/yuv2rgb/*.c"
    24.8  
    24.9  dnl Enable/disable various subsystems of the SDL library
   24.10  
    25.1 --- a/include/SDL_surface.h	Sun Nov 12 10:59:05 2017 -0800
    25.2 +++ b/include/SDL_surface.h	Sun Nov 12 22:51:12 2017 -0800
    25.3 @@ -98,6 +98,17 @@
    25.4                                   struct SDL_Surface * dst, SDL_Rect * dstrect);
    25.5  
    25.6  /**
    25.7 + * \brief The formula used for converting between YUV and RGB
    25.8 + */
    25.9 +typedef enum
   25.10 +{
   25.11 +    SDL_YUV_CONVERSION_JPEG,        /**< Full range JPEG */
   25.12 +    SDL_YUV_CONVERSION_BT601,       /**< BT.601 (the default) */
   25.13 +    SDL_YUV_CONVERSION_BT709,       /**< BT.709 */
   25.14 +    SDL_YUV_CONVERSION_AUTOMATIC    /**< BT.601 for SD content, BT.709 for HD content */
   25.15 +} SDL_YUV_CONVERSION_MODE;
   25.16 +
   25.17 +/**
   25.18   *  Allocate and free an RGB surface.
   25.19   *
   25.20   *  If the depth is 4 or 8 bits, an empty palette is allocated for the surface.
   25.21 @@ -509,6 +520,20 @@
   25.22      (SDL_Surface * src, SDL_Rect * srcrect,
   25.23      SDL_Surface * dst, SDL_Rect * dstrect);
   25.24  
   25.25 +/**
   25.26 + *  \brief Set the YUV conversion mode
   25.27 + */
   25.28 +extern DECLSPEC void SDLCALL SDL_SetYUVConversionMode(SDL_YUV_CONVERSION_MODE mode);
   25.29 +
   25.30 +/**
   25.31 + *  \brief Get the YUV conversion mode
   25.32 + */
   25.33 +extern DECLSPEC SDL_YUV_CONVERSION_MODE SDLCALL SDL_GetYUVConversionMode(void);
   25.34 +
   25.35 +/**
   25.36 + *  \brief Get the YUV conversion mode, returning the correct mode for the resolution when the current conversion mode is SDL_YUV_CONVERSION_AUTOMATIC
   25.37 + */
   25.38 +extern DECLSPEC SDL_YUV_CONVERSION_MODE SDLCALL SDL_GetYUVConversionModeForResolution(int width, int height);
   25.39  
   25.40  /* Ends C function definitions when using C++ */
   25.41  #ifdef __cplusplus
    26.1 --- a/src/dynapi/SDL_dynapi_overrides.h	Sun Nov 12 10:59:05 2017 -0800
    26.2 +++ b/src/dynapi/SDL_dynapi_overrides.h	Sun Nov 12 22:51:12 2017 -0800
    26.3 @@ -660,3 +660,6 @@
    26.4  #define SDL_scalbnf SDL_scalbnf_REAL
    26.5  #define SDL_fmod SDL_fmod_REAL
    26.6  #define SDL_fmodf SDL_fmodf_REAL
    26.7 +#define SDL_SetYUVConversionMode SDL_SetYUVConversionMode_REAL
    26.8 +#define SDL_GetYUVConversionMode SDL_GetYUVConversionMode_REAL
    26.9 +#define SDL_GetYUVConversionModeForResolution SDL_GetYUVConversionModeForResolution_REAL
    27.1 --- a/src/dynapi/SDL_dynapi_procs.h	Sun Nov 12 10:59:05 2017 -0800
    27.2 +++ b/src/dynapi/SDL_dynapi_procs.h	Sun Nov 12 22:51:12 2017 -0800
    27.3 @@ -694,3 +694,6 @@
    27.4  SDL_DYNAPI_PROC(float,SDL_scalbnf,(float a, int b),(a,b),return)
    27.5  SDL_DYNAPI_PROC(double,SDL_fmod,(double a, double b),(a,b),return)
    27.6  SDL_DYNAPI_PROC(float,SDL_fmodf,(float a, float b),(a,b),return)
    27.7 +SDL_DYNAPI_PROC(void,SDL_SetYUVConversionMode,(SDL_YUV_CONVERSION_MODE a),(a),)
    27.8 +SDL_DYNAPI_PROC(SDL_YUV_CONVERSION_MODE,SDL_GetYUVConversionMode,(void),(),return)
    27.9 +SDL_DYNAPI_PROC(SDL_YUV_CONVERSION_MODE,SDL_GetYUVConversionModeForResolution,(int a, int b),(a,b),return)
    28.1 --- a/src/render/SDL_yuv_mmx.c	Sun Nov 12 10:59:05 2017 -0800
    28.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    28.3 @@ -1,409 +0,0 @@
    28.4 -/*
    28.5 -  Simple DirectMedia Layer
    28.6 -  Copyright (C) 1997-2017 Sam Lantinga <slouken@libsdl.org>
    28.7 -
    28.8 -  This software is provided 'as-is', without any express or implied
    28.9 -  warranty.  In no event will the authors be held liable for any damages
   28.10 -  arising from the use of this software.
   28.11 -
   28.12 -  Permission is granted to anyone to use this software for any purpose,
   28.13 -  including commercial applications, and to alter it and redistribute it
   28.14 -  freely, subject to the following restrictions:
   28.15 -
   28.16 -  1. The origin of this software must not be misrepresented; you must not
   28.17 -     claim that you wrote the original software. If you use this software
   28.18 -     in a product, an acknowledgment in the product documentation would be
   28.19 -     appreciated but is not required.
   28.20 -  2. Altered source versions must be plainly marked as such, and must not be
   28.21 -     misrepresented as being the original software.
   28.22 -  3. This notice may not be removed or altered from any source distribution.
   28.23 -*/
   28.24 -#include "../SDL_internal.h"
   28.25 -
   28.26 -#include "SDL_yuv_mmx_c.h"
   28.27 -
   28.28 -#ifdef USE_MMX_ASSEMBLY
   28.29 -
   28.30 -#include "SDL_stdinc.h"
   28.31 -
   28.32 -#include "mmx.h"
   28.33 -
   28.34 -/* *INDENT-OFF* */
   28.35 -
   28.36 -static mmx_t MMX_0080w    = { .ud = {0x00800080, 0x00800080} };
   28.37 -static mmx_t MMX_00FFw    = { .ud = {0x00ff00ff, 0x00ff00ff} };
   28.38 -static mmx_t MMX_FF00w    = { .ud = {0xff00ff00, 0xff00ff00} };
   28.39 -
   28.40 -static mmx_t MMX_Ycoeff   = { .uw = {0x004a, 0x004a, 0x004a, 0x004a} };
   28.41 -
   28.42 -static mmx_t MMX_UbluRGB  = { .uw = {0x0072, 0x0072, 0x0072, 0x0072} };
   28.43 -static mmx_t MMX_VredRGB  = { .uw = {0x0059, 0x0059, 0x0059, 0x0059} };
   28.44 -static mmx_t MMX_UgrnRGB  = { .uw = {0xffea, 0xffea, 0xffea, 0xffea} };
   28.45 -static mmx_t MMX_VgrnRGB  = { .uw = {0xffd2, 0xffd2, 0xffd2, 0xffd2} };
   28.46 -
   28.47 -static mmx_t MMX_Ublu5x5  = { .uw = {0x0081, 0x0081, 0x0081, 0x0081} };
   28.48 -static mmx_t MMX_Vred5x5  = { .uw = {0x0066, 0x0066, 0x0066, 0x0066} };
   28.49 -static mmx_t MMX_Ugrn565  = { .uw = {0xffe8, 0xffe8, 0xffe8, 0xffe8} };
   28.50 -static mmx_t MMX_Vgrn565  = { .uw = {0xffcd, 0xffcd, 0xffcd, 0xffcd} };
   28.51 -
   28.52 -static mmx_t MMX_red565   = { .uw = {0xf800, 0xf800, 0xf800, 0xf800} };
   28.53 -static mmx_t MMX_grn565   = { .uw = {0x07e0, 0x07e0, 0x07e0, 0x07e0} };
   28.54 -
   28.55 -/**
   28.56 -   This MMX assembler is my first assembler/MMX program ever.
   28.57 -   Thus it maybe buggy.
   28.58 -   Send patches to:
   28.59 -   mvogt@rhrk.uni-kl.de
   28.60 -
   28.61 -   After it worked fine I have "obfuscated" the code a bit to have
   28.62 -   more parallism in the MMX units. This means I moved
   28.63 -   initilisation around and delayed other instruction.
   28.64 -   Performance measurement did not show that this brought any advantage
   28.65 -   but in theory it _should_ be faster this way.
   28.66 -
   28.67 -   The overall performanve gain to the C based dither was 30%-40%.
   28.68 -   The MMX routine calculates 256bit=8RGB values in each cycle
   28.69 -   (4 for row1 & 4 for row2)
   28.70 -
   28.71 -   The red/green/blue.. coefficents are taken from the mpeg_play
   28.72 -   player. They look nice, but I dont know if you can have
   28.73 -   better values, to avoid integer rounding errors.
   28.74 -
   28.75 -
   28.76 -   IMPORTANT:
   28.77 -   ==========
   28.78 -
   28.79 -   It is a requirement that the cr/cb/lum are 8 byte aligned and
   28.80 -   the out are 16byte aligned or you will/may get segfaults
   28.81 -
   28.82 -*/
   28.83 -
   28.84 -void ColorRGBDitherYV12MMX1X( int *colortab, Uint32 *rgb_2_pix,
   28.85 -                              unsigned char *lum, unsigned char *cr,
   28.86 -                              unsigned char *cb, unsigned char *out,
   28.87 -                              int rows, int cols, int mod )
   28.88 -{
   28.89 -    Uint32 *row1;
   28.90 -    Uint32 *row2;
   28.91 -
   28.92 -    unsigned char* y = lum +cols*rows;    /* Pointer to the end */
   28.93 -    int x = 0;
   28.94 -    row1 = (Uint32 *)out;                 /* 32 bit target */
   28.95 -    row2 = (Uint32 *)out+cols+mod;        /* start of second row */
   28.96 -    mod = (mod+cols+mod)*4;               /* increment for row1 in byte */
   28.97 -
   28.98 -    __asm__ __volatile__ (
   28.99 -        ".align 8\n"
  28.100 -        "1:\n"
  28.101 -
  28.102 -        /* create Cr (result in mm1) */
  28.103 -        "movd (%0),%%mm1\n"   /*         0  0  0  0  v3 v2 v1 v0 */
  28.104 -        "pxor %%mm7,%%mm7\n"      /*         00 00 00 00 00 00 00 00 */
  28.105 -        "movd (%2), %%mm2\n"           /*    0  0  0  0 l3 l2 l1 l0 */
  28.106 -        "punpcklbw %%mm7,%%mm1\n" /*         0  v3 0  v2 00 v1 00 v0 */
  28.107 -        "punpckldq %%mm1,%%mm1\n" /*         00 v1 00 v0 00 v1 00 v0 */
  28.108 -        "psubw %9,%%mm1\n"        /* mm1-128:r1 r1 r0 r0 r1 r1 r0 r0 */
  28.109 -
  28.110 -        /* create Cr_g (result in mm0) */
  28.111 -        "movq %%mm1,%%mm0\n"           /* r1 r1 r0 r0 r1 r1 r0 r0 */
  28.112 -        "pmullw %10,%%mm0\n"           /* red*-46dec=0.7136*64 */
  28.113 -        "pmullw %11,%%mm1\n"           /* red*89dec=1.4013*64 */
  28.114 -        "psraw  $6, %%mm0\n"           /* red=red/64 */
  28.115 -        "psraw  $6, %%mm1\n"           /* red=red/64 */
  28.116 -
  28.117 -        /* create L1 L2 (result in mm2,mm4) */
  28.118 -        /* L2=lum+cols */
  28.119 -        "movq (%2,%4),%%mm3\n"         /*    0  0  0  0 L3 L2 L1 L0 */
  28.120 -        "punpckldq %%mm3,%%mm2\n"      /*   L3 L2 L1 L0 l3 l2 l1 l0 */
  28.121 -        "movq %%mm2,%%mm4\n"           /*   L3 L2 L1 L0 l3 l2 l1 l0 */
  28.122 -        "pand %12,%%mm2\n"             /*   L3 0  L1  0 l3  0 l1  0 */
  28.123 -        "pand %13,%%mm4\n"             /*   0  L2  0 L0  0 l2  0 l0 */
  28.124 -        "psrlw $8,%%mm2\n"             /*   0  L3  0 L1  0 l3  0 l1 */
  28.125 -
  28.126 -        /* create R (result in mm6) */
  28.127 -        "movq %%mm2,%%mm5\n"           /*   0 L3  0 L1  0 l3  0 l1 */
  28.128 -        "movq %%mm4,%%mm6\n"           /*   0 L2  0 L0  0 l2  0 l0 */
  28.129 -        "paddsw  %%mm1, %%mm5\n"       /* lum1+red:x R3 x R1 x r3 x r1 */
  28.130 -        "paddsw  %%mm1, %%mm6\n"       /* lum1+red:x R2 x R0 x r2 x r0 */
  28.131 -        "packuswb %%mm5,%%mm5\n"       /*  R3 R1 r3 r1 R3 R1 r3 r1 */
  28.132 -        "packuswb %%mm6,%%mm6\n"       /*  R2 R0 r2 r0 R2 R0 r2 r0 */
  28.133 -        "pxor %%mm7,%%mm7\n"      /*         00 00 00 00 00 00 00 00 */
  28.134 -        "punpcklbw %%mm5,%%mm6\n"      /*  R3 R2 R1 R0 r3 r2 r1 r0 */
  28.135 -
  28.136 -        /* create Cb (result in mm1) */
  28.137 -        "movd (%1), %%mm1\n"      /*         0  0  0  0  u3 u2 u1 u0 */
  28.138 -        "punpcklbw %%mm7,%%mm1\n" /*         0  u3 0  u2 00 u1 00 u0 */
  28.139 -        "punpckldq %%mm1,%%mm1\n" /*         00 u1 00 u0 00 u1 00 u0 */
  28.140 -        "psubw %9,%%mm1\n"        /* mm1-128:u1 u1 u0 u0 u1 u1 u0 u0 */
  28.141 -
  28.142 -        /* create Cb_g (result in mm5) */
  28.143 -        "movq %%mm1,%%mm5\n"            /* u1 u1 u0 u0 u1 u1 u0 u0 */
  28.144 -        "pmullw %14,%%mm5\n"            /* blue*-109dec=1.7129*64 */
  28.145 -        "pmullw %15,%%mm1\n"            /* blue*114dec=1.78125*64 */
  28.146 -        "psraw  $6, %%mm5\n"            /* blue=red/64 */
  28.147 -        "psraw  $6, %%mm1\n"            /* blue=blue/64 */
  28.148 -
  28.149 -        /* create G (result in mm7) */
  28.150 -        "movq %%mm2,%%mm3\n"      /*   0  L3  0 L1  0 l3  0 l1 */
  28.151 -        "movq %%mm4,%%mm7\n"      /*   0  L2  0 L0  0 l2  0 l1 */
  28.152 -        "paddsw  %%mm5, %%mm3\n"  /* lum1+Cb_g:x G3t x G1t x g3t x g1t */
  28.153 -        "paddsw  %%mm5, %%mm7\n"  /* lum1+Cb_g:x G2t x G0t x g2t x g0t */
  28.154 -        "paddsw  %%mm0, %%mm3\n"  /* lum1+Cr_g:x G3  x G1  x g3  x g1 */
  28.155 -        "paddsw  %%mm0, %%mm7\n"  /* lum1+blue:x G2  x G0  x g2  x g0 */
  28.156 -        "packuswb %%mm3,%%mm3\n"  /* G3 G1 g3 g1 G3 G1 g3 g1 */
  28.157 -        "packuswb %%mm7,%%mm7\n"  /* G2 G0 g2 g0 G2 G0 g2 g0 */
  28.158 -        "punpcklbw %%mm3,%%mm7\n" /* G3 G2 G1 G0 g3 g2 g1 g0 */
  28.159 -
  28.160 -        /* create B (result in mm5) */
  28.161 -        "movq %%mm2,%%mm3\n"         /*   0  L3  0 L1  0 l3  0 l1 */
  28.162 -        "movq %%mm4,%%mm5\n"         /*   0  L2  0 L0  0 l2  0 l1 */
  28.163 -        "paddsw  %%mm1, %%mm3\n"     /* lum1+blue:x B3 x B1 x b3 x b1 */
  28.164 -        "paddsw  %%mm1, %%mm5\n"     /* lum1+blue:x B2 x B0 x b2 x b0 */
  28.165 -        "packuswb %%mm3,%%mm3\n"     /* B3 B1 b3 b1 B3 B1 b3 b1 */
  28.166 -        "packuswb %%mm5,%%mm5\n"     /* B2 B0 b2 b0 B2 B0 b2 b0 */
  28.167 -        "punpcklbw %%mm3,%%mm5\n"    /* B3 B2 B1 B0 b3 b2 b1 b0 */
  28.168 -
  28.169 -        /* fill destination row1 (needed are mm6=Rr,mm7=Gg,mm5=Bb) */
  28.170 -
  28.171 -        "pxor %%mm2,%%mm2\n"           /*  0  0  0  0  0  0  0  0 */
  28.172 -        "pxor %%mm4,%%mm4\n"           /*  0  0  0  0  0  0  0  0 */
  28.173 -        "movq %%mm6,%%mm1\n"           /* R3 R2 R1 R0 r3 r2 r1 r0 */
  28.174 -        "movq %%mm5,%%mm3\n"           /* B3 B2 B1 B0 b3 b2 b1 b0 */
  28.175 -
  28.176 -        /* process lower lum */
  28.177 -        "punpcklbw %%mm4,%%mm1\n"      /*  0 r3  0 r2  0 r1  0 r0 */
  28.178 -        "punpcklbw %%mm4,%%mm3\n"      /*  0 b3  0 b2  0 b1  0 b0 */
  28.179 -        "movq %%mm1,%%mm2\n"           /*  0 r3  0 r2  0 r1  0 r0 */
  28.180 -        "movq %%mm3,%%mm0\n"           /*  0 b3  0 b2  0 b1  0 b0 */
  28.181 -        "punpcklwd %%mm1,%%mm3\n"      /*  0 r1  0 b1  0 r0  0 b0 */
  28.182 -        "punpckhwd %%mm2,%%mm0\n"      /*  0 r3  0 b3  0 r2  0 b2 */
  28.183 -
  28.184 -        "pxor %%mm2,%%mm2\n"           /*  0  0  0  0  0  0  0  0 */
  28.185 -        "movq %%mm7,%%mm1\n"           /* G3 G2 G1 G0 g3 g2 g1 g0 */
  28.186 -        "punpcklbw %%mm1,%%mm2\n"      /* g3  0 g2  0 g1  0 g0  0 */
  28.187 -        "punpcklwd %%mm4,%%mm2\n"      /*  0  0 g1  0  0  0 g0  0 */
  28.188 -        "por %%mm3, %%mm2\n"          /*  0 r1 g1 b1  0 r0 g0 b0 */
  28.189 -        "movq %%mm2,(%3)\n"          /* wrote out ! row1 */
  28.190 -
  28.191 -        "pxor %%mm2,%%mm2\n"           /*  0  0  0  0  0  0  0  0 */
  28.192 -        "punpcklbw %%mm1,%%mm4\n"      /* g3  0 g2  0 g1  0 g0  0 */
  28.193 -        "punpckhwd %%mm2,%%mm4\n"      /*  0  0 g3  0  0  0 g2  0 */
  28.194 -        "por %%mm0, %%mm4\n"          /*  0 r3 g3 b3  0 r2 g2 b2 */
  28.195 -        "movq %%mm4,8(%3)\n"         /* wrote out ! row1 */
  28.196 -
  28.197 -        /* fill destination row2 (needed are mm6=Rr,mm7=Gg,mm5=Bb) */
  28.198 -        /* this can be done "destructive" */
  28.199 -        "pxor %%mm2,%%mm2\n"           /*  0  0  0  0  0  0  0  0 */
  28.200 -        "punpckhbw %%mm2,%%mm6\n"      /*  0 R3  0 R2  0 R1  0 R0 */
  28.201 -        "punpckhbw %%mm1,%%mm5\n"      /* G3 B3 G2 B2 G1 B1 G0 B0 */
  28.202 -        "movq %%mm5,%%mm1\n"           /* G3 B3 G2 B2 G1 B1 G0 B0 */
  28.203 -        "punpcklwd %%mm6,%%mm1\n"      /*  0 R1 G1 B1  0 R0 G0 B0 */
  28.204 -        "movq %%mm1,(%5)\n"          /* wrote out ! row2 */
  28.205 -        "punpckhwd %%mm6,%%mm5\n"      /*  0 R3 G3 B3  0 R2 G2 B2 */
  28.206 -        "movq %%mm5,8(%5)\n"         /* wrote out ! row2 */
  28.207 -
  28.208 -        "addl $4,%2\n"            /* lum+4 */
  28.209 -        "leal 16(%3),%3\n"        /* row1+16 */
  28.210 -        "leal 16(%5),%5\n"        /* row2+16 */
  28.211 -        "addl $2,%0\n"        /* cr+2 */
  28.212 -        "addl $2,%1\n"           /* cb+2 */
  28.213 -
  28.214 -        "addl $4,%6\n"            /* x+4 */
  28.215 -        "cmpl %4,%6\n"
  28.216 -
  28.217 -        "jl 1b\n"
  28.218 -        "addl %4,%2\n" /* lum += cols */
  28.219 -        "addl %8,%3\n" /* row1+= mod */
  28.220 -        "addl %8,%5\n" /* row2+= mod */
  28.221 -        "movl $0,%6\n" /* x=0 */
  28.222 -        "cmpl %7,%2\n"
  28.223 -        "jl 1b\n"
  28.224 -
  28.225 -        "emms\n"  /* reset MMX registers. */
  28.226 -        :
  28.227 -        : "r" (cr), "r"(cb),"r"(lum),
  28.228 -          "r"(row1),"r"(cols),"r"(row2),"m"(x),"m"(y),"m"(mod),
  28.229 -          "m"(MMX_0080w),"m"(MMX_VgrnRGB),"m"(MMX_VredRGB),
  28.230 -          "m"(MMX_FF00w),"m"(MMX_00FFw),"m"(MMX_UgrnRGB),
  28.231 -          "m"(MMX_UbluRGB)
  28.232 -    );
  28.233 -}
  28.234 -
  28.235 -void Color565DitherYV12MMX1X( int *colortab, Uint32 *rgb_2_pix,
  28.236 -                             unsigned char *lum, unsigned char *cr,
  28.237 -                             unsigned char *cb, unsigned char *out,
  28.238 -                             int rows, int cols, int mod )
  28.239 -{
  28.240 -    Uint16 *row1;
  28.241 -    Uint16 *row2;
  28.242 -
  28.243 -    unsigned char* y = lum +cols*rows;    /* Pointer to the end */
  28.244 -    int x = 0;
  28.245 -    row1 = (Uint16 *)out;                 /* 16 bit target */
  28.246 -    row2 = (Uint16 *)out+cols+mod;        /* start of second row  */
  28.247 -    mod = (mod+cols+mod)*2;               /* increment for row1 in byte */
  28.248 -
  28.249 -    __asm__ __volatile__(
  28.250 -        ".align 8\n"
  28.251 -        "1:\n"
  28.252 -
  28.253 -        "movd           (%1),                   %%mm0\n" /* 4 Cb         0  0  0  0 u3 u2 u1 u0 */
  28.254 -        "pxor           %%mm7,                  %%mm7\n"
  28.255 -        "movd (%0), %%mm1\n"   /* 4 Cr                0  0  0  0 v3 v2 v1 v0 */
  28.256 -
  28.257 -        "punpcklbw      %%mm7,                  %%mm0\n" /* 4 W cb   0 u3  0 u2  0 u1  0 u0 */
  28.258 -        "punpcklbw      %%mm7,                  %%mm1\n" /* 4 W cr   0 v3  0 v2  0 v1  0 v0 */
  28.259 -        "psubw          %9,                     %%mm0\n"
  28.260 -        "psubw          %9,                     %%mm1\n"
  28.261 -        "movq           %%mm0,                  %%mm2\n" /* Cb                   0 u3  0 u2  0 u1  0 u0 */
  28.262 -        "movq           %%mm1,                  %%mm3\n" /* Cr */
  28.263 -        "pmullw         %10,                    %%mm2\n" /* Cb2green 0 R3  0 R2  0 R1  0 R0 */
  28.264 -        "movq           (%2),                   %%mm6\n" /* L1      l7 L6 L5 L4 L3 L2 L1 L0 */
  28.265 -        "pmullw         %11,                    %%mm0\n" /* Cb2blue */
  28.266 -        "pand           %12,                    %%mm6\n" /* L1      00 L6 00 L4 00 L2 00 L0 */
  28.267 -        "pmullw         %13,                    %%mm3\n" /* Cr2green */
  28.268 -        "movq           (%2),                   %%mm7\n" /* L2 */
  28.269 -        "pmullw         %14,                    %%mm1\n" /* Cr2red */
  28.270 -        "psrlw          $8,                     %%mm7\n"        /* L2           00 L7 00 L5 00 L3 00 L1 */
  28.271 -        "pmullw         %15,                    %%mm6\n" /* lum1 */
  28.272 -        "paddw          %%mm3,                  %%mm2\n" /* Cb2green + Cr2green == green */
  28.273 -        "pmullw         %15,                    %%mm7\n" /* lum2 */
  28.274 -
  28.275 -        "movq           %%mm6,                  %%mm4\n" /* lum1 */
  28.276 -        "paddw          %%mm0,                  %%mm6\n" /* lum1 +blue 00 B6 00 B4 00 B2 00 B0 */
  28.277 -        "movq           %%mm4,                  %%mm5\n" /* lum1 */
  28.278 -        "paddw          %%mm1,                  %%mm4\n" /* lum1 +red  00 R6 00 R4 00 R2 00 R0 */
  28.279 -        "paddw          %%mm2,                  %%mm5\n" /* lum1 +green 00 G6 00 G4 00 G2 00 G0 */
  28.280 -        "psraw          $6,                     %%mm4\n" /* R1 0 .. 64 */
  28.281 -        "movq           %%mm7,                  %%mm3\n" /* lum2                       00 L7 00 L5 00 L3 00 L1 */
  28.282 -        "psraw          $6,                     %%mm5\n" /* G1  - .. + */
  28.283 -        "paddw          %%mm0,                  %%mm7\n" /* Lum2 +blue 00 B7 00 B5 00 B3 00 B1 */
  28.284 -        "psraw          $6,                     %%mm6\n" /* B1         0 .. 64 */
  28.285 -        "packuswb       %%mm4,                  %%mm4\n" /* R1 R1 */
  28.286 -        "packuswb       %%mm5,                  %%mm5\n" /* G1 G1 */
  28.287 -        "packuswb       %%mm6,                  %%mm6\n" /* B1 B1 */
  28.288 -        "punpcklbw      %%mm4,                  %%mm4\n"
  28.289 -        "punpcklbw      %%mm5,                  %%mm5\n"
  28.290 -
  28.291 -        "pand           %16,                    %%mm4\n"
  28.292 -        "psllw          $3,                     %%mm5\n" /* GREEN       1 */
  28.293 -        "punpcklbw      %%mm6,                  %%mm6\n"
  28.294 -        "pand           %17,                    %%mm5\n"
  28.295 -        "pand           %16,                    %%mm6\n"
  28.296 -        "por            %%mm5,                  %%mm4\n" /* */
  28.297 -        "psrlw          $11,                    %%mm6\n" /* BLUE        1 */
  28.298 -        "movq           %%mm3,                  %%mm5\n" /* lum2 */
  28.299 -        "paddw          %%mm1,                  %%mm3\n" /* lum2 +red      00 R7 00 R5 00 R3 00 R1 */
  28.300 -        "paddw          %%mm2,                  %%mm5\n" /* lum2 +green 00 G7 00 G5 00 G3 00 G1 */
  28.301 -        "psraw          $6,                     %%mm3\n" /* R2 */
  28.302 -        "por            %%mm6,                  %%mm4\n" /* MM4 */
  28.303 -        "psraw          $6,                     %%mm5\n" /* G2 */
  28.304 -        "movq           (%2, %4),               %%mm6\n" /* L3 load lum2 */
  28.305 -        "psraw          $6,                     %%mm7\n"
  28.306 -        "packuswb       %%mm3,                  %%mm3\n"
  28.307 -        "packuswb       %%mm5,                  %%mm5\n"
  28.308 -        "packuswb       %%mm7,                  %%mm7\n"
  28.309 -        "pand           %12,                    %%mm6\n" /* L3 */
  28.310 -        "punpcklbw      %%mm3,                  %%mm3\n"
  28.311 -        "punpcklbw      %%mm5,                  %%mm5\n"
  28.312 -        "pmullw         %15,                    %%mm6\n" /* lum3 */
  28.313 -        "punpcklbw      %%mm7,                  %%mm7\n"
  28.314 -        "psllw          $3,                     %%mm5\n" /* GREEN 2 */
  28.315 -        "pand           %16,                    %%mm7\n"
  28.316 -        "pand           %16,                    %%mm3\n"
  28.317 -        "psrlw          $11,                    %%mm7\n" /* BLUE  2 */
  28.318 -        "pand           %17,                    %%mm5\n"
  28.319 -        "por            %%mm7,                  %%mm3\n"
  28.320 -        "movq           (%2,%4),                %%mm7\n" /* L4 load lum2 */
  28.321 -        "por            %%mm5,                  %%mm3\n"
  28.322 -        "psrlw          $8,                     %%mm7\n" /* L4 */
  28.323 -        "movq           %%mm4,                  %%mm5\n"
  28.324 -        "punpcklwd      %%mm3,                  %%mm4\n"
  28.325 -        "pmullw         %15,                    %%mm7\n" /* lum4 */
  28.326 -        "punpckhwd      %%mm3,                  %%mm5\n"
  28.327 -
  28.328 -        "movq           %%mm4,                  (%3)\n"  /* write row1 */
  28.329 -        "movq           %%mm5,                  8(%3)\n" /* write row1 */
  28.330 -
  28.331 -        "movq           %%mm6,                  %%mm4\n" /* Lum3 */
  28.332 -        "paddw          %%mm0,                  %%mm6\n" /* Lum3 +blue */
  28.333 -
  28.334 -        "movq           %%mm4,                  %%mm5\n" /* Lum3 */
  28.335 -        "paddw          %%mm1,                  %%mm4\n" /* Lum3 +red */
  28.336 -        "paddw          %%mm2,                  %%mm5\n" /* Lum3 +green */
  28.337 -        "psraw          $6,                     %%mm4\n"
  28.338 -        "movq           %%mm7,                  %%mm3\n" /* Lum4 */
  28.339 -        "psraw          $6,                     %%mm5\n"
  28.340 -        "paddw          %%mm0,                  %%mm7\n" /* Lum4 +blue */
  28.341 -        "psraw          $6,                     %%mm6\n" /* Lum3 +blue */
  28.342 -        "movq           %%mm3,                  %%mm0\n" /* Lum4 */
  28.343 -        "packuswb       %%mm4,                  %%mm4\n"
  28.344 -        "paddw          %%mm1,                  %%mm3\n" /* Lum4 +red */
  28.345 -        "packuswb       %%mm5,                  %%mm5\n"
  28.346 -        "paddw          %%mm2,                  %%mm0\n" /* Lum4 +green */
  28.347 -        "packuswb       %%mm6,                  %%mm6\n"
  28.348 -        "punpcklbw      %%mm4,                  %%mm4\n"
  28.349 -        "punpcklbw      %%mm5,                  %%mm5\n"
  28.350 -        "punpcklbw      %%mm6,                  %%mm6\n"
  28.351 -        "psllw          $3,                     %%mm5\n" /* GREEN 3 */
  28.352 -        "pand           %16,                    %%mm4\n"
  28.353 -        "psraw          $6,                     %%mm3\n" /* psr 6 */
  28.354 -        "psraw          $6,                     %%mm0\n"
  28.355 -        "pand           %16,                    %%mm6\n" /* BLUE */
  28.356 -        "pand           %17,                    %%mm5\n"
  28.357 -        "psrlw          $11,                    %%mm6\n" /* BLUE  3 */
  28.358 -        "por            %%mm5,                  %%mm4\n"
  28.359 -        "psraw          $6,                     %%mm7\n"
  28.360 -        "por            %%mm6,                  %%mm4\n"
  28.361 -        "packuswb       %%mm3,                  %%mm3\n"
  28.362 -        "packuswb       %%mm0,                  %%mm0\n"
  28.363 -        "packuswb       %%mm7,                  %%mm7\n"
  28.364 -        "punpcklbw      %%mm3,                  %%mm3\n"
  28.365 -        "punpcklbw      %%mm0,                  %%mm0\n"
  28.366 -        "punpcklbw      %%mm7,                  %%mm7\n"
  28.367 -        "pand           %16,                    %%mm3\n"
  28.368 -        "pand           %16,                    %%mm7\n" /* BLUE */
  28.369 -        "psllw          $3,                     %%mm0\n" /* GREEN 4 */
  28.370 -        "psrlw          $11,                    %%mm7\n"
  28.371 -        "pand           %17,                    %%mm0\n"
  28.372 -        "por            %%mm7,                  %%mm3\n"
  28.373 -        "por            %%mm0,                  %%mm3\n"
  28.374 -
  28.375 -        "movq           %%mm4,                  %%mm5\n"
  28.376 -
  28.377 -        "punpcklwd      %%mm3,                  %%mm4\n"
  28.378 -        "punpckhwd      %%mm3,                  %%mm5\n"
  28.379 -
  28.380 -        "movq           %%mm4,                  (%5)\n"
  28.381 -        "movq           %%mm5,                  8(%5)\n"
  28.382 -
  28.383 -        "addl           $8,                     %6\n"
  28.384 -        "addl           $8,                     %2\n"
  28.385 -        "addl           $4,                     %0\n"
  28.386 -        "addl           $4,                     %1\n"
  28.387 -        "cmpl           %4,                     %6\n"
  28.388 -        "leal           16(%3),                 %3\n"
  28.389 -        "leal           16(%5),%5\n" /* row2+16 */
  28.390 -
  28.391 -        "jl             1b\n"
  28.392 -        "addl           %4,     %2\n" /* lum += cols */
  28.393 -        "addl           %8,     %3\n" /* row1+= mod */
  28.394 -        "addl           %8,     %5\n" /* row2+= mod */
  28.395 -        "movl           $0,     %6\n" /* x=0 */
  28.396 -        "cmpl           %7,     %2\n"
  28.397 -        "jl             1b\n"
  28.398 -        "emms\n"
  28.399 -        :
  28.400 -        : "r" (cr), "r"(cb),"r"(lum),
  28.401 -          "r"(row1),"r"(cols),"r"(row2),"m"(x),"m"(y),"m"(mod),
  28.402 -          "m"(MMX_0080w),"m"(MMX_Ugrn565),"m"(MMX_Ublu5x5),
  28.403 -          "m"(MMX_00FFw),"m"(MMX_Vgrn565),"m"(MMX_Vred5x5),
  28.404 -          "m"(MMX_Ycoeff),"m"(MMX_red565),"m"(MMX_grn565)
  28.405 -    );
  28.406 -}
  28.407 -
  28.408 -/* *INDENT-ON* */
  28.409 -
  28.410 -#endif /* USE_MMX_ASSEMBLY */
  28.411 -
  28.412 -/* vi: set ts=4 sw=4 expandtab: */
    29.1 --- a/src/render/SDL_yuv_mmx_c.h	Sun Nov 12 10:59:05 2017 -0800
    29.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    29.3 @@ -1,28 +0,0 @@
    29.4 -/*
    29.5 -  Simple DirectMedia Layer
    29.6 -  Copyright (C) 1997-2017 Sam Lantinga <slouken@libsdl.org>
    29.7 -
    29.8 -  This software is provided 'as-is', without any express or implied
    29.9 -  warranty.  In no event will the authors be held liable for any damages
   29.10 -  arising from the use of this software.
   29.11 -
   29.12 -  Permission is granted to anyone to use this software for any purpose,
   29.13 -  including commercial applications, and to alter it and redistribute it
   29.14 -  freely, subject to the following restrictions:
   29.15 -
   29.16 -  1. The origin of this software must not be misrepresented; you must not
   29.17 -     claim that you wrote the original software. If you use this software
   29.18 -     in a product, an acknowledgment in the product documentation would be
   29.19 -     appreciated but is not required.
   29.20 -  2. Altered source versions must be plainly marked as such, and must not be
   29.21 -     misrepresented as being the original software.
   29.22 -  3. This notice may not be removed or altered from any source distribution.
   29.23 -*/
   29.24 -#include "../SDL_internal.h"
   29.25 -
   29.26 -/* FIXME: This breaks on various versions of GCC and should be rewritten using intrinsics */
   29.27 -#if 0 /* (__GNUC__ > 2) && defined(__i386__) && __OPTIMIZE__ && SDL_ASSEMBLY_ROUTINES && !defined(__clang__) */
   29.28 -#define USE_MMX_ASSEMBLY 1
   29.29 -#endif
   29.30 -
   29.31 -/* vi: set ts=4 sw=4 expandtab: */
    30.1 --- a/src/render/SDL_yuv_sw.c	Sun Nov 12 10:59:05 2017 -0800
    30.2 +++ b/src/render/SDL_yuv_sw.c	Sun Nov 12 22:51:12 2017 -0800
    30.3 @@ -22,1058 +22,15 @@
    30.4  
    30.5  /* This is the software implementation of the YUV texture support */
    30.6  
    30.7 -/* This code was derived from code carrying the following copyright notices:
    30.8 +#include "SDL_assert.h"
    30.9  
   30.10 - * Copyright (c) 1995 The Regents of the University of California.
   30.11 - * All rights reserved.
   30.12 - *
   30.13 - * Permission to use, copy, modify, and distribute this software and its
   30.14 - * documentation for any purpose, without fee, and without written agreement is
   30.15 - * hereby granted, provided that the above copyright notice and the following
   30.16 - * two paragraphs appear in all copies of this software.
   30.17 - *
   30.18 - * IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR
   30.19 - * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT
   30.20 - * OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF
   30.21 - * CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
   30.22 - *
   30.23 - * THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES,
   30.24 - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
   30.25 - * AND FITNESS FOR A PARTICULAR PURPOSE.  THE SOFTWARE PROVIDED HEREUNDER IS
   30.26 - * ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO
   30.27 - * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
   30.28 +#include "SDL_yuv_sw_c.h"
   30.29  
   30.30 - * Copyright (c) 1995 Erik Corry
   30.31 - * All rights reserved.
   30.32 - *
   30.33 - * Permission to use, copy, modify, and distribute this software and its
   30.34 - * documentation for any purpose, without fee, and without written agreement is
   30.35 - * hereby granted, provided that the above copyright notice and the following
   30.36 - * two paragraphs appear in all copies of this software.
   30.37 - *
   30.38 - * IN NO EVENT SHALL ERIK CORRY BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT,
   30.39 - * SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OF
   30.40 - * THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF ERIK CORRY HAS BEEN ADVISED
   30.41 - * OF THE POSSIBILITY OF SUCH DAMAGE.
   30.42 - *
   30.43 - * ERIK CORRY SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, BUT NOT
   30.44 - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
   30.45 - * PARTICULAR PURPOSE.  THE SOFTWARE PROVIDED HEREUNDER IS ON AN "AS IS"
   30.46 - * BASIS, AND ERIK CORRY HAS NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT,
   30.47 - * UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
   30.48 -
   30.49 - * Portions of this software Copyright (c) 1995 Brown University.
   30.50 - * All rights reserved.
   30.51 - *
   30.52 - * Permission to use, copy, modify, and distribute this software and its
   30.53 - * documentation for any purpose, without fee, and without written agreement
   30.54 - * is hereby granted, provided that the above copyright notice and the
   30.55 - * following two paragraphs appear in all copies of this software.
   30.56 - *
   30.57 - * IN NO EVENT SHALL BROWN UNIVERSITY BE LIABLE TO ANY PARTY FOR
   30.58 - * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT
   30.59 - * OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF BROWN
   30.60 - * UNIVERSITY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
   30.61 - *
   30.62 - * BROWN UNIVERSITY SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, BUT NOT
   30.63 - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
   30.64 - * PARTICULAR PURPOSE.  THE SOFTWARE PROVIDED HEREUNDER IS ON AN "AS IS"
   30.65 - * BASIS, AND BROWN UNIVERSITY HAS NO OBLIGATION TO PROVIDE MAINTENANCE,
   30.66 - * SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
   30.67 - */
   30.68 -
   30.69 -#include "SDL_assert.h"
   30.70 -#include "SDL_video.h"
   30.71 -#include "SDL_cpuinfo.h"
   30.72 -#include "SDL_yuv_sw_c.h"
   30.73 -#include "SDL_yuv_mmx_c.h"
   30.74 -
   30.75 -
   30.76 -/* The colorspace conversion functions */
   30.77 -
   30.78 -#ifdef USE_MMX_ASSEMBLY
   30.79 -extern void Color565DitherYV12MMX1X(int *colortab, Uint32 * rgb_2_pix,
   30.80 -                                    unsigned char *lum, unsigned char *cr,
   30.81 -                                    unsigned char *cb, unsigned char *out,
   30.82 -                                    int rows, int cols, int mod);
   30.83 -extern void ColorRGBDitherYV12MMX1X(int *colortab, Uint32 * rgb_2_pix,
   30.84 -                                    unsigned char *lum, unsigned char *cr,
   30.85 -                                    unsigned char *cb, unsigned char *out,
   30.86 -                                    int rows, int cols, int mod);
   30.87 -#endif
   30.88 -
   30.89 -static void
   30.90 -Color16DitherYV12Mod1X(int *colortab, Uint32 * rgb_2_pix,
   30.91 -                       unsigned char *lum, unsigned char *cr,
   30.92 -                       unsigned char *cb, unsigned char *out,
   30.93 -                       int rows, int cols, int mod)
   30.94 -{
   30.95 -    unsigned short *row1;
   30.96 -    unsigned short *row2;
   30.97 -    unsigned char *lum2;
   30.98 -    int x, y;
   30.99 -    int cr_r;
  30.100 -    int crb_g;
  30.101 -    int cb_b;
  30.102 -    int cols_2 = cols / 2;
  30.103 -
  30.104 -    row1 = (unsigned short *) out;
  30.105 -    row2 = row1 + cols + mod;
  30.106 -    lum2 = lum + cols;
  30.107 -
  30.108 -    mod += cols + mod;
  30.109 -
  30.110 -    y = rows / 2;
  30.111 -    while (y--) {
  30.112 -        x = cols_2;
  30.113 -        while (x--) {
  30.114 -            register int L;
  30.115 -
  30.116 -            cr_r = 0 * 768 + 256 + colortab[*cr + 0 * 256];
  30.117 -            crb_g = 1 * 768 + 256 + colortab[*cr + 1 * 256]
  30.118 -                + colortab[*cb + 2 * 256];
  30.119 -            cb_b = 2 * 768 + 256 + colortab[*cb + 3 * 256];
  30.120 -            ++cr;
  30.121 -            ++cb;
  30.122 -
  30.123 -            L = *lum++;
  30.124 -            *row1++ = (unsigned short) (rgb_2_pix[L + cr_r] |
  30.125 -                                        rgb_2_pix[L + crb_g] |
  30.126 -                                        rgb_2_pix[L + cb_b]);
  30.127 -
  30.128 -            L = *lum++;
  30.129 -            *row1++ = (unsigned short) (rgb_2_pix[L + cr_r] |
  30.130 -                                        rgb_2_pix[L + crb_g] |
  30.131 -                                        rgb_2_pix[L + cb_b]);
  30.132 -
  30.133 -
  30.134 -            /* Now, do second row.  */
  30.135 -
  30.136 -            L = *lum2++;
  30.137 -            *row2++ = (unsigned short) (rgb_2_pix[L + cr_r] |
  30.138 -                                        rgb_2_pix[L + crb_g] |
  30.139 -                                        rgb_2_pix[L + cb_b]);
  30.140 -
  30.141 -            L = *lum2++;
  30.142 -            *row2++ = (unsigned short) (rgb_2_pix[L + cr_r] |
  30.143 -                                        rgb_2_pix[L + crb_g] |
  30.144 -                                        rgb_2_pix[L + cb_b]);
  30.145 -        }
  30.146 -
  30.147 -        /*
  30.148 -         * These values are at the start of the next line, (due
  30.149 -         * to the ++'s above),but they need to be at the start
  30.150 -         * of the line after that.
  30.151 -         */
  30.152 -        lum += cols;
  30.153 -        lum2 += cols;
  30.154 -        row1 += mod;
  30.155 -        row2 += mod;
  30.156 -    }
  30.157 -}
  30.158 -
  30.159 -static void
  30.160 -Color24DitherYV12Mod1X(int *colortab, Uint32 * rgb_2_pix,
  30.161 -                       unsigned char *lum, unsigned char *cr,
  30.162 -                       unsigned char *cb, unsigned char *out,
  30.163 -                       int rows, int cols, int mod)
  30.164 -{
  30.165 -    unsigned int value;
  30.166 -    unsigned char *row1;
  30.167 -    unsigned char *row2;
  30.168 -    unsigned char *lum2;
  30.169 -    int x, y;
  30.170 -    int cr_r;
  30.171 -    int crb_g;
  30.172 -    int cb_b;
  30.173 -    int cols_2 = cols / 2;
  30.174 -
  30.175 -    row1 = out;
  30.176 -    row2 = row1 + cols * 3 + mod * 3;
  30.177 -    lum2 = lum + cols;
  30.178 -
  30.179 -    mod += cols + mod;
  30.180 -    mod *= 3;
  30.181 -
  30.182 -    y = rows / 2;
  30.183 -    while (y--) {
  30.184 -        x = cols_2;
  30.185 -        while (x--) {
  30.186 -            register int L;
  30.187 -
  30.188 -            cr_r = 0 * 768 + 256 + colortab[*cr + 0 * 256];
  30.189 -            crb_g = 1 * 768 + 256 + colortab[*cr + 1 * 256]
  30.190 -                + colortab[*cb + 2 * 256];
  30.191 -            cb_b = 2 * 768 + 256 + colortab[*cb + 3 * 256];
  30.192 -            ++cr;
  30.193 -            ++cb;
  30.194 -
  30.195 -            L = *lum++;
  30.196 -            value = (rgb_2_pix[L + cr_r] |
  30.197 -                     rgb_2_pix[L + crb_g] | rgb_2_pix[L + cb_b]);
  30.198 -            *row1++ = (value) & 0xFF;
  30.199 -            *row1++ = (value >> 8) & 0xFF;
  30.200 -            *row1++ = (value >> 16) & 0xFF;
  30.201 -
  30.202 -            L = *lum++;
  30.203 -            value = (rgb_2_pix[L + cr_r] |
  30.204 -                     rgb_2_pix[L + crb_g] | rgb_2_pix[L + cb_b]);
  30.205 -            *row1++ = (value) & 0xFF;
  30.206 -            *row1++ = (value >> 8) & 0xFF;
  30.207 -            *row1++ = (value >> 16) & 0xFF;
  30.208 -
  30.209 -
  30.210 -            /* Now, do second row.  */
  30.211 -
  30.212 -            L = *lum2++;
  30.213 -            value = (rgb_2_pix[L + cr_r] |
  30.214 -                     rgb_2_pix[L + crb_g] | rgb_2_pix[L + cb_b]);
  30.215 -            *row2++ = (value) & 0xFF;
  30.216 -            *row2++ = (value >> 8) & 0xFF;
  30.217 -            *row2++ = (value >> 16) & 0xFF;
  30.218 -
  30.219 -            L = *lum2++;
  30.220 -            value = (rgb_2_pix[L + cr_r] |
  30.221 -                     rgb_2_pix[L + crb_g] | rgb_2_pix[L + cb_b]);
  30.222 -            *row2++ = (value) & 0xFF;
  30.223 -            *row2++ = (value >> 8) & 0xFF;
  30.224 -            *row2++ = (value >> 16) & 0xFF;
  30.225 -        }
  30.226 -
  30.227 -        /*
  30.228 -         * These values are at the start of the next line, (due
  30.229 -         * to the ++'s above),but they need to be at the start
  30.230 -         * of the line after that.
  30.231 -         */
  30.232 -        lum += cols;
  30.233 -        lum2 += cols;
  30.234 -        row1 += mod;
  30.235 -        row2 += mod;
  30.236 -    }
  30.237 -}
  30.238 -
  30.239 -static void
  30.240 -Color32DitherYV12Mod1X(int *colortab, Uint32 * rgb_2_pix,
  30.241 -                       unsigned char *lum, unsigned char *cr,
  30.242 -                       unsigned char *cb, unsigned char *out,
  30.243 -                       int rows, int cols, int mod)
  30.244 -{
  30.245 -    unsigned int *row1;
  30.246 -    unsigned int *row2;
  30.247 -    unsigned char *lum2;
  30.248 -    int x, y;
  30.249 -    int cr_r;
  30.250 -    int crb_g;
  30.251 -    int cb_b;
  30.252 -    int cols_2 = (cols + 1) / 2;
  30.253 -    /* not even dimensions */
  30.254 -    int skip_last_col = 0;
  30.255 -    int skip_last_row = 0;
  30.256 -
  30.257 -    if ( (cols & 0x1) ) {
  30.258 -        skip_last_col = 1;
  30.259 -    }
  30.260 -
  30.261 -    if ( (rows & 0x1) ) {
  30.262 -        skip_last_row = 1;
  30.263 -    }
  30.264 -
  30.265 -    row1 = (unsigned int *) out;
  30.266 -    row2 = row1 + cols + mod;
  30.267 -    lum2 = lum + cols;
  30.268 -
  30.269 -    mod += cols + mod;
  30.270 -
  30.271 -    y = (rows + 1) / 2;
  30.272 -    while (y--) {
  30.273 -        x = cols_2;
  30.274 -        while (x--) {
  30.275 -            register int L;
  30.276 -
  30.277 -            cr_r = 0 * 768 + 256 + colortab[*cr + 0 * 256];
  30.278 -            crb_g = 1 * 768 + 256 + colortab[*cr + 1 * 256]
  30.279 -                + colortab[*cb + 2 * 256];
  30.280 -            cb_b = 2 * 768 + 256 + colortab[*cb + 3 * 256];
  30.281 -            ++cr;
  30.282 -            ++cb;
  30.283 -
  30.284 -            L = *lum++;
  30.285 -            *row1++ = (rgb_2_pix[L + cr_r] |
  30.286 -                       rgb_2_pix[L + crb_g] | rgb_2_pix[L + cb_b]);
  30.287 -
  30.288 -            if (!(x == 0 && skip_last_col)) {
  30.289 -            L = *lum++;
  30.290 -            *row1++ = (rgb_2_pix[L + cr_r] |
  30.291 -                       rgb_2_pix[L + crb_g] | rgb_2_pix[L + cb_b]);
  30.292 -            } /* skip col */
  30.293 -
  30.294 -
  30.295 -            if (!(y == 0 && skip_last_row)) {
  30.296 -
  30.297 -            /* Now, do second row.  */
  30.298 -
  30.299 -            L = *lum2++;
  30.300 -            *row2++ = (rgb_2_pix[L + cr_r] |
  30.301 -                       rgb_2_pix[L + crb_g] | rgb_2_pix[L + cb_b]);
  30.302 -
  30.303 -            if (!(x == 1 && skip_last_col)) {
  30.304 -            L = *lum2++;
  30.305 -            *row2++ = (rgb_2_pix[L + cr_r] |
  30.306 -                       rgb_2_pix[L + crb_g] | rgb_2_pix[L + cb_b]);
  30.307 -            } /* skip col */
  30.308 -            } /* skip row */
  30.309 -        }
  30.310 -
  30.311 -        /*
  30.312 -         * These values are at the start of the next line, (due
  30.313 -         * to the ++'s above),but they need to be at the start
  30.314 -         * of the line after that.
  30.315 -         */
  30.316 -        lum += cols;
  30.317 -        lum2 += cols;
  30.318 -        row1 += mod;
  30.319 -        row2 += mod;
  30.320 -    }
  30.321 -}
  30.322 -
  30.323 -/*
  30.324 - * In this function I make use of a nasty trick. The tables have the lower
  30.325 - * 16 bits replicated in the upper 16. This means I can write ints and get
  30.326 - * the horisontal doubling for free (almost).
  30.327 - */
  30.328 -static void
  30.329 -Color16DitherYV12Mod2X(int *colortab, Uint32 * rgb_2_pix,
  30.330 -                       unsigned char *lum, unsigned char *cr,
  30.331 -                       unsigned char *cb, unsigned char *out,
  30.332 -                       int rows, int cols, int mod)
  30.333 -{
  30.334 -    unsigned int *row1 = (unsigned int *) out;
  30.335 -    const int next_row = cols + (mod / 2);
  30.336 -    unsigned int *row2 = row1 + 2 * next_row;
  30.337 -    unsigned char *lum2;
  30.338 -    int x, y;
  30.339 -    int cr_r;
  30.340 -    int crb_g;
  30.341 -    int cb_b;
  30.342 -    int cols_2 = cols / 2;
  30.343 -
  30.344 -    lum2 = lum + cols;
  30.345 -
  30.346 -    mod = (next_row * 3) + (mod / 2);
  30.347 -
  30.348 -    y = rows / 2;
  30.349 -    while (y--) {
  30.350 -        x = cols_2;
  30.351 -        while (x--) {
  30.352 -            register int L;
  30.353 -
  30.354 -            cr_r = 0 * 768 + 256 + colortab[*cr + 0 * 256];
  30.355 -            crb_g = 1 * 768 + 256 + colortab[*cr + 1 * 256]
  30.356 -                + colortab[*cb + 2 * 256];
  30.357 -            cb_b = 2 * 768 + 256 + colortab[*cb + 3 * 256];
  30.358 -            ++cr;
  30.359 -            ++cb;
  30.360 -
  30.361 -            L = *lum++;
  30.362 -            row1[0] = row1[next_row] = (rgb_2_pix[L + cr_r] |
  30.363 -                                        rgb_2_pix[L + crb_g] |
  30.364 -                                        rgb_2_pix[L + cb_b]);
  30.365 -            row1++;
  30.366 -
  30.367 -            L = *lum++;
  30.368 -            row1[0] = row1[next_row] = (rgb_2_pix[L + cr_r] |
  30.369 -                                        rgb_2_pix[L + crb_g] |
  30.370 -                                        rgb_2_pix[L + cb_b]);
  30.371 -            row1++;
  30.372 -
  30.373 -
  30.374 -            /* Now, do second row. */
  30.375 -
  30.376 -            L = *lum2++;
  30.377 -            row2[0] = row2[next_row] = (rgb_2_pix[L + cr_r] |
  30.378 -                                        rgb_2_pix[L + crb_g] |
  30.379 -                                        rgb_2_pix[L + cb_b]);
  30.380 -            row2++;
  30.381 -
  30.382 -            L = *lum2++;
  30.383 -            row2[0] = row2[next_row] = (rgb_2_pix[L + cr_r] |
  30.384 -                                        rgb_2_pix[L + crb_g] |
  30.385 -                                        rgb_2_pix[L + cb_b]);
  30.386 -            row2++;
  30.387 -        }
  30.388 -
  30.389 -        /*
  30.390 -         * These values are at the start of the next line, (due
  30.391 -         * to the ++'s above),but they need to be at the start
  30.392 -         * of the line after that.
  30.393 -         */
  30.394 -        lum += cols;
  30.395 -        lum2 += cols;
  30.396 -        row1 += mod;
  30.397 -        row2 += mod;
  30.398 -    }
  30.399 -}
  30.400 -
  30.401 -static void
  30.402 -Color24DitherYV12Mod2X(int *colortab, Uint32 * rgb_2_pix,
  30.403 -                       unsigned char *lum, unsigned char *cr,
  30.404 -                       unsigned char *cb, unsigned char *out,
  30.405 -                       int rows, int cols, int mod)
  30.406 -{
  30.407 -    unsigned int value;
  30.408 -    unsigned char *row1 = out;
  30.409 -    const int next_row = (cols * 2 + mod) * 3;
  30.410 -    unsigned char *row2 = row1 + 2 * next_row;
  30.411 -    unsigned char *lum2;
  30.412 -    int x, y;
  30.413 -    int cr_r;
  30.414 -    int crb_g;
  30.415 -    int cb_b;
  30.416 -    int cols_2 = cols / 2;
  30.417 -
  30.418 -    lum2 = lum + cols;
  30.419 -
  30.420 -    mod = next_row * 3 + mod * 3;
  30.421 -
  30.422 -    y = rows / 2;
  30.423 -    while (y--) {
  30.424 -        x = cols_2;
  30.425 -        while (x--) {
  30.426 -            register int L;
  30.427 -
  30.428 -            cr_r = 0 * 768 + 256 + colortab[*cr + 0 * 256];
  30.429 -            crb_g = 1 * 768 + 256 + colortab[*cr + 1 * 256]
  30.430 -                + colortab[*cb + 2 * 256];
  30.431 -            cb_b = 2 * 768 + 256 + colortab[*cb + 3 * 256];
  30.432 -            ++cr;
  30.433 -            ++cb;
  30.434 -
  30.435 -            L = *lum++;
  30.436 -            value = (rgb_2_pix[L + cr_r] |
  30.437 -                     rgb_2_pix[L + crb_g] | rgb_2_pix[L + cb_b]);
  30.438 -            row1[0 + 0] = row1[3 + 0] = row1[next_row + 0] =
  30.439 -                row1[next_row + 3 + 0] = (value) & 0xFF;
  30.440 -            row1[0 + 1] = row1[3 + 1] = row1[next_row + 1] =
  30.441 -                row1[next_row + 3 + 1] = (value >> 8) & 0xFF;
  30.442 -            row1[0 + 2] = row1[3 + 2] = row1[next_row + 2] =
  30.443 -                row1[next_row + 3 + 2] = (value >> 16) & 0xFF;
  30.444 -            row1 += 2 * 3;
  30.445 -
  30.446 -            L = *lum++;
  30.447 -            value = (rgb_2_pix[L + cr_r] |
  30.448 -                     rgb_2_pix[L + crb_g] | rgb_2_pix[L + cb_b]);
  30.449 -            row1[0 + 0] = row1[3 + 0] = row1[next_row + 0] =
  30.450 -                row1[next_row + 3 + 0] = (value) & 0xFF;
  30.451 -            row1[0 + 1] = row1[3 + 1] = row1[next_row + 1] =
  30.452 -                row1[next_row + 3 + 1] = (value >> 8) & 0xFF;
  30.453 -            row1[0 + 2] = row1[3 + 2] = row1[next_row + 2] =
  30.454 -                row1[next_row + 3 + 2] = (value >> 16) & 0xFF;
  30.455 -            row1 += 2 * 3;
  30.456 -
  30.457 -
  30.458 -            /* Now, do second row. */
  30.459 -
  30.460 -            L = *lum2++;
  30.461 -            value = (rgb_2_pix[L + cr_r] |
  30.462 -                     rgb_2_pix[L + crb_g] | rgb_2_pix[L + cb_b]);
  30.463 -            row2[0 + 0] = row2[3 + 0] = row2[next_row + 0] =
  30.464 -                row2[next_row + 3 + 0] = (value) & 0xFF;
  30.465 -            row2[0 + 1] = row2[3 + 1] = row2[next_row + 1] =
  30.466 -                row2[next_row + 3 + 1] = (value >> 8) & 0xFF;
  30.467 -            row2[0 + 2] = row2[3 + 2] = row2[next_row + 2] =
  30.468 -                row2[next_row + 3 + 2] = (value >> 16) & 0xFF;
  30.469 -            row2 += 2 * 3;
  30.470 -
  30.471 -            L = *lum2++;
  30.472 -            value = (rgb_2_pix[L + cr_r] |
  30.473 -                     rgb_2_pix[L + crb_g] | rgb_2_pix[L + cb_b]);
  30.474 -            row2[0 + 0] = row2[3 + 0] = row2[next_row + 0] =
  30.475 -                row2[next_row + 3 + 0] = (value) & 0xFF;
  30.476 -            row2[0 + 1] = row2[3 + 1] = row2[next_row + 1] =
  30.477 -                row2[next_row + 3 + 1] = (value >> 8) & 0xFF;
  30.478 -            row2[0 + 2] = row2[3 + 2] = row2[next_row + 2] =
  30.479 -                row2[next_row + 3 + 2] = (value >> 16) & 0xFF;
  30.480 -            row2 += 2 * 3;
  30.481 -        }
  30.482 -
  30.483 -        /*
  30.484 -         * These values are at the start of the next line, (due
  30.485 -         * to the ++'s above),but they need to be at the start
  30.486 -         * of the line after that.
  30.487 -         */
  30.488 -        lum += cols;
  30.489 -        lum2 += cols;
  30.490 -        row1 += mod;
  30.491 -        row2 += mod;
  30.492 -    }
  30.493 -}
  30.494 -
  30.495 -static void
  30.496 -Color32DitherYV12Mod2X(int *colortab, Uint32 * rgb_2_pix,
  30.497 -                       unsigned char *lum, unsigned char *cr,
  30.498 -                       unsigned char *cb, unsigned char *out,
  30.499 -                       int rows, int cols, int mod)
  30.500 -{
  30.501 -    unsigned int *row1 = (unsigned int *) out;
  30.502 -    const int next_row = cols * 2 + mod;
  30.503 -    unsigned int *row2 = row1 + 2 * next_row;
  30.504 -    unsigned char *lum2;
  30.505 -    int x, y;
  30.506 -    int cr_r;
  30.507 -    int crb_g;
  30.508 -    int cb_b;
  30.509 -    int cols_2 = cols / 2;
  30.510 -
  30.511 -    lum2 = lum + cols;
  30.512 -
  30.513 -    mod = (next_row * 3) + mod;
  30.514 -
  30.515 -    y = rows / 2;
  30.516 -    while (y--) {
  30.517 -        x = cols_2;
  30.518 -        while (x--) {
  30.519 -            register int L;
  30.520 -
  30.521 -            cr_r = 0 * 768 + 256 + colortab[*cr + 0 * 256];
  30.522 -            crb_g = 1 * 768 + 256 + colortab[*cr + 1 * 256]
  30.523 -                + colortab[*cb + 2 * 256];
  30.524 -            cb_b = 2 * 768 + 256 + colortab[*cb + 3 * 256];
  30.525 -            ++cr;
  30.526 -            ++cb;
  30.527 -
  30.528 -            L = *lum++;
  30.529 -            row1[0] = row1[1] = row1[next_row] = row1[next_row + 1] =
  30.530 -                (rgb_2_pix[L + cr_r] |
  30.531 -                 rgb_2_pix[L + crb_g] | rgb_2_pix[L + cb_b]);
  30.532 -            row1 += 2;
  30.533 -
  30.534 -            L = *lum++;
  30.535 -            row1[0] = row1[1] = row1[next_row] = row1[next_row + 1] =
  30.536 -                (rgb_2_pix[L + cr_r] |
  30.537 -                 rgb_2_pix[L + crb_g] | rgb_2_pix[L + cb_b]);
  30.538 -            row1 += 2;
  30.539 -
  30.540 -
  30.541 -            /* Now, do second row. */
  30.542 -
  30.543 -            L = *lum2++;
  30.544 -            row2[0] = row2[1] = row2[next_row] = row2[next_row + 1] =
  30.545 -                (rgb_2_pix[L + cr_r] |
  30.546 -                 rgb_2_pix[L + crb_g] | rgb_2_pix[L + cb_b]);
  30.547 -            row2 += 2;
  30.548 -
  30.549 -            L = *lum2++;
  30.550 -            row2[0] = row2[1] = row2[next_row] = row2[next_row + 1] =
  30.551 -                (rgb_2_pix[L + cr_r] |
  30.552 -                 rgb_2_pix[L + crb_g] | rgb_2_pix[L + cb_b]);
  30.553 -            row2 += 2;
  30.554 -        }
  30.555 -
  30.556 -        /*
  30.557 -         * These values are at the start of the next line, (due
  30.558 -         * to the ++'s above),but they need to be at the start
  30.559 -         * of the line after that.
  30.560 -         */
  30.561 -        lum += cols;
  30.562 -        lum2 += cols;
  30.563 -        row1 += mod;
  30.564 -        row2 += mod;
  30.565 -    }
  30.566 -}
  30.567 -
  30.568 -static void
  30.569 -Color16DitherYUY2Mod1X(int *colortab, Uint32 * rgb_2_pix,
  30.570 -                       unsigned char *lum, unsigned char *cr,
  30.571 -                       unsigned char *cb, unsigned char *out,
  30.572 -                       int rows, int cols, int mod)
  30.573 -{
  30.574 -    unsigned short *row;
  30.575 -    int x, y;
  30.576 -    int cr_r;
  30.577 -    int crb_g;
  30.578 -    int cb_b;
  30.579 -    int cols_2 = cols / 2;
  30.580 -
  30.581 -    row = (unsigned short *) out;
  30.582 -
  30.583 -    y = rows;
  30.584 -    while (y--) {
  30.585 -        x = cols_2;
  30.586 -        while (x--) {
  30.587 -            register int L;
  30.588 -
  30.589 -            cr_r = 0 * 768 + 256 + colortab[*cr + 0 * 256];
  30.590 -            crb_g = 1 * 768 + 256 + colortab[*cr + 1 * 256]
  30.591 -                + colortab[*cb + 2 * 256];
  30.592 -            cb_b = 2 * 768 + 256 + colortab[*cb + 3 * 256];
  30.593 -            cr += 4;
  30.594 -            cb += 4;
  30.595 -
  30.596 -            L = *lum;
  30.597 -            lum += 2;
  30.598 -            *row++ = (unsigned short) (rgb_2_pix[L + cr_r] |
  30.599 -                                       rgb_2_pix[L + crb_g] |
  30.600 -                                       rgb_2_pix[L + cb_b]);
  30.601 -
  30.602 -            L = *lum;
  30.603 -            lum += 2;
  30.604 -            *row++ = (unsigned short) (rgb_2_pix[L + cr_r] |
  30.605 -                                       rgb_2_pix[L + crb_g] |
  30.606 -                                       rgb_2_pix[L + cb_b]);
  30.607 -
  30.608 -        }
  30.609 -
  30.610 -        row += mod;
  30.611 -    }
  30.612 -}
  30.613 -
  30.614 -static void
  30.615 -Color24DitherYUY2Mod1X(int *colortab, Uint32 * rgb_2_pix,
  30.616 -                       unsigned char *lum, unsigned char *cr,
  30.617 -                       unsigned char *cb, unsigned char *out,
  30.618 -                       int rows, int cols, int mod)
  30.619 -{
  30.620 -    unsigned int value;
  30.621 -    unsigned char *row;
  30.622 -    int x, y;
  30.623 -    int cr_r;
  30.624 -    int crb_g;
  30.625 -    int cb_b;
  30.626 -    int cols_2 = cols / 2;
  30.627 -
  30.628 -    row = (unsigned char *) out;
  30.629 -    mod *= 3;
  30.630 -    y = rows;
  30.631 -    while (y--) {
  30.632 -        x = cols_2;
  30.633 -        while (x--) {
  30.634 -            register int L;
  30.635 -
  30.636 -            cr_r = 0 * 768 + 256 + colortab[*cr + 0 * 256];
  30.637 -            crb_g = 1 * 768 + 256 + colortab[*cr + 1 * 256]
  30.638 -                + colortab[*cb + 2 * 256];
  30.639 -            cb_b = 2 * 768 + 256 + colortab[*cb + 3 * 256];
  30.640 -            cr += 4;
  30.641 -            cb += 4;
  30.642 -
  30.643 -            L = *lum;
  30.644 -            lum += 2;
  30.645 -            value = (rgb_2_pix[L + cr_r] |
  30.646 -                     rgb_2_pix[L + crb_g] | rgb_2_pix[L + cb_b]);
  30.647 -            *row++ = (value) & 0xFF;
  30.648 -            *row++ = (value >> 8) & 0xFF;
  30.649 -            *row++ = (value >> 16) & 0xFF;
  30.650 -
  30.651 -            L = *lum;
  30.652 -            lum += 2;
  30.653 -            value = (rgb_2_pix[L + cr_r] |
  30.654 -                     rgb_2_pix[L + crb_g] | rgb_2_pix[L + cb_b]);
  30.655 -            *row++ = (value) & 0xFF;
  30.656 -            *row++ = (value >> 8) & 0xFF;
  30.657 -            *row++ = (value >> 16) & 0xFF;
  30.658 -
  30.659 -        }
  30.660 -        row += mod;
  30.661 -    }
  30.662 -}
  30.663 -
  30.664 -static void
  30.665 -Color32DitherYUY2Mod1X(int *colortab, Uint32 * rgb_2_pix,
  30.666 -                       unsigned char *lum, unsigned char *cr,
  30.667 -                       unsigned char *cb, unsigned char *out,
  30.668 -                       int rows, int cols, int mod)
  30.669 -{
  30.670 -    unsigned int *row;
  30.671 -    int x, y;
  30.672 -    int cr_r;
  30.673 -    int crb_g;
  30.674 -    int cb_b;
  30.675 -    int cols_2 = (cols + 1) / 2;
  30.676 -    /* not even dimensions */
  30.677 -    int skip_last_col = 0;
  30.678 -    if ( (cols & 0x1) ) {
  30.679 -        skip_last_col = 1;
  30.680 -    }
  30.681 -
  30.682 -    row = (unsigned int *) out;
  30.683 -    y = rows;
  30.684 -    while (y--) {
  30.685 -        x = cols_2;
  30.686 -        while (x--) {
  30.687 -            register int L;
  30.688 -
  30.689 -            cr_r = 0 * 768 + 256 + colortab[*cr + 0 * 256];
  30.690 -            crb_g = 1 * 768 + 256 + colortab[*cr + 1 * 256]
  30.691 -                + colortab[*cb + 2 * 256];
  30.692 -            cb_b = 2 * 768 + 256 + colortab[*cb + 3 * 256];
  30.693 -            cr += 4;
  30.694 -            cb += 4;
  30.695 -
  30.696 -            L = *lum;
  30.697 -            lum += 2;
  30.698 -            *row++ = (rgb_2_pix[L + cr_r] |
  30.699 -                      rgb_2_pix[L + crb_g] | rgb_2_pix[L + cb_b]);
  30.700 -
  30.701 -            L = *lum;
  30.702 -            lum += 2;
  30.703 -
  30.704 -            if (!(x == 0 && skip_last_col)) {
  30.705 -            *row++ = (rgb_2_pix[L + cr_r] |
  30.706 -                      rgb_2_pix[L + crb_g] | rgb_2_pix[L + cb_b]);
  30.707 -            } /* skip col */
  30.708 -
  30.709 -        }
  30.710 -        row += mod;
  30.711 -    }
  30.712 -}
  30.713 -
  30.714 -/*
  30.715 - * In this function I make use of a nasty trick. The tables have the lower
  30.716 - * 16 bits replicated in the upper 16. This means I can write ints and get
  30.717 - * the horisontal doubling for free (almost).
  30.718 - */
  30.719 -static void
  30.720 -Color16DitherYUY2Mod2X(int *colortab, Uint32 * rgb_2_pix,
  30.721 -                       unsigned char *lum, unsigned char *cr,
  30.722 -                       unsigned char *cb, unsigned char *out,
  30.723 -                       int rows, int cols, int mod)
  30.724 -{
  30.725 -    unsigned int *row = (unsigned int *) out;
  30.726 -    const int next_row = cols + (mod / 2);
  30.727 -    int x, y;
  30.728 -    int cr_r;
  30.729 -    int crb_g;
  30.730 -    int cb_b;
  30.731 -    int cols_2 = cols / 2;
  30.732 -
  30.733 -    y = rows;
  30.734 -    while (y--) {
  30.735 -        x = cols_2;
  30.736 -        while (x--) {
  30.737 -            register int L;
  30.738 -
  30.739 -            cr_r = 0 * 768 + 256 + colortab[*cr + 0 * 256];
  30.740 -            crb_g = 1 * 768 + 256 + colortab[*cr + 1 * 256]
  30.741 -                + colortab[*cb + 2 * 256];
  30.742 -            cb_b = 2 * 768 + 256 + colortab[*cb + 3 * 256];
  30.743 -            cr += 4;
  30.744 -            cb += 4;
  30.745 -
  30.746 -            L = *lum;
  30.747 -            lum += 2;
  30.748 -            row[0] = row[next_row] = (rgb_2_pix[L + cr_r] |
  30.749 -                                      rgb_2_pix[L + crb_g] |
  30.750 -                                      rgb_2_pix[L + cb_b]);
  30.751 -            row++;
  30.752 -
  30.753 -            L = *lum;
  30.754 -            lum += 2;
  30.755 -            row[0] = row[next_row] = (rgb_2_pix[L + cr_r] |
  30.756 -                                      rgb_2_pix[L + crb_g] |
  30.757 -                                      rgb_2_pix[L + cb_b]);
  30.758 -            row++;
  30.759 -
  30.760 -        }
  30.761 -        row += next_row;
  30.762 -    }
  30.763 -}
  30.764 -
  30.765 -static void
  30.766 -Color24DitherYUY2Mod2X(int *colortab, Uint32 * rgb_2_pix,
  30.767 -                       unsigned char *lum, unsigned char *cr,
  30.768 -                       unsigned char *cb, unsigned char *out,
  30.769 -                       int rows, int cols, int mod)
  30.770 -{
  30.771 -    unsigned int value;
  30.772 -    unsigned char *row = out;
  30.773 -    const int next_row = (cols * 2 + mod) * 3;
  30.774 -    int x, y;
  30.775 -    int cr_r;
  30.776 -    int crb_g;
  30.777 -    int cb_b;
  30.778 -    int cols_2 = cols / 2;
  30.779 -    y = rows;
  30.780 -    while (y--) {
  30.781 -        x = cols_2;
  30.782 -        while (x--) {
  30.783 -            register int L;
  30.784 -
  30.785 -            cr_r = 0 * 768 + 256 + colortab[*cr + 0 * 256];
  30.786 -            crb_g = 1 * 768 + 256 + colortab[*cr + 1 * 256]
  30.787 -                + colortab[*cb + 2 * 256];
  30.788 -            cb_b = 2 * 768 + 256 + colortab[*cb + 3 * 256];
  30.789 -            cr += 4;
  30.790 -            cb += 4;
  30.791 -
  30.792 -            L = *lum;
  30.793 -            lum += 2;
  30.794 -            value = (rgb_2_pix[L + cr_r] |
  30.795 -                     rgb_2_pix[L + crb_g] | rgb_2_pix[L + cb_b]);
  30.796 -            row[0 + 0] = row[3 + 0] = row[next_row + 0] =
  30.797 -                row[next_row + 3 + 0] = (value) & 0xFF;
  30.798 -            row[0 + 1] = row[3 + 1] = row[next_row + 1] =
  30.799 -                row[next_row + 3 + 1] = (value >> 8) & 0xFF;
  30.800 -            row[0 + 2] = row[3 + 2] = row[next_row + 2] =
  30.801 -                row[next_row + 3 + 2] = (value >> 16) & 0xFF;
  30.802 -            row += 2 * 3;
  30.803 -
  30.804 -            L = *lum;
  30.805 -            lum += 2;
  30.806 -            value = (rgb_2_pix[L + cr_r] |
  30.807 -                     rgb_2_pix[L + crb_g] | rgb_2_pix[L + cb_b]);
  30.808 -            row[0 + 0] = row[3 + 0] = row[next_row + 0] =
  30.809 -                row[next_row + 3 + 0] = (value) & 0xFF;
  30.810 -            row[0 + 1] = row[3 + 1] = row[next_row + 1] =
  30.811 -                row[next_row + 3 + 1] = (value >> 8) & 0xFF;
  30.812 -            row[0 + 2] = row[3 + 2] = row[next_row + 2] =
  30.813 -                row[next_row + 3 + 2] = (value >> 16) & 0xFF;
  30.814 -            row += 2 * 3;
  30.815 -
  30.816 -        }
  30.817 -        row += next_row;
  30.818 -    }
  30.819 -}
  30.820 -
  30.821 -static void
  30.822 -Color32DitherYUY2Mod2X(int *colortab, Uint32 * rgb_2_pix,
  30.823 -                       unsigned char *lum, unsigned char *cr,
  30.824 -                       unsigned char *cb, unsigned char *out,
  30.825 -                       int rows, int cols, int mod)
  30.826 -{
  30.827 -    unsigned int *row = (unsigned int *) out;
  30.828 -    const int next_row = cols * 2 + mod;
  30.829 -    int x, y;
  30.830 -    int cr_r;
  30.831 -    int crb_g;
  30.832 -    int cb_b;
  30.833 -    int cols_2 = cols / 2;
  30.834 -    mod += mod;
  30.835 -    y = rows;
  30.836 -    while (y--) {
  30.837 -        x = cols_2;
  30.838 -        while (x--) {
  30.839 -            register int L;
  30.840 -
  30.841 -            cr_r = 0 * 768 + 256 + colortab[*cr + 0 * 256];
  30.842 -            crb_g = 1 * 768 + 256 + colortab[*cr + 1 * 256]
  30.843 -                + colortab[*cb + 2 * 256];
  30.844 -            cb_b = 2 * 768 + 256 + colortab[*cb + 3 * 256];
  30.845 -            cr += 4;
  30.846 -            cb += 4;
  30.847 -
  30.848 -            L = *lum;
  30.849 -            lum += 2;
  30.850 -            row[0] = row[1] = row[next_row] = row[next_row + 1] =
  30.851 -                (rgb_2_pix[L + cr_r] |
  30.852 -                 rgb_2_pix[L + crb_g] | rgb_2_pix[L + cb_b]);
  30.853 -            row += 2;
  30.854 -
  30.855 -            L = *lum;
  30.856 -            lum += 2;
  30.857 -            row[0] = row[1] = row[next_row] = row[next_row + 1] =
  30.858 -                (rgb_2_pix[L + cr_r] |
  30.859 -                 rgb_2_pix[L + crb_g] | rgb_2_pix[L + cb_b]);
  30.860 -            row += 2;
  30.861 -
  30.862 -
  30.863 -        }
  30.864 -
  30.865 -        row += next_row;
  30.866 -    }
  30.867 -}
  30.868 -
  30.869 -/*
  30.870 - * How many 1 bits are there in the Uint32.
  30.871 - * Low performance, do not call often.
  30.872 - */
  30.873 -static int
  30.874 -number_of_bits_set(Uint32 a)
  30.875 -{
  30.876 -    if (!a)
  30.877 -        return 0;
  30.878 -    if (a & 1)
  30.879 -        return 1 + number_of_bits_set(a >> 1);
  30.880 -    return (number_of_bits_set(a >> 1));
  30.881 -}
  30.882 -
  30.883 -/*
  30.884 - * How many 0 bits are there at least significant end of Uint32.
  30.885 - * Low performance, do not call often.
  30.886 - */
  30.887 -static int
  30.888 -free_bits_at_bottom_nonzero(Uint32 a)
  30.889 -{
  30.890 -    SDL_assert(a != 0);
  30.891 -    return (((Sint32) a) & 1l) ? 0 : 1 + free_bits_at_bottom_nonzero(a >> 1);
  30.892 -}
  30.893 -
  30.894 -static SDL_INLINE int
  30.895 -free_bits_at_bottom(Uint32 a)
  30.896 -{
  30.897 -    return a ? free_bits_at_bottom_nonzero(a) : 32;
  30.898 -}
  30.899 -
  30.900 -static int
  30.901 -SDL_SW_SetupYUVDisplay(SDL_SW_YUVTexture * swdata, Uint32 target_format)
  30.902 -{
  30.903 -    Uint32 *r_2_pix_alloc;
  30.904 -    Uint32 *g_2_pix_alloc;
  30.905 -    Uint32 *b_2_pix_alloc;
  30.906 -    int i;
  30.907 -    int bpp;
  30.908 -    Uint32 Rmask, Gmask, Bmask, Amask;
  30.909 -    int freebits;
  30.910 -
  30.911 -    if (!SDL_PixelFormatEnumToMasks
  30.912 -        (target_format, &bpp, &Rmask, &Gmask, &Bmask, &Amask) || bpp < 15) {
  30.913 -        return SDL_SetError("Unsupported YUV destination format");
  30.914 -    }
  30.915 -
  30.916 -    swdata->target_format = target_format;
  30.917 -    r_2_pix_alloc = &swdata->rgb_2_pix[0 * 768];
  30.918 -    g_2_pix_alloc = &swdata->rgb_2_pix[1 * 768];
  30.919 -    b_2_pix_alloc = &swdata->rgb_2_pix[2 * 768];
  30.920 -
  30.921 -    /*
  30.922 -     * Set up entries 0-255 in rgb-to-pixel value tables.
  30.923 -     */
  30.924 -    for (i = 0; i < 256; ++i) {
  30.925 -        r_2_pix_alloc[i + 256] = i >> (8 - number_of_bits_set(Rmask));
  30.926 -        freebits = free_bits_at_bottom(Rmask);
  30.927 -        if (freebits < 32) {
  30.928 -            r_2_pix_alloc[i + 256] <<= freebits;
  30.929 -        }
  30.930 -        r_2_pix_alloc[i + 256] |= Amask;
  30.931 -
  30.932 -        g_2_pix_alloc[i + 256] = i >> (8 - number_of_bits_set(Gmask));
  30.933 -        freebits = free_bits_at_bottom(Gmask);
  30.934 -        if (freebits < 32) {
  30.935 -            g_2_pix_alloc[i + 256] <<= freebits;
  30.936 -        }
  30.937 -        g_2_pix_alloc[i + 256] |= Amask;
  30.938 -
  30.939 -        b_2_pix_alloc[i + 256] = i >> (8 - number_of_bits_set(Bmask));
  30.940 -        freebits = free_bits_at_bottom(Bmask);
  30.941 -        if (freebits < 32) {
  30.942 -            b_2_pix_alloc[i + 256] <<= freebits;
  30.943 -        }
  30.944 -        b_2_pix_alloc[i + 256] |= Amask;
  30.945 -    }
  30.946 -
  30.947 -    /*
  30.948 -     * If we have 16-bit output depth, then we double the value
  30.949 -     * in the top word. This means that we can write out both
  30.950 -     * pixels in the pixel doubling mode with one op. It is
  30.951 -     * harmless in the normal case as storing a 32-bit value
  30.952 -     * through a short pointer will lose the top bits anyway.
  30.953 -     */
  30.954 -    if (SDL_BYTESPERPIXEL(target_format) == 2) {
  30.955 -        for (i = 0; i < 256; ++i) {
  30.956 -            r_2_pix_alloc[i + 256] |= (r_2_pix_alloc[i + 256]) << 16;
  30.957 -            g_2_pix_alloc[i + 256] |= (g_2_pix_alloc[i + 256]) << 16;
  30.958 -            b_2_pix_alloc[i + 256] |= (b_2_pix_alloc[i + 256]) << 16;
  30.959 -        }
  30.960 -    }
  30.961 -
  30.962 -    /*
  30.963 -     * Spread out the values we have to the rest of the array so that
  30.964 -     * we do not need to check for overflow.
  30.965 -     */
  30.966 -    for (i = 0; i < 256; ++i) {
  30.967 -        r_2_pix_alloc[i] = r_2_pix_alloc[256];
  30.968 -        r_2_pix_alloc[i + 512] = r_2_pix_alloc[511];
  30.969 -        g_2_pix_alloc[i] = g_2_pix_alloc[256];
  30.970 -        g_2_pix_alloc[i + 512] = g_2_pix_alloc[511];
  30.971 -        b_2_pix_alloc[i] = b_2_pix_alloc[256];
  30.972 -        b_2_pix_alloc[i + 512] = b_2_pix_alloc[511];
  30.973 -    }
  30.974 -
  30.975 -    /* You have chosen wisely... */
  30.976 -    switch (swdata->format) {
  30.977 -    case SDL_PIXELFORMAT_YV12:
  30.978 -    case SDL_PIXELFORMAT_IYUV:
  30.979 -        if (SDL_BYTESPERPIXEL(target_format) == 2) {
  30.980 -#ifdef USE_MMX_ASSEMBLY
  30.981 -            /* inline assembly functions */
  30.982 -            if (SDL_HasMMX() && (Rmask == 0xF800) &&
  30.983 -                (Gmask == 0x07E0) && (Bmask == 0x001F)
  30.984 -                && (swdata->w & 15) == 0) {
  30.985 -/* printf("Using MMX 16-bit 565 dither\n"); */
  30.986 -                swdata->Display1X = Color565DitherYV12MMX1X;
  30.987 -            } else {
  30.988 -/* printf("Using C 16-bit dither\n"); */
  30.989 -                swdata->Display1X = Color16DitherYV12Mod1X;
  30.990 -            }
  30.991 -#else
  30.992 -            swdata->Display1X = Color16DitherYV12Mod1X;
  30.993 -#endif
  30.994 -            swdata->Display2X = Color16DitherYV12Mod2X;
  30.995 -        }
  30.996 -        if (SDL_BYTESPERPIXEL(target_format) == 3) {
  30.997 -            swdata->Display1X = Color24DitherYV12Mod1X;
  30.998 -            swdata->Display2X = Color24DitherYV12Mod2X;
  30.999 -        }
 30.1000 -        if (SDL_BYTESPERPIXEL(target_format) == 4) {
 30.1001 -#ifdef USE_MMX_ASSEMBLY
 30.1002 -            /* inline assembly functions */
 30.1003 -            if (SDL_HasMMX() && (Rmask == 0x00FF0000) &&
 30.1004 -                (Gmask == 0x0000FF00) &&
 30.1005 -                (Bmask == 0x000000FF) && (swdata->w & 15) == 0) {
 30.1006 -/* printf("Using MMX 32-bit dither\n"); */
 30.1007 -                swdata->Display1X = ColorRGBDitherYV12MMX1X;
 30.1008 -            } else {
 30.1009 -/* printf("Using C 32-bit dither\n"); */
 30.1010 -                swdata->Display1X = Color32DitherYV12Mod1X;
 30.1011 -            }
 30.1012 -#else
 30.1013 -            swdata->Display1X = Color32DitherYV12Mod1X;
 30.1014 -#endif
 30.1015 -            swdata->Display2X = Color32DitherYV12Mod2X;
 30.1016 -        }
 30.1017 -        break;
 30.1018 -    case SDL_PIXELFORMAT_YUY2:
 30.1019 -    case SDL_PIXELFORMAT_UYVY:
 30.1020 -    case SDL_PIXELFORMAT_YVYU:
 30.1021 -        if (SDL_BYTESPERPIXEL(target_format) == 2) {
 30.1022 -            swdata->Display1X = Color16DitherYUY2Mod1X;
 30.1023 -            swdata->Display2X = Color16DitherYUY2Mod2X;
 30.1024 -        }
 30.1025 -        if (SDL_BYTESPERPIXEL(target_format) == 3) {
 30.1026 -            swdata->Display1X = Color24DitherYUY2Mod1X;
 30.1027 -            swdata->Display2X = Color24DitherYUY2Mod2X;
 30.1028 -        }
 30.1029 -        if (SDL_BYTESPERPIXEL(target_format) == 4) {
 30.1030 -            swdata->Display1X = Color32DitherYUY2Mod1X;
 30.1031 -            swdata->Display2X = Color32DitherYUY2Mod2X;
 30.1032 -        }
 30.1033 -        break;
 30.1034 -    case SDL_PIXELFORMAT_NV21:
 30.1035 -    case SDL_PIXELFORMAT_NV12:
 30.1036 -        /* no Display{1,2}X function */
 30.1037 -        swdata->Display1X = NULL;
 30.1038 -        swdata->Display2X = NULL;
 30.1039 -        break;
 30.1040 -
 30.1041 -    default:
 30.1042 -        /* We should never get here (caught above) */
 30.1043 -        break;
 30.1044 -    }
 30.1045 -
 30.1046 -    SDL_FreeSurface(swdata->display);
 30.1047 -    swdata->display = NULL;
 30.1048 -    return 0;
 30.1049 -}
 30.1050  
 30.1051  SDL_SW_YUVTexture *
 30.1052  SDL_SW_CreateYUVTexture(Uint32 format, int w, int h)
 30.1053  {
 30.1054      SDL_SW_YUVTexture *swdata;
 30.1055 -    int *Cr_r_tab;
 30.1056 -    int *Cr_g_tab;
 30.1057 -    int *Cb_g_tab;
 30.1058 -    int *Cb_b_tab;
 30.1059 -    int i;
 30.1060 -    int CR, CB;
 30.1061  
 30.1062      switch (format) {
 30.1063      case SDL_PIXELFORMAT_YV12:
 30.1064 @@ -1127,32 +84,14 @@
 30.1065                  break;
 30.1066          }
 30.1067          swdata->pixels = (Uint8 *) SDL_malloc(dst_size);
 30.1068 -    }
 30.1069 -    swdata->colortab = (int *) SDL_malloc(4 * 256 * sizeof(int));
 30.1070 -    swdata->rgb_2_pix = (Uint32 *) SDL_malloc(3 * 768 * sizeof(Uint32));
 30.1071 -    if (!swdata->pixels || !swdata->colortab || !swdata->rgb_2_pix) {
 30.1072 -        SDL_SW_DestroyYUVTexture(swdata);
 30.1073 -        SDL_OutOfMemory();
 30.1074 -        return NULL;
 30.1075 +        if (!swdata->pixels) {
 30.1076 +            SDL_SW_DestroyYUVTexture(swdata);
 30.1077 +            SDL_OutOfMemory();
 30.1078 +            return NULL;
 30.1079 +        }
 30.1080      }
 30.1081  
 30.1082 -    /* Generate the tables for the display surface */
 30.1083 -    Cr_r_tab = &swdata->colortab[0 * 256];
 30.1084 -    Cr_g_tab = &swdata->colortab[1 * 256];
 30.1085 -    Cb_g_tab = &swdata->colortab[2 * 256];
 30.1086 -    Cb_b_tab = &swdata->colortab[3 * 256];
 30.1087 -    for (i = 0; i < 256; i++) {
 30.1088 -        /* Gamma correction (luminescence table) and chroma correction
 30.1089 -           would be done here.  See the Berkeley mpeg_play sources.
 30.1090 -         */
 30.1091 -        CB = CR = (i - 128);
 30.1092 -        Cr_r_tab[i] = (int) ((0.419 / 0.299) * CR);
 30.1093 -        Cr_g_tab[i] = (int) (-(0.299 / 0.419) * CR);
 30.1094 -        Cb_g_tab[i] = (int) (-(0.114 / 0.331) * CB);
 30.1095 -        Cb_b_tab[i] = (int) ((0.587 / 0.331) * CB);
 30.1096 -    }
 30.1097 -
 30.1098 -    /* Find the pitch and offset values for the overlay */
 30.1099 +    /* Find the pitch and offset values for the texture */
 30.1100      switch (format) {
 30.1101      case SDL_PIXELFORMAT_YV12:
 30.1102      case SDL_PIXELFORMAT_IYUV:
 30.1103 @@ -1300,8 +239,6 @@
 30.1104                  }
 30.1105              }
 30.1106          }
 30.1107 -        break;
 30.1108 -
 30.1109      }
 30.1110      return 0;
 30.1111  }
 30.1112 @@ -1398,27 +335,16 @@
 30.1113                      Uint32 target_format, int w, int h, void *pixels,
 30.1114                      int pitch)
 30.1115  {
 30.1116 -    const int targetbpp = SDL_BYTESPERPIXEL(target_format);
 30.1117      int stretch;
 30.1118 -    int scale_2x;
 30.1119 -    Uint8 *lum, *Cr, *Cb;
 30.1120 -    int mod;
 30.1121 -
 30.1122 -    if (targetbpp == 0) {
 30.1123 -        return SDL_SetError("Invalid target pixel format");
 30.1124 -    }
 30.1125  
 30.1126      /* Make sure we're set up to display in the desired format */
 30.1127 -    if (target_format != swdata->target_format) {
 30.1128 -        if (SDL_SW_SetupYUVDisplay(swdata, target_format) < 0) {
 30.1129 -            return -1;
 30.1130 -        }
 30.1131 +    if (target_format != swdata->target_format && swdata->display) {
 30.1132 +        SDL_FreeSurface(swdata->display);
 30.1133 +        swdata->display = NULL;
 30.1134      }
 30.1135  
 30.1136      stretch = 0;
 30.1137 -    scale_2x = 0;
 30.1138 -    if (srcrect->x || srcrect->y || srcrect->w < swdata->w
 30.1139 -        || srcrect->h < swdata->h) {
 30.1140 +    if (srcrect->x || srcrect->y || srcrect->w < swdata->w || srcrect->h < swdata->h) {
 30.1141          /* The source rectangle has been clipped.
 30.1142             Using a scratch surface is easier than adding clipped
 30.1143             source support to all the blitters, plus that would
 30.1144 @@ -1426,11 +352,7 @@
 30.1145           */
 30.1146          stretch = 1;
 30.1147      } else if ((srcrect->w != w) || (srcrect->h != h)) {
 30.1148 -        if ((w == 2 * srcrect->w) && (h == 2 * srcrect->h)) {
 30.1149 -            scale_2x = 1;
 30.1150 -        } else {
 30.1151 -            stretch = 1;
 30.1152 -        }
 30.1153 +        stretch = 1;
 30.1154      }
 30.1155      if (stretch) {
 30.1156          int bpp;
 30.1157 @@ -1466,51 +388,10 @@
 30.1158          pixels = swdata->stretch->pixels;
 30.1159          pitch = swdata->stretch->pitch;
 30.1160      }
 30.1161 -    switch (swdata->format) {
 30.1162 -    case SDL_PIXELFORMAT_YV12:
 30.1163 -        lum = swdata->planes[0];
 30.1164 -        Cr = swdata->planes[1];
 30.1165 -        Cb = swdata->planes[2];
 30.1166 -        break;
 30.1167 -    case SDL_PIXELFORMAT_IYUV:
 30.1168 -        lum = swdata->planes[0];
 30.1169 -        Cr = swdata->planes[2];
 30.1170 -        Cb = swdata->planes[1];
 30.1171 -        break;
 30.1172 -    case SDL_PIXELFORMAT_YUY2:
 30.1173 -        lum = swdata->planes[0];
 30.1174 -        Cr = lum + 3;
 30.1175 -        Cb = lum + 1;
 30.1176 -        break;
 30.1177 -    case SDL_PIXELFORMAT_UYVY:
 30.1178 -        lum = swdata->planes[0] + 1;
 30.1179 -        Cr = lum + 1;
 30.1180 -        Cb = lum - 1;
 30.1181 -        break;
 30.1182 -    case SDL_PIXELFORMAT_YVYU:
 30.1183 -        lum = swdata->planes[0];
 30.1184 -        Cr = lum + 1;
 30.1185 -        Cb = lum + 3;
 30.1186 -        break;
 30.1187 -    case SDL_PIXELFORMAT_NV12:
 30.1188 -    case SDL_PIXELFORMAT_NV21:
 30.1189 -        return SDL_ConvertPixels(swdata->w, swdata->h, 
 30.1190 -                swdata->format, swdata->planes[0], swdata->pitches[0], 
 30.1191 -                target_format, pixels, pitch);
 30.1192 -        break;
 30.1193 -    default:
 30.1194 -        return SDL_SetError("Unsupported YUV format in copy");
 30.1195 -    }
 30.1196 -    mod = (pitch / targetbpp);
 30.1197 -
 30.1198 -    if (scale_2x) {
 30.1199 -        mod -= (swdata->w * 2);
 30.1200 -        swdata->Display2X(swdata->colortab, swdata->rgb_2_pix,
 30.1201 -                          lum, Cr, Cb, pixels, swdata->h, swdata->w, mod);
 30.1202 -    } else {
 30.1203 -        mod -= swdata->w;
 30.1204 -        swdata->Display1X(swdata->colortab, swdata->rgb_2_pix,
 30.1205 -                          lum, Cr, Cb, pixels, swdata->h, swdata->w, mod);
 30.1206 +    if (SDL_ConvertPixels(swdata->w, swdata->h, swdata->format,
 30.1207 +                          swdata->planes[0], swdata->pitches[0], 
 30.1208 +                          target_format, pixels, pitch) < 0) {
 30.1209 +        return -1;
 30.1210      }
 30.1211      if (stretch) {
 30.1212          SDL_Rect rect = *srcrect;
 30.1213 @@ -1524,8 +405,6 @@
 30.1214  {
 30.1215      if (swdata) {
 30.1216          SDL_free(swdata->pixels);
 30.1217 -        SDL_free(swdata->colortab);
 30.1218 -        SDL_free(swdata->rgb_2_pix);
 30.1219          SDL_FreeSurface(swdata->stretch);
 30.1220          SDL_FreeSurface(swdata->display);
 30.1221          SDL_free(swdata);
    31.1 --- a/src/render/SDL_yuv_sw_c.h	Sun Nov 12 10:59:05 2017 -0800
    31.2 +++ b/src/render/SDL_yuv_sw_c.h	Sun Nov 12 22:51:12 2017 -0800
    31.3 @@ -30,16 +30,6 @@
    31.4      Uint32 target_format;
    31.5      int w, h;
    31.6      Uint8 *pixels;
    31.7 -    int *colortab;
    31.8 -    Uint32 *rgb_2_pix;
    31.9 -    void (*Display1X) (int *colortab, Uint32 * rgb_2_pix,
   31.10 -                       unsigned char *lum, unsigned char *cr,
   31.11 -                       unsigned char *cb, unsigned char *out,
   31.12 -                       int rows, int cols, int mod);
   31.13 -    void (*Display2X) (int *colortab, Uint32 * rgb_2_pix,
   31.14 -                       unsigned char *lum, unsigned char *cr,
   31.15 -                       unsigned char *cb, unsigned char *out,
   31.16 -                       int rows, int cols, int mod);
   31.17  
   31.18      /* These are just so we don't have to allocate them separately */
   31.19      Uint16 pitches[3];
    32.1 --- a/src/render/direct3d/SDL_render_d3d.c	Sun Nov 12 10:59:05 2017 -0800
    32.2 +++ b/src/render/direct3d/SDL_render_d3d.c	Sun Nov 12 22:51:12 2017 -0800
    32.3 @@ -39,85 +39,7 @@
    32.4  #include <d3d9.h>
    32.5  #endif
    32.6  
    32.7 -
    32.8 -#ifdef ASSEMBLE_SHADER
    32.9 -#pragma comment(lib, "d3dx9.lib")
   32.10 -
   32.11 -/**************************************************************************
   32.12 - * ID3DXBuffer:
   32.13 - * ------------
   32.14 - * The buffer object is used by D3DX to return arbitrary size data.
   32.15 - *
   32.16 - * GetBufferPointer -
   32.17 - *    Returns a pointer to the beginning of the buffer.
   32.18 - *
   32.19 - * GetBufferSize -
   32.20 - *    Returns the size of the buffer, in bytes.
   32.21 - **************************************************************************/
   32.22 -
   32.23 -typedef interface ID3DXBuffer ID3DXBuffer;
   32.24 -typedef interface ID3DXBuffer *LPD3DXBUFFER;
   32.25 -
   32.26 -/* {8BA5FB08-5195-40e2-AC58-0D989C3A0102} */
   32.27 -DEFINE_GUID(IID_ID3DXBuffer,
   32.28 -0x8ba5fb08, 0x5195, 0x40e2, 0xac, 0x58, 0xd, 0x98, 0x9c, 0x3a, 0x1, 0x2);
   32.29 -
   32.30 -#undef INTERFACE
   32.31 -#define INTERFACE ID3DXBuffer
   32.32 -
   32.33 -typedef interface ID3DXBuffer {
   32.34 -    const struct ID3DXBufferVtbl FAR* lpVtbl;
   32.35 -} ID3DXBuffer;
   32.36 -typedef const struct ID3DXBufferVtbl ID3DXBufferVtbl;
   32.37 -const struct ID3DXBufferVtbl
   32.38 -{
   32.39 -    /* IUnknown */
   32.40 -    STDMETHOD(QueryInterface)(THIS_ REFIID iid, LPVOID *ppv) PURE;
   32.41 -    STDMETHOD_(ULONG, AddRef)(THIS) PURE;
   32.42 -    STDMETHOD_(ULONG, Release)(THIS) PURE;
   32.43 -
   32.44 -    /* ID3DXBuffer */
   32.45 -    STDMETHOD_(LPVOID, GetBufferPointer)(THIS) PURE;
   32.46 -    STDMETHOD_(DWORD, GetBufferSize)(THIS) PURE;
   32.47 -};
   32.48 -
   32.49 -HRESULT WINAPI
   32.50 -    D3DXAssembleShader(
   32.51 -        LPCSTR                          pSrcData,
   32.52 -        UINT                            SrcDataLen,
   32.53 -        CONST LPVOID*                   pDefines,
   32.54 -        LPVOID                          pInclude,
   32.55 -        DWORD                           Flags,
   32.56 -        LPD3DXBUFFER*                   ppShader,
   32.57 -        LPD3DXBUFFER*                   ppErrorMsgs);
   32.58 -
   32.59 -static void PrintShaderData(LPDWORD shader_data, DWORD shader_size)
   32.60 -{
   32.61 -    OutputDebugStringA("const DWORD shader_data[] = {\n\t");
   32.62 -    {
   32.63 -        SDL_bool newline = SDL_FALSE;
   32.64 -        unsigned i;
   32.65 -        for (i = 0; i < shader_size / sizeof(DWORD); ++i) {
   32.66 -            char dword[11];
   32.67 -            if (i > 0) {
   32.68 -                if ((i%6) == 0) {
   32.69 -                    newline = SDL_TRUE;
   32.70 -                }
   32.71 -                if (newline) {
   32.72 -                    OutputDebugStringA(",\n    ");
   32.73 -                    newline = SDL_FALSE;
   32.74 -                } else {
   32.75 -                    OutputDebugStringA(", ");
   32.76 -                }
   32.77 -            }
   32.78 -            SDL_snprintf(dword, sizeof(dword), "0x%8.8x", shader_data[i]);
   32.79 -            OutputDebugStringA(dword);
   32.80 -        }
   32.81 -        OutputDebugStringA("\n};\n");
   32.82 -    }
   32.83 -}
   32.84 -
   32.85 -#endif /* ASSEMBLE_SHADER */
   32.86 +#include "SDL_shaders_d3d.h"
   32.87  
   32.88  
   32.89  /* Direct3D renderer implementation */
   32.90 @@ -188,7 +110,7 @@
   32.91      IDirect3DSurface9 *defaultRenderTarget;
   32.92      IDirect3DSurface9 *currentRenderTarget;
   32.93      void* d3dxDLL;
   32.94 -    LPDIRECT3DPIXELSHADER9 ps_yuv;
   32.95 +    LPDIRECT3DPIXELSHADER9 shaders[NUM_SHADERS];
   32.96  } D3D_RenderData;
   32.97  
   32.98  typedef struct
   32.99 @@ -197,6 +119,7 @@
  32.100      int w, h;
  32.101      DWORD usage;
  32.102      Uint32 format;
  32.103 +    D3DFORMAT d3dfmt;
  32.104      IDirect3DTexture9 *texture;
  32.105      IDirect3DTexture9 *staging;
  32.106  } D3D_TextureRep;
  32.107 @@ -313,6 +236,8 @@
  32.108          return D3DFMT_A8R8G8B8;
  32.109      case SDL_PIXELFORMAT_YV12:
  32.110      case SDL_PIXELFORMAT_IYUV:
  32.111 +    case SDL_PIXELFORMAT_NV12:
  32.112 +    case SDL_PIXELFORMAT_NV21:
  32.113          return D3DFMT_L8;
  32.114      default:
  32.115          return D3DFMT_UNKNOWN;
  32.116 @@ -661,137 +586,19 @@
  32.117      /* Set up parameters for rendering */
  32.118      D3D_InitRenderState(data);
  32.119  
  32.120 -    if (caps.MaxSimultaneousTextures >= 3)
  32.121 -    {
  32.122 -#ifdef ASSEMBLE_SHADER
  32.123 -        /* This shader was created by running the following HLSL through the fxc compiler
  32.124 -           and then tuning the generated assembly.
  32.125 -
  32.126 -           fxc /T fx_4_0 /O3 /Gfa /Fc yuv.fxc yuv.fx
  32.127 -
  32.128 -           --- yuv.fx ---
  32.129 -           Texture2D g_txY;
  32.130 -           Texture2D g_txU;
  32.131 -           Texture2D g_txV;
  32.132 -
  32.133 -           SamplerState samLinear
  32.134 -           {
  32.135 -               Filter = ANISOTROPIC;
  32.136 -               AddressU = Clamp;
  32.137 -               AddressV = Clamp;
  32.138 -               MaxAnisotropy = 1;
  32.139 -           };
  32.140 -
  32.141 -           struct VS_OUTPUT
  32.142 -           {
  32.143 -                float2 TextureUV  : TEXCOORD0;
  32.144 -           };
  32.145 -
  32.146 -           struct PS_OUTPUT
  32.147 -           {
  32.148 -                float4 RGBAColor : SV_Target;
  32.149 -           };
  32.150 -
  32.151 -           PS_OUTPUT YUV420( VS_OUTPUT In ) 
  32.152 -           {
  32.153 -               const float3 offset = {-0.0627451017, -0.501960814, -0.501960814};
  32.154 -               const float3 Rcoeff = {1.164,  0.000,  1.596};
  32.155 -               const float3 Gcoeff = {1.164, -0.391, -0.813};
  32.156 -               const float3 Bcoeff = {1.164,  2.018,  0.000};
  32.157 -
  32.158 -               PS_OUTPUT Output;
  32.159 -               float2 TextureUV = In.TextureUV;
  32.160 -
  32.161 -               float3 yuv;
  32.162 -               yuv.x = g_txY.Sample( samLinear, TextureUV ).r;
  32.163 -               yuv.y = g_txU.Sample( samLinear, TextureUV ).r;
  32.164 -               yuv.z = g_txV.Sample( samLinear, TextureUV ).r;
  32.165 -
  32.166 -               yuv += offset;
  32.167 -               Output.RGBAColor.r = dot(yuv, Rcoeff);
  32.168 -               Output.RGBAColor.g = dot(yuv, Gcoeff);
  32.169 -               Output.RGBAColor.b = dot(yuv, Bcoeff);
  32.170 -               Output.RGBAColor.a = 1.0f;
  32.171 -
  32.172 -               return Output;
  32.173 -           }
  32.174 -
  32.175 -           technique10 RenderYUV420
  32.176 -           {
  32.177 -               pass P0
  32.178 -               {
  32.179 -                    SetPixelShader( CompileShader( ps_4_0_level_9_0, YUV420() ) );
  32.180 -               }
  32.181 -           }
  32.182 -        */
  32.183 -        const char *shader_text =
  32.184 -            "ps_2_0\n"
  32.185 -            "def c0, -0.0627451017, -0.501960814, -0.501960814, 1\n"
  32.186 -            "def c1, 1.16400003, 0, 1.59599996, 0\n"
  32.187 -            "def c2, 1.16400003, -0.391000003, -0.813000023, 0\n"
  32.188 -            "def c3, 1.16400003, 2.01799989, 0, 0\n"
  32.189 -            "dcl t0.xy\n"
  32.190 -            "dcl v0.xyzw\n"
  32.191 -            "dcl_2d s0\n"
  32.192 -            "dcl_2d s1\n"
  32.193 -            "dcl_2d s2\n"
  32.194 -            "texld r0, t0, s0\n"
  32.195 -            "texld r1, t0, s1\n"
  32.196 -            "texld r2, t0, s2\n"
  32.197 -            "mov r0.y, r1.x\n"
  32.198 -            "mov r0.z, r2.x\n"
  32.199 -            "add r0.xyz, r0, c0\n"
  32.200 -            "dp3 r1.x, r0, c1\n"
  32.201 -            "dp3 r1.y, r0, c2\n"
  32.202 -            "dp2add r1.z, r0, c3, c3.z\n"   /* Logically this is "dp3 r1.z, r0, c3" but the optimizer did its magic */
  32.203 -            "mov r1.w, c0.w\n"
  32.204 -            "mul r0, r1, v0\n"              /* Not in the HLSL, multiply by vertex color */
  32.205 -            "mov oC0, r0\n"
  32.206 -        ;
  32.207 -        LPD3DXBUFFER pCode;
  32.208 -        LPD3DXBUFFER pErrorMsgs;
  32.209 -        LPDWORD shader_data = NULL;
  32.210 -        DWORD   shader_size = 0;
  32.211 -        result = D3DXAssembleShader(shader_text, SDL_strlen(shader_text), NULL, NULL, 0, &pCode, &pErrorMsgs);
  32.212 -        if (!FAILED(result)) {
  32.213 -            shader_data = (DWORD*)pCode->lpVtbl->GetBufferPointer(pCode);
  32.214 -            shader_size = pCode->lpVtbl->GetBufferSize(pCode);
  32.215 -            PrintShaderData(shader_data, shader_size);
  32.216 -        } else {
  32.217 -            const char *error = (const char *)pErrorMsgs->lpVtbl->GetBufferPointer(pErrorMsgs);
  32.218 -            SDL_SetError("Couldn't assemble shader: %s", error);
  32.219 -        }
  32.220 -        if (shader_data != NULL)
  32.221 -#else
  32.222 -        const DWORD shader_data[] = {
  32.223 -            0xffff0200, 0x05000051, 0xa00f0000, 0xbd808081, 0xbf008081, 0xbf008081,
  32.224 -            0x3f800000, 0x05000051, 0xa00f0001, 0x3f94fdf4, 0x00000000, 0x3fcc49ba,
  32.225 -            0x00000000, 0x05000051, 0xa00f0002, 0x3f94fdf4, 0xbec83127, 0xbf5020c5,
  32.226 -            0x00000000, 0x05000051, 0xa00f0003, 0x3f94fdf4, 0x400126e9, 0x00000000,
  32.227 -            0x00000000, 0x0200001f, 0x80000000, 0xb0030000, 0x0200001f, 0x80000000,
  32.228 -            0x900f0000, 0x0200001f, 0x90000000, 0xa00f0800, 0x0200001f, 0x90000000,
  32.229 -            0xa00f0801, 0x0200001f, 0x90000000, 0xa00f0802, 0x03000042, 0x800f0000,
  32.230 -            0xb0e40000, 0xa0e40800, 0x03000042, 0x800f0001, 0xb0e40000, 0xa0e40801,
  32.231 -            0x03000042, 0x800f0002, 0xb0e40000, 0xa0e40802, 0x02000001, 0x80020000,
  32.232 -            0x80000001, 0x02000001, 0x80040000, 0x80000002, 0x03000002, 0x80070000,
  32.233 -            0x80e40000, 0xa0e40000, 0x03000008, 0x80010001, 0x80e40000, 0xa0e40001,
  32.234 -            0x03000008, 0x80020001, 0x80e40000, 0xa0e40002, 0x0400005a, 0x80040001,
  32.235 -            0x80e40000, 0xa0e40003, 0xa0aa0003, 0x02000001, 0x80080001, 0xa0ff0000,
  32.236 -            0x03000005, 0x800f0000, 0x80e40001, 0x90e40000, 0x02000001, 0x800f0800,
  32.237 -            0x80e40000, 0x0000ffff
  32.238 -        };
  32.239 -#endif
  32.240 -        {
  32.241 -            result = IDirect3DDevice9_CreatePixelShader(data->device, shader_data, &data->ps_yuv);
  32.242 -            if (!FAILED(result)) {
  32.243 -                renderer->info.texture_formats[renderer->info.num_texture_formats++] = SDL_PIXELFORMAT_YV12;
  32.244 -                renderer->info.texture_formats[renderer->info.num_texture_formats++] = SDL_PIXELFORMAT_IYUV;
  32.245 -            } else {
  32.246 +    if (caps.MaxSimultaneousTextures >= 3) {
  32.247 +        int i;
  32.248 +        for (i = 0; i < SDL_arraysize(data->shaders); ++i) {
  32.249 +            result = D3D9_CreatePixelShader(data->device, (D3D9_Shader)i, &data->shaders[i]);
  32.250 +            if (FAILED(result)) {
  32.251                  D3D_SetError("CreatePixelShader()", result);
  32.252              }
  32.253          }
  32.254 +        if (data->shaders[SHADER_YUV_JPEG] && data->shaders[SHADER_YUV_BT601] && data->shaders[SHADER_YUV_BT709]) {
  32.255 +            renderer->info.texture_formats[renderer->info.num_texture_formats++] = SDL_PIXELFORMAT_YV12;
  32.256 +            renderer->info.texture_formats[renderer->info.num_texture_formats++] = SDL_PIXELFORMAT_IYUV;
  32.257 +        }
  32.258      }
  32.259 -
  32.260      return renderer;
  32.261  }
  32.262  
  32.263 @@ -870,7 +677,7 @@
  32.264  }
  32.265  
  32.266  static int
  32.267 -D3D_CreateTextureRep(IDirect3DDevice9 *device, D3D_TextureRep *texture, DWORD usage, Uint32 format, int w, int h)
  32.268 +D3D_CreateTextureRep(IDirect3DDevice9 *device, D3D_TextureRep *texture, DWORD usage, Uint32 format, D3DFORMAT d3dfmt, int w, int h)
  32.269  {
  32.270      HRESULT result;
  32.271  
  32.272 @@ -879,6 +686,7 @@
  32.273      texture->h = h;
  32.274      texture->usage = usage;
  32.275      texture->format = format;
  32.276 +    texture->d3dfmt = d3dfmt;
  32.277  
  32.278      result = IDirect3DDevice9_CreateTexture(device, w, h, 1, usage,
  32.279          PixelFormatToD3DFMT(format),
  32.280 @@ -897,8 +705,7 @@
  32.281  
  32.282      if (texture->staging == NULL) {
  32.283          result = IDirect3DDevice9_CreateTexture(device, texture->w, texture->h, 1, 0,
  32.284 -            PixelFormatToD3DFMT(texture->format),
  32.285 -            D3DPOOL_SYSTEMMEM, &texture->staging, NULL);
  32.286 +            texture->d3dfmt, D3DPOOL_SYSTEMMEM, &texture->staging, NULL);
  32.287          if (FAILED(result)) {
  32.288              return D3D_SetError("CreateTexture(D3DPOOL_SYSTEMMEM)", result);
  32.289          }
  32.290 @@ -934,7 +741,7 @@
  32.291  }
  32.292  
  32.293  static int
  32.294 -D3D_RecreateTextureRep(IDirect3DDevice9 *device, D3D_TextureRep *texture, Uint32 format, int w, int h)
  32.295 +D3D_RecreateTextureRep(IDirect3DDevice9 *device, D3D_TextureRep *texture)
  32.296  {
  32.297      if (texture->texture) {
  32.298          IDirect3DTexture9_Release(texture->texture);
  32.299 @@ -948,7 +755,7 @@
  32.300  }
  32.301  
  32.302  static int
  32.303 -D3D_UpdateTextureRep(IDirect3DDevice9 *device, D3D_TextureRep *texture, Uint32 format, int x, int y, int w, int h, const void *pixels, int pitch)
  32.304 +D3D_UpdateTextureRep(IDirect3DDevice9 *device, D3D_TextureRep *texture, int x, int y, int w, int h, const void *pixels, int pitch)
  32.305  {
  32.306      RECT d3drect;
  32.307      D3DLOCKED_RECT locked;
  32.308 @@ -972,8 +779,8 @@
  32.309      }
  32.310  
  32.311      src = (const Uint8 *)pixels;
  32.312 -    dst = locked.pBits;
  32.313 -    length = w * SDL_BYTESPERPIXEL(format);
  32.314 +    dst = (Uint8 *)locked.pBits;
  32.315 +    length = w * SDL_BYTESPERPIXEL(texture->format);
  32.316      if (length == pitch && length == locked.Pitch) {
  32.317          SDL_memcpy(dst, src, length*h);
  32.318      } else {
  32.319 @@ -1032,7 +839,7 @@
  32.320          usage = 0;
  32.321      }
  32.322  
  32.323 -    if (D3D_CreateTextureRep(data->device, &texturedata->texture, usage, texture->format, texture->w, texture->h) < 0) {
  32.324 +    if (D3D_CreateTextureRep(data->device, &texturedata->texture, usage, texture->format, PixelFormatToD3DFMT(texture->format), texture->w, texture->h) < 0) {
  32.325          return -1;
  32.326      }
  32.327  
  32.328 @@ -1040,11 +847,11 @@
  32.329          texture->format == SDL_PIXELFORMAT_IYUV) {
  32.330          texturedata->yuv = SDL_TRUE;
  32.331  
  32.332 -        if (D3D_CreateTextureRep(data->device, &texturedata->utexture, usage, texture->format, texture->w / 2, texture->h / 2) < 0) {
  32.333 +        if (D3D_CreateTextureRep(data->device, &texturedata->utexture, usage, texture->format, PixelFormatToD3DFMT(texture->format), (texture->w + 1) / 2, (texture->h + 1) / 2) < 0) {
  32.334              return -1;
  32.335          }
  32.336  
  32.337 -        if (D3D_CreateTextureRep(data->device, &texturedata->vtexture, usage, texture->format, texture->w / 2, texture->h / 2) < 0) {
  32.338 +        if (D3D_CreateTextureRep(data->device, &texturedata->vtexture, usage, texture->format, PixelFormatToD3DFMT(texture->format), (texture->w + 1) / 2, (texture->h + 1) / 2) < 0) {
  32.339              return -1;
  32.340          }
  32.341      }
  32.342 @@ -1061,16 +868,16 @@
  32.343          return 0;
  32.344      }
  32.345  
  32.346 -    if (D3D_RecreateTextureRep(data->device, &texturedata->texture, texture->format, texture->w, texture->h) < 0) {
  32.347 +    if (D3D_RecreateTextureRep(data->device, &texturedata->texture) < 0) {
  32.348          return -1;
  32.349      }
  32.350  
  32.351      if (texturedata->yuv) {
  32.352 -        if (D3D_RecreateTextureRep(data->device, &texturedata->utexture, texture->format, texture->w / 2, texture->h / 2) < 0) {
  32.353 +        if (D3D_RecreateTextureRep(data->device, &texturedata->utexture) < 0) {
  32.354              return -1;
  32.355          }
  32.356  
  32.357 -        if (D3D_RecreateTextureRep(data->device, &texturedata->vtexture, texture->format, texture->w / 2, texture->h / 2) < 0) {
  32.358 +        if (D3D_RecreateTextureRep(data->device, &texturedata->vtexture) < 0) {
  32.359              return -1;
  32.360          }
  32.361      }
  32.362 @@ -1089,7 +896,7 @@
  32.363          return -1;
  32.364      }
  32.365  
  32.366 -    if (D3D_UpdateTextureRep(data->device, &texturedata->texture, texture->format, rect->x, rect->y, rect->w, rect->h, pixels, pitch) < 0) {
  32.367 +    if (D3D_UpdateTextureRep(data->device, &texturedata->texture, rect->x, rect->y, rect->w, rect->h, pixels, pitch) < 0) {
  32.368          return -1;
  32.369      }
  32.370  
  32.371 @@ -1097,13 +904,13 @@
  32.372          /* Skip to the correct offset into the next texture */
  32.373          pixels = (const void*)((const Uint8*)pixels + rect->h * pitch);
  32.374  
  32.375 -        if (D3D_UpdateTextureRep(data->device, texture->format == SDL_PIXELFORMAT_YV12 ? &texturedata->vtexture : &texturedata->utexture, texture->format, rect->x / 2, rect->y / 2, rect->w / 2, rect->h / 2, pixels, pitch / 2) < 0) {
  32.376 +        if (D3D_UpdateTextureRep(data->device, texture->format == SDL_PIXELFORMAT_YV12 ? &texturedata->vtexture : &texturedata->utexture, rect->x / 2, rect->y / 2, (rect->w + 1) / 2, (rect->h + 1) / 2, pixels, (pitch + 1) / 2) < 0) {
  32.377              return -1;
  32.378          }
  32.379  
  32.380          /* Skip to the correct offset into the next texture */
  32.381 -        pixels = (const void*)((const Uint8*)pixels + (rect->h * pitch)/4);
  32.382 -        if (D3D_UpdateTextureRep(data->device, texture->format == SDL_PIXELFORMAT_YV12 ? &texturedata->utexture : &texturedata->vtexture, texture->format, rect->x / 2, rect->y / 2, rect->w / 2, rect->h / 2, pixels, pitch / 2) < 0) {
  32.383 +        pixels = (const void*)((const Uint8*)pixels + ((rect->h + 1) / 2) * ((pitch + 1) / 2));
  32.384 +        if (D3D_UpdateTextureRep(data->device, texture->format == SDL_PIXELFORMAT_YV12 ? &texturedata->utexture : &texturedata->vtexture, rect->x / 2, (rect->y + 1) / 2, (rect->w + 1) / 2, (rect->h + 1) / 2, pixels, (pitch + 1) / 2) < 0) {
  32.385              return -1;
  32.386          }
  32.387      }
  32.388 @@ -1125,13 +932,13 @@
  32.389          return -1;
  32.390      }
  32.391  
  32.392 -    if (D3D_UpdateTextureRep(data->device, &texturedata->texture, texture->format, rect->x, rect->y, rect->w, rect->h, Yplane, Ypitch) < 0) {
  32.393 +    if (D3D_UpdateTextureRep(data->device, &texturedata->texture, rect->x, rect->y, rect->w, rect->h, Yplane, Ypitch) < 0) {
  32.394          return -1;
  32.395      }
  32.396 -    if (D3D_UpdateTextureRep(data->device, &texturedata->utexture, texture->format, rect->x / 2, rect->y / 2, rect->w / 2, rect->h / 2, Uplane, Upitch) < 0) {
  32.397 +    if (D3D_UpdateTextureRep(data->device, &texturedata->utexture, rect->x / 2, rect->y / 2, (rect->w + 1) / 2, (rect->h + 1) / 2, Uplane, Upitch) < 0) {
  32.398          return -1;
  32.399      }
  32.400 -    if (D3D_UpdateTextureRep(data->device, &texturedata->vtexture, texture->format, rect->x / 2, rect->y / 2, rect->w / 2, rect->h / 2, Vplane, Vpitch) < 0) {
  32.401 +    if (D3D_UpdateTextureRep(data->device, &texturedata->vtexture, rect->x / 2, rect->y / 2, (rect->w + 1) / 2, (rect->h + 1) / 2, Vplane, Vpitch) < 0) {
  32.402          return -1;
  32.403      }
  32.404      return 0;
  32.405 @@ -1610,12 +1417,59 @@
  32.406  }
  32.407  
  32.408  static int
  32.409 +D3D_RenderSetupTextureState(SDL_Renderer * renderer, SDL_Texture * texture, LPDIRECT3DPIXELSHADER9 *shader)
  32.410 +{
  32.411 +    D3D_RenderData *data = (D3D_RenderData *) renderer->driverdata;
  32.412 +    D3D_TextureData *texturedata;
  32.413 +
  32.414 +    *shader = NULL;
  32.415 +
  32.416 +    texturedata = (D3D_TextureData *)texture->driverdata;
  32.417 +    if (!texturedata) {
  32.418 +        SDL_SetError("Texture is not currently available");
  32.419 +        return -1;
  32.420 +    }
  32.421 +
  32.422 +    D3D_UpdateTextureScaleMode(data, texturedata, 0);
  32.423 +
  32.424 +    if (D3D_BindTextureRep(data->device, &texturedata->texture, 0) < 0) {
  32.425 +        return -1;
  32.426 +    }
  32.427 +
  32.428 +    if (texturedata->yuv) {
  32.429 +        switch (SDL_GetYUVConversionModeForResolution(texture->w, texture->h)) {
  32.430 +        case SDL_YUV_CONVERSION_JPEG:
  32.431 +            *shader = data->shaders[SHADER_YUV_JPEG];
  32.432 +            break;
  32.433 +        case SDL_YUV_CONVERSION_BT601:
  32.434 +            *shader = data->shaders[SHADER_YUV_BT601];
  32.435 +            break;
  32.436 +        case SDL_YUV_CONVERSION_BT709:
  32.437 +            *shader = data->shaders[SHADER_YUV_BT709];
  32.438 +            break;
  32.439 +        default:
  32.440 +            return SDL_SetError("Unsupported YUV conversion mode");
  32.441 +        }
  32.442 +
  32.443 +        D3D_UpdateTextureScaleMode(data, texturedata, 1);
  32.444 +        D3D_UpdateTextureScaleMode(data, texturedata, 2);
  32.445 +
  32.446 +        if (D3D_BindTextureRep(data->device, &texturedata->utexture, 1) < 0) {
  32.447 +            return -1;
  32.448 +        }
  32.449 +        if (D3D_BindTextureRep(data->device, &texturedata->vtexture, 2) < 0) {
  32.450 +            return -1;
  32.451 +        }
  32.452 +    }
  32.453 +    return 0;
  32.454 +}
  32.455 +
  32.456 +static int
  32.457  D3D_RenderCopy(SDL_Renderer * renderer, SDL_Texture * texture,
  32.458                 const SDL_Rect * srcrect, const SDL_FRect * dstrect)
  32.459  {
  32.460      D3D_RenderData *data = (D3D_RenderData *) renderer->driverdata;
  32.461 -    D3D_TextureData *texturedata;
  32.462 -    LPDIRECT3DPIXELSHADER9 shader = NULL;
  32.463 +    LPDIRECT3DPIXELSHADER9 shader;
  32.464      float minx, miny, maxx, maxy;
  32.465      float minu, maxu, minv, maxv;
  32.466      DWORD color;
  32.467 @@ -1626,12 +1480,6 @@
  32.468          return -1;
  32.469      }
  32.470  
  32.471 -    texturedata = (D3D_TextureData *)texture->driverdata;
  32.472 -    if (!texturedata) {
  32.473 -        SDL_SetError("Texture is not currently available");
  32.474 -        return -1;
  32.475 -    }
  32.476 -
  32.477      minx = dstrect->x - 0.5f;
  32.478      miny = dstrect->y - 0.5f;
  32.479      maxx = dstrect->x + dstrect->w - 0.5f;
  32.480 @@ -1674,45 +1522,25 @@
  32.481  
  32.482      D3D_SetBlendMode(data, texture->blendMode);
  32.483  
  32.484 -    D3D_UpdateTextureScaleMode(data, texturedata, 0);
  32.485 -
  32.486 -    if (D3D_BindTextureRep(data->device, &texturedata->texture, 0) < 0) {
  32.487 +    if (D3D_RenderSetupTextureState(renderer, texture, &shader) < 0) {
  32.488          return -1;
  32.489      }
  32.490 -
  32.491 -    if (texturedata->yuv) {
  32.492 -        shader = data->ps_yuv;
  32.493 -
  32.494 -        D3D_UpdateTextureScaleMode(data, texturedata, 1);
  32.495 -        D3D_UpdateTextureScaleMode(data, texturedata, 2);
  32.496 -
  32.497 -        if (D3D_BindTextureRep(data->device, &texturedata->utexture, 1) < 0) {
  32.498 -            return -1;
  32.499 -        }
  32.500 -        if (D3D_BindTextureRep(data->device, &texturedata->vtexture, 2) < 0) {
  32.501 -            return -1;
  32.502 -        }
  32.503 -    }
  32.504 -
  32.505 +    
  32.506      if (shader) {
  32.507          result = IDirect3DDevice9_SetPixelShader(data->device, shader);
  32.508          if (FAILED(result)) {
  32.509              return D3D_SetError("SetShader()", result);
  32.510          }
  32.511      }
  32.512 -    result =
  32.513 -        IDirect3DDevice9_DrawPrimitiveUP(data->device, D3DPT_TRIANGLEFAN, 2,
  32.514 -                                         vertices, sizeof(*vertices));
  32.515 +    result = IDirect3DDevice9_DrawPrimitiveUP(data->device, D3DPT_TRIANGLEFAN, 2,
  32.516 +                                              vertices, sizeof(*vertices));
  32.517      if (FAILED(result)) {
  32.518 -        return D3D_SetError("DrawPrimitiveUP()", result);
  32.519 +        D3D_SetError("DrawPrimitiveUP()", result);
  32.520      }
  32.521      if (shader) {
  32.522 -        result = IDirect3DDevice9_SetPixelShader(data->device, NULL);
  32.523 -        if (FAILED(result)) {
  32.524 -            return D3D_SetError("SetShader()", result);
  32.525 -        }
  32.526 +        IDirect3DDevice9_SetPixelShader(data->device, NULL);
  32.527      }
  32.528 -    return 0;
  32.529 +    return FAILED(result) ? -1 : 0;
  32.530  }
  32.531  
  32.532  
  32.533 @@ -1722,7 +1550,6 @@
  32.534                 const double angle, const SDL_FPoint * center, const SDL_RendererFlip flip)
  32.535  {
  32.536      D3D_RenderData *data = (D3D_RenderData *) renderer->driverdata;
  32.537 -    D3D_TextureData *texturedata;
  32.538      LPDIRECT3DPIXELSHADER9 shader = NULL;
  32.539      float minx, miny, maxx, maxy;
  32.540      float minu, maxu, minv, maxv;
  32.541 @@ -1736,12 +1563,6 @@
  32.542          return -1;
  32.543      }
  32.544  
  32.545 -    texturedata = (D3D_TextureData *)texture->driverdata;
  32.546 -    if (!texturedata) {
  32.547 -        SDL_SetError("Texture is not currently available");
  32.548 -        return -1;
  32.549 -    }
  32.550 -
  32.551      centerx = center->x;
  32.552      centery = center->y;
  32.553  
  32.554 @@ -1798,54 +1619,37 @@
  32.555  
  32.556      D3D_SetBlendMode(data, texture->blendMode);
  32.557  
  32.558 +    if (D3D_RenderSetupTextureState(renderer, texture, &shader) < 0) {
  32.559 +        return -1;
  32.560 +    }
  32.561 +
  32.562      /* Rotate and translate */
  32.563      modelMatrix = MatrixMultiply(
  32.564              MatrixRotationZ((float)(M_PI * (float) angle / 180.0f)),
  32.565              MatrixTranslation(dstrect->x + center->x - 0.5f, dstrect->y + center->y - 0.5f, 0));
  32.566      IDirect3DDevice9_SetTransform(data->device, D3DTS_VIEW, (D3DMATRIX*)&modelMatrix);
  32.567 -
  32.568 -    D3D_UpdateTextureScaleMode(data, texturedata, 0);
  32.569 -
  32.570 -    if (D3D_BindTextureRep(data->device, &texturedata->texture, 0) < 0) {
  32.571 -        return -1;
  32.572 -    }
  32.573 -
  32.574 -    if (texturedata->yuv) {
  32.575 -        shader = data->ps_yuv;
  32.576 -
  32.577 -        D3D_UpdateTextureScaleMode(data, texturedata, 1);
  32.578 -        D3D_UpdateTextureScaleMode(data, texturedata, 2);
  32.579 -        
  32.580 -        if (D3D_BindTextureRep(data->device, &texturedata->utexture, 1) < 0) {
  32.581 -            return -1;
  32.582 -        }
  32.583 -        if (D3D_BindTextureRep(data->device, &texturedata->vtexture, 2) < 0) {
  32.584 -            return -1;
  32.585 -        }
  32.586 -    }
  32.587 -
  32.588 +    
  32.589      if (shader) {
  32.590          result = IDirect3DDevice9_SetPixelShader(data->device, shader);
  32.591          if (FAILED(result)) {
  32.592 -            return D3D_SetError("SetShader()", result);
  32.593 +            D3D_SetError("SetShader()", result);
  32.594 +            goto done;
  32.595          }
  32.596      }
  32.597 -    result =
  32.598 -        IDirect3DDevice9_DrawPrimitiveUP(data->device, D3DPT_TRIANGLEFAN, 2,
  32.599 -                                         vertices, sizeof(*vertices));
  32.600 +    result = IDirect3DDevice9_DrawPrimitiveUP(data->device, D3DPT_TRIANGLEFAN, 2,
  32.601 +                                              vertices, sizeof(*vertices));
  32.602      if (FAILED(result)) {
  32.603 -        return D3D_SetError("DrawPrimitiveUP()", result);
  32.604 +        D3D_SetError("DrawPrimitiveUP()", result);
  32.605      }
  32.606 +done:
  32.607      if (shader) {
  32.608 -        result = IDirect3DDevice9_SetPixelShader(data->device, NULL);
  32.609 -        if (FAILED(result)) {
  32.610 -            return D3D_SetError("SetShader()", result);
  32.611 -        }
  32.612 +        IDirect3DDevice9_SetPixelShader(data->device, NULL);
  32.613      }
  32.614  
  32.615      modelMatrix = MatrixIdentity();
  32.616      IDirect3DDevice9_SetTransform(data->device, D3DTS_VIEW, (D3DMATRIX*)&modelMatrix);
  32.617 -    return 0;
  32.618 +
  32.619 +    return FAILED(result) ? -1 : 0;
  32.620  }
  32.621  
  32.622  static int
  32.623 @@ -1955,6 +1759,8 @@
  32.624      D3D_RenderData *data = (D3D_RenderData *) renderer->driverdata;
  32.625  
  32.626      if (data) {
  32.627 +        int i;
  32.628 +
  32.629          /* Release the render target */
  32.630          if (data->defaultRenderTarget) {
  32.631              IDirect3DSurface9_Release(data->defaultRenderTarget);
  32.632 @@ -1964,11 +1770,15 @@
  32.633              IDirect3DSurface9_Release(data->currentRenderTarget);
  32.634              data->currentRenderTarget = NULL;
  32.635          }
  32.636 -        if (data->ps_yuv) {
  32.637 -            IDirect3DPixelShader9_Release(data->ps_yuv);
  32.638 +        for (i = 0; i < SDL_arraysize(data->shaders); ++i) {
  32.639 +            if (data->shaders[i]) {
  32.640 +                IDirect3DPixelShader9_Release(data->shaders[i]);
  32.641 +                data->shaders[i] = NULL;
  32.642 +            }
  32.643          }
  32.644          if (data->device) {
  32.645              IDirect3DDevice9_Release(data->device);
  32.646 +            data->device = NULL;
  32.647          }
  32.648          if (data->d3d) {
  32.649              IDirect3D9_Release(data->d3d);
    33.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    33.2 +++ b/src/render/direct3d/SDL_shaders_d3d.c	Sun Nov 12 22:51:12 2017 -0800
    33.3 @@ -0,0 +1,274 @@
    33.4 +/*
    33.5 +  Simple DirectMedia Layer
    33.6 +  Copyright (C) 1997-2017 Sam Lantinga <slouken@libsdl.org>
    33.7 +
    33.8 +  This software is provided 'as-is', without any express or implied
    33.9 +  warranty.  In no event will the authors be held liable for any damages
   33.10 +  arising from the use of this software.
   33.11 +
   33.12 +  Permission is granted to anyone to use this software for any purpose,
   33.13 +  including commercial applications, and to alter it and redistribute it
   33.14 +  freely, subject to the following restrictions:
   33.15 +
   33.16 +  1. The origin of this software must not be misrepresented; you must not
   33.17 +     claim that you wrote the original software. If you use this software
   33.18 +     in a product, an acknowledgment in the product documentation would be
   33.19 +     appreciated but is not required.
   33.20 +  2. Altered source versions must be plainly marked as such, and must not be
   33.21 +     misrepresented as being the original software.
   33.22 +  3. This notice may not be removed or altered from any source distribution.
   33.23 +*/
   33.24 +#include "../../SDL_internal.h"
   33.25 +
   33.26 +#include "SDL_render.h"
   33.27 +#include "SDL_system.h"
   33.28 +
   33.29 +#if SDL_VIDEO_RENDER_D3D && !SDL_RENDER_DISABLED
   33.30 +
   33.31 +#include "../../core/windows/SDL_windows.h"
   33.32 +
   33.33 +#include <d3d9.h>
   33.34 +
   33.35 +#include "SDL_shaders_d3d.h"
   33.36 +
   33.37 +/* The shaders here were compiled with:
   33.38 +
   33.39 +       fxc /T ps_2_0 /Fo"<OUTPUT FILE>" "<INPUT FILE>"
   33.40 +
   33.41 +   Shader object code was converted to a list of DWORDs via the following
   33.42 +   *nix style command (available separately from Windows + MSVC):
   33.43 +
   33.44 +     hexdump -v -e '6/4 "0x%08.8x, " "\n"' <FILE>
   33.45 +*/
   33.46 +
   33.47 +/* --- D3D9_PixelShader_YUV_JPEG.hlsl ---
   33.48 +    Texture2D theTextureY : register(t0);
   33.49 +    Texture2D theTextureU : register(t1);
   33.50 +    Texture2D theTextureV : register(t2);
   33.51 +    SamplerState theSampler = sampler_state
   33.52 +    {
   33.53 +        addressU = Clamp;
   33.54 +        addressV = Clamp;
   33.55 +        mipfilter = NONE;
   33.56 +        minfilter = LINEAR;
   33.57 +        magfilter = LINEAR;
   33.58 +    };
   33.59 +
   33.60 +    struct PixelShaderInput
   33.61 +    {
   33.62 +        float4 pos : SV_POSITION;
   33.63 +        float2 tex : TEXCOORD0;
   33.64 +        float4 color : COLOR0;
   33.65 +    };
   33.66 +
   33.67 +    float4 main(PixelShaderInput input) : SV_TARGET
   33.68 +    {
   33.69 +        const float3 offset = {0.0, -0.501960814, -0.501960814};
   33.70 +        const float3 Rcoeff = {1.0000,  0.0000,  1.4020};
   33.71 +        const float3 Gcoeff = {1.0000, -0.3441, -0.7141};
   33.72 +        const float3 Bcoeff = {1.0000,  1.7720,  0.0000};
   33.73 +
   33.74 +        float4 Output;
   33.75 +
   33.76 +        float3 yuv;
   33.77 +        yuv.x = theTextureY.Sample(theSampler, input.tex).r;
   33.78 +        yuv.y = theTextureU.Sample(theSampler, input.tex).r;
   33.79 +        yuv.z = theTextureV.Sample(theSampler, input.tex).r;
   33.80 +
   33.81 +        yuv += offset;
   33.82 +        Output.r = dot(yuv, Rcoeff);
   33.83 +        Output.g = dot(yuv, Gcoeff);
   33.84 +        Output.b = dot(yuv, Bcoeff);
   33.85 +        Output.a = 1.0f;
   33.86 +
   33.87 +        return Output * input.color;
   33.88 +    }
   33.89 +*/
   33.90 +static const DWORD D3D9_PixelShader_YUV_JPEG[] = {
   33.91 +    0xffff0200, 0x0044fffe, 0x42415443, 0x0000001c, 0x000000d7, 0xffff0200,
   33.92 +    0x00000003, 0x0000001c, 0x00000100, 0x000000d0, 0x00000058, 0x00010003,
   33.93 +    0x00000001, 0x00000070, 0x00000000, 0x00000080, 0x00020003, 0x00000001,
   33.94 +    0x00000098, 0x00000000, 0x000000a8, 0x00000003, 0x00000001, 0x000000c0,
   33.95 +    0x00000000, 0x53656874, 0x6c706d61, 0x742b7265, 0x65546568, 0x72757478,
   33.96 +    0xab005565, 0x00070004, 0x00040001, 0x00000001, 0x00000000, 0x53656874,
   33.97 +    0x6c706d61, 0x742b7265, 0x65546568, 0x72757478, 0xab005665, 0x00070004,
   33.98 +    0x00040001, 0x00000001, 0x00000000, 0x53656874, 0x6c706d61, 0x742b7265,
   33.99 +    0x65546568, 0x72757478, 0xab005965, 0x00070004, 0x00040001, 0x00000001,
  33.100 +    0x00000000, 0x325f7370, 0x4d00305f, 0x6f726369, 0x74666f73, 0x29522820,
  33.101 +    0x534c4820, 0x6853204c, 0x72656461, 0x6d6f4320, 0x656c6970, 0x2e362072,
  33.102 +    0x36392e33, 0x312e3030, 0x34383336, 0xababab00, 0x05000051, 0xa00f0000,
  33.103 +    0x00000000, 0xbf008081, 0xbf008081, 0x3f800000, 0x05000051, 0xa00f0001,
  33.104 +    0x3f800000, 0x00000000, 0x3fb374bc, 0x00000000, 0x05000051, 0xa00f0002,
  33.105 +    0x3f800000, 0xbeb02de0, 0xbf36cf42, 0x00000000, 0x05000051, 0xa00f0003,
  33.106 +    0x3f800000, 0x3fe2d0e5, 0x00000000, 0x00000000, 0x0200001f, 0x80000000,
  33.107 +    0xb0030000, 0x0200001f, 0x80000000, 0x900f0000, 0x0200001f, 0x90000000,
  33.108 +    0xa00f0800, 0x0200001f, 0x90000000, 0xa00f0801, 0x0200001f, 0x90000000,
  33.109 +    0xa00f0802, 0x03000042, 0x800f0000, 0xb0e40000, 0xa0e40800, 0x03000042,
  33.110 +    0x800f0001, 0xb0e40000, 0xa0e40801, 0x03000042, 0x800f0002, 0xb0e40000,
  33.111 +    0xa0e40802, 0x02000001, 0x80020000, 0x80000001, 0x02000001, 0x80040000,
  33.112 +    0x80000002, 0x03000002, 0x80070000, 0x80e40000, 0xa0e40000, 0x03000008,
  33.113 +    0x80010001, 0x80e40000, 0xa0e40001, 0x03000008, 0x80020001, 0x80e40000,
  33.114 +    0xa0e40002, 0x0400005a, 0x80040001, 0x80e40000, 0xa0e40003, 0xa0aa0003,
  33.115 +    0x02000001, 0x80080001, 0xa0ff0000, 0x03000005, 0x800f0000, 0x80e40001,
  33.116 +    0x90e40000, 0x02000001, 0x800f0800, 0x80e40000, 0x0000ffff
  33.117 +};
  33.118 +
  33.119 +/* --- D3D9_PixelShader_YUV_BT601.hlsl ---
  33.120 +    Texture2D theTextureY : register(t0);
  33.121 +    Texture2D theTextureU : register(t1);
  33.122 +    Texture2D theTextureV : register(t2);
  33.123 +    SamplerState theSampler = sampler_state
  33.124 +    {
  33.125 +        addressU = Clamp;
  33.126 +        addressV = Clamp;
  33.127 +        mipfilter = NONE;
  33.128 +        minfilter = LINEAR;
  33.129 +        magfilter = LINEAR;
  33.130 +    };
  33.131 +
  33.132 +    struct PixelShaderInput
  33.133 +    {
  33.134 +        float4 pos : SV_POSITION;
  33.135 +        float2 tex : TEXCOORD0;
  33.136 +        float4 color : COLOR0;
  33.137 +    };
  33.138 +
  33.139 +    float4 main(PixelShaderInput input) : SV_TARGET
  33.140 +    {
  33.141 +        const float3 offset = {-0.0627451017, -0.501960814, -0.501960814};
  33.142 +        const float3 Rcoeff = {1.1644,  0.0000,  1.5960};
  33.143 +        const float3 Gcoeff = {1.1644, -0.3918, -0.8130};
  33.144 +        const float3 Bcoeff = {1.1644,  2.0172,  0.0000};
  33.145 +
  33.146 +        float4 Output;
  33.147 +
  33.148 +        float3 yuv;
  33.149 +        yuv.x = theTextureY.Sample(theSampler, input.tex).r;
  33.150 +        yuv.y = theTextureU.Sample(theSampler, input.tex).r;
  33.151 +        yuv.z = theTextureV.Sample(theSampler, input.tex).r;
  33.152 +
  33.153 +        yuv += offset;
  33.154 +        Output.r = dot(yuv, Rcoeff);
  33.155 +        Output.g = dot(yuv, Gcoeff);
  33.156 +        Output.b = dot(yuv, Bcoeff);
  33.157 +        Output.a = 1.0f;
  33.158 +
  33.159 +        return Output * input.color;
  33.160 +    }
  33.161 +*/
  33.162 +static const DWORD D3D9_PixelShader_YUV_BT601[] = {
  33.163 +    0xffff0200, 0x0044fffe, 0x42415443, 0x0000001c, 0x000000d7, 0xffff0200,
  33.164 +    0x00000003, 0x0000001c, 0x00000100, 0x000000d0, 0x00000058, 0x00010003,
  33.165 +    0x00000001, 0x00000070, 0x00000000, 0x00000080, 0x00020003, 0x00000001,
  33.166 +    0x00000098, 0x00000000, 0x000000a8, 0x00000003, 0x00000001, 0x000000c0,
  33.167 +    0x00000000, 0x53656874, 0x6c706d61, 0x742b7265, 0x65546568, 0x72757478,
  33.168 +    0xab005565, 0x00070004, 0x00040001, 0x00000001, 0x00000000, 0x53656874,
  33.169 +    0x6c706d61, 0x742b7265, 0x65546568, 0x72757478, 0xab005665, 0x00070004,
  33.170 +    0x00040001, 0x00000001, 0x00000000, 0x53656874, 0x6c706d61, 0x742b7265,
  33.171 +    0x65546568, 0x72757478, 0xab005965, 0x00070004, 0x00040001, 0x00000001,
  33.172 +    0x00000000, 0x325f7370, 0x4d00305f, 0x6f726369, 0x74666f73, 0x29522820,
  33.173 +    0x534c4820, 0x6853204c, 0x72656461, 0x6d6f4320, 0x656c6970, 0x2e362072,
  33.174 +    0x36392e33, 0x312e3030, 0x34383336, 0xababab00, 0x05000051, 0xa00f0000,
  33.175 +    0xbd808081, 0xbf008081, 0xbf008081, 0x3f800000, 0x05000051, 0xa00f0001,
  33.176 +    0x3f950b0f, 0x00000000, 0x3fcc49ba, 0x00000000, 0x05000051, 0xa00f0002,
  33.177 +    0x3f950b0f, 0xbec89a02, 0xbf5020c5, 0x00000000, 0x05000051, 0xa00f0003,
  33.178 +    0x3f950b0f, 0x400119ce, 0x00000000, 0x00000000, 0x0200001f, 0x80000000,
  33.179 +    0xb0030000, 0x0200001f, 0x80000000, 0x900f0000, 0x0200001f, 0x90000000,
  33.180 +    0xa00f0800, 0x0200001f, 0x90000000, 0xa00f0801, 0x0200001f, 0x90000000,
  33.181 +    0xa00f0802, 0x03000042, 0x800f0000, 0xb0e40000, 0xa0e40800, 0x03000042,
  33.182 +    0x800f0001, 0xb0e40000, 0xa0e40801, 0x03000042, 0x800f0002, 0xb0e40000,
  33.183 +    0xa0e40802, 0x02000001, 0x80020000, 0x80000001, 0x02000001, 0x80040000,
  33.184 +    0x80000002, 0x03000002, 0x80070000, 0x80e40000, 0xa0e40000, 0x03000008,
  33.185 +    0x80010001, 0x80e40000, 0xa0e40001, 0x03000008, 0x80020001, 0x80e40000,
  33.186 +    0xa0e40002, 0x0400005a, 0x80040001, 0x80e40000, 0xa0e40003, 0xa0aa0003,
  33.187 +    0x02000001, 0x80080001, 0xa0ff0000, 0x03000005, 0x800f0000, 0x80e40001,
  33.188 +    0x90e40000, 0x02000001, 0x800f0800, 0x80e40000, 0x0000ffff
  33.189 +};
  33.190 +
  33.191 +/* --- D3D9_PixelShader_YUV_BT709.hlsl ---
  33.192 +    Texture2D theTextureY : register(t0);
  33.193 +    Texture2D theTextureU : register(t1);
  33.194 +    Texture2D theTextureV : register(t2);
  33.195 +    SamplerState theSampler = sampler_state
  33.196 +    {
  33.197 +        addressU = Clamp;
  33.198 +        addressV = Clamp;
  33.199 +        mipfilter = NONE;
  33.200 +        minfilter = LINEAR;
  33.201 +        magfilter = LINEAR;
  33.202 +    };
  33.203 +
  33.204 +    struct PixelShaderInput
  33.205 +    {
  33.206 +        float4 pos : SV_POSITION;
  33.207 +        float2 tex : TEXCOORD0;
  33.208 +        float4 color : COLOR0;
  33.209 +    };
  33.210 +
  33.211 +    float4 main(PixelShaderInput input) : SV_TARGET
  33.212 +    {
  33.213 +        const float3 offset = {-0.0627451017, -0.501960814, -0.501960814};
  33.214 +        const float3 Rcoeff = {1.1644,  0.0000,  1.7927};
  33.215 +        const float3 Gcoeff = {1.1644, -0.2132, -0.5329};
  33.216 +        const float3 Bcoeff = {1.1644,  2.1124,  0.0000};
  33.217 +
  33.218 +        float4 Output;
  33.219 +
  33.220 +        float3 yuv;
  33.221 +        yuv.x = theTextureY.Sample(theSampler, input.tex).r;
  33.222 +        yuv.y = theTextureU.Sample(theSampler, input.tex).r;
  33.223 +        yuv.z = theTextureV.Sample(theSampler, input.tex).r;
  33.224 +
  33.225 +        yuv += offset;
  33.226 +        Output.r = dot(yuv, Rcoeff);
  33.227 +        Output.g = dot(yuv, Gcoeff);
  33.228 +        Output.b = dot(yuv, Bcoeff);
  33.229 +        Output.a = 1.0f;
  33.230 +
  33.231 +        return Output * input.color;
  33.232 +    }
  33.233 +*/
  33.234 +static const DWORD D3D9_PixelShader_YUV_BT709[] = {
  33.235 +    0xffff0200, 0x0044fffe, 0x42415443, 0x0000001c, 0x000000d7, 0xffff0200,
  33.236 +    0x00000003, 0x0000001c, 0x00000100, 0x000000d0, 0x00000058, 0x00010003,
  33.237 +    0x00000001, 0x00000070, 0x00000000, 0x00000080, 0x00020003, 0x00000001,
  33.238 +    0x00000098, 0x00000000, 0x000000a8, 0x00000003, 0x00000001, 0x000000c0,
  33.239 +    0x00000000, 0x53656874, 0x6c706d61, 0x742b7265, 0x65546568, 0x72757478,
  33.240 +    0xab005565, 0x00070004, 0x00040001, 0x00000001, 0x00000000, 0x53656874,
  33.241 +    0x6c706d61, 0x742b7265, 0x65546568, 0x72757478, 0xab005665, 0x00070004,
  33.242 +    0x00040001, 0x00000001, 0x00000000, 0x53656874, 0x6c706d61, 0x742b7265,
  33.243 +    0x65546568, 0x72757478, 0xab005965, 0x00070004, 0x00040001, 0x00000001,
  33.244 +    0x00000000, 0x325f7370, 0x4d00305f, 0x6f726369, 0x74666f73, 0x29522820,
  33.245 +    0x534c4820, 0x6853204c, 0x72656461, 0x6d6f4320, 0x656c6970, 0x2e362072,
  33.246 +    0x36392e33, 0x312e3030, 0x34383336, 0xababab00, 0x05000051, 0xa00f0000,
  33.247 +    0xbd808081, 0xbf008081, 0xbf008081, 0x3f800000, 0x05000051, 0xa00f0001,
  33.248 +    0x3f950b0f, 0x00000000, 0x3fe57732, 0x00000000, 0x05000051, 0xa00f0002,
  33.249 +    0x3f950b0f, 0xbe5a511a, 0xbf086c22, 0x00000000, 0x05000051, 0xa00f0003,
  33.250 +    0x3f950b0f, 0x40073190, 0x00000000, 0x00000000, 0x0200001f, 0x80000000,
  33.251 +    0xb0030000, 0x0200001f, 0x80000000, 0x900f0000, 0x0200001f, 0x90000000,
  33.252 +    0xa00f0800, 0x0200001f, 0x90000000, 0xa00f0801, 0x0200001f, 0x90000000,
  33.253 +    0xa00f0802, 0x03000042, 0x800f0000, 0xb0e40000, 0xa0e40800, 0x03000042,
  33.254 +    0x800f0001, 0xb0e40000, 0xa0e40801, 0x03000042, 0x800f0002, 0xb0e40000,
  33.255 +    0xa0e40802, 0x02000001, 0x80020000, 0x80000001, 0x02000001, 0x80040000,
  33.256 +    0x80000002, 0x03000002, 0x80070000, 0x80e40000, 0xa0e40000, 0x03000008,
  33.257 +    0x80010001, 0x80e40000, 0xa0e40001, 0x03000008, 0x80020001, 0x80e40000,
  33.258 +    0xa0e40002, 0x0400005a, 0x80040001, 0x80e40000, 0xa0e40003, 0xa0aa0003,
  33.259 +    0x02000001, 0x80080001, 0xa0ff0000, 0x03000005, 0x800f0000, 0x80e40001,
  33.260 +    0x90e40000, 0x02000001, 0x800f0800, 0x80e40000, 0x0000ffff
  33.261 +};
  33.262 +
  33.263 +
  33.264 +static const DWORD *D3D9_shaders[] = {
  33.265 +    D3D9_PixelShader_YUV_JPEG,
  33.266 +    D3D9_PixelShader_YUV_BT601,
  33.267 +    D3D9_PixelShader_YUV_BT709,
  33.268 +};
  33.269 +
  33.270 +HRESULT D3D9_CreatePixelShader(IDirect3DDevice9 *d3dDevice, D3D9_Shader shader, IDirect3DPixelShader9 **pixelShader)
  33.271 +{
  33.272 +    return IDirect3DDevice9_CreatePixelShader(d3dDevice, D3D9_shaders[shader], pixelShader);
  33.273 +}
  33.274 +
  33.275 +#endif /* SDL_VIDEO_RENDER_D3D && !SDL_RENDER_DISABLED */
  33.276 +
  33.277 +/* vi: set ts=4 sw=4 expandtab: */
    34.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    34.2 +++ b/src/render/direct3d/SDL_shaders_d3d.h	Sun Nov 12 22:51:12 2017 -0800
    34.3 @@ -0,0 +1,34 @@
    34.4 +/*
    34.5 +  Simple DirectMedia Layer
    34.6 +  Copyright (C) 1997-2017 Sam Lantinga <slouken@libsdl.org>
    34.7 +
    34.8 +  This software is provided 'as-is', without any express or implied
    34.9 +  warranty.  In no event will the authors be held liable for any damages
   34.10 +  arising from the use of this software.
   34.11 +
   34.12 +  Permission is granted to anyone to use this software for any purpose,
   34.13 +  including commercial applications, and to alter it and redistribute it
   34.14 +  freely, subject to the following restrictions:
   34.15 +
   34.16 +  1. The origin of this software must not be misrepresented; you must not
   34.17 +     claim that you wrote the original software. If you use this software
   34.18 +     in a product, an acknowledgment in the product documentation would be
   34.19 +     appreciated but is not required.
   34.20 +  2. Altered source versions must be plainly marked as such, and must not be
   34.21 +     misrepresented as being the original software.
   34.22 +  3. This notice may not be removed or altered from any source distribution.
   34.23 +*/
   34.24 +#include "../../SDL_internal.h"
   34.25 +
   34.26 +/* D3D9 shader implementation */
   34.27 +
   34.28 +typedef enum {
   34.29 +    SHADER_YUV_JPEG,
   34.30 +    SHADER_YUV_BT601,
   34.31 +    SHADER_YUV_BT709,
   34.32 +    NUM_SHADERS
   34.33 +} D3D9_Shader;
   34.34 +
   34.35 +extern HRESULT D3D9_CreatePixelShader(IDirect3DDevice9 *d3dDevice, D3D9_Shader shader, IDirect3DPixelShader9 **pixelShader);
   34.36 +
   34.37 +/* vi: set ts=4 sw=4 expandtab: */
    35.1 --- a/src/render/direct3d11/SDL_render_d3d11.c	Sun Nov 12 10:59:05 2017 -0800
    35.2 +++ b/src/render/direct3d11/SDL_render_d3d11.c	Sun Nov 12 22:51:12 2017 -0800
    35.3 @@ -29,10 +29,10 @@
    35.4  #include "SDL_syswm.h"
    35.5  #include "../SDL_sysrender.h"
    35.6  #include "../SDL_d3dmath.h"
    35.7 -/* #include "SDL_log.h" */
    35.8  
    35.9  #include <d3d11_1.h>
   35.10  
   35.11 +#include "SDL_shaders_d3d11.h"
   35.12  
   35.13  #ifdef __WINRT__
   35.14  
   35.15 @@ -88,6 +88,12 @@
   35.16      ID3D11ShaderResourceView *mainTextureResourceViewU;
   35.17      ID3D11Texture2D *mainTextureV;
   35.18      ID3D11ShaderResourceView *mainTextureResourceViewV;
   35.19 +
   35.20 +    /* NV12 texture support */
   35.21 +    SDL_bool nv12;
   35.22 +    ID3D11Texture2D *mainTextureNV;
   35.23 +    ID3D11ShaderResourceView *mainTextureResourceViewNV;
   35.24 +
   35.25      Uint8 *pixels;
   35.26      int pitch;
   35.27      SDL_Rect locked_rect;
   35.28 @@ -116,9 +122,7 @@
   35.29      ID3D11InputLayout *inputLayout;
   35.30      ID3D11Buffer *vertexBuffer;
   35.31      ID3D11VertexShader *vertexShader;
   35.32 -    ID3D11PixelShader *colorPixelShader;
   35.33 -    ID3D11PixelShader *texturePixelShader;
   35.34 -    ID3D11PixelShader *yuvPixelShader;
   35.35 +    ID3D11PixelShader *pixelShaders[NUM_SHADERS];
   35.36      int blendModesCount;
   35.37      D3D11_BlendMode *blendModes;
   35.38      ID3D11SamplerState *nearestPixelSampler;
   35.39 @@ -170,553 +174,6 @@
   35.40  #pragma GCC diagnostic pop
   35.41  #endif
   35.42  
   35.43 -/* Direct3D 11.x shaders
   35.44 -
   35.45 -   SDL's shaders are compiled into SDL itself, to simplify distribution.
   35.46 -
   35.47 -   All Direct3D 11.x shaders were compiled with the following:
   35.48 -
   35.49 -   fxc /E"main" /T "<TYPE>" /Fo"<OUTPUT FILE>" "<INPUT FILE>"
   35.50 -
   35.51 -     Variables:
   35.52 -     - <TYPE>: the type of shader.  A table of utilized shader types is
   35.53 -       listed below.
   35.54 -     - <OUTPUT FILE>: where to store compiled output
   35.55 -     - <INPUT FILE>: where to read shader source code from
   35.56 -
   35.57 -     Shader types:
   35.58 -     - ps_4_0_level_9_1: Pixel shader for Windows 8+, including Windows RT
   35.59 -     - vs_4_0_level_9_1: Vertex shader for Windows 8+, including Windows RT
   35.60 -     - ps_4_0_level_9_3: Pixel shader for Windows Phone 8
   35.61 -     - vs_4_0_level_9_3: Vertex shader for Windows Phone 8
   35.62 -   
   35.63 -
   35.64 -   Shader object code was converted to a list of DWORDs via the following
   35.65 -   *nix style command (available separately from Windows + MSVC):
   35.66 -
   35.67 -     hexdump -v -e '6/4 "0x%08.8x, " "\n"' <FILE>
   35.68 -  */
   35.69 -#if WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP
   35.70 -#define D3D11_USE_SHADER_MODEL_4_0_level_9_3
   35.71 -#else
   35.72 -#define D3D11_USE_SHADER_MODEL_4_0_level_9_1
   35.73 -#endif
   35.74 -
   35.75 -/* The color-only-rendering pixel shader:
   35.76 -
   35.77 -   --- D3D11_PixelShader_Colors.hlsl ---
   35.78 -   struct PixelShaderInput
   35.79 -   {
   35.80 -       float4 pos : SV_POSITION;
   35.81 -       float2 tex : TEXCOORD0;
   35.82 -       float4 color : COLOR0;
   35.83 -   };
   35.84 -
   35.85 -   float4 main(PixelShaderInput input) : SV_TARGET
   35.86 -   {
   35.87 -       return input.color;
   35.88 -   }
   35.89 -*/
   35.90 -#if defined(D3D11_USE_SHADER_MODEL_4_0_level_9_1)
   35.91 -static const DWORD D3D11_PixelShader_Colors[] = {
   35.92 -    0x43425844, 0xd74c28fe, 0xa1eb8804, 0x269d512a, 0x7699723d, 0x00000001,
   35.93 -    0x00000240, 0x00000006, 0x00000038, 0x00000084, 0x000000c4, 0x00000140,
   35.94 -    0x00000198, 0x0000020c, 0x396e6f41, 0x00000044, 0x00000044, 0xffff0200,
   35.95 -    0x00000020, 0x00000024, 0x00240000, 0x00240000, 0x00240000, 0x00240000,
   35.96 -    0x00240000, 0xffff0200, 0x0200001f, 0x80000000, 0xb00f0001, 0x02000001,
   35.97 -    0x800f0800, 0xb0e40001, 0x0000ffff, 0x52444853, 0x00000038, 0x00000040,
   35.98 -    0x0000000e, 0x03001062, 0x001010f2, 0x00000002, 0x03000065, 0x001020f2,
   35.99 -    0x00000000, 0x05000036, 0x001020f2, 0x00000000, 0x00101e46, 0x00000002,
  35.100 -    0x0100003e, 0x54415453, 0x00000074, 0x00000002, 0x00000000, 0x00000000,
  35.101 -    0x00000002, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000000,
  35.102 -    0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
  35.103 -    0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0x00000000,
  35.104 -    0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
  35.105 -    0x00000000, 0x00000000, 0x46454452, 0x00000050, 0x00000000, 0x00000000,
  35.106 -    0x00000000, 0x0000001c, 0xffff0400, 0x00000100, 0x0000001c, 0x7263694d,
  35.107 -    0x666f736f, 0x52282074, 0x4c482029, 0x53204c53, 0x65646168, 0x6f432072,
  35.108 -    0x6c69706d, 0x39207265, 0x2e30332e, 0x30303239, 0x3336312e, 0xab003438,
  35.109 -    0x4e475349, 0x0000006c, 0x00000003, 0x00000008, 0x00000050, 0x00000000,
  35.110 -    0x00000001, 0x00000003, 0x00000000, 0x0000000f, 0x0000005c, 0x00000000,
  35.111 -    0x00000000, 0x00000003, 0x00000001, 0x00000003, 0x00000065, 0x00000000,
  35.112 -    0x00000000, 0x00000003, 0x00000002, 0x00000f0f, 0x505f5653, 0x5449534f,
  35.113 -    0x004e4f49, 0x43584554, 0x44524f4f, 0x4c4f4300, 0xab00524f, 0x4e47534f,
  35.114 -    0x0000002c, 0x00000001, 0x00000008, 0x00000020, 0x00000000, 0x00000000,
  35.115 -    0x00000003, 0x00000000, 0x0000000f, 0x545f5653, 0x45475241, 0xabab0054
  35.116 -};
  35.117 -#elif defined(D3D11_USE_SHADER_MODEL_4_0_level_9_3)
  35.118 -static const DWORD D3D11_PixelShader_Colors[] = {
  35.119 -    0x43425844, 0x93f6ccfc, 0x5f919270, 0x7a11aa4f, 0x9148e931, 0x00000001,
  35.120 -    0x00000240, 0x00000006, 0x00000038, 0x00000084, 0x000000c4, 0x00000140,
  35.121 -    0x00000198, 0x0000020c, 0x396e6f41, 0x00000044, 0x00000044, 0xffff0200,
  35.122 -    0x00000020, 0x00000024, 0x00240000, 0x00240000, 0x00240000, 0x00240000,
  35.123 -    0x00240000, 0xffff0201, 0x0200001f, 0x80000000, 0xb00f0001, 0x02000001,
  35.124 -    0x800f0800, 0xb0e40001, 0x0000ffff, 0x52444853, 0x00000038, 0x00000040,
  35.125 -    0x0000000e, 0x03001062, 0x001010f2, 0x00000002, 0x03000065, 0x001020f2,
  35.126 -    0x00000000, 0x05000036, 0x001020f2, 0x00000000, 0x00101e46, 0x00000002,
  35.127 -    0x0100003e, 0x54415453, 0x00000074, 0x00000002, 0x00000000, 0x00000000,
  35.128 -    0x00000002, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000000,
  35.129 -    0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
  35.130 -    0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0x00000000,
  35.131 -    0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
  35.132 -    0x00000000, 0x00000000, 0x46454452, 0x00000050, 0x00000000, 0x00000000,
  35.133 -    0x00000000, 0x0000001c, 0xffff0400, 0x00000100, 0x0000001c, 0x7263694d,
  35.134 -    0x666f736f, 0x52282074, 0x4c482029, 0x53204c53, 0x65646168, 0x6f432072,
  35.135 -    0x6c69706d, 0x39207265, 0x2e30332e, 0x30303239, 0x3336312e, 0xab003438,
  35.136 -    0x4e475349, 0x0000006c, 0x00000003, 0x00000008, 0x00000050, 0x00000000,
  35.137 -    0x00000001, 0x00000003, 0x00000000, 0x0000000f, 0x0000005c, 0x00000000,
  35.138 -    0x00000000, 0x00000003, 0x00000001, 0x00000003, 0x00000065, 0x00000000,
  35.139 -    0x00000000, 0x00000003, 0x00000002, 0x00000f0f, 0x505f5653, 0x5449534f,
  35.140 -    0x004e4f49, 0x43584554, 0x44524f4f, 0x4c4f4300, 0xab00524f, 0x4e47534f,
  35.141 -    0x0000002c, 0x00000001, 0x00000008, 0x00000020, 0x00000000, 0x00000000,
  35.142 -    0x00000003, 0x00000000, 0x0000000f, 0x545f5653, 0x45475241, 0xabab0054
  35.143 -};
  35.144 -#else
  35.145 -#error "An appropriate 'colors' pixel shader is not defined."
  35.146 -#endif
  35.147 -
  35.148 -/* The texture-rendering pixel shader:
  35.149 -
  35.150 -    --- D3D11_PixelShader_Textures.hlsl ---
  35.151 -    Texture2D theTexture : register(t0);
  35.152 -    SamplerState theSampler : register(s0);
  35.153 -
  35.154 -    struct PixelShaderInput
  35.155 -    {
  35.156 -        float4 pos : SV_POSITION;
  35.157 -        float2 tex : TEXCOORD0;
  35.158 -        float4 color : COLOR0;
  35.159 -    };
  35.160 -
  35.161 -    float4 main(PixelShaderInput input) : SV_TARGET
  35.162 -    {
  35.163 -        return theTexture.Sample(theSampler, input.tex) * input.color;
  35.164 -    }
  35.165 -*/
  35.166 -#if defined(D3D11_USE_SHADER_MODEL_4_0_level_9_1)
  35.167 -static const DWORD D3D11_PixelShader_Textures[] = {
  35.168 -    0x43425844, 0x6299b59f, 0x155258f2, 0x873ab86a, 0xfcbb6dcd, 0x00000001,
  35.169 -    0x00000330, 0x00000006, 0x00000038, 0x000000c0, 0x0000015c, 0x000001d8,
  35.170 -    0x00000288, 0x000002fc, 0x396e6f41, 0x00000080, 0x00000080, 0xffff0200,
  35.171 -    0x00000058, 0x00000028, 0x00280000, 0x00280000, 0x00280000, 0x00240001,
  35.172 -    0x00280000, 0x00000000, 0xffff0200, 0x0200001f, 0x80000000, 0xb0030000,
  35.173 -    0x0200001f, 0x80000000, 0xb00f0001, 0x0200001f, 0x90000000, 0xa00f0800,
  35.174 -    0x03000042, 0x800f0000, 0xb0e40000, 0xa0e40800, 0x03000005, 0x800f0000,
  35.175 -    0x80e40000, 0xb0e40001, 0x02000001, 0x800f0800, 0x80e40000, 0x0000ffff,
  35.176 -    0x52444853, 0x00000094, 0x00000040, 0x00000025, 0x0300005a, 0x00106000,
  35.177 -    0x00000000, 0x04001858, 0x00107000, 0x00000000, 0x00005555, 0x03001062,
  35.178 -    0x00101032, 0x00000001, 0x03001062, 0x001010f2, 0x00000002, 0x03000065,
  35.179 -    0x001020f2, 0x00000000, 0x02000068, 0x00000001, 0x09000045, 0x001000f2,
  35.180 -    0x00000000, 0x00101046, 0x00000001, 0x00107e46, 0x00000000, 0x00106000,
  35.181 -    0x00000000, 0x07000038, 0x001020f2, 0x00000000, 0x00100e46, 0x00000000,
  35.182 -    0x00101e46, 0x00000002, 0x0100003e, 0x54415453, 0x00000074, 0x00000003,
  35.183 -    0x00000001, 0x00000000, 0x00000003, 0x00000001, 0x00000000, 0x00000000,
  35.184 -    0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
  35.185 -    0x00000000, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
  35.186 -    0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
  35.187 -    0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x46454452, 0x000000a8,
  35.188 -    0x00000000, 0x00000000, 0x00000002, 0x0000001c, 0xffff0400, 0x00000100,
  35.189 -    0x00000072, 0x0000005c, 0x00000003, 0x00000000, 0x00000000, 0x00000000,
  35.190 -    0x00000000, 0x00000001, 0x00000001, 0x00000067, 0x00000002, 0x00000005,
  35.191 -    0x00000004, 0xffffffff, 0x00000000, 0x00000001, 0x0000000d, 0x53656874,
  35.192 -    0x6c706d61, 0x74007265, 0x65546568, 0x72757478, 0x694d0065, 0x736f7263,
  35.193 -    0x2074666f, 0x20295228, 0x4c534c48, 0x61685320, 0x20726564, 0x706d6f43,
  35.194 -    0x72656c69, 0x332e3920, 0x32392e30, 0x312e3030, 0x34383336, 0xababab00,
  35.195 -    0x4e475349, 0x0000006c, 0x00000003, 0x00000008, 0x00000050, 0x00000000,
  35.196 -    0x00000001, 0x00000003, 0x00000000, 0x0000000f, 0x0000005c, 0x00000000,
  35.197 -    0x00000000, 0x00000003, 0x00000001, 0x00000303, 0x00000065, 0x00000000,
  35.198 -    0x00000000, 0x00000003, 0x00000002, 0x00000f0f, 0x505f5653, 0x5449534f,
  35.199 -    0x004e4f49, 0x43584554, 0x44524f4f, 0x4c4f4300, 0xab00524f, 0x4e47534f,
  35.200 -    0x0000002c, 0x00000001, 0x00000008, 0x00000020, 0x00000000, 0x00000000,
  35.201 -    0x00000003, 0x00000000, 0x0000000f, 0x545f5653, 0x45475241, 0xabab0054
  35.202 -};
  35.203 -#elif defined(D3D11_USE_SHADER_MODEL_4_0_level_9_3)
  35.204 -static const DWORD D3D11_PixelShader_Textures[] = {
  35.205 -    0x43425844, 0x5876569a, 0x01b6c87e, 0x8447454f, 0xc7f3ef10, 0x00000001,
  35.206 -    0x00000330, 0x00000006, 0x00000038, 0x000000c0, 0x0000015c, 0x000001d8,
  35.207 -    0x00000288, 0x000002fc, 0x396e6f41, 0x00000080, 0x00000080, 0xffff0200,
  35.208 -    0x00000058, 0x00000028, 0x00280000, 0x00280000, 0x00280000, 0x00240001,
  35.209 -    0x00280000, 0x00000000, 0xffff0201, 0x0200001f, 0x80000000, 0xb0030000,
  35.210 -    0x0200001f, 0x80000000, 0xb00f0001, 0x0200001f, 0x90000000, 0xa00f0800,
  35.211 -    0x03000042, 0x800f0000, 0xb0e40000, 0xa0e40800, 0x03000005, 0x800f0000,
  35.212 -    0x80e40000, 0xb0e40001, 0x02000001, 0x800f0800, 0x80e40000, 0x0000ffff,
  35.213 -    0x52444853, 0x00000094, 0x00000040, 0x00000025, 0x0300005a, 0x00106000,
  35.214 -    0x00000000, 0x04001858, 0x00107000, 0x00000000, 0x00005555, 0x03001062,
  35.215 -    0x00101032, 0x00000001, 0x03001062, 0x001010f2, 0x00000002, 0x03000065,
  35.216 -    0x001020f2, 0x00000000, 0x02000068, 0x00000001, 0x09000045, 0x001000f2,
  35.217 -    0x00000000, 0x00101046, 0x00000001, 0x00107e46, 0x00000000, 0x00106000,
  35.218 -    0x00000000, 0x07000038, 0x001020f2, 0x00000000, 0x00100e46, 0x00000000,
  35.219 -    0x00101e46, 0x00000002, 0x0100003e, 0x54415453, 0x00000074, 0x00000003,
  35.220 -    0x00000001, 0x00000000, 0x00000003, 0x00000001, 0x00000000, 0x00000000,
  35.221 -    0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
  35.222 -    0x00000000, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
  35.223 -    0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
  35.224 -    0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x46454452, 0x000000a8,
  35.225 -    0x00000000, 0x00000000, 0x00000002, 0x0000001c, 0xffff0400, 0x00000100,
  35.226 -    0x00000072, 0x0000005c, 0x00000003, 0x00000000, 0x00000000, 0x00000000,
  35.227 -    0x00000000, 0x00000001, 0x00000001, 0x00000067, 0x00000002, 0x00000005,
  35.228 -    0x00000004, 0xffffffff, 0x00000000, 0x00000001, 0x0000000d, 0x53656874,
  35.229 -    0x6c706d61, 0x74007265, 0x65546568, 0x72757478, 0x694d0065, 0x736f7263,
  35.230 -    0x2074666f, 0x20295228, 0x4c534c48, 0x61685320, 0x20726564, 0x706d6f43,
  35.231 -    0x72656c69, 0x332e3920, 0x32392e30, 0x312e3030, 0x34383336, 0xababab00,
  35.232 -    0x4e475349, 0x0000006c, 0x00000003, 0x00000008, 0x00000050, 0x00000000,
  35.233 -    0x00000001, 0x00000003, 0x00000000, 0x0000000f, 0x0000005c, 0x00000000,
  35.234 -    0x00000000, 0x00000003, 0x00000001, 0x00000303, 0x00000065, 0x00000000,
  35.235 -    0x00000000, 0x00000003, 0x00000002, 0x00000f0f, 0x505f5653, 0x5449534f,
  35.236 -    0x004e4f49, 0x43584554, 0x44524f4f, 0x4c4f4300, 0xab00524f, 0x4e47534f,
  35.237 -    0x0000002c, 0x00000001, 0x00000008, 0x00000020, 0x00000000, 0x00000000,
  35.238 -    0x00000003, 0x00000000, 0x0000000f, 0x545f5653, 0x45475241, 0xabab0054
  35.239 -};
  35.240 -#else
  35.241 -#error "An appropriate 'textures' pixel shader is not defined"
  35.242 -#endif
  35.243 -
  35.244 -/* The yuv-rendering pixel shader:
  35.245 -
  35.246 -    --- D3D11_PixelShader_YUV.hlsl ---
  35.247 -    Texture2D theTextureY : register(t0);
  35.248 -    Texture2D theTextureU : register(t1);
  35.249 -    Texture2D theTextureV : register(t2);
  35.250 -    SamplerState theSampler : register(s0);
  35.251 -
  35.252 -    struct PixelShaderInput
  35.253 -    {
  35.254 -        float4 pos : SV_POSITION;
  35.255 -        float2 tex : TEXCOORD0;
  35.256 -        float4 color : COLOR0;
  35.257 -    };
  35.258 -
  35.259 -    float4 main(PixelShaderInput input) : SV_TARGET
  35.260 -    {
  35.261 -        const float3 offset = {-0.0627451017, -0.501960814, -0.501960814};
  35.262 -        const float3 Rcoeff = {1.164,  0.000,  1.596};
  35.263 -        const float3 Gcoeff = {1.164, -0.391, -0.813};
  35.264 -        const float3 Bcoeff = {1.164,  2.018,  0.000};
  35.265 -
  35.266 -        float4 Output;
  35.267 -
  35.268 -        float3 yuv;
  35.269 -        yuv.x = theTextureY.Sample(theSampler, input.tex).r;
  35.270 -        yuv.y = theTextureU.Sample(theSampler, input.tex).r;
  35.271 -        yuv.z = theTextureV.Sample(theSampler, input.tex).r;
  35.272 -
  35.273 -        yuv += offset;
  35.274 -        Output.r = dot(yuv, Rcoeff);
  35.275 -        Output.g = dot(yuv, Gcoeff);
  35.276 -        Output.b = dot(yuv, Bcoeff);
  35.277 -        Output.a = 1.0f;
  35.278 -
  35.279 -        return Output * input.color;
  35.280 -    }
  35.281 -
  35.282 -*/
  35.283 -#if defined(D3D11_USE_SHADER_MODEL_4_0_level_9_1)
  35.284 -static const DWORD D3D11_PixelShader_YUV[] = {
  35.285 -    0x43425844, 0x2321c6c6, 0xf14df2d1, 0xc79d068d, 0x8e672abf, 0x00000001,
  35.286 -    0x000005e8, 0x00000006, 0x00000038, 0x000001dc, 0x000003bc, 0x00000438,
  35.287 -    0x00000540, 0x000005b4, 0x396e6f41, 0x0000019c, 0x0000019c, 0xffff0200,
  35.288 -    0x0000016c, 0x00000030, 0x00300000, 0x00300000, 0x00300000, 0x00240003,
  35.289 -    0x00300000, 0x00000000, 0x00010001, 0x00020002, 0xffff0200, 0x05000051,
  35.290 -    0xa00f0000, 0xbd808081, 0xbf008081, 0xbf008081, 0x3f800000, 0x05000051,
  35.291 -    0xa00f0001, 0x3f94fdf4, 0x3fcc49ba, 0x00000000, 0x00000000, 0x05000051,
  35.292 -    0xa00f0002, 0x3f94fdf4, 0xbec83127, 0xbf5020c5, 0x00000000, 0x05000051,
  35.293 -    0xa00f0003, 0x3f94fdf4, 0x400126e9, 0x00000000, 0x00000000, 0x0200001f,
  35.294 -    0x80000000, 0xb0030000, 0x0200001f, 0x80000000, 0xb00f0001, 0x0200001f,
  35.295 -    0x90000000, 0xa00f0800, 0x0200001f, 0x90000000, 0xa00f0801, 0x0200001f,
  35.296 -    0x90000000, 0xa00f0802, 0x03000042, 0x800f0000, 0xb0e40000, 0xa0e40800,
  35.297 -    0x03000042, 0x800f0001, 0xb0e40000, 0xa0e40801, 0x03000042, 0x800f0002,
  35.298 -    0xb0e40000, 0xa0e40802, 0x02000001, 0x80020000, 0x80000001, 0x02000001,
  35.299 -    0x80040000, 0x80000002, 0x03000002, 0x80070000, 0x80e40000, 0xa0e40000,
  35.300 -    0x03000005, 0x80080000, 0x80000000, 0xa0000001, 0x04000004, 0x80010001,
  35.301 -    0x80aa0000, 0xa0550001, 0x80ff0000, 0x03000008, 0x80020001, 0x80e40000,
  35.302 -    0xa0e40002, 0x0400005a, 0x80040001, 0x80e40000, 0xa0e40003, 0xa0aa0003,
  35.303 -    0x02000001, 0x80080001, 0xa0ff0000, 0x03000005, 0x800f0000, 0x80e40001,
  35.304 -    0xb0e40001, 0x02000001, 0x800f0800, 0x80e40000, 0x0000ffff, 0x52444853,
  35.305 -    0x000001d8, 0x00000040, 0x00000076, 0x0300005a, 0x00106000, 0x00000000,
  35.306 -    0x04001858, 0x00107000, 0x00000000, 0x00005555, 0x04001858, 0x00107000,
  35.307 -    0x00000001, 0x00005555, 0x04001858, 0x00107000, 0x00000002, 0x00005555,
  35.308 -    0x03001062, 0x00101032, 0x00000001, 0x03001062, 0x001010f2, 0x00000002,
  35.309 -    0x03000065, 0x001020f2, 0x00000000, 0x02000068, 0x00000002, 0x09000045,
  35.310 -    0x001000f2, 0x00000000, 0x00101046, 0x00000001, 0x00107e46, 0x00000000,
  35.311 -    0x00106000, 0x00000000, 0x09000045, 0x001000f2, 0x00000001, 0x00101046,
  35.312 -    0x00000001, 0x00107e46, 0x00000001, 0x00106000, 0x00000000, 0x05000036,
  35.313 -    0x00100022, 0x00000000, 0x0010000a, 0x00000001, 0x09000045, 0x001000f2,
  35.314 -    0x00000001, 0x00101046, 0x00000001, 0x00107e46, 0x00000002, 0x00106000,
  35.315 -    0x00000000, 0x05000036, 0x00100042, 0x00000000, 0x0010000a, 0x00000001,
  35.316 -    0x0a000000, 0x00100072, 0x00000000, 0x00100246, 0x00000000, 0x00004002,
  35.317 -    0xbd808081, 0xbf008081, 0xbf008081, 0x00000000, 0x0a00000f, 0x00100012,
  35.318 -    0x00000001, 0x00100086, 0x00000000, 0x00004002, 0x3f94fdf4, 0x3fcc49ba,
  35.319 -    0x00000000, 0x00000000, 0x0a000010, 0x00100022, 0x00000001, 0x00100246,
  35.320 -    0x00000000, 0x00004002, 0x3f94fdf4, 0xbec83127, 0xbf5020c5, 0x00000000,
  35.321 -    0x0a00000f, 0x00100042, 0x00000001, 0x00100046, 0x00000000, 0x00004002,
  35.322 -    0x3f94fdf4, 0x400126e9, 0x00000000, 0x00000000, 0x05000036, 0x00100082,
  35.323 -    0x00000001, 0x00004001, 0x3f800000, 0x07000038, 0x001020f2, 0x00000000,
  35.324 -    0x00100e46, 0x00000001, 0x00101e46, 0x00000002, 0x0100003e, 0x54415453,
  35.325 -    0x00000074, 0x0000000c, 0x00000002, 0x00000000, 0x00000003, 0x00000005,
  35.326 -    0x00000000, 0x00000000, 0x00000001, 0x00000000, 0x00000000, 0x00000000,
  35.327 -    0x00000000, 0x00000000, 0x00000000, 0x00000003, 0x00000000, 0x00000000,
  35.328 -    0x00000000, 0x00000000, 0x00000003, 0x00000000, 0x00000000, 0x00000000,
  35.329 -    0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
  35.330 -    0x46454452, 0x00000100, 0x00000000, 0x00000000, 0x00000004, 0x0000001c,
  35.331 -    0xffff0400, 0x00000100, 0x000000cb, 0x0000009c, 0x00000003, 0x00000000,
  35.332 -    0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000001, 0x000000a7,
  35.333 -    0x00000002, 0x00000005, 0x00000004, 0xffffffff, 0x00000000, 0x00000001,
  35.334 -    0x0000000d, 0x000000b3, 0x00000002, 0x00000005, 0x00000004, 0xffffffff,
  35.335 -    0x00000001, 0x00000001, 0x0000000d, 0x000000bf, 0x00000002, 0x00000005,
  35.336 -    0x00000004, 0xffffffff, 0x00000002, 0x00000001, 0x0000000d, 0x53656874,
  35.337 -    0x6c706d61, 0x74007265, 0x65546568, 0x72757478, 0x74005965, 0x65546568,
  35.338 -    0x72757478, 0x74005565, 0x65546568, 0x72757478, 0x4d005665, 0x6f726369,
  35.339 -    0x74666f73, 0x29522820, 0x534c4820, 0x6853204c, 0x72656461, 0x6d6f4320,
  35.340 -    0x656c6970, 0x2e362072, 0x36392e33, 0x312e3030, 0x34383336, 0xababab00,
  35.341 -    0x4e475349, 0x0000006c, 0x00000003, 0x00000008, 0x00000050, 0x00000000,
  35.342 -    0x00000001, 0x00000003, 0x00000000, 0x0000000f, 0x0000005c, 0x00000000,
  35.343 -    0x00000000, 0x00000003, 0x00000001, 0x00000303, 0x00000065, 0x00000000,
  35.344 -    0x00000000, 0x00000003, 0x00000002, 0x00000f0f, 0x505f5653, 0x5449534f,
  35.345 -    0x004e4f49, 0x43584554, 0x44524f4f, 0x4c4f4300, 0xab00524f, 0x4e47534f,
  35.346 -    0x0000002c, 0x00000001, 0x00000008, 0x00000020, 0x00000000, 0x00000000,
  35.347 -    0x00000003, 0x00000000, 0x0000000f, 0x545f5653, 0x45475241, 0xabab0054
  35.348 -};
  35.349 -#elif defined(D3D11_USE_SHADER_MODEL_4_0_level_9_3)
  35.350 -static const DWORD D3D11_PixelShader_YUV[] = {
  35.351 -    0x43425844, 0x6ede7360, 0x45ff5f8a, 0x34ac92ba, 0xb865f5e0, 0x00000001,
  35.352 -    0x000005c0, 0x00000006, 0x00000038, 0x000001b4, 0x00000394, 0x00000410,
  35.353 -    0x00000518, 0x0000058c, 0x396e6f41, 0x00000174, 0x00000174, 0xffff0200,
  35.354 -    0x00000144, 0x00000030, 0x00300000, 0x00300000, 0x00300000, 0x00240003,
  35.355 -    0x00300000, 0x00000000, 0x00010001, 0x00020002, 0xffff0201, 0x05000051,
  35.356 -    0xa00f0000, 0xbd808081, 0xbf008081, 0x3f800000, 0x00000000, 0x05000051,
  35.357 -    0xa00f0001, 0x3f94fdf4, 0x3fcc49ba, 0x00000000, 0x400126e9, 0x05000051,
  35.358 -    0xa00f0002, 0x3f94fdf4, 0xbec83127, 0xbf5020c5, 0x00000000, 0x0200001f,
  35.359 -    0x80000000, 0xb0030000, 0x0200001f, 0x80000000, 0xb00f0001, 0x0200001f,
  35.360 -    0x90000000, 0xa00f0800, 0x0200001f, 0x90000000, 0xa00f0801, 0x0200001f,
  35.361 -    0x90000000, 0xa00f0802, 0x03000042, 0x800f0000, 0xb0e40000, 0xa0e40801,
  35.362 -    0x03000042, 0x800f0001, 0xb0e40000, 0xa0e40800, 0x02000001, 0x80020001,
  35.363 -    0x80000000, 0x03000042, 0x800f0000, 0xb0e40000, 0xa0e40802, 0x02000001,
  35.364 -    0x80040001, 0x80000000, 0x03000002, 0x80070000, 0x80e40001, 0xa0d40000,
  35.365 -    0x0400005a, 0x80010001, 0x80e80000, 0xa0e40001, 0xa0aa0001, 0x03000008,
  35.366 -    0x80020001, 0x80e40000, 0xa0e40002, 0x0400005a, 0x80040001, 0x80e40000,
  35.367 -    0xa0ec0001, 0xa0aa0001, 0x02000001, 0x80080001, 0xa0aa0000, 0x03000005,
  35.368 -    0x800f0000, 0x80e40001, 0xb0e40001, 0x02000001, 0x800f0800, 0x80e40000,
  35.369 -    0x0000ffff, 0x52444853, 0x000001d8, 0x00000040, 0x00000076, 0x0300005a,
  35.370 -    0x00106000, 0x00000000, 0x04001858, 0x00107000, 0x00000000, 0x00005555,
  35.371 -    0x04001858, 0x00107000, 0x00000001, 0x00005555, 0x04001858, 0x00107000,
  35.372 -    0x00000002, 0x00005555, 0x03001062, 0x00101032, 0x00000001, 0x03001062,
  35.373 -    0x001010f2, 0x00000002, 0x03000065, 0x001020f2, 0x00000000, 0x02000068,
  35.374 -    0x00000002, 0x09000045, 0x001000f2, 0x00000000, 0x00101046, 0x00000001,
  35.375 -    0x00107e46, 0x00000000, 0x00106000, 0x00000000, 0x09000045, 0x001000f2,
  35.376 -    0x00000001, 0x00101046, 0x00000001, 0x00107e46, 0x00000001, 0x00106000,
  35.377 -    0x00000000, 0x05000036, 0x00100022, 0x00000000, 0x0010000a, 0x00000001,
  35.378 -    0x09000045, 0x001000f2, 0x00000001, 0x00101046, 0x00000001, 0x00107e46,
  35.379 -    0x00000002, 0x00106000, 0x00000000, 0x05000036, 0x00100042, 0x00000000,
  35.380 -    0x0010000a, 0x00000001, 0x0a000000, 0x00100072, 0x00000000, 0x00100246,
  35.381 -    0x00000000, 0x00004002, 0xbd808081, 0xbf008081, 0xbf008081, 0x00000000,
  35.382 -    0x0a00000f, 0x00100012, 0x00000001, 0x00100086, 0x00000000, 0x00004002,
  35.383 -    0x3f94fdf4, 0x3fcc49ba, 0x00000000, 0x00000000, 0x0a000010, 0x00100022,
  35.384 -    0x00000001, 0x00100246, 0x00000000, 0x00004002, 0x3f94fdf4, 0xbec83127,
  35.385 -    0xbf5020c5, 0x00000000, 0x0a00000f, 0x00100042, 0x00000001, 0x00100046,
  35.386 -    0x00000000, 0x00004002, 0x3f94fdf4, 0x400126e9, 0x00000000, 0x00000000,
  35.387 -    0x05000036, 0x00100082, 0x00000001, 0x00004001, 0x3f800000, 0x07000038,
  35.388 -    0x001020f2, 0x00000000, 0x00100e46, 0x00000001, 0x00101e46, 0x00000002,
  35.389 -    0x0100003e, 0x54415453, 0x00000074, 0x0000000c, 0x00000002, 0x00000000,
  35.390 -    0x00000003, 0x00000005, 0x00000000, 0x00000000, 0x00000001, 0x00000000,
  35.391 -    0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000003,
  35.392 -    0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000003, 0x00000000,
  35.393 -    0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
  35.394 -    0x00000000, 0x00000000, 0x46454452, 0x00000100, 0x00000000, 0x00000000,
  35.395 -    0x00000004, 0x0000001c, 0xffff0400, 0x00000100, 0x000000cb, 0x0000009c,
  35.396 -    0x00000003, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000001,
  35.397 -    0x00000001, 0x000000a7, 0x00000002, 0x00000005, 0x00000004, 0xffffffff,
  35.398 -    0x00000000, 0x00000001, 0x0000000d, 0x000000b3, 0x00000002, 0x00000005,
  35.399 -    0x00000004, 0xffffffff, 0x00000001, 0x00000001, 0x0000000d, 0x000000bf,
  35.400 -    0x00000002, 0x00000005, 0x00000004, 0xffffffff, 0x00000002, 0x00000001,
  35.401 -    0x0000000d, 0x53656874, 0x6c706d61, 0x74007265, 0x65546568, 0x72757478,
  35.402 -    0x74005965, 0x65546568, 0x72757478, 0x74005565, 0x65546568, 0x72757478,
  35.403 -    0x4d005665, 0x6f726369, 0x74666f73, 0x29522820, 0x534c4820, 0x6853204c,
  35.404 -    0x72656461, 0x6d6f4320, 0x656c6970, 0x2e362072, 0x36392e33, 0x312e3030,
  35.405 -    0x34383336, 0xababab00, 0x4e475349, 0x0000006c, 0x00000003, 0x00000008,
  35.406 -    0x00000050, 0x00000000, 0x00000001, 0x00000003, 0x00000000, 0x0000000f,
  35.407 -    0x0000005c, 0x00000000, 0x00000000, 0x00000003, 0x00000001, 0x00000303,
  35.408 -    0x00000065, 0x00000000, 0x00000000, 0x00000003, 0x00000002, 0x00000f0f,
  35.409 -    0x505f5653, 0x5449534f, 0x004e4f49, 0x43584554, 0x44524f4f, 0x4c4f4300,
  35.410 -    0xab00524f, 0x4e47534f, 0x0000002c, 0x00000001, 0x00000008, 0x00000020,
  35.411 -    0x00000000, 0x00000000, 0x00000003, 0x00000000, 0x0000000f, 0x545f5653,
  35.412 -    0x45475241, 0xabab0054
  35.413 -};
  35.414 -#else
  35.415 -#error "An appropriate 'yuv' pixel shader is not defined."
  35.416 -#endif
  35.417 -
  35.418 -/* The sole vertex shader:
  35.419 -
  35.420 -   --- D3D11_VertexShader.hlsl ---
  35.421 -   #pragma pack_matrix( row_major )
  35.422 -
  35.423 -   cbuffer VertexShaderConstants : register(b0)
  35.424 -   {
  35.425 -       matrix model;
  35.426 -       matrix projectionAndView;
  35.427 -   };
  35.428 -
  35.429 -   struct VertexShaderInput
  35.430 -   {
  35.431 -       float3 pos : POSITION;
  35.432 -       float2 tex : TEXCOORD0;
  35.433 -       float4 color : COLOR0;
  35.434 -   };
  35.435 -
  35.436 -   struct VertexShaderOutput
  35.437 -   {
  35.438 -       float4 pos : SV_POSITION;
  35.439 -       float2 tex : TEXCOORD0;
  35.440 -       float4 color : COLOR0;
  35.441 -   };
  35.442 -
  35.443 -   VertexShaderOutput main(VertexShaderInput input)
  35.444 -   {
  35.445 -       VertexShaderOutput output;
  35.446 -       float4 pos = float4(input.pos, 1.0f);
  35.447 -
  35.448 -       // Transform the vertex position into projected space.
  35.449 -       pos = mul(pos, model);
  35.450 -       pos = mul(pos, projectionAndView);
  35.451 -       output.pos = pos;
  35.452 -
  35.453 -       // Pass through texture coordinates and color values without transformation
  35.454 -       output.tex = input.tex;
  35.455 -       output.color = input.color;
  35.456 -
  35.457 -       return output;
  35.458 -   }
  35.459 -*/
  35.460 -#if defined(D3D11_USE_SHADER_MODEL_4_0_level_9_1)
  35.461 -static const DWORD D3D11_VertexShader[] = {
  35.462 -    0x43425844, 0x62dfae5f, 0x3e8bd8df, 0x9ec97127, 0x5044eefb, 0x00000001,
  35.463 -    0x00000598, 0x00000006, 0x00000038, 0x0000016c, 0x00000334, 0x000003b0,
  35.464 -    0x000004b4, 0x00000524, 0x396e6f41, 0x0000012c, 0x0000012c, 0xfffe0200,
  35.465 -    0x000000f8, 0x00000034, 0x00240001, 0x00300000, 0x00300000, 0x00240000,
  35.466 -    0x00300001, 0x00000000, 0x00010008, 0x00000000, 0x00000000, 0xfffe0200,
  35.467 -    0x0200001f, 0x80000005, 0x900f0000, 0x0200001f, 0x80010005, 0x900f0001,
  35.468 -    0x0200001f, 0x80020005, 0x900f0002, 0x03000005, 0x800f0000, 0x90550000,
  35.469 -    0xa0e40002, 0x04000004, 0x800f0000, 0x90000000, 0xa0e40001, 0x80e40000,
  35.470 -    0x04000004, 0x800f0000, 0x90aa0000, 0xa0e40003, 0x80e40000, 0x03000002,
  35.471 -    0x800f0000, 0x80e40000, 0xa0e40004, 0x03000005, 0x800f0001, 0x80550000,
  35.472 -    0xa0e40006, 0x04000004, 0x800f0001, 0x80000000, 0xa0e40005, 0x80e40001,
  35.473 -    0x04000004, 0x800f0001, 0x80aa0000, 0xa0e40007, 0x80e40001, 0x04000004,
  35.474 -    0x800f0000, 0x80ff0000, 0xa0e40008, 0x80e40001, 0x04000004, 0xc0030000,
  35.475 -    0x80ff0000, 0xa0e40000, 0x80e40000, 0x02000001, 0xc00c0000, 0x80e40000,
  35.476 -    0x02000001, 0xe0030000, 0x90e40001, 0x02000001, 0xe00f0001, 0x90e40002,
  35.477 -    0x0000ffff, 0x52444853, 0x000001c0, 0x00010040, 0x00000070, 0x04000059,
  35.478 -    0x00208e46, 0x00000000, 0x00000008, 0x0300005f, 0x00101072, 0x00000000,
  35.479 -    0x0300005f, 0x00101032, 0x00000001, 0x0300005f, 0x001010f2, 0x00000002,
  35.480 -    0x04000067, 0x001020f2, 0x00000000, 0x00000001, 0x03000065, 0x00102032,
  35.481 -    0x00000001, 0x03000065, 0x001020f2, 0x00000002, 0x02000068, 0x00000002,
  35.482 -    0x08000038, 0x001000f2, 0x00000000, 0x00101556, 0x00000000, 0x00208e46,
  35.483 -    0x00000000, 0x00000001, 0x0a000032, 0x001000f2, 0x00000000, 0x00101006,
  35.484 -    0x00000000, 0x00208e46, 0x00000000, 0x00000000, 0x00100e46, 0x00000000,
  35.485 -    0x0a000032, 0x001000f2, 0x00000000, 0x00101aa6, 0x00000000, 0x00208e46,
  35.486 -    0x00000000, 0x00000002, 0x00100e46, 0x00000000, 0x08000000, 0x001000f2,
  35.487 -    0x00000000, 0x00100e46, 0x00000000, 0x00208e46, 0x00000000, 0x00000003,
  35.488 -    0x08000038, 0x001000f2, 0x00000001, 0x00100556, 0x00000000, 0x00208e46,
  35.489 -    0x00000000, 0x00000005, 0x0a000032, 0x001000f2, 0x00000001, 0x00100006,
  35.490 -    0x00000000, 0x00208e46, 0x00000000, 0x00000004, 0x00100e46, 0x00000001,
  35.491 -    0x0a000032, 0x001000f2, 0x00000001, 0x00100aa6, 0x00000000, 0x00208e46,
  35.492 -    0x00000000, 0x00000006, 0x00100e46, 0x00000001, 0x0a000032, 0x001020f2,
  35.493 -    0x00000000, 0x00100ff6, 0x00000000, 0x00208e46, 0x00000000, 0x00000007,
  35.494 -    0x00100e46, 0x00000001, 0x05000036, 0x00102032, 0x00000001, 0x00101046,
  35.495 -    0x00000001, 0x05000036, 0x001020f2, 0x00000002, 0x00101e46, 0x00000002,
  35.496 -    0x0100003e, 0x54415453, 0x00000074, 0x0000000b, 0x00000002, 0x00000000,
  35.497 -    0x00000006, 0x00000003, 0x00000000, 0x00000000, 0x00000001, 0x00000000,
  35.498 -    0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
  35.499 -    0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000003, 0x00000000,
  35.500 -    0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
  35.501 -    0x00000000, 0x00000000, 0x46454452, 0x000000fc, 0x00000001, 0x00000054,
  35.502 -    0x00000001, 0x0000001c, 0xfffe0400, 0x00000100, 0x000000c6, 0x0000003c,
  35.503 -    0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000001,
  35.504 -    0x00000001, 0x74726556, 0x68537865, 0x72656461, 0x736e6f43, 0x746e6174,
  35.505 -    0xabab0073, 0x0000003c, 0x00000002, 0x0000006c, 0x00000080, 0x00000000,
  35.506 -    0x00000000, 0x0000009c, 0x00000000, 0x00000040, 0x00000002, 0x000000a4,
  35.507 -    0x00000000, 0x000000b4, 0x00000040, 0x00000040, 0x00000002, 0x000000a4,
  35.508 -    0x00000000, 0x65646f6d, 0xabab006c, 0x00030002, 0x00040004, 0x00000000,
  35.509 -    0x00000000, 0x6a6f7270, 0x69746365, 0x6e416e6f, 0x65695664, 0x694d0077,
  35.510 -    0x736f7263, 0x2074666f, 0x20295228, 0x4c534c48, 0x61685320, 0x20726564,
  35.511 -    0x706d6f43, 0x72656c69, 0x332e3920, 0x32392e30, 0x312e3030, 0x34383336,
  35.512 -    0xababab00, 0x4e475349, 0x00000068, 0x00000003, 0x00000008, 0x00000050,
  35.513 -    0x00000000, 0x00000000, 0x00000003, 0x00000000, 0x00000707, 0x00000059,
  35.514 -    0x00000000, 0x00000000, 0x00000003, 0x00000001, 0x00000303, 0x00000062,
  35.515 -    0x00000000, 0x00000000, 0x00000003, 0x00000002, 0x00000f0f, 0x49534f50,
  35.516 -    0x4e4f4954, 0x58455400, 0x524f4f43, 0x4f430044, 0x00524f4c, 0x4e47534f,
  35.517 -    0x0000006c, 0x00000003, 0x00000008, 0x00000050, 0x00000000, 0x00000001,
  35.518 -    0x00000003, 0x00000000, 0x0000000f, 0x0000005c, 0x00000000, 0x00000000,
  35.519 -    0x00000003, 0x00000001, 0x00000c03, 0x00000065, 0x00000000, 0x00000000,
  35.520 -    0x00000003, 0x00000002, 0x0000000f, 0x505f5653, 0x5449534f, 0x004e4f49,
  35.521 -    0x43584554, 0x44524f4f, 0x4c4f4300, 0xab00524f
  35.522 -};
  35.523 -#elif defined(D3D11_USE_SHADER_MODEL_4_0_level_9_3)
  35.524 -static const DWORD D3D11_VertexShader[] = {
  35.525 -    0x43425844, 0x01a24e41, 0x696af551, 0x4b2a87d1, 0x82ea03f6, 0x00000001,
  35.526 -    0x00000598, 0x00000006, 0x00000038, 0x0000016c, 0x00000334, 0x000003b0,
  35.527 -    0x000004b4, 0x00000524, 0x396e6f41, 0x0000012c, 0x0000012c, 0xfffe0200,
  35.528 -    0x000000f8, 0x00000034, 0x00240001, 0x00300000, 0x00300000, 0x00240000,
  35.529 -    0x00300001, 0x00000000, 0x00010008, 0x00000000, 0x00000000, 0xfffe0201,
  35.530 -    0x0200001f, 0x80000005, 0x900f0000, 0x0200001f, 0x80010005, 0x900f0001,
  35.531 -    0x0200001f, 0x80020005, 0x900f0002, 0x03000005, 0x800f0000, 0x90550000,
  35.532 -    0xa0e40002, 0x04000004, 0x800f0000, 0x90000000, 0xa0e40001, 0x80e40000,
  35.533 -    0x04000004, 0x800f0000, 0x90aa0000, 0xa0e40003, 0x80e40000, 0x03000002,
  35.534 -    0x800f0000, 0x80e40000, 0xa0e40004, 0x03000005, 0x800f0001, 0x80550000,
  35.535 -    0xa0e40006, 0x04000004, 0x800f0001, 0x80000000, 0xa0e40005, 0x80e40001,
  35.536 -    0x04000004, 0x800f0001, 0x80aa0000, 0xa0e40007, 0x80e40001, 0x04000004,
  35.537 -    0x800f0000, 0x80ff0000, 0xa0e40008, 0x80e40001, 0x04000004, 0xc0030000,
  35.538 -    0x80ff0000, 0xa0e40000, 0x80e40000, 0x02000001, 0xc00c0000, 0x80e40000,
  35.539 -    0x02000001, 0xe0030000, 0x90e40001, 0x02000001, 0xe00f0001, 0x90e40002,
  35.540 -    0x0000ffff, 0x52444853, 0x000001c0, 0x00010040, 0x00000070, 0x04000059,
  35.541 -    0x00208e46, 0x00000000, 0x00000008, 0x0300005f, 0x00101072, 0x00000000,
  35.542 -    0x0300005f, 0x00101032, 0x00000001, 0x0300005f, 0x001010f2, 0x00000002,
  35.543 -    0x04000067, 0x001020f2, 0x00000000, 0x00000001, 0x03000065, 0x00102032,
  35.544 -    0x00000001, 0x03000065, 0x001020f2, 0x00000002, 0x02000068, 0x00000002,
  35.545 -    0x08000038, 0x001000f2, 0x00000000, 0x00101556, 0x00000000, 0x00208e46,
  35.546 -    0x00000000, 0x00000001, 0x0a000032, 0x001000f2, 0x00000000, 0x00101006,
  35.547 -    0x00000000, 0x00208e46, 0x00000000, 0x00000000, 0x00100e46, 0x00000000,
  35.548 -    0x0a000032, 0x001000f2, 0x00000000, 0x00101aa6, 0x00000000, 0x00208e46,
  35.549 -    0x00000000, 0x00000002, 0x00100e46, 0x00000000, 0x08000000, 0x001000f2,
  35.550 -    0x00000000, 0x00100e46, 0x00000000, 0x00208e46, 0x00000000, 0x00000003,
  35.551 -    0x08000038, 0x001000f2, 0x00000001, 0x00100556, 0x00000000, 0x00208e46,
  35.552 -    0x00000000, 0x00000005, 0x0a000032, 0x001000f2, 0x00000001, 0x00100006,
  35.553 -    0x00000000, 0x00208e46, 0x00000000, 0x00000004, 0x00100e46, 0x00000001,
  35.554 -    0x0a000032, 0x001000f2, 0x00000001, 0x00100aa6, 0x00000000, 0x00208e46,
  35.555 -    0x00000000, 0x00000006, 0x00100e46, 0x00000001, 0x0a000032, 0x001020f2,
  35.556 -    0x00000000, 0x00100ff6, 0x00000000, 0x00208e46, 0x00000000, 0x00000007,
  35.557 -    0x00100e46, 0x00000001, 0x05000036, 0x00102032, 0x00000001, 0x00101046,
  35.558 -    0x00000001, 0x05000036, 0x001020f2, 0x00000002, 0x00101e46, 0x00000002,
  35.559 -    0x0100003e, 0x54415453, 0x00000074, 0x0000000b, 0x00000002, 0x00000000,
  35.560 -    0x00000006, 0x00000003, 0x00000000, 0x00000000, 0x00000001, 0x00000000,
  35.561 -    0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
  35.562 -    0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000003, 0x00000000,
  35.563 -    0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
  35.564 -    0x00000000, 0x00000000, 0x46454452, 0x000000fc, 0x00000001, 0x00000054,
  35.565 -    0x00000001, 0x0000001c, 0xfffe0400, 0x00000100, 0x000000c6, 0x0000003c,
  35.566 -    0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000001,
  35.567 -    0x00000001, 0x74726556, 0x68537865, 0x72656461, 0x736e6f43, 0x746e6174,
  35.568 -    0xabab0073, 0x0000003c, 0x00000002, 0x0000006c, 0x00000080, 0x00000000,
  35.569 -    0x00000000, 0x0000009c, 0x00000000, 0x00000040, 0x00000002, 0x000000a4,
  35.570 -    0x00000000, 0x000000b4, 0x00000040, 0x00000040, 0x00000002, 0x000000a4,
  35.571 -    0x00000000, 0x65646f6d, 0xabab006c, 0x00030002, 0x00040004, 0x00000000,
  35.572 -    0x00000000, 0x6a6f7270, 0x69746365, 0x6e416e6f, 0x65695664, 0x694d0077,
  35.573 -    0x736f7263, 0x2074666f, 0x20295228, 0x4c534c48, 0x61685320, 0x20726564,
  35.574 -    0x706d6f43, 0x72656c69, 0x332e3920, 0x32392e30, 0x312e3030, 0x34383336,
  35.575 -    0xababab00, 0x4e475349, 0x00000068, 0x00000003, 0x00000008, 0x00000050,
  35.576 -    0x00000000, 0x00000000, 0x00000003, 0x00000000, 0x00000707, 0x00000059,
  35.577 -    0x00000000, 0x00000000, 0x00000003, 0x00000001, 0x00000303, 0x00000062,
  35.578 -    0x00000000, 0x00000000, 0x00000003, 0x00000002, 0x00000f0f, 0x49534f50,
  35.579 -    0x4e4f4954, 0x58455400, 0x524f4f43, 0x4f430044, 0x00524f4c, 0x4e47534f,
  35.580 -    0x0000006c, 0x00000003, 0x00000008, 0x00000050, 0x00000000, 0x00000001,
  35.581 -    0x00000003, 0x00000000, 0x0000000f, 0x0000005c, 0x00000000, 0x00000000,
  35.582 -    0x00000003, 0x00000001, 0x00000c03, 0x00000065, 0x00000000, 0x00000000,
  35.583 -    0x00000003, 0x00000002, 0x0000000f, 0x505f5653, 0x5449534f, 0x004e4f49,
  35.584 -    0x43584554, 0x44524f4f, 0x4c4f4300, 0xab00524f
  35.585 -};
  35.586 -#else
  35.587 -#error "An appropriate vertex shader is not defined."
  35.588 -#endif
  35.589 -
  35.590  
  35.591  /* Direct3D 11.1 renderer implementation */
  35.592  static SDL_Renderer *D3D11_CreateRenderer(SDL_Window * window, Uint32 flags);
  35.593 @@ -773,12 +230,14 @@
  35.594              SDL_RENDERER_PRESENTVSYNC |
  35.595              SDL_RENDERER_TARGETTEXTURE
  35.596          ),                          /* flags.  see SDL_RendererFlags */
  35.597 -        4,                          /* num_texture_formats */
  35.598 +        6,                          /* num_texture_formats */
  35.599          {                           /* texture_formats */
  35.600              SDL_PIXELFORMAT_ARGB8888,
  35.601              SDL_PIXELFORMAT_RGB888,
  35.602              SDL_PIXELFORMAT_YV12,
  35.603 -            SDL_PIXELFORMAT_IYUV
  35.604 +            SDL_PIXELFORMAT_IYUV,
  35.605 +            SDL_PIXELFORMAT_NV12,
  35.606 +            SDL_PIXELFORMAT_NV21
  35.607          },
  35.608          0,                          /* max_texture_width: will be filled in later */
  35.609          0                           /* max_texture_height: will be filled in later */
  35.610 @@ -787,7 +246,8 @@
  35.611  
  35.612  
  35.613  Uint32
  35.614 -D3D11_DXGIFormatToSDLPixelFormat(DXGI_FORMAT dxgiFormat) {
  35.615 +D3D11_DXGIFormatToSDLPixelFormat(DXGI_FORMAT dxgiFormat)
  35.616 +{
  35.617      switch (dxgiFormat) {
  35.618          case DXGI_FORMAT_B8G8R8A8_UNORM:
  35.619              return SDL_PIXELFORMAT_ARGB8888;
  35.620 @@ -808,6 +268,8 @@
  35.621              return DXGI_FORMAT_B8G8R8X8_UNORM;
  35.622          case SDL_PIXELFORMAT_YV12:
  35.623          case SDL_PIXELFORMAT_IYUV:
  35.624 +        case SDL_PIXELFORMAT_NV12:  /* For the Y texture */
  35.625 +        case SDL_PIXELFORMAT_NV21:  /* For the Y texture */
  35.626              return DXGI_FORMAT_R8_UNORM;
  35.627          default:
  35.628              return DXGI_FORMAT_UNKNOWN;
  35.629 @@ -918,9 +380,9 @@
  35.630          SAFE_RELEASE(data->inputLayout);
  35.631          SAFE_RELEASE(data->vertexBuffer);
  35.632          SAFE_RELEASE(data->vertexShader);
  35.633 -        SAFE_RELEASE(data->colorPixelShader);
  35.634 -        SAFE_RELEASE(data->texturePixelShader);
  35.635 -        SAFE_RELEASE(data->yuvPixelShader);
  35.636 +        for (i = 0; i < SDL_arraysize(data->pixelShaders); ++i) {
  35.637 +            SAFE_RELEASE(data->pixelShaders[i]);
  35.638 +        }
  35.639          if (data->blendModesCount > 0) {
  35.640              for (i = 0; i < data->blendModesCount; ++i) {
  35.641                  SAFE_RELEASE(data->blendModes[i].blendState);
  35.642 @@ -1074,6 +536,7 @@
  35.643      IDXGIDevice1 *dxgiDevice = NULL;
  35.644      HRESULT result = S_OK;
  35.645      UINT creationFlags;
  35.646 +    int i;
  35.647  
  35.648      /* This array defines the set of DirectX hardware feature levels this app will support.
  35.649       * Note the ordering should be preserved.
  35.650 @@ -1091,14 +554,6 @@
  35.651          D3D_FEATURE_LEVEL_9_1
  35.652      };
  35.653  
  35.654 -    /* Declare how the input layout for SDL's vertex shader will be setup: */
  35.655 -    const D3D11_INPUT_ELEMENT_DESC vertexDesc[] = 
  35.656 -    {
  35.657 -        { "POSITION", 0, DXGI_FORMAT_R32G32B32_FLOAT, 0, 0, D3D11_INPUT_PER_VERTEX_DATA, 0 },
  35.658 -        { "TEXCOORD", 0, DXGI_FORMAT_R32G32_FLOAT, 0, 12, D3D11_INPUT_PER_VERTEX_DATA, 0 },
  35.659 -        { "COLOR", 0, DXGI_FORMAT_R32G32B32A32_FLOAT, 0, 20, D3D11_INPUT_PER_VERTEX_DATA, 0 },
  35.660 -    };
  35.661 -
  35.662      D3D11_BUFFER_DESC constantBufferDesc;
  35.663      D3D11_SAMPLER_DESC samplerDesc;
  35.664      D3D11_RASTERIZER_DESC rasterDesc;
  35.665 @@ -1230,63 +685,14 @@
  35.666              goto done;
  35.667      }
  35.668  
  35.669 -    /* Load in SDL's one and only vertex shader: */
  35.670 -    result = ID3D11Device_CreateVertexShader(data->d3dDevice,
  35.671 -        D3D11_VertexShader,
  35.672 -        sizeof(D3D11_VertexShader),
  35.673 -        NULL,
  35.674 -        &data->vertexShader
  35.675 -        );
  35.676 -    if (FAILED(result)) {
  35.677 -        WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("ID3D11Device1::CreateVertexShader"), result);
  35.678 +    if (D3D11_CreateVertexShader(data->d3dDevice, &data->vertexShader, &data->inputLayout) < 0) {
  35.679          goto done;
  35.680      }
  35.681  
  35.682 -    /* Create an input layout for SDL's vertex shader: */
  35.683 -    result = ID3D11Device_CreateInputLayout(data->d3dDevice,
  35.684 -        vertexDesc,
  35.685 -        ARRAYSIZE(vertexDesc),
  35.686 -        D3D11_VertexShader,
  35.687 -        sizeof(D3D11_VertexShader),
  35.688 -        &data->inputLayout
  35.689 -        );
  35.690 -    if (FAILED(result)) {
  35.691 -        WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("ID3D11Device1::CreateInputLayout"), result);
  35.692 -        goto done;
  35.693 -    }
  35.694 -
  35.695 -    /* Load in SDL's pixel shaders */
  35.696 -    result = ID3D11Device_CreatePixelShader(data->d3dDevice,
  35.697 -        D3D11_PixelShader_Colors,
  35.698 -        sizeof(D3D11_PixelShader_Colors),
  35.699 -        NULL,
  35.700 -        &data->colorPixelShader
  35.701 -        );
  35.702 -    if (FAILED(result)) {
  35.703 -        WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("ID3D11Device1::CreatePixelShader ['color' shader]"), result);
  35.704 -        goto done;
  35.705 -    }
  35.706 -
  35.707 -    result = ID3D11Device_CreatePixelShader(data->d3dDevice,
  35.708 -        D3D11_PixelShader_Textures,
  35.709 -        sizeof(D3D11_PixelShader_Textures),
  35.710 -        NULL,
  35.711 -        &data->texturePixelShader
  35.712 -        );
  35.713 -    if (FAILED(result)) {
  35.714 -        WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("ID3D11Device1::CreatePixelShader ['textures' shader]"), result);
  35.715 -        goto done;
  35.716 -    }
  35.717 -
  35.718 -    result = ID3D11Device_CreatePixelShader(data->d3dDevice,
  35.719 -        D3D11_PixelShader_YUV,
  35.720 -        sizeof(D3D11_PixelShader_YUV),
  35.721 -        NULL,
  35.722 -        &data->yuvPixelShader
  35.723 -        );
  35.724 -    if (FAILED(result)) {
  35.725 -        WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("ID3D11Device1::CreatePixelShader ['yuv' shader]"), result);
  35.726 -        goto done;
  35.727 +    for (i = 0; i < SDL_arraysize(data->pixelShaders); ++i) {
  35.728 +        if (D3D11_CreatePixelShader(data->d3dDevice, (D3D11_Shader)i, &data->pixelShaders[i]) < 0) {
  35.729 +            goto done;
  35.730 +        }
  35.731      }
  35.732  
  35.733      /* Setup space to hold vertex shader constants: */
  35.734 @@ -1829,8 +1235,8 @@
  35.735          texture->format == SDL_PIXELFORMAT_IYUV) {
  35.736          textureData->yuv = SDL_TRUE;
  35.737  
  35.738 -        textureDesc.Width /= 2;
  35.739 -        textureDesc.Height /= 2;
  35.740 +        textureDesc.Width = (textureDesc.Width + 1) / 2;
  35.741 +        textureDesc.Height = (textureDesc.Height + 1) / 2;
  35.742  
  35.743          result = ID3D11Device_CreateTexture2D(rendererData->d3dDevice,
  35.744              &textureDesc,
  35.745 @@ -1855,6 +1261,28 @@
  35.746          }
  35.747      }
  35.748  
  35.749 +    if (texture->format == SDL_PIXELFORMAT_NV12 ||
  35.750 +        texture->format == SDL_PIXELFORMAT_NV21) {
  35.751 +        D3D11_TEXTURE2D_DESC nvTextureDesc = textureDesc;
  35.752 +
  35.753 +        textureData->nv12 = SDL_TRUE;
  35.754 +
  35.755 +        nvTextureDesc.Format = DXGI_FORMAT_R8G8_UNORM;
  35.756 +        nvTextureDesc.Width = (textureDesc.Width + 1) / 2;
  35.757 +        nvTextureDesc.Height = (textureDesc.Height + 1) / 2;
  35.758 +
  35.759 +        result = ID3D11Device_CreateTexture2D(rendererData->d3dDevice,
  35.760 +            &nvTextureDesc,
  35.761 +            NULL,
  35.762 +            &textureData->mainTextureNV
  35.763 +            );
  35.764 +        if (FAILED(result)) {
  35.765 +            D3D11_DestroyTexture(renderer, texture);
  35.766 +            WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("ID3D11Device1::CreateTexture2D"), result);
  35.767 +            return -1;
  35.768 +        }
  35.769 +    }
  35.770 +
  35.771      resourceViewDesc.Format = textureDesc.Format;
  35.772      resourceViewDesc.ViewDimension = D3D11_SRV_DIMENSION_TEXTURE2D;
  35.773      resourceViewDesc.Texture2D.MostDetailedMip = 0;
  35.774 @@ -1893,6 +1321,23 @@
  35.775          }
  35.776      }
  35.777  
  35.778 +    if (textureData->nv12) {
  35.779 +        D3D11_SHADER_RESOURCE_VIEW_DESC nvResourceViewDesc = resourceViewDesc;
  35.780 +
  35.781 +        nvResourceViewDesc.Format = DXGI_FORMAT_R8G8_UNORM;
  35.782 +
  35.783 +        result = ID3D11Device_CreateShaderResourceView(rendererData->d3dDevice,
  35.784 +            (ID3D11Resource *)textureData->mainTextureNV,
  35.785 +            &nvResourceViewDesc,
  35.786 +            &textureData->mainTextureResourceViewNV
  35.787 +            );
  35.788 +        if (FAILED(result)) {
  35.789 +            D3D11_DestroyTexture(renderer, texture);
  35.790 +            WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("ID3D11Device1::CreateShaderResourceView"), result);
  35.791 +            return -1;
  35.792 +        }
  35.793 +    }
  35.794 +
  35.795      if (texture->access & SDL_TEXTUREACCESS_TARGET) {
  35.796          D3D11_RENDER_TARGET_VIEW_DESC renderTargetViewDesc;
  35.797          renderTargetViewDesc.Format = textureDesc.Format;
  35.798 @@ -1937,7 +1382,7 @@
  35.799  }
  35.800  
  35.801  static int
  35.802 -D3D11_UpdateTextureInternal(D3D11_RenderData *rendererData, ID3D11Texture2D *texture, Uint32 format, int x, int y, int w, int h, const void *pixels, int pitch)
  35.803 +D3D11_UpdateTextureInternal(D3D11_RenderData *rendererData, ID3D11Texture2D *texture, int bpp, int x, int y, int w, int h, const void *pixels, int pitch)
  35.804  {
  35.805      ID3D11Texture2D *stagingTexture;
  35.806      const Uint8 *src;
  35.807 @@ -1981,7 +1426,7 @@
  35.808  
  35.809      src = (const Uint8 *)pixels;
  35.810      dst = textureMemory.pData;
  35.811 -    length = w * SDL_BYTESPERPIXEL(format);
  35.812 +    length = w * bpp;
  35.813      if (length == pitch && length == textureMemory.RowPitch) {
  35.814          SDL_memcpy(dst, src, length*h);
  35.815      } else {
  35.816 @@ -2032,7 +1477,7 @@
  35.817          return -1;
  35.818      }
  35.819  
  35.820 -    if (D3D11_UpdateTextureInternal(rendererData, textureData->mainTexture, texture->format, rect->x, rect->y, rect->w, rect->h, srcPixels, srcPitch) < 0) {
  35.821 +    if (D3D11_UpdateTextureInternal(rendererData, textureData->mainTexture, SDL_BYTESPERPIXEL(texture->format), rect->x, rect->y, rect->w, rect->h, srcPixels, srcPitch) < 0) {
  35.822          return -1;
  35.823      }
  35.824  
  35.825 @@ -2040,13 +1485,22 @@
  35.826          /* Skip to the correct offset into the next texture */
  35.827          srcPixels = (const void*)((const Uint8*)srcPixels + rect->h * srcPitch);
  35.828  
  35.829 -        if (D3D11_UpdateTextureInternal(rendererData, texture->format == SDL_PIXELFORMAT_YV12 ? textureData->mainTextureV : textureData->mainTextureU, texture->format, rect->x / 2, rect->y / 2, rect->w / 2, rect->h / 2, srcPixels, srcPitch / 2) < 0) {
  35.830 +        if (D3D11_UpdateTextureInternal(rendererData, texture->format == SDL_PIXELFORMAT_YV12 ? textureData->mainTextureV : textureData->mainTextureU, SDL_BYTESPERPIXEL(texture->format), rect->x / 2, rect->y / 2, (rect->w + 1) / 2, (rect->h + 1) / 2, srcPixels, (srcPitch + 1) / 2) < 0) {
  35.831              return -1;
  35.832          }
  35.833  
  35.834          /* Skip to the correct offset into the next texture */
  35.835 -        srcPixels = (const void*)((const Uint8*)srcPixels + (rect->h * srcPitch) / 4);
  35.836 -        if (D3D11_UpdateTextureInternal(rendererData, texture->format == SDL_PIXELFORMAT_YV12 ? textureData->mainTextureU : textureData->mainTextureV, texture->format, rect->x / 2, rect->y / 2, rect->w / 2, rect->h / 2, srcPixels, srcPitch / 2) < 0) {
  35.837 +        srcPixels = (const void*)((const Uint8*)srcPixels + ((rect->h + 1) / 2) * ((srcPitch + 1) / 2));
  35.838 +        if (D3D11_UpdateTextureInternal(rendererData, texture->format == SDL_PIXELFORMAT_YV12 ? textureData->mainTextureU : textureData->mainTextureV, SDL_BYTESPERPIXEL(texture->format), rect->x / 2, rect->y / 2, (rect->w + 1) / 2, (rect->h + 1) / 2, srcPixels, (srcPitch + 1) / 2) < 0) {
  35.839 +            return -1;
  35.840 +        }
  35.841 +    }
  35.842 +
  35.843 +    if (textureData->nv12) {
  35.844 +        /* Skip to the correct offset into the next texture */
  35.845 +        srcPixels = (const void*)((const Uint8*)srcPixels + rect->h * srcPitch);
  35.846 +
  35.847 +        if (D3D11_UpdateTextureInternal(rendererData, textureData->mainTextureNV, 2, rect->x / 2, rect->y / 2, ((rect->w + 1) / 2), (rect->h + 1) / 2, srcPixels, 2*((srcPitch + 1) / 2)) < 0) {
  35.848              return -1;
  35.849          }
  35.850      }
  35.851 @@ -2068,13 +1522,13 @@
  35.852          return -1;
  35.853      }
  35.854  
  35.855 -    if (D3D11_UpdateTextureInternal(rendererData, textureData->mainTexture, texture->format, rect->x, rect->y, rect->w, rect->h, Yplane, Ypitch) < 0) {
  35.856 +    if (D3D11_UpdateTextureInternal(rendererData, textureData->mainTexture, SDL_BYTESPERPIXEL(texture->format), rect->x, rect->y, rect->w, rect->h, Yplane, Ypitch) < 0) {
  35.857          return -1;
  35.858      }
  35.859 -    if (D3D11_UpdateTextureInternal(rendererData, textureData->mainTextureU, texture->format, rect->x / 2, rect->y / 2, rect->w / 2, rect->h / 2, Uplane, Upitch) < 0) {
  35.860 +    if (D3D11_UpdateTextureInternal(rendererData, textureData->mainTextureU, SDL_BYTESPERPIXEL(texture->format), rect->x / 2, rect->y / 2, rect->w / 2, rect->h / 2, Uplane, Upitch) < 0) {
  35.861          return -1;
  35.862      }
  35.863 -    if (D3D11_UpdateTextureInternal(rendererData, textureData->mainTextureV, texture->format, rect->x / 2, rect->y / 2, rect->w / 2, rect->h / 2, Vplane, Vpitch) < 0) {
  35.864 +    if (D3D11_UpdateTextureInternal(rendererData, textureData->mainTextureV, SDL_BYTESPERPIXEL(texture->format), rect->x / 2, rect->y / 2, rect->w / 2, rect->h / 2, Vplane, Vpitch) < 0) {
  35.865          return -1;
  35.866      }
  35.867      return 0;
  35.868 @@ -2095,7 +1549,7 @@
  35.869          return -1;
  35.870      }
  35.871  
  35.872 -    if (textureData->yuv) {
  35.873 +    if (textureData->yuv || textureData->nv12) {
  35.874          /* It's more efficient to upload directly... */
  35.875          if (!textureData->pixels) {
  35.876              textureData->pitch = texture->w;
  35.877 @@ -2178,7 +1632,7 @@
  35.878          return;
  35.879      }
  35.880  
  35.881 -    if (textureData->yuv) {
  35.882 +    if (textureData->yuv || textureData->nv12) {
  35.883          const SDL_Rect *rect = &textureData->locked_rect;
  35.884          void *pixels =
  35.885              (void *) ((Uint8 *) textureData->pixels + rect->y * textureData->pitch +
  35.886 @@ -2594,7 +2048,7 @@
  35.887  
  35.888      D3D11_SetPixelShader(
  35.889          renderer,
  35.890 -        rendererData->colorPixelShader,
  35.891 +        rendererData->pixelShaders[SHADER_SOLID],
  35.892          0,
  35.893          NULL,
  35.894          NULL);
  35.895 @@ -2633,7 +2087,7 @@
  35.896  
  35.897      D3D11_SetPixelShader(
  35.898          renderer,
  35.899 -        rendererData->colorPixelShader,
  35.900 +        rendererData->pixelShaders[SHADER_SOLID],
  35.901          0,
  35.902          NULL,
  35.903          NULL);
  35.904 @@ -2678,7 +2132,7 @@
  35.905  
  35.906          D3D11_SetPixelShader(
  35.907              renderer,
  35.908 -            rendererData->colorPixelShader,
  35.909 +            rendererData->pixelShaders[SHADER_SOLID],
  35.910              0,
  35.911              NULL,
  35.912              NULL);
  35.913 @@ -2689,20 +2143,91 @@
  35.914      return 0;
  35.915  }
  35.916  
  35.917 -static ID3D11SamplerState *
  35.918 -D3D11_RenderGetSampler(SDL_Renderer * renderer, SDL_Texture * texture)
  35.919 +static int
  35.920 +D3D11_RenderSetupSampler(SDL_Renderer * renderer, SDL_Texture * texture)
  35.921  {
  35.922      D3D11_RenderData *rendererData = (D3D11_RenderData *) renderer->driverdata;
  35.923      D3D11_TextureData *textureData = (D3D11_TextureData *) texture->driverdata;
  35.924 +    ID3D11SamplerState *textureSampler;
  35.925  
  35.926      switch (textureData->scaleMode) {
  35.927      case D3D11_FILTER_MIN_MAG_MIP_POINT:
  35.928 -        return rendererData->nearestPixelSampler;
  35.929 +        textureSampler = rendererData->nearestPixelSampler;
  35.930 +        break;
  35.931      case D3D11_FILTER_MIN_MAG_MIP_LINEAR:
  35.932 -        return rendererData->linearSampler;
  35.933 +        textureSampler = rendererData->linearSampler;
  35.934 +        break;
  35.935      default:
  35.936 -        return NULL;
  35.937 +        return SDL_SetError("Unknown scale mode: %d\n", textureData->scaleMode);
  35.938      }
  35.939 +
  35.940 +    if (textureData->yuv) {
  35.941 +        ID3D11ShaderResourceView *shaderResources[] = {
  35.942 +            textureData->mainTextureResourceView,
  35.943 +            textureData->mainTextureResourceViewU,
  35.944 +            textureData->mainTextureResourceViewV
  35.945 +        };
  35.946 +        D3D11_Shader shader;
  35.947 +
  35.948 +        switch (SDL_GetYUVConversionModeForResolution(texture->w, texture->h)) {
  35.949 +        case SDL_YUV_CONVERSION_JPEG:
  35.950 +            shader = SHADER_YUV_JPEG;
  35.951 +            break;
  35.952 +        case SDL_YUV_CONVERSION_BT601:
  35.953 +            shader = SHADER_YUV_BT601;
  35.954 +            break;
  35.955 +        case SDL_YUV_CONVERSION_BT709:
  35.956 +            shader = SHADER_YUV_BT709;
  35.957 +            break;
  35.958 +        default:
  35.959 +            return SDL_SetError("Unsupported YUV conversion mode");
  35.960 +        }
  35.961 +
  35.962 +        D3D11_SetPixelShader(
  35.963 +            renderer,
  35.964 +            rendererData->pixelShaders[shader],
  35.965 +            SDL_arraysize(shaderResources),
  35.966 +            shaderResources,
  35.967 +            textureSampler);
  35.968 +
  35.969 +    } else if (textureData->nv12) {
  35.970 +        ID3D11ShaderResourceView *shaderResources[] = {
  35.971 +            textureData->mainTextureResourceView,
  35.972 +            textureData->mainTextureResourceViewNV,
  35.973 +        };
  35.974 +        D3D11_Shader shader;
  35.975 +
  35.976 +        switch (SDL_GetYUVConversionModeForResolution(texture->w, texture->h)) {
  35.977 +        case SDL_YUV_CONVERSION_JPEG:
  35.978 +            shader = texture->format == SDL_PIXELFORMAT_NV12 ? SHADER_NV12_JPEG : SHADER_NV21_JPEG;
  35.979 +            break;
  35.980 +        case SDL_YUV_CONVERSION_BT601:
  35.981 +            shader = texture->format == SDL_PIXELFORMAT_NV12 ? SHADER_NV12_BT601 : SHADER_NV21_BT601;
  35.982 +            break;
  35.983 +        case SDL_YUV_CONVERSION_BT709:
  35.984 +            shader = texture->format == SDL_PIXELFORMAT_NV12 ? SHADER_NV12_BT709 : SHADER_NV21_BT709;
  35.985 +            break;
  35.986 +        default:
  35.987 +            return SDL_SetError("Unsupported YUV conversion mode");
  35.988 +        }
  35.989 +
  35.990 +        D3D11_SetPixelShader(
  35.991 +            renderer,
  35.992 +            rendererData->pixelShaders[shader],
  35.993 +            SDL_arraysize(shaderResources),
  35.994 +            shaderResources,
  35.995 +            textureSampler);
  35.996 +
  35.997 +    } else {
  35.998 +        D3D11_SetPixelShader(
  35.999 +            renderer,
 35.1000 +            rendererData->pixelShaders[SHADER_RGB],
 35.1001 +            1,
 35.1002 +            &textureData->mainTextureResourceView,
 35.1003 +            textureSampler);
 35.1004 +    }
 35.1005 +
 35.1006 +    return 0;
 35.1007  }
 35.1008  
 35.1009  static int
 35.1010 @@ -2714,7 +2239,6 @@
 35.1011      float minu, maxu, minv, maxv;
 35.1012      Float4 color;
 35.1013      VertexPositionColor vertices[4];
 35.1014 -    ID3D11SamplerState *textureSampler;
 35.1015  
 35.1016      D3D11_RenderStartDrawOp(renderer);
 35.1017      D3D11_RenderSetBlendMode(renderer, texture->blendMode);
 35.1018 @@ -2769,26 +2293,8 @@
 35.1019          return -1;
 35.1020      }
 35.1021  
 35.1022 -    textureSampler = D3D11_RenderGetSampler(renderer, texture);
 35.1023 -    if (textureData->yuv) {
 35.1024 -        ID3D11ShaderResourceView *shaderResources[] = {
 35.1025 -            textureData->mainTextureResourceView,
 35.1026 -            textureData->mainTextureResourceViewU,
 35.1027 -            textureData->mainTextureResourceViewV
 35.1028 -        };
 35.1029 -        D3D11_SetPixelShader(
 35.1030 -            renderer,
 35.1031 -            rendererData->yuvPixelShader,
 35.1032 -            SDL_arraysize(shaderResources),
 35.1033 -            shaderResources,
 35.1034 -            textureSampler);
 35.1035 -    } else {
 35.1036 -        D3D11_SetPixelShader(
 35.1037 -            renderer,
 35.1038 -            rendererData->texturePixelShader,
 35.1039 -            1,
 35.1040 -            &textureData->mainTextureResourceView,
 35.1041 -            textureSampler);
 35.1042 +    if (D3D11_RenderSetupSampler(renderer, texture) < 0) {
 35.1043 +        return -1;
 35.1044      }
 35.1045  
 35.1046      D3D11_RenderFinishDrawOp(renderer, D3D11_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP, sizeof(vertices) / sizeof(VertexPositionColor));
 35.1047 @@ -2808,7 +2314,6 @@
 35.1048      Float4X4 modelMatrix;
 35.1049      float minx, maxx, miny, maxy;
 35.1050      VertexPositionColor vertices[4];
 35.1051 -    ID3D11SamplerState *textureSampler;
 35.1052  
 35.1053      D3D11_RenderStartDrawOp(renderer);
 35.1054      D3D11_RenderSetBlendMode(renderer, texture->blendMode);
 35.1055 @@ -2885,26 +2390,8 @@
 35.1056          return -1;
 35.1057      }
 35.1058  
 35.1059 -    textureSampler = D3D11_RenderGetSampler(renderer, texture);
 35.1060 -    if (textureData->yuv) {
 35.1061 -        ID3D11ShaderResourceView *shaderResources[] = {
 35.1062 -            textureData->mainTextureResourceView,
 35.1063 -            textureData->mainTextureResourceViewU,
 35.1064 -            textureData->mainTextureResourceViewV
 35.1065 -        };
 35.1066 -        D3D11_SetPixelShader(
 35.1067 -            renderer,
 35.1068 -            rendererData->yuvPixelShader,
 35.1069 -            SDL_arraysize(shaderResources),
 35.1070 -            shaderResources,
 35.1071 -            textureSampler);
 35.1072 -    } else {
 35.1073 -        D3D11_SetPixelShader(
 35.1074 -            renderer,
 35.1075 -            rendererData->texturePixelShader,
 35.1076 -            1,
 35.1077 -            &textureData->mainTextureResourceView,
 35.1078 -            textureSampler);
 35.1079 +    if (D3D11_RenderSetupSampler(renderer, texture) < 0) {
 35.1080 +        return -1;
 35.1081      }
 35.1082  
 35.1083      D3D11_RenderFinishDrawOp(renderer, D3D11_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP, sizeof(vertices) / sizeof(VertexPositionColor));
    36.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    36.2 +++ b/src/render/direct3d11/SDL_shaders_d3d11.c	Sun Nov 12 22:51:12 2017 -0800
    36.3 @@ -0,0 +1,1957 @@
    36.4 +/*
    36.5 +  Simple DirectMedia Layer
    36.6 +  Copyright (C) 1997-2017 Sam Lantinga <slouken@libsdl.org>
    36.7 +
    36.8 +  This software is provided 'as-is', without any express or implied
    36.9 +  warranty.  In no event will the authors be held liable for any damages
   36.10 +  arising from the use of this software.
   36.11 +
   36.12 +  Permission is granted to anyone to use this software for any purpose,
   36.13 +  including commercial applications, and to alter it and redistribute it
   36.14 +  freely, subject to the following restrictions:
   36.15 +
   36.16 +  1. The origin of this software must not be misrepresented; you must not
   36.17 +     claim that you wrote the original software. If you use this software
   36.18 +     in a product, an acknowledgment in the product documentation would be
   36.19 +     appreciated but is not required.
   36.20 +  2. Altered source versions must be plainly marked as such, and must not be
   36.21 +     misrepresented as being the original software.
   36.22 +  3. This notice may not be removed or altered from any source distribution.
   36.23 +*/
   36.24 +#include "../../SDL_internal.h"
   36.25 +
   36.26 +#if SDL_VIDEO_RENDER_D3D11 && !SDL_RENDER_DISABLED
   36.27 +
   36.28 +#include "SDL_stdinc.h"
   36.29 +
   36.30 +#define COBJMACROS
   36.31 +#include "../../core/windows/SDL_windows.h"
   36.32 +#include <d3d11_1.h>
   36.33 +
   36.34 +#include "SDL_shaders_d3d11.h"
   36.35 +
   36.36 +#define SDL_COMPOSE_ERROR(str) SDL_STRINGIFY_ARG(__FUNCTION__) ", " str
   36.37 +
   36.38 +
   36.39 +/* Direct3D 11.x shaders
   36.40 +
   36.41 +   SDL's shaders are compiled into SDL itself, to simplify distribution.
   36.42 +
   36.43 +   All Direct3D 11.x shaders were compiled with the following:
   36.44 +
   36.45 +   fxc /E"main" /T "<TYPE>" /Fo"<OUTPUT FILE>" "<INPUT FILE>"
   36.46 +
   36.47 +     Variables:
   36.48 +     - <TYPE>: the type of shader.  A table of utilized shader types is
   36.49 +       listed below.
   36.50 +     - <OUTPUT FILE>: where to store compiled output
   36.51 +     - <INPUT FILE>: where to read shader source code from
   36.52 +
   36.53 +     Shader types:
   36.54 +     - ps_4_0_level_9_1: Pixel shader for Windows 8+, including Windows RT
   36.55 +     - vs_4_0_level_9_1: Vertex shader for Windows 8+, including Windows RT
   36.56 +     - ps_4_0_level_9_3: Pixel shader for Windows Phone 8
   36.57 +     - vs_4_0_level_9_3: Vertex shader for Windows Phone 8
   36.58 +   
   36.59 +
   36.60 +   Shader object code was converted to a list of DWORDs via the following
   36.61 +   *nix style command (available separately from Windows + MSVC):
   36.62 +
   36.63 +     hexdump -v -e '6/4 "0x%08.8x, " "\n"' <FILE>
   36.64 +  */
   36.65 +#if WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP
   36.66 +#define D3D11_USE_SHADER_MODEL_4_0_level_9_3
   36.67 +#else
   36.68 +#define D3D11_USE_SHADER_MODEL_4_0_level_9_1
   36.69 +#endif
   36.70 +
   36.71 +/* The color-only-rendering pixel shader:
   36.72 +
   36.73 +   --- D3D11_PixelShader_Colors.hlsl ---
   36.74 +   struct PixelShaderInput
   36.75 +   {
   36.76 +       float4 pos : SV_POSITION;
   36.77 +       float2 tex : TEXCOORD0;
   36.78 +       float4 color : COLOR0;
   36.79 +   };
   36.80 +
   36.81 +   float4 main(PixelShaderInput input) : SV_TARGET
   36.82 +   {
   36.83 +       return input.color;
   36.84 +   }
   36.85 +*/
   36.86 +#if defined(D3D11_USE_SHADER_MODEL_4_0_level_9_1)
   36.87 +static const DWORD D3D11_PixelShader_Colors[] = {
   36.88 +    0x43425844, 0xd74c28fe, 0xa1eb8804, 0x269d512a, 0x7699723d, 0x00000001,
   36.89 +    0x00000240, 0x00000006, 0x00000038, 0x00000084, 0x000000c4, 0x00000140,
   36.90 +    0x00000198, 0x0000020c, 0x396e6f41, 0x00000044, 0x00000044, 0xffff0200,
   36.91 +    0x00000020, 0x00000024, 0x00240000, 0x00240000, 0x00240000, 0x00240000,
   36.92 +    0x00240000, 0xffff0200, 0x0200001f, 0x80000000, 0xb00f0001, 0x02000001,
   36.93 +    0x800f0800, 0xb0e40001, 0x0000ffff, 0x52444853, 0x00000038, 0x00000040,
   36.94 +    0x0000000e, 0x03001062, 0x001010f2, 0x00000002, 0x03000065, 0x001020f2,
   36.95 +    0x00000000, 0x05000036, 0x001020f2, 0x00000000, 0x00101e46, 0x00000002,
   36.96 +    0x0100003e, 0x54415453, 0x00000074, 0x00000002, 0x00000000, 0x00000000,
   36.97 +    0x00000002, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000000,
   36.98 +    0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
   36.99 +    0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0x00000000,
  36.100 +    0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
  36.101 +    0x00000000, 0x00000000, 0x46454452, 0x00000050, 0x00000000, 0x00000000,
  36.102 +    0x00000000, 0x0000001c, 0xffff0400, 0x00000100, 0x0000001c, 0x7263694d,
  36.103 +    0x666f736f, 0x52282074, 0x4c482029, 0x53204c53, 0x65646168, 0x6f432072,
  36.104 +    0x6c69706d, 0x39207265, 0x2e30332e, 0x30303239, 0x3336312e, 0xab003438,
  36.105 +    0x4e475349, 0x0000006c, 0x00000003, 0x00000008, 0x00000050, 0x00000000,
  36.106 +    0x00000001, 0x00000003, 0x00000000, 0x0000000f, 0x0000005c, 0x00000000,
  36.107 +    0x00000000, 0x00000003, 0x00000001, 0x00000003, 0x00000065, 0x00000000,
  36.108 +    0x00000000, 0x00000003, 0x00000002, 0x00000f0f, 0x505f5653, 0x5449534f,
  36.109 +    0x004e4f49, 0x43584554, 0x44524f4f, 0x4c4f4300, 0xab00524f, 0x4e47534f,
  36.110 +    0x0000002c, 0x00000001, 0x00000008, 0x00000020, 0x00000000, 0x00000000,
  36.111 +    0x00000003, 0x00000000, 0x0000000f, 0x545f5653, 0x45475241, 0xabab0054
  36.112 +};
  36.113 +#elif defined(D3D11_USE_SHADER_MODEL_4_0_level_9_3)
  36.114 +static const DWORD D3D11_PixelShader_Colors[] = {
  36.115 +    0x43425844, 0x93f6ccfc, 0x5f919270, 0x7a11aa4f, 0x9148e931, 0x00000001,
  36.116 +    0x00000240, 0x00000006, 0x00000038, 0x00000084, 0x000000c4, 0x00000140,
  36.117 +    0x00000198, 0x0000020c, 0x396e6f41, 0x00000044, 0x00000044, 0xffff0200,
  36.118 +    0x00000020, 0x00000024, 0x00240000, 0x00240000, 0x00240000, 0x00240000,
  36.119 +    0x00240000, 0xffff0201, 0x0200001f, 0x80000000, 0xb00f0001, 0x02000001,
  36.120 +    0x800f0800, 0xb0e40001, 0x0000ffff, 0x52444853, 0x00000038, 0x00000040,
  36.121 +    0x0000000e, 0x03001062, 0x001010f2, 0x00000002, 0x03000065, 0x001020f2,
  36.122 +    0x00000000, 0x05000036, 0x001020f2, 0x00000000, 0x00101e46, 0x00000002,
  36.123 +    0x0100003e, 0x54415453, 0x00000074, 0x00000002, 0x00000000, 0x00000000,
  36.124 +    0x00000002, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000000,
  36.125 +    0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
  36.126 +    0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0x00000000,
  36.127 +    0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
  36.128 +    0x00000000, 0x00000000, 0x46454452, 0x00000050, 0x00000000, 0x00000000,
  36.129 +    0x00000000, 0x0000001c, 0xffff0400, 0x00000100, 0x0000001c, 0x7263694d,
  36.130 +    0x666f736f, 0x52282074, 0x4c482029, 0x53204c53, 0x65646168, 0x6f432072,
  36.131 +    0x6c69706d, 0x39207265, 0x2e30332e, 0x30303239, 0x3336312e, 0xab003438,
  36.132 +    0x4e475349, 0x0000006c, 0x00000003, 0x00000008, 0x00000050, 0x00000000,
  36.133 +    0x00000001, 0x00000003, 0x00000000, 0x0000000f, 0x0000005c, 0x00000000,
  36.134 +    0x00000000, 0x00000003, 0x00000001, 0x00000003, 0x00000065, 0x00000000,
  36.135 +    0x00000000, 0x00000003, 0x00000002, 0x00000f0f, 0x505f5653, 0x5449534f,
  36.136 +    0x004e4f49, 0x43584554, 0x44524f4f, 0x4c4f4300, 0xab00524f, 0x4e47534f,
  36.137 +    0x0000002c, 0x00000001, 0x00000008, 0x00000020, 0x00000000, 0x00000000,
  36.138 +    0x00000003, 0x00000000, 0x0000000f, 0x545f5653, 0x45475241, 0xabab0054
  36.139 +};
  36.140 +#else
  36.141 +#error "An appropriate 'colors' pixel shader is not defined."
  36.142 +#endif
  36.143 +
  36.144 +/* The texture-rendering pixel shader:
  36.145 +
  36.146 +    --- D3D11_PixelShader_Textures.hlsl ---
  36.147 +    Texture2D theTexture : register(t0);
  36.148 +    SamplerState theSampler : register(s0);
  36.149 +
  36.150 +    struct PixelShaderInput
  36.151 +    {
  36.152 +        float4 pos : SV_POSITION;
  36.153 +        float2 tex : TEXCOORD0;
  36.154 +        float4 color : COLOR0;
  36.155 +    };
  36.156 +
  36.157 +    float4 main(PixelShaderInput input) : SV_TARGET
  36.158 +    {
  36.159 +        return theTexture.Sample(theSampler, input.tex) * input.color;
  36.160 +    }
  36.161 +*/
  36.162 +#if defined(D3D11_USE_SHADER_MODEL_4_0_level_9_1)
  36.163 +static const DWORD D3D11_PixelShader_Textures[] = {
  36.164 +    0x43425844, 0x6299b59f, 0x155258f2, 0x873ab86a, 0xfcbb6dcd, 0x00000001,
  36.165 +    0x00000330, 0x00000006, 0x00000038, 0x000000c0, 0x0000015c, 0x000001d8,
  36.166 +    0x00000288, 0x000002fc, 0x396e6f41, 0x00000080, 0x00000080, 0xffff0200,
  36.167 +    0x00000058, 0x00000028, 0x00280000, 0x00280000, 0x00280000, 0x00240001,
  36.168 +    0x00280000, 0x00000000, 0xffff0200, 0x0200001f, 0x80000000, 0xb0030000,
  36.169 +    0x0200001f, 0x80000000, 0xb00f0001, 0x0200001f, 0x90000000, 0xa00f0800,
  36.170 +    0x03000042, 0x800f0000, 0xb0e40000, 0xa0e40800, 0x03000005, 0x800f0000,
  36.171 +    0x80e40000, 0xb0e40001, 0x02000001, 0x800f0800, 0x80e40000, 0x0000ffff,
  36.172 +    0x52444853, 0x00000094, 0x00000040, 0x00000025, 0x0300005a, 0x00106000,
  36.173 +    0x00000000, 0x04001858, 0x00107000, 0x00000000, 0x00005555, 0x03001062,
  36.174 +    0x00101032, 0x00000001, 0x03001062, 0x001010f2, 0x00000002, 0x03000065,
  36.175 +    0x001020f2, 0x00000000, 0x02000068, 0x00000001, 0x09000045, 0x001000f2,
  36.176 +    0x00000000, 0x00101046, 0x00000001, 0x00107e46, 0x00000000, 0x00106000,
  36.177 +    0x00000000, 0x07000038, 0x001020f2, 0x00000000, 0x00100e46, 0x00000000,
  36.178 +    0x00101e46, 0x00000002, 0x0100003e, 0x54415453, 0x00000074, 0x00000003,
  36.179 +    0x00000001, 0x00000000, 0x00000003, 0x00000001, 0x00000000, 0x00000000,
  36.180 +    0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
  36.181 +    0x00000000, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
  36.182 +    0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
  36.183 +    0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x46454452, 0x000000a8,
  36.184 +    0x00000000, 0x00000000, 0x00000002, 0x0000001c, 0xffff0400, 0x00000100,
  36.185 +    0x00000072, 0x0000005c, 0x00000003, 0x00000000, 0x00000000, 0x00000000,
  36.186 +    0x00000000, 0x00000001, 0x00000001, 0x00000067, 0x00000002, 0x00000005,
  36.187 +    0x00000004, 0xffffffff, 0x00000000, 0x00000001, 0x0000000d, 0x53656874,
  36.188 +    0x6c706d61, 0x74007265, 0x65546568, 0x72757478, 0x694d0065, 0x736f7263,
  36.189 +    0x2074666f, 0x20295228, 0x4c534c48, 0x61685320, 0x20726564, 0x706d6f43,
  36.190 +    0x72656c69, 0x332e3920, 0x32392e30, 0x312e3030, 0x34383336, 0xababab00,
  36.191 +    0x4e475349, 0x0000006c, 0x00000003, 0x00000008, 0x00000050, 0x00000000,
  36.192 +    0x00000001, 0x00000003, 0x00000000, 0x0000000f, 0x0000005c, 0x00000000,
  36.193 +    0x00000000, 0x00000003, 0x00000001, 0x00000303, 0x00000065, 0x00000000,
  36.194 +    0x00000000, 0x00000003, 0x00000002, 0x00000f0f, 0x505f5653, 0x5449534f,
  36.195 +    0x004e4f49, 0x43584554, 0x44524f4f, 0x4c4f4300, 0xab00524f, 0x4e47534f,
  36.196 +    0x0000002c, 0x00000001, 0x00000008, 0x00000020, 0x00000000, 0x00000000,
  36.197 +    0x00000003, 0x00000000, 0x0000000f, 0x545f5653, 0x45475241, 0xabab0054
  36.198 +};
  36.199 +#elif defined(D3D11_USE_SHADER_MODEL_4_0_level_9_3)
  36.200 +static const DWORD D3D11_PixelShader_Textures[] = {
  36.201 +    0x43425844, 0x5876569a, 0x01b6c87e, 0x8447454f, 0xc7f3ef10, 0x00000001,
  36.202 +    0x00000330, 0x00000006, 0x00000038, 0x000000c0, 0x0000015c, 0x000001d8,
  36.203 +    0x00000288, 0x000002fc, 0x396e6f41, 0x00000080, 0x00000080, 0xffff0200,
  36.204 +    0x00000058, 0x00000028, 0x00280000, 0x00280000, 0x00280000, 0x00240001,
  36.205 +    0x00280000, 0x00000000, 0xffff0201, 0x0200001f, 0x80000000, 0xb0030000,
  36.206 +    0x0200001f, 0x80000000, 0xb00f0001, 0x0200001f, 0x90000000, 0xa00f0800,
  36.207 +    0x03000042, 0x800f0000, 0xb0e40000, 0xa0e40800, 0x03000005, 0x800f0000,
  36.208 +    0x80e40000, 0xb0e40001, 0x02000001, 0x800f0800, 0x80e40000, 0x0000ffff,
  36.209 +    0x52444853, 0x00000094, 0x00000040, 0x00000025, 0x0300005a, 0x00106000,
  36.210 +    0x00000000, 0x04001858, 0x00107000, 0x00000000, 0x00005555, 0x03001062,
  36.211 +    0x00101032, 0x00000001, 0x03001062, 0x001010f2, 0x00000002, 0x03000065,
  36.212 +    0x001020f2, 0x00000000, 0x02000068, 0x00000001, 0x09000045, 0x001000f2,
  36.213 +    0x00000000, 0x00101046, 0x00000001, 0x00107e46, 0x00000000, 0x00106000,
  36.214 +    0x00000000, 0x07000038, 0x001020f2, 0x00000000, 0x00100e46, 0x00000000,
  36.215 +    0x00101e46, 0x00000002, 0x0100003e, 0x54415453, 0x00000074, 0x00000003,
  36.216 +    0x00000001, 0x00000000, 0x00000003, 0x00000001, 0x00000000, 0x00000000,
  36.217 +    0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
  36.218 +    0x00000000, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
  36.219 +    0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
  36.220 +    0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x46454452, 0x000000a8,
  36.221 +    0x00000000, 0x00000000, 0x00000002, 0x0000001c, 0xffff0400, 0x00000100,
  36.222 +    0x00000072, 0x0000005c, 0x00000003, 0x00000000, 0x00000000, 0x00000000,
  36.223 +    0x00000000, 0x00000001, 0x00000001, 0x00000067, 0x00000002, 0x00000005,
  36.224 +    0x00000004, 0xffffffff, 0x00000000, 0x00000001, 0x0000000d, 0x53656874,
  36.225 +    0x6c706d61, 0x74007265, 0x65546568, 0x72757478, 0x694d0065, 0x736f7263,
  36.226 +    0x2074666f, 0x20295228, 0x4c534c48, 0x61685320, 0x20726564, 0x706d6f43,
  36.227 +    0x72656c69, 0x332e3920, 0x32392e30, 0x312e3030, 0x34383336, 0xababab00,
  36.228 +    0x4e475349, 0x0000006c, 0x00000003, 0x00000008, 0x00000050, 0x00000000,
  36.229 +    0x00000001, 0x00000003, 0x00000000, 0x0000000f, 0x0000005c, 0x00000000,
  36.230 +    0x00000000, 0x00000003, 0x00000001, 0x00000303, 0x00000065, 0x00000000,
  36.231 +    0x00000000, 0x00000003, 0x00000002, 0x00000f0f, 0x505f5653, 0x5449534f,
  36.232 +    0x004e4f49, 0x43584554, 0x44524f4f, 0x4c4f4300, 0xab00524f, 0x4e47534f,
  36.233 +    0x0000002c, 0x00000001, 0x00000008, 0x00000020, 0x00000000, 0x00000000,
  36.234 +    0x00000003, 0x00000000, 0x0000000f, 0x545f5653, 0x45475241, 0xabab0054
  36.235 +};
  36.236 +#else
  36.237 +#error "An appropriate 'textures' pixel shader is not defined"
  36.238 +#endif
  36.239 +
  36.240 +/* The yuv-rendering pixel shader:
  36.241 +
  36.242 +    --- D3D11_PixelShader_YUV_JPEG.hlsl ---
  36.243 +    Texture2D theTextureY : register(t0);
  36.244 +    Texture2D theTextureU : register(t1);
  36.245 +    Texture2D theTextureV : register(t2);
  36.246 +    SamplerState theSampler : register(s0);
  36.247 +
  36.248 +    struct PixelShaderInput
  36.249 +    {
  36.250 +        float4 pos : SV_POSITION;
  36.251 +        float2 tex : TEXCOORD0;
  36.252 +        float4 color : COLOR0;
  36.253 +    };
  36.254 +
  36.255 +    float4 main(PixelShaderInput input) : SV_TARGET
  36.256 +    {
  36.257 +        const float3 offset = {0.0, -0.501960814, -0.501960814};
  36.258 +        const float3 Rcoeff = {1.0000,  0.0000,  1.4020};
  36.259 +        const float3 Gcoeff = {1.0000, -0.3441, -0.7141};
  36.260 +        const float3 Bcoeff = {1.0000,  1.7720,  0.0000};
  36.261 +
  36.262 +        float4 Output;
  36.263 +
  36.264 +        float3 yuv;
  36.265 +        yuv.x = theTextureY.Sample(theSampler, input.tex).r;
  36.266 +        yuv.y = theTextureU.Sample(theSampler, input.tex).r;
  36.267 +        yuv.z = theTextureV.Sample(theSampler, input.tex).r;
  36.268 +
  36.269 +        yuv += offset;
  36.270 +        Output.r = dot(yuv, Rcoeff);
  36.271 +        Output.g = dot(yuv, Gcoeff);
  36.272 +        Output.b = dot(yuv, Bcoeff);
  36.273 +        Output.a = 1.0f;
  36.274 +
  36.275 +        return Output * input.color;
  36.276 +    }
  36.277 +
  36.278 +*/
  36.279 +#if defined(D3D11_USE_SHADER_MODEL_4_0_level_9_1)
  36.280 +static const DWORD D3D11_PixelShader_YUV_JPEG[] = {
  36.281 +    0x43425844, 0x10359e9c, 0x92c3d2c4, 0x00bf0cd5, 0x5ce8c499, 0x00000001,
  36.282 +    0x000005e8, 0x00000006, 0x00000038, 0x000001dc, 0x000003bc, 0x00000438,
  36.283 +    0x00000540, 0x000005b4, 0x396e6f41, 0x0000019c, 0x0000019c, 0xffff0200,
  36.284 +    0x0000016c, 0x00000030, 0x00300000, 0x00300000, 0x00300000, 0x00240003,
  36.285 +    0x00300000, 0x00000000, 0x00010001, 0x00020002, 0xffff0200, 0x05000051,
  36.286 +    0xa00f0000, 0x00000000, 0xbf008081, 0xbf008081, 0x3f800000, 0x05000051,
  36.287 +    0xa00f0001, 0x3f800000, 0x3fb374bc, 0x00000000, 0x00000000, 0x05000051,
  36.288 +    0xa00f0002, 0x3f800000, 0xbeb02de0, 0xbf36cf42, 0x00000000, 0x05000051,
  36.289 +    0xa00f0003, 0x3f800000, 0x3fe2d0e5, 0x00000000, 0x00000000, 0x0200001f,
  36.290 +    0x80000000, 0xb0030000, 0x0200001f, 0x80000000, 0xb00f0001, 0x0200001f,
  36.291 +    0x90000000, 0xa00f0800, 0x0200001f, 0x90000000, 0xa00f0801, 0x0200001f,
  36.292 +    0x90000000, 0xa00f0802, 0x03000042, 0x800f0000, 0xb0e40000, 0xa0e40800,
  36.293 +    0x03000042, 0x800f0001, 0xb0e40000, 0xa0e40801, 0x03000042, 0x800f0002,
  36.294 +    0xb0e40000, 0xa0e40802, 0x02000001, 0x80020000, 0x80000001, 0x02000001,
  36.295 +    0x80040000, 0x80000002, 0x03000002, 0x80070000, 0x80e40000, 0xa0e40000,
  36.296 +    0x03000005, 0x80080000, 0x80000000, 0xa0000001, 0x04000004, 0x80010001,
  36.297 +    0x80aa0000, 0xa0550001, 0x80ff0000, 0x03000008, 0x80020001, 0x80e40000,
  36.298 +    0xa0e40002, 0x0400005a, 0x80040001, 0x80e40000, 0xa0e40003, 0xa0aa0003,
  36.299 +    0x02000001, 0x80080001, 0xa0ff0000, 0x03000005, 0x800f0000, 0x80e40001,
  36.300 +    0xb0e40001, 0x02000001, 0x800f0800, 0x80e40000, 0x0000ffff, 0x52444853,
  36.301 +    0x000001d8, 0x00000040, 0x00000076, 0x0300005a, 0x00106000, 0x00000000,
  36.302 +    0x04001858, 0x00107000, 0x00000000, 0x00005555, 0x04001858, 0x00107000,
  36.303 +    0x00000001, 0x00005555, 0x04001858, 0x00107000, 0x00000002, 0x00005555,
  36.304 +    0x03001062, 0x00101032, 0x00000001, 0x03001062, 0x001010f2, 0x00000002,
  36.305 +    0x03000065, 0x001020f2, 0x00000000, 0x02000068, 0x00000002, 0x09000045,
  36.306 +    0x001000f2, 0x00000000, 0x00101046, 0x00000001, 0x00107e46, 0x00000000,
  36.307 +    0x00106000, 0x00000000, 0x09000045, 0x001000f2, 0x00000001, 0x00101046,
  36.308 +    0x00000001, 0x00107e46, 0x00000001, 0x00106000, 0x00000000, 0x05000036,
  36.309 +    0x00100022, 0x00000000, 0x0010000a, 0x00000001, 0x09000045, 0x001000f2,
  36.310 +    0x00000001, 0x00101046, 0x00000001, 0x00107e46, 0x00000002, 0x00106000,
  36.311 +    0x00000000, 0x05000036, 0x00100042, 0x00000000, 0x0010000a, 0x00000001,
  36.312 +    0x0a000000, 0x00100072, 0x00000000, 0x00100246, 0x00000000, 0x00004002,
  36.313 +    0x00000000, 0xbf008081, 0xbf008081, 0x00000000, 0x0a00000f, 0x00100012,
  36.314 +    0x00000001, 0x00100086, 0x00000000, 0x00004002, 0x3f800000, 0x3fb374bc,
  36.315 +    0x00000000, 0x00000000, 0x0a000010, 0x00100022, 0x00000001, 0x00100246,
  36.316 +    0x00000000, 0x00004002, 0x3f800000, 0xbeb02de0, 0xbf36cf42, 0x00000000,
  36.317 +    0x0a00000f, 0x00100042, 0x00000001, 0x00100046, 0x00000000, 0x00004002,
  36.318 +    0x3f800000, 0x3fe2d0e5, 0x00000000, 0x00000000, 0x05000036, 0x00100082,
  36.319 +    0x00000001, 0x00004001, 0x3f800000, 0x07000038, 0x001020f2, 0x00000000,
  36.320 +    0x00100e46, 0x00000001, 0x00101e46, 0x00000002, 0x0100003e, 0x54415453,
  36.321 +    0x00000074, 0x0000000c, 0x00000002, 0x00000000, 0x00000003, 0x00000005,
  36.322 +    0x00000000, 0x00000000, 0x00000001, 0x00000000, 0x00000000, 0x00000000,
  36.323 +    0x00000000, 0x00000000, 0x00000000, 0x00000003, 0x00000000, 0x00000000,
  36.324 +    0x00000000, 0x00000000, 0x00000003, 0x00000000, 0x00000000, 0x00000000,
  36.325 +    0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
  36.326 +    0x46454452, 0x00000100, 0x00000000, 0x00000000, 0x00000004, 0x0000001c,
  36.327 +    0xffff0400, 0x00000100, 0x000000cb, 0x0000009c, 0x00000003, 0x00000000,
  36.328 +    0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000001, 0x000000a7,
  36.329 +    0x00000002, 0x00000005, 0x00000004, 0xffffffff, 0x00000000, 0x00000001,
  36.330 +    0x0000000d, 0x000000b3, 0x00000002, 0x00000005, 0x00000004, 0xffffffff,
  36.331 +    0x00000001, 0x00000001, 0x0000000d, 0x000000bf, 0x00000002, 0x00000005,
  36.332 +    0x00000004, 0xffffffff, 0x00000002, 0x00000001, 0x0000000d, 0x53656874,
  36.333 +    0x6c706d61, 0x74007265, 0x65546568, 0x72757478, 0x74005965, 0x65546568,
  36.334 +    0x72757478, 0x74005565, 0x65546568, 0x72757478, 0x4d005665, 0x6f726369,
  36.335 +    0x74666f73, 0x29522820, 0x534c4820, 0x6853204c, 0x72656461, 0x6d6f4320,
  36.336 +    0x656c6970, 0x2e362072, 0x36392e33, 0x312e3030, 0x34383336, 0xababab00,
  36.337 +    0x4e475349, 0x0000006c, 0x00000003, 0x00000008, 0x00000050, 0x00000000,
  36.338 +    0x00000001, 0x00000003, 0x00000000, 0x0000000f, 0x0000005c, 0x00000000,
  36.339 +    0x00000000, 0x00000003, 0x00000001, 0x00000303, 0x00000065, 0x00000000,
  36.340 +    0x00000000, 0x00000003, 0x00000002, 0x00000f0f, 0x505f5653, 0x5449534f,
  36.341 +    0x004e4f49, 0x43584554, 0x44524f4f, 0x4c4f4300, 0xab00524f, 0x4e47534f,
  36.342 +    0x0000002c, 0x00000001, 0x00000008, 0x00000020, 0x00000000, 0x00000000,
  36.343 +    0x00000003, 0x00000000, 0x0000000f, 0x545f5653, 0x45475241, 0xabab0054
  36.344 +};
  36.345 +#elif defined(D3D11_USE_SHADER_MODEL_4_0_level_9_3)
  36.346 +static const DWORD D3D11_PixelShader_YUV_JPEG[] = {
  36.347 +    0x43425844, 0x616d6673, 0x83174178, 0x15aac25d, 0x2a340487, 0x00000001,
  36.348 +    0x000005c0, 0x00000006, 0x00000038, 0x000001b4, 0x00000394, 0x00000410,
  36.349 +    0x00000518, 0x0000058c, 0x396e6f41, 0x00000174, 0x00000174, 0xffff0200,
  36.350 +    0x00000144, 0x00000030, 0x00300000, 0x00300000, 0x00300000, 0x00240003,
  36.351 +    0x00300000, 0x00000000, 0x00010001, 0x00020002, 0xffff0201, 0x05000051,
  36.352 +    0xa00f0000, 0x00000000, 0xbf008081, 0x3f800000, 0x3fb374bc, 0x05000051,
  36.353 +    0xa00f0001, 0x3f800000, 0xbeb02de0, 0xbf36cf42, 0x00000000, 0x05000051,
  36.354 +    0xa00f0002, 0x3f800000, 0x3fe2d0e5, 0x00000000, 0x00000000, 0x0200001f,
  36.355 +    0x80000000, 0xb0030000, 0x0200001f, 0x80000000, 0xb00f0001, 0x0200001f,
  36.356 +    0x90000000, 0xa00f0800, 0x0200001f, 0x90000000, 0xa00f0801, 0x0200001f,
  36.357 +    0x90000000, 0xa00f0802, 0x03000042, 0x800f0000, 0xb0e40000, 0xa0e40801,
  36.358 +    0x03000042, 0x800f0001, 0xb0e40000, 0xa0e40800, 0x02000001, 0x80020001,
  36.359 +    0x80000000, 0x03000042, 0x800f0000, 0xb0e40000, 0xa0e40802, 0x02000001,
  36.360 +    0x80040001, 0x80000000, 0x03000002, 0x80070000, 0x80e40001, 0xa0d40000,
  36.361 +    0x0400005a, 0x80010001, 0x80e80000, 0xa0ee0000, 0xa0000000, 0x03000008,
  36.362 +    0x80020001, 0x80e40000, 0xa0e40001, 0x0400005a, 0x80040001, 0x80e40000,
  36.363 +    0xa0e40002, 0xa0aa0002, 0x02000001, 0x80080001, 0xa0aa0000, 0x03000005,
  36.364 +    0x800f0000, 0x80e40001, 0xb0e40001, 0x02000001, 0x800f0800, 0x80e40000,
  36.365 +    0x0000ffff, 0x52444853, 0x000001d8, 0x00000040, 0x00000076, 0x0300005a,
  36.366 +    0x00106000, 0x00000000, 0x04001858, 0x00107000, 0x00000000, 0x00005555,
  36.367 +    0x04001858, 0x00107000, 0x00000001, 0x00005555, 0x04001858, 0x00107000,
  36.368 +    0x00000002, 0x00005555, 0x03001062, 0x00101032, 0x00000001, 0x03001062,
  36.369 +    0x001010f2, 0x00000002, 0x03000065, 0x001020f2, 0x00000000, 0x02000068,
  36.370 +    0x00000002, 0x09000045, 0x001000f2, 0x00000000, 0x00101046, 0x00000001,
  36.371 +    0x00107e46, 0x00000000, 0x00106000, 0x00000000, 0x09000045, 0x001000f2,
  36.372 +    0x00000001, 0x00101046, 0x00000001, 0x00107e46, 0x00000001, 0x00106000,
  36.373 +    0x00000000, 0x05000036, 0x00100022, 0x00000000, 0x0010000a, 0x00000001,
  36.374 +    0x09000045, 0x001000f2, 0x00000001, 0x00101046, 0x00000001, 0x00107e46,
  36.375 +    0x00000002, 0x00106000, 0x00000000, 0x05000036, 0x00100042, 0x00000000,
  36.376 +    0x0010000a, 0x00000001, 0x0a000000, 0x00100072, 0x00000000, 0x00100246,
  36.377 +    0x00000000, 0x00004002, 0x00000000, 0xbf008081, 0xbf008081, 0x00000000,
  36.378 +    0x0a00000f, 0x00100012, 0x00000001, 0x00100086, 0x00000000, 0x00004002,
  36.379 +    0x3f800000, 0x3fb374bc, 0x00000000, 0x00000000, 0x0a000010, 0x00100022,
  36.380 +    0x00000001, 0x00100246, 0x00000000, 0x00004002, 0x3f800000, 0xbeb02de0,
  36.381 +    0xbf36cf42, 0x00000000, 0x0a00000f, 0x00100042, 0x00000001, 0x00100046,
  36.382 +    0x00000000, 0x00004002, 0x3f800000, 0x3fe2d0e5, 0x00000000, 0x00000000,
  36.383 +    0x05000036, 0x00100082, 0x00000001, 0x00004001, 0x3f800000, 0x07000038,
  36.384 +    0x001020f2, 0x00000000, 0x00100e46, 0x00000001, 0x00101e46, 0x00000002,
  36.385 +    0x0100003e, 0x54415453, 0x00000074, 0x0000000c, 0x00000002, 0x00000000,
  36.386 +    0x00000003, 0x00000005, 0x00000000, 0x00000000, 0x00000001, 0x00000000,
  36.387 +    0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000003,
  36.388 +    0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000003, 0x00000000,
  36.389 +    0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
  36.390 +    0x00000000, 0x00000000, 0x46454452, 0x00000100, 0x00000000, 0x00000000,
  36.391 +    0x00000004, 0x0000001c, 0xffff0400, 0x00000100, 0x000000cb, 0x0000009c,
  36.392 +    0x00000003, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000001,
  36.393 +    0x00000001, 0x000000a7, 0x00000002, 0x00000005, 0x00000004, 0xffffffff,
  36.394 +    0x00000000, 0x00000001, 0x0000000d, 0x000000b3, 0x00000002, 0x00000005,
  36.395 +    0x00000004, 0xffffffff, 0x00000001, 0x00000001, 0x0000000d, 0x000000bf,
  36.396 +    0x00000002, 0x00000005, 0x00000004, 0xffffffff, 0x00000002, 0x00000001,
  36.397 +    0x0000000d, 0x53656874, 0x6c706d61, 0x74007265, 0x65546568, 0x72757478,
  36.398 +    0x74005965, 0x65546568, 0x72757478, 0x74005565, 0x65546568, 0x72757478,
  36.399 +    0x4d005665, 0x6f726369, 0x74666f73, 0x29522820, 0x534c4820, 0x6853204c,
  36.400 +    0x72656461, 0x6d6f4320, 0x656c6970, 0x2e362072, 0x36392e33, 0x312e3030,
  36.401 +    0x34383336, 0xababab00, 0x4e475349, 0x0000006c, 0x00000003, 0x00000008,
  36.402 +    0x00000050, 0x00000000, 0x00000001, 0x00000003, 0x00000000, 0x0000000f,
  36.403 +    0x0000005c, 0x00000000, 0x00000000, 0x00000003, 0x00000001, 0x00000303,
  36.404 +    0x00000065, 0x00000000, 0x00000000, 0x00000003, 0x00000002, 0x00000f0f,
  36.405 +    0x505f5653, 0x5449534f, 0x004e4f49, 0x43584554, 0x44524f4f, 0x4c4f4300,
  36.406 +    0xab00524f, 0x4e47534f, 0x0000002c, 0x00000001, 0x00000008, 0x00000020,
  36.407 +    0x00000000, 0x00000000, 0x00000003, 0x00000000, 0x0000000f, 0x545f5653,
  36.408 +    0x45475241, 0xabab0054
  36.409 +};
  36.410 +#else
  36.411 +#error "An appropriate 'yuv' pixel shader is not defined."
  36.412 +#endif
  36.413 +
  36.414 +/* The yuv-rendering pixel shader:
  36.415 +
  36.416 +    --- D3D11_PixelShader_YUV_BT601.hlsl ---
  36.417 +    Texture2D theTextureY : register(t0);
  36.418 +    Texture2D theTextureU : register(t1);
  36.419 +    Texture2D theTextureV : register(t2);
  36.420 +    SamplerState theSampler : register(s0);
  36.421 +
  36.422 +    struct PixelShaderInput
  36.423 +    {
  36.424 +        float4 pos : SV_POSITION;
  36.425 +        float2 tex : TEXCOORD0;
  36.426 +        float4 color : COLOR0;
  36.427 +    };
  36.428 +
  36.429 +    float4 main(PixelShaderInput input) : SV_TARGET
  36.430 +    {
  36.431 +        const float3 offset = {-0.0627451017, -0.501960814, -0.501960814};
  36.432 +        const float3 Rcoeff = {1.1644,  0.0000,  1.5960};
  36.433 +        const float3 Gcoeff = {1.1644, -0.3918, -0.8130};
  36.434 +        const float3 Bcoeff = {1.1644,  2.0172,  0.0000};
  36.435 +
  36.436 +        float4 Output;
  36.437 +
  36.438 +        float3 yuv;
  36.439 +        yuv.x = theTextureY.Sample(theSampler, input.tex).r;
  36.440 +        yuv.y = theTextureU.Sample(theSampler, input.tex).r;
  36.441 +        yuv.z = theTextureV.Sample(theSampler, input.tex).r;
  36.442 +
  36.443 +        yuv += offset;
  36.444 +        Output.r = dot(yuv, Rcoeff);
  36.445 +        Output.g = dot(yuv, Gcoeff);
  36.446 +        Output.b = dot(yuv, Bcoeff);
  36.447 +        Output.a = 1.0f;
  36.448 +
  36.449 +        return Output * input.color;
  36.450 +    }
  36.451 +
  36.452 +*/
  36.453 +#if defined(D3D11_USE_SHADER_MODEL_4_0_level_9_1)
  36.454 +static const DWORD D3D11_PixelShader_YUV_BT601[] = {
  36.455 +    0x43425844, 0x628ec838, 0xbe9cec6a, 0xc9ee10bb, 0x63283218, 0x00000001,
  36.456 +    0x000005e8, 0x00000006, 0x00000038, 0x000001dc, 0x000003bc, 0x00000438,
  36.457 +    0x00000540, 0x000005b4, 0x396e6f41, 0x0000019c, 0x0000019c, 0xffff0200,
  36.458 +    0x0000016c, 0x00000030, 0x00300000, 0x00300000, 0x00300000, 0x00240003,
  36.459 +    0x00300000, 0x00000000, 0x00010001, 0x00020002, 0xffff0200, 0x05000051,
  36.460 +    0xa00f0000, 0xbd808081, 0xbf008081, 0xbf008081, 0x3f800000, 0x05000051,
  36.461 +    0xa00f0001, 0x3f950b0f, 0x3fcc49ba, 0x00000000, 0x00000000, 0x05000051,
  36.462 +    0xa00f0002, 0x3f950b0f, 0xbec89a02, 0xbf5020c5, 0x00000000, 0x05000051,
  36.463 +    0xa00f0003, 0x3f950b0f, 0x400119ce, 0x00000000, 0x00000000, 0x0200001f,
  36.464 +    0x80000000, 0xb0030000, 0x0200001f, 0x80000000, 0xb00f0001, 0x0200001f,
  36.465 +    0x90000000, 0xa00f0800, 0x0200001f, 0x90000000, 0xa00f0801, 0x0200001f,
  36.466 +    0x90000000, 0xa00f0802, 0x03000042, 0x800f0000, 0xb0e40000, 0xa0e40800,
  36.467 +    0x03000042, 0x800f0001, 0xb0e40000, 0xa0e40801, 0x03000042, 0x800f0002,
  36.468 +    0xb0e40000, 0xa0e40802, 0x02000001, 0x80020000, 0x80000001, 0x02000001,
  36.469 +    0x80040000, 0x80000002, 0x03000002, 0x80070000, 0x80e40000, 0xa0e40000,
  36.470 +    0x03000005, 0x80080000, 0x80000000, 0xa0000001, 0x04000004, 0x80010001,
  36.471 +    0x80aa0000, 0xa0550001, 0x80ff0000, 0x03000008, 0x80020001, 0x80e40000,
  36.472 +    0xa0e40002, 0x0400005a, 0x80040001, 0x80e40000, 0xa0e40003, 0xa0aa0003,
  36.473 +    0x02000001, 0x80080001, 0xa0ff0000, 0x03000005, 0x800f0000, 0x80e40001,
  36.474 +    0xb0e40001, 0x02000001, 0x800f0800, 0x80e40000, 0x0000ffff, 0x52444853,
  36.475 +    0x000001d8, 0x00000040, 0x00000076, 0x0300005a, 0x00106000, 0x00000000,
  36.476 +    0x04001858, 0x00107000, 0x00000000, 0x00005555, 0x04001858, 0x00107000,
  36.477 +    0x00000001, 0x00005555, 0x04001858, 0x00107000, 0x00000002, 0x00005555,
  36.478 +    0x03001062, 0x00101032, 0x00000001, 0x03001062, 0x001010f2, 0x00000002,
  36.479 +    0x03000065, 0x001020f2, 0x00000000, 0x02000068, 0x00000002, 0x09000045,
  36.480 +    0x001000f2, 0x00000000, 0x00101046, 0x00000001, 0x00107e46, 0x00000000,
  36.481 +    0x00106000, 0x00000000, 0x09000045, 0x001000f2, 0x00000001, 0x00101046,
  36.482 +    0x00000001, 0x00107e46, 0x00000001, 0x00106000, 0x00000000, 0x05000036,
  36.483 +    0x00100022, 0x00000000, 0x0010000a, 0x00000001, 0x09000045, 0x001000f2,
  36.484 +    0x00000001, 0x00101046, 0x00000001, 0x00107e46, 0x00000002, 0x00106000,
  36.485 +    0x00000000, 0x05000036, 0x00100042, 0x00000000, 0x0010000a, 0x00000001,
  36.486 +    0x0a000000, 0x00100072, 0x00000000, 0x00100246, 0x00000000, 0x00004002,
  36.487 +    0xbd808081, 0xbf008081, 0xbf008081, 0x00000000, 0x0a00000f, 0x00100012,
  36.488 +    0x00000001, 0x00100086, 0x00000000, 0x00004002, 0x3f950b0f, 0x3fcc49ba,
  36.489 +    0x00000000, 0x00000000, 0x0a000010, 0x00100022, 0x00000001, 0x00100246,
  36.490 +    0x00000000, 0x00004002, 0x3f950b0f, 0xbec89a02, 0xbf5020c5, 0x00000000,
  36.491 +    0x0a00000f, 0x00100042, 0x00000001, 0x00100046, 0x00000000, 0x00004002,
  36.492 +    0x3f950b0f, 0x400119ce, 0x00000000, 0x00000000, 0x05000036, 0x00100082,
  36.493 +    0x00000001, 0x00004001, 0x3f800000, 0x07000038, 0x001020f2, 0x00000000,
  36.494 +    0x00100e46, 0x00000001, 0x00101e46, 0x00000002, 0x0100003e, 0x54415453,
  36.495 +    0x00000074, 0x0000000c, 0x00000002, 0x00000000, 0x00000003, 0x00000005,
  36.496 +    0x00000000, 0x00000000, 0x00000001, 0x00000000, 0x00000000, 0x00000000,
  36.497 +    0x00000000, 0x00000000, 0x00000000, 0x00000003, 0x00000000, 0x00000000,
  36.498 +    0x00000000, 0x00000000, 0x00000003, 0x00000000, 0x00000000, 0x00000000,
  36.499 +    0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
  36.500 +    0x46454452, 0x00000100, 0x00000000, 0x00000000, 0x00000004, 0x0000001c,
  36.501 +    0xffff0400, 0x00000100, 0x000000cb, 0x0000009c, 0x00000003, 0x00000000,
  36.502 +    0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000001, 0x000000a7,
  36.503 +    0x00000002, 0x00000005, 0x00000004, 0xffffffff, 0x00000000, 0x00000001,
  36.504 +    0x0000000d, 0x000000b3, 0x00000002, 0x00000005, 0x00000004, 0xffffffff,
  36.505 +    0x00000001, 0x00000001, 0x0000000d, 0x000000bf, 0x00000002, 0x00000005,
  36.506 +    0x00000004, 0xffffffff, 0x00000002, 0x00000001, 0x0000000d, 0x53656874,
  36.507 +    0x6c706d61, 0x74007265, 0x65546568, 0x72757478, 0x74005965, 0x65546568,
  36.508 +    0x72757478, 0x74005565, 0x65546568, 0x72757478, 0x4d005665, 0x6f726369,
  36.509 +    0x74666f73, 0x29522820, 0x534c4820, 0x6853204c, 0x72656461, 0x6d6f4320,
  36.510 +    0x656c6970, 0x2e362072, 0x36392e33, 0x312e3030, 0x34383336, 0xababab00,
  36.511 +    0x4e475349, 0x0000006c, 0x00000003, 0x00000008, 0x00000050, 0x00000000,
  36.512 +    0x00000001, 0x00000003, 0x00000000, 0x0000000f, 0x0000005c, 0x00000000,
  36.513 +    0x00000000, 0x00000003, 0x00000001, 0x00000303, 0x00000065, 0x00000000,
  36.514 +    0x00000000, 0x00000003, 0x00000002, 0x00000f0f, 0x505f5653, 0x5449534f,
  36.515 +    0x004e4f49, 0x43584554, 0x44524f4f, 0x4c4f4300, 0xab00524f, 0x4e47534f,
  36.516 +    0x0000002c, 0x00000001, 0x00000008, 0x00000020, 0x00000000, 0x00000000,
  36.517 +    0x00000003, 0x00000000, 0x0000000f, 0x545f5653, 0x45475241, 0xabab0054
  36.518 +};
  36.519 +#elif defined(D3D11_USE_SHADER_MODEL_4_0_level_9_3)
  36.520 +static const DWORD D3D11_PixelShader_YUV_BT601[] = {
  36.521 +    0x43425844, 0x692b159b, 0xf58723cc, 0xf4ceac9e, 0x35eec738, 0x00000001,
  36.522 +    0x000005c0, 0x00000006, 0x00000038, 0x000001b4, 0x00000394, 0x00000410,
  36.523 +    0x00000518, 0x0000058c, 0x396e6f41, 0x00000174, 0x00000174, 0xffff0200,
  36.524 +    0x00000144, 0x00000030, 0x00300000, 0x00300000, 0x00300000, 0x00240003,
  36.525 +    0x00300000, 0x00000000, 0x00010001, 0x00020002, 0xffff0201, 0x05000051,
  36.526 +    0xa00f0000, 0xbd808081, 0xbf008081, 0x3f800000, 0x00000000, 0x05000051,
  36.527 +    0xa00f0001, 0x3f950b0f, 0x3fcc49ba, 0x00000000, 0x400119ce, 0x05000051,
  36.528 +    0xa00f0002, 0x3f950b0f, 0xbec89a02, 0xbf5020c5, 0x00000000, 0x0200001f,
  36.529 +    0x80000000, 0xb0030000, 0x0200001f, 0x80000000, 0xb00f0001, 0x0200001f,
  36.530 +    0x90000000, 0xa00f0800, 0x0200001f, 0x90000000, 0xa00f0801, 0x0200001f,
  36.531 +    0x90000000, 0xa00f0802, 0x03000042, 0x800f0000, 0xb0e40000, 0xa0e40801,
  36.532 +    0x03000042, 0x800f0001, 0xb0e40000, 0xa0e40800, 0x02000001, 0x80020001,
  36.533 +    0x80000000, 0x03000042, 0x800f0000, 0xb0e40000, 0xa0e40802, 0x02000001,
  36.534 +    0x80040001, 0x80000000, 0x03000002, 0x80070000, 0x80e40001, 0xa0d40000,
  36.535 +    0x0400005a, 0x80010001, 0x80e80000, 0xa0e40001, 0xa0aa0001, 0x03000008,
  36.536 +    0x80020001, 0x80e40000, 0xa0e40002, 0x0400005a, 0x80040001, 0x80e40000,
  36.537 +    0xa0ec0001, 0xa0aa0001, 0x02000001, 0x80080001, 0xa0aa0000, 0x03000005,
  36.538 +    0x800f0000, 0x80e40001, 0xb0e40001, 0x02000001, 0x800f0800, 0x80e40000,
  36.539 +    0x0000ffff, 0x52444853, 0x000001d8, 0x00000040, 0x00000076, 0x0300005a,
  36.540 +    0x00106000, 0x00000000, 0x04001858, 0x00107000, 0x00000000, 0x00005555,
  36.541 +    0x04001858, 0x00107000, 0x00000001, 0x00005555, 0x04001858, 0x00107000,
  36.542 +    0x00000002, 0x00005555, 0x03001062, 0x00101032, 0x00000001, 0x03001062,
  36.543 +    0x001010f2, 0x00000002, 0x03000065, 0x001020f2, 0x00000000, 0x02000068,
  36.544 +    0x00000002, 0x09000045, 0x001000f2, 0x00000000, 0x00101046, 0x00000001,
  36.545 +    0x00107e46, 0x00000000, 0x00106000, 0x00000000, 0x09000045, 0x001000f2,
  36.546 +    0x00000001, 0x00101046, 0x00000001, 0x00107e46, 0x00000001, 0x00106000,
  36.547 +    0x00000000, 0x05000036, 0x00100022, 0x00000000, 0x0010000a, 0x00000001,
  36.548 +    0x09000045, 0x001000f2, 0x00000001, 0x00101046, 0x00000001, 0x00107e46,
  36.549 +    0x00000002, 0x00106000, 0x00000000, 0x05000036, 0x00100042, 0x00000000,
  36.550 +    0x0010000a, 0x00000001, 0x0a000000, 0x00100072, 0x00000000, 0x00100246,
  36.551 +    0x00000000, 0x00004002, 0xbd808081, 0xbf008081, 0xbf008081, 0x00000000,
  36.552 +    0x0a00000f, 0x00100012, 0x00000001, 0x00100086, 0x00000000, 0x00004002,
  36.553 +    0x3f950b0f, 0x3fcc49ba, 0x00000000, 0x00000000, 0x0a000010, 0x00100022,
  36.554 +    0x00000001, 0x00100246, 0x00000000, 0x00004002, 0x3f950b0f, 0xbec89a02,
  36.555 +    0xbf5020c5, 0x00000000, 0x0a00000f, 0x00100042, 0x00000001, 0x00100046,
  36.556 +    0x00000000, 0x00004002, 0x3f950b0f, 0x400119ce, 0x00000000, 0x00000000,
  36.557 +    0x05000036, 0x00100082, 0x00000001, 0x00004001, 0x3f800000, 0x07000038,
  36.558 +    0x001020f2, 0x00000000, 0x00100e46, 0x00000001, 0x00101e46, 0x00000002,
  36.559 +    0x0100003e, 0x54415453, 0x00000074, 0x0000000c, 0x00000002, 0x00000000,
  36.560 +    0x00000003, 0x00000005, 0x00000000, 0x00000000, 0x00000001, 0x00000000,
  36.561 +    0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000003,
  36.562 +    0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000003, 0x00000000,
  36.563 +    0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
  36.564 +    0x00000000, 0x00000000, 0x46454452, 0x00000100, 0x00000000, 0x00000000,
  36.565 +    0x00000004, 0x0000001c, 0xffff0400, 0x00000100, 0x000000cb, 0x0000009c,
  36.566 +    0x00000003, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000001,
  36.567 +    0x00000001, 0x000000a7, 0x00000002, 0x00000005, 0x00000004, 0xffffffff,
  36.568 +    0x00000000, 0x00000001, 0x0000000d, 0x000000b3, 0x00000002, 0x00000005,
  36.569 +    0x00000004, 0xffffffff, 0x00000001, 0x00000001, 0x0000000d, 0x000000bf,
  36.570 +    0x00000002, 0x00000005, 0x00000004, 0xffffffff, 0x00000002, 0x00000001,
  36.571 +    0x0000000d, 0x53656874, 0x6c706d61, 0x74007265, 0x65546568, 0x72757478,
  36.572 +    0x74005965, 0x65546568, 0x72757478, 0x74005565, 0x65546568, 0x72757478,
  36.573 +    0x4d005665, 0x6f726369, 0x74666f73, 0x29522820, 0x534c4820, 0x6853204c,
  36.574 +    0x72656461, 0x6d6f4320, 0x656c6970, 0x2e362072, 0x36392e33, 0x312e3030,
  36.575 +    0x34383336, 0xababab00, 0x4e475349, 0x0000006c, 0x00000003, 0x00000008,
  36.576 +    0x00000050, 0x00000000, 0x00000001, 0x00000003, 0x00000000, 0x0000000f,
  36.577 +    0x0000005c, 0x00000000, 0x00000000, 0x00000003, 0x00000001, 0x00000303,
  36.578 +    0x00000065, 0x00000000, 0x00000000, 0x00000003, 0x00000002, 0x00000f0f,
  36.579 +    0x505f5653, 0x5449534f, 0x004e4f49, 0x43584554, 0x44524f4f, 0x4c4f4300,
  36.580 +    0xab00524f, 0x4e47534f, 0x0000002c, 0x00000001, 0x00000008, 0x00000020,
  36.581 +    0x00000000, 0x00000000, 0x00000003, 0x00000000, 0x0000000f, 0x545f5653,
  36.582 +    0x45475241, 0xabab0054
  36.583 +};
  36.584 +#else
  36.585 +#error "An appropriate 'yuv' pixel shader is not defined."
  36.586 +#endif
  36.587 +
  36.588 +/* The yuv-rendering pixel shader:
  36.589 +
  36.590 +    --- D3D11_PixelShader_YUV_BT709.hlsl ---
  36.591 +    Texture2D theTextureY : register(t0);
  36.592 +    Texture2D theTextureU : register(t1);
  36.593 +    Texture2D theTextureV : register(t2);
  36.594 +    SamplerState theSampler : register(s0);
  36.595 +
  36.596 +    struct PixelShaderInput
  36.597 +    {
  36.598 +        float4 pos : SV_POSITION;
  36.599 +        float2 tex : TEXCOORD0;
  36.600 +        float4 color : COLOR0;
  36.601 +    };
  36.602 +
  36.603 +    float4 main(PixelShaderInput input) : SV_TARGET
  36.604 +    {
  36.605 +        const float3 offset = {-0.0627451017, -0.501960814, -0.501960814};
  36.606 +        const float3 Rcoeff = {1.1644,  0.0000,  1.7927};
  36.607 +        const float3 Gcoeff = {1.1644, -0.2132, -0.5329};
  36.608 +        const float3 Bcoeff = {1.1644,  2.1124,  0.0000};
  36.609 +
  36.610 +        float4 Output;
  36.611 +
  36.612 +        float3 yuv;
  36.613 +        yuv.x = theTextureY.Sample(theSampler, input.tex).r;
  36.614 +        yuv.y = theTextureU.Sample(theSampler, input.tex).r;
  36.615 +        yuv.z = theTextureV.Sample(theSampler, input.tex).r;
  36.616 +
  36.617 +        yuv += offset;
  36.618 +        Output.r = dot(yuv, Rcoeff);
  36.619 +        Output.g = dot(yuv, Gcoeff);
  36.620 +        Output.b = dot(yuv, Bcoeff);
  36.621 +        Output.a = 1.0f;
  36.622 +
  36.623 +        return Output * input.color;
  36.624 +    }
  36.625 +
  36.626 +*/
  36.627 +#if defined(D3D11_USE_SHADER_MODEL_4_0_level_9_1)
  36.628 +static const DWORD D3D11_PixelShader_YUV_BT709[] = {
  36.629 +    0x43425844, 0x5045fa84, 0xc2908cce, 0x278dacc3, 0xd4276f8f, 0x00000001,
  36.630 +    0x000005e8, 0x00000006, 0x00000038, 0x000001dc, 0x000003bc, 0x00000438,
  36.631 +    0x00000540, 0x000005b4, 0x396e6f41, 0x0000019c, 0x0000019c, 0xffff0200,
  36.632 +    0x0000016c, 0x00000030, 0x00300000, 0x00300000, 0x00300000, 0x00240003,
  36.633 +    0x00300000, 0x00000000, 0x00010001, 0x00020002, 0xffff0200, 0x05000051,
  36.634 +    0xa00f0000, 0xbd808081, 0xbf008081, 0xbf008081, 0x3f800000, 0x05000051,
  36.635 +    0xa00f0001, 0x3f950b0f, 0x3fe57732, 0x00000000, 0x00000000, 0x05000051,
  36.636 +    0xa00f0002, 0x3f950b0f, 0xbe5a511a, 0xbf086c22, 0x00000000, 0x05000051,
  36.637 +    0xa00f0003, 0x3f950b0f, 0x40073190, 0x00000000, 0x00000000, 0x0200001f,
  36.638 +    0x80000000, 0xb0030000, 0x0200001f, 0x80000000, 0xb00f0001, 0x0200001f,
  36.639 +    0x90000000, 0xa00f0800, 0x0200001f, 0x90000000, 0xa00f0801, 0x0200001f,
  36.640 +    0x90000000, 0xa00f0802, 0x03000042, 0x800f0000, 0xb0e40000, 0xa0e40800,
  36.641 +    0x03000042, 0x800f0001, 0xb0e40000, 0xa0e40801, 0x03000042, 0x800f0002,
  36.642 +    0xb0e40000, 0xa0e40802, 0x02000001, 0x80020000, 0x80000001, 0x02000001,
  36.643 +    0x80040000, 0x80000002, 0x03000002, 0x80070000, 0x80e40000, 0xa0e40000,
  36.644 +    0x03000005, 0x80080000, 0x80000000, 0xa0000001, 0x04000004, 0x80010001,
  36.645 +    0x80aa0000, 0xa0550001, 0x80ff0000, 0x03000008, 0x80020001, 0x80e40000,
  36.646 +    0xa0e40002, 0x0400005a, 0x80040001, 0x80e40000, 0xa0e40003, 0xa0aa0003,
  36.647 +    0x02000001, 0x80080001, 0xa0ff0000, 0x03000005, 0x800f0000, 0x80e40001,
  36.648 +    0xb0e40001, 0x02000001, 0x800f0800, 0x80e40000, 0x0000ffff, 0x52444853,
  36.649 +    0x000001d8, 0x00000040, 0x00000076, 0x0300005a, 0x00106000, 0x00000000,
  36.650 +    0x04001858, 0x00107000, 0x00000000, 0x00005555, 0x04001858, 0x00107000,
  36.651 +    0x00000001, 0x00005555, 0x04001858, 0x00107000, 0x00000002, 0x00005555,
  36.652 +    0x03001062, 0x00101032, 0x00000001, 0x03001062, 0x001010f2, 0x00000002,
  36.653 +    0x03000065, 0x001020f2, 0x00000000, 0x02000068, 0x00000002, 0x09000045,
  36.654 +    0x001000f2, 0x00000000, 0x00101046, 0x00000001, 0x00107e46, 0x00000000,
  36.655 +    0x00106000, 0x00000000, 0x09000045, 0x001000f2, 0x00000001, 0x00101046,
  36.656 +    0x00000001, 0x00107e46, 0x00000001, 0x00106000, 0x00000000, 0x05000036,
  36.657 +    0x00100022, 0x00000000, 0x0010000a, 0x00000001, 0x09000045, 0x001000f2,
  36.658 +    0x00000001, 0x00101046, 0x00000001, 0x00107e46, 0x00000002, 0x00106000,
  36.659 +    0x00000000, 0x05000036, 0x00100042, 0x00000000, 0x0010000a, 0x00000001,
  36.660 +    0x0a000000, 0x00100072, 0x00000000, 0x00100246, 0x00000000, 0x00004002,
  36.661 +    0xbd808081, 0xbf008081, 0xbf008081, 0x00000000, 0x0a00000f, 0x00100012,
  36.662 +    0x00000001, 0x00100086, 0x00000000, 0x00004002, 0x3f950b0f, 0x3fe57732,
  36.663 +    0x00000000, 0x00000000, 0x0a000010, 0x00100022, 0x00000001, 0x00100246,
  36.664 +    0x00000000, 0x00004002, 0x3f950b0f, 0xbe5a511a, 0xbf086c22, 0x00000000,
  36.665 +    0x0a00000f, 0x00100042, 0x00000001, 0x00100046, 0x00000000, 0x00004002,
  36.666 +    0x3f950b0f, 0x40073190, 0x00000000, 0x00000000, 0x05000036, 0x00100082,
  36.667 +    0x00000001, 0x00004001, 0x3f800000, 0x07000038, 0x001020f2, 0x00000000,
  36.668 +    0x00100e46, 0x00000001, 0x00101e46, 0x00000002, 0x0100003e, 0x54415453,
  36.669 +    0x00000074, 0x0000000c, 0x00000002, 0x00000000, 0x00000003, 0x00000005,
  36.670 +    0x00000000, 0x00000000, 0x00000001, 0x00000000, 0x00000000, 0x00000000,
  36.671 +    0x00000000, 0x00000000, 0x00000000, 0x00000003, 0x00000000, 0x00000000,
  36.672 +    0x00000000, 0x00000000, 0x00000003, 0x00000000, 0x00000000, 0x00000000,
  36.673 +    0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
  36.674 +    0x46454452, 0x00000100, 0x00000000, 0x00000000, 0x00000004, 0x0000001c,
  36.675 +    0xffff0400, 0x00000100, 0x000000cb, 0x0000009c, 0x00000003, 0x00000000,
  36.676 +    0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000001, 0x000000a7,
  36.677 +    0x00000002, 0x00000005, 0x00000004, 0xffffffff, 0x00000000, 0x00000001,
  36.678 +    0x0000000d, 0x000000b3, 0x00000002, 0x00000005, 0x00000004, 0xffffffff,
  36.679 +    0x00000001, 0x00000001, 0x0000000d, 0x000000bf, 0x00000002, 0x00000005,
  36.680 +    0x00000004, 0xffffffff, 0x00000002, 0x00000001, 0x0000000d, 0x53656874,
  36.681 +    0x6c706d61, 0x74007265, 0x65546568, 0x72757478, 0x74005965, 0x65546568,
  36.682 +    0x72757478, 0x74005565, 0x65546568, 0x72757478, 0x4d005665, 0x6f726369,
  36.683 +    0x74666f73, 0x29522820, 0x534c4820, 0x6853204c, 0x72656461, 0x6d6f4320,
  36.684 +    0x656c6970, 0x2e362072, 0x36392e33, 0x312e3030, 0x34383336, 0xababab00,
  36.685 +    0x4e475349, 0x0000006c, 0x00000003, 0x00000008, 0x00000050, 0x00000000,
  36.686 +    0x00000001, 0x00000003, 0x00000000, 0x0000000f, 0x0000005c, 0x00000000,
  36.687 +    0x00000000, 0x00000003, 0x00000001, 0x00000303, 0x00000065, 0x00000000,
  36.688 +    0x00000000, 0x00000003, 0x00000002, 0x00000f0f, 0x505f5653, 0x5449534f,
  36.689 +    0x004e4f49, 0x43584554, 0x44524f4f, 0x4c4f4300, 0xab00524f, 0x4e47534f,
  36.690 +    0x0000002c, 0x00000001, 0x00000008, 0x00000020, 0x00000000, 0x00000000,
  36.691 +    0x00000003, 0x00000000, 0x0000000f, 0x545f5653, 0x45475241, 0xabab0054
  36.692 +};
  36.693 +#elif defined(D3D11_USE_SHADER_MODEL_4_0_level_9_3)
  36.694 +static const DWORD D3D11_PixelShader_YUV_BT709[] = {
  36.695 +    0x43425844, 0x72d13260, 0xf6c36f65, 0x8b9b28f5, 0x5010733c, 0x00000001,
  36.696 +    0x000005c0, 0x00000006, 0x00000038, 0x000001b4, 0x00000394, 0x00000410,
  36.697 +    0x00000518, 0x0000058c, 0x396e6f41, 0x00000174, 0x00000174, 0xffff0200,
  36.698 +    0x00000144, 0x00000030, 0x00300000, 0x00300000, 0x00300000, 0x00240003,
  36.699 +    0x00300000, 0x00000000, 0x00010001, 0x00020002, 0xffff0201, 0x05000051,
  36.700 +    0xa00f0000, 0xbd808081, 0xbf008081, 0x3f800000, 0x00000000, 0x05000051,
  36.701 +    0xa00f0001, 0x3f950b0f, 0x3fe57732, 0x00000000, 0x40073190, 0x05000051,
  36.702 +    0xa00f0002, 0x3f950b0f, 0xbe5a511a, 0xbf086c22, 0x00000000, 0x0200001f,
  36.703 +    0x80000000, 0xb0030000, 0x0200001f, 0x80000000, 0xb00f0001, 0x0200001f,
  36.704 +    0x90000000, 0xa00f0800, 0x0200001f, 0x90000000, 0xa00f0801, 0x0200001f,
  36.705 +    0x90000000, 0xa00f0802, 0x03000042, 0x800f0000, 0xb0e40000, 0xa0e40801,
  36.706 +    0x03000042, 0x800f0001, 0xb0e40000, 0xa0e40800, 0x02000001, 0x80020001,
  36.707 +    0x80000000, 0x03000042, 0x800f0000, 0xb0e40000, 0xa0e40802, 0x02000001,
  36.708 +    0x80040001, 0x80000000, 0x03000002, 0x80070000, 0x80e40001, 0xa0d40000,
  36.709 +    0x0400005a, 0x80010001, 0x80e80000, 0xa0e40001, 0xa0aa0001, 0x03000008,
  36.710 +    0x80020001, 0x80e40000, 0xa0e40002, 0x0400005a, 0x80040001, 0x80e40000,
  36.711 +    0xa0ec0001, 0xa0aa0001, 0x02000001, 0x80080001, 0xa0aa0000, 0x03000005,
  36.712 +    0x800f0000, 0x80e40001, 0xb0e40001, 0x02000001, 0x800f0800, 0x80e40000,
  36.713 +    0x0000ffff, 0x52444853, 0x000001d8, 0x00000040, 0x00000076, 0x0300005a,
  36.714 +    0x00106000, 0x00000000, 0x04001858, 0x00107000, 0x00000000, 0x00005555,
  36.715 +    0x04001858, 0x00107000, 0x00000001, 0x00005555, 0x04001858, 0x00107000,
  36.716 +    0x00000002, 0x00005555, 0x03001062, 0x00101032, 0x00000001, 0x03001062,
  36.717 +    0x001010f2, 0x00000002, 0x03000065, 0x001020f2, 0x00000000, 0x02000068,
  36.718 +    0x00000002, 0x09000045, 0x001000f2, 0x00000000, 0x00101046, 0x00000001,
  36.719 +    0x00107e46, 0x00000000, 0x00106000, 0x00000000, 0x09000045, 0x001000f2,
  36.720 +    0x00000001, 0x00101046, 0x00000001, 0x00107e46, 0x00000001, 0x00106000,
  36.721 +    0x00000000, 0x05000036, 0x00100022, 0x00000000, 0x0010000a, 0x00000001,
  36.722 +    0x09000045, 0x001000f2, 0x00000001, 0x00101046, 0x00000001, 0x00107e46,
  36.723 +    0x00000002, 0x00106000, 0x00000000, 0x05000036, 0x00100042, 0x00000000,
  36.724 +    0x0010000a, 0x00000001, 0x0a000000, 0x00100072, 0x00000000, 0x00100246,
  36.725 +    0x00000000, 0x00004002, 0xbd808081, 0xbf008081, 0xbf008081, 0x00000000,
  36.726 +    0x0a00000f, 0x00100012, 0x00000001, 0x00100086, 0x00000000, 0x00004002,
  36.727 +    0x3f950b0f, 0x3fe57732, 0x00000000, 0x00000000, 0x0a000010, 0x00100022,
  36.728 +    0x00000001, 0x00100246, 0x00000000, 0x00004002, 0x3f950b0f, 0xbe5a511a,
  36.729 +    0xbf086c22, 0x00000000, 0x0a00000f, 0x00100042, 0x00000001, 0x00100046,
  36.730 +    0x00000000, 0x00004002, 0x3f950b0f, 0x40073190, 0x00000000, 0x00000000,
  36.731 +    0x05000036, 0x00100082, 0x00000001, 0x00004001, 0x3f800000, 0x07000038,
  36.732 +    0x001020f2, 0x00000000, 0x00100e46, 0x00000001, 0x00101e46, 0x00000002,
  36.733 +    0x0100003e, 0x54415453, 0x00000074, 0x0000000c, 0x00000002, 0x00000000,
  36.734 +    0x00000003, 0x00000005, 0x00000000, 0x00000000, 0x00000001, 0x00000000,
  36.735 +    0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000003,
  36.736 +    0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000003, 0x00000000,
  36.737 +    0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
  36.738 +    0x00000000, 0x00000000, 0x46454452, 0x00000100, 0x00000000, 0x00000000,
  36.739 +    0x00000004, 0x0000001c, 0xffff0400, 0x00000100, 0x000000cb, 0x0000009c,
  36.740 +    0x00000003, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000001,
  36.741 +    0x00000001, 0x000000a7, 0x00000002, 0x00000005, 0x00000004, 0xffffffff,
  36.742 +    0x00000000, 0x00000001, 0x0000000d, 0x000000b3, 0x00000002, 0x00000005,
  36.743 +    0x00000004, 0xffffffff, 0x00000001, 0x00000001, 0x0000000d, 0x000000bf,
  36.744 +    0x00000002, 0x00000005, 0x00000004, 0xffffffff, 0x00000002, 0x00000001,
  36.745 +    0x0000000d, 0x53656874, 0x6c706d61, 0x74007265, 0x65546568, 0x72757478,
  36.746 +    0x74005965, 0x65546568, 0x72757478, 0x74005565, 0x65546568, 0x72757478,
  36.747 +    0x4d005665, 0x6f726369, 0x74666f73, 0x29522820, 0x534c4820, 0x6853204c,
  36.748 +    0x72656461, 0x6d6f4320, 0x656c6970, 0x2e362072, 0x36392e33, 0x312e3030,
  36.749 +    0x34383336, 0xababab00, 0x4e475349, 0x0000006c, 0x00000003, 0x00000008,
  36.750 +    0x00000050, 0x00000000, 0x00000001, 0x00000003, 0x00000000, 0x0000000f,
  36.751 +    0x0000005c, 0x00000000, 0x00000000, 0x00000003, 0x00000001, 0x00000303,
  36.752 +    0x00000065, 0x00000000, 0x00000000, 0x00000003, 0x00000002, 0x00000f0f,
  36.753 +    0x505f5653, 0x5449534f, 0x004e4f49, 0x43584554, 0x44524f4f, 0x4c4f4300,
  36.754 +    0xab00524f, 0x4e47534f, 0x0000002c, 0x00000001, 0x00000008, 0x00000020,
  36.755 +    0x00000000, 0x00000000, 0x00000003, 0x00000000, 0x0000000f, 0x545f5653,
  36.756 +    0x45475241, 0xabab0054
  36.757 +};
  36.758 +#else
  36.759 +#error "An appropriate 'yuv' pixel shader is not defined."
  36.760 +#endif
  36.761 +
  36.762 +/* The yuv-rendering pixel shader:
  36.763 +
  36.764 +    --- D3D11_PixelShader_NV12_JPEG.hlsl ---
  36.765 +    Texture2D theTextureY : register(t0);
  36.766 +    Texture2D theTextureUV : register(t1);
  36.767 +    SamplerState theSampler : register(s0);
  36.768 +
  36.769 +    struct PixelShaderInput
  36.770 +    {
  36.771 +        float4 pos : SV_POSITION;
  36.772 +        float2 tex : TEXCOORD0;
  36.773 +        float4 color : COLOR0;
  36.774 +    };
  36.775 +
  36.776 +    float4 main(PixelShaderInput input) : SV_TARGET
  36.777 +    {
  36.778 +        const float3 offset = {0.0, -0.501960814, -0.501960814};
  36.779 +        const float3 Rcoeff = {1.0000,  0.0000,  1.4020};
  36.780 +        const float3 Gcoeff = {1.0000, -0.3441, -0.7141};
  36.781 +        const float3 Bcoeff = {1.0000,  1.7720,  0.0000};
  36.782 +
  36.783 +        float4 Output;
  36.784 +
  36.785 +        float3 yuv;
  36.786 +        yuv.x = theTextureY.Sample(theSampler, input.tex).r;
  36.787 +        yuv.yz = theTextureUV.Sample(theSampler, input.tex).rg;
  36.788 +
  36.789 +        yuv += offset;
  36.790 +        Output.r = dot(yuv, Rcoeff);
  36.791 +        Output.g = dot(yuv, Gcoeff);
  36.792 +        Output.b = dot(yuv, Bcoeff);
  36.793 +        Output.a = 1.0f;
  36.794 +
  36.795 +        return Output * input.color;
  36.796 +    }
  36.797 +
  36.798 +*/
  36.799 +#if defined(D3D11_USE_SHADER_MODEL_4_0_level_9_1)
  36.800 +static const DWORD D3D11_PixelShader_NV12_JPEG[] = {
  36.801 +    0x43425844, 0x8fb9c77a, 0xe9e39686, 0x62b0e0e9, 0xd2bf8183, 0x00000001,
  36.802 +    0x00000548, 0x00000006, 0x00000038, 0x000001b0, 0x00000348, 0x000003c4,
  36.803 +    0x000004a0, 0x00000514, 0x396e6f41, 0x00000170, 0x00000170, 0xffff0200,
  36.804 +    0x00000144, 0x0000002c, 0x002c0000, 0x002c0000, 0x002c0000, 0x00240002,
  36.805 +    0x002c0000, 0x00000000, 0x00010001, 0xffff0200, 0x05000051, 0xa00f0000,
  36.806 +    0x00000000, 0xbf008081, 0xbf008081, 0x3f800000, 0x05000051, 0xa00f0001,
  36.807 +    0x3f800000, 0x3fb374bc, 0x00000000, 0x00000000, 0x05000051, 0xa00f0002,
  36.808 +    0x3f800000, 0xbeb02de0, 0xbf36cf42, 0x00000000, 0x05000051, 0xa00f0003,
  36.809 +    0x3f800000, 0x3fe2d0e5, 0x00000000, 0x00000000, 0x0200001f, 0x80000000,
  36.810 +    0xb0030000, 0x0200001f, 0x80000000, 0xb00f0001, 0x0200001f, 0x90000000,
  36.811 +    0xa00f0800, 0x0200001f, 0x90000000, 0xa00f0801, 0x03000042, 0x800f0000,
  36.812 +    0xb0e40000, 0xa0e40800, 0x03000042, 0x800f0001, 0xb0e40000, 0xa0e40801,
  36.813 +    0x02000001, 0x80060000, 0x80d20001, 0x03000002, 0x80070000, 0x80e40000,
  36.814 +    0xa0e40000, 0x03000005, 0x80080000, 0x80000000, 0xa0000001, 0x04000004,
  36.815 +    0x80010001, 0x80aa0000, 0xa0550001, 0x80ff0000, 0x03000008, 0x80020001,
  36.816 +    0x80e40000, 0xa0e40002, 0x0400005a, 0x80040001, 0x80e40000, 0xa0e40003,
  36.817 +    0xa0aa0003, 0x02000001, 0x80080001, 0xa0ff0000, 0x03000005, 0x800f0000,
  36.818 +    0x80e40001, 0xb0e40001, 0x02000001, 0x800f0800, 0x80e40000, 0x0000ffff,
  36.819 +    0x52444853, 0x00000190, 0x00000040, 0x00000064, 0x0300005a, 0x00106000,
  36.820 +    0x00000000, 0x04001858, 0x00107000, 0x00000000, 0x00005555, 0x04001858,
  36.821 +    0x00107000, 0x00000001, 0x00005555, 0x03001062, 0x00101032, 0x00000001,
  36.822 +    0x03001062, 0x001010f2, 0x00000002, 0x03000065, 0x001020f2, 0x00000000,
  36.823 +    0x02000068, 0x00000002, 0x09000045, 0x001000f2, 0x00000000, 0x00101046,
  36.824 +    0x00000001, 0x00107e46, 0x00000000, 0x00106000, 0x00000000, 0x09000045,
  36.825 +    0x001000f2, 0x00000001, 0x00101046, 0x00000001, 0x00107e46, 0x00000001,
  36.826 +    0x00106000, 0x00000000, 0x05000036, 0x00100062, 0x00000000, 0x00100106,
  36.827 +    0x00000001, 0x0a000000, 0x00100072, 0x00000000, 0x00100246, 0x00000000,
  36.828 +    0x00004002, 0x00000000, 0xbf008081, 0xbf008081, 0x00000000, 0x0a00000f,
  36.829 +    0x00100012, 0x00000001, 0x00100086, 0x00000000, 0x00004002, 0x3f800000,
  36.830 +    0x3fb374bc, 0x00000000, 0x00000000, 0x0a000010, 0x00100022, 0x00000001,
  36.831 +    0x00100246, 0x00000000, 0x00004002, 0x3f800000, 0xbeb02de0, 0xbf36cf42,
  36.832 +    0x00000000, 0x0a00000f, 0x00100042, 0x00000001, 0x00100046, 0x00000000,
  36.833 +    0x00004002, 0x3f800000, 0x3fe2d0e5, 0x00000000, 0x00000000, 0x05000036,
  36.834 +    0x00100082, 0x00000001, 0x00004001, 0x3f800000, 0x07000038, 0x001020f2,
  36.835 +    0x00000000, 0x00100e46, 0x00000001, 0x00101e46, 0x00000002, 0x0100003e,
  36.836 +    0x54415453, 0x00000074, 0x0000000a, 0x00000002, 0x00000000, 0x00000003,
  36.837 +    0x00000005, 0x00000000, 0x00000000, 0x00000001, 0x00000000, 0x00000000,
  36.838 +    0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0x00000000,
  36.839 +    0x00000000, 0x00000000, 0x00000000, 0x00000002, 0x00000000, 0x00000000,
  36.840 +    0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
  36.841 +    0x00000000, 0x46454452, 0x000000d4, 0x00000000, 0x00000000, 0x00000003,
  36.842 +    0x0000001c, 0xffff0400, 0x00000100, 0x000000a0, 0x0000007c, 0x00000003,
  36.843 +    0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000001,
  36.844 +    0x00000087, 0x00000002, 0x00000005, 0x00000004, 0xffffffff, 0x00000000,
  36.845 +    0x00000001, 0x0000000d, 0x00000093, 0x00000002, 0x00000005, 0x00000004,
  36.846 +    0xffffffff, 0x00000001, 0x00000001, 0x0000000d, 0x53656874, 0x6c706d61,
  36.847 +    0x74007265, 0x65546568, 0x72757478, 0x74005965, 0x65546568, 0x72757478,
  36.848 +    0x00565565, 0x7263694d, 0x666f736f, 0x52282074, 0x4c482029, 0x53204c53,
  36.849 +    0x65646168, 0x6f432072, 0x6c69706d, 0x36207265, 0x392e332e, 0x2e303036,
  36.850 +    0x38333631, 0xabab0034, 0x4e475349, 0x0000006c, 0x00000003, 0x00000008,
  36.851 +    0x00000050, 0x00000000, 0x00000001, 0x00000003, 0x00000000, 0x0000000f,
  36.852 +    0x0000005c, 0x00000000, 0x00000000, 0x00000003, 0x00000001, 0x00000303,
  36.853 +    0x00000065, 0x00000000, 0x00000000, 0x00000003, 0x00000002, 0x00000f0f,
  36.854 +    0x505f5653, 0x5449534f, 0x004e4f49, 0x43584554, 0x44524f4f, 0x4c4f4300,
  36.855 +    0xab00524f, 0x4e47534f, 0x0000002c, 0x00000001, 0x00000008, 0x00000020,
  36.856 +    0x00000000, 0x00000000, 0x00000003, 0x00000000, 0x0000000f, 0x545f5653,
  36.857 +    0x45475241, 0xabab0054
  36.858 +};
  36.859 +#elif defined(D3D11_USE_SHADER_MODEL_4_0_level_9_3)
  36.860 +static const DWORD D3D11_PixelShader_NV12_JPEG[] = {
  36.861 +    0x43425844, 0xe33e5d8b, 0x1b5f6461, 0x1afee99f, 0xcc345c04, 0x00000001,
  36.862 +    0x00000520, 0x00000006, 0x00000038, 0x00000188, 0x00000320, 0x0000039c,
  36.863 +    0x00000478, 0x000004ec, 0x396e6f41, 0x00000148, 0x00000148, 0xffff0200,
  36.864 +    0x0000011c, 0x0000002c, 0x002c0000, 0x002c0000, 0x002c0000, 0x00240002,
  36.865 +    0x002c0000, 0x00000000, 0x00010001, 0xffff0201, 0x05000051, 0xa00f0000,
  36.866 +    0x00000000, 0xbf008081, 0x3f800000, 0x3fb374bc, 0x05000051, 0xa00f0001,
  36.867 +    0x3f800000, 0xbeb02de0, 0xbf36cf42, 0x00000000, 0x05000051, 0xa00f0002,
  36.868 +    0x3f800000, 0x3fe2d0e5, 0x00000000, 0x00000000, 0x0200001f, 0x80000000,
  36.869 +    0xb0030000, 0x0200001f, 0x80000000, 0xb00f0001, 0x0200001f, 0x90000000,
  36.870 +    0xa00f0800, 0x0200001f, 0x90000000, 0xa00f0801, 0x03000042, 0x800f0000,
  36.871 +    0xb0e40000, 0xa0e40801, 0x03000042, 0x800f0001, 0xb0e40000, 0xa0e40800,
  36.872 +    0x02000001, 0x80060001, 0x80d00000, 0x03000002, 0x80070000, 0x80e40001,
  36.873 +    0xa0d40000, 0x0400005a, 0x80010001, 0x80e80000, 0xa0ee0000, 0xa0000000,
  36.874 +    0x03000008, 0x80020001, 0x80e40000, 0xa0e40001, 0x0400005a, 0x80040001,
  36.875 +    0x80e40000, 0xa0e40002, 0xa0aa0002, 0x02000001, 0x80080001, 0xa0aa0000,
  36.876 +    0x03000005, 0x800f0000, 0x80e40001, 0xb0e40001, 0x02000001, 0x800f0800,
  36.877 +    0x80e40000, 0x0000ffff, 0x52444853, 0x00000190, 0x00000040, 0x00000064,
  36.878 +    0x0300005a, 0x00106000, 0x00000000, 0x04001858, 0x00107000, 0x00000000,
  36.879 +    0x00005555, 0x04001858, 0x00107000, 0x00000001, 0x00005555, 0x03001062,
  36.880 +    0x00101032, 0x00000001, 0x03001062, 0x001010f2, 0x00000002, 0x03000065,
  36.881 +    0x001020f2, 0x00000000, 0x02000068, 0x00000002, 0x09000045, 0x001000f2,
  36.882 +    0x00000000, 0x00101046, 0x00000001, 0x00107e46, 0x00000000, 0x00106000,
  36.883 +    0x00000000, 0x09000045, 0x001000f2, 0x00000001, 0x00101046, 0x00000001,
  36.884 +    0x00107e46, 0x00000001, 0x00106000, 0x00000000, 0x05000036, 0x00100062,
  36.885 +    0x00000000, 0x00100106, 0x00000001, 0x0a000000, 0x00100072, 0x00000000,
  36.886 +    0x00100246, 0x00000000, 0x00004002, 0x00000000, 0xbf008081, 0xbf008081,
  36.887 +    0x00000000, 0x0a00000f, 0x00100012, 0x00000001, 0x00100086, 0x00000000,
  36.888 +    0x00004002, 0x3f800000, 0x3fb374bc, 0x00000000, 0x00000000, 0x0a000010,
  36.889 +    0x00100022, 0x00000001, 0x00100246, 0x00000000, 0x00004002, 0x3f800000,
  36.890 +    0xbeb02de0, 0xbf36cf42, 0x00000000, 0x0a00000f, 0x00100042, 0x00000001,
  36.891 +    0x00100046, 0x00000000, 0x00004002, 0x3f800000, 0x3fe2d0e5, 0x00000000,
  36.892 +    0x00000000, 0x05000036, 0x00100082, 0x00000001, 0x00004001, 0x3f800000,
  36.893 +    0x07000038, 0x001020f2, 0x00000000, 0x00100e46, 0x00000001, 0x00101e46,
  36.894 +    0x00000002, 0x0100003e, 0x54415453, 0x00000074, 0x0000000a, 0x00000002,
  36.895 +    0x00000000, 0x00000003, 0x00000005, 0x00000000, 0x00000000, 0x00000001,
  36.896 +    0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
  36.897 +    0x00000002, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002,
  36.898 +    0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
  36.899 +    0x00000000, 0x00000000, 0x00000000, 0x46454452, 0x000000d4, 0x00000000,
  36.900 +    0x00000000, 0x00000003, 0x0000001c, 0xffff0400, 0x00000100, 0x000000a0,
  36.901 +    0x0000007c, 0x00000003, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
  36.902 +    0x00000001, 0x00000001, 0x00000087, 0x00000002, 0x00000005, 0x00000004,
  36.903 +    0xffffffff, 0x00000000, 0x00000001, 0x0000000d, 0x00000093, 0x00000002,
  36.904 +    0x00000005, 0x00000004, 0xffffffff, 0x00000001, 0x00000001, 0x0000000d,
  36.905 +    0x53656874, 0x6c706d61, 0x74007265, 0x65546568, 0x72757478, 0x74005965,
  36.906 +    0x65546568, 0x72757478, 0x00565565, 0x7263694d, 0x666f736f, 0x52282074,
  36.907 +    0x4c482029, 0x53204c53, 0x65646168, 0x6f432072, 0x6c69706d, 0x36207265,
  36.908 +    0x392e332e, 0x2e303036, 0x38333631, 0xabab0034, 0x4e475349, 0x0000006c,
  36.909 +    0x00000003, 0x00000008, 0x00000050, 0x00000000, 0x00000001, 0x00000003,
  36.910 +    0x00000000, 0x0000000f, 0x0000005c, 0x00000000, 0x00000000, 0x00000003,
  36.911 +    0x00000001, 0x00000303, 0x00000065, 0x00000000, 0x00000000, 0x00000003,
  36.912 +    0x00000002, 0x00000f0f, 0x505f5653, 0x5449534f, 0x004e4f49, 0x43584554,
  36.913 +    0x44524f4f, 0x4c4f4300, 0xab00524f, 0x4e47534f, 0x0000002c, 0x00000001,
  36.914 +    0x00000008, 0x00000020, 0x00000000, 0x00000000, 0x00000003, 0x00000000,
  36.915 +    0x0000000f, 0x545f5653, 0x45475241, 0xabab0054
  36.916 +};
  36.917 +#else
  36.918 +#error "An appropriate 'yuv' pixel shader is not defined."
  36.919 +#endif
  36.920 +
  36.921 +/* The yuv-rendering pixel shader:
  36.922 +
  36.923 +    --- D3D11_PixelShader_NV12_BT601.hlsl ---
  36.924 +    Texture2D theTextureY : register(t0);
  36.925 +    Texture2D theTextureUV : register(t1);
  36.926 +    SamplerState theSampler : register(s0);
  36.927 +
  36.928 +    struct PixelShaderInput
  36.929 +    {
  36.930 +        float4 pos : SV_POSITION;
  36.931 +        float2 tex : TEXCOORD0;
  36.932 +        float4 color : COLOR0;
  36.933 +    };
  36.934 +
  36.935 +    float4 main(PixelShaderInput input) : SV_TARGET
  36.936 +    {
  36.937 +        const float3 offset = {-0.0627451017, -0.501960814, -0.501960814};
  36.938 +        const float3 Rcoeff = {1.1644,  0.0000,  1.5960};
  36.939 +        const float3 Gcoeff = {1.1644, -0.3918, -0.8130};
  36.940 +        const float3 Bcoeff = {1.1644,  2.0172,  0.0000};
  36.941 +
  36.942 +        float4 Output;
  36.943 +
  36.944 +        float3 yuv;
  36.945 +        yuv.x = theTextureY.Sample(theSampler, input.tex).r;
  36.946 +        yuv.yz = theTextureUV.Sample(theSampler, input.tex).rg;
  36.947 +
  36.948 +        yuv += offset;
  36.949 +        Output.r = dot(yuv, Rcoeff);
  36.950 +        Output.g = dot(yuv, Gcoeff);
  36.951 +        Output.b = dot(yuv, Bcoeff);
  36.952 +        Output.a = 1.0f;
  36.953 +
  36.954 +        return Output * input.color;
  36.955 +    }
  36.956 +
  36.957 +*/
  36.958 +#if defined(D3D11_USE_SHADER_MODEL_4_0_level_9_1)
  36.959 +static const DWORD D3D11_PixelShader_NV12_BT601[] = {
  36.960 +    0x43425844, 0xd1d24a0c, 0x337c447a, 0x22b55cff, 0xb5c9c74b, 0x00000001,
  36.961 +    0x00000548, 0x00000006, 0x00000038, 0x000001b0, 0x00000348, 0x000003c4,
  36.962 +    0x000004a0, 0x00000514, 0x396e6f41, 0x00000170, 0x00000170, 0xffff0200,
  36.963 +    0x00000144, 0x0000002c, 0x002c0000, 0x002c0000, 0x002c0000, 0x00240002,
  36.964 +    0x002c0000, 0x00000000, 0x00010001, 0xffff0200, 0x05000051, 0xa00f0000,
  36.965 +    0xbd808081, 0xbf008081, 0xbf008081, 0x3f800000, 0x05000051, 0xa00f0001,
  36.966 +    0x3f950b0f, 0x3fcc49ba, 0x00000000, 0x00000000, 0x05000051, 0xa00f0002,
  36.967 +    0x3f950b0f, 0xbec89a02, 0xbf5020c5, 0x00000000, 0x05000051, 0xa00f0003,
  36.968 +    0x3f950b0f, 0x400119ce, 0x00000000, 0x00000000, 0x0200001f, 0x80000000,
  36.969 +    0xb0030000, 0x0200001f, 0x80000000, 0xb00f0001, 0x0200001f, 0x90000000,
  36.970 +    0xa00f0800, 0x0200001f, 0x90000000, 0xa00f0801, 0x03000042, 0x800f0000,
  36.971 +    0xb0e40000, 0xa0e40800, 0x03000042, 0x800f0001, 0xb0e40000, 0xa0e40801,
  36.972 +    0x02000001, 0x80060000, 0x80d20001, 0x03000002, 0x80070000, 0x80e40000,
  36.973 +    0xa0e40000, 0x03000005, 0x80080000, 0x80000000, 0xa0000001, 0x04000004,
  36.974 +    0x80010001, 0x80aa0000, 0xa0550001, 0x80ff0000, 0x03000008, 0x80020001,
  36.975 +    0x80e40000, 0xa0e40002, 0x0400005a, 0x80040001, 0x80e40000, 0xa0e40003,
  36.976 +    0xa0aa0003, 0x02000001, 0x80080001, 0xa0ff0000, 0x03000005, 0x800f0000,
  36.977 +    0x80e40001, 0xb0e40001, 0x02000001, 0x800f0800, 0x80e40000, 0x0000ffff,
  36.978 +    0x52444853, 0x00000190, 0x00000040, 0x00000064, 0x0300005a, 0x00106000,
  36.979 +    0x00000000, 0x04001858, 0x00107000, 0x00000000, 0x00005555, 0x04001858,
  36.980 +    0x00107000, 0x00000001, 0x00005555, 0x03001062, 0x00101032, 0x00000001,
  36.981 +    0x03001062, 0x001010f2, 0x00000002, 0x03000065, 0x001020f2, 0x00000000,
  36.982 +    0x02000068, 0x00000002, 0x09000045, 0x001000f2, 0x00000000, 0x00101046,
  36.983 +    0x00000001, 0x00107e46, 0x00000000, 0x00106000, 0x00000000, 0x09000045,
  36.984 +    0x001000f2, 0x00000001, 0x00101046, 0x00000001, 0x00107e46, 0x00000001,
  36.985 +    0x00106000, 0x00000000, 0x05000036, 0x00100062, 0x00000000, 0x00100106,
  36.986 +    0x00000001, 0x0a000000, 0x00100072, 0x00000000, 0x00100246, 0x00000000,
  36.987 +    0x00004002, 0xbd808081, 0xbf008081, 0xbf008081, 0x00000000, 0x0a00000f,
  36.988 +    0x00100012, 0x00000001, 0x00100086, 0x00000000, 0x00004002, 0x3f950b0f,
  36.989 +    0x3fcc49ba, 0x00000000, 0x00000000, 0x0a000010, 0x00100022, 0x00000001,
  36.990 +    0x00100246, 0x00000000, 0x00004002, 0x3f950b0f, 0xbec89a02, 0xbf5020c5,
  36.991 +    0x00000000, 0x0a00000f, 0x00100042, 0x00000001, 0x00100046, 0x00000000,
  36.992 +    0x00004002, 0x3f950b0f, 0x400119ce, 0x00000000, 0x00000000, 0x05000036,
  36.993 +    0x00100082, 0x00000001, 0x00004001, 0x3f800000, 0x07000038, 0x001020f2,
  36.994 +    0x00000000, 0x00100e46, 0x00000001, 0x00101e46, 0x00000002, 0x0100003e,
  36.995 +    0x54415453, 0x00000074, 0x0000000a, 0x00000002, 0x00000000, 0x00000003,
  36.996 +    0x00000005, 0x00000000, 0x00000000, 0x00000001, 0x00000000, 0x00000000,
  36.997 +    0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0x00000000,
  36.998 +    0x00000000, 0x00000000, 0x00000000, 0x00000002, 0x00000000, 0x00000000,
  36.999 +    0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
 36.1000 +    0x00000000, 0x46454452, 0x000000d4, 0x00000000, 0x00000000, 0x00000003,
 36.1001 +    0x0000001c, 0xffff0400, 0x00000100, 0x000000a0, 0x0000007c, 0x00000003,
 36.1002 +    0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000001,
 36.1003 +    0x00000087, 0x00000002, 0x00000005, 0x00000004, 0xffffffff, 0x00000000,
 36.1004 +    0x00000001, 0x0000000d, 0x00000093, 0x00000002, 0x00000005, 0x00000004,
 36.1005 +    0xffffffff, 0x00000001, 0x00000001, 0x0000000d, 0x53656874, 0x6c706d61,
 36.1006 +    0x74007265, 0x65546568, 0x72757478, 0x74005965, 0x65546568, 0x72757478,
 36.1007 +    0x00565565, 0x7263694d, 0x666f736f, 0x52282074, 0x4c482029, 0x53204c53,
 36.1008 +    0x65646168, 0x6f432072, 0x6c69706d, 0x36207265, 0x392e332e, 0x2e303036,
 36.1009 +    0x38333631, 0xabab0034, 0x4e475349, 0x0000006c, 0x00000003, 0x00000008,
 36.1010 +    0x00000050, 0x00000000, 0x00000001, 0x00000003, 0x00000000, 0x0000000f,
 36.1011 +    0x0000005c, 0x00000000, 0x00000000, 0x00000003, 0x00000001, 0x00000303,
 36.1012 +    0x00000065, 0x00000000, 0x00000000, 0x00000003, 0x00000002, 0x00000f0f,
 36.1013 +    0x505f5653, 0x5449534f, 0x004e4f49, 0x43584554, 0x44524f4f, 0x4c4f4300,
 36.1014 +    0xab00524f, 0x4e47534f, 0x0000002c, 0x00000001, 0x00000008, 0x00000020,
 36.1015 +    0x00000000, 0x00000000, 0x00000003, 0x00000000, 0x0000000f, 0x545f5653,
 36.1016 +    0x45475241, 0xabab0054
 36.1017 +};
 36.1018 +#elif defined(D3D11_USE_SHADER_MODEL_4_0_level_9_3)
 36.1019 +static const DWORD D3D11_PixelShader_NV12_BT601[] = {
 36.1020 +    0x43425844, 0x84b8b692, 0x589b9edd, 0x51ef2f0b, 0xf7247962, 0x00000001,
 36.1021 +    0x00000520, 0x00000006, 0x00000038, 0x00000188, 0x00000320, 0x0000039c,
 36.1022 +    0x00000478, 0x000004ec, 0x396e6f41, 0x00000148, 0x00000148, 0xffff0200,
 36.1023 +    0x0000011c, 0x0000002c, 0x002c0000, 0x002c0000, 0x002c0000, 0x00240002,
 36.1024 +    0x002c0000, 0x00000000, 0x00010001, 0xffff0201, 0x05000051, 0xa00f0000,
 36.1025 +    0xbd808081, 0xbf008081, 0x3f800000, 0x00000000, 0x05000051, 0xa00f0001,
 36.1026 +    0x3f950b0f, 0x3fcc49ba, 0x00000000, 0x400119ce, 0x05000051, 0xa00f0002,
 36.1027 +    0x3f950b0f, 0xbec89a02, 0xbf5020c5, 0x00000000, 0x0200001f, 0x80000000,
 36.1028 +    0xb0030000, 0x0200001f, 0x80000000, 0xb00f0001, 0x0200001f, 0x90000000,
 36.1029 +    0xa00f0800, 0x0200001f, 0x90000000, 0xa00f0801, 0x03000042, 0x800f0000,
 36.1030 +    0xb0e40000, 0xa0e40801, 0x03000042, 0x800f0001, 0xb0e40000, 0xa0e40800,
 36.1031 +    0x02000001, 0x80060001, 0x80d00000, 0x03000002, 0x80070000, 0x80e40001,
 36.1032 +    0xa0d40000, 0x0400005a, 0x80010001, 0x80e80000, 0xa0e40001, 0xa0aa0001,
 36.1033 +    0x03000008, 0x80020001, 0x80e40000, 0xa0e40002, 0x0400005a, 0x80040001,
 36.1034 +    0x80e40000, 0xa0ec0001, 0xa0aa0001, 0x02000001, 0x80080001, 0xa0aa0000,
 36.1035 +    0x03000005, 0x800f0000, 0x80e40001, 0xb0e40001, 0x02000001, 0x800f0800,
 36.1036 +    0x80e40000, 0x0000ffff, 0x52444853, 0x00000190, 0x00000040, 0x00000064,
 36.1037 +    0x0300005a, 0x00106000, 0x00000000, 0x04001858, 0x00107000, 0x00000000,
 36.1038 +    0x00005555, 0x04001858, 0x00107000, 0x00000001, 0x00005555, 0x03001062,
 36.1039 +    0x00101032, 0x00000001, 0x03001062, 0x001010f2, 0x00000002, 0x03000065,
 36.1040 +    0x001020f2, 0x00000000, 0x02000068, 0x00000002, 0x09000045, 0x001000f2,
 36.1041 +    0x00000000, 0x00101046, 0x00000001, 0x00107e46, 0x00000000, 0x00106000,
 36.1042 +    0x00000000, 0x09000045, 0x001000f2, 0x00000001, 0x00101046, 0x00000001,
 36.1043 +    0x00107e46, 0x00000001, 0x00106000, 0x00000000, 0x05000036, 0x00100062,
 36.1044 +    0x00000000, 0x00100106, 0x00000001, 0x0a000000, 0x00100072, 0x00000000,
 36.1045 +    0x00100246, 0x00000000, 0x00004002, 0xbd808081, 0xbf008081, 0xbf008081,
 36.1046 +    0x00000000, 0x0a00000f, 0x00100012, 0x00000001, 0x00100086, 0x00000000,
 36.1047 +    0x00004002, 0x3f950b0f, 0x3fcc49ba, 0x00000000, 0x00000000, 0x0a000010,
 36.1048 +    0x00100022, 0x00000001, 0x00100246, 0x00000000, 0x00004002, 0x3f950b0f,
 36.1049 +    0xbec89a02, 0xbf5020c5, 0x00000000, 0x0a00000f, 0x00100042, 0x00000001,
 36.1050 +    0x00100046, 0x00000000, 0x00004002, 0x3f950b0f, 0x400119ce, 0x00000000,
 36.1051 +    0x00000000, 0x05000036, 0x00100082, 0x00000001, 0x00004001, 0x3f800000,
 36.1052 +    0x07000038, 0x001020f2, 0x00000000, 0x00100e46, 0x00000001, 0x00101e46,
 36.1053 +    0x00000002, 0x0100003e, 0x54415453, 0x00000074, 0x0000000a, 0x00000002,
 36.1054 +    0x00000000, 0x00000003, 0x00000005, 0x00000000, 0x00000000, 0x00000001,
 36.1055 +    0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
 36.1056 +    0x00000002, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002,
 36.1057 +    0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
 36.1058 +    0x00000000, 0x00000000, 0x00000000, 0x46454452, 0x000000d4, 0x00000000,
 36.1059 +    0x00000000, 0x00000003, 0x0000001c, 0xffff0400, 0x00000100, 0x000000a0,
 36.1060 +    0x0000007c, 0x00000003, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
 36.1061 +    0x00000001, 0x00000001, 0x00000087, 0x00000002, 0x00000005, 0x00000004,
 36.1062 +    0xffffffff, 0x00000000, 0x00000001, 0x0000000d, 0x00000093, 0x00000002,
 36.1063 +    0x00000005, 0x00000004, 0xffffffff, 0x00000001, 0x00000001, 0x0000000d,
 36.1064 +    0x53656874, 0x6c706d61, 0x74007265, 0x65546568, 0x72757478, 0x74005965,
 36.1065 +    0x65546568, 0x72757478, 0x00565565, 0x7263694d, 0x666f736f, 0x52282074,
 36.1066 +    0x4c482029, 0x53204c53, 0x65646168, 0x6f432072, 0x6c69706d, 0x36207265,
 36.1067 +    0x392e332e, 0x2e303036, 0x38333631, 0xabab0034, 0x4e475349, 0x0000006c,
 36.1068 +    0x00000003, 0x00000008, 0x00000050, 0x00000000, 0x00000001, 0x00000003,
 36.1069 +    0x00000000, 0x0000000f, 0x0000005c, 0x00000000, 0x00000000, 0x00000003,
 36.1070 +    0x00000001, 0x00000303, 0x00000065, 0x00000000, 0x00000000, 0x00000003,
 36.1071 +    0x00000002, 0x00000f0f, 0x505f5653, 0x5449534f, 0x004e4f49, 0x43584554,
 36.1072 +    0x44524f4f, 0x4c4f4300, 0xab00524f, 0x4e47534f, 0x0000002c, 0x00000001,
 36.1073 +    0x00000008, 0x00000020, 0x00000000, 0x00000000, 0x00000003, 0x00000000,
 36.1074 +    0x0000000f, 0x545f5653, 0x45475241, 0xabab0054
 36.1075 +};
 36.1076 +#else
 36.1077 +#error "An appropriate 'yuv' pixel shader is not defined."
 36.1078 +#endif
 36.1079 +
 36.1080 +/* The yuv-rendering pixel shader:
 36.1081 +
 36.1082 +    --- D3D11_PixelShader_NV12_BT709.hlsl ---
 36.1083 +    Texture2D theTextureY : register(t0);
 36.1084 +    Texture2D theTextureUV : register(t1);
 36.1085 +    SamplerState theSampler : register(s0);
 36.1086 +
 36.1087 +    struct PixelShaderInput
 36.1088 +    {
 36.1089 +        float4 pos : SV_POSITION;
 36.1090 +        float2 tex : TEXCOORD0;
 36.1091 +        float4 color : COLOR0;
 36.1092 +    };
 36.1093 +
 36.1094 +    float4 main(PixelShaderInput input) : SV_TARGET
 36.1095 +    {
 36.1096 +        const float3 offset = {-0.0627451017, -0.501960814, -0.501960814};
 36.1097 +        const float3 Rcoeff = {1.1644,  0.0000,  1.7927};
 36.1098 +        const float3 Gcoeff = {1.1644, -0.2132, -0.5329};
 36.1099 +        const float3 Bcoeff = {1.1644,  2.1124,  0.0000};
 36.1100 +
 36.1101 +        float4 Output;
 36.1102 +
 36.1103 +        float3 yuv;
 36.1104 +        yuv.x = theTextureY.Sample(theSampler, input.tex).r;
 36.1105 +        yuv.yz = theTextureUV.Sample(theSampler, input.tex).rg;
 36.1106 +
 36.1107 +        yuv += offset;
 36.1108 +        Output.r = dot(yuv, Rcoeff);
 36.1109 +        Output.g = dot(yuv, Gcoeff);
 36.1110 +        Output.b = dot(yuv, Bcoeff);
 36.1111 +        Output.a = 1.0f;
 36.1112 +
 36.1113 +        return Output * input.color;
 36.1114 +    }
 36.1115 +
 36.1116 +*/
 36.1117 +#if defined(D3D11_USE_SHADER_MODEL_4_0_level_9_1)
 36.1118 +static const DWORD D3D11_PixelShader_NV12_BT709[] = {
 36.1119 +    0x43425844, 0x40d1b8d5, 0xaf4b78b5, 0x907fd0b5, 0xa2d23686, 0x00000001,
 36.1120 +    0x00000548, 0x00000006, 0x00000038, 0x000001b0, 0x00000348, 0x000003c4,
 36.1121 +    0x000004a0, 0x00000514, 0x396e6f41, 0x00000170, 0x00000170, 0xffff0200,
 36.1122 +    0x00000144, 0x0000002c, 0x002c0000, 0x002c0000, 0x002c0000, 0x00240002,
 36.1123 +    0x002c0000, 0x00000000, 0x00010001, 0xffff0200, 0x05000051, 0xa00f0000,
 36.1124 +    0xbd808081, 0xbf008081, 0xbf008081, 0x3f800000, 0x05000051, 0xa00f0001,
 36.1125 +    0x3f950b0f, 0x3fe57732, 0x00000000, 0x00000000, 0x05000051, 0xa00f0002,
 36.1126 +    0x3f950b0f, 0xbe5a511a, 0xbf086c22, 0x00000000, 0x05000051, 0xa00f0003,
 36.1127 +    0x3f950b0f, 0x40073190, 0x00000000, 0x00000000, 0x0200001f, 0x80000000,
 36.1128 +    0xb0030000, 0x0200001f, 0x80000000, 0xb00f0001, 0x0200001f, 0x90000000,
 36.1129 +    0xa00f0800, 0x0200001f, 0x90000000, 0xa00f0801, 0x03000042, 0x800f0000,
 36.1130 +    0xb0e40000, 0xa0e40800, 0x03000042, 0x800f0001, 0xb0e40000, 0xa0e40801,
 36.1131 +    0x02000001, 0x80060000, 0x80d20001, 0x03000002, 0x80070000, 0x80e40000,
 36.1132 +    0xa0e40000, 0x03000005, 0x80080000, 0x80000000, 0xa0000001, 0x04000004,
 36.1133 +    0x80010001, 0x80aa0000, 0xa0550001, 0x80ff0000, 0x03000008, 0x80020001,
 36.1134 +    0x80e40000, 0xa0e40002, 0x0400005a, 0x80040001, 0x80e40000, 0xa0e40003,
 36.1135 +    0xa0aa0003, 0x02000001, 0x80080001, 0xa0ff0000, 0x03000005, 0x800f0000,
 36.1136 +    0x80e40001, 0xb0e40001, 0x02000001, 0x800f0800, 0x80e40000, 0x0000ffff,
 36.1137 +    0x52444853, 0x00000190, 0x00000040, 0x00000064, 0x0300005a, 0x00106000,
 36.1138 +    0x00000000, 0x04001858, 0x00107000, 0x00000000, 0x00005555, 0x04001858,
 36.1139 +    0x00107000, 0x00000001, 0x00005555, 0x03001062, 0x00101032, 0x00000001,
 36.1140 +    0x03001062, 0x001010f2, 0x00000002, 0x03000065, 0x001020f2, 0x00000000,
 36.1141 +    0x02000068, 0x00000002, 0x09000045, 0x001000f2, 0x00000000, 0x00101046,
 36.1142 +    0x00000001, 0x00107e46, 0x00000000, 0x00106000, 0x00000000, 0x09000045,
 36.1143 +    0x001000f2, 0x00000001, 0x00101046, 0x00000001, 0x00107e46, 0x00000001,
 36.1144 +    0x00106000, 0x00000000, 0x05000036, 0x00100062, 0x00000000, 0x00100106,
 36.1145 +    0x00000001, 0x0a000000, 0x00100072, 0x00000000, 0x00100246, 0x00000000,
 36.1146 +    0x00004002, 0xbd808081, 0xbf008081, 0xbf008081, 0x00000000, 0x0a00000f,
 36.1147 +    0x00100012, 0x00000001, 0x00100086, 0x00000000, 0x00004002, 0x3f950b0f,
 36.1148 +    0x3fe57732, 0x00000000, 0x00000000, 0x0a000010, 0x00100022, 0x00000001,
 36.1149 +    0x00100246, 0x00000000, 0x00004002, 0x3f950b0f, 0xbe5a511a, 0xbf086c22,
 36.1150 +    0x00000000, 0x0a00000f, 0x00100042, 0x00000001, 0x00100046, 0x00000000,
 36.1151 +    0x00004002, 0x3f950b0f, 0x40073190, 0x00000000, 0x00000000, 0x05000036,
 36.1152 +    0x00100082, 0x00000001, 0x00004001, 0x3f800000, 0x07000038, 0x001020f2,
 36.1153 +    0x00000000, 0x00100e46, 0x00000001, 0x00101e46, 0x00000002, 0x0100003e,
 36.1154 +    0x54415453, 0x00000074, 0x0000000a, 0x00000002, 0x00000000, 0x00000003,
 36.1155 +    0x00000005, 0x00000000, 0x00000000, 0x00000001, 0x00000000, 0x00000000,
 36.1156 +    0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0x00000000,
 36.1157 +    0x00000000, 0x00000000, 0x00000000, 0x00000002, 0x00000000, 0x00000000,
 36.1158 +    0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
 36.1159 +    0x00000000, 0x46454452, 0x000000d4, 0x00000000, 0x00000000, 0x00000003,
 36.1160 +    0x0000001c, 0xffff0400, 0x00000100, 0x000000a0, 0x0000007c, 0x00000003,
 36.1161 +    0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000001,
 36.1162 +    0x00000087, 0x00000002, 0x00000005, 0x00000004, 0xffffffff, 0x00000000,
 36.1163 +    0x00000001, 0x0000000d, 0x00000093, 0x00000002, 0x00000005, 0x00000004,
 36.1164 +    0xffffffff, 0x00000001, 0x00000001, 0x0000000d, 0x53656874, 0x6c706d61,
 36.1165 +    0x74007265, 0x65546568, 0x72757478, 0x74005965, 0x65546568, 0x72757478,
 36.1166 +    0x00565565, 0x7263694d, 0x666f736f, 0x52282074, 0x4c482029, 0x53204c53,
 36.1167 +    0x65646168, 0x6f432072, 0x6c69706d, 0x36207265, 0x392e332e, 0x2e303036,
 36.1168 +    0x38333631, 0xabab0034, 0x4e475349, 0x0000006c, 0x00000003, 0x00000008,
 36.1169 +    0x00000050, 0x00000000, 0x00000001, 0x00000003, 0x00000000, 0x0000000f,
 36.1170 +    0x0000005c, 0x00000000, 0x00000000, 0x00000003, 0x00000001, 0x00000303,
 36.1171 +    0x00000065, 0x00000000, 0x00000000, 0x00000003, 0x00000002, 0x00000f0f,
 36.1172 +    0x505f5653, 0x5449534f, 0x004e4f49, 0x43584554, 0x44524f4f, 0x4c4f4300,
 36.1173 +    0xab00524f, 0x4e47534f, 0x0000002c, 0x00000001, 0x00000008, 0x00000020,
 36.1174 +    0x00000000, 0x00000000, 0x00000003, 0x00000000, 0x0000000f, 0x545f5653,
 36.1175 +    0x45475241, 0xabab0054
 36.1176 +};
 36.1177 +#elif defined(D3D11_USE_SHADER_MODEL_4_0_level_9_3)
 36.1178 +static const DWORD D3D11_PixelShader_NV12_BT709[] = {
 36.1179 +    0x43425844, 0xa3bba187, 0x71b6afa9, 0x15998682, 0x2d545cae, 0x00000001,
 36.1180 +    0x00000520, 0x00000006, 0x00000038, 0x00000188, 0x00000320, 0x0000039c,
 36.1181 +    0x00000478, 0x000004ec, 0x396e6f41, 0x00000148, 0x00000148, 0xffff0200,
 36.1182 +    0x0000011c, 0x0000002c, 0x002c0000, 0x002c0000, 0x002c0000, 0x00240002,
 36.1183 +    0x002c0000, 0x00000000, 0x00010001, 0xffff0201, 0x05000051, 0xa00f0000,
 36.1184 +    0xbd808081, 0xbf008081, 0x3f800000, 0x00000000, 0x05000051, 0xa00f0001,
 36.1185 +    0x3f950b0f, 0x3fe57732, 0x00000000, 0x40073190, 0x05000051, 0xa00f0002,
 36.1186 +    0x3f950b0f, 0xbe5a511a, 0xbf086c22, 0x00000000, 0x0200001f, 0x80000000,
 36.1187 +    0xb0030000, 0x0200001f, 0x80000000, 0xb00f0001, 0x0200001f, 0x90000000,
 36.1188 +    0xa00f0800, 0x0200001f, 0x90000000, 0xa00f0801, 0x03000042, 0x800f0000,
 36.1189 +    0xb0e40000, 0xa0e40801, 0x03000042, 0x800f0001, 0xb0e40000, 0xa0e40800,
 36.1190 +    0x02000001, 0x80060001, 0x80d00000, 0x03000002, 0x80070000, 0x80e40001,
 36.1191 +    0xa0d40000, 0x0400005a, 0x80010001, 0x80e80000, 0xa0e40001, 0xa0aa0001,
 36.1192 +    0x03000008, 0x80020001, 0x80e40000, 0xa0e40002, 0x0400005a, 0x80040001,
 36.1193 +    0x80e40000, 0xa0ec0001, 0xa0aa0001, 0x02000001, 0x80080001, 0xa0aa0000,
 36.1194 +    0x03000005, 0x800f0000, 0x80e40001, 0xb0e40001, 0x02000001, 0x800f0800,
 36.1195 +    0x80e40000, 0x0000ffff, 0x52444853, 0x00000190, 0x00000040, 0x00000064,
 36.1196 +    0x0300005a, 0x00106000, 0x00000000, 0x04001858, 0x00107000, 0x00000000,
 36.1197 +    0x00005555, 0x04001858, 0x00107000, 0x00000001, 0x00005555, 0x03001062,
 36.1198 +    0x00101032, 0x00000001, 0x03001062, 0x001010f2, 0x00000002, 0x03000065,
 36.1199 +    0x001020f2, 0x00000000, 0x02000068, 0x00000002, 0x09000045, 0x001000f2,
 36.1200 +    0x00000000, 0x00101046, 0x00000001, 0x00107e46, 0x00000000, 0x00106000,
 36.1201 +    0x00000000, 0x09000045, 0x001000f2, 0x00000001, 0x00101046, 0x00000001,
 36.1202 +    0x00107e46, 0x00000001, 0x00106000, 0x00000000, 0x05000036, 0x00100062,
 36.1203 +    0x00000000, 0x00100106, 0x00000001, 0x0a000000, 0x00100072, 0x00000000,
 36.1204 +    0x00100246, 0x00000000, 0x00004002, 0xbd808081, 0xbf008081, 0xbf008081,
 36.1205 +    0x00000000, 0x0a00000f, 0x00100012, 0x00000001, 0x00100086, 0x00000000,
 36.1206 +    0x00004002, 0x3f950b0f, 0x3fe57732, 0x00000000, 0x00000000, 0x0a000010,
 36.1207 +    0x00100022, 0x00000001, 0x00100246, 0x00000000, 0x00004002, 0x3f950b0f,
 36.1208 +    0xbe5a511a, 0xbf086c22, 0x00000000, 0x0a00000f, 0x00100042, 0x00000001,
 36.1209 +    0x00100046, 0x00000000, 0x00004002, 0x3f950b0f, 0x40073190, 0x00000000,
 36.1210 +    0x00000000, 0x05000036, 0x00100082, 0x00000001, 0x00004001, 0x3f800000,
 36.1211 +    0x07000038, 0x001020f2, 0x00000000, 0x00100e46, 0x00000001, 0x00101e46,
 36.1212 +    0x00000002, 0x0100003e, 0x54415453, 0x00000074, 0x0000000a, 0x00000002,
 36.1213 +    0x00000000, 0x00000003, 0x00000005, 0x00000000, 0x00000000, 0x00000001,
 36.1214 +    0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
 36.1215 +    0x00000002, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002,
 36.1216 +    0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
 36.1217 +    0x00000000, 0x00000000, 0x00000000, 0x46454452, 0x000000d4, 0x00000000,
 36.1218 +    0x00000000, 0x00000003, 0x0000001c, 0xffff0400, 0x00000100, 0x000000a0,
 36.1219 +    0x0000007c, 0x00000003, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
 36.1220 +    0x00000001, 0x00000001, 0x00000087, 0x00000002, 0x00000005, 0x00000004,
 36.1221 +    0xffffffff, 0x00000000, 0x00000001, 0x0000000d, 0x00000093, 0x00000002,
 36.1222 +    0x00000005, 0x00000004, 0xffffffff, 0x00000001, 0x00000001, 0x0000000d,
 36.1223 +    0x53656874, 0x6c706d61, 0x74007265, 0x65546568, 0x72757478, 0x74005965,
 36.1224 +    0x65546568, 0x72757478, 0x00565565, 0x7263694d, 0x666f736f, 0x52282074,
 36.1225 +    0x4c482029, 0x53204c53, 0x65646168, 0x6f432072, 0x6c69706d, 0x36207265,
 36.1226 +    0x392e332e, 0x2e303036, 0x38333631, 0xabab0034, 0x4e475349, 0x0000006c,
 36.1227 +    0x00000003, 0x00000008, 0x00000050, 0x00000000, 0x00000001, 0x00000003,
 36.1228 +    0x00000000, 0x0000000f, 0x0000005c, 0x00000000, 0x00000000, 0x00000003,
 36.1229 +    0x00000001, 0x00000303, 0x00000065, 0x00000000, 0x00000000, 0x00000003,
 36.1230 +    0x00000002, 0x00000f0f, 0x505f5653, 0x5449534f, 0x004e4f49, 0x43584554,
 36.1231 +    0x44524f4f, 0x4c4f4300, 0xab00524f, 0x4e47534f, 0x0000002c, 0x00000001,
 36.1232 +    0x00000008, 0x00000020, 0x00000000, 0x00000000, 0x00000003, 0x00000000,
 36.1233 +    0x0000000f, 0x545f5653, 0x45475241, 0xabab0054
 36.1234 +};
 36.1235 +#else
 36.1236 +#error "An appropriate 'yuv' pixel shader is not defined."
 36.1237 +#endif
 36.1238 +
 36.1239 +/* The yuv-rendering pixel shader:
 36.1240 +
 36.1241 +    --- D3D11_PixelShader_NV21_JPEG.hlsl ---
 36.1242 +    Texture2D theTextureY : register(t0);
 36.1243 +    Texture2D theTextureUV : register(t1);
 36.1244 +    SamplerState theSampler : register(s0);
 36.1245 +
 36.1246 +    struct PixelShaderInput
 36.1247 +    {
 36.1248 +        float4 pos : SV_POSITION;
 36.1249 +        float2 tex : TEXCOORD0;
 36.1250 +        float4 color : COLOR0;
 36.1251 +    };
 36.1252 +
 36.1253 +    float4 main(PixelShaderInput input) : SV_TARGET
 36.1254 +    {
 36.1255 +        const float3 offset = {0.0, -0.501960814, -0.501960814};
 36.1256 +        const float3 Rcoeff = {1.0000,  0.0000,  1.4020};
 36.1257 +        const float3 Gcoeff = {1.0000, -0.3441, -0.7141};
 36.1258 +        const float3 Bcoeff = {1.0000,  1.7720,  0.0000};
 36.1259 +
 36.1260 +        float4 Output;
 36.1261 +
 36.1262 +        float3 yuv;
 36.1263 +        yuv.x = theTextureY.Sample(theSampler, input.tex).r;
 36.1264 +        yuv.yz = theTextureUV.Sample(theSampler, input.tex).gr;
 36.1265 +
 36.1266 +        yuv += offset;
 36.1267 +        Output.r = dot(yuv, Rcoeff);
 36.1268 +        Output.g = dot(yuv, Gcoeff);
 36.1269 +        Output.b = dot(yuv, Bcoeff);
 36.1270 +        Output.a = 1.0f;
 36.1271 +
 36.1272 +        return Output * input.color;
 36.1273 +    }
 36.1274 +
 36.1275 +*/
 36.1276 +#if defined(D3D11_USE_SHADER_MODEL_4_0_level_9_1)
 36.1277 +static const DWORD D3D11_PixelShader_NV21_JPEG[] = {
 36.1278 +    0x43425844, 0x9c41f579, 0xfd1019d8, 0x7c27e3ae, 0x52e3a5ff, 0x00000001,
 36.1279 +    0x00000554, 0x00000006, 0x00000038, 0x000001bc, 0x00000354, 0x000003d0,
 36.1280 +    0x000004ac, 0x00000520, 0x396e6f41, 0x0000017c, 0x0000017c, 0xffff0200,
 36.1281 +    0x00000150, 0x0000002c, 0x002c0000, 0x002c0000, 0x002c0000, 0x00240002,
 36.1282 +    0x002c0000, 0x00000000, 0x00010001, 0xffff0200, 0x05000051, 0xa00f0000,
 36.1283 +    0x00000000, 0xbf008081, 0xbf008081, 0x3f800000, 0x05000051, 0xa00f0001,
 36.1284 +    0x3f800000, 0x3fb374bc, 0x00000000, 0x00000000, 0x05000051, 0xa00f0002,
 36.1285 +    0x3f800000, 0xbeb02de0, 0xbf36cf42, 0x00000000, 0x05000051, 0xa00f0003,
 36.1286 +    0x3f800000, 0x3fe2d0e5, 0x00000000, 0x00000000, 0x0200001f, 0x80000000,
 36.1287 +    0xb0030000, 0x0200001f, 0x80000000, 0xb00f0001, 0x0200001f, 0x90000000,
 36.1288 +    0xa00f0800, 0x0200001f, 0x90000000, 0xa00f0801, 0x03000042, 0x800f0000,
 36.1289 +    0xb0e40000, 0xa0e40800, 0x03000042, 0x800f0001, 0xb0e40000, 0xa0e40801,
 36.1290 +    0x02000001, 0x80020000, 0x80550001, 0x02000001, 0x80040000, 0x80000001,
 36.1291 +    0x03000002, 0x80070000, 0x80e40000, 0xa0e40000, 0x03000005, 0x80080000,
 36.1292 +    0x80000000, 0xa0000001, 0x04000004, 0x80010001, 0x80aa0000, 0xa0550001,
 36.1293 +    0x80ff0000, 0x03000008, 0x80020001, 0x80e40000, 0xa0e40002, 0x0400005a,
 36.1294 +    0x80040001, 0x80e40000, 0xa0e40003, 0xa0aa0003, 0x02000001, 0x80080001,
 36.1295 +    0xa0ff0000, 0x03000005, 0x800f0000, 0x80e40001, 0xb0e40001, 0x02000001,
 36.1296 +    0x800f0800, 0x80e40000, 0x0000ffff, 0x52444853, 0x00000190, 0x00000040,
 36.1297 +    0x00000064, 0x0300005a, 0x00106000, 0x00000000, 0x04001858, 0x00107000,
 36.1298 +    0x00000000, 0x00005555, 0x04001858, 0x00107000, 0x00000001, 0x00005555,
 36.1299 +    0x03001062, 0x00101032, 0x00000001, 0x03001062, 0x001010f2, 0x00000002,
 36.1300 +    0x03000065, 0x001020f2, 0x00000000, 0x02000068, 0x00000002, 0x09000045,
 36.1301 +    0x001000f2, 0x00000000, 0x00101046, 0x00000001, 0x00107e46, 0x00000000,
 36.1302 +    0x00106000, 0x00000000, 0x09000045, 0x001000f2, 0x00000001, 0x00101046,
 36.1303 +    0x00000001, 0x00107e46, 0x00000001, 0x00106000, 0x00000000, 0x05000036,
 36.1304 +    0x00100062, 0x00000000, 0x00100456, 0x00000001, 0x0a000000, 0x00100072,
 36.1305 +    0x00000000, 0x00100246, 0x00000000, 0x00004002, 0x00000000, 0xbf008081,
 36.1306 +    0xbf008081, 0x00000000, 0x0a00000f, 0x00100012, 0x00000001, 0x00100086,
 36.1307 +    0x00000000, 0x00004002, 0x3f800000, 0x3fb374bc, 0x00000000, 0x00000000,
 36.1308 +    0x0a000010, 0x00100022, 0x00000001, 0x00100246, 0x00000000, 0x00004002,
 36.1309 +    0x3f800000, 0xbeb02de0, 0xbf36cf42, 0x00000000, 0x0a00000f, 0x00100042,
 36.1310 +    0x00000001, 0x00100046, 0x00000000, 0x00004002, 0x3f800000, 0x3fe2d0e5,
 36.1311 +    0x00000000, 0x00000000, 0x05000036, 0x00100082, 0x00000001, 0x00004001,
 36.1312 +    0x3f800000, 0x07000038, 0x001020f2, 0x00000000, 0x00100e46, 0x00000001,
 36.1313 +    0x00101e46, 0x00000002, 0x0100003e, 0x54415453, 0x00000074, 0x0000000a,
 36.1314 +    0x00000002, 0x00000000, 0x00000003, 0x00000005, 0x00000000, 0x00000000,
 36.1315 +    0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
 36.1316 +    0x00000000, 0x00000002, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
 36.1317 +    0x00000002, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
 36.1318 +    0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x46454452, 0x000000d4,
 36.1319 +    0x00000000, 0x00000000, 0x00000003, 0x0000001c, 0xffff0400, 0x00000100,
 36.1320 +    0x000000a0, 0x0000007c, 0x00000003, 0x00000000, 0x00000000, 0x00000000,
 36.1321 +    0x00000000, 0x00000001, 0x00000001, 0x00000087, 0x00000002, 0x00000005,
 36.1322 +    0x00000004, 0xffffffff, 0x00000000, 0x00000001, 0x0000000d, 0x00000093,
 36.1323 +    0x00000002, 0x00000005, 0x00000004, 0xffffffff, 0x00000001, 0x00000001,
 36.1324 +    0x0000000d, 0x53656874, 0x6c706d61, 0x74007265, 0x65546568, 0x72757478,
 36.1325 +    0x74005965, 0x65546568, 0x72757478, 0x00565565, 0x7263694d, 0x666f736f,
 36.1326 +    0x52282074, 0x4c482029, 0x53204c53, 0x65646168, 0x6f432072, 0x6c69706d,
 36.1327 +    0x36207265, 0x392e332e, 0x2e303036, 0x38333631, 0xabab0034, 0x4e475349,
 36.1328 +    0x0000006c, 0x00000003, 0x00000008, 0x00000050, 0x00000000, 0x00000001,
 36.1329 +    0x00000003, 0x00000000, 0x0000000f, 0x0000005c, 0x00000000, 0x00000000,
 36.1330 +    0x00000003, 0x00000001, 0x00000303, 0x00000065, 0x00000000, 0x00000000,
 36.1331 +    0x00000003, 0x00000002, 0x00000f0f, 0x505f5653, 0x5449534f, 0x004e4f49,
 36.1332 +    0x43584554, 0x44524f4f, 0x4c4f4300, 0xab00524f, 0x4e47534f, 0x0000002c,
 36.1333 +    0x00000001, 0x00000008, 0x00000020, 0x00000000, 0x00000000, 0x00000003,
 36.1334 +    0x00000000, 0x0000000f, 0x545f5653, 0x45475241, 0xabab0054
 36.1335 +};
 36.1336 +#elif defined(D3D11_USE_SHADER_MODEL_4_0_level_9_3)
 36.1337 +static const DWORD D3D11_PixelShader_NV21_JPEG[] = {
 36.1338 +    0x43425844, 0x5705ccc9, 0xeb57571d, 0x8ce556e0, 0x2adef743, 0x00000001,
 36.1339 +    0x00000520, 0x00000006, 0x00000038, 0x00000188, 0x00000320, 0x0000039c,
 36.1340 +    0x00000478, 0x000004ec, 0x396e6f41, 0x00000148, 0x00000148, 0xffff0200,
 36.1341 +    0x0000011c, 0x0000002c, 0x002c0000, 0x002c0000, 0x002c0000, 0x00240002,
 36.1342 +    0x002c0000, 0x00000000, 0x00010001, 0xffff0201, 0x05000051, 0xa00f0000,
 36.1343 +    0x00000000, 0xbf008081, 0x3f800000, 0x3fb374bc, 0x05000051, 0xa00f0001,
 36.1344 +    0x3f800000, 0xbeb02de0, 0xbf36cf42, 0x00000000, 0x05000051, 0xa00f0002,
 36.1345 +    0x3f800000, 0x3fe2d0e5, 0x00000000, 0x00000000, 0x0200001f, 0x80000000,
 36.1346 +    0xb0030000, 0x0200001f, 0x80000000, 0xb00f0001, 0x0200001f, 0x90000000,
 36.1347 +    0xa00f0800, 0x0200001f, 0x90000000, 0xa00f0801, 0x03000042, 0x800f0000,
 36.1348 +    0xb0e40000, 0xa0e40801, 0x03000042, 0x800f0001, 0xb0e40000, 0xa0e40800,
 36.1349 +    0x02000001, 0x80060001, 0x80c40000, 0x03000002, 0x80070000, 0x80e40001,
 36.1350 +    0xa0d40000, 0x0400005a, 0x80010001, 0x80e80000, 0xa0ee0000, 0xa0000000,
 36.1351 +    0x03000008, 0x80020001, 0x80e40000, 0xa0e40001, 0x0400005a, 0x80040001,
 36.1352 +    0x80e40000, 0xa0e40002, 0xa0aa0002, 0x02000001, 0x80080001, 0xa0aa0000,
 36.1353 +    0x03000005, 0x800f0000, 0x80e40001, 0xb0e40001, 0x02000001, 0x800f0800,
 36.1354 +    0x80e40000, 0x0000ffff, 0x52444853, 0x00000190, 0x00000040, 0x00000064,
 36.1355 +    0x0300005a, 0x00106000, 0x00000000, 0x04001858, 0x00107000, 0x00000000,
 36.1356 +    0x00005555, 0x04001858, 0x00107000, 0x00000001, 0x00005555, 0x03001062,
 36.1357 +    0x00101032, 0x00000001, 0x03001062, 0x001010f2, 0x00000002, 0x03000065,
 36.1358 +    0x001020f2, 0x00000000, 0x02000068, 0x00000002, 0x09000045, 0x001000f2,
 36.1359 +    0x00000000, 0x00101046, 0x00000001, 0x00107e46, 0x00000000, 0x00106000,
 36.1360 +    0x00000000, 0x09000045, 0x001000f2, 0x00000001, 0x00101046, 0x00000001,
 36.1361 +    0x00107e46, 0x00000001, 0x00106000, 0x00000000, 0x05000036, 0x00100062,
 36.1362 +    0x00000000, 0x00100456, 0x00000001, 0x0a000000, 0x00100072, 0x00000000,
 36.1363 +    0x00100246, 0x00000000, 0x00004002, 0x00000000, 0xbf008081, 0xbf008081,
 36.1364 +    0x00000000, 0x0a00000f, 0x00100012, 0x00000001, 0x00100086, 0x00000000,
 36.1365 +    0x00004002, 0x3f800000, 0x3fb374bc, 0x00000000, 0x00000000, 0x0a000010,
 36.1366 +    0x00100022, 0x00000001, 0x00100246, 0x00000000, 0x00004002, 0x3f800000,
 36.1367 +    0xbeb02de0, 0xbf36cf42, 0x00000000, 0x0a00000f, 0x00100042, 0x00000001,
 36.1368 +    0x00100046, 0x00000000, 0x00004002, 0x3f800000, 0x3fe2d0e5, 0x00000000,
 36.1369 +    0x00000000, 0x05000036, 0x00100082, 0x00000001, 0x00004001, 0x3f800000,
 36.1370 +    0x07000038, 0x001020f2, 0x00000000, 0x00100e46, 0x00000001, 0x00101e46,
 36.1371 +    0x00000002, 0x0100003e, 0x54415453, 0x00000074, 0x0000000a, 0x00000002,
 36.1372 +    0x00000000, 0x00000003, 0x00000005, 0x00000000, 0x00000000, 0x00000001,
 36.1373 +    0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
 36.1374 +    0x00000002, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002,
 36.1375 +    0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
 36.1376 +    0x00000000, 0x00000000, 0x00000000, 0x46454452, 0x000000d4, 0x00000000,
 36.1377 +    0x00000000, 0x00000003, 0x0000001c, 0xffff0400, 0x00000100, 0x000000a0,
 36.1378 +    0x0000007c, 0x00000003, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
 36.1379 +    0x00000001, 0x00000001, 0x00000087, 0x00000002, 0x00000005, 0x00000004,
 36.1380 +    0xffffffff, 0x00000000, 0x00000001, 0x0000000d, 0x00000093, 0x00000002,
 36.1381 +    0x00000005, 0x00000004, 0xffffffff, 0x00000001, 0x00000001, 0x0000000d,
 36.1382 +    0x53656874, 0x6c706d61, 0x74007265, 0x65546568, 0x72757478, 0x74005965,
 36.1383 +    0x65546568, 0x72757478, 0x00565565, 0x7263694d, 0x666f736f, 0x52282074,
 36.1384 +    0x4c482029, 0x53204c53, 0x65646168, 0x6f432072, 0x6c69706d, 0x36207265,
 36.1385 +    0x392e332e, 0x2e303036, 0x38333631, 0xabab0034, 0x4e475349, 0x0000006c,
 36.1386 +    0x00000003, 0x00000008, 0x00000050, 0x00000000, 0x00000001, 0x00000003,
 36.1387 +    0x00000000, 0x0000000f, 0x0000005c, 0x00000000, 0x00000000, 0x00000003,
 36.1388 +    0x00000001, 0x00000303, 0x00000065, 0x00000000, 0x00000000, 0x00000003,
 36.1389 +    0x00000002, 0x00000f0f, 0x505f5653, 0x5449534f, 0x004e4f49, 0x43584554,
 36.1390 +    0x44524f4f, 0x4c4f4300, 0xab00524f, 0x4e47534f, 0x0000002c, 0x00000001,
 36.1391 +    0x00000008, 0x00000020, 0x00000000, 0x00000000, 0x00000003, 0x00000000,
 36.1392 +    0x0000000f, 0x545f5653, 0x45475241, 0xabab0054
 36.1393 +};
 36.1394 +#else
 36.1395 +#error "An appropriate 'yuv' pixel shader is not defined."
 36.1396 +#endif
 36.1397 +
 36.1398 +/* The yuv-rendering pixel shader:
 36.1399 +
 36.1400 +    --- D3D11_PixelShader_NV21_BT601.hlsl ---
 36.1401 +    Texture2D theTextureY : register(t0);
 36.1402 +    Texture2D theTextureUV : register(t1);
 36.1403 +    SamplerState theSampler : register(s0);
 36.1404 +
 36.1405 +    struct PixelShaderInput
 36.1406 +    {
 36.1407 +        float4 pos : SV_POSITION;
 36.1408 +        float2 tex : TEXCOORD0;
 36.1409 +        float4 color : COLOR0;
 36.1410 +    };
 36.1411 +
 36.1412 +    float4 main(PixelShaderInput input) : SV_TARGET
 36.1413 +    {
 36.1414 +        const float3 offset = {-0.0627451017, -0.501960814, -0.501960814};
 36.1415 +        const float3 Rcoeff = {1.1644,  0.0000,  1.5960};
 36.1416 +        const float3 Gcoeff = {1.1644, -0.3918, -0.8130};
 36.1417 +        const float3 Bcoeff = {1.1644,  2.0172,  0.0000};
 36.1418 +
 36.1419 +        float4 Output;
 36.1420 +
 36.1421 +        float3 yuv;
 36.1422 +        yuv.x = theTextureY.Sample(theSampler, input.tex).r;
 36.1423 +        yuv.yz = theTextureUV.Sample(theSampler, input.tex).gr;
 36.1424 +
 36.1425 +        yuv += offset;
 36.1426 +        Output.r = dot(yuv, Rcoeff);
 36.1427 +        Output.g = dot(yuv, Gcoeff);
 36.1428 +        Output.b = dot(yuv, Bcoeff);
 36.1429 +        Output.a = 1.0f;
 36.1430 +
 36.1431 +        return Output * input.color;
 36.1432 +    }
 36.1433 +
 36.1434 +*/
 36.1435 +#if defined(D3D11_USE_SHADER_MODEL_4_0_level_9_1)
 36.1436 +static const DWORD D3D11_PixelShader_NV21_BT601[] = {
 36.1437 +    0x43425844, 0x7fc6cfdc, 0xba87a4ff, 0xa72685a6, 0xa051b38c, 0x00000001,
 36.1438 +    0x00000554, 0x00000006, 0x00000038, 0x000001bc, 0x00000354, 0x000003d0,
 36.1439 +    0x000004ac, 0x00000520, 0x396e6f41, 0x0000017c, 0x0000017c, 0xffff0200,
 36.1440 +    0x00000150, 0x0000002c, 0x002c0000, 0x002c0000, 0x002c0000, 0x00240002,
 36.1441 +    0x002c0000, 0x00000000, 0x00010001, 0xffff0200, 0x05000051, 0xa00f0000,
 36.1442 +    0xbd808081, 0xbf008081, 0xbf008081, 0x3f800000, 0x05000051, 0xa00f0001,
 36.1443 +    0x3f950b0f, 0x3fcc49ba, 0x00000000, 0x00000000, 0x05000051, 0xa00f0002,
 36.1444 +    0x3f950b0f, 0xbec89a02, 0xbf5020c5, 0x00000000, 0x05000051, 0xa00f0003,
 36.1445 +    0x3f950b0f, 0x400119ce, 0x00000000, 0x00000000, 0x0200001f, 0x80000000,
 36.1446 +    0xb0030000, 0x0200001f, 0x80000000, 0xb00f0001, 0x0200001f, 0x90000000,
 36.1447 +    0xa00f0800, 0x0200001f, 0x90000000, 0xa00f0801, 0x03000042, 0x800f0000,
 36.1448 +    0xb0e40000, 0xa0e40800, 0x03000042, 0x800f0001, 0xb0e40000, 0xa0e40801,
 36.1449 +    0x02000001, 0x80020000, 0x80550001, 0x02000001, 0x80040000, 0x80000001,
 36.1450 +    0x03000002, 0x80070000, 0x80e40000, 0xa0e40000, 0x03000005, 0x80080000,
 36.1451 +    0x80000000, 0xa0000001, 0x04000004, 0x80010001, 0x80aa0000, 0xa0550001,
 36.1452 +    0x80ff0000, 0x03000008, 0x80020001, 0x80e40000, 0xa0e40002, 0x0400005a,
 36.1453 +    0x80040001, 0x80e40000, 0xa0e40003, 0xa0aa0003, 0x02000001, 0x80080001,
 36.1454 +    0xa0ff0000, 0x03000005, 0x800f0000, 0x80e40001, 0xb0e40001, 0x02000001,
 36.1455 +    0x800f0800, 0x80e40000, 0x0000ffff, 0x52444853, 0x00000190, 0x00000040,
 36.1456 +    0x00000064, 0x0300005a, 0x00106000, 0x00000000, 0x04001858, 0x00107000,
 36.1457 +    0x00000000, 0x00005555, 0x04001858, 0x00107000, 0x00000001, 0x00005555,
 36.1458 +    0x03001062, 0x00101032, 0x00000001, 0x03001062, 0x001010f2, 0x00000002,
 36.1459 +    0x03000065, 0x001020f2, 0x00000000, 0x02000068, 0x00000002, 0x09000045,
 36.1460 +    0x001000f2, 0x00000000, 0x00101046, 0x00000001, 0x00107e46, 0x00000000,
 36.1461 +    0x00106000, 0x00000000, 0x09000045, 0x001000f2, 0x00000001, 0x00101046,
 36.1462 +    0x00000001, 0x00107e46, 0x00000001, 0x00106000, 0x00000000, 0x05000036,
 36.1463 +    0x00100062, 0x00000000, 0x00100456, 0x00000001, 0x0a000000, 0x00100072,
 36.1464 +    0x00000000, 0x00100246, 0x00000000, 0x00004002, 0xbd808081, 0xbf008081,
 36.1465 +    0xbf008081, 0x00000000, 0x0a00000f, 0x00100012, 0x00000001, 0x00100086,
 36.1466 +    0x00000000, 0x00004002, 0x3f950b0f, 0x3fcc49ba, 0x00000000, 0x00000000,
 36.1467 +    0x0a000010, 0x00100022, 0x00000001, 0x00100246, 0x00000000, 0x00004002,
 36.1468 +    0x3f950b0f, 0xbec89a02, 0xbf5020c5, 0x00000000, 0x0a00000f, 0x00100042,
 36.1469 +    0x00000001, 0x00100046, 0x00000000, 0x00004002, 0x3f950b0f, 0x400119ce,
 36.1470 +    0x00000000, 0x00000000, 0x05000036, 0x00100082, 0x00000001, 0x00004001,
 36.1471 +    0x3f800000, 0x07000038, 0x001020f2, 0x00000000, 0x00100e46, 0x00000001,
 36.1472 +    0x00101e46, 0x00000002, 0x0100003e, 0x54415453, 0x00000074, 0x0000000a,
 36.1473 +    0x00000002, 0x00000000, 0x00000003, 0x00000005, 0x00000000, 0x00000000,
 36.1474 +    0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
 36.1475 +    0x00000000, 0x00000002, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
 36.1476 +    0x00000002, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
 36.1477 +    0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x46454452, 0x000000d4,
 36.1478 +    0x00000000, 0x00000000, 0x00000003, 0x0000001c, 0xffff0400, 0x00000100,
 36.1479 +    0x000000a0, 0x0000007c, 0x00000003, 0x00000000, 0x00000000, 0x00000000,
 36.1480 +    0x00000000, 0x00000001, 0x00000001, 0x00000087, 0x00000002, 0x00000005,
 36.1481 +    0x00000004, 0xffffffff, 0x00000000, 0x00000001, 0x0000000d, 0x00000093,
 36.1482 +    0x00000002, 0x00000005, 0x00000004, 0xffffffff, 0x00000001, 0x00000001,
 36.1483 +    0x0000000d, 0x53656874, 0x6c706d61, 0x74007265, 0x65546568, 0x72757478,
 36.1484 +    0x74005965, 0x65546568, 0x72757478, 0x00565565, 0x7263694d, 0x666f736f,
 36.1485 +    0x52282074, 0x4c482029, 0x53204c53, 0x65646168, 0x6f432072, 0x6c69706d,
 36.1486 +    0x36207265, 0x392e332e, 0x2e303036, 0x38333631, 0xabab0034, 0x4e475349,
 36.1487 +    0x0000006c, 0x00000003, 0x00000008, 0x00000050, 0x00000000, 0x00000001,
 36.1488 +    0x00000003, 0x00000000, 0x0000000f, 0x0000005c, 0x00000000, 0x00000000,
 36.1489 +    0x00000003, 0x00000001, 0x00000303, 0x00000065, 0x00000000, 0x00000000,
 36.1490 +    0x00000003, 0x00000002, 0x00000f0f, 0x505f5653, 0x5449534f, 0x004e4f49,
 36.1491 +    0x43584554, 0x44524f4f, 0x4c4f4300, 0xab00524f, 0x4e47534f, 0x0000002c,
 36.1492 +    0x00000001, 0x00000008, 0x00000020, 0x00000000, 0x00000000, 0x00000003,
 36.1493 +    0x00000000, 0x0000000f, 0x545f5653, 0x45475241, 0xabab0054
 36.1494 +};
 36.1495 +#elif defined(D3D11_USE_SHADER_MODEL_4_0_level_9_3)
 36.1496 +static const DWORD D3D11_PixelShader_NV21_BT601[] = {
 36.1497 +    0x43425844, 0x1e92bca4, 0xfeb04e20, 0x3f4226b1, 0xc89c58ad, 0x00000001,
 36.1498 +    0x00000520, 0x00000006, 0x00000038, 0x00000188, 0x00000320, 0x0000039c,
 36.1499 +    0x00000478, 0x000004ec, 0x396e6f41, 0x00000148, 0x00000148, 0xffff0200,
 36.1500 +    0x0000011c, 0x0000002c, 0x002c0000, 0x002c0000, 0x002c0000, 0x00240002,
 36.1501 +    0x002c0000, 0x00000000, 0x00010001, 0xffff0201, 0x05000051, 0xa00f0000,