Data Compression & Transmission

Comprehensive Guide to Data Handling, Transfer Methods, and Network Communication

📊 Data Compression

Data compression reduces file size by re-encoding data to use fewer bits. The primary goals are to save storage space and reduce transmission time.

Lossless Compression

Definition: Reduces file size WITHOUT losing any original data

Key Principle: Eliminates statistical redundancy

Perfect Reconstruction: Original data can be fully restored

Compression Ratio: Typically 2:1 to 3:1

Common Methods:

  • Run-Length Encoding (RLE): Replaces repeated sequences with count-value pairs
  • Dictionary Coding (LZW): Builds dictionary of frequent patterns
  • Huffman Coding: Assigns shorter codes to frequent characters

Use Cases: Text files, program code, databases, ZIP files, PNG images

Lossy Compression

Definition: Permanently discards some data to achieve higher compression

Key Principle: Removes perceptually less important information

Approximate Reconstruction: Output is similar but not identical to input

Compression Ratio: 10:1 to 100:1+

Common Methods:

  • JPEG (Images): Chrominance subsampling, DCT, quantization
  • MP3 (Audio): Psychoacoustic modeling, auditory masking
  • Video Compression: Spatial & temporal compression

Use Cases: Photos, music, video streaming, web media

Comparison: Lossless vs Lossy Compression

Aspect Lossless Lossy
Data Integrity Perfect Imperfect
File Size Reduction Moderate Significant
Reversibility Fully reversible Not reversible
Quality No loss Quality degradation
Best For Text, code, archives Media files

📡 Data Transmission

Data transmission involves sending digital data from one device to another over communication channels.

Transmission Methods

Serial Transmission

Bits sent one after another on a single channel

Advantages:

  • Reliable over long distances
  • Lower cost (fewer wires)
  • Less interference
  • Bits arrive in order

Disadvantages:

  • Slower than parallel
  • Requires start/stop bits

Examples: USB, Ethernet, SATA

Parallel Transmission

Multiple bits sent simultaneously on multiple channels

Advantages:

  • Faster data transfer
  • Simple programming
  • Efficient for short distances

Disadvantages:

  • Expensive (more wires)
  • Signal skewing issues
  • Limited cable length

Examples: Internal computer buses, printer ports

Transmission Types (Direction)

Simplex

One-direction only

Example: Keyboard to computer, printer

Half-Duplex

Both directions, but not simultaneously

Example: Walkie-talkies

Full-Duplex

Both directions simultaneously

Example: Telephone, broadband internet

USB (Universal Serial Bus)

Type: Serial, both half/full-duplex

Features:

  • Automatic device detection
  • Plug-and-play
  • Power delivery
  • Standardized interface

Limitations:

  • Cable length restricted (~5 meters)
  • Speed limitations compared to Ethernet

📦 Packet Switching

Packet switching is a method of grouping data that is transmitted over a digital network into packets.

Data Packet Structure

A data packet consists of three main parts:

HEADER
PAYLOAD
TRAILER
Control Info
(Addresses, Sequence)
Actual Data
Error Checking

How Packet Switching Works

  1. Data Segmentation: Large files split into packets
  2. Individual Routing: Each packet sent independently
  3. Path Selection: Routers choose optimal paths
  4. Reassembly: Destination device reconstructs original data

Benefits

  • Efficient line usage
  • Fault tolerance (rerouting)
  • Network scalability
  • High transmission rates

Drawbacks

  • Packet delay (latency)
  • Potential packet loss
  • Reordering overhead
  • Not ideal for real-time streaming

Process Flow

Original Data → Split into Packets → Individual Routing → Reassembly → Original Data

Different paths possible

Routers direct each packet

🔍 Error Handling & Security

Error Detection Methods

Parity Check

Odd/even bit counting to detect errors

Checksum

Algorithmic value verification

Echo Check

Data sent back for comparison

Automatic Repeat Request (ARQ)

Positive Acknowledgement

ACK for successful reception

Negative Acknowledgement

NACK for error detection

Timeout

Resend if no response

Encryption

Symmetric Encryption

Single key for encryption/decryption

Asymmetric Encryption

Public/private key pairs

💡 Key Takeaways

Data Compression

Data Transmission

Packet Switching

html.cafe - a realtime HTML editor and host

Edit the html in the top panel, see the result here.
Save your page and get a link to view it live, anywhere.