[COMMON] fimc-is2: fix a TDNR wrong caculation bug
authorWooyeon Kim <wooy88.kim@samsung.com>
Fri, 1 Jun 2018 07:24:56 +0000 (16:24 +0900)
committerSunyoung Kang <sy0816.kang@samsung.com>
Mon, 23 Jul 2018 08:06:23 +0000 (17:06 +0900)
 - when NI is set to same setfile NI value,
   it is not applied to right value.

PR JIRA ID: CPR-40

Change-Id: Id1cae98d3731d2e874f71435eea4f49280e6971c
Signed-off-by: Wooyeon Kim <wooy88.kim@samsung.com>
drivers/media/platform/exynos/fimc-is2/hardware/fimc-is-hw-tdnr.h

index 5f5c9e6dedadc449a8d9d9fe99b89cfb2f6b7c17..4380be08384a621f31729c6a989e436ce5ce4323 100644 (file)
@@ -19,8 +19,9 @@
 #define INTERPOLATE_NUMERATOR(Y1, Y2, diff_x_x1) \
        ((((Y2) - (Y1)) * (diff_x_x1)) << INTERPOLATE_SHIFT)
 #define GET_LINEAR_INTERPOLATE_VALUE(Y1, Y2, diff_x2_x1, diff_x_x1)            \
-       (((INTERPOLATE_NUMERATOR((int)Y1, (int)Y2, diff_x_x1)) / (diff_x2_x1)) + \
-                                       (((int)(Y1) << INTERPOLATE_SHIFT)))
+       (diff_x2_x1) ? (((INTERPOLATE_NUMERATOR((int)Y1, (int)Y2, diff_x_x1)) / (diff_x2_x1)) + \
+                                       (((int)(Y1) << INTERPOLATE_SHIFT))) :   \
+                                       (int)(Y1) << INTERPOLATE_SHIFT
 #define RESTORE_SHIFT_VALUE(value) ((int)(value) >> INTERPOLATE_SHIFT)
 
 enum tdnr_mode {