diff mbox series

[FFmpeg-devel,2/2] avcodec/snow: Move dsp helper functions to snow_dwt.h

Message ID AS8P250MB0744E3622769C68F99C5A6D08FC7A@AS8P250MB0744.EURP250.PROD.OUTLOOK.COM
State Accepted
Commit f52b4a6e69187a5694b4ca7acefc529439bf4f8a
Headers show
Series [FFmpeg-devel,1/2] avcodec/snow: Move encoder-only stuff out of SnowContext | expand

Checks

Context Check Description
yinshiyou/make_loongarch64 success Make finished
yinshiyou/make_fate_loongarch64 success Make fate finished
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished

Commit Message

Andreas Rheinhardt Sept. 30, 2023, 3:07 p.m. UTC
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
 libavcodec/snow.h        | 38 --------------------------------------
 libavcodec/snow_dwt.h    | 40 ++++++++++++++++++++++++++++++++++++++++
 libavcodec/x86/snowdsp.c |  1 -
 3 files changed, 40 insertions(+), 39 deletions(-)

Comments

Michael Niedermayer Oct. 1, 2023, 8:34 p.m. UTC | #1
On Sat, Sep 30, 2023 at 05:07:31PM +0200, Andreas Rheinhardt wrote:
> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
> ---
>  libavcodec/snow.h        | 38 --------------------------------------
>  libavcodec/snow_dwt.h    | 40 ++++++++++++++++++++++++++++++++++++++++
>  libavcodec/x86/snowdsp.c |  1 -
>  3 files changed, 40 insertions(+), 39 deletions(-)

ok

thx

[...]
diff mbox series

Patch

diff --git a/libavcodec/snow.h b/libavcodec/snow.h
index 2e61154d0c..a5e2c138cb 100644
--- a/libavcodec/snow.h
+++ b/libavcodec/snow.h
@@ -176,44 +176,6 @@  extern const uint8_t * const ff_obmc_tab[4];
 extern const uint8_t ff_qexp[QROOT];
 extern int ff_scale_mv_ref[MAX_REF_FRAMES][MAX_REF_FRAMES];
 
-/* C bits used by mmx/sse2/altivec */
-
-static av_always_inline void snow_interleave_line_header(int * i, int width, IDWTELEM * low, IDWTELEM * high){
-    (*i) = (width) - 2;
-
-    if (width & 1){
-        low[(*i)+1] = low[((*i)+1)>>1];
-        (*i)--;
-    }
-}
-
-static av_always_inline void snow_interleave_line_footer(int * i, IDWTELEM * low, IDWTELEM * high){
-    for (; (*i)>=0; (*i)-=2){
-        low[(*i)+1] = high[(*i)>>1];
-        low[*i] = low[(*i)>>1];
-    }
-}
-
-static av_always_inline void snow_horizontal_compose_lift_lead_out(int i, IDWTELEM * dst, IDWTELEM * src, IDWTELEM * ref, int width, int w, int lift_high, int mul, int add, int shift){
-    for(; i<w; i++){
-        dst[i] = src[i] - ((mul * (ref[i] + ref[i + 1]) + add) >> shift);
-    }
-
-    if((width^lift_high)&1){
-        dst[w] = src[w] - ((mul * 2 * ref[w] + add) >> shift);
-    }
-}
-
-static av_always_inline void snow_horizontal_compose_liftS_lead_out(int i, IDWTELEM * dst, IDWTELEM * src, IDWTELEM * ref, int width, int w){
-        for(; i<w; i++){
-            dst[i] = src[i] + ((ref[i] + ref[(i+1)]+W_BO + 4 * src[i]) >> W_BS);
-        }
-
-        if(width&1){
-            dst[w] = src[w] + ((2 * ref[w] + W_BO + 4 * src[w]) >> W_BS);
-        }
-}
-
 /* common code */
 
 int ff_snow_common_init(AVCodecContext *avctx);
diff --git a/libavcodec/snow_dwt.h b/libavcodec/snow_dwt.h
index 15b8a3007b..6e7d22c71a 100644
--- a/libavcodec/snow_dwt.h
+++ b/libavcodec/snow_dwt.h
@@ -24,6 +24,8 @@ 
 #include <stddef.h>
 #include <stdint.h>
 
+#include "libavutil/attributes.h"
+
 struct MpegEncContext;
 
 typedef int DWTELEM;
@@ -91,6 +93,44 @@  typedef struct SnowDWTContext {
                                  : ff_slice_buffer_load_line((slice_buf),   \
                                                              (line_num)))
 
+/* C bits used by mmx/sse2/altivec */
+
+static av_always_inline void snow_interleave_line_header(int *i, int width, IDWTELEM *low, IDWTELEM *high)
+{
+    *i = width - 2;
+
+    if (width & 1) {
+        low[*i + 1] = low[(*i + 1)>>1];
+        (*i)--;
+    }
+}
+
+static av_always_inline void snow_interleave_line_footer(int *i, IDWTELEM *low, const IDWTELEM *high)
+{
+    for (; *i >= 0; *i -= 2) {
+        low[*i + 1] = high[*i >> 1];
+        low[*i]     =  low[*i >> 1];
+    }
+}
+
+static av_always_inline void snow_horizontal_compose_lift_lead_out(int i, IDWTELEM *dst, const IDWTELEM *src, const IDWTELEM *ref, int width, int w, int lift_high, int mul, int add, int shift)
+{
+    for (; i < w; i++)
+        dst[i] = src[i] - ((mul * (ref[i] + ref[i + 1]) + add) >> shift);
+
+    if ((width ^ lift_high) & 1)
+        dst[w] = src[w] - ((mul * 2 * ref[w] + add) >> shift);
+}
+
+static av_always_inline void snow_horizontal_compose_liftS_lead_out(int i, IDWTELEM *dst, const IDWTELEM *src, const IDWTELEM *ref, int width, int w)
+{
+    for (; i < w; i++)
+        dst[i] = src[i] + ((ref[i] + ref[(i+1)]+W_BO + 4 * src[i]) >> W_BS);
+
+    if (width & 1)
+        dst[w] = src[w] + ((2 * ref[w] + W_BO + 4 * src[w]) >> W_BS);
+}
+
 int ff_slice_buffer_init(slice_buffer *buf, int line_count,
                          int max_allocated_lines, int line_width,
                          IDWTELEM *base_buffer);
diff --git a/libavcodec/x86/snowdsp.c b/libavcodec/x86/snowdsp.c
index bca1f9bd2e..bd0aa766e5 100644
--- a/libavcodec/x86/snowdsp.c
+++ b/libavcodec/x86/snowdsp.c
@@ -24,7 +24,6 @@ 
 #include "libavutil/attributes.h"
 #include "libavutil/cpu.h"
 #include "libavutil/x86/asm.h"
-#include "libavcodec/snow.h"
 #include "libavcodec/snow_dwt.h"
 
 #if HAVE_INLINE_ASM