Skip to content

Commit

Permalink
.
Browse files Browse the repository at this point in the history
  • Loading branch information
Vicente González committed Dec 5, 2024
1 parent e94b245 commit eba9148
Show file tree
Hide file tree
Showing 5 changed files with 67 additions and 38 deletions.
22 changes: 20 additions & 2 deletions contents/entropy_coding/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,15 @@ td center { margin-top:0em; margin-bottom:0em; }
.Canvas { position:relative; }
img.math{vertical-align:middle;}
div.par-math-display, div.math-display{text-align:center;}
body{ margin:1em auto; max-width:80ch; padding:0 .62em; }
h1,h2,h3,h4,h5 { line-height:1.2; }
@media print{ body{ max-width:none } }
.partHead, likepartHead { font-size: 2em; }
.chapterHead, likechapterHead { font-size: 1.7411em; }
.sectionHead, likesectionHead { font-size: 1.5157em; }
.subsectionHead, likesubsectionHead { font-size: 1.3195em; }
.subsubsectionHead, likesubsubsectionHead { font-size: 1.1487em; }
@media (prefers-color-scheme: dark) { img[src^="index"]{filter: invert(1); } }
li p.indent { text-indent: 0em }
li p:first-child{ margin-top:0em; }
li p:last-child, li div:last-child { margin-bottom:0.5em; }
Expand Down Expand Up @@ -99,6 +108,8 @@ table[rules] {border-left:solid black 0.4pt; border-right:solid black 0.4pt; }
.hline td, .cline td{ padding: 0; }
.hline hr, .cline hr{border:none;border-top:1px solid black;}
.hline {border-top: 1px solid black;}
.hline + .vspace:last-child{display:none;}
.hline:first-child{border-bottom:1px solid black;border-top:none;}
.tabbing-right {text-align:right;}
div.float, div.figure {margin-left: auto; margin-right: auto;}
div.float img {text-align:center;}
Expand Down Expand Up @@ -130,6 +141,7 @@ div.caption span.id{font-weight: bold; white-space: nowrap; }
h1.partHead{text-align: center}
p.bibitem { text-indent: -2em; margin-left: 2em; margin-top:0.6em; margin-bottom:0.6em; }
p.bibitem-p { text-indent: 0em; margin-left: 2em; margin-top:0.6em; margin-bottom:0.6em; }
.subsubsectionHead, .likesubsubsectionHead { font-size: 1em; }
.paragraphHead, .likeparagraphHead { margin-top:2em; font-weight: bold;}
.subparagraphHead, .likesubparagraphHead { font-weight: bold;}
.verse{white-space:nowrap; margin-left:2em}
Expand Down Expand Up @@ -180,14 +192,20 @@ table[rules] {border-left:solid black 0.4pt; border-right:solid black 0.4pt; }
.hline td, .cline td{ padding: 0; }
.hline hr, .cline hr{border:none;border-top:1px solid black;}
.hline {border-top: 1px solid black;}
.hline + .vspace:last-child{display:none;}
.hline:first-child{border-bottom:1px solid black;border-top:none;}
div.array {text-align:center;}
.supertabular {text-align:center}
code.lstinline{font-family:monospace,monospace;}
pre.listings{font-family: monospace,monospace; white-space: pre-wrap; margin-top:0.5em; margin-bottom:0.5em; }
.lstlisting .label{margin-right:0.5em; }
div.lstlisting{font-family: monospace,monospace; white-space: nowrap; margin-top:0.5em; margin-bottom:0.5em; }
div.lstinputlisting{ font-family: monospace,monospace; white-space: nowrap; }
pre.lstlisting{font-family: monospace,monospace; white-space: pre-wrap; margin-top:0.5em; margin-bottom:0.5em; }
pre.lstinputlisting{ font-family: monospace,monospace; white-space: pre-wrap; }
.lstinputlisting .label{margin-right:0.5em;}
table[rules] {border-left:solid black 0.4pt; border-right:solid black 0.4pt; }
table.longtable{border-collapse: collapse; border-spacing: 0;}
div.longtable{text-align:center;}
table.longtable{margin-left:auto; margin-right: auto;}
caption.longtable .id{font-weight:bold;}
/* end css.sty */

65 changes: 36 additions & 29 deletions contents/entropy_coding/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -71,24 +71,24 @@ <h3 class='sectionHead'><span class='titlemark'>3 </span> <a id='x1-40003'></a
<!-- l. 68 --><p class='noindent'>
</p>
<h3 class='sectionHead'><span class='titlemark'>4 </span> <a id='x1-50004'></a><a href='https://en.wikipedia.org/wiki/Huffman_coding'>Huffman Coding (HC)</a></h3>
<!-- l. 70 --><p class='noindent'>A Huffman code <span class='cite'>[<a href='#Xvruiz__huffman_coding'>5</a><a href='#Xruiz2000compresion'>1</a>]</span> is a <a href='https://en.wikipedia.org/wiki/Prefix_code'>prefix code</a> that, for each code-word, allows to “navigate”
through the so called Huffman tree from the trunk to one of its leaves, without
uncertainty. The Huffman tree satisfies that \begin {equation} l(c(s)) = \lceil I(s)\rceil , \label {eq:huffman_performance} \end {equation}
where \(l(c(s))\) is the length of the (Huffman) code-word, usually in bits of data, assigned to
the symbol \(s\), and \(I(s)\) is the amount of information represented by \(s\), measured bits of
<!-- l. 70 --><p class='noindent'>A Huffman code <span class='cite'>[<a href='#Xvruiz__huffman_coding'>5</a><a href='#Xruiz2000compresion'>1</a>]</span> is a <a href='https://en.wikipedia.org/wiki/Prefix_code'>prefix code</a> that, for each code-word, allows to
“navigate” through the so called Huffman tree from the trunk to one of its
leaves, without uncertainty. The Huffman tree satisfies that \begin {equation} l(c(s)) = \lceil I(s)\rceil , \label {eq:huffman_performance} \end {equation}<a id='x1-5001r1'></a> where \(l(c(s))\) is the
length of the (Huffman) code-word, usually in bits of data, assigned to the
symbol \(s\), and \(I(s)\) is the amount of information represented by \(s\), measured bits of
information <span class='cite'>[<a href='#Xvruiz__information_theory'>6</a>]</span>.



</p><!-- l. 84 --><p class='indent'> Notice that the minimum number of bits that can be used for representing a
symbol (using Huffman) is 1, which can be a inefficient when the size of the alphabet
is small.<span class='footnote-mark'><a href='#fn1x0' id='fn1x0-bk'><sup class='textsuperscript'>1</sup></a></span><a id='x1-5001f1'></a>
is small.<span class='footnote-mark'><a href='#fn1x0' id='fn1x0-bk'><sup class='textsuperscript'>1</sup></a></span><a id='x1-5002f1'></a>
Another drawback of HC is that the Huffman tree must be updated each time the
probabilistic model is updated, action very frequent when using <a href='https://en.wikipedia.org/wiki/Adaptive_Huffman_coding'>adaptive
models</a>.
</p><!-- l. 95 --><p class='noindent'>
</p>
<h4 class='likesubsectionHead'><a id='x1-60004'></a>Resources</h4>
<h4 class='likesubsectionHead'><a id='x1-6000'></a>Resources</h4>
<!-- l. 96 --><p class='noindent'>
</p><ol class='enumerate1'>
<li class='enumerate' id='x1-6002x1'><a href='https://github.com/Sistemas-Multimedia/VCF/blob/main/src/Huffman.py'>Huffman.py</a>: Implementation in VCF.
Expand All @@ -111,26 +111,26 @@ <h4 class='likesubsectionHead'><a id='x1-60004'></a>Resources</h4>
<li class='enumerate' id='x1-6016x8'><a href='https://en.wikipedia.org/wiki/Context-adaptive_variable-length_coding'>Context-Adaptive Variable-Length Coding</a>.</li></ol>
<!-- l. 107 --><p class='noindent'>
</p>
<h4 class='likesubsectionHead'><a id='x1-70004'></a>To do</h4>
<h4 class='likesubsectionHead'><a id='x1-7000'></a>To do</h4>
<!-- l. 108 --><p class='noindent'>
</p><ol class='enumerate1'>
<li class='enumerate' id='x1-7002x1'>Create a new module named <span class='ectt-1000'>adaptive_Huffman.py </span>that use a
context-based adaptive probabilistic model <span class='cite'>[<a href='#Xnelson96datacompression'>10</a>]</span>, where the user can select
the order of the model.</li></ol>
the order of the model, and HC is used as a entropy encoder.</li></ol>
<!-- l. 116 --><p class='noindent'>
</p>
<h3 class='sectionHead'><span class='titlemark'>5 </span> <a id='x1-80005'></a><a href='https://en.wikipedia.org/wiki/Arithmetic_coding'>Arithmetic Coding (AC)</a></h3>
<!-- l. 118 --><p class='noindent'>In an arithmetic codec <span class='cite'>[<a href='#Xvruiz__arithmetic_coding'>2</a><a href='#Xruiz2000compresion'>1</a>]</span>, the number of bits of data that are used for
representing symbols match exactly the number of bits of information provided by
the symbols, i.e, \begin {equation} l(c(s)) = I(s). \end {equation}
the symbols, i.e, \begin {equation} l(c(s)) = I(s). \end {equation}<a id='x1-8001r2'></a>
</p><!-- l. 125 --><p class='indent'> This also means that, even if the size of the alphabet is small, the coding
performance of an arithmetic code is optimal, although this optimality is only fully
satisfied if the number of symbols to encode is infinite. Notice also that, if the
alphabet is large, the encoding performance difference between a Huffman code (or
any other prefix code) and an arithmetic code, vanishes.
</p><!-- l. 132 --><p class='noindent'>
</p>
<h4 class='likesubsectionHead'><a id='x1-90005'></a>Resources</h4>
<h4 class='likesubsectionHead'><a id='x1-9000'></a>Resources</h4>
<!-- l. 133 --><p class='noindent'>
</p><ol class='enumerate1'>
<li class='enumerate' id='x1-9002x1'><a href='https://github.com/vicente-gonzalez-ruiz/arithmetic_coding/blob/master/src/arithmetic_coding/arithmetic_coding.ipynb'>Arithmetic Coding (notebook)</a>.
Expand All @@ -149,50 +149,53 @@ <h4 class='likesubsectionHead'><a id='x1-90005'></a>Resources</h4>
<li class='enumerate' id='x1-9012x6'><a href='https://en.wikipedia.org/wiki/Context-adaptive_binary_arithmetic_coding'>Context-Adaptive Binary Arithmetic Coding</a>.</li></ol>
<!-- l. 144 --><p class='noindent'>
</p>
<h4 class='likesubsectionHead'><a id='x1-100005'></a>To do</h4>
<h4 class='likesubsectionHead'><a id='x1-10000'></a>To do</h4>
<!-- l. 145 --><p class='noindent'>
</p><ol class='enumerate1'>
<li class='enumerate' id='x1-10002x1'>Create a new module named <span class='ectt-1000'>arith.py </span>that use a context-based adaptive
<li class='enumerate' id='x1-10002x1'>Create a new module named <span class='ectt-1000'>arith </span>that implement a static probabilistic
model and Arithmetic Coding <span class='cite'>[<a href='#Xnelson96datacompression'>10</a>]</span>.
</li>
<li class='enumerate' id='x1-10004x2'>Create a new module named <span class='ectt-1000'>arith.py </span>that use a context-based adaptive
probabilistic model and Arithmetic Coding <span class='cite'>[<a href='#Xnelson96datacompression'>10</a>]</span>, where the user can select
the order of the model.</li></ol>
<!-- l. 152 --><p class='noindent'>
</p>
<h3 class='sectionHead'><span class='titlemark'>6 </span> <a id='x1-110006'></a><a href='https://zlib.net/'><span class='ectt-1000'>zlib</span></a></h3>



