You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

531 lines
17KB

  1. /*
  2. * Copyright (C) 2010 David Conrad
  3. * Copyright (C) 2010 Ronald S. Bultje
  4. *
  5. * This file is part of FFmpeg.
  6. *
  7. * FFmpeg is free software; you can redistribute it and/or
  8. * modify it under the terms of the GNU Lesser General Public
  9. * License as published by the Free Software Foundation; either
  10. * version 2.1 of the License, or (at your option) any later version.
  11. *
  12. * FFmpeg is distributed in the hope that it will be useful,
  13. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  15. * Lesser General Public License for more details.
  16. *
  17. * You should have received a copy of the GNU Lesser General Public
  18. * License along with FFmpeg; if not, write to the Free Software
  19. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  20. */
  21. /**
  22. * @file
  23. * VP8 compatible video decoder
  24. */
  25. #include "dsputil.h"
  26. #include "vp8dsp.h"
  27. #include "libavutil/common.h"
  28. // TODO: Maybe add dequant
  29. static void vp8_luma_dc_wht_c(DCTELEM block[4][4][16], DCTELEM dc[16])
  30. {
  31. int i, t0, t1, t2, t3;
  32. for (i = 0; i < 4; i++) {
  33. t0 = dc[0*4+i] + dc[3*4+i];
  34. t1 = dc[1*4+i] + dc[2*4+i];
  35. t2 = dc[1*4+i] - dc[2*4+i];
  36. t3 = dc[0*4+i] - dc[3*4+i];
  37. dc[0*4+i] = t0 + t1;
  38. dc[1*4+i] = t3 + t2;
  39. dc[2*4+i] = t0 - t1;
  40. dc[3*4+i] = t3 - t2;
  41. }
  42. for (i = 0; i < 4; i++) {
  43. t0 = dc[i*4+0] + dc[i*4+3] + 3; // rounding
  44. t1 = dc[i*4+1] + dc[i*4+2];
  45. t2 = dc[i*4+1] - dc[i*4+2];
  46. t3 = dc[i*4+0] - dc[i*4+3] + 3; // rounding
  47. dc[i*4+0] = 0;
  48. dc[i*4+1] = 0;
  49. dc[i*4+2] = 0;
  50. dc[i*4+3] = 0;
  51. block[i][0][0] = (t0 + t1) >> 3;
  52. block[i][1][0] = (t3 + t2) >> 3;
  53. block[i][2][0] = (t0 - t1) >> 3;
  54. block[i][3][0] = (t3 - t2) >> 3;
  55. }
  56. }
  57. static void vp8_luma_dc_wht_dc_c(DCTELEM block[4][4][16], DCTELEM dc[16])
  58. {
  59. int i, val = (dc[0] + 3) >> 3;
  60. dc[0] = 0;
  61. for (i = 0; i < 4; i++) {
  62. block[i][0][0] = val;
  63. block[i][1][0] = val;
  64. block[i][2][0] = val;
  65. block[i][3][0] = val;
  66. }
  67. }
  68. #define MUL_20091(a) ((((a)*20091) >> 16) + (a))
  69. #define MUL_35468(a) (((a)*35468) >> 16)
  70. static void vp8_idct_add_c(uint8_t *dst, DCTELEM block[16], ptrdiff_t stride)
  71. {
  72. int i, t0, t1, t2, t3;
  73. DCTELEM tmp[16];
  74. for (i = 0; i < 4; i++) {
  75. t0 = block[0*4+i] + block[2*4+i];
  76. t1 = block[0*4+i] - block[2*4+i];
  77. t2 = MUL_35468(block[1*4+i]) - MUL_20091(block[3*4+i]);
  78. t3 = MUL_20091(block[1*4+i]) + MUL_35468(block[3*4+i]);
  79. block[0*4+i] = 0;
  80. block[1*4+i] = 0;
  81. block[2*4+i] = 0;
  82. block[3*4+i] = 0;
  83. tmp[i*4+0] = t0 + t3;
  84. tmp[i*4+1] = t1 + t2;
  85. tmp[i*4+2] = t1 - t2;
  86. tmp[i*4+3] = t0 - t3;
  87. }
  88. for (i = 0; i < 4; i++) {
  89. t0 = tmp[0*4+i] + tmp[2*4+i];
  90. t1 = tmp[0*4+i] - tmp[2*4+i];
  91. t2 = MUL_35468(tmp[1*4+i]) - MUL_20091(tmp[3*4+i]);
  92. t3 = MUL_20091(tmp[1*4+i]) + MUL_35468(tmp[3*4+i]);
  93. dst[0] = av_clip_uint8(dst[0] + ((t0 + t3 + 4) >> 3));
  94. dst[1] = av_clip_uint8(dst[1] + ((t1 + t2 + 4) >> 3));
  95. dst[2] = av_clip_uint8(dst[2] + ((t1 - t2 + 4) >> 3));
  96. dst[3] = av_clip_uint8(dst[3] + ((t0 - t3 + 4) >> 3));
  97. dst += stride;
  98. }
  99. }
  100. static void vp8_idct_dc_add_c(uint8_t *dst, DCTELEM block[16], ptrdiff_t stride)
  101. {
  102. int i, dc = (block[0] + 4) >> 3;
  103. block[0] = 0;
  104. for (i = 0; i < 4; i++) {
  105. dst[0] = av_clip_uint8(dst[0] + dc);
  106. dst[1] = av_clip_uint8(dst[1] + dc);
  107. dst[2] = av_clip_uint8(dst[2] + dc);
  108. dst[3] = av_clip_uint8(dst[3] + dc);
  109. dst += stride;
  110. }
  111. }
  112. static void vp8_idct_dc_add4uv_c(uint8_t *dst, DCTELEM block[4][16], ptrdiff_t stride)
  113. {
  114. vp8_idct_dc_add_c(dst+stride*0+0, block[0], stride);
  115. vp8_idct_dc_add_c(dst+stride*0+4, block[1], stride);
  116. vp8_idct_dc_add_c(dst+stride*4+0, block[2], stride);
  117. vp8_idct_dc_add_c(dst+stride*4+4, block[3], stride);
  118. }
  119. static void vp8_idct_dc_add4y_c(uint8_t *dst, DCTELEM block[4][16], ptrdiff_t stride)
  120. {
  121. vp8_idct_dc_add_c(dst+ 0, block[0], stride);
  122. vp8_idct_dc_add_c(dst+ 4, block[1], stride);
  123. vp8_idct_dc_add_c(dst+ 8, block[2], stride);
  124. vp8_idct_dc_add_c(dst+12, block[3], stride);
  125. }
  126. // because I like only having two parameters to pass functions...
  127. #define LOAD_PIXELS\
  128. int av_unused p3 = p[-4*stride];\
  129. int av_unused p2 = p[-3*stride];\
  130. int av_unused p1 = p[-2*stride];\
  131. int av_unused p0 = p[-1*stride];\
  132. int av_unused q0 = p[ 0*stride];\
  133. int av_unused q1 = p[ 1*stride];\
  134. int av_unused q2 = p[ 2*stride];\
  135. int av_unused q3 = p[ 3*stride];
  136. #define clip_int8(n) (cm[n+0x80]-0x80)
  137. static av_always_inline void filter_common(uint8_t *p, ptrdiff_t stride, int is4tap)
  138. {
  139. LOAD_PIXELS
  140. int a, f1, f2;
  141. uint8_t *cm = ff_cropTbl + MAX_NEG_CROP;
  142. a = 3*(q0 - p0);
  143. if (is4tap)
  144. a += clip_int8(p1 - q1);
  145. a = clip_int8(a);
  146. // We deviate from the spec here with c(a+3) >> 3
  147. // since that's what libvpx does.
  148. f1 = FFMIN(a+4, 127) >> 3;
  149. f2 = FFMIN(a+3, 127) >> 3;
  150. // Despite what the spec says, we do need to clamp here to
  151. // be bitexact with libvpx.
  152. p[-1*stride] = cm[p0 + f2];
  153. p[ 0*stride] = cm[q0 - f1];
  154. // only used for _inner on blocks without high edge variance
  155. if (!is4tap) {
  156. a = (f1+1)>>1;
  157. p[-2*stride] = cm[p1 + a];
  158. p[ 1*stride] = cm[q1 - a];
  159. }
  160. }
  161. static av_always_inline int simple_limit(uint8_t *p, ptrdiff_t stride, int flim)
  162. {
  163. LOAD_PIXELS
  164. return 2*FFABS(p0-q0) + (FFABS(p1-q1) >> 1) <= flim;
  165. }
  166. /**
  167. * E - limit at the macroblock edge
  168. * I - limit for interior difference
  169. */
  170. static av_always_inline int normal_limit(uint8_t *p, ptrdiff_t stride, int E, int I)
  171. {
  172. LOAD_PIXELS
  173. return simple_limit(p, stride, E)
  174. && FFABS(p3-p2) <= I && FFABS(p2-p1) <= I && FFABS(p1-p0) <= I
  175. && FFABS(q3-q2) <= I && FFABS(q2-q1) <= I && FFABS(q1-q0) <= I;
  176. }
  177. // high edge variance
  178. static av_always_inline int hev(uint8_t *p, ptrdiff_t stride, int thresh)
  179. {
  180. LOAD_PIXELS
  181. return FFABS(p1-p0) > thresh || FFABS(q1-q0) > thresh;
  182. }
  183. static av_always_inline void filter_mbedge(uint8_t *p, ptrdiff_t stride)
  184. {
  185. int a0, a1, a2, w;
  186. uint8_t *cm = ff_cropTbl + MAX_NEG_CROP;
  187. LOAD_PIXELS
  188. w = clip_int8(p1-q1);
  189. w = clip_int8(w + 3*(q0-p0));
  190. a0 = (27*w + 63) >> 7;
  191. a1 = (18*w + 63) >> 7;
  192. a2 = ( 9*w + 63) >> 7;
  193. p[-3*stride] = cm[p2 + a2];
  194. p[-2*stride] = cm[p1 + a1];
  195. p[-1*stride] = cm[p0 + a0];
  196. p[ 0*stride] = cm[q0 - a0];
  197. p[ 1*stride] = cm[q1 - a1];
  198. p[ 2*stride] = cm[q2 - a2];
  199. }
  200. #define LOOP_FILTER(dir, size, stridea, strideb, maybe_inline) \
  201. static maybe_inline void vp8_ ## dir ## _loop_filter ## size ## _c(uint8_t *dst, ptrdiff_t stride,\
  202. int flim_E, int flim_I, int hev_thresh)\
  203. {\
  204. int i;\
  205. \
  206. for (i = 0; i < size; i++)\
  207. if (normal_limit(dst+i*stridea, strideb, flim_E, flim_I)) {\
  208. if (hev(dst+i*stridea, strideb, hev_thresh))\
  209. filter_common(dst+i*stridea, strideb, 1);\
  210. else\
  211. filter_mbedge(dst+i*stridea, strideb);\
  212. }\
  213. }\
  214. \
  215. static maybe_inline void vp8_ ## dir ## _loop_filter ## size ## _inner_c(uint8_t *dst, ptrdiff_t stride,\
  216. int flim_E, int flim_I, int hev_thresh)\
  217. {\
  218. int i;\
  219. \
  220. for (i = 0; i < size; i++)\
  221. if (normal_limit(dst+i*stridea, strideb, flim_E, flim_I)) {\
  222. int hv = hev(dst+i*stridea, strideb, hev_thresh);\
  223. if (hv) \
  224. filter_common(dst+i*stridea, strideb, 1);\
  225. else \
  226. filter_common(dst+i*stridea, strideb, 0);\
  227. }\
  228. }
  229. LOOP_FILTER(v, 16, 1, stride,)
  230. LOOP_FILTER(h, 16, stride, 1,)
  231. #define UV_LOOP_FILTER(dir, stridea, strideb) \
  232. LOOP_FILTER(dir, 8, stridea, strideb, av_always_inline) \
  233. static void vp8_ ## dir ## _loop_filter8uv_c(uint8_t *dstU, uint8_t *dstV, ptrdiff_t stride,\
  234. int fE, int fI, int hev_thresh)\
  235. {\
  236. vp8_ ## dir ## _loop_filter8_c(dstU, stride, fE, fI, hev_thresh);\
  237. vp8_ ## dir ## _loop_filter8_c(dstV, stride, fE, fI, hev_thresh);\
  238. }\
  239. static void vp8_ ## dir ## _loop_filter8uv_inner_c(uint8_t *dstU, uint8_t *dstV, ptrdiff_t stride,\
  240. int fE, int fI, int hev_thresh)\
  241. {\
  242. vp8_ ## dir ## _loop_filter8_inner_c(dstU, stride, fE, fI, hev_thresh);\
  243. vp8_ ## dir ## _loop_filter8_inner_c(dstV, stride, fE, fI, hev_thresh);\
  244. }
  245. UV_LOOP_FILTER(v, 1, stride)
  246. UV_LOOP_FILTER(h, stride, 1)
  247. static void vp8_v_loop_filter_simple_c(uint8_t *dst, ptrdiff_t stride, int flim)
  248. {
  249. int i;
  250. for (i = 0; i < 16; i++)
  251. if (simple_limit(dst+i, stride, flim))
  252. filter_common(dst+i, stride, 1);
  253. }
  254. static void vp8_h_loop_filter_simple_c(uint8_t *dst, ptrdiff_t stride, int flim)
  255. {
  256. int i;
  257. for (i = 0; i < 16; i++)
  258. if (simple_limit(dst+i*stride, 1, flim))
  259. filter_common(dst+i*stride, 1, 1);
  260. }
  261. static const uint8_t subpel_filters[7][6] = {
  262. { 0, 6, 123, 12, 1, 0 },
  263. { 2, 11, 108, 36, 8, 1 },
  264. { 0, 9, 93, 50, 6, 0 },
  265. { 3, 16, 77, 77, 16, 3 },
  266. { 0, 6, 50, 93, 9, 0 },
  267. { 1, 8, 36, 108, 11, 2 },
  268. { 0, 1, 12, 123, 6, 0 },
  269. };
  270. #define PUT_PIXELS(WIDTH) \
  271. static void put_vp8_pixels ## WIDTH ##_c(uint8_t *dst, ptrdiff_t dststride, uint8_t *src, ptrdiff_t srcstride, int h, int x, int y) { \
  272. int i; \
  273. for (i = 0; i < h; i++, dst+= dststride, src+= srcstride) { \
  274. memcpy(dst, src, WIDTH); \
  275. } \
  276. }
  277. PUT_PIXELS(16)
  278. PUT_PIXELS(8)
  279. PUT_PIXELS(4)
  280. #define FILTER_6TAP(src, F, stride) \
  281. cm[(F[2]*src[x+0*stride] - F[1]*src[x-1*stride] + F[0]*src[x-2*stride] + \
  282. F[3]*src[x+1*stride] - F[4]*src[x+2*stride] + F[5]*src[x+3*stride] + 64) >> 7]
  283. #define FILTER_4TAP(src, F, stride) \
  284. cm[(F[2]*src[x+0*stride] - F[1]*src[x-1*stride] + \
  285. F[3]*src[x+1*stride] - F[4]*src[x+2*stride] + 64) >> 7]
  286. #define VP8_EPEL_H(SIZE, TAPS) \
  287. static void put_vp8_epel ## SIZE ## _h ## TAPS ## _c(uint8_t *dst, ptrdiff_t dststride, uint8_t *src, ptrdiff_t srcstride, int h, int mx, int my) \
  288. { \
  289. const uint8_t *filter = subpel_filters[mx-1]; \
  290. uint8_t *cm = ff_cropTbl + MAX_NEG_CROP; \
  291. int x, y; \
  292. \
  293. for (y = 0; y < h; y++) { \
  294. for (x = 0; x < SIZE; x++) \
  295. dst[x] = FILTER_ ## TAPS ## TAP(src, filter, 1); \
  296. dst += dststride; \
  297. src += srcstride; \
  298. } \
  299. }
  300. #define VP8_EPEL_V(SIZE, TAPS) \
  301. static void put_vp8_epel ## SIZE ## _v ## TAPS ## _c(uint8_t *dst, ptrdiff_t dststride, uint8_t *src, ptrdiff_t srcstride, int h, int mx, int my) \
  302. { \
  303. const uint8_t *filter = subpel_filters[my-1]; \
  304. uint8_t *cm = ff_cropTbl + MAX_NEG_CROP; \
  305. int x, y; \
  306. \
  307. for (y = 0; y < h; y++) { \
  308. for (x = 0; x < SIZE; x++) \
  309. dst[x] = FILTER_ ## TAPS ## TAP(src, filter, srcstride); \
  310. dst += dststride; \
  311. src += srcstride; \
  312. } \
  313. }
  314. #define VP8_EPEL_HV(SIZE, HTAPS, VTAPS) \
  315. static void put_vp8_epel ## SIZE ## _h ## HTAPS ## v ## VTAPS ## _c(uint8_t *dst, ptrdiff_t dststride, uint8_t *src, ptrdiff_t srcstride, int h, int mx, int my) \
  316. { \
  317. const uint8_t *filter = subpel_filters[mx-1]; \
  318. uint8_t *cm = ff_cropTbl + MAX_NEG_CROP; \
  319. int x, y; \
  320. uint8_t tmp_array[(2*SIZE+VTAPS-1)*SIZE]; \
  321. uint8_t *tmp = tmp_array; \
  322. src -= (2-(VTAPS==4))*srcstride; \
  323. \
  324. for (y = 0; y < h+VTAPS-1; y++) { \
  325. for (x = 0; x < SIZE; x++) \
  326. tmp[x] = FILTER_ ## HTAPS ## TAP(src, filter, 1); \
  327. tmp += SIZE; \
  328. src += srcstride; \
  329. } \
  330. \
  331. tmp = tmp_array + (2-(VTAPS==4))*SIZE; \
  332. filter = subpel_filters[my-1]; \
  333. \
  334. for (y = 0; y < h; y++) { \
  335. for (x = 0; x < SIZE; x++) \
  336. dst[x] = FILTER_ ## VTAPS ## TAP(tmp, filter, SIZE); \
  337. dst += dststride; \
  338. tmp += SIZE; \
  339. } \
  340. }
  341. VP8_EPEL_H(16, 4)
  342. VP8_EPEL_H(8, 4)
  343. VP8_EPEL_H(4, 4)
  344. VP8_EPEL_H(16, 6)
  345. VP8_EPEL_H(8, 6)
  346. VP8_EPEL_H(4, 6)
  347. VP8_EPEL_V(16, 4)
  348. VP8_EPEL_V(8, 4)
  349. VP8_EPEL_V(4, 4)
  350. VP8_EPEL_V(16, 6)
  351. VP8_EPEL_V(8, 6)
  352. VP8_EPEL_V(4, 6)
  353. VP8_EPEL_HV(16, 4, 4)
  354. VP8_EPEL_HV(8, 4, 4)
  355. VP8_EPEL_HV(4, 4, 4)
  356. VP8_EPEL_HV(16, 4, 6)
  357. VP8_EPEL_HV(8, 4, 6)
  358. VP8_EPEL_HV(4, 4, 6)
  359. VP8_EPEL_HV(16, 6, 4)
  360. VP8_EPEL_HV(8, 6, 4)
  361. VP8_EPEL_HV(4, 6, 4)
  362. VP8_EPEL_HV(16, 6, 6)
  363. VP8_EPEL_HV(8, 6, 6)
  364. VP8_EPEL_HV(4, 6, 6)
  365. #define VP8_BILINEAR(SIZE) \
  366. static void put_vp8_bilinear ## SIZE ## _h_c(uint8_t *dst, ptrdiff_t stride, uint8_t *src, ptrdiff_t s2, int h, int mx, int my) \
  367. { \
  368. int a = 8-mx, b = mx; \
  369. int x, y; \
  370. \
  371. for (y = 0; y < h; y++) { \
  372. for (x = 0; x < SIZE; x++) \
  373. dst[x] = (a*src[x] + b*src[x+1] + 4) >> 3; \
  374. dst += stride; \
  375. src += stride; \
  376. } \
  377. } \
  378. static void put_vp8_bilinear ## SIZE ## _v_c(uint8_t *dst, ptrdiff_t stride, uint8_t *src, ptrdiff_t s2, int h, int mx, int my) \
  379. { \
  380. int c = 8-my, d = my; \
  381. int x, y; \
  382. \
  383. for (y = 0; y < h; y++) { \
  384. for (x = 0; x < SIZE; x++) \
  385. dst[x] = (c*src[x] + d*src[x+stride] + 4) >> 3; \
  386. dst += stride; \
  387. src += stride; \
  388. } \
  389. } \
  390. \
  391. static void put_vp8_bilinear ## SIZE ## _hv_c(uint8_t *dst, ptrdiff_t stride, uint8_t *src, ptrdiff_t s2, int h, int mx, int my) \
  392. { \
  393. int a = 8-mx, b = mx; \
  394. int c = 8-my, d = my; \
  395. int x, y; \
  396. uint8_t tmp_array[(2*SIZE+1)*SIZE]; \
  397. uint8_t *tmp = tmp_array; \
  398. \
  399. for (y = 0; y < h+1; y++) { \
  400. for (x = 0; x < SIZE; x++) \
  401. tmp[x] = (a*src[x] + b*src[x+1] + 4) >> 3; \
  402. tmp += SIZE; \
  403. src += stride; \
  404. } \
  405. \
  406. tmp = tmp_array; \
  407. \
  408. for (y = 0; y < h; y++) { \
  409. for (x = 0; x < SIZE; x++) \
  410. dst[x] = (c*tmp[x] + d*tmp[x+SIZE] + 4) >> 3; \
  411. dst += stride; \
  412. tmp += SIZE; \
  413. } \
  414. }
  415. VP8_BILINEAR(16)
  416. VP8_BILINEAR(8)
  417. VP8_BILINEAR(4)
  418. #define VP8_MC_FUNC(IDX, SIZE) \
  419. dsp->put_vp8_epel_pixels_tab[IDX][0][0] = put_vp8_pixels ## SIZE ## _c; \
  420. dsp->put_vp8_epel_pixels_tab[IDX][0][1] = put_vp8_epel ## SIZE ## _h4_c; \
  421. dsp->put_vp8_epel_pixels_tab[IDX][0][2] = put_vp8_epel ## SIZE ## _h6_c; \
  422. dsp->put_vp8_epel_pixels_tab[IDX][1][0] = put_vp8_epel ## SIZE ## _v4_c; \
  423. dsp->put_vp8_epel_pixels_tab[IDX][1][1] = put_vp8_epel ## SIZE ## _h4v4_c; \
  424. dsp->put_vp8_epel_pixels_tab[IDX][1][2] = put_vp8_epel ## SIZE ## _h6v4_c; \
  425. dsp->put_vp8_epel_pixels_tab[IDX][2][0] = put_vp8_epel ## SIZE ## _v6_c; \
  426. dsp->put_vp8_epel_pixels_tab[IDX][2][1] = put_vp8_epel ## SIZE ## _h4v6_c; \
  427. dsp->put_vp8_epel_pixels_tab[IDX][2][2] = put_vp8_epel ## SIZE ## _h6v6_c
  428. #define VP8_BILINEAR_MC_FUNC(IDX, SIZE) \
  429. dsp->put_vp8_bilinear_pixels_tab[IDX][0][0] = put_vp8_pixels ## SIZE ## _c; \
  430. dsp->put_vp8_bilinear_pixels_tab[IDX][0][1] = put_vp8_bilinear ## SIZE ## _h_c; \
  431. dsp->put_vp8_bilinear_pixels_tab[IDX][0][2] = put_vp8_bilinear ## SIZE ## _h_c; \
  432. dsp->put_vp8_bilinear_pixels_tab[IDX][1][0] = put_vp8_bilinear ## SIZE ## _v_c; \
  433. dsp->put_vp8_bilinear_pixels_tab[IDX][1][1] = put_vp8_bilinear ## SIZE ## _hv_c; \
  434. dsp->put_vp8_bilinear_pixels_tab[IDX][1][2] = put_vp8_bilinear ## SIZE ## _hv_c; \
  435. dsp->put_vp8_bilinear_pixels_tab[IDX][2][0] = put_vp8_bilinear ## SIZE ## _v_c; \
  436. dsp->put_vp8_bilinear_pixels_tab[IDX][2][1] = put_vp8_bilinear ## SIZE ## _hv_c; \
  437. dsp->put_vp8_bilinear_pixels_tab[IDX][2][2] = put_vp8_bilinear ## SIZE ## _hv_c
  438. av_cold void ff_vp8dsp_init(VP8DSPContext *dsp)
  439. {
  440. dsp->vp8_luma_dc_wht = vp8_luma_dc_wht_c;
  441. dsp->vp8_luma_dc_wht_dc = vp8_luma_dc_wht_dc_c;
  442. dsp->vp8_idct_add = vp8_idct_add_c;
  443. dsp->vp8_idct_dc_add = vp8_idct_dc_add_c;
  444. dsp->vp8_idct_dc_add4y = vp8_idct_dc_add4y_c;
  445. dsp->vp8_idct_dc_add4uv = vp8_idct_dc_add4uv_c;
  446. dsp->vp8_v_loop_filter16y = vp8_v_loop_filter16_c;
  447. dsp->vp8_h_loop_filter16y = vp8_h_loop_filter16_c;
  448. dsp->vp8_v_loop_filter8uv = vp8_v_loop_filter8uv_c;
  449. dsp->vp8_h_loop_filter8uv = vp8_h_loop_filter8uv_c;
  450. dsp->vp8_v_loop_filter16y_inner = vp8_v_loop_filter16_inner_c;
  451. dsp->vp8_h_loop_filter16y_inner = vp8_h_loop_filter16_inner_c;
  452. dsp->vp8_v_loop_filter8uv_inner = vp8_v_loop_filter8uv_inner_c;
  453. dsp->vp8_h_loop_filter8uv_inner = vp8_h_loop_filter8uv_inner_c;
  454. dsp->vp8_v_loop_filter_simple = vp8_v_loop_filter_simple_c;
  455. dsp->vp8_h_loop_filter_simple = vp8_h_loop_filter_simple_c;
  456. VP8_MC_FUNC(0, 16);
  457. VP8_MC_FUNC(1, 8);
  458. VP8_MC_FUNC(2, 4);
  459. VP8_BILINEAR_MC_FUNC(0, 16);
  460. VP8_BILINEAR_MC_FUNC(1, 8);
  461. VP8_BILINEAR_MC_FUNC(2, 4);
  462. if (HAVE_MMX)
  463. ff_vp8dsp_init_x86(dsp);
  464. if (HAVE_ALTIVEC)
  465. ff_vp8dsp_init_altivec(dsp);
  466. if (ARCH_ARM)
  467. ff_vp8dsp_init_arm(dsp);
  468. }