vc2_bit_widths.pattern_evaluation: Measure the outputs achieved by test patterns

This module provides routines for passing test patterns through a VC encoder and decoder and determining the values produced.

Evaluation functions

evaluate_analysis_test_pattern_output(h_filter_params, v_filter_params, dwt_depth, dwt_depth_ho, level, array_name, test_pattern_specification, input_min, input_max)

Given an analysis test pattern (e.g. created using make_analysis_maximising_pattern()), return the actual intermediate encoder value when the signal is processed.

Parameters
h_filter_paramsvc2_data_tables.LiftingFilterParameters
v_filter_paramsvc2_data_tables.LiftingFilterParameters

Horizontal and vertical filter synthesis (not analysis!) filter parameters (e.g. from vc2_data_tables.LIFTING_FILTERS) defining the wavelet transform used.

dwt_depthint
dwt_depth_hoint

The transform depth used by the filters.

levelint
array_namestr

The intermediate value in the encoder the test pattern targets.

test_pattern_specificationTestPatternSpecification

The test pattern to evaluate.

input_minint
input_maxint

The minimum and maximum value which may be used in the test pattern.

Returns
encoded_minimumint
encoded_maximumint

The target encoder value when the test pattern encoded with minimising and maximising signal levels respectively.

evaluate_synthesis_test_pattern_output(h_filter_params, v_filter_params, dwt_depth, dwt_depth_ho, quantisation_matrix, synthesis_pyexp, test_pattern_specification, input_min, input_max, max_quantisation_index)

Given a synthesis test pattern (e.g. created using make_synthesis_maximising_pattern() or optimise_synthesis_maximising_test_pattern()), return the actual decoder value, and worst-case quantisation index when the signal is processed.

Parameters
h_filter_paramsvc2_data_tables.LiftingFilterParameters
v_filter_paramsvc2_data_tables.LiftingFilterParameters

Horizontal and vertical filter synthesis (not analysis!) filter parameters (e.g. from vc2_data_tables.LIFTING_FILTERS) defining the wavelet transform used.

dwt_depthint
dwt_depth_hoint

The transform depth used by the filters.

quantisation_matrix{level: {orient: int, …}, …}

The VC-2 quantisation matrix to use.

synthesis_pyexpPyExp

A PyExp expression which defines the synthesis process for the decoder value the test pattern is maximising/minimising. Such an expression is usually obtained from the use of synthesis_transform() and make_variable_coeff_arrays().

test_pattern_specificationTestPatternSpecification

The test pattern to evaluate.

input_minint
input_maxint

The minimum and maximum value which may be used in the test pattern.

max_quantisation_indexint

The maximum quantisation index to use. This should be set high enough that at the highest quantisation level all transform coefficients are quantised to zero.

Returns
decoded_minimum(value, quantisation_index)
decoded_maximum(value, quantisation_index)

The target decoded value (and worst-case quantisation index) when the test pattern is encoded using minimising and maximising values respectively.

Utility functions

convert_test_pattern_to_padded_picture_and_slice(test_pattern, input_min, input_max, dwt_depth, dwt_depth_ho)

Convert a description of a test pattern (in terms of polarities) into a numpy.array, padded ready for processing with a filter with the specified transform depths.

Parameters
test_patternTestPattern
input_minint
input_maxint

The full signal range to expand the test pattern to.

dwt_depthint
dwt_depth_hoint

The transform depth used by the filters.

Returns
picturenumpy.array

A 2D array containing the test picture (with all undefined pixels set to 0.

picture_slice(slice, slice)

A 2D slice out of test_pattern which contains the active pixels in test_pattern (i.e. excluding any padding).