Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
orga2-puma-concolor
tp2
Commits
24032548
Commit
24032548
authored
5 years ago
by
Ignacio Losiggio
Browse files
Options
Download
Email Patches
Plain Diff
cuadrados: Agregada implementación en AVX2
parent
875e659a
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
83 additions
and
3 deletions
+83
-3
src/Makefile
src/Makefile
+1
-1
src/filters/Cuadrados.c
src/filters/Cuadrados.c
+7
-1
src/filters/Cuadrados_avx.asm
src/filters/Cuadrados_avx.asm
+65
-0
src/filters/Makefile
src/filters/Makefile
+1
-1
src/tests/2_test_diff_cat_asm.py
src/tests/2_test_diff_cat_asm.py
+4
-0
src/tests/3_correr_test_mem.sh
src/tests/3_correr_test_mem.sh
+5
-0
No files found.
src/Makefile
View file @
24032548
...
...
@@ -11,7 +11,7 @@ FILTROS = Cuadrados Manchas Offset Ruido Sharpen
FILTROS_OBJ
=
$(
addsuffix
.o,
$(FILTROS)
)
$(
addsuffix
_asm.o,
$(FILTROS)
)
\
$(
addsuffix
_c.o,
$(FILTROS)
)
Manchas_mvec.o Manchas_simple.o
\
Offset_avx.o
Offset_avx.o
Cuadrados_avx.o
LIBS_OBJS
=
libbmp.o imagenes.o utils.o
MAIN_OBJS
=
tp2.o cli.o
MAIN_OBJS_CON_PATH
=
$(
addprefix
$(BUILD_DIR)
/,
$(MAIN_OBJS)
)
...
...
This diff is collapsed.
Click to expand it.
src/filters/Cuadrados.c
View file @
24032548
...
...
@@ -10,8 +10,14 @@ void Cuadrados_asm (uint8_t *src, uint8_t *dst, int width, int height,
void
Cuadrados_c
(
uint8_t
*
src
,
uint8_t
*
dst
,
int
width
,
int
height
,
int
src_row_size
,
int
dst_row_size
);
void
Cuadrados_avx
(
uint8_t
*
src
,
uint8_t
*
dst
,
int
width
,
int
height
,
int
src_row_size
,
int
dst_row_size
);
typedef
void
(
Cuadrados_fn_t
)
(
uint8_t
*
,
uint8_t
*
,
int
,
int
,
int
,
int
);
static
Cuadrados_fn_t
*
implementaciones
[]
=
{
Cuadrados_c
,
Cuadrados_asm
,
Cuadrados_avx
};
void
leer_params_Cuadrados
(
configuracion_t
*
config
,
int
argc
,
char
*
argv
[])
{
...
...
@@ -19,7 +25,7 @@ void leer_params_Cuadrados(configuracion_t *config, int argc, char *argv[]) {
void
aplicar_Cuadrados
(
configuracion_t
*
config
)
{
Cuadrados_fn_t
*
Cuadrados
=
SWITCH_C_ASM
(
config
,
Cuadrados_c
,
Cuadrados_asm
)
;
Cuadrados_fn_t
*
Cuadrados
=
implementaciones
[
config
->
tipo_filtro
]
;
buffer_info_t
info
=
config
->
src
;
Cuadrados
(
info
.
bytes
,
config
->
dst
.
bytes
,
info
.
width
,
info
.
height
,
info
.
row_size
,
config
->
dst
.
row_size
);
...
...
This diff is collapsed.
Click to expand it.
src/filters/Cuadrados_avx.asm
0 → 100644
View file @
24032548
section
.rodata
BLACK:
times
8
dd
0xFF000000
section
.text
global
Cuadrados_avx
Cuadrados_avx:
; rdi = uint8_t *src
; rsi = uint8_t *dst
; rdx = int width
; rcx = int height
; r8 = int src_row_size
; r9 = int dst_row_size
; Ajusto por los marcos
sub
rdx
,
8
shr
rdx
,
3
; rax = int height
lea
rax
,
[
rcx
-
8
]
vmovdqu
ymm7
,
[
BL
ACK
]
; r10 = r8 * 3
lea
r10
,
[
r8
+
r8
*
2
]
black_start:
lea
rcx
,
[
rdx
*
4
+
4
]
.x_loop:
vmovdqu
[
rsi
],
ymm7
lea
rsi
,
[
rsi
+
32
]
loop
.x_loop
lea
rdi
,
[
rdi
+
r8
*
4
]
y_loop:
movdqa
[
rsi
],
xmm7
lea
rdi
,
[
rdi
+
16
]
lea
rsi
,
[
rsi
+
16
]
mov
rcx
,
rdx
.x_loop:
vmovdqu
ymm0
,
[
rdi
]
vpmaxub
ymm0
,
ymm0
,
[
rdi
+
4
]
vpmaxub
ymm0
,
ymm0
,
[
rdi
+
8
]
vpmaxub
ymm0
,
ymm0
,
[
rdi
+
12
]
vpmaxub
ymm0
,
ymm0
,
[
rdi
+
r8
]
vpmaxub
ymm0
,
ymm0
,
[
rdi
+
r8
+
4
]
vpmaxub
ymm0
,
ymm0
,
[
rdi
+
r8
+
8
]
vpmaxub
ymm0
,
ymm0
,
[
rdi
+
r8
+
12
]
vpmaxub
ymm0
,
ymm0
,
[
rdi
+
r8
*
2
]
vpmaxub
ymm0
,
ymm0
,
[
rdi
+
r8
*
2
+
4
]
vpmaxub
ymm0
,
ymm0
,
[
rdi
+
r8
*
2
+
8
]
vpmaxub
ymm0
,
ymm0
,
[
rdi
+
r8
*
2
+
12
]
vpmaxub
ymm0
,
ymm0
,
[
rdi
+
r10
]
vpmaxub
ymm0
,
ymm0
,
[
rdi
+
r10
+
4
]
vpmaxub
ymm0
,
ymm0
,
[
rdi
+
r10
+
8
]
vpmaxub
ymm0
,
ymm0
,
[
rdi
+
r10
+
12
]
vmovdqu
[
rsi
],
ymm0
lea
rdi
,
[
rdi
+
32
]
lea
rsi
,
[
rsi
+
32
]
loop
.x_loop
movdqa
[
rsi
],
xmm7
lea
rdi
,
[
rdi
+
16
]
lea
rsi
,
[
rsi
+
16
]
dec
rax
jnz
y_loop
black_end:
lea
rcx
,
[
rdx
*
4
+
4
]
.x_loop:
vmovdqu
[
rsi
],
ymm7
lea
rsi
,
[
rsi
+
32
]
loop
.x_loop
ret
This diff is collapsed.
Click to expand it.
src/filters/Makefile
View file @
24032548
...
...
@@ -20,7 +20,7 @@ FILTROS = Cuadrados Manchas Offset Ruido Sharpen
FILTROS_OBJ
=
$(
addsuffix
.o,
$(FILTROS)
)
$(
addsuffix
_asm.o,
$(FILTROS)
)
\
$(
addsuffix
_c.o,
$(FILTROS)
)
Manchas_mvec.o Manchas_simple.o
\
Offset_avx.o
Offset_avx.o
Cuadrados_avx.o
FILTROS_OBJ_CON_PATH
=
$(
addprefix
$(BUILD_DIR)
/,
$(FILTROS_OBJ)
)
.PHONY
:
filtros clean
...
...
This diff is collapsed.
Click to expand it.
src/tests/2_test_diff_cat_asm.py
View file @
24032548
...
...
@@ -17,6 +17,10 @@ for imagen in archivos:
ok
=
verificar
(
'Offset'
,
''
,
5
,
'avx'
,
imagen
)
todos_ok
=
todos_ok
and
ok
for
imagen
in
archivos
:
ok
=
verificar
(
'Cuadrados'
,
''
,
5
,
'avx'
,
imagen
)
todos_ok
=
todos_ok
and
ok
for
imagen
in
archivos
:
ok
=
verificar
(
'Manchas'
,
'100'
,
5
,
'mvec'
,
imagen
)
todos_ok
=
todos_ok
and
ok
...
...
This diff is collapsed.
Click to expand it.
src/tests/3_correr_test_mem.sh
View file @
24032548
...
...
@@ -49,6 +49,11 @@ for s in ${SIZESMEM[*]}; do
if
[
$ret
-ne
0
]
;
then
exit
-1
;
fi
done
for
s
in
${
SIZESMEM
[*]
}
;
do
run_test
"
$TP2ALU
"
Cuadrados avx
"
$TESTINDIR
/
$img1
.
$s
.bmp"
""
if
[
$ret
-ne
0
]
;
then
exit
-1
;
fi
done
# Manchas
for
s
in
${
SIZESMEM
[*]
}
;
do
run_test
"
$TP2ALU
"
Manchas asm
"
$TESTINDIR
/
$img1
.
$s
.bmp"
"100"
...
...
This diff is collapsed.
Click to expand it.
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