Commit aec89917 authored by Dafna Hirschfeld's avatar Dafna Hirschfeld Committed by Mauro Carvalho Chehab

media: vicodec: prepare support for various number of planes

Add fields to the structs `fwht_raw_frame`, `v4l2_fwht_pixfmts`
to support various number of planes - formats
with alpha channel that have 4 planes and greyscale formats
that have 1 plane.
Signed-off-by: default avatarDafna Hirschfeld <dafna3@gmail.com>
Signed-off-by: default avatarHans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab+samsung@kernel.org>
parent 4e3f1405
...@@ -760,7 +760,7 @@ u32 fwht_encode_frame(struct fwht_raw_frame *frm, ...@@ -760,7 +760,7 @@ u32 fwht_encode_frame(struct fwht_raw_frame *frm,
rlco_max = rlco + size / 2 - 256; rlco_max = rlco + size / 2 - 256;
encoding = encode_plane(frm->luma, ref_frm->luma, &rlco, rlco_max, cf, encoding = encode_plane(frm->luma, ref_frm->luma, &rlco, rlco_max, cf,
frm->height, frm->width, frm->height, frm->width,
frm->luma_step, is_intra, next_is_intra); frm->luma_alpha_step, is_intra, next_is_intra);
if (encoding & FWHT_FRAME_UNENCODED) if (encoding & FWHT_FRAME_UNENCODED)
encoding |= FWHT_LUMA_UNENCODED; encoding |= FWHT_LUMA_UNENCODED;
encoding &= ~FWHT_FRAME_UNENCODED; encoding &= ~FWHT_FRAME_UNENCODED;
......
...@@ -104,9 +104,10 @@ struct fwht_raw_frame { ...@@ -104,9 +104,10 @@ struct fwht_raw_frame {
unsigned int width, height; unsigned int width, height;
unsigned int width_div; unsigned int width_div;
unsigned int height_div; unsigned int height_div;
unsigned int luma_step; unsigned int luma_alpha_step;
unsigned int chroma_step; unsigned int chroma_step;
u8 *luma, *cb, *cr; unsigned int components_num;
u8 *luma, *cb, *cr, *alpha;
}; };
#define FWHT_FRAME_PCODED BIT(0) #define FWHT_FRAME_PCODED BIT(0)
......
...@@ -11,27 +11,28 @@ ...@@ -11,27 +11,28 @@
#include "codec-v4l2-fwht.h" #include "codec-v4l2-fwht.h"
static const struct v4l2_fwht_pixfmt_info v4l2_fwht_pixfmts[] = { static const struct v4l2_fwht_pixfmt_info v4l2_fwht_pixfmts[] = {
{ V4L2_PIX_FMT_YUV420, 1, 3, 2, 1, 1, 2, 2 }, { V4L2_PIX_FMT_YUV420, 1, 3, 2, 1, 1, 2, 2, 3},
{ V4L2_PIX_FMT_YVU420, 1, 3, 2, 1, 1, 2, 2 }, { V4L2_PIX_FMT_YVU420, 1, 3, 2, 1, 1, 2, 2, 3},
{ V4L2_PIX_FMT_YUV422P, 1, 2, 1, 1, 1, 2, 1 }, { V4L2_PIX_FMT_YUV422P, 1, 2, 1, 1, 1, 2, 1, 3},
{ V4L2_PIX_FMT_NV12, 1, 3, 2, 1, 2, 2, 2 }, { V4L2_PIX_FMT_NV12, 1, 3, 2, 1, 2, 2, 2, 3},
{ V4L2_PIX_FMT_NV21, 1, 3, 2, 1, 2, 2, 2 }, { V4L2_PIX_FMT_NV21, 1, 3, 2, 1, 2, 2, 2, 3},
{ V4L2_PIX_FMT_NV16, 1, 2, 1, 1, 2, 2, 1 }, { V4L2_PIX_FMT_NV16, 1, 2, 1, 1, 2, 2, 1, 3},
{ V4L2_PIX_FMT_NV61, 1, 2, 1, 1, 2, 2, 1 }, { V4L2_PIX_FMT_NV61, 1, 2, 1, 1, 2, 2, 1, 3},
{ V4L2_PIX_FMT_NV24, 1, 3, 1, 1, 2, 1, 1 }, { V4L2_PIX_FMT_NV24, 1, 3, 1, 1, 2, 1, 1, 3},
{ V4L2_PIX_FMT_NV42, 1, 3, 1, 1, 2, 1, 1 }, { V4L2_PIX_FMT_NV42, 1, 3, 1, 1, 2, 1, 1, 3},
{ V4L2_PIX_FMT_YUYV, 2, 2, 1, 2, 4, 2, 1 }, { V4L2_PIX_FMT_YUYV, 2, 2, 1, 2, 4, 2, 1, 3},
{ V4L2_PIX_FMT_YVYU, 2, 2, 1, 2, 4, 2, 1 }, { V4L2_PIX_FMT_YVYU, 2, 2, 1, 2, 4, 2, 1, 3},
{ V4L2_PIX_FMT_UYVY, 2, 2, 1, 2, 4, 2, 1 }, { V4L2_PIX_FMT_UYVY, 2, 2, 1, 2, 4, 2, 1, 3},
{ V4L2_PIX_FMT_VYUY, 2, 2, 1, 2, 4, 2, 1 }, { V4L2_PIX_FMT_VYUY, 2, 2, 1, 2, 4, 2, 1, 3},
{ V4L2_PIX_FMT_BGR24, 3, 3, 1, 3, 3, 1, 1 }, { V4L2_PIX_FMT_BGR24, 3, 3, 1, 3, 3, 1, 1, 3},
{ V4L2_PIX_FMT_RGB24, 3, 3, 1, 3, 3, 1, 1 }, { V4L2_PIX_FMT_RGB24, 3, 3, 1, 3, 3, 1, 1, 3},
{ V4L2_PIX_FMT_HSV24, 3, 3, 1, 3, 3, 1, 1 }, { V4L2_PIX_FMT_HSV24, 3, 3, 1, 3, 3, 1, 1, 3},
{ V4L2_PIX_FMT_BGR32, 4, 4, 1, 4, 4, 1, 1 }, { V4L2_PIX_FMT_BGR32, 4, 4, 1, 4, 4, 1, 1, 3},
{ V4L2_PIX_FMT_XBGR32, 4, 4, 1, 4, 4, 1, 1 }, { V4L2_PIX_FMT_XBGR32, 4, 4, 1, 4, 4, 1, 1, 3},
{ V4L2_PIX_FMT_RGB32, 4, 4, 1, 4, 4, 1, 1 }, { V4L2_PIX_FMT_RGB32, 4, 4, 1, 4, 4, 1, 1, 3},
{ V4L2_PIX_FMT_XRGB32, 4, 4, 1, 4, 4, 1, 1 }, { V4L2_PIX_FMT_XRGB32, 4, 4, 1, 4, 4, 1, 1, 3},
{ V4L2_PIX_FMT_HSV32, 4, 4, 1, 4, 4, 1, 1 }, { V4L2_PIX_FMT_HSV32, 4, 4, 1, 4, 4, 1, 1, 3},
}; };
const struct v4l2_fwht_pixfmt_info *v4l2_fwht_find_pixfmt(u32 pixelformat) const struct v4l2_fwht_pixfmt_info *v4l2_fwht_find_pixfmt(u32 pixelformat)
...@@ -68,8 +69,10 @@ int v4l2_fwht_encode(struct v4l2_fwht_state *state, u8 *p_in, u8 *p_out) ...@@ -68,8 +69,10 @@ int v4l2_fwht_encode(struct v4l2_fwht_state *state, u8 *p_in, u8 *p_out)
rf.luma = p_in; rf.luma = p_in;
rf.width_div = info->width_div; rf.width_div = info->width_div;
rf.height_div = info->height_div; rf.height_div = info->height_div;
rf.luma_step = info->luma_step; rf.luma_alpha_step = info->luma_alpha_step;
rf.chroma_step = info->chroma_step; rf.chroma_step = info->chroma_step;
rf.alpha = NULL;
rf.components_num = info->components_num;
switch (info->id) { switch (info->id) {
case V4L2_PIX_FMT_YUV420: case V4L2_PIX_FMT_YUV420:
......
...@@ -13,11 +13,12 @@ struct v4l2_fwht_pixfmt_info { ...@@ -13,11 +13,12 @@ struct v4l2_fwht_pixfmt_info {
unsigned int bytesperline_mult; unsigned int bytesperline_mult;
unsigned int sizeimage_mult; unsigned int sizeimage_mult;
unsigned int sizeimage_div; unsigned int sizeimage_div;
unsigned int luma_step; unsigned int luma_alpha_step;
unsigned int chroma_step; unsigned int chroma_step;
/* Chroma plane subsampling */ /* Chroma plane subsampling */
unsigned int width_div; unsigned int width_div;
unsigned int height_div; unsigned int height_div;
unsigned int components_num;
}; };
struct v4l2_fwht_state { struct v4l2_fwht_state {
......
...@@ -61,7 +61,7 @@ struct pixfmt_info { ...@@ -61,7 +61,7 @@ struct pixfmt_info {
}; };
static const struct v4l2_fwht_pixfmt_info pixfmt_fwht = { static const struct v4l2_fwht_pixfmt_info pixfmt_fwht = {
V4L2_PIX_FMT_FWHT, 0, 3, 1, 1, 1, 1, 1 V4L2_PIX_FMT_FWHT, 0, 3, 1, 1, 1, 1, 1, 0
}; };
static void vicodec_dev_release(struct device *dev) static void vicodec_dev_release(struct device *dev)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment