Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
* [FFmpeg-devel] [PATCH] avcodec/iirfilter: Move ff_iir_filter() to lavc/tests/iirfilter.c
@ 2024-06-16 12:07 Andreas Rheinhardt
  2024-06-16 12:54 ` Paul B Mahol
  2024-06-21 12:21 ` Andreas Rheinhardt
  0 siblings, 2 replies; 3+ messages in thread
From: Andreas Rheinhardt @ 2024-06-16 12:07 UTC (permalink / raw)
  To: ffmpeg-devel; +Cc: Andreas Rheinhardt

It is only used by the test.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
 libavcodec/iirfilter.c       | 14 --------------
 libavcodec/iirfilter.h       | 15 ---------------
 libavcodec/tests/iirfilter.c | 17 ++++++++++++++++-
 3 files changed, 16 insertions(+), 30 deletions(-)

diff --git a/libavcodec/iirfilter.c b/libavcodec/iirfilter.c
index 727a370444..cefe35ab6e 100644
--- a/libavcodec/iirfilter.c
+++ b/libavcodec/iirfilter.c
@@ -277,20 +277,6 @@ av_cold struct FFIIRFilterState *ff_iir_filter_init_state(int order)
     }                                                                       \
 }
 
-void ff_iir_filter(const struct FFIIRFilterCoeffs *c,
-                   struct FFIIRFilterState *s, int size,
-                   const int16_t *src, ptrdiff_t sstep,
-                   int16_t *dst, ptrdiff_t dstep)
-{
-    if (c->order == 2) {
-        FILTER_O2(int16_t, S16)
-    } else if (c->order == 4) {
-        FILTER_BW_O4(int16_t, S16)
-    } else {
-        FILTER_DIRECT_FORM_II(int16_t, S16)
-    }
-}
-
 /**
  * Perform IIR filtering on floating-point input samples.
  *
diff --git a/libavcodec/iirfilter.h b/libavcodec/iirfilter.h
index d6b8fe2782..8ab8ae68c6 100644
--- a/libavcodec/iirfilter.h
+++ b/libavcodec/iirfilter.h
@@ -28,7 +28,6 @@
 #define AVCODEC_IIRFILTER_H
 
 #include <stddef.h>
-#include <stdint.h>
 
 struct FFIIRFilterCoeffs;
 struct FFIIRFilterState;
@@ -114,18 +113,4 @@ void ff_iir_filter_free_coeffsp(struct FFIIRFilterCoeffs **coeffs);
  */
 void ff_iir_filter_free_statep(struct FFIIRFilterState **state);
 
-/**
- * Perform IIR filtering on signed 16-bit input samples.
- *
- * @param coeffs pointer to filter coefficients
- * @param state  pointer to filter state
- * @param size   input length
- * @param src    source samples
- * @param sstep  source stride
- * @param dst    filtered samples (destination may be the same as input)
- * @param dstep  destination stride
- */
-void ff_iir_filter(const struct FFIIRFilterCoeffs *coeffs, struct FFIIRFilterState *state,
-                   int size, const int16_t *src, ptrdiff_t sstep, int16_t *dst, ptrdiff_t dstep);
-
 #endif /* AVCODEC_IIRFILTER_H */
diff --git a/libavcodec/tests/iirfilter.c b/libavcodec/tests/iirfilter.c
index 60cc6fc43d..e03e842b85 100644
--- a/libavcodec/tests/iirfilter.c
+++ b/libavcodec/tests/iirfilter.c
@@ -23,10 +23,25 @@
 #include "libavutil/libm.h"
 
 #include "libavcodec/iirfilter.h"
+#include "libavcodec/iirfilter.c"
 
 #define FILT_ORDER 4
 #define SIZE 1024
 
+static void iir_filter_int16(const struct FFIIRFilterCoeffs *c,
+                             struct FFIIRFilterState *s, int size,
+                             const int16_t *src, ptrdiff_t sstep,
+                             int16_t *dst, ptrdiff_t dstep)
+{
+    if (c->order == 2) {
+        FILTER_O2(int16_t, S16)
+    } else if (c->order == 4) {
+        FILTER_BW_O4(int16_t, S16)
+    } else {
+        FILTER_DIRECT_FORM_II(int16_t, S16)
+    }
+}
+
 int main(void)
 {
     struct FFIIRFilterCoeffs *fcoeffs = NULL;
@@ -43,7 +58,7 @@ int main(void)
     for (i = 0; i < SIZE; i++)
         x[i] = lrint(0.75 * INT16_MAX * sin(0.5 * M_PI * i * i / SIZE));
 
-    ff_iir_filter(fcoeffs, fstate, SIZE, x, 1, y, 1);
+    iir_filter_int16(fcoeffs, fstate, SIZE, x, 1, y, 1);
 
     for (i = 0; i < SIZE; i++)
         printf("%6d %6d\n", x[i], y[i]);
-- 
2.40.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] 3+ messages in thread

* Re: [FFmpeg-devel] [PATCH] avcodec/iirfilter: Move ff_iir_filter() to lavc/tests/iirfilter.c
  2024-06-16 12:07 [FFmpeg-devel] [PATCH] avcodec/iirfilter: Move ff_iir_filter() to lavc/tests/iirfilter.c Andreas Rheinhardt
@ 2024-06-16 12:54 ` Paul B Mahol
  2024-06-21 12:21 ` Andreas Rheinhardt
  1 sibling, 0 replies; 3+ messages in thread
From: Paul B Mahol @ 2024-06-16 12:54 UTC (permalink / raw)
  To: FFmpeg development discussions and patches; +Cc: Andreas Rheinhardt

On Sun, Jun 16, 2024 at 2:07 PM Andreas Rheinhardt <
andreas.rheinhardt@outlook.com> wrote:

> It is only used by the test.
>
> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
> ---
>  libavcodec/iirfilter.c       | 14 --------------
>  libavcodec/iirfilter.h       | 15 ---------------
>  libavcodec/tests/iirfilter.c | 17 ++++++++++++++++-
>  3 files changed, 16 insertions(+), 30 deletions(-)
>
> diff --git a/libavcodec/iirfilter.c b/libavcodec/iirfilter.c
> index 727a370444..cefe35ab6e 100644
> --- a/libavcodec/iirfilter.c
> +++ b/libavcodec/iirfilter.c
> @@ -277,20 +277,6 @@ av_cold struct FFIIRFilterState
> *ff_iir_filter_init_state(int order)
>      }
>    \
>  }
>
> -void ff_iir_filter(const struct FFIIRFilterCoeffs *c,
> -                   struct FFIIRFilterState *s, int size,
> -                   const int16_t *src, ptrdiff_t sstep,
> -                   int16_t *dst, ptrdiff_t dstep)
> -{
> -    if (c->order == 2) {
> -        FILTER_O2(int16_t, S16)
> -    } else if (c->order == 4) {
> -        FILTER_BW_O4(int16_t, S16)
> -    } else {
> -        FILTER_DIRECT_FORM_II(int16_t, S16)
> -    }
> -}
> -
>  /**
>   * Perform IIR filtering on floating-point input samples.
>   *
> diff --git a/libavcodec/iirfilter.h b/libavcodec/iirfilter.h
> index d6b8fe2782..8ab8ae68c6 100644
> --- a/libavcodec/iirfilter.h
> +++ b/libavcodec/iirfilter.h
> @@ -28,7 +28,6 @@
>  #define AVCODEC_IIRFILTER_H
>
>  #include <stddef.h>
> -#include <stdint.h>
>
>  struct FFIIRFilterCoeffs;
>  struct FFIIRFilterState;
> @@ -114,18 +113,4 @@ void ff_iir_filter_free_coeffsp(struct
> FFIIRFilterCoeffs **coeffs);
>   */
>  void ff_iir_filter_free_statep(struct FFIIRFilterState **state);
>
> -/**
> - * Perform IIR filtering on signed 16-bit input samples.
> - *
> - * @param coeffs pointer to filter coefficients
> - * @param state  pointer to filter state
> - * @param size   input length
> - * @param src    source samples
> - * @param sstep  source stride
> - * @param dst    filtered samples (destination may be the same as input)
> - * @param dstep  destination stride
> - */
> -void ff_iir_filter(const struct FFIIRFilterCoeffs *coeffs, struct
> FFIIRFilterState *state,
> -                   int size, const int16_t *src, ptrdiff_t sstep, int16_t
> *dst, ptrdiff_t dstep);
> -
>  #endif /* AVCODEC_IIRFILTER_H */
> diff --git a/libavcodec/tests/iirfilter.c b/libavcodec/tests/iirfilter.c
> index 60cc6fc43d..e03e842b85 100644
> --- a/libavcodec/tests/iirfilter.c
> +++ b/libavcodec/tests/iirfilter.c
> @@ -23,10 +23,25 @@
>  #include "libavutil/libm.h"
>
>  #include "libavcodec/iirfilter.h"
> +#include "libavcodec/iirfilter.c"
>
>  #define FILT_ORDER 4
>  #define SIZE 1024
>
> +static void iir_filter_int16(const struct FFIIRFilterCoeffs *c,
> +                             struct FFIIRFilterState *s, int size,
> +                             const int16_t *src, ptrdiff_t sstep,
> +                             int16_t *dst, ptrdiff_t dstep)
> +{
> +    if (c->order == 2) {
> +        FILTER_O2(int16_t, S16)
> +    } else if (c->order == 4) {
> +        FILTER_BW_O4(int16_t, S16)
> +    } else {
> +        FILTER_DIRECT_FORM_II(int16_t, S16)
> +    }
> +}
> +
>  int main(void)
>  {
>      struct FFIIRFilterCoeffs *fcoeffs = NULL;
> @@ -43,7 +58,7 @@ int main(void)
>      for (i = 0; i < SIZE; i++)
>          x[i] = lrint(0.75 * INT16_MAX * sin(0.5 * M_PI * i * i / SIZE));
>
> -    ff_iir_filter(fcoeffs, fstate, SIZE, x, 1, y, 1);
> +    iir_filter_int16(fcoeffs, fstate, SIZE, x, 1, y, 1);
>
>      for (i = 0; i < SIZE; i++)
>          printf("%6d %6d\n", x[i], y[i]);
> --
> 2.40.1
>
>
Unrelated to this patch, the iir >=2 order done by Direct II form for fixed
point integers is very bad idea.


> _______________________________________________
> 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".
>
_______________________________________________
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] 3+ messages in thread

* Re: [FFmpeg-devel] [PATCH] avcodec/iirfilter: Move ff_iir_filter() to lavc/tests/iirfilter.c
  2024-06-16 12:07 [FFmpeg-devel] [PATCH] avcodec/iirfilter: Move ff_iir_filter() to lavc/tests/iirfilter.c Andreas Rheinhardt
  2024-06-16 12:54 ` Paul B Mahol
@ 2024-06-21 12:21 ` Andreas Rheinhardt
  1 sibling, 0 replies; 3+ messages in thread
From: Andreas Rheinhardt @ 2024-06-21 12:21 UTC (permalink / raw)
  To: ffmpeg-devel

Andreas Rheinhardt:
> It is only used by the test.
> 
> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
> ---
>  libavcodec/iirfilter.c       | 14 --------------
>  libavcodec/iirfilter.h       | 15 ---------------
>  libavcodec/tests/iirfilter.c | 17 ++++++++++++++++-
>  3 files changed, 16 insertions(+), 30 deletions(-)
> 
> diff --git a/libavcodec/iirfilter.c b/libavcodec/iirfilter.c
> index 727a370444..cefe35ab6e 100644
> --- a/libavcodec/iirfilter.c
> +++ b/libavcodec/iirfilter.c
> @@ -277,20 +277,6 @@ av_cold struct FFIIRFilterState *ff_iir_filter_init_state(int order)
>      }                                                                       \
>  }
>  
> -void ff_iir_filter(const struct FFIIRFilterCoeffs *c,
> -                   struct FFIIRFilterState *s, int size,
> -                   const int16_t *src, ptrdiff_t sstep,
> -                   int16_t *dst, ptrdiff_t dstep)
> -{
> -    if (c->order == 2) {
> -        FILTER_O2(int16_t, S16)
> -    } else if (c->order == 4) {
> -        FILTER_BW_O4(int16_t, S16)
> -    } else {
> -        FILTER_DIRECT_FORM_II(int16_t, S16)
> -    }
> -}
> -
>  /**
>   * Perform IIR filtering on floating-point input samples.
>   *
> diff --git a/libavcodec/iirfilter.h b/libavcodec/iirfilter.h
> index d6b8fe2782..8ab8ae68c6 100644
> --- a/libavcodec/iirfilter.h
> +++ b/libavcodec/iirfilter.h
> @@ -28,7 +28,6 @@
>  #define AVCODEC_IIRFILTER_H
>  
>  #include <stddef.h>
> -#include <stdint.h>
>  
>  struct FFIIRFilterCoeffs;
>  struct FFIIRFilterState;
> @@ -114,18 +113,4 @@ void ff_iir_filter_free_coeffsp(struct FFIIRFilterCoeffs **coeffs);
>   */
>  void ff_iir_filter_free_statep(struct FFIIRFilterState **state);
>  
> -/**
> - * Perform IIR filtering on signed 16-bit input samples.
> - *
> - * @param coeffs pointer to filter coefficients
> - * @param state  pointer to filter state
> - * @param size   input length
> - * @param src    source samples
> - * @param sstep  source stride
> - * @param dst    filtered samples (destination may be the same as input)
> - * @param dstep  destination stride
> - */
> -void ff_iir_filter(const struct FFIIRFilterCoeffs *coeffs, struct FFIIRFilterState *state,
> -                   int size, const int16_t *src, ptrdiff_t sstep, int16_t *dst, ptrdiff_t dstep);
> -
>  #endif /* AVCODEC_IIRFILTER_H */
> diff --git a/libavcodec/tests/iirfilter.c b/libavcodec/tests/iirfilter.c
> index 60cc6fc43d..e03e842b85 100644
> --- a/libavcodec/tests/iirfilter.c
> +++ b/libavcodec/tests/iirfilter.c
> @@ -23,10 +23,25 @@
>  #include "libavutil/libm.h"
>  
>  #include "libavcodec/iirfilter.h"
> +#include "libavcodec/iirfilter.c"
>  
>  #define FILT_ORDER 4
>  #define SIZE 1024
>  
> +static void iir_filter_int16(const struct FFIIRFilterCoeffs *c,
> +                             struct FFIIRFilterState *s, int size,
> +                             const int16_t *src, ptrdiff_t sstep,
> +                             int16_t *dst, ptrdiff_t dstep)
> +{
> +    if (c->order == 2) {
> +        FILTER_O2(int16_t, S16)
> +    } else if (c->order == 4) {
> +        FILTER_BW_O4(int16_t, S16)
> +    } else {
> +        FILTER_DIRECT_FORM_II(int16_t, S16)
> +    }
> +}
> +
>  int main(void)
>  {
>      struct FFIIRFilterCoeffs *fcoeffs = NULL;
> @@ -43,7 +58,7 @@ int main(void)
>      for (i = 0; i < SIZE; i++)
>          x[i] = lrint(0.75 * INT16_MAX * sin(0.5 * M_PI * i * i / SIZE));
>  
> -    ff_iir_filter(fcoeffs, fstate, SIZE, x, 1, y, 1);
> +    iir_filter_int16(fcoeffs, fstate, SIZE, x, 1, y, 1);
>  
>      for (i = 0; i < SIZE; i++)
>          printf("%6d %6d\n", x[i], y[i]);

Will apply tonight unless there are objections.

- Andreas

_______________________________________________
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] 3+ messages in thread

end of thread, other threads:[~2024-06-21 12:21 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-06-16 12:07 [FFmpeg-devel] [PATCH] avcodec/iirfilter: Move ff_iir_filter() to lavc/tests/iirfilter.c Andreas Rheinhardt
2024-06-16 12:54 ` Paul B Mahol
2024-06-21 12:21 ` Andreas Rheinhardt

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