forked from FFmpeg/FFmpeg
avfilter/vf_limiter: refactor slice functions
This commit is contained in:
parent
ebcde3fda8
commit
b8e58f0858
1 changed files with 21 additions and 34 deletions
|
@ -88,42 +88,29 @@ static const enum AVPixelFormat pix_fmts[] = {
|
||||||
AV_PIX_FMT_NONE
|
AV_PIX_FMT_NONE
|
||||||
};
|
};
|
||||||
|
|
||||||
static void limiter8(const uint8_t *src, uint8_t *dst,
|
#define LIMITER(n, type) \
|
||||||
ptrdiff_t slinesize, ptrdiff_t dlinesize,
|
static void limiter##n(const uint8_t *ssrc, uint8_t *ddst, \
|
||||||
int w, int h, int min, int max)
|
ptrdiff_t slinesize, ptrdiff_t dlinesize,\
|
||||||
{
|
int w, int h, int min, int max) \
|
||||||
int x, y;
|
{ \
|
||||||
|
const type *src = (const type *)ssrc; \
|
||||||
for (y = 0; y < h; y++) {
|
type *dst = (type *)ddst; \
|
||||||
for (x = 0; x < w; x++) {
|
\
|
||||||
dst[x] = av_clip(src[x], min, max);
|
dlinesize /= sizeof(type); \
|
||||||
}
|
slinesize /= sizeof(type); \
|
||||||
|
\
|
||||||
dst += dlinesize;
|
for (int y = 0; y < h; y++) { \
|
||||||
src += slinesize;
|
for (int x = 0; x < w; x++) { \
|
||||||
}
|
dst[x] = av_clip(src[x], min, max); \
|
||||||
|
} \
|
||||||
|
\
|
||||||
|
dst += dlinesize; \
|
||||||
|
src += slinesize; \
|
||||||
|
} \
|
||||||
}
|
}
|
||||||
|
|
||||||
static void limiter16(const uint8_t *ssrc, uint8_t *ddst,
|
LIMITER(8, uint8_t)
|
||||||
ptrdiff_t slinesize, ptrdiff_t dlinesize,
|
LIMITER(16, uint16_t)
|
||||||
int w, int h, int min, int max)
|
|
||||||
{
|
|
||||||
const uint16_t *src = (const uint16_t *)ssrc;
|
|
||||||
uint16_t *dst = (uint16_t *)ddst;
|
|
||||||
int x, y;
|
|
||||||
|
|
||||||
dlinesize /= 2;
|
|
||||||
slinesize /= 2;
|
|
||||||
|
|
||||||
for (y = 0; y < h; y++) {
|
|
||||||
for (x = 0; x < w; x++) {
|
|
||||||
dst[x] = av_clip(src[x], min, max);
|
|
||||||
}
|
|
||||||
|
|
||||||
dst += dlinesize;
|
|
||||||
src += slinesize;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static int config_input(AVFilterLink *inlink)
|
static int config_input(AVFilterLink *inlink)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Reference in a new issue