Optimised GTX_color_space_YCoCg YCoCgR conversions

This commit is contained in:
Christophe Riccio 2016-11-20 23:44:08 +01:00
parent b09f395cd2
commit 3945098589
2 changed files with 5 additions and 4 deletions

View file

@ -38,9 +38,9 @@ namespace glm
)
{
tvec3<T, P> result;
result.x/*Y */ = rgbColor.g / T(2) + (rgbColor.r + rgbColor.b) / T(4);
result.x/*Y */ = rgbColor.g * static_cast<T>(0.5) + (rgbColor.r + rgbColor.b) * static_cast<T>(0.25);
result.y/*Co*/ = rgbColor.r - rgbColor.b;
result.z/*Cg*/ = rgbColor.g - (rgbColor.r + rgbColor.b) / T(2);
result.z/*Cg*/ = rgbColor.g - (rgbColor.r + rgbColor.b) * static_cast<T>(0.5);
return result;
}
@ -50,9 +50,9 @@ namespace glm
)
{
tvec3<T, P> result;
T tmp = YCoCgRColor.x - (YCoCgRColor.z / T(2));
T tmp = YCoCgRColor.x - (YCoCgRColor.z * static_cast<T>(0.5));
result.g = YCoCgRColor.z + tmp;
result.b = tmp - (YCoCgRColor.y / T(2));
result.b = tmp - (YCoCgRColor.y * static_cast<T>(0.5));
result.r = result.b + YCoCgRColor.y;
return result;
}

View file

@ -65,6 +65,7 @@ glm::mat4 camera(float Translate, glm::vec2 const & Rotate)
- Optimized GTC_packing implementation
- Optimized GTC_noise functions
- Optimized GTC_color_space HSV to RGB conversions
- Optimised GTX_color_space_YCoCg YCoCgR conversions
- Optimized GTX_matrix_interpolation axisAngle function
- Added FAQ 12: Windows headers cause build errors... #557