您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ v4l_bound_align_image函数代码示例

51自学网 2021-06-03 09:30:21
  C++
这篇教程C++ v4l_bound_align_image函数代码示例写得很实用,希望能帮到您。

本文整理汇总了C++中v4l_bound_align_image函数的典型用法代码示例。如果您正苦于以下问题:C++ v4l_bound_align_image函数的具体用法?C++ v4l_bound_align_image怎么用?C++ v4l_bound_align_image使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。

在下文中一共展示了v4l_bound_align_image函数的27个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: rot_bound_align_image

void rot_bound_align_image(struct rot_ctx *ctx, struct rot_fmt *rot_fmt,			   u32 *width, u32 *height){	struct exynos_rot_variant *variant = ctx->rot_dev->variant;	struct exynos_rot_size_limit *limit = NULL;	switch (rot_fmt->pixelformat) {	case V4L2_PIX_FMT_YUV420M:		limit = &variant->limit_yuv420_3p;		break;	case V4L2_PIX_FMT_NV12M:		limit = &variant->limit_yuv420_2p;		break;	case V4L2_PIX_FMT_YUYV:		limit = &variant->limit_yuv422;		break;	case V4L2_PIX_FMT_RGB565:		limit =	&variant->limit_rgb565;		break;	case V4L2_PIX_FMT_RGB32:		limit = &variant->limit_rgb888;		break;	default:		break;	}	/* Bound an image to have width and height in limit */	v4l_bound_align_image(width, limit->min_x, limit->max_x,			limit->align, height, limit->min_y,			limit->max_y, limit->align, 0);}
开发者ID:danielyuan2015,项目名称:Exynos4412,代码行数:31,


示例2: myvivi_vidioc_try_fmt_vid_cap

//0.3 - 4 设置格式前肯定会先测试static int myvivi_vidioc_try_fmt_vid_cap(struct file *file, void *priv,			struct v4l2_format *f){	unsigned int maxw, maxh;		enum v4l2_field field;	//在枚举支持的格式时,我们只写明只支持V4L2_PIX_FMT_YUYV,所以下面只判断这个格式是否支持。	if(f->fmt.pix.pixelformat != V4L2_PIX_FMT_YUYV)		return -EINVAL;		field = f->fmt.pix.field;	if (field == V4L2_FIELD_ANY) {		field = V4L2_FIELD_INTERLACED;	} else if (V4L2_FIELD_INTERLACED != field) {		return -EINVAL;	}	maxw = 1024;	maxh = 768;	//高速format宽度和高度,计算每行占的字节数和整个图像的大小。	v4l_bound_align_image(&f->fmt.pix.width, 48, 2048, 2,			      &f->fmt.pix.height, 32, 1536, 0, 0);	f->fmt.pix.bytesperline =//每一行占的字节数		(f->fmt.pix.width * 16) >> 3;//depth表示颜色深度。这里直接写成16.	f->fmt.pix.sizeimage =//整个图像的大小		f->fmt.pix.height * f->fmt.pix.bytesperline;	return 0;}
开发者ID:NieHao,项目名称:drv,代码行数:29,


示例3: myvivi_vidioc_try_fmt_vid_cap

/*测试驱动程序是否支持某种格式*/static int myvivi_vidioc_try_fmt_vid_cap(struct file *file, void *priv,			struct v4l2_format *f){	unsigned int maxw, maxh;	enum v4l2_field field;	if(f->fmt.pix.pixelformat != V4L2_PIX_FMT_YUYV)		return -EINVAL;	field = f->fmt.pix.field;	if (field == V4L2_FIELD_ANY) {		field = V4L2_FIELD_INTERLACED;	} else if (V4L2_FIELD_INTERLACED != field) {		return -EINVAL;	}	maxw  = 1024;	maxh  = 768;	v4l_bound_align_image(&f->fmt.pix.width, 48, maxw, 2,			      &f->fmt.pix.height, 32, maxh, 0, 0);	f->fmt.pix.bytesperline =		(f->fmt.pix.width * 16) >> 3;	f->fmt.pix.sizeimage =		f->fmt.pix.height * f->fmt.pix.bytesperline;	return 0;}
开发者ID:wareash,项目名称:WDS_PRJ,代码行数:31,


示例4: __isp_subdev_try_format

static void __isp_subdev_try_format(struct fimc_isp *isp,				    struct v4l2_subdev_fh *fh,				    struct v4l2_subdev_format *fmt){	struct v4l2_mbus_framefmt *mf = &fmt->format;	struct v4l2_mbus_framefmt *format;	mf->colorspace = V4L2_COLORSPACE_SRGB;	if (fmt->pad == FIMC_ISP_SD_PAD_SINK) {		v4l_bound_align_image(&mf->width, FIMC_ISP_SINK_WIDTH_MIN,				FIMC_ISP_SINK_WIDTH_MAX, 0,				&mf->height, FIMC_ISP_SINK_HEIGHT_MIN,				FIMC_ISP_SINK_HEIGHT_MAX, 0, 0);		mf->code = V4L2_MBUS_FMT_SGRBG10_1X10;	} else {		if (fmt->which == V4L2_SUBDEV_FORMAT_TRY)			format = v4l2_subdev_get_try_format(fh,						FIMC_ISP_SD_PAD_SINK);		else			format = &isp->sink_fmt;		/* Allow changing format only on sink pad */		mf->width = format->width - FIMC_ISP_CAC_MARGIN_WIDTH;		mf->height = format->height - FIMC_ISP_CAC_MARGIN_HEIGHT;		if (fmt->pad == FIMC_ISP_SD_PAD_SRC_FIFO) {			mf->code = V4L2_MBUS_FMT_YUV10_1X30;			mf->colorspace = V4L2_COLORSPACE_JPEG;		} else {			mf->code = format->code;		}	}}
开发者ID:Astralix,项目名称:mainline-dss11,代码行数:34,


