Libav
Data Structures | Macros | Functions | Variables
tta.c File Reference

TTA (The Lossless True Audio) decoder. More...

#include <limits.h>
#include "libavutil/crc.h"
#include "avcodec.h"
#include "get_bits.h"
#include "internal.h"

Go to the source code of this file.

Data Structures

struct  TTAFilter
 
struct  TTARice
 
struct  TTAChannel
 
struct  TTAContext
 

Macros

#define BITSTREAM_READER_LE
 
#define FORMAT_SIMPLE   1
 
#define FORMAT_ENCRYPTED   2
 
#define MAX_ORDER   16
 
#define PRED(x, k)   (int32_t)((((uint64_t)x << k) - x) >> k)
 

Functions

static void ttafilter_init (TTAFilter *c, int32_t shift)
 
static void memshl (register int32_t *a, register int32_t *b)
 
static void ttafilter_process (TTAFilter *c, int32_t *in)
 
static void rice_init (TTARice *c, uint32_t k0, uint32_t k1)
 
static int tta_get_unary (GetBitContext *gb)
 
static int tta_check_crc (TTAContext *s, const uint8_t *buf, int buf_size)
 
static av_cold int tta_decode_init (AVCodecContext *avctx)
 
static int tta_decode_frame (AVCodecContext *avctx, void *data, int *got_frame_ptr, AVPacket *avpkt)
 
static av_cold int tta_decode_close (AVCodecContext *avctx)
 

Variables

static const uint32_t shift_1 []
 
static const uint32_t *const shift_16 = shift_1 + 4
 
static const int32_t ttafilter_configs [4]
 
AVCodec ff_tta_decoder
 

Detailed Description

TTA (The Lossless True Audio) decoder.

See also
http://www.true-audio.com/
http://tta.corecodec.org/
Author
Alex Beregszaszi

Definition in file tta.c.

Macro Definition Documentation

◆ BITSTREAM_READER_LE

#define BITSTREAM_READER_LE

Definition at line 34 of file tta.c.

◆ FORMAT_SIMPLE

#define FORMAT_SIMPLE   1

Definition at line 39 of file tta.c.

◆ FORMAT_ENCRYPTED

#define FORMAT_ENCRYPTED   2

Definition at line 40 of file tta.c.

Referenced by tta_decode_init().

◆ MAX_ORDER

#define MAX_ORDER   16

Definition at line 42 of file tta.c.

◆ PRED

#define PRED (   x,
 
)    (int32_t)((((uint64_t)x << k) - x) >> k)

Referenced by tta_decode_frame().

Function Documentation

◆ ttafilter_init()

static void ttafilter_init ( TTAFilter c,
int32_t  shift 
)
static

Definition at line 96 of file tta.c.

Referenced by tta_decode_frame().

◆ memshl()

static void memshl ( register int32_t a,
register int32_t b 
)
inlinestatic

Definition at line 104 of file tta.c.

Referenced by ttafilter_process().

◆ ttafilter_process()

static void ttafilter_process ( TTAFilter c,
int32_t in 
)
inlinestatic

Definition at line 115 of file tta.c.

Referenced by tta_decode_frame().

◆ rice_init()

static void rice_init ( TTARice c,
uint32_t  k0,
uint32_t  k1 
)
static

Definition at line 166 of file tta.c.

Referenced by tta_decode_frame().

◆ tta_get_unary()

static int tta_get_unary ( GetBitContext gb)
static

Definition at line 174 of file tta.c.

Referenced by tta_decode_frame().

◆ tta_check_crc()

static int tta_check_crc ( TTAContext s,
const uint8_t buf,
int  buf_size 
)
static

Definition at line 184 of file tta.c.

Referenced by tta_decode_frame(), and tta_decode_init().

◆ tta_decode_init()

static av_cold int tta_decode_init ( AVCodecContext avctx)
static

Definition at line 198 of file tta.c.

◆ tta_decode_frame()

static int tta_decode_frame ( AVCodecContext avctx,
void data,
int *  got_frame_ptr,
AVPacket avpkt 
)
static

Definition at line 310 of file tta.c.

◆ tta_decode_close()

static av_cold int tta_decode_close ( AVCodecContext avctx)
static

Definition at line 464 of file tta.c.

Variable Documentation

◆ shift_1

const uint32_t shift_1[]
static
Initial value:
= {
0x00000001, 0x00000002, 0x00000004, 0x00000008,
0x00000010, 0x00000020, 0x00000040, 0x00000080,
0x00000100, 0x00000200, 0x00000400, 0x00000800,
0x00001000, 0x00002000, 0x00004000, 0x00008000,
0x00010000, 0x00020000, 0x00040000, 0x00080000,
0x00100000, 0x00200000, 0x00400000, 0x00800000,
0x01000000, 0x02000000, 0x04000000, 0x08000000,
0x10000000, 0x20000000, 0x40000000, 0x80000000,
0x80000000, 0x80000000, 0x80000000, 0x80000000,
0x80000000, 0x80000000, 0x80000000, 0x80000000
}

Definition at line 74 of file tta.c.

Referenced by tta_decode_frame(), and ttafilter_init().

◆ shift_16

const uint32_t* const shift_16 = shift_1 + 4
static

Definition at line 87 of file tta.c.

Referenced by rice_init(), and tta_decode_frame().

◆ ttafilter_configs

const int32_t ttafilter_configs[4]
static
Initial value:
= {
10,
9,
10,
12
}

Definition at line 89 of file tta.c.

Referenced by tta_decode_frame().

◆ ff_tta_decoder

AVCodec ff_tta_decoder
Initial value:
= {
.name = "tta",
.long_name = NULL_IF_CONFIG_SMALL("TTA (True Audio)"),
.priv_data_size = sizeof(TTAContext),
.close = tta_decode_close,
.capabilities = AV_CODEC_CAP_DR1,
}
static av_cold int tta_decode_init(AVCodecContext *avctx)
Definition: tta.c:198
static int tta_decode_frame(AVCodecContext *avctx, void *data, int *got_frame_ptr, AVPacket *avpkt)
Definition: tta.c:310
Definition: tta.c:60
static av_cold int tta_decode_close(AVCodecContext *avctx)
Definition: tta.c:464
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
Definition: internal.h:148
static int decode(AVCodecContext *avctx, AVFrame *frame, int *got_frame, AVPacket *pkt)
Definition: avconv.c:1288
static av_cold int init(AVCodecParserContext *s)
Definition: h264_parser.c:582
#define AV_CODEC_CAP_DR1
Codec uses get_buffer() for allocating buffers and supports custom allocators.
Definition: avcodec.h:838

Definition at line 473 of file tta.c.