PA, PB, PC, ...

Started by escho, February 21, 2014, 09:15:24 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

escho

Please help me understanding the code from raw2dng a bit better:

#define PA ((int)(p->a))
#define PB ((int)(p->b_lo | (p->b_hi << 12)))
#define PC ((int)(p->c_lo | (p->c_hi << 10)))
#define PD ((int)(p->d_lo | (p->d_hi << 8)))
#define PE ((int)(p->e_lo | (p->e_hi << 6)))
#define PF ((int)(p->f_lo | (p->f_hi << 4)))
#define PG ((int)(p->g_lo | (p->g_hi << 2)))
#define PH ((int)(p->h))


For what is PA standing, for a red or for a green pixel?

Edgar
https://sternenkarten.com/
600D, 6D, openSUSE Tumbleweed

a1ex

A struct raw_pixblock contains 8 pixels packed into 14 bytes (each pixel has 14 bits). To read these 8 pixels, you can use PA ... PH. To write them, you can use the setter macros (SET_PA ... SET_PH).

When your struct raw_pixblock is on even lines (first line being 0), PA is red. When it's on odd lines, it's green. I always force the image to begin with a red pixel in order to simplify the coding (though the DNG spec and the CHDK guys like to do things a little more complicated by allowing the image to begin with any color).

There is a generic routine (raw_get_pixel), which is a little slower, but easier to use.

escho

Ahh, I understand. PA is the first pixel of this 8 pixel-block. And dependant of the line, it´s  red or green.
Thanks

Edgar
https://sternenkarten.com/
600D, 6D, openSUSE Tumbleweed