Partial (low bits ignored, no direct transcoding into other RGB formats) support

for inputting RGB48BE/LE.

Originally committed as revision 29341 to svn://svn.mplayerhq.hu/mplayer/trunk/libswscale
release/0.6
Kostya Shishkov 16 years ago
parent b2984add80
commit e8417235d0
  1. 44
      libswscale/swscale.c
  2. 4
      libswscale/swscale_internal.h
  3. 14
      libswscale/swscale_template.c

@ -108,6 +108,8 @@ unsigned swscale_version(void)
|| (x)==PIX_FMT_YUVA420P \
|| (x)==PIX_FMT_YUYV422 \
|| (x)==PIX_FMT_UYVY422 \
|| (x)==PIX_FMT_RGB48BE \
|| (x)==PIX_FMT_RGB48LE \
|| (x)==PIX_FMT_RGB32 \
|| (x)==PIX_FMT_RGB32_1 \
|| (x)==PIX_FMT_BGR24 \
@ -1122,6 +1124,48 @@ static void fillPlane(uint8_t* plane, int stride, int width, int height, int y,
}
}
static inline void rgb48ToY(uint8_t *dst, const uint8_t *src, int width)
{
int i;
for (i = 0; i < width; i++) {
int r = src[i*6+0];
int g = src[i*6+2];
int b = src[i*6+4];
dst[i] = (RY*r + GY*g + BY*b + (33<<(RGB2YUV_SHIFT-1))) >> RGB2YUV_SHIFT;
}
}
static inline void rgb48ToUV(uint8_t *dstU, uint8_t *dstV,
uint8_t *src1, uint8_t *src2, int width)
{
int i;
assert(src1==src2);
for (i = 0; i < width; i++) {
int r = src1[6*i + 0];
int g = src1[6*i + 2];
int b = src1[6*i + 4];
dstU[i] = (RU*r + GU*g + BU*b + (257<<(RGB2YUV_SHIFT-1))) >> RGB2YUV_SHIFT;
dstV[i] = (RV*r + GV*g + BV*b + (257<<(RGB2YUV_SHIFT-1))) >> RGB2YUV_SHIFT;
}
}
static inline void rgb48ToUV_half(uint8_t *dstU, uint8_t *dstV,
uint8_t *src1, uint8_t *src2, int width)
{
int i;
assert(src1==src2);
for (i = 0; i < width; i++) {
int r= src1[12*i + 0] + src1[12*i + 6];
int g= src1[12*i + 2] + src1[12*i + 8];
int b= src1[12*i + 4] + src1[12*i + 10];
dstU[i]= (RU*r + GU*g + BU*b + (257<<RGB2YUV_SHIFT)) >> (RGB2YUV_SHIFT+1);
dstV[i]= (RV*r + GV*g + BV*b + (257<<RGB2YUV_SHIFT)) >> (RGB2YUV_SHIFT+1);
}
}
#define BGR2Y(type, name, shr, shg, shb, maskr, maskg, maskb, RY, GY, BY, S)\
static inline void name(uint8_t *dst, const uint8_t *src, long width, uint32_t *unused)\
{\

@ -344,7 +344,9 @@ const char *sws_format_name(int format);
|| (x)==PIX_FMT_GRAY16LE \
)
#define isRGB(x) ( \
(x)==PIX_FMT_RGB32 \
(x)==PIX_FMT_RGB48BE \
|| (x)==PIX_FMT_RGB48LE \
|| (x)==PIX_FMT_RGB32 \
|| (x)==PIX_FMT_RGB32_1 \
|| (x)==PIX_FMT_RGB24 \
|| (x)==PIX_FMT_RGB565 \

@ -2235,6 +2235,9 @@ static inline void RENAME(hyscale)(SwsContext *c, uint16_t *dst, long dstWidth,
src += ALT32_CORR;
}
if (srcFormat == PIX_FMT_RGB48LE)
src++;
if (internal_func) {
internal_func(formatConvBuffer, src, srcW, pal);
src= formatConvBuffer;
@ -2424,6 +2427,11 @@ inline static void RENAME(hcscale)(SwsContext *c, uint16_t *dst, long dstWidth,
src2 += ALT32_CORR;
}
if (srcFormat==PIX_FMT_RGB48LE) {
src1++;
src2++;
}
if (c->hcscale_internal) {
c->hcscale_internal(formatConvBuffer, formatConvBuffer+VOFW, src1, src2, srcW, pal);
src1= formatConvBuffer;
@ -3047,6 +3055,8 @@ static void RENAME(sws_init_swScale)(SwsContext *c)
}
if (c->chrSrcHSubSample) {
switch(srcFormat) {
case PIX_FMT_RGB48BE:
case PIX_FMT_RGB48LE: c->hcscale_internal = rgb48ToUV_half; break;
case PIX_FMT_RGB32 :
case PIX_FMT_RGB32_1: c->hcscale_internal = bgr32ToUV_half; break;
case PIX_FMT_BGR24 : c->hcscale_internal = RENAME(bgr24ToUV_half); break;
@ -3060,6 +3070,8 @@ static void RENAME(sws_init_swScale)(SwsContext *c)
}
} else {
switch(srcFormat) {
case PIX_FMT_RGB48BE:
case PIX_FMT_RGB48LE: c->hcscale_internal = rgb48ToUV; break;
case PIX_FMT_RGB32 :
case PIX_FMT_RGB32_1: c->hcscale_internal = bgr32ToUV; break;
case PIX_FMT_BGR24 : c->hcscale_internal = RENAME(bgr24ToUV); break;
@ -3103,6 +3115,8 @@ static void RENAME(sws_init_swScale)(SwsContext *c)
case PIX_FMT_RGB32_1: c->hyscale_internal = bgr32ToY; break;
case PIX_FMT_BGR32 :
case PIX_FMT_BGR32_1: c->hyscale_internal = rgb32ToY; break;
case PIX_FMT_RGB48BE:
case PIX_FMT_RGB48LE: c->hyscale_internal = rgb48ToY; break;
}
if (c->alpPixBuf) {
switch (srcFormat) {

Loading…
Cancel
Save