import { Size } from '../math/Size'; import Program from './Program'; import Texture from './Texture'; export declare const FRAGMENT_YUV_TO_RGB: { readonly type: "x-shader/x-fragment"; readonly source: "\n precision mediump float;\n\n varying vec2 v_texCoord;\n\n uniform sampler2D yTexture;\n uniform sampler2D uTexture;\n uniform sampler2D vTexture;\n\n const vec3 yuv_bt709_offset = vec3(-0.0625, -0.5, -0.5);\n const vec3 yuv_bt709_rcoeff = vec3(1.164, 0.000, 1.787);\n const vec3 yuv_bt709_gcoeff = vec3(1.164,-0.213,-0.531);\n const vec3 yuv_bt709_bcoeff = vec3(1.164,2.112, 0.000);\n \n vec3 yuv_to_rgb (vec3 val, vec3 offset, vec3 ycoeff, vec3 ucoeff, vec3 vcoeff) {\n vec3 rgb; \n val += offset; \n rgb.r = dot(val, ycoeff);\n rgb.g = dot(val, ucoeff);\n rgb.b = dot(val, vcoeff);\n return rgb;\n }\n\n void main(void) {\n vec4 texel, rgba;\n \n texel.x = texture2D(yTexture, v_texCoord).r;\n texel.y = texture2D(uTexture, v_texCoord).r;\n texel.z = texture2D(vTexture, v_texCoord).r;\n\n rgba.rgb = yuv_to_rgb (texel.xyz, yuv_bt709_offset, yuv_bt709_rcoeff, yuv_bt709_gcoeff, yuv_bt709_bcoeff);\n rgba.a = 1.0;\n gl_FragColor=rgba;\n }\n"; }; declare type ShaderArgs = { yTexture: WebGLUniformLocation; uTexture: WebGLUniformLocation; vTexture: WebGLUniformLocation; a_position: GLint; a_texCoord: GLint; }; declare class YUV2RGBShader { readonly gl: WebGLRenderingContext; readonly vertexBuffer: WebGLBuffer; readonly shaderArgs: ShaderArgs; readonly program: Program; static create(gl: WebGLRenderingContext): YUV2RGBShader; private constructor(); setTexture(textureY: Texture, textureU: Texture, textureV: Texture): void; use(): void; release(): void; updateShaderData(encodedFrameSize: Size, maxXTexCoord: number, maxYTexCoord: number): void; draw(): void; } export default YUV2RGBShader;