⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 isp_device_if.c

📁 最新MTK手机软件源码
💻 C
📖 第 1 页 / 共 5 页
字号:
/*****************************************************************************
*  Copyright Statement:
*  --------------------
*  This software is protected by Copyright and the information contained
*  herein is confidential. The software may not be copied and the information
*  contained herein may not be used or disclosed except with the written
*  permission of MediaTek Inc. (C) 2005
*
*  BY OPENING THIS FILE, BUYER HEREBY UNEQUIVOCALLY ACKNOWLEDGES AND AGREES
*  THAT THE SOFTWARE/FIRMWARE AND ITS DOCUMENTATIONS ("MEDIATEK SOFTWARE")
*  RECEIVED FROM MEDIATEK AND/OR ITS REPRESENTATIVES ARE PROVIDED TO BUYER ON
*  AN "AS-IS" BASIS ONLY. MEDIATEK EXPRESSLY DISCLAIMS ANY AND ALL WARRANTIES,
*  EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
*  MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR NONINFRINGEMENT.
*  NEITHER DOES MEDIATEK PROVIDE ANY WARRANTY WHATSOEVER WITH RESPECT TO THE
*  SOFTWARE OF ANY THIRD PARTY WHICH MAY BE USED BY, INCORPORATED IN, OR
*  SUPPLIED WITH THE MEDIATEK SOFTWARE, AND BUYER AGREES TO LOOK ONLY TO SUCH
*  THIRD PARTY FOR ANY WARRANTY CLAIM RELATING THERETO. MEDIATEK SHALL ALSO
*  NOT BE RESPONSIBLE FOR ANY MEDIATEK SOFTWARE RELEASES MADE TO BUYER'S
*  SPECIFICATION OR TO CONFORM TO A PARTICULAR STANDARD OR OPEN FORUM.
*
*  BUYER'S SOLE AND EXCLUSIVE REMEDY AND MEDIATEK'S ENTIRE AND CUMULATIVE
*  LIABILITY WITH RESPECT TO THE MEDIATEK SOFTWARE RELEASED HEREUNDER WILL BE,
*  AT MEDIATEK'S OPTION, TO REVISE OR REPLACE THE MEDIATEK SOFTWARE AT ISSUE,
*  OR REFUND ANY SOFTWARE LICENSE FEES OR SERVICE CHARGE PAID BY BUYER TO
*  MEDIATEK FOR SUCH MEDIATEK SOFTWARE AT ISSUE. 
*
*  THE TRANSACTION CONTEMPLATED HEREUNDER SHALL BE CONSTRUED IN ACCORDANCE
*  WITH THE LAWS OF THE STATE OF CALIFORNIA, USA, EXCLUDING ITS CONFLICT OF
*  LAWS PRINCIPLES.  ANY DISPUTES, CONTROVERSIES OR CLAIMS ARISING THEREOF AND
*  RELATED THERETO SHALL BE SETTLED BY ARBITRATION IN SAN FRANCISCO, CA, UNDER
*  THE RULES OF THE INTERNATIONAL CHAMBER OF COMMERCE (ICC).
*
*****************************************************************************/

/*****************************************************************************
 *
 * Filename:
 * ---------
 *   isp_device_if.c
 *
 * Project:
 * --------
 *   MT6226,MT6227,MT6228,MT6229
 *
 * Description:
 * ------------
 *   These are interface with FT for CCT/DeviceTool
 *
 * Author:
 * -------
 *
 *   UW Wang (mtk01051)
 *
 *============================================================================
 *             HISTORY
 * Below this line, this part is controlled by PVCS VM. DO NOT MODIFY!!
 *------------------------------------------------------------------------------
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 *------------------------------------------------------------------------------
 * Upper this line, this part is controlled by PVCS VM. DO NOT MODIFY!!
 *============================================================================
 ****************************************************************************/
#if defined(ISP_SUPPORT)
#include "drv_comm.h"
#include "stdio.h"
#include "string.h"
#include "IntrCtrl.h"
#include "jpeg.h"
#include "lcd_if.h"
#include "lcd_sw.h"
#include "lcd_sw_inc.h"
#include "visual_comm.h"
#include "img_comm.h"
#include "visualhisr.h"
#include "isp_if.h"
#include "image_sensor.h"
#include "ae_awb.h"
#include "resizer.h"
#include "camera_para.h"
#include "isp_cct_if.h"
#include "med_api.h"
#include "isp_device_if.h"
#include "af.h"

#if (!defined(MT6219))

extern kal_eventgrpid camera_isp_event_id;
extern ae_lut_info_struct lut_info;
extern kal_uint32  avgall_lum;
/* AE bypass free run mode parameters */
kal_bool    ae_enable_flag_restore;          // for restore ae flag

/*************************************************
 * INFO Interface 
 **************************************************/
/* Mode support get/update function (for MMI/Manu) */
dsc_info_struct *isp_device_get_dsc_info(void ) 
{
	return &dsc_support_info;
}				
	
/* AE/FlashLight device info get/update function (for AE/FlashLight) */	
device_info_struct *isp_device_get_device_info(void) 
{
	return &device_support_info;
}

/* Iris device support get/update function (for AE) */	
void isp_device_get_iris_info(kal_bool iris[AV_NO])
{
	memcpy(iris, aperture_pri_info, AV_NO*sizeof(kal_bool));
}

void isp_device_set_iris_info(const kal_bool iris[AV_NO])
{
	memcpy(aperture_pri_info, iris, AV_NO*sizeof(kal_bool));
}

/*************************************************
 * AE Interface 	
 **************************************************/
/*
 * use get_ae_lut to get ae table:
 *	const exposure_lut_struct *get_ae_lut(ae_lut_info_struct info);
 *	const kal_uint8 *get_iris_lut(ae_lut_info_struct info);
*/

/* 
 * AE Verify Functions 
 * Set AE to some idx by mode
 * Tool will adject LSB and take a picture with idx (repeat from idx=min_idx~max_idx) 
 */
kal_uint8 isp_device_set_ae_EV(ae_lut_info_struct ae_lut_info, kal_uint16 EV)
{
	kal_uint8 idx;
	
	if(EV<device_support_info.ae.minEv)
		ASSERT(0);
	if(device_support_info.ae.step==0)
		ASSERT(0);
	idx = (EV-device_support_info.ae.minEv)/device_support_info.ae.step;
	return isp_device_set_ae_idx(ae_lut_info, idx);
}

kal_uint8 isp_device_set_ae_idx(ae_lut_info_struct ae_lut_info, kal_uint8 idx)
{	
    kal_uint32 save_irq_mask;
    
	save_irq_mask=SaveAndSetIRQMask();    
    ae_enable_flag_restore  = ae_enable_flag;		
    ae_on_off(KAL_FALSE);
	RestoreIRQMask(save_irq_mask);    
	
	/* Load AE Table */
	AE_LUT=get_ae_lut(ae_lut_info);	
	image_sensor_func->set_sensor_eshutter(AE_LUT[idx].shutter);
	image_sensor_func->set_sensor_gain(AE_LUT[idx].sensorgain);
	isp_pregain = AE_LUT[idx].ispgain;
	ae_set_isp_pregain();
	
	save_irq_mask=SaveAndSetIRQMask();    	
    ae_on_off(ae_enable_flag_restore);      	
	RestoreIRQMask(save_irq_mask);        
	return KAL_TRUE;
}

kal_uint8 isp_device_set_ae_value(kal_uint32 shutter, kal_uint32 sensorgain, kal_uint32 ispgain)
{
    kal_uint32 save_irq_mask;
    
	save_irq_mask=SaveAndSetIRQMask();        
    ae_enable_flag_restore  = ae_enable_flag;	
    ae_on_off(KAL_FALSE);
	RestoreIRQMask(save_irq_mask);    
	    
	/* Load AE Table */
	image_sensor_func->set_sensor_eshutter((kal_uint16)shutter);
	image_sensor_func->set_sensor_gain((kal_uint16)sensorgain);
	isp_pregain = (kal_uint8)ispgain;
	ae_set_isp_pregain();	
	
	save_irq_mask=SaveAndSetIRQMask();        
    ae_on_off(ae_enable_flag_restore);      		
	RestoreIRQMask(save_irq_mask);        
	return KAL_TRUE;	
}

