xbmc/xbmc — pull request #1390 by Voyager-xbmc (2012-09-07 20:17:54+00:00)
Title: [AE] fix remapping - downmixing algorithm

The basic algorithm failed when a given output channel is mixing more than 4 sources. I discovered this when playing a 6.1 DTS-ES on stereo output. I didn't have the center channel, which turned out to be the 5th channel in the mix!!

So when doing 7 ch -> 2 ch, each channel is taking more than 4 sources (e.g. FR = FR+ SR+ BC+ LFE+ FC)

The code seems to optimize in "blocks of 4", but was slightly incorrectly written:
- the number of blocks is not & ~0x3 but >> 2
- the +=4 at the end of the for loop jumps too far, since each line inside the loop already increases the index.

Tested the change, and voilà the 6.1 sounds downmix correctly now.