* [FFmpeg-devel] [PATCH] libavcodec/amfenc: Add more pixel formats support @ 2023-07-18 7:33 Evgeny Pavlov 2023-10-20 8:13 ` Evgeny Pavlov 0 siblings, 1 reply; 4+ messages in thread From: Evgeny Pavlov @ 2023-07-18 7:33 UTC (permalink / raw) To: ffmpeg-devel; +Cc: Evgeny Pavlov This commit adds BGRA, RGBA and ARGB pixel formats for AMF encoders Signed-off-by: Evgeny Pavlov <lucenticus@gmail.com> --- libavcodec/amfenc.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/libavcodec/amfenc.c b/libavcodec/amfenc.c index cb48f8c273..234cd012ef 100644 --- a/libavcodec/amfenc.c +++ b/libavcodec/amfenc.c @@ -74,6 +74,9 @@ static const FormatMap format_map[] = { AV_PIX_FMT_NV12, AMF_SURFACE_NV12 }, { AV_PIX_FMT_BGR0, AMF_SURFACE_BGRA }, { AV_PIX_FMT_RGB0, AMF_SURFACE_RGBA }, + { AV_PIX_FMT_BGRA, AMF_SURFACE_BGRA }, + { AV_PIX_FMT_RGBA, AMF_SURFACE_RGBA }, + { AV_PIX_FMT_ARGB, AMF_SURFACE_ARGB }, { AV_PIX_FMT_GRAY8, AMF_SURFACE_GRAY8 }, { AV_PIX_FMT_YUV420P, AMF_SURFACE_YUV420P }, { AV_PIX_FMT_YUYV422, AMF_SURFACE_YUY2 }, -- 2.37.3.windows.1 _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe". ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [FFmpeg-devel] [PATCH] libavcodec/amfenc: Add more pixel formats support 2023-07-18 7:33 [FFmpeg-devel] [PATCH] libavcodec/amfenc: Add more pixel formats support Evgeny Pavlov @ 2023-10-20 8:13 ` Evgeny Pavlov 2023-10-22 15:01 ` Mark Thompson 0 siblings, 1 reply; 4+ messages in thread From: Evgeny Pavlov @ 2023-10-20 8:13 UTC (permalink / raw) To: ffmpeg-devel On Tue, Jul 18, 2023 at 10:32 AM Evgeny Pavlov <lucenticus@gmail.com> wrote: > This commit adds BGRA, RGBA and ARGB pixel formats for AMF encoders > > Signed-off-by: Evgeny Pavlov <lucenticus@gmail.com> > --- > libavcodec/amfenc.c | 3 +++ > 1 file changed, 3 insertions(+) > > diff --git a/libavcodec/amfenc.c b/libavcodec/amfenc.c > index cb48f8c273..234cd012ef 100644 > --- a/libavcodec/amfenc.c > +++ b/libavcodec/amfenc.c > @@ -74,6 +74,9 @@ static const FormatMap format_map[] = > { AV_PIX_FMT_NV12, AMF_SURFACE_NV12 }, > { AV_PIX_FMT_BGR0, AMF_SURFACE_BGRA }, > { AV_PIX_FMT_RGB0, AMF_SURFACE_RGBA }, > + { AV_PIX_FMT_BGRA, AMF_SURFACE_BGRA }, > + { AV_PIX_FMT_RGBA, AMF_SURFACE_RGBA }, > + { AV_PIX_FMT_ARGB, AMF_SURFACE_ARGB }, > { AV_PIX_FMT_GRAY8, AMF_SURFACE_GRAY8 }, > { AV_PIX_FMT_YUV420P, AMF_SURFACE_YUV420P }, > { AV_PIX_FMT_YUYV422, AMF_SURFACE_YUY2 }, > -- > 2.37.3.windows.1 > > The purpose of this patch is to fix an issue with feeding ddagrab output to AMF directly. The output of ddagrab might be BGRA, AMF supports this input, but failed to encode due to missing mapping from AV_PIX_BGRA to AMF_SURFACE_BGRA in amfenc.c DXGI isn't firm to distinguish between RGBA & RGBX, so it is safer to support both to avoid failures like with ddagrab. _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe". ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [FFmpeg-devel] [PATCH] libavcodec/amfenc: Add more pixel formats support 2023-10-20 8:13 ` Evgeny Pavlov @ 2023-10-22 15:01 ` Mark Thompson 2023-10-23 13:12 ` Evgeny Pavlov 0 siblings, 1 reply; 4+ messages in thread From: Mark Thompson @ 2023-10-22 15:01 UTC (permalink / raw) To: ffmpeg-devel On 20/10/2023 09:13, Evgeny Pavlov wrote: > On Tue, Jul 18, 2023 at 10:32 AM Evgeny Pavlov <lucenticus@gmail.com> wrote: > >> This commit adds BGRA, RGBA and ARGB pixel formats for AMF encoders >> >> Signed-off-by: Evgeny Pavlov <lucenticus@gmail.com> >> --- >> libavcodec/amfenc.c | 3 +++ >> 1 file changed, 3 insertions(+) >> >> diff --git a/libavcodec/amfenc.c b/libavcodec/amfenc.c >> index cb48f8c273..234cd012ef 100644 >> --- a/libavcodec/amfenc.c >> +++ b/libavcodec/amfenc.c >> @@ -74,6 +74,9 @@ static const FormatMap format_map[] = >> { AV_PIX_FMT_NV12, AMF_SURFACE_NV12 }, >> { AV_PIX_FMT_BGR0, AMF_SURFACE_BGRA }, >> { AV_PIX_FMT_RGB0, AMF_SURFACE_RGBA }, >> + { AV_PIX_FMT_BGRA, AMF_SURFACE_BGRA }, >> + { AV_PIX_FMT_RGBA, AMF_SURFACE_RGBA }, >> + { AV_PIX_FMT_ARGB, AMF_SURFACE_ARGB }, >> { AV_PIX_FMT_GRAY8, AMF_SURFACE_GRAY8 }, >> { AV_PIX_FMT_YUV420P, AMF_SURFACE_YUV420P }, >> { AV_PIX_FMT_YUYV422, AMF_SURFACE_YUY2 }, >> -- >> 2.37.3.windows.1 >> >> The purpose of this patch is to fix an issue with feeding ddagrab output > to AMF directly. The output of ddagrab might be BGRA, AMF supports this > input, but failed to encode due to missing mapping from AV_PIX_BGRA to > AMF_SURFACE_BGRA in amfenc.c > DXGI isn't firm to distinguish between RGBA & RGBX, so it is safer to > support both to avoid failures like with ddagrab. See patch just sent to fix the bug in ddagrab that it incorrectly advertises an alpha channel. Do you have ddagrab->amfenc working with just something to fix the alpha channel? To make it work I also need to mess with the bind flags because amfenc wants to use the textures as shader resources. This has been noted as a problem before, where a proper fix would require large changes in the format negotiation setup and so it hasn't been done. I'm wondering whether adding "-bind_flags shader_resource" option to ddagrab would be a plausible hack for these cases, or whether that's a bit too obscure for an actual user? Thanks, - Mark _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe". ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [FFmpeg-devel] [PATCH] libavcodec/amfenc: Add more pixel formats support 2023-10-22 15:01 ` Mark Thompson @ 2023-10-23 13:12 ` Evgeny Pavlov 0 siblings, 0 replies; 4+ messages in thread From: Evgeny Pavlov @ 2023-10-23 13:12 UTC (permalink / raw) To: FFmpeg development discussions and patches On Sun, Oct 22, 2023 at 5:01 PM Mark Thompson <sw@jkqxz.net> wrote: > On 20/10/2023 09:13, Evgeny Pavlov wrote: > > On Tue, Jul 18, 2023 at 10:32 AM Evgeny Pavlov <lucenticus@gmail.com> > wrote: > > > >> This commit adds BGRA, RGBA and ARGB pixel formats for AMF encoders > >> > >> Signed-off-by: Evgeny Pavlov <lucenticus@gmail.com> > >> --- > >> libavcodec/amfenc.c | 3 +++ > >> 1 file changed, 3 insertions(+) > >> > >> diff --git a/libavcodec/amfenc.c b/libavcodec/amfenc.c > >> index cb48f8c273..234cd012ef 100644 > >> --- a/libavcodec/amfenc.c > >> +++ b/libavcodec/amfenc.c > >> @@ -74,6 +74,9 @@ static const FormatMap format_map[] = > >> { AV_PIX_FMT_NV12, AMF_SURFACE_NV12 }, > >> { AV_PIX_FMT_BGR0, AMF_SURFACE_BGRA }, > >> { AV_PIX_FMT_RGB0, AMF_SURFACE_RGBA }, > >> + { AV_PIX_FMT_BGRA, AMF_SURFACE_BGRA }, > >> + { AV_PIX_FMT_RGBA, AMF_SURFACE_RGBA }, > >> + { AV_PIX_FMT_ARGB, AMF_SURFACE_ARGB }, > >> { AV_PIX_FMT_GRAY8, AMF_SURFACE_GRAY8 }, > >> { AV_PIX_FMT_YUV420P, AMF_SURFACE_YUV420P }, > >> { AV_PIX_FMT_YUYV422, AMF_SURFACE_YUY2 }, > >> -- > >> 2.37.3.windows.1 > >> > >> The purpose of this patch is to fix an issue with feeding ddagrab output > > to AMF directly. The output of ddagrab might be BGRA, AMF supports this > > input, but failed to encode due to missing mapping from AV_PIX_BGRA to > > AMF_SURFACE_BGRA in amfenc.c > > DXGI isn't firm to distinguish between RGBA & RGBX, so it is safer to > > support both to avoid failures like with ddagrab. > > See patch just sent to fix the bug in ddagrab that it incorrectly > advertises an alpha channel. > > Do you have ddagrab->amfenc working with just something to fix the alpha > channel? To make it work I also need to mess with the bind flags because > amfenc wants to use the textures as shader resources. > > This has been noted as a problem before, where a proper fix would require > large changes in the format negotiation setup and so it hasn't been done. > I'm wondering whether adding "-bind_flags shader_resource" option to > ddagrab would be a plausible hack for these cases, or whether that's a bit > too obscure for an actual user? > > Thanks, > > - Mark > _______________________________________________ > ffmpeg-devel mailing list > ffmpeg-devel@ffmpeg.org > https://ffmpeg.org/mailman/listinfo/ffmpeg-devel > > To unsubscribe, visit link above, or email > ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".> > > Yes, I have ddagrab->amfenc working with just fixing alpha channel, but AMF encoders sometimes use shader, sometimes VCN for color conversion - it depends on HW capabilities. I would suggest to always set bind in ddgrab to D3D11_BIND_SHADER_RESOURCE, because this is no reason not to do it. Thanks, Evgeny _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe". ^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2023-10-23 13:13 UTC | newest] Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2023-07-18 7:33 [FFmpeg-devel] [PATCH] libavcodec/amfenc: Add more pixel formats support Evgeny Pavlov 2023-10-20 8:13 ` Evgeny Pavlov 2023-10-22 15:01 ` Mark Thompson 2023-10-23 13:12 ` Evgeny Pavlov
Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel This inbox may be cloned and mirrored by anyone: git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git # If you have public-inbox 1.1+ installed, you may # initialize and index your mirror using the following commands: public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \ ffmpegdev@gitmailbox.com public-inbox-index ffmpegdev Example config snippet for mirrors. AGPL code for this site: git clone https://public-inbox.org/public-inbox.git