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

2019-07-31 Thread Sun, Jing A
-Original Message-
From: ffmpeg-devel [mailto:ffmpeg-devel-boun...@ffmpeg.org] On Behalf Of James 
Almer
Sent: Wednesday, July 31, 2019 11:40 AM
To: ffmpeg-devel@ffmpeg.org
Subject: Re: [FFmpeg-devel] [PATCH v15 1/2] lavc/svt_hevc: add libsvt hevc 
encoder wrapper

> Simply remove the void* cast in the memset() line. "avctx->extradata +
> avctx->extradata_size" is acceptable as an argument.

Thanks James! It's modified and submitted as V16.

Regards,
Sun, Jing
___
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".

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

2019-07-31 Thread Sun, Jing A
-Original Message-
From: ffmpeg-devel [mailto:ffmpeg-devel-boun...@ffmpeg.org] On Behalf Of Li, 
Zhong
Sent: Wednesday, July 31, 2019 11:33 AM
To: FFmpeg development discussions and patches 
Subject: Re: [FFmpeg-devel] [PATCH v15 1/2] lavc/svt_hevc: add libsvt hevc 
encoder wrapper
 
> > > > +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,
> > > > +.close  = eb_enc_close,
> > > > +.capabilities   = AV_CODEC_CAP_DELAY |
> > > AV_CODEC_CAP_AUTO_THREADS,
> > >
> > > The code don't support to configure thread_count, so I think you'll 
> > > get the same result without AV_CODEC_CAP_AUTO_THREADS.
> > 
> > > This was pointed out by Mark Thompson on patch V4.
> > > It is a problem how comment can be well addressed and avoid to be
> > pointed out again and again.
> > 
> > I got started based on V5 and V6 is my first submission. Thanks for 
> > showing me the information. I am looking into it.
>It was also mentioned in svt-av1 patch 
>https://patchwork.ffmpeg.org/patch/13912/:
>* Expose threads setting since AV_CODEC_CAP_AUTO_THREADS declared 
>___



I checked out the history in https://patchwork.ffmpeg.org/patch/11347/:

Mark's remarks:
> +.capabilities   = AV_CODEC_CAP_DELAY | AV_CODEC_CAP_AUTO_THREADS,
Threads aren't actually mentioned at all above.  Does that mean the encoder 
will always make as many threads as it wants, and the user has no separate 
control?

And from the macro definition:
/**
 * Codec supports avctx->thread_count == 0 (auto).
 */
#define AV_CODEC_CAP_AUTO_THREADS(1 << 15)

static void validate_thread_parameters(AVCodecContext *avctx)
{
...
} else if (!(avctx->codec->capabilities & AV_CODEC_CAP_AUTO_THREADS)) {
avctx->thread_count   = 1;
avctx->active_thread_type = 0;
}
...
}

I think it's right to declare the codec with that capability as long as the 
codec indeed supports the auto thread count. It's not wrong that we have 
declared that. And to Mark's question, the answer is "Yes, the SVT HEVC encoder 
always makes as many threads as it wants". It checks the CPU cores and decides 
the count of working threads based on the number of cores to ensure the best 
performance, and by now users have no separate control on it.

We have been considering if we shall add such a controlling interface to SVT 
HEVC lib and how. The code lines of handling avctx->thread_count in this 
avcodec is possible to get added in the future. Right now, adding an empty 
interface without implementation supported by SVT HEVC lib makes no sense.
 
Regards,
Sun, Jing
___
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".

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

2019-07-30 Thread James Almer
On 7/30/2019 11:18 PM, Sun, Jing A wrote:
> -Original Message-
> From: ffmpeg-devel [mailto:ffmpeg-devel-boun...@ffmpeg.org] On Behalf Of 
> Limin Wang
> Sent: Wednesday, July 31, 2019 7:05 AM
> To: FFmpeg development discussions and patches 
> Subject: Re: [FFmpeg-devel] [PATCH v15 1/2] lavc/svt_hevc: add libsvt hevc 
> encoder wrapper
> 
> On Tue, Jul 30, 2019 at 07:48:43PM +0200, Carl Eugen Hoyos wrote:
>> Am Di., 30. Juli 2019 um 15:20 Uhr schrieb James Almer :
>>>
>>> On 7/30/2019 2:59 AM, Limin Wang wrote:
>>>>> +if (avctx->flags & AV_CODEC_FLAG_GLOBAL_HEADER) {
>>>>> +EB_BUFFERHEADERTYPE *header_ptr = NULL;
>>>>> +
>>>>> +svt_ret = EbH265EncStreamHeader(svt_enc->svt_handle, 
>>>>> _ptr);
>>>>> +if (svt_ret != EB_ErrorNone) {
>>>>> +av_log(avctx, AV_LOG_ERROR, "Failed to build stream 
>>>>> header\n");
>>>>> +goto failed_init_encoder;
>>>>> +}
>>>>> +
>>>>> +avctx->extradata_size = header_ptr->nFilledLen;
>>>>> +avctx->extradata = av_malloc(avctx->extradata_size + 
>>>>> + AV_INPUT_BUFFER_PADDING_SIZE);
>>>> It's preferalbe to use av_mallocz
>>>
>>> He was asked to do it this way as it's faster. No need to zero the 
>>> whole buffer if it's going to be written to immediately afterwards. 
>>> Only the trailing padding bytes needs to be zeroed.
>>
>> In this case I suspect there is an unneeded cast in the next line.
> 
>> It's very confusing to allocate with extra padding size, then memcpy the 
>> actual data size, then zero the padding data.
> 
>> IMO, the padding size is used for the bitstream optimized buffer read(32 or 
>> 64 bit for minimal at least). If it's memcpy, do we need malloc with extra 
>> AV_INPUT_BUFFER_PADDING_SIZE?
> 
> Thanks for everyone's advices and I am considering on how to make this not 
> confusing. Will update the patch later.
> BTW, it's a "she" :-).
> 
> Regards,
> Sun, Jing

Simply remove the void* cast in the memset() line. "avctx->extradata +
avctx->extradata_size" is acceptable as an argument.
___
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".

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

2019-07-30 Thread Li, Zhong
> From: ffmpeg-devel [mailto:ffmpeg-devel-boun...@ffmpeg.org] On Behalf
> Of Sun, Jing A
> Sent: Wednesday, July 31, 2019 10:16 AM
> To: FFmpeg development discussions and patches
> 
> Subject: Re: [FFmpeg-devel] [PATCH v15 1/2] lavc/svt_hevc: add libsvt hevc
> encoder wrapper
> 
> -Original Message-
> From: ffmpeg-devel [mailto:ffmpeg-devel-boun...@ffmpeg.org] On Behalf
> Of Li, Zhong
> Sent: Tuesday, July 30, 2019 3:49 PM
> To: FFmpeg development discussions and patches
> 
> Subject: Re: [FFmpeg-devel] [PATCH v15 1/2] lavc/svt_hevc: add libsvt hevc
> encoder wrapper
> 
> > > +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,
> > > +.close  = eb_enc_close,
> > > +.capabilities   = AV_CODEC_CAP_DELAY |
> > AV_CODEC_CAP_AUTO_THREADS,
> >
> > The code don't support to configure thread_count, so I think you'll
> > get the same result without AV_CODEC_CAP_AUTO_THREADS.
> 
> > This was pointed out by Mark Thompson on patch V4.
> > It is a problem how comment can be well addressed and avoid to be
> pointed out again and again.
> 
> I got started based on V5 and V6 is my first submission. Thanks for showing
> me the information. I am looking into it.

It was also mentioned in svt-av1 patch 
https://patchwork.ffmpeg.org/patch/13912/:
* Expose threads setting since AV_CODEC_CAP_AUTO_THREADS declared
___
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".

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

2019-07-30 Thread Sun, Jing A
-Original Message-
From: ffmpeg-devel [mailto:ffmpeg-devel-boun...@ffmpeg.org] On Behalf Of Limin 
Wang
Sent: Wednesday, July 31, 2019 7:05 AM
To: FFmpeg development discussions and patches 
Subject: Re: [FFmpeg-devel] [PATCH v15 1/2] lavc/svt_hevc: add libsvt hevc 
encoder wrapper

On Tue, Jul 30, 2019 at 07:48:43PM +0200, Carl Eugen Hoyos wrote:
> Am Di., 30. Juli 2019 um 15:20 Uhr schrieb James Almer :
> >
> > On 7/30/2019 2:59 AM, Limin Wang wrote:
> > >> +if (avctx->flags & AV_CODEC_FLAG_GLOBAL_HEADER) {
> > >> +EB_BUFFERHEADERTYPE *header_ptr = NULL;
> > >> +
> > >> +svt_ret = EbH265EncStreamHeader(svt_enc->svt_handle, 
> > >> _ptr);
> > >> +if (svt_ret != EB_ErrorNone) {
> > >> +av_log(avctx, AV_LOG_ERROR, "Failed to build stream 
> > >> header\n");
> > >> +goto failed_init_encoder;
> > >> +}
> > >> +
> > >> +avctx->extradata_size = header_ptr->nFilledLen;
> > >> +avctx->extradata = av_malloc(avctx->extradata_size + 
> > >> + AV_INPUT_BUFFER_PADDING_SIZE);
> > > It's preferalbe to use av_mallocz
> >
> > He was asked to do it this way as it's faster. No need to zero the 
> > whole buffer if it's going to be written to immediately afterwards. 
> > Only the trailing padding bytes needs to be zeroed.
> 
> In this case I suspect there is an unneeded cast in the next line.

> It's very confusing to allocate with extra padding size, then memcpy the 
> actual data size, then zero the padding data.

> IMO, the padding size is used for the bitstream optimized buffer read(32 or 
> 64 bit for minimal at least). If it's memcpy, do we need malloc with extra 
> AV_INPUT_BUFFER_PADDING_SIZE?

Thanks for everyone's advices and I am considering on how to make this not 
confusing. Will update the patch later.
BTW, it's a "she" :-).

Regards,
Sun, Jing

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

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

2019-07-30 Thread Sun, Jing A
-Original Message-
From: ffmpeg-devel [mailto:ffmpeg-devel-boun...@ffmpeg.org] On Behalf Of Li, 
Zhong
Sent: Tuesday, July 30, 2019 3:49 PM
To: FFmpeg development discussions and patches 
Subject: Re: [FFmpeg-devel] [PATCH v15 1/2] lavc/svt_hevc: add libsvt hevc 
encoder wrapper

> > +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,
> > +.close  = eb_enc_close,
> > +.capabilities   = AV_CODEC_CAP_DELAY |
> AV_CODEC_CAP_AUTO_THREADS,
> 
> The code don't support to configure thread_count, so I think you'll 
> get the same result without AV_CODEC_CAP_AUTO_THREADS.

> This was pointed out by Mark Thompson on patch V4. 
> It is a problem how comment can be well addressed and avoid to be pointed out 
> again and again. 

I got started based on V5 and V6 is my first submission. Thanks for showing me 
the information. I am looking into it. 

Regards,
Sun, Jing

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

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

2019-07-30 Thread Limin Wang
On Tue, Jul 30, 2019 at 07:48:43PM +0200, Carl Eugen Hoyos wrote:
> Am Di., 30. Juli 2019 um 15:20 Uhr schrieb James Almer :
> >
> > On 7/30/2019 2:59 AM, Limin Wang wrote:
> > >> +if (avctx->flags & AV_CODEC_FLAG_GLOBAL_HEADER) {
> > >> +EB_BUFFERHEADERTYPE *header_ptr = NULL;
> > >> +
> > >> +svt_ret = EbH265EncStreamHeader(svt_enc->svt_handle, 
> > >> _ptr);
> > >> +if (svt_ret != EB_ErrorNone) {
> > >> +av_log(avctx, AV_LOG_ERROR, "Failed to build stream 
> > >> header\n");
> > >> +goto failed_init_encoder;
> > >> +}
> > >> +
> > >> +avctx->extradata_size = header_ptr->nFilledLen;
> > >> +avctx->extradata = av_malloc(avctx->extradata_size + 
> > >> AV_INPUT_BUFFER_PADDING_SIZE);
> > > It's preferalbe to use av_mallocz
> >
> > He was asked to do it this way as it's faster. No need to zero the whole
> > buffer if it's going to be written to immediately afterwards. Only the
> > trailing padding bytes needs to be zeroed.
> 
> In this case I suspect there is an unneeded cast in the next line.

It's very confusing to allocate with extra padding size, then memcpy the
actual data size, then zero the padding data.

IMO, the padding size is used for the bitstream optimized buffer read(32 or 64
bit for minimal at least). If it's memcpy, do we need malloc with extra 
AV_INPUT_BUFFER_PADDING_SIZE?


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

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

2019-07-30 Thread Limin Wang
On Tue, Jul 30, 2019 at 07:48:43PM +0200, Carl Eugen Hoyos wrote:
> Am Di., 30. Juli 2019 um 15:20 Uhr schrieb James Almer :
> >
> > On 7/30/2019 2:59 AM, Limin Wang wrote:
> > >> +if (avctx->flags & AV_CODEC_FLAG_GLOBAL_HEADER) {
> > >> +EB_BUFFERHEADERTYPE *header_ptr = NULL;
> > >> +
> > >> +svt_ret = EbH265EncStreamHeader(svt_enc->svt_handle, 
> > >> _ptr);
> > >> +if (svt_ret != EB_ErrorNone) {
> > >> +av_log(avctx, AV_LOG_ERROR, "Failed to build stream 
> > >> header\n");
> > >> +goto failed_init_encoder;
> > >> +}
> > >> +
> > >> +avctx->extradata_size = header_ptr->nFilledLen;
> > >> +avctx->extradata = av_malloc(avctx->extradata_size + 
> > >> AV_INPUT_BUFFER_PADDING_SIZE);
> > > It's preferalbe to use av_mallocz
> >
> > He was asked to do it this way as it's faster. No need to zero the whole
> > buffer if it's going to be written to immediately afterwards. Only the
> > trailing padding bytes needs to be zeroed.
> 
> In this case I suspect there is an unneeded cast in the next line.

FYI:
libavcodec/avcodec.h comments for the extradata_size
  * The allocated memory should be AV_INPUT_BUFFER_PADDING_SIZE bytes larger
  * than extradata_size to avoid problems if it is read with the bitstream 
reader.
  * The bytewise contents of extradata must not depend on the architecture 
or CPU endianness.
  * Must be allocated with the av_malloc() family of functions.


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

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

2019-07-30 Thread Carl Eugen Hoyos
Am Di., 30. Juli 2019 um 15:20 Uhr schrieb James Almer :
>
> On 7/30/2019 2:59 AM, Limin Wang wrote:
> >> +if (avctx->flags & AV_CODEC_FLAG_GLOBAL_HEADER) {
> >> +EB_BUFFERHEADERTYPE *header_ptr = NULL;
> >> +
> >> +svt_ret = EbH265EncStreamHeader(svt_enc->svt_handle, _ptr);
> >> +if (svt_ret != EB_ErrorNone) {
> >> +av_log(avctx, AV_LOG_ERROR, "Failed to build stream 
> >> header\n");
> >> +goto failed_init_encoder;
> >> +}
> >> +
> >> +avctx->extradata_size = header_ptr->nFilledLen;
> >> +avctx->extradata = av_malloc(avctx->extradata_size + 
> >> AV_INPUT_BUFFER_PADDING_SIZE);
> > It's preferalbe to use av_mallocz
>
> He was asked to do it this way as it's faster. No need to zero the whole
> buffer if it's going to be written to immediately afterwards. Only the
> trailing padding bytes needs to be zeroed.

In this case I suspect there is an unneeded cast in the next line.

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

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

2019-07-30 Thread James Almer
On 7/30/2019 2:59 AM, Limin Wang wrote:
>> +if (avctx->flags & AV_CODEC_FLAG_GLOBAL_HEADER) {
>> +EB_BUFFERHEADERTYPE *header_ptr = NULL;
>> +
>> +svt_ret = EbH265EncStreamHeader(svt_enc->svt_handle, _ptr);
>> +if (svt_ret != EB_ErrorNone) {
>> +av_log(avctx, AV_LOG_ERROR, "Failed to build stream header\n");
>> +goto failed_init_encoder;
>> +}
>> +
>> +avctx->extradata_size = header_ptr->nFilledLen;
>> +avctx->extradata = av_malloc(avctx->extradata_size + 
>> AV_INPUT_BUFFER_PADDING_SIZE);
> It's preferalbe to use av_mallocz

He was asked to do it this way as it's faster. No need to zero the whole
buffer if it's going to be written to immediately afterwards. Only the
trailing padding bytes needs to be zeroed.
___
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".

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

2019-07-30 Thread Li, Zhong
> > +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,
> > +.close  = eb_enc_close,
> > +.capabilities   = AV_CODEC_CAP_DELAY |
> AV_CODEC_CAP_AUTO_THREADS,
> 
> The code don't support to configure thread_count, so I think you'll get the
> same result without AV_CODEC_CAP_AUTO_THREADS.

This was pointed out by Mark Thompson on patch V4. 
It is a problem how comment can be well addressed and avoid to be pointed out 
again and again. 
___
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".

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

2019-07-30 Thread Limin Wang
On Mon, Jul 29, 2019 at 03:50:36PM +0800, Jing Sun wrote:
> 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 

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

2019-07-29 Thread Sun, Jing A
The just updated one fixed such typo:
  .pix_fmts   = (const enum AVPixelFormat[]){ AV_PIX_FMT_YUV420P,
  AV_PIX_FMT_YUV420P10,
  AV_PIX_FMT_YUV422P,
- AV_PIX_FMT_YUV420P10,
+AV_PIX_FMT_YUV422P10,
  AV_PIX_FMT_YUV444P,
  AV_PIX_FMT_YUV444P10,
  AV_PIX_FMT_NONE },

Regards,
Sun, Jing
___
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 v15 1/2] lavc/svt_hevc: add libsvt hevc encoder wrapper

2019-07-29 Thread Jing Sun
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 = 0,
+EOS_SENT,
+EOS_RECEIVED
+}EOS_STATUS;
+
+typedef struct SvtContext {
+AVClass *class;
+
+EB_H265_ENC_CONFIGURATION enc_params;
+EB_COMPONENTTYPE *svt_handle;
+EB_BUFFERHEADERTYPE in_buf;
+EOS_STATUS eos_flag;

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

2019-06-25 Thread Jing Sun
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 = 0,
+EOS_SENT,
+EOS_RECEIVED
+}EOS_STATUS;
+
+typedef struct SvtContext {
+AVClass *class;
+
+EB_H265_ENC_CONFIGURATION enc_params;
+EB_COMPONENTTYPE *svt_handle;
+EB_BUFFERHEADERTYPE in_buf;
+EOS_STATUS eos_flag;