summaryrefslogtreecommitdiff
path: root/apps/plugins/imageviewer/gif/gif_hash.h
diff options
context:
space:
mode:
authorMarcin Bukat <marcin.bukat@gmail.com>2012-11-02 13:03:58 +0100
committerMarcin Bukat <marcin.bukat@gmail.com>2012-11-13 18:13:10 +0100
commit0ceaff2b65c50b75ad8cc5b2d12e7b3f864092e5 (patch)
tree49d8d297cbba93902bc612a9aa4ded1b6e2d46e5 /apps/plugins/imageviewer/gif/gif_hash.h
parentb35f82c91ff050b4405b19a3e56e9d031bf940e2 (diff)
downloadrockbox-0ceaff2b65c50b75ad8cc5b2d12e7b3f864092e5.tar.gz
rockbox-0ceaff2b65c50b75ad8cc5b2d12e7b3f864092e5.zip
imageviewer: gif viewer based on giflib-5.0.2
This adds ability to view gif images in rockbox. Works both on color and gray/monochrome targets (greylib). Aspect correction is supported as well. Limitations: - animated gifs are restricted to 32 frames - animated gifs loop always (loopcount is ignored) - plain text extension is not supported - animated gifs with interframe delay = 0 are treated as still images (web browsers usually treat delay 0 as 100ms to prevent exhaustive CPU load by such images) Change-Id: I61501f801ddcd403410e38d83e6bddc9883e7ede
Diffstat (limited to 'apps/plugins/imageviewer/gif/gif_hash.h')
-rw-r--r--apps/plugins/imageviewer/gif/gif_hash.h39
1 files changed, 39 insertions, 0 deletions
diff --git a/apps/plugins/imageviewer/gif/gif_hash.h b/apps/plugins/imageviewer/gif/gif_hash.h
new file mode 100644
index 0000000000..a236bb56d1
--- /dev/null
+++ b/apps/plugins/imageviewer/gif/gif_hash.h
@@ -0,0 +1,39 @@
1/******************************************************************************
2
3gif_hash.h - magfic constants and declarations for GIF LZW
4
5******************************************************************************/
6
7#ifndef _GIF_HASH_H_
8#define _GIF_HASH_H_
9
10//#include <unistd.h>
11#include <stdint.h>
12
13#define HT_SIZE 8192 /* 12bits = 4096 or twice as big! */
14#define HT_KEY_MASK 0x1FFF /* 13bits keys */
15#define HT_KEY_NUM_BITS 13 /* 13bits keys */
16#define HT_MAX_KEY 8191 /* 13bits - 1, maximal code possible */
17#define HT_MAX_CODE 4095 /* Biggest code possible in 12 bits. */
18
19/* The 32 bits of the long are divided into two parts for the key & code: */
20/* 1. The code is 12 bits as our compression algorithm is limited to 12bits */
21/* 2. The key is 12 bits Prefix code + 8 bit new char or 20 bits. */
22/* The key is the upper 20 bits. The code is the lower 12. */
23#define HT_GET_KEY(l) (l >> 12)
24#define HT_GET_CODE(l) (l & 0x0FFF)
25#define HT_PUT_KEY(l) (l << 12)
26#define HT_PUT_CODE(l) (l & 0x0FFF)
27
28typedef struct GifHashTableType {
29 uint32_t HTable[HT_SIZE];
30} GifHashTableType;
31
32GifHashTableType *_InitHashTable(void);
33void _ClearHashTable(GifHashTableType *HashTable);
34void _InsertHashTable(GifHashTableType *HashTable, uint32_t Key, int Code);
35int _ExistsHashTable(GifHashTableType *HashTable, uint32_t Key);
36
37#endif /* _GIF_HASH_H_ */
38
39/* end */