<!-- l. 154 --><p class='noindent'><span class='ectt-1000'>zlib </span>is based on <a href='https://en.wikipedia.org/wiki/Deflate'>DEFLATE</a>, which in turn is based on LZ77 <span class='cite'>[<a href='#Xvruiz__LZW'>7</a><a href='#Xruiz2000compresion'>1</a>]</span> and Huffman coding.
<!-- l. 155 --><p class='noindent'>
</p>
<h3 class='sectionHead'><span class='titlemark'>6 </span> <a id='x1-110006'></a><a href='https://zlib.net/'><span class='ectt-1000'>zlib</span></a></h3>
<!-- l. 157 --><p class='noindent'><span class='ectt-1000'>zlib </span>is based on <a href='https://en.wikipedia.org/wiki/Deflate'>DEFLATE</a>, which in turn is based on LZ77 <span class='cite'>[<a href='#Xvruiz__LZW'>7</a><a href='#Xruiz2000compresion'>1</a>]</span> and Huffman coding.
Therefore, <span class='ectt-1000'>zlib </span>exploits the repetition of symbols and also, the 0-order statistical
redundancy<span class='footnote-mark'><a href='#fn2x0' id='fn2x0-bk'><sup class='textsuperscript'>2</sup></a></span><a id='x1-11001f2'></a>.
One of the main advantages of <span class='ectt-1000'>zlib </span>is that is quite fast compared to symbol
encoders such as HC and AC.
</p><!-- l. 163 --><p class='indent'> Nowadays, <span class='ectt-1000'>zlib </span>is a keystone in data manipulation because it is the basic library
</p><!-- l. 166 --><p class='indent'> Nowadays, <span class='ectt-1000'>zlib </span>is a keystone in data manipulation because it is the basic library
used in such important applications as <a href='https://en.wikipedia.org/wiki/ZIP_(file_format)'>Zip</a> and <a href='https://en.wikipedia.org/wiki/Gzip'>Gzip</a>.
</p><!-- l. 168 --><p class='noindent'>
</p><!-- l. 171 --><p class='noindent'>
</p>
<h4 class='likesubsectionHead'><a id='x1-120006'></a>Resources</h4>
<!-- l. 169 --><p class='noindent'>
<h4 class='likesubsectionHead'><a id='x1-12000'></a>Resources</h4>
<!-- l. 172 --><p class='noindent'>
</p><ol class='enumerate1'>
<li class='enumerate' id='x1-12002x1'><a href='https://docs.python.org/3/library/zlib.html'><span class='ectt-1000'>zlib </span>— Compression compatible with gzip</a>.
</li>
<li class='enumerate' id='x1-12004x2'><a href='https://en.wikipedia.org/wiki/Lossless_JPEG'>Lossless JPEG</a>.</li></ol>
<!-- l. 175 --><p class='noindent'>
<!-- l. 178 --><p class='noindent'>
</p>
<h3 class='sectionHead'><span class='titlemark'>7 </span> <a id='x1-130007'></a><a href='https://en.wikipedia.org/wiki/Portable_Network_Graphics'>Portable Network Graphics (PNG)</a></h3>
<!-- l. 176 --><p class='noindent'>PNG <span class='cite'>[<a href='#Xvruiz__PNG'>8</a>]</span> (pronounced “ping”) is a dictionary-based (string encoding) <a href='https://en.wikipedia.org/wiki/Lossless_compression'>lossless image
<!-- l. 179 --><p class='noindent'>PNG <span class='cite'>[<a href='#Xvruiz__PNG'>8</a>]</span> (pronounced “ping”) is a dictionary-based (string encoding) <a href='https://en.wikipedia.org/wiki/Lossless_compression'>lossless image
compression format</a> used for representing <a href='https://en.wikipedia.org/wiki/Digital_data'>digital</a> <a href='https://en.wikipedia.org/wiki/Digital_image'>images</a> and <a href='https://en.wikipedia.org/wiki/Video'>videos</a> <span class='cite'>[<a href='#Xvruiz__image_video'>3</a>]</span> in III...
format. The entropy encoder of PNG is based on HC and LZSS, and a pixel predictor
that removes the spatial redundancy.
</p><!-- l. 187 --><p class='indent'> We must bear in mind that as such an image compressor, we can only interact
</p><!-- l. 190 --><p class='indent'> We must bear in mind that as such an image compressor, we can only interact
with PNG at the image level, that is, it only accepts images (in shades of
gray or in color, with the possibility of an <a href='https://en.wikipedia.org/wiki/Alpha_compositing'>alpha channel</a>), and only returns
images.
</p><!-- l. 197 --><p class='noindent'>
</p><!-- l. 200 --><p class='noindent'>
</p>
<h3 class='sectionHead'><span class='titlemark'>8 </span> <a id='x1-140008'></a>References</h3>



<h3 class='sectionHead'><span class='titlemark'>8 </span> <a id='x1-140008'></a>References</h3>
<div class='thebibliography'>
<p class='bibitem'><span class='biblabel'>
[1]<span class='bibsp'>   </span></span><a id='Xruiz2000compresion'></a>Vicente González-Ruiz. <a href='http://www.hpca.ual.es/~vruiz/papers/tesis.pdf'><span class='ecti-1000'>Compresión Reversible y Transmisión de
Expand Down Expand Up @@ -227,9 +230,13 @@ <h3 class='sectionHead'><span class='titlemark'>8 </span> <a id='x1-140008'></
1996.
</p>
</div>
<div class='footnotes'><!-- l. 89 --><p class='indent'> <span class='footnote-mark'><a href='#fn1x0-bk' id='fn1x0'><sup class='textsuperscript'>1</sup></a></span><span class='ecrm-0800'>In this case, Huffman can be ineffective. In an extreme case, the alphabet could have only
</span><span class='ecrm-0800'>two symbols, and therefore the Huffman encoder does not compress or expand.</span></p>
<!-- l. 159 --><p class='indent'> <span class='footnote-mark'><a href='#fn2x0-bk' id='fn2x0'><sup class='textsuperscript'>2</sup></a></span><span class='ecrm-0800'>In other words, that some symbols are more frequently than others.</span></p> </div>



<div class='footnotes'><a id='x1-5003x4'></a>
<!-- l. 89 --><p class='indent'> <span class='footnote-mark'><a href='#fn1x0-bk' id='fn1x0'><sup class='textsuperscript'>1</sup></a></span><span class='ecrm-0800'>In this case, Huffman can be ineffective. In an extreme case, the alphabet could have only
</span><span class='ecrm-0800'>two symbols, and therefore the Huffman encoder does not compress or expand.</span></p><a id='x1-11002x6'></a>
<!-- l. 162 --><p class='indent'> <span class='footnote-mark'><a href='#fn2x0-bk' id='fn2x0'><sup class='textsuperscript'>2</sup></a></span><span class='ecrm-0800'>In other words, that some symbols are more frequently than others.</span></p> </div>

</body>
</html>
5 changes: 4 additions & 1 deletion contents/entropy_coding/texput.tex
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ \subsection*{To do}
\item Create a new module named \texttt{adaptive\_Huffman.py} that use
a context-based adaptive probabilistic model
\cite{nelson96datacompression}, where the user can select the order
of the model.
of the model, and HC is used as a entropy encoder.
\end{enumerate}

\section{\href{https://en.wikipedia.org/wiki/Arithmetic_coding}{Arithmetic
Expand Down Expand Up @@ -143,6 +143,9 @@ \subsection*{Resources}

\subsection*{To do}
\begin{enumerate}
\item Create a new module named \texttt{arith} that implement a static
probabilistic model and Arithmetic Coding
\cite{nelson96datacompression}.
\item Create a new module named \texttt{arith.py} that use
a context-based adaptive probabilistic model and Arithmetic Coding
\cite{nelson96datacompression}, where the user can select the order
Expand Down
6 changes: 3 additions & 3 deletions contents/working_environment/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@

<h2 class='titleHead'>Working Environment</h2>
<div class='author'><a href='https://vicente-gonzalez-ruiz.github.io/'><span class='ecrm-1200'>Vicente González Ruiz</span></a> <span class='ecrm-1200'>- </span><a href='https://www.ual.es/universidad/departamentos/informatica'><span class='ecrm-1200'>Departamento de Informática</span></a> <span class='ecrm-1200'>- </span><a href='https://www.ual.es'><span class='ecrm-1200'>UAL</span></a></div><br />
<div class='date'><span class='ecrm-1200'>November 3, 2024</span></div>
<div class='date'><span class='ecrm-1200'>December 5, 2024</span></div>
</div>
<h3 class='likesectionHead'><a id='x1-1000'></a>Contents</h3>
<div class='tableofcontents'>
 <span class='sectionToc'>1 <a href='#x1-20001' id='QQ2-1-2'>Visual Coding Framework (VCF) Project</a></span>
 <span class='sectionToc'>1 <a href='#x1-20001' id='QQ2-1-2'>The Visual Coding Framework (VCF) Project</a></span>
<br />  <span class='sectionToc'>2 <a href='#x1-30002' id='QQ2-1-3'>Recommended Working Environments</a></span>
<br />   <span class='subsectionToc'>2.1 <a href='#x1-40002.1' id='QQ2-1-4'>Using your Operating System</a></span>
<br />   <span class='subsectionToc'>2.2 <a href='#x1-50002.2' id='QQ2-1-5'>Using a Container</a></span>
Expand All @@ -35,7 +35,7 @@ <h3 class='likesectionHead'><a id='x1-1000'></a>Contents</h3>
</div>
<!-- l. 10 --><p class='noindent'>
</p>
<h3 class='sectionHead'><span class='titlemark'>1 </span> <a id='x1-20001'></a>Visual Coding Framework (VCF) Project</h3>
<h3 class='sectionHead'><span class='titlemark'>1 </span> <a id='x1-20001'></a>The Visual Coding Framework (VCF) Project</h3>
<!-- l. 11 --><p class='noindent'><a href='https://github.com/Sistemas-Multimedia/VCF'>VCF</a> <span class='cite'>[<a href='#Xvruiz__VCF'>2</a>]</span> is a Python <span class='cite'>[<a href='#Xpython'>1</a>]</span> application that implements a collection of algorithms used
in image and video compression. VCF is hosted at GitHub and developed by the
students of Sistemas Multimedia.
Expand Down
Loading

0 comments on commit eba9148

Please sign in to comment.