示例5: mtk_vcodec_enc_set_default_params

void mtk_vcodec_enc_set_default_params(struct mtk_vcodec_ctx *ctx){	struct mtk_q_data *q_data;	ctx->m2m_ctx->q_lock = &ctx->dev->dev_mutex;	ctx->fh.m2m_ctx = ctx->m2m_ctx;	ctx->fh.ctrl_handler = &ctx->ctrl_hdl;	INIT_WORK(&ctx->encode_work, mtk_venc_worker);	ctx->colorspace = V4L2_COLORSPACE_REC709;	ctx->ycbcr_enc = V4L2_YCBCR_ENC_DEFAULT;	ctx->quantization = V4L2_QUANTIZATION_DEFAULT;	ctx->xfer_func = V4L2_XFER_FUNC_DEFAULT;	q_data = &ctx->q_data[MTK_Q_DATA_SRC];	memset(q_data, 0, sizeof(struct mtk_q_data));	q_data->visible_width = DFT_CFG_WIDTH;	q_data->visible_height = DFT_CFG_HEIGHT;	q_data->coded_width = DFT_CFG_WIDTH;	q_data->coded_height = DFT_CFG_HEIGHT;	q_data->field = V4L2_FIELD_NONE;	q_data->fmt = &mtk_video_formats[OUT_FMT_IDX];	v4l_bound_align_image(&q_data->coded_width,				MTK_VENC_MIN_W,				MTK_VENC_MAX_W, 4,				&q_data->coded_height,				MTK_VENC_MIN_H,				MTK_VENC_MAX_H, 5, 6);	if (q_data->coded_width < DFT_CFG_WIDTH &&		(q_data->coded_width + 16) <= MTK_VENC_MAX_W)		q_data->coded_width += 16;	if (q_data->coded_height < DFT_CFG_HEIGHT &&		(q_data->coded_height + 32) <= MTK_VENC_MAX_H)		q_data->coded_height += 32;	q_data->sizeimage[0] =		q_data->coded_width * q_data->coded_height+		((ALIGN(q_data->coded_width, 16) * 2) * 16);	q_data->bytesperline[0] = q_data->coded_width;	q_data->sizeimage[1] =		(q_data->coded_width * q_data->coded_height) / 2 +		(ALIGN(q_data->coded_width, 16) * 16);	q_data->bytesperline[1] = q_data->coded_width;	q_data = &ctx->q_data[MTK_Q_DATA_DST];	memset(q_data, 0, sizeof(struct mtk_q_data));	q_data->coded_width = DFT_CFG_WIDTH;	q_data->coded_height = DFT_CFG_HEIGHT;	q_data->fmt = &mtk_video_formats[CAP_FMT_IDX];	q_data->field = V4L2_FIELD_NONE;	ctx->q_data[MTK_Q_DATA_DST].sizeimage[0] =		DFT_CFG_WIDTH * DFT_CFG_HEIGHT;	ctx->q_data[MTK_Q_DATA_DST].bytesperline[0] = 0;}
开发者ID:avagin,项目名称:linux,代码行数:58,


示例6: mt9v011_try_fmt

static int mt9v011_try_fmt(struct v4l2_subdev *sd, struct v4l2_format *fmt){	struct v4l2_pix_format *pix = &fmt->fmt.pix;	if (pix->pixelformat != V4L2_PIX_FMT_SGRBG8)		return -EINVAL;	v4l_bound_align_image(&pix->width, 48, 639, 1,			      &pix->height, 32, 480, 1, 0);	return 0;}
开发者ID:325116067,项目名称:semc-qsd8x50,代码行数:12,


示例7: mt9v011_try_mbus_fmt

static int mt9v011_try_mbus_fmt(struct v4l2_subdev *sd, struct v4l2_mbus_framefmt *fmt){	if (fmt->code != V4L2_MBUS_FMT_SGRBG8_1X8)		return -EINVAL;	v4l_bound_align_image(&fmt->width, 48, 639, 1,			      &fmt->height, 32, 480, 1, 0);	fmt->field = V4L2_FIELD_NONE;	fmt->colorspace = V4L2_COLORSPACE_SRGB;	return 0;}
开发者ID:125radheyshyam,项目名称:linux,代码行数:12,


示例8: v4l_bound_align_image

