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

#define SVQ1_CALC_CODEBOOK_ENTRIES ( cbook   ) 

Value:

codebook = (const uint32_t *) cbook[level];\
      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 + (mean >> 31)) << 16) | (mean & 0xFFFF);

Definition at line 197 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 171 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 183 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 / 2) + 1));\
    }

Definition at line 132 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 544 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 486 of file svq1dec.c.

Referenced by svq1_decode_frame().

static av_cold int svq1_decode_end ( AVCodecContext avctx  )  [static]

Definition at line 821 of file svq1dec.c.

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

Definition at line 643 of file svq1dec.c.

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

Definition at line 568 of file svq1dec.c.

Referenced by svq1_decode_frame().

static av_cold int svq1_decode_init ( AVCodecContext avctx  )  [static]

Definition at line 768 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 396 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 554 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 62 of file svq1dec.c.

Referenced by ff_svq1_packet_checksum().

const uint8_t mvtab[33][2]

Definition at line 91 of file h263data.h.

const uint8_t string_table[256] [static]

Definition at line 97 of file svq1dec.c.

Referenced by svq1_parse_string().

VLC svq1_block_type [static]

Definition at line 49 of file svq1dec.c.

Initial value:

 {
    "svq1",
    AVMEDIA_TYPE_VIDEO,
    CODEC_ID_SVQ1,
    sizeof(MpegEncContext),
    svq1_decode_init,
    NULL,
    svq1_decode_end,
    svq1_decode_frame,
    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 830 of file svq1dec.c.

VLC svq1_inter_mean [static]

Definition at line 54 of file svq1dec.c.

Definition at line 52 of file svq1dec.c.

VLC svq1_intra_mean [static]

Definition at line 53 of file svq1dec.c.

Definition at line 51 of file svq1dec.c.

Definition at line 50 of file svq1dec.c.


Generated on Fri Oct 26 02:36:53 2012 for FFmpeg by  doxygen 1.5.8