diff options
author | Zhao Yakui <yakui.zhao@intel.com> | 2013-12-19 17:03:31 +0800 |
---|---|---|
committer | Yakui Zhao <yakui.zhao@intel.com> | 2013-12-19 17:03:31 +0800 |
commit | 92509398f8e8d3bc6f4ab0f6d54cf6fec5b24377 (patch) | |
tree | ef06bb641ed59e8c26994dfd0cb416a8383033e3 | |
parent | 38f274a3b0958dbe5cd6b0886d40511ff71009a7 (diff) | |
download | libva-intel-driver-92509398f8e8d3bc6f4ab0f6d54cf6fec5b24377.tar.gz libva-intel-driver-92509398f8e8d3bc6f4ab0f6d54cf6fec5b24377.tar.bz2 libva-intel-driver-92509398f8e8d3bc6f4ab0f6d54cf6fec5b24377.zip |
Add the support of brightness/contrast/hue/saturation for BDW rendering
This is picked up from the commit 04ecb6e79f4382d96eb5d4b51733049d420f592a
Signed-off-by: Xiang Haihao <haihao.xiang@intel.com>
Signed-off-by: Zhao Yakui <yakui.zhao@intel.com>
-rw-r--r-- | src/i965_render.c | 20 | ||||
-rw-r--r-- | src/shaders/render/Makefile.am | 2 | ||||
-rw-r--r-- | src/shaders/render/exa_wm_yuv_color_balance.g8a | 39 | ||||
-rw-r--r-- | src/shaders/render/exa_wm_yuv_color_balance.g8b | 15 |
4 files changed, 76 insertions, 0 deletions
diff --git a/src/i965_render.c b/src/i965_render.c index d79f6b1..3c99614 100644 --- a/src/i965_render.c +++ b/src/i965_render.c @@ -157,6 +157,7 @@ static const uint32_t sf_kernel_static_gen8[][4] = static const uint32_t ps_kernel_static_gen8[][4] = { #include "shaders/render/exa_wm_src_affine.g8b" #include "shaders/render/exa_wm_src_sample_planar.g8b" +#include "shaders/render/exa_wm_yuv_color_balance.g8b" #include "shaders/render/exa_wm_yuv_rgb.g8b" #include "shaders/render/exa_wm_write.g8b" }; @@ -2867,6 +2868,11 @@ gen8_render_upload_constants(VADriverContextP ctx, struct i965_render_state *render_state = &i965->render_state; unsigned short *constant_buffer; unsigned char *cc_ptr; + float *color_balance_base; + float contrast = (float)i965->contrast_attrib->value / DEFAULT_CONTRAST; + 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; dri_bo_map(render_state->dynamic_state.bo, 1); assert(render_state->dynamic_state.bo->virtual); @@ -2887,6 +2893,20 @@ gen8_render_upload_constants(VADriverContextP ctx, *constant_buffer = 0; } + if (i965->contrast_attrib->value == DEFAULT_CONTRAST && + i965->brightness_attrib->value == DEFAULT_BRIGHTNESS && + i965->hue_attrib->value == DEFAULT_HUE && + i965->saturation_attrib->value == DEFAULT_SATURATION) + constant_buffer[1] = 1; /* skip color balance transformation */ + else + constant_buffer[1] = 0; + + color_balance_base = (float *)constant_buffer + 4; + *color_balance_base++ = contrast; + *color_balance_base++ = brightness; + *color_balance_base++ = cos(hue) * contrast * saturation; + *color_balance_base++ = sin(hue) * contrast * saturation; + dri_bo_unmap(render_state->dynamic_state.bo); } diff --git a/src/shaders/render/Makefile.am b/src/shaders/render/Makefile.am index 33aa367..e59869c 100644 --- a/src/shaders/render/Makefile.am +++ b/src/shaders/render/Makefile.am @@ -89,6 +89,7 @@ INTEL_G8A = \ exa_wm_src_affine.g8a \ exa_wm_src_sample_planar.g8a \ exa_wm_src_sample_argb.g8a \ + exa_wm_yuv_color_balance.g8a \ exa_wm_write.g8a \ exa_wm_yuv_rgb.g8a @@ -98,6 +99,7 @@ INTEL_G8B = \ exa_wm_src_affine.g8b \ exa_wm_src_sample_planar.g8b \ exa_wm_src_sample_argb.g8b \ + exa_wm_yuv_color_balance.g8b \ exa_wm_yuv_rgb.g8b \ exa_wm_write.g8b diff --git a/src/shaders/render/exa_wm_yuv_color_balance.g8a b/src/shaders/render/exa_wm_yuv_color_balance.g8a new file mode 100644 index 0000000..f3cc28f --- /dev/null +++ b/src/shaders/render/exa_wm_yuv_color_balance.g8a @@ -0,0 +1,39 @@ +/* + * 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: + * Haihao Xiang <haihao.xiang@intel.com> + * Zhao Yakui <yakui.zhao@intel.com> + * + */ + +include(`exa_wm.g4i') + +/* Color Balance parameters */ +define(`skip_color_balance', `g6.2<0,1,0>uw') +define(`contrast', `g6.16<0,1,0>f') +define(`brightness', `g6.20<0,1,0>f') +define(`cos_c_s', `g6.24<0,1,0>f') +define(`sin_c_s', `g6.28<0,1,0>f') +define(`sin_c_s_t', `g6.28') + +include(`exa_wm_yuv_color_balance.gxa') diff --git a/src/shaders/render/exa_wm_yuv_color_balance.g8b b/src/shaders/render/exa_wm_yuv_color_balance.g8b new file mode 100644 index 0000000..5dc2c8b --- /dev/null +++ b/src/shaders/render/exa_wm_yuv_color_balance.g8b @@ -0,0 +1,15 @@ + { 0x01000010, 0x200012e0, 0x160000c2, 0x00010001 }, + { 0x00010020, 0x34000000, 0x0e001400, 0x000000d0 }, + { 0x00800040, 0x24003ae8, 0x3e8d01c0, 0xbd808081 }, + { 0x00800041, 0x24003ae8, 0x3a8d0400, 0x000000d0 }, + { 0x00800040, 0x24003ae8, 0x3a8d0400, 0x000000d4 }, + { 0x00800040, 0x21c03ae8, 0x3e8d0400, 0x3d808081 }, + { 0x00800040, 0x24803ae8, 0x3e8d0200, 0xbf008084 }, + { 0x00800040, 0x24403ae8, 0x3e8d0240, 0xbf008084 }, + { 0x00800001, 0x24003ee0, 0x38000000, 0x3f008084 }, + { 0x00800048, 0x24003ae0, 0x3a8d0440, 0x000000dc }, + { 0x00800048, 0x22003ae8, 0x3a8d0480, 0x000000d8 }, + { 0x00000041, 0x20dc3ae8, 0x3e0000dc, 0xbf800000 }, + { 0x00800001, 0x24003ee0, 0x38000000, 0x3f008084 }, + { 0x00800048, 0x24003ae0, 0x3a8d0480, 0x000000dc }, + { 0x00800048, 0x22403ae8, 0x3a8d0440, 0x000000d8 }, |