FFmpeg
Data Structures | Macros | Enumerations | Functions | Variables
mss4.c File Reference
#include "libavutil/thread.h"
#include "avcodec.h"
#include "bytestream.h"
#include "get_bits.h"
#include "internal.h"
#include "jpegtables.h"
#include "mss34dsp.h"
#include "unary.h"

Go to the source code of this file.

Data Structures

struct  MSS4Context
 

Macros

#define HEADER_SIZE   8
 
#define MAX_ENTRIES   162
 
#define MKVAL(vals)   ((vals)[0] | ((vals)[1] << 3) | ((vals)[2] << 6))
 

Enumerations

enum  FrameType {
  ACTIVE_FRAME, SID_FRAME, UNTRANSMITTED_FRAME, INTRA_FRAME = 0,
  INTER_FRAME, SKIP_FRAME, FIRST_FRAME, INNER_FRAME,
  FINAL_FRAME, LINEAR_MODE, FRAME_NB
}
 
enum  BlockType {
  FILL_BLOCK = 0, IMAGE_BLOCK, DCT_BLOCK, HAAR_BLOCK,
  SKIP_BLOCK, SKIP_BLOCK = 0, DCT_BLOCK, IMAGE_BLOCK
}
 
enum  CachePos { LEFT = 0, TOP_LEFT, TOP }
 

Functions

static av_cold void mss4_init_vlc (VLC *vlc, unsigned *offset, const uint8_t *lens, const uint8_t *syms)
 
static av_cold void mss4_init_vlcs (void)
 
static av_always_inline int get_coeff_bits (GetBitContext *gb, int nbits)
 
static int get_coeff (GetBitContext *gb, VLC *vlc)
 
static int mss4_decode_dct (GetBitContext *gb, VLC *dc_vlc, VLC *ac_vlc, int *block, int *dc_cache, int bx, int by, uint16_t *quant_mat)
 
static int mss4_decode_dct_block (MSS4Context *c, GetBitContext *gb, uint8_t *dst[3], int mb_x, int mb_y)
 
static void read_vec_pos (GetBitContext *gb, int *vec_pos, int *sel_flag, int *sel_len, int *prev)
 
static int get_value_cached (GetBitContext *gb, int vec_pos, uint8_t *vec, int vec_size, int component, int shift, int *prev)
 
static int mss4_decode_image_block (MSS4Context *ctx, GetBitContext *gb, uint8_t *picdst[3], int mb_x, int mb_y)
 
static void mss4_update_dc_cache (MSS4Context *c, int mb_x)
 
static int mss4_decode_frame (AVCodecContext *avctx, void *data, int *got_frame, AVPacket *avpkt)
 
static av_cold int mss4_decode_end (AVCodecContext *avctx)
 
static av_cold int mss4_decode_init (AVCodecContext *avctx)
 

Variables

static const uint8_t mss4_dc_vlc_lens [2][16]
 
static const uint8_t vec_len_syms [2][4]
 
static const uint8_t mss4_vec_entry_vlc_lens [2][16]
 
static const uint8_t mss4_vec_entry_vlc_syms [2][9]
 
static VLC dc_vlc [2]
 
static VLC ac_vlc [2]
 
static VLC vec_entry_vlc [2]
 
const AVCodec ff_mts2_decoder
 

Detailed Description

Microsoft Screen 4 (aka Microsoft Titanium Screen 2, aka Microsoft Expression Encoder Screen) decoder

Definition in file mss4.c.

Macro Definition Documentation

◆ HEADER_SIZE

#define HEADER_SIZE   8

Definition at line 38 of file mss4.c.

◆ MAX_ENTRIES

#define MAX_ENTRIES   162

Definition at line 78 of file mss4.c.

◆ MKVAL

#define MKVAL (   vals)    ((vals)[0] | ((vals)[1] << 3) | ((vals)[2] << 6))

Definition at line 304 of file mss4.c.

Enumeration Type Documentation

◆ FrameType

enum FrameType
Enumerator
ACTIVE_FRAME 

Active speech.

SID_FRAME 

Silence Insertion Descriptor frame.

UNTRANSMITTED_FRAME 
INTRA_FRAME 
INTER_FRAME 
SKIP_FRAME 
FIRST_FRAME 
INNER_FRAME 
FINAL_FRAME 
LINEAR_MODE 
FRAME_NB 

Definition at line 40 of file mss4.c.

◆ BlockType

enum BlockType
Enumerator
FILL_BLOCK 
IMAGE_BLOCK 
DCT_BLOCK 
HAAR_BLOCK 
SKIP_BLOCK 
SKIP_BLOCK 
DCT_BLOCK 
IMAGE_BLOCK 

Definition at line 46 of file mss4.c.

◆ CachePos

enum CachePos
Enumerator
LEFT 
TOP_LEFT 
TOP 

Definition at line 52 of file mss4.c.

Function Documentation

◆ mss4_init_vlc()

static av_cold void mss4_init_vlc ( VLC vlc,
unsigned *  offset,
const uint8_t *  lens,
const uint8_t *  syms 
)
static

Definition at line 99 of file mss4.c.

Referenced by mss4_init_vlcs().

◆ mss4_init_vlcs()

static av_cold void mss4_init_vlcs ( void  )
static

Definition at line 122 of file mss4.c.

Referenced by mss4_decode_init().

◆ get_coeff_bits()

static av_always_inline int get_coeff_bits ( GetBitContext gb,
int  nbits 
)
static

Definition at line 143 of file mss4.c.

Referenced by get_coeff(), and mss4_decode_dct().

◆ get_coeff()

static int get_coeff ( GetBitContext gb,
VLC vlc 
)
inlinestatic

Definition at line 157 of file mss4.c.

Referenced by mss4_decode_dct(), and mss4_decode_image_block().

◆ mss4_decode_dct()

static int mss4_decode_dct ( GetBitContext gb,
VLC dc_vlc,
VLC ac_vlc,
int block,
int dc_cache,
int  bx,
int  by,
uint16_t *  quant_mat 
)
static

Definition at line 164 of file mss4.c.

Referenced by mss4_decode_dct_block().

◆ mss4_decode_dct_block()

static int mss4_decode_dct_block ( MSS4Context c,
GetBitContext gb,
uint8_t *  dst[3],
int  mb_x,
int  mb_y 
)
static

Definition at line 219 of file mss4.c.

Referenced by mss4_decode_frame().

◆ read_vec_pos()

static void read_vec_pos ( GetBitContext gb,
int vec_pos,
int sel_flag,
int sel_len,
int prev 
)
static

Definition at line 267 of file mss4.c.

Referenced by mss4_decode_image_block().

◆ get_value_cached()

static int get_value_cached ( GetBitContext gb,
int  vec_pos,
uint8_t *  vec,
int  vec_size,
int  component,
int  shift,
int prev 
)
static

Definition at line 293 of file mss4.c.

Referenced by mss4_decode_image_block().

◆ mss4_decode_image_block()

static int mss4_decode_image_block ( MSS4Context ctx,
GetBitContext gb,
uint8_t *  picdst[3],
int  mb_x,
int  mb_y 
)
static

Definition at line 317 of file mss4.c.

Referenced by mss4_decode_frame().

◆ mss4_update_dc_cache()

static void mss4_update_dc_cache ( MSS4Context c,
int  mb_x 
)
inlinestatic

Definition at line 427 of file mss4.c.

Referenced by mss4_decode_frame().

◆ mss4_decode_frame()

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

Definition at line 446 of file mss4.c.

◆ mss4_decode_end()

static av_cold int mss4_decode_end ( AVCodecContext avctx)
static

Definition at line 569 of file mss4.c.

◆ mss4_decode_init()

static av_cold int mss4_decode_init ( AVCodecContext avctx)
static

Definition at line 581 of file mss4.c.

Variable Documentation

◆ mss4_dc_vlc_lens

