i422_yuy2.h
上传用户:riyaled888
上传日期:2009-03-27
资源大小:7338k
文件大小:5k
源码类别:

多媒体

开发平台:

MultiPlatform

  1. /*****************************************************************************
  2.  * i422_yuy2.h : YUV to YUV conversion module for vlc
  3.  *****************************************************************************
  4.  * Copyright (C) 2002 VideoLAN
  5.  * $Id: i422_yuy2.h 7194 2004-03-29 19:57:07Z fenrir $
  6.  *
  7.  * Authors: Samuel Hocevar <sam@zoy.org>
  8.  *
  9.  * This program is free software; you can redistribute it and/or modify
  10.  * it under the terms of the GNU General Public License as published by
  11.  * the Free Software Foundation; either version 2 of the License, or
  12.  * (at your option) any later version.
  13.  * 
  14.  * This program is distributed in the hope that it will be useful,
  15.  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  16.  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  17.  * GNU General Public License for more details.
  18.  *
  19.  * You should have received a copy of the GNU General Public License
  20.  * along with this program; if not, write to the Free Software
  21.  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111, USA.
  22.  *****************************************************************************/
  23. #ifdef MODULE_NAME_IS_i422_yuy2_mmx
  24. #define MMX_YUV422_YUYV "                                                 n
  25. movq       (%1), %%mm0  # Load 8 Y            y7 y6 y5 y4 y3 y2 y1 y0     n
  26. movd       (%2), %%mm1  # Load 4 Cb           00 00 00 00 u3 u2 u1 u0     n
  27. movd       (%3), %%mm2  # Load 4 Cr           00 00 00 00 v3 v2 v1 v0     n
  28. punpcklbw %%mm2, %%mm1  #                     v3 u3 v2 u2 v1 u1 v0 u0     n
  29. movq      %%mm0, %%mm2  #                     y7 y6 y5 y4 y3 y2 y1 y0     n
  30. punpcklbw %%mm1, %%mm2  #                     v1 y3 u1 y2 v0 y1 u0 y0     n
  31. movq      %%mm2, (%0)   # Store low YUYV                                  n
  32. punpckhbw %%mm1, %%mm0  #                     v3 y7 u3 y6 v2 y5 u2 y4     n
  33. movq      %%mm0, 8(%0)  # Store high YUYV                                 n
  34. "
  35. #define MMX_YUV422_YVYU "                                                 n
  36. movq       (%1), %%mm0  # Load 8 Y            y7 y6 y5 y4 y3 y2 y1 y0     n
  37. movd       (%2), %%mm2  # Load 4 Cb           00 00 00 00 u3 u2 u1 u0     n
  38. movd       (%3), %%mm1  # Load 4 Cr           00 00 00 00 v3 v2 v1 v0     n
  39. punpcklbw %%mm2, %%mm1  #                     u3 v3 u2 v2 u1 v1 u0 v0     n
  40. movq      %%mm0, %%mm2  #                     y7 y6 y5 y4 y3 y2 y1 y0     n
  41. punpcklbw %%mm1, %%mm2  #                     u1 y3 v1 y2 u0 y1 v0 y0     n
  42. movq      %%mm2, (%0)   # Store low YUYV                                  n
  43. punpckhbw %%mm1, %%mm0  #                     u3 y7 v3 y6 u2 y5 v2 y4     n
  44. movq      %%mm0, 8(%0)  # Store high YUYV                                 n
  45. "
  46. #define MMX_YUV422_UYVY "                                                 n
  47. movq       (%1), %%mm0  # Load 8 Y            y7 y6 y5 y4 y3 y2 y1 y0     n
  48. movd       (%2), %%mm2  # Load 4 Cb           00 00 00 00 u3 u2 u1 u0     n
  49. movd       (%3), %%mm1  # Load 4 Cr           00 00 00 00 v3 v2 v1 v0     n
  50. punpcklbw %%mm2, %%mm1  #                     u3 v3 u2 v2 u1 v1 u0 v0     n
  51. movq      %%mm1, %%mm2  #                     u3 v3 u2 v2 u1 v1 u0 v0     n
  52. punpcklbw %%mm0, %%mm2  #                     y3 v1 y2 u1 y1 v0 y0 u0     n
  53. movq      %%mm2, (%0)   # Store low UYVY                                  n
  54. punpckhbw %%mm0, %%mm1  #                     y7 v3 y6 u3 y5 v2 y4 u2     n
  55. movq      %%mm1, 8(%0)  # Store high UYVY                                 n
  56. "
  57. #define MMX_YUV422_Y211 "                                                 n
  58. "
  59. #else
  60. #define C_YUV422_YUYV( p_line, p_y, p_u, p_v )                              
  61.     *(p_line)++ = *(p_y)++;                                                 
  62.     *(p_line)++ = *(p_u)++;                                                 
  63.     *(p_line)++ = *(p_y)++;                                                 
  64.     *(p_line)++ = *(p_v)++;                                                 
  65. #define C_YUV422_YVYU( p_line, p_y, p_u, p_v )                              
  66.     *(p_line)++ = *(p_y)++;                                                 
  67.     *(p_line)++ = *(p_v)++;                                                 
  68.     *(p_line)++ = *(p_y)++;                                                 
  69.     *(p_line)++ = *(p_u)++;                                                 
  70. #define C_YUV422_UYVY( p_line, p_y, p_u, p_v )                              
  71.     *(p_line)++ = *(p_u)++;                                                 
  72.     *(p_line)++ = *(p_y)++;                                                 
  73.     *(p_line)++ = *(p_v)++;                                                 
  74.     *(p_line)++ = *(p_y)++;                                                 
  75. #define C_YUV422_Y211( p_line, p_y, p_u, p_v )                              
  76.     *(p_line)++ = *(p_y); p_y += 2;                                         
  77.     *(p_line)++ = *(p_u) - 0x80; p_u += 2;                                  
  78.     *(p_line)++ = *(p_y); p_y += 2;                                         
  79.     *(p_line)++ = *(p_v) - 0x80; p_v += 2;                                  
  80. #endif