Friday 7 November 2014

Tim’s Vermeer - II. DSD

Yesterday I wrote about Tim Jenison and his cool research on the topic of Vermeer and the photo-realism of the Dutch School, captured in a wonderful documentary called “Tim’s Vermeer” from Sony Classics.  I mentioned the extraordinary story of how Jenison constructed a plausible apparatus by which, he posited, Vermeer may have actually produced his revolutionary paintings.  Jenison, a graphics designer and non-artist, went further and used it to produce his own version of Vermeer’s “The Music Lesson”, something which, had he done it in 1650, might conceivably have elevated the name Jenison into the pantheon of the greats.

Jenison’s technique in effect had him work his way across the canvas, comparing each fragment of the painting with the corresponding fragment of an image of his subject produced by a camera obscura.  In essence, you consider a spot on your canvas, and compare what the obscura image suggests should go there with what is already there.  If you perceive a discrepancy, you can easily correct it.  Or modify it later if, maybe as a result of what you put in an adjacent area, you come up with something better - in contrast to, for example, how an ink-jet printer might approach the same job.  “The Music Lesson” is about two feet square, and it took Jenison something like 130 days to complete the painting.  The unbreaking concentration required was enormous, and in turn nearly broke him.

While watching all this I was immediately struck by an interesting comparison with the Sigma Delta Modulator (SDM) used to produce a DSD data stream.  The SDM takes some input data, which may be an analog signal or a digital data stream, and sets about producing an output data stream.  Each time it needs to create an output value it sets about comparing two things - the input value, plus the input values that preceded it, and the previous output values.  It uses those to calculate what the new output value should be. 

This is like Jenison’s apparatus.  He goes to a place on the canvas, looks what’s there, and compares that to what’s in the equivalent place on the original image.  He then uses his judgement to decide what he needs to paint in that particular place.  In a practical sense, it’s not that he seeks something right or wrong in absolute terms about the smudge of paint that needs to be applied, more a question of what looks best given the available comparables.  “Using his judgement” is a convenient phrase which undervalues the colossal amount of visual processing power that the brain is able to bring to bear on the task.

This illuminates one of the limitations of a true SDM in a DSD application.  DSD requires that the output of the SDM has to be either 1 or 0.  If, on balance, the SDM figures out that the best output value is actually 0.5, DSD doesn’t have that as an option.  It has to choose either 1 or 0.  The SDM architecture only allows us to look historically at both input and output data and use that to make our choice.  If both 1 and 0 are equally wrong, then it does’t matter which one we choose.  We just hope that the SDM can take the error fully into account when it comes to choosing the next output value, and the ones after that.  In fact the situation is always like that.  The SDM, in reality, always figures out a best output value somewhere between 0 and 1, and never comes up with an output value which is either exactly 1 or exactly 0.  And, unlike Jenison, the SDM doesn’t get to go back and do a make-over once it’s made its choice.  In that regard, the SDM is a bit like the ink-jet printer analogy.

Given that the ideal output value is never 1 or 0, and that we have to pick one or the other and hope for the best, what do we do if it turns out that we’d have been better off choosing the other one?  The answer is that, in the grand scheme of things, we end up with a combination of higher background noise and increased distortion.  But in the end, by designing our SDMs optimally, we do get those parameters down to the point where the overall performance is pretty darned good.

Actually, there is a way to get around that problem.  Let’s take an ordinary SDM whose output value is going to be either 1 or 0.  We can do some kind of “what if” calculation, and say “What if we chose a 1?” and calculate what the output value after that was going to be.  We can do the same thing for “What if we chose a 0?”.  In each case the SDM will chose either 1 or 0 for the subsequent output value.  What we are doing is, instead of selecting between two possible output values, 1 and 0, we are selecting between 4 possible output sequences, 10, 11, 00, and 01, which begin with either 0 or 1.  We get to choose which of the 4 gives us the best result, but this comes at the expense of a doubling of the amount of processing that we have to do.  Note that by choosing between those four possible values, we are only selecting the first bit, and not both bits of the sequence.  In other words, if we prefer 11 or 10, then all we are doing is selecting the single output value of 1, and if we prefer 01 or 00 all we are doing is selecting the single output value 0.  This process is called “Look-Ahead” for obvious reasons.

Look-Ahead can give seriously improved performance in both noise floor and distortion, but in order to achieve that, it turns out you need to be able to look a long way ahead, not just two or three bits.  In reality, 10 or 16 bits of look-ahead are required, and, at first sight, each additional bit of look-ahead doubles the amount of processing time required.  At that rate, 16 (or even 10) bits of look-ahead comes at a prohibitive processing cost.  However, like in most things mathematical, when smart people are motivated to look into it, solutions can often be found.  By analyzing how the mathematics of look-ahead works, you realize that the same calculations are being repeated in multiple branches of the look-ahead tree, and can find ways of only doing them once.  Additionally, some of the branches can be identified early on as being bad candidates for the final decision and can be pruned at an early stage.  Finally, it is possible to expand the basis upon which we decide how ‘good’ or ’bad’ a branch is, and thereby do a better job of eliminating the ‘bad’ ones early on.

Taken together, along with the relentless rate of progress of computer power, these “look-ahead” SDM architectures are on the verge of being implementable.  They may not have an immediate impact on consumer DACs, but they could make their presence felt in DSD studio equipment, where the lower noise floor and distortion may open the door to effective mixing and other rudimentary signal processing.

All stuff that Vermeer would never have thought of.  Or, for that matter, Tim Jenison.