From: Andreas Rheinhardt <andreas.rheinhardt@outlook.com> To: ffmpeg-devel@ffmpeg.org Cc: Andreas Rheinhardt <andreas.rheinhardt@outlook.com> Subject: [FFmpeg-devel] [PATCH 10/18] swscale/swscale_internal: Don't export internal function Date: Fri, 29 Mar 2024 00:10:39 +0100 Message-ID: <AS8P250MB0744D7B3AD419C72B0293A1E8F3B2@AS8P250MB0744.EURP250.PROD.OUTLOOK.COM> (raw) In-Reply-To: <GV1P250MB07376DB62F134F911FBD81A18F3B2@GV1P250MB0737.EURP250.PROD.OUTLOOK.COM> sws_alloc_set_opts() can actually be made internal to utils.c. This commit does so. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com> --- libswscale/swscale_internal.h | 11 ----- libswscale/utils.c | 83 ++++++++++++++++++----------------- 2 files changed, 43 insertions(+), 51 deletions(-) diff --git a/libswscale/swscale_internal.h b/libswscale/swscale_internal.h index d7faa5e165..c2cc736dd2 100644 --- a/libswscale/swscale_internal.h +++ b/libswscale/swscale_internal.h @@ -1003,17 +1003,6 @@ void ff_hcscale_fast_mmxext(SwsContext *c, int16_t *dst1, int16_t *dst2, int dstWidth, const uint8_t *src1, const uint8_t *src2, int srcW, int xInc); -/** - * Allocate and return an SwsContext. - * This is like sws_getContext() but does not perform the init step, allowing - * the user to set additional AVOptions. - * - * @see sws_getContext() - */ -struct SwsContext *sws_alloc_set_opts(int srcW, int srcH, enum AVPixelFormat srcFormat, - int dstW, int dstH, enum AVPixelFormat dstFormat, - int flags, const double *param); - int ff_sws_alphablendaway(SwsContext *c, const uint8_t *src[], int srcStride[], int srcSliceY, int srcSliceH, uint8_t *dst[], int dstStride[]); diff --git a/libswscale/utils.c b/libswscale/utils.c index ab8a68e241..cb6e91db06 100644 --- a/libswscale/utils.c +++ b/libswscale/utils.c @@ -269,6 +269,34 @@ static const FormatEntry format_entries[] = { [AV_PIX_FMT_XV36LE] = { 1, 1 }, }; +/** + * Allocate and return an SwsContext without performing initialization. + */ +static SwsContext *alloc_set_opts(int srcW, int srcH, enum AVPixelFormat srcFormat, + int dstW, int dstH, enum AVPixelFormat dstFormat, + int flags, const double *param) +{ + SwsContext *c = sws_alloc_context(); + + if (!c) + return NULL; + + c->flags = flags; + c->srcW = srcW; + c->srcH = srcH; + c->dstW = dstW; + c->dstH = dstH; + c->srcFormat = srcFormat; + c->dstFormat = dstFormat; + + if (param) { + c->param[0] = param[0]; + c->param[1] = param[1]; + } + + return c; +} + int ff_shuffle_filter_coefficients(SwsContext *c, int *filterPos, int filterSize, int16_t *filter, int dstW) @@ -1101,9 +1129,9 @@ int sws_setColorspaceDetails(struct SwsContext *c, const int inv_table[4], if (ret < 0) return ret; - c->cascaded_context[0] = sws_alloc_set_opts(srcW, srcH, c->srcFormat, - tmp_width, tmp_height, tmp_format, - c->flags, c->param); + c->cascaded_context[0] = alloc_set_opts(srcW, srcH, c->srcFormat, + tmp_width, tmp_height, tmp_format, + c->flags, c->param); if (!c->cascaded_context[0]) return -1; @@ -1116,9 +1144,9 @@ int sws_setColorspaceDetails(struct SwsContext *c, const int inv_table[4], srcRange, table, dstRange, brightness, contrast, saturation); - c->cascaded_context[1] = sws_alloc_set_opts(tmp_width, tmp_height, tmp_format, - dstW, dstH, c->dstFormat, - c->flags, c->param); + c->cascaded_context[1] = alloc_set_opts(tmp_width, tmp_height, tmp_format, + dstW, dstH, c->dstFormat, + c->flags, c->param); if (!c->cascaded_context[1]) return -1; c->cascaded_context[1]->srcRange = srcRange; @@ -1682,9 +1710,9 @@ static av_cold int sws_init_single_context(SwsContext *c, SwsFilter *srcFilter, if (ret < 0) return ret; - c->cascaded_context[0] = sws_alloc_set_opts(srcW, srcH, srcFormat, - srcW, srcH, tmpFormat, - flags, c->param); + c->cascaded_context[0] = alloc_set_opts(srcW, srcH, srcFormat, + srcW, srcH, tmpFormat, + flags, c->param); if (!c->cascaded_context[0]) return AVERROR(EINVAL); c->cascaded_context[0]->alphablend = c->alphablend; @@ -1692,9 +1720,9 @@ static av_cold int sws_init_single_context(SwsContext *c, SwsFilter *srcFilter, if (ret < 0) return ret; - c->cascaded_context[1] = sws_alloc_set_opts(srcW, srcH, tmpFormat, - dstW, dstH, dstFormat, - flags, c->param); + c->cascaded_context[1] = alloc_set_opts(srcW, srcH, tmpFormat, + dstW, dstH, dstFormat, + flags, c->param); if (!c->cascaded_context[1]) return AVERROR(EINVAL); @@ -2066,31 +2094,6 @@ av_cold int sws_init_context(SwsContext *c, SwsFilter *srcFilter, return sws_init_single_context(c, srcFilter, dstFilter); } -SwsContext *sws_alloc_set_opts(int srcW, int srcH, enum AVPixelFormat srcFormat, - int dstW, int dstH, enum AVPixelFormat dstFormat, - int flags, const double *param) -{ - SwsContext *c; - - if (!(c = sws_alloc_context())) - return NULL; - - c->flags = flags; - c->srcW = srcW; - c->srcH = srcH; - c->dstW = dstW; - c->dstH = dstH; - c->srcFormat = srcFormat; - c->dstFormat = dstFormat; - - if (param) { - c->param[0] = param[0]; - c->param[1] = param[1]; - } - - return c; -} - SwsContext *sws_getContext(int srcW, int srcH, enum AVPixelFormat srcFormat, int dstW, int dstH, enum AVPixelFormat dstFormat, int flags, SwsFilter *srcFilter, @@ -2098,9 +2101,9 @@ SwsContext *sws_getContext(int srcW, int srcH, enum AVPixelFormat srcFormat, { SwsContext *c; - c = sws_alloc_set_opts(srcW, srcH, srcFormat, - dstW, dstH, dstFormat, - flags, param); + c = alloc_set_opts(srcW, srcH, srcFormat, + dstW, dstH, dstFormat, + flags, param); if (!c) return NULL; -- 2.40.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-03-28 23:12 UTC|newest] Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top 2024-03-28 22:38 [FFmpeg-devel] [PATCH 01/18] avcodec/mips/ac3dsp_mips: Add missing includes Andreas Rheinhardt 2024-03-28 23:10 ` [FFmpeg-devel] [PATCH 02/18] avcodec/pcm-bluray/dvd: Use correct pointer types on BE Andreas Rheinhardt 2024-07-30 9:18 ` Sebastian Ramacher 2024-03-28 23:10 ` [FFmpeg-devel] [PATCH 03/18] swscale/ppc/swscale_altivec: Fix build with -O0 Andreas Rheinhardt 2024-03-28 23:10 ` [FFmpeg-devel] [PATCH 04/18] swscale/ppc/swscale_altivec: Simplify macro Andreas Rheinhardt 2024-03-28 23:10 ` [FFmpeg-devel] [PATCH 05/18] avcodec, avfilter: Don't use "" for system headers Andreas Rheinhardt 2024-03-28 23:10 ` [FFmpeg-devel] [PATCH 06/18] postproc/postprocess: Don't generally include arch-specific headers Andreas Rheinhardt 2024-03-29 14:54 ` Sean McGovern 2024-03-28 23:10 ` [FFmpeg-devel] [PATCH 07/18] swscale/swscale_internal: Only include altivec header iff HAVE_ALTIVEC Andreas Rheinhardt 2024-03-29 14:55 ` Sean McGovern 2024-03-28 23:10 ` [FFmpeg-devel] [PATCH 08/18] avcodec/msmpeg4: Don't include x86-specific header unconditionally Andreas Rheinhardt 2024-03-28 23:10 ` [FFmpeg-devel] [PATCH 09/18] swscale/swscale_internal: Hoist branch out of loop Andreas Rheinhardt 2024-03-28 23:10 ` Andreas Rheinhardt [this message] 2024-03-28 23:10 ` [FFmpeg-devel] [PATCH 11/18] lib*/version: Use static_assert for static asserts Andreas Rheinhardt 2024-03-28 23:10 ` [FFmpeg-devel] [PATCH 12/18] avutil/common: Don't auto-include mem.h Andreas Rheinhardt 2024-03-28 23:10 ` [FFmpeg-devel] [PATCH 13/18] avcodec/arm/mpegvideo_arm: Use static_assert to check offsets Andreas Rheinhardt 2024-03-28 23:10 ` [FFmpeg-devel] [PATCH 14/18] avutil/internal: Move libm inclusion to the beginning Andreas Rheinhardt 2024-03-28 23:10 ` [FFmpeg-devel] [PATCH 15/18] avutil/internal: Move FF_MEMORY_POISON to its only user Andreas Rheinhardt 2024-03-28 23:10 ` [FFmpeg-devel] [PATCH 16/18] avutil/hwcontext_vulkan: Include hwcontext.h Andreas Rheinhardt 2024-03-28 23:10 ` [FFmpeg-devel] [PATCH 17/18] avutil/internal: Move avpriv_set_systematic_pal2 decl to imgutils_internal.h Andreas Rheinhardt 2024-03-28 23:10 ` [FFmpeg-devel] [PATCH 18/18] avcodec/arm/vp8: Don't discard const Andreas Rheinhardt 2024-03-30 13:47 ` [FFmpeg-devel] [PATCH 01/18] avcodec/mips/ac3dsp_mips: Add missing includes 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=AS8P250MB0744D7B3AD419C72B0293A1E8F3B2@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