OSDN Git Service

Constant buffer passes YUV2RGB CSC matrix instead of hardcoded matrix
authorZhao Yakui <yakui.zhao@intel.com>
Fri, 22 Nov 2013 05:39:34 +0000 (13:39 +0800)
committerXiang, Haihao <haihao.xiang@intel.com>
Tue, 3 Dec 2013 04:09:38 +0000 (12:09 +0800)
Signed-off-by: Zhao Yakui <yakui.zhao@intel.com>
(cherry picked from commit 0aa6ccc405726e5521452ee437be6b3cc6fabdee)

12 files changed:
src/i965_render.c
src/shaders/render/Makefile.am
src/shaders/render/exa_wm_yuv_rgb.g4a
src/shaders/render/exa_wm_yuv_rgb.g4b
src/shaders/render/exa_wm_yuv_rgb.g4b.gen5
src/shaders/render/exa_wm_yuv_rgb.g6a
src/shaders/render/exa_wm_yuv_rgb.g6b
src/shaders/render/exa_wm_yuv_rgb.g7a
src/shaders/render/exa_wm_yuv_rgb.g7b
src/shaders/render/exa_yuv_gen4.g4i [new file with mode: 0644]
src/shaders/render/exa_yuv_gen6.g4i [new file with mode: 0644]
src/shaders/render/exa_yuv_rgb.gxa [new file with mode: 0644]

