Add new comment

Row order reversing will work

Row order reversing will work differently for odd and even row count:
Imagine the pattern
RGRGRGR (row #0)
GBGBGBG (row #1)
RGRGRGR (row #2)

For even number of rows (say 2), reversed pattern will be
GBGB.. (former row #1)
RGRG... (former row #0)

For odd number, reversed pattern is the same as original one.

So, if BOTTOM-UP really changes bayer pattern you need to ensure that it works correct for both odd and even row count.

Alternatively, calculate your pattern for left-low corner, not for left-top:

for(row = height-1; row >= height-2; row--)
  for(col = 0; col < 2; col++)
     pattern[j++] = cdesc[COLOR(row,col)]

-- Alex Tutubalin