Log in

View Full Version : Smooth in time and space?


Pages : 1 2 3 [4] 5 6 7

Ivion
5th August 2002, 20:27
Marc FD, while testing your filter I came across a problem wich was already been stated here in this topic. I got a acces violation, te be exact, this one; 'Avisynth: caught access violation at 0x090e70d7 attempting to read from 0x00000000'. Tough I tried everything you suggested, I still got the acces violation, even with this script:
LoadPlugin("C:\PROGRA~1\GORDIA~1\mpeg2dec.dll")
LoadPlugin("C:\filters\mamspe\mam.dll")

src=mpeg2source("E:\test.d2v")
MAM(src,src)
So my guess is that it's still MAM, or MAM in cooperation with mpeg2dec, tough I couldn't test it without mpeg2dec, for I do not capture or anything of the like. :)

dividee
5th August 2002, 21:13
I don't know how MAM reads frames but I think mpeg2source doesn't like too much random access. Could you try the following script ?

LoadPlugin("C:\PROGRA~1\GORDIA~1\mpeg2dec.dll")
LoadPlugin("C:\filters\mamspe\mam.dll")

src1=mpeg2source("E:\test.d2v")
src2=mpeg2source("E:\test.d2v")

MAM(src1,src2)

Don't blame me if it doesn't work, but I think it's worth a test.

tenebrenz
5th August 2002, 22:00
With me I get an access violation when I open a script containing mpeg2source in virtualdub and then press play >0. If I advance one frame first and press play it doesn't crash.

Ivion
5th August 2002, 23:36
Originally posted by dividee
I don't know how MAM reads frames but I think mpeg2source doesn't like too much random access. Could you try the following script ?

LoadPlugin("C:\PROGRA~1\GORDIA~1\mpeg2dec.dll")
LoadPlugin("C:\filters\mamspe\mam.dll")

src1=mpeg2source("E:\test.d2v")
src2=mpeg2source("E:\test.d2v")

MAM(src1,src2)

Don't blame me if it doesn't work, but I think it's worth a test.
Sorry, still doesn't work, again a acces violation, tough there was a subtle difference in the error, the previous error was: 'Avisynth: caught access violation at 0x090e70d7 attempting to read from 0x00000000'.
While this one is: 'Avisynth: caught access violation at 0x00d970d7 attempting to read from 0x00000000'

As I know repeat the test again (my script and dividee's script), the error's are suddenly the same :confused:. Dunno if that is of any help

scorchED
5th August 2002, 23:45
Originally posted by Ivion

Sorry, still doesn't work, again a acces violation, tough there was a subtle difference in the error, the previous error was: 'Avisynth: caught access violation at 0x090e70d7 attempting to read from 0x00000000'.
While this one is: 'Avisynth: caught access violation at 0x00d970d7 attempting to read from 0x00000000'



The MAM Filter works well with AVISource - with MPEG2Source you have prblems like above. Try this script with an AVI (maybe with VFAPIConv).

Ivion
5th August 2002, 23:48
Originally posted by scorchED



The MAM Filter works well with AVISource - with MPEG2Source you have prblems like above. Try this script with an AVI (maybe with VFAPIConv).

VFAPIConf *shivers*, all this trouble with avisynth, the greatest 'scriptable' frameserver, and we have to resort to VFAPI? ;) :p
Ok, I'll try, I'll edit this post after my attempt. :)


Results (Scripts can be found here: http://www.xs4all.nl/~mbeerman/Scripts)
Script 1: Works
Script 2: Miserable Failure (just like Suikun's image, somewhere on page 8)
Script 3: Works

Hope this'll help

Marc FD
6th August 2002, 00:00
I'm sorry but i can do whatever i want with MPEG2source, i can't crash it !!!!

I'm being more and more sure that the problem comes from MPEG2dec.dll

What's the version you're using ??
if you want i would attach my MPEG2dec.dll to this thread but before you should try an another version...

I think mine is the one who comes with GKnot 0.26 but i'm not sure.
(the MPEG2dec i use makes ONLY .d2v decoding and don't have others filters in (like dividee's version ) )

Hope whe will fix that :)

PS : If anyone can get MAM working (without the errors described before ) PLEASE say it !!! i'm beginingto think that my filter can only work for me..... :rolleyes:

and while i'm here, i released the more various filter of avisynth history : the 12 in 1 filter !!
In MAM v0.6 spe2, there is now 12 filters you can test (with 10 cleaners who 2-3 are really serious)
simply load MAM.dll and then play with :

SpatialFiltering(mode,lumathr,chromathr)

see the txt file for more info.

I would really like to see test results :)
with 12 modes it you could all play for a while :D

scorchED
6th August 2002, 00:21
I use the following script for ripping "Erkan und Steffan". It includes the MAM-filter (not the last:o ). It works well with VFAPIConv only.
___________________________________________________________________
LoadPlugin("D:\AudioVideoCoding\_AVISynth\mpeg2dec.dll")
LoadPlugin("D:\AudioVideoCoding\_AVISynth\mam.dll")
LoadPlugin("D:\AudioVideoCoding\_AVISynth\SmoothHiQ.dll")

Source=AVISource("D:\_DVDs\Erkan und Steffan\yuv 64.avi").crop(2,82,716,414).ConvertToYUY2

m_slowmotion=Source.SmoothHiQ(5,48,96,128,0).TemporalSmoother(2,1)
m_fastmotion=Source.SmoothHiQ(3,32,64,128,35)

c_slowmotion=Source.SmoothHiQ(7,48,96,128,0).TemporalSmoother(4,1)
c_fastmotion=Source.SmoothHiQ(3,32,64,256,35)

Movie=MAM(m_slowmotion,m_fastmotion).Trim(0,120535).BiLinearResize(560,320)
Credits=MAM(c_slowmotion,c_fastmotion).Trim(120536,0).BiLinearResize(560,320)

Return Movie+Credits
___________________________________________________________________


If i use the same cript with a MPEG2Source, the movie i get looks very crazy. Does anyone know whats wrong?:confused: :confused: I will attach a screenshot (don't know how to do it).

edited: here is a link to the bad pic (http://www.torstensanio.de/audio_video/doom9forum/mpeg2source.jpg)

Koepi
6th August 2002, 00:42
You should try the dx81-yuv-fix.exe which should be in the old news from last months or on another thread down here in the avisynth forum.

Your domain can't be found, so I can't see the picture, but I guess that's what's going on.

Using vfapi is a bad thing, we use avisynth to stay in YUV colour space to gain speed and less loss due to colour space conversions.

Koepi

Ivion
6th August 2002, 00:48
Originally posted by scorchED
edited: here is a link to the bad pic (http://www.torstensanio/audio_video/doom9forum/mpeg2source.jpg)

First point: Shouldn't your link be: http://www.torstensanio.de/audio_video/doom9forum/mpeg2source.jpg? :rolleyes: :sly: :D
Second point: Your 'disorted' image looks just like that one from Suikun and me with my 2nd Script. So the problem is related to eachother...well, gonna take a look into your script. :D

scorchED
6th August 2002, 01:03
i fixed the link - sorry for this misstake.

i installed the "fix" before the encoding and i have to say that i don't like it, because my BSPlayer can't play my HufYuv-files now. So i deinstall after my testing.

i know that VFAPI is for the "poor man's" quality, but i wanted to test it, because without it, my scipt doesn't work:(

i will test the MPEG2dec.dll from Marc FD now - i have dividee's version.

scorchED
6th August 2002, 01:41
MarcFD, can you add a scenechange-detection in your MAM filter? So after a scenechange, we can reset the x and y results (mam(x,y)). It's needed for the temporal filtering on still areas in a scenechange. It coult reduce the ghosting after a scenechange, which is produced by the temporal filter, and the keyframe"quality" is much more better. For example TemporalSmoother don't have to compare the first frame after the scenechange with frames before the scenechange.
Is it possible to code that in the MAM-filter or have the TemporalSmoother have to be rewritten?

dividee
6th August 2002, 02:10
Hum. In fact TemporalSmoother HAS BEEN rewritten to do exactly what you describe ;) The scene change code I posted was an extract from it.
But for now I only have C implementation and have been on other projects lately so it sits dormant on my disk. I promise I'll finish the MMX version as soon as I get my developing environment back.

scorchED
6th August 2002, 09:41
maybe i make something wrong, i think the scenchangedetection in TEmporalSmoother doesn't work. Only the second (TemporalSmoother(1)) or the thirt (TemporalSmoother(2)) frame after a scenechange is clean :(

vlad59
6th August 2002, 09:47
I think you misunderstood what Dividee said : he has changed TemporalSmoother only on his computer (he said : it sits dormant on my disk).

It's not released now.

Marc FD
6th August 2002, 11:37
in fact MAM does already change detection :) better, it does MOVEMENT detection !! (yes,yes) so when you have scene-change, it's considered to be a 100% movement frame, and temporal filtering is NOT used .
And remind MAM can (now) just prevent ghosting from raduis 1 temporal filters.
I'm waiting on results for my 12 spatial filters. then would add some temporal filters so MAM could work in "integrate mode"(with it's own filtering) who'll be much faster (at least 2x , with spatial filtring MMX much more...)


