Re: [FFmpeg-devel] [PATCH] Support HDR10+ metadata for HEVC.

2020-12-06 Thread James Almer

On 12/6/2020 8:13 AM, Hendrik Leppkes wrote:

On Sat, Dec 5, 2020 at 11:28 PM James Almer  wrote:


On 12/1/2020 3:09 PM, Mohammad Izadi wrote:

Ian, can you please take a look into it? And if it's fine to push it.

Thanks,
Mohammad


I removed the packet side data addition since it was not used by any
module. It can be added when a demuxer needs to propagate it.

Also removed the entry for dynamic_hdr10_plus.h in the installed
libraries list as it's internal, simplified the test (cut the sample
into a single frame, 70kb vs 1mb sample) and split the patch in four
commits before pushing.



I looked through the committed patch as I was curious how it compares
to the code i've been using for a bit, and I noticed some concerns
with the GetBitContext handling.

- All SEI parsing uses one shared "gb", not only for one SEI message,
but the entire SEI NALU (this is fine, but important to know for the
other points)


Apparently, h264 creates standalone GetBitContexts for each SEI message, 
whereas hevc doesn't. This was probably written with the former in mind.



- ff_parse_itu_t_t35_to_dynamic_hdr10_plus will always consume the
*full* GetBitContext with a "skip_bits(gb, get_bits_left(gb));" at its
end, so it may skip over a SEI message following the HDR10+ data?
- The skip in decode_nal_sei_user_data_registered_itu_t_t35 was moved
out of any conditions, so in case of decoding HDR10+ data, it would
skip data despite it already being consumed by parsing?
It seems like the intention of the code was to pass a copy of the
GetBitContex (and not the original) to
ff_parse_itu_t_t35_to_dynamic_hdr10_plus, as it would avoid any of
these issues, but then I don't know what the skip at the end of the
hdr10+ function is for?


It may be better to make ff_parse_itu_t_t35_to_dynamic_hdr10_plus() 
behave like ff_parse_a53_cc(), taking a buffer as argument and creating 
a GetBitContext internally instead. I'll send a patch for that.

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

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-devel] [PATCH] Support HDR10+ metadata for HEVC.

2020-12-06 Thread Hendrik Leppkes
On Sat, Dec 5, 2020 at 11:28 PM James Almer  wrote:
>
> On 12/1/2020 3:09 PM, Mohammad Izadi wrote:
> > Ian, can you please take a look into it? And if it's fine to push it.
> >
> > Thanks,
> > Mohammad
>
> I removed the packet side data addition since it was not used by any
> module. It can be added when a demuxer needs to propagate it.
>
> Also removed the entry for dynamic_hdr10_plus.h in the installed
> libraries list as it's internal, simplified the test (cut the sample
> into a single frame, 70kb vs 1mb sample) and split the patch in four
> commits before pushing.
>

I looked through the committed patch as I was curious how it compares
to the code i've been using for a bit, and I noticed some concerns
with the GetBitContext handling.

- All SEI parsing uses one shared "gb", not only for one SEI message,
but the entire SEI NALU (this is fine, but important to know for the
other points)
- ff_parse_itu_t_t35_to_dynamic_hdr10_plus will always consume the
*full* GetBitContext with a "skip_bits(gb, get_bits_left(gb));" at its
end, so it may skip over a SEI message following the HDR10+ data?
- The skip in decode_nal_sei_user_data_registered_itu_t_t35 was moved
out of any conditions, so in case of decoding HDR10+ data, it would
skip data despite it already being consumed by parsing?

It seems like the intention of the code was to pass a copy of the
GetBitContex (and not the original) to
ff_parse_itu_t_t35_to_dynamic_hdr10_plus, as it would avoid any of
these issues, but then I don't know what the skip at the end of the
hdr10+ function is for?

- Hendrik
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-devel] [PATCH] Support HDR10+ metadata for HEVC.

2020-12-05 Thread James Almer

On 12/1/2020 3:09 PM, Mohammad Izadi wrote:

Ian, can you please take a look into it? And if it's fine to push it.

Thanks,
Mohammad


I removed the packet side data addition since it was not used by any 
module. It can be added when a demuxer needs to propagate it.


Also removed the entry for dynamic_hdr10_plus.h in the installed 
libraries list as it's internal, simplified the test (cut the sample 
into a single frame, 70kb vs 1mb sample) and split the patch in four 
commits before pushing.


Thanks.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-devel] [PATCH] Support HDR10+ metadata for HEVC.

2020-12-01 Thread Mohammad Izadi
Ian, can you please take a look into it? And if it's fine to push it.

Thanks,
Mohammad


On Mon, Nov 23, 2020 at 1:29 PM Mohammad Izadi  wrote:

