summaryrefslogtreecommitdiff
path: root/src/fix.5c
diff options
context:
space:
mode:
authorKeith Packard <keithp@guitar.keithp.com>2006-12-21 02:33:39 -0800
committerKeith Packard <keithp@guitar.keithp.com>2006-12-21 02:33:39 -0800
commit4c0c1aa882cfec77b2183baec93cbc4cfaf4abe0 (patch)
tree664577f6017e17d605ed55b9041cd4beeb229921 /src/fix.5c
parent98fd44d681220aa31200e4262f1a7ec952a09530 (diff)
Computed corred color conversion values.
Extract correct color conversion values for all video formats from documentation. Use those, with appropriate conversions, for the color conversion register values.
Diffstat (limited to 'src/fix.5c')
-rw-r--r--src/fix.5c14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/fix.5c b/src/fix.5c
new file mode 100644
index 00000000..b758a433
--- /dev/null
+++ b/src/fix.5c
@@ -0,0 +1,14 @@
+/*
+ * Convert CSC fix point values to floats
+ */
+
+real fixval (int fix)
+{
+ int exp = fix >> 9;
+ int mant = fix & ((1 << 9) - 1);
+ real ret;
+ if (exp == 0x7)
+ return 1.0;
+ ret = (2 ** -exp) * mant / (1 << 9);
+ return ret;
+}