ENCODE,
ISP,
DEINTERLACE,
+ NUM_ROLES
};
static const char * const roles[] = {
struct bcm2835_codec_fmt {
u32 fourcc;
int depth;
- int bytesperline_align;
+ u8 bytesperline_align[NUM_ROLES];
u32 flags;
u32 mmal_fmt;
int size_multiplier_x2;
/* YUV formats */
.fourcc = V4L2_PIX_FMT_YUV420,
.depth = 8,
- .bytesperline_align = 64,
+ .bytesperline_align = { 32, 64, 64, 32 },
.flags = 0,
.mmal_fmt = MMAL_ENCODING_I420,
.size_multiplier_x2 = 3,
}, {
.fourcc = V4L2_PIX_FMT_YVU420,
.depth = 8,
- .bytesperline_align = 64,
+ .bytesperline_align = { 32, 64, 64, 32 },
.flags = 0,
.mmal_fmt = MMAL_ENCODING_YV12,
.size_multiplier_x2 = 3,
}, {
.fourcc = V4L2_PIX_FMT_NV12,
.depth = 8,
- .bytesperline_align = 32,
+ .bytesperline_align = { 32, 32, 32, 32 },
.flags = 0,
.mmal_fmt = MMAL_ENCODING_NV12,
.size_multiplier_x2 = 3,
}, {
.fourcc = V4L2_PIX_FMT_NV21,
.depth = 8,
- .bytesperline_align = 32,
+ .bytesperline_align = { 32, 32, 32, 32 },
.flags = 0,
.mmal_fmt = MMAL_ENCODING_NV21,
.size_multiplier_x2 = 3,
}, {
.fourcc = V4L2_PIX_FMT_RGB565,
.depth = 16,
- .bytesperline_align = 32,
+ .bytesperline_align = { 32, 32, 32, 32 },
.flags = 0,
.mmal_fmt = MMAL_ENCODING_RGB16,
.size_multiplier_x2 = 2,
}, {
.fourcc = V4L2_PIX_FMT_YUYV,
.depth = 16,
- .bytesperline_align = 32,
+ .bytesperline_align = { 32, 32, 32, 32 },
.flags = 0,
.mmal_fmt = MMAL_ENCODING_YUYV,
.size_multiplier_x2 = 2,
}, {
.fourcc = V4L2_PIX_FMT_UYVY,
.depth = 16,
- .bytesperline_align = 32,
+ .bytesperline_align = { 32, 32, 32, 32 },
.flags = 0,
.mmal_fmt = MMAL_ENCODING_UYVY,
.size_multiplier_x2 = 2,
}, {
.fourcc = V4L2_PIX_FMT_YVYU,
.depth = 16,
- .bytesperline_align = 32,
+ .bytesperline_align = { 32, 32, 32, 32 },
.flags = 0,
.mmal_fmt = MMAL_ENCODING_YVYU,
.size_multiplier_x2 = 2,
}, {
.fourcc = V4L2_PIX_FMT_VYUY,
.depth = 16,
- .bytesperline_align = 32,
+ .bytesperline_align = { 32, 32, 32, 32 },
.flags = 0,
.mmal_fmt = MMAL_ENCODING_VYUY,
.size_multiplier_x2 = 2,
/* RGB formats */
.fourcc = V4L2_PIX_FMT_RGB24,
.depth = 24,
- .bytesperline_align = 32,
+ .bytesperline_align = { 32, 32, 32, 32 },
.flags = 0,
.mmal_fmt = MMAL_ENCODING_RGB24,
.size_multiplier_x2 = 2,
}, {
.fourcc = V4L2_PIX_FMT_BGR24,
.depth = 24,
- .bytesperline_align = 32,
+ .bytesperline_align = { 32, 32, 32, 32 },
.flags = 0,
.mmal_fmt = MMAL_ENCODING_BGR24,
.size_multiplier_x2 = 2,
}, {
.fourcc = V4L2_PIX_FMT_BGR32,
.depth = 32,
- .bytesperline_align = 32,
+ .bytesperline_align = { 32, 32, 32, 32 },
.flags = 0,
.mmal_fmt = MMAL_ENCODING_BGRA,
.size_multiplier_x2 = 2,
/* 8 bit */
.fourcc = V4L2_PIX_FMT_SRGGB8,
.depth = 8,
- .bytesperline_align = 32,
+ .bytesperline_align = { 32, 32, 32, 32 },
.flags = 0,
.mmal_fmt = MMAL_ENCODING_BAYER_SRGGB8,
.size_multiplier_x2 = 2,
}, {
.fourcc = V4L2_PIX_FMT_SBGGR8,
.depth = 8,
- .bytesperline_align = 32,
+ .bytesperline_align = { 32, 32, 32, 32 },
.flags = 0,
.mmal_fmt = MMAL_ENCODING_BAYER_SBGGR8,
.size_multiplier_x2 = 2,
}, {
.fourcc = V4L2_PIX_FMT_SGRBG8,
.depth = 8,
- .bytesperline_align = 32,
+ .bytesperline_align = { 32, 32, 32, 32 },
.flags = 0,
.mmal_fmt = MMAL_ENCODING_BAYER_SGRBG8,
.size_multiplier_x2 = 2,
}, {
.fourcc = V4L2_PIX_FMT_SGBRG8,
.depth = 8,
- .bytesperline_align = 32,
+ .bytesperline_align = { 32, 32, 32, 32 },
.flags = 0,
.mmal_fmt = MMAL_ENCODING_BAYER_SGBRG8,
.size_multiplier_x2 = 2,
/* 10 bit */
.fourcc = V4L2_PIX_FMT_SRGGB10P,
.depth = 10,
- .bytesperline_align = 32,
+ .bytesperline_align = { 32, 32, 32, 32 },
.flags = 0,
.mmal_fmt = MMAL_ENCODING_BAYER_SRGGB10P,
.size_multiplier_x2 = 2,
}, {
.fourcc = V4L2_PIX_FMT_SBGGR10P,
.depth = 10,
- .bytesperline_align = 32,
+ .bytesperline_align = { 32, 32, 32, 32 },
.flags = 0,
.mmal_fmt = MMAL_ENCODING_BAYER_SBGGR10P,
.size_multiplier_x2 = 2,
}, {
.fourcc = V4L2_PIX_FMT_SGRBG10P,
.depth = 10,
- .bytesperline_align = 32,
+ .bytesperline_align = { 32, 32, 32, 32 },
.flags = 0,
.mmal_fmt = MMAL_ENCODING_BAYER_SGRBG10P,
.size_multiplier_x2 = 2,
}, {
.fourcc = V4L2_PIX_FMT_SGBRG10P,
.depth = 10,
- .bytesperline_align = 32,
+ .bytesperline_align = { 32, 32, 32, 32 },
.flags = 0,
.mmal_fmt = MMAL_ENCODING_BAYER_SGBRG10P,
.size_multiplier_x2 = 2,
/* 12 bit */
.fourcc = V4L2_PIX_FMT_SRGGB12P,
.depth = 12,
- .bytesperline_align = 32,
+ .bytesperline_align = { 32, 32, 32, 32 },
.flags = 0,
.mmal_fmt = MMAL_ENCODING_BAYER_SRGGB12P,
.size_multiplier_x2 = 2,
}, {
.fourcc = V4L2_PIX_FMT_SBGGR12P,
.depth = 12,
- .bytesperline_align = 32,
+ .bytesperline_align = { 32, 32, 32, 32 },
.flags = 0,
.mmal_fmt = MMAL_ENCODING_BAYER_SBGGR12P,
.size_multiplier_x2 = 2,
}, {
.fourcc = V4L2_PIX_FMT_SGRBG12P,
.depth = 12,
- .bytesperline_align = 32,
+ .bytesperline_align = { 32, 32, 32, 32 },
.flags = 0,
.mmal_fmt = MMAL_ENCODING_BAYER_SGRBG12P,
.size_multiplier_x2 = 2,
}, {
.fourcc = V4L2_PIX_FMT_SGBRG12P,
.depth = 12,
- .bytesperline_align = 32,
+ .bytesperline_align = { 32, 32, 32, 32 },
.flags = 0,
.mmal_fmt = MMAL_ENCODING_BAYER_SGBRG12P,
.size_multiplier_x2 = 2,
/* 14 bit */
.fourcc = V4L2_PIX_FMT_SRGGB14P,
.depth = 14,
- .bytesperline_align = 32,
+ .bytesperline_align = { 32, 32, 32, 32 },
.flags = 0,
.mmal_fmt = MMAL_ENCODING_BAYER_SRGGB14P,
.size_multiplier_x2 = 2,
}, {
.fourcc = V4L2_PIX_FMT_SBGGR14P,
.depth = 14,
- .bytesperline_align = 32,
+ .bytesperline_align = { 32, 32, 32, 32 },
.flags = 0,
.mmal_fmt = MMAL_ENCODING_BAYER_SBGGR14P,
.size_multiplier_x2 = 2,
}, {
.fourcc = V4L2_PIX_FMT_SGRBG14P,
.depth = 14,
- .bytesperline_align = 32,
+ .bytesperline_align = { 32, 32, 32, 32 },
.flags = 0,
.mmal_fmt = MMAL_ENCODING_BAYER_SGRBG14P,
.size_multiplier_x2 = 2,
}, {
.fourcc = V4L2_PIX_FMT_SGBRG14P,
.depth = 14,
- .bytesperline_align = 32,
+ .bytesperline_align = { 32, 32, 32, 32 },
.flags = 0,
.mmal_fmt = MMAL_ENCODING_BAYER_SGBRG14P,
.size_multiplier_x2 = 2,
/* 16 bit */
.fourcc = V4L2_PIX_FMT_SRGGB16,
.depth = 16,
- .bytesperline_align = 32,
+ .bytesperline_align = { 32, 32, 32, 32 },
.flags = 0,
.mmal_fmt = MMAL_ENCODING_BAYER_SRGGB16,
.size_multiplier_x2 = 2,
}, {
.fourcc = V4L2_PIX_FMT_SBGGR16,
.depth = 16,
- .bytesperline_align = 32,
+ .bytesperline_align = { 32, 32, 32, 32 },
.flags = 0,
.mmal_fmt = MMAL_ENCODING_BAYER_SBGGR16,
.size_multiplier_x2 = 2,
}, {
.fourcc = V4L2_PIX_FMT_SGRBG16,
.depth = 16,
- .bytesperline_align = 32,
+ .bytesperline_align = { 32, 32, 32, 32 },
.flags = 0,
.mmal_fmt = MMAL_ENCODING_BAYER_SGRBG16,
.size_multiplier_x2 = 2,
}, {
.fourcc = V4L2_PIX_FMT_SGBRG16,
.depth = 16,
- .bytesperline_align = 32,
+ .bytesperline_align = { 32, 32, 32, 32 },
.flags = 0,
.mmal_fmt = MMAL_ENCODING_BAYER_SGBRG16,
.size_multiplier_x2 = 2,
/* 10 bit */
.fourcc = V4L2_PIX_FMT_SRGGB10,
.depth = 16,
- .bytesperline_align = 32,
+ .bytesperline_align = { 32, 32, 32, 32 },
.flags = 0,
.mmal_fmt = MMAL_ENCODING_BAYER_SRGGB10,
.size_multiplier_x2 = 2,
}, {
.fourcc = V4L2_PIX_FMT_SBGGR10,
.depth = 16,
- .bytesperline_align = 32,
+ .bytesperline_align = { 32, 32, 32, 32 },
.flags = 0,
.mmal_fmt = MMAL_ENCODING_BAYER_SBGGR10,
.size_multiplier_x2 = 2,
}, {
.fourcc = V4L2_PIX_FMT_SGRBG10,
.depth = 16,
- .bytesperline_align = 32,
+ .bytesperline_align = { 32, 32, 32, 32 },
.flags = 0,
.mmal_fmt = MMAL_ENCODING_BAYER_SGRBG10,
.size_multiplier_x2 = 2,
}, {
.fourcc = V4L2_PIX_FMT_SGBRG10,
.depth = 16,
- .bytesperline_align = 32,
+ .bytesperline_align = { 32, 32, 32, 32 },
.flags = 0,
.mmal_fmt = MMAL_ENCODING_BAYER_SGBRG10,
.size_multiplier_x2 = 2,
/* 12 bit */
.fourcc = V4L2_PIX_FMT_SRGGB12,
.depth = 16,
- .bytesperline_align = 32,
+ .bytesperline_align = { 32, 32, 32, 32 },
.flags = 0,
.mmal_fmt = MMAL_ENCODING_BAYER_SRGGB12,
.size_multiplier_x2 = 2,
}, {
.fourcc = V4L2_PIX_FMT_SBGGR12,
.depth = 16,
- .bytesperline_align = 32,
+ .bytesperline_align = { 32, 32, 32, 32 },
.flags = 0,
.mmal_fmt = MMAL_ENCODING_BAYER_SBGGR12,
.size_multiplier_x2 = 2,
}, {
.fourcc = V4L2_PIX_FMT_SGRBG12,
.depth = 16,
- .bytesperline_align = 32,
+ .bytesperline_align = { 32, 32, 32, 32 },
.flags = 0,
.mmal_fmt = MMAL_ENCODING_BAYER_SGRBG12,
.size_multiplier_x2 = 2,
}, {
.fourcc = V4L2_PIX_FMT_SGBRG12,
.depth = 16,
- .bytesperline_align = 32,
+ .bytesperline_align = { 32, 32, 32, 32 },
.flags = 0,
.mmal_fmt = MMAL_ENCODING_BAYER_SGBRG12,
.size_multiplier_x2 = 2,
/* 14 bit */
.fourcc = V4L2_PIX_FMT_SRGGB14,
.depth = 16,
- .bytesperline_align = 32,
+ .bytesperline_align = { 32, 32, 32, 32 },
.flags = 0,
.mmal_fmt = MMAL_ENCODING_BAYER_SRGGB14,
.size_multiplier_x2 = 2,
}, {
.fourcc = V4L2_PIX_FMT_SBGGR14,
.depth = 16,
- .bytesperline_align = 32,
+ .bytesperline_align = { 32, 32, 32, 32 },
.flags = 0,
.mmal_fmt = MMAL_ENCODING_BAYER_SBGGR14,
.size_multiplier_x2 = 2,
}, {
.fourcc = V4L2_PIX_FMT_SGRBG14,
.depth = 16,
- .bytesperline_align = 32,
+ .bytesperline_align = { 32, 32, 32, 32 },
.flags = 0,
.mmal_fmt = MMAL_ENCODING_BAYER_SGRBG14,
.size_multiplier_x2 = 2,
}, {
.fourcc = V4L2_PIX_FMT_SGBRG14,
.depth = 16,
- .bytesperline_align = 32,
+ .bytesperline_align = { 32, 32, 32, 32 },
.flags = 0,
.mmal_fmt = MMAL_ENCODING_BAYER_SGBRG14,
.size_multiplier_x2 = 2,
/* 8 bit */
.fourcc = V4L2_PIX_FMT_GREY,
.depth = 8,
- .bytesperline_align = 32,
+ .bytesperline_align = { 32, 32, 32, 32 },
.flags = 0,
.mmal_fmt = MMAL_ENCODING_GREY,
.size_multiplier_x2 = 2,
/* 10 bit */
.fourcc = V4L2_PIX_FMT_Y10P,
.depth = 10,
- .bytesperline_align = 32,
+ .bytesperline_align = { 32, 32, 32, 32 },
.flags = 0,
.mmal_fmt = MMAL_ENCODING_Y10P,
.size_multiplier_x2 = 2,
/* 12 bit */
.fourcc = V4L2_PIX_FMT_Y12P,
.depth = 12,
- .bytesperline_align = 32,
+ .bytesperline_align = { 32, 32, 32, 32 },
.flags = 0,
.mmal_fmt = MMAL_ENCODING_Y12P,
.size_multiplier_x2 = 2,
/* 14 bit */
.fourcc = V4L2_PIX_FMT_Y14P,
.depth = 14,
- .bytesperline_align = 32,
+ .bytesperline_align = { 32, 32, 32, 32 },
.flags = 0,
.mmal_fmt = MMAL_ENCODING_Y14P,
.size_multiplier_x2 = 2,
/* 16 bit */
.fourcc = V4L2_PIX_FMT_Y16,
.depth = 16,
- .bytesperline_align = 32,
+ .bytesperline_align = { 32, 32, 32, 32 },
.flags = 0,
.mmal_fmt = MMAL_ENCODING_Y16,
.size_multiplier_x2 = 2,
/* 10 bit as 16bpp */
.fourcc = V4L2_PIX_FMT_Y10,
.depth = 16,
- .bytesperline_align = 32,
+ .bytesperline_align = { 32, 32, 32, 32 },
.flags = 0,
.mmal_fmt = MMAL_ENCODING_Y10,
.size_multiplier_x2 = 2,
/* 12 bit as 16bpp */
.fourcc = V4L2_PIX_FMT_Y12,
.depth = 16,
- .bytesperline_align = 32,
+ .bytesperline_align = { 32, 32, 32, 32 },
.flags = 0,
.mmal_fmt = MMAL_ENCODING_Y12,
.size_multiplier_x2 = 2,
/* 14 bit as 16bpp */
.fourcc = V4L2_PIX_FMT_Y14,
.depth = 16,
- .bytesperline_align = 32,
+ .bytesperline_align = { 32, 32, 32, 32 },
.flags = 0,
.mmal_fmt = MMAL_ENCODING_Y14,
.size_multiplier_x2 = 2,
}
static inline unsigned int get_bytesperline(int width,
- struct bcm2835_codec_fmt *fmt)
+ struct bcm2835_codec_fmt *fmt,
+ enum bcm2835_codec_role role)
{
- return ALIGN((width * fmt->depth) >> 3, fmt->bytesperline_align);
+ return ALIGN((width * fmt->depth) >> 3, fmt->bytesperline_align[role]);
}
static void setup_mmal_port_format(struct bcm2835_codec_ctx *ctx,
*/
q_data->selection_set = true;
q_data->bytesperline = get_bytesperline(format->es.video.width,
- q_data->fmt);
+ q_data->fmt, ctx->dev->role);
q_data->height = format->es.video.height;
q_data->sizeimage = format->buffer_size_min;
f->fmt.pix_mp.height = ALIGN(f->fmt.pix_mp.height, 16);
}
f->fmt.pix_mp.num_planes = 1;
- min_bytesperline = get_bytesperline(f->fmt.pix_mp.width, fmt);
+ min_bytesperline = get_bytesperline(f->fmt.pix_mp.width, fmt,
+ ctx->dev->role);
if (f->fmt.pix_mp.plane_fmt[0].bytesperline < min_bytesperline)
f->fmt.pix_mp.plane_fmt[0].bytesperline = min_bytesperline;
f->fmt.pix_mp.plane_fmt[0].bytesperline =
- ALIGN(f->fmt.pix_mp.plane_fmt[0].bytesperline, fmt->bytesperline_align);
+ ALIGN(f->fmt.pix_mp.plane_fmt[0].bytesperline,
+ fmt->bytesperline_align[ctx->dev->role]);
sizeimage = get_sizeimage(f->fmt.pix_mp.plane_fmt[0].bytesperline,
f->fmt.pix_mp.width, f->fmt.pix_mp.height,
q_data_dst->height = ALIGN(q_data->crop_height, 16);
q_data_dst->bytesperline =
- get_bytesperline(f->fmt.pix_mp.width, q_data_dst->fmt);
+ get_bytesperline(f->fmt.pix_mp.width, q_data_dst->fmt,
+ ctx->dev->role);
q_data_dst->sizeimage = get_sizeimage(q_data_dst->bytesperline,
q_data_dst->crop_width,
q_data_dst->height,
}
}
break;
+ case NUM_ROLES:
+ break;
}
return 0;
}
break;
}
+ case NUM_ROLES:
+ break;
}
return 0;
ctx->q_data[V4L2_M2M_SRC].height = DEFAULT_HEIGHT;
ctx->q_data[V4L2_M2M_SRC].bytesperline =
get_bytesperline(DEFAULT_WIDTH,
- ctx->q_data[V4L2_M2M_SRC].fmt);
+ ctx->q_data[V4L2_M2M_SRC].fmt,
+ dev->role);
ctx->q_data[V4L2_M2M_SRC].sizeimage =
get_sizeimage(ctx->q_data[V4L2_M2M_SRC].bytesperline,
ctx->q_data[V4L2_M2M_SRC].crop_width,
ctx->q_data[V4L2_M2M_DST].height = DEFAULT_HEIGHT;
ctx->q_data[V4L2_M2M_DST].bytesperline =
get_bytesperline(DEFAULT_WIDTH,
- ctx->q_data[V4L2_M2M_DST].fmt);
+ ctx->q_data[V4L2_M2M_DST].fmt,
+ dev->role);
ctx->q_data[V4L2_M2M_DST].sizeimage =
get_sizeimage(ctx->q_data[V4L2_M2M_DST].bytesperline,
ctx->q_data[V4L2_M2M_DST].crop_width,
v4l2_ctrl_handler_init(hdl, 0);
}
break;
+ case NUM_ROLES:
+ break;
}
ctx->fh.m2m_ctx = v4l2_m2m_ctx_init(dev->m2m_dev, ctx, &queue_init);