mirror of
https://github.com/mpv-player/mpv
synced 2025-01-05 03:06:28 +01:00
bgr32to16, bgr32to15 (needed for palette stuff)
paletteto 32,16,15bgr all in c, will be optimized as soon as they are tested (assuming opt. is possible) git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@2695 b3059339-0415-0410-9bf9-f77b7e298cf2
This commit is contained in:
parent
78ab9a9f1d
commit
199e88d20c
@ -1,4 +1,4 @@
|
||||
/*
|
||||
/*
|
||||
*
|
||||
* rgb2rgb.c, Software RGB to RGB convertor
|
||||
* Written by Nick Kurshev.
|
||||
@ -170,3 +170,60 @@ void rgb15to16(const uint8_t *src,uint8_t *dst,uint32_t src_size)
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
* Pallete is assumed to contain bgr32
|
||||
*/
|
||||
void palette8torgb32(uint8_t *src, uint8_t *dst, int src_size, uint8_t *palette)
|
||||
{
|
||||
int i;
|
||||
for(i=0; i<src_size; i++)
|
||||
((uint32_t *)dst)[i] = ((uint32_t *)palette)[ src[i] ];
|
||||
}
|
||||
|
||||
void rgb32to16(uint8_t *src, uint8_t *dst, int src_size)
|
||||
{
|
||||
int i;
|
||||
for(i=0; i<src_size; i+=4)
|
||||
{
|
||||
const int b= src[i+0];
|
||||
const int g= src[i+1];
|
||||
const int r= src[i+2];
|
||||
|
||||
((uint16_t *)dst)[i]= (b>>3) | ((g&0xFC)<<3) | ((r&0xF8)<<8);
|
||||
}
|
||||
}
|
||||
|
||||
void rgb32to15(uint8_t *src, uint8_t *dst, int src_size)
|
||||
{
|
||||
int i;
|
||||
for(i=0; i<src_size; i+=4)
|
||||
{
|
||||
const int b= src[i+0];
|
||||
const int g= src[i+1];
|
||||
const int r= src[i+2];
|
||||
|
||||
((uint16_t *)dst)[i]= (b>>3) | ((g&0xF8)<<3) | ((r&0xF8)<<7);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Palette is assumed to contain bgr16, see rgb32to16 to convert the palette
|
||||
*/
|
||||
void palette8torgb16(uint8_t *src, uint8_t *dst, int src_size, uint8_t *palette)
|
||||
{
|
||||
int i;
|
||||
for(i=0; i<src_size; i++)
|
||||
((uint16_t *)dst)[i] = ((uint16_t *)palette)[ src[i] ];
|
||||
}
|
||||
|
||||
/**
|
||||
* Pallete is assumed to contain bgr15, see rgb32to15 to convert the palette
|
||||
*/
|
||||
void palette8torgb15(uint8_t *src, uint8_t *dst, int src_size, uint8_t *palette)
|
||||
{
|
||||
int i;
|
||||
for(i=0; i<src_size; i++)
|
||||
((uint16_t *)dst)[i] = ((uint16_t *)palette)[ src[i] ];
|
||||
}
|
@ -1,4 +1,4 @@
|
||||
/*
|
||||
/*
|
||||
*
|
||||
* rgb2rgb.h, Software RGB to RGB convertor
|
||||
*
|
||||
@ -11,4 +11,11 @@ extern void rgb24to32(const uint8_t *src,uint8_t *dst,uint32_t src_size);
|
||||
extern void rgb32to24(const uint8_t *src,uint8_t *dst,uint32_t src_size);
|
||||
extern void rgb15to16(const uint8_t *src,uint8_t *dst,uint32_t src_size);
|
||||
|
||||
void rgb32to16(uint8_t *src, uint8_t *dst, int src_size);
|
||||
void rgb32to15(uint8_t *src, uint8_t *dst, int src_size);
|
||||
void palette8torgb32(uint8_t *src, uint8_t *dst, int src_size, uint8_t *palette);
|
||||
void palette8torgb16(uint8_t *src, uint8_t *dst, int src_size, uint8_t *palette);
|
||||
void palette8torgb15(uint8_t *src, uint8_t *dst, int src_size, uint8_t *palette);
|
||||
|
||||
|
||||
#endif
|
||||
|
@ -1,4 +1,4 @@
|
||||
/*
|
||||
/*
|
||||
*
|
||||
* rgb2rgb.c, Software RGB to RGB convertor
|
||||
* Written by Nick Kurshev.
|
||||
@ -170,3 +170,60 @@ void rgb15to16(const uint8_t *src,uint8_t *dst,uint32_t src_size)
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
* Pallete is assumed to contain bgr32
|
||||
*/
|
||||
void palette8torgb32(uint8_t *src, uint8_t *dst, int src_size, uint8_t *palette)
|
||||
{
|
||||
int i;
|
||||
for(i=0; i<src_size; i++)
|
||||
((uint32_t *)dst)[i] = ((uint32_t *)palette)[ src[i] ];
|
||||
}
|
||||
|
||||
void rgb32to16(uint8_t *src, uint8_t *dst, int src_size)
|
||||
{
|
||||
int i;
|
||||
for(i=0; i<src_size; i+=4)
|
||||
{
|
||||
const int b= src[i+0];
|
||||
const int g= src[i+1];
|
||||
const int r= src[i+2];
|
||||
|
||||
((uint16_t *)dst)[i]= (b>>3) | ((g&0xFC)<<3) | ((r&0xF8)<<8);
|
||||
}
|
||||
}
|
||||
|
||||
void rgb32to15(uint8_t *src, uint8_t *dst, int src_size)
|
||||
{
|
||||
int i;
|
||||
for(i=0; i<src_size; i+=4)
|
||||
{
|
||||
const int b= src[i+0];
|
||||
const int g= src[i+1];
|
||||
const int r= src[i+2];
|
||||
|
||||
((uint16_t *)dst)[i]= (b>>3) | ((g&0xF8)<<3) | ((r&0xF8)<<7);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Palette is assumed to contain bgr16, see rgb32to16 to convert the palette
|
||||
*/
|
||||
void palette8torgb16(uint8_t *src, uint8_t *dst, int src_size, uint8_t *palette)
|
||||
{
|
||||
int i;
|
||||
for(i=0; i<src_size; i++)
|
||||
((uint16_t *)dst)[i] = ((uint16_t *)palette)[ src[i] ];
|
||||
}
|
||||
|
||||
/**
|
||||
* Pallete is assumed to contain bgr15, see rgb32to15 to convert the palette
|
||||
*/
|
||||
void palette8torgb15(uint8_t *src, uint8_t *dst, int src_size, uint8_t *palette)
|
||||
{
|
||||
int i;
|
||||
for(i=0; i<src_size; i++)
|
||||
((uint16_t *)dst)[i] = ((uint16_t *)palette)[ src[i] ];
|
||||
}
|
Loading…
Reference in New Issue
Block a user