static const struct fimc_fmt *fimc_lite_subdev_try_fmt(struct fimc_lite *fimc,					struct v4l2_subdev_pad_config *cfg,					struct v4l2_subdev_format *format){	struct flite_drvdata *dd = fimc->dd;	struct v4l2_mbus_framefmt *mf = &format->format;	const struct fimc_fmt *fmt = NULL;	if (format->pad == FLITE_SD_PAD_SINK) {		v4l_bound_align_image(&mf->width, 8, dd->max_width,				ffs(dd->out_width_align) - 1,				&mf->height, 0, dd->max_height, 0, 0);		fmt = fimc_lite_find_format(NULL, &mf->code, 0, 0);		if (WARN_ON(!fmt))			return NULL;		mf->colorspace = fmt->colorspace;		mf->code = fmt->mbus_code;	} else {		struct flite_frame *sink = &fimc->inp_frame;		struct v4l2_mbus_framefmt *sink_fmt;		struct v4l2_rect *rect;		if (format->which == V4L2_SUBDEV_FORMAT_TRY) {			sink_fmt = v4l2_subdev_get_try_format(&fimc->subdev, cfg,						FLITE_SD_PAD_SINK);			mf->code = sink_fmt->code;			mf->colorspace = sink_fmt->colorspace;			rect = v4l2_subdev_get_try_crop(&fimc->subdev, cfg,						FLITE_SD_PAD_SINK);		} else {			mf->code = sink->fmt->mbus_code;			mf->colorspace = sink->fmt->colorspace;			rect = &sink->rect;		}		/* Allow changing format only on sink pad */		mf->width = rect->width;		mf->height = rect->height;	}	mf->field = V4L2_FIELD_NONE;	v4l2_dbg(1, debug, &fimc->subdev, "code: %#x (%d), %dx%d/n",		 mf->code, mf->colorspace, mf->width, mf->height);	return fmt;}
开发者ID:19Dan01,项目名称:linux,代码行数:51,


示例9: fimc_m2m_try_crop

static int fimc_m2m_try_crop(struct fimc_ctx *ctx, struct v4l2_crop *cr){    struct fimc_dev *fimc = ctx->fimc_dev;    struct fimc_frame *f;    u32 min_size, halign, depth = 0;    int i;    if (cr->c.top < 0 || cr->c.left < 0) {        v4l2_err(&fimc->m2m.vfd,                 "doesn't support negative values for top & left/n");        return -EINVAL;    }    if (cr->type == V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE)        f = &ctx->d_frame;    else if (cr->type == V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE)        f = &ctx->s_frame;    else        return -EINVAL;    min_size = (f == &ctx->s_frame) ?               fimc->variant->min_inp_pixsize : fimc->variant->min_out_pixsize;    /* Get pixel alignment constraints. */    if (fimc->variant->min_vsize_align == 1)        halign = fimc_fmt_is_rgb(f->fmt->color) ? 0 : 1;    else        halign = ffs(fimc->variant->min_vsize_align) - 1;    for (i = 0; i < f->fmt->colplanes; i++)        depth += f->fmt->depth[i];    v4l_bound_align_image(&cr->c.width, min_size, f->o_width,                          ffs(min_size) - 1,                          &cr->c.height, min_size, f->o_height,                          halign, 64/(ALIGN(depth, 8)));    /* adjust left/top if cropping rectangle is out of bounds */    if (cr->c.left + cr->c.width > f->o_width)        cr->c.left = f->o_width - cr->c.width;    if (cr->c.top + cr->c.height > f->o_height)        cr->c.top = f->o_height - cr->c.height;    cr->c.left = round_down(cr->c.left, min_size);    cr->c.top  = round_down(cr->c.top, fimc->variant->hor_offs_align);    dbg("l:%d, t:%d, w:%d, h:%d, f_w: %d, f_h: %d",        cr->c.left, cr->c.top, cr->c.width, cr->c.height,        f->f_width, f->f_height);    return 0;}
开发者ID:Niisp,项目名称:MT6795.kernel,代码行数:51,


示例10: ak881x_try_g_mbus_fmt

static int ak881x_try_g_mbus_fmt(struct v4l2_subdev *sd,				 struct v4l2_mbus_framefmt *mf){	struct i2c_client *client = v4l2_get_subdevdata(sd);	struct ak881x *ak881x = to_ak881x(client);	v4l_bound_align_image(&mf->width, 0, 720, 2,			      &mf->height, 0, ak881x->lines, 1, 0);	mf->field	= V4L2_FIELD_INTERLACED;	mf->code	= V4L2_MBUS_FMT_YUYV8_2X8;	mf->colorspace	= V4L2_COLORSPACE_SMPTE170M;	return 0;}
开发者ID:AD5GB,项目名称:kernel_n5_3.10-experimental,代码行数:14,


示例11: hva_try_fmt_frame

static int hva_try_fmt_frame(struct file *file, void *priv,			     struct v4l2_format *f){	struct hva_ctx *ctx = fh_to_ctx(file->private_data);	struct device *dev = ctx_to_dev(ctx);	struct v4l2_pix_format *pix = &f->fmt.pix;	u32 pixelformat = pix->pixelformat;	const struct hva_enc *enc;	u32 width, height;	enc = hva_find_encoder(ctx, pixelformat, ctx->streaminfo.streamformat);	if (!enc) {		dev_dbg(dev,			"%s V4L2 TRY_FMT (OUTPUT): unsupported format %.4s/n",			ctx->name, (char *)&pixelformat);		return -EINVAL;	}	/* adjust width & height */	width = pix->width;	height = pix->height;	v4l_bound_align_image(&pix->width,			      HVA_MIN_WIDTH, HVA_MAX_WIDTH,			      frame_alignment(pixelformat) - 1,			      &pix->height,			      HVA_MIN_HEIGHT, HVA_MAX_HEIGHT,			      frame_alignment(pixelformat) - 1,			      0);	if ((pix->width != width) || (pix->height != height))		dev_dbg(dev,			"%s V4L2 TRY_FMT (OUTPUT): resolution updated %dx%d -> %dx%d to fit min/max/alignment/n",			ctx->name, width, height, pix->width, pix->height);	width = ALIGN(pix->width, HVA_WIDTH_ALIGNMENT);	height = ALIGN(pix->height, HVA_HEIGHT_ALIGNMENT);	if (!pix->colorspace) {		pix->colorspace = V4L2_COLORSPACE_REC709;		pix->xfer_func = V4L2_XFER_FUNC_DEFAULT;		pix->ycbcr_enc = V4L2_YCBCR_ENC_DEFAULT;		pix->quantization = V4L2_QUANTIZATION_DEFAULT;	}	pix->bytesperline = frame_stride(width, pixelformat);	pix->sizeimage = frame_size(width, height, pixelformat);	pix->field = V4L2_FIELD_NONE;	return 0;}
开发者ID:acton393,项目名称:linux,代码行数:50,


示例12: bdisp_try_fmt

static int bdisp_try_fmt(struct file *file, void *fh, struct v4l2_format *f){	struct bdisp_ctx *ctx = fh_to_ctx(fh);	struct v4l2_pix_format *pix = &f->fmt.pix;	const struct bdisp_fmt *format;	u32 in_w, in_h;	format = bdisp_find_fmt(pix->pixelformat);	if (!format) {		dev_dbg(ctx->bdisp_dev->dev, "Unknown format 0x%x/n",			pix->pixelformat);		return -EINVAL;	}	/* YUV420P only supported for VIDEO_OUTPUT */	if ((format->pixelformat == V4L2_PIX_FMT_YUV420) &&	    (f->type == V4L2_BUF_TYPE_VIDEO_CAPTURE)) {		dev_dbg(ctx->bdisp_dev->dev, "No YU12 on capture/n");		return -EINVAL;	}	/* Field (interlaced only supported on OUTPUT) */	if ((f->type == V4L2_BUF_TYPE_VIDEO_CAPTURE) ||	    (pix->field != V4L2_FIELD_INTERLACED))		pix->field = V4L2_FIELD_NONE;	/* Adjust width & height */	in_w = pix->width;	in_h = pix->height;	v4l_bound_align_image(&pix->width,			      BDISP_MIN_W, BDISP_MAX_W,			      ffs(format->w_align) - 1,			      &pix->height,			      BDISP_MIN_H, BDISP_MAX_H,			      ffs(format->h_align) - 1,			      0);	if ((pix->width != in_w) || (pix->height != in_h))		dev_dbg(ctx->bdisp_dev->dev,			"%s size updated: %dx%d -> %dx%d/n", __func__,			in_w, in_h, pix->width, pix->height);	pix->bytesperline = (pix->width * format->bpp_plane0) / 8;	pix->sizeimage = (pix->width * pix->height * format->bpp) / 8;	if (f->type == V4L2_BUF_TYPE_VIDEO_CAPTURE)		pix->colorspace = bdisp_dflt_fmt.colorspace;	return 0;}
开发者ID:AK101111,项目名称:linux,代码行数:49,


示例13: fimc_try_fmt_mplane

static int fimc_try_fmt_mplane(struct fimc_ctx *ctx, struct v4l2_format *f){	struct fimc_dev *fimc = ctx->fimc_dev;	struct fimc_variant *variant = fimc->variant;	struct v4l2_pix_format_mplane *pix = &f->fmt.pix_mp;	struct fimc_fmt *fmt;	u32 max_w, mod_x, mod_y;	if (!IS_M2M(f->type))		return -EINVAL;	dbg("w: %d, h: %d", pix->width, pix->height);	fmt = fimc_find_format(&pix->pixelformat, NULL,			       get_m2m_fmt_flags(f->type), 0);	if (WARN(fmt == NULL, "Pixel format lookup failed"))		return -EINVAL;	if (pix->field == V4L2_FIELD_ANY)		pix->field = V4L2_FIELD_NONE;	else if (pix->field != V4L2_FIELD_NONE)		return -EINVAL;	if (f->type == V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE) {		max_w = variant->pix_limit->scaler_dis_w;		mod_x = ffs(variant->min_inp_pixsize) - 1;	} else {		max_w = variant->pix_limit->out_rot_dis_w;		mod_x = ffs(variant->min_out_pixsize) - 1;	}	if (tiled_fmt(fmt)) {		mod_x = 6; /* 64 x 32 pixels tile */		mod_y = 5;	} else {		if (variant->min_vsize_align == 1)			mod_y = fimc_fmt_is_rgb(fmt->color) ? 0 : 1;		else			mod_y = ffs(variant->min_vsize_align) - 1;	}	v4l_bound_align_image(&pix->width, 16, max_w, mod_x,		&pix->height, 8, variant->pix_limit->scaler_dis_w, mod_y, 0);	fimc_adjust_mplane_format(fmt, pix->width, pix->height, &f->fmt.pix_mp);	return 0;}
开发者ID:ARMWorks,项目名称:FA_2451_Linux_Kernel,代码行数:47,


示例14: rvin_format_align

static void rvin_format_align(struct rvin_dev *vin, struct v4l2_pix_format *pix){	u32 walign;	if (!rvin_format_from_pixel(pix->pixelformat) ||	    (vin->info->model == RCAR_M1 &&	     pix->pixelformat == V4L2_PIX_FMT_XBGR32))		pix->pixelformat = RVIN_DEFAULT_FORMAT;	switch (pix->field) {	case V4L2_FIELD_TOP:	case V4L2_FIELD_BOTTOM:	case V4L2_FIELD_NONE:	case V4L2_FIELD_INTERLACED_TB:	case V4L2_FIELD_INTERLACED_BT:	case V4L2_FIELD_INTERLACED:		break;	case V4L2_FIELD_ALTERNATE:		/*		 * Driver does not (yet) support outputting ALTERNATE to a		 * userspace. It does support outputting INTERLACED so use		 * the VIN hardware to combine the two fields.		 */		pix->field = V4L2_FIELD_INTERLACED;		pix->height *= 2;		break;	default:		pix->field = RVIN_DEFAULT_FIELD;		break;	}	/* HW limit width to a multiple of 32 (2^5) for NV16 else 2 (2^1) */	walign = vin->format.pixelformat == V4L2_PIX_FMT_NV16 ? 5 : 1;	/* Limit to VIN capabilities */	v4l_bound_align_image(&pix->width, 2, vin->info->max_width, walign,			      &pix->height, 4, vin->info->max_height, 2, 0);	pix->bytesperline = rvin_format_bytesperline(pix);	pix->sizeimage = rvin_format_sizeimage(pix);	vin_dbg(vin, "Format %ux%u bpl: %u size: %u/n",		pix->width, pix->height, pix->bytesperline, pix->sizeimage);}
开发者ID:AlexShiLucky,项目名称:linux,代码行数:44,


示例15: __isp_video_try_fmt

static void __isp_video_try_fmt(struct fimc_isp *isp,				struct v4l2_pix_format_mplane *pixm,				const struct fimc_fmt **fmt){	*fmt = fimc_isp_find_format(&pixm->pixelformat, NULL, 2);	pixm->colorspace = V4L2_COLORSPACE_SRGB;	pixm->field = V4L2_FIELD_NONE;	pixm->num_planes = (*fmt)->memplanes;	pixm->pixelformat = (*fmt)->fourcc;	/*	 * TODO: double check with the docmentation these width/height	 * constraints are correct.	 */	v4l_bound_align_image(&pixm->width, FIMC_ISP_SOURCE_WIDTH_MIN,			      FIMC_ISP_SOURCE_WIDTH_MAX, 3,			      &pixm->height, FIMC_ISP_SOURCE_HEIGHT_MIN,			      FIMC_ISP_SOURCE_HEIGHT_MAX, 0, 0);}
开发者ID:a2hojsjsjs,项目名称:linux,代码行数:19,


示例16: fimc_lite_try_fmt

static int fimc_lite_try_fmt(struct fimc_lite *fimc,			     struct v4l2_pix_format_mplane *pixm,			     const struct fimc_fmt **ffmt){	u32 bpl = pixm->plane_fmt[0].bytesperline;	struct flite_drvdata *dd = fimc->dd;	const struct fimc_fmt *inp_fmt = fimc->inp_frame.fmt;	const struct fimc_fmt *fmt;	if (WARN_ON(inp_fmt == NULL))		return -EINVAL;	/*	 * We allow some flexibility only for YUV formats. In case of raw	 * raw Bayer the FIMC-LITE's output format must match its camera	 * interface input format.	 */	if (inp_fmt->flags & FMT_FLAGS_YUV)		fmt = fimc_lite_find_format(&pixm->pixelformat, NULL,						inp_fmt->flags, 0);	else		fmt = inp_fmt;	if (WARN_ON(fmt == NULL))		return -EINVAL;	if (ffmt)		*ffmt = fmt;	v4l_bound_align_image(&pixm->width, 8, dd->max_width,			      ffs(dd->out_width_align) - 1,			      &pixm->height, 0, dd->max_height, 0, 0);	if ((bpl == 0 || ((bpl * 8) / fmt->depth[0]) < pixm->width))		pixm->plane_fmt[0].bytesperline = (pixm->width *						   fmt->depth[0]) / 8;	if (pixm->plane_fmt[0].sizeimage == 0)		pixm->plane_fmt[0].sizeimage = (pixm->width * pixm->height *						fmt->depth[0]) / 8;	pixm->num_planes = fmt->memplanes;	pixm->pixelformat = fmt->fourcc;	pixm->colorspace = fmt->colorspace;	pixm->field = V4L2_FIELD_NONE;	return 0;}
开发者ID:19Dan01,项目名称:linux,代码行数:43,


示例17: ak881x_fill_fmt

static int ak881x_fill_fmt(struct v4l2_subdev *sd,		struct v4l2_subdev_pad_config *cfg,		struct v4l2_subdev_format *format){	struct v4l2_mbus_framefmt *mf = &format->format;	struct i2c_client *client = v4l2_get_subdevdata(sd);	struct ak881x *ak881x = to_ak881x(client);	if (format->pad)		return -EINVAL;	v4l_bound_align_image(&mf->width, 0, 720, 2,			      &mf->height, 0, ak881x->lines, 1, 0);	mf->field	= V4L2_FIELD_INTERLACED;	mf->code	= MEDIA_BUS_FMT_YUYV8_2X8;	mf->colorspace	= V4L2_COLORSPACE_SMPTE170M;	return 0;}
开发者ID:OSPro,项目名称:wpj344_compatwireless,代码行数:19,


示例18: vdic_try_fmt

static void vdic_try_fmt(struct vdic_priv *priv,			 struct v4l2_subdev_pad_config *cfg,			 struct v4l2_subdev_format *sdformat,			 const struct imx_media_pixfmt **cc){	struct v4l2_mbus_framefmt *infmt;	*cc = imx_media_find_ipu_format(sdformat->format.code, CS_SEL_YUV);	if (!*cc) {		u32 code;		imx_media_enum_ipu_format(&code, 0, CS_SEL_YUV);		*cc = imx_media_find_ipu_format(code, CS_SEL_YUV);		sdformat->format.code = (*cc)->codes[0];	}	infmt = __vdic_get_fmt(priv, cfg, priv->active_input_pad,			       sdformat->which);	switch (sdformat->pad) {	case VDIC_SRC_PAD_DIRECT:		sdformat->format = *infmt;		/* output is always progressive! */		sdformat->format.field = V4L2_FIELD_NONE;		break;	case VDIC_SINK_PAD_DIRECT:	case VDIC_SINK_PAD_IDMAC:		v4l_bound_align_image(&sdformat->format.width,				      MIN_W, MAX_W_VDIC, W_ALIGN,				      &sdformat->format.height,				      MIN_H, MAX_H_VDIC, H_ALIGN, S_ALIGN);		imx_media_fill_default_mbus_fields(&sdformat->format, infmt,						   true);		/* input must be interlaced! Choose SEQ_TB if not */		if (!V4L2_FIELD_HAS_BOTH(sdformat->format.field))			sdformat->format.field = V4L2_FIELD_SEQ_TB;		break;	}}
开发者ID:avagin,项目名称:linux,代码行数:41,


示例19: dma_align

static int dma_align(int *width, int *height,		const struct soc_mbus_pixelfmt *fmt,		enum omap1_cam_vb_mode vb_mode, bool enlarge){	s32 bytes_per_line = soc_mbus_bytes_per_line(*width, fmt);	if (bytes_per_line < 0)		return bytes_per_line;	if (!is_dma_aligned(bytes_per_line, *height, vb_mode)) {		unsigned int pxalign = __fls(bytes_per_line / *width);		unsigned int salign  = DMA_FRAME_SHIFT(vb_mode) +				DMA_ELEMENT_SHIFT - pxalign;		unsigned int incr    = enlarge << salign;		v4l_bound_align_image(width, 1, *width + incr, 0,				height, 1, *height + incr, 0, salign);		return 0;	}	return 1;}
开发者ID:andi34,项目名称:Dhollmen_Kernel,代码行数:21,


示例20: gsc_try_crop

int gsc_try_crop(struct gsc_ctx *ctx, struct v4l2_crop *cr){	struct gsc_frame *f;	struct gsc_dev *gsc = ctx->gsc_dev;	struct gsc_variant *variant = gsc->variant;	u32 mod_x = 0, mod_y = 0, tmp_w, tmp_h;	u32 min_w, min_h, max_w, max_h;	if (cr->c.top < 0 || cr->c.left < 0) {		pr_err("doesn't support negative values for top & left/n");		return -EINVAL;	}	pr_debug("user put w: %d, h: %d", cr->c.width, cr->c.height);	if (cr->type == V4L2_BUF_TYPE_VIDEO_CAPTURE)		f = &ctx->d_frame;	else if (cr->type == V4L2_BUF_TYPE_VIDEO_OUTPUT)		f = &ctx->s_frame;	else		return -EINVAL;	max_w = f->f_width;	max_h = f->f_height;	tmp_w = cr->c.width;	tmp_h = cr->c.height;	if (V4L2_TYPE_IS_OUTPUT(cr->type)) {		if ((is_yuv422(f->fmt->color) && f->fmt->num_comp == 1) ||		    is_rgb(f->fmt->color))			min_w = 32;		else			min_w = 64;		if ((is_yuv422(f->fmt->color) && f->fmt->num_comp == 3) ||		    is_yuv420(f->fmt->color))			min_h = 32;		else			min_h = 16;	} else {		if (is_yuv420(f->fmt->color) || is_yuv422(f->fmt->color))			mod_x = ffs(variant->pix_align->target_w) - 1;		if (is_yuv420(f->fmt->color))			mod_y = ffs(variant->pix_align->target_h) - 1;		if (ctx->gsc_ctrls.rotate->val == 90 ||		    ctx->gsc_ctrls.rotate->val == 270) {			max_w = f->f_height;			max_h = f->f_width;			min_w = variant->pix_min->target_rot_en_w;			min_h = variant->pix_min->target_rot_en_h;			tmp_w = cr->c.height;			tmp_h = cr->c.width;		} else {			min_w = variant->pix_min->target_rot_dis_w;			min_h = variant->pix_min->target_rot_dis_h;		}	}	pr_debug("mod_x: %d, mod_y: %d, min_w: %d, min_h = %d",					mod_x, mod_y, min_w, min_h);	pr_debug("tmp_w : %d, tmp_h : %d", tmp_w, tmp_h);	v4l_bound_align_image(&tmp_w, min_w, max_w, mod_x,			      &tmp_h, min_h, max_h, mod_y, 0);	if (!V4L2_TYPE_IS_OUTPUT(cr->type) &&		(ctx->gsc_ctrls.rotate->val == 90 ||		ctx->gsc_ctrls.rotate->val == 270))		gsc_check_crop_change(tmp_h, tmp_w,					&cr->c.width, &cr->c.height);	else		gsc_check_crop_change(tmp_w, tmp_h,					&cr->c.width, &cr->c.height);	/* adjust left/top if cropping rectangle is out of bounds */	/* Need to add code to algin left value with 2's multiple */	if (cr->c.left + tmp_w > max_w)		cr->c.left = max_w - tmp_w;	if (cr->c.top + tmp_h > max_h)		cr->c.top = max_h - tmp_h;	if ((is_yuv420(f->fmt->color) || is_yuv422(f->fmt->color)) &&		cr->c.left & 1)			cr->c.left -= 1;	pr_debug("Aligned l:%d, t:%d, w:%d, h:%d, f_w: %d, f_h: %d",	    cr->c.left, cr->c.top, cr->c.width, cr->c.height, max_w, max_h);	return 0;}
开发者ID:ezequielgarcia,项目名称:linux,代码行数:88,


示例21: gsc_try_fmt_mplane

int gsc_try_fmt_mplane(struct gsc_ctx *ctx, struct v4l2_format *f){	struct gsc_dev *gsc = ctx->gsc_dev;	struct gsc_variant *variant = gsc->variant;	struct v4l2_pix_format_mplane *pix_mp = &f->fmt.pix_mp;	const struct gsc_fmt *fmt;	u32 max_w, max_h, mod_x, mod_y;	u32 min_w, min_h, tmp_w, tmp_h;	int i;	pr_debug("user put w: %d, h: %d", pix_mp->width, pix_mp->height);	fmt = find_fmt(&pix_mp->pixelformat, NULL, 0);	if (!fmt) {		pr_err("pixelformat format (0x%X) invalid/n",						pix_mp->pixelformat);		return -EINVAL;	}	if (pix_mp->field == V4L2_FIELD_ANY)		pix_mp->field = V4L2_FIELD_NONE;	else if (pix_mp->field != V4L2_FIELD_NONE) {		pr_debug("Not supported field order(%d)/n", pix_mp->field);		return -EINVAL;	}	max_w = variant->pix_max->target_rot_dis_w;	max_h = variant->pix_max->target_rot_dis_h;	mod_x = ffs(variant->pix_align->org_w) - 1;	if (is_yuv420(fmt->color))		mod_y = ffs(variant->pix_align->org_h) - 1;	else		mod_y = ffs(variant->pix_align->org_h) - 2;	if (V4L2_TYPE_IS_OUTPUT(f->type)) {		min_w = variant->pix_min->org_w;		min_h = variant->pix_min->org_h;	} else {		min_w = variant->pix_min->target_rot_dis_w;		min_h = variant->pix_min->target_rot_dis_h;		pix_mp->colorspace = ctx->out_colorspace;	}	pr_debug("mod_x: %d, mod_y: %d, max_w: %d, max_h = %d",			mod_x, mod_y, max_w, max_h);	/* To check if image size is modified to adjust parameter against	   hardware abilities */	tmp_w = pix_mp->width;	tmp_h = pix_mp->height;	v4l_bound_align_image(&pix_mp->width, min_w, max_w, mod_x,		&pix_mp->height, min_h, max_h, mod_y, 0);	if (tmp_w != pix_mp->width || tmp_h != pix_mp->height)		pr_debug("Image size has been modified from %dx%d to %dx%d/n",			 tmp_w, tmp_h, pix_mp->width, pix_mp->height);	pix_mp->num_planes = fmt->num_planes;	if (V4L2_TYPE_IS_OUTPUT(f->type))		ctx->out_colorspace = pix_mp->colorspace;	for (i = 0; i < pix_mp->num_planes; ++i) {		struct v4l2_plane_pix_format *plane_fmt = &pix_mp->plane_fmt[i];		u32 bpl = plane_fmt->bytesperline;		if (fmt->num_comp == 1 && /* Packed */		    (bpl == 0 || (bpl * 8 / fmt->depth[i]) < pix_mp->width))			bpl = pix_mp->width * fmt->depth[i] / 8;		if (fmt->num_comp > 1 && /* Planar */		    (bpl == 0 || bpl < pix_mp->width))			bpl = pix_mp->width;		if (i != 0 && fmt->num_comp == 3)			bpl /= 2;		plane_fmt->bytesperline = bpl;		plane_fmt->sizeimage = max(pix_mp->width * pix_mp->height *					   fmt->depth[i] / 8,					   plane_fmt->sizeimage);		pr_debug("[%d]: bpl: %d, sizeimage: %d",				i, bpl, pix_mp->plane_fmt[i].sizeimage);	}	return 0;}
开发者ID:ezequielgarcia,项目名称:linux,代码行数:88,


示例22: gsc_try_fmt_mplane

int gsc_try_fmt_mplane(struct gsc_ctx *ctx, struct v4l2_format *f){	struct gsc_dev *gsc = ctx->gsc_dev;	struct gsc_variant *variant = gsc->variant;	struct v4l2_pix_format_mplane *pix_mp = &f->fmt.pix_mp;	struct gsc_fmt *fmt;	u32 max_w, max_h, mod_x, mod_y;	u32 min_w, min_h, tmp_w, tmp_h;	int i;	gsc_dbg("user put w: %d, h: %d", pix_mp->width, pix_mp->height);	fmt = find_fmt(&pix_mp->pixelformat, NULL, 0);	if (!fmt) {		gsc_err("pixelformat format (0x%X) invalid/n", pix_mp->pixelformat);		return -EINVAL;	}	if (pix_mp->field == V4L2_FIELD_ANY)		pix_mp->field = V4L2_FIELD_NONE;	else if (pix_mp->field != V4L2_FIELD_NONE) {		gsc_err("Not supported field order(%d)/n", pix_mp->field);		return -EINVAL;	}	max_w = variant->pix_max->target_rot_dis_w;	max_h = variant->pix_max->target_rot_dis_h;	if (V4L2_TYPE_IS_OUTPUT(f->type)) {		mod_x = ffs(variant->pix_align->org_w) - 1;		if (is_yuv420(fmt->color))			mod_y = ffs(variant->pix_align->org_h) - 1;		else			mod_y = ffs(variant->pix_align->org_h) - 2;		min_w = variant->pix_min->org_w;		min_h = variant->pix_min->org_h;	} else {		mod_x = ffs(variant->pix_align->org_w) - 1;		if (is_yuv420(fmt->color))			mod_y = ffs(variant->pix_align->org_h) - 1;		else			mod_y = ffs(variant->pix_align->org_h) - 2;		min_w = variant->pix_min->target_rot_dis_w;		min_h = variant->pix_min->target_rot_dis_h;	}	gsc_dbg("mod_x: %d, mod_y: %d, max_w: %d, max_h = %d",	     mod_x, mod_y, max_w, max_h);	/* To check if image size is modified to adjust parameter against	   hardware abilities */	tmp_w = pix_mp->width;	tmp_h = pix_mp->height;	v4l_bound_align_image(&pix_mp->width, min_w, max_w, mod_x,		&pix_mp->height, min_h, max_h, mod_y, 0);	if (tmp_w != pix_mp->width || tmp_h != pix_mp->height)		gsc_info("Image size has been modified from %dx%d to %dx%d",			 tmp_w, tmp_h, pix_mp->width, pix_mp->height);	pix_mp->num_planes = fmt->num_planes;	if (ctx->gsc_ctrls.csc_eq_mode->val)		ctx->gsc_ctrls.csc_eq->val =			(pix_mp->width >= 1280) ? 1 : 0;	if (ctx->gsc_ctrls.csc_eq->val) /* HD */		pix_mp->colorspace = V4L2_COLORSPACE_REC709;	else	/* SD */		pix_mp->colorspace = V4L2_COLORSPACE_SMPTE170M;	for (i = 0; i < pix_mp->num_planes; ++i) {		int bpl = (pix_mp->width * fmt->depth[i]) >> 3;		pix_mp->plane_fmt[i].bytesperline = bpl;		pix_mp->plane_fmt[i].sizeimage = bpl * pix_mp->height;		gsc_dbg("[%d]: bpl: %d, sizeimage: %d",		    i, bpl, pix_mp->plane_fmt[i].sizeimage);	}	return 0;}
开发者ID:ArthySundaram,项目名称:chromeos-kvm,代码行数:79,


示例23: rvin_s_selection

static int rvin_s_selection(struct file *file, void *fh,			    struct v4l2_selection *s){	struct rvin_dev *vin = video_drvdata(file);	const struct rvin_video_format *fmt;	struct v4l2_rect r = s->r;	struct v4l2_rect max_rect;	struct v4l2_rect min_rect = {		.width = 6,		.height = 2,	};	if (s->type != V4L2_BUF_TYPE_VIDEO_CAPTURE)		return -EINVAL;	v4l2_rect_set_min_size(&r, &min_rect);	switch (s->target) {	case V4L2_SEL_TGT_CROP:		/* Can't crop outside of source input */		max_rect.top = max_rect.left = 0;		max_rect.width = vin->source.width;		max_rect.height = vin->source.height;		v4l2_rect_map_inside(&r, &max_rect);		v4l_bound_align_image(&r.width, 2, vin->source.width, 1,				      &r.height, 4, vin->source.height, 2, 0);		r.top  = clamp_t(s32, r.top, 0, vin->source.height - r.height);		r.left = clamp_t(s32, r.left, 0, vin->source.width - r.width);		vin->crop = s->r = r;		vin_dbg(vin, "Cropped %dx%[email
C++ v7_arg函数代码示例
C++ v4l2_subdev_notify函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。