FFmpeg
Data Structures | Macros | Enumerations | Functions | Variables
wavpack.h File Reference
#include "libavutil/common.h"

Go to the source code of this file.

Data Structures

struct  Decorr
 
struct  WvChannel
 

Macros

#define MAX_TERMS   16
 
#define MAX_TERM   8
 
#define WV_HEADER_SIZE   32
 
#define WV_MONO   0x00000004
 
#define WV_JOINT_STEREO   0x00000010
 
#define WV_CROSS_DECORR   0x00000020
 
#define WV_FLOAT_DATA   0x00000080
 
#define WV_INT32_DATA   0x00000100
 
#define WV_FALSE_STEREO   0x40000000
 
#define WV_DSD_DATA   0x80000000
 
#define WV_HYBRID_MODE   0x00000008
 
#define WV_HYBRID_SHAPE   0x00000008
 
#define WV_HYBRID_BITRATE   0x00000200
 
#define WV_HYBRID_BALANCE   0x00000400
 
#define WV_INITIAL_BLOCK   0x00000800
 
#define WV_FINAL_BLOCK   0x00001000
 
#define WV_MONO_DATA   (WV_MONO | WV_FALSE_STEREO)
 
#define WV_SINGLE_BLOCK   (WV_INITIAL_BLOCK | WV_FINAL_BLOCK)
 
#define WV_FLT_SHIFT_ONES   0x01
 
#define WV_FLT_SHIFT_SAME   0x02
 
#define WV_FLT_SHIFT_SENT   0x04
 
#define WV_FLT_ZERO_SENT   0x08
 
#define WV_FLT_ZERO_SIGN   0x10
 
#define WV_MAX_SAMPLES   150000
 
#define GET_MED(n)   ((c->median[n] >> 4) + 1)
 
#define DEC_MED(n)   c->median[n] -= ((int)(c->median[n] + (128U >> (n)) - 2) / (128 >> (n))) * 2U
 
#define INC_MED(n)   c->median[n] += ((int)(c->median[n] + (128U >> (n)) ) / (128 >> (n))) * 5U
 
#define UPDATE_WEIGHT_CLIP(weight, delta, samples, in)
 

Enumerations

enum  WP_ID_Flags { WP_IDF_MASK = 0x3F, WP_IDF_IGNORE = 0x20, WP_IDF_ODD = 0x40, WP_IDF_LONG = 0x80 }
 
enum  WP_ID {
  WP_ID_DUMMY = 0, WP_ID_ENCINFO, WP_ID_DECTERMS, WP_ID_DECWEIGHTS,
  WP_ID_DECSAMPLES, WP_ID_ENTROPY, WP_ID_HYBRID, WP_ID_SHAPING,
  WP_ID_FLOATINFO, WP_ID_INT32INFO, WP_ID_DATA, WP_ID_CORR,
  WP_ID_EXTRABITS, WP_ID_CHANINFO, WP_ID_DSD_DATA, WP_ID_SAMPLE_RATE = 0x27
}
 

Functions

static av_always_inline int wp_exp2 (int16_t val)
 
static av_always_inline int wp_log2 (uint32_t val)
 

Variables

static const int wv_rates [16]
 
const uint8_t ff_wp_exp2_table [256]
 
const uint8_t ff_wp_log2_table [256]
 

Macro Definition Documentation

#define MAX_TERMS   16

Definition at line 27 of file wavpack.h.

Referenced by wavpack_decode_block(), and wavpack_encode_close().

#define MAX_TERM   8
#define WV_HEADER_SIZE   32
#define WV_MONO   0x00000004

Definition at line 32 of file wavpack.h.

#define WV_JOINT_STEREO   0x00000010

Definition at line 33 of file wavpack.h.

Referenced by wavpack_decode_block(), wavpack_encode_block(), and wv_stereo().

#define WV_CROSS_DECORR   0x00000020

Definition at line 34 of file wavpack.h.

Referenced by recurse_stereo(), wavpack_encode_block(), wavpack_encode_frame(), and wv_stereo().

#define WV_FLOAT_DATA   0x00000080

Definition at line 35 of file wavpack.h.

Referenced by wavpack_decode_block(), wavpack_encode_block(), and wavpack_encode_frame().

#define WV_INT32_DATA   0x00000100

Definition at line 36 of file wavpack.h.

Referenced by scan_int23(), scan_int32(), and wavpack_encode_block().

#define WV_FALSE_STEREO   0x40000000

Definition at line 37 of file wavpack.h.

Referenced by wavpack_decode_block(), and wavpack_encode_block().

#define WV_DSD_DATA   0x80000000

Definition at line 38 of file wavpack.h.

Referenced by wavpack_decode_block(), and wavpack_decode_frame().

#define WV_HYBRID_MODE   0x00000008

Definition at line 40 of file wavpack.h.

Referenced by wavpack_decode_block().

#define WV_HYBRID_SHAPE   0x00000008

Definition at line 41 of file wavpack.h.

#define WV_HYBRID_BITRATE   0x00000200

Definition at line 42 of file wavpack.h.

Referenced by wavpack_decode_block().

#define WV_HYBRID_BALANCE   0x00000400

Definition at line 43 of file wavpack.h.

#define WV_INITIAL_BLOCK   0x00000800

Definition at line 44 of file wavpack.h.

Referenced by wavpack_encode_block().

#define WV_FINAL_BLOCK   0x00001000

Definition at line 45 of file wavpack.h.

Referenced by wavpack_encode_block().

#define WV_MONO_DATA   (WV_MONO | WV_FALSE_STEREO)
#define WV_SINGLE_BLOCK   (WV_INITIAL_BLOCK | WV_FINAL_BLOCK)

Definition at line 49 of file wavpack.h.

Referenced by wavpack_decode_block().

#define WV_FLT_SHIFT_ONES   0x01

Definition at line 51 of file wavpack.h.

Referenced by wv_get_value_float().

#define WV_FLT_SHIFT_SAME   0x02

Definition at line 52 of file wavpack.h.

Referenced by wv_get_value_float().

#define WV_FLT_SHIFT_SENT   0x04

Definition at line 53 of file wavpack.h.

Referenced by wv_get_value_float().

#define WV_FLT_ZERO_SENT   0x08

Definition at line 54 of file wavpack.h.

Referenced by wv_get_value_float().

#define WV_FLT_ZERO_SIGN   0x10

Definition at line 55 of file wavpack.h.

Referenced by wv_get_value_float().

#define WV_MAX_SAMPLES   150000

Definition at line 57 of file wavpack.h.

Referenced by wavpack_decode_frame(), and wavpack_encode_init().

#define GET_MED (   n)    ((c->median[n] >> 4) + 1)

Definition at line 103 of file wavpack.h.

Referenced by scan_word(), wavpack_encode_sample(), and wv_get_value().

#define DEC_MED (   n)    c->median[n] -= ((int)(c->median[n] + (128U >> (n)) - 2) / (128 >> (n))) * 2U

Definition at line 104 of file wavpack.h.

Referenced by scan_word(), wavpack_encode_sample(), and wv_get_value().

#define INC_MED (   n)    c->median[n] += ((int)(c->median[n] + (128U >> (n)) ) / (128 >> (n))) * 5U

Definition at line 105 of file wavpack.h.

Referenced by scan_word(), wavpack_encode_sample(), and wv_get_value().

#define UPDATE_WEIGHT_CLIP (   weight,
  delta,
  samples,
  in 
)
Value:
if ((samples) && (in)) { \
if (((samples) ^ (in)) < 0) { \
(weight) -= (delta); \
if ((weight) < -1024) \
(weight) = -1024; \
} else { \
(weight) += (delta); \
if ((weight) > 1024) \
(weight) = 1024; \
} \
}
float delta
if(ret)
uint8_t pi<< 24) CONV_FUNC_GROUP(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_U8, uint8_t,(*(const uint8_t *) pi-0x80)*(1.0f/(1<< 7))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_U8, uint8_t,(*(const uint8_t *) pi-0x80)*(1.0/(1<< 7))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_S16, int16_t,(*(const int16_t *) pi >> 8)+0x80) CONV_FUNC_GROUP(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_S16, int16_t,*(const int16_t *) pi *(1.0f/(1<< 15))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_S16, int16_t,*(const int16_t *) pi *(1.0/(1<< 15))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_S32, int32_t,(*(const int32_t *) pi >> 24)+0x80) CONV_FUNC_GROUP(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_S32, int32_t,*(const int32_t *) pi *(1.0f/(1U<< 31))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_S32, int32_t,*(const int32_t *) pi *(1.0/(1U<< 31))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_FLT, float, av_clip_uint8(lrintf(*(const float *) pi *(1<< 7))+0x80)) CONV_FUNC_GROUP(AV_SAMPLE_FMT_S16, int16_t, AV_SAMPLE_FMT_FLT, float, av_clip_int16(lrintf(*(const float *) pi *(1<< 15)))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_S32, int32_t, AV_SAMPLE_FMT_FLT, float, av_clipl_int32(llrintf(*(const float *) pi *(1U<< 31)))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_DBL, double, av_clip_uint8(lrint(*(const double *) pi *(1<< 7))+0x80)) CONV_FUNC_GROUP(AV_SAMPLE_FMT_S16, int16_t, AV_SAMPLE_FMT_DBL, double, av_clip_int16(lrint(*(const double *) pi *(1<< 15)))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_S32, int32_t, AV_SAMPLE_FMT_DBL, double, av_clipl_int32(llrint(*(const double *) pi *(1U<< 31))))#define SET_CONV_FUNC_GROUP(ofmt, ifmt) static void set_generic_function(AudioConvert *ac){}void ff_audio_convert_free(AudioConvert **ac){if(!*ac) return;ff_dither_free(&(*ac) ->dc);av_freep(ac);}AudioConvert *ff_audio_convert_alloc(AVAudioResampleContext *avr, enum AVSampleFormat out_fmt, enum AVSampleFormat in_fmt, int channels, int sample_rate, int apply_map){AudioConvert *ac;int in_planar, out_planar;ac=av_mallocz(sizeof(*ac));if(!ac) return NULL;ac->avr=avr;ac->out_fmt=out_fmt;ac->in_fmt=in_fmt;ac->channels=channels;ac->apply_map=apply_map;if(avr->dither_method!=AV_RESAMPLE_DITHER_NONE &&av_get_packed_sample_fmt(out_fmt)==AV_SAMPLE_FMT_S16 &&av_get_bytes_per_sample(in_fmt) > 2){ac->dc=ff_dither_alloc(avr, out_fmt, in_fmt, channels, sample_rate, apply_map);if(!ac->dc){av_free(ac);return NULL;}return ac;}in_planar=ff_sample_fmt_is_planar(in_fmt, channels);out_planar=ff_sample_fmt_is_planar(out_fmt, channels);if(in_planar==out_planar){ac->func_type=CONV_FUNC_TYPE_FLAT;ac->planes=in_planar?ac->channels:1;}else if(in_planar) ac->func_type=CONV_FUNC_TYPE_INTERLEAVE;else ac->func_type=CONV_FUNC_TYPE_DEINTERLEAVE;set_generic_function(ac);if(ARCH_AARCH64) ff_audio_convert_init_aarch64(ac);if(ARCH_ARM) ff_audio_convert_init_arm(ac);if(ARCH_X86) ff_audio_convert_init_x86(ac);return ac;}int ff_audio_convert(AudioConvert *ac, AudioData *out, AudioData *in){int use_generic=1;int len=in->nb_samples;int p;if(ac->dc){av_log(ac->avr, AV_LOG_TRACE,"%d samples - audio_convert: %s to %s (dithered)\n", len, av_get_sample_fmt_name(ac->in_fmt), av_get_sample_fmt_name(ac->out_fmt));return ff_convert_dither(ac-> in
static int weight(int i, int blen, int offset)
Definition: diracdec.c:1561
Filter the word “frame” indicates either a video frame or a group of audio samples

Definition at line 108 of file wavpack.h.

Referenced by decorr_stereo(), decorr_stereo_pass2(), decorr_stereo_quick(), and wv_unpack_stereo().

Enumeration Type Documentation

Enumerator
WP_IDF_MASK 
WP_IDF_IGNORE 
WP_IDF_ODD 
WP_IDF_LONG 

Definition at line 59 of file wavpack.h.

enum WP_ID
Enumerator
WP_ID_DUMMY 
WP_ID_ENCINFO 
WP_ID_DECTERMS 
WP_ID_DECWEIGHTS 
WP_ID_DECSAMPLES 
WP_ID_ENTROPY 
WP_ID_HYBRID 
WP_ID_SHAPING 
WP_ID_FLOATINFO 
WP_ID_INT32INFO 
WP_ID_DATA 
WP_ID_CORR 
WP_ID_EXTRABITS 
WP_ID_CHANINFO 
WP_ID_DSD_DATA 
WP_ID_SAMPLE_RATE 

Definition at line 66 of file wavpack.h.

Function Documentation

static av_always_inline int wp_exp2 ( int16_t  val)
static
static av_always_inline int wp_log2 ( uint32_t  val)
static

Definition at line 147 of file wavpack.h.

Referenced by log2s(), and wv_get_value().

Variable Documentation

const int wv_rates[16]
static
Initial value:
= {
6000, 8000, 9600, 11025, 12000, 16000, 22050, 24000,
32000, 44100, 48000, 64000, 88200, 96000, 192000, 0
}

Definition at line 121 of file wavpack.h.

Referenced by set_samplerate(), and wavpack_decode_block().

const uint8_t ff_wp_exp2_table[256]

Definition at line 24 of file wavpackdata.c.

Referenced by wp_exp2().

const uint8_t ff_wp_log2_table[256]

Definition at line 43 of file wavpackdata.c.

Referenced by log2sample(), and wp_log2().