aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media
diff options
context:
space:
mode:
authorLaurent Pinchart <laurent.pinchart@ideasonboard.com>2011-02-18 07:41:50 -0500
committerMauro Carvalho Chehab <mchehab@redhat.com>2011-04-17 06:38:10 -0400
commitf792e4f6ac12d45b0eca12f505295c48182a8fd2 (patch)
tree43dec3a3762db6b0963e55ca8ca8e13c9d714c83 /drivers/media
parent8eca7a004ef9fec2fdca8a2b4b65410ff1515b80 (diff)
[media] omap3isp: resizer: Use 4-tap mode equations when the ratio is <= 512
As the number of phases/taps, used to select the correct equations to compute the ratio, depends on the ratio, start with the 7-tap mode equations to compute an approximation of the ratio, and switch to the 4-tap mode equations if the approximation is lower than or equal to 512. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media')
-rw-r--r--drivers/media/video/omap3isp/ispresizer.c27
1 files changed, 22 insertions, 5 deletions
diff --git a/drivers/media/video/omap3isp/ispresizer.c b/drivers/media/video/omap3isp/ispresizer.c
index 829d7bfd422d..40b2db873a13 100644
--- a/drivers/media/video/omap3isp/ispresizer.c
+++ b/drivers/media/video/omap3isp/ispresizer.c
@@ -724,9 +724,20 @@ static void resizer_print_status(struct isp_res_device *res)
724 * vrsz = ((ih - 7) * 256 - 32 - 64 * spv) / (oh - 1) 724 * vrsz = ((ih - 7) * 256 - 32 - 64 * spv) / (oh - 1)
725 * 725 *
726 * The ratios are integer values, and must be rounded down to ensure that the 726 * The ratios are integer values, and must be rounded down to ensure that the
727 * cropped input size is not bigger than the uncropped input size. As the ratio 727 * cropped input size is not bigger than the uncropped input size.
728 * in 7-tap mode is always smaller than the ratio in 4-tap mode, we can use the 728 *
729 * 7-tap mode equations to compute a ratio approximation. 729 * As the number of phases/taps, used to select the correct equations to compute
730 * the ratio, depends on the ratio, we start with the 4-tap mode equations to
731 * compute an approximation of the ratio, and switch to the 7-tap mode equations
732 * if the approximation is higher than the ratio threshold.
733 *
734 * As the 7-tap mode equations will return a ratio smaller than or equal to the
735 * 4-tap mode equations, the resulting ratio could become lower than or equal to
736 * the ratio threshold. This 'equations loop' isn't an issue as long as the
737 * correct equations are used to compute the final input size. Starting with the
738 * 4-tap mode equations ensure that, in case of values resulting in a 'ratio
739 * loop', the smallest of the ratio values will be used, never exceeding the
740 * requested input size.
730 * 741 *
731 * We first clamp the output size according to the hardware capabilitie to avoid 742 * We first clamp the output size according to the hardware capabilitie to avoid
732 * auto-cropping the input more than required to satisfy the TRM equations. The 743 * auto-cropping the input more than required to satisfy the TRM equations. The
@@ -788,8 +799,11 @@ static void resizer_calc_ratios(struct isp_res_device *res,
788 max_height = min_t(unsigned int, max_height, MAX_OUT_HEIGHT); 799 max_height = min_t(unsigned int, max_height, MAX_OUT_HEIGHT);
789 output->height = clamp(output->height, min_height, max_height); 800 output->height = clamp(output->height, min_height, max_height);
790 801
791 ratio->vert = ((input->height - 7) * 256 - 32 - 64 * spv) 802 ratio->vert = ((input->height - 4) * 256 - 16 - 32 * spv)
792 / (output->height - 1); 803 / (output->height - 1);
804 if (ratio->vert > MID_RESIZE_VALUE)
805 ratio->vert = ((input->height - 7) * 256 - 32 - 64 * spv)
806 / (output->height - 1);
793 ratio->vert = clamp_t(unsigned int, ratio->vert, 807 ratio->vert = clamp_t(unsigned int, ratio->vert,
794 MIN_RESIZE_VALUE, MAX_RESIZE_VALUE); 808 MIN_RESIZE_VALUE, MAX_RESIZE_VALUE);
795 809
@@ -856,8 +870,11 @@ static void resizer_calc_ratios(struct isp_res_device *res,
856 max_width & ~(width_alignment - 1)); 870 max_width & ~(width_alignment - 1));
857 output->width = ALIGN(output->width, width_alignment); 871 output->width = ALIGN(output->width, width_alignment);
858 872
859 ratio->horz = ((input->width - 7) * 256 - 32 - 64 * sph) 873 ratio->horz = ((input->width - 7) * 256 - 16 - 32 * sph)
860 / (output->width - 1); 874 / (output->width - 1);
875 if (ratio->horz > MID_RESIZE_VALUE)
876 ratio->horz = ((input->width - 7) * 256 - 32 - 64 * sph)
877 / (output->width - 1);
861 ratio->horz = clamp_t(unsigned int, ratio->horz, 878 ratio->horz = clamp_t(unsigned int, ratio->horz,
862 MIN_RESIZE_VALUE, MAX_RESIZE_VALUE); 879 MIN_RESIZE_VALUE, MAX_RESIZE_VALUE);
863 880