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

Pages: 1-4041-8081-120121-160161-

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: FrozenAutist !BYmn6QVNCw!ARqrDGkA3TG28fp 2011-11-09 10:21

we all know that I'm going to write that in

a) Javascript, thus completely defeating the purpose of ``fast algorithms''

b) in Frozen++, aka, autism c

Name: Anonymous 2011-11-09 10:22

This is retarded.
Nice copipe, bro.

Name: Anonymous 2011-11-09 10:34

>>2

c) FrozenScript, aka, autism js

Name: Anonymous 2011-11-09 10:56

lawl infinte compression is cool but what is the data loss:?

btw mantissa space is not infinte, hell not even accurate so all these arithmetic compressions based on math are crazy uselss

my idea for infinte compression:
code everything as 0 or 1, on average you only lose 50% of the data!

Name: sage 2011-11-09 10:57

>>5
also sage in all fields

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

The program will be written in C.
In fact have a couple of prototypes, but i can't find a good search function that can be fast enough to search the space and at same time provide enough numbers to fit in the range(this can fixed by expanding scale modifier but that would in turn bloat up the search space, making the search exponentially slower).

Name: FrozenVoid !!mJCwdV5J0Xy2A21 2011-11-09 11:04

>>5
There is no data loss. some files with some functions  will not be able to be compressed if there is no numbers that describe the compressed range for given function.

Name: Anonymous 2011-11-09 11:14

>>8
well the fuck yo' mean 'infinte'
an infite compression ratio would imply that you can get something from nothing, i.e. encoded data has length '0'
this is fucking impossible even for autistic math

also this is 'kinda' like range encoding with floating point numbers

Name: Anonymous 2011-11-09 11:42

Infinite compression implies 1 GB of data is compressed to 1 byte.

There are 4.26 × 10^2525222 different possible gigabytes of data.

There are only 256 different possible bytes.

Explain how you will map 256 values to 4.26 × 10^2525222 values losslessly.

Name: FrozenVoid !!mJCwdV5J0Xy2A21 2011-11-09 11:47

>>10
>Infinite compression implies
I don't imply anything, read >>1 to see what it describes.
a function:(stored as few bytes describing the function number if there multiple functions used)
a 8 bytes long long : scale modifier  to alter range for original number(could be larger e.g. 64 bytes expand search space * (2^8)^64)
a parameter to function: can be several doubles, long longs or floats. about 20-30 bytes max
Thats the best result you can achieve(if the file compresses successfully)

Name: Anonymous 2011-11-09 12:27

>>11
encode "OP is a fag"
show teh relvant 'steps'
and show the compression ratio/factor

Else op confrimed for 'all fur-coat, no knickers, bitches!'

Name: Anonymous 2011-11-09 12:55

You only need 0 bits to compress all possible data and maybe even everything in existence, including yourself (all natural numbers).
However, finding anything you want within such a large amount of data may be unfeasible as it'd be like searching a particular, special small needle in an infinite haystack of small needles.
The next question would be, what would be the shortest program that can generate my data? You'll need to learn about Algorithmic Information Theory and Kolmogorov Complexity to answer that question. What about compressing any data? If we could pick any number at random, we'd expect a good deal of numbers to be Kolmogorov random (no algorithm shorter than the data), however there is the question if we can truly perform this 'pick'. If your random number is generated by a pseudo-random-number-generator, it is computable, thus it will be very compressible. If you random number is generated by, let's say: quantum noise, then it depends on a number of factors, for example, which interpretation of quantum mechanics is the real one. In the case the world is fully computable (PRNGs being used where we assume true randomness), then everything is very easy to compress. In the case some variant of MWI is true (what I consider to be the case, first because when considered independently it's the one that makes most sense, it also is the most probable when considered in the light of various formalizations of Occam's Razor; secondly, my current (with high enough, but not absolute confidence) metaphysical beliefs include Arithmetical Realism and a form of mathematical monism, which essentially gives rise to MWI-like quantum mechanics way too easily when the Anthropic Principle is considered over them, while making most other interpretations highly unlikely), quantum noise will be less likely to be compressable (by a computable function, or Kolmogorov random).
If you don't share my opinion on the nature of quantum mechanics, there is a simpler way to attain the same effect of uncompressability. Consider this thought experiment: You exist at time t0 here in some room, at time t0+delta_t, n (choose a sufficiently large n) identical (be it subparticle-scale, or merely just identical quantum states) copies of yourself and the room you are in are made (they can be placed in various random spatial locations, this part is irrelevant, as long as the locations don't overlap), and the room is altered by adding an index which is visible to each copy, corresponding to the number of the copy (your initial room has number 0 as the index). You are now asked: What number do 'you' see as the index? This assumes that all copies are conscious and philosophical zombies are likely nonsense (please don't consider souls or silly stuff). If you must insist of crazy metaphysics (souls, zombies, etc), then consider a computer or some other digital device instead of yourself and ask yourself from the perspective of the computer, what index does it see?
The obvious answer is that it would seen any number from 0 to n and this number would be truly random (experience is not shared, physical states are consistent with mental states). In a more simplified, and more joking form it would be like looking at the set of natural numbers (or a finite subset of them) and asking those numbers what would the probability of being one of those numbers be (from the perspective of each number, it's 1, but from your 'god'/birds-eye perspective it's 1/n). Anthropic reasoning can be confusing at times.


tl;dr: Computable data is likely to be compressible. Uncomputable or truly random data is likely to not be compressible. "Infinite" compression (0 bit) may be achieved, but that doesn't mean you'll be able to find any data in the infinite mess that it generated (all possible data can be found in a normal number, such as the square root of 2, or the set of natural numbers and so on, which can be computed, even if the algorithm may never halt).

Immediately relevant reading:
"An Introduction to Kolmogorov Complexity and Its Applications" by Li M., Vitanyi P.

Very interesting reading for the more philosophically inclined:
http://www.hpcoders.com.au/nothing.html
http://arxiv.org/abs/0912.5434


(Wait, why am I responding seriously to this reposted thread? /autism)

Name: >>13 2011-11-09 13:22

Oops, forgot to include 2 more papers that are relevant at the end:

Marchal B., 2001, Computation, Consciousness and the Quantum, in Teorie & Modelli, n.s., VI, 1, 2001, pp. 29-43. Special issue on the History and Problems of Quantum Interpretations of Consciousness, ed. by M. Battacchi, V. Fano. (with the kind permission of V. Fano).
"Law Without Law" by John Archibald Wheeler

Name: FrozenVoid !!mJCwdV5J0Xy2A21 2011-11-09 13:32

>>13
1. some data may not be compressible using this technique(it depends on function used: N inputs X scale modifiers will yield X*N files)
2. the idea is the File->Number->Interval is not RANDOM, it makes random numbers into a range.
I'll explain that process more:
Scale Modifier=S(exact S is found for given function input: S expands search space by making the number more "fuzzy")
a Number Z is made into a range by substracting and adding scale modifiers:
Z-S=Low, Z+S=Hi  Range= Low<>Hi
By multiplying Z by Scale:K the the Range is multiplied Low*K > search space < Hi*K
Any number in the search space is not Random, that is huge chunk of number line
Functions which reach into that search space will produce Input:I which expands into  Low*K > func(I) result< Hi*K
By dividing result/K= we get into original range Z-S > original range <Z+S, now we apply +-S to get Z.
Z is now converted to file.

Name: FrozenVoid !!mJCwdV5J0Xy2A21 2011-11-09 13:40

Z-S=Low, Z+S=Hi  Range= Low<>Hi
S is meant to be maximum S(which defines the ranges max reach, not the final S(which is smaller))

Name: Anonymous 2011-11-09 15:21

>>10
python!

Name: HAXUS THE Storage ADmin 2011-11-09 19:40

Infinite compression implies 1 GB of data is compressed to 1 byte.

need to know how to do this for the autists at work that generate multigiga byte render files in AE and generally clog up the file server with their shit.

Name: FrozenVoid !!mJCwdV5J0Xy2A21 2011-11-09 20:26

Note that K itself can be modified with a scale modifier for search windows:
hypothethical example:
/*
 BASE: "1.0000000000000000000000000000000000001"
Power:>0
01=fixed start byte
z=[0x01]+[1023 bytes data]=
z=1024 bytes, S=500 bytes(diff),K=1024*16 bytes(power of 2)
Z-S=low
Z+S=hi
low*K=LowBound
Hi*K=HiBound
To shift window for search:
Kmod=256 bytes(modify to Low*(K-Kmod) <>hi*(K+Kmod)
final:record KMod+ScaleMod+Power<filesize
(Z-S)*(K-Kmod)<search range>(Z+S)*(K+Kmod)


*/

Name: Anonymous 2011-11-09 20:40

Why haven't you killed yourself yet?

Name: FrozenVoid !!mJCwdV5J0Xy2A21 2011-11-09 21:00

K itself can be dynamic, like e^x so seacrch space could be
(Z-S)*(e^x)<>(Z+S)*(e^x) where x is the power of E recorded with ScaleMod

Name: Anonymous 2011-11-09 21:04

Name: Anonymous 2011-11-09 21:19

>>22
Don't bother, YABT. You don't need lots of words to understand the pigeonhole principle or equivalently answer such simple questions as "how many different files can possibly be represented with n bits"

Name: FrozenVoid !!mJCwdV5J0Xy2A21 2011-11-09 21:25

fib series:1...(there are slower growth series ;this is exmaple)
shift window:K=E^x:
(Z-s)*K<fib(n)> (Z+s)*K
the idea is the by shifting the window we find a fib(n) which lies inside the bounds.
Now we record x for e^x and s for Z

Name: matth@eecs.berkeley.edu !!mEFVYLkcRFWjjY+ 2011-11-09 21:51

>>24
That is stupid. Seriously. Can you do more than google shit you fucking idiot?

Name: FrozenVoid !!mJCwdV5J0Xy2A21 2011-11-09 22:42

>>23
n bits can represent 2^n files for sufficient n the 2^n becomes huge enough to contain all the data in the universe(but not the entire set of "possible files" which is near-infinite).
128 bits could be 2^128 files.

Name: Anonymous 2011-11-09 22:59

>>26

that depends on what all the data in the universe is. For a file to represent the state of the universe, it would need to represent the state of each component of the universe. If there are k components of the universe (maybe atoms or some other basic unit) and suppose each component must have one of j states (assuming the states are discrete), then the universe as a whole can have up to kj different states. Each state of teh universe must correspond to a state of a file representing the universe. So basically, the number of bits needed for the file is linearly proportional to the "size" of the universe. You could use log2(k) bits to address the components, but you'll need k * log2(j) bits to represent the states of all of the components.

Name: FrozenVoid !!mJCwdV5J0Xy2A21 2011-11-09 23:51

>a state of a file representing the universe
I don't mean that, i mean real files that can be written. 1mbit can hold 2^1000000 possible files which are probably impossible to store all at once, but one 1mbit of space can address any of them.

Name: Anonymous 2011-11-10 1:11

>>28

But each file is 1 mbit in size... The address is essentially the exact same thing as the file.

Name: FrozenVoid !!mJCwdV5J0Xy2A21 2011-11-10 1:25

>>29
Each file could the entire universe or 1 bit. the 1mbit space is only the address(a function parameter)

Name: Anonymous 2011-11-10 1:32

>>30

oh alright, so you are just enumerating the set of files, and then addressing them with the smallest address needed.

Name: FrozenVoid !!mJCwdV5J0Xy2A21 2011-11-10 3:41

The people thinking pigeongole principle has any relevance to range search:
1. the number of possible files which can be encoded is proportional to ScaleMod and Kmod is much smaller than the set of all possible files.
2. the most of the "possible file" are random garbage, which you don't want to compress anyway like in >>13 so its best to concentrate on
files which can be compressed with the range search.
3. the idea is not limited to a single search function(e.g. fibs) and the scales/Kmods/Scalemods can be generated by functions themself(compactly or storing at most 1/4 file length in parameters).

Name: Anonymous 2011-11-10 5:35

Hey FrozenVoid, I just want to say I love you and your posts so much. Maybe code something like the embryo system in nature, i.e. you have a small seed file which you then grow to the uncompressed file, using some sort of CA ruleset that maybe modifies itself while it's being iterated? I know this is possible because an entire human can be compressed into about 3 MB (just the set of chromosomes!)

You can do it! You shine brighter than any of these narrow-minded faggots! ^___^

Name: Anonymous 2011-11-10 6:10

>>13
Thanks for the post and the links. Will look inside shit threads more often.

Name: FrozenVoid !!mJCwdV5J0Xy2A21 2011-11-10 6:36

I'm thinking of writing a real compressor but i don't have any motivation(its boring and has very low effort/reward ratio).
If any wants to ask technical details, you have to write it yourself.

Name: Anonymous 2011-11-10 6:39

INFINITE COMPRESSION IS IMPOSSIBLE

Name: FrozenVoid !!mJCwdV5J0Xy2A21 2011-11-10 6:43

>>36
Impossible is nothing. You define the "infinite compression" as some arcane magic formula which makes everything smaller.
This is more of "search algorithm", which is successful writes a number in way which is very compact.

Name: Anonymous 2011-11-10 7:02

>>35
Could you post pseudocode for what it expected to do?

Name: Anonymous 2011-11-10 7:02

>>1
So if 3*10 is the range 30.0000000... to 39.99999999..., then what integer represents the range 30.0000000... to 30.99999999...?

Name: FrozenVoid !!mJCwdV5J0Xy2A21 2011-11-10 7:05

>>38
openfile(name)
split file into 1023byte chunks
generate max S(Scalemod_max) which is about 500 bytes in length. 2^m
for each chunk{creat buf=1024 bytes
buf[0]='0x01' to prevent leading null byte
add chunk to buf
convert buf-> integerX
X-S= low bound 
X+S =High bound
multiply both bounds by K= 2^65535
search numbers inside new bounds
which Res= (1+(1e-100))^y= between low and hi
record y, divide Res/K=D,
record difference between X and D as  Scalemod(Scalemod<S (max)),
write result as chunk into new file, repeat next chunk
}

Name: FrozenVoid !!mJCwdV5J0Xy2A21 2011-11-10 7:06

>>39
30.999../10=3.09=3(truncate)
30.000../10=3.00=3(truncate)

Name: FrozenVoid !!mJCwdV5J0Xy2A21 2011-11-10 7:10

>>40
The idea is that K can be modified during search(K=power of 2,K=fib(x0,K=e^1000) so the Result can be found closer to Y and Y can be fit closer to window by modifying y(its synergistic process)

Name: Anonymous 2011-11-10 9:08

>>1
Since the range is enormous there are certainly some numbers which can be represented in short form as function(x)=number_in_range.

How does one find said function?
I get your idea, it's called generalization (also used in AI) but the problem is the same as with AI, the more complex the function, the longer it takes to find, even if the resulting function is only 20 bytes in size, probability says that it will still take approximately 256^20 iterations to find.

Name: FrozenVoid !!mJCwdV5J0Xy2A21 2011-11-10 9:32

>>43
That why i don't like running this algorithm, the search time in the search space is huge and the only matches are for small files, growing exponentially longer for longer files. i.e. each search run to test(new formula/search function/Kmod/Scalemod) will take hours.
I'm certainly missing some optimizations there but its very limited since there is need to search huge amount of functions calls against a shifting window, inherently requirement to get correct results is to get inside the window or to shift window towards results(both take many operations(window shifting is faster on average, but requires to generate new y values for windows shifting instead of converging into window), leaving nothing to do but watch as search space is searched a region at the time).

Name: Anonymous 2011-11-10 9:46

>>44
Why can't you use smaller chunks like 8 bytes?

Name: FrozenVoid !!mJCwdV5J0Xy2A21 2011-11-10 9:51

>>45
1.metadata for a chunk(the algo values for scalemod,y,k) always require some minimum space ~>40 bytes
2.8 bytes is too small for search space and any matches there will be proportionally bigger than matches in 1024 byte(i.e. the value matches will takes about or more then 8 bytes too,ruining compression, plus since the search space is small there will be less potential windows(requiring much more window shifting and scalemod)).
Its like ZIP compression on 3 byte chunks(it wont work).

Name: FrozenVoid !!mJCwdV5J0Xy2A21 2011-11-10 22:47

There is also interesting variant a with a single Y calculation or precomputed Y and window shifting using dynamic K formula(K-KMod*N+a)

Name: Anonymous 2011-11-10 23:09

http://en.wikipedia.org/wiki/Berry_paradox

You can't really compress data for which there is no algorithm shorter than the data itself which generates the data (and only it).

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

>>48
The problem isn't that.With the current search algorithms is too slow to be finished in a thousands of years.
When i get something faster i could easily check a chunk of data and decided if it is compressible by a single function, or check multiple functions. That means the compression is limited by the amount of time it takes to check all the search space near multiplied Z((Max window)*(Max scalemod) distance, which increases search space in both directions).
I'll probably try something along lines of >>47 to save computation time

Name: Anonymous 2011-11-11 2:07

infinite compression would require infinite decompression

Name: FrozenVoid !!mJCwdV5J0Xy2A21 2011-11-11 2:25

>>50
The process is assymetric.
You just get (func(Y)/(k-Kmod))+-scalemod and thats the original number.

Name: Anonymous 2011-11-11 3:31

/* inf_compress: compress data into a single word */
unsigned int
inf_compress(char *data, int len)
{
    return 0;
}

Name: FrozenVoid !!mJCwdV5J0Xy2A21 2011-11-11 3:43

>>52
Thats just a useless function that shouldn't even be run and has zero relevance to the thread.

Name: Anonymous 2011-11-11 3:50


unsigned char inf_compress(char *data, int len) {
    return (unsigned char) FROZEN_VOID;
}

Name: FrozenVoid !!mJCwdV5J0Xy2A21 2011-11-11 4:34

Well since i don't have anything useful to compress and i'm not going to develop software for retards, i'm deleting the project.

Name: Anonymous 2011-11-11 5:51

>>55
and i'm not going to develop software for retards
Careful here, young man, you are close to immanentizing the Barber's Paradox, and who knows what might happen then!

Name: FrozenVoid !!mJCwdV5J0Xy2A21 2011-11-11 6:29

>>56
I hope some company will develop a closedsource version thats fast enough and get millions for paid cloud/file storage,etc though i will not use such services anyway:hard drive space is enough for any uncompressed files i have.

Name: Anonymous 2011-11-11 7:58

>>55
not going to develop software for retards

`>implying you ever actually wrote anything useful to begin with

i'm deleting the project

WAAAAAAHH NOBODY LIKES MY PROJECT Y U GUISE SO EVIL BAWWWWWWWWWW

hint: your software is shit, the way you write code is ridicolous at best, you have never heard of the word 'intendation', you pointlessly obfuscate even simple statements, and you are, ontop of that, a raging autistic furry

Name: Anonymous 2011-11-11 8:14

>>57
I hope some company will develop a closedsource version thats fast enough and get millions for paid cloud/file storage,etc

That is highly fucking unlikely, and it's even unlikelier that they're going to use your autism-powered libyiffmytailhole

now go back to your hugbox

Name: Anonymous 2011-11-11 9:00

>>57
No need to worry, it won't happen because it's mathematically unfeasible. Even given 'infinite' time and space for compression, there is data which is just plain uncompressible (takes more space than the program generating it).

Name: FrozenVoid !!mJCwdV5J0Xy2A21 2011-11-11 9:27

>>60
There are alot of numbers in the window of (scalemod*K) which is of thousands of bytes long(its much larger than a chunk of data being compressed, though its location far up on the number line).
by telling me its "mathematically unfeasible" you mean no number in those windows can be represented via a function.
I.e. there huge deserts in the number line which cannot be reached by any formula

Name: Anonymous 2011-11-11 10:12

>>61
There are 2 major problems with your idea, first is that the multiplier may very well take as much space as your data (or around that size), which already defeats the purpose. If that problem is ignored, there will be data which cannot be generated by the function and have the function's encoding be smaller than the data, this being even in the case where you're looking for a wide range. Instead of limiting the search to simple mathematical functions, I tell you to look at the best possible encoding (which is why I linked you to Algorithmic information theory and Kolmogorov complexity, which is uncomputable, yet I still allowed it in that example by saying 'infinite space and time'). Of course, the encoding(of the code of the function) is irrelevant due to the Church-turing thesis as you will always be able to translate it from one language to another, so you should fix it to some particular language/encoding, but once that is fixed, there will always exist large amounts of uncompressible data (algorithmically random). It may be that you would never actually want to compress such data of course (for example, if our universe was locally deterministic, which is unlikely given what we know from QM). However, even if we ignore those algorithmically random sequences and your multiplier problem and just consider the search for that particular function (finding the best one is not possible due to KC being uncomputable, but surely one can find better representations given enough time and space). Not that such an exhaustive search is feasible in this particular universe we live in (resources too limited), but theoretically the idea is feasible (ignoring our current local limitations).

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

>first is that the multiplier may very well take as much space as your data
there 2 parts, and they don't take as much space
K is the window multiplier(its 2^power about 8 bytes max to store power)
Kmod may takes some space(this does not mean it should be even more than 1/10 the filesize,a function generated Kmod would be also 8 bytes) Kmod is dependent on how much search space you want to cover
Scalemod can be up to half filesize(to provide as wide windows for search as you like)
The maximum it would take 60% of initial data if compressed successfully.
Also if we drop Kmod, K+Scalemod is about half the filesize;
without Kmod search space is:
(Z-S)*K <> (Z+S)*K  (though its unlikely to yield any matches; its one window only(even 128bit Kmod adds huge amount of windows)
with Kmod:
(Z-S)*(K-Kmod)<>(Z+S)*(K-Kmod) search to (Z-S)*(K+Kmod) <>(Z+S)*(K+Kmod)

Name: Anonymous 2011-11-11 11:58

Complete bullshit, you don't have any programs imaginary or not, that even work and you expect us to believe this autistic fantasy.
Show code, any real code which you wrote instead of mathemathical masterbation.

Name: FrozenVoid !!mJCwdV5J0Xy2A21 2011-11-11 12:04

>>64
I only have a small prototype which is limited to 1 function
and its very very slow. You can have it since i'm not interested in this anymore:
//====Headers
//the code is of bit of mess, this is unchunked, single file at onc e version which takes alot of time to search
#define VERSION "Infinity Compressor 1.01 by FrozenVoid\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
//====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);
}


#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 0 //symbolics
#define DEBUG3 0 //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)

 //(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

}
//------INPUT--------
#define PR0 MPFR_RNDN
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;
s8 Kmod=0; //window modifier
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,PR0);
mpf(scalemodmax);//window bounds(1/2 filesize to be safe)
mpfr_set_ui(scalemodmax,1,PR0);
mpfr_mul_2ui(scalemodmax,scalemodmax,inpsize*4,PR0);//scalemods max=half filelength in bits
mpf(K);//window base multiplier=2^inpsize8: 4 times;
mpfr_set_ui(K,1,PR0);//4 times muls
mpfr_mul_2ui(K,K, bitlen,PR0);
mpfr_mul_2ui(K,K, bitlen,PR0);
mpfr_mul_2ui(K,K, bitlen,PR0);
mpfr_mul_2ui(K,K, bitlen,PR0);

//base =1+ 1e-100
mpfr_t base;mpfr_init2(base,POWERPREC);
mpfr_set_str(base,"1e-100",10,PR0);
mpfr_add_ui(base,base,1,PR0);
 check=mpfr_cmp_ui (base,1);
//create initial bounds
mpf(Zlow);mpfr_sub(Zlow,median,scalemodmax,PR0);
mpf(Zhi);mpfr_add(Zhi,median,scalemodmax,PR0);
//multiply bounds to get initial,non-kmod window
mpf(Low);mpfr_mul(Low,Zlow,K,PR0);
mpf(Hi);mpfr_mul(Hi,Zhi,K,PR0);
//search for closest base match to window
mpf(Result);//Power is 512 bits;result stores Base^Power
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(Power,"2",10,PR0);
mpfr_set_str(Powermin,"1",10,PR0);
mpfr_set_str(Powerold,"0",10,PR0);
//genrate match above Hi
if(DEBUG)puts("\nCalculating initial bounds");
preloop://
mpfr_pow(Result,base,Power,PR0);
check=mpfr_cmp(Result,Hi);
if(check<1){if(DEBUG2)printf("*");
mpfr_mul_ui(Power,Power,1024,PR0);
goto preloop;};//if max found set powermax
mpfr_set (Powermax,Power,PR0);
if(DEBUG)puts("\nCalculating closest match to window");
mainloop:;//search for closest match
//power=avg(Powermax,Powermin)
mpfr_add (Power,Powermax,Powermin,PR0);
mpfr_div_2ui(Power,Power,1,PR0);
mpfr_pow(Result,base,Power,PR0);
checkold=mpfr_cmp(Power,Powerold);
checkhi=mpfr_cmp(Result,Hi);
checklow=mpfr_cmp(Result,Low);
if(checkold==0){if(DEBUG2)printf("=");
if(DEBUG)printf("\nInitiating window search: Result is %s window",checkhi>0?"above":"below");
mpfr_out_str(output,16,0,Power,PR0);
goto windowsearch;//power stall:search window to Result
}
if(checkhi>0){if(DEBUG2)printf("+");
mpfr_set(Powerold,Power,PR0);
mpfr_swap(Powermax,Power);
goto mainloop;}
if(checklow<0){if(DEBUG2)printf("-");
mpfr_set(Powerold,Power,PR0);
mpfr_swap(Powermin,Power);
goto mainloop;}
//inside initial window
if(DEBUG)printf("Found match inside initial window");
mpfr_out_str(output,16,0,Power,PR0);//write power(hex)

goto ex1;//success :Inside initial window?
//implement correct window shifting code
windowsearch://to get Result into window, shift window
//search direction: simple add+-1
checkhi=mpfr_cmp(Result,Hi);
checklow=mpfr_cmp(Result,Low);
if(checkhi>0){//Result is up, shift window up
Kmod++;//Kmod Up, Hi/Low+=Scalemodmax
if(DEBUG2){printf("+");}
mpfr_add(Hi,Hi,scalemodmax,PR0);
mpfr_add(Low,Low,scalemodmax,PR0);
goto windowsearch;
}
if(checklow<0){//Result is down ,shift window down
Kmod--;//Kmod down
if(DEBUG2){printf("-");}
mpfr_sub(Hi,Hi,scalemodmax,PR0);
mpfr_sub(Low,Low,scalemodmax,PR0);
goto windowsearch;
}
//found Kmod: apply Kmod to
if(DEBUG)printf("Found Kmod for window");
ex1:;//output result :Scalemod & exit
if(DEBUG)printf("Calculating final scalemod");
mpf(newK);mpfr_set_si(newK,Kmod,PR0);
mpfr_add(newK,K,newK,PR0);//newK=K-+Kmod
fwrite(&Kmod,8,1,output);//write Kmod
mpfr_div(Result,Result,newK,PR0);//get into initial window
check=mpfr_cmp(Result,median);//if R>M scalemod neg
mpf(scalemod);mpfr_sub(scalemod,median,Result,PR0);
mpfr_out_str(output,16,0,scalemod,PR0);//write scaledmod(hex)
//====================================
; }

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

The window search is not not as finished as the other parts (it for signed long long  Kmod, not a arbitrary prec Kmod) so you may want to improve that first(its just substracts/adds scalemodmax).

Name: Anonymous 2011-11-11 12:32

>>65
Why don't you use v0 anymore?

Name: FrozenVoid !!mJCwdV5J0Xy2A21 2011-11-11 12:37

>>67
That code is before #define v0 void was introduced

Name: Anonymous 2011-11-11 12:39

>>68
Ah, okay. I was worried there for a minute. It looks inconsistent and ugly this way.

Name: FrozenVoid !!mJCwdV5J0Xy2A21 2011-11-11 12:54

The GCC version of rdtsc is much uglier than any void types.

Name: Anonymous 2011-11-11 12:58

>>70
What does it do?

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

return timestamp counter, compare with clean DMC version
inline unsigned long long rdtsc(){__asm{RDTSC}}

Name: Anonymous 2011-11-11 13:05

>>72
Why don't you just use clock() then?
Also, that version looks strange, since it doesn't return anything.
Compare with MSVC instead: __rdtsc()

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

>>73
clock() is very slow. rdtsc is the only thing that can calculate a dozen CPU cycle delays(if not interrupted thread).

Name: Anonymous 2011-11-11 13:28

>>74
If you're timing so often that a few cycles matter you're doing it wrong.

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

>>75
How else would you calculate a opcode costs in a small loop or a single operation?
You seriously expect to calculate speed of single random array access or couple of math ops with function calls to clock()?

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

I don't rewrite code(making the code a huge pointless loop) to time it, i just insert rdtsc() calls at start and finish.

Name: Anonymous 2011-11-11 13:47

>>76
Yes, do it a million times in a loop.

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

Name: Anonymous 2011-11-11 13:52

>>79
And you're implying that gives you the correct number of cycles?
You know, if you want such precision, just look at the asm and count the cycles per instruction manually.
Or use GDB.

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

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

Name: Anonymous 2012-07-18 20:37

>>160
OVER 150LBS OF melancholy and regret :(

Name: Anonymous 2012-07-18 20:58

uh, i think there's already a compression like that.

weight characters into 0-1 space by entropy in file, pick the space of the first character in the file, map original space into that space, pick next, etc etc, pick a random fixed point number in final space. it's like other compression methods only nobody uses it because its shitty.

Name: Anonymous 2012-07-18 21:00

>>162
PIGEONHOLE PRINCIPLE MOTHERFUCKER DO YOU SPEAK IT

Name: Anonymous 2012-07-18 21:03

>>163
i'm well aware of pigeon hole principle dumbass. do you notice a) you weight the points by entropy. its equivalent in compression to huffman and b) you pick a fixed point value in the end, fixed point values take up as much space as they have precision. hence: its a shitty compression and nobody uses it. that doesn't change the fact that it exists and i had to learn about it in class.

Name: Anonymous 2012-07-19 8:10

>>162
Are you trying to describe http://en.wikipedia.org/wiki/Arithmetic_encoding, that everybody wants to use because it's AWESOME, but it's patented, so freetards generally avoid it?

Name: Anonymous 2012-07-19 11:56

Arithmetic encoding is a lot of hot wind. It relies  strongly on a pattern predictor, as it encodes the difference between the predictor and the actual data. A badly chosen predictor will ruin your compression ratio.

Also, I do not understand the patents. I have the article "Practical implementations of arithmetic coding" from the book "Image and Text compression (1992)". It does not speak of patents, only the Nasa grant that supported it. I also browsed through a couple of the patents mentioned in the wiki page, and they are just silly as they seem to patent certain way of implementation, not the algorithm. Once again it is illustrated that software patents are just bull and need to be abolished. Guess the patent layers make too much money from it.

Name: Anonymous 2012-07-19 22:11

>>165

I think ey is talking about huffman coding, which is good when your file consists of symbols that have an uneven distribution. The number of bits required to represent each symbol is adjusted so that the more frequent symbols get shorter representations, and the less frequent symbols get longer representations. If the frequent symbols show up a lot, the net size of the file can be reduced. This technique isn't effective on data with an even distribution of symbols. There needs to be symbols with high frequency counts, like the letter e and the space in english text.

Name: Anonymous 2012-07-19 22:18

>>165
yeah thats the one, i forgot the name. how is it at all different in compression ratio from huffman coding. (not saying its not i just don't get why it would be)

Name: Anonymous 2012-07-19 22:27

>>167
ey
Fuck off and die of a slow debilitating disease you little faggot dipshit.  If it ain't singular they, it's crap.

Name: Anonymous 2012-07-20 1:01

>>169

reevaluate your hateful language, friend. i think you will find that any negative connotations you would seek to attach to "faggot", or "nigger" as the mood fits you, actually apply to yourself, sir.

Name: Anonymous 2012-07-20 1:36

>>170
I don't think so, fagstorm.  Fuck you and die.  And I'm no homophobe nor racist.

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