libavcodec/4xm.c File Reference

4XM codec. More...

#include "libavutil/frame.h"
#include "libavutil/intreadwrite.h"
#include "avcodec.h"
#include "bytestream.h"
#include "dsputil.h"
#include "get_bits.h"
#include "internal.h"
#include "libavutil/avassert.h"
Include dependency graph for libavcodec/4xm.c:

Go to the source code of this file.

Data Structures

struct  CFrameBuffer
 
struct  FourXContext
 

Macros

#define BLOCK_TYPE_VLC_BITS   5
 
#define ACDC_VLC_BITS   9
 
#define CFRAME_BUFFER_COUNT   100
 
#define FIX_1_082392200   70936
 
#define FIX_1_414213562   92682
 
#define FIX_1_847759065   121095
 
#define FIX_2_613125930   171254
 
#define MULTIPLY(var, const)   (((var) * (const)) >> 16)
 
#define LE_CENTRIC_MUL(dst, src, scale, dc)
 

Typedefs

typedef struct CFrameBuffer CFrameBuffer
 
typedef struct FourXContext FourXContext
 

Functions

static void idct (int16_t block[64])
 
static av_cold void init_vlcs (FourXContext *f)
 
static void init_mv (FourXContext *f, int linesize)
 
static void mcdc (uint16_t *dst, const uint16_t *src, int log2w, int h, int stride, int scale, unsigned dc)
 
static void decode_p_block (FourXContext *f, uint16_t *dst, uint16_t *src, int log2w, int log2h, int stride)
 
static int decode_p_frame (FourXContext *f, AVFrame *frame, const uint8_t *buf, int length)
 
static int decode_i_block (FourXContext *f, int16_t *block)
 decode block and dequantize. More...
 
static void idct_put (FourXContext *f, AVFrame *frame, int x, int y)
 
static int decode_i_mb (FourXContext *f)
 
static const uint8_tread_huffman_tables (FourXContext *f, const uint8_t *const buf, int buf_size)
 
static int mix (int c0, int c1)
 
static int decode_i2_frame (FourXContext *f, AVFrame *frame, const uint8_t *buf, int length)
 
static int decode_i_frame (FourXContext *f, AVFrame *frame, const uint8_t *buf, int length)
 
static int decode_frame (AVCodecContext *avctx, void *data, int *got_frame, AVPacket *avpkt)
 
static av_cold int decode_init (AVCodecContext *avctx)
 
static av_cold int decode_end (AVCodecContext *avctx)
 

Variables

static const uint8_t block_type_tab [2][4][8][2]
 
static const uint8_t size2index [4][4]
 
static const int8_t mv [256][2]
 
static const uint8_t dequant_table [64]
 
static VLC block_type_vlc [2][4]
 
AVCodec ff_fourxm_decoder
 

Detailed Description

4XM codec.

Definition in file libavcodec/4xm.c.

Macro Definition Documentation

#define ACDC_VLC_BITS   9

Definition at line 38 of file libavcodec/4xm.c.

Referenced by decode_i_block(), decode_i_frame(), and read_huffman_tables().

#define BLOCK_TYPE_VLC_BITS   5

Definition at line 37 of file libavcodec/4xm.c.

Referenced by decode_p_block(), and init_vlcs().

#define CFRAME_BUFFER_COUNT   100

Definition at line 40 of file libavcodec/4xm.c.

Referenced by decode_end(), and decode_frame().

#define FIX_1_082392200   70936

Definition at line 150 of file libavcodec/4xm.c.

Referenced by idct().

#define FIX_1_414213562   92682

Definition at line 151 of file libavcodec/4xm.c.

Referenced by idct().

#define FIX_1_847759065   121095

Definition at line 152 of file libavcodec/4xm.c.

Referenced by idct().

#define FIX_2_613125930   171254

Definition at line 153 of file libavcodec/4xm.c.

Referenced by idct().

#define LE_CENTRIC_MUL (   dst,
  src,
  scale,
  dc 
)
Value:
{ \
unsigned tmpval = AV_RN32(src) * (scale) + (dc); \
AV_WN32A(dst, tmpval); \
}
#define AV_WN32A(p, v)
Definition: intreadwrite.h:530
AVS_Value src
Definition: avisynth_c.h:523
FIXME Range Coding of cr are mx and my are Motion Vector top and top right vectors is used as motion vector prediction the used motion vector is the sum of the predictor and(mvx_diff, mvy_diff)*mv_scale Intra DC Predicton block[y][x] dc[1]
Definition: snow.txt:392
#define AV_RN32(p)
Definition: intreadwrite.h:356
Same thing on a dB scale
else dst[i][x+y *dst_stride[i]]
Definition: vf_mcdeint.c:160

Definition at line 281 of file libavcodec/4xm.c.

Referenced by mcdc().

#define MULTIPLY (   var,
  const 
)    (((var) * (const)) >> 16)

Definition at line 155 of file libavcodec/4xm.c.

Referenced by idct().

Typedef Documentation

typedef struct CFrameBuffer CFrameBuffer
typedef struct FourXContext FourXContext

Function Documentation

static av_cold int decode_end ( AVCodecContext avctx)
static

Definition at line 967 of file libavcodec/4xm.c.

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

Definition at line 800 of file libavcodec/4xm.c.

static int decode_i2_frame ( FourXContext f,
AVFrame frame,
const uint8_t buf,
int  length 
)
static

Definition at line 687 of file libavcodec/4xm.c.

Referenced by decode_frame().

static int decode_i_block ( FourXContext f,
int16_t *  block 
)
static

decode block and dequantize.

Note this is almost identical to MJPEG.

Definition at line 476 of file libavcodec/4xm.c.

Referenced by decode_i_mb().

