noobs 0.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/COPYING +339 -0
- package/README.md +46 -0
- package/bin/64bit/obs.lib +0 -0
- package/binding.gyp +23 -0
- package/dist/bin/Qt6Core.dll +0 -0
- package/dist/bin/Qt6Gui.dll +0 -0
- package/dist/bin/Qt6Network.dll +0 -0
- package/dist/bin/Qt6Svg.dll +0 -0
- package/dist/bin/Qt6Widgets.dll +0 -0
- package/dist/bin/Qt6Xml.dll +0 -0
- package/dist/bin/avcodec-61.dll +0 -0
- package/dist/bin/avdevice-61.dll +0 -0
- package/dist/bin/avfilter-10.dll +0 -0
- package/dist/bin/avformat-61.dll +0 -0
- package/dist/bin/avutil-59.dll +0 -0
- package/dist/bin/datachannel.dll +0 -0
- package/dist/bin/libcurl.dll +0 -0
- package/dist/bin/libobs-d3d11.dll +0 -0
- package/dist/bin/libobs-opengl.dll +0 -0
- package/dist/bin/libobs-winrt.dll +0 -0
- package/dist/bin/librist.dll +0 -0
- package/dist/bin/libx264-164.dll +0 -0
- package/dist/bin/lua51.dll +0 -0
- package/dist/bin/obs-amf-test.exe +0 -0
- package/dist/bin/obs-ffmpeg-mux.exe +0 -0
- package/dist/bin/obs-frontend-api.dll +0 -0
- package/dist/bin/obs-scripting.dll +0 -0
- package/dist/bin/obs.dll +0 -0
- package/dist/bin/srt.dll +0 -0
- package/dist/bin/swresample-5.dll +0 -0
- package/dist/bin/swscale-8.dll +0 -0
- package/dist/bin/w32-pthreads.dll +0 -0
- package/dist/bin/zlib.dll +0 -0
- package/dist/effects/area.effect +250 -0
- package/dist/effects/bicubic_scale.effect +236 -0
- package/dist/effects/bilinear_lowres_scale.effect +123 -0
- package/dist/effects/color.effect +172 -0
- package/dist/effects/default.effect +254 -0
- package/dist/effects/default_rect.effect +84 -0
- package/dist/effects/deinterlace_base.effect +325 -0
- package/dist/effects/deinterlace_blend.effect +21 -0
- package/dist/effects/deinterlace_blend_2x.effect +21 -0
- package/dist/effects/deinterlace_discard.effect +21 -0
- package/dist/effects/deinterlace_discard_2x.effect +21 -0
- package/dist/effects/deinterlace_linear.effect +21 -0
- package/dist/effects/deinterlace_linear_2x.effect +21 -0
- package/dist/effects/deinterlace_yadif.effect +21 -0
- package/dist/effects/deinterlace_yadif_2x.effect +21 -0
- package/dist/effects/format_conversion.effect +1823 -0
- package/dist/effects/lanczos_scale.effect +292 -0
- package/dist/effects/opaque.effect +159 -0
- package/dist/effects/premultiplied_alpha.effect +38 -0
- package/dist/effects/repeat.effect +36 -0
- package/dist/effects/solid.effect +80 -0
- package/dist/noobs.node +0 -0
- package/dist/plugins/obs-ffmpeg.dll +0 -0
- package/dist/plugins/obs-x264.dll +0 -0
- package/dist/plugins/win-capture.dll +0 -0
- package/include/audio-monitoring/osx/mac-helpers.h +13 -0
- package/include/audio-monitoring/pulse/pulseaudio-wrapper.h +212 -0
- package/include/audio-monitoring/win32/wasapi-output.h +22 -0
- package/include/callback/calldata.h +195 -0
- package/include/callback/decl.h +61 -0
- package/include/callback/proc.h +52 -0
- package/include/callback/signal.h +73 -0
- package/include/graphics/axisang.h +65 -0
- package/include/graphics/bounds.h +108 -0
- package/include/graphics/device-exports.h +177 -0
- package/include/graphics/effect-parser.h +290 -0
- package/include/graphics/effect.h +190 -0
- package/include/graphics/graphics-internal.h +335 -0
- package/include/graphics/graphics.h +1024 -0
- package/include/graphics/half.h +100 -0
- package/include/graphics/image-file.h +124 -0
- package/include/graphics/input.h +34 -0
- package/include/graphics/libnsgif/libnsgif.h +142 -0
- package/include/graphics/math-defs.h +45 -0
- package/include/graphics/math-extra.h +61 -0
- package/include/graphics/matrix3.h +98 -0
- package/include/graphics/matrix4.h +102 -0
- package/include/graphics/plane.h +85 -0
- package/include/graphics/quat.h +170 -0
- package/include/graphics/shader-parser.h +273 -0
- package/include/graphics/srgb.h +177 -0
- package/include/graphics/vec2.h +148 -0
- package/include/graphics/vec3.h +224 -0
- package/include/graphics/vec4.h +241 -0
- package/include/media-io/audio-io.h +228 -0
- package/include/media-io/audio-math.h +43 -0
- package/include/media-io/audio-resampler.h +44 -0
- package/include/media-io/format-conversion.h +50 -0
- package/include/media-io/frame-rate.h +29 -0
- package/include/media-io/media-io-defs.h +20 -0
- package/include/media-io/media-remux.h +37 -0
- package/include/media-io/video-frame.h +64 -0
- package/include/media-io/video-io.h +338 -0
- package/include/media-io/video-scaler.h +43 -0
- package/include/obs-audio-controls.h +250 -0
- package/include/obs-av1.h +47 -0
- package/include/obs-avc.h +55 -0
- package/include/obs-config.h +52 -0
- package/include/obs-data.h +311 -0
- package/include/obs-defs.h +52 -0
- package/include/obs-encoder.h +361 -0
- package/include/obs-ffmpeg-compat.h +13 -0
- package/include/obs-hevc.h +81 -0
- package/include/obs-hotkey.h +271 -0
- package/include/obs-hotkeys.h +653 -0
- package/include/obs-interaction.h +56 -0
- package/include/obs-internal.h +1459 -0
- package/include/obs-missing-files.h +53 -0
- package/include/obs-module.h +181 -0
- package/include/obs-nal.h +37 -0
- package/include/obs-nix-platform.h +53 -0
- package/include/obs-nix-wayland.h +24 -0
- package/include/obs-nix-x11.h +22 -0
- package/include/obs-nix.h +42 -0
- package/include/obs-output.h +96 -0
- package/include/obs-properties.h +364 -0
- package/include/obs-scene.h +127 -0
- package/include/obs-service.h +115 -0
- package/include/obs-source.h +568 -0
- package/include/obs.h +2608 -0
- package/include/obsconfig.h +13 -0
- package/include/obsversion.h +5 -0
- package/include/util/apple/cfstring-utils.h +16 -0
- package/include/util/array-serializer.h +37 -0
- package/include/util/base.h +97 -0
- package/include/util/bitstream.h +28 -0
- package/include/util/bmem.h +94 -0
- package/include/util/buffered-file-serializer.h +32 -0
- package/include/util/c99defs.h +75 -0
- package/include/util/cf-lexer.h +199 -0
- package/include/util/cf-parser.h +281 -0
- package/include/util/circlebuf.h +319 -0
- package/include/util/config-file.h +103 -0
- package/include/util/crc32.h +29 -0
- package/include/util/curl/curl-helper.h +35 -0
- package/include/util/darray.h +606 -0
- package/include/util/deque.h +319 -0
- package/include/util/dstr.h +320 -0
- package/include/util/file-serializer.h +34 -0
- package/include/util/lexer.h +273 -0
- package/include/util/pipe.h +52 -0
- package/include/util/platform.h +223 -0
- package/include/util/profiler.h +97 -0
- package/include/util/serializer.h +158 -0
- package/include/util/simde/check.h +285 -0
- package/include/util/simde/debug-trap.h +117 -0
- package/include/util/simde/hedley.h +2123 -0
- package/include/util/simde/simde-align.h +481 -0
- package/include/util/simde/simde-arch.h +537 -0
- package/include/util/simde/simde-common.h +918 -0
- package/include/util/simde/simde-constify.h +925 -0
- package/include/util/simde/simde-detect-clang.h +114 -0
- package/include/util/simde/simde-diagnostic.h +447 -0
- package/include/util/simde/simde-features.h +550 -0
- package/include/util/simde/simde-math.h +1858 -0
- package/include/util/simde/x86/mmx.h +2456 -0
- package/include/util/simde/x86/sse.h +4479 -0
- package/include/util/simde/x86/sse2.h +7549 -0
- package/include/util/source-profiler.h +66 -0
- package/include/util/sse-intrin.h +32 -0
- package/include/util/task.h +22 -0
- package/include/util/text-lookup.h +45 -0
- package/include/util/threading-posix.h +77 -0
- package/include/util/threading-windows.h +142 -0
- package/include/util/threading.h +103 -0
- package/include/util/utf8.h +35 -0
- package/include/util/uthash.h +34 -0
- package/include/util/util_uint128.h +108 -0
- package/include/util/util_uint64.h +34 -0
- package/include/util/windows/device-enum.h +14 -0
- package/include/util/windows/obfuscate.h +16 -0
- package/include/util/windows/win-registry.h +37 -0
- package/include/util/windows/win-version.h +57 -0
- package/include/util/windows/window-helpers.h +47 -0
- package/index.d.ts +38 -0
- package/index.js +8 -0
- package/package.json +31 -0
- package/src/main.cpp +321 -0
- package/src/obs_interface.cpp +605 -0
- package/src/obs_interface.h +74 -0
- package/src/utils.cpp +80 -0
- package/src/utils.h +3 -0
|
@@ -0,0 +1,250 @@
|
|
|
1
|
+
#include "color.effect"
|
|
2
|
+
|
|
3
|
+
uniform float4x4 ViewProj;
|
|
4
|
+
uniform float2 base_dimension;
|
|
5
|
+
uniform float2 base_dimension_i;
|
|
6
|
+
uniform texture2d image;
|
|
7
|
+
uniform float multiplier;
|
|
8
|
+
|
|
9
|
+
sampler_state textureSampler {
|
|
10
|
+
Filter = Linear;
|
|
11
|
+
AddressU = Clamp;
|
|
12
|
+
AddressV = Clamp;
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
struct VertData {
|
|
16
|
+
float4 pos : POSITION;
|
|
17
|
+
float2 uv : TEXCOORD0;
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
struct VertInOut {
|
|
21
|
+
float2 uv : TEXCOORD0;
|
|
22
|
+
float4 pos : POSITION;
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
struct FragData {
|
|
26
|
+
float2 uv : TEXCOORD0;
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
VertInOut VSDefault(VertData vert_in)
|
|
30
|
+
{
|
|
31
|
+
VertInOut vert_out;
|
|
32
|
+
vert_out.pos = mul(float4(vert_in.pos.xyz, 1.0), ViewProj);
|
|
33
|
+
vert_out.uv = vert_in.uv;
|
|
34
|
+
return vert_out;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
float4 DrawArea(FragData frag_in)
|
|
38
|
+
{
|
|
39
|
+
float2 uv = frag_in.uv;
|
|
40
|
+
float2 uv_delta = float2(ddx(uv.x), ddy(uv.y));
|
|
41
|
+
|
|
42
|
+
// Handle potential OpenGL flip.
|
|
43
|
+
if (obs_glsl_compile)
|
|
44
|
+
uv_delta.y = abs(uv_delta.y);
|
|
45
|
+
|
|
46
|
+
float2 uv_min = uv - 0.5 * uv_delta;
|
|
47
|
+
float2 uv_max = uv_min + uv_delta;
|
|
48
|
+
|
|
49
|
+
float2 load_index_begin = floor(uv_min * base_dimension);
|
|
50
|
+
float2 load_index_end = ceil(uv_max * base_dimension);
|
|
51
|
+
|
|
52
|
+
float2 target_dimension = 1.0 / uv_delta;
|
|
53
|
+
float2 target_pos = uv * target_dimension;
|
|
54
|
+
float2 target_pos_min = target_pos - 0.5;
|
|
55
|
+
float2 target_pos_max = target_pos + 0.5;
|
|
56
|
+
float2 scale = base_dimension_i * target_dimension;
|
|
57
|
+
|
|
58
|
+
float4 total_color = float4(0.0, 0.0, 0.0, 0.0);
|
|
59
|
+
|
|
60
|
+
float load_index_y = load_index_begin.y;
|
|
61
|
+
do {
|
|
62
|
+
float source_y_min = load_index_y * scale.y;
|
|
63
|
+
float source_y_max = source_y_min + scale.y;
|
|
64
|
+
float y_min = max(source_y_min, target_pos_min.y);
|
|
65
|
+
float y_max = min(source_y_max, target_pos_max.y);
|
|
66
|
+
float height = y_max - y_min;
|
|
67
|
+
|
|
68
|
+
float load_index_x = load_index_begin.x;
|
|
69
|
+
do {
|
|
70
|
+
float source_x_min = load_index_x * scale.x;
|
|
71
|
+
float source_x_max = source_x_min + scale.x;
|
|
72
|
+
float x_min = max(source_x_min, target_pos_min.x);
|
|
73
|
+
float x_max = min(source_x_max, target_pos_max.x);
|
|
74
|
+
float width = x_max - x_min;
|
|
75
|
+
float area = width * height;
|
|
76
|
+
|
|
77
|
+
float4 color = image.Load(int3(load_index_x, load_index_y, 0));
|
|
78
|
+
total_color += area * color;
|
|
79
|
+
|
|
80
|
+
++load_index_x;
|
|
81
|
+
} while (load_index_x < load_index_end.x);
|
|
82
|
+
|
|
83
|
+
++load_index_y;
|
|
84
|
+
} while (load_index_y < load_index_end.y);
|
|
85
|
+
|
|
86
|
+
return total_color;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
float4 PSDrawAreaRGBA(FragData frag_in) : TARGET
|
|
90
|
+
{
|
|
91
|
+
return DrawArea(frag_in);
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
float4 PSDrawAreaRGBAMultiply(FragData frag_in) : TARGET
|
|
95
|
+
{
|
|
96
|
+
float4 rgba = DrawArea(frag_in);
|
|
97
|
+
rgba.rgb *= multiplier;
|
|
98
|
+
return rgba;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
float4 PSDrawAreaRGBATonemap(FragData frag_in) : TARGET
|
|
102
|
+
{
|
|
103
|
+
float4 rgba = DrawArea(frag_in);
|
|
104
|
+
rgba.rgb = rec709_to_rec2020(rgba.rgb);
|
|
105
|
+
rgba.rgb = reinhard(rgba.rgb);
|
|
106
|
+
rgba.rgb = rec2020_to_rec709(rgba.rgb);
|
|
107
|
+
return rgba;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
float4 PSDrawAreaRGBAMultiplyTonemap(FragData frag_in) : TARGET
|
|
111
|
+
{
|
|
112
|
+
float4 rgba = DrawArea(frag_in);
|
|
113
|
+
rgba.rgb *= multiplier;
|
|
114
|
+
rgba.rgb = rec709_to_rec2020(rgba.rgb);
|
|
115
|
+
rgba.rgb = reinhard(rgba.rgb);
|
|
116
|
+
rgba.rgb = rec2020_to_rec709(rgba.rgb);
|
|
117
|
+
return rgba;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
float4 DrawAreaUpscale(FragData frag_in)
|
|
121
|
+
{
|
|
122
|
+
float2 uv = frag_in.uv;
|
|
123
|
+
float2 uv_delta = float2(ddx(uv.x), ddy(uv.y));
|
|
124
|
+
|
|
125
|
+
// Handle potential OpenGL flip.
|
|
126
|
+
if (obs_glsl_compile)
|
|
127
|
+
uv_delta.y = abs(uv_delta.y);
|
|
128
|
+
|
|
129
|
+
float2 uv_min = uv - 0.5 * uv_delta;
|
|
130
|
+
float2 uv_max = uv_min + uv_delta;
|
|
131
|
+
|
|
132
|
+
float2 load_index_first = floor(uv_min * base_dimension);
|
|
133
|
+
float2 load_index_last = ceil(uv_max * base_dimension) - 1.0;
|
|
134
|
+
|
|
135
|
+
if (load_index_first.x < load_index_last.x) {
|
|
136
|
+
float uv_boundary_x = load_index_last.x * base_dimension_i.x;
|
|
137
|
+
uv.x = ((uv.x - uv_boundary_x) / uv_delta.x) * base_dimension_i.x + uv_boundary_x;
|
|
138
|
+
} else
|
|
139
|
+
uv.x = (load_index_first.x + 0.5) * base_dimension_i.x;
|
|
140
|
+
if (load_index_first.y < load_index_last.y) {
|
|
141
|
+
float uv_boundary_y = load_index_last.y * base_dimension_i.y;
|
|
142
|
+
uv.y = ((uv.y - uv_boundary_y) / uv_delta.y) * base_dimension_i.y + uv_boundary_y;
|
|
143
|
+
} else
|
|
144
|
+
uv.y = (load_index_first.y + 0.5) * base_dimension_i.y;
|
|
145
|
+
|
|
146
|
+
return image.Sample(textureSampler, uv);
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
float4 PSDrawAreaRGBAUpscale(FragData frag_in) : TARGET
|
|
150
|
+
{
|
|
151
|
+
return DrawAreaUpscale(frag_in);
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
float4 PSDrawAreaRGBAUpscaleMultiply(FragData frag_in) : TARGET
|
|
155
|
+
{
|
|
156
|
+
float4 rgba = DrawAreaUpscale(frag_in);
|
|
157
|
+
rgba.rgb *= multiplier;
|
|
158
|
+
return rgba;
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
float4 PSDrawAreaRGBAUpscaleTonemap(FragData frag_in) : TARGET
|
|
162
|
+
{
|
|
163
|
+
float4 rgba = DrawAreaUpscale(frag_in);
|
|
164
|
+
rgba.rgb = rec709_to_rec2020(rgba.rgb);
|
|
165
|
+
rgba.rgb = reinhard(rgba.rgb);
|
|
166
|
+
rgba.rgb = rec2020_to_rec709(rgba.rgb);
|
|
167
|
+
return rgba;
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
float4 PSDrawAreaRGBAUpscaleMultiplyTonemap(FragData frag_in) : TARGET
|
|
171
|
+
{
|
|
172
|
+
float4 rgba = DrawAreaUpscale(frag_in);
|
|
173
|
+
rgba.rgb *= multiplier;
|
|
174
|
+
rgba.rgb = rec709_to_rec2020(rgba.rgb);
|
|
175
|
+
rgba.rgb = reinhard(rgba.rgb);
|
|
176
|
+
rgba.rgb = rec2020_to_rec709(rgba.rgb);
|
|
177
|
+
return rgba;
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
technique Draw
|
|
181
|
+
{
|
|
182
|
+
pass
|
|
183
|
+
{
|
|
184
|
+
vertex_shader = VSDefault(vert_in);
|
|
185
|
+
pixel_shader = PSDrawAreaRGBA(frag_in);
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
technique DrawMultiply
|
|
190
|
+
{
|
|
191
|
+
pass
|
|
192
|
+
{
|
|
193
|
+
vertex_shader = VSDefault(vert_in);
|
|
194
|
+
pixel_shader = PSDrawAreaRGBAMultiply(frag_in);
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
technique DrawTonemap
|
|
199
|
+
{
|
|
200
|
+
pass
|
|
201
|
+
{
|
|
202
|
+
vertex_shader = VSDefault(vert_in);
|
|
203
|
+
pixel_shader = PSDrawAreaRGBATonemap(frag_in);
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
technique DrawMultiplyTonemap
|
|
208
|
+
{
|
|
209
|
+
pass
|
|
210
|
+
{
|
|
211
|
+
vertex_shader = VSDefault(vert_in);
|
|
212
|
+
pixel_shader = PSDrawAreaRGBAMultiplyTonemap(frag_in);
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
technique DrawUpscale
|
|
217
|
+
{
|
|
218
|
+
pass
|
|
219
|
+
{
|
|
220
|
+
vertex_shader = VSDefault(vert_in);
|
|
221
|
+
pixel_shader = PSDrawAreaRGBAUpscale(frag_in);
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
technique DrawUpscaleMultiply
|
|
226
|
+
{
|
|
227
|
+
pass
|
|
228
|
+
{
|
|
229
|
+
vertex_shader = VSDefault(vert_in);
|
|
230
|
+
pixel_shader = PSDrawAreaRGBAUpscaleMultiply(frag_in);
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
technique DrawUpscaleTonemap
|
|
235
|
+
{
|
|
236
|
+
pass
|
|
237
|
+
{
|
|
238
|
+
vertex_shader = VSDefault(vert_in);
|
|
239
|
+
pixel_shader = PSDrawAreaRGBAUpscaleTonemap(frag_in);
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
technique DrawUpscaleMultiplyTonemap
|
|
244
|
+
{
|
|
245
|
+
pass
|
|
246
|
+
{
|
|
247
|
+
vertex_shader = VSDefault(vert_in);
|
|
248
|
+
pixel_shader = PSDrawAreaRGBAUpscaleMultiplyTonemap(frag_in);
|
|
249
|
+
}
|
|
250
|
+
}
|
|
@@ -0,0 +1,236 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* bicubic sharper (better for downscaling)
|
|
3
|
+
* note - this shader is adapted from the GPL bsnes shader, very good stuff
|
|
4
|
+
* there.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
#include "color.effect"
|
|
8
|
+
|
|
9
|
+
uniform float4x4 ViewProj;
|
|
10
|
+
uniform texture2d image;
|
|
11
|
+
uniform float2 base_dimension;
|
|
12
|
+
uniform float2 base_dimension_i;
|
|
13
|
+
uniform float undistort_factor = 1.0;
|
|
14
|
+
uniform float multiplier;
|
|
15
|
+
|
|
16
|
+
sampler_state textureSampler {
|
|
17
|
+
Filter = Linear;
|
|
18
|
+
AddressU = Clamp;
|
|
19
|
+
AddressV = Clamp;
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
struct VertData {
|
|
23
|
+
float4 pos : POSITION;
|
|
24
|
+
float2 uv : TEXCOORD0;
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
struct VertOut {
|
|
28
|
+
float2 uv : TEXCOORD0;
|
|
29
|
+
float4 pos : POSITION;
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
struct FragData {
|
|
33
|
+
float2 uv : TEXCOORD0;
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
VertOut VSDefault(VertData v_in)
|
|
37
|
+
{
|
|
38
|
+
VertOut vert_out;
|
|
39
|
+
vert_out.uv = v_in.uv * base_dimension;
|
|
40
|
+
vert_out.pos = mul(float4(v_in.pos.xyz, 1.0), ViewProj);
|
|
41
|
+
return vert_out;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
float4 weight4(float x)
|
|
45
|
+
{
|
|
46
|
+
/* Sharper version. May look better in some cases. B=0, C=0.75 */
|
|
47
|
+
return float4(
|
|
48
|
+
((-0.75 * x + 1.5) * x - 0.75) * x,
|
|
49
|
+
(1.25 * x - 2.25) * x * x + 1.0,
|
|
50
|
+
((-1.25 * x + 1.5) * x + 0.75) * x,
|
|
51
|
+
(0.75 * x - 0.75) * x * x);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
float AspectUndistortX(float x, float a)
|
|
55
|
+
{
|
|
56
|
+
// The higher the power, the longer the linear part will be.
|
|
57
|
+
return (1.0 - a) * (x * x * x * x * x) + a * x;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
float AspectUndistortU(float u)
|
|
61
|
+
{
|
|
62
|
+
// Normalize texture coord to -1.0 to 1.0 range, and back.
|
|
63
|
+
return AspectUndistortX((u - 0.5) * 2.0, undistort_factor) * 0.5 + 0.5;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
float2 undistort_coord(float xpos, float ypos)
|
|
67
|
+
{
|
|
68
|
+
return float2(AspectUndistortU(xpos), ypos);
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
float4 undistort_pixel(float xpos, float ypos)
|
|
72
|
+
{
|
|
73
|
+
return image.Sample(textureSampler, undistort_coord(xpos, ypos));
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
float4 undistort_line(float4 xpos, float ypos, float4 rowtaps)
|
|
77
|
+
{
|
|
78
|
+
return undistort_pixel(xpos.x, ypos) * rowtaps.x +
|
|
79
|
+
undistort_pixel(xpos.y, ypos) * rowtaps.y +
|
|
80
|
+
undistort_pixel(xpos.z, ypos) * rowtaps.z +
|
|
81
|
+
undistort_pixel(xpos.w, ypos) * rowtaps.w;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
float4 DrawBicubic(FragData f_in, bool undistort)
|
|
85
|
+
{
|
|
86
|
+
float2 pos = f_in.uv;
|
|
87
|
+
float2 pos1 = floor(pos - 0.5) + 0.5;
|
|
88
|
+
float2 f = pos - pos1;
|
|
89
|
+
|
|
90
|
+
float4 rowtaps = weight4(f.x);
|
|
91
|
+
float4 coltaps = weight4(f.y);
|
|
92
|
+
|
|
93
|
+
float2 uv1 = pos1 * base_dimension_i;
|
|
94
|
+
float2 uv0 = uv1 - base_dimension_i;
|
|
95
|
+
float2 uv2 = uv1 + base_dimension_i;
|
|
96
|
+
float2 uv3 = uv2 + base_dimension_i;
|
|
97
|
+
|
|
98
|
+
if (undistort) {
|
|
99
|
+
float4 xpos = float4(uv0.x, uv1.x, uv2.x, uv3.x);
|
|
100
|
+
return undistort_line(xpos, uv0.y, rowtaps) * coltaps.x +
|
|
101
|
+
undistort_line(xpos, uv1.y, rowtaps) * coltaps.y +
|
|
102
|
+
undistort_line(xpos, uv2.y, rowtaps) * coltaps.z +
|
|
103
|
+
undistort_line(xpos, uv3.y, rowtaps) * coltaps.w;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
float u_weight_sum = rowtaps.y + rowtaps.z;
|
|
107
|
+
float u_middle_offset = rowtaps.z * base_dimension_i.x / u_weight_sum;
|
|
108
|
+
float u_middle = uv1.x + u_middle_offset;
|
|
109
|
+
|
|
110
|
+
float v_weight_sum = coltaps.y + coltaps.z;
|
|
111
|
+
float v_middle_offset = coltaps.z * base_dimension_i.y / v_weight_sum;
|
|
112
|
+
float v_middle = uv1.y + v_middle_offset;
|
|
113
|
+
|
|
114
|
+
int2 coord_top_left = int2(max(uv0 * base_dimension, 0.5));
|
|
115
|
+
int2 coord_bottom_right = int2(min(uv3 * base_dimension, base_dimension - 0.5));
|
|
116
|
+
|
|
117
|
+
float4 top = image.Load(int3(coord_top_left, 0)) * rowtaps.x;
|
|
118
|
+
top += image.Sample(textureSampler, float2(u_middle, uv0.y)) * u_weight_sum;
|
|
119
|
+
top += image.Load(int3(coord_bottom_right.x, coord_top_left.y, 0)) * rowtaps.w;
|
|
120
|
+
float4 total = top * coltaps.x;
|
|
121
|
+
|
|
122
|
+
float4 middle = image.Sample(textureSampler, float2(uv0.x, v_middle)) * rowtaps.x;
|
|
123
|
+
middle += image.Sample(textureSampler, float2(u_middle, v_middle)) * u_weight_sum;
|
|
124
|
+
middle += image.Sample(textureSampler, float2(uv3.x, v_middle)) * rowtaps.w;
|
|
125
|
+
total += middle * v_weight_sum;
|
|
126
|
+
|
|
127
|
+
float4 bottom = image.Load(int3(coord_top_left.x, coord_bottom_right.y, 0)) * rowtaps.x;
|
|
128
|
+
bottom += image.Sample(textureSampler, float2(u_middle, uv3.y)) * u_weight_sum;
|
|
129
|
+
bottom += image.Load(int3(coord_bottom_right, 0)) * rowtaps.w;
|
|
130
|
+
total += bottom * coltaps.w;
|
|
131
|
+
|
|
132
|
+
return total;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
float4 PSDrawBicubicRGBA(FragData f_in, bool undistort) : TARGET
|
|
136
|
+
{
|
|
137
|
+
return DrawBicubic(f_in, undistort);
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
float4 PSDrawBicubicRGBAMultiply(FragData f_in, bool undistort) : TARGET
|
|
141
|
+
{
|
|
142
|
+
float4 rgba = DrawBicubic(f_in, undistort);
|
|
143
|
+
rgba.rgb *= multiplier;
|
|
144
|
+
return rgba;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
float4 PSDrawBicubicRGBATonemap(FragData f_in, bool undistort) : TARGET
|
|
148
|
+
{
|
|
149
|
+
float4 rgba = DrawBicubic(f_in, undistort);
|
|
150
|
+
rgba.rgb = rec709_to_rec2020(rgba.rgb);
|
|
151
|
+
rgba.rgb = reinhard(rgba.rgb);
|
|
152
|
+
rgba.rgb = rec2020_to_rec709(rgba.rgb);
|
|
153
|
+
return rgba;
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
float4 PSDrawBicubicRGBAMultiplyTonemap(FragData f_in, bool undistort) : TARGET
|
|
157
|
+
{
|
|
158
|
+
float4 rgba = DrawBicubic(f_in, undistort);
|
|
159
|
+
rgba.rgb *= multiplier;
|
|
160
|
+
rgba.rgb = rec709_to_rec2020(rgba.rgb);
|
|
161
|
+
rgba.rgb = reinhard(rgba.rgb);
|
|
162
|
+
rgba.rgb = rec2020_to_rec709(rgba.rgb);
|
|
163
|
+
return rgba;
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
technique Draw
|
|
167
|
+
{
|
|
168
|
+
pass
|
|
169
|
+
{
|
|
170
|
+
vertex_shader = VSDefault(v_in);
|
|
171
|
+
pixel_shader = PSDrawBicubicRGBA(f_in, false);
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
technique DrawMultiply
|
|
176
|
+
{
|
|
177
|
+
pass
|
|
178
|
+
{
|
|
179
|
+
vertex_shader = VSDefault(v_in);
|
|
180
|
+
pixel_shader = PSDrawBicubicRGBAMultiply(f_in, false);
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
technique DrawTonemap
|
|
185
|
+
{
|
|
186
|
+
pass
|
|
187
|
+
{
|
|
188
|
+
vertex_shader = VSDefault(v_in);
|
|
189
|
+
pixel_shader = PSDrawBicubicRGBATonemap(f_in, false);
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
technique DrawMultiplyTonemap
|
|
194
|
+
{
|
|
195
|
+
pass
|
|
196
|
+
{
|
|
197
|
+
vertex_shader = VSDefault(v_in);
|
|
198
|
+
pixel_shader = PSDrawBicubicRGBAMultiplyTonemap(f_in, false);
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
technique DrawUndistort
|
|
203
|
+
{
|
|
204
|
+
pass
|
|
205
|
+
{
|
|
206
|
+
vertex_shader = VSDefault(v_in);
|
|
207
|
+
pixel_shader = PSDrawBicubicRGBA(f_in, true);
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
technique DrawUndistortMultiply
|
|
212
|
+
{
|
|
213
|
+
pass
|
|
214
|
+
{
|
|
215
|
+
vertex_shader = VSDefault(v_in);
|
|
216
|
+
pixel_shader = PSDrawBicubicRGBAMultiply(f_in, true);
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
technique DrawUndistortTonemap
|
|
221
|
+
{
|
|
222
|
+
pass
|
|
223
|
+
{
|
|
224
|
+
vertex_shader = VSDefault(v_in);
|
|
225
|
+
pixel_shader = PSDrawBicubicRGBATonemap(f_in, true);
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
technique DrawUndistortMultiplyTonemap
|
|
230
|
+
{
|
|
231
|
+
pass
|
|
232
|
+
{
|
|
233
|
+
vertex_shader = VSDefault(v_in);
|
|
234
|
+
pixel_shader = PSDrawBicubicRGBAMultiplyTonemap(f_in, true);
|
|
235
|
+
}
|
|
236
|
+
}
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* bilinear low res scaling, samples 8 pixels of a larger image to scale to a
|
|
3
|
+
* low resolution image below half size
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
#include "color.effect"
|
|
7
|
+
|
|
8
|
+
uniform float4x4 ViewProj;
|
|
9
|
+
uniform texture2d image;
|
|
10
|
+
uniform float multiplier;
|
|
11
|
+
|
|
12
|
+
sampler_state textureSampler {
|
|
13
|
+
Filter = Linear;
|
|
14
|
+
AddressU = Clamp;
|
|
15
|
+
AddressV = Clamp;
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
struct VertData {
|
|
19
|
+
float4 pos : POSITION;
|
|
20
|
+
float2 uv : TEXCOORD0;
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
VertData VSDefault(VertData v_in)
|
|
24
|
+
{
|
|
25
|
+
VertData vert_out;
|
|
26
|
+
vert_out.pos = mul(float4(v_in.pos.xyz, 1.0), ViewProj);
|
|
27
|
+
vert_out.uv = v_in.uv;
|
|
28
|
+
return vert_out;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
float4 pixel(float2 uv)
|
|
32
|
+
{
|
|
33
|
+
return image.Sample(textureSampler, uv);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
float4 DrawLowresBilinear(VertData f_in)
|
|
37
|
+
{
|
|
38
|
+
float2 uv = f_in.uv;
|
|
39
|
+
float2 stepxy = float2(ddx(uv.x), ddy(uv.y));
|
|
40
|
+
float2 stepxy1 = stepxy * 0.0625;
|
|
41
|
+
float2 stepxy3 = stepxy * 0.1875;
|
|
42
|
+
float2 stepxy5 = stepxy * 0.3125;
|
|
43
|
+
float2 stepxy7 = stepxy * 0.4375;
|
|
44
|
+
|
|
45
|
+
// Simulate Direct3D 8-sample pattern
|
|
46
|
+
float4 out_color;
|
|
47
|
+
out_color = pixel(uv + float2( stepxy1.x, -stepxy3.y));
|
|
48
|
+
out_color += pixel(uv + float2(-stepxy1.x, stepxy3.y));
|
|
49
|
+
out_color += pixel(uv + float2( stepxy5.x, stepxy1.y));
|
|
50
|
+
out_color += pixel(uv + float2(-stepxy3.x, -stepxy5.y));
|
|
51
|
+
out_color += pixel(uv + float2(-stepxy5.x, stepxy5.y));
|
|
52
|
+
out_color += pixel(uv + float2(-stepxy7.x, -stepxy1.y));
|
|
53
|
+
out_color += pixel(uv + float2( stepxy3.x, stepxy7.y));
|
|
54
|
+
out_color += pixel(uv + float2( stepxy7.x, -stepxy7.y));
|
|
55
|
+
return out_color * 0.125;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
float4 PSDrawLowresBilinearRGBA(VertData f_in) : TARGET
|
|
59
|
+
{
|
|
60
|
+
return DrawLowresBilinear(f_in);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
float4 PSDrawLowresBilinearRGBAMultiply(VertData f_in) : TARGET
|
|
64
|
+
{
|
|
65
|
+
float4 rgba = DrawLowresBilinear(f_in);
|
|
66
|
+
rgba.rgb *= multiplier;
|
|
67
|
+
return rgba;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
float4 PSDrawLowresBilinearRGBATonemap(VertData f_in) : TARGET
|
|
71
|
+
{
|
|
72
|
+
float4 rgba = DrawLowresBilinear(f_in);
|
|
73
|
+
rgba.rgb = rec709_to_rec2020(rgba.rgb);
|
|
74
|
+
rgba.rgb = reinhard(rgba.rgb);
|
|
75
|
+
rgba.rgb = rec2020_to_rec709(rgba.rgb);
|
|
76
|
+
return rgba;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
float4 PSDrawLowresBilinearRGBAMultiplyTonemap(VertData f_in) : TARGET
|
|
80
|
+
{
|
|
81
|
+
float4 rgba = DrawLowresBilinear(f_in);
|
|
82
|
+
rgba.rgb *= multiplier;
|
|
83
|
+
rgba.rgb = rec709_to_rec2020(rgba.rgb);
|
|
84
|
+
rgba.rgb = reinhard(rgba.rgb);
|
|
85
|
+
rgba.rgb = rec2020_to_rec709(rgba.rgb);
|
|
86
|
+
return rgba;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
technique Draw
|
|
90
|
+
{
|
|
91
|
+
pass
|
|
92
|
+
{
|
|
93
|
+
vertex_shader = VSDefault(v_in);
|
|
94
|
+
pixel_shader = PSDrawLowresBilinearRGBA(f_in);
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
technique DrawMultiply
|
|
99
|
+
{
|
|
100
|
+
pass
|
|
101
|
+
{
|
|
102
|
+
vertex_shader = VSDefault(v_in);
|
|
103
|
+
pixel_shader = PSDrawLowresBilinearRGBAMultiply(f_in);
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
technique DrawTonemap
|
|
108
|
+
{
|
|
109
|
+
pass
|
|
110
|
+
{
|
|
111
|
+
vertex_shader = VSDefault(v_in);
|
|
112
|
+
pixel_shader = PSDrawLowresBilinearRGBATonemap(f_in);
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
technique DrawMultiplyTonemap
|
|
117
|
+
{
|
|
118
|
+
pass
|
|
119
|
+
{
|
|
120
|
+
vertex_shader = VSDefault(v_in);
|
|
121
|
+
pixel_shader = PSDrawLowresBilinearRGBAMultiplyTonemap(f_in);
|
|
122
|
+
}
|
|
123
|
+
}
|