summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJason Garrett-Glaser <darkshikari@gmail.com>2010-06-25 18:14:07 +0000
committerJason Garrett-Glaser <darkshikari@gmail.com>2010-06-25 18:14:07 +0000
commitd6f8476be4895c620d58e021ab880823d2fe25bf (patch)
tree6a6b0d4114ddc750b031fb7920cbc5bdbdc80a50
parenteb7626a32b5d0b14fdc15d9b1bdf65342efe3b67 (diff)
Make VP8 DSP functions take two strides
This isn't useful for the C functions, but will allow re-using H and V functions for HV functions without adding separate H and V wrappers. Originally committed as revision 23782 to svn://svn.ffmpeg.org/ffmpeg/trunk
-rw-r--r--libavcodec/dsputil.c12
-rw-r--r--libavcodec/vp8.c4
-rw-r--r--libavcodec/vp8dsp.c34
-rw-r--r--libavcodec/vp8dsp.h4
4 files changed, 27 insertions, 27 deletions
diff --git a/libavcodec/dsputil.c b/libavcodec/dsputil.c
index fdf23f0a50..0db637a501 100644
--- a/libavcodec/dsputil.c
+++ b/libavcodec/dsputil.c
@@ -2657,18 +2657,6 @@ static void avg_rv40_qpel8_mc33_c(uint8_t *dst, uint8_t *src, int stride){
}
#endif /* CONFIG_RV40_DECODER */
-#if CONFIG_VP8_DECODER
-void ff_put_vp8_pixels16_c(uint8_t *dst, uint8_t *src, int stride, int h, int x, int y) {
- put_pixels16_c(dst, src, stride, h);
-}
-void ff_put_vp8_pixels8_c(uint8_t *dst, uint8_t *src, int stride, int h, int x, int y) {
- put_pixels8_c(dst, src, stride, h);
-}
-void ff_put_vp8_pixels4_c(uint8_t *dst, uint8_t *src, int stride, int h, int x, int y) {
- put_pixels4_c(dst, src, stride, h);
-}
-#endif
-
static void wmv2_mspel8_v_lowpass(uint8_t *dst, uint8_t *src, int dstStride, int srcStride, int w){
uint8_t *cm = ff_cropTbl + MAX_NEG_CROP;
int i;
diff --git a/libavcodec/vp8.c b/libavcodec/vp8.c
index a4b3788d62..b7c60f9809 100644
--- a/libavcodec/vp8.c
+++ b/libavcodec/vp8.c
@@ -912,7 +912,7 @@ static inline void vp8_mc(VP8Context *s, int luma,
uint8_t *dst, uint8_t *src, const VP56mv *mv,
int x_off, int y_off, int block_w, int block_h,
int width, int height, int linesize,
- h264_chroma_mc_func mc_func[3][3])
+ vp8_mc_func mc_func[3][3])
{
static const uint8_t idx[8] = { 0, 1, 2, 1, 2, 1, 2, 1 };
int mx = (mv->x << luma)&7, mx_idx = idx[mx];
@@ -931,7 +931,7 @@ static inline void vp8_mc(VP8Context *s, int luma,
src = s->edge_emu_buffer + 2 + linesize * 2;
}
- mc_func[my_idx][mx_idx](dst, src, linesize, block_h, mx, my);
+ mc_func[my_idx][mx_idx](dst, linesize, src, linesize, block_h, mx, my);
}
/**
diff --git a/libavcodec/vp8dsp.c b/libavcodec/vp8dsp.c
index 50b029776c..4bc1d83916 100644
--- a/libavcodec/vp8dsp.c
+++ b/libavcodec/vp8dsp.c
@@ -250,6 +250,16 @@ static const uint8_t subpel_filters[7][6] = {
{ 0, 1, 12, 123, 6, 0 },
};
+#define PUT_PIXELS(WIDTH) \
+static void put_vp8_pixels ## WIDTH ##_c(uint8_t *dst, int dststride, uint8_t *src, int srcstride, int h, int x, int y) { \
+ for (int y = 0; y < h; y++, dst+= dststride, src+= srcstride) { \
+ memcpy(dst, src, WIDTH); \
+ } \
+}
+
+PUT_PIXELS(16)
+PUT_PIXELS(8)
+PUT_PIXELS(4)
#define FILTER_6TAP(src, F, stride) \
av_clip_uint8((F[2]*src[x+0*stride] - F[1]*src[x-1*stride] + F[0]*src[x-2*stride] + \
@@ -260,7 +270,7 @@ static const uint8_t subpel_filters[7][6] = {
F[3]*src[x+1*stride] - F[4]*src[x+2*stride] + 64) >> 7)
#define VP8_EPEL_H(SIZE, FILTER, FILTERNAME) \
-static void put_vp8_epel ## SIZE ## _ ## FILTERNAME ## _c(uint8_t *dst, uint8_t *src, int stride, int h, int mx, int my) \
+static void put_vp8_epel ## SIZE ## _ ## FILTERNAME ## _c(uint8_t *dst, int dststride, uint8_t *src, int srcstride, int h, int mx, int my) \
{ \
const uint8_t *filter = subpel_filters[mx-1]; \
int x, y; \
@@ -268,37 +278,37 @@ static void put_vp8_epel ## SIZE ## _ ## FILTERNAME ## _c(uint8_t *dst, uint8_t
for (y = 0; y < h; y++) { \
for (x = 0; x < SIZE; x++) \
dst[x] = FILTER(src, filter, 1); \
- dst += stride; \
- src += stride; \
+ dst += dststride; \
+ src += srcstride; \
} \
}
#define VP8_EPEL_V(SIZE, FILTER, FILTERNAME) \
-static void put_vp8_epel ## SIZE ## _ ## FILTERNAME ## _c(uint8_t *dst, uint8_t *src, int stride, int h, int mx, int my) \
+static void put_vp8_epel ## SIZE ## _ ## FILTERNAME ## _c(uint8_t *dst, int dststride, uint8_t *src, int srcstride, int h, int mx, int my) \
{ \
const uint8_t *filter = subpel_filters[my-1]; \
int x, y; \
\
for (y = 0; y < h; y++) { \
for (x = 0; x < SIZE; x++) \
- dst[x] = FILTER(src, filter, stride); \
- dst += stride; \
- src += stride; \
+ dst[x] = FILTER(src, filter, srcstride); \
+ dst += dststride; \
+ src += srcstride; \
} \
}
#define VP8_EPEL_HV(SIZE, FILTERX, FILTERY, FILTERNAME) \
-static void put_vp8_epel ## SIZE ## _ ## FILTERNAME ## _c(uint8_t *dst, uint8_t *src, int stride, int h, int mx, int my) \
+static void put_vp8_epel ## SIZE ## _ ## FILTERNAME ## _c(uint8_t *dst, int dststride, uint8_t *src, int srcstride, int h, int mx, int my) \
{ \
const uint8_t *filter = subpel_filters[mx-1]; \
int x, y; \
uint8_t tmp_array[(2*SIZE+5)*SIZE]; \
uint8_t *tmp = tmp_array; \
- src -= 2*stride; \
+ src -= 2*srcstride; \
\
for (y = 0; y < h+5; y++) { \
for (x = 0; x < SIZE; x++) \
tmp[x] = FILTERX(src, filter, 1); \
tmp += SIZE; \
- src += stride; \
+ src += srcstride; \
} \
\
tmp = tmp_array + 2*SIZE; \
@@ -307,7 +317,7 @@ static void put_vp8_epel ## SIZE ## _ ## FILTERNAME ## _c(uint8_t *dst, uint8_t
for (y = 0; y < h; y++) { \
for (x = 0; x < SIZE; x++) \
dst[x] = FILTERY(tmp, filter, SIZE); \
- dst += stride; \
+ dst += dststride; \
tmp += SIZE; \
} \
}
@@ -338,7 +348,7 @@ VP8_EPEL_HV(8, FILTER_6TAP, FILTER_6TAP, h6v6)
VP8_EPEL_HV(4, FILTER_6TAP, FILTER_6TAP, h6v6)
#define VP8_MC_FUNC(IDX, SIZE) \
- dsp->put_vp8_epel_pixels_tab[IDX][0][0] = ff_put_vp8_pixels ## SIZE ## _c; \
+ dsp->put_vp8_epel_pixels_tab[IDX][0][0] = put_vp8_pixels ## SIZE ## _c; \
dsp->put_vp8_epel_pixels_tab[IDX][0][1] = put_vp8_epel ## SIZE ## _h4_c; \
dsp->put_vp8_epel_pixels_tab[IDX][0][2] = put_vp8_epel ## SIZE ## _h6_c; \
dsp->put_vp8_epel_pixels_tab[IDX][1][0] = put_vp8_epel ## SIZE ## _v4_c; \
diff --git a/libavcodec/vp8dsp.h b/libavcodec/vp8dsp.h
index fa7bf76d29..2cd9e7a10b 100644
--- a/libavcodec/vp8dsp.h
+++ b/libavcodec/vp8dsp.h
@@ -27,6 +27,8 @@
#include "dsputil.h"
+typedef void (*vp8_mc_func)(uint8_t *dst/*align 8*/, int dstStride, uint8_t *src/*align 1*/, int srcStride, int h, int x, int y);
+
typedef struct VP8DSPContext {
void (*vp8_luma_dc_wht)(DCTELEM block[4][4][16], DCTELEM dc[16]);
void (*vp8_idct_add)(uint8_t *dst, DCTELEM block[16], int stride);
@@ -55,7 +57,7 @@ typedef struct VP8DSPContext {
* third dimension: same as second dimention, for horizontal interpolation
* so something like put_vp8_epel_pixels_tab[width>>3][2*!!my-(my&1)][2*!!mx-(mx&1)](..., mx, my)
*/
- h264_chroma_mc_func put_vp8_epel_pixels_tab[3][3][3];
+ vp8_mc_func put_vp8_epel_pixels_tab[3][3][3];
} VP8DSPContext;
void ff_put_vp8_pixels16_c(uint8_t *dst, uint8_t *src, int stride, int h, int x, int y);