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-13 0:30

>>110
Thats window shifting is all about. Problem storing Kmod so it represents a huge chunk of number to lower the window.
K-Kmod always results in some number which is more than 90% of the original length.
Its possible to split Kmod to multiple parts and lower the window -exp2(Kmod1)-exp2(Kmod2) or use a huge
And at the the same time test for matches in the current window, so when its low enough a match will occur.
Even if it requires lowering the window 90% down(with 90% the filesize in Kmod) it will still be useful.

Name: FrozenVoid !!mJCwdV5J0Xy2A21 2011-11-13 2:03

Some formula which is need is that which represetnts at least 90% of Kmod in form which takes less than 90% of number itself.
I.e. something like a 2^xxx.yyy which takes at least 90% of Kmod and at most 100% of Kmod so now window-exp2(Kmodlog) will lower it down

Name: Anonymous 2011-11-13 4:59

window-shift my anus

Name: FrozenVoid !!mJCwdV5J0Xy2A21 2011-11-13 5:01

The cycle will be as follows:
Z=Integer;Hi=Z+1;Low=Z
window=hi<>low
window*=K(k=((2^8)^filesize)^4)
window-=2^kmod
(search for matches here)
window*=K
window-=2^kmod2
(another search for matches)
etc, until the window search space contains some matches for any power of X

Name: Anonymous 2011-11-13 7:10

in response to your theorem

let's say your original number is 2 (4 bytes let's assume), you have a file of 2.4MiBs, you multiply 2 by 2516582 = 5033164 (bytes and range)
so before you had 2 - 2.(9) and now 10066328 - 15049160.36.
now we multiply this range with a 64 bit scale modifier (as in shift), if we apply this to the original number 2 you get 2^64, which doesn't serve any purpose really.
finally the compression, you say, is possible by searching numbers in a huge range (must be 10066328 - 15049160.36 since that's the greatest range yet), when they are found we disregard the original number and save the multiplier and scale modifier (don't know what for though). Now since the range is really enormous you say we need to index the actual number is the data possible and provide no way to do this.
So as far as encrypting goes you basically generate garbage and say our data must be in there somewhere and provide no way to guess it. Even if you were to implement a deterministic pseudo-random generator and store the number of iterations needed to get the actual data the time needed to archive something would be proportional to its size and grow very, very rapidly.

As for the decoding it seems straightforward you generate the mess and you have means to know where it should be and go get it, fine.

It was still a very poor explanation of a stupid way of archiving something, which will still fail since you can only encode all possible data streams with an infinite and really random yet deterministic (let's say predictable instead, reproduceable with a function) stream generator.

Name: FrozenVoid !!mJCwdV5J0Xy2A21 2011-11-13 8:53

>>125
Thats not how it works, though you getting close.
A number is representing the initial file, we get to transform this number into a form which is searchable.
A plain X (like 2308251255316283126526124712) is exactly hard to find via formula like fun(x).
now X and X+1 can be considered the same number: X+1 just serves as upper bound, like  3.000< Range >3.999...<4
All number in that range are same integer. Now that this is established we go to the next step, we multiply the range:
(3.000...<>3.999...)*2=> (6.000...<>7.999...) : notice the range (distance between lower and upper bound) has doubled making it easier to  reach, now if we multiply (3.000...<>3.999...)*1 000 000 000=> range becomes from 3billion to 4 billion, much easier to find
Any number between 3billion and 4billion can be reduced back to 3 by truncating division of it by x/1e9.
A (entirely optional) way to speed it up is to apply a scale modifier to the number itself.
The process is that by making the intitial number more flexible("fuzzy") e.g. modify it in 64bit range. we get initial range from
3.000...<>3.999... to 2.000...<>2.999 or 4.000...<>4.999 for free(8 bytes) and since any number in that range can be used to shift initial
range down/up  the entire 2.000...<range of possible ranges>4.999... can be used as interval(with final scale modifier(8 bytes) determined at end of all calculations to fit the number exactly).
Now the multiplier by which the number is scaled K is determined from its filesize ((2^8)^filesize)^scale_factor(4 in this case)) so it is not stored in file at all. The K however can be modified as well as low/hi bounds of the range being searched(to increases matches).
By moving the window(range where matches can occur 3.000...<>3.999..) down the number line, the number of matches increases substantially, peaking at time when low bound reaches 0, so 0.000<>x.999... is laughably easy to generate via formula.
Kmod is the number by which window:K is shifted,reducing the low and hi bound by same exact amount:window-Kmod means
that 3.000..<>3.999... is reduced by Kmod on both sides, bringing it down the number line(decreasing in magnitude).

Name: Anonymous 2011-11-13 9:07

>now X and X+1 can be considered the same number
MIND BLOWN

Name: Anonymous 2011-11-13 9:09

>>127
That's even mathematically possible.

Name: Anonymous 2011-11-13 13:40

>>128
X and X+1 can could be the same number if they are in the same equiv. class. For example, let's say I have an abritray string, x and y, that contains the same number of ones.  The the following would be true...

[00] = [0] = [000]

likewise

[101= [0101] = [1010] = [00101]

However, in frozenRetard, I mean frozenVoid's example, this can't be true because he/she/it/moron introduces an antisymmetric relation on the set. And as anyone that has taken discrete math knows, part of the requirement for an equiv. class is that the relation has to be symmetric.

Name: FrozenVoid !!mJCwdV5J0Xy2A21 2011-11-14 3:00

X=X+1 is not meant to be integer X=X+1
X+1 is the upper bound 3<>4 or 3.000...<>3.999...
X is the lower bounds.
The number searched is between 3 and 3+1

Name: Anonymous 2011-11-14 5:45

>>127
In the trivial field, x+1 is indeed equal to x.

Name: FrozenVoid !!mJCwdV5J0Xy2A21 2011-11-14 10:00

The problem is storing the data required to shift the window down(its non-trivial despite it not being precise),
i'm trying to do it with power chain, though the data is too big to compress anything.
//====Headers
#define VERSION "Infinity Compressor 1.09 fixedbase window shift-C PowerKmod\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 FIXEDPOW "1e-100"
#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 pr MPFR_RNDN     //correct
#define prz MPFR_RNDZ    //lower to get below target
#define MAXPOW "10"
#define MINPOW "0"
#define BASEADDINT 0
#define MINSUBPOWER "1e-100"
#define SCALEFACTOR 1000000000 /* Must <maxint*/
#define resetpow mpfr_set_str(Power,"2",10,pr);mpfr_set_str(Powermin,MINPOW,10,pr);mpfr_set_str(Powermax,MAXPOW,10,pr);mpfr_set_str(Powerold,"0",10,pr);
#define storehex(pow) ;fprintf(output,"\n");mpfr_out_str(output,16,0,pow,pr);
#define storehexn(pow) ;fprintf(output,"\n-");mpfr_out_str(output,16,0,pow,pr);
#define avg(pow) mpfr_add(pow,Powermax,Powermin,pr);mpfr_div_2ui(pow,Power,1,pr);
#define SYMBLOW 'X'
#define SYMBHI 'O'
#define LOOPPLUS '+'
#define LOOPMINUS '-'
#define SUCCESS "Encoding complete"
//========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,pr);
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);//Z->median
mpfr_set_z(median,Z,pr);
//base =1+ 1e-100

mpfr_t base;mpfr_init2(base,POWERPREC);
mpfr_set_str(base,FIXEDPOW,10,pr);
mpfr_t baseadd;mpfr_init2(baseadd,POWERPREC);
mpfr_set_str(baseadd,FIXEDPOW,10,pr);
mpfr_add_ui(base,base,BASEADDINT,pr);
 check=mpfr_cmp_ui (base,1);
if(check==0){puts("Invalid precision");exit(1);}
//create initial bounds
mpf(low);mpfr_set(low,median,pr);
mpfr_mul_2ui(low,low,SCALEFACTOR,pr);
mpf(hi);mpfr_add_ui(hi,median,1,pr);
mpfr_mul_2ui(hi,hi,SCALEFACTOR,pr);
//search for closest base match to window
mpf(Result);
mpfr_t powsub;mpfr_init2(powsub,POWERPREC);
mpfr_set_str(powsub,MINSUBPOWER,10,pr);
mpfr_t powres;mpfr_init2(powres,POWERPREC*2);
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);
resetpow;
loop://find one which fits just below window:low
avg(Power);
mpfr_pow(powres,Power,Power,prz);
mpfr_pow(Result,Power,powres,prz);
check=mpfr_cmp(Result,low);//has to be below
checkhi=mpfr_cmp(Result,hi);//or inside window
if(mpfr_cmp(Powerold,Power)==0){//final match
if(check<0){//below, stalled
if(DEBUG2)putchar(SYMBLOW);
mpfr_sub(low,low,Result,pr);
mpfr_sub(hi,hi,Result,pr);
storehex(Power);
resetpow;goto loop;}else{//above or inside?
if(DEBUG2)putchar(SYMBHI);//reduce result.
if(checkhi>0){
mpfr_sub(Powermin,Powermin,powsub,pr);
mpfr_sub(Powermax,Powermax,powsub,pr);
goto loop;}else{//inside window
goto end;

}}
}
if(check>0){if(DEBUG2)putchar(LOOPPLUS);
mpfr_set(Powerold,Power,pr);
mpfr_swap(Powermax,Power);
goto loop;};//if max found set powermax
if(check<0){if(DEBUG2)putchar(LOOPMINUS);
mpfr_swap(Powermin,Power);
mpfr_set(Powerold,Powermin,pr);
goto loop;};
//match found;exit
end:;storehex(Power);puts(SUCCESS);;}

Name: FrozenVoid !!mJCwdV5J0Xy2A21 2011-11-14 11:20

this is output from a 635byte test file: these x^x^x power are distance from Z and it seems i need to store deltas instead of full numbers(since there is wasted space storing the redundant data)
8.93667546175722623441263991111358136689208064765866539000081850023952645411859847002124916836666172764277443418266062554876696178497347792047855306871838891
8.93667531760850172185648650505732973869644732177745043658328547510977347797630335403498703060173503977861476334155124471500088478678037335739275661742693898
8.93667517024591486532639993092165215142009976511652882813443866619642807502253649940274918209464182775585142163503753311158375040098999777714699110822112300
8.93667502296056140756680575113948057765863629468739858954699673272526179376116298354292745997914949152798126614370734031525715838151729925092499115798530809
8.93667487467127960026394648378161967561103118989922145971693442416677818696665872541532428454783657893569054326126337146618345509906917627206567516390579107
8.93667472742631992760951274575129748328818034129188749629593436139009056854600154285592012061031127374142448511342071167191521303339199245297516024684277429
8.93667457980259112831570902828698623362649264564077991080455625361988865944439964712311404801165453813750112450900138857855773735501268559361692199032677370
8.93667443231590256066471201801547795023511984136647378836981663722594602552468856322429624292755434380444940014418989303486043805954646333415616734884055358
8.93667428511982460818849637602082790831082986660246662160496667122609513742883537096999795561913992980747635912785259994565165534724781730429920840598664920
8.93667413785130513731097309214978031946805360720051927372521941221879761150906808799234789854983557792402653286987372441778944529091311884455734685236933630
8.93667398998105717468634631354902266026395026070388045560833337703938787583998195887849889337867584743917854629371842971617127960726918910294410549106099679

Name: FrozenVoid !!mJCwdV5J0Xy2A21 2011-11-14 14:03

