Log in

View Full Version : lumi masking


Pages : 1 2 3 4 5 [6]

SansGrip
22nd October 2002, 19:50
iago: also the whole MPEG-2 decoding/encoding process (DVD2AVI(VFAPI)/codec/mpeg2decX/avs/filters/encoder) considering the source ranges, artifacts, etc. as well should be analyzed (or at least rechecked) thoroughly to understand exactly what's going on regarding the black/lumi-blocking issue.

I absolutely agree. From what Tom and Marc say it seems that at least as far as MPEG-2 is concerned pixels outside CCIR-601 range are artifacts and should be clipped anyway. For me that's a pretty important discovery, as my first instinct was to compress the range instead, which I now know results in incorrect luma.

A "noising" filter to be applied finally after all the pre-processing/filtering/resizing, etc. to adaptively/selectively add noise to dark (low luma) regions might be an important point to focus on, at least to be tried imho ;).

I agree again, except I feel that it would be preferable to retain (legal range) noise from the source instead of adding it artificially. Of course if there's no noise there to begin with, it has to be added. If this even turns out to be a good idea ;).

or SansGrip lets us use his own young and fresh one ;)...

heheh it's not quite there yet. I'm not satisfied with the algorithm I'm using to generate the noise. I've yet to find a balance between eliminating blocks (which does happen with sufficient noise) and retaining a fairly clean-looking image. I'm going to experiment with adding only chroma noise to see if that helps -- it should certainly be less noticible to the eye.

You'll be the first to know when I have something promising ;).

SansGrip
24th October 2002, 21:09
@iago and all:

Finally starting to get somewhere with my noise generating filter. But I have some issues that I'd really like peoples' opinions on.

I decided for testing purposes just to generate one frame of noise and average it with the source frame in dark areas. This "spatial noise" actually appears to work pretty well, but I've not done extensive testing yet.

The question is, would "temporal noise" (i.e. generating new random noise for each frame) be better? Worse? The same? It would certainly be slower.

Right now the threshold works as a hard cut-off. This means the luma borders are pretty noticible. Would it be better to weight it so that the noise is applied less strongly as one approaches the threshold? Is there a canonical algorithm for this or should I make one up? ;)

At the moment I'm only applying luma noise. I think I shall add [luma]b and [chroma]b flags to indicate in which component to apply noise. I'm hoping that chroma noise will have the same effect on the encoder without being so apparent to the eyes...

I'm still using a simple rand()-based algorithm. Is that what Photoshop means by "uniform" noise? Does anyone have any pointers to information on implementing a Gaussian noise algorithm?

Any input would be appreciated. I'm hoping to release something preliminary in a few days.

iago
24th October 2002, 22:49
@SansGrip

Great news! ;) Looking forword to trying your release.

regards,
iago

SansGrip
25th October 2002, 03:25
Ok, here's the first version of my noise generator, MakeSomeNoise. It's not terribly sophisticated but preliminary results using MPEG-1 show significant reduction of DCT blocks -- and, I think, improved visual quality -- obviously at the expense of compressability.

Syntax:

MakeSomeNoise(clip, threshold, lamount, camount, temporal, show)

Default:

MakeSomeNoise(last, 25, 2, 4, true, false)

See the included readme.

While the threshold can be set to only "noise-up" dark areas, I've had good results from doing the whole frame at low settings.

As always, YMMV :)

SansGrip
28th October 2002, 06:56
Now I'm satisfied I know what I'm doing with noise generation (including the Gaussian variety) I'm going to factor MakeSomeNoise out into two different filters, UniformNoise and GaussianNoise. I'm going to remove the luma threshold code and move it into a separate filter, probably called LumaThreshold ;).

I think that would give maximum flexibility.

Any reports on MakeSomeNoise? It hasn't crashed for me yet...

iago
28th October 2002, 12:24
@SansGrip

Well, I'd like to report that so far I haven't got any crashes either! ;) As for the job that MakeSomeNoise does, it seems OK with quant 2 (default values seem to be a bit light for some sources); but as soon as the quantization increases MakeSomeNoise generates very visible artifacts, apparent bleeding, and even extra-blocking especially in low luma regions, the very region it aims at. I really appreciate your work and your attempts, but just wanted to report that problem.

Also, nice to hear that you keep up working on the case ;).

best regards,
iago

wotef
29th October 2002, 20:17
is the idea of this filter to achieve something similar to what poptones described in this
thread? (http://arstechnica.infopop.net/OpenTopic/page?a=tpc&s=50009562&f=67909965&m=3890938134&r=5470927074#5470927074)

SansGrip
30th October 2002, 21:03
is the idea of this filter to achieve something similar to what poptones described in this thread? (http://arstechnica.infopop.net/OpenTopic/page?a=tpc&s=50009562&f=67909965&m=3890938134&r=5470927074#5470927074)

Precisely! I remember reading something similar a while ago and thought making bitmaps too much hassle. Now I can see the benefits of adding some noise, and I'm glad someone else does too ;).

Filter update: I've completed UniformNoise() and GaussianNoise() (writing the docs now), but they've mutated into new "producing" filters. They just make noise within the parameters you specify, and will need to be combined with Layer() and/or my soon-to-be-written LumaBlend()/ChromaBlend() filters.

iago
30th October 2002, 23:39
@SansGrip

Good news, pal! ;) I'm anxious as usual to try them as soon as you're finished. (Noise is something really precious, no one can underestimate it! ;)) I believe, as a valuable option to improve at least some of or some parts of our encodes, we absolutely need some good "noising" filters as well.

