![]() |
UltraGrid
UltraGrid Low-Latency High-Resolution Transmission System
|


Go to the source code of this file.
Classes | |
| struct | channel_map |
Macros | |
| #define | STORE_I32_SAMPLE(ptr, val, out_bps) |
| stores given int32_t sample at required out_bps | |
Functions | |
| bool | append_audio_frame (struct audio_frame *frame, char *data, size_t data_len) |
| void | audio_channel_demux (const audio_frame2 *, int, audio_channel *) |
| bool | audio_desc_eq (struct audio_desc, struct audio_desc) |
| struct audio_desc | audio_desc_from_audio_channel (const audio_channel *) |
| struct audio_desc | audio_desc_from_frame (const struct audio_frame *frame) |
| const char * | audio_desc_to_cstring (struct audio_desc desc) |
| struct audio_frame * | audio_frame_copy (const struct audio_frame *src, bool keep_size) |
| void | audio_frame_multiply_channel (struct audio_frame *frame, int new_channel_count) |
| void | audio_frame_write_desc (struct audio_frame *f, struct audio_desc desc) |
| double | calculate_rms (audio_frame *frame, int channel, double *peak) |
| double | calculate_rms (audio_frame2 *frame, int channel, double *peak) |
| Calculates mean and peak RMS from audio samples. | |
| void | change_bps (char *out, int out_bps, const char *in, int in_bps, int in_len) |
| void | change_bps2 (char *out, int out_bps, const char *in, int in_bps, int in_len, bool dither) |
| changes bps with option to specify whether or not do the dithering | |
| void | copy_channel (char *out, const char *in, int bps, int in_len, int out_channel_count) |
| void | demux_channel (char *out, char *in, int bps, int in_len, int in_stream_channels, int pos_in_stream) |
| int32_t | downshift_with_dither (int32_t val, int shift) |
| void | float2int (char *out, const char *in, int len) |
| void | format_audio_channel_volume (int chan_idx, double rms, double peak, const char *format_color, char **volume_start, char *volume_end) |
| format per channel incrementally volume string (eg. "[0]
-18.00/-14.99, [1] -18.00/-14.99") | |
| double | get_avg_volume (char *data, int bps, int in_len, int stream_channels, int chan_pos_stream) |
| void | int2float (char *out, const char *in, int len) |
| void | interleaved2noninterleaved (char *out, const char *in, int bps, int in_len, int channel_count) |
| void | interleaved2noninterleaved2 (char **out, const char *in, int bps, int in_len, int channel_count) |
| void | interleaved2noninterleaved_float (char **out, const char *in, int in_bps, int in_len, int channel_count) |
| void | mux_and_mix_channel (char *out, const char *in, int bps, int in_len, int out_stream_channels, int chan_pos_stream, double scale) |
| void | mux_channel (char *out, const char *in, int bps, int in_len, int out_stream_channels, int chan_pos_stream, double scale) |
| int | parse_audio_format (const char *str, struct audio_desc *ret) |
| bool | parse_channel_map_cfg (struct channel_map *channel_map, const char *cfg) |
| void | remux_and_mix_channel (char *out, const char *in, int bps, int frames, int in_stream_channels, int out_stream_channels, int in_channel, int out_channel, double scale) |
| void | remux_channel (char *out, const char *in, int bps, int in_len, int in_stream_channels, int out_stream_channels, int pos_in_stream, int pos_out_stream) |
| void | signed2unsigned (char *out, const char *in, int in_len) |
Definition in file utils.h.
| #define STORE_I32_SAMPLE | ( | ptr, | |
| val, | |||
| out_bps ) |
stores given int32_t sample at required out_bps
Definition at line 143 of file utils.h.
Referenced by generate_audio_sine(), and get_ebu_signal().
| bool append_audio_frame | ( | struct audio_frame * | frame, |
| char * | data, | ||
| size_t | data_len ) |
Appends data to audio frame
Definition at line 620 of file utils.cpp.
References frame, LOG_LEVEL_WARNING, and log_msg().
Referenced by display_pipe_get_audio().

