Skip to content

Commit

Permalink
优化边界检查
Browse files Browse the repository at this point in the history
  • Loading branch information
Blinue committed Jul 18, 2021
1 parent e4078e5 commit 0d6d598
Show file tree
Hide file tree
Showing 49 changed files with 130 additions and 130 deletions.
4 changes: 2 additions & 2 deletions MODULE_ACNet/ACNetL1aShader.hlsl
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ const static float4 biasL1 = {-0.7577, -0.0210, 0.0292, -0.0189};
D2D_PS_ENTRY(main) {
InitMagpieSampleInput();

float2 leftTop = GetCheckedOffPos(0, float2(-1, -1));
float2 rightBottom = GetCheckedOffPos(0, float2(1, 1));
float2 leftTop = max(0, Coord(0).xy - Coord(0).zw);
float2 rightBottom = min(maxCoord0.xy, Coord(0).xy + Coord(0).zw);

// [tl, tc, tr]
// [ml, mc, mr]
Expand Down
4 changes: 2 additions & 2 deletions MODULE_ACNet/ACNetL1bShader.hlsl
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ const static float4 biasL1 = { 0.0223, 0.0340, 0.0150, -0.0044 };
D2D_PS_ENTRY(main) {
InitMagpieSampleInput();

float2 leftTop = GetCheckedOffPos(0, float2(-1, -1));
float2 rightBottom = GetCheckedOffPos(0, float2(1, 1));
float2 leftTop = max(0, Coord(0).xy - Coord(0).zw);
float2 rightBottom = min(maxCoord0.xy, Coord(0).xy + Coord(0).zw);

// [tl, tc, tr]
// [ml, mc, mr]
Expand Down
8 changes: 4 additions & 4 deletions MODULE_ACNet/ACNetL2aShader.hlsl
Original file line number Diff line number Diff line change
Expand Up @@ -116,8 +116,8 @@ const static float4 biasL = { 0.0272, -0.5743, -0.0333, -0.0334 };
D2D_PS_ENTRY(main) {
InitMagpieSampleInput();

float2 leftTop1 = GetCheckedOffPos(0, float2(-1, -1));
float2 rightBottom1 = GetCheckedOffPos(0, float2(1, 1));
float2 leftTop1 = max(0, Coord(0).xy - Coord(0).zw);
float2 rightBottom1 = min(maxCoord0.xy, Coord(0).xy + Coord(0).zw);

// [tl, tc, tr]
// [ml, mc, mr]
Expand All @@ -132,8 +132,8 @@ D2D_PS_ENTRY(main) {
float4 mr1 = uncompressLinear(SampleInput(0, float2(rightBottom1.x, Coord(0).y)), 0, 2);
float4 br1 = uncompressLinear(SampleInput(0, rightBottom1), 0, 2);

float2 leftTop2 = GetCheckedOffPos(1, float2(-1, -1));
float2 rightBottom2 = GetCheckedOffPos(1, float2(1, 1));
float2 leftTop2 = max(0, Coord(1).xy - Coord(1).zw);
float2 rightBottom2 = min(maxCoord1.xy, Coord(1).xy + Coord(1).zw);

float4 tl2 = uncompressLinear(SampleInput(1, leftTop2), 0, 2);
float4 ml2 = uncompressLinear(SampleInput(1, float2(leftTop2.x, Coord(1).y)), 0, 2);
Expand Down
8 changes: 4 additions & 4 deletions MODULE_ACNet/ACNetL2bShader.hlsl
Original file line number Diff line number Diff line change
Expand Up @@ -116,8 +116,8 @@ const static float4 biasL = { 0.0082, -0.0263, -0.0048, -0.0167 };
D2D_PS_ENTRY(main) {
InitMagpieSampleInput();

float2 leftTop1 = GetCheckedOffPos(0, float2(-1, -1));
float2 rightBottom1 = GetCheckedOffPos(0, float2(1, 1));
float2 leftTop1 = max(0, Coord(0).xy - Coord(0).zw);
float2 rightBottom1 = min(maxCoord0.xy, Coord(0).xy + Coord(0).zw);

// [tl, tc, tr]
// [ml, mc, mr]
Expand All @@ -132,8 +132,8 @@ D2D_PS_ENTRY(main) {
float4 mr1 = uncompressLinear(SampleInput(0, float2(rightBottom1.x, Coord(0).y)), 0, 2);
float4 br1 = uncompressLinear(SampleInput(0, rightBottom1), 0, 2);

float2 leftTop2 = GetCheckedOffPos(1, float2(-1, -1));
float2 rightBottom2 = GetCheckedOffPos(1, float2(1, 1));
float2 leftTop2 = max(0, Coord(1).xy - Coord(1).zw);
float2 rightBottom2 = min(maxCoord1.xy, Coord(1).xy + Coord(1).zw);

float4 tl2 = uncompressLinear(SampleInput(1, leftTop2), 0, 2);
float4 ml2 = uncompressLinear(SampleInput(1, float2(leftTop2.x, Coord(1).y)), 0, 2);
Expand Down
8 changes: 4 additions & 4 deletions MODULE_ACNet/ACNetL3aShader.hlsl
Original file line number Diff line number Diff line change
Expand Up @@ -116,8 +116,8 @@ const static float4 biasL = { -0.0239, -0.0385, 0.0026, 0.0288 };
D2D_PS_ENTRY(main) {
InitMagpieSampleInput();

float2 leftTop1 = GetCheckedOffPos(0, float2(-1, -1));
float2 rightBottom1 = GetCheckedOffPos(0, float2(1, 1));
float2 leftTop1 = max(0, Coord(0).xy - Coord(0).zw);
float2 rightBottom1 = min(maxCoord0.xy, Coord(0).xy + Coord(0).zw);

// [tl, tc, tr]
// [ml, mc, mr]
Expand All @@ -132,8 +132,8 @@ D2D_PS_ENTRY(main) {
float4 mr1 = SampleInput(0, float2(rightBottom1.x, Coord(0).y));
float4 br1 = SampleInput(0, rightBottom1);

float2 leftTop2 = GetCheckedOffPos(1, float2(-1, -1));
float2 rightBottom2 = GetCheckedOffPos(1, float2(1, 1));
float2 leftTop2 = max(0, Coord(1).xy - Coord(1).zw);
float2 rightBottom2 = min(maxCoord1.xy, Coord(1).xy + Coord(1).zw);

float4 tl2 = uncompressLinear(SampleInput(1, leftTop2), 0, 3);
float4 ml2 = uncompressLinear(SampleInput(1, float2(leftTop2.x, Coord(1).y)), 0, 3);
Expand Down
8 changes: 4 additions & 4 deletions MODULE_ACNet/ACNetL3bShader.hlsl
Original file line number Diff line number Diff line change
Expand Up @@ -116,8 +116,8 @@ const static float4 biasL = { -0.0225, 0.0082, -0.0191, -0.0185 };
D2D_PS_ENTRY(main) {
InitMagpieSampleInput();

float2 leftTop1 = GetCheckedOffPos(0, float2(-1, -1));
float2 rightBottom1 = GetCheckedOffPos(0, float2(1, 1));
float2 leftTop1 = max(0, Coord(0).xy - Coord(0).zw);
float2 rightBottom1 = min(maxCoord0.xy, Coord(0).xy + Coord(0).zw);

// [tl, tc, tr]
// [ml, mc, mr]
Expand All @@ -132,8 +132,8 @@ D2D_PS_ENTRY(main) {
float4 mr1 = SampleInput(0, float2(rightBottom1.x, Coord(0).y));
float4 br1 = SampleInput(0, rightBottom1);

float2 leftTop2 = GetCheckedOffPos(1, float2(-1, -1));
float2 rightBottom2 = GetCheckedOffPos(1, float2(1, 1));
float2 leftTop2 = max(0, Coord(1).xy - Coord(1).zw);
float2 rightBottom2 = min(maxCoord1.xy, Coord(1).xy + Coord(1).zw);

float4 tl2 = uncompressLinear(SampleInput(1, leftTop2), 0, 3);
float4 ml2 = uncompressLinear(SampleInput(1, float2(leftTop2.x, Coord(1).y)), 0, 3);
Expand Down
8 changes: 4 additions & 4 deletions MODULE_ACNet/ACNetL4aShader.hlsl
Original file line number Diff line number Diff line change
Expand Up @@ -116,8 +116,8 @@ const static float4 biasL = { -5.8305e-03, -8.6574e-02, 4.2228e-02, -4.3500e-02
D2D_PS_ENTRY(main) {
InitMagpieSampleInput();

float2 leftTop1 = GetCheckedOffPos(0, float2(-1, -1));
float2 rightBottom1 = GetCheckedOffPos(0, float2(1, 1));
float2 leftTop1 = max(0, Coord(0).xy - Coord(0).zw);
float2 rightBottom1 = min(maxCoord0.xy, Coord(0).xy + Coord(0).zw);

// [tl, tc, tr]
// [ml, mc, mr]
Expand All @@ -132,8 +132,8 @@ D2D_PS_ENTRY(main) {
float4 mr1 = uncompressLinear(SampleInput(0, float2(rightBottom1.x, Coord(0).y)), 0, 3.5);
float4 br1 = uncompressLinear(SampleInput(0, rightBottom1), 0, 3.5);

float2 leftTop2 = GetCheckedOffPos(1, float2(-1, -1));
float2 rightBottom2 = GetCheckedOffPos(1, float2(1, 1));
float2 leftTop2 = max(0, Coord(1).xy - Coord(1).zw);
float2 rightBottom2 = min(maxCoord1.xy, Coord(1).xy + Coord(1).zw);

float4 tl2 = uncompressLinear(SampleInput(1, leftTop2), 0, 2);
float4 ml2 = uncompressLinear(SampleInput(1, float2(leftTop2.x, Coord(1).y)), 0, 2);
Expand Down
8 changes: 4 additions & 4 deletions MODULE_ACNet/ACNetL4bShader.hlsl
Original file line number Diff line number Diff line change
Expand Up @@ -116,8 +116,8 @@ const static float4 biasL = { -8.1892e-04, 3.3171e-03, -1.1582e-02, -4.1205e-40
D2D_PS_ENTRY(main) {
InitMagpieSampleInput();

float2 leftTop1 = GetCheckedOffPos(0, float2(-1, -1));
float2 rightBottom1 = GetCheckedOffPos(0, float2(1, 1));
float2 leftTop1 = max(0, Coord(0).xy - Coord(0).zw);
float2 rightBottom1 = min(maxCoord0.xy, Coord(0).xy + Coord(0).zw);

// [tl, tc, tr]
// [ml, mc, mr]
Expand All @@ -132,8 +132,8 @@ D2D_PS_ENTRY(main) {
float4 mr1 = uncompressLinear(SampleInput(0, float2(rightBottom1.x, Coord(0).y)), 0, 3.5);
float4 br1 = uncompressLinear(SampleInput(0, rightBottom1), 0, 3.5);

float2 leftTop2 = GetCheckedOffPos(1, float2(-1, -1));
float2 rightBottom2 = GetCheckedOffPos(1, float2(1, 1));
float2 leftTop2 = max(0, Coord(1).xy - Coord(1).zw);
float2 rightBottom2 = min(maxCoord1.xy, Coord(1).xy + Coord(1).zw);

float4 tl2 = uncompressLinear(SampleInput(1, leftTop2), 0, 2);
float4 ml2 = uncompressLinear(SampleInput(1, float2(leftTop2.x, Coord(1).y)), 0, 2);
Expand Down
8 changes: 4 additions & 4 deletions MODULE_ACNet/ACNetL5aShader.hlsl
Original file line number Diff line number Diff line change
Expand Up @@ -116,8 +116,8 @@ const static float4 biasL = { -0.0053, 0.0053, -0.0114, -0.0127 };
D2D_PS_ENTRY(main) {
InitMagpieSampleInput();

float2 leftTop1 = GetCheckedOffPos(0, float2(-1, -1));
float2 rightBottom1 = GetCheckedOffPos(0, float2(1, 1));
float2 leftTop1 = max(0, Coord(0).xy - Coord(0).zw);
float2 rightBottom1 = min(maxCoord0.xy, Coord(0).xy + Coord(0).zw);

// [tl, tc, tr]
// [ml, mc, mr]
Expand All @@ -132,8 +132,8 @@ D2D_PS_ENTRY(main) {
float4 mr1 = uncompressLinear(SampleInput(0, float2(rightBottom1.x, Coord(0).y)), 0, 2);
float4 br1 = uncompressLinear(SampleInput(0, rightBottom1), 0, 2);

float2 leftTop2 = GetCheckedOffPos(1, float2(-1, -1));
float2 rightBottom2 = GetCheckedOffPos(1, float2(1, 1));
float2 leftTop2 = max(0, Coord(1).xy - Coord(1).zw);
float2 rightBottom2 = min(maxCoord1.xy, Coord(1).xy + Coord(1).zw);

float4 tl2 = uncompressLinear(SampleInput(1, leftTop2), 0, 3);
float4 ml2 = uncompressLinear(SampleInput(1, float2(leftTop2.x, Coord(1).y)), 0, 3);
Expand Down
8 changes: 4 additions & 4 deletions MODULE_ACNet/ACNetL5bShader.hlsl
Original file line number Diff line number Diff line change
Expand Up @@ -116,8 +116,8 @@ const static float4 biasL = { -0.0039, -0.0426, 0.0053, -0.0017 };
D2D_PS_ENTRY(main) {
InitMagpieSampleInput();

float2 leftTop1 = GetCheckedOffPos(0, float2(-1, -1));
float2 rightBottom1 = GetCheckedOffPos(0, float2(1, 1));
float2 leftTop1 = max(0, Coord(0).xy - Coord(0).zw);
float2 rightBottom1 = min(maxCoord0.xy, Coord(0).xy + Coord(0).zw);

// [tl, tc, tr]
// [ml, mc, mr]
Expand All @@ -132,8 +132,8 @@ D2D_PS_ENTRY(main) {
float4 mr1 = uncompressLinear(SampleInput(0, float2(rightBottom1.x, Coord(0).y)), 0, 2);
float4 br1 = uncompressLinear(SampleInput(0, rightBottom1), 0, 2);

float2 leftTop2 = GetCheckedOffPos(1, float2(-1, -1));
float2 rightBottom2 = GetCheckedOffPos(1, float2(1, 1));
float2 leftTop2 = max(0, Coord(1).xy - Coord(1).zw);
float2 rightBottom2 = min(maxCoord1.xy, Coord(1).xy + Coord(1).zw);

float4 tl2 = uncompressLinear(SampleInput(1, leftTop2), 0, 3);
float4 ml2 = uncompressLinear(SampleInput(1, float2(leftTop2.x, Coord(1).y)), 0, 3);
Expand Down
8 changes: 4 additions & 4 deletions MODULE_ACNet/ACNetL6aShader.hlsl
Original file line number Diff line number Diff line change
Expand Up @@ -116,8 +116,8 @@ const static float4 biasL = { -0.0046, -0.0104, -0.0087, -0.0040 };
D2D_PS_ENTRY(main) {
InitMagpieSampleInput();

float2 leftTop1 = GetCheckedOffPos(0, float2(-1, -1));
float2 rightBottom1 = GetCheckedOffPos(0, float2(1, 1));
float2 leftTop1 = max(0, Coord(0).xy - Coord(0).zw);
float2 rightBottom1 = min(maxCoord0.xy, Coord(0).xy + Coord(0).zw);

// [tl, tc, tr]
// [ml, mc, mr]
Expand All @@ -132,8 +132,8 @@ D2D_PS_ENTRY(main) {
float4 mr1 = uncompressLinear(SampleInput(0, float2(rightBottom1.x, Coord(0).y)), 0, 2);
float4 br1 = uncompressLinear(SampleInput(0, rightBottom1), 0, 2);

float2 leftTop2 = GetCheckedOffPos(1, float2(-1, -1));
float2 rightBottom2 = GetCheckedOffPos(1, float2(1, 1));
float2 leftTop2 = max(0, Coord(1).xy - Coord(1).zw);
float2 rightBottom2 = min(maxCoord1.xy, Coord(1).xy + Coord(1).zw);

float4 tl2 = uncompressLinear(SampleInput(1, leftTop2), 0, 3);
float4 ml2 = uncompressLinear(SampleInput(1, float2(leftTop2.x, Coord(1).y)), 0, 3);
Expand Down
8 changes: 4 additions & 4 deletions MODULE_ACNet/ACNetL6bShader.hlsl
Original file line number Diff line number Diff line change
Expand Up @@ -116,8 +116,8 @@ const static float4 biasL = { 0.1077, 0.0347, -0.0165, 0.7296 };
D2D_PS_ENTRY(main) {
InitMagpieSampleInput();

float2 leftTop1 = GetCheckedOffPos(0, float2(-1, -1));
float2 rightBottom1 = GetCheckedOffPos(0, float2(1, 1));
float2 leftTop1 = max(0, Coord(0).xy - Coord(0).zw);
float2 rightBottom1 = min(maxCoord0.xy, Coord(0).xy + Coord(0).zw);

// [tl, tc, tr]
// [ml, mc, mr]
Expand All @@ -132,8 +132,8 @@ D2D_PS_ENTRY(main) {
float4 mr1 = uncompressLinear(SampleInput(0, float2(rightBottom1.x, Coord(0).y)), 0, 2);
float4 br1 = uncompressLinear(SampleInput(0, rightBottom1), 0, 2);

float2 leftTop2 = GetCheckedOffPos(1, float2(-1, -1));
float2 rightBottom2 = GetCheckedOffPos(1, float2(1, 1));
float2 leftTop2 = max(0, Coord(1).xy - Coord(1).zw);
float2 rightBottom2 = min(maxCoord1.xy, Coord(1).xy + Coord(1).zw);

float4 tl2 = uncompressLinear(SampleInput(1, leftTop2), 0, 3);
float4 ml2 = uncompressLinear(SampleInput(1, float2(leftTop2.x, Coord(1).y)), 0, 3);
Expand Down
8 changes: 4 additions & 4 deletions MODULE_ACNet/ACNetL7aShader.hlsl
Original file line number Diff line number Diff line change
Expand Up @@ -116,8 +116,8 @@ const static float4 biasL = { 8.7612e-02, 5.9126e-01, 4.6709e-03, -1.1559e-39
D2D_PS_ENTRY(main) {
InitMagpieSampleInput();

float2 leftTop1 = GetCheckedOffPos(0, float2(-1, -1));
float2 rightBottom1 = GetCheckedOffPos(0, float2(1, 1));
float2 leftTop1 = max(0, Coord(0).xy - Coord(0).zw);
float2 rightBottom1 = min(maxCoord0.xy, Coord(0).xy + Coord(0).zw);

// [tl, tc, tr]
// [ml, mc, mr]
Expand All @@ -132,8 +132,8 @@ D2D_PS_ENTRY(main) {
float4 mr1 = uncompressLinear(SampleInput(0, float2(rightBottom1.x, Coord(0).y)), 0, 2.5);
float4 br1 = uncompressLinear(SampleInput(0, rightBottom1), 0, 2.5);

float2 leftTop2 = GetCheckedOffPos(1, float2(-1, -1));
float2 rightBottom2 = GetCheckedOffPos(1, float2(1, 1));
float2 leftTop2 = max(0, Coord(1).xy - Coord(1).zw);
float2 rightBottom2 = min(maxCoord1.xy, Coord(1).xy + Coord(1).zw);

float4 tl2 = uncompressLinear(SampleInput(1, leftTop2), 0, 3);
float4 ml2 = uncompressLinear(SampleInput(1, float2(leftTop2.x, Coord(1).y)), 0, 3);
Expand Down
8 changes: 4 additions & 4 deletions MODULE_ACNet/ACNetL7bShader.hlsl
Original file line number Diff line number Diff line change
Expand Up @@ -116,8 +116,8 @@ const static float4 biasL = { 2.3381e-02, -1.2136e-40, -5.6040e-39, 3.7100e-02
D2D_PS_ENTRY(main) {
InitMagpieSampleInput();

float2 leftTop1 = GetCheckedOffPos(0, float2(-1, -1));
float2 rightBottom1 = GetCheckedOffPos(0, float2(1, 1));
float2 leftTop1 = max(0, Coord(0).xy - Coord(0).zw);
float2 rightBottom1 = min(maxCoord0.xy, Coord(0).xy + Coord(0).zw);

// [tl, tc, tr]
// [ml, mc, mr]
Expand All @@ -132,8 +132,8 @@ D2D_PS_ENTRY(main) {
float4 mr1 = uncompressLinear(SampleInput(0, float2(rightBottom1.x, Coord(0).y)), 0, 2.5);
float4 br1 = uncompressLinear(SampleInput(0, rightBottom1), 0, 2.5);

float2 leftTop2 = GetCheckedOffPos(1, float2(-1, -1));
float2 rightBottom2 = GetCheckedOffPos(1, float2(1, 1));
float2 leftTop2 = max(0, Coord(1).xy - Coord(1).zw);
float2 rightBottom2 = min(maxCoord1.xy, Coord(1).xy + Coord(1).zw);

float4 tl2 = uncompressLinear(SampleInput(1, leftTop2), 0, 3);
float4 ml2 = uncompressLinear(SampleInput(1, float2(leftTop2.x, Coord(1).y)), 0, 3);
Expand Down
8 changes: 4 additions & 4 deletions MODULE_ACNet/ACNetL8aShader.hlsl
Original file line number Diff line number Diff line change
Expand Up @@ -116,8 +116,8 @@ const static float4 biasL = { -3.3246e-39, -1.4536e-02, -6.3362e-02, 8.5347e-41
D2D_PS_ENTRY(main) {
InitMagpieSampleInput();

float2 leftTop1 = GetCheckedOffPos(0, float2(-1, -1));
float2 rightBottom1 = GetCheckedOffPos(0, float2(1, 1));
float2 leftTop1 = max(0, Coord(0).xy - Coord(0).zw);
float2 rightBottom1 = min(maxCoord0.xy, Coord(0).xy + Coord(0).zw);

// [tl, tc, tr]
// [ml, mc, mr]
Expand All @@ -132,8 +132,8 @@ D2D_PS_ENTRY(main) {
float4 mr1 = uncompressLinear(SampleInput(0, float2(rightBottom1.x, Coord(0).y)), 0, 4);
float4 br1 = uncompressLinear(SampleInput(0, rightBottom1), 0, 4);

float2 leftTop2 = GetCheckedOffPos(1, float2(-1, -1));
float2 rightBottom2 = GetCheckedOffPos(1, float2(1, 1));
float2 leftTop2 = max(0, Coord(1).xy - Coord(1).zw);
float2 rightBottom2 = min(maxCoord1.xy, Coord(1).xy + Coord(1).zw);

float4 tl2 = uncompressLinear(SampleInput(1, leftTop2), 0, 4);
float4 ml2 = uncompressLinear(SampleInput(1, float2(leftTop2.x, Coord(1).y)), 0, 4);
Expand Down
8 changes: 4 additions & 4 deletions MODULE_ACNet/ACNetL8bShader.hlsl
Original file line number Diff line number Diff line change
Expand Up @@ -116,8 +116,8 @@ const static float4 biasL = { 7.9956e-02, 3.0679e-04, -1.0257e-02, -1.2037e-02 }
D2D_PS_ENTRY(main) {
InitMagpieSampleInput();

float2 leftTop1 = GetCheckedOffPos(0, float2(-1, -1));
float2 rightBottom1 = GetCheckedOffPos(0, float2(1, 1));
float2 leftTop1 = max(0, Coord(0).xy - Coord(0).zw);
float2 rightBottom1 = min(maxCoord0.xy, Coord(0).xy + Coord(0).zw);

// [tl, tc, tr]
// [ml, mc, mr]
Expand All @@ -132,8 +132,8 @@ D2D_PS_ENTRY(main) {
float4 mr1 = uncompressLinear(SampleInput(0, float2(rightBottom1.x, Coord(0).y)), 0, 4);
float4 br1 = uncompressLinear(SampleInput(0, rightBottom1), 0, 4);

float2 leftTop2 = GetCheckedOffPos(1, float2(-1, -1));
float2 rightBottom2 = GetCheckedOffPos(1, float2(1, 1));
float2 leftTop2 = max(0, Coord(1).xy - Coord(1).zw);
float2 rightBottom2 = min(maxCoord1.xy, Coord(1).xy + Coord(1).zw);

float4 tl2 = uncompressLinear(SampleInput(1, leftTop2), 0, 4);
float4 ml2 = uncompressLinear(SampleInput(1, float2(leftTop2.x, Coord(1).y)), 0, 4);
Expand Down
8 changes: 4 additions & 4 deletions MODULE_ACNet/ACNetL9aShader.hlsl
Original file line number Diff line number Diff line change
Expand Up @@ -116,8 +116,8 @@ const static float4 biasL = { -0.0006, 0.0117, 0.0083, 0.0686 };
D2D_PS_ENTRY(main) {
InitMagpieSampleInput();

float2 leftTop1 = GetCheckedOffPos(0, float2(-1, -1));
float2 rightBottom1 = GetCheckedOffPos(0, float2(1, 1));
float2 leftTop1 = max(0, Coord(0).xy - Coord(0).zw);
float2 rightBottom1 = min(maxCoord0.xy, Coord(0).xy + Coord(0).zw);

// [tl, tc, tr]
// [ml, mc, mr]
Expand All @@ -132,8 +132,8 @@ D2D_PS_ENTRY(main) {
float4 mr1 = uncompressLinear(SampleInput(0, float2(rightBottom1.x, Coord(0).y)), 0, 4);
float4 br1 = uncompressLinear(SampleInput(0, rightBottom1), 0, 4);

float2 leftTop2 = GetCheckedOffPos(1, float2(-1, -1));
float2 rightBottom2 = GetCheckedOffPos(1, float2(1, 1));
float2 leftTop2 = max(0, Coord(1).xy - Coord(1).zw);
float2 rightBottom2 = min(maxCoord1.xy, Coord(1).xy + Coord(1).zw);

float4 tl2 = uncompressLinear(SampleInput(1, leftTop2), 0, 4);
float4 ml2 = uncompressLinear(SampleInput(1, float2(leftTop2.x, Coord(1).y)), 0, 4);
Expand Down
8 changes: 4 additions & 4 deletions MODULE_ACNet/ACNetL9bShader.hlsl
Original file line number Diff line number Diff line change
Expand Up @@ -116,8 +116,8 @@ const static float4 biasL = { -0.0046, 0.0015, -0.0076, 0.0079 };
D2D_PS_ENTRY(main) {
InitMagpieSampleInput();

float2 leftTop1 = GetCheckedOffPos(0, float2(-1, -1));
float2 rightBottom1 = GetCheckedOffPos(0, float2(1, 1));
float2 leftTop1 = max(0, Coord(0).xy - Coord(0).zw);
float2 rightBottom1 = min(maxCoord0.xy, Coord(0).xy + Coord(0).zw);

// [tl, tc, tr]
// [ml, mc, mr]
Expand All @@ -132,8 +132,8 @@ D2D_PS_ENTRY(main) {
float4 mr1 = uncompressLinear(SampleInput(0, float2(rightBottom1.x, Coord(0).y)), 0, 4);
float4 br1 = uncompressLinear(SampleInput(0, rightBottom1), 0, 4);

float2 leftTop2 = GetCheckedOffPos(1, float2(-1, -1));
float2 rightBottom2 = GetCheckedOffPos(1, float2(1, 1));
float2 leftTop2 = max(0, Coord(1).xy - Coord(1).zw);
float2 rightBottom2 = min(maxCoord1.xy, Coord(1).xy + Coord(1).zw);

float4 tl2 = uncompressLinear(SampleInput(1, leftTop2), 0, 4);
float4 ml2 = uncompressLinear(SampleInput(1, float2(leftTop2.x, Coord(1).y)), 0, 4);
Expand Down
4 changes: 2 additions & 2 deletions MODULE_Anime4K/Anime4KConv4x3x3x1Shader.hlsl
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ cbuffer constants : register(b0) {
D2D_PS_ENTRY(main) {
InitMagpieSampleInput();

float2 leftTop = GetCheckedOffPos(0, float2(-1, -1));
float2 rightBottom = GetCheckedOffPos(0, float2(1, 1));
float2 leftTop = max(0, Coord(0).xy - Coord(0).zw);
float2 rightBottom = min(maxCoord0.xy, Coord(0).xy + Coord(0).zw);

// [ a, d, g ]
// [ b, e, h ]
Expand Down
4 changes: 2 additions & 2 deletions MODULE_Anime4K/Anime4KConv4x3x3x8Pass1Shader.hlsl
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ cbuffer constants : register(b0) {
D2D_PS_ENTRY(main) {
InitMagpieSampleInput();

float2 leftTop = GetCheckedOffPos(0, float2(-1, -1));
float2 rightBottom = GetCheckedOffPos(0, float2(1, 1));
float2 leftTop = max(0, Coord(0).xy - Coord(0).zw);
float2 rightBottom = min(maxCoord0.xy, Coord(0).xy + Coord(0).zw);

// [ a, d, g ]
// [ b, e, h ]
Expand Down
Loading

0 comments on commit 0d6d598

Please sign in to comment.