diff options
author | Spec-Chum <spec-chum@users.sourceforge.net> | 2010-06-28 13:52:29 +0400 |
---|---|---|
committer | Spec-Chum <spec-chum@users.sourceforge.net> | 2010-06-28 13:52:29 +0400 |
commit | d689241854077b6efc7a62f0e4f5b3bd414228e6 (patch) | |
tree | 8bc1c3300a160572b01845c5cabf01f59424030a /src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/vp8dsp.c | |
parent | 4a0275d8a6340469646ef0e07fe8121875051ad0 (diff) |
Updated ffmpeg (patch by XhmikosR) - Unresolved externals fixed by Spec-Chum
git-svn-id: https://mpc-hc.svn.sourceforge.net/svnroot/mpc-hc/trunk@2082 10f7b99b-c216-0410-bff0-8a66a9350fd8
Diffstat (limited to 'src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/vp8dsp.c')
-rw-r--r-- | src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/vp8dsp.c | 111 |
1 files changed, 99 insertions, 12 deletions
diff --git a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/vp8dsp.c b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/vp8dsp.c index 23fb46120..80e659abb 100644 --- a/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/vp8dsp.c +++ b/src/filters/transform/MPCVideoDec/ffmpeg/libavcodec/vp8dsp.c @@ -251,6 +251,17 @@ 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) { \ + int i; \ + for (i = 0; i < h; i++, 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] + \ @@ -261,7 +272,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; \ @@ -269,37 +280,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; \ @@ -308,7 +319,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,8 +349,63 @@ VP8_EPEL_HV(16, FILTER_6TAP, FILTER_6TAP, h6v6) VP8_EPEL_HV(8, FILTER_6TAP, FILTER_6TAP, h6v6) VP8_EPEL_HV(4, FILTER_6TAP, FILTER_6TAP, h6v6) +#define VP8_BILINEAR(SIZE) \ +static void put_vp8_bilinear ## SIZE ## _h_c(uint8_t *dst, int stride, uint8_t *src, int s2, int h, int mx, int my) \ +{ \ + int a = 8-mx, b = mx; \ + int x, y; \ +\ + for (y = 0; y < h; y++) { \ + for (x = 0; x < SIZE; x++) \ + dst[x] = (a*src[x] + b*src[x+1] + 4) >> 3; \ + dst += stride; \ + src += stride; \ + } \ +} \ +static void put_vp8_bilinear ## SIZE ## _v_c(uint8_t *dst, int stride, uint8_t *src, int s2, int h, int mx, int my) \ +{ \ + int c = 8-my, d = my; \ + int x, y; \ +\ + for (y = 0; y < h; y++) { \ + for (x = 0; x < SIZE; x++) \ + dst[x] = (c*src[x] + d*src[x+stride] + 4) >> 3; \ + dst += stride; \ + src += stride; \ + } \ +} \ +\ +static void put_vp8_bilinear ## SIZE ## _hv_c(uint8_t *dst, int stride, uint8_t *src, int s2, int h, int mx, int my) \ +{ \ + int a = 8-mx, b = mx; \ + int c = 8-my, d = my; \ + int x, y; \ + uint8_t tmp_array[(2*SIZE+1)*SIZE]; \ + uint8_t *tmp = tmp_array; \ +\ + for (y = 0; y < h+1; y++) { \ + for (x = 0; x < SIZE; x++) \ + tmp[x] = (a*src[x] + b*src[x+1] + 4) >> 3; \ + tmp += SIZE; \ + src += stride; \ + } \ +\ + tmp = tmp_array; \ +\ + for (y = 0; y < h; y++) { \ + for (x = 0; x < SIZE; x++) \ + dst[x] = (c*tmp[x] + d*tmp[x+SIZE] + 4) >> 3; \ + dst += stride; \ + tmp += SIZE; \ + } \ +} + +VP8_BILINEAR(16) +VP8_BILINEAR(8) +VP8_BILINEAR(4) + #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; \ @@ -349,6 +415,17 @@ VP8_EPEL_HV(4, FILTER_6TAP, FILTER_6TAP, h6v6) dsp->put_vp8_epel_pixels_tab[IDX][2][1] = put_vp8_epel ## SIZE ## _h4v6_c; \ dsp->put_vp8_epel_pixels_tab[IDX][2][2] = put_vp8_epel ## SIZE ## _h6v6_c +#define VP8_BILINEAR_MC_FUNC(IDX, SIZE) \ + dsp->put_vp8_bilinear_pixels_tab[IDX][0][0] = put_vp8_pixels ## SIZE ## _c; \ + dsp->put_vp8_bilinear_pixels_tab[IDX][0][1] = put_vp8_bilinear ## SIZE ## _h_c; \ + dsp->put_vp8_bilinear_pixels_tab[IDX][0][2] = put_vp8_bilinear ## SIZE ## _h_c; \ + dsp->put_vp8_bilinear_pixels_tab[IDX][1][0] = put_vp8_bilinear ## SIZE ## _v_c; \ + dsp->put_vp8_bilinear_pixels_tab[IDX][1][1] = put_vp8_bilinear ## SIZE ## _hv_c; \ + dsp->put_vp8_bilinear_pixels_tab[IDX][1][2] = put_vp8_bilinear ## SIZE ## _hv_c; \ + dsp->put_vp8_bilinear_pixels_tab[IDX][2][0] = put_vp8_bilinear ## SIZE ## _v_c; \ + dsp->put_vp8_bilinear_pixels_tab[IDX][2][1] = put_vp8_bilinear ## SIZE ## _hv_c; \ + dsp->put_vp8_bilinear_pixels_tab[IDX][2][2] = put_vp8_bilinear ## SIZE ## _hv_c + av_cold void ff_vp8dsp_init(VP8DSPContext *dsp) { dsp->vp8_luma_dc_wht = vp8_luma_dc_wht_c; @@ -371,4 +448,14 @@ av_cold void ff_vp8dsp_init(VP8DSPContext *dsp) VP8_MC_FUNC(0, 16); VP8_MC_FUNC(1, 8); VP8_MC_FUNC(2, 4); + + VP8_BILINEAR_MC_FUNC(0, 16); + VP8_BILINEAR_MC_FUNC(1, 8); + VP8_BILINEAR_MC_FUNC(2, 4); + +// MPC-HC Specific code - Optimisations not available when using MSVC +#ifndef _DEBUG + ff_vp8dsp_init_x86(dsp); +#endif +// End MPC-HC Specific code } |