vc2_bit_widths.pattern_generation
: Heuristic test pattern generation¶
The routines in this module implement heuristcs for producing test patterns for VC-2 filters which produce near-maximum magnitude values in a target intermediate or final value.
Due to non-linearities in VC-2’s filters (i.e. rounding and quantisation), the test patterns generated are not true worst-case signals but rather a ‘best effort’ to get close to the worst case. Analysis test patterns will tend to be very close to worst-case signals while synthesis signals are likely to be modest under-estimates. Nevertheless, these signals often reach values well above real pictures and noise.
Test pattern generators¶
Analysis¶
-
make_analysis_maximising_pattern
(input_array, target_array, tx, ty)¶ Create a test pattern which maximises a value within an intermediate/final output of an analysis filter.
Note
In lossless coding modes, test patterns which maximise a given value in the encoder also maximise the corresponding value in the decoder. Consequently this function may also be used to (indirectly) produce lossless decoder test patterns.
Warning
The returned test pattern is designed to maximise a real-valued implementation of the target filter. Though it is likely that this signal also maximises integer-based implementations (such as those used by VC-2) it is not guaranteed.
- Parameters
- input_array
SymbolArray
The input array to the analysis filter.
- target_array
InfiniteArray
An intermediate or final output array produced by the analysis filter within which a value should be maximised.
- tx, tyint
The coordinates of the target value within target_array which is to be maximised.
- input_array
- Returns
- test_pattern_specification
TestPatternSpecification
- test_pattern_specification
Synthesis¶
-
make_synthesis_maximising_pattern
(analysis_input_array, analysis_transform_coeff_arrays, synthesis_target_array, synthesis_output_array, tx, ty)¶ Create a test pattern which, after lossy encoding, is likely to maximise an intermediate/final value of the synthesis filter.
Warning
Because (heavy) lossy VC-2 encoding is a non-linear process, finding encoder inputs which maximise the decoder output is not feasible in general. This function uses a simple heuristic (see Test pattern generation) to attempt to achieve this goal but cannot provide any guarantees about the extent to which it succeeds.
- Parameters
- analysis_input_array
SymbolArray
The input array to a compatible analysis filter for the synthesis filter whose values will be maximised.
- analysis_transform_coeff_arrays{level: {orient:
InfiniteArray
, …}} The final output arrays from a compatible analysis filter for the synthesis filter whose values will be maximised. These should be provided as a nested dictionary of the form produced by
analysis_transform()
.- synthesis_target_array
InfiniteArray
The intermediate or final output array produced by the synthesis filter within which a value should be maximised.
- synthesis_output_array
InfiniteArray
The output array for the synthesis filter.
- tx, tyint
The index of the value within the synthesis_target_array which is to be maximised.
- analysis_input_array
- Returns
- test_pattern_specification
TestPatternSpecification
- test_pattern_specification