mirror of
https://github.com/dyne/frei0r.git
synced 2025-12-06 14:49:59 +01:00
Compare commits
153 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0dbbac5258 | ||
|
|
2183bc1cf6 | ||
|
|
65fa7ea8ea | ||
|
|
d6a0ea5268 | ||
|
|
69d23fc0a2 | ||
|
|
def52c449f | ||
|
|
772d2e5edb | ||
|
|
f11132bb4b | ||
|
|
455aa7d1f5 | ||
|
|
4a4503b1e8 | ||
|
|
8482bc9680 | ||
|
|
cf5cb9654d | ||
|
|
91f4cb3bbc | ||
|
|
fb4e92925f | ||
|
|
62dd46650c | ||
|
|
de67485abb | ||
|
|
5d8e8f8498 | ||
|
|
683e40f147 | ||
|
|
a12d01602b | ||
|
|
42ee3fee46 | ||
|
|
dcd39d95a7 | ||
|
|
ac46ae351d | ||
|
|
cd109d4452 | ||
|
|
542b9a9ddb | ||
|
|
e7dd4f600b | ||
|
|
4958ce76b9 | ||
|
|
1d7af87d8e | ||
|
|
f7f933322d | ||
|
|
b47c180376 | ||
|
|
3d288d95a7 | ||
|
|
1f8e21e27f | ||
|
|
85f6e9dba2 | ||
|
|
eb9e96d200 | ||
|
|
31efba74b2 | ||
|
|
2328ce3802 | ||
|
|
8bf0322bdc | ||
|
|
9178c72e59 | ||
|
|
475c9a409b | ||
|
|
b528b26fd4 | ||
|
|
bc7d7a3ccc | ||
|
|
cbb507dbbc | ||
|
|
e7fa53f312 | ||
|
|
06870b4298 | ||
|
|
cdeddc7553 | ||
|
|
7f0c0a5dfc | ||
|
|
d25ef65a9b | ||
|
|
f6b0fc3cbe | ||
|
|
33ebfb3517 | ||
|
|
784f2061e5 | ||
|
|
2a0d87428c | ||
|
|
9a0650cffd | ||
|
|
fdc9f32a4f | ||
|
|
d86b6f94c6 | ||
|
|
d32a62eeda | ||
|
|
f20a6d59c9 | ||
|
|
9f39a2350f | ||
|
|
7ae35d1715 | ||
|
|
a0e33ae61b | ||
|
|
25526005c2 | ||
|
|
be95dd5394 | ||
|
|
e0b09572fe | ||
|
|
ac71b128e9 | ||
|
|
ba04c6dfc7 | ||
|
|
3b2eeaa38c | ||
|
|
967b121fe7 | ||
|
|
36e7da5d9e | ||
|
|
e8595c6cd2 | ||
|
|
a303b82f34 | ||
|
|
448be4b935 | ||
|
|
659e409c63 | ||
|
|
76b727f247 | ||
|
|
49f759d9e1 | ||
|
|
5770116b0a | ||
|
|
c3f987c4cc | ||
|
|
8e87196572 | ||
|
|
203c03a61d | ||
|
|
929afe1e44 | ||
|
|
dbb348630c | ||
|
|
ad4cbc890b | ||
|
|
7228e0fb4f | ||
|
|
804f2098f7 | ||
|
|
69819601c6 | ||
|
|
2c45f1f093 | ||
|
|
c0bbc2fe10 | ||
|
|
a0bc641d9b | ||
|
|
ae6484e9dc | ||
|
|
bcad9ad6a7 | ||
|
|
73a6e3fa38 | ||
|
|
df066ea634 | ||
|
|
cfcf6d4051 | ||
|
|
3e1234b9f2 | ||
|
|
599b478434 | ||
|
|
6cb9759e90 | ||
|
|
b3b6c0276e | ||
|
|
ade083a867 | ||
|
|
92625bcd0c | ||
|
|
4c9b087fbb | ||
|
|
24c480cd0d | ||
|
|
6f2fdb2f89 | ||
|
|
28ed1548ee | ||
|
|
dcbc1ffc80 | ||
|
|
4ee2c0503c | ||
|
|
6d3437d6bc | ||
|
|
0355da4b24 | ||
|
|
ef3cba26a9 | ||
|
|
df6f48fe6e | ||
|
|
04ac1c58b7 | ||
|
|
0e9ba7a109 | ||
|
|
a4f417d0d4 | ||
|
|
3eb442ff9d | ||
|
|
112f52d745 | ||
|
|
c128c1123e | ||
|
|
59daec3f69 | ||
|
|
d989097b1d | ||
|
|
40b170cc1b | ||
|
|
db45e9320b | ||
|
|
a9d15ff07e | ||
|
|
6a576f4538 | ||
|
|
c3d7763a62 | ||
|
|
a0f49085bf | ||
|
|
6a81092c24 | ||
|
|
4aad575396 | ||
|
|
114a72f438 | ||
|
|
ee21d097b3 | ||
|
|
c11beecfaa | ||
|
|
febd73874d | ||
|
|
e48da90c4e | ||
|
|
5e74dfa3ad | ||
|
|
efa333bd51 | ||
|
|
00f8aa085a | ||
|
|
aa7ccf8e93 | ||
|
|
657dd0cc84 | ||
|
|
9e79ba028e | ||
|
|
a7b36436a0 | ||
|
|
700564265a | ||
|
|
86475d3e11 | ||
|
|
be4dcc6afa | ||
|
|
4e7e0f40d1 | ||
|
|
3d3c4a6acb | ||
|
|
3a1f95e493 | ||
|
|
51e8342063 | ||
|
|
a312322d83 | ||
|
|
69d3968a95 | ||
|
|
0a81c1702e | ||
|
|
bf7d77dd6e | ||
|
|
844573f22a | ||
|
|
9d3a813d19 | ||
|
|
c0c8eed79f | ||
|
|
49dbdfa314 | ||
|
|
796d122587 | ||
|
|
ce89da4892 | ||
|
|
35c6497781 | ||
|
|
b8d4e0595c |
232
.github/workflows/release.yml
vendored
Normal file
232
.github/workflows/release.yml
vendored
Normal file
@@ -0,0 +1,232 @@
|
||||
name: 020-Release
|
||||
|
||||
on:
|
||||
workflow_run:
|
||||
workflows:
|
||||
- 010-Test
|
||||
types: [completed]
|
||||
branches:
|
||||
- master
|
||||
- release/**
|
||||
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.ref_name }}
|
||||
cancel-in-progress: true
|
||||
|
||||
jobs:
|
||||
semantic-release:
|
||||
name: 🤖 Semantic release
|
||||
runs-on: ubuntu-latest
|
||||
if: "!contains(github.event.pull_request.labels.*.name, 'skip-release')"
|
||||
# if: ${{ github.ref_name == 'master' && github.event_name == 'push' }}
|
||||
outputs:
|
||||
release: ${{ steps.tag_release.outputs.release }}
|
||||
version: ${{ steps.tag_release.outputs.version }}
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- name: Setup Node.js
|
||||
uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version: latest
|
||||
- name: Install semantic-release
|
||||
run: |
|
||||
npm i npx
|
||||
npm i semantic-release/changelog
|
||||
- name: Tag release
|
||||
id: tag_release
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
run: |
|
||||
npx semantic-release | tee semantic-release.log
|
||||
if [[ `git tag --points-at HEAD` == "" ]]; then
|
||||
echo "release=False" >> $GITHUB_OUTPUT
|
||||
else
|
||||
echo "release=True" >> $GITHUB_OUTPUT
|
||||
awk '/Published release/ { printf("version=v%s\n",$8) }' semantic-release.log >> $GITHUB_OUTPUT
|
||||
fi
|
||||
|
||||
linux-build:
|
||||
name: 🐧 linux build
|
||||
runs-on: ubuntu-latest
|
||||
needs: [semantic-release]
|
||||
if: ${{ needs.semantic-release.outputs.release == 'True' }}
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- name: apt install deps
|
||||
run: |
|
||||
sudo apt-get update -y -q
|
||||
sudo apt-get install -y -q --no-install-recommends cmake ninja-build libopencv-dev libgavl-dev libfreetype-dev libcairo-dev
|
||||
- name: Build using cmake+ninja
|
||||
run: |
|
||||
mkdir build && cd build
|
||||
cmake -G "Ninja" ../
|
||||
ninja
|
||||
- name: Upload linux filter
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: release-linux-filter
|
||||
path: build/src/filter/**/*.so
|
||||
- name: Upload linux mixer2
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: release-linux-mixer2
|
||||
path: build/src/mixer2/**/*.so
|
||||
- name: Upload linux mixer3
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: release-linux-mixer3
|
||||
path: build/src/mixer3/**/*.so
|
||||
- name: Upload linux generator
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: release-linux-generator
|
||||
path: build/src/generator/**/*.so
|
||||
|
||||
win-build:
|
||||
name: 🪟 win64 build
|
||||
runs-on: windows-latest
|
||||
needs: [semantic-release]
|
||||
if: ${{ needs.semantic-release.outputs.release == 'True' }}
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: ilammy/msvc-dev-cmd@v1
|
||||
- name: choco install deps
|
||||
uses: crazy-max/ghaction-chocolatey@v2
|
||||
with:
|
||||
args: install libopencv-dev
|
||||
- name: Build using nmake
|
||||
run: |
|
||||
mkdir build && cd build
|
||||
cmake -G "NMake Makefiles" ../
|
||||
nmake
|
||||
- name: Upload win64 filter
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: release-win64-filter
|
||||
path: build/src/filter/**/*.dll
|
||||
- name: Upload win64 mixer2
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: release-win64-mixer2
|
||||
path: build/src/mixer2/**/*.dll
|
||||
- name: Upload win64 mixer3
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: release-win64-mixer3
|
||||
path: build/src/mixer3/**/*.dll
|
||||
- name: Upload win64 generator
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: release-win64-generator
|
||||
path: build/src/generator/**/*.dll
|
||||
|
||||
osx-build:
|
||||
name: 🍏 osx build
|
||||
runs-on: macos-latest
|
||||
needs: [semantic-release]
|
||||
if: ${{ needs.semantic-release.outputs.release == 'True' }}
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- name: Update Homebrew
|
||||
run: |
|
||||
brew update
|
||||
- name: Install Homebrew dependencies
|
||||
run: |
|
||||
env HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK=1 HOMEBREW_NO_AUTO_UPDATE=1 HOMEBREW_NO_INSTALL_CLEANUP=1 \
|
||||
brew install ninja cairo
|
||||
- name: Build using ninja
|
||||
run: |
|
||||
mkdir build && cd build
|
||||
cmake -G "Ninja" ../
|
||||
ninja
|
||||
- name: Upload osx filter
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: release-osx-filter
|
||||
path: build/src/filter/**/*.so
|
||||
- name: Upload osx mixer2
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: release-osx-mixer2
|
||||
path: build/src/mixer2/**/*.so
|
||||
- name: Upload osx mixer3
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: release-osx-mixer3
|
||||
path: build/src/mixer3/**/*.so
|
||||
- name: Upload osx generator
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: release-osx-generator
|
||||
path: build/src/generator/**/*.so
|
||||
|
||||
draft-binary-release:
|
||||
name: 📦 Pack release
|
||||
needs: [semantic-release, win-build, osx-build, linux-build]
|
||||
if: ${{ needs.semantic-release.outputs.release == 'True' }}
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- name: download binary artifacts
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
path: |
|
||||
frei0r-bin
|
||||
- name: create compressed archives
|
||||
run: |
|
||||
dst=frei0r-${{ needs.semantic-release.outputs.version }}_win64
|
||||
mkdir -p $dst/filter $dst/generator $dst/mixer2 $dst/mixer3
|
||||
find frei0r-bin/release-win64-filter -type f -name '*.dll' -exec cp {} $dst/filter \;
|
||||
find frei0r-bin/release-win64-generator -type f -name '*.dll' -exec cp {} $dst/generator \;
|
||||
find frei0r-bin/release-win64-mixer2 -type f -name '*.dll' -exec cp {} $dst/mixer2 \;
|
||||
find frei0r-bin/release-win64-mixer3 -type f -name '*.dll' -exec cp {} $dst/mixer3 \;
|
||||
cp README.md $dst/README.txt
|
||||
cp COPYING $dst/LICENSE.txt
|
||||
cp ChangeLog $dst/ChangeLog.txt
|
||||
cp AUTHORS.md $dst/AUTHORS.txt
|
||||
cp include/frei0r.h include/frei0r.hpp $dst/
|
||||
echo "${{ needs.semantic-release.outputs.version }}" > $dst/VERSION.txt
|
||||
zip -r -9 $dst.zip $dst
|
||||
|
||||
dst=frei0r-${{ needs.semantic-release.outputs.version }}_osx
|
||||
mkdir -p $dst/filter $dst/generator $dst/mixer2 $dst/mixer3
|
||||
find frei0r-bin/release-osx-filter -type f -name '*.so' -exec cp {} $dst/filter \;
|
||||
find frei0r-bin/release-osx-generator -type f -name '*.so' -exec cp {} $dst/generator \;
|
||||
find frei0r-bin/release-osx-mixer2 -type f -name '*.so' -exec cp {} $dst/mixer2 \;
|
||||
find frei0r-bin/release-osx-mixer3 -type f -name '*.so' -exec cp {} $dst/mixer3 \;
|
||||
cp README.md $dst/README.txt
|
||||
cp COPYING $dst/LICENSE.txt
|
||||
cp ChangeLog $dst/ChangeLog.txt
|
||||
cp AUTHORS.md $dst/AUTHORS.txt
|
||||
cp include/frei0r.h include/frei0r.hpp $dst/
|
||||
echo "${{ needs.semantic-release.outputs.version }}" > $dst/VERSION.txt
|
||||
zip -r -9 $dst.zip $dst
|
||||
|
||||
dst=frei0r-${{ needs.semantic-release.outputs.version }}_linux
|
||||
mkdir -p $dst/filter $dst/generator $dst/mixer2 $dst/mixer3
|
||||
find frei0r-bin/release-linux-filter -type f -name '*.so' -exec cp {} $dst/filter \;
|
||||
find frei0r-bin/release-linux-generator -type f -name '*.so' -exec cp {} $dst/generator \;
|
||||
find frei0r-bin/release-linux-mixer2 -type f -name '*.so' -exec cp {} $dst/mixer2 \;
|
||||
find frei0r-bin/release-linux-mixer3 -type f -name '*.so' -exec cp {} $dst/mixer3 \;
|
||||
cp README.md $dst/README.txt
|
||||
cp COPYING $dst/LICENSE.txt
|
||||
cp ChangeLog $dst/ChangeLog.txt
|
||||
cp AUTHORS.md $dst/AUTHORS.txt
|
||||
cp include/frei0r.h include/frei0r.hpp $dst/
|
||||
echo "${{ needs.semantic-release.outputs.version }}" > $dst/VERSION.txt
|
||||
tar cvfz $dst.tar.gz $dst
|
||||
|
||||
sha256sum *.zip *.tar.gz > SHA256SUMS.txt
|
||||
|
||||
- name: release all archives
|
||||
uses: softprops/action-gh-release@v1
|
||||
with:
|
||||
files: |
|
||||
*.zip
|
||||
*.tar.gz
|
||||
SHA256SUMS.txt
|
||||
tag_name: ${{ needs.semantic-release.outputs.version }}
|
||||
draft: true
|
||||
prerelease: false
|
||||
fail_on_unmatched_files: true
|
||||
generate_release_notes: true
|
||||
97
.github/workflows/test.yml
vendored
Normal file
97
.github/workflows/test.yml
vendored
Normal file
@@ -0,0 +1,97 @@
|
||||
name: 010-Test
|
||||
|
||||
on:
|
||||
push:
|
||||
paths-ignore:
|
||||
- 'doc/**'
|
||||
- '*.md'
|
||||
branches:
|
||||
- master
|
||||
- release/**
|
||||
|
||||
pull_request:
|
||||
paths-ignore:
|
||||
- 'doc/**'
|
||||
- '*.md'
|
||||
branches:
|
||||
- master
|
||||
- release/**
|
||||
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.ref_name }}
|
||||
cancel-in-progress: true
|
||||
|
||||
jobs:
|
||||
|
||||
# reuse:
|
||||
# name: 🚨 REUSE Compliance
|
||||
# runs-on: ubuntu-latest
|
||||
# steps:
|
||||
# - uses: actions/checkout@v4
|
||||
# - uses: fsfe/reuse-action@v1
|
||||
|
||||
c-lint:
|
||||
name: 🚨 C lint
|
||||
runs-on: ubuntu-latest
|
||||
if: "!contains(github.event.pull_request.labels.*.name, 'skip-lint')"
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: reviewdog/action-cpplint@master
|
||||
env:
|
||||
REVIEWDOG_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
with:
|
||||
github_token: ${{ secrets.GITHUB_TOKEN }}
|
||||
reporter: github-pr-check
|
||||
targets: --recursive src
|
||||
level: warning
|
||||
flags: --linelength=120 # Optional
|
||||
filter: "-readability/braces\
|
||||
,-readability/casting\
|
||||
,-readability/todo\
|
||||
,-whitespace/comma\
|
||||
,-whitespace/braces\
|
||||
,-whitespace/comments\
|
||||
,-whitespace/indent\
|
||||
,-whitespace/newline\
|
||||
,-whitespace/operators\
|
||||
,-whitespace/parens\
|
||||
,-whitespace/tab\
|
||||
,-whitespace/end_of_line\
|
||||
,-whitespace/line_length\
|
||||
,-whitespace/blank_line\
|
||||
,-whitespace/semicolon\
|
||||
,-build/include_subdir\
|
||||
,-build/include_order\
|
||||
,-build/header_guard\
|
||||
"
|
||||
|
||||
test-suite:
|
||||
name: 🔬 test
|
||||
needs: [c-lint]
|
||||
if: "!contains(github.event.pull_request.labels.*.name, 'skip-test')"
|
||||
strategy:
|
||||
matrix:
|
||||
compiler: [clang-14]
|
||||
fail-fast: false
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- name: install dependencies
|
||||
run: |
|
||||
sudo apt-get update -qy
|
||||
sudo apt-get install --no-install-recommends -y ${{ matrix.compiler }} cmake ninja-build libfreetype-dev libopencv-dev libcairo2-dev libgavl-dev
|
||||
- name: ${{ matrix.compiler }} initialize cmake build
|
||||
run: |
|
||||
mkdir -p build && cd build
|
||||
cmake -G "Ninja" ../
|
||||
- name: ${{ matrix.compiler }} run ninja build
|
||||
run: |
|
||||
cd build && ninja
|
||||
- name: ${{ matrix.compiler }} analyze plugins
|
||||
run: |
|
||||
cd test && make
|
||||
- name: ${{ matrix.compiler }} upload plugin analysis
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: release-plugin-analysis
|
||||
path: test/*.json
|
||||
7
.gitignore
vendored
7
.gitignore
vendored
@@ -1,3 +1,5 @@
|
||||
.envrc
|
||||
gallery
|
||||
aclocal.m4
|
||||
autom4te.cache
|
||||
config.h
|
||||
@@ -33,3 +35,8 @@ TAGS
|
||||
ylwrap
|
||||
frei0r.pc
|
||||
doc/html
|
||||
/build/
|
||||
/out/
|
||||
/.vs/
|
||||
CMakeSettings.json
|
||||
.vscode
|
||||
|
||||
9
.releaserc
Normal file
9
.releaserc
Normal file
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"repositoryUrl": "git@github.com:dyne/frei0r.git",
|
||||
"dryRun": false,
|
||||
"plugins": [
|
||||
"@semantic-release/changelog",
|
||||
"@semantic-release/commit-analyzer",
|
||||
"@semantic-release/release-notes-generator"
|
||||
]
|
||||
}
|
||||
@@ -1,36 +1,41 @@
|
||||
# Frei0r developers union
|
||||
|
||||
Project initiated at the Piksel Festival in 2004
|
||||
hosted by BEK - Bergen Senter for Elektronisk Kunst
|
||||
Maintained at the Dyne.org Foundation
|
||||
Read here an account of [Frei0r's project history](https://medium.com/think-do-tank/frei0r-the-free-and-open-source-video-effect-preservation-project-604134dde8b3).
|
||||
|
||||
Developers who contributed, in alphabetic order:
|
||||
Frei0r is a Dyne.org project maintained by Denis "Jaromil" Roio and Dan Dennedy.
|
||||
|
||||
## Developers who contributed, in alphabetic order:
|
||||
|
||||
Akito Iwakura
|
||||
Albert Frisch
|
||||
Ajrat Makhmutov
|
||||
Brendan Hack
|
||||
Brian Matherly
|
||||
Burkhard Plaum
|
||||
Carlo E. Prelz
|
||||
Christoph Willing
|
||||
Dan Dennedy
|
||||
Denis Roio (Jaromil)
|
||||
Cynthia
|
||||
Erik Beck
|
||||
Esmane
|
||||
Filippo Giunchedi
|
||||
Gabriel Finch (Salsaman)
|
||||
Georg Seidel
|
||||
Henner Zeller
|
||||
Hedde Bosman
|
||||
IOhannes M. Zmölnig
|
||||
IOhannes m. zmölnig
|
||||
Janne Liljeblad
|
||||
Jean-Baptiste Mardelle
|
||||
Jean-François Fortin Tam
|
||||
Jean-Sebastien Senecal
|
||||
Jerome Blanchi (d.j.a.y)
|
||||
Johann Jeg
|
||||
Joshua M. Doe
|
||||
Luca Bigliardi
|
||||
Maksim Golovkin (Максим Головкин)
|
||||
Marko Cebokli
|
||||
Martin Bayer
|
||||
Mathieu Guindon
|
||||
Matthias Schnoell
|
||||
Matthias Schnöll
|
||||
Nicolas Carion
|
||||
Niels Elburg
|
||||
Phillip Promesberger
|
||||
@@ -47,4 +52,5 @@ Steinar H. Gunderson
|
||||
Thomas Coldrick
|
||||
Thomas Perl
|
||||
Till Theato
|
||||
Vadim Druzhin
|
||||
Vincent Pinon
|
||||
26
BUILD.md
Normal file
26
BUILD.md
Normal file
@@ -0,0 +1,26 @@
|
||||
# Build instructions
|
||||
|
||||
Frei0r can be built using CMake.
|
||||
|
||||
The presence of optional libraries on the system will trigger compilation of extra plugins. These libraries are:
|
||||
|
||||
+ [Gavl](http://gmerlin.sourceforge.net) required for scale0tilt and vectorscope filters
|
||||
|
||||
+ [OpenCV](http://opencvlibrary.sourceforge.net) required for facebl0r filter
|
||||
|
||||
+ [Cairo](http://cairographics.org) required for cairo- filters and mixers
|
||||
|
||||
It is recommended to use a separate `build` sub-folder.
|
||||
|
||||
```
|
||||
mkdir -p build
|
||||
cd build && cmake ../
|
||||
make
|
||||
```
|
||||
|
||||
Also ninja and nmake are supported through cmake:
|
||||
```
|
||||
cmake -G 'Ninja' ../
|
||||
cmake -G 'NMake Makefiles' ../
|
||||
```
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
cmake_minimum_required (VERSION 2.8)
|
||||
include(GNUInstallDirs)
|
||||
cmake_minimum_required (VERSION 3.12...3.31)
|
||||
|
||||
list (APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/modules)
|
||||
|
||||
project (frei0r)
|
||||
set (VERSION 1.6.1)
|
||||
set (VERSION 1.8)
|
||||
|
||||
include(GNUInstallDirs)
|
||||
|
||||
option (WITHOUT_OPENCV "Disable plugins dependent upon OpenCV" OFF)
|
||||
if (NOT WITHOUT_OPENCV)
|
||||
@@ -21,10 +22,6 @@ endif ()
|
||||
|
||||
include_directories (AFTER include)
|
||||
|
||||
if (MSVC)
|
||||
include_directories (include/msvc)
|
||||
endif (MSVC)
|
||||
|
||||
if (NOT CMAKE_BUILD_TYPE)
|
||||
set (CMAKE_BUILD_TYPE RelWithDebInfo CACHE STRING
|
||||
"Choose the type of build, options are: None Debug Release RelWithDebInfo MinSizeRel."
|
||||
@@ -38,10 +35,11 @@ set (FREI0R_1_1_DEF "${CMAKE_SOURCE_DIR}/msvc/frei0r_1_1.def")
|
||||
# --- custom targets: ---
|
||||
INCLUDE( cmake/modules/TargetDistclean.cmake OPTIONAL)
|
||||
|
||||
# See this thread for a ridiculous discussion about the simple question how to install a header file with CMake: http://www.cmake.org/pipermail/cmake/2009-October/032874.html
|
||||
install (DIRECTORY include DESTINATION . FILES_MATCHING PATTERN "frei0r.h" PATTERN "msvc" EXCLUDE)
|
||||
install(DIRECTORY ${CMAKE_SOURCE_DIR}/include/ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
|
||||
|
||||
# For code documentation run: doxygen doc/Doxyfile
|
||||
# add_subdirectory (doc)
|
||||
|
||||
add_subdirectory (doc)
|
||||
add_subdirectory (src)
|
||||
|
||||
# Generate frei0r.pc and install it.
|
||||
|
||||
27
ChangeLog
27
ChangeLog
@@ -1,4 +1,31 @@
|
||||
OLD, NOT UPDATED ANYMORE
|
||||
|
||||
*** See also the Changes @section in include/frei0r.h or git log
|
||||
** See also the Release section on https://github.com/dyne/frei0r/releases
|
||||
* Usernames prefixed by '@' and issues prefixed by '#' refer to github/dyne/frei0r
|
||||
|
||||
1.8 - 27 March 2021
|
||||
|
||||
What's Changed:
|
||||
Consolidated opencv4 support by @kwizart in #101
|
||||
spelling fixes by @umlaeute in #98
|
||||
Fix build warning in 64 bit Windows by @gbendy in #107
|
||||
using the void keyword in function declaration by @mypopydev in #104
|
||||
Add FX aech0r . Aim to simulate an analog video echo. by @d-j-a-y in #73
|
||||
Fix build for opencv4 by @mingwandroid in #112
|
||||
Support MSYS2/mingw-w64 by @mingwandroid in #113
|
||||
Fill uninitialized gaps between grid images by @bmatherly in #118
|
||||
Avoid destructing alpha channel. by @andre-caldas in #119
|
||||
pixeliz0r: Limit the blocksize to a minimum of 1 pixel by @rrrapha in #120
|
||||
edgeglow: Fix hsl to rgb conversion by @rrrapha in #121
|
||||
|
||||
New Contributors:
|
||||
@kwizart made their first contribution in #101
|
||||
@gbendy made their first contribution in #107
|
||||
@mypopydev made their first contribution in #104
|
||||
@mingwandroid made their first contribution in #112
|
||||
@bmatherly made their first contribution in #118
|
||||
@andre-caldas made their first contribution in #119
|
||||
|
||||
1.7 - 6 December 2019
|
||||
|
||||
|
||||
10
Dockerfile
10
Dockerfile
@@ -1,10 +0,0 @@
|
||||
from dyne/devuan:beowulf
|
||||
maintainer jaromil "https://github.com/jaromil"
|
||||
|
||||
run echo "deb-src http://deb.devuan.org/merged beowulf main" > /etc/apt/sources.list
|
||||
run echo "deb http://deb.devuan.org/merged beowulf main" >> /etc/apt/sources.list
|
||||
run apt-get -qq update
|
||||
run apt-get build-dep -yy frei0r-plugins
|
||||
run apt-get -yy install cmake
|
||||
copy . .
|
||||
|
||||
44
INSTALL.md
44
INSTALL.md
@@ -1,44 +0,0 @@
|
||||
# Installation Instructions
|
||||
|
||||
Frei0r can be built using either Autoconf or CMake.
|
||||
|
||||
The choice is open, CMake is mandatory only on Windowz.
|
||||
|
||||
The presence of optional libraries on the system will trigger compilation
|
||||
of extra plugins. These libraries are:
|
||||
|
||||
+ [Gavl](http://gmerlin.sourceforge.net) required for scale0tilt and vectorscope filters
|
||||
|
||||
+ [OpenCV](http://opencvlibrary.sourceforge.net) required for facebl0r filter
|
||||
|
||||
+ [Cairo](http://cairographics.org) required for cairo- filters and mixers
|
||||
|
||||
## Autoconf build
|
||||
|
||||
```
|
||||
./configure
|
||||
make
|
||||
```
|
||||
|
||||
## CMake build
|
||||
|
||||
```
|
||||
cmake .
|
||||
make
|
||||
```
|
||||
|
||||
## Proceed with install
|
||||
|
||||
Default prefix is `/usr/local`, target directory is `frei0r-1`
|
||||
|
||||
A default `make install` as root will put the plugins into `/usr/local/lib/frei0r-1` unless the prefix path is specified. Most applications will look into that directory on GNU/Linux, or it should be possible to configure where to look for frei0r plugins.
|
||||
|
||||
When using Apple/OSX, the `dlopen()` mechanism (in FFMpeg for instance) will look for `.dylib` extensions and not the `.so` that frei0r plugins have by default. To fix this problem one can rename the plugins simply so:
|
||||
|
||||
```
|
||||
for file in /usr/local/lib/frei0r-1/*.so ; do
|
||||
cp $file "${file%.*}.dylib"
|
||||
done
|
||||
```
|
||||
|
||||
|
||||
19
Makefile.am
19
Makefile.am
@@ -1,19 +0,0 @@
|
||||
# Copyright (C) 2007 Richard Spindler <richard.spindler AT gmail.com>
|
||||
#
|
||||
# This file is free software; as a special exception the author gives
|
||||
# unlimited permission to copy and/or distribute it, with or without
|
||||
# modifications, as long as this notice is preserved.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful, but
|
||||
# WITHOUT ANY WARRANTY, to the extent permitted by law; without even the
|
||||
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
ACLOCAL_AMFLAGS= -I m4
|
||||
|
||||
SUBDIRS=src include
|
||||
|
||||
pkgconfigdir = $(libdir)/pkgconfig
|
||||
pkgconfig_DATA = frei0r.pc
|
||||
|
||||
docsdir = ${prefix}/share/doc/${PACKAGE}
|
||||
docs_DATA = README.md ChangeLog TODO AUTHORS
|
||||
152
README.md
152
README.md
@@ -1,134 +1,93 @@
|
||||
```
|
||||
___________ ._________
|
||||
\_ _____/______ ____ |__\ _ \_______
|
||||
| __) \_ __ \_/ __ \| / /_\ \_ __ \
|
||||
| \ | | \/\ ___/| \ \_/ \ | \/
|
||||
\___ / |__| \___ >__|\_____ /__|
|
||||
\/ \/ \/
|
||||
[](https://frei0r.dyne.org)
|
||||
|
||||
```
|
||||
<img src="https://files.dyne.org/software_by_dyne.png" width="300">
|
||||
|
||||
*Minimalistic plugin API for video effects, by the Piksel Developers Union*
|
||||
[](https://github.com/dyne/frei0r/actions/workflows/test.yml)
|
||||
[](https://github.com/dyne/frei0r/actions/workflows/release.yml)
|
||||
|
||||
Updated info on https://frei0r.dyne.org
|
||||
|
||||
[](http://www.dyne.org)
|
||||
|
||||
[](https://travis-ci.org/dyne/frei0r)
|
||||
|
||||
# What frei0r is
|
||||
|
||||
Frei0r is a minimalistic plugin API for video effects.
|
||||
The frei0r project is a collection of free and open source video effects plugins that can be used with a variety of video editing and processing software.
|
||||
|
||||
The main emphasis is on simplicity for an API that will round up the
|
||||
most common video effects into simple filters, sources and mixers that
|
||||
can be controlled by parameters.
|
||||
[For an extensive introduction to frei0r please read this story.](https://jaromil.medium.com/frei0r-the-free-and-open-source-video-effect-preservation-project-604134dde8b3?source=friends_link&sk=c83a054b979d421279f5fc3d2ea1acd8)
|
||||
|
||||
The frei0r project welcomes contributions by people who are passionate about video effects, its collection consists of more than 100 plugins made to work on any target platform (GNU/Linux, Apple/OSX and MS/Win) without the need for special video hardware. These plugins can be used to add a wide range of effects to video, such as color correction, blurring, and distortion.
|
||||
|
||||
The frei0r project is a great resource for anyone interested in algorithms for video transformation and effects, as it provides a wide range of open source formulas available for free and can be easily integrated into a variety of software.
|
||||
|
||||
It's our hope that this way these simple effects can be shared between
|
||||
many applications, avoiding their reimplementation by different
|
||||
projects.
|
||||
|
||||
## What frei0r is not
|
||||
|
||||
Frei0r is not meant as a competing standard to more ambitious efforts
|
||||
that try to satisfy the needs of many different applications and more
|
||||
complex effects.
|
||||
Frei0r itself is just a C/C++ header and a collection of small programs using it to accept an input frame, change it in any possible way and return an output frame.
|
||||
|
||||
It is not meant as a generic API for all kinds of video applications,
|
||||
as it doesn't provides things like an extensive parameter mechanism or
|
||||
event handling.
|
||||
It is not meant as a generic API for all kinds of video applications, as it doesn't provides things like an extensive parameter mechanism or event handling.
|
||||
|
||||
Eventually the frei0r API can be wrapped by higher level APIs
|
||||
expanding its functionalities
|
||||
(for instance as GStreamer, MLT, FFmpeg and others do).
|
||||
Eventually the frei0r API can be wrapped by higher level APIs expanding its functionalities, for instance GStreamer, MLT, FFmpeg and Pure Data do.
|
||||
|
||||
## Current status
|
||||
## Links
|
||||
|
||||
Developers are sporadically contributing and we are happy if more
|
||||
people like to get involved, so let us know about your creations! Code
|
||||
and patches are well accepted, get in touch with us on the
|
||||
mailinglist (see the section Communication below).
|
||||
Wikipedia page about frei0r: https://en.wikipedia.org/wiki/Frei0r
|
||||
|
||||
Some applications using frei0r, sorted in order of most recent activity
|
||||
|
||||
## History
|
||||
|
||||
Frei0r has been around since 2004, born from yearly brainstormings
|
||||
held at the Piksel conference with the participation of various free
|
||||
and open source video software developers.
|
||||
|
||||
It works on all hardware platforms without the need for any particular
|
||||
hardware acceleration (GNU/Linux, Apple/OSX and MS/Win) and consists
|
||||
of more than 100 plugins. Among the free and open source video
|
||||
application supporting frei0r are: KDEnLive, FFmpeg, MLT, PureData,
|
||||
Open Movie Editor, DVEdit, Gephex, LiVES, FreeJ, VeeJay, Flowblade, and
|
||||
Shotcut among the others.
|
||||
|
||||
Wikipedia page about frei0r: http://en.wikipedia.org/wiki/Frei0r
|
||||
|
||||
|
||||
[Piksel]: http://www.piksel.no
|
||||
[PureData]: http://www.artefacte.org/pd/
|
||||
[Open Movie Editor]: http://openmovieeditor.sourceforge.net/
|
||||
[DVEdit]: http://www.freenet.org.nz/dvedit
|
||||
[Gephex]: http://www.gephex.org/
|
||||
[LiVES]: http://lives.sf.net
|
||||
[FreeJ]: http://freej.dyne.org
|
||||
[MøB]: http://mob.bek.no/
|
||||
[VeeJay]: http://veejayhq.net
|
||||
[MLT]: http://www.mltframework.org/
|
||||
[KDEnLive]: http://www.kdenlive.org/
|
||||
[Flowblade]: http://code.google.com/p/flowblade/
|
||||
[Shotcut]: https://www.shotcut.org/
|
||||
- [MLT](https://www.mltframework.org/)
|
||||
- [LiquidSoap](https://www.liquidsoap.info/)
|
||||
- [KDEnLive](https://www.kdenlive.org/)
|
||||
- [Shotcut](https://www.shotcut.org/)
|
||||
- [FFMpeg](https://ffmpeg.org)
|
||||
- [PureData](https://puredata.info/)
|
||||
- [Open Movie Editor](http://www.openmovieeditor.org/)
|
||||
- [Gephex](https://gephex.org/)
|
||||
- [LiVES](http://lives.sf.net)
|
||||
- [FreeJ](https://freej.dyne.org)
|
||||
- [VeeJay](http://veejayhq.net)
|
||||
- [Flowblade](https://jliljebl.github.io/flowblade/)
|
||||
|
||||
|
||||
# Downloads
|
||||
|
||||
## Source code
|
||||
Stable frei0r releases are built automatically and made available on
|
||||
|
||||
Stable frei0r releases are packaged periodically and distributed on
|
||||
|
||||
https://files.dyne.org/frei0r
|
||||
## https://github.com/dyne/frei0r/releases
|
||||
|
||||
Frei0r sourcecode is released under the terms of the GNU General Public License and, eventually other compatible Free Software licenses.
|
||||
|
||||
The latest source for frei0r plugins can be attained using git on https://github.com/dyne/frei0r
|
||||
|
||||
Make sure to get in touch with our mailinglist if you like to contribute.
|
||||
|
||||
## Build dependencies
|
||||
|
||||
Frei0r can be built on GNU/Linux, M$/Windows and Apple/OSX platforms, possibly in even more environments like embedded devices.
|
||||
|
||||
For details see the [INSTALL](/INSTALL.md) file.
|
||||
For details see the [BUILD](/BUILD.md) file.
|
||||
|
||||
### MS / Windows
|
||||
|
||||
We distribute official builds of frei0r plugins as .dll for the Win64 platform from the releases page.
|
||||
|
||||
### BSD
|
||||
|
||||
Ports of frei0r are included in all major BSD distros:
|
||||
- FreeBSD https://www.freshports.org/graphics/frei0r
|
||||
- OpenBSD
|
||||
- NetBSD https://pkgsrc.se/multimedia/frei0r
|
||||
|
||||
### GNU / Linux
|
||||
|
||||
Binary packages are mantained on various distributions, but they may not be completely up to date with latest release.
|
||||
Binary packages are maintained on various distributions, but they may not be completely up to date with the latest release.
|
||||
|
||||
- [frei0r*](https://repology.org/project/frei0r/versions)
|
||||
- [frei0r-plugins*](https://repology.org/project/frei0r-plugins/versions)
|
||||
- [ocaml:frei0r*](https://repology.org/project/ocaml:frei0r/versions)
|
||||
|
||||
### Apple / OSX
|
||||
|
||||
MacPorts provides packages for OSX:
|
||||
[MacPorts]: http://www.macports.org
|
||||
$ sudo port install frei0r-plugins
|
||||
|
||||
Pre-compiled binaries are also uploaded on our website.
|
||||
|
||||
We encourage Apple/OSX application distributors to compile the plugins
|
||||
directly and to include frei0r within their bundle.
|
||||
|
||||
|
||||
|
||||
### Microsoft / Windows
|
||||
|
||||
Pre-compiled binaries are often provided by third-parties, but they may not to be up to date.
|
||||
|
||||
We encourage MS/Win application distributors to compile the plugins directly and to include frei0r within their bundle.
|
||||
A [frei0r Brew formula](https://formulae.brew.sh/formula/frei0r) is available.
|
||||
|
||||
Official builds of frei0r plugins as .dlsym for the Apple/OSX platform will be soon included in the releases page.
|
||||
|
||||
# Documentation
|
||||
|
||||
|
||||
If you are new to frei0r (but not to programming) the best thing is probably to have a look at the [frei0r header](/include/frei0r.h), which is quite simple and well documented. The [doxyfied documentation](http://frei0r.dyne.org/codedoc/html) is also available for browsing on-line.
|
||||
If you are new to frei0r (but not to programming) the best thing is probably to have a look at the [frei0r header](/include/frei0r.h), which is quite simple and well documented. The [doxyfied documentation](https://frei0r.dyne.org/codedoc/html) is also available for browsing online.
|
||||
|
||||
|
||||
## C++ Filter example
|
||||
@@ -179,14 +138,17 @@ A simple skeleton for a frei0r video filter looks like this:
|
||||
"Who did it", 1, 0);
|
||||
```
|
||||
|
||||
## Join us
|
||||
|
||||
## Communication
|
||||
To contribute your plugin please open a [pull request](https://github.com/dyne/frei0r/pulls).
|
||||
|
||||
You can get in touch with our developer community, send your new effects and share your intentions with us.
|
||||
For bug reporting please use our [issue tracker](https://github.com/dyne/frei0r/issues).
|
||||
|
||||
We have a free mailinglist open to [subscription](https://mailinglists.dyne.org/cgi-bin/mailman/listinfo/frei0r) and we provide [public archives](https://lists.dyne.org/lurker/list/frei0r.en.html) of the discussions there that are also searchable and indexed online.
|
||||
You can get in touch with some developers over various dyne.org chat channels, for instance
|
||||
|
||||
For bug reporting the mailinglist is preferred, but is also possible to use an [issue tracker](https://github.com/dyne/frei0r/issues).
|
||||
### https://t.me/frei0r
|
||||
|
||||
We also have an (old) mailing list open to [subscription](https://mailinglists.dyne.org/cgi-bin/mailman/listinfo/frei0r) and we provide [public archives](https://lists.dyne.org/lurker/list/frei0r.en.html) of discussions, searchable and indexed online.
|
||||
|
||||
## Acknowledgments
|
||||
|
||||
|
||||
112
TODO
112
TODO
@@ -1,112 +0,0 @@
|
||||
|
||||
Frei0r TODO
|
||||
~~~~~~~~~~~
|
||||
|
||||
Table of Contents
|
||||
=================
|
||||
Welcome hackers!
|
||||
Port existing code
|
||||
Bugfixes
|
||||
Test suite
|
||||
Null parameters
|
||||
Spec Update
|
||||
Documentation
|
||||
Screenshots
|
||||
Trac spam
|
||||
|
||||
|
||||
Welcome hackers!
|
||||
~~~~~~~~~~~~~~~~~
|
||||
|
||||
The Frei0r mailinglist is the first step to get in touch with us: the
|
||||
one we use is [frei0r-devel] and it has [public archives] that are also
|
||||
[searchable and indexed] online.
|
||||
|
||||
The bugtracker we are currently using is [the Piksel trac], have a look
|
||||
there and, if you know how to report a bug, please open a new issue
|
||||
and give it as many details as you can.
|
||||
|
||||
Here below are outlined some open issues in the development flow, they
|
||||
range from /bugfixing/ tasks to /specification updates/ and
|
||||
/documentation/.
|
||||
|
||||
|
||||
[frei0r-devel]: https://piksel.no/mailman/listinfo/frei0r-devel
|
||||
[public archives]: http://piksel.no/pipermail/frei0r-devel/
|
||||
[searchable and indexed]: http://blog.gmane.org/gmane.comp.video.frei0r.devel
|
||||
[the Piksel trac]: http://www.piksel.no/projects/frei0r/report
|
||||
|
||||
Port existing code
|
||||
~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
Porting new Effects from existing collections should be easy, for
|
||||
instance there is a lot of code to be ported from [EffecTV], the [Demo Effects Collection], [Pete's plugins] and the XScreensavers… let us if
|
||||
you engage the task, it can be fun and not so difficult if you are
|
||||
just learning how to program in C or C++.
|
||||
|
||||
|
||||
[EffecTV]: http://effectv.sf.net/
|
||||
[Demo Effects Collection]: http://demo-effects.sourceforge.net/
|
||||
[Pete's plugins]: ftp://ftp.dyne.org/freej/plugins/petespluginslinux_070114.tar.gz
|
||||
|
||||
Bugfixes
|
||||
~~~~~~~~~
|
||||
|
||||
We should remove from installation any plugins which casuse a crash or
|
||||
data loss - and if we want them back we'd better fix them, in any case
|
||||
we can't allow distribution of plugins that can potentially crash the
|
||||
host.
|
||||
|
||||
This is an old issue with dynamically loaded objects: if they crash,
|
||||
they'll crash the host application loading them! one reason why JWZ
|
||||
made XScreensavers share an X11 /back-display/...
|
||||
|
||||
TODO Test suite
|
||||
================
|
||||
|
||||
Develop a test suite for frei0r plugins (/scaffolding/ technique)
|
||||
which can be run to generate reports on reliability.
|
||||
|
||||
TODO Null parameters
|
||||
=====================
|
||||
|
||||
Fix plugins which do not set parameters to a default value inside
|
||||
*f0r_init()* - this crashes some applications as often reported in
|
||||
bugreports.
|
||||
|
||||
Spec Update
|
||||
~~~~~~~~~~~~
|
||||
|
||||
We sometimes need to review the Frei0r specification and confront it
|
||||
with new issues coming up. It might be also useful to confront it with
|
||||
the specification drafted in [LiViDO], which provides a broader
|
||||
case-study, and other standards adopted in [GStreamer].
|
||||
|
||||
|
||||
[LiViDO]: http://livido.dyne.org/codedoc/
|
||||
[GStreamer]: http://gstreamer.freedesktop.org/documentation/
|
||||
|
||||
Documentation
|
||||
~~~~~~~~~~~~~~
|
||||
|
||||
Screenshots
|
||||
============
|
||||
|
||||
A Gallery of filters is already being generated, but not yet complete
|
||||
with screenshots. Right now [FreeJ] is being used with scripts to parse
|
||||
plugin contents and render them into a webpage, still what are missing
|
||||
are screenshots or maybe short video renderings of plugins in action.
|
||||
|
||||
|
||||
[FreeJ]: http://freej.dyne.org
|
||||
|
||||
TODO Trac spam
|
||||
===============
|
||||
|
||||
We should fix the trac on piksel.org, install a new bugtracker like
|
||||
[flyspray] or use the mantis already up at [bugs.dyne.org].
|
||||
|
||||
|
||||
[flyspray]: http://flyspray.org
|
||||
[bugs.dyne.org]: http://bugs.dyne.org
|
||||
|
||||
79
autogen.sh
79
autogen.sh
@@ -1,79 +0,0 @@
|
||||
#!/bin/sh
|
||||
# Run this to set up the build system: configure, makefiles, etc.
|
||||
# (based on the version in enlightenment's cvs)
|
||||
#
|
||||
|
||||
package="frei0r"
|
||||
|
||||
olddir=`pwd`
|
||||
srcdir=`dirname $0`
|
||||
|
||||
AUTOHEADER=autoheader
|
||||
if [ "`uname -s`" = "Darwin" ]; then
|
||||
LIBTOOLIZE=glibtoolize
|
||||
ACLOCAL=aclocal
|
||||
AUTOMAKE=automake
|
||||
else
|
||||
LIBTOOLIZE=libtoolize
|
||||
ACLOCAL=aclocal
|
||||
AUTOMAKE=automake
|
||||
fi
|
||||
AUTOCONF=autoconf
|
||||
|
||||
test -z "$srcdir" && srcdir=.
|
||||
|
||||
cd "$srcdir"
|
||||
DIE=0
|
||||
|
||||
($AUTOCONF --version) < /dev/null > /dev/null 2>&1 || {
|
||||
echo
|
||||
echo "You must have autoconf installed to compile $package."
|
||||
echo "Download the appropriate package for your distribution,"
|
||||
echo "or get the source tarball at ftp://ftp.gnu.org/pub/gnu/"
|
||||
DIE=1
|
||||
}
|
||||
|
||||
($AUTOMAKE --version) < /dev/null > /dev/null 2>&1 || {
|
||||
echo
|
||||
echo "You must have automake installed to compile $package."
|
||||
echo "Download the appropriate package for your system,"
|
||||
echo "or get the source from one of the GNU ftp sites"
|
||||
echo "listed in http://www.gnu.org/order/ftp.html"
|
||||
DIE=1
|
||||
}
|
||||
|
||||
($LIBTOOLIZE --version) < /dev/null > /dev/null 2>&1 || {
|
||||
echo
|
||||
echo "You must have libtool installed to compile $package."
|
||||
echo "Download the appropriate package for your system,"
|
||||
echo "or get the source from one of the GNU ftp sites"
|
||||
echo "listed in http://www.gnu.org/order/ftp.html"
|
||||
DIE=1
|
||||
}
|
||||
|
||||
if test "$DIE" -eq 1; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# if test -z "$*"; then
|
||||
# echo "I am going to run ./configure with no arguments - if you wish "
|
||||
# echo "to pass any to it, please specify them on the $0 command line."
|
||||
# fi
|
||||
|
||||
echo "Generating configuration files for $package, please wait...."
|
||||
|
||||
echo " $ACLOCAL"
|
||||
mkdir -p m4
|
||||
$ACLOCAL || exit -1
|
||||
echo " $AUTOHEADER"
|
||||
$AUTOHEADER || exit -1
|
||||
echo " $LIBTOOLIZE --automake -c"
|
||||
$LIBTOOLIZE --automake -c || exit -1
|
||||
echo " $AUTOMAKE --add-missing -c"
|
||||
$AUTOMAKE --add-missing -c || exit -1
|
||||
echo " $AUTOCONF"
|
||||
$AUTOCONF || exit -1
|
||||
|
||||
echo "Now you can run $srcdir/configure"
|
||||
|
||||
cd $olddir
|
||||
@@ -79,12 +79,6 @@ endmacro (libfind_process)
|
||||
|
||||
macro(libfind_library PREFIX basename)
|
||||
set(TMP "")
|
||||
if(MSVC80)
|
||||
set(TMP -vc80)
|
||||
endif(MSVC80)
|
||||
if(MSVC90)
|
||||
set(TMP -vc90)
|
||||
endif(MSVC90)
|
||||
set(${PREFIX}_LIBNAMES ${basename}${TMP})
|
||||
if(${ARGC} GREATER 2)
|
||||
set(${PREFIX}_LIBNAMES ${basename}${TMP}-${ARGV2})
|
||||
|
||||
@@ -3,9 +3,11 @@
|
||||
# Jan Woetzel 04/2003
|
||||
#
|
||||
|
||||
IF (UNIX)
|
||||
ADD_CUSTOM_TARGET (distclean @echo cleaning for source distribution)
|
||||
SET(DISTCLEANED
|
||||
if(UNIX)
|
||||
add_custom_target(distclean
|
||||
COMMENT "cleaning for source distribution"
|
||||
)
|
||||
set(DISTCLEANED
|
||||
cmake.depends
|
||||
cmake.check_depends
|
||||
CMakeCache.txt
|
||||
@@ -16,13 +18,18 @@ IF (UNIX)
|
||||
gmon.out
|
||||
*~
|
||||
)
|
||||
|
||||
ADD_CUSTOM_COMMAND(
|
||||
DEPENDS clean
|
||||
add_custom_command(
|
||||
POST_BUILD
|
||||
COMMENT "running target clean"
|
||||
TARGET distclean
|
||||
COMMAND ${CMAKE_COMMAND} --build ${CMAKE_BINARY_DIR} --target clean
|
||||
)
|
||||
add_custom_command(
|
||||
POST_BUILD
|
||||
COMMENT "distribution clean"
|
||||
COMMAND rm
|
||||
ARGS -Rf CMakeTmp ${DISTCLEANED}
|
||||
TARGET distclean
|
||||
)
|
||||
ENDIF(UNIX)
|
||||
endif(UNIX)
|
||||
|
||||
|
||||
170
configure.ac
170
configure.ac
@@ -1,170 +0,0 @@
|
||||
# -*- Autoconf -*-
|
||||
# Process this file with autoconf to produce a configure script.
|
||||
|
||||
AC_PREREQ(2.59c)
|
||||
AC_INIT(frei0r-plugins, [1.6.1], [frei0r-devel@dyne.org])
|
||||
AC_CONFIG_MACRO_DIR([m4])
|
||||
|
||||
AM_INIT_AUTOMAKE([foreign subdir-objects])
|
||||
|
||||
# Checks for programs.
|
||||
AC_PROG_CXX
|
||||
AC_PROG_CC
|
||||
AC_PROG_CC_C99
|
||||
LT_INIT([disable-static])
|
||||
|
||||
|
||||
AC_CONFIG_HEADERS([include/config.h])
|
||||
|
||||
if test "x${prefix}" = "xNONE"; then
|
||||
prefix=${ac_default_prefix}
|
||||
fi
|
||||
PACKAGE_LIB_DIR="${prefix}/lib/frei0r-1"
|
||||
AC_SUBST(PACKAGE_LIB_DIR)
|
||||
PACKAGE_DATA_DIR="${prefix}/share/frei0r-1"
|
||||
AC_SUBST(PACKAGE_DATA_DIR)
|
||||
|
||||
AC_MSG_CHECKING([host platform])
|
||||
case $host_os in
|
||||
*linux*)
|
||||
AC_MSG_RESULT([Linux])
|
||||
have_linux=yes
|
||||
;;
|
||||
*freebsd*)
|
||||
AC_MSG_RESULT([FreeBSD])
|
||||
have_freebsd=yes
|
||||
;;
|
||||
*darwin*)
|
||||
AC_MSG_RESULT([Darwin/OSX])
|
||||
have_darwin=yes
|
||||
;;
|
||||
*)
|
||||
AC_MSG_RESULT([ $host_os ? ... let us try])
|
||||
;;
|
||||
esac
|
||||
|
||||
AC_ARG_ENABLE(cpuflags,
|
||||
[ --enable-cpuflags compile with advanced cpu instructions (yes)],
|
||||
[
|
||||
if test ! x$enableval = xyes; then
|
||||
have_cpuflags=no
|
||||
else
|
||||
have_cpuflags=yes;
|
||||
fi ],[ have_cpuflags=yes ])
|
||||
|
||||
if test x$have_cpuflags = xyes; then
|
||||
if test x$have_linux = xyes; then
|
||||
CPUFLAGS=`cat /proc/cpuinfo | grep flags`
|
||||
if grep "^flags.* mmx" /proc/cpuinfo > /dev/null; then
|
||||
have_mmx=yes
|
||||
AC_DEFINE(HAVE_MMX,1,[define if enabling MMX acceleration])
|
||||
fi
|
||||
if grep "^flags.* sse" /proc/cpuinfo > /dev/null; then
|
||||
have_sse=yes
|
||||
AC_DEFINE(HAVE_SSE,1,[define if enabling SSE acceleration])
|
||||
fi
|
||||
if grep "^flags.* sse2" /proc/cpuinfo > /dev/null; then
|
||||
have_sse=yes
|
||||
AC_DEFINE(HAVE_SSE2,1,[define if enabling SSE2 acceleration])
|
||||
fi
|
||||
if grep "^flags.* ssse3" /proc/cpuinfo > /dev/null; then
|
||||
have_ssse3=yes
|
||||
AC_DEFINE(HAVE_SSSE3,1,[define if enabling SSSE3 acceleration])
|
||||
fi
|
||||
fi
|
||||
if test x$have_freebsd = xyes; then
|
||||
if sysctl -n hw.instruction_sse; then
|
||||
have_mmx=yes
|
||||
AC_DEFINE(HAVE_MMX,1,[define if enabling MMX acceleration])
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
# Checks for header files.
|
||||
AC_HEADER_STDC
|
||||
AC_CHECK_HEADERS([float.h inttypes.h limits.h stdlib.h string.h])
|
||||
|
||||
# Checks for typedefs, structures, and compiler characteristics.
|
||||
AC_HEADER_STDBOOL
|
||||
AC_C_CONST
|
||||
AC_C_INLINE
|
||||
|
||||
# Checks for library functions.
|
||||
AC_FUNC_MALLOC
|
||||
AC_CHECK_FUNCS([floor memset pow sqrt])
|
||||
|
||||
HAVE_OPENCV=false
|
||||
PKG_CHECK_MODULES(OPENCV, opencv >= 1.0.0, [HAVE_OPENCV=true], [true])
|
||||
AM_CONDITIONAL([HAVE_OPENCV], [test x$HAVE_OPENCV = xtrue])
|
||||
if test x$HAVE_OPENCV = xtrue; then
|
||||
# OPENCV_CFLAGS="$OPENCV_CFLAGS -DOPENCV_PREFIX=`pkg-config opencv --variable=prefix`"
|
||||
AC_DEFINE(HAVE_OPENCV,1,[compiled including opencv])
|
||||
AC_DEFINE(OPENCV_DATA_DIR,[${prefix}/share/opencv],opencv data prefix)
|
||||
fi
|
||||
AC_SUBST(HAVE_OPENCV)
|
||||
|
||||
HAVE_GAVL=false
|
||||
PKG_CHECK_MODULES(GAVL, gavl >= 0.2.3, [HAVE_GAVL=true], [true])
|
||||
AM_CONDITIONAL([HAVE_GAVL], [test x$HAVE_GAVL = xtrue])
|
||||
|
||||
HAVE_CAIRO=false
|
||||
PKG_CHECK_MODULES(CAIRO, cairo >= 1.0.0, [HAVE_CAIRO=true], [true])
|
||||
AM_CONDITIONAL([HAVE_CAIRO], [test x$HAVE_CAIRO = xtrue])
|
||||
|
||||
AC_CHECK_PROG([DOXYGEN], [doxygen], [doxygen])
|
||||
|
||||
|
||||
AC_CONFIG_FILES([
|
||||
frei0r.pc
|
||||
Makefile
|
||||
include/Makefile
|
||||
src/Makefile
|
||||
doc/Makefile
|
||||
])
|
||||
|
||||
AC_OUTPUT
|
||||
|
||||
echo
|
||||
echo
|
||||
echo "Compile $PACKAGE $VERSION for ${host}"
|
||||
echo
|
||||
echo " - INSTALL prefix: $prefix"
|
||||
|
||||
if test x$have_cpuflags = xyes; then
|
||||
echo " - CPU optimization: YES"
|
||||
else
|
||||
echo " - CPU optimization: NO"
|
||||
fi
|
||||
|
||||
if test x$HAVE_OPENCV = xtrue; then
|
||||
echo " - opencv: YES"
|
||||
echo " data dir: $OPENCV_DATA_DIR"
|
||||
else
|
||||
echo " - opencv: NO"
|
||||
echo " opencv >= 1.0.0 not found - this program enables optional"
|
||||
echo " plugin with the Open Source Computer Vision library >= 1.0.0"
|
||||
echo " http://opencvlibrary.sourceforge.net/"
|
||||
fi
|
||||
|
||||
if test x$HAVE_GAVL = xtrue; then
|
||||
echo " - gavl: YES"
|
||||
else
|
||||
echo " - gavl: NO"
|
||||
echo " gavl >= 0.2.3 not found - this program enables optional"
|
||||
echo " plugin with the gmerlin audio video library >= 0.2.3"
|
||||
echo " http://gmerlin.sourceforge.net/"
|
||||
fi
|
||||
|
||||
if test x$HAVE_CAIRO = xtrue; then
|
||||
echo " - cairo: YES"
|
||||
else
|
||||
echo " - cairo: NO"
|
||||
echo " cairo >= 1.0.0 not found - this program enables optional"
|
||||
echo " plugin with the Cairo 2D vector graphics library >= 1.0.0"
|
||||
echo " http://www.cairographics.org/"
|
||||
fi
|
||||
|
||||
echo
|
||||
echo "Now you can run make."
|
||||
echo
|
||||
echo
|
||||
@@ -1,10 +0,0 @@
|
||||
find_package(Doxygen)
|
||||
if(DOXYGEN_FOUND)
|
||||
# configure_file(${CMAKE_CURRENT_SOURCE_DIR}/Doxyfile.in ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile @ONLY)
|
||||
add_custom_target(doc
|
||||
${DOXYGEN_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile
|
||||
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
|
||||
COMMENT "Generating API documentation with Doxygen" VERBATIM
|
||||
)
|
||||
endif(DOXYGEN_FOUND)
|
||||
|
||||
@@ -568,7 +568,7 @@ WARN_LOGFILE =
|
||||
# directories like "/usr/src/myproject". Separate the files or directories
|
||||
# with spaces.
|
||||
|
||||
INPUT = "../include/frei0r.h"
|
||||
INPUT = "include/frei0r.h"
|
||||
|
||||
# This tag can be used to specify the character encoding of the source files
|
||||
# that doxygen parses. Internally doxygen uses the UTF-8 encoding, which is
|
||||
|
||||
@@ -1,31 +0,0 @@
|
||||
# Copyright (C) 2007 Richard Spindler <richard.spindler AT gmail.com>
|
||||
#
|
||||
# This file is free software; as a special exception the author gives
|
||||
# unlimited permission to copy and/or distribute it, with or without
|
||||
# modifications, as long as this notice is preserved.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful, but
|
||||
# WITHOUT ANY WARRANTY, to the extent permitted by law; without even the
|
||||
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
html:
|
||||
$(DOXYGEN) Doxyfile
|
||||
|
||||
htmldocs_DATA = html
|
||||
|
||||
htmldocsdir=${prefix}/share/doc/${PACKAGE}
|
||||
|
||||
clean:
|
||||
rm -rf html
|
||||
|
||||
dist-hook:
|
||||
-cp -ra html $(distdir)/doc/
|
||||
|
||||
install-data:
|
||||
install -c -m 644 -d $(htmldocs_DATA) $(DESTDIR)$(htmldocsdir)
|
||||
|
||||
# Modify the install hook, so we can install directories
|
||||
install-htmldocsDATA:
|
||||
mkdir -p $(DESTDIR)$(htmldocsdir)
|
||||
cp -r ./html $(DESTDIR)$(htmldocsdir)/
|
||||
|
||||
@@ -1,12 +0,0 @@
|
||||
# Copyright (C) 2007 Richard Spindler <richard.spindler AT gmail.com>
|
||||
#
|
||||
# This file is free software; as a special exception the author gives
|
||||
# unlimited permission to copy and/or distribute it, with or without
|
||||
# modifications, as long as this notice is preserved.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful, but
|
||||
# WITHOUT ANY WARRANTY, to the extent permitted by law; without even the
|
||||
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
include_HEADERS = frei0r.h
|
||||
noinst_HEADERS = frei0r_colorspace.h frei0r.hpp frei0r_math.h
|
||||
@@ -23,7 +23,7 @@
|
||||
* @section sec_overview Overview
|
||||
*
|
||||
* If you are new to frei0r, the best thing is probably to have
|
||||
* a look at the <a href="frei0r_8h-source.html">frei0r header</a>,
|
||||
* a look at the <a href="frei0r_8h_source.html">frei0r header</a>,
|
||||
* which is quite simple.
|
||||
*
|
||||
* After that, you might want to look at the
|
||||
@@ -137,7 +137,7 @@
|
||||
* @subsection sec_icon_location Icon location
|
||||
*
|
||||
* The exact location where the application should look for the
|
||||
* plugin is platform dependant.
|
||||
* plugin is platform dependent.
|
||||
*
|
||||
* For Windows platforms, the icon should be at the same place as
|
||||
* the plugin containing the effect.
|
||||
@@ -190,7 +190,7 @@
|
||||
* - \ref f0r_update2
|
||||
*
|
||||
* If a thread is in one of these methods its allowed for another thread to
|
||||
* enter one of theses methods for a different effect instance. But for one
|
||||
* enter one of these methods for a different effect instance. But for one
|
||||
* effect instance only one thread is allowed to execute any of these methods.
|
||||
*/
|
||||
|
||||
@@ -227,13 +227,13 @@
|
||||
* f0r_init() is called once when the plugin is loaded by the application.
|
||||
* \see f0r_deinit
|
||||
*/
|
||||
int f0r_init();
|
||||
int f0r_init(void);
|
||||
|
||||
/**
|
||||
* f0r_deinit is called once when the plugin is unloaded by the application.
|
||||
* \see f0r_init
|
||||
*/
|
||||
void f0r_deinit();
|
||||
void f0r_deinit(void);
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
@@ -260,7 +260,7 @@ void f0r_deinit();
|
||||
* List of supported color models.
|
||||
*
|
||||
* Note: the color models are endian independent, because the
|
||||
* color components are defined by their positon in memory, not
|
||||
* color components are defined by their position in memory, not
|
||||
* by their significance in an uint32_t value.
|
||||
*
|
||||
* For effects that work on the color components,
|
||||
@@ -309,7 +309,7 @@ void f0r_deinit();
|
||||
|
||||
/**
|
||||
* In PACKED32, each pixel is represented by 4 consecutive
|
||||
* bytes, but it is not defined how the color componets are
|
||||
* bytes, but it is not defined how the color components are
|
||||
* stored. The true color format could be RGBA8888,
|
||||
* BGRA8888, a packed 32 bit YUV format, or any other
|
||||
* color format that stores pixels in 32 bit.
|
||||
|
||||
@@ -101,7 +101,7 @@ namespace frei0r
|
||||
{
|
||||
case F0R_PARAM_BOOL :
|
||||
*static_cast<f0r_param_bool*>(param)
|
||||
= *static_cast<f0r_param_bool*>(ptr) > 0.5 ? 1.0 : 0.0;
|
||||
= *static_cast<bool*>(ptr) ? 1.0 : 0.0;
|
||||
break;
|
||||
case F0R_PARAM_DOUBLE:
|
||||
*static_cast<f0r_param_double*>(param)
|
||||
@@ -292,7 +292,7 @@ void f0r_get_plugin_info(f0r_plugin_info_t* info)
|
||||
info->major_version = frei0r::s_version.first;
|
||||
info->minor_version = frei0r::s_version.second;
|
||||
info->explanation = frei0r::s_explanation.c_str();
|
||||
info->num_params = frei0r::s_params.size();
|
||||
info->num_params = static_cast<int>(frei0r::s_params.size());
|
||||
}
|
||||
|
||||
void f0r_get_param_info(f0r_param_info_t* info, int param_index)
|
||||
@@ -341,7 +341,7 @@ void f0r_update2(f0r_instance_t instance, double time,
|
||||
inframe3);
|
||||
}
|
||||
|
||||
// compability for frei0r 1.0
|
||||
// compatibility for frei0r 1.0
|
||||
void f0r_update(f0r_instance_t instance,
|
||||
double time, const uint32_t* inframe, uint32_t* outframe)
|
||||
{
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* frei0r_cairo.h
|
||||
* frei0r/cairo.h
|
||||
* Copyright 2012 Janne Liljeblad
|
||||
*
|
||||
* This file is part of Frei0r.
|
||||
@@ -22,7 +22,7 @@
|
||||
|
||||
#include <cairo.h>
|
||||
#include <string.h>
|
||||
#include "frei0r_math.h"
|
||||
#include "frei0r/math.h"
|
||||
|
||||
/**
|
||||
* String identifiers for gradient types available using Cairo.
|
||||
@@ -196,7 +196,7 @@ void freior_cairo_set_color_stop_rgba_LITTLE_ENDIAN(cairo_pattern_t *pat, double
|
||||
/**
|
||||
* frei0r_cairo_get_pixel_position
|
||||
* @norm_pos: position in range 0 - 1, either x or y
|
||||
* @dim: dimension, either witdh or height
|
||||
* @dim: dimension, either width or height
|
||||
*
|
||||
* Converts double range [0 -> 1] to pixel range [-2*dim -> 3*dim]. Input 0.4 gives position 0.
|
||||
*
|
||||
@@ -292,6 +292,8 @@ void frei0r_cairo_premultiply_rgba2 (unsigned char *in, unsigned char *out,
|
||||
out[0] = ( in[0] * a ) >> 8;
|
||||
out[1] = ( in[1] * a ) >> 8;
|
||||
out[2] = ( in[2] * a ) >> 8;
|
||||
if (alpha < 0)
|
||||
out[3] = a;
|
||||
}
|
||||
if (alpha >= 0)
|
||||
out[3] = alpha;
|
||||
@@ -207,7 +207,7 @@ for (i=0;i<=255;i++)
|
||||
//convert from paked uchar RGBA to packed float RGBA
|
||||
//w,h are width and height of the image
|
||||
//tab = table used for RGB conversion
|
||||
//atab = table used for alpha converion (usually linear)
|
||||
//atab = table used for alpha conversion (usually linear)
|
||||
static inline void RGBA8_2_float(const uint32_t *in, float_rgba *out, int w, int h, float *tab, float *atab)
|
||||
{
|
||||
int i;
|
||||
@@ -224,7 +224,7 @@ for (i=0;i<w*h;i++)
|
||||
|
||||
//--------------------------------------------------------
|
||||
//convert from paked uchar RGBA to packed float RGBA,
|
||||
//covert RGB only, SKIP ALPHA
|
||||
//convert RGB only, SKIP ALPHA
|
||||
//w,h are width and height of the image
|
||||
//tab = table used for RGB conversion
|
||||
static inline void RGB8_2_float(const uint32_t *in, float_rgba *out, int w, int h, float *tab)
|
||||
@@ -259,7 +259,7 @@ for (i=0;i<w*h;i++)
|
||||
//----------------------------------------------------------
|
||||
//convert from packed float RGBA to packed uchar RGBA
|
||||
//tab = table used for RGB conversion
|
||||
//atab = table used for alpha converion (usually linear)
|
||||
//atab = table used for alpha conversion (usually linear)
|
||||
static inline void float_2_RGBA8(const float_rgba *in, uint32_t *out, int w, int h, uint8_t *tab, uint8_t *atab)
|
||||
{
|
||||
int i;
|
||||
@@ -276,7 +276,7 @@ for (i=0;i<w*h;i++)
|
||||
|
||||
//----------------------------------------------------------
|
||||
//convert from packed float RGBA to packed uchar RGBA
|
||||
//covert RGB only, SKIP ALPHA
|
||||
//convert RGB only, SKIP ALPHA
|
||||
//tab = table used for RGB conversion
|
||||
static inline void float_2_RGB8(const float_rgba *in, uint32_t *out, int w, int h, uint8_t *tab)
|
||||
{
|
||||
@@ -1,4 +1,4 @@
|
||||
/* frei0r_colorspace.h
|
||||
/* frei0r/colorspace.h
|
||||
* Copyright (C) 2004 Mathieu Guindon, Julien Keable, Jean-Sebastien Senecal
|
||||
* This file is part of Frei0r.
|
||||
*
|
||||
@@ -20,7 +20,7 @@
|
||||
#ifndef INCLUDED_FREI0R_COLORSPACE_H
|
||||
#define INCLUDED_FREI0R_COLORSPACE_H
|
||||
|
||||
#include "frei0r_math.h"
|
||||
#include "frei0r/math.h"
|
||||
#include <stdlib.h>
|
||||
#include <math.h>
|
||||
|
||||
@@ -1,305 +0,0 @@
|
||||
// ISO C9x compliant inttypes.h for Microsoft Visual Studio
|
||||
// Based on ISO/IEC 9899:TC2 Committee draft (May 6, 2005) WG14/N1124
|
||||
//
|
||||
// Copyright (c) 2006 Alexander Chemeris
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are met:
|
||||
//
|
||||
// 1. Redistributions of source code must retain the above copyright notice,
|
||||
// this list of conditions and the following disclaimer.
|
||||
//
|
||||
// 2. Redistributions in binary form must reproduce the above copyright
|
||||
// notice, this list of conditions and the following disclaimer in the
|
||||
// documentation and/or other materials provided with the distribution.
|
||||
//
|
||||
// 3. The name of the author may be used to endorse or promote products
|
||||
// derived from this software without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||
// WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
|
||||
// EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
|
||||
// OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
// WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
// OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
// ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _MSC_VER // [
|
||||
#error "Use this header only with Microsoft Visual C++ compilers!"
|
||||
#endif // _MSC_VER ]
|
||||
|
||||
#ifndef _MSC_INTTYPES_H_ // [
|
||||
#define _MSC_INTTYPES_H_
|
||||
|
||||
#if _MSC_VER > 1000
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
#include "stdint.h"
|
||||
|
||||
// 7.8 Format conversion of integer types
|
||||
|
||||
typedef struct {
|
||||
intmax_t quot;
|
||||
intmax_t rem;
|
||||
} imaxdiv_t;
|
||||
|
||||
// 7.8.1 Macros for format specifiers
|
||||
|
||||
#if !defined(__cplusplus) || defined(__STDC_FORMAT_MACROS) // [ See footnote 185 at page 198
|
||||
|
||||
// The fprintf macros for signed integers are:
|
||||
#define PRId8 "d"
|
||||
#define PRIi8 "i"
|
||||
#define PRIdLEAST8 "d"
|
||||
#define PRIiLEAST8 "i"
|
||||
#define PRIdFAST8 "d"
|
||||
#define PRIiFAST8 "i"
|
||||
|
||||
#define PRId16 "hd"
|
||||
#define PRIi16 "hi"
|
||||
#define PRIdLEAST16 "hd"
|
||||
#define PRIiLEAST16 "hi"
|
||||
#define PRIdFAST16 "hd"
|
||||
#define PRIiFAST16 "hi"
|
||||
|
||||
#define PRId32 "I32d"
|
||||
#define PRIi32 "I32i"
|
||||
#define PRIdLEAST32 "I32d"
|
||||
#define PRIiLEAST32 "I32i"
|
||||
#define PRIdFAST32 "I32d"
|
||||
#define PRIiFAST32 "I32i"
|
||||
|
||||
#define PRId64 "I64d"
|
||||
#define PRIi64 "I64i"
|
||||
#define PRIdLEAST64 "I64d"
|
||||
#define PRIiLEAST64 "I64i"
|
||||
#define PRIdFAST64 "I64d"
|
||||
#define PRIiFAST64 "I64i"
|
||||
|
||||
#define PRIdMAX "I64d"
|
||||
#define PRIiMAX "I64i"
|
||||
|
||||
#define PRIdPTR "Id"
|
||||
#define PRIiPTR "Ii"
|
||||
|
||||
// The fprintf macros for unsigned integers are:
|
||||
#define PRIo8 "o"
|
||||
#define PRIu8 "u"
|
||||
#define PRIx8 "x"
|
||||
#define PRIX8 "X"
|
||||
#define PRIoLEAST8 "o"
|
||||
#define PRIuLEAST8 "u"
|
||||
#define PRIxLEAST8 "x"
|
||||
#define PRIXLEAST8 "X"
|
||||
#define PRIoFAST8 "o"
|
||||
#define PRIuFAST8 "u"
|
||||
#define PRIxFAST8 "x"
|
||||
#define PRIXFAST8 "X"
|
||||
|
||||
#define PRIo16 "ho"
|
||||
#define PRIu16 "hu"
|
||||
#define PRIx16 "hx"
|
||||
#define PRIX16 "hX"
|
||||
#define PRIoLEAST16 "ho"
|
||||
#define PRIuLEAST16 "hu"
|
||||
#define PRIxLEAST16 "hx"
|
||||
#define PRIXLEAST16 "hX"
|
||||
#define PRIoFAST16 "ho"
|
||||
#define PRIuFAST16 "hu"
|
||||
#define PRIxFAST16 "hx"
|
||||
#define PRIXFAST16 "hX"
|
||||
|
||||
#define PRIo32 "I32o"
|
||||
#define PRIu32 "I32u"
|
||||
#define PRIx32 "I32x"
|
||||
#define PRIX32 "I32X"
|
||||
#define PRIoLEAST32 "I32o"
|
||||
#define PRIuLEAST32 "I32u"
|
||||
#define PRIxLEAST32 "I32x"
|
||||
#define PRIXLEAST32 "I32X"
|
||||
#define PRIoFAST32 "I32o"
|
||||
#define PRIuFAST32 "I32u"
|
||||
#define PRIxFAST32 "I32x"
|
||||
#define PRIXFAST32 "I32X"
|
||||
|
||||
#define PRIo64 "I64o"
|
||||
#define PRIu64 "I64u"
|
||||
#define PRIx64 "I64x"
|
||||
#define PRIX64 "I64X"
|
||||
#define PRIoLEAST64 "I64o"
|
||||
#define PRIuLEAST64 "I64u"
|
||||
#define PRIxLEAST64 "I64x"
|
||||
#define PRIXLEAST64 "I64X"
|
||||
#define PRIoFAST64 "I64o"
|
||||
#define PRIuFAST64 "I64u"
|
||||
#define PRIxFAST64 "I64x"
|
||||
#define PRIXFAST64 "I64X"
|
||||
|
||||
#define PRIoMAX "I64o"
|
||||
#define PRIuMAX "I64u"
|
||||
#define PRIxMAX "I64x"
|
||||
#define PRIXMAX "I64X"
|
||||
|
||||
#define PRIoPTR "Io"
|
||||
#define PRIuPTR "Iu"
|
||||
#define PRIxPTR "Ix"
|
||||
#define PRIXPTR "IX"
|
||||
|
||||
// The fscanf macros for signed integers are:
|
||||
#define SCNd8 "d"
|
||||
#define SCNi8 "i"
|
||||
#define SCNdLEAST8 "d"
|
||||
#define SCNiLEAST8 "i"
|
||||
#define SCNdFAST8 "d"
|
||||
#define SCNiFAST8 "i"
|
||||
|
||||
#define SCNd16 "hd"
|
||||
#define SCNi16 "hi"
|
||||
#define SCNdLEAST16 "hd"
|
||||
#define SCNiLEAST16 "hi"
|
||||
#define SCNdFAST16 "hd"
|
||||
#define SCNiFAST16 "hi"
|
||||
|
||||
#define SCNd32 "ld"
|
||||
#define SCNi32 "li"
|
||||
#define SCNdLEAST32 "ld"
|
||||
#define SCNiLEAST32 "li"
|
||||
#define SCNdFAST32 "ld"
|
||||
#define SCNiFAST32 "li"
|
||||
|
||||
#define SCNd64 "I64d"
|
||||
#define SCNi64 "I64i"
|
||||
#define SCNdLEAST64 "I64d"
|
||||
#define SCNiLEAST64 "I64i"
|
||||
#define SCNdFAST64 "I64d"
|
||||
#define SCNiFAST64 "I64i"
|
||||
|
||||
#define SCNdMAX "I64d"
|
||||
#define SCNiMAX "I64i"
|
||||
|
||||
#ifdef _WIN64 // [
|
||||
# define SCNdPTR "I64d"
|
||||
# define SCNiPTR "I64i"
|
||||
#else // _WIN64 ][
|
||||
# define SCNdPTR "ld"
|
||||
# define SCNiPTR "li"
|
||||
#endif // _WIN64 ]
|
||||
|
||||
// The fscanf macros for unsigned integers are:
|
||||
#define SCNo8 "o"
|
||||
#define SCNu8 "u"
|
||||
#define SCNx8 "x"
|
||||
#define SCNX8 "X"
|
||||
#define SCNoLEAST8 "o"
|
||||
#define SCNuLEAST8 "u"
|
||||
#define SCNxLEAST8 "x"
|
||||
#define SCNXLEAST8 "X"
|
||||
#define SCNoFAST8 "o"
|
||||
#define SCNuFAST8 "u"
|
||||
#define SCNxFAST8 "x"
|
||||
#define SCNXFAST8 "X"
|
||||
|
||||
#define SCNo16 "ho"
|
||||
#define SCNu16 "hu"
|
||||
#define SCNx16 "hx"
|
||||
#define SCNX16 "hX"
|
||||
#define SCNoLEAST16 "ho"
|
||||
#define SCNuLEAST16 "hu"
|
||||
#define SCNxLEAST16 "hx"
|
||||
#define SCNXLEAST16 "hX"
|
||||
#define SCNoFAST16 "ho"
|
||||
#define SCNuFAST16 "hu"
|
||||
#define SCNxFAST16 "hx"
|
||||
#define SCNXFAST16 "hX"
|
||||
|
||||
#define SCNo32 "lo"
|
||||
#define SCNu32 "lu"
|
||||
#define SCNx32 "lx"
|
||||
#define SCNX32 "lX"
|
||||
#define SCNoLEAST32 "lo"
|
||||
#define SCNuLEAST32 "lu"
|
||||
#define SCNxLEAST32 "lx"
|
||||
#define SCNXLEAST32 "lX"
|
||||
#define SCNoFAST32 "lo"
|
||||
#define SCNuFAST32 "lu"
|
||||
#define SCNxFAST32 "lx"
|
||||
#define SCNXFAST32 "lX"
|
||||
|
||||
#define SCNo64 "I64o"
|
||||
#define SCNu64 "I64u"
|
||||
#define SCNx64 "I64x"
|
||||
#define SCNX64 "I64X"
|
||||
#define SCNoLEAST64 "I64o"
|
||||
#define SCNuLEAST64 "I64u"
|
||||
#define SCNxLEAST64 "I64x"
|
||||
#define SCNXLEAST64 "I64X"
|
||||
#define SCNoFAST64 "I64o"
|
||||
#define SCNuFAST64 "I64u"
|
||||
#define SCNxFAST64 "I64x"
|
||||
#define SCNXFAST64 "I64X"
|
||||
|
||||
#define SCNoMAX "I64o"
|
||||
#define SCNuMAX "I64u"
|
||||
#define SCNxMAX "I64x"
|
||||
#define SCNXMAX "I64X"
|
||||
|
||||
#ifdef _WIN64 // [
|
||||
# define SCNoPTR "I64o"
|
||||
# define SCNuPTR "I64u"
|
||||
# define SCNxPTR "I64x"
|
||||
# define SCNXPTR "I64X"
|
||||
#else // _WIN64 ][
|
||||
# define SCNoPTR "lo"
|
||||
# define SCNuPTR "lu"
|
||||
# define SCNxPTR "lx"
|
||||
# define SCNXPTR "lX"
|
||||
#endif // _WIN64 ]
|
||||
|
||||
#endif // __STDC_FORMAT_MACROS ]
|
||||
|
||||
// 7.8.2 Functions for greatest-width integer types
|
||||
|
||||
// 7.8.2.1 The imaxabs function
|
||||
#define imaxabs _abs64
|
||||
|
||||
// 7.8.2.2 The imaxdiv function
|
||||
|
||||
// This is modified version of div() function from Microsoft's div.c found
|
||||
// in %MSVC.NET%\crt\src\div.c
|
||||
#ifdef STATIC_IMAXDIV // [
|
||||
static
|
||||
#else // STATIC_IMAXDIV ][
|
||||
_inline
|
||||
#endif // STATIC_IMAXDIV ]
|
||||
imaxdiv_t __cdecl imaxdiv(intmax_t numer, intmax_t denom)
|
||||
{
|
||||
imaxdiv_t result;
|
||||
|
||||
result.quot = numer / denom;
|
||||
result.rem = numer % denom;
|
||||
|
||||
if (numer < 0 && result.rem > 0) {
|
||||
// did division wrong; must fix up
|
||||
++result.quot;
|
||||
result.rem -= denom;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
// 7.8.2.3 The strtoimax and strtoumax functions
|
||||
#define strtoimax _strtoi64
|
||||
#define strtoumax _strtoui64
|
||||
|
||||
// 7.8.2.4 The wcstoimax and wcstoumax functions
|
||||
#define wcstoimax _wcstoi64
|
||||
#define wcstoumax _wcstoui64
|
||||
|
||||
|
||||
#endif // _MSC_INTTYPES_H_ ]
|
||||
@@ -1,247 +0,0 @@
|
||||
// ISO C9x compliant stdint.h for Microsoft Visual Studio
|
||||
// Based on ISO/IEC 9899:TC2 Committee draft (May 6, 2005) WG14/N1124
|
||||
//
|
||||
// Copyright (c) 2006-2008 Alexander Chemeris
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are met:
|
||||
//
|
||||
// 1. Redistributions of source code must retain the above copyright notice,
|
||||
// this list of conditions and the following disclaimer.
|
||||
//
|
||||
// 2. Redistributions in binary form must reproduce the above copyright
|
||||
// notice, this list of conditions and the following disclaimer in the
|
||||
// documentation and/or other materials provided with the distribution.
|
||||
//
|
||||
// 3. The name of the author may be used to endorse or promote products
|
||||
// derived from this software without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||
// WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
|
||||
// EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
|
||||
// OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
// WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
// OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
// ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _MSC_VER // [
|
||||
#error "Use this header only with Microsoft Visual C++ compilers!"
|
||||
#endif // _MSC_VER ]
|
||||
|
||||
#ifndef _MSC_STDINT_H_ // [
|
||||
#define _MSC_STDINT_H_
|
||||
|
||||
#if _MSC_VER > 1000
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
#include <limits.h>
|
||||
|
||||
// For Visual Studio 6 in C++ mode and for many Visual Studio versions when
|
||||
// compiling for ARM we should wrap <wchar.h> include with 'extern "C++" {}'
|
||||
// or compiler give many errors like this:
|
||||
// error C2733: second C linkage of overloaded function 'wmemchr' not allowed
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
# include <wchar.h>
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
// Define _W64 macros to mark types changing their size, like intptr_t.
|
||||
#ifndef _W64
|
||||
# if !defined(__midl) && (defined(_X86_) || defined(_M_IX86)) && _MSC_VER >= 1300
|
||||
# define _W64 __w64
|
||||
# else
|
||||
# define _W64
|
||||
# endif
|
||||
#endif
|
||||
|
||||
|
||||
// 7.18.1 Integer types
|
||||
|
||||
// 7.18.1.1 Exact-width integer types
|
||||
|
||||
// Visual Studio 6 and Embedded Visual C++ 4 doesn't
|
||||
// realize that, e.g. char has the same size as __int8
|
||||
// so we give up on __intX for them.
|
||||
#if (_MSC_VER < 1300)
|
||||
typedef signed char int8_t;
|
||||
typedef signed short int16_t;
|
||||
typedef signed int int32_t;
|
||||
typedef unsigned char uint8_t;
|
||||
typedef unsigned short uint16_t;
|
||||
typedef unsigned int uint32_t;
|
||||
#else
|
||||
typedef signed __int8 int8_t;
|
||||
typedef signed __int16 int16_t;
|
||||
typedef signed __int32 int32_t;
|
||||
typedef unsigned __int8 uint8_t;
|
||||
typedef unsigned __int16 uint16_t;
|
||||
typedef unsigned __int32 uint32_t;
|
||||
#endif
|
||||
typedef signed __int64 int64_t;
|
||||
typedef unsigned __int64 uint64_t;
|
||||
|
||||
|
||||
// 7.18.1.2 Minimum-width integer types
|
||||
typedef int8_t int_least8_t;
|
||||
typedef int16_t int_least16_t;
|
||||
typedef int32_t int_least32_t;
|
||||
typedef int64_t int_least64_t;
|
||||
typedef uint8_t uint_least8_t;
|
||||
typedef uint16_t uint_least16_t;
|
||||
typedef uint32_t uint_least32_t;
|
||||
typedef uint64_t uint_least64_t;
|
||||
|
||||
// 7.18.1.3 Fastest minimum-width integer types
|
||||
typedef int8_t int_fast8_t;
|
||||
typedef int16_t int_fast16_t;
|
||||
typedef int32_t int_fast32_t;
|
||||
typedef int64_t int_fast64_t;
|
||||
typedef uint8_t uint_fast8_t;
|
||||
typedef uint16_t uint_fast16_t;
|
||||
typedef uint32_t uint_fast32_t;
|
||||
typedef uint64_t uint_fast64_t;
|
||||
|
||||
// 7.18.1.4 Integer types capable of holding object pointers
|
||||
#ifdef _WIN64 // [
|
||||
typedef signed __int64 intptr_t;
|
||||
typedef unsigned __int64 uintptr_t;
|
||||
#else // _WIN64 ][
|
||||
typedef _W64 signed int intptr_t;
|
||||
typedef _W64 unsigned int uintptr_t;
|
||||
#endif // _WIN64 ]
|
||||
|
||||
// 7.18.1.5 Greatest-width integer types
|
||||
typedef int64_t intmax_t;
|
||||
typedef uint64_t uintmax_t;
|
||||
|
||||
|
||||
// 7.18.2 Limits of specified-width integer types
|
||||
|
||||
#if !defined(__cplusplus) || defined(__STDC_LIMIT_MACROS) // [ See footnote 220 at page 257 and footnote 221 at page 259
|
||||
|
||||
// 7.18.2.1 Limits of exact-width integer types
|
||||
#define INT8_MIN ((int8_t)_I8_MIN)
|
||||
#define INT8_MAX _I8_MAX
|
||||
#define INT16_MIN ((int16_t)_I16_MIN)
|
||||
#define INT16_MAX _I16_MAX
|
||||
#define INT32_MIN ((int32_t)_I32_MIN)
|
||||
#define INT32_MAX _I32_MAX
|
||||
#define INT64_MIN ((int64_t)_I64_MIN)
|
||||
#define INT64_MAX _I64_MAX
|
||||
#define UINT8_MAX _UI8_MAX
|
||||
#define UINT16_MAX _UI16_MAX
|
||||
#define UINT32_MAX _UI32_MAX
|
||||
#define UINT64_MAX _UI64_MAX
|
||||
|
||||
// 7.18.2.2 Limits of minimum-width integer types
|
||||
#define INT_LEAST8_MIN INT8_MIN
|
||||
#define INT_LEAST8_MAX INT8_MAX
|
||||
#define INT_LEAST16_MIN INT16_MIN
|
||||
#define INT_LEAST16_MAX INT16_MAX
|
||||
#define INT_LEAST32_MIN INT32_MIN
|
||||
#define INT_LEAST32_MAX INT32_MAX
|
||||
#define INT_LEAST64_MIN INT64_MIN
|
||||
#define INT_LEAST64_MAX INT64_MAX
|
||||
#define UINT_LEAST8_MAX UINT8_MAX
|
||||
#define UINT_LEAST16_MAX UINT16_MAX
|
||||
#define UINT_LEAST32_MAX UINT32_MAX
|
||||
#define UINT_LEAST64_MAX UINT64_MAX
|
||||
|
||||
// 7.18.2.3 Limits of fastest minimum-width integer types
|
||||
#define INT_FAST8_MIN INT8_MIN
|
||||
#define INT_FAST8_MAX INT8_MAX
|
||||
#define INT_FAST16_MIN INT16_MIN
|
||||
#define INT_FAST16_MAX INT16_MAX
|
||||
#define INT_FAST32_MIN INT32_MIN
|
||||
#define INT_FAST32_MAX INT32_MAX
|
||||
#define INT_FAST64_MIN INT64_MIN
|
||||
#define INT_FAST64_MAX INT64_MAX
|
||||
#define UINT_FAST8_MAX UINT8_MAX
|
||||
#define UINT_FAST16_MAX UINT16_MAX
|
||||
#define UINT_FAST32_MAX UINT32_MAX
|
||||
#define UINT_FAST64_MAX UINT64_MAX
|
||||
|
||||
// 7.18.2.4 Limits of integer types capable of holding object pointers
|
||||
#ifdef _WIN64 // [
|
||||
# define INTPTR_MIN INT64_MIN
|
||||
# define INTPTR_MAX INT64_MAX
|
||||
# define UINTPTR_MAX UINT64_MAX
|
||||
#else // _WIN64 ][
|
||||
# define INTPTR_MIN INT32_MIN
|
||||
# define INTPTR_MAX INT32_MAX
|
||||
# define UINTPTR_MAX UINT32_MAX
|
||||
#endif // _WIN64 ]
|
||||
|
||||
// 7.18.2.5 Limits of greatest-width integer types
|
||||
#define INTMAX_MIN INT64_MIN
|
||||
#define INTMAX_MAX INT64_MAX
|
||||
#define UINTMAX_MAX UINT64_MAX
|
||||
|
||||
// 7.18.3 Limits of other integer types
|
||||
|
||||
#ifdef _WIN64 // [
|
||||
# define PTRDIFF_MIN _I64_MIN
|
||||
# define PTRDIFF_MAX _I64_MAX
|
||||
#else // _WIN64 ][
|
||||
# define PTRDIFF_MIN _I32_MIN
|
||||
# define PTRDIFF_MAX _I32_MAX
|
||||
#endif // _WIN64 ]
|
||||
|
||||
#define SIG_ATOMIC_MIN INT_MIN
|
||||
#define SIG_ATOMIC_MAX INT_MAX
|
||||
|
||||
#ifndef SIZE_MAX // [
|
||||
# ifdef _WIN64 // [
|
||||
# define SIZE_MAX _UI64_MAX
|
||||
# else // _WIN64 ][
|
||||
# define SIZE_MAX _UI32_MAX
|
||||
# endif // _WIN64 ]
|
||||
#endif // SIZE_MAX ]
|
||||
|
||||
// WCHAR_MIN and WCHAR_MAX are also defined in <wchar.h>
|
||||
#ifndef WCHAR_MIN // [
|
||||
# define WCHAR_MIN 0
|
||||
#endif // WCHAR_MIN ]
|
||||
#ifndef WCHAR_MAX // [
|
||||
# define WCHAR_MAX _UI16_MAX
|
||||
#endif // WCHAR_MAX ]
|
||||
|
||||
#define WINT_MIN 0
|
||||
#define WINT_MAX _UI16_MAX
|
||||
|
||||
#endif // __STDC_LIMIT_MACROS ]
|
||||
|
||||
|
||||
// 7.18.4 Limits of other integer types
|
||||
|
||||
#if !defined(__cplusplus) || defined(__STDC_CONSTANT_MACROS) // [ See footnote 224 at page 260
|
||||
|
||||
// 7.18.4.1 Macros for minimum-width integer constants
|
||||
|
||||
#define INT8_C(val) val##i8
|
||||
#define INT16_C(val) val##i16
|
||||
#define INT32_C(val) val##i32
|
||||
#define INT64_C(val) val##i64
|
||||
|
||||
#define UINT8_C(val) val##ui8
|
||||
#define UINT16_C(val) val##ui16
|
||||
#define UINT32_C(val) val##ui32
|
||||
#define UINT64_C(val) val##ui64
|
||||
|
||||
// 7.18.4.2 Macros for greatest-width integer constants
|
||||
#define INTMAX_C INT64_C
|
||||
#define UINTMAX_C UINT64_C
|
||||
|
||||
#endif // __STDC_CONSTANT_MACROS ]
|
||||
|
||||
|
||||
#endif // _MSC_STDINT_H_ ]
|
||||
@@ -1,5 +1,7 @@
|
||||
set (CMAKE_SHARED_LINKER_FLAGS "-Wl,--as-needed")
|
||||
link_libraries(m)
|
||||
if(NOT MSVC)
|
||||
link_libraries(m)
|
||||
endif()
|
||||
add_subdirectory (filter)
|
||||
add_subdirectory (generator)
|
||||
add_subdirectory (mixer2)
|
||||
|
||||
353
src/Makefile.am
353
src/Makefile.am
@@ -1,353 +0,0 @@
|
||||
# Copyright (C) 2007 Richard Spindler <richard.spindler AT gmail.com>
|
||||
#
|
||||
# This file is free software; as a special exception the author gives
|
||||
# unlimited permission to copy and/or distribute it, with or without
|
||||
# modifications, as long as this notice is preserved.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful, but
|
||||
# WITHOUT ANY WARRANTY, to the extent permitted by law; without even the
|
||||
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
plugin_LTLIBRARIES = \
|
||||
3dflippo.la \
|
||||
addition.la \
|
||||
addition_alpha.la \
|
||||
alpha0ps.la \
|
||||
alphaatop.la \
|
||||
alphagrad.la \
|
||||
alphain.la \
|
||||
alphainjection.la \
|
||||
alphaout.la \
|
||||
alphaover.la \
|
||||
alphaspot.la \
|
||||
alphaxor.la \
|
||||
B.la \
|
||||
balanc0r.la \
|
||||
baltan.la \
|
||||
blend.la \
|
||||
bluescreen0r.la \
|
||||
bgsubtract0r.la \
|
||||
brightness.la \
|
||||
burn.la \
|
||||
bw0r.la \
|
||||
c0rners.la \
|
||||
cartoon.la \
|
||||
cluster.la \
|
||||
colgate.la \
|
||||
coloradj_RGB.la \
|
||||
colordistance.la \
|
||||
colorhalftone.la \
|
||||
colorize.la \
|
||||
colortap.la \
|
||||
color_only.la \
|
||||
composition.la \
|
||||
contrast0r.la \
|
||||
curves.la \
|
||||
d90stairsteppingfix.la \
|
||||
darken.la \
|
||||
defish0r.la \
|
||||
delay0r.la \
|
||||
delaygrab.la \
|
||||
difference.la \
|
||||
distort0r.la \
|
||||
dither.la \
|
||||
divide.la \
|
||||
dodge.la \
|
||||
edgeglow.la \
|
||||
elastic_scale.la \
|
||||
emboss.la \
|
||||
equaliz0r.la \
|
||||
flippo.la \
|
||||
G.la \
|
||||
gamma.la \
|
||||
glow.la \
|
||||
glitch0r.la \
|
||||
grain_extract.la \
|
||||
grain_merge.la \
|
||||
hardlight.la \
|
||||
hqdn3d.la \
|
||||
hue.la \
|
||||
hueshift0r.la \
|
||||
IIRblur.la \
|
||||
invert0r.la \
|
||||
ising0r.la \
|
||||
keyspillm0pup.la \
|
||||
lenscorrection.la \
|
||||
letterb0xed.la \
|
||||
levels.la \
|
||||
lighten.la \
|
||||
lightgraffiti.la \
|
||||
lissajous0r.la \
|
||||
luminance.la \
|
||||
mask0mate.la \
|
||||
medians.la \
|
||||
multiply.la \
|
||||
ndvi.la \
|
||||
nervous.la \
|
||||
nois0r.la \
|
||||
normaliz0r.la \
|
||||
nosync0r.la \
|
||||
onecol0r.la \
|
||||
overlay.la \
|
||||
partik0l.la \
|
||||
perspective.la \
|
||||
pixeliz0r.la \
|
||||
plasma.la \
|
||||
posterize.la \
|
||||
pr0be.la \
|
||||
pr0file.la \
|
||||
premultiply.la \
|
||||
primaries.la \
|
||||
R.la \
|
||||
RGB.la \
|
||||
rgbnoise.la \
|
||||
rgbsplit0r.la \
|
||||
saturation.la \
|
||||
saturat0r.la \
|
||||
scanline0r.la \
|
||||
screen.la \
|
||||
select0r.la \
|
||||
sharpness.la \
|
||||
sigmoidaltransfer.la \
|
||||
sobel.la \
|
||||
softglow.la \
|
||||
softlight.la \
|
||||
sopsat.la \
|
||||
spillsupress.la \
|
||||
squareblur.la \
|
||||
subtract.la \
|
||||
tehroxx0r.la \
|
||||
test_pat_B.la \
|
||||
test_pat_C.la \
|
||||
test_pat_G.la \
|
||||
test_pat_I.la \
|
||||
test_pat_L.la \
|
||||
test_pat_R.la \
|
||||
three_point_balance.la \
|
||||
threshold0r.la \
|
||||
threelay0r.la \
|
||||
timeout.la \
|
||||
tint0r.la \
|
||||
transparency.la \
|
||||
twolay0r.la \
|
||||
uvmap.la \
|
||||
value.la \
|
||||
vertigo.la \
|
||||
vignette.la \
|
||||
xfade0r.la
|
||||
|
||||
if HAVE_GAVL
|
||||
plugin_LTLIBRARIES += scale0tilt.la
|
||||
scale0tilt_la_SOURCES = filter/scale0tilt/scale0tilt.c
|
||||
scale0tilt_la_CFLAGS = @GAVL_CFLAGS@ @CFLAGS@
|
||||
scale0tilt_la_LIBADD = @GAVL_LIBS@
|
||||
|
||||
plugin_LTLIBRARIES += vectorscope.la
|
||||
vectorscope_la_SOURCES = filter/vectorscope/vectorscope.c filter/vectorscope/vectorscope_image.h
|
||||
vectorscope_la_CFLAGS = @GAVL_CFLAGS@ @CFLAGS@
|
||||
vectorscope_la_LIBADD = @GAVL_LIBS@
|
||||
|
||||
plugin_LTLIBRARIES += rgbparade.la
|
||||
rgbparade_la_SOURCES = filter/rgbparade/rgbparade.c filter/rgbparade/rgbparade_image.h
|
||||
rgbparade_la_CFLAGS = @GAVL_CFLAGS@ @CFLAGS@
|
||||
rgbparade_la_LIBADD = @GAVL_LIBS@
|
||||
endif
|
||||
|
||||
if HAVE_OPENCV
|
||||
plugin_LTLIBRARIES += facebl0r.la
|
||||
facebl0r_la_SOURCES = filter/facebl0r/facebl0r.cpp
|
||||
facebl0r_la_CFLAGS = @OPENCV_CFLAGS@ @CFLAGS@
|
||||
facebl0r_la_LIBADD = @OPENCV_LIBS@
|
||||
plugin_LTLIBRARIES += facedetect.la
|
||||
facedetect_la_SOURCES = filter/facedetect/facedetect.cpp
|
||||
facedetect_la_CFLAGS = @OPENCV_CFLAGS@ @CFLAGS@
|
||||
facedetect_la_LIBADD = @OPENCV_LIBS@
|
||||
endif
|
||||
|
||||
if HAVE_CAIRO
|
||||
plugin_LTLIBRARIES += cairogradient.la
|
||||
cairogradient_la_SOURCES = filter/cairogradient/cairogradient.c
|
||||
cairogradient_la_CFLAGS = @CAIRO_CFLAGS@ @CFLAGS@
|
||||
cairogradient_la_LIBADD = @CAIRO_LIBS@
|
||||
|
||||
plugin_LTLIBRARIES += cairoimagegrid.la
|
||||
cairoimagegrid_la_SOURCES = filter/cairoimagegrid/cairoimagegrid.c
|
||||
cairoimagegrid_la_CFLAGS = @CAIRO_CFLAGS@ @CFLAGS@
|
||||
cairoimagegrid_la_LIBADD = @CAIRO_LIBS@
|
||||
|
||||
plugin_LTLIBRARIES += cairoaffineblend.la
|
||||
cairoaffineblend_la_SOURCES = mixer2/cairoaffineblend/cairoaffineblend.c
|
||||
cairoaffineblend_la_CFLAGS = @CAIRO_CFLAGS@ @CFLAGS@
|
||||
cairoaffineblend_la_LIBADD = @CAIRO_LIBS@
|
||||
|
||||
plugin_LTLIBRARIES += cairoblend.la
|
||||
cairoblend_la_SOURCES = mixer2/cairoblend/cairoblend.c
|
||||
cairoblend_la_CFLAGS = @CAIRO_CFLAGS@ @CFLAGS@
|
||||
cairoblend_la_LIBADD = @CAIRO_LIBS@
|
||||
|
||||
ndvi_la_CPPFLAGS = @CAIRO_CFLAGS@ @CPPFLAGS@ -DHAVE_CAIRO
|
||||
ndvi_la_LIBADD = @CAIRO_LIBS@
|
||||
endif
|
||||
|
||||
#
|
||||
# FILTERS
|
||||
#
|
||||
3dflippo_la_SOURCES = filter/3dflippo/3dflippo.c
|
||||
alpha0ps_la_SOURCES = filter/alpha0ps/alpha0ps.c filter/alpha0ps/fibe_f.h
|
||||
alphagrad_la_SOURCES = filter/alpha0ps/alphagrad.c
|
||||
alphaspot_la_SOURCES = filter/alpha0ps/alphaspot.c
|
||||
B_la_SOURCES = filter/RGB/B.c
|
||||
balanc0r_la_SOURCES = filter/balanc0r/balanc0r.c
|
||||
baltan_la_SOURCES = filter/baltan/baltan.cpp
|
||||
bgsubtract0r_la_SOURCES = filter/bgsubtract0r/bgsubtract0r.c
|
||||
bluescreen0r_la_SOURCES = filter/bluescreen0r/bluescreen0r.cpp
|
||||
brightness_la_SOURCES = filter/brightness/brightness.c
|
||||
bw0r_la_SOURCES = filter/bw0r/bw0r.c
|
||||
c0rners_la_SOURCES = filter/c0rners/c0rners.c filter/c0rners/interp.h
|
||||
cartoon_la_SOURCES = filter/cartoon/cartoon.cpp
|
||||
cluster_la_SOURCES = filter/cluster/cluster.c
|
||||
colgate_la_SOURCES = filter/colgate/colgate.c
|
||||
coloradj_RGB_la_SOURCES = filter/coloradj/coloradj_RGB.c
|
||||
colordistance_la_SOURCES = filter/colordistance/colordistance.c
|
||||
colorhalftone_la_SOURCES = filter/colorhalftone/colorhalftone.c
|
||||
colorize_la_SOURCES = filter/colorize/colorize.c
|
||||
colortap_la_SOURCES = filter/colortap/colortap.c
|
||||
contrast0r_la_SOURCES = filter/contrast0r/contrast0r.c
|
||||
curves_la_SOURCES = filter/curves/curves.c
|
||||
d90stairsteppingfix_la_SOURCES = filter/d90stairsteppingfix/d90stairsteppingfix.cpp
|
||||
defish0r_la_SOURCES = filter/defish0r/defish0r.c filter/defish0r/interp.h
|
||||
delay0r_la_SOURCES = filter/delay0r/delay0r.cpp
|
||||
delaygrab_la_SOURCES = filter/delaygrab/delaygrab.cpp
|
||||
distort0r_la_SOURCES = filter/distort0r/distort0r.c
|
||||
dither_la_SOURCES = filter/dither/dither.c
|
||||
edgeglow_la_SOURCES = filter/edgeglow/edgeglow.cpp
|
||||
elastic_scale_la_SOURCES = filter/elastic_scale/elastic_scale.cpp
|
||||
emboss_la_SOURCES = filter/emboss/emboss.c
|
||||
emboss_la_LIBADD = -lm
|
||||
equaliz0r_la_SOURCES = filter/equaliz0r/equaliz0r.cpp
|
||||
flippo_la_SOURCES = filter/flippo/flippo.c
|
||||
G_la_SOURCES = filter/RGB/G.c
|
||||
gamma_la_SOURCES = filter/gamma/gamma.c
|
||||
glow_la_SOURCES = filter/glow/glow.c
|
||||
glitch0r_la_SOURCES = filter/glitch0r/glitch0r.c
|
||||
hqdn3d_la_SOURCES = filter/denoise/hqdn3d.c
|
||||
hueshift0r_la_SOURCES = filter/hueshift0r/hueshift0r.c filter/hueshift0r/matrix.h
|
||||
IIRblur_la_SOURCES = filter/blur/IIRblur.c filter/blur/fibe.h
|
||||
invert0r_la_SOURCES = filter/invert0r/invert0r.c
|
||||
keyspillm0pup_la_SOURCES = filter/keyspillm0pup/keyspillm0pup.c
|
||||
lenscorrection_la_SOURCES = filter/lenscorrection/lenscorrection.c
|
||||
letterb0xed_la_SOURCES = filter/letterb0xed/letterb0xed.c
|
||||
levels_la_SOURCES = filter/levels/levels.c
|
||||
lightgraffiti_la_SOURCES = filter/lightgraffiti/lightgraffiti.cpp
|
||||
luminance_la_SOURCES = filter/luminance/luminance.c
|
||||
mask0mate_la_SOURCES = filter/mask0mate/mask0mate.c
|
||||
medians_la_SOURCES = filter/medians/medians.c filter/medians/ctmf.h filter/medians/small_medians.h
|
||||
ndvi_la_SOURCES = filter/ndvi/ndvi.cpp filter/ndvi/gradientlut.hpp
|
||||
nervous_la_SOURCES = filter/nervous/nervous.cpp
|
||||
normaliz0r_la_SOURCES = filter/normaliz0r/normaliz0r.c
|
||||
nosync0r_la_SOURCES = filter/nosync0r/nosync0r.cpp
|
||||
partik0l_la_SOURCES = generator/partik0l/partik0l.cpp
|
||||
perspective_la_SOURCES = filter/perspective/perspective.c
|
||||
pixeliz0r_la_SOURCES = filter/pixeliz0r/pixeliz0r.c
|
||||
posterize_la_SOURCES = filter/posterize/posterize.c
|
||||
pr0be_la_SOURCES = filter/measure/pr0be.c filter/measure/measure.h filter/measure/font2.h
|
||||
pr0file_la_SOURCES = filter/measure/pr0file.c filter/measure/measure.h filter/measure/font2.h
|
||||
premultiply_la_SOURCES = filter/premultiply/premultiply.cpp
|
||||
primaries_la_SOURCES = filter/primaries/primaries.cpp
|
||||
R_la_SOURCES = filter/RGB/R.c
|
||||
rgbnoise_la_SOURCES = filter/rgbnoise/rgbnoise.c
|
||||
rgbsplit0r_la_SOURCES = filter/rgbsplit0r/rgbsplit0r.c
|
||||
saturat0r_la_SOURCES = filter/saturat0r/saturat0r.c
|
||||
scanline0r_la_SOURCES = filter/scanline0r/scanline0r.cpp
|
||||
select0r_la_SOURCES = filter/select0r/select0r.c
|
||||
sharpness_la_SOURCES = filter/sharpness/sharpness.c
|
||||
sigmoidaltransfer_la_SOURCES = filter/sigmoidaltransfer/sigmoidaltransfer.c
|
||||
sobel_la_SOURCES = filter/sobel/sobel.cpp
|
||||
softglow_la_SOURCES = filter/softglow/softglow.c
|
||||
sopsat_la_SOURCES = filter/sopsat/sopsat.cpp
|
||||
spillsupress_la_SOURCES = filter/spillsupress/spillsupress.c
|
||||
squareblur_la_SOURCES = filter/squareblur/squareblur.c
|
||||
tehroxx0r_la_SOURCES = filter/tehroxx0r/tehRoxx0r.c
|
||||
threelay0r_la_SOURCES = filter/threelay0r/threelay0r.cpp
|
||||
three_point_balance_la_SOURCES = filter/three_point_balance/three_point_balance.c
|
||||
threshold0r_la_SOURCES = filter/threshold0r/threshold0r.c
|
||||
timeout_la_SOURCES = filter/timeout/timeout.cpp
|
||||
tint0r_la_SOURCES = filter/tint0r/tint0r.c
|
||||
transparency_la_SOURCES = filter/transparency/transparency.c
|
||||
twolay0r_la_SOURCES = filter/twolay0r/twolay0r.cpp
|
||||
vertigo_la_SOURCES = filter/vertigo/vertigo.c
|
||||
vignette_la_SOURCES = filter/vignette/vignette.cpp
|
||||
|
||||
#
|
||||
# GENERATORS
|
||||
#
|
||||
ising0r_la_SOURCES = generator/ising0r/ising0r.c
|
||||
lissajous0r_la_SOURCES = generator/lissajous0r/lissajous0r.cpp
|
||||
nois0r_la_SOURCES = generator/nois0r/nois0r.cpp
|
||||
onecol0r_la_SOURCES = generator/onecol0r/onecol0r.cpp
|
||||
plasma_la_SOURCES = generator/dem0scene/plasma.cpp
|
||||
test_pat_B_la_SOURCES = generator/test_pat/test_pat_B.c
|
||||
test_pat_C_la_SOURCES = generator/test_pat/test_pat_C.c
|
||||
test_pat_G_la_SOURCES = generator/test_pat/test_pat_G.c
|
||||
test_pat_I_la_SOURCES = generator/test_pat/test_pat_I.c
|
||||
test_pat_L_la_SOURCES = generator/test_pat/test_pat_L.c
|
||||
test_pat_R_la_SOURCES = generator/test_pat/test_pat_R.c
|
||||
|
||||
#
|
||||
# MIXERS
|
||||
#
|
||||
addition_la_SOURCES = mixer2/addition/addition.cpp
|
||||
addition_alpha_la_SOURCES = mixer2/addition_alpha/addition_alpha.cpp
|
||||
alphaatop_la_SOURCES = mixer2/alphaatop/alphaatop.cpp
|
||||
alphainjection_la_SOURCES = mixer2/alphainjection/alphainjection.c
|
||||
alphain_la_SOURCES = mixer2/alphain/alphain.cpp
|
||||
alphaout_la_SOURCES = mixer2/alphaout/alphaout.cpp
|
||||
alphaover_la_SOURCES = mixer2/alphaover/alphaover.cpp
|
||||
alphaxor_la_SOURCES = mixer2/alphaxor/alphaxor.cpp
|
||||
blend_la_SOURCES = mixer2/blend/blend.cpp
|
||||
burn_la_SOURCES = mixer2/burn/burn.cpp
|
||||
color_only_la_SOURCES = mixer2/color_only/color_only.cpp
|
||||
composition_la_SOURCES = mixer2/composition/composition.c
|
||||
darken_la_SOURCES = mixer2/darken/darken.cpp
|
||||
difference_la_SOURCES = mixer2/difference/difference.cpp
|
||||
divide_la_SOURCES = mixer2/divide/divide.cpp
|
||||
dodge_la_SOURCES = mixer2/dodge/dodge.cpp
|
||||
grain_extract_la_SOURCES = mixer2/grain_extract/grain_extract.cpp
|
||||
grain_merge_la_SOURCES = mixer2/grain_merge/grain_merge.cpp
|
||||
hardlight_la_SOURCES = mixer2/hardlight/hardlight.cpp
|
||||
hue_la_SOURCES = mixer2/hue/hue.cpp
|
||||
lighten_la_SOURCES = mixer2/lighten/lighten.cpp
|
||||
multiply_la_SOURCES = mixer2/multiply/multiply.cpp
|
||||
overlay_la_SOURCES = mixer2/overlay/overlay.cpp
|
||||
RGB_la_SOURCES = mixer3/RGB/RGB.c
|
||||
saturation_la_SOURCES = mixer2/saturation/saturation.cpp
|
||||
screen_la_SOURCES = mixer2/screen/screen.cpp
|
||||
softlight_la_SOURCES = mixer2/softlight/softlight.cpp
|
||||
subtract_la_SOURCES = mixer2/subtract/subtract.cpp
|
||||
uvmap_la_SOURCES = mixer2/uvmap/uvmap.c
|
||||
value_la_SOURCES = mixer2/value/value.cpp
|
||||
xfade0r_la_SOURCES = mixer2/xfade0r/xfade0r.cpp
|
||||
|
||||
|
||||
AM_CPPFLAGS = -I@top_srcdir@/include -Waddress -Wtype-limits -Wsign-compare
|
||||
AM_CFLAGS = -I@top_srcdir@/include -Waddress -Wtype-limits -Wsign-compare
|
||||
AM_LDFLAGS = -module -avoid-version -lm -export-dynamic
|
||||
AM_LIBTOOLFLAGS = --tag=disable-static
|
||||
|
||||
plugindir = @libdir@/frei0r-1
|
||||
|
||||
|
||||
install-pluginLTLIBRARIES: $(plugin_LTLIBRARIES)
|
||||
mkdir -p $(DESTDIR)/$(plugindir)
|
||||
list='$(plugin_LTLIBRARIES)'; \
|
||||
for file in $$list; do \
|
||||
sofile=`basename $$file .la`.so; \
|
||||
$(INSTALL_PROGRAM) .libs/$$sofile $(DESTDIR)/$(plugindir); \
|
||||
done
|
||||
|
||||
uninstall-pluginLTLIBRARIES:
|
||||
list='$(plugin_LTLIBRARIES)'; \
|
||||
for file in $$list; do \
|
||||
sofile=`basename $$file .la`.so; \
|
||||
rm -f $(DESTDIR)/$(plugindir)/$$sofile; \
|
||||
done
|
||||
@@ -2,7 +2,6 @@ set (SOURCES 3dflippo.c)
|
||||
set (TARGET 3dflippo)
|
||||
|
||||
if (MSVC)
|
||||
set_source_files_properties (3dflippo.c PROPERTIES LANGUAGE CXX)
|
||||
set (SOURCES ${SOURCES} ${FREI0R_DEF})
|
||||
endif (MSVC)
|
||||
|
||||
|
||||
@@ -12,9 +12,11 @@ endif (${OpenCV_FOUND})
|
||||
if (${Cairo_FOUND})
|
||||
add_subdirectory (cairoimagegrid)
|
||||
add_subdirectory (cairogradient)
|
||||
add_subdirectory (mirr0r)
|
||||
endif (${Cairo_FOUND})
|
||||
|
||||
add_subdirectory (3dflippo)
|
||||
add_subdirectory (aech0r)
|
||||
add_subdirectory (alpha0ps)
|
||||
add_subdirectory (balanc0r)
|
||||
add_subdirectory (baltan)
|
||||
@@ -45,13 +47,17 @@ add_subdirectory (edgeglow)
|
||||
add_subdirectory (elastic_scale)
|
||||
add_subdirectory (emboss)
|
||||
add_subdirectory (equaliz0r)
|
||||
add_subdirectory (filmgrain)
|
||||
add_subdirectory (flippo)
|
||||
add_subdirectory (gamma)
|
||||
add_subdirectory (gateweave)
|
||||
add_subdirectory (glow)
|
||||
add_subdirectory (glitch0r)
|
||||
#add_subdirectory (host_param_test)
|
||||
add_subdirectory (heatmap0r)
|
||||
add_subdirectory (hueshift0r)
|
||||
add_subdirectory (invert0r)
|
||||
add_subdirectory (kaleid0sc0pe)
|
||||
add_subdirectory (keyspillm0pup)
|
||||
add_subdirectory (lenscorrection)
|
||||
add_subdirectory (letterb0xed)
|
||||
@@ -60,16 +66,15 @@ add_subdirectory (lightgraffiti)
|
||||
add_subdirectory (luminance)
|
||||
add_subdirectory (mask0mate)
|
||||
add_subdirectory (medians)
|
||||
if (NOT ${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
|
||||
# clang 3.1 on OSX fails to compile this one
|
||||
add_subdirectory (measure)
|
||||
endif ()
|
||||
add_subdirectory (measure)
|
||||
add_subdirectory (ndvi)
|
||||
add_subdirectory (nervous)
|
||||
add_subdirectory (normaliz0r)
|
||||
add_subdirectory (nosync0r)
|
||||
add_subdirectory (ntsc)
|
||||
add_subdirectory (perspective)
|
||||
add_subdirectory (pixeliz0r)
|
||||
add_subdirectory (pixs0r)
|
||||
add_subdirectory (posterize)
|
||||
add_subdirectory (premultiply)
|
||||
add_subdirectory (primaries)
|
||||
|
||||
@@ -3,7 +3,6 @@ set (G_SOURCES G.c)
|
||||
set (B_SOURCES B.c)
|
||||
|
||||
if (MSVC)
|
||||
set_source_files_properties (R.c G.c B.c PROPERTIES LANGUAGE CXX)
|
||||
set (R_SOURCES ${R_SOURCES} ${FREI0R_DEF})
|
||||
set (G_SOURCES ${G_SOURCES} ${FREI0R_DEF})
|
||||
set (B_SOURCES ${B_SOURCES} ${FREI0R_DEF})
|
||||
|
||||
11
src/filter/aech0r/CMakeLists.txt
Normal file
11
src/filter/aech0r/CMakeLists.txt
Normal file
@@ -0,0 +1,11 @@
|
||||
set (SOURCES aech0r.cpp)
|
||||
set (TARGET aech0r)
|
||||
|
||||
if (MSVC)
|
||||
set (SOURCES ${SOURCES} ${FREI0R_DEF})
|
||||
endif (MSVC)
|
||||
|
||||
add_library (${TARGET} MODULE ${SOURCES})
|
||||
set_target_properties (${TARGET} PROPERTIES PREFIX "")
|
||||
|
||||
install (TARGETS ${TARGET} LIBRARY DESTINATION ${LIBDIR})
|
||||
307
src/filter/aech0r/aech0r.cpp
Normal file
307
src/filter/aech0r/aech0r.cpp
Normal file
@@ -0,0 +1,307 @@
|
||||
/*
|
||||
* aech0r.cpp
|
||||
*
|
||||
* This frei0r plugin aims to simulate a video echo with some colors tweaks.
|
||||
* Version 0.1 sept 2020
|
||||
*
|
||||
* Copyright (C) 2018-2020 d-j-a-y & vloop
|
||||
*
|
||||
* This source code is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This source code is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. Please refer
|
||||
* to the GNU Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Public License along
|
||||
* with this source code; if not, write to: Free Software Foundation,
|
||||
* Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
*/
|
||||
#include "frei0r.hpp"
|
||||
#include "frei0r/math.h"
|
||||
|
||||
#include <string.h>
|
||||
#include <climits>
|
||||
|
||||
////// Uncomment to force non optimisation version
|
||||
//~ #undef __SSE2__
|
||||
|
||||
////// TODO / IDEAS / ... //////
|
||||
// IDEA - directionnal echo ? (X/Y like parameter )
|
||||
// TODO RGB gradient by fading influence need more love (See '//Fade by color layers')!
|
||||
// FIXME SSE2 version doesn't support RGB fading influence !
|
||||
|
||||
// FIXME (Veejay specifics?) on activate/deactivate/activate/..., some buffers must be cleared!
|
||||
|
||||
// EXPLORE ME -
|
||||
//~ if((skip_count++)>m_skip) {
|
||||
//~ - skip_count = 0;
|
||||
//~ - m_factor += (factor * 64);
|
||||
//~ [...]
|
||||
//~ }
|
||||
|
||||
// EXPLORE ME a very high m_factor value give some interesting color result ( m_factor += (factor * 64) * m_skip;)
|
||||
|
||||
|
||||
/* Intrinsic declarations */
|
||||
#if defined(__SSE2__)
|
||||
#include <emmintrin.h>
|
||||
// TODO mmx support and others
|
||||
// #elif defined(__MMX__)
|
||||
// #include <mmintrin.h>
|
||||
#endif
|
||||
|
||||
#define SKIP_MAX_IMAGES 8
|
||||
#define M_FACTOR_MAV 127
|
||||
|
||||
union px_t {
|
||||
uint32_t u;
|
||||
unsigned char c[4]; // 0=B, 1=G,2=R,3=A ? i think :P
|
||||
};
|
||||
|
||||
class aech0r : public frei0r::filter {
|
||||
private:
|
||||
f0r_param_double factor;
|
||||
//~ f0r_param_double factor_r; //Fade by color layers
|
||||
//~ f0r_param_double factor_g;
|
||||
//~ f0r_param_double factor_b;
|
||||
f0r_param_double strobe_period;
|
||||
bool bright;
|
||||
bool flag_r;
|
||||
bool flag_g;
|
||||
bool flag_b;
|
||||
|
||||
|
||||
//~ f0r_param_double fade_rgb; //Fade by color layers
|
||||
//~ f0r_param_double flag_rgb;
|
||||
|
||||
unsigned int m_factor;
|
||||
|
||||
//~ unsigned int m_factor_r; //Fade by color layers
|
||||
//~ unsigned int m_factor_g;
|
||||
//~ unsigned int m_factor_b;
|
||||
|
||||
//~ unsigned int m_flag_rgb; //Fade by color layers
|
||||
//~ unsigned int m_flag_r;
|
||||
//~ unsigned int m_flag_g;
|
||||
//~ unsigned int m_flag_b;
|
||||
|
||||
unsigned int m_skip;
|
||||
unsigned int m_skip_count;
|
||||
|
||||
bool firsttime;
|
||||
|
||||
//~ unsigned int m_rgb; //Fade by color layers
|
||||
|
||||
#ifdef __SSE2__
|
||||
long long int m_factor_sse2;
|
||||
|
||||
inline void tracesse2_add(uint32_t* out, const uint32_t* in);
|
||||
inline void tracesse2_sub(uint32_t* out, const uint32_t* in);
|
||||
#else
|
||||
unsigned int m_factor_r;
|
||||
unsigned int m_factor_g;
|
||||
unsigned int m_factor_b;
|
||||
|
||||
inline void trace_add(uint32_t* out, const uint32_t* in);
|
||||
inline void trace_sub(uint32_t* out, const uint32_t* in);
|
||||
#endif
|
||||
public:
|
||||
|
||||
aech0r(unsigned int width, unsigned int height) {
|
||||
|
||||
factor = 0.15; // Quasi full echo has default
|
||||
bright = false; // Dark mode has default
|
||||
|
||||
flag_r = false; // No RGB flag has default
|
||||
flag_g = false;
|
||||
flag_b = false;
|
||||
|
||||
strobe_period = 0; // No strobe has default
|
||||
|
||||
//~ fade_rgb = ? //Fade by color layers
|
||||
|
||||
firsttime = true;
|
||||
m_skip_count = 0;
|
||||
|
||||
register_param(factor, "Fade Factor", "Disappearance rate of the echo"); // 0 No fade, 1 No Trace
|
||||
register_param(bright, "Direction", "Darker or Brighter echo"); // Add or Subtract data
|
||||
register_param(flag_r, "Keep RED", "Influence on Red channel"); // 0 Fade canal, 1 Keep canal data
|
||||
register_param(flag_g, "Keep GREEN", "Influence on Green channel"); // 0 Fade canal, 1 Keep canal data
|
||||
register_param(flag_b, "Keep BLUE", "Influence on Blue channel"); // 0 Fade canal, 1 Keep canal data
|
||||
register_param(strobe_period, "Strobe period", "Rate of the stroboscope: from 0 to 8 frames");
|
||||
|
||||
//~ register_param(fade_rgb, "Plans fade", "RGB"); //Fade by color layers
|
||||
//~ register_param(factor_r, "Fade R", "influence"); // 0 No fade, 1 No Trace
|
||||
//~ register_param(factor_g, "Fade G", "influence"); // 0 No fade, 1 No Trace
|
||||
//~ register_param(factor_b, "Fade B", "influence"); // 0 No fade, 1 No Trace
|
||||
//~ register_param(flag_rgb, "Plans comparison", "RGB");
|
||||
|
||||
}
|
||||
~aech0r() {
|
||||
}
|
||||
|
||||
virtual void update(double time,
|
||||
uint32_t* out,
|
||||
const uint32_t* in) {
|
||||
|
||||
if (firsttime) {
|
||||
memcpy(out, in, size * sizeof(uint32_t) ); // assuming we are RGBA only
|
||||
firsttime = false;
|
||||
return;
|
||||
}
|
||||
|
||||
m_skip = (strobe_period * SKIP_MAX_IMAGES);
|
||||
if(m_skip_count++ < m_skip) {
|
||||
return;
|
||||
}
|
||||
m_skip_count = 0;
|
||||
|
||||
//~ m_factor = m_factor_sse2 = 0; //blink
|
||||
|
||||
unsigned int bright_factor = (bright)? 0:UINT_MAX;
|
||||
|
||||
//~ m_rgb = (fade_rgb * 8); //Fade by color layers
|
||||
m_factor = (factor * M_FACTOR_MAV); //MAgic Value ;-)
|
||||
|
||||
#ifdef __SSE2__
|
||||
// sse2 mask for fade operation
|
||||
m_factor_sse2 = 0;
|
||||
m_factor_sse2 = (flag_r==true)?(bright_factor << 24):(m_factor << 16);
|
||||
m_factor_sse2 += (flag_g==true)?(bright_factor << 16):(m_factor << 8);
|
||||
m_factor_sse2 += (flag_b==true)?(bright_factor << 8):(m_factor << 0);
|
||||
#else
|
||||
m_factor_r = (flag_r==true)?(bright_factor):(m_factor);
|
||||
m_factor_g = (flag_g==true)?(bright_factor):(m_factor);
|
||||
m_factor_b = (flag_b==true)?(bright_factor):(m_factor);
|
||||
#endif
|
||||
|
||||
//~ m_factor_r = m_factor * factor_r; //Fade by color layers
|
||||
//~ m_factor_g = m_factor * factor_g;
|
||||
//~ m_factor_b = m_factor * factor_b;
|
||||
//~ m_flag_rgb=1+flag_rgb*6;
|
||||
//~ m_flag_b = (m_flag_rgb & 1) == 1;
|
||||
//~ m_flag_g = (m_flag_rgb & 2) == 2;
|
||||
//~ m_flag_r = (m_flag_rgb & 4) == 4;
|
||||
//~ m_factor_sse2 = (m_factor << 16) + (m_factor << 8) + m_factor ;
|
||||
|
||||
if(bright) {
|
||||
for(unsigned int i = 0 ; i < size ; i+=4) {
|
||||
#ifdef __SSE2__
|
||||
tracesse2_sub(out+i, in+i);
|
||||
#else
|
||||
trace_sub(out+i, in+i);
|
||||
trace_sub(out+i+1, in+i+1);
|
||||
trace_sub(out+i+2, in+i+2);
|
||||
trace_sub(out+i+3, in+i+3);
|
||||
#endif
|
||||
}
|
||||
} else {
|
||||
for(unsigned int i = 0 ; i < size ; i+=4) {
|
||||
#ifdef __SSE2__
|
||||
tracesse2_add(out+i, in+i);
|
||||
#else
|
||||
trace_add(out+i, in+i);
|
||||
trace_add(out+i+1, in+i+1);
|
||||
trace_add(out+i+2, in+i+2);
|
||||
trace_add(out+i+3, in+i+3);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
#ifdef __SSE2__
|
||||
inline void aech0r::tracesse2_sub(uint32_t* out, const uint32_t* in) {
|
||||
__m128i aa = _mm_load_si128((__m128i*)in);
|
||||
__m128i bb = _mm_load_si128((__m128i*)out);
|
||||
// set a fade (rgb) computation
|
||||
__m128i ff = _mm_set1_epi32(m_factor_sse2);
|
||||
bb = _mm_subs_epu8(bb, ff);
|
||||
|
||||
// unsigned a < b
|
||||
__m128i tmp = _mm_cmpeq_epi8( aa, _mm_min_epu8(aa, bb));
|
||||
|
||||
// create a bit mask
|
||||
ff = _mm_cmpeq_epi32 (tmp, _mm_set1_epi8(0xff));
|
||||
|
||||
bb = _mm_or_si128 (_mm_andnot_si128 (ff, aa),_mm_and_si128 (bb,ff));
|
||||
_mm_store_si128((__m128i*)&out[0], bb);
|
||||
}
|
||||
|
||||
inline void aech0r::tracesse2_add(uint32_t* out, const uint32_t* in) {
|
||||
__m128i aa = _mm_load_si128((__m128i*)in);
|
||||
__m128i bb = _mm_load_si128((__m128i*)out);
|
||||
|
||||
// set a fade (rgb) value
|
||||
__m128i ff = _mm_set1_epi32(m_factor_sse2);
|
||||
bb = _mm_adds_epu8(bb, ff);
|
||||
|
||||
// unsigned a >= b
|
||||
__m128i tmp = _mm_cmpeq_epi8( aa, _mm_max_epu8(aa, bb));
|
||||
|
||||
// create a bit mask
|
||||
ff = _mm_cmpeq_epi32 (tmp, _mm_set1_epi8(0xff));
|
||||
|
||||
bb = _mm_or_si128 (_mm_andnot_si128 (ff, aa),_mm_and_si128 (bb,ff));
|
||||
_mm_store_si128((__m128i*)&out[0], bb);
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
inline void aech0r::trace_sub(uint32_t* out, const uint32_t* in) {
|
||||
|
||||
px_t po, pi;
|
||||
po.u = *out;
|
||||
pi.u = *in;
|
||||
|
||||
//~ po.c[0]=(m_rgb & 4)?pi.c[0]:CLAMP0255(po.c[0] - m_factor_b);//Fade by color layers
|
||||
//~ po.c[1]=(m_rgb & 2)?pi.c[1]:CLAMP0255(po.c[1] - m_factor_g);
|
||||
//~ po.c[2]=(m_rgb & 1)?pi.c[2]:CLAMP0255(po.c[2] - m_factor_r);
|
||||
//NOTA : BGR order come from Frei0r spec
|
||||
po.c[0]=(CLAMP0255(po.c[0] - m_factor_b));
|
||||
po.c[1]=(CLAMP0255(po.c[1] - m_factor_g));
|
||||
po.c[2]=(CLAMP0255(po.c[2] - m_factor_r));
|
||||
*out = po.u;
|
||||
if( (po.c[0]<=pi.c[0]) |
|
||||
(po.c[1]<=pi.c[1]) |
|
||||
(po.c[2]<=pi.c[2]) ) {
|
||||
*out = pi.u;
|
||||
}
|
||||
}
|
||||
|
||||
inline void aech0r::trace_add(uint32_t* out, const uint32_t* in) {
|
||||
|
||||
px_t po, pi;
|
||||
po.u = *out;
|
||||
pi.u = *in;
|
||||
|
||||
//NOTA : BGR order come from Frei0r spec
|
||||
po.c[0] = CLAMP0255(po.c[0] + m_factor_b);
|
||||
po.c[1] = CLAMP0255(po.c[1] + m_factor_g);
|
||||
po.c[2] = CLAMP0255(po.c[2] + m_factor_r);
|
||||
//~ po.c[0]=(m_rgb & 4)?pi.c[0]:CLAMP0255(po.c[0] + m_factor_b); //Fade by color layers
|
||||
//~ po.c[1]=(m_rgb & 2)?pi.c[1]:CLAMP0255(po.c[1] + m_factor_g);
|
||||
//~ po.c[2]=(m_rgb & 1)?pi.c[2]:CLAMP0255(po.c[2] + m_factor_r);
|
||||
*out = po.u;
|
||||
//~ if( ((po.c[0]>pi.c[0])&m_flag_b) | //Fade by color layers (why this test is here and not in trace_sub?)
|
||||
//~ ((po.c[1]>pi.c[1])&m_flag_g) |
|
||||
//~ ((po.c[2]>pi.c[2])&m_flag_r) ) {
|
||||
if( ((po.c[0]>pi.c[0])) |
|
||||
((po.c[1]>pi.c[1])) |
|
||||
((po.c[2]>pi.c[2])) ) {
|
||||
*out = pi.u;
|
||||
}
|
||||
}
|
||||
|
||||
#endif // __SSE2__
|
||||
|
||||
frei0r::construct<aech0r> plugin("aech0r",
|
||||
"analog video echo",
|
||||
"d-j-a-y & vloop",
|
||||
0,1);
|
||||
@@ -1,26 +1,27 @@
|
||||
set (O_SOURCES alpha0ps.c fibe_f.h)
|
||||
set (G_SOURCES alphagrad.c)
|
||||
set (S_SOURCES alphaspot.c)
|
||||
set (O_SOURCES alpha0ps_alpha0ps.c fibe_f.h)
|
||||
set (G_SOURCES alpha0ps_alphagrad.c)
|
||||
set (S_SOURCES alpha0ps_alphaspot.c)
|
||||
|
||||
if (MSVC)
|
||||
set_source_files_properties (alpha0ps.c alphagrad.c alphaspot.c PROPERTIES LANGUAGE CXX)
|
||||
set (O_SOURCES ${O_SOURCES} ${FREI0R_DEF})
|
||||
set (G_SOURCES ${G_SOURCES} ${FREI0R_DEF})
|
||||
set (S_SOURCES ${S_SOURCES} ${FREI0R_DEF})
|
||||
endif (MSVC)
|
||||
|
||||
add_library (alpha0ps MODULE ${O_SOURCES})
|
||||
add_library (alphagrad MODULE ${G_SOURCES})
|
||||
add_library (alphaspot MODULE ${S_SOURCES})
|
||||
add_library (alpha0ps_alpha0ps MODULE ${O_SOURCES})
|
||||
add_library (alpha0ps_alphagrad MODULE ${G_SOURCES})
|
||||
add_library (alpha0ps_alphaspot MODULE ${S_SOURCES})
|
||||
|
||||
target_link_libraries(alpha0ps -lm)
|
||||
target_link_libraries(alphagrad -lm)
|
||||
target_link_libraries(alphaspot -lm)
|
||||
if(NOT MSVC)
|
||||
target_link_libraries(alpha0ps_alpha0ps -lm)
|
||||
target_link_libraries(alpha0ps_alphagrad -lm)
|
||||
target_link_libraries(alpha0ps_alphaspot -lm)
|
||||
endif()
|
||||
|
||||
set_target_properties (alpha0ps PROPERTIES PREFIX "")
|
||||
set_target_properties (alphagrad PROPERTIES PREFIX "")
|
||||
set_target_properties (alphaspot PROPERTIES PREFIX "")
|
||||
set_target_properties (alpha0ps_alpha0ps PROPERTIES PREFIX "")
|
||||
set_target_properties (alpha0ps_alphagrad PROPERTIES PREFIX "")
|
||||
set_target_properties (alpha0ps_alphaspot PROPERTIES PREFIX "")
|
||||
|
||||
install (TARGETS alpha0ps LIBRARY DESTINATION ${LIBDIR})
|
||||
install (TARGETS alphagrad LIBRARY DESTINATION ${LIBDIR})
|
||||
install (TARGETS alphaspot LIBRARY DESTINATION ${LIBDIR})
|
||||
install (TARGETS alpha0ps_alpha0ps LIBRARY DESTINATION ${LIBDIR})
|
||||
install (TARGETS alpha0ps_alphagrad LIBRARY DESTINATION ${LIBDIR})
|
||||
install (TARGETS alpha0ps_alphaspot LIBRARY DESTINATION ${LIBDIR})
|
||||
|
||||
5
src/filter/alpha0ps/alpha0ps.c → src/filter/alpha0ps/alpha0ps_alpha0ps.c
Executable file → Normal file
5
src/filter/alpha0ps/alpha0ps.c → src/filter/alpha0ps/alpha0ps_alpha0ps.c
Executable file → Normal file
@@ -58,7 +58,7 @@ typedef struct
|
||||
float sga;
|
||||
int inv;
|
||||
|
||||
//auxilliary variables for fibe2o
|
||||
//auxiliary variables for fibe2o
|
||||
float f,q,a0,a1,a2,b0,b1,b2,rd1,rd2,rs1,rs2,rc1,rc2;
|
||||
|
||||
} inst;
|
||||
@@ -380,11 +380,12 @@ float AitNev3(int t, float xt[], float yt[], float x)
|
||||
{
|
||||
float p[10];
|
||||
int i,j,m;
|
||||
float zero = 0.0f; // MSVC doesn't allow division through a zero literal, but allows it through non-const variable set to zero
|
||||
|
||||
if ((x<xt[0])||(x>xt[t-1]))
|
||||
{
|
||||
// printf("\n\n x=%f je izven mej tabele!",x);
|
||||
return 1.0/0.0;
|
||||
return 1.0/zero;
|
||||
}
|
||||
|
||||
//poisce, katere tocke bo uporabil
|
||||
0
src/filter/alpha0ps/alphagrad.c → src/filter/alpha0ps/alpha0ps_alphagrad.c
Executable file → Normal file
0
src/filter/alpha0ps/alphagrad.c → src/filter/alpha0ps/alpha0ps_alphagrad.c
Executable file → Normal file
514
src/filter/alpha0ps/alpha0ps_alphaspot.c
Normal file
514
src/filter/alpha0ps/alpha0ps_alphaspot.c
Normal file
@@ -0,0 +1,514 @@
|
||||
/*
|
||||
alphaspot.c
|
||||
|
||||
This frei0r plugin draws simple shapes into the alpha channel
|
||||
Version 0.1 aug 2010
|
||||
|
||||
Copyright (C) 2010 Marko Cebokli http://lea.hamradio.si/~s57uuu
|
||||
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
|
||||
*/
|
||||
|
||||
|
||||
//compile: gcc -c -fPIC -Wall alphaspot.c -o alphaspot.o
|
||||
//link: gcc -shared -o alphaspot.so alphaspot.o
|
||||
|
||||
//#include <stdio.h>
|
||||
#include <frei0r.h>
|
||||
#include <frei0r/math.h>
|
||||
#include <stdlib.h>
|
||||
#include <math.h>
|
||||
#include <assert.h>
|
||||
#include <string.h>
|
||||
|
||||
|
||||
//----------------------------------------
|
||||
//struktura za instanco efekta
|
||||
typedef struct
|
||||
{
|
||||
int h;
|
||||
int w;
|
||||
|
||||
float pozx,pozy,sizx,sizy,wdt,tilt,min,max;
|
||||
int shp,op;
|
||||
|
||||
uint8_t *gr8;
|
||||
|
||||
} inst;
|
||||
|
||||
|
||||
//----------------------------------------------------------
|
||||
//general (rotated) rectangle with soft border
|
||||
void gen_rec_s(uint8_t* sl, int w, int h, float siz1, float siz2, float tilt, float pozx, float pozy, float min, float max, float wb)
|
||||
{
|
||||
int i,j;
|
||||
float d1,d2,d,db,st,ct,g,is1,is2;
|
||||
|
||||
if ((siz1 == 0.0f) || (siz2 == 0.0f)) return;
|
||||
st = sinf(tilt);
|
||||
ct = cosf(tilt);
|
||||
is1 = 1.0f/siz1;
|
||||
is2 = 1.0f/siz2;
|
||||
|
||||
for (i = 0; i < h; i++) {
|
||||
for (j = 0; j < w; j++) {
|
||||
d1 = (i-pozy)*st+(j-pozx)*ct;
|
||||
d2 = (i-pozy)*ct-(j-pozx)*st;
|
||||
d1 = fabsf(d1)*is1;
|
||||
d2 = fabsf(d2)*is2;
|
||||
d = (d1<d2)?d2:d1;
|
||||
d1 = 1.0f - (1.0f - d1)*is2/is1;
|
||||
db = (d1<d2)?d2:d1;
|
||||
if (fabsf(d) > 1.0f) {
|
||||
g = min;
|
||||
} else {
|
||||
if (db <= 1.004f - wb) {
|
||||
g = max;
|
||||
} else {
|
||||
g = min + (1.0f - wb-db)/wb*(max-min);
|
||||
}
|
||||
}
|
||||
sl[i*w+j] = lrintf(g * 255.0f);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//----------------------------------------------------------
|
||||
//general (rotated) ellipse with soft border
|
||||
void gen_eli_s(uint8_t* sl, int w, int h, float siz1, float siz2, float tilt, float pozx, float pozy, float min, float max, float wb)
|
||||
{
|
||||
int i,j;
|
||||
float d1,d2,d,db,st,ct,is1,is2,g;
|
||||
|
||||
if ((siz1 == 0.0f) || (siz2 == 0.0f)) return;
|
||||
st = sinf(tilt);
|
||||
ct = cosf(tilt);
|
||||
is1 = 1.0f/siz1;
|
||||
is2 = 1.0f/siz2;
|
||||
|
||||
for (i = 0; i < h; i++) {
|
||||
for (j = 0; j < w; j++) {
|
||||
d1 = (i-pozy)*st+(j-pozx)*ct;
|
||||
d2 = (i-pozy)*ct-(j-pozx)*st;
|
||||
d = hypotf(d1*is1,d2*is2);
|
||||
|
||||
db = d; //neenakomeren rob!!!
|
||||
|
||||
if (d > 1.0f) {
|
||||
g = min;
|
||||
} else {
|
||||
if (db <= 1.004f - wb) {
|
||||
g = max;
|
||||
} else {
|
||||
g = min + (1.0f - wb-db)/wb*(max-min);
|
||||
}
|
||||
}
|
||||
sl[i*w+j] = lrintf(g * 255.0f);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//----------------------------------------------------------
|
||||
//general (rotated) triangle with soft border
|
||||
void gen_tri_s(uint8_t* sl, int w, int h, float siz1, float siz2, float tilt, float pozx, float pozy, float min, float max, float wb)
|
||||
{
|
||||
int i,j;
|
||||
float d1,d2,d3,d4,d,st,ct,is1,is2,k5,lim,db,g;
|
||||
|
||||
if ((siz1 == 0.0f) || (siz2 == 0.0f)) return;
|
||||
st =sinf(tilt);
|
||||
ct = cosf(tilt);
|
||||
is1 = 1.0f/siz1;
|
||||
is2 = 1.0f/siz2;
|
||||
k5 = 1.0f/sqrtf(5.0f);
|
||||
lim = 0.82f;
|
||||
|
||||
for (i = 0; i < h; i++) {
|
||||
for (j = 0; j < w; j++) {
|
||||
d1 = (i-pozy)*st+(j-pozx)*ct;
|
||||
d2 = (i-pozy)*ct-(j-pozx)*st;
|
||||
d1 = d1*is1;
|
||||
d2 = d2*is2;
|
||||
d3 = (2.0f * d1+d2 + 1.0f)*k5;
|
||||
d4 = (2.0f* d1-d2 - 1.0f)*k5;
|
||||
d2 = fabsf(d2);
|
||||
d3 = fabsf(d3);
|
||||
d4 = fabsf(d4);
|
||||
d = d2;
|
||||
if (d3 > d) d=d3;
|
||||
if (d4 > d) d=d4;
|
||||
db = d;
|
||||
|
||||
if (fabsf(d) > lim) {
|
||||
g = min;
|
||||
} else {
|
||||
if (db <= 1.004f * lim-wb) {
|
||||
g = max;
|
||||
} else {
|
||||
g = min + (lim-wb-db)/wb*(max-min);
|
||||
}
|
||||
}
|
||||
sl[i*w+j] = lrintf(g * 255.0f);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//----------------------------------------------------------
|
||||
//general (rotated) diamond shape with soft border
|
||||
void gen_dia_s(uint8_t* sl, int w, int h, float siz1, float siz2, float tilt, float pozx, float pozy, float min, float max, float wb)
|
||||
{
|
||||
int i,j;
|
||||
float d1,d2,d,db,st,ct,is1,is2,g;
|
||||
|
||||
if ((siz1 == 0.0f) || (siz2 == 0.0f)) return;
|
||||
st = sinf(tilt);
|
||||
ct = cosf(tilt);
|
||||
is1 = 1.0f/siz1;
|
||||
is2 = 1.0f/siz2;
|
||||
|
||||
for (i = 0; i < h; i++) {
|
||||
for (j = 0; j < w; j++) {
|
||||
d1 = (i-pozy)*st+(j-pozx)*ct;
|
||||
d2 = (i-pozy)*ct-(j-pozx)*st;
|
||||
d = fabsf(d1*is1)+fabsf(d2*is2);
|
||||
db = d;
|
||||
if (fabsf(d) > 1.0f) {
|
||||
g = min;
|
||||
} else {
|
||||
if (db <= 1.004f - wb) {
|
||||
g = max;
|
||||
} else {
|
||||
g = min + (1.0f - wb-db)/wb*(max-min);
|
||||
}
|
||||
}
|
||||
sl[i*w+j] = lrintf(g * 255.0f);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------------------
|
||||
void draw(inst *in)
|
||||
{
|
||||
switch (in->shp)
|
||||
{
|
||||
case 0:
|
||||
gen_rec_s(in->gr8, in->w, in->h, in->sizx*in->w, in->sizy*in->h, in->tilt, in->pozx*in->w, in->pozy*in->h, in->min, in->max, in->wdt);
|
||||
break;
|
||||
case 1:
|
||||
gen_eli_s(in->gr8, in->w, in->h, in->sizx*in->w, in->sizy*in->h, in->tilt, in->pozx*in->w, in->pozy*in->h, in->min, in->max, in->wdt);
|
||||
break;
|
||||
case 2:
|
||||
gen_tri_s(in->gr8, in->w, in->h, in->sizx*in->w, in->sizy*in->h, in->tilt, in->pozx*in->w, in->pozy*in->h, in->min, in->max, in->wdt);
|
||||
break;
|
||||
case 3:
|
||||
gen_dia_s(in->gr8, in->w, in->h, in->sizx*in->w, in->sizy*in->h, in->tilt, in->pozx*in->w, in->pozy*in->h, in->min, in->max, in->wdt);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------------------
|
||||
//stretch [0...1] to parameter range [min...max] linear
|
||||
float map_value_forward(double v, float min, float max)
|
||||
{
|
||||
return min+(max-min)*v;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------
|
||||
//collapse from parameter range [min...max] to [0...1] linear
|
||||
double map_value_backward(float v, float min, float max)
|
||||
{
|
||||
return (v-min)/(max-min);
|
||||
}
|
||||
|
||||
//***********************************************
|
||||
// MANDATORY FREI0R FUNCTIONS
|
||||
|
||||
//-----------------------------------------------
|
||||
int f0r_init()
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
//------------------------------------------------
|
||||
void f0r_deinit()
|
||||
{
|
||||
}
|
||||
|
||||
//-----------------------------------------------
|
||||
void f0r_get_plugin_info(f0r_plugin_info_t* info)
|
||||
{
|
||||
|
||||
info->name = "alphaspot";
|
||||
info->author = "Marko Cebokli";
|
||||
info->plugin_type = F0R_PLUGIN_TYPE_FILTER;
|
||||
info->color_model = F0R_COLOR_MODEL_RGBA8888;
|
||||
info->frei0r_version = FREI0R_MAJOR_VERSION;
|
||||
info->major_version = 0;
|
||||
info->minor_version = 2;
|
||||
info->num_params = 10;
|
||||
info->explanation = "Draws simple shapes into the alpha channel";
|
||||
}
|
||||
|
||||
//--------------------------------------------------
|
||||
void f0r_get_param_info(f0r_param_info_t* info, int param_index)
|
||||
{
|
||||
switch(param_index) {
|
||||
case 0:
|
||||
info->name = "Shape";
|
||||
info->type = F0R_PARAM_DOUBLE;
|
||||
info->explanation = "";
|
||||
break;
|
||||
case 1:
|
||||
info->name = "Position X";
|
||||
info->type = F0R_PARAM_DOUBLE;
|
||||
info->explanation = "";
|
||||
break;
|
||||
case 2:
|
||||
info->name = "Position Y";
|
||||
info->type = F0R_PARAM_DOUBLE;
|
||||
info->explanation = "";
|
||||
break;
|
||||
case 3:
|
||||
info->name = "Size X";
|
||||
info->type = F0R_PARAM_DOUBLE;
|
||||
info->explanation = "";
|
||||
break;
|
||||
case 4:
|
||||
info->name = "Size Y";
|
||||
info->type = F0R_PARAM_DOUBLE;
|
||||
info->explanation = "";
|
||||
break;
|
||||
case 5:
|
||||
info->name = "Tilt";
|
||||
info->type = F0R_PARAM_DOUBLE;
|
||||
info->explanation = "";
|
||||
break;
|
||||
case 6:
|
||||
info->name = "Transition width";
|
||||
info->type = F0R_PARAM_DOUBLE;
|
||||
info->explanation = "";
|
||||
break;
|
||||
case 7:
|
||||
info->name = "Min";
|
||||
info->type = F0R_PARAM_DOUBLE;
|
||||
info->explanation = "";
|
||||
break;
|
||||
case 8:
|
||||
info->name = "Max";
|
||||
info->type = F0R_PARAM_DOUBLE;
|
||||
info->explanation = "";
|
||||
break;
|
||||
case 9:
|
||||
info->name = "Operation";
|
||||
info->type = F0R_PARAM_DOUBLE;
|
||||
info->explanation = "";
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
//----------------------------------------------
|
||||
f0r_instance_t f0r_construct(unsigned int width, unsigned int height)
|
||||
{
|
||||
inst *in;
|
||||
|
||||
in = calloc(1, sizeof(inst));
|
||||
in->w = width;
|
||||
in->h = height;
|
||||
|
||||
in->shp = 0;
|
||||
in->pozx = 0.5f;
|
||||
in->pozy = 0.5f;
|
||||
in->sizx = 0.1f;
|
||||
in->sizy = 0.1f;
|
||||
in->wdt = 0.2f;
|
||||
in->tilt = 0.0f;
|
||||
in->min = 0.0f;
|
||||
in->max = 1.0f;
|
||||
in->op = 0;
|
||||
|
||||
in->gr8 = calloc(in->w*in->h, sizeof(*in->gr8));
|
||||
|
||||
draw(in);
|
||||
|
||||
return (f0r_instance_t)in;
|
||||
}
|
||||
|
||||
//---------------------------------------------------
|
||||
void f0r_destruct(f0r_instance_t instance)
|
||||
{
|
||||
inst *in;
|
||||
|
||||
in = (inst*) instance;
|
||||
|
||||
free(in->gr8);
|
||||
free(instance);
|
||||
}
|
||||
|
||||
//-----------------------------------------------------
|
||||
void f0r_set_param_value(f0r_instance_t instance, f0r_param_t parm, int param_index)
|
||||
{
|
||||
inst *p;
|
||||
double tmpf;
|
||||
int tmpi,chg;
|
||||
|
||||
p = (inst*) instance;
|
||||
|
||||
chg = 0;
|
||||
switch (param_index) {
|
||||
case 0:
|
||||
tmpi = map_value_forward(*((double*)parm), 0.0f, 3.9999f);
|
||||
if (p->shp != tmpi) chg=1;
|
||||
p->shp = tmpi;
|
||||
break;
|
||||
case 1:
|
||||
tmpf = *(double*)parm;
|
||||
if (tmpf != p->pozx) chg = 1;
|
||||
p->pozx = tmpf;
|
||||
break;
|
||||
case 2:
|
||||
tmpf = *(double*)parm;
|
||||
if (tmpf != p->pozy) chg = 1;
|
||||
p->pozy = tmpf;
|
||||
break;
|
||||
case 3:
|
||||
tmpf = *(double*)parm;
|
||||
if (tmpf != p->sizx) chg = 1;
|
||||
p->sizx = tmpf;
|
||||
break;
|
||||
case 4:
|
||||
tmpf = *(double*)parm;
|
||||
if (tmpf != p->sizy) chg = 1;
|
||||
p->sizy = tmpf;
|
||||
break;
|
||||
case 5:
|
||||
tmpf = map_value_forward(*((double*)parm), -3.15f, 3.15f);
|
||||
if (tmpf != p->tilt) chg = 1;
|
||||
p->tilt = tmpf;
|
||||
break;
|
||||
case 6:
|
||||
tmpf = *(double*)parm;
|
||||
if (tmpf != p->wdt) chg = 1;
|
||||
p->wdt = tmpf;
|
||||
break;
|
||||
case 7:
|
||||
tmpf = *(double*)parm;
|
||||
if (tmpf != p->min) chg = 1;
|
||||
p->min = tmpf;
|
||||
break;
|
||||
case 8:
|
||||
tmpf = *(double*)parm;
|
||||
if (tmpf != p->max) chg = 1;
|
||||
p->max = tmpf;
|
||||
break;
|
||||
case 9:
|
||||
tmpi = map_value_forward(*((double*)parm), 0.0f, 4.9999f);
|
||||
if (p->op != tmpi) chg = 1;
|
||||
p->op = tmpi;
|
||||
break;
|
||||
}
|
||||
|
||||
if (chg == 0) return;
|
||||
|
||||
draw(p);
|
||||
|
||||
}
|
||||
|
||||
//--------------------------------------------------
|
||||
void f0r_get_param_value(f0r_instance_t instance, f0r_param_t param, int param_index)
|
||||
{
|
||||
inst *p;
|
||||
|
||||
p=(inst*)instance;
|
||||
|
||||
switch(param_index) {
|
||||
case 0:
|
||||
*((double*)param) = map_value_backward(p->shp, 0.0f, 3.9999f);
|
||||
break;
|
||||
case 1:
|
||||
*((double*)param) = p->pozx;
|
||||
break;
|
||||
case 2:
|
||||
*((double*)param) = p->pozy;
|
||||
break;
|
||||
case 3:
|
||||
*((double*)param) = p->sizx;
|
||||
break;
|
||||
case 4:
|
||||
*((double*)param) = p->sizy;
|
||||
break;
|
||||
case 5:
|
||||
*((double*)param) = map_value_backward(p->tilt, -3.15f, 3.15f);
|
||||
break;
|
||||
case 6:
|
||||
*((double*)param) = p->wdt;
|
||||
break;
|
||||
case 7:
|
||||
*((double*)param) = p->min;
|
||||
break;
|
||||
case 8:
|
||||
*((double*)param) = p->max;
|
||||
break;
|
||||
case 9:
|
||||
*((double*)param) = map_value_backward(p->op, 0.0f, 4.9999f);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
//-------------------------------------------------
|
||||
void f0r_update(f0r_instance_t instance, double time, const uint32_t* inframe, uint32_t* outframe)
|
||||
{
|
||||
inst *in;
|
||||
int i;
|
||||
uint8_t *inp = (uint8_t*) inframe;
|
||||
uint8_t *outp = (uint8_t*) outframe;
|
||||
|
||||
assert(instance);
|
||||
in = (inst*)instance;
|
||||
memcpy(outframe, inframe, sizeof(*inframe) * in->w * in->h);
|
||||
|
||||
switch (in->op) {
|
||||
case 0: //write on clear
|
||||
for (i = 0; i < in->h*in->w; i++) {
|
||||
outp[4*i+3] = in->gr8[i];
|
||||
}
|
||||
break;
|
||||
case 1: //max
|
||||
for (i = 0; i < in->h*in->w; i++) {
|
||||
outp[4*i+3] = (inp[4*i+3] > in->gr8[i]) ? inp[4*i+3] : in->gr8[i];
|
||||
}
|
||||
break;
|
||||
case 2: //min
|
||||
for (i = 0; i < in->h*in->w; i++) {
|
||||
outp[4*i+3] = (inp[4*i+3] < in->gr8[i]) ? inp[4*i+3] : in->gr8[i];
|
||||
}
|
||||
break;
|
||||
case 3: //add
|
||||
for (i = 0;i < in->h*in->w; i++) {
|
||||
outp[4*i+3] = MAX255(inp[4*i+3] + in->gr8[i]);
|
||||
}
|
||||
break;
|
||||
case 4: //subtract
|
||||
for (i = 0; i < in->h*in->w; i++) {
|
||||
outp[4*i+3] = (inp[4*i+3] > in->gr8[i]) ? inp[4*i+3] - in->gr8[i] : 0;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -1,538 +0,0 @@
|
||||
/*
|
||||
alphaspot.c
|
||||
|
||||
This frei0r plugin draws simple shapes into the alpha channel
|
||||
Version 0.1 aug 2010
|
||||
|
||||
Copyright (C) 2010 Marko Cebokli http://lea.hamradio.si/~s57uuu
|
||||
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
|
||||
*/
|
||||
|
||||
|
||||
//compile: gcc -c -fPIC -Wall alphaspot.c -o alphaspot.o
|
||||
//link: gcc -shared -o alphaspot.so alphaspot.o
|
||||
|
||||
//#include <stdio.h>
|
||||
#include <frei0r.h>
|
||||
#include <stdlib.h>
|
||||
#include <math.h>
|
||||
#include <assert.h>
|
||||
|
||||
|
||||
|
||||
//----------------------------------------
|
||||
//struktura za instanco efekta
|
||||
typedef struct
|
||||
{
|
||||
int h;
|
||||
int w;
|
||||
|
||||
float pozx,pozy,sizx,sizy,wdt,tilt,min,max;
|
||||
int shp,op;
|
||||
|
||||
uint32_t *gr8;
|
||||
|
||||
} inst;
|
||||
|
||||
|
||||
//----------------------------------------------------------
|
||||
//general (rotated) rectangle with soft border
|
||||
void gen_rec_s(uint32_t* sl, int w, int h, float siz1, float siz2, float tilt, float pozx, float pozy, float min, float max, float wb)
|
||||
{
|
||||
int i,j;
|
||||
float d1,d2,d,db,st,ct,g,is1,is2;
|
||||
|
||||
if ((siz1==0.0)||(siz2==0.0)) return;
|
||||
st=sinf(tilt);
|
||||
ct=cosf(tilt);
|
||||
is1=1.0/siz1;
|
||||
is2=1.0/siz2;
|
||||
|
||||
for (i=0;i<h;i++)
|
||||
for (j=0;j<w;j++)
|
||||
{
|
||||
d1=(i-pozy)*st+(j-pozx)*ct;
|
||||
d2=(i-pozy)*ct-(j-pozx)*st;
|
||||
d1=fabsf(d1)*is1;
|
||||
d2=fabsf(d2)*is2;
|
||||
d=(d1<d2)?d2:d1;
|
||||
d1=1.0-(1.0-d1)*is2/is1;
|
||||
db=(d1<d2)?d2:d1;
|
||||
if (fabsf(d)>1.0)
|
||||
g=min;
|
||||
else
|
||||
{
|
||||
if (db<=1.004-wb)
|
||||
g=max;
|
||||
else
|
||||
{
|
||||
g=min+(1.0-wb-db)/wb*(max-min);
|
||||
}
|
||||
}
|
||||
g=g*255.0;
|
||||
sl[i*w+j] = (((uint32_t)g)<<24)&0xFF000000;
|
||||
}
|
||||
}
|
||||
|
||||
//----------------------------------------------------------
|
||||
//general (rotated) ellipse with soft border
|
||||
void gen_eli_s(uint32_t* sl, int w, int h, float siz1, float siz2, float tilt, float pozx, float pozy, float min, float max, float wb)
|
||||
{
|
||||
int i,j;
|
||||
float d1,d2,d,db,st,ct,is1,is2,g,wbb;
|
||||
|
||||
if ((siz1==0.0)||(siz2==0.0)) return;
|
||||
st=sinf(tilt);
|
||||
ct=cosf(tilt);
|
||||
is1=1.0/siz1;
|
||||
is2=1.0/siz2;
|
||||
wbb=wb;
|
||||
|
||||
for (i=0;i<h;i++)
|
||||
for (j=0;j<w;j++)
|
||||
{
|
||||
d1=(i-pozy)*st+(j-pozx)*ct;
|
||||
d2=(i-pozy)*ct-(j-pozx)*st;
|
||||
d=hypotf(d1*is1,d2*is2);
|
||||
|
||||
db=d; //neenakomeren rob!!!
|
||||
|
||||
if (d>1.0)
|
||||
g=min;
|
||||
else
|
||||
{
|
||||
if (db<=1.004-wb)
|
||||
g=max;
|
||||
else
|
||||
{
|
||||
g=min+(1.0-wb-db)/wb*(max-min);
|
||||
}
|
||||
}
|
||||
g=g*255.0;
|
||||
sl[i*w+j] = (((uint32_t)g)<<24)&0xFF000000;
|
||||
}
|
||||
}
|
||||
|
||||
//----------------------------------------------------------
|
||||
//general (rotated) triangle with soft border
|
||||
void gen_tri_s(uint32_t* sl, int w, int h, float siz1, float siz2, float tilt, float pozx, float pozy, float min, float max, float wb)
|
||||
{
|
||||
int i,j;
|
||||
float d1,d2,d3,d4,d,st,ct,is1,is2,k5,lim,db,g;
|
||||
|
||||
if ((siz1==0.0)||(siz2==0.0)) return;
|
||||
st=sinf(tilt);
|
||||
ct=cosf(tilt);
|
||||
is1=1.0/siz1;
|
||||
is2=1.0/siz2;
|
||||
k5=1.0/sqrtf(5.0);
|
||||
lim=0.82;
|
||||
|
||||
for (i=0;i<h;i++)
|
||||
for (j=0;j<w;j++)
|
||||
{
|
||||
d1=(i-pozy)*st+(j-pozx)*ct;
|
||||
d2=(i-pozy)*ct-(j-pozx)*st;
|
||||
d1=d1*is1;
|
||||
d2=d2*is2;
|
||||
d3=(2.0*d1+d2+1.0)*k5;
|
||||
d4=(2.0*d1-d2-1.0)*k5;
|
||||
d2=fabsf(d2);
|
||||
d3=fabsf(d3);
|
||||
d4=fabsf(d4);
|
||||
d=d2;
|
||||
if (d3>d) d=d3;
|
||||
if (d4>d) d=d4;
|
||||
db=d;
|
||||
|
||||
if (fabsf(d)>lim)
|
||||
g=min;
|
||||
else
|
||||
{
|
||||
if (db<=1.004*lim-wb)
|
||||
g=max;
|
||||
else
|
||||
{
|
||||
g=min+(lim-wb-db)/wb*(max-min);
|
||||
}
|
||||
}
|
||||
g=g*255.0;
|
||||
sl[i*w+j] = (((uint32_t)g)<<24)&0xFF000000;
|
||||
}
|
||||
}
|
||||
|
||||
//----------------------------------------------------------
|
||||
//general (rotated) diamond shape with soft border
|
||||
void gen_dia_s(uint32_t* sl, int w, int h, float siz1, float siz2, float tilt, float pozx, float pozy, float min, float max, float wb)
|
||||
{
|
||||
int i,j;
|
||||
float d1,d2,d,db,st,ct,is1,is2,g;
|
||||
|
||||
if ((siz1==0.0)||(siz2==0.0)) return;
|
||||
st=sinf(tilt);
|
||||
ct=cosf(tilt);
|
||||
is1=1.0/siz1;
|
||||
is2=1.0/siz2;
|
||||
|
||||
for (i=0;i<h;i++)
|
||||
for (j=0;j<w;j++)
|
||||
{
|
||||
d1=(i-pozy)*st+(j-pozx)*ct;
|
||||
d2=(i-pozy)*ct-(j-pozx)*st;
|
||||
d=fabsf(d1*is1)+fabsf(d2*is2);
|
||||
db=d;
|
||||
if (fabsf(d)>1.0)
|
||||
g=min;
|
||||
else
|
||||
{
|
||||
if (db<=1.004-wb)
|
||||
g=max;
|
||||
else
|
||||
{
|
||||
g=min+(1.0-wb-db)/wb*(max-min);
|
||||
}
|
||||
}
|
||||
g=g*255.0;
|
||||
sl[i*w+j] = (((uint32_t)g)<<24)&0xFF000000;
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------------------
|
||||
void draw(inst *in)
|
||||
{
|
||||
switch (in->shp)
|
||||
{
|
||||
case 0:
|
||||
gen_rec_s(in->gr8, in->w, in->h, in->sizx*in->w, in->sizy*in->h, in->tilt, in->pozx*in->w, in->pozy*in->h, in->min, in->max, in->wdt);
|
||||
break;
|
||||
case 1:
|
||||
gen_eli_s(in->gr8, in->w, in->h, in->sizx*in->w, in->sizy*in->h, in->tilt, in->pozx*in->w, in->pozy*in->h, in->min, in->max, in->wdt);
|
||||
break;
|
||||
case 2:
|
||||
gen_tri_s(in->gr8, in->w, in->h, in->sizx*in->w, in->sizy*in->h, in->tilt, in->pozx*in->w, in->pozy*in->h, in->min, in->max, in->wdt);
|
||||
break;
|
||||
case 3:
|
||||
gen_dia_s(in->gr8, in->w, in->h, in->sizx*in->w, in->sizy*in->h, in->tilt, in->pozx*in->w, in->pozy*in->h, in->min, in->max, in->wdt);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------------------
|
||||
//stretch [0...1] to parameter range [min...max] linear
|
||||
float map_value_forward(double v, float min, float max)
|
||||
{
|
||||
return min+(max-min)*v;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------
|
||||
//collapse from parameter range [min...max] to [0...1] linear
|
||||
double map_value_backward(float v, float min, float max)
|
||||
{
|
||||
return (v-min)/(max-min);
|
||||
}
|
||||
|
||||
//***********************************************
|
||||
// OBVEZNE FREI0R FUNKCIJE
|
||||
|
||||
//-----------------------------------------------
|
||||
int f0r_init()
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
//------------------------------------------------
|
||||
void f0r_deinit()
|
||||
{
|
||||
}
|
||||
|
||||
//-----------------------------------------------
|
||||
void f0r_get_plugin_info(f0r_plugin_info_t* info)
|
||||
{
|
||||
|
||||
info->name="alphaspot";
|
||||
info->author="Marko Cebokli";
|
||||
info->plugin_type=F0R_PLUGIN_TYPE_FILTER;
|
||||
info->color_model=F0R_COLOR_MODEL_RGBA8888;
|
||||
info->frei0r_version=FREI0R_MAJOR_VERSION;
|
||||
info->major_version=0;
|
||||
info->minor_version=1;
|
||||
info->num_params=10;
|
||||
info->explanation="Draws simple shapes into the alpha channel";
|
||||
}
|
||||
|
||||
//--------------------------------------------------
|
||||
void f0r_get_param_info(f0r_param_info_t* info, int param_index)
|
||||
{
|
||||
switch(param_index)
|
||||
{
|
||||
case 0:
|
||||
info->name = "Shape";
|
||||
info->type = F0R_PARAM_DOUBLE;
|
||||
info->explanation = "";
|
||||
break;
|
||||
case 1:
|
||||
info->name = "Position X";
|
||||
info->type = F0R_PARAM_DOUBLE;
|
||||
info->explanation = "";
|
||||
break;
|
||||
case 2:
|
||||
info->name = "Position Y";
|
||||
info->type = F0R_PARAM_DOUBLE;
|
||||
info->explanation = "";
|
||||
break;
|
||||
case 3:
|
||||
info->name = "Size X";
|
||||
info->type = F0R_PARAM_DOUBLE;
|
||||
info->explanation = "";
|
||||
break;
|
||||
case 4:
|
||||
info->name = "Size Y";
|
||||
info->type = F0R_PARAM_DOUBLE;
|
||||
info->explanation = "";
|
||||
break;
|
||||
case 5:
|
||||
info->name = "Tilt";
|
||||
info->type = F0R_PARAM_DOUBLE;
|
||||
info->explanation = "";
|
||||
break;
|
||||
case 6:
|
||||
info->name = "Transition width";
|
||||
info->type = F0R_PARAM_DOUBLE;
|
||||
info->explanation = "";
|
||||
break;
|
||||
case 7:
|
||||
info->name = "Min";
|
||||
info->type = F0R_PARAM_DOUBLE;
|
||||
info->explanation = "";
|
||||
break;
|
||||
case 8:
|
||||
info->name = "Max";
|
||||
info->type = F0R_PARAM_DOUBLE;
|
||||
info->explanation = "";
|
||||
break;
|
||||
case 9:
|
||||
info->name = "Operation";
|
||||
info->type = F0R_PARAM_DOUBLE;
|
||||
info->explanation = "";
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
//----------------------------------------------
|
||||
f0r_instance_t f0r_construct(unsigned int width, unsigned int height)
|
||||
{
|
||||
inst *in;
|
||||
|
||||
in=calloc(1,sizeof(inst));
|
||||
in->w=width;
|
||||
in->h=height;
|
||||
|
||||
in->shp=0;
|
||||
in->pozx=0.5;
|
||||
in->pozy=0.5;
|
||||
in->sizx=0.1;
|
||||
in->sizy=0.1;
|
||||
in->wdt=0.2;
|
||||
in->tilt=0.0;
|
||||
in->min=0.0;
|
||||
in->max=1.0;
|
||||
in->op=0;
|
||||
|
||||
in->gr8 = (uint32_t*)calloc(in->w*in->h, sizeof(uint32_t));
|
||||
|
||||
draw(in);
|
||||
|
||||
return (f0r_instance_t)in;
|
||||
}
|
||||
|
||||
//---------------------------------------------------
|
||||
void f0r_destruct(f0r_instance_t instance)
|
||||
{
|
||||
inst *in;
|
||||
|
||||
in=(inst*)instance;
|
||||
|
||||
free(in->gr8);
|
||||
free(instance);
|
||||
}
|
||||
|
||||
//-----------------------------------------------------
|
||||
void f0r_set_param_value(f0r_instance_t instance, f0r_param_t parm, int param_index)
|
||||
{
|
||||
inst *p;
|
||||
double tmpf;
|
||||
int tmpi,chg;
|
||||
|
||||
p=(inst*)instance;
|
||||
|
||||
chg=0;
|
||||
switch(param_index)
|
||||
{
|
||||
case 0:
|
||||
tmpi=map_value_forward(*((double*)parm), 0.0, 3.9999);
|
||||
if (p->shp != tmpi) chg=1;
|
||||
p->shp=tmpi;
|
||||
break;
|
||||
case 1:
|
||||
tmpf=*(double*)parm;
|
||||
if (tmpf!=p->pozx) chg=1;
|
||||
p->pozx=tmpf;
|
||||
break;
|
||||
case 2:
|
||||
tmpf=*(double*)parm;
|
||||
if (tmpf!=p->pozy) chg=1;
|
||||
p->pozy=tmpf;
|
||||
break;
|
||||
case 3:
|
||||
tmpf=*(double*)parm;
|
||||
if (tmpf!=p->sizx) chg=1;
|
||||
p->sizx=tmpf;
|
||||
break;
|
||||
case 4:
|
||||
tmpf=*(double*)parm;
|
||||
if (tmpf!=p->sizy) chg=1;
|
||||
p->sizy=tmpf;
|
||||
break;
|
||||
case 5:
|
||||
tmpf=map_value_forward(*((double*)parm), -3.15, 3.15);
|
||||
if (tmpf!=p->tilt) chg=1;
|
||||
p->tilt=tmpf;
|
||||
break;
|
||||
case 6:
|
||||
tmpf=*(double*)parm;
|
||||
if (tmpf!=p->wdt) chg=1;
|
||||
p->wdt=tmpf;
|
||||
break;
|
||||
case 7:
|
||||
tmpf=*(double*)parm;
|
||||
if (tmpf!=p->min) chg=1;
|
||||
p->min=tmpf;
|
||||
break;
|
||||
case 8:
|
||||
tmpf=*(double*)parm;
|
||||
if (tmpf!=p->max) chg=1;
|
||||
p->max=tmpf;
|
||||
break;
|
||||
case 9:
|
||||
tmpi=map_value_forward(*((double*)parm), 0.0, 4.9999);
|
||||
if (p->op != tmpi) chg=1;
|
||||
p->op=tmpi;
|
||||
break;
|
||||
}
|
||||
|
||||
if (chg==0) return;
|
||||
|
||||
draw(p);
|
||||
|
||||
}
|
||||
|
||||
//--------------------------------------------------
|
||||
void f0r_get_param_value(f0r_instance_t instance, f0r_param_t param, int param_index)
|
||||
{
|
||||
inst *p;
|
||||
|
||||
p=(inst*)instance;
|
||||
|
||||
switch(param_index)
|
||||
{
|
||||
case 0:
|
||||
*((double*)param)=map_value_backward(p->shp, 0.0, 3.9999);
|
||||
break;
|
||||
case 1:
|
||||
*((double*)param)=p->pozx;
|
||||
break;
|
||||
case 2:
|
||||
*((double*)param)=p->pozy;
|
||||
break;
|
||||
case 3:
|
||||
*((double*)param)=p->sizx;
|
||||
break;
|
||||
case 4:
|
||||
*((double*)param)=p->sizy;
|
||||
break;
|
||||
case 5:
|
||||
*((double*)param)=map_value_backward(p->tilt, -3.15, 3.15);
|
||||
break;
|
||||
case 6:
|
||||
*((double*)param)=p->wdt;
|
||||
break;
|
||||
case 7:
|
||||
*((double*)param)=p->min;
|
||||
break;
|
||||
case 8:
|
||||
*((double*)param)=p->max;
|
||||
break;
|
||||
case 9:
|
||||
*((double*)param)=map_value_backward(p->op, 0.0, 4.9999);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
//-------------------------------------------------
|
||||
void f0r_update(f0r_instance_t instance, double time, const uint32_t* inframe, uint32_t* outframe)
|
||||
{
|
||||
inst *in;
|
||||
int i;
|
||||
uint32_t t;
|
||||
|
||||
assert(instance);
|
||||
in=(inst*)instance;
|
||||
|
||||
switch (in->op)
|
||||
{
|
||||
case 0: //write on clear
|
||||
for (i=0;i<in->h*in->w;i++)
|
||||
outframe[i] = (inframe[i]&0x00FFFFFF) | in->gr8[i];
|
||||
break;
|
||||
case 1: //max
|
||||
for (i=0;i<in->h*in->w;i++)
|
||||
{
|
||||
t=((inframe[i]&0xFF000000)>in->gr8[i]) ? inframe[i]&0xFF000000 : in->gr8[i];
|
||||
outframe[i] = (inframe[i]&0x00FFFFFF) | t;
|
||||
}
|
||||
break;
|
||||
case 2: //min
|
||||
for (i=0;i<in->h*in->w;i++)
|
||||
{
|
||||
t=((inframe[i]&0xFF000000)<in->gr8[i]) ? inframe[i]&0xFF000000 : in->gr8[i];
|
||||
outframe[i] = (inframe[i]&0x00FFFFFF) | t;
|
||||
}
|
||||
break;
|
||||
case 3: //add
|
||||
for (i=0;i<in->h*in->w;i++)
|
||||
{
|
||||
t=((inframe[i]&0xFF000000)>>1)+(in->gr8[i]>>1);
|
||||
t = (t>0x7F800000) ? 0xFF000000 : t<<1;
|
||||
outframe[i] = (inframe[i]&0x00FFFFFF) | t;
|
||||
}
|
||||
break;
|
||||
case 4: //subtract
|
||||
for (i=0;i<in->h*in->w;i++)
|
||||
{
|
||||
t= ((inframe[i]&0xFF000000)>in->gr8[i]) ? (inframe[i]&0xFF000000)-in->gr8[i] : 0;
|
||||
outframe[i] = (inframe[i]&0x00FFFFFF) | t;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
//**********************************************************
|
||||
@@ -2,7 +2,6 @@ set (SOURCES balanc0r.c)
|
||||
set (TARGET balanc0r)
|
||||
|
||||
if (MSVC)
|
||||
set_source_files_properties (balanc0r.c PROPERTIES LANGUAGE CXX)
|
||||
set (SOURCES ${SOURCES} ${FREI0R_DEF})
|
||||
endif (MSVC)
|
||||
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
#include <stdio.h>
|
||||
|
||||
#include "frei0r.h"
|
||||
#include "frei0r_math.h"
|
||||
#include "frei0r/math.h"
|
||||
|
||||
static const float bbWB[][3] =
|
||||
{
|
||||
|
||||
@@ -2,7 +2,6 @@ set (SOURCES bgsubtract0r.c)
|
||||
set (TARGET bgsubtract0r)
|
||||
|
||||
if (MSVC)
|
||||
set_source_files_properties (bgsubtract0r.c PROPERTIES LANGUAGE CXX)
|
||||
set (SOURCES ${SOURCES} ${FREI0R_DEF})
|
||||
endif (MSVC)
|
||||
|
||||
|
||||
@@ -34,6 +34,7 @@ class bluescreen0r : public frei0r::filter
|
||||
private:
|
||||
double dist;
|
||||
f0r_param_color color;
|
||||
bool invert;
|
||||
uint32_t r256,g256,b256;
|
||||
|
||||
// returns the distance to 'color', but does not normalize
|
||||
@@ -57,9 +58,12 @@ public:
|
||||
color.r = 0;
|
||||
color.g = 0.94;
|
||||
color.b = 0;
|
||||
|
||||
|
||||
invert = false;
|
||||
|
||||
register_param(color, "Color", "The color to make transparent (B G R)");
|
||||
register_param(dist, "Distance", "Distance to Color (127 is good)");
|
||||
register_param(dist, "Distance", "Distance to Color (127 is good)");
|
||||
register_param(invert, "Invert", "Whether to produce the inverse of the effect on the alpha channel");
|
||||
}
|
||||
|
||||
virtual void update(double time,
|
||||
@@ -86,6 +90,7 @@ public:
|
||||
a = 256*(d-distInt2)/distInt2;
|
||||
}
|
||||
}
|
||||
if (invert) a = 255 - a;
|
||||
*outpixel |= (a<<24);
|
||||
|
||||
++outpixel;
|
||||
@@ -95,5 +100,5 @@ public:
|
||||
};
|
||||
|
||||
|
||||
frei0r::construct<bluescreen0r> plugin("bluescreen0r", "Color to alpha (blit SRCALPHA)", "Hedde Bosman",0,3,F0R_COLOR_MODEL_RGBA8888);
|
||||
frei0r::construct<bluescreen0r> plugin("bluescreen0r", "Color to alpha (blit SRCALPHA)", "Hedde Bosman",0,4,F0R_COLOR_MODEL_RGBA8888);
|
||||
|
||||
|
||||
@@ -2,11 +2,12 @@ set (SOURCES IIRblur.c fibe.h)
|
||||
set (TARGET IIRblur)
|
||||
|
||||
if (MSVC)
|
||||
set_source_files_properties (IIRblur.c PROPERTIES LANGUAGE CXX)
|
||||
set (SOURCES ${SOURCES} ${FREI0R_DEF})
|
||||
endif (MSVC)
|
||||
|
||||
link_libraries(m)
|
||||
if(NOT MSVC)
|
||||
link_libraries(m)
|
||||
endif()
|
||||
add_library (${TARGET} MODULE ${SOURCES})
|
||||
set_target_properties (${TARGET} PROPERTIES PREFIX "")
|
||||
|
||||
|
||||
3
src/filter/blur/IIRblur.c
Executable file → Normal file
3
src/filter/blur/IIRblur.c
Executable file → Normal file
@@ -80,11 +80,12 @@ float AitNev3(int t, float xt[], float yt[], float x)
|
||||
{
|
||||
float p[10];
|
||||
int i,j,m;
|
||||
float zero = 0.0f; // MSVC doesn't allow division through a zero literal, but allows it through non-const variable set to zero
|
||||
|
||||
if ((x<xt[0])||(x>xt[t-1]))
|
||||
{
|
||||
// printf("\n\n x=%f je izven mej tabele!",x);
|
||||
return 1.0/0.0;
|
||||
return 1.0/zero;
|
||||
}
|
||||
|
||||
//poisce, katere tocke bo uporabil
|
||||
|
||||
@@ -105,7 +105,7 @@ The algorithms are very simple, but the code is a bit bloated,
|
||||
because I did some optimizations for speed.
|
||||
The algorithms are so simple, that using SSE didn't bring
|
||||
much speedup - the limiting factor is memory bandwidth, not
|
||||
arithmetics. Therefore I decided not to include the SSE versions.
|
||||
arithmetic. Therefore I decided not to include the SSE versions.
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -35,13 +35,13 @@ Copyright (C) 2011 Marko Cebokli http://lea.hamradio.si/~s57uuu
|
||||
CONTENTS OF FIBE.H FILE:
|
||||
--------------------------------
|
||||
|
||||
calcab_lp1() auxilliary function to calculate lowpass
|
||||
calcab_lp1() auxiliary function to calculate lowpass
|
||||
tap coefficients for FIBE-2
|
||||
|
||||
young_vliet() auxilliary function to calculate tap coefs
|
||||
young_vliet() auxiliary function to calculate tap coefs
|
||||
for Gauss approximation with FIBE-3
|
||||
|
||||
rep() auxilliary function to calculate wraparound
|
||||
rep() auxiliary function to calculate wraparound
|
||||
values for FIBE-2
|
||||
|
||||
fibe1o_8() one tap quadrilateral IIR filter
|
||||
@@ -69,7 +69,7 @@ and therefore time consuming "walks" through memory.
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <string.h>
|
||||
#include "frei0r_math.h"
|
||||
#include "frei0r/math.h"
|
||||
|
||||
//---------------------------------------------------------
|
||||
//koeficienti za biquad lowpass iz f in q
|
||||
|
||||
@@ -2,7 +2,6 @@ set (SOURCES brightness.c)
|
||||
set (TARGET brightness)
|
||||
|
||||
if (MSVC)
|
||||
set_source_files_properties (brightness.c PROPERTIES LANGUAGE CXX)
|
||||
set (SOURCES ${SOURCES} ${FREI0R_DEF})
|
||||
endif (MSVC)
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
#include <assert.h>
|
||||
|
||||
#include "frei0r.h"
|
||||
#include "frei0r_math.h"
|
||||
#include "frei0r/math.h"
|
||||
|
||||
typedef struct brightness_instance
|
||||
{
|
||||
@@ -107,7 +107,7 @@ void f0r_set_param_value(f0r_instance_t instance,
|
||||
{
|
||||
int val;
|
||||
case 0:
|
||||
/* constrast */
|
||||
/* contrast */
|
||||
val = (int) ((*((double*)param) - 0.5) * 512.0); /* remap to [-256, 256] */
|
||||
if (val != inst->brightness)
|
||||
{
|
||||
|
||||
@@ -2,7 +2,6 @@ set (SOURCES bw0r.c)
|
||||
set (TARGET bw0r)
|
||||
|
||||
if (MSVC)
|
||||
set_source_files_properties (bw0r.c PROPERTIES LANGUAGE CXX)
|
||||
set (SOURCES ${SOURCES} ${FREI0R_DEF})
|
||||
endif (MSVC)
|
||||
|
||||
|
||||
@@ -2,7 +2,6 @@ set (SOURCES c0rners.c interp.h)
|
||||
set (TARGET c0rners)
|
||||
|
||||
if (MSVC)
|
||||
set_source_files_properties (c0rners.c PROPERTIES LANGUAGE CXX)
|
||||
set (SOURCES ${SOURCES} ${FREI0R_DEF})
|
||||
endif (MSVC)
|
||||
|
||||
|
||||
@@ -89,7 +89,7 @@ The supplied Kdenlive effect description XML file should change this range to
|
||||
left corner x=1000, y=1000, the upper right corner x=2000, y=1000 and so on. It
|
||||
should also set the defaults so that the undistorted input picture is displayed.
|
||||
If you have no image, check that the corners specify a nonzero area at least
|
||||
partly overlaping the output window.
|
||||
partly overlapping the output window.
|
||||
|
||||
2. Stretch, x and y
|
||||
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
#include <frei0r.h>
|
||||
#include <string.h>
|
||||
#include <math.h>
|
||||
#include "frei0r_math.h"
|
||||
#include "frei0r/math.h"
|
||||
#include "interp.h"
|
||||
|
||||
//----------------------------------------
|
||||
@@ -78,16 +78,15 @@ typedef struct //premica v ravnini
|
||||
float p;
|
||||
} premica2;
|
||||
|
||||
//------------------------------------------------------
|
||||
//premica skozi dve tocki v ravnini (2D)
|
||||
//izracuna a,b,c za enacbo premice: ax + by + c = 0
|
||||
//ps se sin a, cos a in p za normalno obliko
|
||||
//vrne: (return value)
|
||||
//-10 ce ni mozno dolociti p. (tocki sovpadata) coincident points
|
||||
//0 splosna p. general case
|
||||
//+1 navpicna p. x v *a vertical
|
||||
//+2 vodoravna p. y v *b horizontal
|
||||
//a line through two points
|
||||
// line through two points in the plane (2D)
|
||||
// calculate a, b, c for the equation of the line: ax + by + c = 0
|
||||
// ps se sin a, cos a and p for normal form
|
||||
// return: (return value)
|
||||
// - 10 if it is not possible to determine p. coincident points
|
||||
// 0 general p. general case
|
||||
// + 1 vertical p. x v * a vertical
|
||||
// + 2 horizontal p. y v * b horizontal
|
||||
// a line through two points
|
||||
int premica2d(tocka2 t1, tocka2 t2, premica2 *p)
|
||||
{
|
||||
float dx,dy,m;
|
||||
@@ -131,10 +130,10 @@ int premica2d(tocka2 t1, tocka2 t2, premica2 *p)
|
||||
return 0;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------
|
||||
//razdalja tocke od premice (za alpha feather)
|
||||
//distance between a point and a line
|
||||
//needed only for alpha feathering
|
||||
// ------------------------------------------------ -----
|
||||
// point distance from line (for alpha feather)
|
||||
// distance between a point and a line
|
||||
// needed only for alpha feathering
|
||||
float razd_t_p(tocka2 t, premica2 p)
|
||||
{
|
||||
float r;
|
||||
@@ -144,12 +143,12 @@ float razd_t_p(tocka2 t, premica2 p)
|
||||
return r;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------
|
||||
//presecisce dveh premic v ravnini (2D)
|
||||
//vrne:
|
||||
//0 ce je vse OK
|
||||
//-1 ce sta premici vzporedni
|
||||
//intersection of two lines
|
||||
// ------------------------------------------------ -----
|
||||
// intersection of two lines in a plane (2D)
|
||||
// return:
|
||||
// 0 if everything is OK
|
||||
// - 1 if the lines are parallel
|
||||
// intersection of two lines
|
||||
int presecisce2(premica2 p1, premica2 p2, tocka2 *t)
|
||||
{
|
||||
float d1,d2,d3;
|
||||
@@ -166,13 +165,13 @@ int presecisce2(premica2 p1, premica2 p2, tocka2 *t)
|
||||
return 0;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------
|
||||
//generate mapping for a general quadrangle
|
||||
//wi,hi = input image size
|
||||
//wo,ho = output image size
|
||||
//vog[] = the four corners
|
||||
//str: 0=no stretch 1=do stretch
|
||||
//strx,stry: stretch values [0...1] 0.5 = no stretch
|
||||
// ------------------------------------------------ ---------------
|
||||
// generate mapping for a general quadrangle
|
||||
// wi, hi = input image size
|
||||
// wo, ho = output image size
|
||||
// vog [] = the four corners
|
||||
// str: 0 = no stretch 1 = do stretch
|
||||
// strx, stry: stretch values [0 ... 1] 0.5 = no stretch
|
||||
void cetverokotnik4(int wi, int hi, int wo, int ho, tocka2 vog[], int str, float strx, float stry, float *map)
|
||||
{
|
||||
double a,b,c,d,e,f,g,h,a2,b2,c2,u,v,aa,bb,de,sde,v1,v2,u1,u2;
|
||||
@@ -477,14 +476,14 @@ void apply_alphamap(uint32_t* frame, int w, int h, unsigned char *amap, int oper
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------
|
||||
//funkcija za byte polja (char)
|
||||
//generate map from the four corners
|
||||
//first checks for different types of degenerate geometrty...
|
||||
//wi,hi input image size
|
||||
//wo,ho output image size
|
||||
//vog[] the four corners
|
||||
//nots[] "inner" sides (for alpha feathering)
|
||||
// ------------------------------------------------ ---------------
|
||||
// function for byte fields (char)
|
||||
// generate map from the four corners
|
||||
// first checks for different types of degenerate geometrty ...
|
||||
// wi, hi input image size
|
||||
// wo, ho output image size
|
||||
// vog [] the four corners
|
||||
// nots [] "inner" sides (for alpha feathering)
|
||||
int geom4c_b(int wi, int hi, int wo, int ho, tocka2 vog[], int str, float strx, float stry, float *map, int nots[])
|
||||
{
|
||||
premica2 p12,p23,p34,p41;
|
||||
@@ -974,6 +973,8 @@ void f0r_get_param_value(f0r_instance_t instance, f0r_param_t param, int param_i
|
||||
}
|
||||
}
|
||||
|
||||
#define EPSILON 1e-5f
|
||||
#define EQUIVALENT_FLOATS(x, y) (fabsf((x) - (y)) < EPSILON)
|
||||
|
||||
//-------------------------------------------------
|
||||
void f0r_update(f0r_instance_t instance, double time, const uint32_t* inframe, uint32_t* outframe)
|
||||
@@ -983,6 +984,22 @@ void f0r_update(f0r_instance_t instance, double time, const uint32_t* inframe, u
|
||||
|
||||
p=(inst*)instance;
|
||||
|
||||
if (EQUIVALENT_FLOATS(p->x1, 0.333333f) &&
|
||||
EQUIVALENT_FLOATS(p->y1, 0.333333f) &&
|
||||
EQUIVALENT_FLOATS(p->x2, 0.666666f) &&
|
||||
EQUIVALENT_FLOATS(p->y2, 0.333333f) &&
|
||||
EQUIVALENT_FLOATS(p->x3, 0.666666f) &&
|
||||
EQUIVALENT_FLOATS(p->y3, 0.666666f) &&
|
||||
EQUIVALENT_FLOATS(p->x4, 0.333333f) &&
|
||||
EQUIVALENT_FLOATS(p->y4, 0.666666f) &&
|
||||
(!p->stretchON || (
|
||||
EQUIVALENT_FLOATS(p->stretchx, 0.5f) &&
|
||||
EQUIVALENT_FLOATS(p->stretchy, 0.5f))))
|
||||
{
|
||||
memcpy(outframe, inframe, p->w * p->h * 4);
|
||||
return;
|
||||
}
|
||||
|
||||
if (p->mapIsDirty) {
|
||||
tocka2 vog[4];
|
||||
int nots[4];
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
*/
|
||||
|
||||
/*******************************************************************
|
||||
* The remapping functions use a map aray, which contains a pair
|
||||
* The remapping functions use a map array, which contains a pair
|
||||
* of floating values fo each pixel of the output image. These
|
||||
* represent the location in the input image, from where the value
|
||||
* of the given output pixel should be interpolated.
|
||||
@@ -107,11 +107,6 @@ void remap32(int wi, int hi, int wo, int ho, unsigned char *vhs, unsigned char *
|
||||
//**************************************
|
||||
//HERE BEGIN THE INTERPOLATION FUNCTIONS
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
__inline const float roundf(float x){
|
||||
return (int)floor(x+0.5);
|
||||
}
|
||||
#endif /* _MSC_VER */
|
||||
|
||||
//------------------------------------------------------
|
||||
//za debugging - z izpisovanjem
|
||||
|
||||
@@ -5,7 +5,6 @@ include_directories(${Cairo_INCLUDE_DIR})
|
||||
set(LIBS ${LIBS} ${Cairo_LIBRARY})
|
||||
|
||||
if (MSVC)
|
||||
set_source_files_properties (cairogradient.c PROPERTIES LANGUAGE CXX)
|
||||
set (SOURCES ${SOURCES} ${FREI0R_DEF})
|
||||
endif (MSVC)
|
||||
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
#include <math.h>
|
||||
|
||||
#include "frei0r.h"
|
||||
#include "frei0r_cairo.h"
|
||||
#include "frei0r/cairo.h"
|
||||
|
||||
typedef struct cairo_gradient_instance
|
||||
{
|
||||
@@ -333,6 +333,9 @@ void f0r_update(f0r_instance_t instance, double time,
|
||||
unsigned char* src = (unsigned char*)inframe;
|
||||
int pixels = inst->width * inst->height;
|
||||
|
||||
// Clear the destination
|
||||
memset(dst, 0, pixels * sizeof(uint32_t));
|
||||
|
||||
frei0r_cairo_premultiply_rgba (src, pixels, -1);
|
||||
draw_gradient(inst, dst, src, time);
|
||||
frei0r_cairo_unpremultiply_rgba (dst, pixels);
|
||||
|
||||
@@ -5,7 +5,6 @@ include_directories(${Cairo_INCLUDE_DIR})
|
||||
set(LIBS ${LIBS} ${Cairo_LIBRARY})
|
||||
|
||||
if (MSVC)
|
||||
set_source_files_properties (cairoimagegrid.c PROPERTIES LANGUAGE CXX)
|
||||
set (SOURCES ${SOURCES} ${FREI0R_DEF})
|
||||
endif (MSVC)
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
#include <cairo.h>
|
||||
|
||||
#include "frei0r.h"
|
||||
#include "frei0r_cairo.h"
|
||||
#include "frei0r/cairo.h"
|
||||
|
||||
#define MAX_ROWS 20
|
||||
#define MAX_COLUMNS 20
|
||||
@@ -148,6 +148,13 @@ void draw_grid(cairo_imagegrid_instance_t* inst, unsigned char* dst, const unsig
|
||||
int pw = (int)(w/columns);
|
||||
int ph = (int)(h/rows);
|
||||
|
||||
if (w % pw != 0 || h % ph != 0) {
|
||||
// Destination will have gaps - prefill with black.
|
||||
cairo_set_source_rgba(cr, 0.0, 0.0, 0.0, 1.0);
|
||||
cairo_rectangle (cr, 0, 0, w, h);
|
||||
cairo_fill (cr);
|
||||
}
|
||||
|
||||
cairo_matrix_t matrix;
|
||||
cairo_matrix_init_scale (&matrix, columns, rows);
|
||||
cairo_pattern_set_matrix (pattern, &matrix);
|
||||
|
||||
@@ -2,7 +2,6 @@ set (SOURCES cluster.c)
|
||||
set (TARGET cluster)
|
||||
|
||||
if (MSVC)
|
||||
set_source_files_properties (cluster.c PROPERTIES LANGUAGE CXX)
|
||||
set (SOURCES ${SOURCES} ${FREI0R_DEF})
|
||||
endif (MSVC)
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
#include <stdio.h>
|
||||
|
||||
#include "frei0r.h"
|
||||
#include "frei0r_math.h"
|
||||
#include "frei0r/math.h"
|
||||
|
||||
#define MAXNUM 40
|
||||
|
||||
|
||||
@@ -2,11 +2,12 @@ set (SOURCES colgate.c)
|
||||
set (TARGET colgate)
|
||||
|
||||
if (MSVC)
|
||||
set_source_files_properties (colgate.c PROPERTIES LANGUAGE CXX)
|
||||
set (SOURCES ${SOURCES} ${FREI0R_DEF})
|
||||
endif (MSVC)
|
||||
|
||||
link_libraries(m)
|
||||
if(NOT MSVC)
|
||||
link_libraries(m)
|
||||
endif()
|
||||
add_library (${TARGET} MODULE ${SOURCES})
|
||||
set_target_properties (${TARGET} PROPERTIES PREFIX "")
|
||||
|
||||
|
||||
@@ -88,7 +88,7 @@
|
||||
#endif
|
||||
|
||||
#include "frei0r.h"
|
||||
#include "frei0r_math.h"
|
||||
#include "frei0r/math.h"
|
||||
|
||||
enum ParamIndex {
|
||||
NEUTRAL_COLOR,
|
||||
|
||||
@@ -2,11 +2,12 @@ set (SOURCES coloradj_RGB.c)
|
||||
set (TARGET coloradj_RGB)
|
||||
|
||||
if (MSVC)
|
||||
set_source_files_properties (coloradj_RGB.c PROPERTIES LANGUAGE CXX)
|
||||
set (SOURCES ${SOURCES} ${FREI0R_DEF})
|
||||
endif (MSVC)
|
||||
|
||||
link_libraries(m)
|
||||
if(NOT MSVC)
|
||||
link_libraries(m)
|
||||
endif()
|
||||
add_library (${TARGET} MODULE ${SOURCES})
|
||||
set_target_properties (${TARGET} PROPERTIES PREFIX "")
|
||||
|
||||
|
||||
0
src/filter/coloradj/coloradj_RGB.c
Executable file → Normal file
0
src/filter/coloradj/coloradj_RGB.c
Executable file → Normal file
@@ -2,7 +2,6 @@ set (SOURCES colordistance.c)
|
||||
set (TARGET colordistance)
|
||||
|
||||
if (MSVC)
|
||||
set_source_files_properties (colordistance.c PROPERTIES LANGUAGE CXX)
|
||||
set (SOURCES ${SOURCES} ${FREI0R_DEF})
|
||||
endif (MSVC)
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
#include <stdio.h>
|
||||
|
||||
#include "frei0r.h"
|
||||
#include "frei0r_math.h"
|
||||
#include "frei0r/math.h"
|
||||
|
||||
typedef struct colordistance_instance
|
||||
{
|
||||
@@ -109,12 +109,6 @@ void f0r_get_param_value(f0r_instance_t instance,
|
||||
|
||||
}
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
__inline const int rint(float x){
|
||||
return (int)(x+0.5);
|
||||
}
|
||||
#endif
|
||||
|
||||
void f0r_update(f0r_instance_t instance, double time,
|
||||
const uint32_t* inframe, uint32_t* outframe)
|
||||
{
|
||||
|
||||
@@ -2,7 +2,6 @@ set (SOURCES colorhalftone.c)
|
||||
set (TARGET colorhalftone)
|
||||
|
||||
if (MSVC)
|
||||
set_source_files_properties (colorhalftone.c PROPERTIES LANGUAGE CXX)
|
||||
set (SOURCES ${SOURCES} ${FREI0R_DEF})
|
||||
endif (MSVC)
|
||||
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
#include <stdio.h>
|
||||
#include <math.h>
|
||||
#include "frei0r.h"
|
||||
#include "frei0r_math.h"
|
||||
#include "frei0r/math.h"
|
||||
|
||||
double PI=3.14159265358979;
|
||||
|
||||
@@ -119,7 +119,7 @@ void color_halftone(f0r_instance_t instance, double time,
|
||||
// We check all four neighbours, but in practice only one can ever overlap any given point.
|
||||
for (i = 0; i < 5; i++)
|
||||
{
|
||||
// Find neigbouring grid point
|
||||
// Find neighbouring grid point
|
||||
ttx = tx + mx[i]*gridSize;
|
||||
tty = ty + my[i]*gridSize;
|
||||
// Transform back into image space
|
||||
|
||||
@@ -2,7 +2,6 @@ set (SOURCES colorize.c)
|
||||
set (TARGET colorize)
|
||||
|
||||
if (MSVC)
|
||||
set_source_files_properties (colorize.c PROPERTIES LANGUAGE CXX)
|
||||
set (SOURCES ${SOURCES} ${FREI0R_DEF})
|
||||
endif (MSVC)
|
||||
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
#include <assert.h>
|
||||
|
||||
#include "frei0r.h"
|
||||
#include "frei0r_math.h"
|
||||
#include "frei0r/math.h"
|
||||
|
||||
#define GIMP_RGB_LUMINANCE_RED (0.2126)
|
||||
#define GIMP_RGB_LUMINANCE_GREEN (0.7152)
|
||||
|
||||
@@ -2,7 +2,6 @@ set (SOURCES colortap.c)
|
||||
set (TARGET colortap)
|
||||
|
||||
if (MSVC)
|
||||
set_source_files_properties (colortap.c PROPERTIES LANGUAGE CXX)
|
||||
set (SOURCES ${SOURCES} ${FREI0R_DEF})
|
||||
endif (MSVC)
|
||||
|
||||
|
||||
@@ -348,6 +348,8 @@ f0r_instance_t f0r_construct(unsigned int width, unsigned int height)
|
||||
|
||||
void f0r_destruct(f0r_instance_t instance)
|
||||
{
|
||||
colortap_instance_t* inst = (colortap_instance_t*)instance;
|
||||
free(inst->table);
|
||||
free(instance);
|
||||
}
|
||||
|
||||
|
||||
@@ -2,7 +2,6 @@ set (SOURCES contrast0r.c)
|
||||
set (TARGET contrast0r)
|
||||
|
||||
if (MSVC)
|
||||
set_source_files_properties (contrast0r.c PROPERTIES LANGUAGE CXX)
|
||||
set (SOURCES ${SOURCES} ${FREI0R_DEF})
|
||||
endif (MSVC)
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
#include <stdio.h>
|
||||
|
||||
#include "frei0r.h"
|
||||
#include "frei0r_math.h"
|
||||
#include "frei0r/math.h"
|
||||
|
||||
typedef struct contrast0r_instance
|
||||
{
|
||||
@@ -100,7 +100,7 @@ void f0r_set_param_value(f0r_instance_t instance,
|
||||
{
|
||||
int val;
|
||||
case 0:
|
||||
/* constrast */
|
||||
/* contrast */
|
||||
val = (int) ((*((double*)param) - 0.5) * 512.0); /* remap to [-256, 256] */
|
||||
if (val != inst->contrast)
|
||||
{
|
||||
|
||||
@@ -1,17 +1,11 @@
|
||||
# Set C99 flag for gcc
|
||||
if (CMAKE_COMPILER_IS_GNUCC)
|
||||
set(CMAKE_C_FLAGS "-std=c99")
|
||||
endif (CMAKE_COMPILER_IS_GNUCC)
|
||||
|
||||
set (SOURCES curves.c)
|
||||
set (TARGET curves)
|
||||
|
||||
if (MSVC)
|
||||
set_source_files_properties (curves.c PROPERTIES LANGUAGE CXX)
|
||||
set (SOURCES ${SOURCES} ${FREI0R_DEF})
|
||||
endif (MSVC)
|
||||
|
||||
add_library (${TARGET} MODULE ${SOURCES})
|
||||
set_target_properties (${TARGET} PROPERTIES PREFIX "")
|
||||
set_target_properties (${TARGET} PROPERTIES PREFIX "" C_STANDARD 99)
|
||||
|
||||
install (TARGETS ${TARGET} LIBRARY DESTINATION ${LIBDIR})
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
#include <stdio.h>
|
||||
|
||||
#include "frei0r.h"
|
||||
#include "frei0r_math.h"
|
||||
#include "frei0r/math.h"
|
||||
|
||||
#define MAX3(a, b, c) ( ( a > b && a > c) ? a : (b > c ? b : c) )
|
||||
#define MIN3(a, b, c) ( ( a < b && a < c) ? a : (b < c ? b : c) )
|
||||
@@ -234,7 +234,7 @@ void f0r_get_param_info(f0r_param_info_t* info, int param_index)
|
||||
case 5:
|
||||
info->name = "Bézier spline";
|
||||
info->type = F0R_PARAM_STRING;
|
||||
info->explanation = "Use cubic Bézier spline. Has to be a sorted list of points in the format \"handle1x;handle1y#pointx;pointy#handle2x;handle2y\"(pointx = in, pointy = out). Points are separated by a \"|\".The values can have \"double\" precision. x, y for points should be in the range 0-1. x,y for handles might also be out of this range.";
|
||||
info->explanation = "Use cubic Bézier spline. Has to be a sorted list of points in the format 'handle1x;handle1y#pointx;pointy#handle2x;handle2y'(pointx = in, pointy = out). Points are separated by a '|'.The values can have 'double' precision. x, y for points should be in the range 0-1. x,y for handles might also be out of this range.";
|
||||
default:
|
||||
if (param_index > 5) {
|
||||
info->name = get_param_name(param_index - 6);
|
||||
@@ -255,9 +255,9 @@ f0r_instance_t f0r_construct(unsigned int width, unsigned int height)
|
||||
inst->pointNumber = 2;
|
||||
inst->formula = 1;
|
||||
inst->bspline = calloc(1, sizeof(char));
|
||||
inst->bsplineMap = malloc(sizeof(double));
|
||||
inst->csplineMap = malloc(sizeof(double));
|
||||
inst->curveMap = malloc(sizeof(float));
|
||||
inst->bsplineMap = NULL;
|
||||
inst->csplineMap = NULL;
|
||||
inst->curveMap = NULL;
|
||||
inst->points[0] = 0;
|
||||
inst->points[1] = 0;
|
||||
inst->points[2] = 1;
|
||||
@@ -273,12 +273,12 @@ f0r_instance_t f0r_construct(unsigned int width, unsigned int height)
|
||||
|
||||
void f0r_destruct(f0r_instance_t instance)
|
||||
{
|
||||
if (((curves_instance_t*)instance)->bspline)
|
||||
free(((curves_instance_t*)instance)->bspline);
|
||||
free(((curves_instance_t*)instance)->bsplineMap);
|
||||
free(((curves_instance_t*)instance)->csplineMap);
|
||||
free(((curves_instance_t*)instance)->curveMap);
|
||||
free(instance);
|
||||
curves_instance_t* inst = (curves_instance_t*)instance;
|
||||
free(inst->bspline);
|
||||
free(inst->bsplineMap);
|
||||
free(inst->csplineMap);
|
||||
free(inst->curveMap);
|
||||
free(inst);
|
||||
}
|
||||
|
||||
void f0r_set_param_value(f0r_instance_t instance,
|
||||
@@ -388,7 +388,7 @@ void f0r_get_param_value(f0r_instance_t instance,
|
||||
|
||||
double* gaussSLESolve(size_t size, double* A) {
|
||||
int extSize = size + 1;
|
||||
//direct way: tranform matrix A to triangular form
|
||||
//direct way: transform matrix A to triangular form
|
||||
for(int row = 0; row < size; row++) {
|
||||
int col = row;
|
||||
int lastRowToSwap = size - 1;
|
||||
@@ -546,7 +546,7 @@ position pointOnBezier(double t, position points[4])
|
||||
/*
|
||||
* Calculating a point on the bezier curve using the coefficients from Bernstein basis polynomial of degree 3.
|
||||
* Using the De Casteljau algorithm would be slightly faster when calculating a lot of values
|
||||
* but the difference is far from noticable here since we update the spline only when the parameter changes
|
||||
* but the difference is far from noticeable here since we update the spline only when the parameter changes
|
||||
*/
|
||||
double c1 = (1-t) * (1-t) * (1-t);
|
||||
double c2 = 3 * t * (1-t) * (1-t);
|
||||
@@ -557,6 +557,10 @@ position pointOnBezier(double t, position points[4])
|
||||
return pos;
|
||||
}
|
||||
|
||||
#if defined(_WIN32) || defined(_WIN64)
|
||||
# define strtok_r strtok_s
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Splits given string into sub-strings at given delimiter.
|
||||
* \param string input string
|
||||
@@ -569,11 +573,11 @@ int tokenise(char *string, const char *delimiter, char ***tokens)
|
||||
int count = 0;
|
||||
char *input = strdup(string);
|
||||
char *result = NULL;
|
||||
result = strtok(input, delimiter);
|
||||
result = strtok_r(string, delimiter, &input);
|
||||
while (result != NULL) {
|
||||
*tokens = realloc(*tokens, (count + 1) * sizeof(char *));
|
||||
(*tokens)[count++] = strdup(result);
|
||||
result = strtok(NULL, delimiter);
|
||||
result = strtok_r(NULL, delimiter, &input);
|
||||
}
|
||||
free(input);
|
||||
return count;
|
||||
@@ -608,7 +612,7 @@ void updateBsplineMap(f0r_instance_t instance)
|
||||
char **pointStr = calloc(1, sizeof(char *));
|
||||
int count = tokenise(inst->bspline, "|", &pointStr);
|
||||
|
||||
bspline_point points[count];
|
||||
bspline_point *points = (bspline_point *) malloc(count * sizeof(bspline_point));
|
||||
|
||||
for (int i = 0; i < count; ++i) {
|
||||
char **positionsStr = calloc(1, sizeof(char *));
|
||||
@@ -666,7 +670,7 @@ void updateBsplineMap(f0r_instance_t instance)
|
||||
c = 1;
|
||||
}
|
||||
step = 1 / (double)c;
|
||||
position curve[c];
|
||||
position *curve = (position *) malloc((c + 1) * sizeof(position));
|
||||
while (t <= 1) {
|
||||
curve[pn++] = pointOnBezier(t, p);
|
||||
t += step;
|
||||
@@ -697,7 +701,11 @@ void updateBsplineMap(f0r_instance_t instance)
|
||||
else
|
||||
inst->bsplineMap[j] = CLAMP0255(ROUND(y * 255));
|
||||
}
|
||||
|
||||
free(curve);
|
||||
}
|
||||
|
||||
free(points);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -755,9 +763,10 @@ void updateCsplineMap(f0r_instance_t instance)
|
||||
}
|
||||
if (inst->drawCurves) {
|
||||
int scale = inst->height / 2;
|
||||
free(inst->curveMap);
|
||||
inst->curveMap = malloc(scale * sizeof(float));
|
||||
for(i = 0; i < scale; i++)
|
||||
inst->curveMap[i] = spline((float)i / scale, points, (size_t)inst->pointNumber, coeffs) * scale;
|
||||
inst->curveMap[i] = spline((double)i / scale, points, (size_t)inst->pointNumber, coeffs) * scale;
|
||||
}
|
||||
|
||||
free(coeffs);
|
||||
@@ -771,6 +780,13 @@ void f0r_update(f0r_instance_t instance, double time,
|
||||
curves_instance_t* inst = (curves_instance_t*)instance;
|
||||
unsigned int len = inst->width * inst->height;
|
||||
|
||||
// test initialization c/b spline
|
||||
double *splinemap = strlen(inst->bspline)>0 ? inst->bsplineMap : inst->csplineMap;
|
||||
if(!splinemap) {
|
||||
memcpy(outframe,inframe,inst->width * inst->height * 4);
|
||||
return;
|
||||
}
|
||||
|
||||
unsigned char* dst = (unsigned char*)outframe;
|
||||
const unsigned char* src = (unsigned char*)inframe;
|
||||
|
||||
|
||||
@@ -135,7 +135,7 @@ public:
|
||||
* and therefore get the number (line1+line2)/2, here 6.5.
|
||||
* This positions will later be used for interpolation.
|
||||
*/
|
||||
float filled[newHeight];
|
||||
float *filled = (float *) malloc(newHeight * sizeof(float));
|
||||
|
||||
int count = 0;
|
||||
int index = 0;
|
||||
@@ -160,7 +160,7 @@ public:
|
||||
* Calculate scaling numbers to scale the full height matrix
|
||||
* with the slice lines down to the original height (720p).
|
||||
*/
|
||||
float downScaling[height];
|
||||
float *downScaling = (float *) malloc(height * sizeof(float));
|
||||
|
||||
float scaleFactor = (float) newHeight/height;
|
||||
// printf("scale factor: %f\n", scaleFactor);
|
||||
@@ -184,6 +184,9 @@ public:
|
||||
m_mesh[i] = (1-offset)*filled[index] + offset*filled[index+1];
|
||||
// printf("%f at %d with weights %f and %f\n", m_mesh[i], i, (1-offset)*downScaling[i], offset*downScaling[i+1]);
|
||||
}
|
||||
|
||||
free(downScaling);
|
||||
free(filled);
|
||||
|
||||
} else {
|
||||
// Not a 720p file.
|
||||
@@ -219,7 +222,7 @@ public:
|
||||
for (unsigned int pixel = 0; pixel < width*4; pixel++) {
|
||||
// Use linear interpolation on the colours
|
||||
|
||||
// Use pointer arithmetics. Colour values are stored
|
||||
// Use pointer arithmetic. Colour values are stored
|
||||
// as AABBGGRR in the uint32_t values.
|
||||
// Convert each colour separately.
|
||||
|
||||
|
||||
@@ -2,11 +2,12 @@ set (SOURCES defish0r.c interp.h)
|
||||
set (TARGET defish0r)
|
||||
|
||||
if (MSVC)
|
||||
set_source_files_properties (defish0r.c PROPERTIES LANGUAGE CXX)
|
||||
set (SOURCES ${SOURCES} ${FREI0R_DEF})
|
||||
endif (MSVC)
|
||||
|
||||
link_libraries(m)
|
||||
if(NOT MSVC)
|
||||
link_libraries(m)
|
||||
endif()
|
||||
add_library (${TARGET} MODULE ${SOURCES})
|
||||
set_target_properties (${TARGET} PROPERTIES PREFIX "")
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@ Defish0r is a Frei0r plugin that can convert fisheye video to
|
||||
rectilinear, and vice versa. It is based on the angular mapping
|
||||
functions actually used in fisheye lens design, to get the best
|
||||
possible results. It can also be used to correct the slight distortion
|
||||
of some wideangle convertors, or to bend the image beyond recognition
|
||||
of some wideangle converters, or to bend the image beyond recognition
|
||||
for special effects and light shows.
|
||||
|
||||
|
||||
@@ -64,7 +64,7 @@ Description of the available parameters:
|
||||
unreasonable values the image might indeed disappear, when there are
|
||||
math overflows or imaginary results... (types 1 and 2 are more prone
|
||||
to image vanishing). Anyway, when working in the "special effect"
|
||||
range, it is alway worth to try manual scaling.
|
||||
range, it is always worth to try manual scaling.
|
||||
|
||||
"DeFish"
|
||||
If checked, the transform direction is from fisheye to rectiliear,
|
||||
@@ -163,7 +163,7 @@ Type = 1000
|
||||
Scaling = 1000 (manual)
|
||||
Manual Scale = 191
|
||||
|
||||
For an effect, reminiscent of some scenes from the "2001 Spcae Odyssey" try
|
||||
For an effect, reminiscent of some scenes from the "2001 Space Odyssey" try
|
||||
this:
|
||||
Amount = 876
|
||||
Defish = ON
|
||||
|
||||
@@ -37,6 +37,39 @@
|
||||
|
||||
double PI=3.14159265358979;
|
||||
|
||||
//add simplified 'Elestic Scale' to fix superview
|
||||
float stretchWidth(int width, int widthCentre, float currentXPos, float stretchFactor)
|
||||
{
|
||||
double ratio, lowerWeight = 0.0, higherWeight = 0.0, linearRatio;
|
||||
unsigned int lengthSection;
|
||||
float relativeXPos = 0.0f;
|
||||
|
||||
//midline?
|
||||
if (currentXPos < (float)widthCentre)
|
||||
{
|
||||
lengthSection = widthCentre - 1;
|
||||
linearRatio = (double) ( currentXPos ) / lengthSection;
|
||||
ratio = sin(linearRatio * PI - PI) * stretchFactor + linearRatio;
|
||||
}
|
||||
else
|
||||
{
|
||||
lengthSection = width - widthCentre - 1;
|
||||
linearRatio = (double) ( currentXPos - widthCentre ) / lengthSection;
|
||||
ratio = sin(linearRatio * PI) * stretchFactor + linearRatio;
|
||||
}
|
||||
ratio = ratio <= 0.0 ? 0.0 : ratio;
|
||||
|
||||
relativeXPos = (float) ( ratio * lengthSection );
|
||||
|
||||
if (currentXPos < (float)widthCentre)
|
||||
relativeXPos -= currentXPos;
|
||||
else
|
||||
relativeXPos -= ( currentXPos - widthCentre );
|
||||
|
||||
return relativeXPos;
|
||||
}
|
||||
|
||||
|
||||
//---------------------------------------------------------
|
||||
// r = 0...1 izhod = 0...maxr
|
||||
//ta funkcija da popacenje v odvisnosti od r
|
||||
@@ -48,7 +81,7 @@ float fish(int n, float r, float f)
|
||||
switch (n)
|
||||
{
|
||||
case 0: //equidistant
|
||||
ff=f*2.0/PI;
|
||||
ff=f*2.0f/(float)PI;
|
||||
rr=tanf(r/ff);
|
||||
break;
|
||||
case 1: //ortographic
|
||||
@@ -59,15 +92,15 @@ float fish(int n, float r, float f)
|
||||
rr=tanf(asinf(ff));
|
||||
break;
|
||||
case 2: //equiarea
|
||||
ff=r/2.0/f;
|
||||
if (ff>1.0)
|
||||
rr=-1.0;
|
||||
ff=r/2.0f/f;
|
||||
if (ff>1.0f)
|
||||
rr=-1.0f;
|
||||
else
|
||||
rr=tanf(2.0*asinf(r/2.0/f));
|
||||
rr=tanf(2.0f*asinf(r/2.0f/f));
|
||||
break;
|
||||
case 3: //stereographic
|
||||
ff=f*2.0/PI;
|
||||
rr=tanf(2.0*atanf(r/2.0/ff));
|
||||
ff=f*2.0f/(float)PI;
|
||||
rr=tanf(2.0f*atanf(r/2.0f/ff));
|
||||
break;
|
||||
default:
|
||||
// printf("Neznana fishitvena funkcija %d\n",n);
|
||||
@@ -86,16 +119,16 @@ float defish(int n, float r, float f, float mr)
|
||||
switch (n)
|
||||
{
|
||||
case 0: //equidistant
|
||||
rr=f*2.0/PI*atanf(r*mr);
|
||||
rr=f*2.0f/(float)PI*atanf(r*mr);
|
||||
break;
|
||||
case 1: //ortographic
|
||||
rr=f*sinf(atanf(r*mr));
|
||||
break;
|
||||
case 2: //equiarea
|
||||
rr=2.0*f*sinf(atanf(r*mr)/2.0);
|
||||
rr=2.0f*f*sinf(atanf(r*mr)/2.0f);
|
||||
break;
|
||||
case 3: //stereographic
|
||||
rr=f*4.0/PI*tanf(atanf(r*mr)/2.0);
|
||||
rr=f*4.0f/(float)PI*tanf(atanf(r*mr)/2.0f);
|
||||
break;
|
||||
default:
|
||||
// printf("Neznana fishitvena funkcija %d\n",n);
|
||||
@@ -104,10 +137,6 @@ float defish(int n, float r, float f, float mr)
|
||||
return rr;
|
||||
}
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
#define hypotf _hypotf
|
||||
#endif
|
||||
|
||||
//----------------------------------------------------------------
|
||||
//nafila array map s polozaji pikslov
|
||||
//locena funkcija, da jo poklicem samo enkrat na zacetku,
|
||||
@@ -119,26 +148,28 @@ float defish(int n, float r, float f, float mr)
|
||||
//scal = scaling factor
|
||||
//pari, paro = pixel aspect ratio (input / output)
|
||||
//dx, dy offset on input (for non-cosited chroma subsampling)
|
||||
void fishmap(int wi, int hi, int wo, int ho, int n, float f, float scal, float pari, float paro, float dx, float dy, float *map)
|
||||
void fishmap(int wi, int hi, int wo, int ho, int n, float f, float scal, float pari, float paro, float dx, float dy, float *map
|
||||
, float stretchFactor, float yScale)
|
||||
{
|
||||
float rmax,maxr,r,kot,x,y,imax;
|
||||
int i,j,ww,wi2,hi2,wo2,ho2;
|
||||
int i, j, ww;
|
||||
float ii,jj,sc;
|
||||
int wiMid = wi/2;
|
||||
int hiMid = hi/2;
|
||||
|
||||
rmax=hypotf(ho/2.0,wo/2.0*paro);
|
||||
rmax=hypotf(ho/2.0f,wo/2.0f*paro);
|
||||
maxr=fish(n,1.0,f);
|
||||
imax=hypotf(hi/2.0,wi/2.0*pari);
|
||||
imax=hypotf(hi/2.0f,wi/2.0f*pari);
|
||||
sc=imax/maxr;
|
||||
|
||||
//printf("Fishmap: F=%5.2f Rmax= %7.2f Maxr=%6.2f sc=%6.2f scal=%6.2f\n",f,rmax,maxr,sc,scal);
|
||||
|
||||
wi2=wi/2; hi2=hi/2; wo2=wo/2; ho2=ho/2;
|
||||
for (i=0;i<ho;i++)
|
||||
for (i=0;i<hi;i++)
|
||||
{
|
||||
ii=i-ho2;
|
||||
for (j=0;j<wo;j++)
|
||||
ii=(float)(i-hiMid)*yScale; //add Y scale
|
||||
for (j=0;j<wi;j++)
|
||||
{
|
||||
jj=(j-wo2)*paro;
|
||||
jj=(j-wiMid)*paro;
|
||||
r=hypotf(ii,jj);
|
||||
kot=atan2f(ii,jj);
|
||||
r=fish(n,r/rmax*scal,f)*sc;
|
||||
@@ -150,10 +181,12 @@ void fishmap(int wi, int hi, int wo, int ho, int n, float f, float scal, float p
|
||||
}
|
||||
else
|
||||
{
|
||||
x=wi2+r*cosf(kot)/pari;
|
||||
y=hi2+r*sinf(kot);
|
||||
x=wiMid+r*cosf(kot)/pari;
|
||||
y=hiMid+r*sinf(kot);
|
||||
if ((x>0)&(x<(wi-1))&(y>0)&(y<(hi-1)))
|
||||
{
|
||||
if (stretchFactor != 0.0f)
|
||||
x += stretchWidth(wo, wiMid, x, stretchFactor); //add stretch
|
||||
map[ww]=x+dx;
|
||||
map[ww+1]=y+dy;
|
||||
}
|
||||
@@ -165,9 +198,9 @@ void fishmap(int wi, int hi, int wo, int ho, int n, float f, float scal, float p
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
//----------------------------------------------------------------
|
||||
//nafila array map s polozaji pikslov
|
||||
//locena funkcija, da jo poklicem samo enkrat na zacetku,
|
||||
@@ -179,30 +212,35 @@ void fishmap(int wi, int hi, int wo, int ho, int n, float f, float scal, float p
|
||||
//scal = scaling factor
|
||||
//pari,paro = pixel aspect ratio (input / output)
|
||||
//dx, dy offset on input (for non-cosited chroma subsampling)
|
||||
void defishmap(int wi, int hi, int wo, int ho, int n, float f, float scal, float pari, float paro, float dx, float dy, float *map)
|
||||
//lbox = letterbox
|
||||
//stretch = dynamic stretch, convert between 4:3 and 16:9
|
||||
//yScale = -0.5.. 0.5 change aspect ratio on y access only
|
||||
void defishmap(int wi, int hi, int wo, int ho, int n, float f, float scal, float pari, float paro, float dx, float dy, float *map
|
||||
, int lbox, float stretchFactor, float yScale)
|
||||
{
|
||||
float rmax,maxr,r,kot,x,y,imax;
|
||||
int i,j,ww,wi2,hi2,wo2,ho2;
|
||||
int i,j,ww;
|
||||
float ii,jj,sc;
|
||||
int wiMid = wi/2;
|
||||
int hiMid = hi/2;
|
||||
|
||||
rmax=hypotf(ho/2.0,wo/2.0*paro);
|
||||
rmax=hypotf(ho/2.0f,wo/2.0f*paro);
|
||||
maxr=fish(n,1.0,f);
|
||||
imax=hypotf(hi/2.0,wi/2.0*pari);
|
||||
imax=hypotf(hi/2.0f,wi/2.0f*pari);
|
||||
sc=imax/maxr;
|
||||
|
||||
//printf("Defishmap: F=%f rmax= %f Maxr=%f sc=%6.2f scal=%6.2f\n",f,rmax,maxr,sc,scal);
|
||||
|
||||
wi2=wi/2; hi2=hi/2; wo2=wo/2; ho2=ho/2;
|
||||
for (i=0;i<ho;i++)
|
||||
for (i=0;i<hi;i++)
|
||||
{
|
||||
ii=i-ho2;
|
||||
for (j=0;j<wo;j++)
|
||||
ii = (float)(i-hiMid)*yScale; //add Y scale
|
||||
for (j=0;j<wi;j++)
|
||||
{
|
||||
jj=(j-wo2)*paro; //aspect....
|
||||
jj=(j-wiMid)*paro; //aspect....
|
||||
r=hypotf(ii,jj)/scal;
|
||||
kot=atan2f(ii,jj);
|
||||
ww=2*(wo*i+j);
|
||||
r=defish(n,r/sc,f,1.0)*rmax;
|
||||
ww=2*(wi*i+j);
|
||||
r=defish(n,r/sc,f,1.0)*imax;
|
||||
if (r<0.0)
|
||||
{
|
||||
map[ww]=-1;
|
||||
@@ -210,10 +248,14 @@ void defishmap(int wi, int hi, int wo, int ho, int n, float f, float scal, float
|
||||
}
|
||||
else
|
||||
{
|
||||
x=wi2+r*cosf(kot)/pari;
|
||||
y=hi2+r*sinf(kot);
|
||||
if ((x>0)&(x<(wi-1))&(y>0)&(y<(hi-1)))
|
||||
x=wiMid+r*cosf(kot)/pari;
|
||||
y=hiMid+r*sinf(kot);
|
||||
|
||||
if ((x>0)&&(x<(wi-1))&&(y>0)&&(y<(hi-1)))
|
||||
{
|
||||
if (stretchFactor != 0.0f)
|
||||
x += stretchWidth(wi, wiMid, x, stretchFactor); //add stretch
|
||||
|
||||
map[ww]=x;
|
||||
map[ww+1]=y;
|
||||
}
|
||||
@@ -225,6 +267,38 @@ void defishmap(int wi, int hi, int wo, int ho, int n, float f, float scal, float
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//crop all 4 borders
|
||||
if (lbox)
|
||||
{ //top/bottom
|
||||
for (i = 0; i < hi; i++)
|
||||
{
|
||||
ww = 2 * (wi*i + wiMid);
|
||||
if (map[ww] <= 0)
|
||||
{
|
||||
for (j = 0; j < wi; j++)
|
||||
{ //clear entire row
|
||||
ww = 2 * (wi*i + j);
|
||||
map[ww] = -1;
|
||||
map[ww + 1] = -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
//left/right
|
||||
for (i = 0; i < wi; i++)
|
||||
{
|
||||
ww = 2 * (wi*hiMid +i);
|
||||
if (map[ww] <= 0)
|
||||
{
|
||||
for (j = 0; j < hi; j++)
|
||||
{ //clear entire column
|
||||
ww = 2 * (wi*j + i);
|
||||
map[ww] = -1;
|
||||
map[ww + 1] = -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//=====================================================
|
||||
@@ -237,6 +311,8 @@ void defishmap(int wi, int hi, int wo, int ho, int n, float f, float scal, float
|
||||
//intp: 0..6 type of interpolator
|
||||
//aspt: 0..4 aspect type square, PAL, NTSC, HDV, manual
|
||||
//par: pixel aspect ratio
|
||||
//lbox: 1=letterbox
|
||||
//stretch 0..1 stretch video to fix superview distortion
|
||||
typedef struct
|
||||
{
|
||||
int w;
|
||||
@@ -251,6 +327,9 @@ typedef struct
|
||||
float mpar;
|
||||
float par;
|
||||
float *map;
|
||||
int lbox;
|
||||
float stretch;
|
||||
float yScale;
|
||||
interpp interpol;
|
||||
} param;
|
||||
|
||||
@@ -297,7 +376,7 @@ void make_map(param p)
|
||||
case 3: //manual
|
||||
dscal=p.mscale; break;
|
||||
}
|
||||
defishmap(p.w ,p.h ,p.w ,p.h, p.type, p.f, dscal, p.par, p.par, 0.0, 0.0, p.map);
|
||||
defishmap(p.w ,p.h ,p.w ,p.h, p.type, p.f, dscal, p.par, p.par, 0.0, 0.0, p.map, p.lbox, p.stretch, p.yScale);
|
||||
}
|
||||
else //fish
|
||||
{
|
||||
@@ -315,7 +394,7 @@ void make_map(param p)
|
||||
case 3: //manual
|
||||
fscal=1.0/p.mscale; break;
|
||||
}
|
||||
fishmap(p.w, p.h, p.w ,p.h, p.type, p.f, fscal, p.par, p.par, 0.0, 0.0, p.map);
|
||||
fishmap(p.w, p.h, p.w ,p.h, p.type, p.f, fscal, p.par, p.par, 0.0, 0.0, p.map, p.stretch, p.yScale);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -344,8 +423,8 @@ void f0r_get_plugin_info(f0r_plugin_info_t* info)
|
||||
info->color_model=F0R_COLOR_MODEL_RGBA8888;
|
||||
info->frei0r_version=FREI0R_MAJOR_VERSION;
|
||||
info->major_version=0;
|
||||
info->minor_version=3;
|
||||
info->num_params=8;
|
||||
info->minor_version=4;
|
||||
info->num_params=11;
|
||||
info->explanation="Non rectilinear lens mappings";
|
||||
}
|
||||
|
||||
@@ -394,6 +473,21 @@ void f0r_get_param_info(f0r_param_info_t* info, int param_index)
|
||||
info->type = F0R_PARAM_DOUBLE;
|
||||
info->explanation = "Manual Pixel Aspect ratio";
|
||||
break;
|
||||
case 8:
|
||||
info->name = "Crop";
|
||||
info->type = F0R_PARAM_BOOL;
|
||||
info->explanation = "Straighten all edges of video frame";
|
||||
break;
|
||||
case 9:
|
||||
info->name = "Non-Linear scale";
|
||||
info->type = F0R_PARAM_DOUBLE;
|
||||
info->explanation = "Fix camera scaling between 4:3 and 16:9";
|
||||
break;
|
||||
case 10:
|
||||
info->name = "Y Scale";
|
||||
info->type = F0R_PARAM_DOUBLE;
|
||||
info->explanation = "Scale Y to affect aspect ratio";
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -417,6 +511,9 @@ f0r_instance_t f0r_construct(unsigned int width, unsigned int height)
|
||||
p->aspt=0; //square pixels
|
||||
p->par=1.0; //square pixels
|
||||
p->mpar=1.0;
|
||||
p->lbox=0; //letterbox
|
||||
p->stretch = 0.0f; //dynamic stretch
|
||||
p->yScale = 1.0f; //separate Y stretch
|
||||
|
||||
p->map=(float*)calloc(1, sizeof(float)*(p->w*p->h*2+2));
|
||||
p->interpol=set_intp(*p);
|
||||
@@ -578,6 +675,21 @@ void f0r_set_param_value(f0r_instance_t instance, f0r_param_t parm, int param_in
|
||||
if (p->mpar != tmpf) chg=1;
|
||||
p->mpar=tmpf;
|
||||
break;
|
||||
case 8: //letterbox
|
||||
tmpi=(int)map_value_forward(*((double*)parm), 0.0f, 1.0f);//BOOL!!
|
||||
if (p->lbox != tmpi) chg=1;
|
||||
p->lbox=tmpi;
|
||||
break;
|
||||
case 9: //stretch
|
||||
tmpf=map_value_forward(*((double*)parm), -0.2f, 0.2f);
|
||||
if (p->stretch != tmpf) chg=1;
|
||||
p->stretch=tmpf;
|
||||
break;
|
||||
case 10: //Y scale
|
||||
tmpf=map_value_forward(*((double*)parm), 1.5f, 0.5f);
|
||||
if (p->yScale != tmpf) chg=1;
|
||||
p->yScale=tmpf;
|
||||
break;
|
||||
}
|
||||
|
||||
if (chg!=0)
|
||||
@@ -633,6 +745,15 @@ void f0r_get_param_value(f0r_instance_t instance, f0r_param_t parm, int param_in
|
||||
case 7: //manual aspect
|
||||
*((double*)parm)=map_value_backward_log(p->mpar, 0.5, 2.0);
|
||||
break;
|
||||
case 8: //letterbox
|
||||
*((double*)parm)=map_value_backward((float)p->lbox, 0.0f, 1.0f); //BOOL!!
|
||||
break;
|
||||
case 9: //stretch/upscale fix
|
||||
*((double*)parm)=map_value_backward_log(p->stretch, -0.2f, 0.2f);
|
||||
break;
|
||||
case 10: //Y scale
|
||||
*((double*)parm)=map_value_backward(p->yScale, 1.5f, 0.5f);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -19,8 +19,8 @@
|
||||
*/
|
||||
|
||||
/*******************************************************************
|
||||
* The remapping functions use a map aray, which contains a pair
|
||||
* of floating values fo each pixel of the output image. These
|
||||
* The remapping functions use a map array, which contains a pair
|
||||
* of floating values of each pixel of the output image. These
|
||||
* represent the location in the input image, from where the value
|
||||
* of the given output pixel should be interpolated.
|
||||
* They are given in pixels of the input image.
|
||||
@@ -107,7 +107,7 @@ void remap32(int wi, int hi, int wo, int ho, unsigned char *vhs, unsigned char *
|
||||
//**************************************
|
||||
//HERE BEGIN THE INTERPOLATION FUNCTIONS
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
#if defined(_MSC_VER) && _MSC_VER < 1800
|
||||
__inline const float roundf(float x){
|
||||
return (int)floor(x+0.5);
|
||||
}
|
||||
@@ -162,14 +162,17 @@ int interpNN_b(unsigned char *sl, int w, int h, float x, float y, unsigned char
|
||||
// *v interpolirana vrednost
|
||||
int interpNN_b32(unsigned char *sl, int w, int h, float x, float y, unsigned char *v)
|
||||
{
|
||||
//int index = (int)(x+0.5f)*4+(int)(y+0.5f)*4*w; //fast rounding
|
||||
int index = (int)roundf(x)*4+(int)roundf(y)*4*w; //call once
|
||||
|
||||
#ifdef TEST_XY_LIMITS
|
||||
if ((x<0)||(x>w)||(y<0)||(y>h)) return -1;
|
||||
#endif
|
||||
|
||||
v[0]=sl[(int)roundf(x)*4+(int)roundf(y)*4*w];
|
||||
v[1]=sl[(int)roundf(x)*4+(int)roundf(y)*4*w+1];
|
||||
v[2]=sl[(int)roundf(x)*4+(int)roundf(y)*4*w+2];
|
||||
v[3]=sl[(int)roundf(x)*4+(int)roundf(y)*4*w+3];
|
||||
v[0]=sl[index];
|
||||
v[1]=sl[index+1];
|
||||
v[2]=sl[index+2];
|
||||
v[3]=sl[index+3];
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -131,7 +131,7 @@ DelayGrab::DelayGrab(int wdt, int hgt) {
|
||||
}
|
||||
|
||||
DelayGrab::~DelayGrab() {
|
||||
if(delaymap) free(delaymap);
|
||||
free(delaymap);
|
||||
free(imagequeue);
|
||||
}
|
||||
|
||||
@@ -271,7 +271,7 @@ void DelayGrab::set_blocksize(int bs) {
|
||||
delaymapheight = (geo.h)/blocksize;
|
||||
delaymapsize = delaymapheight*delaymapwidth;
|
||||
|
||||
if(delaymap) { free(delaymap); delaymap = NULL; }
|
||||
free(delaymap);
|
||||
delaymap = malloc(delaymapsize*4);
|
||||
|
||||
createDelaymap(current_mode);
|
||||
|
||||
@@ -1,12 +1,13 @@
|
||||
set (SOURCES hqdn3d.c)
|
||||
set (TARGET hqdn3d)
|
||||
set (SOURCES denoise_hqdn3d.c)
|
||||
set (TARGET denoise_hqdn3d)
|
||||
|
||||
if (MSVC)
|
||||
set_source_files_properties (hqdn3d.c PROPERTIES LANGUAGE CXX)
|
||||
set (SOURCES ${SOURCES} ${FREI0R_DEF})
|
||||
endif (MSVC)
|
||||
|
||||
link_libraries(m)
|
||||
if(NOT MSVC)
|
||||
link_libraries(m)
|
||||
endif()
|
||||
add_library (${TARGET} MODULE ${SOURCES})
|
||||
set_target_properties (${TARGET} PROPERTIES PREFIX "")
|
||||
|
||||
|
||||
3
src/filter/denoise/hqdn3d.c → src/filter/denoise/denoise_hqdn3d.c
Executable file → Normal file
3
src/filter/denoise/hqdn3d.c → src/filter/denoise/denoise_hqdn3d.c
Executable file → Normal file
@@ -324,6 +324,9 @@ inst *in;
|
||||
in=(inst*)instance;
|
||||
|
||||
free(in->vps.Line);
|
||||
free(in->vps.Frame[0]);
|
||||
free(in->vps.Frame[1]);
|
||||
free(in->vps.Frame[2]);
|
||||
free(in->Rplani);
|
||||
free(in->Gplani);
|
||||
free(in->Bplani);
|
||||
@@ -2,7 +2,6 @@ set (SOURCES distort0r.c)
|
||||
set (TARGET distort0r)
|
||||
|
||||
if (MSVC)
|
||||
set_source_files_properties (distort0r.c PROPERTIES LANGUAGE CXX)
|
||||
set (SOURCES ${SOURCES} ${FREI0R_DEF})
|
||||
endif (MSVC)
|
||||
|
||||
|
||||
@@ -2,7 +2,6 @@ set (SOURCES dither.c)
|
||||
set (TARGET dither)
|
||||
|
||||
if (MSVC)
|
||||
set_source_files_properties (dither.c PROPERTIES LANGUAGE CXX)
|
||||
set (SOURCES ${SOURCES} ${FREI0R_DEF})
|
||||
endif (MSVC)
|
||||
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
#include <math.h>
|
||||
|
||||
#include "frei0r.h"
|
||||
#include "frei0r_math.h"
|
||||
#include "frei0r/math.h"
|
||||
|
||||
int ditherMagic2x2Matrix[] = {
|
||||
0, 2,
|
||||
@@ -253,7 +253,7 @@ void f0r_update(f0r_instance_t instance, double time,
|
||||
// init look-ups
|
||||
int rows, cols;
|
||||
rows = cols = (int)sqrt(matrixLength);
|
||||
int map[levels];
|
||||
int *map = (int *) malloc(levels * sizeof(int));
|
||||
int i,v;
|
||||
for (i = 0; i < levels; i++)
|
||||
{
|
||||
@@ -297,6 +297,8 @@ void f0r_update(f0r_instance_t instance, double time,
|
||||
*dst++ = *src++;//copy alpha
|
||||
}
|
||||
}
|
||||
|
||||
free(map);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
*/
|
||||
|
||||
#include "frei0r.hpp"
|
||||
#include "frei0r_math.h"
|
||||
#include "frei0r/math.h"
|
||||
#include <stdlib.h>
|
||||
|
||||
class edgeglow : public frei0r::filter
|
||||
@@ -157,17 +157,17 @@ public:
|
||||
|
||||
if (tr<1./6.) g[0]=CLAMP0255(p+((q-p)*6.*tr));
|
||||
else if (tr<0.5) g[0]=CLAMP0255((int32_t)q);
|
||||
else if (tr<1./6.) g[0]=CLAMP0255(p+((q-p)*6.*(2./3.-tr)));
|
||||
else if (tr<2./3.) g[0]=CLAMP0255(p+((q-p)*6.*(2./3.-tr)));
|
||||
else g[0]=CLAMP0255((int32_t)p);
|
||||
|
||||
if (tg<1./6.) g[1]=CLAMP0255(p+((q-p)*6.*tg));
|
||||
else if (tg<0.5) g[1]=CLAMP0255((int32_t)q);
|
||||
else if (tg<1./6.) g[1]=CLAMP0255(p+((q-p)*6.*(2./3.-tg)));
|
||||
else if (tg<2./3.) g[1]=CLAMP0255(p+((q-p)*6.*(2./3.-tg)));
|
||||
else g[1]=CLAMP0255((int32_t)p);
|
||||
|
||||
if (tb<1./6.) g[2]=CLAMP0255(p+((q-p)*6.*tb));
|
||||
else if (tb<0.5) g[2]=CLAMP0255((int32_t)q);
|
||||
else if (tb<1./6.) g[2]=CLAMP0255(p+((q-p)*6.*(2./3.-tb)));
|
||||
else if (tb<2./3.) g[2]=CLAMP0255(p+((q-p)*6.*(2./3.-tb)));
|
||||
else g[2]=CLAMP0255((int32_t)p);
|
||||
}
|
||||
else {
|
||||
@@ -184,6 +184,6 @@ public:
|
||||
frei0r::construct<edgeglow> plugin("Edgeglow",
|
||||
"Edgeglow filter",
|
||||
"Salsaman",
|
||||
0,2,
|
||||
0,3,
|
||||
F0R_COLOR_MODEL_RGBA8888);
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# Elastic Scale
|
||||
|
||||
Elastic scale allows to apply non linear scale to video footage.
|
||||
Elastic scale allows one to apply non linear scale to video footage.
|
||||
|
||||
Written by Matthias Schnöll, Aug 2018 and released under GNU GPL
|
||||
|
||||
@@ -15,7 +15,7 @@ initial release of plugin
|
||||
## Description of the parameters:
|
||||
|
||||
"Scale Center":<br/>
|
||||
Sets the horizontal center where the scaling orgins from. range: [0,1]
|
||||
Sets the horizontal center where the scaling origins from. range: [0,1]
|
||||
|
||||
|
||||
"Linear Scale Area":<br/>
|
||||
|
||||
@@ -28,8 +28,8 @@
|
||||
#define PI 3.141592654
|
||||
|
||||
/**
|
||||
This is a frei0r filter which allows to scale video footage non-linearly.
|
||||
In combination with a linear scale filter, it allows to scale 4:3 footage
|
||||
This is a frei0r filter which allows one to scale video footage non-linearly.
|
||||
In combination with a linear scale filter, it allows one to scale 4:3 footage
|
||||
to 16:9 and maintain the original aspect ratio in the center part of the image.
|
||||
*/
|
||||
|
||||
@@ -303,7 +303,7 @@ private:
|
||||
};
|
||||
|
||||
frei0r::construct<ElasticScale> plugin("Elastic scale filter",
|
||||
"This is a frei0r filter which allows to scale video footage non-linearly.",
|
||||
"This is a frei0r filter which allows one to scale video footage non-linearly.",
|
||||
"Matthias Schnoell",
|
||||
0,2,
|
||||
F0R_COLOR_MODEL_RGBA8888);
|
||||
|
||||
@@ -2,7 +2,6 @@ set (SOURCES emboss.c)
|
||||
set (TARGET emboss)
|
||||
|
||||
if (MSVC)
|
||||
set_source_files_properties (emboss.c PROPERTIES LANGUAGE CXX)
|
||||
set (SOURCES ${SOURCES} ${FREI0R_DEF})
|
||||
endif (MSVC)
|
||||
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
#include <math.h>
|
||||
|
||||
#include "frei0r.h"
|
||||
#include "frei0r_math.h"
|
||||
#include "frei0r/math.h"
|
||||
|
||||
double PI = 3.14159;
|
||||
double pixelScale = 255.9;
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
*/
|
||||
|
||||
#include "frei0r.hpp"
|
||||
#include "frei0r_math.h"
|
||||
#include "frei0r/math.h"
|
||||
#include <string.h>
|
||||
|
||||
#include <cstring>
|
||||
|
||||
@@ -20,51 +20,51 @@
|
||||
#include <string.h>
|
||||
#include <opencv2/opencv.hpp>
|
||||
#include "frei0r.hpp"
|
||||
#include "frei0r_math.h"
|
||||
#include "frei0r/math.h"
|
||||
|
||||
typedef struct {
|
||||
IplImage* hsv; //input image converted to HSV
|
||||
IplImage* hue; //hue channel of HSV image
|
||||
IplImage* mask; //image for masking pixels
|
||||
IplImage* prob; //face probability estimates for each pixel
|
||||
class TrackedObj {
|
||||
public:
|
||||
void update_hist();
|
||||
void update_hue_image (const cv::Mat& image);
|
||||
cv::RotatedRect camshift_track_face();
|
||||
|
||||
CvHistogram* hist; //histogram of hue in original face image
|
||||
cv::Mat hsv; //input image converted to HSV
|
||||
cv::Mat hue; //hue channel of HSV image
|
||||
cv::Mat mask; //image for masking pixels
|
||||
cv::Mat prob; //face probability estimates for each pixel
|
||||
|
||||
CvRect prev_rect; //location of face in previous frame
|
||||
CvBox2D curr_box; //current face location estimate
|
||||
} TrackedObj;
|
||||
cv::Mat hist; //histogram of hue in original face image
|
||||
static const int hist_bins; //number of histogram bins
|
||||
static const float hist_range[2]; //histogram range
|
||||
|
||||
cv::Rect prev_rect; //location of face in previous frame
|
||||
cv::RotatedRect curr_box; //current face location estimate
|
||||
};
|
||||
|
||||
const float TrackedObj::hist_range[2] = { 0, 180 };
|
||||
const int TrackedObj::hist_bins = 30;
|
||||
|
||||
class FaceBl0r: public frei0r::filter {
|
||||
|
||||
public:
|
||||
FaceBl0r(int wdt, int hgt);
|
||||
~FaceBl0r();
|
||||
~FaceBl0r() = default;
|
||||
|
||||
void update(double time,
|
||||
uint32_t* out,
|
||||
const uint32_t* in);
|
||||
|
||||
private:
|
||||
|
||||
// camshift
|
||||
TrackedObj* create_tracked_object (IplImage* image, CvRect* face_rect);
|
||||
void destroy_tracked_object (TrackedObj* tracked_obj);
|
||||
CvBox2D camshift_track_face (IplImage* image, TrackedObj* imgs);
|
||||
void update_hue_image (const IplImage* image, TrackedObj* imgs);
|
||||
|
||||
|
||||
//trackface
|
||||
CvRect* detect_face (IplImage*, CvHaarClassifierCascade*, CvMemStorage*);
|
||||
|
||||
std::vector<cv::Rect> detect_face();
|
||||
|
||||
TrackedObj tracked_obj;
|
||||
|
||||
TrackedObj* tracked_obj;
|
||||
CvBox2D face_box; //area to draw
|
||||
CvRect* face_rect;
|
||||
|
||||
//used by capture_video_frame, so we don't have to keep creating.
|
||||
IplImage* image;
|
||||
cv::Mat image;
|
||||
|
||||
CvHaarClassifierCascade* cascade;
|
||||
CvMemStorage* storage;
|
||||
cv::CascadeClassifier cascade;
|
||||
|
||||
// plugin parameters
|
||||
std::string classifier;
|
||||
@@ -77,7 +77,6 @@ private:
|
||||
double largest;
|
||||
|
||||
std::string old_classifier;
|
||||
|
||||
|
||||
unsigned int face_found;
|
||||
unsigned int face_notfound;
|
||||
@@ -87,18 +86,12 @@ private:
|
||||
frei0r::construct<FaceBl0r> plugin("FaceBl0r",
|
||||
"automatic face blur",
|
||||
"ZioKernel, Biilly, Jilt, Jaromil, ddennedy",
|
||||
1,1, F0R_COLOR_MODEL_PACKED32);
|
||||
1,1, F0R_COLOR_MODEL_BGRA8888);
|
||||
|
||||
FaceBl0r::FaceBl0r(int wdt, int hgt) {
|
||||
|
||||
face_rect = 0;
|
||||
image = 0;
|
||||
tracked_obj = 0;
|
||||
face_found = 0;
|
||||
|
||||
cascade = 0;
|
||||
storage = 0;
|
||||
|
||||
|
||||
classifier = "/usr/share/opencv/haarcascades/haarcascade_frontalface_default.xml";
|
||||
register_param(classifier,
|
||||
"Classifier",
|
||||
@@ -120,52 +113,35 @@ FaceBl0r::FaceBl0r(int wdt, int hgt) {
|
||||
register_param(largest, "Largest", "Maximum object size in pixels, divided by 10000");
|
||||
}
|
||||
|
||||
FaceBl0r::~FaceBl0r() {
|
||||
if(tracked_obj)
|
||||
destroy_tracked_object(tracked_obj);
|
||||
|
||||
if(cascade) cvReleaseHaarClassifierCascade(&cascade);
|
||||
if(storage) cvReleaseMemStorage(&storage);
|
||||
|
||||
}
|
||||
|
||||
void FaceBl0r::update(double time,
|
||||
uint32_t* out,
|
||||
const uint32_t* in) {
|
||||
const uint32_t* in)
|
||||
{
|
||||
if (cascade.empty()) {
|
||||
cv::setNumThreads(cvRound(threads * 100));
|
||||
if (classifier.length() == 0 || classifier == old_classifier) {
|
||||
// same as before, avoid repeating error messages
|
||||
memcpy(out, in, size * 4); // of course assuming we are RGBA only
|
||||
return;
|
||||
}
|
||||
old_classifier = classifier;
|
||||
}
|
||||
|
||||
if (!cascade) {
|
||||
cvSetNumThreads(cvRound(threads * 100));
|
||||
if (classifier.length() > 0) {
|
||||
if (classifier == old_classifier) {
|
||||
// same as before, avoid repeating error messages
|
||||
memcpy(out, in, size * 4); // of course assuming we are RGBA only
|
||||
return;
|
||||
} else old_classifier = classifier;
|
||||
|
||||
cascade = (CvHaarClassifierCascade*) cvLoad(classifier.c_str(), 0, 0, 0 );
|
||||
if (!cascade) {
|
||||
fprintf(stderr, "ERROR in filter facebl0r, classifier cascade not found:\n");
|
||||
fprintf(stderr, " %s\n", classifier.c_str());
|
||||
memcpy(out, in, size * 4);
|
||||
return;
|
||||
}
|
||||
storage = cvCreateMemStorage(0);
|
||||
}
|
||||
else {
|
||||
memcpy(out, in, size * 4);
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (!cascade.load(classifier.c_str())) {
|
||||
fprintf(stderr, "ERROR in filter facebl0r, classifier cascade not found:\n");
|
||||
fprintf(stderr, " %s\n", classifier.c_str());
|
||||
memcpy(out, in, size * 4);
|
||||
return;
|
||||
}
|
||||
|
||||
// sanitize parameters
|
||||
recheck = CLAMP(recheck, 0.001, 1.0);
|
||||
search_scale = CLAMP(search_scale, 0.11, 1.0);
|
||||
neighbors = CLAMP(neighbors, 0.01, 1.0);
|
||||
|
||||
if( !image )
|
||||
image = cvCreateImage( cvSize(width,height), IPL_DEPTH_8U, 4 );
|
||||
|
||||
memcpy(image->imageData, in, size * 4);
|
||||
// copy input image to OpenCV
|
||||
image = cv::Mat(height, width, CV_8UC4, (void*)in);
|
||||
tracked_obj.update_hue_image(image);
|
||||
|
||||
/*
|
||||
no face*
|
||||
@@ -176,27 +152,24 @@ void FaceBl0r::update(double time,
|
||||
no face*
|
||||
*/
|
||||
if(face_notfound>0) {
|
||||
|
||||
std::vector<cv::Rect> faces;
|
||||
if(face_notfound % cvRound(recheck * 1000) == 0)
|
||||
face_rect = detect_face(image, cascade, storage);
|
||||
faces = detect_face();
|
||||
|
||||
// if no face detected
|
||||
if (!face_rect) {
|
||||
if (faces.empty()) {
|
||||
face_notfound++;
|
||||
} else {
|
||||
//track detected face with camshift
|
||||
if(tracked_obj)
|
||||
destroy_tracked_object(tracked_obj);
|
||||
tracked_obj = create_tracked_object(image, face_rect);
|
||||
tracked_obj.prev_rect = faces[0];
|
||||
tracked_obj.update_hist();
|
||||
face_notfound = 0;
|
||||
face_found++;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if(face_found>0) {
|
||||
if (face_found > 0) {
|
||||
//track the face in the new frame
|
||||
face_box = camshift_track_face(image, tracked_obj);
|
||||
cv::RotatedRect face_box = tracked_obj.camshift_track_face();
|
||||
|
||||
int min = cvRound(smallest * 1000);
|
||||
min = min? min : 10;
|
||||
@@ -210,17 +183,13 @@ void FaceBl0r::update(double time,
|
||||
face_notfound++;
|
||||
}
|
||||
else {
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
cvSetImageROI (image, tracked_obj->prev_rect);
|
||||
// cvSmooth (image, image, CV_BLUR, 22, 22, 0, 0);
|
||||
cvSmooth (image, image, CV_BLUR, 23, 23, 0, 0);
|
||||
// cvSmooth (image, image, CV_GAUSSIAN, 11, 11, 0, 0);
|
||||
cvResetImageROI (image);
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
|
||||
cv::Rect blur_region = tracked_obj.prev_rect & cv::Rect({0, 0}, image.size());
|
||||
cv::Mat blur(image, blur_region);
|
||||
cv::blur(blur, blur, {23, 23}, cv::Point(-1, -1));
|
||||
|
||||
//outline face ellipse
|
||||
if (ellipse)
|
||||
cvEllipseBox(image, face_box, CV_RGB(255,0,0), 2, CV_AA, 0);
|
||||
cv::ellipse(image, face_box, CV_RGB(255,0,0), 2, cv::LINE_AA);
|
||||
|
||||
face_found++;
|
||||
if(face_found % cvRound(recheck * 1000) == 0)
|
||||
@@ -228,133 +197,76 @@ void FaceBl0r::update(double time,
|
||||
}
|
||||
}
|
||||
|
||||
memcpy(out, image->imageData, size * 4);
|
||||
cvReleaseImage(&image);
|
||||
memcpy(out, image.data, size * 4);
|
||||
}
|
||||
|
||||
/* Given an image and a classider, detect and return region. */
|
||||
CvRect* FaceBl0r::detect_face (IplImage* image,
|
||||
CvHaarClassifierCascade* cascade,
|
||||
CvMemStorage* storage) {
|
||||
|
||||
CvRect* rect = 0;
|
||||
|
||||
if (cascade && storage) {
|
||||
std::vector<cv::Rect> FaceBl0r::detect_face()
|
||||
{
|
||||
if (cascade.empty()) {
|
||||
return std::vector<cv::Rect>();
|
||||
}
|
||||
|
||||
//use an equalized gray image for better recognition
|
||||
IplImage* gray = cvCreateImage(cvSize(image->width, image->height), 8, 1);
|
||||
cvCvtColor(image, gray, CV_BGR2GRAY);
|
||||
cvEqualizeHist(gray, gray);
|
||||
cvClearMemStorage(storage);
|
||||
cv::Mat gray;
|
||||
cv::cvtColor(image, gray, cv::COLOR_BGR2GRAY);
|
||||
cv::equalizeHist(gray, gray);
|
||||
|
||||
//get a sequence of faces in image
|
||||
int min = cvRound(smallest * 1000);
|
||||
CvSeq *faces = cvHaarDetectObjects(gray, cascade, storage,
|
||||
std::vector<cv::Rect> faces;
|
||||
cascade.detectMultiScale(gray, faces,
|
||||
search_scale * 10.0,
|
||||
cvRound(neighbors * 100),
|
||||
CV_HAAR_FIND_BIGGEST_OBJECT|//since we track only the first, get the biggest
|
||||
CV_HAAR_DO_CANNY_PRUNING, //skip regions unlikely to contain a face
|
||||
cvSize(min, min));
|
||||
|
||||
//if one or more faces are detected, return the first one
|
||||
if(faces && faces->total)
|
||||
rect = (CvRect*) cvGetSeqElem(faces, 0);
|
||||
cv::CASCADE_FIND_BIGGEST_OBJECT|//since we track only the first, get the biggest
|
||||
cv::CASCADE_DO_CANNY_PRUNING, //skip regions unlikely to contain a face
|
||||
cv::Size(min, min));
|
||||
|
||||
cvReleaseImage(&gray);
|
||||
}
|
||||
|
||||
return rect;
|
||||
return faces;
|
||||
}
|
||||
|
||||
/* Create a camshift tracked object from a region in image. */
|
||||
TrackedObj* FaceBl0r::create_tracked_object (IplImage* image, CvRect* region) {
|
||||
TrackedObj* obj;
|
||||
|
||||
//allocate memory for tracked object struct
|
||||
if((obj = (TrackedObj *) malloc(sizeof *obj)) != NULL) {
|
||||
//create-image: size(w,h), bit depth, channels
|
||||
obj->hsv = cvCreateImage(cvGetSize(image), 8, 3);
|
||||
obj->mask = cvCreateImage(cvGetSize(image), 8, 1);
|
||||
obj->hue = cvCreateImage(cvGetSize(image), 8, 1);
|
||||
obj->prob = cvCreateImage(cvGetSize(image), 8, 1);
|
||||
|
||||
int hist_bins = 30; //number of histogram bins
|
||||
float hist_range[] = {0,180}; //histogram range
|
||||
float* range = hist_range;
|
||||
obj->hist = cvCreateHist(1, //number of hist dimensions
|
||||
&hist_bins, //array of dimension sizes
|
||||
CV_HIST_ARRAY, //representation format
|
||||
&range, //array of ranges for bins
|
||||
1); //uniformity flag
|
||||
}
|
||||
|
||||
//create a new hue image
|
||||
update_hue_image(image, obj);
|
||||
|
||||
float max_val = 0.f;
|
||||
|
||||
void TrackedObj::update_hist()
|
||||
{
|
||||
//create a histogram representation for the face
|
||||
cvSetImageROI(obj->hue, *region);
|
||||
cvSetImageROI(obj->mask, *region);
|
||||
cvCalcHist(&obj->hue, obj->hist, 0, obj->mask);
|
||||
cvGetMinMaxHistValue(obj->hist, 0, &max_val, 0, 0 );
|
||||
cvConvertScale(obj->hist->bins, obj->hist->bins,
|
||||
max_val ? 255.0/max_val : 0, 0);
|
||||
cvResetImageROI(obj->hue);
|
||||
cvResetImageROI(obj->mask);
|
||||
|
||||
//store the previous face location
|
||||
obj->prev_rect = *region;
|
||||
cv::Mat hue_roi(hue, prev_rect);
|
||||
cv::Mat mask_roi(mask, prev_rect);
|
||||
|
||||
return obj;
|
||||
}
|
||||
|
||||
/* Release resources from tracked object. */
|
||||
void FaceBl0r::destroy_tracked_object (TrackedObj* obj) {
|
||||
cvReleaseImage(&obj->hsv);
|
||||
cvReleaseImage(&obj->hue);
|
||||
cvReleaseImage(&obj->mask);
|
||||
cvReleaseImage(&obj->prob);
|
||||
cvReleaseHist(&obj->hist);
|
||||
|
||||
free(obj);
|
||||
const float* range = hist_range;
|
||||
cv::calcHist(&hue_roi, 1, nullptr, mask_roi, hist, 1, &hist_bins, &range);
|
||||
normalize(hist, hist, 0, 255, cv::NORM_MINMAX);
|
||||
}
|
||||
|
||||
/* Given an image and tracked object, return box position. */
|
||||
CvBox2D FaceBl0r::camshift_track_face (IplImage* image, TrackedObj* obj) {
|
||||
CvConnectedComp components;
|
||||
|
||||
//create a new hue image
|
||||
update_hue_image(image, obj);
|
||||
|
||||
cv::RotatedRect TrackedObj::camshift_track_face()
|
||||
{
|
||||
//create a probability image based on the face histogram
|
||||
cvCalcBackProject(&obj->hue, obj->prob, obj->hist);
|
||||
cvAnd(obj->prob, obj->mask, obj->prob, 0);
|
||||
const float* range = hist_range;
|
||||
cv::calcBackProject(&hue, 1, nullptr, hist, prob, &range);
|
||||
prob &= mask;
|
||||
|
||||
//use CamShift to find the center of the new face probability
|
||||
cvCamShift(obj->prob, obj->prev_rect,
|
||||
cvTermCriteria(CV_TERMCRIT_EPS | CV_TERMCRIT_ITER, 10, 1),
|
||||
&components, &obj->curr_box);
|
||||
cv::RotatedRect curr_box = CamShift(prob, prev_rect,
|
||||
cv::TermCriteria(cv::TermCriteria::EPS | cv::TermCriteria::MAX_ITER, 10, 1 ));
|
||||
|
||||
//update face location and angle
|
||||
obj->prev_rect = components.rect;
|
||||
obj->curr_box.angle = -obj->curr_box.angle;
|
||||
//update face location
|
||||
prev_rect = curr_box.boundingRect();
|
||||
|
||||
return obj->curr_box;
|
||||
return curr_box;
|
||||
}
|
||||
|
||||
void FaceBl0r::update_hue_image (const IplImage* image, TrackedObj* obj) {
|
||||
void TrackedObj::update_hue_image (const cv::Mat& image) {
|
||||
//limits for calculating hue
|
||||
int vmin = 65, vmax = 256, smin = 55;
|
||||
|
||||
|
||||
//convert to HSV color model
|
||||
cvCvtColor(image, obj->hsv, CV_BGR2HSV);
|
||||
|
||||
cv::cvtColor(image, hsv, cv::COLOR_BGR2HSV);
|
||||
|
||||
//mask out-of-range values
|
||||
cvInRangeS(obj->hsv, //source
|
||||
cvScalar(0, smin, MIN(vmin, vmax), 0), //lower bound
|
||||
cvScalar(180, 256, MAX(vmin, vmax) ,0), //upper bound
|
||||
obj->mask); //destination
|
||||
|
||||
cv::inRange(hsv, //source
|
||||
cv::Scalar(0, smin, MIN(vmin, vmax)), //lower bound
|
||||
cv::Scalar(180, 256, MAX(vmin, vmax)), //upper bound
|
||||
mask); //destination
|
||||
|
||||
//extract the hue channel, split: src, dest channels
|
||||
cvSplit(obj->hsv, obj->hue, 0, 0, 0 );
|
||||
cv::extractChannel(hsv, hue, 0);
|
||||
}
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
#include <string.h>
|
||||
#include <opencv2/opencv.hpp>
|
||||
#include "frei0r.hpp"
|
||||
#include "frei0r_math.h"
|
||||
#include "frei0r/math.h"
|
||||
|
||||
#define USE_ROI
|
||||
#define PAD (40)
|
||||
@@ -148,13 +148,13 @@ public:
|
||||
count = 1; // reset the recheck counter
|
||||
if (objects.size() > 0) // reset the list of objects
|
||||
objects.clear();
|
||||
double elapsed = (double) cvGetTickCount();
|
||||
double elapsed = (double) cv::getTickCount();
|
||||
|
||||
objects = detect();
|
||||
|
||||
// use detection time to throttle frequency of re-detect vs. redraw (automatic recheck)
|
||||
elapsed = cvGetTickCount() - elapsed;
|
||||
elapsed = elapsed / ((double) cvGetTickFrequency() * 1000.0);
|
||||
elapsed = cv::getTickCount() - elapsed;
|
||||
elapsed = elapsed / ((double) cv::getTickFrequency() * 1000.0);
|
||||
|
||||
// Automatic recheck uses an undocumented negative parameter value,
|
||||
// which is not compliant, but technically feasible.
|
||||
@@ -188,7 +188,7 @@ private:
|
||||
}
|
||||
|
||||
// use an equalized grayscale to improve detection
|
||||
cv::cvtColor(image_roi, gray, CV_BGR2GRAY);
|
||||
cv::cvtColor(image_roi, gray, cv::COLOR_BGR2GRAY);
|
||||
|
||||
// use a smaller image to improve performance
|
||||
cv::resize(gray, small, cv::Size(cvRound(gray.cols * scale), cvRound(gray.rows * scale)));
|
||||
@@ -249,8 +249,8 @@ private:
|
||||
{
|
||||
cv::Rect* r = (cv::Rect*) &objects[i];
|
||||
cv::Point center;
|
||||
int thickness = stroke <= 0? CV_FILLED : cvRound(stroke * 100);
|
||||
int linetype = antialias? CV_AA : 8;
|
||||
int thickness = stroke <= 0? cv::FILLED : cvRound(stroke * 100);
|
||||
int linetype = antialias? cv::LINE_AA : 8;
|
||||
|
||||
center.x = cvRound((r->x + r->width * 0.5) / scale);
|
||||
center.y = cvRound((r->y + r->height * 0.5) / scale);
|
||||
|
||||
11
src/filter/filmgrain/CMakeLists.txt
Normal file
11
src/filter/filmgrain/CMakeLists.txt
Normal file
@@ -0,0 +1,11 @@
|
||||
set (SOURCES filmgrain.c)
|
||||
set (TARGET filmgrain)
|
||||
|
||||
if (MSVC)
|
||||
set (SOURCES ${SOURCES} ${FREI0R_DEF})
|
||||
endif (MSVC)
|
||||
|
||||
add_library (${TARGET} MODULE ${SOURCES})
|
||||
set_target_properties (${TARGET} PROPERTIES PREFIX "")
|
||||
|
||||
install (TARGETS ${TARGET} LIBRARY DESTINATION ${LIBDIR})
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user