Merge pull request #6830 from akien-mga/thirdparty

Move most "drivers" as toggleable "modules" and split their thirdparty libraries in an own tree
This commit is contained in:
Rémi Verschelde 2016-10-16 11:52:09 +02:00 committed by GitHub
commit 89132224a6
2409 changed files with 11917 additions and 8352 deletions

View file

@ -119,23 +119,20 @@ opts.Add('platform','Platform: '+str(platform_list)+'.',"")
opts.Add('p','Platform (same as platform=).',"")
opts.Add('tools','Build Tools (Including Editor): (yes/no)','yes')
opts.Add('gdscript','Build GDSCript support: (yes/no)','yes')
opts.Add('vorbis','Build Ogg Vorbis Support: (yes/no)','yes')
opts.Add('opus','Build Opus Audio Format Support: (yes/no)','yes')
opts.Add('libogg','Ogg library for ogg container support (system/builtin)','builtin')
opts.Add('libvorbis','Ogg Vorbis library for vorbis support (system/builtin)','builtin')
opts.Add('libtheora','Theora library for theora module (system/builtin)','builtin')
opts.Add('opus','Opus and opusfile library for Opus format support: (system/builtin)','builtin')
opts.Add('minizip','Build Minizip Archive Support: (yes/no)','yes')
opts.Add('squish','Squish BC Texture Compression in editor (yes/no)','yes')
opts.Add('theora','Theora Video (yes/no)','yes')
opts.Add('theoralib','Theora Video (yes/no)','no')
opts.Add('freetype','Freetype support in editor','builtin')
opts.Add('squish','Squish library for BC Texture Compression in editor (system/builtin)','builtin')
opts.Add('freetype','Freetype library for TTF support via freetype module (system/builtin)','builtin')
opts.Add('xml','XML Save/Load support (yes/no)','yes')
opts.Add('png','PNG Image loader support (yes/no)','yes')
opts.Add('jpg','JPG Image loader support (yes/no)','yes')
opts.Add('webp','WEBP Image loader support (yes/no)','yes')
opts.Add('dds','DDS Texture loader support (yes/no)','yes')
opts.Add('pvr','PVR (PowerVR) Texture loader support (yes/no)','yes')
opts.Add('etc1','etc1 Texture compression support (yes/no)','yes')
opts.Add('builtin_zlib','Use built-in zlib (yes/no)','yes')
opts.Add('openssl','Use OpenSSL (yes/no/builtin)','no')
opts.Add('musepack','Musepack Audio (yes/no)','yes')
opts.Add('libpng','libpng library for image loader support (system/builtin)','builtin')
opts.Add('libwebp','libwebp library for webp module (system/builtin)','builtin')
opts.Add('openssl','OpenSSL library for openssl module (system/builtin)','builtin')
opts.Add('libmpcdec','libmpcdec library for mpc module (system/builtin)','builtin')
opts.Add('enet','ENet library (system/builtin)','builtin')
opts.Add('glew','GLEW library for the gl_context (system/builtin)','builtin')
opts.Add("CXX", "C++ Compiler")
opts.Add("CC", "C Compiler")
opts.Add("CCFLAGS", "Custom flags for the C++ compiler");
@ -157,7 +154,7 @@ for k in platform_opts.keys():
opts.Add(o[0],o[1],o[2])
for x in module_list:
opts.Add('module_'+x+'_enabled', "Enable module '"+x+"'.", "yes")
opts.Add('module_'+x+'_enabled', "Enable module '"+x+"' (yes/no)", "yes")
opts.Update(env_base) # update environment
Help(opts.GenerateHelpText(env_base)) # generate help
@ -253,14 +250,6 @@ if selected_platform in platform_list:
#must happen after the flags, so when flags are used by configure, stuff happens (ie, ssl on x11)
detect.configure(env)
if (env["freetype"]!="no"):
env.Append(CCFLAGS=['-DFREETYPE_ENABLED'])
if (env["freetype"]=="builtin"):
env.Append(CPPPATH=['#drivers/freetype'])
env.Append(CPPPATH=['#drivers/freetype/freetype/include'])
#env['platform_libsuffix'] = env['LIBSUFFIX']
suffix="."+selected_platform
@ -321,46 +310,9 @@ if selected_platform in platform_list:
if (env.use_ptrcall):
env.Append(CPPFLAGS=['-DPTRCALL_ENABLED']);
if (env['musepack']=='yes'):
env.Append(CPPFLAGS=['-DMUSEPACK_ENABLED']);
#if (env['openssl']!='no'):
# env.Append(CPPFLAGS=['-DOPENSSL_ENABLED']);
# if (env['openssl']=="builtin"):
# env.Append(CPPPATH=['#drivers/builtin_openssl2'])
if (env["builtin_zlib"]=='yes'):
env.Append(CPPPATH=['#drivers/builtin_zlib/zlib'])
# to test 64 bits compiltion
# env.Append(CPPFLAGS=['-m64'])
if (env_base['squish']=='yes'):
env.Append(CPPFLAGS=['-DSQUISH_ENABLED']);
if (env['vorbis']=='yes'):
env.Append(CPPFLAGS=['-DVORBIS_ENABLED']);
if (env['opus']=='yes'):
env.Append(CPPFLAGS=['-DOPUS_ENABLED']);
if (env['theora']=='yes'):
env['theoralib']='yes'
env.Append(CPPFLAGS=['-DTHEORA_ENABLED']);
if (env['theoralib']=='yes'):
env.Append(CPPFLAGS=['-DTHEORALIB_ENABLED']);
if (env['png']=='yes'):
env.Append(CPPFLAGS=['-DPNG_ENABLED']);
if (env['dds']=='yes'):
env.Append(CPPFLAGS=['-DDDS_ENABLED']);
if (env['pvr']=='yes'):
env.Append(CPPFLAGS=['-DPVR_ENABLED']);
if (env['jpg']=='yes'):
env.Append(CPPFLAGS=['-DJPG_ENABLED']);
if (env['webp']=='yes'):
env.Append(CPPFLAGS=['-DWEBP_ENABLED']);
if (env['tools']=='yes'):
env.Append(CPPFLAGS=['-DTOOLS_ENABLED'])
if (env['disable_3d']=='yes'):
@ -379,9 +331,6 @@ if selected_platform in platform_list:
if (env['colored']=='yes'):
methods.colored(sys,env)
if (env['etc1']=='yes'):
env.Append(CPPFLAGS=['-DETC1_ENABLED'])
Export('env')
#build subdirs, the build order is dependent on link order.

97
drivers/SCsub vendored
View file

@ -1,78 +1,47 @@
Import('env')
env_drivers = env.Clone()
env.drivers_sources=[]
#env.add_source_files(env.drivers_sources,"*.cpp")
env_drivers.Append(CPPPATH=["vorbis"])
Export('env_drivers')
if ("builtin_zlib" in env and env["builtin_zlib"] == "yes"):
SConscript("zlib/SCsub");
# OS drivers
SConscript('unix/SCsub');
SConscript('windows/SCsub');
# Sounds drivers
SConscript('alsa/SCsub');
SConscript('pulseaudio/SCsub');
SConscript('windows/SCsub');
if (env["platform"] == "windows"):
SConscript("rtaudio/SCsub");
# Graphics drivers
SConscript('gles2/SCsub');
SConscript('gl_context/SCsub');
SConscript('pnm/SCsub');
if (env['openssl']!='no'):
env.Append(CPPFLAGS=['-DOPENSSL_ENABLED']);
env_drivers.Append(CPPFLAGS=['-DOPENSSL_ENABLED']);
if (env['openssl']=="builtin"):
env_drivers.Append(CPPPATH=['#drivers/builtin_openssl2'])
SConscript("builtin_openssl2/SCsub");
SConscript('openssl/SCsub')
if (env["png"]=="yes"):
SConscript("png/SCsub");
if (env["jpg"]=="yes"):
#SConscript("jpg/SCsub");
SConscript("jpegd/SCsub");
if (env["webp"]=="yes"):
SConscript("webp/SCsub");
SConscript("dds/SCsub");
SConscript("pvr/SCsub");
SConscript("etc1/SCsub")
if (env["builtin_zlib"]=="yes"):
SConscript("builtin_zlib/SCsub");
SConscript("rtaudio/SCsub");
# Core dependencies
SConscript("png/SCsub");
SConscript("nrex/SCsub");
SConscript("chibi/SCsub");
if (env["vorbis"]=="yes" or env["theoralib"]=="yes" or env["opus"]=="yes"):
SConscript("ogg/SCsub");
if (env["vorbis"]=="yes"):
SConscript("vorbis/SCsub");
if (env["opus"]=="yes"):
SConscript('opus/SCsub');
# Tools override
# FIXME: Should likely be integrated in the tools/ codebase
if (env["tools"]=="yes"):
SConscript("convex_decomp/SCsub");
if (env["theoralib"]=="yes"):
SConscript("theora/SCsub");
if (env['musepack']=='yes'):
SConscript("mpc/SCsub");
if (env["squish"]=="yes" and env["tools"]=="yes"):
SConscript("squish/SCsub");
if (env["freetype"]!="no"):
SConscript("freetype/SCsub");
num = 0
cur_base = ""
total = len(env.drivers_sources)
max_src = 64
list = []
lib_list = []
import string
if env['vsproj']=="yes":
env.AddToVSProject(env.drivers_sources)
if (env.split_drivers): #split drivers, this used to be needed for windows until separate builders for windows were created
# Split drivers, this used to be needed for windows until separate builders for windows were created
# FIXME: Check if still needed now that the drivers were made more lightweight
if (env.split_drivers):
import string
num = 0
cur_base = ""
max_src = 64
list = []
lib_list = []
for f in env.drivers_sources:
fname = ""
@ -84,14 +53,14 @@ if (env.split_drivers): #split drivers, this used to be needed for windows until
base = string.join(fname.split("/")[:2], "/")
if base != cur_base and len(list) > max_src:
if num > 0:
lib = env_drivers.Library("drivers"+str(num), list)
lib = env.Library("drivers"+str(num), list)
lib_list.append(lib)
list = []
num = num+1
cur_base = base
list.append(f)
lib = env_drivers.Library("drivers"+str(num), list)
lib = env.Library("drivers"+str(num), list)
lib_list.append(lib)
if len(lib_list) > 0:
@ -99,15 +68,15 @@ if (env.split_drivers): #split drivers, this used to be needed for windows until
if os.name=='posix' and sys.platform=='msys':
env.Replace(ARFLAGS=['rcsT'])
lib = env_drivers.Library("drivers_collated", lib_list)
lib = env.Library("drivers_collated", lib_list)
lib_list = [lib]
drivers_base=[]
env_drivers.add_source_files(drivers_base,"*.cpp")
lib_list.insert(0, env_drivers.Library("drivers", drivers_base))
env.add_source_files(drivers_base,"*.cpp")
lib_list.insert(0, env.Library("drivers", drivers_base))
env.Prepend(LIBS=lib_list)
else:
env_drivers.add_source_files(env.drivers_sources,"*.cpp")
lib = env_drivers.Library("drivers",env.drivers_sources)
env.add_source_files(env.drivers_sources,"*.cpp")
lib = env.Library("drivers",env.drivers_sources)
env.Prepend(LIBS=[lib])

View file

@ -1,5 +1,5 @@
Import('env')
env.add_source_files(env.drivers_sources,"*.cpp")
env.add_source_files(env.drivers_sources, "*.cpp")
Export('env')

View file

@ -1,663 +0,0 @@
Import('env')
Import('env_drivers')
openssl_sources = [
"ssl/t1_lib.c",
"ssl/t1_ext.c",
"ssl/s3_srvr.c",
"ssl/t1_enc.c",
"ssl/t1_meth.c",
"ssl/s23_clnt.c",
"ssl/ssl_asn1.c",
"ssl/tls_srp.c",
"ssl/kssl.c",
"ssl/d1_both.c",
"ssl/t1_clnt.c",
"ssl/bio_ssl.c",
"ssl/d1_srtp.c",
"ssl/t1_reneg.c",
"ssl/ssl_cert.c",
"ssl/s3_lib.c",
"ssl/d1_srvr.c",
"ssl/s23_meth.c",
"ssl/ssl_stat.c",
"ssl/ssl_err.c",
"ssl/ssl_algs.c",
"ssl/s3_cbc.c",
"ssl/d1_clnt.c",
"ssl/s3_pkt.c",
"ssl/d1_meth.c",
"ssl/s3_both.c",
"ssl/s2_enc.c",
"ssl/s3_meth.c",
"ssl/s3_enc.c",
"ssl/s23_pkt.c",
"ssl/s2_pkt.c",
"ssl/d1_pkt.c",
"ssl/ssl_rsa.c",
"ssl/s23_srvr.c",
"ssl/s2_meth.c",
"ssl/s3_clnt.c",
"ssl/s23_lib.c",
"ssl/t1_srvr.c",
"ssl/ssl_lib.c",
"ssl/ssl_txt.c",
"ssl/s2_srvr.c",
"ssl/ssl_sess.c",
"ssl/s2_clnt.c",
"ssl/d1_lib.c",
"ssl/s2_lib.c",
"ssl/ssl_err2.c",
"ssl/ssl_ciph.c",
"crypto/dsa/dsa_lib.c",
"crypto/dsa/dsa_pmeth.c",
"crypto/dsa/dsa_ossl.c",
"crypto/dsa/dsa_gen.c",
"crypto/dsa/dsa_asn1.c",
"crypto/dsa/dsa_prn.c",
"crypto/dsa/dsa_sign.c",
"crypto/dsa/dsa_key.c",
"crypto/dsa/dsa_vrf.c",
"crypto/dsa/dsa_err.c",
"crypto/dsa/dsa_ameth.c",
"crypto/dsa/dsa_depr.c",
"crypto/x509/x509_lu.c",
"crypto/x509/x509cset.c",
"crypto/x509/x509_set.c",
"crypto/x509/x509_d2.c",
"crypto/x509/x509_txt.c",
"crypto/x509/x509rset.c",
"crypto/x509/by_dir.c",
"crypto/x509/x509_vpm.c",
"crypto/x509/x509_vfy.c",
"crypto/x509/x509_trs.c",
"crypto/x509/by_file.c",
"crypto/x509/x509_obj.c",
"crypto/x509/x509spki.c",
"crypto/x509/x509_v3.c",
"crypto/x509/x509_req.c",
"crypto/x509/x509_att.c",
"crypto/x509/x_all.c",
"crypto/x509/x509_ext.c",
"crypto/x509/x509type.c",
"crypto/x509/x509_def.c",
"crypto/x509/x509_err.c",
"crypto/x509/x509name.c",
"crypto/x509/x509_r2x.c",
"crypto/x509/x509_cmp.c",
"crypto/asn1/x_pkey.c",
"crypto/asn1/a_gentm.c",
"crypto/asn1/x_sig.c",
"crypto/asn1/t_req.c",
"crypto/asn1/t_pkey.c",
"crypto/asn1/p8_pkey.c",
"crypto/asn1/a_i2d_fp.c",
"crypto/asn1/x_val.c",
"crypto/asn1/f_string.c",
"crypto/asn1/p5_pbe.c",
"crypto/asn1/bio_ndef.c",
"crypto/asn1/a_bool.c",
"crypto/asn1/asn1_gen.c",
"crypto/asn1/x_algor.c",
"crypto/asn1/bio_asn1.c",
"crypto/asn1/asn_mime.c",
"crypto/asn1/t_x509.c",
"crypto/asn1/a_strex.c",
"crypto/asn1/x_nx509.c",
"crypto/asn1/asn1_err.c",
"crypto/asn1/x_crl.c",
"crypto/asn1/a_print.c",
"crypto/asn1/a_type.c",
"crypto/asn1/tasn_new.c",
"crypto/asn1/n_pkey.c",
"crypto/asn1/x_bignum.c",
"crypto/asn1/asn_pack.c",
"crypto/asn1/evp_asn1.c",
"crypto/asn1/t_bitst.c",
"crypto/asn1/x_req.c",
"crypto/asn1/a_time.c",
"crypto/asn1/x_name.c",
"crypto/asn1/x_pubkey.c",
"crypto/asn1/tasn_typ.c",
"crypto/asn1/asn_moid.c",
"crypto/asn1/a_utctm.c",
"crypto/asn1/asn1_lib.c",
"crypto/asn1/x_x509a.c",
"crypto/asn1/a_set.c",
"crypto/asn1/t_crl.c",
"crypto/asn1/p5_pbev2.c",
"crypto/asn1/tasn_enc.c",
"crypto/asn1/a_mbstr.c",
"crypto/asn1/tasn_dec.c",
"crypto/asn1/x_x509.c",
"crypto/asn1/a_octet.c",
"crypto/asn1/x_long.c",
"crypto/asn1/a_bytes.c",
"crypto/asn1/t_x509a.c",
"crypto/asn1/a_enum.c",
"crypto/asn1/a_int.c",
"crypto/asn1/tasn_prn.c",
"crypto/asn1/i2d_pr.c",
"crypto/asn1/a_utf8.c",
"crypto/asn1/t_spki.c",
"crypto/asn1/a_digest.c",
"crypto/asn1/a_dup.c",
"crypto/asn1/i2d_pu.c",
"crypto/asn1/a_verify.c",
"crypto/asn1/f_enum.c",
"crypto/asn1/a_sign.c",
"crypto/asn1/d2i_pr.c",
"crypto/asn1/asn1_par.c",
"crypto/asn1/x_spki.c",
"crypto/asn1/a_d2i_fp.c",
"crypto/asn1/f_int.c",
"crypto/asn1/x_exten.c",
"crypto/asn1/tasn_utl.c",
"crypto/asn1/nsseq.c",
"crypto/asn1/a_bitstr.c",
"crypto/asn1/x_info.c",
"crypto/asn1/a_strnid.c",
"crypto/asn1/a_object.c",
"crypto/asn1/tasn_fre.c",
"crypto/asn1/d2i_pu.c",
"crypto/asn1/ameth_lib.c",
"crypto/asn1/x_attrib.c",
"crypto/evp/m_sha.c",
"crypto/evp/e_camellia.c",
"crypto/evp/e_aes.c",
"crypto/evp/bio_b64.c",
"crypto/evp/m_sigver.c",
"crypto/evp/m_wp.c",
"crypto/evp/m_sha1.c",
"crypto/evp/p_seal.c",
"crypto/evp/c_alld.c",
"crypto/evp/p5_crpt.c",
"crypto/evp/e_rc4.c",
"crypto/evp/m_ecdsa.c",
"crypto/evp/bio_enc.c",
"crypto/evp/e_des3.c",
"crypto/evp/m_null.c",
"crypto/evp/bio_ok.c",
"crypto/evp/pmeth_gn.c",
"crypto/evp/e_rc5.c",
"crypto/evp/e_rc2.c",
"crypto/evp/p_dec.c",
"crypto/evp/p_verify.c",
"crypto/evp/e_rc4_hmac_md5.c",
"crypto/evp/pmeth_lib.c",
"crypto/evp/m_ripemd.c",
"crypto/evp/m_md5.c",
"crypto/evp/e_bf.c",
"crypto/evp/p_enc.c",
"crypto/evp/m_dss.c",
"crypto/evp/bio_md.c",
"crypto/evp/evp_pbe.c",
"crypto/evp/e_seed.c",
"crypto/evp/e_cast.c",
"crypto/evp/p_open.c",
"crypto/evp/p5_crpt2.c",
"crypto/evp/m_dss1.c",
"crypto/evp/names.c",
"crypto/evp/evp_acnf.c",
"crypto/evp/e_des.c",
"crypto/evp/evp_cnf.c",
"crypto/evp/evp_lib.c",
"crypto/evp/digest.c",
"crypto/evp/evp_err.c",
"crypto/evp/evp_enc.c",
"crypto/evp/e_old.c",
"crypto/evp/c_all.c",
"crypto/evp/m_md2.c",
"crypto/evp/e_xcbc_d.c",
"crypto/evp/pmeth_fn.c",
"crypto/evp/p_lib.c",
"crypto/evp/evp_key.c",
"crypto/evp/encode.c",
"crypto/evp/e_aes_cbc_hmac_sha1.c",
"crypto/evp/e_aes_cbc_hmac_sha256.c",
"crypto/evp/m_mdc2.c",
"crypto/evp/e_null.c",
"crypto/evp/p_sign.c",
"crypto/evp/e_idea.c",
"crypto/evp/c_allc.c",
"crypto/evp/evp_pkey.c",
"crypto/evp/m_md4.c",
"crypto/ex_data.c",
"crypto/pkcs12/p12_p8e.c",
"crypto/pkcs12/p12_crt.c",
"crypto/pkcs12/p12_utl.c",
"crypto/pkcs12/p12_attr.c",
"crypto/pkcs12/p12_npas.c",
"crypto/pkcs12/p12_decr.c",
"crypto/pkcs12/p12_init.c",
"crypto/pkcs12/p12_kiss.c",
"crypto/pkcs12/p12_add.c",
"crypto/pkcs12/p12_p8d.c",
"crypto/pkcs12/p12_mutl.c",
"crypto/pkcs12/p12_crpt.c",
"crypto/pkcs12/pk12err.c",
"crypto/pkcs12/p12_asn.c",
"crypto/pkcs12/p12_key.c",
"crypto/ecdh/ech_key.c",
"crypto/ecdh/ech_ossl.c",
"crypto/ecdh/ech_lib.c",
"crypto/ecdh/ech_err.c",
"crypto/ecdh/ech_kdf.c",
"crypto/o_str.c",
"crypto/conf/conf_api.c",
"crypto/conf/conf_err.c",
"crypto/conf/conf_def.c",
"crypto/conf/conf_lib.c",
"crypto/conf/conf_mall.c",
"crypto/conf/conf_sap.c",
"crypto/conf/conf_mod.c",
"crypto/ebcdic.c",
"crypto/ecdsa/ecs_lib.c",
"crypto/ecdsa/ecs_asn1.c",
"crypto/ecdsa/ecs_ossl.c",
"crypto/ecdsa/ecs_vrf.c",
"crypto/ecdsa/ecs_sign.c",
"crypto/ecdsa/ecs_err.c",
"crypto/dso/dso_win32.c",
"crypto/dso/dso_lib.c",
"crypto/dso/dso_dlfcn.c",
"crypto/dso/dso_dl.c",
"crypto/dso/dso_beos.c",
"crypto/dso/dso_null.c",
"crypto/dso/dso_vms.c",
"crypto/dso/dso_err.c",
"crypto/dso/dso_openssl.c",
"crypto/cryptlib.c",
"crypto/md5/md5_one.c",
"crypto/md5/md5_dgst.c",
"crypto/pkcs7/pkcs7err.c",
"crypto/pkcs7/pk7_smime.c",
"crypto/pkcs7/bio_pk7.c",
"crypto/pkcs7/pk7_mime.c",
"crypto/pkcs7/pk7_lib.c",
"crypto/pkcs7/pk7_asn1.c",
"crypto/pkcs7/pk7_doit.c",
"crypto/pkcs7/pk7_attr.c",
"crypto/md4/md4_one.c",
"crypto/md4/md4_dgst.c",
"crypto/o_dir.c",
"crypto/buffer/buf_err.c",
"crypto/buffer/buf_str.c",
"crypto/buffer/buffer.c",
"crypto/cms/cms_lib.c",
"crypto/cms/cms_io.c",
"crypto/cms/cms_err.c",
"crypto/cms/cms_dd.c",
"crypto/cms/cms_smime.c",
"crypto/cms/cms_att.c",
"crypto/cms/cms_pwri.c",
"crypto/cms/cms_cd.c",
"crypto/cms/cms_sd.c",
"crypto/cms/cms_asn1.c",
"crypto/cms/cms_env.c",
"crypto/cms/cms_enc.c",
"crypto/cms/cms_ess.c",
"crypto/cms/cms_kari.c",
"crypto/mem_dbg.c",
"crypto/uid.c",
"crypto/stack/stack.c",
"crypto/ec/ec_ameth.c",
"crypto/ec/ec_err.c",
"crypto/ec/ec_lib.c",
"crypto/ec/ec_curve.c",
"crypto/ec/ec_oct.c",
"crypto/ec/ec_asn1.c",
"crypto/ec/ecp_oct.c",
"crypto/ec/ec_print.c",
"crypto/ec/ec2_smpl.c",
"crypto/ec/ecp_nistp224.c",
"crypto/ec/ec2_oct.c",
"crypto/ec/eck_prn.c",
"crypto/ec/ec_key.c",
"crypto/ec/ecp_nist.c",
"crypto/ec/ec_check.c",
"crypto/ec/ecp_smpl.c",
"crypto/ec/ec2_mult.c",
"crypto/ec/ecp_mont.c",
"crypto/ec/ecp_nistp521.c",
"crypto/ec/ec_mult.c",
"crypto/ec/ecp_nistputil.c",
"crypto/ec/ec_pmeth.c",
"crypto/ec/ec_cvt.c",
"crypto/ec/ecp_nistp256.c",
"crypto/krb5/krb5_asn.c",
"crypto/hmac/hmac.c",
"crypto/hmac/hm_ameth.c",
"crypto/hmac/hm_pmeth.c",
"crypto/comp/c_rle.c",
"crypto/comp/c_zlib.c",
"crypto/comp/comp_lib.c",
"crypto/comp/comp_err.c",
"crypto/des/fcrypt.c",
"crypto/des/str2key.c",
"crypto/des/cbc_cksm.c",
"crypto/des/des_enc.c",
"crypto/des/ofb_enc.c",
"crypto/des/read2pwd.c",
"crypto/des/ecb3_enc.c",
"crypto/des/rand_key.c",
"crypto/des/cfb64ede.c",
"crypto/des/rpc_enc.c",
"crypto/des/ofb64ede.c",
"crypto/des/qud_cksm.c",
"crypto/des/enc_writ.c",
"crypto/des/set_key.c",
"crypto/des/xcbc_enc.c",
"crypto/des/fcrypt_b.c",
"crypto/des/ede_cbcm_enc.c",
"crypto/des/des_old2.c",
"crypto/des/cfb_enc.c",
"crypto/des/ecb_enc.c",
"crypto/des/enc_read.c",
"crypto/des/des_old.c",
"crypto/des/ofb64enc.c",
"crypto/des/pcbc_enc.c",
"crypto/des/cbc_enc.c",
"crypto/des/cfb64enc.c",
"crypto/lhash/lh_stats.c",
"crypto/lhash/lhash.c",
"crypto/x509v3/v3_genn.c",
"crypto/x509v3/pcy_cache.c",
"crypto/x509v3/v3_sxnet.c",
"crypto/x509v3/v3_scts.c",
"crypto/x509v3/v3err.c",
"crypto/x509v3/v3_conf.c",
"crypto/x509v3/v3_utl.c",
"crypto/x509v3/v3_akeya.c",
"crypto/x509v3/v3_lib.c",
"crypto/x509v3/pcy_lib.c",
"crypto/x509v3/v3_cpols.c",
"crypto/x509v3/v3_ia5.c",
"crypto/x509v3/v3_bitst.c",
"crypto/x509v3/v3_skey.c",
"crypto/x509v3/v3_info.c",
"crypto/x509v3/v3_asid.c",
"crypto/x509v3/pcy_tree.c",
"crypto/x509v3/v3_pcons.c",
"crypto/x509v3/v3_bcons.c",
"crypto/x509v3/v3_pku.c",
"crypto/x509v3/v3_ocsp.c",
"crypto/x509v3/pcy_map.c",
"crypto/x509v3/v3_ncons.c",
"crypto/x509v3/v3_purp.c",
"crypto/x509v3/v3_enum.c",
"crypto/x509v3/v3_pmaps.c",
"crypto/x509v3/pcy_node.c",
"crypto/x509v3/v3_pcia.c",
"crypto/x509v3/v3_crld.c",
"crypto/x509v3/v3_pci.c",
"crypto/x509v3/v3_akey.c",
"crypto/x509v3/v3_addr.c",
"crypto/x509v3/v3_int.c",
"crypto/x509v3/v3_alt.c",
"crypto/x509v3/v3_extku.c",
"crypto/x509v3/v3_prn.c",
"crypto/x509v3/pcy_data.c",
"crypto/aes/aes_ofb.c",
"crypto/aes/aes_ctr.c",
"crypto/aes/aes_ecb.c",
"crypto/aes/aes_cfb.c",
"crypto/aes/aes_wrap.c",
"crypto/aes/aes_ige.c",
"crypto/aes/aes_misc.c",
"crypto/pqueue/pqueue.c",
"crypto/sha/sha_one.c",
"crypto/sha/sha_dgst.c",
"crypto/sha/sha512.c",
"crypto/sha/sha1_one.c",
"crypto/sha/sha1dgst.c",
"crypto/sha/sha256.c",
"crypto/whrlpool/wp_dgst.c",
"crypto/objects/obj_xref.c",
"crypto/objects/o_names.c",
"crypto/objects/obj_err.c",
"crypto/objects/obj_dat.c",
"crypto/objects/obj_lib.c",
"crypto/mem.c",
"crypto/fips_ers.c",
"crypto/o_fips.c",
"crypto/engine/eng_rdrand.c",
"crypto/engine/eng_err.c",
"crypto/engine/tb_ecdsa.c",
"crypto/engine/tb_rsa.c",
"crypto/engine/tb_cipher.c",
"crypto/engine/tb_dsa.c",
"crypto/engine/eng_lib.c",
"crypto/engine/tb_asnmth.c",
"crypto/engine/tb_ecdh.c",
"crypto/engine/tb_dh.c",
"crypto/engine/tb_store.c",
"crypto/engine/eng_init.c",
"crypto/engine/eng_cnf.c",
"crypto/engine/eng_all.c",
"crypto/engine/tb_digest.c",
"crypto/engine/tb_pkmeth.c",
"crypto/engine/eng_table.c",
"crypto/engine/eng_ctrl.c",
"crypto/engine/eng_list.c",
"crypto/engine/eng_cryptodev.c",
"crypto/engine/eng_pkey.c",
"crypto/engine/tb_rand.c",
"crypto/engine/eng_openssl.c",
"crypto/engine/eng_fat.c",
"crypto/engine/eng_dyn.c",
"crypto/ts/ts_rsp_verify.c",
"crypto/ts/ts_req_print.c",
"crypto/ts/ts_verify_ctx.c",
"crypto/ts/ts_req_utils.c",
"crypto/ts/ts_err.c",
"crypto/ts/ts_rsp_print.c",
"crypto/ts/ts_rsp_utils.c",
"crypto/ts/ts_lib.c",
"crypto/ts/ts_conf.c",
"crypto/ts/ts_asn1.c",
"crypto/ts/ts_rsp_sign.c",
"crypto/ocsp/ocsp_ext.c",
"crypto/ocsp/ocsp_cl.c",
"crypto/ocsp/ocsp_ht.c",
"crypto/ocsp/ocsp_lib.c",
"crypto/ocsp/ocsp_srv.c",
"crypto/ocsp/ocsp_vfy.c",
"crypto/ocsp/ocsp_err.c",
"crypto/ocsp/ocsp_prn.c",
"crypto/ocsp/ocsp_asn.c",
"crypto/bf/bf_cfb64.c",
"crypto/bf/bf_ecb.c",
"crypto/bf/bf_enc.c",
"crypto/bf/bf_skey.c",
"crypto/bf/bf_ofb64.c",
"crypto/idea/i_skey.c",
"crypto/idea/i_ofb64.c",
"crypto/idea/i_cbc.c",
"crypto/idea/i_ecb.c",
"crypto/idea/i_cfb64.c",
"crypto/cmac/cm_ameth.c",
"crypto/cmac/cmac.c",
"crypto/cmac/cm_pmeth.c",
"crypto/dh/dh_lib.c",
"crypto/dh/dh_key.c",
"crypto/dh/dh_asn1.c",
"crypto/dh/dh_depr.c",
"crypto/dh/dh_pmeth.c",
"crypto/dh/dh_prn.c",
"crypto/dh/dh_gen.c",
"crypto/dh/dh_ameth.c",
"crypto/dh/dh_check.c",
"crypto/dh/dh_err.c",
"crypto/dh/dh_kdf.c",
"crypto/dh/dh_rfc5114.c",
"crypto/modes/ccm128.c",
"crypto/modes/ofb128.c",
"crypto/modes/cts128.c",
"crypto/modes/ctr128.c",
"crypto/modes/gcm128.c",
"crypto/modes/cbc128.c",
"crypto/modes/cfb128.c",
"crypto/modes/xts128.c",
"crypto/modes/wrap128.c",
"crypto/camellia/cmll_cfb.c",
"crypto/camellia/cmll_ecb.c",
"crypto/camellia/cmll_utl.c",
"crypto/camellia/cmll_misc.c",
"crypto/camellia/cmll_ofb.c",
"crypto/camellia/cmll_ctr.c",
"crypto/seed/seed_ecb.c",
"crypto/seed/seed_cbc.c",
"crypto/seed/seed.c",
"crypto/seed/seed_ofb.c",
"crypto/seed/seed_cfb.c",
"crypto/txt_db/txt_db.c",
"crypto/cpt_err.c",
"crypto/pem/pem_pk8.c",
"crypto/pem/pem_lib.c",
"crypto/pem/pem_sign.c",
"crypto/pem/pem_all.c",
"crypto/pem/pem_info.c",
"crypto/pem/pem_pkey.c",
"crypto/pem/pem_seal.c",
"crypto/pem/pem_err.c",
"crypto/pem/pem_xaux.c",
"crypto/pem/pvkfmt.c",
"crypto/pem/pem_x509.c",
"crypto/pem/pem_oth.c",
"crypto/rand/rand_lib.c",
"crypto/rand/randfile.c",
"crypto/rand/rand_os2.c",
"crypto/rand/rand_unix.c",
"crypto/rand/rand_nw.c",
"crypto/rand/md_rand.c",
"crypto/rand/rand_err.c",
"crypto/rand/rand_win.c",
"crypto/rand/rand_egd.c",
"crypto/cversion.c",
"crypto/cast/c_ecb.c",
"crypto/cast/c_skey.c",
"crypto/cast/c_ofb64.c",
"crypto/cast/c_enc.c",
"crypto/cast/c_cfb64.c",
"crypto/o_time.c",
"crypto/mdc2/mdc2dgst.c",
"crypto/mdc2/mdc2_one.c",
"crypto/rc4/rc4_utl.c",
"crypto/ui/ui_compat.c",
"crypto/ui/ui_util.c",
"crypto/ui/ui_lib.c",
"crypto/ui/ui_err.c",
"crypto/ui/ui_openssl.c",
"crypto/bio/bf_buff.c",
"crypto/bio/bss_null.c",
"crypto/bio/bss_acpt.c",
"crypto/bio/bss_conn.c",
"crypto/bio/bss_fd.c",
"crypto/bio/bf_null.c",
"crypto/bio/bio_err.c",
"crypto/bio/bss_sock.c",
"crypto/bio/bss_mem.c",
"crypto/bio/b_dump.c",
"crypto/bio/b_print.c",
"crypto/bio/b_sock.c",
"crypto/bio/bss_dgram.c",
"crypto/bio/bf_nbio.c",
"crypto/bio/bio_lib.c",
"crypto/bio/bss_file.c",
"crypto/bio/bss_bio.c",
"crypto/bio/bss_log.c",
"crypto/bio/bio_cb.c",
"crypto/o_init.c",
"crypto/rc2/rc2_skey.c",
"crypto/rc2/rc2_cbc.c",
"crypto/rc2/rc2cfb64.c",
"crypto/rc2/rc2_ecb.c",
"crypto/rc2/rc2ofb64.c",
"crypto/bn/bn_x931p.c",
"crypto/bn/bn_blind.c",
"crypto/bn/bn_gf2m.c",
"crypto/bn/bn_const.c",
"crypto/bn/bn_sqr.c",
"crypto/bn/bn_nist.c",
"crypto/bn/bn_rand.c",
"crypto/bn/bn_err.c",
"crypto/bn/bn_div.c",
"crypto/bn/bn_kron.c",
"crypto/bn/bn_ctx.c",
"crypto/bn/bn_shift.c",
"crypto/bn/bn_mod.c",
"crypto/bn/bn_exp2.c",
"crypto/bn/bn_word.c",
"crypto/bn/bn_add.c",
"crypto/bn/bn_exp.c",
"crypto/bn/bn_mont.c",
"crypto/bn/bn_print.c",
"crypto/bn/bn_mul.c",
"crypto/bn/bn_prime.c",
"crypto/bn/bn_depr.c",
"crypto/bn/bn_gcd.c",
"crypto/bn/bn_mpi.c",
"crypto/bn/bn_sqrt.c",
"crypto/bn/bn_recp.c",
"crypto/bn/bn_lib.c",
"crypto/ripemd/rmd_dgst.c",
"crypto/ripemd/rmd_one.c",
"crypto/rsa/rsa_x931.c",
"crypto/rsa/rsa_depr.c",
"crypto/rsa/rsa_saos.c",
"crypto/rsa/rsa_crpt.c",
"crypto/rsa/rsa_pss.c",
"crypto/rsa/rsa_oaep.c",
"crypto/rsa/rsa_null.c",
"crypto/rsa/rsa_gen.c",
"crypto/rsa/rsa_prn.c",
"crypto/rsa/rsa_pmeth.c",
"crypto/rsa/rsa_asn1.c",
"crypto/rsa/rsa_ssl.c",
"crypto/rsa/rsa_ameth.c",
"crypto/rsa/rsa_pk1.c",
"crypto/rsa/rsa_err.c",
"crypto/rsa/rsa_lib.c",
"crypto/rsa/rsa_none.c",
"crypto/rsa/rsa_chk.c",
"crypto/rsa/rsa_eay.c",
"crypto/rsa/rsa_sign.c",
"crypto/srp/srp_lib.c",
"crypto/srp/srp_vfy.c",
"crypto/err/err.c",
"crypto/err/err_prn.c",
"crypto/err/err_all.c",
"crypto/mem_clr.c",
"crypto/rc4/rc4_skey.c",
"crypto/rc4/rc4_enc.c",
"crypto/camellia/camellia.c",
"crypto/camellia/cmll_cbc.c",
#"crypto/aes/aes_x86core.c",
"crypto/aes/aes_core.c",
"crypto/aes/aes_cbc.c",
"crypto/whrlpool/wp_block.c",
"crypto/bn/bn_asm.c",
]
#env.drivers_sources+=openssl_sources
env.Append(CPPPATH=["#drivers/builtin_openssl2"])
env_drivers.Append(CPPPATH=["#drivers/builtin_openssl2/crypto"])
env_drivers.Append(CPPPATH=["#drivers/builtin_openssl2/openssl"])
env_drivers.Append(CPPPATH=["#drivers/builtin_openssl2/crypto/evp"])
env_drivers.Append(CPPPATH=["#drivers/builtin_openssl2/crypto/asn1"])
env_drivers.Append(CPPPATH=["#drivers/builtin_openssl2/crypto/modes"])
#env_ssl.Append(CPPPATH=["#drivers/builtin_openssl2/crypto/store"])
env_drivers.Append(CPPFLAGS=["-DOPENSSL_NO_ASM","-DOPENSSL_THREADS","-DL_ENDIAN"])
if "platform" in env and env["platform"] == "winrt":
openssl_sources += ['winrt.cpp']
# Workaround for compilation error with GCC/Clang when -Werror is too greedy (GH-4517)
import os
import methods
if not (os.name=="nt" and methods.msvc_is_detected() ): # not Windows and not MSVC
env_drivers.Append(CFLAGS=["-Wno-error=implicit-function-declaration"])
env_drivers.add_source_files(env.drivers_sources,openssl_sources)

View file

@ -1,22 +0,0 @@
Import('env')
zlib_sources = [
"builtin_zlib/zlib/adler32.c",
"builtin_zlib/zlib/compress.c",
"builtin_zlib/zlib/crc32.c",
"builtin_zlib/zlib/deflate.c",
"builtin_zlib/zlib/infback.c",
"builtin_zlib/zlib/inffast.c",
"builtin_zlib/zlib/inflate.c",
"builtin_zlib/zlib/inftrees.c",
"builtin_zlib/zlib/trees.c",
"builtin_zlib/zlib/uncompr.c",
"builtin_zlib/zlib/zutil.c",
]
env.drivers_sources+=zlib_sources
#env.add_source_files("core", png_sources)
Export('env')

View file

@ -1,5 +0,0 @@
Import('env')
env.add_source_files(env.drivers_sources,"*.cpp")
Export('env')

View file

@ -1,4 +1,5 @@
Import('env')
Export('env');
env.add_source_files(env.drivers_sources,"*.cpp")
env.add_source_files(env.drivers_sources, "*.cpp")
Export('env')

View file

@ -1,10 +0,0 @@
Import('env')
dds_sources = [
"dds/texture_loader_dds.cpp"
]
env.drivers_sources+=dds_sources
#env.add_source_files(env.drivers_sources, dds_sources)

View file

@ -1,15 +0,0 @@
Import('env')
etc_sources = [
"etc1/image_etc.cpp",
"etc1/rg_etc1.cpp",
"etc1/texture_loader_pkm.cpp"
]
if (env["etc1"] != "no"):
env.drivers_sources+=etc_sources
#env.add_source_files(env.drivers_sources, etc_sources)
Export('env')

View file

@ -1,73 +0,0 @@
Import('env')
ft_sources=[\
"src/autofit/autofit.c",\
"src/base/ftapi.c",\
"src/base/ftbase.c",\
"src/base/ftbbox.c",\
"src/base/ftbdf.c",\
"src/base/ftbitmap.c",\
"src/base/ftcid.c",\
"src/base/ftdebug.c",\
"src/base/ftfntfmt.c",\
"src/base/ftfstype.c",\
"src/base/ftgasp.c",\
"src/base/ftglyph.c",\
"src/base/ftgxval.c",\
"src/base/ftinit.c",\
"src/base/ftlcdfil.c",\
"src/base/ftmm.c",\
"src/base/ftotval.c",\
"src/base/ftpatent.c",\
"src/base/ftpfr.c",\
"src/base/ftpic.c",\
"src/base/ftstroke.c",\
"src/base/ftsynth.c",\
"src/base/ftsystem.c",\
"src/base/fttype1.c",\
"src/base/ftwinfnt.c",\
"src/bdf/bdf.c",\
"src/cache/ftcache.c",\
"src/cff/cff.c",\
"src/cid/type1cid.c",\
"src/gxvalid/gxvalid.c",\
"src/otvalid/otvalid.c",\
"src/pcf/pcf.c",\
"src/pfr/pfr.c",\
"src/psaux/psaux.c",\
"src/pshinter/pshinter.c",\
"src/psnames/psnames.c",\
"src/raster/raster.c",\
"src/sfnt/sfnt.c",\
"src/smooth/smooth.c",\
"src/truetype/truetype.c",\
"src/type1/type1.c",\
"src/type42/type42.c",\
"src/winfonts/winfnt.c",\
]
if (env["freetype"]=="builtin"):
# Include header for WinRT to fix build issues
if "platform" in env and env["platform"] == "winrt":
env.Append(CCFLAGS=['/FI', '"drivers/freetype/winrtdef.h"'])
# fix for Windows' shell miserably failing on long lines, split in two libraries
half1=[]
half2=[]
for x in ft_sources:
if (x.find("src/base")==0 or x.find("src/sfnt")==0):
half2.append(x)
else:
half1.append(x)
lib = env.Library("freetype_builtin1",half2)
env.Append(LIBS=[lib])
lib = env.Library("freetype_builtin2",half1)
env.Append(LIBS=[lib])
env.Append(CPPPATH=["#drivers/freetype/include"])
Export('env')

View file

@ -1,19 +0,0 @@
# FreeType 2 src Jamfile
#
# Copyright 2001-2016 by
# David Turner, Robert Wilhelm, and Werner Lemberg.
#
# This file is part of the FreeType project, and may only be used, modified,
# and distributed under the terms of the FreeType project license,
# LICENSE.TXT. By continuing to use, modify, or distribute this file you
# indicate that you have read the license and understand and accept it
# fully.
SubDir FT2_TOP $(FT2_SRC_DIR) ;
for xx in $(FT2_COMPONENTS)
{
SubInclude FT2_TOP $(FT2_SRC_DIR) $(xx) ;
}
# end of src Jamfile

View file

@ -1,53 +0,0 @@
# FreeType 2 src/autofit Jamfile
#
# Copyright 2003-2016 by
# David Turner, Robert Wilhelm, and Werner Lemberg.
#
# This file is part of the FreeType project, and may only be used, modified,
# and distributed under the terms of the FreeType project license,
# LICENSE.TXT. By continuing to use, modify, or distribute this file you
# indicate that you have read the license and understand and accept it
# fully.
SubDir FT2_TOP src autofit ;
{
local _sources ;
# define FT2_AUTOFIT2 to enable experimental latin hinter replacement
if $(FT2_AUTOFIT2)
{
CCFLAGS += FT_OPTION_AUTOFIT2 ;
}
if $(FT2_MULTI)
{
_sources = afangles
afblue
afcjk
afdummy
afglobal
afhints
afindic
aflatin
afloader
afmodule
afpic
afranges
afshaper
afwarp
;
if $(FT2_AUTOFIT2)
{
_sources += aflatin2 ;
}
}
else
{
_sources = autofit ;
}
Library $(FT2_LIB) : $(_sources).c ;
}
# end of src/autofit Jamfile

View file

