@@ -46,6 +46,18 @@ void vsp1_uds_set_alpha(struct vsp1_entity *entity, struct vsp1_dl_body *dlb,
alpha << VI6_UDS_ALPVAL_VAL0_SHIFT);
}
+/*
+ * Determine the pre-filter multiplication value.
+ *
+ * This calculation assumes that the BLADV control is unset.
+ */
+static unsigned int uds_multiplier(int ratio)
+{
+ unsigned int mp = ratio / 4096;
+
+ return mp < 4 ? 1 : (mp < 8 ? 2 : 4);
+}
+
/*
* uds_output_size - Return the output size for an input size and scaling ratio
* @input: input size in pixels
@@ -55,10 +67,7 @@ static unsigned int uds_output_size(unsigned int input, unsigned int ratio)
{
if (ratio > 4096) {
/* Down-scaling */
- unsigned int mp;
-
- mp = ratio / 4096;
- mp = mp < 4 ? 1 : (mp < 8 ? 2 : 4);
+ unsigned int mp = uds_multiplier(ratio);
return (input - 1) / mp * mp * 4096 / ratio + 1;
} else {
@@ -88,10 +97,7 @@ static unsigned int uds_passband_width(unsigned int ratio)
{
if (ratio >= 4096) {
/* Down-scaling */
- unsigned int mp;
-
- mp = ratio / 4096;
- mp = mp < 4 ? 1 : (mp < 8 ? 2 : 4);
+ unsigned int mp = uds_multiplier(ratio);
return 64 * 4096 * mp / ratio;
} else {