swscale_loongarch.h 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211
  1. /*
  2. * Copyright (C) 2022 Loongson Technology Corporation Limited
  3. * Contributed by Hao Chen(chenhao@loongson.cn)
  4. *
  5. * This file is part of FFmpeg.
  6. *
  7. * FFmpeg is free software; you can redistribute it and/or
  8. * modify it under the terms of the GNU Lesser General Public
  9. * License as published by the Free Software Foundation; either
  10. * version 2.1 of the License, or (at your option) any later version.
  11. *
  12. * FFmpeg is distributed in the hope that it will be useful,
  13. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  15. * Lesser General Public License for more details.
  16. *
  17. * You should have received a copy of the GNU Lesser General Public
  18. * License along with FFmpeg; if not, write to the Free Software
  19. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  20. */
  21. #ifndef SWSCALE_LOONGARCH_SWSCALE_LOONGARCH_H
  22. #define SWSCALE_LOONGARCH_SWSCALE_LOONGARCH_H
  23. #include "libswscale/swscale.h"
  24. #include "libswscale/swscale_internal.h"
  25. #include "config.h"
  26. void ff_hscale_8_to_15_lsx(SwsContext *c, int16_t *dst, int dstW,
  27. const uint8_t *src, const int16_t *filter,
  28. const int32_t *filterPos, int filterSize);
  29. void ff_hscale_8_to_19_lsx(SwsContext *c, int16_t *_dst, int dstW,
  30. const uint8_t *src, const int16_t *filter,
  31. const int32_t *filterPos, int filterSize);
  32. void ff_hscale_16_to_15_lsx(SwsContext *c, int16_t *_dst, int dstW,
  33. const uint8_t *_src, const int16_t *filter,
  34. const int32_t *filterPos, int filterSize);
  35. void ff_hscale_16_to_15_sub_lsx(SwsContext *c, int16_t *_dst, int dstW,
  36. const uint8_t *_src, const int16_t *filter,
  37. const int32_t *filterPos, int filterSize, int sh);
  38. void ff_hscale_16_to_19_lsx(SwsContext *c, int16_t *_dst, int dstW,
  39. const uint8_t *_src, const int16_t *filter,
  40. const int32_t *filterPos, int filterSize);
  41. void ff_hscale_16_to_19_sub_lsx(SwsContext *c, int16_t *_dst, int dstW,
  42. const uint8_t *_src, const int16_t *filter,
  43. const int32_t *filterPos, int filterSize, int sh);
  44. void lumRangeFromJpeg_lsx(int16_t *dst, int width);
  45. void chrRangeFromJpeg_lsx(int16_t *dstU, int16_t *dstV, int width);
  46. void lumRangeToJpeg_lsx(int16_t *dst, int width);
  47. void chrRangeToJpeg_lsx(int16_t *dstU, int16_t *dstV, int width);
  48. void planar_rgb_to_uv_lsx(uint8_t *_dstU, uint8_t *_dstV, const uint8_t *src[4],
  49. int width, int32_t *rgb2yuv, void *opq);
  50. void planar_rgb_to_y_lsx(uint8_t *_dst, const uint8_t *src[4], int width,
  51. int32_t *rgb2yuv, void *opq);
  52. void yuv2planeX_8_lsx(const int16_t *filter, int filterSize,
  53. const int16_t **src, uint8_t *dest, int dstW,
  54. const uint8_t *dither, int offset);
  55. void yuv2plane1_8_lsx(const int16_t *src, uint8_t *dest, int dstW,
  56. const uint8_t *dither, int offset);
  57. void yuy2ToUV_lsx(uint8_t *dstU, uint8_t *dstV, const uint8_t *unused0, const uint8_t *src1,
  58. const uint8_t *src2, int width, uint32_t *unused, void *opq);
  59. void yvy2ToUV_lsx(uint8_t *dstU, uint8_t *dstV, const uint8_t *unused0, const uint8_t *src1,
  60. const uint8_t *src2, int width, uint32_t *unused, void *opq);
  61. void uyvyToUV_lsx(uint8_t *dstU, uint8_t *dstV, const uint8_t *unused0, const uint8_t *src1,
  62. const uint8_t *src2, int width, uint32_t *unused, void *opq);
  63. void nv12ToUV_lsx(uint8_t *dstU, uint8_t *dstV, const uint8_t *unused0, const uint8_t *src1,
  64. const uint8_t *src2, int width, uint32_t *unused, void *opq);
  65. void nv21ToUV_lsx(uint8_t *dstU, uint8_t *dstV, const uint8_t *unused0, const uint8_t *src1,
  66. const uint8_t *src2, int width, uint32_t *unused, void *opq);
  67. void abgrToA_lsx(uint8_t *_dst, const uint8_t *src, const uint8_t *unused1,
  68. const uint8_t *unused2, int width, uint32_t *unused, void *opq);
  69. void rgbaToA_lsx(uint8_t *_dst, const uint8_t *src, const uint8_t *unused1,
  70. const uint8_t *unused2, int width, uint32_t *unused, void *opq);
  71. av_cold void ff_sws_init_input_lsx(SwsContext *c);
  72. av_cold void ff_sws_init_output_lsx(SwsContext *c,
  73. yuv2planar1_fn *yuv2plane1,
  74. yuv2planarX_fn *yuv2planeX,
  75. yuv2interleavedX_fn *yuv2nv12cX,
  76. yuv2packed1_fn *yuv2packed1,
  77. yuv2packed2_fn *yuv2packed2,
  78. yuv2packedX_fn *yuv2packedX,
  79. yuv2anyX_fn *yuv2anyX);
  80. int yuv420_rgb24_lsx(SwsContext *c, const uint8_t *src[], int srcStride[],
  81. int srcSliceY, int srcSliceH, uint8_t *dst[], int dstStride[]);
  82. int yuv420_bgr24_lsx(SwsContext *c, const uint8_t *src[], int srcStride[],
  83. int srcSliceY, int srcSliceH, uint8_t *dst[], int dstStride[]);
  84. int yuv420_rgba32_lsx(SwsContext *c, const uint8_t *src[], int srcStride[],
  85. int srcSliceY, int srcSliceH, uint8_t *dst[], int dstStride[]);
  86. int yuv420_bgra32_lsx(SwsContext *c, const uint8_t *src[], int srcStride[],
  87. int srcSliceY, int srcSliceH, uint8_t *dst[], int dstStride[]);
  88. int yuv420_argb32_lsx(SwsContext *c, const uint8_t *src[], int srcStride[],
  89. int srcSliceY, int srcSliceH, uint8_t *dst[], int dstStride[]);
  90. int yuv420_abgr32_lsx(SwsContext *c, const uint8_t *src[], int srcStride[],
  91. int srcSliceY, int srcSliceH, uint8_t *dst[], int dstStride[]);
  92. #if HAVE_LASX
  93. void ff_hscale_8_to_15_lasx(SwsContext *c, int16_t *dst, int dstW,
  94. const uint8_t *src, const int16_t *filter,
  95. const int32_t *filterPos, int filterSize);
  96. void ff_hscale_8_to_19_lasx(SwsContext *c, int16_t *_dst, int dstW,
  97. const uint8_t *src, const int16_t *filter,
  98. const int32_t *filterPos, int filterSize);
  99. void ff_hscale_16_to_19_lasx(SwsContext *c, int16_t *_dst, int dstW,
  100. const uint8_t *_src, const int16_t *filter,
  101. const int32_t *filterPos, int filterSize);
  102. void ff_hscale_16_to_15_lasx(SwsContext *c, int16_t *dst, int dstW,
  103. const uint8_t *_src, const int16_t *filter,
  104. const int32_t *filterPos, int filterSize);
  105. void lumRangeFromJpeg_lasx(int16_t *dst, int width);
  106. void chrRangeFromJpeg_lasx(int16_t *dstU, int16_t *dstV, int width);
  107. void lumRangeToJpeg_lasx(int16_t *dst, int width);
  108. void chrRangeToJpeg_lasx(int16_t *dstU, int16_t *dstV, int width);
  109. void planar_rgb_to_uv_lasx(uint8_t *_dstU, uint8_t *_dstV, const uint8_t *src[4],
  110. int width, int32_t *rgb2yuv, void *opq);
  111. void planar_rgb_to_y_lasx(uint8_t *_dst, const uint8_t *src[4], int width,
  112. int32_t *rgb2yuv, void *opq);
  113. int yuv420_rgb24_lasx(SwsContext *c, const uint8_t *src[], int srcStride[],
  114. int srcSliceY, int srcSliceH, uint8_t *dst[], int dstStride[]);
  115. int yuv420_bgr24_lasx(SwsContext *c, const uint8_t *src[], int srcStride[],
  116. int srcSliceY, int srcSliceH, uint8_t *dst[], int dstStride[]);
  117. int yuv420_rgba32_lasx(SwsContext *c, const uint8_t *src[], int srcStride[],
  118. int srcSliceY, int srcSliceH, uint8_t *dst[], int dstStride[]);
  119. int yuv420_bgra32_lasx(SwsContext *c, const uint8_t *src[], int srcStride[],
  120. int srcSliceY, int srcSliceH, uint8_t *dst[], int dstStride[]);
  121. int yuv420_argb32_lasx(SwsContext *c, const uint8_t *src[], int srcStride[],
  122. int srcSliceY, int srcSliceH, uint8_t *dst[], int dstStride[]);
  123. int yuv420_abgr32_lasx(SwsContext *c, const uint8_t *src[], int srcStride[],
  124. int srcSliceY, int srcSliceH, uint8_t *dst[], int dstStride[]);
  125. void ff_interleave_bytes_lasx(const uint8_t *src1, const uint8_t *src2,
  126. uint8_t *dest, int width, int height,
  127. int src1Stride, int src2Stride, int dstStride);
  128. void yuv2planeX_8_lasx(const int16_t *filter, int filterSize,
  129. const int16_t **src, uint8_t *dest, int dstW,
  130. const uint8_t *dither, int offset);
  131. void yuv2plane1_8_lasx(const int16_t *src, uint8_t *dest, int dstW,
  132. const uint8_t *dither, int offset);
  133. void yuy2ToUV_lasx(uint8_t *dstU, uint8_t *dstV, const uint8_t *unused0, const uint8_t *src1,
  134. const uint8_t *src2, int width, uint32_t *unused, void *opq);
  135. void yvy2ToUV_lasx(uint8_t *dstU, uint8_t *dstV, const uint8_t *unused0, const uint8_t *src1,
  136. const uint8_t *src2, int width, uint32_t *unused, void *opq);
  137. void uyvyToUV_lasx(uint8_t *dstU, uint8_t *dstV, const uint8_t *unused0, const uint8_t *src1,
  138. const uint8_t *src2, int width, uint32_t *unused, void *opq);
  139. void nv12ToUV_lasx(uint8_t *dstU, uint8_t *dstV, const uint8_t *unused0, const uint8_t *src1,
  140. const uint8_t *src2, int width, uint32_t *unused, void *opq);
  141. void nv21ToUV_lasx(uint8_t *dstU, uint8_t *dstV, const uint8_t *unused0, const uint8_t *src1,
  142. const uint8_t *src2, int width, uint32_t *unused, void *opq);
  143. void abgrToA_lasx(uint8_t *_dst, const uint8_t *src, const uint8_t *unused1,
  144. const uint8_t *unused2, int width, uint32_t *unused, void *opq);
  145. void rgbaToA_lasx(uint8_t *_dst, const uint8_t *src, const uint8_t *unused1,
  146. const uint8_t *unused2, int width, uint32_t *unused, void *opq);
  147. av_cold void ff_sws_init_input_lasx(SwsContext *c);
  148. av_cold void ff_sws_init_output_lasx(SwsContext *c,
  149. yuv2planar1_fn *yuv2plane1,
  150. yuv2planarX_fn *yuv2planeX,
  151. yuv2interleavedX_fn *yuv2nv12cX,
  152. yuv2packed1_fn *yuv2packed1,
  153. yuv2packed2_fn *yuv2packed2,
  154. yuv2packedX_fn *yuv2packedX,
  155. yuv2anyX_fn *yuv2anyX);
  156. #endif // #if HAVE_LASX
  157. #endif /* SWSCALE_LOONGARCH_SWSCALE_LOONGARCH_H */