Re: [libav-devel] [PATCH] pixfmt: Support chroma-derived and ictcp color matrices

2017-08-08 Thread Luca Barbato
On 08/08/2017 16:30, Vittorio Giovara wrote:
> Signed-off-by: Vittorio Giovara 
> ---
> Now without the typo in the name.
> Vittorio
> 
>  libavutil/pixdesc.c | 4 
>  libavutil/pixfmt.h  | 3 +++
>  2 files changed, 7 insertions(+)
> 
> diff --git a/libavutil/pixdesc.c b/libavutil/pixdesc.c
> index 7fa6dd7c0b..f1e35f2254 100644
> --- a/libavutil/pixdesc.c
> +++ b/libavutil/pixdesc.c
> @@ -1806,6 +1806,10 @@ static const char * const color_space_names[] = {
>  [AVCOL_SPC_BT2020_NCL] = "bt2020nc",
>  [AVCOL_SPC_BT2020_CL] = "bt2020c",
>  [AVCOL_SPC_SMPTE2085] = "smpte2085",
> +[AVCOL_SPC_CHROMA_DERIVED_NCL] = "chroma-derived-nc",
> +[AVCOL_SPC_CHROMA_DERIVED_CL] = "chroma-derived-c",
> +[AVCOL_SPC_ICTCP] = "ictcp",
> +
>  };
>  
>  static const char * const chroma_location_names[] = {
> diff --git a/libavutil/pixfmt.h b/libavutil/pixfmt.h
> index 2ba7ad1c88..2823a7ea36 100644
> --- a/libavutil/pixfmt.h
> +++ b/libavutil/pixfmt.h
> @@ -384,6 +384,9 @@ enum AVColorSpace {
>  AVCOL_SPC_BT2020_NCL  = 9,  ///< ITU-R BT2020 non-constant luminance 
> system
>  AVCOL_SPC_BT2020_CL   = 10, ///< ITU-R BT2020 constant luminance system
>  AVCOL_SPC_SMPTE2085   = 11, ///< SMPTE 2085, Y'D'zD'x
> +AVCOL_SPC_CHROMA_DERIVED_NCL = 12, ///< Chromaticity-derived 
> non-constant luminance system
> +AVCOL_SPC_CHROMA_DERIVED_CL = 13, ///< Chromaticity-derived constant 
> luminance system
> +AVCOL_SPC_ICTCP   = 14, ///< ITU-R BT.2100-0 ICTCP
>  AVCOL_SPC_NB,   ///< Not part of ABI
>  };
>  
> 

Probably fine.
___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel

[libav-devel] [PATCH] pixfmt: Support chroma-derived and ictcp color matrices

2017-08-08 Thread Vittorio Giovara
Signed-off-by: Vittorio Giovara 
---
Now without the typo in the name.
Vittorio

 libavutil/pixdesc.c | 4 
 libavutil/pixfmt.h  | 3 +++
 2 files changed, 7 insertions(+)

diff --git a/libavutil/pixdesc.c b/libavutil/pixdesc.c
index 7fa6dd7c0b..f1e35f2254 100644
--- a/libavutil/pixdesc.c
+++ b/libavutil/pixdesc.c
@@ -1806,6 +1806,10 @@ static const char * const color_space_names[] = {
 [AVCOL_SPC_BT2020_NCL] = "bt2020nc",
 [AVCOL_SPC_BT2020_CL] = "bt2020c",
 [AVCOL_SPC_SMPTE2085] = "smpte2085",
+[AVCOL_SPC_CHROMA_DERIVED_NCL] = "chroma-derived-nc",
+[AVCOL_SPC_CHROMA_DERIVED_CL] = "chroma-derived-c",
+[AVCOL_SPC_ICTCP] = "ictcp",
+
 };
 
 static const char * const chroma_location_names[] = {
diff --git a/libavutil/pixfmt.h b/libavutil/pixfmt.h
index 2ba7ad1c88..2823a7ea36 100644
--- a/libavutil/pixfmt.h
+++ b/libavutil/pixfmt.h
@@ -384,6 +384,9 @@ enum AVColorSpace {
 AVCOL_SPC_BT2020_NCL  = 9,  ///< ITU-R BT2020 non-constant luminance system
 AVCOL_SPC_BT2020_CL   = 10, ///< ITU-R BT2020 constant luminance system
 AVCOL_SPC_SMPTE2085   = 11, ///< SMPTE 2085, Y'D'zD'x
+AVCOL_SPC_CHROMA_DERIVED_NCL = 12, ///< Chromaticity-derived non-constant 
luminance system
+AVCOL_SPC_CHROMA_DERIVED_CL = 13, ///< Chromaticity-derived constant 
luminance system
+AVCOL_SPC_ICTCP   = 14, ///< ITU-R BT.2100-0 ICTCP
 AVCOL_SPC_NB,   ///< Not part of ABI
 };
 
-- 
2.13.2

___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel

[libav-devel] [PATCH] pixfmt: Support chroma-derived and icpct color matrices

2017-08-08 Thread Vittorio Giovara
Signed-off-by: Vittorio Giovara 
---
Missing version bump.
Vittorio

 libavutil/pixdesc.c | 4 
 libavutil/pixfmt.h  | 3 +++
 2 files changed, 7 insertions(+)

diff --git a/libavutil/pixdesc.c b/libavutil/pixdesc.c
index 7fa6dd7c0b..a72ef3faf0 100644
--- a/libavutil/pixdesc.c
+++ b/libavutil/pixdesc.c
@@ -1806,6 +1806,10 @@ static const char * const color_space_names[] = {
 [AVCOL_SPC_BT2020_NCL] = "bt2020nc",
 [AVCOL_SPC_BT2020_CL] = "bt2020c",
 [AVCOL_SPC_SMPTE2085] = "smpte2085",
+[AVCOL_SPC_CHROMA_DERIVED_NCL] = "chroma-derived-nc",
+[AVCOL_SPC_CHROMA_DERIVED_CL] = "chroma-derived-c",
+[AVCOL_SPC_ICPCT] = "icpct",
+
 };
 
 static const char * const chroma_location_names[] = {
diff --git a/libavutil/pixfmt.h b/libavutil/pixfmt.h
index 2ba7ad1c88..93fd95da58 100644
--- a/libavutil/pixfmt.h
+++ b/libavutil/pixfmt.h
@@ -384,6 +384,9 @@ enum AVColorSpace {
 AVCOL_SPC_BT2020_NCL  = 9,  ///< ITU-R BT2020 non-constant luminance system
 AVCOL_SPC_BT2020_CL   = 10, ///< ITU-R BT2020 constant luminance system
 AVCOL_SPC_SMPTE2085   = 11, ///< SMPTE 2085, Y'D'zD'x
+AVCOL_SPC_CHROMA_DERIVED_NCL = 12, ///< Chromaticity-derived non-constant 
luminance system
+AVCOL_SPC_CHROMA_DERIVED_CL = 13, ///< Chromaticity-derived constant 
luminance system
+AVCOL_SPC_ICPCT   = 14, ///< ITU-R BT.2100-0 ICTCP
 AVCOL_SPC_NB,   ///< Not part of ABI
 };
 
-- 
2.13.2

___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel

[libav-devel] [PATCH] h264: Add support for alternative transfer characterics SEI

2017-08-08 Thread Vittorio Giovara
The use of this SEI is for backward compatibility in HLG HDR systems:
older devices that cannot interpret the "arib-std-b67" transfer will
get the compatible transfer (usually bt709 or bt2020) from the VUI,
while newer devices that can interpret HDR will read the SEI and use
its value instead.

Signed-off-by: Vittorio Giovara 
---
 libavcodec/h264_sei.c   | 11 +++
 libavcodec/h264_sei.h   |  7 +++
 libavcodec/h264_slice.c |  6 ++
 3 files changed, 24 insertions(+)

diff --git a/libavcodec/h264_sei.c b/libavcodec/h264_sei.c
index 3ca2b7a6cd..03fca9017f 100644
--- a/libavcodec/h264_sei.c
+++ b/libavcodec/h264_sei.c
@@ -346,6 +346,14 @@ static int 
decode_display_orientation(H264SEIDisplayOrientation *h,
 return 0;
 }
 
+static int decode_alternative_transfer(H264SEIAlternativeTransfer *h,
+   GetBitContext *gb)
+{
+h->present = 1;
+h->preferred_transfer_characteristics = get_bits(gb, 8);
+return 0;
+}
+
 int ff_h264_sei_decode(H264SEIContext *h, GetBitContext *gb,
const H264ParamSets *ps, void *logctx)
 {
@@ -396,6 +404,9 @@ int ff_h264_sei_decode(H264SEIContext *h, GetBitContext *gb,
 case H264_SEI_TYPE_DISPLAY_ORIENTATION:
 ret = decode_display_orientation(>display_orientation, gb);
 break;
+case H264_SEI_TYPE_ALTERNATIVE_TRANSFER:
+ret = decode_alternative_transfer(>alternative_transfer, gb);
+break;
 default:
 av_log(logctx, AV_LOG_DEBUG, "unknown SEI type %d\n", type);
 skip_bits(gb, 8 * size);
diff --git a/libavcodec/h264_sei.h b/libavcodec/h264_sei.h
index ce9768ec3d..f6ac6034da 100644
--- a/libavcodec/h264_sei.h
+++ b/libavcodec/h264_sei.h
@@ -33,6 +33,7 @@ typedef enum {
 H264_SEI_TYPE_RECOVERY_POINT = 6,   ///< recovery point (frame # 
to decoder sync)
 H264_SEI_TYPE_FRAME_PACKING  = 45,  ///< frame packing arrangement
 H264_SEI_TYPE_DISPLAY_ORIENTATION= 47,  ///< display orientation
+H264_SEI_TYPE_ALTERNATIVE_TRANSFER   = 147, ///< alternative transfer
 } H264_SEI_Type;
 
 /**
@@ -115,6 +116,11 @@ typedef struct H264SEIDisplayOrientation {
 int hflip, vflip;
 } H264SEIDisplayOrientation;
 
+typedef struct H264SEIAlternativeTransfer {
+int present;
+int preferred_transfer_characteristics;
+} H264SEIAlternativeTransfer;
+
 typedef struct H264SEIContext {
 H264SEIPictureTiming picture_timing;
 H264SEIAFD afd;
@@ -124,6 +130,7 @@ typedef struct H264SEIContext {
 H264SEIBufferingPeriod buffering_period;
 H264SEIFramePacking frame_packing;
 H264SEIDisplayOrientation display_orientation;
+H264SEIAlternativeTransfer alternative_transfer;
 } H264SEIContext;
 
 struct H264ParamSets;
diff --git a/libavcodec/h264_slice.c b/libavcodec/h264_slice.c
index c6309b298c..5dd01d836e 100644
--- a/libavcodec/h264_slice.c
+++ b/libavcodec/h264_slice.c
@@ -1154,6 +1154,12 @@ static int h264_export_frame_props(H264Context *h)
 a53->a53_caption_size = 0;
 }
 
+if (h->sei.alternative_transfer.present &&
+
av_color_transfer_name(h->sei.alternative_transfer.preferred_transfer_characteristics)
 &&
+h->sei.alternative_transfer.preferred_transfer_characteristics != 
AVCOL_TRC_UNSPECIFIED) {
+h->avctx->color_trc = cur->f->color_trc = 
h->sei.alternative_transfer.preferred_transfer_characteristics;
+}
+
 return 0;
 }
 
-- 
2.13.2

___
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel