* [FFmpeg-devel] [PATCH 2/3] avfilter/delogo: added circular delogo algorithm description
@ 2025-02-03 20:45 Jörg Habenicht via ffmpeg-devel
0 siblings, 0 replies; 2+ messages in thread
From: Jörg Habenicht via ffmpeg-devel @ 2025-02-03 20:45 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: Jörg Habenicht
Added a description of the elliptic formed delogo algorithm. Placed it
outside the doxygen function comment.
Signed-off-by: Jörg Habenicht <j.habenicht@gmx.de>
---
libavfilter/vf_delogo.c | 24 ++++++++++++++++++++++++
1 file changed, 24 insertions(+)
diff --git a/libavfilter/vf_delogo.c b/libavfilter/vf_delogo.c
index 7641c3b483..ea741e2700 100644
--- a/libavfilter/vf_delogo.c
+++ b/libavfilter/vf_delogo.c
@@ -100,6 +100,30 @@ static void apply_delogo(uint8_t *dst, int
dst_linesize,
int logo_x, int logo_y, int logo_w, int logo_h,
unsigned int band, int show, int direct)
{
+ /* Round area algorithm description:
+ *
+ * logo_x, logo_y, logo_w and logo_h define the boundaries of the
+ * ellipse. In the ellipse formula x^2 / a^2 + y^2 / b^2 = 1 let
+ * a = logo_w/2, b = logo_h/2 and the center of the ellipse
+ * (0,0) = (logo_x + a, logo_y + b).
+ * Let the picture dimensions (px,py,pw,ph) := function API(x,y,w,h).
+ * A point of the picture is transformed into the ellipse coordinates
+ * by using x = px - (logo_x + a), y = py - (logo_y +b).
+ *
+ * A point is inside the ellipse if x^2 / a^2 + y^2 / b^2 <= 1
+ * <=> (x + logo_x)^2 / (logo_w / 2)^2
+ * + (y + logo_y)^2 / (logo_h / 2)^2 <= 1
+ * <=> (px - logo_x - a + logo_x)^2 / (logo_w / 2)^2
+ * + (py - logo_y - b + logo_y)^2 / (logo_h / 2)^2 <= 1
+ * <=> (px - a)^2 / (logo_w / 2)^2
+ * + (py - b)^2 / (logo_h / 2)^2 <= 1
+ * <=> ((px - a) / (logo_w / 2))^2
+ * + ((py - b) / (logo_h / 2))^2 <= 1
+ *
+ * px is later defined x, py defined y.
+ * logo_w is later defined logo_w2, logo_h defined logo_h2.
+ */
+
int x, y;
uint64_t interp, weightl, weightr, weightt, weightb, weight;
uint8_t *xdst, *xsrc;
--
2.45.3
_______________________________________________
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] 2+ messages in thread
* [FFmpeg-devel] [PATCH 2/3] avfilter/delogo: added circular delogo algorithm description
2025-02-04 19:53 [FFmpeg-devel] [PATCH 0/3] Patch to create a circular delogo area Jörg Habenicht via ffmpeg-devel
@ 2025-02-04 19:53 ` Jörg Habenicht via ffmpeg-devel
0 siblings, 0 replies; 2+ messages in thread
From: Jörg Habenicht via ffmpeg-devel @ 2025-02-04 19:53 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: Jörg Habenicht
Added a description of the elliptic formed delogo algorithm. Placed it
outside the doxygen function comment.
Signed-off-by: Jörg Habenicht <j.habenicht@gmx.de>
---
libavfilter/vf_delogo.c | 24 ++++++++++++++++++++++++
1 file changed, 24 insertions(+)
diff --git a/libavfilter/vf_delogo.c b/libavfilter/vf_delogo.c
index 7641c3b483..ea741e2700 100644
--- a/libavfilter/vf_delogo.c
+++ b/libavfilter/vf_delogo.c
@@ -100,6 +100,30 @@ static void apply_delogo(uint8_t *dst, int dst_linesize,
int logo_x, int logo_y, int logo_w, int logo_h,
unsigned int band, int show, int direct)
{
+ /* Round area algorithm description:
+ *
+ * logo_x, logo_y, logo_w and logo_h define the boundaries of the
+ * ellipse. In the ellipse formula x^2 / a^2 + y^2 / b^2 = 1 let
+ * a = logo_w/2, b = logo_h/2 and the center of the ellipse
+ * (0,0) = (logo_x + a, logo_y + b).
+ * Let the picture dimensions (px,py,pw,ph) := function API(x,y,w,h).
+ * A point of the picture is transformed into the ellipse coordinates
+ * by using x = px - (logo_x + a), y = py - (logo_y +b).
+ *
+ * A point is inside the ellipse if x^2 / a^2 + y^2 / b^2 <= 1
+ * <=> (x + logo_x)^2 / (logo_w / 2)^2
+ * + (y + logo_y)^2 / (logo_h / 2)^2 <= 1
+ * <=> (px - logo_x - a + logo_x)^2 / (logo_w / 2)^2
+ * + (py - logo_y - b + logo_y)^2 / (logo_h / 2)^2 <= 1
+ * <=> (px - a)^2 / (logo_w / 2)^2
+ * + (py - b)^2 / (logo_h / 2)^2 <= 1
+ * <=> ((px - a) / (logo_w / 2))^2
+ * + ((py - b) / (logo_h / 2))^2 <= 1
+ *
+ * px is later defined x, py defined y.
+ * logo_w is later defined logo_w2, logo_h defined logo_h2.
+ */
+
int x, y;
uint64_t interp, weightl, weightr, weightt, weightb, weight;
uint8_t *xdst, *xsrc;
--
2.45.3
_______________________________________________
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] 2+ messages in thread
end of thread, other threads:[~2025-02-04 19:55 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-02-03 20:45 [FFmpeg-devel] [PATCH 2/3] avfilter/delogo: added circular delogo algorithm description Jörg Habenicht via ffmpeg-devel
2025-02-04 19:53 [FFmpeg-devel] [PATCH 0/3] Patch to create a circular delogo area Jörg Habenicht via ffmpeg-devel
2025-02-04 19:53 ` [FFmpeg-devel] [PATCH 2/3] avfilter/delogo: added circular delogo algorithm description Jörg Habenicht via ffmpeg-devel
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