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 7800645C20 for ; Sat, 25 Mar 2023 20:56:39 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id A988C68CA9B; Sat, 25 Mar 2023 22:56:36 +0200 (EET) Received: from relay7-d.mail.gandi.net (relay7-d.mail.gandi.net [217.70.183.200]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id D344268C5C8 for ; Sat, 25 Mar 2023 22:56:29 +0200 (EET) Received: (Authenticated sender: michael@niedermayer.cc) by mail.gandi.net (Postfix) with ESMTPSA id B404420002 for ; Sat, 25 Mar 2023 20:56:28 +0000 (UTC) Date: Sat, 25 Mar 2023 21:56:26 +0100 From: Michael Niedermayer To: FFmpeg development discussions and patches Message-ID: <20230325205626.GZ375355@pb2> References: <20230319194240.15001-1-michael@niedermayer.cc> <20230323095034.GL375355@pb2> <20230324000856.GO375355@pb2> MIME-Version: 1.0 In-Reply-To: <20230324000856.GO375355@pb2> 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="===============1202779183596963296==" Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: --===============1202779183596963296== Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="DHd0DHvhbdljNSqO" Content-Disposition: inline --DHd0DHvhbdljNSqO Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Fri, Mar 24, 2023 at 01:08:56AM +0100, Michael Niedermayer wrote: > 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 *avc= tx, 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_F= LAG_PSNR) ? SNOW_MAX_PLANES : 0, > > > > > s->current_picture->pict_ty= pe); > > > > > + 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_= REORDERED_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 g= et 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 diffe= rence > > >=20 > > > thx > > >=20 > > > >=20 > > > > I don't know if this really matters for snow (is it mean to be bite= xact?), > > > > but it seems the very first frame returned by the reconstructed fra= me API is > > > > not the same as the one output by the snow decoder. The rest seem t= o match, > > > > though. > > >=20 > > > This sounds rather strange, the first frame would be used as referenc= e for > > > motion compensation so the subsequent frames matching after a mismatc= h is > > > "surprising" > >=20 > > I tried other supported encoders like libx264 and librav1e and none of = them > > report mismatches. >=20 > bugs > ill send a patchset will apply the fix as well as these 3 patches here [...] --=20 Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB it is not once nor twice but times without number that the same ideas make their appearance in the world. -- Aristotle --DHd0DHvhbdljNSqO Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iF0EABEIAB0WIQSf8hKLFH72cwut8TNhHseHBAsPqwUCZB9f+gAKCRBhHseHBAsP qxSuAJ9zYmkHqIPfN6r9bVv/F4eFwvG1MwCaAiHNPFFh5KN2Wxq03nIqA+jEwS0= =7SfB -----END PGP SIGNATURE----- --DHd0DHvhbdljNSqO-- --===============1202779183596963296== 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". --===============1202779183596963296==--