示例#1
0
文件: NScale.c 项目: jamieguinan/cti
static void y422p_handler(Instance *pi, void *data)
{
  NScale_private *priv = (NScale_private *)pi;
  YUV422P_buffer *y422p_in = data;

  if (pi->outputs[OUTPUT_YUV422P].destination) {

    if (priv->Nx == 1 && priv->Ny == 1) {
      /* Pass-through */
      PostData(y422p_in, pi->outputs[OUTPUT_YUV422P].destination);
      return;
    }

    /* else... */

    YUV422P_buffer *y422p_out = YUV422P_buffer_new(y422p_in->width/priv->Nx, y422p_in->height/priv->Ny,
                                               &y422p_in->c);
    N_scale(priv, y422p_in->y, y422p_in->width, y422p_in->height,
            y422p_out->y, y422p_out->width, y422p_out->height);
    N_scale(priv, y422p_in->cr, y422p_in->cr_width, y422p_in->cr_height,
            y422p_out->cr, y422p_out->cr_width, y422p_out->cr_height);
    N_scale(priv, y422p_in->cb, y422p_in->cb_width, y422p_in->cb_height,
            y422p_out->cb, y422p_out->cb_width, y422p_out->cb_height);
    dpf("posting %dx%d image to output\n", y422p_out->width, y422p_out->height);
    y422p_out->c.timestamp = y422p_in->c.timestamp;
    PostData(y422p_out, pi->outputs[OUTPUT_YUV422P].destination);
  }
  YUV422P_buffer_release(y422p_in);
}
long_flt_type Schechter_like_functor::operator()( const long_flt_type & in_param) const
{
	const flt_type & mag_jump_limit = 23.;

	const long_flt_type x = std::pow(10,0.4*(m_star()-in_param));
	long_flt_type result = 0.4*std::log(10.)*N_scale()*std::pow(x,alpha()+1)*
			std::exp(-std::pow(x,mag_lower_lim_sharpness()));

	if(in_param>=mag_jump_limit) result += mag23_jump();

	const long_flt_type xh = std::pow(10,0.4*(in_param-mag_upper_lim()));

	result *= std::exp(-std::pow(xh,mag_upper_lim_sharpness()));

	return result;
}