summaryrefslogtreecommitdiff
path: root/libavformat/wc3movie.c
diff options
context:
space:
mode:
authorReimar Döffinger <Reimar.Doeffinger@gmx.de>2009-04-11 20:08:16 +0000
committerReimar Döffinger <Reimar.Doeffinger@gmx.de>2009-04-11 20:08:16 +0000
commitcdbe3798d20db744f458cb3f3ad6ed53dae0f4d7 (patch)
tree63c307bacce6afe32eb027c648beb1740a480b8b /libavformat/wc3movie.c
parentf6a708f0920c5c93f183c1e02ac676450533987e (diff)
Explain the purpose of the wc3_pal_lookup and the formula that was used to
calculate it. Originally committed as revision 18445 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavformat/wc3movie.c')
-rw-r--r--libavformat/wc3movie.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/libavformat/wc3movie.c b/libavformat/wc3movie.c
index 4d2c88a647..8e5dd38c0d 100644
--- a/libavformat/wc3movie.c
+++ b/libavformat/wc3movie.c
@@ -72,7 +72,18 @@ typedef struct Wc3DemuxContext {
} Wc3DemuxContext;
-/* bizarre palette lookup table */
+/**
+ * palette lookup table that does gamma correction
+ *
+ * can be calculated by this formula:
+ * for i between 0 and 252 inclusive:
+ * wc3_pal_lookup[i] = pow(i / 256.0, 0.8) * 256;
+ * values 253, 254 and 255 are all 0xFD
+ * calculating this at runtime should not cause any
+ * rounding issues, the maximum difference between
+ * the table values and the calculated doubles is
+ * about 0.497527
+ */
static const unsigned char wc3_pal_lookup[] = {
0x00, 0x03, 0x05, 0x07, 0x09, 0x0B, 0x0D, 0x0E,
0x10, 0x12, 0x13, 0x15, 0x16, 0x18, 0x19, 0x1A,