FreeBSD kernel sound device code
feeder_rate.c File Reference
#include <dev/sound/pcm/sound.h>
#include <dev/sound/pcm/pcm.h>
#include "feeder_if.h"
#include "snd_fxdiv_gen.h"
#include "feeder_rate_gen.h"
Include dependency graph for feeder_rate.c:

Go to the source code of this file.

Data Structures

struct  z_info
 

Macros

#define SND_USE_FXDIV
 
#define Z_QUALITY_DEFAULT   Z_QUALITY_LINEAR
 
#define Z_RESERVOIR   2048
 
#define Z_RESERVOIR_MAX   131072
 
#define Z_SINC_MAX   0x3fffff
 
#define Z_SINC_DOWNMAX   48 /* 384000 / 8000 */
 
#define Z_POLYPHASE_MAX   183040 /* 286 taps, 640 phases */
 
#define Z_RATE_DEFAULT   48000
 
#define Z_RATE_MIN   FEEDRATE_RATEMIN
 
#define Z_RATE_MAX   FEEDRATE_RATEMAX
 
#define Z_ROUNDHZ   FEEDRATE_ROUNDHZ
 
#define Z_ROUNDHZ_MIN   FEEDRATE_ROUNDHZ_MIN
 
#define Z_ROUNDHZ_MAX   FEEDRATE_ROUNDHZ_MAX
 
#define Z_RATE_SRC   FEEDRATE_SRC
 
#define Z_RATE_DST   FEEDRATE_DST
 
#define Z_RATE_QUALITY   FEEDRATE_QUALITY
 
#define Z_RATE_CHANNELS   FEEDRATE_CHANNELS
 
#define Z_PARANOID   1
 
#define Z_MULTIFORMAT   1
 
#define Z_USE_ALPHADRIFT   1
 
#define Z_FACTOR_MIN   1
 
#define Z_FACTOR_MAX   Z_MASK
 
#define Z_FACTOR_SAFE(v)   (!((v) < Z_FACTOR_MIN || (v) > Z_FACTOR_MAX))
 
#define Z_IS_ZOH(i)   ((i)->quality == Z_QUALITY_ZOH)
 
#define Z_IS_LINEAR(i)   ((i)->quality == Z_QUALITY_LINEAR)
 
#define Z_IS_SINC(i)   ((i)->quality > Z_QUALITY_LINEAR)
 
#define _Z_GCAST(x)   ((uint64_t)(x))
 
#define Z_DIV(x, y)   ((x) / (y))
 
#define _Z_GY2GX(i, a, v)
 
#define _Z_GX2GY(i, a, v)    Z_DIV(((_Z_GCAST((i)->z_gy) * (v)) + (a)), (i)->z_gx)
 
#define _Z_DRIFT(i, x, y)    ((_Z_GCAST((i)->z_gy) * (x)) - (_Z_GCAST((i)->z_gx) * (y)))
 
#define z_gy2gx(i, v)   _Z_GY2GX(i, (i)->z_alpha, v)
 
#define z_gx2gy(i, v)   _Z_GX2GY(i, (i)->z_alpha, v)
 
#define z_drift(i, x, y)   _Z_DRIFT(i, x, y)
 
#define Z_SINC_COEFF_IDX(i)   ((i)->quality - Z_QUALITY_LINEAR - 1)
 
#define Z_SINC_LEN(i)
 
#define Z_SINC_BASE_LEN(i)    ((z_coeff_tab[Z_SINC_COEFF_IDX(i)].len - 1) >> (Z_DRIFT_SHIFT - 1))
 
#define z_align(i, v)   ((v) & (i)->z_mask)
 
#define z_next(i, o, v)   z_align(i, (o) + (v))
 
#define z_prev(i, o, v)   z_align(i, (o) - (v))
 
#define z_fetched(i)   (z_align(i, (i)->z_pos - (i)->z_start) - 1)
 
#define z_free(i)   ((i)->z_full - (i)->z_pos)
 
#define z_copy(src, dst, sz)   (void)memcpy(dst, src, sz)
 
#define z_feed(...)   FEEDER_FEED(__VA_ARGS__)
 
#define Z_DECLARE_LINEAR(SIGN, BIT, ENDIAN)
 
#define Z_CLIP_CHECK(...)
 
#define Z_CLAMP(v, BIT)
 
#define _Z_SINC_ACCUMULATE(SIGN, BIT, ENDIAN, adv)
 
#define Z_SINC_ACCUMULATE(...)
 
#define Z_SINC_ACCUMULATE_DECR   1
 
#define Z_DECLARE_SINC(SIGN, BIT, ENDIAN)
 
#define Z_DECLARE_SINC_POLYPHASE(SIGN, BIT, ENDIAN)
 
#define Z_DECLARE(SIGN, BIT, ENDIAN)
 
#define Z_RESAMPLER_IDX(i)    (Z_IS_SINC(i) ? Z_RESAMPLER_SINC : (i)->quality)
 
#define Z_RESAMPLER_ENTRY(SIGN, BIT, ENDIAN)
 
#define Z_RESAMPLER_TAB_SIZE    ((int32_t)(sizeof(z_resampler_tab) / sizeof(z_resampler_tab[0])))
 
#define Z_POLYPHASE_COEFF_SHIFT   0
 

Typedefs

typedef void(* z_resampler_t) (struct z_info *, uint8_t *)
 

Enumerations

enum  {
  Z_RESAMPLER_ZOH , Z_RESAMPLER_LINEAR , Z_RESAMPLER_SINC , Z_RESAMPLER_SINC_POLYPHASE ,
  Z_RESAMPLER_LAST
}
 

Functions

 SND_DECLARE_FILE ("$FreeBSD$")
 
 SYSCTL_STRING (_hw_snd, OID_AUTO, feeder_rate_presets, CTLFLAG_RD, &feeder_rate_presets, 0, "compile-time rate presets")
 
 SYSCTL_INT (_hw_snd, OID_AUTO, feeder_rate_polyphase_max, CTLFLAG_RWTUN, &feeder_rate_polyphase_max, 0, "maximum allowable polyphase entries")
 
static int sysctl_hw_snd_feeder_rate_min (SYSCTL_HANDLER_ARGS)
 
 SYSCTL_PROC (_hw_snd, OID_AUTO, feeder_rate_min, CTLTYPE_INT|CTLFLAG_RWTUN|CTLFLAG_MPSAFE, 0, sizeof(int), sysctl_hw_snd_feeder_rate_min, "I", "minimum allowable rate")
 
static int sysctl_hw_snd_feeder_rate_max (SYSCTL_HANDLER_ARGS)
 
 SYSCTL_PROC (_hw_snd, OID_AUTO, feeder_rate_max, CTLTYPE_INT|CTLFLAG_RWTUN|CTLFLAG_MPSAFE, 0, sizeof(int), sysctl_hw_snd_feeder_rate_max, "I", "maximum allowable rate")
 
static int sysctl_hw_snd_feeder_rate_round (SYSCTL_HANDLER_ARGS)
 
 SYSCTL_PROC (_hw_snd, OID_AUTO, feeder_rate_round, CTLTYPE_INT|CTLFLAG_RWTUN|CTLFLAG_MPSAFE, 0, sizeof(int), sysctl_hw_snd_feeder_rate_round, "I", "sample rate converter rounding threshold")
 
static int sysctl_hw_snd_feeder_rate_quality (SYSCTL_HANDLER_ARGS)
 
 SYSCTL_PROC (_hw_snd, OID_AUTO, feeder_rate_quality, CTLTYPE_INT|CTLFLAG_RWTUN|CTLFLAG_NEEDGIANT, 0, sizeof(int), sysctl_hw_snd_feeder_rate_quality, "I", "sample rate converter quality ("__XSTRING(Z_QUALITY_MIN)"=low .. " __XSTRING(Z_QUALITY_MAX)"=high)")
 
static __inline uint32_t z_min (uint32_t x, uint32_t y)
 
static int32_t z_gcd (int32_t x, int32_t y)
 
static int32_t z_roundpow2 (int32_t v)
 
static void z_feed_zoh (struct z_info *info, uint8_t *dst)
 
static void z_resampler_reset (struct z_info *info)
 
static int32_t z_resampler_sinc_len (struct z_info *info)
 
static int32_t z_coeff_interpolate (int32_t z, int32_t *z_coeff)
 
static int z_resampler_build_polyphase (struct z_info *info)
 
static int z_resampler_setup (struct pcm_feeder *f)
 
static int z_resampler_set (struct pcm_feeder *f, int what, int32_t value)
 
static int z_resampler_get (struct pcm_feeder *f, int what)
 
static int z_resampler_init (struct pcm_feeder *f)
 
static int z_resampler_free (struct pcm_feeder *f)
 
static uint32_t z_resampler_feed_internal (struct pcm_feeder *f, struct pcm_channel *c, uint8_t *b, uint32_t count, void *source)
 
static int z_resampler_feed (struct pcm_feeder *f, struct pcm_channel *c, uint8_t *b, uint32_t count, void *source)
 
 FEEDER_DECLARE (feeder_rate, NULL)
 

Variables

int feeder_rate_min = Z_RATE_MIN
 
int feeder_rate_max = Z_RATE_MAX
 
int feeder_rate_round = Z_ROUNDHZ
 
int feeder_rate_quality = Z_QUALITY_DEFAULT
 
static int feeder_rate_polyphase_max = Z_POLYPHASE_MAX
 
static char feeder_rate_presets [] = FEEDER_RATE_PRESETS
 
struct {
   uint32_t   format
 
   z_resampler_t   resampler [Z_RESAMPLER_LAST]
 
z_resampler_tab []
 
static struct pcm_feederdesc feeder_rate_desc []
 
static kobj_method_t feeder_rate_methods []
 

Macro Definition Documentation

◆ _Z_DRIFT

#define _Z_DRIFT (   i,
  x,
 
)     ((_Z_GCAST((i)->z_gy) * (x)) - (_Z_GCAST((i)->z_gx) * (y)))

Definition at line 354 of file feeder_rate.c.

◆ _Z_GCAST

#define _Z_GCAST (   x)    ((uint64_t)(x))

Definition at line 311 of file feeder_rate.c.

◆ _Z_GX2GY

#define _Z_GX2GY (   i,
  a,
 
)     Z_DIV(((_Z_GCAST((i)->z_gy) * (v)) + (a)), (i)->z_gx)

Definition at line 351 of file feeder_rate.c.

◆ _Z_GY2GX

#define _Z_GY2GX (   i,
  a,
 
)
Value:
Z_DIV(((_Z_GCAST((i)->z_gx) * (v)) + ((i)->z_gy - (a) - 1)), \
(i)->z_gy)
#define _Z_GCAST(x)
Definition: feeder_rate.c:311
#define Z_DIV(x, y)
Definition: feeder_rate.c:344

Definition at line 347 of file feeder_rate.c.

◆ _Z_SINC_ACCUMULATE

#define _Z_SINC_ACCUMULATE (   SIGN,
  BIT,
  ENDIAN,
  adv 
)
Value:
c += z >> Z_SHIFT; \
z &= Z_MASK; \
coeff = Z_COEFF_INTERPOLATE(z, z_coeff[c], z_dcoeff[c]); \
x = _PCM_READ_##SIGN##BIT##_##ENDIAN(p); \
v += Z_NORM_##BIT((intpcm64_t)x * coeff); \
z += info->z_dy; \
p adv##= info->channels * PCM_##BIT##_BPS
struct pcm_channel * c
Definition: channel_if.m:106
int64_t intpcm64_t
Definition: pcm.h:74

Definition at line 523 of file feeder_rate.c.

◆ SND_USE_FXDIV

#define SND_USE_FXDIV

Definition at line 61 of file feeder_rate.c.

◆ z_align

#define z_align (   i,
 
)    ((v) & (i)->z_mask)

Definition at line 380 of file feeder_rate.c.

◆ Z_CLAMP

#define Z_CLAMP (   v,
  BIT 
)
Value:
(((v) > PCM_S##BIT##_MAX) ? PCM_S##BIT##_MAX : \
(((v) < PCM_S##BIT##_MIN) ? PCM_S##BIT##_MIN : (v)))

Definition at line 513 of file feeder_rate.c.

◆ Z_CLIP_CHECK

#define Z_CLIP_CHECK (   ...)

Definition at line 510 of file feeder_rate.c.

◆ z_copy

#define z_copy (   src,
  dst,
  sz 
)    (void)memcpy(dst, src, sz)

Definition at line 389 of file feeder_rate.c.

◆ Z_DECLARE

#define Z_DECLARE (   SIGN,
  BIT,
  ENDIAN 
)
Value:
Z_DECLARE_LINEAR(SIGN, BIT, ENDIAN) \
Z_DECLARE_SINC(SIGN, BIT, ENDIAN) \
Z_DECLARE_SINC_POLYPHASE(SIGN, BIT, ENDIAN)
#define Z_DECLARE_LINEAR(SIGN, BIT, ENDIAN)
Definition: feeder_rate.c:464

Definition at line 628 of file feeder_rate.c.

◆ Z_DECLARE_LINEAR

#define Z_DECLARE_LINEAR (   SIGN,
  BIT,
  ENDIAN 
)
Value:
static void \
z_feed_linear_##SIGN##BIT##ENDIAN(struct z_info *info, uint8_t *dst) \
{ \
int32_t z; \
intpcm_t x, y; \
uint32_t ch; \
uint8_t *sx, *sy; \
\
z = ((uint32_t)info->z_alpha * info->z_dx) >> Z_LINEAR_UNSHIFT; \
\
sx = info->z_delay + (info->z_start * info->channels * \
PCM_##BIT##_BPS); \
sy = sx - (info->channels * PCM_##BIT##_BPS); \
\
ch = info->channels; \
\
do { \
x = _PCM_READ_##SIGN##BIT##_##ENDIAN(sx); \
y = _PCM_READ_##SIGN##BIT##_##ENDIAN(sy); \
x = Z_LINEAR_INTERPOLATE_##BIT(z, x, y); \
_PCM_WRITE_##SIGN##BIT##_##ENDIAN(dst, x); \
sx += PCM_##BIT##_BPS; \
sy += PCM_##BIT##_BPS; \
dst += PCM_##BIT##_BPS; \
} while (--ch != 0); \
}

Definition at line 464 of file feeder_rate.c.

◆ Z_DECLARE_SINC

#define Z_DECLARE_SINC (   SIGN,
  BIT,
  ENDIAN 
)

Definition at line 548 of file feeder_rate.c.

◆ Z_DECLARE_SINC_POLYPHASE

#define Z_DECLARE_SINC_POLYPHASE (   SIGN,
  BIT,
  ENDIAN 
)

Definition at line 589 of file feeder_rate.c.

◆ Z_DIV

#define Z_DIV (   x,
 
)    ((x) / (y))

Definition at line 344 of file feeder_rate.c.

◆ z_drift

#define z_drift (   i,
  x,
 
)    _Z_DRIFT(i, x, y)

Definition at line 359 of file feeder_rate.c.

◆ Z_FACTOR_MAX

#define Z_FACTOR_MAX   Z_MASK

Definition at line 115 of file feeder_rate.c.

◆ Z_FACTOR_MIN

#define Z_FACTOR_MIN   1

Definition at line 114 of file feeder_rate.c.

◆ Z_FACTOR_SAFE

#define Z_FACTOR_SAFE (   v)    (!((v) < Z_FACTOR_MIN || (v) > Z_FACTOR_MAX))

Definition at line 116 of file feeder_rate.c.

◆ z_feed

#define z_feed (   ...)    FEEDER_FEED(__VA_ARGS__)

Definition at line 390 of file feeder_rate.c.

◆ z_fetched

#define z_fetched (   i)    (z_align(i, (i)->z_pos - (i)->z_start) - 1)

Definition at line 383 of file feeder_rate.c.

◆ z_free

#define z_free (   i)    ((i)->z_full - (i)->z_pos)

Definition at line 384 of file feeder_rate.c.

◆ z_gx2gy

#define z_gx2gy (   i,
 
)    _Z_GX2GY(i, (i)->z_alpha, v)

Definition at line 358 of file feeder_rate.c.

◆ z_gy2gx

#define z_gy2gx (   i,
 
)    _Z_GY2GX(i, (i)->z_alpha, v)

Definition at line 357 of file feeder_rate.c.

◆ Z_IS_LINEAR

#define Z_IS_LINEAR (   i)    ((i)->quality == Z_QUALITY_LINEAR)

Definition at line 298 of file feeder_rate.c.

◆ Z_IS_SINC

#define Z_IS_SINC (   i)    ((i)->quality > Z_QUALITY_LINEAR)

Definition at line 299 of file feeder_rate.c.

◆ Z_IS_ZOH

#define Z_IS_ZOH (   i)    ((i)->quality == Z_QUALITY_ZOH)

Definition at line 297 of file feeder_rate.c.

◆ Z_MULTIFORMAT

#define Z_MULTIFORMAT   1

Definition at line 107 of file feeder_rate.c.

◆ z_next

#define z_next (   i,
  o,
 
)    z_align(i, (o) + (v))

Definition at line 381 of file feeder_rate.c.

◆ Z_PARANOID

#define Z_PARANOID   1

Definition at line 105 of file feeder_rate.c.

◆ Z_POLYPHASE_COEFF_SHIFT

#define Z_POLYPHASE_COEFF_SHIFT   0

Definition at line 779 of file feeder_rate.c.

◆ Z_POLYPHASE_MAX

#define Z_POLYPHASE_MAX   183040 /* 286 taps, 640 phases */

Definition at line 87 of file feeder_rate.c.

◆ z_prev

#define z_prev (   i,
  o,
 
)    z_align(i, (o) - (v))

Definition at line 382 of file feeder_rate.c.

◆ Z_QUALITY_DEFAULT

#define Z_QUALITY_DEFAULT   Z_QUALITY_LINEAR

Definition at line 77 of file feeder_rate.c.

◆ Z_RATE_CHANNELS

#define Z_RATE_CHANNELS   FEEDRATE_CHANNELS

Definition at line 103 of file feeder_rate.c.

◆ Z_RATE_DEFAULT

#define Z_RATE_DEFAULT   48000

Definition at line 92 of file feeder_rate.c.

◆ Z_RATE_DST

#define Z_RATE_DST   FEEDRATE_DST

Definition at line 101 of file feeder_rate.c.

◆ Z_RATE_MAX

#define Z_RATE_MAX   FEEDRATE_RATEMAX

Definition at line 95 of file feeder_rate.c.

◆ Z_RATE_MIN

#define Z_RATE_MIN   FEEDRATE_RATEMIN

Definition at line 94 of file feeder_rate.c.

◆ Z_RATE_QUALITY

#define Z_RATE_QUALITY   FEEDRATE_QUALITY

Definition at line 102 of file feeder_rate.c.

◆ Z_RATE_SRC

#define Z_RATE_SRC   FEEDRATE_SRC

Definition at line 100 of file feeder_rate.c.

◆ Z_RESAMPLER_ENTRY

#define Z_RESAMPLER_ENTRY (   SIGN,
  BIT,
  ENDIAN 
)
Value:
{ \
AFMT_##SIGN##BIT##_##ENDIAN, \
{ \
[Z_RESAMPLER_LINEAR] = z_feed_linear_##SIGN##BIT##ENDIAN, \
[Z_RESAMPLER_SINC] = z_feed_sinc_##SIGN##BIT##ENDIAN, \
z_feed_sinc_polyphase_##SIGN##BIT##ENDIAN \
} \
}
static void z_feed_zoh(struct z_info *info, uint8_t *dst)
Definition: feeder_rate.c:434
@ Z_RESAMPLER_LINEAR
Definition: feeder_rate.c:656
@ Z_RESAMPLER_SINC_POLYPHASE
Definition: feeder_rate.c:658
@ Z_RESAMPLER_SINC
Definition: feeder_rate.c:657
@ Z_RESAMPLER_ZOH
Definition: feeder_rate.c:655

Definition at line 665 of file feeder_rate.c.

◆ Z_RESAMPLER_IDX

#define Z_RESAMPLER_IDX (   i)     (Z_IS_SINC(i) ? Z_RESAMPLER_SINC : (i)->quality)

Definition at line 662 of file feeder_rate.c.

◆ Z_RESAMPLER_TAB_SIZE

#define Z_RESAMPLER_TAB_SIZE    ((int32_t)(sizeof(z_resampler_tab) / sizeof(z_resampler_tab[0])))

Definition at line 703 of file feeder_rate.c.

◆ Z_RESERVOIR

#define Z_RESERVOIR   2048

Definition at line 80 of file feeder_rate.c.

◆ Z_RESERVOIR_MAX

#define Z_RESERVOIR_MAX   131072

Definition at line 81 of file feeder_rate.c.

◆ Z_ROUNDHZ

#define Z_ROUNDHZ   FEEDRATE_ROUNDHZ

Definition at line 96 of file feeder_rate.c.

◆ Z_ROUNDHZ_MAX

#define Z_ROUNDHZ_MAX   FEEDRATE_ROUNDHZ_MAX

Definition at line 98 of file feeder_rate.c.

◆ Z_ROUNDHZ_MIN

#define Z_ROUNDHZ_MIN   FEEDRATE_ROUNDHZ_MIN

Definition at line 97 of file feeder_rate.c.

◆ Z_SINC_ACCUMULATE

#define Z_SINC_ACCUMULATE (   ...)
Value:
do { \
_Z_SINC_ACCUMULATE(__VA_ARGS__); \
} while (0)

Definition at line 542 of file feeder_rate.c.

◆ Z_SINC_ACCUMULATE_DECR

#define Z_SINC_ACCUMULATE_DECR   1

Definition at line 545 of file feeder_rate.c.

◆ Z_SINC_BASE_LEN

#define Z_SINC_BASE_LEN (   i)     ((z_coeff_tab[Z_SINC_COEFF_IDX(i)].len - 1) >> (Z_DRIFT_SHIFT - 1))

Definition at line 370 of file feeder_rate.c.

◆ Z_SINC_COEFF_IDX

#define Z_SINC_COEFF_IDX (   i)    ((i)->quality - Z_QUALITY_LINEAR - 1)

Definition at line 364 of file feeder_rate.c.

◆ Z_SINC_DOWNMAX

#define Z_SINC_DOWNMAX   48 /* 384000 / 8000 */

Definition at line 84 of file feeder_rate.c.

◆ Z_SINC_LEN

#define Z_SINC_LEN (   i)
Value:
((int32_t)(((uint64_t)z_coeff_tab[Z_SINC_COEFF_IDX(i)].len << \
Z_SHIFT) / (i)->z_dy))
#define Z_SINC_COEFF_IDX(i)
Definition: feeder_rate.c:364

Definition at line 366 of file feeder_rate.c.

◆ Z_SINC_MAX

#define Z_SINC_MAX   0x3fffff

Definition at line 83 of file feeder_rate.c.

◆ Z_USE_ALPHADRIFT

#define Z_USE_ALPHADRIFT   1

Definition at line 111 of file feeder_rate.c.

Typedef Documentation

◆ z_resampler_t

typedef void(* z_resampler_t) (struct z_info *, uint8_t *)

Definition at line 120 of file feeder_rate.c.

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
Z_RESAMPLER_ZOH 
Z_RESAMPLER_LINEAR 
Z_RESAMPLER_SINC 
Z_RESAMPLER_SINC_POLYPHASE 
Z_RESAMPLER_LAST 

Definition at line 654 of file feeder_rate.c.

Function Documentation

◆ FEEDER_DECLARE()

FEEDER_DECLARE ( feeder_rate  ,
NULL   
)

◆ SND_DECLARE_FILE()

SND_DECLARE_FILE ( "$FreeBSD$"  )

◆ sysctl_hw_snd_feeder_rate_max()

static int sysctl_hw_snd_feeder_rate_max ( SYSCTL_HANDLER_ARGS  )
static

Definition at line 194 of file feeder_rate.c.

References feeder_rate_max, feeder_rate_min, req, val, and Z_FACTOR_SAFE.

◆ sysctl_hw_snd_feeder_rate_min()

static int sysctl_hw_snd_feeder_rate_min ( SYSCTL_HANDLER_ARGS  )
static

Definition at line 171 of file feeder_rate.c.

References feeder_rate_max, feeder_rate_min, req, val, and Z_FACTOR_SAFE.

◆ sysctl_hw_snd_feeder_rate_quality()

static int sysctl_hw_snd_feeder_rate_quality ( SYSCTL_HANDLER_ARGS  )
static

◆ sysctl_hw_snd_feeder_rate_round()

static int sysctl_hw_snd_feeder_rate_round ( SYSCTL_HANDLER_ARGS  )
static

Definition at line 217 of file feeder_rate.c.

References feeder_rate_round, req, val, Z_ROUNDHZ, and Z_ROUNDHZ_MAX.

◆ SYSCTL_INT()

SYSCTL_INT ( _hw_snd  ,
OID_AUTO  ,
feeder_rate_polyphase_max  ,
CTLFLAG_RWTUN  ,
feeder_rate_polyphase_max,
,
"maximum allowable polyphase entries"   
)

◆ SYSCTL_PROC() [1/4]

SYSCTL_PROC ( _hw_snd  ,
OID_AUTO  ,
feeder_rate_max  ,
CTLTYPE_INT|CTLFLAG_RWTUN|  CTLFLAG_MPSAFE,
,
sizeof(int)  ,
sysctl_hw_snd_feeder_rate_max  ,
"I"  ,
"maximum allowable rate  
)

◆ SYSCTL_PROC() [2/4]

SYSCTL_PROC ( _hw_snd  ,
OID_AUTO  ,
feeder_rate_min  ,
CTLTYPE_INT|CTLFLAG_RWTUN|  CTLFLAG_MPSAFE,
,
sizeof(int)  ,
sysctl_hw_snd_feeder_rate_min  ,
"I"  ,
"minimum allowable rate  
)

◆ SYSCTL_PROC() [3/4]

SYSCTL_PROC ( _hw_snd  ,
OID_AUTO  ,
feeder_rate_quality  ,
CTLTYPE_INT|CTLFLAG_RWTUN|  CTLFLAG_NEEDGIANT,
,
sizeof(int)  ,
sysctl_hw_snd_feeder_rate_quality  ,
"I"  ,
"sample rate converter quality ("__XSTRING(Z_QUALITY_MIN)"=low .. " __XSTRING(Z_QUALITY_MAX)"=high)"   
)

◆ SYSCTL_PROC() [4/4]

SYSCTL_PROC ( _hw_snd  ,
OID_AUTO  ,
feeder_rate_round  ,
CTLTYPE_INT|CTLFLAG_RWTUN|  CTLFLAG_MPSAFE,
,
sizeof(int)  ,
sysctl_hw_snd_feeder_rate_round  ,
"I"  ,
"sample rate converter rounding threshold"   
)

◆ SYSCTL_STRING()

SYSCTL_STRING ( _hw_snd  ,
OID_AUTO  ,
feeder_rate_presets  ,
CTLFLAG_RD  ,
feeder_rate_presets,
,
"compile-time rate presets"   
)

◆ z_coeff_interpolate()

static int32_t z_coeff_interpolate ( int32_t  z,
int32_t *  z_coeff 
)
static

Definition at line 819 of file feeder_rate.c.

References Z_POLYPHASE_COEFF_SHIFT.

Referenced by z_resampler_build_polyphase().

Here is the caller graph for this function:

◆ z_feed_zoh()

static void z_feed_zoh ( struct z_info info,
uint8_t *  dst 
)
static

Definition at line 434 of file feeder_rate.c.

References z_info::bps, z_info::channels, src, z_copy, z_info::z_delay, and z_info::z_start.

◆ z_gcd()

static int32_t z_gcd ( int32_t  x,
int32_t  y 
)
static

Definition at line 400 of file feeder_rate.c.

Referenced by z_resampler_setup().

Here is the caller graph for this function:

◆ z_min()

static __inline uint32_t z_min ( uint32_t  x,
uint32_t  y 
)
static

Definition at line 393 of file feeder_rate.c.

Referenced by z_resampler_feed(), and z_resampler_feed_internal().

Here is the caller graph for this function:

◆ z_resampler_build_polyphase()

static int z_resampler_build_polyphase ( struct z_info info)
static

Definition at line 1031 of file feeder_rate.c.

References c, feeder_rate_polyphase_max, free, z_info::z_coeff, z_coeff_interpolate(), z_info::z_dx, z_info::z_dy, z_info::z_gx, z_info::z_gy, z_info::z_pcoeff, and z_info::z_size.

Referenced by z_resampler_setup().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ z_resampler_feed()

static int z_resampler_feed ( struct pcm_feeder f,
struct pcm_channel c,
uint8_t *  b,
uint32_t  count,
void *  source 
)
static

Definition at line 1706 of file feeder_rate.c.

References b, c, count, pcm_feeder::data, feed, left, source, z_info::z_maxfeed, z_min(), and z_resampler_feed_internal().

Here is the call graph for this function:

◆ z_resampler_feed_internal()

static uint32_t z_resampler_feed_internal ( struct pcm_feeder f,
struct pcm_channel c,
uint8_t *  b,
uint32_t  count,
void *  source 
)
static

