Xan video decoder for Wing Commander III computer game by Mario Brito (mbrit.nosp@m.o@st.nosp@m.udent.nosp@m..dei.nosp@m..uc.p.nosp@m.t) and Mike Melanson (melan.nosp@m.son@.nosp@m.pcisy.nosp@m.s.ne.nosp@m.t)
More...
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "libavutil/intreadwrite.h"
#include "libavutil/mem.h"
#include "avcodec.h"
#include "bytestream.h"
#include "get_bits.h"
#include "internal.h"
Go to the source code of this file.
|
static av_cold int | xan_decode_end (AVCodecContext *avctx) |
|
static av_cold int | xan_decode_init (AVCodecContext *avctx) |
|
static int | xan_huffman_decode (uint8_t *dest, int dest_len, const uint8_t *src, int src_len) |
|
static void | xan_unpack (uint8_t *dest, int dest_len, const uint8_t *src, int src_len) |
| unpack simple compression More...
|
|
static void | xan_wc3_output_pixel_run (XanContext *s, AVFrame *frame, const uint8_t *pixel_buffer, int x, int y, int pixel_count) |
|
static void | xan_wc3_copy_pixel_run (XanContext *s, AVFrame *frame, int x, int y, int pixel_count, int motion_x, int motion_y) |
|
static int | xan_wc3_decode_frame (XanContext *s, AVFrame *frame) |
|
static int | xan_decode_frame (AVCodecContext *avctx, void *data, int *got_frame, AVPacket *avpkt) |
|
Xan video decoder for Wing Commander III computer game by Mario Brito (mbrit.nosp@m.o@st.nosp@m.udent.nosp@m..dei.nosp@m..uc.p.nosp@m.t) and Mike Melanson (melan.nosp@m.son@.nosp@m.pcisy.nosp@m.s.ne.nosp@m.t)
The xan_wc3 decoder outputs PAL8 data.
Definition in file xan.c.
◆ BITSTREAM_READER_LE
#define BITSTREAM_READER_LE |
Definition at line 38 of file xan.c.
◆ RUNTIME_GAMMA
Definition at line 44 of file xan.c.
◆ VGA__TAG
#define VGA__TAG MKTAG('V', 'G', 'A', ' ') |
Definition at line 46 of file xan.c.
◆ PALT_TAG
Definition at line 47 of file xan.c.
◆ SHOT_TAG
#define SHOT_TAG MKTAG('S', 'H', 'O', 'T') |
Definition at line 48 of file xan.c.
◆ PALETTE_COUNT
#define PALETTE_COUNT 256 |
Definition at line 49 of file xan.c.
◆ PALETTE_SIZE
Definition at line 50 of file xan.c.
◆ PALETTES_MAX
Definition at line 51 of file xan.c.
◆ xan_decode_end()
Definition at line 75 of file xan.c.
◆ xan_decode_init()
Definition at line 88 of file xan.c.
◆ xan_huffman_decode()
◆ xan_unpack()
unpack simple compression
- Parameters
-
dest | destination buffer of dest_len, must be padded with at least 130 bytes |
Definition at line 154 of file xan.c.
Referenced by xan_wc3_decode_frame().
◆ xan_wc3_output_pixel_run()
◆ xan_wc3_copy_pixel_run()
◆ xan_wc3_decode_frame()
◆ xan_decode_frame()
◆ gamma_lookup
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 504 of file xan.c.
Referenced by xan_decode_frame().
◆ ff_xan_wc3_decoder
Initial value:= {
.name = "xan_wc3",
}
static av_cold int init(AVCodecContext *avctx)
static void decode(AVCodecContext *dec_ctx, AVPacket *pkt, AVFrame *frame, FILE *outfile)
#define AV_CODEC_CAP_DR1
Codec uses get_buffer() or get_encode_buffer() for allocating buffers and supports custom allocators.
#define FF_CODEC_CAP_INIT_THREADSAFE
The codec does not modify any global variables in the init function, allowing to call the init functi...
#define FF_CODEC_CAP_INIT_CLEANUP
The codec allows calling the close function for deallocation even if the init function returned a fai...
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
static av_cold int xan_decode_init(AVCodecContext *avctx)
static av_cold int xan_decode_end(AVCodecContext *avctx)
static int xan_decode_frame(AVCodecContext *avctx, void *data, int *got_frame, AVPacket *avpkt)
Definition at line 638 of file xan.c.