X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=libswscale%2Fswscale_internal.h;h=19dff8f37b246d7ffa33ba2dafb10b2a56e16d4a;hb=bd8154d0b337e7a9f4dd1a728f4409fbe37c8fea;hp=658c4aef723a56016e8c7d8e3f9b25b72f46e85b;hpb=a4388ebd37e42721e294946721d5c008ca0b3e66;p=ffmpeg diff --git a/libswscale/swscale_internal.h b/libswscale/swscale_internal.h index 658c4aef723..19dff8f37b2 100644 --- a/libswscale/swscale_internal.h +++ b/libswscale/swscale_internal.h @@ -86,6 +86,8 @@ typedef struct SwsContext { int lumYInc, chrYInc; enum PixelFormat dstFormat; ///< Destination pixel format. enum PixelFormat srcFormat; ///< Source pixel format. + int dstFormatBpp; ///< Number of bits per pixel of the destination pixel format. + int srcFormatBpp; ///< Number of bits per pixel of the source pixel format. int chrSrcHSubSample; ///< Binary logarithm of horizontal subsampling factor between luma/alpha and chroma planes in source image. int chrSrcVSubSample; ///< Binary logarithm of vertical subsampling factor between luma/alpha and chroma planes in source image. int chrDstHSubSample; ///< Binary logarithm of horizontal subsampling factor between luma/alpha and chroma planes in destination image. @@ -329,8 +331,8 @@ SwsFunc ff_yuv2rgb_init_altivec(SwsContext *c); SwsFunc ff_yuv2rgb_get_func_ptr_bfin(SwsContext *c); void ff_bfin_get_unscaled_swscale(SwsContext *c); void ff_yuv2packedX_altivec(SwsContext *c, - const int16_t *lumFilter, int16_t **lumSrc, int lumFilterSize, - const int16_t *chrFilter, int16_t **chrSrc, int chrFilterSize, + const int16_t *lumFilter, const int16_t **lumSrc, int lumFilterSize, + const int16_t *chrFilter, const int16_t **chrSrc, int chrFilterSize, uint8_t *dest, int dstW, int dstY); const char *sws_format_name(enum PixelFormat format); @@ -341,12 +343,12 @@ const char *sws_format_name(enum PixelFormat format); || (x)==PIX_FMT_GRAY16LE \ || (x)==PIX_FMT_RGB48BE \ || (x)==PIX_FMT_RGB48LE \ - || (x)==PIX_FMT_YUV420P16LE \ - || (x)==PIX_FMT_YUV422P16LE \ - || (x)==PIX_FMT_YUV444P16LE \ - || (x)==PIX_FMT_YUV420P16BE \ - || (x)==PIX_FMT_YUV422P16BE \ - || (x)==PIX_FMT_YUV444P16BE \ + || (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 isBE(x) ((x)&1) #define isPlanar8YUV(x) ( \ @@ -362,12 +364,12 @@ const char *sws_format_name(enum PixelFormat format); ) #define isPlanarYUV(x) ( \ isPlanar8YUV(x) \ - || (x)==PIX_FMT_YUV420P16LE \ - || (x)==PIX_FMT_YUV422P16LE \ - || (x)==PIX_FMT_YUV444P16LE \ - || (x)==PIX_FMT_YUV420P16BE \ - || (x)==PIX_FMT_YUV422P16BE \ - || (x)==PIX_FMT_YUV444P16BE \ + || (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 isYUV(x) ( \ (x)==PIX_FMT_UYVY422 \ @@ -376,6 +378,7 @@ const char *sws_format_name(enum PixelFormat format); ) #define isGray(x) ( \ (x)==PIX_FMT_GRAY8 \ + || (x)==PIX_FMT_Y400A \ || (x)==PIX_FMT_GRAY16BE \ || (x)==PIX_FMT_GRAY16LE \ ) @@ -383,77 +386,65 @@ const char *sws_format_name(enum PixelFormat format); (x)==PIX_FMT_GRAY16BE \ || (x)==PIX_FMT_GRAY16LE \ ) -#define isRGB(x) ( \ +#define isRGBinInt(x) ( \ (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 \ - || (x)==PIX_FMT_RGB555 \ + || (x)==PIX_FMT_RGB565BE \ + || (x)==PIX_FMT_RGB565LE \ + || (x)==PIX_FMT_RGB555BE \ + || (x)==PIX_FMT_RGB555LE \ + || (x)==PIX_FMT_RGB444BE \ + || (x)==PIX_FMT_RGB444LE \ || (x)==PIX_FMT_RGB8 \ || (x)==PIX_FMT_RGB4 \ || (x)==PIX_FMT_RGB4_BYTE \ || (x)==PIX_FMT_MONOBLACK \ || (x)==PIX_FMT_MONOWHITE \ ) -#define isBGR(x) ( \ +#define isBGRinInt(x) ( \ (x)==PIX_FMT_BGR32 \ || (x)==PIX_FMT_BGR32_1 \ || (x)==PIX_FMT_BGR24 \ - || (x)==PIX_FMT_BGR565 \ - || (x)==PIX_FMT_BGR555 \ + || (x)==PIX_FMT_BGR565BE \ + || (x)==PIX_FMT_BGR565LE \ + || (x)==PIX_FMT_BGR555BE \ + || (x)==PIX_FMT_BGR555LE \ + || (x)==PIX_FMT_BGR444BE \ + || (x)==PIX_FMT_BGR444LE \ || (x)==PIX_FMT_BGR8 \ || (x)==PIX_FMT_BGR4 \ || (x)==PIX_FMT_BGR4_BYTE \ || (x)==PIX_FMT_MONOBLACK \ || (x)==PIX_FMT_MONOWHITE \ ) +#define isRGBinBytes(x) ( \ + (x)==PIX_FMT_RGB48BE \ + || (x)==PIX_FMT_RGB48LE \ + || (x)==PIX_FMT_RGBA \ + || (x)==PIX_FMT_ARGB \ + || (x)==PIX_FMT_RGB24 \ + ) +#define isBGRinBytes(x) ( \ + (x)==PIX_FMT_BGRA \ + || (x)==PIX_FMT_ABGR \ + || (x)==PIX_FMT_BGR24 \ + ) +#define isAnyRGB(x) ( \ + isRGBinInt(x) \ + || isBGRinInt(x) \ + ) #define isALPHA(x) ( \ (x)==PIX_FMT_BGR32 \ || (x)==PIX_FMT_BGR32_1 \ || (x)==PIX_FMT_RGB32 \ || (x)==PIX_FMT_RGB32_1 \ + || (x)==PIX_FMT_Y400A \ || (x)==PIX_FMT_YUVA420P \ ) - -static inline int fmt_depth(enum PixelFormat fmt) -{ - switch(fmt) { - case PIX_FMT_RGB48BE: - case PIX_FMT_RGB48LE: - return 48; - case PIX_FMT_BGRA: - case PIX_FMT_ABGR: - case PIX_FMT_RGBA: - case PIX_FMT_ARGB: - return 32; - case PIX_FMT_BGR24: - case PIX_FMT_RGB24: - return 24; - case PIX_FMT_BGR565: - case PIX_FMT_RGB565: - case PIX_FMT_GRAY16BE: - case PIX_FMT_GRAY16LE: - return 16; - case PIX_FMT_BGR555: - case PIX_FMT_RGB555: - return 15; - case PIX_FMT_BGR8: - case PIX_FMT_RGB8: - return 8; - case PIX_FMT_BGR4: - case PIX_FMT_RGB4: - case PIX_FMT_BGR4_BYTE: - case PIX_FMT_RGB4_BYTE: - return 4; - case PIX_FMT_MONOBLACK: - case PIX_FMT_MONOWHITE: - return 1; - default: - return 0; - } -} +#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];