Package: randd
R&D is a Python library that faciliates multimedia codec comparison. It provides functions to perform rate-distortion analysis for a given codec with sparse samples in the rate-distortion space.FeaturesEfficiency: R&D provides the implementation of state-of-the-art rate-distortion function models, which enables efficient codec comparison with only sparse encoding samples.Accuracy: R&D is demonstrated to be more accuracy than the traditional BD-rate measure.Flexibility: R&D can be applied to analyze the encoder performance at different resolution, frame rate, and bit depth, with a unified interface.Robustness: R&D curve/surface fitting models are mathematically stable.Generalizability: R&D is compatible with most of the modern video quality assessment models such as PSNR, VMAF, and SSIMPlus.Extrapolation Capability: R&D can deliver reasonable codec performance analysis in the region where no encoding samples are provided.InstallationR&Dcan be installed usingpipor from source.Install from source:$gitclonegit@github.com:UWIVC/randd.git$pythonsetup.pyinstallInstall from pip:$pipinstallranddSample Usage1D ExampleThe following example illustrates how to use R&D to compare two video codecs with distortion measure being PSNR:importranddasrdimportnumpyasnpr1=np.array([100.,400.,1500.,6000.])d1=np.array([23.83,25.89,31.28,38.22])r2=np.array([100.,400.,1500.,6000.])d2=np.array([16.25,29.75,33.52,39.12])analyzer=rd.Analyzer(d_measure='psnr')quality_gain,bitrate_saving,summary=analyzer(r1,d1,r2,d2,codec1='h264',codec2='vp9')2D ExampleThe following example illustrates how to use R&D to compare two video codecs with distortion measure being VMAF. We can also specify the bitrate region [100, 3000] to compute the quality gain. Note that R&D can perform reasonable extrapolation to the region where no RD samples are given.importranddasrdimportnumpyasnp# 1st dim: bitrate, 2nd dim: diagonal size of spatial resolutionr1=np.array([[2400.,400.],[1700.,865.],[300.,1469.],[2100.,2203.]])d1=np.array([28.39,71.87,26.98,89.35])r2=np.array([[2400.,400.],[1700.,865.],[300.,1469.],[2100.,2203.]])d2=np.array([28.86,75.03,54.35,96.49])analyzer=rd.Analyzer(d_measure='vmaf',ndim=2,r_roi=[100,3000])quality_gain,bitrate_saving,summary=analyzer(r1,d1,r2,d2,codec1='h264',codec2='vp9')Backward CompatibilityR&D also provides implementation of traditional codec comparison tools such as BD-rate:importranddasrdimportnumpyasnpfromrandd.modelimportLogCubicr1=np.array([100.,400.,1500.,6000.])d1=np.array([23.83,25.89,31.28,38.22])r2=np.array([100.,400.,1500.,6000.])d2=np.array([16.25,29.75,33.52,39.12])analyzer=rd.Analyzer(d_measure='psnr',model1=LogCubic,model2=LogCubic)quality_gain,bitrate_saving,summary=analyzer(r1,d1,r2,d2,codec1='h264',codec2='vp9')DocumentationThe full documentation is available athttps://randd.readthedocs.io/.CitationWe are making R&D publicly available. If you use R&D in your project, we kindly ask you to cite the following paper:@article{duanmu2020egrd,
    title={Characterizing Generalized Rate-Distortion Performance of Video Coding: An Eigen Analysis Approach},
    author={Duanmu, Zhengfang and Liu, Wentao and Li, Zhuoran and Ma, Kede and Wang, Zhou},
    journal={IEEE Transactions on Image Processing},
    volume={29},
    number={},
    pages={6180-6193},
    year={2020}}ContactsWentao Liu-@w238liu-w238liu@uwaterloo.caZhengfang Duanmu-@zduanmu-zduanmu@uwaterloo.ca