[FFmpeg-cvslog] swscale: make yuv2interleavedX more asm-friendly
Nelson Gomez
git at videolan.org
Sun Jun 14 18:49:51 EEST 2020
ffmpeg | branch: master | Nelson Gomez <nelson.gomez at microsoft.com> | Sat Apr 25 19:37:01 2020 -0700| [7c39c3c1a6f35a6b47970417b1e273141eadb856] | committer: Josh de Kock
swscale: make yuv2interleavedX more asm-friendly
Extracting information from SwsContext in assembly is difficult, and
rearranging SwsContext just for asm access didn't look good. These
functions only need a couple of fields from it anyway, so just make
them parameters in their own right.
Signed-off-by: Nelson Gomez <nelson.gomez at microsoft.com>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=7c39c3c1a6f35a6b47970417b1e273141eadb856
---
libswscale/output.c | 12 +++++-------
libswscale/swscale_internal.h | 5 +++--
libswscale/vscale.c | 2 +-
3 files changed, 9 insertions(+), 10 deletions(-)
diff --git a/libswscale/output.c b/libswscale/output.c
index 257b07abbc..8903cf79b2 100644
--- a/libswscale/output.c
+++ b/libswscale/output.c
@@ -180,7 +180,7 @@ yuv2planeX_16_c_template(const int16_t *filter, int filterSize,
}
}
-static void yuv2p016cX_c(SwsContext *c, const int16_t *chrFilter, int chrFilterSize,
+static void yuv2p016cX_c(enum AVPixelFormat dstFormat, const uint8_t *chrDither, const int16_t *chrFilter, int chrFilterSize,
const int16_t **chrUSrc, const int16_t **chrVSrc,
uint8_t *dest8, int chrDstW)
{
@@ -188,7 +188,7 @@ static void yuv2p016cX_c(SwsContext *c, const int16_t *chrFilter, int chrFilterS
const int32_t **uSrc = (const int32_t **)chrUSrc;
const int32_t **vSrc = (const int32_t **)chrVSrc;
int shift = 15;
- int big_endian = c->dstFormat == AV_PIX_FMT_P016BE;
+ int big_endian = dstFormat == AV_PIX_FMT_P016BE;
int i, j;
for (i = 0; i < chrDstW; i++) {
@@ -402,12 +402,10 @@ static void yuv2plane1_8_c(const int16_t *src, uint8_t *dest, int dstW,
}
}
-static void yuv2nv12cX_c(SwsContext *c, const int16_t *chrFilter, int chrFilterSize,
+static void yuv2nv12cX_c(enum AVPixelFormat dstFormat, const uint8_t *chrDither, const int16_t *chrFilter, int chrFilterSize,
const int16_t **chrUSrc, const int16_t **chrVSrc,
uint8_t *dest, int chrDstW)
{
- enum AVPixelFormat dstFormat = c->dstFormat;
- const uint8_t *chrDither = c->chrDither8;
int i;
if (dstFormat == AV_PIX_FMT_NV12 ||
@@ -477,13 +475,13 @@ static void yuv2p010lX_c(const int16_t *filter, int filterSize,
}
}
-static void yuv2p010cX_c(SwsContext *c, const int16_t *chrFilter, int chrFilterSize,
+static void yuv2p010cX_c(enum AVPixelFormat dstFormat, const uint8_t *chrDither, const int16_t *chrFilter, int chrFilterSize,
const int16_t **chrUSrc, const int16_t **chrVSrc,
uint8_t *dest8, int chrDstW)
{
uint16_t *dest = (uint16_t*)dest8;
int shift = 17;
- int big_endian = c->dstFormat == AV_PIX_FMT_P010BE;
+ int big_endian = dstFormat == AV_PIX_FMT_P010BE;
int i, j;
for (i = 0; i < chrDstW; i++) {
diff --git a/libswscale/swscale_internal.h b/libswscale/swscale_internal.h
index ee46092ff6..b37d650967 100644
--- a/libswscale/swscale_internal.h
+++ b/libswscale/swscale_internal.h
@@ -119,7 +119,8 @@ typedef void (*yuv2planarX_fn)(const int16_t *filter, int filterSize,
* Write one line of horizontally scaled chroma to interleaved output
* with multi-point vertical scaling between input pixels.
*
- * @param c SWS scaling context
+ * @param dstFormat destination pixel format
+ * @param chrDither ordered dither array of type uint8_t and size 8
* @param chrFilter vertical chroma scaling coefficients, 12 bits [0,4096]
* @param chrUSrc scaled chroma (U) source data, 15 bits for 8-10-bit
* output, 19 bits for 16-bit output (in int32_t)
@@ -130,7 +131,7 @@ typedef void (*yuv2planarX_fn)(const int16_t *filter, int filterSize,
* output, this is in uint16_t
* @param dstW width of chroma planes
*/
-typedef void (*yuv2interleavedX_fn)(struct SwsContext *c,
+typedef void (*yuv2interleavedX_fn)(enum AVPixelFormat dstFormat, const uint8_t *chrDither,
const int16_t *chrFilter,
int chrFilterSize,
const int16_t **chrUSrc,
diff --git a/libswscale/vscale.c b/libswscale/vscale.c
index 9ed227e908..500217239c 100644
--- a/libswscale/vscale.c
+++ b/libswscale/vscale.c
@@ -92,7 +92,7 @@ static int chr_planar_vscale(SwsContext *c, SwsFilterDescriptor *desc, int slice
uint16_t *filter = inst->filter[0] + (inst->isMMX ? 0 : chrSliceY * inst->filter_size);
if (c->yuv2nv12cX) {
- inst->pfn.yuv2interleavedX(c, filter, inst->filter_size, (const int16_t**)src1, (const int16_t**)src2, dst1[0], dstW);
+ inst->pfn.yuv2interleavedX(c->dstFormat, c->chrDither8, filter, inst->filter_size, (const int16_t**)src1, (const int16_t**)src2, dst1[0], dstW);
} else if (inst->filter_size == 1) {
inst->pfn.yuv2planar1((const int16_t*)src1[0], dst1[0], dstW, c->chrDither8, 0);
inst->pfn.yuv2planar1((const int16_t*)src2[0], dst2[0], dstW, c->chrDither8, 3);
More information about the ffmpeg-cvslog
mailing list