Message ID | 20220814213313.37948-2-philipl@overt.org |
---|---|
State | New |
Headers | show |
Series | V2: VAAPI: Add high bit depth encode/decode support | expand |
Context | Check | Description |
---|---|---|
yinshiyou/make_loongarch64 | success | Make finished |
yinshiyou/make_fate_loongarch64 | success | Make fate finished |
andriy/make_x86 | success | Make finished |
andriy/make_fate_x86 | success | Make fate finished |
On Sun, 2022-08-14 at 14:33 -0700, Philip Langdale wrote: > These are the formats returned by the Intel VAAPI decoder for 12bit > 4:2:2, 10bit 4:4:4, and 12bit 4:4:4 respectively. As with the already > supported Y210 and YUVA (AVUY) formats, they are the formats Microsoft > picked as their preferred 4:2:2 and 4:4:4 video formats, and Intel ran > with it. > > Y216 is simply an extension of Y210 to say all 16bits will be used, and > Y416 is a normal looking packed 4 channel format. Y410 is an annoying > format that packs three 10bit channels into 32bits with 2bits of alpha. > > As a result, I had to define Y410 as a bitstream format, even though > each pixel is byte-aligned. If it is in-fact possible to define as a > normal byte-aligned format, please let me know how. > > As with VUYA, I have kept the formal definition of Y410 and Y416 as > formats with alpha channels to maintain fidelity. The Intel folks say > they prefer this and they would rather explicitly use a format defined > as not having alpha than to silently drop it. The hardware decoder > does at least ensure the alpha channel is set to full opacity. > > Signed-off-by: Philip Langdale <philipl@overt.org> > --- > libavutil/pixdesc.c | 77 +++++++++++++++++++++++++++++++- > libavutil/pixfmt.h | 12 +++++ > tests/ref/fate/imgutils | 6 +++ > tests/ref/fate/sws-pixdesc-query | 25 +++++++++++ > 4 files changed, 119 insertions(+), 1 deletion(-) > > diff --git a/libavutil/pixdesc.c b/libavutil/pixdesc.c > index f7558ff8b9..5dee3a95d3 100644 > --- a/libavutil/pixdesc.c > +++ b/libavutil/pixdesc.c > @@ -2532,6 +2532,81 @@ static const AVPixFmtDescriptor > av_pix_fmt_descriptors[AV_PIX_FMT_NB] = { > .flags = AV_PIX_FMT_FLAG_RGB | AV_PIX_FMT_FLAG_ALPHA | > AV_PIX_FMT_FLAG_FLOAT, > }, > + [AV_PIX_FMT_Y216LE] = { > + .name = "y216le", > + .nb_components = 3, > + .log2_chroma_w = 1, > + .log2_chroma_h = 0, > + .comp = { > + { 0, 4, 0, 0, 16 }, /* Y */ > + { 0, 8, 2, 0, 16 }, /* U */ > + { 0, 8, 6, 0, 16 }, /* V */ > + }, > + }, > + [AV_PIX_FMT_Y216BE] = { > + .name = "y216be", > + .nb_components = 3, > + .log2_chroma_w = 1, > + .log2_chroma_h = 0, > + .comp = { > + { 0, 4, 0, 0, 16 }, /* Y */ > + { 0, 8, 2, 0, 16 }, /* U */ > + { 0, 8, 6, 0, 16 }, /* V */ > + }, > + .flags = AV_PIX_FMT_FLAG_BE, > + }, > + [AV_PIX_FMT_Y410LE] = { > + .name = "y410le", > + .nb_components= 4, > + .log2_chroma_w= 0, > + .log2_chroma_h= 0, > + .comp = { > + { 0, 32, 10, 0, 10 }, /* Y */ > + { 0, 32, 0, 0, 10 }, /* U */ > + { 0, 32, 20, 0, 10 }, /* V */ > + { 0, 32, 30, 0, 2 }, /* A */ > + }, > + .flags = AV_PIX_FMT_FLAG_ALPHA | AV_PIX_FMT_FLAG_BITSTREAM, > + }, > + [AV_PIX_FMT_Y410BE] = { > + .name = "y410be", > + .nb_components= 4, > + .log2_chroma_w= 0, > + .log2_chroma_h= 0, > + .comp = { > + { 0, 32, 10, 0, 10 }, /* Y */ > + { 0, 32, 0, 0, 10 }, /* U */ > + { 0, 32, 20, 0, 10 }, /* V */ > + { 0, 32, 30, 0, 2 }, /* A */ > + }, > + .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_ALPHA | > AV_PIX_FMT_FLAG_BITSTREAM, > + }, > + [AV_PIX_FMT_Y416LE] = { > + .name = "y416le", > + .nb_components= 4, > + .log2_chroma_w= 0, > + .log2_chroma_h= 0, > + .comp = { > + { 0, 8, 2, 0, 16 }, /* Y */ > + { 0, 8, 0, 0, 16 }, /* U */ > + { 0, 8, 4, 0, 16 }, /* V */ > + { 0, 8, 6, 0, 16 }, /* A */ > + }, > + .flags = AV_PIX_FMT_FLAG_ALPHA, > + }, > + [AV_PIX_FMT_Y416BE] = { > + .name = "y416be", > + .nb_components= 4, > + .log2_chroma_w= 0, > + .log2_chroma_h= 0, > + .comp = { > + { 0, 8, 2, 0, 16 }, /* Y */ > + { 0, 8, 0, 0, 16 }, /* U */ > + { 0, 8, 4, 0, 16 }, /* V */ > + { 0, 8, 6, 0, 16 }, /* A */ > + }, > + .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_ALPHA, > + }, > }; > > static const char * const color_range_names[] = { > @@ -2767,7 +2842,7 @@ void ff_check_pixfmt_descriptors(void){ > > if (!d->name && !d->nb_components && !d->log2_chroma_w && !d- > >log2_chroma_h && !d->flags) > continue; > -// av_log(NULL, AV_LOG_DEBUG, "Checking: %s\n", d->name); > + av_log(NULL, AV_LOG_INFO, "Checking: %s\n", d->name); > av_assert0(d->log2_chroma_w <= 3); > av_assert0(d->log2_chroma_h <= 3); > av_assert0(d->nb_components <= 4); > diff --git a/libavutil/pixfmt.h b/libavutil/pixfmt.h > index 86c9bdefeb..485655f0c0 100644 > --- a/libavutil/pixfmt.h > +++ b/libavutil/pixfmt.h > @@ -372,6 +372,15 @@ enum AVPixelFormat { > AV_PIX_FMT_RGBAF16BE, ///< IEEE-754 half precision packed RGBA > 16:16:16:16, 64bpp, RGBARGBA..., big-endian > AV_PIX_FMT_RGBAF16LE, ///< IEEE-754 half precision packed RGBA > 16:16:16:16, 64bpp, RGBARGBA..., little-endian > > + AV_PIX_FMT_Y216BE, ///< packed YUV 4:2:2 like YUYV422, 32bpp, big- > endian > + AV_PIX_FMT_Y216LE, ///< packed YUV 4:2:2 like YUYV422, 32bpp, big- > endian > + > + AV_PIX_FMT_Y410BE, ///< packed AVYU 2:10:10:10, 32bpp, (msb)2A 10V > 10Y 10U(lsb), big-endian > + AV_PIX_FMT_Y410LE, ///< packed AVYU 2:10:10:10, 32bpp, (msb)2A 10V > 10Y 10U(lsb), little-endian > + > + AV_PIX_FMT_Y416BE, ///< packed AVYU 16:16:16:16, 64bpp, big-endian > + AV_PIX_FMT_Y416LE, ///< packed AVYU 16:16:16:16, 64bpp, 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 > }; > > @@ -461,6 +470,9 @@ enum AVPixelFormat { > #define AV_PIX_FMT_P016 AV_PIX_FMT_NE(P016BE, P016LE) > > #define AV_PIX_FMT_Y210 AV_PIX_FMT_NE(Y210BE, Y210LE) > +#define AV_PIX_FMT_Y216 AV_PIX_FMT_NE(Y216BE, Y216LE) > +#define AV_PIX_FMT_Y410 AV_PIX_FMT_NE(Y410BE, Y410LE) > +#define AV_PIX_FMT_Y416 AV_PIX_FMT_NE(Y416BE, Y416LE) > #define AV_PIX_FMT_X2RGB10 AV_PIX_FMT_NE(X2RGB10BE, X2RGB10LE) > #define AV_PIX_FMT_X2BGR10 AV_PIX_FMT_NE(X2BGR10BE, X2BGR10LE) > > diff --git a/tests/ref/fate/imgutils b/tests/ref/fate/imgutils > index 01c9877de5..ea959c26b1 100644 > --- a/tests/ref/fate/imgutils > +++ b/tests/ref/fate/imgutils > @@ -249,3 +249,9 @@ p416le planes: 2, linesizes: 128 256 0 0, > plane_sizes: 6144 12288 > vuya planes: 1, linesizes: 256 0 0 0, plane_sizes: > 12288 0 0 0, plane_offsets: 0 0 0, total_size: 12288 > rgbaf16be planes: 1, linesizes: 512 0 0 0, plane_sizes: > 24576 0 0 0, plane_offsets: 0 0 0, total_size: 24576 > rgbaf16le planes: 1, linesizes: 512 0 0 0, plane_sizes: > 24576 0 0 0, plane_offsets: 0 0 0, total_size: 24576 > +y216be planes: 1, linesizes: 256 0 0 0, plane_sizes: > 12288 0 0 0, plane_offsets: 0 0 0, total_size: 12288 > +y216le planes: 1, linesizes: 256 0 0 0, plane_sizes: > 12288 0 0 0, plane_offsets: 0 0 0, total_size: 12288 > +y410be planes: 1, linesizes: 256 0 0 0, plane_sizes: > 12288 0 0 0, plane_offsets: 0 0 0, total_size: 12288 > +y410le planes: 1, linesizes: 256 0 0 0, plane_sizes: > 12288 0 0 0, plane_offsets: 0 0 0, total_size: 12288 > +y416be planes: 1, linesizes: 512 0 0 0, plane_sizes: > 24576 0 0 0, plane_offsets: 0 0 0, total_size: 24576 > +y416le planes: 1, linesizes: 512 0 0 0, plane_sizes: > 24576 0 0 0, plane_offsets: 0 0 0, total_size: 24576 > diff --git a/tests/ref/fate/sws-pixdesc-query b/tests/ref/fate/sws-pixdesc- > query > index f79d99e513..2dea9c5a3c 100644 > --- a/tests/ref/fate/sws-pixdesc-query > +++ b/tests/ref/fate/sws-pixdesc-query > @@ -23,6 +23,10 @@ is16BPS: > rgba64le > rgbaf16be > rgbaf16le > + y216be > + y216le > + y416be > + y416le > ya16be > ya16le > yuv420p16be > @@ -75,6 +79,8 @@ isNBPS: > xyz12le > y210be > y210le > + y410be > + y410le > yuv420p10be > yuv420p10le > yuv420p12be > @@ -164,6 +170,9 @@ isBE: > x2rgb10be > xyz12be > y210be > + y216be > + y410be > + y416be > ya16be > yuv420p10be > yuv420p12be > @@ -223,6 +232,12 @@ isYUV: > xyz12le > y210be > y210le > + y216be > + y216le > + y410be > + y410le > + y416be > + y416le > ya16be > ya16le > ya8 > @@ -665,6 +680,10 @@ ALPHA: > rgbaf16be > rgbaf16le > vuya > + y410be > + y410le > + y416be > + y416le > ya16be > ya16le > ya8 > @@ -761,6 +780,12 @@ Packed: > xyz12le > y210be > y210le > + y216be > + y216le > + y410be > + y410le > + y416be > + y416le > ya16be > ya16le > ya8 Hi Philip, May we add new formats P012, Y212 and Y412 for 12bit contents ? I agree with Mark's comment in https://patchwork.ffmpeg.org/project/ffmpeg/patch/20200619015248.21873-1-fei.w.wang@intel.com/ " Tracking it separately does not seem fun - it looks to me like it would require adding a new bit depth field to AVFrame. FFmpeg has always used pixfmt as defining both the memory layout and which bits are used in that (so, for example, ARGB and 0RGB are not the same thing), unlike most of the graphics APIs which tend to define those two separately. " The bit depth is known if using p012 for 12bit contents in the command below: $ ffmpeg -init_hw_device vaapi=vaapi:/dev/dri/renderD128 -f lavfi -i yuvtestsrc -vf "format=p012,hwupload" -c:v hevc_vaapi -f null - If using p016 for 12bit contents, how do we know the bit depth is 12 when converting yuv444 to p016 in the command below ? $ ffmpeg -init_hw_device vaapi=vaapi:/dev/dri/renderD128 -f lavfi -i yuvtestsrc -vf "format=p016,hwupload" -c:v hevc_vaapi -f null - Thanks Haihao
On Mon, 15 Aug 2022 06:12:20 +0000 "Xiang, Haihao" <haihao.xiang-at-intel.com@ffmpeg.org> wrote: > > Hi Philip, > > May we add new formats P012, Y212 and Y412 for 12bit contents ? I > agree with Mark's comment in > https://patchwork.ffmpeg.org/project/ffmpeg/patch/20200619015248.21873-1-fei.w.wang@intel.com/ > > > " > Tracking it separately does not seem fun - it looks to me like it > would require adding a new bit depth field to AVFrame. > > FFmpeg has always used pixfmt as defining both the memory layout and > which bits are used in that (so, for example, ARGB and 0RGB are not > the same thing), unlike most of the graphics APIs which tend to > define those two separately. > " I went through this same conversation a few years ago around the behaviour of nvdec, which uses p016 and yuv444p16 for 12bit content. All the same arguments were made about not introducing new pixel formats to just indicate stream depth and how we could add a new attribute but it would be a bunch of work, and to avoid bogging down and doing nothing, I just had nvdec/nvenc work with P016 (and honestly, nvidia don't even use P010 internally, it's P016 for >= 10bit) and it was fine. On the decoder side, there's no real problem, and on the encoder side, I think the key insight is that the encoder doesn't encoder to the frame's pixel format depth, it encodes to the depth _specified by the profile_. So even if you give it real 16bit frames in P016, if you are encoding Main12, you are going to get 12bit. Same for any future Main14. I'd argue this is the most correct way to handle it anyway. If the default profile we guess based on format isn't right, specify the one you actually want. > The bit depth is known if using p012 for 12bit contents in the > command below: > > $ ffmpeg -init_hw_device vaapi=vaapi:/dev/dri/renderD128 -f lavfi -i > yuvtestsrc -vf "format=p012,hwupload" -c:v hevc_vaapi -f null - > > If using p016 for 12bit contents, how do we know the bit depth is 12 > when converting yuv444 to p016 in the command below ? > > $ ffmpeg -init_hw_device vaapi=vaapi:/dev/dri/renderD128 -f lavfi -i > yuvtestsrc -vf "format=p016,hwupload" -c:v hevc_vaapi -f null - That's also my answer to your command lines: Specify the profile if the default that we guess from the format isn't what you want. It's not the say that I don't think a bit depth field on AVFrames is a terrible idea, but it's a huge project and not one that I'm interested in blocking on. We'd get nothing done otherwise. I'm very comfortable with the heuristics I've added in this patch set vs the heuristics we had before. It'll be a while before we get 14bit and profile selection actually becomes ambiguous. I don't know if QSV has different constraints that make this approach impossible but it works fine for VAAPI, and I would imagine that when implementing Microsoft's directx interfaces you have to do something similar as they fix the set of usable formats for you. --phil
On Mon, 15 Aug 2022 10:42:11 -0700 Philip Langdale <philipl@overt.org> wrote: > On Mon, 15 Aug 2022 06:12:20 +0000 > "Xiang, Haihao" <haihao.xiang-at-intel.com@ffmpeg.org> wrote: > > > > > Hi Philip, > > > > May we add new formats P012, Y212 and Y412 for 12bit contents ? I > > agree with Mark's comment in > > https://patchwork.ffmpeg.org/project/ffmpeg/patch/20200619015248.21873-1-fei.w.wang@intel.com/ > > > > > > " > > Tracking it separately does not seem fun - it looks to me like it > > would require adding a new bit depth field to AVFrame. > > > > FFmpeg has always used pixfmt as defining both the memory layout and > > which bits are used in that (so, for example, ARGB and 0RGB are not > > the same thing), unlike most of the graphics APIs which tend to > > define those two separately. > > " > > I went through this same conversation a few years ago around the > behaviour of nvdec, which uses p016 and yuv444p16 for 12bit content. > All the same arguments were made about not introducing new pixel > formats to just indicate stream depth and how we could add a new > attribute but it would be a bunch of work, and to avoid bogging down > and doing nothing, I just had nvdec/nvenc work with P016 (and > honestly, nvidia don't even use P010 internally, it's P016 for >= > 10bit) and it was fine. On the decoder side, there's no real problem, > and on the encoder side, I think the key insight is that the encoder > doesn't encoder to the frame's pixel format depth, it encodes to the > depth _specified by the profile_. So even if you give it real 16bit > frames in P016, if you are encoding Main12, you are going to get > 12bit. Same for any future Main14. I'd argue this is the most correct > way to handle it anyway. If the default profile we guess based on > format isn't right, specify the one you actually want. Hi Hai Hao, So, Mark has pointed out to me that this isn't the same situation as nvidia, because the driver is actually exposing support for specific P012, Y212, Y412 formats. I didn't realise this, which is why I took the approach I did. With this new information, I will redo it to add those formats instead of the 16bit ones (which don't have a reason to exist in ffmpeg for now). Thanks! --phil
diff --git a/libavutil/pixdesc.c b/libavutil/pixdesc.c index f7558ff8b9..5dee3a95d3 100644 --- a/libavutil/pixdesc.c +++ b/libavutil/pixdesc.c @@ -2532,6 +2532,81 @@ static const AVPixFmtDescriptor av_pix_fmt_descriptors[AV_PIX_FMT_NB] = { .flags = AV_PIX_FMT_FLAG_RGB | AV_PIX_FMT_FLAG_ALPHA | AV_PIX_FMT_FLAG_FLOAT, }, + [AV_PIX_FMT_Y216LE] = { + .name = "y216le", + .nb_components = 3, + .log2_chroma_w = 1, + .log2_chroma_h = 0, + .comp = { + { 0, 4, 0, 0, 16 }, /* Y */ + { 0, 8, 2, 0, 16 }, /* U */ + { 0, 8, 6, 0, 16 }, /* V */ + }, + }, + [AV_PIX_FMT_Y216BE] = { + .name = "y216be", + .nb_components = 3, + .log2_chroma_w = 1, + .log2_chroma_h = 0, + .comp = { + { 0, 4, 0, 0, 16 }, /* Y */ + { 0, 8, 2, 0, 16 }, /* U */ + { 0, 8, 6, 0, 16 }, /* V */ + }, + .flags = AV_PIX_FMT_FLAG_BE, + }, + [AV_PIX_FMT_Y410LE] = { + .name = "y410le", + .nb_components= 4, + .log2_chroma_w= 0, + .log2_chroma_h= 0, + .comp = { + { 0, 32, 10, 0, 10 }, /* Y */ + { 0, 32, 0, 0, 10 }, /* U */ + { 0, 32, 20, 0, 10 }, /* V */ + { 0, 32, 30, 0, 2 }, /* A */ + }, + .flags = AV_PIX_FMT_FLAG_ALPHA | AV_PIX_FMT_FLAG_BITSTREAM, + }, + [AV_PIX_FMT_Y410BE] = { + .name = "y410be", + .nb_components= 4, + .log2_chroma_w= 0, + .log2_chroma_h= 0, + .comp = { + { 0, 32, 10, 0, 10 }, /* Y */ + { 0, 32, 0, 0, 10 }, /* U */ + { 0, 32, 20, 0, 10 }, /* V */ + { 0, 32, 30, 0, 2 }, /* A */ + }, + .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_ALPHA | AV_PIX_FMT_FLAG_BITSTREAM, + }, + [AV_PIX_FMT_Y416LE] = { + .name = "y416le", + .nb_components= 4, + .log2_chroma_w= 0, + .log2_chroma_h= 0, + .comp = { + { 0, 8, 2, 0, 16 }, /* Y */ + { 0, 8, 0, 0, 16 }, /* U */ + { 0, 8, 4, 0, 16 }, /* V */ + { 0, 8, 6, 0, 16 }, /* A */ + }, + .flags = AV_PIX_FMT_FLAG_ALPHA, + }, + [AV_PIX_FMT_Y416BE] = { + .name = "y416be", + .nb_components= 4, + .log2_chroma_w= 0, + .log2_chroma_h= 0, + .comp = { + { 0, 8, 2, 0, 16 }, /* Y */ + { 0, 8, 0, 0, 16 }, /* U */ + { 0, 8, 4, 0, 16 }, /* V */ + { 0, 8, 6, 0, 16 }, /* A */ + }, + .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_ALPHA, + }, }; static const char * const color_range_names[] = { @@ -2767,7 +2842,7 @@ void ff_check_pixfmt_descriptors(void){ if (!d->name && !d->nb_components && !d->log2_chroma_w && !d->log2_chroma_h && !d->flags) continue; -// av_log(NULL, AV_LOG_DEBUG, "Checking: %s\n", d->name); + av_log(NULL, AV_LOG_INFO, "Checking: %s\n", d->name); av_assert0(d->log2_chroma_w <= 3); av_assert0(d->log2_chroma_h <= 3); av_assert0(d->nb_components <= 4); diff --git a/libavutil/pixfmt.h b/libavutil/pixfmt.h index 86c9bdefeb..485655f0c0 100644 --- a/libavutil/pixfmt.h +++ b/libavutil/pixfmt.h @@ -372,6 +372,15 @@ enum AVPixelFormat { AV_PIX_FMT_RGBAF16BE, ///< IEEE-754 half precision packed RGBA 16:16:16:16, 64bpp, RGBARGBA..., big-endian AV_PIX_FMT_RGBAF16LE, ///< IEEE-754 half precision packed RGBA 16:16:16:16, 64bpp, RGBARGBA..., little-endian + AV_PIX_FMT_Y216BE, ///< packed YUV 4:2:2 like YUYV422, 32bpp, big-endian + AV_PIX_FMT_Y216LE, ///< packed YUV 4:2:2 like YUYV422, 32bpp, big-endian + + AV_PIX_FMT_Y410BE, ///< packed AVYU 2:10:10:10, 32bpp, (msb)2A 10V 10Y 10U(lsb), big-endian + AV_PIX_FMT_Y410LE, ///< packed AVYU 2:10:10:10, 32bpp, (msb)2A 10V 10Y 10U(lsb), little-endian + + AV_PIX_FMT_Y416BE, ///< packed AVYU 16:16:16:16, 64bpp, big-endian + AV_PIX_FMT_Y416LE, ///< packed AVYU 16:16:16:16, 64bpp, 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 }; @@ -461,6 +470,9 @@ enum AVPixelFormat { #define AV_PIX_FMT_P016 AV_PIX_FMT_NE(P016BE, P016LE) #define AV_PIX_FMT_Y210 AV_PIX_FMT_NE(Y210BE, Y210LE) +#define AV_PIX_FMT_Y216 AV_PIX_FMT_NE(Y216BE, Y216LE) +#define AV_PIX_FMT_Y410 AV_PIX_FMT_NE(Y410BE, Y410LE) +#define AV_PIX_FMT_Y416 AV_PIX_FMT_NE(Y416BE, Y416LE) #define AV_PIX_FMT_X2RGB10 AV_PIX_FMT_NE(X2RGB10BE, X2RGB10LE) #define AV_PIX_FMT_X2BGR10 AV_PIX_FMT_NE(X2BGR10BE, X2BGR10LE) diff --git a/tests/ref/fate/imgutils b/tests/ref/fate/imgutils index 01c9877de5..ea959c26b1 100644 --- a/tests/ref/fate/imgutils +++ b/tests/ref/fate/imgutils @@ -249,3 +249,9 @@ p416le planes: 2, linesizes: 128 256 0 0, plane_sizes: 6144 12288 vuya planes: 1, linesizes: 256 0 0 0, plane_sizes: 12288 0 0 0, plane_offsets: 0 0 0, total_size: 12288 rgbaf16be planes: 1, linesizes: 512 0 0 0, plane_sizes: 24576 0 0 0, plane_offsets: 0 0 0, total_size: 24576 rgbaf16le planes: 1, linesizes: 512 0 0 0, plane_sizes: 24576 0 0 0, plane_offsets: 0 0 0, total_size: 24576 +y216be planes: 1, linesizes: 256 0 0 0, plane_sizes: 12288 0 0 0, plane_offsets: 0 0 0, total_size: 12288 +y216le planes: 1, linesizes: 256 0 0 0, plane_sizes: 12288 0 0 0, plane_offsets: 0 0 0, total_size: 12288 +y410be planes: 1, linesizes: 256 0 0 0, plane_sizes: 12288 0 0 0, plane_offsets: 0 0 0, total_size: 12288 +y410le planes: 1, linesizes: 256 0 0 0, plane_sizes: 12288 0 0 0, plane_offsets: 0 0 0, total_size: 12288 +y416be planes: 1, linesizes: 512 0 0 0, plane_sizes: 24576 0 0 0, plane_offsets: 0 0 0, total_size: 24576 +y416le planes: 1, linesizes: 512 0 0 0, plane_sizes: 24576 0 0 0, plane_offsets: 0 0 0, total_size: 24576 diff --git a/tests/ref/fate/sws-pixdesc-query b/tests/ref/fate/sws-pixdesc-query index f79d99e513..2dea9c5a3c 100644 --- a/tests/ref/fate/sws-pixdesc-query +++ b/tests/ref/fate/sws-pixdesc-query @@ -23,6 +23,10 @@ is16BPS: rgba64le rgbaf16be rgbaf16le + y216be + y216le + y416be + y416le ya16be ya16le yuv420p16be @@ -75,6 +79,8 @@ isNBPS: xyz12le y210be y210le + y410be + y410le yuv420p10be yuv420p10le yuv420p12be @@ -164,6 +170,9 @@ isBE: x2rgb10be xyz12be y210be + y216be + y410be + y416be ya16be yuv420p10be yuv420p12be @@ -223,6 +232,12 @@ isYUV: xyz12le y210be y210le + y216be + y216le + y410be + y410le + y416be + y416le ya16be ya16le ya8 @@ -665,6 +680,10 @@ ALPHA: rgbaf16be rgbaf16le vuya + y410be + y410le + y416be + y416le ya16be ya16le ya8 @@ -761,6 +780,12 @@ Packed: xyz12le y210be y210le + y216be + y216le + y410be + y410le + y416be + y416le ya16be ya16le ya8
These are the formats returned by the Intel VAAPI decoder for 12bit 4:2:2, 10bit 4:4:4, and 12bit 4:4:4 respectively. As with the already supported Y210 and YUVA (AVUY) formats, they are the formats Microsoft picked as their preferred 4:2:2 and 4:4:4 video formats, and Intel ran with it. Y216 is simply an extension of Y210 to say all 16bits will be used, and Y416 is a normal looking packed 4 channel format. Y410 is an annoying format that packs three 10bit channels into 32bits with 2bits of alpha. As a result, I had to define Y410 as a bitstream format, even though each pixel is byte-aligned. If it is in-fact possible to define as a normal byte-aligned format, please let me know how. As with VUYA, I have kept the formal definition of Y410 and Y416 as formats with alpha channels to maintain fidelity. The Intel folks say they prefer this and they would rather explicitly use a format defined as not having alpha than to silently drop it. The hardware decoder does at least ensure the alpha channel is set to full opacity. Signed-off-by: Philip Langdale <philipl@overt.org> --- libavutil/pixdesc.c | 77 +++++++++++++++++++++++++++++++- libavutil/pixfmt.h | 12 +++++ tests/ref/fate/imgutils | 6 +++ tests/ref/fate/sws-pixdesc-query | 25 +++++++++++ 4 files changed, 119 insertions(+), 1 deletion(-)