const uint8_t mss4_dc_vlc_lens[2][16]
static
Initial value:
= {
{ 0, 1, 5, 1, 1, 1, 1, 2, 0, 0, 0, 0, 0, 0, 0, 0 },
{ 0, 3, 1, 1, 1, 1, 1, 1, 1, 2, 0, 0, 0, 0, 0, 0 }
}

Definition at line 58 of file mss4.c.

Referenced by mss4_init_vlcs().

◆ vec_len_syms

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

Definition at line 63 of file mss4.c.

Referenced by mss4_decode_image_block().

◆ mss4_vec_entry_vlc_lens

const uint8_t mss4_vec_entry_vlc_lens[2][16]
static
Initial value:
= {
{ 0, 2, 2, 3, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
{ 0, 1, 5, 1, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }
}

Definition at line 68 of file mss4.c.

Referenced by mss4_init_vlcs().

◆ mss4_vec_entry_vlc_syms

const uint8_t mss4_vec_entry_vlc_syms[2][9]
static
Initial value:
= {
{ 0, 7, 6, 5, 8, 4, 3, 1, 2 },
{ 0, 2, 3, 4, 5, 6, 7, 1, 8 }
}

Definition at line 73 of file mss4.c.

Referenced by mss4_init_vlcs().

◆ dc_vlc

VLC dc_vlc[2]
static

Definition at line 96 of file mss4.c.

Referenced by mss4_decode_dct(), mss4_decode_dct_block(), and mss4_init_vlcs().

◆ ac_vlc

VLC ac_vlc[2]
static

Definition at line 96 of file mss4.c.

Referenced by mss4_decode_dct(), mss4_decode_dct_block(), and mss4_init_vlcs().

◆ vec_entry_vlc

VLC vec_entry_vlc[2]
static

Definition at line 97 of file mss4.c.

Referenced by mss4_decode_image_block(), and mss4_init_vlcs().

◆ ff_mts2_decoder

const AVCodec ff_mts2_decoder
Initial value:
= {
.name = "mts2",
.long_name = NULL_IF_CONFIG_SMALL("MS Expression Encoder Screen"),
.priv_data_size = sizeof(MSS4Context),
.close = mss4_decode_end,
.capabilities = AV_CODEC_CAP_DR1,
}

Definition at line 607 of file mss4.c.

FF_CODEC_CAP_INIT_THREADSAFE
#define FF_CODEC_CAP_INIT_THREADSAFE
The codec does not modify any global variables in the init function, allowing to call the init functi...
Definition: internal.h:41
init
static av_cold int init(AVCodecContext *avctx)
Definition: avrndec.c:31
MSS4Context
Definition: mss4.c:80
mss4_decode_end
static av_cold int mss4_decode_end(AVCodecContext *avctx)
Definition: mss4.c:569
decode
static void decode(AVCodecContext *dec_ctx, AVPacket *pkt, AVFrame *frame, FILE *outfile)
Definition: decode_audio.c:71
AV_CODEC_CAP_DR1
#define AV_CODEC_CAP_DR1
Codec uses get_buffer() or get_encode_buffer() for allocating buffers and supports custom allocators.
Definition: codec.h:52
NULL_IF_CONFIG_SMALL
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
Definition: internal.h:117
mss4_decode_frame
static int mss4_decode_frame(AVCodecContext *avctx, void *data, int *got_frame, AVPacket *avpkt)
Definition: mss4.c:446
AV_CODEC_ID_MTS2
@ AV_CODEC_ID_MTS2
Definition: codec_id.h:215
FF_CODEC_CAP_INIT_CLEANUP
#define FF_CODEC_CAP_INIT_CLEANUP
The codec allows calling the close function for deallocation even if the init function returned a fai...
Definition: internal.h:49
AVMEDIA_TYPE_VIDEO
@ AVMEDIA_TYPE_VIDEO
Definition: avutil.h:201
mss4_decode_init
static av_cold int mss4_decode_init(AVCodecContext *avctx)
Definition: mss4.c:581