[FFmpeg-cvslog] avfilter/vf_lenscorrection: get rid of some floats

Michael Niedermayer git at videolan.org
Thu Aug 21 11:55:32 CEST 2014


ffmpeg | branch: master | Michael Niedermayer <michaelni at gmx.at> | Wed Aug 20 13:19:26 2014 +0200| [c1b663bc92d3d5d4683b4109e5f6cea075855a7d] | committer: Michael Niedermayer

avfilter/vf_lenscorrection: get rid of some floats

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=c1b663bc92d3d5d4683b4109e5f6cea075855a7d
---

 libavfilter/vf_lenscorrection.c |   24 ++++++++++++------------
 1 file changed, 12 insertions(+), 12 deletions(-)

diff --git a/libavfilter/vf_lenscorrection.c b/libavfilter/vf_lenscorrection.c
index f4b1676..048820c 100644
--- a/libavfilter/vf_lenscorrection.c
+++ b/libavfilter/vf_lenscorrection.c
@@ -56,9 +56,9 @@ AVFILTER_DEFINE_CLASS(lenscorrection);
 
 typedef struct ThreadData {
     AVFrame *in, *out;
-    float w, h;
+    int w, h;
     int plane;
-    float xcenter, ycenter;
+    int xcenter, ycenter;
     float k1, k2;
 } ThreadData;
 
@@ -68,9 +68,9 @@ static int filter_slice(AVFilterContext *ctx, void *arg, int job, int nb_jobs)
     AVFrame *in = td->in;
     AVFrame *out = td->out;
 
-    const float w = td->w, h = td->h;
-    const float xcenter = td->xcenter;
-    const float ycenter = td->ycenter;
+    const int w = td->w, h = td->h;
+    const int xcenter = td->xcenter;
+    const int ycenter = td->ycenter;
     const float r2inv = 4.0 / (w * w + h * h);
     const float k1 = td->k1;
     const float k2 = td->k2;
@@ -83,12 +83,12 @@ static int filter_slice(AVFilterContext *ctx, void *arg, int job, int nb_jobs)
     uint8_t *outrow = out->data[plane] + start * outlinesize;
     int i;
     for (i = start; i < end; i++, outrow += outlinesize) {
-        const float off_y = i - ycenter;
-        const float off_y2 = off_y * off_y;
+        const int off_y = i - ycenter;
+        const int off_y2 = off_y * off_y;
         uint8_t *out = outrow;
         int j;
         for (j = 0; j < w; j++) {
-            const float off_x = j - xcenter;
+            const int off_x = j - xcenter;
             const float r2 = (off_x * off_x + off_y2) * r2inv;
             const float radius_mult = 1.0f + r2 * k1 + r2 * r2 * k2;
             const int x = xcenter + radius_mult * off_x + 0.5f;
@@ -147,10 +147,10 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in)
     for (plane = 0; plane < rect->nb_planes; ++plane) {
         int hsub = plane == 1 || plane == 2 ? rect->hsub : 0;
         int vsub = plane == 1 || plane == 2 ? rect->vsub : 0;
-        float hdiv = 1 << hsub;
-        float vdiv = 1 << vsub;
-        float w = rect->width / hdiv;
-        float h = rect->height / vdiv;
+        int hdiv = 1 << hsub;
+        int vdiv = 1 << vsub;
+        int w = rect->width / hdiv;
+        int h = rect->height / vdiv;
         ThreadData td = {
             .in = in,
             .out  = out,



More information about the ffmpeg-cvslog mailing list