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

siretart subversion at mplayerhq.hu
Tue Jun 1 23:07:02 CEST 2010


Author: siretart
Date: Tue Jun  1 23:07:02 2010
New Revision: 31303

Log:
avoid using swscale internals by copying in palette8torbg16 and its bgr variant

Modified:
   trunk/libmpcodecs/vf_palette.c

Modified: trunk/libmpcodecs/vf_palette.c
==============================================================================
--- trunk/libmpcodecs/vf_palette.c	Tue Jun  1 22:12:58 2010	(r31302)
+++ trunk/libmpcodecs/vf_palette.c	Tue Jun  1 23:07:02 2010	(r31303)
@@ -28,9 +28,9 @@
 #include "img_format.h"
 #include "mp_image.h"
 #include "vf.h"
+#include "mpbswap.h"
 
 #include "libswscale/swscale.h"
-#include "libswscale/rgb2rgb.h"
 
 //===========================================================================//
 
@@ -53,6 +53,23 @@ static const unsigned int rgb_list[]={
     0
 };
 
+/**
+ * Palette is assumed to contain BGR16, see rgb32to16 to convert the palette.
+ */
+static void palette8torgb16(const uint8_t *src, uint8_t *dst, long num_pixels, const uint8_t *palette)
+{
+    long i;
+    for (i=0; i<num_pixels; i++)
+        ((uint16_t *)dst)[i] = ((const uint16_t *)palette)[src[i]];
+}
+
+static void palette8tobgr16(const uint8_t *src, uint8_t *dst, long num_pixels, const uint8_t *palette)
+{
+    long i;
+    for (i=0; i<num_pixels; i++)
+        ((uint16_t *)dst)[i] = bswap_16(((const uint16_t *)palette)[src[i]]);
+}
+
 static unsigned int gray_pal[256];
 
 static unsigned int find_best(struct vf_instance *vf, unsigned int fmt){


More information about the MPlayer-cvslog mailing list