History

avfilter/vf_dblur: add float formats support

Paul B Mahol committed 4 years ago

Commit 0aa71421 parent 6a9cb5a1 file · +21 −2Browse files

Showing the changes to libavfilter (1 of 1 file). Show all

Unified · Split

libavfilter/vf_dblur.c+21−2
@@ -131,6 +131,7 @@ static const enum AVPixelFormat pix_fmts[] = { · 130 unmodified lines
131131 AV_PIX_FMT_GBRP12, AV_PIX_FMT_GBRP14, AV_PIX_FMT_GBRP16,
132132 AV_PIX_FMT_GBRAP, AV_PIX_FMT_GBRAP10, AV_PIX_FMT_GBRAP12, AV_PIX_FMT_GBRAP16,
133133 AV_PIX_FMT_GRAY8, AV_PIX_FMT_GRAY9, AV_PIX_FMT_GRAY10, AV_PIX_FMT_GRAY12, AV_PIX_FMT_GRAY14, AV_PIX_FMT_GRAY16,
134+ AV_PIX_FMT_GRAYF32, AV_PIX_FMT_GBRPF32, AV_PIX_FMT_GBRAPF32,
134135 AV_PIX_FMT_NONE
135136 };
136137
@@ -214,8 +215,10 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in) · 77 unmodified lines
214215 float *bptr = s->buffer;
215216 const uint8_t *src = in->data[plane];
216217 const uint16_t *src16 = (const uint16_t *)in->data[plane];
218+ const float *src32 = (const float *)in->data[plane];
217219 uint8_t *dst = out->data[plane];
218220 uint16_t *dst16 = (uint16_t *)out->data[plane];
221+ float *dst32 = (float *)out->data[plane];
219222 int y, x;
220223
221224 if (!(s->planes & (1 << plane))) {
@@ -234,7 +237,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in) · 12 unmodified lines
234237 bptr += width;
235238 src += in->linesize[plane];
236239 }
237− } else {
240+ } else if (s->depth <= 16) {
238241 for (y = 0; y < height; y++) {
239242 for (x = 0; x < width; x++) {
240243 bptr[x] = src16[x];
@@ -242,6 +245,14 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in) · 1 unmodified line
242245 bptr += width;
243246 src16 += in->linesize[plane] / 2;
244247 }
248+ } else {
249+ for (y = 0; y < height; y++) {
250+ for (x = 0; x < width; x++) {
251+ memcpy(bptr, src32, width * sizeof(float));
252+ }
253+ bptr += width;
254+ src32 += in->linesize[plane] / 4;
255+ }
245256 }
246257
247258 diriir2d(ctx, plane);
@@ -255,7 +266,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in) · 7 unmodified lines
255266 bptr += width;
256267 dst += out->linesize[plane];
257268 }
258− } else {
269+ } else if (s->depth <= 16) {
259270 for (y = 0; y < height; y++) {
260271 for (x = 0; x < width; x++) {
261272 dst16[x] = av_clip_uintp2_c(lrintf(bptr[x]), s->depth);
@@ -263,6 +274,14 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in) · 1 unmodified line
263274 bptr += width;
264275 dst16 += out->linesize[plane] / 2;
265276 }
277+ } else {
278+ for (y = 0; y < height; y++) {
279+ for (x = 0; x < width; x++) {
280+ memcpy(dst32, bptr, width * sizeof(float));
281+ }
282+ bptr += width;
283+ dst32 += out->linesize[plane] / 4;
284+ }
266285 }
267286 }
268287

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t