Go to the documentation of this file.
19 #ifndef AVFILTER_VSRC_GFXCAPTURE_SHADER_H
20 #define AVFILTER_VSRC_GFXCAPTURE_SHADER_H
22 #define HLSL_SHADER(shader) #shader
30 cbuffer
cb :
register(
b0) {
40 Texture2D t0 :
register(t0);
41 SamplerState s0 :
register(s0);
43 VSOut main_vs(uint
id : SV_VertexID) {
45 o.pos =
float4(
id == 2 ? 3.0 : -1.0,
id == 1 ? 3.0 : -1.0, 0, 1);
46 o.uv =
lerp(uvMin, uvMax,
float2((o.pos.x + 1) * 0.5, 1 - (o.pos.y + 1) * 0.5));
54 float y =
s.y - 4.0 *
s.x;
55 float z =
s.z - 4.0 *
s.y + 6.0 *
s.x;
56 float w = 6.0 - x - y - z;
57 return float4(x, y, z,
w) * (1.0 / 6.0);
79 float sx =
s.x / (
s.x +
s.y);
80 float sy =
s.z / (
s.z +
s.w);
87 return float4(0.0, 0.0, 0.0, 0.0);
95 float3 linear_to_srgb(float3
c) {
97 float3 lo = 12.92 *
c;
98 float3 hi = 1.055 * pow(
c, 1.0 / 2.4) - 0.055;
103 if (to_unpremult || to_srgb)
104 c = unpremultiply(
c);
106 c.rgb = linear_to_srgb(
c.rgb);
113 float4 main_ps(VSOut
i) : SV_Target {
114 return fix_color(t0.Sample(s0,
i.uv));
117 float4 main_ps_bicubic(VSOut
i) : SV_Target {
120 return fix_color(texBicubic(t0, s0,
i.uv));
static double cb(void *priv, double x, double y)
trying all byte sequences megabyte in length and selecting the best looking sequence will yield cases to try But a word about which is also called distortion Distortion can be quantified by almost any quality measurement one chooses the sum of squared differences is used but more complex methods that consider psychovisual effects can be used as well It makes no difference in this discussion First step
#define ss(width, name, subs,...)
static const char render_shader_src[]
#define HLSL_SHADER(shader)
static float saturate(float input)
Undefined Behavior In the C some operations are like signed integer dereferencing freed accessing outside allocated Undefined Behavior must not occur in a C it is not safe even if the output of undefined operations is unused The unsafety may seem nit picking but Optimizing compilers have in fact optimized code on the assumption that no undefined Behavior occurs Optimizing code based on wrong assumptions can and has in some cases lead to effects beyond the output of computations The signed integer overflow problem in speed critical code Code which is highly optimized and works with signed integers sometimes has the problem that often the output of the computation does not c
static double lerp(double a, double b, double x)
#define i(width, name, range_min, range_max)
static double b0(void *priv, double x, double y)