How armour/cmpt365 works
Project Type and Purpose
• This is a native iOS application (Xcode, Objective-C + Objective-C++), implementing a JPEG encoder/decoder for educational purposes (CMPT365 assignments).
• Key features: four chroma-subsampling modes, discrete cosine transform (DCT), six quantization tables, end-to-end compression & decompression.
High-Level Architecture
• Follows an MVC-style pattern common in iOS apps:
• UI Layer (View Controllers)
• Processing Core (C++ image-processing modules bridged via Objective-C++)
• Data/Model Layer (in-memory image buffers, compressed bitstreams, Core Data model stub)
• Assets & I/O (images from bundle or photo library, saving/displaying results)
Main Components
A. User Interface Layer
– ViewController: image selection, initial display
– DCTViewController: visualizing DCT coefficients
– DisplayViewController: showing intermediate stages
– FinalResultViewController: compressed vs. original comparison
B. Processing Core
– MatConvert module: RGB ↔ YCbCr conversion
– Subsampling module: 4:4:4, 4:2:2, 4:2:0, 4:1:1
– DCT module: 8×8 DCT & inverse DCT
– Quantization module: 6 different tables
– (Optional) ZigZag & Bitstream I/O if implemented
C. Data/Model
– UIImage/CGImage buffers
– In-memory block buffers (8×8 coefficient matrices)
– Compressed JPEG byte stream
– Core Data model (present but unused)
D. Assets & I/O
– Bundled sample images
– File system or Photo Library export (if supported)
Component Interactions & Data Flow
1. User taps “Load Image” → ViewController → UIImage created
2. Pass UIImage → MatConvert → YCbCr pixel matrix
3. Pixel matrix → Subsampling → downsampled blocks
4. Blocks → DCT module → frequency coefficients
5. Coefficients → Quantization → quantized coefficients
6. (Optional) ZigZag & Huffman packaging → compressed byte stream
7. Byte stream → inverse operations on decompress path
8. FinalResultViewController → renders reconstructed UIImage
Architectural Patterns & Principles
• Separation of concerns: UI vs. algorithm core
• Bridging Objective-C++ to isolate C++-only code in .mm files
• MVC pattern: View Controllers orchestrate data flow but delegate heavy work to core modules