Exemple #1
0
void TI_GBCE_run(int enable)
{
#if 0 //add by sxh csl
    static int gbce_frameCnt = 0;
    static int enabled = FALSE;
    CSL_IpipeGbceConfig gbceConfig;

    if (gbce_frameCnt == 2)
    {
        if (enable)
        {
            Uint32 Htable[256], expo;
            int status, again;
            GBCE_ImageInputParamsStruct *gbceIIP =
                &(g_gbceHandle.imageInputParams);
            GBCE_ImageOutputParamsStruct *gbceIOP =
                &(g_gbceHandle.imageOutputParams);

            //read histogram, exposure, A gain, aperture
            CSL_ipipeHistogramReadIdleY(&gCSL_ipipeHndl, Htable);
            gbceIIP->InputTable = (int*)&Htable[0];

            status = DRV_imgsGetEshutter(&expo);
            gbceIIP->ExposureTime = expo;

            status |= DRV_imgsGetAgain(&again); //true_gain * 8
            gbceIIP->AnalogGain = again * (256 / 8);
            gbceIIP->Aperture = 0;

            GBCE_run(&g_gbceHandle);

            if (gbceIOP->gbceStatus == 1)
            {
                gbceConfig.enable = TRUE;
                gbceConfig.type = CSL_IPIPE_GBCE_METHOD_Y_VALUE;
                gbceConfig.gainTable = gbceIOP->ToneTable;
                CSL_ipipeSetGbceConfig(&gCSL_ipipeHndl, &gbceConfig);
                enabled = TRUE;
                //OSA_printf("\n\nDEBUG: GBCE ON\n\n");
            }
        }
        else
        {
            if (enabled)
            {
                enabled = FALSE;
                gbceConfig.enable = FALSE;
                gbceConfig.type = CSL_IPIPE_GBCE_METHOD_Y_VALUE;
                gbceConfig.gainTable = NULL;
                CSL_ipipeSetGbceConfig(&gCSL_ipipeHndl, &gbceConfig);
            }
        }
    }

    gbce_frameCnt++;
    if(gbce_frameCnt>=GBCE_APPLY_PERIOD)
      gbce_frameCnt = 0;

#endif
}
int IMAGE_TUNE_CmdExecuteIpipeGbce(IMAGE_TUNE_CmdInfo *cmdInfo, IMAGE_TUNE_CmdInfo *statusInfo)
{
    int retVal;
    CSL_IpipeGbceConfig *pPrm = &gIMAGE_TUNE_ctrl.curPrm.ipipePrm.gbce;
    Uint32 *pTable = gIMAGE_TUNE_ctrl.curPrm.ipipePrm.gbceTable;
    Uint32 prmSize = sizeof(*pPrm);
    Uint32 tableSize = sizeof(gIMAGE_TUNE_ctrl.curPrm.ipipePrm.gbceTable);
    Uint32 reqdPrmSize = prmSize + tableSize;

    if (cmdInfo->prmSize != reqdPrmSize)
    {
#ifdef IMAGE_TUNE_CMD_HANDLER_DEBUG
        OSA_printf(" IMAGE TUNE SERVER: Received parameter size (%d != %d) mismatch ERROR for CMD 0x%04x\n", cmdInfo->prmSize, reqdPrmSize, cmdInfo->commandId);
#endif
        return OSA_EFAIL;
    }

    memcpy(pPrm, cmdInfo->prm, prmSize);
    memcpy(pTable, (Uint8*)cmdInfo->prm + prmSize, tableSize);

    pPrm->gainTable = pTable;

    retVal =  CSL_ipipeSetGbceConfig(&gCSL_ipipeHndl, pPrm);

    return retVal;
}