summaryrefslogtreecommitdiff
path: root/drivers/mxc
diff options
context:
space:
mode:
authorMing Qian <ming.qian@nxp.com>2022-08-01 14:15:17 +0800
committerMing Qian <ming.qian@nxp.com>2022-08-03 17:46:32 +0800
commit440e346e510ad1b9706652d7c75aa8017861e696 (patch)
tree9ae5033462ad885720f4a632d6be3cf724d1e4c0 /drivers/mxc
parent016676e45825b676ae197873ddda9c666ab70d56 (diff)
LF-6690-4:imx8m:vpu: simplify the calculation of sizeimage
refine the function verifyPlanesize Signed-off-by: Ming Qian <ming.qian@nxp.com> Reviewed-by: TaoJiang <tao.jiang_2@nxp.com>
Diffstat (limited to 'drivers/mxc')
-rwxr-xr-xdrivers/mxc/hantro_v4l2/vsi-v4l2-config.c107
1 files changed, 42 insertions, 65 deletions
diff --git a/drivers/mxc/hantro_v4l2/vsi-v4l2-config.c b/drivers/mxc/hantro_v4l2/vsi-v4l2-config.c
index 1f1d92c5a269..3010a4a55eb2 100755
--- a/drivers/mxc/hantro_v4l2/vsi-v4l2-config.c
+++ b/drivers/mxc/hantro_v4l2/vsi-v4l2-config.c
@@ -1266,77 +1266,54 @@ static int vsi_calc_table_size(int pixelformat, int width, int height)
static void verifyPlanesize(u32 psize[], int braw, int pixelformat, int width, int height, int bdecoder)
{
- int basesize = width * height, extsize = 0, quadsize = 0;
+ int basesize = width * height;
int chromausize = 0;
int chromavsize = 0;
int padsize = 0;
int tablesize = 0;
int mvssize = 0;
- if (braw) {
- if (enc_isRGBformat(pixelformat)) {
- extsize = 0;
- quadsize = 0;
- } else {
- switch (pixelformat) {
- case V4L2_PIX_FMT_NV12:
- case V4L2_PIX_FMT_NV12M:
- case V4L2_PIX_FMT_NV21:
- case V4L2_PIX_FMT_NV21M:
- case V4L2_PIX_FMT_NV12X:
- case V4L2_PIX_FMT_DTRC:
- case V4L2_PIX_FMT_P010:
- case V4L2_PIX_FMT_TILEX:
- case V4L2_PIX_FMT_RFC:
- case V4L2_PIX_FMT_RFCX:
- case V4L2_PIX_FMT_411SP:
- extsize = basesize / 2;
- quadsize = basesize / 4;
- chromausize = extsize;
- if (bdecoder)
- padsize = quadsize + 32;
- break;
- case V4L2_PIX_FMT_YUV420:
- case V4L2_PIX_FMT_YUV420M:
- extsize = basesize / 4;
- quadsize = basesize / 4;
- chromausize = quadsize;
- chromavsize = quadsize;
- if (bdecoder)
- padsize = quadsize + 32;
- break;
- case V4L2_PIX_FMT_NV16:
- extsize = basesize;
- chromausize = extsize;
- quadsize = 0;
- break;
- case V4L2_PIX_FMT_NV24:
- extsize = basesize * 2;
- chromausize = extsize;
- quadsize = 0;
- break;
- case V4L2_PIX_FMT_GREY:
- case V4L2_PIX_FMT_YUYV:
- extsize = 0;
- quadsize = 0;
- break;
- default:
- extsize = basesize;
- quadsize = basesize / 2;
- break;
- }
- }
- switch (pixelformat) {
- case V4L2_PIX_FMT_RFC:
- case V4L2_PIX_FMT_RFCX:
- mvssize = DIV_ROUND_UP(width, 64) * DIV_ROUND_UP(height, 64) * 64 * 16;
- padsize = max_t(int, padsize, mvssize);
- tablesize = vsi_calc_table_size(pixelformat, width, height);
- break;
- default:
- tablesize = 0;
- break;
- }
+ switch (pixelformat) {
+ case V4L2_PIX_FMT_NV12:
+ case V4L2_PIX_FMT_NV12M:
+ case V4L2_PIX_FMT_NV21:
+ case V4L2_PIX_FMT_NV21M:
+ case V4L2_PIX_FMT_NV12X:
+ case V4L2_PIX_FMT_DTRC:
+ case V4L2_PIX_FMT_P010:
+ case V4L2_PIX_FMT_TILEX:
+ case V4L2_PIX_FMT_411SP:
+ chromausize = basesize / 2;
+ if (bdecoder)
+ padsize = basesize / 4 + 32;
+ break;
+ case V4L2_PIX_FMT_YUV420:
+ case V4L2_PIX_FMT_YUV420M:
+ chromausize = basesize / 4;
+ chromavsize = basesize / 4;
+ if (bdecoder)
+ padsize = basesize / 4 + 32;
+ break;
+ case V4L2_PIX_FMT_NV16:
+ chromausize = basesize;
+ break;
+ case V4L2_PIX_FMT_NV24:
+ chromausize = basesize * 2;
+ break;
+ case V4L2_PIX_FMT_GREY:
+ case V4L2_PIX_FMT_YUYV:
+ break;
+ case V4L2_PIX_FMT_RFC:
+ case V4L2_PIX_FMT_RFCX:
+ chromausize = basesize / 2;
+ if (bdecoder)
+ padsize = basesize / 4 + 32;
+ mvssize = DIV_ROUND_UP(width, 64) * DIV_ROUND_UP(height, 64) * 64 * 16;
+ padsize = max_t(int, padsize, mvssize);
+ tablesize = vsi_calc_table_size(pixelformat, width, height);
+ break;
+ default:
+ break;
}
//for coded format we support 1 plane only