📄 srgb.lst
字号:
C51 COMPILER V7.50 SRGB 03/18/2008 22:04:56 PAGE 1
C51 COMPILER V7.50, COMPILATION OF MODULE SRGB
OBJECT MODULE PLACED IN .\BIN\sRGB.obj
COMPILER INVOKED BY: D:\设计软件\Keil\C51\BIN\C51.EXE SRC\sRGB.C BROWSE DEBUG OBJECTEXTEND PRINT(.\LST\sRGB.lst) OBJECT(
-.\BIN\sRGB.obj)
line level source
1 #include "IIC.H"
2 #include "Scaler.H"
3 #include "MyDef.H"
4 #include "RAM.H"
5 #include "sRGB.H"
6 #include "PANEL.H"
7 #include <stdio.h>
8
9 code int rgb2yuv[3][3]={
10 { 0x041B, 0x0810, 0x0191 },
11 { -0x025F, -0x04A7, 0x0707 },
12 { 0x0707, -0x05E2, -0x0124 }
13 };
14
15 //code int yuv2rgb[3][3] = yuv2rgbXsRGB2rgb;
16 code int yuv2rgb[3][3]={
17 { 0x12A1, 0x0000, 0x1989 },
18 { 0x12A1, -0x0644, -0x0D01 },
19 { 0x12A1, 0x2046, 0x0000 }
20 };
21 /*
22 short code sincos_tbl[17] = {
23 0x0000, 0x0191, 0x031F, 0x04A5,
24 0x061F, 0x078A, 0x08E3, 0x0A26,
25 0x0B50, 0x0C5E, 0x0D4D, 0x0E1C,
26 0x0EC8, 0x0F4F, 0x0FB1, 0x0FEC,
27 0x0FFF
28 };
29 */
30
31 code int sincos_tbl[65]={
32 0x0000,0x0064,0x00C9,0x012D,0x0191,0x01F5,0x0259,0x02BC,0x031F,0x0381,
33 0x03E3,0x0444,0x04A5,0x0505,0x0564,0x05C2,0x061F,0x067B,0x06D7,0x0731,
34 0x078A,0x07E3,0x083A,0x088F,0x08E3,0x0937,0x0988,0x09D8,0x0A26,0x0A73,
35 0x0ABF,0x0B08,0x0B50,0x0B97,0x0BDB,0x0C1E,0x0C5E,0x0C9D,0x0CDA,0x0D15,
36 0x0D4D,0x0D85,0x0DB9,0x0DEC,0x0E1C,0x0E4B,0x0E77,0x0EA1,0x0EC8,0x0EEE,
37 0x0F10,0x0F31,0x0F4F,0x0F6C,0x0F85,0x0F9C,0x0FB1,0x0FC4,0x0FD4,0x0FE1,
38 0x0FEC,0x0FF5,0x0FFB,0x0FFE,0x1000
39 };
40 int sine(unsigned char alpha)
41 {
42 1 unsigned char value = alpha & 0x3f;
43 1 switch(alpha & 0xC0){
44 2 case 0x00:
45 2 return(sincos_tbl[value]);
46 2 break;
47 2 case 0x40:
48 2 return(sincos_tbl[(64 - value)]);
49 2 break;
50 2 case 0x80:
51 2 return(-sincos_tbl[value]);
52 2 break;
53 2 case 0xC0:
54 2 return(-sincos_tbl[(64 - value)]);
C51 COMPILER V7.50 SRGB 03/18/2008 22:04:56 PAGE 2
55 2 break;
56 2 }
57 1 }
58
59 int cosine(unsigned char alpha)
60 {
61 1 return (sine(alpha + 64));
62 1 }
63
64 void product(int *first, int * second, int *result)
65 {
66 1 unsigned char i,j,k;
67 1 long res;
68 1 for( i=0;i<3;i++){
69 2 for( j=0;j<3;j++){
70 3 res = 0;
71 3 for( k=0;k<3;k++){
72 4 res += (long)*(first + i*3 + k) * (long)*(second + k*3 + j);
73 4 }
74 3 *(result + i*3 + j) = ((res + 2048)>>12);
75 3 }
76 2 }
77 1 }
78
79 void sRGB(void)
80 {
81 1 xdata unsigned char i,j;
82 1 xdata unsigned short ss,hh;
83 1 xdata int temp,gain[3];
84 1 xdata int result[3][3];
85 1 xdata int adjust[3][3];
86 1 xdata int UVrotated[3][3];
87 1 xdata int UserPrefContrast;
88 1 gain[0] = ((unsigned short)R_Gain << 1) + R_Gain/2; //56; gan
89 1 gain[1] = ((unsigned short)G_Gain << 1) + G_Gain/2; //56; gan
90 1 gain[2] = ((unsigned short)B_Gain << 1) + B_Gain/2; //56; gan
91 1 // gain[0] = ((unsigned short)Contrast * 255 + 50)/100;
92 1 // gain[1] = ((unsigned short)Contrast * 255 + 50)/100;
93 1 // gain[2] = ((unsigned short)Contrast * 255 + 50)/100;
94 1 ss = ((unsigned short)Saturation * 256 + 50) / 100;
95 1 hh = (((unsigned short)Tint * 256 + 50) / 100) - 128;
96 1 if((flag3 & BIT_2) != 0x00){
97 2 printf("Saturation = %x\r\n",(unsigned short)ss);
98 2 printf("Tint = %x\r\n",(unsigned short)hh);
99 2 }
100 1
101 1 UserPrefContrast = ((unsigned short)Contrast * 60 + 50)/100 + 98;
102 1 // UserPrefContrast = 0x80;
103 1 for(i=0; i<3; i++){
104 2 UVrotated[i][0] = 0;
105 2 }
106 1 for(i=0; i<3; i++){
107 2 UVrotated[0][i] = 0;
108 2 }
109 1
110 1 UVrotated[1][1] = (((((long)ss<<5) * (long)cosine(hh))+2048)>>12);
111 1 UVrotated[1][2] = (((((long)ss<<5) * (long)sine(hh) )+2048)>>12);
112 1 UVrotated[2][1] = (((-(long)sine(hh)*((long)ss<<5))+2048)>>12);
113 1 UVrotated[2][2] = ((( (long)cosine(hh)*((long)ss<<5))+2048)>>12);
114 1 product(&UVrotated[0][0], &rgb2yuv[0][0], &adjust[0][0]);
115 1
116 1 for(i=0; i<3; i++){
C51 COMPILER V7.50 SRGB 03/18/2008 22:04:56 PAGE 3
117 2 adjust[0][i] =((((long)rgb2yuv[0][i]*((long)UserPrefContrast << 5))+2048)>>12);
118 2 }
119 1
120 1 product(&yuv2rgb[0][0],&adjust[0][0],&result[0][0]);
121 1
122 1 for(i=0; i<3; i++){
123 2 WriteIIC_HW(Scaler_Addr,0x7a,((i * 2) + 0x01));
124 2 // WriteIIC_HW(Scaler_Addr,0x81,0x80);
125 2 for(j=0; j<3; j++){
126 3 temp = (((((long)(result[i][j]+8)>>4)*((long)gain[i]<<4))+2048)>>12);
127 3 // temp = (result[i][j] + 8)/16;
128 3 if(temp < 0){
129 4 temp = temp ^ 0xffff;
130 4 temp +=1 ;
131 4 temp |= 0xf400;
132 4 }
133 3 if((flag3 & BIT_2) != 0x00)
134 3 printf("%x ",temp);
135 3 WriteWordIIC_HW(Scaler_Addr,(0x7b+(j*2)),temp);
136 3 WriteIIC_HW(Scaler_Addr,0x81,0x80);
137 3 }
138 2 if((flag3 & BIT_2) != 0x00)
139 2 printf("\r\n");
140 2 }
141 1 WriteIIC_HW(Scaler_Addr,0x7a,0x0d);
142 1 }
MODULE INFORMATION: STATIC OVERLAYABLE
CODE SIZE = 1363 ----
CONSTANT SIZE = 203 ----
XDATA SIZE = ---- 70
PDATA SIZE = ---- ----
DATA SIZE = ---- 16
IDATA SIZE = ---- ----
BIT SIZE = ---- ----
END OF MODULE INFORMATION.
C51 COMPILATION COMPLETE. 0 WARNING(S), 0 ERROR(S)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -