<?xml version="1.0" encoding="utf-8" standalone="no"?>
<!DOCTYPE document PUBLIC "-//CNX//DTD CNXML 0.5 plus MathML//EN" "http://cnx.rice.edu/cnxml/0.5/DTD/cnxml_mathml.dtd">
<document xmlns="http://cnx.rice.edu/cnxml" xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/" id="m11095">
  
  <name xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/">Quantisation of DCT Coefficients</name>
  
  <metadata xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/">
  <md:version xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/">2.3</md:version>
  <md:created xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/">2003/03/26</md:created>
  <md:revised xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/">2003/05/02</md:revised>
  <md:authorlist xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/">
      <md:author xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/" id="ngk">
      <md:firstname xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/">Nick</md:firstname>
      
      <md:surname xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/">Kingsbury</md:surname>
      <md:email xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/">ngk10@cam.ac.uk</md:email>
    </md:author>
  </md:authorlist>

  <md:maintainerlist xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/">
    <md:maintainer xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/" id="liqun">
      <md:firstname xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/">Liqun</md:firstname>
      
      <md:surname xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/">Wang</md:surname>
      <md:email xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/">liqun@rice.edu</md:email>
    </md:maintainer>
    <md:maintainer xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/" id="ngk">
      <md:firstname xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/">Nick</md:firstname>
      
      <md:surname xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/">Kingsbury</md:surname>
      <md:email xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/">ngk10@cam.ac.uk</md:email>
    </md:maintainer>
  </md:maintainerlist>
  
  <md:keywordlist xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/">
    <md:keyword xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/">DCT</md:keyword>
    <md:keyword xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/">DCT coefficients</md:keyword>
    <md:keyword xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/">Quantisation</md:keyword>
  </md:keywordlist>

  <md:abstract xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/">This module introduces Quantisation of DCT Coefficients.
