[FFmpeg-devel] [PATCH 07/33] Split out common pixel functions from dsputil to bit_depth_template.
Ronald S. Bultje
rsbultje at gmail.com
Wed Feb 6 04:27:20 CET 2013
From: "Ronald S. Bultje" <rsbultje at gmail.com>
Specifically, move {no_,}rnd_avg{32,64}(), BYTE_VEC{32,64}() and
CALL_2X_PIXELS to bit_depth_template.c.
---
libavcodec/arm/dsputil_init_arm.c | 1 +
libavcodec/bit_depth_template.c | 31 +++++++++++++++++++++++++++++++
libavcodec/dsputil.h | 29 -----------------------------
libavcodec/hpeldsp.h | 32 --------------------------------
libavcodec/sh4/dsputil_align.c | 1 +
libavcodec/vc1dsp.c | 2 +-
libavcodec/vp3dsp.c | 1 +
7 files changed, 35 insertions(+), 62 deletions(-)
diff --git a/libavcodec/arm/dsputil_init_arm.c b/libavcodec/arm/dsputil_init_arm.c
index ea75c3c..b3abed1 100644
--- a/libavcodec/arm/dsputil_init_arm.c
+++ b/libavcodec/arm/dsputil_init_arm.c
@@ -21,6 +21,7 @@
#include "libavutil/arm/cpu.h"
#include "libavcodec/dsputil.h"
+#include "libavcodec/bit_depth_template.c" // for CALL_2X_PIXELS
#include "dsputil_arm.h"
void ff_j_rev_dct_arm(int16_t *data);
diff --git a/libavcodec/bit_depth_template.c b/libavcodec/bit_depth_template.c
index 85ba8d0..ba7f4e8 100644
--- a/libavcodec/bit_depth_template.c
+++ b/libavcodec/bit_depth_template.c
@@ -43,6 +43,37 @@
# undef PIXEL_SPLAT_X4
#else
# define AVCODEC_H264_HIGH_DEPTH_H
+
+#define BYTE_VEC32(c) ((c)*0x01010101UL)
+#define BYTE_VEC64(c) ((c)*0x0001000100010001UL)
+
+static inline uint32_t rnd_avg32(uint32_t a, uint32_t b)
+{
+ return (a | b) - (((a ^ b) & ~BYTE_VEC32(0x01)) >> 1);
+}
+
+static inline uint32_t no_rnd_avg32(uint32_t a, uint32_t b)
+{
+ return (a & b) + (((a ^ b) & ~BYTE_VEC32(0x01)) >> 1);
+}
+
+static inline uint64_t rnd_avg64(uint64_t a, uint64_t b)
+{
+ return (a | b) - (((a ^ b) & ~BYTE_VEC64(0x01)) >> 1);
+}
+
+static inline uint64_t no_rnd_avg64(uint64_t a, uint64_t b)
+{
+ return (a & b) + (((a ^ b) & ~BYTE_VEC64(0x01)) >> 1);
+}
+
+#define CALL_2X_PIXELS(a, b, n)\
+static void a(uint8_t *block, const uint8_t *pixels, int line_size, int h)\
+{\
+ b(block , pixels , line_size, h);\
+ b(block+n, pixels+n, line_size, h);\
+}
+
#endif
#if BIT_DEPTH > 8
diff --git a/libavcodec/dsputil.h b/libavcodec/dsputil.h
index fe19cfb..2c3d030 100644
--- a/libavcodec/dsputil.h
+++ b/libavcodec/dsputil.h
@@ -149,12 +149,6 @@ DEF_OLD_QPEL(qpel8_mc32_old_c)
DEF_OLD_QPEL(qpel8_mc13_old_c)
DEF_OLD_QPEL(qpel8_mc33_old_c)
-#define CALL_2X_PIXELS(a, b, n)\
-static void a(uint8_t *block, const uint8_t *pixels, int line_size, int h){\
- b(block , pixels , line_size, h);\
- b(block+n, pixels+n, line_size, h);\
-}
-
/* motion estimation */
// h is limited to {width/2, width, 2*width} but never larger than 16 and never smaller than 2
// although currently h<4 is not used as functions with width <8 are neither used nor implemented
@@ -449,29 +443,6 @@ void ff_block_permute(int16_t *block, uint8_t *permutation, const uint8_t *scant
void ff_set_cmp(DSPContext* c, me_cmp_func *cmp, int type);
-#define BYTE_VEC32(c) ((c)*0x01010101UL)
-#define BYTE_VEC64(c) ((c)*0x0001000100010001UL)
-
-static inline uint32_t rnd_avg32(uint32_t a, uint32_t b)
-{
- return (a | b) - (((a ^ b) & ~BYTE_VEC32(0x01)) >> 1);
-}
-
-static inline uint32_t no_rnd_avg32(uint32_t a, uint32_t b)
-{
- return (a & b) + (((a ^ b) & ~BYTE_VEC32(0x01)) >> 1);
-}
-
-static inline uint64_t rnd_avg64(uint64_t a, uint64_t b)
-{
- return (a | b) - (((a ^ b) & ~BYTE_VEC64(0x01)) >> 1);
-}
-
-static inline uint64_t no_rnd_avg64(uint64_t a, uint64_t b)
-{
- return (a & b) + (((a ^ b) & ~BYTE_VEC64(0x01)) >> 1);
-}
-
static inline int get_penalty_factor(int lambda, int lambda2, int type){
switch(type&0xFF){
default:
diff --git a/libavcodec/hpeldsp.h b/libavcodec/hpeldsp.h
index 40dbf0f..023aa5e 100644
--- a/libavcodec/hpeldsp.h
+++ b/libavcodec/hpeldsp.h
@@ -90,38 +90,6 @@ typedef struct HpelDSPContext {
void ff_hpeldsp_init(HpelDSPContext* p, int flags);
-// FIXME probably move the below stuff (copies from dsputil) out of here
-// and into bit_depth_template.c?
-#define CALL_2X_PIXELS(a, b, n)\
-static void a(uint8_t *block, const uint8_t *pixels, int line_size, int h)\
-{\
- b(block , pixels , line_size, h);\
- b(block+n, pixels+n, line_size, h);\
-}
-
-#define BYTE_VEC32(c) ((c)*0x01010101UL)
-#define BYTE_VEC64(c) ((c)*0x0001000100010001UL)
-
-static inline uint32_t rnd_avg32(uint32_t a, uint32_t b)
-{
- return (a | b) - (((a ^ b) & ~BYTE_VEC32(0x01)) >> 1);
-}
-
-static inline uint32_t no_rnd_avg32(uint32_t a, uint32_t b)
-{
- return (a & b) + (((a ^ b) & ~BYTE_VEC32(0x01)) >> 1);
-}
-
-static inline uint64_t rnd_avg64(uint64_t a, uint64_t b)
-{
- return (a | b) - (((a ^ b) & ~BYTE_VEC64(0x01)) >> 1);
-}
-
-static inline uint64_t no_rnd_avg64(uint64_t a, uint64_t b)
-{
- return (a & b) + (((a ^ b) & ~BYTE_VEC64(0x01)) >> 1);
-}
-
void ff_hpeldsp_init_alpha(HpelDSPContext* c, int flags);
void ff_hpeldsp_init_arm(HpelDSPContext* c, int flags);
void ff_hpeldsp_init_bfin(HpelDSPContext* c, int flags);
diff --git a/libavcodec/sh4/dsputil_align.c b/libavcodec/sh4/dsputil_align.c
index fcea3c3..281da05 100644
--- a/libavcodec/sh4/dsputil_align.c
+++ b/libavcodec/sh4/dsputil_align.c
@@ -23,6 +23,7 @@
#include "libavcodec/avcodec.h"
#include "libavcodec/dsputil.h"
+#include "libavcodec/bit_depth_template.c" // for BYTE_VEC32
#include "dsputil_sh4.h"
diff --git a/libavcodec/vc1dsp.c b/libavcodec/vc1dsp.c
index 9ddd7c7..ff03798 100644
--- a/libavcodec/vc1dsp.c
+++ b/libavcodec/vc1dsp.c
@@ -28,7 +28,7 @@
#include "vc1dsp.h"
#include "libavutil/avassert.h"
#include "libavutil/common.h"
-
+#include "libavcodec/bit_depth_template.c" // for rnd_avg32()
/** Apply overlap transform to horizontal edge
*/
diff --git a/libavcodec/vp3dsp.c b/libavcodec/vp3dsp.c
index f3f9bd2..e883b8a 100644
--- a/libavcodec/vp3dsp.c
+++ b/libavcodec/vp3dsp.c
@@ -29,6 +29,7 @@
#include "avcodec.h"
#include "dsputil.h"
#include "vp3dsp.h"
+#include "bit_depth_template.c" // for no_rnd_avg32()
#define IdctAdjustBeforeShift 8
#define xC1S7 64277
--
1.7.11.3
More information about the ffmpeg-devel
mailing list