diff mbox

[FFmpeg-devel] lavc/x265: set preferred_transfer_characteristics for HLG

Message ID 1575469449-68383-1-git-send-email-zhongli_dev@126.com
State Accepted
Commit a87b5d5e8c9424b5cadd46abba98dae8edd454df
Headers show

Commit Message

zhongli_dev@126.com Dec. 4, 2019, 2:24 p.m. UTC
"HEVC HDR UHDTV Bitstreams using HLG10 shall also contain the
alternative_transfer_characteristics SEI message. The
alternative_transfer_characteristics SEI message shall be inserted on
the HEVC DVB_RAP, and preferred_transfer_characteristics shall be set
equal to "18", indicating Recommendation ITU-R BT. 2100 [45] HLG
system."

Signed-off-by: Zhong Li <zhongli_dev@126.com>
---
 libavcodec/libx265.c | 4 ++++
 1 file changed, 4 insertions(+)

Comments

James Almer Dec. 12, 2019, 4:14 p.m. UTC | #1
On 12/4/2019 11:24 AM, Zhong Li wrote:
> "HEVC HDR UHDTV Bitstreams using HLG10 shall also contain the
> alternative_transfer_characteristics SEI message. The
> alternative_transfer_characteristics SEI message shall be inserted on
> the HEVC DVB_RAP, and preferred_transfer_characteristics shall be set
> equal to "18", indicating Recommendation ITU-R BT. 2100 [45] HLG
> system."
> 
> Signed-off-by: Zhong Li <zhongli_dev@126.com>
> ---
>  libavcodec/libx265.c | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/libavcodec/libx265.c b/libavcodec/libx265.c
> index 4e75077..963c28f 100644
> --- a/libavcodec/libx265.c
> +++ b/libavcodec/libx265.c
> @@ -159,6 +159,10 @@ static av_cold int libx265_encode_init(AVCodecContext *avctx)
>          // x265 validates the parameters internally
>          ctx->params->vui.colorPrimaries          = avctx->color_primaries;
>          ctx->params->vui.transferCharacteristics = avctx->color_trc;
> +#if X265_BUILD >= 159
> +        if (avctx->color_trc == AVCOL_TRC_ARIB_STD_B67)
> +            ctx->params->preferredTransferCharacteristics = ctx->params->vui.transferCharacteristics;
> +#endif

isn't the point of preferred_transfer_characteristics to have the Arib
value at the same time the standard VUI trc field contains a value like
BT2020 instead, for device backwards compat purposes?

If both have the Arib value, then it seems redundant.

>          ctx->params->vui.matrixCoeffs            = avctx->colorspace;
>      }
>  
>
Vittorio Giovara Dec. 12, 2019, 9:22 p.m. UTC | #2
On Thu, Dec 12, 2019 at 11:14 AM James Almer <jamrial@gmail.com> wrote:

> On 12/4/2019 11:24 AM, Zhong Li wrote:
> > "HEVC HDR UHDTV Bitstreams using HLG10 shall also contain the
> > alternative_transfer_characteristics SEI message. The
> > alternative_transfer_characteristics SEI message shall be inserted on
> > the HEVC DVB_RAP, and preferred_transfer_characteristics shall be set
> > equal to "18", indicating Recommendation ITU-R BT. 2100 [45] HLG
> > system."
> >
> > Signed-off-by: Zhong Li <zhongli_dev@126.com>
> > ---
> >  libavcodec/libx265.c | 4 ++++
> >  1 file changed, 4 insertions(+)
> >
> > diff --git a/libavcodec/libx265.c b/libavcodec/libx265.c
> > index 4e75077..963c28f 100644
> > --- a/libavcodec/libx265.c
> > +++ b/libavcodec/libx265.c
> > @@ -159,6 +159,10 @@ static av_cold int
> libx265_encode_init(AVCodecContext *avctx)
> >          // x265 validates the parameters internally
> >          ctx->params->vui.colorPrimaries          =
> avctx->color_primaries;
> >          ctx->params->vui.transferCharacteristics = avctx->color_trc;
> > +#if X265_BUILD >= 159
> > +        if (avctx->color_trc == AVCOL_TRC_ARIB_STD_B67)
> > +            ctx->params->preferredTransferCharacteristics =
> ctx->params->vui.transferCharacteristics;
> > +#endif
>
> isn't the point of preferred_transfer_characteristics to have the Arib
> value at the same time the standard VUI trc field contains a value like
> BT2020 instead, for device backwards compat purposes?
>
> If both have the Arib value, then it seems redundant.
>

yes but that is a new requirement from the dvb spec to my understanding
i believe it is to encourage implementors to support this particular SEI
Zhong Li Dec. 13, 2019, 8:11 a.m. UTC | #3
James Almer <jamrial@gmail.com> 于2019年12月13日周五 上午12:14写道:
>
> On 12/4/2019 11:24 AM, Zhong Li wrote:
> > "HEVC HDR UHDTV Bitstreams using HLG10 shall also contain the
> > alternative_transfer_characteristics SEI message. The
> > alternative_transfer_characteristics SEI message shall be inserted on
> > the HEVC DVB_RAP, and preferred_transfer_characteristics shall be set
> > equal to "18", indicating Recommendation ITU-R BT. 2100 [45] HLG
> > system."
> >
> > Signed-off-by: Zhong Li <zhongli_dev@126.com>
> > ---
> >  libavcodec/libx265.c | 4 ++++
> >  1 file changed, 4 insertions(+)
> >
> > diff --git a/libavcodec/libx265.c b/libavcodec/libx265.c
> > index 4e75077..963c28f 100644
> > --- a/libavcodec/libx265.c
> > +++ b/libavcodec/libx265.c
> > @@ -159,6 +159,10 @@ static av_cold int libx265_encode_init(AVCodecContext *avctx)
> >          // x265 validates the parameters internally
> >          ctx->params->vui.colorPrimaries          = avctx->color_primaries;
> >          ctx->params->vui.transferCharacteristics = avctx->color_trc;
> > +#if X265_BUILD >= 159
> > +        if (avctx->color_trc == AVCOL_TRC_ARIB_STD_B67)
> > +            ctx->params->preferredTransferCharacteristics = ctx->params->vui.transferCharacteristics;
> > +#endif
>
> isn't the point of preferred_transfer_characteristics to have the Arib
> value at the same time the standard VUI trc field contains a value like
> BT2020 instead, for device backwards compat purposes?
>
> If both have the Arib value, then it seems redundant.

It is also for robustness,if preferred_transfer_characteristics is
existed but not set, decoder may use
preferred_transfer_characteristics instead of vui
transfer_characteristics.
diff mbox

Patch

diff --git a/libavcodec/libx265.c b/libavcodec/libx265.c
index 4e75077..963c28f 100644
--- a/libavcodec/libx265.c
+++ b/libavcodec/libx265.c
@@ -159,6 +159,10 @@  static av_cold int libx265_encode_init(AVCodecContext *avctx)
         // x265 validates the parameters internally
         ctx->params->vui.colorPrimaries          = avctx->color_primaries;
         ctx->params->vui.transferCharacteristics = avctx->color_trc;
+#if X265_BUILD >= 159
+        if (avctx->color_trc == AVCOL_TRC_ARIB_STD_B67)
+            ctx->params->preferredTransferCharacteristics = ctx->params->vui.transferCharacteristics;
+#endif
         ctx->params->vui.matrixCoeffs            = avctx->colorspace;
     }