From: Jean-Francois Moine <moinejf@free.fr>
To: Hans de Goede <hdegoede@redhat.com>
Cc: linux-media@vger.kernel.org
Subject: Re: [PATCH v2] tinyjpeg: Dynamic luminance quantization table for Pixart JPEG
Date: Tue, 24 Apr 2012 12:34:12 +0200 [thread overview]
Message-ID: <20120424123412.3b63810d@tele> (raw)
In-Reply-To: <4F95CACD.5010403@redhat.com>
On Mon, 23 Apr 2012 23:34:05 +0200
Hans de Goede <hdegoede@redhat.com> wrote:
> Thanks for your work on this! I've just spend almost 4 days wrestling
> which the Pixart JPEG decompression code to try to better understand
> these cams, and I have learned quite a bit and eventually came up
> with a different approach.
>
> But your effort is appreciated! After spending so much time on this
> myself, I can imagine that it took you quite some time to come up
> with your solution.
>
> Attach is a 4 patch patchset which I plan to push to v4l-utils
> tomorrow (after running some more tests in daylight). I'll also try
> to do some kernel patches tomorrow to match...
Hi Hans,
I tried your patch, but I am not happy with the images I have (pac7302).
You say that the marker cannot be in the range 0..31 (index 0..7), but
I have never seen a value lower than 68 (index 17).
This last marker value (68) is the default when the images have no big
contrasts. With such images / blocks, the standard JPEG quantization
table does not work well. It seems that, for this value, the table
should be full of either 7 or 8 (8 gives a higher contrast).
Here is the sequence which works better (around line 1420 of tinyjpeg.c):
-------------8<--------------
/* And another special Pixart feature, the DC quantization
factor is fixed! */
qt[0] = 7; // 8 gives a higher contrast
// special case for 68
if (marker == 68) {
for (i = 1; i < 64; i++)
qt[i] = 7; // also works with 8
} else {
for (i = 1; i < 64; i++) {
j = (standard_quantization[0][i] * comp + 50) / 100;
qt[i] = (j < 255) ? j : 255;
}
}
build_quantization_table(priv->Q_tables[0], qt);
-------------8<--------------
About the other marker values, it seems also that the quantization
tables are not optimal: some blocks are either too much (small
contrasted lines) or not enough (big pixels) decompressed. As you know,
a finer adjustment would ask for a long test time, so, I think we can
live with your code.
Best regards.
--
Ken ar c'hentañ | ** Breizh ha Linux atav! **
Jef | http://moinejf.free.fr/
next prev parent reply other threads:[~2012-04-24 10:33 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-04-12 10:20 [PATCH v2] tinyjpeg: Dynamic luminance quantization table for Pixart JPEG Jean-Francois Moine
2012-04-23 21:34 ` Hans de Goede
2012-04-24 10:34 ` Jean-Francois Moine [this message]
2012-04-25 14:19 ` Hans de Goede
2012-04-25 16:09 ` Jean-Francois Moine
2012-04-27 13:08 ` Hans de Goede
2012-04-28 13:50 ` Hans de Goede
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=20120424123412.3b63810d@tele \
--to=moinejf@free.fr \
--cc=hdegoede@redhat.com \
--cc=linux-media@vger.kernel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.