nvenc: Map the H264 profiles as it is done for HVEC

Message ID 20161007084721.25114-1-lu_zero@gentoo.org
State New
Headers show

Commit Message

Luca Barbato Oct. 7, 2016, 8:47 a.m.
---

Not totally sure about constrained high. If it is correct I'd add it
to the profiles mapped.

 libavcodec/nvenc.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

--
2.9.2

Comments

Luca Barbato Oct. 10, 2016, 6:33 p.m. | #1
On 07/10/2016 10:47, Luca Barbato wrote:
> ---
> 
> Not totally sure about constrained high. If it is correct I'd add it
> to the profiles mapped.
> 
>  libavcodec/nvenc.c | 8 +++++---
>  1 file changed, 5 insertions(+), 3 deletions(-)
> 
> diff --git a/libavcodec/nvenc.c b/libavcodec/nvenc.c
> index 9c35bd0..36ce11d 100644
> --- a/libavcodec/nvenc.c
> +++ b/libavcodec/nvenc.c
> @@ -697,9 +697,6 @@ static int nvenc_setup_h264_config(AVCodecContext *avctx)
>          h264->outputPictureTimingSEI   = 1;
>      }
> 
> -    if (ctx->profile)
> -        avctx->profile = ctx->profile;
> -
>      if (ctx->data_pix_fmt == AV_PIX_FMT_YUV444P)
>          h264->chromaFormatIDC = 3;
>      else
> @@ -708,18 +705,23 @@ static int nvenc_setup_h264_config(AVCodecContext *avctx)
>      switch (ctx->profile) {
>      case NV_ENC_H264_PROFILE_BASELINE:
>          cc->profileGUID = NV_ENC_H264_PROFILE_BASELINE_GUID;
> +        avctx->profile  = FF_PROFILE_H264_BASELINE;
>          break;
>      case NV_ENC_H264_PROFILE_MAIN:
>          cc->profileGUID = NV_ENC_H264_PROFILE_MAIN_GUID;
> +        avctx->profile  = FF_PROFILE_H264_MAIN;
>          break;
>      case NV_ENC_H264_PROFILE_HIGH:
>          cc->profileGUID = NV_ENC_H264_PROFILE_HIGH_GUID;
> +        avctx->profile  = FF_PROFILE_H264_HIGH;
>          break;
>      case NV_ENC_H264_PROFILE_HIGH_444:
>          cc->profileGUID = NV_ENC_H264_PROFILE_HIGH_444_GUID;
> +        avctx->profile  = FF_PROFILE_H264_HIGH_444_PREDICTIVE;
>          break;
>      case NV_ENC_H264_PROFILE_CONSTRAINED_HIGH:
>          cc->profileGUID = NV_ENC_H264_PROFILE_CONSTRAINED_HIGH_GUID;
> +        avctx->profile  = FF_PROFILE_H264_HIGH|FF_PROFILE_H264_CONSTRAINED;
>          break;
>      }
> 
> --
> 2.9.2
> 
> _______________________________________________
> libav-devel mailing list
> libav-devel@libav.org
> https://lists.libav.org/mailman/listinfo/libav-devel
> 

Ping.
Mark Thompson Oct. 10, 2016, 7:43 p.m. | #2
On 07/10/16 09:47, Luca Barbato wrote:

$subject =~ s/VE/EV/

