---
 libavcodec/Makefile      |    4 ++--
 libavcodec/dwt.c         |   49 +++++++---------------------------------------
 libavcodec/dwt.h         |    9 ---------
 libavcodec/snow.c        |    2 +-
 libavcodec/snow_dwt.c    |   44 +++++++++++++++++++++++++++++++++++++++++
 libavcodec/snow_dwt.h    |   10 ++++++++++
 libavcodec/x86/snowdsp.c |    2 +-
 7 files changed, 65 insertions(+), 55 deletions(-)
 create mode 100644 libavcodec/snow_dwt.c
 create mode 100644 libavcodec/snow_dwt.h

diff --git a/libavcodec/Makefile b/libavcodec/Makefile
index 45c6d66..7e06945 100644
--- a/libavcodec/Makefile
+++ b/libavcodec/Makefile
@@ -339,8 +339,8 @@ OBJS-$(CONFIG_SIPR_DECODER)            += sipr.o 
acelp_pitch_delay.o \
 OBJS-$(CONFIG_SMACKAUD_DECODER)        += smacker.o
 OBJS-$(CONFIG_SMACKER_DECODER)         += smacker.o
 OBJS-$(CONFIG_SMC_DECODER)             += smc.o
-OBJS-$(CONFIG_SNOW_DECODER)            += snowdec.o snow.o
-OBJS-$(CONFIG_SNOW_ENCODER)            += snowenc.o snow.o              \
+OBJS-$(CONFIG_SNOW_DECODER)            += snowdec.o snow.o snow_dwt.o
+OBJS-$(CONFIG_SNOW_ENCODER)            += snowenc.o snow.o snow_dwt.o   \
                                           h263.o ituh263enc.o
 OBJS-$(CONFIG_SOL_DPCM_DECODER)        += dpcm.o
 OBJS-$(CONFIG_SP5X_DECODER)            += sp5xdec.o mjpegdec.o mjpeg.o
diff --git a/libavcodec/dwt.c b/libavcodec/dwt.c
index be53039..4f43819 100644
--- a/libavcodec/dwt.c
+++ b/libavcodec/dwt.c
@@ -21,6 +21,9 @@
 #include "libavutil/attributes.h"
 #include "libavutil/common.h"
 #include "dsputil.h"
