\section{ Colorspace Conversion } \subsection{ exact YUV } An Integer implementation of the exact RGB to YUV transform is given by \begin{eqnarray} Y &=& ( 77 R + 150 G + 29 B) / 256 \nonumber\\ U &=& (-44 R - 87 G + 131 B) / 256 \nonumber\\ V &=& (131 R - 110 G - 21 B) / 256 \nonumber\\ \nonumber \end{eqnarray} You get the reversed transform by inverting this matrix. I don't have the integer representation here, simply multiply all values by 256/256 if you really need one \dots \begin{eqnarray} R &=& Y + 1.371 V \nonumber\\ G &=& Y - 0.698 V - 0.336 U \nonumber\\ B &=& Y + 1.732 U \nonumber\\ \nonumber \end{eqnarray} \subsection{ something like YUV but faster } Since the wavelet transform is expansive, all computations have to be done using at least 16bit Integers when transforming 8bit Integers. Thus we have to copy the entire image into a buffer of 16bit Integers. The following transform is cheap enough to be done on-the-fly while copying data: \begin{eqnarray} V &=& R - G \nonumber\\ U &=& B - G \nonumber\\ Y &=& G + (U + V) / 4 \nonumber\\ \nonumber \end{eqnarray} You can understand this transform as reversible (1,2) - wavelet transform on a row of three data items. It is expanding (8 input bits require 9 output bits) because of the subtraction -- but this doesn't matter since we need 16bit integers anyway. As usual we can generate the inverse transform by running the algorithm backwards and inverting all operations: \begin{eqnarray} G &=& Y - (U + V) / 4 \nonumber\\ B &=& U + G \nonumber\\ R &=& V + G \nonumber\\ \nonumber \end{eqnarray} If someone needs as 'exact YUV to this colorspace' transform he can simply multiply the two transform matrices together. \subsection{ The Lxy Colorspace } I implemented an integer version of the Lxy colorspace as suggested on the tarkin-dev mailing list. It's not well tested and seems to be buggy due to roundoff errors. You can enable it by defining \verb|TARKIN_YUV_LXY| on top of file \verb|yuv.c|. Feel free to fix bugs and send patches.