Skip to main content

A Python Library for Video Codec Comparison.

Project description

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.

Features

  • Efficiency: 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.

Installation

R&D can be installed using pip or from source.

Install from source:

$ git clone git@github.com:UWIVC/randd.git
$ python setup.py install

Install from pip:

$ pip install randd

Sample Usage

1D Example

The following example illustrates how to use R&D to compare two video codecs with distortion measure being PSNR:

import randd as rd
import numpy as np

r1 = 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')
docs/source/_static/example1.png

2D Example

The 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.

import randd as rd
import numpy as np

# 1st dim: bitrate, 2nd dim: diagonal size of spatial resolution
r1 = 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')
docs/source/_static/example2.png

Backward Compatibility

R&D also provides implementation of traditional codec comparison tools such as BD-rate:

import randd as rd
import numpy as np
from randd.model import LogCubic

r1 = 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')
docs/source/_static/example3.png

Documentation

The full documentation is available at https://randd.readthedocs.io/.

Citation

We 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}
}

Contacts

Wentao Liu - @w238liu - w238liu@uwaterloo.ca

Zhengfang Duanmu - @zduanmu - zduanmu@uwaterloo.ca

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

randd-0.2.2.tar.gz (11.3 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

randd-0.2.2-py3-none-any.whl (10.0 MB view details)

Uploaded Python 3

File details

Details for the file randd-0.2.2.tar.gz.

File metadata

  • Download URL: randd-0.2.2.tar.gz
  • Upload date:
  • Size: 11.3 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.13

File hashes

Hashes for randd-0.2.2.tar.gz
Algorithm Hash digest
SHA256 ba023b63be8dcbebad1bf16704069ec417c4e360d73b3cefca5964f709ba98d9
MD5 c353fd9938a13b8ed1d0d4ff1ecc01d7
BLAKE2b-256 965aa3a326bc909db31b3a48d2565b56db2aa6947f40432e9ac666ae5bf0708a

See more details on using hashes here.

File details

Details for the file randd-0.2.2-py3-none-any.whl.

File metadata

  • Download URL: randd-0.2.2-py3-none-any.whl
  • Upload date:
  • Size: 10.0 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.13

File hashes

Hashes for randd-0.2.2-py3-none-any.whl
Algorithm Hash digest
SHA256 ad4f84432184e8362b47861d73e7de60173e66cc509bc36208024a175f5a0fba
MD5 f3280a0db40ca07d3c177d921dc04c98
BLAKE2b-256 edc403591a6bfd18181bc3ea3794881154741f1e90c5dc72484e4dc7b92d18d5

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page