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

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 |
The xan_wc3 decoder outputs the following colorspaces natively: PAL8 (default), RGB555, RGB565, RGB24, BGR24, RGBA32, YUV444P
Definition in file xan.c.
| #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().
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().
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 U_B (SCALEFACTOR * 0.50000) |
| #define U_G (SCALEFACTOR * -0.33126) |
| #define U_R (SCALEFACTOR * -0.16874) |
| #define V_B (SCALEFACTOR * -0.08131) |
| #define V_G (SCALEFACTOR * -0.41869) |
| #define V_R (SCALEFACTOR * 0.50000) |
| #define Y_B (SCALEFACTOR * 0.11400) |
| #define Y_G (SCALEFACTOR * 0.58700) |
| #define Y_R (SCALEFACTOR * 0.29900) |
| static void bytecopy | ( | unsigned char * | dest, | |
| unsigned char * | src, | |||
| int | count | |||
| ) | [inline, static] |
| 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.

| static int xan_decode_frame | ( | AVCodecContext * | avctx, | |
| void * | data, | |||
| int * | data_size, | |||
| uint8_t * | buf, | |||
| int | buf_size | |||
| ) | [static] |
Definition at line 742 of file xan.c.
References av_log(), AV_LOG_ERROR, XanContext::avctx, XanContext::buf, AVCodecContext::codec, CODEC_ID_XAN_WC3, CODEC_ID_XAN_WC4, XanContext::current_frame, AVCodecContext::get_buffer, AVCodec::id, XanContext::last_frame, AVCodecContext::palctrl, AVPaletteControl::palette, AVPaletteControl::palette_changed, AVCodecContext::pix_fmt, PIX_FMT_PAL8, AVCodecContext::priv_data, AVCodecContext::release_buffer, s, XanContext::size, xan_wc3_build_palette(), xan_wc3_decode_frame(), and xan_wc4_decode_frame().

| static int xan_decode_init | ( | AVCodecContext * | avctx | ) | [static] |
Definition at line 103 of file xan.c.
References av_log(), AV_LOG_ERROR, av_malloc(), avcodec_check_dimensions(), XanContext::avctx, XanContext::buffer1, XanContext::buffer2, AVCodecContext::codec, CODEC_ID_XAN_WC3, XanContext::dsp, dsputil_init(), AVCodecContext::has_b_frames, AVCodecContext::height, AVCodec::id, NULL, AVCodecContext::palctrl, AVCodecContext::pix_fmt, PIX_FMT_PAL8, AVCodecContext::priv_data, s, U_B, u_b_table, U_G, u_g_table, U_R, u_r_table, V_B, v_b_table, V_G, v_g_table, V_R, v_r_table, AVCodecContext::width, Y_B, y_b_table, Y_G, y_g_table, Y_R, and y_r_table.

| static int xan_huffman_decode | ( | unsigned char * | dest, | |
| unsigned char * | src | |||
| ) | [static] |
| 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().

| static void xan_wc3_build_palette | ( | XanContext * | s, | |
| unsigned int * | palette_data | |||
| ) | [inline, static] |
Definition at line 250 of file xan.c.
References av_log(), AV_LOG_ERROR, XanContext::avctx, b, COMPUTE_U, COMPUTE_V, COMPUTE_Y, memcpy, XanContext::palette, PALETTE_COUNT, AVCodecContext::pix_fmt, PIX_FMT_BGR24, PIX_FMT_PAL8, PIX_FMT_RGB24, PIX_FMT_RGB555, PIX_FMT_RGB565, PIX_FMT_RGBA32, PIX_FMT_YUV444P, and r.
Referenced by xan_decode_frame().

| static void xan_wc3_copy_pixel_run | ( | XanContext * | s, | |
| int | x, | |||
| int | y, | |||
| int | pixel_count, | |||
| int | motion_x, | |||
| int | motion_y | |||
| ) | [inline, static] |
Definition at line 475 of file xan.c.
References ADVANCE_CURFRAME_X, ADVANCE_PREVFRAME_X, av_log(), AV_LOG_ERROR, XanContext::avctx, XanContext::current_frame, XanContext::last_frame, AVCodecContext::pix_fmt, PIX_FMT_BGR24, PIX_FMT_PAL8, PIX_FMT_RGB24, PIX_FMT_RGB555, PIX_FMT_RGB565, PIX_FMT_RGBA32, PIX_FMT_YUV444P, stride, AVCodecContext::width, and width.
Referenced by xan_wc3_decode_frame().

| static void xan_wc3_decode_frame | ( | XanContext * | s | ) | [static] |
Definition at line 604 of file xan.c.
References XanContext::avctx, BE_16, XanContext::buf, XanContext::buffer1, XanContext::buffer2, XanContext::current_frame, AVCodecContext::height, height, LE_16, memcpy, AVCodecContext::palctrl, XanContext::palette, AVPaletteControl::palette_changed, PALETTE_COUNT, AVCodecContext::pix_fmt, PIX_FMT_PAL8, AVCodecContext::width, width, xan_huffman_decode(), xan_unpack(), xan_wc3_copy_pixel_run(), and xan_wc3_output_pixel_run().
Referenced by xan_decode_frame().

| static void xan_wc3_output_pixel_run | ( | XanContext * | s, | |
| unsigned char * | pixel_buffer, | |||
| int | x, | |||
| int | y, | |||
| int | pixel_count | |||
| ) | [inline, static] |
Definition at line 349 of file xan.c.
References ADVANCE_CURRENT_X, av_log(), AV_LOG_ERROR, XanContext::avctx, XanContext::current_frame, XanContext::palette, AVCodecContext::pix_fmt, PIX_FMT_BGR24, PIX_FMT_PAL8, PIX_FMT_RGB24, PIX_FMT_RGB555, PIX_FMT_RGB565, PIX_FMT_RGBA32, PIX_FMT_YUV444P, stride, AVCodecContext::width, and width.
Referenced by xan_wc3_decode_frame().

| static void xan_wc4_decode_frame | ( | XanContext * | s | ) | [static] |
int u_b_table[256] [static] |
int u_g_table[256] [static] |
int u_r_table[256] [static] |
int v_b_table[256] [static] |
int v_g_table[256] [static] |
int v_r_table[256] [static] |
Initial value:
{
"xan_wc3",
CODEC_TYPE_VIDEO,
CODEC_ID_XAN_WC3,
sizeof(XanContext),
xan_decode_init,
NULL,
xan_decode_end,
xan_decode_frame,
CODEC_CAP_DR1,
}
Definition at line 800 of file xan.c.
Referenced by avcodec_register_all().
int y_b_table[256] [static] |
int y_g_table[256] [static] |
int y_r_table[256] [static] |
1.5.5