[FFmpeg-devel] [PATCH 1/4] dsputil: make square put/avg_pixels functions local to h264qpel.

Ronald S. Bultje rsbultje at gmail.com
Mon Mar 4 00:47:09 CET 2013


From: "Ronald S. Bultje" <rsbultje at gmail.com>

Put a copy of the 8bit functions only in dsputil, where they are used
for some other things (e.g. mpeg4qpel, mspel, cavsqpel). We could perhaps
also try to share specifically the 8bit functions from h264qpel between
it and the others, but that will be slightly more complicated.
---
 libavcodec/dsputil.c           | 15 +++++++++++-
 libavcodec/dsputil.h           | 20 ++++------------
 libavcodec/dsputil_template.c  | 14 -----------
 libavcodec/h264qpel_template.c | 53 ++++++++++++++++++++++++++----------------
 4 files changed, 51 insertions(+), 51 deletions(-)

diff --git a/libavcodec/dsputil.c b/libavcodec/dsputil.c
index 2bcc3ee..8d7fae5 100644
--- a/libavcodec/dsputil.c
+++ b/libavcodec/dsputil.c
@@ -1309,12 +1309,25 @@ QPEL_MC(0, avg_       , _       , op_avg)
 #undef op_put
 #undef op_put_no_rnd
 
+void ff_put_pixels8x8(uint8_t *dst, uint8_t *src, int stride) {
+  put_pixels8_8_c(dst, src, stride, 8);
+}
+void ff_avg_pixels8x8(uint8_t *dst, uint8_t *src, int stride) {
+  avg_pixels8_8_c(dst, src, stride, 8);
+}
+void ff_put_pixels16x16(uint8_t *dst, uint8_t *src, int stride) {
+  put_pixels16_8_c(dst, src, stride, 16);
+}
+void ff_avg_pixels16x16(uint8_t *dst, uint8_t *src, int stride) {
+  avg_pixels16_8_c(dst, src, stride, 16);
+}
+
 #define put_qpel8_mc00_c  ff_put_pixels8x8_c
 #define avg_qpel8_mc00_c  ff_avg_pixels8x8_c
 #define put_qpel16_mc00_c ff_put_pixels16x16_c
 #define avg_qpel16_mc00_c ff_avg_pixels16x16_c
 #define put_no_rnd_qpel8_mc00_c  ff_put_pixels8x8_c
