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
131 AV_PIX_FMT_GBRP12, AV_PIX_FMT_GBRP14, AV_PIX_FMT_GBRP16,131 AV_PIX_FMT_GBRP12, AV_PIX_FMT_GBRP14, AV_PIX_FMT_GBRP16,
132 AV_PIX_FMT_GBRAP, AV_PIX_FMT_GBRAP10, AV_PIX_FMT_GBRAP12, AV_PIX_FMT_GBRAP16,132 AV_PIX_FMT_GBRAP, AV_PIX_FMT_GBRAP10, AV_PIX_FMT_GBRAP12, AV_PIX_FMT_GBRAP16,
133 AV_PIX_FMT_GRAY8, AV_PIX_FMT_GRAY9, AV_PIX_FMT_GRAY10, AV_PIX_FMT_GRAY12, AV_PIX_FMT_GRAY14, AV_PIX_FMT_GRAY16,133 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,
134 AV_PIX_FMT_NONE135 AV_PIX_FMT_NONE
135};136};
136 137
@@ -214,8 +215,10 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in) · 77 unmodified lines
214 float *bptr = s->buffer;215 float *bptr = s->buffer;
215 const uint8_t *src = in->data[plane];216 const uint8_t *src = in->data[plane];
216 const uint16_t *src16 = (const uint16_t *)in->data[plane];217 const uint16_t *src16 = (const uint16_t *)in->data[plane];
218 const float *src32 = (const float *)in->data[plane];
217 uint8_t *dst = out->data[plane];219 uint8_t *dst = out->data[plane];
218 uint16_t *dst16 = (uint16_t *)out->data[plane];220 uint16_t *dst16 = (uint16_t *)out->data[plane];
221 float *dst32 = (float *)out->data[plane];
219 int y, x;222 int y, x;
220 223
221 if (!(s->planes & (1 << plane))) {224 if (!(s->planes & (1 << plane))) {
@@ -234,7 +237,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in) · 12 unmodified lines
234 bptr += width;237 bptr += width;
235 src += in->linesize[plane];238 src += in->linesize[plane];
236 }239 }
237 } else {240 } else if (s->depth <= 16) {
238 for (y = 0; y < height; y++) {241 for (y = 0; y < height; y++) {
239 for (x = 0; x < width; x++) {242 for (x = 0; x < width; x++) {
240 bptr[x] = src16[x];243 bptr[x] = src16[x];
@@ -242,6 +245,14 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in) · 1 unmodified line
242 bptr += width;245 bptr += width;
243 src16 += in->linesize[plane] / 2;246 src16 += in->linesize[plane] / 2;
244 }247 }
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 }
245 }256 }
246 257
247 diriir2d(ctx, plane);258 diriir2d(ctx, plane);
@@ -255,7 +266,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in) · 7 unmodified lines
255 bptr += width;266 bptr += width;
256 dst += out->linesize[plane];267 dst += out->linesize[plane];
257 }268 }
258 } else {269 } else if (s->depth <= 16) {
259 for (y = 0; y < height; y++) {270 for (y = 0; y < height; y++) {
260 for (x = 0; x < width; x++) {271 for (x = 0; x < width; x++) {
261 dst16[x] = av_clip_uintp2_c(lrintf(bptr[x]), s->depth);272 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
263 bptr += width;274 bptr += width;
264 dst16 += out->linesize[plane] / 2;275 dst16 += out->linesize[plane] / 2;
265 }276 }
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 }
266 }285 }
267 }286 }
268 287

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