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.

116 lines
2.6KB

  1. /*
  2. * MMI optimized DSP utils
  3. * Copyright (c) 2000, 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. * MMI optimization by Leon van Stuivenberg <leonvs@iae.nl>
  20. */
  21. #include "../dsputil.h"
  22. void ff_mmi_idct(DCTELEM * block);
  23. #include "mmi.h"
  24. static void clear_blocks_mmi(DCTELEM * blocks)
  25. {
  26. /* $4 = blocks */
  27. int i;
  28. for (i = 0; i < 6; i++) {
  29. sq($0, 0, $4);
  30. sq($0, 16, $4);
  31. sq($0, 32, $4);
  32. sq($0, 48, $4);
  33. sq($0, 64, $4);
  34. sq($0, 80, $4);
  35. sq($0, 96, $4);
  36. sq($0, 112, $4);
  37. __asm__ __volatile__("addi $4, $4, 128");
  38. }
  39. }
  40. static void put_pixels_clamped_mmi(const DCTELEM * block, UINT8 * pixels,
  41. int line_size)
  42. {
  43. /* $4 = block, $5 = pixels, $6 = line_size */
  44. __asm__ __volatile__("li $11, 255":::"$11");
  45. lq($4, 0, $12);
  46. pcpyld($11, $11, $11);
  47. pcpyh($11, $11);
  48. #define PUT(rs) \
  49. ppacb($0, $##rs, $##rs); \
  50. sd3(rs, 0, 5); \
  51. __asm__ __volatile__ ("add $5, $5, $6");
  52. pminh($12, $11, $12);
  53. pmaxh($12, $0, $12);
  54. lq($4, 16, $13);
  55. PUT(12);
  56. pminh($13, $11, $13);
  57. pmaxh($13, $0, $13);
  58. lq($4, 32, $12);
  59. PUT(13);
  60. pminh($12, $11, $12);
  61. pmaxh($12, $0, $12);
  62. lq($4, 48, $13);
  63. PUT(12);
  64. pminh($13, $11, $13);
  65. pmaxh($13, $0, $13);
  66. lq($4, 64, $12);
  67. PUT(13);
  68. pminh($12, $11, $12);
  69. pmaxh($12, $0, $12);
  70. lq($4, 80, $13);
  71. PUT(12);
  72. pminh($13, $11, $13);
  73. pmaxh($13, $0, $13);
  74. lq($4, 96, $12);
  75. PUT(13);
  76. pminh($12, $11, $12);
  77. pmaxh($12, $0, $12);
  78. lq($4, 112, $13);
  79. PUT(12);
  80. pminh($13, $11, $13);
  81. pmaxh($13, $0, $13);
  82. PUT(13);
  83. }
  84. /* todo
  85. static void add_pixels_clamped_mmi(const DCTELEM * block, UINT8 * pixels,
  86. int line_size)
  87. {
  88. }
  89. */
  90. void dsputil_init_mmi(void)
  91. {
  92. put_pixels_clamped = put_pixels_clamped_mmi;
  93. //add_pixels_clamped = add_pixels_clamped_mmi;
  94. clear_blocks = clear_blocks_mmi;
  95. ff_idct = ff_mmi_idct;
  96. }