[MPlayer-cvslog] r31718 - trunk/libvo/vo_tga.c

reimar subversion at mplayerhq.hu
Sun Jul 11 23:25:06 CEST 2010


Author: reimar
Date: Sun Jul 11 23:25:06 2010
New Revision: 31718

Log:
Fix vo_tga RGB with alpha output on little-endian (blue and alpha were swapped),
and simpify by letting libswscale do everything, since it nowadays supports
alpha. This has the side-effect of actually producing a useful alpha channel
when one is encoded in the video.
Patch by Marton Balint [cus fazekas.hu]

Modified:
   trunk/libvo/vo_tga.c

Modified: trunk/libvo/vo_tga.c
==============================================================================
--- trunk/libvo/vo_tga.c	Sun Jul 11 23:14:48 2010	(r31717)
+++ trunk/libvo/vo_tga.c	Sun Jul 11 23:25:06 2010	(r31718)
@@ -68,7 +68,6 @@ const LIBVO_EXTERN (tga)
 
 /* locals vars */
 static int      frame_num = 0;
-static void     *line_buff;
 
 static void tga_make_header(uint8_t *h, int dx, int dy, int bpp)
 {
@@ -128,39 +127,6 @@ static int write_tga( char *file, int bp
             int    wb;
 
             wb = ((bpp + 7) / 8) * dx;
-            if (bpp == 32) {
-                /* Setup the alpha channel for every pixel */
-                while (dy-- > 0) {
-                    uint8_t    *d;
-                    uint8_t    *s;
-                    int         x;
-
-                    s = buf;
-                    d = line_buff;
-                    for(x = 0; x < dx; x++) {
-                    #if HAVE_BIGENDIAN
-                        d[0] = s[3];
-                        d[1] = s[2];
-                        d[2] = s[1];
-                        d[3] = 0xff;
-                    #else
-                        d[0] = 0xff;
-                        d[1] = s[1];
-                        d[2] = s[2];
-                        d[3] = s[3];
-                    #endif
-                        d+=4;
-                        s+=4;
-                    }
-                    if (fwrite(line_buff, wb, 1, fo) != 1) {
-                        er = 4;
-                        break;
-                    }
-                    buf += stride;
-                }
-
-            }
-            else {
                 while (dy-- > 0) {
                     if (fwrite(buf, wb, 1, fo) != 1) {
                         er = 4;
@@ -168,7 +134,6 @@ static int write_tga( char *file, int bp
                     }
                     buf += stride;
                 }
-            }
         }
         else {
             er = 2;
@@ -204,11 +169,6 @@ static uint32_t draw_image(mp_image_t* m
 
 static int config(uint32_t width, uint32_t height, uint32_t d_width, uint32_t d_height, uint32_t flags, char *title, uint32_t format)
 {
-    /* buffer for alpha */
-    if(line_buff){ free(line_buff); line_buff=NULL; }
-    if (format == (IMGFMT_BGR | 32)) {
-        line_buff = malloc(width * 4);
-    }
     return 0;
 }
 
@@ -236,7 +196,7 @@ static int query_format(uint32_t format)
     switch(format){
         case IMGFMT_BGR|15:
         case IMGFMT_BGR|24:
-        case IMGFMT_BGR|32:
+        case IMGFMT_BGRA:
             return VFCAP_CSP_SUPPORTED | VFCAP_CSP_SUPPORTED_BY_HW;
     }
     return 0;
@@ -244,7 +204,6 @@ static int query_format(uint32_t format)
 
 static void uninit(void)
 {
-    if(line_buff){ free(line_buff); line_buff=NULL; }
 }
 
 static void check_events(void)


More information about the MPlayer-cvslog mailing list