</md:abstract>
</metadata>

  <content xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/">
    <para xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/" id="para1">
      For our discussion of the <cnxn xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/" document="m11094" strength="7">2-D DCT</cnxn> we assumed a
      quantiser step size of 15 to allow direct comparison of
      entropies with the Haar transform. But what step size do we
      really need?
    </para>

    <para xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/" id="para2">
      <cnxn xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/" target="figure9" strength="7"/>(a) and (b) show images
      reconstructed from the 
      <m:math>
	<m:apply>
	  <m:times/>
	  <m:cn>8</m:cn>
	  <m:cn>8</m:cn>
	</m:apply>
      </m:math> DCT of Lenna (see <cnxn xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/" document="m11094" target="figure2" strength="7">subfigure (c)</cnxn>), when all the
      DCT coefficients are quantised with step sizes of 15 and 30
      respectively. It is difficult to see quantising artefacts in
      <cnxn xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/" target="figure9" strength="7"/>(a) ( 
      <m:math>
	<m:apply>
	  <m:eq/>
	  <m:ci>
	    <m:msub><m:mi>Q</m:mi><m:mi>step</m:mi></m:msub>
	  </m:ci>
	  <m:cn>15</m:cn>
	</m:apply>
      </m:math>) but they are quite noticeable in <cnxn xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/" target="figure9" strength="7"/>(b) (
      <m:math>
	<m:apply>
	  <m:eq/>
	  <m:ci>
	    <m:msub><m:mi>Q</m:mi><m:mi>step</m:mi></m:msub>
	  </m:ci>
	  <m:cn>30</m:cn>
	</m:apply>
      </m:math>).
    </para>

    <para xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/" id="para3">
      The visibility of the 
      <m:math>
	<m:apply>
	  <m:times/>
	  <m:cn>8</m:cn>
	  <m:cn>8</m:cn>
	</m:apply>
      </m:math> DCT basis functions of <cnxn xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/" document="m11094" target="figure2" strength="7">subfigure (a)</cnxn> in our discussion of the 2-D DCT has been
      measured (for a 
      <m:math>
	<m:apply>
	  <m:times/>
	  <m:cn>720</m:cn>
	  <m:cn>576</m:cn>
	</m:apply>
      </m:math> image viewed from 6 times the image width) and the
      minimum quantiser steps have been determined which will give
      artefacts just at the threshold of visibility. The matrices
      (JPEG Book, p37) for the luminance and chrominance threshold
      step sizes are:

      <equation xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/" id="eq7">
	<m:math>
	  <m:apply>
	    <m:eq/>
	    <m:ci>
	      <m:msub><m:mi>Q</m:mi><m:mi>lum</m:mi></m:msub>
	    </m:ci>
	    <m:matrix>
	      <m:matrixrow>
		<m:cn>16</m:cn>
		<m:cn>11</m:cn>
		<m:cn>10</m:cn>
		<m:cn>16</m:cn>
		<m:cn>24</m:cn>
		<m:cn>40</m:cn>
		<m:cn>51</m:cn>
		<m:cn>61</m:cn>
	      </m:matrixrow>
	      <m:matrixrow>
		<m:cn>12</m:cn>
		<m:cn>12</m:cn>
		<m:cn>14</m:cn>
		<m:cn>19</m:cn>
		<m:cn>26</m:cn>
		<m:cn>58</m:cn>
		<m:cn>60</m:cn>
		<m:cn>55</m:cn>
	      </m:matrixrow>
	      <m:matrixrow>
		<m:cn>14</m:cn>
		<m:cn>13</m:cn>
		<m:cn>16</m:cn>
		<m:cn>24</m:cn>
		<m:cn>40</m:cn>
		<m:cn>57</m:cn>
		<m:cn>69</m:cn>
		<m:cn>56</m:cn>
	      </m:matrixrow>
	      <m:matrixrow>
		<m:cn>14</m:cn>
		<m:cn>17</m:cn>
		<m:cn>22</m:cn>
		<m:cn>29</m:cn>
		<m:cn>51</m:cn>
		<m:cn>87</m:cn>
		<m:cn>80</m:cn>
		<m:cn>62</m:cn>
	      </m:matrixrow>
	      <m:matrixrow>
		<m:cn>18</m:cn>
		<m:cn>22</m:cn>
		<m:cn>37</m:cn>
		<m:cn>56</m:cn>
		<m:cn>68</m:cn>
		<m:cn>109</m:cn>
		<m:cn>103</m:cn>
		<m:cn>77</m:cn>
	      </m:matrixrow>
	      <m:matrixrow>
		<m:cn>24</m:cn>
		<m:cn>35</m:cn>
		<m:cn>55</m:cn>
		<m:cn>64</m:cn>
		<m:cn>81</m:cn>
		<m:cn>104</m:cn>
		<m:cn>113</m:cn>
		<m:cn>92</m:cn>
	      </m:matrixrow>
	      <m:matrixrow>
		<m:cn>49</m:cn>
		<m:cn>64</m:cn>
		<m:cn>78</m:cn>
		<m:cn>87</m:cn>
		<m:cn>103</m:cn>
		<m:cn>121</m:cn>
		<m:cn>120</m:cn>
		<m:cn>101</m:cn>
	      </m:matrixrow>
	      <m:matrixrow>
		<m:cn>72</m:cn>
		<m:cn>92</m:cn>
		<m:cn>95</m:cn>
		<m:cn>98</m:cn>
		<m:cn>112</m:cn>
		<m:cn>100</m:cn>
		<m:cn>103</m:cn>
		<m:cn>99</m:cn>
	      </m:matrixrow>
	    </m:matrix>
	  </m:apply>
	</m:math>
      </equation>

      <equation xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/" id="eq8">
	<m:math>
	  <m:apply>
	    <m:eq/>
	    <m:ci>
	      <m:msub><m:mi>Q</m:mi><m:mi>chr</m:mi></m:msub>
	    </m:ci>
	    <m:matrix>
	      <m:matrixrow>
		<m:cn>17</m:cn>
		<m:cn>18</m:cn>
		<m:cn>24</m:cn>
		<m:cn>47</m:cn>
		<m:cn>99</m:cn>
		<m:cn>99</m:cn>
		<m:cn>99</m:cn>
		<m:cn>99</m:cn>
	      </m:matrixrow>
	       <m:matrixrow>
		<m:cn>18</m:cn>
		<m:cn>21</m:cn>
		<m:cn>26</m:cn>
		<m:cn>66</m:cn>
		<m:cn>99</m:cn>
		<m:cn>99</m:cn>
		<m:cn>99</m:cn>
		<m:cn>99</m:cn>
	      </m:matrixrow>
	      <m:matrixrow>
		<m:cn>24</m:cn>
		<m:cn>26</m:cn>
		<m:cn>56</m:cn>
		<m:cn>99</m:cn>
		<m:cn>99</m:cn>
		<m:cn>99</m:cn>
		<m:cn>99</m:cn>
		<m:cn>99</m:cn>
	      </m:matrixrow>
	      <m:matrixrow>
		<m:cn>47</m:cn>
		<m:cn>66</m:cn>
		<m:cn>99</m:cn>
		<m:cn>99</m:cn>
		<m:cn>99</m:cn>
		<m:cn>99</m:cn>
		<m:cn>99</m:cn>
		<m:cn>99</m:cn>
	      </m:matrixrow>
	      <m:matrixrow>
		<m:cn>99</m:cn>
		<m:cn>99</m:cn>
		<m:cn>99</m:cn>
		<m:cn>99</m:cn>
		<m:cn>99</m:cn>
		<m:cn>99</m:cn>
		<m:cn>99</m:cn>
		<m:cn>99</m:cn>
	      </m:matrixrow>
	      <m:matrixrow>
		<m:cn>99</m:cn>
		<m:cn>99</m:cn>
		<m:cn>99</m:cn>
		<m:cn>99</m:cn>
		<m:cn>99</m:cn>
		<m:cn>99</m:cn>
		<m:cn>99</m:cn>
		<m:cn>99</m:cn>
	      </m:matrixrow>
	      <m:matrixrow>
		<m:cn>99</m:cn>
		<m:cn>99</m:cn>
		<m:cn>99</m:cn>
		<m:cn>99</m:cn>
		<m:cn>99</m:cn>
		<m:cn>99</m:cn>
		<m:cn>99</m:cn>
		<m:cn>99</m:cn>
	      </m:matrixrow>
	      <m:matrixrow>
		<m:cn>99</m:cn>
		<m:cn>99</m:cn>
		<m:cn>99</m:cn>
		<m:cn>99</m:cn>
		<m:cn>99</m:cn>
		<m:cn>99</m:cn>
		<m:cn>99</m:cn>
		<m:cn>99</m:cn>
	      </m:matrixrow>
	    </m:matrix>
	  </m:apply>
	</m:math>
      </equation>

      <cnxn xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/" target="figure9" strength="7"/>(c) shows the
      reconstructed image when each of the <cnxn xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/" document="m11094" target="figure2" strength="7">subimages of (c)</cnxn>  is quantised
      using the corresponding step size from 
      <m:math>
	<m:ci>
	  <m:msub><m:mi>Q</m:mi><m:mi>lum</m:mi></m:msub>
	</m:ci>
      </m:math>. It is certainly difficult to detect any quantising
      artefacts, even though many of the step sizes are greater than 
      <m:math>
	<m:apply>
	  <m:eq/>
	  <m:ci>
	    <m:msub><m:mi>Q</m:mi><m:mi>step</m:mi></m:msub>
	  </m:ci>
	  <m:cn>30</m:cn>
	</m:apply>
      </m:math>, used in <cnxn xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/" target="figure9" strength="7"/>(b). <cnxn xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/" target="figure9" strength="7"/>(d) is
      the reconstructed image using step sizes of 
      <m:math>
	<m:apply>
	  <m:times/>
	  <m:cn>2</m:cn>
	  <m:ci>
	    <m:msub><m:mi>Q</m:mi><m:mi>lum</m:mi></m:msub>
	  </m:ci>
	</m:apply>
      </m:math> and the artefacts are still quite low.
    </para>

    <figure xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/" id="figure9">
      <media xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/" type="image/png" src="figure9.png"/>
      <caption xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/">
	Images reconstructed using the 
	<m:math>
	  <m:apply>
	    <m:times/>
	    <m:cn>8</m:cn>
	    <m:cn>8</m:cn>
	  </m:apply>
	</m:math> DCT with (a) 
	<m:math>
	  <m:apply>
	    <m:eq/>
	    <m:ci>
	      <m:msub><m:mi>Q</m:mi><m:mi>step</m:mi></m:msub>
	    </m:ci>
	    <m:cn>15</m:cn>
	  </m:apply>
	</m:math>, (b) 
	<m:math>
	  <m:apply>
	    <m:eq/>
	    <m:ci>
	      <m:msub><m:mi>Q</m:mi><m:mi>step</m:mi></m:msub>
	    </m:ci>
	    <m:cn>30</m:cn>
	  </m:apply>
	</m:math>, (c) 
	<m:math>
	  <m:apply>
	    <m:eq/>
	    <m:ci>
	      <m:msub><m:mi>Q</m:mi><m:mi>step</m:mi></m:msub>
	    </m:ci>
	    <m:ci>
	      <m:msub><m:mi>Q</m:mi><m:mi>lum</m:mi></m:msub>
	    </m:ci>
	  </m:apply>
	</m:math>, the JPEG luminance matrix, and (d) 
	<m:math>
	  <m:apply>
	    <m:eq/>
	    <m:ci>
	      <m:msub><m:mi>Q</m:mi><m:mi>step</m:mi></m:msub>
	    </m:ci>
	    <m:apply>
	      <m:times/>
	      <m:cn>2</m:cn>
	      <m:ci>
		<m:msub><m:mi>Q</m:mi><m:mi>lum</m:mi></m:msub>
	      </m:ci>
	    </m:apply>
	  </m:apply>
	</m:math>.
      </caption>
    </figure>

    <figure xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/" id="figure10">
      <media xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/" type="image/png" src="figure10.png"/>
      <caption xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/">
	Plots of the entropies of the 
	<m:math>
	  <m:apply>
	    <m:times/>
	    <m:cn>8</m:cn>
	    <m:cn>8</m:cn>
	  </m:apply>
	</m:math> DCT quantised subimages for the four reconstructed
	images of <cnxn xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/" target="figure9" strength="7"/>.
      </caption>
    </figure>

    <para xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/" id="para4">
      <cnxn xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/" target="figure10" strength="7"/> shows the entropies of
      the 64 quantised subimages used to reconstruct each of the four
      images in <cnxn xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/" target="figure9" strength="7"/>. Also given on
      each plot is the mean entropy (giving the bits/pel for the
      image) and the rms quantising error between the quantised image
      and the original.
    </para>
    
    <para xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/" id="para5">
      We see that <cnxn xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/" target="figure9" strength="7"/>(c) has about
      the same mean entropy and rms error as <cnxn xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/" target="figure9" strength="7"/>(b), but that its quantising artefacts are much
      less visible. <cnxn xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/" target="figure9" strength="7"/>(d) has
      similar visibility of artefacts to <cnxn xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/" target="figure9" strength="7"/>(b), but has significantly lower entropy and
      hence <emphasis xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/">greater compression</emphasis> (similarly for
      <cnxn xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/" target="figure9" strength="7"/>(c) versus <cnxn xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/" target="figure9" strength="7"/>(a)).
    </para>

    <para xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/" id="para6">
      This shows the distinct advantages of <emphasis xmlns:md="http://cnx.rice.edu/mdml/0.4" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:bib="http://bibtexml.sf.net/">subjectively
      weighted quantisation</emphasis>, and also that it is unwise to
      rely too much on the rms error as a measure of image quality.
    </para>

  </content>
  
</document>
