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: Re: [FFmpeg-devel] [PATCH 1/4] avcodec/dovi_rpuenc: Avoid intermediate codec par in ff_dovi_configure()
Date: Fri, 30 May 2025 14:57:35 -0300
Message-ID: <7730ef92-7bcb-4f0e-b316-dc390c90470e@gmail.com> (raw)
In-Reply-To: <GV1P250MB073785A131FD60C38028DB798F61A@GV1P250MB0737.EURP250.PROD.OUTLOOK.COM>


[-- Attachment #1.1.1: Type: text/plain, Size: 1664 bytes --]

On 5/30/2025 1:44 PM, Andreas Rheinhardt wrote:
> Patches attached.
> 
> - Andreas

For #11617, something simpler like the following should be enough

> diff --git a/libavcodec/dovi_rpuenc.c b/libavcodec/dovi_rpuenc.c
> index 2e1f8be08e..bbc66fe2e8 100644
> --- a/libavcodec/dovi_rpuenc.c
> +++ b/libavcodec/dovi_rpuenc.c
> @@ -242,6 +242,7 @@ int ff_dovi_configure(DOVIContext *s, AVCodecContext *avctx)
>  {
>      int ret;
>      const AVFrameSideData *sd;
> +    const AVPacketSideData *packet_sd;
>      const AVDOVIMetadata *metadata = NULL;
>      AVCodecParameters *codecpar = avcodec_parameters_alloc();
>      if (!codecpar)
> @@ -263,7 +264,20 @@ int ff_dovi_configure(DOVIContext *s, AVCodecContext *avctx)
>      if (ret < 0)
>          goto fail;
> 
> -    ret = avcodec_parameters_to_context(avctx, codecpar);
> +    packet_sd = av_packet_side_data_get(codecpar->coded_side_data,
> +                                        codecpar->nb_coded_side_data,
> +                                        AV_PKT_DATA_DOVI_CONF);
> +    if (packet_sd) {
> +        AVPacketSideData *dovi = av_packet_side_data_new(&avctx->coded_side_data,
> +                                                         &avctx->nb_coded_side_data,
> +                                                         AV_PKT_DATA_DOVI_CONF,
> +                                                         packet_sd->size, 0);
> +        if (!dovi) {
> +            ret = AVERROR(ENOMEM);
> +            goto fail;
> +        }
> +        memcpy(dovi->data, packet_sd->data, dovi->size);
> +    }
> 
>  fail:
>      avcodec_parameters_free(&codecpar);


[-- Attachment #1.2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 495 bytes --]

[-- Attachment #2: Type: text/plain, Size: 251 bytes --]

_______________________________________________
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:[~2025-05-30 17:57 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-05-30 16:44 Andreas Rheinhardt
2025-05-30 17:29 ` Niklas Haas
2025-05-30 17:57 ` James Almer [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=7730ef92-7bcb-4f0e-b316-dc390c90470e@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