Subversion Repositories Kolibri OS

Rev

Blame | Last modification | View Log | RSS feed

  1. /*
  2.  * Copyright (c) 2015 Manojkumar Bhosale (Manojkumar.Bhosale@imgtec.com)
  3.  *
  4.  * This file is part of FFmpeg.
  5.  *
  6.  * FFmpeg is free software; you can redistribute it and/or
  7.  * modify it under the terms of the GNU Lesser General Public
  8.  * License as published by the Free Software Foundation; either
  9.  * version 2.1 of the License, or (at your option) any later version.
  10.  *
  11.  * FFmpeg is distributed in the hope that it will be useful,
  12.  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13.  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  14.  * Lesser General Public License for more details.
  15.  *
  16.  * You should have received a copy of the GNU Lesser General Public
  17.  * License along with FFmpeg; if not, write to the Free Software
  18.  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  19.  */
  20.  
  21. #ifndef AVCODEC_MIPS_HEVCDSP_MIPS_H
  22. #define AVCODEC_MIPS_HEVCDSP_MIPS_H
  23.  
  24. #include "libavcodec/hevcdsp.h"
  25.  
  26. #define MC(PEL, DIR, WIDTH)                                                 \
  27. void ff_hevc_put_hevc_##PEL##_##DIR##WIDTH##_8_msa(int16_t *dst,            \
  28.                                                      uint8_t *src,          \
  29.                                                      ptrdiff_t src_stride,  \
  30.                                                      int height,            \
  31.                                                      intptr_t mx,           \
  32.                                                      intptr_t my,           \
  33.                                                      int width)
  34.  
  35. MC(pel, pixels, 4);
  36. MC(pel, pixels, 6);
  37. MC(pel, pixels, 8);
  38. MC(pel, pixels, 12);
  39. MC(pel, pixels, 16);
  40. MC(pel, pixels, 24);
  41. MC(pel, pixels, 32);
  42. MC(pel, pixels, 48);
  43. MC(pel, pixels, 64);
  44.  
  45. MC(qpel, h, 4);
  46. MC(qpel, h, 8);
  47. MC(qpel, h, 12);
  48. MC(qpel, h, 16);
  49. MC(qpel, h, 24);
  50. MC(qpel, h, 32);
  51. MC(qpel, h, 48);
  52. MC(qpel, h, 64);
  53.  
  54. MC(qpel, v, 4);
  55. MC(qpel, v, 8);
  56. MC(qpel, v, 12);
  57. MC(qpel, v, 16);
  58. MC(qpel, v, 24);
  59. MC(qpel, v, 32);
  60. MC(qpel, v, 48);
  61. MC(qpel, v, 64);
  62.  
  63. MC(qpel, hv, 4);
  64. MC(qpel, hv, 8);
  65. MC(qpel, hv, 12);
  66. MC(qpel, hv, 16);
  67. MC(qpel, hv, 24);
  68. MC(qpel, hv, 32);
  69. MC(qpel, hv, 48);
  70. MC(qpel, hv, 64);
  71.  
  72. MC(epel, h, 4);
  73. MC(epel, h, 6);
  74. MC(epel, h, 8);
  75. MC(epel, h, 12);
  76. MC(epel, h, 16);
  77. MC(epel, h, 24);
  78. MC(epel, h, 32);
  79. MC(epel, h, 48);
  80. MC(epel, h, 64);
  81.  
  82. MC(epel, v, 4);
  83. MC(epel, v, 6);
  84. MC(epel, v, 8);
  85. MC(epel, v, 12);
  86. MC(epel, v, 16);
  87. MC(epel, v, 24);
  88. MC(epel, v, 32);
  89. MC(epel, v, 48);
  90. MC(epel, v, 64);
  91.  
  92. MC(epel, hv, 4);
  93. MC(epel, hv, 6);
  94. MC(epel, hv, 8);
  95. MC(epel, hv, 12);
  96. MC(epel, hv, 16);
  97. MC(epel, hv, 24);
  98. MC(epel, hv, 32);
  99. MC(epel, hv, 48);
  100. MC(epel, hv, 64);
  101.  
  102. #undef MC
  103.  
  104. #define UNI_MC(PEL, DIR, WIDTH)                                                \
  105. void ff_hevc_put_hevc_uni_##PEL##_##DIR##WIDTH##_8_msa(uint8_t *dst,           \
  106.                                                          ptrdiff_t dst_stride, \
  107.                                                          uint8_t *src,         \
  108.                                                          ptrdiff_t src_stride, \
  109.                                                          int height,           \
  110.                                                          intptr_t mx,          \
  111.                                                          intptr_t my,          \
  112.                                                          int width)
  113.  
  114. UNI_MC(pel, pixels, 4);
  115. UNI_MC(pel, pixels, 6);
  116. UNI_MC(pel, pixels, 8);
  117. UNI_MC(pel, pixels, 12);
  118. UNI_MC(pel, pixels, 16);
  119. UNI_MC(pel, pixels, 24);
  120. UNI_MC(pel, pixels, 32);
  121. UNI_MC(pel, pixels, 48);
  122. UNI_MC(pel, pixels, 64);
  123.  
  124. UNI_MC(qpel, h, 4);
  125. UNI_MC(qpel, h, 8);
  126. UNI_MC(qpel, h, 12);
  127. UNI_MC(qpel, h, 16);
  128. UNI_MC(qpel, h, 24);
  129. UNI_MC(qpel, h, 32);
  130. UNI_MC(qpel, h, 48);
  131. UNI_MC(qpel, h, 64);
  132.  
  133. UNI_MC(qpel, v, 4);
  134. UNI_MC(qpel, v, 8);
  135. UNI_MC(qpel, v, 12);
  136. UNI_MC(qpel, v, 16);
  137. UNI_MC(qpel, v, 24);
  138. UNI_MC(qpel, v, 32);
  139. UNI_MC(qpel, v, 48);
  140. UNI_MC(qpel, v, 64);
  141.  
  142. UNI_MC(qpel, hv, 4);
  143. UNI_MC(qpel, hv, 8);
  144. UNI_MC(qpel, hv, 12);
  145. UNI_MC(qpel, hv, 16);
  146. UNI_MC(qpel, hv, 24);
  147. UNI_MC(qpel, hv, 32);
  148. UNI_MC(qpel, hv, 48);
  149. UNI_MC(qpel, hv, 64);
  150.  
  151. UNI_MC(epel, h, 4);
  152. UNI_MC(epel, h, 6);
  153. UNI_MC(epel, h, 8);
  154. UNI_MC(epel, h, 12);
  155. UNI_MC(epel, h, 16);
  156. UNI_MC(epel, h, 24);
  157. UNI_MC(epel, h, 32);
  158. UNI_MC(epel, h, 48);
  159. UNI_MC(epel, h, 64);
  160.  
  161. UNI_MC(epel, v, 4);
  162. UNI_MC(epel, v, 6);
  163. UNI_MC(epel, v, 8);
  164. UNI_MC(epel, v, 12);
  165. UNI_MC(epel, v, 16);
  166. UNI_MC(epel, v, 24);
  167. UNI_MC(epel, v, 32);
  168. UNI_MC(epel, v, 48);
  169. UNI_MC(epel, v, 64);
  170.  
  171. UNI_MC(epel, hv, 4);
  172. UNI_MC(epel, hv, 6);
  173. UNI_MC(epel, hv, 8);
  174. UNI_MC(epel, hv, 12);
  175. UNI_MC(epel, hv, 16);
  176. UNI_MC(epel, hv, 24);
  177. UNI_MC(epel, hv, 32);
  178. UNI_MC(epel, hv, 48);
  179. UNI_MC(epel, hv, 64);
  180.  
  181. #undef UNI_MC
  182.  
  183. #define UNI_W_MC(PEL, DIR, WIDTH)                                         \
  184. void ff_hevc_put_hevc_uni_w_##PEL##_##DIR##WIDTH##_8_msa(uint8_t *dst,    \
  185.                                                            ptrdiff_t      \
  186.                                                            dst_stride,    \
  187.                                                            uint8_t *src,  \
  188.                                                            ptrdiff_t      \
  189.                                                            src_stride,    \
  190.                                                            int height,    \
  191.                                                            int denom,     \
  192.                                                            int weight,    \
  193.                                                            int offset,    \
  194.                                                            intptr_t mx,   \
  195.                                                            intptr_t my,   \
  196.                                                            int width)
  197.  
  198. UNI_W_MC(pel, pixels, 4);
  199. UNI_W_MC(pel, pixels, 6);
  200. UNI_W_MC(pel, pixels, 8);
  201. UNI_W_MC(pel, pixels, 12);
  202. UNI_W_MC(pel, pixels, 16);
  203. UNI_W_MC(pel, pixels, 24);
  204. UNI_W_MC(pel, pixels, 32);
  205. UNI_W_MC(pel, pixels, 48);
  206. UNI_W_MC(pel, pixels, 64);
  207.  
  208. UNI_W_MC(qpel, h, 4);
  209. UNI_W_MC(qpel, h, 8);
  210. UNI_W_MC(qpel, h, 12);
  211. UNI_W_MC(qpel, h, 16);
  212. UNI_W_MC(qpel, h, 24);
  213. UNI_W_MC(qpel, h, 32);
  214. UNI_W_MC(qpel, h, 48);
  215. UNI_W_MC(qpel, h, 64);
  216.  
  217. UNI_W_MC(qpel, v, 4);
  218. UNI_W_MC(qpel, v, 8);
  219. UNI_W_MC(qpel, v, 12);
  220. UNI_W_MC(qpel, v, 16);
  221. UNI_W_MC(qpel, v, 24);
  222. UNI_W_MC(qpel, v, 32);
  223. UNI_W_MC(qpel, v, 48);
  224. UNI_W_MC(qpel, v, 64);
  225.  
  226. UNI_W_MC(qpel, hv, 4);
  227. UNI_W_MC(qpel, hv, 8);
  228. UNI_W_MC(qpel, hv, 12);
  229. UNI_W_MC(qpel, hv, 16);
  230. UNI_W_MC(qpel, hv, 24);
  231. UNI_W_MC(qpel, hv, 32);
  232. UNI_W_MC(qpel, hv, 48);
  233. UNI_W_MC(qpel, hv, 64);
  234.  
  235. UNI_W_MC(epel, h, 4);
  236. UNI_W_MC(epel, h, 6);
  237. UNI_W_MC(epel, h, 8);
  238. UNI_W_MC(epel, h, 12);
  239. UNI_W_MC(epel, h, 16);
  240. UNI_W_MC(epel, h, 24);
  241. UNI_W_MC(epel, h, 32);
  242. UNI_W_MC(epel, h, 48);
  243. UNI_W_MC(epel, h, 64);
  244.  
  245. UNI_W_MC(epel, v, 4);
  246. UNI_W_MC(epel, v, 6);
  247. UNI_W_MC(epel, v, 8);
  248. UNI_W_MC(epel, v, 12);
  249. UNI_W_MC(epel, v, 16);
  250. UNI_W_MC(epel, v, 24);
  251. UNI_W_MC(epel, v, 32);
  252. UNI_W_MC(epel, v, 48);
  253. UNI_W_MC(epel, v, 64);
  254.  
  255. UNI_W_MC(epel, hv, 4);
  256. UNI_W_MC(epel, hv, 6);
  257. UNI_W_MC(epel, hv, 8);
  258. UNI_W_MC(epel, hv, 12);
  259. UNI_W_MC(epel, hv, 16);
  260. UNI_W_MC(epel, hv, 24);
  261. UNI_W_MC(epel, hv, 32);
  262. UNI_W_MC(epel, hv, 48);
  263. UNI_W_MC(epel, hv, 64);
  264.  
  265. #undef UNI_W_MC
  266.  
  267. #define BI_MC(PEL, DIR, WIDTH)                                                 \
  268. void ff_hevc_put_hevc_bi_##PEL##_##DIR##WIDTH##_8_msa(uint8_t *dst,            \
  269.                                                         ptrdiff_t dst_stride,  \
  270.                                                         uint8_t *src,          \
  271.                                                         ptrdiff_t src_stride,  \
  272.                                                         int16_t *src_16bit,    \
  273.                                                         int height,            \
  274.                                                         intptr_t mx,           \
  275.                                                         intptr_t my,           \
  276.                                                         int width)
  277.  
  278. BI_MC(pel, pixels, 4);
  279. BI_MC(pel, pixels, 6);
  280. BI_MC(pel, pixels, 8);
  281. BI_MC(pel, pixels, 12);
  282. BI_MC(pel, pixels, 16);
  283. BI_MC(pel, pixels, 24);
  284. BI_MC(pel, pixels, 32);
  285. BI_MC(pel, pixels, 48);
  286. BI_MC(pel, pixels, 64);
  287.  
  288. BI_MC(qpel, h, 4);
  289. BI_MC(qpel, h, 8);
  290. BI_MC(qpel, h, 12);
  291. BI_MC(qpel, h, 16);
  292. BI_MC(qpel, h, 24);
  293. BI_MC(qpel, h, 32);
  294. BI_MC(qpel, h, 48);
  295. BI_MC(qpel, h, 64);
  296.  
  297. BI_MC(qpel, v, 4);
  298. BI_MC(qpel, v, 8);
  299. BI_MC(qpel, v, 12);
  300. BI_MC(qpel, v, 16);
  301. BI_MC(qpel, v, 24);
  302. BI_MC(qpel, v, 32);
  303. BI_MC(qpel, v, 48);
  304. BI_MC(qpel, v, 64);
  305.  
  306. BI_MC(qpel, hv, 4);
  307. BI_MC(qpel, hv, 8);
  308. BI_MC(qpel, hv, 12);
  309. BI_MC(qpel, hv, 16);
  310. BI_MC(qpel, hv, 24);
  311. BI_MC(qpel, hv, 32);
  312. BI_MC(qpel, hv, 48);
  313. BI_MC(qpel, hv, 64);
  314.  
  315. BI_MC(epel, h, 4);
  316. BI_MC(epel, h, 6);
  317. BI_MC(epel, h, 8);
  318. BI_MC(epel, h, 12);
  319. BI_MC(epel, h, 16);
  320. BI_MC(epel, h, 24);
  321. BI_MC(epel, h, 32);
  322. BI_MC(epel, h, 48);
  323. BI_MC(epel, h, 64);
  324.  
  325. BI_MC(epel, v, 4);
  326. BI_MC(epel, v, 6);
  327. BI_MC(epel, v, 8);
  328. BI_MC(epel, v, 12);
  329. BI_MC(epel, v, 16);
  330. BI_MC(epel, v, 24);
  331. BI_MC(epel, v, 32);
  332. BI_MC(epel, v, 48);
  333. BI_MC(epel, v, 64);
  334.  
  335. BI_MC(epel, hv, 4);
  336. BI_MC(epel, hv, 6);
  337. BI_MC(epel, hv, 8);
  338. BI_MC(epel, hv, 12);
  339. BI_MC(epel, hv, 16);
  340. BI_MC(epel, hv, 24);
  341. BI_MC(epel, hv, 32);
  342. BI_MC(epel, hv, 48);
  343. BI_MC(epel, hv, 64);
  344.  
  345. #undef BI_MC
  346.  
  347. #define BI_W_MC(PEL, DIR, WIDTH)                                               \
  348. void ff_hevc_put_hevc_bi_w_##PEL##_##DIR##WIDTH##_8_msa(uint8_t *dst,          \
  349.                                                           ptrdiff_t            \
  350.                                                           dst_stride,          \
  351.                                                           uint8_t *src,        \
  352.                                                           ptrdiff_t            \
  353.                                                           src_stride,          \
  354.                                                           int16_t *src_16bit,  \
  355.                                                           int height,          \
  356.                                                           int denom,           \
  357.                                                           int weight0,         \
  358.                                                           int weight1,         \
  359.                                                           int offset0,         \
  360.                                                           int offset1,         \
  361.                                                           intptr_t mx,         \
  362.                                                           intptr_t my,         \
  363.                                                           int width)
  364.  
  365. BI_W_MC(pel, pixels, 4);
  366. BI_W_MC(pel, pixels, 6);
  367. BI_W_MC(pel, pixels, 8);
  368. BI_W_MC(pel, pixels, 12);
  369. BI_W_MC(pel, pixels, 16);
  370. BI_W_MC(pel, pixels, 24);
  371. BI_W_MC(pel, pixels, 32);
  372. BI_W_MC(pel, pixels, 48);
  373. BI_W_MC(pel, pixels, 64);
  374.  
  375. BI_W_MC(qpel, h, 4);
  376. BI_W_MC(qpel, h, 8);
  377. BI_W_MC(qpel, h, 12);
  378. BI_W_MC(qpel, h, 16);
  379. BI_W_MC(qpel, h, 24);
  380. BI_W_MC(qpel, h, 32);
  381. BI_W_MC(qpel, h, 48);
  382. BI_W_MC(qpel, h, 64);
  383.  
  384. BI_W_MC(qpel, v, 4);
  385. BI_W_MC(qpel, v, 8);
  386. BI_W_MC(qpel, v, 12);
  387. BI_W_MC(qpel, v, 16);
  388. BI_W_MC(qpel, v, 24);
  389. BI_W_MC(qpel, v, 32);
  390. BI_W_MC(qpel, v, 48);
  391. BI_W_MC(qpel, v, 64);
  392.  
  393. BI_W_MC(qpel, hv, 4);
  394. BI_W_MC(qpel, hv, 8);
  395. BI_W_MC(qpel, hv, 12);
  396. BI_W_MC(qpel, hv, 16);
  397. BI_W_MC(qpel, hv, 24);
  398. BI_W_MC(qpel, hv, 32);
  399. BI_W_MC(qpel, hv, 48);
  400. BI_W_MC(qpel, hv, 64);
  401.  
  402. BI_W_MC(epel, h, 4);
  403. BI_W_MC(epel, h, 6);
  404. BI_W_MC(epel, h, 8);
  405. BI_W_MC(epel, h, 12);
  406. BI_W_MC(epel, h, 16);
  407. BI_W_MC(epel, h, 24);
  408. BI_W_MC(epel, h, 32);
  409. BI_W_MC(epel, h, 48);
  410. BI_W_MC(epel, h, 64);
  411.  
  412. BI_W_MC(epel, v, 4);
  413. BI_W_MC(epel, v, 6);
  414. BI_W_MC(epel, v, 8);
  415. BI_W_MC(epel, v, 12);
  416. BI_W_MC(epel, v, 16);
  417. BI_W_MC(epel, v, 24);
  418. BI_W_MC(epel, v, 32);
  419. BI_W_MC(epel, v, 48);
  420. BI_W_MC(epel, v, 64);
  421.  
  422. BI_W_MC(epel, hv, 4);
  423. BI_W_MC(epel, hv, 6);
  424. BI_W_MC(epel, hv, 8);
  425. BI_W_MC(epel, hv, 12);
  426. BI_W_MC(epel, hv, 16);
  427. BI_W_MC(epel, hv, 24);
  428. BI_W_MC(epel, hv, 32);
  429. BI_W_MC(epel, hv, 48);
  430. BI_W_MC(epel, hv, 64);
  431.  
  432. #undef BI_W_MC
  433.  
  434. void ff_hevc_loop_filter_luma_h_8_msa(uint8_t *src,
  435.                                       ptrdiff_t src_stride,
  436.                                       int32_t beta, int32_t *tc,
  437.                                       uint8_t *no_p, uint8_t *no_q);
  438.  
  439. void ff_hevc_loop_filter_luma_v_8_msa(uint8_t *src,
  440.                                       ptrdiff_t src_stride,
  441.                                       int32_t beta, int32_t *tc,
  442.                                       uint8_t *no_p, uint8_t *no_q);
  443.  
  444. void ff_hevc_loop_filter_chroma_h_8_msa(uint8_t *src,
  445.                                         ptrdiff_t src_stride,
  446.                                         int32_t *tc, uint8_t *no_p,
  447.                                         uint8_t *no_q);
  448.  
  449. void ff_hevc_loop_filter_chroma_v_8_msa(uint8_t *src,
  450.                                         ptrdiff_t src_stride,
  451.                                         int32_t *tc, uint8_t *no_p,
  452.                                         uint8_t *no_q);
  453.  
  454. void ff_hevc_sao_band_filter_0_8_msa(uint8_t *dst, uint8_t *src,
  455.                                      ptrdiff_t stride_dst, ptrdiff_t stride_src,
  456.                                      int16_t *sao_offset_val, int sao_left_class,
  457.                                      int width, int height);
  458.  
  459. void ff_hevc_sao_edge_filter_8_msa(uint8_t *dst, uint8_t *src,
  460.                                    ptrdiff_t stride_dst,
  461.                                    int16_t *sao_offset_val,
  462.                                    int eo, int width, int height);
  463.  
  464. void ff_hevc_idct_4x4_msa(int16_t *coeffs, int col_limit);
  465. void ff_hevc_idct_8x8_msa(int16_t *coeffs, int col_limit);
  466. void ff_hevc_idct_16x16_msa(int16_t *coeffs, int col_limit);
  467. void ff_hevc_idct_32x32_msa(int16_t *coeffs, int col_limit);
  468. void ff_hevc_idct_dc_4x4_msa(int16_t *coeffs);
  469. void ff_hevc_idct_dc_8x8_msa(int16_t *coeffs);
  470. void ff_hevc_idct_dc_16x16_msa(int16_t *coeffs);
  471. void ff_hevc_idct_dc_32x32_msa(int16_t *coeffs);
  472. void ff_hevc_addblk_4x4_msa(uint8_t *dst, int16_t *pi16Coeffs,
  473.                             ptrdiff_t stride);
  474. void ff_hevc_addblk_8x8_msa(uint8_t *dst, int16_t *pi16Coeffs,
  475.                             ptrdiff_t stride);
  476. void ff_hevc_addblk_16x16_msa(uint8_t *dst, int16_t *pi16Coeffs,
  477.                               ptrdiff_t stride);
  478. void ff_hevc_addblk_32x32_msa(uint8_t *dst, int16_t *pi16Coeffs,
  479.                               ptrdiff_t stride);
  480. void ff_hevc_idct_luma_4x4_msa(int16_t *pi16Coeffs);
  481.  
  482. #endif  // #ifndef AVCODEC_MIPS_HEVCDSP_MIPS_H
  483.