codegen: avoid defining test image in multiple places

pull/7/merge
András Veres-Szentkirályi 2016-04-20 14:04:57 +02:00
rodzic c7fecff3e6
commit 5d38b3b52d
2 zmienionych plików z 5 dodań i 4 usunięć

Wyświetl plik

@ -113,6 +113,7 @@ def test():
from datetime import datetime
import struct
exe = './codegen-test-executable'
img_file = '320x256rgb.png'
if not path.exists('stb_image.h'):
from urllib import urlretrieve
urlretrieve('https://raw.githubusercontent.com/nothings/stb/master/stb_image.h', 'stb_image.h')
@ -127,10 +128,10 @@ def test():
gen_elapsed = datetime.now() - start
print ' - gengcc took', gen_elapsed
start = datetime.now()
gen = check_output([exe])
gen = check_output([exe, img_file])
native_elapsed = datetime.now() - start
print ' - native took', native_elapsed
img = Image.open("320x256rgb.png")
img = Image.open(img_file)
sstv = sstv_class(img, 44100, 16)
start = datetime.now()
try:

Wyświetl plik

@ -5,9 +5,9 @@
#include "stb_image.h"
#include "codegen.c"
int main() {
int main(int argc, char **argv) {
int x, y, n;
unsigned char *img = stbi_load("320x256rgb.png", &x, &y, &n, 0);
unsigned char *img = stbi_load(argv[1], &x, &y, &n, 0);
float freqs[FREQ_COUNT], msecs[FREQ_COUNT];