FFmpeg
|
MLP decoder. More...
#include <stdint.h>
#include "avcodec.h"
#include "libavutil/internal.h"
#include "libavutil/intreadwrite.h"
#include "libavutil/channel_layout.h"
#include "get_bits.h"
#include "internal.h"
#include "libavutil/crc.h"
#include "parser.h"
#include "mlp_parser.h"
#include "mlpdsp.h"
#include "mlp.h"
#include "config.h"
Go to the source code of this file.
Data Structures | |
struct | SubStream |
struct | MLPDecodeContext |
Macros | |
#define | VLC_BITS 9 |
number of bits used for VLC lookup - longest Huffman code is 9 | |
#define | VLC_STATIC_SIZE 512 |
#define | MSB_MASK(bits) (-1u << (bits)) |
#define | PARAM_BLOCKSIZE (1 << 7) |
#define | PARAM_MATRIX (1 << 6) |
#define | PARAM_OUTSHIFT (1 << 5) |
#define | PARAM_QUANTSTEP (1 << 4) |
#define | PARAM_FIR (1 << 3) |
#define | PARAM_IIR (1 << 2) |
#define | PARAM_HUFFOFFSET (1 << 1) |
#define | PARAM_PRESENCE (1 << 0) |
Functions | |
static uint64_t | thd_channel_layout_extract_channel (uint64_t channel_layout, int index) |
static av_cold void | init_static (void) |
Initialize static data, constant between all invocations of the codec. | |
static int32_t | calculate_sign_huff (MLPDecodeContext *m, unsigned int substr, unsigned int ch) |
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. | |
static av_cold int | mlp_decode_init (AVCodecContext *avctx) |
static int | read_major_sync (MLPDecodeContext *m, GetBitContext *gb) |
Read a major sync info header - contains high level information about the stream - sample rate, channel arrangement etc. | |
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. | |
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. | |
static int | read_matrix_params (MLPDecodeContext *m, unsigned int substr, GetBitContext *gbp) |
Read parameters for primitive matrices. | |
static int | read_channel_params (MLPDecodeContext *m, unsigned int substr, GetBitContext *gbp, unsigned int ch) |
Read channel parameters. | |
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. | |
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, and update the filter state. | |
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). | |
static void | generate_2_noise_channels (MLPDecodeContext *m, unsigned int substr) |
Noise generation functions. | |
static void | fill_noise_buffer (MLPDecodeContext *m, unsigned int substr) |
Generate a block of noise, used when restart sync word == 0x31eb. | |
static void | rematrix_channels (MLPDecodeContext *m, unsigned int substr) |
Apply the channel matrices in turn to reconstruct the original audio samples. | |
static int | output_data (MLPDecodeContext *m, unsigned int substr, AVFrame *frame, int *got_frame_ptr) |
Write the audio data into the output buffer. | |
static int | read_access_unit (AVCodecContext *avctx, void *data, int *got_frame_ptr, AVPacket *avpkt) |
Read an access unit from the stream. | |
Variables | |
static const uint64_t | thd_channel_order [] |
static VLC | huff_vlc [3] |
static const int8_t | noise_table [256] |
Data table used for TrueHD noise generation function. | |
MLP decoder.
Definition in file mlpdec.c.
#define VLC_BITS 9 |
number of bits used for VLC lookup - longest Huffman code is 9
Definition at line 47 of file mlpdec.c.
Referenced by init_static(), and read_huff_channels().
#define VLC_STATIC_SIZE 512 |
Definition at line 48 of file mlpdec.c.
Referenced by init_static().
#define PARAM_BLOCKSIZE (1 << 7) |
Definition at line 86 of file mlpdec.c.
Referenced by read_decoding_params().
#define PARAM_MATRIX (1 << 6) |
Definition at line 87 of file mlpdec.c.
Referenced by read_decoding_params().
#define PARAM_OUTSHIFT (1 << 5) |
Definition at line 88 of file mlpdec.c.
Referenced by read_decoding_params().
#define PARAM_QUANTSTEP (1 << 4) |
Definition at line 89 of file mlpdec.c.
Referenced by read_decoding_params().
#define PARAM_FIR (1 << 3) |
Definition at line 90 of file mlpdec.c.
Referenced by read_channel_params().
#define PARAM_IIR (1 << 2) |
Definition at line 91 of file mlpdec.c.
Referenced by read_channel_params().
#define PARAM_HUFFOFFSET (1 << 1) |
Definition at line 92 of file mlpdec.c.
Referenced by read_channel_params().
#define PARAM_PRESENCE (1 << 0) |
Definition at line 93 of file mlpdec.c.
Referenced by read_decoding_params().
#define MSB_MASK | ( | bits | ) | (-1u << (bits)) |
Definition at line 896 of file mlpdec.c.
Referenced by filter_channel(), and rematrix_channels().
|
static |
Definition at line 180 of file mlpdec.c.
Referenced by read_restart_header().
Initialize static data, constant between all invocations of the codec.
Definition at line 198 of file mlpdec.c.
Referenced by mlp_decode_init().
|
inlinestatic |
Definition at line 215 of file mlpdec.c.
Referenced by read_channel_params(), and read_decoding_params().
|
inlinestatic |
Read a sample, consisting of either, both or neither of entropy-coded MSBs and plain LSBs.
Definition at line 236 of file mlpdec.c.
Referenced by read_block_data().
|
static |
|
static |
Read a major sync info header - contains high level information about the stream - sample rate, channel arrangement etc.
Most of this information is not actually necessary for decoding, only for playback.
Definition at line 291 of file mlpdec.c.
Referenced by read_access_unit().
|
static |
Read a restart header from a block in a substream.
This contains parameters required to decode the audio that do not change very often. Generally (always) present only in blocks following a major sync.
Definition at line 461 of file mlpdec.c.
Referenced by read_access_unit().
|
static |
Read parameters for one of the prediction filters.
Definition at line 644 of file mlpdec.c.
Referenced by read_channel_params().
|
static |
Read parameters for primitive matrices.
Definition at line 719 of file mlpdec.c.
Referenced by read_decoding_params().
|
static |
Read channel parameters.
Definition at line 782 of file mlpdec.c.
Referenced by read_decoding_params().
|
static |
Read decoding parameters that change more often than those in the restart header.
Definition at line 841 of file mlpdec.c.
Referenced by read_access_unit().
|
static |
Generate PCM samples using the prediction filters and residual values read from the data stream, and update the filter state.
Definition at line 901 of file mlpdec.c.
Referenced by read_block_data().
|
static |
Read a block of PCM residual data (or actual if no filtering active).
Definition at line 928 of file mlpdec.c.
Referenced by read_access_unit().
|
static |
Noise generation functions.
I'm not sure what these are for - they seem to be some kind of pseudorandom sequence generators, used to generate noise data which is used when the channels are rematrixed. I'm not sure if they provide a practical benefit to compression, or just obfuscate the decoder. Are they for some kind of dithering? Generate two channels of noise, used in the matrix when restart sync word == 0x31ea.
Definition at line 999 of file mlpdec.c.
Referenced by rematrix_channels().
|
static |
Generate a block of noise, used when restart sync word == 0x31eb.
Definition at line 1019 of file mlpdec.c.
Referenced by rematrix_channels().
|
static |
Apply the channel matrices in turn to reconstruct the original audio samples.
Definition at line 1038 of file mlpdec.c.
Referenced by read_access_unit().
|
static |
Write the audio data into the output buffer.
Definition at line 1070 of file mlpdec.c.
Referenced by read_access_unit().
|
static |
|
static |
Definition at line 164 of file mlpdec.c.
Referenced by thd_channel_layout_extract_channel().
|
static |
Data table used for TrueHD noise generation function.
Definition at line 970 of file mlpdec.c.
Referenced by fill_noise_buffer(), and main().