Day 7 - Lossy Data Compression
Day 7: Lossy Data Compression
Learning Objectives
- DAT-1.D: Compare data compression algorithms to determine which is best in a particular context.
Essential Questions
- When is it acceptable to lose some data during compression?
- How do lossy compression algorithms work?
- What are the trade-offs between file size and quality in lossy compression?
Materials Needed
- Presentation slides on lossy compression
- Sample media files in both uncompressed and compressed formats
- Compression comparison worksheet
- Computers with media players and image viewers
- Headphones for audio comparison
Vocabulary
- Lossy compression
- Perceptual coding
- Compression artifacts
- JPEG
- MP3
- Quantization
- Psychoacoustic model
- Quality-size trade-off
Procedure (50 minutes)
Opening (8 minutes)
-
Review and Connection (3 minutes)
- Review lossless compression from previous lesson
- Connect to today's focus on lossy compression techniques
-
Warm-up Discussion (5 minutes)
- Ask: "When might it be acceptable to lose some data during compression?"
- Discuss: "How much quality loss can humans detect in images and sound?"
Main Activities (32 minutes)
-
Lecture: Principles of Lossy Compression (12 minutes)
- Define lossy compression: reducing file size by discarding some data
- Explain that lossy compression works by:
- Removing data that humans are less likely to perceive
- Approximating similar values
- Prioritizing perceptually important information
- Discuss key properties:
- Original data cannot be perfectly reconstructed
- Generally achieves higher compression ratios than lossless
- Quality-size trade-off can be adjusted
- Explain when lossy compression is appropriate (photos, music, video)
- Introduce common lossy formats (JPEG, MP3, MP4) and their uses
-
Demo: Image and Audio Compression Examples (10 minutes)
- Show the same image at different JPEG quality levels
- Point out compression artifacts (blocking, ringing, blurring)
- Explain how JPEG works (color space conversion, DCT, quantization)
- Play the same audio clip at different MP3 bitrates
- Explain how MP3 works (psychoacoustic model, frequency masking)
- Demonstrate how file size decreases as quality decreases
-
Activity: Compare Original and Compressed Media Files (10 minutes)
- Students work in pairs with computers
- Provide access to original and compressed versions of media files
- Students compare:
- Visual/audio quality at different compression levels
- File sizes
- Noticeable artifacts or quality issues
- Students document their observations and preferences
Closing (10 minutes)
-
Analysis of Compression Trade-offs (7 minutes)
- Students complete a compression trade-off analysis worksheet:
- For each use case (web images, professional photography, music streaming, archival storage), recommend a compression approach
- Justify each recommendation based on the context
- Explain the trade-offs involved
- Students complete a compression trade-off analysis worksheet:
-
Preview Next Lesson (3 minutes)
- Explain that next class will shift focus from data representation to data analysis
- Ask students to think about how large datasets might be analyzed
Assessment
- Formative: Quality of media comparison observations
- Compression Trade-off Analysis: Appropriateness of recommendations and justifications
Differentiation
For Advanced Students
- Research specific lossy compression algorithms in detail
- Explore variable bitrate encoding and its advantages
- Compare multiple lossy compression formats for the same media type
For Struggling Students
- Focus on more obvious quality differences
- Provide a structured template for media comparison
- Use visual aids to illustrate compression concepts
Homework/Extension
- Compress the same image or sound using different quality settings and document the results
- Research a specific lossy compression format and create a one-page summary
- Find examples of compression artifacts in everyday media
Teacher Notes
- Have clear examples that demonstrate compression artifacts
- Make connections to students' experiences with streaming media and downloads
- Emphasize that the "best" compression depends on the specific use case
- Consider discussing ethical implications of using lossy compression in certain contexts (medical imaging, legal evidence, etc.)