shorten.c File Reference

Shorten decoder. More...

#include <limits.h>
#include "avcodec.h"
#include "bytestream.h"
#include "get_bits.h"
#include "golomb.h"
#include "internal.h"
Include dependency graph for shorten.c:

Go to the source code of this file.

Data Structures

struct  ShortenContext
 

Macros

#define MAX_CHANNELS   8
 
#define MAX_BLOCKSIZE   65535
 
#define OUT_BUFFER_SIZE   16384
 
#define ULONGSIZE   2
 
#define WAVE_FORMAT_PCM   0x0001
 
#define DEFAULT_BLOCK_SIZE   256
 
#define TYPESIZE   4
 
#define CHANSIZE   0
 
#define LPCQSIZE   2
 
#define ENERGYSIZE   3
 
#define BITSHIFTSIZE   2
 
#define TYPE_S8   1
 
#define TYPE_U8   2
 
#define TYPE_S16HL   3
 
#define TYPE_U16HL   4
 
#define TYPE_S16LH   5
 
#define TYPE_U16LH   6
 
#define NWRAP   3
 
#define NSKIPSIZE   1
 
#define LPCQUANT   5
 
#define V2LPCQOFFSET   (1 << LPCQUANT)
 
#define FNSIZE   2
 
#define FN_DIFF0   0
 
#define FN_DIFF1   1
 
#define FN_DIFF2   2
 
#define FN_DIFF3   3
 
#define FN_QUIT   4
 
#define FN_BLOCKSIZE   5
 
#define FN_BITSHIFT   6
 
#define FN_QLPC   7
 
#define FN_ZERO   8
 
#define FN_VERBATIM   9
 
#define VERBATIM_CKSIZE_SIZE   5
 
#define VERBATIM_BYTE_SIZE   8
 
#define CANONICAL_HEADER_SIZE   44
 

Typedefs

typedef struct ShortenContext ShortenContext
 

Functions

static av_cold int shorten_decode_init (AVCodecContext *avctx)
 
static int allocate_buffers (ShortenContext *s)
 
static unsigned int get_uint (ShortenContext *s, int k)
 
static void fix_bitshift (ShortenContext *s, int32_t *buffer)
 
static int init_offset (ShortenContext *s)
 
static int decode_wave_header (AVCodecContext *avctx, const uint8_t *header, int header_size)
 
static int decode_subframe_lpc (ShortenContext *s, int command, int channel, int residual_size, int32_t coffset)
 
static int read_header (ShortenContext *s)
 
static int shorten_decode_frame (AVCodecContext *avctx, void *data, int *got_frame_ptr, AVPacket *avpkt)
 
static av_cold int shorten_decode_close (AVCodecContext *avctx)
 

Variables

static const uint8_t is_audio_command [10] = { 1, 1, 1, 1, 0, 0, 0, 1, 1, 0 }
 indicates if the FN_* command is audio or non-audio More...
 
static const int fixed_coeffs [3][3]
 
AVCodec ff_shorten_decoder
 

Detailed Description

Shorten decoder.

Author
Jeff Muizelaar

Definition in file shorten.c.

Macro Definition Documentation

#define BITSHIFTSIZE   2

Definition at line 51 of file shorten.c.

Referenced by shorten_decode_frame().

#define CANONICAL_HEADER_SIZE   44

Definition at line 83 of file shorten.c.

Referenced by read_header().

#define CHANSIZE   0

Definition at line 48 of file shorten.c.

Referenced by read_header().

#define DEFAULT_BLOCK_SIZE   256

Definition at line 45 of file shorten.c.

Referenced by read_header().

#define ENERGYSIZE   3

Definition at line 50 of file shorten.c.

Referenced by shorten_decode_frame().

#define FN_BITSHIFT   6

Definition at line 73 of file shorten.c.

Referenced by shorten_decode_frame().

#define FN_BLOCKSIZE   5

Definition at line 72 of file shorten.c.

Referenced by shorten_decode_frame().

#define FN_DIFF0   0

Definition at line 67 of file shorten.c.

#define FN_DIFF1   1

Definition at line 68 of file shorten.c.

#define FN_DIFF2   2

Definition at line 69 of file shorten.c.

#define FN_DIFF3   3

Definition at line 70 of file shorten.c.

#define FN_QLPC   7

Definition at line 74 of file shorten.c.

Referenced by decode_subframe_lpc().

#define FN_QUIT   4

Definition at line 71 of file shorten.c.

Referenced by shorten_decode_frame().

#define FN_VERBATIM   9

Definition at line 76 of file shorten.c.

Referenced by read_header(), and shorten_decode_frame().

#define FN_ZERO   8

Definition at line 75 of file shorten.c.

Referenced by shorten_decode_frame().

#define FNSIZE   2

Definition at line 66 of file shorten.c.

Referenced by read_header(), and shorten_decode_frame().

#define LPCQSIZE   2

Definition at line 49 of file shorten.c.

Referenced by decode_subframe_lpc(), and read_header().

#define LPCQUANT   5

Definition at line 63 of file shorten.c.

Referenced by decode_subframe_lpc().

#define MAX_BLOCKSIZE   65535

Definition at line 37 of file shorten.c.

Referenced by read_header(), and shorten_decode_frame().

#define MAX_CHANNELS   8

Definition at line 36 of file shorten.c.

