From: Michael Niedermayer <michael@niedermayer.cc>
To: FFmpeg development discussions and patches <ffmpeg-devel@ffmpeg.org>
Subject: Re: [FFmpeg-devel] [PATCH v2 1/3] avcodec/snowenc: AV_CODEC_CAP_ENCODER_RECON_FRAME support
Date: Thu, 23 Mar 2023 10:50:34 +0100
Message-ID: <20230323095034.GL375355@pb2> (raw)
In-Reply-To: <d6f64199-6ec7-cb45-685a-08748d465b73@gmail.com>
[-- Attachment #1.1: Type: text/plain, Size: 3453 bytes --]
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 <michael@niedermayer.cc>
> > ---
> > libavcodec/snowenc.c | 10 +++++++++-
> > 1 file changed, 9 insertions(+), 1 deletion(-)
> >
> > 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 = avctx->priv_data;
> > RangeCoder * const c= &s->c;
> > + AVCodecInternal *avci = avctx->internal;
> > AVFrame *pic;
> > const int width= s->avctx->width;
> > const int height= s->avctx->height;
> > @@ -1877,6 +1879,10 @@ redo_frame:
> > s->encoding_error,
> > (s->avctx->flags&AV_CODEC_FLAG_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 = ff_rac_terminate(c, 0);
> > if (s->current_picture->key_frame)
> > @@ -1934,7 +1940,9 @@ const FFCodec ff_snow_encoder = {
> > CODEC_LONG_NAME("Snow"),
> > .p.type = AVMEDIA_TYPE_VIDEO,
> > .p.id = AV_CODEC_ID_SNOW,
> > - .p.capabilities = AV_CODEC_CAP_DR1 | AV_CODEC_CAP_ENCODER_REORDERED_OPAQUE,
> > + .p.capabilities = AV_CODEC_CAP_DR1 |
> > + AV_CODEC_CAP_ENCODER_REORDERED_OPAQUE |
> > + AV_CODEC_CAP_ENCODER_RECON_FRAME,
> > .priv_data_size = sizeof(SnowContext),
> > .init = encode_init,
> > FF_CODEC_ENCODE_CB(encode_frame),
>
> Testing with the tool from https://git.khirnov.net/libav.git/commit/?h=recon&id=d78e17840347abfe10b2bc7e789c60665de56e1f
> (Which i hope will be upstreamed eventually) i get
>
> $ tools/enc_recon_frame_test input.y4m snow flags=+bitexact 10
> Checksum mismatch in frame ts=0, plane 0
I cannot replicate this, using matrixbench and above command line i get no
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
>
> 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 match,
> 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
[...]
--
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
[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 195 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".
next prev parent reply other threads:[~2023-03-23 9:50 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-03-19 19:42 Michael Niedermayer
2023-03-19 19:42 ` [FFmpeg-devel] [PATCH v2 2/3] avfilter/vf_uspp: add AV_CODEC_FLAG_RECON_FRAME support Michael Niedermayer
2023-03-19 19:42 ` [FFmpeg-devel] [PATCH v2 3/3] avfilter/vf_mcdeint: update to new API Michael Niedermayer
2023-03-20 22:07 ` [FFmpeg-devel] [PATCH v2 1/3] avcodec/snowenc: AV_CODEC_CAP_ENCODER_RECON_FRAME support James Almer
2023-03-23 9:50 ` Michael Niedermayer [this message]
2023-03-23 11:32 ` James Almer
2023-03-24 0:08 ` Michael Niedermayer
2023-03-25 20:56 ` Michael Niedermayer
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=20230323095034.GL375355@pb2 \
--to=michael@niedermayer.cc \
--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