> From: Mohammad Izadi 
>
> HDR10+ is dynamic metadata (A/341 Amendment - SMPTE2094-40) that needs to
> be decoded from ITU-T T.35 in HEVC bitstream. The HDR10+ is transferred to
> side data packet to be used or passed through.
> ---
> The fate test file can be found here:
> https://drive.google.com/file/d/1vcT0ohzpoyVFcxQN32jKIhUrBaBwZweT/view?usp=sharing
> The video file needs to be copied to fate-suite/mov/
> configure  |   1 +
>  fftools/ffprobe.c  | 106 +
>  libavcodec/Makefile|   3 +
>  libavcodec/avpacket.c  |   1 +
>  libavcodec/decode.c|   1 +
>  libavcodec/dynamic_hdr10_plus.c| 196 +
>  libavcodec/dynamic_hdr10_plus.h|  34 +
>  libavcodec/hevc_sei.c  |  62 ++--
>  libavcodec/hevc_sei.h  |   5 +
>  libavcodec/hevcdec.c   |  18 +++
>  libavcodec/packet.h|   8 +
>  libavcodec/version.h   |   2 +-
>  libavfilter/vf_showinfo.c  | 106 -
>  tests/fate/mov.mak |   3 +
>  tests/ref/fate/mov-hdr10-plus-metadata |  90 
>  15 files changed, 621 insertions(+), 15 deletions(-)
>  create mode 100644 libavcodec/dynamic_hdr10_plus.c
>  create mode 100644 libavcodec/dynamic_hdr10_plus.h
>  create mode 100644 tests/ref/fate/mov-hdr10-plus-metadata
>
> diff --git a/configure b/configure
> index 51e43fbf66..a9f12a421e 100755
> --- a/configure
> +++ b/configure
> @@ -2360,6 +2360,7 @@ CONFIG_EXTRA="
>  dirac_parse
>  dnn
>  dvprofile
> +dynamic_hdr10_plus
>  exif
>  faandct
>  faanidct
> diff --git a/fftools/ffprobe.c b/fftools/ffprobe.c
> index 86bd23d36d..4cee4e8ec3 100644
> --- a/fftools/ffprobe.c
> +++ b/fftools/ffprobe.c
> @@ -35,6 +35,7 @@
>  #include "libavutil/bprint.h"
>  #include "libavutil/display.h"
>  #include "libavutil/hash.h"
> +#include "libavutil/hdr_dynamic_metadata.h"
>  #include "libavutil/mastering_display_metadata.h"
>  #include "libavutil/dovi_meta.h"
>  #include "libavutil/opt.h"
> @@ -1860,6 +1861,105 @@ static inline int show_tags(WriterContext *w,
> AVDictionary *tags, int section_id
>  return ret;
>  }
>
> +static void print_dynamic_hdr10_plus(WriterContext *w, AVDynamicHDRPlus
> *metadata)
> +{
> +if (!metadata)
> +return;
> +print_int("application version", metadata->application_version);
> +print_int("num_windows", metadata->num_windows);
> +for (int n = 1; n < metadata->num_windows; n++) {
> +AVHDRPlusColorTransformParams *params = &metadata->params[n];
> +print_q("window_upper_left_corner_x",
> +params->window_upper_left_corner_x,'/');
> +print_q("window_upper_left_corner_y",
> +params->window_upper_left_corner_y,'/');
> +print_q("window_lower_right_corner_x",
> +params->window_lower_right_corner_x,'/');
> +print_q("window_lower_right_corner_y",
> +params->window_lower_right_corner_y,'/');
> +print_q("window_upper_left_corner_x",
> +params->window_upper_left_corner_x,'/');
> +print_q("window_upper_left_corner_y",
> +params->window_upper_left_corner_y,'/');
> +print_int("center_of_ellipse_x",
> +  params->center_of_ellipse_x ) ;
> +print_int("center_of_ellipse_y",
> +  params->center_of_ellipse_y );
> +print_int("rotation_angle",
> +  params->rotation_angle);
> +print_int("semimajor_axis_internal_ellipse",
> +  params->semimajor_axis_internal_ellipse);
> +print_int("semimajor_axis_external_ellipse",
> +  params->semimajor_axis_external_ellipse);
> +print_int("semiminor_axis_external_ellipse",
> +  params->semiminor_axis_external_ellipse);
> +print_int("overlap_process_option",
> +  params->overlap_process_option);
> +}
> +print_q("targeted_system_display_maximum_luminance",
> +metadata->targeted_system_display_maximum_luminance,'/');
> +if (metadata->targeted_system_display_actual_peak_luminance_flag) {
> +
> print_int("num_rows_targeted_system_display_actual_peak_luminance",
> +
> metadata->num_rows_targeted_system_display_actual_peak_luminance);
> +
> print_int("num_cols_targeted_system_display_actual_peak_luminance",
> +
> metadata->num_cols_targeted_system_display_actual_peak_luminance);
> +for (int i = 0; i <
> metadata->num_rows_targeted_system_display_actual_peak_luminance; i++) {
> +for (int j = 0; j <
> metadata->num_cols_targeted_system_display_actual_peak_luminance; j++) {
> +print_q("targeted_system_displ

[FFmpeg-devel] [PATCH] Support HDR10+ metadata for HEVC.

2020-11-23 Thread Mohammad Izadi
From: Mohammad Izadi 

HDR10+ is dynamic metadata (A/341 Amendment - SMPTE2094-40) that needs to be 
decoded from ITU-T T.35 in HEVC bitstream. The HDR10+ is transferred to side 
data packet to be used or passed through.
---
The fate test file can be found here: 
https://drive.google.com/file/d/1vcT0ohzpoyVFcxQN32jKIhUrBaBwZweT/view?usp=sharing
The video file needs to be copied to fate-suite/mov/
configure  |   1 +
 fftools/ffprobe.c  | 106 +
 libavcodec/Makefile|   3 +
 libavcodec/avpacket.c  |   1 +
 libavcodec/decode.c|   1 +
 libavcodec/dynamic_hdr10_plus.c| 196 +
 libavcodec/dynamic_hdr10_plus.h|  34 +
 libavcodec/hevc_sei.c  |  62 ++--
 libavcodec/hevc_sei.h  |   5 +
 libavcodec/hevcdec.c   |  18 +++
 libavcodec/packet.h|   8 +
 libavcodec/version.h   |   2 +-
 libavfilter/vf_showinfo.c  | 106 -
 tests/fate/mov.mak |   3 +
 tests/ref/fate/mov-hdr10-plus-metadata |  90 
 15 files changed, 621 insertions(+), 15 deletions(-)
 create mode 100644 libavcodec/dynamic_hdr10_plus.c
 create mode 100644 libavcodec/dynamic_hdr10_plus.h
 create mode 100644 tests/ref/fate/mov-hdr10-plus-metadata

diff --git a/configure b/configure
index 51e43fbf66..a9f12a421e 100755
--- a/configure
+++ b/configure
@@ -2360,6 +2360,7 @@ CONFIG_EXTRA="
 dirac_parse
 dnn
 dvprofile
+dynamic_hdr10_plus
 exif
 faandct
 faanidct
diff --git a/fftools/ffprobe.c b/fftools/ffprobe.c
index 86bd23d36d..4cee4e8ec3 100644
--- a/fftools/ffprobe.c
+++ b/fftools/ffprobe.c
@@ -35,6 +35,7 @@
 #include "libavutil/bprint.h"
 #include "libavutil/display.h"
 #include "libavutil/hash.h"
+#include "libavutil/hdr_dynamic_metadata.h"
 #include "libavutil/mastering_display_metadata.h"
 #include "libavutil/dovi_meta.h"
 #include "libavutil/opt.h"
@@ -1860,6 +1861,105 @@ static inline int show_tags(WriterContext *w, 
AVDictionary *tags, int section_id
 return ret;
 }
 
+static void print_dynamic_hdr10_plus(WriterContext *w, AVDynamicHDRPlus 
*metadata)
+{
+if (!metadata)
+return;
+print_int("application version", metadata->application_version);
+print_int("num_windows", metadata->num_windows);
+for (int n = 1; n < metadata->num_windows; n++) {
+AVHDRPlusColorTransformParams *params = &metadata->params[n];
+print_q("window_upper_left_corner_x",
+params->window_upper_left_corner_x,'/');
+print_q("window_upper_left_corner_y",
+params->window_upper_left_corner_y,'/');
+print_q("window_lower_right_corner_x",
+params->window_lower_right_corner_x,'/');
+print_q("window_lower_right_corner_y",
+params->window_lower_right_corner_y,'/');
+print_q("window_upper_left_corner_x",
+params->window_upper_left_corner_x,'/');
+print_q("window_upper_left_corner_y",
+params->window_upper_left_corner_y,'/');
+print_int("center_of_ellipse_x",
+  params->center_of_ellipse_x ) ;
+print_int("center_of_ellipse_y",
+  params->center_of_ellipse_y );
+print_int("rotation_angle",
+  params->rotation_angle);
+print_int("semimajor_axis_internal_ellipse",
+  params->semimajor_axis_internal_ellipse);
+print_int("semimajor_axis_external_ellipse",
+  params->semimajor_axis_external_ellipse);
+print_int("semiminor_axis_external_ellipse",
+  params->semiminor_axis_external_ellipse);
+print_int("overlap_process_option",
+  params->overlap_process_option);
+}
+print_q("targeted_system_display_maximum_luminance",
+metadata->targeted_system_display_maximum_luminance,'/');
+if (metadata->targeted_system_display_actual_peak_luminance_flag) {
+print_int("num_rows_targeted_system_display_actual_peak_luminance",
+  
metadata->num_rows_targeted_system_display_actual_peak_luminance);
+print_int("num_cols_targeted_system_display_actual_peak_luminance",
+  
metadata->num_cols_targeted_system_display_actual_peak_luminance);
+for (int i = 0; i < 
metadata->num_rows_targeted_system_display_actual_peak_luminance; i++) {
+for (int j = 0; j < 
metadata->num_cols_targeted_system_display_actual_peak_luminance; j++) {
+print_q("targeted_system_display_actual_peak_luminance",
+
metadata->targeted_system_display_actual_peak_luminance[i][j],'/');
+}
+}
+}
+for (int n = 0; n < metadata->num_windows; n++) {
+AVHDRPlusColorTransformParams *params = &metadata->params[n];
+for (int i = 0; 

Re: [FFmpeg-devel] [PATCH] Support HDR10+ metadata for HEVC.

2020-11-23 Thread Mohammad Izadi
Thanks,
Mohammad


On Fri, Nov 20, 2020 at 5:44 AM Anton Khirnov  wrote:

> Quoting Mohammad Izadi (2020-11-20 04:57:11)
> > From: Mohammad Izadi 
> >
> > HDR10+ is dynamic metadata (A/341 Amendment - SMPTE2094-40) that needs
> to be decoded from ITU-T T.35 in HEVC bitstream. The HDR10+ is transferred
> to side data packet to be used or passed through.
> > ---
> > The fate test file can be found here:
> https://drive.google.com/file/d/1vcT0ohzpoyVFcxQN32jKIhUrBaBwZweT/view?usp=sharing
> > The video file needs to be copied to fate-suite/mov/
>
> >  configure |   1 +
> >  fftools/ffprobe.c | 106 +
> >  libavcodec/Makefile   |   3 +
> >  libavcodec/avpacket.c |   1 +
> >  libavcodec/decode.c   |   1 +
> >  libavcodec/dynamic_hdr10_plus.c   | 223 ++
> >  .../dynamic_hdr10_plus.h  |  22 +-
> >  libavcodec/hevc_sei.c |  62 -
> >  libavcodec/hevc_sei.h |   5 +
> >  libavcodec/hevcdec.c  |  18 ++
> >  libavcodec/packet.h   |   8 +
> >  libavcodec/version.h  |   2 +-
> >  libavfilter/vf_showinfo.c | 106 -
> >  libavutil/Makefile|   2 -
> >  libavutil/hdr_dynamic_metadata.c  |  47 
> >  tests/fate/mov.mak|   3 +
> >  tests/ref/fate/mov-hdr10-plus-metadata|  90 +++
> >  17 files changed, 629 insertions(+), 71 deletions(-)
> >  create mode 100644 libavcodec/dynamic_hdr10_plus.c
> >  rename libavutil/hdr_dynamic_metadata.h =>
> libavcodec/dynamic_hdr10_plus.h (95%)
>
> You cannot move a public header like that, it breaks API.
>
Right reverted the change in the following patch.

> Also, the patch does way too many things at once, it should be split.

Some changes are asked to be added by reviewers just for being able to test
it. This CL has been hanging for a long time. I think Vittorio and Ian can
help on this to proceed with this CL.

>
> --
> Anton Khirnov
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> To unsubscribe, visit link above, or email
> ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-devel] [PATCH] Support HDR10+ metadata for HEVC.

2020-11-20 Thread Anton Khirnov
Quoting Mohammad Izadi (2020-11-20 04:57:11)
> From: Mohammad Izadi 
> 
> HDR10+ is dynamic metadata (A/341 Amendment - SMPTE2094-40) that needs to be 
> decoded from ITU-T T.35 in HEVC bitstream. The HDR10+ is transferred to side 
> data packet to be used or passed through.
> ---
> The fate test file can be found here: 
> https://drive.google.com/file/d/1vcT0ohzpoyVFcxQN32jKIhUrBaBwZweT/view?usp=sharing
> The video file needs to be copied to fate-suite/mov/  
>  
>  configure |   1 +
>  fftools/ffprobe.c | 106 +
>  libavcodec/Makefile   |   3 +
>  libavcodec/avpacket.c |   1 +
>  libavcodec/decode.c   |   1 +
>  libavcodec/dynamic_hdr10_plus.c   | 223 ++
>  .../dynamic_hdr10_plus.h  |  22 +-
>  libavcodec/hevc_sei.c |  62 -
>  libavcodec/hevc_sei.h |   5 +
>  libavcodec/hevcdec.c  |  18 ++
>  libavcodec/packet.h   |   8 +
>  libavcodec/version.h  |   2 +-
>  libavfilter/vf_showinfo.c | 106 -
>  libavutil/Makefile|   2 -
>  libavutil/hdr_dynamic_metadata.c  |  47 
>  tests/fate/mov.mak|   3 +
>  tests/ref/fate/mov-hdr10-plus-metadata|  90 +++
>  17 files changed, 629 insertions(+), 71 deletions(-)
>  create mode 100644 libavcodec/dynamic_hdr10_plus.c
>  rename libavutil/hdr_dynamic_metadata.h => libavcodec/dynamic_hdr10_plus.h 
> (95%)

You cannot move a public header like that, it breaks API.
Also, the patch does way too many things at once, it should be split.

-- 
Anton Khirnov
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

[FFmpeg-devel] [PATCH] Support HDR10+ metadata for HEVC.

2020-11-19 Thread Mohammad Izadi
From: Mohammad Izadi 

HDR10+ is dynamic metadata (A/341 Amendment - SMPTE2094-40) that needs to be 
decoded from ITU-T T.35 in HEVC bitstream. The HDR10+ is transferred to side 
data packet to be used or passed through.
---
The fate test file can be found here: 
https://drive.google.com/file/d/1vcT0ohzpoyVFcxQN32jKIhUrBaBwZweT/view?usp=sharing
The video file needs to be copied to fate-suite/mov/
   
 configure |   1 +
 fftools/ffprobe.c | 106 +
 libavcodec/Makefile   |   3 +
 libavcodec/avpacket.c |   1 +
 libavcodec/decode.c   |   1 +
 libavcodec/dynamic_hdr10_plus.c   | 223 ++
 .../dynamic_hdr10_plus.h  |  22 +-
 libavcodec/hevc_sei.c |  62 -
 libavcodec/hevc_sei.h |   5 +
 libavcodec/hevcdec.c  |  18 ++
 libavcodec/packet.h   |   8 +
 libavcodec/version.h  |   2 +-
 libavfilter/vf_showinfo.c | 106 -
 libavutil/Makefile|   2 -
 libavutil/hdr_dynamic_metadata.c  |  47 
 tests/fate/mov.mak|   3 +
 tests/ref/fate/mov-hdr10-plus-metadata|  90 +++
 17 files changed, 629 insertions(+), 71 deletions(-)
 create mode 100644 libavcodec/dynamic_hdr10_plus.c
 rename libavutil/hdr_dynamic_metadata.h => libavcodec/dynamic_hdr10_plus.h 
(95%)
 delete mode 100644 libavutil/hdr_dynamic_metadata.c
 create mode 100644 tests/ref/fate/mov-hdr10-plus-metadata

diff --git a/configure b/configure
index 51e43fbf66..a9f12a421e 100755
--- a/configure
+++ b/configure
@@ -2360,6 +2360,7 @@ CONFIG_EXTRA="
 dirac_parse
 dnn
 dvprofile
+dynamic_hdr10_plus
 exif
 faandct
 faanidct
diff --git a/fftools/ffprobe.c b/fftools/ffprobe.c
index 86bd23d36d..5187e03603 100644
--- a/fftools/ffprobe.c
+++ b/fftools/ffprobe.c
@@ -30,6 +30,7 @@
 
 #include "libavformat/avformat.h"
 #include "libavcodec/avcodec.h"
+#include "libavcodec/dynamic_hdr10_plus.h"
 #include "libavutil/avassert.h"
 #include "libavutil/avstring.h"
 #include "libavutil/bprint.h"
@@ -1860,6 +1861,105 @@ static inline int show_tags(WriterContext *w, 
AVDictionary *tags, int section_id
 return ret;
 }
 
+static void print_dynamic_hdr10_plus(WriterContext *w, AVDynamicHDRPlus 
*metadata)
+{
+if (!metadata)
+return;
+print_int("application version", metadata->application_version);
+print_int("num_windows", metadata->num_windows);
+for (int n = 1; n < metadata->num_windows; n++) {
+AVHDRPlusColorTransformParams *params = &metadata->params[n];
+print_q("window_upper_left_corner_x",
+params->window_upper_left_corner_x,'/');
+print_q("window_upper_left_corner_y",
+params->window_upper_left_corner_y,'/');
+print_q("window_lower_right_corner_x",
+params->window_lower_right_corner_x,'/');
+print_q("window_lower_right_corner_y",
+params->window_lower_right_corner_y,'/');
+print_q("window_upper_left_corner_x",
+params->window_upper_left_corner_x,'/');
+print_q("window_upper_left_corner_y",
+params->window_upper_left_corner_y,'/');
+print_int("center_of_ellipse_x",
+  params->center_of_ellipse_x ) ;
+print_int("center_of_ellipse_y",
+  params->center_of_ellipse_y );
+print_int("rotation_angle",
+  params->rotation_angle);
+print_int("semimajor_axis_internal_ellipse",
+  params->semimajor_axis_internal_ellipse);
+print_int("semimajor_axis_external_ellipse",
+  params->semimajor_axis_external_ellipse);
+print_int("semiminor_axis_external_ellipse",
+  params->semiminor_axis_external_ellipse);
+print_int("overlap_process_option",
+  params->overlap_process_option);
+}
+print_q("targeted_system_display_maximum_luminance",
+metadata->targeted_system_display_maximum_luminance,'/');
+if (metadata->targeted_system_display_actual_peak_luminance_flag) {
+print_int("num_rows_targeted_system_display_actual_peak_luminance",
+  
metadata->num_rows_targeted_system_display_actual_peak_luminance);
+print_int("num_cols_targeted_system_display_actual_peak_luminance",
+  
metadata->num_cols_targeted_system_display_actual_peak_luminance);
+for (int i = 0; i < 
metadata->num_rows_targeted_system_display_actual_peak_luminance; i++) {
+for (int j = 0; j < 
metadata->num_cols_targeted_system_display_actual_peak_luminance; j++) {
+print_q("targeted_system_display_actua

Re: [FFmpeg-devel] [PATCH] Support HDR10+ metadata for HEVC.

2020-11-17 Thread Mohammad Izadi
On Sun, Nov 15, 2020 at 12:19 AM Andreas Rheinhardt <
andreas.rheinha...@gmail.com> wrote:

> Mohammad Izadi:
> > From: Mohammad Izadi 
> >
> > HDR10+ is dynamic metadata (A/341 Amendment - SMPTE2094-40) that needs
> to be decoded from ITU-T T.35 in HEVC bitstream. The HDR10+ is transferred
> to side data packet to be used or passed through.
> >
> > The fate test file can be found here:
> https://drive.google.com/file/d/1Hadzc24-RsgnRqS-B0bxLmzDeTwEOhtE/view?usp=sharing
> >
> > The video file needs to be copied to fate-suite/mov/
> > ---
>
> 1. The comments regarding fate don't belong in the commit message, they
> belong here below the --- (the --annotate option is useful for this when
> using git send-email).
>
Done.

> 2. This file is huge. Why don't you use a file with a smaller
> bitrate/resolution?
>
Took another video with ~1mb. It seems 1080p is the lowest res we can
capture HDR10+ by Samsung S10. Removed audio as well. Added the link to the
patch.

>
> - Andreas
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> To unsubscribe, visit link above, or email
> ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

[FFmpeg-devel] [PATCH] Support HDR10+ metadata for HEVC.

2020-11-17 Thread Mohammad Izadi
From: Mohammad Izadi 

HDR10+ is dynamic metadata (A/341 Amendment - SMPTE2094-40) that needs to be 
decoded from ITU-T T.35 in HEVC bitstream. The HDR10+ is transferred to side 
data packet to be used or passed through.
---
The fate test file can be found here: 
https://drive.google.com/file/d/1vcT0ohzpoyVFcxQN32jKIhUrBaBwZweT/view?usp=sharing
 
The video file needs to be copied to fate-suite/mov/
   
configure |   1 +
 fftools/ffprobe.c | 106 +
 libavcodec/Makefile   |   3 +
 libavcodec/avpacket.c |   1 +
 libavcodec/decode.c   |   1 +
 libavcodec/dynamic_hdr10_plus.c   | 223 ++
 .../dynamic_hdr10_plus.h  |  22 +-
 libavcodec/hevc_sei.c |  62 -
 libavcodec/hevc_sei.h |   5 +
 libavcodec/hevcdec.c  |  18 ++
 libavcodec/packet.h   |   8 +
 libavcodec/version.h  |   2 +-
 libavfilter/vf_showinfo.c | 106 -
 libavutil/Makefile|   2 -
 libavutil/hdr_dynamic_metadata.c  |  47 
 tests/fate/mov.mak|   3 +
 tests/ref/fate/mov-hdr10-plus-metadata|  90 +++
 17 files changed, 629 insertions(+), 71 deletions(-)
 create mode 100644 libavcodec/dynamic_hdr10_plus.c
 rename libavutil/hdr_dynamic_metadata.h => libavcodec/dynamic_hdr10_plus.h 
(95%)
 delete mode 100644 libavutil/hdr_dynamic_metadata.c
 create mode 100644 tests/ref/fate/mov-hdr10-plus-metadata

diff --git a/configure b/configure
index 51e43fbf66..a9f12a421e 100755
--- a/configure
+++ b/configure
@@ -2360,6 +2360,7 @@ CONFIG_EXTRA="
 dirac_parse
 dnn
 dvprofile
+dynamic_hdr10_plus
 exif
 faandct
 faanidct
diff --git a/fftools/ffprobe.c b/fftools/ffprobe.c
index 86bd23d36d..4cee4e8ec3 100644
--- a/fftools/ffprobe.c
+++ b/fftools/ffprobe.c
@@ -35,6 +35,7 @@
 #include "libavutil/bprint.h"
 #include "libavutil/display.h"
 #include "libavutil/hash.h"
+#include "libavutil/hdr_dynamic_metadata.h"
 #include "libavutil/mastering_display_metadata.h"
 #include "libavutil/dovi_meta.h"
 #include "libavutil/opt.h"
@@ -1860,6 +1861,105 @@ static inline int show_tags(WriterContext *w, 
AVDictionary *tags, int section_id
 return ret;
 }
 
+static void print_dynamic_hdr10_plus(WriterContext *w, AVDynamicHDRPlus 
*metadata)
+{
+if (!metadata)
+return;
+print_int("application version", metadata->application_version);
+print_int("num_windows", metadata->num_windows);
+for (int n = 1; n < metadata->num_windows; n++) {
+AVHDRPlusColorTransformParams *params = &metadata->params[n];
+print_q("window_upper_left_corner_x",
+params->window_upper_left_corner_x,'/');
+print_q("window_upper_left_corner_y",
+params->window_upper_left_corner_y,'/');
+print_q("window_lower_right_corner_x",
+params->window_lower_right_corner_x,'/');
+print_q("window_lower_right_corner_y",
+params->window_lower_right_corner_y,'/');
+print_q("window_upper_left_corner_x",
+params->window_upper_left_corner_x,'/');
+print_q("window_upper_left_corner_y",
+params->window_upper_left_corner_y,'/');
+print_int("center_of_ellipse_x",
+  params->center_of_ellipse_x ) ;
+print_int("center_of_ellipse_y",
+  params->center_of_ellipse_y );
+print_int("rotation_angle",
+  params->rotation_angle);
+print_int("semimajor_axis_internal_ellipse",
+  params->semimajor_axis_internal_ellipse);
+print_int("semimajor_axis_external_ellipse",
+  params->semimajor_axis_external_ellipse);
+print_int("semiminor_axis_external_ellipse",
+  params->semiminor_axis_external_ellipse);
+print_int("overlap_process_option",
+  params->overlap_process_option);
+}
+print_q("targeted_system_display_maximum_luminance",
+metadata->targeted_system_display_maximum_luminance,'/');
+if (metadata->targeted_system_display_actual_peak_luminance_flag) {
+print_int("num_rows_targeted_system_display_actual_peak_luminance",
+  
metadata->num_rows_targeted_system_display_actual_peak_luminance);
+print_int("num_cols_targeted_system_display_actual_peak_luminance",
+  
metadata->num_cols_targeted_system_display_actual_peak_luminance);
+for (int i = 0; i < 
metadata->num_rows_targeted_system_display_actual_peak_luminance; i++) {
+for (int j = 0; j < 
metadata->num_cols_targeted_system_display_actual_peak_luminance; j++) {
+  

[FFmpeg-devel] [PATCH] Support HDR10+ metadata for HEVC.

2020-11-16 Thread Mohammad Izadi
From: Mohammad Izadi 

HDR10+ is dynamic metadata (A/341 Amendment - SMPTE2094-40) that needs to be 
decoded from ITU-T T.35 in HEVC bitstream. The HDR10+ is transferred to side 
data packet to be used or passed through.
---
The fate test file can be found here: 
https://drive.google.com/file/d/1Hadzc24-RsgnRqS-B0bxLmzDeTwEOhtE/view?usp=sharing
The video file needs to be copied to fate-suite/mov/

configure |   1 +
 fftools/ffprobe.c | 106 +
 libavcodec/Makefile   |   3 +
 libavcodec/avpacket.c |   1 +
 libavcodec/decode.c   |   1 +
 libavcodec/dynamic_hdr10_plus.c   | 223 ++
 .../dynamic_hdr10_plus.h  |  22 +-
 libavcodec/hevc_sei.c |  62 -
 libavcodec/hevc_sei.h |   5 +
 libavcodec/hevcdec.c  |  18 ++
 libavcodec/packet.h   |   8 +
 libavcodec/version.h  |   2 +-
 libavfilter/vf_showinfo.c | 106 -
 libavutil/Makefile|   2 -
 libavutil/hdr_dynamic_metadata.c  |  47 
 tests/fate/mov.mak|   3 +
 tests/ref/fate/mov-hdr10-plus-metadata|  90 +++
 17 files changed, 629 insertions(+), 71 deletions(-)
 create mode 100644 libavcodec/dynamic_hdr10_plus.c
 rename libavutil/hdr_dynamic_metadata.h => libavcodec/dynamic_hdr10_plus.h 
(95%)
 delete mode 100644 libavutil/hdr_dynamic_metadata.c
 create mode 100644 tests/ref/fate/mov-hdr10-plus-metadata

diff --git a/configure b/configure
index 51e43fbf66..a9f12a421e 100755
--- a/configure
+++ b/configure
@@ -2360,6 +2360,7 @@ CONFIG_EXTRA="
 dirac_parse
 dnn
 dvprofile
+dynamic_hdr10_plus
 exif
 faandct
 faanidct
diff --git a/fftools/ffprobe.c b/fftools/ffprobe.c
index 86bd23d36d..4cee4e8ec3 100644
--- a/fftools/ffprobe.c
+++ b/fftools/ffprobe.c
@@ -35,6 +35,7 @@
 #include "libavutil/bprint.h"
 #include "libavutil/display.h"
 #include "libavutil/hash.h"
+#include "libavutil/hdr_dynamic_metadata.h"
 #include "libavutil/mastering_display_metadata.h"
 #include "libavutil/dovi_meta.h"
 #include "libavutil/opt.h"
@@ -1860,6 +1861,105 @@ static inline int show_tags(WriterContext *w, 
AVDictionary *tags, int section_id
 return ret;
 }
 
+static void print_dynamic_hdr10_plus(WriterContext *w, AVDynamicHDRPlus 
*metadata)
+{
+if (!metadata)
+return;
+print_int("application version", metadata->application_version);
+print_int("num_windows", metadata->num_windows);
+for (int n = 1; n < metadata->num_windows; n++) {
+AVHDRPlusColorTransformParams *params = &metadata->params[n];
+print_q("window_upper_left_corner_x",
+params->window_upper_left_corner_x,'/');
+print_q("window_upper_left_corner_y",
+params->window_upper_left_corner_y,'/');
+print_q("window_lower_right_corner_x",
+params->window_lower_right_corner_x,'/');
+print_q("window_lower_right_corner_y",
+params->window_lower_right_corner_y,'/');
+print_q("window_upper_left_corner_x",
+params->window_upper_left_corner_x,'/');
+print_q("window_upper_left_corner_y",
+params->window_upper_left_corner_y,'/');
+print_int("center_of_ellipse_x",
+  params->center_of_ellipse_x ) ;
+print_int("center_of_ellipse_y",
+  params->center_of_ellipse_y );
+print_int("rotation_angle",
+  params->rotation_angle);
+print_int("semimajor_axis_internal_ellipse",
+  params->semimajor_axis_internal_ellipse);
+print_int("semimajor_axis_external_ellipse",
+  params->semimajor_axis_external_ellipse);
+print_int("semiminor_axis_external_ellipse",
+  params->semiminor_axis_external_ellipse);
+print_int("overlap_process_option",
+  params->overlap_process_option);
+}
+print_q("targeted_system_display_maximum_luminance",
+metadata->targeted_system_display_maximum_luminance,'/');
+if (metadata->targeted_system_display_actual_peak_luminance_flag) {
+print_int("num_rows_targeted_system_display_actual_peak_luminance",
+  
metadata->num_rows_targeted_system_display_actual_peak_luminance);
+print_int("num_cols_targeted_system_display_actual_peak_luminance",
+  
metadata->num_cols_targeted_system_display_actual_peak_luminance);
+for (int i = 0; i < 
metadata->num_rows_targeted_system_display_actual_peak_luminance; i++) {
+for (int j = 0; j < 
metadata->num_cols_targeted_system_display_actual_peak_luminance; j++) {
+print_q("targeted_system_display_actual_peak_luminance",
+ 

[FFmpeg-devel] [PATCH] Support HDR10+ metadata for HEVC.

2020-11-15 Thread Mohammad Izadi
From: Mohammad Izadi 

HDR10+ is dynamic metadata (A/341 Amendment - SMPTE2094-40) that needs to be 
decoded from ITU-T T.35 in HEVC bitstream. The HDR10+ is transferred to side 
data packet to be used or passed through.
---
The fate test file can be found here: 
https://drive.google.com/file/d/1Hadzc24-RsgnRqS-B0bxLmzDeTwEOhtE/view?usp=sharing

The video file needs to be copied to fate-suite/mov/

 configure |   1 +
 fftools/ffprobe.c | 106 +
 libavcodec/Makefile   |   3 +
 libavcodec/avpacket.c |   1 +
 libavcodec/decode.c   |   1 +
 libavcodec/dynamic_hdr10_plus.c   | 223 ++
 .../dynamic_hdr10_plus.h  |  22 +-
 libavcodec/hevc_sei.c |  62 -
 libavcodec/hevc_sei.h |   5 +
 libavcodec/hevcdec.c  |  18 ++
 libavcodec/packet.h   |   8 +
 libavcodec/version.h  |   2 +-
 libavfilter/vf_showinfo.c | 106 -
 libavutil/Makefile|   2 -
 libavutil/hdr_dynamic_metadata.c  |  47 
 tests/fate/mov.mak|   3 +
 tests/ref/fate/mov-hdr10-plus-metadata|  90 +++
 17 files changed, 629 insertions(+), 71 deletions(-)
 create mode 100644 libavcodec/dynamic_hdr10_plus.c
 rename libavutil/hdr_dynamic_metadata.h => libavcodec/dynamic_hdr10_plus.h 
(95%)
 delete mode 100644 libavutil/hdr_dynamic_metadata.c
 create mode 100644 tests/ref/fate/mov-hdr10-plus-metadata

diff --git a/configure b/configure
index 51e43fbf66..a9f12a421e 100755
--- a/configure
+++ b/configure
@@ -2360,6 +2360,7 @@ CONFIG_EXTRA="
 dirac_parse
 dnn
 dvprofile
+dynamic_hdr10_plus
 exif
 faandct
 faanidct
diff --git a/fftools/ffprobe.c b/fftools/ffprobe.c
index 86bd23d36d..4cee4e8ec3 100644
--- a/fftools/ffprobe.c
+++ b/fftools/ffprobe.c
@@ -35,6 +35,7 @@
 #include "libavutil/bprint.h"
 #include "libavutil/display.h"
 #include "libavutil/hash.h"
+#include "libavutil/hdr_dynamic_metadata.h"
 #include "libavutil/mastering_display_metadata.h"
 #include "libavutil/dovi_meta.h"
 #include "libavutil/opt.h"
@@ -1860,6 +1861,105 @@ static inline int show_tags(WriterContext *w, 
AVDictionary *tags, int section_id
 return ret;
 }
 
+static void print_dynamic_hdr10_plus(WriterContext *w, AVDynamicHDRPlus 
*metadata)
+{
+if (!metadata)
+return;
+print_int("application version", metadata->application_version);
+print_int("num_windows", metadata->num_windows);
+for (int n = 1; n < metadata->num_windows; n++) {
+AVHDRPlusColorTransformParams *params = &metadata->params[n];
+print_q("window_upper_left_corner_x",
+params->window_upper_left_corner_x,'/');
+print_q("window_upper_left_corner_y",
+params->window_upper_left_corner_y,'/');
+print_q("window_lower_right_corner_x",
+params->window_lower_right_corner_x,'/');
+print_q("window_lower_right_corner_y",
+params->window_lower_right_corner_y,'/');
+print_q("window_upper_left_corner_x",
+params->window_upper_left_corner_x,'/');
+print_q("window_upper_left_corner_y",
+params->window_upper_left_corner_y,'/');
+print_int("center_of_ellipse_x",
+  params->center_of_ellipse_x ) ;
+print_int("center_of_ellipse_y",
+  params->center_of_ellipse_y );
+print_int("rotation_angle",
+  params->rotation_angle);
+print_int("semimajor_axis_internal_ellipse",
+  params->semimajor_axis_internal_ellipse);
+print_int("semimajor_axis_external_ellipse",
+  params->semimajor_axis_external_ellipse);
+print_int("semiminor_axis_external_ellipse",
+  params->semiminor_axis_external_ellipse);
+print_int("overlap_process_option",
+  params->overlap_process_option);
+}
+print_q("targeted_system_display_maximum_luminance",
+metadata->targeted_system_display_maximum_luminance,'/');
+if (metadata->targeted_system_display_actual_peak_luminance_flag) {
+print_int("num_rows_targeted_system_display_actual_peak_luminance",
+  
metadata->num_rows_targeted_system_display_actual_peak_luminance);
+print_int("num_cols_targeted_system_display_actual_peak_luminance",
+  
metadata->num_cols_targeted_system_display_actual_peak_luminance);
+for (int i = 0; i < 
metadata->num_rows_targeted_system_display_actual_peak_luminance; i++) {
+for (int j = 0; j < 
metadata->num_cols_targeted_system_display_actual_peak_luminance; j++) {
+print_q("targeted_system_display_actual_peak_luminance",

Re: [FFmpeg-devel] [PATCH] Support HDR10+ metadata for HEVC.

2020-11-15 Thread Andreas Rheinhardt
Mohammad Izadi:
> From: Mohammad Izadi 
> 
> HDR10+ is dynamic metadata (A/341 Amendment - SMPTE2094-40) that needs to be 
> decoded from ITU-T T.35 in HEVC bitstream. The HDR10+ is transferred to side 
> data packet to be used or passed through.
> 
> The fate test file can be found here: 
> https://drive.google.com/file/d/1Hadzc24-RsgnRqS-B0bxLmzDeTwEOhtE/view?usp=sharing
> 
> The video file needs to be copied to fate-suite/mov/
> ---

1. The comments regarding fate don't belong in the commit message, they
belong here below the --- (the --annotate option is useful for this when
using git send-email).
2. This file is huge. Why don't you use a file with a smaller
bitrate/resolution?

- Andreas
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

[FFmpeg-devel] [PATCH] Support HDR10+ metadata for HEVC.

2020-11-14 Thread Mohammad Izadi
From: Mohammad Izadi 

HDR10+ is dynamic metadata (A/341 Amendment - SMPTE2094-40) that needs to be 
decoded from ITU-T T.35 in HEVC bitstream. The HDR10+ is transferred to side 
data packet to be used or passed through.

The fate test file can be found here: 
https://drive.google.com/file/d/1Hadzc24-RsgnRqS-B0bxLmzDeTwEOhtE/view?usp=sharing

The video file needs to be copied to fate-suite/mov/
---
 configure |   1 +
 fftools/ffprobe.c | 106 +
 libavcodec/Makefile   |   3 +
 libavcodec/avpacket.c |   1 +
 libavcodec/decode.c   |   1 +
 libavcodec/dynamic_hdr10_plus.c   | 223 ++
 .../dynamic_hdr10_plus.h  |  22 +-
 libavcodec/hevc_sei.c |  62 -
 libavcodec/hevc_sei.h |   5 +
 libavcodec/hevcdec.c  |  18 ++
 libavcodec/packet.h   |   8 +
 libavcodec/version.h  |   2 +-
 libavfilter/vf_showinfo.c | 106 -
 libavutil/Makefile|   2 -
 libavutil/hdr_dynamic_metadata.c  |  47 
 tests/fate/mov.mak|   3 +
 tests/ref/fate/mov-hdr10-plus-metadata|  90 +++
 17 files changed, 629 insertions(+), 71 deletions(-)
 create mode 100644 libavcodec/dynamic_hdr10_plus.c
 rename libavutil/hdr_dynamic_metadata.h => libavcodec/dynamic_hdr10_plus.h 
(95%)
 delete mode 100644 libavutil/hdr_dynamic_metadata.c
 create mode 100644 tests/ref/fate/mov-hdr10-plus-metadata

diff --git a/configure b/configure
index 51e43fbf66..a9f12a421e 100755
--- a/configure
+++ b/configure
@@ -2360,6 +2360,7 @@ CONFIG_EXTRA="
 dirac_parse
 dnn
 dvprofile
+dynamic_hdr10_plus
 exif
 faandct
 faanidct
diff --git a/fftools/ffprobe.c b/fftools/ffprobe.c
index 86bd23d36d..4cee4e8ec3 100644
--- a/fftools/ffprobe.c
+++ b/fftools/ffprobe.c
@@ -35,6 +35,7 @@
 #include "libavutil/bprint.h"
 #include "libavutil/display.h"
 #include "libavutil/hash.h"
+#include "libavutil/hdr_dynamic_metadata.h"
 #include "libavutil/mastering_display_metadata.h"
 #include "libavutil/dovi_meta.h"
 #include "libavutil/opt.h"
@@ -1860,6 +1861,105 @@ static inline int show_tags(WriterContext *w, 
AVDictionary *tags, int section_id
 return ret;
 }
 
+static void print_dynamic_hdr10_plus(WriterContext *w, AVDynamicHDRPlus 
*metadata)
+{
+if (!metadata)
+return;
+print_int("application version", metadata->application_version);
+print_int("num_windows", metadata->num_windows);
+for (int n = 1; n < metadata->num_windows; n++) {
+AVHDRPlusColorTransformParams *params = &metadata->params[n];
+print_q("window_upper_left_corner_x",
+params->window_upper_left_corner_x,'/');
+print_q("window_upper_left_corner_y",
+params->window_upper_left_corner_y,'/');
+print_q("window_lower_right_corner_x",
+params->window_lower_right_corner_x,'/');
+print_q("window_lower_right_corner_y",
+params->window_lower_right_corner_y,'/');
+print_q("window_upper_left_corner_x",
+params->window_upper_left_corner_x,'/');
+print_q("window_upper_left_corner_y",
+params->window_upper_left_corner_y,'/');
+print_int("center_of_ellipse_x",
+  params->center_of_ellipse_x ) ;
+print_int("center_of_ellipse_y",
+  params->center_of_ellipse_y );
+print_int("rotation_angle",
+  params->rotation_angle);
+print_int("semimajor_axis_internal_ellipse",
+  params->semimajor_axis_internal_ellipse);
+print_int("semimajor_axis_external_ellipse",
+  params->semimajor_axis_external_ellipse);
+print_int("semiminor_axis_external_ellipse",
+  params->semiminor_axis_external_ellipse);
+print_int("overlap_process_option",
+  params->overlap_process_option);
+}
+print_q("targeted_system_display_maximum_luminance",
+metadata->targeted_system_display_maximum_luminance,'/');
+if (metadata->targeted_system_display_actual_peak_luminance_flag) {
+print_int("num_rows_targeted_system_display_actual_peak_luminance",
+  
metadata->num_rows_targeted_system_display_actual_peak_luminance);
+print_int("num_cols_targeted_system_display_actual_peak_luminance",
+  
metadata->num_cols_targeted_system_display_actual_peak_luminance);
+for (int i = 0; i < 
metadata->num_rows_targeted_system_display_actual_peak_luminance; i++) {
+for (int j = 0; j < 
metadata->num_cols_targeted_system_display_actual_peak_luminance; j++) {
+print_q("targeted_system_display_actual_peak_luminance",

Re: [FFmpeg-devel] [PATCH] Support HDR10+ metadata for HEVC.

2020-11-14 Thread Mohammad Izadi
Thank you Ian for your great detailed comments.

Thanks,
Mohammad


On Wed, Nov 11, 2020 at 5:10 PM Jan Ekström  wrote:

> On 14.10.2020 2:53, Mohammad Izadi wrote:
> > From: Mohammad Izadi 
> >
> > HDR10+ is dynamic metadata (A/341 Amendment - SMPTE2094-40) that needs
> to be decoded from ITU-T T.35 in HEVC bitstream. The HDR10+ is transferred
> to side data packet to be used or passed through.
> >
> > The fate test file can be found here:
> https://drive.google.com/file/d/1Hadzc24-RsgnRqS-B0bxLmzDeTwEOhtE/view?usp=sharing
> >
> > The video file needs to be copied to fate-suite/mov/
> > ---
>
> Long overdue initial attempt at a review follows...
>
> >  fftools/ffprobe.c  |  16 +++
> >  libavcodec/avpacket.c  |   1 +
> >  libavcodec/decode.c|   1 +
> >  libavcodec/hevc_sei.c  |  39 --
> >  libavcodec/hevc_sei.h  |   5 +
> >  libavcodec/hevcdec.c   |  16 +++
> >  libavcodec/internal.h  |   9 ++
> >  libavcodec/packet.h|   8 ++
> >  libavcodec/utils.c | 180 +
> >  libavcodec/version.h   |   2 +-
> >  libavfilter/vf_showinfo.c  |  28 
> >  tests/fate/mov.mak |   3 +
> >  tests/ref/fate/mov-hdr10-plus-metadata |  55 
> >  13 files changed, 350 insertions(+), 13 deletions(-)
> >  create mode 100644 tests/ref/fate/mov-hdr10-plus-metadata
> >
> > diff --git a/fftools/ffprobe.c b/fftools/ffprobe.c
> > index d4e494f11f..0b80edf842 100644
> > --- a/fftools/ffprobe.c
> > +++ b/fftools/ffprobe.c
> > @@ -35,6 +35,7 @@
> >  #include "libavutil/bprint.h"
> >  #include "libavutil/display.h"
> >  #include "libavutil/hash.h"
> > +#include "libavutil/hdr_dynamic_metadata.h"
> >  #include "libavutil/mastering_display_metadata.h"
> >  #include "libavutil/dovi_meta.h"
> >  #include "libavutil/opt.h"
> > @@ -1925,6 +1926,13 @@ static void print_pkt_side_data(WriterContext *w,
> >  print_q("min_luminance", metadata->min_luminance, '/');
> >  print_q("max_luminance", metadata->max_luminance, '/');
> >  }
> > +} else if (sd->type == AV_PKT_DATA_DYNAMIC_HDR_PLUS) {
> > +AVDynamicHDRPlus *metadata = (AVDynamicHDRPlus *)sd->data;
> > +// Partially print HDR10+ metadata.
> > +print_int("num_windows", metadata->num_windows);
> > +print_q("targeted_system_display_maximum_luminance",
> metadata->targeted_system_display_maximum_luminance, '/');
> > +
> print_int("targeted_system_display_actual_peak_luminance_flag",
> metadata->targeted_system_display_actual_peak_luminance_flag);
> > +print_int("mastering_display_actual_peak_luminance_flag",
> metadata->mastering_display_actual_peak_luminance_flag);
> >  } else if (sd->type == AV_PKT_DATA_CONTENT_LIGHT_LEVEL) {
> >  AVContentLightMetadata *metadata = (AVContentLightMetadata
> *)sd->data;
> >  print_int("max_content", metadata->MaxCLL);
> > @@ -2250,6 +2258,14 @@ static void show_frame(WriterContext *w, AVFrame
> *frame, AVStream *stream,
> >  print_q("min_luminance", metadata->min_luminance,
> '/');
> >  print_q("max_luminance", metadata->max_luminance,
> '/');
> >  }
> > +} else if (sd->type == AV_FRAME_DATA_DYNAMIC_HDR_PLUS) {
> > +AVDynamicHDRPlus *metadata = (AVDynamicHDRPlus
> *)sd->data;
> > +// Partially print HDR10+ metadata.
> > + print_int("num_windows", metadata->num_windows);
> > + print_q("targeted_system_display_maximum_luminance",
> metadata->targeted_system_display_maximum_luminance, '/');
> > +
>  print_int("targeted_system_display_actual_peak_luminance_flag",
> metadata->targeted_system_display_actual_peak_luminance_flag);
> > + print_int("mastering_display_actual_peak_luminance_flag",
> metadata->mastering_display_actual_peak_luminance_flag);
> > +
>
> Some really minor stuff:
> - Empty line at the end
> - Tabs vs space, seemingly some tabs ended up here. Copy and paste can
> make that happen. I know this has been done in this duplicated fashion so
> far, but maybe this should just be in a static function that takes in a
> AVDynamicHDRPlus pointer and could just be called from two places?
>
fixed.

> - I am not sure of the whole history of this patch set, but was there any
> explanation on why these specific values should be the ones from which
> printing should be started since we are not printing the whole
> (complicated) structure? I think so far our practice has been to dump all
> values from the structures, except for the flags for whether a thing exists
> or not (see the example with "has_primaries"/"has_luminance" for mastering
> display metadata, and the loop within S12M timecode printing for lists of
> things), so even if we limit initial printi

Re: [FFmpeg-devel] [PATCH] Support HDR10+ metadata for HEVC.

2020-11-11 Thread Jan Ekström
On 14.10.2020 2:53, Mohammad Izadi wrote:
> From: Mohammad Izadi 
>
> HDR10+ is dynamic metadata (A/341 Amendment - SMPTE2094-40) that needs to be 
> decoded from ITU-T T.35 in HEVC bitstream. The HDR10+ is transferred to side 
> data packet to be used or passed through.
>
> The fate test file can be found here: 
> https://drive.google.com/file/d/1Hadzc24-RsgnRqS-B0bxLmzDeTwEOhtE/view?usp=sharing
>
> The video file needs to be copied to fate-suite/mov/
> ---

Long overdue initial attempt at a review follows...

>  fftools/ffprobe.c  |  16 +++
>  libavcodec/avpacket.c  |   1 +
>  libavcodec/decode.c|   1 +
>  libavcodec/hevc_sei.c  |  39 --
>  libavcodec/hevc_sei.h  |   5 +
>  libavcodec/hevcdec.c   |  16 +++
>  libavcodec/internal.h  |   9 ++
>  libavcodec/packet.h|   8 ++
>  libavcodec/utils.c | 180 +
>  libavcodec/version.h   |   2 +-
>  libavfilter/vf_showinfo.c  |  28 
>  tests/fate/mov.mak |   3 +
>  tests/ref/fate/mov-hdr10-plus-metadata |  55 
>  13 files changed, 350 insertions(+), 13 deletions(-)
>  create mode 100644 tests/ref/fate/mov-hdr10-plus-metadata
>
> diff --git a/fftools/ffprobe.c b/fftools/ffprobe.c
> index d4e494f11f..0b80edf842 100644
> --- a/fftools/ffprobe.c
> +++ b/fftools/ffprobe.c
> @@ -35,6 +35,7 @@
>  #include "libavutil/bprint.h"
>  #include "libavutil/display.h"
>  #include "libavutil/hash.h"
> +#include "libavutil/hdr_dynamic_metadata.h"
>  #include "libavutil/mastering_display_metadata.h"
>  #include "libavutil/dovi_meta.h"
>  #include "libavutil/opt.h"
> @@ -1925,6 +1926,13 @@ static void print_pkt_side_data(WriterContext *w,
>  print_q("min_luminance", metadata->min_luminance, '/');
>  print_q("max_luminance", metadata->max_luminance, '/');
>  }
> +} else if (sd->type == AV_PKT_DATA_DYNAMIC_HDR_PLUS) {
> +AVDynamicHDRPlus *metadata = (AVDynamicHDRPlus *)sd->data;
> +// Partially print HDR10+ metadata.
> +print_int("num_windows", metadata->num_windows);
> +print_q("targeted_system_display_maximum_luminance", 
> metadata->targeted_system_display_maximum_luminance, '/');
> +print_int("targeted_system_display_actual_peak_luminance_flag", 
> metadata->targeted_system_display_actual_peak_luminance_flag);
> +print_int("mastering_display_actual_peak_luminance_flag", 
> metadata->mastering_display_actual_peak_luminance_flag);
>  } else if (sd->type == AV_PKT_DATA_CONTENT_LIGHT_LEVEL) {
>  AVContentLightMetadata *metadata = (AVContentLightMetadata 
> *)sd->data;
>  print_int("max_content", metadata->MaxCLL);
> @@ -2250,6 +2258,14 @@ static void show_frame(WriterContext *w, AVFrame 
> *frame, AVStream *stream,
>  print_q("min_luminance", metadata->min_luminance, '/');
>  print_q("max_luminance", metadata->max_luminance, '/');
>  }
> +} else if (sd->type == AV_FRAME_DATA_DYNAMIC_HDR_PLUS) {
> +AVDynamicHDRPlus *metadata = (AVDynamicHDRPlus *)sd->data;
> +// Partially print HDR10+ metadata.
> + print_int("num_windows", metadata->num_windows);
> + print_q("targeted_system_display_maximum_luminance", 
> metadata->targeted_system_display_maximum_luminance, '/');
> + print_int("targeted_system_display_actual_peak_luminance_flag", 
> metadata->targeted_system_display_actual_peak_luminance_flag);
> + print_int("mastering_display_actual_peak_luminance_flag", 
> metadata->mastering_display_actual_peak_luminance_flag);
> +

Some really minor stuff:
- Empty line at the end
- Tabs vs space, seemingly some tabs ended up here. Copy and paste can make 
that happen. I know this has been done in this duplicated fashion so far, but 
maybe this should just be in a static function that takes in a AVDynamicHDRPlus 
pointer and could just be called from two places?
- I am not sure of the whole history of this patch set, but was there any 
explanation on why these specific values should be the ones from which printing 
should be started since we are not printing the whole (complicated) structure? 
I think so far our practice has been to dump all values from the structures, 
except for the flags for whether a thing exists or not (see the example with 
"has_primaries"/"has_luminance" for mastering display metadata, and the loop 
within S12M timecode printing for lists of things), so even if we limit initial 
printing to certain values, printing out flags instead of actual possible 
values is an interesting selection.

>  } else if (sd->type == AV_FRAME_DATA_CONTENT_LIGHT_LEVEL) {
>  AVContentLightMetadata *metadata = (AVContentLightMetadat

Re: [FFmpeg-devel] [PATCH] Support HDR10+ metadata for HEVC.

2020-11-11 Thread Mohammad Izadi
Is anybody there? Any update? Can we push it to the head?

Thanks,
Mohammad


On Fri, Nov 6, 2020 at 9:42 PM Mohammad Izadi  wrote:

> Any update? Can we push it to the head?
> Thanks,
> Mohammad
>
>
> On Mon, Oct 26, 2020 at 11:53 AM Mohammad Izadi  wrote:
>
>> Thank you, Jan! I hope you feel better soon.
>>
>>
>>
>> On Sun, Oct 25, 2020 at 5:49 PM Jan Ekström  wrote:
>>
>>> On Wed, Oct 14, 2020 at 2:54 AM Mohammad Izadi
>>>  wrote:
>>> >
>>> > From: Mohammad Izadi 
>>> >
>>> > HDR10+ is dynamic metadata (A/341 Amendment - SMPTE2094-40) that needs
>>> to be decoded from ITU-T T.35 in HEVC bitstream. The HDR10+ is transferred
>>> to side data packet to be used or passed through.
>>> >
>>> > The fate test file can be found here:
>>> https://drive.google.com/file/d/1Hadzc24-RsgnRqS-B0bxLmzDeTwEOhtE/view?usp=sharing
>>> >
>>> > The video file needs to be copied to fate-suite/mov/
>>> > ---
>>>
>>> Thanks for posting the latest version of this patch, unfortunately it
>>> also coincided with me first trying to get the colorspace ffmpeg.c
>>> patch forwards, and then getting a flu/cold which is still ongoing.
>>>
>>> Applied it after some tweaking as
>>> https://github.com/jeeb/ffmpeg/commits/hdr10plus_v2 and it does
>>> compile.
>>>
>>> Will attempt to review it as I get the time and feel better.
>>>
>>> Jan
>>> ___
>>> ffmpeg-devel mailing list
>>> ffmpeg-devel@ffmpeg.org
>>> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>>>
>>> To unsubscribe, visit link above, or email
>>> ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
>>
>>
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-devel] [PATCH] Support HDR10+ metadata for HEVC.

2020-11-06 Thread Mohammad Izadi
Any update? Can we push it to the head?
Thanks,
Mohammad


On Mon, Oct 26, 2020 at 11:53 AM Mohammad Izadi  wrote:

> Thank you, Jan! I hope you feel better soon.
>
>
>
> On Sun, Oct 25, 2020 at 5:49 PM Jan Ekström  wrote:
>
>> On Wed, Oct 14, 2020 at 2:54 AM Mohammad Izadi
>>  wrote:
>> >
>> > From: Mohammad Izadi 
>> >
>> > HDR10+ is dynamic metadata (A/341 Amendment - SMPTE2094-40) that needs
>> to be decoded from ITU-T T.35 in HEVC bitstream. The HDR10+ is transferred
>> to side data packet to be used or passed through.
>> >
>> > The fate test file can be found here:
>> https://drive.google.com/file/d/1Hadzc24-RsgnRqS-B0bxLmzDeTwEOhtE/view?usp=sharing
>> >
>> > The video file needs to be copied to fate-suite/mov/
>> > ---
>>
>> Thanks for posting the latest version of this patch, unfortunately it
>> also coincided with me first trying to get the colorspace ffmpeg.c
>> patch forwards, and then getting a flu/cold which is still ongoing.
>>
>> Applied it after some tweaking as
>> https://github.com/jeeb/ffmpeg/commits/hdr10plus_v2 and it does
>> compile.
>>
>> Will attempt to review it as I get the time and feel better.
>>
>> Jan
>> ___
>> ffmpeg-devel mailing list
>> ffmpeg-devel@ffmpeg.org
>> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>>
>> To unsubscribe, visit link above, or email
>> ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
>
>
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-devel] [PATCH] Support HDR10+ metadata for HEVC.

2020-10-26 Thread Mohammad Izadi
Thank you, Jan! I hope you feel better soon.



On Sun, Oct 25, 2020 at 5:49 PM Jan Ekström  wrote:

> On Wed, Oct 14, 2020 at 2:54 AM Mohammad Izadi
>  wrote:
> >
> > From: Mohammad Izadi 
> >
> > HDR10+ is dynamic metadata (A/341 Amendment - SMPTE2094-40) that needs
> to be decoded from ITU-T T.35 in HEVC bitstream. The HDR10+ is transferred
> to side data packet to be used or passed through.
> >
> > The fate test file can be found here:
> https://drive.google.com/file/d/1Hadzc24-RsgnRqS-B0bxLmzDeTwEOhtE/view?usp=sharing
> >
> > The video file needs to be copied to fate-suite/mov/
> > ---
>
> Thanks for posting the latest version of this patch, unfortunately it
> also coincided with me first trying to get the colorspace ffmpeg.c
> patch forwards, and then getting a flu/cold which is still ongoing.
>
> Applied it after some tweaking as
> https://github.com/jeeb/ffmpeg/commits/hdr10plus_v2 and it does
> compile.
>
> Will attempt to review it as I get the time and feel better.
>
> Jan
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> To unsubscribe, visit link above, or email
> ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-devel] [PATCH] Support HDR10+ metadata for HEVC.

2020-10-25 Thread Jan Ekström
On Wed, Oct 14, 2020 at 2:54 AM Mohammad Izadi
 wrote:
>
> From: Mohammad Izadi 
>
> HDR10+ is dynamic metadata (A/341 Amendment - SMPTE2094-40) that needs to be 
> decoded from ITU-T T.35 in HEVC bitstream. The HDR10+ is transferred to side 
> data packet to be used or passed through.
>
> The fate test file can be found here: 
> https://drive.google.com/file/d/1Hadzc24-RsgnRqS-B0bxLmzDeTwEOhtE/view?usp=sharing
>
> The video file needs to be copied to fate-suite/mov/
> ---

Thanks for posting the latest version of this patch, unfortunately it
also coincided with me first trying to get the colorspace ffmpeg.c
patch forwards, and then getting a flu/cold which is still ongoing.

Applied it after some tweaking as
https://github.com/jeeb/ffmpeg/commits/hdr10plus_v2 and it does
compile.

Will attempt to review it as I get the time and feel better.

Jan
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-devel] [PATCH] Support HDR10+ metadata for HEVC.

2020-10-24 Thread Harry Mallon


> On 23 Oct 2020, at 05:57, Mohammad Izadi  
> wrote:
> 
> Any comments?
> 
> Thanks,
> Mohammad
> 
> 
> On Tue, Oct 13, 2020 at 4:53 PM Mohammad Izadi  wrote:
> 
>> From: Mohammad Izadi 
>> 
>> [..]

Hi Mohammad,

Your change is in Patchwork here 
https://patchwork.ffmpeg.org/project/ffmpeg/patch/20201013235345.2609036-1-iz...@google.com/

It seems the automatic testing was not able to apply your patches on top of 
master. Maybe they need to be rebased?

Best,
Harry
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-devel] [PATCH] Support HDR10+ metadata for HEVC.

2020-10-22 Thread Mohammad Izadi
Any comments?

Thanks,
Mohammad


On Tue, Oct 13, 2020 at 4:53 PM Mohammad Izadi  wrote:

> From: Mohammad Izadi 
>
> HDR10+ is dynamic metadata (A/341 Amendment - SMPTE2094-40) that needs to
> be decoded from ITU-T T.35 in HEVC bitstream. The HDR10+ is transferred to
> side data packet to be used or passed through.
>
> The fate test file can be found here:
> https://drive.google.com/file/d/1Hadzc24-RsgnRqS-B0bxLmzDeTwEOhtE/view?usp=sharing
>
> The video file needs to be copied to fate-suite/mov/
> ---
>  fftools/ffprobe.c  |  16 +++
>  libavcodec/avpacket.c  |   1 +
>  libavcodec/decode.c|   1 +
>  libavcodec/hevc_sei.c  |  39 --
>  libavcodec/hevc_sei.h  |   5 +
>  libavcodec/hevcdec.c   |  16 +++
>  libavcodec/internal.h  |   9 ++
>  libavcodec/packet.h|   8 ++
>  libavcodec/utils.c | 180 +
>  libavcodec/version.h   |   2 +-
>  libavfilter/vf_showinfo.c  |  28 
>  tests/fate/mov.mak |   3 +
>  tests/ref/fate/mov-hdr10-plus-metadata |  55 
>  13 files changed, 350 insertions(+), 13 deletions(-)
>  create mode 100644 tests/ref/fate/mov-hdr10-plus-metadata
>
> diff --git a/fftools/ffprobe.c b/fftools/ffprobe.c
> index d4e494f11f..0b80edf842 100644
> --- a/fftools/ffprobe.c
> +++ b/fftools/ffprobe.c
> @@ -35,6 +35,7 @@
>  #include "libavutil/bprint.h"
>  #include "libavutil/display.h"
>  #include "libavutil/hash.h"
> +#include "libavutil/hdr_dynamic_metadata.h"
>  #include "libavutil/mastering_display_metadata.h"
>  #include "libavutil/dovi_meta.h"
>  #include "libavutil/opt.h"
> @@ -1925,6 +1926,13 @@ static void print_pkt_side_data(WriterContext *w,
>  print_q("min_luminance", metadata->min_luminance, '/');
>  print_q("max_luminance", metadata->max_luminance, '/');
>  }
> +} else if (sd->type == AV_PKT_DATA_DYNAMIC_HDR_PLUS) {
> +AVDynamicHDRPlus *metadata = (AVDynamicHDRPlus *)sd->data;
> +// Partially print HDR10+ metadata.
> +print_int("num_windows", metadata->num_windows);
> +print_q("targeted_system_display_maximum_luminance",
> metadata->targeted_system_display_maximum_luminance, '/');
> +
> print_int("targeted_system_display_actual_peak_luminance_flag",
> metadata->targeted_system_display_actual_peak_luminance_flag);
> +print_int("mastering_display_actual_peak_luminance_flag",
> metadata->mastering_display_actual_peak_luminance_flag);
>  } else if (sd->type == AV_PKT_DATA_CONTENT_LIGHT_LEVEL) {
>  AVContentLightMetadata *metadata = (AVContentLightMetadata
> *)sd->data;
>  print_int("max_content", metadata->MaxCLL);
> @@ -2250,6 +2258,14 @@ static void show_frame(WriterContext *w, AVFrame
> *frame, AVStream *stream,
>  print_q("min_luminance", metadata->min_luminance,
> '/');
>  print_q("max_luminance", metadata->max_luminance,
> '/');
>  }
> +} else if (sd->type == AV_FRAME_DATA_DYNAMIC_HDR_PLUS) {
> +AVDynamicHDRPlus *metadata = (AVDynamicHDRPlus *)sd->data;
> +// Partially print HDR10+ metadata.
> +   print_int("num_windows", metadata->num_windows);
> +   print_q("targeted_system_display_maximum_luminance",
> metadata->targeted_system_display_maximum_luminance, '/');
> +
>  print_int("targeted_system_display_actual_peak_luminance_flag",
> metadata->targeted_system_display_actual_peak_luminance_flag);
> +   print_int("mastering_display_actual_peak_luminance_flag",
> metadata->mastering_display_actual_peak_luminance_flag);
> +
>  } else if (sd->type == AV_FRAME_DATA_CONTENT_LIGHT_LEVEL) {
>  AVContentLightMetadata *metadata =
> (AVContentLightMetadata *)sd->data;
>  print_int("max_content", metadata->MaxCLL);
> diff --git a/libavcodec/avpacket.c b/libavcodec/avpacket.c
> index dce26cb31a..8307032335 <(830)%20703-2335> 100644
> --- a/libavcodec/avpacket.c
> +++ b/libavcodec/avpacket.c
> @@ -394,6 +394,7 @@ const char *av_packet_side_data_name(enum
> AVPacketSideDataType type)
>  case AV_PKT_DATA_CONTENT_LIGHT_LEVEL:return "Content light
> level metadata";
>  case AV_PKT_DATA_SPHERICAL:  return "Spherical
> Mapping";
>  case AV_PKT_DATA_A53_CC: return "A53 Closed
> Captions";
> +case AV_PKT_DATA_DYNAMIC_HDR_PLUS:   return "HDR10+ Dynamic
> Metadata (SMPTE 2094-40)";
>  case AV_PKT_DATA_ENCRYPTION_INIT_INFO:   return "Encryption
> initialization data";
>  case AV_PKT_DATA_ENCRYPTION_INFO:return "Encryption info";
>  case AV_PKT_DATA_AFD:return "Active Format
> Description data";
> diff --git a/libavcodec/decode.c b/libavco

[FFmpeg-devel] [PATCH] Support HDR10+ metadata for HEVC.

2020-10-13 Thread Mohammad Izadi
From: Mohammad Izadi 

HDR10+ is dynamic metadata (A/341 Amendment - SMPTE2094-40) that needs to be 
decoded from ITU-T T.35 in HEVC bitstream. The HDR10+ is transferred to side 
data packet to be used or passed through.

The fate test file can be found here: 
https://drive.google.com/file/d/1Hadzc24-RsgnRqS-B0bxLmzDeTwEOhtE/view?usp=sharing

The video file needs to be copied to fate-suite/mov/
---
 fftools/ffprobe.c  |  16 +++
 libavcodec/avpacket.c  |   1 +
 libavcodec/decode.c|   1 +
 libavcodec/hevc_sei.c  |  39 --
 libavcodec/hevc_sei.h  |   5 +
 libavcodec/hevcdec.c   |  16 +++
 libavcodec/internal.h  |   9 ++
 libavcodec/packet.h|   8 ++
 libavcodec/utils.c | 180 +
 libavcodec/version.h   |   2 +-
 libavfilter/vf_showinfo.c  |  28 
 tests/fate/mov.mak |   3 +
 tests/ref/fate/mov-hdr10-plus-metadata |  55 
 13 files changed, 350 insertions(+), 13 deletions(-)
 create mode 100644 tests/ref/fate/mov-hdr10-plus-metadata

diff --git a/fftools/ffprobe.c b/fftools/ffprobe.c
index d4e494f11f..0b80edf842 100644
--- a/fftools/ffprobe.c
+++ b/fftools/ffprobe.c
@@ -35,6 +35,7 @@
 #include "libavutil/bprint.h"
 #include "libavutil/display.h"
 #include "libavutil/hash.h"
+#include "libavutil/hdr_dynamic_metadata.h"
 #include "libavutil/mastering_display_metadata.h"
 #include "libavutil/dovi_meta.h"
 #include "libavutil/opt.h"
@@ -1925,6 +1926,13 @@ static void print_pkt_side_data(WriterContext *w,
 print_q("min_luminance", metadata->min_luminance, '/');
 print_q("max_luminance", metadata->max_luminance, '/');
 }
+} else if (sd->type == AV_PKT_DATA_DYNAMIC_HDR_PLUS) {
+AVDynamicHDRPlus *metadata = (AVDynamicHDRPlus *)sd->data;
+// Partially print HDR10+ metadata.
+print_int("num_windows", metadata->num_windows);
+print_q("targeted_system_display_maximum_luminance", 
metadata->targeted_system_display_maximum_luminance, '/');
+print_int("targeted_system_display_actual_peak_luminance_flag", 
metadata->targeted_system_display_actual_peak_luminance_flag);
+print_int("mastering_display_actual_peak_luminance_flag", 
metadata->mastering_display_actual_peak_luminance_flag);
 } else if (sd->type == AV_PKT_DATA_CONTENT_LIGHT_LEVEL) {
 AVContentLightMetadata *metadata = (AVContentLightMetadata 
*)sd->data;
 print_int("max_content", metadata->MaxCLL);
@@ -2250,6 +2258,14 @@ static void show_frame(WriterContext *w, AVFrame *frame, 
AVStream *stream,
 print_q("min_luminance", metadata->min_luminance, '/');
 print_q("max_luminance", metadata->max_luminance, '/');
 }
+} else if (sd->type == AV_FRAME_DATA_DYNAMIC_HDR_PLUS) {
+AVDynamicHDRPlus *metadata = (AVDynamicHDRPlus *)sd->data;
+// Partially print HDR10+ metadata.
+   print_int("num_windows", metadata->num_windows);
+   print_q("targeted_system_display_maximum_luminance", 
metadata->targeted_system_display_maximum_luminance, '/');
+   print_int("targeted_system_display_actual_peak_luminance_flag", 
metadata->targeted_system_display_actual_peak_luminance_flag);
+   print_int("mastering_display_actual_peak_luminance_flag", 
metadata->mastering_display_actual_peak_luminance_flag);
+
 } else if (sd->type == AV_FRAME_DATA_CONTENT_LIGHT_LEVEL) {
 AVContentLightMetadata *metadata = (AVContentLightMetadata 
*)sd->data;
 print_int("max_content", metadata->MaxCLL);
diff --git a/libavcodec/avpacket.c b/libavcodec/avpacket.c
index dce26cb31a..8307032335 100644
--- a/libavcodec/avpacket.c
+++ b/libavcodec/avpacket.c
@@ -394,6 +394,7 @@ const char *av_packet_side_data_name(enum 
AVPacketSideDataType type)
 case AV_PKT_DATA_CONTENT_LIGHT_LEVEL:return "Content light level 
metadata";
 case AV_PKT_DATA_SPHERICAL:  return "Spherical Mapping";
 case AV_PKT_DATA_A53_CC: return "A53 Closed Captions";
+case AV_PKT_DATA_DYNAMIC_HDR_PLUS:   return "HDR10+ Dynamic 
Metadata (SMPTE 2094-40)";
 case AV_PKT_DATA_ENCRYPTION_INIT_INFO:   return "Encryption 
initialization data";
 case AV_PKT_DATA_ENCRYPTION_INFO:return "Encryption info";
 case AV_PKT_DATA_AFD:return "Active Format 
Description data";
diff --git a/libavcodec/decode.c b/libavcodec/decode.c
index de9c079f9d..cd3286f7fb 100644
--- a/libavcodec/decode.c
+++ b/libavcodec/decode.c
@@ -1698,6 +1698,7 @@ int ff_decode_frame_props(AVCodecContext *avctx, AVFrame 
*frame)
 { AV_PKT_DATA_MASTERING_DISPLAY_METADATA, 
AV_FRAME_DATA_MASTERING_D

Re: [FFmpeg-devel] [PATCH] Support HDR10+ metadata for HEVC.

2020-09-08 Thread Mohammad Izadi
I will add the test by the end of this week.
Thanks,
Mohammad


On Mon, Sep 7, 2020 at 2:56 AM Jan Ekström  wrote:

> On Sat, Jul 25, 2020 at 12:09 AM Mohammad Izadi
>  wrote:
> >
> > On Fri, Jul 24, 2020 at 9:30 AM Andreas Rheinhardt <
> > andreas.rheinha...@gmail.com> wrote:
> >
> > > Mohammad Izadi:
> > > > From: Mohammad Izadi 
> > > >
> > > > HDR10+ is dynamic metadata (A/341 Amendment - SMPTE2094-40) that
> needs
> > > to be decoded from ITU-T T.35 in HEVC bitstream. The HDR10+ is
> transferred
> > > to side data packet to be used or passed through.
> > > > ---
> > > >  libavcodec/avpacket.c |   1 +
> > > >  libavcodec/decode.c   |   1 +
> > > >  libavcodec/hevc_sei.c |  39 ++---
> > > >  libavcodec/hevc_sei.h |   5 ++
> > > >  libavcodec/hevcdec.c  |  16 
> > > >  libavcodec/internal.h |   9 +++
> > > >  libavcodec/packet.h   |   8 ++
> > > >  libavcodec/utils.c| 180
> ++
> > > >  libavcodec/version.h  |   2 +-
> > > >  9 files changed, 248 insertions(+), 13 deletions(-)
> > > >
> > > > diff --git a/libavcodec/avpacket.c b/libavcodec/avpacket.c
> > > > index dce26cb31a..8307032335 <(830)%20703-2335> <(830)%20703-2335>
> 100644
> > > > --- a/libavcodec/avpacket.c
> > > > +++ b/libavcodec/avpacket.c
> > > > @@ -394,6 +394,7 @@ const char *av_packet_side_data_name(enum
> > > AVPacketSideDataType type)
> > > >  case AV_PKT_DATA_CONTENT_LIGHT_LEVEL:return "Content
> light
> > > level metadata";
> > > >  case AV_PKT_DATA_SPHERICAL:  return "Spherical
> > > Mapping";
> > > >  case AV_PKT_DATA_A53_CC: return "A53 Closed
> > > Captions";
> > > > +case AV_PKT_DATA_DYNAMIC_HDR_PLUS:   return "HDR10+
> Dynamic
> > > Metadata (SMPTE 2094-40)";
> > > >  case AV_PKT_DATA_ENCRYPTION_INIT_INFO:   return "Encryption
> > > initialization data";
> > > >  case AV_PKT_DATA_ENCRYPTION_INFO:return "Encryption
> > > info";
> > > >  case AV_PKT_DATA_AFD:return "Active
> Format
> > > Description data";
> > > > diff --git a/libavcodec/decode.c b/libavcodec/decode.c
> > > > index de9c079f9d..cd3286f7fb 100644
> > > > --- a/libavcodec/decode.c
> > > > +++ b/libavcodec/decode.c
> > > > @@ -1698,6 +1698,7 @@ int ff_decode_frame_props(AVCodecContext
> *avctx,
> > > AVFrame *frame)
> > > >  { AV_PKT_DATA_MASTERING_DISPLAY_METADATA,
> > > AV_FRAME_DATA_MASTERING_DISPLAY_METADATA },
> > > >  { AV_PKT_DATA_CONTENT_LIGHT_LEVEL,
> > > AV_FRAME_DATA_CONTENT_LIGHT_LEVEL },
> > > >  { AV_PKT_DATA_A53_CC,
>  AV_FRAME_DATA_A53_CC
> > > },
> > > > +{ AV_PKT_DATA_DYNAMIC_HDR_PLUS,
> > >  AV_FRAME_DATA_DYNAMIC_HDR_PLUS },
> > > >  { AV_PKT_DATA_ICC_PROFILE,
> > > AV_FRAME_DATA_ICC_PROFILE },
> > > >  };
> > > >
> > > > diff --git a/libavcodec/hevc_sei.c b/libavcodec/hevc_sei.c
> > > > index a4ec65dc1a..a490e752dd 100644
> > > > --- a/libavcodec/hevc_sei.c
> > > > +++ b/libavcodec/hevc_sei.c
> > > > @@ -25,6 +25,7 @@
> > > >  #include "golomb.h"
> > > >  #include "hevc_ps.h"
> > > >  #include "hevc_sei.h"
> > > > +#include "internal.h"
> > > >
> > > >  static int decode_nal_sei_decoded_picture_hash(HEVCSEIPictureHash
> *s,
> > > GetBitContext *gb)
> > > >  {
> > > > @@ -242,8 +243,8 @@ static int
> > > decode_nal_sei_user_data_unregistered(HEVCSEIUnregistered *s, GetBitC
> > > >  static int decode_nal_sei_user_data_registered_itu_t_t35(HEVCSEI *s,
> > > GetBitContext *gb,
> > > >   int size)
> > > >  {
> > > > -uint32_t country_code;
> > > > -uint32_t user_identifier;
> > > > +uint8_t country_code;
> > > > +uint16_t provider_code;
> > > >
> > > >  if (size < 7)
> > > >  return AVERROR(EINVAL);
> > > > @@ -255,18 +256,31 @@ static int
> > > decode_nal_sei_user_data_registered_itu_t_t35(HEVCSEI *s, GetBitConte
> > > >  size--;
> > > >  }
> > > >
> > > > -skip_bits(gb, 8);
> > > > -skip_bits(gb, 8);
> > > > -
> > > > -user_identifier = get_bits_long(gb, 32);
> > > > -
> > > > -switch (user_identifier) {
> > > > -case MKBETAG('G', 'A', '9', '4'):
> > > > +provider_code = get_bits(gb, 16);
> > > > +
> > > > +const uint8_t usa_country_code = 0xB5;
> > > > +const uint16_t smpte_provider_code = 0x003C;
> > > > +if (country_code == usa_country_code &&
> > > > +provider_code == smpte_provider_code) {
> > > > +// A/341 Amendment – 2094-40
> > > > +uint16_t provider_oriented_code = get_bits(gb, 16);
> > > > +uint8_t application_identifier = get_bits(gb, 8);
> > > > +const uint16_t smpte2094_40_provider_oriented_code = 0x0001;
> > > > +const uint16_t smpte2094_40_application_identifier = 0x04;
> > > > +if (provider_oriented_code ==
> > > smpte2094_40_provider_oriented_code &&
> > > > +application_identifier ==
> > > smpte2094_40_application_identi

Re: [FFmpeg-devel] [PATCH] Support HDR10+ metadata for HEVC.

2020-09-07 Thread Jan Ekström
On Sat, Jul 25, 2020 at 12:09 AM Mohammad Izadi
 wrote:
>
> On Fri, Jul 24, 2020 at 9:30 AM Andreas Rheinhardt <
> andreas.rheinha...@gmail.com> wrote:
>
> > Mohammad Izadi:
> > > From: Mohammad Izadi 
> > >
> > > HDR10+ is dynamic metadata (A/341 Amendment - SMPTE2094-40) that needs
> > to be decoded from ITU-T T.35 in HEVC bitstream. The HDR10+ is transferred
> > to side data packet to be used or passed through.
> > > ---
> > >  libavcodec/avpacket.c |   1 +
> > >  libavcodec/decode.c   |   1 +
> > >  libavcodec/hevc_sei.c |  39 ++---
> > >  libavcodec/hevc_sei.h |   5 ++
> > >  libavcodec/hevcdec.c  |  16 
> > >  libavcodec/internal.h |   9 +++
> > >  libavcodec/packet.h   |   8 ++
> > >  libavcodec/utils.c| 180 ++
> > >  libavcodec/version.h  |   2 +-
> > >  9 files changed, 248 insertions(+), 13 deletions(-)
> > >
> > > diff --git a/libavcodec/avpacket.c b/libavcodec/avpacket.c
> > > index dce26cb31a..8307032335 <(830)%20703-2335> 100644
> > > --- a/libavcodec/avpacket.c
> > > +++ b/libavcodec/avpacket.c
> > > @@ -394,6 +394,7 @@ const char *av_packet_side_data_name(enum
> > AVPacketSideDataType type)
> > >  case AV_PKT_DATA_CONTENT_LIGHT_LEVEL:return "Content light
> > level metadata";
> > >  case AV_PKT_DATA_SPHERICAL:  return "Spherical
> > Mapping";
> > >  case AV_PKT_DATA_A53_CC: return "A53 Closed
> > Captions";
> > > +case AV_PKT_DATA_DYNAMIC_HDR_PLUS:   return "HDR10+ Dynamic
> > Metadata (SMPTE 2094-40)";
> > >  case AV_PKT_DATA_ENCRYPTION_INIT_INFO:   return "Encryption
> > initialization data";
> > >  case AV_PKT_DATA_ENCRYPTION_INFO:return "Encryption
> > info";
> > >  case AV_PKT_DATA_AFD:return "Active Format
> > Description data";
> > > diff --git a/libavcodec/decode.c b/libavcodec/decode.c
> > > index de9c079f9d..cd3286f7fb 100644
> > > --- a/libavcodec/decode.c
> > > +++ b/libavcodec/decode.c
> > > @@ -1698,6 +1698,7 @@ int ff_decode_frame_props(AVCodecContext *avctx,
> > AVFrame *frame)
> > >  { AV_PKT_DATA_MASTERING_DISPLAY_METADATA,
> > AV_FRAME_DATA_MASTERING_DISPLAY_METADATA },
> > >  { AV_PKT_DATA_CONTENT_LIGHT_LEVEL,
> > AV_FRAME_DATA_CONTENT_LIGHT_LEVEL },
> > >  { AV_PKT_DATA_A53_CC, AV_FRAME_DATA_A53_CC
> > },
> > > +{ AV_PKT_DATA_DYNAMIC_HDR_PLUS,
> >  AV_FRAME_DATA_DYNAMIC_HDR_PLUS },
> > >  { AV_PKT_DATA_ICC_PROFILE,
> > AV_FRAME_DATA_ICC_PROFILE },
> > >  };
> > >
> > > diff --git a/libavcodec/hevc_sei.c b/libavcodec/hevc_sei.c
> > > index a4ec65dc1a..a490e752dd 100644
> > > --- a/libavcodec/hevc_sei.c
> > > +++ b/libavcodec/hevc_sei.c
> > > @@ -25,6 +25,7 @@
> > >  #include "golomb.h"
> > >  #include "hevc_ps.h"
> > >  #include "hevc_sei.h"
> > > +#include "internal.h"
> > >
> > >  static int decode_nal_sei_decoded_picture_hash(HEVCSEIPictureHash *s,
> > GetBitContext *gb)
> > >  {
> > > @@ -242,8 +243,8 @@ static int
> > decode_nal_sei_user_data_unregistered(HEVCSEIUnregistered *s, GetBitC
> > >  static int decode_nal_sei_user_data_registered_itu_t_t35(HEVCSEI *s,
> > GetBitContext *gb,
> > >   int size)
> > >  {
> > > -uint32_t country_code;
> > > -uint32_t user_identifier;
> > > +uint8_t country_code;
> > > +uint16_t provider_code;
> > >
> > >  if (size < 7)
> > >  return AVERROR(EINVAL);
> > > @@ -255,18 +256,31 @@ static int
> > decode_nal_sei_user_data_registered_itu_t_t35(HEVCSEI *s, GetBitConte
> > >  size--;
> > >  }
> > >
> > > -skip_bits(gb, 8);
> > > -skip_bits(gb, 8);
> > > -
> > > -user_identifier = get_bits_long(gb, 32);
> > > -
> > > -switch (user_identifier) {
> > > -case MKBETAG('G', 'A', '9', '4'):
> > > +provider_code = get_bits(gb, 16);
> > > +
> > > +const uint8_t usa_country_code = 0xB5;
> > > +const uint16_t smpte_provider_code = 0x003C;
> > > +if (country_code == usa_country_code &&
> > > +provider_code == smpte_provider_code) {
> > > +// A/341 Amendment – 2094-40
> > > +uint16_t provider_oriented_code = get_bits(gb, 16);
> > > +uint8_t application_identifier = get_bits(gb, 8);
> > > +const uint16_t smpte2094_40_provider_oriented_code = 0x0001;
> > > +const uint16_t smpte2094_40_application_identifier = 0x04;
> > > +if (provider_oriented_code ==
> > smpte2094_40_provider_oriented_code &&
> > > +application_identifier ==
> > smpte2094_40_application_identifier) {
> > > +int err = ff_read_itu_t_t35_to_dynamic_hdr_plus(gb, s->
> > dynamic_hdr_plus.info);
> > > +if (err < 0 && s->dynamic_hdr_plus.info) {
> > > +av_buffer_unref(&s->dynamic_hdr_plus.info);
> > > +}
> > > +return err;
> > > +}
> > > +} else {
> > > +uint32_t  user_identif

Re: [FFmpeg-devel] [PATCH] Support HDR10+ metadata for HEVC.

2020-09-01 Thread Jan Ekström
On Tue, Sep 1, 2020 at 5:22 PM Harry Mallon  wrote:
>
>
>
>
> > On 12 Aug 2020, at 21:58, Vittorio Giovara  
> > wrote:
> >
> > On Wed, Aug 12, 2020 at 6:40 PM Mohammad Izadi  wrote:
> >
> >> Vittorio,
> >>
> >> What is the next step for me?
> >>
> >> Thanks,
> >> Mohammad
> >>
> >
> > Hi, I don't have any more comments for the patch, except that it would be
> > nice if there were some kind of fate testing.
> > See for example cf1cae58b015427918ecfa507a045aae4cf398fd, which is
> > similarly exporting metadata information from an input file to stdout.
> > The test will make sure that future changes won't break this functionality.
>
> So are we waiting on a small file size example to be added to fate? Or is 
> there something else required here? I am also interested in HDR10+ and could 
> help trying patches out.
>
> Harry
>

Hi,

I think the steps would be:
- Generate a FATE sample & test for the parsing (dumping the side data
for a couple of packets)
- Any final review.

I will also attempt to take a look at the patch set itself during the
week-end at the latest. It's been on my go-to list for a while but
unfortunately I've not been able to dedicate it time yet.

Jan
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-devel] [PATCH] Support HDR10+ metadata for HEVC.

2020-09-01 Thread Harry Mallon



> On 12 Aug 2020, at 21:58, Vittorio Giovara  wrote:
> 
> On Wed, Aug 12, 2020 at 6:40 PM Mohammad Izadi  wrote:
> 
>> Vittorio,
>> 
>> What is the next step for me?
>> 
>> Thanks,
>> Mohammad
>> 
> 
> Hi, I don't have any more comments for the patch, except that it would be
> nice if there were some kind of fate testing.
> See for example cf1cae58b015427918ecfa507a045aae4cf398fd, which is
> similarly exporting metadata information from an input file to stdout.
> The test will make sure that future changes won't break this functionality.

So are we waiting on a small file size example to be added to fate? Or is there 
something else required here? I am also interested in HDR10+ and could help 
trying patches out.

Harry

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

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-devel] [PATCH] Support HDR10+ metadata for HEVC.

2020-08-12 Thread Vittorio Giovara
On Wed, Aug 12, 2020 at 6:40 PM Mohammad Izadi  wrote:

> Vittorio,
>
> What is the next step for me?
>
> Thanks,
> Mohammad
>

Hi, I don't have any more comments for the patch, except that it would be
nice if there were some kind of fate testing.
See for example cf1cae58b015427918ecfa507a045aae4cf398fd, which is
similarly exporting metadata information from an input file to stdout.
The test will make sure that future changes won't break this functionality.
-- 
Vittorio
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-devel] [PATCH] Support HDR10+ metadata for HEVC.

2020-08-12 Thread Mohammad Izadi
Vittorio,

What is the next step for me?

Thanks,
Mohammad


On Fri, Aug 7, 2020 at 9:51 AM Mohammad Izadi  wrote:

> Any more comments?  Are you OK to merge?
> Thanks,
> Mohammad
>
>
> On Thu, Jul 30, 2020 at 9:06 AM Vittorio Giovara <
> vittorio.giov...@gmail.com> wrote:
>
>> On Mon, Jul 27, 2020 at 11:44 PM Mohammad Izadi <
>> izadi-at-google@ffmpeg.org> wrote:
>>
>> > It seems FATE is for the regression test. Here is a sample that you can
>> use
>> > and check:
>> >
>> >  https://www.dropbox.com/s/3ewr2t2lvv2cy8d/20200727_143643.mp4?dl=0
>> >
>> >
>> Thanks I will check it out.
>> Fate is indeed for regression testing, but also for continuous
>> integration.
>> If a portion of code has a fate sample available, it is automatically
>> tested every time, and if there is a breaking change, people can act upon
>> it and prevent it from happening.
>> Vittorio
>>
>>
>> > Thanks,
>> > Mohammad
>> >
>> >
>> > On Mon, Jul 27, 2020 at 7:53 AM Vittorio Giovara <
>> > vittorio.giov...@gmail.com>
>> > wrote:
>> >
>> > > On Fri, Jul 24, 2020 at 11:09 PM Mohammad Izadi <
>> > > izadi-at-google@ffmpeg.org> wrote:
>> > >
>> > > > On Fri, Jul 24, 2020 at 9:30 AM Andreas Rheinhardt <
>> > > > andreas.rheinha...@gmail.com> wrote:
>> > > >
>> > > > > Mohammad Izadi:
>> > > > > > From: Mohammad Izadi 
>> > > > > >
>> > > > > > HDR10+ is dynamic metadata (A/341 Amendment - SMPTE2094-40) that
>> > > needs
>> > > > > to be decoded from ITU-T T.35 in HEVC bitstream. The HDR10+ is
>> > > > transferred
>> > > > > to side data packet to be used or passed through.
>> > > > > > ---
>> > > > > >  libavcodec/avpacket.c |   1 +
>> > > > > >  libavcodec/decode.c   |   1 +
>> > > > > >  libavcodec/hevc_sei.c |  39 ++---
>> > > > > >  libavcodec/hevc_sei.h |   5 ++
>> > > > > >  libavcodec/hevcdec.c  |  16 
>> > > > > >  libavcodec/internal.h |   9 +++
>> > > > > >  libavcodec/packet.h   |   8 ++
>> > > > > >  libavcodec/utils.c| 180
>> > > ++
>> > > > > >  libavcodec/version.h  |   2 +-
>> > > > > >  9 files changed, 248 insertions(+), 13 deletions(-)
>> > > > > >
>> > > > > > diff --git a/libavcodec/avpacket.c b/libavcodec/avpacket.c
>> > > > > > index dce26cb31a..8307032335 <(830)%20703-2335>
>> <(830)%20703-2335> <(830)%20703-2335>
>> > > 100644
>> > > > > > --- a/libavcodec/avpacket.c
>> > > > > > +++ b/libavcodec/avpacket.c
>> > > > > > @@ -394,6 +394,7 @@ const char *av_packet_side_data_name(enum
>> > > > > AVPacketSideDataType type)
>> > > > > >  case AV_PKT_DATA_CONTENT_LIGHT_LEVEL:return
>> "Content
>> > > light
>> > > > > level metadata";
>> > > > > >  case AV_PKT_DATA_SPHERICAL:  return
>> "Spherical
>> > > > > Mapping";
>> > > > > >  case AV_PKT_DATA_A53_CC: return "A53
>> > Closed
>> > > > > Captions";
>> > > > > > +case AV_PKT_DATA_DYNAMIC_HDR_PLUS:   return "HDR10+
>> > > > Dynamic
>> > > > > Metadata (SMPTE 2094-40)";
>> > > > > >  case AV_PKT_DATA_ENCRYPTION_INIT_INFO:   return
>> > "Encryption
>> > > > > initialization data";
>> > > > > >  case AV_PKT_DATA_ENCRYPTION_INFO:return
>> > "Encryption
>> > > > > info";
>> > > > > >  case AV_PKT_DATA_AFD:return "Active
>> > > Format
>> > > > > Description data";
>> > > > > > diff --git a/libavcodec/decode.c b/libavcodec/decode.c
>> > > > > > index de9c079f9d..cd3286f7fb 100644
>> > > > > > --- a/libavcodec/decode.c
>> > > > > > +++ b/libavcodec/decode.c
>> > > > > > @@ -1698,6 +1698,7 @@ int ff_decode_frame_props(AVCodecContext
>> > > *avctx,
>> > > > > AVFrame *frame)
>> > > > > >  { AV_PKT_DATA_MASTERING_DISPLAY_METADATA,
>> > > > > AV_FRAME_DATA_MASTERING_DISPLAY_METADATA },
>> > > > > >  { AV_PKT_DATA_CONTENT_LIGHT_LEVEL,
>> > > > > AV_FRAME_DATA_CONTENT_LIGHT_LEVEL },
>> > > > > >  { AV_PKT_DATA_A53_CC,
>> > >  AV_FRAME_DATA_A53_CC
>> > > > > },
>> > > > > > +{ AV_PKT_DATA_DYNAMIC_HDR_PLUS,
>> > > > >  AV_FRAME_DATA_DYNAMIC_HDR_PLUS },
>> > > > > >  { AV_PKT_DATA_ICC_PROFILE,
>> > > > > AV_FRAME_DATA_ICC_PROFILE },
>> > > > > >  };
>> > > > > >
>> > > > > > diff --git a/libavcodec/hevc_sei.c b/libavcodec/hevc_sei.c
>> > > > > > index a4ec65dc1a..a490e752dd 100644
>> > > > > > --- a/libavcodec/hevc_sei.c
>> > > > > > +++ b/libavcodec/hevc_sei.c
>> > > > > > @@ -25,6 +25,7 @@
>> > > > > >  #include "golomb.h"
>> > > > > >  #include "hevc_ps.h"
>> > > > > >  #include "hevc_sei.h"
>> > > > > > +#include "internal.h"
>> > > > > >
>> > > > > >  static int
>> decode_nal_sei_decoded_picture_hash(HEVCSEIPictureHash
>> > > *s,
>> > > > > GetBitContext *gb)
>> > > > > >  {
>> > > > > > @@ -242,8 +243,8 @@ static int
>> > > > > decode_nal_sei_user_data_unregistered(HEVCSEIUnregistered *s,
>> GetBitC
>> > > > > >  static int
>> decode_nal_sei_user_data_registered_itu_t_t35(HEVCSEI
>> > *s,
>> > > > > GetBitContext *gb,
>> > > > > >   

Re: [FFmpeg-devel] [PATCH] Support HDR10+ metadata for HEVC.

2020-08-07 Thread Mohammad Izadi
Any more comments?  Are you OK to merge?
Thanks,
Mohammad


On Thu, Jul 30, 2020 at 9:06 AM Vittorio Giovara 
wrote:

> On Mon, Jul 27, 2020 at 11:44 PM Mohammad Izadi <
> izadi-at-google@ffmpeg.org> wrote:
>
> > It seems FATE is for the regression test. Here is a sample that you can
> use
> > and check:
> >
> >  https://www.dropbox.com/s/3ewr2t2lvv2cy8d/20200727_143643.mp4?dl=0
> >
> >
> Thanks I will check it out.
> Fate is indeed for regression testing, but also for continuous integration.
> If a portion of code has a fate sample available, it is automatically
> tested every time, and if there is a breaking change, people can act upon
> it and prevent it from happening.
> Vittorio
>
>
> > Thanks,
> > Mohammad
> >
> >
> > On Mon, Jul 27, 2020 at 7:53 AM Vittorio Giovara <
> > vittorio.giov...@gmail.com>
> > wrote:
> >
> > > On Fri, Jul 24, 2020 at 11:09 PM Mohammad Izadi <
> > > izadi-at-google@ffmpeg.org> wrote:
> > >
> > > > On Fri, Jul 24, 2020 at 9:30 AM Andreas Rheinhardt <
> > > > andreas.rheinha...@gmail.com> wrote:
> > > >
> > > > > Mohammad Izadi:
> > > > > > From: Mohammad Izadi 
> > > > > >
> > > > > > HDR10+ is dynamic metadata (A/341 Amendment - SMPTE2094-40) that
> > > needs
> > > > > to be decoded from ITU-T T.35 in HEVC bitstream. The HDR10+ is
> > > > transferred
> > > > > to side data packet to be used or passed through.
> > > > > > ---
> > > > > >  libavcodec/avpacket.c |   1 +
> > > > > >  libavcodec/decode.c   |   1 +
> > > > > >  libavcodec/hevc_sei.c |  39 ++---
> > > > > >  libavcodec/hevc_sei.h |   5 ++
> > > > > >  libavcodec/hevcdec.c  |  16 
> > > > > >  libavcodec/internal.h |   9 +++
> > > > > >  libavcodec/packet.h   |   8 ++
> > > > > >  libavcodec/utils.c| 180
> > > ++
> > > > > >  libavcodec/version.h  |   2 +-
> > > > > >  9 files changed, 248 insertions(+), 13 deletions(-)
> > > > > >
> > > > > > diff --git a/libavcodec/avpacket.c b/libavcodec/avpacket.c
> > > > > > index dce26cb31a..8307032335 <(830)%20703-2335>
> <(830)%20703-2335> <(830)%20703-2335>
> > > 100644
> > > > > > --- a/libavcodec/avpacket.c
> > > > > > +++ b/libavcodec/avpacket.c
> > > > > > @@ -394,6 +394,7 @@ const char *av_packet_side_data_name(enum
> > > > > AVPacketSideDataType type)
> > > > > >  case AV_PKT_DATA_CONTENT_LIGHT_LEVEL:return "Content
> > > light
> > > > > level metadata";
> > > > > >  case AV_PKT_DATA_SPHERICAL:  return
> "Spherical
> > > > > Mapping";
> > > > > >  case AV_PKT_DATA_A53_CC: return "A53
> > Closed
> > > > > Captions";
> > > > > > +case AV_PKT_DATA_DYNAMIC_HDR_PLUS:   return "HDR10+
> > > > Dynamic
> > > > > Metadata (SMPTE 2094-40)";
> > > > > >  case AV_PKT_DATA_ENCRYPTION_INIT_INFO:   return
> > "Encryption
> > > > > initialization data";
> > > > > >  case AV_PKT_DATA_ENCRYPTION_INFO:return
> > "Encryption
> > > > > info";
> > > > > >  case AV_PKT_DATA_AFD:return "Active
> > > Format
> > > > > Description data";
> > > > > > diff --git a/libavcodec/decode.c b/libavcodec/decode.c
> > > > > > index de9c079f9d..cd3286f7fb 100644
> > > > > > --- a/libavcodec/decode.c
> > > > > > +++ b/libavcodec/decode.c
> > > > > > @@ -1698,6 +1698,7 @@ int ff_decode_frame_props(AVCodecContext
> > > *avctx,
> > > > > AVFrame *frame)
> > > > > >  { AV_PKT_DATA_MASTERING_DISPLAY_METADATA,
> > > > > AV_FRAME_DATA_MASTERING_DISPLAY_METADATA },
> > > > > >  { AV_PKT_DATA_CONTENT_LIGHT_LEVEL,
> > > > > AV_FRAME_DATA_CONTENT_LIGHT_LEVEL },
> > > > > >  { AV_PKT_DATA_A53_CC,
> > >  AV_FRAME_DATA_A53_CC
> > > > > },
> > > > > > +{ AV_PKT_DATA_DYNAMIC_HDR_PLUS,
> > > > >  AV_FRAME_DATA_DYNAMIC_HDR_PLUS },
> > > > > >  { AV_PKT_DATA_ICC_PROFILE,
> > > > > AV_FRAME_DATA_ICC_PROFILE },
> > > > > >  };
> > > > > >
> > > > > > diff --git a/libavcodec/hevc_sei.c b/libavcodec/hevc_sei.c
> > > > > > index a4ec65dc1a..a490e752dd 100644
> > > > > > --- a/libavcodec/hevc_sei.c
> > > > > > +++ b/libavcodec/hevc_sei.c
> > > > > > @@ -25,6 +25,7 @@
> > > > > >  #include "golomb.h"
> > > > > >  #include "hevc_ps.h"
> > > > > >  #include "hevc_sei.h"
> > > > > > +#include "internal.h"
> > > > > >
> > > > > >  static int
> decode_nal_sei_decoded_picture_hash(HEVCSEIPictureHash
> > > *s,
> > > > > GetBitContext *gb)
> > > > > >  {
> > > > > > @@ -242,8 +243,8 @@ static int
> > > > > decode_nal_sei_user_data_unregistered(HEVCSEIUnregistered *s,
> GetBitC
> > > > > >  static int decode_nal_sei_user_data_registered_itu_t_t35(HEVCSEI
> > *s,
> > > > > GetBitContext *gb,
> > > > > >   int
> size)
> > > > > >  {
> > > > > > -uint32_t country_code;
> > > > > > -uint32_t user_identifier;
> > > > > > +uint8_t country_code;
> > > > > > +uint16_t provider_code;
> > > > > >
> > > > > >  if (size < 7)
> > > > > >  return AVERRO

Re: [FFmpeg-devel] [PATCH] Support HDR10+ metadata for HEVC.

2020-07-30 Thread Vittorio Giovara
On Mon, Jul 27, 2020 at 11:44 PM Mohammad Izadi <
izadi-at-google@ffmpeg.org> wrote:

> It seems FATE is for the regression test. Here is a sample that you can use
> and check:
>
>  https://www.dropbox.com/s/3ewr2t2lvv2cy8d/20200727_143643.mp4?dl=0
>
>
Thanks I will check it out.
Fate is indeed for regression testing, but also for continuous integration.
If a portion of code has a fate sample available, it is automatically
tested every time, and if there is a breaking change, people can act upon
it and prevent it from happening.
Vittorio


> Thanks,
> Mohammad
>
>
> On Mon, Jul 27, 2020 at 7:53 AM Vittorio Giovara <
> vittorio.giov...@gmail.com>
> wrote:
>
> > On Fri, Jul 24, 2020 at 11:09 PM Mohammad Izadi <
> > izadi-at-google@ffmpeg.org> wrote:
> >
> > > On Fri, Jul 24, 2020 at 9:30 AM Andreas Rheinhardt <
> > > andreas.rheinha...@gmail.com> wrote:
> > >
> > > > Mohammad Izadi:
> > > > > From: Mohammad Izadi 
> > > > >
> > > > > HDR10+ is dynamic metadata (A/341 Amendment - SMPTE2094-40) that
> > needs
> > > > to be decoded from ITU-T T.35 in HEVC bitstream. The HDR10+ is
> > > transferred
> > > > to side data packet to be used or passed through.
> > > > > ---
> > > > >  libavcodec/avpacket.c |   1 +
> > > > >  libavcodec/decode.c   |   1 +
> > > > >  libavcodec/hevc_sei.c |  39 ++---
> > > > >  libavcodec/hevc_sei.h |   5 ++
> > > > >  libavcodec/hevcdec.c  |  16 
> > > > >  libavcodec/internal.h |   9 +++
> > > > >  libavcodec/packet.h   |   8 ++
> > > > >  libavcodec/utils.c| 180
> > ++
> > > > >  libavcodec/version.h  |   2 +-
> > > > >  9 files changed, 248 insertions(+), 13 deletions(-)
> > > > >
> > > > > diff --git a/libavcodec/avpacket.c b/libavcodec/avpacket.c
> > > > > index dce26cb31a..8307032335 <(830)%20703-2335> <(830)%20703-2335>
> > 100644
> > > > > --- a/libavcodec/avpacket.c
> > > > > +++ b/libavcodec/avpacket.c
> > > > > @@ -394,6 +394,7 @@ const char *av_packet_side_data_name(enum
> > > > AVPacketSideDataType type)
> > > > >  case AV_PKT_DATA_CONTENT_LIGHT_LEVEL:return "Content
> > light
> > > > level metadata";
> > > > >  case AV_PKT_DATA_SPHERICAL:  return "Spherical
> > > > Mapping";
> > > > >  case AV_PKT_DATA_A53_CC: return "A53
> Closed
> > > > Captions";
> > > > > +case AV_PKT_DATA_DYNAMIC_HDR_PLUS:   return "HDR10+
> > > Dynamic
> > > > Metadata (SMPTE 2094-40)";
> > > > >  case AV_PKT_DATA_ENCRYPTION_INIT_INFO:   return
> "Encryption
> > > > initialization data";
> > > > >  case AV_PKT_DATA_ENCRYPTION_INFO:return
> "Encryption
> > > > info";
> > > > >  case AV_PKT_DATA_AFD:return "Active
> > Format
> > > > Description data";
> > > > > diff --git a/libavcodec/decode.c b/libavcodec/decode.c
> > > > > index de9c079f9d..cd3286f7fb 100644
> > > > > --- a/libavcodec/decode.c
> > > > > +++ b/libavcodec/decode.c
> > > > > @@ -1698,6 +1698,7 @@ int ff_decode_frame_props(AVCodecContext
> > *avctx,
> > > > AVFrame *frame)
> > > > >  { AV_PKT_DATA_MASTERING_DISPLAY_METADATA,
> > > > AV_FRAME_DATA_MASTERING_DISPLAY_METADATA },
> > > > >  { AV_PKT_DATA_CONTENT_LIGHT_LEVEL,
> > > > AV_FRAME_DATA_CONTENT_LIGHT_LEVEL },
> > > > >  { AV_PKT_DATA_A53_CC,
> >  AV_FRAME_DATA_A53_CC
> > > > },
> > > > > +{ AV_PKT_DATA_DYNAMIC_HDR_PLUS,
> > > >  AV_FRAME_DATA_DYNAMIC_HDR_PLUS },
> > > > >  { AV_PKT_DATA_ICC_PROFILE,
> > > > AV_FRAME_DATA_ICC_PROFILE },
> > > > >  };
> > > > >
> > > > > diff --git a/libavcodec/hevc_sei.c b/libavcodec/hevc_sei.c
> > > > > index a4ec65dc1a..a490e752dd 100644
> > > > > --- a/libavcodec/hevc_sei.c
> > > > > +++ b/libavcodec/hevc_sei.c
> > > > > @@ -25,6 +25,7 @@
> > > > >  #include "golomb.h"
> > > > >  #include "hevc_ps.h"
> > > > >  #include "hevc_sei.h"
> > > > > +#include "internal.h"
> > > > >
> > > > >  static int decode_nal_sei_decoded_picture_hash(HEVCSEIPictureHash
> > *s,
> > > > GetBitContext *gb)
> > > > >  {
> > > > > @@ -242,8 +243,8 @@ static int
> > > > decode_nal_sei_user_data_unregistered(HEVCSEIUnregistered *s, GetBitC
> > > > >  static int decode_nal_sei_user_data_registered_itu_t_t35(HEVCSEI
> *s,
> > > > GetBitContext *gb,
> > > > >   int size)
> > > > >  {
> > > > > -uint32_t country_code;
> > > > > -uint32_t user_identifier;
> > > > > +uint8_t country_code;
> > > > > +uint16_t provider_code;
> > > > >
> > > > >  if (size < 7)
> > > > >  return AVERROR(EINVAL);
> > > > > @@ -255,18 +256,31 @@ static int
> > > > decode_nal_sei_user_data_registered_itu_t_t35(HEVCSEI *s, GetBitConte
> > > > >  size--;
> > > > >  }
> > > > >
> > > > > -skip_bits(gb, 8);
> > > > > -skip_bits(gb, 8);
> > > > > -
> > > > > -user_identifier = get_bits_long(gb, 32);
> > > > > -
> > > > > -switch (user_identifier) {
> > > > > -case MK

Re: [FFmpeg-devel] [PATCH] Support HDR10+ metadata for HEVC.

2020-07-27 Thread Mohammad Izadi
It seems FATE is for the regression test. Here is a sample that you can use
and check:

 https://www.dropbox.com/s/3ewr2t2lvv2cy8d/20200727_143643.mp4?dl=0

Thanks,
Mohammad


On Mon, Jul 27, 2020 at 7:53 AM Vittorio Giovara 
wrote:

> On Fri, Jul 24, 2020 at 11:09 PM Mohammad Izadi <
> izadi-at-google@ffmpeg.org> wrote:
>
> > On Fri, Jul 24, 2020 at 9:30 AM Andreas Rheinhardt <
> > andreas.rheinha...@gmail.com> wrote:
> >
> > > Mohammad Izadi:
> > > > From: Mohammad Izadi 
> > > >
> > > > HDR10+ is dynamic metadata (A/341 Amendment - SMPTE2094-40) that
> needs
> > > to be decoded from ITU-T T.35 in HEVC bitstream. The HDR10+ is
> > transferred
> > > to side data packet to be used or passed through.
> > > > ---
> > > >  libavcodec/avpacket.c |   1 +
> > > >  libavcodec/decode.c   |   1 +
> > > >  libavcodec/hevc_sei.c |  39 ++---
> > > >  libavcodec/hevc_sei.h |   5 ++
> > > >  libavcodec/hevcdec.c  |  16 
> > > >  libavcodec/internal.h |   9 +++
> > > >  libavcodec/packet.h   |   8 ++
> > > >  libavcodec/utils.c| 180
> ++
> > > >  libavcodec/version.h  |   2 +-
> > > >  9 files changed, 248 insertions(+), 13 deletions(-)
> > > >
> > > > diff --git a/libavcodec/avpacket.c b/libavcodec/avpacket.c
> > > > index dce26cb31a..8307032335 <(830)%20703-2335> <(830)%20703-2335>
> 100644
> > > > --- a/libavcodec/avpacket.c
> > > > +++ b/libavcodec/avpacket.c
> > > > @@ -394,6 +394,7 @@ const char *av_packet_side_data_name(enum
> > > AVPacketSideDataType type)
> > > >  case AV_PKT_DATA_CONTENT_LIGHT_LEVEL:return "Content
> light
> > > level metadata";
> > > >  case AV_PKT_DATA_SPHERICAL:  return "Spherical
> > > Mapping";
> > > >  case AV_PKT_DATA_A53_CC: return "A53 Closed
> > > Captions";
> > > > +case AV_PKT_DATA_DYNAMIC_HDR_PLUS:   return "HDR10+
> > Dynamic
> > > Metadata (SMPTE 2094-40)";
> > > >  case AV_PKT_DATA_ENCRYPTION_INIT_INFO:   return "Encryption
> > > initialization data";
> > > >  case AV_PKT_DATA_ENCRYPTION_INFO:return "Encryption
> > > info";
> > > >  case AV_PKT_DATA_AFD:return "Active
> Format
> > > Description data";
> > > > diff --git a/libavcodec/decode.c b/libavcodec/decode.c
> > > > index de9c079f9d..cd3286f7fb 100644
> > > > --- a/libavcodec/decode.c
> > > > +++ b/libavcodec/decode.c
> > > > @@ -1698,6 +1698,7 @@ int ff_decode_frame_props(AVCodecContext
> *avctx,
> > > AVFrame *frame)
> > > >  { AV_PKT_DATA_MASTERING_DISPLAY_METADATA,
> > > AV_FRAME_DATA_MASTERING_DISPLAY_METADATA },
> > > >  { AV_PKT_DATA_CONTENT_LIGHT_LEVEL,
> > > AV_FRAME_DATA_CONTENT_LIGHT_LEVEL },
> > > >  { AV_PKT_DATA_A53_CC,
>  AV_FRAME_DATA_A53_CC
> > > },
> > > > +{ AV_PKT_DATA_DYNAMIC_HDR_PLUS,
> > >  AV_FRAME_DATA_DYNAMIC_HDR_PLUS },
> > > >  { AV_PKT_DATA_ICC_PROFILE,
> > > AV_FRAME_DATA_ICC_PROFILE },
> > > >  };
> > > >
> > > > diff --git a/libavcodec/hevc_sei.c b/libavcodec/hevc_sei.c
> > > > index a4ec65dc1a..a490e752dd 100644
> > > > --- a/libavcodec/hevc_sei.c
> > > > +++ b/libavcodec/hevc_sei.c
> > > > @@ -25,6 +25,7 @@
> > > >  #include "golomb.h"
> > > >  #include "hevc_ps.h"
> > > >  #include "hevc_sei.h"
> > > > +#include "internal.h"
> > > >
> > > >  static int decode_nal_sei_decoded_picture_hash(HEVCSEIPictureHash
> *s,
> > > GetBitContext *gb)
> > > >  {
> > > > @@ -242,8 +243,8 @@ static int
> > > decode_nal_sei_user_data_unregistered(HEVCSEIUnregistered *s, GetBitC
> > > >  static int decode_nal_sei_user_data_registered_itu_t_t35(HEVCSEI *s,
> > > GetBitContext *gb,
> > > >   int size)
> > > >  {
> > > > -uint32_t country_code;
> > > > -uint32_t user_identifier;
> > > > +uint8_t country_code;
> > > > +uint16_t provider_code;
> > > >
> > > >  if (size < 7)
> > > >  return AVERROR(EINVAL);
> > > > @@ -255,18 +256,31 @@ static int
> > > decode_nal_sei_user_data_registered_itu_t_t35(HEVCSEI *s, GetBitConte
> > > >  size--;
> > > >  }
> > > >
> > > > -skip_bits(gb, 8);
> > > > -skip_bits(gb, 8);
> > > > -
> > > > -user_identifier = get_bits_long(gb, 32);
> > > > -
> > > > -switch (user_identifier) {
> > > > -case MKBETAG('G', 'A', '9', '4'):
> > > > +provider_code = get_bits(gb, 16);
> > > > +
> > > > +const uint8_t usa_country_code = 0xB5;
> > > > +const uint16_t smpte_provider_code = 0x003C;
> > > > +if (country_code == usa_country_code &&
> > > > +provider_code == smpte_provider_code) {
> > > > +// A/341 Amendment – 2094-40
> > > > +uint16_t provider_oriented_code = get_bits(gb, 16);
> > > > +uint8_t application_identifier = get_bits(gb, 8);
> > > > +const uint16_t smpte2094_40_provider_oriented_code = 0x0001;
> > > > +const uint16_t smpte2094_40_application_identifier = 0x04;
> > > > +if (pr

Re: [FFmpeg-devel] [PATCH] Support HDR10+ metadata for HEVC.

2020-07-27 Thread Vittorio Giovara
On Fri, Jul 24, 2020 at 11:09 PM Mohammad Izadi <
izadi-at-google@ffmpeg.org> wrote:

> On Fri, Jul 24, 2020 at 9:30 AM Andreas Rheinhardt <
> andreas.rheinha...@gmail.com> wrote:
>
> > Mohammad Izadi:
> > > From: Mohammad Izadi 
> > >
> > > HDR10+ is dynamic metadata (A/341 Amendment - SMPTE2094-40) that needs
> > to be decoded from ITU-T T.35 in HEVC bitstream. The HDR10+ is
> transferred
> > to side data packet to be used or passed through.
> > > ---
> > >  libavcodec/avpacket.c |   1 +
> > >  libavcodec/decode.c   |   1 +
> > >  libavcodec/hevc_sei.c |  39 ++---
> > >  libavcodec/hevc_sei.h |   5 ++
> > >  libavcodec/hevcdec.c  |  16 
> > >  libavcodec/internal.h |   9 +++
> > >  libavcodec/packet.h   |   8 ++
> > >  libavcodec/utils.c| 180 ++
> > >  libavcodec/version.h  |   2 +-
> > >  9 files changed, 248 insertions(+), 13 deletions(-)
> > >
> > > diff --git a/libavcodec/avpacket.c b/libavcodec/avpacket.c
> > > index dce26cb31a..8307032335 <(830)%20703-2335> 100644
> > > --- a/libavcodec/avpacket.c
> > > +++ b/libavcodec/avpacket.c
> > > @@ -394,6 +394,7 @@ const char *av_packet_side_data_name(enum
> > AVPacketSideDataType type)
> > >  case AV_PKT_DATA_CONTENT_LIGHT_LEVEL:return "Content light
> > level metadata";
> > >  case AV_PKT_DATA_SPHERICAL:  return "Spherical
> > Mapping";
> > >  case AV_PKT_DATA_A53_CC: return "A53 Closed
> > Captions";
> > > +case AV_PKT_DATA_DYNAMIC_HDR_PLUS:   return "HDR10+
> Dynamic
> > Metadata (SMPTE 2094-40)";
> > >  case AV_PKT_DATA_ENCRYPTION_INIT_INFO:   return "Encryption
> > initialization data";
> > >  case AV_PKT_DATA_ENCRYPTION_INFO:return "Encryption
> > info";
> > >  case AV_PKT_DATA_AFD:return "Active Format
> > Description data";
> > > diff --git a/libavcodec/decode.c b/libavcodec/decode.c
> > > index de9c079f9d..cd3286f7fb 100644
> > > --- a/libavcodec/decode.c
> > > +++ b/libavcodec/decode.c
> > > @@ -1698,6 +1698,7 @@ int ff_decode_frame_props(AVCodecContext *avctx,
> > AVFrame *frame)
> > >  { AV_PKT_DATA_MASTERING_DISPLAY_METADATA,
> > AV_FRAME_DATA_MASTERING_DISPLAY_METADATA },
> > >  { AV_PKT_DATA_CONTENT_LIGHT_LEVEL,
> > AV_FRAME_DATA_CONTENT_LIGHT_LEVEL },
> > >  { AV_PKT_DATA_A53_CC, AV_FRAME_DATA_A53_CC
> > },
> > > +{ AV_PKT_DATA_DYNAMIC_HDR_PLUS,
> >  AV_FRAME_DATA_DYNAMIC_HDR_PLUS },
> > >  { AV_PKT_DATA_ICC_PROFILE,
> > AV_FRAME_DATA_ICC_PROFILE },
> > >  };
> > >
> > > diff --git a/libavcodec/hevc_sei.c b/libavcodec/hevc_sei.c
> > > index a4ec65dc1a..a490e752dd 100644
> > > --- a/libavcodec/hevc_sei.c
> > > +++ b/libavcodec/hevc_sei.c
> > > @@ -25,6 +25,7 @@
> > >  #include "golomb.h"
> > >  #include "hevc_ps.h"
> > >  #include "hevc_sei.h"
> > > +#include "internal.h"
> > >
> > >  static int decode_nal_sei_decoded_picture_hash(HEVCSEIPictureHash *s,
> > GetBitContext *gb)
> > >  {
> > > @@ -242,8 +243,8 @@ static int
> > decode_nal_sei_user_data_unregistered(HEVCSEIUnregistered *s, GetBitC
> > >  static int decode_nal_sei_user_data_registered_itu_t_t35(HEVCSEI *s,
> > GetBitContext *gb,
> > >   int size)
> > >  {
> > > -uint32_t country_code;
> > > -uint32_t user_identifier;
> > > +uint8_t country_code;
> > > +uint16_t provider_code;
> > >
> > >  if (size < 7)
> > >  return AVERROR(EINVAL);
> > > @@ -255,18 +256,31 @@ static int
> > decode_nal_sei_user_data_registered_itu_t_t35(HEVCSEI *s, GetBitConte
> > >  size--;
> > >  }
> > >
> > > -skip_bits(gb, 8);
> > > -skip_bits(gb, 8);
> > > -
> > > -user_identifier = get_bits_long(gb, 32);
> > > -
> > > -switch (user_identifier) {
> > > -case MKBETAG('G', 'A', '9', '4'):
> > > +provider_code = get_bits(gb, 16);
> > > +
> > > +const uint8_t usa_country_code = 0xB5;
> > > +const uint16_t smpte_provider_code = 0x003C;
> > > +if (country_code == usa_country_code &&
> > > +provider_code == smpte_provider_code) {
> > > +// A/341 Amendment – 2094-40
> > > +uint16_t provider_oriented_code = get_bits(gb, 16);
> > > +uint8_t application_identifier = get_bits(gb, 8);
> > > +const uint16_t smpte2094_40_provider_oriented_code = 0x0001;
> > > +const uint16_t smpte2094_40_application_identifier = 0x04;
> > > +if (provider_oriented_code ==
> > smpte2094_40_provider_oriented_code &&
> > > +application_identifier ==
> > smpte2094_40_application_identifier) {
> > > +int err = ff_read_itu_t_t35_to_dynamic_hdr_plus(gb, s->
> > dynamic_hdr_plus.info);
> > > +if (err < 0 && s->dynamic_hdr_plus.info) {
> > > +av_buffer_unref(&s->dynamic_hdr_plus.info);
> > > +}
> > > +return err;
> > > +}
> > > +} else {
>

Re: [FFmpeg-devel] [PATCH] Support HDR10+ metadata for HEVC.

2020-07-24 Thread Mohammad Izadi
On Fri, Jul 24, 2020 at 9:30 AM Andreas Rheinhardt <
andreas.rheinha...@gmail.com> wrote:

> Mohammad Izadi:
> > From: Mohammad Izadi 
> >
> > HDR10+ is dynamic metadata (A/341 Amendment - SMPTE2094-40) that needs
> to be decoded from ITU-T T.35 in HEVC bitstream. The HDR10+ is transferred
> to side data packet to be used or passed through.
> > ---
> >  libavcodec/avpacket.c |   1 +
> >  libavcodec/decode.c   |   1 +
> >  libavcodec/hevc_sei.c |  39 ++---
> >  libavcodec/hevc_sei.h |   5 ++
> >  libavcodec/hevcdec.c  |  16 
> >  libavcodec/internal.h |   9 +++
> >  libavcodec/packet.h   |   8 ++
> >  libavcodec/utils.c| 180 ++
> >  libavcodec/version.h  |   2 +-
> >  9 files changed, 248 insertions(+), 13 deletions(-)
> >
> > diff --git a/libavcodec/avpacket.c b/libavcodec/avpacket.c
> > index dce26cb31a..8307032335 <(830)%20703-2335> 100644
> > --- a/libavcodec/avpacket.c
> > +++ b/libavcodec/avpacket.c
> > @@ -394,6 +394,7 @@ const char *av_packet_side_data_name(enum
> AVPacketSideDataType type)
> >  case AV_PKT_DATA_CONTENT_LIGHT_LEVEL:return "Content light
> level metadata";
> >  case AV_PKT_DATA_SPHERICAL:  return "Spherical
> Mapping";
> >  case AV_PKT_DATA_A53_CC: return "A53 Closed
> Captions";
> > +case AV_PKT_DATA_DYNAMIC_HDR_PLUS:   return "HDR10+ Dynamic
> Metadata (SMPTE 2094-40)";
> >  case AV_PKT_DATA_ENCRYPTION_INIT_INFO:   return "Encryption
> initialization data";
> >  case AV_PKT_DATA_ENCRYPTION_INFO:return "Encryption
> info";
> >  case AV_PKT_DATA_AFD:return "Active Format
> Description data";
> > diff --git a/libavcodec/decode.c b/libavcodec/decode.c
> > index de9c079f9d..cd3286f7fb 100644
> > --- a/libavcodec/decode.c
> > +++ b/libavcodec/decode.c
> > @@ -1698,6 +1698,7 @@ int ff_decode_frame_props(AVCodecContext *avctx,
> AVFrame *frame)
> >  { AV_PKT_DATA_MASTERING_DISPLAY_METADATA,
> AV_FRAME_DATA_MASTERING_DISPLAY_METADATA },
> >  { AV_PKT_DATA_CONTENT_LIGHT_LEVEL,
> AV_FRAME_DATA_CONTENT_LIGHT_LEVEL },
> >  { AV_PKT_DATA_A53_CC, AV_FRAME_DATA_A53_CC
> },
> > +{ AV_PKT_DATA_DYNAMIC_HDR_PLUS,
>  AV_FRAME_DATA_DYNAMIC_HDR_PLUS },
> >  { AV_PKT_DATA_ICC_PROFILE,
> AV_FRAME_DATA_ICC_PROFILE },
> >  };
> >
> > diff --git a/libavcodec/hevc_sei.c b/libavcodec/hevc_sei.c
> > index a4ec65dc1a..a490e752dd 100644
> > --- a/libavcodec/hevc_sei.c
> > +++ b/libavcodec/hevc_sei.c
> > @@ -25,6 +25,7 @@
> >  #include "golomb.h"
> >  #include "hevc_ps.h"
> >  #include "hevc_sei.h"
> > +#include "internal.h"
> >
> >  static int decode_nal_sei_decoded_picture_hash(HEVCSEIPictureHash *s,
> GetBitContext *gb)
> >  {
> > @@ -242,8 +243,8 @@ static int
> decode_nal_sei_user_data_unregistered(HEVCSEIUnregistered *s, GetBitC
> >  static int decode_nal_sei_user_data_registered_itu_t_t35(HEVCSEI *s,
> GetBitContext *gb,
> >   int size)
> >  {
> > -uint32_t country_code;
> > -uint32_t user_identifier;
> > +uint8_t country_code;
> > +uint16_t provider_code;
> >
> >  if (size < 7)
> >  return AVERROR(EINVAL);
> > @@ -255,18 +256,31 @@ static int
> decode_nal_sei_user_data_registered_itu_t_t35(HEVCSEI *s, GetBitConte
> >  size--;
> >  }
> >
> > -skip_bits(gb, 8);
> > -skip_bits(gb, 8);
> > -
> > -user_identifier = get_bits_long(gb, 32);
> > -
> > -switch (user_identifier) {
> > -case MKBETAG('G', 'A', '9', '4'):
> > +provider_code = get_bits(gb, 16);
> > +
> > +const uint8_t usa_country_code = 0xB5;
> > +const uint16_t smpte_provider_code = 0x003C;
> > +if (country_code == usa_country_code &&
> > +provider_code == smpte_provider_code) {
> > +// A/341 Amendment – 2094-40
> > +uint16_t provider_oriented_code = get_bits(gb, 16);
> > +uint8_t application_identifier = get_bits(gb, 8);
> > +const uint16_t smpte2094_40_provider_oriented_code = 0x0001;
> > +const uint16_t smpte2094_40_application_identifier = 0x04;
> > +if (provider_oriented_code ==
> smpte2094_40_provider_oriented_code &&
> > +application_identifier ==
> smpte2094_40_application_identifier) {
> > +int err = ff_read_itu_t_t35_to_dynamic_hdr_plus(gb, s->
> dynamic_hdr_plus.info);
> > +if (err < 0 && s->dynamic_hdr_plus.info) {
> > +av_buffer_unref(&s->dynamic_hdr_plus.info);
> > +}
> > +return err;
> > +}
> > +} else {
> > +uint32_t  user_identifier = get_bits_long(gb, 32);
> > +if(user_identifier == MKBETAG('G', 'A', '9', '4'))
> >  return
> decode_registered_user_data_closed_caption(&s->a53_caption, gb, size);
> > -default:
> > -skip_bits_long(gb, size * 8);
> > -break;
> >  }
> > +

Re: [FFmpeg-devel] [PATCH] Support HDR10+ metadata for HEVC.

2020-07-24 Thread Andreas Rheinhardt
Mohammad Izadi:
> From: Mohammad Izadi 
> 
> HDR10+ is dynamic metadata (A/341 Amendment - SMPTE2094-40) that needs to be 
> decoded from ITU-T T.35 in HEVC bitstream. The HDR10+ is transferred to side 
> data packet to be used or passed through.
> ---
>  libavcodec/avpacket.c |   1 +
>  libavcodec/decode.c   |   1 +
>  libavcodec/hevc_sei.c |  39 ++---
>  libavcodec/hevc_sei.h |   5 ++
>  libavcodec/hevcdec.c  |  16 
>  libavcodec/internal.h |   9 +++
>  libavcodec/packet.h   |   8 ++
>  libavcodec/utils.c| 180 ++
>  libavcodec/version.h  |   2 +-
>  9 files changed, 248 insertions(+), 13 deletions(-)
> 
> diff --git a/libavcodec/avpacket.c b/libavcodec/avpacket.c
> index dce26cb31a..8307032335 100644
> --- a/libavcodec/avpacket.c
> +++ b/libavcodec/avpacket.c
> @@ -394,6 +394,7 @@ const char *av_packet_side_data_name(enum 
> AVPacketSideDataType type)
>  case AV_PKT_DATA_CONTENT_LIGHT_LEVEL:return "Content light level 
> metadata";
>  case AV_PKT_DATA_SPHERICAL:  return "Spherical Mapping";
>  case AV_PKT_DATA_A53_CC: return "A53 Closed 
> Captions";
> +case AV_PKT_DATA_DYNAMIC_HDR_PLUS:   return "HDR10+ Dynamic 
> Metadata (SMPTE 2094-40)";
>  case AV_PKT_DATA_ENCRYPTION_INIT_INFO:   return "Encryption 
> initialization data";
>  case AV_PKT_DATA_ENCRYPTION_INFO:return "Encryption info";
>  case AV_PKT_DATA_AFD:return "Active Format 
> Description data";
> diff --git a/libavcodec/decode.c b/libavcodec/decode.c
> index de9c079f9d..cd3286f7fb 100644
> --- a/libavcodec/decode.c
> +++ b/libavcodec/decode.c
> @@ -1698,6 +1698,7 @@ int ff_decode_frame_props(AVCodecContext *avctx, 
> AVFrame *frame)
>  { AV_PKT_DATA_MASTERING_DISPLAY_METADATA, 
> AV_FRAME_DATA_MASTERING_DISPLAY_METADATA },
>  { AV_PKT_DATA_CONTENT_LIGHT_LEVEL,
> AV_FRAME_DATA_CONTENT_LIGHT_LEVEL },
>  { AV_PKT_DATA_A53_CC, AV_FRAME_DATA_A53_CC },
> +{ AV_PKT_DATA_DYNAMIC_HDR_PLUS,   
> AV_FRAME_DATA_DYNAMIC_HDR_PLUS },
>  { AV_PKT_DATA_ICC_PROFILE,AV_FRAME_DATA_ICC_PROFILE 
> },
>  };
>  
> diff --git a/libavcodec/hevc_sei.c b/libavcodec/hevc_sei.c
> index a4ec65dc1a..a490e752dd 100644
> --- a/libavcodec/hevc_sei.c
> +++ b/libavcodec/hevc_sei.c
> @@ -25,6 +25,7 @@
>  #include "golomb.h"
>  #include "hevc_ps.h"
>  #include "hevc_sei.h"
> +#include "internal.h"
>  
>  static int decode_nal_sei_decoded_picture_hash(HEVCSEIPictureHash *s, 
> GetBitContext *gb)
>  {
> @@ -242,8 +243,8 @@ static int 
> decode_nal_sei_user_data_unregistered(HEVCSEIUnregistered *s, GetBitC
>  static int decode_nal_sei_user_data_registered_itu_t_t35(HEVCSEI *s, 
> GetBitContext *gb,
>   int size)
>  {
> -uint32_t country_code;
> -uint32_t user_identifier;
> +uint8_t country_code;
> +uint16_t provider_code;
>  
>  if (size < 7)
>  return AVERROR(EINVAL);
> @@ -255,18 +256,31 @@ static int 
> decode_nal_sei_user_data_registered_itu_t_t35(HEVCSEI *s, GetBitConte
>  size--;
>  }
>  
> -skip_bits(gb, 8);
> -skip_bits(gb, 8);
> -
> -user_identifier = get_bits_long(gb, 32);
> -
> -switch (user_identifier) {
> -case MKBETAG('G', 'A', '9', '4'):
> +provider_code = get_bits(gb, 16);
> +
> +const uint8_t usa_country_code = 0xB5;
> +const uint16_t smpte_provider_code = 0x003C;
> +if (country_code == usa_country_code &&
> +provider_code == smpte_provider_code) {
> +// A/341 Amendment – 2094-40
> +uint16_t provider_oriented_code = get_bits(gb, 16);
> +uint8_t application_identifier = get_bits(gb, 8);
> +const uint16_t smpte2094_40_provider_oriented_code = 0x0001;
> +const uint16_t smpte2094_40_application_identifier = 0x04;
> +if (provider_oriented_code == smpte2094_40_provider_oriented_code &&
> +application_identifier == smpte2094_40_application_identifier) {
> +int err = ff_read_itu_t_t35_to_dynamic_hdr_plus(gb, 
> s->dynamic_hdr_plus.info);
> +if (err < 0 && s->dynamic_hdr_plus.info) {
> +av_buffer_unref(&s->dynamic_hdr_plus.info);
> +}
> +return err;
> +}
> +} else {
> +uint32_t  user_identifier = get_bits_long(gb, 32);
> +if(user_identifier == MKBETAG('G', 'A', '9', '4'))
>  return 
> decode_registered_user_data_closed_caption(&s->a53_caption, gb, size);
> -default:
> -skip_bits_long(gb, size * 8);
> -break;
>  }
> +skip_bits_long(gb, size * 8);
>  return 0;
>  }
>  
> @@ -453,4 +467,5 @@ void ff_hevc_reset_sei(HEVCSEI *s)
>  av_buffer_unref(&s->unregistered.buf_ref[i]);
>  s->unregistered.nb_buf_ref = 0;
>  av_freep(&s->unregistered.buf_ref);
> +av

Re: [FFmpeg-devel] [PATCH] Support HDR10+ metadata for HEVC

2020-07-24 Thread James Almer
On 7/23/2020 7:26 PM, Mohammad Izadi wrote:
>>>  void av_fast_padded_malloc(void *ptr, unsigned int *size, size_t
>> min_size)
>>>  {
>>> @@ -2346,3 +2359,170 @@ int ff_int_from_list_or_default(void *ctx, const
>> char * val_name, int val,
>>> "%s %d are not supported. Set to default value : %d\n",
>> val_name, val, default_value);
>>>  return default_value;
>>>  }
>>> +
>>> +int ff_read_itu_t_t35_to_dynamic_hdr_plus(void *gbc,  AVBufferRef
>> *output)
>>
>> Unless this is used by other decoders, it should not be added to utils.c
>> Put it in hevc_sei.c
>>
> Yes, we are going to use it for matroka in avf.

If you need to share this function between libraries, then it needs to
use the avpriv prefix, and must not use a pointer to a GetBitContext.

See how avpriv_ac3_parse_header() and ff_ac3_parse_header() are handled
for an example of this. You'd need to do something like:

> int ff_read_itu_t_t35_to_dynamic_hdr_plus(GetBitContext *gbc,  AVBufferRef 
> *output)
> {
> [...]
> }
> 
> int avpriv_read_itu_t_t35_to_dynamic_hdr_plus(const uint8_t *buf, int size, 
> AVBufferRef *output)
> {
> GetBitContext gb;
> int ret = init_get_bits8(&gb, buf, size);
> if (ret < 0)
> return ret;
> return ff_read_itu_t_t35_to_dynamic_hdr_plus(&gb, output);
> }

Also, please move this code to its own file within lavc, instead of
adding it to utils.c
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

[FFmpeg-devel] [PATCH] Support HDR10+ metadata for HEVC.

2020-07-23 Thread Mohammad Izadi
From: Mohammad Izadi 

HDR10+ is dynamic metadata (A/341 Amendment - SMPTE2094-40) that needs to be 
decoded from ITU-T T.35 in HEVC bitstream. The HDR10+ is transferred to side 
data packet to be used or passed through.
---
 libavcodec/avpacket.c |   1 +
 libavcodec/decode.c   |   1 +
 libavcodec/hevc_sei.c |  39 ++---
 libavcodec/hevc_sei.h |   5 ++
 libavcodec/hevcdec.c  |  16 
 libavcodec/internal.h |   9 +++
 libavcodec/packet.h   |   8 ++
 libavcodec/utils.c| 180 ++
 libavcodec/version.h  |   2 +-
 9 files changed, 248 insertions(+), 13 deletions(-)

diff --git a/libavcodec/avpacket.c b/libavcodec/avpacket.c
index dce26cb31a..8307032335 100644
--- a/libavcodec/avpacket.c
+++ b/libavcodec/avpacket.c
@@ -394,6 +394,7 @@ const char *av_packet_side_data_name(enum 
AVPacketSideDataType type)
 case AV_PKT_DATA_CONTENT_LIGHT_LEVEL:return "Content light level 
metadata";
 case AV_PKT_DATA_SPHERICAL:  return "Spherical Mapping";
 case AV_PKT_DATA_A53_CC: return "A53 Closed Captions";
+case AV_PKT_DATA_DYNAMIC_HDR_PLUS:   return "HDR10+ Dynamic 
Metadata (SMPTE 2094-40)";
 case AV_PKT_DATA_ENCRYPTION_INIT_INFO:   return "Encryption 
initialization data";
 case AV_PKT_DATA_ENCRYPTION_INFO:return "Encryption info";
 case AV_PKT_DATA_AFD:return "Active Format 
Description data";
diff --git a/libavcodec/decode.c b/libavcodec/decode.c
index de9c079f9d..cd3286f7fb 100644
--- a/libavcodec/decode.c
+++ b/libavcodec/decode.c
@@ -1698,6 +1698,7 @@ int ff_decode_frame_props(AVCodecContext *avctx, AVFrame 
*frame)
 { AV_PKT_DATA_MASTERING_DISPLAY_METADATA, 
AV_FRAME_DATA_MASTERING_DISPLAY_METADATA },
 { AV_PKT_DATA_CONTENT_LIGHT_LEVEL,
AV_FRAME_DATA_CONTENT_LIGHT_LEVEL },
 { AV_PKT_DATA_A53_CC, AV_FRAME_DATA_A53_CC },
+{ AV_PKT_DATA_DYNAMIC_HDR_PLUS,   
AV_FRAME_DATA_DYNAMIC_HDR_PLUS },
 { AV_PKT_DATA_ICC_PROFILE,AV_FRAME_DATA_ICC_PROFILE },
 };
 
diff --git a/libavcodec/hevc_sei.c b/libavcodec/hevc_sei.c
index a4ec65dc1a..a490e752dd 100644
--- a/libavcodec/hevc_sei.c
+++ b/libavcodec/hevc_sei.c
@@ -25,6 +25,7 @@
 #include "golomb.h"
 #include "hevc_ps.h"
 #include "hevc_sei.h"
+#include "internal.h"
 
 static int decode_nal_sei_decoded_picture_hash(HEVCSEIPictureHash *s, 
GetBitContext *gb)
 {
@@ -242,8 +243,8 @@ static int 
decode_nal_sei_user_data_unregistered(HEVCSEIUnregistered *s, GetBitC
 static int decode_nal_sei_user_data_registered_itu_t_t35(HEVCSEI *s, 
GetBitContext *gb,
  int size)
 {
-uint32_t country_code;
-uint32_t user_identifier;
+uint8_t country_code;
+uint16_t provider_code;
 
 if (size < 7)
 return AVERROR(EINVAL);
@@ -255,18 +256,31 @@ static int 
decode_nal_sei_user_data_registered_itu_t_t35(HEVCSEI *s, GetBitConte
 size--;
 }
 
-skip_bits(gb, 8);
-skip_bits(gb, 8);
-
-user_identifier = get_bits_long(gb, 32);
-
-switch (user_identifier) {
-case MKBETAG('G', 'A', '9', '4'):
+provider_code = get_bits(gb, 16);
+
+const uint8_t usa_country_code = 0xB5;
+const uint16_t smpte_provider_code = 0x003C;
+if (country_code == usa_country_code &&
+provider_code == smpte_provider_code) {
+// A/341 Amendment – 2094-40
+uint16_t provider_oriented_code = get_bits(gb, 16);
+uint8_t application_identifier = get_bits(gb, 8);
+const uint16_t smpte2094_40_provider_oriented_code = 0x0001;
+const uint16_t smpte2094_40_application_identifier = 0x04;
+if (provider_oriented_code == smpte2094_40_provider_oriented_code &&
+application_identifier == smpte2094_40_application_identifier) {
+int err = ff_read_itu_t_t35_to_dynamic_hdr_plus(gb, 
s->dynamic_hdr_plus.info);
+if (err < 0 && s->dynamic_hdr_plus.info) {
+av_buffer_unref(&s->dynamic_hdr_plus.info);
+}
+return err;
+}
+} else {
+uint32_t  user_identifier = get_bits_long(gb, 32);
+if(user_identifier == MKBETAG('G', 'A', '9', '4'))
 return decode_registered_user_data_closed_caption(&s->a53_caption, 
gb, size);
-default:
-skip_bits_long(gb, size * 8);
-break;
 }
+skip_bits_long(gb, size * 8);
 return 0;
 }
 
@@ -453,4 +467,5 @@ void ff_hevc_reset_sei(HEVCSEI *s)
 av_buffer_unref(&s->unregistered.buf_ref[i]);
 s->unregistered.nb_buf_ref = 0;
 av_freep(&s->unregistered.buf_ref);
+av_buffer_unref(&s->dynamic_hdr_plus.info);
 }
diff --git a/libavcodec/hevc_sei.h b/libavcodec/hevc_sei.h
index 5ee7a4796d..e9e2d46ed4 100644
--- a/libavcodec/hevc_sei.h
+++ b/libavcodec/hevc_sei.h
@@ -104,6 +104,10 @@ typedef struct HEVCSEIMasteringDisplay {
 uint32_t mi

Re: [FFmpeg-devel] [PATCH] Support HDR10+ metadata for HEVC

2020-07-23 Thread Mohammad Izadi
I am not sure if you received the patch in reply to the thread? I used:
git send-email  0001-Support-HDR10-metadata-for-HEVC.patch --to=
ffmpeg-devel@ffmpeg.org --in-reply-to=
422719c5-f010-6b39-6415-b3bf46dcb...@rothenpieler.org


It seems it created a new thread. Did you receive it?

Thanks,
Mohammad


On Thu, Jul 23, 2020 at 3:29 PM Mohammad Izadi  wrote:

>
> Thanks,
> Mohammad
>
>
> On Thu, Jul 23, 2020 at 1:14 AM zhilizhao  wrote:
>
>>
>>
>> > On Jul 17, 2020, at 5:47 AM, Steinar H. Gunderson <
>> steinar+ffm...@gunderson.no> wrote:
>> >
>> > On Thu, Jul 16, 2020 at 06:34:31PM -0300, James Almer wrote:
>> >>> static AVMutex codec_mutex = AV_MUTEX_INITIALIZER;
>> >>> +static const uint8_t usa_country_code = 0xB5;
>> >>> +static const uint16_t smpte_provider_code = 0x003C;
>> >>> +static const uint16_t smpte2094_40_provider_oriented_code = 0x0001;
>> >>> +static const uint16_t smpte2094_40_application_identifier = 0x04;
>> >>> +static const int64_t luminance_den = 1;
>> >>> +static const int32_t peak_luminance_den = 15;
>> >>> +static const int64_t rgb_den = 10;
>> >>> +static const int32_t fraction_pixel_den = 1000;
>> >>> +static const int32_t knee_point_den = 4095;
>> >>> +static const int32_t bezier_anchor_den = 1023;
>> >>> +static const int32_t saturation_weight_den = 8;
>> >> Same, no global state.
>> >
>> > It's not state if it can't be changed.
>>
>> If there is any chance to reuse these variables, I prefer current style
>> than
>> use a literal with comments next to it.
>>
> I am going to use them in both read/write. For now I moved them to the
> local function and I will make them global when I added the write func.
>
>>
>> >
>> > /* Steinar */
>> > --
>> > Homepage: https://www.sesse.net/
>> > ___
>> > ffmpeg-devel mailing list
>> > ffmpeg-devel@ffmpeg.org
>> > https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>> >
>> > To unsubscribe, visit link above, or email
>> > ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
>>
>> ___
>> ffmpeg-devel mailing list
>> ffmpeg-devel@ffmpeg.org
>> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>>
>> To unsubscribe, visit link above, or email
>> ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
>
>
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

[FFmpeg-devel] [PATCH] Support HDR10+ metadata for HEVC.

2020-07-23 Thread Mohammad Izadi
From: Mohammad Izadi 

HDR10+ is dynamic metadata (A/341 Amendment - SMPTE2094-40) that needs to be 
decoded from ITU-T T.35 in HEVC bitstream. The HDR10+ is transferred to side 
data packet to be used or passed through.
---
 libavcodec/avpacket.c |   1 +
 libavcodec/decode.c   |   1 +
 libavcodec/hevc_sei.c |  39 ++---
 libavcodec/hevc_sei.h |   5 ++
 libavcodec/hevcdec.c  |  16 
 libavcodec/internal.h |   9 +++
 libavcodec/packet.h   |   8 ++
 libavcodec/utils.c| 180 ++
 libavcodec/version.h  |   2 +-
 9 files changed, 248 insertions(+), 13 deletions(-)

diff --git a/libavcodec/avpacket.c b/libavcodec/avpacket.c
index dce26cb31a..8307032335 100644
--- a/libavcodec/avpacket.c
+++ b/libavcodec/avpacket.c
@@ -394,6 +394,7 @@ const char *av_packet_side_data_name(enum 
AVPacketSideDataType type)
 case AV_PKT_DATA_CONTENT_LIGHT_LEVEL:return "Content light level 
metadata";
 case AV_PKT_DATA_SPHERICAL:  return "Spherical Mapping";
 case AV_PKT_DATA_A53_CC: return "A53 Closed Captions";
+case AV_PKT_DATA_DYNAMIC_HDR_PLUS:   return "HDR10+ Dynamic 
Metadata (SMPTE 2094-40)";
 case AV_PKT_DATA_ENCRYPTION_INIT_INFO:   return "Encryption 
initialization data";
 case AV_PKT_DATA_ENCRYPTION_INFO:return "Encryption info";
 case AV_PKT_DATA_AFD:return "Active Format 
Description data";
diff --git a/libavcodec/decode.c b/libavcodec/decode.c
index de9c079f9d..cd3286f7fb 100644
--- a/libavcodec/decode.c
+++ b/libavcodec/decode.c
@@ -1698,6 +1698,7 @@ int ff_decode_frame_props(AVCodecContext *avctx, AVFrame 
*frame)
 { AV_PKT_DATA_MASTERING_DISPLAY_METADATA, 
AV_FRAME_DATA_MASTERING_DISPLAY_METADATA },
 { AV_PKT_DATA_CONTENT_LIGHT_LEVEL,
AV_FRAME_DATA_CONTENT_LIGHT_LEVEL },
 { AV_PKT_DATA_A53_CC, AV_FRAME_DATA_A53_CC },
+{ AV_PKT_DATA_DYNAMIC_HDR_PLUS,   
AV_FRAME_DATA_DYNAMIC_HDR_PLUS },
 { AV_PKT_DATA_ICC_PROFILE,AV_FRAME_DATA_ICC_PROFILE },
 };
 
diff --git a/libavcodec/hevc_sei.c b/libavcodec/hevc_sei.c
index a4ec65dc1a..a490e752dd 100644
--- a/libavcodec/hevc_sei.c
+++ b/libavcodec/hevc_sei.c
@@ -25,6 +25,7 @@
 #include "golomb.h"
 #include "hevc_ps.h"
 #include "hevc_sei.h"
+#include "internal.h"
 
 static int decode_nal_sei_decoded_picture_hash(HEVCSEIPictureHash *s, 
GetBitContext *gb)
 {
@@ -242,8 +243,8 @@ static int 
decode_nal_sei_user_data_unregistered(HEVCSEIUnregistered *s, GetBitC
 static int decode_nal_sei_user_data_registered_itu_t_t35(HEVCSEI *s, 
GetBitContext *gb,
  int size)
 {
-uint32_t country_code;
-uint32_t user_identifier;
+uint8_t country_code;
+uint16_t provider_code;
 
 if (size < 7)
 return AVERROR(EINVAL);
@@ -255,18 +256,31 @@ static int 
decode_nal_sei_user_data_registered_itu_t_t35(HEVCSEI *s, GetBitConte
 size--;
 }
 
-skip_bits(gb, 8);
-skip_bits(gb, 8);
-
-user_identifier = get_bits_long(gb, 32);
-
-switch (user_identifier) {
-case MKBETAG('G', 'A', '9', '4'):
+provider_code = get_bits(gb, 16);
+
+const uint8_t usa_country_code = 0xB5;
+const uint16_t smpte_provider_code = 0x003C;
+if (country_code == usa_country_code &&
+provider_code == smpte_provider_code) {
+// A/341 Amendment – 2094-40
+uint16_t provider_oriented_code = get_bits(gb, 16);
+uint8_t application_identifier = get_bits(gb, 8);
+const uint16_t smpte2094_40_provider_oriented_code = 0x0001;
+const uint16_t smpte2094_40_application_identifier = 0x04;
+if (provider_oriented_code == smpte2094_40_provider_oriented_code &&
+application_identifier == smpte2094_40_application_identifier) {
+int err = ff_read_itu_t_t35_to_dynamic_hdr_plus(gb, 
s->dynamic_hdr_plus.info);
+if (err < 0 && s->dynamic_hdr_plus.info) {
+av_buffer_unref(&s->dynamic_hdr_plus.info);
+}
+return err;
+}
+} else {
+uint32_t  user_identifier = get_bits_long(gb, 32);
+if(user_identifier == MKBETAG('G', 'A', '9', '4'))
 return decode_registered_user_data_closed_caption(&s->a53_caption, 
gb, size);
-default:
-skip_bits_long(gb, size * 8);
-break;
 }
+skip_bits_long(gb, size * 8);
 return 0;
 }
 
@@ -453,4 +467,5 @@ void ff_hevc_reset_sei(HEVCSEI *s)
 av_buffer_unref(&s->unregistered.buf_ref[i]);
 s->unregistered.nb_buf_ref = 0;
 av_freep(&s->unregistered.buf_ref);
+av_buffer_unref(&s->dynamic_hdr_plus.info);
 }
diff --git a/libavcodec/hevc_sei.h b/libavcodec/hevc_sei.h
index 5ee7a4796d..e9e2d46ed4 100644
--- a/libavcodec/hevc_sei.h
+++ b/libavcodec/hevc_sei.h
@@ -104,6 +104,10 @@ typedef struct HEVCSEIMasteringDisplay {
 uint32_t mi

Re: [FFmpeg-devel] [PATCH] Support HDR10+ metadata for HEVC

2020-07-23 Thread Mohammad Izadi
Thanks,
Mohammad


On Thu, Jul 23, 2020 at 1:14 AM zhilizhao  wrote:

>
>
> > On Jul 17, 2020, at 5:47 AM, Steinar H. Gunderson <
> steinar+ffm...@gunderson.no> wrote:
> >
> > On Thu, Jul 16, 2020 at 06:34:31PM -0300, James Almer wrote:
> >>> static AVMutex codec_mutex = AV_MUTEX_INITIALIZER;
> >>> +static const uint8_t usa_country_code = 0xB5;
> >>> +static const uint16_t smpte_provider_code = 0x003C;
> >>> +static const uint16_t smpte2094_40_provider_oriented_code = 0x0001;
> >>> +static const uint16_t smpte2094_40_application_identifier = 0x04;
> >>> +static const int64_t luminance_den = 1;
> >>> +static const int32_t peak_luminance_den = 15;
> >>> +static const int64_t rgb_den = 10;
> >>> +static const int32_t fraction_pixel_den = 1000;
> >>> +static const int32_t knee_point_den = 4095;
> >>> +static const int32_t bezier_anchor_den = 1023;
> >>> +static const int32_t saturation_weight_den = 8;
> >> Same, no global state.
> >
> > It's not state if it can't be changed.
>
> If there is any chance to reuse these variables, I prefer current style
> than
> use a literal with comments next to it.
>
I am going to use them in both read/write. For now I moved them to the
local function and I will make them global when I added the write func.

>
> >
> > /* Steinar */
> > --
> > Homepage: https://www.sesse.net/
> > ___
> > ffmpeg-devel mailing list
> > ffmpeg-devel@ffmpeg.org
> > https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> >
> > To unsubscribe, visit link above, or email
> > ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
>
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> To unsubscribe, visit link above, or email
> ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-devel] [PATCH] Support HDR10+ metadata for HEVC

2020-07-23 Thread Mohammad Izadi
Please see my answers inline:

On Thu, Jul 16, 2020 at 2:34 PM James Almer  wrote:

> On 7/16/2020 4:23 PM, Mohammad Izadi wrote:
> > From: Mohammad Izadi 
> >
> > ---
> >  libavcodec/avpacket.c |   1 +
> >  libavcodec/decode.c   |   1 +
> >  libavcodec/hevc_sei.c |  40 +++---
> >  libavcodec/hevc_sei.h |   5 ++
> >  libavcodec/hevcdec.c  |   7 ++
> >  libavcodec/internal.h |   9 +++
> >  libavcodec/packet.h   |   9 +++
> >  libavcodec/utils.c| 180 ++
> >  libavcodec/version.h  |   2 +-
> >  9 files changed, 241 insertions(+), 13 deletions(-)
> >
> > diff --git a/libavcodec/avpacket.c b/libavcodec/avpacket.c
> > index dce26cb31a..8307032335 <(830)%20703-2335> 100644
> > --- a/libavcodec/avpacket.c
> > +++ b/libavcodec/avpacket.c
> > @@ -394,6 +394,7 @@ const char *av_packet_side_data_name(enum
> AVPacketSideDataType type)
> >  case AV_PKT_DATA_CONTENT_LIGHT_LEVEL:return "Content light
> level metadata";
> >  case AV_PKT_DATA_SPHERICAL:  return "Spherical
> Mapping";
> >  case AV_PKT_DATA_A53_CC: return "A53 Closed
> Captions";
> > +case AV_PKT_DATA_DYNAMIC_HDR_PLUS:   return "HDR10+ Dynamic
> Metadata (SMPTE 2094-40)";
> >  case AV_PKT_DATA_ENCRYPTION_INIT_INFO:   return "Encryption
> initialization data";
> >  case AV_PKT_DATA_ENCRYPTION_INFO:return "Encryption
> info";
> >  case AV_PKT_DATA_AFD:return "Active Format
> Description data";
> > diff --git a/libavcodec/decode.c b/libavcodec/decode.c
> > index de9c079f9d..cd3286f7fb 100644
> > --- a/libavcodec/decode.c
> > +++ b/libavcodec/decode.c
> > @@ -1698,6 +1698,7 @@ int ff_decode_frame_props(AVCodecContext *avctx,
> AVFrame *frame)
> >  { AV_PKT_DATA_MASTERING_DISPLAY_METADATA,
> AV_FRAME_DATA_MASTERING_DISPLAY_METADATA },
> >  { AV_PKT_DATA_CONTENT_LIGHT_LEVEL,
> AV_FRAME_DATA_CONTENT_LIGHT_LEVEL },
> >  { AV_PKT_DATA_A53_CC, AV_FRAME_DATA_A53_CC
> },
> > +{ AV_PKT_DATA_DYNAMIC_HDR_PLUS,
>  AV_FRAME_DATA_DYNAMIC_HDR_PLUS },
> >  { AV_PKT_DATA_ICC_PROFILE,
> AV_FRAME_DATA_ICC_PROFILE },
> >  };
> >
> > diff --git a/libavcodec/hevc_sei.c b/libavcodec/hevc_sei.c
> > index a4ec65dc1a..096c414d91 100644
> > --- a/libavcodec/hevc_sei.c
> > +++ b/libavcodec/hevc_sei.c
> > @@ -25,6 +25,12 @@
> >  #include "golomb.h"
> >  #include "hevc_ps.h"
> >  #include "hevc_sei.h"
> > +#include "internal.h"
> > +
> > +static const uint8_t usa_country_code = 0xB5;
> > +static const uint16_t smpte_provider_code = 0x003C;
> > +static const uint16_t smpte2094_40_provider_oriented_code = 0x0001;
> > +static const uint16_t smpte2094_40_application_identifier = 0x04;
>
> No global state, please. You can just use the values in question and add
> a comment next to them to describe their meaning, like it's done for a
> lot other values in this file.
>
> Done.

> >
> >  static int decode_nal_sei_decoded_picture_hash(HEVCSEIPictureHash *s,
> GetBitContext *gb)
> >  {
> > @@ -242,8 +248,8 @@ static int
> decode_nal_sei_user_data_unregistered(HEVCSEIUnregistered *s, GetBitC
> >  static int decode_nal_sei_user_data_registered_itu_t_t35(HEVCSEI *s,
> GetBitContext *gb,
> >   int size)
> >  {
> > -uint32_t country_code;
> > -uint32_t user_identifier;
> > +uint8_t country_code;
> > +uint16_t provider_code;
> >
> >  if (size < 7)
> >  return AVERROR(EINVAL);
> > @@ -255,18 +261,27 @@ static int
> decode_nal_sei_user_data_registered_itu_t_t35(HEVCSEI *s, GetBitConte
> >  size--;
> >  }
> >
> > -skip_bits(gb, 8);
> > -skip_bits(gb, 8);
> > -
> > -user_identifier = get_bits_long(gb, 32);
> > -
> > -switch (user_identifier) {
> > -case MKBETAG('G', 'A', '9', '4'):
> > +provider_code = get_bits(gb, 16);
> > +
> > +if (country_code == usa_country_code &&
> > +provider_code == smpte_provider_code) {
> > +// A/341 Amendment – 2094-40
> > +uint16_t provider_oriented_code = get_bits(gb, 16);
> > +uint8_t application_identifier = get_bits(gb, 8);
> > +if (provider_oriented_code ==
> smpte2094_40_provider_oriented_code &&
> > +application_identifier ==
> smpte2094_40_application_identifier) {
> > +int err = ff_read_itu_t_t35_to_dynamic_hdr_plus(gb, s->
> dynamic_hdr_plus.info);
> > +if (err < 0 && s->dynamic_hdr_plus.info) {
> > +av_buffer_unref(&s->dynamic_hdr_plus.info);
> > +}
> > +return err;
> > +}
> > +} else {
> > +uint32_t  user_identifier = get_bits_long(gb, 32);
> > +if(user_identifier == MKBETAG('G', 'A', '9', '4'))
> >  return
> decode_registered_user_data_closed_caption(&s->a53_caption, gb, size);
> > -default:
> > -skip_bits_long(gb, size * 8);
> > -b

Re: [FFmpeg-devel] [PATCH] Support HDR10+ metadata for HEVC

2020-07-23 Thread Timo Rothenpieler

On 23/07/2020 10:13, zhilizhao wrote:




On Jul 17, 2020, at 5:47 AM, Steinar H. Gunderson  
wrote:

On Thu, Jul 16, 2020 at 06:34:31PM -0300, James Almer wrote:

static AVMutex codec_mutex = AV_MUTEX_INITIALIZER;
+static const uint8_t usa_country_code = 0xB5;
+static const uint16_t smpte_provider_code = 0x003C;
+static const uint16_t smpte2094_40_provider_oriented_code = 0x0001;
+static const uint16_t smpte2094_40_application_identifier = 0x04;
+static const int64_t luminance_den = 1;
+static const int32_t peak_luminance_den = 15;
+static const int64_t rgb_den = 10;
+static const int32_t fraction_pixel_den = 1000;
+static const int32_t knee_point_den = 4095;
+static const int32_t bezier_anchor_den = 1023;
+static const int32_t saturation_weight_den = 8;

Same, no global state.


It's not state if it can't be changed.


If there is any chance to reuse these variables, I prefer current style than
use a literal with comments next to it.


I guess ffmpeg more commonly uses #defines for constants like this, but 
it's still valid and not global state.

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

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-devel] [PATCH] Support HDR10+ metadata for HEVC

2020-07-23 Thread zhilizhao


> On Jul 17, 2020, at 5:47 AM, Steinar H. Gunderson 
>  wrote:
> 
> On Thu, Jul 16, 2020 at 06:34:31PM -0300, James Almer wrote:
>>> static AVMutex codec_mutex = AV_MUTEX_INITIALIZER;
>>> +static const uint8_t usa_country_code = 0xB5;
>>> +static const uint16_t smpte_provider_code = 0x003C;
>>> +static const uint16_t smpte2094_40_provider_oriented_code = 0x0001;
>>> +static const uint16_t smpte2094_40_application_identifier = 0x04;
>>> +static const int64_t luminance_den = 1;
>>> +static const int32_t peak_luminance_den = 15;
>>> +static const int64_t rgb_den = 10;
>>> +static const int32_t fraction_pixel_den = 1000;
>>> +static const int32_t knee_point_den = 4095;
>>> +static const int32_t bezier_anchor_den = 1023;
>>> +static const int32_t saturation_weight_den = 8;
>> Same, no global state.
> 
> It's not state if it can't be changed.

If there is any chance to reuse these variables, I prefer current style than
use a literal with comments next to it.

> 
> /* Steinar */
> -- 
> Homepage: https://www.sesse.net/
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> 
> To unsubscribe, visit link above, or email
> ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

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

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-devel] [PATCH] Support HDR10+ metadata for HEVC

2020-07-22 Thread Mohammad Izadi
Please see my answers inline:


On Thu, Jul 16, 2020 at 1:30 PM Carl Eugen Hoyos  wrote:

> Am Do., 16. Juli 2020 um 21:24 Uhr schrieb Mohammad Izadi
> :
>
> > -user_identifier = get_bits_long(gb, 32);
> > -
> > -switch (user_identifier) {
> > -case MKBETAG('G', 'A', '9', '4'):
>
> Why did you have to change this existing code?
>
> We need to read the metadata (A/341 Amendment – 2094-40
)
from the ITU-T T.35. Here is the point we need to read ITU-T T.35 and
decode it. I will update the commit message to explain it.

> Could you elaborate a little on the use-cases this patch supports (and
> does not support) in the commit message?
>
> Sure, I'll do.

> A micro version bump should be sufficient.
>
> Carl Eugen
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> To unsubscribe, visit link above, or email
> ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-devel] [PATCH] Support HDR10+ metadata for HEVC

2020-07-16 Thread Steinar H. Gunderson
On Thu, Jul 16, 2020 at 06:34:31PM -0300, James Almer wrote:
>>  static AVMutex codec_mutex = AV_MUTEX_INITIALIZER;
>> +static const uint8_t usa_country_code = 0xB5;
>> +static const uint16_t smpte_provider_code = 0x003C;
>> +static const uint16_t smpte2094_40_provider_oriented_code = 0x0001;
>> +static const uint16_t smpte2094_40_application_identifier = 0x04;
>> +static const int64_t luminance_den = 1;
>> +static const int32_t peak_luminance_den = 15;
>> +static const int64_t rgb_den = 10;
>> +static const int32_t fraction_pixel_den = 1000;
>> +static const int32_t knee_point_den = 4095;
>> +static const int32_t bezier_anchor_den = 1023;
>> +static const int32_t saturation_weight_den = 8;
> Same, no global state.

It's not state if it can't be changed.

/* Steinar */
-- 
Homepage: https://www.sesse.net/
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-devel] [PATCH] Support HDR10+ metadata for HEVC

2020-07-16 Thread James Almer
On 7/16/2020 4:29 PM, Carl Eugen Hoyos wrote:
> Am Do., 16. Juli 2020 um 21:24 Uhr schrieb Mohammad Izadi
> :
> 
>> -user_identifier = get_bits_long(gb, 32);
>> -
>> -switch (user_identifier) {
>> -case MKBETAG('G', 'A', '9', '4'):
> 
> Why did you have to change this existing code?
> 
> Could you elaborate a little on the use-cases this patch supports (and
> does not support) in the commit message?
> 
> A micro version bump should be sufficient.

It adds a new AVPacketSideDataType enum entry, so minor is correct.

> 
> Carl Eugen
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> 
> To unsubscribe, visit link above, or email
> ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
> 

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

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-devel] [PATCH] Support HDR10+ metadata for HEVC

2020-07-16 Thread James Almer
On 7/16/2020 4:23 PM, Mohammad Izadi wrote:
> From: Mohammad Izadi 
> 
> ---
>  libavcodec/avpacket.c |   1 +
>  libavcodec/decode.c   |   1 +
>  libavcodec/hevc_sei.c |  40 +++---
>  libavcodec/hevc_sei.h |   5 ++
>  libavcodec/hevcdec.c  |   7 ++
>  libavcodec/internal.h |   9 +++
>  libavcodec/packet.h   |   9 +++
>  libavcodec/utils.c| 180 ++
>  libavcodec/version.h  |   2 +-
>  9 files changed, 241 insertions(+), 13 deletions(-)
> 
> diff --git a/libavcodec/avpacket.c b/libavcodec/avpacket.c
> index dce26cb31a..8307032335 100644
> --- a/libavcodec/avpacket.c
> +++ b/libavcodec/avpacket.c
> @@ -394,6 +394,7 @@ const char *av_packet_side_data_name(enum 
> AVPacketSideDataType type)
>  case AV_PKT_DATA_CONTENT_LIGHT_LEVEL:return "Content light level 
> metadata";
>  case AV_PKT_DATA_SPHERICAL:  return "Spherical Mapping";
>  case AV_PKT_DATA_A53_CC: return "A53 Closed 
> Captions";
> +case AV_PKT_DATA_DYNAMIC_HDR_PLUS:   return "HDR10+ Dynamic 
> Metadata (SMPTE 2094-40)";
>  case AV_PKT_DATA_ENCRYPTION_INIT_INFO:   return "Encryption 
> initialization data";
>  case AV_PKT_DATA_ENCRYPTION_INFO:return "Encryption info";
>  case AV_PKT_DATA_AFD:return "Active Format 
> Description data";
> diff --git a/libavcodec/decode.c b/libavcodec/decode.c
> index de9c079f9d..cd3286f7fb 100644
> --- a/libavcodec/decode.c
> +++ b/libavcodec/decode.c
> @@ -1698,6 +1698,7 @@ int ff_decode_frame_props(AVCodecContext *avctx, 
> AVFrame *frame)
>  { AV_PKT_DATA_MASTERING_DISPLAY_METADATA, 
> AV_FRAME_DATA_MASTERING_DISPLAY_METADATA },
>  { AV_PKT_DATA_CONTENT_LIGHT_LEVEL,
> AV_FRAME_DATA_CONTENT_LIGHT_LEVEL },
>  { AV_PKT_DATA_A53_CC, AV_FRAME_DATA_A53_CC },
> +{ AV_PKT_DATA_DYNAMIC_HDR_PLUS,   
> AV_FRAME_DATA_DYNAMIC_HDR_PLUS },
>  { AV_PKT_DATA_ICC_PROFILE,AV_FRAME_DATA_ICC_PROFILE 
> },
>  };
>  
> diff --git a/libavcodec/hevc_sei.c b/libavcodec/hevc_sei.c
> index a4ec65dc1a..096c414d91 100644
> --- a/libavcodec/hevc_sei.c
> +++ b/libavcodec/hevc_sei.c
> @@ -25,6 +25,12 @@
>  #include "golomb.h"
>  #include "hevc_ps.h"
>  #include "hevc_sei.h"
> +#include "internal.h"
> +
> +static const uint8_t usa_country_code = 0xB5;
> +static const uint16_t smpte_provider_code = 0x003C;
> +static const uint16_t smpte2094_40_provider_oriented_code = 0x0001;
> +static const uint16_t smpte2094_40_application_identifier = 0x04;

No global state, please. You can just use the values in question and add
a comment next to them to describe their meaning, like it's done for a
lot other values in this file.

>  
>  static int decode_nal_sei_decoded_picture_hash(HEVCSEIPictureHash *s, 
> GetBitContext *gb)
>  {
> @@ -242,8 +248,8 @@ static int 
> decode_nal_sei_user_data_unregistered(HEVCSEIUnregistered *s, GetBitC
>  static int decode_nal_sei_user_data_registered_itu_t_t35(HEVCSEI *s, 
> GetBitContext *gb,
>   int size)
>  {
> -uint32_t country_code;
> -uint32_t user_identifier;
> +uint8_t country_code;
> +uint16_t provider_code;
>  
>  if (size < 7)
>  return AVERROR(EINVAL);
> @@ -255,18 +261,27 @@ static int 
> decode_nal_sei_user_data_registered_itu_t_t35(HEVCSEI *s, GetBitConte
>  size--;
>  }
>  
> -skip_bits(gb, 8);
> -skip_bits(gb, 8);
> -
> -user_identifier = get_bits_long(gb, 32);
> -
> -switch (user_identifier) {
> -case MKBETAG('G', 'A', '9', '4'):
> +provider_code = get_bits(gb, 16);
> +
> +if (country_code == usa_country_code &&
> +provider_code == smpte_provider_code) {
> +// A/341 Amendment – 2094-40
> +uint16_t provider_oriented_code = get_bits(gb, 16);
> +uint8_t application_identifier = get_bits(gb, 8);
> +if (provider_oriented_code == smpte2094_40_provider_oriented_code &&
> +application_identifier == smpte2094_40_application_identifier) {
> +int err = ff_read_itu_t_t35_to_dynamic_hdr_plus(gb, 
> s->dynamic_hdr_plus.info);
> +if (err < 0 && s->dynamic_hdr_plus.info) {
> +av_buffer_unref(&s->dynamic_hdr_plus.info);
> +}
> +return err;
> +}
> +} else {
> +uint32_t  user_identifier = get_bits_long(gb, 32);
> +if(user_identifier == MKBETAG('G', 'A', '9', '4'))
>  return 
> decode_registered_user_data_closed_caption(&s->a53_caption, gb, size);
> -default:
> -skip_bits_long(gb, size * 8);
> -break;
>  }
> +skip_bits_long(gb, size * 8);
>  return 0;
>  }
>  
> @@ -453,4 +468,5 @@ void ff_hevc_reset_sei(HEVCSEI *s)
>  av_buffer_unref(&s->unregistered.buf_ref[i]);
>  s->unregistered.nb_buf_ref = 0;
>  av_freep(&s->unregistered.buf_ref);

Re: [FFmpeg-devel] [PATCH] Support HDR10+ metadata for HEVC

2020-07-16 Thread Carl Eugen Hoyos
Am Do., 16. Juli 2020 um 21:24 Uhr schrieb Mohammad Izadi
:

> -user_identifier = get_bits_long(gb, 32);
> -
> -switch (user_identifier) {
> -case MKBETAG('G', 'A', '9', '4'):

Why did you have to change this existing code?

Could you elaborate a little on the use-cases this patch supports (and
does not support) in the commit message?

A micro version bump should be sufficient.

Carl Eugen
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

[FFmpeg-devel] [PATCH] Support HDR10+ metadata for HEVC

2020-07-16 Thread Mohammad Izadi
From: Mohammad Izadi 

---
 libavcodec/avpacket.c |   1 +
 libavcodec/decode.c   |   1 +
 libavcodec/hevc_sei.c |  40 +++---
 libavcodec/hevc_sei.h |   5 ++
 libavcodec/hevcdec.c  |   7 ++
 libavcodec/internal.h |   9 +++
 libavcodec/packet.h   |   9 +++
 libavcodec/utils.c| 180 ++
 libavcodec/version.h  |   2 +-
 9 files changed, 241 insertions(+), 13 deletions(-)

diff --git a/libavcodec/avpacket.c b/libavcodec/avpacket.c
index dce26cb31a..8307032335 100644
--- a/libavcodec/avpacket.c
+++ b/libavcodec/avpacket.c
@@ -394,6 +394,7 @@ const char *av_packet_side_data_name(enum 
AVPacketSideDataType type)
 case AV_PKT_DATA_CONTENT_LIGHT_LEVEL:return "Content light level 
metadata";
 case AV_PKT_DATA_SPHERICAL:  return "Spherical Mapping";
 case AV_PKT_DATA_A53_CC: return "A53 Closed Captions";
+case AV_PKT_DATA_DYNAMIC_HDR_PLUS:   return "HDR10+ Dynamic 
Metadata (SMPTE 2094-40)";
 case AV_PKT_DATA_ENCRYPTION_INIT_INFO:   return "Encryption 
initialization data";
 case AV_PKT_DATA_ENCRYPTION_INFO:return "Encryption info";
 case AV_PKT_DATA_AFD:return "Active Format 
Description data";
diff --git a/libavcodec/decode.c b/libavcodec/decode.c
index de9c079f9d..cd3286f7fb 100644
--- a/libavcodec/decode.c
+++ b/libavcodec/decode.c
@@ -1698,6 +1698,7 @@ int ff_decode_frame_props(AVCodecContext *avctx, AVFrame 
*frame)
 { AV_PKT_DATA_MASTERING_DISPLAY_METADATA, 
AV_FRAME_DATA_MASTERING_DISPLAY_METADATA },
 { AV_PKT_DATA_CONTENT_LIGHT_LEVEL,
AV_FRAME_DATA_CONTENT_LIGHT_LEVEL },
 { AV_PKT_DATA_A53_CC, AV_FRAME_DATA_A53_CC },
+{ AV_PKT_DATA_DYNAMIC_HDR_PLUS,   
AV_FRAME_DATA_DYNAMIC_HDR_PLUS },
 { AV_PKT_DATA_ICC_PROFILE,AV_FRAME_DATA_ICC_PROFILE },
 };
 
diff --git a/libavcodec/hevc_sei.c b/libavcodec/hevc_sei.c
index a4ec65dc1a..096c414d91 100644
--- a/libavcodec/hevc_sei.c
+++ b/libavcodec/hevc_sei.c
@@ -25,6 +25,12 @@
 #include "golomb.h"
 #include "hevc_ps.h"
 #include "hevc_sei.h"
+#include "internal.h"
+
+static const uint8_t usa_country_code = 0xB5;
+static const uint16_t smpte_provider_code = 0x003C;
+static const uint16_t smpte2094_40_provider_oriented_code = 0x0001;
+static const uint16_t smpte2094_40_application_identifier = 0x04;
 
 static int decode_nal_sei_decoded_picture_hash(HEVCSEIPictureHash *s, 
GetBitContext *gb)
 {
@@ -242,8 +248,8 @@ static int 
decode_nal_sei_user_data_unregistered(HEVCSEIUnregistered *s, GetBitC
 static int decode_nal_sei_user_data_registered_itu_t_t35(HEVCSEI *s, 
GetBitContext *gb,
  int size)
 {
-uint32_t country_code;
-uint32_t user_identifier;
+uint8_t country_code;
+uint16_t provider_code;
 
 if (size < 7)
 return AVERROR(EINVAL);
@@ -255,18 +261,27 @@ static int 
decode_nal_sei_user_data_registered_itu_t_t35(HEVCSEI *s, GetBitConte
 size--;
 }
 
-skip_bits(gb, 8);
-skip_bits(gb, 8);
-
-user_identifier = get_bits_long(gb, 32);
-
-switch (user_identifier) {
-case MKBETAG('G', 'A', '9', '4'):
+provider_code = get_bits(gb, 16);
+
+if (country_code == usa_country_code &&
+provider_code == smpte_provider_code) {
+// A/341 Amendment – 2094-40
+uint16_t provider_oriented_code = get_bits(gb, 16);
+uint8_t application_identifier = get_bits(gb, 8);
+if (provider_oriented_code == smpte2094_40_provider_oriented_code &&
+application_identifier == smpte2094_40_application_identifier) {
+int err = ff_read_itu_t_t35_to_dynamic_hdr_plus(gb, 
s->dynamic_hdr_plus.info);
+if (err < 0 && s->dynamic_hdr_plus.info) {
+av_buffer_unref(&s->dynamic_hdr_plus.info);
+}
+return err;
+}
+} else {
+uint32_t  user_identifier = get_bits_long(gb, 32);
+if(user_identifier == MKBETAG('G', 'A', '9', '4'))
 return decode_registered_user_data_closed_caption(&s->a53_caption, 
gb, size);
-default:
-skip_bits_long(gb, size * 8);
-break;
 }
+skip_bits_long(gb, size * 8);
 return 0;
 }
 
@@ -453,4 +468,5 @@ void ff_hevc_reset_sei(HEVCSEI *s)
 av_buffer_unref(&s->unregistered.buf_ref[i]);
 s->unregistered.nb_buf_ref = 0;
 av_freep(&s->unregistered.buf_ref);
+av_buffer_unref(&s->dynamic_hdr_plus.info);
 }
diff --git a/libavcodec/hevc_sei.h b/libavcodec/hevc_sei.h
index 5ee7a4796d..e9e2d46ed4 100644
--- a/libavcodec/hevc_sei.h
+++ b/libavcodec/hevc_sei.h
@@ -104,6 +104,10 @@ typedef struct HEVCSEIMasteringDisplay {
 uint32_t min_luminance;
 } HEVCSEIMasteringDisplay;
 
+typedef struct HEVCSEIDynamicHDRPlus {
+AVBufferRef *info;
+} HEVCSEIDynamicHDRPlus;
+
 typedef struct HEVCSEIContentLight {
 int present;