From: Andreas Rheinhardt <andreas.rheinhardt@outlook.com> To: ffmpeg-devel@ffmpeg.org Cc: Andreas Rheinhardt <andreas.rheinhardt@outlook.com> Subject: [FFmpeg-devel] [PATCH 7/9] avcodec/snow: Move decoder parts out of ff_snow_common_init_after_header Date: Mon, 25 Sep 2023 20:04:55 +0200 Message-ID: <AS8P250MB0744CF57A383F9698414F90B8FFCA@AS8P250MB0744.EURP250.PROD.OUTLOOK.COM> (raw) In-Reply-To: <AS8P250MB0744D7FEB3A2719DC2D9F0EA8FFCA@AS8P250MB0744.EURP250.PROD.OUTLOOK.COM> They are not common. Furthermore, this file is pulled in when linking checkasm and up until now, the calls to ff_get_buffer() and av_codec_is_decoder() caused all of libavcodec to be pulled in as well. Besides being bad size-wise this also has the downside that it pulls in avpriv_(cga|vga16)_font from libavutil which are marked as being imported from another library when building libavcodec as a DLL; this breaks checkasm because it links both lavc and lavu statically. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com> --- libavcodec/snow.c | 15 +-------------- libavcodec/snowdec.c | 11 +++++++++++ 2 files changed, 12 insertions(+), 14 deletions(-) diff --git a/libavcodec/snow.c b/libavcodec/snow.c index 09f2d60f47..90197976fb 100644 --- a/libavcodec/snow.c +++ b/libavcodec/snow.c @@ -21,7 +21,6 @@ #include "libavutil/log.h" #include "libavutil/thread.h" #include "avcodec.h" -#include "decode.h" #include "snow_dwt.h" #include "snow.h" #include "snowdata.h" @@ -476,27 +475,15 @@ av_cold int ff_snow_common_init(AVCodecContext *avctx){ int ff_snow_common_init_after_header(AVCodecContext *avctx) { SnowContext *s = avctx->priv_data; int plane_index, level, orientation; - int ret, emu_buf_size; if(!s->scratchbuf) { - if (av_codec_is_decoder(avctx->codec)) { - if ((ret = ff_get_buffer(s->avctx, s->mconly_picture, - AV_GET_BUFFER_FLAG_REF)) < 0) - return ret; - } - + int emu_buf_size; emu_buf_size = FFMAX(s->mconly_picture->linesize[0], 2*avctx->width+256) * (2 * MB_SIZE + HTAPS_MAX - 1); if (!FF_ALLOCZ_TYPED_ARRAY(s->scratchbuf, FFMAX(s->mconly_picture->linesize[0], 2*avctx->width+256) * 7 * MB_SIZE) || !FF_ALLOCZ_TYPED_ARRAY(s->emu_edge_buffer, emu_buf_size)) return AVERROR(ENOMEM); } - if (av_codec_is_decoder(avctx->codec) && - s->mconly_picture->format != avctx->pix_fmt) { - av_log(avctx, AV_LOG_ERROR, "pixel format changed\n"); - return AVERROR_INVALIDDATA; - } - for(plane_index=0; plane_index < s->nb_planes; plane_index++){ int w= s->avctx->width; int h= s->avctx->height; diff --git a/libavcodec/snowdec.c b/libavcodec/snowdec.c index 489c09324e..e77dc8ce8a 100644 --- a/libavcodec/snowdec.c +++ b/libavcodec/snowdec.c @@ -455,6 +455,17 @@ static int decode_frame(AVCodecContext *avctx, AVFrame *picture, s->current_picture->pict_type= AV_PICTURE_TYPE_I; //FIXME I vs. P if ((res = decode_header(s)) < 0) return res; + + if (!s->mconly_picture->data[0]) { + res = ff_get_buffer(avctx, s->mconly_picture, AV_GET_BUFFER_FLAG_REF); + if (res < 0) + return res; + } + if (s->mconly_picture->format != avctx->pix_fmt) { + av_log(avctx, AV_LOG_ERROR, "pixel format changed\n"); + return AVERROR_INVALIDDATA; + } + if ((res=ff_snow_common_init_after_header(avctx)) < 0) return res; -- 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-09-25 18:04 UTC|newest] Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top 2023-09-25 17:53 [FFmpeg-devel] [PATCH 1/9] avfilter/bwdif: Add proper BWDIFDSPContext Andreas Rheinhardt 2023-09-25 18:04 ` [FFmpeg-devel] [PATCH 2/9] avfilter/vf_bwdif: Move DSP code to a new file Andreas Rheinhardt 2023-09-25 18:04 ` [FFmpeg-devel] [PATCH 3/9] avfilter/bwdifdsp: Constify Andreas Rheinhardt 2023-09-25 18:04 ` [FFmpeg-devel] [PATCH 4/9] avfilter/bwdifdsp: Avoid including ff_bwdif_filter_line3_c() Andreas Rheinhardt 2023-09-25 18:04 ` [FFmpeg-devel] [PATCH 5/9] checkasm/motion: Don't allocate AVCodecContext Andreas Rheinhardt 2023-09-25 18:04 ` [FFmpeg-devel] [PATCH 6/9] avcodec/snow: Split ff_snow_get_buffer() Andreas Rheinhardt 2023-09-25 18:04 ` Andreas Rheinhardt [this message] 2023-09-25 18:04 ` [FFmpeg-devel] [PATCH 8/9] avcodec/aacsbrdata: Move ff_sbr_noise_table to sbrdsp_template.c Andreas Rheinhardt 2023-09-25 18:04 ` [FFmpeg-devel] [PATCH 9/9] avcodec/tests/.gitignore: Add bitstream test tools Andreas Rheinhardt 2023-09-26 22:11 ` [FFmpeg-devel] [PATCH 1/9] avfilter/bwdif: Add proper BWDIFDSPContext 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=AS8P250MB0744CF57A383F9698414F90B8FFCA@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