Dodicat Zlib

General FreeBASIC programming questions.
Locked
albert
Posts: 6000
Joined: Sep 28, 2006 2:41
Location: California, USA

Re: Dodicat Zlib

Post by albert »

@Dodicat

I'll try to write an airfoil simulator , I'll post it in Pentacles.. This thread is dedicated to your Zlib compression code...

To reduce air drag... You put dimples in all the surfaces of the airplane and wing..

The dimples along the air flow, reduce the area connecting with the air..

So if you take a sheet of plywood and blow air along the the length , there's aero drag..
If you put dimples all over the surface of the plywood , that reduces the area that is coming into direct contact , with the air flow..

Dimples would also work on Semi-tractor trailers..
1 inch dimples all over the top and sides of the truck and trailer.. would reduce the air drag and increase fuel economy..
Last edited by albert on May 02, 2021 18:30, edited 1 time in total.
albert
Posts: 6000
Joined: Sep 28, 2006 2:41
Location: California, USA

Re: Dodicat Zlib

Post by albert »

@anyone

How do you zip a folder?
If you have nested directories?

What would the process be?

How would you store the dirs and files? so they can be undone?

All i could think up , is to create a string dir name , then add each compressed string to that string with "END" after each file string??

How would you store the dirs anf files in the single output string?

I'm not asking how to compress : ( I already got that. ) , I'm asking ; how to store the nested dirs and files..
Would you use something like a FAT table , or a database??
angros47
Posts: 2323
Joined: Jun 21, 2005 19:04

Re: Dodicat Zlib

Post by angros47 »

What you want to do is called "archiving", not compression. Basically you want to pack several files into a single file. Many compression program (like WinZip, or 7zip, or rar) can do both things: archiving, and compression.

Under Linux the two operations can be separated: you can archive files with the command "tar", that will create a file with extension "tar" (it means Tape ARchive), that contains many files or subdirectories: it is not compressed, its size is equal or higher to the sum of the various files

Linux also features compression programs (like gzip, or bzip) that can compress single files. So, to create a compressed archive, usually first a tar file is created, then it is compressed (hence the compressed archive will have extension .tar.gz or .tar.bz)
albert
Posts: 6000
Joined: Sep 28, 2006 2:41
Location: California, USA

Re: Dodicat Zlib

Post by albert »

@angros47

Thanks!!
That answers my question.. ( Archiving.. )

So you use tar and then compress the tar file... Problem solved!!

I can't post the compression , till i get the decompression working...
And the compression isn't a mathematical formula, It's a process..
So it requires some search and replace , which is a little confusing..
And i think i need some assistance with it , and can't ask for help , I have to figure it out on my own..

So it might be a while till i figure it out...
albert
Posts: 6000
Joined: Sep 28, 2006 2:41
Location: California, USA

Re: Dodicat Zlib

Post by albert »

I could just leave it , as a single file compressor..

Then , if you want to zip a folder , you run a regular zip program on it , and then zip the zip file..

Maybe call it , ZIP-ZIP
angros47
Posts: 2323
Joined: Jun 21, 2005 19:04

Re: Dodicat Zlib

Post by angros47 »

You can't achieve compression if you zip an already zipped file. Check it if you don't believe
albert
Posts: 6000
Joined: Sep 28, 2006 2:41
Location: California, USA

Re: Dodicat Zlib

Post by albert »

@angros47

That's what my process does.. It compresses random data.. So you can zip a zip file...

When i first started computing , back in 1993 , i had an IBM AT with a two 40 megabyte hard drives..
I spent 50 dollars on PKZIP.. and tried to zip a zip file.. It expanded.. So it started a dream of zipping zip files..

In 90 , 91 , 92 , I worked at Sun Mountain Lodge in Winthrop Washington.
Micro-Soft used to hold their corporate pow-wows at Sun Mountain and book 75 rooms for their top members of each department..
I got to meet all the exec's , and Bill and Melinda Gates. And that made me want to get back into programming..

When i was in the U.S. Army in 1983 , I bought an Atari 800XL and learned basic programming..
It only had 64K of memory and a tape drive and a 1 MHZ processor.. So the programs had to be small..

Over the years i was too busy working and earning an income to give data compression a second thought..
Then in 2009 , I got on Social Security and got housing..
So now i got lots of free time , to work on compression...
jj2007
Posts: 2326
Joined: Oct 23, 2016 15:28
Location: Roma, Italia
Contact:

