FFmpeg
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Macros | Functions | Variables
svq1dec.c File Reference

Sorenson Vector Quantizer #1 (SVQ1) video codec. More...

#include "avcodec.h"
#include "get_bits.h"
#include "h263.h"
#include "hpeldsp.h"
#include "internal.h"
#include "mathops.h"
#include "svq1.h"
#include <assert.h>

Go to the source code of this file.

Data Structures

struct  svq1_pmv
 
struct  SVQ1Context
 

Macros

#define SVQ1_PROCESS_VECTOR()
 
#define SVQ1_ADD_CODEBOOK()
 
#define SVQ1_CALC_CODEBOOK_ENTRIES(cbook)
 

Functions

static int svq1_decode_block_intra (GetBitContext *bitbuf, uint8_t *pixels, int pitch)
 
static int svq1_decode_block_non_intra (GetBitContext *bitbuf, uint8_t *pixels, int pitch)
 
static int svq1_decode_motion_vector (GetBitContext *bitbuf, svq1_pmv *mv, svq1_pmv **pmv)
 
static void svq1_skip_block (uint8_t *current, uint8_t *previous, int pitch, int x, int y)
 
static int svq1_motion_inter_block (HpelDSPContext *hdsp, GetBitContext *bitbuf, uint8_t *current, uint8_t *previous, int pitch, svq1_pmv *motion, int x, int y, int width, int height)
 
static int svq1_motion_inter_4v_block (HpelDSPContext *hdsp, GetBitContext *bitbuf, uint8_t *current, uint8_t *previous, int pitch, svq1_pmv *motion, int x, int y, int width, int height)
 
static int svq1_decode_delta_block (AVCodecContext *avctx, HpelDSPContext *hdsp, GetBitContext *bitbuf, uint8_t *current, uint8_t *previous, int pitch, svq1_pmv *motion, int x, int y, int width, int height)
 
static void svq1_parse_string (GetBitContext *bitbuf, uint8_t out[257])
 
static int svq1_decode_frame_header (AVCodecContext *avctx, AVFrame *frame)
 
static int svq1_decode_frame (AVCodecContext *avctx, void *data, int *got_frame, AVPacket *avpkt)
 
static av_cold int svq1_decode_init (AVCodecContext *avctx)
 
static av_cold int svq1_decode_end (AVCodecContext *avctx)
 
static void svq1_flush (AVCodecContext *avctx)
 

Variables

static VLC svq1_block_type
 
static VLC svq1_motion_component
 
static VLC svq1_intra_multistage [6]
 
static VLC svq1_inter_multistage [6]
 
static VLC svq1_intra_mean
 
static VLC svq1_inter_mean
 
static const uint8_t string_table [256]
 
AVCodec ff_svq1_decoder
 

Detailed Description

Sorenson Vector Quantizer #1 (SVQ1) video codec.

For more information of the SVQ1 algorithm, visit: http://www.pcisys.net/~melanson/codecs/

Definition in file svq1dec.c.

Macro Definition Documentation

#define SVQ1_PROCESS_VECTOR ( )
Value:
for (; level > 0; i++) { \
/* process next depth */ \
if (i == m) { \
m = n; \
if (--level == 0) \
break; \
} \
/* divide block if next bit set */ \
if (!get_bits1(bitbuf)) \
break; \
/* add child nodes */ \
list[n++] = list[i]; \
list[n++] = list[i] + (((level & 1) ? pitch : 1) << ((level >> 1) + 1));\
}

Definition at line 108 of file svq1dec.c.

Referenced by svq1_decode_block_intra(), and svq1_decode_block_non_intra().

#define SVQ1_ADD_CODEBOOK ( )
Value:
/* add codebook entries to vector */ \
for (j = 0; j < stages; j++) { \
n3 = codebook[entries[j]] ^ 0x80808080; \
n1 += (n3 & 0xFF00FF00) >> 8; \
n2 += n3 & 0x00FF00FF; \
} \
\
/* clip to [0..255] */ \
if (n1 & 0xFF00FF00) { \
n3 = (n1 >> 15 & 0x00010001 | 0x01000100) - 0x00010001; \
n1 += 0x7F007F00; \
n1 |= (~n1 >> 15 & 0x00010001 | 0x01000100) - 0x00010001; \
n1 &= n3 & 0x00FF00FF; \
} \
if (n2 & 0xFF00FF00) { \
n3 = (n2 >> 15 & 0x00010001 | 0x01000100) - 0x00010001; \
n2 += 0x7F007F00; \
n2 |= (~n2 >> 15 & 0x00010001 | 0x01000100) - 0x00010001; \
n2 &= n3 & 0x00FF00FF; \
}

Definition at line 124 of file svq1dec.c.

Referenced by svq1_decode_block_intra(), and svq1_decode_block_non_intra().