A simplified version: stores just 1 number(i'll test if it compresses better, since it avoids storing delta entirely)
The first bytes of that number can be generated by func(filesize) since it dependent on total bitlength
//====Headers
#define VERSION "Infinity Compressor 1.11 Single number range\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
/* 635 original x2
MINSUBPOWER POWERPREC  SIZE
300             1024  >.1554 bytes
210      >   768     >1755
200         768      >1560
150        >512     > 1441 bytes(best)
110     > 400       >1648
 75    <      256 >  1608

*/
#define POWERPREC 512 ///200 //more=slower, more precise
#define FIXEDPOW "1e-100"
#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 pr MPFR_RNDN     //correct
#define prz MPFR_RNDZ    //lower to get below target
#define MAXPOW "12"
#define MINPOW "0"
#define NUMBERBASE 16
#define BASEADDINT 1
#define BASESUBPOWER "1e100"
#define MAXSUBPOWER "1"
#define MINSUBPOWER "1e-150"// "1e-100"//has to be limit of powerprec
#define SCALEFACTOR 1000000000 /* Must <maxint*/
#define resetpow mpfr_set_str(Power,"2",10,pr);mpfr_set_str(Powermin,MINPOW,10,pr);mpfr_set_str(Powermax,MAXPOW,10,pr);mpfr_set_str(Powerold,"0",10,pr);
#define storehex(pow) ;mpfr_set(powbase,pow,pr);mpfr_out_str(output,NUMBERBASE,0,pow,pr);fprintf(output,"\n");
#define storedelta(pow) ;mpfr_sub(powbase,powbase,Power,pr);mpfr_out_str(output, NUMBERBASE,0,powbase,pr);fprintf(output,"\n");mpfr_set(powbase,pow,pr);
#define store(pow) ;if(first){storehex(pow);first=0;}else{storedelta(pow);};
#define avg(pow) mpfr_add(pow,Powermax,Powermin,pr);mpfr_div_2ui(pow,Power,1,pr);
#define reduce2(a,b,res) ;mpfr_sub(a,a,res,pr);mpfr_sub(b,b,res,pr);
#define swapsave(minmax) mpfr_set(Powerold,Power,pr);mpfr_swap(minmax,Power);
#define disp3 ;if(DEBUG3){mpfr_out_str(stdout,10,0,Power,pr);};

#define SYMBLOW 'X'
#define SYMBHI 'O'
#define LOOPPLUS '+'
#define LOOPMINUS '-'
#define SYM(x) if(DEBUG2)putchar(x);
#define SUCCESS "\nEncoding complete"
#define SYNTAX "Syntax:cmp inputfile [-d=decode]"
//========MAIN===
//code is from another compressor i wrote
v0 main(int argc,char**argv){
if(!argv[1]){puts(SYNTAX);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,pr);
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);//Z->median
mpfr_set_z(median,Z,pr);
//base =1+ 1e-100
#undef POWERPREC
#define POWERPREC bitlen*2
mpfr_t powbase;mpfr_init2(powbase,POWERPREC);
mpfr_t base;mpfr_init2(base,POWERPREC);
mpfr_set_str(base,BASESUBPOWER,10,pr);//same
mpfr_t baseadd;mpfr_init2(baseadd,POWERPREC);
mpfr_set_str(baseadd,FIXEDPOW,10,pr);
mpfr_add_ui(base,base,BASEADDINT,pr);
 check=mpfr_cmp_ui (base,1);
if(check==0){puts("Invalid precision");exit(1);}
//create initial bounds
mpf(low);mpfr_set(low,median,pr);
mpfr_mul_2ui(low,low,SCALEFACTOR,pr);
mpf(hi);mpfr_add_ui(hi,median,1,pr);
mpfr_mul_2ui(hi,hi,SCALEFACTOR,pr);
//search for closest base match to window
mpf(Result);u4 first=1;// delta used(delta:11*-8 bytes)
mpfr_t powsub;mpfr_init2(powsub,POWERPREC);
mpfr_set_str(powsub,MINSUBPOWER,10,pr);
if(mpfr_cmp_si(powsub,0)<1){puts("Minimum precision required <e-100");exit(23);}
mpfr_t powres;mpfr_init2(powres,POWERPREC*2);
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);
resetpow;
loop://find one which fits just below window:low
avg(Power);
mpfr_pow(powres,Power,Power,pr);
mpfr_pow(Result,Power,powres,pr);
check=mpfr_cmp(Result,low);//has to be below
checkhi=mpfr_cmp(Result,hi);//or inside window
if(mpfr_cmp(Powerold,Power)==0){//final match
if(check<0){//below, stalled::increase precision!
SYM(SYMBLOW);disp3;reduce2(low,hi,Result);storehex(Power);resetpow;goto loop;}else{//above or inside?
SYM(SYMBHI);//reduce result.
if(checkhi>0){reduce2(Powermin,Powermax,powsub);
goto loop;}else{goto end;}}}
if(check>0){SYM(LOOPPLUS);
swapsave(Powermax);goto loop;};//if max found set powermax
if(check<0){SYM(LOOPMINUS);swapsave(Powermin);goto loop;};
//match found;exit
end:;storehex(Power);puts(SUCCESS);;}

Name: Anonymous 2011-11-14 14:18

Have you yet managed to compress anything better than ZIP or RAR?

Name: FrozenVoid !!mJCwdV5J0Xy2A21 2011-11-14 14:30

>>135
No. I'm exploring theoretical application first.
When its done and works reliably, I'll first demonstrate the algorithm on something incompressible like random data from the Million Digit Challenge.

Name: Anonymous 2011-11-14 16:33

>>136
Don't smear your shit all over the board then.

Name: Anonymous 2011-11-14 19:16

>>136
yep, come up with some working example
 or a poc
make it short and eloquent 
posting shit like a monkey
is irritating
and people just don't read it
let alone the fact that you've managed
to turn 30 lines of code into
a 200 line-behemoth of incomprehensible
shit

Name: Anonymous 2011-11-14 19:19

I was just thinking about infinite compression the other day. How pleasant to see it lives on.

Name: FrozenVoid !!mJCwdV5J0Xy2A21 2011-11-15 2:01

>>138
This is a thread for compression techniques, there is not "one true algorithm" i'm testing. predictably all those versions will not be used ever they're just prototypes, but it possible to learn stuff from the early versions too and not to repeat same mistakes or reinvent the same version
 a month later(instead i'll just view the thread and see,i've tried this approach and it didn't work instead of posting a similar slightly version(i don't have quite a good memory when there 600 of those programs around))

Name: Anonymous 2011-11-15 2:07

