Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
From: Niklas Haas <ffmpeg@haasn.xyz>
To: ffmpeg-devel@ffmpeg.org
Cc: Niklas Haas <git@haasn.dev>
Subject: [FFmpeg-devel] [PATCH v2 3/3] avcodec/av1dec: parse DV profile 10 T.35 OBU
Date: Sun, 10 Mar 2024 15:01:13 +0100
Message-ID: <20240310140112.41366-4-ffmpeg@haasn.xyz> (raw)
In-Reply-To: <20240310140112.41366-2-ffmpeg@haasn.xyz>

From: Niklas Haas <git@haasn.dev>

See previous commit.
---
 libavcodec/av1dec.c | 25 +++++++++++++++++++++++++
 libavcodec/av1dec.h |  2 ++
 2 files changed, 27 insertions(+)

diff --git a/libavcodec/av1dec.c b/libavcodec/av1dec.c
index bbb5634773f..e6346b51dbe 100644
--- a/libavcodec/av1dec.c
+++ b/libavcodec/av1dec.c
@@ -734,6 +734,7 @@ static av_cold int av1_decode_free(AVCodecContext *avctx)
 
     ff_cbs_fragment_free(&s->current_obu);
     ff_cbs_close(&s->cbc);
+    ff_dovi_ctx_unref(&s->dovi);
 
     return 0;
 }
@@ -828,6 +829,7 @@ static av_cold int av1_decode_init(AVCodecContext *avctx)
 {
     AV1DecContext *s = avctx->priv_data;
     AV1RawSequenceHeader *seq;
+    const AVPacketSideData *sd;
     int ret;
 
     s->avctx = avctx;
@@ -883,6 +885,12 @@ static av_cold int av1_decode_init(AVCodecContext *avctx)
         ff_cbs_fragment_reset(&s->current_obu);
     }
 
+    s->dovi.logctx = avctx;
+    s->dovi.dv_profile = 10; // default for AV1
+    sd = ff_get_coded_side_data(avctx, AV_PKT_DATA_DOVI_CONF);
+    if (sd && sd->size > 0)
+        ff_dovi_update_cfg(&s->dovi, (AVDOVIDecoderConfigurationRecord *) sd->data);
+
     return ret;
 }
 
@@ -936,6 +944,7 @@ static int export_itut_t35(AVCodecContext *avctx, AVFrame *frame,
                            const AV1RawMetadataITUTT35 *itut_t35)
 {
     GetByteContext gb;
+    AV1DecContext *s = avctx->priv_data;
     int ret, provider_code;
 
     bytestream2_init(&gb, itut_t35->payload, itut_t35->payload_size);
@@ -985,6 +994,22 @@ static int export_itut_t35(AVCodecContext *avctx, AVFrame *frame,
             return ret;
         break;
     }
+    case 0x3B: { // dolby_provider_code
+        int provider_oriented_code = bytestream2_get_be32(&gb);
+        if (itut_t35->itu_t_t35_country_code != 0xB5 || provider_oriented_code != 0x800)
+            break;
+
+        ret = ff_dovi_rpu_parse(&s->dovi, gb.buffer, gb.buffer_end - gb.buffer);
+        if (ret < 0) {
+            av_log(avctx, AV_LOG_WARNING, "Error parsing DOVI OBU.\n");
+            break; // ignore
+        }
+
+        ret = ff_dovi_attach_side_data(&s->dovi, frame);
+        if (ret < 0)
+            return ret;
+        break;
+    }
     default: // ignore unsupported provider codes
         break;
     }
diff --git a/libavcodec/av1dec.h b/libavcodec/av1dec.h
index a6ad80c12ab..336eb613597 100644
--- a/libavcodec/av1dec.h
+++ b/libavcodec/av1dec.h
@@ -31,6 +31,7 @@
 #include "packet.h"
 #include "cbs.h"
 #include "cbs_av1.h"
+#include "dovi_rpu.h"
 
 typedef struct AV1Frame {
     AVFrame *f;
@@ -81,6 +82,7 @@ typedef struct AV1DecContext {
     AV1RawMetadataHDRCLL *cll;
     AV1RawOBU *mdcv_ref;   ///< RefStruct reference backing mdcv
     AV1RawMetadataHDRMDCV *mdcv;
+    DOVIContext dovi;
     AVFifo *itut_t35_fifo;
 
     uint16_t tile_num;
-- 
2.44.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".

      parent reply	other threads:[~2024-03-10 14:02 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-10 14:01 [FFmpeg-devel] [PATCH v2 1/3] avcodec/dovi_rpu: implement support for profile 10 Niklas Haas
2024-03-10 14:01 ` [FFmpeg-devel] [PATCH v2 2/3] avcodec/libdav1d: parse DV profile 10 T.35 OBU Niklas Haas
2024-03-10 14:01 ` Niklas Haas [this message]

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=20240310140112.41366-4-ffmpeg@haasn.xyz \
    --to=ffmpeg@haasn.xyz \
    --cc=ffmpeg-devel@ffmpeg.org \
    --cc=git@haasn.dev \
    /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