mirror of
https://git.ffmpeg.org/ffmpeg.git
synced 2025-03-30 07:08:22 +00:00
avfilter/vf_dblur: add float formats support
This commit is contained in:
parent
6a9cb5a7ba
commit
0aa7142442
@ -131,6 +131,7 @@ static const enum AVPixelFormat pix_fmts[] = {
|
|||||||
AV_PIX_FMT_GBRP12, AV_PIX_FMT_GBRP14, AV_PIX_FMT_GBRP16,
|
AV_PIX_FMT_GBRP12, AV_PIX_FMT_GBRP14, AV_PIX_FMT_GBRP16,
|
||||||
AV_PIX_FMT_GBRAP, AV_PIX_FMT_GBRAP10, AV_PIX_FMT_GBRAP12, AV_PIX_FMT_GBRAP16,
|
AV_PIX_FMT_GBRAP, AV_PIX_FMT_GBRAP10, AV_PIX_FMT_GBRAP12, AV_PIX_FMT_GBRAP16,
|
||||||
AV_PIX_FMT_GRAY8, AV_PIX_FMT_GRAY9, AV_PIX_FMT_GRAY10, AV_PIX_FMT_GRAY12, AV_PIX_FMT_GRAY14, AV_PIX_FMT_GRAY16,
|
AV_PIX_FMT_GRAY8, AV_PIX_FMT_GRAY9, AV_PIX_FMT_GRAY10, AV_PIX_FMT_GRAY12, AV_PIX_FMT_GRAY14, AV_PIX_FMT_GRAY16,
|
||||||
|
AV_PIX_FMT_GRAYF32, AV_PIX_FMT_GBRPF32, AV_PIX_FMT_GBRAPF32,
|
||||||
AV_PIX_FMT_NONE
|
AV_PIX_FMT_NONE
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -214,8 +215,10 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in)
|
|||||||
float *bptr = s->buffer;
|
float *bptr = s->buffer;
|
||||||
const uint8_t *src = in->data[plane];
|
const uint8_t *src = in->data[plane];
|
||||||
const uint16_t *src16 = (const uint16_t *)in->data[plane];
|
const uint16_t *src16 = (const uint16_t *)in->data[plane];
|
||||||
|
const float *src32 = (const float *)in->data[plane];
|
||||||
uint8_t *dst = out->data[plane];
|
uint8_t *dst = out->data[plane];
|
||||||
uint16_t *dst16 = (uint16_t *)out->data[plane];
|
uint16_t *dst16 = (uint16_t *)out->data[plane];
|
||||||
|
float *dst32 = (float *)out->data[plane];
|
||||||
int y, x;
|
int y, x;
|
||||||
|
|
||||||
if (!(s->planes & (1 << plane))) {
|
if (!(s->planes & (1 << plane))) {
|
||||||
@ -234,7 +237,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in)
|
|||||||
bptr += width;
|
bptr += width;
|
||||||
src += in->linesize[plane];
|
src += in->linesize[plane];
|
||||||
}
|
}
|
||||||
} else {
|
} else if (s->depth <= 16) {
|
||||||
for (y = 0; y < height; y++) {
|
for (y = 0; y < height; y++) {
|
||||||
for (x = 0; x < width; x++) {
|
for (x = 0; x < width; x++) {
|
||||||
bptr[x] = src16[x];
|
bptr[x] = src16[x];
|
||||||
@ -242,6 +245,14 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in)
|
|||||||
bptr += width;
|
bptr += width;
|
||||||
src16 += in->linesize[plane] / 2;
|
src16 += in->linesize[plane] / 2;
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
for (y = 0; y < height; y++) {
|
||||||
|
for (x = 0; x < width; x++) {
|
||||||
|
memcpy(bptr, src32, width * sizeof(float));
|
||||||
|
}
|
||||||
|
bptr += width;
|
||||||
|
src32 += in->linesize[plane] / 4;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
diriir2d(ctx, plane);
|
diriir2d(ctx, plane);
|
||||||
@ -255,7 +266,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in)
|
|||||||
bptr += width;
|
bptr += width;
|
||||||
dst += out->linesize[plane];
|
dst += out->linesize[plane];
|
||||||
}
|
}
|
||||||
} else {
|
} else if (s->depth <= 16) {
|
||||||
for (y = 0; y < height; y++) {
|
for (y = 0; y < height; y++) {
|
||||||
for (x = 0; x < width; x++) {
|
for (x = 0; x < width; x++) {
|
||||||
dst16[x] = av_clip_uintp2_c(lrintf(bptr[x]), s->depth);
|
dst16[x] = av_clip_uintp2_c(lrintf(bptr[x]), s->depth);
|
||||||
@ -263,6 +274,14 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in)
|
|||||||
bptr += width;
|
bptr += width;
|
||||||
dst16 += out->linesize[plane] / 2;
|
dst16 += out->linesize[plane] / 2;
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
for (y = 0; y < height; y++) {
|
||||||
|
for (x = 0; x < width; x++) {
|
||||||
|
memcpy(dst32, bptr, width * sizeof(float));
|
||||||
|
}
|
||||||
|
bptr += width;
|
||||||
|
dst32 += out->linesize[plane] / 4;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user