From: Andreas Rheinhardt <andreas.rheinhardt@outlook.com> To: ffmpeg-devel@ffmpeg.org Cc: Andreas Rheinhardt <andreas.rheinhardt@outlook.com> Subject: [FFmpeg-devel] [PATCH 7/7] avcodec/texturedsp: Factor common code out Date: Wed, 24 Jan 2024 20:52:39 +0100 Message-ID: <AS8P250MB07447397C696EACA1C2FABF58F7B2@AS8P250MB0744.EURP250.PROD.OUTLOOK.COM> (raw) In-Reply-To: <AS8P250MB0744B4D31626D49493AE03358F7B2@AS8P250MB0744.EURP250.PROD.OUTLOOK.COM> Namely calling avctx->execute2(avctx,...). Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com> --- libavcodec/dds.c | 2 +- libavcodec/dxvenc.c | 2 +- libavcodec/hapdec.c | 2 +- libavcodec/hapenc.c | 2 +- libavcodec/texturedsp.c | 2 +- libavcodec/texturedsp.h | 9 +++++---- libavcodec/texturedsp_template.c | 13 ++++++++++--- libavcodec/texturedspenc.c | 2 +- libavcodec/vbndec.c | 2 +- libavcodec/vbnenc.c | 2 +- 10 files changed, 23 insertions(+), 15 deletions(-) diff --git a/libavcodec/dds.c b/libavcodec/dds.c index 31a327a579..67e2325a2a 100644 --- a/libavcodec/dds.c +++ b/libavcodec/dds.c @@ -636,7 +636,7 @@ static int dds_decode(AVCodecContext *avctx, AVFrame *frame, ctx->dec.tex_data.in = gbc->buffer; ctx->dec.frame_data.out = frame->data[0]; ctx->dec.stride = frame->linesize[0]; - avctx->execute2(avctx, ff_texturedsp_decompress_thread, &ctx->dec, NULL, ctx->dec.slice_count); + ff_texturedsp_exec_decompress_threads(avctx, &ctx->dec); } else if (!ctx->paletted && ctx->bpp == 4 && avctx->pix_fmt == AV_PIX_FMT_PAL8) { uint8_t *dst = frame->data[0]; int x, y, i; diff --git a/libavcodec/dxvenc.c b/libavcodec/dxvenc.c index 280a965685..b274175689 100644 --- a/libavcodec/dxvenc.c +++ b/libavcodec/dxvenc.c @@ -236,7 +236,7 @@ static int dxv_encode(AVCodecContext *avctx, AVPacket *pkt, ctx->enc.tex_data.out = ctx->tex_data; ctx->enc.frame_data.in = frame->data[0]; ctx->enc.stride = frame->linesize[0]; - avctx->execute2(avctx, ff_texturedsp_compress_thread, &ctx->enc, NULL, ctx->enc.slice_count); + ff_texturedsp_exec_compress_threads(avctx, &ctx->enc); } else { /* unimplemented: YCoCg formats */ return AVERROR_INVALIDDATA; diff --git a/libavcodec/hapdec.c b/libavcodec/hapdec.c index 64e0494370..3a848e9f67 100644 --- a/libavcodec/hapdec.c +++ b/libavcodec/hapdec.c @@ -323,7 +323,7 @@ static int hap_decode(AVCodecContext *avctx, AVFrame *frame, ctx->dec[t].frame_data.out = frame->data[0]; ctx->dec[t].stride = frame->linesize[0]; - avctx->execute2(avctx, ff_texturedsp_decompress_thread, &ctx->dec[t], NULL, ctx->dec[t].slice_count); + ff_texturedsp_exec_decompress_threads(avctx, &ctx->dec[t]); } /* Frame is ready to be output */ diff --git a/libavcodec/hapenc.c b/libavcodec/hapenc.c index 92cd9c4d31..1464f743d6 100644 --- a/libavcodec/hapenc.c +++ b/libavcodec/hapenc.c @@ -63,7 +63,7 @@ static int compress_texture(AVCodecContext *avctx, uint8_t *out, int out_length, ctx->enc.tex_data.out = out; ctx->enc.frame_data.in = f->data[0]; ctx->enc.stride = f->linesize[0]; - avctx->execute2(avctx, ff_texturedsp_compress_thread, &ctx->enc, NULL, ctx->enc.slice_count); + ff_texturedsp_exec_compress_threads(avctx, &ctx->enc); return 0; } diff --git a/libavcodec/texturedsp.c b/libavcodec/texturedsp.c index b8938213ef..5fb79937da 100644 --- a/libavcodec/texturedsp.c +++ b/libavcodec/texturedsp.c @@ -653,6 +653,6 @@ av_cold void ff_texturedsp_init(TextureDSPContext *c) c->dxn3dc_block = dxn3dc_block; } -#define TEXTUREDSP_FUNC_NAME ff_texturedsp_decompress_thread +#define TEXTUREDSP_FUNC_NAME ff_texturedsp_exec_decompress_threads #define TEXTUREDSP_TEX_FUNC(a, b, c) tex_funct(a, b, c) #include "texturedsp_template.c" diff --git a/libavcodec/texturedsp.h b/libavcodec/texturedsp.h index 6de8fda690..86c8eea02d 100644 --- a/libavcodec/texturedsp.h +++ b/libavcodec/texturedsp.h @@ -39,8 +39,6 @@ #include <stddef.h> #include <stdint.h> -#include "avcodec.h" - #define TEXTURE_BLOCK_W 4 #define TEXTURE_BLOCK_H 4 @@ -89,7 +87,10 @@ typedef struct TextureDSPThreadContext { void ff_texturedsp_init(TextureDSPContext *c); void ff_texturedspenc_init(TextureDSPEncContext *c); -int ff_texturedsp_decompress_thread(AVCodecContext *avctx, void *arg, int slice, int thread_nb); -int ff_texturedsp_compress_thread(AVCodecContext *avctx, void *arg, int slice, int thread_nb); +struct AVCodecContext; +int ff_texturedsp_exec_decompress_threads(struct AVCodecContext *avctx, + TextureDSPThreadContext *ctx); +int ff_texturedsp_exec_compress_threads(struct AVCodecContext *avctx, + TextureDSPThreadContext *ctx); #endif /* AVCODEC_TEXTUREDSP_H */ diff --git a/libavcodec/texturedsp_template.c b/libavcodec/texturedsp_template.c index bd193aa97c..9589cc4187 100644 --- a/libavcodec/texturedsp_template.c +++ b/libavcodec/texturedsp_template.c @@ -20,10 +20,12 @@ * */ -int TEXTUREDSP_FUNC_NAME(AVCodecContext *avctx, void *arg, - int slice, int thread_nb) +#include "avcodec.h" + +static int exec_func(AVCodecContext *avctx, void *arg, + int slice, int thread_nb) { - TextureDSPThreadContext *ctx = arg; + const TextureDSPThreadContext *ctx = arg; uint8_t *d = ctx->tex_data.out; int w_block = avctx->coded_width / TEXTURE_BLOCK_W; int h_block = avctx->coded_height / TEXTURE_BLOCK_H; @@ -55,3 +57,8 @@ int TEXTUREDSP_FUNC_NAME(AVCodecContext *avctx, void *arg, return 0; } + +int TEXTUREDSP_FUNC_NAME(AVCodecContext *avctx, TextureDSPThreadContext *ctx) +{ + return avctx->execute2(avctx, exec_func, ctx, NULL, ctx->slice_count); +} diff --git a/libavcodec/texturedspenc.c b/libavcodec/texturedspenc.c index ffacf96d56..5657a6ef61 100644 --- a/libavcodec/texturedspenc.c +++ b/libavcodec/texturedspenc.c @@ -654,6 +654,6 @@ av_cold void ff_texturedspenc_init(TextureDSPEncContext *c) c->dxt5ys_block = dxt5ys_block; } -#define TEXTUREDSP_FUNC_NAME ff_texturedsp_compress_thread +#define TEXTUREDSP_FUNC_NAME ff_texturedsp_exec_compress_threads #define TEXTUREDSP_TEX_FUNC(a, b, c) tex_funct(c, b, a) #include "texturedsp_template.c" diff --git a/libavcodec/vbndec.c b/libavcodec/vbndec.c index 02ed43f874..83ce9e994b 100644 --- a/libavcodec/vbndec.c +++ b/libavcodec/vbndec.c @@ -162,7 +162,7 @@ static int vbn_decode_frame(AVCodecContext *avctx, ctx->dec.raw_ratio = 16; ctx->dec.frame_data.out = frame->data[0] + frame->linesize[0] * (frame->height - 1); ctx->dec.stride = -frame->linesize[0]; - avctx->execute2(avctx, ff_texturedsp_decompress_thread, &ctx->dec, NULL, ctx->dec.slice_count); + ff_texturedsp_exec_decompress_threads(avctx, &ctx->dec); } *got_frame = 1; diff --git a/libavcodec/vbnenc.c b/libavcodec/vbnenc.c index 01c2482bff..abdc33c2c9 100644 --- a/libavcodec/vbnenc.c +++ b/libavcodec/vbnenc.c @@ -114,7 +114,7 @@ static int vbn_encode(AVCodecContext *avctx, AVPacket *pkt, ctx->enc.frame_data.in = (frame->height - 1) * frame->linesize[0] + frame->data[0]; ctx->enc.stride = -frame->linesize[0]; ctx->enc.tex_data.out = pkt->data + VBN_HEADER_SIZE; - avctx->execute2(avctx, ff_texturedsp_compress_thread, &ctx->enc, NULL, ctx->enc.slice_count); + ff_texturedsp_exec_compress_threads(avctx, &ctx->enc); } else { const uint8_t *flipped = frame->data[0] + frame->linesize[0] * (frame->height - 1); av_image_copy_plane(pkt->data + VBN_HEADER_SIZE, linesize, flipped, -frame->linesize[0], linesize, frame->height); -- 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:[~2024-01-24 19:51 UTC|newest] Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top 2024-01-24 19:50 [FFmpeg-devel] [PATCH 1/7] avcodec/dxvenc: Don't cast const away Andreas Rheinhardt 2024-01-24 19:52 ` [FFmpeg-devel] [PATCH 2/7] avcodec/dxvenc: Fix data races with slice threading Andreas Rheinhardt 2024-01-24 19:52 ` [FFmpeg-devel] [PATCH 3/7] avcodec/texturedspenc: Remove unused rgtc1_u_alpha encoding func Andreas Rheinhardt 2024-01-24 19:52 ` [FFmpeg-devel] [PATCH 4/7] avcodec/dxvenc, hap(dec|enc): Move TextureDSPContext to stack Andreas Rheinhardt 2024-01-24 19:52 ` [FFmpeg-devel] [PATCH 5/7] avcodec/texturedsp: Add separate TextureDSPEncContext Andreas Rheinhardt 2024-01-24 19:52 ` [FFmpeg-devel] [PATCH 6/7] avcodec/hap: Avoid unnecessary opt.h inclusion Andreas Rheinhardt 2024-01-25 19:27 ` Vittorio Giovara 2024-01-26 6:41 ` Andreas Rheinhardt 2024-01-24 19:52 ` Andreas Rheinhardt [this message] 2024-01-24 20:49 ` [FFmpeg-devel] [PATCH 1/7] avcodec/dxvenc: Don't cast const away Connor Worley 2024-01-25 3:04 ` Andreas Rheinhardt 2024-01-26 19:00 ` Andreas Rheinhardt 2024-01-26 19:15 ` Connor Worley
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=AS8P250MB07447397C696EACA1C2FABF58F7B2@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