i422_yuy2.c
上传用户:kjfoods
上传日期:2020-07-06
资源大小:29949k
文件大小:20k
源码类别:

midi

开发平台:

Unix_Linux

  1. /*****************************************************************************
  2.  * i422_yuy2.c : Planar YUV 4:2:2 to Packed YUV conversion module for vlc
  3.  *****************************************************************************
  4.  * Copyright (C) 2000, 2001 the VideoLAN team
  5.  * $Id: 53dd4fd20089be3f7f9d1ba2fc4779af3acfb963 $
  6.  *
  7.  * Authors: Samuel Hocevar <sam@zoy.org>
  8.  *          Damien Fouilleul <damienf@videolan.org>
  9.  *
  10.  * This program is free software; you can redistribute it and/or modify
  11.  * it under the terms of the GNU General Public License as published by
  12.  * the Free Software Foundation; either version 2 of the License, or
  13.  * (at your option) any later version.
  14.  *
  15.  * This program is distributed in the hope that it will be useful,
  16.  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  17.  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  18.  * GNU General Public License for more details.
  19.  *
  20.  * You should have received a copy of the GNU General Public License
  21.  * along with this program; if not, write to the Free Software
  22.  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
  23.  *****************************************************************************/
  24. /*****************************************************************************
  25.  * Preamble
  26.  *****************************************************************************/
  27. #ifdef HAVE_CONFIG_H
  28. # include "config.h"
  29. #endif
  30. #include <vlc_common.h>
  31. #include <vlc_plugin.h>
  32. #include <vlc_filter.h>
  33. #include <vlc_vout.h>
  34. #include "i422_yuy2.h"
  35. #define SRC_FOURCC  "I422"
  36. #if defined (MODULE_NAME_IS_i422_yuy2)
  37. #    define DEST_FOURCC "YUY2,YUNV,YVYU,UYVY,UYNV,Y422,IUYV,cyuv,Y211"
  38. #else
  39. #    define DEST_FOURCC "YUY2,YUNV,YVYU,UYVY,UYNV,Y422,IUYV,cyuv"
  40. #endif
  41. /*****************************************************************************
  42.  * Local and extern prototypes.
  43.  *****************************************************************************/
  44. static int  Activate ( vlc_object_t * );
  45. static void I422_YUY2               ( filter_t *, picture_t *, picture_t * );
  46. static void I422_YVYU               ( filter_t *, picture_t *, picture_t * );
  47. static void I422_UYVY               ( filter_t *, picture_t *, picture_t * );
  48. static void I422_IUYV               ( filter_t *, picture_t *, picture_t * );
  49. static void I422_cyuv               ( filter_t *, picture_t *, picture_t * );
  50. static picture_t *I422_YUY2_Filter  ( filter_t *, picture_t * );
  51. static picture_t *I422_YVYU_Filter  ( filter_t *, picture_t * );
  52. static picture_t *I422_UYVY_Filter  ( filter_t *, picture_t * );
  53. static picture_t *I422_IUYV_Filter  ( filter_t *, picture_t * );
  54. static picture_t *I422_cyuv_Filter  ( filter_t *, picture_t * );
  55. #if defined (MODULE_NAME_IS_i422_yuy2)
  56. static void I422_Y211               ( filter_t *, picture_t *, picture_t * );
  57. static picture_t *I422_Y211_Filter  ( filter_t *, picture_t * );
  58. #endif
  59. /*****************************************************************************
  60.  * Module descriptor
  61.  *****************************************************************************/
  62. vlc_module_begin ()
  63. #if defined (MODULE_NAME_IS_i422_yuy2)
  64.     set_description( N_("Conversions from " SRC_FOURCC " to " DEST_FOURCC) )
  65.     set_capability( "video filter2", 80 )
  66. #elif defined (MODULE_NAME_IS_i422_yuy2_mmx)
  67.     set_description( N_("MMX conversions from " SRC_FOURCC " to " DEST_FOURCC) )
  68.     set_capability( "video filter2", 100 )
  69.     add_requirement( MMX )
  70. #elif defined (MODULE_NAME_IS_i422_yuy2_sse2)
  71.     set_description( N_("SSE2 conversions from " SRC_FOURCC " to " DEST_FOURCC) )
  72.     set_capability( "video filter2", 120 )
  73.     add_requirement( SSE2 )
  74. #endif
  75.     set_callbacks( Activate, NULL )
  76. vlc_module_end ()
  77. /*****************************************************************************
  78.  * Activate: allocate a chroma function
  79.  *****************************************************************************
  80.  * This function allocates and initializes a chroma function
  81.  *****************************************************************************/
  82. static int Activate( vlc_object_t *p_this )
  83. {
  84.     filter_t *p_filter = (filter_t *)p_this;
  85.     if( p_filter->fmt_in.video.i_width & 1
  86.      || p_filter->fmt_in.video.i_height & 1 )
  87.     {
  88.         return -1;
  89.     }
  90.     switch( p_filter->fmt_in.video.i_chroma )
  91.     {
  92.         case VLC_FOURCC('I','4','2','2'):
  93.             switch( p_filter->fmt_out.video.i_chroma )
  94.             {
  95.                 case VLC_FOURCC('Y','U','Y','2'):
  96.                 case VLC_FOURCC('Y','U','N','V'):
  97.                     p_filter->pf_video_filter = I422_YUY2_Filter;
  98.                     break;
  99.                 case VLC_FOURCC('Y','V','Y','U'):
  100.                     p_filter->pf_video_filter = I422_YVYU_Filter;
  101.                     break;
  102.                 case VLC_FOURCC('U','Y','V','Y'):
  103.                 case VLC_FOURCC('U','Y','N','V'):
  104.                 case VLC_FOURCC('Y','4','2','2'):
  105.                     p_filter->pf_video_filter = I422_UYVY_Filter;
  106.                     break;
  107.                 case VLC_FOURCC('I','U','Y','V'):
  108.                     p_filter->pf_video_filter = I422_IUYV_Filter;
  109.                     break;
  110.                 case VLC_FOURCC('c','y','u','v'):
  111.                     p_filter->pf_video_filter = I422_cyuv_Filter;
  112.                     break;
  113. #if defined (MODULE_NAME_IS_i422_yuy2)
  114.                 case VLC_FOURCC('Y','2','1','1'):
  115.                     p_filter->pf_video_filter = I422_Y211_Filter;
  116.                     break;
  117. #endif
  118.                 default:
  119.                     return -1;
  120.             }
  121.             break;
  122.         default:
  123.             return -1;
  124.     }
  125.     return 0;
  126. }
  127. /* Following functions are local */
  128. VIDEO_FILTER_WRAPPER( I422_YUY2 )
  129. VIDEO_FILTER_WRAPPER( I422_YVYU )
  130. VIDEO_FILTER_WRAPPER( I422_UYVY )
  131. VIDEO_FILTER_WRAPPER( I422_IUYV )
  132. VIDEO_FILTER_WRAPPER( I422_cyuv )
  133. #if defined (MODULE_NAME_IS_i422_yuy2)
  134. VIDEO_FILTER_WRAPPER( I422_Y211 )
  135. #endif
  136. /*****************************************************************************
  137.  * I422_YUY2: planar YUV 4:2:2 to packed YUY2 4:2:2
  138.  *****************************************************************************/
  139. static void I422_YUY2( filter_t *p_filter, picture_t *p_source,
  140.                                            picture_t *p_dest )
  141. {
  142.     uint8_t *p_line = p_dest->p->p_pixels;
  143.     uint8_t *p_y = p_source->Y_PIXELS;
  144.     uint8_t *p_u = p_source->U_PIXELS;
  145.     uint8_t *p_v = p_source->V_PIXELS;
  146.     int i_x, i_y;
  147.     const int i_source_margin = p_source->p[0].i_pitch
  148.                                  - p_source->p[0].i_visible_pitch;
  149.     const int i_source_margin_c = p_source->p[1].i_pitch
  150.                                  - p_source->p[1].i_visible_pitch;
  151.     const int i_dest_margin = p_dest->p->i_pitch
  152.                                - p_dest->p->i_visible_pitch;
  153. #if defined (MODULE_NAME_IS_i422_yuy2_sse2)
  154.     if( 0 == (15 & (p_source->p[Y_PLANE].i_pitch|p_dest->p->i_pitch|
  155.         ((intptr_t)p_line|(intptr_t)p_y))) )
  156.     {
  157.         /* use faster SSE2 aligned fetch and store */
  158.         for( i_y = p_filter->fmt_in.video.i_height ; i_y-- ; )
  159.         {
  160.             for( i_x = p_filter->fmt_in.video.i_width / 16 ; i_x-- ; )
  161.             {
  162.                 SSE2_CALL( SSE2_YUV422_YUYV_ALIGNED );
  163.             }
  164.             for( i_x = ( p_filter->fmt_in.video.i_width % 16 ) / 2; i_x-- ; )
  165.             {
  166.                 C_YUV422_YUYV( p_line, p_y, p_u, p_v );
  167.             }
  168.             p_y += i_source_margin;
  169.             p_u += i_source_margin_c;
  170.             p_v += i_source_margin_c;
  171.             p_line += i_dest_margin;
  172.         }
  173.     }
  174.     else {
  175.         /* use slower SSE2 unaligned fetch and store */
  176.         for( i_y = p_filter->fmt_in.video.i_height ; i_y-- ; )
  177.         {
  178.             for( i_x = p_filter->fmt_in.video.i_width / 16 ; i_x-- ; )
  179.             {
  180.                 SSE2_CALL( SSE2_YUV422_YUYV_UNALIGNED );
  181.             }
  182.             for( i_x = ( p_filter->fmt_in.video.i_width % 16 ) / 2; i_x-- ; )
  183.             {
  184.                 C_YUV422_YUYV( p_line, p_y, p_u, p_v );
  185.             }
  186.             p_y += i_source_margin;
  187.             p_u += i_source_margin_c;
  188.             p_v += i_source_margin_c;
  189.             p_line += i_dest_margin;
  190.         }
  191.     }
  192.     SSE2_END;
  193. #else
  194.     for( i_y = p_filter->fmt_in.video.i_height ; i_y-- ; )
  195.     {
  196.         for( i_x = p_filter->fmt_in.video.i_width / 8 ; i_x-- ; )
  197.         {
  198. #if defined (MODULE_NAME_IS_i422_yuy2)
  199.             C_YUV422_YUYV( p_line, p_y, p_u, p_v );
  200.             C_YUV422_YUYV( p_line, p_y, p_u, p_v );
  201.             C_YUV422_YUYV( p_line, p_y, p_u, p_v );
  202.             C_YUV422_YUYV( p_line, p_y, p_u, p_v );
  203. #elif defined (MODULE_NAME_IS_i422_yuy2_mmx)
  204.             MMX_CALL( MMX_YUV422_YUYV );
  205. #endif
  206.         }
  207.         for( i_x = ( p_filter->fmt_in.video.i_width % 8 ) / 2; i_x-- ; )
  208.         {
  209.             C_YUV422_YUYV( p_line, p_y, p_u, p_v );
  210.         }
  211.         p_y += i_source_margin;
  212.         p_u += i_source_margin_c;
  213.         p_v += i_source_margin_c;
  214.         p_line += i_dest_margin;
  215.     }
  216. #if defined (MODULE_NAME_IS_i422_yuy2_mmx)
  217.     MMX_END;
  218. #endif
  219. #endif
  220. }
  221. /*****************************************************************************
  222.  * I422_YVYU: planar YUV 4:2:2 to packed YVYU 4:2:2
  223.  *****************************************************************************/
  224. static void I422_YVYU( filter_t *p_filter, picture_t *p_source,
  225.                                            picture_t *p_dest )
  226. {
  227.     uint8_t *p_line = p_dest->p->p_pixels;
  228.     uint8_t *p_y = p_source->Y_PIXELS;
  229.     uint8_t *p_u = p_source->U_PIXELS;
  230.     uint8_t *p_v = p_source->V_PIXELS;
  231.     int i_x, i_y;
  232.     const int i_source_margin = p_source->p[0].i_pitch
  233.                                  - p_source->p[0].i_visible_pitch;
  234.     const int i_source_margin_c = p_source->p[1].i_pitch
  235.                                  - p_source->p[1].i_visible_pitch;
  236.     const int i_dest_margin = p_dest->p->i_pitch
  237.                                - p_dest->p->i_visible_pitch;
  238. #if defined (MODULE_NAME_IS_i422_yuy2_sse2)
  239.     if( 0 == (15 & (p_source->p[Y_PLANE].i_pitch|p_dest->p->i_pitch|
  240.         ((intptr_t)p_line|(intptr_t)p_y))) )
  241.     {
  242.         /* use faster SSE2 aligned fetch and store */
  243.         for( i_y = p_filter->fmt_in.video.i_height ; i_y-- ; )
  244.         {
  245.             for( i_x = p_filter->fmt_in.video.i_width / 16 ; i_x-- ; )
  246.             {
  247.                 SSE2_CALL( SSE2_YUV422_YVYU_ALIGNED );
  248.             }
  249.             for( i_x = ( p_filter->fmt_in.video.i_width % 16 ) / 2; i_x-- ; )
  250.             {
  251.                 C_YUV422_YVYU( p_line, p_y, p_u, p_v );
  252.             }
  253.             p_y += i_source_margin;
  254.             p_u += i_source_margin_c;
  255.             p_v += i_source_margin_c;
  256.             p_line += i_dest_margin;
  257.         }
  258.     }
  259.     else {
  260.         /* use slower SSE2 unaligned fetch and store */
  261.         for( i_y = p_filter->fmt_in.video.i_height ; i_y-- ; )
  262.         {
  263.             for( i_x = p_filter->fmt_in.video.i_width / 16 ; i_x-- ; )
  264.             {
  265.                 SSE2_CALL( SSE2_YUV422_YVYU_UNALIGNED );
  266.             }
  267.             for( i_x = ( p_filter->fmt_in.video.i_width % 16 ) / 2; i_x-- ; )
  268.             {
  269.                 C_YUV422_YVYU( p_line, p_y, p_u, p_v );
  270.             }
  271.             p_y += i_source_margin;
  272.             p_u += i_source_margin_c;
  273.             p_v += i_source_margin_c;
  274.             p_line += i_dest_margin;
  275.         }
  276.     }
  277.     SSE2_END;
  278. #else
  279.     for( i_y = p_filter->fmt_in.video.i_height ; i_y-- ; )
  280.     {
  281.         for( i_x = p_filter->fmt_in.video.i_width / 8 ; i_x-- ; )
  282.         {
  283. #if defined (MODULE_NAME_IS_i422_yuy2)
  284.             C_YUV422_YVYU( p_line, p_y, p_u, p_v );
  285.             C_YUV422_YVYU( p_line, p_y, p_u, p_v );
  286.             C_YUV422_YVYU( p_line, p_y, p_u, p_v );
  287.             C_YUV422_YVYU( p_line, p_y, p_u, p_v );
  288. #elif defined (MODULE_NAME_IS_i422_yuy2_mmx)
  289.             MMX_CALL( MMX_YUV422_YVYU );
  290. #endif
  291.         }
  292.         for( i_x = ( p_filter->fmt_in.video.i_width % 8 ) / 2; i_x-- ; )
  293.         {
  294.             C_YUV422_YVYU( p_line, p_y, p_u, p_v );
  295.         }
  296.         p_y += i_source_margin;
  297.         p_u += i_source_margin_c;
  298.         p_v += i_source_margin_c;
  299.         p_line += i_dest_margin;
  300.     }
  301. #if defined (MODULE_NAME_IS_i422_yuy2_mmx)
  302.     MMX_END;
  303. #endif
  304. #endif
  305. }
  306. /*****************************************************************************
  307.  * I422_UYVY: planar YUV 4:2:2 to packed UYVY 4:2:2
  308.  *****************************************************************************/
  309. static void I422_UYVY( filter_t *p_filter, picture_t *p_source,
  310.                                            picture_t *p_dest )
  311. {
  312.     uint8_t *p_line = p_dest->p->p_pixels;
  313.     uint8_t *p_y = p_source->Y_PIXELS;
  314.     uint8_t *p_u = p_source->U_PIXELS;
  315.     uint8_t *p_v = p_source->V_PIXELS;
  316.     int i_x, i_y;
  317.     const int i_source_margin = p_source->p[0].i_pitch
  318.                                  - p_source->p[0].i_visible_pitch;
  319.     const int i_source_margin_c = p_source->p[1].i_pitch
  320.                                  - p_source->p[1].i_visible_pitch;
  321.     const int i_dest_margin = p_dest->p->i_pitch
  322.                                - p_dest->p->i_visible_pitch;
  323. #if defined (MODULE_NAME_IS_i422_yuy2_sse2)
  324.     if( 0 == (15 & (p_source->p[Y_PLANE].i_pitch|p_dest->p->i_pitch|
  325.         ((intptr_t)p_line|(intptr_t)p_y))) )
  326.     {
  327.         /* use faster SSE2 aligned fetch and store */
  328.         for( i_y = p_filter->fmt_in.video.i_height ; i_y-- ; )
  329.         {
  330.             for( i_x = p_filter->fmt_in.video.i_width / 16 ; i_x-- ; )
  331.             {
  332.                 SSE2_CALL( SSE2_YUV422_UYVY_ALIGNED );
  333.             }
  334.             for( i_x = ( p_filter->fmt_in.video.i_width % 16 ) / 2; i_x-- ; )
  335.             {
  336.                 C_YUV422_UYVY( p_line, p_y, p_u, p_v );
  337.             }
  338.             p_y += i_source_margin;
  339.             p_u += i_source_margin_c;
  340.             p_v += i_source_margin_c;
  341.             p_line += i_dest_margin;
  342.         }
  343.     }
  344.     else {
  345.         /* use slower SSE2 unaligned fetch and store */
  346.         for( i_y = p_filter->fmt_in.video.i_height ; i_y-- ; )
  347.         {
  348.             for( i_x = p_filter->fmt_in.video.i_width / 16 ; i_x-- ; )
  349.             {
  350.                 SSE2_CALL( SSE2_YUV422_UYVY_UNALIGNED );
  351.             }
  352.             for( i_x = ( p_filter->fmt_in.video.i_width % 16 ) / 2; i_x-- ; )
  353.             {
  354.                 C_YUV422_UYVY( p_line, p_y, p_u, p_v );
  355.             }
  356.             p_y += i_source_margin;
  357.             p_u += i_source_margin_c;
  358.             p_v += i_source_margin_c;
  359.             p_line += i_dest_margin;
  360.         }
  361.     }
  362.     SSE2_END;
  363. #else
  364.     for( i_y = p_filter->fmt_in.video.i_height ; i_y-- ; )
  365.     {
  366.         for( i_x = p_filter->fmt_in.video.i_width / 8 ; i_x-- ; )
  367.         {
  368. #if defined (MODULE_NAME_IS_i422_yuy2)
  369.             C_YUV422_UYVY( p_line, p_y, p_u, p_v );
  370.             C_YUV422_UYVY( p_line, p_y, p_u, p_v );
  371.             C_YUV422_UYVY( p_line, p_y, p_u, p_v );
  372.             C_YUV422_UYVY( p_line, p_y, p_u, p_v );
  373. #elif defined (MODULE_NAME_IS_i422_yuy2_mmx)
  374.             MMX_CALL( MMX_YUV422_UYVY );
  375. #endif
  376.         }
  377.         for( i_x = ( p_filter->fmt_in.video.i_width % 8 ) / 2; i_x-- ; )
  378.         {
  379.             C_YUV422_UYVY( p_line, p_y, p_u, p_v );
  380.         }
  381.         p_y += i_source_margin;
  382.         p_u += i_source_margin_c;
  383.         p_v += i_source_margin_c;
  384.         p_line += i_dest_margin;
  385.     }
  386. #if defined (MODULE_NAME_IS_i422_yuy2_mmx)
  387.     MMX_END;
  388. #endif
  389. #endif
  390. }
  391. /*****************************************************************************
  392.  * I422_IUYV: planar YUV 4:2:2 to interleaved packed IUYV 4:2:2
  393.  *****************************************************************************/
  394. static void I422_IUYV( filter_t *p_filter, picture_t *p_source,
  395.                                            picture_t *p_dest )
  396. {
  397.     VLC_UNUSED(p_source); VLC_UNUSED(p_dest);
  398.     /* FIXME: TODO ! */
  399.     msg_Err( p_filter, "I422_IUYV unimplemented, please harass <sam@zoy.org>" );
  400. }
  401. /*****************************************************************************
  402.  * I422_cyuv: planar YUV 4:2:2 to upside-down packed UYVY 4:2:2
  403.  *****************************************************************************/
  404. static void I422_cyuv( filter_t *p_filter, picture_t *p_source,
  405.                                            picture_t *p_dest )
  406. {
  407.     uint8_t *p_line = p_dest->p->p_pixels + p_dest->p->i_visible_lines * p_dest->p->i_pitch;
  408.     uint8_t *p_y = p_source->Y_PIXELS;
  409.     uint8_t *p_u = p_source->U_PIXELS;
  410.     uint8_t *p_v = p_source->V_PIXELS;
  411.     int i_x, i_y;
  412.     const int i_source_margin = p_source->p[0].i_pitch
  413.                                  - p_source->p[0].i_visible_pitch;
  414.     const int i_source_margin_c = p_source->p[1].i_pitch
  415.                                  - p_source->p[1].i_visible_pitch;
  416.     const int i_dest_margin = p_dest->p->i_pitch
  417.                                - p_dest->p->i_visible_pitch;
  418. #if defined (MODULE_NAME_IS_i422_yuy2_sse2)
  419.     if( 0 == (15 & (p_source->p[Y_PLANE].i_pitch|p_dest->p->i_pitch|
  420.         ((intptr_t)p_line|(intptr_t)p_y))) )
  421.     {
  422.         /* use faster SSE2 aligned fetch and store */
  423.         for( i_y = p_filter->fmt_in.video.i_height ; i_y-- ; )
  424.         {
  425.             p_line -= 2 * p_dest->p->i_pitch;
  426.             for( i_x = p_filter->fmt_in.video.i_width / 16 ; i_x-- ; )
  427.             {
  428.                 SSE2_CALL( SSE2_YUV422_UYVY_ALIGNED );
  429.             }
  430.             for( i_x = ( p_filter->fmt_in.video.i_width % 16 ) / 2; i_x-- ; )
  431.             {
  432.                 C_YUV422_UYVY( p_line, p_y, p_u, p_v );
  433.             }
  434.             p_y += i_source_margin;
  435.             p_u += i_source_margin_c;
  436.             p_v += i_source_margin_c;
  437.             p_line += i_dest_margin;
  438.         }
  439.     }
  440.     else {
  441.         /* use slower SSE2 unaligned fetch and store */
  442.         for( i_y = p_filter->fmt_in.video.i_height ; i_y-- ; )
  443.         {
  444.             p_line -= 2 * p_dest->p->i_pitch;
  445.             for( i_x = p_filter->fmt_in.video.i_width / 16 ; i_x-- ; )
  446.             {
  447.                 SSE2_CALL( SSE2_YUV422_UYVY_UNALIGNED );
  448.             }
  449.             for( i_x = ( p_filter->fmt_in.video.i_width % 16 ) / 2; i_x-- ; )
  450.             {
  451.                 C_YUV422_UYVY( p_line, p_y, p_u, p_v );
  452.             }
  453.             p_y += i_source_margin;
  454.             p_u += i_source_margin_c;
  455.             p_v += i_source_margin_c;
  456.             p_line += i_dest_margin;
  457.         }
  458.     }
  459.     SSE2_END;
  460. #else
  461.     for( i_y = p_filter->fmt_in.video.i_height ; i_y-- ; )
  462.     {
  463.         for( i_x = p_filter->fmt_in.video.i_width / 8 ; i_x-- ; )
  464.         {
  465.             p_line -= 2 * p_dest->p->i_pitch;
  466. #if defined (MODULE_NAME_IS_i422_yuy2)
  467.             C_YUV422_UYVY( p_line, p_y, p_u, p_v );
  468.             C_YUV422_UYVY( p_line, p_y, p_u, p_v );
  469.             C_YUV422_UYVY( p_line, p_y, p_u, p_v );
  470.             C_YUV422_UYVY( p_line, p_y, p_u, p_v );
  471. #elif defined (MODULE_NAME_IS_i422_yuy2_mmx)
  472.             MMX_CALL( MMX_YUV422_UYVY );
  473. #endif
  474.         }
  475.         p_y += i_source_margin;
  476.         p_u += i_source_margin_c;
  477.         p_v += i_source_margin_c;
  478.         p_line += i_dest_margin;
  479.     }
  480. #if defined (MODULE_NAME_IS_i422_yuy2_mmx)
  481.     MMX_END;
  482. #elif defined (MODULE_NAME_IS_i422_yuy2_sse2)
  483.     SSE2_END;
  484. #endif
  485. #endif
  486. }
  487. /*****************************************************************************
  488.  * I422_Y211: planar YUV 4:2:2 to packed YUYV 2:1:1
  489.  *****************************************************************************/
  490. #if defined (MODULE_NAME_IS_i422_yuy2)
  491. static void I422_Y211( filter_t *p_filter, picture_t *p_source,
  492.                                            picture_t *p_dest )
  493. {
  494.     uint8_t *p_line = p_dest->p->p_pixels + p_dest->p->i_visible_lines * p_dest->p->i_pitch;
  495.     uint8_t *p_y = p_source->Y_PIXELS;
  496.     uint8_t *p_u = p_source->U_PIXELS;
  497.     uint8_t *p_v = p_source->V_PIXELS;
  498.     int i_x, i_y;
  499.     for( i_y = p_filter->fmt_in.video.i_height ; i_y-- ; )
  500.     {
  501.         for( i_x = p_filter->fmt_in.video.i_width / 8 ; i_x-- ; )
  502.         {
  503.             C_YUV422_Y211( p_line, p_y, p_u, p_v );
  504.             C_YUV422_Y211( p_line, p_y, p_u, p_v );
  505.         }
  506.     }
  507. }
  508. #endif