Compare commits
No commits in common. 'd477d24d39c538bef36762d22ed2bd1978071370' and '1b875f6d70461afe0526ee90ba19211bd856b254' have entirely different histories.
d477d24d39
...
1b875f6d70
@ -0,0 +1,38 @@
|
||||
BASE=awsm
|
||||
SFCC=silverfish
|
||||
CC=clang
|
||||
WASMCC=wasm32-unknown-unknown-wasm-clang
|
||||
|
||||
OPTFLAGS=-O3 -flto
|
||||
# same stack-size for all
|
||||
WASMLINKFLAGS=-Wl,-z,stack-size=524288,--allow-undefined,--no-threads,--stack-first,--no-entry,--export-all,--export=main,--export=dummy
|
||||
WASMCFLAGS=${WASMLINKFLAGS} -nostartfiles
|
||||
|
||||
MEMC_64=64bit_nix.c
|
||||
MEMC_NO=no_protection.c
|
||||
MEMC_GEN=generic.c
|
||||
MEMC_MPX=mpx.c
|
||||
MEMC_SEG=segmented.c
|
||||
|
||||
# for silverfish
|
||||
RT_DIR=${BASE_DIR}/runtime/
|
||||
RT_MEM=${RT_DIR}/memory/
|
||||
RT_LIBC=${RT_DIR}/libc/libc_backing.c
|
||||
RT_RT=${RT_DIR}/runtime.c
|
||||
|
||||
MEMC=${RT_MEM}/${MEMC_64}
|
||||
DUMMY=${BASE_DIR}/code_benches/dummy.c
|
||||
|
||||
# for awsm
|
||||
ABASE_DIR=${BASE_DIR}/../
|
||||
ART_DIR=${ABASE_DIR}/runtime/
|
||||
ART_INC=${ART_DIR}/include/
|
||||
|
||||
USE_MEM=USE_MEM_VM
|
||||
ifeq ($(USE_MEM),USE_MEM_VM)
|
||||
AMEMC=${ART_DIR}/compiletime/memory/${MEMC_64}
|
||||
endif
|
||||
WASMISA=${ART_DIR}/compiletime/instr.c
|
||||
|
||||
ABIN_DIR=${ART_DIR}/bin/
|
||||
TMP_DIR=tmp/
|
@ -1,47 +0,0 @@
|
||||
#include <stdio.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/types.h>
|
||||
#include <fcntl.h>
|
||||
#include <unistd.h>
|
||||
#include <stdlib.h>
|
||||
#include "sod.h"
|
||||
|
||||
#define MAX_IMG_SZ 1024*1024
|
||||
|
||||
int main()
|
||||
{
|
||||
unsigned char *zInpbuf = NULL;
|
||||
|
||||
zInpbuf = malloc(MAX_IMG_SZ);
|
||||
if (!zInpbuf)
|
||||
{
|
||||
perror("malloc");
|
||||
return -1;
|
||||
}
|
||||
|
||||
ssize_t imgSz = read(0, zInpbuf, MAX_IMG_SZ);
|
||||
if (imgSz <= 0)
|
||||
{
|
||||
perror("read");
|
||||
free(zInpbuf);
|
||||
return -1;
|
||||
}
|
||||
|
||||
sod_img imgIn = sod_img_load_from_mem(zInpbuf, imgSz, SOD_IMG_COLOR /* full color channels */);
|
||||
if (imgIn.data == 0) {
|
||||
/* Invalid path, unsupported format, memory failure, etc. */
|
||||
//puts("Cannot load input image..exiting");
|
||||
printf("Error loading input\n");
|
||||
free(zInpbuf);
|
||||
return -1;
|
||||
}
|
||||
|
||||
for (int i = 0; i < imgIn.w * imgIn.h * imgIn.c; i++)
|
||||
{
|
||||
imgIn.data[i] = 255.0f - imgIn.data[i];
|
||||
}
|
||||
sod_img_save_as_png(imgIn, NULL);
|
||||
sod_free_image(imgIn);
|
||||
free(zInpbuf);
|
||||
return 0;
|
||||
}
|
Loading…
Reference in new issue