void set_ae_period_data(const camera_ae_period_para_struct *period_data)
{
    kal_uint32 save_irq_mask;
    
	save_irq_mask=SaveAndSetIRQMask();        
    ae_enable_flag_restore  = ae_enable_flag;	
    ae_on_off(KAL_FALSE);
	RestoreIRQMask(save_irq_mask);    
    
	// Update AE Period
	camera_oper_data.ae_awb_cal_period = period_data->ae_awb_cal_period;
	camera_oper_data.ae_setting_gain_delay_frame = period_data->ae_setting_gain_delay_frame;
	camera_oper_data.ae_setting_sensor_gain_delay_frame = period_data->ae_setting_sensor_gain_delay_frame;
	camera_oper_data.ae_setting_shut_delay_frame = period_data->ae_setting_shut_delay_frame;
	camera_oper_data.ae_setting_cal_delay_frame = period_data->ae_setting_cal_delay_frame;            

	save_irq_mask=SaveAndSetIRQMask();        
    ae_on_off(ae_enable_flag_restore);      		
	RestoreIRQMask(save_irq_mask);        	
}

void get_ae_period_data(camera_ae_period_para_struct *period_data)
{
	period_data->ae_awb_cal_period = camera_oper_data.ae_awb_cal_period;
	period_data->ae_setting_gain_delay_frame = camera_oper_data.ae_setting_gain_delay_frame;
	period_data->ae_setting_sensor_gain_delay_frame = camera_oper_data.ae_setting_sensor_gain_delay_frame;
	period_data->ae_setting_shut_delay_frame = camera_oper_data.ae_setting_shut_delay_frame;
	period_data->ae_setting_cal_delay_frame = camera_oper_data.ae_setting_cal_delay_frame;            	
}

void ae_bypass_mode_on_off(kal_bool flag)
{
	ae_bypass_enable_flag=flag;
}
/*************************************************************************
* FUNCTION
*	isp_device_ae_bypass_freerun_process
*
* DESCRIPTION
*	This function is for free run ae but bypass ae cal
*	Before call this function, AE should be turned off.
*	After ae bypass ready, AE should be turn on again to active ae freerun
*
* PARAMETERS
*	freerun_para:	indicate free run dsc mode, idx range and delay time
*	freerun_result:	AE freerun result lum for each idx
*
* RETURNS
*	None
*
* GLOBALS AFFECTED
*
*************************************************************************/
kal_uint8 isp_device_ae_bypass_freerun_process( 
                    camera_ae_bypass_freerun_struct *freerun_para, 
                    camera_ae_bypass_freerun_result_struct *freerun_result )
{
    kal_uint32  curr_idx, ticks;
    ticks = ((freerun_para->timer_ms)*1000)/4615;
    
    ae_enable_flag_restore  = ae_enable_flag;
    AE_LUT = freerun_para->lut;	               /* Assign AE Table */   	
    IRIS_LUT = freerun_para->iris_lut;
    AE_BYPASS_INDEX = freerun_para->start_idx;  /* Set AE bypass Index */		
    
    ae_bypass_mode_on_off(KAL_TRUE);   
    ae_on_off(KAL_TRUE);                  
    for(curr_idx=freerun_para->start_idx; curr_idx<=freerun_para->end_idx; curr_idx++)
    {
        AE_BYPASS_INDEX = curr_idx; /* Set AE bypass Index */		
        kal_sleep_task(ticks);
        freerun_result->resultLum[curr_idx] = avgall_lum;
    }   
    ae_on_off(ae_enable_flag_restore);      
    ae_bypass_mode_on_off(KAL_FALSE);    
    return KAL_TRUE;
}

kal_uint32 get_lum_info(void)

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -