diff mbox series

[FFmpeg-devel,v1] lavc/qsvdec: Add VVC decoder

Message ID 20240612005832.3179960-1-fei.w.wang@intel.com
State New
Headers show
Series [FFmpeg-devel,v1] lavc/qsvdec: Add VVC decoder | expand

Checks

Context Check Description
yinshiyou/make_loongarch64 success Make finished
yinshiyou/make_fate_loongarch64 success Make fate finished
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished

Commit Message

Wang, Fei W June 12, 2024, 12:58 a.m. UTC
From: Fei Wang <fei.w.wang@intel.com>

Signed-off-by: Fei Wang <fei.w.wang@intel.com>
---
 Changelog              | 1 +
 configure              | 1 +
 doc/decoders.texi      | 2 +-
 libavcodec/allcodecs.c | 1 +
 libavcodec/qsv.c       | 4 ++++
 libavcodec/qsvdec.c    | 7 ++++++-
 libavcodec/version.h   | 2 +-
 7 files changed, 15 insertions(+), 3 deletions(-)

Comments

Nuo Mi June 12, 2024, 12:12 p.m. UTC | #1
Hi Fei,
Thank you for the patch.
Which hardware supports this? Could you provide the link?

On Wed, Jun 12, 2024 at 9:03 AM <fei.w.wang-at-intel.com@ffmpeg.org> wrote:

> From: Fei Wang <fei.w.wang@intel.com>
>
> Signed-off-by: Fei Wang <fei.w.wang@intel.com>
> ---
>  Changelog              | 1 +
>  configure              | 1 +
>  doc/decoders.texi      | 2 +-
>  libavcodec/allcodecs.c | 1 +
>  libavcodec/qsv.c       | 4 ++++
>  libavcodec/qsvdec.c    | 7 ++++++-
>  libavcodec/version.h   | 2 +-
>  7 files changed, 15 insertions(+), 3 deletions(-)
>
> diff --git a/Changelog b/Changelog
> index 03d6b29ad8..a238a1c1f3 100644
> --- a/Changelog
> +++ b/Changelog
> @@ -12,6 +12,7 @@ version <next>:
>  - qsv_params option added for QSV encoders
>  - VVC decoder compatible with DVB test content
>  - xHE-AAC decoder
> +- Intel QSV-accelerated VVC decoding
>
>
>  version 7.0:
> diff --git a/configure b/configure
> index 6c5b8aab9a..b4cf12658d 100755
> --- a/configure
> +++ b/configure
> @@ -3423,6 +3423,7 @@ av1_qsv_encoder_deps="libvpl"
>  av1_amf_encoder_deps="amf"
>  av1_vaapi_encoder_deps="VAEncPictureParameterBufferAV1"
>  av1_vaapi_encoder_select="cbs_av1 vaapi_encode"
> +vvc_qsv_decoder_select="qsvdec"
>
It's better to follow the alphabetical order.
You can send another patch to fix av1

