diff mbox

[FFmpeg-devel] lavc/vaapi_encode_mpeg2: fix frame rate calc error when use, time_base.

Message ID 1bf9875e-1fb9-6992-7e15-efaf420b790f@gmail.com
State Accepted
Commit a918f16f7ccc7eb75330c97036888cf05c14b311
Headers show

Commit Message

Jun Zhao Sept. 6, 2017, 3:14 a.m. UTC
From a6f3aaa9c1ff6d35d19eef587a49c04916fceca1 Mon Sep 17 00:00:00 2001
From: Jun Zhao <jun.zhao@intel.com>
Date: Tue, 5 Sep 2017 23:07:15 -0400
Subject: [PATCH] lavc/vaapi_encode_mpeg2: fix frame rate calc error when use
 time_base.

fix frame rate calc error when use time_base.

Signed-off-by: Yun Zhou <yunx.z.zhou@intel.com>
Signed-off-by: Jun Zhao <jun.zhao@intel.com>
---
 libavcodec/vaapi_encode_mpeg2.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Mark Thompson Sept. 9, 2017, 10:34 a.m. UTC | #1
On 06/09/17 04:14, Jun Zhao wrote:
> From a6f3aaa9c1ff6d35d19eef587a49c04916fceca1 Mon Sep 17 00:00:00 2001
> From: Jun Zhao <jun.zhao@intel.com>
> Date: Tue, 5 Sep 2017 23:07:15 -0400
> Subject: [PATCH] lavc/vaapi_encode_mpeg2: fix frame rate calc error when use
>  time_base.
> 
> fix frame rate calc error when use time_base.
> 
> Signed-off-by: Yun Zhou <yunx.z.zhou@intel.com>
> Signed-off-by: Jun Zhao <jun.zhao@intel.com>
> ---
>  libavcodec/vaapi_encode_mpeg2.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/libavcodec/vaapi_encode_mpeg2.c b/libavcodec/vaapi_encode_mpeg2.c
> index fbddfa5d5a..dc918884e8 100644
> --- a/libavcodec/vaapi_encode_mpeg2.c
> +++ b/libavcodec/vaapi_encode_mpeg2.c
> @@ -208,7 +208,7 @@ static int vaapi_encode_mpeg2_init_sequence_params(AVCodecContext *avctx)
>      if (avctx->framerate.num > 0 && avctx->framerate.den > 0)
>          vseq->frame_rate = (float)avctx->framerate.num / avctx->framerate.den;
>      else
> -        vseq->frame_rate = (float)avctx->time_base.num / avctx->time_base.den;
> +        vseq->frame_rate = (float)avctx->time_base.den / avctx->time_base.num;
>  
>      vseq->aspect_ratio_information = 1;
>      vseq->vbv_buffer_size = avctx->rc_buffer_size / (16 * 1024);
> -- 
> 2.11.0
> 

LGTM, applied.

(I can't find anything which actually reads this field, though - the MPEG-2 encoder in the i965 driver only supports CQP.  Is there?)

- Mark
diff mbox

Patch

diff --git a/libavcodec/vaapi_encode_mpeg2.c b/libavcodec/vaapi_encode_mpeg2.c
index fbddfa5d5a..dc918884e8 100644
--- a/libavcodec/vaapi_encode_mpeg2.c
+++ b/libavcodec/vaapi_encode_mpeg2.c
@@ -208,7 +208,7 @@  static int vaapi_encode_mpeg2_init_sequence_params(AVCodecContext *avctx)
     if (avctx->framerate.num > 0 && avctx->framerate.den > 0)
         vseq->frame_rate = (float)avctx->framerate.num / avctx->framerate.den;
     else
-        vseq->frame_rate = (float)avctx->time_base.num / avctx->time_base.den;
+        vseq->frame_rate = (float)avctx->time_base.den / avctx->time_base.num;
 
     vseq->aspect_ratio_information = 1;
     vseq->vbv_buffer_size = avctx->rc_buffer_size / (16 * 1024);