Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
* [FFmpeg-devel] [PATCH v2 0/2] DOVI: Add NLQ pivots to AVDOVIDataMapping
@ 2022-06-17 19:34 quietvoid
  2022-06-17 19:34 ` [FFmpeg-devel] [PATCH v2 1/2] libavutil/dovi_meta: Add nlq_pivots " quietvoid
  2022-06-17 19:34 ` [FFmpeg-devel] [PATCH v2 2/2] fate: Add test to parse profile 7 DOVI RPU quietvoid
  0 siblings, 2 replies; 5+ messages in thread
From: quietvoid @ 2022-06-17 19:34 UTC (permalink / raw)
  To: ffmpeg-devel; +Cc: quietvoid

The NLQ pivots are not documented but should be present
in the header for profile 7 RPU format.
It has been verified using Dolby's verification toolkit.

With the pivots parsed, the parsed values for
num_{x,y}_partitions are correct and usually equal to 1.

Changes in v2:
  - Moved the `nlq_pivots` field at the end of AVDOVIDataMapping.

quietvoid (2):
  libavutil/dovi_meta: Add nlq_pivots to AVDOVIDataMapping
  fate: Add test to parse profile 7 DOVI RPU

 fftools/ffprobe.c                     |   4 +
 libavcodec/dovi_rpu.c                 |   7 +
 libavfilter/vf_showinfo.c             |   8 +
 libavutil/dovi_meta.h                 |   1 +
 tests/fate/hevc.mak                   |   3 +
 tests/ref/fate/hevc-dovi-profile7-rpu | 296 ++++++++++++++++++++++++++
 6 files changed, 319 insertions(+)
 create mode 100644 tests/ref/fate/hevc-dovi-profile7-rpu

-- 
2.36.1

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

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [FFmpeg-devel] [PATCH v2 1/2] libavutil/dovi_meta: Add nlq_pivots to AVDOVIDataMapping
  2022-06-17 19:34 [FFmpeg-devel] [PATCH v2 0/2] DOVI: Add NLQ pivots to AVDOVIDataMapping quietvoid
@ 2022-06-17 19:34 ` quietvoid
  2022-06-17 20:19   ` Andreas Rheinhardt
  2022-06-17 19:34 ` [FFmpeg-devel] [PATCH v2 2/2] fate: Add test to parse profile 7 DOVI RPU quietvoid
  1 sibling, 1 reply; 5+ messages in thread
From: quietvoid @ 2022-06-17 19:34 UTC (permalink / raw)
  To: ffmpeg-devel; +Cc: quietvoid

The NLQ pivots are not documented but should be present
in the header for profile 7 RPU format.
It has been verified using Dolby's verification toolkit.

Also implemented the parsing in libavcodec/dovi_rpu.c.
And added the info to ffprobe and showinfo.

Signed-off-by: quietvoid <tcChlisop0@gmail.com>
---
 fftools/ffprobe.c         | 4 ++++
 libavcodec/dovi_rpu.c     | 7 +++++++
 libavfilter/vf_showinfo.c | 8 ++++++++
 libavutil/dovi_meta.h     | 1 +
 4 files changed, 20 insertions(+)

diff --git a/fftools/ffprobe.c b/fftools/ffprobe.c
index 4e2fdbaec8..bc4f7ec0a1 100644
--- a/fftools/ffprobe.c
+++ b/fftools/ffprobe.c
@@ -2001,6 +2001,10 @@ static void print_dovi_metadata(WriterContext *w, const AVDOVIMetadata *dovi)
             break;
         }
 
+        if (mapping->nlq_method_idc != AV_DOVI_NLQ_NONE) {
+            print_list_fmt("nlq_pivots", "%"PRIu16, 2, mapping->nlq_pivots[idx]);
+        }
+
         print_int("num_x_partitions",          mapping->num_x_partitions);
         print_int("num_y_partitions",          mapping->num_y_partitions);
 
diff --git a/libavcodec/dovi_rpu.c b/libavcodec/dovi_rpu.c
index a87562c8a3..17837eb845 100644
--- a/libavcodec/dovi_rpu.c
+++ b/libavcodec/dovi_rpu.c
@@ -315,7 +315,14 @@ int ff_dovi_rpu_parse(DOVIContext *s, const uint8_t *rpu, size_t rpu_size)
         }
 
         if (use_nlq) {
+            int nlq_pivot = 0;
             vdr->mapping.nlq_method_idc = get_bits(gb, 3);
+
+            for (int i = 0; i < 2; i++) {
+                nlq_pivot += get_bits(gb, hdr->bl_bit_depth);
+                vdr->mapping.nlq_pivots[i] = av_clip_uint16(nlq_pivot);
+            }
+
             /**
              * The patent mentions another legal value, NLQ_MU_LAW, but it's
              * not documented anywhere how to parse or apply that type of NLQ.
diff --git a/libavfilter/vf_showinfo.c b/libavfilter/vf_showinfo.c
index 6efcafce28..f8c04fb2fa 100644
--- a/libavfilter/vf_showinfo.c
+++ b/libavfilter/vf_showinfo.c
@@ -535,6 +535,14 @@ static void dump_dovi_metadata(AVFilterContext *ctx, const AVFrameSideData *sd)
     av_log(ctx, AV_LOG_INFO, "mapping_color_space=%"PRIu8"; ", mapping->mapping_color_space);
     av_log(ctx, AV_LOG_INFO, "mapping_chroma_format_idc=%"PRIu8"; ", mapping->mapping_chroma_format_idc);
     av_log(ctx, AV_LOG_INFO, "nlq_method_idc=%d; ", (int) mapping->nlq_method_idc);
+
+    if (mapping->nlq_method_idc != AV_DOVI_NLQ_NONE) {
+        av_log(ctx, AV_LOG_INFO, "nlq_pivots={ ");
+        for (int i = 0; i < 2; i++)
+            av_log(ctx, AV_LOG_INFO, "%"PRIu16" ", mapping->nlq_pivots[i]);
+        av_log(ctx, AV_LOG_INFO, "}; ");
+    }
+
     av_log(ctx, AV_LOG_INFO, "num_x_partitions=%"PRIu32"; ", mapping->num_x_partitions);
     av_log(ctx, AV_LOG_INFO, "num_y_partitions=%"PRIu32"\n", mapping->num_y_partitions);
 
diff --git a/libavutil/dovi_meta.h b/libavutil/dovi_meta.h
index 3d11e02bff..6afc7b055a 100644
--- a/libavutil/dovi_meta.h
+++ b/libavutil/dovi_meta.h
@@ -147,6 +147,7 @@ typedef struct AVDOVIDataMapping {
     uint32_t num_x_partitions;
     uint32_t num_y_partitions;
     AVDOVINLQParams nlq[3]; /* per component */
+    uint16_t nlq_pivots[2]; /* nlq_pred_pivot_value */
 } AVDOVIDataMapping;
 
 /**
-- 
2.36.1

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

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [FFmpeg-devel] [PATCH v2 2/2] fate: Add test to parse profile 7 DOVI RPU
  2022-06-17 19:34 [FFmpeg-devel] [PATCH v2 0/2] DOVI: Add NLQ pivots to AVDOVIDataMapping quietvoid
  2022-06-17 19:34 ` [FFmpeg-devel] [PATCH v2 1/2] libavutil/dovi_meta: Add nlq_pivots " quietvoid
