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

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

Unified · Split

2 files
  1. libavfilter/v360.h +0 −1
  2. libavfilter/vf_v360.c +4 −21
libavfilter/v360.h+0−1
@@ -105,7 +105,6 @@ typedef struct V360Context { · 104 unmodified lines
105 105
106 float h_fov, v_fov;106 float h_fov, v_fov;
107 float flat_range[3];107 float flat_range[3];
108 float p_lon, p_lat;
109 108
110 float input_mirror_modifier[2];109 float input_mirror_modifier[2];
111 110
libavfilter/vf_v360.c+4−21
@@ -33,8 +33,6 @@ · 32 unmodified lines
33 * 5) Remap input frame to output frame using precalculated data33 * 5) Remap input frame to output frame using precalculated data
34 */34 */
35 35
36#include <float.h>
37
38#include "libavutil/avassert.h"36#include "libavutil/avassert.h"
39#include "libavutil/imgutils.h"37#include "libavutil/imgutils.h"
40#include "libavutil/pixdesc.h"38#include "libavutil/pixdesc.h"
@@ -107,8 +105,6 @@ static const AVOption v360_options[] = { · 66 unmodified lines
107 { "iv_flip", "flip in video vertically", OFFSET(iv_flip), AV_OPT_TYPE_BOOL, {.i64=0}, 0, 1, FLAGS, "iv_flip"},105 { "iv_flip", "flip in video vertically", OFFSET(iv_flip), AV_OPT_TYPE_BOOL, {.i64=0}, 0, 1, FLAGS, "iv_flip"},
108 { "in_trans", "transpose video input", OFFSET(in_transpose), AV_OPT_TYPE_BOOL, {.i64=0}, 0, 1, FLAGS, "in_transpose"},106 { "in_trans", "transpose video input", OFFSET(in_transpose), AV_OPT_TYPE_BOOL, {.i64=0}, 0, 1, FLAGS, "in_transpose"},
109 { "out_trans", "transpose video output", OFFSET(out_transpose), AV_OPT_TYPE_BOOL, {.i64=0}, 0, 1, FLAGS, "out_transpose"},107 { "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"},
112 { NULL }108 { NULL }
113};109};
114 110
@@ -1412,24 +1408,11 @@ static void stereographic_to_xyz(const V360Context *s, · 1297 unmodified lines
1412{1408{
1413 const float x = ((2.f * i) / width - 1.f) * (s->h_fov / 180.f) * M_PI;1409 const float x = ((2.f * i) / width - 1.f) * (s->h_fov / 180.f) * M_PI;
1414 const float y = ((2.f * j) / height - 1.f) * (s->v_fov / 90.f) * M_PI_2;1410 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;1411 const float xy = x * x + y * y;
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);
1429 1412
1430 vec[0] = cos_theta * sin_phi;1413 vec[0] = 2.f * x / (1.f + xy);
1431 vec[1] = -sin_theta;1414 vec[1] = (-1.f + xy) / (1.f + xy);
1432 vec[2] = -cos_theta * cos_phi;1415 vec[2] = 2.f * y / (1.f + xy);
1433 1416
1434 normalize_vector(vec);1417 normalize_vector(vec);
1435}1418}

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