History

avfilter/vf_v360: make FOV adjusted for dual fisheye too

Remove any usage of padding for this format.

Paul B Mahol committed 6 years ago

Commit 29708461 parent d8147c42 files · +25 −21Browse files

Showing the changes to libavfilter (1 of 2 files). Show all

Unified · Split

libavfilter/vf_v360.c+14−10
@@ -2991,16 +2991,14 @@ static int dfisheye_to_xyz(const V360Context *s, · 2990 unmodified lines
29912991 int i, int j, int width, int height,
29922992 float *vec)
29932993 {
2994− const float scale = 1.f + s->out_pad;
2995−
29962994 const float ew = width / 2.f;
29972995 const float eh = height;
29982996
29992997 const int ei = i >= ew ? i - ew : i;
30002998 const float m = i >= ew ? 1.f : -1.f;
30012999
3002− const float uf = ((2.f * ei) / ew - 1.f) * scale;
3003− const float vf = ((2.f * j + 1.f) / eh - 1.f) * scale;
3000+ const float uf = s->flat_range[0] * ((2.f * ei) / ew - 1.f);
3001+ const float vf = s->flat_range[1] * ((2.f * j + 1.f) / eh - 1.f);
30043002
30053003 const float h = hypotf(uf, vf);
30063004 const float lh = h > 0.f ? h : 1.f;
@@ -3034,8 +3032,6 @@ static int xyz_to_dfisheye(const V360Context *s, · 27 unmodified lines
30343032 const float *vec, int width, int height,
30353033 int16_t us[4][4], int16_t vs[4][4], float *du, float *dv)
30363034 {
3037− const float scale = 1.f - s->in_pad;
3038−
30393035 const float ew = width / 2.f;
30403036 const float eh = height;
30413037
@@ -3043,8 +3039,8 @@ static int xyz_to_dfisheye(const V360Context *s, · 1 unmodified line
30433039 const float lh = h > 0.f ? h : 1.f;
30443040 const float theta = acosf(fabsf(vec[2])) / M_PI;
30453041
3046− float uf = (theta * (vec[0] / lh) * s->input_mirror_modifier[0] * scale + 0.5f) * ew;
3047− float vf = (theta * (vec[1] / lh) * s->input_mirror_modifier[1] * scale + 0.5f) * eh;
3042+ float uf = (theta * (vec[0] / lh) * s->input_mirror_modifier[0] / s->iflat_range[0] + 0.5f) * ew;
3043+ float vf = (theta * (vec[1] / lh) * s->input_mirror_modifier[1] / s->iflat_range[1] + 0.5f) * eh;
30483044
30493045 int ui, vi;
30503046 int u_shift;
@@ -3657,6 +3653,14 @@ static void fov_from_dfov(int format, float d_fov, float w, float h, float *h_fo · 606 unmodified lines
36573653 *v_fov = 2.f * atan2f(h * 0.5f, l) * 360.f / M_PI;
36583654 }
36593655 break;
3656+ case DUAL_FISHEYE:
3657+ {
3658+ const float d = 0.5f * hypotf(w * 0.5f, h);
3659+
3660+ *h_fov = d / w * 2.f * d_fov;
3661+ *v_fov = d / h * d_fov;
3662+ }
3663+ break;
36603664 case FISHEYE:
36613665 {
36623666 const float d = 0.5f * hypotf(w, h);
@@ -3928,7 +3932,7 @@ static int config_output(AVFilterLink *outlink) · 265 unmodified lines
39283932 return AVERROR(EINVAL);
39293933 case DUAL_FISHEYE:
39303934 s->in_transform = xyz_to_dfisheye;
3931− err = 0;
3935+ err = prepare_fisheye_in(ctx);
39323936 wf = w;
39333937 hf = h;
39343938 break;
@@ -4058,7 +4062,7 @@ static int config_output(AVFilterLink *outlink) · 123 unmodified lines
40584062 break;
40594063 case DUAL_FISHEYE:
40604064 s->out_transform = dfisheye_to_xyz;
4061− prepare_out = NULL;
4065+ prepare_out = prepare_fisheye_out;
40624066 w = lrintf(wf);
40634067 h = lrintf(hf);
40644068 break;

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t