Commit 3abfc314 authored by Hans Verkuil's avatar Hans Verkuil Committed by Mauro Carvalho Chehab

media: vicodec: add V4L2_ prefix before FWHT_VERSION and FWHT_FL_*

The FWHT stateless 'uAPI' was staging and marked explicitly in the
V4L2 specification that it will change and is unstable.
Note that these control IDs were never exported as a public API,
they were only defined at the driver's code.

While not too late, let's rename them is preparation for promoting
the stateless FWHT codec API as a public API.
Signed-off-by: default avatarHans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab+huawei@kernel.org>
parent 7403fa17
...@@ -2284,52 +2284,52 @@ FWHT Flags ...@@ -2284,52 +2284,52 @@ FWHT Flags
:stub-columns: 0 :stub-columns: 0
:widths: 3 1 4 :widths: 3 1 4
* - ``FWHT_FL_IS_INTERLACED`` * - ``V4L2_FWHT_FL_IS_INTERLACED``
- 0x00000001 - 0x00000001
- Set if this is an interlaced format - Set if this is an interlaced format
* - ``FWHT_FL_IS_BOTTOM_FIRST`` * - ``V4L2_FWHT_FL_IS_BOTTOM_FIRST``
- 0x00000002 - 0x00000002
- Set if this is a bottom-first (NTSC) interlaced format - Set if this is a bottom-first (NTSC) interlaced format
* - ``FWHT_FL_IS_ALTERNATE`` * - ``V4L2_FWHT_FL_IS_ALTERNATE``
- 0x00000004 - 0x00000004
- Set if each 'frame' contains just one field - Set if each 'frame' contains just one field
* - ``FWHT_FL_IS_BOTTOM_FIELD`` * - ``V4L2_FWHT_FL_IS_BOTTOM_FIELD``
- 0x00000008 - 0x00000008
- If FWHT_FL_IS_ALTERNATE was set, then this is set if this 'frame' is the - If V4L2_FWHT_FL_IS_ALTERNATE was set, then this is set if this 'frame' is the
bottom field, else it is the top field. bottom field, else it is the top field.
* - ``FWHT_FL_LUMA_IS_UNCOMPRESSED`` * - ``V4L2_FWHT_FL_LUMA_IS_UNCOMPRESSED``
- 0x00000010 - 0x00000010
- Set if the luma plane is uncompressed - Set if the luma plane is uncompressed
* - ``FWHT_FL_CB_IS_UNCOMPRESSED`` * - ``V4L2_FWHT_FL_CB_IS_UNCOMPRESSED``
- 0x00000020 - 0x00000020
- Set if the cb plane is uncompressed - Set if the cb plane is uncompressed
* - ``FWHT_FL_CR_IS_UNCOMPRESSED`` * - ``V4L2_FWHT_FL_CR_IS_UNCOMPRESSED``
- 0x00000040 - 0x00000040
- Set if the cr plane is uncompressed - Set if the cr plane is uncompressed
* - ``FWHT_FL_CHROMA_FULL_HEIGHT`` * - ``V4L2_FWHT_FL_CHROMA_FULL_HEIGHT``
- 0x00000080 - 0x00000080
- Set if the chroma plane has the same height as the luma plane, - Set if the chroma plane has the same height as the luma plane,
else the chroma plane is half the height of the luma plane else the chroma plane is half the height of the luma plane
* - ``FWHT_FL_CHROMA_FULL_WIDTH`` * - ``V4L2_FWHT_FL_CHROMA_FULL_WIDTH``
- 0x00000100 - 0x00000100
- Set if the chroma plane has the same width as the luma plane, - Set if the chroma plane has the same width as the luma plane,
else the chroma plane is half the width of the luma plane else the chroma plane is half the width of the luma plane
* - ``FWHT_FL_ALPHA_IS_UNCOMPRESSED`` * - ``V4L2_FWHT_FL_ALPHA_IS_UNCOMPRESSED``
- 0x00000200 - 0x00000200
- Set if the alpha plane is uncompressed - Set if the alpha plane is uncompressed
* - ``FWHT_FL_I_FRAME`` * - ``V4L2_FWHT_FL_I_FRAME``
- 0x00000400 - 0x00000400
- Set if this is an I-frame - Set if this is an I-frame
* - ``FWHT_FL_COMPONENTS_NUM_MSK`` * - ``V4L2_FWHT_FL_COMPONENTS_NUM_MSK``
- 0x00070000 - 0x00070000
- A 4-values flag - the number of components - 1 - A 4-values flag - the number of components - 1
* - ``FWHT_FL_PIXENC_YUV`` * - ``V4L2_FWHT_FL_PIXENC_YUV``
- 0x00080000 - 0x00080000
- Set if the pixel encoding is YUV - Set if the pixel encoding is YUV
* - ``FWHT_FL_PIXENC_RGB`` * - ``V4L2_FWHT_FL_PIXENC_RGB``
- 0x00100000 - 0x00100000
- Set if the pixel encoding is RGB - Set if the pixel encoding is RGB
* - ``FWHT_FL_PIXENC_HSV`` * - ``V4L2_FWHT_FL_PIXENC_HSV``
- 0x00180000 - 0x00180000
- Set if the pixel encoding is HSV - Set if the pixel encoding is HSV
......
...@@ -920,7 +920,7 @@ bool fwht_decode_frame(struct fwht_cframe *cf, u32 hdr_flags, ...@@ -920,7 +920,7 @@ bool fwht_decode_frame(struct fwht_cframe *cf, u32 hdr_flags,
if (!decode_plane(cf, &rlco, height, width, ref->luma, ref_stride, if (!decode_plane(cf, &rlco, height, width, ref->luma, ref_stride,
ref->luma_alpha_step, dst->luma, dst_stride, ref->luma_alpha_step, dst->luma, dst_stride,
dst->luma_alpha_step, dst->luma_alpha_step,
hdr_flags & FWHT_FL_LUMA_IS_UNCOMPRESSED, hdr_flags & V4L2_FWHT_FL_LUMA_IS_UNCOMPRESSED,
end_of_rlco_buf)) end_of_rlco_buf))
return false; return false;
...@@ -928,21 +928,21 @@ bool fwht_decode_frame(struct fwht_cframe *cf, u32 hdr_flags, ...@@ -928,21 +928,21 @@ bool fwht_decode_frame(struct fwht_cframe *cf, u32 hdr_flags,
u32 h = height; u32 h = height;
u32 w = width; u32 w = width;
if (!(hdr_flags & FWHT_FL_CHROMA_FULL_HEIGHT)) if (!(hdr_flags & V4L2_FWHT_FL_CHROMA_FULL_HEIGHT))
h /= 2; h /= 2;
if (!(hdr_flags & FWHT_FL_CHROMA_FULL_WIDTH)) if (!(hdr_flags & V4L2_FWHT_FL_CHROMA_FULL_WIDTH))
w /= 2; w /= 2;
if (!decode_plane(cf, &rlco, h, w, ref->cb, ref_chroma_stride, if (!decode_plane(cf, &rlco, h, w, ref->cb, ref_chroma_stride,
ref->chroma_step, dst->cb, dst_chroma_stride, ref->chroma_step, dst->cb, dst_chroma_stride,
dst->chroma_step, dst->chroma_step,
hdr_flags & FWHT_FL_CB_IS_UNCOMPRESSED, hdr_flags & V4L2_FWHT_FL_CB_IS_UNCOMPRESSED,
end_of_rlco_buf)) end_of_rlco_buf))
return false; return false;
if (!decode_plane(cf, &rlco, h, w, ref->cr, ref_chroma_stride, if (!decode_plane(cf, &rlco, h, w, ref->cr, ref_chroma_stride,
ref->chroma_step, dst->cr, dst_chroma_stride, ref->chroma_step, dst->cr, dst_chroma_stride,
dst->chroma_step, dst->chroma_step,
hdr_flags & FWHT_FL_CR_IS_UNCOMPRESSED, hdr_flags & V4L2_FWHT_FL_CR_IS_UNCOMPRESSED,
end_of_rlco_buf)) end_of_rlco_buf))
return false; return false;
} }
...@@ -951,7 +951,7 @@ bool fwht_decode_frame(struct fwht_cframe *cf, u32 hdr_flags, ...@@ -951,7 +951,7 @@ bool fwht_decode_frame(struct fwht_cframe *cf, u32 hdr_flags,
if (!decode_plane(cf, &rlco, height, width, ref->alpha, ref_stride, if (!decode_plane(cf, &rlco, height, width, ref->alpha, ref_stride,
ref->luma_alpha_step, dst->alpha, dst_stride, ref->luma_alpha_step, dst->alpha, dst_stride,
dst->luma_alpha_step, dst->luma_alpha_step,
hdr_flags & FWHT_FL_ALPHA_IS_UNCOMPRESSED, hdr_flags & V4L2_FWHT_FL_ALPHA_IS_UNCOMPRESSED,
end_of_rlco_buf)) end_of_rlco_buf))
return false; return false;
return true; return true;
......
...@@ -56,37 +56,37 @@ ...@@ -56,37 +56,37 @@
#define FWHT_MAGIC1 0x4f4f4f4f #define FWHT_MAGIC1 0x4f4f4f4f
#define FWHT_MAGIC2 0xffffffff #define FWHT_MAGIC2 0xffffffff
#define FWHT_VERSION 3 #define V4L2_FWHT_VERSION 3
/* Set if this is an interlaced format */ /* Set if this is an interlaced format */
#define FWHT_FL_IS_INTERLACED BIT(0) #define V4L2_FWHT_FL_IS_INTERLACED BIT(0)
/* Set if this is a bottom-first (NTSC) interlaced format */ /* Set if this is a bottom-first (NTSC) interlaced format */
#define FWHT_FL_IS_BOTTOM_FIRST BIT(1) #define V4L2_FWHT_FL_IS_BOTTOM_FIRST BIT(1)
/* Set if each 'frame' contains just one field */ /* Set if each 'frame' contains just one field */
#define FWHT_FL_IS_ALTERNATE BIT(2) #define V4L2_FWHT_FL_IS_ALTERNATE BIT(2)
/* /*
* If FWHT_FL_IS_ALTERNATE was set, then this is set if this * If V4L2_FWHT_FL_IS_ALTERNATE was set, then this is set if this
* 'frame' is the bottom field, else it is the top field. * 'frame' is the bottom field, else it is the top field.
*/ */
#define FWHT_FL_IS_BOTTOM_FIELD BIT(3) #define V4L2_FWHT_FL_IS_BOTTOM_FIELD BIT(3)
/* Set if this frame is uncompressed */ /* Set if this frame is uncompressed */
#define FWHT_FL_LUMA_IS_UNCOMPRESSED BIT(4) #define V4L2_FWHT_FL_LUMA_IS_UNCOMPRESSED BIT(4)
#define FWHT_FL_CB_IS_UNCOMPRESSED BIT(5) #define V4L2_FWHT_FL_CB_IS_UNCOMPRESSED BIT(5)
#define FWHT_FL_CR_IS_UNCOMPRESSED BIT(6) #define V4L2_FWHT_FL_CR_IS_UNCOMPRESSED BIT(6)
#define FWHT_FL_CHROMA_FULL_HEIGHT BIT(7) #define V4L2_FWHT_FL_CHROMA_FULL_HEIGHT BIT(7)
#define FWHT_FL_CHROMA_FULL_WIDTH BIT(8) #define V4L2_FWHT_FL_CHROMA_FULL_WIDTH BIT(8)
#define FWHT_FL_ALPHA_IS_UNCOMPRESSED BIT(9) #define V4L2_FWHT_FL_ALPHA_IS_UNCOMPRESSED BIT(9)
#define FWHT_FL_I_FRAME BIT(10) #define V4L2_FWHT_FL_I_FRAME BIT(10)
/* A 4-values flag - the number of components - 1 */ /* A 4-values flag - the number of components - 1 */
#define FWHT_FL_COMPONENTS_NUM_MSK GENMASK(18, 16) #define V4L2_FWHT_FL_COMPONENTS_NUM_MSK GENMASK(18, 16)
#define FWHT_FL_COMPONENTS_NUM_OFFSET 16 #define V4L2_FWHT_FL_COMPONENTS_NUM_OFFSET 16
#define FWHT_FL_PIXENC_MSK GENMASK(20, 19) #define V4L2_FWHT_FL_PIXENC_MSK GENMASK(20, 19)
#define FWHT_FL_PIXENC_OFFSET 19 #define V4L2_FWHT_FL_PIXENC_OFFSET 19
#define FWHT_FL_PIXENC_YUV (1 << FWHT_FL_PIXENC_OFFSET) #define V4L2_FWHT_FL_PIXENC_YUV (1 << V4L2_FWHT_FL_PIXENC_OFFSET)
#define FWHT_FL_PIXENC_RGB (2 << FWHT_FL_PIXENC_OFFSET) #define V4L2_FWHT_FL_PIXENC_RGB (2 << V4L2_FWHT_FL_PIXENC_OFFSET)
#define FWHT_FL_PIXENC_HSV (3 << FWHT_FL_PIXENC_OFFSET) #define V4L2_FWHT_FL_PIXENC_HSV (3 << V4L2_FWHT_FL_PIXENC_OFFSET)
/* /*
* A macro to calculate the needed padding in order to make sure * A macro to calculate the needed padding in order to make sure
......
...@@ -11,34 +11,34 @@ ...@@ -11,34 +11,34 @@
#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, 3, 3, FWHT_FL_PIXENC_YUV}, { V4L2_PIX_FMT_YUV420, 1, 3, 2, 1, 1, 2, 2, 3, 3, V4L2_FWHT_FL_PIXENC_YUV},
{ V4L2_PIX_FMT_YVU420, 1, 3, 2, 1, 1, 2, 2, 3, 3, FWHT_FL_PIXENC_YUV}, { V4L2_PIX_FMT_YVU420, 1, 3, 2, 1, 1, 2, 2, 3, 3, V4L2_FWHT_FL_PIXENC_YUV},
{ V4L2_PIX_FMT_YUV422P, 1, 2, 1, 1, 1, 2, 1, 3, 3, FWHT_FL_PIXENC_YUV}, { V4L2_PIX_FMT_YUV422P, 1, 2, 1, 1, 1, 2, 1, 3, 3, V4L2_FWHT_FL_PIXENC_YUV},
{ V4L2_PIX_FMT_NV12, 1, 3, 2, 1, 2, 2, 2, 3, 2, FWHT_FL_PIXENC_YUV}, { V4L2_PIX_FMT_NV12, 1, 3, 2, 1, 2, 2, 2, 3, 2, V4L2_FW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XENC_HSV}, { V4L2_PIX_FMT_HSV32, 4, 4, 1, 4, 4, 1, 1, 4, 1, V4L2_FWHT_FL_PIXENC_HSV},
{ V4L2_PIX_FMT_GREY, 1, 1, 1, 1, 0, 1, 1, 1, 1, FWHT_FL_PIXENC_RGB}, { V4L2_PIX_FMT_GREY, 1, 1, 1, 1, 0, 1, 1, 1, 1, V4L2_FWHT_FL_PIXENC_RGB},
}; };
bool v4l2_fwht_validate_fmt(const struct v4l2_fwht_pixfmt_info *info, bool v4l2_fwht_validate_fmt(const struct v4l2_fwht_pixfmt_info *info,
...@@ -251,25 +251,25 @@ int v4l2_fwht_encode(struct v4l2_fwht_state *state, u8 *p_in, u8 *p_out) ...@@ -251,25 +251,25 @@ int v4l2_fwht_encode(struct v4l2_fwht_state *state, u8 *p_in, u8 *p_out)
p_hdr = (struct fwht_cframe_hdr *)p_out; p_hdr = (struct fwht_cframe_hdr *)p_out;
p_hdr->magic1 = FWHT_MAGIC1; p_hdr->magic1 = FWHT_MAGIC1;
p_hdr->magic2 = FWHT_MAGIC2; p_hdr->magic2 = FWHT_MAGIC2;
p_hdr->version = htonl(FWHT_VERSION); p_hdr->version = htonl(V4L2_FWHT_VERSION);
p_hdr->width = htonl(state->visible_width); p_hdr->width = htonl(state->visible_width);
p_hdr->height = htonl(state->visible_height); p_hdr->height = htonl(state->visible_height);
flags |= (info->components_num - 1) << FWHT_FL_COMPONENTS_NUM_OFFSET; flags |= (info->components_num - 1) << V4L2_FWHT_FL_COMPONENTS_NUM_OFFSET;
flags |= info->pixenc; flags |= info->pixenc;
if (encoding & FWHT_LUMA_UNENCODED) if (encoding & FWHT_LUMA_UNENCODED)
flags |= FWHT_FL_LUMA_IS_UNCOMPRESSED; flags |= V4L2_FWHT_FL_LUMA_IS_UNCOMPRESSED;
if (encoding & FWHT_CB_UNENCODED) if (encoding & FWHT_CB_UNENCODED)
flags |= FWHT_FL_CB_IS_UNCOMPRESSED; flags |= V4L2_FWHT_FL_CB_IS_UNCOMPRESSED;
if (encoding & FWHT_CR_UNENCODED) if (encoding & FWHT_CR_UNENCODED)
flags |= FWHT_FL_CR_IS_UNCOMPRESSED; flags |= V4L2_FWHT_FL_CR_IS_UNCOMPRESSED;
if (encoding & FWHT_ALPHA_UNENCODED) if (encoding & FWHT_ALPHA_UNENCODED)
flags |= FWHT_FL_ALPHA_IS_UNCOMPRESSED; flags |= V4L2_FWHT_FL_ALPHA_IS_UNCOMPRESSED;
if (!(encoding & FWHT_FRAME_PCODED)) if (!(encoding & FWHT_FRAME_PCODED))
flags |= FWHT_FL_I_FRAME; flags |= V4L2_FWHT_FL_I_FRAME;
if (rf.height_div == 1) if (rf.height_div == 1)
flags |= FWHT_FL_CHROMA_FULL_HEIGHT; flags |= V4L2_FWHT_FL_CHROMA_FULL_HEIGHT;
if (rf.width_div == 1) if (rf.width_div == 1)
flags |= FWHT_FL_CHROMA_FULL_WIDTH; flags |= V4L2_FWHT_FL_CHROMA_FULL_WIDTH;
p_hdr->flags = htonl(flags); p_hdr->flags = htonl(flags);
p_hdr->colorspace = htonl(state->colorspace); p_hdr->colorspace = htonl(state->colorspace);
p_hdr->xfer_func = htonl(state->xfer_func); p_hdr->xfer_func = htonl(state->xfer_func);
...@@ -299,9 +299,9 @@ int v4l2_fwht_decode(struct v4l2_fwht_state *state, u8 *p_in, u8 *p_out) ...@@ -299,9 +299,9 @@ int v4l2_fwht_decode(struct v4l2_fwht_state *state, u8 *p_in, u8 *p_out)
info = state->info; info = state->info;
version = ntohl(state->header.version); version = ntohl(state->header.version);
if (!version || version > FWHT_VERSION) { if (!version || version > V4L2_FWHT_VERSION) {
pr_err("version %d is not supported, current version is %d\n", pr_err("version %d is not supported, current version is %d\n",
version, FWHT_VERSION); version, V4L2_FWHT_VERSION);
return -EINVAL; return -EINVAL;
} }
...@@ -317,10 +317,10 @@ int v4l2_fwht_decode(struct v4l2_fwht_state *state, u8 *p_in, u8 *p_out) ...@@ -317,10 +317,10 @@ int v4l2_fwht_decode(struct v4l2_fwht_state *state, u8 *p_in, u8 *p_out)
flags = ntohl(state->header.flags); flags = ntohl(state->header.flags);
if (version >= 2) { if (version >= 2) {
if ((flags & FWHT_FL_PIXENC_MSK) != info->pixenc) if ((flags & V4L2_FWHT_FL_PIXENC_MSK) != info->pixenc)
return -EINVAL; return -EINVAL;
components_num = 1 + ((flags & FWHT_FL_COMPONENTS_NUM_MSK) >> components_num = 1 + ((flags & V4L2_FWHT_FL_COMPONENTS_NUM_MSK) >>
FWHT_FL_COMPONENTS_NUM_OFFSET); V4L2_FWHT_FL_COMPONENTS_NUM_OFFSET);
} }
if (components_num != info->components_num) if (components_num != info->components_num)
...@@ -333,8 +333,8 @@ int v4l2_fwht_decode(struct v4l2_fwht_state *state, u8 *p_in, u8 *p_out) ...@@ -333,8 +333,8 @@ int v4l2_fwht_decode(struct v4l2_fwht_state *state, u8 *p_in, u8 *p_out)
cf.rlc_data = (__be16 *)p_in; cf.rlc_data = (__be16 *)p_in;
cf.size = ntohl(state->header.size); cf.size = ntohl(state->header.size);
hdr_width_div = (flags & FWHT_FL_CHROMA_FULL_WIDTH) ? 1 : 2; hdr_width_div = (flags & V4L2_FWHT_FL_CHROMA_FULL_WIDTH) ? 1 : 2;
hdr_height_div = (flags & FWHT_FL_CHROMA_FULL_HEIGHT) ? 1 : 2; hdr_height_div = (flags & V4L2_FWHT_FL_CHROMA_FULL_HEIGHT) ? 1 : 2;
if (hdr_width_div != info->width_div || if (hdr_width_div != info->width_div ||
hdr_height_div != info->height_div) hdr_height_div != info->height_div)
return -EINVAL; return -EINVAL;
......
...@@ -200,14 +200,14 @@ static void copy_cap_to_ref(const u8 *cap, const struct v4l2_fwht_pixfmt_info *i ...@@ -200,14 +200,14 @@ static void copy_cap_to_ref(const u8 *cap, const struct v4l2_fwht_pixfmt_info *i
static bool validate_by_version(unsigned int flags, unsigned int version) static bool validate_by_version(unsigned int flags, unsigned int version)
{ {
if (!version || version > FWHT_VERSION) if (!version || version > V4L2_FWHT_VERSION)
return false; return false;
if (version >= 2) { if (version >= 2) {
unsigned int components_num = 1 + unsigned int components_num = 1 +
((flags & FWHT_FL_COMPONENTS_NUM_MSK) >> ((flags & V4L2_FWHT_FL_COMPONENTS_NUM_MSK) >>
FWHT_FL_COMPONENTS_NUM_OFFSET); V4L2_FWHT_FL_COMPONENTS_NUM_OFFSET);
unsigned int pixenc = flags & FWHT_FL_PIXENC_MSK; unsigned int pixenc = flags & V4L2_FWHT_FL_PIXENC_MSK;
if (components_num == 0 || components_num > 4 || !pixenc) if (components_num == 0 || components_num > 4 || !pixenc)
return false; return false;
...@@ -219,18 +219,18 @@ static bool validate_stateless_params_flags(const struct v4l2_ctrl_fwht_params * ...@@ -219,18 +219,18 @@ static bool validate_stateless_params_flags(const struct v4l2_ctrl_fwht_params *
const struct v4l2_fwht_pixfmt_info *cur_info) const struct v4l2_fwht_pixfmt_info *cur_info)
{ {
unsigned int width_div = unsigned int width_div =
(params->flags & FWHT_FL_CHROMA_FULL_WIDTH) ? 1 : 2; (params->flags & V4L2_FWHT_FL_CHROMA_FULL_WIDTH) ? 1 : 2;
unsigned int height_div = unsigned int height_div =
(params->flags & FWHT_FL_CHROMA_FULL_HEIGHT) ? 1 : 2; (params->flags & V4L2_FWHT_FL_CHROMA_FULL_HEIGHT) ? 1 : 2;
unsigned int components_num = 3; unsigned int components_num = 3;
unsigned int pixenc = 0; unsigned int pixenc = 0;
if (params->version < 3) if (params->version < 3)
return false; return false;
components_num = 1 + ((params->flags & FWHT_FL_COMPONENTS_NUM_MSK) >> components_num = 1 + ((params->flags & V4L2_FWHT_FL_COMPONENTS_NUM_MSK) >>
FWHT_FL_COMPONENTS_NUM_OFFSET); V4L2_FWHT_FL_COMPONENTS_NUM_OFFSET);
pixenc = (params->flags & FWHT_FL_PIXENC_MSK); pixenc = (params->flags & V4L2_FWHT_FL_PIXENC_MSK);
if (v4l2_fwht_validate_fmt(cur_info, width_div, height_div, if (v4l2_fwht_validate_fmt(cur_info, width_div, height_div,
components_num, pixenc)) components_num, pixenc))
return true; return true;
...@@ -278,7 +278,7 @@ static int device_process(struct vicodec_ctx *ctx, ...@@ -278,7 +278,7 @@ static int device_process(struct vicodec_ctx *ctx,
* set the reference buffer from the reference timestamp * set the reference buffer from the reference timestamp
* only if this is a P-frame * only if this is a P-frame
*/ */
if (!(ntohl(ctx->state.header.flags) & FWHT_FL_I_FRAME)) { if (!(ntohl(ctx->state.header.flags) & V4L2_FWHT_FL_I_FRAME)) {
struct vb2_buffer *ref_vb2_buf; struct vb2_buffer *ref_vb2_buf;
int ref_buf_idx; int ref_buf_idx;
struct vb2_queue *vq_cap = struct vb2_queue *vq_cap =
...@@ -331,7 +331,7 @@ static int device_process(struct vicodec_ctx *ctx, ...@@ -331,7 +331,7 @@ static int device_process(struct vicodec_ctx *ctx,
copy_cap_to_ref(p_dst, ctx->state.info, &ctx->state); copy_cap_to_ref(p_dst, ctx->state.info, &ctx->state);
vb2_set_plane_payload(&dst_vb->vb2_buf, 0, q_dst->sizeimage); vb2_set_plane_payload(&dst_vb->vb2_buf, 0, q_dst->sizeimage);
if (ntohl(ctx->state.header.flags) & FWHT_FL_I_FRAME) if (ntohl(ctx->state.header.flags) & V4L2_FWHT_FL_I_FRAME)
dst_vb->flags |= V4L2_BUF_FLAG_KEYFRAME; dst_vb->flags |= V4L2_BUF_FLAG_KEYFRAME;
else else
dst_vb->flags |= V4L2_BUF_FLAG_PFRAME; dst_vb->flags |= V4L2_BUF_FLAG_PFRAME;
...@@ -480,16 +480,16 @@ static const struct v4l2_fwht_pixfmt_info * ...@@ -480,16 +480,16 @@ static const struct v4l2_fwht_pixfmt_info *
info_from_header(const struct fwht_cframe_hdr *p_hdr) info_from_header(const struct fwht_cframe_hdr *p_hdr)
{ {
unsigned int flags = ntohl(p_hdr->flags); unsigned int flags = ntohl(p_hdr->flags);
unsigned int width_div = (flags & FWHT_FL_CHROMA_FULL_WIDTH) ? 1 : 2; unsigned int width_div = (flags & V4L2_FWHT_FL_CHROMA_FULL_WIDTH) ? 1 : 2;
unsigned int height_div = (flags & FWHT_FL_CHROMA_FULL_HEIGHT) ? 1 : 2; unsigned int height_div = (flags & V4L2_FWHT_FL_CHROMA_FULL_HEIGHT) ? 1 : 2;
unsigned int components_num = 3; unsigned int components_num = 3;
unsigned int pixenc = 0; unsigned int pixenc = 0;
unsigned int version = ntohl(p_hdr->version); unsigned int version = ntohl(p_hdr->version);
if (version >= 2) { if (version >= 2) {
components_num = 1 + ((flags & FWHT_FL_COMPONENTS_NUM_MSK) >> components_num = 1 + ((flags & V4L2_FWHT_FL_COMPONENTS_NUM_MSK) >>
FWHT_FL_COMPONENTS_NUM_OFFSET); V4L2_FWHT_FL_COMPONENTS_NUM_OFFSET);
pixenc = (flags & FWHT_FL_PIXENC_MSK); pixenc = (flags & V4L2_FWHT_FL_PIXENC_MSK);
} }
return v4l2_fwht_find_nth_fmt(width_div, height_div, return v4l2_fwht_find_nth_fmt(width_div, height_div,
components_num, pixenc, 0); components_num, pixenc, 0);
...@@ -522,8 +522,8 @@ static void update_capture_data_from_header(struct vicodec_ctx *ctx) ...@@ -522,8 +522,8 @@ static void update_capture_data_from_header(struct vicodec_ctx *ctx)
const struct fwht_cframe_hdr *p_hdr = &ctx->state.header; const struct fwht_cframe_hdr *p_hdr = &ctx->state.header;
const struct v4l2_fwht_pixfmt_info *info = info_from_header(p_hdr); const struct v4l2_fwht_pixfmt_info *info = info_from_header(p_hdr);
unsigned int flags = ntohl(p_hdr->flags); unsigned int flags = ntohl(p_hdr->flags);
unsigned int hdr_width_div = (flags & FWHT_FL_CHROMA_FULL_WIDTH) ? 1 : 2; unsigned int hdr_width_div = (flags & V4L2_FWHT_FL_CHROMA_FULL_WIDTH) ? 1 : 2;
unsigned int hdr_height_div = (flags & FWHT_FL_CHROMA_FULL_HEIGHT) ? 1 : 2; unsigned int hdr_height_div = (flags & V4L2_FWHT_FL_CHROMA_FULL_HEIGHT) ? 1 : 2;
/* /*
* This function should not be used by a stateless codec since * This function should not be used by a stateless codec since
...@@ -657,8 +657,8 @@ static int job_ready(void *priv) ...@@ -657,8 +657,8 @@ static int job_ready(void *priv)
if (!is_header_valid(&ctx->state.header) && ctx->comp_has_frame) if (!is_header_valid(&ctx->state.header) && ctx->comp_has_frame)
return 1; return 1;
flags = ntohl(ctx->state.header.flags); flags = ntohl(ctx->state.header.flags);
hdr_width_div = (flags & FWHT_FL_CHROMA_FULL_WIDTH) ? 1 : 2; hdr_width_div = (flags & V4L2_FWHT_FL_CHROMA_FULL_WIDTH) ? 1 : 2;
hdr_height_div = (flags & FWHT_FL_CHROMA_FULL_HEIGHT) ? 1 : 2; hdr_height_div = (flags & V4L2_FWHT_FL_CHROMA_FULL_HEIGHT) ? 1 : 2;
if (ntohl(ctx->state.header.width) != q_dst->visible_width || if (ntohl(ctx->state.header.width) != q_dst->visible_width ||
ntohl(ctx->state.header.height) != q_dst->visible_height || ntohl(ctx->state.header.height) != q_dst->visible_height ||
......
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