Exemplo n.º 1
0
/** util_bcc_cmd_debug:
 *    @cmd: Pointer to statistic configuration.
 *
 * Print mce configuration.
 *
 * This function executes in ISP thread context
 *
 * Return none.
 **/
static void util_bcc_cmd_debug(ISP_DemosaicDBCC_CmdType *cmd)
{
  ISP_DBG(ISP_MOD_BCC, "%s: cmd->fminThreshold = %d \n", __func__, cmd->fminThreshold);
  ISP_DBG(ISP_MOD_BCC, "%s: cmd->fmaxThreshold = %d \n", __func__, cmd->fmaxThreshold);
  ISP_DBG(ISP_MOD_BCC, "%s: cmd->rOffsetHi = %d \n", __func__, cmd->rOffsetHi);
  ISP_DBG(ISP_MOD_BCC, "%s: cmd->rOffsetLo = %d \n", __func__, cmd->rOffsetLo);
  ISP_DBG(ISP_MOD_BCC, "%s: cmd->bOffsetHi = %d \n", __func__, cmd->bOffsetHi);
  ISP_DBG(ISP_MOD_BCC, "%s: cmd->bOffsetLo = %d \n", __func__, cmd->bOffsetLo);
  ISP_DBG(ISP_MOD_BCC, "%s: cmd->grOffsetHi = %d \n", __func__, cmd->grOffsetHi);
  ISP_DBG(ISP_MOD_BCC, "%s: cmd->grOffsetLo = %d \n", __func__, cmd->grOffsetLo);
  ISP_DBG(ISP_MOD_BCC, "%s: cmd->gbOffsetHi = %d \n", __func__, cmd->gbOffsetHi);
  ISP_DBG(ISP_MOD_BCC, "%s: cmd->gbOffsetLo = %d \n", __func__, cmd->gbOffsetLo);
} /* util_bcc_cmd_debug */
Exemplo n.º 2
0
/** sce_set_bestshot
 *    @mod: module instance data
 *    @pix_settings: pix data
 *    @in_param_size: parameter size
 *
 *  Sets configures SCE module according bestshot mode.
 **/
static int sce_set_bestshot(isp_sce_mod_t *mod,
  isp_hw_pix_setting_params_t *pix_settings, uint32_t in_param_size)
{
  int rc = 0;
  isp_mod_set_enable_t tEnable;

  if (in_param_size != sizeof(isp_hw_pix_setting_params_t)) {
    CDBG_ERROR("%s: size mismatch, expecting = %d, received = %d", __func__,
      sizeof(isp_mod_set_enable_t), in_param_size);
    return -1;
  }

  ISP_DBG(ISP_MOD_SCE, "%s: Bestshot mode: %d", __func__, pix_settings->bestshot_mode);
  switch (pix_settings->bestshot_mode) {
  case CAM_SCENE_MODE_PORTRAIT:
  case CAM_SCENE_MODE_PARTY:
  case CAM_SCENE_MODE_THEATRE:
  case CAM_SCENE_MODE_AUTO: {
    tEnable.enable = TRUE;
    rc = sce_enable(mod, &tEnable, sizeof(isp_mod_set_enable_t));
    if (rc != 0) {
      ISP_DBG(ISP_MOD_SCE, "%s: cannot enable SCE", __func__);
      break;
    }
    rc = sce_trigger_enable(mod, &tEnable, sizeof(isp_mod_set_enable_t));
    if (rc != 0) {
      ISP_DBG(ISP_MOD_SCE, "%s: cannot enable trigger", __func__);
    }
  }
    break;

  default:
    tEnable.enable = TRUE;

    /* we have to restore the neutral skin factor */
    mod->sce_adjust_factor = 0;
    rc = sce_enable(mod, &tEnable, sizeof(isp_mod_set_enable_t));
    if (rc != 0) {
      ISP_DBG(ISP_MOD_SCE, "%s: cannot disable SCE", __func__);
      break;
    }
    rc = sce_trigger_enable(mod, &tEnable, sizeof(isp_mod_set_enable_t));
    if (rc != 0)
      ISP_DBG(ISP_MOD_SCE, "%s: cannot disable trigger", __func__);

    break;
  }

  return rc;
}
Exemplo n.º 3
0
/** bcc_config
 *    @mod: bcc module control strcut
 *    @in_params: contains chromatix ptr
 *    @in_param_size: in params struct size
 *
 *  bcc module configuration initial settings
 *
 * Return: 0 - success and negative value - failure
 **/
static int bcc_config(isp_bcc_mod_t *mod,
  isp_hw_pix_setting_params_t *in_params, uint32_t in_param_size)
{
  int  rc = 0;
  chromatix_parms_type *chromatix_ptr =
    (chromatix_parms_type *)in_params->chromatix_ptrs.chromatixPtr;
  chromatix_BPC_type *chromatix_BPC =
    &chromatix_ptr->chromatix_VFE.chromatix_BPC;

  if (in_param_size != sizeof(isp_hw_pix_setting_params_t)) {
    /* size mismatch */
    CDBG_ERROR("%s: size mismatch, expecting = %d, received = %d",
      __func__, sizeof(isp_hw_pix_setting_params_t), in_param_size);
    return -1;
  }

  ISP_DBG(ISP_MOD_BCC, "%s: enter", __func__);

  if (!mod->enable) {
    ISP_DBG(ISP_MOD_BCC, "%s: Mod not Enable.", __func__);
    return rc;
  }

  if ((chromatix_BPC->bcc_Fmin > chromatix_BPC->bcc_Fmax) ||
      (chromatix_BPC->bcc_Fmin_lowlight > chromatix_BPC->bcc_Fmax_lowlight)) {
    CDBG_ERROR("%s: Error min>max: %d/%d; %d/%d\n", __func__,
      chromatix_BPC->bcc_Fmin, chromatix_BPC->bcc_Fmax,
      chromatix_BPC->bcc_Fmin_lowlight, chromatix_BPC->bcc_Fmax_lowlight);
    return -1;
  }

  /* set old cfg to invalid value to trigger the first trigger update */
  mod->old_streaming_mode = CAM_STREAMING_MODE_MAX;

  mod->p_params.p_input_offset =
    &(chromatix_BPC->bcc_4_offset[BPC_NORMAL_LIGHT]);
  mod->p_params.Fmin = chromatix_BPC->bcc_Fmin;
  mod->p_params.Fmax = chromatix_BPC->bcc_Fmax;

  util_bcc_cmd_config(mod);

  mod->enable = TRUE;
  mod->trigger_enable = TRUE;
  mod->aec_ratio = 0;
  mod->skip_trigger = FALSE;
  mod->hw_update_pending = TRUE;

  return rc;
} /* bcc_config */
Exemplo n.º 4
0
/** bf_stats_do_hw_update:
 *    @entry: Pointer to entry struct for bf stats
 *
 *  Method called at SOF, writes the value in reg_cmd to HW register
 *
 *
 *  Return 0 on Success, negative on ERROR
 **/
static int bf_stats_do_hw_update(isp_stats_entry_t *entry)
{
  int rc = 0;
  ISP_StatsBf_CfgCmdType *pcmd = entry->reg_cmd;
  struct msm_vfe_cfg_cmd2 cfg_cmd;
  struct msm_vfe_reg_cfg_cmd reg_cfg_cmd[1];

  ISP_DBG(ISP_MOD_STATS, "%s: E, hw_update = %d\n", __func__, entry->hw_update_pending);
  vfe_bf_stats_debug(pcmd);
  if (entry->hw_update_pending) {
    cfg_cmd.cfg_data = (void *)entry->reg_cmd;
    cfg_cmd.cmd_len = sizeof(ISP_StatsBf_CfgCmdType);
    cfg_cmd.cfg_cmd = (void *) reg_cfg_cmd;
    cfg_cmd.num_cfg = 1;

    reg_cfg_cmd[0].u.rw_info.cmd_data_offset = 0;
    reg_cfg_cmd[0].cmd_type = VFE_WRITE;
    reg_cfg_cmd[0].u.rw_info.reg_offset = BF_STATS_OFF;
    reg_cfg_cmd[0].u.rw_info.len = BF_STATS_LEN * sizeof(uint32_t);

    rc = ioctl(entry->fd, VIDIOC_MSM_VFE_REG_CFG, &cfg_cmd);
    if (rc < 0){
      CDBG_ERROR("%s: HW update error, rc = %d", __func__, rc);
      return rc;
    }

    entry->hw_update_pending = 0;
  }

  return rc;
}
Exemplo n.º 5
0
/** color_correct_set_bestshot:
 *    @mod: pointer to instance private data
 *    @in_params: input data
 *    @in_params_size: size of input data
 *
 * Set scene.
 *
 * This function executes in ISP thread context
 *
 * Return 0 on success.
 **/
static int color_correct_set_bestshot(isp_color_correct_mod_t *mod,
  isp_hw_pix_setting_params_t *in_params, uint32_t in_param_size)
{
  cam_scene_mode_type mode = in_params->bestshot_mode;

  mod->skip_trigger = FALSE;

  if (in_param_size != sizeof(isp_hw_pix_setting_params_t)) {
    /* size mismatch */
    CDBG_ERROR("%s: size mismatch, expecting = %d, received = %d",
      __func__, sizeof(isp_hw_pix_setting_params_t), in_param_size);
    return -1;
  }

  ISP_DBG(ISP_MOD_COLOR_CORRECT, "%s: mode %d", __func__, mode);
  switch (mode) {
  case CAM_SCENE_MODE_NIGHT:
    mod->final_table = mod->table.chromatix_yhi_ylo_color_correction;
    break;
  default:
    mod->final_table = mod->table.chromatix_TL84_color_correction;
    break;
  }
  mod->hw_update_pending = TRUE;
  return 0;
} /* color_correct_set_bestshot */
Exemplo n.º 6
0
/*===========================================================================
 * FUNCTION    - linearization_config -
 *
 * DESCRIPTION:
 *==========================================================================*/
static int linearization_config(isp_linear_mod_t *linear_mod, isp_hw_pix_setting_params_t *pix_settings,
                                uint32_t in_param_size)
{
    int  rc = 0;
    uint32_t i;
    chromatix_VFE_common_type *pchromatix_common =
        (chromatix_VFE_common_type *)pix_settings->chromatix_ptrs.chromatixComPtr;
    chromatix_L_type *pchromatix_L =
        &pchromatix_common->chromatix_L;

    ISP_DBG(ISP_MOD_LINEARIZATION , "%s\n",__func__);

    if (in_param_size != sizeof(isp_hw_pix_setting_params_t)) {
        /* size mismatch */
        CDBG_ERROR("%s: size mismatch, expecting = %d, received = %d",
                   __func__, sizeof(isp_hw_pix_setting_params_t), in_param_size);
        return -1;
    }

    config_linearization_cmd(linear_mod,
                             &(pchromatix_L->linear_table_TL84_normal));

    linear_mod->hw_update_pending = TRUE;
    linear_mod->prev_cct_type = AWB_CCT_TYPE_TL84;
    linear_mod->prev_lux = LINEAR_AEC_NORMAL;
    linear_mod->old_streaming_mode = CAM_STREAMING_MODE_MAX;
    linear_mod-> prev_lux_idx = 0;

    linear_mod->hw_update_pending = TRUE;

    return rc;
}
Exemplo n.º 7
0
/** color_correct_set_effect:
 *    @mod: pointer to instance private data
 *    @in_params: input data
 *    @in_params_size: size of input data
 *
 * Set effect.
 *
 * This function executes in ISP thread context
 *
 * Return 0 on success.
 **/
