randd.analyzer package
Module contents
- class randd.analyzer.Profile(name, rd_func, dr_func, sampled_r, sampled_d)
Bases:
objectA dataclass to store output information.
The class stores data to characterize the RD performance of a given codec.
- Parameters
name (str) – name of the codec
rd_func (Callable[[ArrayLike], NDArray]) – Estimated RD function
dr_func (Callable[[ArrayLike], NDArray]) – Estimated DR function
sampled_r (ArrayLike) – Input encoding representations
sampled_d (ArrayLike) – Input distortion levels
- class randd.analyzer.Summary(codec1, codec2, r_roi, d_roi, quality_gain, bitrate_saving, log_scale)
Bases:
objectA dataclass to store output information.
The class contains the codec comparison results.
- Parameters
codec1 (Profile) – Output profile that describes the RD characteristics of codec1.
codec2 (Profile) – Output profile that describes the RD characteristics of codec2.
r_roi (Tuple[float, float]) – Bitrate region used for codec comparison.
d_roi (Tuple[float, float]) – Distortion region used for codec comparison.
quality_gain (float) – Quality gain of codec2 compared to codec1.
bitrate_saving (float) – Bitrate saving of codec2 over codec1.
log_scale (bool) – Whether the comparison is performed in a log scale.
- class randd.analyzer.Analyzer(model1=<class 'randd.model.egrd.egrd.EGRD'>, model2=<class 'randd.model.egrd.egrd.EGRD'>, r_roi=None, d_roi=None, ndim=1, d_measure='psnr', log_scale=False)
Bases:
objectRate-distortion analyzer.
The core class of R&D. The class firstly estimates the RD curve from sparse samples on a RD function for each codec, and then computes the bitrate saving and quality gain based on the estimated curves.
- Parameters
model1 (Type[GRD], optional) – The RD function model for the codec 1. Available optionals include
randd.model.Linear,randd.model.LogCubic,randd.model.LogPCHIP, andrandd.model.EGRD. Defaults torandd.model.EGRD.model2 (Type[GRD], optional) – The RD function model for the codec 2. Defaults to EGRD.
r_roi (Optional[ArrayLike], optional) – Bitrate region of interest for the quality gain computation. r_roi should be a tuple of float (r_min, r_max). If not specified, the analyzer will infer the range from the given samples. Defaults to
None.d_roi (Optional[ArrayLike], optional) – Distortion region of interest for the bitrate saving computation. d_roi should be a tuple of (d_min, d_max). If not specified. the analyzer will infer the range from the given samples. Defaults to
None.ndim (int, optional) – Number of input dimensions. R&D supports multi-dimensional generalized rate-distortion function estimation. For ndim > 1, the analyzer will first estimate the generalized rate-distortion surface, and then produce a rate-distortion curve on the convex hull. To be specific, for the representations with the same bitrate, we take the representation with the best quality for further analysis. Defaults to
1.d_measure (str, optional) – The name of distortion measure. Defaults to
psnr.log_scale (bool, optional) – Whether to perform the codec comparison in a logscale. Defaults to
False.