aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/omap3isp
diff options
context:
space:
mode:
authorLaurent Pinchart <laurent.pinchart@ideasonboard.com>2011-02-18 07:41:49 -0500
committerMauro Carvalho Chehab <mchehab@redhat.com>2011-04-13 09:33:58 -0400
commit8eca7a004ef9fec2fdca8a2b4b65410ff1515b80 (patch)
tree9b6991fefec70e92d7c14d90f67cdd427f459833 /drivers/media/video/omap3isp
parent21d2b9587f93302d4f13bf3d99482f3642f48b96 (diff)
[media] omap3isp: resizer: Center the crop rectangle
When the crop rectangle needs to be modified to match hardware requirements, center the resulting rectangle on the requested rectangle instead of removing pixels from the right and bottom sides only. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/video/omap3isp')
-rw-r--r--drivers/media/video/omap3isp/ispresizer.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/drivers/media/video/omap3isp/ispresizer.c b/drivers/media/video/omap3isp/ispresizer.c
index 75d39b115d42..829d7bfd422d 100644
--- a/drivers/media/video/omap3isp/ispresizer.c
+++ b/drivers/media/video/omap3isp/ispresizer.c
@@ -775,6 +775,8 @@ static void resizer_calc_ratios(struct isp_res_device *res,
775 unsigned int max_width; 775 unsigned int max_width;
776 unsigned int max_height; 776 unsigned int max_height;
777 unsigned int width_alignment; 777 unsigned int width_alignment;
778 unsigned int width;
779 unsigned int height;
778 780
779 /* 781 /*
780 * Clamp the output height based on the hardware capabilities and 782 * Clamp the output height based on the hardware capabilities and
@@ -794,11 +796,11 @@ static void resizer_calc_ratios(struct isp_res_device *res,
794 if (ratio->vert <= MID_RESIZE_VALUE) { 796 if (ratio->vert <= MID_RESIZE_VALUE) {
795 upscaled_height = (output->height - 1) * ratio->vert 797 upscaled_height = (output->height - 1) * ratio->vert
796 + 32 * spv + 16; 798 + 32 * spv + 16;
797 input->height = (upscaled_height >> 8) + 4; 799 height = (upscaled_height >> 8) + 4;
798 } else { 800 } else {
799 upscaled_height = (output->height - 1) * ratio->vert 801 upscaled_height = (output->height - 1) * ratio->vert
800 + 64 * spv + 32; 802 + 64 * spv + 32;
801 input->height = (upscaled_height >> 8) + 7; 803 height = (upscaled_height >> 8) + 7;
802 } 804 }
803 805
804 /* 806 /*
@@ -862,12 +864,18 @@ static void resizer_calc_ratios(struct isp_res_device *res,
862 if (ratio->horz <= MID_RESIZE_VALUE) { 864 if (ratio->horz <= MID_RESIZE_VALUE) {
863 upscaled_width = (output->width - 1) * ratio->horz 865 upscaled_width = (output->width - 1) * ratio->horz
864 + 32 * sph + 16; 866 + 32 * sph + 16;
865 input->width = (upscaled_width >> 8) + 7; 867 width = (upscaled_width >> 8) + 7;
866 } else { 868 } else {
867 upscaled_width = (output->width - 1) * ratio->horz 869 upscaled_width = (output->width - 1) * ratio->horz
868 + 64 * sph + 32; 870 + 64 * sph + 32;
869 input->width = (upscaled_width >> 8) + 7; 871 width = (upscaled_width >> 8) + 7;
870 } 872 }
873
874 /* Center the new crop rectangle. */
875 input->left += (input->width - width) / 2;
876 input->top += (input->height - height) / 2;
877 input->width = width;
878 input->height = height;
871} 879}
872 880
873/* 881/*