+\r
\r
" \n"\r
- "//http://slouken.blogspot.com/2011/02/mpeg-acceleration-with-glsl.html \n"\r
- "vec4 ycbcra_to_rgba_sd(float y, float cb, float cr, float a) \n"\r
+ "vec4 ycbcra_to_rgba_sd(float Y, float Cb, float Cr, float A) \n"\r
"{ \n"\r
- " // YUV offset \n"\r
- " const vec3 offset = vec3(-0.0625, -0.5, -0.5); \n"\r
- " \n"\r
- " // RGB coefficients \n"\r
- " const vec3 Rcoeff = vec3(1.164, 0.000, 1.596); \n"\r
- " const vec3 Gcoeff = vec3(1.164, -0.391, -0.813); \n"\r
- " const vec3 Bcoeff = vec3(1.164, 2.018, 0.000); \n"\r
- " \n"\r
- " vec3 yuv = vec3(y, cr, cb); \n"\r
" vec4 rgba; \n"\r
- " \n"\r
- " yuv += offset; \n"\r
- " rgba.r = dot(yuv, Rcoeff); \n"\r
- " rgba.g = dot(yuv, Gcoeff); \n"\r
- " rgba.b = dot(yuv, Bcoeff); \n"\r
- " rgba.a = a; \n"\r
- " \n"\r
- " return rgba; \n"\r
+ " rgba.b = (1.164*(Y*255 - 16) + 1.596*(Cr*255 - 128))/255; \n"\r
+ " rgba.g = (1.164*(Y*255 - 16) - 0.813*(Cr*255 - 128) - 0.391*(Cb*255 - 128))/255;\n"\r
+ " rgba.r = (1.164*(Y*255 - 16) + 2.018*(Cb*255 - 128))/255; \n"\r
+ " rgba.a = A; \n"\r
+ " return rgba; \n" \r
"} \n" \r
" \n"\r
- "vec4 ycbcra_to_rgba_hd(float y, float cb, float cr, float a) \n"\r
+ "vec4 ycbcra_to_rgba_hd(float Y, float Cb, float Cr, float A) \n"\r
"{ \n"\r
- " // YUV offset \n"\r
- " const vec3 offset = vec3(-0.0625, -0.5, -0.5); \n"\r
- " \n"\r
- " // RGB coefficients \n"\r
- " const vec3 Rcoeff = vec3(1.164, 0.000, 1.793); \n"\r
- " const vec3 Gcoeff = vec3(1.164, -0.213, -0.534); \n"\r
- " const vec3 Bcoeff = vec3(1.164, 2.115, 0.000); \n"\r
- " \n"\r
- " vec3 yuv = vec3(y, cr, cb); \n"\r
" vec4 rgba; \n"\r
- " \n"\r
- " yuv += offset; \n"\r
- " rgba.r = dot(yuv, Rcoeff); \n"\r
- " rgba.g = dot(yuv, Gcoeff); \n"\r
- " rgba.b = dot(yuv, Bcoeff); \n"\r
- " rgba.a = a; \n"\r
- " \n"\r
+ " rgba.b = (1.164*(Y*255 - 16) + 1.793*(Cr*255 - 128))/255; \n"\r
+ " rgba.g = (1.164*(Y*255 - 16) - 0.534*(Cr*255 - 128) - 0.213*(Cb*255 - 128))/255;\n"\r
+ " rgba.r = (1.164*(Y*255 - 16) + 2.115*(Cb*255 - 128))/255; \n"\r
+ " rgba.a = A; \n"\r
" return rgba; \n"\r
- "} \n" \r
+ "} \n" \r
" \n" \r
"vec4 ycbcra_to_rgba(float y, float cb, float cr, float a) \n"\r
"{ \n"\r