Re: [libav-devel] [PATCH] qsv: Make the hevc idr_interval consistent with the h264 one

2017-10-18 Thread Maxym Dmytrychenko
technical aspect(s) should be ok

thanks, Luca

On Wed, Oct 18, 2017 at 3:29 AM, Diego Biurrun  wrote:

> On Tue, Oct 17, 2017 at 11:49:57AM +, Luca Barbato wrote:
> > According to the MediaSDK documentation the idr_interval value has
> > a different meaning depending on the codec:
> >
> > 0 in H264 means make every I-frame IDR, in HEVC means to have
> > it only at the beginning.
>
> it means
>
> > 1 in H264 means every other I-frame is not-IDR, in HEVC means
> > that every I-frame is IDR.
>
> it means
>
> > Increase by 1 idr_interval for hevc and support -1 with a constant
> > name to provide a mean to have the only-at-beginning behaviour if
> > really need.
> >
> > Keep the default consistent between the two encoders.
>
> Keep the default consistent between the two encoders. Make 1 the default
> for HEVC and provide a shorthand option to set idr_interval to 0 for HEVC.
>
> > --- a/libavcodec/qsvenc_hevc.c
> > +++ b/libavcodec/qsvenc_hevc.c
> > @@ -220,7 +223,8 @@ static av_cold int qsv_enc_close(AVCodecContext
> *avctx)
> >
> > -{ "idr_interval", "Distance (in I-frames) between IDR frames",
> OFFSET(qsv.idr_interval), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, INT_MAX, VE },
> > +{ "idr_interval", "Distance (in I-frames) between IDR frames",
> OFFSET(qsv.idr_interval), AV_OPT_TYPE_INT, { .i64 = 0 }, -1, INT_MAX, VE,
> "idr_interval" },
> > +{ "begin_only", "Output an IDR-frame only at the begin of the
> stream", 0, AV_OPT_TYPE_CONST, { .i64 = -1 }, 0, 0, VE, "idr_interval" },
>
> only at the beginning of the stream
>
> Diego
> ___
> libav-devel mailing list
> libav-devel@libav.org
> https://lists.libav.org/mailman/listinfo/libav-devel
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel

Re: [libav-devel] [PATCH] qsv: Make the hevc idr_interval consistent with the h264 one

2017-10-17 Thread Diego Biurrun
On Tue, Oct 17, 2017 at 11:49:57AM +, Luca Barbato wrote:
> According to the MediaSDK documentation the idr_interval value has
> a different meaning depending on the codec:
> 
> 0 in H264 means make every I-frame IDR, in HEVC means to have
> it only at the beginning.

it means

> 1 in H264 means every other I-frame is not-IDR, in HEVC means
> that every I-frame is IDR.

it means

> Increase by 1 idr_interval for hevc and support -1 with a constant
> name to provide a mean to have the only-at-beginning behaviour if
> really need.
>
> Keep the default consistent between the two encoders.

Keep the default consistent between the two encoders. Make 1 the default
for HEVC and provide a shorthand option to set idr_interval to 0 for HEVC.

> --- a/libavcodec/qsvenc_hevc.c
> +++ b/libavcodec/qsvenc_hevc.c
> @@ -220,7 +223,8 @@ static av_cold int qsv_enc_close(AVCodecContext *avctx)
>  
> -{ "idr_interval", "Distance (in I-frames) between IDR frames", 
> OFFSET(qsv.idr_interval), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, INT_MAX, VE },
> +{ "idr_interval", "Distance (in I-frames) between IDR frames", 
> OFFSET(qsv.idr_interval), AV_OPT_TYPE_INT, { .i64 = 0 }, -1, INT_MAX, VE, 
> "idr_interval" },
> +{ "begin_only", "Output an IDR-frame only at the begin of the stream", 
> 0, AV_OPT_TYPE_CONST, { .i64 = -1 }, 0, 0, VE, "idr_interval" },

only at the beginning of the stream

Diego
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel

[libav-devel] [PATCH] qsv: Make the hevc idr_interval consistent with the h264 one

2017-10-17 Thread Luca Barbato
According to the MediaSDK documentation the idr_interval value has
a different meaning depending on the codec:

0 in H264 means make every I-frame IDR, in HEVC means to have
it only at the beginning.

1 in H264 means every other I-frame is not-IDR, in HEVC means
that every I-frame is IDR.

Increase by 1 idr_interval for hevc and support -1 with a constant
name to provide a mean to have the only-at-beginning behaviour if
really need.

Keep the default consistent between the two encoders.
---
 libavcodec/qsvenc_hevc.c | 6 +-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/libavcodec/qsvenc_hevc.c b/libavcodec/qsvenc_hevc.c
index fb65d58c32..7a8545fced 100644
--- a/libavcodec/qsvenc_hevc.c
+++ b/libavcodec/qsvenc_hevc.c
@@ -181,6 +181,9 @@ static av_cold int qsv_enc_init(AVCodecContext *avctx)
 }
 }
 
+// HEVC and H264 meaning of the value is shifted by 1, make it consistent
+q->qsv.idr_interval++;
+
 ret = ff_qsv_enc_init(avctx, &q->qsv);
 if (ret < 0)
 return ret;
@@ -220,7 +223,8 @@ static av_cold int qsv_enc_close(AVCodecContext *avctx)
 static const AVOption options[] = {
 QSV_COMMON_OPTS
 
-{ "idr_interval", "Distance (in I-frames) between IDR frames", 
OFFSET(qsv.idr_interval), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, INT_MAX, VE },
+{ "idr_interval", "Distance (in I-frames) between IDR frames", 
OFFSET(qsv.idr_interval), AV_OPT_TYPE_INT, { .i64 = 0 }, -1, INT_MAX, VE, 
"idr_interval" },
+{ "begin_only", "Output an IDR-frame only at the begin of the stream", 0, 
AV_OPT_TYPE_CONST, { .i64 = -1 }, 0, 0, VE, "idr_interval" },
 { "load_plugin", "A user plugin to load in an internal session", 
OFFSET(load_plugin), AV_OPT_TYPE_INT, { .i64 = LOAD_PLUGIN_DEFAULT }, 
LOAD_PLUGIN_NONE, LOAD_PLUGIN_HEVC_HW, VE, "load_plugin" },
 { "none", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = LOAD_PLUGIN_NONE },
0, 0, VE, "load_plugin" },
 { "hevc_sw",  NULL, 0, AV_OPT_TYPE_CONST, { .i64 = LOAD_PLUGIN_HEVC_SW }, 
0, 0, VE, "load_plugin" },
-- 
2.11.1

___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel