Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
From: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
To: ffmpeg-devel@ffmpeg.org
Cc: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Subject: [FFmpeg-devel] [PATCH 1/9] avfilter/bwdif: Add proper BWDIFDSPContext
Date: Mon, 25 Sep 2023 19:53:08 +0200
Message-ID: <AS8P250MB0744D7FEB3A2719DC2D9F0EA8FFCA@AS8P250MB0744.EURP250.PROD.OUTLOOK.COM> (raw)

This already avoids unnecessary indirectly included headers
in the arch-specific vf_bwdif_init.c files; it is also in
preparation for splitting the actual functions out of vf_bwdif.c.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
 libavfilter/aarch64/vf_bwdif_init_aarch64.c |  4 ++--
 libavfilter/{bwdif.h => bwdifdsp.h}         | 22 +++++++-------------
 libavfilter/vf_bwdif.c                      | 23 ++++++++++++++-------
 libavfilter/x86/vf_bwdif_init.c             |  4 ++--
 tests/checkasm/vf_bwdif.c                   |  5 ++---
 5 files changed, 29 insertions(+), 29 deletions(-)
 rename libavfilter/{bwdif.h => bwdifdsp.h} (85%)

diff --git a/libavfilter/aarch64/vf_bwdif_init_aarch64.c b/libavfilter/aarch64/vf_bwdif_init_aarch64.c
index f52bc4b9b4..2b8d212de6 100644
--- a/libavfilter/aarch64/vf_bwdif_init_aarch64.c
+++ b/libavfilter/aarch64/vf_bwdif_init_aarch64.c
@@ -21,7 +21,7 @@
  */
 
 #include "libavutil/common.h"
