diff mbox

[FFmpeg-devel] lavc/vaapi_encode_h264: disable B frame in baseline profile

Message ID eb16e534-2046-06ea-c21f-7c619da2ca79@gmail.com
State New
Headers show

Commit Message

Jun Zhao Dec. 16, 2016, 2:21 a.m. UTC
From a4b410e02ac4864c7d82b15474a65ed42a84da6a Mon Sep 17 00:00:00 2001
From: Jun Zhao <jun.zhao@intel.com>
Date: Fri, 16 Dec 2016 09:49:57 +0800
Subject: [PATCH] lavc/vaapi_encode_h264: disable B frame in baseline profile.

disable B frames when usd baseline/constrined baseline profile,
it's base on H.264 spec Annex A.2.1.

Signed-off-by: Jun Zhao <jun.zhao@intel.com>
Signed-off-by: Yi A Wang <yi.a.wang@intel.com>
---
 libavcodec/vaapi_encode_h264.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

Comments

Jun Zhao Jan. 6, 2017, 8:39 a.m. UTC | #1
ping ?

On 2016/12/16 10:21, Jun Zhao wrote:
Michael Niedermayer Jan. 6, 2017, 12:40 p.m. UTC | #2
On Fri, Dec 16, 2016 at 10:21:25AM +0800, Jun Zhao wrote:
>  vaapi_encode_h264.c |   10 ++++++++++
>  1 file changed, 10 insertions(+)
> 79dbe8e5eaf06d39210c325486b96eef1f4d575d  0001-lavc-vaapi_encode_h264-disable-B-frame-in-baseline-p.patch
> From a4b410e02ac4864c7d82b15474a65ed42a84da6a Mon Sep 17 00:00:00 2001
> From: Jun Zhao <jun.zhao@intel.com>
> Date: Fri, 16 Dec 2016 09:49:57 +0800
> Subject: [PATCH] lavc/vaapi_encode_h264: disable B frame in baseline profile.
> 
> disable B frames when usd baseline/constrined baseline profile,
> it's base on H.264 spec Annex A.2.1.
> 
> Signed-off-by: Jun Zhao <jun.zhao@intel.com>
> Signed-off-by: Yi A Wang <yi.a.wang@intel.com>
> ---
>  libavcodec/vaapi_encode_h264.c | 10 ++++++++++
>  1 file changed, 10 insertions(+)
> 
> diff --git a/libavcodec/vaapi_encode_h264.c b/libavcodec/vaapi_encode_h264.c
> index 69cc483..075f800 100644
> --- a/libavcodec/vaapi_encode_h264.c
> +++ b/libavcodec/vaapi_encode_h264.c
> @@ -1190,9 +1190,19 @@ static av_cold int vaapi_encode_h264_init(AVCodecContext *avctx)
>      switch (avctx->profile) {
>      case FF_PROFILE_H264_CONSTRAINED_BASELINE:
>          ctx->va_profile = VAProfileH264ConstrainedBaseline;
> +        if (avctx->max_b_frames != 0) {
> +            avctx->max_b_frames = 0;
> +            av_log(avctx, AV_LOG_WARNING, "H.264 constrained baseline "
> +                   "profile don't support encode B frame.\n");
> +        }
>          break;
>      case FF_PROFILE_H264_BASELINE:
>          ctx->va_profile = VAProfileH264Baseline;
> +        if (avctx->max_b_frames != 0) {
> +            avctx->max_b_frames = 0;
> +            av_log(avctx, AV_LOG_WARNING, "H.264 baseline "
> +                   "profile don't support encode B frame.\n");

the english grammer sounds wrong


[...]
Moritz Barsnick Jan. 6, 2017, 3:19 p.m. UTC | #3
Since Michael mentioned it:

On Fri, Dec 16, 2016 at 10:21:25 +0800, Jun Zhao wrote:

> +        if (avctx->max_b_frames != 0) {
> +            avctx->max_b_frames = 0;
> +            av_log(avctx, AV_LOG_WARNING, "H.264 constrained baseline "
> +                   "profile don't support encode B frame.\n");
> +        }

"H.264 constrained baseline profile doesn't support encoding with B
frames, disabling them.\n".

> +        if (avctx->max_b_frames != 0) {
> +            avctx->max_b_frames = 0;
> +            av_log(avctx, AV_LOG_WARNING, "H.264 baseline "
> +                   "profile don't support encode B frame.\n");
> +        }

"H.264 baseline profile doesn't support encoding with B frames,
disabling them.\n".

(I like stating the consequent action, otherwise the uneducated user
may believe ffmpeg continues to do something which isn't valid.)

Moritz
Mark Thompson Jan. 7, 2017, 11:20 p.m. UTC | #4
On 06/01/17 15:19, Moritz Barsnick wrote:
> Since Michael mentioned it:
> 
> On Fri, Dec 16, 2016 at 10:21:25 +0800, Jun Zhao wrote:
> 
>> +        if (avctx->max_b_frames != 0) {
>> +            avctx->max_b_frames = 0;
>> +            av_log(avctx, AV_LOG_WARNING, "H.264 constrained baseline "
>> +                   "profile don't support encode B frame.\n");
>> +        }
> 
> "H.264 constrained baseline profile doesn't support encoding with B
> frames, disabling them.\n".
> 
>> +        if (avctx->max_b_frames != 0) {
>> +            avctx->max_b_frames = 0;
>> +            av_log(avctx, AV_LOG_WARNING, "H.264 baseline "
>> +                   "profile don't support encode B frame.\n");
>> +        }
> 
> "H.264 baseline profile doesn't support encoding with B frames,
> disabling them.\n".

+1 to this rephrasing (for improved grammar and clarity).  Patch otherwise fine.

Also apologies for missing the mail last month, thank you for the ping.

- Mark
diff mbox

Patch

diff --git a/libavcodec/vaapi_encode_h264.c b/libavcodec/vaapi_encode_h264.c
index 69cc483..075f800 100644
--- a/libavcodec/vaapi_encode_h264.c
+++ b/libavcodec/vaapi_encode_h264.c
@@ -1190,9 +1190,19 @@  static av_cold int vaapi_encode_h264_init(AVCodecContext *avctx)
     switch (avctx->profile) {
     case FF_PROFILE_H264_CONSTRAINED_BASELINE:
         ctx->va_profile = VAProfileH264ConstrainedBaseline;
+        if (avctx->max_b_frames != 0) {
+            avctx->max_b_frames = 0;
+            av_log(avctx, AV_LOG_WARNING, "H.264 constrained baseline "
+                   "profile don't support encode B frame.\n");
+        }
         break;
     case FF_PROFILE_H264_BASELINE:
         ctx->va_profile = VAProfileH264Baseline;
+        if (avctx->max_b_frames != 0) {
+            avctx->max_b_frames = 0;
+            av_log(avctx, AV_LOG_WARNING, "H.264 baseline "
+                   "profile don't support encode B frame.\n");
+        }
         break;
     case FF_PROFILE_H264_MAIN:
         ctx->va_profile = VAProfileH264Main;