RLE-encoding/decoding for files in C

RLE-encoding

RLE-encoding/decoding for files in C

My version of file encoding/decoding as an assignment for Metropolia UAS in C-programming course . The task:

Implement RLE-encoding/decoding of file. Write log of compression results (name, original size, CRC, compressed size, name of compressed file). The encoding is based on encoding the multiple occurrences of the same byte with an encoding that saves number of repeating bytes instead of individual bytes. The encoding works as follows: 0x80 is a special character that indicates encoded sequence. It is immediately followed by the byte to repeat and number of repetitions. For example, a sequence of seven ‘T’s would be encoded as: 0x80 0x07 0x54. From this we can see that encoding sequences of less than three same characters increases the result file size instead of decreasing size. Occurrence of 0x80 is always encoded regardless of the length. There is one exception in the encoding, when number of repetitions is set to zero it indicates a 0x80. A single 0x80 would be encoded as 0x80 0x00, two 0x80s would be encoded as 0x80 0x02 0x80 and three 0x80s as 0x80 0x03 0x80 and so on. The encoded file must contain a small header that carries the CRC of the original file so that decompressed data can verified.

The project contains two files for the program to run:

for functions and main program

for declarations and macros

PROJECT USES GETLINE FUNCTION, SO PREPARE TO IMPLEMENT YOUR OWN GETLINE IN CASE IT DOESN'T WORK

getline source: GNU

(C) Vasily Davydov 2021

Owner
Vasily Davydov
I am a second-year IT-student majoring in Smart-IoT
Vasily Davydov
Similar Resources

A C++11 ASN.1 BER Encoding and Decoding Library

fast_ber A performant ASN.1 BER encoding and decoding library written in C++11 Introduction fast_ber is a small, lightweight library for BER encoding

Dec 1, 2022

Use rtsp protocol to push local H265 video encoding files

rtspServerH265 Use rtsp protocol to push local H265 video encoding files 项目介绍 C++11实现的RTSP服务器和推流器。主要完成对H265视频编码文件的RTSP推流 使用说明 1.编译并运行程序; 2.打开VLC软件,在媒体

Oct 12, 2022

Decoding light morse code with a light dependent resistor and Arduino board

Decoding light morse code with a light dependent resistor and Arduino board

Morse decoder The project's idea is very simple, the Arduino program has the responsibility to upload the sensor's data to the USB serial port.

Mar 12, 2022

Image decoding for many popular formats for Simple Directmedia Layer.

SDL_image 2.0 The latest version of this library is available from: http://www.libsdl.org/projects/SDL_image/ This is a simple library to load image

Nov 27, 2022

Morse code decoding library

Morse code decoding library

ggmorse Morse code decoding library ggmorse2.mp4 ggmorse0.mp4 ggmorse1.mp4 Try it out You can easily test the library using the free GGMorse applicati

Nov 20, 2022

A Haskell library for fast decoding of JSON documents using the simdjson C++ library

hermes A Haskell interface over the simdjson C++ library for decoding JSON documents. Hermes, messenger of the gods, was the maternal great-grandfathe

Nov 9, 2022

⛵ The missing small and fast image decoding library for humans (not for machines).

⛵ The missing small and fast image decoding library for humans (not for machines).

Squirrel Abstract Image Library The missing fast and easy-to-use image decoding library for humans (not for machines). Target Audience • Features • Im

Nov 23, 2022

Single file C library for decoding MPEG1 Video and MP2 Audio

PL_MPEG - MPEG1 Video decoder, MP2 Audio decoder, MPEG-PS demuxer Single-file MIT licensed library for C/C++ See pl_mpeg.h for the documentation. Why?

Nov 30, 2022

Cross platform C++11 library for decoding audio (mp3, wav, ogg, opus, flac, etc)

Libnyquist is a small C++11 library for reading sampled audio data from disk or memory. It is intended to be used an audio loading frontend for games, audio sequencers, music players, and more.

Nov 30, 2022

A guide that teach you build a custom version of Chrome / Electron on macOS / Windows / Linux that supports hardware / software HEVC decoding.

enable-chromium-hevc-hardware-decoding A guide that teach you build a custom version of Chrome / Electron on macOS / Windows / Linux that supports har

Dec 2, 2022

Text utilities, including beam search decoding, tokenizing, and more, built for use in Flashlight.

Flashlight Text: Fast, Lightweight Utilities for Text Quickstart | Installation | Python Documentation | Citing Flashlight Text is a fast, minimal lib

