diff mbox

[FFmpeg-devel] avcodec/libx265: apply lavc maxrate and bufsize

Message ID 3c1965c0-caf0-af66-9577-8ea3d62cb9fb@gmail.com
State Superseded
Headers show

Commit Message

Gyan June 13, 2018, 1:38 p.m. UTC
Default for both parameters in both libs is 0.

Regards,
Gyan
From f875734cc5a1652162156118864db406b192526b Mon Sep 17 00:00:00 2001
From: Gyan Doshi <ffmpeg@gyani.pro>
Date: Wed, 13 Jun 2018 19:01:17 +0530
Subject: [PATCH] avcodec/libx265: apply lavc maxrate and bufsize

CLI options -maxrate and -bufsize are now picked up by the x265 wrapper
---
 libavcodec/libx265.c | 3 +++
 libavcodec/version.h | 2 +-
 2 files changed, 4 insertions(+), 1 deletion(-)

Comments

Gyan June 15, 2018, 4:20 p.m. UTC | #1
On 13-06-2018 07:08 PM, Gyan Doshi wrote:
> Default for both parameters in both libs is 0.

Ping.
Gyan June 17, 2018, 7:53 a.m. UTC | #2
On 15-06-2018 09:50 PM, Gyan Doshi wrote:
> 
> 
> On 13-06-2018 07:08 PM, Gyan Doshi wrote:
>> Default for both parameters in both libs is 0.
> 
> Ping.

Will push in a day.
Mark Thompson June 17, 2018, 3:41 p.m. UTC | #3
On 13/06/18 14:38, Gyan Doshi wrote:
> Default for both parameters in both libs is 0.
> 
> Regards,
> Gyan
> 
> From f875734cc5a1652162156118864db406b192526b Mon Sep 17 00:00:00 2001
> From: Gyan Doshi <ffmpeg@gyani.pro>
> Date: Wed, 13 Jun 2018 19:01:17 +0530
> Subject: [PATCH] avcodec/libx265: apply lavc maxrate and bufsize
> 
> CLI options -maxrate and -bufsize are now picked up by the x265 wrapper
> ---
>  libavcodec/libx265.c | 3 +++
>  libavcodec/version.h | 2 +-
>  2 files changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/libavcodec/libx265.c b/libavcodec/libx265.c
> index bb457dfe5a..6c6fd88602 100644
> --- a/libavcodec/libx265.c
> +++ b/libavcodec/libx265.c
> @@ -205,6 +205,9 @@ static av_cold int libx265_encode_init(AVCodecContext *avctx)
>          ctx->params->rc.rateControlMode = X265_RC_ABR;
>      }
>  
> +    ctx->params->rc.vbvBufferSize = avctx->rc_buffer_size / 1000;
> +    ctx->params->rc.vbvMaxBitrate = avctx->rc_max_rate    / 1000;
> +
>      if (!(avctx->flags & AV_CODEC_FLAG_GLOBAL_HEADER))
>          ctx->params->bRepeatHeaders = 1;
>  
> diff --git a/libavcodec/version.h b/libavcodec/version.h
> index 5e71b48816..219f56c37d 100644
> --- a/libavcodec/version.h
> +++ b/libavcodec/version.h
> @@ -29,7 +29,7 @@
>  
>  #define LIBAVCODEC_VERSION_MAJOR  58
>  #define LIBAVCODEC_VERSION_MINOR  20
> -#define LIBAVCODEC_VERSION_MICRO 101
> +#define LIBAVCODEC_VERSION_MICRO 102
>  
>  #define LIBAVCODEC_VERSION_INT  AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \
>                                                 LIBAVCODEC_VERSION_MINOR, \
> -- 
> 2.12.2.windows.2

Given you have these two, maybe set vbvBufferInit from rc_initial_buffer_occupancy as well?

LGTM in either case.

Thanks,

- Mark
diff mbox

Patch

diff --git a/libavcodec/libx265.c b/libavcodec/libx265.c
index bb457dfe5a..6c6fd88602 100644
--- a/libavcodec/libx265.c
+++ b/libavcodec/libx265.c
@@ -205,6 +205,9 @@  static av_cold int libx265_encode_init(AVCodecContext *avctx)
         ctx->params->rc.rateControlMode = X265_RC_ABR;
     }
 
+    ctx->params->rc.vbvBufferSize = avctx->rc_buffer_size / 1000;
+    ctx->params->rc.vbvMaxBitrate = avctx->rc_max_rate    / 1000;
+
     if (!(avctx->flags & AV_CODEC_FLAG_GLOBAL_HEADER))
         ctx->params->bRepeatHeaders = 1;
 
diff --git a/libavcodec/version.h b/libavcodec/version.h
index 5e71b48816..219f56c37d 100644
--- a/libavcodec/version.h
+++ b/libavcodec/version.h
@@ -29,7 +29,7 @@ 
 
 #define LIBAVCODEC_VERSION_MAJOR  58
 #define LIBAVCODEC_VERSION_MINOR  20
-#define LIBAVCODEC_VERSION_MICRO 101
+#define LIBAVCODEC_VERSION_MICRO 102
 
 #define LIBAVCODEC_VERSION_INT  AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \
                                                LIBAVCODEC_VERSION_MINOR, \