brew qsc6085 camera 一
最近在brew 平台做。遇到一问题,已经量产的手机,由于结构上跟闪光灯隔离不够,导致有些手机拍照之后,会周边泛桔色,卖出去的手机,只可能通过手机软件升级来解决问题。发现把照片的整体红色减少之后,能弱化桔色,所以想到的办法时,在保存图片时,对图片做一些处理。
由于相关的代码camera_svcs.c是qualcomm写的,所以提了case 询问了qualcomm,图片的保存格式是:
1. 主图片是YCbCr:420
2. 缩略图是YCbCr:422
YCbCr 其中Y代表亮度,Cb代表蓝色,Cr代表红色。
在static void camera_jpeg_encode (qcamrawHeaderType *main_image_header, uint8 *main_image_buffer, qcamrawHeaderType *thumbnail_image_header, uint8 *thumbnail_image_buffer)时做一些处理:
main_image_buffer 是主图片buffer,此处主要是对主图处buffer做处理, thumbnail_image_buffer 是缩略图buffer
1 if (camera_flash_on) // 如果闪光灯开启的话 2 { 3 MSG_HIGH ("==camera_flash_on is true==", 0, 0, 0); 4 //0000,0000,0960,1280,0000,-024,0000; 5 x = 0; 6 x1 = 960; 7 y = 0; 8 y1 = 1280; 9 ycb = 0; 10 cr = -24; 11 cb = 0; 12 picX = 1280; 13 for ( ; x <= x1 ; ++x) 14 { 15 for(ySize = y; ySize <= y1; ++ySize) 16 { 17 mainSize = x*(picX-1)+ySize; 18 if (mainSize > main_image_header->YSize)//Ysize = 1228800 19 { 20 mainSize = main_image_header->YSize -1; 21 } 22 tmpY = main_image_buffer[mainSize] + ycb; //对亮度做调整 23 if (tmpY >255) tmpY = 255; 24 if (tmpY <0) tmpY = 0; 25 main_image_buffer[mainSize] = tmpY; 26 ///*=================YCbCr 420=========================== 27 cbCrSize = mainSize /2; 28 if (cbCrSize > main_image_header->CbCrSize)//CbCrSize = 614400 29 { 30 cbCrSize = main_image_header->CbCrSize -1; 31 MSG_HIGH("---illegality cbCrSize=%d", cbCrSize,0, 0); 32 } 33 cbCr = main_image_header->chromaBuffer[cbCrSize]; 34 35 if (ySize % 2 == 0) 36 { 37 if (cb != 0) 38 { 39 cbCr = cbCr + cb; 40 if (cbCr > 255) cbCr =255; 41 if (cbCr < 0) cbCr =0; 42 } 43 } 44 else 45 { 46 if (cr != 0) 47 { 48 cbCr = cbCr + cr; 49 if (cbCr > 255) cbCr =255; 50 if (cbCr < 0) cbCr =0; 51 } 52 } 53 main_image_header->chromaBuffer[cbCrSize] = cbCr; 54 //============================End==========================*/ 55 } 56 } 57 }