+ Post New Thread
Results 1 to 6 of 6
General Chat Thread, Christmas Lectures - compression in General; Just listening to RI Xmas lectures and heard an explanation of data compression which explained how numbers 0-31 can be ...
  1. #1

    Join Date
    Sep 2007
    Location
    Birmingham,UK
    Posts
    44
    Thank Post
    29
    Thanked 1 Time in 1 Post
    Rep Power
    0

    Question Christmas Lectures - compression

    Just listening to RI Xmas lectures and heard an explanation of data compression which explained how numbers 0-31 can be represented in 5 bits (this followed an earlier explanation of natural binary showing 0-15 represented by 4 bits and 0-1023 by ten bits.)
    Since natural binary represents 0-31 in 5 bits, this does not seem a very convincing explanation of data compression.

    Does anyone know of a good, simple explanation of data compression?

    Don.

  2. #2

    russdev's Avatar
    Join Date
    Jun 2005
    Location
    Leicestershire
    Posts
    6,931
    Thank Post
    709
    Thanked 552 Times in 367 Posts
    Blog Entries
    3
    Rep Power
    204
    I had forgotten about the Christmas Lectures thanks for the reminder and looks like they are free on five.tv

    Russ

  3. #3

    Join Date
    Aug 2005
    Location
    London
    Posts
    3,157
    Thank Post
    116
    Thanked 529 Times in 452 Posts
    Blog Entries
    2
    Rep Power
    124
    I haven't seen the programmes so I'm not sure what point they were trying to make with the 0-31 in 5 bits but I'm guessing it's to do with the fact that normally you'd store numbers in at least 8 bits. If you can be sure that you only need the values 0-31 then you can save space by packing stuff more tightly (but it's not a good example!)

    Suppose you have a bitmap image. the "standard" way of storing it is to look at each pixel, work out how much red, green and blue and allocate 1 byte for that (so a pure red pixel might be stored as 3 bytes - 255,0,0; yellow would be 255,255,0; magenta would be 255,0,255 and so on). This means that if you have a 1024 x 768 image you need 1024 x 768 x 3 bytes to store it - a total of 2304 kilobytes which is a big file!

    A simple example of compression is something called run length encoding. Instead of looking at each pixel, you look for patterns. Suppose the picture has a lot of sky in it. It might be that you have 200 pixels in a row which are all (0,100,200) (in RGB values). What you can now do is store this as 4 numbers - a value 200 followed by 0,100,200 - this reduces the 600 bytes to just 4.

    What you're now doing is storing blocks of 4 bytes; the first is a count, the next 3 are the RGB values. If there are lots of blocks of identical colour then this works well. If the colours are more varied then it falls over - you can end up having to use 4 bytes instead of 3 if you have 2 different colours alternating, for example.

    text compression is often done using dictionary type tables. If you are just using a simple alphabet (ie no accented letters) then there are spare numbers in the ASCII set from 128 to 255. This allows you to say that instead of storing (say) "THE" as 84,72, 69 you store it as 128; "AND" can be stored as 129 instead of 65, 78, 68 and so on. In these examples, you use 1 byte instead of 3 for the words; if you can replace longer words then you get even better compression but you do also have to store the dictionary which says "128=THE; 129=AND; 130= anti-disestablishmentarianism" etc so again, if you don't have many words which are repeated then you don't gain.

    I think that the same sort of technique is used by zip compression but instead of looking for words, you look for patterns of bytes and replace them with single codes.

    Each of these techniques is lossless - you can get back exactly what you started with. mp3 and jpg compression are lossy - you don't get back what you started with but what you get is probably good enough. The maths behind these is a bit difficult (look up discrete cosine transform and be boggled!)

  4. #4

    mattx's Avatar
    Join Date
    Jan 2007
    Posts
    9,240
    Thank Post
    1,058
    Thanked 1,068 Times in 625 Posts
    Rep Power
    740
    If anyone wants these [ and some of them are quite good ] - the explanation on quantum computing was well thought out - then I have the AVI's
    They will be going on our media server when I return to work.......

  5. #5

    mattx's Avatar
    Join Date
    Jan 2007
    Posts
    9,240
    Thank Post
    1,058
    Thanked 1,068 Times in 625 Posts
    Rep Power
    740
    Quote Originally Posted by dbrown View Post
    Just listening to RI Xmas lectures and heard an explanation of data compression which explained how numbers 0-31 can be represented in 5 bits (this followed an earlier explanation of natural binary showing 0-15 represented by 4 bits and 0-1023 by ten bits.)
    Since natural binary represents 0-31 in 5 bits, this does not seem a very convincing explanation of data compression.

    Does anyone know of a good, simple explanation of data compression?

    Don.
    Wikipedia has quite a good entry on it.....

    [ame=http://en.wikipedia.org/wiki/Data_compression]Data compression - Wikipedia, the free encyclopedia[/ame]

  6. #6
    Trapper's Avatar
    Join Date
    Apr 2007
    Location
    Birmingham
    Posts
    1,211
    Thank Post
    74
    Thanked 148 Times in 119 Posts
    Rep Power
    93
    Very good lectures this year.

    I agree with Mattx, even I understood the basic theory behind quantum computing

SHARE:
+ Post New Thread

Similar Threads

  1. Backup Compression Ratios
    By danrhodes in forum Hardware
    Replies: 1
    Last Post: 5th December 2008, 08:44 AM
  2. NT Backup compression
    By exsupport in forum Windows
    Replies: 0
    Last Post: 27th October 2008, 08:14 PM
  3. Backupexec tape compression
    By djdos in forum Windows
    Replies: 6
    Last Post: 18th June 2008, 08:50 PM
  4. FREE compression tools
    By mattx in forum Windows
    Replies: 4
    Last Post: 19th November 2007, 12:19 PM
  5. Outlook/Exchange Graphic Compression
    By park_bench in forum Windows
    Replies: 1
    Last Post: 7th September 2007, 10:15 AM

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •