From cb7c11cc9e7e05c819fff487a3f486f11ab4b860 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Storsj=C3=B6?= Date: Fri, 27 May 2011 22:21:40 +0300 Subject: avoptions: Add an av_opt_flag_is_set function for inspecting flag fields MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Martin Storsjö --- libavutil/avutil.h | 2 +- libavutil/opt.c | 10 ++++++++++ libavutil/opt.h | 10 ++++++++++ 3 files changed, 21 insertions(+), 1 deletion(-) (limited to 'libavutil') diff --git a/libavutil/avutil.h b/libavutil/avutil.h index 9c660f3a99..0299bdf797 100644 --- a/libavutil/avutil.h +++ b/libavutil/avutil.h @@ -40,7 +40,7 @@ #define AV_VERSION(a, b, c) AV_VERSION_DOT(a, b, c) #define LIBAVUTIL_VERSION_MAJOR 51 -#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/libavutil/opt.c b/libavutil/opt.c index 172fcec456..7775bb2af3 100644 --- a/libavutil/opt.c +++ b/libavutil/opt.c @@ -320,6 +320,16 @@ int64_t av_get_int(void *obj, const char *name, const AVOption **o_out) return num*intnum/den; } +int av_opt_flag_is_set(void *obj, const char *field_name, const char *flag_name) +{ + const AVOption *field = av_find_opt(obj, field_name, NULL, 0, 0); + const AVOption *flag = av_find_opt(obj, flag_name, NULL, 0, 0); + + if (!field || !flag || flag->type != FF_OPT_TYPE_CONST) + return 0; + return av_get_int(obj, field_name, NULL) & (int) flag->default_val.dbl; +} + static void opt_list(void *obj, void *av_log_obj, const char *unit, int req_flags, int rej_flags) { diff --git a/libavutil/opt.h b/libavutil/opt.h index 8c3b6c1c36..46ad8acce1 100644 --- a/libavutil/opt.h +++ b/libavutil/opt.h @@ -181,4 +181,14 @@ int av_set_options_string(void *ctx, const char *opts, */ void av_opt_free(void *obj); +/** + * Check whether a particular flag is set in a flags field. + * + * @param field_name the name of the flag field option + * @param flag_name the name of the flag to check + * @return non-zero if the flag is set, zero if the flag isn't set, + * isn't of the right type, or the flags field doesn't exist. + */ +int av_opt_flag_is_set(void *obj, const char *field_name, const char *flag_name); + #endif /* AVUTIL_OPT_H */ -- cgit v1.2.3 From 103278f7b0b037a4a6184865ca9b8d021ec9be85 Mon Sep 17 00:00:00 2001 From: "Ronald S. Bultje" Date: Wed, 8 Jun 2011 19:16:39 -0700 Subject: libavutil/swscale: YUV444P10/YUV444P9 support. Also add missing glue code for recently added YUV422P10 formats to swscale. Signed-off-by: Ronald S. Bultje --- libavutil/pixdesc.c | 46 ++++++++++++++++++++++++++++++++++++++++++++++ libavutil/pixfmt.h | 6 ++++++ 2 files changed, 52 insertions(+) (limited to 'libavutil') diff --git a/libavutil/pixdesc.c b/libavutil/pixdesc.c index 77584755d6..efc7c7ea0e 100644 --- a/libavutil/pixdesc.c +++ b/libavutil/pixdesc.c @@ -878,6 +878,52 @@ const AVPixFmtDescriptor av_pix_fmt_descriptors[PIX_FMT_NB] = { }, .flags = PIX_FMT_BE, }, + [PIX_FMT_YUV444P10LE] = { + .name = "yuv444p10le", + .nb_components= 3, + .log2_chroma_w= 0, + .log2_chroma_h= 0, + .comp = { + {0,1,1,0,9}, /* Y */ + {1,1,1,0,9}, /* U */ + {2,1,1,0,9}, /* V */ + }, + }, + [PIX_FMT_YUV444P10BE] = { + .name = "yuv444p10be", + .nb_components= 3, + .log2_chroma_w= 0, + .log2_chroma_h= 0, + .comp = { + {0,1,1,0,9}, /* Y */ + {1,1,1,0,9}, /* U */ + {2,1,1,0,9}, /* V */ + }, + .flags = PIX_FMT_BE, + }, + [PIX_FMT_YUV444P9LE] = { + .name = "yuv444p9le", + .nb_components= 3, + .log2_chroma_w= 0, + .log2_chroma_h= 0, + .comp = { + {0,1,1,0,8}, /* Y */ + {1,1,1,0,8}, /* U */ + {2,1,1,0,8}, /* V */ + }, + }, + [PIX_FMT_YUV444P9BE] = { + .name = "yuv444p9be", + .nb_components= 3, + .log2_chroma_w= 0, + .log2_chroma_h= 0, + .comp = { + {0,1,1,0,9}, /* Y */ + {1,1,1,0,9}, /* U */ + {2,1,1,0,9}, /* V */ + }, + .flags = PIX_FMT_BE, + }, [PIX_FMT_DXVA2_VLD] = { .name = "dxva2_vld", .log2_chroma_w = 1, diff --git a/libavutil/pixfmt.h b/libavutil/pixfmt.h index d88775f462..e852d85519 100644 --- a/libavutil/pixfmt.h +++ b/libavutil/pixfmt.h @@ -141,6 +141,10 @@ enum PixelFormat { PIX_FMT_YUV420P10LE,///< planar YUV 4:2:0, 15bpp, (1 Cr & Cb sample per 2x2 Y samples), little-endian PIX_FMT_YUV422P10BE,///< planar YUV 4:2:2, 20bpp, (1 Cr & Cb sample per 2x1 Y samples), little-endian PIX_FMT_YUV422P10LE,///< planar YUV 4:2:2, 20bpp, (1 Cr & Cb sample per 2x1 Y samples), big-endian + PIX_FMT_YUV444P9BE, ///< planar YUV 4:4:4, 27bpp, (1 Cr & Cb sample per 1x1 Y samples), little-endian + PIX_FMT_YUV444P9LE, ///< planar YUV 4:4:4, 27bpp, (1 Cr & Cb sample per 1x1 Y samples), big-endian + PIX_FMT_YUV444P10BE,///< planar YUV 4:4:4, 30bpp, (1 Cr & Cb sample per 1x1 Y samples), little-endian + PIX_FMT_YUV444P10LE,///< planar YUV 4:4:4, 30bpp, (1 Cr & Cb sample per 1x1 Y samples), big-endian 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 }; @@ -166,8 +170,10 @@ enum PixelFormat { #define PIX_FMT_BGR444 PIX_FMT_NE(BGR444BE, BGR444LE) #define PIX_FMT_YUV420P9 PIX_FMT_NE(YUV420P9BE , YUV420P9LE) +#define PIX_FMT_YUV444P9 PIX_FMT_NE(YUV444P9BE , YUV444P9LE) #define PIX_FMT_YUV420P10 PIX_FMT_NE(YUV420P10BE, YUV420P10LE) #define PIX_FMT_YUV422P10 PIX_FMT_NE(YUV422P10BE, YUV422P10LE) +#define PIX_FMT_YUV444P10 PIX_FMT_NE(YUV444P10BE, YUV444P10LE) #define PIX_FMT_YUV420P16 PIX_FMT_NE(YUV420P16BE, YUV420P16LE) #define PIX_FMT_YUV422P16 PIX_FMT_NE(YUV422P16BE, YUV422P16LE) #define PIX_FMT_YUV444P16 PIX_FMT_NE(YUV444P16BE, YUV444P16LE) -- cgit v1.2.3