Small loops, Duff's device, Core2 and Athlon64 
Thursday, April 19, 2007, 05:31 PM - Optimization
Today, I played a bit with loops unrolling and AMD Code Analyst.
One of the ways to unroll loops in C is to use a Duff's device. While a bit strange at first, this is quit handy for quick loops unrolling.

While having a look at the generated assembly code with and without it (compiler is Visual Studio 2005/8), I noticed a few interesting things:

*VC8 is able to unroll loops, provided that the number of runs is known at compile time. My loop should run 16x, and VC8 unrolled it 4x. It might seem trivial for a compiler, but I don't remember previous versions having this ability.

*On a Core2, my "manual" 4x unrolling (using a Duff's device) is still faster than the 4x auto-unrolled produced by VC8, due to different instructions scheduling.

The generated code flow is a bit different in both cases:

*VC8 auto-4x-unroll features a "continue" jump at the end of the code block for looping, targeting the beginning of the code block. In my 16x loop, this jump is followed 3 times, and skipped the last time.

*My Duff's version features an "exit" jump after the first part of the unrolling (1*code - conditional jump - 3*code). This jump is skipped the first 3 times, and followed on the last pass.

The interesting point is provided by Code Analyst, and its pipeline simulator. I used it to simulated an Athlon64 pipeline, and looked at the result:
In the case of the Duff's device, the exit jump is mispredicted 3 times, leading to the Duff's version being slower than the automatic VC8 unrolling. This being mispredicted 3x, it means that an Athlon64 is unable to predict such a branch, always predicting it to be followed.

However, the code is faster using Duff's device when running over a Core2. That means that using a trick such as this will perhaps increase performance a bit on Core2, but will quite reduce speed on Athlon64, by conflicting with its branch predictors.
Considering that VC8 is able to unroll some loops by itself, we should better think twice before playing with tricks such as Duff's one.
  |  0 trackbacks   |  permalink   |  related link

Sony A10 and A1 at PMA 2007 
Sunday, March 11, 2007, 11:47 PM - Photography
Sony shown two new DSLR from the alpha line at PMA 2007. One (let's call it a10) is supposed to be a Minolta 7D replacement, and the other one (let's call it a1) is an higher range model.

Those are just mock-ups, not yet real cameras. However, that is still a quite good thing, as it states where Sony wants to go regarding the alpha line. Many Minolta users (including me) were wondering about still using the alpha system, or switching to other brands (with many people looking at Pentax and the K10D). It does not mean that everyone wants to buy a new higher end camera now, but it's important to know that there are higher end models than the current one (a100) planned.
This means a possible migration path, but also accessories, lenses (including third party ones), support,...

A good move from Sony in order to bring peace of mind to all the current Minolta users.
  |  0 trackbacks   |  permalink   |  related link

Rawstudio: an open source raw converter 
Tuesday, February 20, 2007, 05:48 PM - Photography
Raw converters was an area with an obvious lack of open source offer.
Of course, basic solutions like using the UFRaw plugin for the Gimp or even directly using DCRaw from the command line were possible. But it only provides a minimal solution (not even mentionning that the Gimp does not yet support 16 bits per channel), and not really what I have in mind for a usable raw converter.

To me, a raw converter should provide at least the following:
*handling of raw files (of course)
*luma/colors global manipulations
*crop/resize/rotate
*sharpen
*denoising
*ability to copy settings between files
*batch processing

And a really good one would also provide correction tools (lens correction).

Rawstudio seems to be the first piece of open source software going in this direction. With a few version iterations, it could become something really nice, filling a need.

Now, please explain me why is there no Windows version available?
  |  0 trackbacks   |  permalink   |  related link

Cult lens versus cheap modern lens 
Saturday, January 27, 2007, 08:09 PM - Lenses
As a zoom lens for my Dynax 5D, I originally bought a relatively cheap 70-300 Tamron zoom. With all the positive things said on the Dyxum forum about the old lens known as the "Beercan", I decided to buy one. In order to know how do both really compare, I decided to do a few tests.

So here it is, a comparison of those two lenses:
*Minolta AF 70-210 F4
*Tamron AF 70-300 F4-5.6 LD

The Minolta beeing an old design from about 1985, it is only available as second hand, while you can build the Tamron as new. Regarding price, both share a similar price.

First, let's compare both, without a camera.

*Body:
The Tamron body is plastic, while the Minolta one is a metal body. Hopefully, both have a metal rear mount. This is purely subjective, but the Tamron really feels cheap when compared to the Beercan. It seems that both are not in the same league. Small detail: serial is sticked on the Tamron, while engraved on the the Minolta.

*Weight:
435g for the Tamron, 695g for the Beercan. That's a important difference for lenses that are supposed to be used without mono/tripod.


*Zoom range:
As indicated by their respective names, the Tamron is 70-300, while the Minolta is only 70-210. Obviously 1 point for the Tamron.

*Aperture:
The Minolta is a constant F/4 aperture, while the Tamron is a more usual 4-5.6 aperture. At maximum zoom, the Minolta is 1 stop faster, but you should note that when set at 210mm, the Tamron can be opened up to F/5, so it's only about 1/2 F-stop slower than the Minolta. The Minolta being a constant maximum aperture lens, it is easier to use in fully manual mode.

*Minimum aperture:
The minimum aperture on the Tamron is F/22, while the Minolta can be closed down to F/32, 1 F-stop slower. In some situations, it means that you could perhaps avoid using a neutral density filter on the Minolta if you need a slow shutter speed.

*Macro:
Both are claimed to be able to do some macro shots, but don't count on them if you really want to often do macrophotography. They only achieve their maximum magnification (1:4 on the Minolta, 1:2 on the Tamron) at full zoom extension, so it's not easy at all when compared to a 100mm macro.

*Filter diameter:
55mm for the Minolta, 62mm for the Tamron. Both filter sizes will be in a similar price range.

*Zoom ring:
When zooming, the Tamron extends while the Minolta does not. Both zoom rings share a similar size, but the Minolta is a lot more smooth. No zoom creep on those lenses, and front element does not rotate when zooming.

*Focus ring:
Front element rotates on both lenses when focusing. Zoom ring is a lot more smooth on the Beercan, but the focus ring is very small. It is so small that you might perhaps want to use the lens hood to rotate the focus ring. As the Beercan was released when Minolta was pushing its first autofocus SLRs, it seems to be a purely marketing decision.

*Rear element:
While the rear element is sealed and easily reachable for cleaning on the Minolta, there is something to be said about the Tamron.
On the Tamron, the rear element is a bit deep inside the lens body, so it is not that easy to reach when you want to clean it. Worst, it goes even deeper inside the lens when zooming, opening access to a kind of internal cavity located around the optical elements. If dust goes inside, it will be nearly impossible to clean. It won't directly affect the optical performance, but can then go into you camera body when zooming in or out.

Now, it's time to test both zooms on a camera. I tried them on my 5D, which is using a 6MP sensor. In all shots, exif info should still be present.

*Focus speed:
None of those lenses is a speed king, but focusing is faster on the Minolta. It's also less noisy than the Tamron when focusing.

*Resolution test:

Minolta, 75mm, F/4:


Tamron, 75mm, F/4:


Minolta, 75mm, F/8:


Tamron, 75mm, F/8:


At 75mm, wide open, there is not much difference between both lenses. Closed down to F/8, the Minolta Beercan is a lot sharper than the Tamron.

Minolta, 210mm, F/4:


Tamron, 210mm, F/5:


Minolta, 210mm, F/8:


Tamron, 210mm, F/8:


At 210mm, the first thing that can be noticed is that the real focal lengths are different. I don't know if the Tamron is more than the reported 210mm or if the Beercan is less than 210mm, but practically the Tamron's focal length is higher than the one from Minolta.
Regarding optical resolution, beeing wide open or closed down to F/8, the Minolta is a lot sharper than the Tamron. To me the Beercan wide open (F/4) is even sharper than the Tamron closed down to F/8.


Tamron, 300mm, F/5.6:


Minolta, 210mm interpolated to 300mm, F/8:


Tamron, 300mm, F/8:


300mm can only be done using the Tamron. At this focal length, it is really soft wide open. Closed down to F/8, it's better, but still soft.
As a comparison, I cropped a 210mm shot from the Beercan, and resized it using Paint Shop Pro. When comparing the "emulated" 300mm from the Minolta to the real 300mm from the Tamron, it seems to me that the Minolta is still providing more details than the Tamron. However, we can also notice that the noise pattern from the camera sensor is bigger (the F/8 shots are using 400 iso).
Quite an amazing result from the Beercan here, that makes you think twice about the 90mm extra focal length that is provided by the Tamron.

*Color test:

Minolta:


Tamron:


Probably not the best color test, but to me there is not much difference regarding color there.

*Chromatic aberration (color fringing) test:

Minolta, 210mm, F/4:


Minolta, 210mm, F/8:


Tamron, 300mm, F/5.6:


Tamron, 300mm, F/8:


Wide open, there is some noticeable fringing with both lenses, with a bit more on the Beercan. Closed down to F/8, chromatic aberrations are reduced and both lenses seem to produce about the same amount of fringing.

*Bokeh test:

Probably not the best case, but here are my test shots:

Minolta, 210mm, F/4:


Minolta, 210mm, F/5:


Minolta, 210mm, F/8:


Tamron, 210mm, F/5:


Tamron, 210mm, F/8:


Differences are subtle, so I will let you draw your own conclusion there.
To me the conclusion regarding the bokeh test is that it was a bad place to change lenses, and that I now have to clean my sensor.

As a final conclusion, I would say that I personally prefer the Beercan to the Tamron. The only real advantages for the Tamron are weight and the fact that it can be bought new.
Now, if we could have a new lens based on the Minolta Beercan, but with a reduced size/weight by cropping it to APS sensors, and with an improved coating, that would be a very good modern lens.
  |  0 trackbacks   |  permalink   |  related link


Back Next