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.

145 lines
4.2KB

  1. /*
  2. * Sun mediaLib optimized DSP utils
  3. * Copyright (c) 2001 Fabrice Bellard.
  4. *
  5. * This library is free software; you can redistribute it and/or
  6. * modify it under the terms of the GNU Lesser General Public
  7. * License as published by the Free Software Foundation; either
  8. * version 2 of the License, or (at your option) any later version.
  9. *
  10. * This library is distributed in the hope that it will be useful,
  11. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  13. * Lesser General Public License for more details.
  14. *
  15. * You should have received a copy of the GNU Lesser General Public
  16. * License along with this library; if not, write to the Free Software
  17. * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  18. */
  19. #include "../dsputil.h"
  20. #include <mlib_types.h>
  21. #include <mlib_status.h>
  22. #include <mlib_sys.h>
  23. #include <mlib_video.h>
  24. static void put_pixels_mlib (uint8_t * dest, const uint8_t * ref,
  25. int stride, int height)
  26. {
  27. assert(height == 16 || height == 8);
  28. if (height == 16)
  29. mlib_VideoCopyRef_U8_U8_8x16(dest, (uint8_t *)ref, stride);
  30. else
  31. mlib_VideoCopyRef_U8_U8_8x8 (dest, (uint8_t *)ref, stride);
  32. }
  33. static void put_pixels_x2_mlib (uint8_t * dest, const uint8_t * ref,
  34. int stride, int height)
  35. {
  36. assert(height == 16 || height == 8);
  37. if (height == 16)
  38. mlib_VideoInterpX_U8_U8_8x16(dest, (uint8_t *)ref, stride, stride);
  39. else
  40. mlib_VideoInterpX_U8_U8_8x8 (dest, (uint8_t *)ref, stride, stride);
  41. }
  42. static void put_pixels_y2_mlib (uint8_t * dest, const uint8_t * ref,
  43. int stride, int height)
  44. {
  45. assert(height == 16 || height == 8);
  46. if (height == 16)
  47. mlib_VideoInterpY_U8_U8_8x16(dest, (uint8_t *)ref, stride, stride);
  48. else
  49. mlib_VideoInterpY_U8_U8_8x8 (dest, (uint8_t *)ref, stride, stride);
  50. }
  51. static void put_pixels_xy2_mlib(uint8_t * dest, const uint8_t * ref,
  52. int stride, int height)
  53. {
  54. assert(height == 16 || height == 8);
  55. if (height == 16)
  56. mlib_VideoInterpXY_U8_U8_8x16(dest, (uint8_t *)ref, stride, stride);
  57. else
  58. mlib_VideoInterpXY_U8_U8_8x8 (dest, (uint8_t *)ref, stride, stride);
  59. }
  60. static void avg_pixels_mlib (uint8_t * dest, const uint8_t * ref,
  61. int stride, int height)
  62. {
  63. assert(height == 16 || height == 8);
  64. if (height == 16)
  65. mlib_VideoCopyRefAve_U8_U8_8x16(dest, (uint8_t *)ref, stride);
  66. else
  67. mlib_VideoCopyRefAve_U8_U8_8x8 (dest, (uint8_t *)ref, stride);
  68. }
  69. static void avg_pixels_x2_mlib (uint8_t * dest, const uint8_t * ref,
  70. int stride, int height)
  71. {
  72. assert(height == 16 || height == 8);
  73. if (height == 16)
  74. mlib_VideoInterpAveX_U8_U8_8x16(dest, (uint8_t *)ref, stride, stride);
  75. else
  76. mlib_VideoInterpAveX_U8_U8_8x8 (dest, (uint8_t *)ref, stride, stride);
  77. }
  78. static void avg_pixels_y2_mlib (uint8_t * dest, const uint8_t * ref,
  79. int stride, int height)
  80. {
  81. assert(height == 16 || height == 8);
  82. if (height == 16)
  83. mlib_VideoInterpAveY_U8_U8_8x16(dest, (uint8_t *)ref, stride, stride);
  84. else
  85. mlib_VideoInterpAveY_U8_U8_8x8 (dest, (uint8_t *)ref, stride, stride);
  86. }
  87. static void avg_pixels_xy2_mlib (uint8_t * dest, const uint8_t * ref,
  88. int stride, int height)
  89. {
  90. assert(height == 16 || height == 8);
  91. if (height == 16)
  92. mlib_VideoInterpAveXY_U8_U8_8x16(dest, (uint8_t *)ref, stride, stride);
  93. else
  94. mlib_VideoInterpAveXY_U8_U8_8x8 (dest, (uint8_t *)ref, stride, stride);
  95. }
  96. static void add_pixels_clamped_mlib(const DCTELEM *block, UINT8 *pixels, int line_size)
  97. {
  98. mlib_VideoAddBlock_U8_S16(pixels, (mlib_s16 *)block, line_size);
  99. }
  100. void ff_idct_mlib(DCTELEM *data)
  101. {
  102. mlib_VideoIDCT8x8_S16_S16 (data, data);
  103. }
  104. void ff_fdct_mlib(DCTELEM *data)
  105. {
  106. mlib_VideoDCT8x8_S16_S16 (data, data);
  107. }
  108. void dsputil_init_mlib(void)
  109. {
  110. av_fdct = ff_fdct_mlib;
  111. ff_idct = ff_idct_mlib;
  112. put_pixels_tab[0] = put_pixels_mlib;
  113. put_pixels_tab[1] = put_pixels_x2_mlib;
  114. put_pixels_tab[2] = put_pixels_y2_mlib;
  115. put_pixels_tab[3] = put_pixels_xy2_mlib;
  116. avg_pixels_tab[0] = avg_pixels_mlib;
  117. avg_pixels_tab[1] = avg_pixels_x2_mlib;
  118. avg_pixels_tab[2] = avg_pixels_y2_mlib;
  119. avg_pixels_tab[3] = avg_pixels_xy2_mlib;
  120. put_no_rnd_pixels_tab[0] = put_pixels_mlib;
  121. add_pixels_clamped = add_pixels_clamped_mlib;
  122. }