video: driver: fix incorrect crop resolution
Store unaligned resolution in driver inst formats to avoid crop resolution getting updated to aligned resolution whenever client did g_fmt and s_fmt again after setting raw input resolution. Change-Id: Ic2b6cf6e7d418d2bf0c35270199b914648e933d4 Signed-off-by: Akshata Sahukar <quic_asahukar@quicinc.com>
This commit is contained in:

committed by
Gerrit - the friendly Code Review server

parent
5dc3050cce
commit
93742170e9
@@ -1227,11 +1227,8 @@ static int msm_venc_s_fmt_input(struct msm_vidc_inst *inst, struct v4l2_format *
|
||||
height = f->fmt.pix_mp.height;
|
||||
|
||||
if (is_image_session(inst)) {
|
||||
width = ALIGN(f->fmt.pix_mp.width, HEIC_GRID_DIMENSION);
|
||||
height = ALIGN(f->fmt.pix_mp.height, HEIC_GRID_DIMENSION);
|
||||
inst->crop.width = ALIGN(inst->crop.width, HEIC_GRID_DIMENSION);
|
||||
inst->crop.height = ALIGN(inst->crop.height, HEIC_GRID_DIMENSION);
|
||||
bytesperline = width * (is_10bit_colorformat(pix_fmt) ? 2 : 1);
|
||||
bytesperline = ALIGN(f->fmt.pix_mp.width, HEIC_GRID_DIMENSION) *
|
||||
(is_10bit_colorformat(pix_fmt) ? 2 : 1);
|
||||
} else if (is_rgba_colorformat(pix_fmt)) {
|
||||
bytesperline = VIDEO_RGB_STRIDE_BYTES(f->fmt.pix_mp.pixelformat,
|
||||
f->fmt.pix_mp.width);
|
||||
|
@@ -294,11 +294,17 @@ u32 msm_vidc_encoder_input_size(struct msm_vidc_inst *inst)
|
||||
{
|
||||
u32 size;
|
||||
struct v4l2_format *f;
|
||||
u32 width, height;
|
||||
|
||||
f = &inst->fmts[INPUT_PORT];
|
||||
width = f->fmt.pix_mp.width;
|
||||
height = f->fmt.pix_mp.height;
|
||||
if (is_image_session(inst)) {
|
||||
width = ALIGN(width, HEIC_GRID_DIMENSION);
|
||||
height = ALIGN(height, HEIC_GRID_DIMENSION);
|
||||
}
|
||||
size = VIDEO_RAW_BUFFER_SIZE(f->fmt.pix_mp.pixelformat,
|
||||
f->fmt.pix_mp.width,
|
||||
f->fmt.pix_mp.height, true);
|
||||
width, height, true);
|
||||
return size;
|
||||
}
|
||||
|
||||
@@ -415,6 +421,7 @@ u32 msm_vidc_encoder_input_meta_size(struct msm_vidc_inst *inst)
|
||||
u32 size = 0;
|
||||
u32 lcu_size = 0;
|
||||
struct v4l2_format *f;
|
||||
u32 width, height;
|
||||
|
||||
if (!inst || !inst->capabilities) {
|
||||
d_vpr_e("%s: invalid params\n", __func__);
|
||||
@@ -434,8 +441,13 @@ u32 msm_vidc_encoder_input_meta_size(struct msm_vidc_inst *inst)
|
||||
lcu_size = 32;
|
||||
|
||||
f = &inst->fmts[INPUT_PORT];
|
||||
size += ROI_METADATA_SIZE(f->fmt.pix_mp.width,
|
||||
f->fmt.pix_mp.height, lcu_size);
|
||||
width = f->fmt.pix_mp.width;
|
||||
height = f->fmt.pix_mp.height;
|
||||
if (is_image_session(inst)) {
|
||||
width = ALIGN(width, HEIC_GRID_DIMENSION);
|
||||
height = ALIGN(height, HEIC_GRID_DIMENSION);
|
||||
}
|
||||
size += ROI_METADATA_SIZE(width, height, lcu_size);
|
||||
size = ALIGN(size, SZ_4K);
|
||||
}
|
||||
return size;
|
||||
|
@@ -6194,16 +6194,6 @@ static bool msm_vidc_allow_image_encode_session(struct msm_vidc_inst *inst)
|
||||
goto exit;
|
||||
}
|
||||
|
||||
/* is input grid aligned */
|
||||
fmt = &inst->fmts[INPUT_PORT];
|
||||
allow = IS_ALIGNED(fmt->fmt.pix_mp.width, HEIC_GRID_DIMENSION);
|
||||
allow &= IS_ALIGNED(fmt->fmt.pix_mp.height, HEIC_GRID_DIMENSION);
|
||||
if (!allow) {
|
||||
i_vpr_e(inst, "%s: input is not grid aligned: %u x %u\n", __func__,
|
||||
fmt->fmt.pix_mp.width, fmt->fmt.pix_mp.height);
|
||||
goto exit;
|
||||
}
|
||||
|
||||
/* is output grid dimension */
|
||||
fmt = &inst->fmts[OUTPUT_PORT];
|
||||
allow = fmt->fmt.pix_mp.width == HEIC_GRID_DIMENSION;
|
||||
|
Reference in New Issue
Block a user