summaryrefslogtreecommitdiff
path: root/libswscale
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2011-11-25 01:38:21 +0100
committerMichael Niedermayer <michaelni@gmx.at>2011-11-25 04:34:44 +0100
commit92afb431621c79155fcb7171d26f137eb1bee028 (patch)
tree2beb660ea9fafc1d2d304c0f7df610ebf54117e0 /libswscale
parent3880b4541ace2697f380ae1f43cb2299efeb2cc7 (diff)
parent7f1b427018ecff59e0e14031eecc79aac0d91ec8 (diff)
Merge remote-tracking branch 'qatar/master'
* qatar/master: snow: split snow in snowdec and snowenc tiffenc: deprecate using compression_level swscale: fix failing fate tests. swscale: add support for planar RGB input. h264: add support for decoding planar RGB images. Clean up swscale pixfmt macros using av_pix_fmt_descriptors[]. pixfmt: add planar RGB formats. Conflicts: libavcodec/h264.c libavcodec/snow.c libavcodec/utils.c libavutil/avutil.h libavutil/pixdesc.c libavutil/pixfmt.h libswscale/swscale.c libswscale/swscale_internal.h libswscale/swscale_unscaled.c libswscale/utils.c Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libswscale')
-rw-r--r--libswscale/swscale.c147
-rw-r--r--libswscale/swscale_internal.h155
-rw-r--r--libswscale/swscale_unscaled.c2
-rw-r--r--libswscale/utils.c7
4 files changed, 195 insertions, 116 deletions
diff --git a/libswscale/swscale.c b/libswscale/swscale.c
index 4be9b800ae..afc510a75c 100644
--- a/libswscale/swscale.c
+++ b/libswscale/swscale.c
@@ -1968,6 +1968,91 @@ static void rgb24ToUV_half_c(int16_t *dstU, int16_t *dstV, const uint8_t *unused
}
}
+static void planar_rgb_to_y(uint16_t *dst, const uint8_t *src[4], int width)
+{
+ int i;
+ for (i = 0; i < width; i++) {
+ int g = src[0][i];
+ int b = src[1][i];
+ int r = src[2][i];
+
+ dst[i] = (RY*r + GY*g + BY*b + (0x801<<(RGB2YUV_SHIFT-7))) >> (RGB2YUV_SHIFT-6);
+ }
+}
+
+static void planar_rgb16le_to_y(uint8_t *_dst, const uint8_t *_src[4], int width)
+{
+ int i;
+ const uint16_t **src = (const uint16_t **) _src;
+ uint16_t *dst = (uint16_t *) _dst;
+ for (i = 0; i < width; i++) {
+ int g = AV_RL16(src[0] + i);
+ int b = AV_RL16(src[1] + i);
+ int r = AV_RL16(src[2] + i);
+
+ dst[i] = ((RY * r + GY * g + BY * b + (33 << (RGB2YUV_SHIFT - 1))) >> RGB2YUV_SHIFT);
+ }
+}
+
+static void planar_rgb16be_to_y(uint8_t *_dst, const uint8_t *_src[4], int width)
+{
+ int i;
+ const uint16_t **src = (const uint16_t **) _src;
+ uint16_t *dst = (uint16_t *) _dst;
+ for (i = 0; i < width; i++) {
+ int g = AV_RB16(src[0] + i);
+ int b = AV_RB16(src[1] + i);
+ int r = AV_RB16(src[2] + i);
+
+ dst[i] = ((RY * r + GY * g + BY * b + (33 << (RGB2YUV_SHIFT - 1))) >> RGB2YUV_SHIFT);
+ }
+}
+
+static void planar_rgb_to_uv(uint16_t *dstU, uint16_t *dstV, const uint8_t *src[4], int width)
+{
+ int i;
+ for (i = 0; i < width; i++) {
+ int g = src[0][i];
+ int b = src[1][i];
+ int r = src[2][i];
+
+ dstU[i] = (RU*r + GU*g + BU*b + (0x4001<<(RGB2YUV_SHIFT-7))) >> (RGB2YUV_SHIFT-6);
+ dstV[i] = (RV*r + GV*g + BV*b + (0x4001<<(RGB2YUV_SHIFT-7))) >> (RGB2YUV_SHIFT-6);
+ }
+}
+
+static void planar_rgb16le_to_uv(uint8_t *_dstU, uint8_t *_dstV, const uint8_t *_src[4], int width)
+{
+ int i;
+ const uint16_t **src = (const uint16_t **) _src;
+ uint16_t *dstU = (uint16_t *) _dstU;
+ uint16_t *dstV = (uint16_t *) _dstV;
+ for (i = 0; i < width; i++) {
+ int g = AV_RL16(src[0] + i);
+ int b = AV_RL16(src[1] + i);
+ int r = AV_RL16(src[2] + i);
+
+ 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);
+ }
+}
+
+static void planar_rgb16be_to_uv(uint8_t *_dstU, uint8_t *_dstV, const uint8_t *_src[4], int width)
+{
+ int i;
+ const uint16_t **src = (const uint16_t **) _src;
+ uint16_t *dstU = (uint16_t *) _dstU;
+ uint16_t *dstV = (uint16_t *) _dstV;
+ for (i = 0; i < width; i++) {
+ int g = AV_RB16(src[0] + i);
+ int b = AV_RB16(src[1] + i);
+ int r = AV_RB16(src[2] + i);
+
+ 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);
+ }
+}
+
static void hScale16To19_c(SwsContext *c, int16_t *_dst, int dstW, const uint8_t *_src,
const int16_t *filter,
const int16_t *filterPos, int filterSize)
@@ -2139,8 +2224,7 @@ static void hyscale_fast_c(SwsContext *c, int16_t *dst, int dstWidth,
// *** horizontal scale Y line to temp buffer
static av_always_inline void hyscale(SwsContext *c, int16_t *dst, int dstWidth,
- const uint8_t *src, const uint8_t *src2, const uint8_t *src3,
- int srcW, int xInc,
+ const uint8_t *src_in[4], int srcW, int xInc,
const int16_t *hLumFilter,
const int16_t *hLumFilterPos, int hLumFilterSize,
uint8_t *formatConvBuffer,
@@ -2148,10 +2232,14 @@ static av_always_inline void hyscale(SwsContext *c, int16_t *dst, int dstWidth,
{
void (*toYV12)(uint8_t *, const uint8_t *, const uint8_t *, const uint8_t *, int, uint32_t *) = isAlpha ? c->alpToYV12 : c->lumToYV12;
void (*convertRange)(int16_t *, int) = isAlpha ? NULL : c->lumConvertRange;
+ const uint8_t *src = src_in[isAlpha ? 3 : 0];
if (toYV12) {
- toYV12(formatConvBuffer, src, src2, src3, srcW, pal);
+ toYV12(formatConvBuffer, src, src_in[1], src_in[2], srcW, pal);
src= formatConvBuffer;
+ } else if (c->readLumPlanar && !isAlpha) {
+ c->readLumPlanar(formatConvBuffer, src_in, srcW);
+ src = formatConvBuffer;
}
if (!c->hyscale_fast) {
@@ -2184,14 +2272,20 @@ static void hcscale_fast_c(SwsContext *c, int16_t *dst1, int16_t *dst2,
}
static av_always_inline void hcscale(SwsContext *c, int16_t *dst1, int16_t *dst2, int dstWidth,
- const uint8_t *src0, const uint8_t *src1, const uint8_t *src2,
+ const uint8_t *src_in[4],
int srcW, int xInc, const int16_t *hChrFilter,
const int16_t *hChrFilterPos, int hChrFilterSize,
uint8_t *formatConvBuffer, uint32_t *pal)
{
+ const uint8_t *src1 = src_in[1], *src2 = src_in[2];
if (c->chrToYV12) {
uint8_t *buf2 = formatConvBuffer + FFALIGN(srcW*2+78, 16);
- c->chrToYV12(formatConvBuffer, buf2, src0, src1, src2, srcW, pal);
+ c->chrToYV12(formatConvBuffer, buf2, src_in[0], src1, src2, srcW, pal);
+ src1= formatConvBuffer;
+ src2= buf2;
+ } else if (c->readChrPlanar) {
+ uint8_t *buf2 = formatConvBuffer + FFALIGN(srcW*2+78, 16);
+ c->readChrPlanar(formatConvBuffer, buf2, src_in, srcW);
src1= formatConvBuffer;
src2= buf2;
}
@@ -2609,20 +2703,22 @@ static int swScale(SwsContext *c, const uint8_t* src[],
//Do horizontal scaling
while(lastInLumBuf < lastLumSrcY) {
- const uint8_t *src1= src[0]+(lastInLumBuf + 1 - srcSliceY)*srcStride[0];
- const uint8_t *src2= src[1]+(lastInLumBuf + 1 - srcSliceY)*srcStride[1];
- const uint8_t *src3= src[2]+(lastInLumBuf + 1 - srcSliceY)*srcStride[2];
- const uint8_t *src4= src[3]+(lastInLumBuf + 1 - srcSliceY)*srcStride[3];
+ const uint8_t *src1[4] = {
+ src[0] + (lastInLumBuf + 1 - srcSliceY) * srcStride[0],
+ src[1] + (lastInLumBuf + 1 - srcSliceY) * srcStride[1],
+ src[2] + (lastInLumBuf + 1 - srcSliceY) * srcStride[2],
+ src[3] + (lastInLumBuf + 1 - srcSliceY) * srcStride[3],
+ };
lumBufIndex++;
assert(lumBufIndex < 2*vLumBufSize);
assert(lastInLumBuf + 1 - srcSliceY < srcSliceH);
assert(lastInLumBuf + 1 - srcSliceY >= 0);
- hyscale(c, lumPixBuf[ lumBufIndex ], dstW, src1, src2, src3, srcW, lumXInc,
+ hyscale(c, lumPixBuf[ lumBufIndex ], dstW, src1, srcW, lumXInc,
hLumFilter, hLumFilterPos, hLumFilterSize,
formatConvBuffer,
pal, 0);
if (CONFIG_SWSCALE_ALPHA && alpPixBuf)
- hyscale(c, alpPixBuf[ lumBufIndex ], dstW, src4, NULL, NULL, srcW,
+ hyscale(c, alpPixBuf[ lumBufIndex ], dstW, src1, srcW,
lumXInc, hLumFilter, hLumFilterPos, hLumFilterSize,
formatConvBuffer,
pal, 1);
@@ -2631,9 +2727,12 @@ static int swScale(SwsContext *c, const uint8_t* src[],
lumBufIndex, lastInLumBuf);
}
while(lastInChrBuf < lastChrSrcY) {
- const uint8_t *src0= src[0]+(lastInChrBuf + 1 - chrSrcSliceY)*srcStride[0];
- const uint8_t *src1= src[1]+(lastInChrBuf + 1 - chrSrcSliceY)*srcStride[1];
- const uint8_t *src2= src[2]+(lastInChrBuf + 1 - chrSrcSliceY)*srcStride[2];
+ const uint8_t *src1[4] = {
+ src[0] + (lastInChrBuf + 1 - chrSrcSliceY) * srcStride[0],
+ src[1] + (lastInChrBuf + 1 - chrSrcSliceY) * srcStride[1],
+ src[2] + (lastInChrBuf + 1 - chrSrcSliceY) * srcStride[2],
+ src[3] + (lastInChrBuf + 1 - chrSrcSliceY) * srcStride[3],
+ };
chrBufIndex++;
assert(chrBufIndex < 2*vChrBufSize);
assert(lastInChrBuf + 1 - chrSrcSliceY < (chrSrcSliceH));
@@ -2642,7 +2741,7 @@ static int swScale(SwsContext *c, const uint8_t* src[],
if (c->needs_hcscale)
hcscale(c, chrUPixBuf[chrBufIndex], chrVPixBuf[chrBufIndex],
- chrDstW, src0, src1, src2, chrSrcW, chrXInc,
+ chrDstW, src1, chrSrcW, chrXInc,
hChrFilter, hChrFilterPos, hChrFilterSize,
formatConvBuffer, pal);
lastInChrBuf++;
@@ -2796,6 +2895,13 @@ static av_cold void sws_init_swScale_c(SwsContext *c)
case PIX_FMT_PAL8 :
case PIX_FMT_BGR4_BYTE:
case PIX_FMT_RGB4_BYTE: c->chrToYV12 = palToUV_c; break;
+ case PIX_FMT_GBRP9LE:
+ case PIX_FMT_GBRP10LE:
+ case PIX_FMT_GBRP16LE: c->readChrPlanar = planar_rgb16le_to_uv; break;
+ case PIX_FMT_GBRP9BE:
+ case PIX_FMT_GBRP10BE:
+ case PIX_FMT_GBRP16BE: c->readChrPlanar = planar_rgb16be_to_uv; break;
+ case PIX_FMT_GBRP: c->readChrPlanar = planar_rgb_to_uv; break;
#if HAVE_BIGENDIAN
case PIX_FMT_YUV444P9LE:
case PIX_FMT_YUV422P9LE:
@@ -2860,13 +2966,20 @@ static av_cold void sws_init_swScale_c(SwsContext *c)
case PIX_FMT_RGB565BE: c->chrToYV12 = rgb16beToUV_c; break;
case PIX_FMT_RGB555LE: c->chrToYV12 = rgb15leToUV_c; break;
case PIX_FMT_RGB555BE: c->chrToYV12 = rgb15beToUV_c; break;
- case PIX_FMT_GBR24P : c->chrToYV12 = gbr24pToUV_c; break;
+// case PIX_FMT_GBR24P : c->chrToYV12 = gbr24pToUV_c; break;
}
}
c->lumToYV12 = NULL;
c->alpToYV12 = NULL;
switch (srcFormat) {
+ case PIX_FMT_GBRP9LE:
+ case PIX_FMT_GBRP10LE:
+ case PIX_FMT_GBRP16LE: c->readLumPlanar = planar_rgb16le_to_y; break;
+ case PIX_FMT_GBRP9BE:
+ case PIX_FMT_GBRP10BE:
+ case PIX_FMT_GBRP16BE: c->readLumPlanar = planar_rgb16be_to_y; break;
+ case PIX_FMT_GBRP: c->readLumPlanar = planar_rgb_to_y; break;
#if HAVE_BIGENDIAN
case PIX_FMT_YUV444P9LE:
case PIX_FMT_YUV422P9LE:
@@ -2918,7 +3031,7 @@ static av_cold void sws_init_swScale_c(SwsContext *c)
case PIX_FMT_RGB48LE: c->lumToYV12 = rgb48LEToY_c; break;
case PIX_FMT_BGR48BE: c->lumToYV12 = bgr48BEToY_c; break;
case PIX_FMT_BGR48LE: c->lumToYV12 = bgr48LEToY_c; break;
- case PIX_FMT_GBR24P : c->lumToYV12 = gbr24pToY_c ; break;
+// case PIX_FMT_GBR24P : c->lumToYV12 = gbr24pToY_c ; break;
}
if (c->alpPixBuf) {
switch (srcFormat) {
diff --git a/libswscale/swscale_internal.h b/libswscale/swscale_internal.h
index 42012c222e..44ff166e55 100644
--- a/libswscale/swscale_internal.h
+++ b/libswscale/swscale_internal.h
@@ -30,6 +30,7 @@
#include "libavutil/avutil.h"
#include "libavutil/log.h"
#include "libavutil/pixfmt.h"
+#include "libavutil/pixdesc.h"
#define STR(s) AV_TOSTRING(s) //AV_STRINGIFY is too long
@@ -429,6 +430,16 @@ typedef struct SwsContext {
void (*chrToYV12)(uint8_t *dstU, uint8_t *dstV,
const uint8_t *src1, const uint8_t *src2, const uint8_t *src3,
int width, uint32_t *pal); ///< Unscaled conversion of chroma planes to YV12 for horizontal scaler.
+
+ /**
+ * Functions to read planar input, such as planar RGB, and convert
+ * internally to Y/UV.
+ */
+ /** @{ */
+ void (*readLumPlanar)(uint8_t *dst, const uint8_t *src[4], int width);
+ void (*readChrPlanar)(uint8_t *dstU, uint8_t *dstV, const uint8_t *src[4], int width);
+ /** @} */
+
/**
* Scale one horizontal line of input data using a bilinear filter
* to produce one line of output data. Compared to SwsContext->hScale(),
@@ -529,98 +540,41 @@ attribute_deprecated
const char *sws_format_name(enum PixelFormat format);
#endif
-//FIXME replace this with something faster
-#define is16BPS(x) ( \
- (x)==PIX_FMT_GRAY16BE \
- || (x)==PIX_FMT_GRAY16LE \
- || (x)==PIX_FMT_BGR48BE \
- || (x)==PIX_FMT_BGR48LE \
- || (x)==PIX_FMT_RGB48BE \
- || (x)==PIX_FMT_RGB48LE \
- || (x)==PIX_FMT_BGRA64BE \
- || (x)==PIX_FMT_BGRA64LE \
- || (x)==PIX_FMT_RGBA64BE \
- || (x)==PIX_FMT_RGBA64LE \
- || (x)==PIX_FMT_YUV420P16LE \
- || (x)==PIX_FMT_YUV422P16LE \
- || (x)==PIX_FMT_YUV444P16LE \
- || (x)==PIX_FMT_YUV420P16BE \
- || (x)==PIX_FMT_YUV422P16BE \
- || (x)==PIX_FMT_YUV444P16BE \
- )
-#define isNBPS(x) ( \
- (x)==PIX_FMT_YUV420P9LE \
- || (x)==PIX_FMT_YUV420P9BE \
- || (x)==PIX_FMT_YUV422P9LE \
- || (x)==PIX_FMT_YUV422P9BE \
- || (x)==PIX_FMT_YUV444P9BE \
- || (x)==PIX_FMT_YUV444P9LE \
- || (x)==PIX_FMT_YUV422P10BE \
- || (x)==PIX_FMT_YUV422P10LE \
- || (x)==PIX_FMT_YUV444P10BE \
- || (x)==PIX_FMT_YUV444P10LE \
- || (x)==PIX_FMT_YUV420P10LE \
- || (x)==PIX_FMT_YUV420P10BE \
- || (x)==PIX_FMT_YUV422P10LE \
- || (x)==PIX_FMT_YUV422P10BE \
- )
-#define is9_OR_10BPS isNBPS //for ronald
-#define isBE(x) ((x)&1)
-#define isPlanar8YUV(x) ( \
- (x)==PIX_FMT_YUV410P \
- || (x)==PIX_FMT_YUV420P \
- || (x)==PIX_FMT_YUVA420P \
- || (x)==PIX_FMT_YUV411P \
- || (x)==PIX_FMT_YUV422P \
- || (x)==PIX_FMT_YUV444P \
- || (x)==PIX_FMT_YUV440P \
- || (x)==PIX_FMT_NV12 \
- || (x)==PIX_FMT_NV21 \
- )
-#define isPlanarYUV(x) ( \
- isPlanar8YUV(x) \
- || (x)==PIX_FMT_YUV420P9LE \
- || (x)==PIX_FMT_YUV422P9LE \
- || (x)==PIX_FMT_YUV444P9LE \
- || (x)==PIX_FMT_YUV420P10LE \
- || (x)==PIX_FMT_YUV422P10LE \
- || (x)==PIX_FMT_YUV444P10LE \
- || (x)==PIX_FMT_YUV420P16LE \
- || (x)==PIX_FMT_YUV422P10LE \
- || (x)==PIX_FMT_YUV422P16LE \
- || (x)==PIX_FMT_YUV444P16LE \
- || (x)==PIX_FMT_YUV420P9BE \
- || (x)==PIX_FMT_YUV422P9BE \
- || (x)==PIX_FMT_YUV444P9BE \
- || (x)==PIX_FMT_YUV420P10BE \
- || (x)==PIX_FMT_YUV422P10BE \
- || (x)==PIX_FMT_YUV444P10BE \
- || (x)==PIX_FMT_YUV420P16BE \
- || (x)==PIX_FMT_YUV422P10BE \
- || (x)==PIX_FMT_YUV422P16BE \
- || (x)==PIX_FMT_YUV444P16BE \
- )
+#define is16BPS(x) \
+ (av_pix_fmt_descriptors[x].comp[0].depth_minus1 == 15)
-#define isPlanar(x) ( \
- isPlanarYUV(x) \
- || (x)==PIX_FMT_GBR24P \
- )
+#define is9_OR_10BPS(x) \
+ (av_pix_fmt_descriptors[x].comp[0].depth_minus1 == 8 || \
+ av_pix_fmt_descriptors[x].comp[0].depth_minus1 == 9)
-#define isYUV(x) ( \
- (x)==PIX_FMT_UYVY422 \
- || (x)==PIX_FMT_YUYV422 \
- || isPlanarYUV(x) \
- )
+#define isNBPS(x) is9_OR_10BPS(x)
+
+#define isBE(x) \
+ (av_pix_fmt_descriptors[x].flags & PIX_FMT_BE)
+
+#define isYUV(x) \
+ (!(av_pix_fmt_descriptors[x].flags & PIX_FMT_RGB) && \
+ av_pix_fmt_descriptors[x].nb_components >= 2)
+
+#define isPlanarYUV(x) \
+ ((av_pix_fmt_descriptors[x].flags & PIX_FMT_PLANAR) && \
+ isYUV(x))
+
+#define isRGB(x) \
+ (av_pix_fmt_descriptors[x].flags & PIX_FMT_RGB)
+#if 0 // FIXME
+#define isGray(x) \
+ (!(av_pix_fmt_descriptors[x].flags & PIX_FMT_PAL) && \
+ av_pix_fmt_descriptors[x].nb_components <= 2)
+#else
#define isGray(x) ( \
(x)==PIX_FMT_GRAY8 \
|| (x)==PIX_FMT_GRAY8A \
|| (x)==PIX_FMT_GRAY16BE \
|| (x)==PIX_FMT_GRAY16LE \
)
-#define isGray16(x) ( \
- (x)==PIX_FMT_GRAY16BE \
- || (x)==PIX_FMT_GRAY16LE \
- )
+#endif
+
#define isRGBinInt(x) ( \
(x)==PIX_FMT_RGB48BE \
|| (x)==PIX_FMT_RGB48LE \
@@ -661,6 +615,7 @@ const char *sws_format_name(enum PixelFormat format);
|| (x)==PIX_FMT_MONOBLACK \
|| (x)==PIX_FMT_MONOWHITE \
)
+
#define isRGBinBytes(x) ( \
(x)==PIX_FMT_RGB48BE \
|| (x)==PIX_FMT_RGB48LE \
@@ -679,24 +634,18 @@ const char *sws_format_name(enum PixelFormat format);
|| (x)==PIX_FMT_ABGR \
|| (x)==PIX_FMT_BGR24 \
)
+
#define isAnyRGB(x) ( \
isRGBinInt(x) \
|| isBGRinInt(x) \
|| (x)==PIX_FMT_GBR24P \
)
-#define isALPHA(x) ( \
- (x)==PIX_FMT_BGRA64BE \
- || (x)==PIX_FMT_BGRA64LE \
- || (x)==PIX_FMT_RGBA64BE \
- || (x)==PIX_FMT_RGBA64LE \
- || (x)==PIX_FMT_BGR32 \
- || (x)==PIX_FMT_BGR32_1 \
- || (x)==PIX_FMT_RGB32 \
- || (x)==PIX_FMT_RGB32_1 \
- || (x)==PIX_FMT_PAL8 \
- || (x)==PIX_FMT_GRAY8A \
- || (x)==PIX_FMT_YUVA420P \
- )
+
+#define isALPHA(x) \
+ (av_pix_fmt_descriptors[x].nb_components == 2 || \
+ av_pix_fmt_descriptors[x].nb_components == 4)
+
+#if 1
#define isPacked(x) ( \
(x)==PIX_FMT_PAL8 \
|| (x)==PIX_FMT_YUYV422 \
@@ -705,7 +654,17 @@ const char *sws_format_name(enum PixelFormat format);
|| isRGBinInt(x) \
|| isBGRinInt(x) \
)
-#define usePal(x) ((av_pix_fmt_descriptors[x].flags & PIX_FMT_PAL) || (x) == PIX_FMT_GRAY8A)
+#else
+#define isPacked(x) \
+ (av_pix_fmt_descriptors[x].nb_components >= 2 && \
+ !(av_pix_fmt_descriptors[x].flags & PIX_FMT_PLANAR))
+
+#endif
+#define isPlanar(x) \
+ (av_pix_fmt_descriptors[x].nb_components >= 2 && \
+ (av_pix_fmt_descriptors[x].flags & PIX_FMT_PLANAR))
+
+#define usePal(x) ((av_pix_fmt_descriptors[x].flags & PIX_FMT_PAL) || (x) == PIX_FMT_Y400A)
extern const uint64_t ff_dither4[2];
extern const uint64_t ff_dither8[2];
diff --git a/libswscale/swscale_unscaled.c b/libswscale/swscale_unscaled.c
index adeb409d2f..80ae5fc287 100644
--- a/libswscale/swscale_unscaled.c
+++ b/libswscale/swscale_unscaled.c
@@ -763,7 +763,7 @@ static void reset_ptr(const uint8_t* src[], int format)
{
if(!isALPHA(format))
src[3]=NULL;
- if(!isPlanar(format)) {
+ if (!isPlanar(format)) {
src[3]=src[2]=NULL;
if (!usePal(format))
diff --git a/libswscale/utils.c b/libswscale/utils.c
index 7cc13bf7e5..347b9905e0 100644
--- a/libswscale/utils.c
+++ b/libswscale/utils.c
@@ -145,6 +145,13 @@ const static FormatEntry format_entries[PIX_FMT_NB] = {
[PIX_FMT_YUV444P10BE] = { 1 , 1 },
[PIX_FMT_YUV444P10LE] = { 1 , 1 },
[PIX_FMT_GBR24P] = { 1 , 0 },
+ [PIX_FMT_GBRP] = { 1 , 0 },
+ [PIX_FMT_GBRP9LE] = { 1 , 0 },
+ [PIX_FMT_GBRP9BE] = { 1 , 0 },
+ [PIX_FMT_GBRP10LE] = { 1 , 0 },
+ [PIX_FMT_GBRP10BE] = { 1 , 0 },
+ [PIX_FMT_GBRP16LE] = { 1 , 0 },
+ [PIX_FMT_GBRP16BE] = { 1 , 0 },
};
int sws_isSupportedInput(enum PixelFormat pix_fmt)