static int color_correct_set_effect(isp_color_correct_mod_t *mod,
  isp_hw_pix_setting_params_t *in_params, uint32_t in_param_size)
{
  int type;
  float s;
  if (in_param_size != sizeof(isp_hw_pix_setting_params_t)) {
    /* size mismatch */
    CDBG_ERROR("%s: size mismatch, expecting = %d, received = %d",
      __func__, sizeof(isp_hw_pix_setting_params_t), in_param_size);
    return -1;
  }

  if (!mod->enable) {
    ISP_DBG(ISP_MOD_COLOR_CORRECT, "%s: CC not enabled", __func__);
    return 0;
  }
  type = in_params->effects.effect_type_mask;
  SET_UNITY_MATRIX(mod->effects_matrix, 3);
  if (type & (1 << ISP_EFFECT_SATURATION)) {
    s = 2.0 * in_params->effects.saturation;
    if (F_EQUAL(in_params->effects.hue, 0))
      util_color_correct_populate_matrix(mod->effects_matrix, s);
  }
  if (type & (1 << ISP_EFFECT_HUE)) {
    s = 2.0 * in_params->effects.hue;
    if (!F_EQUAL(in_params->effects.saturation, .5))
      util_color_correct_populate_matrix(mod->effects_matrix, s);
  }
  mod->hw_update_pending = TRUE;
  return 0;
} /*color_correct_set_effect*/
Exemplo n.º 8
0
/** ihist_stats_trigger_enable:
 *    @entry: Pointer to entry struct of ihist stats
 *    @in_params: Input params
 *
 *  Set the trigger enable
 *
 *
 *  Return 0 on Success, negative on ERROR
 **/
static int ihist_stats_trigger_enable(isp_stats_entry_t *entry,
  isp_mod_set_enable_t *in_params)
{
  ISP_DBG(ISP_MOD_STATS, "%s: trigger_enable = %d\n", __func__, in_params->enable);
  entry->trigger_enable = in_params->enable;
  return 0;
}
Exemplo n.º 9
0
/** sce_do_hw_update
 *
 * description: sce_do_hw_update
 *
 **/
static int sce_do_hw_update(isp_sce_mod_t *sce_mod)
{
  int i, rc = 0;
  struct msm_vfe_cfg_cmd2 cfg_cmd;
  struct msm_vfe_reg_cfg_cmd reg_cfg_cmd[1];

  ISP_DBG(ISP_MOD_SCE, "%s: E: hw_update = %d\n", __func__, sce_mod->hw_update_pending);
  if (sce_mod->hw_update_pending) {
    cfg_cmd.cfg_data = (void *) &sce_mod->sce_cmd;
    cfg_cmd.cmd_len = sizeof(sce_mod->sce_cmd);
    cfg_cmd.cfg_cmd = (void *) reg_cfg_cmd;
    cfg_cmd.num_cfg = 1;

    reg_cfg_cmd[0].u.rw_info.cmd_data_offset = 0;
    reg_cfg_cmd[0].cmd_type = VFE_WRITE;
    reg_cfg_cmd[0].u.rw_info.reg_offset = ISP_SCE40_OFF;
    reg_cfg_cmd[0].u.rw_info.len = ISP_SCE40_LEN * sizeof(uint32_t);

    //isp_sce_debug(&sce_mod);
    rc = ioctl(sce_mod->fd, VIDIOC_MSM_VFE_REG_CFG, &cfg_cmd);
    if (rc < 0){
      CDBG_ERROR("%s: HW update error, rc = %d", __func__, rc);
      return rc;
    }
    sce_mod->sce_cmd = sce_mod->applied_sce_cmd;
    sce_mod->hw_update_pending = 0;
  }
  return rc;
}
Exemplo n.º 10
0
/** isp44_util_get_awb_cct_type
 *
 *    @trigger:
 *    @chromatix_ptr:
 *
 **/
static awb_cct_type isp44_util_get_awb_cct_type(cct_trigger_info* trigger,
  void *chromatix_ptr)
{
  chromatix_parms_type *p_chromatix = chromatix_ptr;
  awb_cct_type cct_type = AWB_CCT_TYPE_TL84;

  ISP_DBG(ISP_MOD_COM,"%s: CCT %f D65 %f %f A %f %f", __func__,
    trigger->mired_color_temp,
    trigger->trigger_d65.mired_end,
    trigger->trigger_d65.mired_start,
    trigger->trigger_A.mired_start,
    trigger->trigger_A.mired_end);

  if (trigger->mired_color_temp <= trigger->trigger_d65.mired_end) {
    cct_type = AWB_CCT_TYPE_D65;
  } else if ((trigger->mired_color_temp > trigger->trigger_d65.mired_end) &&
             (trigger->mired_color_temp <= trigger->trigger_d65.mired_start)) {
    cct_type = AWB_CCT_TYPE_D65_TL84;
  } else if ((trigger->mired_color_temp >= trigger->trigger_A.mired_start) &&
             (trigger->mired_color_temp < trigger->trigger_A.mired_end)) {
    cct_type = AWB_CCT_TYPE_TL84_A;
  } else if (trigger->mired_color_temp >= trigger->trigger_A.mired_end) {
    cct_type = AWB_CCT_TYPE_A;
  }
  /* else its TL84*/

  return cct_type;
} /*isp_util_get_awb_cct_type*/
Exemplo n.º 11
0
/** color_xform_action
 *    @mod_ctrl: xform module control struct
 *    @action_code : action code
 *    @data: not used
 *    @data_size: not used
 *
 *  processing the hw action like update or reset
 *
 * Return: 0 - success and negative value - failure
 **/
static int color_xform_action (void *mod_ctrl, uint32_t action_code, void *data,
  uint32_t data_size)
{
  int rc = 0;
  isp_color_xform_mod_t *mod = mod_ctrl;

  switch (action_code) {
  case ISP_HW_MOD_ACTION_HW_UPDATE: {
    rc = color_xform_do_hw_update(mod);
  }
    break;

  case ISP_HW_MOD_ACTION_RESET: {
    color_xform_reset(mod);
  }
    break;

  default: {
    /* no op */
    ISP_DBG(ISP_MOD_COLOR_XFORM, "%s: action code = %d is not supported. nop",
      __func__, action_code);
    rc = 0;
  }
    break;
  }

  return rc;
} /* color_xform_action */
Exemplo n.º 12
0
/** color_conversion_set_chromatix:
 *
 *    @mod:
 *    @in_params:
 *    @in_param_size:
 *
 * set chromatix info to modules
 *
 **/
