Stefano Tommesani

  • Increase font size
  • Default font size
  • Decrease font size

Slow blits with latest nVidia drivers

E-mail Print PDF

An application of mine uses DirectDraw to draw video frames on multiple screens, and so far the visualization pipeline used a group of off-screen YUV surfaces that, at the end of the process, are drawn into the primary surface. So this is the code that creates the primary surface:

ZeroMemory(&ddsd, sizeof(ddsd));
ddsd.dwSize = sizeof(DDSURFACEDESC);
ddsd.dwFlags = DDSD_CAPS;
ddsd.ddsCaps.dwCaps    = DDSCAPS_PRIMARYSURFACE;
if ((ddrval = lpDD->CreateSurface(&ddsd, &lpDDSPrimary, NULL)) != DD_OK)

and this is the code that creates an off-screen YUV surface:

Last Updated on Friday, 27 July 2012 11:12

Easy multi-thread programming with Delphi

E-mail Print PDF

In the AltaPixShare software app, when the user drags a group of images to the target location, the following code iterates over the list of images, and for each image creates the destination file:

for i := 0 to Pred(ActiveImages.Count) do
CurrentImage := TProcessedImage(ActiveImages[i]);
CurrentImage := nil;
if Assigned(CurrentImage)
then begin

Given that applying a filter to a large image and then writing the output image into a JPEG file is a time-consuming task, this is a clear case for multi-threaded optimization, so that multiple images are processed at the same time on different CPU cores. And using the amazing AsyncCalls library, we can achieve this result with only a few lines of code. These are the steps required to turn this serial code into a multi-threaded one:

Last Updated on Saturday, 20 April 2013 17:19

Using Amazon SimpleDB from Delphi

E-mail Print PDF


Table of contents 1 - Introduction to Amazon SimpleDB 2 - SimpleDB and Delphi 3 - Extending Data.Cloud.AmazonAPI

Download_32 Download SimpleDBExplorer project files and executable

Introduction to Amazon SimpleDB

The best description of the Amazon SimpleDB service is given by Amazon itself here:

Amazon SimpleDB is a highly available and flexible non-relational data store that offloads the work of database administration. Developers simply store and query data items via web services requests and Amazon SimpleDB does the rest. Unbound by the strict requirements of a relational database, Amazon SimpleDB is optimized to provide high availability and flexibility, with little or no administrative burden. Behind the scenes, Amazon SimpleDB creates and manages multiple geographically distributed replicas of your data automatically to enable high availability and data durability. The service charges you only for the resources actually consumed in storing your data and serving your requests. You can change your data model on the fly, and data is automatically indexed for you. With Amazon SimpleDB, you can focus on application development without worrying about infrastructure provisioning, high availability, software maintenance, schema and index management, or performance tuning.

Amazon stresses that SimpleDB is optimized for high availability, thaks to distributed replicas of data, and low administrative costs, as there are no schemas and indexes to manage. With SimpleDB, you don't have to define a schema for each database table before you can use it, and you don't have to change that schema before storing your data in a different way. As there is no schema, there are no data types, as all data values are treated as variable length char data. So, if you want to add a new field to an existing database, you just data the new field to the data items that require it, and there is no enforcing that all data items contains the same fields. The drawback of having no schema is that you have to handle formatting and type conversions in your code, and this has a serious impact on queries.

The terminology used in SimpleDB is different from the usual DBMS one, so the following table shows how the different terms are related:

DBMS Amazon SimpleDB
table domain
row item
column attribute

The domain is analogous to a database table, but a domain has no schema, so the only parameter you can set is the name of the domain. All the data stored in a domain has the form of name-value attribute pairs, and each attributes pair belongs to an item, which is similar to a table row. The attribute name is similar to a table column, but each item can have different attribute names, so you can store data with different layouts in the same domain, and add new fields to items without restructuring the table. It is also possible to have, for a given attribute, not just one value, but an array of values, so when you add an attribute name-value pair to an item, you can choose if SimpleDB should replace the existing pair with the same attribute pair, or add the new value to the existing pair.

Queries on SimpleDB are mostly done with a key-value approach, where you retrieve an item and its attributes from the item's name. But you can also use a SQL-style query language to issue queries over the scope of a single domain. When designing queries, you should be aware that all the data stored in SimpleDB is treated as plain string data (be careful with numerical data!), and that all values are automatically indexed.

Last Updated on Friday, 27 July 2012 11:12

AltaCdCover - convert CD covers

E-mail Print PDF

AltaCdCoverQuickly convert a digipak CD cover into a traditional jewel-box CD back cover!

Just drop the CD cover to convert into the source area, AltaCdCover will automatically recognize if it contains both front and back sides or only the back side, drop the front side if found, and reconstruct the missing spine, finally adjust the resulting image's aspect ratio so that it matches that of jewel-box back covers, without requiring any action from you! Optionally, you can adjust for non-standard spine sizes using the slider on the toolbar.

You can download the latest version of AltaCdCover from the Download section of the site.

Last Updated on Saturday, 01 June 2013 15:19

AltaPixShare - free image optimization and sharing

E-mail Print PDF


DownloadSmallYou're having a chat on Skype with a friend of yours, talking about your last holiday, and then you want to send him some pictures. Your new 16 megapixel camera takes amazing pictures, so you drop them in the chat window, and... it takes forever to send them! In fact, each photo is bigger than 6 megabytes, so sending just 20 pictures requires more than 100 megabytes of bandwidth usage. And your friend is just watching those photos on a PC screen, which has a 1 to 2 megapixel resolution, so nearly 90% of the transferred resolution is wasted.

So a simple solution would be opening each picture in an image editor, rescaling it, saving it with a different name and, finally, dropping the new file to the chat window. Boring for just an image, do you really want to repeat it for each picture?

Luckily, there's a simpler, quicker and free solution, AltaPixShare! Just drop the pictures in the app, choose the rescaling factor with a single mouse click, and optionally apply an image effect, then drop them all to the chat window with a single mouse gesture.

Last Updated on Friday, 09 August 2013 20:14

AltaLux in XnView

E-mail Print PDF

The AltaLux image enhancement filter is now available in the popular XnView image viewer!

Now you can enjoy AltaLux technology inside an advanced image viewer and editor, so trying how AltaLux can effectively enhance your photos is just a click away while you keep using your favourite image viewer.


Last Updated on Friday, 14 October 2011 12:27

Page 8 of 9
View Stefano Tommesani's profile on LinkedIn

Latest Articles

Fixing Git pull errors in SourceTree 10 April 2017, 01.44 Software
Fixing Git pull errors in SourceTree
If you encounter the following error when pulling a repository in SourceTree: VirtualAlloc pointer is null, Win32 error 487 it is due to to the Cygwin system failing to allocate a 5 MB large chunk of memory for its heap at
Castle on the hill of crappy audio quality 19 March 2017, 01.53 Audio
Castle on the hill of crappy audio quality
As the yearly dynamic range day is close (March 31st), let's have a look at one of the biggest audio massacres of the year, Ed Sheeran's "Castle on the hill". First time I heard the song, I thought my headphones just got
Necessary evil: testing private methods 29 January 2017, 21.41 Testing
Necessary evil: testing private methods
Some might say that testing private methods should be avoided because it means not testing the contract, that is the interface implemented by the class, but the internal implementation of the class itself. Still, not all
I am right and you are wrong 28 December 2016, 14.23 Web
I am right and you are wrong
Have you ever convinced anyone that disagreed with you about a deeply held belief? Better yet, have you changed your mind lately on an important topic after discussing with someone else that did not share your point of
How Commercial Insight changes R&D 06 November 2016, 01.21 Web
How Commercial Insight changes R&D
The CEB's Commercial Insight is based on three pillars: Be credible/relevant – Demonstrate an understanding of the customer’s world, substantiating claims with real-world evidence. Be frame-breaking – Disrupt the