diff mbox series

[FFmpeg-devel] avcodec/hevcdec: fix per-frame signaling of color_trc

Message ID 20200917001429.20867-1-pkoshevoy@gmail.com
State New
Headers show
Series [FFmpeg-devel] avcodec/hevcdec: fix per-frame signaling of color_trc | expand

Checks

Context Check Description
andriy/default pending
andriy/make success Make finished
andriy/make_fate success Make fate finished

Commit Message

Pavel Koshevoy Sept. 17, 2020, 12:14 a.m. UTC
This is a partial revert of f2ad6238e4c0e99e2fc131ee14c586e87b045680
It fixes per-frame color_trc signaling of arib-std-b67 frames.

Reproducible with:
ffprobe -show_frames lg_4k_hlg.ts | grep color_transfer=
---
 libavcodec/hevcdec.c | 6 ++++++
 1 file changed, 6 insertions(+)

Comments

James Almer Sept. 17, 2020, 12:28 a.m. UTC | #1
On 9/16/2020 9:14 PM, Pavel Koshevoy wrote:
> This is a partial revert of f2ad6238e4c0e99e2fc131ee14c586e87b045680
> It fixes per-frame color_trc signaling of arib-std-b67 frames.
> 
> Reproducible with:
> ffprobe -show_frames lg_4k_hlg.ts | grep color_transfer=
> ---
>  libavcodec/hevcdec.c | 6 ++++++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/libavcodec/hevcdec.c b/libavcodec/hevcdec.c
> index c1de75abe1..e3d1e3f693 100644
> --- a/libavcodec/hevcdec.c
> +++ b/libavcodec/hevcdec.c
> @@ -2810,6 +2810,12 @@ static int set_side_data(HEVCContext *s)
>          s->avctx->properties |= FF_CODEC_PROPERTY_CLOSED_CAPTIONS;
>      }
>  
> +    if (s->sei.alternative_transfer.present &&
> +        av_color_transfer_name(s->sei.alternative_transfer.preferred_transfer_characteristics) &&
> +        s->sei.alternative_transfer.preferred_transfer_characteristics != AVCOL_TRC_UNSPECIFIED) {
> +        s->avctx->color_trc = out->color_trc = s->sei.alternative_transfer.preferred_transfer_characteristics;
> +    }
> +
>      for (int i = 0; i < s->sei.unregistered.nb_buf_ref; i++) {
>          HEVCSEIUnregistered *unreg = &s->sei.unregistered;

I have an alternative approach. Will send it soon.
Andriy Gelman Sept. 17, 2020, 4:06 a.m. UTC | #2
On Wed, 16. Sep 18:14, Pavel Koshevoy wrote:
> This is a partial revert of f2ad6238e4c0e99e2fc131ee14c586e87b045680
> It fixes per-frame color_trc signaling of arib-std-b67 frames.
> 
> Reproducible with:
> ffprobe -show_frames lg_4k_hlg.ts | grep color_transfer=
> ---
>  libavcodec/hevcdec.c | 6 ++++++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/libavcodec/hevcdec.c b/libavcodec/hevcdec.c
> index c1de75abe1..e3d1e3f693 100644
> --- a/libavcodec/hevcdec.c
> +++ b/libavcodec/hevcdec.c
> @@ -2810,6 +2810,12 @@ static int set_side_data(HEVCContext *s)
>          s->avctx->properties |= FF_CODEC_PROPERTY_CLOSED_CAPTIONS;
>      }
>  
> +    if (s->sei.alternative_transfer.present &&
> +        av_color_transfer_name(s->sei.alternative_transfer.preferred_transfer_characteristics) &&
> +        s->sei.alternative_transfer.preferred_transfer_characteristics != AVCOL_TRC_UNSPECIFIED) {
> +        s->avctx->color_trc = out->color_trc = s->sei.alternative_transfer.preferred_transfer_characteristics;
> +    }
> +
>      for (int i = 0; i < s->sei.unregistered.nb_buf_ref; i++) {
>          HEVCSEIUnregistered *unreg = &s->sei.unregistered;
>  

Haven't looked in detail but patch appears to fix 
https://trac.ffmpeg.org/ticket/8610
diff mbox series

Patch

diff --git a/libavcodec/hevcdec.c b/libavcodec/hevcdec.c
index c1de75abe1..e3d1e3f693 100644
--- a/libavcodec/hevcdec.c
+++ b/libavcodec/hevcdec.c
@@ -2810,6 +2810,12 @@  static int set_side_data(HEVCContext *s)
         s->avctx->properties |= FF_CODEC_PROPERTY_CLOSED_CAPTIONS;
     }
 
+    if (s->sei.alternative_transfer.present &&
+        av_color_transfer_name(s->sei.alternative_transfer.preferred_transfer_characteristics) &&
+        s->sei.alternative_transfer.preferred_transfer_characteristics != AVCOL_TRC_UNSPECIFIED) {
+        s->avctx->color_trc = out->color_trc = s->sei.alternative_transfer.preferred_transfer_characteristics;
+    }
+
     for (int i = 0; i < s->sei.unregistered.nb_buf_ref; i++) {
         HEVCSEIUnregistered *unreg = &s->sei.unregistered;