Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
* [FFmpeg-devel] [PATCH 1/2] hwcontext_d3d11: Add BGR0 support
@ 2023-10-22 14:54 Mark Thompson
  2023-10-22 14:56 ` [FFmpeg-devel] [PATCH 2/2] lavfi/ddagrab: Fix 8-bit BGR output to not advertise an alpha component Mark Thompson
  2023-11-27 13:43 ` [FFmpeg-devel] [PATCH 1/2] hwcontext_d3d11: Add BGR0 support Mark Thompson
  0 siblings, 2 replies; 3+ messages in thread
From: Mark Thompson @ 2023-10-22 14:54 UTC (permalink / raw)
  To: FFmpeg development discussions and patches

The 8-bit four-component DXGI container is also used for three-component
RGB without alpha.
---
This list is only used for AV->DXGI mapping, so it doesn't matter that there are duplicate DXGI formats in the list.

  libavutil/hwcontext_d3d11va.c | 1 +
  1 file changed, 1 insertion(+)

diff --git a/libavutil/hwcontext_d3d11va.c b/libavutil/hwcontext_d3d11va.c
index cc8c97d2b6..1d249f2088 100644
--- a/libavutil/hwcontext_d3d11va.c
+++ b/libavutil/hwcontext_d3d11va.c
@@ -86,6 +86,7 @@ static const struct {
  } supported_formats[] = {
      { DXGI_FORMAT_NV12,         AV_PIX_FMT_NV12 },
      { DXGI_FORMAT_P010,         AV_PIX_FMT_P010 },
+    { DXGI_FORMAT_B8G8R8A8_UNORM,    AV_PIX_FMT_BGR0 },
      { DXGI_FORMAT_B8G8R8A8_UNORM,    AV_PIX_FMT_BGRA },
      { DXGI_FORMAT_R10G10B10A2_UNORM, AV_PIX_FMT_X2BGR10 },
      { DXGI_FORMAT_R16G16B16A16_FLOAT, AV_PIX_FMT_RGBAF16 },
-- 
2.39.2
_______________________________________________
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] 3+ messages in thread

* [FFmpeg-devel] [PATCH 2/2] lavfi/ddagrab: Fix 8-bit BGR output to not advertise an alpha component
  2023-10-22 14:54 [FFmpeg-devel] [PATCH 1/2] hwcontext_d3d11: Add BGR0 support Mark Thompson
@ 2023-10-22 14:56 ` Mark Thompson
  2023-11-27 13:43 ` [FFmpeg-devel] [PATCH 1/2] hwcontext_d3d11: Add BGR0 support Mark Thompson
  1 sibling, 0 replies; 3+ messages in thread
From: Mark Thompson @ 2023-10-22 14:56 UTC (permalink / raw)
  To: FFmpeg development discussions and patches

There is never an alpha component here, so the actual format is BGR0
rather than BGRA.  This fixes cases which maintain the alpha component
and therefore generate unexpected results.
---
E.g. fixes download and encode with PNG to make an RGB PNG as expected, rather than an RGBA PNG with nothing in the alpha channel.  (Previously this was relying on the user to realise that the alpha channel contained nothing and ignore it.)

  doc/filters.texi           | 2 +-
  libavfilter/vsrc_ddagrab.c | 6 +++---
  2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/doc/filters.texi b/doc/filters.texi
index f5032ddf74..550f9a6ecc 100644
--- a/doc/filters.texi
+++ b/doc/filters.texi
@@ -28183,7 +28183,7 @@ It accepts the following values:
  @item auto
  Passes all supported output formats to DDA and returns what DDA decides to use.
  @item 8bit
-@item bgra
+@item bgrx
  8 Bit formats always work, and DDA will convert to them if neccesary.
  @item 10bit
  @item x2bgr10
diff --git a/libavfilter/vsrc_ddagrab.c b/libavfilter/vsrc_ddagrab.c
index 9c59faf53e..8ff3c97959 100644
--- a/libavfilter/vsrc_ddagrab.c
+++ b/libavfilter/vsrc_ddagrab.c
@@ -115,14 +115,14 @@ static const AVOption ddagrab_options[] = {
      { "output_fmt", "desired output format",       OFFSET(out_fmt),    AV_OPT_TYPE_INT,        { .i64 = DXGI_FORMAT_B8G8R8A8_UNORM },    0, INT_MAX, FLAGS, "output_fmt" },
      { "auto",       "let dda pick its preferred format", 0,            AV_OPT_TYPE_CONST,      { .i64 = 0 },                             0, INT_MAX, FLAGS, "output_fmt" },
      { "8bit",       "only output default 8 Bit format",  0,            AV_OPT_TYPE_CONST,      { .i64 = DXGI_FORMAT_B8G8R8A8_UNORM },    0, INT_MAX, FLAGS, "output_fmt" },
-    { "bgra",       "only output 8 Bit BGRA",            0,            AV_OPT_TYPE_CONST,      { .i64 = DXGI_FORMAT_B8G8R8A8_UNORM },    0, INT_MAX, FLAGS, "output_fmt" },
+    { "bgrx",       "only output 8 Bit BGRX",            0,            AV_OPT_TYPE_CONST,      { .i64 = DXGI_FORMAT_B8G8R8A8_UNORM },    0, INT_MAX, FLAGS, "output_fmt" },
      { "10bit",      "only output default 10 Bit format", 0,            AV_OPT_TYPE_CONST,      { .i64 = DXGI_FORMAT_R10G10B10A2_UNORM }, 0, INT_MAX, FLAGS, "output_fmt" },
      { "x2bgr10",    "only output 10 Bit X2BGR10",        0,            AV_OPT_TYPE_CONST,      { .i64 = DXGI_FORMAT_R10G10B10A2_UNORM }, 0, INT_MAX, FLAGS, "output_fmt" },
      { "16bit",      "only output default 16 Bit format", 0,            AV_OPT_TYPE_CONST,      { .i64 = DXGI_FORMAT_R16G16B16A16_FLOAT },0, INT_MAX, FLAGS, "output_fmt" },
      { "rgbaf16",    "only output 16 Bit RGBAF16",        0,            AV_OPT_TYPE_CONST,      { .i64 = DXGI_FORMAT_R16G16B16A16_FLOAT },0, INT_MAX, FLAGS, "output_fmt" },
      { "allow_fallback", "don't error on fallback to default 8 Bit format",
                                                     OFFSET(allow_fallback), AV_OPT_TYPE_BOOL,   { .i64 = 0    },       0,       1, FLAGS },
-    { "force_fmt",  "exclude BGRA from format list (experimental, discouraged by Microsoft)",
+    { "force_fmt",  "exclude BGRX from format list (experimental, discouraged by Microsoft)",
                                                     OFFSET(force_fmt),  AV_OPT_TYPE_BOOL,       { .i64 = 0    },       0,       1, FLAGS },
      { NULL }
  };
@@ -775,7 +775,7 @@ static av_cold int init_hwframes_ctx(AVFilterContext *avctx)
      switch (dda->raw_format) {
      case DXGI_FORMAT_B8G8R8A8_UNORM:
          av_log(avctx, AV_LOG_VERBOSE, "Probed 8 bit RGB frame format\n");
-        dda->frames_ctx->sw_format = AV_PIX_FMT_BGRA;
+        dda->frames_ctx->sw_format = AV_PIX_FMT_BGR0;
          break;
      case DXGI_FORMAT_R10G10B10A2_UNORM:
          av_log(avctx, AV_LOG_VERBOSE, "Probed 10 bit RGB frame format\n");
-- 
2.39.2
_______________________________________________
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] 3+ messages in thread

* Re: [FFmpeg-devel] [PATCH 1/2] hwcontext_d3d11: Add BGR0 support
  2023-10-22 14:54 [FFmpeg-devel] [PATCH 1/2] hwcontext_d3d11: Add BGR0 support Mark Thompson
  2023-10-22 14:56 ` [FFmpeg-devel] [PATCH 2/2] lavfi/ddagrab: Fix 8-bit BGR output to not advertise an alpha component Mark Thompson
@ 2023-11-27 13:43 ` Mark Thompson
  1 sibling, 0 replies; 3+ messages in thread
From: Mark Thompson @ 2023-11-27 13:43 UTC (permalink / raw)
  To: FFmpeg development discussions and patches

On 22/10/2023 15:54, Mark Thompson wrote:
> The 8-bit four-component DXGI container is also used for three-component
> RGB without alpha.
> ---
> This list is only used for AV->DXGI mapping, so it doesn't matter that there are duplicate DXGI formats in the list.
> 
>   libavutil/hwcontext_d3d11va.c | 1 +
>   1 file changed, 1 insertion(+)
> 
> diff --git a/libavutil/hwcontext_d3d11va.c b/libavutil/hwcontext_d3d11va.c
> index cc8c97d2b6..1d249f2088 100644
> --- a/libavutil/hwcontext_d3d11va.c
> +++ b/libavutil/hwcontext_d3d11va.c
> @@ -86,6 +86,7 @@ static const struct {
>   } supported_formats[] = {
>       { DXGI_FORMAT_NV12,         AV_PIX_FMT_NV12 },
>       { DXGI_FORMAT_P010,         AV_PIX_FMT_P010 },
> +    { DXGI_FORMAT_B8G8R8A8_UNORM,    AV_PIX_FMT_BGR0 },
>       { DXGI_FORMAT_B8G8R8A8_UNORM,    AV_PIX_FMT_BGRA },
>       { DXGI_FORMAT_R10G10B10A2_UNORM, AV_PIX_FMT_X2BGR10 },
>       { DXGI_FORMAT_R16G16B16A16_FLOAT, AV_PIX_FMT_RGBAF16 },

Ping for set.

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] 3+ messages in thread

end of thread, other threads:[~2023-11-27 13:43 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-10-22 14:54 [FFmpeg-devel] [PATCH 1/2] hwcontext_d3d11: Add BGR0 support Mark Thompson
2023-10-22 14:56 ` [FFmpeg-devel] [PATCH 2/2] lavfi/ddagrab: Fix 8-bit BGR output to not advertise an alpha component Mark Thompson
2023-11-27 13:43 ` [FFmpeg-devel] [PATCH 1/2] hwcontext_d3d11: Add BGR0 support Mark Thompson

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