-#include "libavfilter/bwdif.h"
+#include "libavfilter/bwdifdsp.h"
 #include "libavutil/aarch64/cpu.h"
 
 void ff_bwdif_filter_edge_neon(void *dst1, void *prev1, void *cur1, void *next1,
@@ -107,7 +107,7 @@ static void filter_intra_helper(void *dst1, void *cur1, int w, int prefs, int mr
 }
 
 void
-ff_bwdif_init_aarch64(BWDIFContext *s, int bit_depth)
+ff_bwdif_init_aarch64(BWDIFDSPContext *s, int bit_depth)
 {
     const int cpu_flags = av_get_cpu_flags();
 
diff --git a/libavfilter/bwdif.h b/libavfilter/bwdifdsp.h
similarity index 85%
rename from libavfilter/bwdif.h
rename to libavfilter/bwdifdsp.h
index 496cec72ef..1ff810719f 100644
--- a/libavfilter/bwdif.h
+++ b/libavfilter/bwdifdsp.h
@@ -16,16 +16,10 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
-#ifndef AVFILTER_BWDIF_H
-#define AVFILTER_BWDIF_H
-
-#include "libavutil/pixdesc.h"
-#include "avfilter.h"
-#include "yadif.h"
-
-typedef struct BWDIFContext {
-    YADIFContext yadif;
+#ifndef AVFILTER_BWDIFDSP_H
+#define AVFILTER_BWDIFDSP_H
 
+typedef struct BWDIFDSPContext {
     void (*filter_intra)(void *dst1, void *cur1, int w, int prefs, int mrefs,
                          int prefs3, int mrefs3, int parity, int clip_max);
     void (*filter_line)(void *dst, void *prev, void *cur, void *next,
@@ -38,11 +32,11 @@ typedef struct BWDIFContext {
     void (*filter_line3)(void *dst, int dstride,
                          const void *prev, const void *cur, const void *next, int prefs,
                          int w, int parity, int clip_max);
-} BWDIFContext;
+} BWDIFDSPContext;
 
-void ff_bwdif_init_filter_line(BWDIFContext *bwdif, int bit_depth);
-void ff_bwdif_init_x86(BWDIFContext *bwdif, int bit_depth);
-void ff_bwdif_init_aarch64(BWDIFContext *bwdif, int bit_depth);
+void ff_bwdif_init_filter_line(BWDIFDSPContext *bwdif, int bit_depth);
+void ff_bwdif_init_x86(BWDIFDSPContext *bwdif, int bit_depth);
+void ff_bwdif_init_aarch64(BWDIFDSPContext *bwdif, int bit_depth);
 
 void ff_bwdif_filter_edge_c(void *dst1, void *prev1, void *cur1, void *next1,
                             int w, int prefs, int mrefs, int prefs2, int mrefs2,
@@ -60,4 +54,4 @@ void ff_bwdif_filter_line3_c(void * dst1, int d_stride,
                              const void * prev1, const void * cur1, const void * next1, int s_stride,
                              int w, int parity, int clip_max);
 
-#endif /* AVFILTER_BWDIF_H */
+#endif /* AVFILTER_BWDIFDSP_H */
diff --git a/libavfilter/vf_bwdif.c b/libavfilter/vf_bwdif.c
index 6195e6cb64..282aef5698 100644
--- a/libavfilter/vf_bwdif.c
+++ b/libavfilter/vf_bwdif.c
@@ -32,8 +32,10 @@
 #include "libavutil/opt.h"
 #include "libavutil/pixdesc.h"
 #include "avfilter.h"
+#include "bwdifdsp.h"
+#include "ccfifo.h"
 #include "internal.h"
-#include "bwdif.h"
+#include "yadif.h"
 
 /*
  * Filter coefficients coef_lf and coef_hf taken from BBC PH-2071 (Weston 3 Field Deinterlacer).
@@ -45,6 +47,11 @@ static const uint16_t coef_lf[2] = { 4309, 213 };
 static const uint16_t coef_hf[3] = { 5570, 3801, 1016 };
 static const uint16_t coef_sp[2] = { 5077, 981 };
 
+typedef struct BWDIFContext {
+    YADIFContext yadif;
+    BWDIFDSPContext dsp;
+} BWDIFContext;
+
 typedef struct ThreadData {
     AVFrame *frame;
     int plane;
@@ -261,25 +268,25 @@ static int filter_slice(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)
             uint8_t *next = &yadif->next->data[td->plane][y * linesize];
             uint8_t *dst  = &td->frame->data[td->plane][y * td->frame->linesize[td->plane]];
             if (yadif->current_field == YADIF_FIELD_END) {
-                s->filter_intra(dst, cur, td->w, (y + df) < td->h ? refs : -refs,
+                s->dsp.filter_intra(dst, cur, td->w, (y + df) < td->h ? refs : -refs,
                                 y > (df - 1) ? -refs : refs,
                                 (y + 3*df) < td->h ? 3 * refs : -refs,
                                 y > (3*df - 1) ? -3 * refs : refs,
                                 td->parity ^ td->tff, clip_max);
             } else if ((y < 4) || ((y + 5) > td->h)) {
-                s->filter_edge(dst, prev, cur, next, td->w,
+                s->dsp.filter_edge(dst, prev, cur, next, td->w,
                                (y + df) < td->h ? refs : -refs,
                                y > (df - 1) ? -refs : refs,
                                refs << 1, -(refs << 1),
                                td->parity ^ td->tff, clip_max,
                                (y < 2) || ((y + 3) > td->h) ? 0 : 1);
-            } else if (s->filter_line3 && y + 2 < slice_end && y + 6 < td->h) {
-                s->filter_line3(dst, td->frame->linesize[td->plane],
+            } else if (s->dsp.filter_line3 && y + 2 < slice_end && y + 6 < td->h) {
+                s->dsp.filter_line3(dst, td->frame->linesize[td->plane],
                                 prev, cur, next, linesize, td->w,
                                 td->parity ^ td->tff, clip_max);
                 y += 2;
             } else {
-                s->filter_line(dst, prev, cur, next, td->w,
+                s->dsp.filter_line(dst, prev, cur, next, td->w,
                                refs, -refs, refs << 1, -(refs << 1),
                                3 * refs, -3 * refs, refs << 2, -(refs << 2),
                                td->parity ^ td->tff, clip_max);
@@ -382,12 +389,12 @@ static int config_props(AVFilterLink *link)
 
     yadif->csp = av_pix_fmt_desc_get(link->format);
     yadif->filter = filter;
-    ff_bwdif_init_filter_line(s, yadif->csp->comp[0].depth);
+    ff_bwdif_init_filter_line(&s->dsp, yadif->csp->comp[0].depth);
 
     return 0;
 }
 
-av_cold void ff_bwdif_init_filter_line(BWDIFContext *s, int bit_depth)
+av_cold void ff_bwdif_init_filter_line(BWDIFDSPContext *s, int bit_depth)
 {
     s->filter_line3 = 0;
     if (bit_depth > 8) {
diff --git a/libavfilter/x86/vf_bwdif_init.c b/libavfilter/x86/vf_bwdif_init.c
index 57f908a8ef..b1d1d6a91c 100644
--- a/libavfilter/x86/vf_bwdif_init.c
+++ b/libavfilter/x86/vf_bwdif_init.c
@@ -22,7 +22,7 @@
 #include "libavutil/cpu.h"
 #include "libavutil/x86/asm.h"
 #include "libavutil/x86/cpu.h"
-#include "libavfilter/bwdif.h"
+#include "libavfilter/bwdifdsp.h"
 
 void ff_bwdif_filter_line_sse2(void *dst, void *prev, void *cur, void *next,
                                int w, int prefs, int mrefs, int prefs2,
@@ -50,7 +50,7 @@ void ff_bwdif_filter_line_12bit_avx2(void *dst, void *prev, void *cur, void *nex
                                      int mrefs2, int prefs3, int mrefs3, int prefs4,
                                      int mrefs4, int parity, int clip_max);
 
-av_cold void ff_bwdif_init_x86(BWDIFContext *bwdif, int bit_depth)
+av_cold void ff_bwdif_init_x86(BWDIFDSPContext *bwdif, int bit_depth)
 {
     int cpu_flags = av_get_cpu_flags();
 
diff --git a/tests/checkasm/vf_bwdif.c b/tests/checkasm/vf_bwdif.c
index 3399cacdf7..fae61b62e4 100644
--- a/tests/checkasm/vf_bwdif.c
+++ b/tests/checkasm/vf_bwdif.c
@@ -18,8 +18,7 @@
 
 #include <string.h>
 #include "checkasm.h"
-#include "libavcodec/internal.h"
-#include "libavfilter/bwdif.h"
+#include "libavfilter/bwdifdsp.h"
 #include "libavutil/mem_internal.h"
 
 #define WIDTH 256
@@ -72,7 +71,7 @@
 
 void checkasm_check_vf_bwdif(void)
 {
-    BWDIFContext ctx_8, ctx_10;
+    BWDIFDSPContext ctx_8, ctx_10;
 
     ff_bwdif_init_filter_line(&ctx_8, 8);
     ff_bwdif_init_filter_line(&ctx_10, 10);
-- 
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".

             reply	other threads:[~2023-09-25 17:52 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-25 17:53 Andreas Rheinhardt [this message]
2023-09-25 18:04 ` [FFmpeg-devel] [PATCH 2/9] avfilter/vf_bwdif: Move DSP code to a new file Andreas Rheinhardt
2023-09-25 18:04 ` [FFmpeg-devel] [PATCH 3/9] avfilter/bwdifdsp: Constify Andreas Rheinhardt
2023-09-25 18:04 ` [FFmpeg-devel] [PATCH 4/9] avfilter/bwdifdsp: Avoid including ff_bwdif_filter_line3_c() Andreas Rheinhardt
2023-09-25 18:04 ` [FFmpeg-devel] [PATCH 5/9] checkasm/motion: Don't allocate AVCodecContext Andreas Rheinhardt
2023-09-25 18:04 ` [FFmpeg-devel] [PATCH 6/9] avcodec/snow: Split ff_snow_get_buffer() Andreas Rheinhardt
2023-09-25 18:04 ` [FFmpeg-devel] [PATCH 7/9] avcodec/snow: Move decoder parts out of ff_snow_common_init_after_header Andreas Rheinhardt
2023-09-25 18:04 ` [FFmpeg-devel] [PATCH 8/9] avcodec/aacsbrdata: Move ff_sbr_noise_table to sbrdsp_template.c Andreas Rheinhardt
2023-09-25 18:04 ` [FFmpeg-devel] [PATCH 9/9] avcodec/tests/.gitignore: Add bitstream test tools Andreas Rheinhardt
2023-09-26 22:11 ` [FFmpeg-devel] [PATCH 1/9] avfilter/bwdif: Add proper BWDIFDSPContext Andreas Rheinhardt

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=AS8P250MB0744D7FEB3A2719DC2D9F0EA8FFCA@AS8P250MB0744.EURP250.PROD.OUTLOOK.COM \
    --to=andreas.rheinhardt@outlook.com \
    --cc=ffmpeg-devel@ffmpeg.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

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