summaryrefslogtreecommitdiff
path: root/libavfilter/vf_perspective.c
diff options
context:
space:
mode:
authorGanesh Ajjanagadde <gajjanagadde@gmail.com>2015-11-25 17:32:15 -0500
committerGanesh Ajjanagadde <gajjanagadde@gmail.com>2015-12-02 18:31:56 -0500
commitc6bea81acfa49d7e73f625332fc304d8a0fd09bd (patch)
tree92e2f17dee7c02327300016dc2dc5002bdbf9b13 /libavfilter/vf_perspective.c
parentfa5d299496c15e992240914ae05b92d9b74eb3c4 (diff)
avfilter/vf_perspective: use lrint instead of floor hack
Reviewed-by: Michael Niedermayer <michael@niedermayer.cc> Signed-off-by: Ganesh Ajjanagadde <gajjanagadde@gmail.com>
Diffstat (limited to 'libavfilter/vf_perspective.c')
-rw-r--r--libavfilter/vf_perspective.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/libavfilter/vf_perspective.c b/libavfilter/vf_perspective.c
index 970870cda5..13053f1b77 100644
--- a/libavfilter/vf_perspective.c
+++ b/libavfilter/vf_perspective.c
@@ -213,10 +213,10 @@ static int config_input(AVFilterLink *inlink)
for (x = 0; x < w; x++){
int u, v;
- u = (int)floor(SUB_PIXELS * (x0 * x + x1 * y + x2) /
- (x6 * x + x7 * y + x8) + 0.5);
- v = (int)floor(SUB_PIXELS * (x3 * x + x4 * y + x5) /
- (x6 * x + x7 * y + x8) + 0.5);
+ u = lrint(SUB_PIXELS * (x0 * x + x1 * y + x2) /
+ (x6 * x + x7 * y + x8));
+ v = lrint(SUB_PIXELS * (x3 * x + x4 * y + x5) /
+ (x6 * x + x7 * y + x8));
s->pv[x + y * w][0] = u;
s->pv[x + y * w][1] = v;
@@ -235,7 +235,7 @@ static int config_input(AVFilterLink *inlink)
sum += temp[j];
for (j = 0; j < 4; j++)
- s->coeff[i][j] = (int)floor((1 << COEFF_BITS) * temp[j] / sum + 0.5);
+ s->coeff[i][j] = lrint((1 << COEFF_BITS) * temp[j] / sum);
}
return 0;