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"
};
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);
*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);
}
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
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
--- /dev/null
+/*
+ * 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')
--- /dev/null
+ { 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 },