[MPlayer-cvslog] r37629 - trunk/libmpcodecs/vf_palette.c

reimar subversion at mplayerhq.hu
Mon Feb 8 22:35:21 CET 2016


Author: reimar
Date: Mon Feb  8 22:35:21 2016
New Revision: 37629

Log:
vf_palette: remove pointless conditions.

Pointless to have the same code in the if and
the else path, RGB and BGR actually behave the
same in most cases.
Fixes Coverity issue.

Modified:
   trunk/libmpcodecs/vf_palette.c

Modified: trunk/libmpcodecs/vf_palette.c
==============================================================================
--- trunk/libmpcodecs/vf_palette.c	Mon Feb  8 22:29:57 2016	(r37628)
+++ trunk/libmpcodecs/vf_palette.c	Mon Feb  8 22:35:21 2016	(r37629)
@@ -77,6 +77,7 @@ static unsigned int find_best(struct vf_
     unsigned int best=0;
     int ret;
     const unsigned int* p;
+    // output RGB vs. BGR must match palette format
     if(fmt==IMGFMT_BGR8) p=bgr_list;
     else if(fmt==IMGFMT_RGB8) p=rgb_list;
     else return 0;
@@ -140,16 +141,10 @@ static int put_image(struct vf_instance
                 palette8torgb16(mpi->planes[0],dmpi->planes[0],mpi->h*mpi->w,mpi->planes[1]);
             break;
         case 24:
-            if (IMGFMT_IS_BGR(dmpi->imgfmt))
-                sws_convertPalette8ToPacked24(mpi->planes[0],dmpi->planes[0],mpi->h*mpi->w,mpi->planes[1]);
-            else
-                sws_convertPalette8ToPacked24(mpi->planes[0],dmpi->planes[0],mpi->h*mpi->w,mpi->planes[1]);
+            sws_convertPalette8ToPacked24(mpi->planes[0],dmpi->planes[0],mpi->h*mpi->w,mpi->planes[1]);
             break;
         case 32:
-            if (IMGFMT_IS_BGR(dmpi->imgfmt))
-                sws_convertPalette8ToPacked32(mpi->planes[0],dmpi->planes[0],mpi->h*mpi->w,mpi->planes[1]);
-            else
-                sws_convertPalette8ToPacked32(mpi->planes[0],dmpi->planes[0],mpi->h*mpi->w,mpi->planes[1]);
+            sws_convertPalette8ToPacked32(mpi->planes[0],dmpi->planes[0],mpi->h*mpi->w,mpi->planes[1]);
             break;
         }
     } else {
@@ -166,16 +161,10 @@ static int put_image(struct vf_instance
                     palette8torgb16(src,dst,mpi->w,mpi->planes[1]);
                 break;
             case 24:
-                if (IMGFMT_IS_BGR(dmpi->imgfmt))
-                    sws_convertPalette8ToPacked24(src,dst,mpi->w,mpi->planes[1]);
-                else
-                    sws_convertPalette8ToPacked24(src,dst,mpi->w,mpi->planes[1]);
+                sws_convertPalette8ToPacked24(src,dst,mpi->w,mpi->planes[1]);
                 break;
             case 32:
-                if (IMGFMT_IS_BGR(dmpi->imgfmt))
-                    sws_convertPalette8ToPacked32(src,dst,mpi->w,mpi->planes[1]);
-                else
-                    sws_convertPalette8ToPacked32(src,dst,mpi->w,mpi->planes[1]);
+                sws_convertPalette8ToPacked32(src,dst,mpi->w,mpi->planes[1]);
                 break;
             }
         }


More information about the MPlayer-cvslog mailing list