Skip to content

Commit

Permalink
optimize openjpeg test
Browse files Browse the repository at this point in the history
  • Loading branch information
azakai committed Mar 5, 2011
1 parent 1de9903 commit 7d2f754
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 13 deletions.
2 changes: 2 additions & 0 deletions tests/openjpeg/syntensity_lobby_s.raw
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
&:��l:{�>Mw9-)Hg?R,(1EJEb���GA>VJE@��?(-/.m��*m�Y?�U#"DmB9/&5ukFu�|[KEMZV:d��',,-04][9@SA/I8)%9bHR*%6iVHf|xeV\^^�>��S%$#&-)��EÿK��'.CbIQ)(.Cq��ڣ����yxu��("(,!%���M��{��86?A>@ 4f����������Nq�k,-!$0:ȿQx�q_y1@y97/!+G�㵄������J��:%$.0@.2+'% " *<j6)" #-D{�x��j���e:�s*$-/3=+=RdtuoeQ@=65\:($$)0>�{~z{^_X^D$%'(()**_u���������d_U?3! !$&)��S8$(/D2+(!#&(((Z[Xdv������ZH?A=31+,+0��U>"%7?/-*'&'&""KEGLS\dmwuy|]JHF8<3/*1R���{K:4/&*,*()&$$GJRX^jnv���KsZJ94  ,-Q���Ί=$$%&()'"%*T\egqwz�����u��J.AN^j^=8T����="$%%#""&.empv��������ɩ�~���fGXaJ;-Lɓ5  "&��������������⾏�ct[\R<984@G%## ��������������ʹ�q@E>6/*47K<)"+## ����������̿������])$29.!#92#$- $$ �����ʿ��Ŀ�������s�0 4=,*+.! '$" �����������������nJc9,*8.$,#$&3,+& �����������������wU+3X8&.<0)!0'%10*"��������������vzsk^%I[%'+#)aG.#&'$ ������������uvphusy3/P@??%8@+DF6+&%#����������xutjry~}h7#8+#.59920(*%�������}tv~vrw{~lmiMIFIDE+)3B926/+###����uxrqyw{vlhciklmkcZXC*(=?1)0'#"��uiqvnqv|{{ukhdehkmme_[_OD7+/,+#!%rgjnlnnxt|�tnnmvplqria_a_MIC:&%'e�("oqoklutu|yxswtyxtgmpf_gb[UJLD3A2Csqsqmqku|qu�yvlpcptkggcPXTPQN�= uvujd`bs}q}�xumfljmoedgY]YSMPTxO4%'B��A��G]�C--SzFb1,7MSOg�ŽOC<TG?E��E.1./���.��hI�e%%O}L@3):�vIw�}WD=K\[6tȘ*0.,.8ki@H`L5WC+'BqR[/'6hR>\wwh[a^^�9��['&%&-+��K��S��+2QpP\..)5Kq�ɧ���mqi��*$)-#%���O����:@HHDE%$'Jr��~������Gs�l,,"%0:��T|�wb}3BzA;4 #)]�wq�h����F��9($-/B!-1,)'"!%#!,@m;/%!$#%GoP{G=v�v\7�t+%,.2?-=RduvqgUJL??e@,'$)$#eHD<=020B:$'(**+,+c{�������ͮxpcF:'""% �{31-+(!$'))(cdbn�������cPGHF7725'��!.'-*'&&&""RLMU[dks|xxoDEFC5:52%"$?FJ2'$*,*()&$$LOTY]egksoqv&WG=., ESWW=%$%&()'#%*SV]]ehjq����Ypr;+4=HPH-'%4d�]-!$%%$"#'.[`bep~��������s^dqmS:EJ4&"(gO2 !!"" &vyx����������¯�sqOZIF=.((+/2"!#%! ����������������}Y694.(#*+2))$3(& ����������������ugE%(-3-&$-)%*/%' !�������������~}{shU[+$06) "-00!&!$!  �����������}twpicS3=*..6+%*',#&!%$ "������{����uspjg]9 1.6=0.&(! +*% �����{��}�yok^`[TH0<$1+'*F2'"$$" %#������zswzq^_ZU_\b&#@3-7#/3#8;-&$%%#%'�����~qqkob]^V]cggT'-)%-0/)+')&"#$$}��}{xkf^aha^cehYZV@=;>:<)$+84.0-+%%%$$#{y{iac^]dicfbZWSXZ[[ZSKL;-*88.,1* !"$$&�xbW_c[^bgghcZXUTWZ\[VQLQC>9./,-("#!""#(`VY][\\fbilc\][c_[aaZSQSRB@@8(*(!OW#B2"_`]Z[dbcifecechecX^`YRZTOJAC;.9"%#)+!2)"baba\_[dh`domhf\aV`d\YYUGMIGHB`6&%! "efd[UQTak`lugd]V]\``YWZNSPJDGKYA!%!'?1$ $I���G��Qu�P*/Y�Mv2.;OTTe���SC7XH?P��H15+.�ѽ/��~W�{%%V�QF5)=��Jv��XA;J`c6���+30*,9pqBMnU:hN,%HwVc/'7rU9Vmne`e^`�7��_'%$$)&��H��Q��(/QqP]0.+,8d�������_dL��(#&)!"���I��x��5:=A?<%##;1xvr������Be�Y)(",5ȿOs�pWp.;j>7-!#"2elrE����C��1'"*+9*-'%$ %#!,0B53&"$%",=T%ks]Q5tc($)*/:)9L_oqldSII=4,-'$(3$#/6$$&)()**ay���������aVJ*()!"$ xE
&,,(!#&()(fhdm~������PDAAA;=;>-D; #-+'&'&""TOPUYaejpjjb9EGF8;73#""*,*()&$$NPSWX^^af_^e >40)(#%&(*'#%)NPUTYZY^ioq{HUE,%''/67&8<) $%%"!$&+QTTW^ijw����|iTDCOTB266$0'2!" !!#hifnuux�������qaZ@B:," &%)"""%!�xu{~{�������wlaI/),' $%%)$4)&!����������{rtwshYN+'(-)$$%"*.5'( !������zttxtrj_^^YN<,&&,3#!".26&%#"(����vpmoppjb^XZVPL?+'.,5*&+)0"!!"!&5����xgboohfbXWTQQI/&-8<1/'!$% "%(-��}thfbgfch]WSHJFC;#!4+*("#% !"#)-)porskeaY]_ZJKGAJJP 3)"$,1$$%&(+783owtmhfZ[TXNJMEJPQSE# )')&!%(-+1589gljedaUSLNTMLPRTHIG621405+!$/.(,0/*+-068iedeVNQKLQVRTQJGCHJKMKE>?85-41-150.+)*-5lcQGNQJNQUUWRJIFDGJLMHD?F9;?1/03/,330+*.PGJLLNMUQVZQLMLSOLPRLGFHF87=<+3.'.UX3=3)OPNKLSRSXUTSVRWUTINPKENJE@894)))2.14095-SQRQLPLTXQT^\XVMQGPTOMNL?EA>@3$52-+,133VUULGEHS[Q[cWUOIOMPRLMOEJG@;>@$#(2.2H>63
Expand Down
29 changes: 16 additions & 13 deletions tests/runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -1645,7 +1645,13 @@ def test_zlib(self):

def test_openjpeg(self):
global SAFE_HEAP; SAFE_HEAP = 0 # Very slow
global CORRECT_SIGNS; CORRECT_SIGNS = 1 # Needed for some comparisons, at least in gcc
global COMPILER_TEST_OPTS; COMPILER_TEST_OPTS = ['-g']
global CORRECT_SIGNS; CORRECT_SIGNS = 2
global CORRECT_SIGNS_LINES
if COMPILER == CLANG:
CORRECT_SIGNS_LINES = ["mqc.c:566"]
else:
CORRECT_SIGNS_LINES = ["mqc.c:566", "mqc.c:317"]

original_j2k = path_from_root('tests', 'openjpeg', 'syntensity_lobby_s.j2k')

Expand Down Expand Up @@ -1685,28 +1691,25 @@ def image_compare(output):

js_data = map(lambda x: x if x >= 0 else 256+x, js_data) # Our output may be signed, so unsign it

# Generate the native code output using lli
lli_file = os.path.join(self.get_dir(), 'lli.raw')
stdout = self.run_llvm_interpreter([os.path.join(self.get_dir(), 'src.c.o'), '-i', original_j2k, '-o', lli_file])
assert 'Successfully generated' in stdout, 'Error in lli run: ' + stdout
lli_data = open(lli_file, 'rb').read()
# Get the correct output
true_data = open(path_from_root('tests', 'openjpeg', 'syntensity_lobby_s.raw'), 'rb').read()

# Compare them
assert(len(js_data) == len(lli_data))
assert(len(js_data) == len(true_data))
num = len(js_data)
diff_total = js_total = lli_total = 0
diff_total = js_total = true_total = 0
for i in range(num):
js_total += js_data[i]
lli_total += ord(lli_data[i])
diff_total += abs(js_data[i] - ord(lli_data[i]))
true_total += ord(true_data[i])
diff_total += abs(js_data[i] - ord(true_data[i]))
js_mean = js_total/float(num)
lli_mean = lli_total/float(num)
true_mean = true_total/float(num)
diff_mean = diff_total/float(num)

image_mean = 83
#print '[image stats:', js_mean, image_mean, lli_mean, diff_mean, num, ']'
#print '[image stats:', js_mean, image_mean, true_mean, diff_mean, num, ']'
assert abs(js_mean - image_mean) < 2
assert abs(lli_mean - image_mean) < 2
assert abs(true_mean - image_mean) < 2
assert diff_mean < 2 # XXX All of these are not quite right...

return output
Expand Down

0 comments on commit 7d2f754

Please sign in to comment.