hvirtual/quicktime/ffmpeg/libavcodec/xan.c File Reference

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include "common.h"
#include "avcodec.h"
#include "dsputil.h"

Include dependency graph for xan.c:

Go to the source code of this file.

Data Structures

struct  XanContext

Defines

#define PALETTE_COUNT   256
#define PALETTE_CONTROL_SIZE   ((256 * 3) + 1)
#define SCALEFACTOR   65536
#define CENTERSAMPLE   128
#define COMPUTE_Y(r, g, b)
#define COMPUTE_U(r, g, b)
#define COMPUTE_V(r, g, b)
#define Y_R   (SCALEFACTOR * 0.29900)
#define Y_G   (SCALEFACTOR * 0.58700)
#define Y_B   (SCALEFACTOR * 0.11400)
#define U_R   (SCALEFACTOR * -0.16874)
#define U_G   (SCALEFACTOR * -0.33126)
#define U_B   (SCALEFACTOR * 0.50000)
#define V_R   (SCALEFACTOR * 0.50000)
#define V_G   (SCALEFACTOR * -0.41869)
#define V_B   (SCALEFACTOR * -0.08131)
#define ADVANCE_CURRENT_X()
#define ADVANCE_CURFRAME_X()
#define ADVANCE_PREVFRAME_X()

Functions

static int xan_decode_init (AVCodecContext *avctx)
static void bytecopy (unsigned char *dest, unsigned char *src, int count)
static int xan_huffman_decode (unsigned char *dest, unsigned char *src)
static void xan_unpack (unsigned char *dest, unsigned char *src)
static void xan_wc3_build_palette (XanContext *s, unsigned int *palette_data)
static void xan_wc3_output_pixel_run (XanContext *s, unsigned char *pixel_buffer, int x, int y, int pixel_count)
static void xan_wc3_copy_pixel_run (XanContext *s, int x, int y, int pixel_count, int motion_x, int motion_y)
static void xan_wc3_decode_frame (XanContext *s)
static void xan_wc4_decode_frame (XanContext *s)
static int xan_decode_frame (AVCodecContext *avctx, void *data, int *data_size, uint8_t *buf, int buf_size)
static int xan_decode_end (AVCodecContext *avctx)

Variables

static int y_r_table [256]
static int y_g_table [256]
static int y_b_table [256]
static int u_r_table [256]
static int u_g_table [256]
static int u_b_table [256]
static int v_r_table [256]
static int v_g_table [256]
static int v_b_table [256]
AVCodec xan_wc3_decoder


Detailed Description

Xan video decoder for Wing Commander III & IV computer games by Mario Brito (mbrito@student.dei.uc.pt) and Mike Melanson (melanson@pcisys.net)

The xan_wc3 decoder outputs the following colorspaces natively: PAL8 (default), RGB555, RGB565, RGB24, BGR24, RGBA32, YUV444P

Definition in file xan.c.


Define Documentation

 
#define ADVANCE_CURFRAME_X (  ) 

Value:

curframe_x++; \
    if (curframe_x >= width) { \
        curframe_index += line_inc; \
        curframe_x = 0; \
    }

Definition at line 461 of file xan.c.

Referenced by xan_wc3_copy_pixel_run().

 
#define ADVANCE_CURRENT_X (  ) 

Value:

current_x++; \
    if (current_x >= width) { \
        index += line_inc; \
        current_x = 0; \
    }

Definition at line 342 of file xan.c.

Referenced by xan_wc3_output_pixel_run().

 
#define ADVANCE_PREVFRAME_X (  ) 

Value:

prevframe_x++; \
    if (prevframe_x >= width) { \
        prevframe_index += line_inc; \
        prevframe_x = 0; \
    }

Definition at line 468 of file xan.c.

Referenced by xan_wc3_copy_pixel_run().

#define CENTERSAMPLE   128

Definition at line 63 of file xan.c.

#define COMPUTE_U ( r,
g,
b   ) 

Value:

(unsigned char) \
  ((u_r_table[r] + u_g_table[g] + u_b_table[b]) / SCALEFACTOR + CENTERSAMPLE)

Definition at line 68 of file xan.c.

Referenced by xan_wc3_build_palette().

#define COMPUTE_V ( r,
g,
b   ) 

Value:

(unsigned char) \
  ((v_r_table[r] + v_g_table[g] + v_b_table[b]) / SCALEFACTOR + CENTERSAMPLE)

Definition at line 71 of file xan.c.

Referenced by xan_wc3_build_palette().

#define COMPUTE_Y ( r,
g,
b   ) 

Value:

(unsigned char) \
  ((y_r_table[r] + y_g_table[g] + y_b_table[b]) / SCALEFACTOR)

