isp_output_width = out_info->padded_width,
isp_output_height = out_info->height,
s3a_isp_width;
+ bool enable_ds = info->enable_ds;
+ bool enable_hus = in_info->width < out_info->width;
+ bool enable_vus = in_info->height < out_info->height;
if (info->enable_dvs_envelope) {
sh_css_video_get_dis_envelope(&dvs_env_width, &dvs_env_height);
bits_per_pixel = sh_css_input_format_bits_per_pixel(
stream_format, two_ppc);
}
- if (info->enable_ds) {
- ds_input_width = in_info->padded_width + info->left_cropping;
- ds_input_height = in_info->height + info->top_cropping;
- }
+ ds_input_width = in_info->padded_width + info->left_cropping;
+ ds_input_height = in_info->height + info->top_cropping;
+ if (enable_hus)
+ ds_input_width += dvs_env_width;
+ if (enable_vus)
+ ds_input_height += dvs_env_height;
+
/* We first calculate the resolutions used by the ISP. After that,
* we use those resolutions to compute sizes for tables etc. */
isp_internal_width =
__ISP_INTERNAL_HEIGHT(isp_output_height, info->top_cropping,
dvs_env_height);
isp_input_width = _ISP_INPUT_WIDTH(isp_internal_width,
- ds_input_width, info->enable_ds);
+ ds_input_width,
+ enable_ds || enable_hus);
isp_input_height = _ISP_INPUT_HEIGHT(isp_internal_height,
- ds_input_height, info->enable_ds);
+ ds_input_height,
+ enable_ds || enable_vus);
- s3a_isp_width = _ISP_S3A_ISP_WIDTH(isp_input_width,
- info->left_cropping);
+ s3a_isp_width = _ISP_S3A_ELEMS_ISP_WIDTH(isp_input_width,
+ isp_internal_width, enable_hus, info->left_cropping);
if (info->fixed_s3a_deci_log)
s3a_log_deci = info->fixed_s3a_deci_log;
else
_ISP_S3ATBL_WIDTH(binary->in_frame_info.width,
s3a_log_deci);
binary->s3atbl_height =
- _ISP_S3ATBL_HEIGHT(isp_input_height, s3a_log_deci);
+ _ISP_S3ATBL_HEIGHT(binary->in_frame_info.height,
+ s3a_log_deci);
binary->s3atbl_isp_width =
- _ISP_S3ATBL_ISP_WIDTH(isp_input_width, s3a_log_deci,
- info->left_cropping);
+ _ISP_S3ATBL_ISP_WIDTH(
+ _ISP_S3A_ELEMS_ISP_WIDTH(isp_input_width,
+ isp_internal_width, enable_hus,
+ info->left_cropping),
+ s3a_log_deci);
binary->s3atbl_isp_height =
- _ISP_S3ATBL_ISP_HEIGHT(isp_input_height, s3a_log_deci);
+ _ISP_S3ATBL_ISP_HEIGHT(
+ _ISP_S3A_ELEMS_ISP_HEIGHT(isp_input_height,
+ isp_internal_height, enable_vus), s3a_log_deci);
} else {
binary->s3atbl_width = 0;
binary->s3atbl_height = 0;
_ISP_SDIS_HOR_COEF_NUM_3A(binary->in_frame_info.width,
SH_CSS_DIS_DECI_FACTOR_LOG2);
binary->dis_ver_coef_num_3a =
- _ISP_SDIS_VER_COEF_NUM_3A(isp_input_height,
+ _ISP_SDIS_VER_COEF_NUM_3A(binary->in_frame_info.height,
SH_CSS_DIS_DECI_FACTOR_LOG2);
binary->dis_hor_coef_num_isp =
- _ISP_SDIS_HOR_COEF_NUM_ISP(isp_input_width);
+ _ISP_SDIS_HOR_COEF_NUM_ISP(
+ _ISP_SDIS_ELEMS_ISP(isp_input_width,
+ isp_internal_width, enable_hus));
binary->dis_ver_coef_num_isp =
- _ISP_SDIS_VER_COEF_NUM_ISP(isp_input_height);
+ _ISP_SDIS_VER_COEF_NUM_ISP(
+ _ISP_SDIS_ELEMS_ISP(isp_input_height,
+ isp_internal_height, enable_vus));
binary->dis_hor_proj_num_3a =
- _ISP_SDIS_HOR_PROJ_NUM_3A(isp_input_height,
+ _ISP_SDIS_HOR_PROJ_NUM_3A(binary->in_frame_info.height,
SH_CSS_DIS_DECI_FACTOR_LOG2);
binary->dis_ver_proj_num_3a =
_ISP_SDIS_VER_PROJ_NUM_3A(binary->in_frame_info.width,
SH_CSS_DIS_DECI_FACTOR_LOG2);
binary->dis_hor_proj_num_isp =
- __ISP_SDIS_HOR_PROJ_NUM_ISP(isp_input_height,
+ __ISP_SDIS_HOR_PROJ_NUM_ISP(
+ _ISP_SDIS_ELEMS_ISP(isp_input_height,
+ isp_internal_height, enable_vus),
SH_CSS_DIS_DECI_FACTOR_LOG2);
binary->dis_ver_proj_num_isp =
- __ISP_SDIS_VER_PROJ_NUM_ISP(isp_input_width,
+ __ISP_SDIS_VER_PROJ_NUM_ISP(
+ _ISP_SDIS_ELEMS_ISP(isp_input_width,
+ isp_internal_width, enable_hus),
SH_CSS_DIS_DECI_FACTOR_LOG2);
} else {
binary->dis_deci_factor_log2 = 0;
#define _SDIS_VER_COEF_TBL_USE_DMEM(mode, enable_sdis) \
(mode == SH_CSS_BINARY_MODE_VIDEO && enable_sdis)
+/* For YUV upscaling, the internal size is used for DIS statistics */
+#define _ISP_SDIS_ELEMS_ISP(input, internal, enable_us) \
+ ((enable_us) ? (internal) : (input))
+
/* SDIS Projections:
* Horizontal projections are calculated for each line.
* Vertical projections are calculated for each column.
(_ISP_BQS(in_width) >> deci_factor_log2)
#define _ISP_S3ATBL_HEIGHT(in_height, deci_factor_log2) \
(_ISP_BQS(in_height) >> deci_factor_log2)
-#define _ISP_S3A_ISP_WIDTH(in_width, left_crop) \
- ((in_width) - ((left_crop) ? 2*ISP_VEC_NELEMS : 0))
-#define _ISP_S3ATBL_ISP_WIDTH(in_width, deci_log2, left_crop) \
- CEIL_SHIFT(_ISP_BQS(_ISP_S3A_ISP_WIDTH(in_width, left_crop)), deci_log2)
+
+#define _ISP_S3A_ELEMS_ISP_WIDTH(in_width, int_width, enable_hus, left_crop) \
+ (((enable_hus) ? (int_width) : (in_width)) \
+ - ((left_crop) ? 2 * ISP_VEC_NELEMS : 0))
+#define _ISP_S3A_ELEMS_ISP_HEIGHT(in_height, int_height, enable_vus) \
+ ((enable_vus) ? (int_height) : (in_height))
+
+#define _ISP_S3ATBL_ISP_WIDTH(in_width, deci_factor_log2) \
+ CEIL_SHIFT(_ISP_BQS(in_width), deci_factor_log2)
#define _ISP_S3ATBL_ISP_HEIGHT(in_height, deci_factor_log2) \
CEIL_SHIFT(_ISP_BQS(in_height), deci_factor_log2)
#define ISP_S3ATBL_VECTORS \
int half_env_x, half_env_y,
motion_x = args->dvs_vector_x,
motion_y = args->dvs_vector_y;
+ bool upscale_x = binary->in_frame_info.width <
+ binary->out_frame_info.width;
+ bool upscale_y = binary->in_frame_info.height <
+ binary->out_frame_info.height;
if (binary->info->enable_uds) {
/* we calculate with the envelope that we can actually use,
/* for digital zoom, we use the dvs envelope and make sure
that we don't include the 8 leftmost pixels or 8 topmost
rows. */
- uds_xc = (binary->out_frame_info.width + env_width) / 2 +
- SH_CSS_MIN_DVS_ENVELOPE;
- uds_yc = (binary->out_frame_info.height + env_height) / 2 +
- SH_CSS_MIN_DVS_ENVELOPE;
+ if (upscale_x) {
+ uds_xc = (binary->in_frame_info.width + env_width
+ + SH_CSS_MIN_DVS_ENVELOPE) / 2;
+ } else {
+ uds_xc = (binary->out_frame_info.width + env_width)
+ / 2 + SH_CSS_MIN_DVS_ENVELOPE;
+ }
+ if (upscale_y) {
+ uds_yc = (binary->in_frame_info.height + env_height
+ + SH_CSS_MIN_DVS_ENVELOPE) / 2;
+ } else {
+ uds_yc = (binary->out_frame_info.height + env_height)
+ / 2 + SH_CSS_MIN_DVS_ENVELOPE;
+ }
/* clip the motion vector to +/- half the envelope */
motion_x = clamp(motion_x, -half_env_x, half_env_x);
motion_y = clamp(motion_y, -half_env_y, half_env_y);