EDIT : I don't like scene-change detection.. I haven't tested dividee's pack but i'm afraid it's very difficult for a simple algo to see the difference between a travelling and a scene-change...maybe pattern detection ? or Motion compensation ?

bb
6th August 2002, 11:48
@Marc FD:
There are different scene change algorithms. E.g. some compare the average luma value of consecutive frames and detect a scene change, if the difference is above a certain threshold. I don't know how well this works, but this kind of scene change detection has nothing to do with motion detection.

bb

Marc FD
6th August 2002, 11:56
yes of course they are plenty of ways of doing it :)
but if you have a flashing light, your scene-change algo will get mad.
The problem is to have an all around scene-change algo. and that's not so easy !

bb
6th August 2002, 12:17
True. If you want a well-working solution you'll probably have to combine different methods (without compromising performance, of course :eek: )

It's so easy if you have camcorder timecodes...

bb

scorchED
6th August 2002, 12:43
@MarcFD

can you attach your MPEG2dec.dll on you're next post please?
I get an access violation error everyime i use a mpeg2source:(
i tested trbarry's dll, GKnot's dll and dividee's dll - everytime the same error. I tested it with the simple script you posted.

maybe this error depends on the CPU? I have an Athlon C 1333MHz.
which AVISynth version are you using? I am using 2.02.

Ivion
6th August 2002, 15:42
Yeah, Marc FD, could you please post your MPEG2dec.dll? The one I use is the one provided by the newest gknot (0.26, right?).
As you might have read my test, with my 3 sample scripts, it seems that crop in combination with avisource, converttoyuy2 and mam produces weird results. Maybe that's a bug too?
So, we've 2 bugs, one with MPEG2dec and one wich happens when using this script (http://www.xs4all.nl/~mbeerman/Scripts/test2.avs), for when using this script you will get one of the weird images, wich have already been posted in this thread.

Hope this'll help.

Marc FD
6th August 2002, 23:43
I'm really sorry :(
really.

In fact the bug was corrected in MAM b3-b4
And i dumbly reintroduced it !!
i've disabled buffering because it was giving less quality and could be buggy... and i replaced it with a very dangerous frame access
(never access the n-1 frame ....)

i've seen it in the code, could reproduce the bug (in fact if you use Trim(1,0) before MAM everything would work fine :rolleyes: )
so it's corrected now and it should work very good

PS : if you want to make an older MAM version work, simply add Trim(1,0) before :)

The new mam version is MAM spe2b
avaiable in 5 min on my site

scorchED
7th August 2002, 06:01
if you use MPEG2Source don't crop the source directly, you don't get strange looking results like in older posts. The best is, to crop and resize at the end of the script.

--wrong----------------------------------------------------------
source=(...).crop(...)
slowmotion=(source. ...)
fastmotion=(source. ...)
mam(slowmotion,fastmotion)
...Resize

--right----------------------------------------------------------
source=(...)
slowmotion=(source. ...)
fastmotion=(source. ...)
mam(slowmotion,fastmotion)
crop(...)
...Resize

but the calculation time is much more bigger, because there have to be more pixel calculated.
you can cropp an AVISource directly without getting strange results.

Ivion
7th August 2002, 11:31
Originally posted by scorchED
if you use MPEG2Source don't crop the source directly, you don't get strange looking results like in older posts. The best is, to crop and resize at the end of the script.

--wrong----------------------------------------------------------
source=(...).crop(...)
slowmotion=(source. ...)
fastmotion=(source. ...)
mam(slowmotion,fastmotion)
...Resize

--right----------------------------------------------------------
source=(...)
slowmotion=(source. ...)
fastmotion=(source. ...)
mam(slowmotion,fastmotion)
crop(...)
...Resize

