From: "Ronald S. Bultje" <[email protected]>
---
configure | 7 ++++---
libavcodec/Makefile | 1 +
libavcodec/dsputil.c | 1 -
libavcodec/dsputil.h | 2 --
libavcodec/dsputil_template.c | 4 ----
libavcodec/vp3.c | 5 ++++-
libavcodec/vp35mcdsp.c | 43 +++++++++++++++++++++++++++++++++++++++++++
libavcodec/vp35mcdsp.h | 43 +++++++++++++++++++++++++++++++++++++++++++
libavcodec/vp56.c | 3 ++-
libavcodec/vp56.h | 2 ++
10 files changed, 99 insertions(+), 12 deletions(-)
create mode 100644 libavcodec/vp35mcdsp.c
create mode 100644 libavcodec/vp35mcdsp.h
diff --git a/configure b/configure
index 144ec2d..fc2be8e 100755
--- a/configure
+++ b/configure
@@ -1333,6 +1333,7 @@ CONFIG_EXTRA="
sinewin
videodsp
vp3dsp
+ vp35mcdsp
"
CMDLINE_SELECT="
@@ -1575,9 +1576,9 @@ vc1_decoder_select="h263_decoder h264chroma h264qpel"
vc1image_decoder_select="vc1_decoder"
vorbis_decoder_select="mdct"
vorbis_encoder_select="mdct"
-vp3_decoder_select="vp3dsp videodsp"
-vp5_decoder_select="vp3dsp videodsp"
-vp6_decoder_select="huffman vp3dsp videodsp"
+vp3_decoder_select="vp3dsp vp35mcdsp videodsp"
+vp5_decoder_select="vp3dsp vp35mcdsp videodsp"
+vp6_decoder_select="huffman vp3dsp vp35mcdsp videodsp"
vp6a_decoder_select="vp6_decoder"
vp6f_decoder_select="vp6_decoder"
vp8_decoder_select="h264pred videodsp"
diff --git a/libavcodec/Makefile b/libavcodec/Makefile
index 3f8f280..d49af79 100644
--- a/libavcodec/Makefile
+++ b/libavcodec/Makefile
@@ -68,6 +68,7 @@ OBJS-$(CONFIG_VAAPI) += vaapi.o
OBJS-$(CONFIG_VDPAU) += vdpau.o
OBJS-$(CONFIG_VIDEODSP) += videodsp.o
OBJS-$(CONFIG_VP3DSP) += vp3dsp.o
+OBJS-$(CONFIG_VP35MCDSP) += vp35mcdsp.o
# decoders/encoders/hardware accelerators
OBJS-$(CONFIG_A64MULTI_ENCODER) += a64multienc.o elbg.o
diff --git a/libavcodec/dsputil.c b/libavcodec/dsputil.c
index 32a56df..caf1b07 100644
--- a/libavcodec/dsputil.c
+++ b/libavcodec/dsputil.c
@@ -2726,7 +2726,6 @@ av_cold void ff_dsputil_init(DSPContext* c,
AVCodecContext *avctx)
c->clear_blocks = FUNCC(clear_blocks ## dct , depth);\
c->add_pixels8 = FUNCC(add_pixels8 ## dct , depth);\
c->add_pixels4 = FUNCC(add_pixels4 ## dct , depth);\
- c->put_no_rnd_pixels_l2 = FUNCC(put_no_rnd_pixels8_l2 , depth);\
\
c->put_h264_chroma_pixels_tab[0] = FUNCC(put_h264_chroma_mc8 , depth);\
c->put_h264_chroma_pixels_tab[1] = FUNCC(put_h264_chroma_mc4 , depth);\
diff --git a/libavcodec/dsputil.h b/libavcodec/dsputil.h
index e6cc1c0..9b88058 100644
--- a/libavcodec/dsputil.h
+++ b/libavcodec/dsputil.h
@@ -291,8 +291,6 @@ typedef struct DSPContext {
*/
op_pixels_func avg_no_rnd_pixels_tab[4][4];
- void (*put_no_rnd_pixels_l2)(uint8_t *block/*align 8*/, const uint8_t
*a/*align 1*/, const uint8_t *b/*align 1*/, int line_size, int h);
-
/**
* Thirdpel motion compensation with rounding (a+b+1)>>1.
* this is an array[12] of motion compensation functions for the 9 thirdpe
diff --git a/libavcodec/dsputil_template.c b/libavcodec/dsputil_template.c
index b9d5e97..bd5c48b 100644
--- a/libavcodec/dsputil_template.c
+++ b/libavcodec/dsputil_template.c
@@ -582,10 +582,6 @@ PIXOP2(put, op_put)
#define put_no_rnd_pixels8_c put_pixels8_c
#define put_no_rnd_pixels16_c put_pixels16_c
-static void FUNCC(put_no_rnd_pixels8_l2)(uint8_t *dst, const uint8_t *a, const
uint8_t *b, int stride, int h){
- FUNC(put_no_rnd_pixels8_l2)(dst, a, b, stride, stride, stride, h);
-}
-
#define H264_CHROMA_MC(OPNAME, OP)\
static void FUNCC(OPNAME ## h264_chroma_mc2)(uint8_t *_dst/*align 8*/, uint8_t
*_src/*align 1*/, int stride, int h, int x, int y){\
pixel *dst = (pixel*)_dst;\
diff --git a/libavcodec/vp3.c b/libavcodec/vp3.c
index 58db890..35cfd24 100644
--- a/libavcodec/vp3.c
+++ b/libavcodec/vp3.c
@@ -41,6 +41,7 @@
#include "videodsp.h"
#include "vp3data.h"
#include "vp3dsp.h"
+#include "vp35mcdsp.h"
#include "xiph.h"
#include "thread.h"
@@ -138,6 +139,7 @@ typedef struct Vp3DecodeContext {
DSPContext dsp;
VideoDSPContext vdsp;
VP3DSPContext vp3dsp;
+ VP35MCDSPContext vp35mcdsp;
DECLARE_ALIGNED(16, DCTELEM, block)[64];
int flipped_image;
int last_slice_end;
@@ -1564,7 +1566,7 @@ static void render_slice(Vp3DecodeContext *s, int slice)
motion_source, stride, 8);
}else{
int d= (motion_x ^ motion_y)>>31; // d is 0 if
motion_x and _y have the same sign, else -1
- s->dsp.put_no_rnd_pixels_l2(
+ s->vp35mcdsp.put_no_rnd_pixels_l2(
output_plane + first_pixel,
motion_source - d,
motion_source + stride + 1 + d,
@@ -1679,6 +1681,7 @@ static av_cold int vp3_decode_init(AVCodecContext *avctx)
ff_dsputil_init(&s->dsp, avctx);
ff_videodsp_init(&s->vdsp, 8);
ff_vp3dsp_init(&s->vp3dsp, avctx->flags);
+ ff_vp35mcdsp_init(&s->vp35mcdsp);
ff_init_scantable_permutation(s->dsp.idct_permutation,
s->vp3dsp.idct_perm);
ff_init_scantable(s->dsp.idct_permutation, &s->scantable,
ff_zigzag_direct);
diff --git a/libavcodec/vp35mcdsp.c b/libavcodec/vp35mcdsp.c
new file mode 100644
index 0000000..5a4d076
--- /dev/null
+++ b/libavcodec/vp35mcdsp.c
@@ -0,0 +1,43 @@
+/*
+ * 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
+ */
+
+#include "libavutil/intreadwrite.h"
+#include "vp35mcdsp.h"
+#include "dsputil.h"
+
+static void put_no_rnd_pixels_l2(uint8_t *dst, const uint8_t *src1,
+ const uint8_t *src2, ptrdiff_t stride, int h)
+{
+ int i;
+
+ for (i = 0; i < h; i++) {
+ uint32_t a, b;
+
+ a = AV_RN32A(&src1[i * stride]);
+ b = AV_RN32A(&src2[i * stride]);
+ AV_WN32A(&dst[i * stride], no_rnd_avg32(a, b));
+ a = AV_RN32A(&src1[i * stride + 4]);
+ b = AV_RN32A(&src2[i * stride + 4]);
+ AV_WN32A(&dst[i * stride + 4], no_rnd_avg32(a, b));
+ }
+}
+
+av_cold void ff_vp35mcdsp_init(VP35MCDSPContext *c)
+{
+ c->put_no_rnd_pixels_l2 = put_no_rnd_pixels_l2;
+}
diff --git a/libavcodec/vp35mcdsp.h b/libavcodec/vp35mcdsp.h
new file mode 100644
index 0000000..c11dd46
--- /dev/null
+++ b/libavcodec/vp35mcdsp.h
@@ -0,0 +1,43 @@
+/*
+ * 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_VP35MCDSP_H
+#define AVCODEC_VP35MCDSP_H
+
+#include <stddef.h>
+
+typedef struct VP35MCDSPContext {
+ /**
+ * Copy 8xH pixels from source to destination buffer using a bilinear
+ * filter with no rounding (i.e. *dst = (*a + *b) >> 1).
+ *
+ * @param dst destination buffer, aligned by 8
+ * @param a first source buffer, no alignment
+ * @param b second source buffer, no alignment
+ * @param stride distance between two lines in source/dest buffers
+ * @param h height
+ */
+ void (*put_no_rnd_pixels_l2)(uint8_t *dst,
+ const uint8_t *a,
+ const uint8_t *b,
+ ptrdiff_t stride, int h);
+} VP35MCDSPContext;
+
+void ff_vp35mcdsp_init(VP35MCDSPContext *c);
+
+#endif /* AVCODEC_VP35MCDSP_H */
diff --git a/libavcodec/vp56.c b/libavcodec/vp56.c
index c05d38e..094aa84 100644
--- a/libavcodec/vp56.c
+++ b/libavcodec/vp56.c
@@ -373,7 +373,7 @@ static void vp56_mc(VP56Context *s, int b, int plane,
uint8_t *src,
s->filter(s, dst, src_block, src_offset, src_offset+overlap_offset,
stride, s->mv[b], mask, s->filter_selection, b<4);
else
- s->dsp.put_no_rnd_pixels_l2(dst, src_block+src_offset,
+ s->vp35mcdsp.put_no_rnd_pixels_l2(dst, src_block+src_offset,
src_block+src_offset+overlap_offset,
stride, 8);
} else {
@@ -676,6 +676,7 @@ av_cold void ff_vp56_init(AVCodecContext *avctx, int flip,
int has_alpha)
ff_dsputil_init(&s->dsp, avctx);
ff_videodsp_init(&s->vdsp, 8);
ff_vp3dsp_init(&s->vp3dsp, avctx->flags);
+ ff_vp35mcdsp_init(&s->vp35mcdsp);
ff_vp56dsp_init(&s->vp56dsp, avctx->codec->id);
ff_init_scantable_permutation(s->dsp.idct_permutation,
s->vp3dsp.idct_perm);
ff_init_scantable(s->dsp.idct_permutation, &s->scantable,ff_zigzag_direct);
diff --git a/libavcodec/vp56.h b/libavcodec/vp56.h
index 431d1a9..947589c 100644
--- a/libavcodec/vp56.h
+++ b/libavcodec/vp56.h
@@ -32,6 +32,7 @@
#include "bytestream.h"
#include "videodsp.h"
#include "vp3dsp.h"
+#include "vp35mcdsp.h"
#include "vp56dsp.h"
typedef struct vp56_context VP56Context;
@@ -97,6 +98,7 @@ struct vp56_context {
DSPContext dsp;
VideoDSPContext vdsp;
VP3DSPContext vp3dsp;
+ VP35MCDSPContext vp35mcdsp;
VP56DSPContext vp56dsp;
ScanTable scantable;
AVFrame frames[4];
--
1.7.11.3
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel