struct vicodec_q_data {
unsigned int width;
unsigned int height;
- unsigned int flags;
unsigned int sizeimage;
unsigned int sequence;
const struct pixfmt_info *info;
static void encode(struct vicodec_ctx *ctx,
struct vicodec_q_data *q_data,
- u8 *p_in, u8 *p_out)
+ u8 *p_in, u8 *p_out, u32 flags)
{
unsigned int size = q_data->width * q_data->height;
const struct pixfmt_info *info = q_data->info;
p_hdr->version = htonl(VICODEC_VERSION);
p_hdr->width = htonl(cf.width);
p_hdr->height = htonl(cf.height);
- p_hdr->flags = htonl(q_data->flags);
if (encoding & LUMA_UNENCODED)
- p_hdr->flags |= htonl(VICODEC_FL_LUMA_IS_UNCOMPRESSED);
+ flags |= VICODEC_FL_LUMA_IS_UNCOMPRESSED;
if (encoding & CB_UNENCODED)
- p_hdr->flags |= htonl(VICODEC_FL_CB_IS_UNCOMPRESSED);
+ flags |= VICODEC_FL_CB_IS_UNCOMPRESSED;
if (encoding & CR_UNENCODED)
- p_hdr->flags |= htonl(VICODEC_FL_CR_IS_UNCOMPRESSED);
+ flags |= VICODEC_FL_CR_IS_UNCOMPRESSED;
if (rf.height_div == 1)
- p_hdr->flags |= htonl(VICODEC_FL_CHROMA_FULL_HEIGHT);
+ flags |= VICODEC_FL_CHROMA_FULL_HEIGHT;
if (rf.width_div == 1)
- p_hdr->flags |= htonl(VICODEC_FL_CHROMA_FULL_WIDTH);
+ flags |= VICODEC_FL_CHROMA_FULL_WIDTH;
+ p_hdr->flags = htonl(flags);
p_hdr->colorspace = htonl(ctx->colorspace);
p_hdr->xfer_func = htonl(ctx->xfer_func);
p_hdr->ycbcr_enc = htonl(ctx->ycbcr_enc);
unsigned int size = q_data->width * q_data->height;
unsigned int chroma_size = size;
unsigned int i;
+ u32 flags;
struct cframe_hdr *p_hdr;
struct cframe cf;
u8 *p;
p_hdr = (struct cframe_hdr *)p_in;
cf.width = ntohl(p_hdr->width);
cf.height = ntohl(p_hdr->height);
- q_data->flags = ntohl(p_hdr->flags);
+ flags = ntohl(p_hdr->flags);
ctx->colorspace = ntohl(p_hdr->colorspace);
ctx->xfer_func = ntohl(p_hdr->xfer_func);
ctx->ycbcr_enc = ntohl(p_hdr->ycbcr_enc);
if (cf.width != q_data->width || cf.height != q_data->height)
return -EINVAL;
- if (!(q_data->flags & VICODEC_FL_CHROMA_FULL_WIDTH))
+ if (!(flags & VICODEC_FL_CHROMA_FULL_WIDTH))
chroma_size /= 2;
- if (!(q_data->flags & VICODEC_FL_CHROMA_FULL_HEIGHT))
+ if (!(flags & VICODEC_FL_CHROMA_FULL_HEIGHT))
chroma_size /= 2;
- decode_frame(&cf, &ctx->ref_frame, q_data->flags);
+ decode_frame(&cf, &ctx->ref_frame, flags);
switch (q_data->info->id) {
case V4L2_PIX_FMT_YUV420:
if (ctx->is_enc) {
struct cframe_hdr *p_hdr = (struct cframe_hdr *)p_out;
- encode(ctx, q_out, p_in, p_out);
+ encode(ctx, q_out, p_in, p_out, 0);
vb2_set_plane_payload(&out_vb->vb2_buf, 0,
sizeof(*p_hdr) + ntohl(p_hdr->size));
} else {