Add algoritm description

This commit is contained in:
serturx 2022-10-03 10:24:21 +02:00 committed by Krishna Vedala
parent 45f09db995
commit 35f6431f47
2 changed files with 13 additions and 4 deletions

Binary file not shown.

View File

@ -2,12 +2,21 @@
* @file * @file
* @author [serturx](https://github.com/serturx/) * @author [serturx](https://github.com/serturx/)
* @brief Encode a null terminated string using [Run-length encoding](https://en.wikipedia.org/wiki/Run-length_encoding) * @brief Encode a null terminated string using [Run-length encoding](https://en.wikipedia.org/wiki/Run-length_encoding)
* @section Description
* Run-length encoding is a lossless compression algorithm.
* It works by counting the consecutive occurences symbols
* and encodes that series of consecutive symbols into the
* counted symbol and a number denoting the number of
* consecutive occorences.
*
* For example the string "AAAABBCCD" gets encoded into "4A2B2C1D"
*
*/ */
#include <stdio.h> #include <stdio.h> //For printf
#include <string.h> #include <string.h> //For string functions like strlen
#include <stdlib.h> #include <stdlib.h> //For malloc/free
#include <assert.h> #include <assert.h> //For assert
/** /**
* @brief Encodes a null-terminated string using run-length encoding * @brief Encodes a null-terminated string using run-length encoding