@ -1,88 +0,0 @@
# FreeType 2 src/base Jamfile
#
# Copyright 2001-2016 by
# David Turner, Robert Wilhelm, and Werner Lemberg.
#
# This file is part of the FreeType project, and may only be used, modified,
# and distributed under the terms of the FreeType project license,
# LICENSE.TXT. By continuing to use, modify, or distribute this file you
# indicate that you have read the license and understand and accept it
# fully.
SubDir FT2_TOP $(FT2_SRC_DIR) base ;
{
local _sources ;
if $(FT2_MULTI)
{
_sources = basepic
ftadvanc
ftcalc
ftdbgmem
ftgloadr
fthash
ftobjs
ftoutln
ftpic
ftrfork
ftsnames
ftstream
fttrigon
ftutil
;
}
else
{
_sources = ftbase ;
}
Library $(FT2_LIB) : $(_sources).c ;
}
# Add the optional/replaceable files.
#
{
local _sources = ftapi
ftbbox
ftbdf
ftbitmap
ftcid
ftdebug
ftfntfmt
ftfstype
ftgasp
ftglyph
ftgxval
ftinit
ftlcdfil
ftmm
ftotval
ftpatent
ftpfr
ftstroke
ftsynth
ftsystem
fttype1
ftwinfnt
;
Library $(FT2_LIB) : $(_sources).c ;
}
# Add Macintosh-specific file to the library when necessary.
#
if $(MAC)
{
Library $(FT2_LIB) : ftmac.c ;
}
else if $(OS) = MACOSX
{
if $(FT2_MULTI)
{
Library $(FT2_LIB) : ftmac.c ;
}
}
# end of src/base Jamfile

View file

@ -1,31 +0,0 @@
# FreeType 2 src/bdf Jamfile
#
# Copyright 2002-2016 by
# David Turner, Robert Wilhelm, and Werner Lemberg.
#
# This file is part of the FreeType project, and may only be used, modified,
# and distributed under the terms of the FreeType project license,
# LICENSE.TXT. By continuing to use, modify, or distribute this file you
# indicate that you have read the license and understand and accept it
# fully.
SubDir FT2_TOP $(FT2_SRC_DIR) bdf ;
{
local _sources ;
if $(FT2_MULTI)
{
_sources = bdfdrivr
bdflib
;
}
else
{
_sources = bdf ;
}
Library $(FT2_LIB) : $(_sources).c ;
}
# end of src/bdf Jamfile

View file

@ -1,37 +0,0 @@
# FreeType 2 src/cache Jamfile
#
# Copyright 2001-2016 by
# David Turner, Robert Wilhelm, and Werner Lemberg.
#
# This file is part of the FreeType project, and may only be used, modified,
# and distributed under the terms of the FreeType project license,
# LICENSE.TXT. By continuing to use, modify, or distribute this file you
# indicate that you have read the license and understand and accept it
# fully.
SubDir FT2_TOP $(FT2_SRC_DIR) cache ;
{
local _sources ;
if $(FT2_MULTI)
{
_sources = ftcbasic
ftccache
ftcglyph
ftcimage
ftcmanag
ftccmap
ftcmru
ftcsbits
;
}
else
{
_sources = ftcache ;
}
Library $(FT2_LIB) : $(_sources).c ;
}
# end of src/cache Jamfile

View file

@ -1,45 +0,0 @@
# FreeType 2 src/cff Jamfile
#
# Copyright 2001-2016 by
# David Turner, Robert Wilhelm, and Werner Lemberg.
#
# This file is part of the FreeType project, and may only be used, modified,
# and distributed under the terms of the FreeType project license,
# LICENSE.TXT. By continuing to use, modify, or distribute this file you
# indicate that you have read the license and understand and accept it
# fully.
SubDir FT2_TOP $(FT2_SRC_DIR) cff ;
{
local _sources ;
if $(FT2_MULTI)
{
_sources = cffcmap
cffdrivr
cffgload
cffload
cffobjs
cffparse
cffpic
cf2arrst
cf2blues
cf2error
cf2font
cf2ft
cf2hints
cf2intrp
cf2read
cf2stack
;
}
else
{
_sources = cff ;
}
Library $(FT2_LIB) : $(_sources).c ;
}
# end of src/cff Jamfile

View file

@ -1,34 +0,0 @@
# FreeType 2 src/cid Jamfile
#
# Copyright 2001-2016 by
# David Turner, Robert Wilhelm, and Werner Lemberg.
#
# This file is part of the FreeType project, and may only be used, modified,
# and distributed under the terms of the FreeType project license,
# LICENSE.TXT. By continuing to use, modify, or distribute this file you
# indicate that you have read the license and understand and accept it
# fully.
SubDir FT2_TOP $(FT2_SRC_DIR) cid ;
{
local _sources ;
if $(FT2_MULTI)
{
_sources = cidgload
cidload
cidobjs
cidparse
cidriver
;
}
else
{
_sources = type1cid ;
}
Library $(FT2_LIB) : $(_sources).c ;
}
# end of src/cid Jamfile

View file

@ -1,52 +0,0 @@
# FreeType 2 src/gxvalid Jamfile
#
# Copyright 2005-2016 by
# suzuki toshiya, Masatake YAMATO and Red Hat K.K.
#
# This file is part of the FreeType project, and may only be used, modified,
# and distributed under the terms of the FreeType project license,
# LICENSE.TXT. By continuing to use, modify, or distribute this file you
# indicate that you have read the license and understand and accept it
# fully.
SubDir FT2_TOP $(FT2_SRC_DIR) gxvalid ;
{
local _sources ;
if $(FT2_MULTI)
{
_sources = gxvbsln
gxvcommn
gxvfeat
gxvjust
gxvkern
gxvlcar
gxvmod
gxvmort
gxvmort0
gxvmort1
gxvmort2
gxvmort4
gxvmort5
gxvmorx
gxvmorx0
gxvmorx1
gxvmorx2
gxvmorx4
gxvmorx5
gxvopbd
gxvprop
gxvtrak
;
}
else
{
_sources = gxvalid ;
}
Library $(FT2_LIB) : $(_sources).c ;
}
# end of src/gxvalid Jamfile

View file

@ -1,37 +0,0 @@
# FreeType 2 src/otvalid Jamfile
#
# Copyright 2004-2016 by
# David Turner, Robert Wilhelm, and Werner Lemberg.
#
# This file is part of the FreeType project, and may only be used, modified,
# and distributed under the terms of the FreeType project license,
# LICENSE.TXT. By continuing to use, modify, or distribute this file you
# indicate that you have read the license and understand and accept it
# fully.
SubDir FT2_TOP $(FT2_SRC_DIR) otvalid ;
{
local _sources ;
if $(FT2_MULTI)
{
_sources = otvbase
otvcommn
otvgdef
otvgpos
otvgsub
otvjstf
otvmath
otvmod
;
}
else
{
_sources = otvalid ;
}
Library $(FT2_LIB) : $(_sources).c ;
}
# end of src/otvalid Jamfile

View file

@ -1,32 +0,0 @@
# FreeType 2 src/pcf Jamfile
#
# Copyright 2001-2016 by
# David Turner, Robert Wilhelm, and Werner Lemberg.
#
# This file is part of the FreeType project, and may only be used, modified,
# and distributed under the terms of the FreeType project license,
# LICENSE.TXT. By continuing to use, modify, or distribute this file you
# indicate that you have read the license and understand and accept it
# fully.
SubDir FT2_TOP $(FT2_SRC_DIR) pcf ;
{
local _sources ;
if $(FT2_MULTI)
{
_sources = pcfdrivr
pcfread
pcfutil
;
}
else
{
_sources = pcf ;
}
Library $(FT2_LIB) : $(_sources).c ;
}
# end of src/pcf Jamfile

View file

@ -1,35 +0,0 @@
# FreeType 2 src/pfr Jamfile
#
# Copyright 2002-2016 by
# David Turner, Robert Wilhelm, and Werner Lemberg.
#
# This file is part of the FreeType project, and may only be used, modified,
# and distributed under the terms of the FreeType project license,
# LICENSE.TXT. By continuing to use, modify, or distribute this file you
# indicate that you have read the license and understand and accept it
# fully.
SubDir FT2_TOP $(FT2_SRC_DIR) pfr ;
{
local _sources ;
if $(FT2_MULTI)
{
_sources = pfrcmap
pfrdrivr
pfrgload
pfrload
pfrobjs
pfrsbit
;
}
else
{
_sources = pfr ;
}
Library $(FT2_LIB) : $(_sources).c ;
}
# end of src/pfr Jamfile

View file

@ -1,35 +0,0 @@
# FreeType 2 src/psaux Jamfile
#
# Copyright 2001-2016 by
# David Turner, Robert Wilhelm, and Werner Lemberg.
#
# This file is part of the FreeType project, and may only be used, modified,
# and distributed under the terms of the FreeType project license,
# LICENSE.TXT. By continuing to use, modify, or distribute this file you
# indicate that you have read the license and understand and accept it
# fully.
SubDir FT2_TOP $(FT2_SRC_DIR) psaux ;
{
local _sources ;
if $(FT2_MULTI)
{
_sources = afmparse
psauxmod
psconv
psobjs
t1cmap
t1decode
;
}
else
{
_sources = psaux ;
}
Library $(FT2_LIB) : $(_sources).c ;
}
# end of src/psaux Jamfile

View file

@ -1,34 +0,0 @@
# FreeType 2 src/pshinter Jamfile
#
# Copyright 2001-2016 by
# David Turner, Robert Wilhelm, and Werner Lemberg.
#
# This file is part of the FreeType project, and may only be used, modified,
# and distributed under the terms of the FreeType project license,
# LICENSE.TXT. By continuing to use, modify, or distribute this file you
# indicate that you have read the license and understand and accept it
# fully.
SubDir FT2_TOP $(FT2_SRC_DIR) pshinter ;
{
local _sources ;
if $(FT2_MULTI)
{
_sources = pshalgo
pshglob
pshmod
pshpic
pshrec
;
}
else
{
_sources = pshinter ;
}
Library $(FT2_LIB) : $(_sources).c ;
}
# end of src/pshinter Jamfile

View file

@ -1,31 +0,0 @@
# FreeType 2 src/psnames Jamfile
#
# Copyright 2001-2016 by
# David Turner, Robert Wilhelm, and Werner Lemberg.
#
# This file is part of the FreeType project, and may only be used, modified,
# and distributed under the terms of the FreeType project license,
# LICENSE.TXT. By continuing to use, modify, or distribute this file you
# indicate that you have read the license and understand and accept it
# fully.
SubDir FT2_TOP $(FT2_SRC_DIR) psnames ;
{
local _sources ;
if $(FT2_MULTI)
{
_sources = psmodule
pspic
;
}
else
{
_sources = psnames ;
}
Library $(FT2_LIB) : $(_sources).c ;
}
# end of src/psnames Jamfile

View file

@ -1,32 +0,0 @@
# FreeType 2 src/raster Jamfile
#
# Copyright 2001-2016 by
# David Turner, Robert Wilhelm, and Werner Lemberg.
#
# This file is part of the FreeType project, and may only be used, modified,
# and distributed under the terms of the FreeType project license,
# LICENSE.TXT. By continuing to use, modify, or distribute this file you
# indicate that you have read the license and understand and accept it
# fully.
SubDir FT2_TOP $(FT2_SRC_DIR) raster ;
{
local _sources ;
if $(FT2_MULTI)
{
_sources = ftraster
ftrend1
rastpic
;
}
else
{
_sources = raster ;
}
Library $(FT2_LIB) : $(_sources).c ;
}
# end of src/raster Jamfile

View file

@ -1,40 +0,0 @@
# FreeType 2 src/sfnt Jamfile
#
# Copyright 2001-2016 by
# David Turner, Robert Wilhelm, and Werner Lemberg.
#
# This file is part of the FreeType project, and may only be used, modified,
# and distributed under the terms of the FreeType project license,
# LICENSE.TXT. By continuing to use, modify, or distribute this file you
# indicate that you have read the license and understand and accept it
# fully.
SubDir FT2_TOP $(FT2_SRC_DIR) sfnt ;
{
local _sources ;
if $(FT2_MULTI)
{
_sources = pngshim
sfdriver
sfntpic
sfobjs
ttbdf
ttcmap
ttkern
ttload
ttmtx
ttpost
ttsbit
;
}
else
{
_sources = sfnt ;
}
Library $(FT2_LIB) : $(_sources).c ;
}
# end of src/sfnt Jamfile

View file

@ -1,32 +0,0 @@
# FreeType 2 src/smooth Jamfile
#
# Copyright 2001-2016 by
# David Turner, Robert Wilhelm, and Werner Lemberg.
#
# This file is part of the FreeType project, and may only be used, modified,
# and distributed under the terms of the FreeType project license,
# LICENSE.TXT. By continuing to use, modify, or distribute this file you
# indicate that you have read the license and understand and accept it
# fully.
SubDir FT2_TOP $(FT2_SRC_DIR) smooth ;
{
local _sources ;
if $(FT2_MULTI)
{
_sources = ftgrays
ftsmooth
ftspic
;
}
else
{
_sources = smooth ;
}
Library $(FT2_LIB) : $(_sources).c ;
}
# end of src/smooth Jamfile

View file

@ -1,37 +0,0 @@
# FreeType 2 src/truetype Jamfile
#
# Copyright 2001-2016 by
# David Turner, Robert Wilhelm, and Werner Lemberg.
#
# This file is part of the FreeType project, and may only be used, modified,
# and distributed under the terms of the FreeType project license,
# LICENSE.TXT. By continuing to use, modify, or distribute this file you
# indicate that you have read the license and understand and accept it
# fully.
SubDir FT2_TOP $(FT2_SRC_DIR) truetype ;
{
local _sources ;
if $(FT2_MULTI)
{
_sources = ttdriver
ttgload
ttgxvar
ttinterp
ttobjs
ttpic
ttpload
ttsubpix
;
}
else
{
_sources = truetype ;
}
Library $(FT2_LIB) : $(_sources).c ;
}
# end of src/truetype Jamfile

View file

@ -1,35 +0,0 @@
# FreeType 2 src/type1 Jamfile
#
# Copyright 2001-2016 by
# David Turner, Robert Wilhelm, and Werner Lemberg.
#
# This file is part of the FreeType project, and may only be used, modified,
# and distributed under the terms of the FreeType project license,
# LICENSE.TXT. By continuing to use, modify, or distribute this file you
# indicate that you have read the license and understand and accept it
# fully.
SubDir FT2_TOP $(FT2_SRC_DIR) type1 ;
{
local _sources ;
if $(FT2_MULTI)
{
_sources = t1afm
t1driver
t1gload
t1load
t1objs
t1parse
;
}
else
{
_sources = type1 ;
}
Library $(FT2_LIB) : $(_sources).c ;
}
# end of src/type1 Jamfile

View file

@ -1,32 +0,0 @@
# FreeType 2 src/type42 Jamfile
#
# Copyright 2002-2016 by
# David Turner, Robert Wilhelm, and Werner Lemberg.
#
# This file is part of the FreeType project, and may only be used, modified,
# and distributed under the terms of the FreeType project license,
# LICENSE.TXT. By continuing to use, modify, or distribute this file you
# indicate that you have read the license and understand and accept it
# fully.
SubDir FT2_TOP $(FT2_SRC_DIR) type42 ;
{
local _sources ;
if $(FT2_MULTI)
{
_sources = t42drivr
t42objs
t42parse
;
}
else
{
_sources = type42 ;
}
Library $(FT2_LIB) : $(_sources).c ;
}
# end of src/type42 Jamfile

View file

@ -1,16 +0,0 @@
# FreeType 2 src/winfonts Jamfile
#
# Copyright 2001-2016 by
# David Turner, Robert Wilhelm, and Werner Lemberg.
#
# This file is part of the FreeType project, and may only be used, modified,
# and distributed under the terms of the FreeType project license,
# LICENSE.TXT. By continuing to use, modify, or distribute this file you
# indicate that you have read the license and understand and accept it
# fully.
SubDir FT2_TOP $(FT2_SRC_DIR) winfonts ;
Library $(FT2_LIB) : winfnt.c ;
# end of src/winfonts Jamfile

View file

@ -1,11 +1,21 @@
Import('env')
env.add_source_files(env.drivers_sources,"*.cpp")
if (env["platform"] in ["haiku","osx","windows","x11"]):
# Thirdparty source files
if (env["glew"] != "system"): # builtin
thirdparty_dir = "#thirdparty/glew/"
thirdparty_sources = [
"glew.c",
]
thirdparty_sources = [thirdparty_dir + file for file in thirdparty_sources]
env.add_source_files(env.drivers_sources, thirdparty_sources)
env.Append(CPPFLAGS = ['-DGLEW_STATIC'])
env.Append(CPPPATH = [thirdparty_dir])
if (env.get('glew') == 'yes'):
env.add_source_files(env.drivers_sources,"glew.c")
env.Append(CPPFLAGS = ['-DGLEW_ENABLED'])
env.Append(CPPFLAGS = ['-DGLEW_STATIC'])
env.Append(CPPPATH = ['.'])
# Godot source files
env.add_source_files(env.drivers_sources, "*.cpp")
Export('env')

View file

@ -1,5 +1,7 @@
Import('env')
env.add_source_files(env.drivers_sources,"*.cpp")
env.add_source_files(env.drivers_sources, "*.cpp")
SConscript("shaders/SCsub")
Export('env')

View file

@ -6,3 +6,5 @@ if env['BUILDERS'].has_key('GLSL120GLES'):
env.GLSL120GLES('canvas_shadow.glsl');
env.GLSL120GLES('blur.glsl');
env.GLSL120GLES('copy.glsl');
Export('env')

View file

@ -1,11 +0,0 @@
Import('env')
jpg_sources = [
"jpegd/jpgd.cpp",
"jpegd/image_loader_jpegd.cpp"
]
env.drivers_sources+=jpg_sources
#env.add_source_files(env.drivers_sources, jpg_sources)

View file

@ -1,21 +0,0 @@
Import('env')
mpc_sources = [
"mpc/huffman.c",
"mpc/mpc_bits_reader.c",
"mpc/mpc_decoder.c",
"mpc/mpc_demux.c",
"mpc/mpc_reader.c",
"mpc/requant.c",
"mpc/streaminfo.c",
"mpc/synth_filter.c",
]
env.drivers_sources+=mpc_sources
env.add_source_files(env.drivers_sources,"*.cpp")
#env.add_source_files(env.drivers_sources, mpc_sources)
Export('env')

View file

@ -1,7 +1,5 @@
Import('env')
sources = [
'nrex.cpp',
'regex.cpp',
]
env.add_source_files(env.drivers_sources, sources)
env.add_source_files(env.drivers_sources, "*.cpp")
Export('env')

View file

@ -1,9 +0,0 @@
Import('env')
ogg_sources = [
"ogg/bitwise.c",
"ogg/framing.c",
]
env.drivers_sources+=ogg_sources

View file

@ -1,6 +0,0 @@
Import('env_drivers')
Import('env')
env_drivers.add_source_files(env.drivers_sources,"*.cpp")
env_drivers.add_source_files(env.drivers_sources,"*.c")

View file

