Re: [FFmpeg-devel] [PATCH v4 7/8] lavc/vaapi_encode: Add VAAPI AV1 encoder

2023-09-08 Thread Xiang, Haihao
On Do, 2023-08-31 at 15:21 +0800, fei.w.wang-at-intel@ffmpeg.org wrote:
> From: Fei Wang 
> 
> Signed-off-by: Fei Wang 
> ---
> Fixed the discussions in V3.
> 
>  Changelog |   1 +
>  configure |   3 +
>  doc/encoders.texi |  14 +
>  libavcodec/Makefile   |   2 +
>  libavcodec/allcodecs.c    |   1 +
>  libavcodec/av1_levels.c   |  92 
>  libavcodec/av1_levels.h   |  58 +++
>  libavcodec/vaapi_encode.c | 198 +--
>  libavcodec/vaapi_encode.h |  24 +
>  libavcodec/vaapi_encode_av1.c | 949 ++
>  libavcodec/version.h  |   2 +-
>  11 files changed, 1311 insertions(+), 33 deletions(-)
>  create mode 100644 libavcodec/av1_levels.c
>  create mode 100644 libavcodec/av1_levels.h
>  create mode 100644 libavcodec/vaapi_encode_av1.c


FF_PROFILE_* were deprecated recently, please use AV_PROFILE_* in
vaapi_encode_av1.c

Thanks
Haihao


> 
> diff --git a/Changelog b/Changelog
> index c010e86159..b10c65a4c5 100644
> --- a/Changelog
> +++ b/Changelog
> @@ -30,6 +30,7 @@ version :
>  - support for the P_SKIP hinting to speed up libx264 encoding
>  - Support HEVC,VP9,AV1 codec in enhanced flv format
>  - apsnr and asisdr audio filters
> +- VAAPI AV1 encoder
>  
>  
>  version 6.0:
> diff --git a/configure b/configure
> index bd7f7697c8..ec7a80cd48 100755
> --- a/configure
> +++ b/configure
> @@ -3323,6 +3323,8 @@ av1_qsv_decoder_select="qsvdec"
>  av1_qsv_encoder_select="qsvenc"
>  av1_qsv_encoder_deps="libvpl"
>  av1_amf_encoder_deps="amf"
> +av1_vaapi_encoder_deps="VAEncPictureParameterBufferAV1"
> +av1_vaapi_encoder_select="cbs_av1 vaapi_encode"
>  
>  # parsers
>  aac_parser_select="adts_header mpeg4audio"
> @@ -7110,6 +7112,7 @@ if enabled vaapi; then
>  check_type "va/va.h va/va_enc_jpeg.h" "VAEncPictureParameterBufferJPEG"
>  check_type "va/va.h va/va_enc_vp8.h"  "VAEncPictureParameterBufferVP8"
>  check_type "va/va.h va/va_enc_vp9.h"  "VAEncPictureParameterBufferVP9"
> +    check_type "va/va.h va/va_enc_av1.h"  "VAEncPictureParameterBufferAV1"
>  fi
>  
>  if enabled_all opencl libdrm ; then
> diff --git a/doc/encoders.texi b/doc/encoders.texi
> index 6f8f5e127e..d7d9584a0c 100644
> --- a/doc/encoders.texi
> +++ b/doc/encoders.texi
> @@ -3995,6 +3995,20 @@ Average variable bitrate.
>  Each encoder also has its own specific options:
>  @table @option
>  
> +@item av1_vaapi
> +@option{profile} sets the value of @emph{seq_profile}.
> +@option{tier} sets the value of @emph{seq_tier}.
> +@option{level} sets the value of @emph{seq_level_idx}.
> +
> +@table @option
> +@item tiles
> +Set the number of tiles to encode the input video with, as columns x rows.
> +(default is auto, which means use minimal tile column/row number).
> +@item tile_groups
> +Set tile groups number. All the tiles will be distributed as evenly as
> possible to
> +each tile group. (default is 1).
> +@end table
> +
>  @item h264_vaapi
>  @option{profile} sets the value of @emph{profile_idc} and the
> @emph{constraint_set*_flag}s.
>  @option{level} sets the value of @emph{level_idc}.
> diff --git a/libavcodec/Makefile b/libavcodec/Makefile
> index f961d0abd6..e315299a0e 100644
> --- a/libavcodec/Makefile
> +++ b/libavcodec/Makefile
> @@ -258,6 +258,7 @@ OBJS-$(CONFIG_AV1_MEDIACODEC_DECODER)  += mediacodecdec.o
>  OBJS-$(CONFIG_AV1_MEDIACODEC_ENCODER)  += mediacodecenc.o
>  OBJS-$(CONFIG_AV1_NVENC_ENCODER)   += nvenc_av1.o nvenc.o
>  OBJS-$(CONFIG_AV1_QSV_ENCODER) += qsvenc_av1.o
> +OBJS-$(CONFIG_AV1_VAAPI_ENCODER)   += vaapi_encode_av1.o av1_levels.o
>  OBJS-$(CONFIG_AVRN_DECODER)    += avrndec.o
>  OBJS-$(CONFIG_AVRP_DECODER)    += r210dec.o
>  OBJS-$(CONFIG_AVRP_ENCODER)    += r210enc.o
> @@ -1322,6 +1323,7 @@ TESTPROGS =
> avcodec \
>  jpeg2000dwt \
>  mathops    \
>  
> +TESTPROGS-$(CONFIG_AV1_VAAPI_ENCODER) += av1_levels
>  TESTPROGS-$(CONFIG_CABAC) += cabac
>  TESTPROGS-$(CONFIG_DCT)   += avfft
>  TESTPROGS-$(CONFIG_FFT)   += fft fft-fixed32
> diff --git a/libavcodec/allcodecs.c b/libavcodec/allcodecs.c
> index 8775d15a4f..c43c1d7b48 100644
> --- a/libavcodec/allcodecs.c
> +++ b/libavcodec/allcodecs.c
> @@ -844,6 +844,7 @@ extern const FFCodec ff_av1_nvenc_encoder;
>  extern const FFCodec ff_av1_qsv_decoder;
>  extern const FFCodec ff_av1_qsv_encoder;
>  extern const FFCodec ff_av1_amf_encoder;
> +extern const FFCodec ff_av1_vaapi_encoder;
>  extern const FFCodec ff_libopenh264_encoder;
>  extern const FFCodec ff_libopenh264_decoder;
>  extern const FFCodec ff_h264_amf_encoder;
> diff --git a/libavcodec/av1_levels.c b/libavcodec/av1_levels.c
> new file mode 100644
> index 00..19b6ee1736
> --- /dev/null
> +++ b/libavcodec/av1_levels.c
> @@ 

Re: [FFmpeg-devel] [PATCH v4 7/8] lavc/vaapi_encode: Add VAAPI AV1 encoder

2023-09-04 Thread Wang, Fei W
On Thu, 2023-08-31 at 15:21 +0800, fei.w.w...@intel.com wrote:
> From: Fei Wang 
> 
> Signed-off-by: Fei Wang 
> ---
> Fixed the discussions in V3.

@Mark, any more comment on this version?

Thanks

> 
>  Changelog |   1 +
>  configure |   3 +
>  doc/encoders.texi |  14 +
>  libavcodec/Makefile   |   2 +
>  libavcodec/allcodecs.c|   1 +
>  libavcodec/av1_levels.c   |  92 
>  libavcodec/av1_levels.h   |  58 +++
>  libavcodec/vaapi_encode.c | 198 +--
>  libavcodec/vaapi_encode.h |  24 +
>  libavcodec/vaapi_encode_av1.c | 949
> ++
>  libavcodec/version.h  |   2 +-
>  11 files changed, 1311 insertions(+), 33 deletions(-)
>  create mode 100644 libavcodec/av1_levels.c
>  create mode 100644 libavcodec/av1_levels.h
>  create mode 100644 libavcodec/vaapi_encode_av1.c

___
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".


[FFmpeg-devel] [PATCH v4 7/8] lavc/vaapi_encode: Add VAAPI AV1 encoder

2023-08-31 Thread fei . w . wang-at-intel . com
From: Fei Wang 

Signed-off-by: Fei Wang 
---
Fixed the discussions in V3.

 Changelog |   1 +
 configure |   3 +
 doc/encoders.texi |  14 +
 libavcodec/Makefile   |   2 +
 libavcodec/allcodecs.c|   1 +
 libavcodec/av1_levels.c   |  92 
 libavcodec/av1_levels.h   |  58 +++
 libavcodec/vaapi_encode.c | 198 +--
 libavcodec/vaapi_encode.h |  24 +
 libavcodec/vaapi_encode_av1.c | 949 ++
 libavcodec/version.h  |   2 +-
 11 files changed, 1311 insertions(+), 33 deletions(-)
 create mode 100644 libavcodec/av1_levels.c
 create mode 100644 libavcodec/av1_levels.h
 create mode 100644 libavcodec/vaapi_encode_av1.c

diff --git a/Changelog b/Changelog
index c010e86159..b10c65a4c5 100644
--- a/Changelog
+++ b/Changelog
@@ -30,6 +30,7 @@ version :
 - support for the P_SKIP hinting to speed up libx264 encoding
 - Support HEVC,VP9,AV1 codec in enhanced flv format
 - apsnr and asisdr audio filters
+- VAAPI AV1 encoder
 
 
 version 6.0:
diff --git a/configure b/configure
index bd7f7697c8..ec7a80cd48 100755
--- a/configure
+++ b/configure
@@ -3323,6 +3323,8 @@ av1_qsv_decoder_select="qsvdec"
 av1_qsv_encoder_select="qsvenc"
 av1_qsv_encoder_deps="libvpl"
 av1_amf_encoder_deps="amf"
+av1_vaapi_encoder_deps="VAEncPictureParameterBufferAV1"
+av1_vaapi_encoder_select="cbs_av1 vaapi_encode"
 
 # parsers
 aac_parser_select="adts_header mpeg4audio"
@@ -7110,6 +7112,7 @@ if enabled vaapi; then
 check_type "va/va.h va/va_enc_jpeg.h" "VAEncPictureParameterBufferJPEG"
 check_type "va/va.h va/va_enc_vp8.h"  "VAEncPictureParameterBufferVP8"
 check_type "va/va.h va/va_enc_vp9.h"  "VAEncPictureParameterBufferVP9"
+check_type "va/va.h va/va_enc_av1.h"  "VAEncPictureParameterBufferAV1"
 fi
 
 if enabled_all opencl libdrm ; then
diff --git a/doc/encoders.texi b/doc/encoders.texi
index 6f8f5e127e..d7d9584a0c 100644
--- a/doc/encoders.texi
+++ b/doc/encoders.texi
@@ -3995,6 +3995,20 @@ Average variable bitrate.
 Each encoder also has its own specific options:
 @table @option
 
+@item av1_vaapi
+@option{profile} sets the value of @emph{seq_profile}.
+@option{tier} sets the value of @emph{seq_tier}.
+@option{level} sets the value of @emph{seq_level_idx}.
+
+@table @option
+@item tiles
+Set the number of tiles to encode the input video with, as columns x rows.
+(default is auto, which means use minimal tile column/row number).
+@item tile_groups
+Set tile groups number. All the tiles will be distributed as evenly as 
possible to
+each tile group. (default is 1).
+@end table
+
 @item h264_vaapi
 @option{profile} sets the value of @emph{profile_idc} and the 
@emph{constraint_set*_flag}s.
 @option{level} sets the value of @emph{level_idc}.
diff --git a/libavcodec/Makefile b/libavcodec/Makefile
index f961d0abd6..e315299a0e 100644
--- a/libavcodec/Makefile
+++ b/libavcodec/Makefile
@@ -258,6 +258,7 @@ OBJS-$(CONFIG_AV1_MEDIACODEC_DECODER)  += mediacodecdec.o
 OBJS-$(CONFIG_AV1_MEDIACODEC_ENCODER)  += mediacodecenc.o
 OBJS-$(CONFIG_AV1_NVENC_ENCODER)   += nvenc_av1.o nvenc.o
 OBJS-$(CONFIG_AV1_QSV_ENCODER) += qsvenc_av1.o
+OBJS-$(CONFIG_AV1_VAAPI_ENCODER)   += vaapi_encode_av1.o av1_levels.o
 OBJS-$(CONFIG_AVRN_DECODER)+= avrndec.o
 OBJS-$(CONFIG_AVRP_DECODER)+= r210dec.o
 OBJS-$(CONFIG_AVRP_ENCODER)+= r210enc.o
@@ -1322,6 +1323,7 @@ TESTPROGS = avcodec   
  \
 jpeg2000dwt \
 mathops\
 
+TESTPROGS-$(CONFIG_AV1_VAAPI_ENCODER) += av1_levels
 TESTPROGS-$(CONFIG_CABAC) += cabac
 TESTPROGS-$(CONFIG_DCT)   += avfft
 TESTPROGS-$(CONFIG_FFT)   += fft fft-fixed32
diff --git a/libavcodec/allcodecs.c b/libavcodec/allcodecs.c
index 8775d15a4f..c43c1d7b48 100644
--- a/libavcodec/allcodecs.c
+++ b/libavcodec/allcodecs.c
@@ -844,6 +844,7 @@ extern const FFCodec ff_av1_nvenc_encoder;
 extern const FFCodec ff_av1_qsv_decoder;
 extern const FFCodec ff_av1_qsv_encoder;
 extern const FFCodec ff_av1_amf_encoder;
+extern const FFCodec ff_av1_vaapi_encoder;
 extern const FFCodec ff_libopenh264_encoder;
 extern const FFCodec ff_libopenh264_decoder;
 extern const FFCodec ff_h264_amf_encoder;
diff --git a/libavcodec/av1_levels.c b/libavcodec/av1_levels.c
new file mode 100644
index 00..19b6ee1736
--- /dev/null
+++ b/libavcodec/av1_levels.c
@@ -0,0 +1,92 @@
+/*
+ * Copyright (c) 2023 Intel Corporation
+ *
+ * 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