yuv_and_pgx_from_ppm
Author: Ismael Seidel Affiliation: Embedded Computing Lab (ECL), Federal University of Santa Catarina (UFSC) Contributors:
André Filipe da Silva Fernandes
- Description:
This module converts the JPEG Pleno LF Dataset from PPM to YUV and PGX formats. The PGX and YUV files should have the same data. This implementation is for JPEG Pleno CE 14.
- checksum_conversion(lightfield_name, md5, file_format, configuration)[source]
Verify MD5 checksum for converted light field files.
Compares computed MD5 hash against expected value stored in configuration. Logs result indicating whether checksum matches or not.
- Parameters:
lightfield_name (str) – Name of the light field
md5 (str) – Computed MD5 hash value
file_format (str) – File format (ppm, yuv, or pgx)
configuration (ConfigurationReader) – Configuration reader with checksum data
- Returns:
None
- Return type:
None
- Raises:
Exception – If file format is not supported (ppm, yuv, or pgx)
- get_output_log()[source]
Get FFmpeg version and initialize conversion output log.
- Returns:
Dictionary with FFmpeg version and empty conversion results list
- Return type:
dict
- Raises:
Exception – If FFmpeg is not available or version check fails
- download_lightfield_if_needed(lightfield, configuration)[source]
Download light field PPM files if not already present locally.
Downloads the light field from configured URL and extracts to the appropriate raw_ppm_path directory if files don’t already exist.
- Parameters:
lightfield (RAWLightFieldData) – Light field object with raw_path attribute
configuration (ConfigurationReader) – Configuration reader with download URLs and paths
- Returns:
None
- Return type:
None
- Raises:
Exception – If URL not configured and files not present
- convert_lightfield_to_yuv_and_pgx(lightfield_name, configuration)[source]
Ensure light field is available in PPM, YUV and PGX formats.
Handles all format conversions needed for a light field: - Downloads original format if needed - Preprocesses the raw light field - Converts to PPM format - Converts from PPM to YUV - Converts from YUV to PGX
- Parameters:
lightfield_name (str) – Name of the light field to convert
configuration (ConfigurationReader) – Configuration reader with paths and format settings
- Returns:
Dictionary with ‘ppm’, ‘yuv’, and ‘pgx’ light field instances
- Return type:
dict
- main(configuration=None)[source]
Convert JPEG Pleno light field dataset from PPM to YUV and PGX formats.
Orchestrates the complete format conversion pipeline for all configured light fields. Downloads raw PPM files if needed, preprocesses them, and converts to both YUV and PGX formats with full MD5 checksum verification. Performs round-trip validation (YUV->PGX->YUV) to ensure data integrity.
Usage: python yuv_and_pgx_from_ppm.py <configuration.json>
- Parameters:
configuration (ConfigurationReader) – Configuration reader (read from argv if None)
- Returns:
None
- Return type:
None