[FFmpeg-devel] [PATCH 06/12] swscale/internal: expose low level swscale() internally
Niklas Haas
ffmpeg at haasn.xyz
Sat Oct 5 22:23:57 EEST 2024
From: Niklas Haas <git at haasn.dev>
And give it const parameters while we're at it, because this function does
not mutate its parameters.
Used as an intermediate entry point for the new swscale context.
Sponsored-by: Sovereign Tech Fund
Signed-off-by: Niklas Haas <git at haasn.dev>
---
libswscale/slice.c | 3 ++-
libswscale/swscale.c | 11 +++++------
libswscale/swscale_internal.h | 8 +++++++-
3 files changed, 14 insertions(+), 8 deletions(-)
diff --git a/libswscale/slice.c b/libswscale/slice.c
index 1cc3f6c405..119bfbdb8d 100644
--- a/libswscale/slice.c
+++ b/libswscale/slice.c
@@ -145,7 +145,8 @@ int ff_rotate_slice(SwsSlice *s, int lum, int chr)
return 0;
}
-int ff_init_slice_from_src(SwsSlice * s, uint8_t *src[4], int stride[4], int srcW, int lumY, int lumH, int chrY, int chrH, int relative)
+int ff_init_slice_from_src(SwsSlice * s, uint8_t *const src[4], const int stride[4],
+ int srcW, int lumY, int lumH, int chrY, int chrH, int relative)
{
int i = 0;
diff --git a/libswscale/swscale.c b/libswscale/swscale.c
index b9ec976be0..4ba35a61e1 100644
--- a/libswscale/swscale.c
+++ b/libswscale/swscale.c
@@ -233,10 +233,9 @@ static void lumRangeFromJpeg16_c(int16_t *_dst, int width)
if (DEBUG_SWSCALE_BUFFERS) \
av_log(c, AV_LOG_DEBUG, __VA_ARGS__)
-static int swscale(SwsContext *c, const uint8_t *src[],
- int srcStride[], int srcSliceY, int srcSliceH,
- uint8_t *dst[], int dstStride[],
- int dstSliceY, int dstSliceH)
+int ff_swscale(SwsContext *c, const uint8_t *src[], int srcStride[],
+ int srcSliceY, int srcSliceH, uint8_t *dst[],
+ const int dstStride[], int dstSliceY, int dstSliceH)
{
const int scale_dst = dstSliceY > 0 || dstSliceH < c->dstH;
@@ -1053,8 +1052,8 @@ static int scale_internal(SwsContext *c,
if (scale_dst)
dst2[0] += dstSliceY * dstStride2[0];
} else {
- ret = swscale(c, src2, srcStride2, srcSliceY_internal, srcSliceH,
- dst2, dstStride2, dstSliceY, dstSliceH);
+ ret = ff_swscale(c, src2, srcStride2, srcSliceY_internal, srcSliceH,
+ dst2, dstStride2, dstSliceY, dstSliceH);
}
if (c->dstXYZ && !(c->srcXYZ && c->srcW==c->dstW && c->srcH==c->dstH)) {
diff --git a/libswscale/swscale_internal.h b/libswscale/swscale_internal.h
index 17440c99c4..33f9404b34 100644
--- a/libswscale/swscale_internal.h
+++ b/libswscale/swscale_internal.h
@@ -1100,7 +1100,8 @@ typedef struct SwsFilterDescriptor
// warp input lines in the form (src + width*i + j) to slice format (line[i][j])
// relative=true means first line src[x][0] otherwise first line is src[x][lum/crh Y]
-int ff_init_slice_from_src(SwsSlice * s, uint8_t *src[4], int stride[4], int srcW, int lumY, int lumH, int chrY, int chrH, int relative);
+int ff_init_slice_from_src(SwsSlice * s, uint8_t *const src[4], const int stride[4],
+ int srcW, int lumY, int lumH, int chrY, int chrH, int relative);
// Initialize scaler filter descriptor chain
int ff_init_filters(SwsContext *c);
@@ -1144,6 +1145,11 @@ void ff_init_vscale_pfn(SwsContext *c, yuv2planar1_fn yuv2plane1, yuv2planarX_fn
void ff_sws_slice_worker(void *priv, int jobnr, int threadnr,
int nb_jobs, int nb_threads);
+int ff_swscale(SwsContext *c, const uint8_t *src[], int srcStride[],
+ int srcSliceY, int srcSliceH, uint8_t *dst[],
+ const int dstStride[], int dstSliceY, int dstSliceH);
+
+
//number of extra lines to process
#define MAX_LINES_AHEAD 4
--
2.46.1
More information about the ffmpeg-devel
mailing list