diff mbox

[FFmpeg-devel,1/2] lavc/vaapi_encode_mpeg2: add support for CBR/VBR

Message ID 20190116143401.9419-1-linjie.fu@intel.com
State New
Headers show

Commit Message

Fu, Linjie Jan. 16, 2019, 2:34 p.m. UTC
Add support for VBR/CBR mode in mpeg2_vaapi encode.

Fix #7650.

Signed-off-by: Linjie Fu <linjie.fu@intel.com>
---
 libavcodec/vaapi_encode_mpeg2.c | 7 +++++++
 1 file changed, 7 insertions(+)

Comments

Mark Thompson Jan. 23, 2019, 11:34 p.m. UTC | #1
On 16/01/2019 14:34, Linjie Fu wrote:
> Add support for VBR/CBR mode in mpeg2_vaapi encode.
> 
> Fix #7650.
> 
> Signed-off-by: Linjie Fu <linjie.fu@intel.com>
> ---
>  libavcodec/vaapi_encode_mpeg2.c | 7 +++++++
>  1 file changed, 7 insertions(+)
> 
> diff --git a/libavcodec/vaapi_encode_mpeg2.c b/libavcodec/vaapi_encode_mpeg2.c
> index 22d7e306bb..a625b15461 100644
> --- a/libavcodec/vaapi_encode_mpeg2.c
> +++ b/libavcodec/vaapi_encode_mpeg2.c
> @@ -541,6 +541,13 @@ static av_cold int vaapi_encode_mpeg2_configure(AVCodecContext *avctx)
>                 "%d / %d / %d for I- / P- / B-frames.\n",
>                 priv->quant_i, priv->quant_p, priv->quant_b);
>  
> +    } else if (ctx->va_rc_mode == VA_RC_CBR ||
> +               ctx->va_rc_mode == VA_RC_VBR) {
> +        // These still need to be set for quantiser_scale_code.
> +        priv->quant_i = 10;
> +        priv->quant_p = 10;
> +        priv->quant_b = 10;
> +
>      } else {
>          av_assert0(0 && "Invalid RC mode.");
>      }
> 

See existing patch <https://lists.ffmpeg.org/pipermail/ffmpeg-devel/2018-December/237943.html>.  I'll send a new version of the remainder of that series soon.

- Mark
Fu, Linjie Jan. 24, 2019, 1:38 a.m. UTC | #2
> -----Original Message-----

> From: ffmpeg-devel [mailto:ffmpeg-devel-bounces@ffmpeg.org] On Behalf

> Of Mark Thompson

> Sent: Thursday, January 24, 2019 07:35

> To: ffmpeg-devel@ffmpeg.org

> Subject: Re: [FFmpeg-devel] [PATCH 1/2] lavc/vaapi_encode_mpeg2: add

> support for CBR/VBR

> 

> On 16/01/2019 14:34, Linjie Fu wrote:

> > Add support for VBR/CBR mode in mpeg2_vaapi encode.

> >

> > Fix #7650.

> >

> > Signed-off-by: Linjie Fu <linjie.fu@intel.com>

> > ---

> >  libavcodec/vaapi_encode_mpeg2.c | 7 +++++++

> >  1 file changed, 7 insertions(+)

> >

> > diff --git a/libavcodec/vaapi_encode_mpeg2.c

> b/libavcodec/vaapi_encode_mpeg2.c

> > index 22d7e306bb..a625b15461 100644

> > --- a/libavcodec/vaapi_encode_mpeg2.c

> > +++ b/libavcodec/vaapi_encode_mpeg2.c

> > @@ -541,6 +541,13 @@ static av_cold int

> vaapi_encode_mpeg2_configure(AVCodecContext *avctx)

> >                 "%d / %d / %d for I- / P- / B-frames.\n",

> >                 priv->quant_i, priv->quant_p, priv->quant_b);

> >

> > +    } else if (ctx->va_rc_mode == VA_RC_CBR ||

> > +               ctx->va_rc_mode == VA_RC_VBR) {

> > +        // These still need to be set for quantiser_scale_code.

> > +        priv->quant_i = 10;

> > +        priv->quant_p = 10;

> > +        priv->quant_b = 10;

> > +

> >      } else {

> >          av_assert0(0 && "Invalid RC mode.");

> >      }

> >

> 

> See existing patch <https://lists.ffmpeg.org/pipermail/ffmpeg-devel/2018-

> December/237943.html>.  I'll send a new version of the remainder of that

> series soon.

> 

> - Mark


Seen, next time I'll check the existing patch list first for the issues in trac.
Thanks.
diff mbox

Patch

diff --git a/libavcodec/vaapi_encode_mpeg2.c b/libavcodec/vaapi_encode_mpeg2.c
index 22d7e306bb..a625b15461 100644
--- a/libavcodec/vaapi_encode_mpeg2.c
+++ b/libavcodec/vaapi_encode_mpeg2.c
@@ -541,6 +541,13 @@  static av_cold int vaapi_encode_mpeg2_configure(AVCodecContext *avctx)
                "%d / %d / %d for I- / P- / B-frames.\n",
                priv->quant_i, priv->quant_p, priv->quant_b);
 
+    } else if (ctx->va_rc_mode == VA_RC_CBR ||
+               ctx->va_rc_mode == VA_RC_VBR) {
+        // These still need to be set for quantiser_scale_code.
+        priv->quant_i = 10;
+        priv->quant_p = 10;
+        priv->quant_b = 10;
+
     } else {
         av_assert0(0 && "Invalid RC mode.");
     }