static int decode_i_frame ( FourXContext f,
AVFrame frame,
const uint8_t buf,
int  length 
)
static

Definition at line 736 of file libavcodec/4xm.c.

Referenced by decode_frame().

static int decode_i_mb ( FourXContext f)
static

Definition at line 570 of file libavcodec/4xm.c.

Referenced by decode_i_frame().

static av_cold int decode_init ( AVCodecContext avctx)
static

Definition at line 935 of file libavcodec/4xm.c.

static void decode_p_block ( FourXContext f,
uint16_t *  dst,
uint16_t *  src,
int  log2w,
int  log2h,
int  stride 
)
static

Definition at line 336 of file libavcodec/4xm.c.

Referenced by decode_p_frame().

static int decode_p_frame ( FourXContext f,
AVFrame frame,
const uint8_t buf,
int  length 
)
static

Definition at line 408 of file libavcodec/4xm.c.

Referenced by decode_frame().

static void idct ( int16_t  block[64])
static

Definition at line 157 of file libavcodec/4xm.c.

Referenced by idct_put().

static void idct_put ( FourXContext f,
AVFrame frame,
int  x,
int  y 
)
inlinestatic

Definition at line 524 of file libavcodec/4xm.c.

Referenced by decode_i_frame().

static void init_mv ( FourXContext f,
int  linesize 
)
static

Definition at line 259 of file libavcodec/4xm.c.

Referenced by decode_p_frame().

static av_cold void init_vlcs ( FourXContext f)
static

Definition at line 242 of file libavcodec/4xm.c.

Referenced by decode_init().

static void mcdc ( uint16_t *  dst,
const uint16_t *  src,
int  log2w,
int  h,
int  stride,
int  scale,
unsigned  dc 
)
inlinestatic

Definition at line 288 of file libavcodec/4xm.c.

Referenced by decode_p_block().

static int mix ( int  c0,
int  c1 
)
static

Definition at line 679 of file libavcodec/4xm.c.

Referenced by decode_i2_frame().

static const uint8_t* read_huffman_tables ( FourXContext f,
const uint8_t *const  buf,
int  buf_size 
)
static

Definition at line 584 of file libavcodec/4xm.c.

Referenced by decode_i_frame().

Variable Documentation

const uint8_t block_type_tab[2][4][8][2]
static
Initial value:
= {
{
{
{ 0, 1 }, { 2, 2 }, { 6, 3 }, { 14, 4 }, { 30, 5 }, { 31, 5 }, { 0, 0 }
}, {
{ 0, 1 }, { 0, 0 }, { 2, 2 }, { 6, 3 }, { 14, 4 }, { 15, 4 }, { 0, 0 }
}, {
{ 0, 1 }, { 2, 2 }, { 0, 0 }, { 6, 3 }, { 14, 4 }, { 15, 4 }, { 0, 0 }
}, {
{ 0, 1 }, { 0, 0 }, { 0, 0 }, { 2, 2 }, { 6, 3 }, { 14, 4 }, { 15, 4 }
}
}, {
{
{ 1, 2 }, { 4, 3 }, { 5, 3 }, { 0, 2 }, { 6, 3 }, { 7, 3 }, { 0, 0 }
}, {
{ 1, 2 }, { 0, 0 }, { 2, 2 }, { 0, 2 }, { 6, 3 }, { 7, 3 }, { 0, 0 }
}, {
{ 1, 2 }, { 2, 2 }, { 0, 0 }, { 0, 2 }, { 6, 3 }, { 7, 3 }, { 0, 0 }
}, {
{ 1, 2 }, { 0, 0 }, { 0, 0 }, { 0, 2 }, { 2, 2 }, { 6, 3 }, { 7, 3 }
}
}
}

Definition at line 42 of file libavcodec/4xm.c.

Referenced by init_vlcs().

VLC block_type_vlc[2][4]
static

Definition at line 121 of file libavcodec/4xm.c.

const uint8_t dequant_table[64]
static
Initial value:
= {
16, 15, 13, 19, 24, 31, 28, 17,
17, 23, 25, 31, 36, 63, 45, 21,
18, 24, 27, 37, 52, 59, 49, 20,
16, 28, 34, 40, 60, 80, 51, 20,
18, 31, 48, 66, 68, 86, 56, 21,
19, 38, 56, 59, 64, 64, 48, 20,
27, 48, 55, 55, 56, 51, 35, 15,
20, 35, 34, 32, 31, 22, 15, 8,
}

Definition at line 110 of file libavcodec/4xm.c.

Referenced by decode_i_block(), and fill_tone_level_array().

AVCodec ff_fourxm_decoder
Initial value:
= {
.name = "4xm",
.priv_data_size = sizeof(FourXContext),
.capabilities = CODEC_CAP_DR1,
.long_name = NULL_IF_CONFIG_SMALL("4X Movie"),
}
static av_cold int init(AVCodecContext *avctx)
Definition: avrndec.c:35
#define CODEC_CAP_DR1
Codec uses get_buffer() for allocating buffers and supports custom allocators.
static av_cold int decode_init(AVCodecContext *avctx)
static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame, AVPacket *avpkt)
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
struct FourXContext FourXContext
static void close(AVCodecParserContext *s)
Definition: h264_parser.c:375
static av_cold int decode_end(AVCodecContext *avctx)
static int decode(AVCodecContext *avctx, void *data, int *got_frame, AVPacket *avpkt)
Definition: crystalhd.c:868

Definition at line 985 of file libavcodec/4xm.c.

const uint8_t size2index[4][4]
static
Initial value:
= {
{ -1, 3, 1, 1 },
{ 3, 0, 0, 0 },
{ 2, 0, 0, 0 },
{ 2, 0, 0, 0 },
}

Definition at line 66 of file libavcodec/4xm.c.

Referenced by decode_p_block().