From: "Tomas Härdin" <tjoppen@acc.umu.se> To: FFmpeg development discussions and patches <ffmpeg-devel@ffmpeg.org> Subject: [FFmpeg-devel] [PATCH 8/8] libavcodec/jpeg2000: Call av_codec_is_encoder() only once in init_prec() Date: Tue, 31 May 2022 12:01:35 +0200 Message-ID: <59a03d6a765d4626738cea828551d424246fa9bb.camel@acc.umu.se> (raw) In-Reply-To: <152f94f0779c645542f5a678d9392ee53584d45a.camel@acc.umu.se> [-- Attachment #1: Type: text/plain, Size: 1 bytes --] [-- Attachment #2: 0008-libavcodec-jpeg2000-Call-av_codec_is_encoder-only-on.patch --] [-- Type: text/x-patch, Size: 1530 bytes --] From 1485b06278f38dcda5ff83f17e0a3446949809b6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomas=20H=C3=A4rdin?= <git@haerdin.se> Date: Mon, 23 May 2022 11:20:57 +0200 Subject: [PATCH 8/8] libavcodec/jpeg2000: Call av_codec_is_encoder() only once in init_prec() --- libavcodec/jpeg2000.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/libavcodec/jpeg2000.c b/libavcodec/jpeg2000.c index 0aa984bc53..0d4b18b38d 100644 --- a/libavcodec/jpeg2000.c +++ b/libavcodec/jpeg2000.c @@ -278,7 +278,7 @@ static int init_prec(AVCodecContext *avctx, int log2_band_prec_height) { Jpeg2000Prec *prec = band->prec + precno; - int nb_codeblocks, cblkno; + int nb_codeblocks, cblkno, is_enc; prec->decoded_layers = 0; @@ -336,6 +336,9 @@ static int init_prec(AVCodecContext *avctx, prec->cblk = av_calloc(nb_codeblocks, sizeof(*prec->cblk)); if (!prec->cblk) return AVERROR(ENOMEM); + + is_enc = av_codec_is_encoder(avctx->codec); + for (cblkno = 0; cblkno < nb_codeblocks; cblkno++) { Jpeg2000Cblk *cblk = prec->cblk + cblkno; int Cx0, Cy0; @@ -375,7 +378,7 @@ static int init_prec(AVCodecContext *avctx, cblk->lblock = 3; cblk->length = 0; cblk->npasses = 0; - if (av_codec_is_encoder(avctx->codec)) { + if (is_enc) { cblk->layers = av_calloc(codsty->nlayers, sizeof(*cblk->layers)); if (!cblk->layers) return AVERROR(ENOMEM); -- 2.30.2 [-- Attachment #3: 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:[~2022-05-31 10:01 UTC|newest] Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top 2022-05-31 9:58 [FFmpeg-devel] [PATCH 1/8] libavcodec/jpeg2000_parser: Speed up long skips Tomas Härdin 2022-05-31 9:59 ` [FFmpeg-devel] [PATCH 2/8] libavcodec/jpeg2000_parser: Simplify, fix reset_context() Tomas Härdin 2022-06-01 16:50 ` Michael Niedermayer 2022-05-31 9:59 ` [FFmpeg-devel] [PATCH 3/8] libavcodec/jpeg2000_parser: next_state is just a temporary Tomas Härdin 2022-06-01 16:43 ` Michael Niedermayer 2022-05-31 10:00 ` [FFmpeg-devel] [PATCH 4/8] libavcodec/jpeg2000_parser: LUTify info_marker() Tomas Härdin 2022-06-01 16:40 ` Michael Niedermayer 2022-05-31 10:00 ` [FFmpeg-devel] [PATCH 5/8] libavcodec/jpeg2000_parser: Rearrange ifs Tomas Härdin 2022-06-01 16:36 ` Michael Niedermayer 2022-05-31 10:00 ` [FFmpeg-devel] [PATCH 6/8] libavcodec/jpeg2000_parser: Reindent Tomas Härdin 2022-05-31 10:01 ` [FFmpeg-devel] [PATCH 7/8] libavcodec/jpeg2000_parser: Localize m->bytes_read Tomas Härdin 2022-06-01 16:38 ` Michael Niedermayer 2022-05-31 10:01 ` Tomas Härdin [this message] 2022-06-01 16:34 ` [FFmpeg-devel] [PATCH 8/8] libavcodec/jpeg2000: Call av_codec_is_encoder() only once in init_prec() Michael Niedermayer 2022-06-01 9:59 ` [FFmpeg-devel] [PATCH 1/8] libavcodec/jpeg2000_parser: Speed up long skips Anton Khirnov 2022-06-01 12:34 ` Tomas Härdin 2022-06-01 13:29 ` Anton Khirnov 2022-06-01 16:21 ` Michael Niedermayer 2022-06-01 16:23 ` Michael Niedermayer 2022-06-02 9:54 ` Tomas Härdin 2022-06-02 19:19 ` Michael Niedermayer 2022-06-03 9:17 ` Tomas Härdin 2022-06-03 14:58 ` Michael Niedermayer 2022-06-10 9:12 ` Tomas Härdin
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=59a03d6a765d4626738cea828551d424246fa9bb.camel@acc.umu.se \ --to=tjoppen@acc.umu.se \ --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