Skip to content

mplough/mcutool

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 

Repository files navigation

JPEG minimum coded unit tool

A JPEG image is encoded as a series of small blocks, usually around 8x8 or 16x16 pixels in size. This block primitive is called the minimum coded unit.

Very few tools display information about the size and number of minimum coded units. The JPEGSnoop tool can overlay a grid showing the division of an image into MCUs but it does not display MCU statistics. A blog entry on quippe.eu contains a script that calculates and displays the MCU size for YUV-encoded JPEG images. This project enhances that script.

As with the original script:

Please note that it will only work with YCbCr color space JPEG files and assumes that the 3-byte component parts are in the order Y, Cb, Cr:

Changes from the original on quippe.eu

Bug fixes

  • Use proper SOF offset (past the two SOF header bytes FF C0 instead of including them)
  • Pass filename as last param to hexdump (for macOS BSD hexdump)
  • Accommodate file names that contain spaces

Enhancements

  • Retrieve and display image width and height
  • Calculate and display number of MCUs

Dependencies

exiv2 must be installed.

On macOS, install exiv2 with Homebrew:

brew install exiv2

Usage and example output

$ ./mcutool.sh image.jpg
width	640
height	480
mcu_x	16
mcu_y	16
n_full_mcu_x	40
n_full_mcu_y	30
n_mcu_x	40
n_mcu_y	30
n_mcus	1200

About

JPEG MCU stats tool (original at https://quippe.eu/blog/2016/11/17/determining-minimum-coded-unit-dimensions.html)

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •  

Languages