1
0
mirror of https://github.com/mpv-player/mpv synced 2024-12-27 09:32:40 +00:00

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

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@31303 b3059339-0415-0410-9bf9-f77b7e298cf2
This commit is contained in:
siretart 2010-06-01 21:07:02 +00:00
parent 988b04eb2d
commit 1cbf1ec468

View File

@ -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){