其他分享
首页 > 其他分享> > YV12 YUV转RGB

YV12 YUV转RGB

作者:互联网

const char fragmentShader_yuv420p[] =
{
"precision mediump float;\n"
"uniform sampler2D Ytex;\n"
"uniform sampler2D Utex,Vtex;\n"
"varying vec2 vTextureCoord;\n"
"void main(void) {\n"
" float nx,ny,r,g,b,y,u,v;\n"
" mediump vec4 txl,ux,vx;"
" nx=vTextureCoord[0];\n"
" ny=vTextureCoord[1];\n"
" y=texture2D(Ytex,vec2(nx,ny)).r;\n"
" u=texture2D(Utex,vec2(nx,ny)).r;\n"
" v=texture2D(Vtex,vec2(nx,ny)).r;\n"

" y=1.1643*(y-0.0625);\n"
" u=u-0.5;\n"
" v=v-0.5;\n"

" r=y+1.5958*v;\n"
" g=y-0.39173*u-0.81290*v;\n"
" b=y+2.017*u;\n"
" gl_FragColor=vec4(r,g,b,1.0);\n"
"}\n"
};

https://bbs.csdn.net/topics/390408474?list=lz

标签:YV12,float,YUV,nx,ny,RGB,vec2,texture2D,vTextureCoord
来源: https://www.cnblogs.com/8335IT/p/16446477.html