mirror of
https://github.com/dnet/pySSTV.git
synced 2025-12-06 07:12:00 +01:00
codegen: avoid defining test image in multiple places
This commit is contained in:
parent
c7fecff3e6
commit
5d38b3b52d
|
|
@ -113,6 +113,7 @@ def test():
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
import struct
|
import struct
|
||||||
exe = './codegen-test-executable'
|
exe = './codegen-test-executable'
|
||||||
|
img_file = '320x256rgb.png'
|
||||||
if not path.exists('stb_image.h'):
|
if not path.exists('stb_image.h'):
|
||||||
from urllib import urlretrieve
|
from urllib import urlretrieve
|
||||||
urlretrieve('https://raw.githubusercontent.com/nothings/stb/master/stb_image.h', 'stb_image.h')
|
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
|
gen_elapsed = datetime.now() - start
|
||||||
print ' - gengcc took', gen_elapsed
|
print ' - gengcc took', gen_elapsed
|
||||||
start = datetime.now()
|
start = datetime.now()
|
||||||
gen = check_output([exe])
|
gen = check_output([exe, img_file])
|
||||||
native_elapsed = datetime.now() - start
|
native_elapsed = datetime.now() - start
|
||||||
print ' - native took', native_elapsed
|
print ' - native took', native_elapsed
|
||||||
img = Image.open("320x256rgb.png")
|
img = Image.open(img_file)
|
||||||
sstv = sstv_class(img, 44100, 16)
|
sstv = sstv_class(img, 44100, 16)
|
||||||
start = datetime.now()
|
start = datetime.now()
|
||||||
try:
|
try:
|
||||||
|
|
|
||||||
|
|
@ -5,9 +5,9 @@
|
||||||
#include "stb_image.h"
|
#include "stb_image.h"
|
||||||
#include "codegen.c"
|
#include "codegen.c"
|
||||||
|
|
||||||
int main() {
|
int main(int argc, char **argv) {
|
||||||
int x, y, n;
|
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];
|
float freqs[FREQ_COUNT], msecs[FREQ_COUNT];
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue