FFmpeg
Data Structures | Macros | Functions | Variables
mss2.c File Reference
#include "libavutil/avassert.h"
#include "libavutil/mem.h"
#include "codec_internal.h"
#include "decode.h"
#include "error_resilience.h"
#include "mpeg_er.h"
#include "mpegvideodec.h"
#include "vc1.h"
#include "wmv2data.h"
#include "mss12.h"
#include "mss2dsp.h"

Go to the source code of this file.

Data Structures

struct  MSS2Context
 
struct  Rectangle
 
struct  Rectangle2
 

Macros

#define READ_PAIR(a, b)
 
#define COMPARE(top, bottom, left, right)
 
#define MAX_WMV9_RECTANGLES   20
 
#define ARITH2_PADDING   2
 

Functions

static void arith2_normalise (ArithCoder *c)
 
static int arith2_get_scaled_value (int value, int n, int range)
 
static void arith2_rescale_interval (ArithCoder *c, int range, int low, int high, int n)
 
static int arith2_get_number (ArithCoder *c, int n)
 
static int arith2_get_prob (ArithCoder *c, int16_t *probs)
 
static int arith2_get_consumed_bytes (ArithCoder *c)
 
static void arith2_init (ArithCoder *c, GetByteContext *gB)
 
static int decode_pal_v2 (MSS12Context *ctx, const uint8_t *buf, int buf_size)
 
static int decode_555 (AVCodecContext *avctx, GetByteContext *gB, uint16_t *dst, ptrdiff_t stride, int keyframe, int w, int h)
 
static int decode_rle (GetBitContext *gb, uint8_t *pal_dst, ptrdiff_t pal_stride, uint8_t *rgb_dst, ptrdiff_t rgb_stride, uint32_t *pal, int keyframe, int kf_slipt, int slice, int w, int h)
 
static int decode_wmv9 (AVCodecContext *avctx, const uint8_t *buf, int buf_size, int x, int y, int w, int h, int wmv9_mask)
 
static void calc_draw_region (struct Rectangle2 *draw, const struct Rectangle2 *rect)
 
static int calc_split_position (int split_position, const struct Rectangle2 *rect, int height)
 
static int mss2_decode_frame (AVCodecContext *avctx, AVFrame *frame, int *got_frame, AVPacket *avpkt)
 
static av_cold int wmv9_init (AVCodecContext *avctx)
 
static av_cold int mss2_decode_end (AVCodecContext *avctx)
 
static av_cold int mss2_decode_init (AVCodecContext *avctx)
 

Variables

const FFCodec ff_mss2_decoder
 

Detailed Description

Microsoft Screen 2 (aka Windows Media Video V9 Screen) decoder

Definition in file mss2.c.

Macro Definition Documentation

◆ READ_PAIR

#define READ_PAIR (   a,
  b 
)
Value:
a = bytestream2_get_byte(gB) << 4; \
t = bytestream2_get_byte(gB); \
a |= t >> 4; \
b = (t & 0xF) << 8; \
b |= bytestream2_get_byte(gB); \

◆ COMPARE

#define COMPARE (   top,
  bottom,
  left,
  right 
)
Value:
if (rect->top <= draw->top && rect->bottom >= draw->bottom) { \
if (rect->left <= draw->left && rect->right >= draw->left) \
draw->left = FFMIN(rect->right, draw->right); \
if (rect->right >= draw->right) { \
if (rect->left >= draw->left) { \
if (rect->left < draw->right) \
draw->right = rect->left; \
} else { \
draw->right = draw->left; \
} \
} \
}

◆ MAX_WMV9_RECTANGLES

#define MAX_WMV9_RECTANGLES   20

Definition at line 503 of file mss2.c.

◆ ARITH2_PADDING

#define ARITH2_PADDING   2

Definition at line 504 of file mss2.c.

Function Documentation

◆ arith2_normalise()

static void arith2_normalise ( ArithCoder c)
static

Definition at line 47 of file mss2.c.

Referenced by arith2_get_number().

◆ arith2_get_scaled_value()

static int arith2_get_scaled_value ( int  value,
int  n,
int  range 
)
static

Definition at line 66 of file mss2.c.

Referenced by arith2_get_number(), and arith2_get_prob().

◆ arith2_rescale_interval()

static void arith2_rescale_interval ( ArithCoder c,
int  range,
int  low,
int  high,
int  n 
)
static

Definition at line 76 of file mss2.c.

Referenced by arith2_get_number(), and arith2_get_prob().

◆ arith2_get_number()

static int arith2_get_number ( ArithCoder c,
int  n 
)
static

Definition at line 94 of file mss2.c.

Referenced by arith2_init(), and mss2_decode_frame().

◆ arith2_get_prob()

static int arith2_get_prob ( ArithCoder c,
int16_t *  probs 
)
static

Definition at line 114 of file mss2.c.

◆ arith2_get_consumed_bytes()

