Click here to Skip to main content
15,886,724 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
It's for a data compressor... The code is FreeBasic.. ( freebasic.net )

if n1 = 110 or 111 it compresses a bit..
if n1 = 000 or 001 it expands 2 bits..

it compresses a bit more often than it expands 2 bits, so it overall it compresses..

n1 = 3 bits

if n1 = "000" then outs+= "0" : map+= "1101"
if n1 = "001" then outs+= "1" : map+= "1101"

if n1 = "010" then outs+= "0" : map+= "11"
if n1 = "011" then outs+= "1" : map+= "11"

if n1 = "100" then outs+= "0" : map+= "10"
if n1 = "101" then outs+= "1" : map+= "10"

if n1 = "110" then outs+= "0" : map+= "0"
if n1 = "111" then outs+= "1" : map+= "0"


Got to figure out a bit sequence for the "1101" it neds to be a sequence that the other 3 outputs can't equal out to..

You turn the "outs" and "map" into output chars..
And then pass the output to a zip lib, and then repeat , until the output is bigger than or equla to the input...

What I have tried:

played around with different sequences...

0101

etc...
Posted
Updated 22-Oct-21 14:45pm
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900