| void audio_channel_demux | ( | const audio_frame2 * | frame, |
| int | index, | ||
| audio_channel * | channel ) |
Definition at line 528 of file utils.cpp.
References audio_channel::bps, audio_channel::codec, audio_channel::data, audio_channel::data_len, frame, and audio_channel::sample_rate.
Referenced by audio_codec_compress(), and audio_codec_decompress().
| bool audio_desc_eq | ( | struct audio_desc | a1, |
| struct audio_desc | a2 ) |
Definition at line 189 of file utils.cpp.
References audio_desc::bps, audio_desc::ch_count, audio_desc::codec, and audio_desc::sample_rate.
Referenced by audio_append_pcm(), audio_export(), audio_receiver_thread(), check_reconf(), display_pipe_get_audio(), libavcodec_decompress(), and process_input().
| struct audio_desc audio_desc_from_audio_channel | ( | const audio_channel * | channel | ) |
Definition at line 205 of file utils.cpp.
Referenced by libavcodec_decompress(), and process_input().
| struct audio_desc audio_desc_from_frame | ( | const struct audio_frame * | frame | ) |
Definition at line 196 of file utils.cpp.
Referenced by audio_append_pcm(), audio_export(), audio_receiver_thread(), display_file_put_audio_frame(), display_pipe_get_audio(), generate_signal(), setup_audio(), vidcap_state_aja::SetupAudio(), and wait_for_channel().
| const char * audio_desc_to_cstring | ( | struct audio_desc | desc | ) |
Definition at line 644 of file utils.cpp.
References desc.
Referenced by generate_signal(), set_audio_spec_to_vrxtx(), and vidcap_file_init().
| struct audio_frame * audio_frame_copy | ( | const struct audio_frame * | src, |
| bool | keep_size ) |
Creates a deep copy of src. Both struct and audio_frame::data is malloc'd.
| keep_size | allocate exactly same storage (audio_frame::max_size) as original frame. If false, the storage may be shorter. |
Definition at line 633 of file utils.cpp.
References audio_frame::data, audio_frame::data_len, and audio_frame::max_size.
Referenced by display_pipe_put_audio_frame().
| void audio_frame_multiply_channel | ( | struct audio_frame * | frame, |
| int | new_channel_count ) |
Makes n copies of first channel (interleaved).
Definition at line 328 of file utils.cpp.
References copy_channel(), and frame.

| void audio_frame_write_desc | ( | struct audio_frame * | f, |
| struct audio_desc | desc ) |
Copies desc from desc to f.
Definition at line 220 of file utils.cpp.
References audio_frame::bps, audio_frame::ch_count, desc, and audio_frame::sample_rate.
Referenced by display_pipe_get_audio(), and get_audio().
| double calculate_rms | ( | audio_frame * | frame, |
| int | channel, | ||
| double * | peak ) |
Definition at line 169 of file utils.cpp.
References calculate_rms_helper(), frame, LOG, and LOG_LEVEL_FATAL.

| double calculate_rms | ( | audio_frame2 * | frame, |
| int | channel, | ||
| double * | peak ) |
Calculates mean and peak RMS from audio samples.
| [in] | frame | audio frame |
| [in] | channel | channel index to calculate RMS to |
| [out] | peak | peak RMS |
Definition at line 150 of file utils.cpp.
References AC_PCM, calculate_rms_helper(), frame, LOG, and LOG_LEVEL_FATAL.
Referenced by adec_compute_and_print_stats(), asend_compute_and_print_stats(), decode_audio_frame(), and filter().

| void change_bps | ( | char * | out, |
| int | out_bps, | ||
| const char * | in, | ||
| int | in_bps, | ||
| int | in_len ) |
Changes bps for everey sample.
The memory areas shouldn't (supposedly) overlap.
Definition at line 258 of file utils.cpp.
References change_bps2(), commandline_params, and NO_DITHER_PARAM.
Referenced by audio_testcard_read_wav(), display_sdl_put_audio_frame(), echo_cancel(), echo_play(), and process_input().

| void change_bps2 | ( | char * | out, |
| int | out_bps, | ||
| const char * | in, | ||
| int | in_bps, | ||
| int | in_len, | ||
| bool | dither ) |
changes bps with option to specify whether or not do the dithering
Definition at line 263 of file utils.cpp.
References downshift_with_dither(), format_from_in_bps(), and format_to_out_bps().
Referenced by change_bps(), and get_sine_signal().

| void copy_channel | ( | char * | out, |
| const char * | in, | ||
| int | bps, | ||
| int | in_len, | ||
| int | out_channel_count ) |
Definition at line 306 of file utils.cpp.
References audio_desc::bps.
Referenced by audio_frame_multiply_channel().
| void demux_channel | ( | char * | out, |
| char * | in, | ||
| int | bps, | ||
| int | in_len, | ||
| int | in_stream_channels, | ||
| int | pos_in_stream ) |
Definition at line 334 of file utils.cpp.
References audio_desc::bps.
Referenced by audio_frame2::audio_frame2(), audio_cap_alsa_read(), display_deltacast_put_audio_frame(), jack_process_callback(), process_new_audio_packets(), and vidcap_dvs_grab_thread().
| int32_t downshift_with_dither | ( | int32_t | val, |
| int | shift ) |
Bit-shifts val down by shift bits with a triangular dither noise.
By reducing bit-depth of audio, quantization noise is introduced. If the bit depth is reduced by consistent rounding (either always down, always up, or always to nearest) the quantization noise is correlated with the input signal and percieved as distortion. Adding a small amount of noise to the input signal before reducing the bit-depth causes random rounding, which makes the noise uncorrelated and uniformly spread through the whole spectrum.
Definition at line 227 of file utils.cpp.
Referenced by change_bps2().

| void float2int | ( | char * | out, |
| const char * | in, | ||
| int | len ) |
This fuction converts from normalized float to int32_t representation Input and output data may overlap.
| [out] | out | 4-byte aligned output buffer |
| [in] | in | 4-byte aligned input buffer |
Can be used in situ.
Definition at line 482 of file utils.cpp.
References INT_MAX_FLT, and len.
Referenced by audio_cap_jack_read(), libavcodec_decompress(), and vidcap_file_write_audio().
| void format_audio_channel_volume | ( | int | chan_idx, |
| double | rms, | ||
| double | peak, | ||
| const char * | format_color, | ||
| char ** | volume_start, | ||
| char * | volume_end ) |
format per channel incrementally volume string (eg. "[0] -18.00/-14.99, [1] -18.00/-14.99")
| rms | volume RMS in range [0,1] | |
| peak | value of sample with maximal absolute value in range [0,1] | |
| [in,out] | volume_start | string to be wwritten to, after function exit will to point after just written data |
Definition at line 828 of file utils.cpp.
References TERM_RESET.
Referenced by adec_compute_and_print_stats(), and asend_compute_and_print_stats().
| double get_avg_volume | ( | char * | data, |
| int | bps, | ||
| int | in_len, | ||
| int | stream_channels, | ||
| int | chan_pos_stream ) |
Definition at line 461 of file utils.cpp.
References audio_desc::bps, get_avg_volume_helper(), LOG, and LOG_LEVEL_FATAL.
Referenced by decode_audio_frame().

| void int2float | ( | char * | out, |
| const char * | in, | ||
| int | len ) |
This fuction converts from int32_t to normalized float Input and output data may overlap.
| [out] | out | 4-byte aligned output buffer |
| [in] | in | 4-byte aligned input buffer |
Definition at line 496 of file utils.cpp.
References len.
Referenced by audio_play_jack_put_frame(), and process_input().
| void interleaved2noninterleaved | ( | char * | out, |
| const char * | in, | ||
| int | bps, | ||
| int | in_len, | ||
| int | channel_count ) |
Definition at line 610 of file utils.cpp.
References audio_desc::bps, and interleaved2noninterleaved2().
Referenced by write_samples().

| void interleaved2noninterleaved2 | ( | char ** | out, |
| const char * | in, | ||
| int | bps, | ||
| int | in_len, | ||
| int | channel_count ) |
Definition at line 566 of file utils.cpp.
References audio_desc::bps.
Referenced by file_append_audio_frame(), and interleaved2noninterleaved().
| void interleaved2noninterleaved_float | ( | char ** | out, |
| const char * | in, | ||
| int | in_bps, | ||
| int | in_len, | ||
| int | channel_count ) |
Definition at line 578 of file utils.cpp.
References val.
Referenced by file_append_audio_frame().
| void mux_and_mix_channel | ( | char * | out, |
| const char * | in, | ||
| int | bps, | ||
| int | in_len, | ||
| int | out_stream_channels, | ||
| int | chan_pos_stream, | ||
| double | scale ) |
Definition at line 402 of file utils.cpp.
References audio_desc::bps, format_from_in_bps(), and format_to_out_bps().
Referenced by decode_audio_frame().

| void mux_channel | ( | char * | out, |
| const char * | in, | ||
| int | bps, | ||
| int | in_len, | ||
| int | out_stream_channels, | ||
| int | chan_pos_stream, | ||
| double | scale ) |
Definition at line 371 of file utils.cpp.
References audio_desc::bps, format_from_in_bps(), and format_to_out_bps().
Referenced by decode_yuri_audio_frame(), InputProc(), jack_process_callback(), and vidcap_file_write_audio().

| int parse_audio_format | ( | const char * | str, |
| struct audio_desc * | ret ) |
Parses configuration string for audio format.
Only members that are specified explicitly by the config string are changed in returned audio desc, the remaining members are left untouched!
Definition at line 655 of file utils.cpp.
References audio_desc::bps, audio_frame::bps, audio_desc::ch_count, color_printf(), IS_KEY_PREFIX, LOG, LOG_LEVEL_ERROR, LOG_LEVEL_INFO, LOG_LEVEL_WARNING, log_msg(), MAX_AUD_CH_COUNT, MAX_AUD_SAMPLE_RATE, audio_desc::sample_rate, TBOLD, unit_evaluate(), and val.
Referenced by audio_decoder_reconfigure(), and set_audio_capture_format().

| bool parse_channel_map_cfg | ( | struct channel_map * | channel_map, |
| const char * | cfg ) |
Definition at line 716 of file utils.cpp.
References channel_map::compute_contributors(), LOG_LEVEL_ERROR, log_msg(), channel_map::map, channel_map::size, channel_map::sizes, and channel_map::validate().
Referenced by audio_decoder_init(), and init().

| void remux_and_mix_channel | ( | char * | out, |
| const char * | in, | ||
| int | bps, | ||
| int | frames, | ||
| int | in_stream_channels, | ||
| int | out_stream_channels, | ||
| int | in_channel, | ||
| int | out_channel, | ||
| double | scale ) |
Definition at line 423 of file utils.cpp.
References audio_desc::bps, format_from_in_bps(), and format_to_out_bps().
Referenced by filter().

| void remux_channel | ( | char * | out, |
| const char * | in, | ||
| int | bps, | ||
| int | in_len, | ||
| int | in_stream_channels, | ||
| int | out_stream_channels, | ||
| int | pos_in_stream, | ||
| int | pos_out_stream ) |
Definition at line 352 of file utils.cpp.
References audio_desc::bps.
Referenced by audio_tx_send_standard(), and vidcap_state_aja::grab().
| void signed2unsigned | ( | char * | out, |
| const char * | in, | ||
| int | in_len ) |
Converts int8_t samples to uint8_t by adding 128 (standard shifted zero unsigned samples).
Works also in the opposite direction!
Can be used in situ.
Definition at line 515 of file utils.cpp.
Referenced by audio_cap_alsa_read(), libavcodec_compress(), libavcodec_decompress(), wav_read(), wav_writer_write(), and write_samples().