diff mbox series

[FFmpeg-devel,1/5] lavc/amfenc: HWConfig for amf encoder.

Message ID 20201015001625.32832-1-ovchinnikov.dmitrii@gmail.com
State New
Headers show
Series [FFmpeg-devel,1/5] lavc/amfenc: HWConfig for amf encoder.
Related show

Checks

Context Check Description
andriy/x86_make success Make finished
andriy/x86_make_fate success Make fate finished

Commit Message

Dmitrii Ovchinnikov Oct. 15, 2020, 12:16 a.m. UTC
---
 libavcodec/amfenc.c      | 12 ++++++++++++
 libavcodec/amfenc.h      |  4 +++-
 libavcodec/amfenc_h264.c |  1 +
 libavcodec/amfenc_hevc.c |  1 +
 4 files changed, 17 insertions(+), 1 deletion(-)

Comments

Dmitrii Ovchinnikov Oct. 27, 2020, 10:26 p.m. UTC | #1
Hi! could you please review and accept this patch? It fixes a broken AMF
hwaccel pipeline.
Mark Thompson Oct. 28, 2020, 11:21 p.m. UTC | #2
On 15/10/2020 01:16, OvchinnikovDmitrii wrote:
> ---
>   libavcodec/amfenc.c      | 12 ++++++++++++
>   libavcodec/amfenc.h      |  4 +++-
>   libavcodec/amfenc_h264.c |  1 +
>   libavcodec/amfenc_hevc.c |  1 +
>   4 files changed, 17 insertions(+), 1 deletion(-)
> 
> diff --git a/libavcodec/amfenc.c b/libavcodec/amfenc.c
> index da0652943d..33f97dd582 100644
> --- a/libavcodec/amfenc.c
> +++ b/libavcodec/amfenc.c
> @@ -782,3 +782,15 @@ int ff_amf_receive_packet(AVCodecContext *avctx, AVPacket *avpkt)
>       }
>       return ret;
>   }
> +
> +const AVCodecHWConfigInternal *ff_amfenc_hw_configs[] = {
> +#if CONFIG_D3D11VA
> +    HW_CONFIG_ENCODER_FRAMES(D3D11, D3D11VA),
> +    HW_CONFIG_ENCODER_DEVICE(NONE,  D3D11VA),
> +#endif
> +#if CONFIG_DXVA2
> +    HW_CONFIG_ENCODER_FRAMES(DXVA2_VLD, DXVA2),
> +    HW_CONFIG_ENCODER_DEVICE(NONE,  DXVA2),
> +#endif
> +    NULL,
> +};
> \ No newline at end of file

Your git client has left a review comment for you.

> diff --git a/libavcodec/amfenc.h b/libavcodec/amfenc.h
> index 80658c6b2a..06994da543 100644
> --- a/libavcodec/amfenc.h
> +++ b/libavcodec/amfenc.h
> @@ -27,7 +27,7 @@
>   #include "libavutil/fifo.h"
>   
>   #include "avcodec.h"
> -
> +#include "hwconfig.h"
>   
>   /**
>   * AMF trace writer callback class
> @@ -117,6 +117,8 @@ typedef struct AmfContext {
>       int                 tier;
>   } AmfContext;
>   
> +extern const AVCodecHWConfigInternal *ff_amfenc_hw_configs[];
> +
>   /**
>   * Common encoder initization function
>   */
> diff --git a/libavcodec/amfenc_h264.c b/libavcodec/amfenc_h264.c
> index 7a8029f3b7..622ee85946 100644
> --- a/libavcodec/amfenc_h264.c
> +++ b/libavcodec/amfenc_h264.c
> @@ -392,4 +392,5 @@ AVCodec ff_h264_amf_encoder = {
>       .caps_internal  = FF_CODEC_CAP_INIT_CLEANUP,
>       .pix_fmts       = ff_amf_pix_fmts,
>       .wrapper_name   = "amf",
> +    .hw_configs     = ff_amfenc_hw_configs,
>   };
> diff --git a/libavcodec/amfenc_hevc.c b/libavcodec/amfenc_hevc.c
> index fa12a3a3f6..bb224c5fec 100644
> --- a/libavcodec/amfenc_hevc.c
> +++ b/libavcodec/amfenc_hevc.c
> @@ -322,4 +322,5 @@ AVCodec ff_hevc_amf_encoder = {
>       .caps_internal  = FF_CODEC_CAP_INIT_CLEANUP,
>       .pix_fmts       = ff_amf_pix_fmts,
>       .wrapper_name   = "amf",
> +    .hw_configs     = ff_amfenc_hw_configs,
>   };
> 

This looks right, but can you clarify the intent behind the hw config cases?  (Do you have an ffmpeg command line or other example which is improved by them?)

Thanks,

- Mark
Dmitrii Ovchinnikov Oct. 28, 2020, 11:28 p.m. UTC | #3
>
>
> This looks right, but can you clarify the intent behind the hw config
> cases?  (Do you have an ffmpeg command line or other example which is
> improved by them?)
>
> Hi! This ticket describes the problem.
https://trac.ffmpeg.org/ticket/8953#ticket
Mark Thompson Nov. 8, 2020, 7:09 p.m. UTC | #4
On 28/10/2020 23:28, Dmitrii Ovchinnikov wrote:
>>
>>
>> This looks right, but can you clarify the intent behind the hw config
>> cases?  (Do you have an ffmpeg command line or other example which is
>> improved by them?)
>>
>> Hi! This ticket describes the problem.
> https://trac.ffmpeg.org/ticket/8953#ticket
I added a proper explanation to the commit message and applied with that.

Thanks,

- Mark
diff mbox series

Patch

diff --git a/libavcodec/amfenc.c b/libavcodec/amfenc.c
index da0652943d..33f97dd582 100644
--- a/libavcodec/amfenc.c
+++ b/libavcodec/amfenc.c
@@ -782,3 +782,15 @@  int ff_amf_receive_packet(AVCodecContext *avctx, AVPacket *avpkt)
     }
     return ret;
 }
+
+const AVCodecHWConfigInternal *ff_amfenc_hw_configs[] = {
+#if CONFIG_D3D11VA
+    HW_CONFIG_ENCODER_FRAMES(D3D11, D3D11VA),
+    HW_CONFIG_ENCODER_DEVICE(NONE,  D3D11VA),
+#endif
+#if CONFIG_DXVA2
+    HW_CONFIG_ENCODER_FRAMES(DXVA2_VLD, DXVA2),
+    HW_CONFIG_ENCODER_DEVICE(NONE,  DXVA2),
+#endif
+    NULL,
+};
\ No newline at end of file
diff --git a/libavcodec/amfenc.h b/libavcodec/amfenc.h
index 80658c6b2a..06994da543 100644
--- a/libavcodec/amfenc.h
+++ b/libavcodec/amfenc.h
@@ -27,7 +27,7 @@ 
 #include "libavutil/fifo.h"
 
 #include "avcodec.h"
-
+#include "hwconfig.h"
 
 /**
 * AMF trace writer callback class
@@ -117,6 +117,8 @@  typedef struct AmfContext {
     int                 tier;
 } AmfContext;
 
+extern const AVCodecHWConfigInternal *ff_amfenc_hw_configs[];
+
 /**
 * Common encoder initization function
 */
diff --git a/libavcodec/amfenc_h264.c b/libavcodec/amfenc_h264.c
index 7a8029f3b7..622ee85946 100644
--- a/libavcodec/amfenc_h264.c
+++ b/libavcodec/amfenc_h264.c
@@ -392,4 +392,5 @@  AVCodec ff_h264_amf_encoder = {
     .caps_internal  = FF_CODEC_CAP_INIT_CLEANUP,
     .pix_fmts       = ff_amf_pix_fmts,
     .wrapper_name   = "amf",
+    .hw_configs     = ff_amfenc_hw_configs,
 };
diff --git a/libavcodec/amfenc_hevc.c b/libavcodec/amfenc_hevc.c
index fa12a3a3f6..bb224c5fec 100644
--- a/libavcodec/amfenc_hevc.c
+++ b/libavcodec/amfenc_hevc.c
@@ -322,4 +322,5 @@  AVCodec ff_hevc_amf_encoder = {
     .caps_internal  = FF_CODEC_CAP_INIT_CLEANUP,
     .pix_fmts       = ff_amf_pix_fmts,
     .wrapper_name   = "amf",
+    .hw_configs     = ff_amfenc_hw_configs,
 };