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.

569 lines
26KB

  1. /*
  2. * Copyright (C) 2010 David Conrad
  3. * Copyright (C) 2010 Ronald S. Bultje
  4. *
  5. * This file is part of Libav.
  6. *
  7. * Libav 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. * Libav 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 Libav; 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 "libavutil/common.h"
  26. #include "mathops.h"
  27. #include "vp8dsp.h"
  28. // TODO: Maybe add dequant
  29. static void vp8_luma_dc_wht_c(int16_t block[4][4][16], int16_t 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(int16_t block[4][4][16], int16_t 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, int16_t block[16], ptrdiff_t stride)
  71. {
  72. int i, t0, t1, t2, t3;
  73. int16_t 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, int16_t 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, int16_t block[4][16],
  113. ptrdiff_t stride)
  114. {
  115. vp8_idct_dc_add_c(dst + stride * 0 + 0, block[0], stride);
  116. vp8_idct_dc_add_c(dst + stride * 0 + 4, block[1], stride);
  117. vp8_idct_dc_add_c(dst + stride * 4 + 0, block[2], stride);
  118. vp8_idct_dc_add_c(dst + stride * 4 + 4, block[3], stride);
  119. }
  120. static void vp8_idct_dc_add4y_c(uint8_t *dst, int16_t block[4][16],
  121. ptrdiff_t stride)
  122. {
  123. vp8_idct_dc_add_c(dst + 0, block[0], stride);
  124. vp8_idct_dc_add_c(dst + 4, block[1], stride);
  125. vp8_idct_dc_add_c(dst + 8, block[2], stride);
  126. vp8_idct_dc_add_c(dst + 12, block[3], stride);
  127. }
  128. // because I like only having two parameters to pass functions...
  129. #define LOAD_PIXELS \
  130. int av_unused p3 = p[-4 * stride]; \
  131. int av_unused p2 = p[-3 * stride]; \
  132. int av_unused p1 = p[-2 * stride]; \
  133. int av_unused p0 = p[-1 * stride]; \
  134. int av_unused q0 = p[ 0 * stride]; \
  135. int av_unused q1 = p[ 1 * stride]; \
  136. int av_unused q2 = p[ 2 * stride]; \
  137. int av_unused q3 = p[ 3 * stride];
  138. #define clip_int8(n) (cm[n + 0x80] - 0x80)
  139. static av_always_inline void filter_common(uint8_t *p, ptrdiff_t stride,
  140. int is4tap)
  141. {
  142. LOAD_PIXELS
  143. int a, f1, f2;
  144. const uint8_t *cm = ff_crop_tab + MAX_NEG_CROP;
  145. a = 3 * (q0 - p0);
  146. if (is4tap)
  147. a += clip_int8(p1 - q1);
  148. a = clip_int8(a);
  149. // We deviate from the spec here with c(a+3) >> 3
  150. // since that's what libvpx does.
  151. f1 = FFMIN(a + 4, 127) >> 3;
  152. f2 = FFMIN(a + 3, 127) >> 3;
  153. // Despite what the spec says, we do need to clamp here to
  154. // be bitexact with libvpx.
  155. p[-1 * stride] = cm[p0 + f2];
  156. p[ 0 * stride] = cm[q0 - f1];
  157. // only used for _inner on blocks without high edge variance
  158. if (!is4tap) {
  159. a = (f1 + 1) >> 1;
  160. p[-2 * stride] = cm[p1 + a];
  161. p[ 1 * stride] = cm[q1 - a];
  162. }
  163. }
  164. static av_always_inline int simple_limit(uint8_t *p, ptrdiff_t stride, int flim)
  165. {
  166. LOAD_PIXELS
  167. return 2 * FFABS(p0 - q0) + (FFABS(p1 - q1) >> 1) <= flim;
  168. }
  169. /**
  170. * E - limit at the macroblock edge
  171. * I - limit for interior difference
  172. */
  173. static av_always_inline int normal_limit(uint8_t *p, ptrdiff_t stride,
  174. int E, int I)
  175. {
  176. LOAD_PIXELS
  177. return simple_limit(p, stride, E) &&
  178. FFABS(p3 - p2) <= I &&
  179. FFABS(p2 - p1) <= I &&
  180. FFABS(p1 - p0) <= I &&
  181. FFABS(q3 - q2) <= I &&
  182. FFABS(q2 - q1) <= I &&
  183. FFABS(q1 - q0) <= I;
  184. }
  185. // high edge variance
  186. static av_always_inline int hev(uint8_t *p, ptrdiff_t stride, int thresh)
  187. {
  188. LOAD_PIXELS
  189. return FFABS(p1 - p0) > thresh || FFABS(q1 - q0) > thresh;
  190. }
  191. static av_always_inline void filter_mbedge(uint8_t *p, ptrdiff_t stride)
  192. {
  193. int a0, a1, a2, w;
  194. const uint8_t *cm = ff_crop_tab + MAX_NEG_CROP;
  195. LOAD_PIXELS
  196. w = clip_int8(p1 - q1);
  197. w = clip_int8(w + 3 * (q0 - p0));
  198. a0 = (27 * w + 63) >> 7;
  199. a1 = (18 * w + 63) >> 7;
  200. a2 = (9 * w + 63) >> 7;
  201. p[-3 * stride] = cm[p2 + a2];
  202. p[-2 * stride] = cm[p1 + a1];
  203. p[-1 * stride] = cm[p0 + a0];
  204. p[ 0 * stride] = cm[q0 - a0];
  205. p[ 1 * stride] = cm[q1 - a1];
  206. p[ 2 * stride] = cm[q2 - a2];
  207. }
  208. #define LOOP_FILTER(dir, size, stridea, strideb, maybe_inline) \
  209. static maybe_inline \
  210. void vp8_ ## dir ## _loop_filter ## size ## _c(uint8_t *dst, \
  211. ptrdiff_t stride, \
  212. int flim_E, int flim_I, \
  213. int hev_thresh) \
  214. { \
  215. int i; \
  216. for (i = 0; i < size; i++) \
  217. if (normal_limit(dst + i * stridea, strideb, flim_E, flim_I)) { \
  218. if (hev(dst + i * stridea, strideb, hev_thresh)) \
  219. filter_common(dst + i * stridea, strideb, 1); \
  220. else \
  221. filter_mbedge(dst + i * stridea, strideb); \
  222. } \
  223. } \
  224. \
  225. static maybe_inline \
  226. void vp8_ ## dir ## _loop_filter ## size ## _inner_c(uint8_t *dst, \
  227. ptrdiff_t stride, \
  228. int flim_E, int flim_I, \
  229. int hev_thresh) \
  230. { \
  231. int i; \
  232. for (i = 0; i < size; i++) \
  233. if (normal_limit(dst + i * stridea, strideb, flim_E, flim_I)) { \
  234. int hv = hev(dst + i * stridea, strideb, hev_thresh); \
  235. if (hv) \
  236. filter_common(dst + i * stridea, strideb, 1); \
  237. else \
  238. filter_common(dst + i * stridea, strideb, 0); \
  239. } \
  240. }
  241. LOOP_FILTER(v, 16, 1, stride, )
  242. LOOP_FILTER(h, 16, stride, 1, )
  243. #define UV_LOOP_FILTER(dir, stridea, strideb) \
  244. LOOP_FILTER(dir, 8, stridea, strideb, av_always_inline) \
  245. static void vp8_ ## dir ## _loop_filter8uv_c(uint8_t *dstU, uint8_t *dstV, \
  246. ptrdiff_t stride, int fE, \
  247. int fI, int hev_thresh) \
  248. { \
  249. vp8_ ## dir ## _loop_filter8_c(dstU, stride, fE, fI, hev_thresh); \
  250. vp8_ ## dir ## _loop_filter8_c(dstV, stride, fE, fI, hev_thresh); \
  251. } \
  252. \
  253. static void vp8_ ## dir ## _loop_filter8uv_inner_c(uint8_t *dstU, \
  254. uint8_t *dstV, \
  255. ptrdiff_t stride, int fE, \
  256. int fI, int hev_thresh) \
  257. { \
  258. vp8_ ## dir ## _loop_filter8_inner_c(dstU, stride, fE, fI, hev_thresh); \
  259. vp8_ ## dir ## _loop_filter8_inner_c(dstV, stride, fE, fI, hev_thresh); \
  260. }
  261. UV_LOOP_FILTER(v, 1, stride)
  262. UV_LOOP_FILTER(h, stride, 1)
  263. static void vp8_v_loop_filter_simple_c(uint8_t *dst, ptrdiff_t stride, int flim)
  264. {
  265. int i;
  266. for (i = 0; i < 16; i++)
  267. if (simple_limit(dst + i, stride, flim))
  268. filter_common(dst + i, stride, 1);
  269. }
  270. static void vp8_h_loop_filter_simple_c(uint8_t *dst, ptrdiff_t stride, int flim)
  271. {
  272. int i;
  273. for (i = 0; i < 16; i++)
  274. if (simple_limit(dst + i * stride, 1, flim))
  275. filter_common(dst + i * stride, 1, 1);
  276. }
  277. static const uint8_t subpel_filters[7][6] = {
  278. { 0, 6, 123, 12, 1, 0 },
  279. { 2, 11, 108, 36, 8, 1 },
  280. { 0, 9, 93, 50, 6, 0 },
  281. { 3, 16, 77, 77, 16, 3 },
  282. { 0, 6, 50, 93, 9, 0 },
  283. { 1, 8, 36, 108, 11, 2 },
  284. { 0, 1, 12, 123, 6, 0 },
  285. };
  286. #define PUT_PIXELS(WIDTH) \
  287. static void put_vp8_pixels ## WIDTH ## _c(uint8_t *dst, ptrdiff_t dststride, \
  288. uint8_t *src, ptrdiff_t srcstride, \
  289. int h, int x, int y) \
  290. { \
  291. int i; \
  292. for (i = 0; i < h; i++, dst += dststride, src += srcstride) \
  293. memcpy(dst, src, WIDTH); \
  294. }
  295. PUT_PIXELS(16)
  296. PUT_PIXELS(8)
  297. PUT_PIXELS(4)
  298. #define FILTER_6TAP(src, F, stride) \
  299. cm[(F[2] * src[x + 0 * stride] - F[1] * src[x - 1 * stride] + \
  300. F[0] * src[x - 2 * stride] + F[3] * src[x + 1 * stride] - \
  301. F[4] * src[x + 2 * stride] + F[5] * src[x + 3 * stride] + 64) >> 7]
  302. #define FILTER_4TAP(src, F, stride) \
  303. cm[(F[2] * src[x + 0 * stride] - F[1] * src[x - 1 * stride] + \
  304. F[3] * src[x + 1 * stride] - F[4] * src[x + 2 * stride] + 64) >> 7]
  305. #define VP8_EPEL_H(SIZE, TAPS) \
  306. static void put_vp8_epel ## SIZE ## _h ## TAPS ## _c(uint8_t *dst, \
  307. ptrdiff_t dststride, \
  308. uint8_t *src, \
  309. ptrdiff_t srcstride, \
  310. int h, int mx, int my) \
  311. { \
  312. const uint8_t *filter = subpel_filters[mx - 1]; \
  313. const uint8_t *cm = ff_crop_tab + MAX_NEG_CROP; \
  314. int x, y; \
  315. for (y = 0; y < h; y++) { \
  316. for (x = 0; x < SIZE; x++) \
  317. dst[x] = FILTER_ ## TAPS ## TAP(src, filter, 1); \
  318. dst += dststride; \
  319. src += srcstride; \
  320. } \
  321. }
  322. #define VP8_EPEL_V(SIZE, TAPS) \
  323. static void put_vp8_epel ## SIZE ## _v ## TAPS ## _c(uint8_t *dst, \
  324. ptrdiff_t dststride, \
  325. uint8_t *src, \
  326. ptrdiff_t srcstride, \
  327. int h, int mx, int my) \
  328. { \
  329. const uint8_t *filter = subpel_filters[my - 1]; \
  330. const uint8_t *cm = ff_crop_tab + MAX_NEG_CROP; \
  331. int x, y; \
  332. for (y = 0; y < h; y++) { \
  333. for (x = 0; x < SIZE; x++) \
  334. dst[x] = FILTER_ ## TAPS ## TAP(src, filter, srcstride); \
  335. dst += dststride; \
  336. src += srcstride; \
  337. } \
  338. }
  339. #define VP8_EPEL_HV(SIZE, HTAPS, VTAPS) \
  340. static void \
  341. put_vp8_epel ## SIZE ## _h ## HTAPS ## v ## VTAPS ## _c(uint8_t *dst, \
  342. ptrdiff_t dststride, \
  343. uint8_t *src, \
  344. ptrdiff_t srcstride, \
  345. int h, int mx, \
  346. int my) \
  347. { \
  348. const uint8_t *filter = subpel_filters[mx - 1]; \
  349. const uint8_t *cm = ff_crop_tab + MAX_NEG_CROP; \
  350. int x, y; \
  351. uint8_t tmp_array[(2 * SIZE + VTAPS - 1) * SIZE]; \
  352. uint8_t *tmp = tmp_array; \
  353. src -= (2 - (VTAPS == 4)) * srcstride; \
  354. \
  355. for (y = 0; y < h + VTAPS - 1; y++) { \
  356. for (x = 0; x < SIZE; x++) \
  357. tmp[x] = FILTER_ ## HTAPS ## TAP(src, filter, 1); \
  358. tmp += SIZE; \
  359. src += srcstride; \
  360. } \
  361. tmp = tmp_array + (2 - (VTAPS == 4)) * SIZE; \
  362. filter = subpel_filters[my - 1]; \
  363. \
  364. for (y = 0; y < h; y++) { \
  365. for (x = 0; x < SIZE; x++) \
  366. dst[x] = FILTER_ ## VTAPS ## TAP(tmp, filter, SIZE); \
  367. dst += dststride; \
  368. tmp += SIZE; \
  369. } \
  370. }
  371. VP8_EPEL_H(16, 4)
  372. VP8_EPEL_H(8, 4)
  373. VP8_EPEL_H(4, 4)
  374. VP8_EPEL_H(16, 6)
  375. VP8_EPEL_H(8, 6)
  376. VP8_EPEL_H(4, 6)
  377. VP8_EPEL_V(16, 4)
  378. VP8_EPEL_V(8, 4)
  379. VP8_EPEL_V(4, 4)
  380. VP8_EPEL_V(16, 6)
  381. VP8_EPEL_V(8, 6)
  382. VP8_EPEL_V(4, 6)
  383. VP8_EPEL_HV(16, 4, 4)
  384. VP8_EPEL_HV(8, 4, 4)
  385. VP8_EPEL_HV(4, 4, 4)
  386. VP8_EPEL_HV(16, 4, 6)
  387. VP8_EPEL_HV(8, 4, 6)
  388. VP8_EPEL_HV(4, 4, 6)
  389. VP8_EPEL_HV(16, 6, 4)
  390. VP8_EPEL_HV(8, 6, 4)
  391. VP8_EPEL_HV(4, 6, 4)
  392. VP8_EPEL_HV(16, 6, 6)
  393. VP8_EPEL_HV(8, 6, 6)
  394. VP8_EPEL_HV(4, 6, 6)
  395. #define VP8_BILINEAR(SIZE) \
  396. static void put_vp8_bilinear ## SIZE ## _h_c(uint8_t *dst, ptrdiff_t dstride, \
  397. uint8_t *src, ptrdiff_t sstride, \
  398. int h, int mx, int my) \
  399. { \
  400. int a = 8 - mx, b = mx; \
  401. int x, y; \
  402. for (y = 0; y < h; y++) { \
  403. for (x = 0; x < SIZE; x++) \
  404. dst[x] = (a * src[x] + b * src[x + 1] + 4) >> 3; \
  405. dst += dstride; \
  406. src += sstride; \
  407. } \
  408. } \
  409. \
  410. static void put_vp8_bilinear ## SIZE ## _v_c(uint8_t *dst, ptrdiff_t dstride, \
  411. uint8_t *src, ptrdiff_t sstride, \
  412. int h, int mx, int my) \
  413. { \
  414. int c = 8 - my, d = my; \
  415. int x, y; \
  416. for (y = 0; y < h; y++) { \
  417. for (x = 0; x < SIZE; x++) \
  418. dst[x] = (c * src[x] + d * src[x + sstride] + 4) >> 3; \
  419. dst += dstride; \
  420. src += sstride; \
  421. } \
  422. } \
  423. \
  424. static void put_vp8_bilinear ## SIZE ## _hv_c(uint8_t *dst, \
  425. ptrdiff_t dstride, \
  426. uint8_t *src, \
  427. ptrdiff_t sstride, \
  428. int h, int mx, int my) \
  429. { \
  430. int a = 8 - mx, b = mx; \
  431. int c = 8 - my, d = my; \
  432. int x, y; \
  433. uint8_t tmp_array[(2 * SIZE + 1) * SIZE]; \
  434. uint8_t *tmp = tmp_array; \
  435. for (y = 0; y < h + 1; y++) { \
  436. for (x = 0; x < SIZE; x++) \
  437. tmp[x] = (a * src[x] + b * src[x + 1] + 4) >> 3; \
  438. tmp += SIZE; \
  439. src += sstride; \
  440. } \
  441. tmp = tmp_array; \
  442. for (y = 0; y < h; y++) { \
  443. for (x = 0; x < SIZE; x++) \
  444. dst[x] = (c * tmp[x] + d * tmp[x + SIZE] + 4) >> 3; \
  445. dst += dstride; \
  446. tmp += SIZE; \
  447. } \
  448. }
  449. VP8_BILINEAR(16)
  450. VP8_BILINEAR(8)
  451. VP8_BILINEAR(4)
  452. #define VP8_MC_FUNC(IDX, SIZE) \
  453. dsp->put_vp8_epel_pixels_tab[IDX][0][0] = put_vp8_pixels ## SIZE ## _c; \
  454. dsp->put_vp8_epel_pixels_tab[IDX][0][1] = put_vp8_epel ## SIZE ## _h4_c; \
  455. dsp->put_vp8_epel_pixels_tab[IDX][0][2] = put_vp8_epel ## SIZE ## _h6_c; \
  456. dsp->put_vp8_epel_pixels_tab[IDX][1][0] = put_vp8_epel ## SIZE ## _v4_c; \
  457. dsp->put_vp8_epel_pixels_tab[IDX][1][1] = put_vp8_epel ## SIZE ## _h4v4_c; \
  458. dsp->put_vp8_epel_pixels_tab[IDX][1][2] = put_vp8_epel ## SIZE ## _h6v4_c; \
  459. dsp->put_vp8_epel_pixels_tab[IDX][2][0] = put_vp8_epel ## SIZE ## _v6_c; \
  460. dsp->put_vp8_epel_pixels_tab[IDX][2][1] = put_vp8_epel ## SIZE ## _h4v6_c; \
  461. dsp->put_vp8_epel_pixels_tab[IDX][2][2] = put_vp8_epel ## SIZE ## _h6v6_c
  462. #define VP8_BILINEAR_MC_FUNC(IDX, SIZE) \
  463. dsp->put_vp8_bilinear_pixels_tab[IDX][0][0] = put_vp8_pixels ## SIZE ## _c; \
  464. dsp->put_vp8_bilinear_pixels_tab[IDX][0][1] = put_vp8_bilinear ## SIZE ## _h_c; \
  465. dsp->put_vp8_bilinear_pixels_tab[IDX][0][2] = put_vp8_bilinear ## SIZE ## _h_c; \
  466. dsp->put_vp8_bilinear_pixels_tab[IDX][1][0] = put_vp8_bilinear ## SIZE ## _v_c; \
  467. dsp->put_vp8_bilinear_pixels_tab[IDX][1][1] = put_vp8_bilinear ## SIZE ## _hv_c; \
  468. dsp->put_vp8_bilinear_pixels_tab[IDX][1][2] = put_vp8_bilinear ## SIZE ## _hv_c; \
  469. dsp->put_vp8_bilinear_pixels_tab[IDX][2][0] = put_vp8_bilinear ## SIZE ## _v_c; \
  470. dsp->put_vp8_bilinear_pixels_tab[IDX][2][1] = put_vp8_bilinear ## SIZE ## _hv_c; \
  471. dsp->put_vp8_bilinear_pixels_tab[IDX][2][2] = put_vp8_bilinear ## SIZE ## _hv_c
  472. av_cold void ff_vp8dsp_init(VP8DSPContext *dsp)
  473. {
  474. dsp->vp8_luma_dc_wht = vp8_luma_dc_wht_c;
  475. dsp->vp8_luma_dc_wht_dc = vp8_luma_dc_wht_dc_c;
  476. dsp->vp8_idct_add = vp8_idct_add_c;
  477. dsp->vp8_idct_dc_add = vp8_idct_dc_add_c;
  478. dsp->vp8_idct_dc_add4y = vp8_idct_dc_add4y_c;
  479. dsp->vp8_idct_dc_add4uv = vp8_idct_dc_add4uv_c;
  480. dsp->vp8_v_loop_filter16y = vp8_v_loop_filter16_c;
  481. dsp->vp8_h_loop_filter16y = vp8_h_loop_filter16_c;
  482. dsp->vp8_v_loop_filter8uv = vp8_v_loop_filter8uv_c;
  483. dsp->vp8_h_loop_filter8uv = vp8_h_loop_filter8uv_c;
  484. dsp->vp8_v_loop_filter16y_inner = vp8_v_loop_filter16_inner_c;
  485. dsp->vp8_h_loop_filter16y_inner = vp8_h_loop_filter16_inner_c;
  486. dsp->vp8_v_loop_filter8uv_inner = vp8_v_loop_filter8uv_inner_c;
  487. dsp->vp8_h_loop_filter8uv_inner = vp8_h_loop_filter8uv_inner_c;
  488. dsp->vp8_v_loop_filter_simple = vp8_v_loop_filter_simple_c;
  489. dsp->vp8_h_loop_filter_simple = vp8_h_loop_filter_simple_c;
  490. VP8_MC_FUNC(0, 16);
  491. VP8_MC_FUNC(1, 8);
  492. VP8_MC_FUNC(2, 4);
  493. VP8_BILINEAR_MC_FUNC(0, 16);
  494. VP8_BILINEAR_MC_FUNC(1, 8);
  495. VP8_BILINEAR_MC_FUNC(2, 4);
  496. if (ARCH_ARM)
  497. ff_vp8dsp_init_arm(dsp);
  498. if (ARCH_PPC)
  499. ff_vp8dsp_init_ppc(dsp);
  500. if (ARCH_X86)
  501. ff_vp8dsp_init_x86(dsp);
  502. }