-#define put_no_rnd_qpel16_mc00_c ff_put_pixels16x16_8_c
+#define put_no_rnd_qpel16_mc00_c ff_put_pixels16x16_c
 
 static void wmv2_mspel8_h_lowpass(uint8_t *dst, uint8_t *src, int dstStride, int srcStride, int h){
     uint8_t *cm = ff_cropTbl + MAX_NEG_CROP;
diff --git a/libavcodec/dsputil.h b/libavcodec/dsputil.h
index 7d12fe3..2d1c54a 100644
--- a/libavcodec/dsputil.h
+++ b/libavcodec/dsputil.h
@@ -49,22 +49,10 @@ extern const uint8_t ff_zigzag248_direct[64];
 extern uint32_t ff_squareTbl[512];
 extern uint8_t ff_cropTbl[256 + 2 * MAX_NEG_CROP];
 
-#define PUTAVG_PIXELS(depth)\
-void ff_put_pixels8x8_ ## depth ## _c(uint8_t *dst, uint8_t *src, int stride);\
-void ff_avg_pixels8x8_ ## depth ## _c(uint8_t *dst, uint8_t *src, int stride);\
-void ff_put_pixels16x16_ ## depth ## _c(uint8_t *dst, uint8_t *src, int stride);\
-void ff_avg_pixels16x16_ ## depth ## _c(uint8_t *dst, uint8_t *src, int stride);
-
-PUTAVG_PIXELS( 8)
-PUTAVG_PIXELS( 9)
-PUTAVG_PIXELS(10)
-PUTAVG_PIXELS(12)
-PUTAVG_PIXELS(14)
-
-#define ff_put_pixels8x8_c ff_put_pixels8x8_8_c
-#define ff_avg_pixels8x8_c ff_avg_pixels8x8_8_c
-#define ff_put_pixels16x16_c ff_put_pixels16x16_8_c
-#define ff_avg_pixels16x16_c ff_avg_pixels16x16_8_c
+void ff_put_pixels8x8_c(uint8_t *dst, uint8_t *src, int stride);
+void ff_avg_pixels8x8_c(uint8_t *dst, uint8_t *src, int stride);
+void ff_put_pixels16x16_c(uint8_t *dst, uint8_t *src, int stride);
+void ff_avg_pixels16x16_c(uint8_t *dst, uint8_t *src, int stride);
 
 /* RV40 functions */
 void ff_put_rv40_qpel16_mc33_c(uint8_t *dst, uint8_t *src, int stride);
diff --git a/libavcodec/dsputil_template.c b/libavcodec/dsputil_template.c
index 8517ded..8dd886e 100644
--- a/libavcodec/dsputil_template.c
+++ b/libavcodec/dsputil_template.c
@@ -420,17 +420,3 @@ PIXOP2(put, op_put)
 #endif
 #undef op_avg
 #undef op_put
-
-void FUNCC(ff_put_pixels8x8)(uint8_t *dst, uint8_t *src, int stride) {
-    FUNCC(put_pixels8)(dst, src, stride, 8);
-}
-void FUNCC(ff_avg_pixels8x8)(uint8_t *dst, uint8_t *src, int stride) {
-    FUNCC(avg_pixels8)(dst, src, stride, 8);
-}
-void FUNCC(ff_put_pixels16x16)(uint8_t *dst, uint8_t *src, int stride) {
-    FUNCC(put_pixels16)(dst, src, stride, 16);
-}
-void FUNCC(ff_avg_pixels16x16)(uint8_t *dst, uint8_t *src, int stride) {
-    FUNCC(avg_pixels16)(dst, src, stride, 16);
-}
-
diff --git a/libavcodec/h264qpel_template.c b/libavcodec/h264qpel_template.c
index 95950f4..88adb15 100644
--- a/libavcodec/h264qpel_template.c
+++ b/libavcodec/h264qpel_template.c
@@ -532,29 +532,42 @@ H264_MC(avg_, 16)
 #undef op2_avg
 #undef op2_put
 
+static void FUNCC(put_pixels8x8)(uint8_t *dst, uint8_t *src, int stride) {
+  FUNCC(put_pixels8)(dst, src, stride, 8);
+}
+static void FUNCC(avg_pixels8x8)(uint8_t *dst, uint8_t *src, int stride) {
+  FUNCC(avg_pixels8)(dst, src, stride, 8);
+}
+static void FUNCC(put_pixels16x16)(uint8_t *dst, uint8_t *src, int stride) {
+  FUNCC(put_pixels16)(dst, src, stride, 16);
+}
+static void FUNCC(avg_pixels16x16)(uint8_t *dst, uint8_t *src, int stride) {
+  FUNCC(avg_pixels16)(dst, src, stride, 16);
+}
+
 #if BIT_DEPTH == 8
-#   define put_h264_qpel8_mc00_8_c  ff_put_pixels8x8_8_c
-#   define avg_h264_qpel8_mc00_8_c  ff_avg_pixels8x8_8_c
-#   define put_h264_qpel16_mc00_8_c ff_put_pixels16x16_8_c
-#   define avg_h264_qpel16_mc00_8_c ff_avg_pixels16x16_8_c
+#   define put_h264_qpel8_mc00_8_c  put_pixels8x8_8_c
+#   define avg_h264_qpel8_mc00_8_c  avg_pixels8x8_8_c
+#   define put_h264_qpel16_mc00_8_c put_pixels16x16_8_c
+#   define avg_h264_qpel16_mc00_8_c avg_pixels16x16_8_c
 #elif BIT_DEPTH == 9
-#   define put_h264_qpel8_mc00_9_c  ff_put_pixels8x8_9_c
-#   define avg_h264_qpel8_mc00_9_c  ff_avg_pixels8x8_9_c
-#   define put_h264_qpel16_mc00_9_c ff_put_pixels16x16_9_c
-#   define avg_h264_qpel16_mc00_9_c ff_avg_pixels16x16_9_c
+#   define put_h264_qpel8_mc00_9_c  put_pixels8x8_9_c
+#   define avg_h264_qpel8_mc00_9_c  avg_pixels8x8_9_c
+#   define put_h264_qpel16_mc00_9_c put_pixels16x16_9_c
+#   define avg_h264_qpel16_mc00_9_c avg_pixels16x16_9_c
 #elif BIT_DEPTH == 10
-#   define put_h264_qpel8_mc00_10_c  ff_put_pixels8x8_10_c
-#   define avg_h264_qpel8_mc00_10_c  ff_avg_pixels8x8_10_c
-#   define put_h264_qpel16_mc00_10_c ff_put_pixels16x16_10_c
-#   define avg_h264_qpel16_mc00_10_c ff_avg_pixels16x16_10_c
+#   define put_h264_qpel8_mc00_10_c  put_pixels8x8_10_c
+#   define avg_h264_qpel8_mc00_10_c  avg_pixels8x8_10_c
+#   define put_h264_qpel16_mc00_10_c put_pixels16x16_10_c
+#   define avg_h264_qpel16_mc00_10_c avg_pixels16x16_10_c
 #elif BIT_DEPTH == 12
-#   define put_h264_qpel8_mc00_12_c  ff_put_pixels8x8_12_c
-#   define avg_h264_qpel8_mc00_12_c  ff_avg_pixels8x8_12_c
-#   define put_h264_qpel16_mc00_12_c ff_put_pixels16x16_12_c
-#   define avg_h264_qpel16_mc00_12_c ff_avg_pixels16x16_12_c
+#   define put_h264_qpel8_mc00_12_c  put_pixels8x8_12_c
+#   define avg_h264_qpel8_mc00_12_c  avg_pixels8x8_12_c
+#   define put_h264_qpel16_mc00_12_c put_pixels16x16_12_c
+#   define avg_h264_qpel16_mc00_12_c avg_pixels16x16_12_c
 #elif BIT_DEPTH == 14
-#   define put_h264_qpel8_mc00_14_c  ff_put_pixels8x8_14_c
-#   define avg_h264_qpel8_mc00_14_c  ff_avg_pixels8x8_14_c
-#   define put_h264_qpel16_mc00_14_c ff_put_pixels16x16_14_c
-#   define avg_h264_qpel16_mc00_14_c ff_avg_pixels16x16_14_c
+#   define put_h264_qpel8_mc00_14_c  put_pixels8x8_14_c
+#   define avg_h264_qpel8_mc00_14_c  avg_pixels8x8_14_c
+#   define put_h264_qpel16_mc00_14_c put_pixels16x16_14_c
+#   define avg_h264_qpel16_mc00_14_c avg_pixels16x16_14_c
 #endif
-- 
1.7.11.3



More information about the ffmpeg-devel mailing list