Re: Dodicat Zlib

Post by jj2007 »

albert wrote:So now i got lots of free time , to work on compression...
You shouldn't "work" on compression. You should read about the basics of compression. Without understanding the theory, you will NEVER get off the ground.
albert
Posts: 6000
Joined: Sep 28, 2006 2:41
Location: California, USA

Re: Dodicat Zlib

Post by albert »

@jj2007

Current compression techniques won't work on a zip file..
There's no patterns , left in the data..

In a 64K zip file , there's like 63,000 unique ushorts.. only several hundred duplicates.

I've got a process that seems to work.. But I can't post it till i get the decompression working..
Compresses 1,000,000 bytes down to under 9,000 bytes ( 99.24% compression ) over 100 loops..
But it's slow , takes 90 - 96 seconds , to do 100 loops..
angros47
Posts: 2323
Joined: Jun 21, 2005 19:04

Re: Dodicat Zlib

Post by angros47 »

albert wrote: Current compression techniques won't work on a zip file..
There's no patterns , left in the data..
True. That is the answer. That is what we keep telling you since years. So why you keep bringing this up?

I've got a process that seems to work..
No. It doesn't work. It's mathematically impossible. You will find out that you can't decompress it. So, please, stop pestering everyone with this.
jj2007
Posts: 2326
Joined: Oct 23, 2016 15:28
Location: Roma, Italia
Contact:

Re: Dodicat Zlib

Post by jj2007 »

albert wrote:@jj2007

Current compression techniques won't work on a zip file..
I know, I have read the manuals.
Compresses 1,000,000 bytes down to under 9,000 bytes ( 99.24% compression ) over 100 loops
Those who have not been too lazy to study the theory know that this is nonsense. But keep on posting, Albert, nobody cares. This might change if one day you start reading the theory, instead of playing around with numbers like a 3 year old child.
albert
Posts: 6000
Joined: Sep 28, 2006 2:41
Location: California, USA

Re: Dodicat Zlib

Post by albert »

@angros47

My process is not math or logic.. Neither of those work to compress..

I spent several years trying every sort of mathematical and logical type of manipulation.. They don't work..

Spent 1,000's of hours on ltrim , rtrim... i couldn't get those to work either , the map of the trims always expanded the data..

One that did work , turn the 8 bits into a str() or oct() and rtrim the "0's" .. but you can't tell for sure if you trimmed a 0 or not , and a map expands the data.. so a oct 330 would come out as a 33 you don't know if it's a 033 or 330. ???

So I had to resort to other types of manipulations...
jj2007
Posts: 2326
Joined: Oct 23, 2016 15:28
Location: Roma, Italia
Contact:

Re: Dodicat Zlib

Post by jj2007 »

albert wrote:My process is not math or logic..
I guess we can all confirm that.
albert
Posts: 6000
Joined: Sep 28, 2006 2:41
Location: California, USA

Re: Dodicat Zlib

Post by albert »

trailers , for sale or rent
rooms , to let 50 cent

I'm a man of means , by no means
"King Of The Road"

YouTube Roger Miller "King Of The Road"
albert
Posts: 6000
Joined: Sep 28, 2006 2:41
Location: California, USA

Re: Dodicat Zlib

Post by albert »

@jj2007

I dug up one that i thought had some promise... It's a math formula... But i couldn't get it to decompress..
Can't tell where s1 ends and s2 starts.

Maybe someone else can figure out how to make it work??? Maybe not!!! I couldn't figure it out cause I'm stupid... "Wizard Of Id"

You have to call Zlib.dll on the output chrs. cause it sometimes expands.
If you have a 255 it outputs 16 bits..
If you have a 128 it outputs 2 bits..

v1 = val( "&B" + n1 )

s1 = ""
if v1 > 127 then v1-= 128 : s1+= "11"
if v1 > 063 then v1-= 064 : s1+= "10"
if v1 > 031 then v1-= 032 : s1+= "01"
if v1 > 015 then v1-= 016 : s1+= "00"

s2 = ""
if v1 > 007 then v1-= 008 : s2+= "11"
if v1 > 003 then v1-= 004 : s2+= "10"
if v1 > 001 then v1-= 002 : s2+= "01"
if v1 > 000 then v1-= 001 : s2+= "00"

outs+= s1 + s2

Don't ban me , for posting this CoderJeff..
Locked