trunk 20080912
[gitenigma.git] / lib / picviewer / fb_display.h
blobf009941a909393843984dea3ec6be325677a0370
1 #ifndef __pictureviewer_fbdisplay__
2 #define __pictureviewer_fbdisplay__
4 ///// YUV framebuffer stuff
5 #define BPP_RED 8
6 #define BPP_GREEN 8
7 #define BPP_BLUE 8
9 #define NR_RED (1<<(BPP_RED))
10 #define NR_GREEN (1<<(BPP_GREEN))
11 #define NR_BLUE (1<<(BPP_BLUE))
13 #define lut_r_y (lut + 0 * (NR_RED + NR_GREEN + NR_BLUE) + 0)
14 #define lut_g_y (lut + 0 * (NR_RED + NR_GREEN + NR_BLUE) + NR_RED)
15 #define lut_b_y (lut + 0 * (NR_RED + NR_GREEN + NR_BLUE) + NR_RED + NR_GREEN)
16 #define lut_r_u (lut + 1 * (NR_RED + NR_GREEN + NR_BLUE) + 0)
17 #define lut_g_u (lut + 1 * (NR_RED + NR_GREEN + NR_BLUE) + NR_RED)
18 #define lut_b_u (lut + 1 * (NR_RED + NR_GREEN + NR_BLUE) + NR_RED + NR_GREEN)
19 #define lut_r_v (lut + 2 * (NR_RED + NR_GREEN + NR_BLUE) + 0)
20 #define lut_g_v (lut + 2 * (NR_RED + NR_GREEN + NR_BLUE) + NR_RED)
21 #define lut_b_v (lut + 2 * (NR_RED + NR_GREEN + NR_BLUE) + NR_RED + NR_GREEN)
22 extern unsigned short lut[3 * (NR_RED + NR_GREEN + NR_BLUE) ];
24 inline int Y(int R, int G, int B)
26 return 66 * R + 129 * G + 25 * B;
29 inline int U(int R, int G, int B)
31 return -38 * R - 74 * G + 112 * B;
34 inline int V(int R, int G, int B)
36 return 112 * R - 94 * G - 18 * B;
38 extern void * convertRGB2FB(unsigned char *rgbbuff, unsigned long count, int bpp, int *cpp);
39 extern void fb_display(unsigned char *rgbbuff, int x_size, int y_size, int x_pan, int y_pan, int x_offs, int y_offs);
40 extern void getCurrentRes(int *x, int *y);
41 #endif