aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRamiro Polla <ramiro.polla@gmail.com>2024-08-09 13:26:11 +0200
committerRamiro Polla <ramiro.polla@gmail.com>2024-08-26 11:04:46 +0200
commit88a563ad180a04affa2926609e8b3c54b16bcb36 (patch)
treef52518718b65c1bbf5cac68ecb2a52a91835bb6e
parenta2e01cade80cf297a5569b390058f2a9115d3db5 (diff)
downloadffmpeg-88a563ad180a04affa2926609e8b3c54b16bcb36.tar.gz
swscale: export ff_copyPlane so it may be used by simd code
-rw-r--r--libswscale/swscale_internal.h4
-rw-r--r--libswscale/swscale_unscaled.c42
2 files changed, 25 insertions, 21 deletions
diff --git a/libswscale/swscale_internal.h b/libswscale/swscale_internal.h
index e5610161d0..50127d288f 100644
--- a/libswscale/swscale_internal.h
+++ b/libswscale/swscale_internal.h
@@ -1009,6 +1009,10 @@ int ff_sws_alphablendaway(SwsContext *c, const uint8_t *src[],
int srcStride[], int srcSliceY, int srcSliceH,
uint8_t *dst[], int dstStride[]);
+void ff_copyPlane(const uint8_t *src, int srcStride,
+ int srcSliceY, int srcSliceH, int width,
+ uint8_t *dst, int dstStride);
+
static inline void fillPlane16(uint8_t *plane, int stride, int width, int height, int y,
int alpha, int bits, const int big_endian)
{
diff --git a/libswscale/swscale_unscaled.c b/libswscale/swscale_unscaled.c
index 239258ab8c..dc1d5f3593 100644
--- a/libswscale/swscale_unscaled.c
+++ b/libswscale/swscale_unscaled.c
@@ -122,9 +122,9 @@ static void fillPlane(uint8_t *plane, int stride, int width, int height, int y,
}
}
-static void copyPlane(const uint8_t *src, int srcStride,
- int srcSliceY, int srcSliceH, int width,
- uint8_t *dst, int dstStride)
+void ff_copyPlane(const uint8_t *src, int srcStride,
+ int srcSliceY, int srcSliceH, int width,
+ uint8_t *dst, int dstStride)
{
dst += dstStride * srcSliceY;
if (dstStride == srcStride && srcStride > 0) {
@@ -146,8 +146,8 @@ static int planarToNv12Wrapper(SwsContext *c, const uint8_t *src[],
{
uint8_t *dst = dstParam[1] + dstStride[1] * srcSliceY / 2;
- copyPlane(src[0], srcStride[0], srcSliceY, srcSliceH, c->srcW,
- dstParam[0], dstStride[0]);
+ ff_copyPlane(src[0], srcStride[0], srcSliceY, srcSliceH, c->srcW,
+ dstParam[0], dstStride[0]);
if (c->dstFormat == AV_PIX_FMT_NV12)
interleaveBytes(src[1], src[2], dst, c->chrSrcW, (srcSliceH + 1) / 2,
@@ -167,8 +167,8 @@ static int nv12ToPlanarWrapper(SwsContext *c, const uint8_t *src[],
uint8_t *dst1 = dstParam[1] + dstStride[1] * srcSliceY / 2;
uint8_t *dst2 = dstParam[2] + dstStride[2] * srcSliceY / 2;
- copyPlane(src[0], srcStride[0], srcSliceY, srcSliceH, c->srcW,
- dstParam[0], dstStride[0]);
+ ff_copyPlane(src[0], srcStride[0], srcSliceY, srcSliceH, c->srcW,
+ dstParam[0], dstStride[0]);
if (c->srcFormat == AV_PIX_FMT_NV12)
deinterleaveBytes(src[1], dst1, dst2, c->chrSrcW, (srcSliceH + 1) / 2,
@@ -187,8 +187,8 @@ static int planarToNv24Wrapper(SwsContext *c, const uint8_t *src[],
{
uint8_t *dst = dstParam[1] + dstStride[1] * srcSliceY;
- copyPlane(src[0], srcStride[0], srcSliceY, srcSliceH, c->srcW,
- dstParam[0], dstStride[0]);
+ ff_copyPlane(src[0], srcStride[0], srcSliceY, srcSliceH, c->srcW,
+ dstParam[0], dstStride[0]);
if (c->dstFormat == AV_PIX_FMT_NV24)
interleaveBytes(src[1], src[2], dst, c->chrSrcW, srcSliceH,
@@ -208,8 +208,8 @@ static int nv24ToPlanarWrapper(SwsContext *c, const uint8_t *src[],
uint8_t *dst1 = dstParam[1] + dstStride[1] * srcSliceY;
uint8_t *dst2 = dstParam[2] + dstStride[2] * srcSliceY;
- copyPlane(src[0], srcStride[0], srcSliceY, srcSliceH, c->srcW,
- dstParam[0], dstStride[0]);
+ ff_copyPlane(src[0], srcStride[0], srcSliceY, srcSliceH, c->srcW,
+ dstParam[0], dstStride[0]);
if (c->srcFormat == AV_PIX_FMT_NV24)
deinterleaveBytes(src[1], dst1, dst2, c->chrSrcW, srcSliceH,
@@ -250,8 +250,8 @@ static int nv24ToYuv420Wrapper(SwsContext *c, const uint8_t *src[],
uint8_t *dst1 = dstParam[1] + dstStride[1] * srcSliceY / 2;
uint8_t *dst2 = dstParam[2] + dstStride[2] * srcSliceY / 2;
- copyPlane(src[0], srcStride[0], srcSliceY, srcSliceH, c->srcW,
- dstParam[0], dstStride[0]);
+ ff_copyPlane(src[0], srcStride[0], srcSliceY, srcSliceH, c->srcW,
+ dstParam[0], dstStride[0]);
if (c->srcFormat == AV_PIX_FMT_NV24)
nv24_to_yuv420p_chroma(dst1, dstStride[1], dst2, dstStride[2],
@@ -1173,12 +1173,12 @@ static int planarRgbToplanarRgbWrapper(SwsContext *c,
int srcSliceY, int srcSliceH,
uint8_t *dst[], int dstStride[])
{
- copyPlane(src[0], srcStride[0], srcSliceY, srcSliceH, c->srcW,
- dst[0], dstStride[0]);
- copyPlane(src[1], srcStride[1], srcSliceY, srcSliceH, c->srcW,
- dst[1], dstStride[1]);
- copyPlane(src[2], srcStride[2], srcSliceY, srcSliceH, c->srcW,
- dst[2], dstStride[2]);
+ ff_copyPlane(src[0], srcStride[0], srcSliceY, srcSliceH, c->srcW,
+ dst[0], dstStride[0]);
+ ff_copyPlane(src[1], srcStride[1], srcSliceY, srcSliceH, c->srcW,
+ dst[1], dstStride[1]);
+ ff_copyPlane(src[2], srcStride[2], srcSliceY, srcSliceH, c->srcW,
+ dst[2], dstStride[2]);
if (dst[3])
fillPlane(dst[3], dstStride[3], c->srcW, srcSliceH, srcSliceY, 255);
@@ -1700,8 +1700,8 @@ static int yvu9ToYv12Wrapper(SwsContext *c, const uint8_t *src[],
int srcStride[], int srcSliceY, int srcSliceH,
uint8_t *dst[], int dstStride[])
{
- copyPlane(src[0], srcStride[0], srcSliceY, srcSliceH, c->srcW,
- dst[0], dstStride[0]);
+ ff_copyPlane(src[0], srcStride[0], srcSliceY, srcSliceH, c->srcW,
+ dst[0], dstStride[0]);
planar2x(src[1], dst[1] + dstStride[1] * (srcSliceY >> 1), c->chrSrcW,
srcSliceH >> 2, srcStride[1], dstStride[1]);