mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Jesper Juhl <juhl-lkml@dif.dk>
To: Luc Saillard <luc@saillard.org>
Cc: linux-kernel <linux-kernel@vger.kernel.org>
Subject: [PATCH][1/3] pwc-uncompress cleanup - whitespace cleanups.
Date: Mon, 20 Jun 2005 23:11:19 +0200 (CEST)	[thread overview]
Message-ID: <Pine.LNX.4.62.0506202303050.2369@dragon.hyggekrogen.localhost> (raw)

This patch makes whitespace cleanups to 
drivers/usb/media/pwc/pwc-uncompress.c
It makes the following changes:
 - lines stay within 80 columns.
 - makes testing of pointer vs NULL use the !ptr form consistently, the 
   file was mixing (!ptr) and (ptr == NULL).
 - removes some trailing whitespace.
 - tabs vs spaces fixes.
 - make if statements match CodingStyle
     if (foo) {
       /* ... */
     } else {
       /* ... */
     }
 - remove empty lines at end of file.

There are no functional changes made by the patch.


Signed-off-by: Jesper Juhl <juhl-lkml@dif.dk>
---

 drivers/usb/media/pwc/pwc-uncompress.c |  135 ++++++++++++++++-----------------
 1 files changed, 67 insertions(+), 68 deletions(-)

--- linux-2.6.12-orig/drivers/usb/media/pwc/pwc-uncompress.c	2005-06-17 21:48:29.000000000 +0200
+++ linux-2.6.12/drivers/usb/media/pwc/pwc-uncompress.c	2005-06-20 22:53:51.000000000 +0200
@@ -38,7 +38,7 @@ int pwc_decompress(struct pwc_device *pd
 	u16 *src;
 	u16 *dsty, *dstu, *dstv;
 
-	if (pdev == NULL)
+	if (!pdev)
 		return -EFAULT;
 #if defined(__KERNEL__) && defined(PWC_MAGIC)
 	if (pdev->magic != PWC_MAGIC) {
@@ -48,7 +48,7 @@ int pwc_decompress(struct pwc_device *pd
 #endif
 
 	fbuf = pdev->read_frame;
-	if (fbuf == NULL)
+	if (!fbuf)
 		return -EFAULT;
 	image = pdev->image_ptr[pdev->fill_image];
 	if (!image)
@@ -57,8 +57,7 @@ int pwc_decompress(struct pwc_device *pd
 	yuv = fbuf->data + pdev->frame_header_size;  /* Skip header */
 
 	/* Raw format; that's easy... */
-	if (pdev->vpalette == VIDEO_PALETTE_RAW)
-	{
+	if (pdev->vpalette == VIDEO_PALETTE_RAW) {
 		memcpy(image, yuv, pdev->frame_size);
 		return 0;
 	}
@@ -69,79 +68,79 @@ int pwc_decompress(struct pwc_device *pd
 		   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
-			 * native format to YUV420P.
-			 */
-			src = (u16 *)yuv;
-			n = pdev->view.x * pdev->view.y;
-
-			/* offset in Y plane */
-			stride = pdev->view.x * pdev->offset.y + pdev->offset.x;
-			dsty = (u16 *)(image + stride);
-
-			/* offsets in U/V planes */
-			stride = pdev->view.x * pdev->offset.y / 4 + pdev->offset.x / 2;
-			dstu = (u16 *)(image + n +         stride);
-			dstv = (u16 *)(image + n + n / 4 + stride);
-
-			/* increment after each line */
-			stride = (pdev->view.x - pdev->image.x) / 2; /* u16 is 2 bytes */
-
-			for (line = 0; line < pdev->image.y; line++) {
-				for (col = 0; col < pdev->image.x; col += 4) {
-					*dsty++ = *src++;
-					*dsty++ = *src++;
-					if (line & 1)
-						*dstv++ = *src++;
-					else
-						*dstu++ = *src++;
-				}
-				dsty += stride;
+
+		/*
+		 * We do some byte shuffling here to go from the
+		 * native format to YUV420P.
+		 */
+		src = (u16 *)yuv;
+		n = pdev->view.x * pdev->view.y;
+
+		/* offset in Y plane */
+		stride = pdev->view.x * pdev->offset.y + pdev->offset.x;
+		dsty = (u16 *)(image + stride);
+
+		/* offsets in U/V planes */
+		stride = pdev->view.x * pdev->offset.y / 4 + pdev->offset.x / 2;
+		dstu = (u16 *)(image + n +         stride);
+		dstv = (u16 *)(image + n + n / 4 + stride);
+
+		/* increment after each line */
+		stride = (pdev->view.x - pdev->image.x) / 2; /* u16 = 2 bytes */
+
+		for (line = 0; line < pdev->image.y; line++) {
+			for (col = 0; col < pdev->image.x; col += 4) {
+				*dsty++ = *src++;
+				*dsty++ = *src++;
 				if (line & 1)
-					dstv += (stride >> 1);
+					*dstv++ = *src++;
 				else
-					dstu += (stride >> 1);
+					*dstu++ = *src++;
 			}
-	}
-	else {
+			dsty += stride;
+			if (line & 1)
+				dstv += (stride >> 1);
+			else
+				dstu += (stride >> 1);
+		}
+	} 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)
-		 {
-		   printk(KERN_ERR "pwc: Mode Bayer is not supported for now\n");
-		   flags |= PWCX_FLAG_BAYER;
-		   return -ENXIO; /* No such device or address: missing decompressor */
-		 }
-
-		switch (pdev->type)
-		 {
-#if 0		 
-		  case 675:
-		  case 680:
-		  case 690:
-		  case 720:
-		  case 730:
-		  case 740:
-		  case 750:
-		    pwc_dec23_decompress(&pdev->image, &pdev->view, &pdev->offset,
-				yuv, image,
-				flags,
-				pdev->decompress_data, pdev->vbandlength);
-		    break;
-		  case 645:
-		  case 646:
-		    /* TODO & FIXME */
-#endif		    
-		    return -ENXIO; /* No such device or address: missing decompressor */
-		    break;
+		flags = PWCX_FLAG_PLANAR;
+		if (pdev->vsize == PSZ_VGA &&
+		    pdev->vframes == 5 && pdev->vsnapshot) {
+			printk(KERN_ERR 
+			       "pwc: Mode Bayer is not supported for now\n");
+			flags |= PWCX_FLAG_BAYER;
+			/* No such device or address: missing decompressor */
+			return -ENXIO;
+		}
+
+		switch (pdev->type) {
+#if 0
+			case 675:
+			case 680:
+			case 690:
+			case 720:
+			case 730:
+			case 740:
+			case 750:
+				pwc_dec23_decompress(&pdev->image, &pdev->view,
+						&pdev->offset, yuv, image,
+						flags, pdev->decompress_data,
+						pdev->vbandlength);
+				break;
+			case 645:
+			case 646:
+			/* TODO & FIXME */
+#endif
+			/* No such device or address: missing decompressor */
+				return -ENXIO;
+				break;
 		 }
 	}
 	return 0;
 }
-
-





             reply	other threads:[~2005-06-20 21:14 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-06-20 21:11 Jesper Juhl [this message]
2005-06-21  7:29 ` Jörn Engel

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Pine.LNX.4.62.0506202303050.2369@dragon.hyggekrogen.localhost \
    --to=juhl-lkml@dif.dk \
    --cc=jesper.juhl@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=luc@saillard.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®