History

avfilter/vf_v360: speed up fisheye input calculation

Paul B Mahol committed 6 years ago

Commit 3733a6b1 parent 2dfd9441 file · +5 −4Browse files

Unified · Split

libavfilter/vf_v360.c+5−4
@@ -2484,11 +2484,12 @@ static int xyz_to_fisheye(const V360Context *s, · 2483 unmodified lines
2484 const float *vec, int width, int height,2484 const float *vec, int width, int height,
2485 int16_t us[4][4], int16_t vs[4][4], float *du, float *dv)2485 int16_t us[4][4], int16_t vs[4][4], float *du, float *dv)
2486{2486{
2487 const float phi = -atan2f(hypotf(vec[0], vec[1]), -vec[2]) / M_PI;2487 const float h = hypotf(vec[0], vec[1]);
2488 const float theta = -atan2f(vec[0], vec[1]);2488 const float lh = h > 0.f ? h : 1.f;
2489 const float phi = atan2f(h, -vec[2]) / M_PI;
2489 2490
2490 float uf = sinf(theta) * phi * s->input_mirror_modifier[0] / s->iflat_range[0];2491 float uf = vec[0] / lh * phi * s->input_mirror_modifier[0] / s->iflat_range[0];
2491 float vf = cosf(theta) * phi * s->input_mirror_modifier[1] / s->iflat_range[1];2492 float vf = -vec[1] / lh * phi * s->input_mirror_modifier[1] / s->iflat_range[1];
2492 2493
2493 const int visible = hypotf(uf, vf) <= 0.5f;2494 const int visible = hypotf(uf, vf) <= 0.5f;
2494 int ui, vi;2495 int ui, vi;

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