aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec
diff options
context:
space:
mode:
authorRonald S. Bultje <rsbultje@gmail.com>2013-01-21 11:02:33 -0800
committerRonald S. Bultje <rsbultje@gmail.com>2013-01-21 18:08:55 -0800
commit4a73fbd9c5d5ba6b32a116b296a8cb199f8940ed (patch)
tree52037eaebd840fedbad4a6e3e959d4d0b6fc2551 /libavcodec
parent4f56e773fe8a554b8c2662650aaf799c2ece2721 (diff)
downloadffmpeg-4a73fbd9c5d5ba6b32a116b296a8cb199f8940ed.tar.gz
vp3/5: move put_no_rnd_pixels_l2 from dsputil to VP3DSPContext.
The function is only used in VP3 and VP5, so no need to have it in DSPContext.
Diffstat (limited to 'libavcodec')
-rw-r--r--libavcodec/dsputil.c1
-rw-r--r--libavcodec/dsputil.h2
-rw-r--r--libavcodec/dsputil_template.c4
-rw-r--r--libavcodec/vp3.c2
-rw-r--r--libavcodec/vp3dsp.c19
-rw-r--r--libavcodec/vp3dsp.h16
-rw-r--r--libavcodec/vp56.c6
7 files changed, 39 insertions, 11 deletions
diff --git a/libavcodec/dsputil.c b/libavcodec/dsputil.c
index 251fb0c2d9..ea40d2e8ed 100644
--- a/libavcodec/dsputil.c
+++ b/libavcodec/dsputil.c
@@ -2765,7 +2765,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 c0645a1eba..ddbbbe7539 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 b9d5e97bc0..bd5c48b1a8 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 58db8908db..33cfc8c204 100644
--- a/libavcodec/vp3.c
+++ b/libavcodec/vp3.c
@@ -1564,7 +1564,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->vp3dsp.put_no_rnd_pixels_l2(
output_plane + first_pixel,
motion_source - d,
motion_source + stride + 1 + d,
diff --git a/libavcodec/vp3dsp.c b/libavcodec/vp3dsp.c
index 9e6209dfdd..1883099002 100644
--- a/libavcodec/vp3dsp.c
+++ b/libavcodec/vp3dsp.c
@@ -274,8 +274,27 @@ static void vp3_h_loop_filter_c(uint8_t *first_pixel, int stride,
}
}
+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_vp3dsp_init(VP3DSPContext *c, int flags)
{
+ c->put_no_rnd_pixels_l2 = put_no_rnd_pixels_l2;
+
c->idct_put = vp3_idct_put_c;
c->idct_add = vp3_idct_add_c;
c->idct_dc_add = vp3_idct_dc_add_c;
diff --git a/libavcodec/vp3dsp.h b/libavcodec/vp3dsp.h
index feb300017a..d28c8478f0 100644
--- a/libavcodec/vp3dsp.h
+++ b/libavcodec/vp3dsp.h
@@ -19,10 +19,26 @@
#ifndef AVCODEC_VP3DSP_H
#define AVCODEC_VP3DSP_H
+#include <stddef.h>
#include <stdint.h>
#include "dsputil.h"
typedef struct VP3DSPContext {
+ /**
+ * 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);
+
void (*idct_put)(uint8_t *dest, int line_size, DCTELEM *block);
void (*idct_add)(uint8_t *dest, int line_size, DCTELEM *block);
void (*idct_dc_add)(uint8_t *dest, int line_size, DCTELEM *block);
diff --git a/libavcodec/vp56.c b/libavcodec/vp56.c
index c05d38ea10..64210881a4 100644
--- a/libavcodec/vp56.c
+++ b/libavcodec/vp56.c
@@ -373,9 +373,9 @@ 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,
- src_block+src_offset+overlap_offset,
- stride, 8);
+ s->vp3dsp.put_no_rnd_pixels_l2(dst, src_block+src_offset,
+ src_block+src_offset+overlap_offset,
+ stride, 8);
} else {
s->dsp.put_pixels_tab[1][0](dst, src_block+src_offset, stride, 8);
}