camdata.h
上传用户:dzdeming
上传日期:2022-08-03
资源大小:381k
文件大小:14k
源码类别:

Windows CE

开发平台:

Visual C++

  1. /*****************************************
  2.   NAME: camdata.h
  3.   DESC: data for initializing camera module
  4.   HISTORY:  2004.01.16:draft ver 0.0
  5.  *****************************************/
  6. #ifndef __CAMDATA_H__
  7. #define __CAMDATA_H__
  8. #ifdef __cplusplus
  9. extern "C"{
  10. #endif
  11. #include "Camdef.h"
  12. #define CAM_ACT_HSIZE (640) // Max 640
  13. #define CAM_ACT_VSIZE (480) // Max 480
  14. #define CAM_STX (0x2f) //47
  15. #define CAM_STY (6) //6
  16. #define CAM_ENDX (((CAM_ACT_HSIZE)/4) + CAM_STX)
  17. #define CAM_ENDY ((CAM_ACT_VSIZE/2) + CAM_STY-1)
  18. const unsigned char Ov7620_Yuv16bit[][2] = {
  19. {0x12, 0x80}, // Camera Soft reset. Self cleared after reset.
  20. {0x17, CAM_STX}, //
  21. {0x18, CAM_ENDX}, // (207-47)*4 = 640
  22. {0x19, CAM_STY}, //
  23. {0x1a, CAM_ENDY}, // ((244-5)+1)*2=480
  24. {0x01, 0x80}, // set blue gain
  25. {0x02, 0x80}, // set red gain
  26. {0x03, 0xb0},
  27. {0x06, 0x70}, // set brightness
  28. {0x07, 0x00},
  29. {0x0c, 0x24}, // set blue background
  30. {0x0d, 0x24}, // set red background
  31. {0x10, 0xff}, // set exposure time, brightness control
  32. {0x11, 0x40}, // set frame rate 27Mhz/[(0+1)*2]=13.5MHz
  33. {0x12, 0x24}, // set YUV mode, enable AGC/AWB, mirror image.
  34. {0x15, 0x01}, // Use PCLK rising edge to latch data
  35. {0x16, 0x03}, //
  36. {0x12, 0x64}, // set YUV mode, enable AGC/AWB, mirror image.
  37. {0x13, 0x01}, // YUV 16-bit format, Disable AEC/AGC/AWB
  38. {0x14, 0x84}, // turn off GAMMA
  39. {0x24, 0x3a}, //
  40. {0x25, 0x60}, //
  41. {0x28, 0x20}, // Progressive mode.
  42. {0x2d, 0x95}, //
  43. {0x67, 0x92}, //
  44. {0x74, 0x00} //
  45. };
  46. const unsigned char Ov7620_YCbCr8bit[][2] = {
  47. {0x12, 0x80}, // Camera Soft reset. Self cleared after reset.
  48. {0x00, 0x00},
  49. {0x01, 0x80}, // set blue gain
  50. {0x02, 0x80}, // set red gain
  51. {0x03, 0xb0},
  52. {0x06, 0x60}, // set brightness
  53. {0x0c, 0x24}, // set blue background
  54. {0x0d, 0x24}, // set red background
  55. {0x10, 0xff}, // set exposure time, brightness control
  56. {0x11, 0x80}, // set frame rate CLK_input = PCLK
  57. {0x13, 0x21}, // set 8 Bit YUV mode
  58. {0x14, 0x94}, 
  59. {0x16, 0x03}, //
  60. {0x17, 0x2f}, //
  61. {0x18, 0xcf},         // (207-47)*4 = 640
  62. {0x19, 0x06}, //
  63. {0x1a, 0xf5},         // ((244-5)+1)*2=480
  64. {0x1b, 0x00},
  65. {0x20, 0x00},
  66. {0x21, 0x80},
  67. {0x22, 0x80},
  68. {0x23, 0x00},
  69. {0x26, 0xa2},
  70. {0x27, 0xea},
  71. {0x29, 0x00},
  72. {0x2a, 0x00},
  73. {0x2b, 0x00},
  74. {0x2c, 0x88},
  75. {0x2e, 0x80},
  76. {0x2f, 0x44},
  77. {0x60, 0x27},
  78. {0x61, 0x82},
  79. {0x62, 0x5f},
  80. {0x63, 0xd5},
  81. {0x64, 0x57},
  82. {0x65, 0x83},
  83. {0x66, 0x55},
  84. {0x68, 0xcf},
  85. {0x69, 0x76},
  86. {0x6a, 0x22},
  87. {0x6b, 0x00},
  88. {0x6c, 0x08},
  89. {0x6d, 0x48},
  90. {0x6e, 0x80},
  91. {0x6f, 0x0c},
  92. {0x70, 0x89},
  93. {0x71, 0x00},
  94. {0x72, 0x14},
  95. {0x73, 0x54},
  96. {0x75, 0x0e},
  97. {0x76, 0x00},
  98. {0x77, 0xff},
  99. {0x78, 0x80},
  100. {0x79, 0x80},
  101. {0x7a, 0x80},
  102. {0x7b, 0xe6},
  103. {0x7c, 0x00},
  104. {0x24, 0x10},
  105. {0x25, 0x8a},
  106. {0x28, 0x20},
  107. {0x2d, 0x95},
  108. {0x67, 0x92},
  109. {0x74, 0x00},
  110. {0x15, 0x41}, // inversed PCLK : falling edge to get data, 8 Bit -U-V- sequence....
  111. {0x12, 0x34},  // enable AGC/AWB, mirror image. YUYV-must set at last..
  112. };
  113. const unsigned char Au70h[][2] = {
  114.     {0x01,0x0b}, /*0x04*/ //5x5 interpolation VGA mode
  115. #if AU70H_VIDEO_SIZE==640
  116. {0x08,0x00},
  117. {0x09,0xc0},
  118. {0x0a,0x01},
  119. {0x0b,0x00},
  120. {0x0c,0x01},
  121. {0x0d,0xe0},
  122. {0x0e,0x02},
  123. {0x0f,0x80},
  124. #elif AU70H_VIDEO_SIZE==1152
  125. {0x08,0x00},
  126. {0x09,0x02},
  127. {0x0a,0x00},
  128. {0x0b,0x02},
  129. {0x0c,0x03},
  130. {0x0d,0x60},
  131. {0x0e,0x04},
  132. {0x0f,0x80},
  133. #endif
  134. {0x18,0x01},
  135. {0x19,0x3f},
  136. {0x1a,0x13},
  137. {0x1b,0x7f},
  138. {0x1c,0x08},
  139. {0x20,0x13},
  140. {0x21,0x01},
  141. {0x22,0x01},
  142. {0x23,0x01},
  143. {0x27,0xf0},
  144. {0x30,0xfe},
  145. {0x31,0x31}, //YCbCr 8bit 0x31,0x11
  146. {0x32,0x00},
  147. {0x33,0x03},
  148. {0x67,0xa5},  //???
  149. {0x68,0x2c},
  150. {0x69,0x2a},
  151. {0x73,0x79},
  152. {0x75,0x03},
  153. {0x76,0x08},
  154. {0x77,0x35},
  155. {0x81,0x19},
  156. {0x90,0x01},
  157. {0x91,0x06},
  158. {0x92,0x1a},
  159. {0x93,0x80},
  160. {0x6a,0x01},
  161. {0x6b,0x38},
  162. {0x6c,0x80},
  163. {0x6d,0x09},
  164. {0x6e,0xc4},
  165. {0x6f,0x00},
  166. {0x60,0x99},
  167. {0x63,0x03},
  168. {0x64,0xa9},
  169. {0x65,0x80},
  170. {0x66,0x30},
  171. {0x70,0x44},
  172. {0x71,0x00},
  173. //{0x14,0x8},
  174. //{0x16,0x8},
  175. {0x70,0x45},
  176. {0x71,0x02},
  177. {0x66,0x70}
  178. };
  179. const unsigned char S5X532_YCbCr8bit[][2] = 
  180. {
  181. #if 0 
  182. // page 5
  183. {0xec,0x05},
  184. {0x08,0x55},
  185. {0x0a,0x75},
  186. {0x0c,0x90},
  187. {0x0e,0x18},
  188. {0x12,0x09},
  189. {0x14,0x9d},
  190. {0x16,0x90},
  191. {0x1a,0x18},
  192. {0x1c,0x0c},
  193. {0x1e,0x09},
  194. {0x20,0x06},
  195. {0x22,0x20},
  196. {0x2a,0x00},
  197. {0x2d,0x04},
  198. {0x12,0x24},
  199. // page 3
  200. {0xec,0x03},
  201. {0x0c,0x09},
  202. {0x6c,0x09},
  203. {0x2b,0x10}, // momo clock inversion
  204. // page 2
  205. {0xec,0x02},
  206. {0x03,0x09},
  207. {0x05,0x08},
  208. {0x06,0x01},
  209. {0x07,0xf8},
  210. {0x15,0x25},
  211. {0x30,0x29},
  212. {0x36,0x12},
  213. {0x38,0x04},
  214. {0x1b,0x77}, // 24MHz : 0x77, 12MHz : 0x22
  215. {0x1c,0x77}, // 24MHz : 0x77, 12MHz : 0x22
  216. // page 1
  217. {0xec,0x01},
  218. {0x00,0x03}, // 
  219. {0x0a,0x08}, // 0x0-QQVGA, 0x06-CIF, 0x02-QCIF, 0x08-VGA, 0x04-QVGA, 0x0a-SXGA
  220. {0x0c,0x00}, // Pattern selectio. 0-CIS, 1-Color bar, 2-Ramp, 3-Blue screen
  221. {0x10,0x27}, // 0x21-ITU-R656(CbYCrY), 0x25-ITU-R601(CbYCrY), 0x26-ITU-R601(YCrYCb)
  222. {0x50,0x21}, // Hblank
  223. {0x51,0x00}, // Hblank
  224. {0x52,0xA1}, // Hblank
  225. {0x53,0x02}, // Hblank
  226. {0x54,0x01}, // Vblank
  227. {0x55,0x00}, // Vblank
  228. {0x56,0xE1}, // Vblank 
  229. {0x57,0x01}, // Vblank
  230. {0x58,0x21}, // Hsync
  231. {0x59,0x00}, // Hsync
  232. {0x5a,0xA1}, // Hsync
  233. {0x5b,0x02}, // Hsync
  234. {0x5c,0x03}, // Vref
  235. {0x5d,0x00}, // Vref
  236. {0x5e,0x05}, // Vref
  237. {0x5f,0x00}, // Vref
  238. {0x70,0x0E},
  239. {0x71,0xD6},
  240. {0x72,0x30},
  241. {0x73,0xDB},
  242. {0x74,0x0E},
  243. {0x75,0xD6},
  244. {0x76,0x18},
  245. {0x77,0xF5},
  246. {0x78,0x0E},
  247. {0x79,0xD6},
  248. {0x7a,0x28},
  249. {0x7b,0xE6},
  250. {0x50,0x00},
  251. {0x5c,0x00},
  252. // page 0
  253. {0xec,0x00},
  254. {0x79,0x01},
  255. {0x58,0x90},
  256. {0x59,0xA0},
  257. {0x5a,0x50},
  258. {0x5b,0x70},
  259. {0x5c,0xD0},
  260. {0x5d,0xC0},
  261. {0x5e,0x28},
  262. {0x5f,0x08},
  263. {0x50,0x90},
  264. {0x51,0xA0},
  265. {0x52,0x50},
  266. {0x53,0x70},
  267. {0x54,0xD0},
  268. {0x55,0xC0},
  269. {0x56,0x28},
  270. {0x57,0x00},
  271. {0x48,0x90},
  272. {0x49,0xA0},
  273. {0x4a,0x50},
  274. {0x4b,0x70},
  275. {0x4c,0xD0},
  276. {0x4d,0xC0},
  277. {0x4e,0x28},
  278. {0x4f,0x08},
  279. {0x72,0x82}, // main clock = 24MHz:0xd2, 16M:0x82, 12M:0x54
  280. {0x75,0x05} // absolute vertical mirror.  junon
  281. #else
  282. ///3aa////////////////////////////////////////////////////////////////////
  283. // page 1
  284. {0xec,0x01},
  285. {0x28,0x10}, //Edge Enhancement Noise Slice
  286. //////////////////
  287. //Computer Encoding
  288. //s8b21 //V Output Sync inversion, Full_YC On,SCK656_INV_R
  289. //s1941 //Y Coef
  290. //1b19
  291. //s48ee //Cb Coef  
  292. //s4a38
  293. //s4738 //Cr Coef                                                    
  294. //s49f7 
  295. ///////////////////
  296. //SDTV Encoding
  297. {0x8b,0x23}, //V Output Sync inversion, Full_YC On,SCK656_INV_R
  298. {0x19,0x4d}, //Y Coef
  299. {0x1a,0x96},
  300. {0x1b,0x1d},
  301. {0x48,0xea}, //Cb Coef  
  302. {0x4a,0x41},
  303. {0x47,0x41}, //Cr Coef                                                    
  304. {0x49,0xf5},
  305. {0x2d,0x15}, //Adjust YGRPDLY 3clk->0clk
  306. ///// Color Matrix
  307. ////s107e
  308. ////s12fe
  309. ////s187e //a0 
  310. //s1cd0   //Highlight Suppress Reference
  311. {0xaa,0xe0},   //For AWB, High Threshold Value of Y signal
  312. {0xab,0x10}, //30 //For AWB, Low Threshold Value of Y signal
  313. // Pixel Filter
  314. {0xac,0x80},   //AWB B-G Low Threshold
  315. {0xad,0x80}, //AWB B-G High Threshold
  316. {0xae,0x80}, //AWB R-G Low Threshold
  317. {0xaf,0x80}, //AWB R-G Low Threshold
  318. {0xb0,0x60}, //AWB R-G,B-G High Threshold
  319. {0xb1,0x80}, //AWB R-G,B-G Low Threshold
  320. //***************************************************
  321. // page 2
  322. {0xec,0x02},
  323. {0x05,0x0b},
  324. {0x07,0x0b},
  325. {0x26,0x86},   //ADLC Set
  326. {0x2d,0x00}, //APS Bias Current   6uA  ---> 1uA for SHBN & HN reduce 
  327. {0x2e,0x50}, //Ramp Gain
  328. {0x2f,0x30}, //Ramp Bias Current for SHBN reduce 
  329. {0x30,0x05}, //for reducing noise... switch cap
  330. //***************************************************
  331. // page 3,4
  332. //Y,Cr first ITU R-601 format
  333. //sec01
  334. //s6a07
  335. {0xec,0x03},
  336. {0x06,0x07},
  337. {0xec,0x04},
  338. {0x06,0x07},
  339. // VCK inversion(data rising)
  340. //sec01
  341. //s690f
  342. {0xec,0x03},
  343. {0x05,0x0f},
  344. {0xec,0x04},
  345. {0x05,0x0f},
  346. //////////////////////////////
  347. // control start position(hsync hblank )
  348. // to remove broken pixel width on left side 
  349. //sec01
  350. //s783d //HBLK START
  351. //s823d //HS656 START
  352. {0xec,0x04},
  353. {0x0e,0x3d},
  354. {0x18,0x3d},
  355. //***************************************************
  356. // page 5
  357. // Shading
  358. {0xec,0x05},
  359. {0x00,0x0d}, //Shading Old(Y shading) ON & Shading New(RGB Shading) OFF
  360. //s000f //Shading Old(Y shading)  & Shading New(RGB Shading)
  361. //RGB Shading
  362. {0x05,0x05},   //R Shading of RGB Shading
  363. {0x06,0x05},
  364. {0x07,0x05},
  365. {0x08,0x05},
  366. {0x09,0x00},   //GR Shading of RGB Shading
  367. {0x0a,0x00},
  368. {0x0b,0x00},
  369. {0x0c,0x00},
  370. {0x0d,0x00},   //GB Shading of RGB Shading
  371. {0x0e,0x00},
  372. {0x0f,0x00},
  373. {0x10,0x00},
  374. {0x11,0x00},   //B Shading of RGB Shading
  375. {0x12,0x00},
  376. {0x13,0x00},
  377. {0x14,0x00},
  378. // Y Shading
  379. {0x2d,0xd0},
  380. {0x2e,0xb0},
  381. {0x2f,0xa0},
  382. {0x30,0x88},
  383. {0x31,0x88},
  384. {0x32,0xa0},
  385. {0x33,0xb0},
  386. {0x34,0xd0},
  387. {0x35,0xd0},
  388. {0x36,0xb0},
  389. {0x37,0x98},
  390. {0x38,0x88},
  391. {0x39,0x88},
  392. {0x3a,0x98},
  393. {0x3b,0xb0},
  394. {0x3c,0xd0},
  395. //***************************************************
  396. // page 6
  397. //adjust AE window
  398. //sec01
  399. ////s9718
  400. ////s9ae0
  401. ////s9c20
  402. ////s9ee8
  403. {0xec,0x06},
  404. {0x00,0x18},
  405. {0x02,0xe0},
  406. {0x04,0x20},
  407. {0x06,0xe8},
  408. ///
  409. ////adjust AWB window
  410. ////sec01
  411. ////sa05a
  412. ////sa2d8
  413. ////sa433
  414. ////sa6ba
  415. {0xec,0x06},
  416. {0x08,0x5a},
  417. {0x0a,0xd8},
  418. {0x0c,0x33},
  419. {0x0e,0xba},
  420. {0x8c,0x0b}, //in case of wrp wcp control for mirror
  421. {0x8d,0x0c},
  422. {0x8e,0x0b},
  423. {0x8f,0x0c},
  424. //***************************************************
  425. // page 7
  426. {0xec,0x07},
  427. {0x3c,0x00}, //adjust AWB internal window boundary to decrease skin color tracking
  428. //to dectect 50Hz flicker in 25Mhz 7.5fps
  429. {0x60,0x10}, //adjust flicker thres
  430. {0x62,0x11}, //adjust edge detection boundary
  431. {0x63,0x07}, //04 //duration of flicker
  432.      
  433. {0x69,0x10}, //for mirror
  434. {0x70,0x00},   //BLC Off
  435. //***************************************************
  436. // page 0
  437. {0xec,0x00},
  438. // Mirror
  439. {0x23,0x52}, //RV/H Control
  440. ////////////////////////////
  441. //Adjust AWB boundary
  442. {0xec,0x00},
  443. {0x34,0x08}, //0e //Rgain Max
  444. {0x37,0x0b}, //05 //Blimit High
  445. {0x39,0x06}, //06 //Blimit Low
  446. {0x3a,0x05}, //08 //Slope Bottom
  447. {0x3b,0x10}, //13 //08 //Slope Top
  448. {0x83,0xa0}, //c0 //Color suppress
  449. //s8a04 //unstable diff
  450. {0xbb,0x01}, //AWB AE Diff
  451. {0xbc,0x00},
  452. ////////////////////////////
  453. // improve AE speed
  454. {0xec,0x00},
  455. {0x92,0x80}, //AE ratio high
  456. {0xec,0x07},
  457. {0x10,0x30}, //AGC predict ON
  458. /////////////////////////////
  459. // Color Tunning
  460. ////1st. White Point 
  461. {0xec,0x07},
  462. {0x17,0x44}, //Increase Ggain
  463. //White Point                               
  464. {0xec,0x00},  
  465. {0x40,0x1a},
  466. {0x41,0x4f},
  467. {0x42,0x21},
  468. {0x43,0x40},
  469. {0x44,0x2e},
  470. {0x45,0x30},
  471. //Change start point of RBgain
  472. {0xa4,0x2e},
  473. {0xa5,0x30},
  474. {0x7f,0x30},
  475. ///2nd Veiwing 5100 DNP, Adjust RGBgain of AWB
  476. {0x79,0xff}, //Rgain
  477. {0x7a,0x03}, //Bgain
  478. {0xec,0x07},
  479. {0x11,0xff}, //Ggain
  480. ////3rd AE target, Gamma
  481. {0xec,0x00},
  482. {0x6c,0x08},   //AE Target
  483. //Y Gamma
  484. {0xec,0x01},
  485. {0x2e,0x08},
  486. {0x2f,0x10},
  487. {0x30,0x20},
  488. {0x31,0x58},
  489. {0x32,0xfe},
  490. {0x33,0xa8},
  491. {0x34,0x6c},
  492. {0x35,0xff},
  493. {0x36,0x00},
  494. {0x37,0x1b},
  495. //C Gamma  
  496. {0x55,0x08},     
  497. {0x56,0x10},     
  498. {0x57,0x20},     
  499. {0x58,0x58},
  500. {0x59,0xfe},
  501. {0x5a,0xa8},   
  502. {0x5b,0x8c},
  503. {0x5c,0xcf},
  504. {0x5d,0x00},
  505. {0x5e,0x1b},
  506. ///4th Hue, Color Level
  507. {0xec,0x00},
  508. {0x77,0xa9},  //da //Color Level
  509. {0x76,0x75}, 
  510. //Hue, Gain control                           
  511. {0x48,0xd0},                   
  512. {0x49,0xf0},//fe      
  513. {0x4a,0x48},                   
  514. {0x4b,0x28},//38       
  515. {0x4c,0xfe},       
  516. {0x4d,0xfe},       
  517. {0x4e,0x58},   
  518. {0x4f,0x10},    
  519. {0x50,0xc0},                        
  520. {0x51,0xf0},//fe           
  521. {0x52,0x4a},                
  522. {0x53,0x28},//38
  523. {0x54,0xfe},    
  524. {0x55,0xfe},         
  525. {0x56,0x60},         
  526. {0x57,0x10},
  527. {0x58,0xb0},
  528. {0x59,0xf0},//fe    
  529. {0x5a,0x50},
  530. {0x5b,0x38},//48
  531. {0x5c,0xf0},    
  532. {0x5d,0xfe},    
  533. {0x5e,0x60},    
  534. {0x5f,0x10},
  535. ////5th Adjust AE weight
  536. {0xec,0x07},
  537. {0x80,0x10}, //10
  538. {0x81,0x01}, //00
  539. {0x82,0x01}, //01
  540. {0x83,0x01}, //02
  541. {0x84,0x04}, //02
  542. ////////////////////////////
  543. // Control Gain
  544. {0xec,0x00},
  545. {0x78,0x60}, //Total gain x4 (Only Analog x4)
  546. {0x2d,0x5a}, //Frame AE start
  547. {0x82,0x5A}, //Color Suppress AGC Min
  548. ///////////////////////////
  549. // Control BPRM
  550. // CIS BPR always off
  551. {0xec,0x00},
  552. {0x7e,0x87}, //Color Suppress On, Y gain On, Digital clamp On, DBPRM On
  553. {0x86,0x01}, //DBPR AGC MIN
  554. {0x87,0x00}, //DBPRM THRES. MIN
  555. //s8710 //DBPRM THRES. MIN.. optimize between BPR and Pseudo color
  556. {0xec,0x07},
  557. {0x21,0x90}, //50 //DBPRM THRES. MAX
  558. {0x22,0x20}, //DBPR AGC MAX
  559. //*********************************************************
  560. // If you change MCLK or Frame rate, you change below register
  561. //*********************************************************
  562. /////////////////////////////
  563. ///Adjust Global Gain 
  564. {0xec,0x02},
  565. {0x1f,0x0f}, // if MCLK is 25Mhz
  566. ////////////////////////////
  567. //Flicker setting
  568. {0xec,0x00},
  569. {0x72,0x7a}, // if MCLK is 25Mhz
  570. ////////////////////////////
  571. // Adjust Vblank depth
  572. /// Make 25Mhz 7.5fps 
  573. {0xec,0x02},
  574. {0x17,0x00},
  575. {0x18,0x8c},
  576. {0xec,0x04},
  577. {0x01,0x00},
  578. {0x02,0x8c},
  579. //*********************************************************
  580. ////////////////////////////
  581. //Flicker setting
  582. {0xec,0x00},
  583. {0x74,0x14},  // Auto Flicker start 60hz for 7.5fps
  584. ////////////////////////////
  585. // Frame AE 
  586. {0xec,0x00},
  587. {0x73,0x11}, // frame 1/2
  588. #endif
  589. };
  590. const unsigned char S5X3A1_YCbCr8bit[][2] = 
  591. // page 0
  592. {0xec,0x00},
  593. // {0x72,0xd2}, //main clock = 27MHz:0x00, 24MHz:0xd2, ...
  594. {0x01,0x00}, //SXGA
  595. // page 1
  596. {0xec,0x01},
  597. {0x0b,0x10}, // href type
  598. {0x5c,0x01}, // href type
  599. {0x5d,0x00}, // href type
  600. {0x5e,0x01}, // href type
  601. {0x5f,0x04}, // href type
  602. // page 0
  603. {0xec,0x00}
  604. };
  605. #ifdef __cplusplus
  606. }
  607. #endif
  608. #endif /*__CAMDATA_H__*/