regards,
iago

SansGrip
31st October 2002, 00:46
I'm anxious as usual to try them as soon as you're finished.

See this thread (http://forum.doom9.org/showthread.php?s=&threadid=37003) for the noise generators. You can use these in combination with Layer to selectively add noise until I've finished my blending filters.

I believe, as a valuable option to improve at least some of or some parts of our encodes, we absolutely need some good "noising" filters as well.

I agree. I hope these fit the bill ;).

SansGrip
1st November 2002, 22:42
@iago:

I'd be grateful if you could run some tests with my new AddNoise filter (http://forum.doom9.org/showthread.php?s=&threadid=37135), which is specifically designed to add sensible levels of Gaussian noise to a clip with a view to eliminating DCT blocks.

Thanks :).

iago
1st November 2002, 23:08
@SansGrip

As you also mentioned in the related thread, unfortunately I couldn't get good results in my test encodes with XviD using Noise Generators -> GaussianNoise with Layer and Levels.

Certainly I'll try your new AddNoise filter. However, I'm so confused and tired because of some other tests ;) atm that I actually cannot concentrate on setting the right parameters with it. Considering that I want to add noise to the 0-20 area of a full 0-255 levels range, can you please modify the below sample script:

---------------------------------------
LoadPlugin("C:\FILTERS\mpeg2dec2.dll")
LoadPlugin("C:\FILTERS\AddNoise.dll")

mpeg2source("C:\MOVIE\MOVIE.d2v")
crop(12,12,698,552)
BicubicResize(576,320,0,0.5)

AddNoise(?)
---------------------------------------

Thanks a lot in advance,
regards,
iago

Emp3r0r
1st November 2002, 23:35
I think I mentioned this before but wouldn't the best solution to this problem be some post processing that blurs or adds noise to VERY dark areas? I'd love to have this in ffdshow or xvid.ax

SansGrip
2nd November 2002, 00:04
Considering that I want to add noise to the 0-20 area of a full 0-255 levels range, can you please modify the below sample script

AddNoise is designed to process the entire luma range. I can't think of a way to apply a filter to a certain luma range using existing filters (if anyone knows of a way please tell me), but LumaBlend and ChromaBlend are on my todo list...

If you wanted to try AddNoise anyway (to see if noise helps in the dark areas) I recommend using almost the default settings first:

AddNoise(loop=4) # here ym=um=vm=0, yv=uv=vv=1

If you find the noise too strong you can pull it down in any or all of the components:

AddNoise(yv=0.5, uv=0.2, vv=0.2)

This will reduce the noise to 0.5 in Y and 0.2 in U and V.

If you want more noise, increase the variance parameters.

I'd be very interested to hear your experiences with it. I've had extremely good results so far, at least with MPEG-1. MPEG-4 might be a different beast entirely.

Sorry I have no answer for the selective-noise part of your question right now. I think I'll make LumaBlend and ChromaBlend my next project :).

SansGrip
2nd November 2002, 00:11
I think I mentioned this before but wouldn't the best solution to this problem be some post processing that blurs or adds noise to VERY dark areas?

Theoretically ffdshow's add noise facility should help in this regard. I have my doubts about further smoothing of dark areas, since the blocks are already a result of a lack of detail. In my tests applying more averaging to dark areas only made the problem worse.

On the other hand, if some clever soul could come up with an algorithm to detect DCT blocks specifically (perhaps by looking for blocks of solid colour in a square shape with roughly the right dimensions) it sould be possible to blend them into each other without disturbing other areas of the image.

While post-processing solutions are an option, my opinion is that it would be better to eliminate the blocks from the encoding in the first place. This way you're not limited to using, say, ffdshow to view the movie. In my case almost all my encodes are viewed on a TV via my standalone player, and the DCT blocks can look awful with a too-smooth source.

Marc FD
2nd November 2002, 11:54
Hi all ^^

I've viewed a movie (not XviD, SBC) tonight on my TV.
And i saw this Black-Blocking problem.
But it was different...
The most dark parts were greenish. i wonder if anyone had this problem ?
because it's _very_ visible for me, and i think it's pretty easy to fix.

MaTTeR
2nd November 2002, 14:22
Marc,

The greenish blocks seem to be more common on SBC rips than XviD for some reason. However, the blocks that I see in XviD are usually a light pink or greenish color showing mostly in mid tones or shadow areas. Pink blocks are very annoying when they float around in the static background:D

SansGrip
2nd November 2002, 15:47
The most dark parts were greenish. i wonder if anyone had this problem ?

I've never seen this, but it sounds almost like the U and V are getting pushed towards zero somehow.

iago
3rd November 2002, 01:38
... AddNoise is designed to process the entire luma range ... Sorry I have no answer for the selective-noise part of your question right now.

