From 1481d24c3a0abf81e1d7a514547bd5305232be30 Mon Sep 17 00:00:00 2001 From: Jean First Date: Fri, 23 Sep 2011 20:26:20 +0200 Subject: [PATCH] RGBA64 pixel formats Signed-off-by: Vittorio Giovara --- doc/APIchanges | 3 ++ libavutil/pixdesc.c | 52 +++++++++++++++++++++++++++++++++++ libavutil/pixfmt.h | 9 ++++++ libavutil/version.h | 2 +- libswscale/swscale_internal.h | 4 +++ libswscale/utils.c | 4 +++ 6 files changed, 73 insertions(+), 1 deletion(-) diff --git a/doc/APIchanges b/doc/APIchanges index d6134f99cc..38d18bc826 100644 --- a/doc/APIchanges +++ b/doc/APIchanges @@ -13,6 +13,9 @@ libavutil: 2013-12-xx API changes, most recent first: +2014-xx-xx - xxxxxxx - lavu 53.06.0 - pixfmt.h + Add RGBA64 pixel format and variants. + 2014-xx-xx - xxxxxxx - lavu 53.05.0 - frame.h Add av_frame_copy() for copying the frame data. diff --git a/libavutil/pixdesc.c b/libavutil/pixdesc.c index 37ce173201..d0e6919451 100644 --- a/libavutil/pixdesc.c +++ b/libavutil/pixdesc.c @@ -858,6 +858,32 @@ const AVPixFmtDescriptor av_pix_fmt_descriptors[AV_PIX_FMT_NB] = { }, .flags = AV_PIX_FMT_FLAG_RGB, }, + [AV_PIX_FMT_RGBA64BE] = { + .name = "rgba64be", + .nb_components = 4, + .log2_chroma_w = 0, + .log2_chroma_h = 0, + .comp = { + { 0, 7, 1, 0, 15 }, /* R */ + { 0, 7, 3, 0, 15 }, /* G */ + { 0, 7, 5, 0, 15 }, /* B */ + { 0, 7, 7, 0, 15 }, /* A */ + }, + .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_RGB | AV_PIX_FMT_FLAG_ALPHA, + }, + [AV_PIX_FMT_RGBA64LE] = { + .name = "rgba64le", + .nb_components = 4, + .log2_chroma_w = 0, + .log2_chroma_h = 0, + .comp = { + { 0, 7, 1, 0, 15 }, /* R */ + { 0, 7, 3, 0, 15 }, /* G */ + { 0, 7, 5, 0, 15 }, /* B */ + { 0, 7, 7, 0, 15 }, /* A */ + }, + .flags = AV_PIX_FMT_FLAG_RGB | AV_PIX_FMT_FLAG_ALPHA, + }, [AV_PIX_FMT_RGB565BE] = { .name = "rgb565be", .nb_components = 3, @@ -954,6 +980,32 @@ const AVPixFmtDescriptor av_pix_fmt_descriptors[AV_PIX_FMT_NB] = { }, .flags = AV_PIX_FMT_FLAG_RGB, }, + [AV_PIX_FMT_BGRA64BE] = { + .name = "bgra64be", + .nb_components = 4, + .log2_chroma_w = 0, + .log2_chroma_h = 0, + .comp = { + { 0, 5, 1, 0, 15 }, /* B */ + { 0, 5, 3, 0, 15 }, /* G */ + { 0, 5, 5, 0, 15 }, /* R */ + { 0, 5, 7, 0, 15 }, /* A */ + }, + .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_RGB | AV_PIX_FMT_FLAG_ALPHA, + }, + [AV_PIX_FMT_BGRA64LE] = { + .name = "bgra64le", + .nb_components = 4, + .log2_chroma_w = 0, + .log2_chroma_h = 0, + .comp = { + { 0, 5, 1, 0, 15 }, /* B */ + { 0, 5, 3, 0, 15 }, /* G */ + { 0, 5, 5, 0, 15 }, /* R */ + { 0, 5, 7, 0, 15 }, /* A */ + }, + .flags = AV_PIX_FMT_FLAG_RGB | AV_PIX_FMT_FLAG_ALPHA, + }, [AV_PIX_FMT_BGR565BE] = { .name = "bgr565be", .nb_components = 3, diff --git a/libavutil/pixfmt.h b/libavutil/pixfmt.h index 0d6e0a3007..e86ec7ee79 100644 --- a/libavutil/pixfmt.h +++ b/libavutil/pixfmt.h @@ -190,6 +190,12 @@ enum AVPixelFormat { AV_PIX_FMT_NV16, ///< interleaved chroma YUV 4:2:2, 16bpp, (1 Cr & Cb sample per 2x1 Y samples) AV_PIX_FMT_NV20LE, ///< interleaved chroma YUV 4:2:2, 20bpp, (1 Cr & Cb sample per 2x1 Y samples), little-endian AV_PIX_FMT_NV20BE, ///< interleaved chroma YUV 4:2:2, 20bpp, (1 Cr & Cb sample per 2x1 Y samples), big-endian + + AV_PIX_FMT_RGBA64BE, ///< packed RGBA 16:16:16:16, 64bpp, 16R, 16G, 16B, 16A, the 2-byte value for each R/G/B/A component is stored as big-endian + AV_PIX_FMT_RGBA64LE, ///< packed RGBA 16:16:16:16, 64bpp, 16R, 16G, 16B, 16A, the 2-byte value for each R/G/B/A component is stored as little-endian + AV_PIX_FMT_BGRA64BE, ///< packed RGBA 16:16:16:16, 64bpp, 16B, 16G, 16R, 16A, the 2-byte value for each R/G/B/A component is stored as big-endian + AV_PIX_FMT_BGRA64LE, ///< packed RGBA 16:16:16:16, 64bpp, 16B, 16G, 16R, 16A, the 2-byte value for each R/G/B/A component is stored as little-endian + AV_PIX_FMT_NB, ///< number of pixel formats, DO NOT USE THIS if you want to link with shared libav* because the number of formats might differ between versions #if FF_API_PIX_FMT @@ -213,10 +219,12 @@ enum AVPixelFormat { #define AV_PIX_FMT_RGB565 AV_PIX_FMT_NE(RGB565BE, RGB565LE) #define AV_PIX_FMT_RGB555 AV_PIX_FMT_NE(RGB555BE, RGB555LE) #define AV_PIX_FMT_RGB444 AV_PIX_FMT_NE(RGB444BE, RGB444LE) +#define AV_PIX_FMT_RGBA64 AV_PIX_FMT_NE(RGBA64BE, RGBA64LE) #define AV_PIX_FMT_BGR48 AV_PIX_FMT_NE(BGR48BE, BGR48LE) #define AV_PIX_FMT_BGR565 AV_PIX_FMT_NE(BGR565BE, BGR565LE) #define AV_PIX_FMT_BGR555 AV_PIX_FMT_NE(BGR555BE, BGR555LE) #define AV_PIX_FMT_BGR444 AV_PIX_FMT_NE(BGR444BE, BGR444LE) +#define AV_PIX_FMT_BGRA64 AV_PIX_FMT_NE(BGRA64BE, BGRA64LE) #define AV_PIX_FMT_YUV420P9 AV_PIX_FMT_NE(YUV420P9BE , YUV420P9LE) #define AV_PIX_FMT_YUV422P9 AV_PIX_FMT_NE(YUV422P9BE , YUV422P9LE) @@ -245,6 +253,7 @@ enum AVPixelFormat { #define AV_PIX_FMT_XYZ12 AV_PIX_FMT_NE(XYZ12BE, XYZ12LE) #define AV_PIX_FMT_NV20 AV_PIX_FMT_NE(NV20BE, NV20LE) + #if FF_API_PIX_FMT #define PixelFormat AVPixelFormat diff --git a/libavutil/version.h b/libavutil/version.h index cd0981c319..36070b251a 100644 --- a/libavutil/version.h +++ b/libavutil/version.h @@ -54,7 +54,7 @@ */ #define LIBAVUTIL_VERSION_MAJOR 53 -#define LIBAVUTIL_VERSION_MINOR 5 +#define LIBAVUTIL_VERSION_MINOR 6 #define LIBAVUTIL_VERSION_MICRO 0 #define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \ diff --git a/libswscale/swscale_internal.h b/libswscale/swscale_internal.h index 228107af6d..bd57b20d6f 100644 --- a/libswscale/swscale_internal.h +++ b/libswscale/swscale_internal.h @@ -641,6 +641,8 @@ static av_always_inline int isRGB(enum AVPixelFormat pix_fmt) (x) == AV_PIX_FMT_RGB8 || \ (x) == AV_PIX_FMT_RGB4 || \ (x) == AV_PIX_FMT_RGB4_BYTE || \ + (x) == AV_PIX_FMT_RGBA64BE || \ + (x) == AV_PIX_FMT_RGBA64LE || \ (x) == AV_PIX_FMT_MONOBLACK || \ (x) == AV_PIX_FMT_MONOWHITE) @@ -659,6 +661,8 @@ static av_always_inline int isRGB(enum AVPixelFormat pix_fmt) (x) == AV_PIX_FMT_BGR8 || \ (x) == AV_PIX_FMT_BGR4 || \ (x) == AV_PIX_FMT_BGR4_BYTE || \ + (x) == AV_PIX_FMT_BGRA64BE || \ + (x) == AV_PIX_FMT_BGRA64LE || \ (x) == AV_PIX_FMT_MONOBLACK || \ (x) == AV_PIX_FMT_MONOWHITE) diff --git a/libswscale/utils.c b/libswscale/utils.c index 2111fc2a62..7534be9366 100644 --- a/libswscale/utils.c +++ b/libswscale/utils.c @@ -133,6 +133,8 @@ static const FormatEntry format_entries[AV_PIX_FMT_NB] = { [AV_PIX_FMT_YUVA444P16LE]= { 1, 1 }, [AV_PIX_FMT_RGB48BE] = { 1, 1 }, [AV_PIX_FMT_RGB48LE] = { 1, 1 }, + [AV_PIX_FMT_RGBA64BE] = { 0, 0 }, + [AV_PIX_FMT_RGBA64LE] = { 0, 0 }, [AV_PIX_FMT_RGB565BE] = { 1, 1 }, [AV_PIX_FMT_RGB565LE] = { 1, 1 }, [AV_PIX_FMT_RGB555BE] = { 1, 1 }, @@ -154,6 +156,8 @@ static const FormatEntry format_entries[AV_PIX_FMT_NB] = { [AV_PIX_FMT_Y400A] = { 1, 0 }, [AV_PIX_FMT_BGR48BE] = { 1, 1 }, [AV_PIX_FMT_BGR48LE] = { 1, 1 }, + [AV_PIX_FMT_BGRA64BE] = { 0, 0 }, + [AV_PIX_FMT_BGRA64LE] = { 0, 0 }, [AV_PIX_FMT_YUV420P9BE] = { 1, 1 }, [AV_PIX_FMT_YUV420P9LE] = { 1, 1 }, [AV_PIX_FMT_YUV420P10BE] = { 1, 1 },