Compare commits

...

153 Commits

Author SHA1 Message Date
Jaromil
0dbbac5258 Heatmap0r for a hot frei0r experience (#218)
Natural extension of the `tint0r` filter. The filter operates only between two colours, while the `heatmap0r` filter works between three colours: two extremes and one adjustable mid-point, and smoothly interpolates between them using quadratic interpolation. It can also be used for analysing the gamut of luminosity.
2025-10-07 16:15:56 +02:00
Jaromil
2183bc1cf6 Merge branch 'master' into features 2025-10-07 08:11:45 +02:00
Jaromil
65fa7ea8ea Optimize tint0r, and sigmoidaltransfer filter (#217)
target SSE4.1 with opportunistic assembler optimizations via macros.
2025-10-07 08:06:05 +02:00
Cynthia
d6a0ea5268 Merge branch 'master' into master 2025-10-07 08:45:23 +05:30
esmane
69d23fc0a2 Improve progressive scan mode 2025-10-06 23:17:09 +02:00
esmane
def52c449f Improve (and simplify) NTSC filter 2025-10-06 23:17:09 +02:00
Jaromil
772d2e5edb fix: strtok_r is _s on windows 2025-10-06 22:42:32 +02:00
Jaromil
f11132bb4b fix: correct use of snprintf and strtok 2025-10-06 22:32:36 +02:00
Cynthia
455aa7d1f5 Merge in upstream changes & add self to AUTHORS 2025-09-19 11:21:21 +05:30
Cynthia
4a4503b1e8 Fix typos & rename ids in heatmap0r 2025-09-19 10:53:44 +05:30
Cynthia
8482bc9680 change heatmap0r colorscheme 2025-09-17 11:40:29 +02:00
Cynthia
cf5cb9654d rename p0st0r to heatmap0r 2025-09-17 11:40:29 +02:00
Cynthia
91f4cb3bbc feat: add p0st0r filter 2025-09-17 11:40:29 +02:00
Jaromil
fb4e92925f Merge branch 'master' into master 2025-09-17 11:39:35 +02:00
luzpaz
62dd46650c fix various typos in the codebase
Found via `codespell -L currenty,distint,parm,shotcut`
2025-09-17 11:37:33 +02:00
IOhannes m zmölnig
de67485abb Add Vadim Druzhin to the AUTHORS
author of "sleid0r"
2025-09-17 11:15:38 +02:00
IOhannes m zmölnig
5d8e8f8498 Add Johannes Jeg to the authors
author of "mirr0r"
2025-09-17 11:15:38 +02:00
IOhannes m zmölnig
683e40f147 fix some typos 2025-09-17 11:15:38 +02:00
IOhannes m zmölnig
a12d01602b one author per line 2025-09-17 11:15:38 +02:00
Cynthia
42ee3fee46 change heatmap0r colorscheme 2025-09-12 16:38:23 +05:30
Cynthia
dcd39d95a7 rename p0st0r to heatmap0r 2025-09-12 14:39:29 +05:30
Cynthia
ac46ae351d feat: add p0st0r filter 2025-09-12 14:26:31 +05:30
Cynthia
cd109d4452 Optimize the sigmoidal filter with LUTs, and make curve customizable 2025-09-11 20:31:19 +05:30
Cynthia
542b9a9ddb Optimize tint0r filter using SSE4.1 2025-09-08 22:17:43 +05:30
Jaromil
e7dd4f600b fix: authors filename in release pack 2025-09-03 16:34:34 +02:00
Jaromil
4958ce76b9 fix: brew install cmake already pinned 2025-09-03 11:26:57 +02:00
Jaromil
1d7af87d8e fix: brew update for release build 2025-09-03 11:20:39 +02:00
esmane
f7f933322d feat: Add NTSC/VHS Filter (#212)
* Create CMakeLists.txt

* Add NTSC filter

* Scale output to display

* relax linter about header guards format

---------

Co-authored-by: Jaromil <jaromil@dyne.org>
2025-09-03 10:25:25 +02:00
Dan Dennedy
b47c180376 Add "Pass-through alpha" to pixeliz0r (#206) 2025-04-26 23:37:11 -07:00
Dan Dennedy
3d288d95a7 fix missing POST_BUILD 2025-04-07 14:26:17 +02:00
Dan Dennedy
1f8e21e27f Fix bad add_custom_command() in distclean target
`add_custom_command()` has 2 formats: OUTPUT and TARGET. This is TARGET,
but TARGET does not permit OUTPUT.

see https://cmake.org/cmake/help/v3.31/policy/CMP0175.html
and https://cmake.org/cmake/help/v3.31/command/add_custom_command.html

Also, I converted to now-prefered lowercase (only lowercase works in my
IDE to pull up context-sensitive help for CMake). And I replaced a Make-
oriented COMMAND on `add_custom_target()` to a proper `COMMENT`.
2025-04-07 14:26:17 +02:00
Dan Dennedy
85f6e9dba2 Upgrade to actions/checkout & upload-artifact v4 2025-04-07 14:26:17 +02:00
Dan Dennedy
eb9e96d200 Add CMake max-policy version
This attempts to insulate projects from changes in future versions of
CMake.
2025-04-07 14:26:17 +02:00
Dan Dennedy
31efba74b2 Fix configuring with CMake version 4
See https://cmake.org/cmake/help/latest/release/4.0.html#deprecated-and-
removed-features

> Compatibility with versions of CMake older than 3.5 has been removed.
2025-04-07 14:26:17 +02:00
Brian Matherly
2328ce3802 Add vsync option to nosync0r filter 2025-02-06 04:42:33 +01:00
IOhannes m zmölnig
8bf0322bdc Make sure that CFLAGS from the cmdline are honoured
Origin: Debian
Bug: <URL to the upstream bug report if any, implies patch has been forwarded, optional>
Forwarded: no
Last-Update: 2025-01-11

Last-Update: 2025-01-11
Gbp-Pq: Name apply_CFLAGS.patch
2025-01-12 06:21:31 +01:00
Johann
9178c72e59 mirr0r filter added (#196)
* mirr0r filter added

* removed redundant and unused includes

* Using Cairo graphics library

* fixed parameters range

* Clear the screen before drawing, to avoid problems with image sources with transparency.

* Remove unused import
2024-11-15 11:20:44 +01:00
Jaromil
475c9a409b update authors 2024-11-10 18:22:41 +01:00
erik Beck
b528b26fd4 Adding Euclid Eraser to mixer2 2024-09-04 09:28:08 +02:00
Dan Dennedy
bc7d7a3ccc fix GitHub vulnerability in download-artifact
CVE-2024-42471
2024-09-03 16:29:41 -07:00
Raphael Graf
cbb507dbbc Fix cast to bool type in get_param_value() 2024-07-22 17:36:42 +02:00
Ajrat Makhmutov
e7fa53f312 Move the auxiliary libraries to a separate directory
This is necessary in order to avoid clogging the system
directory. It will also be easier to put these libraries
in a separate distribution package.
2024-07-22 17:28:47 +02:00
Ajrat Makhmutov
06870b4298 fix CMakeLists.txt: install all headers from the include dir 2024-07-22 17:28:47 +02:00
Jaromil
cdeddc7553 update node in github actions for semver 2024-06-07 11:00:56 +02:00
esmane
7f0c0a5dfc fix: reduce dust effect on Windows
on Windows RAND_MAX is only 32,767.
2024-06-03 12:43:16 +02:00
esmane
d25ef65a9b use fabs and CLAMP0255 instead of custom functions 2024-06-03 12:43:16 +02:00
esmane
f6b0fc3cbe fix: minor improvements 2024-06-03 12:43:16 +02:00
esmane
33ebfb3517 fix crash when "max movement" is set to 0 2024-06-03 12:43:16 +02:00
esmane
784f2061e5 fix memory leak when blur = 0 2024-06-03 12:43:16 +02:00
esmane
2a0d87428c change inline functions to static inline 2024-05-29 13:24:38 +02:00
esmane
9a0650cffd change inline functions to static inline 2024-05-29 13:24:38 +02:00
esmane
fdc9f32a4f significant gateweave improvements 2024-04-11 00:40:09 +02:00
esmane
d86b6f94c6 lower grainy black point 2024-04-11 00:40:09 +02:00
esmane
d32a62eeda more grain improvements 2024-04-11 00:40:09 +02:00
esmane
f20a6d59c9 minor improvements 2024-04-11 00:40:09 +02:00
esmane
9f39a2350f minor improvements + add flicker parameter 2024-04-11 00:40:09 +02:00
esmane
7ae35d1715 fix crash when movement is set to zero 2024-04-11 00:40:09 +02:00
esmane
a0e33ae61b improve dust effects 2024-04-11 00:40:09 +02:00
esmane
25526005c2 Update gateweave.c
smoothed gateweave effect
2024-04-11 00:40:09 +02:00
esmane
be95dd5394 Update filmgrain.c 2024-04-11 00:40:09 +02:00
esmane
e0b09572fe Update CMakeLists.txt 2024-04-11 00:40:09 +02:00
esmane
ac71b128e9 Create CMakeLists.txt 2024-04-11 00:40:09 +02:00
esmane
ba04c6dfc7 Create filmgrain.c 2024-04-11 00:40:09 +02:00
esmane
3b2eeaa38c Create CMakeLists.txt
i think i did this right
2024-04-11 00:40:09 +02:00
esmane
967b121fe7 Create gateweave.c 2024-04-11 00:40:09 +02:00
Brendan Hack
36e7da5d9e Add new Kaleid0sc0pe example video 2024-02-25 09:16:36 +01:00
Jaromil
e8595c6cd2 fix: doxygen code documentation 2024-02-05 09:26:59 +00:00
Jaromil
a303b82f34 fix: update authors and trigger fix release 2023-12-08 07:33:38 +00:00
Brendan Hack
448be4b935 Check that the C++11 future feature is supported
The mingw cross compiler for windows can be built with either a
posix thread model or a win32 thread model. The win32 thread model does
not fully support future. So we detect if future compilation works and
disable multithreading if not.

Fixes issue #178
2023-12-08 08:26:27 +01:00
Brian Matherly
659e409c63 Fix nosync0r crash when hsync is negative
As reported here:
https://forum.shotcut.org/t/shotcut-crashes-when-using-certain-types-of-keyframes/41866
2023-12-08 08:23:20 +01:00
Dan Dennedy
76b727f247 fix alphaspot transition param
clang on macOS stopped handling the "Transition width" parameter.
2023-12-07 22:54:54 -08:00
Jaromil
49f759d9e1 fix: water filter
contributed by @qq2225936589 in #106
2023-08-04 16:50:11 +02:00
Brendan Hack
5770116b0a Add kaleid0sc0pe filter
Original implementation from https://github.com/gbendy/kaleidoscope

Includes minor modifications to build correctly in the frei0r source
tree.
2023-07-24 15:57:03 +02:00
Raphael Graf
c3f987c4cc Fix some broken links and typos in README.md 2023-06-11 10:31:54 +02:00
Raphael Graf
8e87196572 Do not check for NULL before calling free() 2023-05-30 16:24:08 +02:00
Jaromil
203c03a61d update links to third party apps 2023-05-30 16:12:26 +02:00
Jaromil
929afe1e44 correct denoise naming 2023-05-30 15:55:04 +02:00
Jaromil
dbb348630c correct naming of alpha0ps multiple plugins 2023-05-30 15:55:04 +02:00
Jaromil
ad4cbc890b remove camelcase from tehroxx0r plugin
dir and plugin name should be the same in this case (case sensitive match)
2023-05-30 15:55:04 +02:00
Jaromil
7228e0fb4f rename pr0be and pr0file filters prefixing measure_
all directories including multiple plugins should prefix the plugin name with
the directory name separated by underscore.
2023-05-30 15:55:04 +02:00
Jaromil
804f2098f7 ignore local build files for web gallery 2023-05-30 15:55:04 +02:00
Raphael Graf
69819601c6 Prevent compiler warnings in select0r 2023-05-23 18:41:30 +02:00
Jaromil
2c45f1f093 feat: release various fixes found using ASAN tests
various heap buffer overflows were found applying a new address sanitization test suite, fixes were kindly contributed by @rrralpha

list of fixed filters: curves, dodge, pixs0r, hqdn3d, colortap, keyspillm0pup, cairogradient.

this release should help fix a crash in kdenline related to the curves overflow.

update node to fix action semantic release
2023-05-17 23:20:20 +02:00
Jaromil
c0bbc2fe10 curves init fix to run without paramenter changes 2023-05-12 08:21:16 +02:00
Raphael Graf
a0bc641d9b Fix a memory leak and an off-by-one problem in curves filter. 2023-05-12 08:21:16 +02:00
Raphael Graf
ae6484e9dc dodge: fix clamping to 0 - 255 2023-05-12 06:49:50 +02:00
Raphael Graf
bcad9ad6a7 Fix shifting of rows by 0 pixels in pixs0r filter
Resolves #162
2023-05-01 20:51:52 +02:00
Raphael Graf
73a6e3fa38 Fix memory leak in hqdn3d
Resolves #154
2023-04-27 13:56:06 +02:00
Raphael Graf
df066ea634 Fix memory leak in colortap
Resolves #157
2023-04-26 12:46:38 +02:00
Raphael Graf
cfcf6d4051 Fix memory leak in keyspillm0pup
Resolves #155
2023-04-26 12:42:59 +02:00
Brian Matherly
3e1234b9f2 Fix artifacts/flashing when using cairogradient
Cairo blends with the destination image. This can result in artifacts
if the destination image is not cleared.

As reported here:
https://forum.shotcut.org/t/size-position-rotate-and-nosync-works-on-sth-different-than-current-layer-plus-strange-blinking/37042
2023-02-26 20:06:20 +01:00
Jaromil
599b478434 improve readme and link story 2023-01-03 10:57:52 +01:00
Jaromil
6cb9759e90 feat: add linux build and release 2023-01-02 18:55:02 +01:00
Jaromil
b3b6c0276e feat(build): osx build in CI (#146)
also cleanup and separation of test and release workflows
2022-12-31 16:10:04 +01:00
Jaromil
ade083a867 msvc build fixes on sleid0r 2022-12-30 12:19:42 +01:00
Jaromil
92625bcd0c feat(build): remove autoconf and adopt cmake exclusively (#142)
* remove autoconf build system
* update documentation
* add links to BSD ports in README

BREAKING CHANGE: Package maintainers relying on autoconf please note that this won't work anymore. Our CMake setup is tested to support both GNUMake, Ninja and NMake for the compiler legwork.
2022-12-30 11:48:21 +01:00
xsbee
4c9b087fbb Add Filter 'pixs0r' for Glitch Art (#127)
* pixs0r:	random horizontal block shifting filter

This filter imitates contemporary glitch art by shifting blocks
left or rightward with static/variable block height.

* Include pixs0r directory in filter CMakeLists.txt

Co-authored-by: Jaromil <jaromil@dyne.org>
2022-12-30 11:46:34 +01:00
Jaromil
24c480cd0d 12 new transition effects 'sleid0r' (#141)
imported 12 new transition (mixer2) effects from sleid0r-effects by half-bit software
wipe-up
wipe-right
wipe-rect
wipe-left
wipe-down
wipe-circle
wipe-barn-door-v
wipe-barn-door-h
slide-up
slide-right
slide-left
slide-down
push-up
push-right
push-left
push-down
2022-12-30 11:08:52 +01:00
Jaromil
6f2fdb2f89 updated readme documentation
updated info and links
2022-12-28 20:33:24 +01:00
Jaromil
28ed1548ee feat: test suite and ci improvements
linux build is dismissed (using distro packages or source recommended) and
release builds target win64 built using msvc

also implemented skip labels:
- skip-test
- skip-lint
- skip-release

test will list info about plugins found in any directory in a json file

also includes various ci fixes
2022-12-28 19:30:49 +01:00
Jaromil
dcbc1ffc80 remove newlines from descriptions of overlay and burn mixer2 2022-12-28 19:30:49 +01:00
Jaromil
4ee2c0503c remove newline in description of dodge mixer2 2022-12-28 19:30:49 +01:00
Jaromil
6d3437d6bc remove newline in description of screen mixer2 2022-12-28 19:30:49 +01:00
Jaromil
0355da4b24 initial info extractor for tests 2022-12-28 19:30:41 +01:00
Jaromil
ef3cba26a9 omit error message in tutorial load
commented, in case redirect to stderr
2022-12-28 10:32:48 +01:00
Jean-Damien Durand
df6f48fe6e Remove VLA from dither 2022-12-28 08:19:53 +01:00
Jean-Damien Durand
04ac1c58b7 Enable curves everywhere 2022-12-28 08:19:34 +01:00
Jean-Damien Durand
0e9ba7a109 Remove VLA from d90stairsteppingfix 2022-12-28 08:17:02 +01:00
Jaromil
a4f417d0d4 fix: remove escaped quotes in plugin explanations 2022-12-28 07:36:59 +01:00
Jaromil
3eb442ff9d fix: remove link to libm in measure filter 2022-12-28 01:58:12 +01:00
Jaromil
112f52d745 fix: don't upload release assets if no release is tagged 2022-12-28 01:07:28 +01:00
Jaromil
c128c1123e fix: add changelog to semantic release 2022-12-28 00:44:33 +01:00
Jaromil
59daec3f69 fix: semantic release detection 2022-12-28 00:30:32 +01:00
Jaromil
d989097b1d fix: skip release job if semantic version is not in release mode 2022-12-28 00:21:59 +01:00
Jaromil
40b170cc1b feat: github workflow for ci build
also features:
- semantic release
- cpp linter
- binary release
- cmake+ninja build
2022-12-27 23:47:23 +01:00
Peter Eszlari
db45e9320b fix MSVC compilation
The following filters needed to be disabled because of
Variable Length Arrays (VLA), but are enabled when
compiling with clang-cl:

* curves
* d90stairsteppingfix
* dither
2022-12-27 16:45:20 +01:00
david smyth
a9d15ff07e added Elastic Scale, crop and Y scale to defish0r (#126)
* added Elastic Scale, crop and Y scale to defish0r

Dynamic Stretch. -0.2 to 0.2. added a simplified version of the 'Elastic Scale' filter. fixes gopro up-scaled videos 4:3 to 16:9 thats used in GoPro's Superview
Crop. true/false. crop all 4 borders straight. removing distorted sections
Y scale. 1.5 to 0.5. independently scale Y axis 

added fix for Visual Studio roundf. VS 2013+ supports this function
removed unnecessary calls to roundf in interpNN_b32(nearest neighbor). speed boost

* fixed names, typos and float values
2022-06-26 16:15:34 -07:00
Dan Dennedy
6a576f4538 fix regression in c3d7763a retaining color 2022-06-08 11:35:39 -07:00
Dan Dennedy
c3d7763a62 remove endian-sensitive code in alphaspot
This also reduces the memory and makes the code easier to read.

Somehow this also fixes the "Transition width" (softness) parameter on
Apple Silicon not working as reported here:
https://forum.shotcut.org/t/the-sharpness-of-the-mask-edges-cannot-be-
adjusted/33593
2022-04-30 13:06:13 -07:00
Dan Dennedy
a0f49085bf remove unused variable in alphaspot 2022-04-30 12:13:22 -07:00
Dan Dennedy
6a81092c24 convert double literals to float to match types 2022-04-30 12:12:30 -07:00
Dan Dennedy
4aad575396 reformat alphaspot.c 2022-04-30 12:04:32 -07:00
Dan Dennedy
114a72f438 re-enable missing plugins on macOS 2022-04-05 12:21:25 -07:00
Dan Dennedy
ee21d097b3 fix autotools build fails on removed TODO 2022-03-28 10:14:25 -07:00
Jaromil
c11beecfaa update docs for release 2022-03-27 22:59:28 +02:00
Dan Dennedy
febd73874d fix divide by zero crash in glitch0r 2022-01-06 13:50:04 -08:00
Dan Dennedy
e48da90c4e fix cairoblend input 1 alpha not copied 2021-12-23 13:16:56 -08:00
Raphael Graf
5e74dfa3ad edgeglow: Fix hsl to rgb conversion 2021-12-16 21:53:41 -08:00
Raphael Graf
efa333bd51 pixeliz0r: Limit the blocksize to a minimum of 1 pixel 2021-12-15 11:50:28 -08:00
Dan Dennedy
00f8aa085a Merge branch 'andre-caldas-master' 2021-11-30 17:36:59 -08:00
Dan Dennedy
aa7ccf8e93 avoid destroying alpha channel in cairoaffineblend 2021-11-30 17:35:28 -08:00
André Caldas
657dd0cc84 Google translate comments. :-( 2021-11-26 22:26:58 -03:00
André Caldas
9e79ba028e Avoid destructing alpha channel. 2021-11-22 10:25:09 -03:00
Brian Matherly
a7b36436a0 Fill uninitialized gaps between grid images
If the imagegrid images do not perfectly fill the destination buffer,
the dst image ends up with artifacts due to uninitialized memory.

As reported here:
https://forum.shotcut.org/t/artifacts-with-a-grid-filter-when-video-mode-and-original-video-aspect-ratios-dont-match-up/30688
2021-11-14 17:02:25 -08:00
Dan Dennedy
700564265a add an invert parameter to bluescreen0r 2021-10-08 17:32:33 -07:00
Dan Dennedy
86475d3e11 Merge pull request #113 from mingwandroid/master
Support MSYS2/mingw-w64
2020-12-08 22:02:41 -08:00
Ray Donnelly
be4dcc6afa Support MSYS2/mingw-w64 2020-12-03 03:06:02 +01:00
Ray Donnelly
4e7e0f40d1 Fix out-of-source-tree CXX build failures
Lack of CXXFLAGS here. I would expect that CPPFLAGS would
have made it through but that seems not to be the case.

Anyway it seems like being able to specify global CXXFLAGS
in one place is useful and this achieves that too.
2020-12-03 03:06:02 +01:00
Dan Dennedy
3d3c4a6acb fix autoconf fails without opencv
Also fixes the OpenCV-based plugins actually building and installing when
OpenCV present.
2020-12-01 22:10:51 -08:00
Denis Roio
3a1f95e493 Merge pull request #112 from mingwandroid/master
Fix build for opencv4
2020-12-01 13:21:44 +01:00
Ray Donnelly
51e8342063 Fix autotools build for opencv4
The CMake build already works
2020-12-01 03:02:42 +01:00
d-j-a-y
a312322d83 Add FX aech0r . Aim to simulate an analog video echo. (#73)
* Add FX aech0r . Aim to simulate an analog video echo.

* Lighter or Darker mode
* Transform the echo to RGB world

TODO : Fix sse2 version - __SSE2__WIP
RGB plane fade is not ported in sse2 (m_rgb and m_flag_b tests)

files  :
          src/Makefile.am
          src/filter/CMakeLists.txt
+         src/filter/aech0r/aech0r.cpp
+         src/filter/aech0r/CMakeLists.txt

* Add FX aech0r (FIXED). Aim to simulate an analog video echo with some colors tweaks

* Bright or Dark mode
* Transform the echo to RGB world
* Strobe

* filter/aechor : Fix 'Fade Factor' description (range->)

* filter/aechor : Fix the default values

* spell fix

Co-authored-by: Poren Chiang <ren.chiang@gmail.com>

* typo fix

Co-authored-by: Poren Chiang <ren.chiang@gmail.com>

Co-authored-by: Poren Chiang <ren.chiang@gmail.com>
2020-09-16 11:11:59 -07:00
Dan Dennedy
69d3968a95 Merge pull request #104 from mypopydev/master
using the void keyword in function declaration
2020-09-15 12:21:18 -07:00
Brendan Hack
0a81c1702e Fix build warning in 64 bit Windows 2020-09-14 20:11:36 -07:00
Dan Dennedy
bf7d77dd6e fix #108 docker and travis-CI builds 2020-09-12 13:17:12 -07:00
Jun Zhao
844573f22a using the void keyword in function declaration
Using the void keyword in function declaration to fix the build
warning when enable frei0r in FFmpeg, the warning message like"
frei0r.h:230:1: warning: function declaration isn’t a prototype [-Wstrict-prototypes]
  230 | int f0r_init();
      | ^~~
CC	libavfilter/vf_gblur.o
frei0r.h:236:1: warning: function declaration isn’t a prototype [-Wstrict-prototypes]
  236 | void f0r_deinit();
      | ^~~~
"
Signed-off-by: Jun Zhao <barryjzhao@tencent.com>
2020-08-06 22:24:36 +08:00
IOhannes m zmölnig
9d3a813d19 spelling fixes
in English, you cannot really say that "foo allows to do bar".
the correct version is "foo allows someone to do bar" (in the
generic case, use 'one' for <someone>)
2020-05-25 09:00:41 -07:00
Dan Dennedy
c0c8eed79f Merge pull request #101 from kwizart/more_opencv4
Consolidated opencv4 support
2020-05-25 08:58:26 -07:00
Nicolas Chauvet
49dbdfa314 Clean executable on sources files 2020-05-25 10:41:44 +02:00
Nicolas Chauvet
796d122587 Switch to OpenCV4 enums
Signed-off-by: Nicolas Chauvet <kwizart@gmail.com>
2020-05-25 09:51:23 +02:00
Stefan Brüns
ce89da4892 Port facebl0r to OpenCV C++ API
TrackedObj has been converted to a class, and the update_hue_image and
camshift_track_face methods are now members of it, instead of passing
the object as a parameter.

Also, the various cv::Mat instances are kept, instead of destroying and
recreating these on various occasions.

The plugin now only accepts BGRA8888 as image format, as this is the
expected layout throughout the code (default openCV channel order).

The plugin has been tested using the following gstreamer pipeline:
gst-launch-1.0 v4l2src ! image/jpeg,width=640,rate=1/15 \
  ! jpegdec ! videoconvert \
  ! frei0r-filter-facebl0r ellipse=1 \
    classifier=/usr/share/OpenCV/haarcascades/haarcascade_frontalface_default.xml \
  ! videoconvert ! autovideosink
2020-05-25 09:48:08 +02:00
Raphael Graf
35c6497781 facedetect: Support opencv4 2020-05-25 09:47:55 +02:00
Dan Dennedy
b8d4e0595c fix c0rners filter top and left edge artifacts at default full size 2020-04-11 11:54:37 -07:00
275 changed files with 11075 additions and 3186 deletions

232
.github/workflows/release.yml vendored Normal file
View 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
View 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
View File

@@ -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
View 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"
]
}

View File

@@ -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
View 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' ../
```

View File

@@ -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.

View File

@@ -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

View File

@@ -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 . .

View File

@@ -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
```

View File

@@ -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

0
NEWS
View File

152
README.md
View File

@@ -1,134 +1,93 @@
```
___________ ._________
\_ _____/______ ____ |__\ _ \_______
| __) \_ __ \_/ __ \| / /_\ \_ __ \
| \ | | \/\ ___/| \ \_/ \ | \/
\___ / |__| \___ >__|\_____ /__|
\/ \/ \/
[![Frei0r logo](https://github.com/dyne/frei0r/raw/gh_pages/pics/frei0r.png)](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*
[![frei0r](https://github.com/dyne/frei0r/actions/workflows/test.yml/badge.svg)](https://github.com/dyne/frei0r/actions/workflows/test.yml)
[![frei0r](https://github.com/dyne/frei0r/actions/workflows/release.yml/badge.svg)](https://github.com/dyne/frei0r/actions/workflows/release.yml)
Updated info on https://frei0r.dyne.org
[![software by Dyne.org](https://files.dyne.org/software_by_dyne.png)](http://www.dyne.org)
[![Build Status](https://travis-ci.org/dyne/frei0r.svg?branch=master)](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
View File

@@ -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

View File

@@ -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

View File

@@ -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})

View File

@@ -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)

View File

@@ -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

View File

@@ -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)

View File

@@ -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

View File

@@ -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)/

View File

@@ -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

View File

@@ -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.

View File

@@ -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)
{

View File

@@ -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;

View File

@@ -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)
{

View File

@@ -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>

View File

@@ -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_ ]

View File

@@ -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_ ]

View File

@@ -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)

View File

@@ -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

View File

@@ -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)

View File

@@ -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)

View File

@@ -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})

View 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})

View 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);

View File

@@ -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})

View 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

View 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;
}
}

View File

@@ -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;
}
}
//**********************************************************

View File

@@ -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)

View File

@@ -28,7 +28,7 @@
#include <stdio.h>
#include "frei0r.h"
#include "frei0r_math.h"
#include "frei0r/math.h"
static const float bbWB[][3] =
{

View File

@@ -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)

View File

@@ -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);

View File

@@ -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
View 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

View File

@@ -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.

View File

@@ -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

View File

@@ -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)

View File

@@ -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)
{

View File

@@ -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)

View File

@@ -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)

View File

@@ -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

View File

@@ -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];

View File

@@ -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

View File

@@ -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)

View File

@@ -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);

View File

@@ -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)

View File

@@ -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);

View File

@@ -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)

View File

@@ -24,7 +24,7 @@
#include <stdio.h>
#include "frei0r.h"
#include "frei0r_math.h"
#include "frei0r/math.h"
#define MAXNUM 40

View File

@@ -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 "")

View File

@@ -88,7 +88,7 @@
#endif
#include "frei0r.h"
#include "frei0r_math.h"
#include "frei0r/math.h"
enum ParamIndex {
NEUTRAL_COLOR,

View File

@@ -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
View File

View 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)

View File

@@ -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)
{

View File

@@ -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)

View File

@@ -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

View File

@@ -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)

View File

@@ -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)

View File

@@ -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)

View File

@@ -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);
}

View File

@@ -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)

View File

@@ -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)
{

View File

@@ -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})

View File

@@ -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;

View File

@@ -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.

View File

@@ -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 "")

View File

@@ -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

View File

@@ -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;
}
}

View File

@@ -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;
}

View File

@@ -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);

View File

@@ -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 "")

View 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);

View File

@@ -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)

View File

@@ -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)

View File

@@ -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);
}

View File

@@ -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);

View File

@@ -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/>

View File

@@ -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);

View File

@@ -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)

View File

@@ -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;

View File

@@ -18,7 +18,7 @@
*/
#include "frei0r.hpp"
#include "frei0r_math.h"
#include "frei0r/math.h"
#include <string.h>
#include <cstring>

View File

@@ -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);
}

View File

@@ -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);

View 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