FFmpeg  4.0
Functions
ffmath.h File Reference

internal math functions header More...

#include "attributes.h"
#include "libm.h"

Go to the source code of this file.

Functions

static av_always_inline double ff_exp10 (double x)
 Compute 10^x for floating point values. More...
 
static av_always_inline float ff_exp10f (float x)
 
static av_always_inline float ff_fast_powf (float x, float y)
 Compute x^y for floating point x, y. More...
 

Detailed Description

internal math functions header

Definition in file ffmath.h.

Function Documentation

◆ ff_exp10()

static av_always_inline double ff_exp10 ( double  x)
static

Compute 10^x for floating point values.

Note: this function is by no means "correctly rounded", and is meant as a fast, reasonably accurate approximation. For instance, maximum relative error for the double precision variant is ~ 1e-13 for very small and very large values. This is ~2x faster than GNU libm's approach, which is still off by 2ulp on some inputs.

Parameters
xexponent
Returns
10^x

Definition at line 42 of file ffmath.h.

Referenced by av_strtod(), butterworth_bp_filter(), chebyshev1_bp_filter(), chebyshev2_bp_filter(), cng_decode_frame(), config_output(), decode_subframe(), encode_block(), encode_init(), ff_amr_set_fixed_gain(), ff_opus_parse_extradata(), filter_frame(), iac_generate_tabs(), init_exp(), libopus_decode_init(), on2avc_decode_init(), psy_3gpp_init(), read16_fft_bin(), read8_fft_bin(), request_frame(), and wma_decode_block().

◆ ff_exp10f()

static av_always_inline float ff_exp10f ( float  x)
static

Definition at line 47 of file ffmath.h.

◆ ff_fast_powf()

static av_always_inline float ff_fast_powf ( float  x,
float  y 
)
static

Compute x^y for floating point x, y.

Note: this function is faster than the libm variant due to mainly 2 reasons:

  1. It does not handle any edge cases. In particular, this is only guaranteed to work correctly for x > 0.
  2. It is not as accurate as a standard nearly "correctly rounded" libm variant.
    Parameters
    xbase
    yexponent
    Returns
    x^y

Definition at line 62 of file ffmath.h.

Referenced by find_form_factor().