00001
00019 #include <stdint.h>
00020 #include "libavcodec/vp8dsp.h"
00021
00022 void ff_vp8_luma_dc_wht_dc_armv6(DCTELEM block[4][4][16], DCTELEM dc[16]);
00023
00024 #define idct_funcs(opt) \
00025 void ff_vp8_luma_dc_wht_ ## opt(DCTELEM block[4][4][16], DCTELEM dc[16]); \
00026 void ff_vp8_idct_add_ ## opt(uint8_t *dst, DCTELEM block[16], int stride); \
00027 void ff_vp8_idct_dc_add_ ## opt(uint8_t *dst, DCTELEM block[16], int stride); \
00028 void ff_vp8_idct_dc_add4y_ ## opt(uint8_t *dst, DCTELEM block[4][16], int stride); \
00029 void ff_vp8_idct_dc_add4uv_ ## opt(uint8_t *dst, DCTELEM block[4][16], int stride)
00030
00031 idct_funcs(neon);
00032 idct_funcs(armv6);
00033
00034 void ff_vp8_v_loop_filter16_neon(uint8_t *dst, int stride,
00035 int flim_E, int flim_I, int hev_thresh);
00036 void ff_vp8_h_loop_filter16_neon(uint8_t *dst, int stride,
00037 int flim_E, int flim_I, int hev_thresh);
00038 void ff_vp8_v_loop_filter8uv_neon(uint8_t *dstU, uint8_t *dstV, int stride,
00039 int flim_E, int flim_I, int hev_thresh);
00040 void ff_vp8_h_loop_filter8uv_neon(uint8_t *dstU, uint8_t *dstV, int stride,
00041 int flim_E, int flim_I, int hev_thresh);
00042
00043 void ff_vp8_v_loop_filter16_inner_neon(uint8_t *dst, int stride,
00044 int flim_E, int flim_I, int hev_thresh);
00045 void ff_vp8_h_loop_filter16_inner_neon(uint8_t *dst, int stride,
00046 int flim_E, int flim_I, int hev_thresh);
00047 void ff_vp8_v_loop_filter8uv_inner_neon(uint8_t *dstU, uint8_t *dstV,
00048 int stride, int flim_E, int flim_I,
00049 int hev_thresh);
00050 void ff_vp8_h_loop_filter8uv_inner_neon(uint8_t *dstU, uint8_t *dstV,
00051 int stride, int flim_E, int flim_I,
00052 int hev_thresh);
00053
00054 void ff_vp8_v_loop_filter_inner_armv6(uint8_t *dst, int stride,
00055 int flim_E, int flim_I,
00056 int hev_thresh, int count);
00057 void ff_vp8_h_loop_filter_inner_armv6(uint8_t *dst, int stride,
00058 int flim_E, int flim_I,
00059 int hev_thresh, int count);
00060 void ff_vp8_v_loop_filter_armv6(uint8_t *dst, int stride,
00061 int flim_E, int flim_I,
00062 int hev_thresh, int count);
00063 void ff_vp8_h_loop_filter_armv6(uint8_t *dst, int stride,
00064 int flim_E, int flim_I,
00065 int hev_thresh, int count);
00066
00067 static void ff_vp8_v_loop_filter16_armv6(uint8_t *dst, int stride,
00068 int flim_E, int flim_I, int hev_thresh)
00069 {
00070 ff_vp8_v_loop_filter_armv6(dst, stride, flim_E, flim_I, hev_thresh, 4);
00071 }
00072
00073 static void ff_vp8_h_loop_filter16_armv6(uint8_t *dst, int stride,
00074 int flim_E, int flim_I, int hev_thresh)
00075 {
00076 ff_vp8_h_loop_filter_armv6(dst, stride, flim_E, flim_I, hev_thresh, 4);
00077 }
00078
00079 static void ff_vp8_v_loop_filter8uv_armv6(uint8_t *dstU, uint8_t *dstV, int stride,
00080 int flim_E, int flim_I, int hev_thresh)
00081 {
00082 ff_vp8_v_loop_filter_armv6(dstU, stride, flim_E, flim_I, hev_thresh, 2);
00083 ff_vp8_v_loop_filter_armv6(dstV, stride, flim_E, flim_I, hev_thresh, 2);
00084 }
00085
00086 static void ff_vp8_h_loop_filter8uv_armv6(uint8_t *dstU, uint8_t *dstV, int stride,
00087 int flim_E, int flim_I, int hev_thresh)
00088 {
00089 ff_vp8_h_loop_filter_armv6(dstU, stride, flim_E, flim_I, hev_thresh, 2);
00090 ff_vp8_h_loop_filter_armv6(dstV, stride, flim_E, flim_I, hev_thresh, 2);
00091 }
00092
00093 static void ff_vp8_v_loop_filter16_inner_armv6(uint8_t *dst, int stride,
00094 int flim_E, int flim_I, int hev_thresh)
00095 {
00096 ff_vp8_v_loop_filter_inner_armv6(dst, stride, flim_E, flim_I, hev_thresh, 4);
00097 }
00098
00099 static void ff_vp8_h_loop_filter16_inner_armv6(uint8_t *dst, int stride,
00100 int flim_E, int flim_I, int hev_thresh)
00101 {
00102 ff_vp8_h_loop_filter_inner_armv6(dst, stride, flim_E, flim_I, hev_thresh, 4);
00103 }
00104
00105 static void ff_vp8_v_loop_filter8uv_inner_armv6(uint8_t *dstU, uint8_t *dstV,
00106 int stride, int flim_E, int flim_I,
00107 int hev_thresh)
00108 {
00109 ff_vp8_v_loop_filter_inner_armv6(dstU, stride, flim_E, flim_I, hev_thresh, 2);
00110 ff_vp8_v_loop_filter_inner_armv6(dstV, stride, flim_E, flim_I, hev_thresh, 2);
00111 }
00112
00113 static void ff_vp8_h_loop_filter8uv_inner_armv6(uint8_t *dstU, uint8_t *dstV,
00114 int stride, int flim_E, int flim_I,
00115 int hev_thresh)
00116 {
00117 ff_vp8_h_loop_filter_inner_armv6(dstU, stride, flim_E, flim_I, hev_thresh, 2);
00118 ff_vp8_h_loop_filter_inner_armv6(dstV, stride, flim_E, flim_I, hev_thresh, 2);
00119 }
00120
00121 #define simple_lf_funcs(opt) \
00122 void ff_vp8_v_loop_filter16_simple_ ## opt(uint8_t *dst, int stride, int flim); \
00123 void ff_vp8_h_loop_filter16_simple_ ## opt(uint8_t *dst, int stride, int flim)
00124
00125 simple_lf_funcs(neon);
00126 simple_lf_funcs(armv6);
00127
00128 #define VP8_MC_OPT(n, opt) \
00129 void ff_put_vp8_##n##_##opt(uint8_t *dst, int dststride, \
00130 uint8_t *src, int srcstride, \
00131 int h, int x, int y)
00132
00133 #define VP8_MC(n) \
00134 VP8_MC_OPT(n, neon)
00135
00136 #define VP8_EPEL(w) \
00137 VP8_MC(epel ## w ## _h4); \
00138 VP8_MC(epel ## w ## _h6); \
00139 VP8_MC(epel ## w ## _h4v4); \
00140 VP8_MC(epel ## w ## _h6v4); \
00141 VP8_MC(epel ## w ## _v4); \
00142 VP8_MC(epel ## w ## _v6); \
00143 VP8_MC(epel ## w ## _h4v6); \
00144 VP8_MC(epel ## w ## _h6v6)
00145
00146 VP8_EPEL(16);
00147 VP8_MC(pixels16);
00148 VP8_MC_OPT(pixels16, armv6);
00149 VP8_EPEL(8);
00150 VP8_MC(pixels8);
00151 VP8_MC_OPT(pixels8, armv6);
00152 VP8_EPEL(4);
00153 VP8_MC_OPT(pixels4, armv6);
00154
00155 VP8_MC(bilin16_h);
00156 VP8_MC(bilin16_v);
00157 VP8_MC(bilin16_hv);
00158 VP8_MC(bilin8_h);
00159 VP8_MC(bilin8_v);
00160 VP8_MC(bilin8_hv);
00161 VP8_MC(bilin4_h);
00162 VP8_MC(bilin4_v);
00163 VP8_MC(bilin4_hv);
00164
00165 #define VP8_V6_MC(n) \
00166 void ff_put_vp8_##n##_armv6(uint8_t *dst, int dststride, uint8_t *src, \
00167 int srcstride, int w, int h, int mxy)
00168
00169 VP8_V6_MC(epel_v6);
00170 VP8_V6_MC(epel_h6);
00171 VP8_V6_MC(epel_v4);
00172 VP8_V6_MC(epel_h4);
00173 VP8_V6_MC(bilin_v);
00174 VP8_V6_MC(bilin_h);
00175
00176 #define VP8_EPEL_HV(SIZE, TAPNUMX, TAPNUMY, NAME, HNAME, VNAME, MAXHEIGHT) \
00177 static void ff_put_vp8_##NAME##SIZE##_##HNAME##VNAME##_armv6( \
00178 uint8_t *dst, int dststride, uint8_t *src, \
00179 int srcstride, int h, int mx, int my) \
00180 { \
00181 DECLARE_ALIGNED(4, uint8_t, tmp)[SIZE * (MAXHEIGHT + TAPNUMY - 1)]; \
00182 uint8_t *tmpptr = tmp + SIZE * (TAPNUMY / 2 - 1); \
00183 src -= srcstride * (TAPNUMY / 2 - 1); \
00184 ff_put_vp8_ ## NAME ## _ ## HNAME ## _armv6(tmp, SIZE, src, srcstride, \
00185 SIZE, h + TAPNUMY - 1, mx); \
00186 ff_put_vp8_ ## NAME ## _ ## VNAME ## _armv6(dst, dststride, tmpptr, SIZE, \
00187 SIZE, h, my); \
00188 }
00189
00190 VP8_EPEL_HV(16, 6, 6, epel, h6, v6, 16);
00191 VP8_EPEL_HV(16, 2, 2, bilin, h, v, 16);
00192 VP8_EPEL_HV(8, 6, 6, epel, h6, v6, 16);
00193 VP8_EPEL_HV(8, 4, 6, epel, h4, v6, 16);
00194 VP8_EPEL_HV(8, 6, 4, epel, h6, v4, 16);
00195 VP8_EPEL_HV(8, 4, 4, epel, h4, v4, 16);
00196 VP8_EPEL_HV(8, 2, 2, bilin, h, v, 16);
00197 VP8_EPEL_HV(4, 6, 6, epel, h6, v6, 8);
00198 VP8_EPEL_HV(4, 4, 6, epel, h4, v6, 8);
00199 VP8_EPEL_HV(4, 6, 4, epel, h6, v4, 8);
00200 VP8_EPEL_HV(4, 4, 4, epel, h4, v4, 8);
00201 VP8_EPEL_HV(4, 2, 2, bilin, h, v, 8);
00202
00203 extern void put_vp8_epel4_v6_c(uint8_t *dst, int d, uint8_t *src, int s, int h, int mx, int my);
00204 #undef printf
00205 #define VP8_EPEL_H_OR_V(SIZE, NAME, HV) \
00206 static void ff_put_vp8_##NAME##SIZE##_##HV##_armv6( \
00207 uint8_t *dst, int dststride, uint8_t *src, \
00208 int srcstride, int h, int mx, int my) \
00209 { \
00210 ff_put_vp8_## NAME ## _ ## HV ## _armv6(dst, dststride, src, srcstride, \
00211 SIZE, h, mx | my); \
00212 }
00213
00214 VP8_EPEL_H_OR_V(4, epel, h6);
00215 VP8_EPEL_H_OR_V(4, epel, h4);
00216 VP8_EPEL_H_OR_V(4, epel, v6);
00217 VP8_EPEL_H_OR_V(4, epel, v4);
00218 VP8_EPEL_H_OR_V(4, bilin, v);
00219 VP8_EPEL_H_OR_V(4, bilin, h);
00220 VP8_EPEL_H_OR_V(8, epel, h6);
00221 VP8_EPEL_H_OR_V(8, epel, h4);
00222 VP8_EPEL_H_OR_V(8, epel, v6);
00223 VP8_EPEL_H_OR_V(8, epel, v4);
00224 VP8_EPEL_H_OR_V(8, bilin, v);
00225 VP8_EPEL_H_OR_V(8, bilin, h);
00226 VP8_EPEL_H_OR_V(16, epel, h6);
00227 VP8_EPEL_H_OR_V(16, epel, v6);
00228 VP8_EPEL_H_OR_V(16, bilin, v);
00229 VP8_EPEL_H_OR_V(16, bilin, h);
00230
00231 av_cold void ff_vp8dsp_init_arm(VP8DSPContext *dsp)
00232 {
00233 #define set_func_ptrs(opt) \
00234 dsp->vp8_luma_dc_wht = ff_vp8_luma_dc_wht_##opt; \
00235 dsp->vp8_luma_dc_wht_dc = ff_vp8_luma_dc_wht_dc_armv6; \
00236 \
00237 dsp->vp8_idct_add = ff_vp8_idct_add_##opt; \
00238 dsp->vp8_idct_dc_add = ff_vp8_idct_dc_add_##opt; \
00239 dsp->vp8_idct_dc_add4y = ff_vp8_idct_dc_add4y_##opt; \
00240 dsp->vp8_idct_dc_add4uv = ff_vp8_idct_dc_add4uv_##opt; \
00241 \
00242 dsp->vp8_v_loop_filter16y = ff_vp8_v_loop_filter16_##opt; \
00243 dsp->vp8_h_loop_filter16y = ff_vp8_h_loop_filter16_##opt; \
00244 dsp->vp8_v_loop_filter8uv = ff_vp8_v_loop_filter8uv_##opt; \
00245 dsp->vp8_h_loop_filter8uv = ff_vp8_h_loop_filter8uv_##opt; \
00246 \
00247 dsp->vp8_v_loop_filter16y_inner = ff_vp8_v_loop_filter16_inner_##opt; \
00248 dsp->vp8_h_loop_filter16y_inner = ff_vp8_h_loop_filter16_inner_##opt; \
00249 dsp->vp8_v_loop_filter8uv_inner = ff_vp8_v_loop_filter8uv_inner_##opt; \
00250 dsp->vp8_h_loop_filter8uv_inner = ff_vp8_h_loop_filter8uv_inner_##opt; \
00251 \
00252 dsp->vp8_v_loop_filter_simple = ff_vp8_v_loop_filter16_simple_##opt; \
00253 dsp->vp8_h_loop_filter_simple = ff_vp8_h_loop_filter16_simple_##opt; \
00254 \
00255 dsp->put_vp8_epel_pixels_tab[0][0][0] = ff_put_vp8_pixels16_##opt; \
00256 dsp->put_vp8_epel_pixels_tab[0][0][2] = ff_put_vp8_epel16_h6_##opt; \
00257 dsp->put_vp8_epel_pixels_tab[0][2][0] = ff_put_vp8_epel16_v6_##opt; \
00258 dsp->put_vp8_epel_pixels_tab[0][2][2] = ff_put_vp8_epel16_h6v6_##opt; \
00259 \
00260 dsp->put_vp8_epel_pixels_tab[1][0][0] = ff_put_vp8_pixels8_##opt; \
00261 dsp->put_vp8_epel_pixels_tab[1][0][1] = ff_put_vp8_epel8_h4_##opt; \
00262 dsp->put_vp8_epel_pixels_tab[1][0][2] = ff_put_vp8_epel8_h6_##opt; \
00263 dsp->put_vp8_epel_pixels_tab[1][1][0] = ff_put_vp8_epel8_v4_##opt; \
00264 dsp->put_vp8_epel_pixels_tab[1][1][1] = ff_put_vp8_epel8_h4v4_##opt; \
00265 dsp->put_vp8_epel_pixels_tab[1][1][2] = ff_put_vp8_epel8_h6v4_##opt; \
00266 dsp->put_vp8_epel_pixels_tab[1][2][0] = ff_put_vp8_epel8_v6_##opt; \
00267 dsp->put_vp8_epel_pixels_tab[1][2][1] = ff_put_vp8_epel8_h4v6_##opt; \
00268 dsp->put_vp8_epel_pixels_tab[1][2][2] = ff_put_vp8_epel8_h6v6_##opt; \
00269 \
00270 dsp->put_vp8_epel_pixels_tab[2][0][0] = ff_put_vp8_pixels4_armv6; \
00271 dsp->put_vp8_epel_pixels_tab[2][0][1] = ff_put_vp8_epel4_h4_##opt; \
00272 dsp->put_vp8_epel_pixels_tab[2][0][2] = ff_put_vp8_epel4_h6_##opt; \
00273 dsp->put_vp8_epel_pixels_tab[2][1][0] = ff_put_vp8_epel4_v4_##opt; \
00274 dsp->put_vp8_epel_pixels_tab[2][1][1] = ff_put_vp8_epel4_h4v4_##opt; \
00275 dsp->put_vp8_epel_pixels_tab[2][1][2] = ff_put_vp8_epel4_h6v4_##opt; \
00276 dsp->put_vp8_epel_pixels_tab[2][2][0] = ff_put_vp8_epel4_v6_##opt; \
00277 dsp->put_vp8_epel_pixels_tab[2][2][1] = ff_put_vp8_epel4_h4v6_##opt; \
00278 dsp->put_vp8_epel_pixels_tab[2][2][2] = ff_put_vp8_epel4_h6v6_##opt; \
00279 \
00280 dsp->put_vp8_bilinear_pixels_tab[0][0][0] = ff_put_vp8_pixels16_##opt; \
00281 dsp->put_vp8_bilinear_pixels_tab[0][0][2] = ff_put_vp8_bilin16_h_##opt; \
00282 dsp->put_vp8_bilinear_pixels_tab[0][2][0] = ff_put_vp8_bilin16_v_##opt; \
00283 dsp->put_vp8_bilinear_pixels_tab[0][2][2] = ff_put_vp8_bilin16_hv_##opt; \
00284 \
00285 dsp->put_vp8_bilinear_pixels_tab[1][0][0] = ff_put_vp8_pixels8_##opt; \
00286 dsp->put_vp8_bilinear_pixels_tab[1][0][1] = ff_put_vp8_bilin8_h_##opt; \
00287 dsp->put_vp8_bilinear_pixels_tab[1][0][2] = ff_put_vp8_bilin8_h_##opt; \
00288 dsp->put_vp8_bilinear_pixels_tab[1][1][0] = ff_put_vp8_bilin8_v_##opt; \
00289 dsp->put_vp8_bilinear_pixels_tab[1][1][1] = ff_put_vp8_bilin8_hv_##opt; \
00290 dsp->put_vp8_bilinear_pixels_tab[1][1][2] = ff_put_vp8_bilin8_hv_##opt; \
00291 dsp->put_vp8_bilinear_pixels_tab[1][2][0] = ff_put_vp8_bilin8_v_##opt; \
00292 dsp->put_vp8_bilinear_pixels_tab[1][2][1] = ff_put_vp8_bilin8_hv_##opt; \
00293 dsp->put_vp8_bilinear_pixels_tab[1][2][2] = ff_put_vp8_bilin8_hv_##opt; \
00294 \
00295 dsp->put_vp8_bilinear_pixels_tab[2][0][0] = ff_put_vp8_pixels4_armv6; \
00296 dsp->put_vp8_bilinear_pixels_tab[2][0][1] = ff_put_vp8_bilin4_h_##opt; \
00297 dsp->put_vp8_bilinear_pixels_tab[2][0][2] = ff_put_vp8_bilin4_h_##opt; \
00298 dsp->put_vp8_bilinear_pixels_tab[2][1][0] = ff_put_vp8_bilin4_v_##opt; \
00299 dsp->put_vp8_bilinear_pixels_tab[2][1][1] = ff_put_vp8_bilin4_hv_##opt; \
00300 dsp->put_vp8_bilinear_pixels_tab[2][1][2] = ff_put_vp8_bilin4_hv_##opt; \
00301 dsp->put_vp8_bilinear_pixels_tab[2][2][0] = ff_put_vp8_bilin4_v_##opt; \
00302 dsp->put_vp8_bilinear_pixels_tab[2][2][1] = ff_put_vp8_bilin4_hv_##opt; \
00303 dsp->put_vp8_bilinear_pixels_tab[2][2][2] = ff_put_vp8_bilin4_hv_##opt
00304 if (HAVE_NEON) {
00305 set_func_ptrs(neon);
00306 } else if (HAVE_ARMV6) {
00307 set_func_ptrs(armv6);
00308 }
00309 }