FFmpeg
|
mlpdec.c
Go to the documentation of this file.
378 if (m->avctx->channels<=2 && m->substream[substr].ch_layout == AV_CH_LAYOUT_MONO && m->max_decoded_substream == 1) {
static unsigned int show_bits_long(GetBitContext *s, int n)
Show 0-32 bits.
Definition: get_bits.h:352
Definition: libavcodec/avcodec.h:410
struct SubStream SubStream
static int read_decoding_params(MLPDecodeContext *m, GetBitContext *gbp, unsigned int substr)
Read decoding parameters that change more often than those in the restart header. ...
Definition: mlpdec.c:769
uint8_t param_presence_flags
Bitmask of which parameter sets are conveyed in a decoding parameter block.
Definition: mlpdec.c:75
static void generate_2_noise_channels(MLPDecodeContext *m, unsigned int substr)
Noise generation functions.
Definition: mlpdec.c:921
uint8_t params_valid
Set if a valid major sync block has been read. Otherwise no decoding is possible. ...
Definition: mlpdec.c:126
struct MLPDecodeContext MLPDecodeContext
const uint8_t ff_mlp_huffman_tables[3][18][2]
Tables defining the Huffman codes.
Definition: mlp.c:28
int8_t output_shift[MAX_CHANNELS]
Left shift to apply to decoded PCM values to get final 24-bit output.
Definition: mlpdec.c:112
int bits_per_raw_sample
Bits per sample/pixel of internal libavcodec pixel/sample format.
Definition: libavcodec/avcodec.h:2553
initialize output if(nPeaks >3)%at least 3 peaks in spectrum for trying to find f0 nf0peaks
int32_t matrix_coeff[MAX_MATRICES][MAX_CHANNELS]
Matrix coefficients, stored as 2.14 fixed point.
Definition: mlpdec.c:98
void void avpriv_request_sample(void *avc, const char *msg,...) av_printf_format(2
Log a generic warning message about a missing feature.
#define INIT_VLC_STATIC(vlc, bits, a, b, c, d, e, f, g, static_size)
Definition: get_bits.h:445
uint8_t ch_assign[MAX_CHANNELS]
For each channel output by the matrix, the output channel to map it to.
Definition: mlpdec.c:59
Definition: mlp_parser.h:32
#define CODEC_CAP_DR1
Codec uses get_buffer() for allocating buffers and supports custom allocators.
Definition: libavcodec/avcodec.h:743
the mask is usually to keep the same permissions Filters should remove permissions on reference they give to output whenever necessary It can be automatically done by setting the rej_perms field on the output pad Here are a few guidelines corresponding to common then the filter should push the output frames on the output link immediately As an exception to the previous rule if the input frame is enough to produce several output frames then the filter needs output only at least one per link The additional frames can be left buffered in the filter
Definition: filter_design.txt:201
static void fill_noise_buffer(MLPDecodeContext *m, unsigned int substr)
Generate a block of noise, used when restart sync word == 0x31eb.
Definition: mlpdec.c:941
int av_get_channel_layout_channel_index(uint64_t channel_layout, uint64_t channel)
Get the index of a channel in channel_layout.
Definition: channel_layout.c:204
uint8_t restart_seen
Set if a valid restart header has been read. Otherwise the substream cannot be decoded.
Definition: mlpdec.c:45
bitstream reader API header.
static int read_filter_params(MLPDecodeContext *m, GetBitContext *gbp, unsigned int substr, unsigned int channel, unsigned int filter)
Read parameters for one of the prediction filters.
Definition: mlpdec.c:572
static int read_restart_header(MLPDecodeContext *m, GetBitContext *gbp, const uint8_t *buf, unsigned int substr)
Read a restart header from a block in a substream.
Definition: mlpdec.c:395
static int read_matrix_params(MLPDecodeContext *m, unsigned int substr, GetBitContext *gbp)
Read parameters for primitive matrices.
Definition: mlpdec.c:647
static int read_access_unit(AVCodecContext *avctx, void *data, int *got_frame_ptr, AVPacket *avpkt)
Read an access unit from the stream.
Definition: mlpdec.c:1053
Definition: libavcodec/avcodec.h:426
uint8_t ff_mlp_calculate_parity(const uint8_t *buf, unsigned int buf_size)
XOR together all the bytes of a buffer.
Definition: mlp.c:99
ChannelParams channel_params[MAX_CHANNELS]
Channel coding parameters for channels in the substream.
Definition: mlpdec.c:64
static uint64_t thd_channel_layout_extract_channel(uint64_t channel_layout, int index)
Definition: mlpdec.c:170
uint8_t needs_reordering
Stream needs channel reordering to comply with FFmpeg's channel order.
Definition: mlpdec.c:135
int8_t bypassed_lsbs[MAX_BLOCKSIZE][MAX_CHANNELS]
Definition: mlpdec.c:148
static const struct endianess table[]
uint8_t quant_step_size[MAX_CHANNELS]
Left shift to apply to Huffman-decoded residuals.
Definition: mlpdec.c:104
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
Definition: libavutil/internal.h:123
int av_get_channel_layout_nb_channels(uint64_t channel_layout)
Return the number of channels in the channel layout.
Definition: channel_layout.c:191
Definition: avutil.h:144
external API header
Definition: get_bits.h:63
uint8_t max_matrix_channel
The number of channels input into the rematrix stage.
Definition: mlpdec.c:57
audio channel layout utility functions
uint8_t ff_mlp_restart_checksum(const uint8_t *buf, unsigned int bit_size)
Calculate an 8-bit checksum over a restart header – a non-multiple-of-8 number of bits...
Definition: mlp.c:80
Definition: mlpdsp.h:27
void(* mlp_filter_channel)(int32_t *state, const int32_t *coeff, int firorder, int iirorder, unsigned int filter_shift, int32_t mask, int blocksize, int32_t *sample_buffer)
Definition: mlpdsp.h:28
static int read_channel_params(MLPDecodeContext *m, unsigned int substr, GetBitContext *gbp, unsigned int ch)
Read channel parameters.
Definition: mlpdec.c:710
MLP parser prototypes.
static av_always_inline int get_vlc2(GetBitContext *s, VLC_TYPE(*table)[2], int bits, int max_depth)
Parse a vlc code.
Definition: get_bits.h:524
int filter_changed[MAX_CHANNELS][NUM_FILTERS]
Definition: mlpdec.c:145
uint8_t lsb_bypass[MAX_MATRICES]
Whether the LSBs of the matrix output are encoded in the bitstream.
Definition: mlpdec.c:96
static int read_huff_channels(MLPDecodeContext *m, GetBitContext *gbp, unsigned int substr, unsigned int pos)
Read a sample, consisting of either, both or neither of entropy-coded MSBs and plain LSBs...
Definition: mlpdec.c:226
static int32_t calculate_sign_huff(MLPDecodeContext *m, unsigned int substr, unsigned int ch)
Definition: mlpdec.c:205
int frame_size
Number of samples per channel in an audio frame.
Definition: libavcodec/avcodec.h:1881
int access_unit_size_pow2
Next power of two above number of samples per frame.
Definition: mlp_parser.h:51
uint8_t data_check_present
Set if the substream contains extra info to check the size of VLC blocks.
Definition: mlpdec.c:72
#define VLC_BITS
number of bits used for VLC lookup - longest Huffman code is 9
Definition: mlpdec.c:41
int ff_get_buffer(AVCodecContext *avctx, AVFrame *frame, int flags)
Get a buffer for a frame.
Definition: libavcodec/utils.c:823
int32_t sample_buffer[MAX_BLOCKSIZE][MAX_CHANNELS]
Definition: mlpdec.c:149
static void rematrix_channels(MLPDecodeContext *m, unsigned int substr)
Apply the channel matrices in turn to reconstruct the original audio samples.
Definition: mlpdec.c:960
static int read_block_data(MLPDecodeContext *m, GetBitContext *gbp, unsigned int substr)
Read a block of PCM residual data (or actual if no filtering active).
Definition: mlpdec.c:850
static int init_get_bits(GetBitContext *s, const uint8_t *buffer, int bit_size)
Initialize GetBitContext.
Definition: get_bits.h:379
uint8_t max_decoded_substream
Index of the last substream to decode - further substreams are skipped.
Definition: mlpdec.c:132
static const int8_t noise_table[256]
Data table used for TrueHD noise generation function.
Definition: mlpdec.c:892
static int read_major_sync(MLPDecodeContext *m, GetBitContext *gb)
Read a major sync info header - contains high level information about the stream - sample rate...
Definition: mlpdec.c:281
Definition: mlpdec.c:119
static av_cold void init_static(void)
Initialize static data, constant between all invocations of the codec.
Definition: mlpdec.c:188
uint32_t noisegen_seed
The current seed value for the pseudorandom noise generator(s).
Definition: mlpdec.c:69
Definition: get_bits.h:54
common internal api header.
int access_unit_size_pow2
next power of two above the number of samples in each frame
Definition: mlpdec.c:140
uint64_t channel_layout_thd_stream1
Channel layout for substream 1 of TrueHD streams ("6-channel presentation")
Definition: mlp_parser.h:47
uint64_t channel_layout_thd_stream2
Channel layout for substream 2 of TrueHD streams ("8-channel presentation")
Definition: mlp_parser.h:48
int ff_mlp_read_major_sync(void *log, MLPHeaderInfo *mh, GetBitContext *gb)
Read a major sync info header - contains high level information about the stream - sample rate...
Definition: mlp_parser.c:127
Definition: mlpdec.c:43
uint8_t matrix_noise_shift[MAX_MATRICES]
Left shift to apply to noise values in 0x31eb substreams.
Definition: mlpdec.c:100
uint8_t noise_shift
The left shift applied to random noise in 0x31ea substreams.
Definition: mlpdec.c:67
static int output_data(MLPDecodeContext *m, unsigned int substr, AVFrame *frame, int *got_frame_ptr)
Write the audio data into the output buffer.
Definition: mlpdec.c:1005
static void filter_channel(MLPDecodeContext *m, unsigned int substr, unsigned int channel)
Generate PCM samples using the prediction filters and residual values read from the data stream...
Definition: mlpdec.c:823
#define MAX_MATRICES_MLP
Maximum number of matrices used in decoding; most streams have one matrix per output channel...
Definition: mlp.h:41
Filter the word “frame” indicates either a video frame or a group of audio samples
Definition: filter_design.txt:2
static int decode(AVCodecContext *avctx, void *data, int *got_frame, AVPacket *avpkt)
Definition: crystalhd.c:868
uint64_t request_channel_layout
Request decoder to use this channel layout if it can (0 for default)
Definition: libavcodec/avcodec.h:1929
uint8_t ff_mlp_checksum8(const uint8_t *buf, unsigned int buf_size)
MLP uses checksums that seem to be based on the standard CRC algorithm, but are not (in implementatio...
Definition: mlp.c:73
Generated on Mon Nov 18 2024 06:51:57 for FFmpeg by 1.8.11