[FFmpeg-devel] [PATCH 2/3] avcodec/nvenc: add master display and light level sei for HDR10

Timo Rothenpieler timo at rothenpieler.org
Wed May 22 16:54:42 EEST 2019


On 22.05.2019 08:59, lance.lmwang at gmail.com wrote:
> From: Limin Wang <lance.lmwang at gmail.com>
> 
> The testing command for the HDR10 output with nvenc:
> $ ./ffmpeg_g -y -i 4K.mp4 -c:v hevc_nvenc -g 7 -color_primaries bt2020 -colorspace bt2020_ncl -color_trc smpte2084 -sei hdr10 \
>          -master_display "G(13250,34500)B(7500,3000)R(34000,16000)WP(15635,16450)L(10000000,50)" -max_cll "0, 0" test.ts
> 
> Please notice it is preferable to use the frame sei side data than master_display and max_cll paramters config
> ---
>   libavcodec/nvenc.c      | 129 ++++++++++++++++++++++++++++++++++++++++
>   libavcodec/nvenc.h      |  18 ++++++
>   libavcodec/nvenc_hevc.c |  11 ++++
>   3 files changed, 158 insertions(+)
> 
> diff --git a/libavcodec/nvenc.c b/libavcodec/nvenc.c
> index 75dda6d689..3fd0eca4a5 100644
> --- a/libavcodec/nvenc.c
> +++ b/libavcodec/nvenc.c
> @@ -22,6 +22,9 @@
>   #include "config.h"
>   
>   #include "nvenc.h"
> +#include "cbs_h265.h"
> +#include "hevc_sei.h"
> +#include "put_bits.h"
>   
>   #include "libavutil/hwcontext_cuda.h"
>   #include "libavutil/hwcontext.h"
> @@ -30,6 +33,7 @@
>   #include "libavutil/avassert.h"
>   #include "libavutil/mem.h"
>   #include "libavutil/pixdesc.h"
> +#include "libavutil/mastering_display_metadata.h"
>   #include "internal.h"
>   
>   #define CHECK_CU(x) FF_CUDA_CHECK_DL(avctx, dl_fn->cuda_dl, x)
> @@ -1491,6 +1495,46 @@ av_cold int ff_nvenc_encode_init(AVCodecContext *avctx)
>           ctx->data_pix_fmt = avctx->pix_fmt;
>       }
>   
> +    ctx->display_primaries_x[0] = 13250;
> +    ctx->display_primaries_y[0] = 34500;
> +    ctx->display_primaries_x[1] = 7500;
> +    ctx->display_primaries_y[1] = 3000;
> +    ctx->display_primaries_x[2] = 34000;
> +    ctx->display_primaries_y[2] = 16000;
> +    ctx->white_point_x          = 15635;
> +    ctx->white_point_y          = 16450;
> +    ctx->max_display_mastering_luminance = 10000000;
> +    ctx->min_display_mastering_luminance = 500;
> +    ctx->max_content_light_level = 0;
> +    ctx->max_pic_average_light_level = 0;

Does all this really belong into an encoder? The command line parameter 
also looks very arcane.
To me, this looks more like a filter or something should add this as 
extra data, and then multiple encoders can pick it up from there.

Same goes for patch 3/3. Patch 1/3 is looks OK to me.


Timo

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 4538 bytes
Desc: S/MIME Cryptographic Signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20190522/0502c97c/attachment.bin>


More information about the ffmpeg-devel mailing list