summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarsten Haitzler (Rasterman) <raster@rasterman.com>2015-05-27 20:17:20 +0900
committerCarsten Haitzler (Rasterman) <raster@rasterman.com>2015-05-27 20:19:46 +0900
commitcc49c1702b64152144a1fc6534ba9de71a61d4ba (patch)
treef3d162a6c39c42ebf1b8a24e23fc20c361de2591
parent80000e993e779caf4317cd595c6c4593d2db8857 (diff)
evas - fix yuv support to no longer ignore 709 colorspace params
if yuou use 709 instead of 601 yuv (ycbcr) evas will just be wrong and use 601. this fixes that and implements 709. it also fixes a scaling bug for yuv in the gl engine. no one noticed but me, so i won't call this a bug fix, and it can go into the next efl release - no need to backport unless it actually bothers peolpe (which it seemingly doesn't)
-rw-r--r--src/lib/evas/canvas/evas_object_image.c2
-rw-r--r--src/lib/evas/common/evas_convert_colorspace.c2
-rw-r--r--src/lib/evas/common/evas_convert_yuv.c454
-rw-r--r--src/lib/evas/common/evas_convert_yuv.h4
-rw-r--r--src/lib/evas/common/evas_image_main.c33
-rw-r--r--src/modules/evas/engines/gl_common/evas_gl_common.h10
-rw-r--r--src/modules/evas/engines/gl_common/evas_gl_context.c104
-rw-r--r--src/modules/evas/engines/gl_common/evas_gl_image.c32
-rw-r--r--src/modules/evas/engines/gl_common/evas_gl_texture.c2
-rw-r--r--src/modules/evas/engines/gl_common/shader/evas_gl_enum.x46
-rw-r--r--src/modules/evas/engines/gl_common/shader/evas_gl_shaders.x948
-rw-r--r--src/modules/evas/engines/gl_common/shader/fragment.glsl35
-rw-r--r--src/modules/evas/engines/gl_common/shader/shaders.txt15
13 files changed, 1585 insertions, 102 deletions
diff --git a/src/lib/evas/canvas/evas_object_image.c b/src/lib/evas/canvas/evas_object_image.c
index 366e341e94..b3d6fb6fc2 100644
--- a/src/lib/evas/canvas/evas_object_image.c
+++ b/src/lib/evas/canvas/evas_object_image.c
@@ -1697,7 +1697,7 @@ _evas_image_pixels_import(Eo *eo_obj, Evas_Image_Data *o, Evas_Pixel_Import_Sour
1697 1697
1698 o->engine_data = ENFN->image_data_get(ENDT, o->engine_data, 1, &image_pixels,&o->load_error); 1698 o->engine_data = ENFN->image_data_get(ENDT, o->engine_data, 1, &image_pixels,&o->load_error);
1699 if (image_pixels) 1699 if (image_pixels)
1700 evas_common_convert_yuv_420p_601_rgba((DATA8 **) pixels->rows, (DATA8 *) image_pixels, o->cur->image.w, o->cur->image.h); 1700 evas_common_convert_yuv_422p_601_rgba((DATA8 **) pixels->rows, (DATA8 *) image_pixels, o->cur->image.w, o->cur->image.h);
1701 if (o->engine_data) 1701 if (o->engine_data)
1702 o->engine_data = ENFN->image_data_put(ENDT, o->engine_data, image_pixels); 1702 o->engine_data = ENFN->image_data_put(ENDT, o->engine_data, image_pixels);
1703 if (o->engine_data) 1703 if (o->engine_data)
diff --git a/src/lib/evas/common/evas_convert_colorspace.c b/src/lib/evas/common/evas_convert_colorspace.c
index 77d1cb1876..0536380897 100644
--- a/src/lib/evas/common/evas_convert_colorspace.c
+++ b/src/lib/evas/common/evas_convert_colorspace.c
@@ -131,7 +131,7 @@ evas_common_convert_yuv_422P_601_to(void *data, int w, int h, Evas_Colorspace cs
131 dst = malloc(sizeof (unsigned int) * w * h); 131 dst = malloc(sizeof (unsigned int) * w * h);
132 if (!dst) return NULL; 132 if (!dst) return NULL;
133 133
134 evas_common_convert_yuv_420p_601_rgba(data, dst, w, h); 134 evas_common_convert_yuv_422p_601_rgba(data, dst, w, h);
135 return dst; 135 return dst;
136 } 136 }
137 default: 137 default:
diff --git a/src/lib/evas/common/evas_convert_yuv.c b/src/lib/evas/common/evas_convert_yuv.c
index b7e98e2325..9d2e8fff17 100644
--- a/src/lib/evas/common/evas_convert_yuv.c
+++ b/src/lib/evas/common/evas_convert_yuv.c
@@ -16,12 +16,17 @@
16#endif 16#endif
17 17
18static void _evas_yuv_init (void); 18static void _evas_yuv_init (void);
19// Broken atm - the sse and mmx get math.. wrong :(
20//static void _evas_yv12_709torgb_sse(unsigned char **yuv, unsigned char *rgb, int w, int h);
19static void _evas_yv12torgb_sse (unsigned char **yuv, unsigned char *rgb, int w, int h); 21static void _evas_yv12torgb_sse (unsigned char **yuv, unsigned char *rgb, int w, int h);
22// Broken atm - the sse and mmx get math.. wrong :(
23//static void _evas_yv12_709torgb_mmx(unsigned char **yuv, unsigned char *rgb, int w, int h);
20static void _evas_yv12torgb_mmx (unsigned char **yuv, unsigned char *rgb, int w, int h); 24static void _evas_yv12torgb_mmx (unsigned char **yuv, unsigned char *rgb, int w, int h);
21#ifdef BUILD_ALTIVEC 25#ifdef BUILD_ALTIVEC
22static void _evas_yv12torgb_altivec(unsigned char **yuv, unsigned char *rgb, int w, int h); 26static void _evas_yv12torgb_altivec(unsigned char **yuv, unsigned char *rgb, int w, int h);
23static void _evas_yv12torgb_diz (unsigned char **yuv, unsigned char *rgb, int w, int h); 27static void _evas_yv12torgb_diz (unsigned char **yuv, unsigned char *rgb, int w, int h);
24#endif 28#endif
29static void _evas_yv12_709torgb_raster(unsigned char **yuv, unsigned char *rgb, int w, int h);
25static void _evas_yv12torgb_raster (unsigned char **yuv, unsigned char *rgb, int w, int h); 30static void _evas_yv12torgb_raster (unsigned char **yuv, unsigned char *rgb, int w, int h);
26static void _evas_yuy2torgb_raster (unsigned char **yuv, unsigned char *rgb, int w, int h); 31static void _evas_yuy2torgb_raster (unsigned char **yuv, unsigned char *rgb, int w, int h);
27static void _evas_nv12torgb_raster (unsigned char **yuv, unsigned char *rgb, int w, int h); 32static void _evas_nv12torgb_raster (unsigned char **yuv, unsigned char *rgb, int w, int h);
@@ -31,10 +36,17 @@ static void _evas_nv12tiledtorgb_raster(unsigned char **yuv, unsigned char *rgb,
31#define CBU 132251 36#define CBU 132251
32#define CGU 25624 37#define CGU 25624
33#define CGV 53280 38#define CGV 53280
39
34#define YMUL 76283 40#define YMUL 76283
35#define OFF 32768 41#define OFF 32768
36#define BITRES 16 42#define BITRES 16
37 43
44#define CRV709 117504
45#define CBU709 138607
46#define CGU709 13959
47#define CGV709 34996
48
49
38/* calculation float resolution in bits */ 50/* calculation float resolution in bits */
39/* ie RES = 6 is 10.6 fixed point */ 51/* ie RES = 6 is 10.6 fixed point */
40/* RES = 8 is 8.8 fixed point */ 52/* RES = 8 is 8.8 fixed point */
@@ -56,6 +68,11 @@ __attribute__ ((aligned (8))) const volatile unsigned short _const_32 [4] = F
56__attribute__ ((aligned (8))) const volatile unsigned short _const_16 [4] = FOUR(16); 68__attribute__ ((aligned (8))) const volatile unsigned short _const_16 [4] = FOUR(16);
57__attribute__ ((aligned (8))) const volatile unsigned short _const_ff [4] = FOUR(-1); 69__attribute__ ((aligned (8))) const volatile unsigned short _const_ff [4] = FOUR(-1);
58 70
71__attribute__ ((aligned (8))) const volatile unsigned short _const_crvcrv709[4] = FOUR(RZ(CRV709));
72__attribute__ ((aligned (8))) const volatile unsigned short _const_cbucbu709[4] = FOUR(RZ(CBU709));
73__attribute__ ((aligned (8))) const volatile unsigned short _const_cgucgu709[4] = FOUR(RZ(CGU709));
74__attribute__ ((aligned (8))) const volatile unsigned short _const_cgvcgv709[4] = FOUR(RZ(CGV709));
75
59#define CONST_CRVCRV *_const_crvcrv 76#define CONST_CRVCRV *_const_crvcrv
60#define CONST_CBUCBU *_const_cbucbu 77#define CONST_CBUCBU *_const_cbucbu
61#define CONST_CGUCGU *_const_cgucgu 78#define CONST_CGUCGU *_const_cgucgu
@@ -66,12 +83,22 @@ __attribute__ ((aligned (8))) const volatile unsigned short _const_ff [4] = F
66#define CONST_16 *_const_16 83#define CONST_16 *_const_16
67#define CONST_FF *_const_ff 84#define CONST_FF *_const_ff
68 85
86#define CONST_CRVCRV709 *_const_crvcrv709
87#define CONST_CBUCBU709 *_const_cbucbu709
88#define CONST_CGUCGU709 *_const_cgucgu709
89#define CONST_CGVCGV709 *_const_cgvcgv709
90
69/* for C non aligned cleanup */ 91/* for C non aligned cleanup */
70const int _crv = RZ(CRV); /* 1.596 */ 92const int _crv = RZ(CRV); /* 1.596 */
71const int _cbu = RZ(CBU); /* 2.018 */ 93const int _cbu = RZ(CBU); /* 2.018 */
72const int _cgu = RZ(CGU); /* 0.391 */ 94const int _cgu = RZ(CGU); /* 0.391 */
73const int _cgv = RZ(CGV); /* 0.813 */ 95const int _cgv = RZ(CGV); /* 0.813 */
74 96
97const int _crv709 = RZ(CRV709); /* 1.793 */
98const int _cbu709 = RZ(CBU709); /* 2.115 */
99const int _cgu709 = RZ(CGU709); /* 0.213 */
100const int _cgv709 = RZ(CGV709); /* 0.534 */
101
75#endif 102#endif
76 103
77#ifdef BUILD_ALTIVEC 104#ifdef BUILD_ALTIVEC
@@ -113,6 +140,11 @@ static short _v813[256];
113static short _v391[256]; 140static short _v391[256];
114static short _v2018[256]; 141static short _v2018[256];
115 142
143static short _v1793[256];
144static short _v534[256];
145static short _v213[256];
146static short _v2115[256];
147
116static unsigned char _clip_lut[1024]; 148static unsigned char _clip_lut[1024];
117#define LUT_CLIP(i) ((_clip_lut+384)[(i)]) 149#define LUT_CLIP(i) ((_clip_lut+384)[(i)])
118 150
@@ -121,8 +153,26 @@ static unsigned char _clip_lut[1024];
121static int initted = 0; 153static int initted = 0;
122 154
123void 155void
124evas_common_convert_yuv_420p_601_rgba(DATA8 **src, DATA8 *dst, int w, int h) 156evas_common_convert_yuv_422p_709_rgba(DATA8 **src, DATA8 *dst, int w, int h)
157{
158 if (!initted) _evas_yuv_init();
159 initted = 1;
160/* Broken atm - the sse and mmx get math.. wrong :(
161 if (evas_common_cpu_has_feature(CPU_FEATURE_MMX2))
162 _evas_yv12_709torgb_sse(src, dst, w, h);
163 else if (evas_common_cpu_has_feature(CPU_FEATURE_MMX))
164 _evas_yv12_709torgb_mmx(src, dst, w, h);
165 else
166 */
167 _evas_yv12_709torgb_raster(src, dst, w, h);
168}
169
170
171void
172evas_common_convert_yuv_422p_601_rgba(DATA8 **src, DATA8 *dst, int w, int h)
125{ 173{
174 if (!initted) _evas_yuv_init();
175 initted = 1;
126 if (evas_common_cpu_has_feature(CPU_FEATURE_MMX2)) 176 if (evas_common_cpu_has_feature(CPU_FEATURE_MMX2))
127 _evas_yv12torgb_sse(src, dst, w, h); 177 _evas_yv12torgb_sse(src, dst, w, h);
128 else if (evas_common_cpu_has_feature(CPU_FEATURE_MMX)) 178 else if (evas_common_cpu_has_feature(CPU_FEATURE_MMX))
@@ -132,12 +182,7 @@ evas_common_convert_yuv_420p_601_rgba(DATA8 **src, DATA8 *dst, int w, int h)
132 _evas_yv12torgb_altivec(src, dst, w, h); 182 _evas_yv12torgb_altivec(src, dst, w, h);
133#endif 183#endif
134 else 184 else
135 { 185 _evas_yv12torgb_raster(src, dst, w, h);
136 if (!initted) _evas_yuv_init();
137 initted = 1;
138 /* FIXME: diz may be faster sometimes */
139 _evas_yv12torgb_raster(src, dst, w, h);
140 }
141} 186}
142 187
143/* Thanks to Diz for this code. i've munged it a little and turned it into */ 188/* Thanks to Diz for this code. i've munged it a little and turned it into */
@@ -157,6 +202,169 @@ evas_common_convert_yuv_420p_601_rgba(DATA8 **src, DATA8 *dst, int w, int h)
157/* this code should be faster. In the end it's all just an mmx version of */ 202/* this code should be faster. In the end it's all just an mmx version of */
158/* the reference implimentation done with fixed point math */ 203/* the reference implimentation done with fixed point math */
159 204
205/*
206static void
207_evas_yv12_709torgb_sse(unsigned char **yuv, unsigned char *rgb, int w, int h)
208{
209#ifdef BUILD_MMX
210 int xx, yy;
211 register unsigned char *yp1, *up, *vp;
212 unsigned char *dp1;
213
214 dp1 = rgb;
215
216 for (yy = 0; yy < h; yy++)
217 {
218 yp1 = yuv[yy];
219 up = yuv[h + (yy / 2)];
220 vp = yuv[h + (h / 2) + (yy / 2)];
221 for (xx = 0; xx < (w - 807); xx += 8)
222 {
223 movd_m2r(*up, mm3);
224 movd_m2r(*vp, mm2);
225 movq_m2r(*yp1, mm0);
226
227 pxor_r2r(mm7, mm7);
228 punpcklbw_r2r(mm7, mm2);
229 punpcklbw_r2r(mm7, mm3);
230
231 movq_r2r(mm0, mm1);
232 psrlw_i2r(8, mm0);
233 psllw_i2r(8, mm1);
234 psrlw_i2r(8, mm1);
235
236 movq_m2r(CONST_16, mm4);
237 psubsw_r2r(mm4, mm0);
238 psubsw_r2r(mm4, mm1);
239
240 movq_m2r(CONST_128, mm5);
241 psubsw_r2r(mm5, mm2);
242 psubsw_r2r(mm5, mm3);
243
244 movq_m2r(CONST_YMUL, mm4);
245 pmullw_r2r(mm4, mm0);
246 pmullw_r2r(mm4, mm1);
247
248 movq_m2r(CONST_CRVCRV709, mm7);
249 pmullw_r2r(mm3, mm7);
250 movq_m2r(CONST_CBUCBU709, mm6);
251 pmullw_r2r(mm2, mm6);
252 movq_m2r(CONST_CGUCGU709, mm5);
253 pmullw_r2r(mm2, mm5);
254 movq_m2r(CONST_CGVCGV709, mm4);
255 pmullw_r2r(mm3, mm4);
256
257 movq_r2r(mm0, mm2);
258 paddsw_r2r(mm7, mm2);
259 paddsw_r2r(mm1, mm7);
260
261 psraw_i2r(RES, mm2);
262 psraw_i2r(RES, mm7);
263 packuswb_r2r(mm7, mm2);
264
265 pxor_r2r(mm7, mm7);
266 movq_r2r(mm2, mm3);
267 punpckhbw_r2r(mm7, mm2);
268 punpcklbw_r2r(mm3, mm7);
269 por_r2r(mm7, mm2);
270
271 movq_r2r(mm0, mm3);
272 psubsw_r2r(mm5, mm3);
273 psubsw_r2r(mm4, mm3);
274 paddsw_m2r(CONST_32, mm3);
275
276 movq_r2r(mm1, mm7);
277 psubsw_r2r(mm5, mm7);
278 psubsw_r2r(mm4, mm7);
279 paddsw_m2r(CONST_32, mm7);
280
281 psraw_i2r(RES, mm3);
282 psraw_i2r(RES, mm7);
283 packuswb_r2r(mm7, mm3);
284
285 pxor_r2r(mm7, mm7);
286 movq_r2r(mm3, mm4);
287 punpckhbw_r2r(mm7, mm3);
288 punpcklbw_r2r(mm4, mm7);
289 por_r2r(mm7, mm3);
290
291 movq_m2r(CONST_32, mm4);
292 paddsw_r2r(mm6, mm0);
293 paddsw_r2r(mm6, mm1);
294 paddsw_r2r(mm4, mm0);
295 paddsw_r2r(mm4, mm1);
296 psraw_i2r(RES, mm0);
297 psraw_i2r(RES, mm1);
298 packuswb_r2r(mm1, mm0);
299
300 pxor_r2r(mm7, mm7);
301 movq_r2r(mm0, mm5);
302 punpckhbw_r2r(mm7, mm0);
303 punpcklbw_r2r(mm5, mm7);
304 por_r2r(mm7, mm0);
305
306 movq_m2r(CONST_FF, mm1);
307 movq_r2r(mm0, mm5);
308 movq_r2r(mm3, mm6);
309 movq_r2r(mm2, mm7);
310 punpckhbw_r2r(mm3, mm2);
311 punpcklbw_r2r(mm6, mm7);
312 punpckhbw_r2r(mm1, mm0);
313 punpcklbw_r2r(mm1, mm5);
314
315 movq_r2r(mm7, mm1);
316 punpckhwd_r2r(mm5, mm7);
317 punpcklwd_r2r(mm5, mm1);
318
319 movq_r2r(mm2, mm4);
320 punpckhwd_r2r(mm0, mm2);
321 punpcklwd_r2r(mm0, mm4);
322
323 movntq_r2m(mm1, *(dp1));
324 movntq_r2m(mm7, *(dp1 + 8));
325 movntq_r2m(mm4, *(dp1 + 16));
326 movntq_r2m(mm2, *(dp1 + 24));
327
328 yp1 += 8;
329 up += 4;
330 vp += 4;
331 dp1 += 8 * 4;
332 }
333
334 if (xx < w)
335 {
336 int y, u, v, r, g, b;
337
338 for (; xx < w; xx += 2)
339 {
340 u = (*up++) - 128;
341 v = (*vp++) - 128;
342
343 y = RZ(YMUL) * ((*yp1++) - 16);
344 r = LUT_CLIP((y + (_crv709 * v)) >> RES);
345 g = LUT_CLIP((y - (_cgu709 * u) - (_cgv709 * v) + RZ(OFF)) >> RES);
346 b = LUT_CLIP((y + (_cbu709 * u) + RZ(OFF)) >> RES);
347 *((DATA32 *) dp1) = 0xff000000 + RGB_JOIN(r,g,b);
348
349 dp1 += 4;
350
351 y = RZ(YMUL) * ((*yp1++) - 16);
352 r = LUT_CLIP((y + (_crv709 * v)) >> RES);
353 g = LUT_CLIP((y - (_cgu709 * u) - (_cgv709 * v) + RZ(OFF)) >> RES);
354 b = LUT_CLIP((y + (_cbu709 * u) + RZ(OFF)) >> RES);
355 *((DATA32 *) dp1) = 0xff000000 + RGB_JOIN(r,g,b);
356
357 dp1 += 4;
358 }
359 }
360 }
361 emms();
362#else
363 _evas_yv12_709torgb_mmx(yuv, rgb, w, h);
364#endif
365}
366*/
367
160static void 368static void
161_evas_yv12torgb_sse(unsigned char **yuv, unsigned char *rgb, int w, int h) 369_evas_yv12torgb_sse(unsigned char **yuv, unsigned char *rgb, int w, int h)
162{ 370{
@@ -320,6 +528,168 @@ _evas_yv12torgb_sse(unsigned char **yuv, unsigned char *rgb, int w, int h)
320#endif 528#endif
321} 529}
322 530
531/*
532static void
533_evas_yv12_709torgb_mmx(unsigned char **yuv, unsigned char *rgb, int w, int h)
534{
535#ifdef BUILD_MMX
536 int xx, yy;
537 register unsigned char *yp1, *up, *vp;
538 unsigned char *dp1;
539
540 dp1 = rgb;
541
542 for (yy = 0; yy < h; yy++)
543 {
544 yp1 = yuv[yy];
545 up = yuv[h + (yy / 2)];
546 vp = yuv[h + (h / 2) + (yy / 2)];
547 for (xx = 0; xx < (w - 7); xx += 8)
548 {
549 movd_m2r(*up, mm3);
550 movd_m2r(*vp, mm2);
551 movq_m2r(*yp1, mm0);
552
553 pxor_r2r(mm7, mm7);
554 punpcklbw_r2r(mm7, mm2);
555 punpcklbw_r2r(mm7, mm3);
556
557 movq_r2r(mm0, mm1);
558 psrlw_i2r(8, mm0);
559 psllw_i2r(8, mm1);
560 psrlw_i2r(8, mm1);
561
562 movq_m2r(CONST_16, mm4);
563 psubsw_r2r(mm4, mm0);
564 psubsw_r2r(mm4, mm1);
565
566 movq_m2r(CONST_128, mm5);
567 psubsw_r2r(mm5, mm2);
568 psubsw_r2r(mm5, mm3);
569
570 movq_m2r(CONST_YMUL, mm4);
571 pmullw_r2r(mm4, mm0);
572 pmullw_r2r(mm4, mm1);
573
574 movq_m2r(CONST_CRVCRV709, mm7);
575 pmullw_r2r(mm3, mm7);
576 movq_m2r(CONST_CBUCBU709, mm6);
577 pmullw_r2r(mm2, mm6);
578 movq_m2r(CONST_CGUCGU709, mm5);
579 pmullw_r2r(mm2, mm5);
580 movq_m2r(CONST_CGVCGV709, mm4);
581 pmullw_r2r(mm3, mm4);
582
583 movq_r2r(mm0, mm2);
584 paddsw_r2r(mm7, mm2);
585 paddsw_r2r(mm1, mm7);
586
587 psraw_i2r(RES, mm2);
588 psraw_i2r(RES, mm7);
589 packuswb_r2r(mm7, mm2);
590
591 pxor_r2r(mm7, mm7);
592 movq_r2r(mm2, mm3);
593 punpckhbw_r2r(mm7, mm2);
594 punpcklbw_r2r(mm3, mm7);
595 por_r2r(mm7, mm2);
596
597 movq_r2r(mm0, mm3);
598 psubsw_r2r(mm5, mm3);
599 psubsw_r2r(mm4, mm3);
600 paddsw_m2r(CONST_32, mm3);
601
602 movq_r2r(mm1, mm7);
603 psubsw_r2r(mm5, mm7);
604 psubsw_r2r(mm4, mm7);
605 paddsw_m2r(CONST_32, mm7);
606
607 psraw_i2r(RES, mm3);
608 psraw_i2r(RES, mm7);
609 packuswb_r2r(mm7, mm3);
610
611 pxor_r2r(mm7, mm7);
612 movq_r2r(mm3, mm4);
613 punpckhbw_r2r(mm7, mm3);
614 punpcklbw_r2r(mm4, mm7);
615 por_r2r(mm7, mm3);
616
617 movq_m2r(CONST_32, mm4);
618 paddsw_r2r(mm6, mm0);
619 paddsw_r2r(mm6, mm1);
620 paddsw_r2r(mm4, mm0);
621 paddsw_r2r(mm4, mm1);
622 psraw_i2r(RES, mm0);
623 psraw_i2r(RES, mm1);
624 packuswb_r2r(mm1, mm0);
625
626 pxor_r2r(mm7, mm7);
627 movq_r2r(mm0, mm5);
628 punpckhbw_r2r(mm7, mm0);
629 punpcklbw_r2r(mm5, mm7);
630 por_r2r(mm7, mm0);
631
632 movq_m2r(CONST_FF, mm1);
633 movq_r2r(mm0, mm5);
634 movq_r2r(mm3, mm6);
635 movq_r2r(mm2, mm7);
636 punpckhbw_r2r(mm3, mm2);
637 punpcklbw_r2r(mm6, mm7);
638 punpckhbw_r2r(mm1, mm0);
639 punpcklbw_r2r(mm1, mm5);
640
641 movq_r2r(mm7, mm1);
642 punpckhwd_r2r(mm5, mm7);
643 punpcklwd_r2r(mm5, mm1);
644
645 movq_r2r(mm2, mm4);
646 punpckhwd_r2r(mm0, mm2);
647 punpcklwd_r2r(mm0, mm4);
648
649 movq_r2m(mm1, *(dp1));
650 movq_r2m(mm7, *(dp1 + 8));
651 movq_r2m(mm4, *(dp1 + 16));
652 movq_r2m(mm2, *(dp1 + 24));
653
654 yp1 += 8;
655 up += 4;
656 vp += 4;
657 dp1 += 8 * 4;
658 }
659 if (xx < w)
660 {
661 int y, u, v, r, g, b;
662
663 for (; xx < w; xx += 2)
664 {
665 u = (*up++) - 128;
666 v = (*vp++) - 128;
667
668 y = RZ(YMUL) * ((*yp1++) - 16);
669 r = LUT_CLIP((y + (_crv709 * v)) >> RES);
670 g = LUT_CLIP((y - (_cgu709 * u) - (_cgv709 * v) + RZ(OFF)) >> RES);
671 b = LUT_CLIP((y + (_cbu709 * u) + RZ(OFF)) >> RES);
672 *((DATA32 *) dp1) = 0xff000000 + RGB_JOIN(r,g,b);
673
674 dp1 += 4;
675
676 y = RZ(YMUL) * ((*yp1++) - 16);
677 r = LUT_CLIP((y + (_crv709 * v)) >> RES);
678 g = LUT_CLIP((y - (_cgu709 * u) - (_cgv709 * v) + RZ(OFF)) >> RES);
679 b = LUT_CLIP((y + (_cbu709 * u) + RZ(OFF)) >> RES);
680 *((DATA32 *) dp1) = 0xff000000 + RGB_JOIN(r,g,b);
681
682 dp1 += 4;
683 }
684 }
685 }
686 emms();
687#else
688 _evas_yv12torgb_raster(yuv, rgb, w, h);
689#endif
690}
691*/
692
323static void 693static void
324_evas_yv12torgb_mmx(unsigned char **yuv, unsigned char *rgb, int w, int h) 694_evas_yv12torgb_mmx(unsigned char **yuv, unsigned char *rgb, int w, int h)
325{ 695{
@@ -715,6 +1085,12 @@ _evas_yuv_init(void)
715 1085
716 _v391[i] = (int)(((float)(i - 128)) * 0.391); 1086 _v391[i] = (int)(((float)(i - 128)) * 0.391);
717 _v2018[i] = (int)(((float)(i - 128)) * 2.018); 1087 _v2018[i] = (int)(((float)(i - 128)) * 2.018);
1088
1089//////////////////////////////////////////////////////////////////////////
1090 _v1793[i] = (int)(((float)(i - 128)) * 1.793);
1091 _v534[i] = (int)(((float)(i - 128)) * 0.534);
1092 _v213[i] = (int)(((float)(i - 128)) * 0.213);
1093 _v2115[i] = (int)(((float)(i - 128)) * 2.115);
718 } 1094 }
719 1095
720 for (i = -384; i < 640; i++) 1096 for (i = -384; i < 640; i++)
@@ -801,6 +1177,70 @@ _evas_yv12torgb_diz(unsigned char **yuv, unsigned char *rgb, int w, int h)
801#endif 1177#endif
802 1178
803static void 1179static void
1180_evas_yv12_709torgb_raster(unsigned char **yuv, unsigned char *rgb, int w, int h)
1181{
1182 int xx, yy;
1183 int y, u, v;
1184 unsigned char *yp1, *yp2, *up, *vp;
1185 unsigned char *dp1, *dp2;
1186
1187 /* destination pointers */
1188 dp1 = rgb;
1189 dp2 = rgb + (w * 4);
1190
1191 for (yy = 0; yy < h; yy += 2)
1192 {
1193 /* plane pointers */
1194 yp1 = yuv[yy];
1195 yp2 = yuv[yy + 1];
1196 up = yuv[h + (yy / 2)];
1197 vp = yuv[h + (h / 2) + (yy / 2)];
1198 for (xx = 0; xx < w; xx += 2)
1199 {
1200 int vmu;
1201
1202 /* collect u & v for 2x2 pixel block */
1203 u = *up++;
1204 v = *vp++;
1205
1206 /* save lookups */
1207 vmu = _v534[v] + _v213[u];
1208 u = _v2115[u];
1209 v = _v1793[v];
1210
1211 /* do the top 2 pixels of the 2x2 block which shared u & v */
1212 /* yuv to rgb */
1213 y = _v1164[*yp1++];
1214 *((DATA32 *) dp1) = 0xff000000 + RGB_JOIN(LUT_CLIP(y + v), LUT_CLIP(y - vmu), LUT_CLIP(y + u));
1215
1216 dp1 += 4;
1217
1218 /* yuv to rgb */
1219 y = _v1164[*yp1++];
1220 *((DATA32 *) dp1) = 0xff000000 + RGB_JOIN(LUT_CLIP(y + v), LUT_CLIP(y - vmu), LUT_CLIP(y + u));
1221
1222 dp1 += 4;
1223
1224 /* do the bottom 2 pixels */
1225 /* yuv to rgb */
1226 y = _v1164[*yp2++];
1227 *((DATA32 *) dp2) = 0xff000000 + RGB_JOIN(LUT_CLIP(y + v), LUT_CLIP(y - vmu), LUT_CLIP(y + u));
1228
1229 dp2 += 4;
1230
1231 /* yuv to rgb */
1232 y = _v1164[*yp2++];
1233 *((DATA32 *) dp2) = 0xff000000 + RGB_JOIN(LUT_CLIP(y + v), LUT_CLIP(y - vmu), LUT_CLIP(y + u));
1234
1235 dp2 += 4;
1236 }
1237 /* jump down one line since we are doing 2 at once */
1238 dp1 += (w * 4);
1239 dp2 += (w * 4);
1240 }
1241}
1242
1243static void
804_evas_yv12torgb_raster(unsigned char **yuv, unsigned char *rgb, int w, int h) 1244_evas_yv12torgb_raster(unsigned char **yuv, unsigned char *rgb, int w, int h)
805{ 1245{
806 int xx, yy; 1246 int xx, yy;
diff --git a/src/lib/evas/common/evas_convert_yuv.h b/src/lib/evas/common/evas_convert_yuv.h
index b598807176..1cadf2b1a3 100644
--- a/src/lib/evas/common/evas_convert_yuv.h
+++ b/src/lib/evas/common/evas_convert_yuv.h
@@ -1,7 +1,9 @@
1#ifndef _EVAS_CONVERT_YUV_H 1#ifndef _EVAS_CONVERT_YUV_H
2#define _EVAS_CONVERT_YUV_H 2#define _EVAS_CONVERT_YUV_H
3 3
4EAPI void evas_common_convert_yuv_420p_601_rgba (DATA8 **src, DATA8 *dst, int w, int h); 4EAPI void evas_common_convert_yuv_422p_709_rgba (DATA8 **src, DATA8 *dst, int w, int h);
5
6EAPI void evas_common_convert_yuv_422p_601_rgba (DATA8 **src, DATA8 *dst, int w, int h);
5EAPI void evas_common_convert_yuv_422_601_rgba (DATA8 **src, DATA8 *dst, int w, int h); 7EAPI void evas_common_convert_yuv_422_601_rgba (DATA8 **src, DATA8 *dst, int w, int h);
6EAPI void evas_common_convert_yuv_420_601_rgba (DATA8 **src, DATA8 *dst, int w, int h); 8EAPI void evas_common_convert_yuv_420_601_rgba (DATA8 **src, DATA8 *dst, int w, int h);
7EAPI void evas_common_convert_yuv_420T_601_rgba (DATA8 **src, DATA8 *dst, int w, int h); 9EAPI void evas_common_convert_yuv_420T_601_rgba (DATA8 **src, DATA8 *dst, int w, int h);
diff --git a/src/lib/evas/common/evas_image_main.c b/src/lib/evas/common/evas_image_main.c
index b9af38a3ce..3cb2044518 100644
--- a/src/lib/evas/common/evas_image_main.c
+++ b/src/lib/evas/common/evas_image_main.c
@@ -794,13 +794,13 @@ evas_common_image_colorspace_normalize(RGBA_Image *im)
794 case EVAS_COLORSPACE_ARGB8888: 794 case EVAS_COLORSPACE_ARGB8888:
795 case EVAS_COLORSPACE_GRY8: 795 case EVAS_COLORSPACE_GRY8:
796 case EVAS_COLORSPACE_AGRY88: 796 case EVAS_COLORSPACE_AGRY88:
797 if (im->image.data != im->cs.data) 797 if (im->image.data != im->cs.data)
798 { 798 {
799#ifdef EVAS_CSERVE2 799#ifdef EVAS_CSERVE2
800 // if (((Image_Entry *)im)->data1) evas_cserve2_image_free(&im->cache_entry); 800 // if (((Image_Entry *)im)->data1) evas_cserve2_image_free(&im->cache_entry);
801 if (((Image_Entry *)im)->data1) ERR("Shouldn't reach this point since we are using cache2."); 801 if (((Image_Entry *)im)->data1) ERR("Shouldn't reach this point since we are using cache2.");
802#endif 802#endif
803 if (!im->image.no_free) 803 if (!im->image.no_free)
804 { 804 {
805 _evas_common_rgba_image_surface_munmap(im->image.data, 805 _evas_common_rgba_image_surface_munmap(im->image.data,
806 im->cache_entry.allocated.w, 806 im->cache_entry.allocated.w,
@@ -808,19 +808,19 @@ evas_common_image_colorspace_normalize(RGBA_Image *im)
808 im->cache_entry.space); 808 im->cache_entry.space);
809#ifdef SURFDBG 809#ifdef SURFDBG
810 surfs = eina_list_remove(surfs, im); 810 surfs = eina_list_remove(surfs, im);
811#endif 811#endif
812 ((Image_Entry *)im)->allocated.w = 0; 812 ((Image_Entry *)im)->allocated.w = 0;
813 ((Image_Entry *)im)->allocated.h = 0; 813 ((Image_Entry *)im)->allocated.h = 0;
814 } 814 }
815 im->image.data = im->cs.data; 815 im->image.data = im->cs.data;
816 im->cs.no_free = im->image.no_free; 816 im->cs.no_free = im->image.no_free;
817 } 817 }
818 break; 818 break;
819 case EVAS_COLORSPACE_YCBCR422P601_PL: 819 case EVAS_COLORSPACE_YCBCR422P601_PL:
820 if ((im->image.data) && (*((unsigned char **)im->cs.data))) 820 if ((im->image.data) && (*((unsigned char **)im->cs.data)))
821 evas_common_convert_yuv_420p_601_rgba(im->cs.data, (DATA8*) im->image.data, 821 evas_common_convert_yuv_422p_601_rgba(im->cs.data, (DATA8*) im->image.data,
822 im->cache_entry.w, im->cache_entry.h); 822 im->cache_entry.w, im->cache_entry.h);
823 break; 823 break;
824 case EVAS_COLORSPACE_YCBCR422601_PL: 824 case EVAS_COLORSPACE_YCBCR422601_PL:
825 if ((im->image.data) && (*((unsigned char **)im->cs.data))) 825 if ((im->image.data) && (*((unsigned char **)im->cs.data)))
826 evas_common_convert_yuv_422_601_rgba(im->cs.data, (DATA8*) im->image.data, 826 evas_common_convert_yuv_422_601_rgba(im->cs.data, (DATA8*) im->image.data,
@@ -836,13 +836,18 @@ evas_common_image_colorspace_normalize(RGBA_Image *im)
836 evas_common_convert_yuv_420T_601_rgba(im->cs.data, (DATA8*) im->image.data, 836 evas_common_convert_yuv_420T_601_rgba(im->cs.data, (DATA8*) im->image.data,
837 im->cache_entry.w, im->cache_entry.h); 837 im->cache_entry.w, im->cache_entry.h);
838 break; 838 break;
839 case EMILE_COLORSPACE_YCBCR422P709_PL:
840 if ((im->image.data) && (*((unsigned char **)im->cs.data)))
841 evas_common_convert_yuv_422p_709_rgba(im->cs.data, (DATA8*) im->image.data,
842 im->cache_entry.w, im->cache_entry.h);
843 break;
839 default: 844 default:
840 break; 845 break;
841 } 846 }
842 im->cs.dirty = 0; 847 im->cs.dirty = 0;
843#ifdef SURFDBG 848#ifdef SURFDBG
844 surf_debug(); 849 surf_debug();
845#endif 850#endif
846} 851}
847 852
848EAPI void 853EAPI void
diff --git a/src/modules/evas/engines/gl_common/evas_gl_common.h b/src/modules/evas/engines/gl_common/evas_gl_common.h
index 2c4ec568ef..d2cc58a025 100644
--- a/src/modules/evas/engines/gl_common/evas_gl_common.h
+++ b/src/modules/evas/engines/gl_common/evas_gl_common.h
@@ -465,6 +465,9 @@ enum _Shader_Type {
465 SHD_YUV, 465 SHD_YUV,
466 SHD_YUY2, 466 SHD_YUY2,
467 SHD_NV12, 467 SHD_NV12,
468 SHD_YUV_709,
469 SHD_YUY2_709,
470 SHD_NV12_709,
468 SHD_LINE, 471 SHD_LINE,
469 SHD_RGB_A_PAIR, 472 SHD_RGB_A_PAIR,
470 SHD_TEX_EXTERNAL, 473 SHD_TEX_EXTERNAL,
@@ -792,6 +795,13 @@ void evas_gl_common_context_yuv_push(Evas_Engine_GL_Context *gc,
792 Evas_GL_Texture *mtex, int mx, int my, int mw, int mh, Eina_Bool mask_smooth, 795 Evas_GL_Texture *mtex, int mx, int my, int mw, int mh, Eina_Bool mask_smooth,
793 int r, int g, int b, int a, 796 int r, int g, int b, int a,
794 Eina_Bool smooth); 797 Eina_Bool smooth);
798void evas_gl_common_context_yuv_709_push(Evas_Engine_GL_Context *gc,
799 Evas_GL_Texture *tex,
800 double sx, double sy, double sw, double sh,
801 int x, int y, int w, int h,
802 Evas_GL_Texture *mtex, int mx, int my, int mw, int mh, Eina_Bool mask_smooth,
803 int r, int g, int b, int a,
804 Eina_Bool smooth);
795void evas_gl_common_context_yuy2_push(Evas_Engine_GL_Context *gc, 805void evas_gl_common_context_yuy2_push(Evas_Engine_GL_Context *gc,
796 Evas_GL_Texture *tex, 806 Evas_GL_Texture *tex,
797 double sx, double sy, double sw, double sh, 807 double sx, double sy, double sw, double sh,
diff --git a/src/modules/evas/engines/gl_common/evas_gl_context.c b/src/modules/evas/engines/gl_common/evas_gl_context.c
index e37306a2c7..c89c41bed3 100644
--- a/src/modules/evas/engines/gl_common/evas_gl_context.c
+++ b/src/modules/evas/engines/gl_common/evas_gl_context.c
@@ -1548,11 +1548,13 @@ evas_gl_common_shader_select(Evas_Engine_GL_Context *gc,
1548 { 1548 {
1549 if (tex->pt->dyn.img) 1549 if (tex->pt->dyn.img)
1550 { 1550 {
1551 printf("a... %i\n", (int)tex->alpha);
1551 afill = !tex->alpha; 1552 afill = !tex->alpha;
1552 bgra = 1; 1553 bgra = 1;
1553 } 1554 }
1554 else if (tex->im && tex->im->native.target == GL_TEXTURE_EXTERNAL_OES) 1555 else if (tex->im && tex->im->native.target == GL_TEXTURE_EXTERNAL_OES)
1555 { 1556 {
1557 printf("b... %i\n", (int)tex->alpha);
1556 type = SHD_TEX_EXTERNAL; 1558 type = SHD_TEX_EXTERNAL;
1557 afill = !tex->alpha; 1559 afill = !tex->alpha;
1558 } 1560 }
@@ -1571,6 +1573,9 @@ evas_gl_common_shader_select(Evas_Engine_GL_Context *gc,
1571 SHADER_YUV_NOMUL, SHADER_YUV, SHADER_YUV_MASK_NOMUL, SHADER_YUV_MASK, 1573 SHADER_YUV_NOMUL, SHADER_YUV, SHADER_YUV_MASK_NOMUL, SHADER_YUV_MASK,
1572 SHADER_YUY2_NOMUL, SHADER_YUY2, SHADER_YUY2_MASK_NOMUL, SHADER_YUY2_MASK, 1574 SHADER_YUY2_NOMUL, SHADER_YUY2, SHADER_YUY2_MASK_NOMUL, SHADER_YUY2_MASK,
1573 SHADER_NV12_NOMUL, SHADER_NV12, SHADER_NV12_MASK_NOMUL, SHADER_NV12_MASK, 1575 SHADER_NV12_NOMUL, SHADER_NV12, SHADER_NV12_MASK_NOMUL, SHADER_NV12_MASK,
1576 SHADER_YUV_709_NOMUL, SHADER_YUV_709, SHADER_YUV_709_MASK_NOMUL, SHADER_YUV_709_MASK,
1577 SHADER_YUY2_709_NOMUL, SHADER_YUY2_709, SHADER_YUY2_709_MASK_NOMUL, SHADER_YUY2_709_MASK,
1578 SHADER_NV12_709_NOMUL, SHADER_NV12_709, SHADER_NV12_709_MASK_NOMUL, SHADER_NV12_709_MASK,
1574 // RGB+A could support extra sampling 1579 // RGB+A could support extra sampling
1575 SHADER_RGB_A_PAIR_NOMUL, SHADER_RGB_A_PAIR, SHADER_RGB_A_PAIR_MASK_NOMUL, SHADER_RGB_A_PAIR_MASK, 1580 SHADER_RGB_A_PAIR_NOMUL, SHADER_RGB_A_PAIR, SHADER_RGB_A_PAIR_MASK_NOMUL, SHADER_RGB_A_PAIR_MASK,
1576 // TEX_EXTERNAL could support extra sampling 1581 // TEX_EXTERNAL could support extra sampling
@@ -1584,8 +1589,11 @@ evas_gl_common_shader_select(Evas_Engine_GL_Context *gc,
1584 case SHD_YUV: k = 0; break; 1589 case SHD_YUV: k = 0; break;
1585 case SHD_YUY2: k = 4; break; 1590 case SHD_YUY2: k = 4; break;
1586 case SHD_NV12: k = 8; break; 1591 case SHD_NV12: k = 8; break;
1587 case SHD_RGB_A_PAIR: k = 12; break; 1592 case SHD_YUV_709: k = 12; break;
1588 case SHD_TEX_EXTERNAL: k = 16; break; 1593 case SHD_YUY2_709: k = 16; break;
1594 case SHD_NV12_709: k = 20; break;
1595 case SHD_RGB_A_PAIR: k = 24; break;
1596 case SHD_TEX_EXTERNAL: k = 28; break;
1589 default: 1597 default:
1590 CRI("Unknown shader type requested!"); 1598 CRI("Unknown shader type requested!");
1591 return SHADER_RECT; 1599 return SHADER_RECT;
@@ -2343,10 +2351,89 @@ evas_gl_common_context_yuv_push(Evas_Engine_GL_Context *gc,
2343 tx2 = (sx + sw) / (double)tex->pt->w; 2351 tx2 = (sx + sw) / (double)tex->pt->w;
2344 ty2 = (sy + sh) / (double)tex->pt->h; 2352 ty2 = (sy + sh) / (double)tex->pt->h;
2345 2353
2346 t2x1 = ((sx) / 2) / (double)tex->ptu->w; 2354 t2x1 = ((sx) / 2.0) / (double)tex->ptu->w;
2347 t2y1 = ((sy) / 2) / (double)tex->ptu->h; 2355 t2y1 = ((sy) / 2.0) / (double)tex->ptu->h;
2348 t2x2 = ((sx + sw) / 2) / (double)tex->ptu->w; 2356 t2x2 = ((sx + sw) / 2.0) / (double)tex->ptu->w;
2349 t2y2 = ((sy + sh) / 2) / (double)tex->ptu->h; 2357 t2y2 = ((sy + sh) / 2.0) / (double)tex->ptu->h;
2358
2359 PUSH_6_VERTICES(pn, x, y, w, h);
2360 PUSH_6_TEXUV(pn, tx1, ty1, tx2, ty2);
2361 PUSH_6_TEXUV2(pn, t2x1, t2y1, t2x2, t2y2);
2362 PUSH_6_TEXUV3(pn, t2x1, t2y1, t2x2, t2y2);
2363 PUSH_MASK(pn, mtex, mx, my, mw, mh);
2364 if (!nomul)
2365 PUSH_6_COLORS(pn, r, g, b, a);
2366}
2367
2368void
2369evas_gl_common_context_yuv_709_push(Evas_Engine_GL_Context *gc,
2370 Evas_GL_Texture *tex,
2371 double sx, double sy, double sw, double sh,
2372 int x, int y, int w, int h,
2373 Evas_GL_Texture *mtex, int mx, int my, int mw, int mh, Eina_Bool mask_smooth,
2374 int r, int g, int b, int a,
2375 Eina_Bool smooth)
2376{
2377 GLfloat tx1, tx2, ty1, ty2, t2x1, t2x2, t2y1, t2y2;
2378 Eina_Bool blend = 0;
2379 Evas_GL_Shader shader;
2380 GLuint prog;
2381 int pn = 0, nomul = 0;
2382
2383 if ((a < 255) || (!!mtex))
2384 blend = 1;
2385
2386 shader = evas_gl_common_shader_select(gc, SHD_YUV_709, NULL, 0, r, g, b, a,
2387 w, h, w, h, smooth, tex, 0, mtex,
2388 NULL, &nomul);
2389 prog = gc->shared->shader[shader].prog;
2390
2391 pn = _evas_gl_common_context_push(SHD_YUV_709,
2392 gc, tex, mtex,
2393 prog,
2394 x, y, w, h,
2395 blend,
2396 smooth,
2397 0, 0, 0, 0, 0,
2398 mask_smooth);
2399
2400 gc->pipe[pn].region.type = SHD_YUV_709;
2401 gc->pipe[pn].shader.id = shader;
2402 gc->pipe[pn].shader.cur_tex = tex->pt->texture;
2403 gc->pipe[pn].shader.cur_texu = tex->ptu->texture;
2404 gc->pipe[pn].shader.cur_texv = tex->ptv->texture;
2405 gc->pipe[pn].shader.cur_texm = mtex ? mtex->pt->texture : 0;
2406 gc->pipe[pn].shader.cur_prog = prog;
2407 gc->pipe[pn].shader.smooth = smooth;
2408 gc->pipe[pn].shader.blend = blend;
2409 gc->pipe[pn].shader.render_op = gc->dc->render_op;
2410 gc->pipe[pn].shader.mask_smooth = mask_smooth;
2411 gc->pipe[pn].shader.clip = 0;
2412 gc->pipe[pn].shader.cx = 0;
2413 gc->pipe[pn].shader.cy = 0;
2414 gc->pipe[pn].shader.cw = 0;
2415 gc->pipe[pn].shader.ch = 0;
2416 gc->pipe[pn].array.line = 0;
2417 gc->pipe[pn].array.use_vertex = 1;
2418 gc->pipe[pn].array.use_color = !nomul;
2419 gc->pipe[pn].array.use_texuv = 1;
2420 gc->pipe[pn].array.use_texuv2 = 1;
2421 gc->pipe[pn].array.use_texuv3 = 1;
2422 gc->pipe[pn].array.use_mask = !!mtex;
2423 gc->pipe[pn].array.use_texsam = 0;
2424
2425 pipe_region_expand(gc, pn, x, y, w, h);
2426 PIPE_GROW(gc, pn, 6);
2427
2428 tx1 = (sx) / (double)tex->pt->w;
2429 ty1 = (sy) / (double)tex->pt->h;
2430 tx2 = (sx + sw) / (double)tex->pt->w;
2431 ty2 = (sy + sh) / (double)tex->pt->h;
2432
2433 t2x1 = ((sx) / 2.0) / (double)tex->ptu->w;
2434 t2y1 = ((sy) / 2.0) / (double)tex->ptu->h;
2435 t2x2 = ((sx + sw) / 2.0) / (double)tex->ptu->w;
2436 t2y2 = ((sy + sh) / 2.0) / (double)tex->ptu->h;
2350 2437
2351 PUSH_6_VERTICES(pn, x, y, w, h); 2438 PUSH_6_VERTICES(pn, x, y, w, h);
2352 PUSH_6_TEXUV(pn, tx1, ty1, tx2, ty2); 2439 PUSH_6_TEXUV(pn, tx1, ty1, tx2, ty2);
@@ -2643,10 +2730,13 @@ evas_gl_common_context_image_map_push(Evas_Engine_GL_Context *gc,
2643 switch (cspace) 2730 switch (cspace)
2644 { 2731 {
2645 case EVAS_COLORSPACE_YCBCR422P601_PL: 2732 case EVAS_COLORSPACE_YCBCR422P601_PL:
2646 case EVAS_COLORSPACE_YCBCR422P709_PL:
2647 type = SHD_YUV; 2733 type = SHD_YUV;
2648 utexture = EINA_TRUE; 2734 utexture = EINA_TRUE;
2649 break; 2735 break;
2736 case EVAS_COLORSPACE_YCBCR422P709_PL:
2737 type = SHD_YUV_709;
2738 utexture = EINA_TRUE;
2739 break;
2650 case EVAS_COLORSPACE_YCBCR422601_PL: 2740 case EVAS_COLORSPACE_YCBCR422601_PL:
2651 type = SHD_YUY2; 2741 type = SHD_YUY2;
2652 uvtexture = EINA_TRUE; 2742 uvtexture = EINA_TRUE;
diff --git a/src/modules/evas/engines/gl_common/evas_gl_image.c b/src/modules/evas/engines/gl_common/evas_gl_image.c
index da50781cd5..2d8d936e2a 100644
--- a/src/modules/evas/engines/gl_common/evas_gl_image.c
+++ b/src/modules/evas/engines/gl_common/evas_gl_image.c
@@ -791,7 +791,7 @@ evas_gl_common_image_update(Evas_Engine_GL_Context *gc, Evas_GL_Image *im)
791 free(im->im->image.data); 791 free(im->im->image.data);
792 im->im->image.data = malloc(im->im->cache_entry.w * im->im->cache_entry.h * sizeof(DATA32)); 792 im->im->image.data = malloc(im->im->cache_entry.w * im->im->cache_entry.h * sizeof(DATA32));
793 if (im->im->image.data) 793 if (im->im->image.data)
794 evas_common_convert_yuv_420p_601_rgba(im->cs.data, 794 evas_common_convert_yuv_422p_601_rgba(im->cs.data,
795 (void *)im->im->image.data, 795 (void *)im->im->image.data,
796 im->im->cache_entry.w, im->im->cache_entry.h); 796 im->im->cache_entry.w, im->im->cache_entry.h);
797 } 797 }
@@ -992,7 +992,8 @@ _evas_gl_common_image_push(Evas_Engine_GL_Context *gc, Evas_GL_Image *im,
992 int r, int g, int b, int a, 992 int r, int g, int b, int a,
993 Evas_GL_Image *mask, 993 Evas_GL_Image *mask,
994 Eina_Bool smooth, 994 Eina_Bool smooth,
995 Eina_Bool yuv, Eina_Bool yuy2, Eina_Bool nv12, 995 Eina_Bool yuv, Eina_Bool yuv_709,
996 Eina_Bool yuy2, Eina_Bool nv12,
996 Eina_Bool rgb_a_pair) 997 Eina_Bool rgb_a_pair)
997{ 998{
998 int mx = 0, my = 0, mw = 0, mh = 0; 999 int mx = 0, my = 0, mw = 0, mh = 0;
@@ -1033,6 +1034,14 @@ _evas_gl_common_image_push(Evas_Engine_GL_Context *gc, Evas_GL_Image *im,
1033 mtex, mx, my, mw, mh, mask_smooth, 1034 mtex, mx, my, mw, mh, mask_smooth,
1034 r, g, b, a, 1035 r, g, b, a,
1035 smooth); 1036 smooth);
1037 else if (yuv_709)
1038 evas_gl_common_context_yuv_709_push(gc,
1039 im->tex,
1040 sx, sy, sw, sh,
1041 dx, dy, dw, dh,
1042 mtex, mx, my, mw, mh, mask_smooth,
1043 r, g, b, a,
1044 smooth);
1036 else if (yuy2) 1045 else if (yuy2)
1037 evas_gl_common_context_yuy2_push(gc, 1046 evas_gl_common_context_yuy2_push(gc,
1038 im->tex, 1047 im->tex,
@@ -1081,6 +1090,14 @@ _evas_gl_common_image_push(Evas_Engine_GL_Context *gc, Evas_GL_Image *im,
1081 mtex, mx, my, mw, mh, mask_smooth, 1090 mtex, mx, my, mw, mh, mask_smooth,
1082 r, g, b, a, 1091 r, g, b, a,
1083 smooth); 1092 smooth);
1093 else if (yuv_709)
1094 evas_gl_common_context_yuv_709_push(gc,
1095 im->tex,
1096 ssx, ssy, ssw, ssh,
1097 nx, ny, nw, nh,
1098 mtex, mx, my, mw, mh, mask_smooth,
1099 r, g, b, a,
1100 smooth);
1084 else if (yuy2) 1101 else if (yuy2)
1085 evas_gl_common_context_yuy2_push(gc, 1102 evas_gl_common_context_yuy2_push(gc,
1086 im->tex, 1103 im->tex,
@@ -1124,6 +1141,7 @@ evas_gl_common_image_draw(Evas_Engine_GL_Context *gc, Evas_GL_Image *im, int sx,
1124 int c, cx, cy, cw, ch; 1141 int c, cx, cy, cw, ch;
1125 int i; 1142 int i;
1126 Eina_Bool yuv = EINA_FALSE; 1143 Eina_Bool yuv = EINA_FALSE;
1144 Eina_Bool yuv_709 = EINA_FALSE;
1127 Eina_Bool yuy2 = EINA_FALSE; 1145 Eina_Bool yuy2 = EINA_FALSE;
1128 Eina_Bool nv12 = EINA_FALSE; 1146 Eina_Bool nv12 = EINA_FALSE;
1129 Eina_Bool rgb_a_pair = EINA_FALSE; 1147 Eina_Bool rgb_a_pair = EINA_FALSE;
@@ -1156,9 +1174,11 @@ evas_gl_common_image_draw(Evas_Engine_GL_Context *gc, Evas_GL_Image *im, int sx,
1156 switch (im->cs.space) 1174 switch (im->cs.space)
1157 { 1175 {
1158 case EVAS_COLORSPACE_YCBCR422P601_PL: 1176 case EVAS_COLORSPACE_YCBCR422P601_PL:
1159 case EVAS_COLORSPACE_YCBCR422P709_PL:
1160 yuv = EINA_TRUE; 1177 yuv = EINA_TRUE;
1161 break; 1178 break;
1179 case EVAS_COLORSPACE_YCBCR422P709_PL:
1180 yuv_709 = EINA_TRUE;
1181 break;
1162 case EVAS_COLORSPACE_YCBCR422601_PL: 1182 case EVAS_COLORSPACE_YCBCR422601_PL:
1163 yuy2 = EINA_TRUE; 1183 yuy2 = EINA_TRUE;
1164 break; 1184 break;
@@ -1189,7 +1209,7 @@ evas_gl_common_image_draw(Evas_Engine_GL_Context *gc, Evas_GL_Image *im, int sx,
1189 r, g, b, a, 1209 r, g, b, a,
1190 mask, 1210 mask,
1191 smooth, 1211 smooth,
1192 yuv, yuy2, nv12, rgb_a_pair); 1212 yuv, yuv_709, yuy2, nv12, rgb_a_pair);
1193 } 1213 }
1194 else 1214 else
1195 { 1215 {
@@ -1200,7 +1220,7 @@ evas_gl_common_image_draw(Evas_Engine_GL_Context *gc, Evas_GL_Image *im, int sx,
1200 r, g, b, a, 1220 r, g, b, a,
1201 mask, 1221 mask,
1202 smooth, 1222 smooth,
1203 yuv, yuy2, nv12, rgb_a_pair); 1223 yuv, yuv_709, yuy2, nv12, rgb_a_pair);
1204 } 1224 }
1205 return; 1225 return;
1206 } 1226 }
@@ -1227,7 +1247,7 @@ evas_gl_common_image_draw(Evas_Engine_GL_Context *gc, Evas_GL_Image *im, int sx,
1227 r, g, b, a, 1247 r, g, b, a,
1228 mask, 1248 mask,
1229 smooth, 1249 smooth,
1230 yuv, yuy2, nv12, rgb_a_pair); 1250 yuv, yuv_709, yuy2, nv12, rgb_a_pair);
1231 } 1251 }
1232 evas_common_draw_context_cutouts_free(_evas_gl_common_cutout_rects); 1252 evas_common_draw_context_cutouts_free(_evas_gl_common_cutout_rects);
1233 /* restore clip info */ 1253 /* restore clip info */
diff --git a/src/modules/evas/engines/gl_common/evas_gl_texture.c b/src/modules/evas/engines/gl_common/evas_gl_texture.c
index 20105cde51..39b97ae8f5 100644
--- a/src/modules/evas/engines/gl_common/evas_gl_texture.c
+++ b/src/modules/evas/engines/gl_common/evas_gl_texture.c
@@ -1684,7 +1684,7 @@ evas_gl_common_texture_yuv_new(Evas_Engine_GL_Context *gc, DATA8 **rows, unsigne
1684 tex = evas_gl_common_texture_alloc(gc, w, h, EINA_FALSE); 1684 tex = evas_gl_common_texture_alloc(gc, w, h, EINA_FALSE);
1685 if (!tex) return NULL; 1685 if (!tex) return NULL;
1686 1686
1687 tex->ptu = _pool_tex_new(gc, w / 2 + 1, h / 2 + 1, lum_ifmt, lum_fmt); 1687 tex->ptu = _pool_tex_new(gc, (w + 1) / 2, (h + 1) / 2, lum_ifmt, lum_fmt);
1688 if (!tex->ptu) 1688 if (!tex->ptu)
1689 { 1689 {
1690 evas_gl_common_texture_light_free(tex); 1690 evas_gl_common_texture_light_free(tex);
diff --git a/src/modules/evas/engines/gl_common/shader/evas_gl_enum.x b/src/modules/evas/engines/gl_common/shader/evas_gl_enum.x
index fef7a70f6f..dfc5881964 100644
--- a/src/modules/evas/engines/gl_common/shader/evas_gl_enum.x
+++ b/src/modules/evas/engines/gl_common/shader/evas_gl_enum.x
@@ -76,6 +76,18 @@ typedef enum {
76 SHADER_NV12_NOMUL, 76 SHADER_NV12_NOMUL,
77 SHADER_NV12_MASK, 77 SHADER_NV12_MASK,
78 SHADER_NV12_MASK_NOMUL, 78 SHADER_NV12_MASK_NOMUL,
79 SHADER_YUV_709,
80 SHADER_YUV_709_NOMUL,
81 SHADER_YUV_709_MASK,
82 SHADER_YUV_709_MASK_NOMUL,
83 SHADER_YUY2_709,
84 SHADER_YUY2_709_NOMUL,
85 SHADER_YUY2_709_MASK,
86 SHADER_YUY2_709_MASK_NOMUL,
87 SHADER_NV12_709,
88 SHADER_NV12_709_NOMUL,
89 SHADER_NV12_709_MASK,
90 SHADER_NV12_709_MASK_NOMUL,
79 SHADER_LAST 91 SHADER_LAST
80} Evas_GL_Shader; 92} Evas_GL_Shader;
81 93
@@ -163,6 +175,40 @@ static struct {
163 { SHADER_NV12_MASK_NOMUL, "tex" }, 175 { SHADER_NV12_MASK_NOMUL, "tex" },
164 { SHADER_NV12_MASK_NOMUL, "texuv" }, 176 { SHADER_NV12_MASK_NOMUL, "texuv" },
165 { SHADER_NV12_MASK_NOMUL, "texm" }, 177 { SHADER_NV12_MASK_NOMUL, "texm" },
178 { SHADER_YUV_709, "tex" },
179 { SHADER_YUV_709, "texu" },
180 { SHADER_YUV_709, "texv" },
181 { SHADER_YUV_709_NOMUL, "tex" },
182 { SHADER_YUV_709_NOMUL, "texu" },
183 { SHADER_YUV_709_NOMUL, "texv" },
184 { SHADER_YUV_709_MASK, "tex" },
185 { SHADER_YUV_709_MASK, "texu" },
186 { SHADER_YUV_709_MASK, "texv" },
187 { SHADER_YUV_709_MASK, "texm" },
188 { SHADER_YUV_709_MASK_NOMUL, "tex" },
189 { SHADER_YUV_709_MASK_NOMUL, "texu" },
190 { SHADER_YUV_709_MASK_NOMUL, "texv" },
191 { SHADER_YUV_709_MASK_NOMUL, "texm" },
192 { SHADER_YUY2_709, "tex" },
193 { SHADER_YUY2_709, "texuv" },
194 { SHADER_YUY2_709_NOMUL, "tex" },
195 { SHADER_YUY2_709_NOMUL, "texuv" },
196 { SHADER_YUY2_709_MASK, "tex" },
197 { SHADER_YUY2_709_MASK, "texuv" },
198 { SHADER_YUY2_709_MASK, "texm" },
199 { SHADER_YUY2_709_MASK_NOMUL, "tex" },
200 { SHADER_YUY2_709_MASK_NOMUL, "texuv" },
201 { SHADER_YUY2_709_MASK_NOMUL, "texm" },
202 { SHADER_NV12_709, "tex" },
203 { SHADER_NV12_709, "texuv" },
204 { SHADER_NV12_709_NOMUL, "tex" },
205 { SHADER_NV12_709_NOMUL, "texuv" },
206 { SHADER_NV12_709_MASK, "tex" },
207 { SHADER_NV12_709_MASK, "texuv" },
208 { SHADER_NV12_709_MASK, "texm" },
209 { SHADER_NV12_709_MASK_NOMUL, "tex" },
210 { SHADER_NV12_709_MASK_NOMUL, "texuv" },
211 { SHADER_NV12_709_MASK_NOMUL, "texm" },
166 { SHADER_LAST, NULL } 212 { SHADER_LAST, NULL }
167}; 213};
168 214
diff --git a/src/modules/evas/engines/gl_common/shader/evas_gl_shaders.x b/src/modules/evas/engines/gl_common/shader/evas_gl_shaders.x
index f78119b355..965ffc126d 100644
--- a/src/modules/evas/engines/gl_common/shader/evas_gl_shaders.x
+++ b/src/modules/evas/engines/gl_common/shader/evas_gl_shaders.x
@@ -3470,16 +3470,19 @@ static const char yuv_frag_glsl[] =
3470 "void main()\n" 3470 "void main()\n"
3471 "{\n" 3471 "{\n"
3472 " vec4 c;\n" 3472 " vec4 c;\n"
3473 " float r, g, b, y, u, v;\n" 3473 " float r, g, b, y, u, v, vmu;\n"
3474 " y = texture2D(tex, tex_c).r;\n" 3474 " y = texture2D(tex, tex_c).r;\n"
3475 " u = texture2D(texu, tex_c2).r;\n" 3475 " u = texture2D(texu, tex_c2).r;\n"
3476 " v = texture2D(texv, tex_c3).r;\n" 3476 " v = texture2D(texv, tex_c3).r;\n"
3477 " y = (y - 0.0625) * 1.164;\n"
3478 " u = u - 0.5;\n" 3477 " u = u - 0.5;\n"
3479 " v = v - 0.5;\n" 3478 " v = v - 0.5;\n"
3480 " r = y + (1.402 * v);\n" 3479 " y = (y - 0.062) * 1.164;\n"
3481 " g = y - (0.34414 * u) - (0.71414 * v);\n" 3480 " vmu = (v * 0.813) + (u * 0.391);\n"
3482 " b = y + (1.772 * u);\n" 3481 " v = v * 1.596;\n"
3482 " u = u * 2.018;\n"
3483 " r = y + v;\n"
3484 " g = y - vmu;\n"
3485 " b = y + u;\n"
3483 " c = vec4(r, g, b, 1.0);\n" 3486 " c = vec4(r, g, b, 1.0);\n"
3484 " gl_FragColor =\n" 3487 " gl_FragColor =\n"
3485 " c\n" 3488 " c\n"
@@ -3537,16 +3540,19 @@ static const char yuv_nomul_frag_glsl[] =
3537 "void main()\n" 3540 "void main()\n"
3538 "{\n" 3541 "{\n"
3539 " vec4 c;\n" 3542 " vec4 c;\n"
3540 " float r, g, b, y, u, v;\n" 3543 " float r, g, b, y, u, v, vmu;\n"
3541 " y = texture2D(tex, tex_c).r;\n" 3544 " y = texture2D(tex, tex_c).r;\n"
3542 " u = texture2D(texu, tex_c2).r;\n" 3545 " u = texture2D(texu, tex_c2).r;\n"
3543 " v = texture2D(texv, tex_c3).r;\n" 3546 " v = texture2D(texv, tex_c3).r;\n"
3544 " y = (y - 0.0625) * 1.164;\n"
3545 " u = u - 0.5;\n" 3547 " u = u - 0.5;\n"
3546 " v = v - 0.5;\n" 3548 " v = v - 0.5;\n"
3547 " r = y + (1.402 * v);\n" 3549 " y = (y - 0.062) * 1.164;\n"
3548 " g = y - (0.34414 * u) - (0.71414 * v);\n" 3550 " vmu = (v * 0.813) + (u * 0.391);\n"
3549 " b = y + (1.772 * u);\n" 3551 " v = v * 1.596;\n"
3552 " u = u * 2.018;\n"
3553 " r = y + v;\n"
3554 " g = y - vmu;\n"
3555 " b = y + u;\n"
3550 " c = vec4(r, g, b, 1.0);\n" 3556 " c = vec4(r, g, b, 1.0);\n"
3551 " gl_FragColor =\n" 3557 " gl_FragColor =\n"
3552 " c\n" 3558 " c\n"
@@ -3603,16 +3609,19 @@ static const char yuv_mask_frag_glsl[] =
3603 "void main()\n" 3609 "void main()\n"
3604 "{\n" 3610 "{\n"
3605 " vec4 c;\n" 3611 " vec4 c;\n"
3606 " float r, g, b, y, u, v;\n" 3612 " float r, g, b, y, u, v, vmu;\n"
3607 " y = texture2D(tex, tex_c).r;\n" 3613 " y = texture2D(tex, tex_c).r;\n"
3608 " u = texture2D(texu, tex_c2).r;\n" 3614 " u = texture2D(texu, tex_c2).r;\n"
3609 " v = texture2D(texv, tex_c3).r;\n" 3615 " v = texture2D(texv, tex_c3).r;\n"
3610 " y = (y - 0.0625) * 1.164;\n"
3611 " u = u - 0.5;\n" 3616 " u = u - 0.5;\n"
3612 " v = v - 0.5;\n" 3617 " v = v - 0.5;\n"
3613 " r = y + (1.402 * v);\n" 3618 " y = (y - 0.062) * 1.164;\n"
3614 " g = y - (0.34414 * u) - (0.71414 * v);\n" 3619 " vmu = (v * 0.813) + (u * 0.391);\n"
3615 " b = y + (1.772 * u);\n" 3620 " v = v * 1.596;\n"
3621 " u = u * 2.018;\n"
3622 " r = y + v;\n"
3623 " g = y - vmu;\n"
3624 " b = y + u;\n"
3616 " c = vec4(r, g, b, 1.0);\n" 3625 " c = vec4(r, g, b, 1.0);\n"
3617 " gl_FragColor =\n" 3626 " gl_FragColor =\n"
3618 " c\n" 3627 " c\n"
@@ -3677,16 +3686,19 @@ static const char yuv_mask_nomul_frag_glsl[] =
3677 "void main()\n" 3686 "void main()\n"
3678 "{\n" 3687 "{\n"
3679 " vec4 c;\n" 3688 " vec4 c;\n"
3680 " float r, g, b, y, u, v;\n" 3689 " float r, g, b, y, u, v, vmu;\n"
3681 " y = texture2D(tex, tex_c).r;\n" 3690 " y = texture2D(tex, tex_c).r;\n"
3682 " u = texture2D(texu, tex_c2).r;\n" 3691 " u = texture2D(texu, tex_c2).r;\n"
3683 " v = texture2D(texv, tex_c3).r;\n" 3692 " v = texture2D(texv, tex_c3).r;\n"
3684 " y = (y - 0.0625) * 1.164;\n"
3685 " u = u - 0.5;\n" 3693 " u = u - 0.5;\n"
3686 " v = v - 0.5;\n" 3694 " v = v - 0.5;\n"
3687 " r = y + (1.402 * v);\n" 3695 " y = (y - 0.062) * 1.164;\n"
3688 " g = y - (0.34414 * u) - (0.71414 * v);\n" 3696 " vmu = (v * 0.813) + (u * 0.391);\n"
3689 " b = y + (1.772 * u);\n" 3697 " v = v * 1.596;\n"
3698 " u = u * 2.018;\n"
3699 " r = y + v;\n"
3700 " g = y - vmu;\n"
3701 " b = y + u;\n"
3690 " c = vec4(r, g, b, 1.0);\n" 3702 " c = vec4(r, g, b, 1.0);\n"
3691 " gl_FragColor =\n" 3703 " gl_FragColor =\n"
3692 " c\n" 3704 " c\n"
@@ -3744,15 +3756,16 @@ static const char yuy2_frag_glsl[] =
3744 "void main()\n" 3756 "void main()\n"
3745 "{\n" 3757 "{\n"
3746 " vec4 c;\n" 3758 " vec4 c;\n"
3747 " float y, u, v, vmu, r, g, b;\n" 3759 " float r, g, b, y, u, v, vmu;\n"
3748 " y = texture2D(tex, tex_c).g;\n" 3760 " y = texture2D(tex, tex_c).g;\n"
3749 " u = texture2D(texuv, tex_c2).g;\n" 3761 " u = texture2D(texuv, tex_c2).g;\n"
3750 " v = texture2D(texuv, tex_c2).a;\n" 3762 " v = texture2D(texuv, tex_c2).a;\n"
3751 " u = u - 0.5;\n" 3763 " u = u - 0.5;\n"
3752 " v = v - 0.5;\n" 3764 " v = v - 0.5;\n"
3753 " vmu = v * 0.813 + u * 0.391;\n" 3765 " y = (y - 0.062) * 1.164;\n"
3754 " u = u * 2.018;\n" 3766 " vmu = (v * 0.813) + (u * 0.391);\n"
3755 " v = v * 1.596;\n" 3767 " v = v * 1.596;\n"
3768 " u = u * 2.018;\n"
3756 " r = y + v;\n" 3769 " r = y + v;\n"
3757 " g = y - vmu;\n" 3770 " g = y - vmu;\n"
3758 " b = y + u;\n" 3771 " b = y + u;\n"
@@ -3808,15 +3821,16 @@ static const char yuy2_nomul_frag_glsl[] =
3808 "void main()\n" 3821 "void main()\n"
3809 "{\n" 3822 "{\n"
3810 " vec4 c;\n" 3823 " vec4 c;\n"
3811 " float y, u, v, vmu, r, g, b;\n" 3824 " float r, g, b, y, u, v, vmu;\n"
3812 " y = texture2D(tex, tex_c).g;\n" 3825 " y = texture2D(tex, tex_c).g;\n"
3813 " u = texture2D(texuv, tex_c2).g;\n" 3826 " u = texture2D(texuv, tex_c2).g;\n"
3814 " v = texture2D(texuv, tex_c2).a;\n" 3827 " v = texture2D(texuv, tex_c2).a;\n"
3815 " u = u - 0.5;\n" 3828 " u = u - 0.5;\n"
3816 " v = v - 0.5;\n" 3829 " v = v - 0.5;\n"
3817 " vmu = v * 0.813 + u * 0.391;\n" 3830 " y = (y - 0.062) * 1.164;\n"
3818 " u = u * 2.018;\n" 3831 " vmu = (v * 0.813) + (u * 0.391);\n"
3819 " v = v * 1.596;\n" 3832 " v = v * 1.596;\n"
3833 " u = u * 2.018;\n"
3820 " r = y + v;\n" 3834 " r = y + v;\n"
3821 " g = y - vmu;\n" 3835 " g = y - vmu;\n"
3822 " b = y + u;\n" 3836 " b = y + u;\n"
@@ -3871,15 +3885,16 @@ static const char yuy2_mask_frag_glsl[] =
3871 "void main()\n" 3885 "void main()\n"
3872 "{\n" 3886 "{\n"
3873 " vec4 c;\n" 3887 " vec4 c;\n"
3874 " float y, u, v, vmu, r, g, b;\n" 3888 " float r, g, b, y, u, v, vmu;\n"
3875 " y = texture2D(tex, tex_c).g;\n" 3889 " y = texture2D(tex, tex_c).g;\n"
3876 " u = texture2D(texuv, tex_c2).g;\n" 3890 " u = texture2D(texuv, tex_c2).g;\n"
3877 " v = texture2D(texuv, tex_c2).a;\n" 3891 " v = texture2D(texuv, tex_c2).a;\n"
3878 " u = u - 0.5;\n" 3892 " u = u - 0.5;\n"
3879 " v = v - 0.5;\n" 3893 " v = v - 0.5;\n"
3880 " vmu = v * 0.813 + u * 0.391;\n" 3894 " y = (y - 0.062) * 1.164;\n"
3881 " u = u * 2.018;\n" 3895 " vmu = (v * 0.813) + (u * 0.391);\n"
3882 " v = v * 1.596;\n" 3896 " v = v * 1.596;\n"
3897 " u = u * 2.018;\n"
3883 " r = y + v;\n" 3898 " r = y + v;\n"
3884 " g = y - vmu;\n" 3899 " g = y - vmu;\n"
3885 " b = y + u;\n" 3900 " b = y + u;\n"
@@ -3942,15 +3957,16 @@ static const char yuy2_mask_nomul_frag_glsl[] =
3942 "void main()\n" 3957 "void main()\n"
3943 "{\n" 3958 "{\n"
3944 " vec4 c;\n" 3959 " vec4 c;\n"
3945 " float y, u, v, vmu, r, g, b;\n" 3960 " float r, g, b, y, u, v, vmu;\n"
3946 " y = texture2D(tex, tex_c).g;\n" 3961 " y = texture2D(tex, tex_c).g;\n"
3947 " u = texture2D(texuv, tex_c2).g;\n" 3962 " u = texture2D(texuv, tex_c2).g;\n"
3948 " v = texture2D(texuv, tex_c2).a;\n" 3963 " v = texture2D(texuv, tex_c2).a;\n"
3949 " u = u - 0.5;\n" 3964 " u = u - 0.5;\n"
3950 " v = v - 0.5;\n" 3965 " v = v - 0.5;\n"
3951 " vmu = v * 0.813 + u * 0.391;\n" 3966 " y = (y - 0.062) * 1.164;\n"
3952 " u = u * 2.018;\n" 3967 " vmu = (v * 0.813) + (u * 0.391);\n"
3953 " v = v * 1.596;\n" 3968 " v = v * 1.596;\n"
3969 " u = u * 2.018;\n"
3954 " r = y + v;\n" 3970 " r = y + v;\n"
3955 " g = y - vmu;\n" 3971 " g = y - vmu;\n"
3956 " b = y + u;\n" 3972 " b = y + u;\n"
@@ -4008,16 +4024,16 @@ static const char nv12_frag_glsl[] =
4008 "void main()\n" 4024 "void main()\n"
4009 "{\n" 4025 "{\n"
4010 " vec4 c;\n" 4026 " vec4 c;\n"
4011 " float y, u, v, vmu, r, g, b;\n" 4027 " float r, g, b, y, u, v, vmu;\n"
4012 " y = texture2D(tex, tex_c).g;\n" 4028 " y = texture2D(tex, tex_c).g;\n"
4013 " u = texture2D(texuv, tex_c2).g;\n" 4029 " u = texture2D(texuv, tex_c2).g;\n"
4014 " v = texture2D(texuv, tex_c2).a;\n" 4030 " v = texture2D(texuv, tex_c2).a;\n"
4015 " u = u - 0.5;\n" 4031 " u = u - 0.5;\n"
4016 " v = v - 0.5;\n" 4032 " v = v - 0.5;\n"
4017 " vmu = v * 0.813 + u * 0.391;\n"
4018 " u = u * 2.018;\n"
4019 " v = v * 1.596;\n"
4020 " y = (y - 0.062) * 1.164;\n" 4033 " y = (y - 0.062) * 1.164;\n"
4034 " vmu = (v * 0.813) + (u * 0.391);\n"
4035 " v = v * 1.596;\n"
4036 " u = u * 2.018;\n"
4021 " r = y + v;\n" 4037 " r = y + v;\n"
4022 " g = y - vmu;\n" 4038 " g = y - vmu;\n"
4023 " b = y + u;\n" 4039 " b = y + u;\n"
@@ -4073,16 +4089,16 @@ static const char nv12_nomul_frag_glsl[] =
4073 "void main()\n" 4089 "void main()\n"
4074 "{\n" 4090 "{\n"
4075 " vec4 c;\n" 4091 " vec4 c;\n"
4076 " float y, u, v, vmu, r, g, b;\n" 4092 " float r, g, b, y, u, v, vmu;\n"
4077 " y = texture2D(tex, tex_c).g;\n" 4093 " y = texture2D(tex, tex_c).g;\n"
4078 " u = texture2D(texuv, tex_c2).g;\n" 4094 " u = texture2D(texuv, tex_c2).g;\n"
4079 " v = texture2D(texuv, tex_c2).a;\n" 4095 " v = texture2D(texuv, tex_c2).a;\n"
4080 " u = u - 0.5;\n" 4096 " u = u - 0.5;\n"
4081 " v = v - 0.5;\n" 4097 " v = v - 0.5;\n"
4082 " vmu = v * 0.813 + u * 0.391;\n"
4083 " u = u * 2.018;\n"
4084 " v = v * 1.596;\n"
4085 " y = (y - 0.062) * 1.164;\n" 4098 " y = (y - 0.062) * 1.164;\n"
4099 " vmu = (v * 0.813) + (u * 0.391);\n"
4100 " v = v * 1.596;\n"
4101 " u = u * 2.018;\n"
4086 " r = y + v;\n" 4102 " r = y + v;\n"
4087 " g = y - vmu;\n" 4103 " g = y - vmu;\n"
4088 " b = y + u;\n" 4104 " b = y + u;\n"
@@ -4137,16 +4153,16 @@ static const char nv12_mask_frag_glsl[] =
4137 "void main()\n" 4153 "void main()\n"
4138 "{\n" 4154 "{\n"
4139 " vec4 c;\n" 4155 " vec4 c;\n"
4140 " float y, u, v, vmu, r, g, b;\n" 4156 " float r, g, b, y, u, v, vmu;\n"
4141 " y = texture2D(tex, tex_c).g;\n" 4157 " y = texture2D(tex, tex_c).g;\n"
4142 " u = texture2D(texuv, tex_c2).g;\n" 4158 " u = texture2D(texuv, tex_c2).g;\n"
4143 " v = texture2D(texuv, tex_c2).a;\n" 4159 " v = texture2D(texuv, tex_c2).a;\n"
4144 " u = u - 0.5;\n" 4160 " u = u - 0.5;\n"
4145 " v = v - 0.5;\n" 4161 " v = v - 0.5;\n"
4146 " vmu = v * 0.813 + u * 0.391;\n"
4147 " u = u * 2.018;\n"
4148 " v = v * 1.596;\n"
4149 " y = (y - 0.062) * 1.164;\n" 4162 " y = (y - 0.062) * 1.164;\n"
4163 " vmu = (v * 0.813) + (u * 0.391);\n"
4164 " v = v * 1.596;\n"
4165 " u = u * 2.018;\n"
4150 " r = y + v;\n" 4166 " r = y + v;\n"
4151 " g = y - vmu;\n" 4167 " g = y - vmu;\n"
4152 " b = y + u;\n" 4168 " b = y + u;\n"
@@ -4209,16 +4225,16 @@ static const char nv12_mask_nomul_frag_glsl[] =
4209 "void main()\n" 4225 "void main()\n"
4210 "{\n" 4226 "{\n"
4211 " vec4 c;\n" 4227 " vec4 c;\n"
4212 " float y, u, v, vmu, r, g, b;\n" 4228 " float r, g, b, y, u, v, vmu;\n"
4213 " y = texture2D(tex, tex_c).g;\n" 4229 " y = texture2D(tex, tex_c).g;\n"
4214 " u = texture2D(texuv, tex_c2).g;\n" 4230 " u = texture2D(texuv, tex_c2).g;\n"
4215 " v = texture2D(texuv, tex_c2).a;\n" 4231 " v = texture2D(texuv, tex_c2).a;\n"
4216 " u = u - 0.5;\n" 4232 " u = u - 0.5;\n"
4217 " v = v - 0.5;\n" 4233 " v = v - 0.5;\n"
4218 " vmu = v * 0.813 + u * 0.391;\n"
4219 " u = u * 2.018;\n"
4220 " v = v * 1.596;\n"
4221 " y = (y - 0.062) * 1.164;\n" 4234 " y = (y - 0.062) * 1.164;\n"
4235 " vmu = (v * 0.813) + (u * 0.391);\n"
4236 " v = v * 1.596;\n"
4237 " u = u * 2.018;\n"
4222 " r = y + v;\n" 4238 " r = y + v;\n"
4223 " g = y - vmu;\n" 4239 " g = y - vmu;\n"
4224 " b = y + u;\n" 4240 " b = y + u;\n"
@@ -4260,6 +4276,830 @@ Evas_GL_Program_Source shader_nv12_mask_nomul_vert_src =
4260 NULL, 0 4276 NULL, 0
4261}; 4277};
4262 4278
4279static const char yuv_709_frag_glsl[] =
4280 "#ifdef GL_ES\n"
4281 "#ifdef GL_FRAGMENT_PRECISION_HIGH\n"
4282 "precision highp float;\n"
4283 "#else\n"
4284 "precision mediump float;\n"
4285 "#endif\n"
4286 "#endif\n"
4287 "varying vec4 col;\n"
4288 "uniform sampler2D tex;\n"
4289 "varying vec2 tex_c;\n"
4290 "uniform sampler2D texu;\n"
4291 "uniform sampler2D texv;\n"
4292 "varying vec2 tex_c2;\n"
4293 "varying vec2 tex_c3;\n"
4294 "void main()\n"
4295 "{\n"
4296 " vec4 c;\n"
4297 " float r, g, b, y, u, v, vmu;\n"
4298 " y = texture2D(tex, tex_c).r;\n"
4299 " u = texture2D(texu, tex_c2).r;\n"
4300 " v = texture2D(texv, tex_c3).r;\n"
4301 " u = u - 0.5;\n"
4302 " v = v - 0.5;\n"
4303 " y = (y - 0.062) * 1.164;\n"
4304 " vmu = (v * 0.534) + (u * 0.213);\n"
4305 " v = v * 1.793;\n"
4306 " u = u * 2.115;\n"
4307 " r = y + v;\n"
4308 " g = y - vmu;\n"
4309 " b = y + u;\n"
4310 " c = vec4(r, g, b, 1.0);\n"
4311 " gl_FragColor =\n"
4312 " c\n"
4313 " * col\n"
4314 " ;\n"
4315 "}\n";
4316Evas_GL_Program_Source shader_yuv_709_frag_src =
4317{
4318 yuv_709_frag_glsl,
4319 NULL, 0
4320};
4321
4322static const char yuv_709_vert_glsl[] =
4323 "#ifdef GL_ES\n"
4324 "precision highp float;\n"
4325 "#endif\n"
4326 "attribute vec4 vertex;\n"
4327 "uniform mat4 mvp;\n"
4328 "attribute vec4 color;\n"
4329 "varying vec4 col;\n"
4330 "attribute vec2 tex_coord;\n"
4331 "varying vec2 tex_c;\n"
4332 "attribute vec2 tex_coord2;\n"
4333 "varying vec2 tex_c2;\n"
4334 "attribute vec2 tex_coord3;\n"
4335 "varying vec2 tex_c3;\n"
4336 "void main()\n"
4337 "{\n"
4338 " gl_Position = mvp * vertex;\n"
4339 " col = color;\n"
4340 " tex_c = tex_coord;\n"
4341 " tex_c2 = tex_coord2;\n"
4342 " tex_c3 = tex_coord3;\n"
4343 "}\n";
4344Evas_GL_Program_Source shader_yuv_709_vert_src =
4345{
4346 yuv_709_vert_glsl,
4347 NULL, 0
4348};
4349
4350static const char yuv_709_nomul_frag_glsl[] =
4351 "#ifdef GL_ES\n"
4352 "#ifdef GL_FRAGMENT_PRECISION_HIGH\n"
4353 "precision highp float;\n"
4354 "#else\n"
4355 "precision mediump float;\n"
4356 "#endif\n"
4357 "#endif\n"
4358 "uniform sampler2D tex;\n"
4359 "varying vec2 tex_c;\n"
4360 "uniform sampler2D texu;\n"
4361 "uniform sampler2D texv;\n"
4362 "varying vec2 tex_c2;\n"
4363 "varying vec2 tex_c3;\n"
4364 "void main()\n"
4365 "{\n"
4366 " vec4 c;\n"
4367 " float r, g, b, y, u, v, vmu;\n"
4368 " y = texture2D(tex, tex_c).r;\n"
4369 " u = texture2D(texu, tex_c2).r;\n"
4370 " v = texture2D(texv, tex_c3).r;\n"
4371 " u = u - 0.5;\n"
4372 " v = v - 0.5;\n"
4373 " y = (y - 0.062) * 1.164;\n"
4374 " vmu = (v * 0.534) + (u * 0.213);\n"
4375 " v = v * 1.793;\n"
4376 " u = u * 2.115;\n"
4377 " r = y + v;\n"
4378 " g = y - vmu;\n"
4379 " b = y + u;\n"
4380 " c = vec4(r, g, b, 1.0);\n"
4381 " gl_FragColor =\n"
4382 " c\n"
4383 " ;\n"
4384 "}\n";
4385Evas_GL_Program_Source shader_yuv_709_nomul_frag_src =
4386{
4387 yuv_709_nomul_frag_glsl,
4388 NULL, 0
4389};
4390
4391static const char yuv_709_nomul_vert_glsl[] =
4392 "#ifdef GL_ES\n"
4393 "precision highp float;\n"
4394 "#endif\n"
4395 "attribute vec4 vertex;\n"
4396 "uniform mat4 mvp;\n"
4397 "attribute vec2 tex_coord;\n"
4398 "varying vec2 tex_c;\n"
4399 "attribute vec2 tex_coord2;\n"
4400 "varying vec2 tex_c2;\n"
4401 "attribute vec2 tex_coord3;\n"
4402 "varying vec2 tex_c3;\n"
4403 "void main()\n"
4404 "{\n"
4405 " gl_Position = mvp * vertex;\n"
4406 " tex_c = tex_coord;\n"
4407 " tex_c2 = tex_coord2;\n"
4408 " tex_c3 = tex_coord3;\n"
4409 "}\n";
4410Evas_GL_Program_Source shader_yuv_709_nomul_vert_src =
4411{
4412 yuv_709_nomul_vert_glsl,
4413 NULL, 0
4414};
4415
4416static const char yuv_709_mask_frag_glsl[] =
4417 "#ifdef GL_ES\n"
4418 "#ifdef GL_FRAGMENT_PRECISION_HIGH\n"
4419 "precision highp float;\n"
4420 "#else\n"
4421 "precision mediump float;\n"
4422 "#endif\n"
4423 "#endif\n"
4424 "varying vec4 col;\n"
4425 "uniform sampler2D tex;\n"
4426 "varying vec2 tex_c;\n"
4427 "uniform sampler2D texu;\n"
4428 "uniform sampler2D texv;\n"
4429 "varying vec2 tex_c2;\n"
4430 "varying vec2 tex_c3;\n"
4431 "uniform sampler2D texm;\n"
4432 "varying vec2 tex_m;\n"
4433 "void main()\n"
4434 "{\n"
4435 " vec4 c;\n"
4436 " float r, g, b, y, u, v, vmu;\n"
4437 " y = texture2D(tex, tex_c).r;\n"
4438 " u = texture2D(texu, tex_c2).r;\n"
4439 " v = texture2D(texv, tex_c3).r;\n"
4440 " u = u - 0.5;\n"
4441 " v = v - 0.5;\n"
4442 " y = (y - 0.062) * 1.164;\n"
4443 " vmu = (v * 0.534) + (u * 0.213);\n"
4444 " v = v * 1.793;\n"
4445 " u = u * 2.115;\n"
4446 " r = y + v;\n"
4447 " g = y - vmu;\n"
4448 " b = y + u;\n"
4449 " c = vec4(r, g, b, 1.0);\n"
4450 " gl_FragColor =\n"
4451 " c\n"
4452 " * col\n"
4453 " * texture2D(texm, tex_m).a\n"
4454 " ;\n"
4455 "}\n";
4456Evas_GL_Program_Source shader_yuv_709_mask_frag_src =
4457{
4458 yuv_709_mask_frag_glsl,
4459 NULL, 0
4460};
4461
4462static const char yuv_709_mask_vert_glsl[] =
4463 "#ifdef GL_ES\n"
4464 "precision highp float;\n"
4465 "#endif\n"
4466 "attribute vec4 vertex;\n"
4467 "uniform mat4 mvp;\n"
4468 "attribute vec4 color;\n"
4469 "varying vec4 col;\n"
4470 "attribute vec2 tex_coord;\n"
4471 "varying vec2 tex_c;\n"
4472 "attribute vec2 tex_coord2;\n"
4473 "varying vec2 tex_c2;\n"
4474 "attribute vec2 tex_coord3;\n"
4475 "varying vec2 tex_c3;\n"
4476 "attribute vec4 mask_coord;\n"
4477 "varying vec2 tex_m;\n"
4478 "void main()\n"
4479 "{\n"
4480 " gl_Position = mvp * vertex;\n"
4481 " col = color;\n"
4482 " tex_c = tex_coord;\n"
4483 " tex_c2 = tex_coord2;\n"
4484 " tex_c3 = tex_coord3;\n"
4485 " vec4 mask_Position = mvp * vertex * vec4(0.5, sign(mask_coord.w) * 0.5, 0.5, 0.5) + vec4(0.5, 0.5, 0, 0);\n"
4486 " tex_m = mask_Position.xy * abs(mask_coord.zw) + mask_coord.xy;\n"
4487 "}\n";
4488Evas_GL_Program_Source shader_yuv_709_mask_vert_src =
4489{
4490 yuv_709_mask_vert_glsl,
4491 NULL, 0
4492};
4493
4494static const char yuv_709_mask_nomul_frag_glsl[] =
4495 "#ifdef GL_ES\n"
4496 "#ifdef GL_FRAGMENT_PRECISION_HIGH\n"
4497 "precision highp float;\n"
4498 "#else\n"
4499 "precision mediump float;\n"
4500 "#endif\n"
4501 "#endif\n"
4502 "uniform sampler2D tex;\n"
4503 "varying vec2 tex_c;\n"
4504 "uniform sampler2D texu;\n"
4505 "uniform sampler2D texv;\n"
4506 "varying vec2 tex_c2;\n"
4507 "varying vec2 tex_c3;\n"
4508 "uniform sampler2D texm;\n"
4509 "varying vec2 tex_m;\n"
4510 "void main()\n"
4511 "{\n"
4512 " vec4 c;\n"
4513 " float r, g, b, y, u, v, vmu;\n"
4514 " y = texture2D(tex, tex_c).r;\n"
4515 " u = texture2D(texu, tex_c2).r;\n"
4516 " v = texture2D(texv, tex_c3).r;\n"
4517 " u = u - 0.5;\n"
4518 " v = v - 0.5;\n"
4519 " y = (y - 0.062) * 1.164;\n"
4520 " vmu = (v * 0.534) + (u * 0.213);\n"
4521 " v = v * 1.793;\n"
4522 " u = u * 2.115;\n"
4523 " r = y + v;\n"
4524 " g = y - vmu;\n"
4525 " b = y + u;\n"
4526 " c = vec4(r, g, b, 1.0);\n"
4527 " gl_FragColor =\n"
4528 " c\n"
4529 " * texture2D(texm, tex_m).a\n"
4530 " ;\n"
4531 "}\n";
4532Evas_GL_Program_Source shader_yuv_709_mask_nomul_frag_src =
4533{
4534 yuv_709_mask_nomul_frag_glsl,
4535 NULL, 0
4536};
4537
4538static const char yuv_709_mask_nomul_vert_glsl[] =
4539 "#ifdef GL_ES\n"
4540 "precision highp float;\n"
4541 "#endif\n"
4542 "attribute vec4 vertex;\n"
4543 "uniform mat4 mvp;\n"
4544 "attribute vec2 tex_coord;\n"
4545 "varying vec2 tex_c;\n"
4546 "attribute vec2 tex_coord2;\n"
4547 "varying vec2 tex_c2;\n"
4548 "attribute vec2 tex_coord3;\n"
4549 "varying vec2 tex_c3;\n"
4550 "attribute vec4 mask_coord;\n"
4551 "varying vec2 tex_m;\n"
4552 "void main()\n"
4553 "{\n"
4554 " gl_Position = mvp * vertex;\n"
4555 " tex_c = tex_coord;\n"
4556 " tex_c2 = tex_coord2;\n"
4557 " tex_c3 = tex_coord3;\n"
4558 " vec4 mask_Position = mvp * vertex * vec4(0.5, sign(mask_coord.w) * 0.5, 0.5, 0.5) + vec4(0.5, 0.5, 0, 0);\n"
4559 " tex_m = mask_Position.xy * abs(mask_coord.zw) + mask_coord.xy;\n"
4560 "}\n";
4561Evas_GL_Program_Source shader_yuv_709_mask_nomul_vert_src =
4562{
4563 yuv_709_mask_nomul_vert_glsl,
4564 NULL, 0
4565};
4566
4567static const char yuy2_709_frag_glsl[] =
4568 "#ifdef GL_ES\n"
4569 "#ifdef GL_FRAGMENT_PRECISION_HIGH\n"
4570 "precision highp float;\n"
4571 "#else\n"
4572 "precision mediump float;\n"
4573 "#endif\n"
4574 "#endif\n"
4575 "varying vec4 col;\n"
4576 "uniform sampler2D tex;\n"
4577 "varying vec2 tex_c;\n"
4578 "uniform sampler2D texuv;\n"
4579 "varying vec2 tex_c2;\n"
4580 "void main()\n"
4581 "{\n"
4582 " vec4 c;\n"
4583 " float r, g, b, y, u, v, vmu;\n"
4584 " y = texture2D(tex, tex_c).g;\n"
4585 " u = texture2D(texuv, tex_c2).g;\n"
4586 " v = texture2D(texuv, tex_c2).a;\n"
4587 " u = u - 0.5;\n"
4588 " v = v - 0.5;\n"
4589 " y = (y - 0.062) * 1.164;\n"
4590 " vmu = (v * 0.534) + (u * 0.213);\n"
4591 " v = v * 1.793;\n"
4592 " u = u * 2.115;\n"
4593 " r = y + v;\n"
4594 " g = y - vmu;\n"
4595 " b = y + u;\n"
4596 " c = vec4(r, g, b, 1.0);\n"
4597 " gl_FragColor =\n"
4598 " c\n"
4599 " * col\n"
4600 " ;\n"
4601 "}\n";
4602Evas_GL_Program_Source shader_yuy2_709_frag_src =
4603{
4604 yuy2_709_frag_glsl,
4605 NULL, 0
4606};
4607
4608static const char yuy2_709_vert_glsl[] =
4609 "#ifdef GL_ES\n"
4610 "precision highp float;\n"
4611 "#endif\n"
4612 "attribute vec4 vertex;\n"
4613 "uniform mat4 mvp;\n"
4614 "attribute vec4 color;\n"
4615 "varying vec4 col;\n"
4616 "attribute vec2 tex_coord;\n"
4617 "varying vec2 tex_c;\n"
4618 "attribute vec2 tex_coord2;\n"
4619 "varying vec2 tex_c2;\n"
4620 "void main()\n"
4621 "{\n"
4622 " gl_Position = mvp * vertex;\n"
4623 " col = color;\n"
4624 " tex_c = tex_coord;\n"
4625 " tex_c2 = vec2(tex_coord2.x * 0.5, tex_coord2.y);\n"
4626 "}\n";
4627Evas_GL_Program_Source shader_yuy2_709_vert_src =
4628{
4629 yuy2_709_vert_glsl,
4630 NULL, 0
4631};
4632
4633static const char yuy2_709_nomul_frag_glsl[] =
4634 "#ifdef GL_ES\n"
4635 "#ifdef GL_FRAGMENT_PRECISION_HIGH\n"
4636 "precision highp float;\n"
4637 "#else\n"
4638 "precision mediump float;\n"
4639 "#endif\n"
4640 "#endif\n"
4641 "uniform sampler2D tex;\n"
4642 "varying vec2 tex_c;\n"
4643 "uniform sampler2D texuv;\n"
4644 "varying vec2 tex_c2;\n"
4645 "void main()\n"
4646 "{\n"
4647 " vec4 c;\n"
4648 " float r, g, b, y, u, v, vmu;\n"
4649 " y = texture2D(tex, tex_c).g;\n"
4650 " u = texture2D(texuv, tex_c2).g;\n"
4651 " v = texture2D(texuv, tex_c2).a;\n"
4652 " u = u - 0.5;\n"
4653 " v = v - 0.5;\n"
4654 " y = (y - 0.062) * 1.164;\n"
4655 " vmu = (v * 0.534) + (u * 0.213);\n"
4656 " v = v * 1.793;\n"
4657 " u = u * 2.115;\n"
4658 " r = y + v;\n"
4659 " g = y - vmu;\n"
4660 " b = y + u;\n"
4661 " c = vec4(r, g, b, 1.0);\n"
4662 " gl_FragColor =\n"
4663 " c\n"
4664 " ;\n"
4665 "}\n";
4666Evas_GL_Program_Source shader_yuy2_709_nomul_frag_src =
4667{
4668 yuy2_709_nomul_frag_glsl,
4669 NULL, 0
4670};
4671
4672static const char yuy2_709_nomul_vert_glsl[] =
4673 "#ifdef GL_ES\n"
4674 "precision highp float;\n"
4675 "#endif\n"
4676 "attribute vec4 vertex;\n"
4677 "uniform mat4 mvp;\n"
4678 "attribute vec2 tex_coord;\n"
4679 "varying vec2 tex_c;\n"
4680 "attribute vec2 tex_coord2;\n"
4681 "varying vec2 tex_c2;\n"
4682 "void main()\n"
4683 "{\n"
4684 " gl_Position = mvp * vertex;\n"
4685 " tex_c = tex_coord;\n"
4686 " tex_c2 = vec2(tex_coord2.x * 0.5, tex_coord2.y);\n"
4687 "}\n";
4688Evas_GL_Program_Source shader_yuy2_709_nomul_vert_src =
4689{
4690 yuy2_709_nomul_vert_glsl,
4691 NULL, 0
4692};
4693
4694static const char yuy2_709_mask_frag_glsl[] =
4695 "#ifdef GL_ES\n"
4696 "#ifdef GL_FRAGMENT_PRECISION_HIGH\n"
4697 "precision highp float;\n"
4698 "#else\n"
4699 "precision mediump float;\n"
4700 "#endif\n"
4701 "#endif\n"
4702 "varying vec4 col;\n"
4703 "uniform sampler2D tex;\n"
4704 "varying vec2 tex_c;\n"
4705 "uniform sampler2D texuv;\n"
4706 "varying vec2 tex_c2;\n"
4707 "uniform sampler2D texm;\n"
4708 "varying vec2 tex_m;\n"
4709 "void main()\n"
4710 "{\n"
4711 " vec4 c;\n"
4712 " float r, g, b, y, u, v, vmu;\n"
4713 " y = texture2D(tex, tex_c).g;\n"
4714 " u = texture2D(texuv, tex_c2).g;\n"
4715 " v = texture2D(texuv, tex_c2).a;\n"
4716 " u = u - 0.5;\n"
4717 " v = v - 0.5;\n"
4718 " y = (y - 0.062) * 1.164;\n"
4719 " vmu = (v * 0.534) + (u * 0.213);\n"
4720 " v = v * 1.793;\n"
4721 " u = u * 2.115;\n"
4722 " r = y + v;\n"
4723 " g = y - vmu;\n"
4724 " b = y + u;\n"
4725 " c = vec4(r, g, b, 1.0);\n"
4726 " gl_FragColor =\n"
4727 " c\n"
4728 " * col\n"
4729 " * texture2D(texm, tex_m).a\n"
4730 " ;\n"
4731 "}\n";
4732Evas_GL_Program_Source shader_yuy2_709_mask_frag_src =
4733{
4734 yuy2_709_mask_frag_glsl,
4735 NULL, 0
4736};
4737
4738static const char yuy2_709_mask_vert_glsl[] =
4739 "#ifdef GL_ES\n"
4740 "precision highp float;\n"
4741 "#endif\n"
4742 "attribute vec4 vertex;\n"
4743 "uniform mat4 mvp;\n"
4744 "attribute vec4 color;\n"
4745 "varying vec4 col;\n"
4746 "attribute vec2 tex_coord;\n"
4747 "varying vec2 tex_c;\n"
4748 "attribute vec2 tex_coord2;\n"
4749 "varying vec2 tex_c2;\n"
4750 "attribute vec4 mask_coord;\n"
4751 "varying vec2 tex_m;\n"
4752 "void main()\n"
4753 "{\n"
4754 " gl_Position = mvp * vertex;\n"
4755 " col = color;\n"
4756 " tex_c = tex_coord;\n"
4757 " tex_c2 = vec2(tex_coord2.x * 0.5, tex_coord2.y);\n"
4758 " vec4 mask_Position = mvp * vertex * vec4(0.5, sign(mask_coord.w) * 0.5, 0.5, 0.5) + vec4(0.5, 0.5, 0, 0);\n"
4759 " tex_m = mask_Position.xy * abs(mask_coord.zw) + mask_coord.xy;\n"
4760 "}\n";
4761Evas_GL_Program_Source shader_yuy2_709_mask_vert_src =
4762{
4763 yuy2_709_mask_vert_glsl,
4764 NULL, 0
4765};
4766
4767static const char yuy2_709_mask_nomul_frag_glsl[] =
4768 "#ifdef GL_ES\n"
4769 "#ifdef GL_FRAGMENT_PRECISION_HIGH\n"
4770 "precision highp float;\n"
4771 "#else\n"
4772 "precision mediump float;\n"
4773 "#endif\n"
4774 "#endif\n"
4775 "uniform sampler2D tex;\n"
4776 "varying vec2 tex_c;\n"
4777 "uniform sampler2D texuv;\n"
4778 "varying vec2 tex_c2;\n"
4779 "uniform sampler2D texm;\n"
4780 "varying vec2 tex_m;\n"
4781 "void main()\n"
4782 "{\n"
4783 " vec4 c;\n"
4784 " float r, g, b, y, u, v, vmu;\n"
4785 " y = texture2D(tex, tex_c).g;\n"
4786 " u = texture2D(texuv, tex_c2).g;\n"
4787 " v = texture2D(texuv, tex_c2).a;\n"
4788 " u = u - 0.5;\n"
4789 " v = v - 0.5;\n"
4790 " y = (y - 0.062) * 1.164;\n"
4791 " vmu = (v * 0.534) + (u * 0.213);\n"
4792 " v = v * 1.793;\n"
4793 " u = u * 2.115;\n"
4794 " r = y + v;\n"
4795 " g = y - vmu;\n"
4796 " b = y + u;\n"
4797 " c = vec4(r, g, b, 1.0);\n"
4798 " gl_FragColor =\n"
4799 " c\n"
4800 " * texture2D(texm, tex_m).a\n"
4801 " ;\n"
4802 "}\n";
4803Evas_GL_Program_Source shader_yuy2_709_mask_nomul_frag_src =
4804{
4805 yuy2_709_mask_nomul_frag_glsl,
4806 NULL, 0
4807};
4808
4809static const char yuy2_709_mask_nomul_vert_glsl[] =
4810 "#ifdef GL_ES\n"
4811 "precision highp float;\n"
4812 "#endif\n"
4813 "attribute vec4 vertex;\n"
4814 "uniform mat4 mvp;\n"
4815 "attribute vec2 tex_coord;\n"
4816 "varying vec2 tex_c;\n"
4817 "attribute vec2 tex_coord2;\n"
4818 "varying vec2 tex_c2;\n"
4819 "attribute vec4 mask_coord;\n"
4820 "varying vec2 tex_m;\n"
4821 "void main()\n"
4822 "{\n"
4823 " gl_Position = mvp * vertex;\n"
4824 " tex_c = tex_coord;\n"
4825 " tex_c2 = vec2(tex_coord2.x * 0.5, tex_coord2.y);\n"
4826 " vec4 mask_Position = mvp * vertex * vec4(0.5, sign(mask_coord.w) * 0.5, 0.5, 0.5) + vec4(0.5, 0.5, 0, 0);\n"
4827 " tex_m = mask_Position.xy * abs(mask_coord.zw) + mask_coord.xy;\n"
4828 "}\n";
4829Evas_GL_Program_Source shader_yuy2_709_mask_nomul_vert_src =
4830{
4831 yuy2_709_mask_nomul_vert_glsl,
4832 NULL, 0
4833};
4834
4835static const char nv12_709_frag_glsl[] =
4836 "#ifdef GL_ES\n"
4837 "#ifdef GL_FRAGMENT_PRECISION_HIGH\n"
4838 "precision highp float;\n"
4839 "#else\n"
4840 "precision mediump float;\n"
4841 "#endif\n"
4842 "#endif\n"
4843 "varying vec4 col;\n"
4844 "uniform sampler2D tex;\n"
4845 "varying vec2 tex_c;\n"
4846 "uniform sampler2D texuv;\n"
4847 "varying vec2 tex_c2;\n"
4848 "void main()\n"
4849 "{\n"
4850 " vec4 c;\n"
4851 " float r, g, b, y, u, v, vmu;\n"
4852 " y = texture2D(tex, tex_c).g;\n"
4853 " u = texture2D(texuv, tex_c2).g;\n"
4854 " v = texture2D(texuv, tex_c2).a;\n"
4855 " u = u - 0.5;\n"
4856 " v = v - 0.5;\n"
4857 " y = (y - 0.062) * 1.164;\n"
4858 " vmu = (v * 0.534) + (u * 0.213);\n"
4859 " v = v * 1.793;\n"
4860 " u = u * 2.115;\n"
4861 " r = y + v;\n"
4862 " g = y - vmu;\n"
4863 " b = y + u;\n"
4864 " c = vec4(r, g, b, 1.0);\n"
4865 " gl_FragColor =\n"
4866 " c\n"
4867 " * col\n"
4868 " ;\n"
4869 "}\n";
4870Evas_GL_Program_Source shader_nv12_709_frag_src =
4871{
4872 nv12_709_frag_glsl,
4873 NULL, 0
4874};
4875
4876static const char nv12_709_vert_glsl[] =
4877 "#ifdef GL_ES\n"
4878 "precision highp float;\n"
4879 "#endif\n"
4880 "attribute vec4 vertex;\n"
4881 "uniform mat4 mvp;\n"
4882 "attribute vec4 color;\n"
4883 "varying vec4 col;\n"
4884 "attribute vec2 tex_coord;\n"
4885 "varying vec2 tex_c;\n"
4886 "attribute vec2 tex_coord2;\n"
4887 "varying vec2 tex_c2;\n"
4888 "void main()\n"
4889 "{\n"
4890 " gl_Position = mvp * vertex;\n"
4891 " col = color;\n"
4892 " tex_c = tex_coord;\n"
4893 " tex_c2 = tex_coord2 * 0.5;\n"
4894 "}\n";
4895Evas_GL_Program_Source shader_nv12_709_vert_src =
4896{
4897 nv12_709_vert_glsl,
4898 NULL, 0
4899};
4900
4901static const char nv12_709_nomul_frag_glsl[] =
4902 "#ifdef GL_ES\n"
4903 "#ifdef GL_FRAGMENT_PRECISION_HIGH\n"
4904 "precision highp float;\n"
4905 "#else\n"
4906 "precision mediump float;\n"
4907 "#endif\n"
4908 "#endif\n"
4909 "uniform sampler2D tex;\n"
4910 "varying vec2 tex_c;\n"
4911 "uniform sampler2D texuv;\n"
4912 "varying vec2 tex_c2;\n"
4913 "void main()\n"
4914 "{\n"
4915 " vec4 c;\n"
4916 " float r, g, b, y, u, v, vmu;\n"
4917 " y = texture2D(tex, tex_c).g;\n"
4918 " u = texture2D(texuv, tex_c2).g;\n"
4919 " v = texture2D(texuv, tex_c2).a;\n"
4920 " u = u - 0.5;\n"
4921 " v = v - 0.5;\n"
4922 " y = (y - 0.062) * 1.164;\n"
4923 " vmu = (v * 0.534) + (u * 0.213);\n"
4924 " v = v * 1.793;\n"
4925 " u = u * 2.115;\n"
4926 " r = y + v;\n"
4927 " g = y - vmu;\n"
4928 " b = y + u;\n"
4929 " c = vec4(r, g, b, 1.0);\n"
4930 " gl_FragColor =\n"
4931 " c\n"
4932 " ;\n"
4933 "}\n";
4934Evas_GL_Program_Source shader_nv12_709_nomul_frag_src =
4935{
4936 nv12_709_nomul_frag_glsl,
4937 NULL, 0
4938};
4939
4940static const char nv12_709_nomul_vert_glsl[] =
4941 "#ifdef GL_ES\n"
4942 "precision highp float;\n"
4943 "#endif\n"
4944 "attribute vec4 vertex;\n"
4945 "uniform mat4 mvp;\n"
4946 "attribute vec2 tex_coord;\n"
4947 "varying vec2 tex_c;\n"
4948 "attribute vec2 tex_coord2;\n"
4949 "varying vec2 tex_c2;\n"
4950 "void main()\n"
4951 "{\n"
4952 " gl_Position = mvp * vertex;\n"
4953 " tex_c = tex_coord;\n"
4954 " tex_c2 = tex_coord2 * 0.5;\n"
4955 "}\n";
4956Evas_GL_Program_Source shader_nv12_709_nomul_vert_src =
4957{
4958 nv12_709_nomul_vert_glsl,
4959 NULL, 0
4960};
4961
4962static const char nv12_709_mask_frag_glsl[] =
4963 "#ifdef GL_ES\n"
4964 "#ifdef GL_FRAGMENT_PRECISION_HIGH\n"
4965 "precision highp float;\n"
4966 "#else\n"
4967 "precision mediump float;\n"
4968 "#endif\n"
4969 "#endif\n"
4970 "varying vec4 col;\n"
4971 "uniform sampler2D tex;\n"
4972 "varying vec2 tex_c;\n"
4973 "uniform sampler2D texuv;\n"
4974 "varying vec2 tex_c2;\n"
4975 "uniform sampler2D texm;\n"
4976 "varying vec2 tex_m;\n"
4977 "void main()\n"
4978 "{\n"
4979 " vec4 c;\n"
4980 " float r, g, b, y, u, v, vmu;\n"
4981 " y = texture2D(tex, tex_c).g;\n"
4982 " u = texture2D(texuv, tex_c2).g;\n"
4983 " v = texture2D(texuv, tex_c2).a;\n"
4984 " u = u - 0.5;\n"
4985 " v = v - 0.5;\n"
4986 " y = (y - 0.062) * 1.164;\n"
4987 " vmu = (v * 0.534) + (u * 0.213);\n"
4988 " v = v * 1.793;\n"
4989 " u = u * 2.115;\n"
4990 " r = y + v;\n"
4991 " g = y - vmu;\n"
4992 " b = y + u;\n"
4993 " c = vec4(r, g, b, 1.0);\n"
4994 " gl_FragColor =\n"
4995 " c\n"
4996 " * col\n"
4997 " * texture2D(texm, tex_m).a\n"
4998 " ;\n"
4999 "}\n";
5000Evas_GL_Program_Source shader_nv12_709_mask_frag_src =
5001{
5002 nv12_709_mask_frag_glsl,
5003 NULL, 0
5004};
5005
5006static const char nv12_709_mask_vert_glsl[] =
5007 "#ifdef GL_ES\n"
5008 "precision highp float;\n"
5009 "#endif\n"
5010 "attribute vec4 vertex;\n"
5011 "uniform mat4 mvp;\n"
5012 "attribute vec4 color;\n"
5013 "varying vec4 col;\n"
5014 "attribute vec2 tex_coord;\n"
5015 "varying vec2 tex_c;\n"
5016 "attribute vec2 tex_coord2;\n"
5017 "varying vec2 tex_c2;\n"
5018 "attribute vec4 mask_coord;\n"
5019 "varying vec2 tex_m;\n"
5020 "void main()\n"
5021 "{\n"
5022 " gl_Position = mvp * vertex;\n"
5023 " col = color;\n"
5024 " tex_c = tex_coord;\n"
5025 " tex_c2 = tex_coord2 * 0.5;\n"
5026 " vec4 mask_Position = mvp * vertex * vec4(0.5, sign(mask_coord.w) * 0.5, 0.5, 0.5) + vec4(0.5, 0.5, 0, 0);\n"
5027 " tex_m = mask_Position.xy * abs(mask_coord.zw) + mask_coord.xy;\n"
5028 "}\n";
5029Evas_GL_Program_Source shader_nv12_709_mask_vert_src =
5030{
5031 nv12_709_mask_vert_glsl,
5032 NULL, 0
5033};
5034
5035static const char nv12_709_mask_nomul_frag_glsl[] =
5036 "#ifdef GL_ES\n"
5037 "#ifdef GL_FRAGMENT_PRECISION_HIGH\n"
5038 "precision highp float;\n"
5039 "#else\n"
5040 "precision mediump float;\n"
5041 "#endif\n"
5042 "#endif\n"
5043 "uniform sampler2D tex;\n"
5044 "varying vec2 tex_c;\n"
5045 "uniform sampler2D texuv;\n"
5046 "varying vec2 tex_c2;\n"
5047 "uniform sampler2D texm;\n"
5048 "varying vec2 tex_m;\n"
5049 "void main()\n"
5050 "{\n"
5051 " vec4 c;\n"
5052 " float r, g, b, y, u, v, vmu;\n"
5053 " y = texture2D(tex, tex_c).g;\n"
5054 " u = texture2D(texuv, tex_c2).g;\n"
5055 " v = texture2D(texuv, tex_c2).a;\n"
5056 " u = u - 0.5;\n"
5057 " v = v - 0.5;\n"
5058 " y = (y - 0.062) * 1.164;\n"
5059 " vmu = (v * 0.534) + (u * 0.213);\n"
5060 " v = v * 1.793;\n"
5061 " u = u * 2.115;\n"
5062 " r = y + v;\n"
5063 " g = y - vmu;\n"
5064 " b = y + u;\n"
5065 " c = vec4(r, g, b, 1.0);\n"
5066 " gl_FragColor =\n"
5067 " c\n"
5068 " * texture2D(texm, tex_m).a\n"
5069 " ;\n"
5070 "}\n";
5071Evas_GL_Program_Source shader_nv12_709_mask_nomul_frag_src =
5072{
5073 nv12_709_mask_nomul_frag_glsl,
5074 NULL, 0
5075};
5076
5077static const char nv12_709_mask_nomul_vert_glsl[] =
5078 "#ifdef GL_ES\n"
5079 "precision highp float;\n"
5080 "#endif\n"
5081 "attribute vec4 vertex;\n"
5082 "uniform mat4 mvp;\n"
5083 "attribute vec2 tex_coord;\n"
5084 "varying vec2 tex_c;\n"
5085 "attribute vec2 tex_coord2;\n"
5086 "varying vec2 tex_c2;\n"
5087 "attribute vec4 mask_coord;\n"
5088 "varying vec2 tex_m;\n"
5089 "void main()\n"
5090 "{\n"
5091 " gl_Position = mvp * vertex;\n"
5092 " tex_c = tex_coord;\n"
5093 " tex_c2 = tex_coord2 * 0.5;\n"
5094 " vec4 mask_Position = mvp * vertex * vec4(0.5, sign(mask_coord.w) * 0.5, 0.5, 0.5) + vec4(0.5, 0.5, 0, 0);\n"
5095 " tex_m = mask_Position.xy * abs(mask_coord.zw) + mask_coord.xy;\n"
5096 "}\n";
5097Evas_GL_Program_Source shader_nv12_709_mask_nomul_vert_src =
5098{
5099 nv12_709_mask_nomul_vert_glsl,
5100 NULL, 0
5101};
5102
4263 5103
4264static const struct { 5104static const struct {
4265 Evas_GL_Shader id; 5105 Evas_GL_Shader id;
@@ -4347,5 +5187,17 @@ static const struct {
4347 { SHADER_NV12_NOMUL, &(shader_nv12_nomul_vert_src), &(shader_nv12_nomul_frag_src), "nv12_nomul", SHD_NV12, SHD_SAM11, 0, 0, 1, 0 }, 5187 { SHADER_NV12_NOMUL, &(shader_nv12_nomul_vert_src), &(shader_nv12_nomul_frag_src), "nv12_nomul", SHD_NV12, SHD_SAM11, 0, 0, 1, 0 },
4348 { SHADER_NV12_MASK, &(shader_nv12_mask_vert_src), &(shader_nv12_mask_frag_src), "nv12_mask", SHD_NV12, SHD_SAM11, 0, 1, 0, 0 }, 5188 { SHADER_NV12_MASK, &(shader_nv12_mask_vert_src), &(shader_nv12_mask_frag_src), "nv12_mask", SHD_NV12, SHD_SAM11, 0, 1, 0, 0 },
4349 { SHADER_NV12_MASK_NOMUL, &(shader_nv12_mask_nomul_vert_src), &(shader_nv12_mask_nomul_frag_src), "nv12_mask_nomul", SHD_NV12, SHD_SAM11, 0, 1, 1, 0 }, 5189 { SHADER_NV12_MASK_NOMUL, &(shader_nv12_mask_nomul_vert_src), &(shader_nv12_mask_nomul_frag_src), "nv12_mask_nomul", SHD_NV12, SHD_SAM11, 0, 1, 1, 0 },
5190 { SHADER_YUV_709, &(shader_yuv_709_vert_src), &(shader_yuv_709_frag_src), "yuv_709", SHD_YUV, SHD_SAM11, 0, 0, 0, 0 },
5191 { SHADER_YUV_709_NOMUL, &(shader_yuv_709_nomul_vert_src), &(shader_yuv_709_nomul_frag_src), "yuv_709_nomul", SHD_YUV, SHD_SAM11, 0, 0, 1, 0 },
5192 { SHADER_YUV_709_MASK, &(shader_yuv_709_mask_vert_src), &(shader_yuv_709_mask_frag_src), "yuv_709_mask", SHD_YUV, SHD_SAM11, 0, 1, 0, 0 },
5193 { SHADER_YUV_709_MASK_NOMUL, &(shader_yuv_709_mask_nomul_vert_src), &(shader_yuv_709_mask_nomul_frag_src), "yuv_709_mask_nomul", SHD_YUV, SHD_SAM11, 0, 1, 1, 0 },
5194 { SHADER_YUY2_709, &(shader_yuy2_709_vert_src), &(shader_yuy2_709_frag_src), "yuy2_709", SHD_YUY2, SHD_SAM11, 0, 0, 0, 0 },
5195 { SHADER_YUY2_709_NOMUL, &(shader_yuy2_709_nomul_vert_src), &(shader_yuy2_709_nomul_frag_src), "yuy2_709_nomul", SHD_YUY2, SHD_SAM11, 0, 0, 1, 0 },
5196 { SHADER_YUY2_709_MASK, &(shader_yuy2_709_mask_vert_src), &(shader_yuy2_709_mask_frag_src), "yuy2_709_mask", SHD_YUY2, SHD_SAM11, 0, 1, 0, 0 },
5197 { SHADER_YUY2_709_MASK_NOMUL, &(shader_yuy2_709_mask_nomul_vert_src), &(shader_yuy2_709_mask_nomul_frag_src), "yuy2_709_mask_nomul", SHD_YUY2, SHD_SAM11, 0, 1, 1, 0 },
5198 { SHADER_NV12_709, &(shader_nv12_709_vert_src), &(shader_nv12_709_frag_src), "nv12_709", SHD_NV12, SHD_SAM11, 0, 0, 0, 0 },
5199 { SHADER_NV12_709_NOMUL, &(shader_nv12_709_nomul_vert_src), &(shader_nv12_709_nomul_frag_src), "nv12_709_nomul", SHD_NV12, SHD_SAM11, 0, 0, 1, 0 },
5200 { SHADER_NV12_709_MASK, &(shader_nv12_709_mask_vert_src), &(shader_nv12_709_mask_frag_src), "nv12_709_mask", SHD_NV12, SHD_SAM11, 0, 1, 0, 0 },
5201 { SHADER_NV12_709_MASK_NOMUL, &(shader_nv12_709_mask_nomul_vert_src), &(shader_nv12_709_mask_nomul_frag_src), "nv12_709_mask_nomul", SHD_NV12, SHD_SAM11, 0, 1, 1, 0 },
4350}; 5202};
4351 5203
diff --git a/src/modules/evas/engines/gl_common/shader/fragment.glsl b/src/modules/evas/engines/gl_common/shader/fragment.glsl
index 26be33c485..e7d0c38643 100644
--- a/src/modules/evas/engines/gl_common/shader/fragment.glsl
+++ b/src/modules/evas/engines/gl_common/shader/fragment.glsl
@@ -69,32 +69,35 @@ void main()
69{ 69{
70 vec4 c; 70 vec4 c;
71 71
72#if defined(SHD_YUV) 72#if defined(SHD_YUV) || defined(SHD_NV12) || defined(SHD_YUY2)
73 float r, g, b, y, u, v; 73 float r, g, b, y, u, v, vmu;
74# if defined(SHD_YUV)
74 y = texture2D(tex, tex_c).r; 75 y = texture2D(tex, tex_c).r;
75 u = texture2D(texu, tex_c2).r; 76 u = texture2D(texu, tex_c2).r;
76 v = texture2D(texv, tex_c3).r; 77 v = texture2D(texv, tex_c3).r;
77 y = (y - 0.0625) * 1.164; 78# elif defined(SHD_NV12) || defined(SHD_YUY2)
78 u = u - 0.5;
79 v = v - 0.5;
80 r = y + (1.402 * v);
81 g = y - (0.34414 * u) - (0.71414 * v);
82 b = y + (1.772 * u);
83 c = vec4(r, g, b, 1.0);
84
85#elif defined(SHD_NV12) || defined(SHD_YUY2)
86 float y, u, v, vmu, r, g, b;
87 y = texture2D(tex, tex_c).g; 79 y = texture2D(tex, tex_c).g;
88 u = texture2D(texuv, tex_c2).g; 80 u = texture2D(texuv, tex_c2).g;
89 v = texture2D(texuv, tex_c2).a; 81 v = texture2D(texuv, tex_c2).a;
82# endif
83// center u and v around 0 for uv and y (with 128/255 for u + v, 16/255 for y)
90 u = u - 0.5; 84 u = u - 0.5;
91 v = v - 0.5; 85 v = v - 0.5;
92 vmu = v * 0.813 + u * 0.391; 86
93 u = u * 2.018; 87# if defined (SHD_YUV_709)
94 v = v * 1.596; 88// 709 yuv colorspace for hd content
95# ifdef SHD_NV12 89 y = (y - 0.062) * 1.164;
90 vmu = (v * 0.534) + (u * 0.213);
91 v = v * 1.793;
92 u = u * 2.115;
93# else
94// 601 colorspace constants (older yuv content)
96 y = (y - 0.062) * 1.164; 95 y = (y - 0.062) * 1.164;
96 vmu = (v * 0.813) + (u * 0.391);
97 v = v * 1.596;
98 u = u * 2.018;
97# endif 99# endif
100// common yuv
98 r = y + v; 101 r = y + v;
99 g = y - vmu; 102 g = y - vmu;
100 b = y + u; 103 b = y + u;
diff --git a/src/modules/evas/engines/gl_common/shader/shaders.txt b/src/modules/evas/engines/gl_common/shader/shaders.txt
index e5a3e7a721..94a4fd14df 100644
--- a/src/modules/evas/engines/gl_common/shader/shaders.txt
+++ b/src/modules/evas/engines/gl_common/shader/shaders.txt
@@ -111,3 +111,18 @@ nv12_nomul:tex,nv12,nomul
111nv12_mask:tex,nv12,mask 111nv12_mask:tex,nv12,mask
112nv12_mask_nomul:tex,nv12,mask,nomul 112nv12_mask_nomul:tex,nv12,mask,nomul
113 113
114yuv_709:tex,yuv,yuv_709
115yuv_709_nomul:tex,yuv,yuv_709,nomul
116yuv_709_mask:tex,yuv,yuv_709,mask
117yuv_709_mask_nomul:tex,yuv,yuv_709,mask,nomul
118
119yuy2_709:tex,yuy2,yuv_709
120yuy2_709_nomul:tex,yuy2,yuv_709,nomul
121yuy2_709_mask:tex,yuy2,yuv_709,mask
122yuy2_709_mask_nomul:tex,yuy2,yuv_709,mask,nomul
123
124nv12_709:tex,nv12,yuv_709
125nv12_709_nomul:tex,nv12,yuv_709,nomul
126nv12_709_mask:tex,nv12,yuv_709,mask
127nv12_709_mask_nomul:tex,nv12,yuv_709,mask,nomul
128