Re: [FFmpeg-devel] [PATCH v2 2/9] avcodec: add D3D12VA hardware accelerated H264 decoding

2023-05-31 Thread Zhanbang He
On Wednesday, May 31, 2023, Tong Wu 
wrote:

> From: Wu Jianhua 
>
> The implementation is based on:
> https://learn.microsoft.com/en-us/windows/win32/medfound/
> direct3d-12-video-overview
>
>

> With the Direct3D 12 video decoding support, we can render or process
> the decoded images by the pixel shaders or compute shaders directly

do you have some demo regarding pixel shaders or compute shaders?


> without the extra copy overhead, which is beneficial especially if you

are trying to render or post-process a 4K or 8K video.
>
> The command below is how to enable d3d12va:
> ffmpeg -hwaccel d3d12va -i input.mp4 output.mp4
>
> Signed-off-by: Wu Jianhua 
> Signed-off-by: Tong Wu 
> ---
>  configure   |   2 +
>  libavcodec/Makefile |   3 +
>  libavcodec/d3d11va.h|   3 -
>  libavcodec/d3d12va.c| 552 
>  libavcodec/d3d12va.h| 184 
>  libavcodec/d3d12va_h264.c   | 210 ++
>  libavcodec/dxva2.c  |  24 ++
>  libavcodec/dxva2.h  |   3 -
>  libavcodec/dxva2_h264.c |  12 +-
>  libavcodec/dxva2_internal.h |  69 +++--
>  libavcodec/h264_slice.c |   4 +
>  libavcodec/h264dec.c|   3 +
>  libavcodec/hwaccels.h   |   1 +
>  libavcodec/hwconfig.h   |   2 +
>  14 files changed, 1030 insertions(+), 42 deletions(-)
>  create mode 100644 libavcodec/d3d12va.c
>  create mode 100644 libavcodec/d3d12va.h
>  create mode 100644 libavcodec/d3d12va_h264.c
>
> diff --git a/configure b/configure
> index b86064e36f..f5dad4653f 100755
> --- a/configure
> +++ b/configure
> @@ -3033,6 +3033,8 @@ h264_d3d11va_hwaccel_deps="d3d11va"
>  h264_d3d11va_hwaccel_select="h264_decoder"
>  h264_d3d11va2_hwaccel_deps="d3d11va"
>  h264_d3d11va2_hwaccel_select="h264_decoder"
> +h264_d3d12va_hwaccel_deps="d3d12va"
> +h264_d3d12va_hwaccel_select="h264_decoder"
>  h264_dxva2_hwaccel_deps="dxva2"
>  h264_dxva2_hwaccel_select="h264_decoder"
>  h264_nvdec_hwaccel_deps="nvdec"
> diff --git a/libavcodec/Makefile b/libavcodec/Makefile
> index 9aacc1d477..ae143d8821 100644
> --- a/libavcodec/Makefile
> +++ b/libavcodec/Makefile
> @@ -977,6 +977,7 @@ OBJS-$(CONFIG_ADPCM_ZORK_DECODER) += adpcm.o
> adpcm_data.o
>
>  # hardware accelerators
>  OBJS-$(CONFIG_D3D11VA)+= dxva2.o
> +OBJS-$(CONFIG_D3D12VA)+= dxva2.o d3d12va.o
>  OBJS-$(CONFIG_DXVA2)  += dxva2.o
>  OBJS-$(CONFIG_NVDEC)  += nvdec.o
>  OBJS-$(CONFIG_VAAPI)  += vaapi_decode.o
> @@ -994,6 +995,7 @@ OBJS-$(CONFIG_H263_VAAPI_HWACCEL) +=
> vaapi_mpeg4.o
>  OBJS-$(CONFIG_H263_VIDEOTOOLBOX_HWACCEL)  += videotoolbox.o
>  OBJS-$(CONFIG_H264_D3D11VA_HWACCEL)   += dxva2_h264.o
>  OBJS-$(CONFIG_H264_DXVA2_HWACCEL) += dxva2_h264.o
> +OBJS-$(CONFIG_H264_D3D12VA_HWACCEL)   += dxva2_h264.o d3d12va_h264.o
>  OBJS-$(CONFIG_H264_NVDEC_HWACCEL) += nvdec_h264.o
>  OBJS-$(CONFIG_H264_QSV_HWACCEL)   += qsvdec.o
>  OBJS-$(CONFIG_H264_VAAPI_HWACCEL) += vaapi_h264.o
> @@ -1277,6 +1279,7 @@ SKIPHEADERS+=
> %_tablegen.h  \
>
>  SKIPHEADERS-$(CONFIG_AMF)  += amfenc.h
>  SKIPHEADERS-$(CONFIG_D3D11VA)  += d3d11va.h dxva2_internal.h
> +SKIPHEADERS-$(CONFIG_D3D12VA)  += d3d12va.h
>  SKIPHEADERS-$(CONFIG_DXVA2)+= dxva2.h dxva2_internal.h
>  SKIPHEADERS-$(CONFIG_JNI)  += ffjni.h
>  SKIPHEADERS-$(CONFIG_LCMS2)+= fflcms2.h
> diff --git a/libavcodec/d3d11va.h b/libavcodec/d3d11va.h
> index 6816b6c1e6..27f40e5519 100644
> --- a/libavcodec/d3d11va.h
> +++ b/libavcodec/d3d11va.h
> @@ -45,9 +45,6 @@
>   * @{
>   */
>
> -#define FF_DXVA2_WORKAROUND_SCALING_LIST_ZIGZAG 1 ///< Work around for
> Direct3D11 and old UVD/UVD+ ATI video cards
> -#define FF_DXVA2_WORKAROUND_INTEL_CLEARVIDEO2 ///< Work around for
> Direct3D11 and old Intel GPUs with ClearVideo interface
> -
>  /**
>   * This structure is used to provides the necessary configurations and
> data
>   * to the Direct3D11 FFmpeg HWAccel implementation.
> diff --git a/libavcodec/d3d12va.c b/libavcodec/d3d12va.c
> new file mode 100644
> index 00..d80575441c
> --- /dev/null
> +++ b/libavcodec/d3d12va.c
> @@ -0,0 +1,552 @@
> +/*
> + * Direct3D 12 HW acceleration video decoder
> + *
> + * copyright (c) 2022-2023 Wu Jianhua 
> + *
> + * This file is part of FFmpeg.
> + *
> + * FFmpeg is free software; you can redistribute it and/or
> + * modify it under the terms of the GNU Lesser General Public
> + * License as published by the Free Software Foundation; either
> + * version 2.1 of the License, or (at your option) any later version.
> + *
> + * FFmpeg is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
> + * Lesser General Public License for more det

Re: [FFmpeg-devel] Embedded documentation?

2023-05-08 Thread Zhanbang He
Can it supports chatGPT?

On Monday, May 8, 2023, Nicolas George  wrote:

> Stefano Sabatini (12023-05-08):
> > I cannot parse this, where is the threshold value defined?
>
> The threshold is the enum constant that was being described.
>
> > Maybe an example would clarify this, since there is ambiguity about
> > what default and explanations are.
>
> Let us think how this is meant to be used. For example, the user of a
> GUI clicks on a filter, the application asks the library “give me the
> documentation for this” and displays it somewhere.
>
> Imagine the whole FFmpeg documentation as a gigantic hypertext document,
> like . Imagine we want the
> documentation for the scale filter. So we start at
> , and we take:
>
> - the introduction of the scale filter,
> - the width option,
> - the height option,
> - the flags option,
> - the size option,
> - etc.,
> - the examples,
> - the commands,
>
> But the width and height options are expressions, therefore we will need
> also .
> And the size option is a video size, so we take
>  too.
> And the flags option requires
> .
> And maybe the various scaler flags link to explanations about their pros
> and cons, and we want these explanations too.
>
> In general, to get the documentation for a component, avdoc starts at
> the doc node of this component, and it follows all the links from there,
> and then all the links from the nodes reached, etc., recursively, until
> avdoc has all the documentation that might be useful to understand that
> component. Then it returns to the application.
>
> But that means we will get 50 pages of documentation for most
> components. It is fine to display in a full-fledged help browser, but a
> 50 pages tooltip is not very convenient.
>
> This is where the thresholds come into play:
>
> - if you want a tooltip, av_documentation_get_excerpt(obj, 0);
>
> - if you want a help dialog where scrolling is possible,
>   av_documentation_get_excerpt(obj, AVDOC_LINK_SELF_CONTAINED);
>
> - if you want a help browser where hyperlinks are possible,
>   av_documentation_get_excerpt(obj, AVDOC_LINK_SELF_CONTAINED_FULL).
>
> Regards,
>
> --
>   Nicolas George
>
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".