Commit 7af14b37 authored by Ganesh Ajjanagadde's avatar Ganesh Ajjanagadde

lavfi/vf_colorlevels: replace round by lrint

lrint avoids an implicit cast, and is not slower on non-broken libm's. Thus this
represents a Pareto improvement.
Signed-off-by: 's avatarGanesh Ajjanagadde <gajjanagadde@gmail.com>
parent cc37b31a
...@@ -132,10 +132,10 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in) ...@@ -132,10 +132,10 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in)
const uint8_t offset = s->rgba_map[i]; const uint8_t offset = s->rgba_map[i];
const uint8_t *srcrow = in->data[0]; const uint8_t *srcrow = in->data[0];
uint8_t *dstrow = out->data[0]; uint8_t *dstrow = out->data[0];
int imin = round(r->in_min * UINT8_MAX); int imin = lrint(r->in_min * UINT8_MAX);
int imax = round(r->in_max * UINT8_MAX); int imax = lrint(r->in_max * UINT8_MAX);
int omin = round(r->out_min * UINT8_MAX); int omin = lrint(r->out_min * UINT8_MAX);
int omax = round(r->out_max * UINT8_MAX); int omax = lrint(r->out_max * UINT8_MAX);
double coeff; double coeff;
if (imin < 0) { if (imin < 0) {
...@@ -179,10 +179,10 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in) ...@@ -179,10 +179,10 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in)
const uint8_t offset = s->rgba_map[i]; const uint8_t offset = s->rgba_map[i];
const uint8_t *srcrow = in->data[0]; const uint8_t *srcrow = in->data[0];
uint8_t *dstrow = out->data[0]; uint8_t *dstrow = out->data[0];
int imin = round(r->in_min * UINT16_MAX); int imin = lrint(r->in_min * UINT16_MAX);
int imax = round(r->in_max * UINT16_MAX); int imax = lrint(r->in_max * UINT16_MAX);
int omin = round(r->out_min * UINT16_MAX); int omin = lrint(r->out_min * UINT16_MAX);
int omax = round(r->out_max * UINT16_MAX); int omax = lrint(r->out_max * UINT16_MAX);
double coeff; double coeff;
if (imin < 0) { if (imin < 0) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment