Monday, December 31, 2012
Wednesday, December 26, 2012
Pseudo HDR effect using Pixilang
Here is my version of Pseudo HDR filter (tone mapping) for Pixilang. You can use it freely in any Pixilang applications.
/*
hdr_simulation.pixi
Copyright (c) 2012, Alexander Zolotov
http://www.warmplace.ru
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to
deal in the Software without restriction, including without limitation the
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
sell copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
IN THE SOFTWARE.
*/
scr = get_screen()
xsize = get_xsize( scr )
ysize = get_ysize( scr )
clear()
//$src - source image (container of PIXEL type)
//$filter_radius (in percent)
fn apply_hdr_effect( $src, $filter_radius, $intensity )
{
$src_xsize = get_xsize( $src )
$src_ysize = get_ysize( $src )
//Make grayscale copy:
$img2 = clone( $src )
$c = new( $src_xsize, $src_ysize, FLOAT32 )
split_rgb( 0, $src, -1, $c ) //Get red channel
split_rgb( 1, $img2, $c, $c, $c )
//Blur grayscale image:
$scr = get_screen()
set_screen( $img2 )
$size = ( $src_xsize * $filter_radius ) / 100
effector( EFF_HBLUR, $size )
effector( EFF_VBLUR, $size )
set_screen( $scr )
//Invert it:
op_cn( OP_XOR, $img2, WHITE )
//Do normalization:
split_rgb( 0, $img2, $c )
op_cc( OP_MUL, $c, $c ) //Add contrast
op_cc( OP_MUL, $c, $c ) //Add contrast
if $intensity != 1
{
op_cn( OP_MUL, $c, $intensity )
}
op_cn( OP_ADD, $c, 1 ) //Add base level
$r = clone( $c )
$g = clone( $c )
$b = clone( $c )
split_rgb( 0, $src, $r, $g, $b )
op_cc( OP_MUL, $r, $c )
op_cc( OP_MUL, $g, $c )
op_cc( OP_MUL, $b, $c )
split_rgb( 1, $src, $r, $g, $b )
remove( $r )
remove( $g )
remove( $b )
remove( $c )
remove( $img2 )
}
//Load image:
img = load( "images/dark.jpg" )
set_flags( img, CFLAG_INTERP )
img_xsize = get_xsize( img )
img_ysize = get_ysize( img )
s = 1
if img_xsize > xsize || img_ysize >= ysize
{
s1 = xsize / img_xsize
s2 = ysize / img_ysize
if s1 < s2 { s = s1 } else { s = s2 }
}
pixi( img, 0, 0, WHITE, s, s )
frame( 500 )
apply_hdr_effect( img, 3, 2 )
set_flags( img, CFLAG_INTERP )
save( img, "hdr.jpg", FORMAT_JPEG, 95 )
start_timer( 0 )
while 1
{
t = get_timer( 0 )
transp( t / 64 )
pixi( img, 0, 0, WHITE, s, s )
frame()
while get_event() { if EVT[ EVT_TYPE ] == EVT_QUIT { halt } }
}
The main function is apply_hdr_effect( $img, $radius, $intensity ) will apply Pseudo HDR effect to the selected image.
Parameters: $img - container with the image; $radius - blur-filter radius; $intensity - effect intensity.
Now let's see how it works.
Before:
After:
Before:
After:
Before:
After:
Before:
After:
You can always get the latest version of this program from the Pixilang distribution. Folder - examples/graphics. File - hdr_simulation.pixi
Tuesday, December 25, 2012
SunVox Dynamic Library v1.7.3
SunVox Dynamic Library for developers has been updated to v1.7.3.
You can use this library to play SunVox songs in your Windows/Linux/OSX/Android applications.
What is new:
You can use this library to play SunVox songs in your Windows/Linux/OSX/Android applications.
What is new:
- added Android version (but now only tested with Pixilang applications);
- new functions: sv_lock_slot(), sv_unlock_slot(), sv_pattern_mute();
- some bugs fixed.
Monday, December 24, 2012
Pixilang v3.4.3
Pixilang updated to version 3.4.3
What is new:
What is new:
- license changed from New BSD to MIT;
- Android: support of x86 and ARMv7-A;
- added Android native library (.so) support;
- new folder with examples - native_library;
- new data processing operations for op_cn(): OP_COLOR_SUB2, OP_DIV2; use them if you need N/C[i] instead of C[i]/N;
- new transformation functions: t_push_matrix() and t_pop_matrix(); use them to save and restore current transformation state;
- new graphics examples: labyrinth, clock, save_gif_anim2, hdr_simulation, tiny_generator1-5;
- bugs fixed.
Saturday, December 22, 2012
Saturday, December 15, 2012
Want to listen to songs made with SunVox?
Want to share your own songs?
It's all here: SunVox group on SoundCloud!
Want to share your own songs?
It's all here: SunVox group on SoundCloud!
Friday, December 14, 2012
Thursday, December 13, 2012
Wednesday, December 12, 2012
Saturday, December 8, 2012
SunVox song optimization for slow devices
The CPU of your device is too slow for some SunVox project? Here are some tips to avoid this.
- Use monophonic modes (Mono, HQmono or LQmono) for the modules. For example Analog Generator has a Mode (12) controller; set it to the HQmono (High Quality Mono) value. Another example - Mono (04) controller of the EQ module.
- Use low quality modes (LQ or LQmono) for the modules.
- Use reduced polyphony for generators.
- Don't use the Reverb, or use it in LQ (Low Quality) mode and with All-pass filter disabled.
- Use the Sampler without interpolation (Sample interpolation = OFF; Volume interpolation = OFF).
- Use the Generator without Attack and Release (Attack = 0; Release = 0; Sustain = ON).
Sunday, December 2, 2012
SunVox music. Best of November 2012
Want to listen to songs made with SunVox?
Want to share your own songs?
It's all here: SunVox group on SoundCloud!
Subscribe to:
Posts (Atom)