but the calculation time is much more bigger, because there have to be more pixel calculated.
you can cropp an AVISource directly without getting strange results.

:confused:
That's not exactly the same conclusion I had, for with this script (http://www.xs4all.nl/~mbeerman/Scripts/test2.avs), I also had the 'weird' image problem, tough I'm using an AVIsource. So I presume it's because the YUY2 source (cuz of the ConvertToYUY2 in this case) in combination with a righ after it (thus before MAM) crop and MAM afterwards.

So, a 'correct' script at the moment will be to crop and resize after MAM, I hope this is also correctable. For the crop is meant to remove black bars wich have none to do with the movie, so using MAM on those while removing them later is a waste. :D

Marc FD
7th August 2002, 11:44
i use crop&resize before mam.
i would try crop only.
if there is a bug, i would correct it :)

PS : does it work better now (with spe2b)

scorchED
7th August 2002, 13:17
if you have an AVISource, you have to Cropp before ConvertToYuv and everything works fine (on my PC).
but the same doesn't work with MPEG2Source:(

Marc FD
7th August 2002, 15:36
BTW i never use ConvertToYUY2()
MPEG2source gives YUY2 output
AVISource with an DivX/XviD/huffyuv encoded file gives YUY2 output too...
but you may need it...
Will look at MAM now.

scorchED
7th August 2002, 16:46
Originally posted by Marc FD
BTW i never use ConvertToYUY2()
MPEG2source gives YUY2 output
AVISource with an DivX/XviD/huffyuv encoded file gives YUY2 output too...
but you may need it...

Yes of course, i know that. But if you use VFAPI than you have to convert the color table.
I think the most important for the MAM is, that is works fine with cropping before MAM (look at the scripts i posted before), because of the big increase in encodingspeed.
MAM is a very very very usefull tool/filter and thank u very much for you're great work, MarcFD.

Marc FD
7th August 2002, 17:09
done :cool:
dl MAM v0.6 spe II (c)

_should_ be bugfree

scorchED
7th August 2002, 20:14
YES!! (sorry about crying)
it works:D

very nice (and surely hard) work! thanks!
i have some ideas how to make the scenechange algos for TemporalSmoother of MAM better. i will make some screenshots and will write a pseudo-code. maybe you'll find my ideas nice to implement them. My goal is to make a perfect filtered I-Frame, so the encoding is more efficient.

vlad59
7th August 2002, 21:28
I'm finally back (too much work) ...
You can't imagine how much I would give to be a simple student again and have a little time.

Well I should stop dreaming.

You will find attached the latest version of convolution3D (the last alpha I think), the changelog is simple :
- No more green rectangle
- No more problem with cropped source
- But it should be a little slower.

I'll released the sources this weekend as soon as I comment asm a little more and change some "french sounding" variables to more english variables. But as usual you can get the latest sources just by emailing me or with PM.

@bb
I had no time to add the full 1 weight matrix, maybe this weekend.

EDIT : removed old version of Convolution3D

Marc FD
7th August 2002, 22:35
@scorchED
no pb. i'll have a look at it. improvements are always welcome.
I've several goods ideas myself. just need to implement and to test them...

@vlad59
he ouais, c con ca... le best c que moi je suis encore au bahut :)
j'ai même pas mon bac... alors tu peux imaginer le degré de glande
(la terminale c pas l'extenutation totale si tu vois c que je veux dire)

"french sounding" variables are COOL !!

bb
8th August 2002, 11:15
@vlad59:
Thanks, I'll test the new filter this weekend.
Do you think you can optimize "full 1 weight matrix" very much? (I think you could completely drop the weight calculation)

bb

vlad59
8th August 2002, 11:31
@bb

I'll be obliged to adapt a little the "full 1 weight matrix" to have a better divisor :

with this matrix I have a total divisor (sum of weight of the matrix) of 9+9+9 = 27
So if I use 27, all the speed gained with the simplier matrix will be lost with division.
I would prefer to have 32 as a divisor (to use right shift) but for this the weight matrix should change a little, for example :


1 1 1 1 1 1 1 1 1
1 2 1 2 2 2 1 2 1
1 1 1 1 1 1 1 1 1


With that I think it could be a little faster than the actual Convolution3D matrix.

Perhaps you could add this matrix to your previous test to see if it changes a lot

sh0dan
8th August 2002, 13:22
Originally posted by Marc FD
I didn't exactly understood how do you debug avs filters...
do you have a special VDub version ??
[/B]

No - use the released vdub.

1) Use the DEBUG configuration.

