mirror of https://github.com/encounter/SDL.git
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.
This commit is contained in:
parent
c317ab978f
commit
a6a4e27ae8
12
.hgignore
12
.hgignore
|
@ -70,14 +70,19 @@ test/controllermap
|
|||
test/loopwave
|
||||
test/loopwavequeue
|
||||
test/testatomic
|
||||
test/testaudiocapture
|
||||
test/testaudiohotplug
|
||||
test/testaudioinfo
|
||||
test/testautomation
|
||||
test/testbounds
|
||||
test/testcustomcursor
|
||||
test/testdisplayinfo
|
||||
test/testdraw2
|
||||
test/testdrawchessboard
|
||||
test/testdropfile
|
||||
test/testerror
|
||||
test/testfile
|
||||
test/testfilesystem
|
||||
test/testgamecontroller
|
||||
test/testgesture
|
||||
test/testgl2
|
||||
|
@ -99,7 +104,7 @@ test/testnative
|
|||
test/testoverlay2
|
||||
test/testplatform
|
||||
test/testpower
|
||||
test/testfilesystem
|
||||
test/testqsort
|
||||
test/testrelative
|
||||
test/testrendercopyex
|
||||
test/testrendertarget
|
||||
|
@ -117,11 +122,8 @@ test/testtimer
|
|||
test/testver
|
||||
test/testviewport
|
||||
test/testwm2
|
||||
test/testbounds
|
||||
test/testyuv
|
||||
test/torturethread
|
||||
test/testdisplayinfo
|
||||
test/testqsort
|
||||
test/testaudiocapture
|
||||
test/*.exe
|
||||
test/*.dSYM
|
||||
buildbot
|
||||
|
|
|
@ -45,6 +45,7 @@ LOCAL_SRC_FILES := \
|
|||
$(wildcard $(LOCAL_PATH)/src/timer/unix/*.c) \
|
||||
$(wildcard $(LOCAL_PATH)/src/video/*.c) \
|
||||
$(wildcard $(LOCAL_PATH)/src/video/android/*.c) \
|
||||
$(wildcard $(LOCAL_PATH)/src/video/yuv2rgb/*.c) \
|
||||
$(wildcard $(LOCAL_PATH)/src/test/*.c))
|
||||
|
||||
LOCAL_CFLAGS += -DGL_GLEXT_PROTOTYPES
|
||||
|
|
|
@ -357,6 +357,7 @@ file(GLOB SOURCE_FILES
|
|||
${SDL2_SOURCE_DIR}/src/thread/*.c
|
||||
${SDL2_SOURCE_DIR}/src/timer/*.c
|
||||
${SDL2_SOURCE_DIR}/src/video/*.c)
|
||||
${SDL2_SOURCE_DIR}/src/video/yuv2rgb/*.c)
|
||||
|
||||
|
||||
if(ASSERTIONS STREQUAL "auto")
|
||||
|
|
|
@ -117,7 +117,7 @@
|
|||
<ClInclude Include="..\..\src\joystick\windows\SDL_windowsjoystick_c.h" />
|
||||
<ClInclude Include="..\..\src\joystick\windows\SDL_xinputjoystick_c.h" />
|
||||
<ClInclude Include="..\..\src\render\direct3d11\SDL_render_winrt.h" />
|
||||
<ClInclude Include="..\..\src\render\mmx.h" />
|
||||
<ClInclude Include="..\..\src\render\direct3d11\SDL_shaders_d3d11.h" />
|
||||
<ClInclude Include="..\..\src\render\opengles2\SDL_gles2funcs.h" />
|
||||
<ClInclude Include="..\..\src\render\opengles2\SDL_shaders_gles2.h" />
|
||||
<ClInclude Include="..\..\src\render\SDL_d3dmath.h" />
|
||||
|
@ -155,12 +155,14 @@
|
|||
<ClInclude Include="..\..\src\video\SDL_RLEaccel_c.h" />
|
||||
<ClInclude Include="..\..\src\video\SDL_shape_internals.h" />
|
||||
<ClInclude Include="..\..\src\video\SDL_sysvideo.h" />
|
||||
<ClInclude Include="..\..\src\video\SDL_yuv_c.h" />
|
||||
<ClInclude Include="..\..\src\video\winrt\SDL_winrtevents_c.h" />
|
||||
<ClInclude Include="..\..\src\video\winrt\SDL_winrtgamebar_cpp.h" />
|
||||
<ClInclude Include="..\..\src\video\winrt\SDL_winrtmessagebox.h" />
|
||||
<ClInclude Include="..\..\src\video\winrt\SDL_winrtmouse_c.h" />
|
||||
<ClInclude Include="..\..\src\video\winrt\SDL_winrtopengles.h" />
|
||||
<ClInclude Include="..\..\src\video\winrt\SDL_winrtvideo_cpp.h" />
|
||||
<ClInclude Include="..\..\src\video\yuv2rgb\yuv_rgb.h" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\..\src\atomic\SDL_atomic.c" />
|
||||
|
@ -251,11 +253,11 @@
|
|||
<CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">true</CompileAsWinRT>
|
||||
<CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</CompileAsWinRT>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\render\direct3d11\SDL_shaders_d3d11.c" />
|
||||
<ClCompile Include="..\..\src\render\opengles2\SDL_render_gles2.c" />
|
||||
<ClCompile Include="..\..\src\render\opengles2\SDL_shaders_gles2.c" />
|
||||
<ClCompile Include="..\..\src\render\SDL_d3dmath.c" />
|
||||
<ClCompile Include="..\..\src\render\SDL_render.c" />
|
||||
<ClCompile Include="..\..\src\render\SDL_yuv_mmx.c" />
|
||||
<ClCompile Include="..\..\src\render\SDL_yuv_sw.c" />
|
||||
<ClCompile Include="..\..\src\render\software\SDL_blendfillrect.c" />
|
||||
<ClCompile Include="..\..\src\render\software\SDL_blendline.c" />
|
||||
|
@ -305,6 +307,7 @@
|
|||
<ClCompile Include="..\..\src\video\SDL_stretch.c" />
|
||||
<ClCompile Include="..\..\src\video\SDL_surface.c" />
|
||||
<ClCompile Include="..\..\src\video\SDL_video.c" />
|
||||
<ClCompile Include="..\..\src\video\SDL_yuv.c" />
|
||||
<ClCompile Include="..\..\src\video\winrt\SDL_winrtevents.cpp">
|
||||
<CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</CompileAsWinRT>
|
||||
<CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">true</CompileAsWinRT>
|
||||
|
@ -369,6 +372,7 @@
|
|||
<CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">true</CompileAsWinRT>
|
||||
<CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</CompileAsWinRT>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\video\yuv2rgb\yuv_rgb.c" />
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectGuid>{89e9b32e-a86a-47c3-a948-d2b1622925ce}</ProjectGuid>
|
||||
|
|
|
@ -267,9 +267,6 @@
|
|||
<ClInclude Include="..\..\src\render\direct3d11\SDL_render_winrt.h">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\render\mmx.h">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\render\opengles2\SDL_gles2funcs.h">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClInclude>
|
||||
|
@ -411,6 +408,15 @@
|
|||
<ClInclude Include="..\..\src\haptic\windows\SDL_windowshaptic_c.h">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\video\SDL_yuv_c.h">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\video\yuv2rgb\yuv_rgb.h">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\render\direct3d11\SDL_shaders_d3d11.h">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\..\src\atomic\SDL_atomic.c">
|
||||
|
@ -551,9 +557,6 @@
|
|||
<ClCompile Include="..\..\src\render\SDL_render.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\render\SDL_yuv_mmx.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\render\SDL_yuv_sw.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
|
@ -737,5 +740,14 @@
|
|||
<ClCompile Include="..\..\src\haptic\windows\SDL_xinputhaptic.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\video\SDL_yuv.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\video\yuv2rgb\yuv_rgb.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\render\direct3d11\SDL_shaders_d3d11.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
</Project>
|
|
@ -235,7 +235,7 @@
|
|||
<ClInclude Include="..\..\src\joystick\SDL_sysjoystick.h" />
|
||||
<ClInclude Include="..\..\src\joystick\windows\SDL_xinputjoystick_c.h" />
|
||||
<ClInclude Include="..\..\src\render\direct3d11\SDL_render_winrt.h" />
|
||||
<ClInclude Include="..\..\src\render\mmx.h" />
|
||||
<ClInclude Include="..\..\src\render\direct3d11\SDL_shaders_d3d11.h" />
|
||||
<ClInclude Include="..\..\src\render\opengles2\SDL_gles2funcs.h" />
|
||||
<ClInclude Include="..\..\src\render\opengles2\SDL_shaders_gles2.h" />
|
||||
<ClInclude Include="..\..\src\render\SDL_d3dmath.h" />
|
||||
|
@ -272,12 +272,14 @@
|
|||
<ClInclude Include="..\..\src\video\SDL_RLEaccel_c.h" />
|
||||
<ClInclude Include="..\..\src\video\SDL_shape_internals.h" />
|
||||
<ClInclude Include="..\..\src\video\SDL_sysvideo.h" />
|
||||
<ClInclude Include="..\..\src\video\SDL_yuv_c.h" />
|
||||
<ClInclude Include="..\..\src\video\winrt\SDL_winrtevents_c.h" />
|
||||
<ClInclude Include="..\..\src\video\winrt\SDL_winrtgamebar_cpp.h" />
|
||||
<ClInclude Include="..\..\src\video\winrt\SDL_winrtmessagebox.h" />
|
||||
<ClInclude Include="..\..\src\video\winrt\SDL_winrtmouse_c.h" />
|
||||
<ClInclude Include="..\..\src\video\winrt\SDL_winrtopengles.h" />
|
||||
<ClInclude Include="..\..\src\video\winrt\SDL_winrtvideo_cpp.h" />
|
||||
<ClInclude Include="..\..\src\video\yuv2rgb\yuv_rgb.h" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\..\src\atomic\SDL_atomic.c" />
|
||||
|
@ -350,11 +352,11 @@
|
|||
<CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</CompileAsWinRT>
|
||||
<CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</CompileAsWinRT>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\render\direct3d11\SDL_shaders_d3d11.c" />
|
||||
<ClCompile Include="..\..\src\render\opengles2\SDL_render_gles2.c" />
|
||||
<ClCompile Include="..\..\src\render\opengles2\SDL_shaders_gles2.c" />
|
||||
<ClCompile Include="..\..\src\render\SDL_d3dmath.c" />
|
||||
<ClCompile Include="..\..\src\render\SDL_render.c" />
|
||||
<ClCompile Include="..\..\src\render\SDL_yuv_mmx.c" />
|
||||
<ClCompile Include="..\..\src\render\SDL_yuv_sw.c" />
|
||||
<ClCompile Include="..\..\src\render\software\SDL_blendfillrect.c" />
|
||||
<ClCompile Include="..\..\src\render\software\SDL_blendline.c" />
|
||||
|
@ -404,6 +406,7 @@
|
|||
<ClCompile Include="..\..\src\video\SDL_stretch.c" />
|
||||
<ClCompile Include="..\..\src\video\SDL_surface.c" />
|
||||
<ClCompile Include="..\..\src\video\SDL_video.c" />
|
||||
<ClCompile Include="..\..\src\video\SDL_yuv.c" />
|
||||
<ClCompile Include="..\..\src\video\winrt\SDL_winrtevents.cpp">
|
||||
<CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">true</CompileAsWinRT>
|
||||
<CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">true</CompileAsWinRT>
|
||||
|
@ -452,6 +455,7 @@
|
|||
<CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</CompileAsWinRT>
|
||||
<CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</CompileAsWinRT>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\video\yuv2rgb\yuv_rgb.c" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<Import Project="$(MSBuildExtensionsPath)\Microsoft\WindowsPhone\v$(TargetPlatformVersion)\Microsoft.Cpp.WindowsPhone.$(TargetPlatformVersion).targets" />
|
||||
|
|
|
@ -216,9 +216,6 @@
|
|||
<ClInclude Include="..\..\src\joystick\SDL_sysjoystick.h">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\render\mmx.h">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\render\SDL_sysrender.h">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClInclude>
|
||||
|
@ -375,6 +372,15 @@
|
|||
<ClInclude Include="..\..\src\SDL_dataqueue.h">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\video\SDL_yuv_c.h">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\video\yuv2rgb\yuv_rgb.h">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\render\direct3d11\SDL_shaders_d3d11.h">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\..\src\atomic\SDL_atomic.c">
|
||||
|
@ -467,9 +473,6 @@
|
|||
<ClCompile Include="..\..\src\render\SDL_render.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\render\SDL_yuv_mmx.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\render\SDL_yuv_sw.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
|
@ -683,5 +686,14 @@
|
|||
<ClCompile Include="..\..\src\SDL_dataqueue.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\video\SDL_yuv.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\video\yuv2rgb\yuv_rgb.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\render\direct3d11\SDL_shaders_d3d11.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
</Project>
|
|
@ -101,7 +101,7 @@
|
|||
<ClInclude Include="..\..\src\joystick\SDL_sysjoystick.h" />
|
||||
<ClInclude Include="..\..\src\joystick\windows\SDL_xinputjoystick_c.h" />
|
||||
<ClInclude Include="..\..\src\render\direct3d11\SDL_render_winrt.h" />
|
||||
<ClInclude Include="..\..\src\render\mmx.h" />
|
||||
<ClInclude Include="..\..\src\render\direct3d11\SDL_shaders_d3d11.h" />
|
||||
<ClInclude Include="..\..\src\render\opengles2\SDL_gles2funcs.h" />
|
||||
<ClInclude Include="..\..\src\render\opengles2\SDL_shaders_gles2.h" />
|
||||
<ClInclude Include="..\..\src\render\SDL_d3dmath.h" />
|
||||
|
@ -138,12 +138,14 @@
|
|||
<ClInclude Include="..\..\src\video\SDL_RLEaccel_c.h" />
|
||||
<ClInclude Include="..\..\src\video\SDL_shape_internals.h" />
|
||||
<ClInclude Include="..\..\src\video\SDL_sysvideo.h" />
|
||||
<ClInclude Include="..\..\src\video\SDL_yuv_c.h" />
|
||||
<ClInclude Include="..\..\src\video\winrt\SDL_winrtevents_c.h" />
|
||||
<ClInclude Include="..\..\src\video\winrt\SDL_winrtgamebar_cpp.h" />
|
||||
<ClInclude Include="..\..\src\video\winrt\SDL_winrtmessagebox.h" />
|
||||
<ClInclude Include="..\..\src\video\winrt\SDL_winrtmouse_c.h" />
|
||||
<ClInclude Include="..\..\src\video\winrt\SDL_winrtopengles.h" />
|
||||
<ClInclude Include="..\..\src\video\winrt\SDL_winrtvideo_cpp.h" />
|
||||
<ClInclude Include="..\..\src\video\yuv2rgb\yuv_rgb.h" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\..\src\atomic\SDL_atomic.c" />
|
||||
|
@ -216,11 +218,11 @@
|
|||
<CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</CompileAsWinRT>
|
||||
<CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">true</CompileAsWinRT>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\render\direct3d11\SDL_shaders_d3d11.c" />
|
||||
<ClCompile Include="..\..\src\render\opengles2\SDL_render_gles2.c" />
|
||||
<ClCompile Include="..\..\src\render\opengles2\SDL_shaders_gles2.c" />
|
||||
<ClCompile Include="..\..\src\render\SDL_d3dmath.c" />
|
||||
<ClCompile Include="..\..\src\render\SDL_render.c" />
|
||||
<ClCompile Include="..\..\src\render\SDL_yuv_mmx.c" />
|
||||
<ClCompile Include="..\..\src\render\SDL_yuv_sw.c" />
|
||||
<ClCompile Include="..\..\src\render\software\SDL_blendfillrect.c" />
|
||||
<ClCompile Include="..\..\src\render\software\SDL_blendline.c" />
|
||||
|
@ -271,6 +273,7 @@
|
|||
<ClCompile Include="..\..\src\video\SDL_stretch.c" />
|
||||
<ClCompile Include="..\..\src\video\SDL_surface.c" />
|
||||
<ClCompile Include="..\..\src\video\SDL_video.c" />
|
||||
<ClCompile Include="..\..\src\video\SDL_yuv.c" />
|
||||
<ClCompile Include="..\..\src\video\winrt\SDL_winrtevents.cpp">
|
||||
<CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</CompileAsWinRT>
|
||||
<CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">true</CompileAsWinRT>
|
||||
|
@ -319,6 +322,7 @@
|
|||
<CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</CompileAsWinRT>
|
||||
<CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">true</CompileAsWinRT>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\video\yuv2rgb\yuv_rgb.c" />
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectGuid>{48fadc0e-964d-4dab-bced-372e0ad19577}</ProjectGuid>
|
||||
|
|
|
@ -252,9 +252,6 @@
|
|||
<ClInclude Include="..\..\src\render\direct3d11\SDL_render_winrt.h">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\render\mmx.h">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\render\opengles2\SDL_gles2funcs.h">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClInclude>
|
||||
|
@ -384,6 +381,13 @@
|
|||
<ClInclude Include="..\..\src\SDL_dataqueue.h">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\video\SDL_yuv_c.h">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\video\yuv2rgb\yuv_rgb.h">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\render\direct3d11\SDL_shaders_d3d11.h" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\..\src\atomic\SDL_atomic.c">
|
||||
|
@ -515,9 +519,6 @@
|
|||
<ClCompile Include="..\..\src\render\SDL_render.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\render\SDL_yuv_mmx.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\render\SDL_yuv_sw.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
|
@ -695,5 +696,12 @@
|
|||
<ClCompile Include="..\..\src\SDL_dataqueue.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\video\SDL_yuv.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\video\yuv2rgb\yuv_rgb.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\render\direct3d11\SDL_shaders_d3d11.c" />
|
||||
</ItemGroup>
|
||||
</Project>
|
|
@ -114,11 +114,11 @@
|
|||
<CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</CompileAsWinRT>
|
||||
<CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</CompileAsWinRT>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\render\direct3d11\SDL_shaders_d3d11.c" />
|
||||
<ClCompile Include="..\..\src\render\opengles2\SDL_render_gles2.c" />
|
||||
<ClCompile Include="..\..\src\render\opengles2\SDL_shaders_gles2.c" />
|
||||
<ClCompile Include="..\..\src\render\SDL_d3dmath.c" />
|
||||
<ClCompile Include="..\..\src\render\SDL_render.c" />
|
||||
<ClCompile Include="..\..\src\render\SDL_yuv_mmx.c" />
|
||||
<ClCompile Include="..\..\src\render\SDL_yuv_sw.c" />
|
||||
<ClCompile Include="..\..\src\render\software\SDL_blendfillrect.c" />
|
||||
<ClCompile Include="..\..\src\render\software\SDL_blendline.c" />
|
||||
|
@ -168,6 +168,7 @@
|
|||
<ClCompile Include="..\..\src\video\SDL_stretch.c" />
|
||||
<ClCompile Include="..\..\src\video\SDL_surface.c" />
|
||||
<ClCompile Include="..\..\src\video\SDL_video.c" />
|
||||
<ClCompile Include="..\..\src\video\SDL_yuv.c" />
|
||||
<ClCompile Include="..\..\src\video\winrt\SDL_winrtevents.cpp">
|
||||
<CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">true</CompileAsWinRT>
|
||||
<CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">true</CompileAsWinRT>
|
||||
|
@ -232,6 +233,7 @@
|
|||
<CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</CompileAsWinRT>
|
||||
<CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</CompileAsWinRT>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\video\yuv2rgb\yuv_rgb.c" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\..\include\begin_code.h" />
|
||||
|
@ -323,7 +325,7 @@
|
|||
<ClInclude Include="..\..\src\joystick\windows\SDL_windowsjoystick_c.h" />
|
||||
<ClInclude Include="..\..\src\joystick\windows\SDL_xinputjoystick_c.h" />
|
||||
<ClInclude Include="..\..\src\render\direct3d11\SDL_render_winrt.h" />
|
||||
<ClInclude Include="..\..\src\render\mmx.h" />
|
||||
<ClInclude Include="..\..\src\render\direct3d11\SDL_shaders_d3d11.h" />
|
||||
<ClInclude Include="..\..\src\render\opengles2\SDL_gles2funcs.h" />
|
||||
<ClInclude Include="..\..\src\render\opengles2\SDL_shaders_gles2.h" />
|
||||
<ClInclude Include="..\..\src\render\SDL_d3dmath.h" />
|
||||
|
@ -361,12 +363,14 @@
|
|||
<ClInclude Include="..\..\src\video\SDL_RLEaccel_c.h" />
|
||||
<ClInclude Include="..\..\src\video\SDL_shape_internals.h" />
|
||||
<ClInclude Include="..\..\src\video\SDL_sysvideo.h" />
|
||||
<ClInclude Include="..\..\src\video\SDL_yuv_c.h" />
|
||||
<ClInclude Include="..\..\src\video\winrt\SDL_winrtevents_c.h" />
|
||||
<ClInclude Include="..\..\src\video\winrt\SDL_winrtgamebar_cpp.h" />
|
||||
<ClInclude Include="..\..\src\video\winrt\SDL_winrtmessagebox.h" />
|
||||
<ClInclude Include="..\..\src\video\winrt\SDL_winrtmouse_c.h" />
|
||||
<ClInclude Include="..\..\src\video\winrt\SDL_winrtopengles.h" />
|
||||
<ClInclude Include="..\..\src\video\winrt\SDL_winrtvideo_cpp.h" />
|
||||
<ClInclude Include="..\..\src\video\yuv2rgb\yuv_rgb.h" />
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectGuid>{aeaea3a2-d4e6-45b1-8ec6-53d84287fc14}</ProjectGuid>
|
||||
|
|
|
@ -220,9 +220,6 @@
|
|||
<ClCompile Include="..\..\src\audio\xaudio2\SDL_xaudio2_winrthelpers.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\render\SDL_yuv_mmx.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\render\SDL_yuv_sw.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
|
@ -322,6 +319,15 @@
|
|||
<ClCompile Include="..\..\src\SDL_dataqueue.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\video\SDL_yuv.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\video\yuv2rgb\yuv_rgb.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\render\direct3d11\SDL_shaders_d3d11.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\..\include\begin_code.h">
|
||||
|
@ -444,9 +450,6 @@
|
|||
<ClInclude Include="..\..\src\video\SDL_blit_slow.h">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\render\mmx.h">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\include\SDL_config.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
|
@ -723,6 +726,15 @@
|
|||
<ClInclude Include="..\..\src\SDL_dataqueue.h">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\video\SDL_yuv_c.h">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\video\yuv2rgb\yuv_rgb.h">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\render\direct3d11\SDL_shaders_d3d11.h">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Filter Include="Header Files">
|
||||
|
|
|
@ -116,7 +116,7 @@
|
|||
<ClInclude Include="..\..\src\joystick\windows\SDL_windowsjoystick_c.h" />
|
||||
<ClInclude Include="..\..\src\joystick\windows\SDL_xinputjoystick_c.h" />
|
||||
<ClInclude Include="..\..\src\render\direct3d11\SDL_render_winrt.h" />
|
||||
<ClInclude Include="..\..\src\render\mmx.h" />
|
||||
<ClInclude Include="..\..\src\render\direct3d11\SDL_shaders_d3d11.h" />
|
||||
<ClInclude Include="..\..\src\render\opengles2\SDL_gles2funcs.h" />
|
||||
<ClInclude Include="..\..\src\render\opengles2\SDL_shaders_gles2.h" />
|
||||
<ClInclude Include="..\..\src\render\SDL_d3dmath.h" />
|
||||
|
@ -152,12 +152,14 @@
|
|||
<ClInclude Include="..\..\src\video\SDL_RLEaccel_c.h" />
|
||||
<ClInclude Include="..\..\src\video\SDL_shape_internals.h" />
|
||||
<ClInclude Include="..\..\src\video\SDL_sysvideo.h" />
|
||||
<ClInclude Include="..\..\src\video\SDL_yuv_c.h" />
|
||||
<ClInclude Include="..\..\src\video\winrt\SDL_winrtevents_c.h" />
|
||||
<ClInclude Include="..\..\src\video\winrt\SDL_winrtgamebar_cpp.h" />
|
||||
<ClInclude Include="..\..\src\video\winrt\SDL_winrtmessagebox.h" />
|
||||
<ClInclude Include="..\..\src\video\winrt\SDL_winrtmouse_c.h" />
|
||||
<ClInclude Include="..\..\src\video\winrt\SDL_winrtopengles.h" />
|
||||
<ClInclude Include="..\..\src\video\winrt\SDL_winrtvideo_cpp.h" />
|
||||
<ClInclude Include="..\..\src\video\yuv2rgb\yuv_rgb.h" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\..\src\atomic\SDL_atomic.c" />
|
||||
|
@ -248,11 +250,11 @@
|
|||
<CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">true</CompileAsWinRT>
|
||||
<CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</CompileAsWinRT>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\render\direct3d11\SDL_shaders_d3d11.c" />
|
||||
<ClCompile Include="..\..\src\render\opengles2\SDL_render_gles2.c" />
|
||||
<ClCompile Include="..\..\src\render\opengles2\SDL_shaders_gles2.c" />
|
||||
<ClCompile Include="..\..\src\render\SDL_d3dmath.c" />
|
||||
<ClCompile Include="..\..\src\render\SDL_render.c" />
|
||||
<ClCompile Include="..\..\src\render\SDL_yuv_mmx.c" />
|
||||
<ClCompile Include="..\..\src\render\SDL_yuv_sw.c" />
|
||||
<ClCompile Include="..\..\src\render\software\SDL_blendfillrect.c" />
|
||||
<ClCompile Include="..\..\src\render\software\SDL_blendline.c" />
|
||||
|
@ -303,6 +305,7 @@
|
|||
<ClCompile Include="..\..\src\video\SDL_stretch.c" />
|
||||
<ClCompile Include="..\..\src\video\SDL_surface.c" />
|
||||
<ClCompile Include="..\..\src\video\SDL_video.c" />
|
||||
<ClCompile Include="..\..\src\video\SDL_yuv.c" />
|
||||
<ClCompile Include="..\..\src\video\winrt\SDL_winrtevents.cpp">
|
||||
<CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</CompileAsWinRT>
|
||||
<CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">true</CompileAsWinRT>
|
||||
|
@ -367,6 +370,7 @@
|
|||
<CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">true</CompileAsWinRT>
|
||||
<CompileAsWinRT Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</CompileAsWinRT>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\video\yuv2rgb\yuv_rgb.c" />
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectGuid>{c8df6173-06a1-4f56-a9bc-2002596b30e9}</ProjectGuid>
|
||||
|
|
|
@ -252,9 +252,6 @@
|
|||
<ClInclude Include="..\..\src\render\direct3d11\SDL_render_winrt.h">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\render\mmx.h">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\render\opengles2\SDL_gles2funcs.h">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClInclude>
|
||||
|
@ -384,9 +381,6 @@
|
|||
<ClInclude Include="..\..\src\joystick\windows\SDL_dinputjoystick_c.h">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\haptic\windows\SDL_windowshaptic_c.h" />
|
||||
<ClInclude Include="..\..\src\haptic\windows\SDL_dinputhaptic_c.h" />
|
||||
<ClInclude Include="..\..\src\haptic\windows\SDL_xinputhaptic_c.h" />
|
||||
<ClInclude Include="..\..\src\thread\windows\SDL_systhread_c.h">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClInclude>
|
||||
|
@ -396,6 +390,24 @@
|
|||
<ClInclude Include="..\..\src\SDL_dataqueue.h">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\haptic\windows\SDL_dinputhaptic_c.h">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\haptic\windows\SDL_windowshaptic_c.h">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\haptic\windows\SDL_xinputhaptic_c.h">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\video\SDL_yuv_c.h">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\video\yuv2rgb\yuv_rgb.h">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\render\direct3d11\SDL_shaders_d3d11.h">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\..\src\atomic\SDL_atomic.c">
|
||||
|
@ -527,9 +539,6 @@
|
|||
<ClCompile Include="..\..\src\render\SDL_render.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\render\SDL_yuv_mmx.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\render\SDL_yuv_sw.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
|
@ -695,9 +704,6 @@
|
|||
<ClCompile Include="..\..\src\joystick\windows\SDL_dinputjoystick.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\haptic\windows\SDL_windowshaptic.c" />
|
||||
<ClCompile Include="..\..\src\haptic\windows\SDL_xinputhaptic.c" />
|
||||
<ClCompile Include="..\..\src\haptic\windows\SDL_dinputhaptic.c" />
|
||||
<ClCompile Include="..\..\src\thread\windows\SDL_sysmutex.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
|
@ -719,5 +725,23 @@
|
|||
<ClCompile Include="..\..\src\SDL_dataqueue.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\haptic\windows\SDL_dinputhaptic.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\haptic\windows\SDL_windowshaptic.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\haptic\windows\SDL_xinputhaptic.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\video\SDL_yuv.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\video\yuv2rgb\yuv_rgb.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\render\direct3d11\SDL_shaders_d3d11.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
</Project>
|
|
@ -50,6 +50,8 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "controllermap", "tests\cont
|
|||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "testvulkan", "tests\testvulkan\testvulkan.vcxproj", "{0D604DFD-AAB6-442C-9368-F91A344146AB}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "testyuv", "tests\testyuv\testyuv.vcxproj", "{40FB7794-D3C3-4CFE-BCF4-A80C97635682}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Win32 = Debug|Win32
|
||||
|
@ -250,6 +252,14 @@ Global
|
|||
{0D604DFD-AAB6-442C-9368-F91A344146AB}.Release|Win32.Build.0 = Release|Win32
|
||||
{0D604DFD-AAB6-442C-9368-F91A344146AB}.Release|x64.ActiveCfg = Release|x64
|
||||
{0D604DFD-AAB6-442C-9368-F91A344146AB}.Release|x64.Build.0 = Release|x64
|
||||
{40FB7794-D3C3-4CFE-BCF4-A80C97635682}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{40FB7794-D3C3-4CFE-BCF4-A80C97635682}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{40FB7794-D3C3-4CFE-BCF4-A80C97635682}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{40FB7794-D3C3-4CFE-BCF4-A80C97635682}.Debug|x64.Build.0 = Debug|x64
|
||||
{40FB7794-D3C3-4CFE-BCF4-A80C97635682}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{40FB7794-D3C3-4CFE-BCF4-A80C97635682}.Release|Win32.Build.0 = Release|Win32
|
||||
{40FB7794-D3C3-4CFE-BCF4-A80C97635682}.Release|x64.ActiveCfg = Release|x64
|
||||
{40FB7794-D3C3-4CFE-BCF4-A80C97635682}.Release|x64.Build.0 = Release|x64
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
|
@ -276,5 +286,6 @@ Global
|
|||
{E9558DFE-1961-4DD4-B09B-DD0EEFD5C315} = {D69D5741-611F-4E14-8541-1FEE94F50B5A}
|
||||
{55812185-D13C-4022-9C81-32E0F4A08306} = {D69D5741-611F-4E14-8541-1FEE94F50B5A}
|
||||
{0D604DFD-AAB6-442C-9368-F91A344146AB} = {D69D5741-611F-4E14-8541-1FEE94F50B5A}
|
||||
{40FB7794-D3C3-4CFE-BCF4-A80C97635682} = {D69D5741-611F-4E14-8541-1FEE94F50B5A}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
|
|
|
@ -78,6 +78,7 @@
|
|||
<CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|x64'">AllRules.ruleset</CodeAnalysisRuleSet>
|
||||
<CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|x64'" />
|
||||
<CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|x64'" />
|
||||
<LibraryPath Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">C:\Program Files %28x86%29\Microsoft DirectX SDK %28June 2010%29\Lib\x86;$(LibraryPath)</LibraryPath>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<PreBuildEvent>
|
||||
|
@ -324,7 +325,8 @@
|
|||
<ClInclude Include="..\..\src\joystick\windows\SDL_xinputjoystick_c.h" />
|
||||
<ClInclude Include="..\..\src\libm\math_libm.h" />
|
||||
<ClInclude Include="..\..\src\libm\math_private.h" />
|
||||
<ClInclude Include="..\..\src\render\mmx.h" />
|
||||
<ClInclude Include="..\..\src\render\direct3d11\SDL_shaders_d3d11.h" />
|
||||
<ClInclude Include="..\..\src\render\direct3d\SDL_shaders_d3d.h" />
|
||||
<ClInclude Include="..\..\src\render\opengl\SDL_glfuncs.h" />
|
||||
<ClInclude Include="..\..\src\render\opengl\SDL_shaders_gl.h" />
|
||||
<ClInclude Include="..\..\src\render\opengles\SDL_glesfuncs.h" />
|
||||
|
@ -358,6 +360,7 @@
|
|||
<ClInclude Include="..\..\src\video\SDL_shape_internals.h" />
|
||||
<ClInclude Include="..\..\src\video\SDL_sysvideo.h" />
|
||||
<ClInclude Include="..\..\src\video\SDL_vulkan_internal.h" />
|
||||
<ClInclude Include="..\..\src\video\SDL_yuv_c.h" />
|
||||
<ClInclude Include="..\..\src\video\windows\SDL_vkeys.h" />
|
||||
<ClInclude Include="..\..\src\video\windows\SDL_windowsclipboard.h" />
|
||||
<ClInclude Include="..\..\src\video\windows\SDL_windowsevents.h" />
|
||||
|
@ -372,6 +375,7 @@
|
|||
<ClInclude Include="..\..\src\video\windows\SDL_windowsvulkan.h" />
|
||||
<ClInclude Include="..\..\src\video\windows\SDL_windowswindow.h" />
|
||||
<ClInclude Include="..\..\src\video\windows\wmmsg.h" />
|
||||
<ClInclude Include="..\..\src\video\yuv2rgb\yuv_rgb.h" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\..\src\atomic\SDL_atomic.c" />
|
||||
|
@ -434,15 +438,16 @@
|
|||
<ClCompile Include="..\..\src\loadso\windows\SDL_sysloadso.c" />
|
||||
<ClCompile Include="..\..\src\power\SDL_power.c" />
|
||||
<ClCompile Include="..\..\src\power\windows\SDL_syspower.c" />
|
||||
<ClCompile Include="..\..\src\render\direct3d11\SDL_shaders_d3d11.c" />
|
||||
<ClCompile Include="..\..\src\render\direct3d\SDL_render_d3d.c" />
|
||||
<ClCompile Include="..\..\src\render\direct3d11\SDL_render_d3d11.c" />
|
||||
<ClCompile Include="..\..\src\render\direct3d\SDL_shaders_d3d.c" />
|
||||
<ClCompile Include="..\..\src\render\opengl\SDL_render_gl.c" />
|
||||
<ClCompile Include="..\..\src\render\opengl\SDL_shaders_gl.c" />
|
||||
<ClCompile Include="..\..\src\render\opengles2\SDL_render_gles2.c" />
|
||||
<ClCompile Include="..\..\src\render\opengles2\SDL_shaders_gles2.c" />
|
||||
<ClCompile Include="..\..\src\render\SDL_d3dmath.c" />
|
||||
<ClCompile Include="..\..\src\render\SDL_render.c" />
|
||||
<ClCompile Include="..\..\src\render\SDL_yuv_mmx.c" />
|
||||
<ClCompile Include="..\..\src\render\SDL_yuv_sw.c" />
|
||||
<ClCompile Include="..\..\src\render\software\SDL_blendfillrect.c" />
|
||||
<ClCompile Include="..\..\src\render\software\SDL_blendline.c" />
|
||||
|
@ -494,6 +499,7 @@
|
|||
<ClCompile Include="..\..\src\video\SDL_surface.c" />
|
||||
<ClCompile Include="..\..\src\video\SDL_video.c" />
|
||||
<ClCompile Include="..\..\src\video\SDL_vulkan_utils.c" />
|
||||
<ClCompile Include="..\..\src\video\SDL_yuv.c" />
|
||||
<ClCompile Include="..\..\src\video\windows\SDL_windowsclipboard.c" />
|
||||
<ClCompile Include="..\..\src\video\windows\SDL_windowsevents.c" />
|
||||
<ClCompile Include="..\..\src\video\windows\SDL_windowsframebuffer.c" />
|
||||
|
@ -507,6 +513,7 @@
|
|||
<ClCompile Include="..\..\src\video\windows\SDL_windowsvideo.c" />
|
||||
<ClCompile Include="..\..\src\video\windows\SDL_windowsvulkan.c" />
|
||||
<ClCompile Include="..\..\src\video\windows\SDL_windowswindow.c" />
|
||||
<ClCompile Include="..\..\src\video\yuv2rgb\yuv_rgb.c" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ResourceCompile Include="..\..\src\main\windows\version.rc" />
|
||||
|
|
|
@ -262,7 +262,6 @@
|
|||
<ClInclude Include="..\..\src\joystick\windows\SDL_xinputjoystick_c.h" />
|
||||
<ClInclude Include="..\..\src\libm\math_libm.h" />
|
||||
<ClInclude Include="..\..\src\libm\math_private.h" />
|
||||
<ClInclude Include="..\..\src\render\mmx.h" />
|
||||
<ClInclude Include="..\..\src\render\opengl\SDL_glfuncs.h" />
|
||||
<ClInclude Include="..\..\src\render\opengl\SDL_shaders_gl.h" />
|
||||
<ClInclude Include="..\..\src\render\opengles\SDL_glesfuncs.h" />
|
||||
|
@ -310,6 +309,10 @@
|
|||
<ClInclude Include="..\..\src\video\windows\SDL_windowsvulkan.h" />
|
||||
<ClInclude Include="..\..\src\video\windows\SDL_windowswindow.h" />
|
||||
<ClInclude Include="..\..\src\video\windows\wmmsg.h" />
|
||||
<ClInclude Include="..\..\src\video\SDL_yuv_c.h" />
|
||||
<ClInclude Include="..\..\src\video\yuv2rgb\yuv_rgb.h" />
|
||||
<ClInclude Include="..\..\src\render\direct3d11\SDL_shaders_d3d11.h" />
|
||||
<ClInclude Include="..\..\src\render\direct3d\SDL_shaders_d3d.h" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\..\src\libm\e_atan2.c" />
|
||||
|
@ -439,12 +442,15 @@
|
|||
<ClCompile Include="..\..\src\core\windows\SDL_xinput.c" />
|
||||
<ClCompile Include="..\..\src\haptic\windows\SDL_xinputhaptic.c" />
|
||||
<ClCompile Include="..\..\src\joystick\windows\SDL_xinputjoystick.c" />
|
||||
<ClCompile Include="..\..\src\render\SDL_yuv_mmx.c" />
|
||||
<ClCompile Include="..\..\src\render\SDL_yuv_sw.c" />
|
||||
<ClCompile Include="..\..\src\audio\wasapi\SDL_wasapi.c" />
|
||||
<ClCompile Include="..\..\src\video\SDL_vulkan_utils.c" />
|
||||
<ClCompile Include="..\..\src\video\windows\SDL_windowsvulkan.c" />
|
||||
<ClCompile Include="..\..\src\libm\e_fmod.c" />
|
||||
<ClCompile Include="..\..\src\video\SDL_yuv.c" />
|
||||
<ClCompile Include="..\..\src\video\yuv2rgb\yuv_rgb.c" />
|
||||
<ClCompile Include="..\..\src\render\direct3d11\SDL_shaders_d3d11.c" />
|
||||
<ClCompile Include="..\..\src\render\direct3d\SDL_shaders_d3d.c" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ResourceCompile Include="..\..\src\main\windows\version.rc" />
|
||||
|
|
|
@ -0,0 +1,229 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|Win32">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Debug|x64">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|x64">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectGuid>{40FB7794-D3C3-4CFE-BCF4-A80C97635682}</ProjectGuid>
|
||||
<RootNamespace>testyuv</RootNamespace>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
<Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC70.props" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
<Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC70.props" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
<Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC70.props" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
<Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC70.props" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<PropertyGroup>
|
||||
<_ProjectFileVersion>10.0.40219.1</_ProjectFileVersion>
|
||||
<OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)$(Platform)\$(Configuration)\</OutDir>
|
||||
<IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(Platform)\$(Configuration)\</IntDir>
|
||||
<OutDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(SolutionDir)$(Platform)\$(Configuration)\</OutDir>
|
||||
<IntDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(Platform)\$(Configuration)\</IntDir>
|
||||
<OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)$(Platform)\$(Configuration)\</OutDir>
|
||||
<IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(Platform)\$(Configuration)\</IntDir>
|
||||
<OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(SolutionDir)$(Platform)\$(Configuration)\</OutDir>
|
||||
<IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(Platform)\$(Configuration)\</IntDir>
|
||||
<CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">AllRules.ruleset</CodeAnalysisRuleSet>
|
||||
<CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" />
|
||||
<CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" />
|
||||
<CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">AllRules.ruleset</CodeAnalysisRuleSet>
|
||||
<CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" />
|
||||
<CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" />
|
||||
<CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">AllRules.ruleset</CodeAnalysisRuleSet>
|
||||
<CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" />
|
||||
<CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" />
|
||||
<CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|x64'">AllRules.ruleset</CodeAnalysisRuleSet>
|
||||
<CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|x64'" />
|
||||
<CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|x64'" />
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<Midl>
|
||||
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<MkTypLibCompatible>true</MkTypLibCompatible>
|
||||
<SuppressStartupBanner>true</SuppressStartupBanner>
|
||||
<TargetEnvironment>Win32</TargetEnvironment>
|
||||
<TypeLibraryName>.\Release/testyuv.tlb</TypeLibraryName>
|
||||
</Midl>
|
||||
<ClCompile>
|
||||
<AdditionalIncludeDirectories>$(SolutionDir)/../include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<AdditionalUsingDirectories>%(AdditionalUsingDirectories)</AdditionalUsingDirectories>
|
||||
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
</ClCompile>
|
||||
<ResourceCompile>
|
||||
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<Culture>0x0409</Culture>
|
||||
</ResourceCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<Midl>
|
||||
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<MkTypLibCompatible>true</MkTypLibCompatible>
|
||||
<SuppressStartupBanner>true</SuppressStartupBanner>
|
||||
<TargetEnvironment>X64</TargetEnvironment>
|
||||
<TypeLibraryName>.\Release/testyuv.tlb</TypeLibraryName>
|
||||
</Midl>
|
||||
<ClCompile>
|
||||
<AdditionalIncludeDirectories>$(SolutionDir)/../include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<AdditionalUsingDirectories>%(AdditionalUsingDirectories)</AdditionalUsingDirectories>
|
||||
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
</ClCompile>
|
||||
<ResourceCompile>
|
||||
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<Culture>0x0409</Culture>
|
||||
</ResourceCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<Midl>
|
||||
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<MkTypLibCompatible>true</MkTypLibCompatible>
|
||||
<SuppressStartupBanner>true</SuppressStartupBanner>
|
||||
<TargetEnvironment>Win32</TargetEnvironment>
|
||||
<TypeLibraryName>.\Debug/testyuv.tlb</TypeLibraryName>
|
||||
</Midl>
|
||||
<ClCompile>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<AdditionalIncludeDirectories>$(SolutionDir)/../include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<AdditionalUsingDirectories>%(AdditionalUsingDirectories)</AdditionalUsingDirectories>
|
||||
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<DebugInformationFormat>OldStyle</DebugInformationFormat>
|
||||
</ClCompile>
|
||||
<ResourceCompile>
|
||||
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<Culture>0x0409</Culture>
|
||||
</ResourceCompile>
|
||||
<Link>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<Midl>
|
||||
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<MkTypLibCompatible>true</MkTypLibCompatible>
|
||||
<SuppressStartupBanner>true</SuppressStartupBanner>
|
||||
<TargetEnvironment>X64</TargetEnvironment>
|
||||
<TypeLibraryName>.\Debug/testyuv.tlb</TypeLibraryName>
|
||||
</Midl>
|
||||
<ClCompile>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<AdditionalIncludeDirectories>$(SolutionDir)/../include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<AdditionalUsingDirectories>%(AdditionalUsingDirectories)</AdditionalUsingDirectories>
|
||||
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<DebugInformationFormat>OldStyle</DebugInformationFormat>
|
||||
</ClCompile>
|
||||
<ResourceCompile>
|
||||
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<Culture>0x0409</Culture>
|
||||
</ResourceCompile>
|
||||
<Link>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\SDL\SDL.vcxproj">
|
||||
<Project>{81ce8daf-ebb2-4761-8e45-b71abcca8c68}</Project>
|
||||
<Private>false</Private>
|
||||
<CopyLocalSatelliteAssemblies>false</CopyLocalSatelliteAssemblies>
|
||||
<ReferenceOutputAssembly>true</ReferenceOutputAssembly>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\SDLmain\SDLmain.vcxproj">
|
||||
<Project>{da956fd3-e142-46f2-9dd5-c78bebb56b7a}</Project>
|
||||
<Private>false</Private>
|
||||
<CopyLocalSatelliteAssemblies>false</CopyLocalSatelliteAssemblies>
|
||||
<ReferenceOutputAssembly>true</ReferenceOutputAssembly>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\SDLtest\SDLtest.vcxproj">
|
||||
<Project>{da956fd3-e143-46f2-9fe5-c77bebc56b1a}</Project>
|
||||
<Private>false</Private>
|
||||
<CopyLocalSatelliteAssemblies>false</CopyLocalSatelliteAssemblies>
|
||||
<ReferenceOutputAssembly>true</ReferenceOutputAssembly>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<CustomBuild Include="..\..\..\test\testyuv.bmp">
|
||||
<Message Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Copying %(Filename)%(Extension)</Message>
|
||||
<Command Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">copy %(FullPath) $(ProjectDir)\
|
||||
</Command>
|
||||
<Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(ProjectDir)\%(Filename)%(Extension);%(Outputs)</Outputs>
|
||||
<Message Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Copying %(Filename)%(Extension)</Message>
|
||||
<Command Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">copy %(FullPath) $(ProjectDir)\
|
||||
</Command>
|
||||
<Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(ProjectDir)\%(Filename)%(Extension);%(Outputs)</Outputs>
|
||||
<Message Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Copying %(Filename)%(Extension)</Message>
|
||||
<Command Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">copy %(FullPath) $(ProjectDir)\
|
||||
</Command>
|
||||
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(ProjectDir)\%(Filename)%(Extension);%(Outputs)</Outputs>
|
||||
<Message Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Copying %(Filename)%(Extension)</Message>
|
||||
<Command Condition="'$(Configuration)|$(Platform)'=='Release|x64'">copy %(FullPath) $(ProjectDir)\
|
||||
</Command>
|
||||
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(ProjectDir)\%(Filename)%(Extension);%(Outputs)</Outputs>
|
||||
</CustomBuild>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\..\..\test\testyuv.c" />
|
||||
<ClCompile Include="..\..\..\test\testyuv_cvt.c" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\..\..\test\testyuv_cvt.h" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
|
@ -52,8 +52,6 @@
|
|||
041B2CF212FA0F680087D585 /* SDL_sysrender.h in Headers */ = {isa = PBXBuildFile; fileRef = 041B2CEB12FA0F680087D585 /* SDL_sysrender.h */; };
|
||||
0420497011E6F03D007E7EC9 /* SDL_clipboardevents_c.h in Headers */ = {isa = PBXBuildFile; fileRef = 0420496E11E6F03D007E7EC9 /* SDL_clipboardevents_c.h */; };
|
||||
0420497111E6F03D007E7EC9 /* SDL_clipboardevents.c in Sources */ = {isa = PBXBuildFile; fileRef = 0420496F11E6F03D007E7EC9 /* SDL_clipboardevents.c */; };
|
||||
04409BA612FA989600FB9AA8 /* mmx.h in Headers */ = {isa = PBXBuildFile; fileRef = 04409BA212FA989600FB9AA8 /* mmx.h */; };
|
||||
04409BA712FA989600FB9AA8 /* SDL_yuv_mmx.c in Sources */ = {isa = PBXBuildFile; fileRef = 04409BA312FA989600FB9AA8 /* SDL_yuv_mmx.c */; };
|
||||
04409BA812FA989600FB9AA8 /* SDL_yuv_sw_c.h in Headers */ = {isa = PBXBuildFile; fileRef = 04409BA412FA989600FB9AA8 /* SDL_yuv_sw_c.h */; };
|
||||
04409BA912FA989600FB9AA8 /* SDL_yuv_sw.c in Sources */ = {isa = PBXBuildFile; fileRef = 04409BA512FA989600FB9AA8 /* SDL_yuv_sw.c */; };
|
||||
0442EC5012FE1C1E004C9285 /* SDL_render_sw_c.h in Headers */ = {isa = PBXBuildFile; fileRef = 0442EC4E12FE1C1E004C9285 /* SDL_render_sw_c.h */; };
|
||||
|
@ -119,6 +117,17 @@
|
|||
AA0F8495178D5F1A00823F9D /* SDL_systls.c in Sources */ = {isa = PBXBuildFile; fileRef = AA0F8494178D5F1A00823F9D /* SDL_systls.c */; };
|
||||
AA126AD41617C5E7005ABC8F /* SDL_uikitmodes.h in Headers */ = {isa = PBXBuildFile; fileRef = AA126AD21617C5E6005ABC8F /* SDL_uikitmodes.h */; };
|
||||
AA126AD51617C5E7005ABC8F /* SDL_uikitmodes.m in Sources */ = {isa = PBXBuildFile; fileRef = AA126AD31617C5E6005ABC8F /* SDL_uikitmodes.m */; };
|
||||
AA13B3491FB8B27800D9FEE6 /* SDL_egl_c.h in Headers */ = {isa = PBXBuildFile; fileRef = AA13B3431FB8B27700D9FEE6 /* SDL_egl_c.h */; };
|
||||
AA13B34A1FB8B27800D9FEE6 /* SDL_shape.c in Sources */ = {isa = PBXBuildFile; fileRef = AA13B3441FB8B27800D9FEE6 /* SDL_shape.c */; };
|
||||
AA13B34B1FB8B27800D9FEE6 /* SDL_shape_internals.h in Headers */ = {isa = PBXBuildFile; fileRef = AA13B3451FB8B27800D9FEE6 /* SDL_shape_internals.h */; };
|
||||
AA13B34C1FB8B27800D9FEE6 /* SDL_rect_c.h in Headers */ = {isa = PBXBuildFile; fileRef = AA13B3461FB8B27800D9FEE6 /* SDL_rect_c.h */; };
|
||||
AA13B34D1FB8B27800D9FEE6 /* SDL_egl.c in Sources */ = {isa = PBXBuildFile; fileRef = AA13B3471FB8B27800D9FEE6 /* SDL_egl.c */; };
|
||||
AA13B34E1FB8B27800D9FEE6 /* SDL_yuv_c.h in Headers */ = {isa = PBXBuildFile; fileRef = AA13B3481FB8B27800D9FEE6 /* SDL_yuv_c.h */; };
|
||||
AA13B3501FB8B3CC00D9FEE6 /* SDL_yuv.c in Sources */ = {isa = PBXBuildFile; fileRef = AA13B34F1FB8B3CC00D9FEE6 /* SDL_yuv.c */; };
|
||||
AA13B3571FB8B46400D9FEE6 /* yuv_rgb_std_func.h in Headers */ = {isa = PBXBuildFile; fileRef = AA13B3531FB8B46300D9FEE6 /* yuv_rgb_std_func.h */; };
|
||||
AA13B3581FB8B46400D9FEE6 /* yuv_rgb_sse_func.h in Headers */ = {isa = PBXBuildFile; fileRef = AA13B3541FB8B46300D9FEE6 /* yuv_rgb_sse_func.h */; };
|
||||
AA13B3591FB8B46400D9FEE6 /* yuv_rgb.h in Headers */ = {isa = PBXBuildFile; fileRef = AA13B3551FB8B46300D9FEE6 /* yuv_rgb.h */; };
|
||||
AA13B35A1FB8B46400D9FEE6 /* yuv_rgb.c in Sources */ = {isa = PBXBuildFile; fileRef = AA13B3561FB8B46300D9FEE6 /* yuv_rgb.c */; };
|
||||
AA628ADB159369E3005138DD /* SDL_rotate.c in Sources */ = {isa = PBXBuildFile; fileRef = AA628AD9159369E3005138DD /* SDL_rotate.c */; };
|
||||
AA628ADC159369E3005138DD /* SDL_rotate.h in Headers */ = {isa = PBXBuildFile; fileRef = AA628ADA159369E3005138DD /* SDL_rotate.h */; };
|
||||
AA704DD6162AA90A0076D1C1 /* SDL_dropevents_c.h in Headers */ = {isa = PBXBuildFile; fileRef = AA704DD4162AA90A0076D1C1 /* SDL_dropevents_c.h */; };
|
||||
|
@ -222,7 +231,6 @@
|
|||
FAB598681BB5C31600BE72C5 /* SDL_render_sw.c in Sources */ = {isa = PBXBuildFile; fileRef = 0442EC4F12FE1C1E004C9285 /* SDL_render_sw.c */; };
|
||||
FAB5986A1BB5C31600BE72C5 /* SDL_rotate.c in Sources */ = {isa = PBXBuildFile; fileRef = AA628AD9159369E3005138DD /* SDL_rotate.c */; };
|
||||
FAB5986D1BB5C31600BE72C5 /* SDL_render.c in Sources */ = {isa = PBXBuildFile; fileRef = 041B2CEA12FA0F680087D585 /* SDL_render.c */; };
|
||||
FAB5986F1BB5C31600BE72C5 /* SDL_yuv_mmx.c in Sources */ = {isa = PBXBuildFile; fileRef = 04409BA312FA989600FB9AA8 /* SDL_yuv_mmx.c */; };
|
||||
FAB598711BB5C31600BE72C5 /* SDL_yuv_sw.c in Sources */ = {isa = PBXBuildFile; fileRef = 04409BA512FA989600FB9AA8 /* SDL_yuv_sw.c */; };
|
||||
FAB598721BB5C31600BE72C5 /* SDL_getenv.c in Sources */ = {isa = PBXBuildFile; fileRef = FD3F4A700DEA620800C5B771 /* SDL_getenv.c */; };
|
||||
FAB598731BB5C31600BE72C5 /* SDL_iconv.c in Sources */ = {isa = PBXBuildFile; fileRef = FD3F4A710DEA620800C5B771 /* SDL_iconv.c */; };
|
||||
|
@ -358,8 +366,6 @@
|
|||
041B2CEB12FA0F680087D585 /* SDL_sysrender.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_sysrender.h; sourceTree = "<group>"; };
|
||||
0420496E11E6F03D007E7EC9 /* SDL_clipboardevents_c.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_clipboardevents_c.h; sourceTree = "<group>"; };
|
||||
0420496F11E6F03D007E7EC9 /* SDL_clipboardevents.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_clipboardevents.c; sourceTree = "<group>"; };
|
||||
04409BA212FA989600FB9AA8 /* mmx.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = mmx.h; sourceTree = "<group>"; };
|
||||
04409BA312FA989600FB9AA8 /* SDL_yuv_mmx.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_yuv_mmx.c; sourceTree = "<group>"; };
|
||||
04409BA412FA989600FB9AA8 /* SDL_yuv_sw_c.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_yuv_sw_c.h; sourceTree = "<group>"; };
|
||||
04409BA512FA989600FB9AA8 /* SDL_yuv_sw.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_yuv_sw.c; sourceTree = "<group>"; };
|
||||
0442EC4E12FE1C1E004C9285 /* SDL_render_sw_c.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_render_sw_c.h; sourceTree = "<group>"; };
|
||||
|
@ -424,6 +430,17 @@
|
|||
AA0F8494178D5F1A00823F9D /* SDL_systls.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_systls.c; sourceTree = "<group>"; };
|
||||
AA126AD21617C5E6005ABC8F /* SDL_uikitmodes.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_uikitmodes.h; sourceTree = "<group>"; };
|
||||
AA126AD31617C5E6005ABC8F /* SDL_uikitmodes.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SDL_uikitmodes.m; sourceTree = "<group>"; };
|
||||
AA13B3431FB8B27700D9FEE6 /* SDL_egl_c.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_egl_c.h; sourceTree = "<group>"; };
|
||||
AA13B3441FB8B27800D9FEE6 /* SDL_shape.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_shape.c; sourceTree = "<group>"; };
|
||||
AA13B3451FB8B27800D9FEE6 /* SDL_shape_internals.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_shape_internals.h; sourceTree = "<group>"; };
|
||||
AA13B3461FB8B27800D9FEE6 /* SDL_rect_c.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_rect_c.h; sourceTree = "<group>"; };
|
||||
AA13B3471FB8B27800D9FEE6 /* SDL_egl.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_egl.c; sourceTree = "<group>"; };
|
||||
AA13B3481FB8B27800D9FEE6 /* SDL_yuv_c.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_yuv_c.h; sourceTree = "<group>"; };
|
||||
AA13B34F1FB8B3CC00D9FEE6 /* SDL_yuv.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_yuv.c; sourceTree = "<group>"; };
|
||||
AA13B3531FB8B46300D9FEE6 /* yuv_rgb_std_func.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = yuv_rgb_std_func.h; sourceTree = "<group>"; };
|
||||
AA13B3541FB8B46300D9FEE6 /* yuv_rgb_sse_func.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = yuv_rgb_sse_func.h; sourceTree = "<group>"; };
|
||||
AA13B3551FB8B46300D9FEE6 /* yuv_rgb.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = yuv_rgb.h; sourceTree = "<group>"; };
|
||||
AA13B3561FB8B46300D9FEE6 /* yuv_rgb.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = yuv_rgb.c; sourceTree = "<group>"; };
|
||||
AA628AD9159369E3005138DD /* SDL_rotate.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_rotate.c; sourceTree = "<group>"; };
|
||||
AA628ADA159369E3005138DD /* SDL_rotate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_rotate.h; sourceTree = "<group>"; };
|
||||
AA704DD4162AA90A0076D1C1 /* SDL_dropevents_c.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_dropevents_c.h; sourceTree = "<group>"; };
|
||||
|
@ -608,10 +625,8 @@
|
|||
041B2CE812FA0F680087D585 /* opengles */,
|
||||
0402A85412FE70C600CECEE3 /* opengles2 */,
|
||||
041B2CEC12FA0F680087D585 /* software */,
|
||||
04409BA212FA989600FB9AA8 /* mmx.h */,
|
||||
041B2CEA12FA0F680087D585 /* SDL_render.c */,
|
||||
041B2CEB12FA0F680087D585 /* SDL_sysrender.h */,
|
||||
04409BA312FA989600FB9AA8 /* SDL_yuv_mmx.c */,
|
||||
04409BA412FA989600FB9AA8 /* SDL_yuv_sw_c.h */,
|
||||
04409BA512FA989600FB9AA8 /* SDL_yuv_sw.c */,
|
||||
);
|
||||
|
@ -760,6 +775,17 @@
|
|||
path = steam;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
AA13B3521FB8B41700D9FEE6 /* yuv2rgb */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
AA13B3541FB8B46300D9FEE6 /* yuv_rgb_sse_func.h */,
|
||||
AA13B3531FB8B46300D9FEE6 /* yuv_rgb_std_func.h */,
|
||||
AA13B3561FB8B46300D9FEE6 /* yuv_rgb.c */,
|
||||
AA13B3551FB8B46300D9FEE6 /* yuv_rgb.h */,
|
||||
);
|
||||
path = yuv2rgb;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
FD3F4A6F0DEA620800C5B771 /* stdlib */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
|
@ -1070,10 +1096,9 @@
|
|||
FDA682420DF2374D00F98A1A /* video */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
FD689F090E26E5D900F90B21 /* uikit */,
|
||||
FDA685F40DF244C800F98A1A /* dummy */,
|
||||
FDA683000DF2374E00F98A1A /* SDL_blit.c */,
|
||||
FDA683010DF2374E00F98A1A /* SDL_blit.h */,
|
||||
FD689F090E26E5D900F90B21 /* uikit */,
|
||||
AA13B3521FB8B41700D9FEE6 /* yuv2rgb */,
|
||||
FDA683020DF2374E00F98A1A /* SDL_blit_0.c */,
|
||||
FDA683030DF2374E00F98A1A /* SDL_blit_1.c */,
|
||||
FDA683040DF2374E00F98A1A /* SDL_blit_A.c */,
|
||||
|
@ -1084,20 +1109,29 @@
|
|||
FDA683090DF2374E00F98A1A /* SDL_blit_N.c */,
|
||||
FDA6830A0DF2374E00F98A1A /* SDL_blit_slow.c */,
|
||||
0463873A0F0B5B7D0041FD65 /* SDL_blit_slow.h */,
|
||||
FDA683000DF2374E00F98A1A /* SDL_blit.c */,
|
||||
FDA683010DF2374E00F98A1A /* SDL_blit.h */,
|
||||
FDA6830B0DF2374E00F98A1A /* SDL_bmp.c */,
|
||||
044E5FB711E606EB0076F181 /* SDL_clipboard.c */,
|
||||
AA13B3431FB8B27700D9FEE6 /* SDL_egl_c.h */,
|
||||
AA13B3471FB8B27800D9FEE6 /* SDL_egl.c */,
|
||||
0463873E0F0B5B7D0041FD65 /* SDL_fillrect.c */,
|
||||
FDA6830F0DF2374E00F98A1A /* SDL_pixels.c */,
|
||||
FDA683100DF2374E00F98A1A /* SDL_pixels_c.h */,
|
||||
FDA6830F0DF2374E00F98A1A /* SDL_pixels.c */,
|
||||
AA13B3461FB8B27800D9FEE6 /* SDL_rect_c.h */,
|
||||
FDA683110DF2374E00F98A1A /* SDL_rect.c */,
|
||||
FDA683150DF2374E00F98A1A /* SDL_RLEaccel.c */,
|
||||
FDA683160DF2374E00F98A1A /* SDL_RLEaccel_c.h */,
|
||||
FDA683150DF2374E00F98A1A /* SDL_RLEaccel.c */,
|
||||
AA13B3451FB8B27800D9FEE6 /* SDL_shape_internals.h */,
|
||||
AA13B3441FB8B27800D9FEE6 /* SDL_shape.c */,
|
||||
FDA683170DF2374E00F98A1A /* SDL_stretch.c */,
|
||||
FDA683190DF2374E00F98A1A /* SDL_surface.c */,
|
||||
FDA6831A0DF2374E00F98A1A /* SDL_sysvideo.h */,
|
||||
FDA6831B0DF2374E00F98A1A /* SDL_video.c */,
|
||||
4D75171D1EE1D98200820EEA /* SDL_vulkan_internal.h */,
|
||||
4D75171E1EE1D98200820EEA /* SDL_vulkan_utils.c */,
|
||||
AA13B34F1FB8B3CC00D9FEE6 /* SDL_yuv.c */,
|
||||
AA13B3481FB8B27800D9FEE6 /* SDL_yuv_c.h */,
|
||||
);
|
||||
name = video;
|
||||
path = ../../src/video;
|
||||
|
@ -1144,20 +1178,24 @@
|
|||
56A6703818565E760007D20F /* SDL_dynapi.h in Headers */,
|
||||
FD689FCF0E26E9D400F90B21 /* SDL_uikitappdelegate.h in Headers */,
|
||||
56A6703518565E760007D20F /* SDL_dynapi_overrides.h in Headers */,
|
||||
AA13B3571FB8B46400D9FEE6 /* yuv_rgb_std_func.h in Headers */,
|
||||
047677BD0EA76A31008ABAF1 /* SDL_syshaptic.h in Headers */,
|
||||
046387420F0B5B7D0041FD65 /* SDL_blit_slow.h in Headers */,
|
||||
006E9888119552DD001DE610 /* SDL_rwopsbundlesupport.h in Headers */,
|
||||
0420497011E6F03D007E7EC9 /* SDL_clipboardevents_c.h in Headers */,
|
||||
AA13B34C1FB8B27800D9FEE6 /* SDL_rect_c.h in Headers */,
|
||||
AA13B3581FB8B46400D9FEE6 /* yuv_rgb_sse_func.h in Headers */,
|
||||
04BA9D6311EF474A00B60E01 /* SDL_gesture_c.h in Headers */,
|
||||
04BA9D6511EF474A00B60E01 /* SDL_touch_c.h in Headers */,
|
||||
041B2CF212FA0F680087D585 /* SDL_sysrender.h in Headers */,
|
||||
04409BA612FA989600FB9AA8 /* mmx.h in Headers */,
|
||||
04409BA812FA989600FB9AA8 /* SDL_yuv_sw_c.h in Headers */,
|
||||
AA13B3591FB8B46400D9FEE6 /* yuv_rgb.h in Headers */,
|
||||
04F7807712FB751400FC43C0 /* SDL_blendfillrect.h in Headers */,
|
||||
04F7807912FB751400FC43C0 /* SDL_blendline.h in Headers */,
|
||||
04F7807B12FB751400FC43C0 /* SDL_blendpoint.h in Headers */,
|
||||
04F7807C12FB751400FC43C0 /* SDL_draw.h in Headers */,
|
||||
04F7807E12FB751400FC43C0 /* SDL_drawline.h in Headers */,
|
||||
AA13B34E1FB8B27800D9FEE6 /* SDL_yuv_c.h in Headers */,
|
||||
04F7808012FB751400FC43C0 /* SDL_drawpoint.h in Headers */,
|
||||
04F7808412FB753F00FC43C0 /* SDL_nullframebuffer_c.h in Headers */,
|
||||
A7A9EEAA1F702631002A5589 /* SDL_steamcontroller.h in Headers */,
|
||||
|
@ -1178,6 +1216,7 @@
|
|||
AA75589F1595D55500BBD41B /* SDL_config_iphoneos.h in Headers */,
|
||||
AA7558A01595D55500BBD41B /* SDL_config.h in Headers */,
|
||||
AA7558A11595D55500BBD41B /* SDL_copying.h in Headers */,
|
||||
AA13B3491FB8B27800D9FEE6 /* SDL_egl_c.h in Headers */,
|
||||
AA7558A21595D55500BBD41B /* SDL_cpuinfo.h in Headers */,
|
||||
AA7558A31595D55500BBD41B /* SDL_endian.h in Headers */,
|
||||
AA7558A41595D55500BBD41B /* SDL_error.h in Headers */,
|
||||
|
@ -1188,6 +1227,7 @@
|
|||
AA7558A81595D55500BBD41B /* SDL_hints.h in Headers */,
|
||||
566726461DF72CF5001DD3DB /* SDL_dataqueue.h in Headers */,
|
||||
AA7558AA1595D55500BBD41B /* SDL_joystick.h in Headers */,
|
||||
AA13B34B1FB8B27800D9FEE6 /* SDL_shape_internals.h in Headers */,
|
||||
AA7558AB1595D55500BBD41B /* SDL_keyboard.h in Headers */,
|
||||
AA7558AC1595D55500BBD41B /* SDL_keycode.h in Headers */,
|
||||
AA7558AD1595D55500BBD41B /* SDL_loadso.h in Headers */,
|
||||
|
@ -1407,7 +1447,6 @@
|
|||
FAB598681BB5C31600BE72C5 /* SDL_render_sw.c in Sources */,
|
||||
FAB5986A1BB5C31600BE72C5 /* SDL_rotate.c in Sources */,
|
||||
FAB5986D1BB5C31600BE72C5 /* SDL_render.c in Sources */,
|
||||
FAB5986F1BB5C31600BE72C5 /* SDL_yuv_mmx.c in Sources */,
|
||||
FAB598711BB5C31600BE72C5 /* SDL_yuv_sw.c in Sources */,
|
||||
FAB598721BB5C31600BE72C5 /* SDL_getenv.c in Sources */,
|
||||
FAB598731BB5C31600BE72C5 /* SDL_iconv.c in Sources */,
|
||||
|
@ -1501,6 +1540,7 @@
|
|||
FD3F4A7A0DEA620800C5B771 /* SDL_stdlib.c in Sources */,
|
||||
FDA6844D0DF2374E00F98A1A /* SDL_blit.c in Sources */,
|
||||
FDA6844F0DF2374E00F98A1A /* SDL_blit_0.c in Sources */,
|
||||
AA13B3501FB8B3CC00D9FEE6 /* SDL_yuv.c in Sources */,
|
||||
FDA684500DF2374E00F98A1A /* SDL_blit_1.c in Sources */,
|
||||
566726451DF72CF5001DD3DB /* SDL_dataqueue.c in Sources */,
|
||||
FDA684510DF2374E00F98A1A /* SDL_blit_A.c in Sources */,
|
||||
|
@ -1513,6 +1553,7 @@
|
|||
FDA6845E0DF2374E00F98A1A /* SDL_rect.c in Sources */,
|
||||
FDA684620DF2374E00F98A1A /* SDL_RLEaccel.c in Sources */,
|
||||
FDA684640DF2374E00F98A1A /* SDL_stretch.c in Sources */,
|
||||
AA13B34D1FB8B27800D9FEE6 /* SDL_egl.c in Sources */,
|
||||
FDA684660DF2374E00F98A1A /* SDL_surface.c in Sources */,
|
||||
FDA684680DF2374E00F98A1A /* SDL_video.c in Sources */,
|
||||
FDA685FB0DF244C800F98A1A /* SDL_nullevents.c in Sources */,
|
||||
|
@ -1520,6 +1561,7 @@
|
|||
FD5F9D2F0E0E08B3008E885B /* SDL_joystick.c in Sources */,
|
||||
FD689F030E26E5B600F90B21 /* SDL_sysjoystick.m in Sources */,
|
||||
FD689F1D0E26E5D900F90B21 /* SDL_uikitevents.m in Sources */,
|
||||
AA13B35A1FB8B46400D9FEE6 /* yuv_rgb.c in Sources */,
|
||||
FD689F1F0E26E5D900F90B21 /* SDL_uikitopengles.m in Sources */,
|
||||
FD689F210E26E5D900F90B21 /* SDL_uikitvideo.m in Sources */,
|
||||
FD689F230E26E5D900F90B21 /* SDL_uikitview.m in Sources */,
|
||||
|
@ -1542,7 +1584,6 @@
|
|||
04FFAB8B12E23B8D00BA343D /* SDL_atomic.c in Sources */,
|
||||
04FFAB8C12E23B8D00BA343D /* SDL_spinlock.c in Sources */,
|
||||
041B2CF112FA0F680087D585 /* SDL_render.c in Sources */,
|
||||
04409BA712FA989600FB9AA8 /* SDL_yuv_mmx.c in Sources */,
|
||||
04409BA912FA989600FB9AA8 /* SDL_yuv_sw.c in Sources */,
|
||||
04F7807612FB751400FC43C0 /* SDL_blendfillrect.c in Sources */,
|
||||
04F7807812FB751400FC43C0 /* SDL_blendline.c in Sources */,
|
||||
|
@ -1553,6 +1594,7 @@
|
|||
0442EC5112FE1C1E004C9285 /* SDL_render_sw.c in Sources */,
|
||||
0442EC5312FE1C28004C9285 /* SDL_render_gles.c in Sources */,
|
||||
0442EC5512FE1C3F004C9285 /* SDL_hints.c in Sources */,
|
||||
AA13B34A1FB8B27800D9FEE6 /* SDL_shape.c in Sources */,
|
||||
0402A85812FE70C600CECEE3 /* SDL_render_gles2.c in Sources */,
|
||||
0402A85912FE70C600CECEE3 /* SDL_shaders_gles2.c in Sources */,
|
||||
04BAC09D1300C1290055DE28 /* SDL_log.c in Sources */,
|
||||
|
|
|
@ -318,6 +318,7 @@
|
|||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
EXECUTABLE_PREFIX = lib;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
};
|
||||
name = Debug;
|
||||
|
@ -326,6 +327,7 @@
|
|||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
EXECUTABLE_PREFIX = lib;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
};
|
||||
name = Release;
|
||||
|
|
|
@ -22,7 +22,5 @@
|
|||
<string>????</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>1.0</string>
|
||||
<key>NSMainNibFile</key>
|
||||
<string></string>
|
||||
</dict>
|
||||
</plist>
|
||||
|
|
|
@ -36,6 +36,22 @@
|
|||
56ED0508118A8FE400A56AA6 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FDA8A89D0E2D111A00EA573E /* Foundation.framework */; };
|
||||
56ED0509118A8FE400A56AA6 /* CoreAudio.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FDA8A89E0E2D111A00EA573E /* CoreAudio.framework */; };
|
||||
56ED0511118A904200A56AA6 /* testpower.c in Sources */ = {isa = PBXBuildFile; fileRef = 56ED0510118A904200A56AA6 /* testpower.c */; };
|
||||
AA13B3171FB8AEBC00D9FEE6 /* AVFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FABA34761D8B4EAD00915323 /* AVFoundation.framework */; };
|
||||
AA13B3181FB8AEBC00D9FEE6 /* libSDL2test.a in Frameworks */ = {isa = PBXBuildFile; fileRef = AA1EE452176059230029C7A5 /* libSDL2test.a */; };
|
||||
AA13B3191FB8AEBC00D9FEE6 /* libSDL2.a in Frameworks */ = {isa = PBXBuildFile; fileRef = FD1B48B80E3131CA007AB34E /* libSDL2.a */; };
|
||||
AA13B31A1FB8AEBC00D9FEE6 /* GameController.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA684F7A1BAF1A4400DCFD1A /* GameController.framework */; };
|
||||
AA13B31B1FB8AEBC00D9FEE6 /* CoreMotion.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA8B4BAC1967076F00F8EB7C /* CoreMotion.framework */; };
|
||||
AA13B31C1FB8AEBC00D9FEE6 /* AudioToolbox.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FDA8A8980E2D111A00EA573E /* AudioToolbox.framework */; };
|
||||
AA13B31D1FB8AEBC00D9FEE6 /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FDA8A8990E2D111A00EA573E /* QuartzCore.framework */; };
|
||||
AA13B31E1FB8AEBC00D9FEE6 /* OpenGLES.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FDA8A89A0E2D111A00EA573E /* OpenGLES.framework */; };
|
||||
AA13B31F1FB8AEBC00D9FEE6 /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FDA8A89B0E2D111A00EA573E /* CoreGraphics.framework */; };
|
||||
AA13B3201FB8AEBC00D9FEE6 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FDA8A89C0E2D111A00EA573E /* UIKit.framework */; };
|
||||
AA13B3211FB8AEBC00D9FEE6 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FDA8A89D0E2D111A00EA573E /* Foundation.framework */; };
|
||||
AA13B3221FB8AEBC00D9FEE6 /* CoreAudio.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FDA8A89E0E2D111A00EA573E /* CoreAudio.framework */; };
|
||||
AA13B32F1FB8AF0C00D9FEE6 /* testyuv.bmp in Resources */ = {isa = PBXBuildFile; fileRef = AA13B32E1FB8AF0C00D9FEE6 /* testyuv.bmp */; };
|
||||
AA13B3301FB8AF2300D9FEE6 /* testyuv.bmp in Resources */ = {isa = PBXBuildFile; fileRef = AA13B32E1FB8AF0C00D9FEE6 /* testyuv.bmp */; };
|
||||
AA13B35D1FB8B4E200D9FEE6 /* testyuv.c in Sources */ = {isa = PBXBuildFile; fileRef = AA13B35B1FB8B4D600D9FEE6 /* testyuv.c */; };
|
||||
AA13B3611FB8B52500D9FEE6 /* testyuv_cvt.c in Sources */ = {isa = PBXBuildFile; fileRef = AA13B35E1FB8B50D00D9FEE6 /* testyuv_cvt.c */; };
|
||||
AA1EE470176059D00029C7A5 /* libSDL2test.a in Frameworks */ = {isa = PBXBuildFile; fileRef = AA1EE452176059230029C7A5 /* libSDL2test.a */; };
|
||||
AA1EE47117605A7F0029C7A5 /* libSDL2test.a in Frameworks */ = {isa = PBXBuildFile; fileRef = AA1EE452176059230029C7A5 /* libSDL2test.a */; };
|
||||
AA1EE47417605B5C0029C7A5 /* libSDL2test.a in Frameworks */ = {isa = PBXBuildFile; fileRef = AA1EE452176059230029C7A5 /* libSDL2test.a */; };
|
||||
|
@ -407,6 +423,10 @@
|
|||
1D6058910D05DD3D006BFB54 /* testwm2.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = testwm2.app; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
56ED050D118A8FE400A56AA6 /* testpower.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = testpower.app; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
56ED0510118A904200A56AA6 /* testpower.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = testpower.c; path = ../../test/testpower.c; sourceTree = SOURCE_ROOT; };
|
||||
AA13B3261FB8AEBC00D9FEE6 /* testyuv.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = testyuv.app; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
AA13B32E1FB8AF0C00D9FEE6 /* testyuv.bmp */ = {isa = PBXFileReference; lastKnownFileType = image.bmp; name = testyuv.bmp; path = ../../test/testyuv.bmp; sourceTree = "<group>"; };
|
||||
AA13B35B1FB8B4D600D9FEE6 /* testyuv.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = testyuv.c; path = ../../test/testyuv.c; sourceTree = "<group>"; };
|
||||
AA13B35E1FB8B50D00D9FEE6 /* testyuv_cvt.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = testyuv_cvt.c; path = ../../test/testyuv_cvt.c; sourceTree = "<group>"; };
|
||||
AA1EE44D176059220029C7A5 /* SDL2test.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = SDL2test.xcodeproj; path = ../SDLtest/SDL2test.xcodeproj; sourceTree = "<group>"; };
|
||||
AAE7DEEC14CBB1E100DF1A0E /* testscale.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = testscale.app; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
AAE7DF4514CBB43900DF1A0E /* testscale.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = testscale.c; path = ../../test/testscale.c; sourceTree = "<group>"; };
|
||||
|
@ -552,6 +572,25 @@
|
|||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
AA13B3161FB8AEBC00D9FEE6 /* Frameworks */ = {
|
||||
isa = PBXFrameworksBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
AA13B3171FB8AEBC00D9FEE6 /* AVFoundation.framework in Frameworks */,
|
||||
AA13B3181FB8AEBC00D9FEE6 /* libSDL2test.a in Frameworks */,
|
||||
AA13B3191FB8AEBC00D9FEE6 /* libSDL2.a in Frameworks */,
|
||||
AA13B31A1FB8AEBC00D9FEE6 /* GameController.framework in Frameworks */,
|
||||
AA13B31B1FB8AEBC00D9FEE6 /* CoreMotion.framework in Frameworks */,
|
||||
AA13B31C1FB8AEBC00D9FEE6 /* AudioToolbox.framework in Frameworks */,
|
||||
AA13B31D1FB8AEBC00D9FEE6 /* QuartzCore.framework in Frameworks */,
|
||||
AA13B31E1FB8AEBC00D9FEE6 /* OpenGLES.framework in Frameworks */,
|
||||
AA13B31F1FB8AEBC00D9FEE6 /* CoreGraphics.framework in Frameworks */,
|
||||
AA13B3201FB8AEBC00D9FEE6 /* UIKit.framework in Frameworks */,
|
||||
AA13B3211FB8AEBC00D9FEE6 /* Foundation.framework in Frameworks */,
|
||||
AA13B3221FB8AEBC00D9FEE6 /* CoreAudio.framework in Frameworks */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
AAE7DEE014CBB1E100DF1A0E /* Frameworks */ = {
|
||||
isa = PBXFrameworksBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
|
@ -1003,6 +1042,7 @@
|
|||
FA3D99341BC4E644002C96C8 /* testgamecontroller-TV.app */,
|
||||
FABA34911D8B575200915323 /* testaudiocapture.app */,
|
||||
FABA34AA1D8B582100915323 /* loopwav-TV.app */,
|
||||
AA13B3261FB8AEBC00D9FEE6 /* testyuv.app */,
|
||||
);
|
||||
name = Products;
|
||||
sourceTree = "<group>";
|
||||
|
@ -1051,9 +1091,9 @@
|
|||
FDA8A73B0E2D0F0400EA573E /* src */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
FABA34931D8B578200915323 /* testaudiocapture.c */,
|
||||
047A63F013285CD100CD7973 /* checkkeys.c */,
|
||||
FDA8A78B0E2D0F3D00EA573E /* loopwave.c */,
|
||||
FABA34931D8B578200915323 /* testaudiocapture.c */,
|
||||
FDA8A7410E2D0F1600EA573E /* testaudioinfo.c */,
|
||||
FDC430090F0D86BF009C87E1 /* testdraw2.c */,
|
||||
FDA8A7470E2D0F1600EA573E /* testerror.c */,
|
||||
|
@ -1076,6 +1116,8 @@
|
|||
FDA8A75A0E2D0F1600EA573E /* testtimer.c */,
|
||||
FDA8A75B0E2D0F1600EA573E /* testver.c */,
|
||||
FDA8A75F0E2D0F1600EA573E /* testwm2.c */,
|
||||
AA13B35E1FB8B50D00D9FEE6 /* testyuv_cvt.c */,
|
||||
AA13B35B1FB8B4D600D9FEE6 /* testyuv.c */,
|
||||
FDA8A7610E2D0F1600EA573E /* torturethread.c */,
|
||||
);
|
||||
name = src;
|
||||
|
@ -1103,12 +1145,13 @@
|
|||
FA0EF2281BAF4487000E07A6 /* axis.bmp */,
|
||||
FA0EF2291BAF4487000E07A6 /* button.bmp */,
|
||||
FA0EF22A1BAF4487000E07A6 /* controllermap.bmp */,
|
||||
FDD2C18A0E2E52FE00B7A85F /* utf8.txt */,
|
||||
FDA8AAD90E2D33B000EA573E /* icon.bmp */,
|
||||
FDA8AADA0E2D33BA00EA573E /* moose.dat */,
|
||||
FDA8AADB0E2D33BA00EA573E /* picture.xbm */,
|
||||
FDA8AADE0E2D33C100EA573E /* sample.bmp */,
|
||||
FDA8AAE20E2D33C600EA573E /* sample.wav */,
|
||||
AA13B32E1FB8AF0C00D9FEE6 /* testyuv.bmp */,
|
||||
FDD2C18A0E2E52FE00B7A85F /* utf8.txt */,
|
||||
);
|
||||
name = Resources;
|
||||
sourceTree = "<group>";
|
||||
|
@ -1184,6 +1227,23 @@
|
|||
productReference = 56ED050D118A8FE400A56AA6 /* testpower.app */;
|
||||
productType = "com.apple.product-type.application";
|
||||
};
|
||||
AA13B3111FB8AEBC00D9FEE6 /* testyuv */ = {
|
||||
isa = PBXNativeTarget;
|
||||
buildConfigurationList = AA13B3231FB8AEBC00D9FEE6 /* Build configuration list for PBXNativeTarget "testyuv" */;
|
||||
buildPhases = (
|
||||
AA13B3121FB8AEBC00D9FEE6 /* Resources */,
|
||||
AA13B3141FB8AEBC00D9FEE6 /* Sources */,
|
||||
AA13B3161FB8AEBC00D9FEE6 /* Frameworks */,
|
||||
);
|
||||
buildRules = (
|
||||
);
|
||||
dependencies = (
|
||||
);
|
||||
name = testyuv;
|
||||
productName = Test;
|
||||
productReference = AA13B3261FB8AEBC00D9FEE6 /* testyuv.app */;
|
||||
productType = "com.apple.product-type.application";
|
||||
};
|
||||
AAE7DEDA14CBB1E100DF1A0E /* testscale */ = {
|
||||
isa = PBXNativeTarget;
|
||||
buildConfigurationList = AAE7DEE914CBB1E100DF1A0E /* Build configuration list for PBXNativeTarget "testscale" */;
|
||||
|
@ -1584,6 +1644,9 @@
|
|||
attributes = {
|
||||
LastUpgradeCheck = 0630;
|
||||
TargetAttributes = {
|
||||
AA13B3111FB8AEBC00D9FEE6 = {
|
||||
DevelopmentTeam = EH385AYQ6F;
|
||||
};
|
||||
FA3D99331BC4E644002C96C8 = {
|
||||
CreatedOnToolsVersion = 7.1;
|
||||
};
|
||||
|
@ -1643,6 +1706,7 @@
|
|||
FDD2C5740E2E8C7400B7A85F /* testtimer */,
|
||||
FDD2C5B30E2E8CFC00B7A85F /* testver */,
|
||||
1D6058900D05DD3D006BFB54 /* testwm2 */,
|
||||
AA13B3111FB8AEBC00D9FEE6 /* testyuv */,
|
||||
FDD2C6E20E2E959E00B7A85F /* torturethread */,
|
||||
);
|
||||
};
|
||||
|
@ -1692,6 +1756,7 @@
|
|||
isa = PBXResourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
AA13B32F1FB8AF0C00D9FEE6 /* testyuv.bmp in Resources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
|
@ -1710,6 +1775,14 @@
|
|||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
AA13B3121FB8AEBC00D9FEE6 /* Resources */ = {
|
||||
isa = PBXResourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
AA13B3301FB8AF2300D9FEE6 /* testyuv.bmp in Resources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
AAE7DEDB14CBB1E100DF1A0E /* Resources */ = {
|
||||
isa = PBXResourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
|
@ -1926,6 +1999,15 @@
|
|||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
AA13B3141FB8AEBC00D9FEE6 /* Sources */ = {
|
||||
isa = PBXSourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
AA13B3611FB8B52500D9FEE6 /* testyuv_cvt.c in Sources */,
|
||||
AA13B35D1FB8B4E200D9FEE6 /* testyuv.c in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
AAE7DEDD14CBB1E100DF1A0E /* Sources */ = {
|
||||
isa = PBXSourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
|
@ -2185,6 +2267,24 @@
|
|||
};
|
||||
name = Release;
|
||||
};
|
||||
AA13B3241FB8AEBC00D9FEE6 /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
DEVELOPMENT_TEAM = EH385AYQ6F;
|
||||
INFOPLIST_FILE = Info.plist;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
AA13B3251FB8AEBC00D9FEE6 /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
DEVELOPMENT_TEAM = EH385AYQ6F;
|
||||
INFOPLIST_FILE = Info.plist;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
AAE7DEEA14CBB1E100DF1A0E /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
|
@ -2221,8 +2321,10 @@
|
|||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
|
||||
ENABLE_BITCODE = NO;
|
||||
GCC_OPTIMIZATION_LEVEL = 0;
|
||||
HEADER_SEARCH_PATHS = ../../include;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
|
||||
ONLY_ACTIVE_ARCH = YES;
|
||||
OTHER_LDFLAGS = "-ObjC";
|
||||
"PROVISIONING_PROFILE[sdk=iphoneos*]" = "";
|
||||
|
@ -2235,7 +2337,9 @@
|
|||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
|
||||
ENABLE_BITCODE = NO;
|
||||
HEADER_SEARCH_PATHS = ../../include;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
|
||||
OTHER_LDFLAGS = "-ObjC";
|
||||
"PROVISIONING_PROFILE[sdk=iphoneos*]" = "";
|
||||
SDKROOT = iphoneos;
|
||||
|
@ -2696,6 +2800,15 @@
|
|||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release;
|
||||
};
|
||||
AA13B3231FB8AEBC00D9FEE6 /* Build configuration list for PBXNativeTarget "testyuv" */ = {
|
||||
isa = XCConfigurationList;
|
||||
buildConfigurations = (
|
||||
AA13B3241FB8AEBC00D9FEE6 /* Debug */,
|
||||
AA13B3251FB8AEBC00D9FEE6 /* Release */,
|
||||
);
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release;
|
||||
};
|
||||
AAE7DEE914CBB1E100DF1A0E /* Build configuration list for PBXNativeTarget "testscale" */ = {
|
||||
isa = XCConfigurationList;
|
||||
buildConfigurations = (
|
||||
|
|
|
@ -25,12 +25,8 @@
|
|||
0435673F1303160F00BA5428 /* SDL_shaders_gl.h in Headers */ = {isa = PBXBuildFile; fileRef = 0435673D1303160F00BA5428 /* SDL_shaders_gl.h */; };
|
||||
043567401303160F00BA5428 /* SDL_shaders_gl.c in Sources */ = {isa = PBXBuildFile; fileRef = 0435673C1303160F00BA5428 /* SDL_shaders_gl.c */; };
|
||||
043567411303160F00BA5428 /* SDL_shaders_gl.h in Headers */ = {isa = PBXBuildFile; fileRef = 0435673D1303160F00BA5428 /* SDL_shaders_gl.h */; };
|
||||
04409B9112FA97ED00FB9AA8 /* mmx.h in Headers */ = {isa = PBXBuildFile; fileRef = 04409B8D12FA97ED00FB9AA8 /* mmx.h */; };
|
||||
04409B9212FA97ED00FB9AA8 /* SDL_yuv_mmx.c in Sources */ = {isa = PBXBuildFile; fileRef = 04409B8E12FA97ED00FB9AA8 /* SDL_yuv_mmx.c */; };
|
||||
04409B9312FA97ED00FB9AA8 /* SDL_yuv_sw_c.h in Headers */ = {isa = PBXBuildFile; fileRef = 04409B8F12FA97ED00FB9AA8 /* SDL_yuv_sw_c.h */; };
|
||||
04409B9412FA97ED00FB9AA8 /* SDL_yuv_sw.c in Sources */ = {isa = PBXBuildFile; fileRef = 04409B9012FA97ED00FB9AA8 /* SDL_yuv_sw.c */; };
|
||||
04409B9512FA97ED00FB9AA8 /* mmx.h in Headers */ = {isa = PBXBuildFile; fileRef = 04409B8D12FA97ED00FB9AA8 /* mmx.h */; };
|
||||
04409B9612FA97ED00FB9AA8 /* SDL_yuv_mmx.c in Sources */ = {isa = PBXBuildFile; fileRef = 04409B8E12FA97ED00FB9AA8 /* SDL_yuv_mmx.c */; };
|
||||
04409B9712FA97ED00FB9AA8 /* SDL_yuv_sw_c.h in Headers */ = {isa = PBXBuildFile; fileRef = 04409B8F12FA97ED00FB9AA8 /* SDL_yuv_sw_c.h */; };
|
||||
04409B9812FA97ED00FB9AA8 /* SDL_yuv_sw.c in Sources */ = {isa = PBXBuildFile; fileRef = 04409B9012FA97ED00FB9AA8 /* SDL_yuv_sw.c */; };
|
||||
0442EC1812FE1BBA004C9285 /* SDL_render_gl.c in Sources */ = {isa = PBXBuildFile; fileRef = 0442EC1712FE1BBA004C9285 /* SDL_render_gl.c */; };
|
||||
|
@ -540,6 +536,10 @@
|
|||
AA75585E1595D4D800BBD41B /* SDL.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7557F91595D4D800BBD41B /* SDL.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
AA75585F1595D4D800BBD41B /* SDL.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7557F91595D4D800BBD41B /* SDL.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
AA8167541F5E727800518735 /* SDL_vulkan.h in Headers */ = {isa = PBXBuildFile; fileRef = 4D4820431F0F10B400EDC31C /* SDL_vulkan.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
AA9A7F111FB0206400FED37F /* yuv_rgb.h in Headers */ = {isa = PBXBuildFile; fileRef = AA9A7F0F1FB0206300FED37F /* yuv_rgb.h */; };
|
||||
AA9A7F121FB0206400FED37F /* yuv_rgb.c in Sources */ = {isa = PBXBuildFile; fileRef = AA9A7F101FB0206300FED37F /* yuv_rgb.c */; };
|
||||
AA9A7F151FB0209D00FED37F /* SDL_yuv.c in Sources */ = {isa = PBXBuildFile; fileRef = AA9A7F131FB0209C00FED37F /* SDL_yuv.c */; };
|
||||
AA9A7F161FB0209D00FED37F /* SDL_yuv_c.h in Headers */ = {isa = PBXBuildFile; fileRef = AA9A7F141FB0209C00FED37F /* SDL_yuv_c.h */; };
|
||||
AA9E4093163BE51E007A2AD0 /* SDL_x11messagebox.c in Sources */ = {isa = PBXBuildFile; fileRef = AA9E4092163BE51E007A2AD0 /* SDL_x11messagebox.c */; };
|
||||
AA9E4094163BE51E007A2AD0 /* SDL_x11messagebox.c in Sources */ = {isa = PBXBuildFile; fileRef = AA9E4092163BE51E007A2AD0 /* SDL_x11messagebox.c */; };
|
||||
AA9FF95A1637CBF9000DF050 /* SDL_messagebox.h in Headers */ = {isa = PBXBuildFile; fileRef = AA9FF9591637CBF9000DF050 /* SDL_messagebox.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
|
@ -644,7 +644,6 @@
|
|||
DB313FB617554B71006C0E22 /* SDL_x11video.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFFD412E6671800899322 /* SDL_x11video.h */; };
|
||||
DB313FB717554B71006C0E22 /* SDL_x11window.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFFD612E6671800899322 /* SDL_x11window.h */; };
|
||||
DB313FB817554B71006C0E22 /* SDL_sysrender.h in Headers */ = {isa = PBXBuildFile; fileRef = 041B2C9F12FA0D680087D585 /* SDL_sysrender.h */; };
|
||||
DB313FB917554B71006C0E22 /* mmx.h in Headers */ = {isa = PBXBuildFile; fileRef = 04409B8D12FA97ED00FB9AA8 /* mmx.h */; };
|
||||
DB313FBA17554B71006C0E22 /* SDL_yuv_sw_c.h in Headers */ = {isa = PBXBuildFile; fileRef = 04409B8F12FA97ED00FB9AA8 /* SDL_yuv_sw_c.h */; };
|
||||
DB313FBB17554B71006C0E22 /* SDL_nullframebuffer_c.h in Headers */ = {isa = PBXBuildFile; fileRef = 04F7803712FB748500FC43C0 /* SDL_nullframebuffer_c.h */; };
|
||||
DB313FBC17554B71006C0E22 /* SDL_blendfillrect.h in Headers */ = {isa = PBXBuildFile; fileRef = 04F7803E12FB74A200FC43C0 /* SDL_blendfillrect.h */; };
|
||||
|
@ -801,7 +800,6 @@
|
|||
DB31405617554B71006C0E22 /* SDL_x11video.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFFD312E6671800899322 /* SDL_x11video.c */; };
|
||||
DB31405717554B71006C0E22 /* SDL_x11window.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFFD512E6671800899322 /* SDL_x11window.c */; };
|
||||
DB31405817554B71006C0E22 /* SDL_render.c in Sources */ = {isa = PBXBuildFile; fileRef = 041B2C9E12FA0D680087D585 /* SDL_render.c */; };
|
||||
DB31405917554B71006C0E22 /* SDL_yuv_mmx.c in Sources */ = {isa = PBXBuildFile; fileRef = 04409B8E12FA97ED00FB9AA8 /* SDL_yuv_mmx.c */; };
|
||||
DB31405A17554B71006C0E22 /* SDL_yuv_sw.c in Sources */ = {isa = PBXBuildFile; fileRef = 04409B9012FA97ED00FB9AA8 /* SDL_yuv_sw.c */; };
|
||||
DB31405B17554B71006C0E22 /* SDL_nullframebuffer.c in Sources */ = {isa = PBXBuildFile; fileRef = 04F7803812FB748500FC43C0 /* SDL_nullframebuffer.c */; };
|
||||
DB31405C17554B71006C0E22 /* SDL_blendfillrect.c in Sources */ = {isa = PBXBuildFile; fileRef = 04F7803D12FB74A200FC43C0 /* SDL_blendfillrect.c */; };
|
||||
|
@ -852,8 +850,6 @@
|
|||
041B2C9F12FA0D680087D585 /* SDL_sysrender.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_sysrender.h; sourceTree = "<group>"; };
|
||||
0435673C1303160F00BA5428 /* SDL_shaders_gl.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_shaders_gl.c; sourceTree = "<group>"; };
|
||||
0435673D1303160F00BA5428 /* SDL_shaders_gl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_shaders_gl.h; sourceTree = "<group>"; };
|
||||
04409B8D12FA97ED00FB9AA8 /* mmx.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = mmx.h; sourceTree = "<group>"; };
|
||||
04409B8E12FA97ED00FB9AA8 /* SDL_yuv_mmx.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_yuv_mmx.c; sourceTree = "<group>"; };
|
||||
04409B8F12FA97ED00FB9AA8 /* SDL_yuv_sw_c.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_yuv_sw_c.h; sourceTree = "<group>"; };
|
||||
04409B9012FA97ED00FB9AA8 /* SDL_yuv_sw.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_yuv_sw.c; sourceTree = "<group>"; };
|
||||
0442EC1712FE1BBA004C9285 /* SDL_render_gl.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_render_gl.c; sourceTree = "<group>"; };
|
||||
|
@ -1104,6 +1100,10 @@
|
|||
AA7557F71595D4D800BBD41B /* SDL_version.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_version.h; sourceTree = "<group>"; };
|
||||
AA7557F81595D4D800BBD41B /* SDL_video.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_video.h; sourceTree = "<group>"; };
|
||||
AA7557F91595D4D800BBD41B /* SDL.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL.h; sourceTree = "<group>"; };
|
||||
AA9A7F0F1FB0206300FED37F /* yuv_rgb.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = yuv_rgb.h; sourceTree = "<group>"; };
|
||||
AA9A7F101FB0206300FED37F /* yuv_rgb.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = yuv_rgb.c; sourceTree = "<group>"; };
|
||||
AA9A7F131FB0209C00FED37F /* SDL_yuv.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_yuv.c; sourceTree = "<group>"; };
|
||||
AA9A7F141FB0209C00FED37F /* SDL_yuv_c.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_yuv_c.h; sourceTree = "<group>"; };
|
||||
AA9E4092163BE51E007A2AD0 /* SDL_x11messagebox.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_x11messagebox.c; sourceTree = "<group>"; };
|
||||
AA9FF9591637CBF9000DF050 /* SDL_messagebox.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_messagebox.h; sourceTree = "<group>"; };
|
||||
AABCC38B164063D200AB8930 /* SDL_cocoamessagebox.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_cocoamessagebox.h; sourceTree = "<group>"; };
|
||||
|
@ -1264,10 +1264,8 @@
|
|||
children = (
|
||||
041B2C9A12FA0D680087D585 /* opengl */,
|
||||
041B2CA012FA0D680087D585 /* software */,
|
||||
04409B8D12FA97ED00FB9AA8 /* mmx.h */,
|
||||
041B2C9E12FA0D680087D585 /* SDL_render.c */,
|
||||
041B2C9F12FA0D680087D585 /* SDL_sysrender.h */,
|
||||
04409B8E12FA97ED00FB9AA8 /* SDL_yuv_mmx.c */,
|
||||
04409B8F12FA97ED00FB9AA8 /* SDL_yuv_sw_c.h */,
|
||||
04409B9012FA97ED00FB9AA8 /* SDL_yuv_sw.c */,
|
||||
);
|
||||
|
@ -1568,8 +1566,7 @@
|
|||
04BDFEC112E6671800899322 /* cocoa */,
|
||||
04BDFEE712E6671800899322 /* dummy */,
|
||||
04BDFFB712E6671800899322 /* x11 */,
|
||||
04BDFF4E12E6671800899322 /* SDL_blit.c */,
|
||||
04BDFF4F12E6671800899322 /* SDL_blit.h */,
|
||||
AA9A7F0E1FB0200B00FED37F /* yuv2rgb */,
|
||||
04BDFF5012E6671800899322 /* SDL_blit_0.c */,
|
||||
04BDFF5112E6671800899322 /* SDL_blit_1.c */,
|
||||
04BDFF5212E6671800899322 /* SDL_blit_A.c */,
|
||||
|
@ -1580,22 +1577,26 @@
|
|||
04BDFF5712E6671800899322 /* SDL_blit_N.c */,
|
||||
04BDFF5812E6671800899322 /* SDL_blit_slow.c */,
|
||||
04BDFF5912E6671800899322 /* SDL_blit_slow.h */,
|
||||
04BDFF4E12E6671800899322 /* SDL_blit.c */,
|
||||
04BDFF4F12E6671800899322 /* SDL_blit.h */,
|
||||
04BDFF5A12E6671800899322 /* SDL_bmp.c */,
|
||||
04BDFF5B12E6671800899322 /* SDL_clipboard.c */,
|
||||
04BDFF6012E6671800899322 /* SDL_fillrect.c */,
|
||||
04BDFF6512E6671800899322 /* SDL_pixels.c */,
|
||||
04BDFF6612E6671800899322 /* SDL_pixels_c.h */,
|
||||
04BDFF6512E6671800899322 /* SDL_pixels.c */,
|
||||
04BDFF6712E6671800899322 /* SDL_rect.c */,
|
||||
04BDFF6F12E6671800899322 /* SDL_RLEaccel.c */,
|
||||
04BDFF7012E6671800899322 /* SDL_RLEaccel_c.h */,
|
||||
04BDFF7112E6671800899322 /* SDL_shape.c */,
|
||||
04BDFF6F12E6671800899322 /* SDL_RLEaccel.c */,
|
||||
04BDFF7212E6671800899322 /* SDL_shape_internals.h */,
|
||||
04BDFF7112E6671800899322 /* SDL_shape.c */,
|
||||
04BDFF7312E6671800899322 /* SDL_stretch.c */,
|
||||
04BDFF7412E6671800899322 /* SDL_surface.c */,
|
||||
04BDFF7512E6671800899322 /* SDL_sysvideo.h */,
|
||||
04BDFF7612E6671800899322 /* SDL_video.c */,
|
||||
4D16644C1EDD6023003DE88E /* SDL_vulkan_internal.h */,
|
||||
4D16644D1EDD6023003DE88E /* SDL_vulkan_utils.c */,
|
||||
AA9A7F141FB0209C00FED37F /* SDL_yuv_c.h */,
|
||||
AA9A7F131FB0209C00FED37F /* SDL_yuv.c */,
|
||||
);
|
||||
name = video;
|
||||
path = ../../src/video;
|
||||
|
@ -1763,6 +1764,16 @@
|
|||
name = dynapi;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
AA9A7F0E1FB0200B00FED37F /* yuv2rgb */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
AA9A7F101FB0206300FED37F /* yuv_rgb.c */,
|
||||
AA9A7F0F1FB0206300FED37F /* yuv_rgb.h */,
|
||||
);
|
||||
name = yuv2rgb;
|
||||
path = ../../src/video/yuv2rgb;
|
||||
sourceTree = SOURCE_ROOT;
|
||||
};
|
||||
BEC562FE0761C0E800A33029 /* Linked Frameworks */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
|
@ -1882,6 +1893,7 @@
|
|||
04BD004B12E6671800899322 /* SDL_events_c.h in Headers */,
|
||||
04BD004D12E6671800899322 /* SDL_gesture_c.h in Headers */,
|
||||
04BD004F12E6671800899322 /* SDL_keyboard_c.h in Headers */,
|
||||
AA9A7F111FB0206400FED37F /* yuv_rgb.h in Headers */,
|
||||
04BD005112E6671800899322 /* SDL_mouse_c.h in Headers */,
|
||||
04BD005312E6671800899322 /* SDL_sysevents.h in Headers */,
|
||||
04BD005512E6671800899322 /* SDL_touch_c.h in Headers */,
|
||||
|
@ -1937,7 +1949,7 @@
|
|||
04BD01F712E6671800899322 /* SDL_x11video.h in Headers */,
|
||||
04BD01F912E6671800899322 /* SDL_x11window.h in Headers */,
|
||||
041B2CA612FA0D680087D585 /* SDL_sysrender.h in Headers */,
|
||||
04409B9112FA97ED00FB9AA8 /* mmx.h in Headers */,
|
||||
AA9A7F161FB0209D00FED37F /* SDL_yuv_c.h in Headers */,
|
||||
04409B9312FA97ED00FB9AA8 /* SDL_yuv_sw_c.h in Headers */,
|
||||
04F7803912FB748500FC43C0 /* SDL_nullframebuffer_c.h in Headers */,
|
||||
04F7804A12FB74A200FC43C0 /* SDL_blendfillrect.h in Headers */,
|
||||
|
@ -2094,7 +2106,6 @@
|
|||
AAC07100195606770073DCDF /* SDL_opengles2_gl2ext.h in Headers */,
|
||||
04BD041112E6671800899322 /* SDL_x11window.h in Headers */,
|
||||
041B2CAC12FA0D680087D585 /* SDL_sysrender.h in Headers */,
|
||||
04409B9512FA97ED00FB9AA8 /* mmx.h in Headers */,
|
||||
04409B9712FA97ED00FB9AA8 /* SDL_yuv_sw_c.h in Headers */,
|
||||
04F7803B12FB748500FC43C0 /* SDL_nullframebuffer_c.h in Headers */,
|
||||
04F7805612FB74A200FC43C0 /* SDL_blendfillrect.h in Headers */,
|
||||
|
@ -2249,7 +2260,6 @@
|
|||
AAC07101195606770073DCDF /* SDL_opengles2_gl2ext.h in Headers */,
|
||||
DB313FB717554B71006C0E22 /* SDL_x11window.h in Headers */,
|
||||
DB313FB817554B71006C0E22 /* SDL_sysrender.h in Headers */,
|
||||
DB313FB917554B71006C0E22 /* mmx.h in Headers */,
|
||||
DB313FBA17554B71006C0E22 /* SDL_yuv_sw_c.h in Headers */,
|
||||
DB313FBB17554B71006C0E22 /* SDL_nullframebuffer_c.h in Headers */,
|
||||
DB313FBC17554B71006C0E22 /* SDL_blendfillrect.h in Headers */,
|
||||
|
@ -2475,6 +2485,7 @@
|
|||
04BD00F412E6671800899322 /* SDL_cocoaclipboard.m in Sources */,
|
||||
04BD00F612E6671800899322 /* SDL_cocoaevents.m in Sources */,
|
||||
04BD00F812E6671800899322 /* SDL_cocoakeyboard.m in Sources */,
|
||||
AA9A7F151FB0209D00FED37F /* SDL_yuv.c in Sources */,
|
||||
04BD00FA12E6671800899322 /* SDL_cocoamodes.m in Sources */,
|
||||
4D16644F1EDD6023003DE88E /* SDL_vulkan_utils.c in Sources */,
|
||||
04BD00FC12E6671800899322 /* SDL_cocoamouse.m in Sources */,
|
||||
|
@ -2487,6 +2498,7 @@
|
|||
04BD017512E6671800899322 /* SDL_blit.c in Sources */,
|
||||
04BD017712E6671800899322 /* SDL_blit_0.c in Sources */,
|
||||
04BD017812E6671800899322 /* SDL_blit_1.c in Sources */,
|
||||
AA9A7F121FB0206400FED37F /* yuv_rgb.c in Sources */,
|
||||
04BD017912E6671800899322 /* SDL_blit_A.c in Sources */,
|
||||
04BD017A12E6671800899322 /* SDL_blit_auto.c in Sources */,
|
||||
04BD017C12E6671800899322 /* SDL_blit_copy.c in Sources */,
|
||||
|
@ -2516,7 +2528,6 @@
|
|||
04BD01F612E6671800899322 /* SDL_x11video.c in Sources */,
|
||||
04BD01F812E6671800899322 /* SDL_x11window.c in Sources */,
|
||||
041B2CA512FA0D680087D585 /* SDL_render.c in Sources */,
|
||||
04409B9212FA97ED00FB9AA8 /* SDL_yuv_mmx.c in Sources */,
|
||||
04409B9412FA97ED00FB9AA8 /* SDL_yuv_sw.c in Sources */,
|
||||
04F7803A12FB748500FC43C0 /* SDL_nullframebuffer.c in Sources */,
|
||||
04F7804912FB74A200FC43C0 /* SDL_blendfillrect.c in Sources */,
|
||||
|
@ -2641,7 +2652,6 @@
|
|||
04BD040E12E6671800899322 /* SDL_x11video.c in Sources */,
|
||||
04BD041012E6671800899322 /* SDL_x11window.c in Sources */,
|
||||
041B2CAB12FA0D680087D585 /* SDL_render.c in Sources */,
|
||||
04409B9612FA97ED00FB9AA8 /* SDL_yuv_mmx.c in Sources */,
|
||||
04409B9812FA97ED00FB9AA8 /* SDL_yuv_sw.c in Sources */,
|
||||
04F7803C12FB748500FC43C0 /* SDL_nullframebuffer.c in Sources */,
|
||||
04F7805512FB74A200FC43C0 /* SDL_blendfillrect.c in Sources */,
|
||||
|
@ -2764,7 +2774,6 @@
|
|||
DB31405617554B71006C0E22 /* SDL_x11video.c in Sources */,
|
||||
DB31405717554B71006C0E22 /* SDL_x11window.c in Sources */,
|
||||
DB31405817554B71006C0E22 /* SDL_render.c in Sources */,
|
||||
DB31405917554B71006C0E22 /* SDL_yuv_mmx.c in Sources */,
|
||||
DB31405A17554B71006C0E22 /* SDL_yuv_sw.c in Sources */,
|
||||
DB31405B17554B71006C0E22 /* SDL_nullframebuffer.c in Sources */,
|
||||
DB31405C17554B71006C0E22 /* SDL_blendfillrect.c in Sources */,
|
||||
|
|
|
@ -16874,6 +16874,7 @@ SOURCES="$SOURCES $srcdir/src/stdlib/*.c"
|
|||
SOURCES="$SOURCES $srcdir/src/thread/*.c"
|
||||
SOURCES="$SOURCES $srcdir/src/timer/*.c"
|
||||
SOURCES="$SOURCES $srcdir/src/video/*.c"
|
||||
SOURCES="$SOURCES $srcdir/src/video/yuv2rgb/*.c"
|
||||
|
||||
|
||||
# Check whether --enable-atomic was given.
|
||||
|
|
|
@ -343,6 +343,7 @@ SOURCES="$SOURCES $srcdir/src/stdlib/*.c"
|
|||
SOURCES="$SOURCES $srcdir/src/thread/*.c"
|
||||
SOURCES="$SOURCES $srcdir/src/timer/*.c"
|
||||
SOURCES="$SOURCES $srcdir/src/video/*.c"
|
||||
SOURCES="$SOURCES $srcdir/src/video/yuv2rgb/*.c"
|
||||
|
||||
dnl Enable/disable various subsystems of the SDL library
|
||||
|
||||
|
|
|
@ -97,6 +97,17 @@ typedef struct SDL_Surface
|
|||
typedef int (SDLCALL *SDL_blit) (struct SDL_Surface * src, SDL_Rect * srcrect,
|
||||
struct SDL_Surface * dst, SDL_Rect * dstrect);
|
||||
|
||||
/**
|
||||
* \brief The formula used for converting between YUV and RGB
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
SDL_YUV_CONVERSION_JPEG, /**< Full range JPEG */
|
||||
SDL_YUV_CONVERSION_BT601, /**< BT.601 (the default) */
|
||||
SDL_YUV_CONVERSION_BT709, /**< BT.709 */
|
||||
SDL_YUV_CONVERSION_AUTOMATIC /**< BT.601 for SD content, BT.709 for HD content */
|
||||
} SDL_YUV_CONVERSION_MODE;
|
||||
|
||||
/**
|
||||
* Allocate and free an RGB surface.
|
||||
*
|
||||
|
@ -509,6 +520,20 @@ extern DECLSPEC int SDLCALL SDL_LowerBlitScaled
|
|||
(SDL_Surface * src, SDL_Rect * srcrect,
|
||||
SDL_Surface * dst, SDL_Rect * dstrect);
|
||||
|
||||
/**
|
||||
* \brief Set the YUV conversion mode
|
||||
*/
|
||||
extern DECLSPEC void SDLCALL SDL_SetYUVConversionMode(SDL_YUV_CONVERSION_MODE mode);
|
||||
|
||||
/**
|
||||
* \brief Get the YUV conversion mode
|
||||
*/
|
||||
extern DECLSPEC SDL_YUV_CONVERSION_MODE SDLCALL SDL_GetYUVConversionMode(void);
|
||||
|
||||
/**
|
||||
* \brief Get the YUV conversion mode, returning the correct mode for the resolution when the current conversion mode is SDL_YUV_CONVERSION_AUTOMATIC
|
||||
*/
|
||||
extern DECLSPEC SDL_YUV_CONVERSION_MODE SDLCALL SDL_GetYUVConversionModeForResolution(int width, int height);
|
||||
|
||||
/* Ends C function definitions when using C++ */
|
||||
#ifdef __cplusplus
|
||||
|
|
|
@ -660,3 +660,6 @@
|
|||
#define SDL_scalbnf SDL_scalbnf_REAL
|
||||
#define SDL_fmod SDL_fmod_REAL
|
||||
#define SDL_fmodf SDL_fmodf_REAL
|
||||
#define SDL_SetYUVConversionMode SDL_SetYUVConversionMode_REAL
|
||||
#define SDL_GetYUVConversionMode SDL_GetYUVConversionMode_REAL
|
||||
#define SDL_GetYUVConversionModeForResolution SDL_GetYUVConversionModeForResolution_REAL
|
||||
|
|
|
@ -694,3 +694,6 @@ SDL_DYNAPI_PROC(float,SDL_powf,(float a, float b),(a,b),return)
|
|||
SDL_DYNAPI_PROC(float,SDL_scalbnf,(float a, int b),(a,b),return)
|
||||
SDL_DYNAPI_PROC(double,SDL_fmod,(double a, double b),(a,b),return)
|
||||
SDL_DYNAPI_PROC(float,SDL_fmodf,(float a, float b),(a,b),return)
|
||||
SDL_DYNAPI_PROC(void,SDL_SetYUVConversionMode,(SDL_YUV_CONVERSION_MODE a),(a),)
|
||||
SDL_DYNAPI_PROC(SDL_YUV_CONVERSION_MODE,SDL_GetYUVConversionMode,(void),(),return)
|
||||
SDL_DYNAPI_PROC(SDL_YUV_CONVERSION_MODE,SDL_GetYUVConversionModeForResolution,(int a, int b),(a,b),return)
|
||||
|
|
|
@ -1,409 +0,0 @@
|
|||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2017 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
arising from the use of this software.
|
||||
|
||||
Permission is granted to anyone to use this software for any purpose,
|
||||
including commercial applications, and to alter it and redistribute it
|
||||
freely, subject to the following restrictions:
|
||||
|
||||
1. The origin of this software must not be misrepresented; you must not
|
||||
claim that you wrote the original software. If you use this software
|
||||
in a product, an acknowledgment in the product documentation would be
|
||||
appreciated but is not required.
|
||||
2. Altered source versions must be plainly marked as such, and must not be
|
||||
misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
*/
|
||||
#include "../SDL_internal.h"
|
||||
|
||||
#include "SDL_yuv_mmx_c.h"
|
||||
|
||||
#ifdef USE_MMX_ASSEMBLY
|
||||
|
||||
#include "SDL_stdinc.h"
|
||||
|
||||
#include "mmx.h"
|
||||
|
||||
/* *INDENT-OFF* */
|
||||
|
||||
static mmx_t MMX_0080w = { .ud = {0x00800080, 0x00800080} };
|
||||
static mmx_t MMX_00FFw = { .ud = {0x00ff00ff, 0x00ff00ff} };
|
||||
static mmx_t MMX_FF00w = { .ud = {0xff00ff00, 0xff00ff00} };
|
||||
|
||||
static mmx_t MMX_Ycoeff = { .uw = {0x004a, 0x004a, 0x004a, 0x004a} };
|
||||
|
||||
static mmx_t MMX_UbluRGB = { .uw = {0x0072, 0x0072, 0x0072, 0x0072} };
|
||||
static mmx_t MMX_VredRGB = { .uw = {0x0059, 0x0059, 0x0059, 0x0059} };
|
||||
static mmx_t MMX_UgrnRGB = { .uw = {0xffea, 0xffea, 0xffea, 0xffea} };
|
||||
static mmx_t MMX_VgrnRGB = { .uw = {0xffd2, 0xffd2, 0xffd2, 0xffd2} };
|
||||
|
||||
static mmx_t MMX_Ublu5x5 = { .uw = {0x0081, 0x0081, 0x0081, 0x0081} };
|
||||
static mmx_t MMX_Vred5x5 = { .uw = {0x0066, 0x0066, 0x0066, 0x0066} };
|
||||
static mmx_t MMX_Ugrn565 = { .uw = {0xffe8, 0xffe8, 0xffe8, 0xffe8} };
|
||||
static mmx_t MMX_Vgrn565 = { .uw = {0xffcd, 0xffcd, 0xffcd, 0xffcd} };
|
||||
|
||||
static mmx_t MMX_red565 = { .uw = {0xf800, 0xf800, 0xf800, 0xf800} };
|
||||
static mmx_t MMX_grn565 = { .uw = {0x07e0, 0x07e0, 0x07e0, 0x07e0} };
|
||||
|
||||
/**
|
||||
This MMX assembler is my first assembler/MMX program ever.
|
||||
Thus it maybe buggy.
|
||||
Send patches to:
|
||||
mvogt@rhrk.uni-kl.de
|
||||
|
||||
After it worked fine I have "obfuscated" the code a bit to have
|
||||
more parallism in the MMX units. This means I moved
|
||||
initilisation around and delayed other instruction.
|
||||
Performance measurement did not show that this brought any advantage
|
||||
but in theory it _should_ be faster this way.
|
||||
|
||||
The overall performanve gain to the C based dither was 30%-40%.
|
||||
The MMX routine calculates 256bit=8RGB values in each cycle
|
||||
(4 for row1 & 4 for row2)
|
||||
|
||||
The red/green/blue.. coefficents are taken from the mpeg_play
|
||||
player. They look nice, but I dont know if you can have
|
||||
better values, to avoid integer rounding errors.
|
||||
|
||||
|
||||
IMPORTANT:
|
||||
==========
|
||||
|
||||
It is a requirement that the cr/cb/lum are 8 byte aligned and
|
||||
the out are 16byte aligned or you will/may get segfaults
|
||||
|
||||
*/
|
||||
|
||||
void ColorRGBDitherYV12MMX1X( int *colortab, Uint32 *rgb_2_pix,
|
||||
unsigned char *lum, unsigned char *cr,
|
||||
unsigned char *cb, unsigned char *out,
|
||||
int rows, int cols, int mod )
|
||||
{
|
||||
Uint32 *row1;
|
||||
Uint32 *row2;
|
||||
|
||||
unsigned char* y = lum +cols*rows; /* Pointer to the end */
|
||||
int x = 0;
|
||||
row1 = (Uint32 *)out; /* 32 bit target */
|
||||
row2 = (Uint32 *)out+cols+mod; /* start of second row */
|
||||
mod = (mod+cols+mod)*4; /* increment for row1 in byte */
|
||||
|
||||
__asm__ __volatile__ (
|
||||
".align 8\n"
|
||||
"1:\n"
|
||||
|
||||
/* create Cr (result in mm1) */
|
||||
"movd (%0),%%mm1\n" /* 0 0 0 0 v3 v2 v1 v0 */
|
||||
"pxor %%mm7,%%mm7\n" /* 00 00 00 00 00 00 00 00 */
|
||||
"movd (%2), %%mm2\n" /* 0 0 0 0 l3 l2 l1 l0 */
|
||||
"punpcklbw %%mm7,%%mm1\n" /* 0 v3 0 v2 00 v1 00 v0 */
|
||||
"punpckldq %%mm1,%%mm1\n" /* 00 v1 00 v0 00 v1 00 v0 */
|
||||
"psubw %9,%%mm1\n" /* mm1-128:r1 r1 r0 r0 r1 r1 r0 r0 */
|
||||
|
||||
/* create Cr_g (result in mm0) */
|
||||
"movq %%mm1,%%mm0\n" /* r1 r1 r0 r0 r1 r1 r0 r0 */
|
||||
"pmullw %10,%%mm0\n" /* red*-46dec=0.7136*64 */
|
||||
"pmullw %11,%%mm1\n" /* red*89dec=1.4013*64 */
|
||||
"psraw $6, %%mm0\n" /* red=red/64 */
|
||||
"psraw $6, %%mm1\n" /* red=red/64 */
|
||||
|
||||
/* create L1 L2 (result in mm2,mm4) */
|
||||
/* L2=lum+cols */
|
||||
"movq (%2,%4),%%mm3\n" /* 0 0 0 0 L3 L2 L1 L0 */
|
||||
"punpckldq %%mm3,%%mm2\n" /* L3 L2 L1 L0 l3 l2 l1 l0 */
|
||||
"movq %%mm2,%%mm4\n" /* L3 L2 L1 L0 l3 l2 l1 l0 */
|
||||
"pand %12,%%mm2\n" /* L3 0 L1 0 l3 0 l1 0 */
|
||||
"pand %13,%%mm4\n" /* 0 L2 0 L0 0 l2 0 l0 */
|
||||
"psrlw $8,%%mm2\n" /* 0 L3 0 L1 0 l3 0 l1 */
|
||||
|
||||
/* create R (result in mm6) */
|
||||
"movq %%mm2,%%mm5\n" /* 0 L3 0 L1 0 l3 0 l1 */
|
||||
"movq %%mm4,%%mm6\n" /* 0 L2 0 L0 0 l2 0 l0 */
|
||||
"paddsw %%mm1, %%mm5\n" /* lum1+red:x R3 x R1 x r3 x r1 */
|
||||
"paddsw %%mm1, %%mm6\n" /* lum1+red:x R2 x R0 x r2 x r0 */
|
||||
"packuswb %%mm5,%%mm5\n" /* R3 R1 r3 r1 R3 R1 r3 r1 */
|
||||
"packuswb %%mm6,%%mm6\n" /* R2 R0 r2 r0 R2 R0 r2 r0 */
|
||||
"pxor %%mm7,%%mm7\n" /* 00 00 00 00 00 00 00 00 */
|
||||
"punpcklbw %%mm5,%%mm6\n" /* R3 R2 R1 R0 r3 r2 r1 r0 */
|
||||
|
||||
/* create Cb (result in mm1) */
|
||||
"movd (%1), %%mm1\n" /* 0 0 0 0 u3 u2 u1 u0 */
|
||||
"punpcklbw %%mm7,%%mm1\n" /* 0 u3 0 u2 00 u1 00 u0 */
|
||||
"punpckldq %%mm1,%%mm1\n" /* 00 u1 00 u0 00 u1 00 u0 */
|
||||
"psubw %9,%%mm1\n" /* mm1-128:u1 u1 u0 u0 u1 u1 u0 u0 */
|
||||
|
||||
/* create Cb_g (result in mm5) */
|
||||
"movq %%mm1,%%mm5\n" /* u1 u1 u0 u0 u1 u1 u0 u0 */
|
||||
"pmullw %14,%%mm5\n" /* blue*-109dec=1.7129*64 */
|
||||
"pmullw %15,%%mm1\n" /* blue*114dec=1.78125*64 */
|
||||
"psraw $6, %%mm5\n" /* blue=red/64 */
|
||||
"psraw $6, %%mm1\n" /* blue=blue/64 */
|
||||
|
||||
/* create G (result in mm7) */
|
||||
"movq %%mm2,%%mm3\n" /* 0 L3 0 L1 0 l3 0 l1 */
|
||||
"movq %%mm4,%%mm7\n" /* 0 L2 0 L0 0 l2 0 l1 */
|
||||
"paddsw %%mm5, %%mm3\n" /* lum1+Cb_g:x G3t x G1t x g3t x g1t */
|
||||
"paddsw %%mm5, %%mm7\n" /* lum1+Cb_g:x G2t x G0t x g2t x g0t */
|
||||
"paddsw %%mm0, %%mm3\n" /* lum1+Cr_g:x G3 x G1 x g3 x g1 */
|
||||
"paddsw %%mm0, %%mm7\n" /* lum1+blue:x G2 x G0 x g2 x g0 */
|
||||
"packuswb %%mm3,%%mm3\n" /* G3 G1 g3 g1 G3 G1 g3 g1 */
|
||||
"packuswb %%mm7,%%mm7\n" /* G2 G0 g2 g0 G2 G0 g2 g0 */
|
||||
"punpcklbw %%mm3,%%mm7\n" /* G3 G2 G1 G0 g3 g2 g1 g0 */
|
||||
|
||||
/* create B (result in mm5) */
|
||||
"movq %%mm2,%%mm3\n" /* 0 L3 0 L1 0 l3 0 l1 */
|
||||
"movq %%mm4,%%mm5\n" /* 0 L2 0 L0 0 l2 0 l1 */
|
||||
"paddsw %%mm1, %%mm3\n" /* lum1+blue:x B3 x B1 x b3 x b1 */
|
||||
"paddsw %%mm1, %%mm5\n" /* lum1+blue:x B2 x B0 x b2 x b0 */
|
||||
"packuswb %%mm3,%%mm3\n" /* B3 B1 b3 b1 B3 B1 b3 b1 */
|
||||
"packuswb %%mm5,%%mm5\n" /* B2 B0 b2 b0 B2 B0 b2 b0 */
|
||||
"punpcklbw %%mm3,%%mm5\n" /* B3 B2 B1 B0 b3 b2 b1 b0 */
|
||||
|
||||
/* fill destination row1 (needed are mm6=Rr,mm7=Gg,mm5=Bb) */
|
||||
|
||||
"pxor %%mm2,%%mm2\n" /* 0 0 0 0 0 0 0 0 */
|
||||
"pxor %%mm4,%%mm4\n" /* 0 0 0 0 0 0 0 0 */
|
||||
"movq %%mm6,%%mm1\n" /* R3 R2 R1 R0 r3 r2 r1 r0 */
|
||||
"movq %%mm5,%%mm3\n" /* B3 B2 B1 B0 b3 b2 b1 b0 */
|
||||
|
||||
/* process lower lum */
|
||||
"punpcklbw %%mm4,%%mm1\n" /* 0 r3 0 r2 0 r1 0 r0 */
|
||||
"punpcklbw %%mm4,%%mm3\n" /* 0 b3 0 b2 0 b1 0 b0 */
|
||||
"movq %%mm1,%%mm2\n" /* 0 r3 0 r2 0 r1 0 r0 */
|
||||
"movq %%mm3,%%mm0\n" /* 0 b3 0 b2 0 b1 0 b0 */
|
||||
"punpcklwd %%mm1,%%mm3\n" /* 0 r1 0 b1 0 r0 0 b0 */
|
||||
"punpckhwd %%mm2,%%mm0\n" /* 0 r3 0 b3 0 r2 0 b2 */
|
||||
|
||||
"pxor %%mm2,%%mm2\n" /* 0 0 0 0 0 0 0 0 */
|
||||
"movq %%mm7,%%mm1\n" /* G3 G2 G1 G0 g3 g2 g1 g0 */
|
||||
"punpcklbw %%mm1,%%mm2\n" /* g3 0 g2 0 g1 0 g0 0 */
|
||||
"punpcklwd %%mm4,%%mm2\n" /* 0 0 g1 0 0 0 g0 0 */
|
||||
"por %%mm3, %%mm2\n" /* 0 r1 g1 b1 0 r0 g0 b0 */
|
||||
"movq %%mm2,(%3)\n" /* wrote out ! row1 */
|
||||
|
||||
"pxor %%mm2,%%mm2\n" /* 0 0 0 0 0 0 0 0 */
|
||||
"punpcklbw %%mm1,%%mm4\n" /* g3 0 g2 0 g1 0 g0 0 */
|
||||
"punpckhwd %%mm2,%%mm4\n" /* 0 0 g3 0 0 0 g2 0 */
|
||||
"por %%mm0, %%mm4\n" /* 0 r3 g3 b3 0 r2 g2 b2 */
|
||||
"movq %%mm4,8(%3)\n" /* wrote out ! row1 */
|
||||
|
||||
/* fill destination row2 (needed are mm6=Rr,mm7=Gg,mm5=Bb) */
|
||||
/* this can be done "destructive" */
|
||||
"pxor %%mm2,%%mm2\n" /* 0 0 0 0 0 0 0 0 */
|
||||
"punpckhbw %%mm2,%%mm6\n" /* 0 R3 0 R2 0 R1 0 R0 */
|
||||
"punpckhbw %%mm1,%%mm5\n" /* G3 B3 G2 B2 G1 B1 G0 B0 */
|
||||
"movq %%mm5,%%mm1\n" /* G3 B3 G2 B2 G1 B1 G0 B0 */
|
||||
"punpcklwd %%mm6,%%mm1\n" /* 0 R1 G1 B1 0 R0 G0 B0 */
|
||||
"movq %%mm1,(%5)\n" /* wrote out ! row2 */
|
||||
"punpckhwd %%mm6,%%mm5\n" /* 0 R3 G3 B3 0 R2 G2 B2 */
|
||||
"movq %%mm5,8(%5)\n" /* wrote out ! row2 */
|
||||
|
||||
"addl $4,%2\n" /* lum+4 */
|
||||
"leal 16(%3),%3\n" /* row1+16 */
|
||||
"leal 16(%5),%5\n" /* row2+16 */
|
||||
"addl $2,%0\n" /* cr+2 */
|
||||
"addl $2,%1\n" /* cb+2 */
|
||||
|
||||
"addl $4,%6\n" /* x+4 */
|
||||
"cmpl %4,%6\n"
|
||||
|
||||
"jl 1b\n"
|
||||
"addl %4,%2\n" /* lum += cols */
|
||||
"addl %8,%3\n" /* row1+= mod */
|
||||
"addl %8,%5\n" /* row2+= mod */
|
||||
"movl $0,%6\n" /* x=0 */
|
||||
"cmpl %7,%2\n"
|
||||
"jl 1b\n"
|
||||
|
||||
"emms\n" /* reset MMX registers. */
|
||||
:
|
||||
: "r" (cr), "r"(cb),"r"(lum),
|
||||
"r"(row1),"r"(cols),"r"(row2),"m"(x),"m"(y),"m"(mod),
|
||||
"m"(MMX_0080w),"m"(MMX_VgrnRGB),"m"(MMX_VredRGB),
|
||||
"m"(MMX_FF00w),"m"(MMX_00FFw),"m"(MMX_UgrnRGB),
|
||||
"m"(MMX_UbluRGB)
|
||||
);
|
||||
}
|
||||
|
||||
void Color565DitherYV12MMX1X( int *colortab, Uint32 *rgb_2_pix,
|
||||
unsigned char *lum, unsigned char *cr,
|
||||
unsigned char *cb, unsigned char *out,
|
||||
int rows, int cols, int mod )
|
||||
{
|
||||
Uint16 *row1;
|
||||
Uint16 *row2;
|
||||
|
||||
unsigned char* y = lum +cols*rows; /* Pointer to the end */
|
||||
int x = 0;
|
||||
row1 = (Uint16 *)out; /* 16 bit target */
|
||||
row2 = (Uint16 *)out+cols+mod; /* start of second row */
|
||||
mod = (mod+cols+mod)*2; /* increment for row1 in byte */
|
||||
|
||||
__asm__ __volatile__(
|
||||
".align 8\n"
|
||||
"1:\n"
|
||||
|
||||
"movd (%1), %%mm0\n" /* 4 Cb 0 0 0 0 u3 u2 u1 u0 */
|
||||
"pxor %%mm7, %%mm7\n"
|
||||
"movd (%0), %%mm1\n" /* 4 Cr 0 0 0 0 v3 v2 v1 v0 */
|
||||
|
||||
"punpcklbw %%mm7, %%mm0\n" /* 4 W cb 0 u3 0 u2 0 u1 0 u0 */
|
||||
"punpcklbw %%mm7, %%mm1\n" /* 4 W cr 0 v3 0 v2 0 v1 0 v0 */
|
||||
"psubw %9, %%mm0\n"
|
||||
"psubw %9, %%mm1\n"
|
||||
"movq %%mm0, %%mm2\n" /* Cb 0 u3 0 u2 0 u1 0 u0 */
|
||||
"movq %%mm1, %%mm3\n" /* Cr */
|
||||
"pmullw %10, %%mm2\n" /* Cb2green 0 R3 0 R2 0 R1 0 R0 */
|
||||
"movq (%2), %%mm6\n" /* L1 l7 L6 L5 L4 L3 L2 L1 L0 */
|
||||
"pmullw %11, %%mm0\n" /* Cb2blue */
|
||||
"pand %12, %%mm6\n" /* L1 00 L6 00 L4 00 L2 00 L0 */
|
||||
"pmullw %13, %%mm3\n" /* Cr2green */
|
||||
"movq (%2), %%mm7\n" /* L2 */
|
||||
"pmullw %14, %%mm1\n" /* Cr2red */
|
||||
"psrlw $8, %%mm7\n" /* L2 00 L7 00 L5 00 L3 00 L1 */
|
||||
"pmullw %15, %%mm6\n" /* lum1 */
|
||||
"paddw %%mm3, %%mm2\n" /* Cb2green + Cr2green == green */
|
||||
"pmullw %15, %%mm7\n" /* lum2 */
|
||||
|
||||
"movq %%mm6, %%mm4\n" /* lum1 */
|
||||
"paddw %%mm0, %%mm6\n" /* lum1 +blue 00 B6 00 B4 00 B2 00 B0 */
|
||||
"movq %%mm4, %%mm5\n" /* lum1 */
|
||||
"paddw %%mm1, %%mm4\n" /* lum1 +red 00 R6 00 R4 00 R2 00 R0 */
|
||||
"paddw %%mm2, %%mm5\n" /* lum1 +green 00 G6 00 G4 00 G2 00 G0 */
|
||||
"psraw $6, %%mm4\n" /* R1 0 .. 64 */
|
||||
"movq %%mm7, %%mm3\n" /* lum2 00 L7 00 L5 00 L3 00 L1 */
|
||||
"psraw $6, %%mm5\n" /* G1 - .. + */
|
||||
"paddw %%mm0, %%mm7\n" /* Lum2 +blue 00 B7 00 B5 00 B3 00 B1 */
|
||||
"psraw $6, %%mm6\n" /* B1 0 .. 64 */
|
||||
"packuswb %%mm4, %%mm4\n" /* R1 R1 */
|
||||
"packuswb %%mm5, %%mm5\n" /* G1 G1 */
|
||||
"packuswb %%mm6, %%mm6\n" /* B1 B1 */
|
||||
"punpcklbw %%mm4, %%mm4\n"
|
||||
"punpcklbw %%mm5, %%mm5\n"
|
||||
|
||||
"pand %16, %%mm4\n"
|
||||
"psllw $3, %%mm5\n" /* GREEN 1 */
|
||||
"punpcklbw %%mm6, %%mm6\n"
|
||||
"pand %17, %%mm5\n"
|
||||
"pand %16, %%mm6\n"
|
||||
"por %%mm5, %%mm4\n" /* */
|
||||
"psrlw $11, %%mm6\n" /* BLUE 1 */
|
||||
"movq %%mm3, %%mm5\n" /* lum2 */
|
||||
"paddw %%mm1, %%mm3\n" /* lum2 +red 00 R7 00 R5 00 R3 00 R1 */
|
||||
"paddw %%mm2, %%mm5\n" /* lum2 +green 00 G7 00 G5 00 G3 00 G1 */
|
||||
"psraw $6, %%mm3\n" /* R2 */
|
||||
"por %%mm6, %%mm4\n" /* MM4 */
|
||||
"psraw $6, %%mm5\n" /* G2 */
|
||||
"movq (%2, %4), %%mm6\n" /* L3 load lum2 */
|
||||
"psraw $6, %%mm7\n"
|
||||
"packuswb %%mm3, %%mm3\n"
|
||||
"packuswb %%mm5, %%mm5\n"
|
||||
"packuswb %%mm7, %%mm7\n"
|
||||
"pand %12, %%mm6\n" /* L3 */
|
||||
"punpcklbw %%mm3, %%mm3\n"
|
||||
"punpcklbw %%mm5, %%mm5\n"
|
||||
"pmullw %15, %%mm6\n" /* lum3 */
|
||||
"punpcklbw %%mm7, %%mm7\n"
|
||||
"psllw $3, %%mm5\n" /* GREEN 2 */
|
||||
"pand %16, %%mm7\n"
|
||||
"pand %16, %%mm3\n"
|
||||
"psrlw $11, %%mm7\n" /* BLUE 2 */
|
||||
"pand %17, %%mm5\n"
|
||||
"por %%mm7, %%mm3\n"
|
||||
"movq (%2,%4), %%mm7\n" /* L4 load lum2 */
|
||||
"por %%mm5, %%mm3\n"
|
||||
"psrlw $8, %%mm7\n" /* L4 */
|
||||
"movq %%mm4, %%mm5\n"
|
||||
"punpcklwd %%mm3, %%mm4\n"
|
||||
"pmullw %15, %%mm7\n" /* lum4 */
|
||||
"punpckhwd %%mm3, %%mm5\n"
|
||||
|
||||
"movq %%mm4, (%3)\n" /* write row1 */
|
||||
"movq %%mm5, 8(%3)\n" /* write row1 */
|
||||
|
||||
"movq %%mm6, %%mm4\n" /* Lum3 */
|
||||
"paddw %%mm0, %%mm6\n" /* Lum3 +blue */
|
||||
|
||||
"movq %%mm4, %%mm5\n" /* Lum3 */
|
||||
"paddw %%mm1, %%mm4\n" /* Lum3 +red */
|
||||
"paddw %%mm2, %%mm5\n" /* Lum3 +green */
|
||||
"psraw $6, %%mm4\n"
|
||||
"movq %%mm7, %%mm3\n" /* Lum4 */
|
||||
"psraw $6, %%mm5\n"
|
||||
"paddw %%mm0, %%mm7\n" /* Lum4 +blue */
|
||||
"psraw $6, %%mm6\n" /* Lum3 +blue */
|
||||
"movq %%mm3, %%mm0\n" /* Lum4 */
|
||||
"packuswb %%mm4, %%mm4\n"
|
||||
"paddw %%mm1, %%mm3\n" /* Lum4 +red */
|
||||
"packuswb %%mm5, %%mm5\n"
|
||||
"paddw %%mm2, %%mm0\n" /* Lum4 +green */
|
||||
"packuswb %%mm6, %%mm6\n"
|
||||
"punpcklbw %%mm4, %%mm4\n"
|
||||
"punpcklbw %%mm5, %%mm5\n"
|
||||
"punpcklbw %%mm6, %%mm6\n"
|
||||
"psllw $3, %%mm5\n" /* GREEN 3 */
|
||||
"pand %16, %%mm4\n"
|
||||
"psraw $6, %%mm3\n" /* psr 6 */
|
||||
"psraw $6, %%mm0\n"
|
||||
"pand %16, %%mm6\n" /* BLUE */
|
||||
"pand %17, %%mm5\n"
|
||||
"psrlw $11, %%mm6\n" /* BLUE 3 */
|
||||
"por %%mm5, %%mm4\n"
|
||||
"psraw $6, %%mm7\n"
|
||||
"por %%mm6, %%mm4\n"
|
||||
"packuswb %%mm3, %%mm3\n"
|
||||
"packuswb %%mm0, %%mm0\n"
|
||||
"packuswb %%mm7, %%mm7\n"
|
||||
"punpcklbw %%mm3, %%mm3\n"
|
||||
"punpcklbw %%mm0, %%mm0\n"
|
||||
"punpcklbw %%mm7, %%mm7\n"
|
||||
"pand %16, %%mm3\n"
|
||||
"pand %16, %%mm7\n" /* BLUE */
|
||||
"psllw $3, %%mm0\n" /* GREEN 4 */
|
||||
"psrlw $11, %%mm7\n"
|
||||
"pand %17, %%mm0\n"
|
||||
"por %%mm7, %%mm3\n"
|
||||
"por %%mm0, %%mm3\n"
|
||||
|
||||
"movq %%mm4, %%mm5\n"
|
||||
|
||||
"punpcklwd %%mm3, %%mm4\n"
|
||||
"punpckhwd %%mm3, %%mm5\n"
|
||||
|
||||
"movq %%mm4, (%5)\n"
|
||||
"movq %%mm5, 8(%5)\n"
|
||||
|
||||
"addl $8, %6\n"
|
||||
"addl $8, %2\n"
|
||||
"addl $4, %0\n"
|
||||
"addl $4, %1\n"
|
||||
"cmpl %4, %6\n"
|
||||
"leal 16(%3), %3\n"
|
||||
"leal 16(%5),%5\n" /* row2+16 */
|
||||
|
||||
"jl 1b\n"
|
||||
"addl %4, %2\n" /* lum += cols */
|
||||
"addl %8, %3\n" /* row1+= mod */
|
||||
"addl %8, %5\n" /* row2+= mod */
|
||||
"movl $0, %6\n" /* x=0 */
|
||||
"cmpl %7, %2\n"
|
||||
"jl 1b\n"
|
||||
"emms\n"
|
||||
:
|
||||
: "r" (cr), "r"(cb),"r"(lum),
|
||||
"r"(row1),"r"(cols),"r"(row2),"m"(x),"m"(y),"m"(mod),
|
||||
"m"(MMX_0080w),"m"(MMX_Ugrn565),"m"(MMX_Ublu5x5),
|
||||
"m"(MMX_00FFw),"m"(MMX_Vgrn565),"m"(MMX_Vred5x5),
|
||||
"m"(MMX_Ycoeff),"m"(MMX_red565),"m"(MMX_grn565)
|
||||
);
|
||||
}
|
||||
|
||||
/* *INDENT-ON* */
|
||||
|
||||
#endif /* USE_MMX_ASSEMBLY */
|
||||
|
||||
/* vi: set ts=4 sw=4 expandtab: */
|
File diff suppressed because it is too large
Load Diff
|
@ -30,16 +30,6 @@ struct SDL_SW_YUVTexture
|
|||
Uint32 target_format;
|
||||
int w, h;
|
||||
Uint8 *pixels;
|
||||
int *colortab;
|
||||
Uint32 *rgb_2_pix;
|
||||
void (*Display1X) (int *colortab, Uint32 * rgb_2_pix,
|
||||
unsigned char *lum, unsigned char *cr,
|
||||
unsigned char *cb, unsigned char *out,
|
||||
int rows, int cols, int mod);
|
||||
void (*Display2X) (int *colortab, Uint32 * rgb_2_pix,
|
||||
unsigned char *lum, unsigned char *cr,
|
||||
unsigned char *cb, unsigned char *out,
|
||||
int rows, int cols, int mod);
|
||||
|
||||
/* These are just so we don't have to allocate them separately */
|
||||
Uint16 pitches[3];
|
||||
|
|
|
@ -39,85 +39,7 @@
|
|||
#include <d3d9.h>
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef ASSEMBLE_SHADER
|
||||
#pragma comment(lib, "d3dx9.lib")
|
||||
|
||||
/**************************************************************************
|
||||
* ID3DXBuffer:
|
||||
* ------------
|
||||
* The buffer object is used by D3DX to return arbitrary size data.
|
||||
*
|
||||
* GetBufferPointer -
|
||||
* Returns a pointer to the beginning of the buffer.
|
||||
*
|
||||
* GetBufferSize -
|
||||
* Returns the size of the buffer, in bytes.
|
||||
**************************************************************************/
|
||||
|
||||
typedef interface ID3DXBuffer ID3DXBuffer;
|
||||
typedef interface ID3DXBuffer *LPD3DXBUFFER;
|
||||
|
||||
/* {8BA5FB08-5195-40e2-AC58-0D989C3A0102} */
|
||||
DEFINE_GUID(IID_ID3DXBuffer,
|
||||
0x8ba5fb08, 0x5195, 0x40e2, 0xac, 0x58, 0xd, 0x98, 0x9c, 0x3a, 0x1, 0x2);
|
||||
|
||||
#undef INTERFACE
|
||||
#define INTERFACE ID3DXBuffer
|
||||
|
||||
typedef interface ID3DXBuffer {
|
||||
const struct ID3DXBufferVtbl FAR* lpVtbl;
|
||||
} ID3DXBuffer;
|
||||
typedef const struct ID3DXBufferVtbl ID3DXBufferVtbl;
|
||||
const struct ID3DXBufferVtbl
|
||||
{
|
||||
/* IUnknown */
|
||||
STDMETHOD(QueryInterface)(THIS_ REFIID iid, LPVOID *ppv) PURE;
|
||||
STDMETHOD_(ULONG, AddRef)(THIS) PURE;
|
||||
STDMETHOD_(ULONG, Release)(THIS) PURE;
|
||||
|
||||
/* ID3DXBuffer */
|
||||
STDMETHOD_(LPVOID, GetBufferPointer)(THIS) PURE;
|
||||
STDMETHOD_(DWORD, GetBufferSize)(THIS) PURE;
|
||||
};
|
||||
|
||||
HRESULT WINAPI
|
||||
D3DXAssembleShader(
|
||||
LPCSTR pSrcData,
|
||||
UINT SrcDataLen,
|
||||
CONST LPVOID* pDefines,
|
||||
LPVOID pInclude,
|
||||
DWORD Flags,
|
||||
LPD3DXBUFFER* ppShader,
|
||||
LPD3DXBUFFER* ppErrorMsgs);
|
||||
|
||||
static void PrintShaderData(LPDWORD shader_data, DWORD shader_size)
|
||||
{
|
||||
OutputDebugStringA("const DWORD shader_data[] = {\n\t");
|
||||
{
|
||||
SDL_bool newline = SDL_FALSE;
|
||||
unsigned i;
|
||||
for (i = 0; i < shader_size / sizeof(DWORD); ++i) {
|
||||
char dword[11];
|
||||
if (i > 0) {
|
||||
if ((i%6) == 0) {
|
||||
newline = SDL_TRUE;
|
||||
}
|
||||
if (newline) {
|
||||
OutputDebugStringA(",\n ");
|
||||
newline = SDL_FALSE;
|
||||
} else {
|
||||
OutputDebugStringA(", ");
|
||||
}
|
||||
}
|
||||
SDL_snprintf(dword, sizeof(dword), "0x%8.8x", shader_data[i]);
|
||||
OutputDebugStringA(dword);
|
||||
}
|
||||
OutputDebugStringA("\n};\n");
|
||||
}
|
||||
}
|
||||
|
||||
#endif /* ASSEMBLE_SHADER */
|
||||
#include "SDL_shaders_d3d.h"
|
||||
|
||||
|
||||
/* Direct3D renderer implementation */
|
||||
|
@ -188,7 +110,7 @@ typedef struct
|
|||
IDirect3DSurface9 *defaultRenderTarget;
|
||||
IDirect3DSurface9 *currentRenderTarget;
|
||||
void* d3dxDLL;
|
||||
LPDIRECT3DPIXELSHADER9 ps_yuv;
|
||||
LPDIRECT3DPIXELSHADER9 shaders[NUM_SHADERS];
|
||||
} D3D_RenderData;
|
||||
|
||||
typedef struct
|
||||
|
@ -197,6 +119,7 @@ typedef struct
|
|||
int w, h;
|
||||
DWORD usage;
|
||||
Uint32 format;
|
||||
D3DFORMAT d3dfmt;
|
||||
IDirect3DTexture9 *texture;
|
||||
IDirect3DTexture9 *staging;
|
||||
} D3D_TextureRep;
|
||||
|
@ -313,6 +236,8 @@ PixelFormatToD3DFMT(Uint32 format)
|
|||
return D3DFMT_A8R8G8B8;
|
||||
case SDL_PIXELFORMAT_YV12:
|
||||
case SDL_PIXELFORMAT_IYUV:
|
||||
case SDL_PIXELFORMAT_NV12:
|
||||
case SDL_PIXELFORMAT_NV21:
|
||||
return D3DFMT_L8;
|
||||
default:
|
||||
return D3DFMT_UNKNOWN;
|
||||
|
@ -661,137 +586,19 @@ D3D_CreateRenderer(SDL_Window * window, Uint32 flags)
|
|||
/* Set up parameters for rendering */
|
||||
D3D_InitRenderState(data);
|
||||
|
||||
if (caps.MaxSimultaneousTextures >= 3)
|
||||
{
|
||||
#ifdef ASSEMBLE_SHADER
|
||||
/* This shader was created by running the following HLSL through the fxc compiler
|
||||
and then tuning the generated assembly.
|
||||
|
||||
fxc /T fx_4_0 /O3 /Gfa /Fc yuv.fxc yuv.fx
|
||||
|
||||
--- yuv.fx ---
|
||||
Texture2D g_txY;
|
||||
Texture2D g_txU;
|
||||
Texture2D g_txV;
|
||||
|
||||
SamplerState samLinear
|
||||
{
|
||||
Filter = ANISOTROPIC;
|
||||
AddressU = Clamp;
|
||||
AddressV = Clamp;
|
||||
MaxAnisotropy = 1;
|
||||
};
|
||||
|
||||
struct VS_OUTPUT
|
||||
{
|
||||
float2 TextureUV : TEXCOORD0;
|
||||
};
|
||||
|
||||
struct PS_OUTPUT
|
||||
{
|
||||
float4 RGBAColor : SV_Target;
|
||||
};
|
||||
|
||||
PS_OUTPUT YUV420( VS_OUTPUT In )
|
||||
{
|
||||
const float3 offset = {-0.0627451017, -0.501960814, -0.501960814};
|
||||
const float3 Rcoeff = {1.164, 0.000, 1.596};
|
||||
const float3 Gcoeff = {1.164, -0.391, -0.813};
|
||||
const float3 Bcoeff = {1.164, 2.018, 0.000};
|
||||
|
||||
PS_OUTPUT Output;
|
||||
float2 TextureUV = In.TextureUV;
|
||||
|
||||
float3 yuv;
|
||||
yuv.x = g_txY.Sample( samLinear, TextureUV ).r;
|
||||
yuv.y = g_txU.Sample( samLinear, TextureUV ).r;
|
||||
yuv.z = g_txV.Sample( samLinear, TextureUV ).r;
|
||||
|
||||
yuv += offset;
|
||||
Output.RGBAColor.r = dot(yuv, Rcoeff);
|
||||
Output.RGBAColor.g = dot(yuv, Gcoeff);
|
||||
Output.RGBAColor.b = dot(yuv, Bcoeff);
|
||||
Output.RGBAColor.a = 1.0f;
|
||||
|
||||
return Output;
|
||||
}
|
||||
|
||||
technique10 RenderYUV420
|
||||
{
|
||||
pass P0
|
||||
{
|
||||
SetPixelShader( CompileShader( ps_4_0_level_9_0, YUV420() ) );
|
||||
}
|
||||
}
|
||||
*/
|
||||
const char *shader_text =
|
||||
"ps_2_0\n"
|
||||
"def c0, -0.0627451017, -0.501960814, -0.501960814, 1\n"
|
||||
"def c1, 1.16400003, 0, 1.59599996, 0\n"
|
||||
"def c2, 1.16400003, -0.391000003, -0.813000023, 0\n"
|
||||
"def c3, 1.16400003, 2.01799989, 0, 0\n"
|
||||
"dcl t0.xy\n"
|
||||
"dcl v0.xyzw\n"
|
||||
"dcl_2d s0\n"
|
||||
"dcl_2d s1\n"
|
||||
"dcl_2d s2\n"
|
||||
"texld r0, t0, s0\n"
|
||||
"texld r1, t0, s1\n"
|
||||
"texld r2, t0, s2\n"
|
||||
"mov r0.y, r1.x\n"
|
||||
"mov r0.z, r2.x\n"
|
||||
"add r0.xyz, r0, c0\n"
|
||||
"dp3 r1.x, r0, c1\n"
|
||||
"dp3 r1.y, r0, c2\n"
|
||||
"dp2add r1.z, r0, c3, c3.z\n" /* Logically this is "dp3 r1.z, r0, c3" but the optimizer did its magic */
|
||||
"mov r1.w, c0.w\n"
|
||||
"mul r0, r1, v0\n" /* Not in the HLSL, multiply by vertex color */
|
||||
"mov oC0, r0\n"
|
||||
;
|
||||
LPD3DXBUFFER pCode;
|
||||
LPD3DXBUFFER pErrorMsgs;
|
||||
LPDWORD shader_data = NULL;
|
||||
DWORD shader_size = 0;
|
||||
result = D3DXAssembleShader(shader_text, SDL_strlen(shader_text), NULL, NULL, 0, &pCode, &pErrorMsgs);
|
||||
if (!FAILED(result)) {
|
||||
shader_data = (DWORD*)pCode->lpVtbl->GetBufferPointer(pCode);
|
||||
shader_size = pCode->lpVtbl->GetBufferSize(pCode);
|
||||
PrintShaderData(shader_data, shader_size);
|
||||
} else {
|
||||
const char *error = (const char *)pErrorMsgs->lpVtbl->GetBufferPointer(pErrorMsgs);
|
||||
SDL_SetError("Couldn't assemble shader: %s", error);
|
||||
}
|
||||
if (shader_data != NULL)
|
||||
#else
|
||||
const DWORD shader_data[] = {
|
||||
0xffff0200, 0x05000051, 0xa00f0000, 0xbd808081, 0xbf008081, 0xbf008081,
|
||||
0x3f800000, 0x05000051, 0xa00f0001, 0x3f94fdf4, 0x00000000, 0x3fcc49ba,
|
||||
0x00000000, 0x05000051, 0xa00f0002, 0x3f94fdf4, 0xbec83127, 0xbf5020c5,
|
||||
0x00000000, 0x05000051, 0xa00f0003, 0x3f94fdf4, 0x400126e9, 0x00000000,
|
||||
0x00000000, 0x0200001f, 0x80000000, 0xb0030000, 0x0200001f, 0x80000000,
|
||||
0x900f0000, 0x0200001f, 0x90000000, 0xa00f0800, 0x0200001f, 0x90000000,
|
||||
0xa00f0801, 0x0200001f, 0x90000000, 0xa00f0802, 0x03000042, 0x800f0000,
|
||||
0xb0e40000, 0xa0e40800, 0x03000042, 0x800f0001, 0xb0e40000, 0xa0e40801,
|
||||
0x03000042, 0x800f0002, 0xb0e40000, 0xa0e40802, 0x02000001, 0x80020000,
|
||||
0x80000001, 0x02000001, 0x80040000, 0x80000002, 0x03000002, 0x80070000,
|
||||
0x80e40000, 0xa0e40000, 0x03000008, 0x80010001, 0x80e40000, 0xa0e40001,
|
||||
0x03000008, 0x80020001, 0x80e40000, 0xa0e40002, 0x0400005a, 0x80040001,
|
||||
0x80e40000, 0xa0e40003, 0xa0aa0003, 0x02000001, 0x80080001, 0xa0ff0000,
|
||||
0x03000005, 0x800f0000, 0x80e40001, 0x90e40000, 0x02000001, 0x800f0800,
|
||||
0x80e40000, 0x0000ffff
|
||||
};
|
||||
#endif
|
||||
{
|
||||
result = IDirect3DDevice9_CreatePixelShader(data->device, shader_data, &data->ps_yuv);
|
||||
if (!FAILED(result)) {
|
||||
renderer->info.texture_formats[renderer->info.num_texture_formats++] = SDL_PIXELFORMAT_YV12;
|
||||
renderer->info.texture_formats[renderer->info.num_texture_formats++] = SDL_PIXELFORMAT_IYUV;
|
||||
} else {
|
||||
if (caps.MaxSimultaneousTextures >= 3) {
|
||||
int i;
|
||||
for (i = 0; i < SDL_arraysize(data->shaders); ++i) {
|
||||
result = D3D9_CreatePixelShader(data->device, (D3D9_Shader)i, &data->shaders[i]);
|
||||
if (FAILED(result)) {
|
||||
D3D_SetError("CreatePixelShader()", result);
|
||||
}
|
||||
}
|
||||
if (data->shaders[SHADER_YUV_JPEG] && data->shaders[SHADER_YUV_BT601] && data->shaders[SHADER_YUV_BT709]) {
|
||||
renderer->info.texture_formats[renderer->info.num_texture_formats++] = SDL_PIXELFORMAT_YV12;
|
||||
renderer->info.texture_formats[renderer->info.num_texture_formats++] = SDL_PIXELFORMAT_IYUV;
|
||||
}
|
||||
}
|
||||
|
||||
return renderer;
|
||||
}
|
||||
|
||||
|
@ -870,7 +677,7 @@ GetScaleQuality(void)
|
|||
}
|
||||
|
||||
static int
|
||||
D3D_CreateTextureRep(IDirect3DDevice9 *device, D3D_TextureRep *texture, DWORD usage, Uint32 format, int w, int h)
|
||||
D3D_CreateTextureRep(IDirect3DDevice9 *device, D3D_TextureRep *texture, DWORD usage, Uint32 format, D3DFORMAT d3dfmt, int w, int h)
|
||||
{
|
||||
HRESULT result;
|
||||
|
||||
|
@ -879,6 +686,7 @@ D3D_CreateTextureRep(IDirect3DDevice9 *device, D3D_TextureRep *texture, DWORD us
|
|||
texture->h = h;
|
||||
texture->usage = usage;
|
||||
texture->format = format;
|
||||
texture->d3dfmt = d3dfmt;
|
||||
|
||||
result = IDirect3DDevice9_CreateTexture(device, w, h, 1, usage,
|
||||
PixelFormatToD3DFMT(format),
|
||||
|
@ -897,8 +705,7 @@ D3D_CreateStagingTexture(IDirect3DDevice9 *device, D3D_TextureRep *texture)
|
|||
|
||||
if (texture->staging == NULL) {
|
||||
result = IDirect3DDevice9_CreateTexture(device, texture->w, texture->h, 1, 0,
|
||||
PixelFormatToD3DFMT(texture->format),
|
||||
D3DPOOL_SYSTEMMEM, &texture->staging, NULL);
|
||||
texture->d3dfmt, D3DPOOL_SYSTEMMEM, &texture->staging, NULL);
|
||||
if (FAILED(result)) {
|
||||
return D3D_SetError("CreateTexture(D3DPOOL_SYSTEMMEM)", result);
|
||||
}
|
||||
|
@ -934,7 +741,7 @@ D3D_BindTextureRep(IDirect3DDevice9 *device, D3D_TextureRep *texture, DWORD samp
|
|||
}
|
||||
|
||||
static int
|
||||
D3D_RecreateTextureRep(IDirect3DDevice9 *device, D3D_TextureRep *texture, Uint32 format, int w, int h)
|
||||
D3D_RecreateTextureRep(IDirect3DDevice9 *device, D3D_TextureRep *texture)
|
||||
{
|
||||
if (texture->texture) {
|
||||
IDirect3DTexture9_Release(texture->texture);
|
||||
|
@ -948,7 +755,7 @@ D3D_RecreateTextureRep(IDirect3DDevice9 *device, D3D_TextureRep *texture, Uint32
|
|||
}
|
||||
|
||||
static int
|
||||
D3D_UpdateTextureRep(IDirect3DDevice9 *device, D3D_TextureRep *texture, Uint32 format, int x, int y, int w, int h, const void *pixels, int pitch)
|
||||
D3D_UpdateTextureRep(IDirect3DDevice9 *device, D3D_TextureRep *texture, int x, int y, int w, int h, const void *pixels, int pitch)
|
||||
{
|
||||
RECT d3drect;
|
||||
D3DLOCKED_RECT locked;
|
||||
|
@ -972,8 +779,8 @@ D3D_UpdateTextureRep(IDirect3DDevice9 *device, D3D_TextureRep *texture, Uint32 f
|
|||
}
|
||||
|
||||
src = (const Uint8 *)pixels;
|
||||
dst = locked.pBits;
|
||||
length = w * SDL_BYTESPERPIXEL(format);
|
||||
dst = (Uint8 *)locked.pBits;
|
||||
length = w * SDL_BYTESPERPIXEL(texture->format);
|
||||
if (length == pitch && length == locked.Pitch) {
|
||||
SDL_memcpy(dst, src, length*h);
|
||||
} else {
|
||||
|
@ -1032,7 +839,7 @@ D3D_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture)
|
|||
usage = 0;
|
||||
}
|
||||
|
||||
if (D3D_CreateTextureRep(data->device, &texturedata->texture, usage, texture->format, texture->w, texture->h) < 0) {
|
||||
if (D3D_CreateTextureRep(data->device, &texturedata->texture, usage, texture->format, PixelFormatToD3DFMT(texture->format), texture->w, texture->h) < 0) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -1040,11 +847,11 @@ D3D_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture)
|
|||
texture->format == SDL_PIXELFORMAT_IYUV) {
|
||||
texturedata->yuv = SDL_TRUE;
|
||||
|
||||
if (D3D_CreateTextureRep(data->device, &texturedata->utexture, usage, texture->format, texture->w / 2, texture->h / 2) < 0) {
|
||||
if (D3D_CreateTextureRep(data->device, &texturedata->utexture, usage, texture->format, PixelFormatToD3DFMT(texture->format), (texture->w + 1) / 2, (texture->h + 1) / 2) < 0) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (D3D_CreateTextureRep(data->device, &texturedata->vtexture, usage, texture->format, texture->w / 2, texture->h / 2) < 0) {
|
||||
if (D3D_CreateTextureRep(data->device, &texturedata->vtexture, usage, texture->format, PixelFormatToD3DFMT(texture->format), (texture->w + 1) / 2, (texture->h + 1) / 2) < 0) {
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
@ -1061,16 +868,16 @@ D3D_RecreateTexture(SDL_Renderer * renderer, SDL_Texture * texture)
|
|||
return 0;
|
||||
}
|
||||
|
||||
if (D3D_RecreateTextureRep(data->device, &texturedata->texture, texture->format, texture->w, texture->h) < 0) {
|
||||
if (D3D_RecreateTextureRep(data->device, &texturedata->texture) < 0) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (texturedata->yuv) {
|
||||
if (D3D_RecreateTextureRep(data->device, &texturedata->utexture, texture->format, texture->w / 2, texture->h / 2) < 0) {
|
||||
if (D3D_RecreateTextureRep(data->device, &texturedata->utexture) < 0) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (D3D_RecreateTextureRep(data->device, &texturedata->vtexture, texture->format, texture->w / 2, texture->h / 2) < 0) {
|
||||
if (D3D_RecreateTextureRep(data->device, &texturedata->vtexture) < 0) {
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
@ -1089,7 +896,7 @@ D3D_UpdateTexture(SDL_Renderer * renderer, SDL_Texture * texture,
|
|||
return -1;
|
||||
}
|
||||
|
||||
if (D3D_UpdateTextureRep(data->device, &texturedata->texture, texture->format, rect->x, rect->y, rect->w, rect->h, pixels, pitch) < 0) {
|
||||
if (D3D_UpdateTextureRep(data->device, &texturedata->texture, rect->x, rect->y, rect->w, rect->h, pixels, pitch) < 0) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -1097,13 +904,13 @@ D3D_UpdateTexture(SDL_Renderer * renderer, SDL_Texture * texture,
|
|||
/* Skip to the correct offset into the next texture */
|
||||
pixels = (const void*)((const Uint8*)pixels + rect->h * pitch);
|
||||
|
||||
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) {
|
||||
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) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* Skip to the correct offset into the next texture */
|
||||
pixels = (const void*)((const Uint8*)pixels + (rect->h * pitch)/4);
|
||||
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) {
|
||||
pixels = (const void*)((const Uint8*)pixels + ((rect->h + 1) / 2) * ((pitch + 1) / 2));
|
||||
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) {
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
@ -1125,13 +932,13 @@ D3D_UpdateTextureYUV(SDL_Renderer * renderer, SDL_Texture * texture,
|
|||
return -1;
|
||||
}
|
||||
|
||||
if (D3D_UpdateTextureRep(data->device, &texturedata->texture, texture->format, rect->x, rect->y, rect->w, rect->h, Yplane, Ypitch) < 0) {
|
||||
if (D3D_UpdateTextureRep(data->device, &texturedata->texture, rect->x, rect->y, rect->w, rect->h, Yplane, Ypitch) < 0) {
|
||||
return -1;
|
||||
}
|
||||
if (D3D_UpdateTextureRep(data->device, &texturedata->utexture, texture->format, rect->x / 2, rect->y / 2, rect->w / 2, rect->h / 2, Uplane, Upitch) < 0) {
|
||||
if (D3D_UpdateTextureRep(data->device, &texturedata->utexture, rect->x / 2, rect->y / 2, (rect->w + 1) / 2, (rect->h + 1) / 2, Uplane, Upitch) < 0) {
|
||||
return -1;
|
||||
}
|
||||
if (D3D_UpdateTextureRep(data->device, &texturedata->vtexture, texture->format, rect->x / 2, rect->y / 2, rect->w / 2, rect->h / 2, Vplane, Vpitch) < 0) {
|
||||
if (D3D_UpdateTextureRep(data->device, &texturedata->vtexture, rect->x / 2, rect->y / 2, (rect->w + 1) / 2, (rect->h + 1) / 2, Vplane, Vpitch) < 0) {
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
|
@ -1609,13 +1416,60 @@ D3D_UpdateTextureScaleMode(D3D_RenderData *data, D3D_TextureData *texturedata, u
|
|||
}
|
||||
}
|
||||
|
||||
static int
|
||||
D3D_RenderSetupTextureState(SDL_Renderer * renderer, SDL_Texture * texture, LPDIRECT3DPIXELSHADER9 *shader)
|
||||
{
|
||||
D3D_RenderData *data = (D3D_RenderData *) renderer->driverdata;
|
||||
D3D_TextureData *texturedata;
|
||||
|
||||
*shader = NULL;
|
||||
|
||||
texturedata = (D3D_TextureData *)texture->driverdata;
|
||||
if (!texturedata) {
|
||||
SDL_SetError("Texture is not currently available");
|
||||
return -1;
|
||||
}
|
||||
|
||||
D3D_UpdateTextureScaleMode(data, texturedata, 0);
|
||||
|
||||
if (D3D_BindTextureRep(data->device, &texturedata->texture, 0) < 0) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (texturedata->yuv) {
|
||||
switch (SDL_GetYUVConversionModeForResolution(texture->w, texture->h)) {
|
||||
case SDL_YUV_CONVERSION_JPEG:
|
||||
*shader = data->shaders[SHADER_YUV_JPEG];
|
||||
break;
|
||||
case SDL_YUV_CONVERSION_BT601:
|
||||
*shader = data->shaders[SHADER_YUV_BT601];
|
||||
break;
|
||||
case SDL_YUV_CONVERSION_BT709:
|
||||
*shader = data->shaders[SHADER_YUV_BT709];
|
||||
break;
|
||||
default:
|
||||
return SDL_SetError("Unsupported YUV conversion mode");
|
||||
}
|
||||
|
||||
D3D_UpdateTextureScaleMode(data, texturedata, 1);
|
||||
D3D_UpdateTextureScaleMode(data, texturedata, 2);
|
||||
|
||||
if (D3D_BindTextureRep(data->device, &texturedata->utexture, 1) < 0) {
|
||||
return -1;
|
||||
}
|
||||
if (D3D_BindTextureRep(data->device, &texturedata->vtexture, 2) < 0) {
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
D3D_RenderCopy(SDL_Renderer * renderer, SDL_Texture * texture,
|
||||
const SDL_Rect * srcrect, const SDL_FRect * dstrect)
|
||||
{
|
||||
D3D_RenderData *data = (D3D_RenderData *) renderer->driverdata;
|
||||
D3D_TextureData *texturedata;
|
||||
LPDIRECT3DPIXELSHADER9 shader = NULL;
|
||||
LPDIRECT3DPIXELSHADER9 shader;
|
||||
float minx, miny, maxx, maxy;
|
||||
float minu, maxu, minv, maxv;
|
||||
DWORD color;
|
||||
|
@ -1626,12 +1480,6 @@ D3D_RenderCopy(SDL_Renderer * renderer, SDL_Texture * texture,
|
|||
return -1;
|
||||
}
|
||||
|
||||
texturedata = (D3D_TextureData *)texture->driverdata;
|
||||
if (!texturedata) {
|
||||
SDL_SetError("Texture is not currently available");
|
||||
return -1;
|
||||
}
|
||||
|
||||
minx = dstrect->x - 0.5f;
|
||||
miny = dstrect->y - 0.5f;
|
||||
maxx = dstrect->x + dstrect->w - 0.5f;
|
||||
|
@ -1674,45 +1522,25 @@ D3D_RenderCopy(SDL_Renderer * renderer, SDL_Texture * texture,
|
|||
|
||||
D3D_SetBlendMode(data, texture->blendMode);
|
||||
|
||||
D3D_UpdateTextureScaleMode(data, texturedata, 0);
|
||||
|
||||
if (D3D_BindTextureRep(data->device, &texturedata->texture, 0) < 0) {
|
||||
if (D3D_RenderSetupTextureState(renderer, texture, &shader) < 0) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (texturedata->yuv) {
|
||||
shader = data->ps_yuv;
|
||||
|
||||
D3D_UpdateTextureScaleMode(data, texturedata, 1);
|
||||
D3D_UpdateTextureScaleMode(data, texturedata, 2);
|
||||
|
||||
if (D3D_BindTextureRep(data->device, &texturedata->utexture, 1) < 0) {
|
||||
return -1;
|
||||
}
|
||||
if (D3D_BindTextureRep(data->device, &texturedata->vtexture, 2) < 0) {
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
if (shader) {
|
||||
result = IDirect3DDevice9_SetPixelShader(data->device, shader);
|
||||
if (FAILED(result)) {
|
||||
return D3D_SetError("SetShader()", result);
|
||||
}
|
||||
}
|
||||
result =
|
||||
IDirect3DDevice9_DrawPrimitiveUP(data->device, D3DPT_TRIANGLEFAN, 2,
|
||||
vertices, sizeof(*vertices));
|
||||
result = IDirect3DDevice9_DrawPrimitiveUP(data->device, D3DPT_TRIANGLEFAN, 2,
|
||||
vertices, sizeof(*vertices));
|
||||
if (FAILED(result)) {
|
||||
return D3D_SetError("DrawPrimitiveUP()", result);
|
||||
D3D_SetError("DrawPrimitiveUP()", result);
|
||||
}
|
||||
if (shader) {
|
||||
result = IDirect3DDevice9_SetPixelShader(data->device, NULL);
|
||||
if (FAILED(result)) {
|
||||
return D3D_SetError("SetShader()", result);
|
||||
}
|
||||
IDirect3DDevice9_SetPixelShader(data->device, NULL);
|
||||
}
|
||||
return 0;
|
||||
return FAILED(result) ? -1 : 0;
|
||||
}
|
||||
|
||||
|
||||
|
@ -1722,7 +1550,6 @@ D3D_RenderCopyEx(SDL_Renderer * renderer, SDL_Texture * texture,
|
|||
const double angle, const SDL_FPoint * center, const SDL_RendererFlip flip)
|
||||
{
|
||||
D3D_RenderData *data = (D3D_RenderData *) renderer->driverdata;
|
||||
D3D_TextureData *texturedata;
|
||||
LPDIRECT3DPIXELSHADER9 shader = NULL;
|
||||
float minx, miny, maxx, maxy;
|
||||
float minu, maxu, minv, maxv;
|
||||
|
@ -1736,12 +1563,6 @@ D3D_RenderCopyEx(SDL_Renderer * renderer, SDL_Texture * texture,
|
|||
return -1;
|
||||
}
|
||||
|
||||
texturedata = (D3D_TextureData *)texture->driverdata;
|
||||
if (!texturedata) {
|
||||
SDL_SetError("Texture is not currently available");
|
||||
return -1;
|
||||
}
|
||||
|
||||
centerx = center->x;
|
||||
centery = center->y;
|
||||
|
||||
|
@ -1798,54 +1619,37 @@ D3D_RenderCopyEx(SDL_Renderer * renderer, SDL_Texture * texture,
|
|||
|
||||
D3D_SetBlendMode(data, texture->blendMode);
|
||||
|
||||
if (D3D_RenderSetupTextureState(renderer, texture, &shader) < 0) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* Rotate and translate */
|
||||
modelMatrix = MatrixMultiply(
|
||||
MatrixRotationZ((float)(M_PI * (float) angle / 180.0f)),
|
||||
MatrixTranslation(dstrect->x + center->x - 0.5f, dstrect->y + center->y - 0.5f, 0));
|
||||
IDirect3DDevice9_SetTransform(data->device, D3DTS_VIEW, (D3DMATRIX*)&modelMatrix);
|
||||
|
||||
D3D_UpdateTextureScaleMode(data, texturedata, 0);
|
||||
|
||||
if (D3D_BindTextureRep(data->device, &texturedata->texture, 0) < 0) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (texturedata->yuv) {
|
||||
shader = data->ps_yuv;
|
||||
|
||||
D3D_UpdateTextureScaleMode(data, texturedata, 1);
|
||||
D3D_UpdateTextureScaleMode(data, texturedata, 2);
|
||||
|
||||
if (D3D_BindTextureRep(data->device, &texturedata->utexture, 1) < 0) {
|
||||
return -1;
|
||||
}
|
||||
if (D3D_BindTextureRep(data->device, &texturedata->vtexture, 2) < 0) {
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
if (shader) {
|
||||
result = IDirect3DDevice9_SetPixelShader(data->device, shader);
|
||||
if (FAILED(result)) {
|
||||
return D3D_SetError("SetShader()", result);
|
||||
D3D_SetError("SetShader()", result);
|
||||
goto done;
|
||||
}
|
||||
}
|
||||
result =
|
||||
IDirect3DDevice9_DrawPrimitiveUP(data->device, D3DPT_TRIANGLEFAN, 2,
|
||||
vertices, sizeof(*vertices));
|
||||
result = IDirect3DDevice9_DrawPrimitiveUP(data->device, D3DPT_TRIANGLEFAN, 2,
|
||||
vertices, sizeof(*vertices));
|
||||
if (FAILED(result)) {
|
||||
return D3D_SetError("DrawPrimitiveUP()", result);
|
||||
D3D_SetError("DrawPrimitiveUP()", result);
|
||||
}
|
||||
done:
|
||||
if (shader) {
|
||||
result = IDirect3DDevice9_SetPixelShader(data->device, NULL);
|
||||
if (FAILED(result)) {
|
||||
return D3D_SetError("SetShader()", result);
|
||||
}
|
||||
IDirect3DDevice9_SetPixelShader(data->device, NULL);
|
||||
}
|
||||
|
||||
modelMatrix = MatrixIdentity();
|
||||
IDirect3DDevice9_SetTransform(data->device, D3DTS_VIEW, (D3DMATRIX*)&modelMatrix);
|
||||
return 0;
|
||||
|
||||
return FAILED(result) ? -1 : 0;
|
||||
}
|
||||
|
||||
static int
|
||||
|
@ -1955,6 +1759,8 @@ D3D_DestroyRenderer(SDL_Renderer * renderer)
|
|||
D3D_RenderData *data = (D3D_RenderData *) renderer->driverdata;
|
||||
|
||||
if (data) {
|
||||
int i;
|
||||
|
||||
/* Release the render target */
|
||||
if (data->defaultRenderTarget) {
|
||||
IDirect3DSurface9_Release(data->defaultRenderTarget);
|
||||
|
@ -1964,11 +1770,15 @@ D3D_DestroyRenderer(SDL_Renderer * renderer)
|
|||
IDirect3DSurface9_Release(data->currentRenderTarget);
|
||||
data->currentRenderTarget = NULL;
|
||||
}
|
||||
if (data->ps_yuv) {
|
||||
IDirect3DPixelShader9_Release(data->ps_yuv);
|
||||
for (i = 0; i < SDL_arraysize(data->shaders); ++i) {
|
||||
if (data->shaders[i]) {
|
||||
IDirect3DPixelShader9_Release(data->shaders[i]);
|
||||
data->shaders[i] = NULL;
|
||||
}
|
||||
}
|
||||
if (data->device) {
|
||||
IDirect3DDevice9_Release(data->device);
|
||||
data->device = NULL;
|
||||
}
|
||||
if (data->d3d) {
|
||||
IDirect3D9_Release(data->d3d);
|
||||
|
|
|
@ -0,0 +1,274 @@
|
|||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2017 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
arising from the use of this software.
|
||||
|
||||
Permission is granted to anyone to use this software for any purpose,
|
||||
including commercial applications, and to alter it and redistribute it
|
||||
freely, subject to the following restrictions:
|
||||
|
||||
1. The origin of this software must not be misrepresented; you must not
|
||||
claim that you wrote the original software. If you use this software
|
||||
in a product, an acknowledgment in the product documentation would be
|
||||
appreciated but is not required.
|
||||
2. Altered source versions must be plainly marked as such, and must not be
|
||||
misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
*/
|
||||
#include "../../SDL_internal.h"
|
||||
|
||||
#include "SDL_render.h"
|
||||
#include "SDL_system.h"
|
||||
|
||||
#if SDL_VIDEO_RENDER_D3D && !SDL_RENDER_DISABLED
|
||||
|
||||
#include "../../core/windows/SDL_windows.h"
|
||||
|
||||
#include <d3d9.h>
|
||||
|
||||
#include "SDL_shaders_d3d.h"
|
||||
|
||||
/* The shaders here were compiled with:
|
||||
|
||||
fxc /T ps_2_0 /Fo"<OUTPUT FILE>" "<INPUT FILE>"
|
||||
|
||||
Shader object code was converted to a list of DWORDs via the following
|
||||
*nix style command (available separately from Windows + MSVC):
|
||||
|
||||
hexdump -v -e '6/4 "0x%08.8x, " "\n"' <FILE>
|
||||
*/
|
||||
|
||||
/* --- D3D9_PixelShader_YUV_JPEG.hlsl ---
|
||||
Texture2D theTextureY : register(t0);
|
||||
Texture2D theTextureU : register(t1);
|
||||
Texture2D theTextureV : register(t2);
|
||||
SamplerState theSampler = sampler_state
|
||||
{
|
||||
addressU = Clamp;
|
||||
addressV = Clamp;
|
||||
mipfilter = NONE;
|
||||
minfilter = LINEAR;
|
||||
magfilter = LINEAR;
|
||||
};
|
||||
|
||||
struct PixelShaderInput
|
||||
{
|
||||
float4 pos : SV_POSITION;
|
||||
float2 tex : TEXCOORD0;
|
||||
float4 color : COLOR0;
|
||||
};
|
||||
|
||||
float4 main(PixelShaderInput input) : SV_TARGET
|
||||
{
|
||||
const float3 offset = {0.0, -0.501960814, -0.501960814};
|
||||
const float3 Rcoeff = {1.0000, 0.0000, 1.4020};
|
||||
const float3 Gcoeff = {1.0000, -0.3441, -0.7141};
|
||||
const float3 Bcoeff = {1.0000, 1.7720, 0.0000};
|
||||
|
||||
float4 Output;
|
||||
|
||||
float3 yuv;
|
||||
yuv.x = theTextureY.Sample(theSampler, input.tex).r;
|
||||
yuv.y = theTextureU.Sample(theSampler, input.tex).r;
|
||||
yuv.z = theTextureV.Sample(theSampler, input.tex).r;
|
||||
|
||||
yuv += offset;
|
||||
Output.r = dot(yuv, Rcoeff);
|
||||
Output.g = dot(yuv, Gcoeff);
|
||||
Output.b = dot(yuv, Bcoeff);
|
||||
Output.a = 1.0f;
|
||||
|
||||
return Output * input.color;
|
||||
}
|
||||
*/
|
||||
static const DWORD D3D9_PixelShader_YUV_JPEG[] = {
|
||||
0xffff0200, 0x0044fffe, 0x42415443, 0x0000001c, 0x000000d7, 0xffff0200,
|
||||
0x00000003, 0x0000001c, 0x00000100, 0x000000d0, 0x00000058, 0x00010003,
|
||||
0x00000001, 0x00000070, 0x00000000, 0x00000080, 0x00020003, 0x00000001,
|
||||
0x00000098, 0x00000000, 0x000000a8, 0x00000003, 0x00000001, 0x000000c0,
|
||||
0x00000000, 0x53656874, 0x6c706d61, 0x742b7265, 0x65546568, 0x72757478,
|
||||
0xab005565, 0x00070004, 0x00040001, 0x00000001, 0x00000000, 0x53656874,
|
||||
0x6c706d61, 0x742b7265, 0x65546568, 0x72757478, 0xab005665, 0x00070004,
|
||||
0x00040001, 0x00000001, 0x00000000, 0x53656874, 0x6c706d61, 0x742b7265,
|
||||
0x65546568, 0x72757478, 0xab005965, 0x00070004, 0x00040001, 0x00000001,
|
||||
0x00000000, 0x325f7370, 0x4d00305f, 0x6f726369, 0x74666f73, 0x29522820,
|
||||
0x534c4820, 0x6853204c, 0x72656461, 0x6d6f4320, 0x656c6970, 0x2e362072,
|
||||
0x36392e33, 0x312e3030, 0x34383336, 0xababab00, 0x05000051, 0xa00f0000,
|
||||
0x00000000, 0xbf008081, 0xbf008081, 0x3f800000, 0x05000051, 0xa00f0001,
|
||||
0x3f800000, 0x00000000, 0x3fb374bc, 0x00000000, 0x05000051, 0xa00f0002,
|
||||
0x3f800000, 0xbeb02de0, 0xbf36cf42, 0x00000000, 0x05000051, 0xa00f0003,
|
||||
0x3f800000, 0x3fe2d0e5, 0x00000000, 0x00000000, 0x0200001f, 0x80000000,
|
||||
0xb0030000, 0x0200001f, 0x80000000, 0x900f0000, 0x0200001f, 0x90000000,
|
||||
0xa00f0800, 0x0200001f, 0x90000000, 0xa00f0801, 0x0200001f, 0x90000000,
|
||||
0xa00f0802, 0x03000042, 0x800f0000, 0xb0e40000, 0xa0e40800, 0x03000042,
|
||||
0x800f0001, 0xb0e40000, 0xa0e40801, 0x03000042, 0x800f0002, 0xb0e40000,
|
||||
0xa0e40802, 0x02000001, 0x80020000, 0x80000001, 0x02000001, 0x80040000,
|
||||
0x80000002, 0x03000002, 0x80070000, 0x80e40000, 0xa0e40000, 0x03000008,
|
||||
0x80010001, 0x80e40000, 0xa0e40001, 0x03000008, 0x80020001, 0x80e40000,
|
||||
0xa0e40002, 0x0400005a, 0x80040001, 0x80e40000, 0xa0e40003, 0xa0aa0003,
|
||||
0x02000001, 0x80080001, 0xa0ff0000, 0x03000005, 0x800f0000, 0x80e40001,
|
||||
0x90e40000, 0x02000001, 0x800f0800, 0x80e40000, 0x0000ffff
|
||||
};
|
||||
|
||||
/* --- D3D9_PixelShader_YUV_BT601.hlsl ---
|
||||
Texture2D theTextureY : register(t0);
|
||||
Texture2D theTextureU : register(t1);
|
||||
Texture2D theTextureV : register(t2);
|
||||
SamplerState theSampler = sampler_state
|
||||
{
|
||||
addressU = Clamp;
|
||||
addressV = Clamp;
|
||||
mipfilter = NONE;
|
||||
minfilter = LINEAR;
|
||||
magfilter = LINEAR;
|
||||
};
|
||||
|
||||
struct PixelShaderInput
|
||||
{
|
||||
float4 pos : SV_POSITION;
|
||||
float2 tex : TEXCOORD0;
|
||||
float4 color : COLOR0;
|
||||
};
|
||||
|
||||
float4 main(PixelShaderInput input) : SV_TARGET
|
||||
{
|
||||
const float3 offset = {-0.0627451017, -0.501960814, -0.501960814};
|
||||
const float3 Rcoeff = {1.1644, 0.0000, 1.5960};
|
||||
const float3 Gcoeff = {1.1644, -0.3918, -0.8130};
|
||||
const float3 Bcoeff = {1.1644, 2.0172, 0.0000};
|
||||
|
||||
float4 Output;
|
||||
|
||||
float3 yuv;
|
||||
yuv.x = theTextureY.Sample(theSampler, input.tex).r;
|
||||
yuv.y = theTextureU.Sample(theSampler, input.tex).r;
|
||||
yuv.z = theTextureV.Sample(theSampler, input.tex).r;
|
||||
|
||||
yuv += offset;
|
||||
Output.r = dot(yuv, Rcoeff);
|
||||
Output.g = dot(yuv, Gcoeff);
|
||||
Output.b = dot(yuv, Bcoeff);
|
||||
Output.a = 1.0f;
|
||||
|
||||
return Output * input.color;
|
||||
}
|
||||
*/
|
||||
static const DWORD D3D9_PixelShader_YUV_BT601[] = {
|
||||
0xffff0200, 0x0044fffe, 0x42415443, 0x0000001c, 0x000000d7, 0xffff0200,
|
||||
0x00000003, 0x0000001c, 0x00000100, 0x000000d0, 0x00000058, 0x00010003,
|
||||
0x00000001, 0x00000070, 0x00000000, 0x00000080, 0x00020003, 0x00000001,
|
||||
0x00000098, 0x00000000, 0x000000a8, 0x00000003, 0x00000001, 0x000000c0,
|
||||
0x00000000, 0x53656874, 0x6c706d61, 0x742b7265, 0x65546568, 0x72757478,
|
||||
0xab005565, 0x00070004, 0x00040001, 0x00000001, 0x00000000, 0x53656874,
|
||||
0x6c706d61, 0x742b7265, 0x65546568, 0x72757478, 0xab005665, 0x00070004,
|
||||
0x00040001, 0x00000001, 0x00000000, 0x53656874, 0x6c706d61, 0x742b7265,
|
||||
0x65546568, 0x72757478, 0xab005965, 0x00070004, 0x00040001, 0x00000001,
|
||||
0x00000000, 0x325f7370, 0x4d00305f, 0x6f726369, 0x74666f73, 0x29522820,
|
||||
0x534c4820, 0x6853204c, 0x72656461, 0x6d6f4320, 0x656c6970, 0x2e362072,
|
||||
0x36392e33, 0x312e3030, 0x34383336, 0xababab00, 0x05000051, 0xa00f0000,
|
||||
0xbd808081, 0xbf008081, 0xbf008081, 0x3f800000, 0x05000051, 0xa00f0001,
|
||||
0x3f950b0f, 0x00000000, 0x3fcc49ba, 0x00000000, 0x05000051, 0xa00f0002,
|
||||
0x3f950b0f, 0xbec89a02, 0xbf5020c5, 0x00000000, 0x05000051, 0xa00f0003,
|
||||
0x3f950b0f, 0x400119ce, 0x00000000, 0x00000000, 0x0200001f, 0x80000000,
|
||||
0xb0030000, 0x0200001f, 0x80000000, 0x900f0000, 0x0200001f, 0x90000000,
|
||||
0xa00f0800, 0x0200001f, 0x90000000, 0xa00f0801, 0x0200001f, 0x90000000,
|
||||
0xa00f0802, 0x03000042, 0x800f0000, 0xb0e40000, 0xa0e40800, 0x03000042,
|
||||
0x800f0001, 0xb0e40000, 0xa0e40801, 0x03000042, 0x800f0002, 0xb0e40000,
|
||||
0xa0e40802, 0x02000001, 0x80020000, 0x80000001, 0x02000001, 0x80040000,
|
||||
0x80000002, 0x03000002, 0x80070000, 0x80e40000, 0xa0e40000, 0x03000008,
|
||||
0x80010001, 0x80e40000, 0xa0e40001, 0x03000008, 0x80020001, 0x80e40000,
|
||||
0xa0e40002, 0x0400005a, 0x80040001, 0x80e40000, 0xa0e40003, 0xa0aa0003,
|
||||
0x02000001, 0x80080001, 0xa0ff0000, 0x03000005, 0x800f0000, 0x80e40001,
|
||||
0x90e40000, 0x02000001, 0x800f0800, 0x80e40000, 0x0000ffff
|
||||
};
|
||||
|
||||
/* --- D3D9_PixelShader_YUV_BT709.hlsl ---
|
||||
Texture2D theTextureY : register(t0);
|
||||
Texture2D theTextureU : register(t1);
|
||||
Texture2D theTextureV : register(t2);
|
||||
SamplerState theSampler = sampler_state
|
||||
{
|
||||
addressU = Clamp;
|
||||
addressV = Clamp;
|
||||
mipfilter = NONE;
|
||||
minfilter = LINEAR;
|
||||
magfilter = LINEAR;
|
||||
};
|
||||
|
||||
struct PixelShaderInput
|
||||
{
|
||||
float4 pos : SV_POSITION;
|
||||
float2 tex : TEXCOORD0;
|
||||
float4 color : COLOR0;
|
||||
};
|
||||
|
||||
float4 main(PixelShaderInput input) : SV_TARGET
|
||||
{
|
||||
const float3 offset = {-0.0627451017, -0.501960814, -0.501960814};
|
||||
const float3 Rcoeff = {1.1644, 0.0000, 1.7927};
|
||||
const float3 Gcoeff = {1.1644, -0.2132, -0.5329};
|
||||
const float3 Bcoeff = {1.1644, 2.1124, 0.0000};
|
||||
|
||||
float4 Output;
|
||||
|
||||
float3 yuv;
|
||||
yuv.x = theTextureY.Sample(theSampler, input.tex).r;
|
||||
yuv.y = theTextureU.Sample(theSampler, input.tex).r;
|
||||
yuv.z = theTextureV.Sample(theSampler, input.tex).r;
|
||||
|
||||
yuv += offset;
|
||||
Output.r = dot(yuv, Rcoeff);
|
||||
Output.g = dot(yuv, Gcoeff);
|
||||
Output.b = dot(yuv, Bcoeff);
|
||||
Output.a = 1.0f;
|
||||
|
||||
return Output * input.color;
|
||||
}
|
||||
*/
|
||||
static const DWORD D3D9_PixelShader_YUV_BT709[] = {
|
||||
0xffff0200, 0x0044fffe, 0x42415443, 0x0000001c, 0x000000d7, 0xffff0200,
|
||||
0x00000003, 0x0000001c, 0x00000100, 0x000000d0, 0x00000058, 0x00010003,
|
||||
0x00000001, 0x00000070, 0x00000000, 0x00000080, 0x00020003, 0x00000001,
|
||||
0x00000098, 0x00000000, 0x000000a8, 0x00000003, 0x00000001, 0x000000c0,
|
||||
0x00000000, 0x53656874, 0x6c706d61, 0x742b7265, 0x65546568, 0x72757478,
|
||||
0xab005565, 0x00070004, 0x00040001, 0x00000001, 0x00000000, 0x53656874,
|
||||
0x6c706d61, 0x742b7265, 0x65546568, 0x72757478, 0xab005665, 0x00070004,
|
||||
0x00040001, 0x00000001, 0x00000000, 0x53656874, 0x6c706d61, 0x742b7265,
|
||||
0x65546568, 0x72757478, 0xab005965, 0x00070004, 0x00040001, 0x00000001,
|
||||
0x00000000, 0x325f7370, 0x4d00305f, 0x6f726369, 0x74666f73, 0x29522820,
|
||||
0x534c4820, 0x6853204c, 0x72656461, 0x6d6f4320, 0x656c6970, 0x2e362072,
|
||||
0x36392e33, 0x312e3030, 0x34383336, 0xababab00, 0x05000051, 0xa00f0000,
|
||||
0xbd808081, 0xbf008081, 0xbf008081, 0x3f800000, 0x05000051, 0xa00f0001,
|
||||
0x3f950b0f, 0x00000000, 0x3fe57732, 0x00000000, 0x05000051, 0xa00f0002,
|
||||
0x3f950b0f, 0xbe5a511a, 0xbf086c22, 0x00000000, 0x05000051, 0xa00f0003,
|
||||
0x3f950b0f, 0x40073190, 0x00000000, 0x00000000, 0x0200001f, 0x80000000,
|
||||
0xb0030000, 0x0200001f, 0x80000000, 0x900f0000, 0x0200001f, 0x90000000,
|
||||
0xa00f0800, 0x0200001f, 0x90000000, 0xa00f0801, 0x0200001f, 0x90000000,
|
||||
0xa00f0802, 0x03000042, 0x800f0000, 0xb0e40000, 0xa0e40800, 0x03000042,
|
||||
0x800f0001, 0xb0e40000, 0xa0e40801, 0x03000042, 0x800f0002, 0xb0e40000,
|
||||
0xa0e40802, 0x02000001, 0x80020000, 0x80000001, 0x02000001, 0x80040000,
|
||||
0x80000002, 0x03000002, 0x80070000, 0x80e40000, 0xa0e40000, 0x03000008,
|
||||
0x80010001, 0x80e40000, 0xa0e40001, 0x03000008, 0x80020001, 0x80e40000,
|
||||
0xa0e40002, 0x0400005a, 0x80040001, 0x80e40000, 0xa0e40003, 0xa0aa0003,
|
||||
0x02000001, 0x80080001, 0xa0ff0000, 0x03000005, 0x800f0000, 0x80e40001,
|
||||
0x90e40000, 0x02000001, 0x800f0800, 0x80e40000, 0x0000ffff
|
||||
};
|
||||
|
||||
|
||||
static const DWORD *D3D9_shaders[] = {
|
||||
D3D9_PixelShader_YUV_JPEG,
|
||||
D3D9_PixelShader_YUV_BT601,
|
||||
D3D9_PixelShader_YUV_BT709,
|
||||
};
|
||||
|
||||
HRESULT D3D9_CreatePixelShader(IDirect3DDevice9 *d3dDevice, D3D9_Shader shader, IDirect3DPixelShader9 **pixelShader)
|
||||
{
|
||||
return IDirect3DDevice9_CreatePixelShader(d3dDevice, D3D9_shaders[shader], pixelShader);
|
||||
}
|
||||
|
||||
#endif /* SDL_VIDEO_RENDER_D3D && !SDL_RENDER_DISABLED */
|
||||
|
||||
/* vi: set ts=4 sw=4 expandtab: */
|
|
@ -18,11 +18,17 @@
|
|||
misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
*/
|
||||
#include "../SDL_internal.h"
|
||||
#include "../../SDL_internal.h"
|
||||
|
||||
/* FIXME: This breaks on various versions of GCC and should be rewritten using intrinsics */
|
||||
#if 0 /* (__GNUC__ > 2) && defined(__i386__) && __OPTIMIZE__ && SDL_ASSEMBLY_ROUTINES && !defined(__clang__) */
|
||||
#define USE_MMX_ASSEMBLY 1
|
||||
#endif
|
||||
/* D3D9 shader implementation */
|
||||
|
||||
typedef enum {
|
||||
SHADER_YUV_JPEG,
|
||||
SHADER_YUV_BT601,
|
||||
SHADER_YUV_BT709,
|
||||
NUM_SHADERS
|
||||
} D3D9_Shader;
|
||||
|
||||
extern HRESULT D3D9_CreatePixelShader(IDirect3DDevice9 *d3dDevice, D3D9_Shader shader, IDirect3DPixelShader9 **pixelShader);
|
||||
|
||||
/* vi: set ts=4 sw=4 expandtab: */
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,43 @@
|
|||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2017 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
arising from the use of this software.
|
||||
|
||||
Permission is granted to anyone to use this software for any purpose,
|
||||
including commercial applications, and to alter it and redistribute it
|
||||
freely, subject to the following restrictions:
|
||||
|
||||
1. The origin of this software must not be misrepresented; you must not
|
||||
claim that you wrote the original software. If you use this software
|
||||
in a product, an acknowledgment in the product documentation would be
|
||||
appreciated but is not required.
|
||||
2. Altered source versions must be plainly marked as such, and must not be
|
||||
misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
*/
|
||||
#include "../../SDL_internal.h"
|
||||
|
||||
/* D3D11 shader implementation */
|
||||
|
||||
typedef enum {
|
||||
SHADER_SOLID,
|
||||
SHADER_RGB,
|
||||
SHADER_YUV_JPEG,
|
||||
SHADER_YUV_BT601,
|
||||
SHADER_YUV_BT709,
|
||||
SHADER_NV12_JPEG,
|
||||
SHADER_NV12_BT601,
|
||||
SHADER_NV12_BT709,
|
||||
SHADER_NV21_JPEG,
|
||||
SHADER_NV21_BT601,
|
||||
SHADER_NV21_BT709,
|
||||
NUM_SHADERS
|
||||
} D3D11_Shader;
|
||||
|
||||
extern int D3D11_CreateVertexShader(ID3D11Device1 *d3dDevice, ID3D11VertexShader **vertexShader, ID3D11InputLayout **inputLayout);
|
||||
extern int D3D11_CreatePixelShader(ID3D11Device1 *d3dDevice, D3D11_Shader shader, ID3D11PixelShader **pixelShader);
|
||||
|
||||
/* vi: set ts=4 sw=4 expandtab: */
|
642
src/render/mmx.h
642
src/render/mmx.h
|
@ -1,642 +0,0 @@
|
|||
/* mmx.h
|
||||
|
||||
MultiMedia eXtensions GCC interface library for IA32.
|
||||
|
||||
To use this library, simply include this header file
|
||||
and compile with GCC. You MUST have inlining enabled
|
||||
in order for mmx_ok() to work; this can be done by
|
||||
simply using -O on the GCC command line.
|
||||
|
||||
Compiling with -DMMX_TRACE will cause detailed trace
|
||||
output to be sent to stderr for each mmx operation.
|
||||
This adds lots of code, and obviously slows execution to
|
||||
a crawl, but can be very useful for debugging.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY
|
||||
EXPRESS OR IMPLIED WARRANTIES, INCLUDING, WITHOUT
|
||||
LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
AND FITNESS FOR ANY PARTICULAR PURPOSE.
|
||||
|
||||
1997-99 by H. Dietz and R. Fisher
|
||||
|
||||
Notes:
|
||||
It appears that the latest gas has the pand problem fixed, therefore
|
||||
I'll undefine BROKEN_PAND by default.
|
||||
*/
|
||||
|
||||
#ifndef _MMX_H
|
||||
#define _MMX_H
|
||||
|
||||
|
||||
/* Warning: at this writing, the version of GAS packaged
|
||||
with most Linux distributions does not handle the
|
||||
parallel AND operation mnemonic correctly. If the
|
||||
symbol BROKEN_PAND is defined, a slower alternative
|
||||
coding will be used. If execution of mmxtest results
|
||||
in an illegal instruction fault, define this symbol.
|
||||
*/
|
||||
#undef BROKEN_PAND
|
||||
|
||||
|
||||
/* The type of an value that fits in an MMX register
|
||||
(note that long long constant values MUST be suffixed
|
||||
by LL and unsigned long long values by ULL, lest
|
||||
they be truncated by the compiler)
|
||||
*/
|
||||
typedef union
|
||||
{
|
||||
long long q; /* Quadword (64-bit) value */
|
||||
unsigned long long uq; /* Unsigned Quadword */
|
||||
int d[2]; /* 2 Doubleword (32-bit) values */
|
||||
unsigned int ud[2]; /* 2 Unsigned Doubleword */
|
||||
short w[4]; /* 4 Word (16-bit) values */
|
||||
unsigned short uw[4]; /* 4 Unsigned Word */
|
||||
char b[8]; /* 8 Byte (8-bit) values */
|
||||
unsigned char ub[8]; /* 8 Unsigned Byte */
|
||||
float s[2]; /* Single-precision (32-bit) value */
|
||||
} __attribute__ ((aligned(8))) mmx_t; /* On an 8-byte (64-bit) boundary */
|
||||
|
||||
|
||||
#if 0
|
||||
/* Function to test if multimedia instructions are supported...
|
||||
*/
|
||||
inline extern int
|
||||
mm_support(void)
|
||||
{
|
||||
/* Returns 1 if MMX instructions are supported,
|
||||
3 if Cyrix MMX and Extended MMX instructions are supported
|
||||
5 if AMD MMX and 3DNow! instructions are supported
|
||||
0 if hardware does not support any of these
|
||||
*/
|
||||
register int rval = 0;
|
||||
|
||||
__asm__ __volatile__(
|
||||
/* See if CPUID instruction is supported ... */
|
||||
/* ... Get copies of EFLAGS into eax and ecx */
|
||||
"pushf\n\t"
|
||||
"popl %%eax\n\t" "movl %%eax, %%ecx\n\t"
|
||||
/* ... Toggle the ID bit in one copy and store */
|
||||
/* to the EFLAGS reg */
|
||||
"xorl $0x200000, %%eax\n\t"
|
||||
"push %%eax\n\t" "popf\n\t"
|
||||
/* ... Get the (hopefully modified) EFLAGS */
|
||||
"pushf\n\t" "popl %%eax\n\t"
|
||||
/* ... Compare and test result */
|
||||
"xorl %%eax, %%ecx\n\t" "testl $0x200000, %%ecx\n\t" "jz NotSupported1\n\t" /* CPUID not supported */
|
||||
/* Get standard CPUID information, and
|
||||
go to a specific vendor section */
|
||||
"movl $0, %%eax\n\t" "cpuid\n\t"
|
||||
/* Check for Intel */
|
||||
"cmpl $0x756e6547, %%ebx\n\t"
|
||||
"jne TryAMD\n\t"
|
||||
"cmpl $0x49656e69, %%edx\n\t"
|
||||
"jne TryAMD\n\t"
|
||||
"cmpl $0x6c65746e, %%ecx\n"
|
||||
"jne TryAMD\n\t" "jmp Intel\n\t"
|
||||
/* Check for AMD */
|
||||
"\nTryAMD:\n\t"
|
||||
"cmpl $0x68747541, %%ebx\n\t"
|
||||
"jne TryCyrix\n\t"
|
||||
"cmpl $0x69746e65, %%edx\n\t"
|
||||
"jne TryCyrix\n\t"
|
||||
"cmpl $0x444d4163, %%ecx\n"
|
||||
"jne TryCyrix\n\t" "jmp AMD\n\t"
|
||||
/* Check for Cyrix */
|
||||
"\nTryCyrix:\n\t"
|
||||
"cmpl $0x69727943, %%ebx\n\t"
|
||||
"jne NotSupported2\n\t"
|
||||
"cmpl $0x736e4978, %%edx\n\t"
|
||||
"jne NotSupported3\n\t"
|
||||
"cmpl $0x64616574, %%ecx\n\t"
|
||||
"jne NotSupported4\n\t"
|
||||
/* Drop through to Cyrix... */
|
||||
/* Cyrix Section */
|
||||
/* See if extended CPUID level 80000001 is supported */
|
||||
/* The value of CPUID/80000001 for the 6x86MX is undefined
|
||||
according to the Cyrix CPU Detection Guide (Preliminary
|
||||
Rev. 1.01 table 1), so we'll check the value of eax for
|
||||
CPUID/0 to see if standard CPUID level 2 is supported.
|
||||
According to the table, the only CPU which supports level
|
||||
2 is also the only one which supports extended CPUID levels.
|
||||
*/
|
||||
"cmpl $0x2, %%eax\n\t" "jne MMXtest\n\t" /* Use standard CPUID instead */
|
||||
/* Extended CPUID supported (in theory), so get extended
|
||||
features */
|
||||
"movl $0x80000001, %%eax\n\t" "cpuid\n\t" "testl $0x00800000, %%eax\n\t" /* Test for MMX */
|
||||
"jz NotSupported5\n\t" /* MMX not supported */
|
||||
"testl $0x01000000, %%eax\n\t" /* Test for Ext'd MMX */
|
||||
"jnz EMMXSupported\n\t" "movl $1, %0:\n\n\t" /* MMX Supported */
|
||||
"jmp Return\n\n" "EMMXSupported:\n\t" "movl $3, %0:\n\n\t" /* EMMX and MMX Supported */
|
||||
"jmp Return\n\t"
|
||||
/* AMD Section */
|
||||
"AMD:\n\t"
|
||||
/* See if extended CPUID is supported */
|
||||
"movl $0x80000000, %%eax\n\t" "cpuid\n\t" "cmpl $0x80000000, %%eax\n\t" "jl MMXtest\n\t" /* Use standard CPUID instead */
|
||||
/* Extended CPUID supported, so get extended features */
|
||||
"movl $0x80000001, %%eax\n\t" "cpuid\n\t" "testl $0x00800000, %%edx\n\t" /* Test for MMX */
|
||||
"jz NotSupported6\n\t" /* MMX not supported */
|
||||
"testl $0x80000000, %%edx\n\t" /* Test for 3DNow! */
|
||||
"jnz ThreeDNowSupported\n\t" "movl $1, %0:\n\n\t" /* MMX Supported */
|
||||
"jmp Return\n\n" "ThreeDNowSupported:\n\t" "movl $5, %0:\n\n\t" /* 3DNow! and MMX Supported */
|
||||
"jmp Return\n\t"
|
||||
/* Intel Section */
|
||||
"Intel:\n\t"
|
||||
/* Check for MMX */
|
||||
"MMXtest:\n\t" "movl $1, %%eax\n\t" "cpuid\n\t" "testl $0x00800000, %%edx\n\t" /* Test for MMX */
|
||||
"jz NotSupported7\n\t" /* MMX Not supported */
|
||||
"movl $1, %0:\n\n\t" /* MMX Supported */
|
||||
"jmp Return\n\t"
|
||||
/* Nothing supported */
|
||||
"\nNotSupported1:\n\t" "#movl $101, %0:\n\n\t" "\nNotSupported2:\n\t" "#movl $102, %0:\n\n\t" "\nNotSupported3:\n\t" "#movl $103, %0:\n\n\t" "\nNotSupported4:\n\t" "#movl $104, %0:\n\n\t" "\nNotSupported5:\n\t" "#movl $105, %0:\n\n\t" "\nNotSupported6:\n\t" "#movl $106, %0:\n\n\t" "\nNotSupported7:\n\t" "#movl $107, %0:\n\n\t" "movl $0, %0:\n\n\t" "Return:\n\t":"=a"(rval): /* no input */
|
||||
:"eax", "ebx", "ecx", "edx");
|
||||
|
||||
/* Return */
|
||||
return (rval);
|
||||
}
|
||||
|
||||
/* Function to test if mmx instructions are supported...
|
||||
*/
|
||||
inline extern int
|
||||
mmx_ok(void)
|
||||
{
|
||||
/* Returns 1 if MMX instructions are supported, 0 otherwise */
|
||||
return (mm_support() & 0x1);
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Helper functions for the instruction macros that follow...
|
||||
(note that memory-to-register, m2r, instructions are nearly
|
||||
as efficient as register-to-register, r2r, instructions;
|
||||
however, memory-to-memory instructions are really simulated
|
||||
as a convenience, and are only 1/3 as efficient)
|
||||
*/
|
||||
#ifdef MMX_TRACE
|
||||
|
||||
/* Include the stuff for printing a trace to stderr...
|
||||
*/
|
||||
|
||||
#define mmx_i2r(op, imm, reg) \
|
||||
{ \
|
||||
mmx_t mmx_trace; \
|
||||
mmx_trace.uq = (imm); \
|
||||
printf(#op "_i2r(" #imm "=0x%08x%08x, ", \
|
||||
mmx_trace.d[1], mmx_trace.d[0]); \
|
||||
__asm__ __volatile__ ("movq %%" #reg ", %0" \
|
||||
: "=X" (mmx_trace) \
|
||||
: /* nothing */ ); \
|
||||
printf(#reg "=0x%08x%08x) => ", \
|
||||
mmx_trace.d[1], mmx_trace.d[0]); \
|
||||
__asm__ __volatile__ (#op " %0, %%" #reg \
|
||||
: /* nothing */ \
|
||||
: "X" (imm)); \
|
||||
__asm__ __volatile__ ("movq %%" #reg ", %0" \
|
||||
: "=X" (mmx_trace) \
|
||||
: /* nothing */ ); \
|
||||
printf(#reg "=0x%08x%08x\n", \
|
||||
mmx_trace.d[1], mmx_trace.d[0]); \
|
||||
}
|
||||
|
||||
#define mmx_m2r(op, mem, reg) \
|
||||
{ \
|
||||
mmx_t mmx_trace; \
|
||||
mmx_trace = (mem); \
|
||||
printf(#op "_m2r(" #mem "=0x%08x%08x, ", \
|
||||
mmx_trace.d[1], mmx_trace.d[0]); \
|
||||
__asm__ __volatile__ ("movq %%" #reg ", %0" \
|
||||
: "=X" (mmx_trace) \
|
||||
: /* nothing */ ); \
|
||||
printf(#reg "=0x%08x%08x) => ", \
|
||||
mmx_trace.d[1], mmx_trace.d[0]); \
|
||||
__asm__ __volatile__ (#op " %0, %%" #reg \
|
||||
: /* nothing */ \
|
||||
: "X" (mem)); \
|
||||
__asm__ __volatile__ ("movq %%" #reg ", %0" \
|
||||
: "=X" (mmx_trace) \
|
||||
: /* nothing */ ); \
|
||||
printf(#reg "=0x%08x%08x\n", \
|
||||
mmx_trace.d[1], mmx_trace.d[0]); \
|
||||
}
|
||||
|
||||
#define mmx_r2m(op, reg, mem) \
|
||||
{ \
|
||||
mmx_t mmx_trace; \
|
||||
__asm__ __volatile__ ("movq %%" #reg ", %0" \
|
||||
: "=X" (mmx_trace) \
|
||||
: /* nothing */ ); \
|
||||
printf(#op "_r2m(" #reg "=0x%08x%08x, ", \
|
||||
mmx_trace.d[1], mmx_trace.d[0]); \
|
||||
mmx_trace = (mem); \
|
||||
printf(#mem "=0x%08x%08x) => ", \
|
||||
mmx_trace.d[1], mmx_trace.d[0]); \
|
||||
__asm__ __volatile__ (#op " %%" #reg ", %0" \
|
||||
: "=X" (mem) \
|
||||
: /* nothing */ ); \
|
||||
mmx_trace = (mem); \
|
||||
printf(#mem "=0x%08x%08x\n", \
|
||||
mmx_trace.d[1], mmx_trace.d[0]); \
|
||||
}
|
||||
|
||||
#define mmx_r2r(op, regs, regd) \
|
||||
{ \
|
||||
mmx_t mmx_trace; \
|
||||
__asm__ __volatile__ ("movq %%" #regs ", %0" \
|
||||
: "=X" (mmx_trace) \
|
||||
: /* nothing */ ); \
|
||||
printf(#op "_r2r(" #regs "=0x%08x%08x, ", \
|
||||
mmx_trace.d[1], mmx_trace.d[0]); \
|
||||
__asm__ __volatile__ ("movq %%" #regd ", %0" \
|
||||
: "=X" (mmx_trace) \
|
||||
: /* nothing */ ); \
|
||||
printf(#regd "=0x%08x%08x) => ", \
|
||||
mmx_trace.d[1], mmx_trace.d[0]); \
|
||||
__asm__ __volatile__ (#op " %" #regs ", %" #regd); \
|
||||
__asm__ __volatile__ ("movq %%" #regd ", %0" \
|
||||
: "=X" (mmx_trace) \
|
||||
: /* nothing */ ); \
|
||||
printf(#regd "=0x%08x%08x\n", \
|
||||
mmx_trace.d[1], mmx_trace.d[0]); \
|
||||
}
|
||||
|
||||
#define mmx_m2m(op, mems, memd) \
|
||||
{ \
|
||||
mmx_t mmx_trace; \
|
||||
mmx_trace = (mems); \
|
||||
printf(#op "_m2m(" #mems "=0x%08x%08x, ", \
|
||||
mmx_trace.d[1], mmx_trace.d[0]); \
|
||||
mmx_trace = (memd); \
|
||||
printf(#memd "=0x%08x%08x) => ", \
|
||||
mmx_trace.d[1], mmx_trace.d[0]); \
|
||||
__asm__ __volatile__ ("movq %0, %%mm0\n\t" \
|
||||
#op " %1, %%mm0\n\t" \
|
||||
"movq %%mm0, %0" \
|
||||
: "=X" (memd) \
|
||||
: "X" (mems)); \
|
||||
mmx_trace = (memd); \
|
||||
printf(#memd "=0x%08x%08x\n", \
|
||||
mmx_trace.d[1], mmx_trace.d[0]); \
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
/* These macros are a lot simpler without the tracing...
|
||||
*/
|
||||
|
||||
#define mmx_i2r(op, imm, reg) \
|
||||
__asm__ __volatile__ (#op " %0, %%" #reg \
|
||||
: /* nothing */ \
|
||||
: "X" (imm) )
|
||||
|
||||
#define mmx_m2r(op, mem, reg) \
|
||||
__asm__ __volatile__ (#op " %0, %%" #reg \
|
||||
: /* nothing */ \
|
||||
: "m" (mem))
|
||||
|
||||
#define mmx_r2m(op, reg, mem) \
|
||||
__asm__ __volatile__ (#op " %%" #reg ", %0" \
|
||||
: "=m" (mem) \
|
||||
: /* nothing */ )
|
||||
|
||||
#define mmx_r2r(op, regs, regd) \
|
||||
__asm__ __volatile__ (#op " %" #regs ", %" #regd)
|
||||
|
||||
#define mmx_m2m(op, mems, memd) \
|
||||
__asm__ __volatile__ ("movq %0, %%mm0\n\t" \
|
||||
#op " %1, %%mm0\n\t" \
|
||||
"movq %%mm0, %0" \
|
||||
: "=X" (memd) \
|
||||
: "X" (mems))
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
/* 1x64 MOVe Quadword
|
||||
(this is both a load and a store...
|
||||
in fact, it is the only way to store)
|
||||
*/
|
||||
#define movq_m2r(var, reg) mmx_m2r(movq, var, reg)
|
||||
#define movq_r2m(reg, var) mmx_r2m(movq, reg, var)
|
||||
#define movq_r2r(regs, regd) mmx_r2r(movq, regs, regd)
|
||||
#define movq(vars, vard) \
|
||||
__asm__ __volatile__ ("movq %1, %%mm0\n\t" \
|
||||
"movq %%mm0, %0" \
|
||||
: "=X" (vard) \
|
||||
: "X" (vars))
|
||||
|
||||
|
||||
/* 1x32 MOVe Doubleword
|
||||
(like movq, this is both load and store...
|
||||
but is most useful for moving things between
|
||||
mmx registers and ordinary registers)
|
||||
*/
|
||||
#define movd_m2r(var, reg) mmx_m2r(movd, var, reg)
|
||||
#define movd_r2m(reg, var) mmx_r2m(movd, reg, var)
|
||||
#define movd_r2r(regs, regd) mmx_r2r(movd, regs, regd)
|
||||
#define movd(vars, vard) \
|
||||
__asm__ __volatile__ ("movd %1, %%mm0\n\t" \
|
||||
"movd %%mm0, %0" \
|
||||
: "=X" (vard) \
|
||||
: "X" (vars))
|
||||
|
||||
|
||||
/* 2x32, 4x16, and 8x8 Parallel ADDs
|
||||
*/
|
||||
#define paddd_m2r(var, reg) mmx_m2r(paddd, var, reg)
|
||||
#define paddd_r2r(regs, regd) mmx_r2r(paddd, regs, regd)
|
||||
#define paddd(vars, vard) mmx_m2m(paddd, vars, vard)
|
||||
|
||||
#define paddw_m2r(var, reg) mmx_m2r(paddw, var, reg)
|
||||
#define paddw_r2r(regs, regd) mmx_r2r(paddw, regs, regd)
|
||||
#define paddw(vars, vard) mmx_m2m(paddw, vars, vard)
|
||||
|
||||
#define paddb_m2r(var, reg) mmx_m2r(paddb, var, reg)
|
||||
#define paddb_r2r(regs, regd) mmx_r2r(paddb, regs, regd)
|
||||
#define paddb(vars, vard) mmx_m2m(paddb, vars, vard)
|
||||
|
||||
|
||||
/* 4x16 and 8x8 Parallel ADDs using Saturation arithmetic
|
||||
*/
|
||||
#define paddsw_m2r(var, reg) mmx_m2r(paddsw, var, reg)
|
||||
#define paddsw_r2r(regs, regd) mmx_r2r(paddsw, regs, regd)
|
||||
#define paddsw(vars, vard) mmx_m2m(paddsw, vars, vard)
|
||||
|
||||
#define paddsb_m2r(var, reg) mmx_m2r(paddsb, var, reg)
|
||||
#define paddsb_r2r(regs, regd) mmx_r2r(paddsb, regs, regd)
|
||||
#define paddsb(vars, vard) mmx_m2m(paddsb, vars, vard)
|
||||
|
||||
|
||||
/* 4x16 and 8x8 Parallel ADDs using Unsigned Saturation arithmetic
|
||||
*/
|
||||
#define paddusw_m2r(var, reg) mmx_m2r(paddusw, var, reg)
|
||||
#define paddusw_r2r(regs, regd) mmx_r2r(paddusw, regs, regd)
|
||||
#define paddusw(vars, vard) mmx_m2m(paddusw, vars, vard)
|
||||
|
||||
#define paddusb_m2r(var, reg) mmx_m2r(paddusb, var, reg)
|
||||
#define paddusb_r2r(regs, regd) mmx_r2r(paddusb, regs, regd)
|
||||
#define paddusb(vars, vard) mmx_m2m(paddusb, vars, vard)
|
||||
|
||||
|
||||
/* 2x32, 4x16, and 8x8 Parallel SUBs
|
||||
*/
|
||||
#define psubd_m2r(var, reg) mmx_m2r(psubd, var, reg)
|
||||
#define psubd_r2r(regs, regd) mmx_r2r(psubd, regs, regd)
|
||||
#define psubd(vars, vard) mmx_m2m(psubd, vars, vard)
|
||||
|
||||
#define psubw_m2r(var, reg) mmx_m2r(psubw, var, reg)
|
||||
#define psubw_r2r(regs, regd) mmx_r2r(psubw, regs, regd)
|
||||
#define psubw(vars, vard) mmx_m2m(psubw, vars, vard)
|
||||
|
||||
#define psubb_m2r(var, reg) mmx_m2r(psubb, var, reg)
|
||||
#define psubb_r2r(regs, regd) mmx_r2r(psubb, regs, regd)
|
||||
#define psubb(vars, vard) mmx_m2m(psubb, vars, vard)
|
||||
|
||||
|
||||
/* 4x16 and 8x8 Parallel SUBs using Saturation arithmetic
|
||||
*/
|
||||
#define psubsw_m2r(var, reg) mmx_m2r(psubsw, var, reg)
|
||||
#define psubsw_r2r(regs, regd) mmx_r2r(psubsw, regs, regd)
|
||||
#define psubsw(vars, vard) mmx_m2m(psubsw, vars, vard)
|
||||
|
||||
#define psubsb_m2r(var, reg) mmx_m2r(psubsb, var, reg)
|
||||
#define psubsb_r2r(regs, regd) mmx_r2r(psubsb, regs, regd)
|
||||
#define psubsb(vars, vard) mmx_m2m(psubsb, vars, vard)
|
||||
|
||||
|
||||
/* 4x16 and 8x8 Parallel SUBs using Unsigned Saturation arithmetic
|
||||
*/
|
||||
#define psubusw_m2r(var, reg) mmx_m2r(psubusw, var, reg)
|
||||
#define psubusw_r2r(regs, regd) mmx_r2r(psubusw, regs, regd)
|
||||
#define psubusw(vars, vard) mmx_m2m(psubusw, vars, vard)
|
||||
|
||||
#define psubusb_m2r(var, reg) mmx_m2r(psubusb, var, reg)
|
||||
#define psubusb_r2r(regs, regd) mmx_r2r(psubusb, regs, regd)
|
||||
#define psubusb(vars, vard) mmx_m2m(psubusb, vars, vard)
|
||||
|
||||
|
||||
/* 4x16 Parallel MULs giving Low 4x16 portions of results
|
||||
*/
|
||||
#define pmullw_m2r(var, reg) mmx_m2r(pmullw, var, reg)
|
||||
#define pmullw_r2r(regs, regd) mmx_r2r(pmullw, regs, regd)
|
||||
#define pmullw(vars, vard) mmx_m2m(pmullw, vars, vard)
|
||||
|
||||
|
||||
/* 4x16 Parallel MULs giving High 4x16 portions of results
|
||||
*/
|
||||
#define pmulhw_m2r(var, reg) mmx_m2r(pmulhw, var, reg)
|
||||
#define pmulhw_r2r(regs, regd) mmx_r2r(pmulhw, regs, regd)
|
||||
#define pmulhw(vars, vard) mmx_m2m(pmulhw, vars, vard)
|
||||
|
||||
|
||||
/* 4x16->2x32 Parallel Mul-ADD
|
||||
(muls like pmullw, then adds adjacent 16-bit fields
|
||||
in the multiply result to make the final 2x32 result)
|
||||
*/
|
||||
#define pmaddwd_m2r(var, reg) mmx_m2r(pmaddwd, var, reg)
|
||||
#define pmaddwd_r2r(regs, regd) mmx_r2r(pmaddwd, regs, regd)
|
||||
#define pmaddwd(vars, vard) mmx_m2m(pmaddwd, vars, vard)
|
||||
|
||||
|
||||
/* 1x64 bitwise AND
|
||||
*/
|
||||
#ifdef BROKEN_PAND
|
||||
#define pand_m2r(var, reg) \
|
||||
{ \
|
||||
mmx_m2r(pandn, (mmx_t) -1LL, reg); \
|
||||
mmx_m2r(pandn, var, reg); \
|
||||
}
|
||||
#define pand_r2r(regs, regd) \
|
||||
{ \
|
||||
mmx_m2r(pandn, (mmx_t) -1LL, regd); \
|
||||
mmx_r2r(pandn, regs, regd) \
|
||||
}
|
||||
#define pand(vars, vard) \
|
||||
{ \
|
||||
movq_m2r(vard, mm0); \
|
||||
mmx_m2r(pandn, (mmx_t) -1LL, mm0); \
|
||||
mmx_m2r(pandn, vars, mm0); \
|
||||
movq_r2m(mm0, vard); \
|
||||
}
|
||||
#else
|
||||
#define pand_m2r(var, reg) mmx_m2r(pand, var, reg)
|
||||
#define pand_r2r(regs, regd) mmx_r2r(pand, regs, regd)
|
||||
#define pand(vars, vard) mmx_m2m(pand, vars, vard)
|
||||
#endif
|
||||
|
||||
|
||||
/* 1x64 bitwise AND with Not the destination
|
||||
*/
|
||||
#define pandn_m2r(var, reg) mmx_m2r(pandn, var, reg)
|
||||
#define pandn_r2r(regs, regd) mmx_r2r(pandn, regs, regd)
|
||||
#define pandn(vars, vard) mmx_m2m(pandn, vars, vard)
|
||||
|
||||
|
||||
/* 1x64 bitwise OR
|
||||
*/
|
||||
#define por_m2r(var, reg) mmx_m2r(por, var, reg)
|
||||
#define por_r2r(regs, regd) mmx_r2r(por, regs, regd)
|
||||
#define por(vars, vard) mmx_m2m(por, vars, vard)
|
||||
|
||||
|
||||
/* 1x64 bitwise eXclusive OR
|
||||
*/
|
||||
#define pxor_m2r(var, reg) mmx_m2r(pxor, var, reg)
|
||||
#define pxor_r2r(regs, regd) mmx_r2r(pxor, regs, regd)
|
||||
#define pxor(vars, vard) mmx_m2m(pxor, vars, vard)
|
||||
|
||||
|
||||
/* 2x32, 4x16, and 8x8 Parallel CoMPare for EQuality
|
||||
(resulting fields are either 0 or -1)
|
||||
*/
|
||||
#define pcmpeqd_m2r(var, reg) mmx_m2r(pcmpeqd, var, reg)
|
||||
#define pcmpeqd_r2r(regs, regd) mmx_r2r(pcmpeqd, regs, regd)
|
||||
#define pcmpeqd(vars, vard) mmx_m2m(pcmpeqd, vars, vard)
|
||||
|
||||
#define pcmpeqw_m2r(var, reg) mmx_m2r(pcmpeqw, var, reg)
|
||||
#define pcmpeqw_r2r(regs, regd) mmx_r2r(pcmpeqw, regs, regd)
|
||||
#define pcmpeqw(vars, vard) mmx_m2m(pcmpeqw, vars, vard)
|
||||
|
||||
#define pcmpeqb_m2r(var, reg) mmx_m2r(pcmpeqb, var, reg)
|
||||
#define pcmpeqb_r2r(regs, regd) mmx_r2r(pcmpeqb, regs, regd)
|
||||
#define pcmpeqb(vars, vard) mmx_m2m(pcmpeqb, vars, vard)
|
||||
|
||||
|
||||
/* 2x32, 4x16, and 8x8 Parallel CoMPare for Greater Than
|
||||
(resulting fields are either 0 or -1)
|
||||
*/
|
||||
#define pcmpgtd_m2r(var, reg) mmx_m2r(pcmpgtd, var, reg)
|
||||
#define pcmpgtd_r2r(regs, regd) mmx_r2r(pcmpgtd, regs, regd)
|
||||
#define pcmpgtd(vars, vard) mmx_m2m(pcmpgtd, vars, vard)
|
||||
|
||||
#define pcmpgtw_m2r(var, reg) mmx_m2r(pcmpgtw, var, reg)
|
||||
#define pcmpgtw_r2r(regs, regd) mmx_r2r(pcmpgtw, regs, regd)
|
||||
#define pcmpgtw(vars, vard) mmx_m2m(pcmpgtw, vars, vard)
|
||||
|
||||
#define pcmpgtb_m2r(var, reg) mmx_m2r(pcmpgtb, var, reg)
|
||||
#define pcmpgtb_r2r(regs, regd) mmx_r2r(pcmpgtb, regs, regd)
|
||||
#define pcmpgtb(vars, vard) mmx_m2m(pcmpgtb, vars, vard)
|
||||
|
||||
|
||||
/* 1x64, 2x32, and 4x16 Parallel Shift Left Logical
|
||||
*/
|
||||
#define psllq_i2r(imm, reg) mmx_i2r(psllq, imm, reg)
|
||||
#define psllq_m2r(var, reg) mmx_m2r(psllq, var, reg)
|
||||
#define psllq_r2r(regs, regd) mmx_r2r(psllq, regs, regd)
|
||||
#define psllq(vars, vard) mmx_m2m(psllq, vars, vard)
|
||||
|
||||
#define pslld_i2r(imm, reg) mmx_i2r(pslld, imm, reg)
|
||||
#define pslld_m2r(var, reg) mmx_m2r(pslld, var, reg)
|
||||
#define pslld_r2r(regs, regd) mmx_r2r(pslld, regs, regd)
|
||||
#define pslld(vars, vard) mmx_m2m(pslld, vars, vard)
|
||||
|
||||
#define psllw_i2r(imm, reg) mmx_i2r(psllw, imm, reg)
|
||||
#define psllw_m2r(var, reg) mmx_m2r(psllw, var, reg)
|
||||
#define psllw_r2r(regs, regd) mmx_r2r(psllw, regs, regd)
|
||||
#define psllw(vars, vard) mmx_m2m(psllw, vars, vard)
|
||||
|
||||
|
||||
/* 1x64, 2x32, and 4x16 Parallel Shift Right Logical
|
||||
*/
|
||||
#define psrlq_i2r(imm, reg) mmx_i2r(psrlq, imm, reg)
|
||||
#define psrlq_m2r(var, reg) mmx_m2r(psrlq, var, reg)
|
||||
#define psrlq_r2r(regs, regd) mmx_r2r(psrlq, regs, regd)
|
||||
#define psrlq(vars, vard) mmx_m2m(psrlq, vars, vard)
|
||||
|
||||
#define psrld_i2r(imm, reg) mmx_i2r(psrld, imm, reg)
|
||||
#define psrld_m2r(var, reg) mmx_m2r(psrld, var, reg)
|
||||
#define psrld_r2r(regs, regd) mmx_r2r(psrld, regs, regd)
|
||||
#define psrld(vars, vard) mmx_m2m(psrld, vars, vard)
|
||||
|
||||
#define psrlw_i2r(imm, reg) mmx_i2r(psrlw, imm, reg)
|
||||
#define psrlw_m2r(var, reg) mmx_m2r(psrlw, var, reg)
|
||||
#define psrlw_r2r(regs, regd) mmx_r2r(psrlw, regs, regd)
|
||||
#define psrlw(vars, vard) mmx_m2m(psrlw, vars, vard)
|
||||
|
||||
|
||||
/* 2x32 and 4x16 Parallel Shift Right Arithmetic
|
||||
*/
|
||||
#define psrad_i2r(imm, reg) mmx_i2r(psrad, imm, reg)
|
||||
#define psrad_m2r(var, reg) mmx_m2r(psrad, var, reg)
|
||||
#define psrad_r2r(regs, regd) mmx_r2r(psrad, regs, regd)
|
||||
#define psrad(vars, vard) mmx_m2m(psrad, vars, vard)
|
||||
|
||||
#define psraw_i2r(imm, reg) mmx_i2r(psraw, imm, reg)
|
||||
#define psraw_m2r(var, reg) mmx_m2r(psraw, var, reg)
|
||||
#define psraw_r2r(regs, regd) mmx_r2r(psraw, regs, regd)
|
||||
#define psraw(vars, vard) mmx_m2m(psraw, vars, vard)
|
||||
|
||||
|
||||
/* 2x32->4x16 and 4x16->8x8 PACK and Signed Saturate
|
||||
(packs source and dest fields into dest in that order)
|
||||
*/
|
||||
#define packssdw_m2r(var, reg) mmx_m2r(packssdw, var, reg)
|
||||
#define packssdw_r2r(regs, regd) mmx_r2r(packssdw, regs, regd)
|
||||
#define packssdw(vars, vard) mmx_m2m(packssdw, vars, vard)
|
||||
|
||||
#define packsswb_m2r(var, reg) mmx_m2r(packsswb, var, reg)
|
||||
#define packsswb_r2r(regs, regd) mmx_r2r(packsswb, regs, regd)
|
||||
#define packsswb(vars, vard) mmx_m2m(packsswb, vars, vard)
|
||||
|
||||
|
||||
/* 4x16->8x8 PACK and Unsigned Saturate
|
||||
(packs source and dest fields into dest in that order)
|
||||
*/
|
||||
#define packuswb_m2r(var, reg) mmx_m2r(packuswb, var, reg)
|
||||
#define packuswb_r2r(regs, regd) mmx_r2r(packuswb, regs, regd)
|
||||
#define packuswb(vars, vard) mmx_m2m(packuswb, vars, vard)
|
||||
|
||||
|
||||
/* 2x32->1x64, 4x16->2x32, and 8x8->4x16 UNPaCK Low
|
||||
(interleaves low half of dest with low half of source
|
||||
as padding in each result field)
|
||||
*/
|
||||
#define punpckldq_m2r(var, reg) mmx_m2r(punpckldq, var, reg)
|
||||
#define punpckldq_r2r(regs, regd) mmx_r2r(punpckldq, regs, regd)
|
||||
#define punpckldq(vars, vard) mmx_m2m(punpckldq, vars, vard)
|
||||
|
||||
#define punpcklwd_m2r(var, reg) mmx_m2r(punpcklwd, var, reg)
|
||||
#define punpcklwd_r2r(regs, regd) mmx_r2r(punpcklwd, regs, regd)
|
||||
#define punpcklwd(vars, vard) mmx_m2m(punpcklwd, vars, vard)
|
||||
|
||||
#define punpcklbw_m2r(var, reg) mmx_m2r(punpcklbw, var, reg)
|
||||
#define punpcklbw_r2r(regs, regd) mmx_r2r(punpcklbw, regs, regd)
|
||||
#define punpcklbw(vars, vard) mmx_m2m(punpcklbw, vars, vard)
|
||||
|
||||
|
||||
/* 2x32->1x64, 4x16->2x32, and 8x8->4x16 UNPaCK High
|
||||
(interleaves high half of dest with high half of source
|
||||
as padding in each result field)
|
||||
*/
|
||||
#define punpckhdq_m2r(var, reg) mmx_m2r(punpckhdq, var, reg)
|
||||
#define punpckhdq_r2r(regs, regd) mmx_r2r(punpckhdq, regs, regd)
|
||||
#define punpckhdq(vars, vard) mmx_m2m(punpckhdq, vars, vard)
|
||||
|
||||
#define punpckhwd_m2r(var, reg) mmx_m2r(punpckhwd, var, reg)
|
||||
#define punpckhwd_r2r(regs, regd) mmx_r2r(punpckhwd, regs, regd)
|
||||
#define punpckhwd(vars, vard) mmx_m2m(punpckhwd, vars, vard)
|
||||
|
||||
#define punpckhbw_m2r(var, reg) mmx_m2r(punpckhbw, var, reg)
|
||||
#define punpckhbw_r2r(regs, regd) mmx_r2r(punpckhbw, regs, regd)
|
||||
#define punpckhbw(vars, vard) mmx_m2m(punpckhbw, vars, vard)
|
||||
|
||||
|
||||
/* Empty MMx State
|
||||
(used to clean-up when going from mmx to float use
|
||||
of the registers that are shared by both; note that
|
||||
there is no float-to-mmx operation needed, because
|
||||
only the float tag word info is corruptible)
|
||||
*/
|
||||
#ifdef MMX_TRACE
|
||||
|
||||
#define emms() \
|
||||
{ \
|
||||
printf("emms()\n"); \
|
||||
__asm__ __volatile__ ("emms"); \
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
#define emms() __asm__ __volatile__ ("emms")
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
/* vi: set ts=4 sw=4 expandtab: */
|
|
@ -1349,13 +1349,37 @@ GL_SetupCopy(SDL_Renderer * renderer, SDL_Texture * texture)
|
|||
|
||||
GL_SetBlendMode(data, texture->blendMode);
|
||||
|
||||
if (texturedata->yuv) {
|
||||
GL_SetShader(data, SHADER_YUV);
|
||||
} else if (texturedata->nv12) {
|
||||
if (texture->format == SDL_PIXELFORMAT_NV12) {
|
||||
GL_SetShader(data, SHADER_NV12);
|
||||
} else {
|
||||
GL_SetShader(data, SHADER_NV21);
|
||||
if (texturedata->yuv || texturedata->nv12) {
|
||||
switch (SDL_GetYUVConversionModeForResolution(texture->w, texture->h)) {
|
||||
case SDL_YUV_CONVERSION_JPEG:
|
||||
if (texturedata->yuv) {
|
||||
GL_SetShader(data, SHADER_YUV_JPEG);
|
||||
} else if (texture->format == SDL_PIXELFORMAT_NV12) {
|
||||
GL_SetShader(data, SHADER_NV12_JPEG);
|
||||
} else {
|
||||
GL_SetShader(data, SHADER_NV21_JPEG);
|
||||
}
|
||||
break;
|
||||
case SDL_YUV_CONVERSION_BT601:
|
||||
if (texturedata->yuv) {
|
||||
GL_SetShader(data, SHADER_YUV_BT601);
|
||||
} else if (texture->format == SDL_PIXELFORMAT_NV12) {
|
||||
GL_SetShader(data, SHADER_NV12_BT601);
|
||||
} else {
|
||||
GL_SetShader(data, SHADER_NV21_BT601);
|
||||
}
|
||||
break;
|
||||
case SDL_YUV_CONVERSION_BT709:
|
||||
if (texturedata->yuv) {
|
||||
GL_SetShader(data, SHADER_YUV_BT709);
|
||||
} else if (texture->format == SDL_PIXELFORMAT_NV12) {
|
||||
GL_SetShader(data, SHADER_NV12_BT709);
|
||||
} else {
|
||||
GL_SetShader(data, SHADER_NV21_BT709);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
return SDL_SetError("Unsupported YUV conversion mode");
|
||||
}
|
||||
} else {
|
||||
GL_SetShader(data, SHADER_RGB);
|
||||
|
|
|
@ -62,6 +62,151 @@ struct GL_ShaderContext
|
|||
GL_ShaderData shaders[NUM_SHADERS];
|
||||
};
|
||||
|
||||
#define COLOR_VERTEX_SHADER \
|
||||
"varying vec4 v_color;\n" \
|
||||
"\n" \
|
||||
"void main()\n" \
|
||||
"{\n" \
|
||||
" gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;\n" \
|
||||
" v_color = gl_Color;\n" \
|
||||
"}" \
|
||||
|
||||
#define TEXTURE_VERTEX_SHADER \
|
||||
"varying vec4 v_color;\n" \
|
||||
"varying vec2 v_texCoord;\n" \
|
||||
"\n" \
|
||||
"void main()\n" \
|
||||
"{\n" \
|
||||
" gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;\n" \
|
||||
" v_color = gl_Color;\n" \
|
||||
" v_texCoord = vec2(gl_MultiTexCoord0);\n" \
|
||||
"}" \
|
||||
|
||||
#define JPEG_SHADER_CONSTANTS \
|
||||
"// YUV offset \n" \
|
||||
"const vec3 offset = vec3(0, -0.501960814, -0.501960814);\n" \
|
||||
"\n" \
|
||||
"// RGB coefficients \n" \
|
||||
"const vec3 Rcoeff = vec3(1, 0.000, 1.402);\n" \
|
||||
"const vec3 Gcoeff = vec3(1, -0.3441, -0.7141);\n" \
|
||||
"const vec3 Bcoeff = vec3(1, 1.772, 0.000);\n" \
|
||||
|
||||
#define BT601_SHADER_CONSTANTS \
|
||||
"// YUV offset \n" \
|
||||
"const vec3 offset = vec3(-0.0627451017, -0.501960814, -0.501960814);\n" \
|
||||
"\n" \
|
||||
"// RGB coefficients \n" \
|
||||
"const vec3 Rcoeff = vec3(1.1644, 0.000, 1.596);\n" \
|
||||
"const vec3 Gcoeff = vec3(1.1644, -0.3918, -0.813);\n" \
|
||||
"const vec3 Bcoeff = vec3(1.1644, 2.0172, 0.000);\n" \
|
||||
|
||||
#define BT709_SHADER_CONSTANTS \
|
||||
"// YUV offset \n" \
|
||||
"const vec3 offset = vec3(-0.0627451017, -0.501960814, -0.501960814);\n" \
|
||||
"\n" \
|
||||
"// RGB coefficients \n" \
|
||||
"const vec3 Rcoeff = vec3(1.1644, 0.000, 1.7927);\n" \
|
||||
"const vec3 Gcoeff = vec3(1.1644, -0.2132, -0.5329);\n" \
|
||||
"const vec3 Bcoeff = vec3(1.1644, 2.1124, 0.000);\n" \
|
||||
|
||||
#define YUV_SHADER_PROLOGUE \
|
||||
"varying vec4 v_color;\n" \
|
||||
"varying vec2 v_texCoord;\n" \
|
||||
"uniform sampler2D tex0; // Y \n" \
|
||||
"uniform sampler2D tex1; // U \n" \
|
||||
"uniform sampler2D tex2; // V \n" \
|
||||
"\n" \
|
||||
|
||||
#define YUV_SHADER_BODY \
|
||||
"\n" \
|
||||
"void main()\n" \
|
||||
"{\n" \
|
||||
" vec2 tcoord;\n" \
|
||||
" vec3 yuv, rgb;\n" \
|
||||
"\n" \
|
||||
" // Get the Y value \n" \
|
||||
" tcoord = v_texCoord;\n" \
|
||||
" yuv.x = texture2D(tex0, tcoord).r;\n" \
|
||||
"\n" \
|
||||
" // Get the U and V values \n" \
|
||||
" tcoord *= UVCoordScale;\n" \
|
||||
" yuv.y = texture2D(tex1, tcoord).r;\n" \
|
||||
" yuv.z = texture2D(tex2, tcoord).r;\n" \
|
||||
"\n" \
|
||||
" // Do the color transform \n" \
|
||||
" yuv += offset;\n" \
|
||||
" rgb.r = dot(yuv, Rcoeff);\n" \
|
||||
" rgb.g = dot(yuv, Gcoeff);\n" \
|
||||
" rgb.b = dot(yuv, Bcoeff);\n" \
|
||||
"\n" \
|
||||
" // That was easy. :) \n" \
|
||||
" gl_FragColor = vec4(rgb, 1.0) * v_color;\n" \
|
||||
"}" \
|
||||
|
||||
#define NV12_SHADER_PROLOGUE \
|
||||
"varying vec4 v_color;\n" \
|
||||
"varying vec2 v_texCoord;\n" \
|
||||
"uniform sampler2D tex0; // Y \n" \
|
||||
"uniform sampler2D tex1; // U/V \n" \
|
||||
"\n" \
|
||||
|
||||
#define NV12_SHADER_BODY \
|
||||
"\n" \
|
||||
"void main()\n" \
|
||||
"{\n" \
|
||||
" vec2 tcoord;\n" \
|
||||
" vec3 yuv, rgb;\n" \
|
||||
"\n" \
|
||||
" // Get the Y value \n" \
|
||||
" tcoord = v_texCoord;\n" \
|
||||
" yuv.x = texture2D(tex0, tcoord).r;\n" \
|
||||
"\n" \
|
||||
" // Get the U and V values \n" \
|
||||
" tcoord *= UVCoordScale;\n" \
|
||||
" yuv.yz = texture2D(tex1, tcoord).ra;\n" \
|
||||
"\n" \
|
||||
" // Do the color transform \n" \
|
||||
" yuv += offset;\n" \
|
||||
" rgb.r = dot(yuv, Rcoeff);\n" \
|
||||
" rgb.g = dot(yuv, Gcoeff);\n" \
|
||||
" rgb.b = dot(yuv, Bcoeff);\n" \
|
||||
"\n" \
|
||||
" // That was easy. :) \n" \
|
||||
" gl_FragColor = vec4(rgb, 1.0) * v_color;\n" \
|
||||
"}" \
|
||||
|
||||
#define NV21_SHADER_PROLOGUE \
|
||||
"varying vec4 v_color;\n" \
|
||||
"varying vec2 v_texCoord;\n" \
|
||||
"uniform sampler2D tex0; // Y \n" \
|
||||
"uniform sampler2D tex1; // U/V \n" \
|
||||
"\n" \
|
||||
|
||||
#define NV21_SHADER_BODY \
|
||||
"\n" \
|
||||
"void main()\n" \
|
||||
"{\n" \
|
||||
" vec2 tcoord;\n" \
|
||||
" vec3 yuv, rgb;\n" \
|
||||
"\n" \
|
||||
" // Get the Y value \n" \
|
||||
" tcoord = v_texCoord;\n" \
|
||||
" yuv.x = texture2D(tex0, tcoord).r;\n" \
|
||||
"\n" \
|
||||
" // Get the U and V values \n" \
|
||||
" tcoord *= UVCoordScale;\n" \
|
||||
" yuv.yz = texture2D(tex1, tcoord).ar;\n" \
|
||||
"\n" \
|
||||
" // Do the color transform \n" \
|
||||
" yuv += offset;\n" \
|
||||
" rgb.r = dot(yuv, Rcoeff);\n" \
|
||||
" rgb.g = dot(yuv, Gcoeff);\n" \
|
||||
" rgb.b = dot(yuv, Bcoeff);\n" \
|
||||
"\n" \
|
||||
" // That was easy. :) \n" \
|
||||
" gl_FragColor = vec4(rgb, 1.0) * v_color;\n" \
|
||||
"}" \
|
||||
|
||||
/*
|
||||
* NOTE: Always use sampler2D, etc here. We'll #define them to the
|
||||
* texture_rectangle versions if we choose to use that extension.
|
||||
|
@ -74,13 +219,7 @@ static const char *shader_source[NUM_SHADERS][2] =
|
|||
/* SHADER_SOLID */
|
||||
{
|
||||
/* vertex shader */
|
||||
"varying vec4 v_color;\n"
|
||||
"\n"
|
||||
"void main()\n"
|
||||
"{\n"
|
||||
" gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;\n"
|
||||
" v_color = gl_Color;\n"
|
||||
"}",
|
||||
COLOR_VERTEX_SHADER,
|
||||
/* fragment shader */
|
||||
"varying vec4 v_color;\n"
|
||||
"\n"
|
||||
|
@ -93,15 +232,7 @@ static const char *shader_source[NUM_SHADERS][2] =
|
|||
/* SHADER_RGB */
|
||||
{
|
||||
/* vertex shader */
|
||||
"varying vec4 v_color;\n"
|
||||
"varying vec2 v_texCoord;\n"
|
||||
"\n"
|
||||
"void main()\n"
|
||||
"{\n"
|
||||
" gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;\n"
|
||||
" v_color = gl_Color;\n"
|
||||
" v_texCoord = vec2(gl_MultiTexCoord0);\n"
|
||||
"}",
|
||||
TEXTURE_VERTEX_SHADER,
|
||||
/* fragment shader */
|
||||
"varying vec4 v_color;\n"
|
||||
"varying vec2 v_texCoord;\n"
|
||||
|
@ -113,156 +244,86 @@ static const char *shader_source[NUM_SHADERS][2] =
|
|||
"}"
|
||||
},
|
||||
|
||||
/* SHADER_YUV */
|
||||
/* SHADER_YUV_JPEG */
|
||||
{
|
||||
/* vertex shader */
|
||||
"varying vec4 v_color;\n"
|
||||
"varying vec2 v_texCoord;\n"
|
||||
"\n"
|
||||
"void main()\n"
|
||||
"{\n"
|
||||
" gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;\n"
|
||||
" v_color = gl_Color;\n"
|
||||
" v_texCoord = vec2(gl_MultiTexCoord0);\n"
|
||||
"}",
|
||||
TEXTURE_VERTEX_SHADER,
|
||||
/* fragment shader */
|
||||
"varying vec4 v_color;\n"
|
||||
"varying vec2 v_texCoord;\n"
|
||||
"uniform sampler2D tex0; // Y \n"
|
||||
"uniform sampler2D tex1; // U \n"
|
||||
"uniform sampler2D tex2; // V \n"
|
||||
"\n"
|
||||
"// YUV offset \n"
|
||||
"const vec3 offset = vec3(-0.0627451017, -0.501960814, -0.501960814);\n"
|
||||
"\n"
|
||||
"// RGB coefficients \n"
|
||||
"const vec3 Rcoeff = vec3(1.164, 0.000, 1.596);\n"
|
||||
"const vec3 Gcoeff = vec3(1.164, -0.391, -0.813);\n"
|
||||
"const vec3 Bcoeff = vec3(1.164, 2.018, 0.000);\n"
|
||||
"\n"
|
||||
"void main()\n"
|
||||
"{\n"
|
||||
" vec2 tcoord;\n"
|
||||
" vec3 yuv, rgb;\n"
|
||||
"\n"
|
||||
" // Get the Y value \n"
|
||||
" tcoord = v_texCoord;\n"
|
||||
" yuv.x = texture2D(tex0, tcoord).r;\n"
|
||||
"\n"
|
||||
" // Get the U and V values \n"
|
||||
" tcoord *= UVCoordScale;\n"
|
||||
" yuv.y = texture2D(tex1, tcoord).r;\n"
|
||||
" yuv.z = texture2D(tex2, tcoord).r;\n"
|
||||
"\n"
|
||||
" // Do the color transform \n"
|
||||
" yuv += offset;\n"
|
||||
" rgb.r = dot(yuv, Rcoeff);\n"
|
||||
" rgb.g = dot(yuv, Gcoeff);\n"
|
||||
" rgb.b = dot(yuv, Bcoeff);\n"
|
||||
"\n"
|
||||
" // That was easy. :) \n"
|
||||
" gl_FragColor = vec4(rgb, 1.0) * v_color;\n"
|
||||
"}"
|
||||
YUV_SHADER_PROLOGUE
|
||||
JPEG_SHADER_CONSTANTS
|
||||
YUV_SHADER_BODY
|
||||
},
|
||||
|
||||
/* SHADER_NV12 */
|
||||
/* SHADER_YUV_BT601 */
|
||||
{
|
||||
/* vertex shader */
|
||||
"varying vec4 v_color;\n"
|
||||
"varying vec2 v_texCoord;\n"
|
||||
"\n"
|
||||
"void main()\n"
|
||||
"{\n"
|
||||
" gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;\n"
|
||||
" v_color = gl_Color;\n"
|
||||
" v_texCoord = vec2(gl_MultiTexCoord0);\n"
|
||||
"}",
|
||||
TEXTURE_VERTEX_SHADER,
|
||||
/* fragment shader */
|
||||
"varying vec4 v_color;\n"
|
||||
"varying vec2 v_texCoord;\n"
|
||||
"uniform sampler2D tex0; // Y \n"
|
||||
"uniform sampler2D tex1; // U/V \n"
|
||||
"\n"
|
||||
"// YUV offset \n"
|
||||
"const vec3 offset = vec3(-0.0627451017, -0.501960814, -0.501960814);\n"
|
||||
"\n"
|
||||
"// RGB coefficients \n"
|
||||
"const vec3 Rcoeff = vec3(1.164, 0.000, 1.596);\n"
|
||||
"const vec3 Gcoeff = vec3(1.164, -0.391, -0.813);\n"
|
||||
"const vec3 Bcoeff = vec3(1.164, 2.018, 0.000);\n"
|
||||
"\n"
|
||||
"void main()\n"
|
||||
"{\n"
|
||||
" vec2 tcoord;\n"
|
||||
" vec3 yuv, rgb;\n"
|
||||
"\n"
|
||||
" // Get the Y value \n"
|
||||
" tcoord = v_texCoord;\n"
|
||||
" yuv.x = texture2D(tex0, tcoord).r;\n"
|
||||
"\n"
|
||||
" // Get the U and V values \n"
|
||||
" tcoord *= UVCoordScale;\n"
|
||||
" yuv.yz = texture2D(tex1, tcoord).ra;\n"
|
||||
"\n"
|
||||
" // Do the color transform \n"
|
||||
" yuv += offset;\n"
|
||||
" rgb.r = dot(yuv, Rcoeff);\n"
|
||||
" rgb.g = dot(yuv, Gcoeff);\n"
|
||||
" rgb.b = dot(yuv, Bcoeff);\n"
|
||||
"\n"
|
||||
" // That was easy. :) \n"
|
||||
" gl_FragColor = vec4(rgb, 1.0) * v_color;\n"
|
||||
"}"
|
||||
YUV_SHADER_PROLOGUE
|
||||
BT601_SHADER_CONSTANTS
|
||||
YUV_SHADER_BODY
|
||||
},
|
||||
|
||||
/* SHADER_NV21 */
|
||||
/* SHADER_YUV_BT709 */
|
||||
{
|
||||
/* vertex shader */
|
||||
"varying vec4 v_color;\n"
|
||||
"varying vec2 v_texCoord;\n"
|
||||
"\n"
|
||||
"void main()\n"
|
||||
"{\n"
|
||||
" gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;\n"
|
||||
" v_color = gl_Color;\n"
|
||||
" v_texCoord = vec2(gl_MultiTexCoord0);\n"
|
||||
"}",
|
||||
TEXTURE_VERTEX_SHADER,
|
||||
/* fragment shader */
|
||||
"varying vec4 v_color;\n"
|
||||
"varying vec2 v_texCoord;\n"
|
||||
"uniform sampler2D tex0; // Y \n"
|
||||
"uniform sampler2D tex1; // U/V \n"
|
||||
"\n"
|
||||
"// YUV offset \n"
|
||||
"const vec3 offset = vec3(-0.0627451017, -0.501960814, -0.501960814);\n"
|
||||
"\n"
|
||||
"// RGB coefficients \n"
|
||||
"const vec3 Rcoeff = vec3(1.164, 0.000, 1.596);\n"
|
||||
"const vec3 Gcoeff = vec3(1.164, -0.391, -0.813);\n"
|
||||
"const vec3 Bcoeff = vec3(1.164, 2.018, 0.000);\n"
|
||||
"\n"
|
||||
"void main()\n"
|
||||
"{\n"
|
||||
" vec2 tcoord;\n"
|
||||
" vec3 yuv, rgb;\n"
|
||||
"\n"
|
||||
" // Get the Y value \n"
|
||||
" tcoord = v_texCoord;\n"
|
||||
" yuv.x = texture2D(tex0, tcoord).r;\n"
|
||||
"\n"
|
||||
" // Get the U and V values \n"
|
||||
" tcoord *= UVCoordScale;\n"
|
||||
" yuv.yz = texture2D(tex1, tcoord).ar;\n"
|
||||
"\n"
|
||||
" // Do the color transform \n"
|
||||
" yuv += offset;\n"
|
||||
" rgb.r = dot(yuv, Rcoeff);\n"
|
||||
" rgb.g = dot(yuv, Gcoeff);\n"
|
||||
" rgb.b = dot(yuv, Bcoeff);\n"
|
||||
"\n"
|
||||
" // That was easy. :) \n"
|
||||
" gl_FragColor = vec4(rgb, 1.0) * v_color;\n"
|
||||
"}"
|
||||
YUV_SHADER_PROLOGUE
|
||||
BT709_SHADER_CONSTANTS
|
||||
YUV_SHADER_BODY
|
||||
},
|
||||
/* SHADER_NV12_JPEG */
|
||||
{
|
||||
/* vertex shader */
|
||||
TEXTURE_VERTEX_SHADER,
|
||||
/* fragment shader */
|
||||
NV12_SHADER_PROLOGUE
|
||||
JPEG_SHADER_CONSTANTS
|
||||
NV12_SHADER_BODY
|
||||
},
|
||||
/* SHADER_NV12_BT601 */
|
||||
{
|
||||
/* vertex shader */
|
||||
TEXTURE_VERTEX_SHADER,
|
||||
/* fragment shader */
|
||||
NV12_SHADER_PROLOGUE
|
||||
BT601_SHADER_CONSTANTS
|
||||
NV12_SHADER_BODY
|
||||
},
|
||||
/* SHADER_NV12_BT709 */
|
||||
{
|
||||
/* vertex shader */
|
||||
TEXTURE_VERTEX_SHADER,
|
||||
/* fragment shader */
|
||||
NV12_SHADER_PROLOGUE
|
||||
BT709_SHADER_CONSTANTS
|
||||
NV12_SHADER_BODY
|
||||
},
|
||||
/* SHADER_NV21_JPEG */
|
||||
{
|
||||
/* vertex shader */
|
||||
TEXTURE_VERTEX_SHADER,
|
||||
/* fragment shader */
|
||||
NV21_SHADER_PROLOGUE
|
||||
JPEG_SHADER_CONSTANTS
|
||||
NV21_SHADER_BODY
|
||||
},
|
||||
/* SHADER_NV21_BT601 */
|
||||
{
|
||||
/* vertex shader */
|
||||
TEXTURE_VERTEX_SHADER,
|
||||
/* fragment shader */
|
||||
NV21_SHADER_PROLOGUE
|
||||
BT601_SHADER_CONSTANTS
|
||||
NV21_SHADER_BODY
|
||||
},
|
||||
/* SHADER_NV21_BT709 */
|
||||
{
|
||||
/* vertex shader */
|
||||
TEXTURE_VERTEX_SHADER,
|
||||
/* fragment shader */
|
||||
NV21_SHADER_PROLOGUE
|
||||
BT709_SHADER_CONSTANTS
|
||||
NV21_SHADER_BODY
|
||||
},
|
||||
};
|
||||
|
||||
|
|
|
@ -26,9 +26,15 @@ typedef enum {
|
|||
SHADER_NONE,
|
||||
SHADER_SOLID,
|
||||
SHADER_RGB,
|
||||
SHADER_YUV,
|
||||
SHADER_NV12,
|
||||
SHADER_NV21,
|
||||
SHADER_YUV_JPEG,
|
||||
SHADER_YUV_BT601,
|
||||
SHADER_YUV_BT709,
|
||||
SHADER_NV12_JPEG,
|
||||
SHADER_NV12_BT601,
|
||||
SHADER_NV12_BT709,
|
||||
SHADER_NV21_JPEG,
|
||||
SHADER_NV21_BT601,
|
||||
SHADER_NV21_BT709,
|
||||
NUM_SHADERS
|
||||
} GL_Shader;
|
||||
|
||||
|
|
|
@ -950,7 +950,7 @@ static void GLES2_EvictShader(SDL_Renderer *renderer, GLES2_ShaderCacheEntry *en
|
|||
static GLES2_ProgramCacheEntry *GLES2_CacheProgram(SDL_Renderer *renderer,
|
||||
GLES2_ShaderCacheEntry *vertex,
|
||||
GLES2_ShaderCacheEntry *fragment);
|
||||
static int GLES2_SelectProgram(SDL_Renderer *renderer, GLES2_ImageSource source);
|
||||
static int GLES2_SelectProgram(SDL_Renderer *renderer, GLES2_ImageSource source, int w, int h);
|
||||
|
||||
static GLES2_ProgramCacheEntry *
|
||||
GLES2_CacheProgram(SDL_Renderer *renderer, GLES2_ShaderCacheEntry *vertex,
|
||||
|
@ -1189,7 +1189,7 @@ GLES2_EvictShader(SDL_Renderer *renderer, GLES2_ShaderCacheEntry *entry)
|
|||
}
|
||||
|
||||
static int
|
||||
GLES2_SelectProgram(SDL_Renderer *renderer, GLES2_ImageSource source)
|
||||
GLES2_SelectProgram(SDL_Renderer *renderer, GLES2_ImageSource source, int w, int h)
|
||||
{
|
||||
GLES2_DriverContext *data = (GLES2_DriverContext *)renderer->driverdata;
|
||||
GLES2_ShaderCacheEntry *vertex = NULL;
|
||||
|
@ -1216,13 +1216,52 @@ GLES2_SelectProgram(SDL_Renderer *renderer, GLES2_ImageSource source)
|
|||
ftype = GLES2_SHADER_FRAGMENT_TEXTURE_BGR_SRC;
|
||||
break;
|
||||
case GLES2_IMAGESOURCE_TEXTURE_YUV:
|
||||
ftype = GLES2_SHADER_FRAGMENT_TEXTURE_YUV_SRC;
|
||||
switch (SDL_GetYUVConversionModeForResolution(w, h)) {
|
||||
case SDL_YUV_CONVERSION_JPEG:
|
||||
ftype = GLES2_SHADER_FRAGMENT_TEXTURE_YUV_JPEG_SRC;
|
||||
break;
|
||||
case SDL_YUV_CONVERSION_BT601:
|
||||
ftype = GLES2_SHADER_FRAGMENT_TEXTURE_YUV_BT601_SRC;
|
||||
break;
|
||||
case SDL_YUV_CONVERSION_BT709:
|
||||
ftype = GLES2_SHADER_FRAGMENT_TEXTURE_YUV_BT709_SRC;
|
||||
break;
|
||||
default:
|
||||
SDL_SetError("Unsupported YUV conversion mode: %d\n", SDL_GetYUVConversionModeForResolution(w, h));
|
||||
goto fault;
|
||||
}
|
||||
break;
|
||||
case GLES2_IMAGESOURCE_TEXTURE_NV12:
|
||||
ftype = GLES2_SHADER_FRAGMENT_TEXTURE_NV12_SRC;
|
||||
switch (SDL_GetYUVConversionModeForResolution(w, h)) {
|
||||
case SDL_YUV_CONVERSION_JPEG:
|
||||
ftype = GLES2_SHADER_FRAGMENT_TEXTURE_NV12_JPEG_SRC;
|
||||
break;
|
||||
case SDL_YUV_CONVERSION_BT601:
|
||||
ftype = GLES2_SHADER_FRAGMENT_TEXTURE_NV12_BT601_SRC;
|
||||
break;
|
||||
case SDL_YUV_CONVERSION_BT709:
|
||||
ftype = GLES2_SHADER_FRAGMENT_TEXTURE_NV12_BT709_SRC;
|
||||
break;
|
||||
default:
|
||||
SDL_SetError("Unsupported YUV conversion mode: %d\n", SDL_GetYUVConversionModeForResolution(w, h));
|
||||
goto fault;
|
||||
}
|
||||
break;
|
||||
case GLES2_IMAGESOURCE_TEXTURE_NV21:
|
||||
ftype = GLES2_SHADER_FRAGMENT_TEXTURE_NV21_SRC;
|
||||
switch (SDL_GetYUVConversionModeForResolution(w, h)) {
|
||||
case SDL_YUV_CONVERSION_JPEG:
|
||||
ftype = GLES2_SHADER_FRAGMENT_TEXTURE_NV21_JPEG_SRC;
|
||||
break;
|
||||
case SDL_YUV_CONVERSION_BT601:
|
||||
ftype = GLES2_SHADER_FRAGMENT_TEXTURE_NV21_BT601_SRC;
|
||||
break;
|
||||
case SDL_YUV_CONVERSION_BT709:
|
||||
ftype = GLES2_SHADER_FRAGMENT_TEXTURE_NV21_BT709_SRC;
|
||||
break;
|
||||
default:
|
||||
SDL_SetError("Unsupported YUV conversion mode: %d\n", SDL_GetYUVConversionModeForResolution(w, h));
|
||||
goto fault;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
goto fault;
|
||||
|
@ -1445,7 +1484,7 @@ GLES2_SetDrawingState(SDL_Renderer * renderer)
|
|||
GLES2_SetTexCoords(data, SDL_FALSE);
|
||||
|
||||
/* Activate an appropriate shader and set the projection matrix */
|
||||
if (GLES2_SelectProgram(renderer, GLES2_IMAGESOURCE_SOLID) < 0) {
|
||||
if (GLES2_SelectProgram(renderer, GLES2_IMAGESOURCE_SOLID, 0, 0) < 0) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -1707,7 +1746,7 @@ GLES2_SetupCopy(SDL_Renderer *renderer, SDL_Texture *texture)
|
|||
}
|
||||
}
|
||||
|
||||
if (GLES2_SelectProgram(renderer, sourceType) < 0) {
|
||||
if (GLES2_SelectProgram(renderer, sourceType, texture->w, texture->h) < 0) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
|
|
@ -126,73 +126,154 @@ static const Uint8 GLES2_FragmentSrc_TextureBGRSrc_[] = " \
|
|||
} \
|
||||
";
|
||||
|
||||
#define JPEG_SHADER_CONSTANTS \
|
||||
"// YUV offset \n" \
|
||||
"const vec3 offset = vec3(0, -0.501960814, -0.501960814);\n" \
|
||||
"\n" \
|
||||
"// RGB coefficients \n" \
|
||||
"const mat3 matrix = mat3( 1, 1, 1,\n" \
|
||||
" 0, -0.3441, 1.772,\n" \
|
||||
" 1.402, -0.7141, 0);\n" \
|
||||
|
||||
#define BT601_SHADER_CONSTANTS \
|
||||
"// YUV offset \n" \
|
||||
"const vec3 offset = vec3(-0.0627451017, -0.501960814, -0.501960814);\n" \
|
||||
"\n" \
|
||||
"// RGB coefficients \n" \
|
||||
"const mat3 matrix = mat3( 1.1644, 1.1644, 1.1644,\n" \
|
||||
" 0, -0.3918, 2.0172,\n" \
|
||||
" 1.596, -0.813, 0);\n" \
|
||||
|
||||
#define BT709_SHADER_CONSTANTS \
|
||||
"// YUV offset \n" \
|
||||
"const vec3 offset = vec3(-0.0627451017, -0.501960814, -0.501960814);\n" \
|
||||
"\n" \
|
||||
"// RGB coefficients \n" \
|
||||
"const mat3 matrix = mat3( 1.1644, 1.1644, 1.1644,\n" \
|
||||
" 0, -0.2132, 2.1124,\n" \
|
||||
" 1.7927, -0.5329, 0);\n" \
|
||||
|
||||
|
||||
#define YUV_SHADER_PROLOGUE \
|
||||
"precision mediump float;\n" \
|
||||
"uniform sampler2D u_texture;\n" \
|
||||
"uniform sampler2D u_texture_u;\n" \
|
||||
"uniform sampler2D u_texture_v;\n" \
|
||||
"uniform vec4 u_modulation;\n" \
|
||||
"varying vec2 v_texCoord;\n" \
|
||||
"\n" \
|
||||
|
||||
#define YUV_SHADER_BODY \
|
||||
"\n" \
|
||||
"void main()\n" \
|
||||
"{\n" \
|
||||
" mediump vec3 yuv;\n" \
|
||||
" lowp vec3 rgb;\n" \
|
||||
"\n" \
|
||||
" // Get the YUV values \n" \
|
||||
" yuv.x = texture2D(u_texture, v_texCoord).r;\n" \
|
||||
" yuv.y = texture2D(u_texture_u, v_texCoord).r;\n" \
|
||||
" yuv.z = texture2D(u_texture_v, v_texCoord).r;\n" \
|
||||
"\n" \
|
||||
" // Do the color transform \n" \
|
||||
" yuv += offset;\n" \
|
||||
" rgb = matrix * yuv;\n" \
|
||||
"\n" \
|
||||
" // That was easy. :) \n" \
|
||||
" gl_FragColor = vec4(rgb, 1);\n" \
|
||||
" gl_FragColor *= u_modulation;\n" \
|
||||
"}" \
|
||||
|
||||
#define NV12_SHADER_BODY \
|
||||
"\n" \
|
||||
"void main()\n" \
|
||||
"{\n" \
|
||||
" mediump vec3 yuv;\n" \
|
||||
" lowp vec3 rgb;\n" \
|
||||
"\n" \
|
||||
" // Get the YUV values \n" \
|
||||
" yuv.x = texture2D(u_texture, v_texCoord).r;\n" \
|
||||
" yuv.yz = texture2D(u_texture_u, v_texCoord).ra;\n" \
|
||||
"\n" \
|
||||
" // Do the color transform \n" \
|
||||
" yuv += offset;\n" \
|
||||
" rgb = matrix * yuv;\n" \
|
||||
"\n" \
|
||||
" // That was easy. :) \n" \
|
||||
" gl_FragColor = vec4(rgb, 1);\n" \
|
||||
" gl_FragColor *= u_modulation;\n" \
|
||||
"}" \
|
||||
|
||||
#define NV21_SHADER_BODY \
|
||||
"\n" \
|
||||
"void main()\n" \
|
||||
"{\n" \
|
||||
" mediump vec3 yuv;\n" \
|
||||
" lowp vec3 rgb;\n" \
|
||||
"\n" \
|
||||
" // Get the YUV values \n" \
|
||||
" yuv.x = texture2D(u_texture, v_texCoord).r;\n" \
|
||||
" yuv.yz = texture2D(u_texture_u, v_texCoord).ar;\n" \
|
||||
"\n" \
|
||||
" // Do the color transform \n" \
|
||||
" yuv += offset;\n" \
|
||||
" rgb = matrix * yuv;\n" \
|
||||
"\n" \
|
||||
" // That was easy. :) \n" \
|
||||
" gl_FragColor = vec4(rgb, 1);\n" \
|
||||
" gl_FragColor *= u_modulation;\n" \
|
||||
"}" \
|
||||
|
||||
/* YUV to ABGR conversion */
|
||||
static const Uint8 GLES2_FragmentSrc_TextureYUVSrc_[] = " \
|
||||
precision mediump float; \
|
||||
uniform sampler2D u_texture; \
|
||||
uniform sampler2D u_texture_u; \
|
||||
uniform sampler2D u_texture_v; \
|
||||
uniform vec4 u_modulation; \
|
||||
varying vec2 v_texCoord; \
|
||||
\
|
||||
void main() \
|
||||
{ \
|
||||
mediump vec3 yuv; \
|
||||
lowp vec3 rgb; \
|
||||
yuv.x = texture2D(u_texture, v_texCoord).r; \
|
||||
yuv.y = texture2D(u_texture_u, v_texCoord).r - 0.5; \
|
||||
yuv.z = texture2D(u_texture_v, v_texCoord).r - 0.5; \
|
||||
rgb = mat3( 1, 1, 1, \
|
||||
0, -0.39465, 2.03211, \
|
||||
1.13983, -0.58060, 0) * yuv; \
|
||||
gl_FragColor = vec4(rgb, 1); \
|
||||
gl_FragColor *= u_modulation; \
|
||||
} \
|
||||
";
|
||||
static const Uint8 GLES2_FragmentSrc_TextureYUVJPEGSrc_[] = \
|
||||
YUV_SHADER_PROLOGUE \
|
||||
JPEG_SHADER_CONSTANTS \
|
||||
YUV_SHADER_BODY \
|
||||
;
|
||||
static const Uint8 GLES2_FragmentSrc_TextureYUVBT601Src_[] = \
|
||||
YUV_SHADER_PROLOGUE \
|
||||
BT601_SHADER_CONSTANTS \
|
||||
YUV_SHADER_BODY \
|
||||
;
|
||||
static const Uint8 GLES2_FragmentSrc_TextureYUVBT709Src_[] = \
|
||||
YUV_SHADER_PROLOGUE \
|
||||
BT709_SHADER_CONSTANTS \
|
||||
YUV_SHADER_BODY \
|
||||
;
|
||||
|
||||
/* NV12 to ABGR conversion */
|
||||
static const Uint8 GLES2_FragmentSrc_TextureNV12Src_[] = " \
|
||||
precision mediump float; \
|
||||
uniform sampler2D u_texture; \
|
||||
uniform sampler2D u_texture_u; \
|
||||
uniform vec4 u_modulation; \
|
||||
varying vec2 v_texCoord; \
|
||||
\
|
||||
void main() \
|
||||
{ \
|
||||
mediump vec3 yuv; \
|
||||
lowp vec3 rgb; \
|
||||
yuv.x = texture2D(u_texture, v_texCoord).r; \
|
||||
yuv.yz = texture2D(u_texture_u, v_texCoord).ra - 0.5; \
|
||||
rgb = mat3( 1, 1, 1, \
|
||||
0, -0.39465, 2.03211, \
|
||||
1.13983, -0.58060, 0) * yuv; \
|
||||
gl_FragColor = vec4(rgb, 1); \
|
||||
gl_FragColor *= u_modulation; \
|
||||
} \
|
||||
";
|
||||
static const Uint8 GLES2_FragmentSrc_TextureNV12JPEGSrc_[] = \
|
||||
YUV_SHADER_PROLOGUE \
|
||||
JPEG_SHADER_CONSTANTS \
|
||||
NV12_SHADER_BODY \
|
||||
;
|
||||
static const Uint8 GLES2_FragmentSrc_TextureNV12BT601Src_[] = \
|
||||
YUV_SHADER_PROLOGUE \
|
||||
BT601_SHADER_CONSTANTS \
|
||||
NV12_SHADER_BODY \
|
||||
;
|
||||
static const Uint8 GLES2_FragmentSrc_TextureNV12BT709Src_[] = \
|
||||
YUV_SHADER_PROLOGUE \
|
||||
BT709_SHADER_CONSTANTS \
|
||||
NV12_SHADER_BODY \
|
||||
;
|
||||
|
||||
/* NV21 to ABGR conversion */
|
||||
static const Uint8 GLES2_FragmentSrc_TextureNV21Src_[] = " \
|
||||
precision mediump float; \
|
||||
uniform sampler2D u_texture; \
|
||||
uniform sampler2D u_texture_u; \
|
||||
uniform vec4 u_modulation; \
|
||||
varying vec2 v_texCoord; \
|
||||
\
|
||||
void main() \
|
||||
{ \
|
||||
mediump vec3 yuv; \
|
||||
lowp vec3 rgb; \
|
||||
yuv.x = texture2D(u_texture, v_texCoord).r; \
|
||||
yuv.yz = texture2D(u_texture_u, v_texCoord).ar - 0.5; \
|
||||
rgb = mat3( 1, 1, 1, \
|
||||
0, -0.39465, 2.03211, \
|
||||
1.13983, -0.58060, 0) * yuv; \
|
||||
gl_FragColor = vec4(rgb, 1); \
|
||||
gl_FragColor *= u_modulation; \
|
||||
} \
|
||||
";
|
||||
static const Uint8 GLES2_FragmentSrc_TextureNV21JPEGSrc_[] = \
|
||||
YUV_SHADER_PROLOGUE \
|
||||
JPEG_SHADER_CONSTANTS \
|
||||
NV21_SHADER_BODY \
|
||||
;
|
||||
static const Uint8 GLES2_FragmentSrc_TextureNV21BT601Src_[] = \
|
||||
YUV_SHADER_PROLOGUE \
|
||||
BT601_SHADER_CONSTANTS \
|
||||
NV21_SHADER_BODY \
|
||||
;
|
||||
static const Uint8 GLES2_FragmentSrc_TextureNV21BT709Src_[] = \
|
||||
YUV_SHADER_PROLOGUE \
|
||||
BT709_SHADER_CONSTANTS \
|
||||
NV21_SHADER_BODY \
|
||||
;
|
||||
|
||||
static const GLES2_ShaderInstance GLES2_VertexSrc_Default = {
|
||||
GL_VERTEX_SHADER,
|
||||
|
@ -236,25 +317,67 @@ static const GLES2_ShaderInstance GLES2_FragmentSrc_TextureBGRSrc = {
|
|||
GLES2_FragmentSrc_TextureBGRSrc_
|
||||
};
|
||||
|
||||
static const GLES2_ShaderInstance GLES2_FragmentSrc_TextureYUVSrc = {
|
||||
static const GLES2_ShaderInstance GLES2_FragmentSrc_TextureYUVJPEGSrc = {
|
||||
GL_FRAGMENT_SHADER,
|
||||
GLES2_SOURCE_SHADER,
|
||||
sizeof(GLES2_FragmentSrc_TextureYUVSrc_),
|
||||
GLES2_FragmentSrc_TextureYUVSrc_
|
||||
sizeof(GLES2_FragmentSrc_TextureYUVJPEGSrc_),
|
||||
GLES2_FragmentSrc_TextureYUVJPEGSrc_
|
||||
};
|
||||
|
||||
static const GLES2_ShaderInstance GLES2_FragmentSrc_TextureNV12Src = {
|
||||
static const GLES2_ShaderInstance GLES2_FragmentSrc_TextureYUVBT601Src = {
|
||||
GL_FRAGMENT_SHADER,
|
||||
GLES2_SOURCE_SHADER,
|
||||
sizeof(GLES2_FragmentSrc_TextureNV12Src_),
|
||||
GLES2_FragmentSrc_TextureNV12Src_
|
||||
sizeof(GLES2_FragmentSrc_TextureYUVBT601Src_),
|
||||
GLES2_FragmentSrc_TextureYUVBT601Src_
|
||||
};
|
||||
|
||||
static const GLES2_ShaderInstance GLES2_FragmentSrc_TextureNV21Src = {
|
||||
static const GLES2_ShaderInstance GLES2_FragmentSrc_TextureYUVBT709Src = {
|
||||
GL_FRAGMENT_SHADER,
|
||||
GLES2_SOURCE_SHADER,
|
||||
sizeof(GLES2_FragmentSrc_TextureNV21Src_),
|
||||
GLES2_FragmentSrc_TextureNV21Src_
|
||||
sizeof(GLES2_FragmentSrc_TextureYUVBT709Src_),
|
||||
GLES2_FragmentSrc_TextureYUVBT709Src_
|
||||
};
|
||||
|
||||
static const GLES2_ShaderInstance GLES2_FragmentSrc_TextureNV12JPEGSrc = {
|
||||
GL_FRAGMENT_SHADER,
|
||||
GLES2_SOURCE_SHADER,
|
||||
sizeof(GLES2_FragmentSrc_TextureNV12JPEGSrc_),
|
||||
GLES2_FragmentSrc_TextureNV12JPEGSrc_
|
||||
};
|
||||
|
||||
static const GLES2_ShaderInstance GLES2_FragmentSrc_TextureNV12BT601Src = {
|
||||
GL_FRAGMENT_SHADER,
|
||||
GLES2_SOURCE_SHADER,
|
||||
sizeof(GLES2_FragmentSrc_TextureNV12BT601Src_),
|
||||
GLES2_FragmentSrc_TextureNV12BT601Src_
|
||||
};
|
||||
|
||||
static const GLES2_ShaderInstance GLES2_FragmentSrc_TextureNV21BT709Src = {
|
||||
GL_FRAGMENT_SHADER,
|
||||
GLES2_SOURCE_SHADER,
|
||||
sizeof(GLES2_FragmentSrc_TextureNV21BT709Src_),
|
||||
GLES2_FragmentSrc_TextureNV21BT709Src_
|
||||
};
|
||||
|
||||
static const GLES2_ShaderInstance GLES2_FragmentSrc_TextureNV21JPEGSrc = {
|
||||
GL_FRAGMENT_SHADER,
|
||||
GLES2_SOURCE_SHADER,
|
||||
sizeof(GLES2_FragmentSrc_TextureNV21JPEGSrc_),
|
||||
GLES2_FragmentSrc_TextureNV21JPEGSrc_
|
||||
};
|
||||
|
||||
static const GLES2_ShaderInstance GLES2_FragmentSrc_TextureNV21BT601Src = {
|
||||
GL_FRAGMENT_SHADER,
|
||||
GLES2_SOURCE_SHADER,
|
||||
sizeof(GLES2_FragmentSrc_TextureNV21BT601Src_),
|
||||
GLES2_FragmentSrc_TextureNV21BT601Src_
|
||||
};
|
||||
|
||||
static const GLES2_ShaderInstance GLES2_FragmentSrc_TextureNV12BT709Src = {
|
||||
GL_FRAGMENT_SHADER,
|
||||
GLES2_SOURCE_SHADER,
|
||||
sizeof(GLES2_FragmentSrc_TextureNV12BT709Src_),
|
||||
GLES2_FragmentSrc_TextureNV12BT709Src_
|
||||
};
|
||||
|
||||
|
||||
|
@ -304,24 +427,66 @@ static GLES2_Shader GLES2_FragmentShader_TextureBGRSrc = {
|
|||
}
|
||||
};
|
||||
|
||||
static GLES2_Shader GLES2_FragmentShader_TextureYUVSrc = {
|
||||
static GLES2_Shader GLES2_FragmentShader_TextureYUVJPEGSrc = {
|
||||
1,
|
||||
{
|
||||
&GLES2_FragmentSrc_TextureYUVSrc
|
||||
&GLES2_FragmentSrc_TextureYUVJPEGSrc
|
||||
}
|
||||
};
|
||||
|
||||
static GLES2_Shader GLES2_FragmentShader_TextureNV12Src = {
|
||||
static GLES2_Shader GLES2_FragmentShader_TextureYUVBT601Src = {
|
||||
1,
|
||||
{
|
||||
&GLES2_FragmentSrc_TextureNV12Src
|
||||
&GLES2_FragmentSrc_TextureYUVBT601Src
|
||||
}
|
||||
};
|
||||
|
||||
static GLES2_Shader GLES2_FragmentShader_TextureNV21Src = {
|
||||
static GLES2_Shader GLES2_FragmentShader_TextureYUVBT709Src = {
|
||||
1,
|
||||
{
|
||||
&GLES2_FragmentSrc_TextureNV21Src
|
||||
&GLES2_FragmentSrc_TextureYUVBT709Src
|
||||
}
|
||||
};
|
||||
|
||||
static GLES2_Shader GLES2_FragmentShader_TextureNV12JPEGSrc = {
|
||||
1,
|
||||
{
|
||||
&GLES2_FragmentSrc_TextureNV12JPEGSrc
|
||||
}
|
||||
};
|
||||
|
||||
static GLES2_Shader GLES2_FragmentShader_TextureNV12BT601Src = {
|
||||
1,
|
||||
{
|
||||
&GLES2_FragmentSrc_TextureNV12BT601Src
|
||||
}
|
||||
};
|
||||
|
||||
static GLES2_Shader GLES2_FragmentShader_TextureNV12BT709Src = {
|
||||
1,
|
||||
{
|
||||
&GLES2_FragmentSrc_TextureNV12BT709Src
|
||||
}
|
||||
};
|
||||
|
||||
static GLES2_Shader GLES2_FragmentShader_TextureNV21JPEGSrc = {
|
||||
1,
|
||||
{
|
||||
&GLES2_FragmentSrc_TextureNV21JPEGSrc
|
||||
}
|
||||
};
|
||||
|
||||
static GLES2_Shader GLES2_FragmentShader_TextureNV21BT601Src = {
|
||||
1,
|
||||
{
|
||||
&GLES2_FragmentSrc_TextureNV21BT601Src
|
||||
}
|
||||
};
|
||||
|
||||
static GLES2_Shader GLES2_FragmentShader_TextureNV21BT709Src = {
|
||||
1,
|
||||
{
|
||||
&GLES2_FragmentSrc_TextureNV21BT709Src
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -345,12 +510,24 @@ const GLES2_Shader *GLES2_GetShader(GLES2_ShaderType type)
|
|||
return &GLES2_FragmentShader_TextureRGBSrc;
|
||||
case GLES2_SHADER_FRAGMENT_TEXTURE_BGR_SRC:
|
||||
return &GLES2_FragmentShader_TextureBGRSrc;
|
||||
case GLES2_SHADER_FRAGMENT_TEXTURE_YUV_SRC:
|
||||
return &GLES2_FragmentShader_TextureYUVSrc;
|
||||
case GLES2_SHADER_FRAGMENT_TEXTURE_NV12_SRC:
|
||||
return &GLES2_FragmentShader_TextureNV12Src;
|
||||
case GLES2_SHADER_FRAGMENT_TEXTURE_NV21_SRC:
|
||||
return &GLES2_FragmentShader_TextureNV21Src;
|
||||
case GLES2_SHADER_FRAGMENT_TEXTURE_YUV_JPEG_SRC:
|
||||
return &GLES2_FragmentShader_TextureYUVJPEGSrc;
|
||||
case GLES2_SHADER_FRAGMENT_TEXTURE_YUV_BT601_SRC:
|
||||
return &GLES2_FragmentShader_TextureYUVBT601Src;
|
||||
case GLES2_SHADER_FRAGMENT_TEXTURE_YUV_BT709_SRC:
|
||||
return &GLES2_FragmentShader_TextureYUVBT709Src;
|
||||
case GLES2_SHADER_FRAGMENT_TEXTURE_NV12_JPEG_SRC:
|
||||
return &GLES2_FragmentShader_TextureNV12JPEGSrc;
|
||||
case GLES2_SHADER_FRAGMENT_TEXTURE_NV12_BT601_SRC:
|
||||
return &GLES2_FragmentShader_TextureNV12BT601Src;
|
||||
case GLES2_SHADER_FRAGMENT_TEXTURE_NV12_BT709_SRC:
|
||||
return &GLES2_FragmentShader_TextureNV12BT709Src;
|
||||
case GLES2_SHADER_FRAGMENT_TEXTURE_NV21_JPEG_SRC:
|
||||
return &GLES2_FragmentShader_TextureNV21JPEGSrc;
|
||||
case GLES2_SHADER_FRAGMENT_TEXTURE_NV21_BT601_SRC:
|
||||
return &GLES2_FragmentShader_TextureNV21BT601Src;
|
||||
case GLES2_SHADER_FRAGMENT_TEXTURE_NV21_BT709_SRC:
|
||||
return &GLES2_FragmentShader_TextureNV21BT709Src;
|
||||
default:
|
||||
return NULL;
|
||||
}
|
||||
|
|
|
@ -20,11 +20,11 @@
|
|||
*/
|
||||
#include "../../SDL_internal.h"
|
||||
|
||||
#if SDL_VIDEO_RENDER_OGL_ES2
|
||||
|
||||
#ifndef SDL_shaders_gles2_h_
|
||||
#define SDL_shaders_gles2_h_
|
||||
|
||||
#if SDL_VIDEO_RENDER_OGL_ES2
|
||||
|
||||
typedef struct GLES2_ShaderInstance
|
||||
{
|
||||
GLenum type;
|
||||
|
@ -47,17 +47,23 @@ typedef enum
|
|||
GLES2_SHADER_FRAGMENT_TEXTURE_ARGB_SRC,
|
||||
GLES2_SHADER_FRAGMENT_TEXTURE_BGR_SRC,
|
||||
GLES2_SHADER_FRAGMENT_TEXTURE_RGB_SRC,
|
||||
GLES2_SHADER_FRAGMENT_TEXTURE_YUV_SRC,
|
||||
GLES2_SHADER_FRAGMENT_TEXTURE_NV12_SRC,
|
||||
GLES2_SHADER_FRAGMENT_TEXTURE_NV21_SRC
|
||||
GLES2_SHADER_FRAGMENT_TEXTURE_YUV_JPEG_SRC,
|
||||
GLES2_SHADER_FRAGMENT_TEXTURE_YUV_BT601_SRC,
|
||||
GLES2_SHADER_FRAGMENT_TEXTURE_YUV_BT709_SRC,
|
||||
GLES2_SHADER_FRAGMENT_TEXTURE_NV12_JPEG_SRC,
|
||||
GLES2_SHADER_FRAGMENT_TEXTURE_NV12_BT601_SRC,
|
||||
GLES2_SHADER_FRAGMENT_TEXTURE_NV12_BT709_SRC,
|
||||
GLES2_SHADER_FRAGMENT_TEXTURE_NV21_JPEG_SRC,
|
||||
GLES2_SHADER_FRAGMENT_TEXTURE_NV21_BT601_SRC,
|
||||
GLES2_SHADER_FRAGMENT_TEXTURE_NV21_BT709_SRC,
|
||||
} GLES2_ShaderType;
|
||||
|
||||
#define GLES2_SOURCE_SHADER (GLenum)-1
|
||||
|
||||
const GLES2_Shader *GLES2_GetShader(GLES2_ShaderType type);
|
||||
|
||||
#endif /* SDL_shaders_gles2_h_ */
|
||||
|
||||
#endif /* SDL_VIDEO_RENDER_OGL_ES2 */
|
||||
|
||||
#endif /* SDL_shaders_gles2_h_ */
|
||||
|
||||
/* vi: set ts=4 sw=4 expandtab: */
|
||||
|
|
|
@ -748,30 +748,6 @@ SDL_DitherColors(SDL_Color * colors, int bpp)
|
|||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Calculate the pad-aligned scanline width of a surface
|
||||
*/
|
||||
int
|
||||
SDL_CalculatePitch(SDL_Surface * surface)
|
||||
{
|
||||
int pitch;
|
||||
|
||||
/* Surface should be 4-byte aligned for speed */
|
||||
pitch = surface->w * surface->format->BytesPerPixel;
|
||||
switch (surface->format->BitsPerPixel) {
|
||||
case 1:
|
||||
pitch = (pitch + 7) / 8;
|
||||
break;
|
||||
case 4:
|
||||
pitch = (pitch + 1) / 2;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
pitch = (pitch + 3) & ~3; /* 4-byte aligning */
|
||||
return (pitch);
|
||||
}
|
||||
|
||||
/*
|
||||
* Match an RGB value to a particular palette index
|
||||
*/
|
||||
|
|
|
@ -34,7 +34,6 @@ extern int SDL_MapSurface(SDL_Surface * src, SDL_Surface * dst);
|
|||
extern void SDL_FreeBlitMap(SDL_BlitMap * map);
|
||||
|
||||
/* Miscellaneous functions */
|
||||
extern int SDL_CalculatePitch(SDL_Surface * surface);
|
||||
extern void SDL_DitherColors(SDL_Color * colors, int bpp);
|
||||
extern Uint8 SDL_FindColor(SDL_Palette * pal, Uint8 r, Uint8 g, Uint8 b, Uint8 a);
|
||||
|
||||
|
|
|
@ -25,17 +25,8 @@
|
|||
#include "SDL_blit.h"
|
||||
#include "SDL_RLEaccel_c.h"
|
||||
#include "SDL_pixels_c.h"
|
||||
#include "SDL_yuv_c.h"
|
||||
|
||||
/* Private routines */
|
||||
static int
|
||||
SDL_ConvertPixels_YUV_to_ARGB8888(int width, int height,
|
||||
Uint32 src_format, const void *src,
|
||||
void *dst, int dst_pitch);
|
||||
|
||||
static int
|
||||
SDL_ConvertPixels_ARGB8888_to_YUV(int width, int height,
|
||||
const void *src, int src_pitch,
|
||||
Uint32 dst_format, void *dst);
|
||||
|
||||
/* Check to make sure we can safely check multiplication of surface w and pitch and it won't overflow size_t */
|
||||
SDL_COMPILE_TIME_ASSERT(surface_size_assumptions,
|
||||
|
@ -43,6 +34,30 @@ SDL_COMPILE_TIME_ASSERT(surface_size_assumptions,
|
|||
|
||||
/* Public routines */
|
||||
|
||||
/*
|
||||
* Calculate the pad-aligned scanline width of a surface
|
||||
*/
|
||||
int
|
||||
SDL_CalculatePitch(Uint32 format, int width)
|
||||
{
|
||||
int pitch;
|
||||
|
||||
/* Surface should be 4-byte aligned for speed */
|
||||
pitch = width * SDL_BYTESPERPIXEL(format);
|
||||
switch (SDL_BITSPERPIXEL(format)) {
|
||||
case 1:
|
||||
pitch = (pitch + 7) / 8;
|
||||
break;
|
||||
case 4:
|
||||
pitch = (pitch + 1) / 2;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
pitch = (pitch + 3) & ~3; /* 4-byte aligning */
|
||||
return pitch;
|
||||
}
|
||||
|
||||
/*
|
||||
* Create an empty RGB surface of the appropriate depth using the given
|
||||
* enum SDL_PIXELFORMAT_* format
|
||||
|
@ -70,7 +85,7 @@ SDL_CreateRGBSurfaceWithFormat(Uint32 flags, int width, int height, int depth,
|
|||
}
|
||||
surface->w = width;
|
||||
surface->h = height;
|
||||
surface->pitch = SDL_CalculatePitch(surface);
|
||||
surface->pitch = SDL_CalculatePitch(format, width);
|
||||
SDL_SetClipRect(surface, NULL);
|
||||
|
||||
if (SDL_ISPIXELFORMAT_INDEXED(surface->format->format)) {
|
||||
|
@ -1138,135 +1153,27 @@ int SDL_ConvertPixels(int width, int height,
|
|||
return SDL_InvalidParamError("dst_pitch");
|
||||
}
|
||||
|
||||
if (SDL_ISPIXELFORMAT_FOURCC(src_format) && SDL_ISPIXELFORMAT_FOURCC(dst_format)) {
|
||||
return SDL_ConvertPixels_YUV_to_YUV(width, height, src_format, src, src_pitch, dst_format, dst, dst_pitch);
|
||||
} else if (SDL_ISPIXELFORMAT_FOURCC(src_format)) {
|
||||
return SDL_ConvertPixels_YUV_to_RGB(width, height, src_format, src, src_pitch, dst_format, dst, dst_pitch);
|
||||
} else if (SDL_ISPIXELFORMAT_FOURCC(dst_format)) {
|
||||
return SDL_ConvertPixels_RGB_to_YUV(width, height, src_format, src, src_pitch, dst_format, dst, dst_pitch);
|
||||
}
|
||||
|
||||
/* Fast path for same format copy */
|
||||
if (src_format == dst_format) {
|
||||
int i;
|
||||
|
||||
if (SDL_ISPIXELFORMAT_FOURCC(src_format)) {
|
||||
switch (src_format) {
|
||||
case SDL_PIXELFORMAT_YUY2:
|
||||
case SDL_PIXELFORMAT_UYVY:
|
||||
case SDL_PIXELFORMAT_YVYU:
|
||||
/* Packed planes */
|
||||
width = 4 * ((width + 1) / 2);
|
||||
for (i = height; i--;) {
|
||||
SDL_memcpy(dst, src, width);
|
||||
src = (const Uint8*)src + src_pitch;
|
||||
dst = (Uint8*)dst + dst_pitch;
|
||||
}
|
||||
break;
|
||||
case SDL_PIXELFORMAT_YV12:
|
||||
case SDL_PIXELFORMAT_IYUV:
|
||||
case SDL_PIXELFORMAT_NV12:
|
||||
case SDL_PIXELFORMAT_NV21:
|
||||
{
|
||||
/* Y plane */
|
||||
for (i = height; i--;) {
|
||||
SDL_memcpy(dst, src, width);
|
||||
src = (const Uint8*)src + src_pitch;
|
||||
dst = (Uint8*)dst + dst_pitch;
|
||||
}
|
||||
|
||||
/* not sure the pitch is relevant here.
|
||||
this also works to add the size of two chroma planes */
|
||||
#if 0
|
||||
SDL_memcpy(dst, src, 2 * ((width + 1)/2) * ((height+1)/2));
|
||||
#else
|
||||
|
||||
if (src_format == SDL_PIXELFORMAT_YV12 || src_format == SDL_PIXELFORMAT_IYUV) {
|
||||
/* U and V planes are a quarter the size of the Y plane */
|
||||
width = (width + 1) / 2;
|
||||
height = (height + 1) / 2;
|
||||
src_pitch = (src_pitch + 1) / 2;
|
||||
dst_pitch = (dst_pitch + 1) / 2;
|
||||
for (i = height * 2; i--;) {
|
||||
SDL_memcpy(dst, src, width);
|
||||
src = (const Uint8*)src + src_pitch;
|
||||
dst = (Uint8*)dst + dst_pitch;
|
||||
}
|
||||
} else if (src_format == SDL_PIXELFORMAT_NV12 || src_format == SDL_PIXELFORMAT_NV21) {
|
||||
/* U/V plane is half the height of the Y plane */
|
||||
height = (height + 1) / 2;
|
||||
width = (width + 1) / 2;
|
||||
src_pitch = (src_pitch + 1) / 2;
|
||||
dst_pitch = (dst_pitch + 1) / 2;
|
||||
for (i = height; i--;) {
|
||||
SDL_memcpy(dst, src, 2 * width);
|
||||
src = (const Uint8*)src + 2 * src_pitch;
|
||||
dst = (Uint8*)dst + 2 * dst_pitch;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
break;
|
||||
default:
|
||||
return SDL_SetError("Unknown FOURCC pixel format");
|
||||
}
|
||||
} else {
|
||||
const int bpp = SDL_BYTESPERPIXEL(src_format);
|
||||
width *= bpp;
|
||||
for (i = height; i--;) {
|
||||
SDL_memcpy(dst, src, width);
|
||||
src = (const Uint8*)src + src_pitch;
|
||||
dst = (Uint8*)dst + dst_pitch;
|
||||
}
|
||||
const int bpp = SDL_BYTESPERPIXEL(src_format);
|
||||
width *= bpp;
|
||||
for (i = height; i--;) {
|
||||
SDL_memcpy(dst, src, width);
|
||||
src = (const Uint8*)src + src_pitch;
|
||||
dst = (Uint8*)dst + dst_pitch;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* FOURCC to Any */
|
||||
if (SDL_ISPIXELFORMAT_FOURCC(src_format)) {
|
||||
/* FOURCC to ARGB8888 */
|
||||
if (dst_format == SDL_PIXELFORMAT_ARGB8888) {
|
||||
SDL_ConvertPixels_YUV_to_ARGB8888(width, height, src_format, src, dst, dst_pitch);
|
||||
return 0;
|
||||
}
|
||||
else /* FOURCC to not(ARGB8888) : need an intermediate conversion */
|
||||
{
|
||||
int ret;
|
||||
void *tmp = SDL_malloc(width * height * 4);
|
||||
if (tmp == NULL) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* convert src/FOURCC to tmp/ARGB8888 */
|
||||
SDL_ConvertPixels_YUV_to_ARGB8888(width, height, src_format, src, tmp, width * 4);
|
||||
|
||||
/* convert tmp/ARGB8888 to dst/dst_format */
|
||||
ret = SDL_ConvertPixels(width, height, SDL_PIXELFORMAT_ARGB8888, tmp, width * 4, dst_format, dst, dst_pitch);
|
||||
SDL_free(tmp);
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
||||
/* Any to FOURCC */
|
||||
if (SDL_ISPIXELFORMAT_FOURCC(dst_format)) {
|
||||
/* ARGB8888 to FOURCC */
|
||||
if (src_format == SDL_PIXELFORMAT_ARGB8888) {
|
||||
SDL_ConvertPixels_ARGB8888_to_YUV(width, height, src, src_pitch, dst_format, dst);
|
||||
return 0;
|
||||
}
|
||||
else /* not(ARGB8888) to FOURCC : need an intermediate conversion */
|
||||
{
|
||||
int ret;
|
||||
void *tmp = SDL_malloc(width * height * 4);
|
||||
if (tmp == NULL) {
|
||||
return -1;
|
||||
}
|
||||
/* convert src/src_format to tmp/ARGB8888 */
|
||||
ret = SDL_ConvertPixels(width, height, src_format, src, src_pitch, SDL_PIXELFORMAT_ARGB8888, tmp, width * 4);
|
||||
if (ret == -1) {
|
||||
SDL_free(tmp);
|
||||
return ret;
|
||||
}
|
||||
/* convert tmp/ARGB8888 to dst/FOURCC */
|
||||
SDL_ConvertPixels_ARGB8888_to_YUV(width, height, tmp, width * 4, dst_format, dst);
|
||||
|
||||
SDL_free(tmp);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (!SDL_CreateSurfaceOnStack(width, height, src_format, nonconst_src,
|
||||
src_pitch,
|
||||
&src_surface, &src_fmt, &src_blitmap)) {
|
||||
|
@ -1322,491 +1229,4 @@ SDL_FreeSurface(SDL_Surface * surface)
|
|||
SDL_free(surface);
|
||||
}
|
||||
|
||||
|
||||
/* YUV-RGB conversion */
|
||||
#define CLAMP(val) ((val) > 0 ? ((val) < 255 ? (val) : 255) : 0)
|
||||
|
||||
#if 1
|
||||
|
||||
/* Coefficients from CCIR 601 */
|
||||
#define MAKE_Y(r, g, b) (int)( 0.29900f * (r) + 0.58700f * (g) + 0.11400f * (b))
|
||||
#define MAKE_U(r, g, b) (int)(-0.16874f * (r) - 0.33126f * (g) + 0.50000f * (b) + 128)
|
||||
#define MAKE_V(r, g, b) (int)( 0.50000f * (r) - 0.41869f * (g) - 0.08131f * (b) + 128)
|
||||
|
||||
#define MAKE_R(y, u, v) CLAMP((int)((y) + 1.40200f * ((v) - 128)))
|
||||
#define MAKE_G(y, u, v) CLAMP((int)((y) - 0.34414f * ((u) - 128) - 0.71414f * ((v) - 128)))
|
||||
#define MAKE_B(y, u, v) CLAMP((int)((y) + 1.77200f * ((u) - 128) ))
|
||||
|
||||
#else
|
||||
|
||||
/* Coefficients from Video Demystified */
|
||||
#define MAKE_Y(r, g, b) ((( 66 * (r) + 129 * (g) + 25 * (b) + 128) >> 8) + 16)
|
||||
#define MAKE_U(r, g, b) ((( -38 * (r) - 74 * (g) + 112 * (b) + 128) >> 8) + 128)
|
||||
#define MAKE_V(r, g, b) ((( 112 * (r) - 94 * (g) - 18 * (b) + 128) >> 8) + 128)
|
||||
|
||||
#define MAKE_R(y, u, v) CLAMP(( 298 * ((y) - 16) + 409 * ((v) - 128) + 128) >> 8)
|
||||
#define MAKE_G(y, u, v) CLAMP(( 298 * ((y) - 16) - 100 * ((u) - 128) - 208 * ((v) - 128) + 128) >> 8)
|
||||
#define MAKE_B(y, u, v) CLAMP(( 298 * ((y) - 16) + 516 * ((u) - 128) + 128) >> 8)
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
static int
|
||||
SDL_ConvertPixels_YUV_to_ARGB8888(int width, int height,
|
||||
Uint32 src_format, const void *src,
|
||||
void *dst, int dst_pitch)
|
||||
{
|
||||
const int sz_plane = width * height;
|
||||
const int sz_plane_chroma = ((width + 1) / 2) * ((height + 1) / 2);
|
||||
const int width_remainder = (width & 0x1);
|
||||
const int width_half = width / 2;
|
||||
const int curr_row_padding = dst_pitch - 4 * width;
|
||||
int i, j;
|
||||
Uint8 *curr_row = (Uint8*)dst;
|
||||
|
||||
// SDL_Log("SDL_ConvertPixels_YUV_to_ARGB8888 (from %s)", SDL_GetPixelFormatName(src_format));
|
||||
|
||||
#define WRITE_RGB_PIXEL(y, u, v) \
|
||||
*((Uint32*)curr_row) = \
|
||||
(MAKE_B((y), (u), (v)) \
|
||||
| (MAKE_G((y), (u), (v)) << 8) \
|
||||
| (MAKE_R((y), (u), (v)) << 16) \
|
||||
| 0xff000000); \
|
||||
curr_row += 4; \
|
||||
|
||||
switch (src_format)
|
||||
{
|
||||
case SDL_PIXELFORMAT_YV12:
|
||||
case SDL_PIXELFORMAT_IYUV:
|
||||
case SDL_PIXELFORMAT_NV12:
|
||||
case SDL_PIXELFORMAT_NV21:
|
||||
{
|
||||
const Uint8 *plane_y = (const Uint8*)src;
|
||||
|
||||
if (src_format == SDL_PIXELFORMAT_YV12 || src_format == SDL_PIXELFORMAT_IYUV)
|
||||
{
|
||||
const Uint8 *plane_u = (src_format == SDL_PIXELFORMAT_YV12 ? plane_y + sz_plane + sz_plane_chroma : plane_y + sz_plane);
|
||||
const Uint8 *plane_v = (src_format == SDL_PIXELFORMAT_YV12 ? plane_y + sz_plane : plane_y + sz_plane + sz_plane_chroma);
|
||||
|
||||
for (j = 0; j < height; j++) {
|
||||
for (i = 0; i < width_half; i++) {
|
||||
const Uint8 u = *plane_u++;
|
||||
const Uint8 v = *plane_v++;
|
||||
const Uint8 y = *plane_y++;
|
||||
const Uint8 y1 = *plane_y++;
|
||||
WRITE_RGB_PIXEL(y, u, v);
|
||||
WRITE_RGB_PIXEL(y1, u, v);
|
||||
}
|
||||
if (width_remainder) {
|
||||
const Uint8 u = *plane_u++;
|
||||
const Uint8 v = *plane_v++;
|
||||
const Uint8 y = *plane_y++;
|
||||
WRITE_RGB_PIXEL(y, u, v);
|
||||
}
|
||||
/* Re-use the same line of chroma planes */
|
||||
if ((j & 0x1) == 0x0) {
|
||||
plane_u -= width_half + width_remainder;
|
||||
plane_v -= width_half + width_remainder;
|
||||
}
|
||||
curr_row += curr_row_padding;
|
||||
}
|
||||
}
|
||||
else if (src_format == SDL_PIXELFORMAT_NV12)
|
||||
{
|
||||
const Uint8 *plane_interleaved_uv = plane_y + sz_plane;
|
||||
for (j = 0; j < height; j++) {
|
||||
for (i = 0; i < width_half; i++) {
|
||||
const Uint8 y = *plane_y++;
|
||||
const Uint8 y1 = *plane_y++;
|
||||
const Uint8 u = *plane_interleaved_uv++;
|
||||
const Uint8 v = *plane_interleaved_uv++;
|
||||
WRITE_RGB_PIXEL(y, u, v);
|
||||
WRITE_RGB_PIXEL(y1, u, v);
|
||||
}
|
||||
if (width_remainder) {
|
||||
const Uint8 y = *plane_y++;
|
||||
const Uint8 u = *plane_interleaved_uv++;
|
||||
const Uint8 v = *plane_interleaved_uv++;
|
||||
WRITE_RGB_PIXEL(y, u, v);
|
||||
}
|
||||
/* Re-use the same line of chroma planes */
|
||||
if ((j & 0x1) == 0x0) {
|
||||
plane_interleaved_uv -= 2 * (width_half + width_remainder);
|
||||
}
|
||||
curr_row += curr_row_padding;
|
||||
}
|
||||
}
|
||||
else /* src_format == SDL_PIXELFORMAT_NV21 */
|
||||
{
|
||||
const Uint8 *plane_interleaved_uv = plane_y + sz_plane;
|
||||
for (j = 0; j < height; j++) {
|
||||
for (i = 0; i < width_half; i++) {
|
||||
const Uint8 y = *plane_y++;
|
||||
const Uint8 y1 = *plane_y++;
|
||||
const Uint8 v = *plane_interleaved_uv++;
|
||||
const Uint8 u = *plane_interleaved_uv++;
|
||||
WRITE_RGB_PIXEL(y, u, v);
|
||||
WRITE_RGB_PIXEL(y1, u, v);
|
||||
}
|
||||
if (width_remainder) {
|
||||
const Uint8 y = *plane_y++;
|
||||
const Uint8 v = *plane_interleaved_uv++;
|
||||
const Uint8 u = *plane_interleaved_uv++;
|
||||
WRITE_RGB_PIXEL(y, u, v);
|
||||
}
|
||||
/* Re-use the same line of chroma planes */
|
||||
if ((j & 0x1) == 0x0) {
|
||||
plane_interleaved_uv -= 2 * (width_half + width_remainder);
|
||||
}
|
||||
curr_row += curr_row_padding;
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case SDL_PIXELFORMAT_YUY2:
|
||||
case SDL_PIXELFORMAT_UYVY:
|
||||
case SDL_PIXELFORMAT_YVYU:
|
||||
{
|
||||
const Uint8 *plane = (const Uint8 *)src;
|
||||
|
||||
#define READ_PACKED_YUV(var1, var2, var3, var4) \
|
||||
const Uint8 var1 = plane[0]; \
|
||||
const Uint8 var2 = plane[1]; \
|
||||
const Uint8 var3 = plane[2]; \
|
||||
const Uint8 var4 = plane[3]; \
|
||||
plane += 4; \
|
||||
|
||||
if (src_format == SDL_PIXELFORMAT_YUY2) /* Y U Y1 V */
|
||||
{
|
||||
for (j = 0; j < height; j++) {
|
||||
for (i = 0; i < width_half; i++) {
|
||||
READ_PACKED_YUV(y, u, y1, v);
|
||||
WRITE_RGB_PIXEL(y, u, v);
|
||||
WRITE_RGB_PIXEL(y1, u, v);
|
||||
}
|
||||
if (width_remainder) {
|
||||
READ_PACKED_YUV(y, u, y1, v);
|
||||
(void)y1; /* y1 unused */
|
||||
WRITE_RGB_PIXEL(y, u, v);
|
||||
}
|
||||
curr_row += curr_row_padding;
|
||||
}
|
||||
}
|
||||
else if (src_format == SDL_PIXELFORMAT_UYVY) /* U Y V Y1 */
|
||||
{
|
||||
for (j = 0; j < height; j++) {
|
||||
for (i = 0; i < width_half; i++) {
|
||||
READ_PACKED_YUV(u, y, v, y1);
|
||||
WRITE_RGB_PIXEL(y, u, v);
|
||||
WRITE_RGB_PIXEL(y1, u, v);
|
||||
}
|
||||
if (width_remainder) {
|
||||
READ_PACKED_YUV(u, y, v, y1);
|
||||
(void) y1; /* y1 unused */
|
||||
WRITE_RGB_PIXEL(y, u, v);
|
||||
}
|
||||
curr_row += curr_row_padding;
|
||||
}
|
||||
}
|
||||
else if (src_format == SDL_PIXELFORMAT_YVYU) /* Y V Y1 U */
|
||||
{
|
||||
for (j = 0; j < height; j++) {
|
||||
for (i = 0; i < width_half; i++) {
|
||||
READ_PACKED_YUV(y, v, y1, u);
|
||||
WRITE_RGB_PIXEL(y, u, v);
|
||||
WRITE_RGB_PIXEL(y1, u, v);
|
||||
}
|
||||
if (width_remainder) {
|
||||
READ_PACKED_YUV(y, v, y1, u);
|
||||
(void) y1; /* y1 unused */
|
||||
WRITE_RGB_PIXEL(y, u, v);
|
||||
}
|
||||
curr_row += curr_row_padding;
|
||||
}
|
||||
}
|
||||
#undef READ_PACKED_YUV
|
||||
}
|
||||
break;
|
||||
}
|
||||
#undef WRITE_RGB_PIXEL
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
SDL_ConvertPixels_ARGB8888_to_YUV(int width, int height, const void *src, int src_pitch, Uint32 dst_format, void *dst)
|
||||
{
|
||||
const int src_pitch_x_2 = src_pitch * 2;
|
||||
const int sz_plane = width * height;
|
||||
const int sz_plane_chroma = ((width + 1) / 2) * ((height + 1) / 2);
|
||||
const int height_half = height / 2;
|
||||
const int height_remainder = (height & 0x1);
|
||||
const int width_half = width / 2;
|
||||
const int width_remainder = (width & 0x1);
|
||||
int i, j;
|
||||
|
||||
// SDL_Log("SDL_ConvertPixels_ARGB8888_to_YUV (to %s)", SDL_GetPixelFormatName(dst_format));
|
||||
|
||||
switch (dst_format)
|
||||
{
|
||||
case SDL_PIXELFORMAT_YV12:
|
||||
case SDL_PIXELFORMAT_IYUV:
|
||||
case SDL_PIXELFORMAT_NV12:
|
||||
case SDL_PIXELFORMAT_NV21:
|
||||
{
|
||||
const Uint8 *curr_row, *next_row;
|
||||
|
||||
Uint8 *plane_y = (Uint8*) dst;
|
||||
Uint8 *plane_u = (dst_format == SDL_PIXELFORMAT_YV12 ? plane_y + sz_plane + sz_plane_chroma : plane_y + sz_plane);
|
||||
Uint8 *plane_v = (dst_format == SDL_PIXELFORMAT_YV12 ? plane_y + sz_plane : plane_y + sz_plane + sz_plane_chroma);
|
||||
Uint8 *plane_interleaved_uv = plane_y + sz_plane;
|
||||
|
||||
curr_row = (const Uint8*)src;
|
||||
|
||||
/* Write Y plane */
|
||||
for (j = 0; j < height; j++) {
|
||||
for (i = 0; i < width; i++) {
|
||||
const Uint8 b = curr_row[4 * i + 0];
|
||||
const Uint8 g = curr_row[4 * i + 1];
|
||||
const Uint8 r = curr_row[4 * i + 2];
|
||||
*plane_y++ = MAKE_Y(r, g, b);
|
||||
}
|
||||
curr_row += src_pitch;
|
||||
}
|
||||
|
||||
curr_row = (const Uint8*)src;
|
||||
next_row = (const Uint8*)src;
|
||||
next_row += src_pitch;
|
||||
|
||||
#if 1
|
||||
/* slightly faster */
|
||||
#define READ_2x2_PIXELS \
|
||||
const Uint32 p1 = ((const Uint32 *)curr_row)[2 * i]; \
|
||||
const Uint32 p2 = ((const Uint32 *)curr_row)[2 * i + 1]; \
|
||||
const Uint32 p3 = ((const Uint32 *)next_row)[2 * i]; \
|
||||
const Uint32 p4 = ((const Uint32 *)next_row)[2 * i + 1]; \
|
||||
const Uint32 b = ((p1 & 0x000000ff) + (p2 & 0x000000ff) + (p3 & 0x000000ff) + (p4 & 0x000000ff)) >> 2; \
|
||||
const Uint32 g = ((p1 & 0x0000ff00) + (p2 & 0x0000ff00) + (p3 & 0x0000ff00) + (p4 & 0x0000ff00)) >> 10; \
|
||||
const Uint32 r = ((p1 & 0x00ff0000) + (p2 & 0x00ff0000) + (p3 & 0x00ff0000) + (p4 & 0x00ff0000)) >> 18; \
|
||||
|
||||
#else
|
||||
|
||||
#define READ_2x2_PIXELS \
|
||||
const Uint8 b = (curr_row[8 * i + 0] + curr_row[8 * i + 4] \
|
||||
+ next_row[8 * i + 0] + next_row[8 * i + 4] ) >> 2; \
|
||||
const Uint8 g = (curr_row[8 * i + 1] + curr_row[8 * i + 5] \
|
||||
+ next_row[8 * i + 1] + next_row[8 * i + 5] ) >> 2; \
|
||||
const Uint8 r = (curr_row[8 * i + 2] + curr_row[8 * i + 6] \
|
||||
+ next_row[8 * i + 2] + next_row[8 * i + 6] ) >> 2; \
|
||||
|
||||
#endif
|
||||
|
||||
#define READ_2x1_PIXELS \
|
||||
const Uint8 b = (curr_row[8 * i + 0] + next_row[8 * i + 0]) >> 1; \
|
||||
const Uint8 g = (curr_row[8 * i + 1] + next_row[8 * i + 1]) >> 1; \
|
||||
const Uint8 r = (curr_row[8 * i + 2] + next_row[8 * i + 2]) >> 1; \
|
||||
|
||||
#define READ_1x2_PIXELS \
|
||||
const Uint8 b = (curr_row[8 * i + 0] + curr_row[8 * i + 4]) >> 1; \
|
||||
const Uint8 g = (curr_row[8 * i + 1] + curr_row[8 * i + 5]) >> 1; \
|
||||
const Uint8 r = (curr_row[8 * i + 2] + curr_row[8 * i + 6]) >> 1; \
|
||||
|
||||
#define READ_1x1_PIXEL \
|
||||
const Uint8 b = curr_row[8 * i + 0]; \
|
||||
const Uint8 g = curr_row[8 * i + 1]; \
|
||||
const Uint8 r = curr_row[8 * i + 2]; \
|
||||
|
||||
if (dst_format == SDL_PIXELFORMAT_YV12 || dst_format == SDL_PIXELFORMAT_IYUV)
|
||||
{
|
||||
/* Write UV planes, not interleaved */
|
||||
for (j = 0; j < height_half; j++) {
|
||||
for (i = 0; i < width_half; i++) {
|
||||
READ_2x2_PIXELS;
|
||||
*plane_u++ = MAKE_U(r, g, b);
|
||||
*plane_v++ = MAKE_V(r, g, b);
|
||||
}
|
||||
if (width_remainder) {
|
||||
READ_2x1_PIXELS;
|
||||
*plane_u++ = MAKE_U(r, g, b);
|
||||
*plane_v++ = MAKE_V(r, g, b);
|
||||
}
|
||||
curr_row += src_pitch_x_2;
|
||||
next_row += src_pitch_x_2;
|
||||
}
|
||||
if (height_remainder) {
|
||||
for (i = 0; i < width_half; i++) {
|
||||
READ_1x2_PIXELS;
|
||||
*plane_u++ = MAKE_U(r, g, b);
|
||||
*plane_v++ = MAKE_V(r, g, b);
|
||||
}
|
||||
if (width_remainder) {
|
||||
READ_1x1_PIXEL;
|
||||
*plane_u++ = MAKE_U(r, g, b);
|
||||
*plane_v++ = MAKE_V(r, g, b);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (dst_format == SDL_PIXELFORMAT_NV12)
|
||||
{
|
||||
for (j = 0; j < height_half; j++) {
|
||||
for (i = 0; i < width_half; i++) {
|
||||
READ_2x2_PIXELS;
|
||||
*plane_interleaved_uv++ = MAKE_U(r, g, b);
|
||||
*plane_interleaved_uv++ = MAKE_V(r, g, b);
|
||||
}
|
||||
if (width_remainder) {
|
||||
READ_2x1_PIXELS;
|
||||
*plane_interleaved_uv++ = MAKE_U(r, g, b);
|
||||
*plane_interleaved_uv++ = MAKE_V(r, g, b);
|
||||
}
|
||||
curr_row += src_pitch_x_2;
|
||||
next_row += src_pitch_x_2;
|
||||
}
|
||||
if (height_remainder) {
|
||||
for (i = 0; i < width_half; i++) {
|
||||
READ_1x2_PIXELS;
|
||||
*plane_interleaved_uv++ = MAKE_U(r, g, b);
|
||||
*plane_interleaved_uv++ = MAKE_V(r, g, b);
|
||||
}
|
||||
if (width_remainder) {
|
||||
READ_1x1_PIXEL;
|
||||
*plane_interleaved_uv++ = MAKE_U(r, g, b);
|
||||
*plane_interleaved_uv++ = MAKE_V(r, g, b);
|
||||
}
|
||||
}
|
||||
}
|
||||
else /* dst_format == SDL_PIXELFORMAT_NV21 */
|
||||
{
|
||||
for (j = 0; j < height_half; j++) {
|
||||
for (i = 0; i < width_half; i++) {
|
||||
READ_2x2_PIXELS;
|
||||
*plane_interleaved_uv++ = MAKE_V(r, g, b);
|
||||
*plane_interleaved_uv++ = MAKE_U(r, g, b);
|
||||
}
|
||||
if (width_remainder) {
|
||||
READ_2x1_PIXELS;
|
||||
*plane_interleaved_uv++ = MAKE_V(r, g, b);
|
||||
*plane_interleaved_uv++ = MAKE_U(r, g, b);
|
||||
}
|
||||
curr_row += src_pitch_x_2;
|
||||
next_row += src_pitch_x_2;
|
||||
}
|
||||
if (height_remainder) {
|
||||
for (i = 0; i < width_half; i++) {
|
||||
READ_1x2_PIXELS;
|
||||
*plane_interleaved_uv++ = MAKE_V(r, g, b);
|
||||
*plane_interleaved_uv++ = MAKE_U(r, g, b);
|
||||
}
|
||||
if (width_remainder) {
|
||||
READ_1x1_PIXEL;
|
||||
*plane_interleaved_uv++ = MAKE_V(r, g, b);
|
||||
*plane_interleaved_uv++ = MAKE_U(r, g, b);
|
||||
}
|
||||
}
|
||||
}
|
||||
#undef READ_2x2_PIXELS
|
||||
#undef READ_2x1_PIXELS
|
||||
#undef READ_1x2_PIXELS
|
||||
#undef READ_1x1_PIXEL
|
||||
}
|
||||
break;
|
||||
|
||||
case SDL_PIXELFORMAT_YUY2:
|
||||
case SDL_PIXELFORMAT_UYVY:
|
||||
case SDL_PIXELFORMAT_YVYU:
|
||||
{
|
||||
const Uint8 *curr_row = (const Uint8*) src;
|
||||
Uint8 *plane = (Uint8*) dst;
|
||||
|
||||
#define READ_TWO_RGB_PIXELS \
|
||||
const Uint8 b = curr_row[8 * i + 0]; \
|
||||
const Uint8 g = curr_row[8 * i + 1]; \
|
||||
const Uint8 r = curr_row[8 * i + 2]; \
|
||||
const Uint8 b1 = curr_row[8 * i + 4]; \
|
||||
const Uint8 g1 = curr_row[8 * i + 5]; \
|
||||
const Uint8 r1 = curr_row[8 * i + 6]; \
|
||||
const Uint8 B = (b + b1) >> 1; \
|
||||
const Uint8 G = (g + g1) >> 1; \
|
||||
const Uint8 R = (r + r1) >> 1; \
|
||||
|
||||
#define READ_ONE_RGB_PIXEL \
|
||||
const Uint8 b = curr_row[8 * i + 0]; \
|
||||
const Uint8 g = curr_row[8 * i + 1]; \
|
||||
const Uint8 r = curr_row[8 * i + 2]; \
|
||||
|
||||
/* Write YUV plane, packed */
|
||||
if (dst_format == SDL_PIXELFORMAT_YUY2)
|
||||
{
|
||||
for (j = 0; j < height; j++) {
|
||||
for (i = 0; i < width_half; i++) {
|
||||
READ_TWO_RGB_PIXELS;
|
||||
/* Y U Y1 V */
|
||||
*plane++ = MAKE_Y(r, g, b);
|
||||
*plane++ = MAKE_U(R, G, B);
|
||||
*plane++ = MAKE_Y(r1, g1, b1);
|
||||
*plane++ = MAKE_V(R, G, B);
|
||||
}
|
||||
if (width_remainder) {
|
||||
READ_ONE_RGB_PIXEL;
|
||||
/* Y U Y V */
|
||||
*plane++ = MAKE_Y(r, g, b);
|
||||
*plane++ = MAKE_U(r, g, b);
|
||||
*plane++ = MAKE_Y(r, g, b);
|
||||
*plane++ = MAKE_V(r, g, b);
|
||||
}
|
||||
curr_row += src_pitch;
|
||||
}
|
||||
}
|
||||
else if (dst_format == SDL_PIXELFORMAT_UYVY)
|
||||
{
|
||||
for (j = 0; j < height; j++) {
|
||||
for (i = 0; i < width_half; i++) {
|
||||
READ_TWO_RGB_PIXELS;
|
||||
/* U Y V Y1 */
|
||||
*plane++ = MAKE_U(R, G, B);
|
||||
*plane++ = MAKE_Y(r, g, b);
|
||||
*plane++ = MAKE_V(R, G, B);
|
||||
*plane++ = MAKE_Y(r1, g1, b1);
|
||||
}
|
||||
if (width_remainder) {
|
||||
READ_ONE_RGB_PIXEL;
|
||||
/* U Y V Y */
|
||||
*plane++ = MAKE_U(r, g, b);
|
||||
*plane++ = MAKE_Y(r, g, b);
|
||||
*plane++ = MAKE_V(r, g, b);
|
||||
*plane++ = MAKE_Y(r, g, b);
|
||||
}
|
||||
curr_row += src_pitch;
|
||||
}
|
||||
}
|
||||
else if (dst_format == SDL_PIXELFORMAT_YVYU)
|
||||
{
|
||||
for (j = 0; j < height; j++) {
|
||||
for (i = 0; i < width_half; i++) {
|
||||
READ_TWO_RGB_PIXELS;
|
||||
/* Y V Y1 U */
|
||||
*plane++ = MAKE_Y(r, g, b);
|
||||
*plane++ = MAKE_V(R, G, B);
|
||||
*plane++ = MAKE_Y(r1, g1, b1);
|
||||
*plane++ = MAKE_U(R, G, B);
|
||||
}
|
||||
if (width_remainder) {
|
||||
READ_ONE_RGB_PIXEL;
|
||||
/* Y V Y U */
|
||||
*plane++ = MAKE_Y(r, g, b);
|
||||
*plane++ = MAKE_V(r, g, b);
|
||||
*plane++ = MAKE_Y(r, g, b);
|
||||
*plane++ = MAKE_U(r, g, b);
|
||||
}
|
||||
curr_row += src_pitch;
|
||||
}
|
||||
}
|
||||
#undef READ_TWO_RGB_PIXELS
|
||||
#undef READ_ONE_RGB_PIXEL
|
||||
}
|
||||
break;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* vi: set ts=4 sw=4 expandtab: */
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,30 @@
|
|||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2017 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
arising from the use of this software.
|
||||
|
||||
Permission is granted to anyone to use this software for any purpose,
|
||||
including commercial applications, and to alter it and redistribute it
|
||||
freely, subject to the following restrictions:
|
||||
|
||||
1. The origin of this software must not be misrepresented; you must not
|
||||
claim that you wrote the original software. If you use this software
|
||||
in a product, an acknowledgment in the product documentation would be
|
||||
appreciated but is not required.
|
||||
2. Altered source versions must be plainly marked as such, and must not be
|
||||
misrepresented as being the original software.
|
||||
3. This notice may not be removed or altered from any source distribution.
|
||||
*/
|
||||
#include "../SDL_internal.h"
|
||||
|
||||
|
||||
/* YUV conversion functions */
|
||||
|
||||
extern int SDL_ConvertPixels_YUV_to_RGB(int width, int height, Uint32 src_format, const void *src, int src_pitch, Uint32 dst_format, void *dst, int dst_pitch);
|
||||
extern int SDL_ConvertPixels_RGB_to_YUV(int width, int height, Uint32 src_format, const void *src, int src_pitch, Uint32 dst_format, void *dst, int dst_pitch);
|
||||
extern int SDL_ConvertPixels_YUV_to_YUV(int width, int height, Uint32 src_format, const void *src, int src_pitch, Uint32 dst_format, void *dst, int dst_pitch);
|
||||
|
||||
/* vi: set ts=4 sw=4 expandtab: */
|
|
@ -0,0 +1,27 @@
|
|||
Copyright (c) 2016, Adrien Descamps
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright notice, this
|
||||
list of conditions and the following disclaimer.
|
||||
|
||||
* Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation
|
||||
and/or other materials provided with the distribution.
|
||||
|
||||
* Neither the name of yuv2rgb nor the names of its
|
||||
contributors may be used to endorse or promote products derived from
|
||||
this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
||||
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
@ -0,0 +1,63 @@
|
|||
From: https://github.com/descampsa/yuv2rgb
|
||||
# yuv2rgb
|
||||
C library for fast image conversion between yuv420p and rgb24.
|
||||
|
||||
This is a simple library for optimized image conversion between YUV420p and rgb24.
|
||||
It was done mainly as an exercise to learn to use sse instrinsics, so there may still be room for optimization.
|
||||
|
||||
For each conversion, a standard c optimized function and two sse function (with aligned and unaligned memory) are implemented.
|
||||
The sse version requires only SSE2, which is available on any reasonnably recent CPU.
|
||||
The library also supports the three different YUV (YCrCb to be correct) color spaces that exist (see comments in code), and others can be added simply.
|
||||
|
||||
There is a simple test program, that convert a raw YUV file to rgb ppm format, and measure computation time.
|
||||
Optionnaly, it also compares the result and computation time with the ffmpeg implementation (that uses MMX), and with the IPP functions.
|
||||
|
||||
To compile, simply do :
|
||||
|
||||
mkdir build
|
||||
cd build
|
||||
cmake -DCMAKE_BUILD_TYPE=Release ..
|
||||
make
|
||||
|
||||
The test program only support raw YUV files for the YUV420 format, and ppm for the RGB24 format.
|
||||
To generate a raw yuv file, you can use avconv:
|
||||
|
||||
avconv -i example.jpg -c:v rawvideo -pix_fmt yuv420p example.yuv
|
||||
|
||||
To generate the rgb file, you can use the ImageMagick convert program:
|
||||
|
||||
convert example.jpg example.ppm
|
||||
|
||||
Then, for YUV420 to RGB24 conversion, use the test program like that:
|
||||
|
||||
./test_yuv_rgb yuv2rgb image.yuv 4096 2160 image
|
||||
|
||||
The second and third parameters are image width and height (that are needed because not available in the raw YUV file), and fourth parameter is the output filename template (several output files will be generated, named for example output_sse.ppm, output_av.ppm, etc.)
|
||||
|
||||
Similarly, for RGB24 to YUV420 conversion:
|
||||
|
||||
./test_yuv_rgb yuv2rgb image.ppm image
|
||||
|
||||
On my computer, the test program on a 4K image give the following for yuv2rgb:
|
||||
|
||||
Time will be measured in each configuration for 100 iterations...
|
||||
Processing time (std) : 2.630193 sec
|
||||
Processing time (sse2_unaligned) : 0.704394 sec
|
||||
Processing time (ffmpeg_unaligned) : 1.221432 sec
|
||||
Processing time (ipp_unaligned) : 0.636274 sec
|
||||
Processing time (sse2_aligned) : 0.606648 sec
|
||||
Processing time (ffmpeg_aligned) : 1.227100 sec
|
||||
Processing time (ipp_aligned) : 0.636951 sec
|
||||
|
||||
And for rgb2yuv:
|
||||
|
||||
Time will be measured in each configuration for 100 iterations...
|
||||
Processing time (std) : 2.588675 sec
|
||||
Processing time (sse2_unaligned) : 0.676625 sec
|
||||
Processing time (ffmpeg_unaligned) : 3.385816 sec
|
||||
Processing time (ipp_unaligned) : 0.593890 sec
|
||||
Processing time (sse2_aligned) : 0.640630 sec
|
||||
Processing time (ffmpeg_aligned) : 3.397952 sec
|
||||
Processing time (ipp_aligned) : 0.579043 sec
|
||||
|
||||
configuration : gcc 4.9.2, swscale 3.0.0, IPP 9.0.1, intel i7-5500U
|
|
@ -0,0 +1,687 @@
|
|||
// Copyright 2016 Adrien Descamps
|
||||
// Distributed under BSD 3-Clause License
|
||||
#include "../../SDL_internal.h"
|
||||
|
||||
#include "yuv_rgb.h"
|
||||
|
||||
#include "SDL_cpuinfo.h"
|
||||
/*#include <x86intrin.h>*/
|
||||
|
||||
#define PRECISION 6
|
||||
#define PRECISION_FACTOR (1<<PRECISION)
|
||||
|
||||
typedef struct
|
||||
{
|
||||
uint8_t y_shift;
|
||||
int16_t matrix[3][3];
|
||||
} RGB2YUVParam;
|
||||
// |Y| |y_shift| |matrix[0][0] matrix[0][1] matrix[0][2]| |R|
|
||||
// |U| = | 128 | + 1/PRECISION_FACTOR * |matrix[1][0] matrix[1][1] matrix[1][2]| * |G|
|
||||
// |V| | 128 | |matrix[2][0] matrix[2][1] matrix[2][2]| |B|
|
||||
|
||||
typedef struct
|
||||
{
|
||||
uint8_t y_shift;
|
||||
int16_t y_factor;
|
||||
int16_t v_r_factor;
|
||||
int16_t u_g_factor;
|
||||
int16_t v_g_factor;
|
||||
int16_t u_b_factor;
|
||||
} YUV2RGBParam;
|
||||
// |R| |y_factor 0 v_r_factor| |Y-y_shift|
|
||||
// |G| = 1/PRECISION_FACTOR * |y_factor u_g_factor v_g_factor| * | U-128 |
|
||||
// |B| |y_factor u_b_factor 0 | | V-128 |
|
||||
|
||||
#define V(value) (int16_t)((value*PRECISION_FACTOR)+0.5)
|
||||
|
||||
// for ITU-T T.871, values can be found in section 7
|
||||
// for ITU-R BT.601-7 values are derived from equations in sections 2.5.1-2.5.3, assuming RGB is encoded using full range ([0-1]<->[0-255])
|
||||
// for ITU-R BT.709-6 values are derived from equations in sections 3.2-3.4, assuming RGB is encoded using full range ([0-1]<->[0-255])
|
||||
// all values are rounded to the fourth decimal
|
||||
|
||||
static const YUV2RGBParam YUV2RGB[3] = {
|
||||
// ITU-T T.871 (JPEG)
|
||||
{/*.y_shift=*/ 0, /*.y_factor=*/ V(1.0), /*.v_r_factor=*/ V(1.402), /*.u_g_factor=*/ -V(0.3441), /*.v_g_factor=*/ -V(0.7141), /*.u_b_factor=*/ V(1.772)},
|
||||
// ITU-R BT.601-7
|
||||
{/*.y_shift=*/ 16, /*.y_factor=*/ V(1.1644), /*.v_r_factor=*/ V(1.596), /*.u_g_factor=*/ -V(0.3918), /*.v_g_factor=*/ -V(0.813), /*.u_b_factor=*/ V(2.0172)},
|
||||
// ITU-R BT.709-6
|
||||
{/*.y_shift=*/ 16, /*.y_factor=*/ V(1.1644), /*.v_r_factor=*/ V(1.7927), /*.u_g_factor=*/ -V(0.2132), /*.v_g_factor=*/ -V(0.5329), /*.u_b_factor=*/ V(2.1124)}
|
||||
};
|
||||
|
||||
static const RGB2YUVParam RGB2YUV[3] = {
|
||||
// ITU-T T.871 (JPEG)
|
||||
{/*.y_shift=*/ 0, /*.matrix=*/ {{V(0.299), V(0.587), V(0.114)}, {-V(0.1687), -V(0.3313), V(0.5)}, {V(0.5), -V(0.4187), -V(0.0813)}}},
|
||||
// ITU-R BT.601-7
|
||||
{/*.y_shift=*/ 16, /*.matrix=*/ {{V(0.2568), V(0.5041), V(0.0979)}, {-V(0.1482), -V(0.291), V(0.4392)}, {V(0.4392), -V(0.3678), -V(0.0714)}}},
|
||||
// ITU-R BT.709-6
|
||||
{/*.y_shift=*/ 16, /*.matrix=*/ {{V(0.1826), V(0.6142), V(0.062)}, {-V(0.1006), -V(0.3386), V(0.4392)}, {V(0.4392), -V(0.3989), -V(0.0403)}}}
|
||||
};
|
||||
|
||||
/* The various layouts of YUV data we support */
|
||||
#define YUV_FORMAT_420 1
|
||||
#define YUV_FORMAT_422 2
|
||||
#define YUV_FORMAT_NV12 3
|
||||
|
||||
/* The various formats of RGB pixel that we support */
|
||||
#define RGB_FORMAT_RGB565 1
|
||||
#define RGB_FORMAT_RGB24 2
|
||||
#define RGB_FORMAT_RGBA 3
|
||||
#define RGB_FORMAT_BGRA 4
|
||||
#define RGB_FORMAT_ARGB 5
|
||||
#define RGB_FORMAT_ABGR 6
|
||||
|
||||
// divide by PRECISION_FACTOR and clamp to [0:255] interval
|
||||
// input must be in the [-128*PRECISION_FACTOR:384*PRECISION_FACTOR] range
|
||||
static uint8_t clampU8(int32_t v)
|
||||
{
|
||||
static const uint8_t lut[512] =
|
||||
{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,
|
||||
47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,
|
||||
91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,
|
||||
126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,
|
||||
159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,
|
||||
192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207,208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,223,224,
|
||||
225,226,227,228,229,230,231,232,233,234,235,236,237,238,239,240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,
|
||||
255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
|
||||
255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
|
||||
255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
|
||||
255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255
|
||||
};
|
||||
return lut[(v+128*PRECISION_FACTOR)>>PRECISION];
|
||||
}
|
||||
|
||||
|
||||
#define STD_FUNCTION_NAME yuv420_rgb565_std
|
||||
#define YUV_FORMAT YUV_FORMAT_420
|
||||
#define RGB_FORMAT RGB_FORMAT_RGB565
|
||||
#include "yuv_rgb_std_func.h"
|
||||
|
||||
#define STD_FUNCTION_NAME yuv420_rgb24_std
|
||||
#define YUV_FORMAT YUV_FORMAT_420
|
||||
#define RGB_FORMAT RGB_FORMAT_RGB24
|
||||
#include "yuv_rgb_std_func.h"
|
||||
|
||||
#define STD_FUNCTION_NAME yuv420_rgba_std
|
||||
#define YUV_FORMAT YUV_FORMAT_420
|
||||
#define RGB_FORMAT RGB_FORMAT_RGBA
|
||||
#include "yuv_rgb_std_func.h"
|
||||
|
||||
#define STD_FUNCTION_NAME yuv420_bgra_std
|
||||
#define YUV_FORMAT YUV_FORMAT_420
|
||||
#define RGB_FORMAT RGB_FORMAT_BGRA
|
||||
#include "yuv_rgb_std_func.h"
|
||||
|
||||
#define STD_FUNCTION_NAME yuv420_argb_std
|
||||
#define YUV_FORMAT YUV_FORMAT_420
|
||||
#define RGB_FORMAT RGB_FORMAT_ARGB
|
||||
#include "yuv_rgb_std_func.h"
|
||||
|
||||
#define STD_FUNCTION_NAME yuv420_abgr_std
|
||||
#define YUV_FORMAT YUV_FORMAT_420
|
||||
#define RGB_FORMAT RGB_FORMAT_ABGR
|
||||
#include "yuv_rgb_std_func.h"
|
||||
|
||||
#define STD_FUNCTION_NAME yuv422_rgb565_std
|
||||
#define YUV_FORMAT YUV_FORMAT_422
|
||||
#define RGB_FORMAT RGB_FORMAT_RGB565
|
||||
#include "yuv_rgb_std_func.h"
|
||||
|
||||
#define STD_FUNCTION_NAME yuv422_rgb24_std
|
||||
#define YUV_FORMAT YUV_FORMAT_422
|
||||
#define RGB_FORMAT RGB_FORMAT_RGB24
|
||||
#include "yuv_rgb_std_func.h"
|
||||
|
||||
#define STD_FUNCTION_NAME yuv422_rgba_std
|
||||
#define YUV_FORMAT YUV_FORMAT_422
|
||||
#define RGB_FORMAT RGB_FORMAT_RGBA
|
||||
#include "yuv_rgb_std_func.h"
|
||||
|
||||
#define STD_FUNCTION_NAME yuv422_bgra_std
|
||||
#define YUV_FORMAT YUV_FORMAT_422
|
||||
#define RGB_FORMAT RGB_FORMAT_BGRA
|
||||
#include "yuv_rgb_std_func.h"
|
||||
|
||||
#define STD_FUNCTION_NAME yuv422_argb_std
|
||||
#define YUV_FORMAT YUV_FORMAT_422
|
||||
#define RGB_FORMAT RGB_FORMAT_ARGB
|
||||
#include "yuv_rgb_std_func.h"
|
||||
|
||||
#define STD_FUNCTION_NAME yuv422_abgr_std
|
||||
#define YUV_FORMAT YUV_FORMAT_422
|
||||
#define RGB_FORMAT RGB_FORMAT_ABGR
|
||||
#include "yuv_rgb_std_func.h"
|
||||
|
||||
#define STD_FUNCTION_NAME yuvnv12_rgb565_std
|
||||
#define YUV_FORMAT YUV_FORMAT_NV12
|
||||
#define RGB_FORMAT RGB_FORMAT_RGB565
|
||||
#include "yuv_rgb_std_func.h"
|
||||
|
||||
#define STD_FUNCTION_NAME yuvnv12_rgb24_std
|
||||
#define YUV_FORMAT YUV_FORMAT_NV12
|
||||
#define RGB_FORMAT RGB_FORMAT_RGB24
|
||||
#include "yuv_rgb_std_func.h"
|
||||
|
||||
#define STD_FUNCTION_NAME yuvnv12_rgba_std
|
||||
#define YUV_FORMAT YUV_FORMAT_NV12
|
||||
#define RGB_FORMAT RGB_FORMAT_RGBA
|
||||
#include "yuv_rgb_std_func.h"
|
||||
|
||||
#define STD_FUNCTION_NAME yuvnv12_bgra_std
|
||||
#define YUV_FORMAT YUV_FORMAT_NV12
|
||||
#define RGB_FORMAT RGB_FORMAT_BGRA
|
||||
#include "yuv_rgb_std_func.h"
|
||||
|
||||
#define STD_FUNCTION_NAME yuvnv12_argb_std
|
||||
#define YUV_FORMAT YUV_FORMAT_NV12
|
||||
#define RGB_FORMAT RGB_FORMAT_ARGB
|
||||
#include "yuv_rgb_std_func.h"
|
||||
|
||||
#define STD_FUNCTION_NAME yuvnv12_abgr_std
|
||||
#define YUV_FORMAT YUV_FORMAT_NV12
|
||||
#define RGB_FORMAT RGB_FORMAT_ABGR
|
||||
#include "yuv_rgb_std_func.h"
|
||||
|
||||
void rgb24_yuv420_std(
|
||||
uint32_t width, uint32_t height,
|
||||
const uint8_t *RGB, uint32_t RGB_stride,
|
||||
uint8_t *Y, uint8_t *U, uint8_t *V, uint32_t Y_stride, uint32_t UV_stride,
|
||||
YCbCrType yuv_type)
|
||||
{
|
||||
const RGB2YUVParam *const param = &(RGB2YUV[yuv_type]);
|
||||
|
||||
uint32_t x, y;
|
||||
for(y=0; y<(height-1); y+=2)
|
||||
{
|
||||
const uint8_t *rgb_ptr1=RGB+y*RGB_stride,
|
||||
*rgb_ptr2=RGB+(y+1)*RGB_stride;
|
||||
|
||||
uint8_t *y_ptr1=Y+y*Y_stride,
|
||||
*y_ptr2=Y+(y+1)*Y_stride,
|
||||
*u_ptr=U+(y/2)*UV_stride,
|
||||
*v_ptr=V+(y/2)*UV_stride;
|
||||
|
||||
for(x=0; x<(width-1); x+=2)
|
||||
{
|
||||
// compute yuv for the four pixels, u and v values are summed
|
||||
int32_t y_tmp, u_tmp, v_tmp;
|
||||
|
||||
y_tmp = param->matrix[0][0]*rgb_ptr1[0] + param->matrix[0][1]*rgb_ptr1[1] + param->matrix[0][2]*rgb_ptr1[2];
|
||||
u_tmp = param->matrix[1][0]*rgb_ptr1[0] + param->matrix[1][1]*rgb_ptr1[1] + param->matrix[1][2]*rgb_ptr1[2];
|
||||
v_tmp = param->matrix[2][0]*rgb_ptr1[0] + param->matrix[2][1]*rgb_ptr1[1] + param->matrix[2][2]*rgb_ptr1[2];
|
||||
y_ptr1[0]=clampU8(y_tmp+((param->y_shift)<<PRECISION));
|
||||
|
||||
y_tmp = param->matrix[0][0]*rgb_ptr1[3] + param->matrix[0][1]*rgb_ptr1[4] + param->matrix[0][2]*rgb_ptr1[5];
|
||||
u_tmp += param->matrix[1][0]*rgb_ptr1[3] + param->matrix[1][1]*rgb_ptr1[4] + param->matrix[1][2]*rgb_ptr1[5];
|
||||
v_tmp += param->matrix[2][0]*rgb_ptr1[3] + param->matrix[2][1]*rgb_ptr1[4] + param->matrix[2][2]*rgb_ptr1[5];
|
||||
y_ptr1[1]=clampU8(y_tmp+((param->y_shift)<<PRECISION));
|
||||
|
||||
y_tmp = param->matrix[0][0]*rgb_ptr2[0] + param->matrix[0][1]*rgb_ptr2[1] + param->matrix[0][2]*rgb_ptr2[2];
|
||||
u_tmp += param->matrix[1][0]*rgb_ptr2[0] + param->matrix[1][1]*rgb_ptr2[1] + param->matrix[1][2]*rgb_ptr2[2];
|
||||
v_tmp += param->matrix[2][0]*rgb_ptr2[0] + param->matrix[2][1]*rgb_ptr2[1] + param->matrix[2][2]*rgb_ptr2[2];
|
||||
y_ptr2[0]=clampU8(y_tmp+((param->y_shift)<<PRECISION));
|
||||
|
||||
y_tmp = param->matrix[0][0]*rgb_ptr2[3] + param->matrix[0][1]*rgb_ptr2[4] + param->matrix[0][2]*rgb_ptr2[5];
|
||||
u_tmp += param->matrix[1][0]*rgb_ptr2[3] + param->matrix[1][1]*rgb_ptr2[4] + param->matrix[1][2]*rgb_ptr2[5];
|
||||
v_tmp += param->matrix[2][0]*rgb_ptr2[3] + param->matrix[2][1]*rgb_ptr2[4] + param->matrix[2][2]*rgb_ptr2[5];
|
||||
y_ptr2[1]=clampU8(y_tmp+((param->y_shift)<<PRECISION));
|
||||
|
||||
u_ptr[0] = clampU8(u_tmp/4+(128<<PRECISION));
|
||||
v_ptr[0] = clampU8(v_tmp/4+(128<<PRECISION));
|
||||
|
||||
rgb_ptr1 += 6;
|
||||
rgb_ptr2 += 6;
|
||||
y_ptr1 += 2;
|
||||
y_ptr2 += 2;
|
||||
u_ptr += 1;
|
||||
v_ptr += 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef __SSE2__
|
||||
|
||||
#define SSE_FUNCTION_NAME yuv420_rgb565_sse
|
||||
#define STD_FUNCTION_NAME yuv420_rgb565_std
|
||||
#define YUV_FORMAT YUV_FORMAT_420
|
||||
#define RGB_FORMAT RGB_FORMAT_RGB565
|
||||
#define SSE_ALIGNED
|
||||
#include "yuv_rgb_sse_func.h"
|
||||
|
||||
#define SSE_FUNCTION_NAME yuv420_rgb565_sseu
|
||||
#define STD_FUNCTION_NAME yuv420_rgb565_std
|
||||
#define YUV_FORMAT YUV_FORMAT_420
|
||||
#define RGB_FORMAT RGB_FORMAT_RGB565
|
||||
#include "yuv_rgb_sse_func.h"
|
||||
|
||||
#define SSE_FUNCTION_NAME yuv420_rgb24_sse
|
||||
#define STD_FUNCTION_NAME yuv420_rgb24_std
|
||||
#define YUV_FORMAT YUV_FORMAT_420
|
||||
#define RGB_FORMAT RGB_FORMAT_RGB24
|
||||
#define SSE_ALIGNED
|
||||
#include "yuv_rgb_sse_func.h"
|
||||
|
||||
#define SSE_FUNCTION_NAME yuv420_rgb24_sseu
|
||||
#define STD_FUNCTION_NAME yuv420_rgb24_std
|
||||
#define YUV_FORMAT YUV_FORMAT_420
|
||||
#define RGB_FORMAT RGB_FORMAT_RGB24
|
||||
#include "yuv_rgb_sse_func.h"
|
||||
|
||||
#define SSE_FUNCTION_NAME yuv420_rgba_sse
|
||||
#define STD_FUNCTION_NAME yuv420_rgba_std
|
||||
#define YUV_FORMAT YUV_FORMAT_420
|
||||
#define RGB_FORMAT RGB_FORMAT_RGBA
|
||||
#define SSE_ALIGNED
|
||||
#include "yuv_rgb_sse_func.h"
|
||||
|
||||
#define SSE_FUNCTION_NAME yuv420_rgba_sseu
|
||||
#define STD_FUNCTION_NAME yuv420_rgba_std
|
||||
#define YUV_FORMAT YUV_FORMAT_420
|
||||
#define RGB_FORMAT RGB_FORMAT_RGBA
|
||||
#include "yuv_rgb_sse_func.h"
|
||||
|
||||
#define SSE_FUNCTION_NAME yuv420_bgra_sse
|
||||
#define STD_FUNCTION_NAME yuv420_bgra_std
|
||||
#define YUV_FORMAT YUV_FORMAT_420
|
||||
#define RGB_FORMAT RGB_FORMAT_BGRA
|
||||
#define SSE_ALIGNED
|
||||
#include "yuv_rgb_sse_func.h"
|
||||
|
||||
#define SSE_FUNCTION_NAME yuv420_bgra_sseu
|
||||
#define STD_FUNCTION_NAME yuv420_bgra_std
|
||||
#define YUV_FORMAT YUV_FORMAT_420
|
||||
#define RGB_FORMAT RGB_FORMAT_BGRA
|
||||
#include "yuv_rgb_sse_func.h"
|
||||
|
||||
#define SSE_FUNCTION_NAME yuv420_argb_sse
|
||||
#define STD_FUNCTION_NAME yuv420_argb_std
|
||||
#define YUV_FORMAT YUV_FORMAT_420
|
||||
#define RGB_FORMAT RGB_FORMAT_ARGB
|
||||
#define SSE_ALIGNED
|
||||
#include "yuv_rgb_sse_func.h"
|
||||
|
||||
#define SSE_FUNCTION_NAME yuv420_argb_sseu
|
||||
#define STD_FUNCTION_NAME yuv420_argb_std
|
||||
#define YUV_FORMAT YUV_FORMAT_420
|
||||
#define RGB_FORMAT RGB_FORMAT_ARGB
|
||||
#include "yuv_rgb_sse_func.h"
|
||||
|
||||
#define SSE_FUNCTION_NAME yuv420_abgr_sse
|
||||
#define STD_FUNCTION_NAME yuv420_abgr_std
|
||||
#define YUV_FORMAT YUV_FORMAT_420
|
||||
#define RGB_FORMAT RGB_FORMAT_ABGR
|
||||
#define SSE_ALIGNED
|
||||
#include "yuv_rgb_sse_func.h"
|
||||
|
||||
#define SSE_FUNCTION_NAME yuv420_abgr_sseu
|
||||
#define STD_FUNCTION_NAME yuv420_abgr_std
|
||||
#define YUV_FORMAT YUV_FORMAT_420
|
||||
#define RGB_FORMAT RGB_FORMAT_ABGR
|
||||
#include "yuv_rgb_sse_func.h"
|
||||
|
||||
#define SSE_FUNCTION_NAME yuv422_rgb565_sse
|
||||
#define STD_FUNCTION_NAME yuv422_rgb565_std
|
||||
#define YUV_FORMAT YUV_FORMAT_422
|
||||
#define RGB_FORMAT RGB_FORMAT_RGB565
|
||||
#define SSE_ALIGNED
|
||||
#include "yuv_rgb_sse_func.h"
|
||||
|
||||
#define SSE_FUNCTION_NAME yuv422_rgb565_sseu
|
||||
#define STD_FUNCTION_NAME yuv422_rgb565_std
|
||||
#define YUV_FORMAT YUV_FORMAT_422
|
||||
#define RGB_FORMAT RGB_FORMAT_RGB565
|
||||
#include "yuv_rgb_sse_func.h"
|
||||
|
||||
#define SSE_FUNCTION_NAME yuv422_rgb24_sse
|
||||
#define STD_FUNCTION_NAME yuv422_rgb24_std
|
||||
#define YUV_FORMAT YUV_FORMAT_422
|
||||
#define RGB_FORMAT RGB_FORMAT_RGB24
|
||||
#define SSE_ALIGNED
|
||||
#include "yuv_rgb_sse_func.h"
|
||||
|
||||
#define SSE_FUNCTION_NAME yuv422_rgb24_sseu
|
||||
#define STD_FUNCTION_NAME yuv422_rgb24_std
|
||||
#define YUV_FORMAT YUV_FORMAT_422
|
||||
#define RGB_FORMAT RGB_FORMAT_RGB24
|
||||
#include "yuv_rgb_sse_func.h"
|
||||
|
||||
#define SSE_FUNCTION_NAME yuv422_rgba_sse
|
||||
#define STD_FUNCTION_NAME yuv422_rgba_std
|
||||
#define YUV_FORMAT YUV_FORMAT_422
|
||||
#define RGB_FORMAT RGB_FORMAT_RGBA
|
||||
#define SSE_ALIGNED
|
||||
#include "yuv_rgb_sse_func.h"
|
||||
|
||||
#define SSE_FUNCTION_NAME yuv422_rgba_sseu
|
||||
#define STD_FUNCTION_NAME yuv422_rgba_std
|
||||
#define YUV_FORMAT YUV_FORMAT_422
|
||||
#define RGB_FORMAT RGB_FORMAT_RGBA
|
||||
#include "yuv_rgb_sse_func.h"
|
||||
|
||||
#define SSE_FUNCTION_NAME yuv422_bgra_sse
|
||||
#define STD_FUNCTION_NAME yuv422_bgra_std
|
||||
#define YUV_FORMAT YUV_FORMAT_422
|
||||
#define RGB_FORMAT RGB_FORMAT_BGRA
|
||||
#define SSE_ALIGNED
|
||||
#include "yuv_rgb_sse_func.h"
|
||||
|
||||
#define SSE_FUNCTION_NAME yuv422_bgra_sseu
|
||||
#define STD_FUNCTION_NAME yuv422_bgra_std
|
||||
#define YUV_FORMAT YUV_FORMAT_422
|
||||
#define RGB_FORMAT RGB_FORMAT_BGRA
|
||||
#include "yuv_rgb_sse_func.h"
|
||||
|
||||
#define SSE_FUNCTION_NAME yuv422_argb_sse
|
||||
#define STD_FUNCTION_NAME yuv422_argb_std
|
||||
#define YUV_FORMAT YUV_FORMAT_422
|
||||
#define RGB_FORMAT RGB_FORMAT_ARGB
|
||||
#define SSE_ALIGNED
|
||||
#include "yuv_rgb_sse_func.h"
|
||||
|
||||
#define SSE_FUNCTION_NAME yuv422_argb_sseu
|
||||
#define STD_FUNCTION_NAME yuv422_argb_std
|
||||
#define YUV_FORMAT YUV_FORMAT_422
|
||||
#define RGB_FORMAT RGB_FORMAT_ARGB
|
||||
#include "yuv_rgb_sse_func.h"
|
||||
|
||||
#define SSE_FUNCTION_NAME yuv422_abgr_sse
|
||||
#define STD_FUNCTION_NAME yuv422_abgr_std
|
||||
#define YUV_FORMAT YUV_FORMAT_422
|
||||
#define RGB_FORMAT RGB_FORMAT_ABGR
|
||||
#define SSE_ALIGNED
|
||||
#include "yuv_rgb_sse_func.h"
|
||||
|
||||
#define SSE_FUNCTION_NAME yuv422_abgr_sseu
|
||||
#define STD_FUNCTION_NAME yuv422_abgr_std
|
||||
#define YUV_FORMAT YUV_FORMAT_422
|
||||
#define RGB_FORMAT RGB_FORMAT_ABGR
|
||||
#include "yuv_rgb_sse_func.h"
|
||||
|
||||
#define SSE_FUNCTION_NAME yuvnv12_rgb565_sse
|
||||
#define STD_FUNCTION_NAME yuvnv12_rgb565_std
|
||||
#define YUV_FORMAT YUV_FORMAT_NV12
|
||||
#define RGB_FORMAT RGB_FORMAT_RGB565
|
||||
#define SSE_ALIGNED
|
||||
#include "yuv_rgb_sse_func.h"
|
||||
|
||||
#define SSE_FUNCTION_NAME yuvnv12_rgb565_sseu
|
||||
#define STD_FUNCTION_NAME yuvnv12_rgb565_std
|
||||
#define YUV_FORMAT YUV_FORMAT_NV12
|
||||
#define RGB_FORMAT RGB_FORMAT_RGB565
|
||||
#include "yuv_rgb_sse_func.h"
|
||||
|
||||
#define SSE_FUNCTION_NAME yuvnv12_rgb24_sse
|
||||
#define STD_FUNCTION_NAME yuvnv12_rgb24_std
|
||||
#define YUV_FORMAT YUV_FORMAT_NV12
|
||||
#define RGB_FORMAT RGB_FORMAT_RGB24
|
||||
#define SSE_ALIGNED
|
||||
#include "yuv_rgb_sse_func.h"
|
||||
|
||||
#define SSE_FUNCTION_NAME yuvnv12_rgb24_sseu
|
||||
#define STD_FUNCTION_NAME yuvnv12_rgb24_std
|
||||
#define YUV_FORMAT YUV_FORMAT_NV12
|
||||
#define RGB_FORMAT RGB_FORMAT_RGB24
|
||||
#include "yuv_rgb_sse_func.h"
|
||||
|
||||
#define SSE_FUNCTION_NAME yuvnv12_rgba_sse
|
||||
#define STD_FUNCTION_NAME yuvnv12_rgba_std
|
||||
#define YUV_FORMAT YUV_FORMAT_NV12
|
||||
#define RGB_FORMAT RGB_FORMAT_RGBA
|
||||
#define SSE_ALIGNED
|
||||
#include "yuv_rgb_sse_func.h"
|
||||
|
||||
#define SSE_FUNCTION_NAME yuvnv12_rgba_sseu
|
||||
#define STD_FUNCTION_NAME yuvnv12_rgba_std
|
||||
#define YUV_FORMAT YUV_FORMAT_NV12
|
||||
#define RGB_FORMAT RGB_FORMAT_RGBA
|
||||
#include "yuv_rgb_sse_func.h"
|
||||
|
||||
#define SSE_FUNCTION_NAME yuvnv12_bgra_sse
|
||||
#define STD_FUNCTION_NAME yuvnv12_bgra_std
|
||||
#define YUV_FORMAT YUV_FORMAT_NV12
|
||||
#define RGB_FORMAT RGB_FORMAT_BGRA
|
||||
#define SSE_ALIGNED
|
||||
#include "yuv_rgb_sse_func.h"
|
||||
|
||||
#define SSE_FUNCTION_NAME yuvnv12_bgra_sseu
|
||||
#define STD_FUNCTION_NAME yuvnv12_bgra_std
|
||||
#define YUV_FORMAT YUV_FORMAT_NV12
|
||||
#define RGB_FORMAT RGB_FORMAT_BGRA
|
||||
#include "yuv_rgb_sse_func.h"
|
||||
|
||||
#define SSE_FUNCTION_NAME yuvnv12_argb_sse
|
||||
#define STD_FUNCTION_NAME yuvnv12_argb_std
|
||||
#define YUV_FORMAT YUV_FORMAT_NV12
|
||||
#define RGB_FORMAT RGB_FORMAT_ARGB
|
||||
#define SSE_ALIGNED
|
||||
#include "yuv_rgb_sse_func.h"
|
||||
|
||||
#define SSE_FUNCTION_NAME yuvnv12_argb_sseu
|
||||
#define STD_FUNCTION_NAME yuvnv12_argb_std
|
||||
#define YUV_FORMAT YUV_FORMAT_NV12
|
||||
#define RGB_FORMAT RGB_FORMAT_ARGB
|
||||
#include "yuv_rgb_sse_func.h"
|
||||
|
||||
#define SSE_FUNCTION_NAME yuvnv12_abgr_sse
|
||||
#define STD_FUNCTION_NAME yuvnv12_abgr_std
|
||||
#define YUV_FORMAT YUV_FORMAT_NV12
|
||||
#define RGB_FORMAT RGB_FORMAT_ABGR
|
||||
#define SSE_ALIGNED
|
||||
#include "yuv_rgb_sse_func.h"
|
||||
|
||||
#define SSE_FUNCTION_NAME yuvnv12_abgr_sseu
|
||||
#define STD_FUNCTION_NAME yuvnv12_abgr_std
|
||||
#define YUV_FORMAT YUV_FORMAT_NV12
|
||||
#define RGB_FORMAT RGB_FORMAT_ABGR
|
||||
#include "yuv_rgb_sse_func.h"
|
||||
|
||||
|
||||
#define UNPACK_RGB24_32_STEP1(RGB1, RGB2, RGB3, RGB4, RGB5, RGB6, R1, R2, G1, G2, B1, B2) \
|
||||
R1 = _mm_unpacklo_epi8(RGB1, RGB4); \
|
||||
R2 = _mm_unpackhi_epi8(RGB1, RGB4); \
|
||||
G1 = _mm_unpacklo_epi8(RGB2, RGB5); \
|
||||
G2 = _mm_unpackhi_epi8(RGB2, RGB5); \
|
||||
B1 = _mm_unpacklo_epi8(RGB3, RGB6); \
|
||||
B2 = _mm_unpackhi_epi8(RGB3, RGB6);
|
||||
|
||||
#define UNPACK_RGB24_32_STEP2(RGB1, RGB2, RGB3, RGB4, RGB5, RGB6, R1, R2, G1, G2, B1, B2) \
|
||||
RGB1 = _mm_unpacklo_epi8(R1, G2); \
|
||||
RGB2 = _mm_unpackhi_epi8(R1, G2); \
|
||||
RGB3 = _mm_unpacklo_epi8(R2, B1); \
|
||||
RGB4 = _mm_unpackhi_epi8(R2, B1); \
|
||||
RGB5 = _mm_unpacklo_epi8(G1, B2); \
|
||||
RGB6 = _mm_unpackhi_epi8(G1, B2); \
|
||||
|
||||
#define UNPACK_RGB24_32(RGB1, RGB2, RGB3, RGB4, RGB5, RGB6, R1, R2, G1, G2, B1, B2) \
|
||||
UNPACK_RGB24_32_STEP1(RGB1, RGB2, RGB3, RGB4, RGB5, RGB6, R1, R2, G1, G2, B1, B2) \
|
||||
UNPACK_RGB24_32_STEP2(RGB1, RGB2, RGB3, RGB4, RGB5, RGB6, R1, R2, G1, G2, B1, B2) \
|
||||
UNPACK_RGB24_32_STEP1(RGB1, RGB2, RGB3, RGB4, RGB5, RGB6, R1, R2, G1, G2, B1, B2) \
|
||||
UNPACK_RGB24_32_STEP2(RGB1, RGB2, RGB3, RGB4, RGB5, RGB6, R1, R2, G1, G2, B1, B2) \
|
||||
UNPACK_RGB24_32_STEP1(RGB1, RGB2, RGB3, RGB4, RGB5, RGB6, R1, R2, G1, G2, B1, B2) \
|
||||
|
||||
#define RGB2YUV_16(R, G, B, Y, U, V) \
|
||||
Y = _mm_add_epi16(_mm_mullo_epi16(R, _mm_set1_epi16(param->matrix[0][0])), \
|
||||
_mm_mullo_epi16(G, _mm_set1_epi16(param->matrix[0][1]))); \
|
||||
Y = _mm_add_epi16(Y, _mm_mullo_epi16(B, _mm_set1_epi16(param->matrix[0][2]))); \
|
||||
Y = _mm_add_epi16(Y, _mm_set1_epi16((param->y_shift)<<PRECISION)); \
|
||||
Y = _mm_srai_epi16(Y, PRECISION); \
|
||||
U = _mm_add_epi16(_mm_mullo_epi16(R, _mm_set1_epi16(param->matrix[1][0])), \
|
||||
_mm_mullo_epi16(G, _mm_set1_epi16(param->matrix[1][1]))); \
|
||||
U = _mm_add_epi16(U, _mm_mullo_epi16(B, _mm_set1_epi16(param->matrix[1][2]))); \
|
||||
U = _mm_add_epi16(U, _mm_set1_epi16(128<<PRECISION)); \
|
||||
U = _mm_srai_epi16(U, PRECISION); \
|
||||
V = _mm_add_epi16(_mm_mullo_epi16(R, _mm_set1_epi16(param->matrix[2][0])), \
|
||||
_mm_mullo_epi16(G, _mm_set1_epi16(param->matrix[2][1]))); \
|
||||
V = _mm_add_epi16(V, _mm_mullo_epi16(B, _mm_set1_epi16(param->matrix[2][2]))); \
|
||||
V = _mm_add_epi16(V, _mm_set1_epi16(128<<PRECISION)); \
|
||||
V = _mm_srai_epi16(V, PRECISION);
|
||||
|
||||
#define RGB2YUV_32 \
|
||||
__m128i r1, r2, b1, b2, g1, g2; \
|
||||
__m128i r_16, g_16, b_16; \
|
||||
__m128i y1_16, y2_16, u1_16, u2_16, v1_16, v2_16, y, u1, u2, v1, v2, u1_tmp, u2_tmp, v1_tmp, v2_tmp; \
|
||||
__m128i rgb1 = LOAD_SI128((const __m128i*)(rgb_ptr1)), \
|
||||
rgb2 = LOAD_SI128((const __m128i*)(rgb_ptr1+16)), \
|
||||
rgb3 = LOAD_SI128((const __m128i*)(rgb_ptr1+32)), \
|
||||
rgb4 = LOAD_SI128((const __m128i*)(rgb_ptr2)), \
|
||||
rgb5 = LOAD_SI128((const __m128i*)(rgb_ptr2+16)), \
|
||||
rgb6 = LOAD_SI128((const __m128i*)(rgb_ptr2+32)); \
|
||||
/* unpack rgb24 data to r, g and b data in separate channels*/ \
|
||||
UNPACK_RGB24_32(rgb1, rgb2, rgb3, rgb4, rgb5, rgb6, r1, r2, g1, g2, b1, b2) \
|
||||
/* process pixels of first line */ \
|
||||
r_16 = _mm_unpacklo_epi8(r1, _mm_setzero_si128()); \
|
||||
g_16 = _mm_unpacklo_epi8(g1, _mm_setzero_si128()); \
|
||||
b_16 = _mm_unpacklo_epi8(b1, _mm_setzero_si128()); \
|
||||
RGB2YUV_16(r_16, g_16, b_16, y1_16, u1_16, v1_16) \
|
||||
r_16 = _mm_unpackhi_epi8(r1, _mm_setzero_si128()); \
|
||||
g_16 = _mm_unpackhi_epi8(g1, _mm_setzero_si128()); \
|
||||
b_16 = _mm_unpackhi_epi8(b1, _mm_setzero_si128()); \
|
||||
RGB2YUV_16(r_16, g_16, b_16, y2_16, u2_16, v2_16) \
|
||||
y = _mm_packus_epi16(y1_16, y2_16); \
|
||||
u1 = _mm_packus_epi16(u1_16, u2_16); \
|
||||
v1 = _mm_packus_epi16(v1_16, v2_16); \
|
||||
/* save Y values */ \
|
||||
SAVE_SI128((__m128i*)(y_ptr1), y); \
|
||||
/* process pixels of second line */ \
|
||||
r_16 = _mm_unpacklo_epi8(r2, _mm_setzero_si128()); \
|
||||
g_16 = _mm_unpacklo_epi8(g2, _mm_setzero_si128()); \
|
||||
b_16 = _mm_unpacklo_epi8(b2, _mm_setzero_si128()); \
|
||||
RGB2YUV_16(r_16, g_16, b_16, y1_16, u1_16, v1_16) \
|
||||
r_16 = _mm_unpackhi_epi8(r2, _mm_setzero_si128()); \
|
||||
g_16 = _mm_unpackhi_epi8(g2, _mm_setzero_si128()); \
|
||||
b_16 = _mm_unpackhi_epi8(b2, _mm_setzero_si128()); \
|
||||
RGB2YUV_16(r_16, g_16, b_16, y2_16, u2_16, v2_16) \
|
||||
y = _mm_packus_epi16(y1_16, y2_16); \
|
||||
u2 = _mm_packus_epi16(u1_16, u2_16); \
|
||||
v2 = _mm_packus_epi16(v1_16, v2_16); \
|
||||
/* save Y values */ \
|
||||
SAVE_SI128((__m128i*)(y_ptr2), y); \
|
||||
/* vertical subsampling of u/v values */ \
|
||||
u1_tmp = _mm_avg_epu8(u1, u2); \
|
||||
v1_tmp = _mm_avg_epu8(v1, v2); \
|
||||
/* do the same again with next data */ \
|
||||
rgb1 = LOAD_SI128((const __m128i*)(rgb_ptr1+48)); \
|
||||
rgb2 = LOAD_SI128((const __m128i*)(rgb_ptr1+64)); \
|
||||
rgb3 = LOAD_SI128((const __m128i*)(rgb_ptr1+80)); \
|
||||
rgb4 = LOAD_SI128((const __m128i*)(rgb_ptr2+48)); \
|
||||
rgb5 = LOAD_SI128((const __m128i*)(rgb_ptr2+64)); \
|
||||
rgb6 = LOAD_SI128((const __m128i*)(rgb_ptr2+80)); \
|
||||
/* unpack rgb24 data to r, g and b data in separate channels*/ \
|
||||
UNPACK_RGB24_32(rgb1, rgb2, rgb3, rgb4, rgb5, rgb6, r1, r2, g1, g2, b1, b2) \
|
||||
/* process pixels of first line */ \
|
||||
r_16 = _mm_unpacklo_epi8(r1, _mm_setzero_si128()); \
|
||||
g_16 = _mm_unpacklo_epi8(g1, _mm_setzero_si128()); \
|
||||
b_16 = _mm_unpacklo_epi8(b1, _mm_setzero_si128()); \
|
||||
RGB2YUV_16(r_16, g_16, b_16, y1_16, u1_16, v1_16) \
|
||||
r_16 = _mm_unpackhi_epi8(r1, _mm_setzero_si128()); \
|
||||
g_16 = _mm_unpackhi_epi8(g1, _mm_setzero_si128()); \
|
||||
b_16 = _mm_unpackhi_epi8(b1, _mm_setzero_si128()); \
|
||||
RGB2YUV_16(r_16, g_16, b_16, y2_16, u2_16, v2_16) \
|
||||
y = _mm_packus_epi16(y1_16, y2_16); \
|
||||
u1 = _mm_packus_epi16(u1_16, u2_16); \
|
||||
v1 = _mm_packus_epi16(v1_16, v2_16); \
|
||||
/* save Y values */ \
|
||||
SAVE_SI128((__m128i*)(y_ptr1+16), y); \
|
||||
/* process pixels of second line */ \
|
||||
r_16 = _mm_unpacklo_epi8(r2, _mm_setzero_si128()); \
|
||||
g_16 = _mm_unpacklo_epi8(g2, _mm_setzero_si128()); \
|
||||
b_16 = _mm_unpacklo_epi8(b2, _mm_setzero_si128()); \
|
||||
RGB2YUV_16(r_16, g_16, b_16, y1_16, u1_16, v1_16) \
|
||||
r_16 = _mm_unpackhi_epi8(r2, _mm_setzero_si128()); \
|
||||
g_16 = _mm_unpackhi_epi8(g2, _mm_setzero_si128()); \
|
||||
b_16 = _mm_unpackhi_epi8(b2, _mm_setzero_si128()); \
|
||||
RGB2YUV_16(r_16, g_16, b_16, y2_16, u2_16, v2_16) \
|
||||
y = _mm_packus_epi16(y1_16, y2_16); \
|
||||
u2 = _mm_packus_epi16(u1_16, u2_16); \
|
||||
v2 = _mm_packus_epi16(v1_16, v2_16); \
|
||||
/* save Y values */ \
|
||||
SAVE_SI128((__m128i*)(y_ptr2+16), y); \
|
||||
/* vertical subsampling of u/v values */ \
|
||||
u2_tmp = _mm_avg_epu8(u1, u2); \
|
||||
v2_tmp = _mm_avg_epu8(v1, v2); \
|
||||
/* horizontal subsampling of u/v values */ \
|
||||
u1 = _mm_packus_epi16(_mm_srl_epi16(u1_tmp, _mm_cvtsi32_si128(8)), _mm_srl_epi16(u2_tmp, _mm_cvtsi32_si128(8))); \
|
||||
v1 = _mm_packus_epi16(_mm_srl_epi16(v1_tmp, _mm_cvtsi32_si128(8)), _mm_srl_epi16(v2_tmp, _mm_cvtsi32_si128(8))); \
|
||||
u2 = _mm_packus_epi16(_mm_and_si128(u1_tmp, _mm_set1_epi16(0xFF)), _mm_and_si128(u2_tmp, _mm_set1_epi16(0xFF))); \
|
||||
v2 = _mm_packus_epi16(_mm_and_si128(v1_tmp, _mm_set1_epi16(0xFF)), _mm_and_si128(v2_tmp, _mm_set1_epi16(0xFF))); \
|
||||
u1 = _mm_avg_epu8(u1, u2); \
|
||||
v1 = _mm_avg_epu8(v1, v2); \
|
||||
SAVE_SI128((__m128i*)(u_ptr), u1); \
|
||||
SAVE_SI128((__m128i*)(v_ptr), v1);
|
||||
|
||||
void rgb24_yuv420_sse(uint32_t width, uint32_t height,
|
||||
const uint8_t *RGB, uint32_t RGB_stride,
|
||||
uint8_t *Y, uint8_t *U, uint8_t *V, uint32_t Y_stride, uint32_t UV_stride,
|
||||
YCbCrType yuv_type)
|
||||
{
|
||||
#define LOAD_SI128 _mm_load_si128
|
||||
#define SAVE_SI128 _mm_stream_si128
|
||||
const RGB2YUVParam *const param = &(RGB2YUV[yuv_type]);
|
||||
|
||||
uint32_t x, y;
|
||||
for(y=0; y<(height-1); y+=2)
|
||||
{
|
||||
const uint8_t *rgb_ptr1=RGB+y*RGB_stride,
|
||||
*rgb_ptr2=RGB+(y+1)*RGB_stride;
|
||||
|
||||
uint8_t *y_ptr1=Y+y*Y_stride,
|
||||
*y_ptr2=Y+(y+1)*Y_stride,
|
||||
*u_ptr=U+(y/2)*UV_stride,
|
||||
*v_ptr=V+(y/2)*UV_stride;
|
||||
|
||||
for(x=0; x<(width-31); x+=32)
|
||||
{
|
||||
RGB2YUV_32
|
||||
|
||||
rgb_ptr1+=96;
|
||||
rgb_ptr2+=96;
|
||||
y_ptr1+=32;
|
||||
y_ptr2+=32;
|
||||
u_ptr+=16;
|
||||
v_ptr+=16;
|
||||
}
|
||||
}
|
||||
#undef LOAD_SI128
|
||||
#undef SAVE_SI128
|
||||
}
|
||||
|
||||
void rgb24_yuv420_sseu(uint32_t width, uint32_t height,
|
||||
const uint8_t *RGB, uint32_t RGB_stride,
|
||||
uint8_t *Y, uint8_t *U, uint8_t *V, uint32_t Y_stride, uint32_t UV_stride,
|
||||
YCbCrType yuv_type)
|
||||
{
|
||||
#define LOAD_SI128 _mm_loadu_si128
|
||||
#define SAVE_SI128 _mm_storeu_si128
|
||||
const RGB2YUVParam *const param = &(RGB2YUV[yuv_type]);
|
||||
|
||||
uint32_t x, y;
|
||||
for(y=0; y<(height-1); y+=2)
|
||||
{
|
||||
const uint8_t *rgb_ptr1=RGB+y*RGB_stride,
|
||||
*rgb_ptr2=RGB+(y+1)*RGB_stride;
|
||||
|
||||
uint8_t *y_ptr1=Y+y*Y_stride,
|
||||
*y_ptr2=Y+(y+1)*Y_stride,
|
||||
*u_ptr=U+(y/2)*UV_stride,
|
||||
*v_ptr=V+(y/2)*UV_stride;
|
||||
|
||||
for(x=0; x<(width-31); x+=32)
|
||||
{
|
||||
RGB2YUV_32
|
||||
|
||||
rgb_ptr1+=96;
|
||||
rgb_ptr2+=96;
|
||||
y_ptr1+=32;
|
||||
y_ptr2+=32;
|
||||
u_ptr+=16;
|
||||
v_ptr+=16;
|
||||
}
|
||||
}
|
||||
#undef LOAD_SI128
|
||||
#undef SAVE_SI128
|
||||
}
|
||||
|
||||
|
||||
#endif //__SSE2__
|
||||
|
|
@ -0,0 +1,380 @@
|
|||
// Copyright 2016 Adrien Descamps
|
||||
// Distributed under BSD 3-Clause License
|
||||
|
||||
// Provide optimized functions to convert images from 8bits yuv420 to rgb24 format
|
||||
|
||||
// There are a few slightly different variations of the YCbCr color space with different parameters that
|
||||
// change the conversion matrix.
|
||||
// The three most common YCbCr color space, defined by BT.601, BT.709 and JPEG standard are implemented here.
|
||||
// See the respective standards for details
|
||||
// The matrix values used are derived from http://www.equasys.de/colorconversion.html
|
||||
|
||||
// YUV420 is stored as three separate channels, with U and V (Cb and Cr) subsampled by a 2 factor
|
||||
// For conversion from yuv to rgb, no interpolation is done, and the same UV value are used for 4 rgb pixels. This
|
||||
// is suboptimal for image quality, but by far the fastest method.
|
||||
|
||||
// For all methods, width and height should be even, if not, the last row/column of the result image won't be affected.
|
||||
// For sse methods, if the width if not divisable by 32, the last (width%32) pixels of each line won't be affected.
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
typedef enum
|
||||
{
|
||||
YCBCR_JPEG,
|
||||
YCBCR_601,
|
||||
YCBCR_709
|
||||
} YCbCrType;
|
||||
|
||||
// yuv to rgb, standard c implementation
|
||||
void yuv420_rgb565_std(
|
||||
uint32_t width, uint32_t height,
|
||||
const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride,
|
||||
uint8_t *rgb, uint32_t rgb_stride,
|
||||
YCbCrType yuv_type);
|
||||
|
||||
void yuv420_rgb24_std(
|
||||
uint32_t width, uint32_t height,
|
||||
const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride,
|
||||
uint8_t *rgb, uint32_t rgb_stride,
|
||||
YCbCrType yuv_type);
|
||||
|
||||
void yuv420_rgba_std(
|
||||
uint32_t width, uint32_t height,
|
||||
const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride,
|
||||
uint8_t *rgb, uint32_t rgb_stride,
|
||||
YCbCrType yuv_type);
|
||||
|
||||
void yuv420_bgra_std(
|
||||
uint32_t width, uint32_t height,
|
||||
const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride,
|
||||
uint8_t *rgb, uint32_t rgb_stride,
|
||||
YCbCrType yuv_type);
|
||||
|
||||
void yuv420_argb_std(
|
||||
uint32_t width, uint32_t height,
|
||||
const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride,
|
||||
uint8_t *rgb, uint32_t rgb_stride,
|
||||
YCbCrType yuv_type);
|
||||
|
||||
void yuv420_abgr_std(
|
||||
uint32_t width, uint32_t height,
|
||||
const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride,
|
||||
uint8_t *rgb, uint32_t rgb_stride,
|
||||
YCbCrType yuv_type);
|
||||
|
||||
void yuv422_rgb565_std(
|
||||
uint32_t width, uint32_t height,
|
||||
const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride,
|
||||
uint8_t *rgb, uint32_t rgb_stride,
|
||||
YCbCrType yuv_type);
|
||||
|
||||
void yuv422_rgb24_std(
|
||||
uint32_t width, uint32_t height,
|
||||
const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride,
|
||||
uint8_t *rgb, uint32_t rgb_stride,
|
||||
YCbCrType yuv_type);
|
||||
|
||||
void yuv422_rgba_std(
|
||||
uint32_t width, uint32_t height,
|
||||
const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride,
|
||||
uint8_t *rgb, uint32_t rgb_stride,
|
||||
YCbCrType yuv_type);
|
||||
|
||||
void yuv422_bgra_std(
|
||||
uint32_t width, uint32_t height,
|
||||
const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride,
|
||||
uint8_t *rgb, uint32_t rgb_stride,
|
||||
YCbCrType yuv_type);
|
||||
|
||||
void yuv422_argb_std(
|
||||
uint32_t width, uint32_t height,
|
||||
const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride,
|
||||
uint8_t *rgb, uint32_t rgb_stride,
|
||||
YCbCrType yuv_type);
|
||||
|
||||
void yuv422_abgr_std(
|
||||
uint32_t width, uint32_t height,
|
||||
const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride,
|
||||
uint8_t *rgb, uint32_t rgb_stride,
|
||||
YCbCrType yuv_type);
|
||||
|
||||
void yuvnv12_rgb565_std(
|
||||
uint32_t width, uint32_t height,
|
||||
const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride,
|
||||
uint8_t *rgb, uint32_t rgb_stride,
|
||||
YCbCrType yuv_type);
|
||||
|
||||
void yuvnv12_rgb24_std(
|
||||
uint32_t width, uint32_t height,
|
||||
const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride,
|
||||
uint8_t *rgb, uint32_t rgb_stride,
|
||||
YCbCrType yuv_type);
|
||||
|
||||
void yuvnv12_rgba_std(
|
||||
uint32_t width, uint32_t height,
|
||||
const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride,
|
||||
uint8_t *rgb, uint32_t rgb_stride,
|
||||
YCbCrType yuv_type);
|
||||
|
||||
void yuvnv12_bgra_std(
|
||||
uint32_t width, uint32_t height,
|
||||
const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride,
|
||||
uint8_t *rgb, uint32_t rgb_stride,
|
||||
YCbCrType yuv_type);
|
||||
|
||||
void yuvnv12_argb_std(
|
||||
uint32_t width, uint32_t height,
|
||||
const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride,
|
||||
uint8_t *rgb, uint32_t rgb_stride,
|
||||
YCbCrType yuv_type);
|
||||
|
||||
void yuvnv12_abgr_std(
|
||||
uint32_t width, uint32_t height,
|
||||
const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride,
|
||||
uint8_t *rgb, uint32_t rgb_stride,
|
||||
YCbCrType yuv_type);
|
||||
|
||||
// yuv to rgb, sse implementation
|
||||
// pointers must be 16 byte aligned, and strides must be divisable by 16
|
||||
void yuv420_rgb565_sse(
|
||||
uint32_t width, uint32_t height,
|
||||
const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride,
|
||||
uint8_t *rgb, uint32_t rgb_stride,
|
||||
YCbCrType yuv_type);
|
||||
|
||||
void yuv420_rgb24_sse(
|
||||
uint32_t width, uint32_t height,
|
||||
const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride,
|
||||
uint8_t *rgb, uint32_t rgb_stride,
|
||||
YCbCrType yuv_type);
|
||||
|
||||
void yuv420_rgba_sse(
|
||||
uint32_t width, uint32_t height,
|
||||
const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride,
|
||||
uint8_t *rgb, uint32_t rgb_stride,
|
||||
YCbCrType yuv_type);
|
||||
|
||||
void yuv420_bgra_sse(
|
||||
uint32_t width, uint32_t height,
|
||||
const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride,
|
||||
uint8_t *rgb, uint32_t rgb_stride,
|
||||
YCbCrType yuv_type);
|
||||
|
||||
void yuv420_argb_sse(
|
||||
uint32_t width, uint32_t height,
|
||||
const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride,
|
||||
uint8_t *rgb, uint32_t rgb_stride,
|
||||
YCbCrType yuv_type);
|
||||
|
||||
void yuv420_abgr_sse(
|
||||
uint32_t width, uint32_t height,
|
||||
const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride,
|
||||
uint8_t *rgb, uint32_t rgb_stride,
|
||||
YCbCrType yuv_type);
|
||||
|
||||
void yuv422_rgb565_sse(
|
||||
uint32_t width, uint32_t height,
|
||||
const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride,
|
||||
uint8_t *rgb, uint32_t rgb_stride,
|
||||
YCbCrType yuv_type);
|
||||
|
||||
void yuv422_rgb24_sse(
|
||||
uint32_t width, uint32_t height,
|
||||
const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride,
|
||||
uint8_t *rgb, uint32_t rgb_stride,
|
||||
YCbCrType yuv_type);
|
||||
|
||||
void yuv422_rgba_sse(
|
||||
uint32_t width, uint32_t height,
|
||||
const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride,
|
||||
uint8_t *rgb, uint32_t rgb_stride,
|
||||
YCbCrType yuv_type);
|
||||
|
||||
void yuv422_bgra_sse(
|
||||
uint32_t width, uint32_t height,
|
||||
const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride,
|
||||
uint8_t *rgb, uint32_t rgb_stride,
|
||||
YCbCrType yuv_type);
|
||||
|
||||
void yuv422_argb_sse(
|
||||
uint32_t width, uint32_t height,
|
||||
const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride,
|
||||
uint8_t *rgb, uint32_t rgb_stride,
|
||||
YCbCrType yuv_type);
|
||||
|
||||
void yuv422_abgr_sse(
|
||||
uint32_t width, uint32_t height,
|
||||
const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride,
|
||||
uint8_t *rgb, uint32_t rgb_stride,
|
||||
YCbCrType yuv_type);
|
||||
|
||||
void yuvnv12_rgb565_sse(
|
||||
uint32_t width, uint32_t height,
|
||||
const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride,
|
||||
uint8_t *rgb, uint32_t rgb_stride,
|
||||
YCbCrType yuv_type);
|
||||
|
||||
void yuvnv12_rgb24_sse(
|
||||
uint32_t width, uint32_t height,
|
||||
const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride,
|
||||
uint8_t *rgb, uint32_t rgb_stride,
|
||||
YCbCrType yuv_type);
|
||||
|
||||
void yuvnv12_rgba_sse(
|
||||
uint32_t width, uint32_t height,
|
||||
const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride,
|
||||
uint8_t *rgb, uint32_t rgb_stride,
|
||||
YCbCrType yuv_type);
|
||||
|
||||
void yuvnv12_bgra_sse(
|
||||
uint32_t width, uint32_t height,
|
||||
const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride,
|
||||
uint8_t *rgb, uint32_t rgb_stride,
|
||||
YCbCrType yuv_type);
|
||||
|
||||
void yuvnv12_argb_sse(
|
||||
uint32_t width, uint32_t height,
|
||||
const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride,
|
||||
uint8_t *rgb, uint32_t rgb_stride,
|
||||
YCbCrType yuv_type);
|
||||
|
||||
void yuvnv12_abgr_sse(
|
||||
uint32_t width, uint32_t height,
|
||||
const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride,
|
||||
uint8_t *rgb, uint32_t rgb_stride,
|
||||
YCbCrType yuv_type);
|
||||
|
||||
// yuv to rgb, sse implementation
|
||||
// pointers do not need to be 16 byte aligned
|
||||
void yuv420_rgb565_sseu(
|
||||
uint32_t width, uint32_t height,
|
||||
const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride,
|
||||
uint8_t *rgb, uint32_t rgb_stride,
|
||||
YCbCrType yuv_type);
|
||||
|
||||
void yuv420_rgb24_sseu(
|
||||
uint32_t width, uint32_t height,
|
||||
const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride,
|
||||
uint8_t *rgb, uint32_t rgb_stride,
|
||||
YCbCrType yuv_type);
|
||||
|
||||
void yuv420_rgba_sseu(
|
||||
uint32_t width, uint32_t height,
|
||||
const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride,
|
||||
uint8_t *rgb, uint32_t rgb_stride,
|
||||
YCbCrType yuv_type);
|
||||
|
||||
void yuv420_bgra_sseu(
|
||||
uint32_t width, uint32_t height,
|
||||
const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride,
|
||||
uint8_t *rgb, uint32_t rgb_stride,
|
||||
YCbCrType yuv_type);
|
||||
|
||||
void yuv420_argb_sseu(
|
||||
uint32_t width, uint32_t height,
|
||||
const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride,
|
||||
uint8_t *rgb, uint32_t rgb_stride,
|
||||
YCbCrType yuv_type);
|
||||
|
||||
void yuv420_abgr_sseu(
|
||||
uint32_t width, uint32_t height,
|
||||
const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride,
|
||||
uint8_t *rgb, uint32_t rgb_stride,
|
||||
YCbCrType yuv_type);
|
||||
|
||||
void yuv422_rgb565_sseu(
|
||||
uint32_t width, uint32_t height,
|
||||
const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride,
|
||||
uint8_t *rgb, uint32_t rgb_stride,
|
||||
YCbCrType yuv_type);
|
||||
|
||||
void yuv422_rgb24_sseu(
|
||||
uint32_t width, uint32_t height,
|
||||
const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride,
|
||||
uint8_t *rgb, uint32_t rgb_stride,
|
||||
YCbCrType yuv_type);
|
||||
|
||||
void yuv422_rgba_sseu(
|
||||
uint32_t width, uint32_t height,
|
||||
const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride,
|
||||
uint8_t *rgb, uint32_t rgb_stride,
|
||||
YCbCrType yuv_type);
|
||||
|
||||
void yuv422_bgra_sseu(
|
||||
uint32_t width, uint32_t height,
|
||||
const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride,
|
||||
uint8_t *rgb, uint32_t rgb_stride,
|
||||
YCbCrType yuv_type);
|
||||
|
||||
void yuv422_argb_sseu(
|
||||
uint32_t width, uint32_t height,
|
||||
const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride,
|
||||
uint8_t *rgb, uint32_t rgb_stride,
|
||||
YCbCrType yuv_type);
|
||||
|
||||
void yuv422_abgr_sseu(
|
||||
uint32_t width, uint32_t height,
|
||||
const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride,
|
||||
uint8_t *rgb, uint32_t rgb_stride,
|
||||
YCbCrType yuv_type);
|
||||
|
||||
void yuvnv12_rgb565_sseu(
|
||||
uint32_t width, uint32_t height,
|
||||
const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride,
|
||||
uint8_t *rgb, uint32_t rgb_stride,
|
||||
YCbCrType yuv_type);
|
||||
|
||||
void yuvnv12_rgb24_sseu(
|
||||
uint32_t width, uint32_t height,
|
||||
const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride,
|
||||
uint8_t *rgb, uint32_t rgb_stride,
|
||||
YCbCrType yuv_type);
|
||||
|
||||
void yuvnv12_rgba_sseu(
|
||||
uint32_t width, uint32_t height,
|
||||
const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride,
|
||||
uint8_t *rgb, uint32_t rgb_stride,
|
||||
YCbCrType yuv_type);
|
||||
|
||||
void yuvnv12_bgra_sseu(
|
||||
uint32_t width, uint32_t height,
|
||||
const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride,
|
||||
uint8_t *rgb, uint32_t rgb_stride,
|
||||
YCbCrType yuv_type);
|
||||
|
||||
void yuvnv12_argb_sseu(
|
||||
uint32_t width, uint32_t height,
|
||||
const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride,
|
||||
uint8_t *rgb, uint32_t rgb_stride,
|
||||
YCbCrType yuv_type);
|
||||
|
||||
void yuvnv12_abgr_sseu(
|
||||
uint32_t width, uint32_t height,
|
||||
const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride,
|
||||
uint8_t *rgb, uint32_t rgb_stride,
|
||||
YCbCrType yuv_type);
|
||||
|
||||
|
||||
// rgb to yuv, standard c implementation
|
||||
void rgb24_yuv420_std(
|
||||
uint32_t width, uint32_t height,
|
||||
const uint8_t *rgb, uint32_t rgb_stride,
|
||||
uint8_t *y, uint8_t *u, uint8_t *v, uint32_t y_stride, uint32_t uv_stride,
|
||||
YCbCrType yuv_type);
|
||||
|
||||
// rgb to yuv, sse implementation
|
||||
// pointers must be 16 byte aligned, and strides must be divisible by 16
|
||||
void rgb24_yuv420_sse(
|
||||
uint32_t width, uint32_t height,
|
||||
const uint8_t *rgb, uint32_t rgb_stride,
|
||||
uint8_t *y, uint8_t *u, uint8_t *v, uint32_t y_stride, uint32_t uv_stride,
|
||||
YCbCrType yuv_type);
|
||||
|
||||
// rgb to yuv, sse implementation
|
||||
// pointers do not need to be 16 byte aligned
|
||||
void rgb24_yuv420_sseu(
|
||||
uint32_t width, uint32_t height,
|
||||
const uint8_t *rgb, uint32_t rgb_stride,
|
||||
uint8_t *y, uint8_t *u, uint8_t *v, uint32_t y_stride, uint32_t uv_stride,
|
||||
YCbCrType yuv_type);
|
||||
|
|
@ -0,0 +1,498 @@
|
|||
// Copyright 2016 Adrien Descamps
|
||||
// Distributed under BSD 3-Clause License
|
||||
|
||||
/* You need to define the following macros before including this file:
|
||||
SSE_FUNCTION_NAME
|
||||
STD_FUNCTION_NAME
|
||||
YUV_FORMAT
|
||||
RGB_FORMAT
|
||||
*/
|
||||
/* You may define the following macro, which affects generated code:
|
||||
SSE_ALIGNED
|
||||
*/
|
||||
|
||||
#ifdef SSE_ALIGNED
|
||||
/* Unaligned instructions seem faster, even on aligned data? */
|
||||
/*
|
||||
#define LOAD_SI128 _mm_load_si128
|
||||
#define SAVE_SI128 _mm_stream_si128
|
||||
*/
|
||||
#define LOAD_SI128 _mm_loadu_si128
|
||||
#define SAVE_SI128 _mm_storeu_si128
|
||||
#else
|
||||
#define LOAD_SI128 _mm_loadu_si128
|
||||
#define SAVE_SI128 _mm_storeu_si128
|
||||
#endif
|
||||
|
||||
#define UV2RGB_16(U,V,R1,G1,B1,R2,G2,B2) \
|
||||
r_tmp = _mm_mullo_epi16(V, _mm_set1_epi16(param->v_r_factor)); \
|
||||
g_tmp = _mm_add_epi16( \
|
||||
_mm_mullo_epi16(U, _mm_set1_epi16(param->u_g_factor)), \
|
||||
_mm_mullo_epi16(V, _mm_set1_epi16(param->v_g_factor))); \
|
||||
b_tmp = _mm_mullo_epi16(U, _mm_set1_epi16(param->u_b_factor)); \
|
||||
R1 = _mm_unpacklo_epi16(r_tmp, r_tmp); \
|
||||
G1 = _mm_unpacklo_epi16(g_tmp, g_tmp); \
|
||||
B1 = _mm_unpacklo_epi16(b_tmp, b_tmp); \
|
||||
R2 = _mm_unpackhi_epi16(r_tmp, r_tmp); \
|
||||
G2 = _mm_unpackhi_epi16(g_tmp, g_tmp); \
|
||||
B2 = _mm_unpackhi_epi16(b_tmp, b_tmp); \
|
||||
|
||||
#define ADD_Y2RGB_16(Y1,Y2,R1,G1,B1,R2,G2,B2) \
|
||||
Y1 = _mm_mullo_epi16(_mm_sub_epi16(Y1, _mm_set1_epi16(param->y_shift)), _mm_set1_epi16(param->y_factor)); \
|
||||
Y2 = _mm_mullo_epi16(_mm_sub_epi16(Y2, _mm_set1_epi16(param->y_shift)), _mm_set1_epi16(param->y_factor)); \
|
||||
\
|
||||
R1 = _mm_srai_epi16(_mm_add_epi16(R1, Y1), PRECISION); \
|
||||
G1 = _mm_srai_epi16(_mm_add_epi16(G1, Y1), PRECISION); \
|
||||
B1 = _mm_srai_epi16(_mm_add_epi16(B1, Y1), PRECISION); \
|
||||
R2 = _mm_srai_epi16(_mm_add_epi16(R2, Y2), PRECISION); \
|
||||
G2 = _mm_srai_epi16(_mm_add_epi16(G2, Y2), PRECISION); \
|
||||
B2 = _mm_srai_epi16(_mm_add_epi16(B2, Y2), PRECISION); \
|
||||
|
||||
#define PACK_RGB565_32(R1, R2, G1, G2, B1, B2, RGB1, RGB2, RGB3, RGB4) \
|
||||
{ \
|
||||
__m128i red_mask, tmp1, tmp2, tmp3, tmp4; \
|
||||
\
|
||||
red_mask = _mm_set1_epi16(0xF800); \
|
||||
RGB1 = _mm_and_si128(_mm_unpacklo_epi8(_mm_setzero_si128(), R1), red_mask); \
|
||||
RGB2 = _mm_and_si128(_mm_unpackhi_epi8(_mm_setzero_si128(), R1), red_mask); \
|
||||
RGB3 = _mm_and_si128(_mm_unpacklo_epi8(_mm_setzero_si128(), R2), red_mask); \
|
||||
RGB4 = _mm_and_si128(_mm_unpackhi_epi8(_mm_setzero_si128(), R2), red_mask); \
|
||||
tmp1 = _mm_slli_epi16(_mm_srli_epi16(_mm_unpacklo_epi8(G1, _mm_setzero_si128()), 2), 5); \
|
||||
tmp2 = _mm_slli_epi16(_mm_srli_epi16(_mm_unpackhi_epi8(G1, _mm_setzero_si128()), 2), 5); \
|
||||
tmp3 = _mm_slli_epi16(_mm_srli_epi16(_mm_unpacklo_epi8(G2, _mm_setzero_si128()), 2), 5); \
|
||||
tmp4 = _mm_slli_epi16(_mm_srli_epi16(_mm_unpackhi_epi8(G2, _mm_setzero_si128()), 2), 5); \
|
||||
RGB1 = _mm_or_si128(RGB1, tmp1); \
|
||||
RGB2 = _mm_or_si128(RGB2, tmp2); \
|
||||
RGB3 = _mm_or_si128(RGB3, tmp3); \
|
||||
RGB4 = _mm_or_si128(RGB4, tmp4); \
|
||||
tmp1 = _mm_srli_epi16(_mm_unpacklo_epi8(B1, _mm_setzero_si128()), 3); \
|
||||
tmp2 = _mm_srli_epi16(_mm_unpackhi_epi8(B1, _mm_setzero_si128()), 3); \
|
||||
tmp3 = _mm_srli_epi16(_mm_unpacklo_epi8(B2, _mm_setzero_si128()), 3); \
|
||||
tmp4 = _mm_srli_epi16(_mm_unpackhi_epi8(B2, _mm_setzero_si128()), 3); \
|
||||
RGB1 = _mm_or_si128(RGB1, tmp1); \
|
||||
RGB2 = _mm_or_si128(RGB2, tmp2); \
|
||||
RGB3 = _mm_or_si128(RGB3, tmp3); \
|
||||
RGB4 = _mm_or_si128(RGB4, tmp4); \
|
||||
}
|
||||
|
||||
#define PACK_RGB24_32_STEP1(R1, R2, G1, G2, B1, B2, RGB1, RGB2, RGB3, RGB4, RGB5, RGB6) \
|
||||
RGB1 = _mm_packus_epi16(_mm_and_si128(R1,_mm_set1_epi16(0xFF)), _mm_and_si128(R2,_mm_set1_epi16(0xFF))); \
|
||||
RGB2 = _mm_packus_epi16(_mm_and_si128(G1,_mm_set1_epi16(0xFF)), _mm_and_si128(G2,_mm_set1_epi16(0xFF))); \
|
||||
RGB3 = _mm_packus_epi16(_mm_and_si128(B1,_mm_set1_epi16(0xFF)), _mm_and_si128(B2,_mm_set1_epi16(0xFF))); \
|
||||
RGB4 = _mm_packus_epi16(_mm_srli_epi16(R1,8), _mm_srli_epi16(R2,8)); \
|
||||
RGB5 = _mm_packus_epi16(_mm_srli_epi16(G1,8), _mm_srli_epi16(G2,8)); \
|
||||
RGB6 = _mm_packus_epi16(_mm_srli_epi16(B1,8), _mm_srli_epi16(B2,8)); \
|
||||
|
||||
#define PACK_RGB24_32_STEP2(R1, R2, G1, G2, B1, B2, RGB1, RGB2, RGB3, RGB4, RGB5, RGB6) \
|
||||
R1 = _mm_packus_epi16(_mm_and_si128(RGB1,_mm_set1_epi16(0xFF)), _mm_and_si128(RGB2,_mm_set1_epi16(0xFF))); \
|
||||
R2 = _mm_packus_epi16(_mm_and_si128(RGB3,_mm_set1_epi16(0xFF)), _mm_and_si128(RGB4,_mm_set1_epi16(0xFF))); \
|
||||
G1 = _mm_packus_epi16(_mm_and_si128(RGB5,_mm_set1_epi16(0xFF)), _mm_and_si128(RGB6,_mm_set1_epi16(0xFF))); \
|
||||
G2 = _mm_packus_epi16(_mm_srli_epi16(RGB1,8), _mm_srli_epi16(RGB2,8)); \
|
||||
B1 = _mm_packus_epi16(_mm_srli_epi16(RGB3,8), _mm_srli_epi16(RGB4,8)); \
|
||||
B2 = _mm_packus_epi16(_mm_srli_epi16(RGB5,8), _mm_srli_epi16(RGB6,8)); \
|
||||
|
||||
#define PACK_RGB24_32(R1, R2, G1, G2, B1, B2, RGB1, RGB2, RGB3, RGB4, RGB5, RGB6) \
|
||||
PACK_RGB24_32_STEP1(R1, R2, G1, G2, B1, B2, RGB1, RGB2, RGB3, RGB4, RGB5, RGB6) \
|
||||
PACK_RGB24_32_STEP2(R1, R2, G1, G2, B1, B2, RGB1, RGB2, RGB3, RGB4, RGB5, RGB6) \
|
||||
PACK_RGB24_32_STEP1(R1, R2, G1, G2, B1, B2, RGB1, RGB2, RGB3, RGB4, RGB5, RGB6) \
|
||||
PACK_RGB24_32_STEP2(R1, R2, G1, G2, B1, B2, RGB1, RGB2, RGB3, RGB4, RGB5, RGB6) \
|
||||
PACK_RGB24_32_STEP1(R1, R2, G1, G2, B1, B2, RGB1, RGB2, RGB3, RGB4, RGB5, RGB6) \
|
||||
|
||||
#define PACK_RGBA_32(R1, R2, G1, G2, B1, B2, A1, A2, RGB1, RGB2, RGB3, RGB4, RGB5, RGB6, RGB7, RGB8) \
|
||||
{ \
|
||||
__m128i lo_ab, hi_ab, lo_gr, hi_gr; \
|
||||
\
|
||||
lo_ab = _mm_unpacklo_epi8( A1, B1 ); \
|
||||
hi_ab = _mm_unpackhi_epi8( A1, B1 ); \
|
||||
lo_gr = _mm_unpacklo_epi8( G1, R1 ); \
|
||||
hi_gr = _mm_unpackhi_epi8( G1, R1 ); \
|
||||
RGB1 = _mm_unpacklo_epi16( lo_ab, lo_gr ); \
|
||||
RGB2 = _mm_unpackhi_epi16( lo_ab, lo_gr ); \
|
||||
RGB3 = _mm_unpacklo_epi16( hi_ab, hi_gr ); \
|
||||
RGB4 = _mm_unpackhi_epi16( hi_ab, hi_gr ); \
|
||||
\
|
||||
lo_ab = _mm_unpacklo_epi8( A2, B2 ); \
|
||||
hi_ab = _mm_unpackhi_epi8( A2, B2 ); \
|
||||
lo_gr = _mm_unpacklo_epi8( G2, R2 ); \
|
||||
hi_gr = _mm_unpackhi_epi8( G2, R2 ); \
|
||||
RGB5 = _mm_unpacklo_epi16( lo_ab, lo_gr ); \
|
||||
RGB6 = _mm_unpackhi_epi16( lo_ab, lo_gr ); \
|
||||
RGB7 = _mm_unpacklo_epi16( hi_ab, hi_gr ); \
|
||||
RGB8 = _mm_unpackhi_epi16( hi_ab, hi_gr ); \
|
||||
}
|
||||
|
||||
#if RGB_FORMAT == RGB_FORMAT_RGB565
|
||||
|
||||
#define PACK_PIXEL \
|
||||
__m128i rgb_1, rgb_2, rgb_3, rgb_4, rgb_5, rgb_6, rgb_7, rgb_8; \
|
||||
\
|
||||
PACK_RGB565_32(r_8_11, r_8_12, g_8_11, g_8_12, b_8_11, b_8_12, rgb_1, rgb_2, rgb_3, rgb_4) \
|
||||
\
|
||||
PACK_RGB565_32(r_8_21, r_8_22, g_8_21, g_8_22, b_8_21, b_8_22, rgb_5, rgb_6, rgb_7, rgb_8) \
|
||||
|
||||
#elif RGB_FORMAT == RGB_FORMAT_RGB24
|
||||
|
||||
#define PACK_PIXEL \
|
||||
__m128i rgb_1, rgb_2, rgb_3, rgb_4, rgb_5, rgb_6; \
|
||||
__m128i rgb_7, rgb_8, rgb_9, rgb_10, rgb_11, rgb_12; \
|
||||
\
|
||||
PACK_RGB24_32(r_8_11, r_8_12, g_8_11, g_8_12, b_8_11, b_8_12, rgb_1, rgb_2, rgb_3, rgb_4, rgb_5, rgb_6) \
|
||||
\
|
||||
PACK_RGB24_32(r_8_21, r_8_22, g_8_21, g_8_22, b_8_21, b_8_22, rgb_7, rgb_8, rgb_9, rgb_10, rgb_11, rgb_12) \
|
||||
|
||||
#elif RGB_FORMAT == RGB_FORMAT_RGBA
|
||||
|
||||
#define PACK_PIXEL \
|
||||
__m128i rgb_1, rgb_2, rgb_3, rgb_4, rgb_5, rgb_6, rgb_7, rgb_8; \
|
||||
__m128i rgb_9, rgb_10, rgb_11, rgb_12, rgb_13, rgb_14, rgb_15, rgb_16; \
|
||||
__m128i a = _mm_set1_epi8( 0xFF ); \
|
||||
\
|
||||
PACK_RGBA_32(r_8_11, r_8_12, g_8_11, g_8_12, b_8_11, b_8_12, a, a, rgb_1, rgb_2, rgb_3, rgb_4, rgb_5, rgb_6, rgb_7, rgb_8) \
|
||||
\
|
||||
PACK_RGBA_32(r_8_21, r_8_22, g_8_21, g_8_22, b_8_21, b_8_22, a, a, rgb_9, rgb_10, rgb_11, rgb_12, rgb_13, rgb_14, rgb_15, rgb_16) \
|
||||
|
||||
#elif RGB_FORMAT == RGB_FORMAT_BGRA
|
||||
|
||||
#define PACK_PIXEL \
|
||||
__m128i rgb_1, rgb_2, rgb_3, rgb_4, rgb_5, rgb_6, rgb_7, rgb_8; \
|
||||
__m128i rgb_9, rgb_10, rgb_11, rgb_12, rgb_13, rgb_14, rgb_15, rgb_16; \
|
||||
__m128i a = _mm_set1_epi8( 0xFF ); \
|
||||
\
|
||||
PACK_RGBA_32(b_8_11, b_8_12, g_8_11, g_8_12, r_8_11, r_8_12, a, a, rgb_1, rgb_2, rgb_3, rgb_4, rgb_5, rgb_6, rgb_7, rgb_8) \
|
||||
\
|
||||
PACK_RGBA_32(b_8_21, b_8_22, g_8_21, g_8_22, r_8_21, r_8_22, a, a, rgb_9, rgb_10, rgb_11, rgb_12, rgb_13, rgb_14, rgb_15, rgb_16) \
|
||||
|
||||
#elif RGB_FORMAT == RGB_FORMAT_ARGB
|
||||
|
||||
#define PACK_PIXEL \
|
||||
__m128i rgb_1, rgb_2, rgb_3, rgb_4, rgb_5, rgb_6, rgb_7, rgb_8; \
|
||||
__m128i rgb_9, rgb_10, rgb_11, rgb_12, rgb_13, rgb_14, rgb_15, rgb_16; \
|
||||
__m128i a = _mm_set1_epi8( 0xFF ); \
|
||||
\
|
||||
PACK_RGBA_32(a, a, r_8_11, r_8_12, g_8_11, g_8_12, b_8_11, b_8_12, rgb_1, rgb_2, rgb_3, rgb_4, rgb_5, rgb_6, rgb_7, rgb_8) \
|
||||
\
|
||||
PACK_RGBA_32(a, a, r_8_21, r_8_22, g_8_21, g_8_22, b_8_21, b_8_22, rgb_9, rgb_10, rgb_11, rgb_12, rgb_13, rgb_14, rgb_15, rgb_16) \
|
||||
|
||||
#elif RGB_FORMAT == RGB_FORMAT_ABGR
|
||||
|
||||
#define PACK_PIXEL \
|
||||
__m128i rgb_1, rgb_2, rgb_3, rgb_4, rgb_5, rgb_6, rgb_7, rgb_8; \
|
||||
__m128i rgb_9, rgb_10, rgb_11, rgb_12, rgb_13, rgb_14, rgb_15, rgb_16; \
|
||||
__m128i a = _mm_set1_epi8( 0xFF ); \
|
||||
\
|
||||
PACK_RGBA_32(a, a, b_8_11, b_8_12, g_8_11, g_8_12, r_8_11, r_8_12, rgb_1, rgb_2, rgb_3, rgb_4, rgb_5, rgb_6, rgb_7, rgb_8) \
|
||||
\
|
||||
PACK_RGBA_32(a, a, b_8_21, b_8_22, g_8_21, g_8_22, r_8_21, r_8_22, rgb_9, rgb_10, rgb_11, rgb_12, rgb_13, rgb_14, rgb_15, rgb_16) \
|
||||
|
||||
#else
|
||||
#error PACK_PIXEL unimplemented
|
||||
#endif
|
||||
|
||||
#if RGB_FORMAT == RGB_FORMAT_RGB565
|
||||
|
||||
#define SAVE_LINE1 \
|
||||
SAVE_SI128((__m128i*)(rgb_ptr1), rgb_1); \
|
||||
SAVE_SI128((__m128i*)(rgb_ptr1+16), rgb_2); \
|
||||
SAVE_SI128((__m128i*)(rgb_ptr1+32), rgb_3); \
|
||||
SAVE_SI128((__m128i*)(rgb_ptr1+48), rgb_4); \
|
||||
|
||||
#define SAVE_LINE2 \
|
||||
SAVE_SI128((__m128i*)(rgb_ptr2), rgb_5); \
|
||||
SAVE_SI128((__m128i*)(rgb_ptr2+16), rgb_6); \
|
||||
SAVE_SI128((__m128i*)(rgb_ptr2+32), rgb_7); \
|
||||
SAVE_SI128((__m128i*)(rgb_ptr2+48), rgb_8); \
|
||||
|
||||
#elif RGB_FORMAT == RGB_FORMAT_RGB24
|
||||
|
||||
#define SAVE_LINE1 \
|
||||
SAVE_SI128((__m128i*)(rgb_ptr1), rgb_1); \
|
||||
SAVE_SI128((__m128i*)(rgb_ptr1+16), rgb_2); \
|
||||
SAVE_SI128((__m128i*)(rgb_ptr1+32), rgb_3); \
|
||||
SAVE_SI128((__m128i*)(rgb_ptr1+48), rgb_4); \
|
||||
SAVE_SI128((__m128i*)(rgb_ptr1+64), rgb_5); \
|
||||
SAVE_SI128((__m128i*)(rgb_ptr1+80), rgb_6); \
|
||||
|
||||
#define SAVE_LINE2 \
|
||||
SAVE_SI128((__m128i*)(rgb_ptr2), rgb_7); \
|
||||
SAVE_SI128((__m128i*)(rgb_ptr2+16), rgb_8); \
|
||||
SAVE_SI128((__m128i*)(rgb_ptr2+32), rgb_9); \
|
||||
SAVE_SI128((__m128i*)(rgb_ptr2+48), rgb_10); \
|
||||
SAVE_SI128((__m128i*)(rgb_ptr2+64), rgb_11); \
|
||||
SAVE_SI128((__m128i*)(rgb_ptr2+80), rgb_12); \
|
||||
|
||||
#elif RGB_FORMAT == RGB_FORMAT_RGBA || RGB_FORMAT == RGB_FORMAT_BGRA || \
|
||||
RGB_FORMAT == RGB_FORMAT_ARGB || RGB_FORMAT == RGB_FORMAT_ABGR
|
||||
|
||||
#define SAVE_LINE1 \
|
||||
SAVE_SI128((__m128i*)(rgb_ptr1), rgb_1); \
|
||||
SAVE_SI128((__m128i*)(rgb_ptr1+16), rgb_2); \
|
||||
SAVE_SI128((__m128i*)(rgb_ptr1+32), rgb_3); \
|
||||
SAVE_SI128((__m128i*)(rgb_ptr1+48), rgb_4); \
|
||||
SAVE_SI128((__m128i*)(rgb_ptr1+64), rgb_5); \
|
||||
SAVE_SI128((__m128i*)(rgb_ptr1+80), rgb_6); \
|
||||
SAVE_SI128((__m128i*)(rgb_ptr1+96), rgb_7); \
|
||||
SAVE_SI128((__m128i*)(rgb_ptr1+112), rgb_8); \
|
||||
|
||||
#define SAVE_LINE2 \
|
||||
SAVE_SI128((__m128i*)(rgb_ptr2), rgb_9); \
|
||||
SAVE_SI128((__m128i*)(rgb_ptr2+16), rgb_10); \
|
||||
SAVE_SI128((__m128i*)(rgb_ptr2+32), rgb_11); \
|
||||
SAVE_SI128((__m128i*)(rgb_ptr2+48), rgb_12); \
|
||||
SAVE_SI128((__m128i*)(rgb_ptr2+64), rgb_13); \
|
||||
SAVE_SI128((__m128i*)(rgb_ptr2+80), rgb_14); \
|
||||
SAVE_SI128((__m128i*)(rgb_ptr2+96), rgb_15); \
|
||||
SAVE_SI128((__m128i*)(rgb_ptr2+112), rgb_16); \
|
||||
|
||||
#else
|
||||
#error SAVE_LINE unimplemented
|
||||
#endif
|
||||
|
||||
#if YUV_FORMAT == YUV_FORMAT_420
|
||||
|
||||
#define READ_Y(y_ptr) \
|
||||
y = LOAD_SI128((const __m128i*)(y_ptr)); \
|
||||
|
||||
#define READ_UV \
|
||||
u = LOAD_SI128((const __m128i*)(u_ptr)); \
|
||||
v = LOAD_SI128((const __m128i*)(v_ptr)); \
|
||||
|
||||
#elif YUV_FORMAT == YUV_FORMAT_422
|
||||
|
||||
#define READ_Y(y_ptr) \
|
||||
{ \
|
||||
__m128i y1, y2; \
|
||||
y1 = _mm_srli_epi16(_mm_slli_epi16(LOAD_SI128((const __m128i*)(y_ptr)), 8), 8); \
|
||||
y2 = _mm_srli_epi16(_mm_slli_epi16(LOAD_SI128((const __m128i*)(y_ptr+16)), 8), 8); \
|
||||
y = _mm_packus_epi16(y1, y2); \
|
||||
}
|
||||
|
||||
#define READ_UV \
|
||||
{ \
|
||||
__m128i u1, u2, u3, u4, v1, v2, v3, v4; \
|
||||
u1 = _mm_srli_epi32(_mm_slli_epi32(LOAD_SI128((const __m128i*)(u_ptr)), 24), 24); \
|
||||
u2 = _mm_srli_epi32(_mm_slli_epi32(LOAD_SI128((const __m128i*)(u_ptr+16)), 24), 24); \
|
||||
u3 = _mm_srli_epi32(_mm_slli_epi32(LOAD_SI128((const __m128i*)(u_ptr+32)), 24), 24); \
|
||||
u4 = _mm_srli_epi32(_mm_slli_epi32(LOAD_SI128((const __m128i*)(u_ptr+48)), 24), 24); \
|
||||
u = _mm_packus_epi16(_mm_packs_epi32(u1, u2), _mm_packs_epi32(u3, u4)); \
|
||||
v1 = _mm_srli_epi32(_mm_slli_epi32(LOAD_SI128((const __m128i*)(v_ptr)), 24), 24); \
|
||||
v2 = _mm_srli_epi32(_mm_slli_epi32(LOAD_SI128((const __m128i*)(v_ptr+16)), 24), 24); \
|
||||
v3 = _mm_srli_epi32(_mm_slli_epi32(LOAD_SI128((const __m128i*)(v_ptr+32)), 24), 24); \
|
||||
v4 = _mm_srli_epi32(_mm_slli_epi32(LOAD_SI128((const __m128i*)(v_ptr+48)), 24), 24); \
|
||||
v = _mm_packus_epi16(_mm_packs_epi32(v1, v2), _mm_packs_epi32(v3, v4)); \
|
||||
}
|
||||
|
||||
#elif YUV_FORMAT == YUV_FORMAT_NV12
|
||||
|
||||
#define READ_Y(y_ptr) \
|
||||
y = LOAD_SI128((const __m128i*)(y_ptr)); \
|
||||
|
||||
#define READ_UV \
|
||||
{ \
|
||||
__m128i u1, u2, v1, v2; \
|
||||
u1 = _mm_srli_epi16(_mm_slli_epi16(LOAD_SI128((const __m128i*)(u_ptr)), 8), 8); \
|
||||
u2 = _mm_srli_epi16(_mm_slli_epi16(LOAD_SI128((const __m128i*)(u_ptr+16)), 8), 8); \
|
||||
u = _mm_packus_epi16(u1, u2); \
|
||||
v1 = _mm_srli_epi16(_mm_slli_epi16(LOAD_SI128((const __m128i*)(v_ptr)), 8), 8); \
|
||||
v2 = _mm_srli_epi16(_mm_slli_epi16(LOAD_SI128((const __m128i*)(v_ptr+16)), 8), 8); \
|
||||
v = _mm_packus_epi16(v1, v2); \
|
||||
}
|
||||
|
||||
#else
|
||||
#error READ_UV unimplemented
|
||||
#endif
|
||||
|
||||
#define YUV2RGB_32 \
|
||||
__m128i r_tmp, g_tmp, b_tmp; \
|
||||
__m128i r_16_1, g_16_1, b_16_1, r_16_2, g_16_2, b_16_2; \
|
||||
__m128i r_uv_16_1, g_uv_16_1, b_uv_16_1, r_uv_16_2, g_uv_16_2, b_uv_16_2; \
|
||||
__m128i y_16_1, y_16_2; \
|
||||
__m128i y, u, v, u_16, v_16; \
|
||||
__m128i r_8_11, g_8_11, b_8_11, r_8_21, g_8_21, b_8_21; \
|
||||
__m128i r_8_12, g_8_12, b_8_12, r_8_22, g_8_22, b_8_22; \
|
||||
\
|
||||
READ_UV \
|
||||
\
|
||||
/* process first 16 pixels of first line */\
|
||||
u_16 = _mm_unpacklo_epi8(u, _mm_setzero_si128()); \
|
||||
v_16 = _mm_unpacklo_epi8(v, _mm_setzero_si128()); \
|
||||
u_16 = _mm_add_epi16(u_16, _mm_set1_epi16(-128)); \
|
||||
v_16 = _mm_add_epi16(v_16, _mm_set1_epi16(-128)); \
|
||||
\
|
||||
UV2RGB_16(u_16, v_16, r_16_1, g_16_1, b_16_1, r_16_2, g_16_2, b_16_2) \
|
||||
r_uv_16_1=r_16_1; g_uv_16_1=g_16_1; b_uv_16_1=b_16_1; \
|
||||
r_uv_16_2=r_16_2; g_uv_16_2=g_16_2; b_uv_16_2=b_16_2; \
|
||||
\
|
||||
READ_Y(y_ptr1) \
|
||||
y_16_1 = _mm_unpacklo_epi8(y, _mm_setzero_si128()); \
|
||||
y_16_2 = _mm_unpackhi_epi8(y, _mm_setzero_si128()); \
|
||||
\
|
||||
ADD_Y2RGB_16(y_16_1, y_16_2, r_16_1, g_16_1, b_16_1, r_16_2, g_16_2, b_16_2) \
|
||||
\
|
||||
r_8_11 = _mm_packus_epi16(r_16_1, r_16_2); \
|
||||
g_8_11 = _mm_packus_epi16(g_16_1, g_16_2); \
|
||||
b_8_11 = _mm_packus_epi16(b_16_1, b_16_2); \
|
||||
\
|
||||
/* process first 16 pixels of second line */\
|
||||
r_16_1=r_uv_16_1; g_16_1=g_uv_16_1; b_16_1=b_uv_16_1; \
|
||||
r_16_2=r_uv_16_2; g_16_2=g_uv_16_2; b_16_2=b_uv_16_2; \
|
||||
\
|
||||
READ_Y(y_ptr2) \
|
||||
y_16_1 = _mm_unpacklo_epi8(y, _mm_setzero_si128()); \
|
||||
y_16_2 = _mm_unpackhi_epi8(y, _mm_setzero_si128()); \
|
||||
\
|
||||
ADD_Y2RGB_16(y_16_1, y_16_2, r_16_1, g_16_1, b_16_1, r_16_2, g_16_2, b_16_2) \
|
||||
\
|
||||
r_8_21 = _mm_packus_epi16(r_16_1, r_16_2); \
|
||||
g_8_21 = _mm_packus_epi16(g_16_1, g_16_2); \
|
||||
b_8_21 = _mm_packus_epi16(b_16_1, b_16_2); \
|
||||
\
|
||||
/* process last 16 pixels of first line */\
|
||||
u_16 = _mm_unpackhi_epi8(u, _mm_setzero_si128()); \
|
||||
v_16 = _mm_unpackhi_epi8(v, _mm_setzero_si128()); \
|
||||
u_16 = _mm_add_epi16(u_16, _mm_set1_epi16(-128)); \
|
||||
v_16 = _mm_add_epi16(v_16, _mm_set1_epi16(-128)); \
|
||||
\
|
||||
UV2RGB_16(u_16, v_16, r_16_1, g_16_1, b_16_1, r_16_2, g_16_2, b_16_2) \
|
||||
r_uv_16_1=r_16_1; g_uv_16_1=g_16_1; b_uv_16_1=b_16_1; \
|
||||
r_uv_16_2=r_16_2; g_uv_16_2=g_16_2; b_uv_16_2=b_16_2; \
|
||||
\
|
||||
READ_Y(y_ptr1+16*y_pixel_stride) \
|
||||
y_16_1 = _mm_unpacklo_epi8(y, _mm_setzero_si128()); \
|
||||
y_16_2 = _mm_unpackhi_epi8(y, _mm_setzero_si128()); \
|
||||
\
|
||||
ADD_Y2RGB_16(y_16_1, y_16_2, r_16_1, g_16_1, b_16_1, r_16_2, g_16_2, b_16_2) \
|
||||
\
|
||||
r_8_12 = _mm_packus_epi16(r_16_1, r_16_2); \
|
||||
g_8_12 = _mm_packus_epi16(g_16_1, g_16_2); \
|
||||
b_8_12 = _mm_packus_epi16(b_16_1, b_16_2); \
|
||||
\
|
||||
/* process last 16 pixels of second line */\
|
||||
r_16_1=r_uv_16_1; g_16_1=g_uv_16_1; b_16_1=b_uv_16_1; \
|
||||
r_16_2=r_uv_16_2; g_16_2=g_uv_16_2; b_16_2=b_uv_16_2; \
|
||||
\
|
||||
READ_Y(y_ptr2+16*y_pixel_stride) \
|
||||
y_16_1 = _mm_unpacklo_epi8(y, _mm_setzero_si128()); \
|
||||
y_16_2 = _mm_unpackhi_epi8(y, _mm_setzero_si128()); \
|
||||
\
|
||||
ADD_Y2RGB_16(y_16_1, y_16_2, r_16_1, g_16_1, b_16_1, r_16_2, g_16_2, b_16_2) \
|
||||
\
|
||||
r_8_22 = _mm_packus_epi16(r_16_1, r_16_2); \
|
||||
g_8_22 = _mm_packus_epi16(g_16_1, g_16_2); \
|
||||
b_8_22 = _mm_packus_epi16(b_16_1, b_16_2); \
|
||||
\
|
||||
|
||||
|
||||
void SSE_FUNCTION_NAME(uint32_t width, uint32_t height,
|
||||
const uint8_t *Y, const uint8_t *U, const uint8_t *V, uint32_t Y_stride, uint32_t UV_stride,
|
||||
uint8_t *RGB, uint32_t RGB_stride,
|
||||
YCbCrType yuv_type)
|
||||
{
|
||||
const YUV2RGBParam *const param = &(YUV2RGB[yuv_type]);
|
||||
#if YUV_FORMAT == YUV_FORMAT_420
|
||||
const int y_pixel_stride = 1;
|
||||
const int uv_pixel_stride = 1;
|
||||
const int uv_x_sample_interval = 2;
|
||||
const int uv_y_sample_interval = 2;
|
||||
#elif YUV_FORMAT == YUV_FORMAT_422
|
||||
const int y_pixel_stride = 2;
|
||||
const int uv_pixel_stride = 4;
|
||||
const int uv_x_sample_interval = 2;
|
||||
const int uv_y_sample_interval = 1;
|
||||
#elif YUV_FORMAT == YUV_FORMAT_NV12
|
||||
const int y_pixel_stride = 1;
|
||||
const int uv_pixel_stride = 2;
|
||||
const int uv_x_sample_interval = 2;
|
||||
const int uv_y_sample_interval = 2;
|
||||
#endif
|
||||
#if RGB_FORMAT == RGB_FORMAT_RGB565
|
||||
const int rgb_pixel_stride = 2;
|
||||
#elif RGB_FORMAT == RGB_FORMAT_RGB24
|
||||
const int rgb_pixel_stride = 3;
|
||||
#elif RGB_FORMAT == RGB_FORMAT_RGBA || RGB_FORMAT == RGB_FORMAT_BGRA || \
|
||||
RGB_FORMAT == RGB_FORMAT_ARGB || RGB_FORMAT == RGB_FORMAT_ABGR
|
||||
const int rgb_pixel_stride = 4;
|
||||
#else
|
||||
#error Unknown RGB pixel size
|
||||
#endif
|
||||
|
||||
if (width >= 32) {
|
||||
uint32_t x, y;
|
||||
for(y=0; y<(height-(uv_y_sample_interval-1)); y+=uv_y_sample_interval)
|
||||
{
|
||||
const uint8_t *y_ptr1=Y+y*Y_stride,
|
||||
*y_ptr2=Y+(y+1)*Y_stride,
|
||||
*u_ptr=U+(y/uv_y_sample_interval)*UV_stride,
|
||||
*v_ptr=V+(y/uv_y_sample_interval)*UV_stride;
|
||||
|
||||
uint8_t *rgb_ptr1=RGB+y*RGB_stride,
|
||||
*rgb_ptr2=RGB+(y+1)*RGB_stride;
|
||||
|
||||
for(x=0; x<(width-31); x+=32)
|
||||
{
|
||||
YUV2RGB_32
|
||||
{
|
||||
PACK_PIXEL
|
||||
SAVE_LINE1
|
||||
if (uv_y_sample_interval > 1)
|
||||
{
|
||||
SAVE_LINE2
|
||||
}
|
||||
}
|
||||
|
||||
y_ptr1+=32*y_pixel_stride;
|
||||
y_ptr2+=32*y_pixel_stride;
|
||||
u_ptr+=32*uv_pixel_stride/uv_x_sample_interval;
|
||||
v_ptr+=32*uv_pixel_stride/uv_x_sample_interval;
|
||||
rgb_ptr1+=32*rgb_pixel_stride;
|
||||
rgb_ptr2+=32*rgb_pixel_stride;
|
||||
}
|
||||
}
|
||||
|
||||
/* Catch the last line, if needed */
|
||||
if (uv_y_sample_interval == 2 && y == (height-1))
|
||||
{
|
||||
const uint8_t *y_ptr=Y+y*Y_stride,
|
||||
*u_ptr=U+(y/uv_y_sample_interval)*UV_stride,
|
||||
*v_ptr=V+(y/uv_y_sample_interval)*UV_stride;
|
||||
|
||||
uint8_t *rgb_ptr=RGB+y*RGB_stride;
|
||||
|
||||
STD_FUNCTION_NAME(width, 1, y_ptr, u_ptr, v_ptr, Y_stride, UV_stride, rgb_ptr, RGB_stride, yuv_type);
|
||||
}
|
||||
}
|
||||
|
||||
/* Catch the right column, if needed */
|
||||
{
|
||||
int converted = (width & ~31);
|
||||
if (converted != width)
|
||||
{
|
||||
const uint8_t *y_ptr=Y+converted*y_pixel_stride,
|
||||
*u_ptr=U+converted*uv_pixel_stride/uv_x_sample_interval,
|
||||
*v_ptr=V+converted*uv_pixel_stride/uv_x_sample_interval;
|
||||
|
||||
uint8_t *rgb_ptr=RGB+converted*rgb_pixel_stride;
|
||||
|
||||
STD_FUNCTION_NAME(width-converted, height, y_ptr, u_ptr, v_ptr, Y_stride, UV_stride, rgb_ptr, RGB_stride, yuv_type);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#undef SSE_FUNCTION_NAME
|
||||
#undef STD_FUNCTION_NAME
|
||||
#undef YUV_FORMAT
|
||||
#undef RGB_FORMAT
|
||||
#undef SSE_ALIGNED
|
||||
#undef LOAD_SI128
|
||||
#undef SAVE_SI128
|
||||
#undef UV2RGB_16
|
||||
#undef ADD_Y2RGB_16
|
||||
#undef PACK_RGB24_32_STEP1
|
||||
#undef PACK_RGB24_32_STEP2
|
||||
#undef PACK_RGB24_32
|
||||
#undef PACK_RGBA_32
|
||||
#undef PACK_PIXEL
|
||||
#undef SAVE_LINE1
|
||||
#undef SAVE_LINE2
|
||||
#undef READ_Y
|
||||
#undef READ_UV
|
||||
#undef YUV2RGB_32
|
|
@ -0,0 +1,220 @@
|
|||
// Copyright 2016 Adrien Descamps
|
||||
// Distributed under BSD 3-Clause License
|
||||
|
||||
/* You need to define the following macros before including this file:
|
||||
STD_FUNCTION_NAME
|
||||
YUV_FORMAT
|
||||
RGB_FORMAT
|
||||
*/
|
||||
|
||||
#if RGB_FORMAT == RGB_FORMAT_RGB565
|
||||
|
||||
#define PACK_PIXEL(rgb_ptr) \
|
||||
*(Uint16 *)rgb_ptr = \
|
||||
((((Uint16)clampU8(y_tmp+r_tmp)) << 8 ) & 0xF800) | \
|
||||
((((Uint16)clampU8(y_tmp+g_tmp)) << 3) & 0x07E0) | \
|
||||
(((Uint16)clampU8(y_tmp+b_tmp)) >> 3); \
|
||||
rgb_ptr += 2; \
|
||||
|
||||
#elif RGB_FORMAT == RGB_FORMAT_RGB24
|
||||
|
||||
#define PACK_PIXEL(rgb_ptr) \
|
||||
rgb_ptr[0] = clampU8(y_tmp+r_tmp); \
|
||||
rgb_ptr[1] = clampU8(y_tmp+g_tmp); \
|
||||
rgb_ptr[2] = clampU8(y_tmp+b_tmp); \
|
||||
rgb_ptr += 3; \
|
||||
|
||||
#elif RGB_FORMAT == RGB_FORMAT_RGBA
|
||||
|
||||
#define PACK_PIXEL(rgb_ptr) \
|
||||
*(Uint32 *)rgb_ptr = \
|
||||
(((Uint32)clampU8(y_tmp+r_tmp)) << 24) | \
|
||||
(((Uint32)clampU8(y_tmp+g_tmp)) << 16) | \
|
||||
(((Uint32)clampU8(y_tmp+b_tmp)) << 8) | \
|
||||
0x000000FF; \
|
||||
rgb_ptr += 4; \
|
||||
|
||||
#elif RGB_FORMAT == RGB_FORMAT_BGRA
|
||||
|
||||
#define PACK_PIXEL(rgb_ptr) \
|
||||
*(Uint32 *)rgb_ptr = \
|
||||
(((Uint32)clampU8(y_tmp+b_tmp)) << 24) | \
|
||||
(((Uint32)clampU8(y_tmp+g_tmp)) << 16) | \
|
||||
(((Uint32)clampU8(y_tmp+r_tmp)) << 8) | \
|
||||
0x000000FF; \
|
||||
rgb_ptr += 4; \
|
||||
|
||||
#elif RGB_FORMAT == RGB_FORMAT_ARGB
|
||||
|
||||
#define PACK_PIXEL(rgb_ptr) \
|
||||
*(Uint32 *)rgb_ptr = \
|
||||
0xFF000000 | \
|
||||
(((Uint32)clampU8(y_tmp+r_tmp)) << 16) | \
|
||||
(((Uint32)clampU8(y_tmp+g_tmp)) << 8) | \
|
||||
(((Uint32)clampU8(y_tmp+b_tmp)) << 0); \
|
||||
rgb_ptr += 4; \
|
||||
|
||||
#elif RGB_FORMAT == RGB_FORMAT_ABGR
|
||||
|
||||
#define PACK_PIXEL(rgb_ptr) \
|
||||
*(Uint32 *)rgb_ptr = \
|
||||
0xFF000000 | \
|
||||
(((Uint32)clampU8(y_tmp+b_tmp)) << 16) | \
|
||||
(((Uint32)clampU8(y_tmp+g_tmp)) << 8) | \
|
||||
(((Uint32)clampU8(y_tmp+r_tmp)) << 0); \
|
||||
rgb_ptr += 4; \
|
||||
|
||||
#else
|
||||
#error PACK_PIXEL unimplemented
|
||||
#endif
|
||||
|
||||
|
||||
void STD_FUNCTION_NAME(
|
||||
uint32_t width, uint32_t height,
|
||||
const uint8_t *Y, const uint8_t *U, const uint8_t *V, uint32_t Y_stride, uint32_t UV_stride,
|
||||
uint8_t *RGB, uint32_t RGB_stride,
|
||||
YCbCrType yuv_type)
|
||||
{
|
||||
const YUV2RGBParam *const param = &(YUV2RGB[yuv_type]);
|
||||
#if YUV_FORMAT == YUV_FORMAT_420
|
||||
const int y_pixel_stride = 1;
|
||||
const int uv_pixel_stride = 1;
|
||||
const int uv_x_sample_interval = 2;
|
||||
const int uv_y_sample_interval = 2;
|
||||
#elif YUV_FORMAT == YUV_FORMAT_422
|
||||
const int y_pixel_stride = 2;
|
||||
const int uv_pixel_stride = 4;
|
||||
const int uv_x_sample_interval = 2;
|
||||
const int uv_y_sample_interval = 1;
|
||||
#elif YUV_FORMAT == YUV_FORMAT_NV12
|
||||
const int y_pixel_stride = 1;
|
||||
const int uv_pixel_stride = 2;
|
||||
const int uv_x_sample_interval = 2;
|
||||
const int uv_y_sample_interval = 2;
|
||||
#endif
|
||||
|
||||
uint32_t x, y;
|
||||
for(y=0; y<(height-(uv_y_sample_interval-1)); y+=uv_y_sample_interval)
|
||||
{
|
||||
const uint8_t *y_ptr1=Y+y*Y_stride,
|
||||
*y_ptr2=Y+(y+1)*Y_stride,
|
||||
*u_ptr=U+(y/uv_y_sample_interval)*UV_stride,
|
||||
*v_ptr=V+(y/uv_y_sample_interval)*UV_stride;
|
||||
|
||||
uint8_t *rgb_ptr1=RGB+y*RGB_stride,
|
||||
*rgb_ptr2=RGB+(y+1)*RGB_stride;
|
||||
|
||||
for(x=0; x<(width-(uv_x_sample_interval-1)); x+=uv_x_sample_interval)
|
||||
{
|
||||
// Compute U and V contributions, common to the four pixels
|
||||
|
||||
int32_t u_tmp = ((*u_ptr)-128);
|
||||
int32_t v_tmp = ((*v_ptr)-128);
|
||||
|
||||
int32_t r_tmp = (v_tmp*param->v_r_factor);
|
||||
int32_t g_tmp = (u_tmp*param->u_g_factor + v_tmp*param->v_g_factor);
|
||||
int32_t b_tmp = (u_tmp*param->u_b_factor);
|
||||
|
||||
// Compute the Y contribution for each pixel
|
||||
|
||||
int32_t y_tmp = ((y_ptr1[0]-param->y_shift)*param->y_factor);
|
||||
PACK_PIXEL(rgb_ptr1);
|
||||
|
||||
y_tmp = ((y_ptr1[y_pixel_stride]-param->y_shift)*param->y_factor);
|
||||
PACK_PIXEL(rgb_ptr1);
|
||||
|
||||
if (uv_y_sample_interval > 1) {
|
||||
y_tmp = ((y_ptr2[0]-param->y_shift)*param->y_factor);
|
||||
PACK_PIXEL(rgb_ptr2);
|
||||
|
||||
y_tmp = ((y_ptr2[y_pixel_stride]-param->y_shift)*param->y_factor);
|
||||
PACK_PIXEL(rgb_ptr2);
|
||||
}
|
||||
|
||||
y_ptr1+=2*y_pixel_stride;
|
||||
y_ptr2+=2*y_pixel_stride;
|
||||
u_ptr+=2*uv_pixel_stride/uv_x_sample_interval;
|
||||
v_ptr+=2*uv_pixel_stride/uv_x_sample_interval;
|
||||
}
|
||||
|
||||
/* Catch the last pixel, if needed */
|
||||
if (uv_x_sample_interval == 2 && x == (width-1))
|
||||
{
|
||||
// Compute U and V contributions, common to the four pixels
|
||||
|
||||
int32_t u_tmp = ((*u_ptr)-128);
|
||||
int32_t v_tmp = ((*v_ptr)-128);
|
||||
|
||||
int32_t r_tmp = (v_tmp*param->v_r_factor);
|
||||
int32_t g_tmp = (u_tmp*param->u_g_factor + v_tmp*param->v_g_factor);
|
||||
int32_t b_tmp = (u_tmp*param->u_b_factor);
|
||||
|
||||
// Compute the Y contribution for each pixel
|
||||
|
||||
int32_t y_tmp = ((y_ptr1[0]-param->y_shift)*param->y_factor);
|
||||
PACK_PIXEL(rgb_ptr1);
|
||||
|
||||
if (uv_y_sample_interval > 1) {
|
||||
y_tmp = ((y_ptr2[0]-param->y_shift)*param->y_factor);
|
||||
PACK_PIXEL(rgb_ptr2);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Catch the last line, if needed */
|
||||
if (uv_y_sample_interval == 2 && y == (height-1))
|
||||
{
|
||||
const uint8_t *y_ptr1=Y+y*Y_stride,
|
||||
*u_ptr=U+(y/uv_y_sample_interval)*UV_stride,
|
||||
*v_ptr=V+(y/uv_y_sample_interval)*UV_stride;
|
||||
|
||||
uint8_t *rgb_ptr1=RGB+y*RGB_stride;
|
||||
|
||||
for(x=0; x<(width-(uv_x_sample_interval-1)); x+=uv_x_sample_interval)
|
||||
{
|
||||
// Compute U and V contributions, common to the four pixels
|
||||
|
||||
int32_t u_tmp = ((*u_ptr)-128);
|
||||
int32_t v_tmp = ((*v_ptr)-128);
|
||||
|
||||
int32_t r_tmp = (v_tmp*param->v_r_factor);
|
||||
int32_t g_tmp = (u_tmp*param->u_g_factor + v_tmp*param->v_g_factor);
|
||||
int32_t b_tmp = (u_tmp*param->u_b_factor);
|
||||
|
||||
// Compute the Y contribution for each pixel
|
||||
|
||||
int32_t y_tmp = ((y_ptr1[0]-param->y_shift)*param->y_factor);
|
||||
PACK_PIXEL(rgb_ptr1);
|
||||
|
||||
y_tmp = ((y_ptr1[y_pixel_stride]-param->y_shift)*param->y_factor);
|
||||
PACK_PIXEL(rgb_ptr1);
|
||||
|
||||
y_ptr1+=2*y_pixel_stride;
|
||||
u_ptr+=2*uv_pixel_stride/uv_x_sample_interval;
|
||||
v_ptr+=2*uv_pixel_stride/uv_x_sample_interval;
|
||||
}
|
||||
|
||||
/* Catch the last pixel, if needed */
|
||||
if (uv_x_sample_interval == 2 && x == (width-1))
|
||||
{
|
||||
// Compute U and V contributions, common to the four pixels
|
||||
|
||||
int32_t u_tmp = ((*u_ptr)-128);
|
||||
int32_t v_tmp = ((*v_ptr)-128);
|
||||
|
||||
int32_t r_tmp = (v_tmp*param->v_r_factor);
|
||||
int32_t g_tmp = (u_tmp*param->u_g_factor + v_tmp*param->v_g_factor);
|
||||
int32_t b_tmp = (u_tmp*param->u_b_factor);
|
||||
|
||||
// Compute the Y contribution for each pixel
|
||||
|
||||
int32_t y_tmp = ((y_ptr1[0]-param->y_shift)*param->y_factor);
|
||||
PACK_PIXEL(rgb_ptr1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#undef STD_FUNCTION_NAME
|
||||
#undef YUV_FORMAT
|
||||
#undef RGB_FORMAT
|
||||
#undef PACK_PIXEL
|
|
@ -9,19 +9,23 @@ LIBS = @LIBS@
|
|||
|
||||
TARGETS = \
|
||||
checkkeys$(EXE) \
|
||||
controllermap$(EXE) \
|
||||
loopwave$(EXE) \
|
||||
loopwavequeue$(EXE) \
|
||||
testatomic$(EXE) \
|
||||
testaudioinfo$(EXE) \
|
||||
testaudiocapture$(EXE) \
|
||||
testaudiohotplug$(EXE) \
|
||||
testaudioinfo$(EXE) \
|
||||
testautomation$(EXE) \
|
||||
testbounds$(EXE) \
|
||||
testcustomcursor$(EXE) \
|
||||
testdisplayinfo$(EXE) \
|
||||
testdraw2$(EXE) \
|
||||
testdrawchessboard$(EXE) \
|
||||
testdropfile$(EXE) \
|
||||
testerror$(EXE) \
|
||||
testfile$(EXE) \
|
||||
testfilesystem$(EXE) \
|
||||
testgamecontroller$(EXE) \
|
||||
testgesture$(EXE) \
|
||||
testgl2$(EXE) \
|
||||
|
@ -29,26 +33,26 @@ TARGETS = \
|
|||
testgles2$(EXE) \
|
||||
testhaptic$(EXE) \
|
||||
testhittesting$(EXE) \
|
||||
testrumble$(EXE) \
|
||||
testhotplug$(EXE) \
|
||||
testthread$(EXE) \
|
||||
testiconv$(EXE) \
|
||||
testime$(EXE) \
|
||||
testintersections$(EXE) \
|
||||
testrelative$(EXE) \
|
||||
testjoystick$(EXE) \
|
||||
testkeys$(EXE) \
|
||||
testloadso$(EXE) \
|
||||
testlock$(EXE) \
|
||||
testmessage$(EXE) \
|
||||
testmultiaudio$(EXE) \
|
||||
testaudiohotplug$(EXE) \
|
||||
testnative$(EXE) \
|
||||
testoverlay2$(EXE) \
|
||||
testplatform$(EXE) \
|
||||
testpower$(EXE) \
|
||||
testfilesystem$(EXE) \
|
||||
testqsort$(EXE) \
|
||||
testrelative$(EXE) \
|
||||
testrendercopyex$(EXE) \
|
||||
testrendertarget$(EXE) \
|
||||
testresample$(EXE) \
|
||||
testrumble$(EXE) \
|
||||
testscale$(EXE) \
|
||||
testsem$(EXE) \
|
||||
testshader$(EXE) \
|
||||
|
@ -56,17 +60,14 @@ TARGETS = \
|
|||
testsprite2$(EXE) \
|
||||
testspriteminimal$(EXE) \
|
||||
teststreaming$(EXE) \
|
||||
testthread$(EXE) \
|
||||
testtimer$(EXE) \
|
||||
testver$(EXE) \
|
||||
testviewport$(EXE) \
|
||||
testwm2$(EXE) \
|
||||
torturethread$(EXE) \
|
||||
testrendercopyex$(EXE) \
|
||||
testmessage$(EXE) \
|
||||
testdisplayinfo$(EXE) \
|
||||
testqsort$(EXE) \
|
||||
controllermap$(EXE) \
|
||||
testvulkan$(EXE) \
|
||||
testwm2$(EXE) \
|
||||
testyuv$(EXE) \
|
||||
torturethread$(EXE) \
|
||||
|
||||
all: Makefile $(TARGETS) copydatafiles
|
||||
|
||||
|
@ -266,6 +267,9 @@ testviewport$(EXE): $(srcdir)/testviewport.c
|
|||
testwm2$(EXE): $(srcdir)/testwm2.c
|
||||
$(CC) -o $@ $^ $(CFLAGS) $(LIBS)
|
||||
|
||||
testyuv$(EXE): $(srcdir)/testyuv.c
|
||||
$(CC) -o $@ $^ $(CFLAGS) $(LIBS)
|
||||
|
||||
torturethread$(EXE): $(srcdir)/torturethread.c
|
||||
$(CC) -o $@ $^ $(CFLAGS) $(LIBS)
|
||||
|
||||
|
|
|
@ -16,16 +16,14 @@
|
|||
* *
|
||||
********************************************************************************/
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#ifdef __EMSCRIPTEN__
|
||||
#include <emscripten/emscripten.h>
|
||||
#endif
|
||||
|
||||
#include "SDL.h"
|
||||
|
||||
#include "testyuv_cvt.h"
|
||||
|
||||
#define MOOSEPIC_W 64
|
||||
#define MOOSEPIC_H 88
|
||||
|
||||
|
@ -149,7 +147,6 @@ SDL_Renderer *renderer;
|
|||
int paused = 0;
|
||||
int i;
|
||||
SDL_bool done = SDL_FALSE;
|
||||
Uint32 pixel_format = SDL_PIXELFORMAT_YV12;
|
||||
static int fpsdelay;
|
||||
|
||||
/* Call this instead of exit(), so we can clean up SDL: atexit() is evil. */
|
||||
|
@ -160,91 +157,6 @@ quit(int rc)
|
|||
exit(rc);
|
||||
}
|
||||
|
||||
/* All RGB2YUV conversion code and some other parts of code has been taken from testoverlay.c */
|
||||
|
||||
/* NOTE: These RGB conversion functions are not intended for speed,
|
||||
only as examples.
|
||||
*/
|
||||
|
||||
void
|
||||
RGBtoYUV(Uint8 * rgb, int *yuv, int monochrome, int luminance)
|
||||
{
|
||||
if (monochrome) {
|
||||
#if 1 /* these are the two formulas that I found on the FourCC site... */
|
||||
yuv[0] = (int)(0.299 * rgb[0] + 0.587 * rgb[1] + 0.114 * rgb[2]);
|
||||
yuv[1] = 128;
|
||||
yuv[2] = 128;
|
||||
#else
|
||||
yuv[0] = (int)(0.257 * rgb[0]) + (0.504 * rgb[1]) + (0.098 * rgb[2]) + 16;
|
||||
yuv[1] = 128;
|
||||
yuv[2] = 128;
|
||||
#endif
|
||||
} else {
|
||||
#if 1 /* these are the two formulas that I found on the FourCC site... */
|
||||
yuv[0] = (int)(0.299 * rgb[0] + 0.587 * rgb[1] + 0.114 * rgb[2]);
|
||||
yuv[1] = (int)((rgb[2] - yuv[0]) * 0.565 + 128);
|
||||
yuv[2] = (int)((rgb[0] - yuv[0]) * 0.713 + 128);
|
||||
#else
|
||||
yuv[0] = (0.257 * rgb[0]) + (0.504 * rgb[1]) + (0.098 * rgb[2]) + 16;
|
||||
yuv[1] = 128 - (0.148 * rgb[0]) - (0.291 * rgb[1]) + (0.439 * rgb[2]);
|
||||
yuv[2] = 128 + (0.439 * rgb[0]) - (0.368 * rgb[1]) - (0.071 * rgb[2]);
|
||||
#endif
|
||||
}
|
||||
|
||||
if (luminance != 100) {
|
||||
yuv[0] = yuv[0] * luminance / 100;
|
||||
if (yuv[0] > 255)
|
||||
yuv[0] = 255;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
ConvertRGBtoYV12(Uint8 *rgb, Uint8 *out, int w, int h,
|
||||
int monochrome, int luminance)
|
||||
{
|
||||
int x, y;
|
||||
int yuv[3];
|
||||
Uint8 *op[3];
|
||||
|
||||
op[0] = out;
|
||||
op[1] = op[0] + w*h;
|
||||
op[2] = op[1] + w*h/4;
|
||||
for (y = 0; y < h; ++y) {
|
||||
for (x = 0; x < w; ++x) {
|
||||
RGBtoYUV(rgb, yuv, monochrome, luminance);
|
||||
*(op[0]++) = yuv[0];
|
||||
if (x % 2 == 0 && y % 2 == 0) {
|
||||
*(op[1]++) = yuv[2];
|
||||
*(op[2]++) = yuv[1];
|
||||
}
|
||||
rgb += 3;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
ConvertRGBtoNV12(Uint8 *rgb, Uint8 *out, int w, int h,
|
||||
int monochrome, int luminance)
|
||||
{
|
||||
int x, y;
|
||||
int yuv[3];
|
||||
Uint8 *op[2];
|
||||
|
||||
op[0] = out;
|
||||
op[1] = op[0] + w*h;
|
||||
for (y = 0; y < h; ++y) {
|
||||
for (x = 0; x < w; ++x) {
|
||||
RGBtoYUV(rgb, yuv, monochrome, luminance);
|
||||
*(op[0]++) = yuv[0];
|
||||
if (x % 2 == 0 && y % 2 == 0) {
|
||||
*(op[1]++) = yuv[1];
|
||||
*(op[1]++) = yuv[2];
|
||||
}
|
||||
rgb += 3;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
PrintUsage(char *argv0)
|
||||
{
|
||||
|
@ -307,7 +219,7 @@ loop()
|
|||
if (!paused) {
|
||||
i = (i + 1) % MOOSEFRAMES_COUNT;
|
||||
|
||||
SDL_UpdateTexture(MooseTexture, NULL, MooseFrame[i], MOOSEPIC_W*SDL_BYTESPERPIXEL(pixel_format));
|
||||
SDL_UpdateTexture(MooseTexture, NULL, MooseFrame[i], MOOSEPIC_W);
|
||||
}
|
||||
SDL_RenderClear(renderer);
|
||||
SDL_RenderCopy(renderer, MooseTexture, NULL, &displayrect);
|
||||
|
@ -329,11 +241,6 @@ main(int argc, char **argv)
|
|||
int j;
|
||||
int fps = 12;
|
||||
int nodelay = 0;
|
||||
#ifdef TEST_NV12
|
||||
Uint32 pixel_format = SDL_PIXELFORMAT_NV12;
|
||||
#else
|
||||
Uint32 pixel_format = SDL_PIXELFORMAT_YV12;
|
||||
#endif
|
||||
int scale = 5;
|
||||
|
||||
/* Enable standard application logging */
|
||||
|
@ -439,7 +346,7 @@ main(int argc, char **argv)
|
|||
quit(4);
|
||||
}
|
||||
|
||||
MooseTexture = SDL_CreateTexture(renderer, pixel_format, SDL_TEXTUREACCESS_STREAMING, MOOSEPIC_W, MOOSEPIC_H);
|
||||
MooseTexture = SDL_CreateTexture(renderer, SDL_PIXELFORMAT_YV12, SDL_TEXTUREACCESS_STREAMING, MOOSEPIC_W, MOOSEPIC_H);
|
||||
if (!MooseTexture) {
|
||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't set create texture: %s\n", SDL_GetError());
|
||||
free(RawMooseData);
|
||||
|
@ -461,17 +368,9 @@ main(int argc, char **argv)
|
|||
rgb[2] = MooseColors[frame[j]].b;
|
||||
rgb += 3;
|
||||
}
|
||||
switch (pixel_format) {
|
||||
case SDL_PIXELFORMAT_YV12:
|
||||
ConvertRGBtoYV12(MooseFrameRGB, MooseFrame[i], MOOSEPIC_W, MOOSEPIC_H, 0, 100);
|
||||
break;
|
||||
case SDL_PIXELFORMAT_NV12:
|
||||
ConvertRGBtoNV12(MooseFrameRGB, MooseFrame[i], MOOSEPIC_W, MOOSEPIC_H, 0, 100);
|
||||
break;
|
||||
default:
|
||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Unsupported pixel format\n");
|
||||
break;
|
||||
}
|
||||
ConvertRGBtoYUV(SDL_PIXELFORMAT_YV12, MooseFrameRGB, MOOSEPIC_W*3, MooseFrame[i], MOOSEPIC_W, MOOSEPIC_H,
|
||||
SDL_GetYUVConversionModeForResolution(MOOSEPIC_W, MOOSEPIC_H),
|
||||
0, 100);
|
||||
}
|
||||
|
||||
free(RawMooseData);
|
||||
|
|
Binary file not shown.
After Width: | Height: | Size: 722 KiB |
|
@ -0,0 +1,455 @@
|
|||
/*
|
||||
Copyright (C) 1997-2017 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
arising from the use of this software.
|
||||
|
||||
Permission is granted to anyone to use this software for any purpose,
|
||||
including commercial applications, and to alter it and redistribute it
|
||||
freely.
|
||||
*/
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "SDL.h"
|
||||
#include "SDL_test_font.h"
|
||||
#include "testyuv_cvt.h"
|
||||
|
||||
|
||||
/* 422 (YUY2, etc) formats are the largest */
|
||||
#define MAX_YUV_SURFACE_SIZE(W, H, P) (H*4*(W+P+1)/2)
|
||||
|
||||
|
||||
/* Return true if the YUV format is packed pixels */
|
||||
static SDL_bool is_packed_yuv_format(Uint32 format)
|
||||
{
|
||||
return (format == SDL_PIXELFORMAT_YUY2 ||
|
||||
format == SDL_PIXELFORMAT_UYVY ||
|
||||
format == SDL_PIXELFORMAT_YVYU);
|
||||
}
|
||||
|
||||
/* Create a surface with a good pattern for verifying YUV conversion */
|
||||
static SDL_Surface *generate_test_pattern(int pattern_size)
|
||||
{
|
||||
SDL_Surface *pattern = SDL_CreateRGBSurfaceWithFormat(0, pattern_size, pattern_size, 0, SDL_PIXELFORMAT_RGB24);
|
||||
|
||||
if (pattern) {
|
||||
int i, x, y;
|
||||
Uint8 *p, c;
|
||||
const int thickness = 2; /* Important so 2x2 blocks of color are the same, to avoid Cr/Cb interpolation over pixels */
|
||||
|
||||
/* R, G, B in alternating horizontal bands */
|
||||
for (y = 0; y < pattern->h; y += thickness) {
|
||||
for (i = 0; i < thickness; ++i) {
|
||||
p = (Uint8 *)pattern->pixels + (y + i) * pattern->pitch + ((y/thickness) % 3);
|
||||
for (x = 0; x < pattern->w; ++x) {
|
||||
*p = 0xFF;
|
||||
p += 3;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Black and white in alternating vertical bands */
|
||||
c = 0xFF;
|
||||
for (x = 1*thickness; x < pattern->w; x += 2*thickness) {
|
||||
for (i = 0; i < thickness; ++i) {
|
||||
p = (Uint8 *)pattern->pixels + (x + i)*3;
|
||||
for (y = 0; y < pattern->h; ++y) {
|
||||
SDL_memset(p, c, 3);
|
||||
p += pattern->pitch;
|
||||
}
|
||||
}
|
||||
if (c) {
|
||||
c = 0x00;
|
||||
} else {
|
||||
c = 0xFF;
|
||||
}
|
||||
}
|
||||
}
|
||||
return pattern;
|
||||
}
|
||||
|
||||
static SDL_bool verify_yuv_data(Uint32 format, const Uint8 *yuv, int yuv_pitch, SDL_Surface *surface)
|
||||
{
|
||||
const int tolerance = 20;
|
||||
const int size = (surface->h * surface->pitch);
|
||||
Uint8 *rgb;
|
||||
SDL_bool result = SDL_FALSE;
|
||||
|
||||
rgb = (Uint8 *)SDL_malloc(size);
|
||||
if (!rgb) {
|
||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Out of memory");
|
||||
return SDL_FALSE;
|
||||
}
|
||||
|
||||
if (SDL_ConvertPixels(surface->w, surface->h, format, yuv, yuv_pitch, surface->format->format, rgb, surface->pitch) == 0) {
|
||||
int x, y;
|
||||
result = SDL_TRUE;
|
||||
for (y = 0; y < surface->h; ++y) {
|
||||
const Uint8 *actual = rgb + y * surface->pitch;
|
||||
const Uint8 *expected = (const Uint8 *)surface->pixels + y * surface->pitch;
|
||||
for (x = 0; x < surface->w; ++x) {
|
||||
int deltaR = (int)actual[0] - expected[0];
|
||||
int deltaG = (int)actual[1] - expected[1];
|
||||
int deltaB = (int)actual[2] - expected[2];
|
||||
int distance = (deltaR * deltaR + deltaG * deltaG + deltaB * deltaB);
|
||||
if (distance > tolerance) {
|
||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Pixel at %d,%d was 0x%.2x,0x%.2x,0x%.2x, expected 0x%.2x,0x%.2x,0x%.2x, distance = %d\n", x, y, actual[0], actual[1], actual[2], expected[0], expected[1], expected[2], distance);
|
||||
result = SDL_FALSE;
|
||||
}
|
||||
actual += 3;
|
||||
expected += 3;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't convert %s to %s: %s\n", SDL_GetPixelFormatName(format), SDL_GetPixelFormatName(surface->format->format), SDL_GetError());
|
||||
}
|
||||
SDL_free(rgb);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
static int run_automated_tests(int pattern_size, int extra_pitch)
|
||||
{
|
||||
const Uint32 formats[] = {
|
||||
SDL_PIXELFORMAT_YV12,
|
||||
SDL_PIXELFORMAT_IYUV,
|
||||
SDL_PIXELFORMAT_NV12,
|
||||
SDL_PIXELFORMAT_NV21,
|
||||
SDL_PIXELFORMAT_YUY2,
|
||||
SDL_PIXELFORMAT_UYVY,
|
||||
SDL_PIXELFORMAT_YVYU
|
||||
};
|
||||
int i, j;
|
||||
SDL_Surface *pattern = generate_test_pattern(pattern_size);
|
||||
const int yuv_len = MAX_YUV_SURFACE_SIZE(pattern->w, pattern->h, extra_pitch);
|
||||
Uint8 *yuv1 = (Uint8 *)SDL_malloc(yuv_len);
|
||||
Uint8 *yuv2 = (Uint8 *)SDL_malloc(yuv_len);
|
||||
int yuv1_pitch, yuv2_pitch;
|
||||
int result = -1;
|
||||
|
||||
if (!pattern || !yuv1 || !yuv2) {
|
||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't allocate test surfaces");
|
||||
goto done;
|
||||
}
|
||||
|
||||
/* Verify conversion from YUV formats */
|
||||
for (i = 0; i < SDL_arraysize(formats); ++i) {
|
||||
if (!ConvertRGBtoYUV(formats[i], pattern->pixels, pattern->pitch, yuv1, pattern->w, pattern->h, SDL_GetYUVConversionModeForResolution(pattern->w, pattern->h), 0, 100)) {
|
||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "ConvertRGBtoYUV() doesn't support converting to %s\n", SDL_GetPixelFormatName(formats[i]));
|
||||
goto done;
|
||||
}
|
||||
yuv1_pitch = CalculateYUVPitch(formats[i], pattern->w);
|
||||
if (!verify_yuv_data(formats[i], yuv1, yuv1_pitch, pattern)) {
|
||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Failed conversion from %s to RGB\n", SDL_GetPixelFormatName(formats[i]));
|
||||
goto done;
|
||||
}
|
||||
}
|
||||
|
||||
/* Verify conversion to YUV formats */
|
||||
for (i = 0; i < SDL_arraysize(formats); ++i) {
|
||||
yuv1_pitch = CalculateYUVPitch(formats[i], pattern->w) + extra_pitch;
|
||||
if (SDL_ConvertPixels(pattern->w, pattern->h, pattern->format->format, pattern->pixels, pattern->pitch, formats[i], yuv1, yuv1_pitch) < 0) {
|
||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't convert %s to %s: %s\n", SDL_GetPixelFormatName(pattern->format->format), SDL_GetPixelFormatName(formats[i]), SDL_GetError());
|
||||
goto done;
|
||||
}
|
||||
if (!verify_yuv_data(formats[i], yuv1, yuv1_pitch, pattern)) {
|
||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Failed conversion from RGB to %s\n", SDL_GetPixelFormatName(formats[i]));
|
||||
goto done;
|
||||
}
|
||||
}
|
||||
|
||||
/* Verify conversion between YUV formats */
|
||||
for (i = 0; i < SDL_arraysize(formats); ++i) {
|
||||
for (j = 0; j < SDL_arraysize(formats); ++j) {
|
||||
yuv1_pitch = CalculateYUVPitch(formats[i], pattern->w) + extra_pitch;
|
||||
yuv2_pitch = CalculateYUVPitch(formats[j], pattern->w) + extra_pitch;
|
||||
if (SDL_ConvertPixels(pattern->w, pattern->h, pattern->format->format, pattern->pixels, pattern->pitch, formats[i], yuv1, yuv1_pitch) < 0) {
|
||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't convert %s to %s: %s\n", SDL_GetPixelFormatName(pattern->format->format), SDL_GetPixelFormatName(formats[i]), SDL_GetError());
|
||||
goto done;
|
||||
}
|
||||
if (SDL_ConvertPixels(pattern->w, pattern->h, formats[i], yuv1, yuv1_pitch, formats[j], yuv2, yuv2_pitch) < 0) {
|
||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't convert %s to %s: %s\n", SDL_GetPixelFormatName(formats[i]), SDL_GetPixelFormatName(formats[j]), SDL_GetError());
|
||||
goto done;
|
||||
}
|
||||
if (!verify_yuv_data(formats[j], yuv2, yuv2_pitch, pattern)) {
|
||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Failed conversion from %s to %s\n", SDL_GetPixelFormatName(formats[i]), SDL_GetPixelFormatName(formats[j]));
|
||||
goto done;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Verify conversion between YUV formats in-place */
|
||||
for (i = 0; i < SDL_arraysize(formats); ++i) {
|
||||
for (j = 0; j < SDL_arraysize(formats); ++j) {
|
||||
if (is_packed_yuv_format(formats[i]) != is_packed_yuv_format(formats[j])) {
|
||||
/* Can't change plane vs packed pixel layout in-place */
|
||||
continue;
|
||||
}
|
||||
|
||||
yuv1_pitch = CalculateYUVPitch(formats[i], pattern->w) + extra_pitch;
|
||||
yuv2_pitch = CalculateYUVPitch(formats[j], pattern->w) + extra_pitch;
|
||||
if (SDL_ConvertPixels(pattern->w, pattern->h, pattern->format->format, pattern->pixels, pattern->pitch, formats[i], yuv1, yuv1_pitch) < 0) {
|
||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't convert %s to %s: %s\n", SDL_GetPixelFormatName(pattern->format->format), SDL_GetPixelFormatName(formats[i]), SDL_GetError());
|
||||
goto done;
|
||||
}
|
||||
if (SDL_ConvertPixels(pattern->w, pattern->h, formats[i], yuv1, yuv1_pitch, formats[j], yuv1, yuv2_pitch) < 0) {
|
||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't convert %s to %s: %s\n", SDL_GetPixelFormatName(formats[i]), SDL_GetPixelFormatName(formats[j]), SDL_GetError());
|
||||
goto done;
|
||||
}
|
||||
if (!verify_yuv_data(formats[j], yuv1, yuv2_pitch, pattern)) {
|
||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Failed conversion from %s to %s\n", SDL_GetPixelFormatName(formats[i]), SDL_GetPixelFormatName(formats[j]));
|
||||
goto done;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
result = 0;
|
||||
|
||||
done:
|
||||
SDL_free(yuv1);
|
||||
SDL_free(yuv2);
|
||||
SDL_FreeSurface(pattern);
|
||||
return result;
|
||||
}
|
||||
|
||||
int
|
||||
main(int argc, char **argv)
|
||||
{
|
||||
struct {
|
||||
SDL_bool enable_intrinsics;
|
||||
int pattern_size;
|
||||
int extra_pitch;
|
||||
} automated_test_params[] = {
|
||||
/* Test: even width and height */
|
||||
{ SDL_FALSE, 2, 0 },
|
||||
{ SDL_FALSE, 4, 0 },
|
||||
/* Test: odd width and height */
|
||||
{ SDL_FALSE, 1, 0 },
|
||||
{ SDL_FALSE, 3, 0 },
|
||||
/* Test: even width and height, extra pitch */
|
||||
{ SDL_FALSE, 2, 3 },
|
||||
{ SDL_FALSE, 4, 3 },
|
||||
/* Test: odd width and height, extra pitch */
|
||||
{ SDL_FALSE, 1, 3 },
|
||||
{ SDL_FALSE, 3, 3 },
|
||||
/* Test: even width and height with intrinsics */
|
||||
{ SDL_TRUE, 32, 0 },
|
||||
/* Test: odd width and height with intrinsics */
|
||||
{ SDL_TRUE, 33, 0 },
|
||||
{ SDL_TRUE, 37, 0 },
|
||||
/* Test: even width and height with intrinsics, extra pitch */
|
||||
{ SDL_TRUE, 32, 3 },
|
||||
/* Test: odd width and height with intrinsics, extra pitch */
|
||||
{ SDL_TRUE, 33, 3 },
|
||||
{ SDL_TRUE, 37, 3 },
|
||||
};
|
||||
int arg = 1;
|
||||
const char *filename;
|
||||
SDL_Surface *original;
|
||||
SDL_Surface *converted;
|
||||
SDL_Window *window;
|
||||
SDL_Renderer *renderer;
|
||||
SDL_Texture *output[3];
|
||||
const char *titles[3] = { "ORIGINAL", "SOFTWARE", "HARDWARE" };
|
||||
char title[128];
|
||||
const char *yuv_name;
|
||||
const char *yuv_mode;
|
||||
Uint32 rgb_format = SDL_PIXELFORMAT_RGBX8888;
|
||||
Uint32 yuv_format = SDL_PIXELFORMAT_YV12;
|
||||
int current = 0;
|
||||
int pitch;
|
||||
Uint8 *raw_yuv;
|
||||
Uint32 then, now, i, iterations = 100;
|
||||
SDL_bool should_run_automated_tests = SDL_FALSE;
|
||||
|
||||
while (argv[arg] && *argv[arg] == '-') {
|
||||
if (SDL_strcmp(argv[arg], "--jpeg") == 0) {
|
||||
SDL_SetYUVConversionMode(SDL_YUV_CONVERSION_JPEG);
|
||||
} else if (SDL_strcmp(argv[arg], "--bt601") == 0) {
|
||||
SDL_SetYUVConversionMode(SDL_YUV_CONVERSION_BT601);
|
||||
} else if (SDL_strcmp(argv[arg], "--bt709") == 0) {
|
||||
SDL_SetYUVConversionMode(SDL_YUV_CONVERSION_BT709);
|
||||
} else if (SDL_strcmp(argv[arg], "--auto") == 0) {
|
||||
SDL_SetYUVConversionMode(SDL_YUV_CONVERSION_AUTOMATIC);
|
||||
} else if (SDL_strcmp(argv[arg], "--yv12") == 0) {
|
||||
yuv_format = SDL_PIXELFORMAT_YV12;
|
||||
} else if (SDL_strcmp(argv[arg], "--iyuv") == 0) {
|
||||
yuv_format = SDL_PIXELFORMAT_IYUV;
|
||||
} else if (SDL_strcmp(argv[arg], "--yuy2") == 0) {
|
||||
yuv_format = SDL_PIXELFORMAT_YUY2;
|
||||
} else if (SDL_strcmp(argv[arg], "--uyvy") == 0) {
|
||||
yuv_format = SDL_PIXELFORMAT_UYVY;
|
||||
} else if (SDL_strcmp(argv[arg], "--yvyu") == 0) {
|
||||
yuv_format = SDL_PIXELFORMAT_YVYU;
|
||||
} else if (SDL_strcmp(argv[arg], "--nv12") == 0) {
|
||||
yuv_format = SDL_PIXELFORMAT_NV12;
|
||||
} else if (SDL_strcmp(argv[arg], "--nv21") == 0) {
|
||||
yuv_format = SDL_PIXELFORMAT_NV21;
|
||||
} else if (SDL_strcmp(argv[arg], "--rgb555") == 0) {
|
||||
rgb_format = SDL_PIXELFORMAT_RGB555;
|
||||
} else if (SDL_strcmp(argv[arg], "--rgb565") == 0) {
|
||||
rgb_format = SDL_PIXELFORMAT_RGB565;
|
||||
} else if (SDL_strcmp(argv[arg], "--rgb24") == 0) {
|
||||
rgb_format = SDL_PIXELFORMAT_RGB24;
|
||||
} else if (SDL_strcmp(argv[arg], "--argb") == 0) {
|
||||
rgb_format = SDL_PIXELFORMAT_ARGB8888;
|
||||
} else if (SDL_strcmp(argv[arg], "--abgr") == 0) {
|
||||
rgb_format = SDL_PIXELFORMAT_ABGR8888;
|
||||
} else if (SDL_strcmp(argv[arg], "--rgba") == 0) {
|
||||
rgb_format = SDL_PIXELFORMAT_RGBA8888;
|
||||
} else if (SDL_strcmp(argv[arg], "--bgra") == 0) {
|
||||
rgb_format = SDL_PIXELFORMAT_BGRA8888;
|
||||
} else if (SDL_strcmp(argv[arg], "--automated") == 0) {
|
||||
should_run_automated_tests = SDL_TRUE;
|
||||
} else {
|
||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Usage: %s [--jpeg|--bt601|-bt709|--auto] [--yv12|--iyuv|--yuy2|--uyvy|--yvyu|--nv12|--nv21] [--rgb555|--rgb565|--rgb24|--argb|--abgr|--rgba|--bgra] [image_filename]\n", argv[0]);
|
||||
return 1;
|
||||
}
|
||||
++arg;
|
||||
}
|
||||
|
||||
/* Run automated tests */
|
||||
if (should_run_automated_tests) {
|
||||
for (i = 0; i < SDL_arraysize(automated_test_params); ++i) {
|
||||
SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION, "Running automated test, pattern size %d, extra pitch %d, intrinsics %s\n",
|
||||
automated_test_params[i].pattern_size,
|
||||
automated_test_params[i].extra_pitch,
|
||||
automated_test_params[i].enable_intrinsics ? "enabled" : "disabled");
|
||||
if (run_automated_tests(automated_test_params[i].pattern_size, automated_test_params[i].extra_pitch) < 0) {
|
||||
return 2;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (argv[arg]) {
|
||||
filename = argv[arg];
|
||||
} else {
|
||||
filename = "testyuv.bmp";
|
||||
}
|
||||
original = SDL_ConvertSurfaceFormat(SDL_LoadBMP(filename), SDL_PIXELFORMAT_RGB24, 0);
|
||||
if (!original) {
|
||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't load %s: %s\n", filename, SDL_GetError());
|
||||
return 3;
|
||||
}
|
||||
|
||||
raw_yuv = SDL_calloc(1, MAX_YUV_SURFACE_SIZE(original->w, original->h, 0));
|
||||
ConvertRGBtoYUV(yuv_format, original->pixels, original->pitch, raw_yuv, original->w, original->h,
|
||||
SDL_GetYUVConversionModeForResolution(original->w, original->h),
|
||||
0, 100);
|
||||
pitch = CalculateYUVPitch(yuv_format, original->w);
|
||||
|
||||
converted = SDL_CreateRGBSurfaceWithFormat(0, original->w, original->h, 0, rgb_format);
|
||||
if (!converted) {
|
||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't create converted surface: %s\n", SDL_GetError());
|
||||
return 3;
|
||||
}
|
||||
|
||||
then = SDL_GetTicks();
|
||||
for ( i = 0; i < iterations; ++i ) {
|
||||
SDL_ConvertPixels(original->w, original->h, yuv_format, raw_yuv, pitch, rgb_format, converted->pixels, converted->pitch);
|
||||
}
|
||||
now = SDL_GetTicks();
|
||||
SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION, "%d iterations in %d ms, %.2fms each\n", iterations, (now - then), (float)(now - then)/iterations);
|
||||
|
||||
window = SDL_CreateWindow("YUV test",
|
||||
SDL_WINDOWPOS_UNDEFINED,
|
||||
SDL_WINDOWPOS_UNDEFINED,
|
||||
original->w, original->h,
|
||||
0);
|
||||
if (!window) {
|
||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't create window: %s\n", SDL_GetError());
|
||||
return 4;
|
||||
}
|
||||
|
||||
renderer = SDL_CreateRenderer(window, -1, 0);
|
||||
if (!renderer) {
|
||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't create renderer: %s\n", SDL_GetError());
|
||||
return 4;
|
||||
}
|
||||
|
||||
output[0] = SDL_CreateTextureFromSurface(renderer, original);
|
||||
output[1] = SDL_CreateTextureFromSurface(renderer, converted);
|
||||
output[2] = SDL_CreateTexture(renderer, yuv_format, SDL_TEXTUREACCESS_STREAMING, original->w, original->h);
|
||||
if (!output[0] || !output[1] || !output[2]) {
|
||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't set create texture: %s\n", SDL_GetError());
|
||||
return 5;
|
||||
}
|
||||
SDL_UpdateTexture(output[2], NULL, raw_yuv, pitch);
|
||||
|
||||
yuv_name = SDL_GetPixelFormatName(yuv_format);
|
||||
if (SDL_strncmp(yuv_name, "SDL_PIXELFORMAT_", 16) == 0) {
|
||||
yuv_name += 16;
|
||||
}
|
||||
|
||||
switch (SDL_GetYUVConversionModeForResolution(original->w, original->h)) {
|
||||
case SDL_YUV_CONVERSION_JPEG:
|
||||
yuv_mode = "JPEG";
|
||||
break;
|
||||
case SDL_YUV_CONVERSION_BT601:
|
||||
yuv_mode = "BT.601";
|
||||
break;
|
||||
case SDL_YUV_CONVERSION_BT709:
|
||||
yuv_mode = "BT.709";
|
||||
break;
|
||||
default:
|
||||
yuv_mode = "UNKNOWN";
|
||||
break;
|
||||
}
|
||||
|
||||
{ int done = 0;
|
||||
while ( !done )
|
||||
{
|
||||
SDL_Event event;
|
||||
while (SDL_PollEvent(&event) > 0) {
|
||||
if (event.type == SDL_QUIT) {
|
||||
done = 1;
|
||||
}
|
||||
if (event.type == SDL_KEYDOWN) {
|
||||
if (event.key.keysym.sym == SDLK_ESCAPE) {
|
||||
done = 1;
|
||||
} else if (event.key.keysym.sym == SDLK_LEFT) {
|
||||
--current;
|
||||
} else if (event.key.keysym.sym == SDLK_RIGHT) {
|
||||
++current;
|
||||
}
|
||||
}
|
||||
if (event.type == SDL_MOUSEBUTTONDOWN) {
|
||||
if (event.button.x < (original->w/2)) {
|
||||
--current;
|
||||
} else {
|
||||
++current;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Handle wrapping */
|
||||
if (current < 0) {
|
||||
current += SDL_arraysize(output);
|
||||
}
|
||||
if (current >= SDL_arraysize(output)) {
|
||||
current -= SDL_arraysize(output);
|
||||
}
|
||||
|
||||
SDL_RenderClear(renderer);
|
||||
SDL_RenderCopy(renderer, output[current], NULL, NULL);
|
||||
SDL_SetRenderDrawColor(renderer, 0xFF, 0xFF, 0xFF, 0xFF);
|
||||
if (current == 0) {
|
||||
SDLTest_DrawString(renderer, 4, 4, titles[current]);
|
||||
} else {
|
||||
SDL_snprintf(title, sizeof(title), "%s %s %s", titles[current], yuv_name, yuv_mode);
|
||||
SDLTest_DrawString(renderer, 4, 4, title);
|
||||
}
|
||||
SDL_RenderPresent(renderer);
|
||||
SDL_Delay(10);
|
||||
}
|
||||
}
|
||||
SDL_Quit();
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* vi: set ts=4 sw=4 expandtab: */
|
|
@ -0,0 +1,300 @@
|
|||
/*
|
||||
Copyright (C) 1997-2017 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
arising from the use of this software.
|
||||
|
||||
Permission is granted to anyone to use this software for any purpose,
|
||||
including commercial applications, and to alter it and redistribute it
|
||||
freely.
|
||||
*/
|
||||
|
||||
#include "SDL.h"
|
||||
|
||||
#include "testyuv_cvt.h"
|
||||
|
||||
|
||||
static float clip3(float x, float y, float z)
|
||||
{
|
||||
return ((z < x) ? x : ((z > y) ? y : z));
|
||||
}
|
||||
|
||||
static void RGBtoYUV(Uint8 * rgb, int *yuv, SDL_YUV_CONVERSION_MODE mode, int monochrome, int luminance)
|
||||
{
|
||||
if (mode == SDL_YUV_CONVERSION_JPEG) {
|
||||
/* Full range YUV */
|
||||
yuv[0] = (int)(0.299 * rgb[0] + 0.587 * rgb[1] + 0.114 * rgb[2]);
|
||||
yuv[1] = (int)((rgb[2] - yuv[0]) * 0.565 + 128);
|
||||
yuv[2] = (int)((rgb[0] - yuv[0]) * 0.713 + 128);
|
||||
} else {
|
||||
// This formula is from Microsoft's documentation:
|
||||
// https://msdn.microsoft.com/en-us/library/windows/desktop/dd206750(v=vs.85).aspx
|
||||
// L = Kr * R + Kb * B + (1 - Kr - Kb) * G
|
||||
// Y = floor(2^(M-8) * (219*(L-Z)/S + 16) + 0.5);
|
||||
// U = clip3(0, (2^M)-1, floor(2^(M-8) * (112*(B-L) / ((1-Kb)*S) + 128) + 0.5));
|
||||
// V = clip3(0, (2^M)-1, floor(2^(M-8) * (112*(R-L) / ((1-Kr)*S) + 128) + 0.5));
|
||||
float S, Z, R, G, B, L, Kr, Kb, Y, U, V;
|
||||
|
||||
if (mode == SDL_YUV_CONVERSION_BT709) {
|
||||
/* BT.709 */
|
||||
Kr = 0.2126f;
|
||||
Kb = 0.0722f;
|
||||
} else {
|
||||
/* BT.601 */
|
||||
Kr = 0.299f;
|
||||
Kb = 0.114f;
|
||||
}
|
||||
|
||||
S = 255.0f;
|
||||
Z = 0.0f;
|
||||
R = rgb[0];
|
||||
G = rgb[1];
|
||||
B = rgb[2];
|
||||
L = Kr * R + Kb * B + (1 - Kr - Kb) * G;
|
||||
Y = (Uint8)SDL_floorf((219*(L-Z)/S + 16) + 0.5f);
|
||||
U = (Uint8)clip3(0, 255, SDL_floorf((112.0f*(B-L) / ((1.0f-Kb)*S) + 128) + 0.5f));
|
||||
V = (Uint8)clip3(0, 255, SDL_floorf((112.0f*(R-L) / ((1.0f-Kr)*S) + 128) + 0.5f));
|
||||
|
||||
yuv[0] = (Uint8)Y;
|
||||
yuv[1] = (Uint8)U;
|
||||
yuv[2] = (Uint8)V;
|
||||
}
|
||||
|
||||
if (monochrome) {
|
||||
yuv[1] = 128;
|
||||
yuv[2] = 128;
|
||||
}
|
||||
|
||||
if (luminance != 100) {
|
||||
yuv[0] = yuv[0] * luminance / 100;
|
||||
if (yuv[0] > 255)
|
||||
yuv[0] = 255;
|
||||
}
|
||||
}
|
||||
|
||||
static void ConvertRGBtoPlanar2x2(Uint32 format, Uint8 *src, int pitch, Uint8 *out, int w, int h, SDL_YUV_CONVERSION_MODE mode, int monochrome, int luminance)
|
||||
{
|
||||
int x, y;
|
||||
int yuv[4][3];
|
||||
Uint8 *Y1, *Y2, *U, *V;
|
||||
Uint8 *rgb1, *rgb2;
|
||||
int rgb_row_advance = (pitch - w*3) + pitch;
|
||||
int UV_advance;
|
||||
|
||||
rgb1 = src;
|
||||
rgb2 = src + pitch;
|
||||
|
||||
Y1 = out;
|
||||
Y2 = Y1 + w;
|
||||
switch (format) {
|
||||
case SDL_PIXELFORMAT_YV12:
|
||||
V = (Y1 + h * w);
|
||||
U = V + ((h + 1)/2)*((w + 1)/2);
|
||||
UV_advance = 1;
|
||||
break;
|
||||
case SDL_PIXELFORMAT_IYUV:
|
||||
U = (Y1 + h * w);
|
||||
V = U + ((h + 1)/2)*((w + 1)/2);
|
||||
UV_advance = 1;
|
||||
break;
|
||||
case SDL_PIXELFORMAT_NV12:
|
||||
U = (Y1 + h * w);
|
||||
V = U + 1;
|
||||
UV_advance = 2;
|
||||
break;
|
||||
case SDL_PIXELFORMAT_NV21:
|
||||
V = (Y1 + h * w);
|
||||
U = V + 1;
|
||||
UV_advance = 2;
|
||||
break;
|
||||
default:
|
||||
SDL_assert(!"Unsupported planar YUV format");
|
||||
return;
|
||||
}
|
||||
|
||||
for (y = 0; y < (h - 1); y += 2) {
|
||||
for (x = 0; x < (w - 1); x += 2) {
|
||||
RGBtoYUV(rgb1, yuv[0], mode, monochrome, luminance);
|
||||
rgb1 += 3;
|
||||
*Y1++ = (Uint8)yuv[0][0];
|
||||
|
||||
RGBtoYUV(rgb1, yuv[1], mode, monochrome, luminance);
|
||||
rgb1 += 3;
|
||||
*Y1++ = (Uint8)yuv[1][0];
|
||||
|
||||
RGBtoYUV(rgb2, yuv[2], mode, monochrome, luminance);
|
||||
rgb2 += 3;
|
||||
*Y2++ = (Uint8)yuv[2][0];
|
||||
|
||||
RGBtoYUV(rgb2, yuv[3], mode, monochrome, luminance);
|
||||
rgb2 += 3;
|
||||
*Y2++ = (Uint8)yuv[3][0];
|
||||
|
||||
*U = (Uint8)SDL_floorf((yuv[0][1] + yuv[1][1] + yuv[2][1] + yuv[3][1])/4.0f + 0.5f);
|
||||
U += UV_advance;
|
||||
|
||||
*V = (Uint8)SDL_floorf((yuv[0][2] + yuv[1][2] + yuv[2][2] + yuv[3][2])/4.0f + 0.5f);
|
||||
V += UV_advance;
|
||||
}
|
||||
/* Last column */
|
||||
if (x == (w - 1)) {
|
||||
RGBtoYUV(rgb1, yuv[0], mode, monochrome, luminance);
|
||||
rgb1 += 3;
|
||||
*Y1++ = (Uint8)yuv[0][0];
|
||||
|
||||
RGBtoYUV(rgb2, yuv[2], mode, monochrome, luminance);
|
||||
rgb2 += 3;
|
||||
*Y2++ = (Uint8)yuv[2][0];
|
||||
|
||||
*U = (Uint8)SDL_floorf((yuv[0][1] + yuv[2][1])/2.0f + 0.5f);
|
||||
U += UV_advance;
|
||||
|
||||
*V = (Uint8)SDL_floorf((yuv[0][2] + yuv[2][2])/2.0f + 0.5f);
|
||||
V += UV_advance;
|
||||
}
|
||||
Y1 += w;
|
||||
Y2 += w;
|
||||
rgb1 += rgb_row_advance;
|
||||
rgb2 += rgb_row_advance;
|
||||
}
|
||||
/* Last row */
|
||||
if (y == (h - 1)) {
|
||||
for (x = 0; x < (w - 1); x += 2) {
|
||||
RGBtoYUV(rgb1, yuv[0], mode, monochrome, luminance);
|
||||
rgb1 += 3;
|
||||
*Y1++ = (Uint8)yuv[0][0];
|
||||
|
||||
RGBtoYUV(rgb1, yuv[1], mode, monochrome, luminance);
|
||||
rgb1 += 3;
|
||||
*Y1++ = (Uint8)yuv[1][0];
|
||||
|
||||
*U = (Uint8)SDL_floorf((yuv[0][1] + yuv[1][1])/2.0f + 0.5f);
|
||||
U += UV_advance;
|
||||
|
||||
*V = (Uint8)SDL_floorf((yuv[0][2] + yuv[1][2])/2.0f + 0.5f);
|
||||
V += UV_advance;
|
||||
}
|
||||
/* Last column */
|
||||
if (x == (w - 1)) {
|
||||
RGBtoYUV(rgb1, yuv[0], mode, monochrome, luminance);
|
||||
*Y1++ = (Uint8)yuv[0][0];
|
||||
|
||||
*U = (Uint8)yuv[0][1];
|
||||
U += UV_advance;
|
||||
|
||||
*V = (Uint8)yuv[0][2];
|
||||
V += UV_advance;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void ConvertRGBtoPacked4(Uint32 format, Uint8 *src, int pitch, Uint8 *out, int w, int h, SDL_YUV_CONVERSION_MODE mode, int monochrome, int luminance)
|
||||
{
|
||||
int x, y;
|
||||
int yuv[2][3];
|
||||
Uint8 *Y1, *Y2, *U, *V;
|
||||
Uint8 *rgb;
|
||||
int rgb_row_advance = (pitch - w*3);
|
||||
|
||||
rgb = src;
|
||||
|
||||
switch (format) {
|
||||
case SDL_PIXELFORMAT_YUY2:
|
||||
Y1 = out;
|
||||
U = out+1;
|
||||
Y2 = out+2;
|
||||
V = out+3;
|
||||
break;
|
||||
case SDL_PIXELFORMAT_UYVY:
|
||||
U = out;
|
||||
Y1 = out+1;
|
||||
V = out+2;
|
||||
Y2 = out+3;
|
||||
break;
|
||||
case SDL_PIXELFORMAT_YVYU:
|
||||
Y1 = out;
|
||||
V = out+1;
|
||||
Y2 = out+2;
|
||||
U = out+3;
|
||||
break;
|
||||
default:
|
||||
SDL_assert(!"Unsupported packed YUV format");
|
||||
return;
|
||||
}
|
||||
|
||||
for (y = 0; y < h; ++y) {
|
||||
for (x = 0; x < (w - 1); x += 2) {
|
||||
RGBtoYUV(rgb, yuv[0], mode, monochrome, luminance);
|
||||
rgb += 3;
|
||||
*Y1 = (Uint8)yuv[0][0];
|
||||
Y1 += 4;
|
||||
|
||||
RGBtoYUV(rgb, yuv[1], mode, monochrome, luminance);
|
||||
rgb += 3;
|
||||
*Y2 = (Uint8)yuv[1][0];
|
||||
Y2 += 4;
|
||||
|
||||
*U = (Uint8)SDL_floorf((yuv[0][1] + yuv[1][1])/2.0f + 0.5f);
|
||||
U += 4;
|
||||
|
||||
*V = (Uint8)SDL_floorf((yuv[0][2] + yuv[1][2])/2.0f + 0.5f);
|
||||
V += 4;
|
||||
}
|
||||
/* Last column */
|
||||
if (x == (w - 1)) {
|
||||
RGBtoYUV(rgb, yuv[0], mode, monochrome, luminance);
|
||||
rgb += 3;
|
||||
*Y2 = *Y1 = (Uint8)yuv[0][0];
|
||||
Y1 += 4;
|
||||
Y2 += 4;
|
||||
|
||||
*U = (Uint8)yuv[0][1];
|
||||
U += 4;
|
||||
|
||||
*V = (Uint8)yuv[0][2];
|
||||
V += 4;
|
||||
}
|
||||
rgb += rgb_row_advance;
|
||||
}
|
||||
}
|
||||
|
||||
SDL_bool ConvertRGBtoYUV(Uint32 format, Uint8 *src, int pitch, Uint8 *out, int w, int h, SDL_YUV_CONVERSION_MODE mode, int monochrome, int luminance)
|
||||
{
|
||||
switch (format)
|
||||
{
|
||||
case SDL_PIXELFORMAT_YV12:
|
||||
case SDL_PIXELFORMAT_IYUV:
|
||||
case SDL_PIXELFORMAT_NV12:
|
||||
case SDL_PIXELFORMAT_NV21:
|
||||
ConvertRGBtoPlanar2x2(format, src, pitch, out, w, h, mode, monochrome, luminance);
|
||||
return SDL_TRUE;
|
||||
case SDL_PIXELFORMAT_YUY2:
|
||||
case SDL_PIXELFORMAT_UYVY:
|
||||
case SDL_PIXELFORMAT_YVYU:
|
||||
ConvertRGBtoPacked4(format, src, pitch, out, w, h, mode, monochrome, luminance);
|
||||
return SDL_TRUE;
|
||||
default:
|
||||
return SDL_FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
int CalculateYUVPitch(Uint32 format, int width)
|
||||
{
|
||||
switch (format)
|
||||
{
|
||||
case SDL_PIXELFORMAT_YV12:
|
||||
case SDL_PIXELFORMAT_IYUV:
|
||||
case SDL_PIXELFORMAT_NV12:
|
||||
case SDL_PIXELFORMAT_NV21:
|
||||
return width;
|
||||
case SDL_PIXELFORMAT_YUY2:
|
||||
case SDL_PIXELFORMAT_UYVY:
|
||||
case SDL_PIXELFORMAT_YVYU:
|
||||
return 4*((width + 1)/2);
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
/* vi: set ts=4 sw=4 expandtab: */
|
|
@ -0,0 +1,16 @@
|
|||
/*
|
||||
Copyright (C) 1997-2017 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
arising from the use of this software.
|
||||
|
||||
Permission is granted to anyone to use this software for any purpose,
|
||||
including commercial applications, and to alter it and redistribute it
|
||||
freely.
|
||||
*/
|
||||
|
||||
/* These functions are designed for testing correctness, not for speed */
|
||||
|
||||
extern SDL_bool ConvertRGBtoYUV(Uint32 format, Uint8 *src, int pitch, Uint8 *out, int w, int h, SDL_YUV_CONVERSION_MODE mode, int monochrome, int luminance);
|
||||
extern int CalculateYUVPitch(Uint32 format, int width);
|
Loading…
Reference in New Issue