Commit f2de9118 authored by Timo Rothenpieler's avatar Timo Rothenpieler

swscale: add opaque parameter to input functions

parent ef2c2a22
......@@ -105,18 +105,18 @@ static int lum_convert(SwsContext *c, SwsFilterDescriptor *desc, int sliceY, int
uint8_t * dst = desc->dst->plane[0].line[i];
if (c->lumToYV12) {
c->lumToYV12(dst, src[0], src[1], src[2], srcW, pal);
c->lumToYV12(dst, src[0], src[1], src[2], srcW, pal, c->input_opaque);
} else if (c->readLumPlanar) {
c->readLumPlanar(dst, src, srcW, c->input_rgb2yuv_table);
c->readLumPlanar(dst, src, srcW, c->input_rgb2yuv_table, c->input_opaque);
}
if (desc->alpha) {
dst = desc->dst->plane[3].line[i];
if (c->alpToYV12) {
c->alpToYV12(dst, src[3], src[1], src[2], srcW, pal);
c->alpToYV12(dst, src[3], src[1], src[2], srcW, pal, c->input_opaque);
} else if (c->readAlpPlanar) {
c->readAlpPlanar(dst, src, srcW, NULL);
c->readAlpPlanar(dst, src, srcW, NULL, c->input_opaque);
}
}
}
......@@ -224,9 +224,9 @@ static int chr_convert(SwsContext *c, SwsFilterDescriptor *desc, int sliceY, int
uint8_t * dst1 = desc->dst->plane[1].line[i];
uint8_t * dst2 = desc->dst->plane[2].line[i];
if (c->chrToYV12) {
c->chrToYV12(dst1, dst2, src[0], src[1], src[2], srcW, pal);
c->chrToYV12(dst1, dst2, src[0], src[1], src[2], srcW, pal, c->input_opaque);
} else if (c->readChrPlanar) {
c->readChrPlanar(dst1, dst2, src, srcW, c->input_rgb2yuv_table);
c->readChrPlanar(dst1, dst2, src, srcW, c->input_rgb2yuv_table, c->input_opaque);
}
}
return sliceH;
......
This diff is collapsed.
......@@ -559,26 +559,31 @@ typedef struct SwsContext {
yuv2packedX_fn yuv2packedX;
yuv2anyX_fn yuv2anyX;
/// Opaque data pointer passed to all input functions.
void *input_opaque;
/// Unscaled conversion of luma plane to YV12 for horizontal scaler.
void (*lumToYV12)(uint8_t *dst, const uint8_t *src, const uint8_t *src2, const uint8_t *src3,
int width, uint32_t *pal);
int width, uint32_t *pal, void *opq);
/// Unscaled conversion of alpha plane to YV12 for horizontal scaler.
void (*alpToYV12)(uint8_t *dst, const uint8_t *src, const uint8_t *src2, const uint8_t *src3,
int width, uint32_t *pal);
int width, uint32_t *pal, void *opq);
/// Unscaled conversion of chroma planes to YV12 for horizontal scaler.
void (*chrToYV12)(uint8_t *dstU, uint8_t *dstV,
const uint8_t *src1, const uint8_t *src2, const uint8_t *src3,
int width, uint32_t *pal);
int width, uint32_t *pal, void *opq);
/**
* Functions to read planar input, such as planar RGB, and convert
* internally to Y/UV/A.
*/
/** @{ */
void (*readLumPlanar)(uint8_t *dst, const uint8_t *src[4], int width, int32_t *rgb2yuv);
void (*readLumPlanar)(uint8_t *dst, const uint8_t *src[4], int width, int32_t *rgb2yuv,
void *opq);
void (*readChrPlanar)(uint8_t *dstU, uint8_t *dstV, const uint8_t *src[4],
int width, int32_t *rgb2yuv);
void (*readAlpPlanar)(uint8_t *dst, const uint8_t *src[4], int width, int32_t *rgb2yuv);
int width, int32_t *rgb2yuv, void *opq);
void (*readAlpPlanar)(uint8_t *dst, const uint8_t *src[4], int width, int32_t *rgb2yuv,
void *opq);
/** @} */
/**
......
......@@ -296,13 +296,13 @@ VSCALE_FUNCS(avx, avx);
#define INPUT_Y_FUNC(fmt, opt) \
void ff_ ## fmt ## ToY_ ## opt(uint8_t *dst, const uint8_t *src, \
const uint8_t *unused1, const uint8_t *unused2, \
int w, uint32_t *unused)
int w, uint32_t *unused, void *opq)
#define INPUT_UV_FUNC(fmt, opt) \
void ff_ ## fmt ## ToUV_ ## opt(uint8_t *dstU, uint8_t *dstV, \
const uint8_t *unused0, \
const uint8_t *src1, \
const uint8_t *src2, \
int w, uint32_t *unused)
int w, uint32_t *unused, void *opq)
#define INPUT_FUNC(fmt, opt) \
INPUT_Y_FUNC(fmt, opt); \
INPUT_UV_FUNC(fmt, opt)
......@@ -370,15 +370,18 @@ YUV2GBRP_DECL(avx2);
#define INPUT_PLANAR_RGB_Y_FN_DECL(fmt, opt) \
void ff_planar_##fmt##_to_y_##opt(uint8_t *dst, \
const uint8_t *src[4], int w, int32_t *rgb2yuv)
const uint8_t *src[4], int w, int32_t *rgb2yuv, \
void *opq)
#define INPUT_PLANAR_RGB_UV_FN_DECL(fmt, opt) \
void ff_planar_##fmt##_to_uv_##opt(uint8_t *dstU, uint8_t *dstV, \
const uint8_t *src[4], int w, int32_t *rgb2yuv)
const uint8_t *src[4], int w, int32_t *rgb2yuv, \
void *opq)
#define INPUT_PLANAR_RGB_A_FN_DECL(fmt, opt) \
void ff_planar_##fmt##_to_a_##opt(uint8_t *dst, \
const uint8_t *src[4], int w, int32_t *rgb2yuv)
const uint8_t *src[4], int w, int32_t *rgb2yuv, \
void *opq)
#define INPUT_PLANAR_RGBXX_A_DECL(fmt, opt) \
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment