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.

84 lines
2.5KB

  1. ;******************************************************************************
  2. ;* MMX optimized deinterlacing functions
  3. ;* Copyright (c) 2010 Vitor Sessak
  4. ;* Copyright (c) 2002 Michael Niedermayer
  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 "x86inc.asm"
  23. %include "x86util.asm"
  24. SECTION_RODATA
  25. cextern pw_4
  26. SECTION .text
  27. %macro DEINTERLACE 1
  28. %ifidn %1, inplace
  29. ;void ff_deinterlace_line_inplace_mmx(const uint8_t *lum_m4, const uint8_t *lum_m3, const uint8_t *lum_m2, const uint8_t *lum_m1, const uint8_t *lum, int size)
  30. cglobal deinterlace_line_inplace_mmx, 6,6,7, lum_m4, lum_m3, lum_m2, lum_m1, lum, size
  31. %else
  32. ;void ff_deinterlace_line_mmx(uint8_t *dst, const uint8_t *lum_m4, const uint8_t *lum_m3, const uint8_t *lum_m2, const uint8_t *lum_m1, const uint8_t *lum, int size)
  33. cglobal deinterlace_line_mmx, 7,7,7, dst, lum_m4, lum_m3, lum_m2, lum_m1, lum, size
  34. %endif
  35. pxor mm7, mm7
  36. movq mm6, [pw_4]
  37. .nextrow
  38. movd mm0, [lum_m4q]
  39. movd mm1, [lum_m3q]
  40. movd mm2, [lum_m2q]
  41. %ifidn %1, inplace
  42. movd [lum_m4q], mm2
  43. %endif
  44. movd mm3, [lum_m1q]
  45. movd mm4, [lumq]
  46. punpcklbw mm0, mm7
  47. punpcklbw mm1, mm7
  48. punpcklbw mm2, mm7
  49. punpcklbw mm3, mm7
  50. punpcklbw mm4, mm7
  51. paddw mm1, mm3
  52. psllw mm2, 1
  53. paddw mm0, mm4
  54. psllw mm1, 2
  55. paddw mm2, mm6
  56. paddw mm1, mm2
  57. psubusw mm1, mm0
  58. psrlw mm1, 3
  59. packuswb mm1, mm7
  60. %ifidn %1, inplace
  61. movd [lum_m2q], mm1
  62. %else
  63. movd [dstq], mm1
  64. add dstq, 4
  65. %endif
  66. add lum_m4q, 4
  67. add lum_m3q, 4
  68. add lum_m2q, 4
  69. add lum_m1q, 4
  70. add lumq, 4
  71. sub sized, 4
  72. jg .nextrow
  73. REP_RET
  74. %endmacro
  75. DEINTERLACE ""
  76. DEINTERLACE inplace