diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2011-11-25 01:38:21 +0100 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2011-11-25 04:34:44 +0100 |
commit | 92afb431621c79155fcb7171d26f137eb1bee028 (patch) | |
tree | 2beb660ea9fafc1d2d304c0f7df610ebf54117e0 /libswscale/swscale_internal.h | |
parent | 3880b4541ace2697f380ae1f43cb2299efeb2cc7 (diff) | |
parent | 7f1b427018ecff59e0e14031eecc79aac0d91ec8 (diff) | |
download | ffmpeg-92afb431621c79155fcb7171d26f137eb1bee028.tar.gz |
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/swscale_internal.h')
-rw-r--r-- | libswscale/swscale_internal.h | 155 |
1 files changed, 57 insertions, 98 deletions
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]; |