Skip to content

Latest commit

History

History
64 lines (49 loc) · 1.06 KB

File metadata and controls

64 lines (49 loc) · 1.06 KB

cpp-decoder

C++ decoder for FIF

Building

Run the build.sh script to compile both programs.

Reqired libraries: png++ (for fif2png) and SDL2 (for fifsdl).

fif2png

Converts a FIF file to a PNG file.

./fif2png input.fif output.png

fifsdl

SDL based viewer for FIF images and videos.

./fifsdl input.fif

fif_decoder.h usage

FIF struct:

structFIFrgb {
unsignedchar r;
unsignedchar g;
unsignedchar b;
}structFIF {
constunsignedchar* data;
unsignedint width;
unsignedint height;
unsignedlong datapos;
bool eof;
FIFrgb currentBG;
FIFrgb currentFG;
FIFrgb* decoded_data = nullptr;
}

Create your FIF struct object:

FIF* fif = newFIF;

Write file data to FIF->data

Read FIF:

FIF_read(fif)

Return codes (signed int):

Less than 0: Error reading file

More than 0: Sleep operation, returned number is milliseconds to sleep

0: Done reading file

Read the decoded data from FIF->decoded_data as standard RGB pixel data. (FIF->width * FIF->height)

Closing:

FIF_free(fif);
delete fif;