Infinite Compression is an impossibility, much like Uncountably Infinite Sets or the Judaic-Christian-Islamic God.

Name: Anonymous 2011-11-15 3:50

>>138
>a 200 line-behemoth
You're not a programmer if you consider a toy program with 200 lines of source a "behemoth"
I've read 10k lines source files and they often take weeks to fully comprehend(or more if the programmer was clever with typedefs and pointer casts).

Name: Anonymous 2011-11-15 5:33

>>1

Well done you have discovered the decimal system

10/10 or should I say 1.0?

next week you kids will be learning the 9 times table

Name: FrozenVoid !!mJCwdV5J0Xy2A21 2011-11-15 9:40

>>143
Its not the decimal system, its exploiting floating point-like convergence to integers.
For example if you generate a number which fits into a range L<>H  3.000... to  3.999...
you can have the integer 3 by discarding the data below the floating point(non-integer remainder) to become 3 to 3.
Now all i do is expand the range by applying a function(e.g. multiplying the range by constant, adding a func(x) to low/hi bounds)
 so range can contain more numbers(more search space) which can be reached.
By lowering the resulting new range down(substraction of low/hi bounds of some function result), the search is simplified because lower numbers are easier to represent(and takes less precision to store).

Name: Anonymous 2011-11-15 10:35

>>144
>adding more bits to determine whether or not you use the half value and still calling it the same
God, I was hoping the trolls on /prog/ would be better than this

Trolling used to be about making stupid people do stupid things, now it's about being as retarded as possible

I'm not upset 4chan is getting DDoSed, kill yourself faggot.

Name: Anonymous 2012-07-16 6:32

FrozenBump technique #4

Name: Anonymous 2012-07-16 7:41

COMPRESS MY ANUS

Name: Anonymous 2012-07-16 10:02

This thread is delicious.

You are generating noise and trying to find a noise generator that contains the data and whose data position are together passive to be stored in less space than the data itself.

To illustrate let's say you want to encode:
0x00000001
0x00000002
0x00000003
0x00000004

Which is 16 bytes. Let's say that after a few minutes your algorithm finds a function that generates 1, 2, 3, 4, 5, ..., let's say you encode it in a subset of assembly for arithmetical and bitwise operations only and each opcode is 4 bits as well as each algorithmic symbol, you might have something like
IN symbol1 // 1 byte
OUT symbol2 // 1 byte
DEC symbol1
SETOUT symbol1

which is a very simple example, maybe the simplest, and costs 4 bytes plus padding

Now of course you want to allow a noise generating function to be able to serve multiple, at least sequential, data chunks, so we need another 4 bytes to indicate this (4 bytes because it seems to be bellow the minimum function size, but lower it if you want)

So we have our 4 byte noise function, 1 byte to indicate end of function, 4 bytes to indicate length of data, then we need around another (data length)/4 bytes to indicate the starting index and then we need to encode the possibility of no function found (in useful time), so...

My dear FrozenVoid, it might encode a little something 0.001% of the time and the expense of a huve computational power over time, worth it? No.

Name: Anonymous 2012-07-16 10:07

Now what might actually be useful is a container compression method, that scans chunks of data to decide the best method of compression to use and compresses accordingly.

You can have compression methods that are particularly effective with pseudo random data (at the expense of being terrible at the rest) and so on.

Name: Anonymous 2012-07-16 12:15

I can do better than this and compress a file to 0 length resulting in a true infinite compression ratio.

- base64 encode the contents of the file
- remove the contents of the file
- rename the file to the base64 encoded string

Name: Anonymous 2012-07-16 12:28

The absolute limit information can be compressed to is to schwarzchild coordinates on black hole surfaces, you should try to crack the algorithm used for that.

Name: Anonymous 2012-07-16 14:33

PIGEONHOLE MY ANUS

Name: Anonymous 2012-07-16 22:25

This thread is a work of art

Name: Anonymous 2012-07-16 23:11

Anything infinite cannot exist in a finite universe.

Name: Anonymous 2012-07-16 23:16

>>150

I love you

Name: Anonymous 2012-07-16 23:23

>>154
This would be true in a finite universe.

Name: Anonymous 2012-07-17 12:29

>>156

The universe is finite.

Name: Anonymous 2012-07-17 16:25

MY DICK IS FINITE BUT UNCOUNTABLY LARGE

Name: Anonymous 2012-07-17 16:28

>>158
I don't think you have a dick. Enjoy your pussy and tits.

Name: Anonymous 2012-07-18 9:57

>>159
OVER 20LBS OF PUSSY AND TITS

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