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.

88 lines
3.2KB

  1. /*
  2. * Copyright (C) 2007 Marc Hoffman <marc.hoffman@analog.com>
  3. *
  4. * Blackfin software video scaler operations
  5. *
  6. * This file is part of Libav.
  7. *
  8. * Libav is free software; you can redistribute it and/or
  9. * modify it under the terms of the GNU Lesser General Public
  10. * License as published by the Free Software Foundation; either
  11. * version 2.1 of the License, or (at your option) any later version.
  12. *
  13. * Libav is distributed in the hope that it will be useful,
  14. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  16. * Lesser General Public License for more details.
  17. *
  18. * You should have received a copy of the GNU Lesser General Public
  19. * License along with Libav; if not, write to the Free Software
  20. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  21. */
  22. #include <stdint.h>
  23. #include "config.h"
  24. #include "libavutil/attributes.h"
  25. #include "libswscale/swscale_internal.h"
  26. #if defined (__FDPIC__) && CONFIG_SRAM
  27. #define L1CODE __attribute__((l1_text))
  28. #else
  29. #define L1CODE
  30. #endif
  31. int ff_bfin_uyvytoyv12(const uint8_t *src, uint8_t *ydst, uint8_t *udst,
  32. uint8_t *vdst, int width, int height,
  33. int lumStride, int chromStride, int srcStride) L1CODE;
  34. int ff_bfin_yuyvtoyv12(const uint8_t *src, uint8_t *ydst, uint8_t *udst,
  35. uint8_t *vdst, int width, int height,
  36. int lumStride, int chromStride, int srcStride) L1CODE;
  37. static int uyvytoyv12_unscaled(SwsContext *c, const uint8_t *src[],
  38. int srcStride[], int srcSliceY, int srcSliceH,
  39. uint8_t *dst[], int dstStride[])
  40. {
  41. uint8_t *dsty = dst[0] + dstStride[0] * srcSliceY;
  42. uint8_t *dstu = dst[1] + dstStride[1] * srcSliceY / 2;
  43. uint8_t *dstv = dst[2] + dstStride[2] * srcSliceY / 2;
  44. const uint8_t *ip = src[0] + srcStride[0] * srcSliceY;
  45. int w = dstStride[0];
  46. ff_bfin_uyvytoyv12(ip, dsty, dstu, dstv, w, srcSliceH,
  47. dstStride[0], dstStride[1], srcStride[0]);
  48. return srcSliceH;
  49. }
  50. static int yuyvtoyv12_unscaled(SwsContext *c, const uint8_t *src[],
  51. int srcStride[], int srcSliceY, int srcSliceH,
  52. uint8_t *dst[], int dstStride[])
  53. {
  54. uint8_t *dsty = dst[0] + dstStride[0] * srcSliceY;
  55. uint8_t *dstu = dst[1] + dstStride[1] * srcSliceY / 2;
  56. uint8_t *dstv = dst[2] + dstStride[2] * srcSliceY / 2;
  57. const uint8_t *ip = src[0] + srcStride[0] * srcSliceY;
  58. int w = dstStride[0];
  59. ff_bfin_yuyvtoyv12(ip, dsty, dstu, dstv, w, srcSliceH,
  60. dstStride[0], dstStride[1], srcStride[0]);
  61. return srcSliceH;
  62. }
  63. av_cold void ff_get_unscaled_swscale_bfin(SwsContext *c)
  64. {
  65. if (c->dstFormat == AV_PIX_FMT_YUV420P && c->srcFormat == AV_PIX_FMT_UYVY422) {
  66. av_log(NULL, AV_LOG_VERBOSE,
  67. "selecting Blackfin optimized uyvytoyv12_unscaled\n");
  68. c->swscale = uyvytoyv12_unscaled;
  69. }
  70. if (c->dstFormat == AV_PIX_FMT_YUV420P && c->srcFormat == AV_PIX_FMT_YUYV422) {
  71. av_log(NULL, AV_LOG_VERBOSE,
  72. "selecting Blackfin optimized yuyvtoyv12_unscaled\n");
  73. c->swscale = yuyvtoyv12_unscaled;
  74. }
  75. }