1 //<MStar Software>
2 //******************************************************************************
3 // MStar Software
4 // Copyright (c) 2010 - 2012 MStar Semiconductor, Inc. All rights reserved.
5 // All software, firmware and related documentation herein ("MStar Software") are
6 // intellectual property of MStar Semiconductor, Inc. ("MStar") and protected by
7 // law, including, but not limited to, copyright law and international treaties.
8 // Any use, modification, reproduction, retransmission, or republication of all
9 // or part of MStar Software is expressly prohibited, unless prior written
10 // permission has been granted by MStar.
11 //
12 // By accessing, browsing and/or using MStar Software, you acknowledge that you
13 // have read, understood, and agree, to be bound by below terms ("Terms") and to
14 // comply with all applicable laws and regulations:
15 //
16 // 1. MStar shall retain any and all right, ownership and interest to MStar
17 // Software and any modification/derivatives thereof.
18 // No right, ownership, or interest to MStar Software and any
19 // modification/derivatives thereof is transferred to you under Terms.
20 //
21 // 2. You understand that MStar Software might include, incorporate or be
22 // supplied together with third party`s software and the use of MStar
23 // Software may require additional licenses from third parties.
24 // Therefore, you hereby agree it is your sole responsibility to separately
25 // obtain any and all third party right and license necessary for your use of
26 // such third party`s software.
27 //
28 // 3. MStar Software and any modification/derivatives thereof shall be deemed as
29 // MStar`s confidential information and you agree to keep MStar`s
30 // confidential information in strictest confidence and not disclose to any
31 // third party.
32 //
33 // 4. MStar Software is provided on an "AS IS" basis without warranties of any
34 // kind. Any warranties are hereby expressly disclaimed by MStar, including
35 // without limitation, any warranties of merchantability, non-infringement of
36 // intellectual property rights, fitness for a particular purpose, error free
37 // and in conformity with any international standard. You agree to waive any
38 // claim against MStar for any loss, damage, cost or expense that you may
39 // incur related to your use of MStar Software.
40 // In no event shall MStar be liable for any direct, indirect, incidental or
41 // consequential damages, including without limitation, lost of profit or
42 // revenues, lost or damage of data, and unauthorized system use.
43 // You agree that this Section 4 shall still apply without being affected
44 // even if MStar Software has been modified by MStar in accordance with your
45 // request or instruction for your use, except otherwise agreed by both
46 // parties in writing.
47 //
48 // 5. If requested, MStar may from time to time provide technical supports or
49 // services in relation with MStar Software to you for your use of
50 // MStar Software in conjunction with your or your customer`s product
51 // ("Services").
52 // You understand and agree that, except otherwise agreed by both parties in
53 // writing, Services are provided on an "AS IS" basis and the warranty
54 // disclaimer set forth in Section 4 above shall apply.
55 //
56 // 6. Nothing contained herein shall be construed as by implication, estoppels
57 // or otherwise:
58 // (a) conferring any license or right to use MStar name, trademark, service
59 // mark, symbol or any other identification;
60 // (b) obligating MStar or any of its affiliates to furnish any person,
61 // including without limitation, you and your customers, any assistance
62 // of any kind whatsoever, or any information; or
63 // (c) conferring any license or right under any intellectual property right.
64 //
65 // 7. These terms shall be governed by and construed in accordance with the laws
66 // of Taiwan, R.O.C., excluding its conflict of law rules.
67 // Any and all dispute arising out hereof or related hereto shall be finally
68 // settled by arbitration referred to the Chinese Arbitration Association,
69 // Taipei in accordance with the ROC Arbitration Law and the Arbitration
70 // Rules of the Association by three (3) arbitrators appointed in accordance
71 // with the said Rules.
72 // The place of arbitration shall be in Taipei, Taiwan and the language shall
73 // be English.
74 // The arbitration award shall be final and binding to both parties.
75 //
76 //******************************************************************************
77 //<MStar Software>
78 ////////////////////////////////////////////////////////////////////////////////
79 //
80 // Copyright (c) 2008-2009 MStar Semiconductor, Inc.
81 // All rights reserved.
82 //
83 // Unless otherwise stipulated in writing, any and all information contained
84 // herein regardless in any format shall remain the sole proprietary of
85 // MStar Semiconductor Inc. and be kept in strict confidence
86 // ("MStar Confidential Information") by the recipient.
87 // Any unauthorized act including without limitation unauthorized disclosure,
88 // copying, use, reproduction, sale, distribution, modification, disassembling,
89 // reverse engineering and compiling of the contents of MStar Confidential
90 // Information is unlawful and strictly prohibited. MStar hereby reserves the
91 // rights to any and all damages, losses, costs and expenses resulting therefrom.
92 //
93 ////////////////////////////////////////////////////////////////////////////////#include <stdio.h>
94 #define DRV_XC_CALIBRATION_C
95
96 // Common Definition
97 #ifdef MSOS_TYPE_LINUX_KERNEL
98 #include <linux/string.h>
99 #else
100 #include <string.h>
101 #endif
102 #include "MsCommon.h"
103 #include "MsIRQ.h"
104 #include "MsOS.h"
105 #include "mhal_xc_chip_config.h"
106 #include "utopia.h"
107 #include "utopia_dapi.h"
108
109 #include "xc_Analog_Reg.h"
110
111 #include "drvXC_IOPort.h"
112 #include "apiXC.h"
113 #include "apiXC_Adc.h"
114 #include "apiXC_Auto.h"
115 #include "drv_sc_display.h"
116 #include "drv_sc_isr.h"
117 #include "apiXC_PCMonitor.h"
118 #include "apiXC_ModeParse.h"
119 #include "drvXC_HDMI_if.h"
120 #include "mvideo_context.h"
121 #include "drv_sc_ip.h"
122 #if (LD_ENABLE==1)
123 #include "mdrv_ld.h"
124 #include "mdrv_ldalgo.h"
125 #endif
126 #include "mdrv_sc_3d.h"
127 #include "drv_sc_menuload.h"
128 #include "drvXC_ADC_Internal.h"
129 #include "mhal_sc.h"
130 #if FRC_INSIDE
131 #include "mdrv_frc.h"
132 #include "mhal_frc.h"
133 #endif
134 #include "XC_private.h"
135 #include "apiXC_v2.h"
136 #include "drv_xc_calibration.h"
137 #include "drv_sc_scaling.h"
138 #include "xc_hwreg_utility2.h"
139
140 #define STORE_W_LIMIT_UNIT_SIZE 8UL
141 #define STORE_MEM_UNIT_SIZE 8UL
142 #define STORE_MEM_ALIGN_SIZE 8UL // 64 bits
143 #define CALIBRATION_DUMP_CAP_MEMORY 0
144 #define CALIBRATION_DUMP_STATISTIC 0
145 #define ENABLE_CALIB_SCREEN_MUTE 0
146 #define CALIBRATION_DELAY_TIME 100
147 #define CALIBRATION_PRE_CAPTURE_DELAY 30
148
149
150 #define DBG_CAL_CAP(x) //x
151 #define MIU_PROTECT 1
152 #define ENABLE_SC_MIU1 0
153
154
155 //Capture_Memory
156 #define FB_DBG(x) //x
157 #define ADC_MEMAVG_WITHOUT_MAXMIN 0
158 #define ADC_READ_PATTERN_FROM_EXTERNAL_SIGNAL 0
159
160
161 // Get pixel data
MApi_XC_Get_PixelData_U2(void * pInstance,MS_U16 u16CorX,MS_U16 u16CorY,MS_PIXEL_32BIT * pixel)162 void MApi_XC_Get_PixelData_U2(void* pInstance, MS_U16 u16CorX, MS_U16 u16CorY, MS_PIXEL_32BIT* pixel)
163 {
164 _XC_ENTRY(pInstance);
165 XC_INSTANCE_PRIVATE *psXCInstPri = NULL;
166 UtopiaInstanceGetPrivate(pInstance, (void**)&psXCInstPri);
167 // Enable memory pixel capture function
168 //MDrv_WriteByte( BK_SELECT_00, REG_BANK_DLC );
169 //MDrv_WriteByteMask(L_BK_DLC(0x68), ENABLE, BIT(0));
170 SC_W2BYTEMSK(psXCInstPri->u32DeviceID, REG_SC_BK1A_68_L,BIT(0),BIT(0));
171 SC_W2BYTE(psXCInstPri->u32DeviceID, REG_SC_BK1A_69_L,u16CorX);
172 SC_W2BYTE(psXCInstPri->u32DeviceID, REG_SC_BK1A_6A_L,u16CorY);
173 //MDrv_Write2Byte(L_BK_DLC(0x69), u16CorX);
174 //MDrv_Write2Byte(L_BK_DLC(0x6A), u16CorY);
175
176 OS_DELAY_TASK(20);
177
178 /*pixel->G_Y = MDrv_Read2Byte(L_BK_DLC(0x6B)) & 0x03FF;
179 pixel->B_Cb = MDrv_Read2Byte(L_BK_DLC(0x6C)) & 0x03FF;
180 pixel->R_Cr = MDrv_Read2Byte(L_BK_DLC(0x6D)) & 0x03FF;*/
181 pixel->G_Y = SC_R2BYTE(psXCInstPri->u32DeviceID, REG_SC_BK1A_6B_L)& 0x03FF;
182 pixel->B_Cb = SC_R2BYTE(psXCInstPri->u32DeviceID, REG_SC_BK1A_6C_L) & 0x03FF;
183 pixel->R_Cr = SC_R2BYTE(psXCInstPri->u32DeviceID, REG_SC_BK1A_6D_L) & 0x03FF;
184
185 //MDrv_WriteByteMask(L_BK_DLC(0x68), DISABLE, BIT(0));
186 SC_W2BYTEMSK(psXCInstPri->u32DeviceID, REG_SC_BK1A_68_L,0,BIT(0));
187 _XC_RETURN(pInstance);
188 }
189
MApi_XC_Get_PixelData(MS_U16 u16CorX,MS_U16 u16CorY,MS_PIXEL_32BIT * pixel)190 void MApi_XC_Get_PixelData(MS_U16 u16CorX, MS_U16 u16CorY, MS_PIXEL_32BIT* pixel)
191 {
192 if (pu32XCInst == NULL)
193 {
194 printf("[%s,%5d]No instance existed, please get an instance by calling MApi_XC_Init() first\n",__FUNCTION__,__LINE__);
195 return;
196 }
197
198 stXC_GET_PIXEL_DATA XCArgs;
199 XCArgs.u16CorX = u16CorX;
200 XCArgs.u16CorY = u16CorY;
201 XCArgs.pixel = pixel;
202
203 if(UtopiaIoctl(pu32XCInst, E_XC_CMD_GET_PIXEL_DATA, (void*)&XCArgs) != UTOPIA_STATUS_SUCCESS)
204 {
205 printf("Obtain XC engine fail\n");
206 return;
207 }
208 else
209 {
210 return;
211 }
212 }
213
214 //-------------------------------------------------------------------------------------------------
215 /// Get Average Data
216 /// @param sMemBuf \b IN: the buffer of memory
217 /// @param pCalWin \b IN: the window position and size of the memory
218 /// @return @ref MS_AUTOADC_TYPE
219 //-------------------------------------------------------------------------------------------------
MDrv_XC_GetAverageData(void * pInstance,MS_PIXEL_32BIT * sMemBuf,MS_AUTO_CAL_WINDOW_t pCalWin,SCALER_WIN eWindow)220 MS_AUTOADC_TYPE MDrv_XC_GetAverageData(void *pInstance, MS_PIXEL_32BIT *sMemBuf, MS_AUTO_CAL_WINDOW_t pCalWin, SCALER_WIN eWindow)
221 {
222 XC_INSTANCE_PRIVATE *psXCInstPri = NULL;
223 UtopiaInstanceGetPrivate(pInstance, (void**)&psXCInstPri);
224 MS_AUTOADC_TYPE ptAdcData;
225 MS_U32 u32Rtt, u32Gtt, u32Btt;
226 MS_U32 i, x, y;
227 #if ADC_MEMAVG_WITHOUT_MAXMIN
228 MS_U32 tmp;
229 MS_U16 u16MaxR,u16MaxG,u16MaxB;
230 MS_U16 u16MinR,u16MinG,u16MinB;
231 MS_U16 u16NumMaxR,u16NumMaxG,u16NumMaxB;
232 MS_U16 u16NumMinR,u16NumMinG,u16NumMinB;
233 MS_U16 u16NoMinMaxAvgCb, u16NoMinMaxAvgY, u16NoMinMaxAvgCr;
234 #endif
235
236 ptAdcData.u16CH_AVG[0] = ptAdcData.u16CH_AVG[1] = ptAdcData.u16CH_AVG[2] = 0;
237
238 i = 0;
239 u32Rtt = 0;
240 u32Gtt = 0;
241 u32Btt = 0;
242
243 #if ADC_MEMAVG_WITHOUT_MAXMIN
244 u16MaxR = 0;
245 u16MaxG = 0;
246 u16MaxB = 0;
247 u16MinR = 0;
248 u16MinG = 0;
249 u16MinB = 0;
250
251 u16NumMaxR = 0;
252 u16NumMaxG = 0;
253 u16NumMaxB = 0;
254 u16NumMinR = 0;
255 u16NumMinG = 0;
256 u16NumMinB = 0;
257
258 u16NoMinMaxAvgCb = 0;
259 u16NoMinMaxAvgY = 0;
260 u16NoMinMaxAvgCr = 0;
261 #endif
262
263 #if ADC_READ_PATTERN_FROM_EXTERNAL_SIGNAL
264
265 for(y=pCalWin.u16Y; y<pCalWin.u16Y+pCalWin.u16Ysize; y++)
266 {
267 for(x=pCalWin.u16X; x<pCalWin.u16X+pCalWin.u16Xsize; x++)
268 {
269
270 MS_PIXEL_32BIT pix;
271 MDrv_XC_Get_Pixel(x,y,&pix);
272
273 //printf("Y = 0x%04x, Cb = 0x%04x, Cr = 0x%04x\n", u16Y, u16Cb, u16Cr);
274 u32Rtt += pix.R_Cr;
275 u32Gtt += pix.G_Y;
276 u32Btt += pix.B_Cb;
277 }
278 }
279 // Disable Debug Cross
280 //MDrv_WriteByte( BK_SELECT_00, REG_BANK_DLC );
281 //MDrv_WriteByteMask(L_BK_DLC(0x68), DISABLE, BIT(0));
282 SC_W2BYTEMSK(psXCInstPri->u32DeviceID, REG_SC_BK1A_68_L,0,BIT(0));
283 ptAdcData.u16CH_AVG[0] = u32Rtt / (pCalWin.u16Ysize * pCalWin.u16Xsize);
284 ptAdcData.u16CH_AVG[1] = u32Gtt / (pCalWin.u16Ysize * pCalWin.u16Xsize);
285 ptAdcData.u16CH_AVG[2] = u32Btt / (pCalWin.u16Ysize * pCalWin.u16Xsize);
286
287 FB_DBG(printf("AvgCr AvgY AvgCb\n"));
288 FB_DBG(printf("%04d %04d %04d\n\n", ptAdcData.u16CH_AVG[0], ptAdcData.u16CH_AVG[1], ptAdcData.u16CH_AVG[2]));
289
290
291 #else
292 FB_DBG(printf("Mem Start (%d, %d) size %dx%d\n", pCalWin.u16X, pCalWin.u16Y, pCalWin.u16Xsize, pCalWin.u16Ysize));
293 FB_DBG(printf("u32RectSize=%u, u16PointSize=%u\n", pCalWin.u16Ysize * pCalWin.u16Xsize * sizeof(MS_PIXEL_32BIT), sizeof(MS_PIXEL_32BIT)));
294
295 MS_WINDOW_TYPE stTmpWin;
296 stTmpWin.x = pCalWin.u16X;
297 stTmpWin.y = pCalWin.u16Y;
298 stTmpWin.width = pCalWin.u16Xsize;
299 stTmpWin.height = pCalWin.u16Ysize;
300
301 MApi_XC_Get_BufferData_WithoutMutex(pInstance, E_XC_OUTPUTDATA_RGB10BITS, &stTmpWin, sMemBuf, eWindow);
302
303 for(y=pCalWin.u16Y; y<(pCalWin.u16Y+pCalWin.u16Ysize); y++)
304 {
305 for(x=pCalWin.u16X; x<(pCalWin.u16X+pCalWin.u16Xsize); x++)
306 {
307 #if ADC_MEMAVG_WITHOUT_MAXMIN
308 if (i == 0)
309 {
310 //printf("pu8VirPixelAdr 0x%lx\n", (U32)pu8VirPixelAdr);
311 u16MaxR = sMemBuf[i].Cr;
312 u16MinR = sMemBuf[i].Cr;
313 u16MaxG = sMemBuf[i].Y;
314 u16MinG = sMemBuf[i].Y;
315 u16MaxB = sMemBuf[i].Cb;
316 u16MinB = sMemBuf[i].Cb;
317 u16NumMaxR = 1;
318 u16NumMaxG = 1;
319 u16NumMaxB = 1;
320 u16NumMinR = 1;
321 u16NumMinG = 1;
322 u16NumMinB = 1;
323 }
324 else
325 {
326 if (sMemBuf[i].Cr > u16MaxR)
327 {
328 u16MaxR = sMemBuf[i].Cr;
329 u16NumMaxR = 1;
330 }
331 else if (sMemBuf[i].Cr == u16MaxR)
332 {
333 u16NumMaxR++;
334 }
335
336 if (sMemBuf[i].Cr < u16MinR)
337 {
338 u16MinR = sMemBuf[i].Cr;
339 u16NumMinR = 1;
340 }
341 else if (sMemBuf[i].Cr == u16MinR)
342 {
343 u16NumMinR++;
344 }
345
346
347 if (sMemBuf[i].Y > u16MaxG)
348 {
349 u16MaxG = sMemBuf[i].Y;
350 u16NumMaxG = 1;
351 }
352 else if (sMemBuf[i].Y == u16MaxG)
353 {
354 u16NumMaxG++;
355 }
356
357 if (sMemBuf[i].Y < u16MinG)
358 {
359 u16MinG = sMemBuf[i].Y;
360 u16NumMinG = 1;
361 }
362 else if (sMemBuf[i].Y == u16MinG)
363 {
364 u16NumMinG++;
365 }
366
367 if (sMemBuf[i].Cb > u16MaxB)
368 {
369 u16MaxB = sMemBuf[i].Cb;
370 u16NumMaxB = 1;
371 }
372 else if (sMemBuf[i].Cb == u16MaxB)
373 {
374 u16NumMaxB++;
375 }
376
377 if (sMemBuf[i].Cb < u16MinB)
378 {
379 u16MinB = sMemBuf[i].Cb;
380 u16NumMinB = 1;
381 }
382 else if (sMemBuf[i].Cb == u16MinB)
383 {
384 u16NumMinB++;
385 }
386 }
387 #endif
388 u32Rtt += sMemBuf[i].R_Cr;
389 u32Gtt += sMemBuf[i].G_Y;
390 u32Btt += sMemBuf[i].B_Cb;
391
392 //printf("(%3ld,%3ld) Rdata=%u, Gdata=%u, Bdata=%u\n",x,y,sMemBuf[i].R_Cr,sMemBuf[i].G_Y, sMemBuf[i].B_Cb);
393 FB_DBG(printf("Rtt=%lu, Gtt=%lu, Btt=%lu\n",u32Rtt,u32Gtt,u32Btt));
394 i++;
395 }
396 }
397
398
399 #if ADC_MEMAVG_WITHOUT_MAXMIN
400 tmp = u32Rtt - ((U32)u16MaxR * (U32)u16NumMaxR) - ((U32)u16MinR * (U32)u16NumMinR);
401 if ( tmp != 0 )
402 {
403 u16NoMinMaxAvgCr = tmp / ((pCalWin.u16Ysize * pCalWin.u16Xsize) - (u16NumMaxR + u16NumMinR));
404 }
405
406 tmp = u32Gtt - ((U32)u16MaxG * (U32)u16NumMaxG) - ((U32)u16MinG * (U32)u16NumMinG);
407 if ( tmp != 0 )
408 {
409 u16NoMinMaxAvgY = tmp / ((pCalWin.u16Ysize * pCalWin.u16Xsize) - (u16NumMaxG + u16NumMinG));
410 }
411
412 tmp = u32Btt - ((U32)u16MaxB * (U32)u16NumMaxB) - ((U32)u16MinB * (U32)u16NumMinB);
413 if ( tmp != 0 )
414 {
415 u16NoMinMaxAvgCb = tmp / ((pCalWin.u16Ysize * pCalWin.u16Xsize) - (u16NumMaxB + u16NumMinB));
416 }
417 #endif
418
419 ptAdcData.u16CH_AVG[0] = u32Rtt / (pCalWin.u16Ysize * pCalWin.u16Xsize);
420 ptAdcData.u16CH_AVG[1] = u32Gtt / (pCalWin.u16Ysize * pCalWin.u16Xsize);
421 ptAdcData.u16CH_AVG[2] = u32Btt / (pCalWin.u16Ysize * pCalWin.u16Xsize);
422
423 //printf("ptAdcData[RGB][%04d,%04d,%04d]\n",ptAdcData.u16CH_AVG[0],ptAdcData.u16CH_AVG[1],ptAdcData.u16CH_AVG[2]) ;
424
425 #if ADC_MEMAVG_WITHOUT_MAXMIN
426 printf("MaxCr MinCr MaxY MinY MaxCb MinCb AvgCr AvgY AvgCb\n");
427 printf("%04d %04d %04d %04d %04d %04d %04d %04d %04d\n",
428 u16MaxR, u16MinR, u16MaxG, u16MinG, u16MaxB, u16MinB, ptAdcData.u16CH_AVG[0], ptAdcData.u16CH_AVG[1], ptAdcData.u16CH_AVG[2]);
429
430 printf("NumMaxCr NumMinCr NumMaxY NumMinY NumMaxCb NumMinCb AvgCr AvgY AvgCr\n");
431 printf("%04d %04d %04d %04d %04d %04d %04d %04d %04d\n\n",
432 u16NumMaxR, u16NumMinR, u16NumMaxG, u16NumMinG, u16NumMaxB, u16NumMinB, u16NoMinMaxAvgCr, u16NoMinMaxAvgY, u16NoMinMaxAvgCb);
433 #endif
434
435 #endif
436
437 return ptAdcData;
438 }
439
440 // TODO: Implemant Later
441 #if 0
442 void MDrv_Calibration_SetMirror( MS_BOOL bOnOff )
443 {
444 MS_U8 u8Bank;
445 MS_BOOL bInputEnable;
446
447
448 MDrv_WriteByte(BK_SELECT_00, REG_BANK_IP1F2);
449 bInputEnable = (MDrv_ReadRegBit( BK_SC_IP1F2_02_L, _BIT7)) ? TRUE : FALSE;
450
451 #if(ENABLE_CALIB_SCREEN_MUTE)
452 if( bInputEnable )
453 MDrv_XC_DisableInputSource(DISABLE);
454 #endif
455
456 if(bOnOff)
457 {
458 g_SrcInfo.u8SCStatus |= (SCSTATUS_H_MIRROR | SCSTATUS_V_MIRROR);
459 }
460 else
461 {
462 g_SrcInfo.u8SCStatus &= ~(SCSTATUS_H_MIRROR | SCSTATUS_V_MIRROR);
463 }
464
465 MDrv_Scaler_SetScalingRatio(gtSysVar.mbMpSrc, &g_DisplayWindowSetting);
466
467 MDrv_Scaler_SW_DB();
468
469 #if(ENABLE_CALIB_SCREEN_MUTE)
470 if( bInputEnable )
471 MDrv_XC_DisableInputSource(ENABLE);
472 #endif
473 }
474 #endif
475 #if 0 // TODO: Implement Later
476 static void MDrv_Calibration_SetSCMiu(MS_U8 u8miuNum)
477 {
478 // enable freeze
479 Hal_SC_set_freezeimg(ENABLE, MAIN_WINDOW);
480 g_bDoCalibration = ((u8miuNum == 0) ? TRUE : FALSE);
481
482 MDrv_MIU_ChangeScalerMIUNumber(u8miuNum);
483
484 MDrv_SC_set_fetch_number_limit( &gSrcInfo[MAIN_WINDOW], MAIN_WINDOW );
485 MDrv_SC_sw_db( &stDBreg, MAIN_WINDOW );
486
487 // disable freeze
488 Hal_SC_set_freezeimg(DISABLE, MAIN_WINDOW);
489 MsOS_DelayTask(CALIBRATION_DELAY_TIME); //change MIU delay to avoid garbage image
490 }
491 #endif
492
MApi_XC_ReadRgbData(void * pInstance,MS_IMAGE_MEM_INFO * pMemInfo)493 void MApi_XC_ReadRgbData(void *pInstance, MS_IMAGE_MEM_INFO * pMemInfo)
494 {
495 MS_PIXEL_32BIT sMemBuf[(pMemInfo->eCal_Win_Size.u16Xsize)*(pMemInfo->eCal_Win_Size.u16Ysize)];
496 memset(&sMemBuf, 0 , sizeof(sMemBuf) );
497 FB_DBG(printf("x=%u, y=%u, xsize=%u, ysize=%u\n",pMemInfo->eCal_Win_Size.u16X,pMemInfo->eCal_Win_Size.u16Y,
498 pMemInfo->eCal_Win_Size.u16Xsize,pMemInfo->eCal_Win_Size.u16Ysize));
499 Hal_SC_set_freezeimg(pInstance, ENABLE, MAIN_WINDOW);
500
501 pMemInfo->pixelAverage = MDrv_XC_GetAverageData(pInstance, sMemBuf, pMemInfo->eCal_Win_Size, MAIN_WINDOW);
502 Hal_SC_set_freezeimg(pInstance, DISABLE, MAIN_WINDOW);
503 }
504
MApi_XC_ReadVOPData(void * pInstance,MS_IMAGE_MEM_INFO * pMemInfo)505 void MApi_XC_ReadVOPData(void *pInstance, MS_IMAGE_MEM_INFO * pMemInfo)
506 {
507 MS_PIXEL_32BIT sMemBuf[(pMemInfo->eCal_Win_Size.u16Xsize)*(pMemInfo->eCal_Win_Size.u16Ysize)];
508 memset(&sMemBuf, 0 , sizeof(sMemBuf) );
509 FB_DBG(printf("x=%u, y=%u, xsize=%u, ysize=%u\n",pMemInfo->eCal_Win_Size.u16X,pMemInfo->eCal_Win_Size.u16Y,
510 pMemInfo->eCal_Win_Size.u16Xsize,pMemInfo->eCal_Win_Size.u16Ysize));
511 Hal_SC_set_freezeimg(pInstance, ENABLE, MAIN_WINDOW);
512 MApi_XC_Rerout_for_Capture_VOP_Data(pInstance);
513 pMemInfo->pixelAverage = MDrv_XC_GetAverageData(pInstance, sMemBuf, pMemInfo->eCal_Win_Size, MAIN_WINDOW);
514 Hal_SC_set_freezeimg(pInstance, DISABLE, MAIN_WINDOW);
515
516 }
517
518
519