[igt-dev] [PATCH i-g-t 3/4] lib/igt_color_encoding: Appease c90

Ville Syrjala ville.syrjala at linux.intel.com
Wed Jun 6 20:16:41 UTC 2018


From: Ville Syrjälä <ville.syrjala at linux.intel.com>

Apparently we stil build in c90 mode or something with autotools. It
doesn't like mixed code and declarations.

Cc: Chris Wilson <chris at chris-wilson.co.uk>
Signed-off-by: Ville Syrjälä <ville.syrjala at linux.intel.com>
---
 lib/igt_color_encoding.c | 46 ++++++++++++++++++++++------------------------
 1 file changed, 22 insertions(+), 24 deletions(-)

diff --git a/lib/igt_color_encoding.c b/lib/igt_color_encoding.c
index fc9edef1e331..8d5379b1f740 100644
--- a/lib/igt_color_encoding.c
+++ b/lib/igt_color_encoding.c
@@ -36,54 +36,52 @@ static const struct color_encoding color_encodings[IGT_NUM_COLOR_ENCODINGS] = {
 
 static struct igt_mat4 rgb_to_ycbcr_matrix(const struct color_encoding *e)
 {
+	struct igt_mat4 ret = {};
 	float kr, kg, kb;
 
 	kr = e->kr;
 	kb = e->kb;
 	kg = 1.0f - kr - kb;
 
-	struct igt_mat4 ret = {
-		.d[m(0, 0)] = kr,
-		.d[m(0, 1)] = kg,
-		.d[m(0, 2)] = kb,
+	ret.d[m(0, 0)] = kr;
+	ret.d[m(0, 1)] = kg;
+	ret.d[m(0, 2)] = kb;
 
-		.d[m(1, 0)] = -kr / (1.0f - kb),
-		.d[m(1, 1)] = -kg / (1.0f - kb),
-		.d[m(1, 2)] = 1.0f,
+	ret.d[m(1, 0)] = -kr / (1.0f - kb);
+	ret.d[m(1, 1)] = -kg / (1.0f - kb);
+	ret.d[m(1, 2)] = 1.0f;
 
-		.d[m(2, 0)] = 1.0f,
-		.d[m(2, 1)] = -kg / (1.0f - kr),
-		.d[m(2, 2)] = -kb / (1.0f - kr),
+	ret.d[m(2, 0)] = 1.0f;
+	ret.d[m(2, 1)] = -kg / (1.0f - kr);
+	ret.d[m(2, 2)] = -kb / (1.0f - kr);
 
-		.d[m(3, 3)] = 1.0f,
-	};
+	ret.d[m(3, 3)] = 1.0f;
 
 	return ret;
 }
 
 static struct igt_mat4 ycbcr_to_rgb_matrix(const struct color_encoding *e)
 {
+	struct igt_mat4 ret = {};
 	float kr, kg, kb;
 
 	kr = e->kr;
 	kb = e->kb;
 	kg = 1.0f - kr - kb;
 
-	struct igt_mat4 ret = {
-		.d[m(0, 0)] = 1.0f,
-		.d[m(0, 1)] = 0.0f,
-		.d[m(0, 2)] = 1.0 - kr,
+	ret.d[m(0, 0)] = 1.0f;
+	ret.d[m(0, 1)] = 0.0f;
+	ret.d[m(0, 2)] = 1.0 - kr;
 
-		.d[m(1, 0)] = 1.0f,
-		.d[m(1, 1)] = -(1.0 - kb) * kb / kg,
-		.d[m(1, 2)] = -(1.0 - kr) * kr / kg,
+	ret.d[m(1, 0)] = 1.0f;
+	ret.d[m(1, 1)] = -(1.0 - kb) * kb / kg;
+	ret.d[m(1, 2)] = -(1.0 - kr) * kr / kg;
 
-		.d[m(2, 0)] = 1.0f,
-		.d[m(2, 1)] = 1.0 - kb,
-		.d[m(2, 2)] = 0.0f,
+	ret.d[m(2, 0)] = 1.0f;
+	ret.d[m(2, 1)] = 1.0 - kb;
+	ret.d[m(2, 2)] = 0.0f;
 
-		.d[m(3, 3)] = 1.0f,
-	};
+	ret.d[m(3, 3)] = 1.0f;
 
 	return ret;
 }
-- 
2.16.4



More information about the igt-dev mailing list