Uploaded June 2023 | Updated November 2026, 4 hours ago
Note: There are some typos in the pseudocode at the end of this video. See below for details.
This video was made as part of a fourth-year undergraduate course covering an overview of Data Compression.
0:00 Introduction
0:53 Infinite Precision
4:07 How many bits do we need?
28:48 Integer Arithmetic Coding
1:17:55 Underflow
1:32:50 Encoding Pseudocode
1:36:12 Decoding
All slides and diagrams are original content (developed between 2019 and 2023).
As any viewer will quickly realize, these videos were made just like in-person lectures: in one sitting, with no breaks, editing or script. If you find any of this helpful or interesting, please let me know (I really appreciate any other feedback as well).
There are some mistakes in the pseudocode for encoding (slide 127) and decoding (slide 131) at the end of the video:
- There should be an extra " - 1" at the end of the formula to update the variable "high" on line 10 of the encoding pseudocode and line 14 of the decoding pseudocode (i.e. the line should be "high = low + w*CFhigh(c)/T - 1"). It is clear from the earlier slides that this extra -1 is needed (e.g. see slide 33).
- The if/else block in the inner loop that starts on line 12 of the encoding pseudocode and line 16 of the decoding pseudocode should have an extra "else" clause which contains a "break" statement (such that if the MSBs do not match and the 2nd most significant bits also do not match, the inner loop will end).
For added certainty, a complete C++ implementation of a basic arithmetic coder, originally provided as part of the course materials and based on the algorithms in this lecture, has also been posted: github.com/billbird/arith32
The posted code might also be helpful if you want specifics on the low-level bitwise manipulations required for the algorithms.
Note: There are some typos in the pseudocode at the end of this video. See below for details.
This video was made as part of a fourth-year undergraduate course covering an overview of Data Compression.
0:00 Introduction
0:53 Infinite Precision
4:07 How many bits do we need?
28:48 Integer Arithmetic Coding
1:17:55 Underflow
1:32:50 Encoding Pseudocode
1:36:12 Decoding
All slides and diagrams are original content (developed between 2019 and 2023).
As any viewer will quickly realize, these videos were made just like in-person lectures: in one sitting, with no breaks, editing or script. If you find any of this helpful or interesting, please let me know (I really appreciate any other feedback as well).
There are some mistakes in the pseudocode for encoding (slide 127) and decoding (slide 131) at the end of the video:
- There should be an extra " - 1" at the end of the formula to update the variable "high" on line 10 of the encoding pseudocode and line 14 of the decoding pseudocode (i.e. the line should be "high = low + w*CFhigh(c)/T - 1"). It is clear from the earlier slides that this extra -1 is needed (e.g. see slide 33).
- The if/else block in the inner loop that starts on line 12 of the encoding pseudocode and line 16 of the decoding pseudocode should have an extra "else" clause which contains a "break" statement (such that if the MSBs do not match and the 2nd most significant bits also do not match, the inner loop will end).
For added certainty, a complete C++ implementation of a basic arithmetic coder, originally provided as part of the course materials and based on the algorithms in this lecture, has also been posted: github.com/billbird/arith32
The posted code might also be helpful if you want specifics on the low-level bitwise manipulations required for the algorithms.










