Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
mandelbrot-explorer
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Ильин Владимир Александрович
mandelbrot-explorer
Commits
6cc918c0
Commit
6cc918c0
authored
Jun 26, 2025
by
Ильин Владимир Александрович
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
headless mode that doest write to file with -p flag added
parent
1d1221c9
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
42 additions
and
13 deletions
+42
-13
mandelbrot.c
src/mandelbrot.c
+42
-13
No files found.
src/mandelbrot.c
View file @
6cc918c0
...
...
@@ -41,7 +41,7 @@ int mandelbrot_avx(Complex c, unsigned max_iterations) {
__m256d
threshold
=
_mm256_set1_pd
(
4
.
0
);
__m256d
one
=
_mm256_set1_pd
(
1
.
0
);
int
k
=
1
;
unsigned
int
k
=
1
;
__m256d
mk
=
_mm256_set1_pd
(
k
);
while
(
k
<
max_iterations
)
{
...
...
@@ -109,8 +109,8 @@ calculate_color(unsigned int iterations, unsigned int max_iterations)
double
t
=
(
double
)
iterations
/
max_iterations
;
t
=
0
.
5
+
0
.
5
*
tan
(
log
(
t
+
0
.
0001
)
*
3
.
0
);
cl
.
r
=
255
*
t
*
0
.
5
;
cl
.
g
=
255
*
t
*
0
.
4
;
cl
.
b
=
255
*
t
*
0
.
3
;
cl
.
g
=
255
*
t
*
0
.
3
;
cl
.
b
=
255
*
t
*
0
.
5
;
cl
.
a
=
255
;
}
return
cl
;
...
...
@@ -177,7 +177,8 @@ struct arguments
unsigned
int
max_iterations
;
short
unsigned
use_avx
;
short
unsigned
use_omp
;
int
recalc
;
short
unsigned
dry_run
;
short
unsigned
recalc
;
double
x_min
;
double
x_max
;
...
...
@@ -190,13 +191,14 @@ struct arguments
static
struct
argp_option
options
[]
=
{
{
"output
file
"
,
'o'
,
"FILE"
,
0
,
"Render to image, default False"
,
0
},
{
"output"
,
'o'
,
"FILE"
,
0
,
"Render to image, default False"
,
0
},
{
"width"
,
'w'
,
"WIDTH"
,
0
,
"Width of window/image, default 640"
,
0
},
{
"height"
,
'h'
,
"HEIGHT"
,
0
,
"Height of window/image, default 480"
,
0
},
{
"iterations"
,
'i'
,
"ITERATIONS"
,
0
,
"Max iterations, default 250."
,
0
},
{
"
dont_use
_avx"
,
'x'
,
0
,
0
,
"NOT use avx for calculations, default False"
,
0
},
{
"
dont_use
_omp"
,
't'
,
0
,
0
,
"NOT use openmpfor calculations, default False"
,
0
},
{
"
no
_avx"
,
'x'
,
0
,
0
,
"NOT use avx for calculations, default False"
,
0
},
{
"
no
_omp"
,
't'
,
0
,
0
,
"NOT use openmpfor calculations, default False"
,
0
},
{
"recalc"
,
'r'
,
0
,
0
,
"Recalculate set on every frame, default False"
,
0
},
{
"dry"
,
'p'
,
0
,
0
,
"Dry run, headless mode without writing to file and sdl nonsense, default False."
,
0
},
{
"x_min"
,
'a'
,
"VALUE"
,
0
,
"X min"
,
0
},
{
"x_max"
,
'b'
,
"VALUE"
,
0
,
"X max"
,
0
},
...
...
@@ -213,6 +215,9 @@ parse_opt (int key, char *arg, struct argp_state *state)
struct
arguments
*
arguments
=
state
->
input
;
switch
(
key
)
{
case
'p'
:
arguments
->
dry_run
=
1
;
break
;
case
'i'
:
arguments
->
max_iterations
=
atoi
(
arg
);
break
;
...
...
@@ -287,6 +292,22 @@ render_cl(Array *arr, SDL_Texture *texture, SDL_Renderer *renderer, int width, i
SDL_RenderCopy
(
renderer
,
texture
,
NULL
,
NULL
);
}
short
unsigned
dry_headless
(
ViewInfo
*
view
,
int
width
,
int
height
,
unsigned
int
max_iterations
,
short
unsigned
use_avx
,
short
unsigned
use_omp
)
{
Array
arr
=
{
malloc
(
width
*
height
*
sizeof
(
Color
)),
width
*
height
*
sizeof
(
Color
)
};
calculate_set
(
&
arr
,
height
,
width
,
*
view
,
use_avx
,
use_omp
,
max_iterations
);
free
(
arr
.
pointer
);
return
0
;
}
short
unsigned
render_headless
(
ViewInfo
view
,
const
char
*
filename
,
int
width
,
int
height
,
unsigned
int
max_iterations
,
...
...
@@ -330,14 +351,11 @@ main(int argc, char **argv)
NULL
,
640
,
480
,
250
,
1
,
1
,
0
,
-
2
.
0
,
1
.
0
,
-
1
.
5
,
1
.
5
,
1
.
0
,
0
,
0
,
-
2
.
0
,
1
.
0
,
-
1
.
5
,
1
.
5
,
1
.
0
};
argp_parse
(
&
argp
,
argc
,
argv
,
0
,
0
,
&
args
);
if
(
SDL_Init
(
SDL_INIT_EVERYTHING
)
!=
0
){
printf
(
"error initializing SDL: %s
\n
"
,
SDL_GetError
());
return
1
;
}
ViewInfo
view
=
{
.
x_min
=
args
.
x_min
*
args
.
zoom
,
...
...
@@ -347,6 +365,17 @@ main(int argc, char **argv)
.
zoom
=
args
.
zoom
};
if
(
args
.
dry_run
){
dry_headless
(
&
view
,
args
.
width
,
args
.
height
,
args
.
max_iterations
,
args
.
use_avx
,
args
.
use_omp
);
return
0
;
}
if
(
SDL_Init
(
SDL_INIT_EVERYTHING
)
!=
0
){
printf
(
"error initializing SDL: %s
\n
"
,
SDL_GetError
());
return
1
;
}
if
(
args
.
output_file
)
{
render_headless
(
view
,
args
.
output_file
,
args
.
width
,
args
.
height
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment