svq1dec.c File Reference

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

#include "avcodec.h"
#include "get_bits.h"
#include "hpeldsp.h"
#include "internal.h"
#include "mathops.h"
#include "svq1.h"
#include <assert.h>
Include dependency graph for svq1dec.c:

Go to the source code of this file.

Data Structures

struct  svq1_pmv_s
 
struct  SVQ1Context
 

Macros

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

Typedefs

typedef struct svq1_pmv_s svq1_pmv
 
typedef struct SVQ1Context SVQ1Context
 

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)
 
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

const uint8_t ff_mvtab [33][2]
 
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_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; \
}
initialize output if(nPeaks >3)%at least 3 peaks in spectrum for trying to find f0 nf0peaks
for(j=16;j >0;--j)

Definition at line 121 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;
static unsigned int get_bits(GetBitContext *s, int n)
Read 1-25 bits.
Definition: get_bits.h:240
initialize output if(nPeaks >3)%at least 3 peaks in spectrum for trying to find f0 nf0peaks
FIXME Range Coding of cr are level
Definition: snow.txt:367
for(j=16;j >0;--j)

Definition at line 144 of file svq1dec.c.

Referenced by svq1_decode_block_intra(), and svq1_decode_block_non_intra().

#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));\
}
Filter the word “frame” indicates either a video frame or a group of audio as stored in an AVFilterBuffer structure Format for each input and each output the list of supported formats For video that means pixel format For audio that means channel sample they are references to shared objects When the negotiation mechanism computes the intersection of the formats supported at each end of a all references to both lists are replaced with a reference to the intersection And when a single format is eventually chosen for a link amongst the remaining list
initialize output if(nPeaks >3)%at least 3 peaks in spectrum for trying to find f0 nf0peaks
window constants for m
FIXME Range Coding of cr are level
Definition: snow.txt:367
static unsigned int get_bits1(GetBitContext *s)
Definition: get_bits.h:273
synthesis window for stochastic i

Definition at line 105 of file svq1dec.c.

Referenced by svq1_decode_block_intra(), and svq1_decode_block_non_intra().

Typedef Documentation

typedef struct svq1_pmv_s svq1_pmv
typedef struct SVQ1Context SVQ1Context

Function Documentation

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

Definition at line 156 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 221 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 442 of file svq1dec.c.

Referenced by svq1_decode_frame().

static av_cold int svq1_decode_end ( AVCodecContext avctx)
static

Definition at line 792 of file svq1dec.c.

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

Definition at line 606 of file svq1dec.c.

static int svq1_decode_frame_header ( AVCodecContext avctx,
AVFrame frame 
)
static

Definition at line 513 of file svq1dec.c.

Referenced by svq1_decode_frame().

static av_cold int svq1_decode_init ( AVCodecContext avctx)
static

Definition at line 737 of file svq1dec.c.

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

Definition at line 279 of file svq1dec.c.

Referenced by svq1_motion_inter_4v_block(), and svq1_motion_inter_block().

static void svq1_flush ( AVCodecContext avctx)
static

Definition at line 801 of file svq1dec.c.

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 365 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 322 of file svq1dec.c.

Referenced by svq1_decode_delta_block().

static void svq1_parse_string ( GetBitContext bitbuf,
uint8_t out 
)
static

Definition at line 499 of file svq1dec.c.

Referenced by svq1_decode_frame_header().

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

Definition at line 305 of file svq1dec.c.

Referenced by svq1_decode_delta_block().

Variable Documentation

const uint8_t ff_mvtab[33][2]

Definition at line 91 of file h263data.h.

Referenced by svq1_decode_init().

AVCodec ff_svq1_decoder
Initial value:
= {
.name = "svq1",
.priv_data_size = sizeof(SVQ1Context),
.capabilities = CODEC_CAP_DR1,
.pix_fmts = (const enum AVPixelFormat[]) { AV_PIX_FMT_YUV410P,
.long_name = NULL_IF_CONFIG_SMALL("Sorenson Vector Quantizer 1 / Sorenson Video 1 / SVQ1"),
}
static av_cold int init(AVCodecContext *avctx)
Definition: avrndec.c:35
static av_cold int svq1_decode_end(AVCodecContext *avctx)
Definition: svq1dec.c:792
struct SVQ1Context SVQ1Context
#define CODEC_CAP_DR1
Codec uses get_buffer() for allocating buffers and supports custom allocators.
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
static void svq1_flush(AVCodecContext *avctx)
Definition: svq1dec.c:801
static void flush(AVCodecContext *avctx)
static void close(AVCodecParserContext *s)
Definition: h264_parser.c:375
planar YUV 4:1:0, 9bpp, (1 Cr & Cb sample per 4x4 Y samples)
Definition: pixfmt.h:74
static int svq1_decode_frame(AVCodecContext *avctx, void *data, int *got_frame, AVPacket *avpkt)
Definition: svq1dec.c:606
static av_cold int svq1_decode_init(AVCodecContext *avctx)
Definition: svq1dec.c:737
static int decode(AVCodecContext *avctx, void *data, int *got_frame, AVPacket *avpkt)
Definition: crystalhd.c:868
AVPixelFormat
Pixel format.
Definition: pixfmt.h:66

Definition at line 808 of file svq1dec.c.

const uint8_t string_table[256]
static

Definition at line 70 of file svq1dec.c.

Referenced by svq1_parse_string().

VLC svq1_block_type
static

Definition at line 47 of file svq1dec.c.

VLC svq1_inter_mean
static

Definition at line 52 of file svq1dec.c.

VLC svq1_inter_multistage[6]
static

Definition at line 50 of file svq1dec.c.

VLC svq1_intra_mean
static

Definition at line 51 of file svq1dec.c.

VLC svq1_intra_multistage[6]
static

Definition at line 49 of file svq1dec.c.

VLC svq1_motion_component
static

Definition at line 48 of file svq1dec.c.