From: Andreas Rheinhardt <andreas.rheinhardt@outlook.com> To: ffmpeg-devel@ffmpeg.org Cc: Andreas Rheinhardt <andreas.rheinhardt@outlook.com> Subject: [FFmpeg-devel] [PATCH 12/12] avcodec/mpegvideo: Move allocating new_picture to the encoder Date: Tue, 3 Oct 2023 18:04:04 +0200 Message-ID: <AS8P250MB0744B4A6145D580C570021248FC4A@AS8P250MB0744.EURP250.PROD.OUTLOOK.COM> (raw) In-Reply-To: <AS8P250MB0744CC369A3887A6A38474498FC7A@AS8P250MB0744.EURP250.PROD.OUTLOOK.COM> It is only used by encoders; this unfortunately necessitated to add separate allocations to the SVQ1 encoder which uses motion estimation without being a full member of mpegvideo. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com> --- libavcodec/mpegvideo.c | 5 +---- libavcodec/mpegvideo_enc.c | 3 ++- libavcodec/svq1enc.c | 6 ++++-- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/libavcodec/mpegvideo.c b/libavcodec/mpegvideo.c index fc73abab9c..9ed158ac57 100644 --- a/libavcodec/mpegvideo.c +++ b/libavcodec/mpegvideo.c @@ -632,7 +632,6 @@ static void clear_context(MpegEncContext *s) memset(&s->next_picture, 0, sizeof(s->next_picture)); memset(&s->last_picture, 0, sizeof(s->last_picture)); memset(&s->current_picture, 0, sizeof(s->current_picture)); - memset(&s->new_picture, 0, sizeof(s->new_picture)); memset(s->thread_context, 0, sizeof(s->thread_context)); @@ -720,8 +719,7 @@ av_cold int ff_mpv_common_init(MpegEncContext *s) if (!(s->next_picture.f = av_frame_alloc()) || !(s->last_picture.f = av_frame_alloc()) || - !(s->current_picture.f = av_frame_alloc()) || - !(s->new_picture = av_frame_alloc())) + !(s->current_picture.f = av_frame_alloc())) goto fail_nomem; if ((ret = ff_mpv_init_context_frame(s))) @@ -801,7 +799,6 @@ void ff_mpv_common_end(MpegEncContext *s) ff_mpv_picture_free(s->avctx, &s->last_picture); ff_mpv_picture_free(s->avctx, &s->current_picture); ff_mpv_picture_free(s->avctx, &s->next_picture); - av_frame_free(&s->new_picture); s->context_initialized = 0; s->context_reinit = 0; diff --git a/libavcodec/mpegvideo_enc.c b/libavcodec/mpegvideo_enc.c index 5bf4b06a11..f669658127 100644 --- a/libavcodec/mpegvideo_enc.c +++ b/libavcodec/mpegvideo_enc.c @@ -821,7 +821,8 @@ av_cold int ff_mpv_encode_init(AVCodecContext *avctx) !FF_ALLOCZ_TYPED_ARRAY(s->q_chroma_intra_matrix16, 32) || !FF_ALLOCZ_TYPED_ARRAY(s->q_inter_matrix16, 32) || !FF_ALLOCZ_TYPED_ARRAY(s->input_picture, MAX_PICTURE_COUNT) || - !FF_ALLOCZ_TYPED_ARRAY(s->reordered_input_picture, MAX_PICTURE_COUNT)) + !FF_ALLOCZ_TYPED_ARRAY(s->reordered_input_picture, MAX_PICTURE_COUNT) || + !(s->new_picture = av_frame_alloc())) return AVERROR(ENOMEM); /* Allocate MV tables; the MV and MB tables will be copied diff --git a/libavcodec/svq1enc.c b/libavcodec/svq1enc.c index 46a484e15f..894ae552bb 100644 --- a/libavcodec/svq1enc.c +++ b/libavcodec/svq1enc.c @@ -570,6 +570,7 @@ static av_cold int svq1_encode_end(AVCodecContext *avctx) av_frame_free(&s->current_picture); av_frame_free(&s->last_picture); + av_frame_free(&s->m.new_picture); return 0; } @@ -632,10 +633,11 @@ static av_cold int svq1_encode_init(AVCodecContext *avctx) s->dummy = av_mallocz((s->y_block_width + 1) * s->y_block_height * sizeof(int32_t)); s->m.me.map = av_mallocz(2 * ME_MAP_SIZE * sizeof(*s->m.me.map)); + s->m.new_picture = av_frame_alloc(); s->svq1encdsp.ssd_int8_vs_int16 = ssd_int8_vs_int16_c; - if (!s->m.me.temp || !s->m.me.scratchpad || !s->m.me.map || - !s->mb_type || !s->dummy) + if (!s->m.me.scratchpad || !s->m.me.map || + !s->mb_type || !s->dummy || !s->m.new_picture) return AVERROR(ENOMEM); s->m.me.score_map = s->m.me.map + ME_MAP_SIZE; -- 2.34.1 _______________________________________________ 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-10-03 16:03 UTC|newest] Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top 2023-09-30 18:02 [FFmpeg-devel] [PATCH 1/4] avcodec/mpegvideo_dec: Check for existence of planes before accesses Andreas Rheinhardt 2023-09-30 18:02 ` [FFmpeg-devel] [PATCH 2/4] avcodec/mpegvideo_dec: Don't memset twice Andreas Rheinhardt 2023-09-30 18:02 ` [FFmpeg-devel] [PATCH 3/4] avcodec/mpegvideo_dec: Remove commented-out legacy cruft Andreas Rheinhardt 2023-10-01 20:29 ` Michael Niedermayer 2023-09-30 18:02 ` [FFmpeg-devel] [PATCH 4/4] avcodec/h264_slice: Don't keep AVCodecContext props in sync manually Andreas Rheinhardt 2023-10-02 10:51 ` [FFmpeg-devel] [PATCH 5/8] avcodec/mpeg12dec: Don't initialize IDCT more than once Andreas Rheinhardt 2023-10-03 22:14 ` Andreas Rheinhardt 2023-10-02 10:52 ` [FFmpeg-devel] [PATCH 6/8] avcodec/mpegvideo_dec: Don't zero context on init failure Andreas Rheinhardt 2023-10-02 10:52 ` [FFmpeg-devel] [PATCH 7/8] avcodec/mpegvideo_dec: Always initialize IDCTDSPContext during init Andreas Rheinhardt 2023-10-02 10:52 ` [FFmpeg-devel] [PATCH 8/8] avcodec/h263dec, mpeg4videodec: Parse extradata " Andreas Rheinhardt 2023-10-02 23:39 ` [FFmpeg-devel] [PATCH 1/4] avcodec/mpegvideo_dec: Check for existence of planes before accesses Andreas Rheinhardt 2023-10-03 16:04 ` [FFmpeg-devel] [PATCH 09/12] avcodec/rv10: Remove dead code Andreas Rheinhardt 2023-10-04 17:28 ` Michael Niedermayer 2023-10-03 16:04 ` [FFmpeg-devel] [PATCH 10/12] avcodec/rv10: Replace switch by LUT Andreas Rheinhardt 2023-10-04 17:27 ` Michael Niedermayer 2023-10-06 1:42 ` Vittorio Giovara 2023-10-06 2:03 ` Andreas Rheinhardt 2023-10-07 16:44 ` Michael Niedermayer 2023-10-03 16:04 ` [FFmpeg-devel] [PATCH 11/12] avcodec/h261dec, mpeg12dec, vc1dec: Remove setting write-only flags Andreas Rheinhardt 2023-10-04 17:26 ` Michael Niedermayer 2023-10-03 16:04 ` Andreas Rheinhardt [this message] 2023-10-06 2:21 ` [FFmpeg-devel] [PATCH 12/12] avcodec/mpegvideo: Move allocating new_picture to the encoder Andreas Rheinhardt
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=AS8P250MB0744B4A6145D580C570021248FC4A@AS8P250MB0744.EURP250.PROD.OUTLOOK.COM \ --to=andreas.rheinhardt@outlook.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