Opened 4 years ago

Closed 3 years ago

Last modified 16 months ago

#4910 closed enhancement (fixed)

support for nl-means denoise filter

Reported by: ponpon Owned by: ubitux
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 4 years ago.
Patch file for anyone wanting to try it out…

Download all attachments as: .zip

Change History (21)

comment:1 Changed 4 years ago by cehoyos

  • Priority changed from normal to wish
  • Version changed from unspecified to git-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 Changed 4 years ago by ponpon

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 Changed 4 years ago by ubitux

  • Owner set to ubitux
  • Status changed from new to open

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

comment:4 Changed 4 years ago by dakooga

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 Changed 4 years ago by ubitux

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 Changed 4 years ago by dakooga

@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 follow-up: Changed 4 years ago by dakooga

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?

Changed 4 years ago by dakooga

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

comment:8 follow-up: Changed 4 years ago by richardpl

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

comment:9 in reply to: ↑ 7 Changed 4 years ago by cehoyos

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.

comment:10 in reply to: ↑ 8 ; follow-up: Changed 4 years ago by ubitux

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 Changed 4 years ago by dakooga

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...

comment:12 in reply to: ↑ 10 Changed 3 years ago by ponpon

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

comment:13 Changed 3 years ago by ubitux

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 follow-up: Changed 3 years ago by ponpon

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

or do you aim at faster one than handbrake one?

Version 0, edited 3 years ago by ponpon (next)

comment:15 in reply to: ↑ 14 Changed 3 years ago by ubitux

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 follow-up: Changed 3 years ago by ubitux

Implemented in c29b532a942233b5c804e620d475b3b888fe6e72

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

Last edited 3 years ago by ubitux (previous) (diff)

comment:17 follow-up: Changed 3 years ago by ubitux

  • Resolution set to fixed
  • Status changed from open to closed

comment:18 in reply to: ↑ 16 Changed 3 years ago by ponpon

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

comment:19 in reply to: ↑ 17 Changed 16 months ago by ponpon

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 Changed 16 months ago by richardpl

Can you show cases when this numbers helps?

Note: See TracTickets for help on using tickets.