+#if CONFIG_SNOW_DECODER
+#include "snow_dwt.h"
+#endif
 #include "dwt.h"
 
 int ff_slice_buffer_init(slice_buffer *buf, int line_count,
@@ -474,34 +477,6 @@ static void av_unused spatial_compose53i(IDWTELEM *buffer, 
IDWTELEM *temp,
         spatial_compose53i_dy(&cs, buffer, temp, width, height, stride);
 }
 
-void ff_snow_horizontal_compose97i(IDWTELEM *b, IDWTELEM *temp, int width)
-{
-    const int w2 = (width + 1) >> 1;
-    int x;
-
-    temp[0] = b[0] - ((3 * b[w2] + 2) >> 2);
-    for (x = 1; x < (width >> 1); x++) {
-        temp[2 * x]     = b[x] - ((3 * (b[x + w2 - 1] + b[x + w2]) + 4) >> 3);
-        temp[2 * x - 1] = b[x + w2 - 1] - temp[2 * x - 2] - temp[2 * x];
-    }
-    if (width & 1) {
-        temp[2 * x]     = b[x] - ((3 * b[x + w2 - 1] + 2) >> 2);
-        temp[2 * x - 1] = b[x + w2 - 1] - temp[2 * x - 2] - temp[2 * x];
-    } else
-        temp[2 * x - 1] = b[x + w2 - 1] - 2 * temp[2 * x - 2];
-
-    b[0] = temp[0] + ((2 * temp[0] + temp[1] + 4) >> 3);
-    for (x = 2; x < width - 1; x += 2) {
-        b[x]     = temp[x] + ((4 * temp[x] + temp[x - 1] + temp[x + 1] + 8) >> 
4);
-        b[x - 1] = temp[x - 1] + ((3 * (b[x - 2] + b[x])) >> 1);
-    }
-    if (width & 1) {
-        b[x]     = temp[x] + ((2 * temp[x] + temp[x - 1] + 4) >> 3);
-        b[x - 1] = temp[x - 1] + ((3 * (b[x - 2] + b[x])) >> 1);
-    } else
-        b[x - 1] = temp[x - 1] + 3 * b[x - 2];
-}
-
 static void vertical_compose97iH0(IDWTELEM *b0, IDWTELEM *b1, IDWTELEM *b2,
                                   int width)
 {
@@ -538,20 +513,6 @@ static void vertical_compose97iL1(IDWTELEM *b0, IDWTELEM 
*b1, IDWTELEM *b2,
         b1[i] -= (W_DM * (b0[i] + b2[i]) + W_DO) >> W_DS;
 }
 
-void ff_snow_vertical_compose97i(IDWTELEM *b0, IDWTELEM *b1, IDWTELEM *b2,
-                                 IDWTELEM *b3, IDWTELEM *b4, IDWTELEM *b5,
-                                 int width)
-{
-    int i;
-
-    for (i = 0; i < width; i++) {
-        b4[i] -= (W_DM * (b3[i] + b5[i]) + W_DO) >> W_DS;
-        b3[i] -= (W_CM * (b2[i] + b4[i]) + W_CO) >> W_CS;
-        b2[i] += (W_BM * (b1[i] + b3[i]) + 4 * b2[i] + W_BO) >> W_BS;
-        b1[i] += (W_AM * (b0[i] + b2[i]) + W_AO) >> W_AS;
-    }
-}
-
 static void spatial_compose97i_buffered_init(DWTCompose *cs, slice_buffer *sb,
                                              int height, int stride_line)
 {
@@ -636,10 +597,12 @@ static void spatial_compose97i_dy(DWTCompose *cs, 
IDWTELEM *buffer,
     if (y + 0 < (unsigned)height)
         vertical_compose97iH0(b0, b1, b2, width);
 
+#if CONFIG_SNOW_DECODER
     if (y - 1 < (unsigned)height)
         ff_snow_horizontal_compose97i(b0, temp, width);
     if (y + 0 < (unsigned)height)
         ff_snow_horizontal_compose97i(b1, temp, width);
+#endif
 
     cs->b0  = b2;
     cs->b1  = b3;
@@ -870,10 +833,12 @@ void ff_dsputil_init_dwt(DSPContext *c)
 
 void ff_dwt_init(DWTContext *c)
 {
+#if CONFIG_SNOW_DECODER
     c->vertical_compose97i   = ff_snow_vertical_compose97i;
     c->horizontal_compose97i = ff_snow_horizontal_compose97i;
     c->inner_add_yblock      = ff_snow_inner_add_yblock;
 
     if (HAVE_MMX)
         ff_dwt_init_x86(c);
+#endif
 }
diff --git a/libavcodec/dwt.h b/libavcodec/dwt.h
index f2d7864..1d01d59 100644
--- a/libavcodec/dwt.h
+++ b/libavcodec/dwt.h
@@ -93,15 +93,6 @@ void ff_slice_buffer_flush(slice_buffer *buf);
 void ff_slice_buffer_destroy(slice_buffer *buf);
 IDWTELEM *ff_slice_buffer_load_line(slice_buffer *buf, int line);
 
-void ff_snow_vertical_compose97i(IDWTELEM *b0, IDWTELEM *b1, IDWTELEM *b2,
-                                 IDWTELEM *b3, IDWTELEM *b4, IDWTELEM *b5,
-                                 int width);
-void ff_snow_horizontal_compose97i(IDWTELEM *b, IDWTELEM *temp, int width);
-void ff_snow_inner_add_yblock(const uint8_t *obmc, const int obmc_stride,
-                              uint8_t **block, int b_w, int b_h, int src_x,
-                              int src_y, int src_stride, slice_buffer *sb,
-                              int add, uint8_t *dst8);
-
 int ff_w53_32_c(void *v, uint8_t *pix1, uint8_t *pix2, int line_size, int h);
 int ff_w97_32_c(void *v, uint8_t *pix1, uint8_t *pix2, int line_size, int h);
 
diff --git a/libavcodec/snow.c b/libavcodec/snow.c
index d69f452..281d9bf 100644
--- a/libavcodec/snow.c
+++ b/libavcodec/snow.c
@@ -23,8 +23,8 @@
 #include "libavutil/opt.h"
 #include "avcodec.h"
 #include "dsputil.h"
-#include "dwt.h"
 #include "snow.h"
+#include "snow_dwt.h"
 #include "snowdata.h"
 
 #include "rangecoder.h"
diff --git a/libavcodec/snow_dwt.c b/libavcodec/snow_dwt.c
new file mode 100644
index 0000000..2979b40
--- /dev/null
+++ b/libavcodec/snow_dwt.c
@@ -0,0 +1,44 @@
+#include "snow_dwt.h"
+
+void ff_snow_horizontal_compose97i(IDWTELEM *b, IDWTELEM *temp, int width)
+{
+    const int w2 = (width + 1) >> 1;
+    int x;
+
+    temp[0] = b[0] - ((3 * b[w2] + 2) >> 2);
+    for (x = 1; x < (width >> 1); x++) {
+        temp[2 * x]     = b[x] - ((3 * (b[x + w2 - 1] + b[x + w2]) + 4) >> 3);
+        temp[2 * x - 1] = b[x + w2 - 1] - temp[2 * x - 2] - temp[2 * x];
+    }
+    if (width & 1) {
+        temp[2 * x]     = b[x] - ((3 * b[x + w2 - 1] + 2) >> 2);
+        temp[2 * x - 1] = b[x + w2 - 1] - temp[2 * x - 2] - temp[2 * x];
+    } else
+        temp[2 * x - 1] = b[x + w2 - 1] - 2 * temp[2 * x - 2];
+
+    b[0] = temp[0] + ((2 * temp[0] + temp[1] + 4) >> 3);
+    for (x = 2; x < width - 1; x += 2) {
+        b[x]     = temp[x] + ((4 * temp[x] + temp[x - 1] + temp[x + 1] + 8) >> 
4);
+        b[x - 1] = temp[x - 1] + ((3 * (b[x - 2] + b[x])) >> 1);
+    }
+    if (width & 1) {
+        b[x]     = temp[x] + ((2 * temp[x] + temp[x - 1] + 4) >> 3);
+        b[x - 1] = temp[x - 1] + ((3 * (b[x - 2] + b[x])) >> 1);
+    } else
+        b[x - 1] = temp[x - 1] + 3 * b[x - 2];
+}
+
+void ff_snow_vertical_compose97i(IDWTELEM *b0, IDWTELEM *b1, IDWTELEM *b2,
+                                 IDWTELEM *b3, IDWTELEM *b4, IDWTELEM *b5,
+                                 int width)
+{
+    int i;
+
+    for (i = 0; i < width; i++) {
+        b4[i] -= (W_DM * (b3[i] + b5[i]) + W_DO) >> W_DS;
+        b3[i] -= (W_CM * (b2[i] + b4[i]) + W_CO) >> W_CS;
+        b2[i] += (W_BM * (b1[i] + b3[i]) + 4 * b2[i] + W_BO) >> W_BS;
+        b1[i] += (W_AM * (b0[i] + b2[i]) + W_AO) >> W_AS;
+    }
+}
+
diff --git a/libavcodec/snow_dwt.h b/libavcodec/snow_dwt.h
new file mode 100644
index 0000000..d1184a3
--- /dev/null
+++ b/libavcodec/snow_dwt.h
@@ -0,0 +1,10 @@
+#include "dwt.h"
+
+void ff_snow_vertical_compose97i(IDWTELEM *b0, IDWTELEM *b1, IDWTELEM *b2,
+                                 IDWTELEM *b3, IDWTELEM *b4, IDWTELEM *b5,
+                                 int width);
+void ff_snow_horizontal_compose97i(IDWTELEM *b, IDWTELEM *temp, int width);
+void ff_snow_inner_add_yblock(const uint8_t *obmc, const int obmc_stride,
+                              uint8_t **block, int b_w, int b_h, int src_x,
+                              int src_y, int src_stride, slice_buffer *sb,
+                              int add, uint8_t *dst8);
diff --git a/libavcodec/x86/snowdsp.c b/libavcodec/x86/snowdsp.c
index fb190d8..d819ae0 100644
--- a/libavcodec/x86/snowdsp.c
+++ b/libavcodec/x86/snowdsp.c
@@ -23,7 +23,7 @@
 #include "libavutil/x86/asm.h"
 #include "libavcodec/avcodec.h"
 #include "libavcodec/snow.h"
-#include "libavcodec/dwt.h"
+#include "libavcodec/snow_dwt.h"
 #include "dsputil_mmx.h"
 
 #if HAVE_INLINE_ASM
-- 
1.7.10.4

_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to