2021-12-01 07:13:34 +00:00
|
|
|
# Dithering with OpenCL
|
|
|
|
|
2022-01-18 02:51:53 +00:00
|
|
|
## Note about Maintenance and Versions
|
|
|
|
|
2022-02-18 06:24:31 +00:00
|
|
|
~~The project at tag `1.0.0` refers to the state of the project upon completion
|
2022-01-18 02:51:53 +00:00
|
|
|
of the course. Newer versions are meant to be maintenance releases; fixes that
|
|
|
|
keep the project working. As of 2022-01-18, there may be (after now) a version
|
|
|
|
`1.1.0` or `1.0.1` due to keeping up to date with the FFmpeg dependency as a new
|
2022-02-18 06:25:53 +00:00
|
|
|
major version of FFmpeg was released (version `5.0`).~~
|
2022-01-18 02:51:53 +00:00
|
|
|
|
2022-02-18 06:25:53 +00:00
|
|
|
~~To be clear, version `1.0.0` of this project is expected to work with FFmpeg
|
2022-02-18 06:24:31 +00:00
|
|
|
version `4.4`.~~
|
|
|
|
|
|
|
|
Fixes were applied for FFmpeg version 5. A macro is used to change incompatible
|
|
|
|
code based on what version of FFmpeg is specified in the headers, so external
|
|
|
|
checking of version is not necessary. Thus, the latest version of this repo
|
|
|
|
should work with both FFmpeg 5.0 and 4.4.
|
2022-01-18 02:54:37 +00:00
|
|
|
|
2021-12-01 07:13:34 +00:00
|
|
|
## Background
|
|
|
|
|
|
|
|
[Project Proposal PDF](https://seodisparate.com/static/uploads/EN605.617.81.FA21_ProjectProposal.pdf)
|
|
|
|
|
|
|
|
The proposal mentioned dithering live-input frames, but I ended up with just
|
|
|
|
dithering single images or turning a video into dithered images.
|
|
|
|
|
2021-12-01 08:33:28 +00:00
|
|
|
# Usage
|
|
|
|
|
|
|
|
A "blue-noise" image is integral to dithering images. A generated blue-noise
|
|
|
|
image is provided in the "res/" directory. Run the program with "--help" to get
|
|
|
|
info on how to use it.
|
|
|
|
|
2021-12-10 06:49:14 +00:00
|
|
|
Blue-noise images were generated using [my other project that generates
|
|
|
|
blue-noise with/without OpenCL](https://git.seodisparate.com/stephenseo/blue_noise_generation).
|
|
|
|
|
2021-12-01 08:36:46 +00:00
|
|
|
PNG, PGM, and PPM image formats are supported.
|
|
|
|
|
|
|
|
For decoding video, any format that ffmpeg can read should work (though if
|
|
|
|
things don't work, try using MP4 files).
|
|
|
|
|
2021-12-03 11:15:02 +00:00
|
|
|
~~WARNING: Video decoding is still a WIP. The video is currently decoded, but an
|
2021-12-01 08:41:49 +00:00
|
|
|
output video being encoded hasn't been implemented yet. The current
|
2021-12-03 11:15:02 +00:00
|
|
|
implementation writes each video frame to a PNG image in the current
|
|
|
|
directory.~~
|
|
|
|
|
2021-12-05 11:15:10 +00:00
|
|
|
Video decoding and encoding is finished, ~~but there is some noticable drops in
|
|
|
|
quality when encoding to colored dithered video~~ but the resulting video may
|
|
|
|
end up being too large. It may be better to just output each frame to individual
|
|
|
|
PNGs, then combining them later just like as mentioned here with the params you
|
|
|
|
want set: https://trac.ffmpeg.org/wiki/Slideshow .
|
2021-12-01 08:41:49 +00:00
|
|
|
|
2021-12-01 07:16:33 +00:00
|
|
|
# Other Notes
|
|
|
|
|
2021-12-01 07:50:11 +00:00
|
|
|
~~I plan on adding the MIT License to this project once the course (that this
|
|
|
|
project was made for) is over.~~
|
|
|
|
|
|
|
|
I went ahead and applied the MIT License earlier than noted here.
|
2021-12-01 07:51:28 +00:00
|
|
|
|
2021-12-04 11:09:55 +00:00
|
|
|
## C++ Compatability
|
|
|
|
|
|
|
|
The source is written to work with C++11 but not any higher. The only
|
|
|
|
significant part that this affects are the functions in the "Image" class that
|
|
|
|
return an optional value (non-optional on success). Ideally, C++17's
|
|
|
|
std::optional would be used in that case, but since I am keeping things to work
|
|
|
|
up to C++11, std::unique\_ptr is used instead.
|
|
|
|
|
2021-12-12 06:53:36 +00:00
|
|
|
# Project Presentation
|
|
|
|
|
|
|
|
[Click here to view the presentation](https://igpup.seodisparate.com/posts/project_presentation/)
|
|
|
|
|
2021-12-01 07:51:28 +00:00
|
|
|
# Legal Stuff
|
|
|
|
|
|
|
|
[This program uses FFmpeg which is licensed under the LGPL 2.1 license](https://ffmpeg.org/legal.html)
|
2021-12-12 07:15:51 +00:00
|
|
|
|
|
|
|
[This program uses libpng which is licensed under the PNG Reference Library License Version 2](http://www.libpng.org/pub/png/src/libpng-LICENSE.txt)
|