#define SVQ1_CALC_CODEBOOK_ENTRIES (   cbook)
Value:
codebook = (const uint32_t *)cbook[level]; \
if (stages > 0) \
bit_cache = get_bits(bitbuf, 4 * stages); \
/* calculate codebook entries for this vector */ \
for (j = 0; j < stages; j++) { \
entries[j] = (((bit_cache >> (4 * (stages - j - 1))) & 0xF) + \
16 * j) << (level + 1); \
} \
mean -= stages * 128; \
n4 = (mean << 16) + mean;

Definition at line 147 of file svq1dec.c.

Referenced by svq1_decode_block_intra(), and svq1_decode_block_non_intra().

Function Documentation

static int svq1_decode_block_intra ( GetBitContext bitbuf,
uint8_t pixels,
int  pitch 
)
static

Definition at line 159 of file svq1dec.c.

Referenced by svq1_decode_delta_block(), and svq1_decode_frame().

static int svq1_decode_block_non_intra ( GetBitContext bitbuf,
uint8_t pixels,
int  pitch 
)
static

Definition at line 224 of file svq1dec.c.

Referenced by svq1_decode_delta_block().

static int svq1_decode_motion_vector ( GetBitContext bitbuf,
svq1_pmv mv,
svq1_pmv **  pmv 
)
static

Definition at line 282 of file svq1dec.c.

Referenced by svq1_motion_inter_4v_block(), and svq1_motion_inter_block().

static void svq1_skip_block ( uint8_t current,
uint8_t previous,
int  pitch,
int  x,
int  y 
)
static

Definition at line 308 of file svq1dec.c.

Referenced by svq1_decode_delta_block().

static int svq1_motion_inter_block ( HpelDSPContext hdsp,
GetBitContext bitbuf,
uint8_t current,
uint8_t previous,
int  pitch,
svq1_pmv motion,
int  x,
int  y,
int  width,
int  height 
)
static

Definition at line 325 of file svq1dec.c.

Referenced by svq1_decode_delta_block().

static int svq1_motion_inter_4v_block ( HpelDSPContext hdsp,
GetBitContext bitbuf,
uint8_t current,
uint8_t previous,
int  pitch,
svq1_pmv motion,
int  x,
int  y,
int  width,
int  height 
)
static

Definition at line 368 of file svq1dec.c.

Referenced by svq1_decode_delta_block().

static int svq1_decode_delta_block ( AVCodecContext avctx,
HpelDSPContext hdsp,
GetBitContext bitbuf,
uint8_t current,
uint8_t previous,
int  pitch,
svq1_pmv motion,
int  x,
int  y,
int  width,
int  height 
)
static

Definition at line 445 of file svq1dec.c.

Referenced by svq1_decode_frame().

static void svq1_parse_string ( GetBitContext bitbuf,
uint8_t  out[257] 
)
static

Definition at line 502 of file svq1dec.c.

Referenced by svq1_decode_frame_header().

static int svq1_decode_frame_header ( AVCodecContext avctx,
AVFrame frame 
)
static

Definition at line 517 of file svq1dec.c.

Referenced by svq1_decode_frame().

static int svq1_decode_frame ( AVCodecContext avctx,
void data,
int *  got_frame,
AVPacket avpkt 
)
static

Definition at line 610 of file svq1dec.c.

static av_cold int svq1_decode_init ( AVCodecContext avctx)
static

Definition at line 761 of file svq1dec.c.

static av_cold int svq1_decode_end ( AVCodecContext avctx)
static

Definition at line 816 of file svq1dec.c.

static void svq1_flush ( AVCodecContext avctx)
static

Definition at line 827 of file svq1dec.c.

Variable Documentation

VLC svq1_block_type
static

Definition at line 46 of file svq1dec.c.

VLC svq1_motion_component
static

Definition at line 47 of file svq1dec.c.

VLC svq1_intra_multistage[6]
static

Definition at line 48 of file svq1dec.c.

VLC svq1_inter_multistage[6]
static

Definition at line 49 of file svq1dec.c.

VLC svq1_intra_mean
static

Definition at line 50 of file svq1dec.c.

VLC svq1_inter_mean
static

Definition at line 51 of file svq1dec.c.

const uint8_t string_table[256]
static

Definition at line 73 of file svq1dec.c.

Referenced by svq1_parse_string().

AVCodec ff_svq1_decoder
Initial value:
= {
.name = "svq1",
.long_name = NULL_IF_CONFIG_SMALL("Sorenson Vector Quantizer 1 / Sorenson Video 1 / SVQ1"),
.priv_data_size = sizeof(SVQ1Context),
.capabilities = CODEC_CAP_DR1,
.pix_fmts = (const enum AVPixelFormat[]) { AV_PIX_FMT_YUV410P,
}

Definition at line 834 of file svq1dec.c.