(Cross posted to libjpeg-turbo-users list.)
I'm having a problem with libjpeg-turbo.
The tjCompress2 function requires an RGB or Greyscale image to compress.
http://libjpeg-turbo.sourceforge.net/ljtdoc.branches_1.3.x/turbojpeg-c/group___turbo_j_p_e_g.html#gaba62b7a98f960839b588579898495cf2
(Sorry, you'll have to paste that link as it breaks markdown.)
My webcam (a PS3 EyeToy) has the following characteristics:
chris@raspberrypi ~ $ v4l2-ctl --get-fmt-video
Format Video Capture:
Width/Height : 320/240
Pixel Format : 'YUYV'
Field : None
Bytes per Line: 640
Size Image : 153600
Colorspace : SRGB
From http://en.wikipedia.org/wiki/JPEG#Color_space_transformation it looks like YUYV is equivalent to the YCbCr that JPEG needs (though it has half the Cb and Cr data, compared with luminance). Have I understood correctly?
I know how to turn YUYV into RGB, using a matrix, but it seems a waste of scarce CPU cycles and colour accuracy, to perform two colour space changes when none are needed.
Is there a function which can directly compress a YUYV image into a JPEG?