@SansGrip

Well, using AddNoise with Trim in Avisynth and applying the desired amount of noise to the frame-selected parts of the encode still remains as another option ;). Full support to your obsession with and works on "noise"! ;) And honestly, I really would like to be able to use "selective-noise" one day in my encodes...

Also I want to point out that since there is no one and only solution to encoding problems, as long as we have the necessary tools and filters in hand, we can always use them (or combinations of them) in an effective way, when required, to enhance our encodes.

For example mpeg2dec3 with the lumoff parameter by Marc, and UnFilter by Tom are indispensable elements of my avs scripts atm to solve the black-blocking issue. Why not add a good "noiser" (maybe one day a good "selective-noiser") to the script, to apply where and when necessary! (Think about the "sky", "walls", etc.) ;)

best regards,
iago

SansGrip
3rd November 2002, 03:45
Full support to your obsession with and works on "noise"! ;)

:D

I think I'm more obsessed with showing other people what a little noise can do for their encodes...

Also I want to point out that since there is no one and only solution to encoding problems, as long as we have the necessary tools and filters in hand, we can always use them (or combinations of them) in an effective way, when required, to enhance our encodes.

Exactly. That's why I like to make my filters as specific as possible (where practical anyway). While AddNoise is nice (and getting nicer - see below) it's still very useful to have separate filters that just generate noise. Who knows what they might be useful for in combination with something else?

(Think about the "sky", "walls", etc.) ;)

I'm thinking walls (http://forum.doom9.org/showthread.php?s=&threadid=37135#post204538) in particular... Go look, go look! :D

cjv
6th November 2002, 21:34
I have noticed that a lot more people are using Unfilter() to combat the blocking issue, but I also see values like Unfilter(3,3) and Unfilter(4,4) creeping up in some scripts.

Do you really notice any difference? On my machine at least, using anything < Unfilter(5,5) (while still staying +,+) basically is a no-op (ie. it behaves as if Unfilter() was not even there). I believe I have the latest version of Unfilter...I hope its just my machine because I love Unfilter() but (5,5) increases the bitrate requirement a bit too much sometimes.
Does anyone else experience this?

cjv

soujir0u
1st December 2002, 11:04
Hi guys, I noticed that the latest MPEG2Dec3 doesn't have the lumoff option anymore. Will using Unfilter(-5,-5) alone be enough to solve the black blocking problem?

Koepi
1st December 2002, 11:14
Uh, it's written in the docs:

it's now an additional command:

LumaFilter(-2)


Regards
Koepi

soujir0u
1st December 2002, 11:23
Oh thanks! I was confused cos that option accepted 2 values...

iago
1st December 2002, 12:26
@soujir0u

As far as I could figure out, UnFilter(-,-) helps solving black-blocking problem by providing an additional subtle darkening effect and thus assisting lumoff=-x or LumaFilter(-x) in doing its job ;). Therefore, you can also go with a value of LumaFilter(-3,0.8) for instance, depending on the source, as an alternative to the company of UnFilter(-,-). However, I still find it useful to add UnFilter(-,-) to my scripts when I go for 1CD encodes (which I usually do) and especially when the movie is hard to compress.

best regards,
iago

drebel
2nd December 2002, 03:20
@all

I've been using all of our latest methods for the black blocks issue with good results(lumoff,lumafilter,blockbuster...).Forgive my ignorance,but besides mpeg4 that prob seems to exist even in mpeg2(for another reason?).I'm reffering to the famous IRE prob.I'm copying a brief expanation from a site:


>>>In the original black and white television system the voltage level for picture material at black was zero Volts DC or 0 IRE. (IRE and other terms used in this explanation are defined in the glossary of terms.) .......

...from a second look it's FAR OT.Sorry,
I'm starting a new thread
regards,
george

bilu
26th December 2002, 11:42
@iago

As far as I could figure out, UnFilter(-,-) helps solving black-blocking problem...

You mean Unfilter with negative values? I'm asking this because I read the whole thread and it seemed everybody mentioned Unfilter(+,+), namely Unfilter(5,5).


@all

I think somebody (trbarry?) mentioned in this thread that Xvid handles 0-255 range both in luma and chroma. Could the Xvid quantizing change the luma/chroma outside the 16-235 limit, even using the LegalClip filter?

iago
26th December 2002, 14:07
Originally posted by bilu
@iago

You mean Unfilter with negative values?

Yep, that's what I have observed so far ;).

kalehrl
21st December 2011, 15:21
I apologize for resurrecting such an old thread but I wonder if there is any way I can determine if an avi xvid video was encoded using lumi masking (-masking 1 in the latest 1.3.2 xvid)?

henryho_hk
25th December 2011, 12:10
GSpot may provide such information.

If not, install ffdshow directshow filter and turn on its visualization to show the quantitizers.... those with lumimasking have different values in the same frame.

kalehrl
25th December 2011, 14:46
Thank you.
Gspot is useless for this but ffdshow directshow filter does work.
I guess this means that lumimasking was used:
http://i40.tinypic.com/n15ope.jpg