Merge pull request #887 from sobotka/patch-3
Update coefficients from busted up REC.601
This commit is contained in:
@@ -0,0 +1,59 @@
|
|||||||
|
/***
|
||||||
|
Despill - for cleaning up keying residue.
|
||||||
|
Written by unfa for Olive Video Editor.
|
||||||
|
***/
|
||||||
|
|
||||||
|
uniform sampler2D tex;
|
||||||
|
varying vec2 uTexCoord;
|
||||||
|
uniform vec2 resolution;
|
||||||
|
uniform int channel;
|
||||||
|
|
||||||
|
const vec2 renderScale = vec2(1,1);
|
||||||
|
|
||||||
|
void main(void)
|
||||||
|
{
|
||||||
|
vec2 uv = gl_FragCoord.xy/resolution.xy;
|
||||||
|
|
||||||
|
vec4 col = texture2D(tex, uv);
|
||||||
|
|
||||||
|
// separate channels
|
||||||
|
|
||||||
|
float r = col.r;
|
||||||
|
float g = col.g;
|
||||||
|
float b = col.b;
|
||||||
|
float a = col.a;
|
||||||
|
|
||||||
|
// Select despilled channel: 0 = RED; 1 = GREEN; 2 = BLUE;
|
||||||
|
|
||||||
|
if (channel == 0) // RED
|
||||||
|
{
|
||||||
|
// replace new green channel by avaraging between existing red and blue channels
|
||||||
|
float r2 = (g + b) * 0.5;
|
||||||
|
|
||||||
|
// now composite the original and new gree channel using the "darken" mode
|
||||||
|
r = min(r, r2);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (channel == 1) // GREEN
|
||||||
|
{
|
||||||
|
// replace new green channel by avaraging between existing red and blue channels
|
||||||
|
float g2 = (r + b) * 0.5;
|
||||||
|
|
||||||
|
// now composite the original and new gree channel using the "darken" mode
|
||||||
|
g = min(g, g2);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (channel == 2) // BLUE
|
||||||
|
{
|
||||||
|
// replace new green channel by avaraging between existing red and blue channels
|
||||||
|
float b2 = (r + g) * 0.5;
|
||||||
|
|
||||||
|
// now composite the original and new gree channel using the "darken" mode
|
||||||
|
b = min(b, b2);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// and return the result
|
||||||
|
|
||||||
|
gl_FragColor = vec4(r, g, b, a);
|
||||||
|
}
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<effect name="Despill" category="Keying">
|
||||||
|
<row name="Channel">
|
||||||
|
<field type="combo" default="1" id="channel">
|
||||||
|
<option>Red</option>
|
||||||
|
<option>Green</option>
|
||||||
|
<option>Blue</option>
|
||||||
|
</field>
|
||||||
|
</row>
|
||||||
|
<shader vert="../COMMON/common.vert" frag="despill.frag"/>
|
||||||
|
</effect>
|
||||||
@@ -13,6 +13,9 @@ uniform float tolb;
|
|||||||
uniform bool opt;
|
uniform bool opt;
|
||||||
uniform int mode;
|
uniform int mode;
|
||||||
|
|
||||||
|
float rgb2y (vec3 c) {
|
||||||
|
/*a utility function to convert colors in RGB into YCbCr*/
|
||||||
|
|
||||||
// This isn’t colour managed and is a huge mess, but in the
|
// This isn’t colour managed and is a huge mess, but in the
|
||||||
// short term, using correct weights will give significantly
|
// short term, using correct weights will give significantly
|
||||||
// more ideal results. The correct weights for REC.709 are
|
// more ideal results. The correct weights for REC.709 are
|
||||||
|
|||||||
Reference in New Issue
Block a user