Referenced by read_header().

#define NSKIPSIZE   1

Definition at line 61 of file shorten.c.

Referenced by read_header().

#define NWRAP   3

Definition at line 60 of file shorten.c.

Referenced by read_header().

#define OUT_BUFFER_SIZE   16384

Definition at line 39 of file shorten.c.

Referenced by read_header().

#define TYPE_S16HL   3

Definition at line 55 of file shorten.c.

Referenced by init_offset(), and shorten_decode_frame().

#define TYPE_S16LH   5

Definition at line 57 of file shorten.c.

Referenced by init_offset(), and shorten_decode_frame().

#define TYPE_S8   1

Definition at line 53 of file shorten.c.

#define TYPE_U16HL   4

Definition at line 56 of file shorten.c.

#define TYPE_U16LH   6

Definition at line 58 of file shorten.c.

#define TYPE_U8   2

Definition at line 54 of file shorten.c.

Referenced by init_offset(), and shorten_decode_frame().

#define TYPESIZE   4

Definition at line 47 of file shorten.c.

Referenced by read_header().

#define ULONGSIZE   2

Definition at line 41 of file shorten.c.

Referenced by get_uint().

#define V2LPCQOFFSET   (1 << LPCQUANT)

Definition at line 64 of file shorten.c.

Referenced by read_header().

#define VERBATIM_BYTE_SIZE   8

Definition at line 82 of file shorten.c.

Referenced by read_header(), and shorten_decode_frame().

#define VERBATIM_CKSIZE_SIZE   5

Definition at line 81 of file shorten.c.

Referenced by read_header(), and shorten_decode_frame().

#define WAVE_FORMAT_PCM   0x0001

Definition at line 43 of file shorten.c.

Referenced by decode_wave_header().

Typedef Documentation

Function Documentation

static int allocate_buffers ( ShortenContext s)
static

Definition at line 123 of file shorten.c.

Referenced by read_header().

static int decode_subframe_lpc ( ShortenContext s,
int  command,
int  channel,
int  residual_size,
int32_t  coffset 
)
static

Definition at line 274 of file shorten.c.

Referenced by shorten_decode_frame().

static int decode_wave_header ( AVCodecContext avctx,
const uint8_t header,
int  header_size 
)
static

Definition at line 207 of file shorten.c.

Referenced by read_header().

static void fix_bitshift ( ShortenContext s,
int32_t buffer 
)
static

Definition at line 172 of file shorten.c.

Referenced by shorten_decode_frame().

static unsigned int get_uint ( ShortenContext s,
int  k 
)
inlinestatic

Definition at line 165 of file shorten.c.

Referenced by read_header(), and shorten_decode_frame().

static int init_offset ( ShortenContext s)
static

Definition at line 181 of file shorten.c.

Referenced by read_header().

static int read_header ( ShortenContext s)
static

Definition at line 324 of file shorten.c.

Referenced by shorten_decode_frame().

static av_cold int shorten_decode_close ( AVCodecContext avctx)
static

Definition at line 642 of file shorten.c.

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

Definition at line 412 of file shorten.c.

static av_cold int shorten_decode_init ( AVCodecContext avctx)
static

Definition at line 115 of file shorten.c.

Variable Documentation

AVCodec ff_shorten_decoder
Initial value:
= {
.name = "shorten",
.priv_data_size = sizeof(ShortenContext),
.capabilities = CODEC_CAP_DELAY | CODEC_CAP_DR1,
.long_name = NULL_IF_CONFIG_SMALL("Shorten"),
.sample_fmts = (const enum AVSampleFormat[]) { AV_SAMPLE_FMT_S16P,
}
static av_cold int init(AVCodecContext *avctx)
Definition: avrndec.c:35
static av_cold int shorten_decode_init(AVCodecContext *avctx)
Definition: shorten.c:115
#define CODEC_CAP_DR1
Codec uses get_buffer() for allocating buffers and supports custom allocators.
struct ShortenContext ShortenContext
#define CODEC_CAP_DELAY
Encoder or decoder requires flushing with NULL input at the end in order to give the complete and cor...
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
static void close(AVCodecParserContext *s)
Definition: h264_parser.c:375
static av_cold int shorten_decode_close(AVCodecContext *avctx)
Definition: shorten.c:642
static int shorten_decode_frame(AVCodecContext *avctx, void *data, int *got_frame_ptr, AVPacket *avpkt)
Definition: shorten.c:412
AVSampleFormat
Audio Sample Formats.
Definition: samplefmt.h:49
unsigned 8 bits, planar
Definition: samplefmt.h:57
signed 16 bits, planar
Definition: samplefmt.h:58
static int decode(AVCodecContext *avctx, void *data, int *got_frame, AVPacket *avpkt)
Definition: crystalhd.c:868

Definition at line 658 of file shorten.c.

const int fixed_coeffs[3][3]
static
Initial value:
= {
{ 1, 0, 0 },
{ 2, -1, 0 },
{ 3, -3, 1 }
}

Definition at line 268 of file shorten.c.

Referenced by decode_subframe_lpc().

const uint8_t is_audio_command[10] = { 1, 1, 1, 1, 0, 0, 0, 1, 1, 0 }
static

indicates if the FN_* command is audio or non-audio

Definition at line 79 of file shorten.c.

Referenced by shorten_decode_frame().