[FFmpeg-devel] [PATCH v13 1/2] lavc/svt_hevc: add libsvt hevc encoder wrapper

James Almer jamrial at gmail.com
Thu May 30 18:34:42 EEST 2019


On 5/30/2019 8:04 AM, Jing Sun wrote:
> Signed-off-by: Zhengxu Huang <zhengxu.huang at intel.com>
> Signed-off-by: Hassene Tmar <hassene.tmar at intel.com>
> Signed-off-by: Jun Zhao <jun.zhao at intel.com>
> Signed-off-by: Jing Sun <jing.a.sun at intel.com>
> ---
>  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

[...]

> +AVCodec ff_libsvt_hevc_encoder = {
> +    .name           = "libsvt_hevc",
> +    .long_name      = NULL_IF_CONFIG_SMALL("SVT-HEVC(Scalable Video Technology for HEVC) encoder"),
> +    .priv_data_size = sizeof(SvtContext),
> +    .type           = AVMEDIA_TYPE_VIDEO,
> +    .id             = AV_CODEC_ID_HEVC,
> +    .init           = eb_enc_init,
> +    .encode2        = eb_encode_frame,

Why the switch to encode2? All previous versions were using the
send/receive API, and seeing SVT also uses a decoupled input/output API,
it was certainly the most adequate option.

Were you running into some issue? A quick look at v12 shows you were
using ff_alloc_packet2(), which afaik you shouldn't have. It's meant for
the encode2() API only, where user provided buffers are allowed, and it
alone does not ensure the packet will be reference counted, which is
required for the send/receive API.

> +    .close          = eb_enc_close,
> +    .capabilities   = AV_CODEC_CAP_DELAY | AV_CODEC_CAP_AUTO_THREADS,
> +    .pix_fmts       = (const enum AVPixelFormat[]){ AV_PIX_FMT_YUV420P,
> +                                                    AV_PIX_FMT_YUV420P10,
> +                                                    AV_PIX_FMT_YUV422P,
> +                                                    AV_PIX_FMT_YUV420P10,
> +                                                    AV_PIX_FMT_YUV444P,
> +                                                    AV_PIX_FMT_YUV444P10,
> +                                                    AV_PIX_FMT_NONE },
> +    .priv_class     = &class,
> +    .defaults       = eb_enc_defaults,
> +    .caps_internal  = FF_CODEC_CAP_INIT_CLEANUP,
> +    .wrapper_name   = "libsvt_hevc",
> +};
> diff --git a/libavcodec/version.h b/libavcodec/version.h
> index 7ed6071..8773fee 100644
> --- a/libavcodec/version.h
> +++ b/libavcodec/version.h
> @@ -29,7 +29,7 @@
>  
>  #define LIBAVCODEC_VERSION_MAJOR  58
>  #define LIBAVCODEC_VERSION_MINOR  52
> -#define LIBAVCODEC_VERSION_MICRO 102
> +#define LIBAVCODEC_VERSION_MICRO 103
>  
>  #define LIBAVCODEC_VERSION_INT  AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \
>                                                 LIBAVCODEC_VERSION_MINOR, \
> 



More information about the ffmpeg-devel mailing list