libavcodec/xan.c File Reference
Xan video decoder for Wing Commander III computer game by Mario Brito (
mbrito@student.dei.uc.pt) and Mike Melanson (
melanson@pcisys.net).
More...
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "libavutil/intreadwrite.h"
#include "avcodec.h"
#include "bytestream.h"
#include "get_bits.h"
#include "libavutil/lzo.h"
Go to the source code of this file.
|
Data Structures |
struct | XanContext |
Defines |
#define | ALT_BITSTREAM_READER_LE |
#define | RUNTIME_GAMMA 0 |
#define | VGA__TAG MKTAG('V', 'G', 'A', ' ') |
#define | PALT_TAG MKTAG('P', 'A', 'L', 'T') |
#define | SHOT_TAG MKTAG('S', 'H', 'O', 'T') |
#define | PALETTE_COUNT 256 |
#define | PALETTE_SIZE (PALETTE_COUNT * 3) |
#define | PALETTES_MAX 256 |
Functions |
static av_cold int | xan_decode_init (AVCodecContext *avctx) |
static int | xan_huffman_decode (unsigned char *dest, int dest_len, const unsigned char *src, int src_len) |
static void | xan_unpack (unsigned char *dest, int dest_len, const unsigned char *src, int src_len) |
| unpack simple compression
|
static void | xan_wc3_output_pixel_run (XanContext *s, const 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 int | xan_wc3_decode_frame (XanContext *s) |
static int | xan_decode_frame (AVCodecContext *avctx, void *data, int *data_size, AVPacket *avpkt) |
static av_cold int | xan_decode_end (AVCodecContext *avctx) |
Variables |
static const uint8_t | gamma_lookup [256] |
| This is a gamma correction that xan3 applies to all palette entries.
|
AVCodec | ff_xan_wc3_decoder |
Detailed Description
Xan video decoder for Wing Commander III computer game by Mario Brito (
mbrito@student.dei.uc.pt) and Mike Melanson (
melanson@pcisys.net).
The xan_wc3 decoder outputs PAL8 data.
Definition in file xan.c.
Define Documentation
#define ALT_BITSTREAM_READER_LE |
Definition at line 38 of file xan.c.
#define PALETTE_COUNT 256 |
Definition at line 48 of file xan.c.
#define PALETTE_SIZE (PALETTE_COUNT * 3) |
#define PALT_TAG MKTAG('P', 'A', 'L', 'T') |
Definition at line 43 of file xan.c.
#define SHOT_TAG MKTAG('S', 'H', 'O', 'T') |
#define VGA__TAG MKTAG('V', 'G', 'A', ' ') |
Function Documentation
static int xan_decode_frame |
( |
AVCodecContext * |
avctx, |
|
|
void * |
data, |
|
|
int * |
data_size, |
|
|
AVPacket * |
avpkt | |
|
) |
| | [static] |
static av_cold int xan_decode_init |
( |
AVCodecContext * |
avctx |
) |
[static] |
Definition at line 75 of file xan.c.
static int xan_huffman_decode |
( |
unsigned char * |
dest, |
|
|
int |
dest_len, |
|
|
const unsigned char * |
src, |
|
|
int |
src_len | |
|
) |
| | [static] |
static void xan_unpack |
( |
unsigned char * |
dest, |
|
|
int |
dest_len, |
|
|
const unsigned char * |
src, |
|
|
int |
src_len | |
|
) |
| | [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 int xan_wc3_decode_frame |
( |
XanContext * |
s |
) |
[static] |
static void xan_wc3_output_pixel_run |
( |
XanContext * |
s, |
|
|
const unsigned char * |
pixel_buffer, |
|
|
int |
x, |
|
|
int |
y, |
|
|
int |
pixel_count | |
|
) |
| | [inline, static] |
Variable Documentation
Initial value:
Definition at line 614 of file xan.c.
This is a gamma correction that xan3 applies to all palette entries.
There is a peculiarity, namely that the values are clamped to 253 - it seems likely that this table was calculated by a buggy fixed-point implementation, the one above under RUNTIME_GAMMA behaves like this for example. The exponent value of 0.8 can be explained by this as well, since 0.8 = 4/5 and thus pow(x, 0.8) is still easy to calculate. Also, the input values are first rotated to the left by 2.
Definition at line 461 of file xan.c.