static int arith2_get_consumed_bytes ( ArithCoder c)
static

Definition at line 136 of file mss2.c.

Referenced by mss2_decode_frame().

◆ arith2_init()

static void arith2_init ( ArithCoder c,
GetByteContext gB 
)
static

Definition at line 150 of file mss2.c.

Referenced by mss2_decode_frame().

◆ decode_pal_v2()

static int decode_pal_v2 ( MSS12Context ctx,
const uint8_t *  buf,
int  buf_size 
)
static

Definition at line 161 of file mss2.c.

Referenced by mss2_decode_frame().

◆ decode_555()

static int decode_555 ( AVCodecContext avctx,
GetByteContext gB,
uint16_t *  dst,
ptrdiff_t  stride,
int  keyframe,
int  w,
int  h 
)
static

Definition at line 178 of file mss2.c.

Referenced by mss2_decode_frame().

◆ decode_rle()

static int decode_rle ( GetBitContext gb,
uint8_t *  pal_dst,
ptrdiff_t  pal_stride,
uint8_t *  rgb_dst,
ptrdiff_t  rgb_stride,
uint32_t *  pal,
int  keyframe,
int  kf_slipt,
int  slice,
int  w,
int  h 
)
static

Definition at line 241 of file mss2.c.

Referenced by mss2_decode_frame().

◆ decode_wmv9()

static int decode_wmv9 ( AVCodecContext avctx,
const uint8_t *  buf,
int  buf_size,
int  x,
int  y,
int  w,
int  h,
int  wmv9_mask 
)
static

Definition at line 378 of file mss2.c.

Referenced by mss2_decode_frame().

◆ calc_draw_region()

static void calc_draw_region ( struct Rectangle2 draw,
const struct Rectangle2 rect 
)
static

Definition at line 474 of file mss2.c.

Referenced by mss2_decode_frame().

◆ calc_split_position()

static int calc_split_position ( int  split_position,
const struct Rectangle2 rect,
int  height 
)
static

Definition at line 495 of file mss2.c.

Referenced by mss2_decode_frame().

◆ mss2_decode_frame()

static int mss2_decode_frame ( AVCodecContext avctx,
AVFrame frame,
int *  got_frame,
AVPacket avpkt 
)
static

Definition at line 506 of file mss2.c.

◆ wmv9_init()

static av_cold int wmv9_init ( AVCodecContext avctx)
static

Definition at line 810 of file mss2.c.

Referenced by mss2_decode_init().

◆ mss2_decode_end()

static av_cold int mss2_decode_end ( AVCodecContext avctx)
static

Definition at line 863 of file mss2.c.

◆ mss2_decode_init()

static av_cold int mss2_decode_init ( AVCodecContext avctx)
static

Definition at line 877 of file mss2.c.

Variable Documentation

◆ ff_mss2_decoder

const FFCodec ff_mss2_decoder
Initial value:
= {
.p.name = "mss2",
CODEC_LONG_NAME("MS Windows Media Video V9 Screen"),
.p.type = AVMEDIA_TYPE_VIDEO,
.priv_data_size = sizeof(MSS2Context),
.close = mss2_decode_end,
.p.capabilities = AV_CODEC_CAP_DR1,
.caps_internal = FF_CODEC_CAP_INIT_CLEANUP,
}

Definition at line 902 of file mss2.c.

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: codec_internal.h:43
rect
Definition: f_ebur128.c:76
FF_CODEC_DECODE_CB
#define FF_CODEC_DECODE_CB(func)
Definition: codec_internal.h:311
CODEC_LONG_NAME
#define CODEC_LONG_NAME(str)
Definition: codec_internal.h:296
if
if(ret)
Definition: filter_design.txt:179
mss2_decode_end
static av_cold int mss2_decode_end(AVCodecContext *avctx)
Definition: mss2.c:863
init
int(* init)(AVBSFContext *ctx)
Definition: dts2pts.c:368
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
MSS2Context
Definition: mss2.c:38
a
The reader does not expect b to be semantically here and if the code is changed by maybe adding a a division or other the signedness will almost certainly be mistaken To avoid this confusion a new type was SUINT is the C unsigned type but it holds a signed int to use the same example SUINT a
Definition: undefined.txt:41
draw
static int draw(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)
Definition: avf_showcwt.c:440
AV_CODEC_ID_MSS2
@ AV_CODEC_ID_MSS2
Definition: codec_id.h:219
mss2_decode_init
static av_cold int mss2_decode_init(AVCodecContext *avctx)
Definition: mss2.c:877
FFMIN
#define FFMIN(a, b)
Definition: macros.h:49
AVMEDIA_TYPE_VIDEO
@ AVMEDIA_TYPE_VIDEO
Definition: avutil.h:201
mss2_decode_frame
static int mss2_decode_frame(AVCodecContext *avctx, AVFrame *frame, int *got_frame, AVPacket *avpkt)
Definition: mss2.c:506