gpt-3.5-turbo-0301· openai
Suzhen/CodeChat
基于C语言和opengl es3.2版本实现NV12转换成RGB的着色器程序
- User
基于C语言和opengl es3.2版本实现NV12转换成RGB的着色器程序
- Assistant
以下是基于C语言和OpenGL ES3.2实现的NV12转换成RGB的着色器程序:
顶点着色器代码:
#version 320 es in vec4 a_position; in vec2 a_texcoord; out vec2 v_texcoord; void main() { gl_Position = a_position; v_texcoord = a_texcoord; }片段着色器代码:
#version 320 es precision highp float; in vec2 v_texcoord; uniform sampler2D u_y_texture; uniform sampler2D u_uv_texture; out vec4 o_color; void main() { float y = texture(u_y_texture, v_texcoord).r; vec2 uv = texture(u_uv_texture, v_texcoord).rg - vec2(0.5, 0.5); float u = uv.x; float v = uv.y; float r = y + 1.370705 * v; float g = y - 0.698001 * v - 0.337633 * u; float b = y + 1.732446 * u; o_color = vec4(r, g, b, 1.0); }
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.