From: James Almer <jamrial@gmail.com>
To: ffmpeg-devel@ffmpeg.org
Subject: Re: [FFmpeg-devel] [PATCH] lavc/encode: drop EncodeSimpleContext
Date: Mon, 11 Apr 2022 13:32:30 -0300
Message-ID: <8f9ab35a-863e-44fa-eb69-759cb9f0f9c5@gmail.com> (raw)
In-Reply-To: <20220411083908.28802-1-anton@khirnov.net>
On 4/11/2022 5:39 AM, Anton Khirnov wrote:
> It has only a single member.
> ---
> libavcodec/avcodec.c | 4 ++--
> libavcodec/encode.c | 7 +++----
> libavcodec/internal.h | 12 +++++++-----
> 3 files changed, 12 insertions(+), 11 deletions(-)
>
> diff --git a/libavcodec/avcodec.c b/libavcodec/avcodec.c
> index c7daa385e7..e0f38ac42a 100644
> --- a/libavcodec/avcodec.c
> +++ b/libavcodec/avcodec.c
> @@ -432,7 +432,7 @@ void avcodec_flush_buffers(AVCodecContext *avctx)
> while (av_fifo_read(avci->pkt_props, avci->last_pkt_props, 1) >= 0)
> av_packet_unref(avci->last_pkt_props);
>
> - av_frame_unref(avci->es.in_frame);
> + av_frame_unref(avci->in_frame);
> av_packet_unref(avci->in_pkt);
>
> if (HAVE_THREADS && avctx->active_thread_type & FF_THREAD_FRAME)
> @@ -498,7 +498,7 @@ av_cold int avcodec_close(AVCodecContext *avctx)
> av_packet_free(&avci->last_pkt_props);
>
> av_packet_free(&avci->in_pkt);
> - av_frame_free(&avci->es.in_frame);
> + av_frame_free(&avci->in_frame);
>
> av_buffer_unref(&avci->pool);
>
> diff --git a/libavcodec/encode.c b/libavcodec/encode.c
> index 837ffaa40d..8b0d4443cd 100644
> --- a/libavcodec/encode.c
> +++ b/libavcodec/encode.c
> @@ -175,8 +175,7 @@ int ff_encode_get_frame(AVCodecContext *avctx, AVFrame *frame)
> static int encode_simple_internal(AVCodecContext *avctx, AVPacket *avpkt)
> {
> AVCodecInternal *avci = avctx->internal;
> - EncodeSimpleContext *es = &avci->es;
> - AVFrame *frame = es->in_frame;
> + AVFrame *frame = avci->in_frame;
> const FFCodec *const codec = ffcodec(avctx->codec);
> int got_packet;
> int ret;
> @@ -565,8 +564,8 @@ FF_ENABLE_DEPRECATION_WARNINGS
> avctx->internal->intra_only_flag = AV_PKT_FLAG_KEY;
>
> if (ffcodec(avctx->codec)->encode2) {
> - avci->es.in_frame = av_frame_alloc();
> - if (!avci->es.in_frame)
> + avci->in_frame = av_frame_alloc();
> + if (!avci->in_frame)
> return AVERROR(ENOMEM);
> }
>
> diff --git a/libavcodec/internal.h b/libavcodec/internal.h
> index f9d08fcb60..2fa56d3a59 100644
> --- a/libavcodec/internal.h
> +++ b/libavcodec/internal.h
> @@ -47,10 +47,6 @@
> # define STRIDE_ALIGN 8
> #endif
>
> -typedef struct EncodeSimpleContext {
> - AVFrame *in_frame;
> -} EncodeSimpleContext;
> -
> typedef struct AVCodecInternal {
> /**
> * When using frame-threaded decoding, this field is set for the first
> @@ -101,7 +97,13 @@ typedef struct AVCodecInternal {
>
> void *frame_thread_encoder;
>
> - EncodeSimpleContext es;
> + /**
> + * The input frame is stored here for encoders implementing the simple
> + * encode API.
> + *
> + * Not allocated in other cases.
> + */
> + AVFrame *in_frame;
>
> /**
> * If this is set, then FFCodec->close (if existing) needs to be called
LGTM.
_______________________________________________
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:[~2022-04-11 16:32 UTC|newest]
Thread overview: 33+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-03-23 15:57 [FFmpeg-devel] [PATCH 1/8] lavc/avcodec: simplify codec id/type validity checking Anton Khirnov
2022-03-23 15:57 ` [FFmpeg-devel] [PATCH 2/8] lavc/avcodec: only allocate the encoding frame for encoders Anton Khirnov
2022-03-23 16:29 ` James Almer
2022-04-11 8:39 ` [FFmpeg-devel] [PATCH] lavc/encode: drop EncodeSimpleContext Anton Khirnov
2022-04-11 9:16 ` Paul B Mahol
2022-04-11 16:32 ` James Almer [this message]
2022-03-23 15:57 ` [FFmpeg-devel] [PATCH 3/8] lavc: move default get_buffer2() to its own file Anton Khirnov
2022-03-23 15:57 ` [FFmpeg-devel] [PATCH 4/8] lavc/snow: only allocate mconly_picture for decoding Anton Khirnov
2022-03-24 23:07 ` Michael Niedermayer
2022-04-11 8:49 ` [FFmpeg-devel] [PATCH] " Anton Khirnov
2022-04-11 19:28 ` Michael Niedermayer
2022-04-13 10:21 ` Anton Khirnov
2022-03-23 15:57 ` [FFmpeg-devel] [PATCH 5/8] lavc/encode: add an encoder-specific get_buffer() variant Anton Khirnov
2022-03-23 16:26 ` James Almer
2022-04-11 9:05 ` [FFmpeg-devel] [PATCH] " Anton Khirnov
2022-03-23 15:57 ` [FFmpeg-devel] [PATCH 6/8] lavc/avcodec: only allocate decoding packets for decoders Anton Khirnov
2022-04-13 14:51 ` Andreas Rheinhardt
2022-03-23 15:57 ` [FFmpeg-devel] [PATCH 7/8] lavc/pthread_frame: do not copy AVCodecInternal contents Anton Khirnov
2022-03-23 15:57 ` [FFmpeg-devel] [PATCH 8/8] lavc: drop a confusing message about "thread emulation" Anton Khirnov
2022-04-13 10:23 ` [FFmpeg-devel] [PATCH 1/8] lavc/avcodec: simplify codec id/type validity checking Anton Khirnov
2022-06-05 5:23 ` Soft Works
2022-06-05 7:01 ` Anton Khirnov
2022-06-05 7:54 ` Soft Works
2022-06-05 7:59 ` Soft Works
2022-06-05 8:20 ` Anton Khirnov
2022-06-05 8:55 ` Paul B Mahol
2022-06-05 8:55 ` Soft Works
2022-06-05 9:15 ` Soft Works
2022-06-05 10:42 ` Anton Khirnov
2022-06-05 10:55 ` Soft Works
2022-06-05 11:10 ` Soft Works
2022-06-05 13:20 ` Anton Khirnov
2022-06-05 14:06 ` Soft Works
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=8f9ab35a-863e-44fa-eb69-759cb9f0f9c5@gmail.com \
--to=jamrial@gmail.com \
--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