index 0777ce0..5b1a1a5 100644 (file)
@@ -311,6 +311,12 @@ static struct i965_kernel render_kernels_gen7_haswell[] = {
 #define URB_CS_ENTRIES       4
 #define URB_CS_ENTRY_SIZE     4
 
+static float yuv_to_rgb_bt601[3][4] = {
+{1.164,                0,      1.596,          -0.06275,},
+{1.164,                -0.392, -0.813,         -0.50196,},
+{1.164,                2.017,  0,              -0.50196,},
+};
+
 static void
 i965_render_vs_unit(VADriverContextP ctx)
 {
@@ -1070,6 +1076,7 @@ i965_render_upload_constants(VADriverContextP ctx,
     float brightness = (float)i965->brightness_attrib->value / 255; /* YUV is float in the shader */
     float hue = (float)i965->hue_attrib->value / 180 * PI;
     float saturation = (float)i965->saturation_attrib->value / DEFAULT_SATURATION;
+    float *yuv_to_rgb;
 
     dri_bo_map(render_state->curbe.bo, 1);
     assert(render_state->curbe.bo->virtual);
@@ -1100,6 +1107,9 @@ i965_render_upload_constants(VADriverContextP ctx,
     *color_balance_base++ = cos(hue) * contrast * saturation;
     *color_balance_base++ = sin(hue) * contrast * saturation;
 
+    yuv_to_rgb = (float *)constant_buffer + 8;
+    memcpy(yuv_to_rgb, yuv_to_rgb_bt601, sizeof(yuv_to_rgb_bt601));
+
     dri_bo_unmap(render_state->curbe.bo);
 }
 
index 1653b4a..bed683b 100644 (file)
@@ -2,7 +2,10 @@
 INTEL_G4I =                    \
        exa_wm.g4i              \
        exa_wm_affine.g4i       \
-       exa_wm_yuv_color_balance.gxa
+       exa_wm_yuv_color_balance.gxa \
+       exa_yuv_rgb.gxa         \
+       exa_yuv_gen4.g4i        \
+       exa_yuv_gen6.g4i
 
 INTEL_G4A =                            \
        exa_sf.g4a                      \
index b3abe4b..e3d2464 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright © 2006 Intel Corporation
+ * Copyright © 2006-2013 Intel Corporation
  *
  * Permission is hereby granted, free of charge, to any person obtaining a
  * copy of this software and associated documentation files (the "Software"),
  */
 
 include(`exa_wm.g4i')
+include(`exa_yuv_gen4.g4i')
+include(`exa_yuv_rgb.gxa')
 
-define(`YCbCr_base',   `src_sample_base')
-
-define(`Cr',           `src_sample_b')
-define(`Cr_01',                `src_sample_b_01')
-define(`Cr_23',                `src_sample_b_23')
-
-define(`Y',            `src_sample_r')
-define(`Y_01',         `src_sample_r_01')
-define(`Y_23',         `src_sample_r_23')
-
-define(`Cb',           `src_sample_g')
-define(`Cb_01',                `src_sample_g_01')
-define(`Cb_23',                `src_sample_g_23')
-
-define(`Crn',          `mask_sample_g')
-define(`Crn_01',       `mask_sample_g_01')
-define(`Crn_23',       `mask_sample_g_23')
-
-define(`Yn',           `mask_sample_r')
-define(`Yn_01',                `mask_sample_r_01')
-define(`Yn_23',                `mask_sample_r_23')
-
-define(`Cbn',          `mask_sample_b')
-define(`Cbn_01',       `mask_sample_b_01')
-define(`Cbn_23',       `mask_sample_b_23')
-
-    /* color space conversion function:
-     * R = Clamp ( 1.164(Y-16/255) + 1.596(Cr-128/255), 0, 1)
-     * G = Clamp ( 1.164(Y-16/255) - 0.813(Cr-128/255) - 0.392(Cb-128/255), 0, 1)
-     * B = Clamp ( 1.164(Y-16/255) + 2.017(Cb-128/255), 0, 1)
-     */
-
-    /* Normalize Y, Cb and Cr:
-     *
-     * Yn = (Y - 16/255) * 1.164
-     * Crn = Cr - 128 / 255
-     * Cbn = Cb - 128 / 255
-     */
-add (16)    Yn<1>F             Y<8,8,1>F       -0.0627451F { compr align1 };
-mul (16)    Yn<1>F             Yn<8,8,1>F      1.164F      { compr align1 };
-
-add (16)    Crn<1>F            Cr<8,8,1>F      -0.501961F  { compr align1 };
-
-add (16)    Cbn<1>F            Cb<8,8,1>F      -0.501961F  { compr align1 };
-
-    /* 
-     * R = Y + Cr * 1.596
-     */
-mov (16)    acc0<1>F           Yn<8,8,1>F                  { compr align1 };
-mac.sat(16) src_sample_r<1>F   Crn<8,8,1>F     1.596F      { compr align1 };
-     
-    /*
-     * G = Crn * -0.813 + Cbn * -0.392 + Y
-     */
-mov (16)    acc0<1>F           Yn<8,8,1>F                  { compr align1 };
-mac (16)    acc0<1>F           Crn<8,8,1>F     -0.813F     { compr align1 };
-mac.sat(16) src_sample_g<1>F   Cbn<8,8,1>F     -0.392F     { compr align1 };
-
-    /*
-     * B = Cbn * 2.017 + Y
-     */
-mov (16)    acc0<1>F           Yn<8,8,1>F                  { compr align1 };
-mac.sat(16) src_sample_b<1>F   Cbn<8,8,1>F     2.017F      { compr align1 };
-
-    /*
-     * A = 1.0
-     */
-mov (16)    src_sample_a<1>F   1.0F                        { compr align1 };
index 6b99838..b116ece 100644 (file)
@@ -1,12 +1,13 @@
-   { 0x00802040, 0x22c07fbd, 0x008d01c0, 0xbd808081 },
-   { 0x00802041, 0x22c07fbd, 0x008d02c0, 0x3f94fdf4 },
-   { 0x00802040, 0x23007fbd, 0x008d0240, 0xbf008084 },
-   { 0x00802040, 0x23407fbd, 0x008d0200, 0xbf008084 },
-   { 0x00802001, 0x240003bc, 0x008d02c0, 0x00000000 },
-   { 0x80802048, 0x21c07fbd, 0x008d0300, 0x3fcc49ba },
-   { 0x00802001, 0x240003bc, 0x008d02c0, 0x00000000 },
-   { 0x00802048, 0x24007fbc, 0x008d0300, 0xbf5020c5 },
-   { 0x80802048, 0x22007fbd, 0x008d0340, 0xbec8b439 },
-   { 0x00802001, 0x240003bc, 0x008d02c0, 0x00000000 },
-   { 0x80802048, 0x22407fbd, 0x008d0340, 0x40011687 },
+   { 0x00802040, 0x22c077bd, 0x008d01c0, 0x0000006c },
+   { 0x00802040, 0x230077bd, 0x008d0200, 0x0000007c },
+   { 0x00802040, 0x234077bd, 0x008d0240, 0x0000008c },
+   { 0x00802041, 0x240077bc, 0x008d02c0, 0x00000060 },
+   { 0x00802048, 0x240077bc, 0x008d0300, 0x00000064 },
+   { 0x80802048, 0x21c077bd, 0x008d0340, 0x00000068 },
+   { 0x00802041, 0x240077bc, 0x008d02c0, 0x00000070 },
+   { 0x00802048, 0x240077bc, 0x008d0300, 0x00000074 },
+   { 0x80802048, 0x220077bd, 0x008d0340, 0x00000078 },
+   { 0x00802041, 0x240077bc, 0x008d02c0, 0x00000080 },
+   { 0x00802048, 0x240077bc, 0x008d0300, 0x00000084 },
+   { 0x80802048, 0x224077bd, 0x008d0340, 0x00000088 },
    { 0x00802001, 0x228003fd, 0x00000000, 0x3f800000 },
index 6b99838..b116ece 100644 (file)
@@ -1,12 +1,13 @@
-   { 0x00802040, 0x22c07fbd, 0x008d01c0, 0xbd808081 },
-   { 0x00802041, 0x22c07fbd, 0x008d02c0, 0x3f94fdf4 },
-   { 0x00802040, 0x23007fbd, 0x008d0240, 0xbf008084 },
-   { 0x00802040, 0x23407fbd, 0x008d0200, 0xbf008084 },
-   { 0x00802001, 0x240003bc, 0x008d02c0, 0x00000000 },
-   { 0x80802048, 0x21c07fbd, 0x008d0300, 0x3fcc49ba },
-   { 0x00802001, 0x240003bc, 0x008d02c0, 0x00000000 },
-   { 0x00802048, 0x24007fbc, 0x008d0300, 0xbf5020c5 },
-   { 0x80802048, 0x22007fbd, 0x008d0340, 0xbec8b439 },
-   { 0x00802001, 0x240003bc, 0x008d02c0, 0x00000000 },
-   { 0x80802048, 0x22407fbd, 0x008d0340, 0x40011687 },
+   { 0x00802040, 0x22c077bd, 0x008d01c0, 0x0000006c },
+   { 0x00802040, 0x230077bd, 0x008d0200, 0x0000007c },
+   { 0x00802040, 0x234077bd, 0x008d0240, 0x0000008c },
+   { 0x00802041, 0x240077bc, 0x008d02c0, 0x00000060 },
+   { 0x00802048, 0x240077bc, 0x008d0300, 0x00000064 },
+   { 0x80802048, 0x21c077bd, 0x008d0340, 0x00000068 },
+   { 0x00802041, 0x240077bc, 0x008d02c0, 0x00000070 },
+   { 0x00802048, 0x240077bc, 0x008d0300, 0x00000074 },
+   { 0x80802048, 0x220077bd, 0x008d0340, 0x00000078 },
+   { 0x00802041, 0x240077bc, 0x008d02c0, 0x00000080 },
+   { 0x00802048, 0x240077bc, 0x008d0300, 0x00000084 },
+   { 0x80802048, 0x224077bd, 0x008d0340, 0x00000088 },
    { 0x00802001, 0x228003fd, 0x00000000, 0x3f800000 },
index b3abe4b..ede0298 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright © 2006 Intel Corporation
+ * Copyright © 2006-2013 Intel Corporation
  *
  * Permission is hereby granted, free of charge, to any person obtaining a
  * copy of this software and associated documentation files (the "Software"),
  */
 
 include(`exa_wm.g4i')
-
-define(`YCbCr_base',   `src_sample_base')
-
-define(`Cr',           `src_sample_b')
-define(`Cr_01',                `src_sample_b_01')
-define(`Cr_23',                `src_sample_b_23')
-
-define(`Y',            `src_sample_r')
-define(`Y_01',         `src_sample_r_01')
-define(`Y_23',         `src_sample_r_23')
-
-define(`Cb',           `src_sample_g')
-define(`Cb_01',                `src_sample_g_01')
-define(`Cb_23',                `src_sample_g_23')
-
-define(`Crn',          `mask_sample_g')
-define(`Crn_01',       `mask_sample_g_01')
-define(`Crn_23',       `mask_sample_g_23')
-
-define(`Yn',           `mask_sample_r')
-define(`Yn_01',                `mask_sample_r_01')
-define(`Yn_23',                `mask_sample_r_23')
-
-define(`Cbn',          `mask_sample_b')
-define(`Cbn_01',       `mask_sample_b_01')
-define(`Cbn_23',       `mask_sample_b_23')
-
-    /* color space conversion function:
-     * R = Clamp ( 1.164(Y-16/255) + 1.596(Cr-128/255), 0, 1)
-     * G = Clamp ( 1.164(Y-16/255) - 0.813(Cr-128/255) - 0.392(Cb-128/255), 0, 1)
-     * B = Clamp ( 1.164(Y-16/255) + 2.017(Cb-128/255), 0, 1)
-     */
-
-    /* Normalize Y, Cb and Cr:
-     *
-     * Yn = (Y - 16/255) * 1.164
-     * Crn = Cr - 128 / 255
-     * Cbn = Cb - 128 / 255
-     */
-add (16)    Yn<1>F             Y<8,8,1>F       -0.0627451F { compr align1 };
-mul (16)    Yn<1>F             Yn<8,8,1>F      1.164F      { compr align1 };
-
-add (16)    Crn<1>F            Cr<8,8,1>F      -0.501961F  { compr align1 };
-
-add (16)    Cbn<1>F            Cb<8,8,1>F      -0.501961F  { compr align1 };
-
-    /* 
-     * R = Y + Cr * 1.596
-     */
-mov (16)    acc0<1>F           Yn<8,8,1>F                  { compr align1 };
-mac.sat(16) src_sample_r<1>F   Crn<8,8,1>F     1.596F      { compr align1 };
-     
-    /*
-     * G = Crn * -0.813 + Cbn * -0.392 + Y
-     */
-mov (16)    acc0<1>F           Yn<8,8,1>F                  { compr align1 };
-mac (16)    acc0<1>F           Crn<8,8,1>F     -0.813F     { compr align1 };
-mac.sat(16) src_sample_g<1>F   Cbn<8,8,1>F     -0.392F     { compr align1 };
-
-    /*
-     * B = Cbn * 2.017 + Y
-     */
-mov (16)    acc0<1>F           Yn<8,8,1>F                  { compr align1 };
-mac.sat(16) src_sample_b<1>F   Cbn<8,8,1>F     2.017F      { compr align1 };
-
-    /*
-     * A = 1.0
-     */
-mov (16)    src_sample_a<1>F   1.0F                        { compr align1 };
+include(`exa_yuv_gen6.g4i')
+include(`exa_yuv_rgb.gxa')
index 6c8c724..d09ae00 100644 (file)
@@ -1,12 +1,13 @@
-   { 0x00800040, 0x22c07fbd, 0x008d01c0, 0xbd808081 },
-   { 0x00800041, 0x22c07fbd, 0x008d02c0, 0x3f94fdf4 },
-   { 0x00800040, 0x23007fbd, 0x008d0240, 0xbf008084 },
-   { 0x00800040, 0x23407fbd, 0x008d0200, 0xbf008084 },
-   { 0x00800001, 0x240003bc, 0x008d02c0, 0x00000000 },
-   { 0x80800048, 0x21c07fbd, 0x008d0300, 0x3fcc49ba },
-   { 0x00800001, 0x240003bc, 0x008d02c0, 0x00000000 },
-   { 0x00800048, 0x24007fbc, 0x008d0300, 0xbf5020c5 },
-   { 0x80800048, 0x22007fbd, 0x008d0340, 0xbec8b439 },
-   { 0x00800001, 0x240003bc, 0x008d02c0, 0x00000000 },
-   { 0x80800048, 0x22407fbd, 0x008d0340, 0x40011687 },
+   { 0x00800040, 0x22c077bd, 0x008d01c0, 0x000000ec },
+   { 0x00800040, 0x230077bd, 0x008d0200, 0x000000fc },
+   { 0x00800040, 0x234077bd, 0x008d0240, 0x0000010c },
+   { 0x00800041, 0x240077bc, 0x008d02c0, 0x000000e0 },
+   { 0x00800048, 0x240077bc, 0x008d0300, 0x000000e4 },
+   { 0x80800048, 0x21c077bd, 0x008d0340, 0x000000e8 },
+   { 0x00800041, 0x240077bc, 0x008d02c0, 0x000000f0 },
+   { 0x00800048, 0x240077bc, 0x008d0300, 0x000000f4 },
+   { 0x80800048, 0x220077bd, 0x008d0340, 0x000000f8 },
+   { 0x00800041, 0x240077bc, 0x008d02c0, 0x00000100 },
+   { 0x00800048, 0x240077bc, 0x008d0300, 0x00000104 },
+   { 0x80800048, 0x224077bd, 0x008d0340, 0x00000108 },
    { 0x00800001, 0x228003fd, 0x00000000, 0x3f800000 },
index 5cd33e2..ede0298 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright © 2006 Intel Corporation
+ * Copyright © 2006-2013 Intel Corporation
  *
  * Permission is hereby granted, free of charge, to any person obtaining a
  * copy of this software and associated documentation files (the "Software"),
  */
 
 include(`exa_wm.g4i')
-
-define(`YCbCr_base',   `src_sample_base')
-
-define(`Cr',           `src_sample_b')
-define(`Cr_01',                `src_sample_b_01')
-define(`Cr_23',                `src_sample_b_23')
-
-define(`Y',            `src_sample_r')
-define(`Y_01',         `src_sample_r_01')
-define(`Y_23',         `src_sample_r_23')
-
-define(`Cb',           `src_sample_g')
-define(`Cb_01',                `src_sample_g_01')
-define(`Cb_23',                `src_sample_g_23')
-
-define(`Crn',          `mask_sample_g')
-define(`Crn_01',       `mask_sample_g_01')
-define(`Crn_23',       `mask_sample_g_23')
-
-define(`Yn',           `mask_sample_r')
-define(`Yn_01',                `mask_sample_r_01')
-define(`Yn_23',                `mask_sample_r_23')
-
-define(`Cbn',          `mask_sample_b')
-define(`Cbn_01',       `mask_sample_b_01')
-define(`Cbn_23',       `mask_sample_b_23')
-
-    /* color space conversion function:
-     * R = Clamp ( 1.164(Y-16/255) + 1.596(Cr-128/255), 0, 1)
-     * G = Clamp ( 1.164(Y-16/255) - 0.813(Cr-128/255) - 0.392(Cb-128/255), 0, 1)
-     * B = Clamp ( 1.164(Y-16/255) + 2.017(Cb-128/255), 0, 1)
-     */
-
-    /* Normalize Y, Cb and Cr:
-     *
-     * Yn = (Y - 16/255) * 1.164
-     * Crn = Cr - 128 / 255
-     * Cbn = Cb - 128 / 255
-     */
-add (16)    Yn<1>F             Y<8,8,1>F       -0.0627451F { compr align1 };
-mul (16)    Yn<1>F             Yn<8,8,1>F      1.164F      { compr align1 };
-
-add (16)    Crn<1>F            Cr<8,8,1>F      -0.501961F  { compr align1 };
-
-add (16)    Cbn<1>F            Cb<8,8,1>F      -0.501961F  { compr align1 };
-
-    /* 
-     * R = Y + Cr * 1.596
-     */
-mov (16)    acc0<1>F           Yn<8,8,1>F                  { compr align1 };
-mac.sat(16) src_sample_r<1>F   Crn<8,8,1>F     1.596F      { compr align1 };
-     
-    /*
-     * G = Crn * -0.813 + Cbn * -0.392 + Y
-     */
-mov (16)    acc0<1>F           Yn<8,8,1>F                  { compr align1 };
-mac (16)    acc0<1>F           Crn<8,8,1>F     -0.813F     { compr align1 };
-mac.sat(16) src_sample_g<1>F   Cbn<8,8,1>F     -0.392F     { compr align1 };
-
-    /*
-     * B = Cbn * 2.017 + Y
-     */
-mov (16)    acc0<1>F           Yn<8,8,1>F                  { compr align1 };
-mac.sat(16) src_sample_b<1>F   Cbn<8,8,1>F     2.017F      { compr align1 };
-
-    /*
-     * A = 1.0
-     */
-mov (16)    src_sample_a<1>F   1.0F        { compr align1 };
+include(`exa_yuv_gen6.g4i')
+include(`exa_yuv_rgb.gxa')
index 6c8c724..d09ae00 100644 (file)
@@ -1,12 +1,13 @@
-   { 0x00800040, 0x22c07fbd, 0x008d01c0, 0xbd808081 },
-   { 0x00800041, 0x22c07fbd, 0x008d02c0, 0x3f94fdf4 },
-   { 0x00800040, 0x23007fbd, 0x008d0240, 0xbf008084 },
-   { 0x00800040, 0x23407fbd, 0x008d0200, 0xbf008084 },
-   { 0x00800001, 0x240003bc, 0x008d02c0, 0x00000000 },
-   { 0x80800048, 0x21c07fbd, 0x008d0300, 0x3fcc49ba },
-   { 0x00800001, 0x240003bc, 0x008d02c0, 0x00000000 },
-   { 0x00800048, 0x24007fbc, 0x008d0300, 0xbf5020c5 },
-   { 0x80800048, 0x22007fbd, 0x008d0340, 0xbec8b439 },
-   { 0x00800001, 0x240003bc, 0x008d02c0, 0x00000000 },
-   { 0x80800048, 0x22407fbd, 0x008d0340, 0x40011687 },
+   { 0x00800040, 0x22c077bd, 0x008d01c0, 0x000000ec },
+   { 0x00800040, 0x230077bd, 0x008d0200, 0x000000fc },
+   { 0x00800040, 0x234077bd, 0x008d0240, 0x0000010c },
+   { 0x00800041, 0x240077bc, 0x008d02c0, 0x000000e0 },
+   { 0x00800048, 0x240077bc, 0x008d0300, 0x000000e4 },
+   { 0x80800048, 0x21c077bd, 0x008d0340, 0x000000e8 },
+   { 0x00800041, 0x240077bc, 0x008d02c0, 0x000000f0 },
+   { 0x00800048, 0x240077bc, 0x008d0300, 0x000000f4 },
+   { 0x80800048, 0x220077bd, 0x008d0340, 0x000000f8 },
+   { 0x00800041, 0x240077bc, 0x008d02c0, 0x00000100 },
+   { 0x00800048, 0x240077bc, 0x008d0300, 0x00000104 },
+   { 0x80800048, 0x224077bd, 0x008d0340, 0x00000108 },
    { 0x00800001, 0x228003fd, 0x00000000, 0x3f800000 },
diff --git a/src/shaders/render/exa_yuv_gen4.g4i b/src/shaders/render/exa_yuv_gen4.g4i
new file mode 100644 (file)
index 0000000..5a66616
--- /dev/null
@@ -0,0 +1,42 @@
+/*
+ * Copyright © 2013 Intel Corporation
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+ * IN THE SOFTWARE.
+ *
+ * Authors:
+ *    Zhao Yakui <yakui.zhao@intel.com>
+ */
+
+/* YUV to RGB matrix coeff */
+
+define(`coef_ry',      `g3.0<0,1,0>F')
+define(`coef_ru',      `g3.4<0,1,0>F')
+define(`coef_rv',      `g3.8<0,1,0>F')
+define(`coef_yd',      `g3.12<0,1,0>F')
+
+define(`coef_gy',      `g3.16<0,1,0>F')
+define(`coef_gu',      `g3.20<0,1,0>F')
+define(`coef_gv',      `g3.24<0,1,0>F')
+define(`coef_ud',      `g3.28<0,1,0>F')
+
+define(`coef_by',      `g4.0<0,1,0>F')
+define(`coef_bu',      `g4.4<0,1,0>F')
+define(`coef_bv',      `g4.8<0,1,0>F')
+define(`coef_vd',      `g4.12<0,1,0>F')
diff --git a/src/shaders/render/exa_yuv_gen6.g4i b/src/shaders/render/exa_yuv_gen6.g4i
new file mode 100644 (file)
index 0000000..a8d69ee
--- /dev/null
@@ -0,0 +1,42 @@
+/*
+ * Copyright © 2013 Intel Corporation
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+ * IN THE SOFTWARE.
+ *
+ * Authors:
+ *    Zhao Yakui <yakui.zhao@intel.com>
+ */
+/* YUV to RGB matrix coeff */
+
+
+define(`coef_ry',      `g7.0<0,1,0>F')
+define(`coef_ru',      `g7.4<0,1,0>F')
+define(`coef_rv',      `g7.8<0,1,0>F')
+define(`coef_yd',      `g7.12<0,1,0>F')
+
+define(`coef_gy',      `g7.16<0,1,0>F')
+define(`coef_gu',      `g7.20<0,1,0>F')
+define(`coef_gv',      `g7.24<0,1,0>F')
+define(`coef_ud',      `g7.28<0,1,0>F')
+
+define(`coef_by',      `g8.0<0,1,0>F')
+define(`coef_bu',      `g8.4<0,1,0>F')
+define(`coef_bv',      `g8.8<0,1,0>F')
+define(`coef_vd',      `g8.12<0,1,0>F')
diff --git a/src/shaders/render/exa_yuv_rgb.gxa b/src/shaders/render/exa_yuv_rgb.gxa
new file mode 100644 (file)
index 0000000..656ae73
--- /dev/null
@@ -0,0 +1,74 @@
+/*
+ * Copyright © 2013 Intel Corporation
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+ * IN THE SOFTWARE.
+ *
+ * Authors:
+ *    Zhao Yakui <yakui.zhao@intel.com>
+ */
+
+define(`YCbCr_base',   `src_sample_base')
+
+define(`Cr',           `src_sample_b')
+define(`Cr_01',                `src_sample_b_01')
+define(`Cr_23',                `src_sample_b_23')
+
+define(`Y',            `src_sample_r')
+define(`Y_01',         `src_sample_r_01')
+define(`Y_23',         `src_sample_r_23')
+
+define(`Cb',           `src_sample_g')
+define(`Cb_01',                `src_sample_g_01')
+define(`Cb_23',                `src_sample_g_23')
+
+define(`Crn',          `mask_sample_b')
+define(`Crn_01',       `mask_sample_b_01')
+define(`Crn_23',       `mask_sample_b_23')
+
+define(`Yn',           `mask_sample_r')
+define(`Yn_01',                `mask_sample_r_01')
+define(`Yn_23',                `mask_sample_r_23')
+
+define(`Cbn',          `mask_sample_g')
+define(`Cbn_01',       `mask_sample_g_01')
+define(`Cbn_23',       `mask_sample_g_23')
+
+add (16)    Yn<1>F             Y<8,8,1>F       coef_yd     { compr align1 };
+
+add (16)    Cbn<1>F            Cb<8,8,1>F      coef_ud     { compr align1 };
+
+add (16)    Crn<1>F            Cr<8,8,1>F      coef_vd     { compr align1 };
+
+mul (16)    acc0<1>F           Yn<8,8,1>F      coef_ry     { compr align1 };
+mac (16)    acc0<1>F           Cbn<8,8,1>F     coef_ru     { compr align1 };
+mac.sat (16) src_sample_r<1>F  Crn<8,8,1>F     coef_rv     { compr align1 };
+     
+mul (16)    acc0<1>F           Yn<8,8,1>F      coef_gy     { compr align1 };
+mac (16)    acc0<1>F           Cbn<8,8,1>F     coef_gu     { compr align1 };
+mac.sat(16) src_sample_g<1>F   Crn<8,8,1>F     coef_gv     { compr align1 };
+
+mul (16)    acc0<1>F           Yn<8,8,1>F      coef_by     { compr align1 };
+mac (16)    acc0<1>F           Cbn<8,8,1>F     coef_bu     { compr align1 };
+mac.sat(16) src_sample_b<1>F   Crn<8,8,1>F     coef_bv     { compr align1 };
+
+    /*
+     * A = 1.0
+     */
+mov (16)    src_sample_a<1>F   1.0F                        { compr align1 };