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

Unified · Split

libavfilter/vf_v360.c+5−1
@@ -3744,6 +3744,7 @@ static int barrelsplit_to_xyz(const V360Context *s, · 3743 unmodified lines
37443744 const float x = (i + 0.5f) / width;
37453745 const float y = (j + 0.5f) / height;
37463746 float l_x, l_y, l_z;
3747+ int ret;
37473748
37483749 if (x < 2.f / 3.f) {
37493750 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
37623763 l_x = cos_theta * sin_phi;
37633764 l_y = sin_theta;
37643765 l_z = cos_theta * cos_phi;
3766+
3767+ ret = 1;
37653768 } else {
37663769 const float scalew = s->fout_pad > 0 ? 1.f - s->fout_pad / (width / 3.f) : 1.f - s->out_pad;
37673770 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
37873790 l_x = (0.5f - uf) / scalew;
37883791 l_y = 0.5f * dir_vert;
37893792 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;
37903794 }
37913795
37923796 vec[0] = l_x;
37933797 vec[1] = l_y;
37943798 vec[2] = l_z;
37953799
3796− return 1;
3800+ return ret;
37973801 }
37983802
37993803 /**

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