summaryrefslogtreecommitdiff
path: root/libavfilter/vf_v360.c
diff options
context:
space:
mode:
authorPaul B Mahol <onemda@gmail.com>2021-10-09 16:24:58 +0200
committerPaul B Mahol <onemda@gmail.com>2021-10-09 16:59:35 +0200
commit57b14879b93992181ad029297d4045a73d8f5f89 (patch)
tree150e069889a5bfa9d6a6f6c3dd7ba20cbf7f5be5 /libavfilter/vf_v360.c
parentfd3aba10cc55a668997c1d1fae5555ad2e8af910 (diff)
avfilter/vf_v360: fix scaling to give proper results
Diffstat (limited to 'libavfilter/vf_v360.c')
-rw-r--r--libavfilter/vf_v360.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/libavfilter/vf_v360.c b/libavfilter/vf_v360.c
index cc075cd39f..1a813c1f14 100644
--- a/libavfilter/vf_v360.c
+++ b/libavfilter/vf_v360.c
@@ -1375,7 +1375,7 @@ static void process_cube_coordinates(const V360Context *s,
static av_always_inline float scale(float x, float s)
{
- return (0.5f * x + 0.5f) * s - 0.5f;
+ return (0.5f * x + 0.5f) * (s - 1.f);
}
static av_always_inline float rescale(int x, float s)
@@ -3423,7 +3423,7 @@ static int dfisheye_to_xyz(const V360Context *s,
int i, int j, int width, int height,
float *vec)
{
- const float ew = width / 2.f;
+ const float ew = width * 0.5f;
const float eh = height;
const int ei = i >= ew ? i - ew : i;
@@ -3464,7 +3464,7 @@ static int xyz_to_dfisheye(const V360Context *s,
const float *vec, int width, int height,
int16_t us[4][4], int16_t vs[4][4], float *du, float *dv)
{
- const float ew = width / 2.f;
+ const float ew = (width - 1) * 0.5f;
const float eh = height;
const float h = hypotf(vec[0], vec[1]);