From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ffbox0-bg.ffmpeg.org (ffbox0-bg.ffmpeg.org [79.124.17.100]) by master.gitmailbox.com (Postfix) with ESMTPS id 4A2C84D930 for ; Mon, 2 Jun 2025 18:39:40 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.ffmpeg.org (Postfix) with ESMTP id 3C55B68DEEC; Mon, 2 Jun 2025 21:39:37 +0300 (EEST) Received: from relay2-d.mail.gandi.net (relay2-d.mail.gandi.net [217.70.183.194]) by ffbox0-bg.ffmpeg.org (Postfix) with ESMTPS id 980CC68DEB0 for ; Mon, 2 Jun 2025 21:39:29 +0300 (EEST) Received: by mail.gandi.net (Postfix) with ESMTPSA id EC26743849 for ; Mon, 2 Jun 2025 18:39:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=niedermayer.cc; s=gm1; t=1748889569; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=LX3SKoqimDL9qV48WHnt23EgjtlmAfi8AIFalFeZCDA=; b=ofYyd+dVF40hzYc8w6DIgpjDPglkETIYa0OzyFaQC0NX13s3PaO9MWUq/1GhPkuk0OKVSl GBfPtb/FRx5ZhzCamIqvD1BLWSEXpD7mMilW7UZ1uJ0s/etuDKKuMeu3TZE8T0+Rbo7xFS T78HJGgLBzUcPshmSxRjxnCaRpTVUEGqNP9KIZz4CUzqMNrjEIdZ/ed8Jc7IjbsO3kbRcP KvPjUFf99LT0cDaDctmDFTY7attzynQhNBRCwCRLqQSElYCJj2FcHJr3y/+uyTGIAgFmoL NrANJONFcLPgCUsV8SdnwJAYF5qr2C3vdBwjKkGMXWy0OduBQRIPXhGg8bwSaA== Date: Mon, 2 Jun 2025 20:39:27 +0200 From: Michael Niedermayer To: FFmpeg development discussions and patches Message-ID: <20250602183927.GE29660@pb2> References: <90c31845-ef4f-4aa2-b87d-93800e1a469b@gmail.com> <20250530005839.GG29660@pb2> MIME-Version: 1.0 In-Reply-To: X-GND-State: clean X-GND-Score: -90 X-GND-Cause: gggruggvucftvghtrhhoucdtuddrgeeffedrtddtgdefkeegudculddtuddrgeefvddrtddtmdcutefuodetggdotefrodftvfcurfhrohhfihhlvgemucfitefpfffkpdcuggftfghnshhusghstghrihgsvgenuceurghilhhouhhtmecufedtudenucesvcftvggtihhpihgvnhhtshculddquddttddmnegfrhhlucfvnfffucdluddtmdenucfjughrpeffhffvuffkfhggtggujgesghdtreertddtvdenucfhrhhomhepofhitghhrggvlhcupfhivgguvghrmhgrhigvrhcuoehmihgthhgrvghlsehnihgvuggvrhhmrgihvghrrdgttgeqnecuggftrfgrthhtvghrnhepffeltdefveefffehueeuhfdtjeeileeufedtiedtgfehteegffeffeetkefftdfhnecuffhomhgrihhnpehffhhmphgvghdrohhrghenucfkphepgedurdeiiedrieejrdduudefnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehinhgvthepgedurdeiiedrieejrdduudefpdhhvghloheplhhotggrlhhhohhsthdpmhgrihhlfhhrohhmpehmihgthhgrvghlsehnihgvuggvrhhmrgihvghrrdgttgdpnhgspghrtghpthhtohepuddprhgtphhtthhopehffhhmphgvghdquggvvhgvlhesfhhfmhhpvghgrdhorhhg X-GND-Sasl: michael@niedermayer.cc Subject: Re: [FFmpeg-devel] [PATCH] add yuv444p support to mcdeint X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Content-Type: multipart/mixed; boundary="===============5236280471186732364==" Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: --===============5236280471186732364== Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="avvtomMgIkVznAbf" Content-Disposition: inline --avvtomMgIkVznAbf Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hi Ethan On Fri, May 30, 2025 at 12:29:19AM -0500, Ethan Halsall wrote: > On 5/29/25 7:58 PM, Michael Niedermayer wrote: > > On Tue, May 27, 2025 at 01:24:57PM -0500, Ethan Halsall wrote: > > > Signed-off-by: Ethan Halsall > > > --- > > > libavfilter/vf_mcdeint.c | 32 ++++++++++++++++++++++++++++---- > > > 1 file changed, 28 insertions(+), 4 deletions(-) > > >=20 > > > diff --git a/libavfilter/vf_mcdeint.c b/libavfilter/vf_mcdeint.c > > > index 82048b51d0..11ad19f5cd 100644 > > > --- a/libavfilter/vf_mcdeint.c > > > +++ b/libavfilter/vf_mcdeint.c > > > @@ -51,8 +51,10 @@ > > > #include "libavutil/opt.h" > > > #include "libavcodec/avcodec.h" > > > +#include "libavutil/pixdesc.h" > > > #include "avfilter.h" > > > #include "filters.h" > > > +#include "formats.h" > > > #include "video.h" > > > enum MCDeintMode { > > > @@ -76,6 +78,7 @@ typedef struct MCDeintContext { > > > AVPacket *pkt; > > > AVFrame *frame_dec; > > > AVCodecContext *enc_ctx; > > > + const AVPixFmtDescriptor *pix_fmt_desc; > > > } MCDeintContext; > > > #define OFFSET(x) offsetof(MCDeintContext, x) > > > @@ -99,6 +102,17 @@ static const AVOption mcdeint_options[] =3D { > > > AVFILTER_DEFINE_CLASS(mcdeint); > > > +static const enum AVPixelFormat pix_fmts[] =3D { > > > + AV_PIX_FMT_YUV420P, > > > + AV_PIX_FMT_YUV444P, > > > + AV_PIX_FMT_NONE > > > +}; > > > + > >=20 > > Applying: add yuv444p support to mcdeint > > error: corrupt patch at line 18 > >=20 > > this patch is somehow corrupted, that above is not a valid diff > > make sure the output of git format-patch is not modified > >=20 > > thx > >=20 > >=20 > > [...] > >=20 > >=20 > >=20 > > _______________________________________________ > > ffmpeg-devel mailing list > > ffmpeg-devel@ffmpeg.org > > https://ffmpeg.org/mailman/listinfo/ffmpeg-devel > >=20 > > To unsubscribe, visit link above, or email > > ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe". >=20 > I followed the instructions on the "Sending patches from email clients" > section of https://ffmpeg.org/developer.html#Submitting-patches-1. I think > Thunderbird removed some line breaks in the patch though when I opened the > .eml file. >=20 > Let's try this one: >=20 >=20 > Signed-off-by: Ethan Halsall > --- > libavfilter/vf_mcdeint.c | 32 ++++++++++++++++++++++++++++---- > 1 file changed, 28 insertions(+), 4 deletions(-) >=20 > diff --git a/libavfilter/vf_mcdeint.c b/libavfilter/vf_mcdeint.c > index 82048b51d0..11ad19f5cd 100644 > --- a/libavfilter/vf_mcdeint.c > +++ b/libavfilter/vf_mcdeint.c > @@ -51,8 +51,10 @@ >=20 > #include "libavutil/opt.h" > #include "libavcodec/avcodec.h" > +#include "libavutil/pixdesc.h" > #include "avfilter.h" > #include "filters.h" > +#include "formats.h" > #include "video.h" >=20 > enum MCDeintMode { > @@ -76,6 +78,7 @@ typedef struct MCDeintContext { > AVPacket *pkt; > AVFrame *frame_dec; > AVCodecContext *enc_ctx; > + const AVPixFmtDescriptor *pix_fmt_desc; > } MCDeintContext; >=20 > #define OFFSET(x) offsetof(MCDeintContext, x) > @@ -99,6 +102,17 @@ static const AVOption mcdeint_options[] =3D { >=20 > AVFILTER_DEFINE_CLASS(mcdeint); >=20 > +static const enum AVPixelFormat pix_fmts[] =3D { > + AV_PIX_FMT_YUV420P, > + AV_PIX_FMT_YUV444P, > + AV_PIX_FMT_NONE > +}; > + > +static int query_formats(AVFilterContext *ctx) > +{ > + return ff_set_common_formats(ctx, ff_make_format_list(pix_fmts)); > +} why not use FILTER_PIXFMTS ? > + > static int config_props(AVFilterLink *inlink) > { > AVFilterContext *ctx =3D inlink->dst; > @@ -122,13 +136,16 @@ static int config_props(AVFilterLink *inlink) > mcdeint->enc_ctx =3D avcodec_alloc_context3(enc); > if (!mcdeint->enc_ctx) > return AVERROR(ENOMEM); > + mcdeint->pix_fmt_desc =3D av_pix_fmt_desc_get(inlink->format); > + if (!mcdeint->pix_fmt_desc) > + return AVERROR(ENOMEM); > enc_ctx =3D mcdeint->enc_ctx; > enc_ctx->width =3D inlink->w; > enc_ctx->height =3D inlink->h; > enc_ctx->time_base =3D (AVRational){1,25}; // meaningless > enc_ctx->gop_size =3D INT_MAX; > enc_ctx->max_b_frames =3D 0; > - enc_ctx->pix_fmt =3D AV_PIX_FMT_YUV420P; > + enc_ctx->pix_fmt =3D inlink->format; > enc_ctx->flags =3D AV_CODEC_FLAG_QSCALE | AV_CODEC_FLAG_LOW_DELAY | > AV_CODEC_FLAG_RECON_FRAME; > enc_ctx->strict_std_compliance =3D FF_COMPLIANCE_EXPERIMENTAL; > enc_ctx->global_quality =3D 1; > @@ -201,8 +218,14 @@ static int filter_frame(AVFilterLink *inlink, AVFrame > *inpic) >=20 > for (i =3D 0; i < 3; i++) { > int is_chroma =3D !!i; > - int w =3D AV_CEIL_RSHIFT(inlink->w, is_chroma); > - int h =3D AV_CEIL_RSHIFT(inlink->h, is_chroma); > + int w, h; > + if (is_chroma) { > + w =3D inlink->w >> mcdeint->pix_fmt_desc->log2_chroma_w; > + h =3D inlink->h >> mcdeint->pix_fmt_desc->log2_chroma_h; > + } else { > + w =3D inlink->w; > + h =3D inlink->h; > + } > int fils =3D frame_dec->linesize[i]; > int srcs =3D inpic ->linesize[i]; > int dsts =3D outpic ->linesize[i]; pix_fmt_desc could be a local variable in filter_frame() which would avoid adding it to the context thx [...] --=20 Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB Rewriting code that is poorly written but fully understood is good. Rewriting code that one doesnt understand is a sign that one is less smart than the original author, trying to rewrite it will not make it better. --avvtomMgIkVznAbf Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iF0EABEKAB0WIQSf8hKLFH72cwut8TNhHseHBAsPqwUCaD3v2wAKCRBhHseHBAsP q4bzAKCCgO8fQ2E43avq0hzoIQVuQ289DACdFEpvcflUUD45FXtZvAodTlIYVFc= =DrUo -----END PGP SIGNATURE----- --avvtomMgIkVznAbf-- --===============5236280471186732364== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ 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". --===============5236280471186732364==--