From: cedric Date: Wed, 5 Oct 2011 10:16:25 +0000 (+0000) Subject: evas: fix shader for nv12. X-Git-Tag: accepted/2.0/20130306.225542~195^2~103 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=6094c55dd203d299f0945b32212c12f8edeb1496;p=profile%2Fivi%2Fevas.git evas: fix shader for nv12. git-svn-id: svn+ssh://svn.enlightenment.org/var/svn/e/trunk/evas@63835 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33 --- diff --git a/src/modules/engines/gl_common/Makefile.am b/src/modules/engines/gl_common/Makefile.am index aeae77d..15acc02 100644 --- a/src/modules/engines/gl_common/Makefile.am +++ b/src/modules/engines/gl_common/Makefile.am @@ -143,5 +143,22 @@ shader/filter_sepia_bgra_nomul.shd \ shader/filter_blur.shd \ shader/filter_blur_nomul.shd \ shader/filter_blur_bgra.shd \ -shader/filter_blur_bgra_nomul.shd +shader/filter_blur_bgra_nomul.shd \ +shader/nv12_frag.h \ +shader/nv12_frag.shd \ +shader/nv12_nomul_frag.h \ +shader/nv12_nomul_frag.shd \ +shader/nv12_nomul_vert.h \ +shader/nv12_nomul_vert.shd \ +shader/nv12_vert.h \ +shader/nv12_vert.shd \ +shader/yuy2_frag.h \ +shader/yuy2_frag.shd \ +shader/yuy2_nomul_frag.h \ +shader/yuy2_nomul_frag.shd \ +shader/yuy2_nomul_vert.h \ +shader/yuy2_nomul_vert.shd \ +shader/yuy2_vert.h \ +shader/yuy2_vert.shd + diff --git a/src/modules/engines/gl_common/shader/compile-s3c6410.sh b/src/modules/engines/gl_common/shader/compile-s3c6410.sh index 90ec941..450e5de 100755 --- a/src/modules/engines/gl_common/shader/compile-s3c6410.sh +++ b/src/modules/engines/gl_common/shader/compile-s3c6410.sh @@ -40,4 +40,8 @@ compile yuv compile yuv_nomul compile tex compile tex_nomul +compile nv12 +compile nv12_nomul +compile yuy2 +compile yuy2_nomul ## FIXME: compile filter_* diff --git a/src/modules/engines/gl_common/shader/nv12_frag.shd b/src/modules/engines/gl_common/shader/nv12_frag.shd new file mode 100644 index 0000000..b3ee780 --- /dev/null +++ b/src/modules/engines/gl_common/shader/nv12_frag.shd @@ -0,0 +1,27 @@ +#ifdef GL_ES +precision mediump float; +#endif +uniform sampler2D tex, texuv; +varying vec4 col; +varying vec2 tex_c, tex_cuv; +void main() +{ + float y,u,v,vmu,r,g,b; + y=texture2D(tex,tex_c).g; + u=texture2D(texuv,tex_cuv).g; + v=texture2D(texuv,tex_cuv).a; + + u=u-0.5; + v=v-0.5; + vmu=v*0.813+u*0.391; + u=u*2.018; + v=v*1.596; + y=(y-0.062)*1.164; + + r=y+v; + g=y-vmu; + b=y+u; + + gl_FragColor=vec4(r,g,b,1.0) * col; +} + diff --git a/src/modules/engines/gl_common/shader/nv12_nomul_frag.shd b/src/modules/engines/gl_common/shader/nv12_nomul_frag.shd new file mode 100644 index 0000000..9d325b6 --- /dev/null +++ b/src/modules/engines/gl_common/shader/nv12_nomul_frag.shd @@ -0,0 +1,27 @@ +#ifdef GL_ES +precision mediump float; +#endif +uniform sampler2D tex, texuv; +varying vec2 tex_c, tex_cuv; +void main() +{ + float y,u,v,vmu,r,g,b; + y=texture2D(tex,tex_c).g; + u=texture2D(texuv,tex_cuv).g; + v=texture2D(texuv,tex_cuv).a; + + u=u-0.5; + v=v-0.5; + vmu=v*0.813+u*0.391; + u=u*2.018; + v=v*1.596; + y=(y-0.062)*1.164; + + r=y+v; + g=y-vmu; + b=y+u; + + gl_FragColor=vec4(r,g,b,1.0); +} + + diff --git a/src/modules/engines/gl_common/shader/nv12_nomul_vert.shd b/src/modules/engines/gl_common/shader/nv12_nomul_vert.shd index b61c3c3..2d7567b 100644 --- a/src/modules/engines/gl_common/shader/nv12_nomul_vert.shd +++ b/src/modules/engines/gl_common/shader/nv12_nomul_vert.shd @@ -10,5 +10,5 @@ void main() { gl_Position = mvp * vertex; tex_y = tex_coord; - tex_cuv = tex_coord2; + tex_cuv = tex_coord2 * 0.5; } diff --git a/src/modules/engines/gl_common/shader/nv12_vert.shd b/src/modules/engines/gl_common/shader/nv12_vert.shd index 68934e9..f8204c7 100644 --- a/src/modules/engines/gl_common/shader/nv12_vert.shd +++ b/src/modules/engines/gl_common/shader/nv12_vert.shd @@ -12,5 +12,5 @@ void main() gl_Position = mvp * vertex; col = color; tex_y = tex_coord; - tex_cuv = tex_coord2; + tex_cuv = tex_coord2 * 0.5; }