From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by master.gitmailbox.com (Postfix) with ESMTP id B5CAF404DD for ; Fri, 24 Mar 2023 00:09:08 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id AC90468C2E3; Fri, 24 Mar 2023 02:09:04 +0200 (EET) Received: from relay11.mail.gandi.net (relay11.mail.gandi.net [217.70.178.231]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id A892268C2D7 for ; Fri, 24 Mar 2023 02:08:58 +0200 (EET) Received: (Authenticated sender: michael@niedermayer.cc) by mail.gandi.net (Postfix) with ESMTPSA id 87AF2100003 for ; Fri, 24 Mar 2023 00:08:57 +0000 (UTC) Date: Fri, 24 Mar 2023 01:08:56 +0100 From: Michael Niedermayer To: FFmpeg development discussions and patches Message-ID: <20230324000856.GO375355@pb2> References: <20230319194240.15001-1-michael@niedermayer.cc> <20230323095034.GL375355@pb2> MIME-Version: 1.0 In-Reply-To: Subject: Re: [FFmpeg-devel] [PATCH v2 1/3] avcodec/snowenc: AV_CODEC_CAP_ENCODER_RECON_FRAME support 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="===============8957099271411360793==" Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: --===============8957099271411360793== Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="WoqaC9TUMqqIOlla" Content-Disposition: inline --WoqaC9TUMqqIOlla Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Thu, Mar 23, 2023 at 08:32:48AM -0300, James Almer wrote: > On 3/23/2023 6:50 AM, Michael Niedermayer wrote: > > On Mon, Mar 20, 2023 at 07:07:59PM -0300, James Almer wrote: > > > On 3/19/2023 4:42 PM, Michael Niedermayer wrote: > > > > Signed-off-by: Michael Niedermayer > > > > --- > > > > libavcodec/snowenc.c | 10 +++++++++- > > > > 1 file changed, 9 insertions(+), 1 deletion(-) > > > >=20 > > > > diff --git a/libavcodec/snowenc.c b/libavcodec/snowenc.c > > > > index 658684c575..5fb5906ed8 100644 > > > > --- a/libavcodec/snowenc.c > > > > +++ b/libavcodec/snowenc.c > > > > @@ -26,6 +26,7 @@ > > > > #include "avcodec.h" > > > > #include "codec_internal.h" > > > > #include "encode.h" > > > > +#include "internal.h" //For AVCodecInternal.recon_frame > > > > #include "me_cmp.h" > > > > #include "packet_internal.h" > > > > #include "snow_dwt.h" > > > > @@ -1576,6 +1577,7 @@ static int encode_frame(AVCodecContext *avctx= , AVPacket *pkt, > > > > { > > > > SnowContext *s =3D avctx->priv_data; > > > > RangeCoder * const c=3D &s->c; > > > > + AVCodecInternal *avci =3D avctx->internal; > > > > AVFrame *pic; > > > > const int width=3D s->avctx->width; > > > > const int height=3D s->avctx->height; > > > > @@ -1877,6 +1879,10 @@ redo_frame: > > > > s->encoding_error, > > > > (s->avctx->flags&AV_CODEC_FLA= G_PSNR) ? SNOW_MAX_PLANES : 0, > > > > s->current_picture->pict_type= ); > > > > + if (s->avctx->flags & AV_CODEC_FLAG_RECON_FRAME) { > > > > + av_frame_unref(avci->recon_frame); > > > > + av_frame_ref(avci->recon_frame, s->current_picture); > > > > + } > > > > pkt->size =3D ff_rac_terminate(c, 0); > > > > if (s->current_picture->key_frame) > > > > @@ -1934,7 +1940,9 @@ const FFCodec ff_snow_encoder =3D { > > > > CODEC_LONG_NAME("Snow"), > > > > .p.type =3D AVMEDIA_TYPE_VIDEO, > > > > .p.id =3D AV_CODEC_ID_SNOW, > > > > - .p.capabilities =3D AV_CODEC_CAP_DR1 | AV_CODEC_CAP_ENCODER_RE= ORDERED_OPAQUE, > > > > + .p.capabilities =3D AV_CODEC_CAP_DR1 | > > > > + AV_CODEC_CAP_ENCODER_REORDERED_OPAQUE | > > > > + AV_CODEC_CAP_ENCODER_RECON_FRAME, > > > > .priv_data_size =3D sizeof(SnowContext), > > > > .init =3D encode_init, > > > > FF_CODEC_ENCODE_CB(encode_frame), > > >=20 > > > Testing with the tool from https://git.khirnov.net/libav.git/commit/?= h=3Drecon&id=3Dd78e17840347abfe10b2bc7e789c60665de56e1f > > > (Which i hope will be upstreamed eventually) i get > > >=20 > > > $ tools/enc_recon_frame_test input.y4m snow flags=3D+bitexact 10 > > > Checksum mismatch in frame ts=3D0, plane 0 > >=20 > > I cannot replicate this, using matrixbench and above command line i get= no > > mismatches, where can i find the input.y4m you used ? >=20 > It was https://0x0.st/sfRh.y4m >=20 > >=20 > > also would be nice if this tool would write a image showing the differe= nce > >=20 > > thx > >=20 > > >=20 > > > I don't know if this really matters for snow (is it mean to be bitexa= ct?), > > > but it seems the very first frame returned by the reconstructed frame= API is > > > not the same as the one output by the snow decoder. The rest seem to = match, > > > though. > >=20 > > This sounds rather strange, the first frame would be used as reference = for > > motion compensation so the subsequent frames matching after a mismatch = is > > "surprising" >=20 > I tried other supported encoders like libx264 and librav1e and none of th= em > report mismatches. bugs ill send a patchset thx [...] --=20 Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB Modern terrorism, a quick summary: Need oil, start war with country that has oil, kill hundread thousand in war. Let country fall into chaos, be surprised about raise of fundamantalists. Drop more bombs, kill more people, be surprised about them taking revenge and drop even more bombs and strip your own citizens of their rights and freedoms. to be continued --WoqaC9TUMqqIOlla Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iF0EABEIAB0WIQSf8hKLFH72cwut8TNhHseHBAsPqwUCZBzqFAAKCRBhHseHBAsP q5h2AJ9I7CpMhmu9HvmDaPnVbFRYDj+5WgCfWZEZEPhThmqe2oXfb70oxe1BwNI= =SWvu -----END PGP SIGNATURE----- --WoqaC9TUMqqIOlla-- --===============8957099271411360793== 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". --===============8957099271411360793==--