rv40dsp_init_arm.c 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150
  1. /*
  2. * Copyright (c) 2011 Janne Grunau <janne-libav@jannau.net>
  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. #include <stdint.h>
  21. #include "libavutil/attributes.h"
  22. #include "libavcodec/avcodec.h"
  23. #include "libavcodec/rv34dsp.h"
  24. #include "libavutil/arm/cpu.h"
  25. #define DECL_QPEL3(type, w, pos) \
  26. void ff_ ## type ## _rv40_qpel ## w ## _mc ## pos ## _neon(uint8_t *dst, \
  27. const uint8_t *src, \
  28. ptrdiff_t stride)
  29. #define DECL_QPEL2(w, pos) \
  30. DECL_QPEL3(put, w, pos); \
  31. DECL_QPEL3(avg, w, pos)
  32. #define DECL_QPEL_XY(x, y) \
  33. DECL_QPEL2(16, x ## y); \
  34. DECL_QPEL2(8, x ## y)
  35. #define DECL_QPEL_Y(y) \
  36. DECL_QPEL_XY(0, y); \
  37. DECL_QPEL_XY(1, y); \
  38. DECL_QPEL_XY(2, y); \
  39. DECL_QPEL_XY(3, y); \
  40. DECL_QPEL_Y(0);
  41. DECL_QPEL_Y(1);
  42. DECL_QPEL_Y(2);
  43. DECL_QPEL_Y(3);
  44. void ff_put_rv40_chroma_mc8_neon(uint8_t *, uint8_t *, int, int, int, int);
  45. void ff_put_rv40_chroma_mc4_neon(uint8_t *, uint8_t *, int, int, int, int);
  46. void ff_avg_rv40_chroma_mc8_neon(uint8_t *, uint8_t *, int, int, int, int);
  47. void ff_avg_rv40_chroma_mc4_neon(uint8_t *, uint8_t *, int, int, int, int);
  48. void ff_rv40_weight_func_16_neon(uint8_t *, uint8_t *, uint8_t *, int, int, ptrdiff_t);
  49. void ff_rv40_weight_func_8_neon(uint8_t *, uint8_t *, uint8_t *, int, int, ptrdiff_t);
  50. int ff_rv40_h_loop_filter_strength_neon(uint8_t *src, ptrdiff_t stride,
  51. int beta, int beta2, int edge,
  52. int *p1, int *q1);
  53. int ff_rv40_v_loop_filter_strength_neon(uint8_t *src, ptrdiff_t stride,
  54. int beta, int beta2, int edge,
  55. int *p1, int *q1);
  56. void ff_rv40_h_weak_loop_filter_neon(uint8_t *src, ptrdiff_t stride, int filter_p1,
  57. int filter_q1, int alpha, int beta,
  58. int lim_p0q0, int lim_q1, int lim_p1);
  59. void ff_rv40_v_weak_loop_filter_neon(uint8_t *src, ptrdiff_t stride, int filter_p1,
  60. int filter_q1, int alpha, int beta,
  61. int lim_p0q0, int lim_q1, int lim_p1);
  62. static av_cold void rv40dsp_init_neon(RV34DSPContext *c)
  63. {
  64. c->put_pixels_tab[0][ 1] = ff_put_rv40_qpel16_mc10_neon;
  65. c->put_pixels_tab[0][ 3] = ff_put_rv40_qpel16_mc30_neon;
  66. c->put_pixels_tab[0][ 4] = ff_put_rv40_qpel16_mc01_neon;
  67. c->put_pixels_tab[0][ 5] = ff_put_rv40_qpel16_mc11_neon;
  68. c->put_pixels_tab[0][ 6] = ff_put_rv40_qpel16_mc21_neon;
  69. c->put_pixels_tab[0][ 7] = ff_put_rv40_qpel16_mc31_neon;
  70. c->put_pixels_tab[0][ 9] = ff_put_rv40_qpel16_mc12_neon;
  71. c->put_pixels_tab[0][10] = ff_put_rv40_qpel16_mc22_neon;
  72. c->put_pixels_tab[0][11] = ff_put_rv40_qpel16_mc32_neon;
  73. c->put_pixels_tab[0][12] = ff_put_rv40_qpel16_mc03_neon;
  74. c->put_pixels_tab[0][13] = ff_put_rv40_qpel16_mc13_neon;
  75. c->put_pixels_tab[0][14] = ff_put_rv40_qpel16_mc23_neon;
  76. c->put_pixels_tab[0][15] = ff_put_rv40_qpel16_mc33_neon;
  77. c->avg_pixels_tab[0][ 1] = ff_avg_rv40_qpel16_mc10_neon;
  78. c->avg_pixels_tab[0][ 3] = ff_avg_rv40_qpel16_mc30_neon;
  79. c->avg_pixels_tab[0][ 4] = ff_avg_rv40_qpel16_mc01_neon;
  80. c->avg_pixels_tab[0][ 5] = ff_avg_rv40_qpel16_mc11_neon;
  81. c->avg_pixels_tab[0][ 6] = ff_avg_rv40_qpel16_mc21_neon;
  82. c->avg_pixels_tab[0][ 7] = ff_avg_rv40_qpel16_mc31_neon;
  83. c->avg_pixels_tab[0][ 9] = ff_avg_rv40_qpel16_mc12_neon;
  84. c->avg_pixels_tab[0][10] = ff_avg_rv40_qpel16_mc22_neon;
  85. c->avg_pixels_tab[0][11] = ff_avg_rv40_qpel16_mc32_neon;
  86. c->avg_pixels_tab[0][12] = ff_avg_rv40_qpel16_mc03_neon;
  87. c->avg_pixels_tab[0][13] = ff_avg_rv40_qpel16_mc13_neon;
  88. c->avg_pixels_tab[0][14] = ff_avg_rv40_qpel16_mc23_neon;
  89. c->avg_pixels_tab[0][15] = ff_avg_rv40_qpel16_mc33_neon;
  90. c->put_pixels_tab[1][ 1] = ff_put_rv40_qpel8_mc10_neon;
  91. c->put_pixels_tab[1][ 3] = ff_put_rv40_qpel8_mc30_neon;
  92. c->put_pixels_tab[1][ 4] = ff_put_rv40_qpel8_mc01_neon;
  93. c->put_pixels_tab[1][ 5] = ff_put_rv40_qpel8_mc11_neon;
  94. c->put_pixels_tab[1][ 6] = ff_put_rv40_qpel8_mc21_neon;
  95. c->put_pixels_tab[1][ 7] = ff_put_rv40_qpel8_mc31_neon;
  96. c->put_pixels_tab[1][ 9] = ff_put_rv40_qpel8_mc12_neon;
  97. c->put_pixels_tab[1][10] = ff_put_rv40_qpel8_mc22_neon;
  98. c->put_pixels_tab[1][11] = ff_put_rv40_qpel8_mc32_neon;
  99. c->put_pixels_tab[1][12] = ff_put_rv40_qpel8_mc03_neon;
  100. c->put_pixels_tab[1][13] = ff_put_rv40_qpel8_mc13_neon;
  101. c->put_pixels_tab[1][14] = ff_put_rv40_qpel8_mc23_neon;
  102. c->put_pixels_tab[1][15] = ff_put_rv40_qpel8_mc33_neon;
  103. c->avg_pixels_tab[1][ 1] = ff_avg_rv40_qpel8_mc10_neon;
  104. c->avg_pixels_tab[1][ 3] = ff_avg_rv40_qpel8_mc30_neon;
  105. c->avg_pixels_tab[1][ 4] = ff_avg_rv40_qpel8_mc01_neon;
  106. c->avg_pixels_tab[1][ 5] = ff_avg_rv40_qpel8_mc11_neon;
  107. c->avg_pixels_tab[1][ 6] = ff_avg_rv40_qpel8_mc21_neon;
  108. c->avg_pixels_tab[1][ 7] = ff_avg_rv40_qpel8_mc31_neon;
  109. c->avg_pixels_tab[1][ 9] = ff_avg_rv40_qpel8_mc12_neon;
  110. c->avg_pixels_tab[1][10] = ff_avg_rv40_qpel8_mc22_neon;
  111. c->avg_pixels_tab[1][11] = ff_avg_rv40_qpel8_mc32_neon;
  112. c->avg_pixels_tab[1][12] = ff_avg_rv40_qpel8_mc03_neon;
  113. c->avg_pixels_tab[1][13] = ff_avg_rv40_qpel8_mc13_neon;
  114. c->avg_pixels_tab[1][14] = ff_avg_rv40_qpel8_mc23_neon;
  115. c->avg_pixels_tab[1][15] = ff_avg_rv40_qpel8_mc33_neon;
  116. c->put_chroma_pixels_tab[0] = ff_put_rv40_chroma_mc8_neon;
  117. c->put_chroma_pixels_tab[1] = ff_put_rv40_chroma_mc4_neon;
  118. c->avg_chroma_pixels_tab[0] = ff_avg_rv40_chroma_mc8_neon;
  119. c->avg_chroma_pixels_tab[1] = ff_avg_rv40_chroma_mc4_neon;
  120. c->rv40_weight_pixels_tab[0][0] = ff_rv40_weight_func_16_neon;
  121. c->rv40_weight_pixels_tab[0][1] = ff_rv40_weight_func_8_neon;
  122. c->rv40_loop_filter_strength[0] = ff_rv40_h_loop_filter_strength_neon;
  123. c->rv40_loop_filter_strength[1] = ff_rv40_v_loop_filter_strength_neon;
  124. c->rv40_weak_loop_filter[0] = ff_rv40_h_weak_loop_filter_neon;
  125. c->rv40_weak_loop_filter[1] = ff_rv40_v_weak_loop_filter_neon;
  126. }
  127. av_cold void ff_rv40dsp_init_arm(RV34DSPContext *c)
  128. {
  129. int cpu_flags = av_get_cpu_flags();
  130. if (have_neon(cpu_flags))
  131. rv40dsp_init_neon(c);
  132. }