Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
From: James Almer <jamrial@gmail.com>
To: ffmpeg-devel@ffmpeg.org
Subject: [FFmpeg-devel] [PATCH 2/4] avcodec/cbs_h266: add support for Decoding capability information NALU type
Date: Sun,  2 Jul 2023 20:26:20 -0300
Message-ID: <20230702232622.6870-2-jamrial@gmail.com> (raw)
In-Reply-To: <20230702232622.6870-1-jamrial@gmail.com>

Signed-off-by: James Almer <jamrial@gmail.com>
---
 libavcodec/cbs_h2645.c                | 18 ++++++++++++++++++
 libavcodec/cbs_h266.h                 | 10 ++++++++++
 libavcodec/cbs_h266_syntax_template.c | 24 ++++++++++++++++++++++++
 libavcodec/vvc.h                      |  3 +++
 4 files changed, 55 insertions(+)

diff --git a/libavcodec/cbs_h2645.c b/libavcodec/cbs_h2645.c
index 8dc9ae471d..95da597427 100644
--- a/libavcodec/cbs_h2645.c
+++ b/libavcodec/cbs_h2645.c
@@ -1059,6 +1059,14 @@ static int cbs_h266_read_nal_unit(CodedBitstreamContext *ctx,
         return err;
 
     switch (unit->type) {
+    case VVC_DCI_NUT:
+        {
+            err = cbs_h266_read_dci(ctx, &gbc, unit->content);
+
+            if (err < 0)
+                return err;
+        }
+        break;
     case VVC_OPI_NUT:
         {
             err = cbs_h266_read_opi(ctx, &gbc, unit->content);
@@ -1601,6 +1609,15 @@ static int cbs_h266_write_nal_unit(CodedBitstreamContext *ctx,
     int err;
 
     switch (unit->type) {
+    case VVC_DCI_NUT:
+        {
+            H266RawDCI *dci = unit->content;
+
+            err = cbs_h266_write_dci(ctx, pbc, dci);
+            if (err < 0)
+                return err;
+        }
+        break;
     case VVC_OPI_NUT:
         {
             H266RawOPI *opi = unit->content;
@@ -1982,6 +1999,7 @@ static void cbs_h266_free_sei(void *opaque, uint8_t *content)
 }
 
 static const CodedBitstreamUnitTypeDescriptor cbs_h266_unit_types[] = {
+    CBS_UNIT_TYPE_INTERNAL_REF(VVC_DCI_NUT, H266RawDCI, extension_data.data),
     CBS_UNIT_TYPE_INTERNAL_REF(VVC_OPI_NUT, H266RawOPI, extension_data.data),
     CBS_UNIT_TYPE_INTERNAL_REF(VVC_VPS_NUT, H266RawVPS, extension_data.data),
     CBS_UNIT_TYPE_INTERNAL_REF(VVC_SPS_NUT, H266RawSPS, extension_data.data),
diff --git a/libavcodec/cbs_h266.h b/libavcodec/cbs_h266.h
index 693d1ca1fd..87aa2d849d 100644
--- a/libavcodec/cbs_h266.h
+++ b/libavcodec/cbs_h266.h
@@ -241,6 +241,16 @@ typedef struct H266RawOPI {
     H266RawExtensionData extension_data;
 } H266RawOPI;
 
+typedef struct H266RawDCI {
+    H266RawNALUnitHeader nal_unit_header;
+
+    uint8_t dci_reserved_zero_4bits;
+    uint8_t dci_num_ptls_minus1;
+    H266RawProfileTierLevel dci_profile_tier_level[VVC_MAX_DCI_PTLS];
+    uint8_t dci_extension_flag;
+    H266RawExtensionData extension_data;
+} H266RawDCI;
+
 typedef struct H266RawVPS {
     H266RawNALUnitHeader nal_unit_header;
 
diff --git a/libavcodec/cbs_h266_syntax_template.c b/libavcodec/cbs_h266_syntax_template.c
index d9c8e0afbe..4ea29ec789 100644
--- a/libavcodec/cbs_h266_syntax_template.c
+++ b/libavcodec/cbs_h266_syntax_template.c
@@ -650,6 +650,30 @@ static int FUNC(opi)(CodedBitstreamContext *ctx, RWContext *rw,
     return 0;
 }
 
+static int FUNC(dci)(CodedBitstreamContext *ctx, RWContext *rw,
+                     H266RawDCI *current)
+{
+    int err, i;
+
+    HEADER("Decoding capability information");
+
+    CHECK(FUNC(nal_unit_header)(ctx, rw,
+                                &current->nal_unit_header, VVC_DCI_NUT));
+
+    ub(4, dci_reserved_zero_4bits);
+    ub(4, dci_num_ptls_minus1);
+    for (i = 0; i <= current->dci_num_ptls_minus1; i++)
+        CHECK(FUNC(profile_tier_level)(ctx, rw,
+                                       current->dci_profile_tier_level + i, 1, 0));
+
+    flag(dci_extension_flag);
+    if (current->dci_extension_flag)
+        CHECK(FUNC(extension_data)(ctx, rw, &current->extension_data));
+    CHECK(FUNC(rbsp_trailing_bits)(ctx, rw));
+
+    return 0;
+}
+
 static int FUNC(vps) (CodedBitstreamContext *ctx, RWContext *rw,
                      H266RawVPS *current)
 {
diff --git a/libavcodec/vvc.h b/libavcodec/vvc.h
index 099d2fc2ad..eda1b40eef 100644
--- a/libavcodec/vvc.h
+++ b/libavcodec/vvc.h
@@ -76,6 +76,9 @@ enum {
     //7.4.3.3 The value of vps_max_sublayers_minus1 shall be in the range of 0 to 6, inclusive
     VVC_MAX_SUBLAYERS = 7,
 
+    //7.3.2.1 dci_num_ptls_minus1 is u(4)
+    VVC_MAX_DCI_PTLS = 16,
+
     //7.4.3.3 vps_num_ptls_minus1 is u(8)
     VVC_MAX_PTLS = 256,
 
-- 
2.41.0

_______________________________________________
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:[~2023-07-02 23:28 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-02 23:26 [FFmpeg-devel] [PATCH 1/4] avcodec/cbs_h266: add support for Operating point " James Almer
2023-07-02 23:26 ` James Almer [this message]
2023-07-03 15:11   ` [FFmpeg-devel] [PATCH 2/4] avcodec/cbs_h266: add support for Decoding capability " Nuo Mi
2023-07-02 23:26 ` [FFmpeg-devel] [PATCH 3/4] avcodec/cbs_h266: add support for Adaptation parameter set " James Almer
2023-07-05 14:29   ` Nuo Mi
2023-07-05 18:11     ` [FFmpeg-devel] [PATCH v2 " James Almer
2023-07-05 18:33     ` [FFmpeg-devel] [PATCH v3] " James Almer
2023-07-05 18:36     ` [FFmpeg-devel] [PATCH v4] " James Almer
2023-07-06  0:41       ` Nuo Mi
2023-07-06  1:03         ` James Almer
2023-07-06 14:00           ` Nuo Mi
2023-07-02 23:26 ` [FFmpeg-devel] [PATCH 4/4] fate/cbs: add more VVC tests James Almer
2023-07-05 14:32 ` [FFmpeg-devel] [PATCH 1/4] avcodec/cbs_h266: add support for Operating point information NALU type Nuo Mi

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=20230702232622.6870-2-jamrial@gmail.com \
    --to=jamrial@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