Re: [FFmpeg-devel] [PATCH] nvenc set slice number to 1 to improve encoding quality and clamp initial qp value to [1, 51]

2015-12-14 Thread Timo Rothenpieler
> No, it won't affect performance, we did lots of internal tests, mainly
> focused on quality improvement. But if it makes performance worse we
> won't apply it anyway.

Split and applied, thanks.

> Agatha Hu
> 
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel



signature.asc
Description: OpenPGP digital signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] nvenc set slice number to 1 to improve encoding quality and clamp initial qp value to [1, 51]

2015-12-13 Thread Agatha Hu

On 2015/12/11 17:20, Timo Rothenpieler wrote:

* PGP Signed by an unknown key


Hi all, before switching to the new released nvenc6.0 header, can you
take a look at this fix?


I'm fine with making it the default, the only concern i have is weather
it has any side-effects, like reduced performance that impacts some
higher resolutions which can't be encoded in realtime anymore.

If that's not the case, this LGTM.

No, it won't affect performance, we did lots of internal tests, mainly 
focused on quality improvement. But if it makes performance worse we 
won't apply it anyway.


Agatha Hu

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] nvenc set slice number to 1 to improve encoding quality and clamp initial qp value to [1, 51]

2015-12-11 Thread Timo Rothenpieler
> Hi all, before switching to the new released nvenc6.0 header, can you
> take a look at this fix?

I'm fine with making it the default, the only concern i have is weather
it has any side-effects, like reduced performance that impacts some
higher resolutions which can't be encoded in realtime anymore.

If that's not the case, this LGTM.

> Agatha Hu
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel



signature.asc
Description: OpenPGP digital signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] nvenc set slice number to 1 to improve encoding quality and clamp initial qp value to [1, 51]

2015-12-10 Thread Agatha Hu

On 2015/12/11 11:10, Agatha Hu wrote:


---
  libavcodec/nvenc.c | 19 +++
  1 file changed, 15 insertions(+), 4 deletions(-)

diff --git a/libavcodec/nvenc.c b/libavcodec/nvenc.c
index 43b8e78..6365434 100644
--- a/libavcodec/nvenc.c
+++ b/libavcodec/nvenc.c
@@ -762,6 +762,17 @@ static av_cold int nvenc_encode_init(AVCodecContext
*avctx)
  }
  }

+switch (avctx->codec->id) {
+case AV_CODEC_ID_H264:
+ctx->encode_config.encodeCodecConfig.h264Config.sliceMode = 3;
+ctx->encode_config.encodeCodecConfig.h264Config.sliceModeData = 1;
+break;
+case AV_CODEC_ID_H265:
+ctx->encode_config.encodeCodecConfig.hevcConfig.sliceMode = 3;
+ctx->encode_config.encodeCodecConfig.hevcConfig.sliceModeData = 1;
+break;
+}
+
  /* when there're b frames, set dts offset */
  if (ctx->encode_config.frameIntervalP >= 2)
  ctx->last_dts = -2;
@@ -843,10 +854,10 @@ static av_cold int
nvenc_encode_init(AVCodecContext *avctx)
  ctx->encode_config.rcParams.initialRCQP.qpInterP  = qp_inter_p;

  if(avctx->i_quant_factor != 0.0 && avctx->b_quant_factor !=
0.0) {
-ctx->encode_config.rcParams.initialRCQP.qpIntra =
qp_inter_p * fabs(avctx->i_quant_factor);
-ctx->encode_config.rcParams.initialRCQP.qpIntra +=
avctx->i_quant_offset;
-ctx->encode_config.rcParams.initialRCQP.qpInterB =
qp_inter_p * fabs(avctx->b_quant_factor);
-ctx->encode_config.rcParams.initialRCQP.qpInterB +=
avctx->b_quant_offset;
+ctx->encode_config.rcParams.initialRCQP.qpIntra = av_clip(
+qp_inter_p * fabs(avctx->i_quant_factor) +
avctx->i_quant_offset, 0, 51);
+ctx->encode_config.rcParams.initialRCQP.qpInterB = av_clip(
+qp_inter_p * fabs(avctx->b_quant_factor) +
avctx->b_quant_offset, 0, 51);
  } else {
  ctx->encode_config.rcParams.initialRCQP.qpIntra = qp_inter_p;
  ctx->encode_config.rcParams.initialRCQP.qpInterB =
qp_inter_p;


Hi all, before switching to the new released nvenc6.0 header, can you 
take a look at this fix?


Agatha Hu
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel