#include "avcodec.h"
#include "copy_block.h"
#include "bytestream.h"
#include "internal.h"
#include "libavutil/bswap.h"
#include "libavutil/imgutils.h"
#include "sanm_data.h"
#include "libavutil/avassert.h"
Include dependency graph for sanm.c:

Go to the source code of this file.

Data Structures

struct  SANMVideoContext
 
struct  SANMFrameHeader
 

Macros

#define NGLYPHS   256
 

Typedefs

typedef int(* frm_decoder) (SANMVideoContext *ctx)
 

Enumerations

enum  GlyphEdge {
  LEFT_EDGE, TOP_EDGE, RIGHT_EDGE, BOTTOM_EDGE,
  NO_EDGE
}
 
enum  GlyphDir {
  DIR_LEFT, DIR_UP, DIR_RIGHT, DIR_DOWN,
  NO_DIR
}
 

Functions

static enum GlyphEdge which_edge (int x, int y, int edge_size)
 Return enum GlyphEdge of box where point (x, y) lies. More...
 
static enum GlyphDir which_direction (enum GlyphEdge edge0, enum GlyphEdge edge1)
 
static void interp_point (int8_t *points, int x0, int y0, int x1, int y1, int pos, int npoints)
 Interpolate two points. More...
 
static void make_glyphs (int8_t *pglyphs, const int8_t *xvec, const int8_t *yvec, const int side_length)
 Construct glyphs by iterating through vectors coordinates. More...
 
static void init_sizes (SANMVideoContext *ctx, int width, int height)
 
static void destroy_buffers (SANMVideoContext *ctx)
 
static av_cold int init_buffers (SANMVideoContext *ctx)
 
static void rotate_bufs (SANMVideoContext *ctx, int rotate_code)
 
static av_cold int decode_init (AVCodecContext *avctx)
 
static av_cold int decode_end (AVCodecContext *avctx)
 
static int rle_decode (SANMVideoContext *ctx, uint8_t *dst, const int out_size)
 
static int old_codec1 (SANMVideoContext *ctx, int top, int left, int width, int height)
 
static void codec37_mv (uint8_t *dst, const uint8_t *src, int height, int stride, int x, int y)
 
static int old_codec37 (SANMVideoContext *ctx, int top, int left, int width, int height)
 
static int process_block (SANMVideoContext *ctx, uint8_t *dst, uint8_t *prev1, uint8_t *prev2, int stride, int tbl, int size)
 
static int old_codec47 (SANMVideoContext *ctx, int top, int left, int width, int height)
 
static int process_frame_obj (SANMVideoContext *ctx)
 
static int decode_0 (SANMVideoContext *ctx)
 
static int decode_nop (SANMVideoContext *ctx)
 
static void copy_block (uint16_t *pdest, uint16_t *psrc, int block_size, int pitch)
 
static void fill_block (uint16_t *pdest, uint16_t color, int block_size, int pitch)
 
static int draw_glyph (SANMVideoContext *ctx, uint16_t *dst, int index, uint16_t fg_color, uint16_t bg_color, int block_size, int pitch)
 
static int opcode_0xf7 (SANMVideoContext *ctx, int cx, int cy, int block_size, int pitch)
 
static int opcode_0xf8 (SANMVideoContext *ctx, int cx, int cy, int block_size, int pitch)
 
static int good_mvec (SANMVideoContext *ctx, int cx, int cy, int mx, int my, int block_size)
 
static int codec2subblock (SANMVideoContext *ctx, int cx, int cy, int blk_size)
 
static int decode_2 (SANMVideoContext *ctx)
 
static int decode_3 (SANMVideoContext *ctx)
 
static int decode_4 (SANMVideoContext *ctx)
 
static int decode_5 (SANMVideoContext *ctx)
 
static int decode_6 (SANMVideoContext *ctx)
 
static int decode_8 (SANMVideoContext *ctx)
 
static int read_frame_header (SANMVideoContext *ctx, SANMFrameHeader *hdr)
 
static void fill_frame (uint16_t *pbuf, int buf_size, uint16_t color)
 
static int copy_output (SANMVideoContext *ctx, SANMFrameHeader *hdr)
 
static int decode_frame (AVCodecContext *avctx, void *data, int *got_frame_ptr, AVPacket *pkt)
 

Variables

static const frm_decoder v1_decoders []
 
AVCodec ff_sanm_decoder
 

Macro Definition Documentation

#define NGLYPHS   256

Definition at line 34 of file sanm.c.

Referenced by draw_glyph().

Typedef Documentation

typedef int(* frm_decoder) (SANMVideoContext *ctx)

Definition at line 1086 of file sanm.c.

Enumeration Type Documentation

enum GlyphDir
Enumerator
DIR_LEFT 
DIR_UP 
DIR_RIGHT 
DIR_DOWN 
NO_DIR 

Definition at line 84 of file sanm.c.

enum GlyphEdge
Enumerator
LEFT_EDGE 
TOP_EDGE 
RIGHT_EDGE 
BOTTOM_EDGE 
NO_EDGE 

Definition at line 76 of file sanm.c.

Function Documentation

static int codec2subblock ( SANMVideoContext ctx,
int  cx,
int  cy,
int  blk_size 
)
static

Definition at line 916 of file sanm.c.

Referenced by decode_2().

static void codec37_mv ( uint8_t dst,
const uint8_t src,
int  height,
int  stride,
int  x,
int  y 
)
inlinestatic

Definition at line 379 of file sanm.c.

Referenced by old_codec37().

static void copy_block ( uint16_t *  pdest,
uint16_t *  psrc,
int  block_size,
int  pitch 
)
static

Definition at line 791 of file sanm.c.

Referenced by codec2subblock().

static int copy_output ( SANMVideoContext ctx,
SANMFrameHeader hdr 
)
static

Definition at line 1140 of file sanm.c.

Referenced by decode_frame().

static int decode_0 ( SANMVideoContext ctx)
static

Definition at line 768 of file sanm.c.

static int decode_2 ( SANMVideoContext ctx)
static

Definition at line 1002 of file sanm.c.

static int decode_3 ( SANMVideoContext ctx)
static

Definition at line 1016 of file sanm.c.

static int decode_4 ( SANMVideoContext ctx)
static

Definition at line 1022 of file sanm.c.

static int decode_5 ( SANMVideoContext ctx)
static

Definition at line 1028 of file sanm.c.

static int decode_6 ( SANMVideoContext ctx)
static

Definition at line 1049 of file sanm.c.

static int decode_8 ( SANMVideoContext ctx)
static

Definition at line 1064 of file sanm.c.

static av_cold int decode_end ( AVCodecContext avctx)
static

Definition at line 297 of file sanm.c.

static int decode_frame ( AVCodecContext avctx,
void data,
int *  got_frame_ptr,
AVPacket pkt 
)
static

Definition at line 1162 of file sanm.c.

static av_cold int decode_init ( AVCodecContext avctx)
static

Definition at line 263 of file sanm.c.

static int decode_nop ( SANMVideoContext ctx)
static

Definition at line 785 of file sanm.c.

static void destroy_buffers ( SANMVideoContext ctx)
static

Definition at line 227 of file sanm.c.

Referenced by decode_end(), and init_buffers().

static int draw_glyph ( SANMVideoContext ctx,
uint16_t *  dst,
int  index,
uint16_t  fg_color,
uint16_t  bg_color,
int  block_size,
int  pitch 
)
static

Definition at line 820 of file sanm.c.

Referenced by opcode_0xf7(), and opcode_0xf8().

static void fill_block ( uint16_t *  pdest,
uint16_t  color,
int  block_size,
int  pitch 
)
static

Definition at line 810 of file sanm.c.

Referenced by codec2subblock().

static void fill_frame ( uint16_t *  pbuf,
int  buf_size,
uint16_t  color 
)
static

Definition at line 1134 of file sanm.c.

Referenced by decode_frame().

static int good_mvec ( SANMVideoContext ctx,
int  cx,
int  cy,
int  mx,
int  my,
int  block_size 
)
static

Definition at line 900 of file sanm.c.

Referenced by codec2subblock().

static av_cold int init_buffers ( SANMVideoContext ctx)
static

Definition at line 239 of file sanm.c.

Referenced by decode_init(), and process_frame_obj().

static void init_sizes ( SANMVideoContext ctx,
int  width,
int  height 
)
static

Definition at line 214 of file sanm.c.

Referenced by decode_init(), and process_frame_obj().

static void interp_point ( int8_t *  points,
int  x0,
int  y0,
int  x1,
int  y1,
int  pos,
int  npoints 
)
static

Interpolate two points.

Definition at line 142 of file sanm.c.

Referenced by make_glyphs().

static void make_glyphs ( int8_t *  pglyphs,
const int8_t *  xvec,
const int8_t *  yvec,
const int  side_length 
)
static

Construct glyphs by iterating through vectors coordinates.

Parameters
pglyphspointer to table where glyphs are stored
xvecpointer to x component of vectors coordinates
yvecpointer to y component of vectors coordinates
side_lengthglyph width/height.

Definition at line 162 of file sanm.c.

Referenced by decode_init().

static int old_codec1 ( SANMVideoContext ctx,
int  top,
int  left,
int  width,
int  height 
)
static

Definition at line 332 of file sanm.c.

Referenced by process_frame_obj().

static int old_codec37 ( SANMVideoContext ctx,
int  top,
int  left,
int  width,
int  height 
)
static

Definition at line 398 of file sanm.c.

Referenced by process_frame_obj().

static int old_codec47 ( SANMVideoContext ctx,
int  top,
int  left,
int  width,
int  height 
)
static

Definition at line 635 of file sanm.c.

Referenced by process_frame_obj().

static int opcode_0xf7 ( SANMVideoContext ctx,
int  cx,
int  cy,
int  block_size,
int  pitch 
)
static

Definition at line 841 of file sanm.c.

Referenced by codec2subblock().

static int opcode_0xf8 ( SANMVideoContext ctx,
int  cx,
int  cy,
int  block_size,
int  pitch 
)
static

Definition at line 872 of file sanm.c.

Referenced by codec2subblock().

static int process_block ( SANMVideoContext ctx,
uint8_t dst,
uint8_t prev1,
uint8_t prev2,
int  stride,
int  tbl,
int  size 
)
static

Definition at line 545 of file sanm.c.

Referenced by old_codec47().

static int process_frame_obj ( SANMVideoContext ctx)
static

Definition at line 725 of file sanm.c.

Referenced by decode_frame().

static int read_frame_header ( SANMVideoContext ctx,
SANMFrameHeader hdr 
)
static

Definition at line 1093 of file sanm.c.

Referenced by decode_frame().

static int rle_decode ( SANMVideoContext ctx,
uint8_t dst,
const int  out_size 
)
static

Definition at line 306 of file sanm.c.

Referenced by decode_5(), decode_8(), old_codec37(), and old_codec47().

static void rotate_bufs ( SANMVideoContext ctx,
int  rotate_code 
)
static

Definition at line 255 of file sanm.c.

Referenced by decode_frame(), and old_codec37().

static enum GlyphDir which_direction ( enum GlyphEdge  edge0,
enum GlyphEdge  edge1 
)
static

Definition at line 116 of file sanm.c.

Referenced by make_glyphs().

static enum GlyphEdge which_edge ( int  x,
int  y,
int  edge_size 
)
static

Return enum GlyphEdge of box where point (x, y) lies.

Parameters
xx point coordinate
yy point coordinate
edge_sizebox width/height.

Definition at line 99 of file sanm.c.

Referenced by make_glyphs().

Variable Documentation

AVCodec ff_sanm_decoder
Initial value:
= {
.name = "sanm",
.priv_data_size = sizeof(SANMVideoContext),
.capabilities = CODEC_CAP_DR1,
.long_name = NULL_IF_CONFIG_SMALL("LucasArts SMUSH video"),
}
static av_cold int init(AVCodecContext *avctx)
Definition: avrndec.c:35
static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame_ptr, AVPacket *pkt)
Definition: sanm.c:1162
static av_cold int decode_init(AVCodecContext *avctx)
Definition: sanm.c:263
#define CODEC_CAP_DR1
Codec uses get_buffer() for allocating buffers and supports custom allocators.
static av_cold int decode_end(AVCodecContext *avctx)
Definition: sanm.c:297
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
static void close(AVCodecParserContext *s)
Definition: h264_parser.c:375
static int decode(AVCodecContext *avctx, void *data, int *got_frame, AVPacket *avpkt)
Definition: crystalhd.c:868

Definition at line 1290 of file sanm.c.

const frm_decoder v1_decoders[]
static
Initial value:
= {
}
static int decode_5(SANMVideoContext *ctx)
Definition: sanm.c:1028
static int decode_3(SANMVideoContext *ctx)
Definition: sanm.c:1016
static int decode_nop(SANMVideoContext *ctx)
Definition: sanm.c:785
static int decode_6(SANMVideoContext *ctx)
Definition: sanm.c:1049
static int decode_2(SANMVideoContext *ctx)
Definition: sanm.c:1002
static int decode_8(SANMVideoContext *ctx)
Definition: sanm.c:1064
static int decode_0(SANMVideoContext *ctx)
Definition: sanm.c:768
static int decode_4(SANMVideoContext *ctx)
Definition: sanm.c:1022

Definition at line 1088 of file sanm.c.

Referenced by decode_frame().