2) Project -> Settings -> Debug Tab

Select your virtualdub.exe as executeable for debug session.

3) Include the dll in the debug directory in your AVS script

4) Set debug breakpoints using F9.

5) Press 'F5'.

6) VC++ will complain about not finding debug information for virtualdub.exe - ignore this.

7) Load the AVS-file.

8) Seek to another frame.

Bingo! You're in Debug mode.
If you get bombed into debug mode using 'F5', just press 'F5' again.

You can adjust which exceptions should be caught by visual studio in the debug menu.

Marc FD
8th August 2002, 16:02
thanks sh0dan, but i used this feature a while ago now :)
you are too late ;)

Ivion
8th August 2002, 18:25
Well, I ran a quick test with the newest MAM (spe2c), and I was pleased with the result, on my LOTR:FOTR rip it COMPLETELY removed all the (visible) noise, it rocked. :D
Tough, I'm sorry to say, I discovered some bugs. When using this (http://www.xs4all.nl/~mbeerman/error1.avs) and this (http://www.xs4all.nl/~mbeerman/error2.avs) script, I get this image (http://www.xs4all.nl/~mbeerman/error.png).
Tough, this script (http://www.xs4all.nl/~mbeerman/bingo.avs) worked wonderfull!

So, option 3 (2x1D soft blur) and option 5 (2D fixed edge detection) give problems as far as I've tested, for these filters seemed also 'usefull' to test on my source. Option 12 (2D Thresolded Median Clip chroma/luma check) worked like a charm and option 9 looks very usefull for use on animation vids and/or anime, for I found the blurring on 'normal' (normal movies, with humans, special fx, etc.) sources to much for my liking.

Didn't tested the other ones, for it looked (I haven't checked, I'm basing this on the names :D) that 12 and 9 were the best in their 'series' (12, 11, 10, 2, 1 - 9, 8, 7, 4 [if I'm correct :)]), and 3 and 5 also looked interesting, 2bad they didn't worked.

Hope that this test will help you choose the right filters and fix the bugs. :)

scorchED
9th August 2002, 01:28
@MarcFD
why do you include some spatialfilters in mam? i personally use SmoothHiQ, which is the best so far, or do you know a better one?

vlad59
9th August 2002, 07:43
@bb and others

I forgot to inline some functions so now Convolution3D is 1.2fps faster. I'll release the beta1 with sources tonight (in about 10 hours)

@Trbarry
I tested your STMedianFilter and it did a very good job (better than convolution3d ;) ) when temporal informations are not interesting (I tested it in a long fade in from full white to a very complex landscape).
Whereas in static scene when you have very usefull temporal information it always soften less than Convolution3d, it also tend to blur the edges a little bit (only visible at 2* zoom).
Comparing speed was not funny :D , your filter is 2 times faster than mine. I'll definitly have to learn in ASM & MMX .... :( .

I haven't tried to play with the parameters so I only use your suggested settings. I can make a better test this weekend.

trbarry
9th August 2002, 07:52
Vlad -

Actually when I wrote the readme file I had mostly tested with my fairly noisy Tivo capture. For DVDs or other cleaner material I'd probably recomend filtering less, something like:

STMedianFilter(8,15,5,7,8,15)

And just about anything can go faster with a bit more assembler. :devil:

- Tom

vlad59
9th August 2002, 08:14
Originally posted by trbarry
Vlad -

Actually when I wrote the readme file I had mostly tested with my fairly noisy Tivo capture. For DVDs or other cleaner material I'd probably recomend filtering less, something like:

STMedianFilter(8,15,5,7,8,15)

And just about anything can go faster with a bit more assembler. :devil:

- Tom

I test with an old anime reedited in DVD without any good mastering. It has heavy noise and you can even see some scratch from the master, my VHS tape look better than the DVD, I've made a bad deal when I bought those DVD ;) .

So your suggested settings were good enought in most scenes and they could have been stronger in low motion scene.

Convolution3D has already a lot of ASM inside (every time critical part) but they aren't well optimized (I know it), so there's still a lot to do and I don't have your experience ;) ;) ;)

Marc FD
9th August 2002, 09:44
@ivion
i'll take a look next week. i go in holidays today :)

@sorchED
SmoothHIQ is great. No pb. but it's not the faster filter.
the filters i add in MAM would be used in next version in MAD mode.
And this would go damn faster (i'm aiming 20 fps)
It's just an another part of the filter (more strong filtering, more speed) more designed for VHS encodes or animes.

vlad59
9th August 2002, 11:33
@Tom

I just had a look to your sources and I found it :

you only work with bytes and I'm obliged (due to my weigth matrix) to work with word.

That's may be an explaination for the speed différence. ;) ;)

Sorry, but I was so sad to be two times slower, I couldn't have slept before finding a good reason for this difference. ;) :D ;) :D

EDIT : To tell the truth, another good reason is my code is crap sometimes :(

trbarry
9th August 2002, 18:03
To tell the truth, another good reason is my code is crap sometimes

Everybody's code is crap sometimes. ;)

Mine is no exception. But the advantage of open source and the reason I always force folks to download my source along with the DLL's (apart from free backup) is because people write me little notes telling me how to de-crap-itize it. This often gets things fixed in short order.

I think you have sent me a couple of these yourself. :)

- Tom

vlad59
9th August 2002, 19:24
@Tom

Yep, tomorrow everybody will be able to make my code better, I hope so.

@all

This time the last alpha Convolution3D (alpha 5).

The only change is more speed wich is always a good news.

Just a little precision on how the tresholds works :

The parameters of Convolution3d are only here to take care of edges and scene change. You can increase them (especially the chroma treshold) but stop as soon as you see some blurring around the edges or some ghosting. With the settings proposed you shouldn't have any of these problems.


EDIT : Removed old attachement

Slyde
10th August 2002, 22:19
All of you really impress me, I'm really slow as hell compared to all of you... still struggling with master trbarry filter sources to learn and understand. I have just be able to make a basic deinterlacer, CNR port for K!TV and two or three ridiculous things so far... Perhaps it's not good to begin with such optimized code, it really took me a loooong time to understand a bit of GreedyHMA sources :(


Marc FD => tu n'es qu'en term ??? AAAHHHHHHHHHHH :eek: :eek: :eek: je crois qu'on tiens un futur master là. Chapeau ! J'ai plus qu'a aller chercher ma corde...

vlad59
10th August 2002, 23:12
@all

New release of Convolution3d (beta 1) with sources.

Changelog :
- Added the simple full 1 matrix
- code is now included (I had no time to comment & clean it, but I promess to release it)

please read the txt file included before testing.
BB's idea of the full 1 matrix seems to work well but I got some strange results :
the result with the full 1 matrix seems to be better (at least for my tired eyes) but the compressibility test isn't better than the normal matrix.

I'm waiting for your tests.

@slyde
les français parlent aux français ;) :D ;) :D ;) :D
I think we are all learning by reading the sources from experienced coders (Tom, Donald, Dividee, Shodan, Poptones, ...... please don't be offended if I forgot you, I'm just tired :o )
That's great, thank you all.


EDIT : attachment is deleted, my full 1 matrix is buggy, sorry

Koepi
12th August 2002, 02:35
Well, I tested convulution3d a little and it gives me nice results, I'm amazed :)

Now I only have to tweak it a little, you have to speed it up and we're done! ;)

Thanks for the nice work!

Best regards,
Koepi

P.S.: any timeframe when you'll fix the full matrix? I'm eager to see the beta :)

vlad59
12th August 2002, 07:22
Hi Koepi,

I'm happy you find Convolution3d usefull.

I already fixed the full 1 matrix but the result are somehow disappointing (so no release :( ) : the compressibility test with the standard matrix (1 2 1) is still better.

Perhaps my source is strange, I hope bb could make a test with his test sources.

Next on my todo list is to add specific temporal tresholds so you can tweak them to be sure to avoid ghosting.
And then I'll try to optimize it better (I hope I can do that ;) ).

If nothing goes wrong, tomorrow you should have the beta.

bb
12th August 2002, 09:53
@vlad59:
I would like to test the Convolution3D with standard and full-1 matrix at the same time; this way it's easier to compare.
BTW: What do you say about the possibility of optimizing the algorithm for a full-1 matrix (in fact you wouldn't need a matrix at all in this special case)?

bb