Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

Infinite Compression techniques

Name: FrozenVoid !!mJCwdV5J0Xy2A21 2011-11-09 9:48

I present a system which would be capable of unlimited compression of any data.
Theory:
Every number can be mapped 1:1 to positive unsigned integer(representing the number itself)
Every integer can be represented as range of floating point numbers
i.e. 3 is range from 3.000... to 3.999...
Now if we multiply the original number by 10: 3*10=30
the range is also multiplied, 30.000... to 39.999... all of these numbers divided by 10 give 3 as integer.
Suppose we can alter original number by shifting the range up or down by supplying an extra factor
3+1 or 3-1, with these 3.000...-3.999... ranges become 4.000...-4.999.. and 2.000...-2.999... respectively
The compression is as follows. The original number is multiplied by a huge scale to create number
which is at least twice longer in file length, giving very large floating point range.
Now we multiply this range by adding a 64bit scale modifier(applied to original number) which shifts the range up and down so the space of the range is now 2^64 times bigger than original.
The compression is search for Any number in that huge range which can be represented more compactly
when one of these is found(for some function like e^A) A is recorded along with scale modifier.
Since the range is enormous there are certainly some numbers which can be represented in short form as
function(x)=number_in_range.
The decoding is as follows,function(x) is runs and results number is divided by scale, then a scale modifier is applied
to get the original number, which is converted to file.

Name: FrozenVoid !!mJCwdV5J0Xy2A21 2011-11-11 13:55

>>80
I don't ever inspect asm output unless the rdtsc() is high enough. rdtsc() can be inserted as debug feature, asm output is manual, time consuming search (which isn't guaranteed to be correct vs rdtsc() live results).

Name: FrozenVoid !!mJCwdV5J0Xy2A21 2011-11-11 13:57

Besides this code does not call rdtsc(it is added from void.h for GCC)

Name: Anonymous 2011-11-11 14:02

im gonna report http://www.amazon.com/Touhou-Project-Adorable-Pretty-Anime/dp/B004AB4R3G to the feminists and outlaw touhou bc it encourages pedophilia!!!!

Name: Anonymous 2011-11-11 15:47

>>83
lol >implying feminazists can change shit

Name: Anonymous 2011-11-11 16:05

>>84
They somehow managed to get some porn games taken off non-japanse Amazon. I blame japanese people for being intimidated too easily (not that this changed anything, it just made them hate gaijin more and block non-japanese IPs from some of their sites even more than they used to).

Name: Anonymous 2011-11-11 16:57

GUYS

STOP FUCKING SUPPORTING FROZENAUTIST

HE IS BATSHIT INSANE, AND SO ARE YOU FOR SUPPORTING THIS DICKWAD

ALL HE WANTS IS TO STEAL YOUR MONEY, YOU STUPID FUCKING CUNTS

Name: Anonymous 2011-11-11 16:58

>>86
Fuck off, he's probably the only competent programmer on /prog/.

Name: FrozenVoid !!mJCwdV5J0Xy2A21 2011-11-11 17:01

I think the window multiplier search could be replaced by directly multiplying
(res1=base*power1)*(res2=base*power2)... until the result reaches into initial window(K*Scalemodmax)without Kmod)
though this would introduce additional storage for each power

Name: FrozenVoid !!mJCwdV5J0Xy2A21 2011-11-11 17:19

for the power chain the  (amount of powers*512bits) has to be less than filesize to be compressed.
Res1,res2 are full precision, while power1,power2 are 512bit precision

Name: Anonymous 2011-11-11 18:14

>>87
you're probably just as much of an autistic furry as FrozenNigger is

Name: Anonymous 2011-11-11 18:16

>>90
Stop projecting already.

Name: Anonymous 2011-11-11 18:33

>>91
Oh... now i get it!

You're just FrozenFurry himself trying to make it look like someone else is interested in the autism shat out by FrozenJew

autism++

Name: Anonymous 2011-11-11 18:43

>>92
I don't think FrozenVoid would do something like that and I know that I'm not him. Stop being so butthurt about your inability to program anything worth mention, so that you have to troll people who actually have some clue about computer science.

Name: Anonymous 2011-11-11 18:43

*grabs dick*

Name: Anonymous 2011-11-11 23:21

>>88
How this can follow from having a window multiplier, that you suddenly want to multiply bases instead of result? it doesn't make sense and its way more space to store powers.

Name: Anonymous 2011-11-11 23:44

>>92-93
What are you guys talking about? FV doesn't post here anymore.

Name: FrozenVoid !!mJCwdV5J0Xy2A21 2011-11-11 23:55

>>95
The window multplier can be generated programmaticalilly instead of storing it as huge Kmod number.
Kmod=windowbase^power. now instead of having two bases, you can use the result from base^power with another power by
making a multiply windowbase^power * base^power  becomes base^power * base^power
so if windowbase^power power precision is not enough for one multiply it becomes a chain
base^power1*base^power2*base^power3*base^power4...
with each power approximating result closer to window or initial number(window can be unused, since its fast enough to converge using powers vs using scaled mod for window construction)
The idea is that 1+(1e-100)(actuall e-X can be higher) can converge fast enough to avoid using window Kmod or window itself.
Also 1+(1e-100) is quite low and for a chain of multiplies a 1+(1e-10000) or even lower(e-1000000) should be used(convergence for power is directly proportional on how precises the ^power becomes, which makes lower bases more desirable unlike the case with Kmod, where bases us uses once and Kmod/Scalemod fixes the distance with bruteforce of adding/multiplying to reach into initial window).
And the chain of powers can be added at once(since a^b(*/)a^c=a^*(b-/+c) to store a combined power at once as one number.
Its an interesting method. Though Kmod can be generated by functions other than exponentiation, this is simplest way to reach to Z(even allowing not using window, since base^combinedpower can be converted to integer directly), with the caveat it may quite alot of space for power, compared to more complex Kmod/Scalemod combos(which can avoid storing alot of number data by making it abstracted in function call to generate the data, e.g. Kmod=func(Kmod_gen) Scalemod=func(Scale_gen_)).

Name: FrozenVoid !!mJCwdV5J0Xy2A21 2011-11-12 0:08

Also, adding/substraction of base^power+-base^power2 should converge faster and store less powers

Name: FrozenVoid !!mJCwdV5J0Xy2A21 2011-11-12 0:17

Another system entirely would be:
array of bases AB(e.g. 256 bases):
pick one AB[x] which x^power is closest to Z, (thus storing less power info per iteration of converge loop, since unnecessary precision is avoided)

Name: FrozenVoid !!mJCwdV5J0Xy2A21 2011-11-12 0:36

The base can be eliminated too. It could be chain of powers calculated as
power^(power^power)+/-power1^(power1^power1)+/-power2^(power2^power2).. converge to z

Name: FrozenVoid !!mJCwdV5J0Xy2A21 2011-11-12 1:30

>>100
The code for power chain is much simpler but it doesn't have any good compression ratio:
//====Headers
#define VERSION "Infinity Compressor 1.03-powerchain test\n"
//..\gcc -O2  main.c -lmpfr -lgmp  -o a.exe
//the code is of bit of mess, this is unchunked, single file at onc eversion which takes alot of time to search
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <float.h>
#include <time.h>
#include <gmp.h>   //using libgmp.a
#include <mpfr.h>
//======Types
#define u1 unsigned char
#define u2 unsigned short
#define u4 unsigned int
#define u8 unsigned long long
#define s1 signed char
#define s2 signed short
#define s4 signed int
#define s8 signed long long
#define f2 short float
#define f4 float
#define f8 double
#define f10 long double
//====Bithacks
#define setb(o,p) (o|=(1<<p))      //byte| 1<< pos  
#define clrb(o,p) (o&=(~(1<<p)))  // byte | 11101111
#define togb(o,p) (o^=(1<<p))
#define chkb(o,p) ((o>>p)&1)
#define bitchar(bitchar_bit)    (48|bitchar_bit) // 48|0 or 1
//====Func GCC
static __inline__ u8 rdtsc(void){u8 x;
 __asm__ volatile (".byte 0x0f, 0x31" : "=A" (x));     return x;}

u8 fsize(u1* filename){
FILE* tfile=fopen(filename,"rb");
if(!tfile){perror(filename);return 0;}
fseek(tfile,0,SEEK_END);
u8 sz=(u8)(ftell(tfile));fclose(tfile);return sz;}

u1* getcontent(u1*filename){//file to buffer
u8 size=fsize(filename);//
if(!size){perror("Zero length content"); return NULL;}
u1* res=malloc(size);
if(!res){perror("Malloc failure");return NULL;}
FILE* inpfile=fopen(filename,"rb");
if(!inpfile){perror("File cannot be read");return NULL;}
u8 findex=(u8)fread(res,1,size,inpfile);fclose(inpfile);
if(findex!=size){perror("size mismatch");return NULL;}
return res;}


void readcontent(u1* filename,u1* storage){
if(!filename){perror("Invalid filename"); return;}
u8 inpsize=fsize(filename);
if(!inpsize){perror("File empty");return;}
FILE* in=fopen(filename,"rb");
if(!in){perror(filename);return;}
storage=realloc(storage,inpsize);
if(!storage){perror("Malloc failure");return;}
u8 findex=(u8)fread(storage,1,inpsize,in);
fclose(in);
if(findex!=inpsize){perror("Read size mismatch");return;}}

void writecontent(u1* filename,u1* content,u8 size){
FILE* out=fopen(filename,"wb");
if(!out){perror(filename);return;}
u8 findex=(u8)fwrite(content,1,size,out);fclose(out);
if(findex!=size) perror("Write size mismatch");}

void buf2mpz(u1* string,mpz_t num,u8 size){
if(!string){perror("NULL string");return;}
if(!num){perror("Invalid mpz_t");return;}
if(!size){perror("Zero-length string");return;}
mpz_import(num,size, 1,1, -1, 0,string);
}

u1* mpz2buf(mpz_t num){
u1* res=malloc( (mpz_sizeinbase(num,16)/2)+2);
mpz_export(res,NULL,1,1,-1,0,num);return res;}
#define loop(loopx,loopy) for(loopx=0;loopx<loopy;loopx++)

#define fextension(string) strrchr(string,'.')?:".???"
#define isbit(xint,ypos)    ((xint)&(1<<ypos)) 
#define frop(x,filename) FILE* x=fopen(filename,"rb")
#define fwop(x,filename) FILE* x=fopen(filename,"wb")

#define outx(x,fil) fwrite(&x,1,sizeof(x),fil);
#define mpz(x) mpz_t x;mpz_init(x);
#define mpf(x) mpfr_t x;mpfr_init(x);
//static array
#define mpfr(x) MPFR_DECL_INIT(x, 53)  //returns float
#define DEBUG 1 //debug
#define DEBUG2 1 //symbolics
#define DEBUG3 1 //verbose
#define POWERPREC 512 //more=slower, more precise
#define fdisp(x) puts("");mpf_out_str(stdout,10, 0,x);
//===========MAIN======================
#define setch(o,ch,pos)  (o|=ch<<(pos<<1))  // pos 0-3,ch=0-3
#define getbb(o,pos) ((o>>(pos<<1))&3) //get 001100>>2 &3
#define getb0(b) (b&3)
#define getb1(b) ((b>>2)&3)
#define getb2(b) ((b>>4)&3)
#define getb3(b) ((b>>6)&3)
#define PR0 MPFR_RNDN
#define MAXPOW "10"
#define MINPOW "0"
//power^(power^power) from 10^(10^10) to 0
 //(1<<(pos<<1))
//========MAIN===
//code is from another compressor i wrote
void main(int argc,char**argv){
if(!argv[1]){printf("Syntax:cmp inputfile [-d=decode]");exit(1);}
//-----DECODE--TODO-----
if(argv[2] && !strcmp(argv[2],"-d")){//decode Data
FILE* inp=fopen(argv[1],"rb");
if(!inp){perror("No file");exit(2);}
u8 outsize;fread(&outsize,8,1,inp);
if(DEBUG)printf("\nFilesize:%llu",outsize);
u8 bitlen=outsize*8;mpfr_set_default_prec( bitlen);
mpf(Power);//read powers and signs.
//todo


mpz(Z);
//mpfr_get_z(Z,Result,PR0);
FILE* output=fopen("Decode.dat","wb");
mpz_out_raw(output, Z);//slightly larger
//fwrite(&out,1,outsize,output);//end: does not work
exit(10);
}
//------INPUT--------

if(DEBUG3)printf(VERSION);
/*
  >>  MPFR_RNDN: round to nearest (roundTiesToEven in IEEE 754-2008),
    MPFR_RNDZ: round toward zero (roundTowardZero in IEEE 754-2008),
    MPFR_RNDU: round toward plus infinity (roundTowardPositive in IEEE 754-2008),
    MPFR_RNDD: round toward minus infinity (roundTowardNegative in IEEE 754-2008),
    MPFR_RNDA: round away from zero.
*/
FILE* output=fopen("Result.cmp","wb");
u8 inpsize=fsize(argv[1]);
fwrite(&inpsize,8,1,output);//write inpsize to avoid misdecoding;
u8 bitlen=inpsize*8;
s4 check,checklow,checkhi,checkold;
if(!inpsize){perror("input size invalid");return;};
u1* input=getcontent(argv[1]);
//convert to mpz
mpfr_set_default_prec( bitlen);
mpz(Z);buf2mpz(input,Z,inpsize);
mpf(median);mpf(logs);//Z->median
mpfr_set_z(median,Z,PR0);
mpf(Result);//Power is 512 bits;result stores Base^Power
mpf(Resbase);//p^p=resbase
mpfr_t Power;mpfr_init2(Power,POWERPREC);
mpfr_t Powermin;mpfr_init2(Powermin,POWERPREC);
mpfr_t Powermax;mpfr_init2(Powermax,POWERPREC);
mpfr_t Powerold;mpfr_init2(Powerold,POWERPREC);
mpfr_set_str(Powermin,MINPOW,10,PR0);
mpfr_set_str(Powermax,MAXPOW,10,PR0);
mpfr_set_str(Powerold,"-1",10,PR0);
mainloop:;//search for closest match
//power=avg(Powermax,Powermin)
mpfr_add(Power,Powermax,Powermin,PR0);
mpfr_div_2ui(Power,Power,1,PR0);
checkold=mpfr_cmp(Power,Powerold);
mpfr_pow(Resbase,Power,Power,PR0);
mpfr_pow(Result,Power,Resbase,PR0);
check=mpfr_cmp(Result,median);
if(checkold==0){if(DEBUG2)printf("#\n");
//Write power to output, ssubstract Median-Result
//if neg, fprintf "-" to o
mpfr_sub(median,median,Result,PR0);
if(mpfr_cmp_si(median,0)<0){
fprintf(output,"-");mpfr_abs(median,median,PR0);}

mpfr_log2(logs,median,PR0);
id(DEBUG3)printf("Distance=%d",mpfr_get_ui(logs,PR0));
mpfr_out_str(output,16,0,Power,PR0);
mpfr_set_str(Powermin,MINPOW,10,PR0);
mpfr_set_str(Powermax,MAXPOW,10,PR0);
mpfr_set_str(Powerold,"-1",10,PR0);
if(mpfr_cmp_si(logs,1)<0){puts("::Final result reached");exit(2);}; goto mainloop;}
if(check>0){if(DEBUG2)printf("+");
mpfr_set(Powerold,Power,PR0);
mpfr_swap(Powermax,Power);
goto mainloop;}
if(check<0){if(DEBUG2)printf("-");
mpfr_set(Powerold,Power,PR0);
mpfr_swap(Powermin,Power);
goto mainloop;}
//inside initial window
mpfr_out_str(output,16,0,Power,PR0);//write final power(hex)
//====================================
; }

Name: FrozenVoid !!mJCwdV5J0Xy2A21 2011-11-12 1:42

Fixed some code and reduced POWERPREC
//====Headers
#define VERSION "Infinity Compressor 1.04 power chain\n"
//..\gcc -O2  main.c -lmpfr -lgmp  -o a.exe
//the code is of bit of mess, this is unchunked, single file at onc eversion which takes alot of time to search
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <float.h>
#include <time.h>
#include <gmp.h>   //using libgmp.a
#include <mpfr.h>
//======Types
#define u1 unsigned char
#define u2 unsigned short
#define u4 unsigned int
#define u8 unsigned long long
#define s1 signed char
#define s2 signed short
#define s4 signed int
#define s8 signed long long
#define f2 short float
#define f4 float
#define f8 double
#define f10 long double
//====Bithacks
#define setb(o,p) (o|=(1<<p))      //byte| 1<< pos  
#define clrb(o,p) (o&=(~(1<<p)))  // byte | 11101111
#define togb(o,p) (o^=(1<<p))
#define chkb(o,p) ((o>>p)&1)
#define bitchar(bitchar_bit)    (48|bitchar_bit) // 48|0 or 1
//====Func GCC
static __inline__ u8 rdtsc(void){u8 x;
 __asm__ volatile (".byte 0x0f, 0x31" : "=A" (x));     return x;}

u8 fsize(u1* filename){
FILE* tfile=fopen(filename,"rb");
if(!tfile){perror(filename);return 0;}
fseek(tfile,0,SEEK_END);
u8 sz=(u8)(ftell(tfile));fclose(tfile);return sz;}

u1* getcontent(u1*filename){//file to buffer
u8 size=fsize(filename);//
if(!size){perror("Zero length content"); return NULL;}
u1* res=malloc(size);
if(!res){perror("Malloc failure");return NULL;}
FILE* inpfile=fopen(filename,"rb");
if(!inpfile){perror("File cannot be read");return NULL;}
u8 findex=(u8)fread(res,1,size,inpfile);fclose(inpfile);
if(findex!=size){perror("size mismatch");return NULL;}
return res;}


void readcontent(u1* filename,u1* storage){
if(!filename){perror("Invalid filename"); return;}
u8 inpsize=fsize(filename);
if(!inpsize){perror("File empty");return;}
FILE* in=fopen(filename,"rb");
if(!in){perror(filename);return;}
storage=realloc(storage,inpsize);
if(!storage){perror("Malloc failure");return;}
u8 findex=(u8)fread(storage,1,inpsize,in);
fclose(in);
if(findex!=inpsize){perror("Read size mismatch");return;}}

void writecontent(u1* filename,u1* content,u8 size){
FILE* out=fopen(filename,"wb");
if(!out){perror(filename);return;}
u8 findex=(u8)fwrite(content,1,size,out);fclose(out);
if(findex!=size) perror("Write size mismatch");}

void buf2mpz(u1* string,mpz_t num,u8 size){
if(!string){perror("NULL string");return;}
if(!num){perror("Invalid mpz_t");return;}
if(!size){perror("Zero-length string");return;}
mpz_import(num,size, 1,1, -1, 0,string);
}

u1* mpz2buf(mpz_t num){
u1* res=malloc( (mpz_sizeinbase(num,16)/2)+2);
mpz_export(res,NULL,1,1,-1,0,num);return res;}
#define loop(loopx,loopy) for(loopx=0;loopx<loopy;loopx++)

#define fextension(string) strrchr(string,'.')?:".???"
#define isbit(xint,ypos)    ((xint)&(1<<ypos)) 
#define frop(x,filename) FILE* x=fopen(filename,"rb")
#define fwop(x,filename) FILE* x=fopen(filename,"wb")

#define outx(x,fil) fwrite(&x,1,sizeof(x),fil);
#define mpz(x) mpz_t x;mpz_init(x);
#define mpf(x) mpfr_t x;mpfr_init(x);
//static array
#define mpfr(x) MPFR_DECL_INIT(x, 53)  //returns float
#define DEBUG 1 //debug
#define DEBUG2 1 //symbolics
#define DEBUG3 1 //verbose
#define POWERPREC 200 //more=slower, more precise
#define fdisp(x) puts("");mpf_out_str(stdout,10, 0,x);
//===========MAIN======================
#define setch(o,ch,pos)  (o|=ch<<(pos<<1))  // pos 0-3,ch=0-3
#define getbb(o,pos) ((o>>(pos<<1))&3) //get 001100>>2 &3
#define getb0(b) (b&3)
#define getb1(b) ((b>>2)&3)
#define getb2(b) ((b>>4)&3)
#define getb3(b) ((b>>6)&3)
#define PR0 MPFR_RNDN
#define MAXPOW "10"
#define MINPOW "0"
//power^(power^power) from 10^(10^10) to 0
 //(1<<(pos<<1))
//========MAIN===
//code is from another compressor i wrote
void main(int argc,char**argv){
if(!argv[1]){printf("Syntax:cmp inputfile [-d=decode]");exit(1);}
//-----DECODE--TODO-----
if(argv[2] && !strcmp(argv[2],"-d")){//decode Data
FILE* inp=fopen(argv[1],"rb");
if(!inp){perror("No file");exit(2);}
u8 outsize;fread(&outsize,8,1,inp);
if(DEBUG)printf("\nFilesize:%llu",outsize);
u8 bitlen=outsize*8;mpfr_set_default_prec( bitlen);
mpf(Power);//read powers and signs.
//todo


mpz(Z);
//mpfr_get_z(Z,Result,PR0);
FILE* output=fopen("Decode.dat","wb");
mpz_out_raw(output, Z);//slightly larger
//fwrite(&out,1,outsize,output);//end: does not work
exit(10);
}
//------INPUT--------

if(DEBUG3)printf(VERSION);
/*
  >>  MPFR_RNDN: round to nearest (roundTiesToEven in IEEE 754-2008),
    MPFR_RNDZ: round toward zero (roundTowardZero in IEEE 754-2008),
    MPFR_RNDU: round toward plus infinity (roundTowardPositive in IEEE 754-2008),
    MPFR_RNDD: round toward minus infinity (roundTowardNegative in IEEE 754-2008),
    MPFR_RNDA: round away from zero.
*/
FILE* output=fopen("Result.cmp","wb");
u8 inpsize=fsize(argv[1]);
fwrite(&inpsize,8,1,output);//write inpsize to avoid misdecoding;
u8 bitlen=inpsize*8;
s4 check,checklow,checkhi,checkold;
if(!inpsize){perror("input size invalid");return;};
u1* input=getcontent(argv[1]);
//convert to mpz
mpfr_set_default_prec( bitlen);
mpz(Z);buf2mpz(input,Z,inpsize);
mpf(median);mpf(logs);//Z->median
mpfr_set_z(median,Z,PR0);
mpf(Result);//Power is 512 bits;result stores Base^Power
mpf(Resbase);//p^p=resbase
mpfr_t Power;mpfr_init2(Power,POWERPREC);
mpfr_t Powermin;mpfr_init2(Powermin,POWERPREC);
mpfr_t Powermax;mpfr_init2(Powermax,POWERPREC);
mpfr_t Powerold;mpfr_init2(Powerold,POWERPREC);
mpfr_set_str(Powermin,MINPOW,10,PR0);
mpfr_set_str(Powermax,MAXPOW,10,PR0);
mpfr_set_str(Powerold,"-1",10,PR0);
mainloop:;//search for closest match
//power=avg(Powermax,Powermin)
mpfr_add(Power,Powermax,Powermin,PR0);
mpfr_div_2ui(Power,Power,1,PR0);
checkold=mpfr_cmp(Power,Powerold);
mpfr_pow(Resbase,Power,Power,PR0);
mpfr_pow(Result,Power,Resbase,PR0);
check=mpfr_cmp(Result,median);
if(checkold==0){if(DEBUG2)printf("#\n");
//Write power to output, ssubstract Median-Result
//if neg, fprintf "-" to o
mpfr_sub(median,median,Result,PR0);
if(mpfr_cmp_si(median,0)<0){
fprintf(output,"-");mpfr_abs(median,median,PR0);}

mpfr_log2(logs,median,PR0);
if(DEBUG3)printf("Distance=%d",mpfr_get_ui(logs,PR0));
mpfr_out_str(output,16,0,Power,PR0);
mpfr_set_str(Powermin,MINPOW,10,PR0);
mpfr_set_str(Powermax,MAXPOW,10,PR0);
mpfr_set_str(Powerold,"-1",10,PR0);
if(mpfr_cmp_si(logs,1)<0){puts("::Final result reached");exit(2);}; goto mainloop;}
if(check>0){if(DEBUG2)printf("+");
mpfr_set(Powerold,Power,PR0);
mpfr_swap(Powermax,Power);
goto mainloop;}
if(check<0){if(DEBUG2)printf("-");
mpfr_set(Powerold,Power,PR0);
mpfr_swap(Powermin,Power);
goto mainloop;}
//inside initial window
mpfr_out_str(output,16,0,Power,PR0);//write final power(hex)
//====================================
; }

Name: FrozenVoid !!mJCwdV5J0Xy2A21 2011-11-12 2:29

A version which uses a fixed base^dynamic power series
//====Headers
#define VERSION "Infinity Compressor 1.05 fixedbase chain\n"
//..\gcc -O2  main.c -lmpfr -lgmp  -o a.exe
//the code is of bit of mess, this is unchunked, single file at onc eversion which takes alot of time to search
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <float.h>
#include <time.h>
#include <gmp.h>   //using libgmp.a
#include <mpfr.h>
//======Types
#define u1 unsigned char
#define u2 unsigned short
#define u4 unsigned int
#define u8 unsigned long long
#define s1 signed char
#define s2 signed short
#define s4 signed int
#define s8 signed long long
#define f2 short float
#define f4 float
#define f8 double
#define f10 long double
//====Bithacks
#define setb(o,p) (o|=(1<<p))      //byte| 1<< pos  
#define clrb(o,p) (o&=(~(1<<p)))  // byte | 11101111
#define togb(o,p) (o^=(1<<p))
#define chkb(o,p) ((o>>p)&1)
#define bitchar(bitchar_bit)    (48|bitchar_bit) // 48|0 or 1
//====Func GCC
static __inline__ u8 rdtsc(void){u8 x;
 __asm__ volatile (".byte 0x0f, 0x31" : "=A" (x));     return x;}

u8 fsize(u1* filename){
FILE* tfile=fopen(filename,"rb");
if(!tfile){perror(filename);return 0;}
fseek(tfile,0,SEEK_END);
u8 sz=(u8)(ftell(tfile));fclose(tfile);return sz;}

u1* getcontent(u1*filename){//file to buffer
u8 size=fsize(filename);//
if(!size){perror("Zero length content"); return NULL;}
u1* res=malloc(size);
if(!res){perror("Malloc failure");return NULL;}
FILE* inpfile=fopen(filename,"rb");
if(!inpfile){perror("File cannot be read");return NULL;}
u8 findex=(u8)fread(res,1,size,inpfile);fclose(inpfile);
if(findex!=size){perror("size mismatch");return NULL;}
return res;}


void readcontent(u1* filename,u1* storage){
if(!filename){perror("Invalid filename"); return;}
u8 inpsize=fsize(filename);
if(!inpsize){perror("File empty");return;}
FILE* in=fopen(filename,"rb");
if(!in){perror(filename);return;}
storage=realloc(storage,inpsize);
if(!storage){perror("Malloc failure");return;}
u8 findex=(u8)fread(storage,1,inpsize,in);
fclose(in);
if(findex!=inpsize){perror("Read size mismatch");return;}}

void writecontent(u1* filename,u1* content,u8 size){
FILE* out=fopen(filename,"wb");
if(!out){perror(filename);return;}
u8 findex=(u8)fwrite(content,1,size,out);fclose(out);
if(findex!=size) perror("Write size mismatch");}

void buf2mpz(u1* string,mpz_t num,u8 size){
if(!string){perror("NULL string");return;}
if(!num){perror("Invalid mpz_t");return;}
if(!size){perror("Zero-length string");return;}
mpz_import(num,size, 1,1, -1, 0,string);
}

u1* mpz2buf(mpz_t num){
u1* res=malloc( (mpz_sizeinbase(num,16)/2)+2);
mpz_export(res,NULL,1,1,-1,0,num);return res;}
#define loop(loopx,loopy) for(loopx=0;loopx<loopy;loopx++)

#define fextension(string) strrchr(string,'.')?:".???"
#define isbit(xint,ypos)    ((xint)&(1<<ypos)) 
#define frop(x,filename) FILE* x=fopen(filename,"rb")
#define fwop(x,filename) FILE* x=fopen(filename,"wb")

#define outx(x,fil) fwrite(&x,1,sizeof(x),fil);
#define mpz(x) mpz_t x;mpz_init(x);
#define mpf(x) mpfr_t x;mpfr_init(x);
//static array
#define mpfr(x) MPFR_DECL_INIT(x, 53)  //returns float
#define DEBUG 1 //debug
#define DEBUG2 1 //symbolics
#define DEBUG3 1 //verbose
#define POWERPREC 1024 ///200 //more=slower, more precise
#define fdisp(x) puts("");mpf_out_str(stdout,10, 0,x);
//===========MAIN======================
#define setch(o,ch,pos)  (o|=ch<<(pos<<1))  // pos 0-3,ch=0-3
#define getbb(o,pos) ((o>>(pos<<1))&3) //get 001100>>2 &3
#define getb0(b) (b&3)
#define getb1(b) ((b>>2)&3)
#define getb2(b) ((b>>4)&3)
#define getb3(b) ((b>>6)&3)
#define PR0 MPFR_RNDN
#define MAXPOW "10e1000"
#define MINPOW "0"
//power^(power^power) from 10^(10^10) to 0
 //(1<<(pos<<1))
//========MAIN===
//code is from another compressor i wrote
void main(int argc,char**argv){
if(!argv[1]){printf("Syntax:cmp inputfile [-d=decode]");exit(1);}
//-----DECODE--TODO-----
if(argv[2] && !strcmp(argv[2],"-d")){//decode Data
FILE* inp=fopen(argv[1],"rb");
if(!inp){perror("No file");exit(2);}
u8 outsize;fread(&outsize,8,1,inp);
if(DEBUG)printf("\nFilesize:%llu",outsize);
u8 bitlen=outsize*8;mpfr_set_default_prec( bitlen);
mpf(Power);//read powers and signs.
//todo


mpz(Z);
//mpfr_get_z(Z,Result,PR0);
FILE* output=fopen("Decode.dat","wb");
mpz_out_raw(output, Z);//slightly larger
//fwrite(&out,1,outsize,output);//end: does not work
exit(10);
}
//------INPUT--------

if(DEBUG3)printf(VERSION);
/*
  >>  MPFR_RNDN: round to nearest (roundTiesToEven in IEEE 754-2008),
    MPFR_RNDZ: round toward zero (roundTowardZero in IEEE 754-2008),
    MPFR_RNDU: round toward plus infinity (roundTowardPositive in IEEE 754-2008),
    MPFR_RNDD: round toward minus infinity (roundTowardNegative in IEEE 754-2008),
    MPFR_RNDA: round away from zero.
*/
FILE* output=fopen("Result.cmp","wb");
u8 inpsize=fsize(argv[1]);
fwrite(&inpsize,8,1,output);//write inpsize to avoid misdecoding;
u8 bitlen=inpsize*8;
s4 check,checklow,checkhi,checkold;
if(!inpsize){perror("input size invalid");return;};
u1* input=getcontent(argv[1]);
//convert to mpz
mpfr_set_default_prec( bitlen);
mpz(Z);buf2mpz(input,Z,inpsize);
mpf(median);mpf(logs);//Z->median
mpfr_set_z(median,Z,PR0);
mpf(Result);//Power is 512 bits;result stores Base^Power
mpf(Resbase);//p^p=resbase
mpfr_t fixedbase;mpfr_init2(fixedbase,POWERPREC);
mpfr_set_str(fixedbase,"1e-100",10,PR0);
mpfr_add_ui(fixedbase,fixedbase,1,PR0);
if(mpfr_cmp_ui(fixedbase,1)==0){puts("PowerPrec too low");exit(11);}
mpfr_t Power;mpfr_init2(Power,POWERPREC);
mpfr_t Powermin;mpfr_init2(Powermin,POWERPREC);
mpfr_t Powermax;mpfr_init2(Powermax,POWERPREC);
mpfr_t Powerold;mpfr_init2(Powerold,POWERPREC);
mpfr_set_str(Powermin,MINPOW,10,PR0);
mpfr_set_str(Powermax,MAXPOW,10,PR0);
mpfr_set_str(Powerold,"-1",10,PR0);
mainloop:;//search for closest match
//power=avg(Powermax,Powermin)
//code is just a simple power series(it does not have any compression advantage without window modifiers)
mpfr_add(Power,Powermax,Powermin,PR0);
mpfr_div_2ui(Power,Power,1,PR0);
checkold=mpfr_cmp(Power,Powerold);
mpfr_pow(Result,fixedbase,Power,PR0);
//mpfr_pow(Result,Power,Resbase,PR0);
check=mpfr_cmp(Result,median);
if(checkold==0){if(DEBUG2)printf("#\n");
//Write power to output, ssubstract Median-Result
//if neg, fprintf "-" to o
mpfr_sub(median,median,Result,PR0);
fprintf(output,"\n");
if(mpfr_cmp_si(median,0)<0){
fprintf(output,"-");mpfr_abs(median,median,PR0);}
mpfr_out_str(output,16,0,Power,PR0);
mpfr_log2(logs,median,PR0);
if(DEBUG3)printf("Distance=%d",mpfr_get_ui(logs,PR0));
mpfr_set_str(Powermin,MINPOW,10,PR0);
mpfr_set_str(Powermax,MAXPOW,10,PR0);
mpfr_set_str(Powerold,"-1",10,PR0);
if(mpfr_cmp_si(logs,1)<0){puts("::Final result reached");exit(2);}; goto mainloop;}
if(check>0){if(DEBUG2)printf("+");
mpfr_set(Powerold,Power,PR0);
mpfr_swap(Powermax,Power);
goto mainloop;}
if(check<0){if(DEBUG2)printf("-");
mpfr_set(Powerold,Power,PR0);
mpfr_swap(Powermin,Power);
goto mainloop;}
fprintf(output,"\n");
mpfr_out_str(output,16,0,Power,PR0);//write final power(hex)
;}

Name: FrozenVoid !!mJCwdV5J0Xy2A21 2011-11-12 2:52

also, in window shift search the initial window lower bound could be lowered down the number line, by substracting window-(some func(z))
so the window is located closer to zero(which would make it easier to find matches)

Name: sage 2011-11-12 3:31

tl;dr  I don't get it fv, let's just include every known library and call it a compression technique ignoring overhead

Name: FrozenVoid !!mJCwdV5J0Xy2A21 2011-11-12 3:33

>>105
Its a thread for discussing theoretical methods for infinite compression.I don't limit myself to one function or one program.
its perfectly possible to write one in Lisp  or Haskell(later has native GMP/MPFR bindings).

Name: FrozenVoid !!mJCwdV5J0Xy2A21 2011-11-12 3:36

Here is version with larger PowerPrec which apparently converges better:
Now the limit is to reach below filesize(powerchain itself is uncompressed) to allow useful compression(some scaling tricks or optimization of power storage could be useful)

//====Headers
#define VERSION "Infinity Compressor 1.06 fixedbase chain\n"
//..\gcc -O2  main.c -lmpfr -lgmp  -o a.exe
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <float.h>
#include <time.h>
#include <gmp.h>   //using libgmp.a
#include <mpfr.h>
//======Types
#define u1 unsigned char
#define u2 unsigned short
#define u4 unsigned int
#define u8 unsigned long long
#define s1 signed char
#define s2 signed short
#define s4 signed int
#define s8 signed long long
#define f2 short float
#define f4 float
#define f8 double
#define f10 long double
#define v0 void
u8 fsize(u1* filename){
FILE* tfile=fopen(filename,"rb");
if(!tfile){perror(filename);return 0;}
fseek(tfile,0,SEEK_END);
u8 sz=(u8)(ftell(tfile));fclose(tfile);return sz;}

u1* getcontent(u1*filename){//file to buffer
u8 size=fsize(filename);//
if(!size){perror("Zero length content"); return NULL;}
u1* res=malloc(size);
if(!res){perror("Malloc failure");return NULL;}
FILE* inpfile=fopen(filename,"rb");
if(!inpfile){perror("File cannot be read");return NULL;}
u8 findex=(u8)fread(res,1,size,inpfile);fclose(inpfile);
if(findex!=size){perror("size mismatch");return NULL;}
return res;}


v0 readcontent(u1* filename,u1* storage){
if(!filename){perror("Invalid filename"); return;}
u8 inpsize=fsize(filename);
if(!inpsize){perror("File empty");return;}
FILE* in=fopen(filename,"rb");
if(!in){perror(filename);return;}
storage=realloc(storage,inpsize);
if(!storage){perror("Malloc failure");return;}
u8 findex=(u8)fread(storage,1,inpsize,in);
fclose(in);
if(findex!=inpsize){perror("Read size mismatch");return;}}

v0 writecontent(u1* filename,u1* content,u8 size){
FILE* out=fopen(filename,"wb");
if(!out){perror(filename);return;}
u8 findex=(u8)fwrite(content,1,size,out);fclose(out);
if(findex!=size) perror("Write size mismatch");}

v0 buf2mpz(u1* string,mpz_t num,u8 size){
if(!string){perror("NULL string");return;}
if(!num){perror("Invalid mpz_t");return;}
if(!size){perror("Zero-length string");return;}
mpz_import(num,size, 1,1, -1, 0,string);
}

u1* mpz2buf(mpz_t num){
u1* res=malloc( (mpz_sizeinbase(num,16)/2)+2);
mpz_export(res,NULL,1,1,-1,0,num);return res;}
#define loop(loopx,loopy) for(loopx=0;loopx<loopy;loopx++)

#define fextension(string) strrchr(string,'.')?:".???"
#define isbit(xint,ypos)    ((xint)&(1<<ypos)) 
#define frop(x,filename) FILE* x=fopen(filename,"rb")
#define fwop(x,filename) FILE* x=fopen(filename,"wb")

#define outx(x,fil) fwrite(&x,1,sizeof(x),fil);
#define mpz(x) mpz_t x;mpz_init(x);
#define mpf(x) mpfr_t x;mpfr_init(x);
//static array
#define mpfr(x) MPFR_DECL_INIT(x, 53)  //returns float
#define DEBUG 1 //debug
#define DEBUG2 1 //symbolics
#define DEBUG3 1 //verbose
#define POWERPREC 1024 ///200 //more=slower, more precise
#define fdisp(x) puts("");mpf_out_str(stdout,10, 0,x);
//===========MAIN======================
#define setch(o,ch,pos)  (o|=ch<<(pos<<1))  // pos 0-3,ch=0-3
#define getbb(o,pos) ((o>>(pos<<1))&3) //get 001100>>2 &3
#define getb0(b) (b&3)
#define getb1(b) ((b>>2)&3)
#define getb2(b) ((b>>4)&3)
#define getb3(b) ((b>>6)&3)
#define PR0 MPFR_RNDN
#define MAXPOW "10e1100"
#define MINPOW "0"
//========MAIN===
//code is from another compressor i wrote
v0 main(int argc,char**argv){
if(!argv[1]){printf("Syntax:cmp inputfile [-d=decode]");exit(1);}
//-----DECODE--TODO-----
if(argv[2] && !strcmp(argv[2],"-d")){//decode Data
FILE* inp=fopen(argv[1],"rb");
if(!inp){perror("No file");exit(2);}
u8 outsize;fread(&outsize,8,1,inp);
if(DEBUG)printf("\nFilesize:%llu",outsize);
u8 bitlen=outsize*8;mpfr_set_default_prec( bitlen);
mpf(Power);//read powers and signs.
//todo


mpz(Z);
//mpfr_get_z(Z,Result,PR0);
FILE* output=fopen("Decode.dat","wb");
mpz_out_raw(output, Z);//slightly larger
//fwrite(&out,1,outsize,output);//end: does not work
exit(10);
}
//------INPUT--------

if(DEBUG3)printf(VERSION);
/*
  >>  MPFR_RNDN: round to nearest (roundTiesToEven in IEEE 754-2008),
    MPFR_RNDZ: round toward zero (roundTowardZero in IEEE 754-2008),
    MPFR_RNDU: round toward plus infinity (roundTowardPositive in IEEE 754-2008),
    MPFR_RNDD: round toward minus infinity (roundTowardNegative in IEEE 754-2008),
    MPFR_RNDA: round away from zero.
*/
FILE* output=fopen("Result.cmp","wb");
u8 inpsize=fsize(argv[1]);
fwrite(&inpsize,8,1,output);//write inpsize to avoid misdecoding;
u8 bitlen=inpsize*8;
s4 check,checklow,checkhi,checkold;
if(!inpsize){perror("input size invalid");return;};
u1* input=getcontent(argv[1]);
//convert to mpz
mpfr_set_default_prec( bitlen);
mpz(Z);buf2mpz(input,Z,inpsize);
mpf(median);mpf(logs);//Z->median
mpfr_set_z(median,Z,PR0);
mpf(Result);//Power is 512 bits;result stores Base^Power
mpf(Resbase);//p^p=resbase
mpfr_t fixedbase;mpfr_init2(fixedbase,4000);
mpfr_set_str(fixedbase,"1e-1000",10,PR0);
mpfr_add_ui(fixedbase,fixedbase,1,PR0);
if(mpfr_cmp_ui(fixedbase,1)==0){puts("BasePrec too low");exit(11);}
mpfr_t Power;mpfr_init2(Power,POWERPREC);
mpfr_t Powermin;mpfr_init2(Powermin,POWERPREC);
mpfr_t Powermax;mpfr_init2(Powermax,POWERPREC);
mpfr_t Powerold;mpfr_init2(Powerold,POWERPREC);
mpfr_set_str(Powermin,MINPOW,10,PR0);
mpfr_set_str(Powermax,MAXPOW,10,PR0);
mpfr_set_str(Powerold,"-1",10,PR0);
mainloop:;//search for closest match
//power=avg(Powermax,Powermin)
//code is just a simple power series(it does not have any compression advantage without window modifiers)
mpfr_add(Power,Powermax,Powermin,PR0);
mpfr_div_2ui(Power,Power,1,PR0);
checkold=mpfr_cmp(Power,Powerold);
mpfr_pow(Result,fixedbase,Power,PR0);
//mpfr_pow(Result,Power,Resbase,PR0);
check=mpfr_cmp(Result,median);
if(checkold==0){if(DEBUG2)printf("#\n");
//Write power to output, ssubstract Median-Result
//if neg, fprintf "-" to o
mpfr_sub(median,median,Result,PR0);
fprintf(output,"\n");
if(mpfr_cmp_si(median,0)<0){
fprintf(output,"-");mpfr_abs(median,median,PR0);}
mpfr_out_str(output,16,0,Power,PR0);
mpfr_log2(logs,median,PR0);
if(DEBUG3)printf("Distance=%d",mpfr_get_ui(logs,PR0));
mpfr_set_str(Powermin,MINPOW,10,PR0);
mpfr_set_str(Powermax,MAXPOW,10,PR0);
mpfr_set_str(Powerold,"-1",10,PR0);
if(mpfr_cmp_si(logs,1)<0){puts("::Final result reached");exit(2);}; goto mainloop;}
if(check>0){if(DEBUG2)printf("+");
mpfr_set(Powerold,Power,PR0);
mpfr_swap(Powermax,Power);
goto mainloop;}
if(check<0){if(DEBUG2)printf("-");
mpfr_set(Powerold,Power,PR0);
mpfr_swap(Powermin,Power);
goto mainloop;}
fprintf(output,"\n");
mpfr_out_str(output,16,0,Power,PR0);//write final power(hex)
;}

Name: FrozenVoid !!mJCwdV5J0Xy2A21 2011-11-12 4:23

Filesize is now embedded into output filename(saves 8 bytes)
//====Headers
#define VERSION "Infinity Compressor 1.06 fixedbase chain\n"
//..\gcc -O2  main.c -lmpfr -lgmp  -o a.exe
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <float.h>
#include <time.h>
#include <gmp.h>   //using libgmp.a
#include <mpfr.h>
//======Types
#define u1 unsigned char
#define u2 unsigned short
#define u4 unsigned int
#define u8 unsigned long long
#define s1 signed char
#define s2 signed short
#define s4 signed int
#define s8 signed long long
#define f2 short float
#define f4 float
#define f8 double
#define f10 long double
#define v0 void
u8 fsize(u1* filename){
FILE* tfile=fopen(filename,"rb");
if(!tfile){perror(filename);return 0;}
fseek(tfile,0,SEEK_END);
u8 sz=(u8)(ftell(tfile));fclose(tfile);return sz;}

u1* getcontent(u1*filename){//file to buffer
u8 size=fsize(filename);//
if(!size){perror("Zero length content"); return NULL;}
u1* res=malloc(size);
if(!res){perror("Malloc failure");return NULL;}
FILE* inpfile=fopen(filename,"rb");
if(!inpfile){perror("File cannot be read");return NULL;}
u8 findex=(u8)fread(res,1,size,inpfile);fclose(inpfile);
if(findex!=size){perror("size mismatch");return NULL;}
return res;}


v0 readcontent(u1* filename,u1* storage){
if(!filename){perror("Invalid filename"); return;}
u8 inpsize=fsize(filename);
if(!inpsize){perror("File empty");return;}
FILE* in=fopen(filename,"rb");
if(!in){perror(filename);return;}
storage=realloc(storage,inpsize);
if(!storage){perror("Malloc failure");return;}
u8 findex=(u8)fread(storage,1,inpsize,in);
fclose(in);
if(findex!=inpsize){perror("Read size mismatch");return;}}

v0 writecontent(u1* filename,u1* content,u8 size){
FILE* out=fopen(filename,"wb");
if(!out){perror(filename);return;}
u8 findex=(u8)fwrite(content,1,size,out);fclose(out);
if(findex!=size) perror("Write size mismatch");}

v0 buf2mpz(u1* string,mpz_t num,u8 size){
if(!string){perror("NULL string");return;}
if(!num){perror("Invalid mpz_t");return;}
if(!size){perror("Zero-length string");return;}
mpz_import(num,size, 1,1, -1, 0,string);
}

u1* mpz2buf(mpz_t num){
u1* res=malloc( (mpz_sizeinbase(num,16)/2)+2);
mpz_export(res,NULL,1,1,-1,0,num);return res;}
#define loop(loopx,loopy) for(loopx=0;loopx<loopy;loopx++)

#define fextension(string) strrchr(string,'.')?:".???"
#define isbit(xint,ypos)    ((xint)&(1<<ypos)) 
#define frop(x,filename) FILE* x=fopen(filename,"rb")
#define fwop(x,filename) FILE* x=fopen(filename,"wb")

#define outx(x,fil) fwrite(&x,1,sizeof(x),fil);
#define mpz(x) mpz_t x;mpz_init(x);
#define mpf(x) mpfr_t x;mpfr_init(x);
//static array
#define mpfr(x) MPFR_DECL_INIT(x, 53)  //returns float
#define DEBUG 1 //debug
#define DEBUG2 1 //symbolics
#define DEBUG3 1 //verbose
#define POWERPREC 1024 ///200 //more=slower, more precise
#define fdisp(x) puts("");mpf_out_str(stdout,10, 0,x);
//===========MAIN======================
#define setch(o,ch,pos)  (o|=ch<<(pos<<1))  // pos 0-3,ch=0-3
#define getbb(o,pos) ((o>>(pos<<1))&3) //get 001100>>2 &3
#define getb0(b) (b&3)
#define getb1(b) ((b>>2)&3)
#define getb2(b) ((b>>4)&3)
#define getb3(b) ((b>>6)&3)
#define PR0 MPFR_RNDN
#define MAXPOW "10e1100"
#define MINPOW "0"
//========MAIN===
//code is from another compressor i wrote
v0 main(int argc,char**argv){
if(!argv[1]){printf("Syntax:cmp inputfile [-d=decode]");exit(1);}
//-----DECODE--TODO-----
if(argv[2] && !strcmp(argv[2],"-d")){//decode Data
FILE* inp=fopen(argv[1],"rb");
if(!inp){perror("No file");exit(2);}
u8 outsize;fread(&outsize,8,1,inp);
if(DEBUG)printf("\nFilesize:%llu",outsize);
u8 bitlen=outsize*8;mpfr_set_default_prec( bitlen);
mpf(Power);//read powers and signs.
//todo


mpz(Z);
//mpfr_get_z(Z,Result,PR0);
FILE* output=fopen("Decode.dat","wb");
mpz_out_raw(output, Z);//slightly larger
//fwrite(&out,1,outsize,output);//end: does not work
exit(10);
}
//------INPUT--------

if(DEBUG3)printf(VERSION);
/*
  >>  MPFR_RNDN: round to nearest (roundTiesToEven in IEEE 754-2008),
    MPFR_RNDZ: round toward zero (roundTowardZero in IEEE 754-2008),
    MPFR_RNDU: round toward plus infinity (roundTowardPositive in IEEE 754-2008),
    MPFR_RNDD: round toward minus infinity (roundTowardNegative in IEEE 754-2008),
    MPFR_RNDA: round away from zero.
*/
u8 inpsize=fsize(argv[1]);
u8 bitlen=inpsize*8;
s1* filename=malloc(120);
sprintf(filename,"Result.%d.cmp",inpsize);
FILE* output=fopen(filename,"wb");

s4 check,checklow,checkhi,checkold;
if(!inpsize){perror("input size invalid");return;};
u1* input=getcontent(argv[1]);
//convert to mpz
mpfr_set_default_prec( bitlen);
mpz(Z);buf2mpz(input,Z,inpsize);
mpf(median);mpf(logs);//Z->median
mpfr_set_z(median,Z,PR0);
mpf(Result);//Power is 512 bits;result stores Base^Power
mpf(Resbase);//p^p=resbase
mpfr_t fixedbase;mpfr_init2(fixedbase,4000);
mpfr_set_str(fixedbase,"1e-1000",10,PR0);
mpfr_add_ui(fixedbase,fixedbase,1,PR0);
if(mpfr_cmp_ui(fixedbase,1)==0){puts("BasePrec too low");exit(11);}
mpfr_t Power;mpfr_init2(Power,POWERPREC);
mpfr_t Powermin;mpfr_init2(Powermin,POWERPREC);
mpfr_t Powermax;mpfr_init2(Powermax,POWERPREC);
mpfr_t Powerold;mpfr_init2(Powerold,POWERPREC);
mpfr_set_str(Powermin,MINPOW,10,PR0);
mpfr_set_str(Powermax,MAXPOW,10,PR0);
mpfr_set_str(Powerold,"-1",10,PR0);
mainloop:;//search for closest match
//power=avg(Powermax,Powermin)
//code is just a simple power series(it does not have any compression advantage without window modifiers)
mpfr_add(Power,Powermax,Powermin,PR0);
mpfr_div_2ui(Power,Power,1,PR0);
checkold=mpfr_cmp(Power,Powerold);
mpfr_pow(Result,fixedbase,Power,PR0);
//mpfr_pow(Result,Power,Resbase,PR0);
check=mpfr_cmp(Result,median);
if(checkold==0){if(DEBUG2)printf("#\n");
//Write power to output, ssubstract Median-Result
//if neg, fprintf "-" to o
mpfr_sub(median,median,Result,PR0);

if(mpfr_cmp_si(median,0)<0){
fprintf(output,"-");mpfr_abs(median,median,PR0);}
mpfr_out_str(output,16,0,Power,PR0);fprintf(output,"\n");
mpfr_log2(logs,median,PR0);
if(DEBUG3)printf("Distance=%d",mpfr_get_ui(logs,PR0));
mpfr_set_str(Powermin,MINPOW,10,PR0);
mpfr_set_str(Powermax,MAXPOW,10,PR0);
mpfr_set_str(Powerold,"-1",10,PR0);
if(mpfr_cmp_si(logs,1)<0){puts("::Final result reached");exit(2);}; goto mainloop;}
if(check>0){if(DEBUG2)printf("+");
mpfr_set(Powerold,Power,PR0);
mpfr_swap(Powermax,Power);
goto mainloop;}
if(check<0){if(DEBUG2)printf("-");
mpfr_set(Powerold,Power,PR0);
mpfr_swap(Powermin,Power);
goto mainloop;}
fprintf(output,"\n");
mpfr_out_str(output,16,0,Power,PR0);fprintf(output,"\n");//write final power(hex)
;}

Name: Anonymous 2011-11-12 8:17

THIS THREAD HAS BEEN REPLACED WITH THE FOLLOWING THREAD:

    Subject: `FrozenFurry!!mJCwdV5J0Xy2A21
    Message: FrozenKike is the inventor of the famous Autism# language. everyone ready your tailholes for some proper jolly rodgering

Name: Anonymous 2011-11-12 13:42

The key is expanding the window AND moving it down the number line. The later is far more harder than it seems.

Name: Anonymous 2011-11-12 13:48

The initial number has a window length of 1*windowsize.
there has to be some formula to move the window down, and expand it again by *windowsize

Name: Anonymous 2011-11-12 13:50

Mary Jane shoes

Name: Anonymous 2011-11-12 13:51

Once the window is wide enough and moved as low as initial number approximate range, there will be easy matches for most functions.

Name: Anonymous 2011-11-12 13:54

>>110
NP-Hard trolling by FV

Name: Anonymous 2011-11-12 18:11

oh frozenbutts you so crazy

Name: Anonymous 2011-11-12 21:50

Frozenvoid, You should bring back your kr4d signature system and start posting on /g/ with an avatar again.

That shit was fucking great, I don't know why the whole world doesn't love you.. oh yeah SYNACKSYNACKSYNACK!!!!!  You should bring that back too.. that was cool.

Name: Anonymous 2011-11-12 21:52

>>114
My crew is so hard we roll NP
and bitches dereference my pointer for free.
When I'm linear probing they're like, "Damn that's gigantic,"
I showed it to your mom and she used Hoare semantics.
She jumped like JNE up onto my erection
And I picked up that ho like straight garbage collection.

Name: Anonymous 2011-11-12 22:43

This reminds me of the CAR algorithm posted on the gamedev forums.
http://www.gamedev.net/topic/11259-mp3-beating-compression/

Name: Anonymous 2011-11-12 23:21

>>118
CAR
That's the power of Lisp.

Name: Anonymous 2011-11-12 23:26

CAR CAR CAR CUDDER

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List