Tuukka Toivonen (tuukkat@xxxxxxxxxx): > On Tue, 5 Aug 2003, Billy Biggs wrote: > > >> >> Then some cameras supported by qc-usb can deliver MJPEG compressed frames > >> >> and I have used > >> >> #define VIDEO_PALETTE_MJPEG (('q'<<8) | 2) /* Grab video in compressed MJPEG format */ > >> No. Looks like it's in 4:2:2 packed format (YUY2, I guess). I didn't write > > mpeg2dec only has 4:2:0 conversion code, no 4:2:2 code, since MPEG2 > > You're right. Looks like it's 4:2:0 planar, not 4:2:2 packed. This is the > relevant conversion function (where yuv2rgb_func converts two scanlines): > > /* Convert YUV image to RGB */ > static void qc_mjpeg_yuv2rgb(struct qc_mjpeg_data *md, void *dst, u8 *py, > u8 *pu, u8 *pv, > int width, int height, int rgb_stride, int y_stride, int uv_stride) > { > height >>= 1; > do { > md->yuv2rgb_func(md, py, py + y_stride, pu, pv, dst, ((u8 *)dst) + rgb_stride, width); > py += 2 * y_stride; > pu += uv_stride; > pv += uv_stride; > dst = ((u8 *)dst) + 2 * rgb_stride; > } while (--height); > } > > > It sounds like you might be using the wrong conversion function. > > No, the function is right, I was just reading it wrong. I was referring to the extents. If you're using this MPEG2 conversion function to convert JPEG data to RGB, then you're likely using the wrong conversion function (your colours will be slightly wrong). -Billy