Beispiel #1
0
int jpeg_dec_vidioc_g_fmt(struct file *file, void *priv,
			     struct v4l2_format *f)
{
	struct jpeg_ctx *ctx = priv;
	struct v4l2_pix_format_mplane *pixm;
	struct jpeg_dec_param *dec_param = &ctx->param.dec_param;
	unsigned int width, height;

	pixm = &f->fmt.pix_mp;

	pixm->field	= V4L2_FIELD_NONE;

	if (f->type == V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE) {
		pixm->pixelformat = dec_param->in_fmt;
		pixm->num_planes = dec_param->in_plane;
		pixm->width = dec_param->in_width;
		pixm->height = dec_param->in_height;
	} else if (f->type == V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE) {
		jpeg_get_frame_size(ctx->dev->reg_base, &width, &height);
		pixm->pixelformat =
			dec_param->out_fmt;
		pixm->num_planes = dec_param->out_plane;
		pixm->width = width;
		pixm->height = height;
	} else {
		v4l2_err(&ctx->dev->v4l2_dev,
			"Wrong buffer/video queue type (%d)\n", f->type);
	}

	return 0;
}
Beispiel #2
0
int jpeg_exe_dec(struct jpeg_control *ctrl)
{

	jpeg_start_decode(ctrl->reg_base);

	if (interruptible_sleep_on_timeout(&ctrl->wq, INT_TIMEOUT) == 0)
		jpeg_err("waiting for interrupt is timeout\n");


	if (ctrl->irq_ret != OK_ENC_OR_DEC) {
		jpeg_err("jpeg decode error(%d)\n", ctrl->irq_ret);
		return -1;
	}

	jpeg_get_frame_size(ctrl->reg_base,
		&ctrl->dec_param.width, &ctrl->dec_param.height);

	ctrl->dec_param.in_fmt = jpeg_get_stream_fmt(ctrl->reg_base);

	jpeg_info("decode img in_fmt(%d) width(%d) height(%d)\n",
			ctrl->dec_param.in_fmt , ctrl->dec_param.width,
			ctrl->dec_param.height);
	return 0;
}