libmpcdec: src/mpc_decoder.c File Reference

Main Page | Class List | Directories | File List | Class Members | File Members | Related Pages

# mpc_decoder.c File Reference

`#include <mpcdec/mpcdec.h>`
`#include <mpcdec/internal.h>`
`#include <mpcdec/requant.h>`
`#include <mpcdec/huffman.h>`

Go to the source code of this file.

## Defines

#define | MPC_MULTIPLY_SCF(CcVal, SCF_idx) MPC_MULTIPLY(CcVal, d->SCF[SCF_idx])

## Enumerations

enum | { EQ_TAP = 13, DELAY = ((EQ_TAP + 1) / 2), FIR_BANDS = 4, MEMSIZE = MPC_DECODER_MEMSIZE, MEMSIZE2 = (MEMSIZE/2), MEMMASK = (MEMSIZE-1) }

## Functions

void | mpc_decoder_init_huffman_sv6 (mpc_decoder *d)
| Initializes sv6 huffman decoding structures.
void | mpc_decoder_init_huffman_sv7 (mpc_decoder *d)
| Initializes sv7 huffman decoding structures.
void | mpc_decoder_read_bitstream_sv6 (mpc_decoder *d)
void | mpc_decoder_read_bitstream_sv7 (mpc_decoder *d)
void | mpc_decoder_update_buffer (mpc_decoder *d, mpc_uint32_t RING)
mpc_bool_t | mpc_decoder_seek_sample (mpc_decoder *d, mpc_int64_t destsample)
void | mpc_decoder_requantisierung (mpc_decoder *d, const mpc_int32_t Last_Band)
void | mpc_decoder_resort_huff_tables (const mpc_uint32_t elements, HuffmanTyp *Table, const mpc_int32_t offset)
| Sorts huffman-tables by codeword.
mpc_uint32_t | mpc_decoder_decode_frame (mpc_decoder *d, mpc_uint32_t *in_buffer, mpc_uint32_t in_len, MPC_SAMPLE_FORMAT *out_buffer)
mpc_uint32_t | mpc_decoder_decode (mpc_decoder *d, MPC_SAMPLE_FORMAT *buffer, mpc_uint32_t *vbr_update_acc, mpc_uint32_t *vbr_update_bits)
void | mpc_decoder_setup (mpc_decoder *d, mpc_reader *r)
void | mpc_decoder_set_streaminfo (mpc_decoder *d, mpc_streaminfo *si)
mpc_bool_t | mpc_decoder_initialize (mpc_decoder *d, mpc_streaminfo *si)
mpc_bool_t | mpc_decoder_seek_seconds (mpc_decoder *d, double seconds)
| Seeks to specified position in seconds in the source stream.

## Detailed Description

Core decoding routines and logic.

Definition in file mpc_decoder.c.

## Function Documentation

mpc_uint32_t mpc_decoder_decode | ( | mpc_decoder * | d,
|  | MPC_SAMPLE_FORMAT * | buffer,
|  | mpc_uint32_t * | vbr_update_acc,
|  | mpc_uint32_t * | vbr_update_bits
| ) |

Actually reads data from previously initialized stream. Call this iteratively to decode the mpc stream.

Parameters:

  | buffer | destination buffer for decoded samples
  | vbr_update_acc\xrefitem | todo 1

Definition at line 453 of file mpc_decoder.c.

References mpc_decoder_t::FrameWasValid, mpc_decoder_update_buffer(), mpc_decoder_t::pos, and mpc_decoder_t::Zaehler.

mpc_bool_t mpc_decoder_initialize | ( | mpc_decoder * | d,
|  | mpc_streaminfo * | si
| ) |

Initializes mpc decoder with the supplied stream info parameters. Call this next after calling mpc_decoder_setup.

Parameters:

  | si | streaminfo structure indicating format of source stream

Returns:
  TRUE if decoder was initalized successfully, FALSE otherwise

Definition at line 1225 of file mpc_decoder.c.

References mpc_decoder_t::dword, mpc_decoder_set_streaminfo(), mpc_decoder_t::MPCHeaderPos, mpc_decoder_t::pos, mpc_decoder_t::Speicher, mpc_decoder_t::StreamVersion, and mpc_decoder_t::Zaehler.

void mpc_decoder_resort_huff_tables | ( | const mpc_uint32_t | elements,
|  | HuffmanTyp * | Table,
|  | const mpc_int32_t | offset
| ) |

Sorts huffman-tables by codeword.

offset resulting value.

Parameters:

  | elements |
  | Table | table to sort
  | offset | offset of resulting sort

Definition at line 187 of file mpc_decoder.c.

References huffman_type_t::Code, huffman_type_t::Length, and huffman_type_t::Value.

Referenced by mpc_decoder_init_huffman_sv6(), and mpc_decoder_init_huffman_sv7().

void mpc_decoder_setup | ( | mpc_decoder * | d,
|  | mpc_reader * | r
| ) |

Sets up decoder library. Call this first when preparing to decode an mpc stream.

Parameters:

  | r | reader that will supply raw data to the decoder

Definition at line 1139 of file mpc_decoder.c.

References mpc_decoder_t::__r1, mpc_decoder_t::__r2, mpc_decoder_t::ActDecodePos, mpc_decoder_t::DecodedFrames, mpc_decoder_t::dword, mpc_decoder_t::Entropie_1, mpc_decoder_t::Entropie_2, mpc_decoder_t::Entropie_3, mpc_decoder_t::Entropie_4, mpc_decoder_t::Entropie_5, mpc_decoder_t::Entropie_6, mpc_decoder_t::Entropie_7, mpc_decoder_t::EQ_activated, mpc_decoder_t::FrameWasValid, mpc_decoder_t::FwdJumpInfo, mpc_decoder_t::HuffQ, mpc_decoder_t::HuffQ1, mpc_decoder_t::HuffQ2, mpc_decoder_t::HuffQ3, mpc_decoder_t::HuffQ4, mpc_decoder_t::HuffQ5, mpc_decoder_t::HuffQ6, mpc_decoder_t::HuffQ7, mpc_decoder_t::LastValidSamples, mpc_decoder_t::Max_Band, mpc_decoder_init_huffman_sv6(), mpc_decoder_init_huffman_sv7(), mpc_decoder_initialisiere_quantisierungstabellen(), mpc_decoder_t::MPCHeaderPos, mpc_decoder_t::MS_used, mpc_decoder_t::OverallFrames, mpc_decoder_t::pos, mpc_decoder_t::r, mpc_decoder_t::SampleHuff, mpc_decoder_t::SampleRate, mpc_decoder_t::StreamVersion, mpc_decoder_t::TrueGaplessPresent, mpc_decoder_t::WordsRead, and mpc_decoder_t::Zaehler.