X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=drivers%2Fusb%2Fmedia%2Fpwc-uncompress.c;h=269cd227ffffaead829493e9c7501ce5c39ab2d2;hb=9bf4aaab3e101692164d49b7ca357651eb691cb6;hp=68b20ecc037dd03242b2ab8d626b46bb7a4d9e3f;hpb=db216c3d5e4c040e557a50f8f5d35d5c415e8c1c;p=linux-2.6.git diff --git a/drivers/usb/media/pwc-uncompress.c b/drivers/usb/media/pwc-uncompress.c index 68b20ecc0..269cd227f 100644 --- a/drivers/usb/media/pwc-uncompress.c +++ b/drivers/usb/media/pwc-uncompress.c @@ -1,4 +1,4 @@ -/* Linux driver for Philips webcam +/* Linux driver for Philips webcam Decompression frontend. (C) 1999-2003 Nemosoft Unv. (webcam@smcc.demon.nl) @@ -21,7 +21,9 @@ themselves. It also has a decompressor wrapper function. */ +#include #include +// #include #include "pwc.h" #include "pwc-uncompress.h" @@ -81,7 +83,6 @@ int pwc_decompress(struct pwc_device *pdev) u16 *src; u16 *dsty, *dstu, *dstv; - if (pdev == NULL) return -EFAULT; #if defined(__KERNEL__) && defined(PWC_MAGIC) @@ -97,16 +98,24 @@ int pwc_decompress(struct pwc_device *pdev) image = pdev->image_ptr[pdev->fill_image]; if (!image) return -EFAULT; - + yuv = fbuf->data + pdev->frame_header_size; /* Skip header */ - if (pdev->vbandlength == 0) { + + /* Raw format; that's easy... */ + if (pdev->vpalette == VIDEO_PALETTE_RAW) + { + memcpy(image, yuv, pdev->frame_size); + return 0; + } + + if (pdev->vbandlength == 0) { /* Uncompressed mode. We copy the data into the output buffer, using the viewport size (which may be larger than the image size). Unfortunately we have to do a bit of byte stuffing to get the desired output format/size. */ - /* - * We do some byte shuffling here to go from the + /* + * We do some byte shuffling here to go from the * native format to YUV420P. */ src = (u16 *)yuv; @@ -140,15 +149,21 @@ int pwc_decompress(struct pwc_device *pdev) dstu += (stride >> 1); } } - else { - /* Compressed; the decompressor routines will write the data + else { + /* Compressed; the decompressor routines will write the data in planar format immediately. */ + int flags; + + flags = PWCX_FLAG_PLANAR; + if (pdev->vsize == PSZ_VGA && pdev->vframes == 5 && pdev->vsnapshot) + flags |= PWCX_FLAG_BAYER; + if (pdev->decompressor) pdev->decompressor->decompress( &pdev->image, &pdev->view, &pdev->offset, yuv, image, - 1, + flags, pdev->decompress_data, pdev->vbandlength); else return -ENXIO; /* No such device or address: missing decompressor */