History

lavfi/vf_v360: implement output mask for barrelsplit

The top/bottom of the barrel are each coded as two semicircles inside a square block in the frame. Mask out the parts of the square that lie outside of these semicircles, so they are made transparent when alpha_mask=1. Fixes the other part of #9725.

Anton Khirnov committed 4 years ago

Commit fa26e171 parent 83a5ef51 file · +5 −1Browse files

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

Unified · Split

libavfilter/vf_v360.c+5−1
@@ -3744,6 +3744,7 @@ static int barrelsplit_to_xyz(const V360Context *s, · 3743 unmodified lines
3744 const float x = (i + 0.5f) / width;3744 const float x = (i + 0.5f) / width;
3745 const float y = (j + 0.5f) / height;3745 const float y = (j + 0.5f) / height;
3746 float l_x, l_y, l_z;3746 float l_x, l_y, l_z;
3747 int ret;
3747 3748
3748 if (x < 2.f / 3.f) {3749 if (x < 2.f / 3.f) {
3749 const float scalew = s->fout_pad > 0 ? 1.f - s->fout_pad / (width * 2.f / 3.f) : 1.f - s->out_pad;3750 const float scalew = s->fout_pad > 0 ? 1.f - s->fout_pad / (width * 2.f / 3.f) : 1.f - s->out_pad;
@@ -3762,6 +3763,8 @@ static int barrelsplit_to_xyz(const V360Context *s, · 12 unmodified lines
3762 l_x = cos_theta * sin_phi;3763 l_x = cos_theta * sin_phi;
3763 l_y = sin_theta;3764 l_y = sin_theta;
3764 l_z = cos_theta * cos_phi;3765 l_z = cos_theta * cos_phi;
3766
3767 ret = 1;
3765 } else {3768 } else {
3766 const float scalew = s->fout_pad > 0 ? 1.f - s->fout_pad / (width / 3.f) : 1.f - s->out_pad;3769 const float scalew = s->fout_pad > 0 ? 1.f - s->fout_pad / (width / 3.f) : 1.f - s->out_pad;
3767 const float scaleh = s->fout_pad > 0 ? 1.f - s->fout_pad / (height / 4.f) : 1.f - s->out_pad;3770 const float scaleh = s->fout_pad > 0 ? 1.f - s->fout_pad / (height / 4.f) : 1.f - s->out_pad;
@@ -3787,13 +3790,14 @@ static int barrelsplit_to_xyz(const V360Context *s, · 19 unmodified lines
3787 l_x = (0.5f - uf) / scalew;3790 l_x = (0.5f - uf) / scalew;
3788 l_y = 0.5f * dir_vert;3791 l_y = 0.5f * dir_vert;
3789 l_z = (vf - 0.5f) * dir_vert / scaleh;3792 l_z = (vf - 0.5f) * dir_vert / scaleh;
3793 ret = (l_x * l_x * scalew * scalew + l_z * l_z * scaleh * scaleh) < 0.5f * 0.5f;
3790 }3794 }
3791 3795
3792 vec[0] = l_x;3796 vec[0] = l_x;
3793 vec[1] = l_y;3797 vec[1] = l_y;
3794 vec[2] = l_z;3798 vec[2] = l_z;
3795 3799
3796 return 1;3800 return ret;
3797}3801}
3798 3802
3799/**3803/**

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