diff options
| author | Krishna Chaitanya Parimi <cparimi@codeaurora.org> | 2015-03-17 12:11:45 +0530 |
|---|---|---|
| committer | David Keitel <dkeitel@codeaurora.org> | 2016-03-23 21:14:32 -0700 |
| commit | bc7eb1a073530473045c9b9f412bb2ccd6b39125 (patch) | |
| tree | 6f34791d68281aa83f7b4d4aefcf27cb96e2f93a /drivers/video/fbdev | |
| parent | 3d3dd8c52944381c89d7625467743b075af2d5ab (diff) | |
msm: mdss: alter linear_map to incorporate rounding for AD
The helper function linear_map would take the integral part
of the calculated map, thereby causing issues with getting
the same value after consecutive map and inverse map calls.
For ex: linear_map(21, out, 255, 4095) would translate to
*out = 21 * 4095 / 255 = 337, whereas inverse case
linear_map(337, out, 4095, 255) would translate to
*out = 337 * 255 / 4095 = 20
Changing linear_map from ((in * out_max) / in_max) to a more
precise ((2 * (in * out_max) + in_max) / (2 * in_max)) for
incorporating rounding in the integral mapping.
Change-Id: I15cd8aa1326813ce3cb3a426cbb4e78374623c72
Signed-off-by: Krishna Chaitanya Parimi <cparimi@codeaurora.org>
Diffstat (limited to 'drivers/video/fbdev')
| -rw-r--r-- | drivers/video/fbdev/msm/mdss_mdp_pp.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/video/fbdev/msm/mdss_mdp_pp.c b/drivers/video/fbdev/msm/mdss_mdp_pp.c index 81ea1c988c36..4a37ed844805 100644 --- a/drivers/video/fbdev/msm/mdss_mdp_pp.c +++ b/drivers/video/fbdev/msm/mdss_mdp_pp.c @@ -515,7 +515,7 @@ inline int linear_map(int in, int *out, int in_max, int out_max) { if (in < 0 || !out || in_max <= 0 || out_max <= 0) return -EINVAL; - *out = ((in * out_max) / in_max); + *out = ((2 * (in * out_max) + in_max) / (2 * in_max)); pr_debug("in = %d, out = %d, in_max = %d, out_max = %d\n", in, *out, in_max, out_max); if ((in > 0) && (*out == 0)) |
