|
|
@ -412,7 +412,9 @@ static int palToRgbWrapper(SwsContext *c, const uint8_t *src[], int srcStride[], |
|
|
|
return srcSliceH; |
|
|
|
return srcSliceH; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
static void gbr24ptopacked24(const uint8_t* src[], int srcStride[], uint8_t* dst, int dstStride, int srcSliceH, int width) |
|
|
|
static void gbr24ptopacked24(const uint8_t *src[], int srcStride[], |
|
|
|
|
|
|
|
uint8_t *dst, int dstStride, int srcSliceH, |
|
|
|
|
|
|
|
int width) |
|
|
|
{ |
|
|
|
{ |
|
|
|
int x, h, i; |
|
|
|
int x, h, i; |
|
|
|
for (h = 0; h < srcSliceH; h++) { |
|
|
|
for (h = 0; h < srcSliceH; h++) { |
|
|
@ -428,7 +430,9 @@ static void gbr24ptopacked24(const uint8_t* src[], int srcStride[], uint8_t* dst |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
static void gbr24ptopacked32(const uint8_t* src[], int srcStride[], uint8_t* dst, int dstStride, int srcSliceH, int alpha_first, int width) |
|
|
|
static void gbr24ptopacked32(const uint8_t *src[], int srcStride[], |
|
|
|
|
|
|
|
uint8_t *dst, int dstStride, int srcSliceH, |
|
|
|
|
|
|
|
int alpha_first, int width) |
|
|
|
{ |
|
|
|
{ |
|
|
|
int x, h, i; |
|
|
|
int x, h, i; |
|
|
|
for (h = 0; h < srcSliceH; h++) { |
|
|
|
for (h = 0; h < srcSliceH; h++) { |
|
|
@ -455,44 +459,56 @@ static void gbr24ptopacked32(const uint8_t* src[], int srcStride[], uint8_t* dst |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
static int planarRgbToRgbWrapper(SwsContext *c, const uint8_t* src[], int srcStride[], int srcSliceY, |
|
|
|
static int planarRgbToRgbWrapper(SwsContext *c, const uint8_t *src[], |
|
|
|
int srcSliceH, uint8_t* dst[], int dstStride[]) |
|
|
|
int srcStride[], int srcSliceY, int srcSliceH, |
|
|
|
|
|
|
|
uint8_t *dst[], int dstStride[]) |
|
|
|
{ |
|
|
|
{ |
|
|
|
int alpha_first = 0; |
|
|
|
int alpha_first = 0; |
|
|
|
if (c->srcFormat != PIX_FMT_GBR24P) { |
|
|
|
if (c->srcFormat != PIX_FMT_GBRP) { |
|
|
|
av_log(c, AV_LOG_ERROR, "unsupported planar RGB conversion %s -> %s\n", |
|
|
|
av_log(c, AV_LOG_ERROR, "unsupported planar RGB conversion %s -> %s\n", |
|
|
|
av_get_pix_fmt_name(c->srcFormat), av_get_pix_fmt_name(c->dstFormat)); |
|
|
|
av_get_pix_fmt_name(c->srcFormat), |
|
|
|
|
|
|
|
av_get_pix_fmt_name(c->dstFormat)); |
|
|
|
return srcSliceH; |
|
|
|
return srcSliceH; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
switch (c->dstFormat) { |
|
|
|
switch (c->dstFormat) { |
|
|
|
case PIX_FMT_BGR24: |
|
|
|
case PIX_FMT_BGR24: |
|
|
|
gbr24ptopacked24((const uint8_t* []) {src[1], src[0], src[2]}, (int []) {srcStride[1], srcStride[0], srcStride[2]}, |
|
|
|
gbr24ptopacked24((const uint8_t *[]) { src[1], src[0], src[2] }, |
|
|
|
dst[0] + srcSliceY * dstStride[0], dstStride[0], srcSliceH, c->srcW); |
|
|
|
(int []) { srcStride[1], srcStride[0], srcStride[2] }, |
|
|
|
break; |
|
|
|
dst[0] + srcSliceY * dstStride[0], dstStride[0], |
|
|
|
|
|
|
|
srcSliceH, c->srcW); |
|
|
|
case PIX_FMT_RGB24: |
|
|
|
break; |
|
|
|
gbr24ptopacked24((const uint8_t* []) {src[2], src[0], src[1]}, (int []) {srcStride[2], srcStride[0], srcStride[1]}, |
|
|
|
|
|
|
|
dst[0] + srcSliceY * dstStride[0], dstStride[0], srcSliceH, c->srcW); |
|
|
|
case PIX_FMT_RGB24: |
|
|
|
break; |
|
|
|
gbr24ptopacked24((const uint8_t *[]) { src[2], src[0], src[1] }, |
|
|
|
|
|
|
|
(int []) { srcStride[2], srcStride[0], srcStride[1] }, |
|
|
|
case PIX_FMT_ARGB: |
|
|
|
dst[0] + srcSliceY * dstStride[0], dstStride[0], |
|
|
|
alpha_first = 1; |
|
|
|
srcSliceH, c->srcW); |
|
|
|
case PIX_FMT_RGBA: |
|
|
|
break; |
|
|
|
gbr24ptopacked32((const uint8_t* []) {src[2], src[0], src[1]}, (int []) {srcStride[2], srcStride[0], srcStride[1]}, |
|
|
|
|
|
|
|
dst[0] + srcSliceY * dstStride[0], dstStride[0], srcSliceH, alpha_first, c->srcW); |
|
|
|
case PIX_FMT_ARGB: |
|
|
|
break; |
|
|
|
alpha_first = 1; |
|
|
|
|
|
|
|
case PIX_FMT_RGBA: |
|
|
|
case PIX_FMT_ABGR: |
|
|
|
gbr24ptopacked32((const uint8_t *[]) { src[2], src[0], src[1] }, |
|
|
|
alpha_first = 1; |
|
|
|
(int []) { srcStride[2], srcStride[0], srcStride[1] }, |
|
|
|
case PIX_FMT_BGRA: |
|
|
|
dst[0] + srcSliceY * dstStride[0], dstStride[0], |
|
|
|
gbr24ptopacked32((const uint8_t* []) {src[1], src[0], src[2]}, (int []) {srcStride[1], srcStride[0], srcStride[2]}, |
|
|
|
srcSliceH, alpha_first, c->srcW); |
|
|
|
dst[0] + srcSliceY * dstStride[0], dstStride[0], srcSliceH, alpha_first, c->srcW); |
|
|
|
break; |
|
|
|
break; |
|
|
|
|
|
|
|
|
|
|
|
case PIX_FMT_ABGR: |
|
|
|
default: |
|
|
|
alpha_first = 1; |
|
|
|
av_log(c, AV_LOG_ERROR, "unsupported planar RGB conversion %s -> %s\n", |
|
|
|
case PIX_FMT_BGRA: |
|
|
|
av_get_pix_fmt_name(c->srcFormat), av_get_pix_fmt_name(c->dstFormat)); |
|
|
|
gbr24ptopacked32((const uint8_t *[]) { src[1], src[0], src[2] }, |
|
|
|
|
|
|
|
(int []) { srcStride[1], srcStride[0], srcStride[2] }, |
|
|
|
|
|
|
|
dst[0] + srcSliceY * dstStride[0], dstStride[0], |
|
|
|
|
|
|
|
srcSliceH, alpha_first, c->srcW); |
|
|
|
|
|
|
|
break; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
default: |
|
|
|
|
|
|
|
av_log(c, AV_LOG_ERROR, |
|
|
|
|
|
|
|
"unsupported planar RGB conversion %s -> %s\n", |
|
|
|
|
|
|
|
av_get_pix_fmt_name(c->srcFormat), |
|
|
|
|
|
|
|
av_get_pix_fmt_name(c->dstFormat)); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
return srcSliceH; |
|
|
|
return srcSliceH; |
|
|
@ -897,7 +913,7 @@ void ff_get_unscaled_swscale(SwsContext *c) |
|
|
|
f == PIX_FMT_BGR24) |
|
|
|
f == PIX_FMT_BGR24) |
|
|
|
|
|
|
|
|
|
|
|
if (isAnyRGB(srcFormat) && isPlanar(srcFormat) && isByteRGB(dstFormat)) |
|
|
|
if (isAnyRGB(srcFormat) && isPlanar(srcFormat) && isByteRGB(dstFormat)) |
|
|
|
c->swScale= planarRgbToRgbWrapper; |
|
|
|
c->swScale = planarRgbToRgbWrapper; |
|
|
|
|
|
|
|
|
|
|
|
/* bswap 16 bits per pixel/component packed formats */ |
|
|
|
/* bswap 16 bits per pixel/component packed formats */ |
|
|
|
if (IS_DIFFERENT_ENDIANESS(srcFormat, dstFormat, PIX_FMT_BGR444) || |
|
|
|
if (IS_DIFFERENT_ENDIANESS(srcFormat, dstFormat, PIX_FMT_BGR444) || |
|
|
|