/* To convert channel gamma value to linear value: */ gamma->tables[chan_number].u16[chan_val] /* ... or when result has no more than 8bits ... */ gamma->tables[chan_number].u8[chan_val] /* The inverse transformation is done as: */ gamma->tables[chan_count + chan_number].u8[chan_val] /* ... or when original pixel channel had more than 8bits ... */ gamma->tables[chan_count + chan_number].u16[chan_val] /* * When doing more than one conversion it's better to save pointers to * individual table (example for RGB888): */ uint16_t *R_2_LIN = gamma->tables[0].u16; /* ... */ uint8_t *R_2_GAMMA = gamma->tables[3].u8; /* ... */