Nov 24, 2022

Fast Binary Encoding is ultra fast and universal serialization solution for C++, C#, Go, Java, JavaScript, Kotlin, Python, Ruby, Swift

Fast Binary Encoding (FBE) Fast Binary Encoding allows to describe any domain models, business objects, complex data structures, client/server request

Dec 1, 2022

Simple Binary Encoding (SBE) - High Performance Message Codec

Simple Binary Encoding (SBE) SBE is an OSI layer 6 presentation for encoding and decoding binary application messages for low-latency financial applic

Nov 30, 2022

TurboRLE-Fastest Run Length Encoding

TurboRLE: Turbo Run Length Encoding Efficient and fastest Run Length Encoding library 🆕 The fastest now up to 50% more faster incl. SSE/AVX2 + improv

Nov 18, 2022

Consistent Hashing Using Fibonacci Encoding

fibonacci_table This does not work as I thought it would. I did not manage to compute an inverse fibonacci mapping. It works, but just like linear has

Jan 30, 2021

Single header lib for JPEG encoding. Public domain. C99. stb style.

tiny_jpeg.h A header-only public domain implementation of Baseline JPEG compression. Features: stb-style header only library. Does not do dynamic allo

Nov 22, 2022

An 'embedded-friendly' (aka Arduino) JPEG image encoding library

Starting in the late 80's I wrote my own imaging codecs for the existing standards (CCITT G3/G4 was the first). I soon added GIF, JPEG and not long after that, the PNG specification was ratified. All of this code was "clean room" - written just from the specification. I used my imaging library in many projects and products over the years and recently decided that some of my codecs could get a new lease on life as open source, embedded-friendly libraries for microcontrollers.

Oct 16, 2022

Project #1: Run-length Encoding (Computer Architecture, Fall 2021)

4190.308 Computer Architecture (Fall 2021) Project #1: Run-length Encoding Due: 11:59PM, September 26 (Sunday) Introduction In this project, you need

Sep 19, 2022

Base64 Encoding implementation in C Programming Language

cb64 Base64 Encoding implementation in C Programming Language Spec: https://datatracker.ietf.org/doc/html/rfc4648#page-5 Header only So just copy cb64

Dec 14, 2021
A C++11 ASN.1 BER Encoding and Decoding Library

fast_ber A performant ASN.1 BER encoding and decoding library written in C++11 Introduction fast_ber is a small, lightweight library for BER encoding

Dec 1, 2022
Morse code decoding library
Morse code decoding library

ggmorse Morse code decoding library ggmorse2.mp4 ggmorse0.mp4 ggmorse1.mp4 Try it out You can easily test the library using the free GGMorse applicati

Nov 20, 2022
Fast Binary Encoding is ultra fast and universal serialization solution for C++, C#, Go, Java, JavaScript, Kotlin, Python, Ruby, Swift

Fast Binary Encoding (FBE) Fast Binary Encoding allows to describe any domain models, business objects, complex data structures, client/server request

Dec 1, 2022
Simple Binary Encoding (SBE) - High Performance Message Codec

Simple Binary Encoding (SBE) SBE is an OSI layer 6 presentation for encoding and decoding binary application messages for low-latency financial applic

Nov 30, 2022
Consistent Hashing Using Fibonacci Encoding

fibonacci_table This does not work as I thought it would. I did not manage to compute an inverse fibonacci mapping. It works, but just like linear has

Jan 30, 2021
Base64 Encoding implementation in C Programming Language

cb64 Base64 Encoding implementation in C Programming Language Spec: https://datatracker.ietf.org/doc/html/rfc4648#page-5 Header only So just copy cb64

Dec 14, 2021
Like my previous encoding project but actually likely finishedable. Also in C++.

EncodedCPP Like my previous encoding project but actually likely finishedable. Also in C++. Now with encoding and decoding options. Saving codes has a

Jan 1, 2022
BRAW decoder to allow unattended, headless, conversion of *.braw files into other file formats.

BRAW Decode This is a project that uses the official Blackmagic Raw SDK to decode a *.braw file in a way that can be read by FFmpeg. The goal of the p

Oct 5, 2022
Nov 29, 2021
C library for encoding, decoding and manipulating JSON data

Jansson README Jansson is a C library for encoding, decoding and manipulating JSON data. Its main features and design principles are: Simple and intui

Nov 27, 2022