@ -1,196 +0,0 @@
Import('env')
opus_sources = [
"opus/audio_stream_opus.cpp",
]
opus_sources_silk=[]
opus_sources_lib = [
"opus/silk/tables_other.c",
"opus/silk/sum_sqr_shift.c",
"opus/silk/PLC.c",
"opus/silk/dec_API.c",
"opus/silk/decode_pulses.c",
"opus/silk/inner_prod_aligned.c",
"opus/silk/init_encoder.c",
"opus/silk/interpolate.c",
"opus/silk/stereo_encode_pred.c",
"opus/silk/decode_frame.c",
"opus/silk/NLSF_del_dec_quant.c",
"opus/silk/VAD.c",
"opus/silk/resampler_private_AR2.c",
"opus/silk/NLSF_unpack.c",
"opus/silk/resampler_down2.c",
"opus/silk/sort.c",
"opus/silk/resampler_private_IIR_FIR.c",
"opus/silk/resampler_down2_3.c",
"opus/silk/resampler_private_up2_HQ.c",
"opus/silk/tables_gain.c",
"opus/silk/stereo_find_predictor.c",
"opus/silk/stereo_quant_pred.c",
"opus/silk/NLSF_stabilize.c",
"opus/silk/ana_filt_bank_1.c",
"opus/silk/check_control_input.c",
"opus/silk/bwexpander.c",
"opus/silk/A2NLSF.c",
"opus/silk/LPC_inv_pred_gain.c",
"opus/silk/log2lin.c",
"opus/silk/process_NLSFs.c",
"opus/silk/sigm_Q15.c",
"opus/silk/VQ_WMat_EC.c",
"opus/silk/quant_LTP_gains.c",
"opus/silk/resampler_private_down_FIR.c",
"opus/silk/NLSF_decode.c",
"opus/silk/control_codec.c",
"opus/silk/NLSF_VQ_weights_laroia.c",
"opus/silk/decode_pitch.c",
"opus/silk/stereo_decode_pred.c",
"opus/silk/tables_pulses_per_block.c",
"opus/silk/init_decoder.c",
"opus/silk/table_LSF_cos.c",
"opus/silk/decode_core.c",
"opus/silk/code_signs.c",
"opus/silk/enc_API.c",
"opus/silk/tables_LTP.c",
"opus/silk/pitch_est_tables.c",
"opus/silk/biquad_alt.c",
"opus/silk/encode_indices.c",
"opus/silk/tables_NLSF_CB_WB.c",
"opus/silk/debug.c",
"opus/silk/decode_parameters.c",
"opus/silk/tables_pitch_lag.c",
"opus/silk/NLSF2A.c",
"opus/silk/resampler.c",
"opus/silk/decode_indices.c",
"opus/silk/NLSF_VQ.c",
"opus/silk/bwexpander_32.c",
"opus/silk/tables_NLSF_CB_NB_MB.c",
"opus/silk/encode_pulses.c",
"opus/silk/NSQ_del_dec.c",
"opus/silk/control_SNR.c",
"opus/silk/shell_coder.c",
"opus/silk/NLSF_encode.c",
"opus/silk/stereo_MS_to_LR.c",
"opus/silk/stereo_LR_to_MS.c",
"opus/silk/HP_variable_cutoff.c",
"opus/silk/LPC_analysis_filter.c",
"opus/silk/CNG.c",
"opus/silk/decoder_set_fs.c",
"opus/silk/resampler_rom.c",
"opus/silk/control_audio_bandwidth.c",
"opus/silk/lin2log.c",
"opus/silk/LP_variable_cutoff.c",
"opus/silk/NSQ.c",
"opus/silk/gain_quant.c",
"opus/celt/laplace.c",
"opus/celt/vq.c",
"opus/celt/quant_bands.c",
"opus/celt/kiss_fft.c",
"opus/celt/entcode.c",
"opus/celt/entenc.c",
"opus/celt/celt_lpc.c",
"opus/celt/pitch.c",
"opus/celt/rate.c",
"opus/celt/mathops.c",
#"opus/celt/arm/armcpu.c",
#"opus/celt/arm/celt_neon_intr.c",
#"opus/celt/arm/celt_ne10_mdct.c",
#"opus/celt/arm/celt_ne10_fft.c",
#"opus/celt/arm/arm_celt_map.c",
"opus/celt/celt_encoder.c",
"opus/celt/celt.c",
"opus/celt/bands.c",
"opus/celt/cwrs.c",
"opus/celt/entdec.c",
"opus/celt/celt_decoder.c",
"opus/celt/mdct.c",
"opus/celt/modes.c",
"opus/repacketizer.c",
"opus/mlp_data.c",
"opus/opus_multistream.c",
"opus/opusfile.c",
"opus/opus_encoder.c",
"opus/analysis.c",
"opus/mlp.c",
"opus/info.c",
"opus/stream.c",
"opus/opus_decoder.c",
"opus/internal.c",
"opus/wincerts.c",
"opus/opus.c",
"opus/opus_multistream_encoder.c",
"opus/http.c",
"opus/opus_multistream_decoder.c"
]
if("opus_fixed_point" in env and env.opus_fixed_point=="yes"):
env.Append(CFLAGS=["-DOPUS_FIXED_POINT"])
opus_sources_silk = [
"opus/silk/fixed/schur64_FIX.c",
"opus/silk/fixed/residual_energy16_FIX.c",
"opus/silk/fixed/encode_frame_FIX.c",
"opus/silk/fixed/regularize_correlations_FIX.c",
"opus/silk/fixed/apply_sine_window_FIX.c",
"opus/silk/fixed/solve_LS_FIX.c",
"opus/silk/fixed/schur_FIX.c",
"opus/silk/fixed/pitch_analysis_core_FIX.c",
"opus/silk/fixed/noise_shape_analysis_FIX.c",
"opus/silk/fixed/find_LTP_FIX.c",
"opus/silk/fixed/vector_ops_FIX.c",
"opus/silk/fixed/autocorr_FIX.c",
"opus/silk/fixed/warped_autocorrelation_FIX.c",
"opus/silk/fixed/find_pitch_lags_FIX.c",
"opus/silk/fixed/k2a_Q16_FIX.c",
"opus/silk/fixed/LTP_scale_ctrl_FIX.c",
"opus/silk/fixed/corrMatrix_FIX.c",
"opus/silk/fixed/prefilter_FIX.c",
"opus/silk/fixed/find_LPC_FIX.c",
"opus/silk/fixed/residual_energy_FIX.c",
"opus/silk/fixed/process_gains_FIX.c",
"opus/silk/fixed/LTP_analysis_filter_FIX.c",
"opus/silk/fixed/k2a_FIX.c",
"opus/silk/fixed/burg_modified_FIX.c",
"opus/silk/fixed/find_pred_coefs_FIX.c"
]
else:
opus_sources_silk = [
"opus/silk/float/LTP_scale_ctrl_FLP.c",
"opus/silk/float/regularize_correlations_FLP.c",
"opus/silk/float/corrMatrix_FLP.c",
"opus/silk/float/LPC_analysis_filter_FLP.c",
"opus/silk/float/levinsondurbin_FLP.c",
"opus/silk/float/schur_FLP.c",
"opus/silk/float/scale_vector_FLP.c",
"opus/silk/float/apply_sine_window_FLP.c",
"opus/silk/float/pitch_analysis_core_FLP.c",
"opus/silk/float/wrappers_FLP.c",
"opus/silk/float/bwexpander_FLP.c",
"opus/silk/float/warped_autocorrelation_FLP.c",
"opus/silk/float/solve_LS_FLP.c",
"opus/silk/float/find_LPC_FLP.c",
"opus/silk/float/autocorrelation_FLP.c",
"opus/silk/float/find_pred_coefs_FLP.c",
"opus/silk/float/find_pitch_lags_FLP.c",
"opus/silk/float/burg_modified_FLP.c",
"opus/silk/float/find_LTP_FLP.c",
"opus/silk/float/energy_FLP.c",
"opus/silk/float/sort_FLP.c",
"opus/silk/float/LPC_inv_pred_gain_FLP.c",
"opus/silk/float/k2a_FLP.c",
"opus/silk/float/noise_shape_analysis_FLP.c",
"opus/silk/float/inner_product_FLP.c",
"opus/silk/float/process_gains_FLP.c",
"opus/silk/float/encode_frame_FLP.c",
"opus/silk/float/scale_copy_vector_FLP.c",
"opus/silk/float/residual_energy_FLP.c",
"opus/silk/float/LTP_analysis_filter_FLP.c",
"opus/silk/float/prefilter_FLP.c"
]
env.drivers_sources+=opus_sources_silk
env.drivers_sources+=opus_sources_lib
env.drivers_sources+=opus_sources
Export('env')

View file

@ -1,42 +1,48 @@
Import('env')
Import('env_drivers')
env_png = env.Clone()
png_sources = [
"png/png.c",
"png/pngerror.c",
"png/pngget.c",
"png/pngmem.c",
"png/pngpread.c",
"png/pngread.c",
"png/pngrio.c",
"png/pngrtran.c",
"png/pngrutil.c",
"png/pngset.c",
"png/pngtrans.c",
"png/pngwio.c",
"png/pngwrite.c",
"png/pngwtran.c",
"png/pngwutil.c",
"png/resource_saver_png.cpp",
"png/image_loader_png.cpp"
]
# Thirdparty source files
if (env["libpng"] == "builtin"):
thirdparty_dir = "#thirdparty/libpng/"
thirdparty_sources = [
"png.c",
"pngerror.c",
"pngget.c",
"pngmem.c",
"pngpread.c",
"pngread.c",
"pngrio.c",
"pngrtran.c",
"pngrutil.c",
"pngset.c",
"pngtrans.c",
"pngwio.c",
"pngwrite.c",
"pngwtran.c",
"pngwutil.c",
]
thirdparty_sources = [thirdparty_dir + file for file in thirdparty_sources]
# Currently .ASM filter_neon.S does not compile on NT.
import os
if ("neon_enabled" in env and env["neon_enabled"]) and os.name!="nt":
env_drivers.Append(CPPFLAGS=["-DPNG_ARM_NEON_OPT=2"])
env_neon = env_drivers.Clone();
if "S_compiler" in env:
env_neon['CC'] = env['S_compiler']
#env_neon.Append(CPPFLAGS=["-DPNG_ARM_NEON"])
png_sources.append(env_neon.Object("#drivers/png/arm/arm_init.c"))
png_sources.append(env_neon.Object("#drivers/png/arm/filter_neon.S"))
else:
env_drivers.Append(CPPFLAGS=["-DPNG_ARM_NEON_OPT=0"])
env_png.add_source_files(env.drivers_sources, thirdparty_sources)
env_png.Append(CPPPATH = [thirdparty_dir])
env.drivers_sources+=png_sources
# Currently .ASM filter_neon.S does not compile on NT.
import os
if ("neon_enabled" in env and env["neon_enabled"]) and os.name!="nt":
env_png.Append(CPPFLAGS = ["-DPNG_ARM_NEON_OPT=2"])
env_neon = env_png.Clone();
if "S_compiler" in env:
env_neon['CC'] = env['S_compiler']
neon_sources = []
neon_sources.append(env_neon.Object(thirdparty_dir + "/arm/arm_init.c"))
neon_sources.append(env_neon.Object(thirdparty_dir + "/arm/filter_neon_intrinsics.c"))
neon_sources.append(env_neon.Object(thirdparty_dir + "/arm/filter_neon.S"))
env.drivers_sources += neon_sources
else:
env_png.Append(CPPFLAGS = ["-DPNG_ARM_NEON_OPT=0"])
#env.add_source_files(env.drivers_sources, png_sources)
# Godot source files
env_png.add_source_files(env.drivers_sources, "*.cpp")
Export('env')

View file

@ -30,6 +30,7 @@
#include "print_string.h"
#include "os/os.h"
#include <string.h>

View file

@ -30,7 +30,8 @@
#define IMAGE_LOADER_PNG_H
#include "io/image_loader.h"
#include "drivers/png/png.h"
#include <png.h>
/**
@author Juan Linietsky <reduzio@gmail.com>

View file

@ -27,11 +27,13 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
#include "resource_saver_png.h"
#include "scene/resources/texture.h"
#include "drivers/png/png.h"
#include "os/file_access.h"
#include "globals.h"
#include "core/image.h"
#include "globals.h"
#include "os/file_access.h"
#include "scene/resources/texture.h"
#include <png.h>
static void _write_png_data(png_structp png_ptr,png_bytep data, png_size_t p_length) {

View file

@ -1,10 +0,0 @@
Import('env')
pnm_sources = [
"pnm/bitmap_loader_pnm.cpp"
]
env.drivers_sources+=pnm_sources
#env.add_source_files(env.drivers_sources, pnm_sources)

View file

@ -1,5 +1,5 @@
Import('env')
env.add_source_files(env.drivers_sources,"*.cpp")
env.add_source_files(env.drivers_sources, "*.cpp")
Export('env')

View file

@ -1,15 +0,0 @@
Import('env')
pvr_sources = [
"pvr/BitScale.cpp",
"pvr/MortonTable.cpp",
"pvr/PvrTcDecoder.cpp",
"pvr/PvrTcEncoder.cpp",
"pvr/PvrTcPacket.cpp",
"pvr/texture_loader_pvr.cpp"
]
env.drivers_sources+=pvr_sources
#env.add_source_files(env.drivers_sources, pvr_sources)

View file

@ -28,21 +28,9 @@
/*************************************************************************/
#include "register_driver_types.h"
#include "core/math/geometry.h"
#include "png/image_loader_png.h"
#include "webp/image_loader_webp.h"
#include "png/resource_saver_png.h"
#include "jpegd/image_loader_jpegd.h"
#include "dds/texture_loader_dds.h"
#include "etc1/texture_loader_pkm.h"
#include "pvr/texture_loader_pvr.h"
#include "etc1/image_etc.h"
#include "chibi/event_stream_chibi.h"
#include "pnm/bitmap_loader_pnm.h"
#ifdef TOOLS_ENABLED
#include "squish/image_compress_squish.h"
#endif
#ifdef TOOLS_ENABLED
#include "convex_decomp/b2d_decompose.h"
@ -52,258 +40,38 @@
#include "platform/windows/export/export.h"
#endif
#ifdef TREMOR_ENABLED
#include "teora/audio_stream_ogg.h"
#endif
#ifdef VORBIS_ENABLED
#include "vorbis/audio_stream_ogg_vorbis.h"
#endif
#ifdef OPUS_ENABLED
#include "opus/audio_stream_opus.h"
#endif
#ifdef THEORA_ENABLED
#include "theora/video_stream_theora.h"
#endif
#include "drivers/nrex/regex.h"
#ifdef MUSEPACK_ENABLED
#include "mpc/audio_stream_mpc.h"
#endif
#ifdef PNG_ENABLED
static ImageLoaderPNG *image_loader_png=NULL;
static ResourceSaverPNG *resource_saver_png=NULL;
#endif
#ifdef WEBP_ENABLED
static ImageLoaderWEBP *image_loader_webp=NULL;
//static ResourceSaverPNG *resource_saver_png=NULL;
#endif
#ifdef JPG_ENABLED
static ImageLoaderJPG *image_loader_jpg=NULL;
#endif
#ifdef DDS_ENABLED
static ResourceFormatDDS *resource_loader_dds=NULL;
#endif
#ifdef ETC1_ENABLED
static ResourceFormatPKM *resource_loader_pkm=NULL;
#endif
#ifdef PVR_ENABLED
static ResourceFormatPVR *resource_loader_pvr=NULL;
#endif
#ifdef TREMOR_ENABLED
static ResourceFormatLoaderAudioStreamOGG *vorbis_stream_loader=NULL;
#endif
#ifdef VORBIS_ENABLED
static ResourceFormatLoaderAudioStreamOGGVorbis *vorbis_stream_loader=NULL;
#endif
#ifdef OPUS_ENABLED
static ResourceFormatLoaderAudioStreamOpus *opus_stream_loader=NULL;
#endif
#ifdef THEORA_ENABLED
static ResourceFormatLoaderVideoStreamTheora* theora_stream_loader = NULL;
#endif
#ifdef MUSEPACK_ENABLED
static ResourceFormatLoaderAudioStreamMPC * mpc_stream_loader=NULL;
#endif
#ifdef OPENSSL_ENABLED
#include "openssl/register_openssl.h"
#endif
static ResourceFormatPBM * pbm_loader=NULL;
void register_core_driver_types() {
#ifdef PNG_ENABLED
image_loader_png = memnew( ImageLoaderPNG );
ImageLoader::add_image_format_loader( image_loader_png );
resource_saver_png = memnew( ResourceSaverPNG );
ResourceSaver::add_resource_format_saver(resource_saver_png);
#endif
#ifdef WEBP_ENABLED
image_loader_webp = memnew( ImageLoaderWEBP );
ImageLoader::add_image_format_loader( image_loader_webp );
// resource_saver_png = memnew( ResourceSaverPNG );
// ResourceSaver::add_resource_format_saver(resource_saver_png);
#endif
#ifdef JPG_ENABLED
image_loader_jpg = memnew( ImageLoaderJPG );
ImageLoader::add_image_format_loader( image_loader_jpg );
#endif
pbm_loader = memnew( ResourceFormatPBM );
ResourceLoader::add_resource_format_loader(pbm_loader);
ObjectTypeDB::register_type<RegEx>();
}
void unregister_core_driver_types() {
#ifdef PNG_ENABLED
if (image_loader_png)
memdelete( image_loader_png );
if (resource_saver_png)
memdelete( resource_saver_png );
#endif
#ifdef WEBP_ENABLED
if (image_loader_webp)
memdelete( image_loader_webp );
// if (resource_saver_png)
// memdelete( resource_saver_png );
#endif
#ifdef JPG_ENABLED
if (image_loader_jpg)
memdelete( image_loader_jpg );
#endif
memdelete( pbm_loader );
}
void register_driver_types() {
#ifdef TREMOR_ENABLED
vorbis_stream_loader=memnew( ResourceFormatLoaderAudioStreamOGG );
ResourceLoader::add_resource_format_loader(vorbis_stream_loader );
ObjectTypeDB::register_type<AudioStreamOGG>();
#endif
#ifdef VORBIS_ENABLED
vorbis_stream_loader=memnew( ResourceFormatLoaderAudioStreamOGGVorbis );
ResourceLoader::add_resource_format_loader(vorbis_stream_loader );
ObjectTypeDB::register_type<AudioStreamOGGVorbis>();
#endif
#ifdef OPUS_ENABLED
opus_stream_loader=memnew( ResourceFormatLoaderAudioStreamOpus );
ResourceLoader::add_resource_format_loader( opus_stream_loader );
ObjectTypeDB::register_type<AudioStreamOpus>();
#endif
#ifdef DDS_ENABLED
resource_loader_dds = memnew( ResourceFormatDDS );
ResourceLoader::add_resource_format_loader(resource_loader_dds );
#endif
#ifdef ETC1_ENABLED
resource_loader_pkm = memnew( ResourceFormatPKM );
ResourceLoader::add_resource_format_loader(resource_loader_pkm);
#endif
#ifdef PVR_ENABLED
resource_loader_pvr = memnew( ResourceFormatPVR );
ResourceLoader::add_resource_format_loader(resource_loader_pvr );
#endif
#ifdef TOOLS_ENABLED
Geometry::_decompose_func=b2d_decompose;
#endif
#ifdef MUSEPACK_ENABLED
mpc_stream_loader=memnew( ResourceFormatLoaderAudioStreamMPC );
ResourceLoader::add_resource_format_loader(mpc_stream_loader);
ObjectTypeDB::register_type<AudioStreamMPC>();
#endif
#ifdef OPENSSL_ENABLED
register_openssl();
#endif
#ifdef THEORA_ENABLED
theora_stream_loader = memnew( ResourceFormatLoaderVideoStreamTheora );
ResourceLoader::add_resource_format_loader(theora_stream_loader);
ObjectTypeDB::register_type<VideoStreamTheora>();
#endif
#ifdef TOOLS_ENABLED
#ifdef SQUISH_ENABLED
Image::set_compress_bc_func(image_compress_squish);
#endif
#endif
#ifdef ETC1_ENABLED
_register_etc1_compress_func();
#endif
initialize_chibi();
}
void unregister_driver_types() {
#ifdef TREMOR_ENABLED
memdelete( vorbis_stream_loader );
#endif
#ifdef VORBIS_ENABLED
memdelete( vorbis_stream_loader );
#endif
#ifdef OPUS_ENABLED
memdelete( opus_stream_loader );
#endif
#ifdef THEORA_ENABLED
memdelete (theora_stream_loader);
#endif
#ifdef MUSEPACK_ENABLED
memdelete (mpc_stream_loader);
#endif
#ifdef DDS_ENABLED
memdelete(resource_loader_dds);
#endif
#ifdef ETC1_ENABLED
memdelete(resource_loader_pkm);
#endif
#ifdef PVR_ENABLED
memdelete(resource_loader_pvr);
#endif
#ifdef OPENSSL_ENABLED
unregister_openssl();
#endif
finalize_chibi();
}

View file

@ -1,4 +1,18 @@
Import('env')
Export('env');
env.add_source_files(env.drivers_sources,"*.cpp")
# Not cloning the env, the includes need to be accessible for platform/
# Thirdparty source files
thirdparty_dir = "#thirdparty/rtaudio/"
thirdparty_sources = [
"RtAudio.cpp",
]
thirdparty_sources = [thirdparty_dir + file for file in thirdparty_sources]
env.add_source_files(env.drivers_sources, thirdparty_sources)
env.Append(CPPPATH = [thirdparty_dir])
# Driver source files
env.add_source_files(env.drivers_sources, "*.cpp")
Export('env')

View file

