ffmpeg: refactor so swscale is an optional step before glsl
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
uniform sampler2D ove_maintex;
|
||||
|
||||
uniform int interlacing;
|
||||
uniform int pixel_height;
|
||||
|
||||
in vec2 ove_texcoord;
|
||||
out vec4 frag_color;
|
||||
|
||||
void main() {
|
||||
vec2 real_coord = ove_texcoord;
|
||||
if (interlacing != 0) {
|
||||
float field_height = float(pixel_height / 2);
|
||||
real_coord.y = floor(real_coord.y * field_height) + 0.25;
|
||||
if (interlacing == 2) {
|
||||
real_coord.y += 0.5;
|
||||
}
|
||||
real_coord.y /= field_height;
|
||||
}
|
||||
|
||||
frag_color = texture(ove_maintex, real_coord);
|
||||
}
|
||||
@@ -10,29 +10,16 @@ uniform float yuv_cgu;
|
||||
uniform float yuv_cgv;
|
||||
uniform float yuv_cbu;
|
||||
|
||||
uniform int interlacing;
|
||||
uniform int pixel_height;
|
||||
|
||||
in vec2 ove_texcoord;
|
||||
out vec4 frag_color;
|
||||
|
||||
void main()
|
||||
{
|
||||
vec2 real_coord = ove_texcoord;
|
||||
if (interlacing != 0) {
|
||||
float field_height = float(pixel_height / 2);
|
||||
real_coord.y = floor(real_coord.y * field_height) + 0.25;
|
||||
if (interlacing == 2) {
|
||||
real_coord.y += 0.5;
|
||||
}
|
||||
real_coord.y /= field_height;
|
||||
}
|
||||
|
||||
// Sample YUV planes
|
||||
vec3 yuv;
|
||||
yuv.r = texture(y_channel, real_coord).r;
|
||||
yuv.g = texture(u_channel, real_coord).r;
|
||||
yuv.b = texture(v_channel, real_coord).r;
|
||||
yuv.r = texture(y_channel, ove_texcoord).r;
|
||||
yuv.g = texture(u_channel, ove_texcoord).r;
|
||||
yuv.b = texture(v_channel, ove_texcoord).r;
|
||||
|
||||
// Pixels will have come in aligned to 16-bit regardless of their actual bit depth, so they must
|
||||
// be scaled as if they were actually 16-bit
|
||||
|
||||
Reference in New Issue
Block a user