Definition at line 65 of file xan.c.

Referenced by xan_wc3_build_palette().

#define PALETTE_CONTROL_SIZE   ((256 * 3) + 1)

Definition at line 41 of file xan.c.

#define PALETTE_COUNT   256

Definition at line 40 of file xan.c.

#define SCALEFACTOR   65536

Definition at line 62 of file xan.c.

#define U_B   (SCALEFACTOR * 0.50000)

Definition at line 81 of file xan.c.

Referenced by xan_decode_init().

#define U_G   (SCALEFACTOR * -0.33126)

Definition at line 80 of file xan.c.

Referenced by xan_decode_init().

#define U_R   (SCALEFACTOR * -0.16874)

Definition at line 79 of file xan.c.

Referenced by xan_decode_init().

#define V_B   (SCALEFACTOR * -0.08131)

Definition at line 85 of file xan.c.

Referenced by xan_decode_init().

#define V_G   (SCALEFACTOR * -0.41869)

Definition at line 84 of file xan.c.

Referenced by xan_decode_init().

#define V_R   (SCALEFACTOR * 0.50000)

Definition at line 83 of file xan.c.

Referenced by xan_decode_init().

#define Y_B   (SCALEFACTOR * 0.11400)

Definition at line 77 of file xan.c.

Referenced by xan_decode_init().

#define Y_G   (SCALEFACTOR * 0.58700)

Definition at line 76 of file xan.c.

Referenced by xan_decode_init().

#define Y_R   (SCALEFACTOR * 0.29900)

Definition at line 75 of file xan.c.

Referenced by xan_decode_init().


Function Documentation

static void bytecopy ( unsigned char *  dest,
unsigned char *  src,
int  count 
) [inline, static]

Definition at line 151 of file xan.c.

Referenced by xan_unpack().

static int xan_decode_end ( AVCodecContext avctx  )  [static]

Definition at line 787 of file xan.c.

References av_free(), XanContext::buffer1, XanContext::buffer2, XanContext::last_frame, AVCodecContext::priv_data, AVCodecContext::release_buffer, and s.

Here is the call graph for this function:

static int xan_decode_frame ( AVCodecContext avctx,
void *  data,
int *  data_size,
uint8_t *  buf,
int  buf_size 
) [static]

static int xan_decode_init ( AVCodecContext avctx  )  [static]

static int xan_huffman_decode ( unsigned char *  dest,
unsigned char *  src 
) [static]

Definition at line 159 of file xan.c.

References bits.

Referenced by xan_wc3_decode_frame().

static void xan_unpack ( unsigned char *  dest,
unsigned char *  src 
) [static]

Definition at line 189 of file xan.c.

References bytecopy(), and offset.

Referenced by xan_wc3_decode_frame().

Here is the call graph for this function:

static void xan_wc3_build_palette ( XanContext s,
unsigned int *  palette_data 
) [inline, static]

static void xan_wc3_copy_pixel_run ( XanContext s,
int  x,
int  y,
int  pixel_count,
int  motion_x,
int  motion_y 
) [inline, static]

static void xan_wc3_decode_frame ( XanContext s  )  [static]

static void xan_wc3_output_pixel_run ( XanContext s,
unsigned char *  pixel_buffer,
int  x,
int  y,
int  pixel_count 
) [inline, static]

static void xan_wc4_decode_frame ( XanContext s  )  [static]

Definition at line 739 of file xan.c.

Referenced by xan_decode_frame().


Variable Documentation

int u_b_table[256] [static]

Definition at line 97 of file xan.c.

Referenced by xan_decode_init().

int u_g_table[256] [static]

Definition at line 96 of file xan.c.

Referenced by xan_decode_init().

int u_r_table[256] [static]

Definition at line 95 of file xan.c.

Referenced by xan_decode_init().

int v_b_table[256] [static]

Definition at line 101 of file xan.c.

Referenced by xan_decode_init().

int v_g_table[256] [static]

Definition at line 100 of file xan.c.

Referenced by xan_decode_init().

int v_r_table[256] [static]

Definition at line 99 of file xan.c.

Referenced by xan_decode_init().

Initial value:

Definition at line 800 of file xan.c.

Referenced by avcodec_register_all().

int y_b_table[256] [static]

Definition at line 93 of file xan.c.

Referenced by xan_decode_init().

int y_g_table[256] [static]

Definition at line 92 of file xan.c.

Referenced by xan_decode_init().

int y_r_table[256] [static]

Definition at line 91 of file xan.c.

Referenced by xan_decode_init().


Generated on Mon Apr 28 14:06:46 2008 for Cinelerra by  doxygen 1.5.5