static int color_conversion_set_chromatix(isp_color_conversion_mod_t *mod,
  isp_hw_pix_setting_params_t *in_params, uint32_t in_param_size)
{
  if (in_param_size != sizeof(isp_hw_pix_setting_params_t)) {
    /* size mismatch */
    CDBG_ERROR("%s: size mismatch, expecting = %d, received = %d",
         __func__, sizeof(isp_hw_pix_setting_params_t), in_param_size);
    return -1;
  }

  chromatix_parms_type *chromatix_ptr =
    in_params->chromatix_ptrs.chromatixPtr;
  chromatix_CV_type *chromatix_CV_ptr =
      &chromatix_ptr->chromatix_VFE.chromatix_CV;

  ISP_DBG(ISP_MOD_COLOR_CONV, "%s:", __func__);
  SET_UNITY_MATRIX(mod->effects_matrix, 2);

  mod->cv_data = chromatix_CV_ptr->TL84_color_conversion;
  mod->p_cv = &chromatix_CV_ptr->TL84_color_conversion;

  mod->hw_update_pending = TRUE;

  return 0;
}
Exemplo n.º 13
0
/** bf_stats_get_params:
 *    @ctrl: Pointer to entry (ctrl) struct
 *    @param_id: event id indicating what param to get
 *    @in_params: input params
 *    @in_param_size: Size of Input Params
 *    @out_params: output params
 *    @out_param_size: size of output params
 *
 *  Get value of parameter given by param id
 *
 *
 *  Return 0 for Success, negative if ERROR
 **/
static int bf_stats_get_params (void *ctrl, uint32_t param_id,
                     void *in_params, uint32_t in_param_size,
                     void *out_params, uint32_t out_param_size)
{
  isp_stats_entry_t *entry = ctrl;
  int rc = 0;

  ISP_DBG(ISP_MOD_STATS, "%s: param_id = %d\n", __func__, param_id);
  switch (param_id) {
  case ISP_STATS_GET_ENABLE:
    break;
  case ISP_STATS_GET_STREAM_STATE:
    break;
  case ISP_STATS_GET_PARSED_STATS:
    break;
  case ISP_STATS_GET_STREAM_HANDLE:{
    uint32_t *handle = (uint32_t *) (out_params);
    *handle = entry->stream_handle;
    break;
  }
  default:
    break;
  }
  return rc;
}
/*===========================================================================
FUNCTION      isp_tintless_update_chromatix_params

DESCRIPTION   Update the tintless related chromatix tuning parameters.
===========================================================================*/
static tintless_return_t isp_tintless_bg_pca_update_chromatix_params(
   void * const res, chromatix_color_tint_correction_type * p)
{
    tintless_return_t rc;
    tintless_cfg_t param;
    tintless_lib_t * const tintless_lib = (tintless_lib_t *) res;

    ISP_DBG(ISP_MOD_ROLLOFF,"%s: chromatix : strength %d",__func__,
               p->tint_correction_strength);

    if (tintless_lib == NULL || tintless_lib->init_func == NULL)
    {
        rc = TINTLESS_LIB_NOT_LOADED;
    } else {
        param.chromatix = p;
        if (tintless_lib->updates & ( 1 << UPDATES_CHROMATIX_PARAMS)) {
            rc = isp_tintless_config(tintless_lib, UPDATES_CHROMATIX_PARAMS, param);
            CDBG_ERROR("%s: lib returned config err=%d", __func__, rc);
        } else {
            CDBG_ERROR("%s: chromatix parameter updates not needed", __func__);
            rc = TINTLESS_UPDATES_NOT_SUPPORTED;
        }
    }

    return rc;
} /* isp_tintless_update_chromatix_params */
Exemplo n.º 15
0
/** color_conversion_config:
 *
 *    @mod:
 *    @in_params:
 *    @in_param_size:
 *
 * configure initial settings
 *
 **/
static int color_conversion_config(isp_color_conversion_mod_t *mod, isp_hw_pix_setting_params_t *in_params, uint32_t in_param_size)
{
  int  rc = 0;
  chromatix_parms_type *chromatix_ptr =
    (chromatix_parms_type *)in_params->chromatix_ptrs.chromatixPtr;
  chromatix_CV_type *chromatix_CV_ptr =
      &chromatix_ptr->chromatix_VFE.chromatix_CV;

  if (in_param_size != sizeof(isp_hw_pix_setting_params_t)) {
    /* size mismatch */
    CDBG_ERROR("%s: size mismatch, expecting = %d, received = %d",
      __func__, sizeof(isp_hw_pix_setting_params_t), in_param_size);
    return -1;
  }

  ISP_DBG(ISP_MOD_COLOR_CONV, "%s: enter", __func__);

  if (!mod->enable) {
    CDBG_HIGH("%s: Mod not Enable.", __func__);
    return rc;
  }

  /* set old cfg to invalid value to trigger the first trigger update */
  SET_UNITY_MATRIX(mod->effects_matrix, 2);
  mod->cv_data = chromatix_CV_ptr->TL84_color_conversion;
  mod->p_cv = &(chromatix_CV_ptr->TL84_color_conversion);

  util_color_conversion_cmd_config(mod);
  mod->hw_update_pending = TRUE;

  return rc;
} /* color_conversion_config */
Exemplo n.º 16
0
/** clf_enable:
 *    @mod: CLF module instance
 *    @enable: true if module is to be enabled
 *    @in_param_size: enable parameter size
 *
 *  This function runs in ISP HW thread context.
 *
 *  This function enables CLF module
 *
 *  Return:   0 - Success
 *           -1 - Parameters size mismatch
 **/
static int clf_enable(isp_clf_mod_t *mod,
  isp_mod_set_enable_t *enable, uint32_t in_param_size)
{
  if (in_param_size != sizeof(isp_mod_set_enable_t)) {
    /* size mismatch */
  CDBG_ERROR("%s: size mismatch, expecting = %d, received = %d",
      __func__, sizeof(isp_mod_set_enable_t), in_param_size);

    return -1;
  }

  mod->lf_enable = mod->cf_enable = mod->enable = enable->enable;

  int clf_enable = IS_CLF_ENABLED(mod);
  ISP_DBG(ISP_MOD_CLF, "%s: clf_enable %d", __func__, clf_enable);

  if (!clf_enable)
    /* disable both modules */
    mod->lf_enable = mod->cf_enable = FALSE;
  else
    mod->lf_enable = mod->cf_enable = TRUE;

  if (!mod->enable)
      mod->hw_update_pending = 0;

  return 0;
} /* clf_enable */
Exemplo n.º 17
0
/** port_isp_send_event_to_peer
 *   @data1: mct port instance
 *   @user_data: mct event
 *
 *  This method sends event to peer modules
 *
 *  Return: TRUE always!
 **/
static boolean port_isp_send_event_to_peer(void *data1, void *user_data)
{
  mct_port_t *mct_port = (mct_port_t *)data1;
  mct_event_t *event = (mct_event_t *)user_data;
  isp_port_t *isp_port = (isp_port_t * )mct_port->port_private;
  isp_stream_t *stream = NULL;
  isp_stream_t **streams = NULL;
  int i;
  uint32_t identity;
  boolean rc = FALSE;

  ISP_DBG(ISP_MOD_COM,"%s: E, event type %d direction %d\n", __func__,
       event->type, event->direction);
  if (isp_port->state == ISP_PORT_STATE_CREATED) {
    /* not used port */
    ISP_DBG(ISP_MOD_COM,"%s: X\n", __func__);
    return TRUE;
  }
  if (mct_port->direction == MCT_PORT_SINK) {
    isp_sink_port_t *sink_port = &isp_port->u.sink_port;
    streams = sink_port->streams;
  } else if (mct_port->direction == MCT_PORT_SRC) {
    isp_src_port_t *src_port = &isp_port->u.src_port;
    streams = src_port->streams;
  } else {
    ISP_DBG(ISP_MOD_COM,"%s: X\n", __func__);
    return TRUE;
  }

  for (i = 0; i < ISP_MAX_STREAMS; i++) {
    stream = streams[i];
    if (stream == NULL)
      continue;
    identity = pack_identity(stream->session_id, stream->stream_id);
    if (identity != (uint32_t)event->identity)
      continue;
    rc = mct_port->peer->event_func(mct_port->peer, event);
    if (rc == FALSE) {
      CDBG_ERROR("%s: direction= %d event = %d rc = FALSE\n", __func__,
        mct_port->direction, event->type);
      return rc;
    }
    break;
  }
  ISP_DBG(ISP_MOD_COM,"%s: X\n", __func__);
  return TRUE;
}
Exemplo n.º 18
0
/** color_conversion_set_bestshot:
 *
 *    @mod:
 *    @in_params:
 *    @in_param_size:
 *
 * Set BestShot mode
 *
 **/
static int color_conversion_set_bestshot(isp_color_conversion_mod_t *mod,
  isp_hw_pix_setting_params_t *in_params, uint32_t in_param_size )
{
  if (in_param_size != sizeof(isp_hw_pix_setting_params_t)) {
    CDBG_ERROR("%s: size mismatch, expecting = %d, received = %d",
      __func__, sizeof(isp_hw_pix_setting_params_t), in_param_size);
    return -1;
  }

  chromatix_parms_type *chroma_ptr =
    in_params->chromatix_ptrs.chromatixPtr;
  chromatix_CV_type *chromatix_CV_ptr = &chroma_ptr->chromatix_VFE.chromatix_CV;
  ASD_struct_type *ASD_algo_ptr = &chroma_ptr->ASD_algo_data;
  cam_scene_mode_type bestshot_mode = in_params->bestshot_mode;
  float s = 0.0;
  int status= 0;

  mod->trigger_enable = TRUE;
  ISP_DBG(ISP_MOD_COLOR_CONV, "%s: mode %d\n", __func__, bestshot_mode);
  SET_UNITY_MATRIX(mod->effects_matrix, 2);
  switch (bestshot_mode) {
  case CAM_SCENE_MODE_THEATRE:
  case CAM_SCENE_MODE_CANDLELIGHT:
  case CAM_SCENE_MODE_SUNSET: {
    mod->cv_data = ASD_algo_ptr->sunset_color_conversion;
  }
    break;

  case CAM_SCENE_MODE_FIREWORKS: {
    /* from WB need to check */
    mod->cv_data = chromatix_CV_ptr->daylight_color_conversion;
  }
    break;

  case CAM_SCENE_MODE_FLOWERS:
  case CAM_SCENE_MODE_PARTY: {
    /* apply required saturation */
    s = chromatix_CV_ptr->saturated_color_conversion_factor;
    /* Just update color conversion matrix in this case */
    SET_UNITY_MATRIX(mod->effects_matrix, 2);
    SET_SAT_MATRIX(mod->effects_matrix, s);
  }
    break;

  case CAM_SCENE_MODE_PORTRAIT:
  case CAM_SCENE_MODE_NIGHT_PORTRAIT:
  default: {
    mod->cv_data = chromatix_CV_ptr->TL84_color_conversion;
    mod->trigger_enable = FALSE;
  }
    break;
  }

  util_color_conversion_cmd_config(mod);
  util_color_conversion_cmd_debug(mod);
  mod->hw_update_pending = TRUE;

  return status;
} /* color_conversion_set_bestshot */
Exemplo n.º 19
0
/** port_isp_destroy_ports
 *   @isp: isp instance
 *
 *  Destroy all created isp ports
 *
 *  Returns nothing
 **/
static void port_isp_destroy_ports(isp_t *isp)
{
  ISP_DBG(ISP_MOD_COM,"%s: E\n", __func__);
  if (isp->module->sinkports) {
    mct_list_traverse(isp->module->sinkports,
              port_isp_free_mem_func, NULL);
    mct_list_free_list(isp->module->sinkports);
    isp->module->sinkports= NULL;
  }
  if (isp->module->srcports) {
    mct_list_traverse(isp->module->srcports,
              port_isp_free_mem_func, NULL);
    mct_list_free_list(isp->module->srcports);
    isp->module->srcports= NULL;
  }
  ISP_DBG(ISP_MOD_COM,"%s: X\n", __func__);
}
Exemplo n.º 20
0
/** isp_pipeline44_read_dmi_tbl
 *
 *    @pipeline:
 *
 **/
static int isp_pipeline44_read_dmi_tbl(void *pipeline_ptr,
  isp_hw_read_info *dmi_read_info, void *dump_entry)
{
   int rc = 0;
   isp_pipeline_t *pipeline = (isp_pipeline_t *)pipeline_ptr;

   if (dmi_read_info->is_kernel_dump == 1) {
      ISP_DBG(ISP_MOD_COM,"%s: dump kernel DMI\n", __func__);
      rc = isp_pipeline44_read_dmi_tbl_kernel(pipeline,
        dmi_read_info, dump_entry);
   } else {
      ISP_DBG(ISP_MOD_COM,"%s: dump USERSPACE DMI\n", __func__);
      rc = isp_pipeline44_read_dmi_tbl_user(pipeline,
        dmi_read_info, dump_entry);
   }

  return rc;
}
Exemplo n.º 21
0
/** ihist_stats_enable:
 *    @entry: Pointer to entry struct
 *    @in_params: input params with enable value
 *
 *  Enable the ihist stats module
 *
 *
 * Return 0 on Success, negative on ERROR
 **/
static int ihist_stats_enable(isp_stats_entry_t *entry,
  isp_mod_set_enable_t *in_params)
{
  ISP_DBG(ISP_MOD_STATS, "%s: enable = %d\n", __func__, in_params->enable);
  entry->enable = in_params->enable;
  /* after enable the first stats is corrupted */
  entry->is_first = 1;
  return 0;
}
Exemplo n.º 22
0
/** util_clf_luma_debug:
 *    @p_cmd: Luma Filter configuration
 *
 *  This function runs in ISP HW thread context.
 *
 *  This function dumps the CLF luma configuration
 *
 *  Return: None
 **/
static void util_clf_luma_debug(ISP_CLF_Luma_Update_CmdType* p_cmd)
{
  int i = 0;
  ISP_DBG(ISP_MOD_CLF, "%s: CLF Luma cutoff1: %d cutoff2: %d cutoff3: %d\n",
    __func__, p_cmd->Cfg.cutoff_1, p_cmd->Cfg.cutoff_2, p_cmd->Cfg.cutoff_3);
  ISP_DBG(ISP_MOD_CLF, "%s: mult_neg %d mult_pos %d\n",
    __func__, p_cmd->Cfg.mult_neg, p_cmd->Cfg.mult_pos);

  for (i=0; i<8; i++)
    ISP_DBG(ISP_MOD_CLF, "%s: posLUT%d %d posLUT%d %d", __func__,
      2*i, p_cmd->pos_LUT[i].lut0,
      2*i+1, p_cmd->pos_LUT[i].lut1);

  for (i=0; i<4; i++)
    ISP_DBG(ISP_MOD_CLF, "%s: negLUT%d %d negLUT%d %d", __func__,
      2*i, p_cmd->neg_LUT[i].lut0,
      2*i+1, p_cmd->neg_LUT[i].lut1);
} /* util_clf_luma_debug */
Exemplo n.º 23
0
/** sce_find_intersection:
 *    @line1: first line
 *    @line2: second line
 *    @t: parameter for intersection point in first line
 *
 *  This function runs in ISP HW thread context.
 *
 *  This function finds a intersection between two lines and return its position
 *  in first line by parameter.
 *
 *  Return:  TRUE  - lines are intersecting
 *           FALSE - lines are parallel
 *
 **/
static boolean sce_find_intersection(ISP_Skin_enhan_line *line1,
  ISP_Skin_enhan_line *line2, double* t)
{
  double t2;
  /* check if one of the lines is either vertical or horizontal */
  /* Assumptions according SCE documentation:
     - lines are not matching:
        One of the line is crossing center of pentagon and other is one
        of its sides
     - none of the points belong to neither axis (cb and cr does not equal 0)
     - no line can have both shift_cr and shift_cb equal to 0
   */
  if ((FLOAT_EQ((line2->shift_cb * line1->shift_cr -
      line1->shift_cb * line2->shift_cr), 0)) ||
      ((FLOAT_EQ(line1->shift_cr, 0) && FLOAT_EQ(line2->shift_cr, 0)))){
    /* Lines are parallel */

    ISP_DBG(ISP_MOD_SCE, "%s: parallel lines", __func__);
    return FALSE;
  }

  if(FLOAT_EQ(line1->shift_cr, 0)) {
    *t =  ((line1->point0.cr - line2->point0.cr) * line2->shift_cb +
          (line2->point0.cb - line1->point0.cb) * line2->shift_cr) /
          (line1->shift_cb * line2->shift_cr - line2->shift_cb * line1->shift_cr);
    t2  = (line1->point0.cr - line2->point0.cr + line1->shift_cr * *t) /
          line2->shift_cr;
  } else {
    t2 =  ((line2->point0.cr - line1->point0.cr) * line1->shift_cb +
          (line1->point0.cb - line2->point0.cb) * line1->shift_cr) /
          (line2->shift_cb * line1->shift_cr - line1->shift_cb * line2->shift_cr);
    *t =  (line2->point0.cr - line1->point0.cr + line2->shift_cr * t2) /
          line1->shift_cr;
  }

  if ((t2 < 0) || (t2 > 1)){
    /* Lines intersect outside poligon */
    ISP_DBG(ISP_MOD_SCE, "%s: outside intersection", __func__);
    return FALSE;
  }

  return TRUE;
}
Exemplo n.º 24
0
/** port_isp_create_ports
 *   @isp: isp instance
 *
 *  Creates all the necessary isp ports like 3A, data and sink
 *
 *  Returns 0 for success and negative error for failure
 **/
int port_isp_create_ports(isp_t *isp)
{
  int i;
  int rc = 0;
  ISP_DBG(ISP_MOD_COM,"%s: E\n", __func__);
  rc = port_isp_create_sink_ports(isp);
  if (rc == 0)
    rc = port_isp_create_src_ports(isp, ISP_SRC_PORT_3A);
  /*if (rc == 0)
    rc = isp_create_src_ports(isp, ISP_SRC_PORT_IMAGING);*/
  if (rc == 0)
    rc = port_isp_create_src_ports(isp, ISP_SRC_PORT_DATA);

end:
  if (rc < 0)
    port_isp_destroy_ports(isp);
  ISP_DBG(ISP_MOD_COM,"%s: X rc %d\n", __func__, rc);
  return rc;
}
Exemplo n.º 25
0
/** color_conversion_set_spl_effect:
 *
 *    @mod:
 *    @in_params:
 *    @in-param_size:
 *
 * Set special effect
 *
 **/
static int color_conversion_set_spl_effect(isp_color_conversion_mod_t *mod,
  isp_hw_pix_setting_params_t *in_params, uint32_t in_param_size)
{
  if (in_param_size != sizeof(isp_hw_pix_setting_params_t)) {
    CDBG_ERROR("%s: size mismatch, expecting = %d, received = %d",
      __func__, sizeof(isp_hw_pix_setting_params_t), in_param_size);
    return -1;
  }

  chromatix_parms_type *chroma_ptr =
    in_params->chromatix_ptrs.chromatixPtr;
  chromatix_CV_type *chromatix_CV_ptr =
    &chroma_ptr->chromatix_VFE.chromatix_CV;
  int status= 0;
  cam_effect_mode_type effects =
    (cam_effect_mode_type) in_params->effects.spl_effect;
  mod->trigger_enable = FALSE;
  ISP_DBG(ISP_MOD_COLOR_CONV, "%s: apply %d", __func__, effects);
  /* reset hue/saturation */
  SET_UNITY_MATRIX(mod->effects_matrix, 2);

  switch(effects) {
  case CAM_EFFECT_MODE_EMBOSS:
  case CAM_EFFECT_MODE_MONO: {
    mod->cv_data = chromatix_CV_ptr->mono_color_conversion;
  }
    break;

  case CAM_EFFECT_MODE_NEGATIVE: {
    mod->cv_data = chromatix_CV_ptr->negative_color_conversion;
  }
    break;

  case CAM_EFFECT_MODE_SEPIA: {
    mod->cv_data = chromatix_CV_ptr->sepia_color_conversion;
  }
    break;

  case CAM_EFFECT_MODE_AQUA: {
    mod->cv_data = chromatix_CV_ptr->aqua_color_conversion;
  }
    break;

  default: {
    mod->cv_data = chromatix_CV_ptr->TL84_color_conversion;
    mod->trigger_enable = TRUE;
  }
    break;
  }

  util_color_conversion_cmd_config(mod);
  mod->hw_update_pending = TRUE;

  return status;
} /* util_color_conversion_set_spl_effect */
Exemplo n.º 26
0
/** port_isp_unlink_func
 *   @identity: contains session_id and stream_id
 *   @port: mct port instance
 *   @peer: peer port instance
 *
 *  Unlinking with external ports
 *
 *  Returns TRUE for success and FALSE on failure
 **/
static void port_isp_unlink_func(unsigned int identity, mct_port_t *port,
  mct_port_t *peer)
{
  int ret = 0;
  isp_port_t *tmp_port = (isp_port_t *)port->port_private;
  isp_t *isp = (isp_t *)tmp_port->isp;
  ISP_DBG(ISP_MOD_COM,"%s: E, identity = 0x%x, port = %p, direction = %d\n",
       __func__, identity, port, port->direction);

  pthread_mutex_lock(&isp->mutex);
  if (port->direction == MCT_PORT_SRC)
    ret = isp_unlink_src_port(isp, tmp_port, peer,
            UNPACK_SESSION_ID(identity), UNPACK_STREAM_ID(identity));
  else
    ret = isp_unlink_sink_port(isp, tmp_port, peer,
            UNPACK_SESSION_ID(identity), UNPACK_STREAM_ID(identity));
  pthread_mutex_unlock(&isp->mutex);
  ISP_DBG(ISP_MOD_COM,"%s: X, ret = %d, identity = 0x%x, port = %p, direction = %d\n",
       __func__, ret, identity, port, port->direction);
}
Exemplo n.º 27
0
/** sce_reorder_triangles
 *
 * Description:  reorder the triangles by default chromatix
 *               triangels
 *
 **/
static void sce_reorder_triangles(isp_sce_mod_t *sce_mod, isp_hw_pix_setting_params_t *pix_settings)
{
  chromatix_parms_type *p_chx =
    (chromatix_parms_type *)pix_settings->chromatix_ptrs.chromatixPtr;
  chromatix_SCE_type *p_sce = &p_chx->chromatix_VFE.chromatix_SCE;
  sce_mod->origin_triangles_A = p_sce->origin_triangles_A;
  sce_mod->origin_triangles_D65 = p_sce->origin_triangles_D65;
  sce_mod->origin_triangles_TL84 = p_sce->origin_triangles_TL84;

  ISP_DBG(ISP_MOD_SCE, "%s:\n", __func__);
}
Exemplo n.º 28
0
/** demux_get_params:
 *    @mod_ctrl: demux module instance
 *    @param_id: parameter id
 *    @in_params: input parameter data
 *    @in_param_size: input parameter size
 *    @out_params: output parameter data
 *    @out_param_size: output parameter size
 *
 *  This function runs in ISP HW thread context.
 *
 *  This function gets a parameter from demux module
 *
 *  Return:   0 - Success
 *            Negative - paramter get error
 **/
static int demux_get_params (void *mod_ctrl, uint32_t param_id,
                     void *in_params, uint32_t in_param_size,
                     void *out_params, uint32_t out_param_size)
{
  isp_demux_mod_t *demux_mod = mod_ctrl;
  int rc = 0;

  switch (param_id) {
  case ISP_HW_MOD_GET_MOD_ENABLE: {
    isp_mod_get_enable_t *enable = out_params;

    if (sizeof(isp_mod_get_enable_t) != out_param_size) {
      CDBG_ERROR("%s: error, out_param_size mismatch, param_id = %d",
                 __func__, param_id);
      break;
    }

    enable->enable = demux_mod->enable;
  }
    break;

  case ISP_HW_MOD_GET_APPLIED_DIG_GAIN:{
    isp_hw_mode_get_applied_dig_gain_t *demux_dig_gain = out_params;
    demux_dig_gain->applied_dig_gain = demux_mod->dig_gain;
  }
    break;

  case ISP_HW_MOD_GET_VFE_DIAG_INFO_USER: {
    vfe_diagnostics_t *vfe_diag = (vfe_diagnostics_t *)out_params;
    demuxchannelgain_t *gain;
    if (sizeof(vfe_diagnostics_t) != out_param_size) {
      CDBG_ERROR("%s: error, out_param_size mismatch, param_id = %d",
        __func__, param_id);
      break;
    }
    gain = &(vfe_diag->prev_demuxchannelgain);
    if(demux_mod->old_streaming_mode == CAM_STREAMING_MODE_BURST) {
        gain = &(vfe_diag->snap_demuxchannelgain);
    }
    vfe_diag->control_demux.enable = demux_mod->enable;
    vfe_diag->control_demux.cntrlenable = demux_mod->trigger_enable;
    demux_ez_isp_update(demux_mod, gain);
    /*Populate vfe_diag data*/
    ISP_DBG(ISP_MOD_DEMUX, "%s: Populating vfe_diag data", __func__);
  }
    break;

  default:
    rc = -EPERM;
    break;
  }

  return rc;
} /* demux_get_params */
Exemplo n.º 29
0
/** demux_config:
 *    @demux: demux module instance
 *    @in_params: configuration parameters
 *    @size: configuration parameters size
 *
 *  This function runs in ISP HW thread context.
 *
 *  This function makes initial configuration of demux module
 *
 *  Return:   0 - Success
 *           -1 - Parameters size mismatch
 **/
static int demux_config(isp_demux_mod_t *demux,
  isp_hw_pix_setting_params_t *pix_settings, uint32_t in_param_size)
{
  chromatix_parms_type *chromatix_ptr =
    pix_settings->chromatix_ptrs.chromatixPtr;
  AEC_algo_struct_type *AEC_algo_data = &chromatix_ptr->AEC_algo_data;
  ISP_DemuxConfigCmdType* p_cmd = &demux->ISP_DemuxConfigCmd;
  demux->dig_gain = 1.0;
  demux->remaining_digital_gain = 1.0;

  ISP_DBG(ISP_MOD_DEMUX, "%s: E\n", __func__);

  if (pix_settings->camif_cfg.is_bayer_sensor) {
    INIT_GAIN(demux->gain, AEC_algo_data->color_correction_global_gain);
  } else {
    INIT_GAIN(demux->gain, 1.0);
  }

  INIT_GAIN(demux->r_gain, 1.0);

  demux_set_cfg_parms(p_cmd, pix_settings->camif_cfg.sensor_output_fmt);
  ISP_DBG(ISP_MOD_DEMUX, "%s: sensor input format : %d \n", __func__,
       pix_settings->camif_cfg.sensor_output_fmt);

  ISP_DBG(ISP_MOD_DEMUX, "%s:gain: gr_odd = %5.2f, gr_even = %5.2f, red = %5.2f blue = %5.2f ",
    __func__, demux->gain.green_odd, demux->gain.green_even, demux->gain.red,
    demux->gain.blue);

  p_cmd->ch0EvenGain = DEMUX_GAIN(demux->gain.green_even);
  p_cmd->ch0OddGain = DEMUX_GAIN(demux->gain.green_odd);
  p_cmd->ch1Gain = DEMUX_GAIN(demux->gain.blue);
  p_cmd->ch2Gain = DEMUX_GAIN(demux->gain.red);
  /* 3D is not supported. */
  if (demux->is_3d) {
    demux_r_image_gain_update(demux);
  }

  demux->hw_update_pending = TRUE;

  return 0;
} /* demux_config */
Exemplo n.º 30
0
/** isp44_util_get_cds_trigger_pts:
 *    @pipeline_ptr: pointer to pipeline dependency data
 *    @enable
 * Free private resources.
 *
 * Return none.
 **/
static void isp44_util_get_params(void *in_params, uint32_t in_params_size,
  uint32_t param_id, void* out_param, uint32_t out_params_size, void *ctrl)
{
  ISP_DBG(ISP_MOD_COM,"%s:E, param_id %d", __func__, param_id);
  switch (param_id) {
  case ISP_PIPELINE_GET_CDS_TRIGGER_VAL: {
    modulesChromatix_t *chromatix_ptr = (modulesChromatix_t *)in_params;
    isp_uv_subsample_t *uv_subsample_ctrl = (isp_uv_subsample_t *)out_param;
    if (NULL != uv_subsample_ctrl) {
      /*
      chromatix_parms_type *chromatixPtr = NULL;
      chromatix_CDS_type *chromatix_CDS = NULL;
      if(chromatix_ptr)
       chromatixPtr = (chromatix_parms_type *)chromatix_ptr->chromatixPtr;
      if(chromatixPtr)
        chromatix_CDS = &chromatixPtr->chromatix_post_processing
        .chromatix_chroma_sub_sampling;
      if(!chromatix_CDS) {
        uv_subsample_ctrl->trigger_A = 0;
        uv_subsample_ctrl->trigger_B = 0;
      } else {
      */
        uv_subsample_ctrl->trigger_A = 300;
        /*chromatix_CDS->lux_index_trigger_value_A;*/
        uv_subsample_ctrl->trigger_B = 330;
        /*chromatix_CDS->lux_index_trigger_value_B;*/
      /*}*/
      ISP_DBG(ISP_MOD_COM,"%s: chromatix %x got trigger A= %ld, B= %ld ", __func__,
        (unsigned int)chromatix_ptr, uv_subsample_ctrl->trigger_A,
        uv_subsample_ctrl->trigger_B);
    }
  }
    break;

  default: {
    ISP_DBG(ISP_MOD_COM,"%s: param_id %d not supported ", __func__, param_id);
  }
    break;
  }
  return;
}