avfilter/vf_v360: fix scaling to give proper results

This commit is contained in:
Paul B Mahol 2021-10-09 16:24:58 +02:00
parent fd3aba10cc
commit 57b14879b9
1 changed files with 3 additions and 3 deletions

View File

@ -1375,7 +1375,7 @@ static void process_cube_coordinates(const V360Context *s,
static av_always_inline float scale(float x, float 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) 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, int i, int j, int width, int height,
float *vec) float *vec)
{ {
const float ew = width / 2.f; const float ew = width * 0.5f;
const float eh = height; const float eh = height;
const int ei = i >= ew ? i - ew : i; 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, const float *vec, int width, int height,
int16_t us[4][4], int16_t vs[4][4], float *du, float *dv) 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 eh = height;
const float h = hypotf(vec[0], vec[1]); const float h = hypotf(vec[0], vec[1]);