mirror of
https://github.com/hrydgard/ppsspp.git
synced 2024-10-08 03:13:25 +00:00
Add a 2x2 downsampled version of 4xBRZ as 2xBRZ (save memory bandwidth)
fmt
This commit is contained in:
parent
7e097084a6
commit
10db19efc4
@ -15,7 +15,8 @@
|
|||||||
// Mostly useful for profiling texture uploads currently, but could be useful for
|
// Mostly useful for profiling texture uploads currently, but could be useful for
|
||||||
// other things as well. We also have a nice integrated render pass profiler in the queue
|
// other things as well. We also have a nice integrated render pass profiler in the queue
|
||||||
// runner, but this one is more convenient for transient events.
|
// runner, but this one is more convenient for transient events.
|
||||||
// #define VULKAN_PROFILER_ENABLED
|
|
||||||
|
#define VULKAN_PROFILER_ENABLED
|
||||||
|
|
||||||
#if defined(VULKAN_PROFILER_ENABLED)
|
#if defined(VULKAN_PROFILER_ENABLED)
|
||||||
#define VK_PROFILE_BEGIN(vulkan, cmd, stage, message) vulkan->GetProfiler()->Begin(cmd, stage, message);
|
#define VK_PROFILE_BEGIN(vulkan, cmd, stage, message) vulkan->GetProfiler()->Begin(cmd, stage, message);
|
||||||
|
@ -664,6 +664,50 @@
|
|||||||
<Project>{4328a62c-f1e9-47ed-b816-a1a81daf4363}</Project>
|
<Project>{4328a62c-f1e9-47ed-b816-a1a81daf4363}</Project>
|
||||||
</ProjectReference>
|
</ProjectReference>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<FxCompile Include="..\assets\shaders\tex_2xbrz.csh">
|
||||||
|
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
|
||||||
|
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
|
||||||
|
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'">true</ExcludedFromBuild>
|
||||||
|
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'">true</ExcludedFromBuild>
|
||||||
|
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">true</ExcludedFromBuild>
|
||||||
|
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">true</ExcludedFromBuild>
|
||||||
|
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
|
||||||
|
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
|
||||||
|
</FxCompile>
|
||||||
|
<FxCompile Include="..\assets\shaders\tex_4xbrz.csh">
|
||||||
|
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
|
||||||
|
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
|
||||||
|
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'">true</ExcludedFromBuild>
|
||||||
|
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'">true</ExcludedFromBuild>
|
||||||
|
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">true</ExcludedFromBuild>
|
||||||
|
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">true</ExcludedFromBuild>
|
||||||
|
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
|
||||||
|
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
|
||||||
|
</FxCompile>
|
||||||
|
<FxCompile Include="..\assets\shaders\tex_mmpx.csh">
|
||||||
|
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
|
||||||
|
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
|
||||||
|
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'">true</ExcludedFromBuild>
|
||||||
|
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'">true</ExcludedFromBuild>
|
||||||
|
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">true</ExcludedFromBuild>
|
||||||
|
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">true</ExcludedFromBuild>
|
||||||
|
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
|
||||||
|
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
|
||||||
|
</FxCompile>
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<None Include="..\assets\shaders\defaultshaders.ini">
|
||||||
|
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
|
||||||
|
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
|
||||||
|
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'">true</ExcludedFromBuild>
|
||||||
|
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'">true</ExcludedFromBuild>
|
||||||
|
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">true</ExcludedFromBuild>
|
||||||
|
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">true</ExcludedFromBuild>
|
||||||
|
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
|
||||||
|
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
|
||||||
|
</None>
|
||||||
|
</ItemGroup>
|
||||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||||
<ImportGroup Label="ExtensionTargets">
|
<ImportGroup Label="ExtensionTargets">
|
||||||
</ImportGroup>
|
</ImportGroup>
|
||||||
|
@ -22,6 +22,9 @@
|
|||||||
<Filter Include="D3D11">
|
<Filter Include="D3D11">
|
||||||
<UniqueIdentifier>{88eb5cea-ec25-4881-89da-02f9f2fa8f3f}</UniqueIdentifier>
|
<UniqueIdentifier>{88eb5cea-ec25-4881-89da-02f9f2fa8f3f}</UniqueIdentifier>
|
||||||
</Filter>
|
</Filter>
|
||||||
|
<Filter Include="Shaders">
|
||||||
|
<UniqueIdentifier>{3a7618ae-e254-406a-8ae5-590bb077d8a1}</UniqueIdentifier>
|
||||||
|
</Filter>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClInclude Include="Math3D.h">
|
<ClInclude Include="Math3D.h">
|
||||||
@ -552,4 +555,20 @@
|
|||||||
<Filter>Software</Filter>
|
<Filter>Software</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<FxCompile Include="..\assets\shaders\tex_4xbrz.csh">
|
||||||
|
<Filter>Shaders</Filter>
|
||||||
|
</FxCompile>
|
||||||
|
<FxCompile Include="..\assets\shaders\tex_mmpx.csh">
|
||||||
|
<Filter>Shaders</Filter>
|
||||||
|
</FxCompile>
|
||||||
|
<FxCompile Include="..\assets\shaders\tex_2xbrz.csh">
|
||||||
|
<Filter>Shaders</Filter>
|
||||||
|
</FxCompile>
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<None Include="..\assets\shaders\defaultshaders.ini">
|
||||||
|
<Filter>Shaders</Filter>
|
||||||
|
</None>
|
||||||
|
</ItemGroup>
|
||||||
</Project>
|
</Project>
|
@ -154,6 +154,12 @@ Name=PSP Color
|
|||||||
Author=hunterk, Pokefan531 (ported by jdgleaver)
|
Author=hunterk, Pokefan531 (ported by jdgleaver)
|
||||||
Fragment=psp_color.fsh
|
Fragment=psp_color.fsh
|
||||||
Vertex=fxaa.vsh
|
Vertex=fxaa.vsh
|
||||||
|
[Tex2xBRZ]
|
||||||
|
Type=Texture
|
||||||
|
Name=2xBRZ (2x)
|
||||||
|
Author=Hyllian
|
||||||
|
Compute=tex_2xbrz.csh
|
||||||
|
Scale=2
|
||||||
[Tex4xBRZ]
|
[Tex4xBRZ]
|
||||||
Type=Texture
|
Type=Texture
|
||||||
Name=4xBRZ (4x)
|
Name=4xBRZ (4x)
|
||||||
|
@ -18,8 +18,8 @@ float DistYCbCr(vec4 pixA, vec4 pixB) {
|
|||||||
// https://en.wikipedia.org/wiki/YCbCr#ITU-R_BT.2020_conversion
|
// https://en.wikipedia.org/wiki/YCbCr#ITU-R_BT.2020_conversion
|
||||||
const vec3 K = vec3(0.2627, 0.6780, 0.0593);
|
const vec3 K = vec3(0.2627, 0.6780, 0.0593);
|
||||||
const mat3 MATRIX = mat3(K,
|
const mat3 MATRIX = mat3(K,
|
||||||
-.5 * K.r / (1.0 - K.b), -.5 * K.g / (1.0 - K.b), .5,
|
-.5 * K.r / (1.0 - K.b), -.5 * K.g / (1.0 - K.b), .5,
|
||||||
.5, -.5 * K.g / (1.0 - K.r), -.5 * K.b / (1.0 - K.r));
|
.5, -.5 * K.g / (1.0 - K.r), -.5 * K.b / (1.0 - K.r));
|
||||||
vec4 diff = pixA - pixB;
|
vec4 diff = pixA - pixB;
|
||||||
vec3 YCbCr = diff.rgb * MATRIX;
|
vec3 YCbCr = diff.rgb * MATRIX;
|
||||||
YCbCr.x *= LUMINANCE_WEIGHT;
|
YCbCr.x *= LUMINANCE_WEIGHT;
|
||||||
@ -37,7 +37,7 @@ bool IsBlendingNeeded(const ivec4 blend) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
vec4 readInput(uvec2 coord) {
|
vec4 readInput(uvec2 coord) {
|
||||||
return readColorf(uvec2(clamp(coord.x, 0, params.width - 1), clamp(coord.y, 0, params.height - 1)));
|
return readColorf(uvec2(clamp(coord.x, 0, params.width - 1), clamp(coord.y, 0, params.height - 1)));
|
||||||
}
|
}
|
||||||
|
|
||||||
void applyScaling(uvec2 origxy) {
|
void applyScaling(uvec2 origxy) {
|
||||||
@ -67,22 +67,22 @@ void applyScaling(uvec2 origxy) {
|
|||||||
src[21] = readInput(t1.xw);
|
src[21] = readInput(t1.xw);
|
||||||
src[22] = readInput(t1.yw);
|
src[22] = readInput(t1.yw);
|
||||||
src[23] = readInput(t1.zw);
|
src[23] = readInput(t1.zw);
|
||||||
src[ 6] = readInput(t2.xw);
|
src[6] = readInput(t2.xw);
|
||||||
src[ 7] = readInput(t2.yw);
|
src[7] = readInput(t2.yw);
|
||||||
src[ 8] = readInput(t2.zw);
|
src[8] = readInput(t2.zw);
|
||||||
src[ 5] = readInput(t3.xw);
|
src[5] = readInput(t3.xw);
|
||||||
src[ 0] = readInput(t3.yw);
|
src[0] = readInput(t3.yw);
|
||||||
src[ 1] = readInput(t3.zw);
|
src[1] = readInput(t3.zw);
|
||||||
src[ 4] = readInput(t4.xw);
|
src[4] = readInput(t4.xw);
|
||||||
src[ 3] = readInput(t4.yw);
|
src[3] = readInput(t4.yw);
|
||||||
src[ 2] = readInput(t4.zw);
|
src[2] = readInput(t4.zw);
|
||||||
src[15] = readInput(t5.xw);
|
src[15] = readInput(t5.xw);
|
||||||
src[14] = readInput(t5.yw);
|
src[14] = readInput(t5.yw);
|
||||||
src[13] = readInput(t5.zw);
|
src[13] = readInput(t5.zw);
|
||||||
src[19] = readInput(t6.xy);
|
src[19] = readInput(t6.xy);
|
||||||
src[18] = readInput(t6.xz);
|
src[18] = readInput(t6.xz);
|
||||||
src[17] = readInput(t6.xw);
|
src[17] = readInput(t6.xw);
|
||||||
src[ 9] = readInput(t7.xy);
|
src[9] = readInput(t7.xy);
|
||||||
src[10] = readInput(t7.xz);
|
src[10] = readInput(t7.xz);
|
||||||
src[11] = readInput(t7.xw);
|
src[11] = readInput(t7.xw);
|
||||||
|
|
||||||
@ -106,9 +106,9 @@ void applyScaling(uvec2 origxy) {
|
|||||||
// --|04|03|02|11
|
// --|04|03|02|11
|
||||||
// --|--|14|13|--
|
// --|--|14|13|--
|
||||||
// Corner (1, 1)
|
// Corner (1, 1)
|
||||||
if ( ((v[0] == v[1] && v[3] == v[2]) || (v[0] == v[3] && v[1] == v[2])) == false) {
|
if (((v[0] == v[1] && v[3] == v[2]) || (v[0] == v[3] && v[1] == v[2])) == false) {
|
||||||
float dist_03_01 = DistYCbCr(src[ 4], src[ 0]) + DistYCbCr(src[ 0], src[ 8]) + DistYCbCr(src[14], src[ 2]) + DistYCbCr(src[ 2], src[10]) + (4.0 * DistYCbCr(src[ 3], src[ 1]));
|
float dist_03_01 = DistYCbCr(src[4], src[0]) + DistYCbCr(src[0], src[8]) + DistYCbCr(src[14], src[2]) + DistYCbCr(src[2], src[10]) + (4.0 * DistYCbCr(src[3], src[1]));
|
||||||
float dist_00_02 = DistYCbCr(src[ 5], src[ 3]) + DistYCbCr(src[ 3], src[13]) + DistYCbCr(src[ 7], src[ 1]) + DistYCbCr(src[ 1], src[11]) + (4.0 * DistYCbCr(src[ 0], src[ 2]));
|
float dist_00_02 = DistYCbCr(src[5], src[3]) + DistYCbCr(src[3], src[13]) + DistYCbCr(src[7], src[1]) + DistYCbCr(src[1], src[11]) + (4.0 * DistYCbCr(src[0], src[2]));
|
||||||
bool dominantGradient = (DOMINANT_DIRECTION_THRESHOLD * dist_03_01) < dist_00_02;
|
bool dominantGradient = (DOMINANT_DIRECTION_THRESHOLD * dist_03_01) < dist_00_02;
|
||||||
blendResult[2] = ((dist_03_01 < dist_00_02) && (v[0] != v[1]) && (v[0] != v[3])) ? ((dominantGradient) ? BLEND_DOMINANT : BLEND_NORMAL) : BLEND_NONE;
|
blendResult[2] = ((dist_03_01 < dist_00_02) && (v[0] != v[1]) && (v[0] != v[3])) ? ((dominantGradient) ? BLEND_DOMINANT : BLEND_NORMAL) : BLEND_NONE;
|
||||||
}
|
}
|
||||||
@ -119,9 +119,9 @@ void applyScaling(uvec2 origxy) {
|
|||||||
// 17|04|03|02|--
|
// 17|04|03|02|--
|
||||||
// --|15|14|--|--
|
// --|15|14|--|--
|
||||||
// Corner (0, 1)
|
// Corner (0, 1)
|
||||||
if ( ((v[5] == v[0] && v[4] == v[3]) || (v[5] == v[4] && v[0] == v[3])) == false) {
|
if (((v[5] == v[0] && v[4] == v[3]) || (v[5] == v[4] && v[0] == v[3])) == false) {
|
||||||
float dist_04_00 = DistYCbCr(src[17], src[ 5]) + DistYCbCr(src[ 5], src[ 7]) + DistYCbCr(src[15], src[ 3]) + DistYCbCr(src[ 3], src[ 1]) + (4.0 * DistYCbCr(src[ 4], src[ 0]));
|
float dist_04_00 = DistYCbCr(src[17], src[5]) + DistYCbCr(src[5], src[7]) + DistYCbCr(src[15], src[3]) + DistYCbCr(src[3], src[1]) + (4.0 * DistYCbCr(src[4], src[0]));
|
||||||
float dist_05_03 = DistYCbCr(src[18], src[ 4]) + DistYCbCr(src[ 4], src[14]) + DistYCbCr(src[ 6], src[ 0]) + DistYCbCr(src[ 0], src[ 2]) + (4.0 * DistYCbCr(src[ 5], src[ 3]));
|
float dist_05_03 = DistYCbCr(src[18], src[4]) + DistYCbCr(src[4], src[14]) + DistYCbCr(src[6], src[0]) + DistYCbCr(src[0], src[2]) + (4.0 * DistYCbCr(src[5], src[3]));
|
||||||
bool dominantGradient = (DOMINANT_DIRECTION_THRESHOLD * dist_05_03) < dist_04_00;
|
bool dominantGradient = (DOMINANT_DIRECTION_THRESHOLD * dist_05_03) < dist_04_00;
|
||||||
blendResult[3] = ((dist_04_00 > dist_05_03) && (v[0] != v[5]) && (v[0] != v[3])) ? ((dominantGradient) ? BLEND_DOMINANT : BLEND_NORMAL) : BLEND_NONE;
|
blendResult[3] = ((dist_04_00 > dist_05_03) && (v[0] != v[5]) && (v[0] != v[3])) ? ((dominantGradient) ? BLEND_DOMINANT : BLEND_NORMAL) : BLEND_NONE;
|
||||||
}
|
}
|
||||||
@ -132,9 +132,9 @@ void applyScaling(uvec2 origxy) {
|
|||||||
// --|--|03|02|--
|
// --|--|03|02|--
|
||||||
// --|--|--|--|--
|
// --|--|--|--|--
|
||||||
// Corner (1, 0)
|
// Corner (1, 0)
|
||||||
if ( ((v[7] == v[8] && v[0] == v[1]) || (v[7] == v[0] && v[8] == v[1])) == false) {
|
if (((v[7] == v[8] && v[0] == v[1]) || (v[7] == v[0] && v[8] == v[1])) == false) {
|
||||||
float dist_00_08 = DistYCbCr(src[ 5], src[ 7]) + DistYCbCr(src[ 7], src[23]) + DistYCbCr(src[ 3], src[ 1]) + DistYCbCr(src[ 1], src[ 9]) + (4.0 * DistYCbCr(src[ 0], src[ 8]));
|
float dist_00_08 = DistYCbCr(src[5], src[7]) + DistYCbCr(src[7], src[23]) + DistYCbCr(src[3], src[1]) + DistYCbCr(src[1], src[9]) + (4.0 * DistYCbCr(src[0], src[8]));
|
||||||
float dist_07_01 = DistYCbCr(src[ 6], src[ 0]) + DistYCbCr(src[ 0], src[ 2]) + DistYCbCr(src[22], src[ 8]) + DistYCbCr(src[ 8], src[10]) + (4.0 * DistYCbCr(src[ 7], src[ 1]));
|
float dist_07_01 = DistYCbCr(src[6], src[0]) + DistYCbCr(src[0], src[2]) + DistYCbCr(src[22], src[8]) + DistYCbCr(src[8], src[10]) + (4.0 * DistYCbCr(src[7], src[1]));
|
||||||
bool dominantGradient = (DOMINANT_DIRECTION_THRESHOLD * dist_07_01) < dist_00_08;
|
bool dominantGradient = (DOMINANT_DIRECTION_THRESHOLD * dist_07_01) < dist_00_08;
|
||||||
blendResult[1] = ((dist_00_08 > dist_07_01) && (v[0] != v[7]) && (v[0] != v[1])) ? ((dominantGradient) ? BLEND_DOMINANT : BLEND_NORMAL) : BLEND_NONE;
|
blendResult[1] = ((dist_00_08 > dist_07_01) && (v[0] != v[7]) && (v[0] != v[1])) ? ((dominantGradient) ? BLEND_DOMINANT : BLEND_NORMAL) : BLEND_NONE;
|
||||||
}
|
}
|
||||||
@ -145,24 +145,24 @@ void applyScaling(uvec2 origxy) {
|
|||||||
// --|04|03|--|--
|
// --|04|03|--|--
|
||||||
// --|--|--|--|--
|
// --|--|--|--|--
|
||||||
// Corner (0, 0)
|
// Corner (0, 0)
|
||||||
if ( ((v[6] == v[7] && v[5] == v[0]) || (v[6] == v[5] && v[7] == v[0])) == false) {
|
if (((v[6] == v[7] && v[5] == v[0]) || (v[6] == v[5] && v[7] == v[0])) == false) {
|
||||||
float dist_05_07 = DistYCbCr(src[18], src[ 6]) + DistYCbCr(src[ 6], src[22]) + DistYCbCr(src[ 4], src[ 0]) + DistYCbCr(src[ 0], src[ 8]) + (4.0 * DistYCbCr(src[ 5], src[ 7]));
|
float dist_05_07 = DistYCbCr(src[18], src[6]) + DistYCbCr(src[6], src[22]) + DistYCbCr(src[4], src[0]) + DistYCbCr(src[0], src[8]) + (4.0 * DistYCbCr(src[5], src[7]));
|
||||||
float dist_06_00 = DistYCbCr(src[19], src[ 5]) + DistYCbCr(src[ 5], src[ 3]) + DistYCbCr(src[21], src[ 7]) + DistYCbCr(src[ 7], src[ 1]) + (4.0 * DistYCbCr(src[ 6], src[ 0]));
|
float dist_06_00 = DistYCbCr(src[19], src[5]) + DistYCbCr(src[5], src[3]) + DistYCbCr(src[21], src[7]) + DistYCbCr(src[7], src[1]) + (4.0 * DistYCbCr(src[6], src[0]));
|
||||||
bool dominantGradient = (DOMINANT_DIRECTION_THRESHOLD * dist_05_07) < dist_06_00;
|
bool dominantGradient = (DOMINANT_DIRECTION_THRESHOLD * dist_05_07) < dist_06_00;
|
||||||
blendResult[0] = ((dist_05_07 < dist_06_00) && (v[0] != v[5]) && (v[0] != v[7])) ? ((dominantGradient) ? BLEND_DOMINANT : BLEND_NORMAL) : BLEND_NONE;
|
blendResult[0] = ((dist_05_07 < dist_06_00) && (v[0] != v[5]) && (v[0] != v[7])) ? ((dominantGradient) ? BLEND_DOMINANT : BLEND_NORMAL) : BLEND_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
vec4 dst[16];
|
vec4 dst[16];
|
||||||
dst[ 0] = src[0];
|
dst[0] = src[0];
|
||||||
dst[ 1] = src[0];
|
dst[1] = src[0];
|
||||||
dst[ 2] = src[0];
|
dst[2] = src[0];
|
||||||
dst[ 3] = src[0];
|
dst[3] = src[0];
|
||||||
dst[ 4] = src[0];
|
dst[4] = src[0];
|
||||||
dst[ 5] = src[0];
|
dst[5] = src[0];
|
||||||
dst[ 6] = src[0];
|
dst[6] = src[0];
|
||||||
dst[ 7] = src[0];
|
dst[7] = src[0];
|
||||||
dst[ 8] = src[0];
|
dst[8] = src[0];
|
||||||
dst[ 9] = src[0];
|
dst[9] = src[0];
|
||||||
dst[10] = src[0];
|
dst[10] = src[0];
|
||||||
dst[11] = src[0];
|
dst[11] = src[0];
|
||||||
dst[12] = src[0];
|
dst[12] = src[0];
|
||||||
@ -175,16 +175,16 @@ void applyScaling(uvec2 origxy) {
|
|||||||
float dist_01_04 = DistYCbCr(src[1], src[4]);
|
float dist_01_04 = DistYCbCr(src[1], src[4]);
|
||||||
float dist_03_08 = DistYCbCr(src[3], src[8]);
|
float dist_03_08 = DistYCbCr(src[3], src[8]);
|
||||||
bool haveShallowLine = (STEEP_DIRECTION_THRESHOLD * dist_01_04 <= dist_03_08) && (v[0] != v[4]) && (v[5] != v[4]);
|
bool haveShallowLine = (STEEP_DIRECTION_THRESHOLD * dist_01_04 <= dist_03_08) && (v[0] != v[4]) && (v[5] != v[4]);
|
||||||
bool haveSteepLine = (STEEP_DIRECTION_THRESHOLD * dist_03_08 <= dist_01_04) && (v[0] != v[8]) && (v[7] != v[8]);
|
bool haveSteepLine = (STEEP_DIRECTION_THRESHOLD * dist_03_08 <= dist_01_04) && (v[0] != v[8]) && (v[7] != v[8]);
|
||||||
bool needBlend = (blendResult[2] != BLEND_NONE);
|
bool needBlend = (blendResult[2] != BLEND_NONE);
|
||||||
bool doLineBlend = ( blendResult[2] >= BLEND_DOMINANT ||
|
bool doLineBlend = (blendResult[2] >= BLEND_DOMINANT ||
|
||||||
((blendResult[1] != BLEND_NONE && !IsPixEqual(src[0], src[4])) ||
|
((blendResult[1] != BLEND_NONE && !IsPixEqual(src[0], src[4])) ||
|
||||||
(blendResult[3] != BLEND_NONE && !IsPixEqual(src[0], src[8])) ||
|
(blendResult[3] != BLEND_NONE && !IsPixEqual(src[0], src[8])) ||
|
||||||
(IsPixEqual(src[4], src[3]) && IsPixEqual(src[3], src[2]) && IsPixEqual(src[2], src[1]) && IsPixEqual(src[1], src[8]) && IsPixEqual(src[0], src[2]) == false) ) == false );
|
(IsPixEqual(src[4], src[3]) && IsPixEqual(src[3], src[2]) && IsPixEqual(src[2], src[1]) && IsPixEqual(src[1], src[8]) && IsPixEqual(src[0], src[2]) == false)) == false);
|
||||||
|
|
||||||
vec4 blendPix = ( DistYCbCr(src[0], src[1]) <= DistYCbCr(src[0], src[3]) ) ? src[1] : src[3];
|
vec4 blendPix = (DistYCbCr(src[0], src[1]) <= DistYCbCr(src[0], src[3])) ? src[1] : src[3];
|
||||||
dst[ 2] = mix(dst[ 2], blendPix, (needBlend && doLineBlend) ? ((haveShallowLine) ? ((haveSteepLine) ? 1.0/3.0 : 0.25) : ((haveSteepLine) ? 0.25 : 0.00)) : 0.00);
|
dst[2] = mix(dst[2], blendPix, (needBlend && doLineBlend) ? ((haveShallowLine) ? ((haveSteepLine) ? 1.0 / 3.0 : 0.25) : ((haveSteepLine) ? 0.25 : 0.00)) : 0.00);
|
||||||
dst[ 9] = mix(dst[ 9], blendPix, (needBlend && doLineBlend && haveSteepLine) ? 0.25 : 0.00);
|
dst[9] = mix(dst[9], blendPix, (needBlend && doLineBlend && haveSteepLine) ? 0.25 : 0.00);
|
||||||
dst[10] = mix(dst[10], blendPix, (needBlend && doLineBlend && haveSteepLine) ? 0.75 : 0.00);
|
dst[10] = mix(dst[10], blendPix, (needBlend && doLineBlend && haveSteepLine) ? 0.75 : 0.00);
|
||||||
dst[11] = mix(dst[11], blendPix, (needBlend) ? ((doLineBlend) ? ((haveSteepLine) ? 1.00 : ((haveShallowLine) ? 0.75 : 0.50)) : 0.08677704501) : 0.00);
|
dst[11] = mix(dst[11], blendPix, (needBlend) ? ((doLineBlend) ? ((haveSteepLine) ? 1.00 : ((haveShallowLine) ? 0.75 : 0.50)) : 0.08677704501) : 0.00);
|
||||||
dst[12] = mix(dst[12], blendPix, (needBlend) ? ((doLineBlend) ? 1.00 : 0.6848532563) : 0.00);
|
dst[12] = mix(dst[12], blendPix, (needBlend) ? ((doLineBlend) ? 1.00 : 0.6848532563) : 0.00);
|
||||||
@ -195,19 +195,19 @@ void applyScaling(uvec2 origxy) {
|
|||||||
dist_01_04 = DistYCbCr(src[7], src[2]);
|
dist_01_04 = DistYCbCr(src[7], src[2]);
|
||||||
dist_03_08 = DistYCbCr(src[1], src[6]);
|
dist_03_08 = DistYCbCr(src[1], src[6]);
|
||||||
haveShallowLine = (STEEP_DIRECTION_THRESHOLD * dist_01_04 <= dist_03_08) && (v[0] != v[2]) && (v[3] != v[2]);
|
haveShallowLine = (STEEP_DIRECTION_THRESHOLD * dist_01_04 <= dist_03_08) && (v[0] != v[2]) && (v[3] != v[2]);
|
||||||
haveSteepLine = (STEEP_DIRECTION_THRESHOLD * dist_03_08 <= dist_01_04) && (v[0] != v[6]) && (v[5] != v[6]);
|
haveSteepLine = (STEEP_DIRECTION_THRESHOLD * dist_03_08 <= dist_01_04) && (v[0] != v[6]) && (v[5] != v[6]);
|
||||||
needBlend = (blendResult[1] != BLEND_NONE);
|
needBlend = (blendResult[1] != BLEND_NONE);
|
||||||
doLineBlend = ( blendResult[1] >= BLEND_DOMINANT ||
|
doLineBlend = (blendResult[1] >= BLEND_DOMINANT ||
|
||||||
!((blendResult[0] != BLEND_NONE && !IsPixEqual(src[0], src[2])) ||
|
!((blendResult[0] != BLEND_NONE && !IsPixEqual(src[0], src[2])) ||
|
||||||
(blendResult[2] != BLEND_NONE && !IsPixEqual(src[0], src[6])) ||
|
(blendResult[2] != BLEND_NONE && !IsPixEqual(src[0], src[6])) ||
|
||||||
(IsPixEqual(src[2], src[1]) && IsPixEqual(src[1], src[8]) && IsPixEqual(src[8], src[7]) && IsPixEqual(src[7], src[6]) && !IsPixEqual(src[0], src[8])) ) );
|
(IsPixEqual(src[2], src[1]) && IsPixEqual(src[1], src[8]) && IsPixEqual(src[8], src[7]) && IsPixEqual(src[7], src[6]) && !IsPixEqual(src[0], src[8]))));
|
||||||
|
|
||||||
blendPix = ( DistYCbCr(src[0], src[7]) <= DistYCbCr(src[0], src[1]) ) ? src[7] : src[1];
|
blendPix = (DistYCbCr(src[0], src[7]) <= DistYCbCr(src[0], src[1])) ? src[7] : src[1];
|
||||||
dst[ 1] = mix(dst[ 1], blendPix, (needBlend && doLineBlend) ? ((haveShallowLine) ? ((haveSteepLine) ? 1.0/3.0 : 0.25) : ((haveSteepLine) ? 0.25 : 0.00)) : 0.00);
|
dst[1] = mix(dst[1], blendPix, (needBlend && doLineBlend) ? ((haveShallowLine) ? ((haveSteepLine) ? 1.0 / 3.0 : 0.25) : ((haveSteepLine) ? 0.25 : 0.00)) : 0.00);
|
||||||
dst[ 6] = mix(dst[ 6], blendPix, (needBlend && doLineBlend && haveSteepLine) ? 0.25 : 0.00);
|
dst[6] = mix(dst[6], blendPix, (needBlend && doLineBlend && haveSteepLine) ? 0.25 : 0.00);
|
||||||
dst[ 7] = mix(dst[ 7], blendPix, (needBlend && doLineBlend && haveSteepLine) ? 0.75 : 0.00);
|
dst[7] = mix(dst[7], blendPix, (needBlend && doLineBlend && haveSteepLine) ? 0.75 : 0.00);
|
||||||
dst[ 8] = mix(dst[ 8], blendPix, (needBlend) ? ((doLineBlend) ? ((haveSteepLine) ? 1.00 : ((haveShallowLine) ? 0.75 : 0.50)) : 0.08677704501) : 0.00);
|
dst[8] = mix(dst[8], blendPix, (needBlend) ? ((doLineBlend) ? ((haveSteepLine) ? 1.00 : ((haveShallowLine) ? 0.75 : 0.50)) : 0.08677704501) : 0.00);
|
||||||
dst[ 9] = mix(dst[ 9], blendPix, (needBlend) ? ((doLineBlend) ? 1.00 : 0.6848532563) : 0.00);
|
dst[9] = mix(dst[9], blendPix, (needBlend) ? ((doLineBlend) ? 1.00 : 0.6848532563) : 0.00);
|
||||||
dst[10] = mix(dst[10], blendPix, (needBlend) ? ((doLineBlend) ? ((haveShallowLine) ? 1.00 : ((haveSteepLine) ? 0.75 : 0.50)) : 0.08677704501) : 0.00);
|
dst[10] = mix(dst[10], blendPix, (needBlend) ? ((doLineBlend) ? ((haveShallowLine) ? 1.00 : ((haveSteepLine) ? 0.75 : 0.50)) : 0.08677704501) : 0.00);
|
||||||
dst[11] = mix(dst[11], blendPix, (needBlend && doLineBlend && haveShallowLine) ? 0.75 : 0.00);
|
dst[11] = mix(dst[11], blendPix, (needBlend && doLineBlend && haveShallowLine) ? 0.75 : 0.00);
|
||||||
dst[12] = mix(dst[12], blendPix, (needBlend && doLineBlend && haveShallowLine) ? 0.25 : 0.00);
|
dst[12] = mix(dst[12], blendPix, (needBlend && doLineBlend && haveShallowLine) ? 0.25 : 0.00);
|
||||||
@ -215,42 +215,42 @@ void applyScaling(uvec2 origxy) {
|
|||||||
dist_01_04 = DistYCbCr(src[5], src[8]);
|
dist_01_04 = DistYCbCr(src[5], src[8]);
|
||||||
dist_03_08 = DistYCbCr(src[7], src[4]);
|
dist_03_08 = DistYCbCr(src[7], src[4]);
|
||||||
haveShallowLine = (STEEP_DIRECTION_THRESHOLD * dist_01_04 <= dist_03_08) && (v[0] != v[8]) && (v[1] != v[8]);
|
haveShallowLine = (STEEP_DIRECTION_THRESHOLD * dist_01_04 <= dist_03_08) && (v[0] != v[8]) && (v[1] != v[8]);
|
||||||
haveSteepLine = (STEEP_DIRECTION_THRESHOLD * dist_03_08 <= dist_01_04) && (v[0] != v[4]) && (v[3] != v[4]);
|
haveSteepLine = (STEEP_DIRECTION_THRESHOLD * dist_03_08 <= dist_01_04) && (v[0] != v[4]) && (v[3] != v[4]);
|
||||||
needBlend = (blendResult[0] != BLEND_NONE);
|
needBlend = (blendResult[0] != BLEND_NONE);
|
||||||
doLineBlend = ( blendResult[0] >= BLEND_DOMINANT ||
|
doLineBlend = (blendResult[0] >= BLEND_DOMINANT ||
|
||||||
!((blendResult[3] != BLEND_NONE && !IsPixEqual(src[0], src[8])) ||
|
!((blendResult[3] != BLEND_NONE && !IsPixEqual(src[0], src[8])) ||
|
||||||
(blendResult[1] != BLEND_NONE && !IsPixEqual(src[0], src[4])) ||
|
(blendResult[1] != BLEND_NONE && !IsPixEqual(src[0], src[4])) ||
|
||||||
(IsPixEqual(src[8], src[7]) && IsPixEqual(src[7], src[6]) && IsPixEqual(src[6], src[5]) && IsPixEqual(src[5], src[4]) && !IsPixEqual(src[0], src[6])) ) );
|
(IsPixEqual(src[8], src[7]) && IsPixEqual(src[7], src[6]) && IsPixEqual(src[6], src[5]) && IsPixEqual(src[5], src[4]) && !IsPixEqual(src[0], src[6]))));
|
||||||
|
|
||||||
blendPix = ( DistYCbCr(src[0], src[5]) <= DistYCbCr(src[0], src[7]) ) ? src[5] : src[7];
|
blendPix = (DistYCbCr(src[0], src[5]) <= DistYCbCr(src[0], src[7])) ? src[5] : src[7];
|
||||||
dst[ 0] = mix(dst[ 0], blendPix, (needBlend && doLineBlend) ? ((haveShallowLine) ? ((haveSteepLine) ? 1.0/3.0 : 0.25) : ((haveSteepLine) ? 0.25 : 0.00)) : 0.00);
|
dst[0] = mix(dst[0], blendPix, (needBlend && doLineBlend) ? ((haveShallowLine) ? ((haveSteepLine) ? 1.0 / 3.0 : 0.25) : ((haveSteepLine) ? 0.25 : 0.00)) : 0.00);
|
||||||
dst[15] = mix(dst[15], blendPix, (needBlend && doLineBlend && haveSteepLine) ? 0.25 : 0.00);
|
dst[15] = mix(dst[15], blendPix, (needBlend && doLineBlend && haveSteepLine) ? 0.25 : 0.00);
|
||||||
dst[ 4] = mix(dst[ 4], blendPix, (needBlend && doLineBlend && haveSteepLine) ? 0.75 : 0.00);
|
dst[4] = mix(dst[4], blendPix, (needBlend && doLineBlend && haveSteepLine) ? 0.75 : 0.00);
|
||||||
dst[ 5] = mix(dst[ 5], blendPix, (needBlend) ? ((doLineBlend) ? ((haveSteepLine) ? 1.00 : ((haveShallowLine) ? 0.75 : 0.50)) : 0.08677704501) : 0.00);
|
dst[5] = mix(dst[5], blendPix, (needBlend) ? ((doLineBlend) ? ((haveSteepLine) ? 1.00 : ((haveShallowLine) ? 0.75 : 0.50)) : 0.08677704501) : 0.00);
|
||||||
dst[ 6] = mix(dst[ 6], blendPix, (needBlend) ? ((doLineBlend) ? 1.00 : 0.6848532563) : 0.00);
|
dst[6] = mix(dst[6], blendPix, (needBlend) ? ((doLineBlend) ? 1.00 : 0.6848532563) : 0.00);
|
||||||
dst[ 7] = mix(dst[ 7], blendPix, (needBlend) ? ((doLineBlend) ? ((haveShallowLine) ? 1.00 : ((haveSteepLine) ? 0.75 : 0.50)) : 0.08677704501) : 0.00);
|
dst[7] = mix(dst[7], blendPix, (needBlend) ? ((doLineBlend) ? ((haveShallowLine) ? 1.00 : ((haveSteepLine) ? 0.75 : 0.50)) : 0.08677704501) : 0.00);
|
||||||
dst[ 8] = mix(dst[ 8], blendPix, (needBlend && doLineBlend && haveShallowLine) ? 0.75 : 0.00);
|
dst[8] = mix(dst[8], blendPix, (needBlend && doLineBlend && haveShallowLine) ? 0.75 : 0.00);
|
||||||
dst[ 9] = mix(dst[ 9], blendPix, (needBlend && doLineBlend && haveShallowLine) ? 0.25 : 0.00);
|
dst[9] = mix(dst[9], blendPix, (needBlend && doLineBlend && haveShallowLine) ? 0.25 : 0.00);
|
||||||
|
|
||||||
dist_01_04 = DistYCbCr(src[3], src[6]);
|
dist_01_04 = DistYCbCr(src[3], src[6]);
|
||||||
dist_03_08 = DistYCbCr(src[5], src[2]);
|
dist_03_08 = DistYCbCr(src[5], src[2]);
|
||||||
haveShallowLine = (STEEP_DIRECTION_THRESHOLD * dist_01_04 <= dist_03_08) && (v[0] != v[6]) && (v[7] != v[6]);
|
haveShallowLine = (STEEP_DIRECTION_THRESHOLD * dist_01_04 <= dist_03_08) && (v[0] != v[6]) && (v[7] != v[6]);
|
||||||
haveSteepLine = (STEEP_DIRECTION_THRESHOLD * dist_03_08 <= dist_01_04) && (v[0] != v[2]) && (v[1] != v[2]);
|
haveSteepLine = (STEEP_DIRECTION_THRESHOLD * dist_03_08 <= dist_01_04) && (v[0] != v[2]) && (v[1] != v[2]);
|
||||||
needBlend = (blendResult[3] != BLEND_NONE);
|
needBlend = (blendResult[3] != BLEND_NONE);
|
||||||
doLineBlend = ( blendResult[3] >= BLEND_DOMINANT ||
|
doLineBlend = (blendResult[3] >= BLEND_DOMINANT ||
|
||||||
!((blendResult[2] != BLEND_NONE && !IsPixEqual(src[0], src[6])) ||
|
!((blendResult[2] != BLEND_NONE && !IsPixEqual(src[0], src[6])) ||
|
||||||
(blendResult[0] != BLEND_NONE && !IsPixEqual(src[0], src[2])) ||
|
(blendResult[0] != BLEND_NONE && !IsPixEqual(src[0], src[2])) ||
|
||||||
(IsPixEqual(src[6], src[5]) && IsPixEqual(src[5], src[4]) && IsPixEqual(src[4], src[3]) && IsPixEqual(src[3], src[2]) && !IsPixEqual(src[0], src[4])) ) );
|
(IsPixEqual(src[6], src[5]) && IsPixEqual(src[5], src[4]) && IsPixEqual(src[4], src[3]) && IsPixEqual(src[3], src[2]) && !IsPixEqual(src[0], src[4]))));
|
||||||
|
|
||||||
blendPix = ( DistYCbCr(src[0], src[3]) <= DistYCbCr(src[0], src[5]) ) ? src[3] : src[5];
|
blendPix = (DistYCbCr(src[0], src[3]) <= DistYCbCr(src[0], src[5])) ? src[3] : src[5];
|
||||||
dst[ 3] = mix(dst[ 3], blendPix, (needBlend && doLineBlend) ? ((haveShallowLine) ? ((haveSteepLine) ? 1.0/3.0 : 0.25) : ((haveSteepLine) ? 0.25 : 0.00)) : 0.00);
|
dst[3] = mix(dst[3], blendPix, (needBlend && doLineBlend) ? ((haveShallowLine) ? ((haveSteepLine) ? 1.0 / 3.0 : 0.25) : ((haveSteepLine) ? 0.25 : 0.00)) : 0.00);
|
||||||
dst[12] = mix(dst[12], blendPix, (needBlend && doLineBlend && haveSteepLine) ? 0.25 : 0.00);
|
dst[12] = mix(dst[12], blendPix, (needBlend && doLineBlend && haveSteepLine) ? 0.25 : 0.00);
|
||||||
dst[13] = mix(dst[13], blendPix, (needBlend && doLineBlend && haveSteepLine) ? 0.75 : 0.00);
|
dst[13] = mix(dst[13], blendPix, (needBlend && doLineBlend && haveSteepLine) ? 0.75 : 0.00);
|
||||||
dst[14] = mix(dst[14], blendPix, (needBlend) ? ((doLineBlend) ? ((haveSteepLine) ? 1.00 : ((haveShallowLine) ? 0.75 : 0.50)) : 0.08677704501) : 0.00);
|
dst[14] = mix(dst[14], blendPix, (needBlend) ? ((doLineBlend) ? ((haveSteepLine) ? 1.00 : ((haveShallowLine) ? 0.75 : 0.50)) : 0.08677704501) : 0.00);
|
||||||
dst[15] = mix(dst[15], blendPix, (needBlend) ? ((doLineBlend) ? 1.00 : 0.6848532563) : 0.00);
|
dst[15] = mix(dst[15], blendPix, (needBlend) ? ((doLineBlend) ? 1.00 : 0.6848532563) : 0.00);
|
||||||
dst[ 4] = mix(dst[ 4], blendPix, (needBlend) ? ((doLineBlend) ? ((haveShallowLine) ? 1.00 : ((haveSteepLine) ? 0.75 : 0.50)) : 0.08677704501) : 0.00);
|
dst[4] = mix(dst[4], blendPix, (needBlend) ? ((doLineBlend) ? ((haveShallowLine) ? 1.00 : ((haveSteepLine) ? 0.75 : 0.50)) : 0.08677704501) : 0.00);
|
||||||
dst[ 5] = mix(dst[ 5], blendPix, (needBlend && doLineBlend && haveShallowLine) ? 0.75 : 0.00);
|
dst[5] = mix(dst[5], blendPix, (needBlend && doLineBlend && haveShallowLine) ? 0.75 : 0.00);
|
||||||
dst[ 6] = mix(dst[ 6], blendPix, (needBlend && doLineBlend && haveShallowLine) ? 0.25 : 0.00);
|
dst[6] = mix(dst[6], blendPix, (needBlend && doLineBlend && haveShallowLine) ? 0.25 : 0.00);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Output Pixel Mapping:
|
// Output Pixel Mapping:
|
||||||
@ -260,10 +260,18 @@ void applyScaling(uvec2 origxy) {
|
|||||||
// 15|14|13|12
|
// 15|14|13|12
|
||||||
const int order[16] = int[16](6, 7, 8, 9, 5, 0, 1, 10, 4, 3, 2, 11, 15, 14, 13, 12);
|
const int order[16] = int[16](6, 7, 8, 9, 5, 0, 1, 10, 4, 3, 2, 11, 15, 14, 13, 12);
|
||||||
// Write all 16 output pixels.
|
// Write all 16 output pixels.
|
||||||
ivec2 destXY = ivec2(origxy) * 4;
|
ivec2 destXY = ivec2(origxy) * 2;
|
||||||
for (int y = 0; y < 4; y++) {
|
for (int y = 0; y < 2; y++) {
|
||||||
for (int x = 0; x < 4; x++) {
|
for (int x = 0; x < 2; x++) {
|
||||||
writeColorf(destXY + ivec2(x, y), dst[order[y * 4 + x]]);
|
vec4 sum = vec4(0.0);
|
||||||
|
int index = y * 4 + x * 2;
|
||||||
|
for (int iy = 0; iy < 2; iy++) {
|
||||||
|
for (int ix = 0; ix < 2; ix++) {
|
||||||
|
sum += dst[order[index + iy * 4 + ix]];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
sum *= 0.25;
|
||||||
|
writeColorf(destXY + ivec2(x, y), sum);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user