예제 #1
0
static int prev2resz_ioc_set_config(struct prev2resz_fhdl *fh)
{
	struct isp_node *pipe = &fh->pipe;
	int rval, rest;

	if (pipe->in.image.pixelformat != V4L2_PIX_FMT_SBGGR16 &&
	    pipe->in.image.pixelformat != V4L2_PIX_FMT_SGRBG10DPCM8) {
		pipe->in.image.bytesperline = (pipe->in.image.width * 2) & ~63;
		rest = (pipe->in.image.width * 2) % 64;
	} else {
		pipe->in.image.bytesperline =  pipe->in.image.width & ~63;
		rest = pipe->in.image.width % 64;
	}
	/* ISP Previewer memory input must be aligned of 64 bytes */
	pipe->in.crop.left		+= rest / 2;
	pipe->in.crop.width		-= rest / 2;

	/* Setup parameters for Previewer input */
	fh->prev.in			= pipe->in;
	fh->prev.in.path		= PRV_RAW_MEM;
	/* Setup parameters for Previewer output */
	fh->prev.out			= pipe->in;
	fh->prev.out.path		= PREVIEW_RSZ;
	fh->prev.out.image.pixelformat	= pipe->out.image.pixelformat;
	/* Previewer output is 16 bits data and must be aligned of 32 bytes */
	fh->prev.out.image.bytesperline =
				(fh->prev.out.image.width * 2) & ~31;
	rest = (fh->prev.out.image.width * 2) % 32;
	fh->prev.out.crop.left		+= rest / 2;
	fh->prev.out.crop.width		-= rest / 2;

	/* Try Previwer input and output size */
	rval = isppreview_try_pipeline(fh->isp_prev, &fh->prev);
	if (rval != 0)
		return rval;
	/* Update return parameters */
	pipe->in.crop = fh->prev.out.crop;

	/* Setup parameters for Resizer input */
	fh->resz.in			= fh->prev.out;
	fh->resz.in.path			= RSZ_OTFLY_YUV;
	fh->resz.in.image.width		= fh->prev.out.crop.width;
	fh->resz.in.image.height	= fh->prev.out.crop.height;
	fh->resz.in.image.pixelformat	= pipe->out.image.pixelformat;
	/* Setup parameters for Resizer output */
	fh->resz.out			= pipe->out;
	fh->resz.out.path		= RSZ_MEM_YUV;
	fh->resz.out.image.pixelformat	= pipe->out.image.pixelformat;

	/* Try Resizer input and output size */
	rval = ispresizer_try_pipeline(fh->isp_resz, &fh->resz);
	if (rval != 0)
		return rval;
	/* Update return parameters */
	pipe->out = fh->resz.out;

	return 0;
}
예제 #2
0
/**
 * ispresizer_config_size - Configures input and output image size.
 * @pipe: Resizer data path parameters.
 *
 * Configures the appropriate values stored in the isp_res structure in the
 * resizer registers.
 *
 * Returns 0 if successful, or -EINVAL if passed values haven't been verified
 * with ispresizer_try_size() previously.
 **/
int ispresizer_s_pipeline(struct isp_res_device *isp_res,
			  struct isp_node *pipe)
{
	struct device *dev = to_device(isp_res);
	int bpp = ISP_BYTES_PER_PIXEL;

	ispresizer_set_source(isp_res, pipe->in.path);
	ispresizer_set_intype(isp_res, pipe->in.path);
	ispresizer_set_start_phase(dev, NULL);
	ispresizer_set_luma_enhance(dev, NULL);

	if (pipe->in.image.pixelformat == V4L2_PIX_FMT_YUYV)
		ispresizer_config_ycpos(isp_res, 1);
	else
		ispresizer_config_ycpos(isp_res, 0);

	ispresizer_try_pipeline(isp_res, pipe);

	ispresizer_set_ratio(dev, isp_res->h_resz, isp_res->v_resz);
	ispresizer_set_coeffs(dev, NULL, isp_res->h_resz, isp_res->v_resz);

	/* Switch filter, releated to up/down scale */
	if (ispresizer_is_upscale(pipe))
		ispresizer_enable_cbilin(isp_res, 1);
	else
		ispresizer_enable_cbilin(isp_res, 0);

	/* Set input and output size */
	ispresizer_set_input_size(dev, isp_res->phy_rect.width,
				  isp_res->phy_rect.height);
	ispresizer_set_output_size(dev, pipe->out.image.width,
				   pipe->out.image.height);

	/* Set input address and line offset address */
	if (pipe->in.path != RSZ_OTFLY_YUV) {
		/* Set the input address, plus calculated crop offset */
		ispresizer_set_inaddr(isp_res, isp_res->in_buff_addr, pipe);
		/* Set the input line offset/length */
		ispresizer_set_in_offset(isp_res, pipe->in.image.bytesperline);
	} else {
		/* Set the input address.*/
		ispresizer_set_inaddr(isp_res, 0, NULL);
		/* Set the starting pixel offset */
		ispresizer_set_start(dev, isp_res->phy_rect.left * bpp,
				     isp_res->phy_rect.top);
		ispresizer_set_in_offset(isp_res, 0);
	}

	/* Set output line offset */
	ispresizer_set_out_offset(isp_res, pipe->out.image.bytesperline);

	return 0;
}
예제 #3
0
파일: ispdss.c 프로젝트: kapoloclubs/diana
/**
  * ispdss_configure - configure the Resizer parameters
  * @params: Structure containing the Resizer Wrapper parameters
  * @callback: callback function to call after resizing is over
  * @arg1: argument to callback function
  *
  * This function can be called from DSS to set the parameter of resizer
  * in case there is need to downsize the input image through resizer
  * before calling this function calling driver must already have called
  * ispdss_get_resource() function so that necessory initialization is over.
  * Returns 0 if successful,
  **/
int ispdss_configure(struct isp_node *pipe, ispdss_callback callback,
		  u32 num_video_buffers, void *arg1)
{
	struct isp_device *isp = dev_get_drvdata(dev_ctx.isp);
	struct isp_res_device *isp_res = &isp->isp_res;

	/* the source always is memory */
	if (pipe->in.image.pixelformat == V4L2_PIX_FMT_YUYV ||
	    pipe->in.image.pixelformat == V4L2_PIX_FMT_UYVY)
		pipe->in.path = RSZ_MEM_YUV;
	else
		pipe->in.path = RSZ_MEM_COL8;

	if (ispresizer_try_pipeline(isp_res, pipe) != 0)
		return -EINVAL;

	dev_ctx.callback = callback;
	dev_ctx.num_video_buffers = num_video_buffers;
	dev_ctx.config_state = STATE_CONFIGURED;

	return 0;
}