>
>  # parsers
>  aac_parser_select="adts_header mpeg4audio"
> diff --git a/doc/decoders.texi b/doc/decoders.texi
> index 293c82c2ba..2fcc761d2f 100644
> --- a/doc/decoders.texi
> +++ b/doc/decoders.texi
> @@ -157,7 +157,7 @@ Force to use a specific number of threads
>  @section QSV Decoders
>
>  The family of Intel QuickSync Video decoders (VC1, MPEG-2, H.264, HEVC,
> -JPEG/MJPEG, VP8, VP9, AV1).
> +JPEG/MJPEG, VP8, VP9, AV1, VVC).
>
>  @subsection Common Options
>
> diff --git a/libavcodec/allcodecs.c b/libavcodec/allcodecs.c
> index b102a8069e..a73b4e1673 100644
> --- a/libavcodec/allcodecs.c
> +++ b/libavcodec/allcodecs.c
> @@ -885,6 +885,7 @@ extern const FFCodec ff_vp9_mediacodec_encoder;
>  extern const FFCodec ff_vp9_qsv_decoder;
>  extern const FFCodec ff_vp9_vaapi_encoder;
>  extern const FFCodec ff_vp9_qsv_encoder;
> +extern const FFCodec ff_vvc_qsv_decoder;
>
>  // null codecs
>  extern const FFCodec ff_vnull_decoder;
> diff --git a/libavcodec/qsv.c b/libavcodec/qsv.c
> index 0c6fbd0dc0..221c1b24e5 100644
> --- a/libavcodec/qsv.c
> +++ b/libavcodec/qsv.c
> @@ -73,6 +73,10 @@ int ff_qsv_codec_id_to_mfx(enum AVCodecID codec_id)
>      case AV_CODEC_ID_AV1:
>          return MFX_CODEC_AV1;
>  #endif
> +#if QSV_VERSION_ATLEAST(2, 11)
> +    case AV_CODEC_ID_VVC:
> +        return MFX_CODEC_VVC;
> +#endif
>
>      default:
>          break;
> diff --git a/libavcodec/qsvdec.c b/libavcodec/qsvdec.c
> index f2cd6ae05c..9ad3439991 100644
> --- a/libavcodec/qsvdec.c
> +++ b/libavcodec/qsvdec.c
> @@ -933,7 +933,8 @@ static int qsv_decode(AVCodecContext *avctx,
> QSVContext *q,
>          frame->pict_type =
> ff_qsv_map_pictype(aframe.frame->dec_info.FrameType);
>
>          if (avctx->codec_id == AV_CODEC_ID_H264 ||
> -            avctx->codec_id == AV_CODEC_ID_HEVC) {
> +            avctx->codec_id == AV_CODEC_ID_HEVC ||
> +            avctx->codec_id == AV_CODEC_ID_VVC) {
>              if (aframe.frame->dec_info.FrameType & MFX_FRAMETYPE_IDR)
>                  frame->flags |= AV_FRAME_FLAG_KEY;
>              else
> @@ -1300,3 +1301,7 @@ DEFINE_QSV_DECODER(vp9, VP9, NULL)
>  #if CONFIG_AV1_QSV_DECODER
>  DEFINE_QSV_DECODER(av1, AV1, NULL)
>  #endif
> +
> +#if CONFIG_VVC_QSV_DECODER
> +DEFINE_QSV_DECODER(vvc, VVC, NULL)
> +#endif
> diff --git a/libavcodec/version.h b/libavcodec/version.h
> index 7acb261bb3..37c4c39451 100644
> --- a/libavcodec/version.h
> +++ b/libavcodec/version.h
> @@ -29,7 +29,7 @@
>
>  #include "version_major.h"
>
> -#define LIBAVCODEC_VERSION_MINOR   7
> +#define LIBAVCODEC_VERSION_MINOR   8
>  #define LIBAVCODEC_VERSION_MICRO 100
>
>  #define LIBAVCODEC_VERSION_INT  AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \
> --
> 2.25.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".
>
Wang, Fei W June 13, 2024, 6:29 a.m. UTC | #2
On Wed, 2024-06-12 at 20:12 +0800, Nuo Mi wrote:
> Hi Fei,
> Thank you for the patch.
> Which hardware supports this? Could you provide the link?

Lunar Lake will. Libvpl will update the supported HW in its code repo
later https://github.com/intel/libvpl. Here is a video on overview of
Lunar Lake:
https://www.youtube.com/watch?v=OGEdN2ahmBQ

> 
> On Wed, Jun 12, 2024 at 9:03 AM <fei.w.wang-at-intel.com@ffmpeg.org>
> wrote:
> 
> > From: Fei Wang <fei.w.wang@intel.com>
> > 
> > Signed-off-by: Fei Wang <fei.w.wang@intel.com>
> > ---
> >  Changelog              | 1 +
> >  configure              | 1 +
> >  doc/decoders.texi      | 2 +-
> >  libavcodec/allcodecs.c | 1 +
> >  libavcodec/qsv.c       | 4 ++++
> >  libavcodec/qsvdec.c    | 7 ++++++-
> >  libavcodec/version.h   | 2 +-
> >  7 files changed, 15 insertions(+), 3 deletions(-)
> > 
> > diff --git a/Changelog b/Changelog
> > index 03d6b29ad8..a238a1c1f3 100644
> > --- a/Changelog
> > +++ b/Changelog
> > @@ -12,6 +12,7 @@ version <next>:
> >  - qsv_params option added for QSV encoders
> >  - VVC decoder compatible with DVB test content
> >  - xHE-AAC decoder
> > +- Intel QSV-accelerated VVC decoding
> > 
> > 
> >  version 7.0:
> > diff --git a/configure b/configure
> > index 6c5b8aab9a..b4cf12658d 100755
> > --- a/configure
> > +++ b/configure
> > @@ -3423,6 +3423,7 @@ av1_qsv_encoder_deps="libvpl"
> >  av1_amf_encoder_deps="amf"
> >  av1_vaapi_encoder_deps="VAEncPictureParameterBufferAV1"
> >  av1_vaapi_encoder_select="cbs_av1 vaapi_encode"
> > +vvc_qsv_decoder_select="qsvdec"
> > 
> It's better to follow the alphabetical order.
> You can send another patch to fix av1

OK, will fix it in v2.

Thanks
Fei

> 
> >  # parsers
> >  aac_parser_select="adts_header mpeg4audio"
> > diff --git a/doc/decoders.texi b/doc/decoders.texi
> > index 293c82c2ba..2fcc761d2f 100644
> > --- a/doc/decoders.texi
> > +++ b/doc/decoders.texi
> > @@ -157,7 +157,7 @@ Force to use a specific number of threads
> >  @section QSV Decoders
> > 
> >  The family of Intel QuickSync Video decoders (VC1, MPEG-2, H.264,
> > HEVC,
> > -JPEG/MJPEG, VP8, VP9, AV1).
> > +JPEG/MJPEG, VP8, VP9, AV1, VVC).
> > 
> >  @subsection Common Options
> > 
> > diff --git a/libavcodec/allcodecs.c b/libavcodec/allcodecs.c
> > index b102a8069e..a73b4e1673 100644
> > --- a/libavcodec/allcodecs.c
> > +++ b/libavcodec/allcodecs.c
> > @@ -885,6 +885,7 @@ extern const FFCodec ff_vp9_mediacodec_encoder;
> >  extern const FFCodec ff_vp9_qsv_decoder;
> >  extern const FFCodec ff_vp9_vaapi_encoder;
> >  extern const FFCodec ff_vp9_qsv_encoder;
> > +extern const FFCodec ff_vvc_qsv_decoder;
> > 
> >  // null codecs
> >  extern const FFCodec ff_vnull_decoder;
> > diff --git a/libavcodec/qsv.c b/libavcodec/qsv.c
> > index 0c6fbd0dc0..221c1b24e5 100644
> > --- a/libavcodec/qsv.c
> > +++ b/libavcodec/qsv.c
> > @@ -73,6 +73,10 @@ int ff_qsv_codec_id_to_mfx(enum AVCodecID
> > codec_id)
> >      case AV_CODEC_ID_AV1:
> >          return MFX_CODEC_AV1;
> >  #endif
> > +#if QSV_VERSION_ATLEAST(2, 11)
> > +    case AV_CODEC_ID_VVC:
> > +        return MFX_CODEC_VVC;
> > +#endif
> > 
> >      default:
> >          break;
> > diff --git a/libavcodec/qsvdec.c b/libavcodec/qsvdec.c
> > index f2cd6ae05c..9ad3439991 100644
> > --- a/libavcodec/qsvdec.c
> > +++ b/libavcodec/qsvdec.c
> > @@ -933,7 +933,8 @@ static int qsv_decode(AVCodecContext *avctx,
> > QSVContext *q,
> >          frame->pict_type =
> > ff_qsv_map_pictype(aframe.frame->dec_info.FrameType);
> > 
> >          if (avctx->codec_id == AV_CODEC_ID_H264 ||
> > -            avctx->codec_id == AV_CODEC_ID_HEVC) {
> > +            avctx->codec_id == AV_CODEC_ID_HEVC ||
> > +            avctx->codec_id == AV_CODEC_ID_VVC) {
> >              if (aframe.frame->dec_info.FrameType &
> > MFX_FRAMETYPE_IDR)
> >                  frame->flags |= AV_FRAME_FLAG_KEY;
> >              else
> > @@ -1300,3 +1301,7 @@ DEFINE_QSV_DECODER(vp9, VP9, NULL)
> >  #if CONFIG_AV1_QSV_DECODER
> >  DEFINE_QSV_DECODER(av1, AV1, NULL)
> >  #endif
> > +
> > +#if CONFIG_VVC_QSV_DECODER
> > +DEFINE_QSV_DECODER(vvc, VVC, NULL)
> > +#endif
> > diff --git a/libavcodec/version.h b/libavcodec/version.h
> > index 7acb261bb3..37c4c39451 100644
> > --- a/libavcodec/version.h
> > +++ b/libavcodec/version.h
> > @@ -29,7 +29,7 @@
> > 
> >  #include "version_major.h"
> > 
> > -#define LIBAVCODEC_VERSION_MINOR   7
> > +#define LIBAVCODEC_VERSION_MINOR   8
> >  #define LIBAVCODEC_VERSION_MICRO 100
> > 
> >  #define
> > LIBAVCODEC_VERSION_INT  AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \
> > --
> > 2.25.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".
> > 
> _______________________________________________
> 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".
diff mbox series

Patch

diff --git a/Changelog b/Changelog
index 03d6b29ad8..a238a1c1f3 100644
--- a/Changelog
+++ b/Changelog
@@ -12,6 +12,7 @@  version <next>:
 - qsv_params option added for QSV encoders
 - VVC decoder compatible with DVB test content
 - xHE-AAC decoder
+- Intel QSV-accelerated VVC decoding
 
 
 version 7.0:
diff --git a/configure b/configure
index 6c5b8aab9a..b4cf12658d 100755
--- a/configure
+++ b/configure
@@ -3423,6 +3423,7 @@  av1_qsv_encoder_deps="libvpl"
 av1_amf_encoder_deps="amf"
 av1_vaapi_encoder_deps="VAEncPictureParameterBufferAV1"
 av1_vaapi_encoder_select="cbs_av1 vaapi_encode"
+vvc_qsv_decoder_select="qsvdec"
 
 # parsers
 aac_parser_select="adts_header mpeg4audio"
diff --git a/doc/decoders.texi b/doc/decoders.texi
index 293c82c2ba..2fcc761d2f 100644
--- a/doc/decoders.texi
+++ b/doc/decoders.texi
@@ -157,7 +157,7 @@  Force to use a specific number of threads
 @section QSV Decoders
 
 The family of Intel QuickSync Video decoders (VC1, MPEG-2, H.264, HEVC,
-JPEG/MJPEG, VP8, VP9, AV1).
+JPEG/MJPEG, VP8, VP9, AV1, VVC).
 
 @subsection Common Options
 
diff --git a/libavcodec/allcodecs.c b/libavcodec/allcodecs.c
index b102a8069e..a73b4e1673 100644
--- a/libavcodec/allcodecs.c
+++ b/libavcodec/allcodecs.c
@@ -885,6 +885,7 @@  extern const FFCodec ff_vp9_mediacodec_encoder;
 extern const FFCodec ff_vp9_qsv_decoder;
 extern const FFCodec ff_vp9_vaapi_encoder;
 extern const FFCodec ff_vp9_qsv_encoder;
+extern const FFCodec ff_vvc_qsv_decoder;
 
 // null codecs
 extern const FFCodec ff_vnull_decoder;
diff --git a/libavcodec/qsv.c b/libavcodec/qsv.c
index 0c6fbd0dc0..221c1b24e5 100644
--- a/libavcodec/qsv.c
+++ b/libavcodec/qsv.c
@@ -73,6 +73,10 @@  int ff_qsv_codec_id_to_mfx(enum AVCodecID codec_id)
     case AV_CODEC_ID_AV1:
         return MFX_CODEC_AV1;
 #endif
+#if QSV_VERSION_ATLEAST(2, 11)
+    case AV_CODEC_ID_VVC:
+        return MFX_CODEC_VVC;
+#endif
 
     default:
         break;
diff --git a/libavcodec/qsvdec.c b/libavcodec/qsvdec.c
index f2cd6ae05c..9ad3439991 100644
--- a/libavcodec/qsvdec.c
+++ b/libavcodec/qsvdec.c
@@ -933,7 +933,8 @@  static int qsv_decode(AVCodecContext *avctx, QSVContext *q,
         frame->pict_type = ff_qsv_map_pictype(aframe.frame->dec_info.FrameType);
 
         if (avctx->codec_id == AV_CODEC_ID_H264 ||
-            avctx->codec_id == AV_CODEC_ID_HEVC) {
+            avctx->codec_id == AV_CODEC_ID_HEVC ||
+            avctx->codec_id == AV_CODEC_ID_VVC) {
             if (aframe.frame->dec_info.FrameType & MFX_FRAMETYPE_IDR)
                 frame->flags |= AV_FRAME_FLAG_KEY;
             else
@@ -1300,3 +1301,7 @@  DEFINE_QSV_DECODER(vp9, VP9, NULL)
 #if CONFIG_AV1_QSV_DECODER
 DEFINE_QSV_DECODER(av1, AV1, NULL)
 #endif
+
+#if CONFIG_VVC_QSV_DECODER
+DEFINE_QSV_DECODER(vvc, VVC, NULL)
+#endif
diff --git a/libavcodec/version.h b/libavcodec/version.h
index 7acb261bb3..37c4c39451 100644
--- a/libavcodec/version.h
+++ b/libavcodec/version.h
@@ -29,7 +29,7 @@ 
 
 #include "version_major.h"
 
-#define LIBAVCODEC_VERSION_MINOR   7
+#define LIBAVCODEC_VERSION_MINOR   8
 #define LIBAVCODEC_VERSION_MICRO 100
 
 #define LIBAVCODEC_VERSION_INT  AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \