Message ID | 4B6751F3.3040407@freemail.hu (mailing list archive) |
---|---|
State | Superseded, archived |
Headers |
Return-path: <linux-media-owner@vger.kernel.org> Envelope-to: mchehab@infradead.org Delivery-date: Mon, 01 Feb 2010 22:13:31 +0000 Received: from bombadil.infradead.org [18.85.46.34] by pedra with IMAP (fetchmail-6.3.6) for <mchehab@localhost> (single-drop); Mon, 01 Feb 2010 20:14:55 -0200 (BRST) Received: from vger.kernel.org ([209.132.180.67]) by bombadil.infradead.org with esmtp (Exim 4.69 #1 (Red Hat Linux)) id 1Nc4WR-0002O6-20; Mon, 01 Feb 2010 22:13:31 +0000 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754881Ab0BAWNO (ORCPT <rfc822; kmpark@infradead.org> + 1 other); Mon, 1 Feb 2010 17:13:14 -0500 Received: from mail02a.mail.t-online.hu ([84.2.40.7]:52323 "EHLO mail02a.mail.t-online.hu" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754823Ab0BAWNN (ORCPT <rfc822; linux-media@vger.kernel.org>); Mon, 1 Feb 2010 17:13:13 -0500 Received: from [192.168.1.67] (dsl5402C4B8.pool.t-online.hu [84.2.196.184]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail02a.mail.t-online.hu (Postfix) with ESMTPSA id 0D33225BFC0; Mon, 1 Feb 2010 23:13:09 +0100 (CET) Message-ID: <4B6751F3.3040407@freemail.hu> Date: Mon, 01 Feb 2010 23:13:07 +0100 From: =?UTF-8?B?TsOpbWV0aCBNw6FydG9u?= <nm127@freemail.hu> User-Agent: Mozilla/5.0 (X11; U; Linux i686; hu-HU; rv:1.8.1.21) Gecko/20090402 SeaMonkey/1.1.16 MIME-Version: 1.0 To: Hans de Goede <hdegoede@redhat.com>, Luc Saillard <luc@saillard.org> CC: V4L Mailing List <linux-media@vger.kernel.org> Subject: [PATCH ] libv4l: skip false Pixart markers References: <4B67466F.1030301@freemail.hu> In-Reply-To: <4B67466F.1030301@freemail.hu> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-DCC-mail.t-online.hu-Metrics: mail02a.mail.t-online.hu 32711; Body=3 Fuz1=3 Fuz2=3 Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: <linux-media.vger.kernel.org> X-Mailing-List: linux-media@vger.kernel.org |
Commit Message
Németh Márton
Feb. 1, 2010, 10:13 p.m. UTC
From: Márton Németh <nm127@freemail.hu> The byte sequence 0xff, 0xff, 0xff 0xff is not a real marker to skip, instead it is one byte from the image and the following three 0xff bytes might belong to a real marker. Modify pixart_fill_nbits() macro to pass the first 0xff byte as an image data. Signed-off-by: Márton Németh <nm127@freemail.hu> --- -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Comments
Hi, On 02/01/2010 11:13 PM, Németh Márton wrote: > From: Márton Németh<nm127@freemail.hu> > > The byte sequence 0xff, 0xff, 0xff 0xff is not a real marker to skip, instead > it is one byte from the image and the following three 0xff bytes might belong > to a real marker. Modify pixart_fill_nbits() macro to pass the first 0xff byte > as an image data. > Oh, good catch. I'm still seeing the occasional bad frame though :( While on the subject of the pac7302. I've been playing around a bit, and I have the feeling that if we were to go for a lower auto gain target (set autogain off and lower exposure, you can do this ie with v4l2ucp), combined with a gamma correction of 1500 (again use ie v4l2ucp), the images is much better (less over exposed, more contrast). Do you agree ? Regards, Hans > Signed-off-by: Márton Németh<nm127@freemail.hu> > --- > diff -r f23c5a878fb1 v4l2-apps/libv4l/libv4lconvert/tinyjpeg.c > --- a/v4l2-apps/libv4l/libv4lconvert/tinyjpeg.c Mon Feb 01 13:32:46 2010 +0100 > +++ b/v4l2-apps/libv4l/libv4lconvert/tinyjpeg.c Mon Feb 01 23:05:39 2010 +0100 > @@ -339,10 +339,15 @@ > } \ > break; \ > case 0xff: \ > - if (stream[1] == 0xff&& (stream[2]< 7 || stream[2] == 0xff)) { \ > - stream += 3; \ > - c = *stream++; \ > - break; \ > + if (stream[1] == 0xff) { \ > + if (stream[2]< 7) { \ > + stream += 3; \ > + c = *stream++; \ > + break; \ > + } else if (stream[2] == 0xff) { \ > + /* four 0xff in a row: the first belongs to the image data */ \ > + break; \ > + }\ > } \ > /* Error fall through */ \ > default: \ -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Hans de Goede wrote: > Hi, > > On 02/01/2010 11:13 PM, Németh Márton wrote: >> From: Márton Németh<nm127@freemail.hu> >> >> The byte sequence 0xff, 0xff, 0xff 0xff is not a real marker to skip, instead >> it is one byte from the image and the following three 0xff bytes might belong >> to a real marker. Modify pixart_fill_nbits() macro to pass the first 0xff byte >> as an image data. >> > > Oh, good catch. I'm still seeing the occasional bad frame though :( The same at my side, this patch alone does not solve the whole problem complete. I have the feeling that at least same of the corrupted frames will not come with this patch, through I haven't verified this with measurement. On the other hand, in my previous email used a little bit different code: I jumped over the 1024 and 512 bytes without parsing it. That would be maybe necessary to add. By the way, is there any reason why pixart_fill_nbits() is a macro? > While on the subject of the pac7302. I've been playing around a bit, and I have the > feeling that if we were to go for a lower auto gain target (set autogain off and > lower exposure, you can do this ie with v4l2ucp), combined with a gamma correction of > 1500 (again use ie v4l2ucp), the images is much better (less over exposed, more > contrast). > > Do you agree ? Well, my Labtec Webcam 2200 works only with acceptable indoors, when I try to capture something outdoors under direct sunshine conditions I get overexposed frames. I found, however, an interesting pointer in two cameras' user's manual, see the Note column: http://linuxtv.org/wiki/index.php/PixArt_PAC7301/PAC7302#Identification There is a setting indoor/outdoor which is currently not available in gspca_pac7302 driver. Maybe this would be an interesting point to figure out which register is related to this setting. Regards, Márton Németh >> Signed-off-by: Márton Németh<nm127@freemail.hu> >> --- >> diff -r f23c5a878fb1 v4l2-apps/libv4l/libv4lconvert/tinyjpeg.c >> --- a/v4l2-apps/libv4l/libv4lconvert/tinyjpeg.c Mon Feb 01 13:32:46 2010 +0100 >> +++ b/v4l2-apps/libv4l/libv4lconvert/tinyjpeg.c Mon Feb 01 23:05:39 2010 +0100 >> @@ -339,10 +339,15 @@ >> } \ >> break; \ >> case 0xff: \ >> - if (stream[1] == 0xff&& (stream[2]< 7 || stream[2] == 0xff)) { \ >> - stream += 3; \ >> - c = *stream++; \ >> - break; \ >> + if (stream[1] == 0xff) { \ >> + if (stream[2]< 7) { \ >> + stream += 3; \ >> + c = *stream++; \ >> + break; \ >> + } else if (stream[2] == 0xff) { \ >> + /* four 0xff in a row: the first belongs to the image data */ \ >> + break; \ >> + }\ >> } \ >> /* Error fall through */ \ >> default: \ > > -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
diff -r f23c5a878fb1 v4l2-apps/libv4l/libv4lconvert/tinyjpeg.c --- a/v4l2-apps/libv4l/libv4lconvert/tinyjpeg.c Mon Feb 01 13:32:46 2010 +0100 +++ b/v4l2-apps/libv4l/libv4lconvert/tinyjpeg.c Mon Feb 01 23:05:39 2010 +0100 @@ -339,10 +339,15 @@ } \ break; \ case 0xff: \ - if (stream[1] == 0xff && (stream[2] < 7 || stream[2] == 0xff)) { \ - stream += 3; \ - c = *stream++; \ - break; \ + if (stream[1] == 0xff) { \ + if (stream[2] < 7) { \ + stream += 3; \ + c = *stream++; \ + break; \ + } else if (stream[2] == 0xff) { \ + /* four 0xff in a row: the first belongs to the image data */ \ + break; \ + }\ } \ /* Error fall through */ \ default: \