Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
From: quietvoid <tcchlisop0@gmail.com>
To: ffmpeg-devel@ffmpeg.org
Cc: quietvoid <tcChlisop0@gmail.com>
Subject: [FFmpeg-devel] [PATCH 1/2] libavutil/dovi_meta: Add nlq_pivots to AVDOVIDataMapping
Date: Sat, 11 Jun 2022 12:45:29 -0400
Message-ID: <20220611164530.157-2-tcChlisop0@gmail.com> (raw)
In-Reply-To: <20220611164530.157-1-tcChlisop0@gmail.com>

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.
---
 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 c44297c1fa..63eb9b32ae 100644
--- a/fftools/ffprobe.c
+++ b/fftools/ffprobe.c
@@ -1934,6 +1934,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 12d39310ef..2148d202b1 100644
--- a/libavfilter/vf_showinfo.c
+++ b/libavfilter/vf_showinfo.c
@@ -543,6 +543,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..c7c5ba721f 100644
--- a/libavutil/dovi_meta.h
+++ b/libavutil/dovi_meta.h
@@ -144,6 +144,7 @@ typedef struct AVDOVIDataMapping {
 
     /* Non-linear inverse quantization */
     enum AVDOVINLQMethod nlq_method_idc;
+    uint16_t nlq_pivots[2]; /* nlq_pred_pivot_value */
     uint32_t num_x_partitions;
     uint32_t num_y_partitions;
     AVDOVINLQParams nlq[3]; /* per component */
-- 
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".

  reply	other threads:[~2022-06-11 16:45 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-11 16:45 [FFmpeg-devel] [PATCH 0/2] DOVI: Add NLQ pivots " quietvoid
2022-06-11 16:45 ` quietvoid [this message]
2022-06-11 16:48   ` [FFmpeg-devel] [PATCH 1/2] libavutil/dovi_meta: Add nlq_pivots " Andreas Rheinhardt
2022-06-17 19:35     ` quietvoid
2022-06-11 16:45 ` [FFmpeg-devel] [PATCH 2/2] fate: Add test to parse profile 7 DOVI RPU quietvoid

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220611164530.157-2-tcChlisop0@gmail.com \
    --to=tcchlisop0@gmail.com \
    --cc=ffmpeg-devel@ffmpeg.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

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