Scalable Video Compressed Stream
Implementing a closed loop video compression algorithm that produces scalable compressed video elementary streams similar to MPEG-2.
- Utilizing Visual Studio C++ to implement.
- Steps of Encoding (Encoder):
- Converting RGB format to YCrCb format for each frame
- Completing DCT transform:
- Dividing each frame into 8x8 blocks, and getting a value for each block
- Closed Loop Motion Compensation:
- Let every 30th frame be an I frame unless and until we deem an intermediary frame to be saved as an I frame (because errors from frame to frame were too large).
- 16x16 motion macroblock
- Quantizing:
- Dividing each block's DCT value by an respective value get from a quantization table. In a consequence, the bits used to store the DCT value could be less.
- File Saving:
- Y component:
If I frame
Block#1 – Quantized values #1, #2, #3 …
Block#2 – Quantized values #1, #2, #3 ….
If P frame
Block#1 – (x, y) & Difference Image Quantized values #1, #2, ….
Block#2 – (x, y) & Difference Image Quantized values #1, #2, …
Here x and y are a byte each – vector range -128 to 127 - Cr & Cbcomponent: (if color image)
If I frame
Block#1 – Quantized values #1, #2, #3 …
Block#2 – Quantized values #1, #2, #3 ….
If P frame
Block#1 – Difference Image Quantized values #1, #2, ….
Block#2 – Difference Image Quantized values #1, #2, ….
- Note: each value is stored by minimum bits which means each value will represented by different bits.
- Y component:
- Steps of Decoding (Decoder):
- Correctly extracting bits from encoded file to recover the quantized values.
- Using quantization table to get the dequantized values.
- Inversing DCT
- Converting YCrCb format to RGB format
- Result:
![]() |
![]() |
| Encoder Interface | Decoder Interface |
- Compression Rate: 20.3MB (compressed file size)/ 34.8MB (original file size) = 58 %

