<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>atppp&#039;s Blog &#187; lang:en</title>
	<atom:link href="http://blog.wuxinan.net/archives/tag/langen/feed" rel="self" type="application/rss+xml" />
	<link>http://blog.wuxinan.net</link>
	<description></description>
	<lastBuildDate>Tue, 08 Dec 2009 08:20:42 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.1</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>mysql/5.0.45 &#8230;</title>
		<link>http://blog.wuxinan.net/archives/537</link>
		<comments>http://blog.wuxinan.net/archives/537#comments</comments>
		<pubDate>Wed, 12 Aug 2009 21:09:04 +0000</pubDate>
		<dc:creator>atppp</dc:creator>
				<category><![CDATA[Tech]]></category>
		<category><![CDATA[lang:en]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[server]]></category>

		<guid isPermaLink="false">http://blog.wuxinan.net/?p=537</guid>
		<description><![CDATA[I recently did some performance testing with a few big tables on mysql/5.0.45 under CentOS and noticed a sharp drop in query speed a few minutes after restarting mysql. More tests showed mysql/5.0.51a or newer don&#8217;t have this problem. OK, I guess a picture is worth a thousand words&#8230; (SELECT queries only, and also mysql [...]]]></description>
			<content:encoded><![CDATA[<p>I recently did some performance testing with a few big tables on mysql/5.0.45 under CentOS and noticed a sharp drop in query speed a few minutes after restarting mysql. More tests showed mysql/5.0.51a or newer don&#8217;t have this problem. OK, I guess a picture is worth a thousand words&#8230; (SELECT queries only, and also mysql buffer size is huge, so disk I/O is minimal during test.)<br />
<a href="http://blog.wuxinan.net/wp-content/uploads/2009/08/mysql_performance.png"><img title="mysql_performance" src="http://blog.wuxinan.net/wp-content/uploads/2009/08/mysql_performance.png" alt="mysql_performance" width="600" height="452" /></a><br />
It&#8217;s most likely due to <a href="http://bugs.mysql.com/bug.php?id=21074">mysql bug 21075</a> (fixed in mysql/5.0.50). Unfortunately mysql/5.0.45 is the version that ships with CentOS 5.3 and some other Redhat-derived Linux distro. Consider upgrading if you are using mysql/5.0.45 and your mysql server appears to be heavily CPU-bound.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.wuxinan.net/archives/537/feed</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>sort&#8230;</title>
		<link>http://blog.wuxinan.net/archives/532</link>
		<comments>http://blog.wuxinan.net/archives/532#comments</comments>
		<pubDate>Mon, 10 Aug 2009 04:35:48 +0000</pubDate>
		<dc:creator>atppp</dc:creator>
				<category><![CDATA[Tech]]></category>
		<category><![CDATA[centos]]></category>
		<category><![CDATA[lang:en]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[sort]]></category>

		<guid isPermaLink="false">http://blog.wuxinan.net/?p=532</guid>
		<description><![CDATA[I recently noticed CentOS 5.3&#8217;s sort is way slower than Ubuntu 9.04&#8217;s. Apparently the i18n patch used in coreutils-5.97 CentOS rpm is a performance killer:
$ LANG=C time -p sort --buffer-size=128M -n -k1 -k2 test.info &#62; /dev/null
real 92.58
user 86.04
sys 6.52
$ time -p sort --buffer-size=128M -n -k1 -k2 test.info &#62; /dev/null
real 463.04
user 456.01
sys 6.64
P.S. grep and other [...]]]></description>
			<content:encoded><![CDATA[<p>I recently noticed CentOS 5.3&#8217;s <code>sort</code> is way slower than Ubuntu 9.04&#8217;s. Apparently the i18n patch used in coreutils-5.97 CentOS rpm is a performance killer:</p>
<pre>$ LANG=C time -p sort --buffer-size=128M -n -k1 -k2 test.info &gt; /dev/null
real 92.58
user 86.04
sys 6.52
$ time -p sort --buffer-size=128M -n -k1 -k2 test.info &gt; /dev/null
real 463.04
user 456.01
sys 6.64</pre>
<p>P.S. <code>grep</code> and other locale sensitive utilities have similar issue.</p>
<p>BTW, if your disk is slow, <code>--buffer-size</code> is a parameter you might want to play with to optimize performance. By default <code>sort</code> uses very conservative buffer size while your seemingly used memory is actually just used for cache. [<a href="http://www.mail-archive.com/bug-coreutils@gnu.org/msg16953.html">ref</a>]</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.wuxinan.net/archives/532/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Oral Tradition</title>
		<link>http://blog.wuxinan.net/archives/451</link>
		<comments>http://blog.wuxinan.net/archives/451#comments</comments>
		<pubDate>Thu, 16 Oct 2008 19:34:49 +0000</pubDate>
		<dc:creator>atppp</dc:creator>
				<category><![CDATA[Study]]></category>
		<category><![CDATA[lang:en]]></category>
		<category><![CDATA[physics]]></category>

		<guid isPermaLink="false">http://blog.wuxinan.net/?p=451</guid>
		<description><![CDATA[Mark A. Kasevich et al., rf Spectroscopy in an Atomic Fountain:
In the early 1950&#8217;s, Zacharias attempted to make a fountain of atoms by directing a thermal atomic beam upwards. [2]
[2] Knowledge of J. R. Zacharias&#8217;s work has been passed down in the oral tradition. &#8230;
]]></description>
			<content:encoded><![CDATA[<p>Mark A. Kasevich et al., <a href="http://dx.doi.org/10.1103/PhysRevLett.63.612"><em>rf Spectroscopy in an Atomic Fountain</em></a>:</p>
<blockquote><p>In the early 1950&#8217;s, Zacharias attempted to make a fountain of atoms by directing a thermal atomic beam upwards. [2]</p>
<p>[2] Knowledge of J. R. Zacharias&#8217;s work has been passed down in the oral tradition. &#8230;</p></blockquote>
]]></content:encoded>
			<wfw:commentRss>http://blog.wuxinan.net/archives/451/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Convert video to iPod format</title>
		<link>http://blog.wuxinan.net/archives/422</link>
		<comments>http://blog.wuxinan.net/archives/422#comments</comments>
		<pubDate>Fri, 08 Aug 2008 03:21:11 +0000</pubDate>
		<dc:creator>atppp</dc:creator>
				<category><![CDATA[Tech]]></category>
		<category><![CDATA[aac]]></category>
		<category><![CDATA[apple]]></category>
		<category><![CDATA[conversion]]></category>
		<category><![CDATA[iphone]]></category>
		<category><![CDATA[ipod]]></category>
		<category><![CDATA[lang:en]]></category>
		<category><![CDATA[video]]></category>

		<guid isPermaLink="false">http://blog.wuxinan.net/?p=422</guid>
		<description><![CDATA[Basic command:
ffmpeg -i input.avi -f mp4 -vcodec mpeg4 -b 1000kb \
-acodec aac -ab 192kb [-ac 2] output.mp4
&#8220;-ac 2&#8221; may not work if the input file is in mkv format with 5.1 aac audio (if you don&#8217;t convert 5.1 to 2.0, playing the file crashes your iPod/iPhone). Here&#8217;s a possible way to convert:

Extract aac audio from [...]]]></description>
			<content:encoded><![CDATA[<p>Basic command:</p>
<pre>ffmpeg -i input.avi -f mp4 -vcodec mpeg4 -b 1000kb \
-acodec aac -ab 192kb [-ac 2] output.mp4</pre>
<p>&#8220;<code>-ac 2</code>&#8221; may not work if the input file is in mkv format with 5.1 aac audio (if you don&#8217;t convert 5.1 to 2.0, playing the file crashes your iPod/iPhone). Here&#8217;s a possible way to convert:</p>
<ul>
<li>Extract aac audio from the mkv file:
<pre>ffmpeg -i input.mkv -vn -acodec copy audio.aac</pre>
</li>
<li>Downmix 5.1 to 2.0:
<pre>faad -d audio.aac -o audio-2ch.wav</pre>
</li>
<li>Merge and convert to iPod format:
<pre>ffmpeg -i input.mkv -i audio-2ch.wav -map 0.0:0 -map 1.0:1 -f mp4 \
-vcodec mpeg4 -s 470x320 -b 1000kb -acodec aac -ab 192kb output.mp4</pre>
</li>
<li>The output of the last command gives a little more info of what I am doing here:
<pre>Input #0, matroska, from 'input.mkv':
Duration: 01:24:42.5, start: 0.000000, bitrate: N/A
Stream #0.0: Video: h264, yuv420p, 704x480, 24.39 fps(r)
Stream #0.1: Audio: aac, 48000 Hz, 5:1
Input #1, wav, from 'audio-2ch.wav':
Duration: 01:24:42.5, start: 0.000000, bitrate: 1536 kb/s
Stream #1.0: Audio: pcm_s16le, 48000 Hz, stereo, 1536 kb/s
Output #0, mp4, to 'output.mp4':
Stream #0.0: Video: mpeg4, yuv420p, 470x320, q=2-31, 1000 kb/s, 24.39 fps(c)
Stream #0.1: Audio: aac, 48000 Hz, stereo, 192 kb/s
Stream mapping:
Stream #0.0 -&gt; #0.0
Stream #1.0 -&gt; #0.1</pre>
</li>
</ul>
<p>Video conversion can certainly be way fancier than what I am doing here, and <code>faad</code> is obviously not the best way to downmix audio from 5.1 to 2.0. You can also find quite a few iPod converters but personally I like command line. Anyway, happy converting! (ffmpeg <a href="http://ffmpeg.mplayerhq.hu/faq.html#SEC25">ref</a>)</p>
<p>[Also note that on MacOS, you may have to change "<code>-acodec aac</code>" to "<code>-acodec libfaac</code>".]</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.wuxinan.net/archives/422/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Google ads in Gmail</title>
		<link>http://blog.wuxinan.net/archives/410</link>
		<comments>http://blog.wuxinan.net/archives/410#comments</comments>
		<pubDate>Sun, 03 Aug 2008 16:54:17 +0000</pubDate>
		<dc:creator>atppp</dc:creator>
				<category><![CDATA[Misc]]></category>
		<category><![CDATA[google]]></category>
		<category><![CDATA[lang:en]]></category>

		<guid isPermaLink="false">http://blog.wuxinan.net/?p=410</guid>
		<description><![CDATA[Google ads are &#8220;content-sensitive&#8221;. What does that mean?

Case 1: My colleague worked overnight, so I sent an email to him in the morning: &#8220;Great work, have some good sleep then.&#8221;. Gmail popped up a sponsored link: &#8220;Sleep Apnea Cure&#8221;. Oh come on, my colleague sleeps very well&#8230;
Case 2: My friend did not show up in [...]]]></description>
			<content:encoded><![CDATA[<p>Google ads are &#8220;content-sensitive&#8221;. What does that mean?</p>
<ul>
<li>Case 1: My colleague worked overnight, so I sent an email to him in the morning: &#8220;Great work, have some good sleep then.&#8221;. Gmail popped up a sponsored link: &#8220;Sleep Apnea Cure&#8221;. Oh come on, my colleague sleeps very well&#8230;</li>
<li>Case 2: My friend did not show up in a scheduled meeting, and he emailed me: &#8220;Sorry I screwed up today&#8230;.  Could we meet late afternoon tomorrow&#8221;. The Google ads beside this email was &#8220;Date Hot Stanford Girls!&#8221;. ok, ok, I guess Google knows my geolocation, and &#8220;screw up&#8221; does have another meaning&#8230;</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://blog.wuxinan.net/archives/410/feed</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Matlab under Ubuntu</title>
		<link>http://blog.wuxinan.net/archives/376</link>
		<comments>http://blog.wuxinan.net/archives/376#comments</comments>
		<pubDate>Sat, 28 Jun 2008 05:17:27 +0000</pubDate>
		<dc:creator>atppp</dc:creator>
				<category><![CDATA[Tech]]></category>
		<category><![CDATA[lang:en]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[matlab]]></category>

		<guid isPermaLink="false">http://blog.wuxinan.net/?p=376</guid>
		<description><![CDATA[Some tips:

Q: Matlab desktop does not show up correctly.
A: export MATLAB_JAVA=/usr/lib/jvm/java-6-sun/jre/ (requires Sun Java 6 Runtime)
Q: Matlab windows disappear in taskbar (Window List applet).
A: minimizing all windows (show desktop button) seems to bring all windows back into taskbar. Or you can try to export AWT_TOOLKIT=MToolkit
Q: Printing in Matlab throws java exception.
A: Go set all printers [...]]]></description>
			<content:encoded><![CDATA[<p>Some tips:</p>
<ul>
<li>Q: Matlab desktop does not show up correctly.<br />
A: export MATLAB_JAVA=/usr/lib/jvm/java-6-sun/jre/ (requires Sun Java 6 Runtime)</li>
<li>Q: Matlab windows disappear in taskbar (Window List applet).<br />
A: minimizing all windows (show desktop button) seems to bring all windows back into taskbar. Or you can try to export AWT_TOOLKIT=MToolkit</li>
<li>Q: Printing in Matlab throws java exception.<br />
A: Go set all printers &gt; Job Options &gt; Orientation to something other than &#8220;Automatic Rotation&#8221;.</li>
</ul>
<p>Links: <a href="http://ubuntuforums.org/showthread.php?t=635142">1</a>, <a href="http://ubuntuforums.org/showthread.php?t=672625&amp;highlight=kbless7&amp;page=3">2</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.wuxinan.net/archives/376/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Microsoft Visio save as EPS</title>
		<link>http://blog.wuxinan.net/archives/282</link>
		<comments>http://blog.wuxinan.net/archives/282#comments</comments>
		<pubDate>Fri, 08 Feb 2008 22:04:29 +0000</pubDate>
		<dc:creator>atppp</dc:creator>
				<category><![CDATA[Tech]]></category>
		<category><![CDATA[eps]]></category>
		<category><![CDATA[howto]]></category>
		<category><![CDATA[lang:en]]></category>
		<category><![CDATA[latex]]></category>
		<category><![CDATA[visio]]></category>

		<guid isPermaLink="false">http://blog.wuxinan.net/archives/282</guid>
		<description><![CDATA[I wrote the following procedure on 2008.02.08:
To convert a Microsoft Visio document to EPS without losing scalable vector format (and without installing 3rd-party software&#8230;):

Install Microsoft Save as PDF or XPS Add-in for 2007 Microsoft Office programs (only available for Office 2007?).
Save Visio document as PDF in Visio 2007.
Convert PDF to Postscript (.ps) with pdf2ps utility.
Open [...]]]></description>
			<content:encoded><![CDATA[<p>I wrote the following procedure on 2008.02.08:</p>
<blockquote><p>To convert a Microsoft Visio document to EPS without losing scalable vector format (and without installing 3rd-party software&#8230;):</p>
<ol>
<li>Install <a href="http://r.office.microsoft.com/r/rlidMSAddinPDFXPS">Microsoft Save as PDF or XPS Add-in for 2007 Microsoft Office programs</a> (only available for Office 2007?).</li>
<li>Save Visio document as PDF in Visio 2007.</li>
<li>Convert PDF to Postscript (.ps) with pdf2ps utility.</li>
<li>Open .ps file with gsview, and select File -&gt; PS to EPS, be sure to check &#8220;Automatically calculate Bounding Box&#8221;.</li>
</ol>
<p>Now you have an EPS file to be embedded into your LaTeX document. Many other converting methods exist, see also <a href="http://www.itee.uq.edu.au/~emmerik/visioeps.html">Visio and EPS</a>.</p></blockquote>
<p>Here are some updates (edited on 2009.01.30):</p>
<ol>
<li>In theory, you should be able to open that saved PDF directly in gsview and convert to EPS, but gsview either crashes or refuses to accept the PDF.</li>
<li>In some cases, e.g. when you compile LaTeX directly to PDF using pdflatex, you just need a PDF figure with correct size. In that case, you can set the document size in Visio: File -&gt; Page Setup -&gt; Page Size (tab) -&gt; Size to fit drawing contents, and then save the Visio document to PDF, which will then be in correct size ready to be embedded into LaTeX.</li>
<li>To create a Postscript file, you don&#8217;t necessarily need to save as PDF and convert to .ps using pdf2ps. All you need to do is to use a postscript printer (most modern printers are, including most PDF writers) and print to file. That would create a postscript file which can then be passed to gsview and converted to EPS by adding a bounding box. Note: this is in fact a generic way of converting anything to (vector-format) EPS/PDF with bounding box.</li>
</ol>
]]></content:encoded>
			<wfw:commentRss>http://blog.wuxinan.net/archives/282/feed</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>TeraStation does not auto-mount USB disk</title>
		<link>http://blog.wuxinan.net/archives/275</link>
		<comments>http://blog.wuxinan.net/archives/275#comments</comments>
		<pubDate>Fri, 01 Feb 2008 00:32:02 +0000</pubDate>
		<dc:creator>atppp</dc:creator>
				<category><![CDATA[Tech]]></category>
		<category><![CDATA[lang:en]]></category>
		<category><![CDATA[terastation]]></category>

		<guid isPermaLink="false">http://blog.wuxinan.net/archives/275</guid>
		<description><![CDATA[Don&#8217;t know exactly why TeraStation does not automatically mount my external USB disk, but the fix is to manually fill in the USB disk GUID in /etc/melco/diskinfo. GUID can be obtained from /proc/scsi/usb-storage/*. Related script is possibly /etc/hotplug.d/scsi_device/usb-buffalo.hotplug.
]]></description>
			<content:encoded><![CDATA[<p>Don&#8217;t know exactly why TeraStation does not automatically mount my external USB disk, but the fix is to manually fill in the USB disk GUID in /etc/melco/diskinfo. GUID can be obtained from /proc/scsi/usb-storage/*. Related script is possibly /etc/hotplug.d/scsi_device/usb-buffalo.hotplug.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.wuxinan.net/archives/275/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Convert WordPress database from Latin1 to UTF-8</title>
		<link>http://blog.wuxinan.net/archives/255</link>
		<comments>http://blog.wuxinan.net/archives/255#comments</comments>
		<pubDate>Sun, 13 Jan 2008 01:39:31 +0000</pubDate>
		<dc:creator>atppp</dc:creator>
				<category><![CDATA[Tech]]></category>
		<category><![CDATA[encoding]]></category>
		<category><![CDATA[howto]]></category>
		<category><![CDATA[lang:en]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[wordpress]]></category>

		<guid isPermaLink="false">http://blog.wuxinan.net/archives/255</guid>
		<description><![CDATA[Some early WordPress databases use raw Latin1 encoding to represent UTF-8 characters. The following seems to be an O.K. way to convert those databases to native UTF-8 databases (at least it works for me, Mysql 5.0.45):

Stop/restrict web service.
Dump the database:
$ mysqldump --default-character-set=latin1 --databases wordpress &#62; m.sql

Change encoding settings in m.sql, including table default encoding and [...]]]></description>
			<content:encoded><![CDATA[<p>Some early WordPress databases use raw Latin1 encoding to represent UTF-8 characters. The following seems to be an O.K. way to convert those databases to native UTF-8 databases (at least it works for me, Mysql 5.0.45):</p>
<ol>
<li>Stop/restrict web service.</li>
<li>Dump the database:
<pre>$ mysqldump --default-character-set=latin1 --databases wordpress &gt; m.sql</pre>
</li>
<li>Change encoding settings in m.sql, including table default encoding and client communication encoding:
<pre>$ replace "CHARSET=latin1" "CHARSET=utf8" \
    "SET NAMES latin1" "SET NAMES utf8" &lt; m.sql &gt; m2.sql</pre>
</li>
<li>Import the &#8220;converted&#8221; sql:
<pre>$ mysql &lt; m2.sql</pre>
</li>
<li>Add the following lines to WordPress wp-config.php
<pre>define('DB_CHARSET', 'utf8');
define('DB_COLLATE', '');</pre>
</li>
<li>Reopen web service. That&#8217;s it.</li>
</ol>
<p>Note: For future convenience, you might as well change the database default encoding to utf8.</p>
<p>Ref to WordPress documentation for details: <a href="http://codex.wordpress.org/Editing_wp-config.php#Database_character_set">here</a> and <a href="http://codex.wordpress.org/Converting_Database_Character_Sets">here</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.wuxinan.net/archives/255/feed</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Defective Pixels in Canon A570 IS</title>
		<link>http://blog.wuxinan.net/archives/196</link>
		<comments>http://blog.wuxinan.net/archives/196#comments</comments>
		<pubDate>Mon, 26 Nov 2007 02:12:36 +0000</pubDate>
		<dc:creator>atppp</dc:creator>
				<category><![CDATA[Tech]]></category>
		<category><![CDATA[camera]]></category>
		<category><![CDATA[canon]]></category>
		<category><![CDATA[CCD]]></category>
		<category><![CDATA[chdk]]></category>
		<category><![CDATA[defective]]></category>
		<category><![CDATA[dng]]></category>
		<category><![CDATA[lang:en]]></category>
		<category><![CDATA[pixel]]></category>

		<guid isPermaLink="false">http://blog.wuxinan.net/archives/196</guid>
		<description><![CDATA[We know almost every pixel array (CCD sensor in camera, LCD screen, etc) has defective pixels. For camera CCD sensor, a few defective pixels can ruin good pictures, but we usually don&#8217;t see those pixels in the JPEG picture. Here&#8217;s a short story about those defective pixels.
I installed CHDK on my Canon A570 IS camera [...]]]></description>
			<content:encoded><![CDATA[<p>We know almost every pixel array (CCD sensor in camera, LCD screen, etc) has defective pixels. For camera CCD sensor, a few defective pixels can ruin good pictures, but we usually don&#8217;t see those pixels in the JPEG picture. Here&#8217;s a short story about those defective pixels.</p>
<p>I installed CHDK on my Canon A570 IS camera and shot a few test pictures to find out defective pixels of my camera. To my surprise, this 7.1 mega-pixel CCD sensor has couple thousands defective pixels. The following picture represents the raw output from CCD sensor when I shot a 15 sec picture with ridiculously bright light source: (The green border is just showing image boundary, not from the actual picture.)</p>
<p><a title="0486.png" href="http://blog.wuxinan.net/wp-content/uploads/2007/11/0486.png"><img style="border: 3px solid #00ff00" src="http://blog.wuxinan.net/wp-content/uploads/2007/11/0486_small.png" alt="0486.png" /></a></p>
<p>The raw file is 3152 columns by 2340 rows, 10 bits per pixel, so the file size is 3152 x 2340 x 10 bits = 9219600 bytes. The first few columns and rows are used for background subtraction (masked pixels, their values are usually around 30-40 on this 2<sup>10</sup> = 1024 scale), so the active area is actually 3072 x 2304 pixels. The above picture is RAW CCD output down scaled to 0-255 and converted to 8-bit gray PNG (i.e., before demosaicing/gamma correction/any other process taken place). As you can see, there&#8217;re a lot (9205) of 0-valued defective pixels in the active area. There is no defective pixel in the masked area.</p>
<p>When I shot with faster shutter speed, I have less (2991) defective pixels.  The following was shot with 1/250 sec shutter speed, showing CCD value 0 as black (defective pixels), 1-40 as gray (masked pixels), and 40-267 as white. No pixel has value more than 267.</p>
<p><a title="0488.png" href="http://blog.wuxinan.net/wp-content/uploads/2007/11/0488.png"><img style="border: 3px solid #00ff00" src="http://blog.wuxinan.net/wp-content/uploads/2007/11/0488_small.png" alt="0488.png" /></a></p>
<p>I shot a lot of RAW pictures and found the number of  defective pixels is either 9205 or 2991. Generally speaking, the slower the shutter speed, the more chance I get 9205 defective pixels. But I did have 2991 defective pixels with 1/30 sec picture, and 9205 defective pixels with 1/250 sec picture, with all other settings the same. So I have no idea what determines the defective pixel pattern. Also what&#8217;s interesting is those 2991 defective pixels are subset of the 9205 defective pixels.</p>
<p>If I go ahead and demosaic, combining RGB channels together, This is part of the image I get: (You can see defective pixels in different color channels.)</p>
<p><img style="border: 3px solid #00ff00" src="http://blog.wuxinan.net/wp-content/uploads/2007/11/0405-with-bad-pixel-small.png" alt="0405-with-bad-pixel-small.png" /></p>
<p>Instead, most RAW format processors find those 0-valued (sub)pixels and interpolate over with neighbor pixels. By doing that, here&#8217;s what I get: (white balance etc. was tuned a little bit as well)</p>
<p><img style="border: 3px solid #00ff00" src="http://blog.wuxinan.net/wp-content/uploads/2007/11/0405-without-bad-pixel-small.png" alt="0405-without-bad-pixel-small.png" /></p>
<p>Nicely white, no annoying dots any more, right? This &#8220;cheating&#8221; process is done inside the camera when saving JPEG file, and also done in most RAW format conversion. <a href="http://www.adobe.com/products/dng/">DNG specification</a> states that:</p>
<blockquote><p>Defective pixels should be mapped out (interpolated over) before the raw data is stored as DNG.</p></blockquote>
<p>Enjoy your camera with 0.1% defective pixels!</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.wuxinan.net/archives/196/feed</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
	</channel>
</rss>