> ---
> 
> Not totally sure about constrained high. If it is correct I'd add it
> to the profiles mapped.
> 
>  libavcodec/nvenc.c | 8 +++++---
>  1 file changed, 5 insertions(+), 3 deletions(-)
> 
> diff --git a/libavcodec/nvenc.c b/libavcodec/nvenc.c
> index 9c35bd0..36ce11d 100644
> --- a/libavcodec/nvenc.c
> +++ b/libavcodec/nvenc.c
> @@ -697,9 +697,6 @@ static int nvenc_setup_h264_config(AVCodecContext *avctx)
>          h264->outputPictureTimingSEI   = 1;
>      }
> 
> -    if (ctx->profile)
> -        avctx->profile = ctx->profile;
> -
>      if (ctx->data_pix_fmt == AV_PIX_FMT_YUV444P)
>          h264->chromaFormatIDC = 3;
>      else
> @@ -708,18 +705,23 @@ static int nvenc_setup_h264_config(AVCodecContext *avctx)
>      switch (ctx->profile) {
>      case NV_ENC_H264_PROFILE_BASELINE:
>          cc->profileGUID = NV_ENC_H264_PROFILE_BASELINE_GUID;
> +        avctx->profile  = FF_PROFILE_H264_BASELINE;
>          break;
>      case NV_ENC_H264_PROFILE_MAIN:
>          cc->profileGUID = NV_ENC_H264_PROFILE_MAIN_GUID;
> +        avctx->profile  = FF_PROFILE_H264_MAIN;
>          break;
>      case NV_ENC_H264_PROFILE_HIGH:
>          cc->profileGUID = NV_ENC_H264_PROFILE_HIGH_GUID;
> +        avctx->profile  = FF_PROFILE_H264_HIGH;
>          break;
>      case NV_ENC_H264_PROFILE_HIGH_444:
>          cc->profileGUID = NV_ENC_H264_PROFILE_HIGH_444_GUID;
> +        avctx->profile  = FF_PROFILE_H264_HIGH_444_PREDICTIVE;
>          break;
>      case NV_ENC_H264_PROFILE_CONSTRAINED_HIGH:
>          cc->profileGUID = NV_ENC_H264_PROFILE_CONSTRAINED_HIGH_GUID;
> +        avctx->profile  = FF_PROFILE_H264_HIGH|FF_PROFILE_H264_CONSTRAINED;

No, constrained high is high|set4|set5.  Maybe it needs some new FF_PROFILE_H264 flags - *_PROGRESSIVE and *_NO_B_SLICES, or something?

- Mark
Luca Barbato Oct. 10, 2016, 8 p.m. | #3
On 10/10/2016 21:43, Mark Thompson wrote:
> No, constrained high is high|set4|set5.  Maybe it needs some new FF_PROFILE_H264 flags - *_PROGRESSIVE and *_NO_B_SLICES, or something?

I guess, do you have time to get the right combination in?

lu

Patch

diff --git a/libavcodec/nvenc.c b/libavcodec/nvenc.c
index 9c35bd0..36ce11d 100644
--- a/libavcodec/nvenc.c
+++ b/libavcodec/nvenc.c
@@ -697,9 +697,6 @@  static int nvenc_setup_h264_config(AVCodecContext *avctx)
         h264->outputPictureTimingSEI   = 1;
     }

-    if (ctx->profile)
-        avctx->profile = ctx->profile;
-
     if (ctx->data_pix_fmt == AV_PIX_FMT_YUV444P)
         h264->chromaFormatIDC = 3;
     else
@@ -708,18 +705,23 @@  static int nvenc_setup_h264_config(AVCodecContext *avctx)
     switch (ctx->profile) {
     case NV_ENC_H264_PROFILE_BASELINE:
         cc->profileGUID = NV_ENC_H264_PROFILE_BASELINE_GUID;
+        avctx->profile  = FF_PROFILE_H264_BASELINE;
         break;
     case NV_ENC_H264_PROFILE_MAIN:
         cc->profileGUID = NV_ENC_H264_PROFILE_MAIN_GUID;
+        avctx->profile  = FF_PROFILE_H264_MAIN;
         break;
     case NV_ENC_H264_PROFILE_HIGH:
         cc->profileGUID = NV_ENC_H264_PROFILE_HIGH_GUID;
+        avctx->profile  = FF_PROFILE_H264_HIGH;
         break;
     case NV_ENC_H264_PROFILE_HIGH_444:
         cc->profileGUID = NV_ENC_H264_PROFILE_HIGH_444_GUID;
+        avctx->profile  = FF_PROFILE_H264_HIGH_444_PREDICTIVE;
         break;
     case NV_ENC_H264_PROFILE_CONSTRAINED_HIGH:
         cc->profileGUID = NV_ENC_H264_PROFILE_CONSTRAINED_HIGH_GUID;
+        avctx->profile  = FF_PROFILE_H264_HIGH|FF_PROFILE_H264_CONSTRAINED;
         break;
     }