@ 2022-06-17 19:34 ` quietvoid
  1 sibling, 0 replies; 5+ messages in thread
From: quietvoid @ 2022-06-17 19:34 UTC (permalink / raw)
  To: ffmpeg-devel; +Cc: quietvoid

Signed-off-by: quietvoid <tcChlisop0@gmail.com>
---
 tests/fate/hevc.mak                   |   3 +
 tests/ref/fate/hevc-dovi-profile7-rpu | 296 ++++++++++++++++++++++++++
 2 files changed, 299 insertions(+)
 create mode 100644 tests/ref/fate/hevc-dovi-profile7-rpu

diff --git a/tests/fate/hevc.mak b/tests/fate/hevc.mak
index 2f16e3a29f..549436cb39 100644
--- a/tests/fate/hevc.mak
+++ b/tests/fate/hevc.mak
@@ -254,6 +254,9 @@ FATE_HEVC-$(call FRAMECRC, HEVC, HEVC) += fate-hevc-cabac-tudepth
 fate-hevc-small422chroma: CMD = framecrc -flags unaligned -i $(TARGET_SAMPLES)/hevc/food.hevc -pix_fmt yuv422p10le -vf scale
 FATE_HEVC-$(call FRAMECRC, HEVC, HEVC, HEVC_PARSER SCALE_FILTER) += fate-hevc-small422chroma
 
+fate-hevc-dovi-profile7-rpu: CMD = probeframes -show_entries frame=side_data_list -select_streams 1 -read_intervals "%+\#2" $(TARGET_SAMPLES)/mov/dovi-p7.mp4
+FATE_HEVC_FFPROBE-$(call DEMDEC, MOV, HEVC) += fate-hevc-dovi-profile7-rpu
+
 FATE_SAMPLES_AVCONV += $(FATE_HEVC-yes)
 FATE_SAMPLES_FFPROBE += $(FATE_HEVC_FFPROBE-yes)
 
diff --git a/tests/ref/fate/hevc-dovi-profile7-rpu b/tests/ref/fate/hevc-dovi-profile7-rpu
new file mode 100644
index 0000000000..7fa5d20f01
--- /dev/null
+++ b/tests/ref/fate/hevc-dovi-profile7-rpu
@@ -0,0 +1,296 @@
+[FRAME]
+[SIDE_DATA]
+side_data_type=Mastering display metadata
+red_x=34000/50000
+red_y=16000/50000
+green_x=13250/50000
+green_y=34500/50000
+blue_x=7500/50000
+blue_y=3000/50000
+white_point_x=15635/50000
+white_point_y=16450/50000
+min_luminance=1/10000
+max_luminance=100000000/10000
+[/SIDE_DATA]
+[SIDE_DATA]
+side_data_type=Content light level metadata
+max_content=1000
+max_average=400
+[/SIDE_DATA]
+[SIDE_DATA]
+side_data_type=Dolby Vision RPU Data
+[/SIDE_DATA]
+[SIDE_DATA]
+side_data_type=Dolby Vision Metadata
+rpu_type=2
+rpu_format=18
+vdr_rpu_profile=1
+vdr_rpu_level=0
+chroma_resampling_explicit_filter_flag=0
+coef_data_type=0
+coef_log2_denom=23
+vdr_rpu_normalized_idc=1
+bl_video_full_range_flag=0
+bl_bit_depth=10
+el_bit_depth=10
+vdr_bit_depth=12
+spatial_resampling_filter_flag=0
+el_spatial_resampling_filter_flag=1
+disable_residual_flag=0
+vdr_rpu_id=0
+mapping_color_space=0
+mapping_chroma_format_idc=0
+nlq_method_idc=0
+nlq_method_idc_name=linear_dz
+nlq_pivots=0 1023
+num_x_partitions=1
+num_y_partitions=1
+[COMPONENT]
+pivots=0 128 256 384 512 640 768 896 1023
+[SECTION]
+mapping_idc=0
+mapping_idc_name=polynomial
+poly_order=1
+poly_coef=0 8388608
+[/SECTION]
+[SECTION]
+mapping_idc=0
+mapping_idc_name=polynomial
+poly_order=1
+poly_coef=0 8388608
+[/SECTION]
+[SECTION]
+mapping_idc=0
+mapping_idc_name=polynomial
+poly_order=1
+poly_coef=0 8388608
+[/SECTION]
+[SECTION]
+mapping_idc=0
+mapping_idc_name=polynomial
+poly_order=1
+poly_coef=0 8388608
+[/SECTION]
+[SECTION]
+mapping_idc=0
+mapping_idc_name=polynomial
+poly_order=1
+poly_coef=0 8388608
+[/SECTION]
+[SECTION]
+mapping_idc=0
+mapping_idc_name=polynomial
+poly_order=1
+poly_coef=0 8388608
+[/SECTION]
+[SECTION]
+mapping_idc=0
+mapping_idc_name=polynomial
+poly_order=1
+poly_coef=0 8388608
+[/SECTION]
+[SECTION]
+mapping_idc=0
+mapping_idc_name=polynomial
+poly_order=1
+poly_coef=0 8388608
+[/SECTION]
+nlq_offset=512
+vdr_in_max=1048576
+linear_deadzone_slope=2048
+linear_deadzone_threshold=0
+[/COMPONENT]
+[COMPONENT]
+pivots=0 1023
+[SECTION]
+mapping_idc=1
+mapping_idc_name=mmr
+mmr_order=3
+mmr_constant=448998
+mmr_coef=-1262056 8122466 -1703266 1622123 808554 -829469 -13459 801251 694657 3697830 -1819391 -772917 -654425 78034 -181321 -324811 -2213356 -716030 761880 365184 2545494
+[/SECTION]
+nlq_offset=512
+vdr_in_max=1048576
+linear_deadzone_slope=2048
+linear_deadzone_threshold=0
+[/COMPONENT]
+[COMPONENT]
+pivots=0 1023
+[SECTION]
+mapping_idc=1
+mapping_idc_name=mmr
+mmr_order=3
+mmr_constant=30364
+mmr_coef=-1369971 645159 9055254 -106426 2546351 -2246880 672220 1356576 1789054 -3311517 -1372035 -4554569 -548063 722319 57239 -2130348 3956345 1480062 -1696575 3919674 3414157
+[/SECTION]
+nlq_offset=512
+vdr_in_max=1048576
+linear_deadzone_slope=2048
+linear_deadzone_threshold=0
+[/COMPONENT]
+dm_metadata_id=0
+scene_refresh_flag=0
+ycc_to_rgb_matrix=9574/8192 0/8192 13802/8192 9574/8192 -1540/8192 -5348/8192 9574/8192 17610/8192 0/8192
+ycc_to_rgb_offset=16777216/268435456 134217728/268435456 134217728/268435456
+rgb_to_lms_matrix=7222/16384 8771/16384 390/16384 2654/16384 12430/16384 1300/16384 0/16384 422/16384 15962/16384
+signal_eotf=65535
+signal_eotf_param0=0
+signal_eotf_param1=0
+signal_eotf_param2=0
+signal_bit_depth=12
+signal_color_space=0
+signal_chroma_format=0
+signal_full_range_flag=1
+source_min_pq=7
+source_max_pq=3079
+source_diagonal=42
+[/SIDE_DATA]
+[/FRAME]
+[FRAME]
+[SIDE_DATA]
+side_data_type=Mastering display metadata
+red_x=34000/50000
+red_y=16000/50000
+green_x=13250/50000
+green_y=34500/50000
+blue_x=7500/50000
+blue_y=3000/50000
+white_point_x=15635/50000
+white_point_y=16450/50000
+min_luminance=1/10000
+max_luminance=100000000/10000
+[/SIDE_DATA]
+[SIDE_DATA]
+side_data_type=Content light level metadata
+max_content=1000
+max_average=400
+[/SIDE_DATA]
+[SIDE_DATA]
+side_data_type=Dolby Vision RPU Data
+[/SIDE_DATA]
+[SIDE_DATA]
+side_data_type=Dolby Vision Metadata
+rpu_type=2
+rpu_format=18
+vdr_rpu_profile=1
+vdr_rpu_level=0
+chroma_resampling_explicit_filter_flag=0
+coef_data_type=0
+coef_log2_denom=23
+vdr_rpu_normalized_idc=1
+bl_video_full_range_flag=0
+bl_bit_depth=10
+el_bit_depth=10
+vdr_bit_depth=12
+spatial_resampling_filter_flag=0
+el_spatial_resampling_filter_flag=1
+disable_residual_flag=0
+vdr_rpu_id=0
+mapping_color_space=0
+mapping_chroma_format_idc=0
+nlq_method_idc=0
+nlq_method_idc_name=linear_dz
+nlq_pivots=0 1023
+num_x_partitions=1
+num_y_partitions=1
+[COMPONENT]
+pivots=0 128 256 384 512 640 768 896 1023
+[SECTION]
+mapping_idc=0
+mapping_idc_name=polynomial
+poly_order=1
+poly_coef=0 8388608
+[/SECTION]
+[SECTION]
+mapping_idc=0
+mapping_idc_name=polynomial
+poly_order=1
+poly_coef=0 8388608
+[/SECTION]
+[SECTION]
+mapping_idc=0
+mapping_idc_name=polynomial
+poly_order=1
+poly_coef=0 8388608
+[/SECTION]
+[SECTION]
+mapping_idc=0
+mapping_idc_name=polynomial
+poly_order=1
+poly_coef=0 8388608
+[/SECTION]
+[SECTION]
+mapping_idc=0
+mapping_idc_name=polynomial
+poly_order=1
+poly_coef=0 8388608
+[/SECTION]
+[SECTION]
+mapping_idc=0
+mapping_idc_name=polynomial
+poly_order=1
+poly_coef=0 8388608
+[/SECTION]
+[SECTION]
+mapping_idc=0
+mapping_idc_name=polynomial
+poly_order=1
+poly_coef=0 8388608
+[/SECTION]
+[SECTION]
+mapping_idc=0
+mapping_idc_name=polynomial
+poly_order=1
+poly_coef=0 8388608
+[/SECTION]
+nlq_offset=512
+vdr_in_max=1048576
+linear_deadzone_slope=2048
+linear_deadzone_threshold=0
+[/COMPONENT]
+[COMPONENT]
+pivots=0 1023
+[SECTION]
+mapping_idc=1
+mapping_idc_name=mmr
+mmr_order=3
+mmr_constant=448998
+mmr_coef=-1262056 8122466 -1703266 1622123 808554 -829469 -13459 801251 694657 3697830 -1819391 -772917 -654425 78034 -181321 -324811 -2213356 -716030 761880 365184 2545494
+[/SECTION]
+nlq_offset=512
+vdr_in_max=1048576
+linear_deadzone_slope=2048
+linear_deadzone_threshold=0
+[/COMPONENT]
+[COMPONENT]
+pivots=0 1023
+[SECTION]
+mapping_idc=1
+mapping_idc_name=mmr
+mmr_order=3
+mmr_constant=30364
+mmr_coef=-1369971 645159 9055254 -106426 2546351 -2246880 672220 1356576 1789054 -3311517 -1372035 -4554569 -548063 722319 57239 -2130348 3956345 1480062 -1696575 3919674 3414157
+[/SECTION]
+nlq_offset=512
+vdr_in_max=1048576
+linear_deadzone_slope=2048
+linear_deadzone_threshold=0
+[/COMPONENT]
+dm_metadata_id=0
+scene_refresh_flag=0
+ycc_to_rgb_matrix=9574/8192 0/8192 13802/8192 9574/8192 -1540/8192 -5348/8192 9574/8192 17610/8192 0/8192
+ycc_to_rgb_offset=16777216/268435456 134217728/268435456 134217728/268435456
+rgb_to_lms_matrix=7222/16384 8771/16384 390/16384 2654/16384 12430/16384 1300/16384 0/16384 422/16384 15962/16384
+signal_eotf=65535
+signal_eotf_param0=0
+signal_eotf_param1=0
+signal_eotf_param2=0
+signal_bit_depth=12
+signal_color_space=0
+signal_chroma_format=0
+signal_full_range_flag=1
+source_min_pq=7
+source_max_pq=3079
+source_diagonal=42
+[/SIDE_DATA]
+[/FRAME]
-- 
2.36.1

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

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [FFmpeg-devel] [PATCH v2 1/2] libavutil/dovi_meta: Add nlq_pivots to AVDOVIDataMapping
  2022-06-17 19:34 ` [FFmpeg-devel] [PATCH v2 1/2] libavutil/dovi_meta: Add nlq_pivots " quietvoid
@ 2022-06-17 20:19   ` Andreas Rheinhardt
  2022-06-17 20:37     ` quietvoid
  0 siblings, 1 reply; 5+ messages in thread
From: Andreas Rheinhardt @ 2022-06-17 20:19 UTC (permalink / raw)
  To: ffmpeg-devel

quietvoid:
> The NLQ pivots are not documented but should be present
> in the header for profile 7 RPU format.
> It has been verified using Dolby's verification toolkit.
> 
> Also implemented the parsing in libavcodec/dovi_rpu.c.
> And added the info to ffprobe and showinfo.
> 
> Signed-off-by: quietvoid <tcChlisop0@gmail.com>
> ---
>  fftools/ffprobe.c         | 4 ++++
>  libavcodec/dovi_rpu.c     | 7 +++++++
>  libavfilter/vf_showinfo.c | 8 ++++++++
>  libavutil/dovi_meta.h     | 1 +
>  4 files changed, 20 insertions(+)
> 
> diff --git a/fftools/ffprobe.c b/fftools/ffprobe.c
> index 4e2fdbaec8..bc4f7ec0a1 100644
> --- a/fftools/ffprobe.c
> +++ b/fftools/ffprobe.c
> @@ -2001,6 +2001,10 @@ static void print_dovi_metadata(WriterContext *w, const AVDOVIMetadata *dovi)
>              break;
>          }
>  
> +        if (mapping->nlq_method_idc != AV_DOVI_NLQ_NONE) {
> +            print_list_fmt("nlq_pivots", "%"PRIu16, 2, mapping->nlq_pivots[idx]);
> +        }
> +
>          print_int("num_x_partitions",          mapping->num_x_partitions);
>          print_int("num_y_partitions",          mapping->num_y_partitions);
>  
> diff --git a/libavcodec/dovi_rpu.c b/libavcodec/dovi_rpu.c
> index a87562c8a3..17837eb845 100644
> --- a/libavcodec/dovi_rpu.c
> +++ b/libavcodec/dovi_rpu.c
> @@ -315,7 +315,14 @@ int ff_dovi_rpu_parse(DOVIContext *s, const uint8_t *rpu, size_t rpu_size)
>          }
>  
>          if (use_nlq) {
> +            int nlq_pivot = 0;
>              vdr->mapping.nlq_method_idc = get_bits(gb, 3);
> +
> +            for (int i = 0; i < 2; i++) {
> +                nlq_pivot += get_bits(gb, hdr->bl_bit_depth);
> +                vdr->mapping.nlq_pivots[i] = av_clip_uint16(nlq_pivot);
> +            }
> +
>              /**
>               * The patent mentions another legal value, NLQ_MU_LAW, but it's
>               * not documented anywhere how to parse or apply that type of NLQ.
> diff --git a/libavfilter/vf_showinfo.c b/libavfilter/vf_showinfo.c
> index 6efcafce28..f8c04fb2fa 100644
> --- a/libavfilter/vf_showinfo.c
> +++ b/libavfilter/vf_showinfo.c
> @@ -535,6 +535,14 @@ static void dump_dovi_metadata(AVFilterContext *ctx, const AVFrameSideData *sd)
>      av_log(ctx, AV_LOG_INFO, "mapping_color_space=%"PRIu8"; ", mapping->mapping_color_space);
>      av_log(ctx, AV_LOG_INFO, "mapping_chroma_format_idc=%"PRIu8"; ", mapping->mapping_chroma_format_idc);
>      av_log(ctx, AV_LOG_INFO, "nlq_method_idc=%d; ", (int) mapping->nlq_method_idc);
> +
> +    if (mapping->nlq_method_idc != AV_DOVI_NLQ_NONE) {
> +        av_log(ctx, AV_LOG_INFO, "nlq_pivots={ ");
> +        for (int i = 0; i < 2; i++)
> +            av_log(ctx, AV_LOG_INFO, "%"PRIu16" ", mapping->nlq_pivots[i]);
> +        av_log(ctx, AV_LOG_INFO, "}; ");

Don't use four calls to av_log for something that is so simple. Besides
having higher overhead and binary size it also adds the risk that these
av_logs are disturbed by another av_log in the middle, breaking the
output (at least with the default log callback).
(The same btw applies to other av_logs in this very function. Is it
actually intended for this to be one big line?)

> +    }
> +
>      av_log(ctx, AV_LOG_INFO, "num_x_partitions=%"PRIu32"; ", mapping->num_x_partitions);
>      av_log(ctx, AV_LOG_INFO, "num_y_partitions=%"PRIu32"\n", mapping->num_y_partitions);
>  
> diff --git a/libavutil/dovi_meta.h b/libavutil/dovi_meta.h
> index 3d11e02bff..6afc7b055a 100644
> --- a/libavutil/dovi_meta.h
> +++ b/libavutil/dovi_meta.h
> @@ -147,6 +147,7 @@ typedef struct AVDOVIDataMapping {
>      uint32_t num_x_partitions;
>      uint32_t num_y_partitions;
>      AVDOVINLQParams nlq[3]; /* per component */
> +    uint16_t nlq_pivots[2]; /* nlq_pred_pivot_value */
>  } AVDOVIDataMapping;
>  
>  /**

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

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [FFmpeg-devel] [PATCH v2 1/2] libavutil/dovi_meta: Add nlq_pivots to AVDOVIDataMapping
  2022-06-17 20:19   ` Andreas Rheinhardt
@ 2022-06-17 20:37     ` quietvoid
  0 siblings, 0 replies; 5+ messages in thread
From: quietvoid @ 2022-06-17 20:37 UTC (permalink / raw)
  To: FFmpeg development discussions and patches

On Fri, Jun 17, 2022 at 4:20 PM Andreas Rheinhardt
<andreas.rheinhardt@outlook.com> wrote:
>
> quietvoid:
> > The NLQ pivots are not documented but should be present
> > in the header for profile 7 RPU format.
> > It has been verified using Dolby's verification toolkit.
> >
> > Also implemented the parsing in libavcodec/dovi_rpu.c.
> > And added the info to ffprobe and showinfo.
> >
> > Signed-off-by: quietvoid <tcChlisop0@gmail.com>
> > ---
> >  fftools/ffprobe.c         | 4 ++++
> >  libavcodec/dovi_rpu.c     | 7 +++++++
> >  libavfilter/vf_showinfo.c | 8 ++++++++
> >  libavutil/dovi_meta.h     | 1 +
> >  4 files changed, 20 insertions(+)
> >
> > diff --git a/fftools/ffprobe.c b/fftools/ffprobe.c
> > index 4e2fdbaec8..bc4f7ec0a1 100644
> > --- a/fftools/ffprobe.c
> > +++ b/fftools/ffprobe.c
> > @@ -2001,6 +2001,10 @@ static void print_dovi_metadata(WriterContext *w, const AVDOVIMetadata *dovi)
> >              break;
> >          }
> >
> > +        if (mapping->nlq_method_idc != AV_DOVI_NLQ_NONE) {
> > +            print_list_fmt("nlq_pivots", "%"PRIu16, 2, mapping->nlq_pivots[idx]);
> > +        }
> > +
> >          print_int("num_x_partitions",          mapping->num_x_partitions);
> >          print_int("num_y_partitions",          mapping->num_y_partitions);
> >
> > diff --git a/libavcodec/dovi_rpu.c b/libavcodec/dovi_rpu.c
> > index a87562c8a3..17837eb845 100644
> > --- a/libavcodec/dovi_rpu.c
> > +++ b/libavcodec/dovi_rpu.c
> > @@ -315,7 +315,14 @@ int ff_dovi_rpu_parse(DOVIContext *s, const uint8_t *rpu, size_t rpu_size)
> >          }
> >
> >          if (use_nlq) {
> > +            int nlq_pivot = 0;
> >              vdr->mapping.nlq_method_idc = get_bits(gb, 3);
> > +
> > +            for (int i = 0; i < 2; i++) {
> > +                nlq_pivot += get_bits(gb, hdr->bl_bit_depth);
> > +                vdr->mapping.nlq_pivots[i] = av_clip_uint16(nlq_pivot);
> > +            }
> > +
> >              /**
> >               * The patent mentions another legal value, NLQ_MU_LAW, but it's
> >               * not documented anywhere how to parse or apply that type of NLQ.
> > diff --git a/libavfilter/vf_showinfo.c b/libavfilter/vf_showinfo.c
> > index 6efcafce28..f8c04fb2fa 100644
> > --- a/libavfilter/vf_showinfo.c
> > +++ b/libavfilter/vf_showinfo.c
> > @@ -535,6 +535,14 @@ static void dump_dovi_metadata(AVFilterContext *ctx, const AVFrameSideData *sd)
> >      av_log(ctx, AV_LOG_INFO, "mapping_color_space=%"PRIu8"; ", mapping->mapping_color_space);
> >      av_log(ctx, AV_LOG_INFO, "mapping_chroma_format_idc=%"PRIu8"; ", mapping->mapping_chroma_format_idc);
> >      av_log(ctx, AV_LOG_INFO, "nlq_method_idc=%d; ", (int) mapping->nlq_method_idc);
> > +
> > +    if (mapping->nlq_method_idc != AV_DOVI_NLQ_NONE) {
> > +        av_log(ctx, AV_LOG_INFO, "nlq_pivots={ ");
> > +        for (int i = 0; i < 2; i++)
> > +            av_log(ctx, AV_LOG_INFO, "%"PRIu16" ", mapping->nlq_pivots[i]);
> > +        av_log(ctx, AV_LOG_INFO, "}; ");
>
> Don't use four calls to av_log for something that is so simple. Besides
> having higher overhead and binary size it also adds the risk that these
> av_logs are disturbed by another av_log in the middle, breaking the
> output (at least with the default log callback).

Fixed in v3.
I've made it into a single log call:
https://ffmpeg.org/pipermail/ffmpeg-devel/2022-June/297733.html

> (The same btw applies to other av_logs in this very function. Is it
> actually intended for this to be one big line?)

I'm not exactly sure how the showinfo filters usually look like.
I'm only basing this on the existing logging for this part.

>
> > +    }
> > +
> >      av_log(ctx, AV_LOG_INFO, "num_x_partitions=%"PRIu32"; ", mapping->num_x_partitions);
> >      av_log(ctx, AV_LOG_INFO, "num_y_partitions=%"PRIu32"\n", mapping->num_y_partitions);
> >
> > diff --git a/libavutil/dovi_meta.h b/libavutil/dovi_meta.h
> > index 3d11e02bff..6afc7b055a 100644
> > --- a/libavutil/dovi_meta.h
> > +++ b/libavutil/dovi_meta.h
> > @@ -147,6 +147,7 @@ typedef struct AVDOVIDataMapping {
> >      uint32_t num_x_partitions;
> >      uint32_t num_y_partitions;
> >      AVDOVINLQParams nlq[3]; /* per component */
> > +    uint16_t nlq_pivots[2]; /* nlq_pred_pivot_value */
> >  } AVDOVIDataMapping;
> >
> >  /**
>
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> To unsubscribe, visit link above, or email
> ffmpeg-devel-request@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-request@ffmpeg.org with subject "unsubscribe".

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2022-06-17 20:37 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-17 19:34 [FFmpeg-devel] [PATCH v2 0/2] DOVI: Add NLQ pivots to AVDOVIDataMapping quietvoid
2022-06-17 19:34 ` [FFmpeg-devel] [PATCH v2 1/2] libavutil/dovi_meta: Add nlq_pivots " quietvoid
2022-06-17 20:19   ` Andreas Rheinhardt
2022-06-17 20:37     ` quietvoid
2022-06-17 19:34 ` [FFmpeg-devel] [PATCH v2 2/2] fate: Add test to parse profile 7 DOVI RPU quietvoid

Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
		ffmpegdev@gitmailbox.com
	public-inbox-index ffmpegdev

Example config snippet for mirrors.


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git