Opened 6 years ago

Closed 5 years ago

Last modified 4 years ago

#4910 closed enhancement (fixed)

support for nl-means denoise filter

Reported by: ponpon Owned by: Clément Bœsch
Priority: wish Component: avfilter
Version: git-master Keywords:
Cc: Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description

Dear ffmpeg teams,

i strongly request support for nl-means denoise filter.
the filter is too excellent. even bad source such as vhs video is recovered.
we can see the effect in the below links.
though mr. dirk farin has the fork of ffmpeg, one of handbrake is improved in settings and optimization.
i believe the filter enhances ffmpeg.

http://www.dirk-farin.net/projects/nlmeans/index.html
https://forum.handbrake.fr/viewtopic.php?f=4&t=30135&sid=c2d2b10af30b495acb6138e8d5cf8622

Attachments (1)

0001-Added-nl_means-from-https-github.com-farindk-ffmpeg.patch (26.1 KB ) - added by dakooga 6 years ago.
Patch file for anyone wanting to try it out…

Download all attachments as: .zip

Change History (21)

comment:1 by Carl Eugen Hoyos, 6 years ago

Priority: normalwish
Version: unspecifiedgit-master

Did you ask Dirk Farin why he didn't send his filter to the FFmpeg development mailing list?
Did you consider to send a patch?

comment:2 by ponpon, 6 years ago

thank you for your reply.

Did you ask Dirk Farin why he didn't send his filter to the FFmpeg development mailing list?

no. because the filter of handbrake is improved in settings and optimization.

Did you consider to send a patch?

regrettably, i don't have such a ability. if i do so, ffmpeg team and users get only confusion.

comment:3 by Clément Bœsch, 6 years ago

Owner: set to Clément Bœsch
Status: newopen

I'm working on it since a while, I need more time.

comment:4 by dakooga, 6 years ago

I've just tried this filter in handbrake and it works extremely well with older material. Another by product of a the filter is greatly improved compression ratios.

comment:5 by Clément Bœsch, 6 years ago

The filter is actually pretty simple in theory. I have a working implementation here, but very slow. I'm working on making it usable.

comment:6 by dakooga, 6 years ago

@ubitux I understand.. The handbrake version costs about 20-25% of the encoding speed when applied.

I'm not sure how I can help but if you manage to submit a patch that makes it to the master then others might be able to contribute too!

comment:7 by dakooga, 6 years ago

I just added to my snasphot... get about 22 fps on 720p content with 6:3:1. Had it up to 55 fps with 480p content and NVenc going to HEVC...

Do I just submit the patch or something else?

by dakooga, 6 years ago

Patch file for anyone wanting to try it out...

comment:8 by Elon Musk, 6 years ago

First it is GPL.
Second it uses intrinsic and thus is unacceptable in such form.

in reply to:  7 comment:9 by Carl Eugen Hoyos, 6 years ago

Replying to dakooga:

Do I just submit the patch or something else?

You also have to port Dirk's change to configure (line 2589) to make sure LGPL builds do not contain the filter.
Then please remove the whole x86 optimizations: It cannot be committed as-is and it is not needed for the initial commit. I would also suggest to remove the pragma directives, they will just cause fruitless discussions. Finally, please send your patch to the development mailing list, no review is done on this bug tracker.

in reply to:  8 ; comment:10 by Clément Bœsch, 6 years ago

Replying to richardpl:

First it is GPL.
Second it uses intrinsic and thus is unacceptable in such form.

3rd: it's not the final version; Handbrake improved it in various ways, this version is inferior.

Note: if people don't want to wait until I'm done with the filter and prefer to port it themselves, I can stop right now, but please say so.

comment:11 by dakooga, 6 years ago

4th I don't want to step on anyone toes. You guys do whatever you like.

I merely put it up in case others wanted to try it. I'm not good enough and knowledgeable enough to do a proper commit. But some people do want to try it and see what it does even if it takes a bit longer. It doesn't have to be perfect just to see...

in reply to:  10 comment:12 by ponpon, 6 years ago

Replying to ubitux:
i am rooting for you and looking forward to your work.
do you know when your work is completed?

comment:13 by Clément Bœsch, 6 years ago

Sorry I got delayed in my progress for various reasons. I have a working version locally, but it's so damn slow it's unusable, so that I'm studying the different existing ways of improving speed.

comment:14 by ponpon, 6 years ago

is the present ubitux version slower than the dirk farin one?
or do you aim at faster one than handbrake one?

Last edited 6 years ago by ponpon (previous) (diff)

in reply to:  14 comment:15 by Clément Bœsch, 5 years ago

WIP patch available for testing: https://patchwork.ffmpeg.org/patch/613/

Replying to ponpon:

is the present ubitux version slower than the dirk farin one?

I don't know I haven't compared. Probably since there is no ASM for now.

or do you aim at faster one than handbrake one?

The code is ready for some fast SIMD, but won't be present in the first version.

comment:16 by Clément Bœsch, 5 years ago

Implemented in c29b532a942233b5c804e620d475b3b888fe6e72

SIMD will be the next iteration, but the filter is already "fast enough" for normal use.

Last edited 5 years ago by Clément Bœsch (previous) (diff)

comment:17 by Clément Bœsch, 5 years ago

Resolution: fixed
Status: openclosed

in reply to:  16 comment:18 by ponpon, 5 years ago

Replying to ubitux:
goood!
thank you for your work.
It's got for everyone tol enjoy it!

in reply to:  17 comment:19 by ponpon, 4 years ago

Replying to ubitux:
i think the default value is too strong for SD video and slow for HD.
i try to change them in source from

static const AVOption nlmeans_options[] = {
    { "s",  "denoising strength", OFFSET(sigma), AV_OPT_TYPE_DOUBLE, { .dbl = 1.0 }, 1.0, 30.0, FLAGS },
    { "r",  "research window",                   OFFSET(research_size),    AV_OPT_TYPE_INT, { .i64 = 7*2+1 }, 0, 99, FLAGS },

to

static const AVOption nlmeans_options[] = {
    { "s",  "denoising strength", OFFSET(sigma), AV_OPT_TYPE_DOUBLE, { .dbl = 0.85 }, 0.000001, 30.0, FLAGS },
    { "r",  "research window",                   OFFSET(research_size),    AV_OPT_TYPE_INT, { .i64 = 3*2+1 }, 0, 99, FLAGS },

doesn't this brake the work of nlmeans?

is support for SIMD completed?

i have requests for nlmeans. should i write them here or open a new ticket?

comment:20 by Elon Musk, 4 years ago

Can you show cases when this numbers helps?

Note: See TracTickets for help on using tickets.