@ -27,8 +27,10 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
#include "audio_driver_rtaudio.h"
#include "globals.h"
#include "os/os.h"
#ifdef RTAUDIO_ENABLED
const char* AudioDriverRtAudio::get_name() const {

View file

@ -32,7 +32,8 @@
#ifdef RTAUDIO_ENABLED
#include "servers/audio/audio_server_sw.h"
#include "drivers/rtaudio/RtAudio.h"
#include <RtAudio.h>
class AudioDriverRtAudio : public AudioDriverSW {

View file

@ -1,23 +0,0 @@
Import('env')
squish_sources=[
'squish/alpha.cpp',
'squish/clusterfit.cpp',
'squish/colourblock.cpp',
'squish/colourfit.cpp',
'squish/colourset.cpp',
'squish/maths.cpp',
'squish/rangefit.cpp',
'squish/singlecolourfit.cpp',
'squish/squish.cpp',
'squish/image_compress_squish.cpp',
]
if (env["tools"]=="yes"):
env.drivers_sources+=squish_sources
#env.add_source_files(env.drivers_sources, squish_sources)
Export('env')

View file

@ -1,348 +0,0 @@
/* -----------------------------------------------------------------------------
Copyright (c) 2006 Simon Brown si@sjbrown.co.uk
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be included
in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-------------------------------------------------------------------------- */
#include "alpha.h"
#include <algorithm>
namespace squish {
static int FloatToInt( float a, int limit )
{
// use ANSI round-to-zero behaviour to get round-to-nearest
int i = ( int )( a + 0.5f );
// clamp to the limit
if( i < 0 )
i = 0;
else if( i > limit )
i = limit;
// done
return i;
}
void CompressAlphaDxt3( u8 const* rgba, int mask, void* block )
{
u8* bytes = reinterpret_cast< u8* >( block );
// quantise and pack the alpha values pairwise
for( int i = 0; i < 8; ++i )
{
// quantise down to 4 bits
float alpha1 = ( float )rgba[8*i + 3] * ( 15.0f/255.0f );
float alpha2 = ( float )rgba[8*i + 7] * ( 15.0f/255.0f );
int quant1 = FloatToInt( alpha1, 15 );
int quant2 = FloatToInt( alpha2, 15 );
// set alpha to zero where masked
int bit1 = 1 << ( 2*i );
int bit2 = 1 << ( 2*i + 1 );
if( ( mask & bit1 ) == 0 )
quant1 = 0;
if( ( mask & bit2 ) == 0 )
quant2 = 0;
// pack into the byte
bytes[i] = ( u8 )( quant1 | ( quant2 << 4 ) );
}
}
void DecompressAlphaDxt3( u8* rgba, void const* block )
{
u8 const* bytes = reinterpret_cast< u8 const* >( block );
// unpack the alpha values pairwise
for( int i = 0; i < 8; ++i )
{
// quantise down to 4 bits
u8 quant = bytes[i];
// unpack the values
u8 lo = quant & 0x0f;
u8 hi = quant & 0xf0;
// convert back up to bytes
rgba[8*i + 3] = lo | ( lo << 4 );
rgba[8*i + 7] = hi | ( hi >> 4 );
}
}
static void FixRange( int& min, int& max, int steps )
{
if( max - min < steps )
max = std::min( min + steps, 255 );
if( max - min < steps )
min = std::max( 0, max - steps );
}
static int FitCodes( u8 const* rgba, int mask, u8 const* codes, u8* indices )
{
// fit each alpha value to the codebook
int err = 0;
for( int i = 0; i < 16; ++i )
{
// check this pixel is valid
int bit = 1 << i;
if( ( mask & bit ) == 0 )
{
// use the first code
indices[i] = 0;
continue;
}
// find the least error and corresponding index
int value = rgba[4*i + 3];
int least = 2147483647; //INT_MAX
int index = 0;
for( int j = 0; j < 8; ++j )
{
// get the squared error from this code
int dist = ( int )value - ( int )codes[j];
dist *= dist;
// compare with the best so far
if( dist < least )
{
least = dist;
index = j;
}
}
// save this index and accumulate the error
indices[i] = ( u8 )index;
err += least;
}
// return the total error
return err;
}
static void WriteAlphaBlock( int alpha0, int alpha1, u8 const* indices, void* block )
{
u8* bytes = reinterpret_cast< u8* >( block );
// write the first two bytes
bytes[0] = ( u8 )alpha0;
bytes[1] = ( u8 )alpha1;
// pack the indices with 3 bits each
u8* dest = bytes + 2;
u8 const* src = indices;
for( int i = 0; i < 2; ++i )
{
// pack 8 3-bit values
int value = 0;
for( int j = 0; j < 8; ++j )
{
int index = *src++;
value |= ( index << 3*j );
}
// store in 3 bytes
for( int j = 0; j < 3; ++j )
{
int byte = ( value >> 8*j ) & 0xff;
*dest++ = ( u8 )byte;
}
}
}
static void WriteAlphaBlock5( int alpha0, int alpha1, u8 const* indices, void* block )
{
// check the relative values of the endpoints
if( alpha0 > alpha1 )
{
// swap the indices
u8 swapped[16];
for( int i = 0; i < 16; ++i )
{
u8 index = indices[i];
if( index == 0 )
swapped[i] = 1;
else if( index == 1 )
swapped[i] = 0;
else if( index <= 5 )
swapped[i] = 7 - index;
else
swapped[i] = index;
}
// write the block
WriteAlphaBlock( alpha1, alpha0, swapped, block );
}
else
{
// write the block
WriteAlphaBlock( alpha0, alpha1, indices, block );
}
}
static void WriteAlphaBlock7( int alpha0, int alpha1, u8 const* indices, void* block )
{
// check the relative values of the endpoints
if( alpha0 < alpha1 )
{
// swap the indices
u8 swapped[16];
for( int i = 0; i < 16; ++i )
{
u8 index = indices[i];
if( index == 0 )
swapped[i] = 1;
else if( index == 1 )
swapped[i] = 0;
else
swapped[i] = 9 - index;
}
// write the block
WriteAlphaBlock( alpha1, alpha0, swapped, block );
}
else
{
// write the block
WriteAlphaBlock( alpha0, alpha1, indices, block );
}
}
void CompressAlphaDxt5( u8 const* rgba, int mask, void* block )
{
// get the range for 5-alpha and 7-alpha interpolation
int min5 = 255;
int max5 = 0;
int min7 = 255;
int max7 = 0;
for( int i = 0; i < 16; ++i )
{
// check this pixel is valid
int bit = 1 << i;
if( ( mask & bit ) == 0 )
continue;
// incorporate into the min/max
int value = rgba[4*i + 3];
if( value < min7 )
min7 = value;
if( value > max7 )
max7 = value;
if( value != 0 && value < min5 )
min5 = value;
if( value != 255 && value > max5 )
max5 = value;
}
// handle the case that no valid range was found
if( min5 > max5 )
min5 = max5;
if( min7 > max7 )
min7 = max7;
// fix the range to be the minimum in each case
FixRange( min5, max5, 5 );
FixRange( min7, max7, 7 );
// set up the 5-alpha code book
u8 codes5[8];
codes5[0] = ( u8 )min5;
codes5[1] = ( u8 )max5;
for( int i = 1; i < 5; ++i )
codes5[1 + i] = ( u8 )( ( ( 5 - i )*min5 + i*max5 )/5 );
codes5[6] = 0;
codes5[7] = 255;
// set up the 7-alpha code book
u8 codes7[8];
codes7[0] = ( u8 )min7;
codes7[1] = ( u8 )max7;
for( int i = 1; i < 7; ++i )
codes7[1 + i] = ( u8 )( ( ( 7 - i )*min7 + i*max7 )/7 );
// fit the data to both code books
u8 indices5[16];
u8 indices7[16];
int err5 = FitCodes( rgba, mask, codes5, indices5 );
int err7 = FitCodes( rgba, mask, codes7, indices7 );
// save the block with least error
if( err5 <= err7 )
WriteAlphaBlock5( min5, max5, indices5, block );
else
WriteAlphaBlock7( min7, max7, indices7, block );
}
void DecompressAlphaDxt5( u8* rgba, void const* block )
{
// get the two alpha values
u8 const* bytes = reinterpret_cast< u8 const* >( block );
int alpha0 = bytes[0];
int alpha1 = bytes[1];
// compare the values to build the codebook
u8 codes[8];
codes[0] = ( u8 )alpha0;
codes[1] = ( u8 )alpha1;
if( alpha0 <= alpha1 )
{
// use 5-alpha codebook
for( int i = 1; i < 5; ++i )
codes[1 + i] = ( u8 )( ( ( 5 - i )*alpha0 + i*alpha1 )/5 );
codes[6] = 0;
codes[7] = 255;
}
else
{
// use 7-alpha codebook
for( int i = 1; i < 7; ++i )
codes[1 + i] = ( u8 )( ( ( 7 - i )*alpha0 + i*alpha1 )/7 );
}
// decode the indices
u8 indices[16];
u8 const* src = bytes + 2;
u8* dest = indices;
for( int i = 0; i < 2; ++i )
{
// grab 3 bytes
int value = 0;
for( int j = 0; j < 3; ++j )
{
int byte = *src++;
value |= ( byte << 8*j );
}
// unpack 8 3-bit values from it
for( int j = 0; j < 8; ++j )
{
int index = ( value >> 3*j ) & 0x7;
*dest++ = ( u8 )index;
}
}
// write out the indexed codebook values
for( int i = 0; i < 16; ++i )
rgba[4*i + 3] = codes[indices[i]];
}
} // namespace squish

View file

@ -1,41 +0,0 @@
/* -----------------------------------------------------------------------------
Copyright (c) 2006 Simon Brown si@sjbrown.co.uk
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be included
in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-------------------------------------------------------------------------- */
#ifndef SQUISH_ALPHA_H
#define SQUISH_ALPHA_H
#include "squish/squish.h"
namespace squish {
void CompressAlphaDxt3( u8 const* rgba, int mask, void* block );
void CompressAlphaDxt5( u8 const* rgba, int mask, void* block );
void DecompressAlphaDxt3( u8* rgba, void const* block );
void DecompressAlphaDxt5( u8* rgba, void const* block );
} // namespace squish
#endif // ndef SQUISH_ALPHA_H

View file

@ -1,393 +0,0 @@
/* -----------------------------------------------------------------------------
Copyright (c) 2006 Simon Brown si@sjbrown.co.uk
Copyright (c) 2007 Ignacio Castano icastano@nvidia.com
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be included
in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-------------------------------------------------------------------------- */
#include "clusterfit.h"
#include "colourset.h"
#include "colourblock.h"
#include <cfloat>
namespace squish {
ClusterFit::ClusterFit( ColourSet const* colours, int flags )
: ColourFit( colours, flags )
{
// set the iteration count
m_iterationCount = ( m_flags & kColourIterativeClusterFit ) ? kMaxIterations : 1;
// initialise the best error
m_besterror = VEC4_CONST( FLT_MAX );
// initialise the metric
bool perceptual = ( ( m_flags & kColourMetricPerceptual ) != 0 );
if( perceptual )
m_metric = Vec4( 0.2126f, 0.7152f, 0.0722f, 0.0f );
else
m_metric = VEC4_CONST( 1.0f );
// cache some values
int const count = m_colours->GetCount();
Vec3 const* values = m_colours->GetPoints();
// get the covariance matrix
Sym3x3 covariance = ComputeWeightedCovariance( count, values, m_colours->GetWeights() );
// compute the principle component
m_principle = ComputePrincipleComponent( covariance );
}
bool ClusterFit::ConstructOrdering( Vec3 const& axis, int iteration )
{
// cache some values
int const count = m_colours->GetCount();
Vec3 const* values = m_colours->GetPoints();
// build the list of dot products
float dps[16];
u8* order = ( u8* )m_order + 16*iteration;
for( int i = 0; i < count; ++i )
{
dps[i] = Dot( values[i], axis );
order[i] = ( u8 )i;
}
// stable sort using them
for( int i = 0; i < count; ++i )
{
for( int j = i; j > 0 && dps[j] < dps[j - 1]; --j )
{
std::swap( dps[j], dps[j - 1] );
std::swap( order[j], order[j - 1] );
}
}
// check this ordering is unique
for( int it = 0; it < iteration; ++it )
{
u8 const* prev = ( u8* )m_order + 16*it;
bool same = true;
for( int i = 0; i < count; ++i )
{
if( order[i] != prev[i] )
{
same = false;
break;
}
}
if( same )
return false;
}
// copy the ordering and weight all the points
Vec3 const* unweighted = m_colours->GetPoints();
float const* weights = m_colours->GetWeights();
m_xsum_wsum = VEC4_CONST( 0.0f );
for( int i = 0; i < count; ++i )
{
int j = order[i];
Vec4 p( unweighted[j].X(), unweighted[j].Y(), unweighted[j].Z(), 1.0f );
Vec4 w( weights[j] );
Vec4 x = p*w;
m_points_weights[i] = x;
m_xsum_wsum += x;
}
return true;
}
void ClusterFit::Compress3( void* block )
{
// declare variables
int const count = m_colours->GetCount();
Vec4 const two = VEC4_CONST( 2.0 );
Vec4 const one = VEC4_CONST( 1.0f );
Vec4 const half_half2( 0.5f, 0.5f, 0.5f, 0.25f );
Vec4 const zero = VEC4_CONST( 0.0f );
Vec4 const half = VEC4_CONST( 0.5f );
Vec4 const grid( 31.0f, 63.0f, 31.0f, 0.0f );
Vec4 const gridrcp( 1.0f/31.0f, 1.0f/63.0f, 1.0f/31.0f, 0.0f );
// prepare an ordering using the principle axis
ConstructOrdering( m_principle, 0 );
// check all possible clusters and iterate on the total order
Vec4 beststart = VEC4_CONST( 0.0f );
Vec4 bestend = VEC4_CONST( 0.0f );
Vec4 besterror = m_besterror;
u8 bestindices[16];
int bestiteration = 0;
int besti = 0, bestj = 0;
// loop over iterations (we avoid the case that all points in first or last cluster)
for( int iterationIndex = 0;; )
{
// first cluster [0,i) is at the start
Vec4 part0 = VEC4_CONST( 0.0f );
for( int i = 0; i < count; ++i )
{
// second cluster [i,j) is half along
Vec4 part1 = ( i == 0 ) ? m_points_weights[0] : VEC4_CONST( 0.0f );
int jmin = ( i == 0 ) ? 1 : i;
for( int j = jmin;; )
{
// last cluster [j,count) is at the end
Vec4 part2 = m_xsum_wsum - part1 - part0;
// compute least squares terms directly
Vec4 alphax_sum = MultiplyAdd( part1, half_half2, part0 );
Vec4 alpha2_sum = alphax_sum.SplatW();
Vec4 betax_sum = MultiplyAdd( part1, half_half2, part2 );
Vec4 beta2_sum = betax_sum.SplatW();
Vec4 alphabeta_sum = ( part1*half_half2 ).SplatW();
// compute the least-squares optimal points
Vec4 factor = Reciprocal( NegativeMultiplySubtract( alphabeta_sum, alphabeta_sum, alpha2_sum*beta2_sum ) );
Vec4 a = NegativeMultiplySubtract( betax_sum, alphabeta_sum, alphax_sum*beta2_sum )*factor;
Vec4 b = NegativeMultiplySubtract( alphax_sum, alphabeta_sum, betax_sum*alpha2_sum )*factor;
// clamp to the grid
a = Min( one, Max( zero, a ) );
b = Min( one, Max( zero, b ) );
a = Truncate( MultiplyAdd( grid, a, half ) )*gridrcp;
b = Truncate( MultiplyAdd( grid, b, half ) )*gridrcp;
// compute the error (we skip the constant xxsum)
Vec4 e1 = MultiplyAdd( a*a, alpha2_sum, b*b*beta2_sum );
Vec4 e2 = NegativeMultiplySubtract( a, alphax_sum, a*b*alphabeta_sum );
Vec4 e3 = NegativeMultiplySubtract( b, betax_sum, e2 );
Vec4 e4 = MultiplyAdd( two, e3, e1 );
// apply the metric to the error term
Vec4 e5 = e4*m_metric;
Vec4 error = e5.SplatX() + e5.SplatY() + e5.SplatZ();
// keep the solution if it wins
if( CompareAnyLessThan( error, besterror ) )
{
beststart = a;
bestend = b;
besti = i;
bestj = j;
besterror = error;
bestiteration = iterationIndex;
}
// advance
if( j == count )
break;
part1 += m_points_weights[j];
++j;
}
// advance
part0 += m_points_weights[i];
}
// stop if we didn't improve in this iteration
if( bestiteration != iterationIndex )
break;
// advance if possible
++iterationIndex;
if( iterationIndex == m_iterationCount )
break;
// stop if a new iteration is an ordering that has already been tried
Vec3 axis = ( bestend - beststart ).GetVec3();
if( !ConstructOrdering( axis, iterationIndex ) )
break;
}
// save the block if necessary
if( CompareAnyLessThan( besterror, m_besterror ) )
{
// remap the indices
u8 const* order = ( u8* )m_order + 16*bestiteration;
u8 unordered[16];
for( int m = 0; m < besti; ++m )
unordered[order[m]] = 0;
for( int m = besti; m < bestj; ++m )
unordered[order[m]] = 2;
for( int m = bestj; m < count; ++m )
unordered[order[m]] = 1;
m_colours->RemapIndices( unordered, bestindices );
// save the block
WriteColourBlock3( beststart.GetVec3(), bestend.GetVec3(), bestindices, block );
// save the error
m_besterror = besterror;
}
}
void ClusterFit::Compress4( void* block )
{
// declare variables
int const count = m_colours->GetCount();
Vec4 const two = VEC4_CONST( 2.0f );
Vec4 const one = VEC4_CONST( 1.0f );
Vec4 const onethird_onethird2( 1.0f/3.0f, 1.0f/3.0f, 1.0f/3.0f, 1.0f/9.0f );
Vec4 const twothirds_twothirds2( 2.0f/3.0f, 2.0f/3.0f, 2.0f/3.0f, 4.0f/9.0f );
Vec4 const twonineths = VEC4_CONST( 2.0f/9.0f );
Vec4 const zero = VEC4_CONST( 0.0f );
Vec4 const half = VEC4_CONST( 0.5f );
Vec4 const grid( 31.0f, 63.0f, 31.0f, 0.0f );
Vec4 const gridrcp( 1.0f/31.0f, 1.0f/63.0f, 1.0f/31.0f, 0.0f );
// prepare an ordering using the principle axis
ConstructOrdering( m_principle, 0 );
// check all possible clusters and iterate on the total order
Vec4 beststart = VEC4_CONST( 0.0f );
Vec4 bestend = VEC4_CONST( 0.0f );
Vec4 besterror = m_besterror;
u8 bestindices[16];
int bestiteration = 0;
int besti = 0, bestj = 0, bestk = 0;
// loop over iterations (we avoid the case that all points in first or last cluster)
for( int iterationIndex = 0;; )
{
// first cluster [0,i) is at the start
Vec4 part0 = VEC4_CONST( 0.0f );
for( int i = 0; i < count; ++i )
{
// second cluster [i,j) is one third along
Vec4 part1 = VEC4_CONST( 0.0f );
for( int j = i;; )
{
// third cluster [j,k) is two thirds along
Vec4 part2 = ( j == 0 ) ? m_points_weights[0] : VEC4_CONST( 0.0f );
int kmin = ( j == 0 ) ? 1 : j;
for( int k = kmin;; )
{
// last cluster [k,count) is at the end
Vec4 part3 = m_xsum_wsum - part2 - part1 - part0;
// compute least squares terms directly
Vec4 const alphax_sum = MultiplyAdd( part2, onethird_onethird2, MultiplyAdd( part1, twothirds_twothirds2, part0 ) );
Vec4 const alpha2_sum = alphax_sum.SplatW();
Vec4 const betax_sum = MultiplyAdd( part1, onethird_onethird2, MultiplyAdd( part2, twothirds_twothirds2, part3 ) );
Vec4 const beta2_sum = betax_sum.SplatW();
Vec4 const alphabeta_sum = twonineths*( part1 + part2 ).SplatW();
// compute the least-squares optimal points
Vec4 factor = Reciprocal( NegativeMultiplySubtract( alphabeta_sum, alphabeta_sum, alpha2_sum*beta2_sum ) );
Vec4 a = NegativeMultiplySubtract( betax_sum, alphabeta_sum, alphax_sum*beta2_sum )*factor;
Vec4 b = NegativeMultiplySubtract( alphax_sum, alphabeta_sum, betax_sum*alpha2_sum )*factor;
// clamp to the grid
a = Min( one, Max( zero, a ) );
b = Min( one, Max( zero, b ) );
a = Truncate( MultiplyAdd( grid, a, half ) )*gridrcp;
b = Truncate( MultiplyAdd( grid, b, half ) )*gridrcp;
// compute the error (we skip the constant xxsum)
Vec4 e1 = MultiplyAdd( a*a, alpha2_sum, b*b*beta2_sum );
Vec4 e2 = NegativeMultiplySubtract( a, alphax_sum, a*b*alphabeta_sum );
Vec4 e3 = NegativeMultiplySubtract( b, betax_sum, e2 );
Vec4 e4 = MultiplyAdd( two, e3, e1 );
// apply the metric to the error term
Vec4 e5 = e4*m_metric;
Vec4 error = e5.SplatX() + e5.SplatY() + e5.SplatZ();
// keep the solution if it wins
if( CompareAnyLessThan( error, besterror ) )
{
beststart = a;
bestend = b;
besterror = error;
besti = i;
bestj = j;
bestk = k;
bestiteration = iterationIndex;
}
// advance
if( k == count )
break;
part2 += m_points_weights[k];
++k;
}
// advance
if( j == count )
break;
part1 += m_points_weights[j];
++j;
}
// advance
part0 += m_points_weights[i];
}
// stop if we didn't improve in this iteration
if( bestiteration != iterationIndex )
break;
// advance if possible
++iterationIndex;
if( iterationIndex == m_iterationCount )
break;
// stop if a new iteration is an ordering that has already been tried
Vec3 axis = ( bestend - beststart ).GetVec3();
if( !ConstructOrdering( axis, iterationIndex ) )
break;
}
// save the block if necessary
if( CompareAnyLessThan( besterror, m_besterror ) )
{
// remap the indices
u8 const* order = ( u8* )m_order + 16*bestiteration;
u8 unordered[16];
for( int m = 0; m < besti; ++m )
unordered[order[m]] = 0;
for( int m = besti; m < bestj; ++m )
unordered[order[m]] = 2;
for( int m = bestj; m < bestk; ++m )
unordered[order[m]] = 3;
for( int m = bestk; m < count; ++m )
unordered[order[m]] = 1;
m_colours->RemapIndices( unordered, bestindices );
// save the block
WriteColourBlock4( beststart.GetVec3(), bestend.GetVec3(), bestindices, block );
// save the error
m_besterror = besterror;
}
}
} // namespace squish

View file

@ -1,61 +0,0 @@
/* -----------------------------------------------------------------------------
Copyright (c) 2006 Simon Brown si@sjbrown.co.uk
Copyright (c) 2007 Ignacio Castano icastano@nvidia.com
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be included
in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-------------------------------------------------------------------------- */
#ifndef SQUISH_CLUSTERFIT_H
#define SQUISH_CLUSTERFIT_H
#include "squish/squish.h"
#include "maths.h"
#include "simd.h"
#include "colourfit.h"
namespace squish {
class ClusterFit : public ColourFit
{
public:
ClusterFit( ColourSet const* colours, int flags );
private:
bool ConstructOrdering( Vec3 const& axis, int iteration );
virtual void Compress3( void* block );
virtual void Compress4( void* block );
enum { kMaxIterations = 8 };
int m_iterationCount;
Vec3 m_principle;
u8 m_order[16*kMaxIterations];
Vec4 m_points_weights[16];
Vec4 m_xsum_wsum;
Vec4 m_metric;
Vec4 m_besterror;
};
} // namespace squish
#endif // ndef SQUISH_CLUSTERFIT_H

View file

@ -1,214 +0,0 @@
/* -----------------------------------------------------------------------------
Copyright (c) 2006 Simon Brown si@sjbrown.co.uk
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be included
in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-------------------------------------------------------------------------- */
#include "colourblock.h"
namespace squish {
static int FloatToInt( float a, int limit )
{
// use ANSI round-to-zero behaviour to get round-to-nearest
int i = ( int )( a + 0.5f );
// clamp to the limit
if( i < 0 )
i = 0;
else if( i > limit )
i = limit;
// done
return i;
}
static int FloatTo565( Vec3::Arg colour )
{
// get the components in the correct range
int r = FloatToInt( 31.0f*colour.X(), 31 );
int g = FloatToInt( 63.0f*colour.Y(), 63 );
int b = FloatToInt( 31.0f*colour.Z(), 31 );
// pack into a single value
return ( r << 11 ) | ( g << 5 ) | b;
}
static void WriteColourBlock( int a, int b, u8* indices, void* block )
{
// get the block as bytes
u8* bytes = ( u8* )block;
// write the endpoints
bytes[0] = ( u8 )( a & 0xff );
bytes[1] = ( u8 )( a >> 8 );
bytes[2] = ( u8 )( b & 0xff );
bytes[3] = ( u8 )( b >> 8 );
// write the indices
for( int i = 0; i < 4; ++i )
{
u8 const* ind = indices + 4*i;
bytes[4 + i] = ind[0] | ( ind[1] << 2 ) | ( ind[2] << 4 ) | ( ind[3] << 6 );
}
}
void WriteColourBlock3( Vec3::Arg start, Vec3::Arg end, u8 const* indices, void* block )
{
// get the packed values
int a = FloatTo565( start );
int b = FloatTo565( end );
// remap the indices
u8 remapped[16];
if( a <= b )
{
// use the indices directly
for( int i = 0; i < 16; ++i )
remapped[i] = indices[i];
}
else
{
// swap a and b
std::swap( a, b );
for( int i = 0; i < 16; ++i )
{
if( indices[i] == 0 )
remapped[i] = 1;
else if( indices[i] == 1 )
remapped[i] = 0;
else
remapped[i] = indices[i];
}
}
// write the block
WriteColourBlock( a, b, remapped, block );
}
void WriteColourBlock4( Vec3::Arg start, Vec3::Arg end, u8 const* indices, void* block )
{
// get the packed values
int a = FloatTo565( start );
int b = FloatTo565( end );
// remap the indices
u8 remapped[16];
if( a < b )
{
// swap a and b
std::swap( a, b );
for( int i = 0; i < 16; ++i )
remapped[i] = ( indices[i] ^ 0x1 ) & 0x3;
}
else if( a == b )
{
// use index 0
for( int i = 0; i < 16; ++i )
remapped[i] = 0;
}
else
{
// use the indices directly
for( int i = 0; i < 16; ++i )
remapped[i] = indices[i];
}
// write the block
WriteColourBlock( a, b, remapped, block );
}
static int Unpack565( u8 const* packed, u8* colour )
{
// build the packed value
int value = ( int )packed[0] | ( ( int )packed[1] << 8 );
// get the components in the stored range
u8 red = ( u8 )( ( value >> 11 ) & 0x1f );
u8 green = ( u8 )( ( value >> 5 ) & 0x3f );
u8 blue = ( u8 )( value & 0x1f );
// scale up to 8 bits
colour[0] = ( red << 3 ) | ( red >> 2 );
colour[1] = ( green << 2 ) | ( green >> 4 );
colour[2] = ( blue << 3 ) | ( blue >> 2 );
colour[3] = 255;
// return the value
return value;
}
void DecompressColour( u8* rgba, void const* block, bool isDxt1 )
{
// get the block bytes
u8 const* bytes = reinterpret_cast< u8 const* >( block );
// unpack the endpoints
u8 codes[16];
int a = Unpack565( bytes, codes );
int b = Unpack565( bytes + 2, codes + 4 );
// generate the midpoints
for( int i = 0; i < 3; ++i )
{
int c = codes[i];
int d = codes[4 + i];
if( isDxt1 && a <= b )
{
codes[8 + i] = ( u8 )( ( c + d )/2 );
codes[12 + i] = 0;
}
else
{
codes[8 + i] = ( u8 )( ( 2*c + d )/3 );
codes[12 + i] = ( u8 )( ( c + 2*d )/3 );
}
}
// fill in alpha for the intermediate values
codes[8 + 3] = 255;
codes[12 + 3] = ( isDxt1 && a <= b ) ? 0 : 255;
// unpack the indices
u8 indices[16];
for( int i = 0; i < 4; ++i )
{
u8* ind = indices + 4*i;
u8 packed = bytes[4 + i];
ind[0] = packed & 0x3;
ind[1] = ( packed >> 2 ) & 0x3;
ind[2] = ( packed >> 4 ) & 0x3;
ind[3] = ( packed >> 6 ) & 0x3;
}
// store out the colours
for( int i = 0; i < 16; ++i )
{
u8 offset = 4*indices[i];
for( int j = 0; j < 4; ++j )
rgba[4*i + j] = codes[offset + j];
}
}
} // namespace squish

View file

@ -1,41 +0,0 @@
/* -----------------------------------------------------------------------------
Copyright (c) 2006 Simon Brown si@sjbrown.co.uk
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be included
in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-------------------------------------------------------------------------- */
#ifndef SQUISH_COLOURBLOCK_H
#define SQUISH_COLOURBLOCK_H
#include "squish/squish.h"
#include "maths.h"
namespace squish {
void WriteColourBlock3( Vec3::Arg start, Vec3::Arg end, u8 const* indices, void* block );
void WriteColourBlock4( Vec3::Arg start, Vec3::Arg end, u8 const* indices, void* block );
void DecompressColour( u8* rgba, void const* block, bool isDxt1 );
} // namespace squish
#endif // ndef SQUISH_COLOURBLOCK_H

View file

@ -1,50 +0,0 @@
/* -----------------------------------------------------------------------------
Copyright (c) 2006 Simon Brown si@sjbrown.co.uk
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be included
in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-------------------------------------------------------------------------- */
#include "colourfit.h"
#include "colourset.h"
namespace squish {
ColourFit::ColourFit( ColourSet const* colours, int flags )
: m_colours( colours ),
m_flags( flags )
{
}
void ColourFit::Compress( void* block )
{
bool isDxt1 = ( ( m_flags & kDxt1 ) != 0 );
if( isDxt1 )
{
Compress3( block );
if( !m_colours->IsTransparent() )
Compress4( block );
}
else
Compress4( block );
}
} // namespace squish

View file

@ -1,53 +0,0 @@
/* -----------------------------------------------------------------------------
Copyright (c) 2006 Simon Brown si@sjbrown.co.uk
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be included
in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-------------------------------------------------------------------------- */
#ifndef SQUISH_COLOURFIT_H
#define SQUISH_COLOURFIT_H
#include "squish/squish.h"
#include "maths.h"
namespace squish {
class ColourSet;
class ColourFit
{
public:
ColourFit( ColourSet const* colours, int flags );
void Compress( void* block );
protected:
virtual void Compress3( void* block ) = 0;
virtual void Compress4( void* block ) = 0;
ColourSet const* m_colours;
int m_flags;
};
} // namespace squish
#endif // ndef SQUISH_COLOURFIT_H

View file

@ -1,121 +0,0 @@
/* -----------------------------------------------------------------------------
Copyright (c) 2006 Simon Brown si@sjbrown.co.uk
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be included
in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-------------------------------------------------------------------------- */
#include "colourset.h"
namespace squish {
ColourSet::ColourSet( u8 const* rgba, int mask, int flags )
: m_count( 0 ),
m_transparent( false )
{
// check the compression mode for dxt1
bool isDxt1 = ( ( flags & kDxt1 ) != 0 );
bool weightByAlpha = ( ( flags & kWeightColourByAlpha ) != 0 );
// create the minimal set
for( int i = 0; i < 16; ++i )
{
// check this pixel is enabled
int bit = 1 << i;
if( ( mask & bit ) == 0 )
{
m_remap[i] = -1;
continue;
}
// check for transparent pixels when using dxt1
if( isDxt1 && rgba[4*i + 3] < 128 )
{
m_remap[i] = -1;
m_transparent = true;
continue;
}
// loop over previous points for a match
for( int j = 0;; ++j )
{
// allocate a new point
if( j == i )
{
// normalise coordinates to [0,1]
float x = ( float )rgba[4*i] / 255.0f;
float y = ( float )rgba[4*i + 1] / 255.0f;
float z = ( float )rgba[4*i + 2] / 255.0f;
// ensure there is always non-zero weight even for zero alpha
float w = ( float )( rgba[4*i + 3] + 1 ) / 256.0f;
// add the point
m_points[m_count] = Vec3( x, y, z );
m_weights[m_count] = ( weightByAlpha ? w : 1.0f );
m_remap[i] = m_count;
// advance
++m_count;
break;
}
// check for a match
int oldbit = 1 << j;
bool match = ( ( mask & oldbit ) != 0 )
&& ( rgba[4*i] == rgba[4*j] )
&& ( rgba[4*i + 1] == rgba[4*j + 1] )
&& ( rgba[4*i + 2] == rgba[4*j + 2] )
&& ( rgba[4*j + 3] >= 128 || !isDxt1 );
if( match )
{
// get the index of the match
int index = m_remap[j];
// ensure there is always non-zero weight even for zero alpha
float w = ( float )( rgba[4*i + 3] + 1 ) / 256.0f;
// map to this point and increase the weight
m_weights[index] += ( weightByAlpha ? w : 1.0f );
m_remap[i] = index;
break;
}
}
}
// square root the weights
for( int i = 0; i < m_count; ++i )
m_weights[i] = std::sqrt( m_weights[i] );
}
void ColourSet::RemapIndices( u8 const* source, u8* target ) const
{
for( int i = 0; i < 16; ++i )
{
int j = m_remap[i];
if( j == -1 )
target[i] = 3;
else
target[i] = source[j];
}
}
} // namespace squish

View file

@ -1,58 +0,0 @@
/* -----------------------------------------------------------------------------
Copyright (c) 2006 Simon Brown si@sjbrown.co.uk
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be included
in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-------------------------------------------------------------------------- */
#ifndef SQUISH_COLOURSET_H
#define SQUISH_COLOURSET_H
#include "squish/squish.h"
#include "maths.h"
namespace squish {
/*! @brief Represents a set of block colours
*/
class ColourSet
{
public:
ColourSet( u8 const* rgba, int mask, int flags );
int GetCount() const { return m_count; }
Vec3 const* GetPoints() const { return m_points; }
float const* GetWeights() const { return m_weights; }
bool IsTransparent() const { return m_transparent; }
void RemapIndices( u8 const* source, u8* target ) const;
private:
int m_count;
Vec3 m_points[16];
float m_weights[16];
int m_remap[16];
bool m_transparent;
};
} // namespace sqish
#endif // ndef SQUISH_COLOURSET_H

View file

@ -1,49 +0,0 @@
/* -----------------------------------------------------------------------------
Copyright (c) 2006 Simon Brown si@sjbrown.co.uk
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be included
in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-------------------------------------------------------------------------- */
#ifndef SQUISH_CONFIG_H
#define SQUISH_CONFIG_H
// Set to 1 when building squish to use Altivec instructions.
#ifndef SQUISH_USE_ALTIVEC
#define SQUISH_USE_ALTIVEC 0
#endif
// Set to 1 or 2 when building squish to use SSE or SSE2 instructions.
#ifndef SQUISH_USE_SSE
#define SQUISH_USE_SSE 0
#endif
// Internally et SQUISH_USE_SIMD when either Altivec or SSE is available.
#if SQUISH_USE_ALTIVEC && SQUISH_USE_SSE
#error "Cannot enable both Altivec and SSE!"
#endif
#if SQUISH_USE_ALTIVEC || SQUISH_USE_SSE
#define SQUISH_USE_SIMD 1
#else
#define SQUISH_USE_SIMD 0
#endif
#endif // ndef SQUISH_CONFIG_H

View file

@ -1,227 +0,0 @@
/* -----------------------------------------------------------------------------
Copyright (c) 2006 Simon Brown si@sjbrown.co.uk
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be included
in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-------------------------------------------------------------------------- */
/*! @file
The symmetric eigensystem solver algorithm is from
http://www.geometrictools.com/Documentation/EigenSymmetric3x3.pdf
*/
#include "maths.h"
#include <cfloat>
namespace squish {
Sym3x3 ComputeWeightedCovariance( int n, Vec3 const* points, float const* weights )
{
// compute the centroid
float total = 0.0f;
Vec3 centroid( 0.0f );
for( int i = 0; i < n; ++i )
{
total += weights[i];
centroid += weights[i]*points[i];
}
centroid /= total;
// accumulate the covariance matrix
Sym3x3 covariance( 0.0f );
for( int i = 0; i < n; ++i )
{
Vec3 a = points[i] - centroid;
Vec3 b = weights[i]*a;
covariance[0] += a.X()*b.X();
covariance[1] += a.X()*b.Y();
covariance[2] += a.X()*b.Z();
covariance[3] += a.Y()*b.Y();
covariance[4] += a.Y()*b.Z();
covariance[5] += a.Z()*b.Z();
}
// return it
return covariance;
}
static Vec3 GetMultiplicity1Evector( Sym3x3 const& matrix, float evalue )
{
// compute M
Sym3x3 m;
m[0] = matrix[0] - evalue;
m[1] = matrix[1];
m[2] = matrix[2];
m[3] = matrix[3] - evalue;
m[4] = matrix[4];
m[5] = matrix[5] - evalue;
// compute U
Sym3x3 u;
u[0] = m[3]*m[5] - m[4]*m[4];
u[1] = m[2]*m[4] - m[1]*m[5];
u[2] = m[1]*m[4] - m[2]*m[3];
u[3] = m[0]*m[5] - m[2]*m[2];
u[4] = m[1]*m[2] - m[4]*m[0];
u[5] = m[0]*m[3] - m[1]*m[1];
// find the largest component
float mc = std::fabs( u[0] );
int mi = 0;
for( int i = 1; i < 6; ++i )
{
float c = std::fabs( u[i] );
if( c > mc )
{
mc = c;
mi = i;
}
}
// pick the column with this component
switch( mi )
{
case 0:
return Vec3( u[0], u[1], u[2] );
case 1:
case 3:
return Vec3( u[1], u[3], u[4] );
default:
return Vec3( u[2], u[4], u[5] );
}
}
static Vec3 GetMultiplicity2Evector( Sym3x3 const& matrix, float evalue )
{
// compute M
Sym3x3 m;
m[0] = matrix[0] - evalue;
m[1] = matrix[1];
m[2] = matrix[2];
m[3] = matrix[3] - evalue;
m[4] = matrix[4];
m[5] = matrix[5] - evalue;
// find the largest component
float mc = std::fabs( m[0] );
int mi = 0;
for( int i = 1; i < 6; ++i )
{
float c = std::fabs( m[i] );
if( c > mc )
{
mc = c;
mi = i;
}
}
// pick the first eigenvector based on this index
switch( mi )
{
case 0:
case 1:
return Vec3( -m[1], m[0], 0.0f );
case 2:
return Vec3( m[2], 0.0f, -m[0] );
case 3:
case 4:
return Vec3( 0.0f, -m[4], m[3] );
default:
return Vec3( 0.0f, -m[5], m[4] );
}
}
Vec3 ComputePrincipleComponent( Sym3x3 const& matrix )
{
// compute the cubic coefficients
float c0 = matrix[0]*matrix[3]*matrix[5]
+ 2.0f*matrix[1]*matrix[2]*matrix[4]
- matrix[0]*matrix[4]*matrix[4]
- matrix[3]*matrix[2]*matrix[2]
- matrix[5]*matrix[1]*matrix[1];
float c1 = matrix[0]*matrix[3] + matrix[0]*matrix[5] + matrix[3]*matrix[5]
- matrix[1]*matrix[1] - matrix[2]*matrix[2] - matrix[4]*matrix[4];
float c2 = matrix[0] + matrix[3] + matrix[5];
// compute the quadratic coefficients
float a = c1 - ( 1.0f/3.0f )*c2*c2;
float b = ( -2.0f/27.0f )*c2*c2*c2 + ( 1.0f/3.0f )*c1*c2 - c0;
// compute the root count check
float Q = 0.25f*b*b + ( 1.0f/27.0f )*a*a*a;
// test the multiplicity
if( FLT_EPSILON < Q )
{
// only one root, which implies we have a multiple of the identity
return Vec3( 1.0f );
}
else if( Q < -FLT_EPSILON )
{
// three distinct roots
float theta = std::atan2( std::sqrt( -Q ), -0.5f*b );
float rho = std::sqrt( 0.25f*b*b - Q );
float rt = std::pow( rho, 1.0f/3.0f );
float ct = std::cos( theta/3.0f );
float st = std::sin( theta/3.0f );
float l1 = ( 1.0f/3.0f )*c2 + 2.0f*rt*ct;
float l2 = ( 1.0f/3.0f )*c2 - rt*( ct + ( float )sqrt( 3.0f )*st );
float l3 = ( 1.0f/3.0f )*c2 - rt*( ct - ( float )sqrt( 3.0f )*st );
// pick the larger
if( std::fabs( l2 ) > std::fabs( l1 ) )
l1 = l2;
if( std::fabs( l3 ) > std::fabs( l1 ) )
l1 = l3;
// get the eigenvector
return GetMultiplicity1Evector( matrix, l1 );
}
else // if( -FLT_EPSILON <= Q && Q <= FLT_EPSILON )
{
// two roots
float rt;
if( b < 0.0f )
rt = -std::pow( -0.5f*b, 1.0f/3.0f );
else
rt = std::pow( 0.5f*b, 1.0f/3.0f );
float l1 = ( 1.0f/3.0f )*c2 + rt; // repeated
float l2 = ( 1.0f/3.0f )*c2 - 2.0f*rt;
// get the eigenvector
if( std::fabs( l1 ) > std::fabs( l2 ) )
return GetMultiplicity2Evector( matrix, l1 );
else
return GetMultiplicity1Evector( matrix, l2 );
}
}
} // namespace squish

View file

@ -1,233 +0,0 @@
/* -----------------------------------------------------------------------------
Copyright (c) 2006 Simon Brown si@sjbrown.co.uk
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be included
in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-------------------------------------------------------------------------- */
#ifndef SQUISH_MATHS_H
#define SQUISH_MATHS_H
#include <cmath>
#include <algorithm>
#include "config.h"
namespace squish {
class Vec3
{
public:
typedef Vec3 const& Arg;
Vec3()
{
}
explicit Vec3( float s )
{
m_x = s;
m_y = s;
m_z = s;
}
Vec3( float x, float y, float z )
{
m_x = x;
m_y = y;
m_z = z;
}
float X() const { return m_x; }
float Y() const { return m_y; }
float Z() const { return m_z; }
Vec3 operator-() const
{
return Vec3( -m_x, -m_y, -m_z );
}
Vec3& operator+=( Arg v )
{
m_x += v.m_x;
m_y += v.m_y;
m_z += v.m_z;
return *this;
}
Vec3& operator-=( Arg v )
{
m_x -= v.m_x;
m_y -= v.m_y;
m_z -= v.m_z;
return *this;
}
Vec3& operator*=( Arg v )
{
m_x *= v.m_x;
m_y *= v.m_y;
m_z *= v.m_z;
return *this;
}
Vec3& operator*=( float s )
{
m_x *= s;
m_y *= s;
m_z *= s;
return *this;
}
Vec3& operator/=( Arg v )
{
m_x /= v.m_x;
m_y /= v.m_y;
m_z /= v.m_z;
return *this;
}
Vec3& operator/=( float s )
{
float t = 1.0f/s;
m_x *= t;
m_y *= t;
m_z *= t;
return *this;
}
friend Vec3 operator+( Arg left, Arg right )
{
Vec3 copy( left );
return copy += right;
}
friend Vec3 operator-( Arg left, Arg right )
{
Vec3 copy( left );
return copy -= right;
}
friend Vec3 operator*( Arg left, Arg right )
{
Vec3 copy( left );
return copy *= right;
}
friend Vec3 operator*( Arg left, float right )
{
Vec3 copy( left );
return copy *= right;
}
friend Vec3 operator*( float left, Arg right )
{
Vec3 copy( right );
return copy *= left;
}
friend Vec3 operator/( Arg left, Arg right )
{
Vec3 copy( left );
return copy /= right;
}
friend Vec3 operator/( Arg left, float right )
{
Vec3 copy( left );
return copy /= right;
}
friend float Dot( Arg left, Arg right )
{
return left.m_x*right.m_x + left.m_y*right.m_y + left.m_z*right.m_z;
}
friend Vec3 Min( Arg left, Arg right )
{
return Vec3(
std::min( left.m_x, right.m_x ),
std::min( left.m_y, right.m_y ),
std::min( left.m_z, right.m_z )
);
}
friend Vec3 Max( Arg left, Arg right )
{
return Vec3(
std::max( left.m_x, right.m_x ),
std::max( left.m_y, right.m_y ),
std::max( left.m_z, right.m_z )
);
}
friend Vec3 Truncate( Arg v )
{
return Vec3(
v.m_x > 0.0f ? std::floor( v.m_x ) : std::ceil( v.m_x ),
v.m_y > 0.0f ? std::floor( v.m_y ) : std::ceil( v.m_y ),
v.m_z > 0.0f ? std::floor( v.m_z ) : std::ceil( v.m_z )
);
}
private:
float m_x;
float m_y;
float m_z;
};
inline float LengthSquared( Vec3::Arg v )
{
return Dot( v, v );
}
class Sym3x3
{
public:
Sym3x3()
{
}
Sym3x3( float s )
{
for( int i = 0; i < 6; ++i )
m_x[i] = s;
}
float operator[]( int index ) const
{
return m_x[index];
}
float& operator[]( int index )
{
return m_x[index];
}
private:
float m_x[6];
};
Sym3x3 ComputeWeightedCovariance( int n, Vec3 const* points, float const* weights );
Vec3 ComputePrincipleComponent( Sym3x3 const& matrix );
} // namespace squish
#endif // ndef SQUISH_MATHS_H

View file

@ -1,202 +0,0 @@
/* -----------------------------------------------------------------------------
Copyright (c) 2006 Simon Brown si@sjbrown.co.uk
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be included
in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-------------------------------------------------------------------------- */
#include "rangefit.h"
#include "colourset.h"
#include "colourblock.h"
#include <cfloat>
namespace squish {
RangeFit::RangeFit( ColourSet const* colours, int flags )
: ColourFit( colours, flags )
{
// initialise the metric
bool perceptual = ( ( m_flags & kColourMetricPerceptual ) != 0 );
if( perceptual )
m_metric = Vec3( 0.2126f, 0.7152f, 0.0722f );
else
m_metric = Vec3( 1.0f );
// initialise the best error
m_besterror = FLT_MAX;
// cache some values
int const count = m_colours->GetCount();
Vec3 const* values = m_colours->GetPoints();
float const* weights = m_colours->GetWeights();
// get the covariance matrix
Sym3x3 covariance = ComputeWeightedCovariance( count, values, weights );
// compute the principle component
Vec3 principle = ComputePrincipleComponent( covariance );
// get the min and max range as the codebook endpoints
Vec3 start( 0.0f );
Vec3 end( 0.0f );
if( count > 0 )
{
float min, max;
// compute the range
start = end = values[0];
min = max = Dot( values[0], principle );
for( int i = 1; i < count; ++i )
{
float val = Dot( values[i], principle );
if( val < min )
{
start = values[i];
min = val;
}
else if( val > max )
{
end = values[i];
max = val;
}
}
}
// clamp the output to [0, 1]
Vec3 const one( 1.0f );
Vec3 const zero( 0.0f );
start = Min( one, Max( zero, start ) );
end = Min( one, Max( zero, end ) );
// clamp to the grid and save
Vec3 const grid( 31.0f, 63.0f, 31.0f );
Vec3 const gridrcp( 1.0f/31.0f, 1.0f/63.0f, 1.0f/31.0f );
Vec3 const half( 0.5f );
m_start = Truncate( grid*start + half )*gridrcp;
m_end = Truncate( grid*end + half )*gridrcp;
}
void RangeFit::Compress3( void* block )
{
// cache some values
int const count = m_colours->GetCount();
Vec3 const* values = m_colours->GetPoints();
// create a codebook
Vec3 codes[3];
codes[0] = m_start;
codes[1] = m_end;
codes[2] = 0.5f*m_start + 0.5f*m_end;
// match each point to the closest code
u8 closest[16];
float error = 0.0f;
for( int i = 0; i < count; ++i )
{
// find the closest code
float dist = FLT_MAX;
int idx = 0;
for( int j = 0; j < 3; ++j )
{
float d = LengthSquared( m_metric*( values[i] - codes[j] ) );
if( d < dist )
{
dist = d;
idx = j;
}
}
// save the index
closest[i] = ( u8 )idx;
// accumulate the error
error += dist;
}
// save this scheme if it wins
if( error < m_besterror )
{
// remap the indices
u8 indices[16];
m_colours->RemapIndices( closest, indices );
// save the block
WriteColourBlock3( m_start, m_end, indices, block );
// save the error
m_besterror = error;
}
}
void RangeFit::Compress4( void* block )
{
// cache some values
int const count = m_colours->GetCount();
Vec3 const* values = m_colours->GetPoints();
// create a codebook
Vec3 codes[4];
codes[0] = m_start;
codes[1] = m_end;
codes[2] = ( 2.0f/3.0f )*m_start + ( 1.0f/3.0f )*m_end;
codes[3] = ( 1.0f/3.0f )*m_start + ( 2.0f/3.0f )*m_end;
// match each point to the closest code
u8 closest[16];
float error = 0.0f;
for( int i = 0; i < count; ++i )
{
// find the closest code
float dist = FLT_MAX;
int idx = 0;
for( int j = 0; j < 4; ++j )
{
float d = LengthSquared( m_metric*( values[i] - codes[j] ) );
if( d < dist )
{
dist = d;
idx = j;
}
}
// save the index
closest[i] = ( u8 )idx;
// accumulate the error
error += dist;
}
// save this scheme if it wins
if( error < m_besterror )
{
// remap the indices
u8 indices[16];
m_colours->RemapIndices( closest, indices );
// save the block
WriteColourBlock4( m_start, m_end, indices, block );
// save the error
m_besterror = error;
}
}
} // namespace squish

View file

@ -1,54 +0,0 @@
/* -----------------------------------------------------------------------------
Copyright (c) 2006 Simon Brown si@sjbrown.co.uk
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be included
in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-------------------------------------------------------------------------- */
#ifndef SQUISH_RANGEFIT_H
#define SQUISH_RANGEFIT_H
#include "squish/squish.h"
#include "colourfit.h"
#include "maths.h"
namespace squish {
class ColourSet;
class RangeFit : public ColourFit
{
public:
RangeFit( ColourSet const* colours, int flags );
private:
virtual void Compress3( void* block );
virtual void Compress4( void* block );
Vec3 m_metric;
Vec3 m_start;
Vec3 m_end;
float m_besterror;
};
} // squish
#endif // ndef SQUISH_RANGEFIT_H

View file

@ -1,40 +0,0 @@
/* -----------------------------------------------------------------------------
Copyright (c) 2006 Simon Brown si@sjbrown.co.uk
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be included
in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-------------------------------------------------------------------------- */
#ifndef SQUISH_SIMD_H
#define SQUISH_SIMD_H
#include "maths.h"
#if SQUISH_USE_ALTIVEC
#include "simd_ve.h"
#elif SQUISH_USE_SSE
#include "simd_sse.h"
#else
#include "simd_float.h"
#endif
#endif // ndef SQUISH_SIMD_H

View file

@ -1,183 +0,0 @@
/* -----------------------------------------------------------------------------
Copyright (c) 2006 Simon Brown si@sjbrown.co.uk
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be included
in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-------------------------------------------------------------------------- */
#ifndef SQUISH_SIMD_FLOAT_H
#define SQUISH_SIMD_FLOAT_H
#include <algorithm>
namespace squish {
#define VEC4_CONST( X ) Vec4( X )
class Vec4
{
public:
typedef Vec4 const& Arg;
Vec4() {}
explicit Vec4( float s )
: m_x( s ),
m_y( s ),
m_z( s ),
m_w( s )
{
}
Vec4( float x, float y, float z, float w )
: m_x( x ),
m_y( y ),
m_z( z ),
m_w( w )
{
}
Vec3 GetVec3() const
{
return Vec3( m_x, m_y, m_z );
}
Vec4 SplatX() const { return Vec4( m_x ); }
Vec4 SplatY() const { return Vec4( m_y ); }
Vec4 SplatZ() const { return Vec4( m_z ); }
Vec4 SplatW() const { return Vec4( m_w ); }
Vec4& operator+=( Arg v )
{
m_x += v.m_x;
m_y += v.m_y;
m_z += v.m_z;
m_w += v.m_w;
return *this;
}
Vec4& operator-=( Arg v )
{
m_x -= v.m_x;
m_y -= v.m_y;
m_z -= v.m_z;
m_w -= v.m_w;
return *this;
}
Vec4& operator*=( Arg v )
{
m_x *= v.m_x;
m_y *= v.m_y;
m_z *= v.m_z;
m_w *= v.m_w;
return *this;
}
friend Vec4 operator+( Vec4::Arg left, Vec4::Arg right )
{
Vec4 copy( left );
return copy += right;
}
friend Vec4 operator-( Vec4::Arg left, Vec4::Arg right )
{
Vec4 copy( left );
return copy -= right;
}
friend Vec4 operator*( Vec4::Arg left, Vec4::Arg right )
{
Vec4 copy( left );
return copy *= right;
}
//! Returns a*b + c
friend Vec4 MultiplyAdd( Vec4::Arg a, Vec4::Arg b, Vec4::Arg c )
{
return a*b + c;
}
//! Returns -( a*b - c )
friend Vec4 NegativeMultiplySubtract( Vec4::Arg a, Vec4::Arg b, Vec4::Arg c )
{
return c - a*b;
}
friend Vec4 Reciprocal( Vec4::Arg v )
{
return Vec4(
1.0f/v.m_x,
1.0f/v.m_y,
1.0f/v.m_z,
1.0f/v.m_w
);
}
friend Vec4 Min( Vec4::Arg left, Vec4::Arg right )
{
return Vec4(
std::min( left.m_x, right.m_x ),
std::min( left.m_y, right.m_y ),
std::min( left.m_z, right.m_z ),
std::min( left.m_w, right.m_w )
);
}
friend Vec4 Max( Vec4::Arg left, Vec4::Arg right )
{
return Vec4(
std::max( left.m_x, right.m_x ),
std::max( left.m_y, right.m_y ),
std::max( left.m_z, right.m_z ),
std::max( left.m_w, right.m_w )
);
}
friend Vec4 Truncate( Vec4::Arg v )
{
return Vec4(
v.m_x > 0.0f ? std::floor( v.m_x ) : std::ceil( v.m_x ),
v.m_y > 0.0f ? std::floor( v.m_y ) : std::ceil( v.m_y ),
v.m_z > 0.0f ? std::floor( v.m_z ) : std::ceil( v.m_z ),
v.m_w > 0.0f ? std::floor( v.m_w ) : std::ceil( v.m_w )
);
}
friend bool CompareAnyLessThan( Vec4::Arg left, Vec4::Arg right )
{
return left.m_x < right.m_x
|| left.m_y < right.m_y
|| left.m_z < right.m_z
|| left.m_w < right.m_w;
}
private:
float m_x;
float m_y;
float m_z;
float m_w;
};
} // namespace squish
#endif // ndef SQUISH_SIMD_FLOAT_H

View file

@ -1,180 +0,0 @@
/* -----------------------------------------------------------------------------
Copyright (c) 2006 Simon Brown si@sjbrown.co.uk
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be included
in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-------------------------------------------------------------------------- */
#ifndef SQUISH_SIMD_SSE_H
#define SQUISH_SIMD_SSE_H
#include <xmmintrin.h>
#if ( SQUISH_USE_SSE > 1 )
#include <emmintrin.h>
#endif
#define SQUISH_SSE_SPLAT( a ) \
( ( a ) | ( ( a ) << 2 ) | ( ( a ) << 4 ) | ( ( a ) << 6 ) )
#define SQUISH_SSE_SHUF( x, y, z, w ) \
( ( x ) | ( ( y ) << 2 ) | ( ( z ) << 4 ) | ( ( w ) << 6 ) )
namespace squish {
#define VEC4_CONST( X ) Vec4( X )
class Vec4
{
public:
typedef Vec4 const& Arg;
Vec4() {}
explicit Vec4( __m128 v ) : m_v( v ) {}
Vec4( Vec4 const& arg ) : m_v( arg.m_v ) {}
Vec4& operator=( Vec4 const& arg )
{
m_v = arg.m_v;
return *this;
}
explicit Vec4( float s ) : m_v( _mm_set1_ps( s ) ) {}
Vec4( float x, float y, float z, float w ) : m_v( _mm_setr_ps( x, y, z, w ) ) {}
Vec3 GetVec3() const
{
#ifdef __GNUC__
__attribute__ ((__aligned__ (16))) float c[4];
#else
__declspec(align(16)) float c[4];
#endif
_mm_store_ps( c, m_v );
return Vec3( c[0], c[1], c[2] );
}
Vec4 SplatX() const { return Vec4( _mm_shuffle_ps( m_v, m_v, SQUISH_SSE_SPLAT( 0 ) ) ); }
Vec4 SplatY() const { return Vec4( _mm_shuffle_ps( m_v, m_v, SQUISH_SSE_SPLAT( 1 ) ) ); }
Vec4 SplatZ() const { return Vec4( _mm_shuffle_ps( m_v, m_v, SQUISH_SSE_SPLAT( 2 ) ) ); }
Vec4 SplatW() const { return Vec4( _mm_shuffle_ps( m_v, m_v, SQUISH_SSE_SPLAT( 3 ) ) ); }
Vec4& operator+=( Arg v )
{
m_v = _mm_add_ps( m_v, v.m_v );
return *this;
}
Vec4& operator-=( Arg v )
{
m_v = _mm_sub_ps( m_v, v.m_v );
return *this;
}
Vec4& operator*=( Arg v )
{
m_v = _mm_mul_ps( m_v, v.m_v );
return *this;
}
friend Vec4 operator+( Vec4::Arg left, Vec4::Arg right )
{
return Vec4( _mm_add_ps( left.m_v, right.m_v ) );
}
friend Vec4 operator-( Vec4::Arg left, Vec4::Arg right )
{
return Vec4( _mm_sub_ps( left.m_v, right.m_v ) );
}
friend Vec4 operator*( Vec4::Arg left, Vec4::Arg right )
{
return Vec4( _mm_mul_ps( left.m_v, right.m_v ) );
}
//! Returns a*b + c
friend Vec4 MultiplyAdd( Vec4::Arg a, Vec4::Arg b, Vec4::Arg c )
{
return Vec4( _mm_add_ps( _mm_mul_ps( a.m_v, b.m_v ), c.m_v ) );
}
//! Returns -( a*b - c )
friend Vec4 NegativeMultiplySubtract( Vec4::Arg a, Vec4::Arg b, Vec4::Arg c )
{
return Vec4( _mm_sub_ps( c.m_v, _mm_mul_ps( a.m_v, b.m_v ) ) );
}
friend Vec4 Reciprocal( Vec4::Arg v )
{
// get the reciprocal estimate
__m128 estimate = _mm_rcp_ps( v.m_v );
// one round of Newton-Rhaphson refinement
__m128 diff = _mm_sub_ps( _mm_set1_ps( 1.0f ), _mm_mul_ps( estimate, v.m_v ) );
return Vec4( _mm_add_ps( _mm_mul_ps( diff, estimate ), estimate ) );
}
friend Vec4 Min( Vec4::Arg left, Vec4::Arg right )
{
return Vec4( _mm_min_ps( left.m_v, right.m_v ) );
}
friend Vec4 Max( Vec4::Arg left, Vec4::Arg right )
{
return Vec4( _mm_max_ps( left.m_v, right.m_v ) );
}
friend Vec4 Truncate( Vec4::Arg v )
{
#if ( SQUISH_USE_SSE == 1 )
// convert to ints
__m128 input = v.m_v;
__m64 lo = _mm_cvttps_pi32( input );
__m64 hi = _mm_cvttps_pi32( _mm_movehl_ps( input, input ) );
// convert to floats
__m128 part = _mm_movelh_ps( input, _mm_cvtpi32_ps( input, hi ) );
__m128 truncated = _mm_cvtpi32_ps( part, lo );
// clear out the MMX multimedia state to allow FP calls later
_mm_empty();
return Vec4( truncated );
#else
// use SSE2 instructions
return Vec4( _mm_cvtepi32_ps( _mm_cvttps_epi32( v.m_v ) ) );
#endif
}
friend bool CompareAnyLessThan( Vec4::Arg left, Vec4::Arg right )
{
__m128 bits = _mm_cmplt_ps( left.m_v, right.m_v );
int value = _mm_movemask_ps( bits );
return value != 0;
}
private:
__m128 m_v;
};
} // namespace squish
#endif // ndef SQUISH_SIMD_SSE_H

View file

@ -1,166 +0,0 @@
/* -----------------------------------------------------------------------------
Copyright (c) 2006 Simon Brown si@sjbrown.co.uk
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be included
in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-------------------------------------------------------------------------- */
#ifndef SQUISH_SIMD_VE_H
#define SQUISH_SIMD_VE_H
#include <altivec.h>
#undef bool
namespace squish {
#define VEC4_CONST( X ) Vec4( ( vector float )( X ) )
class Vec4
{
public:
typedef Vec4 Arg;
Vec4() {}
explicit Vec4( vector float v ) : m_v( v ) {}
Vec4( Vec4 const& arg ) : m_v( arg.m_v ) {}
Vec4& operator=( Vec4 const& arg )
{
m_v = arg.m_v;
return *this;
}
explicit Vec4( float s )
{
union { vector float v; float c[4]; } u;
u.c[0] = s;
u.c[1] = s;
u.c[2] = s;
u.c[3] = s;
m_v = u.v;
}
Vec4( float x, float y, float z, float w )
{
union { vector float v; float c[4]; } u;
u.c[0] = x;
u.c[1] = y;
u.c[2] = z;
u.c[3] = w;
m_v = u.v;
}
Vec3 GetVec3() const
{
union { vector float v; float c[4]; } u;
u.v = m_v;
return Vec3( u.c[0], u.c[1], u.c[2] );
}
Vec4 SplatX() const { return Vec4( vec_splat( m_v, 0 ) ); }
Vec4 SplatY() const { return Vec4( vec_splat( m_v, 1 ) ); }
Vec4 SplatZ() const { return Vec4( vec_splat( m_v, 2 ) ); }
Vec4 SplatW() const { return Vec4( vec_splat( m_v, 3 ) ); }
Vec4& operator+=( Arg v )
{
m_v = vec_add( m_v, v.m_v );
return *this;
}
Vec4& operator-=( Arg v )
{
m_v = vec_sub( m_v, v.m_v );
return *this;
}
Vec4& operator*=( Arg v )
{
m_v = vec_madd( m_v, v.m_v, ( vector float )( -0.0f ) );
return *this;
}
friend Vec4 operator+( Vec4::Arg left, Vec4::Arg right )
{
return Vec4( vec_add( left.m_v, right.m_v ) );
}
friend Vec4 operator-( Vec4::Arg left, Vec4::Arg right )
{
return Vec4( vec_sub( left.m_v, right.m_v ) );
}
friend Vec4 operator*( Vec4::Arg left, Vec4::Arg right )
{
return Vec4( vec_madd( left.m_v, right.m_v, ( vector float )( -0.0f ) ) );
}
//! Returns a*b + c
friend Vec4 MultiplyAdd( Vec4::Arg a, Vec4::Arg b, Vec4::Arg c )
{
return Vec4( vec_madd( a.m_v, b.m_v, c.m_v ) );
}
//! Returns -( a*b - c )
friend Vec4 NegativeMultiplySubtract( Vec4::Arg a, Vec4::Arg b, Vec4::Arg c )
{
return Vec4( vec_nmsub( a.m_v, b.m_v, c.m_v ) );
}
friend Vec4 Reciprocal( Vec4::Arg v )
{
// get the reciprocal estimate
vector float estimate = vec_re( v.m_v );
// one round of Newton-Rhaphson refinement
vector float diff = vec_nmsub( estimate, v.m_v, ( vector float )( 1.0f ) );
return Vec4( vec_madd( diff, estimate, estimate ) );
}
friend Vec4 Min( Vec4::Arg left, Vec4::Arg right )
{
return Vec4( vec_min( left.m_v, right.m_v ) );
}
friend Vec4 Max( Vec4::Arg left, Vec4::Arg right )
{
return Vec4( vec_max( left.m_v, right.m_v ) );
}
friend Vec4 Truncate( Vec4::Arg v )
{
return Vec4( vec_trunc( v.m_v ) );
}
friend bool CompareAnyLessThan( Vec4::Arg left, Vec4::Arg right )
{
return vec_any_lt( left.m_v, right.m_v ) != 0;
}
private:
vector float m_v;
};
} // namespace squish
#endif // ndef SQUISH_SIMD_VE_H

View file

@ -1,172 +0,0 @@
/* -----------------------------------------------------------------------------
Copyright (c) 2006 Simon Brown si@sjbrown.co.uk
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be included
in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-------------------------------------------------------------------------- */
#include "singlecolourfit.h"
#include "colourset.h"
#include "colourblock.h"
namespace squish {
struct SourceBlock
{
u8 start;
u8 end;
u8 error;
};
struct SingleColourLookup
{
SourceBlock sources[2];
};
#include "singlecolourlookup.inl"
static int FloatToInt( float a, int limit )
{
// use ANSI round-to-zero behaviour to get round-to-nearest
int i = ( int )( a + 0.5f );
// clamp to the limit
if( i < 0 )
i = 0;
else if( i > limit )
i = limit;
// done
return i;
}
SingleColourFit::SingleColourFit( ColourSet const* colours, int flags )
: ColourFit( colours, flags )
{
// grab the single colour
Vec3 const* values = m_colours->GetPoints();
m_colour[0] = ( u8 )FloatToInt( 255.0f*values->X(), 255 );
m_colour[1] = ( u8 )FloatToInt( 255.0f*values->Y(), 255 );
m_colour[2] = ( u8 )FloatToInt( 255.0f*values->Z(), 255 );
// initialise the best error
m_besterror = 2147483647; //INT_MAX
}
void SingleColourFit::Compress3( void* block )
{
// build the table of lookups
SingleColourLookup const* const lookups[] =
{
lookup_5_3,
lookup_6_3,
lookup_5_3
};
// find the best end-points and index
ComputeEndPoints( lookups );
// build the block if we win
if( m_error < m_besterror )
{
// remap the indices
u8 indices[16];
m_colours->RemapIndices( &m_index, indices );
// save the block
WriteColourBlock3( m_start, m_end, indices, block );
// save the error
m_besterror = m_error;
}
}
void SingleColourFit::Compress4( void* block )
{
// build the table of lookups
SingleColourLookup const* const lookups[] =
{
lookup_5_4,
lookup_6_4,
lookup_5_4
};
// find the best end-points and index
ComputeEndPoints( lookups );
// build the block if we win
if( m_error < m_besterror )
{
// remap the indices
u8 indices[16];
m_colours->RemapIndices( &m_index, indices );
// save the block
WriteColourBlock4( m_start, m_end, indices, block );
// save the error
m_besterror = m_error;
}
}
void SingleColourFit::ComputeEndPoints( SingleColourLookup const* const* lookups )
{
// check each index combination (endpoint or intermediate)
m_error = 2147483647; //INT_MAX
for( int index = 0; index < 2; ++index )
{
// check the error for this codebook index
SourceBlock const* sources[3];
int error = 0;
for( int channel = 0; channel < 3; ++channel )
{
// grab the lookup table and index for this channel
SingleColourLookup const* lookup = lookups[channel];
int target = m_colour[channel];
// store a pointer to the source for this channel
sources[channel] = lookup[target].sources + index;
// accumulate the error
int diff = sources[channel]->error;
error += diff*diff;
}
// keep it if the error is lower
if( error < m_error )
{
m_start = Vec3(
( float )sources[0]->start/31.0f,
( float )sources[1]->start/63.0f,
( float )sources[2]->start/31.0f
);
m_end = Vec3(
( float )sources[0]->end/31.0f,
( float )sources[1]->end/63.0f,
( float )sources[2]->end/31.0f
);
m_index = ( u8 )( 2*index );
m_error = error;
}
}
}
} // namespace squish

View file

@ -1,58 +0,0 @@
/* -----------------------------------------------------------------------------
Copyright (c) 2006 Simon Brown si@sjbrown.co.uk
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be included
in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-------------------------------------------------------------------------- */
#ifndef SQUISH_SINGLECOLOURFIT_H
#define SQUISH_SINGLECOLOURFIT_H
#include "squish/squish.h"
#include "colourfit.h"
namespace squish {
class ColourSet;
struct SingleColourLookup;
class SingleColourFit : public ColourFit
{
public:
SingleColourFit( ColourSet const* colours, int flags );
private:
virtual void Compress3( void* block );
virtual void Compress4( void* block );
void ComputeEndPoints( SingleColourLookup const* const* lookups );
u8 m_colour[3];
Vec3 m_start;
Vec3 m_end;
u8 m_index;
int m_error;
int m_besterror;
};
} // namespace squish
#endif // ndef SQUISH_SINGLECOLOURFIT_H

File diff suppressed because it is too large Load diff

View file

@ -1,239 +0,0 @@
/* -----------------------------------------------------------------------------
Copyright (c) 2006 Simon Brown si@sjbrown.co.uk
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be included
in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-------------------------------------------------------------------------- */
#include "squish/squish.h"
#include "colourset.h"
#include "maths.h"
#include "rangefit.h"
#include "clusterfit.h"
#include "colourblock.h"
#include "alpha.h"
#include "singlecolourfit.h"
namespace squish {
static int FixFlags( int flags )
{
// grab the flag bits
int method = flags & ( kDxt1 | kDxt3 | kDxt5 );
int fit = flags & ( kColourIterativeClusterFit | kColourClusterFit | kColourRangeFit );
int metric = flags & ( kColourMetricPerceptual | kColourMetricUniform );
int extra = flags & kWeightColourByAlpha;
// set defaults
if( method != kDxt3 && method != kDxt5 )
method = kDxt1;
if( fit != kColourRangeFit )
fit = kColourClusterFit;
if( metric != kColourMetricUniform )
metric = kColourMetricPerceptual;
// done
return method | fit | metric | extra;
}
void Compress( u8 const* rgba, void* block, int flags )
{
// compress with full mask
CompressMasked( rgba, 0xffff, block, flags );
}
void CompressMasked( u8 const* rgba, int mask, void* block, int flags )
{
// fix any bad flags
flags = FixFlags( flags );
// get the block locations
void* colourBlock = block;
void* alphaBock = block;
if( ( flags & ( kDxt3 | kDxt5 ) ) != 0 )
colourBlock = reinterpret_cast< u8* >( block ) + 8;
// create the minimal point set
ColourSet colours( rgba, mask, flags );
// check the compression type and compress colour
if( colours.GetCount() == 1 )
{
// always do a single colour fit
SingleColourFit fit( &colours, flags );
fit.Compress( colourBlock );
}
else if( ( flags & kColourRangeFit ) != 0 || colours.GetCount() == 0 )
{
// do a range fit
RangeFit fit( &colours, flags );
fit.Compress( colourBlock );
}
else
{
// default to a cluster fit (could be iterative or not)
ClusterFit fit( &colours, flags );
fit.Compress( colourBlock );
}
// compress alpha separately if necessary
if( ( flags & kDxt3 ) != 0 )
CompressAlphaDxt3( rgba, mask, alphaBock );
else if( ( flags & kDxt5 ) != 0 )
CompressAlphaDxt5( rgba, mask, alphaBock );
}
void Decompress( u8* rgba, void const* block, int flags )
{
// fix any bad flags
flags = FixFlags( flags );
// get the block locations
void const* colourBlock = block;
void const* alphaBock = block;
if( ( flags & ( kDxt3 | kDxt5 ) ) != 0 )
colourBlock = reinterpret_cast< u8 const* >( block ) + 8;
// decompress colour
DecompressColour( rgba, colourBlock, ( flags & kDxt1 ) != 0 );
// decompress alpha separately if necessary
if( ( flags & kDxt3 ) != 0 )
DecompressAlphaDxt3( rgba, alphaBock );
else if( ( flags & kDxt5 ) != 0 )
DecompressAlphaDxt5( rgba, alphaBock );
}
int GetStorageRequirements( int width, int height, int flags )
{
// fix any bad flags
flags = FixFlags( flags );
// compute the storage requirements
int blockcount = ( ( width + 3 )/4 ) * ( ( height + 3 )/4 );
int blocksize = ( ( flags & kDxt1 ) != 0 ) ? 8 : 16;
return blockcount*blocksize;
}
void CompressImage( u8 const* rgba, int width, int height, void* blocks, int flags )
{
// fix any bad flags
flags = FixFlags( flags );
// initialise the block output
u8* targetBlock = reinterpret_cast< u8* >( blocks );
int bytesPerBlock = ( ( flags & kDxt1 ) != 0 ) ? 8 : 16;
// loop over blocks
for( int y = 0; y < height; y += 4 )
{
for( int x = 0; x < width; x += 4 )
{
// build the 4x4 block of pixels
u8 sourceRgba[16*4];
u8* targetPixel = sourceRgba;
int mask = 0;
for( int py = 0; py < 4; ++py )
{
for( int px = 0; px < 4; ++px )
{
// get the source pixel in the image
int sx = x + px;
int sy = y + py;
// enable if we're in the image
if( sx < width && sy < height )
{
// copy the rgba value
u8 const* sourcePixel = rgba + 4*( width*sy + sx );
for( int i = 0; i < 4; ++i )
*targetPixel++ = *sourcePixel++;
// enable this pixel
mask |= ( 1 << ( 4*py + px ) );
}
else
{
// skip this pixel as its outside the image
targetPixel += 4;
}
}
}
// compress it into the output
CompressMasked( sourceRgba, mask, targetBlock, flags );
// advance
targetBlock += bytesPerBlock;
}
}
}
void DecompressImage( u8* rgba, int width, int height, void const* blocks, int flags )
{
// fix any bad flags
flags = FixFlags( flags );
// initialise the block input
u8 const* sourceBlock = reinterpret_cast< u8 const* >( blocks );
int bytesPerBlock = ( ( flags & kDxt1 ) != 0 ) ? 8 : 16;
// loop over blocks
for( int y = 0; y < height; y += 4 )
{
for( int x = 0; x < width; x += 4 )
{
// decompress the block
u8 targetRgba[4*16];
Decompress( targetRgba, sourceBlock, flags );
// write the decompressed pixels to the correct image locations
u8 const* sourcePixel = targetRgba;
for( int py = 0; py < 4; ++py )
{
for( int px = 0; px < 4; ++px )
{
// get the target location
int sx = x + px;
int sy = y + py;
if( sx < width && sy < height )
{
u8* targetPixel = rgba + 4*( width*sy + sx );
// copy the rgba value
for( int i = 0; i < 4; ++i )
*targetPixel++ = *sourcePixel++;
}
else
{
// skip this pixel as its outside the image
sourcePixel += 4;
}
}
}
// advance
sourceBlock += bytesPerBlock;
}
}
}
} // namespace squish

View file

@ -1,247 +0,0 @@
/* -----------------------------------------------------------------------------
Copyright (c) 2006 Simon Brown si@sjbrown.co.uk
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be included
in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-------------------------------------------------------------------------- */
#ifndef SQUISH_H
#define SQUISH_H
//! All squish API functions live in this namespace.
namespace squish {
// -----------------------------------------------------------------------------
//! Typedef a quantity that is a single unsigned byte.
typedef unsigned char u8;
// -----------------------------------------------------------------------------
enum
{
//! Use DXT1 compression.
kDxt1 = ( 1 << 0 ),
//! Use DXT3 compression.
kDxt3 = ( 1 << 1 ),
//! Use DXT5 compression.
kDxt5 = ( 1 << 2 ),
//! Use a very slow but very high quality colour compressor.
kColourIterativeClusterFit = ( 1 << 8 ),
//! Use a slow but high quality colour compressor (the default).
kColourClusterFit = ( 1 << 3 ),
//! Use a fast but low quality colour compressor.
kColourRangeFit = ( 1 << 4 ),
//! Use a perceptual metric for colour error (the default).
kColourMetricPerceptual = ( 1 << 5 ),
//! Use a uniform metric for colour error.
kColourMetricUniform = ( 1 << 6 ),
//! Weight the colour by alpha during cluster fit (disabled by default).
kWeightColourByAlpha = ( 1 << 7 )
};
// -----------------------------------------------------------------------------
/*! @brief Compresses a 4x4 block of pixels.
@param rgba The rgba values of the 16 source pixels.
@param block Storage for the compressed DXT block.
@param flags Compression flags.
The source pixels should be presented as a contiguous array of 16 rgba
values, with each component as 1 byte each. In memory this should be:
{ r1, g1, b1, a1, .... , r16, g16, b16, a16 }
The flags parameter should specify either kDxt1, kDxt3 or kDxt5 compression,
however, DXT1 will be used by default if none is specified. When using DXT1
compression, 8 bytes of storage are required for the compressed DXT block.
DXT3 and DXT5 compression require 16 bytes of storage per block.
The flags parameter can also specify a preferred colour compressor and
colour error metric to use when fitting the RGB components of the data.
Possible colour compressors are: kColourClusterFit (the default),
kColourRangeFit or kColourIterativeClusterFit. Possible colour error metrics
are: kColourMetricPerceptual (the default) or kColourMetricUniform. If no
flags are specified in any particular category then the default will be
used. Unknown flags are ignored.
When using kColourClusterFit, an additional flag can be specified to
weight the colour of each pixel by its alpha value. For images that are
rendered using alpha blending, this can significantly increase the
perceived quality.
*/
void Compress( u8 const* rgba, void* block, int flags );
// -----------------------------------------------------------------------------
/*! @brief Compresses a 4x4 block of pixels.
@param rgba The rgba values of the 16 source pixels.
@param mask The valid pixel mask.
@param block Storage for the compressed DXT block.
@param flags Compression flags.
The source pixels should be presented as a contiguous array of 16 rgba
values, with each component as 1 byte each. In memory this should be:
{ r1, g1, b1, a1, .... , r16, g16, b16, a16 }
The mask parameter enables only certain pixels within the block. The lowest
bit enables the first pixel and so on up to the 16th bit. Bits beyond the
16th bit are ignored. Pixels that are not enabled are allowed to take
arbitrary colours in the output block. An example of how this can be used
is in the CompressImage function to disable pixels outside the bounds of
the image when the width or height is not divisible by 4.
The flags parameter should specify either kDxt1, kDxt3 or kDxt5 compression,
however, DXT1 will be used by default if none is specified. When using DXT1
compression, 8 bytes of storage are required for the compressed DXT block.
DXT3 and DXT5 compression require 16 bytes of storage per block.
The flags parameter can also specify a preferred colour compressor and
colour error metric to use when fitting the RGB components of the data.
Possible colour compressors are: kColourClusterFit (the default),
kColourRangeFit or kColourIterativeClusterFit. Possible colour error metrics
are: kColourMetricPerceptual (the default) or kColourMetricUniform. If no
flags are specified in any particular category then the default will be
used. Unknown flags are ignored.
When using kColourClusterFit, an additional flag can be specified to
weight the colour of each pixel by its alpha value. For images that are
rendered using alpha blending, this can significantly increase the
perceived quality.
*/
void CompressMasked( u8 const* rgba, int mask, void* block, int flags );
// -----------------------------------------------------------------------------
/*! @brief Decompresses a 4x4 block of pixels.
@param rgba Storage for the 16 decompressed pixels.
@param block The compressed DXT block.
@param flags Compression flags.
The decompressed pixels will be written as a contiguous array of 16 rgba
values, with each component as 1 byte each. In memory this is:
{ r1, g1, b1, a1, .... , r16, g16, b16, a16 }
The flags parameter should specify either kDxt1, kDxt3 or kDxt5 compression,
however, DXT1 will be used by default if none is specified. All other flags
are ignored.
*/
void Decompress( u8* rgba, void const* block, int flags );
// -----------------------------------------------------------------------------
/*! @brief Computes the amount of compressed storage required.
@param width The width of the image.
@param height The height of the image.
@param flags Compression flags.
The flags parameter should specify either kDxt1, kDxt3 or kDxt5 compression,
however, DXT1 will be used by default if none is specified. All other flags
are ignored.
Most DXT images will be a multiple of 4 in each dimension, but this
function supports arbitrary size images by allowing the outer blocks to
be only partially used.
*/
int GetStorageRequirements( int width, int height, int flags );
// -----------------------------------------------------------------------------
/*! @brief Compresses an image in memory.
@param rgba The pixels of the source.
@param width The width of the source image.
@param height The height of the source image.
@param blocks Storage for the compressed output.
@param flags Compression flags.
The source pixels should be presented as a contiguous array of width*height
rgba values, with each component as 1 byte each. In memory this should be:
{ r1, g1, b1, a1, .... , rn, gn, bn, an } for n = width*height
The flags parameter should specify either kDxt1, kDxt3 or kDxt5 compression,
however, DXT1 will be used by default if none is specified. When using DXT1
compression, 8 bytes of storage are required for each compressed DXT block.
DXT3 and DXT5 compression require 16 bytes of storage per block.
The flags parameter can also specify a preferred colour compressor and
colour error metric to use when fitting the RGB components of the data.
Possible colour compressors are: kColourClusterFit (the default),
kColourRangeFit or kColourIterativeClusterFit. Possible colour error metrics
are: kColourMetricPerceptual (the default) or kColourMetricUniform. If no
flags are specified in any particular category then the default will be
used. Unknown flags are ignored.
When using kColourClusterFit, an additional flag can be specified to
weight the colour of each pixel by its alpha value. For images that are
rendered using alpha blending, this can significantly increase the
perceived quality.
Internally this function calls squish::Compress for each block. To see how
much memory is required in the compressed image, use
squish::GetStorageRequirements.
*/
void CompressImage( u8 const* rgba, int width, int height, void* blocks, int flags );
// -----------------------------------------------------------------------------
/*! @brief Decompresses an image in memory.
@param rgba Storage for the decompressed pixels.
@param width The width of the source image.
@param height The height of the source image.
@param blocks The compressed DXT blocks.
@param flags Compression flags.
The decompressed pixels will be written as a contiguous array of width*height
16 rgba values, with each component as 1 byte each. In memory this is:
{ r1, g1, b1, a1, .... , rn, gn, bn, an } for n = width*height
The flags parameter should specify either kDxt1, kDxt3 or kDxt5 compression,
however, DXT1 will be used by default if none is specified. All other flags
are ignored.
Internally this function calls squish::Decompress for each block.
*/
void DecompressImage( u8* rgba, int width, int height, void const* blocks, int flags );
// -----------------------------------------------------------------------------
} // namespace squish
#endif // ndef SQUISH_H

View file

@ -1,65 +0,0 @@
Import('env')
sources = [
#"theora/analyze.c",
#"theora/apiwrapper.c",
"theora/bitpack.c",
"theora/cpu.c",
#"theora/decapiwrapper.c",
"theora/decinfo.c",
"theora/decode.c",
"theora/dequant.c",
#"theora/encapiwrapper.c",
#"theora/encfrag.c",
#"theora/encinfo.c",
#"theora/encode.c",
#"theora/encoder_disabled.c",
#"theora/enquant.c",
#"theora/fdct.c",
"theora/fragment.c",
"theora/huffdec.c",
#"theora/huffenc.c",
"theora/idct.c",
"theora/info.c",
"theora/internal.c",
#"theora/mathops.c",
#"theora/mcenc.c",
"theora/quant.c",
#"theora/rate.c",
"theora/state.c",
#"theora/tokenize.c",
"theora/video_stream_theora.cpp",
]
sources_x86 = [
#"theora/x86/mmxencfrag.c",
#"theora/x86/mmxfdct.c",
"theora/x86/mmxfrag.c",
"theora/x86/mmxidct.c",
"theora/x86/mmxstate.c",
#"theora/x86/sse2fdct.c",
#"theora/x86/x86enc.c",
"theora/x86/x86state.c",
]
sources_x86_vc = [
#"theora/x86_vc/mmxencfrag.c",
#"theora/x86_vc/mmxfdct.c",
"theora/x86_vc/mmxfrag.c",
"theora/x86_vc/mmxidct.c",
"theora/x86_vc/mmxstate.c",
#"theora/x86_vc/x86enc.c",
"theora/x86_vc/x86state.c",
]
env.drivers_sources += sources
if (env["x86_opt_gcc"]):
env.drivers_sources += sources_x86
if (env["x86_opt_vc"]):
env.drivers_sources += sources_x86_vc
if (env["x86_opt_gcc"] or env["x86_opt_vc"]):
Import('env_drivers')
env_drivers.Append(CCFLAGS=["-DOC_X86_ASM"])

View file

@ -1,55 +0,0 @@
# export list for libtheora
_theora_version_string
_theora_version_number
_theora_encode_init
_theora_encode_YUVin
_theora_encode_packetout
_theora_encode_header
_theora_encode_comment
_theora_encode_tables
_theora_decode_header
_theora_decode_init
_theora_decode_packetin
_theora_decode_YUVout
_theora_control
_theora_packet_isheader
_theora_packet_iskeyframe
_theora_granule_shift
_theora_granule_frame
_theora_granule_time
_theora_info_init
_theora_info_clear
_theora_clear
_theora_comment_init
_theora_comment_add
_theora_comment_add_tag
_theora_comment_query
_theora_comment_query_count
_theora_comment_clear
_th_version_string
_th_version_number
_th_decode_headerin
_th_decode_alloc
_th_setup_free
_th_decode_ctl
_th_decode_packetin
_th_decode_ycbcr_out
_th_decode_free
_th_packet_isheader
_th_packet_iskeyframe
_th_granule_frame
_th_granule_time
_th_info_init
_th_info_clear
_th_comment_init
_th_comment_add
_th_comment_add_tag
_th_comment_query
_th_comment_query_count
_th_comment_clear
_th_encode_alloc
_th_encode_ctl
_th_encode_flushheader
_th_encode_packetout
_th_encode_ycbcr_in
_th_encode_free

View file

@ -10,6 +10,6 @@ f = open("os_unix_global_settings_path.cpp","wb")
f.write(g_set_p)
f.close()
env.add_source_files(env.drivers_sources,"*.cpp")
env.add_source_files(env.drivers_sources, "*.cpp")
Export('env')

View file

@ -1,36 +0,0 @@
Import('env')
sources = [
"vorbis/audio_stream_ogg_vorbis.cpp",
]
sources_lib = [
#"vorbis/analysis.c",
#"vorbis/barkmel.c",
"vorbis/bitrate.c",
"vorbis/block.c",
"vorbis/codebook.c",
"vorbis/envelope.c",
"vorbis/floor0.c",
"vorbis/floor1.c",
"vorbis/info.c",
"vorbis/lookup.c",
"vorbis/lpc.c",
"vorbis/lsp.c",
"vorbis/mapping0.c",
"vorbis/mdct.c",
"vorbis/psy.c",
#"vorbis/psytune.c",
"vorbis/registry.c",
"vorbis/res0.c",
"vorbis/sharedbook.c",
"vorbis/smallft.c",
"vorbis/synthesis.c",
#"vorbis/tone.c",
#"vorbis/vorbisenc.c",
"vorbis/vorbisfile.c",
"vorbis/window.c",
]
env.drivers_sources += sources
env.drivers_sources += sources_lib

View file

@ -1,115 +0,0 @@
Import('env')
webp_sources = [
"webp/enc/webpenc.c",\
"webp/enc/near_lossless.c",\
"webp/enc/frame.c",\
"webp/enc/alpha.c",\
"webp/enc/picture_csp.c",\
"webp/enc/vp8l.c",\
"webp/enc/picture_psnr.c",\
"webp/enc/delta_palettization.c",\
"webp/enc/syntax.c",\
"webp/enc/backward_references.c",\
"webp/enc/token.c",\
"webp/enc/analysis.c",\
"webp/enc/iterator.c",\
"webp/enc/picture_tools.c",\
"webp/enc/picture_rescale.c",\
"webp/enc/config.c",\
"webp/enc/tree.c",\
"webp/enc/cost.c",\
"webp/enc/picture.c",\
"webp/enc/quant.c",\
"webp/enc/filter.c",\
"webp/enc/histogram.c",\
"webp/image_loader_webp.cpp",\
"webp/utils/rescaler.c",\
"webp/utils/filters.c",\
"webp/utils/quant_levels_dec.c",\
"webp/utils/huffman.c",\
"webp/utils/thread.c",\
"webp/utils/quant_levels.c",\
"webp/utils/bit_writer.c",\
"webp/utils/bit_reader.c",\
"webp/utils/random.c",\
"webp/utils/utils.c",\
"webp/utils/huffman_encode.c",\
"webp/utils/color_cache.c",\
"webp/mux/muxinternal.c",\
"webp/mux/muxread.c",\
"webp/mux/anim_encode.c",\
"webp/mux/muxedit.c",\
"webp/dec/webp.c",\
"webp/dec/frame.c",\
"webp/dec/alpha.c",\
"webp/dec/vp8l.c",\
"webp/dec/io.c",\
"webp/dec/vp8.c",\
"webp/dec/idec.c",\
"webp/dec/tree.c",\
"webp/dec/buffer.c",\
"webp/dec/quant.c",\
"webp/demux/demux.c",\
"webp/demux/anim_decode.c",\
"webp/dsp/yuv.c",\
"webp/dsp/filters_sse2.c",\
"webp/dsp/dec_sse41.c",\
"webp/dsp/rescaler.c",\
"webp/dsp/lossless_sse2.c",\
"webp/dsp/alpha_processing_sse41.c",\
"webp/dsp/alpha_processing_sse2.c",\
"webp/dsp/filters.c",\
"webp/dsp/upsampling_mips_dsp_r2.c",\
"webp/dsp/dec_neon.c",\
"webp/dsp/enc_neon.c",\
"webp/dsp/lossless_enc_mips32.c",\
"webp/dsp/lossless_enc_sse2.c",\
"webp/dsp/upsampling.c",\
"webp/dsp/lossless_enc_neon.c",\
"webp/dsp/alpha_processing.c",\
"webp/dsp/cost_sse2.c",\
"webp/dsp/dec_mips32.c",\
"webp/dsp/enc_avx2.c",\
"webp/dsp/rescaler_mips32.c",\
"webp/dsp/enc.c",\
"webp/dsp/lossless_enc_sse41.c",\
"webp/dsp/cost_mips32.c",\
"webp/dsp/lossless_mips_dsp_r2.c",\
"webp/dsp/filters_mips_dsp_r2.c",\
"webp/dsp/upsampling_neon.c",\
"webp/dsp/alpha_processing_mips_dsp_r2.c",\
"webp/dsp/enc_mips_dsp_r2.c",\
"webp/dsp/lossless.c",\
"webp/dsp/yuv_mips_dsp_r2.c",\
"webp/dsp/cost_mips_dsp_r2.c",\
"webp/dsp/argb.c",\
"webp/dsp/dec_sse2.c",\
"webp/dsp/rescaler_sse2.c",\
"webp/dsp/enc_sse41.c",\
"webp/dsp/argb_mips_dsp_r2.c",\
"webp/dsp/lossless_enc_mips_dsp_r2.c",\
"webp/dsp/dec_clip_tables.c",\
"webp/dsp/yuv_mips32.c",\
"webp/dsp/cpu.c",\
"webp/dsp/dec.c",\
"webp/dsp/argb_sse2.c",\
"webp/dsp/lossless_neon.c",\
"webp/dsp/lossless_enc.c",\
"webp/dsp/enc_mips32.c",\
"webp/dsp/cost.c",\
"webp/dsp/rescaler_mips_dsp_r2.c",\
"webp/dsp/dec_mips_dsp_r2.c",\
"webp/dsp/rescaler_neon.c",\
"webp/dsp/yuv_sse2.c",\
"webp/dsp/enc_sse2.c",\
"webp/dsp/upsampling_sse2.c"
]
env.drivers_sources+=webp_sources
#env.add_source_files(env.drivers_sources, webp_sources)
Export('env')

View file

@ -1,51 +0,0 @@
// Copyright 2015 Google Inc. All Rights Reserved.
//
// Use of this source code is governed by a BSD-style license
// that can be found in the COPYING file in the root of the source
// tree. An additional intellectual property rights grant can be found
// in the file PATENTS. All contributing project authors may
// be found in the AUTHORS file in the root of the source tree.
// -----------------------------------------------------------------------------
//
#ifndef WEBP_WEBP_EXTRAS_H_
#define WEBP_WEBP_EXTRAS_H_
#include "./types.h"
#ifdef __cplusplus
extern "C" {
#endif
#include "./encode.h"
#define WEBP_EXTRAS_ABI_VERSION 0x0000 // MAJOR(8b) + MINOR(8b)
//------------------------------------------------------------------------------
// Returns the version number of the extras library, packed in hexadecimal using
// 8bits for each of major/minor/revision. E.g: v2.5.7 is 0x020507.
WEBP_EXTERN(int) WebPGetExtrasVersion(void);
//------------------------------------------------------------------------------
// Ad-hoc colorspace importers.
// Import luma sample (gray scale image) into 'picture'. The 'picture'
// width and height must be set prior to calling this function.
WEBP_EXTERN(int) WebPImportGray(const uint8_t* gray, WebPPicture* picture);
// Import rgb sample in RGB565 packed format into 'picture'. The 'picture'
// width and height must be set prior to calling this function.
WEBP_EXTERN(int) WebPImportRGB565(const uint8_t* rgb565, WebPPicture* pic);
// Import rgb sample in RGB4444 packed format into 'picture'. The 'picture'
// width and height must be set prior to calling this function.
WEBP_EXTERN(int) WebPImportRGB4444(const uint8_t* rgb4444, WebPPicture* pic);
//------------------------------------------------------------------------------
#ifdef __cplusplus
} // extern "C"
#endif
#endif /* WEBP_WEBP_EXTRAS_H_ */

View file

@ -1,5 +1,5 @@
Import('env')
env.add_source_files(env.drivers_sources,"*.cpp")
env.add_source_files(env.drivers_sources, "*.cpp")
Export('env')

24
drivers/zlib/SCsub Normal file
View file

@ -0,0 +1,24 @@
Import('env')
# Not cloning the env, the includes need to be accessible for core/
# Thirdparty source files
# No check here as already done in drivers/SCsub
thirdparty_dir = "#thirdparty/zlib/"
thirdparty_sources = [
"adler32.c",
"compress.c",
"crc32.c",
"deflate.c",
"infback.c",
"inffast.c",
"inflate.c",
"inftrees.c",
"trees.c",
"uncompr.c",
"zutil.c",
]
thirdparty_sources = [thirdparty_dir + file for file in thirdparty_sources]
env.add_source_files(env.drivers_sources, thirdparty_sources)
env.Append(CPPPATH = [thirdparty_dir])

7
modules/chibi/SCsub Normal file
View file

@ -0,0 +1,7 @@
Import('env')
Import('env_modules')
env_chibi = env_modules.Clone()
# Godot source files
env_chibi.add_source_files(env.modules_sources, "*.cpp")

6
modules/chibi/config.py Normal file
View file

@ -0,0 +1,6 @@
def can_build(platform):
return True
def configure(env):
pass

Some files were not shown because too many files have changed in this diff Show more