History

avfilter/vf_v360: partialy revert previous commit

roll/pitch can do exactly same thing.

Paul B Mahol committed 7 years ago

Commit 799c07e1 parent 976617c3 files · +4 −26Browse files

Unified · Split

3 files
  1. doc/filters.texi +0 −4
  2. libavfilter/v360.h +0 −1
  3. libavfilter/vf_v360.c +4 −21
doc/filters.texi+0−4
@@ -18040,10 +18040,6 @@ Format specific options: · 18039 unmodified lines
1804018040 @item h_fov
1804118041 @item v_fov
1804218042 Set horizontal/vertical field of view. Values in degrees.
18043−
18044−@item p_lon
18045−@item p_lat
18046−Set central point of projection longitude/latitude. Values in degrees.
1804718043 @end table
1804818044
1804918045 @end table
libavfilter/v360.h+0−1
@@ -105,7 +105,6 @@ typedef struct V360Context { · 104 unmodified lines
105105
106106 float h_fov, v_fov;
107107 float flat_range[3];
108− float p_lon, p_lat;
109108
110109 float input_mirror_modifier[2];
111110
libavfilter/vf_v360.c+4−21
@@ -33,8 +33,6 @@ · 32 unmodified lines
3333 * 5) Remap input frame to output frame using precalculated data
3434 */
3535
36−#include <float.h>
37−
3836 #include "libavutil/avassert.h"
3937 #include "libavutil/imgutils.h"
4038 #include "libavutil/pixdesc.h"
@@ -107,8 +105,6 @@ static const AVOption v360_options[] = { · 66 unmodified lines
107105 { "iv_flip", "flip in video vertically", OFFSET(iv_flip), AV_OPT_TYPE_BOOL, {.i64=0}, 0, 1, FLAGS, "iv_flip"},
108106 { "in_trans", "transpose video input", OFFSET(in_transpose), AV_OPT_TYPE_BOOL, {.i64=0}, 0, 1, FLAGS, "in_transpose"},
109107 { "out_trans", "transpose video output", OFFSET(out_transpose), AV_OPT_TYPE_BOOL, {.i64=0}, 0, 1, FLAGS, "out_transpose"},
110− { "p_lon", "central projection longitude", OFFSET(p_lon), AV_OPT_TYPE_FLOAT, {.dbl=0.f}, -180.f, 180.f, FLAGS, "p_lon"},
111− { "p_lat", "central projection latitude", OFFSET(p_lat), AV_OPT_TYPE_FLOAT, {.dbl=90.f}, -90.f, 90.f, FLAGS, "p_lat"},
112108 { NULL }
113109 };
114110
@@ -1412,24 +1408,11 @@ static void stereographic_to_xyz(const V360Context *s, · 1297 unmodified lines
14121408 {
14131409 const float x = ((2.f * i) / width - 1.f) * (s->h_fov / 180.f) * M_PI;
14141410 const float y = ((2.f * j) / height - 1.f) * (s->v_fov / 90.f) * M_PI_2;
1415− const float rho = hypotf(x, y) + FLT_EPSILON;
1416− const float c = 2.f * atan2f(rho, 0.15f / 2.f);
1417− const float cos_c = cosf(c);
1418− const float sin_c = sinf(c);
1419− const float cp_x = s->p_lon / 180.f * M_PI;
1420− const float cp_y = s->p_lat / 90.f * M_PI_2;
1421−
1422− const float phi = cp_x + atan2f(x * sin_c, rho * cosf(cp_y) * cos_c - y * sinf(cp_y) * sin_c);
1423− const float theta = asinf(cos_c * sinf(cp_y) + (y * sin_c * cosf(cp_y)) / rho);
1424−
1425− const float sin_phi = sinf(phi);
1426− const float cos_phi = cosf(phi);
1427− const float sin_theta = sinf(theta);
1428− const float cos_theta = cosf(theta);
1411+ const float xy = x * x + y * y;
14291412
1430− vec[0] = cos_theta * sin_phi;
1431− vec[1] = -sin_theta;
1432− vec[2] = -cos_theta * cos_phi;
1413+ vec[0] = 2.f * x / (1.f + xy);
1414+ vec[1] = (-1.f + xy) / (1.f + xy);
1415+ vec[2] = 2.f * y / (1.f + xy);
14331416
14341417 normalize_vector(vec);
14351418 }

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