vc1dsp_init_neon.c 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  1. /*
  2. * This file is part of FFmpeg.
  3. *
  4. * FFmpeg is free software; you can redistribute it and/or
  5. * modify it under the terms of the GNU Lesser General Public
  6. * License as published by the Free Software Foundation; either
  7. * version 2.1 of the License, or (at your option) any later version.
  8. *
  9. * FFmpeg is distributed in the hope that it will be useful,
  10. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  12. * Lesser General Public License for more details.
  13. *
  14. * You should have received a copy of the GNU Lesser General Public
  15. * License along with FFmpeg; if not, write to the Free Software
  16. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  17. */
  18. #include <stdint.h>
  19. #include "libavutil/attributes.h"
  20. #include "libavcodec/vc1dsp.h"
  21. #include "vc1dsp.h"
  22. void ff_vc1_inv_trans_8x8_neon(int16_t *block);
  23. void ff_vc1_inv_trans_4x8_neon(uint8_t *dest, ptrdiff_t stride, int16_t *block);
  24. void ff_vc1_inv_trans_8x4_neon(uint8_t *dest, ptrdiff_t stride, int16_t *block);
  25. void ff_vc1_inv_trans_4x4_neon(uint8_t *dest, ptrdiff_t stride, int16_t *block);
  26. void ff_vc1_inv_trans_8x8_dc_neon(uint8_t *dest, ptrdiff_t stride, int16_t *block);
  27. void ff_vc1_inv_trans_4x8_dc_neon(uint8_t *dest, ptrdiff_t stride, int16_t *block);
  28. void ff_vc1_inv_trans_8x4_dc_neon(uint8_t *dest, ptrdiff_t stride, int16_t *block);
  29. void ff_vc1_inv_trans_4x4_dc_neon(uint8_t *dest, ptrdiff_t stride, int16_t *block);
  30. void ff_put_pixels8x8_neon(uint8_t *block, const uint8_t *pixels,
  31. ptrdiff_t line_size, int rnd);
  32. #define DECL_PUT(X, Y) \
  33. void ff_put_vc1_mspel_mc##X##Y##_neon(uint8_t *dst, const uint8_t *src, \
  34. ptrdiff_t stride, int rnd); \
  35. static void ff_put_vc1_mspel_mc##X##Y##_16_neon(uint8_t *dst, const uint8_t *src, \
  36. ptrdiff_t stride, int rnd) \
  37. { \
  38. ff_put_vc1_mspel_mc##X##Y##_neon(dst+0, src+0, stride, rnd); \
  39. ff_put_vc1_mspel_mc##X##Y##_neon(dst+8, src+8, stride, rnd); \
  40. dst += 8*stride; src += 8*stride; \
  41. ff_put_vc1_mspel_mc##X##Y##_neon(dst+0, src+0, stride, rnd); \
  42. ff_put_vc1_mspel_mc##X##Y##_neon(dst+8, src+8, stride, rnd); \
  43. }
  44. DECL_PUT(1, 0)
  45. DECL_PUT(2, 0)
  46. DECL_PUT(3, 0)
  47. DECL_PUT(0, 1)
  48. DECL_PUT(0, 2)
  49. DECL_PUT(0, 3)
  50. DECL_PUT(1, 1)
  51. DECL_PUT(1, 2)
  52. DECL_PUT(1, 3)
  53. DECL_PUT(2, 1)
  54. DECL_PUT(2, 2)
  55. DECL_PUT(2, 3)
  56. DECL_PUT(3, 1)
  57. DECL_PUT(3, 2)
  58. DECL_PUT(3, 3)
  59. void ff_put_vc1_chroma_mc8_neon(uint8_t *dst, uint8_t *src, ptrdiff_t stride,
  60. int h, int x, int y);
  61. void ff_avg_vc1_chroma_mc8_neon(uint8_t *dst, uint8_t *src, ptrdiff_t stride,
  62. int h, int x, int y);
  63. void ff_put_vc1_chroma_mc4_neon(uint8_t *dst, uint8_t *src, ptrdiff_t stride,
  64. int h, int x, int y);
  65. void ff_avg_vc1_chroma_mc4_neon(uint8_t *dst, uint8_t *src, ptrdiff_t stride,
  66. int h, int x, int y);
  67. #define FN_ASSIGN(X, Y) \
  68. dsp->put_vc1_mspel_pixels_tab[0][X+4*Y] = ff_put_vc1_mspel_mc##X##Y##_16_neon; \
  69. dsp->put_vc1_mspel_pixels_tab[1][X+4*Y] = ff_put_vc1_mspel_mc##X##Y##_neon
  70. av_cold void ff_vc1dsp_init_neon(VC1DSPContext *dsp)
  71. {
  72. dsp->vc1_inv_trans_8x8 = ff_vc1_inv_trans_8x8_neon;
  73. dsp->vc1_inv_trans_4x8 = ff_vc1_inv_trans_4x8_neon;
  74. dsp->vc1_inv_trans_8x4 = ff_vc1_inv_trans_8x4_neon;
  75. dsp->vc1_inv_trans_4x4 = ff_vc1_inv_trans_4x4_neon;
  76. dsp->vc1_inv_trans_8x8_dc = ff_vc1_inv_trans_8x8_dc_neon;
  77. dsp->vc1_inv_trans_4x8_dc = ff_vc1_inv_trans_4x8_dc_neon;
  78. dsp->vc1_inv_trans_8x4_dc = ff_vc1_inv_trans_8x4_dc_neon;
  79. dsp->vc1_inv_trans_4x4_dc = ff_vc1_inv_trans_4x4_dc_neon;
  80. dsp->put_vc1_mspel_pixels_tab[1][ 0] = ff_put_pixels8x8_neon;
  81. FN_ASSIGN(1, 0);
  82. FN_ASSIGN(2, 0);
  83. FN_ASSIGN(3, 0);
  84. FN_ASSIGN(0, 1);
  85. FN_ASSIGN(1, 1);
  86. FN_ASSIGN(2, 1);
  87. FN_ASSIGN(3, 1);
  88. FN_ASSIGN(0, 2);
  89. FN_ASSIGN(1, 2);
  90. FN_ASSIGN(2, 2);
  91. FN_ASSIGN(3, 2);
  92. FN_ASSIGN(0, 3);
  93. FN_ASSIGN(1, 3);
  94. FN_ASSIGN(2, 3);
  95. FN_ASSIGN(3, 3);
  96. dsp->put_no_rnd_vc1_chroma_pixels_tab[0] = ff_put_vc1_chroma_mc8_neon;
  97. dsp->avg_no_rnd_vc1_chroma_pixels_tab[0] = ff_avg_vc1_chroma_mc8_neon;
  98. dsp->put_no_rnd_vc1_chroma_pixels_tab[1] = ff_put_vc1_chroma_mc4_neon;
  99. dsp->avg_no_rnd_vc1_chroma_pixels_tab[1] = ff_avg_vc1_chroma_mc4_neon;
  100. }