codecwrappers.jplm_wrapper

Author: Ismael Seidel (ismael.seidel@ufsc.br) Affiliation: Embedded Computing Lab (ECL), Federal University of Santa Catarina (UFSC)

Description:

This module contains the JPLMWrapper class, which extends the CodecWrapper class to provide specific encoding and decoding functionality for the JPLM codec.

get_data_from_preffix(file_lines, preffix)[source]

Extracts the value from a log line that starts with the given prefix.

Parameters:
  • file_lines (List[str]) – List of lines from the log file

  • preffix (str) – Prefix string to search for at the start of lines

Returns:

The value after the prefix, or empty string if not found

Return type:

str

class JPLMWrapper(codec, codec_path, results_path, encoded_extension, repository, clear_log=False, repetitions=1, force_encoding=False, num_cores=None, number_of_threads=1, json_configuration_path=None, extra_params=None)[source]

Bases: CodecWrapper

Parameters:
  • codec (str)

  • codec_path (str | Path)

  • results_path (str | Path)

  • encoded_extension (str)

  • repository (str)

  • clear_log (bool)

  • repetitions (int)

  • force_encoding (bool)

  • num_cores (int)

  • number_of_threads (int)

  • json_configuration_path (str | Path | None)

  • extra_params (Any | None)

__init__(codec, codec_path, results_path, encoded_extension, repository, clear_log=False, repetitions=1, force_encoding=False, num_cores=None, number_of_threads=1, json_configuration_path=None, extra_params=None)[source]

Initializes the JPLMWrapper instance with the given parameters.

Parameters:
  • codec (str) – Name of the codec

  • codec_path (Union[str, Path]) – Path to the codec binary

  • results_path (Union[str, Path]) – Path to store results

  • encoded_extension (str) – File extension for encoded files

  • repository (str) – Repository object for managing codec source

  • clear_log (bool, optional) – Whether to clear logs after execution, defaults to False

  • repetitions (int, optional) – Number of repetitions for encoding/decoding, defaults to 1

  • force_encoding (bool, optional) – Whether to force encoding even if results exist, defaults to False

  • num_cores (int, optional) – Number of cores to use for encoding/decoding, defaults to None

  • number_of_threads (int, optional) – Number of threads to use, defaults to 1

  • json_configuration_path (Union[str, Path], optional) – Path to the JSON configuration file, defaults to None

  • extra_params (optional) – Additional parameters for the codec, defaults to None

Return type:

None

create_required_paths(raw_lightfield)[source]

Creates the required directories for storing encoded and log data.

Parameters:

raw_lightfield (RAWLightFieldData) – The raw light field data

Returns:

None

Return type:

None

encode_lightfield_for_target_bpps(raw_lightfield, bpps)[source]

Encodes the light field for the specified target bits per pixel (bpp) values.

Parameters:
  • raw_lightfield (RAWLightFieldData) – The raw light field data

  • bpps (List[float]) – List of target bpp values

Returns:

List of encoded light fields

Return type:

List[EncodedLightField]

decode(encoded_lightfield)[source]

Decodes an encoded light field using the JPLM decoder.

Parameters:

encoded_lightfield (EncodedLightField) – The encoded light field to decode

Returns:

Decoded raw light field data in PGX format

Return type:

RAWLightFieldData

extract_data_from_log(log_filename)[source]

Extracts encoding/decoding metrics from a JPLM log file.

Parameters:

log_filename (Union[str, Path]) – Path to the log file

Returns:

Dictionary with extracted data (bytes, bpp, lambda, timing, memory, etc.)

Return type:

Dict