[FFmpeg-devel,5/5] avfilter/vf_v360: improve interpolation precision

Submitted by Paul B Mahol on Sept. 5, 2019, 8:52 a.m.

Details

Message ID 20190905085255.24699-5-onemda@gmail.com
State New
Headers show

Commit Message

Paul B Mahol Sept. 5, 2019, 8:52 a.m.
Signed-off-by: Paul B Mahol <onemda@gmail.com>
---
 libavfilter/vf_v360.c       | 14 +++++++-------
 libavfilter/x86/vf_v360.asm |  2 +-
 2 files changed, 8 insertions(+), 8 deletions(-)

Patch hide | download patch | download mbox

diff --git a/libavfilter/vf_v360.c b/libavfilter/vf_v360.c
index e69aa7e8c5..2c1a175d7d 100644
--- a/libavfilter/vf_v360.c
+++ b/libavfilter/vf_v360.c
@@ -263,7 +263,7 @@  static void remap##ws##_##bits##bit_line_c(uint8_t *dst, int width, const uint8_
             }                                                                                              \
         }                                                                                                  \
                                                                                                            \
-        d[x] = av_clip_uint##bits(tmp >> (15 - ws));                                                       \
+        d[x] = av_clip_uint##bits(tmp >> 14);                                                              \
     }                                                                                                      \
 }
 
@@ -335,10 +335,10 @@  static void bilinear_kernel(float du, float dv, const XYRemap *r_tmp,
         }
     }
 
-    ker[0] = (1.f - du) * (1.f - dv) * 8192;
-    ker[1] =        du  * (1.f - dv) * 8192;
-    ker[2] = (1.f - du) *        dv  * 8192;
-    ker[3] =        du  *        dv  * 8192;
+    ker[0] = (1.f - du) * (1.f - dv) * 16384;
+    ker[1] =        du  * (1.f - dv) * 16384;
+    ker[2] = (1.f - du) *        dv  * 16384;
+    ker[3] =        du  *        dv  * 16384;
 }
 
 /**
@@ -382,7 +382,7 @@  static void bicubic_kernel(float du, float dv, const XYRemap *r_tmp,
         for (j = 0; j < 4; j++) {
             u[i * 4 + j] = r_tmp->u[i][j];
             v[i * 4 + j] = r_tmp->v[i][j];
-            ker[i * 4 + j] = du_coeffs[j] * dv_coeffs[i] * 2048;
+            ker[i * 4 + j] = du_coeffs[j] * dv_coeffs[i] * 16384;
         }
     }
 }
@@ -437,7 +437,7 @@  static void lanczos_kernel(float du, float dv, const XYRemap *r_tmp,
         for (j = 0; j < 4; j++) {
             u[i * 4 + j] = r_tmp->u[i][j];
             v[i * 4 + j] = r_tmp->v[i][j];
-            ker[i * 4 + j] = du_coeffs[j] * dv_coeffs[i] * 2048;
+            ker[i * 4 + j] = du_coeffs[j] * dv_coeffs[i] * 16384;
         }
     }
 }
diff --git a/libavfilter/x86/vf_v360.asm b/libavfilter/x86/vf_v360.asm
index e1efe2e3a3..3d05f02c75 100644
--- a/libavfilter/x86/vf_v360.asm
+++ b/libavfilter/x86/vf_v360.asm
@@ -84,7 +84,7 @@  cglobal remap2_8bit_line, 7, 8, 8, dst, width, src, in_linesize, u, v, ker, x
         pmulld          m2, m1
         phaddd          m2, m2
         phaddd          m1, m2, m2
-        psrld           m1, m1, 0xd
+        psrld           m1, m1, 0xe
         pshufb          m1, m1, m5
         vextracti128   xm2, m1, 1