input_lsx.c 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. /*
  2. * Copyright (C) 2024 Loongson Technology Corporation Limited
  3. * Contributed by Shiyou Yin<yinshiyou-hf@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. #include "swscale_loongarch.h"
  22. av_cold void ff_sws_init_input_lsx(SwsInternal *c)
  23. {
  24. enum AVPixelFormat srcFormat = c->srcFormat;
  25. switch (srcFormat) {
  26. case AV_PIX_FMT_YUYV422:
  27. c->chrToYV12 = yuy2ToUV_lsx;
  28. break;
  29. case AV_PIX_FMT_YVYU422:
  30. c->chrToYV12 = yvy2ToUV_lsx;
  31. break;
  32. case AV_PIX_FMT_UYVY422:
  33. c->chrToYV12 = uyvyToUV_lsx;
  34. break;
  35. case AV_PIX_FMT_NV12:
  36. case AV_PIX_FMT_NV16:
  37. case AV_PIX_FMT_NV24:
  38. c->chrToYV12 = nv12ToUV_lsx;
  39. break;
  40. case AV_PIX_FMT_NV21:
  41. case AV_PIX_FMT_NV42:
  42. c->chrToYV12 = nv21ToUV_lsx;
  43. break;
  44. case AV_PIX_FMT_GBRAP:
  45. case AV_PIX_FMT_GBRP:
  46. c->readChrPlanar = planar_rgb_to_uv_lsx;
  47. break;
  48. }
  49. if (c->needAlpha) {
  50. switch (srcFormat) {
  51. case AV_PIX_FMT_BGRA:
  52. case AV_PIX_FMT_RGBA:
  53. c->alpToYV12 = rgbaToA_lsx;
  54. break;
  55. case AV_PIX_FMT_ABGR:
  56. case AV_PIX_FMT_ARGB:
  57. c->alpToYV12 = abgrToA_lsx;
  58. break;
  59. }
  60. }
  61. }