]> git.sesse.net Git - vlc/commitdiff
YUV MMX, avec aspect ratio !!!
authorVincent Seguin <seguin@videolan.org>
Tue, 18 Jan 2000 23:43:52 +0000 (23:43 +0000)
committerVincent Seguin <seguin@videolan.org>
Tue, 18 Jan 2000 23:43:52 +0000 (23:43 +0000)
Makefile
include/video_yuv.h
src/video_output/video_yuv.c
src/video_output/video_yuv_mmx.S

index f2a4673dba9fbd09831498f1615d5e9f816d99c6..1645e93a67cf18d22c20ef5e00487b74e269886b 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -22,7 +22,7 @@ VIDEO=X11
 
 # Target architecture and optimization
 #ARCH=
-#ARCH=MMX
+ARCH=MMX
 #ARCH=PPC
 
 # Decoder choice - ?? old decoder will be removed soon
index 4a80108802599d173256787ad778c5006f7502c5..6b682ab942fbe5a79efb2e235e2feca22621eec4 100644 (file)
@@ -13,3 +13,25 @@ int             vout_InitTables      ( vout_thread_t *p_vout );
 int             vout_ResetTables     ( vout_thread_t *p_vout );
 void            vout_EndTables       ( vout_thread_t *p_vout );
 
+/*******************************************************************************
+ * External prototypes
+ *******************************************************************************/
+#ifdef HAVE_MMX
+
+/* YUV transformations for MMX - in video_yuv_mmx.S 
+ *      p_y, p_u, p_v:          Y U and V planes
+ *      i_width, i_height:      frames dimensions (pixels)
+ *      i_ypitch, i_vpitch:     Y and V lines sizes (bytes)
+ *      i_aspect:               vertical aspect factor
+ *      p_pic:                  RGB frame
+ *      i_dci_offset:           ?? x offset for left image border
+ *      i_offset_to_line_0:     ?? x offset for left image border
+ *      i_pitch:                RGB line size (bytes)
+ *      i_colortype:            0 for 565, 1 for 555 */
+void ConvertYUV420RGB16MMX( u8* p_y, u8* p_u, u8 *p_v, 
+                            unsigned int i_width, unsigned int i_height,
+                            unsigned int i_ypitch, unsigned int i_vpitch,
+                            unsigned int i_aspect, u8 *p_pic, 
+                            u32 i_dci_offset, u32 i_offset_to_line_0,
+                            int CCOPitch, int i_colortype );
+#endif
index 47bbfdb7cd6e9448e420c27e192c877446eb4e58..10be5be91842cd519db042c5e29a14ccf1dd9a8a 100644 (file)
@@ -25,6 +25,7 @@
 #include "vlc_thread.h"
 #include "video.h"
 #include "video_output.h"
+#include "video_yuv.h"
 #include "intf_msg.h"
 
 /*******************************************************************************
@@ -276,8 +277,26 @@ int vout_InitTables( vout_thread_t *p_vout )
     size_t      tables_size;                          /* tables size, in bytes */
     
     /* Computes tables size */
-    //??
-    tables_size = 4 * 4 * 1024;    
+    switch( p_vout->i_screen_depth )
+    {
+    case 15:
+    case 16:
+        tables_size = sizeof( u16 ) * 1024 * (p_vout->b_grayscale ? 1 : 3);
+        break;        
+    case 24:        
+    case 32:
+#ifndef DEBUG
+    default:        
+#endif
+        tables_size = sizeof( u32 ) * 1024 * (p_vout->b_grayscale ? 1 : 3);        
+        break;        
+#ifdef DEBUG
+    default:
+        intf_DbgMsg("error: invalid screen depth %d\n", p_vout->i_screen_depth );
+        tables_size = 0;
+        break;        
+#endif      
+    }
     
     /* Allocate memory */
     p_vout->tables.p_base = malloc( tables_size );
@@ -300,7 +319,7 @@ int vout_InitTables( vout_thread_t *p_vout )
  *******************************************************************************/
 int vout_ResetTables( vout_thread_t *p_vout )
 {
-    // ?? realloc ?
+    // ?? realloc if b_grayscale or i_screen_depth changed
     SetTables( p_vout );
     return( 0 );    
 }
@@ -597,6 +616,17 @@ static void ConvertYUV420RGB16( p_vout_thread_t p_vout, u16 *p_pic,
                                 int i_width, int i_height, int i_eol, int i_pic_eol,
                                 int i_scale, int i_matrix_coefficients )
 {
+#ifdef HAVE_MMX
+    int         i_chroma_width, i_chroma_eol;      /* width and eol for chroma */
+
+    i_chroma_width =    i_width / 2;
+    i_chroma_eol =      i_eol / 2;
+    ConvertYUV420RGB16MMX( p_y, p_u, p_v, i_width, i_height, 
+                           (i_width + i_eol) * sizeof( yuv_data_t ), 
+                           (i_chroma_width + i_chroma_eol) * sizeof( yuv_data_t),
+                           i_scale, (u8 *)p_pic, 0, 0, (i_width + i_pic_eol) * sizeof( u16 ),
+                           p_vout->i_screen_depth == 15 );    
+#else
     u16 *       p_pic_src;                   /* source pointer in case of copy */
     u16 *       p_red;                                            /* red table */
     u16 *       p_green;                                        /* green table */
@@ -616,6 +646,7 @@ static void ConvertYUV420RGB16( p_vout_thread_t p_vout, u16 *p_pic,
     i_chroma_width =    i_width / 2;
     i_chroma_eol =      i_eol / 2;
     CONVERT_YUV_RGB( 420 )
+#endif
 }
 
 /*******************************************************************************
@@ -823,35 +854,8 @@ static void Scale32( p_vout_thread_t p_vout, void *p_pic, void *p_buffer,
     //???
 }
 
-//-------------------------
-
-/*******************************************************************************
- * External prototypes
- *******************************************************************************/
-#ifdef HAVE_MMX
-/* YUV transformations for MMX - in video_yuv_mmx.S 
- *      p_y, p_u, p_v:          Y U and V planes
- *      i_width, i_height:      frames dimensions (pixels)
- *      i_ypitch, i_vpitch:     Y and V lines sizes (bytes)
- *      i_aspect:               vertical aspect factor
- *      p_pic:                  RGB frame
- *      i_dci_offset:           ?? x offset for left image border
- *      i_offset_to_line_0:     ?? x offset for left image border
- *      i_pitch:                RGB line size (bytes)
- *      i_colortype:            0 for 565, 1 for 555 */
-static YUV420_16_MMX( u8* p_y, u8* p_u, u8 *p_v, 
-                         unsigned int i_width, unsigned int i_height,
-                         unsigned int i_ypitch, unsigned int i_vpitch,
-                         unsigned int i_aspect, u8 *p_pic, 
-                         u32 i_dci_offset, u32 i_offset_to_line_0,
-                         int CCOPitch, int i_colortype );
-#endif
-
 //-------------------- walken code follow --------------------------------
 
-
-
-
 /*
  * YUV to RGB routines.
  *
index 0b3c9db7af3ec96dd684f95a79756621a0e890fa..7010a32982fcb011bb82f3bb2a1d80a48546e562 100644 (file)
@@ -90,7 +90,7 @@ sixbitu:            .quad 0xc0c0c0c0c0c0c0c0
 #define BUpperLimit      148
 
 /*
- * extern void C vout_YUV420_16_MMX (
+ * extern void C ConvertYUV420RGB16MMX (
  *                                     U8* YPlane,
  *                                     U8* UPlane,
  *                                     U8* VPlane,
@@ -116,8 +116,8 @@ sixbitu:            .quad 0xc0c0c0c0c0c0c0c0
  *    RGB655 = 3
  */
 
-.globl vout_YUV420_16_MMX
-vout_YUV420_16_MMX: 
+.globl ConvertYUV420RGB16MMX
+ConvertYUV420RGB16MMX: 
   pushl      %esi
   pushl      %edi