Subversion Repositories filter_foundry

Rev

Rev 158 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 158 Rev 192
Line 1... Line 1...
1
 
1
 
2
Implementation detail differences			Daniel Marschall
2
Implementation detail differences			Daniel Marschall
3
=================================			08 January 2018
3
=================================			08 January 2018
4
 
4
 
5
FilterFoundry tries to be as compatible with Filter Factory as possible.
5
FilterFoundry tries to be as compatible with Filter Factory as possible.
6
However, results are usually not 100% equal, because functions like
6
However, results are usually not 100% equal because functions like
7
cos, sin, sqr, etc. have different accuracy due to the underlying
7
cos, sin, sqr, etc., have different accuracy due to the underlying
8
implementation.
8
implementation.
9
 
9
 
10
Furthermore, there are following known differences between Filter Foundry
10
Furthermore, there are the following known differences between
11
and Filter Factory:
11
Filter Foundry and Filter Factory:
12
 
12
 
13
i, u, v (Testcase iuv.afs)
13
i, u, v (Testcase iuv.afs)
14
-------
14
-------
15
 
15
 
16
Filter Foundry <1.7 uses the same formulas as in Filter Factory:
16
Filter Foundry <1.7 uses the same formulas as in Filter Factory:
Line 23... Line 23...
23
 
23
 
24
	i=(299*r+587*g+114*b)/1000               Output range is 0..255
24
	i=(299*r+587*g+114*b)/1000               Output range is 0..255
25
	u=(-147407*r-289391*g+436798*b)/2000000  Output range is -55..55
25
	u=(-147407*r-289391*g+436798*b)/2000000  Output range is -55..55
26
	v=614777*r-514799*g-99978*b)/2000000     Output range is -78..78
26
	v=614777*r-514799*g-99978*b)/2000000     Output range is -78..78
27
 
27
 
28
Both formulas follow the same YUV standard, but have different accuracy.
28
Both formulas follow the same YUV standard but have different accuracy.
29
 
29
 
30
 
30
 
31
get(i) (Testcase getput.afs)
31
get(i) (Testcase getput.afs)
32
------
32
------
33
 
33
 
Line 48... Line 48...
48
 
48
 
49
 
49
 
50
rnd(a,b) and rst(i) (Testcases rst_*.afs)
50
rnd(a,b) and rst(i) (Testcases rst_*.afs)
51
-------------------
51
-------------------
52
 
52
 
53
Filter Foundry's implementation of rst(i) (undocumented function that sets the seed for the PRG)
53
Filter Foundry's implementation of rst(i) (an undocumented function that sets the seed for the PRG)
54
and rnd(a,b) (generate random number between a and b, inclusively)
54
and rnd(a,b) (generate a random number between a and b, inclusively)
55
differs from the implementation of Filter Factory in many ways.
55
differs from the implementation of Filter Factory in many ways.
56
 
56
 
57
1. In Filter Foundry, the random seed is automatically initialized with seed 691204.
57
1. In Filter Foundry, the random seed is automatically initialized with seed 691204.
58
   In Filter Factory, the random seed is automatically initialized with seed 0.   
58
   In Filter Factory, the random seed is automatically initialized with seed 0.   
59
 
59
 
Line 63... Line 63...
63
 
63
 
64
   In Filter Factory, the argument i must be between 0 and 32767, inclusively.
64
   In Filter Factory, the argument i must be between 0 and 32767, inclusively.
65
   If the argument is not within this range, the operation "and 0x7FFF" will be applied to it
65
   If the argument is not within this range, the operation "and 0x7FFF" will be applied to it
66
   to extract the low 15 bits.
66
   to extract the low 15 bits.
67
 
67
 
68
3. In Filter Foundry, the function rnd(a,b) retrieves a random number at realtime; therefore, if the
68
3. In Filter Foundry, the function rnd(a,b) retrieves a random number in realtime; therefore, if the
69
   seed is changed via rst(i), there is an immediate effect on the next call of the rnd(a,b) function.
69
   seed is changed via rst(i), there is an immediate effect on the next call of the rnd(a,b) function.
70
   For example, following filter would generate an one-colored picture without any randomness:
70
   For example, following filter would generate an one-colored picture without any randomness:
71
	R: rst(123), rnd(0,255)
71
	R: rst(123), rnd(0,255)
72
	G: rnd(0,255)
72
	G: rnd(0,255)
73
	B: rnd(0,255)
73
	B: rnd(0,255)