[FFmpeg-devel] Add new pix_fmt RGBA64, BGRA64
Stefano Sabatini
stefasab at gmail.com
Fri Sep 23 15:49:16 CEST 2011
On date Friday 2011-09-23 10:21:16 +0200, Jean First encoded:
> Adds the pix_fmt RGBA64[LE,BE] BGRA64[LE,BE]. But no sws functions included.
> Jean
> From c6dc453c6a9c3eae20ff121e5628fb77897800d3 Mon Sep 17 00:00:00 2001
> From: Jean First <jeanfirst at gmail.com>
> Date: Fri, 23 Sep 2011 02:05:22 +0200
> Subject: [PATCH] Add new pix_fmt RGBA64
>
> ---
> libavcodec/imgconvert.c | 22 ++++++++++++++++++
> libavutil/pixdesc.c | 50 +++++++++++++++++++++++++++++++++++++++++
> libavutil/pixfmt.h | 6 +++++
> libswscale/swscale_internal.h | 18 ++++++++++++++-
> libswscale/utils.c | 4 +++
> 5 files changed, 99 insertions(+), 1 deletions(-)
>
> diff --git a/libavcodec/imgconvert.c b/libavcodec/imgconvert.c
> index 13c2cde..5f5a50e 100644
> --- a/libavcodec/imgconvert.c
> +++ b/libavcodec/imgconvert.c
> @@ -143,6 +143,14 @@ static const PixFmtInfo pix_fmt_info[PIX_FMT_NB] = {
> [PIX_FMT_RGB48LE] = {
> .color_type = FF_COLOR_RGB,
> },
> + [PIX_FMT_RGBA64BE] = {
> + .is_alpha = 1,
> + .color_type = FF_COLOR_RGB,
> + },
> + [PIX_FMT_RGBA64LE] = {
> + .is_alpha = 1,
> + .color_type = FF_COLOR_RGB,
> + },
> [PIX_FMT_RGB565BE] = {
> .color_type = FF_COLOR_RGB,
> },
> @@ -195,6 +203,20 @@ static const PixFmtInfo pix_fmt_info[PIX_FMT_NB] = {
> .is_alpha = 1,
> .color_type = FF_COLOR_RGB,
> },
> + [PIX_FMT_BGR48BE] = {
> + .color_type = FF_COLOR_RGB,
> + },
> + [PIX_FMT_BGR48LE] = {
> + .color_type = FF_COLOR_RGB,
> + },
> + [PIX_FMT_BGRA64BE] = {
> + .is_alpha = 1,
> + .color_type = FF_COLOR_RGB,
> + },
> + [PIX_FMT_BGRA64LE] = {
> + .is_alpha = 1,
> + .color_type = FF_COLOR_RGB,
> + },
> [PIX_FMT_BGR565BE] = {
> .color_type = FF_COLOR_RGB,
> .padded_size = 16,
> diff --git a/libavutil/pixdesc.c b/libavutil/pixdesc.c
> index 8a19be1..1b97ab2 100644
> --- a/libavutil/pixdesc.c
> +++ b/libavutil/pixdesc.c
> @@ -561,6 +561,31 @@ const AVPixFmtDescriptor av_pix_fmt_descriptors[PIX_FMT_NB] = {
> {0,5,5,0,15}, /* B */
> },
> },
> + [PIX_FMT_RGBA64BE] = {
> + .name = "rgba64be",
> + .nb_components= 4,
> + .log2_chroma_w= 0,
> + .log2_chroma_h= 0,
> + .comp = {
> + {0,5,1,0,15}, /* R */
> + {0,5,3,0,15}, /* G */
> + {0,5,5,0,15}, /* B */
> + {0,5,7,0,15}, /* A */
> + },
> + .flags = PIX_FMT_BE,
> + },
> + [PIX_FMT_RGBA64LE] = {
> + .name = "rgba64le",
> + .nb_components= 4,
> + .log2_chroma_w= 0,
> + .log2_chroma_h= 0,
> + .comp = {
> + {0,5,1,0,15}, /* R */
> + {0,5,3,0,15}, /* G */
> + {0,5,5,0,15}, /* B */
> + {0,5,7,0,15}, /* B */
> + },
> + },
> [PIX_FMT_RGB565BE] = {
> .name = "rgb565be",
> .nb_components= 3,
> @@ -653,6 +678,31 @@ const AVPixFmtDescriptor av_pix_fmt_descriptors[PIX_FMT_NB] = {
> {0,5,5,0,15}, /* R */
> },
> },
> + [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 = PIX_FMT_BE,
> + },
> + [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 */
> + },
> + },
> [PIX_FMT_BGR565BE] = {
> .name = "bgr565be",
> .nb_components= 3,
> diff --git a/libavutil/pixfmt.h b/libavutil/pixfmt.h
> index bac7b45..96cc3f8 100644
> --- a/libavutil/pixfmt.h
> +++ b/libavutil/pixfmt.h
> @@ -104,6 +104,8 @@ enum PixelFormat {
> PIX_FMT_VDPAU_VC1, ///< VC-1 HW decoding with VDPAU, data[0] contains a vdpau_render_state struct which contains the bitstream of the slices as well as various fields extracted from headers
> PIX_FMT_RGB48BE, ///< packed RGB 16:16:16, 48bpp, 16R, 16G, 16B, the 2-byte value for each R/G/B component is stored as big-endian
> PIX_FMT_RGB48LE, ///< packed RGB 16:16:16, 48bpp, 16R, 16G, 16B, the 2-byte value for each R/G/B component is stored as little-endian
> + 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
> + 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
>
> PIX_FMT_RGB565BE, ///< packed RGB 5:6:5, 16bpp, (msb) 5R 6G 5B(lsb), big-endian
> PIX_FMT_RGB565LE, ///< packed RGB 5:6:5, 16bpp, (msb) 5R 6G 5B(lsb), little-endian
> @@ -135,6 +137,8 @@ enum PixelFormat {
> PIX_FMT_GRAY8A, ///< 8bit gray, 8bit alpha
> PIX_FMT_BGR48BE, ///< packed RGB 16:16:16, 48bpp, 16B, 16G, 16R, the 2-byte value for each R/G/B component is stored as big-endian
> PIX_FMT_BGR48LE, ///< packed RGB 16:16:16, 48bpp, 16B, 16G, 16R, the 2-byte value for each R/G/B component is stored as little-endian
> + 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
> + 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
>
> //the following 10 formats have the disadvantage of needing 1 format for each bit depth, thus
> //If you want to support multiple bit depths, then using PIX_FMT_YUV420P16* with the bpp stored seperately
> @@ -167,10 +171,12 @@ enum PixelFormat {
>
> #define PIX_FMT_GRAY16 PIX_FMT_NE(GRAY16BE, GRAY16LE)
> #define PIX_FMT_RGB48 PIX_FMT_NE(RGB48BE, RGB48LE)
> +#define PIX_FMT_RGB64 PIX_FMT_NE(RGBA64BE, RGBA64LE)
> #define PIX_FMT_RGB565 PIX_FMT_NE(RGB565BE, RGB565LE)
> #define PIX_FMT_RGB555 PIX_FMT_NE(RGB555BE, RGB555LE)
> #define PIX_FMT_RGB444 PIX_FMT_NE(RGB444BE, RGB444LE)
> #define PIX_FMT_BGR48 PIX_FMT_NE(BGR48BE, BGR48LE)
> +#define PIX_FMT_BGRA64 PIX_FMT_NE(BGRA64BE, BGRA64LE)
> #define PIX_FMT_BGR565 PIX_FMT_NE(BGR565BE, BGR565LE)
> #define PIX_FMT_BGR555 PIX_FMT_NE(BGR555BE, BGR555LE)
> #define PIX_FMT_BGR444 PIX_FMT_NE(BGR444BE, BGR444LE)
> diff --git a/libswscale/swscale_internal.h b/libswscale/swscale_internal.h
> index 3267d1e..07ae72b 100644
> --- a/libswscale/swscale_internal.h
> +++ b/libswscale/swscale_internal.h
> @@ -533,6 +533,10 @@ const char *sws_format_name(enum PixelFormat format);
> || (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 \
> @@ -606,6 +610,8 @@ const char *sws_format_name(enum PixelFormat format);
> #define isRGBinInt(x) ( \
> (x)==PIX_FMT_RGB48BE \
> || (x)==PIX_FMT_RGB48LE \
> + || (x)==PIX_FMT_RGBA64BE \
> + || (x)==PIX_FMT_RGBA64LE \
> || (x)==PIX_FMT_RGB32 \
> || (x)==PIX_FMT_RGB32_1 \
> || (x)==PIX_FMT_RGB24 \
> @@ -624,6 +630,8 @@ const char *sws_format_name(enum PixelFormat format);
> #define isBGRinInt(x) ( \
> (x)==PIX_FMT_BGR48BE \
> || (x)==PIX_FMT_BGR48LE \
> + || (x)==PIX_FMT_BGRA64BE \
> + || (x)==PIX_FMT_BGRA64LE \
> || (x)==PIX_FMT_BGR32 \
> || (x)==PIX_FMT_BGR32_1 \
> || (x)==PIX_FMT_BGR24 \
> @@ -642,6 +650,8 @@ const char *sws_format_name(enum PixelFormat format);
> #define isRGBinBytes(x) ( \
> (x)==PIX_FMT_RGB48BE \
> || (x)==PIX_FMT_RGB48LE \
> + || (x)==PIX_FMT_RGBA64BE \
> + || (x)==PIX_FMT_RGBA64LE \
> || (x)==PIX_FMT_RGBA \
> || (x)==PIX_FMT_ARGB \
> || (x)==PIX_FMT_RGB24 \
> @@ -649,6 +659,8 @@ const char *sws_format_name(enum PixelFormat format);
> #define isBGRinBytes(x) ( \
> (x)==PIX_FMT_BGR48BE \
> || (x)==PIX_FMT_BGR48LE \
> + || (x)==PIX_FMT_BGRA64BE \
> + || (x)==PIX_FMT_BGRA64LE \
> || (x)==PIX_FMT_BGRA \
> || (x)==PIX_FMT_ABGR \
> || (x)==PIX_FMT_BGR24 \
> @@ -658,7 +670,11 @@ const char *sws_format_name(enum PixelFormat format);
> || isBGRinInt(x) \
> )
> #define isALPHA(x) ( \
> - (x)==PIX_FMT_BGR32 \
> + (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 \
Note: these should all be made properties in the format_entries array.
> diff --git a/libswscale/utils.c b/libswscale/utils.c
> index 8b793f7..a851d99 100644
> --- a/libswscale/utils.c
> +++ b/libswscale/utils.c
> @@ -107,6 +107,8 @@ const static FormatEntry format_entries[PIX_FMT_NB] = {
> [PIX_FMT_YUVA420P] = { 1 , 1 },
> [PIX_FMT_RGB48BE] = { 1 , 1 },
> [PIX_FMT_RGB48LE] = { 1 , 1 },
> + [PIX_FMT_RGBA64BE] = { 0 , 0 },
> + [PIX_FMT_RGBA64LE] = { 0 , 0 },
> [PIX_FMT_RGB565BE] = { 1 , 1 },
> [PIX_FMT_RGB565LE] = { 1 , 1 },
> [PIX_FMT_RGB555BE] = { 1 , 1 },
> @@ -128,6 +130,8 @@ const static FormatEntry format_entries[PIX_FMT_NB] = {
> [PIX_FMT_Y400A] = { 1 , 0 },
> [PIX_FMT_BGR48BE] = { 1 , 1 },
> [PIX_FMT_BGR48LE] = { 1 , 1 },
> + [PIX_FMT_BGRA64BE] = { 0 , 0 },
> + [PIX_FMT_BGRA64LE] = { 0 , 0 },
> [PIX_FMT_YUV420P9BE] = { 1 , 1 },
> [PIX_FMT_YUV420P9LE] = { 1 , 1 },
> [PIX_FMT_YUV420P10BE] = { 1 , 1 },
Looks fine, I'll apply in a day or two if I see no more comments,
thanks.
--
FFmpeg = Freak and Faithful Merciful Power Ecletic Guru
More information about the ffmpeg-devel
mailing list