libavcodec/svq1dec.c File Reference

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

#include "avcodec.h"
#include "dsputil.h"
#include "mpegvideo.h"
#include "mathops.h"
#include "svq1.h"
#include <assert.h>

Go to the source code of this file.

Data Structures

struct  svq1_pmv_s

Defines

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

Typedefs

typedef struct svq1_pmv_s svq1_pmv

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 (MpegEncContext *s, GetBitContext *bitbuf, uint8_t *current, uint8_t *previous, int pitch, svq1_pmv *motion, int x, int y)
static int svq1_motion_inter_4v_block (MpegEncContext *s, GetBitContext *bitbuf, uint8_t *current, uint8_t *previous, int pitch, svq1_pmv *motion, int x, int y)
static int svq1_decode_delta_block (MpegEncContext *s, GetBitContext *bitbuf, uint8_t *current, uint8_t *previous, int pitch, svq1_pmv *motion, int x, int y)
uint16_t ff_svq1_packet_checksum (const uint8_t *data, const int length, int value)
static void svq1_parse_string (GetBitContext *bitbuf, uint8_t *out)
static int svq1_decode_frame_header (GetBitContext *bitbuf, MpegEncContext *s)
static int svq1_decode_frame (AVCodecContext *avctx, void *data, int *data_size, AVPacket *avpkt)
static av_cold int svq1_decode_init (AVCodecContext *avctx)
static av_cold int svq1_decode_end (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 uint16_t checksum_table [256]
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.


Define 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);\
          }

Definition at line 147 of file svq1dec.c.

#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 196 of file svq1dec.c.

Referenced by svq1_decode_block_intra(), and svq1_decode_block_non_intra().

 
#define SVQ1_DO_CODEBOOK_INTRA (  ) 

Value:

for (y=0; y < height; y++) {\
        for (x=0; x < (width / 4); x++, codebook++) {\
        n1 = n4;\
        n2 = n4;\
        SVQ1_ADD_CODEBOOK()\
        /* store result */\
        dst[x] = (n1 << 8) | n2;\
        }\
        dst += (pitch / 4);\
      }

Definition at line 170 of file svq1dec.c.

Referenced by svq1_decode_block_intra().

 
#define SVQ1_DO_CODEBOOK_NONINTRA (  ) 

Value:

for (y=0; y < height; y++) {\
        for (x=0; x < (width / 4); x++, codebook++) {\
        n3 = dst[x];\
        /* add mean value to vector */\
        n1 = ((n3 & 0xFF00FF00) >> 8) + n4;\
        n2 =  (n3 & 0x00FF00FF)          + n4;\
        SVQ1_ADD_CODEBOOK()\
        /* store result */\
        dst[x] = (n1 << 8) | n2;\
        }\
        dst += (pitch / 4);\
      }

Definition at line 182 of file svq1dec.c.

Referenced by 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) == 0)\
        break;\
      /* add child nodes */\
      list[n++] = list[i];\
      list[n++] = list[i] + (((level & 1) ? pitch : 1) << ((level >> 1) + 1));\
    }

Definition at line 131 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


Function Documentation

uint16_t ff_svq1_packet_checksum ( const uint8_t *  data,
const int  length,
int  value 
)

Definition at line 527 of file svq1dec.c.

Referenced by svq1_decode_frame_header(), and svq3_decode_init().

static int svq1_decode_block_intra ( GetBitContext bitbuf,
uint8_t *  pixels,
int  pitch 
) [static]

Definition at line 207 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 262 of file svq1dec.c.

Referenced by svq1_decode_delta_block().

static int svq1_decode_delta_block ( MpegEncContext s,
GetBitContext bitbuf,
uint8_t *  current,
uint8_t *  previous,
int  pitch,
svq1_pmv motion,
int  x,
int  y 
) [static]

Definition at line 473 of file svq1dec.c.

Referenced by svq1_decode_frame().

static av_cold int svq1_decode_end ( AVCodecContext avctx  )  [static]

Definition at line 803 of file svq1dec.c.

static int svq1_decode_frame ( AVCodecContext avctx,
void *  data,
int *  data_size,
AVPacket avpkt 
) [static]

Definition at line 625 of file svq1dec.c.

static int svq1_decode_frame_header ( GetBitContext bitbuf,
MpegEncContext s 
) [static]

Definition at line 551 of file svq1dec.c.

Referenced by svq1_decode_frame().

static av_cold int svq1_decode_init ( AVCodecContext avctx  )  [static]

Definition at line 750 of file svq1dec.c.

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

Definition at line 305 of file svq1dec.c.

Referenced by svq1_motion_inter_4v_block(), and svq1_motion_inter_block().

static int svq1_motion_inter_4v_block ( MpegEncContext s,
GetBitContext bitbuf,
uint8_t *  current,
uint8_t *  previous,
int  pitch,
svq1_pmv motion,
int  x,
int  y 
) [static]

XXX /FIXME clipping or padding?

Definition at line 389 of file svq1dec.c.

Referenced by svq1_decode_delta_block().

static int svq1_motion_inter_block ( MpegEncContext s,
GetBitContext bitbuf,
uint8_t *  current,
uint8_t *  previous,
int  pitch,
svq1_pmv motion,
int  x,
int  y 
) [static]

Definition at line 344 of file svq1dec.c.

Referenced by svq1_decode_delta_block().

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

Definition at line 537 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 329 of file svq1dec.c.

Referenced by svq1_decode_delta_block().


Variable Documentation

const uint16_t checksum_table[256] [static]

Definition at line 61 of file svq1dec.c.

Referenced by ff_svq1_packet_checksum().

const uint8_t ff_mvtab[33][2]

Definition at line 91 of file h263data.h.

Initial value:

 {
    .name           = "svq1",
    .type           = AVMEDIA_TYPE_VIDEO,
    .id             = CODEC_ID_SVQ1,
    .priv_data_size = sizeof(MpegEncContext),
    .init           = svq1_decode_init,
    .close          = svq1_decode_end,
    .decode         = svq1_decode_frame,
    .capabilities   = CODEC_CAP_DR1,
    .flush= ff_mpeg_flush,
    .pix_fmts= (const enum PixelFormat[]){PIX_FMT_YUV410P, PIX_FMT_NONE},
    .long_name= NULL_IF_CONFIG_SMALL("Sorenson Vector Quantizer 1 / Sorenson Video 1 / SVQ1"),
}

Definition at line 812 of file svq1dec.c.

const uint8_t string_table[256] [static]

Definition at line 96 of file svq1dec.c.

Referenced by svq1_parse_string().

VLC svq1_block_type [static]

Definition at line 48 of file svq1dec.c.

VLC svq1_inter_mean [static]

Definition at line 53 of file svq1dec.c.

Definition at line 51 of file svq1dec.c.

VLC svq1_intra_mean [static]

Definition at line 52 of file svq1dec.c.

Definition at line 50 of file svq1dec.c.

Definition at line 49 of file svq1dec.c.


Generated on Fri Oct 26 02:46:10 2012 for FFmpeg by  doxygen 1.5.8