Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revisionNext revisionBoth sides next revision | ||
isp:hsl-_rgb [2019/05/27 23:51] – Igor Yefmov | isp:hsl-_rgb [2019/05/31 03:52] – [Division-less division] Igor Yefmov | ||
---|---|---|---|
Line 2: | Line 2: | ||
The text below is based on an Excel workbook attached to this page: {{ : | The text below is based on an Excel workbook attached to this page: {{ : | ||
===== Preface ===== | ===== Preface ===== | ||
- | Much is written and is available on the color space conversion from HSL to RGB (for example this [[https:// | + | Much is written and is available on the color space conversion from HSL to RGB (for example this [[https:// |
The below article details the way to perform this conversion without the use of division operations with high enough precision as to satisfy the imaging pipeline quality requirements for the SUB2r camera based on Artix-7 100T FPGA. | The below article details the way to perform this conversion without the use of division operations with high enough precision as to satisfy the imaging pipeline quality requirements for the SUB2r camera based on Artix-7 100T FPGA. | ||
Line 20: | Line 20: | ||
\[\frac{1}{x} = \frac{1*N}{x*N}\] | \[\frac{1}{x} = \frac{1*N}{x*N}\] | ||
and choosing \(N\) such that \(x*N\) is a whole power of \(2\) we have an optimization where a division is replaced by a pair of a multiplication followed by a (super cheap!) bit-shift operation by \(Z\) bits: | and choosing \(N\) such that \(x*N\) is a whole power of \(2\) we have an optimization where a division is replaced by a pair of a multiplication followed by a (super cheap!) bit-shift operation by \(Z\) bits: | ||
- | \[\frac{C}{x} = C*\frac{1}{x} = C*\frac{1*N}{x*N} = C*\frac{N}{2^Z} = [(C*N)>>Z]\] | + | \[\frac{C}{x} = C*\frac{1}{x} = C*\frac{1*N}{x*N} = C*\frac{N}{2^Z} = [(C*N) |
The value \(Z\) depends on the needed precision and, of course, the higher the \(Z\) the less precision loss there will be in the end. | The value \(Z\) depends on the needed precision and, of course, the higher the \(Z\) the less precision loss there will be in the end. | ||