◆ z_resampler_free()

static int z_resampler_free ( struct pcm_feeder f)
static

Definition at line 1551 of file feeder_rate.c.

References pcm_feeder::data, free, z_info::z_delay, and z_info::z_pcoeff.

◆ z_resampler_get()

static int z_resampler_get ( struct pcm_feeder f,
int  what 
)
static

◆ z_resampler_init()

static int z_resampler_init ( struct pcm_feeder f)
static

◆ z_resampler_reset()

static void z_resampler_reset ( struct z_info info)
static

◆ z_resampler_set()

static int z_resampler_set ( struct pcm_feeder f,
int  what,
int32_t  value 
)
static

◆ z_resampler_setup()

◆ z_resampler_sinc_len()

static int32_t z_resampler_sinc_len ( struct z_info info)
static

Definition at line 739 of file feeder_rate.c.

References c, len, z_info::z_dy, Z_IS_SINC, Z_SINC_COEFF_IDX, and Z_SINC_LEN.

Referenced by z_resampler_setup().

Here is the caller graph for this function:

◆ z_roundpow2()

static int32_t z_roundpow2 ( int32_t  v)
static

Definition at line 414 of file feeder_rate.c.

Referenced by z_resampler_setup().

Here is the caller graph for this function:

Variable Documentation

◆ feeder_rate_desc

struct pcm_feederdesc feeder_rate_desc[]
static
Initial value:
= {
{ FEEDER_RATE, 0, 0, 0, 0 },
{ 0, 0, 0, 0, 0 },
}
@ FEEDER_RATE
Definition: feeder.h:85

Definition at line 1727 of file feeder_rate.c.

◆ feeder_rate_max

◆ feeder_rate_methods

kobj_method_t feeder_rate_methods[]
static
Initial value:
= {
KOBJMETHOD(feeder_init, z_resampler_init),
KOBJMETHOD(feeder_free, z_resampler_free),
KOBJMETHOD(feeder_set, z_resampler_set),
KOBJMETHOD(feeder_get, z_resampler_get),
KOBJMETHOD(feeder_feed, z_resampler_feed),
}
static int z_resampler_feed(struct pcm_feeder *f, struct pcm_channel *c, uint8_t *b, uint32_t count, void *source)
Definition: feeder_rate.c:1706
static int z_resampler_free(struct pcm_feeder *f)
Definition: feeder_rate.c:1551
static int z_resampler_set(struct pcm_feeder *f, int what, int32_t value)
Definition: feeder_rate.c:1436
static int z_resampler_get(struct pcm_feeder *f, int what)
Definition: feeder_rate.c:1491
static int z_resampler_init(struct pcm_feeder *f)
Definition: feeder_rate.c:1518
#define KOBJMETHOD_END
Definition: midi.c:76

Definition at line 1732 of file feeder_rate.c.

◆ feeder_rate_min

◆ feeder_rate_polyphase_max

int feeder_rate_polyphase_max = Z_POLYPHASE_MAX
static

Definition at line 161 of file feeder_rate.c.

Referenced by z_resampler_build_polyphase().

◆ feeder_rate_presets

char feeder_rate_presets[] = FEEDER_RATE_PRESETS
static

Definition at line 164 of file feeder_rate.c.

◆ feeder_rate_quality

int feeder_rate_quality = Z_QUALITY_DEFAULT

Definition at line 159 of file feeder_rate.c.

Referenced by sysctl_hw_snd_feeder_rate_quality(), and z_resampler_init().

◆ feeder_rate_round

◆ format

uint32_t format

Definition at line 678 of file feeder_rate.c.

Referenced by z_resampler_setup().

◆ resampler

Definition at line 679 of file feeder_rate.c.

◆ 

const struct { ... } z_resampler_tab[]
Initial value:
= {
Z_RESAMPLER_ENTRY(S, 16, LE),
Z_RESAMPLER_ENTRY(S, 32, LE),
Z_RESAMPLER_ENTRY(S, 16, BE),
Z_RESAMPLER_ENTRY(S, 32, BE),
}
#define Z_RESAMPLER_ENTRY(SIGN, BIT, ENDIAN)
Definition: feeder_rate.c:665

Referenced by z_resampler_setup().