TSDuck v3.40-3963
MPEG Transport Stream Toolkit
Loading...
Searching...
No Matches
tsBitRate.h File Reference

Implementation of bitrates in bits/second. More...

Namespaces

namespace  ts
 TSDuck namespace, containing all TSDuck classes and functions.
 

Macros

#define TS_BITRATE_DECIMALS   1
 Define the precision (number of decimal digits) of fixed-point bitrate values.
 
#define TS_BITRATE_DISPLAY_DECIMALS   2
 Define the displayed precision (number of decimal digits) of floating-point bitrate values.
 
#define TS_BITRATE_FIXED   1
 If this symbol is defined, bitrate values are represented as fixed-point.
 
#define TS_BITRATE_FLOAT   1
 If this symbol is defined, bitrate values are represented as double floating-point.
 
#define TS_BITRATE_FRACTION   1
 If this symbol is defined, bitrate values are represented as fractions of 64-bit integers.
 
#define TS_BITRATE_INTEGER   1
 If this symbol is defined, bitrate values are represented as unsigned 64-bit integers.
 

Typedefs

using ts::BitRate = user_defined
 Bitrate in bits/second.
 

Detailed Description

Implementation of bitrates in bits/second.

Macro Definition Documentation

◆ TS_BITRATE_INTEGER

#define TS_BITRATE_INTEGER   1

If this symbol is defined, bitrate values are represented as unsigned 64-bit integers.

See also
ts::Integer
ts::BitRate

◆ TS_BITRATE_FRACTION

#define TS_BITRATE_FRACTION   1

If this symbol is defined, bitrate values are represented as fractions of 64-bit integers.

Using fractions instead of fixed-point numbers gives a better precision but seriously impacts the overall performance of computations involving bitrates. The experience also demonstractes that using fractions for bitrates introduces intermediate overflows, making long computations on bitrates unusable in practice. Using fractions for bitrates is therefore currenly discouraged, until a new implementation of fractions absorbs intermediate overflows using approximated fraction reduction, at the expense of a loss of precision.

See also
ts::Fraction
ts::BitRate

◆ TS_BITRATE_FLOAT

#define TS_BITRATE_FLOAT   1

If this symbol is defined, bitrate values are represented as double floating-point.

Using floating-point instead of fixed-point numbers may give a better precision in some cases.

This is currently the default.

See also
ts::Double
ts::BitRate

◆ TS_BITRATE_FIXED

#define TS_BITRATE_FIXED   1

If this symbol is defined, bitrate values are represented as fixed-point.

The number of decimal digits is set by the macro TS_BITRATE_DECIMALS.

See also
ts::FixedPoint
ts::BitRate
TS_BITRATE_DECIMALS

◆ TS_BITRATE_DECIMALS

#define TS_BITRATE_DECIMALS   1

Define the precision (number of decimal digits) of fixed-point bitrate values.

This is used when bitrates are represented as fixed-point numbers instead of fractions or floating-point.

See also
ts::FixedPoint
ts::BitRate
TS_BITRATE_FIXED

◆ TS_BITRATE_DISPLAY_DECIMALS

#define TS_BITRATE_DISPLAY_DECIMALS   2

Define the displayed precision (number of decimal digits) of floating-point bitrate values.

This is used when bitrates are represented as floating-point numbers instead of fractions or fixed-point.

See also
ts::FloatingPoint
ts::BitRate
TS_BITRATE_FLOAT