FFmpeg
Data Structures | Macros | Functions | Variables
takdec.c File Reference
#include "libavutil/internal.h"
#include "libavutil/mem_internal.h"
#include "libavutil/samplefmt.h"
#include "audiodsp.h"
#include "thread.h"
#include "avcodec.h"
#include "internal.h"
#include "unary.h"
#include "tak.h"
#include "takdsp.h"

Go to the source code of this file.

Data Structures

struct  MCDParam
 
struct  TAKDecContext
 
struct  CParam
 

Macros

#define BITSTREAM_READER_LE
 
#define MAX_SUBFRAMES   8
 max number of subframes per channel More...
 
#define MAX_PREDICTORS   256
 

Functions

static int set_bps_params (AVCodecContext *avctx)
 
static void set_sample_rate_params (AVCodecContext *avctx)
 
static av_cold int tak_decode_init (AVCodecContext *avctx)
 
static void decode_lpc (int32_t *coeffs, int mode, int length)
 
static int decode_segment (TAKDecContext *s, int8_t mode, int32_t *decoded, int len)
 
static int decode_residues (TAKDecContext *s, int32_t *decoded, int length)
 
static int get_bits_esc4 (GetBitContext *gb)
 
static int decode_subframe (TAKDecContext *s, int32_t *decoded, int subframe_size, int prev_subframe_size)
 
static int decode_channel (TAKDecContext *s, int chan)
 
static int decorrelate (TAKDecContext *s, int c1, int c2, int length)
 
static int tak_decode_frame (AVCodecContext *avctx, void *data, int *got_frame_ptr, AVPacket *pkt)
 
static av_cold int tak_decode_close (AVCodecContext *avctx)
 

Variables

static const int8_t mc_dmodes [] = { 1, 3, 4, 6, }
 
static const uint16_t predictor_sizes []
 
static const struct CParam xcodes [50]
 
const AVCodec ff_tak_decoder
 

Detailed Description

TAK (Tom's lossless Audio Kompressor) decoder

Author
Paul B Mahol

Definition in file takdec.c.

Macro Definition Documentation

◆ BITSTREAM_READER_LE

#define BITSTREAM_READER_LE

Definition at line 32 of file takdec.c.

◆ MAX_SUBFRAMES

#define MAX_SUBFRAMES   8

max number of subframes per channel

Definition at line 41 of file takdec.c.

◆ MAX_PREDICTORS

#define MAX_PREDICTORS   256

Definition at line 42 of file takdec.c.

Function Documentation

◆ set_bps_params()

static int set_bps_params ( AVCodecContext avctx)
static

Definition at line 145 of file takdec.c.

Referenced by tak_decode_frame(), and tak_decode_init().

◆ set_sample_rate_params()

static void set_sample_rate_params ( AVCodecContext avctx)
static

Definition at line 166 of file takdec.c.

Referenced by tak_decode_frame(), and tak_decode_init().

◆ tak_decode_init()

static av_cold int tak_decode_init ( AVCodecContext avctx)
static

Definition at line 184 of file takdec.c.

◆ decode_lpc()

static void decode_lpc ( int32_t coeffs,
int  mode,
int  length 
)
static

Definition at line 199 of file takdec.c.

Referenced by decode_subframe(), and tak_decode_frame().

◆ decode_segment()

static int decode_segment ( TAKDecContext s,
int8_t  mode,
int32_t decoded,
int  len 
)
static

Definition at line 255 of file takdec.c.

Referenced by decode_residues().

◆ decode_residues()

static int decode_residues ( TAKDecContext s,
int32_t decoded,
int  length 
)
static

Definition at line 299 of file takdec.c.

Referenced by decode_subframe().

◆ get_bits_esc4()

static int get_bits_esc4 ( GetBitContext gb)
static

Definition at line 378 of file takdec.c.

Referenced by decode_channel(), decode_subframe(), and decorrelate().

◆ decode_subframe()

static int decode_subframe ( TAKDecContext s,
int32_t decoded,
int  subframe_size,
int  prev_subframe_size 
)
static

Definition at line 386 of file takdec.c.

Referenced by decode_channel().

◆ decode_channel()

static int decode_channel ( TAKDecContext s,
int  chan 
)
static

Definition at line 510 of file takdec.c.

Referenced by tak_decode_frame().

◆ decorrelate()

static int decorrelate ( TAKDecContext s,
int  c1,
int  c2,
int  length 
)
static

Definition at line 557 of file takdec.c.

Referenced by tak_decode_frame().

◆ tak_decode_frame()

static int tak_decode_frame ( AVCodecContext avctx,
void *  data,
int got_frame_ptr,
AVPacket pkt 
)
static

Definition at line 677 of file takdec.c.

◆ tak_decode_close()

static av_cold int tak_decode_close ( AVCodecContext avctx)
static

Definition at line 932 of file takdec.c.

Variable Documentation

◆ mc_dmodes

const int8_t mc_dmodes[] = { 1, 3, 4, 6, }
static

Definition at line 80 of file takdec.c.

Referenced by tak_decode_frame().

◆ predictor_sizes

const uint16_t predictor_sizes[]
static
Initial value:
= {
4, 8, 12, 16, 24, 32, 48, 64, 80, 96, 128, 160, 192, 224, 256, 0,
}

Definition at line 82 of file takdec.c.

Referenced by decode_subframe().

◆ xcodes

const struct CParam xcodes[50]
static

Referenced by decode_segment().

◆ ff_tak_decoder

const AVCodec ff_tak_decoder
Initial value:

Definition at line 941 of file takdec.c.

FF_CODEC_CAP_INIT_THREADSAFE
#define FF_CODEC_CAP_INIT_THREADSAFE
The codec does not modify any global variables in the init function, allowing to call the init functi...
Definition: internal.h:42
AV_SAMPLE_FMT_S32P
@ AV_SAMPLE_FMT_S32P
signed 32 bits, planar
Definition: samplefmt.h:68
tak_decode_close
static av_cold int tak_decode_close(AVCodecContext *avctx)
Definition: takdec.c:932
init
static int init
Definition: av_tx.c:47
tak_decode_init
static av_cold int tak_decode_init(AVCodecContext *avctx)
Definition: takdec.c:184
decode
static void decode(AVCodecContext *dec_ctx, AVPacket *pkt, AVFrame *frame, FILE *outfile)
Definition: decode_audio.c:71
AVMEDIA_TYPE_AUDIO
@ AVMEDIA_TYPE_AUDIO
Definition: avutil.h:202
AV_CODEC_CAP_FRAME_THREADS
#define AV_CODEC_CAP_FRAME_THREADS
Codec supports frame-level multithreading.
Definition: codec.h:113
ONLY_IF_THREADS_ENABLED
#define ONLY_IF_THREADS_ENABLED(x)
Define a function with only the non-default version specified.
Definition: internal.h:156
AV_CODEC_CAP_CHANNEL_CONF
#define AV_CODEC_CAP_CHANNEL_CONF
Codec should fill in channel configuration and samplerate instead of container.
Definition: codec.h:109
TAKDecContext
Definition: takdec.c:51
AV_CODEC_CAP_DR1
#define AV_CODEC_CAP_DR1
Codec uses get_buffer() or get_encode_buffer() for allocating buffers and supports custom allocators.
Definition: codec.h:52
NULL_IF_CONFIG_SMALL
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
Definition: internal.h:117
AV_SAMPLE_FMT_U8P
@ AV_SAMPLE_FMT_U8P
unsigned 8 bits, planar
Definition: samplefmt.h:66
AV_SAMPLE_FMT_NONE
@ AV_SAMPLE_FMT_NONE
Definition: samplefmt.h:59
AV_SAMPLE_FMT_S16P
@ AV_SAMPLE_FMT_S16P
signed 16 bits, planar
Definition: samplefmt.h:67
AVSampleFormat
AVSampleFormat
Audio sample formats.
Definition: samplefmt.h:58
tak_decode_frame
static int tak_decode_frame(AVCodecContext *avctx, void *data, int *got_frame_ptr, AVPacket *pkt)
Definition: takdec.c:677
update_thread_context
the pkt_dts and pkt_pts fields in AVFrame will work as usual Restrictions on codec whose streams don t reset across will not work because their bitstreams cannot be decoded in parallel *The contents of buffers must not be read before as well as code calling up to before the decode process starts Call have update_thread_context() run it in the next thread. Add AV_CODEC_CAP_FRAME_THREADS to the codec capabilities. There will be very little speed gain at this point but it should work. If there are inter-frame dependencies
AV_CODEC_ID_TAK
@ AV_CODEC_ID_TAK
Definition: codec_id.h:485