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 4/4] avcodec/libx265: encode dovi RPUs
Date: Tue, 19 Mar 2024 20:16:42 +0100
Message-ID: <20240319191642.95217-4-ffmpeg@haasn.xyz> (raw)
In-Reply-To: <20240319191642.95217-1-ffmpeg@haasn.xyz>

From: Niklas Haas <git@haasn.dev>

libx265 supports these natively, we just need to forward them to the
x265picture.
---
 libavcodec/libx265.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/libavcodec/libx265.c b/libavcodec/libx265.c
index 92183b9ca26..92b25844ef6 100644
--- a/libavcodec/libx265.c
+++ b/libavcodec/libx265.c
@@ -560,6 +560,7 @@ static av_cold int libx265_encode_set_roi(libx265Context *ctx, const AVFrame *fr
 static void free_picture(libx265Context *ctx, x265_picture *pic)
 {
     x265_sei *sei = &pic->userSEI;
+    av_free(pic->rpu.payload);
     for (int i = 0; i < sei->numPayloads; i++)
         av_free(sei->payloads[i].payload);
 
@@ -594,6 +595,7 @@ static int libx265_encode_frame(AVCodecContext *avctx, AVPacket *pkt,
     sei->numPayloads = 0;
 
     if (pic) {
+        AVFrameSideData *sd;
         ReorderedData *rd;
         int rd_idx;
 
@@ -694,6 +696,15 @@ static int libx265_encode_frame(AVCodecContext *avctx, AVPacket *pkt,
                 sei->numPayloads++;
             }
         }
+
+        if ((sd = av_frame_get_side_data(pic, AV_FRAME_DATA_DOVI_RPU_BUFFER))) {
+            x265pic.rpu.payload = av_memdup(sd->data, sd->size);
+            if (!x265pic.rpu.payload) {
+                free_picture(ctx, &x265pic);
+                return AVERROR(ENOMEM);
+            }
+            x265pic.rpu.payloadSize = sd->size;
+        }
     }
 
     ret = ctx->api->encoder_encode(ctx->encoder, &nal, &nnal,
-- 
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-19 19:17 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-19 19:16 [FFmpeg-devel] [PATCH 1/4] fftools/ffmpeg_enc: strip DOVI config record for AV1 Niklas Haas
2024-03-19 19:16 ` [FFmpeg-devel] [PATCH 2/4] avcodec/dovi_rpu: implement T.35 payload synthesis Niklas Haas
2024-03-19 19:16 ` [FFmpeg-devel] [PATCH 3/4] avcodec/libaomenc: encode dovi RPUs as T.35 metadata Niklas Haas
2024-03-19 19:16 ` Niklas Haas [this message]
2024-03-19 21:39   ` [FFmpeg-devel] [PATCH 4/4] avcodec/libx265: encode dovi RPUs Derek Buitenhuis
     [not found]     ` <9183F034-A7F5-4683-A932-273E15B9886C@cosmin.at>
2024-03-19 21:59       ` Cosmin Stejerean via ffmpeg-devel
2024-03-19 23:04         ` Niklas Haas
2024-03-19 23:19           ` Vittorio Giovara
2024-03-21 12:09             ` Niklas Haas
2024-03-20 19:30   ` Michael Niedermayer
2024-03-20 21:22     ` Jan Ekström
2024-03-21 12:02       ` Niklas Haas
2024-03-21 10:16 ` [FFmpeg-devel] [PATCH 1/4] fftools/ffmpeg_enc: strip DOVI config record for AV1 Anton Khirnov
2024-03-21 12:11   ` Niklas Haas
2024-03-22  9:41     ` Anton Khirnov
2024-03-22 13:08       ` Niklas Haas
2024-03-22 17:04         ` Niklas Haas
2024-03-23 17:45 ` Niklas Haas

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=20240319191642.95217-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