diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2013-02-09 14:01:40 +0100 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2013-02-09 14:22:05 +0100 |
commit | 81a11452f8e0b486299905601460d6d2f7eaa548 (patch) | |
tree | 1c9a708d0c77e77c930385ed95ee82601b0bdfd0 | |
parent | a8864615e6cc0bb202d9a269dbccbc7442232fe3 (diff) | |
parent | bf6b3ec924b4fb64d14df33077f4d4541d525dbf (diff) | |
download | ffmpeg-81a11452f8e0b486299905601460d6d2f7eaa548.tar.gz |
Merge commit 'bf6b3ec924b4fb64d14df33077f4d4541d525dbf'
* commit 'bf6b3ec924b4fb64d14df33077f4d4541d525dbf':
dsputil: Move rnd_avg inline functions to a separate header
Merged-by: Michael Niedermayer <michaelni@gmx.at>
-rw-r--r-- | libavcodec/bit_depth_template.c | 1 | ||||
-rw-r--r-- | libavcodec/dsputil.h | 23 | ||||
-rw-r--r-- | libavcodec/rnd_avg.h | 47 | ||||
-rw-r--r-- | libavcodec/sh4/dsputil_align.c | 1 | ||||
-rw-r--r-- | libavcodec/sh4/qpel.c | 1 | ||||
-rw-r--r-- | libavcodec/vc1dsp.c | 1 | ||||
-rw-r--r-- | libavcodec/vp3dsp.c | 1 |
7 files changed, 52 insertions, 23 deletions
diff --git a/libavcodec/bit_depth_template.c b/libavcodec/bit_depth_template.c index 6b757fc041..66b737bd8e 100644 --- a/libavcodec/bit_depth_template.c +++ b/libavcodec/bit_depth_template.c @@ -17,6 +17,7 @@ */ #include "dsputil.h" +#include "rnd_avg.h" #ifndef BIT_DEPTH #define BIT_DEPTH 8 diff --git a/libavcodec/dsputil.h b/libavcodec/dsputil.h index 3a0a610f32..e5f0e31f25 100644 --- a/libavcodec/dsputil.h +++ b/libavcodec/dsputil.h @@ -420,29 +420,6 @@ int ff_check_alignment(void); 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); -} - void ff_dsputil_init_alpha(DSPContext* c, AVCodecContext *avctx); void ff_dsputil_init_arm(DSPContext* c, AVCodecContext *avctx); void ff_dsputil_init_bfin(DSPContext* c, AVCodecContext *avctx); diff --git a/libavcodec/rnd_avg.h b/libavcodec/rnd_avg.h new file mode 100644 index 0000000000..c2b90e06d4 --- /dev/null +++ b/libavcodec/rnd_avg.h @@ -0,0 +1,47 @@ +/* + * This file is part of Libav. + * + * Libav is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * Libav is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with Libav; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVCODEC_RND_AVG_H +#define AVCODEC_RND_AVG_H + +#include <stdint.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); +} + +#endif /* AVCODEC_RND_AVG_H */ diff --git a/libavcodec/sh4/dsputil_align.c b/libavcodec/sh4/dsputil_align.c index d59a12ec56..46981f6c87 100644 --- a/libavcodec/sh4/dsputil_align.c +++ b/libavcodec/sh4/dsputil_align.c @@ -23,6 +23,7 @@ #include "libavutil/attributes.h" #include "libavcodec/avcodec.h" #include "libavcodec/dsputil.h" +#include "libavcodec/rnd_avg.h" #include "dsputil_sh4.h" diff --git a/libavcodec/sh4/qpel.c b/libavcodec/sh4/qpel.c index 8bcce2b8d2..1a5a4cd88d 100644 --- a/libavcodec/sh4/qpel.c +++ b/libavcodec/sh4/qpel.c @@ -23,6 +23,7 @@ #include "libavutil/common.h" #include "libavcodec/copy_block.h" +#include "libavcodec/rnd_avg.h" #define PIXOP2(OPNAME, OP) \ \ diff --git a/libavcodec/vc1dsp.c b/libavcodec/vc1dsp.c index 7ad63afd78..260eda401b 100644 --- a/libavcodec/vc1dsp.c +++ b/libavcodec/vc1dsp.c @@ -28,6 +28,7 @@ #include "libavutil/avassert.h" #include "libavutil/common.h" #include "h264chroma.h" +#include "rnd_avg.h" #include "vc1dsp.h" diff --git a/libavcodec/vp3dsp.c b/libavcodec/vp3dsp.c index f3f9bd231d..051812e72d 100644 --- a/libavcodec/vp3dsp.c +++ b/libavcodec/vp3dsp.c @@ -28,6 +28,7 @@ #include "libavutil/common.h" #include "avcodec.h" #include "dsputil.h" +#include "rnd_avg.h" #include "vp3dsp.h" #define IdctAdjustBeforeShift 8 |