[FFmpeg-devel] [PATCH v18 1/2] lavc/svt_hevc: add libsvt hevc encoder wrapper
Signed-off-by: Zhengxu Huang Signed-off-by: Hassene Tmar Signed-off-by: Jun Zhao Signed-off-by: Jing Sun --- configure| 4 + libavcodec/Makefile | 1 + libavcodec/allcodecs.c | 1 + libavcodec/libsvt_hevc.c | 497 +++ libavcodec/version.h | 2 +- 5 files changed, 504 insertions(+), 1 deletion(-) create mode 100644 libavcodec/libsvt_hevc.c diff --git a/configure b/configure index 8413826..7b5e9f9 100755 --- a/configure +++ b/configure @@ -264,6 +264,7 @@ External library support: --enable-libspeexenable Speex de/encoding via libspeex [no] --enable-libsrt enable Haivision SRT protocol via libsrt [no] --enable-libssh enable SFTP protocol via libssh [no] + --enable-libsvthevc enable HEVC encoding via svt [no] --enable-libtensorflow enable TensorFlow as a DNN module backend for DNN based filters like sr [no] --enable-libtesseractenable Tesseract, needed for ocr filter [no] @@ -1793,6 +1794,7 @@ EXTERNAL_LIBRARY_LIST=" libspeex libsrt libssh +libsvthevc libtensorflow libtesseract libtheora @@ -3198,6 +3200,7 @@ libshine_encoder_select="audio_frame_queue" libspeex_decoder_deps="libspeex" libspeex_encoder_deps="libspeex" libspeex_encoder_select="audio_frame_queue" +libsvt_hevc_encoder_deps="libsvthevc" libtheora_encoder_deps="libtheora" libtwolame_encoder_deps="libtwolame" libvo_amrwbenc_encoder_deps="libvo_amrwbenc" @@ -6276,6 +6279,7 @@ enabled libsoxr && require libsoxr soxr.h soxr_create -lsoxr enabled libssh&& require_pkg_config libssh libssh libssh/sftp.h sftp_init enabled libspeex && require_pkg_config libspeex speex speex/speex.h speex_decoder_init enabled libsrt&& require_pkg_config libsrt "srt >= 1.3.0" srt/srt.h srt_socket +enabled libsvthevc&& require_pkg_config libsvthevc SvtHevcEnc EbApi.h EbInitHandle enabled libtensorflow && require libtensorflow tensorflow/c/c_api.h TF_Version -ltensorflow enabled libtesseract && require_pkg_config libtesseract tesseract tesseract/capi.h TessBaseAPICreate enabled libtheora && require libtheora theora/theoraenc.h th_info_init -ltheoraenc -ltheoradec -logg diff --git a/libavcodec/Makefile b/libavcodec/Makefile index 37a84a6..334b755 100644 --- a/libavcodec/Makefile +++ b/libavcodec/Makefile @@ -994,6 +994,7 @@ OBJS-$(CONFIG_LIBOPUS_ENCODER)+= libopusenc.o libopus.o \ OBJS-$(CONFIG_LIBSHINE_ENCODER) += libshine.o OBJS-$(CONFIG_LIBSPEEX_DECODER) += libspeexdec.o OBJS-$(CONFIG_LIBSPEEX_ENCODER) += libspeexenc.o +OBJS-$(CONFIG_LIBSVT_HEVC_ENCODER)+= libsvt_hevc.o OBJS-$(CONFIG_LIBTHEORA_ENCODER) += libtheoraenc.o OBJS-$(CONFIG_LIBTWOLAME_ENCODER) += libtwolame.o OBJS-$(CONFIG_LIBVO_AMRWBENC_ENCODER) += libvo-amrwbenc.o diff --git a/libavcodec/allcodecs.c b/libavcodec/allcodecs.c index 41f6801..9415e94 100644 --- a/libavcodec/allcodecs.c +++ b/libavcodec/allcodecs.c @@ -708,6 +708,7 @@ extern AVCodec ff_librsvg_decoder; extern AVCodec ff_libshine_encoder; extern AVCodec ff_libspeex_encoder; extern AVCodec ff_libspeex_decoder; +extern AVCodec ff_libsvt_hevc_encoder; extern AVCodec ff_libtheora_encoder; extern AVCodec ff_libtwolame_encoder; extern AVCodec ff_libvo_amrwbenc_encoder; diff --git a/libavcodec/libsvt_hevc.c b/libavcodec/libsvt_hevc.c new file mode 100644 index 000..d2fdaf3 --- /dev/null +++ b/libavcodec/libsvt_hevc.c @@ -0,0 +1,497 @@ +/* +* Scalable Video Technology for HEVC encoder library plugin +* +* Copyright (c) 2019 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 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 details. +* +* You should have received a copy of the GNU Lesser General Public +* License along with this program; if not, write to the Free Software +* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +*/ + +#include "EbApi.h" + +#include "libavutil/common.h" +#include "libavutil/frame.h" +#include "libavutil/opt.h" + +#include "internal.h" +#include "avcodec.h" + +typedef enum eos_status { +EOS_NOT_REACHED = 0, +EOS_SENT, +EOS_RECEIVED +}EOS_STATUS; + +typedef str
[FFmpeg-devel] [PATCH v17 1/2] lavc/svt_hevc: add libsvt hevc encoder wrapper
Signed-off-by: Zhengxu Huang Signed-off-by: Hassene Tmar Signed-off-by: Jun Zhao Signed-off-by: Jing Sun --- configure| 4 + libavcodec/Makefile | 1 + libavcodec/allcodecs.c | 1 + libavcodec/libsvt_hevc.c | 497 +++ libavcodec/version.h | 2 +- 5 files changed, 504 insertions(+), 1 deletion(-) create mode 100644 libavcodec/libsvt_hevc.c diff --git a/configure b/configure index c09c842..648ea80 100755 --- a/configure +++ b/configure @@ -264,6 +264,7 @@ External library support: --enable-libspeexenable Speex de/encoding via libspeex [no] --enable-libsrt enable Haivision SRT protocol via libsrt [no] --enable-libssh enable SFTP protocol via libssh [no] + --enable-libsvthevc enable HEVC encoding via svt [no] --enable-libtensorflow enable TensorFlow as a DNN module backend for DNN based filters like sr [no] --enable-libtesseractenable Tesseract, needed for ocr filter [no] @@ -1793,6 +1794,7 @@ EXTERNAL_LIBRARY_LIST=" libspeex libsrt libssh +libsvthevc libtensorflow libtesseract libtheora @@ -3194,6 +3196,7 @@ libshine_encoder_select="audio_frame_queue" libspeex_decoder_deps="libspeex" libspeex_encoder_deps="libspeex" libspeex_encoder_select="audio_frame_queue" +libsvt_hevc_encoder_deps="libsvthevc" libtheora_encoder_deps="libtheora" libtwolame_encoder_deps="libtwolame" libvo_amrwbenc_encoder_deps="libvo_amrwbenc" @@ -6269,6 +6272,7 @@ enabled libsoxr && require libsoxr soxr.h soxr_create -lsoxr enabled libssh&& require_pkg_config libssh libssh libssh/sftp.h sftp_init enabled libspeex && require_pkg_config libspeex speex speex/speex.h speex_decoder_init enabled libsrt&& require_pkg_config libsrt "srt >= 1.3.0" srt/srt.h srt_socket +enabled libsvthevc&& require_pkg_config libsvthevc SvtHevcEnc EbApi.h EbInitHandle enabled libtensorflow && require libtensorflow tensorflow/c/c_api.h TF_Version -ltensorflow enabled libtesseract && require_pkg_config libtesseract tesseract tesseract/capi.h TessBaseAPICreate enabled libtheora && require libtheora theora/theoraenc.h th_info_init -ltheoraenc -ltheoradec -logg diff --git a/libavcodec/Makefile b/libavcodec/Makefile index 3cd73fb..d39f568 100644 --- a/libavcodec/Makefile +++ b/libavcodec/Makefile @@ -991,6 +991,7 @@ OBJS-$(CONFIG_LIBOPUS_ENCODER)+= libopusenc.o libopus.o \ OBJS-$(CONFIG_LIBSHINE_ENCODER) += libshine.o OBJS-$(CONFIG_LIBSPEEX_DECODER) += libspeexdec.o OBJS-$(CONFIG_LIBSPEEX_ENCODER) += libspeexenc.o +OBJS-$(CONFIG_LIBSVT_HEVC_ENCODER)+= libsvt_hevc.o OBJS-$(CONFIG_LIBTHEORA_ENCODER) += libtheoraenc.o OBJS-$(CONFIG_LIBTWOLAME_ENCODER) += libtwolame.o OBJS-$(CONFIG_LIBVO_AMRWBENC_ENCODER) += libvo-amrwbenc.o diff --git a/libavcodec/allcodecs.c b/libavcodec/allcodecs.c index d2f9a39..d8788a7 100644 --- a/libavcodec/allcodecs.c +++ b/libavcodec/allcodecs.c @@ -707,6 +707,7 @@ extern AVCodec ff_librsvg_decoder; extern AVCodec ff_libshine_encoder; extern AVCodec ff_libspeex_encoder; extern AVCodec ff_libspeex_decoder; +extern AVCodec ff_libsvt_hevc_encoder; extern AVCodec ff_libtheora_encoder; extern AVCodec ff_libtwolame_encoder; extern AVCodec ff_libvo_amrwbenc_encoder; diff --git a/libavcodec/libsvt_hevc.c b/libavcodec/libsvt_hevc.c new file mode 100644 index 000..24ab0ff --- /dev/null +++ b/libavcodec/libsvt_hevc.c @@ -0,0 +1,497 @@ +/* +* Scalable Video Technology for HEVC encoder library plugin +* +* Copyright (c) 2019 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 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 details. +* +* You should have received a copy of the GNU Lesser General Public +* License along with this program; if not, write to the Free Software +* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +*/ + +#include "EbApi.h" + +#include "libavutil/common.h" +#include "libavutil/frame.h" +#include "libavutil/opt.h" + +#include "internal.h" +#include "avcodec.h" + +typedef enum eos_status { +EOS_NOT_REACHED = 0, +EOS_SENT, +EOS_RECEIVED +}EOS_STATUS; + +typedef str
[FFmpeg-devel] [PATCH v17 2/2] doc: Add libsvt_hevc encoder docs
Add docs for libsvt_hevc encoder in encoders.texi and general.texi Signed-off-by: Jun Zhao Signed-off-by: Zhengxu Huang Signed-off-by: Hassene Tmar Signed-off-by: Jing Sun --- doc/encoders.texi | 149 ++ doc/general.texi | 8 +++ 2 files changed, 157 insertions(+) diff --git a/doc/encoders.texi b/doc/encoders.texi index eefd124..aa5bcda 100644 --- a/doc/encoders.texi +++ b/doc/encoders.texi @@ -1640,6 +1640,155 @@ Set maximum NAL size in bytes. Allow skipping frames to hit the target bitrate if set to 1. @end table +@section libsvt_hevc + +Scalable Video Technology for HEVC (SVT-HEVC) encoder wrapper. + +This encoder requires the presence of the headers and +library during configuration. You need to explicitly configure the +build with @code{--enable-libsvthevc}. The library is detected using +@command{pkg-config}. + +For more information about the library see +@url{https://github.com/intel/SVT-HEVC.git}. + +@subsection Options + +The following FFmpeg global options affect the configurations of the +libsvt_hevc encoder: + +@table @option +@item b (@emph{bitrate}) +Set the bitrate (as a number of bits per second). Default is 7M. + +@item g / @option{gop_size} +Set the GOP size. Default is -2 (unspecified). + +@item flags +cgop +Enable closed GOP. + +@item qmin (@emph{min-q}) +Default is 10 + +@item qmax (@emph{max-q}) +Default is 48 + +Set minimum/maximum quantisation values. Valid range is from 0 to 51 +(Only used when bit rate control mode @option{rc} is set to 1(vbr) mode. +It is required that qmax >= qmin). + +@item profile (@emph{profile}) +Set profile restrictions. Can assume one of the following possible values: + +@table @samp +@item main +main profile +@item main10 +main10 profile +@item rext +rext profile +@end table + +Default is 1 (main). + +@item level (@emph{level}) + +@option{level} sets the value of @emph{level}. +Set level (level_idc). Default is 0 (to be determined by the encoder). + +@end table + +The encoder also has its own specific options: + +@table @option +@item aud (@emph{aud}) +Enable use of access unit delimiters when set to 1. Default is 0 (Off). + +@item hielevel +Set hierarchical levels. Can assume one of the following possible values: + +@table @samp +@item flat +flat more +@item 1 level +Minigop size is 2^1 +@item 2 level +Minigop size is 2^2 +@item 3 level +Minigop size is 2^3 +@end table + +Default is 3 level. + +@item la_depth +Set look-ahead depth, depending on @option{rc}: for @var{vbr}, it's recommended +to unset it and use the default value (the intra period); for @var{cqp}, better +specify the look-ahead depth. + +The range is @var{-1-256}. Default is -1 (unset and the default value to be used). + +@item preset +Set the quality vs density tradeoff point at which the encoding is to be performed. +Higher perset value, higher density and lower quality. + +The range is @var{0-12}. Default is 9. + +@item tier +Set @emph{general_tier_flag}. This may affect the level chosen for the stream +if it is not explicitly specified. Can assume one of the following possible values: + +@table @samp +@item main +main tier +@item high +high tier +@end table + +Default is 1 (main). + +@item rc +Set bit rate control mode. Can assume one of the following possible values: + +@table @samp +@item cqp +Constant QP (CQP) mode +@item vbr +Variable Bit Rate (VBR) mode +@end table + +Default is 0 (cqp). + +@item forced_idr +Force keyframes to be IDR if set to >=0 (the value sets headers insertion interval). Default is -1 (CRA). + +@item asm_type +Auto select highest supported asm if set to 1 or C only if 0. Default is 1. + +@item qp +Initial quantization parameter for the intra pictures used when +@option{rc} is cqp mode. The range is from @var{0-51}. Default is 32. + +@item sc_detection +Enables or disables the scene change detection algorithm. Default is 0 (disabled). + +@item tune +Set quality tuning mode. Can assume one of the following possible values: + +@table @samp +@item sq +Visually optimized mode +@item oq +PSNR / SSIM optimized mode +@item vmaf +VMAF optimized mode +@end table + +Default is 1 (oq). + +@item bl_mode +Enables or disables Random Access Prediction. Default is 0 (disabled). +@end table + @section libtheora libtheora Theora encoder wrapper. diff --git a/doc/general.texi b/doc/general.texi index 3c0c803..fa9cd31 100644 --- a/doc/general.texi +++ b/doc/general.texi @@ -243,6 +243,14 @@ FFmpeg can use the OpenJPEG libraries for decoding/encoding J2K videos. Go to instructions. To enable using OpenJPEG in FFmpeg, pass @code{--enable-libopenjpeg} to @file{./configure}. +@section Scalable Video Technology for HEVC + +FFmpeg can make use of the SVT-HEVC library for HEVC encoding. + +Go to @url{https://github.com/intel/SVT-HEVC.git} and follow the instructions +for installing the library. Pass @code{--enable-libsvthevc} to configure to +enable it. + @section TwoLAME FFmpeg can ma
[FFmpeg-devel] [PATCH v16 1/2] lavc/svt_hevc: add libsvt hevc encoder wrapper
Signed-off-by: Zhengxu Huang Signed-off-by: Hassene Tmar Signed-off-by: Jun Zhao Signed-off-by: Jing Sun --- configure| 4 + libavcodec/Makefile | 1 + libavcodec/allcodecs.c | 1 + libavcodec/libsvt_hevc.c | 500 +++ libavcodec/version.h | 2 +- 5 files changed, 507 insertions(+), 1 deletion(-) create mode 100644 libavcodec/libsvt_hevc.c diff --git a/configure b/configure index 5a4f507..3a6cab7 100755 --- a/configure +++ b/configure @@ -264,6 +264,7 @@ External library support: --enable-libspeexenable Speex de/encoding via libspeex [no] --enable-libsrt enable Haivision SRT protocol via libsrt [no] --enable-libssh enable SFTP protocol via libssh [no] + --enable-libsvthevc enable HEVC encoding via svt [no] --enable-libtensorflow enable TensorFlow as a DNN module backend for DNN based filters like sr [no] --enable-libtesseractenable Tesseract, needed for ocr filter [no] @@ -1788,6 +1789,7 @@ EXTERNAL_LIBRARY_LIST=" libspeex libsrt libssh +libsvthevc libtensorflow libtesseract libtheora @@ -3183,6 +3185,7 @@ libshine_encoder_select="audio_frame_queue" libspeex_decoder_deps="libspeex" libspeex_encoder_deps="libspeex" libspeex_encoder_select="audio_frame_queue" +libsvt_hevc_encoder_deps="libsvthevc" libtheora_encoder_deps="libtheora" libtwolame_encoder_deps="libtwolame" libvo_amrwbenc_encoder_deps="libvo_amrwbenc" @@ -6230,6 +6233,7 @@ enabled libsoxr && require libsoxr soxr.h soxr_create -lsoxr enabled libssh&& require_pkg_config libssh libssh libssh/sftp.h sftp_init enabled libspeex && require_pkg_config libspeex speex speex/speex.h speex_decoder_init enabled libsrt&& require_pkg_config libsrt "srt >= 1.3.0" srt/srt.h srt_socket +enabled libsvthevc&& require_pkg_config libsvthevc SvtHevcEnc EbApi.h EbInitHandle enabled libtensorflow && require libtensorflow tensorflow/c/c_api.h TF_Version -ltensorflow enabled libtesseract && require_pkg_config libtesseract tesseract tesseract/capi.h TessBaseAPICreate enabled libtheora && require libtheora theora/theoraenc.h th_info_init -ltheoraenc -ltheoradec -logg diff --git a/libavcodec/Makefile b/libavcodec/Makefile index 3cd73fb..d39f568 100644 --- a/libavcodec/Makefile +++ b/libavcodec/Makefile @@ -991,6 +991,7 @@ OBJS-$(CONFIG_LIBOPUS_ENCODER)+= libopusenc.o libopus.o \ OBJS-$(CONFIG_LIBSHINE_ENCODER) += libshine.o OBJS-$(CONFIG_LIBSPEEX_DECODER) += libspeexdec.o OBJS-$(CONFIG_LIBSPEEX_ENCODER) += libspeexenc.o +OBJS-$(CONFIG_LIBSVT_HEVC_ENCODER)+= libsvt_hevc.o OBJS-$(CONFIG_LIBTHEORA_ENCODER) += libtheoraenc.o OBJS-$(CONFIG_LIBTWOLAME_ENCODER) += libtwolame.o OBJS-$(CONFIG_LIBVO_AMRWBENC_ENCODER) += libvo-amrwbenc.o diff --git a/libavcodec/allcodecs.c b/libavcodec/allcodecs.c index d2f9a39..d8788a7 100644 --- a/libavcodec/allcodecs.c +++ b/libavcodec/allcodecs.c @@ -707,6 +707,7 @@ extern AVCodec ff_librsvg_decoder; extern AVCodec ff_libshine_encoder; extern AVCodec ff_libspeex_encoder; extern AVCodec ff_libspeex_decoder; +extern AVCodec ff_libsvt_hevc_encoder; extern AVCodec ff_libtheora_encoder; extern AVCodec ff_libtwolame_encoder; extern AVCodec ff_libvo_amrwbenc_encoder; diff --git a/libavcodec/libsvt_hevc.c b/libavcodec/libsvt_hevc.c new file mode 100644 index 000..59a155f --- /dev/null +++ b/libavcodec/libsvt_hevc.c @@ -0,0 +1,500 @@ +/* +* Scalable Video Technology for HEVC encoder library plugin +* +* Copyright (c) 2019 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 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 details. +* +* You should have received a copy of the GNU Lesser General Public +* License along with this program; if not, write to the Free Software +* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +*/ + +#include "EbErrorCodes.h" +#include "EbTime.h" +#include "EbApi.h" + +#include "libavutil/common.h" +#include "libavutil/frame.h" +#include "libavutil/opt.h" + +#include "internal.h" +#include "avcodec.h" + +typedef enum eos_status { +EOS_NOT_REACHED
[FFmpeg-devel] [PATCH v16 1/2] lavc/svt_hevc: add libsvt hevc encoder wrapper
Signed-off-by: Zhengxu Huang Signed-off-by: Hassene Tmar Signed-off-by: Jun Zhao Signed-off-by: Jing Sun --- configure| 4 + libavcodec/Makefile | 1 + libavcodec/allcodecs.c | 1 + libavcodec/libsvt_hevc.c | 500 +++ libavcodec/version.h | 2 +- 5 files changed, 507 insertions(+), 1 deletion(-) create mode 100644 libavcodec/libsvt_hevc.c diff --git a/configure b/configure index 5a4f507..3a6cab7 100755 --- a/configure +++ b/configure @@ -264,6 +264,7 @@ External library support: --enable-libspeexenable Speex de/encoding via libspeex [no] --enable-libsrt enable Haivision SRT protocol via libsrt [no] --enable-libssh enable SFTP protocol via libssh [no] + --enable-libsvthevc enable HEVC encoding via svt [no] --enable-libtensorflow enable TensorFlow as a DNN module backend for DNN based filters like sr [no] --enable-libtesseractenable Tesseract, needed for ocr filter [no] @@ -1788,6 +1789,7 @@ EXTERNAL_LIBRARY_LIST=" libspeex libsrt libssh +libsvthevc libtensorflow libtesseract libtheora @@ -3183,6 +3185,7 @@ libshine_encoder_select="audio_frame_queue" libspeex_decoder_deps="libspeex" libspeex_encoder_deps="libspeex" libspeex_encoder_select="audio_frame_queue" +libsvt_hevc_encoder_deps="libsvthevc" libtheora_encoder_deps="libtheora" libtwolame_encoder_deps="libtwolame" libvo_amrwbenc_encoder_deps="libvo_amrwbenc" @@ -6230,6 +6233,7 @@ enabled libsoxr && require libsoxr soxr.h soxr_create -lsoxr enabled libssh&& require_pkg_config libssh libssh libssh/sftp.h sftp_init enabled libspeex && require_pkg_config libspeex speex speex/speex.h speex_decoder_init enabled libsrt&& require_pkg_config libsrt "srt >= 1.3.0" srt/srt.h srt_socket +enabled libsvthevc&& require_pkg_config libsvthevc SvtHevcEnc EbApi.h EbInitHandle enabled libtensorflow && require libtensorflow tensorflow/c/c_api.h TF_Version -ltensorflow enabled libtesseract && require_pkg_config libtesseract tesseract tesseract/capi.h TessBaseAPICreate enabled libtheora && require libtheora theora/theoraenc.h th_info_init -ltheoraenc -ltheoradec -logg diff --git a/libavcodec/Makefile b/libavcodec/Makefile index 3cd73fb..d39f568 100644 --- a/libavcodec/Makefile +++ b/libavcodec/Makefile @@ -991,6 +991,7 @@ OBJS-$(CONFIG_LIBOPUS_ENCODER)+= libopusenc.o libopus.o \ OBJS-$(CONFIG_LIBSHINE_ENCODER) += libshine.o OBJS-$(CONFIG_LIBSPEEX_DECODER) += libspeexdec.o OBJS-$(CONFIG_LIBSPEEX_ENCODER) += libspeexenc.o +OBJS-$(CONFIG_LIBSVT_HEVC_ENCODER)+= libsvt_hevc.o OBJS-$(CONFIG_LIBTHEORA_ENCODER) += libtheoraenc.o OBJS-$(CONFIG_LIBTWOLAME_ENCODER) += libtwolame.o OBJS-$(CONFIG_LIBVO_AMRWBENC_ENCODER) += libvo-amrwbenc.o diff --git a/libavcodec/allcodecs.c b/libavcodec/allcodecs.c index d2f9a39..d8788a7 100644 --- a/libavcodec/allcodecs.c +++ b/libavcodec/allcodecs.c @@ -707,6 +707,7 @@ extern AVCodec ff_librsvg_decoder; extern AVCodec ff_libshine_encoder; extern AVCodec ff_libspeex_encoder; extern AVCodec ff_libspeex_decoder; +extern AVCodec ff_libsvt_hevc_encoder; extern AVCodec ff_libtheora_encoder; extern AVCodec ff_libtwolame_encoder; extern AVCodec ff_libvo_amrwbenc_encoder; diff --git a/libavcodec/libsvt_hevc.c b/libavcodec/libsvt_hevc.c new file mode 100644 index 000..b0e21a36 --- /dev/null +++ b/libavcodec/libsvt_hevc.c @@ -0,0 +1,500 @@ +/* +* Scalable Video Technology for HEVC encoder library plugin +* +* Copyright (c) 2019 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 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 details. +* +* You should have received a copy of the GNU Lesser General Public +* License along with this program; if not, write to the Free Software +* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +*/ + +#include "EbErrorCodes.h" +#include "EbTime.h" +#include "EbApi.h" + +#include "libavutil/common.h" +#include "libavutil/frame.h" +#include "libavutil/opt.h" + +#include "internal.h" +#include "avcodec.h" + +typedef enum eos_status { +EOS_NOT_REACHED
[FFmpeg-devel] [PATCH v16 1/2] lavc/svt_hevc: add libsvt hevc encoder wrapper
Signed-off-by: Zhengxu Huang Signed-off-by: Hassene Tmar Signed-off-by: Jun Zhao Signed-off-by: Jing Sun --- configure| 4 + libavcodec/Makefile | 1 + libavcodec/allcodecs.c | 1 + libavcodec/libsvt_hevc.c | 501 +++ libavcodec/version.h | 2 +- 5 files changed, 508 insertions(+), 1 deletion(-) create mode 100644 libavcodec/libsvt_hevc.c diff --git a/configure b/configure index 5a4f507..3a6cab7 100755 --- a/configure +++ b/configure @@ -264,6 +264,7 @@ External library support: --enable-libspeexenable Speex de/encoding via libspeex [no] --enable-libsrt enable Haivision SRT protocol via libsrt [no] --enable-libssh enable SFTP protocol via libssh [no] + --enable-libsvthevc enable HEVC encoding via svt [no] --enable-libtensorflow enable TensorFlow as a DNN module backend for DNN based filters like sr [no] --enable-libtesseractenable Tesseract, needed for ocr filter [no] @@ -1788,6 +1789,7 @@ EXTERNAL_LIBRARY_LIST=" libspeex libsrt libssh +libsvthevc libtensorflow libtesseract libtheora @@ -3183,6 +3185,7 @@ libshine_encoder_select="audio_frame_queue" libspeex_decoder_deps="libspeex" libspeex_encoder_deps="libspeex" libspeex_encoder_select="audio_frame_queue" +libsvt_hevc_encoder_deps="libsvthevc" libtheora_encoder_deps="libtheora" libtwolame_encoder_deps="libtwolame" libvo_amrwbenc_encoder_deps="libvo_amrwbenc" @@ -6230,6 +6233,7 @@ enabled libsoxr && require libsoxr soxr.h soxr_create -lsoxr enabled libssh&& require_pkg_config libssh libssh libssh/sftp.h sftp_init enabled libspeex && require_pkg_config libspeex speex speex/speex.h speex_decoder_init enabled libsrt&& require_pkg_config libsrt "srt >= 1.3.0" srt/srt.h srt_socket +enabled libsvthevc&& require_pkg_config libsvthevc SvtHevcEnc EbApi.h EbInitHandle enabled libtensorflow && require libtensorflow tensorflow/c/c_api.h TF_Version -ltensorflow enabled libtesseract && require_pkg_config libtesseract tesseract tesseract/capi.h TessBaseAPICreate enabled libtheora && require libtheora theora/theoraenc.h th_info_init -ltheoraenc -ltheoradec -logg diff --git a/libavcodec/Makefile b/libavcodec/Makefile index 3cd73fb..d39f568 100644 --- a/libavcodec/Makefile +++ b/libavcodec/Makefile @@ -991,6 +991,7 @@ OBJS-$(CONFIG_LIBOPUS_ENCODER)+= libopusenc.o libopus.o \ OBJS-$(CONFIG_LIBSHINE_ENCODER) += libshine.o OBJS-$(CONFIG_LIBSPEEX_DECODER) += libspeexdec.o OBJS-$(CONFIG_LIBSPEEX_ENCODER) += libspeexenc.o +OBJS-$(CONFIG_LIBSVT_HEVC_ENCODER)+= libsvt_hevc.o OBJS-$(CONFIG_LIBTHEORA_ENCODER) += libtheoraenc.o OBJS-$(CONFIG_LIBTWOLAME_ENCODER) += libtwolame.o OBJS-$(CONFIG_LIBVO_AMRWBENC_ENCODER) += libvo-amrwbenc.o diff --git a/libavcodec/allcodecs.c b/libavcodec/allcodecs.c index d2f9a39..d8788a7 100644 --- a/libavcodec/allcodecs.c +++ b/libavcodec/allcodecs.c @@ -707,6 +707,7 @@ extern AVCodec ff_librsvg_decoder; extern AVCodec ff_libshine_encoder; extern AVCodec ff_libspeex_encoder; extern AVCodec ff_libspeex_decoder; +extern AVCodec ff_libsvt_hevc_encoder; extern AVCodec ff_libtheora_encoder; extern AVCodec ff_libtwolame_encoder; extern AVCodec ff_libvo_amrwbenc_encoder; diff --git a/libavcodec/libsvt_hevc.c b/libavcodec/libsvt_hevc.c new file mode 100644 index 000..57843ef --- /dev/null +++ b/libavcodec/libsvt_hevc.c @@ -0,0 +1,501 @@ +/* +* Scalable Video Technology for HEVC encoder library plugin +* +* Copyright (c) 2019 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 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 details. +* +* You should have received a copy of the GNU Lesser General Public +* License along with this program; if not, write to the Free Software +* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +*/ + +#include "EbErrorCodes.h" +#include "EbTime.h" +#include "EbApi.h" + +#include "libavutil/common.h" +#include "libavutil/frame.h" +#include "libavutil/opt.h" + +#include "internal.h" +#include "avcodec.h" + +typedef enum eos_status { +EOS_NOT_REACHED
[FFmpeg-devel] [PATCH v16 2/2] doc: Add libsvt_hevc encoder docs
Add docs for libsvt_hevc encoder in encoders.texi and general.texi Signed-off-by: Jun Zhao Signed-off-by: Zhengxu Huang Signed-off-by: Hassene Tmar Signed-off-by: Jing Sun --- doc/encoders.texi | 149 ++ doc/general.texi | 8 +++ 2 files changed, 157 insertions(+) diff --git a/doc/encoders.texi b/doc/encoders.texi index eefd124..aa5bcda 100644 --- a/doc/encoders.texi +++ b/doc/encoders.texi @@ -1640,6 +1640,155 @@ Set maximum NAL size in bytes. Allow skipping frames to hit the target bitrate if set to 1. @end table +@section libsvt_hevc + +Scalable Video Technology for HEVC (SVT-HEVC) encoder wrapper. + +This encoder requires the presence of the headers and +library during configuration. You need to explicitly configure the +build with @code{--enable-libsvthevc}. The library is detected using +@command{pkg-config}. + +For more information about the library see +@url{https://github.com/intel/SVT-HEVC.git}. + +@subsection Options + +The following FFmpeg global options affect the configurations of the +libsvt_hevc encoder: + +@table @option +@item b (@emph{bitrate}) +Set the bitrate (as a number of bits per second). Default is 7M. + +@item g / @option{gop_size} +Set the GOP size. Default is -2 (unspecified). + +@item flags +cgop +Enable closed GOP. + +@item qmin (@emph{min-q}) +Default is 10 + +@item qmax (@emph{max-q}) +Default is 48 + +Set minimum/maximum quantisation values. Valid range is from 0 to 51 +(Only used when bit rate control mode @option{rc} is set to 1(vbr) mode. +It is required that qmax >= qmin). + +@item profile (@emph{profile}) +Set profile restrictions. Can assume one of the following possible values: + +@table @samp +@item main +main profile +@item main10 +main10 profile +@item rext +rext profile +@end table + +Default is 1 (main). + +@item level (@emph{level}) + +@option{level} sets the value of @emph{level}. +Set level (level_idc). Default is 0 (to be determined by the encoder). + +@end table + +The encoder also has its own specific options: + +@table @option +@item aud (@emph{aud}) +Enable use of access unit delimiters when set to 1. Default is 0 (Off). + +@item hielevel +Set hierarchical levels. Can assume one of the following possible values: + +@table @samp +@item flat +flat more +@item 1 level +Minigop size is 2^1 +@item 2 level +Minigop size is 2^2 +@item 3 level +Minigop size is 2^3 +@end table + +Default is 3 level. + +@item la_depth +Set look-ahead depth, depending on @option{rc}: for @var{vbr}, it's recommended +to unset it and use the default value (the intra period); for @var{cqp}, better +specify the look-ahead depth. + +The range is @var{-1-256}. Default is -1 (unset and the default value to be used). + +@item preset +Set the quality vs density tradeoff point at which the encoding is to be performed. +Higher perset value, higher density and lower quality. + +The range is @var{0-12}. Default is 9. + +@item tier +Set @emph{general_tier_flag}. This may affect the level chosen for the stream +if it is not explicitly specified. Can assume one of the following possible values: + +@table @samp +@item main +main tier +@item high +high tier +@end table + +Default is 1 (main). + +@item rc +Set bit rate control mode. Can assume one of the following possible values: + +@table @samp +@item cqp +Constant QP (CQP) mode +@item vbr +Variable Bit Rate (VBR) mode +@end table + +Default is 0 (cqp). + +@item forced_idr +Force keyframes to be IDR if set to >=0 (the value sets headers insertion interval). Default is -1 (CRA). + +@item asm_type +Auto select highest supported asm if set to 1 or C only if 0. Default is 1. + +@item qp +Initial quantization parameter for the intra pictures used when +@option{rc} is cqp mode. The range is from @var{0-51}. Default is 32. + +@item sc_detection +Enables or disables the scene change detection algorithm. Default is 0 (disabled). + +@item tune +Set quality tuning mode. Can assume one of the following possible values: + +@table @samp +@item sq +Visually optimized mode +@item oq +PSNR / SSIM optimized mode +@item vmaf +VMAF optimized mode +@end table + +Default is 1 (oq). + +@item bl_mode +Enables or disables Random Access Prediction. Default is 0 (disabled). +@end table + @section libtheora libtheora Theora encoder wrapper. diff --git a/doc/general.texi b/doc/general.texi index 3c0c803..fa9cd31 100644 --- a/doc/general.texi +++ b/doc/general.texi @@ -243,6 +243,14 @@ FFmpeg can use the OpenJPEG libraries for decoding/encoding J2K videos. Go to instructions. To enable using OpenJPEG in FFmpeg, pass @code{--enable-libopenjpeg} to @file{./configure}. +@section Scalable Video Technology for HEVC + +FFmpeg can make use of the SVT-HEVC library for HEVC encoding. + +Go to @url{https://github.com/intel/SVT-HEVC.git} and follow the instructions +for installing the library. Pass @code{--enable-libsvthevc} to configure to +enable it. + @section TwoLAME FFmpeg can ma
[FFmpeg-devel] [PATCH v15 1/2] lavc/svt_hevc: add libsvt hevc encoder wrapper
Signed-off-by: Zhengxu Huang Signed-off-by: Hassene Tmar Signed-off-by: Jun Zhao Signed-off-by: Jing Sun --- configure| 4 + libavcodec/Makefile | 1 + libavcodec/allcodecs.c | 1 + libavcodec/libsvt_hevc.c | 501 +++ libavcodec/version.h | 2 +- 5 files changed, 508 insertions(+), 1 deletion(-) create mode 100644 libavcodec/libsvt_hevc.c diff --git a/configure b/configure index 7cea9d4..8f2f065 100755 --- a/configure +++ b/configure @@ -264,6 +264,7 @@ External library support: --enable-libspeexenable Speex de/encoding via libspeex [no] --enable-libsrt enable Haivision SRT protocol via libsrt [no] --enable-libssh enable SFTP protocol via libssh [no] + --enable-libsvthevc enable HEVC encoding via svt [no] --enable-libtensorflow enable TensorFlow as a DNN module backend for DNN based filters like sr [no] --enable-libtesseractenable Tesseract, needed for ocr filter [no] @@ -1787,6 +1788,7 @@ EXTERNAL_LIBRARY_LIST=" libspeex libsrt libssh +libsvthevc libtensorflow libtesseract libtheora @@ -3180,6 +3182,7 @@ libshine_encoder_select="audio_frame_queue" libspeex_decoder_deps="libspeex" libspeex_encoder_deps="libspeex" libspeex_encoder_select="audio_frame_queue" +libsvt_hevc_encoder_deps="libsvthevc" libtheora_encoder_deps="libtheora" libtwolame_encoder_deps="libtwolame" libvo_amrwbenc_encoder_deps="libvo_amrwbenc" @@ -6226,6 +6229,7 @@ enabled libsoxr && require libsoxr soxr.h soxr_create -lsoxr enabled libssh&& require_pkg_config libssh libssh libssh/sftp.h sftp_init enabled libspeex && require_pkg_config libspeex speex speex/speex.h speex_decoder_init enabled libsrt&& require_pkg_config libsrt "srt >= 1.3.0" srt/srt.h srt_socket +enabled libsvthevc&& require_pkg_config libsvthevc SvtHevcEnc EbApi.h EbInitHandle enabled libtensorflow && require libtensorflow tensorflow/c/c_api.h TF_Version -ltensorflow enabled libtesseract && require_pkg_config libtesseract tesseract tesseract/capi.h TessBaseAPICreate enabled libtheora && require libtheora theora/theoraenc.h th_info_init -ltheoraenc -ltheoradec -logg diff --git a/libavcodec/Makefile b/libavcodec/Makefile index edccd73..7eb13de 100644 --- a/libavcodec/Makefile +++ b/libavcodec/Makefile @@ -991,6 +991,7 @@ OBJS-$(CONFIG_LIBOPUS_ENCODER)+= libopusenc.o libopus.o \ OBJS-$(CONFIG_LIBSHINE_ENCODER) += libshine.o OBJS-$(CONFIG_LIBSPEEX_DECODER) += libspeexdec.o OBJS-$(CONFIG_LIBSPEEX_ENCODER) += libspeexenc.o +OBJS-$(CONFIG_LIBSVT_HEVC_ENCODER)+= libsvt_hevc.o OBJS-$(CONFIG_LIBTHEORA_ENCODER) += libtheoraenc.o OBJS-$(CONFIG_LIBTWOLAME_ENCODER) += libtwolame.o OBJS-$(CONFIG_LIBVO_AMRWBENC_ENCODER) += libvo-amrwbenc.o diff --git a/libavcodec/allcodecs.c b/libavcodec/allcodecs.c index d2f9a39..d8788a7 100644 --- a/libavcodec/allcodecs.c +++ b/libavcodec/allcodecs.c @@ -707,6 +707,7 @@ extern AVCodec ff_librsvg_decoder; extern AVCodec ff_libshine_encoder; extern AVCodec ff_libspeex_encoder; extern AVCodec ff_libspeex_decoder; +extern AVCodec ff_libsvt_hevc_encoder; extern AVCodec ff_libtheora_encoder; extern AVCodec ff_libtwolame_encoder; extern AVCodec ff_libvo_amrwbenc_encoder; diff --git a/libavcodec/libsvt_hevc.c b/libavcodec/libsvt_hevc.c new file mode 100644 index 000..d9ac04c --- /dev/null +++ b/libavcodec/libsvt_hevc.c @@ -0,0 +1,501 @@ +/* +* Scalable Video Technology for HEVC encoder library plugin +* +* Copyright (c) 2019 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 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 details. +* +* You should have received a copy of the GNU Lesser General Public +* License along with this program; if not, write to the Free Software +* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +*/ + +#include "EbErrorCodes.h" +#include "EbTime.h" +#include "EbApi.h" + +#include "libavutil/common.h" +#include "libavutil/frame.h" +#include "libavutil/opt.h" + +#include "internal.h" +#include "avcodec.h" + +typedef enum eos_status { +EOS_NOT_REACHED
[FFmpeg-devel] [PATCH v15 1/2] lavc/svt_hevc: add libsvt hevc encoder wrapper
Signed-off-by: Zhengxu Huang Signed-off-by: Hassene Tmar Signed-off-by: Jun Zhao Signed-off-by: Jing Sun --- configure| 4 + libavcodec/Makefile | 1 + libavcodec/allcodecs.c | 1 + libavcodec/libsvt_hevc.c | 501 +++ libavcodec/version.h | 2 +- 5 files changed, 508 insertions(+), 1 deletion(-) create mode 100644 libavcodec/libsvt_hevc.c diff --git a/configure b/configure index 7cea9d4..8f2f065 100755 --- a/configure +++ b/configure @@ -264,6 +264,7 @@ External library support: --enable-libspeexenable Speex de/encoding via libspeex [no] --enable-libsrt enable Haivision SRT protocol via libsrt [no] --enable-libssh enable SFTP protocol via libssh [no] + --enable-libsvthevc enable HEVC encoding via svt [no] --enable-libtensorflow enable TensorFlow as a DNN module backend for DNN based filters like sr [no] --enable-libtesseractenable Tesseract, needed for ocr filter [no] @@ -1787,6 +1788,7 @@ EXTERNAL_LIBRARY_LIST=" libspeex libsrt libssh +libsvthevc libtensorflow libtesseract libtheora @@ -3180,6 +3182,7 @@ libshine_encoder_select="audio_frame_queue" libspeex_decoder_deps="libspeex" libspeex_encoder_deps="libspeex" libspeex_encoder_select="audio_frame_queue" +libsvt_hevc_encoder_deps="libsvthevc" libtheora_encoder_deps="libtheora" libtwolame_encoder_deps="libtwolame" libvo_amrwbenc_encoder_deps="libvo_amrwbenc" @@ -6226,6 +6229,7 @@ enabled libsoxr && require libsoxr soxr.h soxr_create -lsoxr enabled libssh&& require_pkg_config libssh libssh libssh/sftp.h sftp_init enabled libspeex && require_pkg_config libspeex speex speex/speex.h speex_decoder_init enabled libsrt&& require_pkg_config libsrt "srt >= 1.3.0" srt/srt.h srt_socket +enabled libsvthevc&& require_pkg_config libsvthevc SvtHevcEnc EbApi.h EbInitHandle enabled libtensorflow && require libtensorflow tensorflow/c/c_api.h TF_Version -ltensorflow enabled libtesseract && require_pkg_config libtesseract tesseract tesseract/capi.h TessBaseAPICreate enabled libtheora && require libtheora theora/theoraenc.h th_info_init -ltheoraenc -ltheoradec -logg diff --git a/libavcodec/Makefile b/libavcodec/Makefile index edccd73..7eb13de 100644 --- a/libavcodec/Makefile +++ b/libavcodec/Makefile @@ -991,6 +991,7 @@ OBJS-$(CONFIG_LIBOPUS_ENCODER)+= libopusenc.o libopus.o \ OBJS-$(CONFIG_LIBSHINE_ENCODER) += libshine.o OBJS-$(CONFIG_LIBSPEEX_DECODER) += libspeexdec.o OBJS-$(CONFIG_LIBSPEEX_ENCODER) += libspeexenc.o +OBJS-$(CONFIG_LIBSVT_HEVC_ENCODER)+= libsvt_hevc.o OBJS-$(CONFIG_LIBTHEORA_ENCODER) += libtheoraenc.o OBJS-$(CONFIG_LIBTWOLAME_ENCODER) += libtwolame.o OBJS-$(CONFIG_LIBVO_AMRWBENC_ENCODER) += libvo-amrwbenc.o diff --git a/libavcodec/allcodecs.c b/libavcodec/allcodecs.c index d2f9a39..d8788a7 100644 --- a/libavcodec/allcodecs.c +++ b/libavcodec/allcodecs.c @@ -707,6 +707,7 @@ extern AVCodec ff_librsvg_decoder; extern AVCodec ff_libshine_encoder; extern AVCodec ff_libspeex_encoder; extern AVCodec ff_libspeex_decoder; +extern AVCodec ff_libsvt_hevc_encoder; extern AVCodec ff_libtheora_encoder; extern AVCodec ff_libtwolame_encoder; extern AVCodec ff_libvo_amrwbenc_encoder; diff --git a/libavcodec/libsvt_hevc.c b/libavcodec/libsvt_hevc.c new file mode 100644 index 000..d9ac04c --- /dev/null +++ b/libavcodec/libsvt_hevc.c @@ -0,0 +1,501 @@ +/* +* Scalable Video Technology for HEVC encoder library plugin +* +* Copyright (c) 2019 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 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 details. +* +* You should have received a copy of the GNU Lesser General Public +* License along with this program; if not, write to the Free Software +* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +*/ + +#include "EbErrorCodes.h" +#include "EbTime.h" +#include "EbApi.h" + +#include "libavutil/common.h" +#include "libavutil/frame.h" +#include "libavutil/opt.h" + +#include "internal.h" +#include "avcodec.h" + +typedef enum eos_status { +EOS_NOT_REACHED
[FFmpeg-devel] [PATCH v15 2/2] doc: Add libsvt_hevc encoder docs
Add docs for libsvt_hevc encoder in encoders.texi and general.texi Signed-off-by: Jun Zhao Signed-off-by: Zhengxu Huang Signed-off-by: Hassene Tmar Signed-off-by: Jing Sun --- doc/encoders.texi | 149 ++ doc/general.texi | 8 +++ 2 files changed, 157 insertions(+) diff --git a/doc/encoders.texi b/doc/encoders.texi index eefd124..81debda 100644 --- a/doc/encoders.texi +++ b/doc/encoders.texi @@ -1640,6 +1640,155 @@ Set maximum NAL size in bytes. Allow skipping frames to hit the target bitrate if set to 1. @end table +@section libsvt_hevc + +Scalable Video Technology for HEVC (SVT-HEVC) encoder wrapper. + +This encoder requires the presence of the headers and +library during configuration. You need to explicitly configure the +build with @code{--enable-libsvthevc}. The library is detected using +@command{pkg-config}. + +For more information about the library see +@url{https://github.com/intel/SVT-HEVC.git}. + +@subsection Options + +The following FFmpeg global options affect the configurations of the +libsvt_hevc encoder: + +@table @option +@item b (@emph{bitrate}) +Set the bitrate (as a number of bits per second). Default is 7M. + +@item g / @option{gop_size} +Set the GOP size. Default is -2 (unspecified). + +@item flags +cgop +Enable closed GOP. + +@item qmin (@emph{min-q}) +Default is 10 + +@item qmax (@emph{max-q}) +Default is 48 + +Set minimum/maximum quantisation values. Valid range is from 0 to 51 +(Only used when bit rate control mode @option{rc} is set to 1(vbr) mode. +It is required that qmax >= qmin). + +@item profile (@emph{profile}) +Set profile restrictions. Can assume one of the following possible values: + +@table @samp +@item main +main profile +@item main10 +main10 profile +@item rext +rext profile +@end table + +Default is 1 (main). + +@item level (@emph{level}) + +@option{level} sets the value of @emph{level}. +Set level (level_idc). Default is 0 (to be determined by the encoder). + +@end table + +The encoder also has its own specific options: + +@table @option +@item aud (@emph{aud}) +Enable use of access unit delimiters when set to 1. Default is 0 (Off). + +@item hielevel +Set hierarchical levels. Can assume one of the following possible values: + +@table @samp +@item flat +flat more +@item 1 level +Minigop size is 2^1 +@item 2 level +Minigop size is 2^2 +@item 3 level +Minigop size is 2^3 +@end table + +Default is 3 level. + +@item la_depth +Set look-ahead depth, depending on @option{rc}: for @var{vbr}, it's recommended +to unset it and use the default value (the intra period); for @var{cqp}, better +specify the look-ahead depth. + +The range is @var{-1-256}. Default is -1 (unset and the default value to be used). + +@item preset +Set the quality vs density tradeoff point at which the encoding is to be performed. +Higher perset value, higher density and lower quality. + +The range is @var{0-12}. Default is 9. + +@item tier +Set @emph{general_tier_flag}. This may affect the level chosen for the stream +if it is not explicitly specified. Can assume one of the following possible values: + +@table @samp +@item main +main tier +@item high +high tier +@end table + +Default is 1 (main). + +@item rc +Set bit rate control mode. Can assume one of the following possible values: + +@table @samp +@item cqp +Constant QP (CQP) mode +@item vbr +Variable Bit Rate (VBR) mode +@end table + +Default is 0 (cqp). + +@item forced_idr +Force keyframes to be IDR if set to 1. Default is 0 (CRA). + +@item asm_type +Auto select highest supported asm if set to 1 or C only if 0. Default is 1. + +@item qp +Initial quantization parameter for the intra pictures used when +@option{rc} is cqp mode. The range is from @var{0-51}. Default is 32. + +@item sc_detection +Enables or disables the scene change detection algorithm. Default is 0 (disabled). + +@item tune +Set quality tuning mode. Can assume one of the following possible values: + +@table @samp +@item sq +Visually optimized mode +@item oq +PSNR / SSIM optimized mode +@item vmaf +VMAF optimized mode +@end table + +Default is 1 (oq). + +@item bl_mode +Enables or disables Random Access Prediction. Default is 0 (disabled). +@end table + @section libtheora libtheora Theora encoder wrapper. diff --git a/doc/general.texi b/doc/general.texi index 3c0c803..fa9cd31 100644 --- a/doc/general.texi +++ b/doc/general.texi @@ -243,6 +243,14 @@ FFmpeg can use the OpenJPEG libraries for decoding/encoding J2K videos. Go to instructions. To enable using OpenJPEG in FFmpeg, pass @code{--enable-libopenjpeg} to @file{./configure}. +@section Scalable Video Technology for HEVC + +FFmpeg can make use of the SVT-HEVC library for HEVC encoding. + +Go to @url{https://github.com/intel/SVT-HEVC.git} and follow the instructions +for installing the library. Pass @code{--enable-libsvthevc} to configure to +enable it. + @section TwoLAME FFmpeg can make use of the TwoLAME library for MP2 encoding. -- 1.8.
[FFmpeg-devel] [PATCH v14 2/2] doc: Add libsvt_hevc encoder docs
Add docs for libsvt_hevc encoder in encoders.texi and general.texi Signed-off-by: Jun Zhao Signed-off-by: Zhengxu Huang Signed-off-by: Hassene Tmar Signed-off-by: Jing Sun --- doc/encoders.texi | 149 ++ doc/general.texi | 8 +++ 2 files changed, 157 insertions(+) diff --git a/doc/encoders.texi b/doc/encoders.texi index eefd124..81debda 100644 --- a/doc/encoders.texi +++ b/doc/encoders.texi @@ -1640,6 +1640,155 @@ Set maximum NAL size in bytes. Allow skipping frames to hit the target bitrate if set to 1. @end table +@section libsvt_hevc + +Scalable Video Technology for HEVC (SVT-HEVC) encoder wrapper. + +This encoder requires the presence of the headers and +library during configuration. You need to explicitly configure the +build with @code{--enable-libsvthevc}. The library is detected using +@command{pkg-config}. + +For more information about the library see +@url{https://github.com/intel/SVT-HEVC.git}. + +@subsection Options + +The following FFmpeg global options affect the configurations of the +libsvt_hevc encoder: + +@table @option +@item b (@emph{bitrate}) +Set the bitrate (as a number of bits per second). Default is 7M. + +@item g / @option{gop_size} +Set the GOP size. Default is -2 (unspecified). + +@item flags +cgop +Enable closed GOP. + +@item qmin (@emph{min-q}) +Default is 10 + +@item qmax (@emph{max-q}) +Default is 48 + +Set minimum/maximum quantisation values. Valid range is from 0 to 51 +(Only used when bit rate control mode @option{rc} is set to 1(vbr) mode. +It is required that qmax >= qmin). + +@item profile (@emph{profile}) +Set profile restrictions. Can assume one of the following possible values: + +@table @samp +@item main +main profile +@item main10 +main10 profile +@item rext +rext profile +@end table + +Default is 1 (main). + +@item level (@emph{level}) + +@option{level} sets the value of @emph{level}. +Set level (level_idc). Default is 0 (to be determined by the encoder). + +@end table + +The encoder also has its own specific options: + +@table @option +@item aud (@emph{aud}) +Enable use of access unit delimiters when set to 1. Default is 0 (Off). + +@item hielevel +Set hierarchical levels. Can assume one of the following possible values: + +@table @samp +@item flat +flat more +@item 1 level +Minigop size is 2^1 +@item 2 level +Minigop size is 2^2 +@item 3 level +Minigop size is 2^3 +@end table + +Default is 3 level. + +@item la_depth +Set look-ahead depth, depending on @option{rc}: for @var{vbr}, it's recommended +to unset it and use the default value (the intra period); for @var{cqp}, better +specify the look-ahead depth. + +The range is @var{-1-256}. Default is -1 (unset and the default value to be used). + +@item preset +Set the quality vs density tradeoff point at which the encoding is to be performed. +Higher perset value, higher density and lower quality. + +The range is @var{0-12}. Default is 9. + +@item tier +Set @emph{general_tier_flag}. This may affect the level chosen for the stream +if it is not explicitly specified. Can assume one of the following possible values: + +@table @samp +@item main +main tier +@item high +high tier +@end table + +Default is 1 (main). + +@item rc +Set bit rate control mode. Can assume one of the following possible values: + +@table @samp +@item cqp +Constant QP (CQP) mode +@item vbr +Variable Bit Rate (VBR) mode +@end table + +Default is 0 (cqp). + +@item forced_idr +Force keyframes to be IDR if set to 1. Default is 0 (CRA). + +@item asm_type +Auto select highest supported asm if set to 1 or C only if 0. Default is 1. + +@item qp +Initial quantization parameter for the intra pictures used when +@option{rc} is cqp mode. The range is from @var{0-51}. Default is 32. + +@item sc_detection +Enables or disables the scene change detection algorithm. Default is 0 (disabled). + +@item tune +Set quality tuning mode. Can assume one of the following possible values: + +@table @samp +@item sq +Visually optimized mode +@item oq +PSNR / SSIM optimized mode +@item vmaf +VMAF optimized mode +@end table + +Default is 1 (oq). + +@item bl_mode +Enables or disables Random Access Prediction. Default is 0 (disabled). +@end table + @section libtheora libtheora Theora encoder wrapper. diff --git a/doc/general.texi b/doc/general.texi index 3c0c803..fa9cd31 100644 --- a/doc/general.texi +++ b/doc/general.texi @@ -243,6 +243,14 @@ FFmpeg can use the OpenJPEG libraries for decoding/encoding J2K videos. Go to instructions. To enable using OpenJPEG in FFmpeg, pass @code{--enable-libopenjpeg} to @file{./configure}. +@section Scalable Video Technology for HEVC + +FFmpeg can make use of the SVT-HEVC library for HEVC encoding. + +Go to @url{https://github.com/intel/SVT-HEVC.git} and follow the instructions +for installing the library. Pass @code{--enable-libsvthevc} to configure to +enable it. + @section TwoLAME FFmpeg can make use of the TwoLAME library for MP2 encoding. -- 1.8.
[FFmpeg-devel] [PATCH v14 1/2] lavc/svt_hevc: add libsvt hevc encoder wrapper
Signed-off-by: Zhengxu Huang Signed-off-by: Hassene Tmar Signed-off-by: Jun Zhao Signed-off-by: Jing Sun --- configure| 4 + libavcodec/Makefile | 1 + libavcodec/allcodecs.c | 1 + libavcodec/libsvt_hevc.c | 501 +++ libavcodec/version.h | 2 +- 5 files changed, 508 insertions(+), 1 deletion(-) create mode 100644 libavcodec/libsvt_hevc.c diff --git a/configure b/configure index 7cea9d4..8f2f065 100755 --- a/configure +++ b/configure @@ -264,6 +264,7 @@ External library support: --enable-libspeexenable Speex de/encoding via libspeex [no] --enable-libsrt enable Haivision SRT protocol via libsrt [no] --enable-libssh enable SFTP protocol via libssh [no] + --enable-libsvthevc enable HEVC encoding via svt [no] --enable-libtensorflow enable TensorFlow as a DNN module backend for DNN based filters like sr [no] --enable-libtesseractenable Tesseract, needed for ocr filter [no] @@ -1787,6 +1788,7 @@ EXTERNAL_LIBRARY_LIST=" libspeex libsrt libssh +libsvthevc libtensorflow libtesseract libtheora @@ -3180,6 +3182,7 @@ libshine_encoder_select="audio_frame_queue" libspeex_decoder_deps="libspeex" libspeex_encoder_deps="libspeex" libspeex_encoder_select="audio_frame_queue" +libsvt_hevc_encoder_deps="libsvthevc" libtheora_encoder_deps="libtheora" libtwolame_encoder_deps="libtwolame" libvo_amrwbenc_encoder_deps="libvo_amrwbenc" @@ -6226,6 +6229,7 @@ enabled libsoxr && require libsoxr soxr.h soxr_create -lsoxr enabled libssh&& require_pkg_config libssh libssh libssh/sftp.h sftp_init enabled libspeex && require_pkg_config libspeex speex speex/speex.h speex_decoder_init enabled libsrt&& require_pkg_config libsrt "srt >= 1.3.0" srt/srt.h srt_socket +enabled libsvthevc&& require_pkg_config libsvthevc SvtHevcEnc EbApi.h EbInitHandle enabled libtensorflow && require libtensorflow tensorflow/c/c_api.h TF_Version -ltensorflow enabled libtesseract && require_pkg_config libtesseract tesseract tesseract/capi.h TessBaseAPICreate enabled libtheora && require libtheora theora/theoraenc.h th_info_init -ltheoraenc -ltheoradec -logg diff --git a/libavcodec/Makefile b/libavcodec/Makefile index edccd73..7eb13de 100644 --- a/libavcodec/Makefile +++ b/libavcodec/Makefile @@ -991,6 +991,7 @@ OBJS-$(CONFIG_LIBOPUS_ENCODER)+= libopusenc.o libopus.o \ OBJS-$(CONFIG_LIBSHINE_ENCODER) += libshine.o OBJS-$(CONFIG_LIBSPEEX_DECODER) += libspeexdec.o OBJS-$(CONFIG_LIBSPEEX_ENCODER) += libspeexenc.o +OBJS-$(CONFIG_LIBSVT_HEVC_ENCODER)+= libsvt_hevc.o OBJS-$(CONFIG_LIBTHEORA_ENCODER) += libtheoraenc.o OBJS-$(CONFIG_LIBTWOLAME_ENCODER) += libtwolame.o OBJS-$(CONFIG_LIBVO_AMRWBENC_ENCODER) += libvo-amrwbenc.o diff --git a/libavcodec/allcodecs.c b/libavcodec/allcodecs.c index d2f9a39..d8788a7 100644 --- a/libavcodec/allcodecs.c +++ b/libavcodec/allcodecs.c @@ -707,6 +707,7 @@ extern AVCodec ff_librsvg_decoder; extern AVCodec ff_libshine_encoder; extern AVCodec ff_libspeex_encoder; extern AVCodec ff_libspeex_decoder; +extern AVCodec ff_libsvt_hevc_encoder; extern AVCodec ff_libtheora_encoder; extern AVCodec ff_libtwolame_encoder; extern AVCodec ff_libvo_amrwbenc_encoder; diff --git a/libavcodec/libsvt_hevc.c b/libavcodec/libsvt_hevc.c new file mode 100644 index 000..d9ac04c --- /dev/null +++ b/libavcodec/libsvt_hevc.c @@ -0,0 +1,501 @@ +/* +* Scalable Video Technology for HEVC encoder library plugin +* +* Copyright (c) 2019 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 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 details. +* +* You should have received a copy of the GNU Lesser General Public +* License along with this program; if not, write to the Free Software +* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +*/ + +#include "EbErrorCodes.h" +#include "EbTime.h" +#include "EbApi.h" + +#include "libavutil/common.h" +#include "libavutil/frame.h" +#include "libavutil/opt.h" + +#include "internal.h" +#include "avcodec.h" + +typedef enum eos_status { +EOS_NOT_REACHED
[FFmpeg-devel] [PATCH v1 1/1] vaapi_encode: replace av_new_packet with ff_alloc_packet2
ff_alloc_packet2 should be used if encode2 API Signed-off-by: Jing Sun --- libavcodec/vaapi_encode.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/libavcodec/vaapi_encode.c b/libavcodec/vaapi_encode.c index 2dda451..98e3176 100644 --- a/libavcodec/vaapi_encode.c +++ b/libavcodec/vaapi_encode.c @@ -26,6 +26,7 @@ #include "vaapi_encode.h" #include "avcodec.h" +#include "internal.h" static const char * const picture_type_name[] = { "IDR", "I", "P", "B" }; @@ -509,7 +510,7 @@ static int vaapi_encode_output(AVCodecContext *avctx, av_log(avctx, AV_LOG_DEBUG, "Output buffer: %u bytes " "(status %08x).\n", buf->size, buf->status); -err = av_new_packet(pkt, buf->size); +err = ff_alloc_packet2(avctx, pkt, buf->size, 0); if (err < 0) goto fail_mapped; -- 1.8.3.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-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH v13 1/2] lavc/svt_hevc: add libsvt hevc encoder wrapper
Signed-off-by: Zhengxu Huang Signed-off-by: Hassene Tmar Signed-off-by: Jun Zhao Signed-off-by: Jing Sun --- configure| 4 + libavcodec/Makefile | 1 + libavcodec/allcodecs.c | 1 + libavcodec/libsvt_hevc.c | 501 +++ libavcodec/version.h | 2 +- 5 files changed, 508 insertions(+), 1 deletion(-) create mode 100644 libavcodec/libsvt_hevc.c diff --git a/configure b/configure index 32fc263..9e29ad3 100755 --- a/configure +++ b/configure @@ -264,6 +264,7 @@ External library support: --enable-libspeexenable Speex de/encoding via libspeex [no] --enable-libsrt enable Haivision SRT protocol via libsrt [no] --enable-libssh enable SFTP protocol via libssh [no] + --enable-libsvthevc enable HEVC encoding via svt [no] --enable-libtensorflow enable TensorFlow as a DNN module backend for DNN based filters like sr [no] --enable-libtesseractenable Tesseract, needed for ocr filter [no] @@ -1787,6 +1788,7 @@ EXTERNAL_LIBRARY_LIST=" libspeex libsrt libssh +libsvthevc libtensorflow libtesseract libtheora @@ -3179,6 +3181,7 @@ libshine_encoder_select="audio_frame_queue" libspeex_decoder_deps="libspeex" libspeex_encoder_deps="libspeex" libspeex_encoder_select="audio_frame_queue" +libsvt_hevc_encoder_deps="libsvthevc" libtheora_encoder_deps="libtheora" libtwolame_encoder_deps="libtwolame" libvo_amrwbenc_encoder_deps="libvo_amrwbenc" @@ -6210,6 +6213,7 @@ enabled libsoxr && require libsoxr soxr.h soxr_create -lsoxr enabled libssh&& require_pkg_config libssh libssh libssh/sftp.h sftp_init enabled libspeex && require_pkg_config libspeex speex speex/speex.h speex_decoder_init enabled libsrt&& require_pkg_config libsrt "srt >= 1.3.0" srt/srt.h srt_socket +enabled libsvthevc&& require_pkg_config libsvthevc SvtHevcEnc EbApi.h EbInitHandle enabled libtensorflow && require libtensorflow tensorflow/c/c_api.h TF_Version -ltensorflow enabled libtesseract && require_pkg_config libtesseract tesseract tesseract/capi.h TessBaseAPICreate enabled libtheora && require libtheora theora/theoraenc.h th_info_init -ltheoraenc -ltheoradec -logg diff --git a/libavcodec/Makefile b/libavcodec/Makefile index edccd73..7eb13de 100644 --- a/libavcodec/Makefile +++ b/libavcodec/Makefile @@ -991,6 +991,7 @@ OBJS-$(CONFIG_LIBOPUS_ENCODER)+= libopusenc.o libopus.o \ OBJS-$(CONFIG_LIBSHINE_ENCODER) += libshine.o OBJS-$(CONFIG_LIBSPEEX_DECODER) += libspeexdec.o OBJS-$(CONFIG_LIBSPEEX_ENCODER) += libspeexenc.o +OBJS-$(CONFIG_LIBSVT_HEVC_ENCODER)+= libsvt_hevc.o OBJS-$(CONFIG_LIBTHEORA_ENCODER) += libtheoraenc.o OBJS-$(CONFIG_LIBTWOLAME_ENCODER) += libtwolame.o OBJS-$(CONFIG_LIBVO_AMRWBENC_ENCODER) += libvo-amrwbenc.o diff --git a/libavcodec/allcodecs.c b/libavcodec/allcodecs.c index 6178d31..e27a7b6 100644 --- a/libavcodec/allcodecs.c +++ b/libavcodec/allcodecs.c @@ -706,6 +706,7 @@ extern AVCodec ff_librsvg_decoder; extern AVCodec ff_libshine_encoder; extern AVCodec ff_libspeex_encoder; extern AVCodec ff_libspeex_decoder; +extern AVCodec ff_libsvt_hevc_encoder; extern AVCodec ff_libtheora_encoder; extern AVCodec ff_libtwolame_encoder; extern AVCodec ff_libvo_amrwbenc_encoder; diff --git a/libavcodec/libsvt_hevc.c b/libavcodec/libsvt_hevc.c new file mode 100644 index 000..d9ac04c --- /dev/null +++ b/libavcodec/libsvt_hevc.c @@ -0,0 +1,501 @@ +/* +* Scalable Video Technology for HEVC encoder library plugin +* +* Copyright (c) 2019 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 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 details. +* +* You should have received a copy of the GNU Lesser General Public +* License along with this program; if not, write to the Free Software +* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +*/ + +#include "EbErrorCodes.h" +#include "EbTime.h" +#include "EbApi.h" + +#include "libavutil/common.h" +#include "libavutil/frame.h" +#include "libavutil/opt.h" + +#include "internal.h" +#include "avcodec.h" + +typedef enum eos_status { +EOS_NOT_REACHED
[FFmpeg-devel] [PATCH v13 1/2] lavc/svt_hevc: add libsvt hevc encoder wrapper
Signed-off-by: Zhengxu Huang Signed-off-by: Hassene Tmar Signed-off-by: Jun Zhao Signed-off-by: Jing Sun --- configure| 4 + libavcodec/Makefile | 1 + libavcodec/allcodecs.c | 1 + libavcodec/libsvt_hevc.c | 499 +++ libavcodec/version.h | 2 +- 5 files changed, 506 insertions(+), 1 deletion(-) create mode 100644 libavcodec/libsvt_hevc.c diff --git a/configure b/configure index 32fc263..9e29ad3 100755 --- a/configure +++ b/configure @@ -264,6 +264,7 @@ External library support: --enable-libspeexenable Speex de/encoding via libspeex [no] --enable-libsrt enable Haivision SRT protocol via libsrt [no] --enable-libssh enable SFTP protocol via libssh [no] + --enable-libsvthevc enable HEVC encoding via svt [no] --enable-libtensorflow enable TensorFlow as a DNN module backend for DNN based filters like sr [no] --enable-libtesseractenable Tesseract, needed for ocr filter [no] @@ -1787,6 +1788,7 @@ EXTERNAL_LIBRARY_LIST=" libspeex libsrt libssh +libsvthevc libtensorflow libtesseract libtheora @@ -3179,6 +3181,7 @@ libshine_encoder_select="audio_frame_queue" libspeex_decoder_deps="libspeex" libspeex_encoder_deps="libspeex" libspeex_encoder_select="audio_frame_queue" +libsvt_hevc_encoder_deps="libsvthevc" libtheora_encoder_deps="libtheora" libtwolame_encoder_deps="libtwolame" libvo_amrwbenc_encoder_deps="libvo_amrwbenc" @@ -6210,6 +6213,7 @@ enabled libsoxr && require libsoxr soxr.h soxr_create -lsoxr enabled libssh&& require_pkg_config libssh libssh libssh/sftp.h sftp_init enabled libspeex && require_pkg_config libspeex speex speex/speex.h speex_decoder_init enabled libsrt&& require_pkg_config libsrt "srt >= 1.3.0" srt/srt.h srt_socket +enabled libsvthevc&& require_pkg_config libsvthevc SvtHevcEnc EbApi.h EbInitHandle enabled libtensorflow && require libtensorflow tensorflow/c/c_api.h TF_Version -ltensorflow enabled libtesseract && require_pkg_config libtesseract tesseract tesseract/capi.h TessBaseAPICreate enabled libtheora && require libtheora theora/theoraenc.h th_info_init -ltheoraenc -ltheoradec -logg diff --git a/libavcodec/Makefile b/libavcodec/Makefile index edccd73..7eb13de 100644 --- a/libavcodec/Makefile +++ b/libavcodec/Makefile @@ -991,6 +991,7 @@ OBJS-$(CONFIG_LIBOPUS_ENCODER)+= libopusenc.o libopus.o \ OBJS-$(CONFIG_LIBSHINE_ENCODER) += libshine.o OBJS-$(CONFIG_LIBSPEEX_DECODER) += libspeexdec.o OBJS-$(CONFIG_LIBSPEEX_ENCODER) += libspeexenc.o +OBJS-$(CONFIG_LIBSVT_HEVC_ENCODER)+= libsvt_hevc.o OBJS-$(CONFIG_LIBTHEORA_ENCODER) += libtheoraenc.o OBJS-$(CONFIG_LIBTWOLAME_ENCODER) += libtwolame.o OBJS-$(CONFIG_LIBVO_AMRWBENC_ENCODER) += libvo-amrwbenc.o diff --git a/libavcodec/allcodecs.c b/libavcodec/allcodecs.c index 6178d31..e27a7b6 100644 --- a/libavcodec/allcodecs.c +++ b/libavcodec/allcodecs.c @@ -706,6 +706,7 @@ extern AVCodec ff_librsvg_decoder; extern AVCodec ff_libshine_encoder; extern AVCodec ff_libspeex_encoder; extern AVCodec ff_libspeex_decoder; +extern AVCodec ff_libsvt_hevc_encoder; extern AVCodec ff_libtheora_encoder; extern AVCodec ff_libtwolame_encoder; extern AVCodec ff_libvo_amrwbenc_encoder; diff --git a/libavcodec/libsvt_hevc.c b/libavcodec/libsvt_hevc.c new file mode 100644 index 000..fe6ea4b --- /dev/null +++ b/libavcodec/libsvt_hevc.c @@ -0,0 +1,499 @@ +/* +* Scalable Video Technology for HEVC encoder library plugin +* +* Copyright (c) 2019 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 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 details. +* +* You should have received a copy of the GNU Lesser General Public +* License along with this program; if not, write to the Free Software +* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +*/ + +#include "EbErrorCodes.h" +#include "EbTime.h" +#include "EbApi.h" + +#include "libavutil/common.h" +#include "libavutil/frame.h" +#include "libavutil/opt.h" + +#include "internal.h" +#include "avcodec.h" + +typedef enum eos_status { +EOS_NOT_REACHED
[FFmpeg-devel] [PATCH v13 1/2] lavc/svt_hevc: add libsvt hevc encoder wrapper
Signed-off-by: Zhengxu Huang Signed-off-by: Hassene Tmar Signed-off-by: Jun Zhao Signed-off-by: Jing Sun --- configure| 4 + libavcodec/Makefile | 1 + libavcodec/allcodecs.c | 1 + libavcodec/libsvt_hevc.c | 499 +++ libavcodec/version.h | 2 +- 5 files changed, 506 insertions(+), 1 deletion(-) create mode 100644 libavcodec/libsvt_hevc.c diff --git a/configure b/configure index 32fc263..9e29ad3 100755 --- a/configure +++ b/configure @@ -264,6 +264,7 @@ External library support: --enable-libspeexenable Speex de/encoding via libspeex [no] --enable-libsrt enable Haivision SRT protocol via libsrt [no] --enable-libssh enable SFTP protocol via libssh [no] + --enable-libsvthevc enable HEVC encoding via svt [no] --enable-libtensorflow enable TensorFlow as a DNN module backend for DNN based filters like sr [no] --enable-libtesseractenable Tesseract, needed for ocr filter [no] @@ -1787,6 +1788,7 @@ EXTERNAL_LIBRARY_LIST=" libspeex libsrt libssh +libsvthevc libtensorflow libtesseract libtheora @@ -3179,6 +3181,7 @@ libshine_encoder_select="audio_frame_queue" libspeex_decoder_deps="libspeex" libspeex_encoder_deps="libspeex" libspeex_encoder_select="audio_frame_queue" +libsvt_hevc_encoder_deps="libsvthevc" libtheora_encoder_deps="libtheora" libtwolame_encoder_deps="libtwolame" libvo_amrwbenc_encoder_deps="libvo_amrwbenc" @@ -6210,6 +6213,7 @@ enabled libsoxr && require libsoxr soxr.h soxr_create -lsoxr enabled libssh&& require_pkg_config libssh libssh libssh/sftp.h sftp_init enabled libspeex && require_pkg_config libspeex speex speex/speex.h speex_decoder_init enabled libsrt&& require_pkg_config libsrt "srt >= 1.3.0" srt/srt.h srt_socket +enabled libsvthevc&& require_pkg_config libsvthevc SvtHevcEnc EbApi.h EbInitHandle enabled libtensorflow && require libtensorflow tensorflow/c/c_api.h TF_Version -ltensorflow enabled libtesseract && require_pkg_config libtesseract tesseract tesseract/capi.h TessBaseAPICreate enabled libtheora && require libtheora theora/theoraenc.h th_info_init -ltheoraenc -ltheoradec -logg diff --git a/libavcodec/Makefile b/libavcodec/Makefile index edccd73..7eb13de 100644 --- a/libavcodec/Makefile +++ b/libavcodec/Makefile @@ -991,6 +991,7 @@ OBJS-$(CONFIG_LIBOPUS_ENCODER)+= libopusenc.o libopus.o \ OBJS-$(CONFIG_LIBSHINE_ENCODER) += libshine.o OBJS-$(CONFIG_LIBSPEEX_DECODER) += libspeexdec.o OBJS-$(CONFIG_LIBSPEEX_ENCODER) += libspeexenc.o +OBJS-$(CONFIG_LIBSVT_HEVC_ENCODER)+= libsvt_hevc.o OBJS-$(CONFIG_LIBTHEORA_ENCODER) += libtheoraenc.o OBJS-$(CONFIG_LIBTWOLAME_ENCODER) += libtwolame.o OBJS-$(CONFIG_LIBVO_AMRWBENC_ENCODER) += libvo-amrwbenc.o diff --git a/libavcodec/allcodecs.c b/libavcodec/allcodecs.c index 6178d31..e27a7b6 100644 --- a/libavcodec/allcodecs.c +++ b/libavcodec/allcodecs.c @@ -706,6 +706,7 @@ extern AVCodec ff_librsvg_decoder; extern AVCodec ff_libshine_encoder; extern AVCodec ff_libspeex_encoder; extern AVCodec ff_libspeex_decoder; +extern AVCodec ff_libsvt_hevc_encoder; extern AVCodec ff_libtheora_encoder; extern AVCodec ff_libtwolame_encoder; extern AVCodec ff_libvo_amrwbenc_encoder; diff --git a/libavcodec/libsvt_hevc.c b/libavcodec/libsvt_hevc.c new file mode 100644 index 000..a445c84a4 --- /dev/null +++ b/libavcodec/libsvt_hevc.c @@ -0,0 +1,499 @@ +/* +* Scalable Video Technology for HEVC encoder library plugin +* +* Copyright (c) 2019 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 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 details. +* +* You should have received a copy of the GNU Lesser General Public +* License along with this program; if not, write to the Free Software +* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +*/ + +#include "EbErrorCodes.h" +#include "EbTime.h" +#include "EbApi.h" + +#include "libavutil/common.h" +#include "libavutil/frame.h" +#include "libavutil/opt.h" + +#include "internal.h" +#include "avcodec.h" + +typedef enum eos_status { +EOS_NOT_REACHED
[FFmpeg-devel] [PATCH v13 2/2] doc: Add libsvt_hevc encoder docs
Add docs for libsvt_hevc encoder in encoders.texi and general.texi Signed-off-by: Jun Zhao Signed-off-by: Zhengxu Huang Signed-off-by: Hassene Tmar Signed-off-by: Jing Sun --- doc/encoders.texi | 149 ++ doc/general.texi | 8 +++ 2 files changed, 157 insertions(+) diff --git a/doc/encoders.texi b/doc/encoders.texi index eefd124..81debda 100644 --- a/doc/encoders.texi +++ b/doc/encoders.texi @@ -1640,6 +1640,155 @@ Set maximum NAL size in bytes. Allow skipping frames to hit the target bitrate if set to 1. @end table +@section libsvt_hevc + +Scalable Video Technology for HEVC (SVT-HEVC) encoder wrapper. + +This encoder requires the presence of the headers and +library during configuration. You need to explicitly configure the +build with @code{--enable-libsvthevc}. The library is detected using +@command{pkg-config}. + +For more information about the library see +@url{https://github.com/intel/SVT-HEVC.git}. + +@subsection Options + +The following FFmpeg global options affect the configurations of the +libsvt_hevc encoder: + +@table @option +@item b (@emph{bitrate}) +Set the bitrate (as a number of bits per second). Default is 7M. + +@item g / @option{gop_size} +Set the GOP size. Default is -2 (unspecified). + +@item flags +cgop +Enable closed GOP. + +@item qmin (@emph{min-q}) +Default is 10 + +@item qmax (@emph{max-q}) +Default is 48 + +Set minimum/maximum quantisation values. Valid range is from 0 to 51 +(Only used when bit rate control mode @option{rc} is set to 1(vbr) mode. +It is required that qmax >= qmin). + +@item profile (@emph{profile}) +Set profile restrictions. Can assume one of the following possible values: + +@table @samp +@item main +main profile +@item main10 +main10 profile +@item rext +rext profile +@end table + +Default is 1 (main). + +@item level (@emph{level}) + +@option{level} sets the value of @emph{level}. +Set level (level_idc). Default is 0 (to be determined by the encoder). + +@end table + +The encoder also has its own specific options: + +@table @option +@item aud (@emph{aud}) +Enable use of access unit delimiters when set to 1. Default is 0 (Off). + +@item hielevel +Set hierarchical levels. Can assume one of the following possible values: + +@table @samp +@item flat +flat more +@item 1 level +Minigop size is 2^1 +@item 2 level +Minigop size is 2^2 +@item 3 level +Minigop size is 2^3 +@end table + +Default is 3 level. + +@item la_depth +Set look-ahead depth, depending on @option{rc}: for @var{vbr}, it's recommended +to unset it and use the default value (the intra period); for @var{cqp}, better +specify the look-ahead depth. + +The range is @var{-1-256}. Default is -1 (unset and the default value to be used). + +@item preset +Set the quality vs density tradeoff point at which the encoding is to be performed. +Higher perset value, higher density and lower quality. + +The range is @var{0-12}. Default is 9. + +@item tier +Set @emph{general_tier_flag}. This may affect the level chosen for the stream +if it is not explicitly specified. Can assume one of the following possible values: + +@table @samp +@item main +main tier +@item high +high tier +@end table + +Default is 1 (main). + +@item rc +Set bit rate control mode. Can assume one of the following possible values: + +@table @samp +@item cqp +Constant QP (CQP) mode +@item vbr +Variable Bit Rate (VBR) mode +@end table + +Default is 0 (cqp). + +@item forced_idr +Force keyframes to be IDR if set to 1. Default is 0 (CRA). + +@item asm_type +Auto select highest supported asm if set to 1 or C only if 0. Default is 1. + +@item qp +Initial quantization parameter for the intra pictures used when +@option{rc} is cqp mode. The range is from @var{0-51}. Default is 32. + +@item sc_detection +Enables or disables the scene change detection algorithm. Default is 0 (disabled). + +@item tune +Set quality tuning mode. Can assume one of the following possible values: + +@table @samp +@item sq +Visually optimized mode +@item oq +PSNR / SSIM optimized mode +@item vmaf +VMAF optimized mode +@end table + +Default is 1 (oq). + +@item bl_mode +Enables or disables Random Access Prediction. Default is 0 (disabled). +@end table + @section libtheora libtheora Theora encoder wrapper. diff --git a/doc/general.texi b/doc/general.texi index ec43723..f3e0c6b 100644 --- a/doc/general.texi +++ b/doc/general.texi @@ -243,6 +243,14 @@ FFmpeg can use the OpenJPEG libraries for decoding/encoding J2K videos. Go to instructions. To enable using OpenJPEG in FFmpeg, pass @code{--enable-libopenjpeg} to @file{./configure}. +@section Scalable Video Technology for HEVC + +FFmpeg can make use of the SVT-HEVC library for HEVC encoding. + +Go to @url{https://github.com/intel/SVT-HEVC.git} and follow the instructions +for installing the library. Pass @code{--enable-libsvthevc} to configure to +enable it. + @section TwoLAME FFmpeg can make use of the TwoLAME library for MP2 encoding. -- 1.8.
[FFmpeg-devel] [PATCH v13 1/2] lavc/svt_hevc: add libsvt hevc encoder wrapper
Signed-off-by: Zhengxu Huang Signed-off-by: Hassene Tmar Signed-off-by: Jun Zhao Signed-off-by: Jing Sun --- configure| 4 + libavcodec/Makefile | 1 + libavcodec/allcodecs.c | 1 + libavcodec/libsvt_hevc.c | 510 +++ libavcodec/version.h | 2 +- 5 files changed, 517 insertions(+), 1 deletion(-) create mode 100644 libavcodec/libsvt_hevc.c diff --git a/configure b/configure index 32fc263..9e29ad3 100755 --- a/configure +++ b/configure @@ -264,6 +264,7 @@ External library support: --enable-libspeexenable Speex de/encoding via libspeex [no] --enable-libsrt enable Haivision SRT protocol via libsrt [no] --enable-libssh enable SFTP protocol via libssh [no] + --enable-libsvthevc enable HEVC encoding via svt [no] --enable-libtensorflow enable TensorFlow as a DNN module backend for DNN based filters like sr [no] --enable-libtesseractenable Tesseract, needed for ocr filter [no] @@ -1787,6 +1788,7 @@ EXTERNAL_LIBRARY_LIST=" libspeex libsrt libssh +libsvthevc libtensorflow libtesseract libtheora @@ -3179,6 +3181,7 @@ libshine_encoder_select="audio_frame_queue" libspeex_decoder_deps="libspeex" libspeex_encoder_deps="libspeex" libspeex_encoder_select="audio_frame_queue" +libsvt_hevc_encoder_deps="libsvthevc" libtheora_encoder_deps="libtheora" libtwolame_encoder_deps="libtwolame" libvo_amrwbenc_encoder_deps="libvo_amrwbenc" @@ -6210,6 +6213,7 @@ enabled libsoxr && require libsoxr soxr.h soxr_create -lsoxr enabled libssh&& require_pkg_config libssh libssh libssh/sftp.h sftp_init enabled libspeex && require_pkg_config libspeex speex speex/speex.h speex_decoder_init enabled libsrt&& require_pkg_config libsrt "srt >= 1.3.0" srt/srt.h srt_socket +enabled libsvthevc&& require_pkg_config libsvthevc SvtHevcEnc EbApi.h EbInitHandle enabled libtensorflow && require libtensorflow tensorflow/c/c_api.h TF_Version -ltensorflow enabled libtesseract && require_pkg_config libtesseract tesseract tesseract/capi.h TessBaseAPICreate enabled libtheora && require libtheora theora/theoraenc.h th_info_init -ltheoraenc -ltheoradec -logg diff --git a/libavcodec/Makefile b/libavcodec/Makefile index edccd73..7eb13de 100644 --- a/libavcodec/Makefile +++ b/libavcodec/Makefile @@ -991,6 +991,7 @@ OBJS-$(CONFIG_LIBOPUS_ENCODER)+= libopusenc.o libopus.o \ OBJS-$(CONFIG_LIBSHINE_ENCODER) += libshine.o OBJS-$(CONFIG_LIBSPEEX_DECODER) += libspeexdec.o OBJS-$(CONFIG_LIBSPEEX_ENCODER) += libspeexenc.o +OBJS-$(CONFIG_LIBSVT_HEVC_ENCODER)+= libsvt_hevc.o OBJS-$(CONFIG_LIBTHEORA_ENCODER) += libtheoraenc.o OBJS-$(CONFIG_LIBTWOLAME_ENCODER) += libtwolame.o OBJS-$(CONFIG_LIBVO_AMRWBENC_ENCODER) += libvo-amrwbenc.o diff --git a/libavcodec/allcodecs.c b/libavcodec/allcodecs.c index 6178d31..e27a7b6 100644 --- a/libavcodec/allcodecs.c +++ b/libavcodec/allcodecs.c @@ -706,6 +706,7 @@ extern AVCodec ff_librsvg_decoder; extern AVCodec ff_libshine_encoder; extern AVCodec ff_libspeex_encoder; extern AVCodec ff_libspeex_decoder; +extern AVCodec ff_libsvt_hevc_encoder; extern AVCodec ff_libtheora_encoder; extern AVCodec ff_libtwolame_encoder; extern AVCodec ff_libvo_amrwbenc_encoder; diff --git a/libavcodec/libsvt_hevc.c b/libavcodec/libsvt_hevc.c new file mode 100644 index 000..1c740e6 --- /dev/null +++ b/libavcodec/libsvt_hevc.c @@ -0,0 +1,510 @@ +/* +* Scalable Video Technology for HEVC encoder library plugin +* +* Copyright (c) 2019 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 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 details. +* +* You should have received a copy of the GNU Lesser General Public +* License along with this program; if not, write to the Free Software +* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +*/ + +#include "EbErrorCodes.h" +#include "EbTime.h" +#include "EbApi.h" + +#include "libavutil/common.h" +#include "libavutil/frame.h" +#include "libavutil/opt.h" + +#include "internal.h" +#include "avcodec.h" + +typedef enum eos_status { +EOS_NOT_REACHED
[FFmpeg-devel] [PATCH v12 1/2] lavc/svt_hevc: add libsvt hevc encoder wrapper
Signed-off-by: Zhengxu Huang Signed-off-by: Hassene Tmar Signed-off-by: Jun Zhao Signed-off-by: Jing Sun --- configure| 4 + libavcodec/Makefile | 1 + libavcodec/allcodecs.c | 1 + libavcodec/libsvt_hevc.c | 518 +++ libavcodec/version.h | 4 +- 5 files changed, 526 insertions(+), 2 deletions(-) create mode 100644 libavcodec/libsvt_hevc.c diff --git a/configure b/configure index d644a5b..2bc93a6 100755 --- a/configure +++ b/configure @@ -264,6 +264,7 @@ External library support: --enable-libspeexenable Speex de/encoding via libspeex [no] --enable-libsrt enable Haivision SRT protocol via libsrt [no] --enable-libssh enable SFTP protocol via libssh [no] + --enable-libsvthevc enable HEVC encoding via svt [no] --enable-libtensorflow enable TensorFlow as a DNN module backend for DNN based filters like sr [no] --enable-libtesseractenable Tesseract, needed for ocr filter [no] @@ -1782,6 +1783,7 @@ EXTERNAL_LIBRARY_LIST=" libspeex libsrt libssh +libsvthevc libtensorflow libtesseract libtheora @@ -3174,6 +3176,7 @@ libshine_encoder_select="audio_frame_queue" libspeex_decoder_deps="libspeex" libspeex_encoder_deps="libspeex" libspeex_encoder_select="audio_frame_queue" +libsvt_hevc_encoder_deps="libsvthevc" libtheora_encoder_deps="libtheora" libtwolame_encoder_deps="libtwolame" libvo_amrwbenc_encoder_deps="libvo_amrwbenc" @@ -6203,6 +6206,7 @@ enabled libsoxr && require libsoxr soxr.h soxr_create -lsoxr enabled libssh&& require_pkg_config libssh libssh libssh/sftp.h sftp_init enabled libspeex && require_pkg_config libspeex speex speex/speex.h speex_decoder_init enabled libsrt&& require_pkg_config libsrt "srt >= 1.3.0" srt/srt.h srt_socket +enabled libsvthevc&& require_pkg_config libsvthevc SvtHevcEnc EbApi.h EbInitHandle enabled libtensorflow && require libtensorflow tensorflow/c/c_api.h TF_Version -ltensorflow enabled libtesseract && require_pkg_config libtesseract tesseract tesseract/capi.h TessBaseAPICreate enabled libtheora && require libtheora theora/theoraenc.h th_info_init -ltheoraenc -ltheoradec -logg diff --git a/libavcodec/Makefile b/libavcodec/Makefile index f37135f..8e031d3 100644 --- a/libavcodec/Makefile +++ b/libavcodec/Makefile @@ -991,6 +991,7 @@ OBJS-$(CONFIG_LIBOPUS_ENCODER)+= libopusenc.o libopus.o \ OBJS-$(CONFIG_LIBSHINE_ENCODER) += libshine.o OBJS-$(CONFIG_LIBSPEEX_DECODER) += libspeexdec.o OBJS-$(CONFIG_LIBSPEEX_ENCODER) += libspeexenc.o +OBJS-$(CONFIG_LIBSVT_HEVC_ENCODER)+= libsvt_hevc.o OBJS-$(CONFIG_LIBTHEORA_ENCODER) += libtheoraenc.o OBJS-$(CONFIG_LIBTWOLAME_ENCODER) += libtwolame.o OBJS-$(CONFIG_LIBVO_AMRWBENC_ENCODER) += libvo-amrwbenc.o diff --git a/libavcodec/allcodecs.c b/libavcodec/allcodecs.c index 6178d31..e27a7b6 100644 --- a/libavcodec/allcodecs.c +++ b/libavcodec/allcodecs.c @@ -706,6 +706,7 @@ extern AVCodec ff_librsvg_decoder; extern AVCodec ff_libshine_encoder; extern AVCodec ff_libspeex_encoder; extern AVCodec ff_libspeex_decoder; +extern AVCodec ff_libsvt_hevc_encoder; extern AVCodec ff_libtheora_encoder; extern AVCodec ff_libtwolame_encoder; extern AVCodec ff_libvo_amrwbenc_encoder; diff --git a/libavcodec/libsvt_hevc.c b/libavcodec/libsvt_hevc.c new file mode 100644 index 000..8fe9803 --- /dev/null +++ b/libavcodec/libsvt_hevc.c @@ -0,0 +1,518 @@ +/* +* Scalable Video Technology for HEVC encoder library plugin +* +* Copyright (c) 2019 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 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 details. +* +* You should have received a copy of the GNU Lesser General Public +* License along with this program; if not, write to the Free Software +* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +*/ + +#include "EbErrorCodes.h" +#include "EbTime.h" +#include "EbApi.h" + +#include "libavutil/common.h" +#include "libavutil/frame.h" +#include "libavutil/opt.h" + +#include "internal.h" +#include "avcodec.h" + +typedef enum eos_status { +EOS_NOT_REA
[FFmpeg-devel] [PATCH v12 1/2] lavc/svt_hevc: add libsvt hevc encoder wrapper
Signed-off-by: Zhengxu Huang Signed-off-by: Hassene Tmar Signed-off-by: Jun Zhao Signed-off-by: Jing Sun --- configure| 4 + libavcodec/Makefile | 1 + libavcodec/allcodecs.c | 1 + libavcodec/libsvt_hevc.c | 517 +++ libavcodec/version.h | 4 +- 5 files changed, 525 insertions(+), 2 deletions(-) create mode 100644 libavcodec/libsvt_hevc.c diff --git a/configure b/configure index d644a5b..2bc93a6 100755 --- a/configure +++ b/configure @@ -264,6 +264,7 @@ External library support: --enable-libspeexenable Speex de/encoding via libspeex [no] --enable-libsrt enable Haivision SRT protocol via libsrt [no] --enable-libssh enable SFTP protocol via libssh [no] + --enable-libsvthevc enable HEVC encoding via svt [no] --enable-libtensorflow enable TensorFlow as a DNN module backend for DNN based filters like sr [no] --enable-libtesseractenable Tesseract, needed for ocr filter [no] @@ -1782,6 +1783,7 @@ EXTERNAL_LIBRARY_LIST=" libspeex libsrt libssh +libsvthevc libtensorflow libtesseract libtheora @@ -3174,6 +3176,7 @@ libshine_encoder_select="audio_frame_queue" libspeex_decoder_deps="libspeex" libspeex_encoder_deps="libspeex" libspeex_encoder_select="audio_frame_queue" +libsvt_hevc_encoder_deps="libsvthevc" libtheora_encoder_deps="libtheora" libtwolame_encoder_deps="libtwolame" libvo_amrwbenc_encoder_deps="libvo_amrwbenc" @@ -6203,6 +6206,7 @@ enabled libsoxr && require libsoxr soxr.h soxr_create -lsoxr enabled libssh&& require_pkg_config libssh libssh libssh/sftp.h sftp_init enabled libspeex && require_pkg_config libspeex speex speex/speex.h speex_decoder_init enabled libsrt&& require_pkg_config libsrt "srt >= 1.3.0" srt/srt.h srt_socket +enabled libsvthevc&& require_pkg_config libsvthevc SvtHevcEnc EbApi.h EbInitHandle enabled libtensorflow && require libtensorflow tensorflow/c/c_api.h TF_Version -ltensorflow enabled libtesseract && require_pkg_config libtesseract tesseract tesseract/capi.h TessBaseAPICreate enabled libtheora && require libtheora theora/theoraenc.h th_info_init -ltheoraenc -ltheoradec -logg diff --git a/libavcodec/Makefile b/libavcodec/Makefile index f37135f..8e031d3 100644 --- a/libavcodec/Makefile +++ b/libavcodec/Makefile @@ -991,6 +991,7 @@ OBJS-$(CONFIG_LIBOPUS_ENCODER)+= libopusenc.o libopus.o \ OBJS-$(CONFIG_LIBSHINE_ENCODER) += libshine.o OBJS-$(CONFIG_LIBSPEEX_DECODER) += libspeexdec.o OBJS-$(CONFIG_LIBSPEEX_ENCODER) += libspeexenc.o +OBJS-$(CONFIG_LIBSVT_HEVC_ENCODER)+= libsvt_hevc.o OBJS-$(CONFIG_LIBTHEORA_ENCODER) += libtheoraenc.o OBJS-$(CONFIG_LIBTWOLAME_ENCODER) += libtwolame.o OBJS-$(CONFIG_LIBVO_AMRWBENC_ENCODER) += libvo-amrwbenc.o diff --git a/libavcodec/allcodecs.c b/libavcodec/allcodecs.c index 6178d31..e27a7b6 100644 --- a/libavcodec/allcodecs.c +++ b/libavcodec/allcodecs.c @@ -706,6 +706,7 @@ extern AVCodec ff_librsvg_decoder; extern AVCodec ff_libshine_encoder; extern AVCodec ff_libspeex_encoder; extern AVCodec ff_libspeex_decoder; +extern AVCodec ff_libsvt_hevc_encoder; extern AVCodec ff_libtheora_encoder; extern AVCodec ff_libtwolame_encoder; extern AVCodec ff_libvo_amrwbenc_encoder; diff --git a/libavcodec/libsvt_hevc.c b/libavcodec/libsvt_hevc.c new file mode 100644 index 000..3bb4086 --- /dev/null +++ b/libavcodec/libsvt_hevc.c @@ -0,0 +1,517 @@ +/* +* Scalable Video Technology for HEVC encoder library plugin +* +* Copyright (c) 2019 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 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 details. +* +* You should have received a copy of the GNU Lesser General Public +* License along with this program; if not, write to the Free Software +* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +*/ + +#include "EbErrorCodes.h" +#include "EbTime.h" +#include "EbApi.h" + +#include "libavutil/common.h" +#include "libavutil/frame.h" +#include "libavutil/opt.h" + +#include "internal.h" +#include "avcodec.h" + +typedef enum eos_status { +EOS_NOT_REA
[FFmpeg-devel] [PATCH v12 2/2] doc: Add libsvt_hevc encoder docs
Add docs for libsvt_hevc encoder in encoders.texi and general.texi Signed-off-by: Jun Zhao Signed-off-by: Zhengxu Huang Signed-off-by: Hassene Tmar Signed-off-by: Jing Sun --- doc/encoders.texi | 141 ++ doc/general.texi | 8 2 files changed, 149 insertions(+) diff --git a/doc/encoders.texi b/doc/encoders.texi index ef12c73..a340734 100644 --- a/doc/encoders.texi +++ b/doc/encoders.texi @@ -1632,6 +1632,147 @@ Set maximum NAL size in bytes. Allow skipping frames to hit the target bitrate if set to 1. @end table +@section libsvt_hevc + +Scalable Video Technology for HEVC (SVT-HEVC) encoder wrapper. + +This encoder requires the presence of the headers and +library during configuration. You need to explicitly configure the +build with @code{--enable-libsvthevc}. The library is detected using +@command{pkg-config}. + +For more information about the library see +@url{https://github.com/intel/SVT-HEVC.git}. + +@subsection Options + +The following FFmpeg global options affect the configurations of the +libsvt_hevc encoder: + +@table @option +@item b (@emph{bitrate}) +Set the bitrate (as a number of bits per second). Default is 7M. + +@item g / @option{gop_size} +Set the GOP size. Default is -2 (unspecified). + +@item flags +cgop +Enable closed GOP. + +@item qmin (@emph{min-q}) +Default is 10 + +@item qmax (@emph{max-q}) +Default is 48 + +Set minimum/maximum quantisation values. Valid range is from 0 to 51 +(Only used when bit rate control mode @option{rc} is set to 1(vbr) mode. +It is required that qmax >= qmin). + +@item profile (@emph{profile}) +Set profile restrictions. Can assume one of the following possible values: + +@table @samp +@item main +main profile +@item main10 +main10 profile +@end table + +Default is 2 (main10). + +@item level (@emph{level}) + +@option{level} sets the value of @emph{level}. +Set level (level_idc). Default is 0 (to be determined by the encoder). + +@end table + +The encoder also has its own specific options: + +@table @option +@item aud (@emph{aud}) +Enable use of access unit delimiters when set to 1. Default is 0 (Off). + +@item hielevel +Set hierarchical levels. Can assume one of the following possible values: + +@table @samp +@item flat +none hierarchy level +@item 2level +2-level hierarchy +@item 3level +3-level hierarchy +@item 4level +4-level hierarchy +@end table + +Default is 3. + +@item la_depth +Set look-ahead depth, depending on @option{rc}: for @var{vbr}, it's recommended +to unset it and use the default value (the intra period); for @var{cqp}, better +specify the look-ahead depth. + +The range is @var{-1-256}. Default is -1 (unset and the default value to be used). + +@item preset +Set the quality vs density tradeoff point at which the encoding is to be performed. +Higher perset value, higher density and lower quality. + +The range is @var{0-12}. Default is 9. + +@item tier +Set @emph{general_tier_flag}. This may affect the level chosen for the stream +if it is not explicitly specified. Can assume one of the following possible values: + +@table @samp +@item main +main tier +@item high +high tier +@end table + +Default is 1 (main). + +@item rc +Set bit rate control mode. Can assume one of the following possible values: + +@table @samp +@item cqp +Constant QP (CQP) mode +@item vbr +Variable Bit Rate (VBR) mode +@end table + +Default is 0 (cqp). + +@item qp +Initial quantization parameter for the intra pictures used when +@option{rc} is cqp mode. The range is from @var{0-51}. Default is 32. + +@item sc_detection +Enables or disables the scene change detection algorithm. Default is 0 (disabled). + +@item tune +Set quality tuning mode. Can assume one of the following possible values: + +@table @samp +@item sq +Visually optimized mode +@item oq +PSNR / SSIM optimized mode +@item vmaf +VMAF optimized mode +@end table + +Default is 1 (oq). + +@item bl_mode +Enables or disables Random Access Prediction. Default is 0 (disabled). +@end table + @section libtheora libtheora Theora encoder wrapper. diff --git a/doc/general.texi b/doc/general.texi index d232461..11ec1c0 100644 --- a/doc/general.texi +++ b/doc/general.texi @@ -236,6 +236,14 @@ FFmpeg can use the OpenJPEG libraries for decoding/encoding J2K videos. Go to instructions. To enable using OpenJPEG in FFmpeg, pass @code{--enable-libopenjpeg} to @file{./configure}. +@section Scalable Video Technology for HEVC + +FFmpeg can make use of the SVT-HEVC library for HEVC encoding. + +Go to @url{https://github.com/intel/SVT-HEVC.git} and follow the instructions +for installing the library. Pass @code{--enable-libsvthevc} to configure to +enable it. + @section TwoLAME FFmpeg can make use of the TwoLAME library for MP2 encoding. -- 1.8.3.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffm
[FFmpeg-devel] [PATCH v12 1/2] lavc/svt_hevc: add libsvt hevc encoder wrapper
Signed-off-by: Zhengxu Huang Signed-off-by: Hassene Tmar Signed-off-by: Jun Zhao Signed-off-by: Jing Sun --- configure| 4 + libavcodec/Makefile | 1 + libavcodec/allcodecs.c | 1 + libavcodec/libsvt_hevc.c | 518 +++ libavcodec/version.h | 4 +- 5 files changed, 526 insertions(+), 2 deletions(-) create mode 100644 libavcodec/libsvt_hevc.c diff --git a/configure b/configure index d644a5b..2bc93a6 100755 --- a/configure +++ b/configure @@ -264,6 +264,7 @@ External library support: --enable-libspeexenable Speex de/encoding via libspeex [no] --enable-libsrt enable Haivision SRT protocol via libsrt [no] --enable-libssh enable SFTP protocol via libssh [no] + --enable-libsvthevc enable HEVC encoding via svt [no] --enable-libtensorflow enable TensorFlow as a DNN module backend for DNN based filters like sr [no] --enable-libtesseractenable Tesseract, needed for ocr filter [no] @@ -1782,6 +1783,7 @@ EXTERNAL_LIBRARY_LIST=" libspeex libsrt libssh +libsvthevc libtensorflow libtesseract libtheora @@ -3174,6 +3176,7 @@ libshine_encoder_select="audio_frame_queue" libspeex_decoder_deps="libspeex" libspeex_encoder_deps="libspeex" libspeex_encoder_select="audio_frame_queue" +libsvt_hevc_encoder_deps="libsvthevc" libtheora_encoder_deps="libtheora" libtwolame_encoder_deps="libtwolame" libvo_amrwbenc_encoder_deps="libvo_amrwbenc" @@ -6203,6 +6206,7 @@ enabled libsoxr && require libsoxr soxr.h soxr_create -lsoxr enabled libssh&& require_pkg_config libssh libssh libssh/sftp.h sftp_init enabled libspeex && require_pkg_config libspeex speex speex/speex.h speex_decoder_init enabled libsrt&& require_pkg_config libsrt "srt >= 1.3.0" srt/srt.h srt_socket +enabled libsvthevc&& require_pkg_config libsvthevc SvtHevcEnc EbApi.h EbInitHandle enabled libtensorflow && require libtensorflow tensorflow/c/c_api.h TF_Version -ltensorflow enabled libtesseract && require_pkg_config libtesseract tesseract tesseract/capi.h TessBaseAPICreate enabled libtheora && require libtheora theora/theoraenc.h th_info_init -ltheoraenc -ltheoradec -logg diff --git a/libavcodec/Makefile b/libavcodec/Makefile index f37135f..8e031d3 100644 --- a/libavcodec/Makefile +++ b/libavcodec/Makefile @@ -991,6 +991,7 @@ OBJS-$(CONFIG_LIBOPUS_ENCODER)+= libopusenc.o libopus.o \ OBJS-$(CONFIG_LIBSHINE_ENCODER) += libshine.o OBJS-$(CONFIG_LIBSPEEX_DECODER) += libspeexdec.o OBJS-$(CONFIG_LIBSPEEX_ENCODER) += libspeexenc.o +OBJS-$(CONFIG_LIBSVT_HEVC_ENCODER)+= libsvt_hevc.o OBJS-$(CONFIG_LIBTHEORA_ENCODER) += libtheoraenc.o OBJS-$(CONFIG_LIBTWOLAME_ENCODER) += libtwolame.o OBJS-$(CONFIG_LIBVO_AMRWBENC_ENCODER) += libvo-amrwbenc.o diff --git a/libavcodec/allcodecs.c b/libavcodec/allcodecs.c index 6178d31..e27a7b6 100644 --- a/libavcodec/allcodecs.c +++ b/libavcodec/allcodecs.c @@ -706,6 +706,7 @@ extern AVCodec ff_librsvg_decoder; extern AVCodec ff_libshine_encoder; extern AVCodec ff_libspeex_encoder; extern AVCodec ff_libspeex_decoder; +extern AVCodec ff_libsvt_hevc_encoder; extern AVCodec ff_libtheora_encoder; extern AVCodec ff_libtwolame_encoder; extern AVCodec ff_libvo_amrwbenc_encoder; diff --git a/libavcodec/libsvt_hevc.c b/libavcodec/libsvt_hevc.c new file mode 100644 index 000..1dd1659 --- /dev/null +++ b/libavcodec/libsvt_hevc.c @@ -0,0 +1,518 @@ +/* +* Scalable Video Technology for HEVC encoder library plugin +* +* Copyright (c) 2019 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 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 details. +* +* You should have received a copy of the GNU Lesser General Public +* License along with this program; if not, write to the Free Software +* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +*/ + +#include "EbErrorCodes.h" +#include "EbTime.h" +#include "EbApi.h" + +#include "libavutil/common.h" +#include "libavutil/frame.h" +#include "libavutil/opt.h" + +#include "internal.h" +#include "avcodec.h" + +typedef enum eos_status { +EOS_NOT_REA
[FFmpeg-devel] [PATCH v11 1/2] lavc/svt_hevc: add libsvt hevc encoder wrapper
Signed-off-by: Zhengxu Huang Signed-off-by: Hassene Tmar Signed-off-by: Jun Zhao Signed-off-by: Jing Sun --- configure| 4 + libavcodec/Makefile | 1 + libavcodec/allcodecs.c | 1 + libavcodec/libsvt_hevc.c | 482 +++ libavcodec/version.h | 4 +- 5 files changed, 490 insertions(+), 2 deletions(-) create mode 100644 libavcodec/libsvt_hevc.c diff --git a/configure b/configure index d644a5b..2bc93a6 100755 --- a/configure +++ b/configure @@ -264,6 +264,7 @@ External library support: --enable-libspeexenable Speex de/encoding via libspeex [no] --enable-libsrt enable Haivision SRT protocol via libsrt [no] --enable-libssh enable SFTP protocol via libssh [no] + --enable-libsvthevc enable HEVC encoding via svt [no] --enable-libtensorflow enable TensorFlow as a DNN module backend for DNN based filters like sr [no] --enable-libtesseractenable Tesseract, needed for ocr filter [no] @@ -1782,6 +1783,7 @@ EXTERNAL_LIBRARY_LIST=" libspeex libsrt libssh +libsvthevc libtensorflow libtesseract libtheora @@ -3174,6 +3176,7 @@ libshine_encoder_select="audio_frame_queue" libspeex_decoder_deps="libspeex" libspeex_encoder_deps="libspeex" libspeex_encoder_select="audio_frame_queue" +libsvt_hevc_encoder_deps="libsvthevc" libtheora_encoder_deps="libtheora" libtwolame_encoder_deps="libtwolame" libvo_amrwbenc_encoder_deps="libvo_amrwbenc" @@ -6203,6 +6206,7 @@ enabled libsoxr && require libsoxr soxr.h soxr_create -lsoxr enabled libssh&& require_pkg_config libssh libssh libssh/sftp.h sftp_init enabled libspeex && require_pkg_config libspeex speex speex/speex.h speex_decoder_init enabled libsrt&& require_pkg_config libsrt "srt >= 1.3.0" srt/srt.h srt_socket +enabled libsvthevc&& require_pkg_config libsvthevc SvtHevcEnc EbApi.h EbInitHandle enabled libtensorflow && require libtensorflow tensorflow/c/c_api.h TF_Version -ltensorflow enabled libtesseract && require_pkg_config libtesseract tesseract tesseract/capi.h TessBaseAPICreate enabled libtheora && require libtheora theora/theoraenc.h th_info_init -ltheoraenc -ltheoradec -logg diff --git a/libavcodec/Makefile b/libavcodec/Makefile index f37135f..8e031d3 100644 --- a/libavcodec/Makefile +++ b/libavcodec/Makefile @@ -991,6 +991,7 @@ OBJS-$(CONFIG_LIBOPUS_ENCODER)+= libopusenc.o libopus.o \ OBJS-$(CONFIG_LIBSHINE_ENCODER) += libshine.o OBJS-$(CONFIG_LIBSPEEX_DECODER) += libspeexdec.o OBJS-$(CONFIG_LIBSPEEX_ENCODER) += libspeexenc.o +OBJS-$(CONFIG_LIBSVT_HEVC_ENCODER)+= libsvt_hevc.o OBJS-$(CONFIG_LIBTHEORA_ENCODER) += libtheoraenc.o OBJS-$(CONFIG_LIBTWOLAME_ENCODER) += libtwolame.o OBJS-$(CONFIG_LIBVO_AMRWBENC_ENCODER) += libvo-amrwbenc.o diff --git a/libavcodec/allcodecs.c b/libavcodec/allcodecs.c index 6178d31..e27a7b6 100644 --- a/libavcodec/allcodecs.c +++ b/libavcodec/allcodecs.c @@ -706,6 +706,7 @@ extern AVCodec ff_librsvg_decoder; extern AVCodec ff_libshine_encoder; extern AVCodec ff_libspeex_encoder; extern AVCodec ff_libspeex_decoder; +extern AVCodec ff_libsvt_hevc_encoder; extern AVCodec ff_libtheora_encoder; extern AVCodec ff_libtwolame_encoder; extern AVCodec ff_libvo_amrwbenc_encoder; diff --git a/libavcodec/libsvt_hevc.c b/libavcodec/libsvt_hevc.c new file mode 100644 index 000..5534389 --- /dev/null +++ b/libavcodec/libsvt_hevc.c @@ -0,0 +1,482 @@ +/* +* Scalable Video Technology for HEVC encoder library plugin +* +* Copyright (c) 2019 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 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 details. +* +* You should have received a copy of the GNU Lesser General Public +* License along with this program; if not, write to the Free Software +* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +*/ + +#include "EbErrorCodes.h" +#include "EbTime.h" +#include "EbApi.h" + +#include "libavutil/common.h" +#include "libavutil/frame.h" +#include "libavutil/opt.h" + +#include "internal.h" +#include "avcodec.h" + +typedef enum eos_status { +EOS_NOT_RE
[FFmpeg-devel] [PATCH v11 2/2] doc: Add libsvt_hevc encoder docs
Add docs for libsvt_hevc encoder in encoders.texi and general.texi Signed-off-by: Jun Zhao Signed-off-by: Zhengxu Huang Signed-off-by: Hassene Tmar Signed-off-by: Jing Sun --- doc/encoders.texi | 141 ++ doc/general.texi | 8 2 files changed, 149 insertions(+) diff --git a/doc/encoders.texi b/doc/encoders.texi index ef12c73..a340734 100644 --- a/doc/encoders.texi +++ b/doc/encoders.texi @@ -1632,6 +1632,147 @@ Set maximum NAL size in bytes. Allow skipping frames to hit the target bitrate if set to 1. @end table +@section libsvt_hevc + +Scalable Video Technology for HEVC (SVT-HEVC) encoder wrapper. + +This encoder requires the presence of the headers and +library during configuration. You need to explicitly configure the +build with @code{--enable-libsvthevc}. The library is detected using +@command{pkg-config}. + +For more information about the library see +@url{https://github.com/intel/SVT-HEVC.git}. + +@subsection Options + +The following FFmpeg global options affect the configurations of the +libsvt_hevc encoder: + +@table @option +@item b (@emph{bitrate}) +Set the bitrate (as a number of bits per second). Default is 7M. + +@item g / @option{gop_size} +Set the GOP size. Default is -2 (unspecified). + +@item flags +cgop +Enable closed GOP. + +@item qmin (@emph{min-q}) +Default is 10 + +@item qmax (@emph{max-q}) +Default is 48 + +Set minimum/maximum quantisation values. Valid range is from 0 to 51 +(Only used when bit rate control mode @option{rc} is set to 1(vbr) mode. +It is required that qmax >= qmin). + +@item profile (@emph{profile}) +Set profile restrictions. Can assume one of the following possible values: + +@table @samp +@item main +main profile +@item main10 +main10 profile +@end table + +Default is 2 (main10). + +@item level (@emph{level}) + +@option{level} sets the value of @emph{level}. +Set level (level_idc). Default is 0 (to be determined by the encoder). + +@end table + +The encoder also has its own specific options: + +@table @option +@item aud (@emph{aud}) +Enable use of access unit delimiters when set to 1. Default is 0 (Off). + +@item hielevel +Set hierarchical levels. Can assume one of the following possible values: + +@table @samp +@item flat +none hierarchy level +@item 2level +2-level hierarchy +@item 3level +3-level hierarchy +@item 4level +4-level hierarchy +@end table + +Default is 3. + +@item la_depth +Set look-ahead depth, depending on @option{rc}: for @var{vbr}, it's recommended +to unset it and use the default value (the intra period); for @var{cqp}, better +specify the look-ahead depth. + +The range is @var{-1-256}. Default is -1 (unset and the default value to be used). + +@item preset +Set the quality vs density tradeoff point at which the encoding is to be performed. +Higher perset value, higher density and lower quality. + +The range is @var{0-12}. Default is 9. + +@item tier +Set @emph{general_tier_flag}. This may affect the level chosen for the stream +if it is not explicitly specified. Can assume one of the following possible values: + +@table @samp +@item main +main tier +@item high +high tier +@end table + +Default is 1 (main). + +@item rc +Set bit rate control mode. Can assume one of the following possible values: + +@table @samp +@item cqp +Constant QP (CQP) mode +@item vbr +Variable Bit Rate (VBR) mode +@end table + +Default is 0 (cqp). + +@item qp +Initial quantization parameter for the intra pictures used when +@option{rc} is cqp mode. The range is from @var{0-51}. Default is 32. + +@item sc_detection +Enables or disables the scene change detection algorithm. Default is 0 (disabled). + +@item tune +Set quality tuning mode. Can assume one of the following possible values: + +@table @samp +@item sq +Visually optimized mode +@item oq +PSNR / SSIM optimized mode +@item vmaf +VMAF optimized mode +@end table + +Default is 1 (oq). + +@item bl_mode +Enables or disables Random Access Prediction. Default is 0 (disabled). +@end table + @section libtheora libtheora Theora encoder wrapper. diff --git a/doc/general.texi b/doc/general.texi index d232461..11ec1c0 100644 --- a/doc/general.texi +++ b/doc/general.texi @@ -236,6 +236,14 @@ FFmpeg can use the OpenJPEG libraries for decoding/encoding J2K videos. Go to instructions. To enable using OpenJPEG in FFmpeg, pass @code{--enable-libopenjpeg} to @file{./configure}. +@section Scalable Video Technology for HEVC + +FFmpeg can make use of the SVT-HEVC library for HEVC encoding. + +Go to @url{https://github.com/intel/SVT-HEVC.git} and follow the instructions +for installing the library. Pass @code{--enable-libsvthevc} to configure to +enable it. + @section TwoLAME FFmpeg can make use of the TwoLAME library for MP2 encoding. -- 1.8.3.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffm
[FFmpeg-devel] [PATCH v10 1/2] lavc/svt_hevc: add libsvt hevc encoder wrapper
Signed-off-by: Zhengxu Huang Signed-off-by: Hassene Tmar Signed-off-by: Jun Zhao Signed-off-by: Jing Sun --- configure| 4 + libavcodec/Makefile | 1 + libavcodec/allcodecs.c | 1 + libavcodec/libsvt_hevc.c | 482 +++ 4 files changed, 488 insertions(+) create mode 100644 libavcodec/libsvt_hevc.c diff --git a/configure b/configure index 938ff10..2aabac4 100755 --- a/configure +++ b/configure @@ -264,6 +264,7 @@ External library support: --enable-libspeexenable Speex de/encoding via libspeex [no] --enable-libsrt enable Haivision SRT protocol via libsrt [no] --enable-libssh enable SFTP protocol via libssh [no] + --enable-libsvthevc enable HEVC encoding via svt [no] --enable-libtensorflow enable TensorFlow as a DNN module backend for DNN based filters like sr [no] --enable-libtesseractenable Tesseract, needed for ocr filter [no] @@ -1784,6 +1785,7 @@ EXTERNAL_LIBRARY_LIST=" libspeex libsrt libssh +libsvthevc libtensorflow libtesseract libtheora @@ -3173,6 +3175,7 @@ libshine_encoder_select="audio_frame_queue" libspeex_decoder_deps="libspeex" libspeex_encoder_deps="libspeex" libspeex_encoder_select="audio_frame_queue" +libsvt_hevc_encoder_deps="libsvthevc" libtheora_encoder_deps="libtheora" libtwolame_encoder_deps="libtwolame" libvo_amrwbenc_encoder_deps="libvo_amrwbenc" @@ -6209,6 +6212,7 @@ enabled libsoxr && require libsoxr soxr.h soxr_create -lsoxr enabled libssh&& require_pkg_config libssh libssh libssh/sftp.h sftp_init enabled libspeex && require_pkg_config libspeex speex speex/speex.h speex_decoder_init enabled libsrt&& require_pkg_config libsrt "srt >= 1.3.0" srt/srt.h srt_socket +enabled libsvthevc&& require_pkg_config libsvthevc SvtHevcEnc EbApi.h EbInitHandle enabled libtensorflow && require libtensorflow tensorflow/c/c_api.h TF_Version -ltensorflow enabled libtesseract && require_pkg_config libtesseract tesseract tesseract/capi.h TessBaseAPICreate enabled libtheora && require libtheora theora/theoraenc.h th_info_init -ltheoraenc -ltheoradec -logg diff --git a/libavcodec/Makefile b/libavcodec/Makefile index 15c43a8..c93e545 100644 --- a/libavcodec/Makefile +++ b/libavcodec/Makefile @@ -987,6 +987,7 @@ OBJS-$(CONFIG_LIBOPUS_ENCODER)+= libopusenc.o libopus.o \ OBJS-$(CONFIG_LIBSHINE_ENCODER) += libshine.o OBJS-$(CONFIG_LIBSPEEX_DECODER) += libspeexdec.o OBJS-$(CONFIG_LIBSPEEX_ENCODER) += libspeexenc.o +OBJS-$(CONFIG_LIBSVT_HEVC_ENCODER)+= libsvt_hevc.o OBJS-$(CONFIG_LIBTHEORA_ENCODER) += libtheoraenc.o OBJS-$(CONFIG_LIBTWOLAME_ENCODER) += libtwolame.o OBJS-$(CONFIG_LIBVO_AMRWBENC_ENCODER) += libvo-amrwbenc.o diff --git a/libavcodec/allcodecs.c b/libavcodec/allcodecs.c index b26aeca..e93f66f 100644 --- a/libavcodec/allcodecs.c +++ b/libavcodec/allcodecs.c @@ -703,6 +703,7 @@ extern AVCodec ff_librsvg_decoder; extern AVCodec ff_libshine_encoder; extern AVCodec ff_libspeex_encoder; extern AVCodec ff_libspeex_decoder; +extern AVCodec ff_libsvt_hevc_encoder; extern AVCodec ff_libtheora_encoder; extern AVCodec ff_libtwolame_encoder; extern AVCodec ff_libvo_amrwbenc_encoder; diff --git a/libavcodec/libsvt_hevc.c b/libavcodec/libsvt_hevc.c new file mode 100644 index 000..5534389 --- /dev/null +++ b/libavcodec/libsvt_hevc.c @@ -0,0 +1,482 @@ +/* +* Scalable Video Technology for HEVC encoder library plugin +* +* Copyright (c) 2019 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 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 details. +* +* You should have received a copy of the GNU Lesser General Public +* License along with this program; if not, write to the Free Software +* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +*/ + +#include "EbErrorCodes.h" +#include "EbTime.h" +#include "EbApi.h" + +#include "libavutil/common.h" +#include "libavutil/frame.h" +#include "libavutil/opt.h" + +#include "internal.h" +#include "avcodec.h" + +typedef enum eos_status { +EOS_NOT_REACHED = 0, +EOS_REACHED, +EOS_TOTRI
[FFmpeg-devel] [PATCH v10 1/2] lavc/svt_hevc: add libsvt hevc encoder wrapper
Signed-off-by: Zhengxu Huang Signed-off-by: Hassene Tmar Signed-off-by: Jun Zhao Signed-off-by: Jing Sun --- configure| 4 + libavcodec/Makefile | 1 + libavcodec/allcodecs.c | 1 + libavcodec/libsvt_hevc.c | 482 +++ 4 files changed, 488 insertions(+) create mode 100644 libavcodec/libsvt_hevc.c diff --git a/configure b/configure index 938ff10..2aabac4 100755 --- a/configure +++ b/configure @@ -264,6 +264,7 @@ External library support: --enable-libspeexenable Speex de/encoding via libspeex [no] --enable-libsrt enable Haivision SRT protocol via libsrt [no] --enable-libssh enable SFTP protocol via libssh [no] + --enable-libsvthevc enable HEVC encoding via svt [no] --enable-libtensorflow enable TensorFlow as a DNN module backend for DNN based filters like sr [no] --enable-libtesseractenable Tesseract, needed for ocr filter [no] @@ -1784,6 +1785,7 @@ EXTERNAL_LIBRARY_LIST=" libspeex libsrt libssh +libsvthevc libtensorflow libtesseract libtheora @@ -3173,6 +3175,7 @@ libshine_encoder_select="audio_frame_queue" libspeex_decoder_deps="libspeex" libspeex_encoder_deps="libspeex" libspeex_encoder_select="audio_frame_queue" +libsvt_hevc_encoder_deps="libsvthevc" libtheora_encoder_deps="libtheora" libtwolame_encoder_deps="libtwolame" libvo_amrwbenc_encoder_deps="libvo_amrwbenc" @@ -6209,6 +6212,7 @@ enabled libsoxr && require libsoxr soxr.h soxr_create -lsoxr enabled libssh&& require_pkg_config libssh libssh libssh/sftp.h sftp_init enabled libspeex && require_pkg_config libspeex speex speex/speex.h speex_decoder_init enabled libsrt&& require_pkg_config libsrt "srt >= 1.3.0" srt/srt.h srt_socket +enabled libsvthevc&& require_pkg_config libsvthevc SvtHevcEnc EbApi.h EbInitHandle enabled libtensorflow && require libtensorflow tensorflow/c/c_api.h TF_Version -ltensorflow enabled libtesseract && require_pkg_config libtesseract tesseract tesseract/capi.h TessBaseAPICreate enabled libtheora && require libtheora theora/theoraenc.h th_info_init -ltheoraenc -ltheoradec -logg diff --git a/libavcodec/Makefile b/libavcodec/Makefile index 15c43a8..c93e545 100644 --- a/libavcodec/Makefile +++ b/libavcodec/Makefile @@ -987,6 +987,7 @@ OBJS-$(CONFIG_LIBOPUS_ENCODER)+= libopusenc.o libopus.o \ OBJS-$(CONFIG_LIBSHINE_ENCODER) += libshine.o OBJS-$(CONFIG_LIBSPEEX_DECODER) += libspeexdec.o OBJS-$(CONFIG_LIBSPEEX_ENCODER) += libspeexenc.o +OBJS-$(CONFIG_LIBSVT_HEVC_ENCODER)+= libsvt_hevc.o OBJS-$(CONFIG_LIBTHEORA_ENCODER) += libtheoraenc.o OBJS-$(CONFIG_LIBTWOLAME_ENCODER) += libtwolame.o OBJS-$(CONFIG_LIBVO_AMRWBENC_ENCODER) += libvo-amrwbenc.o diff --git a/libavcodec/allcodecs.c b/libavcodec/allcodecs.c index b26aeca..e93f66f 100644 --- a/libavcodec/allcodecs.c +++ b/libavcodec/allcodecs.c @@ -703,6 +703,7 @@ extern AVCodec ff_librsvg_decoder; extern AVCodec ff_libshine_encoder; extern AVCodec ff_libspeex_encoder; extern AVCodec ff_libspeex_decoder; +extern AVCodec ff_libsvt_hevc_encoder; extern AVCodec ff_libtheora_encoder; extern AVCodec ff_libtwolame_encoder; extern AVCodec ff_libvo_amrwbenc_encoder; diff --git a/libavcodec/libsvt_hevc.c b/libavcodec/libsvt_hevc.c new file mode 100644 index 000..2ab5323 --- /dev/null +++ b/libavcodec/libsvt_hevc.c @@ -0,0 +1,482 @@ +/* +* Scalable Video Technology for HEVC encoder library plugin +* +* Copyright (c) 2018 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 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 details. +* +* You should have received a copy of the GNU Lesser General Public +* License along with this program; if not, write to the Free Software +* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +*/ + +#include "EbErrorCodes.h" +#include "EbTime.h" +#include "EbApi.h" + +#include "libavutil/common.h" +#include "libavutil/frame.h" +#include "libavutil/opt.h" + +#include "internal.h" +#include "avcodec.h" + +typedef enum eos_status { +EOS_NOT_REACHED = 0, +EOS_REACHED, +EOS_TOTRI
[FFmpeg-devel] [PATCH v10 1/2] lavc/svt_hevc: add libsvt hevc encoder wrapper
Signed-off-by: Zhengxu Huang Signed-off-by: Hassene Tmar Signed-off-by: Jun Zhao Signed-off-by: Jing Sun --- configure| 4 + libavcodec/Makefile | 1 + libavcodec/allcodecs.c | 1 + libavcodec/libsvt_hevc.c | 482 +++ 4 files changed, 488 insertions(+) create mode 100644 libavcodec/libsvt_hevc.c diff --git a/configure b/configure index 938ff10..2aabac4 100755 --- a/configure +++ b/configure @@ -264,6 +264,7 @@ External library support: --enable-libspeexenable Speex de/encoding via libspeex [no] --enable-libsrt enable Haivision SRT protocol via libsrt [no] --enable-libssh enable SFTP protocol via libssh [no] + --enable-libsvthevc enable HEVC encoding via svt [no] --enable-libtensorflow enable TensorFlow as a DNN module backend for DNN based filters like sr [no] --enable-libtesseractenable Tesseract, needed for ocr filter [no] @@ -1784,6 +1785,7 @@ EXTERNAL_LIBRARY_LIST=" libspeex libsrt libssh +libsvthevc libtensorflow libtesseract libtheora @@ -3173,6 +3175,7 @@ libshine_encoder_select="audio_frame_queue" libspeex_decoder_deps="libspeex" libspeex_encoder_deps="libspeex" libspeex_encoder_select="audio_frame_queue" +libsvt_hevc_encoder_deps="libsvthevc" libtheora_encoder_deps="libtheora" libtwolame_encoder_deps="libtwolame" libvo_amrwbenc_encoder_deps="libvo_amrwbenc" @@ -6209,6 +6212,7 @@ enabled libsoxr && require libsoxr soxr.h soxr_create -lsoxr enabled libssh&& require_pkg_config libssh libssh libssh/sftp.h sftp_init enabled libspeex && require_pkg_config libspeex speex speex/speex.h speex_decoder_init enabled libsrt&& require_pkg_config libsrt "srt >= 1.3.0" srt/srt.h srt_socket +enabled libsvthevc&& require_pkg_config libsvthevc SvtHevcEnc EbApi.h EbInitHandle enabled libtensorflow && require libtensorflow tensorflow/c/c_api.h TF_Version -ltensorflow enabled libtesseract && require_pkg_config libtesseract tesseract tesseract/capi.h TessBaseAPICreate enabled libtheora && require libtheora theora/theoraenc.h th_info_init -ltheoraenc -ltheoradec -logg diff --git a/libavcodec/Makefile b/libavcodec/Makefile index 15c43a8..c93e545 100644 --- a/libavcodec/Makefile +++ b/libavcodec/Makefile @@ -987,6 +987,7 @@ OBJS-$(CONFIG_LIBOPUS_ENCODER)+= libopusenc.o libopus.o \ OBJS-$(CONFIG_LIBSHINE_ENCODER) += libshine.o OBJS-$(CONFIG_LIBSPEEX_DECODER) += libspeexdec.o OBJS-$(CONFIG_LIBSPEEX_ENCODER) += libspeexenc.o +OBJS-$(CONFIG_LIBSVT_HEVC_ENCODER)+= libsvt_hevc.o OBJS-$(CONFIG_LIBTHEORA_ENCODER) += libtheoraenc.o OBJS-$(CONFIG_LIBTWOLAME_ENCODER) += libtwolame.o OBJS-$(CONFIG_LIBVO_AMRWBENC_ENCODER) += libvo-amrwbenc.o diff --git a/libavcodec/allcodecs.c b/libavcodec/allcodecs.c index b26aeca..e93f66f 100644 --- a/libavcodec/allcodecs.c +++ b/libavcodec/allcodecs.c @@ -703,6 +703,7 @@ extern AVCodec ff_librsvg_decoder; extern AVCodec ff_libshine_encoder; extern AVCodec ff_libspeex_encoder; extern AVCodec ff_libspeex_decoder; +extern AVCodec ff_libsvt_hevc_encoder; extern AVCodec ff_libtheora_encoder; extern AVCodec ff_libtwolame_encoder; extern AVCodec ff_libvo_amrwbenc_encoder; diff --git a/libavcodec/libsvt_hevc.c b/libavcodec/libsvt_hevc.c new file mode 100644 index 000..59c6758 --- /dev/null +++ b/libavcodec/libsvt_hevc.c @@ -0,0 +1,482 @@ +/* +* Scalable Video Technology for HEVC encoder library plugin +* +* Copyright (c) 2018 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 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 details. +* +* You should have received a copy of the GNU Lesser General Public +* License along with this program; if not, write to the Free Software +* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +*/ + +#include "EbErrorCodes.h" +#include "EbTime.h" +#include "EbApi.h" + +#include "libavutil/common.h" +#include "libavutil/frame.h" +#include "libavutil/opt.h" + +#include "internal.h" +#include "avcodec.h" + +typedef enum eos_status { +EOS_NOT_REACHED = 0, +EOS_REACHED, +EOS_TOTRI
[FFmpeg-devel] [PATCH v10 2/2] doc: Add libsvt_hevc encoder docs
Add docs for libsvt_hevc encoder in encoders.texi and general.texi Signed-off-by: Jun Zhao Signed-off-by: Zhengxu Huang Signed-off-by: Hassene Tmar Signed-off-by: Jing Sun --- doc/encoders.texi | 141 ++ doc/general.texi | 8 2 files changed, 149 insertions(+) diff --git a/doc/encoders.texi b/doc/encoders.texi index 94337d0..7dfb2a0 100644 --- a/doc/encoders.texi +++ b/doc/encoders.texi @@ -1569,6 +1569,147 @@ Set maximum NAL size in bytes. Allow skipping frames to hit the target bitrate if set to 1. @end table +@section libsvt_hevc + +Scalable Video Technology for HEVC (SVT-HEVC) encoder wrapper. + +This encoder requires the presence of the headers and +library during configuration. You need to explicitly configure the +build with @code{--enable-libsvthevc}. The library is detected using +@command{pkg-config}. + +For more information about the library see +@url{https://github.com/intel/SVT-HEVC.git}. + +@subsection Options + +The following FFmpeg global options affect the configurations of the +libsvt_hevc encoder: + +@table @option +@item b (@emph{bitrate}) +Set the bitrate (as a number of bits per second). Default is 7M. + +@item g / @option{gop_size} +Set the GOP size. Default is -2 (unspecified). + +@item flags +cgop +Enable closed GOP. + +@item qmin (@emph{min-q}) +Default is 10 + +@item qmax (@emph{max-q}) +Default is 48 + +Set minimum/maximum quantisation values. Valid range is from 0 to 51 +(Only used when bit rate control mode @option{rc} is set to 1(vbr) mode. +It is required that qmax >= qmin). + +@item profile (@emph{profile}) +Set profile restrictions. Can assume one of the following possible values: + +@table @samp +@item main +main profile +@item main10 +main10 profile +@end table + +Default is 2 (main10). + +@item level (@emph{level}) + +@option{level} sets the value of @emph{level}. +Set level (level_idc). Default is 0 (to be determined by the encoder). + +@end table + +The encoder also has its own specific options: + +@table @option +@item aud (@emph{aud}) +Enable use of access unit delimiters when set to 1. Default is 0 (Off). + +@item hielevel +Set hierarchical levels. Can assume one of the following possible values: + +@table @samp +@item flat +none hierarchy level +@item 2level +2-level hierarchy +@item 3level +3-level hierarchy +@item 4level +4-level hierarchy +@end table + +Default is 3. + +@item la_depth +Set look-ahead depth, depending on @option{rc}: for @var{vbr}, it's recommended +to unset it and use the default value (the intra period); for @var{cqp}, better +specify the look-ahead depth. + +The range is @var{-1-256}. Default is -1 (unset and the default value to be used). + +@item preset +Set the quality vs density tradeoff point at which the encoding is to be performed. +Higher perset value, higher density and lower quality. + +The range is @var{0-12}. Default is 9. + +@item tier +Set @emph{general_tier_flag}. This may affect the level chosen for the stream +if it is not explicitly specified. Can assume one of the following possible values: + +@table @samp +@item main +main tier +@item high +high tier +@end table + +Default is 1 (main). + +@item rc +Set bit rate control mode. Can assume one of the following possible values: + +@table @samp +@item cqp +Constant QP (CQP) mode +@item vbr +Variable Bit Rate (VBR) mode +@end table + +Default is 0 (cqp). + +@item qp +Initial quantization parameter for the intra pictures used when +@option{rc} is cqp mode. The range is from @var{0-51}. Default is 32. + +@item sc_detection +Enables or disables the scene change detection algorithm. Default is 0 (disabled). + +@item tune +Set quality tuning mode. Can assume one of the following possible values: + +@table @samp +@item sq +Visually optimized mode +@item oq +PSNR / SSIM optimized mode +@item vmaf +VMAF optimized mode +@end table + +Default is 1 (oq). + +@item bl_mode +Enables or disables Random Access Prediction. Default is 0 (disabled). +@end table + @section libtheora libtheora Theora encoder wrapper. diff --git a/doc/general.texi b/doc/general.texi index fe94c40..f90e188 100644 --- a/doc/general.texi +++ b/doc/general.texi @@ -234,6 +234,14 @@ FFmpeg can use the OpenJPEG libraries for decoding/encoding J2K videos. Go to instructions. To enable using OpenJPEG in FFmpeg, pass @code{--enable-libopenjpeg} to @file{./configure}. +@section Scalable Video Technology for HEVC + +FFmpeg can make use of the SVT-HEVC library for HEVC encoding. + +Go to @url{https://github.com/intel/SVT-HEVC.git} and follow the instructions +for installing the library. Pass @code{--enable-libsvthevc} to configure to +enable it. + @section TwoLAME FFmpeg can make use of the TwoLAME library for MP2 encoding. -- 1.8.3.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffm
[FFmpeg-devel] [PATCH v10 1/2] lavc/svt_hevc: add libsvt hevc encoder wrapper
Signed-off-by: Zhengxu Huang Signed-off-by: Hassene Tmar Signed-off-by: Jun Zhao Signed-off-by: Jing Sun --- configure| 4 + libavcodec/Makefile | 1 + libavcodec/allcodecs.c | 1 + libavcodec/libsvt_hevc.c | 500 +++ 4 files changed, 506 insertions(+) create mode 100644 libavcodec/libsvt_hevc.c diff --git a/configure b/configure index 938ff10..2aabac4 100755 --- a/configure +++ b/configure @@ -264,6 +264,7 @@ External library support: --enable-libspeexenable Speex de/encoding via libspeex [no] --enable-libsrt enable Haivision SRT protocol via libsrt [no] --enable-libssh enable SFTP protocol via libssh [no] + --enable-libsvthevc enable HEVC encoding via svt [no] --enable-libtensorflow enable TensorFlow as a DNN module backend for DNN based filters like sr [no] --enable-libtesseractenable Tesseract, needed for ocr filter [no] @@ -1784,6 +1785,7 @@ EXTERNAL_LIBRARY_LIST=" libspeex libsrt libssh +libsvthevc libtensorflow libtesseract libtheora @@ -3173,6 +3175,7 @@ libshine_encoder_select="audio_frame_queue" libspeex_decoder_deps="libspeex" libspeex_encoder_deps="libspeex" libspeex_encoder_select="audio_frame_queue" +libsvt_hevc_encoder_deps="libsvthevc" libtheora_encoder_deps="libtheora" libtwolame_encoder_deps="libtwolame" libvo_amrwbenc_encoder_deps="libvo_amrwbenc" @@ -6209,6 +6212,7 @@ enabled libsoxr && require libsoxr soxr.h soxr_create -lsoxr enabled libssh&& require_pkg_config libssh libssh libssh/sftp.h sftp_init enabled libspeex && require_pkg_config libspeex speex speex/speex.h speex_decoder_init enabled libsrt&& require_pkg_config libsrt "srt >= 1.3.0" srt/srt.h srt_socket +enabled libsvthevc&& require_pkg_config libsvthevc SvtHevcEnc EbApi.h EbInitHandle enabled libtensorflow && require libtensorflow tensorflow/c/c_api.h TF_Version -ltensorflow enabled libtesseract && require_pkg_config libtesseract tesseract tesseract/capi.h TessBaseAPICreate enabled libtheora && require libtheora theora/theoraenc.h th_info_init -ltheoraenc -ltheoradec -logg diff --git a/libavcodec/Makefile b/libavcodec/Makefile index 15c43a8..c93e545 100644 --- a/libavcodec/Makefile +++ b/libavcodec/Makefile @@ -987,6 +987,7 @@ OBJS-$(CONFIG_LIBOPUS_ENCODER)+= libopusenc.o libopus.o \ OBJS-$(CONFIG_LIBSHINE_ENCODER) += libshine.o OBJS-$(CONFIG_LIBSPEEX_DECODER) += libspeexdec.o OBJS-$(CONFIG_LIBSPEEX_ENCODER) += libspeexenc.o +OBJS-$(CONFIG_LIBSVT_HEVC_ENCODER)+= libsvt_hevc.o OBJS-$(CONFIG_LIBTHEORA_ENCODER) += libtheoraenc.o OBJS-$(CONFIG_LIBTWOLAME_ENCODER) += libtwolame.o OBJS-$(CONFIG_LIBVO_AMRWBENC_ENCODER) += libvo-amrwbenc.o diff --git a/libavcodec/allcodecs.c b/libavcodec/allcodecs.c index b26aeca..e93f66f 100644 --- a/libavcodec/allcodecs.c +++ b/libavcodec/allcodecs.c @@ -703,6 +703,7 @@ extern AVCodec ff_librsvg_decoder; extern AVCodec ff_libshine_encoder; extern AVCodec ff_libspeex_encoder; extern AVCodec ff_libspeex_decoder; +extern AVCodec ff_libsvt_hevc_encoder; extern AVCodec ff_libtheora_encoder; extern AVCodec ff_libtwolame_encoder; extern AVCodec ff_libvo_amrwbenc_encoder; diff --git a/libavcodec/libsvt_hevc.c b/libavcodec/libsvt_hevc.c new file mode 100644 index 000..4ef06a8 --- /dev/null +++ b/libavcodec/libsvt_hevc.c @@ -0,0 +1,500 @@ +/* +* Scalable Video Technology for HEVC encoder library plugin +* +* Copyright (c) 2018 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 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 details. +* +* You should have received a copy of the GNU Lesser General Public +* License along with this program; if not, write to the Free Software +* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +*/ + +#include "EbErrorCodes.h" +#include "EbTime.h" +#include "EbApi.h" + +#include "libavutil/common.h" +#include "libavutil/frame.h" +#include "libavutil/opt.h" + +#include "internal.h" +#include "avcodec.h" + +typedef enum eos_status { +EOS_NOT_REACHED = 0, +EOS_REACHED, +EOS_TOTRIGGER +}EO
[FFmpeg-devel] [PATCH v9 1/2] lavc/svt_hevc: add libsvt hevc encoder wrapper
Signed-off-by: Zhengxu Huang Signed-off-by: Hassene Tmar Signed-off-by: Jun Zhao Signed-off-by: Jing Sun --- configure| 4 + libavcodec/Makefile | 1 + libavcodec/allcodecs.c | 1 + libavcodec/libsvt_hevc.c | 502 +++ 4 files changed, 508 insertions(+) create mode 100644 libavcodec/libsvt_hevc.c diff --git a/configure b/configure index 938ff10..2aabac4 100755 --- a/configure +++ b/configure @@ -264,6 +264,7 @@ External library support: --enable-libspeexenable Speex de/encoding via libspeex [no] --enable-libsrt enable Haivision SRT protocol via libsrt [no] --enable-libssh enable SFTP protocol via libssh [no] + --enable-libsvthevc enable HEVC encoding via svt [no] --enable-libtensorflow enable TensorFlow as a DNN module backend for DNN based filters like sr [no] --enable-libtesseractenable Tesseract, needed for ocr filter [no] @@ -1784,6 +1785,7 @@ EXTERNAL_LIBRARY_LIST=" libspeex libsrt libssh +libsvthevc libtensorflow libtesseract libtheora @@ -3173,6 +3175,7 @@ libshine_encoder_select="audio_frame_queue" libspeex_decoder_deps="libspeex" libspeex_encoder_deps="libspeex" libspeex_encoder_select="audio_frame_queue" +libsvt_hevc_encoder_deps="libsvthevc" libtheora_encoder_deps="libtheora" libtwolame_encoder_deps="libtwolame" libvo_amrwbenc_encoder_deps="libvo_amrwbenc" @@ -6209,6 +6212,7 @@ enabled libsoxr && require libsoxr soxr.h soxr_create -lsoxr enabled libssh&& require_pkg_config libssh libssh libssh/sftp.h sftp_init enabled libspeex && require_pkg_config libspeex speex speex/speex.h speex_decoder_init enabled libsrt&& require_pkg_config libsrt "srt >= 1.3.0" srt/srt.h srt_socket +enabled libsvthevc&& require_pkg_config libsvthevc SvtHevcEnc EbApi.h EbInitHandle enabled libtensorflow && require libtensorflow tensorflow/c/c_api.h TF_Version -ltensorflow enabled libtesseract && require_pkg_config libtesseract tesseract tesseract/capi.h TessBaseAPICreate enabled libtheora && require libtheora theora/theoraenc.h th_info_init -ltheoraenc -ltheoradec -logg diff --git a/libavcodec/Makefile b/libavcodec/Makefile index 15c43a8..c93e545 100644 --- a/libavcodec/Makefile +++ b/libavcodec/Makefile @@ -987,6 +987,7 @@ OBJS-$(CONFIG_LIBOPUS_ENCODER)+= libopusenc.o libopus.o \ OBJS-$(CONFIG_LIBSHINE_ENCODER) += libshine.o OBJS-$(CONFIG_LIBSPEEX_DECODER) += libspeexdec.o OBJS-$(CONFIG_LIBSPEEX_ENCODER) += libspeexenc.o +OBJS-$(CONFIG_LIBSVT_HEVC_ENCODER)+= libsvt_hevc.o OBJS-$(CONFIG_LIBTHEORA_ENCODER) += libtheoraenc.o OBJS-$(CONFIG_LIBTWOLAME_ENCODER) += libtwolame.o OBJS-$(CONFIG_LIBVO_AMRWBENC_ENCODER) += libvo-amrwbenc.o diff --git a/libavcodec/allcodecs.c b/libavcodec/allcodecs.c index b26aeca..e93f66f 100644 --- a/libavcodec/allcodecs.c +++ b/libavcodec/allcodecs.c @@ -703,6 +703,7 @@ extern AVCodec ff_librsvg_decoder; extern AVCodec ff_libshine_encoder; extern AVCodec ff_libspeex_encoder; extern AVCodec ff_libspeex_decoder; +extern AVCodec ff_libsvt_hevc_encoder; extern AVCodec ff_libtheora_encoder; extern AVCodec ff_libtwolame_encoder; extern AVCodec ff_libvo_amrwbenc_encoder; diff --git a/libavcodec/libsvt_hevc.c b/libavcodec/libsvt_hevc.c new file mode 100644 index 000..ca6e37b --- /dev/null +++ b/libavcodec/libsvt_hevc.c @@ -0,0 +1,502 @@ +/* +* Scalable Video Technology for HEVC encoder library plugin +* +* Copyright (c) 2018 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 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 details. +* +* You should have received a copy of the GNU Lesser General Public +* License along with this program; if not, write to the Free Software +* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +*/ + +#include "EbErrorCodes.h" +#include "EbTime.h" +#include "EbApi.h" + +#include "libavutil/common.h" +#include "libavutil/frame.h" +#include "libavutil/opt.h" + +#include "internal.h" +#include "avcodec.h" + +typedef enum eos_status { +EOS_NOT_REACHED = 0, +EOS_REACHED, +EOS_TOTRIGGER +}EO
[FFmpeg-devel] [PATCH v9 1/2] lavc/svt_hevc: add libsvt hevc encoder wrapper
Signed-off-by: Zhengxu Huang Signed-off-by: Hassene Tmar Signed-off-by: Jun Zhao Signed-off-by: Jing Sun --- configure| 4 + libavcodec/Makefile | 1 + libavcodec/allcodecs.c | 1 + libavcodec/libsvt_hevc.c | 501 +++ 4 files changed, 507 insertions(+) create mode 100644 libavcodec/libsvt_hevc.c diff --git a/configure b/configure index 938ff10..2aabac4 100755 --- a/configure +++ b/configure @@ -264,6 +264,7 @@ External library support: --enable-libspeexenable Speex de/encoding via libspeex [no] --enable-libsrt enable Haivision SRT protocol via libsrt [no] --enable-libssh enable SFTP protocol via libssh [no] + --enable-libsvthevc enable HEVC encoding via svt [no] --enable-libtensorflow enable TensorFlow as a DNN module backend for DNN based filters like sr [no] --enable-libtesseractenable Tesseract, needed for ocr filter [no] @@ -1784,6 +1785,7 @@ EXTERNAL_LIBRARY_LIST=" libspeex libsrt libssh +libsvthevc libtensorflow libtesseract libtheora @@ -3173,6 +3175,7 @@ libshine_encoder_select="audio_frame_queue" libspeex_decoder_deps="libspeex" libspeex_encoder_deps="libspeex" libspeex_encoder_select="audio_frame_queue" +libsvt_hevc_encoder_deps="libsvthevc" libtheora_encoder_deps="libtheora" libtwolame_encoder_deps="libtwolame" libvo_amrwbenc_encoder_deps="libvo_amrwbenc" @@ -6209,6 +6212,7 @@ enabled libsoxr && require libsoxr soxr.h soxr_create -lsoxr enabled libssh&& require_pkg_config libssh libssh libssh/sftp.h sftp_init enabled libspeex && require_pkg_config libspeex speex speex/speex.h speex_decoder_init enabled libsrt&& require_pkg_config libsrt "srt >= 1.3.0" srt/srt.h srt_socket +enabled libsvthevc&& require_pkg_config libsvthevc SvtHevcEnc EbApi.h EbInitHandle enabled libtensorflow && require libtensorflow tensorflow/c/c_api.h TF_Version -ltensorflow enabled libtesseract && require_pkg_config libtesseract tesseract tesseract/capi.h TessBaseAPICreate enabled libtheora && require libtheora theora/theoraenc.h th_info_init -ltheoraenc -ltheoradec -logg diff --git a/libavcodec/Makefile b/libavcodec/Makefile index 15c43a8..c93e545 100644 --- a/libavcodec/Makefile +++ b/libavcodec/Makefile @@ -987,6 +987,7 @@ OBJS-$(CONFIG_LIBOPUS_ENCODER)+= libopusenc.o libopus.o \ OBJS-$(CONFIG_LIBSHINE_ENCODER) += libshine.o OBJS-$(CONFIG_LIBSPEEX_DECODER) += libspeexdec.o OBJS-$(CONFIG_LIBSPEEX_ENCODER) += libspeexenc.o +OBJS-$(CONFIG_LIBSVT_HEVC_ENCODER)+= libsvt_hevc.o OBJS-$(CONFIG_LIBTHEORA_ENCODER) += libtheoraenc.o OBJS-$(CONFIG_LIBTWOLAME_ENCODER) += libtwolame.o OBJS-$(CONFIG_LIBVO_AMRWBENC_ENCODER) += libvo-amrwbenc.o diff --git a/libavcodec/allcodecs.c b/libavcodec/allcodecs.c index b26aeca..e93f66f 100644 --- a/libavcodec/allcodecs.c +++ b/libavcodec/allcodecs.c @@ -703,6 +703,7 @@ extern AVCodec ff_librsvg_decoder; extern AVCodec ff_libshine_encoder; extern AVCodec ff_libspeex_encoder; extern AVCodec ff_libspeex_decoder; +extern AVCodec ff_libsvt_hevc_encoder; extern AVCodec ff_libtheora_encoder; extern AVCodec ff_libtwolame_encoder; extern AVCodec ff_libvo_amrwbenc_encoder; diff --git a/libavcodec/libsvt_hevc.c b/libavcodec/libsvt_hevc.c new file mode 100644 index 000..819979a --- /dev/null +++ b/libavcodec/libsvt_hevc.c @@ -0,0 +1,501 @@ +/* +* Scalable Video Technology for HEVC encoder library plugin +* +* Copyright (c) 2018 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 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 details. +* +* You should have received a copy of the GNU Lesser General Public +* License along with this program; if not, write to the Free Software +* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +*/ + +#include "EbErrorCodes.h" +#include "EbTime.h" +#include "EbApi.h" + +#include "libavutil/common.h" +#include "libavutil/frame.h" +#include "libavutil/opt.h" + +#include "internal.h" +#include "avcodec.h" + +typedef enum eos_status { +EOS_NOT_REACHED = 0, +EOS_REACHED, +EOS_TOTRIGGER +}EO
[FFmpeg-devel] [PATCH v9 1/2] lavc/svt_hevc: add libsvt hevc encoder wrapper
Signed-off-by: Zhengxu Huang Signed-off-by: Hassene Tmar Signed-off-by: Jun Zhao Signed-off-by: Jing Sun --- configure| 4 + libavcodec/Makefile | 1 + libavcodec/allcodecs.c | 1 + libavcodec/libsvt_hevc.c | 505 +++ 4 files changed, 511 insertions(+) create mode 100644 libavcodec/libsvt_hevc.c diff --git a/configure b/configure index 938ff10..2aabac4 100755 --- a/configure +++ b/configure @@ -264,6 +264,7 @@ External library support: --enable-libspeexenable Speex de/encoding via libspeex [no] --enable-libsrt enable Haivision SRT protocol via libsrt [no] --enable-libssh enable SFTP protocol via libssh [no] + --enable-libsvthevc enable HEVC encoding via svt [no] --enable-libtensorflow enable TensorFlow as a DNN module backend for DNN based filters like sr [no] --enable-libtesseractenable Tesseract, needed for ocr filter [no] @@ -1784,6 +1785,7 @@ EXTERNAL_LIBRARY_LIST=" libspeex libsrt libssh +libsvthevc libtensorflow libtesseract libtheora @@ -3173,6 +3175,7 @@ libshine_encoder_select="audio_frame_queue" libspeex_decoder_deps="libspeex" libspeex_encoder_deps="libspeex" libspeex_encoder_select="audio_frame_queue" +libsvt_hevc_encoder_deps="libsvthevc" libtheora_encoder_deps="libtheora" libtwolame_encoder_deps="libtwolame" libvo_amrwbenc_encoder_deps="libvo_amrwbenc" @@ -6209,6 +6212,7 @@ enabled libsoxr && require libsoxr soxr.h soxr_create -lsoxr enabled libssh&& require_pkg_config libssh libssh libssh/sftp.h sftp_init enabled libspeex && require_pkg_config libspeex speex speex/speex.h speex_decoder_init enabled libsrt&& require_pkg_config libsrt "srt >= 1.3.0" srt/srt.h srt_socket +enabled libsvthevc&& require_pkg_config libsvthevc SvtHevcEnc EbApi.h EbInitHandle enabled libtensorflow && require libtensorflow tensorflow/c/c_api.h TF_Version -ltensorflow enabled libtesseract && require_pkg_config libtesseract tesseract tesseract/capi.h TessBaseAPICreate enabled libtheora && require libtheora theora/theoraenc.h th_info_init -ltheoraenc -ltheoradec -logg diff --git a/libavcodec/Makefile b/libavcodec/Makefile index 15c43a8..c93e545 100644 --- a/libavcodec/Makefile +++ b/libavcodec/Makefile @@ -987,6 +987,7 @@ OBJS-$(CONFIG_LIBOPUS_ENCODER)+= libopusenc.o libopus.o \ OBJS-$(CONFIG_LIBSHINE_ENCODER) += libshine.o OBJS-$(CONFIG_LIBSPEEX_DECODER) += libspeexdec.o OBJS-$(CONFIG_LIBSPEEX_ENCODER) += libspeexenc.o +OBJS-$(CONFIG_LIBSVT_HEVC_ENCODER)+= libsvt_hevc.o OBJS-$(CONFIG_LIBTHEORA_ENCODER) += libtheoraenc.o OBJS-$(CONFIG_LIBTWOLAME_ENCODER) += libtwolame.o OBJS-$(CONFIG_LIBVO_AMRWBENC_ENCODER) += libvo-amrwbenc.o diff --git a/libavcodec/allcodecs.c b/libavcodec/allcodecs.c index b26aeca..e93f66f 100644 --- a/libavcodec/allcodecs.c +++ b/libavcodec/allcodecs.c @@ -703,6 +703,7 @@ extern AVCodec ff_librsvg_decoder; extern AVCodec ff_libshine_encoder; extern AVCodec ff_libspeex_encoder; extern AVCodec ff_libspeex_decoder; +extern AVCodec ff_libsvt_hevc_encoder; extern AVCodec ff_libtheora_encoder; extern AVCodec ff_libtwolame_encoder; extern AVCodec ff_libvo_amrwbenc_encoder; diff --git a/libavcodec/libsvt_hevc.c b/libavcodec/libsvt_hevc.c new file mode 100644 index 000..9c958f5 --- /dev/null +++ b/libavcodec/libsvt_hevc.c @@ -0,0 +1,505 @@ +/* +* Scalable Video Technology for HEVC encoder library plugin +* +* Copyright (c) 2018 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 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 details. +* +* You should have received a copy of the GNU Lesser General Public +* License along with this program; if not, write to the Free Software +* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +*/ + +#include "EbErrorCodes.h" +#include "EbTime.h" +#include "EbApi.h" + +#include "libavutil/common.h" +#include "libavutil/frame.h" +#include "libavutil/opt.h" + +#include "internal.h" +#include "avcodec.h" + +typedef enum eos_status { +EOS_NOT_REACHED = 0, +EOS_REACHED, +EOS_TOTRIGGER +}EO
[FFmpeg-devel] [PATCH v9 2/2] doc: Add libsvt_hevc encoder docs
Add docs for libsvt_hevc encoder in encoders.texi and general.texi Signed-off-by: Jun Zhao Signed-off-by: Zhengxu Huang Signed-off-by: Hassene Tmar Signed-off-by: Jing Sun --- doc/encoders.texi | 147 ++ doc/general.texi | 8 +++ 2 files changed, 155 insertions(+) diff --git a/doc/encoders.texi b/doc/encoders.texi index 94337d0..c85950c 100644 --- a/doc/encoders.texi +++ b/doc/encoders.texi @@ -1569,6 +1569,153 @@ Set maximum NAL size in bytes. Allow skipping frames to hit the target bitrate if set to 1. @end table +@section libsvt_hevc + +Scalable Video Technology for HEVC (SVT-HEVC) encoder wrapper. + +This encoder requires the presence of the headers and +library during configuration. You need to explicitly configure the +build with @code{--enable-libsvthevc}. The library is detected using +@command{pkg-config}. + +For more information about the library see +@url{https://github.com/intel/SVT-HEVC.git}. + +@subsection Options + +The following FFmpeg global options affect the configurations of the +libsvt_hevc encoder. + +@table @option +@item b (@emph{bitrate}) +Set the bitrate (as a number of bits per second). Default is 7M. + +@item g / @option{gop_size} +Set the GOP size. Default is -2 (unspecified). + +@item flags +cgop +Enable closed GOP. + +@item qmin (@emph{min-q}) +Default is 10 + +@item qmax (@emph{max-q}) +Default is 48 + +Set minimum/maximum quantisation values. Valid range is from 0 to 51 +(Only used when bit rate control mode @option{rc} is set to 1(vbr) mode. +It is required that qmax >= qmin). + +@item profile (@emph{profile}) +Set profile restrictions. Can assume one of the following possible values: + +@table @samp +@item main +main profile +@item main10 +main10 profile +@end table + +Default is 2 (main10). + +@item level (@emph{level}) + +@option{level} sets the value of @emph{level}. +Set level (level_idc). Default is 0 (to be determined by the encoder). + +The encoder also has its own specific options: + +@table @option +@item vui +Enables or disables the vui structure in the HEVC elementary +bitstream. 0 = Off, 1 = On. Default is 0 (Off). + +@item aud (@emph{aud}) +Enable use of access unit delimiters when set to 1. Default is 0 (Off). + +@item hielevel +Set hierarchical levels. Can assume one of the following possible values: + +@table @samp +@item flat +none hierarchy level +@item 2level +2-level hierarchy +@item 3level +3-level hierarchy +@item 4level +4-level hierarchy +@end table + +Default is 3. + +@item la_depth +Set look-ahead depth, depending on @option{rc}: for @var{vbr}, it's recommended +to unset it and use the default value (the intra period); for @var{cqp}, better +specify the look-ahead depth. + +The range is @var{-1-256}. Default is -1 (unset and the default value to be used). + +@item preset +Set the quality vs density tradeoff point at which the encoding is to be performed. +Higher perset value, higher density and lower quality. + +The range is @var{0-12}. Default is 9. + +@item tier +Set @emph{general_tier_flag}. This may affect the level chosen for the stream +if it is not explicitly specified. Can assume one of the following possible values: + +@table @samp +@item main +main tier +@item high +high tier +@end table + +Default is 1 (main). + +@item rc +Set bit rate control mode. Can assume one of the following possible values: + +@table @samp +@item cqp +Constant QP (CQP) mode +@item vbr +Variable Bit Rate (VBR) mode +@end table + +Default is 0 (cqp). + +@item qp +Initial quantization parameter for the intra pictures used when +@option{rc} is cqp mode. The range is from @var{0-51}. Default is 32. + +@item sc_detection +Enables or disables the scene change detection algorithm. Default is 0 (disabled). + +@item tune +Set quality tuning mode. Can assume one of the following possible values: + +@table @samp +@item sq +Visually optimized mode +@item oq +PSNR / SSIM optimized mode +@item vmaf +VMAF optimized mode +@end table + +Default is 1 (oq). + +@item bl_mode +Enables or disables Random Access Prediction. Default is 0 (disabled). +@end table + +@item hdr +High dynamic range input. Default is 0 (disabled). +@end table + @section libtheora libtheora Theora encoder wrapper. diff --git a/doc/general.texi b/doc/general.texi index fe94c40..f90e188 100644 --- a/doc/general.texi +++ b/doc/general.texi @@ -234,6 +234,14 @@ FFmpeg can use the OpenJPEG libraries for decoding/encoding J2K videos. Go to instructions. To enable using OpenJPEG in FFmpeg, pass @code{--enable-libopenjpeg} to @file{./configure}. +@section Scalable Video Technology for HEVC + +FFmpeg can make use of the SVT-HEVC library for HEVC encoding. + +Go to @url{https://github.com/intel/SVT-HEVC.git} and follow the instructions +for installing the library. Pass @code{--enable-libsvthevc} to configure to +enable it. + @section TwoLAME FFmpeg can make use of the TwoLAME library for MP2 encoding. -- 1.8.
[FFmpeg-devel] [PATCH v8 1/2] lavc/svt_hevc: add libsvt hevc encoder wrapper
Signed-off-by: Zhengxu Huang Signed-off-by: Hassene Tmar Signed-off-by: Jun Zhao Signed-off-by: Jing Sun --- configure| 4 + libavcodec/Makefile | 1 + libavcodec/allcodecs.c | 1 + libavcodec/libsvt_hevc.c | 505 +++ 4 files changed, 511 insertions(+) create mode 100644 libavcodec/libsvt_hevc.c diff --git a/configure b/configure index dcead3a..2884ad7 100755 --- a/configure +++ b/configure @@ -264,6 +264,7 @@ External library support: --enable-libspeexenable Speex de/encoding via libspeex [no] --enable-libsrt enable Haivision SRT protocol via libsrt [no] --enable-libssh enable SFTP protocol via libssh [no] + --enable-libsvthevc enable HEVC encoding via svt [no] --enable-libtensorflow enable TensorFlow as a DNN module backend for DNN based filters like sr [no] --enable-libtesseractenable Tesseract, needed for ocr filter [no] @@ -1784,6 +1785,7 @@ EXTERNAL_LIBRARY_LIST=" libspeex libsrt libssh +libsvthevc libtensorflow libtesseract libtheora @@ -3173,6 +3175,7 @@ libshine_encoder_select="audio_frame_queue" libspeex_decoder_deps="libspeex" libspeex_encoder_deps="libspeex" libspeex_encoder_select="audio_frame_queue" +libsvt_hevc_encoder_deps="libsvthevc" libtheora_encoder_deps="libtheora" libtwolame_encoder_deps="libtwolame" libvo_amrwbenc_encoder_deps="libvo_amrwbenc" @@ -6209,6 +6212,7 @@ enabled libsoxr && require libsoxr soxr.h soxr_create -lsoxr enabled libssh&& require_pkg_config libssh libssh libssh/sftp.h sftp_init enabled libspeex && require_pkg_config libspeex speex speex/speex.h speex_decoder_init enabled libsrt&& require_pkg_config libsrt "srt >= 1.3.0" srt/srt.h srt_socket +enabled libsvthevc&& require_pkg_config libsvthevc SvtHevcEnc EbApi.h EbInitHandle enabled libtensorflow && require libtensorflow tensorflow/c/c_api.h TF_Version -ltensorflow enabled libtesseract && require_pkg_config libtesseract tesseract tesseract/capi.h TessBaseAPICreate enabled libtheora && require libtheora theora/theoraenc.h th_info_init -ltheoraenc -ltheoradec -logg diff --git a/libavcodec/Makefile b/libavcodec/Makefile index 15c43a8..c93e545 100644 --- a/libavcodec/Makefile +++ b/libavcodec/Makefile @@ -987,6 +987,7 @@ OBJS-$(CONFIG_LIBOPUS_ENCODER)+= libopusenc.o libopus.o \ OBJS-$(CONFIG_LIBSHINE_ENCODER) += libshine.o OBJS-$(CONFIG_LIBSPEEX_DECODER) += libspeexdec.o OBJS-$(CONFIG_LIBSPEEX_ENCODER) += libspeexenc.o +OBJS-$(CONFIG_LIBSVT_HEVC_ENCODER)+= libsvt_hevc.o OBJS-$(CONFIG_LIBTHEORA_ENCODER) += libtheoraenc.o OBJS-$(CONFIG_LIBTWOLAME_ENCODER) += libtwolame.o OBJS-$(CONFIG_LIBVO_AMRWBENC_ENCODER) += libvo-amrwbenc.o diff --git a/libavcodec/allcodecs.c b/libavcodec/allcodecs.c index b26aeca..e93f66f 100644 --- a/libavcodec/allcodecs.c +++ b/libavcodec/allcodecs.c @@ -703,6 +703,7 @@ extern AVCodec ff_librsvg_decoder; extern AVCodec ff_libshine_encoder; extern AVCodec ff_libspeex_encoder; extern AVCodec ff_libspeex_decoder; +extern AVCodec ff_libsvt_hevc_encoder; extern AVCodec ff_libtheora_encoder; extern AVCodec ff_libtwolame_encoder; extern AVCodec ff_libvo_amrwbenc_encoder; diff --git a/libavcodec/libsvt_hevc.c b/libavcodec/libsvt_hevc.c new file mode 100644 index 000..5bed83e --- /dev/null +++ b/libavcodec/libsvt_hevc.c @@ -0,0 +1,505 @@ +/* +* Scalable Video Technology for HEVC encoder library plugin +* +* Copyright (c) 2018 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 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 details. +* +* You should have received a copy of the GNU Lesser General Public +* License along with this program; if not, write to the Free Software +* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +*/ + +#include "EbErrorCodes.h" +#include "EbTime.h" +#include "EbApi.h" + +#include "libavutil/common.h" +#include "libavutil/frame.h" +#include "libavutil/opt.h" + +#include "internal.h" +#include "avcodec.h" + +typedef enum eos_status { +EOS_NOT_REACHED = 0, +EOS_REACHED, +EOS_TOTRIGGER +}EO
[FFmpeg-devel] [PATCH v8 1/2] lavc/svt_hevc: add libsvt hevc encoder wrapper
Signed-off-by: Zhengxu Huang Signed-off-by: Hassene Tmar Signed-off-by: Jun Zhao Signed-off-by: Jing Sun --- configure| 4 + libavcodec/Makefile | 1 + libavcodec/allcodecs.c | 1 + libavcodec/libsvt_hevc.c | 505 +++ 4 files changed, 511 insertions(+) create mode 100644 libavcodec/libsvt_hevc.c diff --git a/configure b/configure index dcead3a..36bc8c1 100755 --- a/configure +++ b/configure @@ -264,6 +264,7 @@ External library support: --enable-libspeexenable Speex de/encoding via libspeex [no] --enable-libsrt enable Haivision SRT protocol via libsrt [no] --enable-libssh enable SFTP protocol via libssh [no] + --enable-libsvthevc enable HEVC encoding via svt [no] --enable-libtensorflow enable TensorFlow as a DNN module backend for DNN based filters like sr [no] --enable-libtesseractenable Tesseract, needed for ocr filter [no] @@ -1784,6 +1785,7 @@ EXTERNAL_LIBRARY_LIST=" libspeex libsrt libssh +libsvthevc libtensorflow libtesseract libtheora @@ -3173,6 +3175,7 @@ libshine_encoder_select="audio_frame_queue" libspeex_decoder_deps="libspeex" libspeex_encoder_deps="libspeex" libspeex_encoder_select="audio_frame_queue" +libsvt_hevc_encoder_deps="libsvthevc" libtheora_encoder_deps="libtheora" libtwolame_encoder_deps="libtwolame" libvo_amrwbenc_encoder_deps="libvo_amrwbenc" @@ -6209,6 +6212,7 @@ enabled libsoxr && require libsoxr soxr.h soxr_create -lsoxr enabled libssh&& require_pkg_config libssh libssh libssh/sftp.h sftp_init enabled libspeex && require_pkg_config libspeex speex speex/speex.h speex_decoder_init enabled libsrt&& require_pkg_config libsrt "srt >= 1.3.0" srt/srt.h srt_socket +enabled libsvthevc&& require_pkg_config libsvthevc SvtHevcEnc svt-hevc/EbApi.h EbInitHandle enabled libtensorflow && require libtensorflow tensorflow/c/c_api.h TF_Version -ltensorflow enabled libtesseract && require_pkg_config libtesseract tesseract tesseract/capi.h TessBaseAPICreate enabled libtheora && require libtheora theora/theoraenc.h th_info_init -ltheoraenc -ltheoradec -logg diff --git a/libavcodec/Makefile b/libavcodec/Makefile index 15c43a8..c93e545 100644 --- a/libavcodec/Makefile +++ b/libavcodec/Makefile @@ -987,6 +987,7 @@ OBJS-$(CONFIG_LIBOPUS_ENCODER)+= libopusenc.o libopus.o \ OBJS-$(CONFIG_LIBSHINE_ENCODER) += libshine.o OBJS-$(CONFIG_LIBSPEEX_DECODER) += libspeexdec.o OBJS-$(CONFIG_LIBSPEEX_ENCODER) += libspeexenc.o +OBJS-$(CONFIG_LIBSVT_HEVC_ENCODER)+= libsvt_hevc.o OBJS-$(CONFIG_LIBTHEORA_ENCODER) += libtheoraenc.o OBJS-$(CONFIG_LIBTWOLAME_ENCODER) += libtwolame.o OBJS-$(CONFIG_LIBVO_AMRWBENC_ENCODER) += libvo-amrwbenc.o diff --git a/libavcodec/allcodecs.c b/libavcodec/allcodecs.c index b26aeca..e93f66f 100644 --- a/libavcodec/allcodecs.c +++ b/libavcodec/allcodecs.c @@ -703,6 +703,7 @@ extern AVCodec ff_librsvg_decoder; extern AVCodec ff_libshine_encoder; extern AVCodec ff_libspeex_encoder; extern AVCodec ff_libspeex_decoder; +extern AVCodec ff_libsvt_hevc_encoder; extern AVCodec ff_libtheora_encoder; extern AVCodec ff_libtwolame_encoder; extern AVCodec ff_libvo_amrwbenc_encoder; diff --git a/libavcodec/libsvt_hevc.c b/libavcodec/libsvt_hevc.c new file mode 100644 index 000..c6ec3ff --- /dev/null +++ b/libavcodec/libsvt_hevc.c @@ -0,0 +1,505 @@ +/* +* Scalable Video Technology for HEVC encoder library plugin +* +* Copyright (c) 2018 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 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 details. +* +* You should have received a copy of the GNU Lesser General Public +* License along with this program; if not, write to the Free Software +* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +*/ + +#include "svt-hevc/EbErrorCodes.h" +#include "svt-hevc/EbTime.h" +#include "svt-hevc/EbApi.h" + +#include "libavutil/common.h" +#include "libavutil/frame.h" +#include "libavutil/opt.h" + +#include "internal.h" +#include "avcodec.h" + +typedef enum eos_status { +EOS_NOT_REACHED = 0
[FFmpeg-devel] [PATCH v7 1/2] lavc/svt_hevc: add libsvt hevc encoder wrapper.
From: Jing Sun base on patch by Huang, Zhengxu from https://github.com/intel/SVT-HEVC V4: - Fix the build error with new API in PR#52 - Fix the encoding hang issue by API change in PR#52 - Fix the last frame dropping issue - Fix the invalid parameter causing segmentation fault issue - Add the support to svt hevc and av1 plugins coexistance - Add the VMAF optimized mode to "-tune" - Add the "-hdr" parameter V3: - Fix the build error with new API V2: - Change the config options (didn't need to enable-gpl for BSD+Patent, it's can compatible with LGPL2+, thanks Xavier correct this part), now just need to "--enable-libsvthevc" option - Add force_idr option - Remove default GoP size setting in the wrapper, SVT-HEVC will calc the the GoP size internal - Refine the code as the FFmpeg community's comments (https://patchwork.ffmpeg.org/patch/11347/) V1: - base on patch by Huang, Zhengxu, then refine some code. Change-Id: If0dcc5044ab9effd6847a8f48797b985d02b0816 Signed-off-by: Huang, Zhengxu Signed-off-by: hassene Signed-off-by: Jun Zhao Signed-off-by: Jing Sun Signed-off-by: Jing SUN --- configure| 4 + libavcodec/Makefile | 1 + libavcodec/allcodecs.c | 1 + libavcodec/libsvt_hevc.c | 527 +++ 4 files changed, 533 insertions(+) create mode 100644 libavcodec/libsvt_hevc.c diff --git a/configure b/configure index dcead3a..36bc8c1 100755 --- a/configure +++ b/configure @@ -264,6 +264,7 @@ External library support: --enable-libspeexenable Speex de/encoding via libspeex [no] --enable-libsrt enable Haivision SRT protocol via libsrt [no] --enable-libssh enable SFTP protocol via libssh [no] + --enable-libsvthevc enable HEVC encoding via svt [no] --enable-libtensorflow enable TensorFlow as a DNN module backend for DNN based filters like sr [no] --enable-libtesseractenable Tesseract, needed for ocr filter [no] @@ -1784,6 +1785,7 @@ EXTERNAL_LIBRARY_LIST=" libspeex libsrt libssh +libsvthevc libtensorflow libtesseract libtheora @@ -3173,6 +3175,7 @@ libshine_encoder_select="audio_frame_queue" libspeex_decoder_deps="libspeex" libspeex_encoder_deps="libspeex" libspeex_encoder_select="audio_frame_queue" +libsvt_hevc_encoder_deps="libsvthevc" libtheora_encoder_deps="libtheora" libtwolame_encoder_deps="libtwolame" libvo_amrwbenc_encoder_deps="libvo_amrwbenc" @@ -6209,6 +6212,7 @@ enabled libsoxr && require libsoxr soxr.h soxr_create -lsoxr enabled libssh&& require_pkg_config libssh libssh libssh/sftp.h sftp_init enabled libspeex && require_pkg_config libspeex speex speex/speex.h speex_decoder_init enabled libsrt&& require_pkg_config libsrt "srt >= 1.3.0" srt/srt.h srt_socket +enabled libsvthevc&& require_pkg_config libsvthevc SvtHevcEnc svt-hevc/EbApi.h EbInitHandle enabled libtensorflow && require libtensorflow tensorflow/c/c_api.h TF_Version -ltensorflow enabled libtesseract && require_pkg_config libtesseract tesseract tesseract/capi.h TessBaseAPICreate enabled libtheora && require libtheora theora/theoraenc.h th_info_init -ltheoraenc -ltheoradec -logg diff --git a/libavcodec/Makefile b/libavcodec/Makefile index 15c43a8..c93e545 100644 --- a/libavcodec/Makefile +++ b/libavcodec/Makefile @@ -987,6 +987,7 @@ OBJS-$(CONFIG_LIBOPUS_ENCODER)+= libopusenc.o libopus.o \ OBJS-$(CONFIG_LIBSHINE_ENCODER) += libshine.o OBJS-$(CONFIG_LIBSPEEX_DECODER) += libspeexdec.o OBJS-$(CONFIG_LIBSPEEX_ENCODER) += libspeexenc.o +OBJS-$(CONFIG_LIBSVT_HEVC_ENCODER)+= libsvt_hevc.o OBJS-$(CONFIG_LIBTHEORA_ENCODER) += libtheoraenc.o OBJS-$(CONFIG_LIBTWOLAME_ENCODER) += libtwolame.o OBJS-$(CONFIG_LIBVO_AMRWBENC_ENCODER) += libvo-amrwbenc.o diff --git a/libavcodec/allcodecs.c b/libavcodec/allcodecs.c index b26aeca..e93f66f 100644 --- a/libavcodec/allcodecs.c +++ b/libavcodec/allcodecs.c @@ -703,6 +703,7 @@ extern AVCodec ff_librsvg_decoder; extern AVCodec ff_libshine_encoder; extern AVCodec ff_libspeex_encoder; extern AVCodec ff_libspeex_decoder; +extern AVCodec ff_libsvt_hevc_encoder; extern AVCodec ff_libtheora_encoder; extern AVCodec ff_libtwolame_encoder; extern AVCodec ff_libvo_amrwbenc_encoder; diff --git a/libavcodec/libsvt_hevc.c b/libavcodec/libsvt_hevc.c new file mode 100644 index 000..088decf --- /dev/null +++ b/libavcodec/libsvt_hevc.c @@ -0,0 +1,527 @@ +/* +* Scalable Video Technology for HEVC encoder library plugin +* +* Copyright (c) 2018 Intel Corporation +* +* This file is part of FFmpeg. +* +* FFmpeg is free soft
[FFmpeg-devel] [PATCH v7 1/2] lavc/svt_hevc: add libsvt hevc encoder wrapper.
From: Jing Sun base on patch by Huang, Zhengxu from https://github.com/intel/SVT-HEVC V4: - Fix the build error with new API in PR#52 - Fix the encoding hang issue by API change in PR#52 - Fix the last frame dropping issue - Fix the invalid parameter causing segmentation fault issue - Add the support to svt hevc and av1 plugins coexistance - Add the VMAF optimized mode to "-tune" - Add the "-hdr" parameter V3: - Fix the build error with new API V2: - Change the config options (didn't need to enable-gpl for BSD+Patent, it's can compatible with LGPL2+, thanks Xavier correct this part), now just need to "--enable-libsvthevc" option - Add force_idr option - Remove default GoP size setting in the wrapper, SVT-HEVC will calc the the GoP size internal - Refine the code as the FFmpeg community's comments (https://patchwork.ffmpeg.org/patch/11347/) V1: - base on patch by Huang, Zhengxu, then refine some code. Change-Id: If0dcc5044ab9effd6847a8f48797b985d02b0816 Signed-off-by: Huang, Zhengxu Signed-off-by: hassene Signed-off-by: Jun Zhao Signed-off-by: Jing Sun Signed-off-by: Jing SUN --- configure| 4 + libavcodec/Makefile | 1 + libavcodec/allcodecs.c | 1 + libavcodec/libsvt_hevc.c | 527 +++ 4 files changed, 533 insertions(+) create mode 100644 libavcodec/libsvt_hevc.c diff --git a/configure b/configure index dcead3a..36bc8c1 100755 --- a/configure +++ b/configure @@ -264,6 +264,7 @@ External library support: --enable-libspeexenable Speex de/encoding via libspeex [no] --enable-libsrt enable Haivision SRT protocol via libsrt [no] --enable-libssh enable SFTP protocol via libssh [no] + --enable-libsvthevc enable HEVC encoding via svt [no] --enable-libtensorflow enable TensorFlow as a DNN module backend for DNN based filters like sr [no] --enable-libtesseractenable Tesseract, needed for ocr filter [no] @@ -1784,6 +1785,7 @@ EXTERNAL_LIBRARY_LIST=" libspeex libsrt libssh +libsvthevc libtensorflow libtesseract libtheora @@ -3173,6 +3175,7 @@ libshine_encoder_select="audio_frame_queue" libspeex_decoder_deps="libspeex" libspeex_encoder_deps="libspeex" libspeex_encoder_select="audio_frame_queue" +libsvt_hevc_encoder_deps="libsvthevc" libtheora_encoder_deps="libtheora" libtwolame_encoder_deps="libtwolame" libvo_amrwbenc_encoder_deps="libvo_amrwbenc" @@ -6209,6 +6212,7 @@ enabled libsoxr && require libsoxr soxr.h soxr_create -lsoxr enabled libssh&& require_pkg_config libssh libssh libssh/sftp.h sftp_init enabled libspeex && require_pkg_config libspeex speex speex/speex.h speex_decoder_init enabled libsrt&& require_pkg_config libsrt "srt >= 1.3.0" srt/srt.h srt_socket +enabled libsvthevc&& require_pkg_config libsvthevc SvtHevcEnc svt-hevc/EbApi.h EbInitHandle enabled libtensorflow && require libtensorflow tensorflow/c/c_api.h TF_Version -ltensorflow enabled libtesseract && require_pkg_config libtesseract tesseract tesseract/capi.h TessBaseAPICreate enabled libtheora && require libtheora theora/theoraenc.h th_info_init -ltheoraenc -ltheoradec -logg diff --git a/libavcodec/Makefile b/libavcodec/Makefile index 15c43a8..c93e545 100644 --- a/libavcodec/Makefile +++ b/libavcodec/Makefile @@ -987,6 +987,7 @@ OBJS-$(CONFIG_LIBOPUS_ENCODER)+= libopusenc.o libopus.o \ OBJS-$(CONFIG_LIBSHINE_ENCODER) += libshine.o OBJS-$(CONFIG_LIBSPEEX_DECODER) += libspeexdec.o OBJS-$(CONFIG_LIBSPEEX_ENCODER) += libspeexenc.o +OBJS-$(CONFIG_LIBSVT_HEVC_ENCODER)+= libsvt_hevc.o OBJS-$(CONFIG_LIBTHEORA_ENCODER) += libtheoraenc.o OBJS-$(CONFIG_LIBTWOLAME_ENCODER) += libtwolame.o OBJS-$(CONFIG_LIBVO_AMRWBENC_ENCODER) += libvo-amrwbenc.o diff --git a/libavcodec/allcodecs.c b/libavcodec/allcodecs.c index b26aeca..e93f66f 100644 --- a/libavcodec/allcodecs.c +++ b/libavcodec/allcodecs.c @@ -703,6 +703,7 @@ extern AVCodec ff_librsvg_decoder; extern AVCodec ff_libshine_encoder; extern AVCodec ff_libspeex_encoder; extern AVCodec ff_libspeex_decoder; +extern AVCodec ff_libsvt_hevc_encoder; extern AVCodec ff_libtheora_encoder; extern AVCodec ff_libtwolame_encoder; extern AVCodec ff_libvo_amrwbenc_encoder; diff --git a/libavcodec/libsvt_hevc.c b/libavcodec/libsvt_hevc.c new file mode 100644 index 000..088decf --- /dev/null +++ b/libavcodec/libsvt_hevc.c @@ -0,0 +1,527 @@ +/* +* Scalable Video Technology for HEVC encoder library plugin +* +* Copyright (c) 2018 Intel Corporation +* +* This file is part of FFmpeg. +* +* FFmpeg is free soft
[FFmpeg-devel] [PATCH v7 2/2] doc: Add libsvt_hevc encoder docs
Add docs for libsvt_hevc encoder in encoders.texi and general.texi Signed-off-by: Jun Zhao Signed-off-by: Huang, Zhengxu Signed-off-by: hassene Signed-off-by: Jing SUN --- doc/encoders.texi | 145 ++ doc/general.texi | 8 +++ 2 files changed, 153 insertions(+) diff --git a/doc/encoders.texi b/doc/encoders.texi index 29625ba..0b30776 100644 --- a/doc/encoders.texi +++ b/doc/encoders.texi @@ -1569,6 +1569,151 @@ Set maximum NAL size in bytes. Allow skipping frames to hit the target bitrate if set to 1. @end table +@section libsvt_hevc + +Scalable Video Technology for HEVC encoder (SVT-HEVC encoder) wrapper. + +This encoder requires the presence of the headers and +library during configuration. You need to explicitly configure the +build with @code{--enable-libsvthevc}. The library is detected using +@command{pkg-config}. + +For more information about the library see +@url{https://github.com/intel/SVT-HEVC.git}. + +@subsection Options + +The following FFmpeg global options affect the configurations of the +libsvt_hevc encoder. + +@table @option +@item b (@emph{bitrate}) +Set the bitrate (as a number of bits per second). Default is 7M. + +@item g / @option{gop_size} +Set the GOP size. Default is -2 (unspecified). + +@item flags +cgop +Enable closed GOP. + +@item qmin (@emph{min-q}) +Defaults 10 + +@item qmax (@emph{max-q}) +Defaults 48 + +Set minimum/maximum quantisation values. Valid range is from 0 to 51 +(Only used when bit rate control mode @option{rc} is set to 1(vbr) mode. +Has to be qmax > = qmin). + +@item profile (@emph{profile}) +Set profile restrictions. Can assume one of the following possible values: + +Default is 2 (main10). + +@table @samp +@item main +main profile +@item main10 +main10 profile +@end table + +@item level + +@option{profile} sets the value of @emph{profile}. +@option{level} sets the value of @emph{level}. + +The encoder also has its own specific options: + +@table @option +@item vui +Enables or disables the vui structure in the HEVC elementary +bitstream. 0 = Off, 1 = On. Default is 0 (Off). + +@item aud (@emph{aud}) +Enable use of access unit delimiters when set to 1. Default is 0 (Off). + +@item hielevel +Set hierarchical levels. Can assume one of the following possible values: + +Default is 3 (4level). + +@table @samp +@item flat +none hierarchy level +@item 2level +2-level hierarchy +@item 3level +3-level hierarchy +@item 4level +4-level hierarchy +@end table + +@item la_depth +Set look-ahead depth, depending on bit rate control mode @option{rc}, when +bit rate control mode is set to vbr it's best to set this parameter to be +equal to the intra period value (such is the default set by the encoder), +when cqp is chosen, then a look ahead is recommended. The range is from @var{0-256}. + +@item preset +A preset defining the quality vs density tradeoff point that the +encoding is to be performed at.(e.g. 0 is the highest quality mode, +12 is the highest density mode). The range is from @var{0-12}. Default is 9. + +@item tier +Set @emph{general_tier_flag}. This may affect the level chosen for the stream +if it is not explicitly specified. Can assume one of the following possible values: + +Default is 1 (main). + +@table @samp +@item main +main tier +@item high +high tier +@end table + +@item rc +Set bit rate control mode. Can assume one of the following possible values: + +Default is 0 (cqp). + +@table @samp +@item cqp +Constant QP (CQP) mode +@item vbr +Variable Bit Rate (VBR) mode +@end table + +@item qp +Initial quantization parameter for the intra pictures used when +@option{rc} is cqp mode. The range is from @var{0-51}. Default is 32. + +@item sc_detection +Enables or disables the scene change detection algorithm. Default is 0 (disable). + +@item tune +Set quality tuning mode. Can assume one of the following possible values: + +Default is 1 (oq). + +@table @samp +@item sq +Visually optimized mode +@item oq +PSNR / SSIM optimized mode +@item vmaf +VMAF optimized mode +@end table + +@item bl_mode +Enables or disables Random Access Prediction. Default is 0 (disable). +@end table + +@item hdr +High dynamic range input. Default is 0 (disable). +@end table + @section libtheora libtheora Theora encoder wrapper. diff --git a/doc/general.texi b/doc/general.texi index fe94c40..f90e188 100644 --- a/doc/general.texi +++ b/doc/general.texi @@ -234,6 +234,14 @@ FFmpeg can use the OpenJPEG libraries for decoding/encoding J2K videos. Go to instructions. To enable using OpenJPEG in FFmpeg, pass @code{--enable-libopenjpeg} to @file{./configure}. +@section Scalable Video Technology for HEVC + +FFmpeg can make use of the SVT-HEVC library for HEVC encoding. + +Go to @url{https://github.com/intel/SVT-HEVC.git} and follow the instructions +for installing the library. Pass @code{--enable-libsvthevc} to configure to +enable it. + @section TwoLAME FFmpeg can make use of the TwoLAME library for MP2 encod
[FFmpeg-devel] [PATCH v7 1/2] lavc/svt_hevc: add libsvt hevc encoder wrapper.
From: Jing Sun base on patch by Huang, Zhengxu from https://github.com/intel/SVT-HEVC V4: - Fix the build error with new API in PR#52 - Fix the encoding hang issue by API change in PR#52 - Fix the last frame dropping issue - Fix the invalid parameter causing segmentation fault issue - Add the support to svt hevc and av1 plugins coexistance - Add the VMAF optimized mode to "-tune" - Add the "-hdr" parameter V3: - Fix the build error with new API V2: - Change the config options (didn't need to enable-gpl for BSD+Patent, it's can compatible with LGPL2+, thanks Xavier correct this part), now just need to "--enable-libsvthevc" option - Add force_idr option - Remove default GoP size setting in the wrapper, SVT-HEVC will calc the the GoP size internal - Refine the code as the FFmpeg community's comments (https://patchwork.ffmpeg.org/patch/11347/) V1: - base on patch by Huang, Zhengxu, then refine some code. Change-Id: If0dcc5044ab9effd6847a8f48797b985d02b0816 Signed-off-by: Huang, Zhengxu Signed-off-by: hassene Signed-off-by: Jun Zhao Signed-off-by: Jing Sun Signed-off-by: Jing SUN --- configure| 4 + libavcodec/Makefile | 1 + libavcodec/allcodecs.c | 1 + libavcodec/libsvt_hevc.c | 528 +++ 4 files changed, 534 insertions(+) create mode 100644 libavcodec/libsvt_hevc.c diff --git a/configure b/configure index dcead3a..36bc8c1 100755 --- a/configure +++ b/configure @@ -264,6 +264,7 @@ External library support: --enable-libspeexenable Speex de/encoding via libspeex [no] --enable-libsrt enable Haivision SRT protocol via libsrt [no] --enable-libssh enable SFTP protocol via libssh [no] + --enable-libsvthevc enable HEVC encoding via svt [no] --enable-libtensorflow enable TensorFlow as a DNN module backend for DNN based filters like sr [no] --enable-libtesseractenable Tesseract, needed for ocr filter [no] @@ -1784,6 +1785,7 @@ EXTERNAL_LIBRARY_LIST=" libspeex libsrt libssh +libsvthevc libtensorflow libtesseract libtheora @@ -3173,6 +3175,7 @@ libshine_encoder_select="audio_frame_queue" libspeex_decoder_deps="libspeex" libspeex_encoder_deps="libspeex" libspeex_encoder_select="audio_frame_queue" +libsvt_hevc_encoder_deps="libsvthevc" libtheora_encoder_deps="libtheora" libtwolame_encoder_deps="libtwolame" libvo_amrwbenc_encoder_deps="libvo_amrwbenc" @@ -6209,6 +6212,7 @@ enabled libsoxr && require libsoxr soxr.h soxr_create -lsoxr enabled libssh&& require_pkg_config libssh libssh libssh/sftp.h sftp_init enabled libspeex && require_pkg_config libspeex speex speex/speex.h speex_decoder_init enabled libsrt&& require_pkg_config libsrt "srt >= 1.3.0" srt/srt.h srt_socket +enabled libsvthevc&& require_pkg_config libsvthevc SvtHevcEnc svt-hevc/EbApi.h EbInitHandle enabled libtensorflow && require libtensorflow tensorflow/c/c_api.h TF_Version -ltensorflow enabled libtesseract && require_pkg_config libtesseract tesseract tesseract/capi.h TessBaseAPICreate enabled libtheora && require libtheora theora/theoraenc.h th_info_init -ltheoraenc -ltheoradec -logg diff --git a/libavcodec/Makefile b/libavcodec/Makefile index 15c43a8..c93e545 100644 --- a/libavcodec/Makefile +++ b/libavcodec/Makefile @@ -987,6 +987,7 @@ OBJS-$(CONFIG_LIBOPUS_ENCODER)+= libopusenc.o libopus.o \ OBJS-$(CONFIG_LIBSHINE_ENCODER) += libshine.o OBJS-$(CONFIG_LIBSPEEX_DECODER) += libspeexdec.o OBJS-$(CONFIG_LIBSPEEX_ENCODER) += libspeexenc.o +OBJS-$(CONFIG_LIBSVT_HEVC_ENCODER)+= libsvt_hevc.o OBJS-$(CONFIG_LIBTHEORA_ENCODER) += libtheoraenc.o OBJS-$(CONFIG_LIBTWOLAME_ENCODER) += libtwolame.o OBJS-$(CONFIG_LIBVO_AMRWBENC_ENCODER) += libvo-amrwbenc.o diff --git a/libavcodec/allcodecs.c b/libavcodec/allcodecs.c index b26aeca..e93f66f 100644 --- a/libavcodec/allcodecs.c +++ b/libavcodec/allcodecs.c @@ -703,6 +703,7 @@ extern AVCodec ff_librsvg_decoder; extern AVCodec ff_libshine_encoder; extern AVCodec ff_libspeex_encoder; extern AVCodec ff_libspeex_decoder; +extern AVCodec ff_libsvt_hevc_encoder; extern AVCodec ff_libtheora_encoder; extern AVCodec ff_libtwolame_encoder; extern AVCodec ff_libvo_amrwbenc_encoder; diff --git a/libavcodec/libsvt_hevc.c b/libavcodec/libsvt_hevc.c new file mode 100644 index 000..de11a19 --- /dev/null +++ b/libavcodec/libsvt_hevc.c @@ -0,0 +1,528 @@ +/* +* Scalable Video Technology for HEVC encoder library plugin +* +* Copyright (c) 2018 Intel Corporation +* +* This file is part of FFmpeg. +* +* FFmpeg is free soft
[FFmpeg-devel] [PATCH v6 2/2] doc: Add libsvt_hevc encoder docs
Add docs for libsvt_hevc encoder in encoders.texi and general.texi Signed-off-by: Jun Zhao Signed-off-by: Huang, Zhengxu Signed-off-by: hassene Signed-off-by: Jing SUN --- doc/encoders.texi | 161 ++ doc/general.texi | 8 +++ 2 files changed, 169 insertions(+) diff --git a/doc/encoders.texi b/doc/encoders.texi index 29625ba..64ddb2f 100644 --- a/doc/encoders.texi +++ b/doc/encoders.texi @@ -1569,6 +1569,167 @@ Set maximum NAL size in bytes. Allow skipping frames to hit the target bitrate if set to 1. @end table +@section libsvt_hevc + +Scalable Video Technology for HEVC encoder (SVT-HEVC encoder) wrapper. + +This encoder requires the presence of the headers and +library during configuration. You need to explicitly configure the +build with @code{--enable-libsvthevc}. The library is detected using +@command{pkg-config}. + +For more information about the library see +@url{https://github.com/intel/SVT-HEVC.git}. + +@subsection Options + +The following FFmpeg global options affect the configurations of the +libsvt_hevc encoder. + +@table @option +@item b (@emph{bitrate}) +Set the bitrate (as a number of bits per second). Default is 7M. + +@item refs (@emph{ref}) +Number of reference frames each P-frame can use. The range is from @var{0-16}. +Default is 0(disabled). + +@item g / @option{gop_size} +Set the GOP size. Default is 64. + +@item flags +cgop +Enable closed GOP. + +@item qmin (@emph{min-q}) +Defaults 10 + +@item qmax (@emph{max-q}) +Defaults 48 + +Set minimum/maximum quantisation values. Valid range is from 0 to 51 +(Only used when bit rate control mode @option{rc} is set to 0(cqp) mode. +Has to be qmax > = qmin). + +@item profile (@emph{profile}) +Set profile restrictions. Can assume one of the following possible values: + +Default is 2 (main10). + +@table @samp +@item main +main profile +@item main10 +main10 profile +@end table + +@item level + +@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}. + +The encoder also has its own specific options: + +@table @option +@item vui +Enables or disables the vui structure in the HEVC elementary +bitstream. 0 = Off, 1 = On. Default is 0 (Off). + +@item aud (@emph{aud}) +Enable use of access unit delimiters when set to 1. Default is 0 (Off). + +@item hielevel +Set hierarchical levels. Can assume one of the following possible values: + +Default is 3 (4level). + +@table @samp +@item flat +none hierarchy level +@item 2level +2-level hierarchy +@item 3level +3-level hierarchy +@item 4level +4-level hierarchy +@end table + +@item la_depth +Set look-ahead depth, depending on bit rate control mode @option{rc}, when +bit rate control mode is set to vbr it's best to set this parameter to be +equal to the intra period value (such is the default set by the encoder), +when cqp is chosen, then a look ahead is recommended. The range is from @var{0-256}. + +@item intra_ref_type +Set intra refesh type. Can assume one of the following possible values: + +Default is 2 (idr). + +@table @samp +@item cra +open group of pictures +@item idr +closed group of pictures +@end table + +@item preset +A preset defining the quality vs density tradeoff point that the +encoding is to be performed at.(e.g. 0 is the highest quality mode, +12 is the highest density mode). The range is from @var{0-12}. Default is 9. + +@item tier +Set @emph{general_tier_flag}. This may affect the level chosen for the stream +if it is not explicitly specified. Can assume one of the following possible values: + +Default is 1 (main). + +@table @samp +@item main +main tier +@item high +high tier +@end table + +@item rc +Set bit rate control mode. Can assume one of the following possible values: + +Default is 0 (cqp). + +@table @samp +@item cqp +Constant QP (CQP) mode +@item vbr +Variable Bit Rate (VBR) mode +@end table + +@item qp +Initial quantization parameter for the intra pictures used when +@option{rc} is cqp mode. The range is from @var{0-51}. Default is 32. + +@item sc_detection +Enables or disables the scene change detection algorithm. Default is 0 (disable). + +@item tune +Set quality tuning mode. Can assume one of the following possible values: + +Default is 1 (oq). + +@table @samp +@item sq +Visually optimized mode +@item oq +PSNR / SSIM optimized mode +@item vmaf +VMAF optimized mode +@end table + +@item bl_mode +Enables or disables Random Access Prediction. Default is 0 (disable). +@end table + +@item hdr +High dynamic range input. Default is 0 (disable). +@end table + @section libtheora libtheora Theora encoder wrapper. diff --git a/doc/general.texi b/doc/general.texi index fe94c40..9863e14 100644 --- a/doc/general.texi +++ b/doc/general.texi @@ -126,6 +126,14 @@ The dispatcher is open source and can be downloaded from with the @code{--enable-libmfx} option and @code{pkg-config} needs to be able to locate the dispatcher's @code{
[FFmpeg-devel] [PATCH v6 1/2] lavc/svt_hevc: add libsvt hevc encoder wrapper.
From: Jing Sun base on patch by Huang, Zhengxu from https://github.com/intel/SVT-HEVC V4: - Fix the build error with new API in PR#52 - Fix the encoding hang issue by API change in PR#52 - Fix the last frame dropping issue - Fix the invalid parameter causing segmentation fault issue - Add the support to svt hevc and av1 plugins coexistance - Add the VMAF optimized mode to "-tune" - Add the "-hdr" parameter V3: - Fix the build error with new API V2: - Change the config options (didn't need to enable-gpl for BSD+Patent, it's can compatible with LGPL2+, thanks Xavier correct this part), now just need to "--enable-libsvthevc" option - Add force_idr option - Remove default GoP size setting in the wrapper, SVT-HEVC will calc the the GoP size internal - Refine the code as the FFmpeg community's comments (https://patchwork.ffmpeg.org/patch/11347/) V1: - base on patch by Huang, Zhengxu, then refine some code. Change-Id: If0dcc5044ab9effd6847a8f48797b985d02b0816 Signed-off-by: Huang, Zhengxu Signed-off-by: hassene Signed-off-by: Jun Zhao Signed-off-by: Jing Sun --- configure| 4 + libavcodec/Makefile | 1 + libavcodec/allcodecs.c | 1 + libavcodec/libsvt_hevc.c | 546 +++ 4 files changed, 552 insertions(+) create mode 100644 libavcodec/libsvt_hevc.c diff --git a/configure b/configure index dcead3a..36bc8c1 100755 --- a/configure +++ b/configure @@ -264,6 +264,7 @@ External library support: --enable-libspeexenable Speex de/encoding via libspeex [no] --enable-libsrt enable Haivision SRT protocol via libsrt [no] --enable-libssh enable SFTP protocol via libssh [no] + --enable-libsvthevc enable HEVC encoding via svt [no] --enable-libtensorflow enable TensorFlow as a DNN module backend for DNN based filters like sr [no] --enable-libtesseractenable Tesseract, needed for ocr filter [no] @@ -1784,6 +1785,7 @@ EXTERNAL_LIBRARY_LIST=" libspeex libsrt libssh +libsvthevc libtensorflow libtesseract libtheora @@ -3173,6 +3175,7 @@ libshine_encoder_select="audio_frame_queue" libspeex_decoder_deps="libspeex" libspeex_encoder_deps="libspeex" libspeex_encoder_select="audio_frame_queue" +libsvt_hevc_encoder_deps="libsvthevc" libtheora_encoder_deps="libtheora" libtwolame_encoder_deps="libtwolame" libvo_amrwbenc_encoder_deps="libvo_amrwbenc" @@ -6209,6 +6212,7 @@ enabled libsoxr && require libsoxr soxr.h soxr_create -lsoxr enabled libssh&& require_pkg_config libssh libssh libssh/sftp.h sftp_init enabled libspeex && require_pkg_config libspeex speex speex/speex.h speex_decoder_init enabled libsrt&& require_pkg_config libsrt "srt >= 1.3.0" srt/srt.h srt_socket +enabled libsvthevc&& require_pkg_config libsvthevc SvtHevcEnc svt-hevc/EbApi.h EbInitHandle enabled libtensorflow && require libtensorflow tensorflow/c/c_api.h TF_Version -ltensorflow enabled libtesseract && require_pkg_config libtesseract tesseract tesseract/capi.h TessBaseAPICreate enabled libtheora && require libtheora theora/theoraenc.h th_info_init -ltheoraenc -ltheoradec -logg diff --git a/libavcodec/Makefile b/libavcodec/Makefile index 15c43a8..c93e545 100644 --- a/libavcodec/Makefile +++ b/libavcodec/Makefile @@ -987,6 +987,7 @@ OBJS-$(CONFIG_LIBOPUS_ENCODER)+= libopusenc.o libopus.o \ OBJS-$(CONFIG_LIBSHINE_ENCODER) += libshine.o OBJS-$(CONFIG_LIBSPEEX_DECODER) += libspeexdec.o OBJS-$(CONFIG_LIBSPEEX_ENCODER) += libspeexenc.o +OBJS-$(CONFIG_LIBSVT_HEVC_ENCODER)+= libsvt_hevc.o OBJS-$(CONFIG_LIBTHEORA_ENCODER) += libtheoraenc.o OBJS-$(CONFIG_LIBTWOLAME_ENCODER) += libtwolame.o OBJS-$(CONFIG_LIBVO_AMRWBENC_ENCODER) += libvo-amrwbenc.o diff --git a/libavcodec/allcodecs.c b/libavcodec/allcodecs.c index b26aeca..e93f66f 100644 --- a/libavcodec/allcodecs.c +++ b/libavcodec/allcodecs.c @@ -703,6 +703,7 @@ extern AVCodec ff_librsvg_decoder; extern AVCodec ff_libshine_encoder; extern AVCodec ff_libspeex_encoder; extern AVCodec ff_libspeex_decoder; +extern AVCodec ff_libsvt_hevc_encoder; extern AVCodec ff_libtheora_encoder; extern AVCodec ff_libtwolame_encoder; extern AVCodec ff_libvo_amrwbenc_encoder; diff --git a/libavcodec/libsvt_hevc.c b/libavcodec/libsvt_hevc.c new file mode 100644 index 000..97bd204 --- /dev/null +++ b/libavcodec/libsvt_hevc.c @@ -0,0 +1,546 @@ +/* +* Scalable Video Technology for HEVC encoder library plugin +* +* Copyright (c) 2018 Intel Corporation +* +* This file is part of FFmpeg. +* +* FFmpeg is free software; you can redistribut
[FFmpeg-devel] [PATCH v2 1/1] avcodec/vaapi_encode: add frame-skip func
This implements app controlled frame skipping in vaapi encoding. To make a frame skipped, allocate its frame side data of the newly added AV_FRAME_DATA_SKIP_FRAME type and set its value to 1. Signed-off-by: Jing SUN --- libavcodec/vaapi_encode.c | 112 -- libavcodec/vaapi_encode.h | 5 +++ libavutil/frame.c | 1 + libavutil/frame.h | 5 +++ 4 files changed, 119 insertions(+), 4 deletions(-) diff --git a/libavcodec/vaapi_encode.c b/libavcodec/vaapi_encode.c index b4e9fad..debcfa6 100644 --- a/libavcodec/vaapi_encode.c +++ b/libavcodec/vaapi_encode.c @@ -23,6 +23,7 @@ #include "libavutil/common.h" #include "libavutil/log.h" #include "libavutil/pixdesc.h" +#include "libavutil/intreadwrite.h" #include "vaapi_encode.h" #include "avcodec.h" @@ -103,6 +104,41 @@ static int vaapi_encode_make_param_buffer(AVCodecContext *avctx, return 0; } +static int vaapi_encode_check_if_skip(AVCodecContext *avctx, + VAAPIEncodePicture *pic) +{ +AVFrameSideData *fside = NULL; +VAAPIEncodeContext *ctx = avctx->priv_data; +VAAPIEncodePicture *cur = NULL; +int i = 0; +if (!pic || !pic->input_image) +return AVERROR(EINVAL); +fside = av_frame_get_side_data(pic->input_image, AV_FRAME_DATA_SKIP_FRAME); +if (fside) +pic->skipped_flag = AV_RL8(fside->data); +else +pic->skipped_flag = 0; +if (0 == pic->skipped_flag) +return 0; +if ((pic->type == PICTURE_TYPE_IDR) || (pic->type == PICTURE_TYPE_I)) { +av_log(avctx, AV_LOG_INFO, "Can't skip IDR/I pic %"PRId64"/%"PRId64".\n", + pic->display_order, pic->encode_order); +pic->skipped_flag = 0; +return 0; +} +for (cur = ctx->pic_start; cur; cur = cur->next) { +for (i=0; i < cur->nb_refs; ++i) { +if (cur->refs[i] == pic) { +av_log(avctx, AV_LOG_INFO, "Can't skip ref pic %"PRId64"/%"PRId64".\n", + pic->display_order, pic->encode_order); +pic->skipped_flag = 0; +return 0; +} +} +} +return 0; +} + static int vaapi_encode_wait(AVCodecContext *avctx, VAAPIEncodePicture *pic) { @@ -412,6 +448,50 @@ static int vaapi_encode_issue(AVCodecContext *avctx, } } +err = vaapi_encode_check_if_skip(avctx, pic); +if (err != 0) +av_log(avctx, AV_LOG_ERROR, "Fail to check if skip.\n"); + +#if VA_CHECK_VERSION(0,38,1) +if (pic->skipped_flag) { +av_log(avctx, AV_LOG_INFO, "Skip pic %"PRId64"/%"PRId64" as requested.\n", + pic->display_order, pic->encode_order); +++ctx->skipped_pic_count; +pic->encode_issued = 1; +return 0; +} else if (ctx->skipped_pic_count > 0) { +VAEncMiscParameterBuffer *misc_param = NULL; +VAEncMiscParameterSkipFrame *skip_param = NULL; + +misc_param = av_malloc(sizeof(VAEncMiscParameterBuffer) + sizeof(VAEncMiscParameterSkipFrame)); +misc_param->type = (VAEncMiscParameterType)VAEncMiscParameterTypeSkipFrame; +skip_param = (VAEncMiscParameterSkipFrame *)misc_param->data; + +skip_param->skip_frame_flag = 1; +skip_param->num_skip_frames = ctx->skipped_pic_count; +skip_param->size_skip_frames = 0; + +err = vaapi_encode_make_param_buffer(avctx, pic, + VAEncMiscParameterBufferType, (void *)misc_param, + (sizeof(VAEncMiscParameterBuffer) + + sizeof(VAEncMiscParameterSkipFrame))); + +free(misc_param); + +if (err < 0) +goto fail; + +ctx->skipped_pic_count = 0; +} +#else +if (pic->skipped_flag) { +av_log(avctx, AV_LOG_INFO, "Skip-frame isn't supported and pic %"PRId64"/%"PRId64" isn't skipped.\n", + pic->display_order, pic->encode_order); +pic->skipped_flag = 0; +ctx->skipped_pic_count = 0; +} +#endif + vas = vaBeginPicture(ctx->hwctx->display, ctx->va_context, pic->input_surface); if (vas != VA_STATUS_SUCCESS) { @@ -491,9 +571,23 @@ static int vaapi_encode_output(AVCodecContext *avctx, VAStatus vas; int err; -err = vaapi_encode_wait(avctx, pic); -if (err < 0) -return err; +if (!pic->skipped_flag) { +err = vaapi_encode_wait(avctx, pic); +if (err < 0) +return err; +} else { +av_frame_free(>input_image); +pic->encode_complete = 1; +err = av_new_packet(pkt, 0); +if (err
[FFmpeg-devel] [PATCH 1/1] avcodec/vaapi_encode: add frame-skip func
frame-skip is required to implement network bandwidth self-adaptive vaapi encoding. To make a frame skipped, allocate its frame side data of AV_FRAME_DATA_SKIP_FRAME type and set its value to 1. Signed-off-by: Jing SUN --- libavcodec/vaapi_encode.c | 142 -- libavcodec/vaapi_encode.h | 5 ++ libavutil/frame.c | 1 + libavutil/frame.h | 5 ++ 4 files changed, 149 insertions(+), 4 deletions(-) diff --git a/libavcodec/vaapi_encode.c b/libavcodec/vaapi_encode.c index 2fe8501..a401d61 100644 --- a/libavcodec/vaapi_encode.c +++ b/libavcodec/vaapi_encode.c @@ -23,6 +23,7 @@ #include "libavutil/common.h" #include "libavutil/log.h" #include "libavutil/pixdesc.h" +#include "libavutil/intreadwrite.h" #include "vaapi_encode.h" #include "avcodec.h" @@ -103,6 +104,47 @@ static int vaapi_encode_make_param_buffer(AVCodecContext *avctx, return 0; } +static int vaapi_encode_check_if_skip(AVCodecContext *avctx, + VAAPIEncodePicture *pic) +{ +AVFrameSideData *fside = NULL; +VAAPIEncodeContext *ctx = avctx->priv_data; +VAAPIEncodePicture *cur = NULL; +int i = 0; + +if (!pic || !pic->input_image) +return AVERROR(EINVAL); + +fside = av_frame_get_side_data(pic->input_image, AV_FRAME_DATA_SKIP_FRAME); +if (fside) +pic->skipped_flag = AV_RL8(fside->data); +else +pic->skipped_flag = 0; + +if (0 == pic->skipped_flag) +return 0; + +if ((pic->type == PICTURE_TYPE_IDR) || (pic->type == PICTURE_TYPE_I)) { +av_log(avctx, AV_LOG_INFO, "Can't skip IDR/I pic %"PRId64"/%"PRId64".\n", + pic->display_order, pic->encode_order); +pic->skipped_flag = 0; +return 0; +} + +for (cur = ctx->pic_start; cur; cur = cur->next) { +for (i=0; i < cur->nb_refs; ++i) { +if (cur->refs[i] == pic) { +av_log(avctx, AV_LOG_INFO, "Can't skip ref pic %"PRId64"/%"PRId64".\n", + pic->display_order, pic->encode_order); +pic->skipped_flag = 0; +return 0; +} +} +} + +return 0; +} + static int vaapi_encode_wait(AVCodecContext *avctx, VAAPIEncodePicture *pic) { @@ -418,6 +460,69 @@ static int vaapi_encode_issue(AVCodecContext *avctx, } } +err = vaapi_encode_check_if_skip(avctx, pic); +if (err != 0) +av_log(avctx, AV_LOG_ERROR, "Fail to check if skip.\n"); + +#ifdef VAEncMiscParameterSkipFrame +if (pic->skipped_flag) { +av_log(avctx, AV_LOG_INFO, "Skip pic %"PRId64"/%"PRId64" as requested.\n", + pic->display_order, pic->encode_order); + +++ctx->skipped_pic_count; +pic->encode_issued = 1; + +return 0; +} else if (ctx->skipped_pic_count > 0) { +VABufferID skip_param_id; +VAEncMiscParameterBuffer *misc_param; +VAEncMiscParameterSkipFrame *skip_param; + +err = vaapi_encode_make_param_buffer(avctx, pic, + VAEncMiscParameterBufferType, NULL, + (sizeof(VAEncMiscParameterBuffer) + + sizeof(VAEncMiscParameterSkipFrame))); +if (err < 0) +goto fail; + +skip_param_id = pic->param_buffers[pic->nb_param_buffers-1]; + +vas = vaMapBuffer(ctx->hwctx->display, + skip_param_id, + (void **)_param); +if (vas != VA_STATUS_SUCCESS) { +av_log(avctx, AV_LOG_ERROR, "Failed to map skip-frame buffer: " + "%d (%s).\n", vas, vaErrorStr(vas)); +err = AVERROR(EIO); +goto fail; +} + +misc_param->type = (VAEncMiscParameterType)VAEncMiscParameterTypeSkipFrame; +skip_param = (VAEncMiscParameterSkipFrame *)misc_param->data; +skip_param->skip_frame_flag = 1; +skip_param->num_skip_frames = ctx->skipped_pic_count; +skip_param->size_skip_frames = 0; + +vas = vaUnmapBuffer(ctx->hwctx->display, skip_param_id); +if (vas != VA_STATUS_SUCCESS) { +av_log(avctx, AV_LOG_ERROR, "Failed to unmap skip-frame buffer: " + "%d (%s).\n", vas, vaErrorStr(vas)); +err = AVERROR(EIO); +goto fail; +} + +ctx->skipped_pic_count = 0; +} +#else +if (pic->skipped_flag) { +av_log(avctx, AV_LOG_INFO, "Skip-frame isn't supported and pic %"PRId64"/%"PRId64" isn't skipped.\n", + pic->display_order, pic->encode_order); + +p
[FFmpeg-devel] [PATCH 1/1] avcodec/vaapi_encode: add frame-skip func
frame-skip is required to implement network bandwidth self-adaptive vaapi encoding. To make a frame skipped, allocate its frame side data of AV_FRAME_DATA_SKIP_FRAME type and set its value to 1. Signed-off-by: Jing SUN --- libavcodec/vaapi_encode.c | 132 -- libavcodec/vaapi_encode.h | 5 ++ libavutil/frame.c | 1 + libavutil/frame.h | 5 ++ 4 files changed, 139 insertions(+), 4 deletions(-) diff --git a/libavcodec/vaapi_encode.c b/libavcodec/vaapi_encode.c index 2fe8501..ea06404 100644 --- a/libavcodec/vaapi_encode.c +++ b/libavcodec/vaapi_encode.c @@ -23,6 +23,7 @@ #include "libavutil/common.h" #include "libavutil/log.h" #include "libavutil/pixdesc.h" +#include "libavutil/intreadwrite.h" #include "vaapi_encode.h" #include "avcodec.h" @@ -103,6 +104,47 @@ static int vaapi_encode_make_param_buffer(AVCodecContext *avctx, return 0; } +static int vaapi_encode_check_if_skip(AVCodecContext *avctx, + VAAPIEncodePicture *pic) +{ +AVFrameSideData *fside = NULL; +VAAPIEncodeContext *ctx = avctx->priv_data; +VAAPIEncodePicture *cur = NULL; +int i = 0; + +if (!pic || !pic->input_image) +return AVERROR(EINVAL); + +fside = av_frame_get_side_data(pic->input_image, AV_FRAME_DATA_SKIP_FRAME); +if (fside) +pic->skipped_flag = AV_RL8(fside->data); +else +pic->skipped_flag = 0; + +if (0 == pic->skipped_flag) +return 0; + +if ((pic->type == PICTURE_TYPE_IDR) || (pic->type == PICTURE_TYPE_I)) { +av_log(avctx, AV_LOG_INFO, "Can't skip IDR/I pic %"PRId64"/%"PRId64".\n", + pic->display_order, pic->encode_order); +pic->skipped_flag = 0; +return 0; +} + +for (cur = ctx->pic_start; cur; cur = cur->next) { +for (i=0; i < cur->nb_refs; ++i) { +if (cur->refs[i] == pic) { +av_log(avctx, AV_LOG_INFO, "Can't skip ref pic %"PRId64"/%"PRId64".\n", + pic->display_order, pic->encode_order); +pic->skipped_flag = 0; +return 0; +} +} +} + +return 0; +} + static int vaapi_encode_wait(AVCodecContext *avctx, VAAPIEncodePicture *pic) { @@ -418,6 +460,59 @@ static int vaapi_encode_issue(AVCodecContext *avctx, } } +err = vaapi_encode_check_if_skip(avctx, pic); +if (err != 0) +av_log(avctx, AV_LOG_ERROR, "Fail to check if skip.\n"); + +if (pic->skipped_flag) { +av_log(avctx, AV_LOG_INFO, "Skip pic %"PRId64"/%"PRId64" as requested.\n", + pic->display_order, pic->encode_order); + +++ctx->skipped_pic_count; +pic->encode_issued = 1; + +return 0; +} else if (ctx->skipped_pic_count > 0) { +VABufferID skip_param_id; +VAEncMiscParameterBuffer *misc_param; +VAEncMiscParameterSkipFrame *skip_param; + +err = vaapi_encode_make_param_buffer(avctx, pic, + VAEncMiscParameterBufferType, NULL, + (sizeof(VAEncMiscParameterBuffer) + + sizeof(VAEncMiscParameterSkipFrame))); +if (err < 0) +goto fail; + +skip_param_id = pic->param_buffers[pic->nb_param_buffers-1]; + +vas = vaMapBuffer(ctx->hwctx->display, + skip_param_id, + (void **)_param); +if (vas != VA_STATUS_SUCCESS) { +av_log(avctx, AV_LOG_ERROR, "Failed to map skip-frame buffer: " + "%d (%s).\n", vas, vaErrorStr(vas)); +err = AVERROR(EIO); +goto fail; +} + +misc_param->type = (VAEncMiscParameterType)VAEncMiscParameterTypeSkipFrame; +skip_param = (VAEncMiscParameterSkipFrame *)misc_param->data; +skip_param->skip_frame_flag = 1; +skip_param->num_skip_frames = ctx->skipped_pic_count; +skip_param->size_skip_frames = 0; + +vas = vaUnmapBuffer(ctx->hwctx->display, skip_param_id); +if (vas != VA_STATUS_SUCCESS) { +av_log(avctx, AV_LOG_ERROR, "Failed to unmap skip-frame buffer: " + "%d (%s).\n", vas, vaErrorStr(vas)); +err = AVERROR(EIO); +goto fail; +} + +ctx->skipped_pic_count = 0; +} + vas = vaBeginPicture(ctx->hwctx->display, ctx->va_context, pic->input_surface); if (vas != VA_STATUS_SUCCESS) { @@ -500,9 +595,28 @@ static int vaapi_encode_output(AVCodecContext *avctx, VAStatus vas; int err; -err = vaapi_