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

James Almer jamrial at gmail.com
Mon Dec 3 04:10:36 EET 2018


On 12/2/2018 10:59 PM, mypopy at gmail.com wrote:
> On Sun, Dec 2, 2018 at 10:19 PM James Almer <jamrial at gmail.com> wrote:
>>
>> On 12/2/2018 2:38 AM, Jun Zhao wrote:
>>> base on patch by Huang, Zhengxu from https://github.com/intel/SVT-HEVC
>>>
>>> Signed-off-by: Huang, Zhengxu <zhengxu.huang at intel.com>
>>> Signed-off-by: hassene <hassene.tmar at intel.com>
>>> Signed-off-by: Jun Zhao <jun.zhao at intel.com>
>>> ---
>>>  configure                |    4 +
>>>  libavcodec/Makefile      |    1 +
>>>  libavcodec/allcodecs.c   |    1 +
>>>  libavcodec/libsvt_hevc.c |  370
> ++++++++++++++++++++++++++++++++++++++++++++++
>>>  4 files changed, 376 insertions(+), 0 deletions(-)
>>>  create mode 100644 libavcodec/libsvt_hevc.c
>>>
>>> diff --git a/configure b/configure
>>> index 54b7e11..c3dca73 100755
>>> --- a/configure
>>> +++ b/configure
>>> @@ -263,6 +263,7 @@ External library support:
>>>    --enable-libspeex        enable Speex de/encoding via libspeex [no]
>>>    --enable-libsrt          enable Haivision SRT protocol via libsrt
> [no]
>>>    --enable-libssh           enable SFTP protocol via libssh [no]
>>> +  --enable-libsvt          enable HEVC encoding via svt [no]
>>>    --enable-libtensorflow   enable TensorFlow as a DNN module backend
>>>                             for DNN based filters like sr [no]
>>>    --enable-libtesseract    enable Tesseract, needed for ocr filter [no]
>>> @@ -1665,6 +1666,7 @@ EXTERNAL_LIBRARY_GPL_LIST="
>>>      libcdio
>>>      libdavs2
>>>      librubberband
>>> +    libsvt
>>>      libvidstab
>>>      libx264
>>>      libx265
>>> @@ -3087,6 +3089,7 @@ pcm_mulaw_at_encoder_select="audio_frame_queue"
>>>  chromaprint_muxer_deps="chromaprint"
>>>  h264_videotoolbox_encoder_deps="pthreads"
>>>  h264_videotoolbox_encoder_select="videotoolbox_encoder"
>>> +hevc_svt_encoder_deps="libsvt"
>>
>> Since this is an external library based encoder, the correct name would
>> be libsvt_encoder.
>> You can also make it libsvt_hevc_encoder instead, which is what you used
>> as AVCodec.name.
>>
> I perfer  libsvt_hevc_encoder than libsvt_encoder, because maybe we will
> have libsvt_{av1/vp9/xxx}_encoder in the future.

Sounds good.

[...]

>>> +AVCodec ff_hevc_svt_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,
>>> +    .send_frame     = eb_send_frame,
>>> +    .receive_packet = eb_receive_packet,
>>
>> Keep in mind that, at least for now and unlike with the decoupled
>> input-output decode API, if you only provide a send/receive callback
>> then the encoder will not work with avcodec_encode_video2(), only with
>> avcodec_send_frame() and avcodec_receive_packet().
>>
> Because avcodec_encode_video2() flags with deprecated, so I think is Ok if
> we don't implement the encode2 callback.
> 
> BTW: What's the reason we don't use avcodec_send_frame() and
> avcodec_receive_packet() in avcodec_encode_video2() like use
> avcodec_send_packet() and avcodec_receive_frame() in avcodec_decode_video2()
> ?

Because nobody implemented it yet, simple as that. The encoder
equivalent of 061a0c14bb needs to be written.

> 
> 
>>> +    .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_NONE },
>>> +    .priv_class     = &class,
>>> +    .defaults       = eb_enc_defaults,
>>> +    .caps_internal  = FF_CODEC_CAP_INIT_CLEANUP,
>>> +    .wrapper_name   = "libsvt_hevc",
>>> +};
>>>
>>
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel at ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> 



More information about the ffmpeg-devel mailing list