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 8454B45321 for ; Thu, 23 Mar 2023 09:50:46 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id DC22868C252; Thu, 23 Mar 2023 11:50:42 +0200 (EET) Received: from relay1-d.mail.gandi.net (relay1-d.mail.gandi.net [217.70.183.193]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 7635A68C0DD for ; Thu, 23 Mar 2023 11:50:36 +0200 (EET) Received: (Authenticated sender: michael@niedermayer.cc) by mail.gandi.net (Postfix) with ESMTPSA id 96777240002 for ; Thu, 23 Mar 2023 09:50:35 +0000 (UTC) Date: Thu, 23 Mar 2023 10:50:34 +0100 From: Michael Niedermayer To: FFmpeg development discussions and patches Message-ID: <20230323095034.GL375355@pb2> References: <20230319194240.15001-1-michael@niedermayer.cc> 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="===============2294532384445913561==" Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: --===============2294532384445913561== Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="HLsZ5Z1opAQvdr2J" Content-Disposition: inline --HLsZ5Z1opAQvdr2J Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable 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, AV= Packet *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_FLAG_PSN= R) ? 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_REORDE= RED_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=3D= recon&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 I cannot replicate this, using matrixbench and above command line i get no= =20 mismatches, where can i find the input.y4m you used ? also would be nice if this tool would write a image showing the difference thx >=20 > I don't know if this really matters for snow (is it mean to be bitexact?), > 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 matc= h, > though. 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" thx [...] --=20 Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB Concerning the gods, I have no means of knowing whether they exist or not or of what sort they may be, because of the obscurity of the subject, and the brevity of human life -- Protagoras --HLsZ5Z1opAQvdr2J Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iF0EABEIAB0WIQSf8hKLFH72cwut8TNhHseHBAsPqwUCZBwg5QAKCRBhHseHBAsP qznbAJwMZ0DRFibT5Twe1lF6Koqe+qWK2ACdFx5/mpLtXXGJJ1efFVhG3+nCNto= =uTI1 -----END PGP SIGNATURE----- --HLsZ5Z1opAQvdr2J-- --===============2294532384445913561== 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". --===============2294532384445913561==--