* [FFmpeg-devel] [PATCH 1/4] lavfi/vf_v360: drop nonsense inline specifier
@ 2022-05-19 13:47 Anton Khirnov
2022-05-19 13:47 ` [FFmpeg-devel] [PATCH 2/4] lavfi/vf_v360: factorize vector computation for barrelsplit Anton Khirnov
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: Anton Khirnov @ 2022-05-19 13:47 UTC (permalink / raw)
To: ffmpeg-devel
This function is always called indirectly, it cannot be inlined.
---
libavfilter/vf_v360.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/libavfilter/vf_v360.c b/libavfilter/vf_v360.c
index 7f377dd8f2..8f36d207c9 100644
--- a/libavfilter/vf_v360.c
+++ b/libavfilter/vf_v360.c
@@ -4239,7 +4239,7 @@ static void set_dimensions(int *outw, int *outh, int w, int h, const AVPixFmtDes
}
// Calculate remap data
-static av_always_inline int v360_slice(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)
+static int v360_slice(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)
{
V360Context *s = ctx->priv;
SliceXYRemap *r = &s->slice_remap[jobnr];
--
2.34.1
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 5+ messages in thread
* [FFmpeg-devel] [PATCH 2/4] lavfi/vf_v360: factorize vector computation for barrelsplit
2022-05-19 13:47 [FFmpeg-devel] [PATCH 1/4] lavfi/vf_v360: drop nonsense inline specifier Anton Khirnov
@ 2022-05-19 13:47 ` Anton Khirnov
2022-05-19 13:47 ` [FFmpeg-devel] [PATCH 3/4] lavfi/vf_v360: fix barrelsplit transform with padding Anton Khirnov
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: Anton Khirnov @ 2022-05-19 13:47 UTC (permalink / raw)
To: ffmpeg-devel
---
libavfilter/vf_v360.c | 20 ++++----------------
1 file changed, 4 insertions(+), 16 deletions(-)
diff --git a/libavfilter/vf_v360.c b/libavfilter/vf_v360.c
index 8f36d207c9..620a995733 100644
--- a/libavfilter/vf_v360.c
+++ b/libavfilter/vf_v360.c
@@ -3765,6 +3765,7 @@ static int barrelsplit_to_xyz(const V360Context *s,
const float scaleh = s->fout_pad > 0 ? 1.f - s->fout_pad / (height / 4.f) : 1.f - s->out_pad;
const int face = floorf(y * 4.f);
+ const float dir_vert = (face == 1 || face == 3) ? 1.0f : -1.0f;
float uf, vf;
uf = x * 3.f - 2.f;
@@ -3774,36 +3775,23 @@ static int barrelsplit_to_xyz(const V360Context *s,
vf = y * 2.f;
uf = 1.f - uf;
vf = 0.5f - vf;
-
- l_x = (0.5f - uf) / scalew;
- l_y = -0.5f;
- l_z = (0.5f - vf) / scaleh;
break;
case 1:
vf = y * 2.f;
uf = 1.f - uf;
vf = 1.f - (vf - 0.5f);
-
- l_x = (0.5f - uf) / scalew;
- l_y = 0.5f;
- l_z = (-0.5f + vf) / scaleh;
break;
case 2:
vf = y * 2.f - 0.5f;
vf = 1.f - (1.f - vf);
-
- l_x = (0.5f - uf) / scalew;
- l_y = -0.5f;
- l_z = (0.5f - vf) / scaleh;
break;
case 3:
vf = y * 2.f - 1.5f;
-
- l_x = (0.5f - uf) / scalew;
- l_y = 0.5f;
- l_z = (-0.5f + vf) / scaleh;
break;
}
+ l_x = (0.5f - uf) / scalew;
+ l_y = 0.5f * dir_vert;
+ l_z = (vf - 0.5f) * dir_vert / scaleh;
}
vec[0] = l_x;
--
2.34.1
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 5+ messages in thread
* [FFmpeg-devel] [PATCH 3/4] lavfi/vf_v360: fix barrelsplit transform with padding
2022-05-19 13:47 [FFmpeg-devel] [PATCH 1/4] lavfi/vf_v360: drop nonsense inline specifier Anton Khirnov
2022-05-19 13:47 ` [FFmpeg-devel] [PATCH 2/4] lavfi/vf_v360: factorize vector computation for barrelsplit Anton Khirnov
@ 2022-05-19 13:47 ` Anton Khirnov
2022-05-19 13:47 ` [FFmpeg-devel] [PATCH 4/4] lavfi/vf_v360: implement output mask for barrelsplit Anton Khirnov
2022-05-24 11:57 ` [FFmpeg-devel] [PATCH 1/4] lavfi/vf_v360: drop nonsense inline specifier Anton Khirnov
3 siblings, 0 replies; 5+ messages in thread
From: Anton Khirnov @ 2022-05-19 13:47 UTC (permalink / raw)
To: ffmpeg-devel
Make it match Facebook's transform360
(https://github.com/facebook/transform360)
Fixes one part of #9725.
---
libavfilter/vf_v360.c | 46 ++++++++++++++++++++-----------------------
1 file changed, 21 insertions(+), 25 deletions(-)
diff --git a/libavfilter/vf_v360.c b/libavfilter/vf_v360.c
index 620a995733..940e6fc5f6 100644
--- a/libavfilter/vf_v360.c
+++ b/libavfilter/vf_v360.c
@@ -3683,30 +3683,33 @@ static int xyz_to_barrelsplit(const V360Context *s,
u_shift = 2 * ew;
+ uf = vec[0] / vec[1] * scalew;
+ vf = vec[2] / vec[1] * scaleh;
+
if (theta <= 0.f && theta >= -M_PI_2 &&
phi <= M_PI_2 && phi >= -M_PI_2) {
- uf = -vec[0] / vec[1];
- vf = -vec[2] / vec[1];
+ uf *= -1.0f;
+ vf = -(vf + 1.f) * scaleh + 1.f;
v_shift = 0;
v_offset = -eh;
} else if (theta >= 0.f && theta <= M_PI_2 &&
phi <= M_PI_2 && phi >= -M_PI_2) {
- uf = vec[0] / vec[1];
- vf = -vec[2] / vec[1];
+ vf = -(vf - 1.f) * scaleh;
v_shift = height * 0.25f;
} else if (theta <= 0.f && theta >= -M_PI_2) {
- uf = vec[0] / vec[1];
- vf = vec[2] / vec[1];
+ // back top
+ vf = (vf - 1.f) * scaleh + 1.f;
v_shift = height * 0.5f;
v_offset = -eh;
} else {
- uf = -vec[0] / vec[1];
- vf = vec[2] / vec[1];
+ // back bottom
+ uf *= -1.0f;
+ vf = (vf + 1.f) * scaleh;
v_shift = height * 0.75f;
}
- uf = 0.5f * width / 3.f * (uf * scalew + 1.f);
- vf = height * 0.25f * (vf * scaleh + 1.f) + v_offset;
+ uf = 0.5f * width / 3.f * (uf + 1.f);
+ vf *= height * 0.25f;
}
ui = floorf(uf);
@@ -3764,29 +3767,22 @@ static int barrelsplit_to_xyz(const V360Context *s,
const float scalew = s->fout_pad > 0 ? 1.f - s->fout_pad / (width / 3.f) : 1.f - s->out_pad;
const float scaleh = s->fout_pad > 0 ? 1.f - s->fout_pad / (height / 4.f) : 1.f - s->out_pad;
- const int face = floorf(y * 4.f);
+ const float facef = floorf(y * 4.f);
+ const int face = facef;
const float dir_vert = (face == 1 || face == 3) ? 1.0f : -1.0f;
float uf, vf;
uf = x * 3.f - 2.f;
switch (face) {
- case 0:
- vf = y * 2.f;
+ case 0: // front top
+ case 1: // front bottom
uf = 1.f - uf;
- vf = 0.5f - vf;
- break;
- case 1:
- vf = y * 2.f;
- uf = 1.f - uf;
- vf = 1.f - (vf - 0.5f);
- break;
- case 2:
- vf = y * 2.f - 0.5f;
- vf = 1.f - (1.f - vf);
+ vf = (0.5f - 2.f * y) / scaleh + facef;
break;
- case 3:
- vf = y * 2.f - 1.5f;
+ case 2: // back top
+ case 3: // back bottom
+ vf = (y * 2.f - 1.5f) / scaleh + 3.f - facef;
break;
}
l_x = (0.5f - uf) / scalew;
--
2.34.1
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 5+ messages in thread
* [FFmpeg-devel] [PATCH 4/4] lavfi/vf_v360: implement output mask for barrelsplit
2022-05-19 13:47 [FFmpeg-devel] [PATCH 1/4] lavfi/vf_v360: drop nonsense inline specifier Anton Khirnov
2022-05-19 13:47 ` [FFmpeg-devel] [PATCH 2/4] lavfi/vf_v360: factorize vector computation for barrelsplit Anton Khirnov
2022-05-19 13:47 ` [FFmpeg-devel] [PATCH 3/4] lavfi/vf_v360: fix barrelsplit transform with padding Anton Khirnov
@ 2022-05-19 13:47 ` Anton Khirnov
2022-05-24 11:57 ` [FFmpeg-devel] [PATCH 1/4] lavfi/vf_v360: drop nonsense inline specifier Anton Khirnov
3 siblings, 0 replies; 5+ messages in thread
From: Anton Khirnov @ 2022-05-19 13:47 UTC (permalink / raw)
To: ffmpeg-devel
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.
---
libavfilter/vf_v360.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/libavfilter/vf_v360.c b/libavfilter/vf_v360.c
index 940e6fc5f6..42b1761333 100644
--- a/libavfilter/vf_v360.c
+++ b/libavfilter/vf_v360.c
@@ -3745,6 +3745,7 @@ static int barrelsplit_to_xyz(const V360Context *s,
const float x = (i + 0.5f) / width;
const float y = (j + 0.5f) / height;
float l_x, l_y, l_z;
+ int ret;
if (x < 2.f / 3.f) {
const float scalew = s->fout_pad > 0 ? 1.f - s->fout_pad / (width * 2.f / 3.f) : 1.f - s->out_pad;
@@ -3763,6 +3764,8 @@ static int barrelsplit_to_xyz(const V360Context *s,
l_x = cos_theta * sin_phi;
l_y = sin_theta;
l_z = cos_theta * cos_phi;
+
+ ret = 1;
} else {
const float scalew = s->fout_pad > 0 ? 1.f - s->fout_pad / (width / 3.f) : 1.f - s->out_pad;
const float scaleh = s->fout_pad > 0 ? 1.f - s->fout_pad / (height / 4.f) : 1.f - s->out_pad;
@@ -3788,13 +3791,14 @@ static int barrelsplit_to_xyz(const V360Context *s,
l_x = (0.5f - uf) / scalew;
l_y = 0.5f * dir_vert;
l_z = (vf - 0.5f) * dir_vert / scaleh;
+ ret = (l_x * l_x * scalew * scalew + l_z * l_z * scaleh * scaleh) < 0.5f * 0.5f;
}
vec[0] = l_x;
vec[1] = l_y;
vec[2] = l_z;
- return 1;
+ return ret;
}
/**
--
2.34.1
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [FFmpeg-devel] [PATCH 1/4] lavfi/vf_v360: drop nonsense inline specifier
2022-05-19 13:47 [FFmpeg-devel] [PATCH 1/4] lavfi/vf_v360: drop nonsense inline specifier Anton Khirnov
` (2 preceding siblings ...)
2022-05-19 13:47 ` [FFmpeg-devel] [PATCH 4/4] lavfi/vf_v360: implement output mask for barrelsplit Anton Khirnov
@ 2022-05-24 11:57 ` Anton Khirnov
3 siblings, 0 replies; 5+ messages in thread
From: Anton Khirnov @ 2022-05-24 11:57 UTC (permalink / raw)
To: FFmpeg development discussions and patches
set approved by Paul on IRC and pushed with trivial changes
--
Anton Khirnov
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2022-05-24 11:57 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-19 13:47 [FFmpeg-devel] [PATCH 1/4] lavfi/vf_v360: drop nonsense inline specifier Anton Khirnov
2022-05-19 13:47 ` [FFmpeg-devel] [PATCH 2/4] lavfi/vf_v360: factorize vector computation for barrelsplit Anton Khirnov
2022-05-19 13:47 ` [FFmpeg-devel] [PATCH 3/4] lavfi/vf_v360: fix barrelsplit transform with padding Anton Khirnov
2022-05-19 13:47 ` [FFmpeg-devel] [PATCH 4/4] lavfi/vf_v360: implement output mask for barrelsplit Anton Khirnov
2022-05-24 11:57 ` [FFmpeg-devel] [PATCH 1/4] lavfi/vf_v360: drop nonsense inline specifier Anton Khirnov
Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
This inbox may be cloned and mirrored by anyone:
git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git
# If you have public-inbox 1.1+ installed, you may
# initialize and index your mirror using the following commands:
public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
ffmpegdev@gitmailbox.com
public-inbox-index ffmpegdev
Example config snippet for mirrors.
AGPL code for this site: git clone https://public-inbox.org/public-inbox.git