diff options
author | Corbin Simpson <MostAwesomeDude@gmail.com> | 2008-07-18 11:06:34 -0700 |
---|---|---|
committer | Alex Deucher <alexdeucher@gmail.com> | 2008-08-25 06:19:04 -0400 |
commit | ca51f4f37e1dbf53bf7ffc0e8f612e9609e11209 (patch) | |
tree | 8ff86e7ed2e19f6d45b979fc80eeba8002b96ff6 /src | |
parent | 1cf7a5494fa94e8d9f30f9b2905dfbe6d4faa445 (diff) |
Add bicubic texture table, as well as the script used to (re)generate it. To regenerate, just run "python bicubic_table.py > bicubic_table.h".
Diffstat (limited to 'src')
-rw-r--r-- | src/bicubic_table.h | 130 | ||||
-rwxr-xr-x | src/bicubic_table.py | 38 |
2 files changed, 168 insertions, 0 deletions
diff --git a/src/bicubic_table.h b/src/bicubic_table.h new file mode 100644 index 00000000..b61b9ba3 --- /dev/null +++ b/src/bicubic_table.h @@ -0,0 +1,130 @@ +const float[] bicubic_tex = { + 0.2, 1.0, 0.833333333333, 0.166666666667, + 0.204088720925, 0.992187965834, 0.829396724701, 0.170603275299, + 0.208229306439, 0.984378641369, 0.825400034587, 0.174599965413, + 0.212420907874, 0.976574510623, 0.821344216665, 0.178655783335, + 0.216662699005, 0.968777828797, 0.817230224609, 0.182769775391, + 0.220953875426, 0.960990640339, 0.813059012095, 0.186940987905, + 0.225293653935, 0.953214795864, 0.808831532796, 0.191168467204, + 0.229681271957, 0.945451967972, 0.804548740387, 0.195451259613, + 0.234115986983, 0.937703665988, 0.800211588542, 0.199788411458, + 0.238597076022, 0.929971249668, 0.795821030935, 0.204178969065, + 0.243123835089, 0.922255941932, 0.79137802124, 0.20862197876, + 0.247695578698, 0.914558840653, 0.786883513133, 0.213116486867, + 0.252311639383, 0.90688092957, 0.782338460286, 0.217661539714, + 0.256971367229, 0.899223088369, 0.777743816376, 0.222256183624, + 0.261674129428, 0.891586101989, 0.773100535075, 0.226899464925, + 0.266419309847, 0.883970669194, 0.768409570058, 0.231590429942, + 0.27120630861, 0.876377410468, 0.763671875, 0.236328125, + 0.276034541704, 0.868806875283, 0.758888403575, 0.241111596425, + 0.280903440584, 0.861259548768, 0.754060109456, 0.245939890544, + 0.285812451814, 0.853735857846, 0.74918794632, 0.25081205368, + 0.290761036698, 0.846236176857, 0.744272867839, 0.255727132161, + 0.295748670944, 0.838760832722, 0.739315827688, 0.260684172312, + 0.300774844327, 0.831310109672, 0.734317779541, 0.265682220459, + 0.305839060373, 0.823884253585, 0.729279677073, 0.270720322927, + 0.310940836049, 0.816483475952, 0.724202473958, 0.275797526042, + 0.316079701469, 0.80910795751, 0.719087123871, 0.280912876129, + 0.321255199604, 0.801757851568, 0.713934580485, 0.286065419515, + 0.326466886014, 0.794433287044, 0.708745797475, 0.291254202525, + 0.331714328576, 0.787134371247, 0.703521728516, 0.296478271484, + 0.336997107235, 0.779861192413, 0.698263327281, 0.301736672719, + 0.342314813753, 0.772613822026, 0.692971547445, 0.307028452555, + 0.347667051478, 0.76539231694, 0.687647342682, 0.312352657318, + 0.353053435115, 0.758196721311, 0.682291666667, 0.317708333333, + 0.358473590501, 0.751027068365, 0.676905473073, 0.323094526927, + 0.363927154404, 0.743883382007, 0.671489715576, 0.328510284424, + 0.369413774313, 0.736765678299, 0.66604534785, 0.33395465215, + 0.374933108243, 0.729673966794, 0.660573323568, 0.339426676432, + 0.380484824551, 0.722608251764, 0.655074596405, 0.344925403595, + 0.386068601748, 0.715568533318, 0.649550120036, 0.350449879964, + 0.391684128331, 0.708554808415, 0.644000848134, 0.355999151866, + 0.397331102613, 0.701567071798, 0.638427734375, 0.361572265625, + 0.403009232558, 0.694605316836, 0.632831732432, 0.367168267568, + 0.40871823563, 0.687669536295, 0.62721379598, 0.37278620402, + 0.414457838638, 0.680759723045, 0.621574878693, 0.378425121307, + 0.420227777594, 0.673875870699, 0.615915934245, 0.384084065755, + 0.426027797575, 0.6670179742, 0.610237916311, 0.389762083689, + 0.431857652583, 0.66018603035, 0.604541778564, 0.395458221436, + 0.437717105418, 0.653380038302, 0.598828474681, 0.401171525319, + 0.443605927552, 0.6466, 0.593098958333, 0.406901041667, + 0.449523899007, 0.639845920588, 0.587354183197, 0.412645816803, + 0.455470808236, 0.633117808778, 0.581595102946, 0.418404897054, + 0.461446452007, 0.626415677192, 0.575822671254, 0.424177328746, + 0.467450635295, 0.619739542669, 0.570037841797, 0.429962158203, + 0.473483171168, 0.613089426553, 0.564241568247, 0.435758431753, + 0.479543880687, 0.606465354949, 0.558434804281, 0.441565195719, + 0.485632592794, 0.59986735897, 0.552618503571, 0.447381496429, + 0.491749144218, 0.593295474951, 0.546793619792, 0.453206380208, + 0.497893379365, 0.586749744657, 0.540961106618, 0.459038893382, + 0.504065150224, 0.580230215471, 0.535121917725, 0.464878082275, + 0.510264316266, 0.573736940568, 0.529277006785, 0.470722993215, + 0.51649074434, 0.567269979082, 0.523427327474, 0.476572672526, + 0.522744308578, 0.560829396251, 0.517573833466, 0.482426166534, + 0.529024890292, 0.554415263567, 0.511717478434, 0.488282521566, + 0.535332377868, 0.548027658908, 0.505859216054, 0.494140783946, + 0.541666666667, 0.541666666667, 0.5, 0.5, + 0.548027658908, 0.535332377868, 0.494140783946, 0.505859216054, + 0.554415263567, 0.529024890292, 0.488282521566, 0.511717478434, + 0.560829396251, 0.522744308578, 0.482426166534, 0.517573833466, + 0.567269979082, 0.51649074434, 0.476572672526, 0.523427327474, + 0.573736940568, 0.510264316266, 0.470722993215, 0.529277006785, + 0.580230215471, 0.504065150224, 0.464878082275, 0.535121917725, + 0.586749744657, 0.497893379365, 0.459038893382, 0.540961106618, + 0.593295474951, 0.491749144218, 0.453206380208, 0.546793619792, + 0.59986735897, 0.485632592794, 0.447381496429, 0.552618503571, + 0.606465354949, 0.479543880687, 0.441565195719, 0.558434804281, + 0.613089426553, 0.473483171168, 0.435758431753, 0.564241568247, + 0.619739542669, 0.467450635295, 0.429962158203, 0.570037841797, + 0.626415677192, 0.461446452007, 0.424177328746, 0.575822671254, + 0.633117808778, 0.455470808236, 0.418404897054, 0.581595102946, + 0.639845920588, 0.449523899007, 0.412645816803, 0.587354183197, + 0.6466, 0.443605927552, 0.406901041667, 0.593098958333, + 0.653380038302, 0.437717105418, 0.401171525319, 0.598828474681, + 0.66018603035, 0.431857652583, 0.395458221436, 0.604541778564, + 0.6670179742, 0.426027797575, 0.389762083689, 0.610237916311, + 0.673875870699, 0.420227777594, 0.384084065755, 0.615915934245, + 0.680759723045, 0.414457838638, 0.378425121307, 0.621574878693, + 0.687669536295, 0.40871823563, 0.37278620402, 0.62721379598, + 0.694605316836, 0.403009232558, 0.367168267568, 0.632831732432, + 0.701567071798, 0.397331102613, 0.361572265625, 0.638427734375, + 0.708554808415, 0.391684128331, 0.355999151866, 0.644000848134, + 0.715568533318, 0.386068601748, 0.350449879964, 0.649550120036, + 0.722608251764, 0.380484824551, 0.344925403595, 0.655074596405, + 0.729673966794, 0.374933108243, 0.339426676432, 0.660573323568, + 0.736765678299, 0.369413774313, 0.33395465215, 0.66604534785, + 0.743883382007, 0.363927154404, 0.328510284424, 0.671489715576, + 0.751027068365, 0.358473590501, 0.323094526927, 0.676905473073, + 0.758196721311, 0.353053435115, 0.317708333333, 0.682291666667, + 0.76539231694, 0.347667051478, 0.312352657318, 0.687647342682, + 0.772613822026, 0.342314813753, 0.307028452555, 0.692971547445, + 0.779861192413, 0.336997107235, 0.301736672719, 0.698263327281, + 0.787134371247, 0.331714328576, 0.296478271484, 0.703521728516, + 0.794433287044, 0.326466886014, 0.291254202525, 0.708745797475, + 0.801757851568, 0.321255199604, 0.286065419515, 0.713934580485, + 0.80910795751, 0.316079701469, 0.280912876129, 0.719087123871, + 0.816483475952, 0.310940836049, 0.275797526042, 0.724202473958, + 0.823884253585, 0.305839060373, 0.270720322927, 0.729279677073, + 0.831310109672, 0.300774844327, 0.265682220459, 0.734317779541, + 0.838760832722, 0.295748670944, 0.260684172312, 0.739315827688, + 0.846236176857, 0.290761036698, 0.255727132161, 0.744272867839, + 0.853735857846, 0.285812451814, 0.25081205368, 0.74918794632, + 0.861259548768, 0.280903440584, 0.245939890544, 0.754060109456, + 0.868806875283, 0.276034541704, 0.241111596425, 0.758888403575, + 0.876377410468, 0.27120630861, 0.236328125, 0.763671875, + 0.883970669194, 0.266419309847, 0.231590429942, 0.768409570058, + 0.891586101989, 0.261674129428, 0.226899464925, 0.773100535075, + 0.899223088369, 0.256971367229, 0.222256183624, 0.777743816376, + 0.90688092957, 0.252311639383, 0.217661539714, 0.782338460286, + 0.914558840653, 0.247695578698, 0.213116486867, 0.786883513133, + 0.922255941932, 0.243123835089, 0.20862197876, 0.79137802124, + 0.929971249668, 0.238597076022, 0.204178969065, 0.795821030935, + 0.937703665988, 0.234115986983, 0.199788411458, 0.800211588542, + 0.945451967972, 0.229681271957, 0.195451259613, 0.804548740387, + 0.953214795864, 0.225293653935, 0.191168467204, 0.808831532796, + 0.960990640339, 0.220953875426, 0.186940987905, 0.813059012095, + 0.968777828797, 0.216662699005, 0.182769775391, 0.817230224609, + 0.976574510623, 0.212420907874, 0.178655783335, 0.821344216665, + 0.984378641369, 0.208229306439, 0.174599965413, 0.825400034587, + 0.992187965834, 0.204088720925, 0.170603275299, 0.829396724701, + NULL } diff --git a/src/bicubic_table.py b/src/bicubic_table.py new file mode 100755 index 00000000..45101173 --- /dev/null +++ b/src/bicubic_table.py @@ -0,0 +1,38 @@ +#!/usr/bin/python + +def texgen(): + + tex = [] + + for i in range(0,512,4): + + a = i / 512.0 + a2 = a ** 2 + a3 = a ** 3 + + w0 = 1 / 6.0 * (-a3 + 3 * a2 + -3 * a + 1) + w1 = 1 / 6.0 * (3 * a3 + -6 * a2 + 4) + w2 = 1 / 6.0 * (-3 * a3 + 3 * a2 + 3 * a + 1) + w3 = 1 / 6.0 * a3 + + tex.append(1 - (w1 / (w0 + w1)) + a) + tex.append(1 + (w3 / (w2 + w3)) - a) + tex.append(w0 + w1) + tex.append(w2 + w3) + + return tex + +def printrow(l, offset): + + seq = [ str(i) for i in l[offset:offset+4] ] + return "\t" + ", ".join(seq) + "," + +l = texgen() + +print "const float[] bicubic_tex = {" + +for i in range(0, 512, 4): + + print printrow(l, i) + +print "\tNULL }" |