#include "common.h"#include "bitstream.h"#include "avcodec.h"#include "dsputil.h"

Go to the source code of this file.
Data Structures | |
| struct | HYuvContext |
Defines | |
| #define | VLC_BITS 11 |
| #define | B 0 |
| #define | G 1 |
| #define | R 2 |
Enumerations | |
| enum | Predictor { LEFT = 0, PLANE, MEDIAN } |
Functions | |
| static int | add_left_prediction (uint8_t *dst, uint8_t *src, int w, int acc) |
| static void | add_median_prediction (uint8_t *dst, uint8_t *src1, uint8_t *diff, int w, int *left, int *left_top) |
| static void | add_left_prediction_bgr32 (uint8_t *dst, uint8_t *src, int w, int *red, int *green, int *blue) |
| static int | sub_left_prediction (HYuvContext *s, uint8_t *dst, uint8_t *src, int w, int left) |
| static void | read_len_table (uint8_t *dst, GetBitContext *gb) |
| static int | generate_bits_table (uint32_t *dst, uint8_t *len_table) |
| static void | generate_len_table (uint8_t *dst, uint64_t *stats, int size) |
| static int | read_huffman_tables (HYuvContext *s, uint8_t *src, int length) |
| static int | read_old_huffman_tables (HYuvContext *s) |
| static void | alloc_temp (HYuvContext *s) |
| static int | common_init (AVCodecContext *avctx) |
| static int | decode_init (AVCodecContext *avctx) |
| static int | store_table (HYuvContext *s, uint8_t *len, uint8_t *buf) |
| static int | encode_init (AVCodecContext *avctx) |
| static void | decode_422_bitstream (HYuvContext *s, int count) |
| static void | decode_gray_bitstream (HYuvContext *s, int count) |
| static int | encode_422_bitstream (HYuvContext *s, int count) |
| static int | encode_gray_bitstream (HYuvContext *s, int count) |
| static void | decode_bgr_bitstream (HYuvContext *s, int count) |
| static void | draw_slice (HYuvContext *s, int y) |
| static int | decode_frame (AVCodecContext *avctx, void *data, int *data_size, uint8_t *buf, int buf_size) |
| static int | common_end (HYuvContext *s) |
| static int | decode_end (AVCodecContext *avctx) |
| static int | encode_frame (AVCodecContext *avctx, unsigned char *buf, int buf_size, void *data) |
| static int | encode_end (AVCodecContext *avctx) |
Variables | |
| static const unsigned char | classic_shift_luma [] |
| static const unsigned char | classic_shift_chroma [] |
| static const unsigned char | classic_add_luma [256] |
| static const unsigned char | classic_add_chroma [256] |
| AVCodec | huffyuv_decoder |
| AVCodec | ffvhuff_decoder |
Definition in file huffyuv.c.
| #define B 0 |
Definition at line 41 of file huffyuv.c.
Referenced by add_left_prediction_bgr32(), decode_bgr_bitstream(), decode_frame(), gmc1_altivec(), gmc1_c(), gmc_c(), h263_pred_motion(), horizX1Filter(), ipvideo_decode_block_opcode_0x2(), ipvideo_decode_block_opcode_0x3(), ipvideo_decode_block_opcode_0x4(), ipvideo_decode_block_opcode_0x7(), ipvideo_decode_block_opcode_0x8(), ipvideo_decode_block_opcode_0x9(), ipvideo_decode_block_opcode_0xA(), pred_16x8_motion(), pred_motion(), and wmv2_pred_motion().
| #define G 1 |
Definition at line 42 of file huffyuv.c.
Referenced by add_left_prediction_bgr32(), decode_bgr_bitstream(), and decode_frame().
| #define R 2 |
Definition at line 43 of file huffyuv.c.
Referenced by add_left_prediction_bgr32(), decode_bgr_bitstream(), and decode_frame().
| static int add_left_prediction | ( | uint8_t * | dst, | |
| uint8_t * | src, | |||
| int | w, | |||
| int | acc | |||
| ) | [inline, static] |
| static void add_left_prediction_bgr32 | ( | uint8_t * | dst, | |
| uint8_t * | src, | |||
| int | w, | |||
| int * | red, | |||
| int * | green, | |||
| int * | blue | |||
| ) | [inline, static] |
| static void add_median_prediction | ( | uint8_t * | dst, | |
| uint8_t * | src1, | |||
| uint8_t * | diff, | |||
| int | w, | |||
| int * | left, | |||
| int * | left_top | |||
| ) | [inline, static] |
| static void alloc_temp | ( | HYuvContext * | s | ) | [static] |
Definition at line 351 of file huffyuv.c.
References av_malloc(), HYuvContext::bitstream_bpp, HYuvContext::temp, and HYuvContext::width.
Referenced by decode_init(), and encode_init().

| static int common_end | ( | HYuvContext * | s | ) | [static] |
Definition at line 1018 of file huffyuv.c.
References av_freep(), and HYuvContext::temp.

| static int common_init | ( | AVCodecContext * | avctx | ) | [static] |
Definition at line 363 of file huffyuv.c.
References HYuvContext::avctx, HYuvContext::dsp, dsputil_init(), AVCodecContext::flags, HYuvContext::flags, AVCodecContext::height, HYuvContext::height, AVCodecContext::priv_data, s, AVCodecContext::width, and HYuvContext::width.

| static void decode_422_bitstream | ( | HYuvContext * | s, | |
| int | count | |||
| ) | [static] |
Definition at line 619 of file huffyuv.c.
References HYuvContext::gb, get_vlc2(), VLC::table, HYuvContext::temp, HYuvContext::vlc, and VLC_BITS.
Referenced by decode_frame().

| static void decode_bgr_bitstream | ( | HYuvContext * | s, | |
| int | count | |||
| ) | [static] |
Definition at line 718 of file huffyuv.c.
References B, HYuvContext::bitstream_bpp, HYuvContext::decorrelate, G, HYuvContext::gb, get_vlc2(), R, VLC::table, HYuvContext::temp, HYuvContext::vlc, and VLC_BITS.
Referenced by decode_frame().

| static int decode_end | ( | AVCodecContext * | avctx | ) | [static] |
Definition at line 1027 of file huffyuv.c.
References av_freep(), HYuvContext::bitstream_buffer, common_end(), free_vlc(), AVCodecContext::priv_data, s, and HYuvContext::vlc.

| static int decode_frame | ( | AVCodecContext * | avctx, | |
| void * | data, | |||
| int * | data_size, | |||
| uint8_t * | buf, | |||
| int | buf_size | |||
| ) | [static] |
Definition at line 781 of file huffyuv.c.
References DSPContext::add_bytes, add_left_prediction(), add_left_prediction_bgr32(), add_median_prediction(), av_fast_realloc(), av_log(), AV_LOG_ERROR, B, HYuvContext::bgr32, HYuvContext::bitstream_bpp, HYuvContext::bitstream_buffer, HYuvContext::bitstream_buffer_size, DSPContext::bswap_buf, CODEC_FLAG_GRAY, HYuvContext::context, decode_422_bitstream(), decode_bgr_bitstream(), decode_gray_bitstream(), draw_slice(), HYuvContext::dsp, emms_c, FF_INPUT_BUFFER_PADDING_SIZE, HYuvContext::flags, G, HYuvContext::gb, get_bits(), get_bits_count(), AVCodecContext::get_buffer, HYuvContext::height, height, init_get_bits(), HYuvContext::interlaced, HYuvContext::last_slice_end, LEFT, MEDIAN, picture, HYuvContext::picture, PLANE, HYuvContext::predictor, AVCodecContext::priv_data, R, read_huffman_tables(), AVCodecContext::release_buffer, s, skip_bits(), HYuvContext::temp, HYuvContext::width, width, width2, and HYuvContext::yuy2.

| static void decode_gray_bitstream | ( | HYuvContext * | s, | |
| int | count | |||
| ) | [static] |
Definition at line 632 of file huffyuv.c.
References HYuvContext::gb, get_vlc2(), VLC::table, HYuvContext::temp, HYuvContext::vlc, and VLC_BITS.
Referenced by decode_frame().

| static int decode_init | ( | AVCodecContext * | avctx | ) | [static] |
Definition at line 378 of file huffyuv.c.
References alloc_temp(), HYuvContext::bgr32, AVCodecContext::bits_per_sample, HYuvContext::bitstream_bpp, AVCodecContext::coded_frame, common_init(), HYuvContext::context, HYuvContext::decorrelate, AVCodecContext::extradata, AVCodecContext::extradata_size, HYuvContext::height, HYuvContext::interlaced, LEFT, MEDIAN, HYuvContext::picture, AVCodecContext::pix_fmt, PIX_FMT_BGR24, PIX_FMT_RGBA32, PIX_FMT_YUV420P, PIX_FMT_YUV422, PIX_FMT_YUV422P, PLANE, HYuvContext::predictor, AVCodecContext::priv_data, read_huffman_tables(), read_old_huffman_tables(), s, HYuvContext::version, HYuvContext::vlc, and HYuvContext::yuy2.

| static void draw_slice | ( | HYuvContext * | s, | |
| int | y | |||
| ) | [static] |
Definition at line 754 of file huffyuv.c.
References HYuvContext::avctx, HYuvContext::bitstream_bpp, AVCodecContext::draw_horiz_band, emms_c, HYuvContext::last_slice_end, NULL, offset, and HYuvContext::picture.
Referenced by decode_frame().
| static int encode_422_bitstream | ( | HYuvContext * | s, | |
| int | count | |||
| ) | [static] |
Definition at line 643 of file huffyuv.c.
References av_log(), AV_LOG_ERROR, HYuvContext::avctx, HYuvContext::bits, PutBitContext::buf, PutBitContext::buf_end, CODEC_FLAG2_NO_OUTPUT, CODEC_FLAG_PASS1, HYuvContext::context, HYuvContext::flags, AVCodecContext::flags2, HYuvContext::len, HYuvContext::pb, put_bits(), put_bits_count(), HYuvContext::stats, and HYuvContext::temp.
Referenced by encode_frame().

| static int encode_end | ( | AVCodecContext * | avctx | ) | [static] |
Definition at line 1210 of file huffyuv.c.
References av_freep(), common_end(), AVCodecContext::extradata, AVCodecContext::priv_data, s, and AVCodecContext::stats_out.

| static int encode_frame | ( | AVCodecContext * | avctx, | |
| unsigned char * | buf, | |||
| int | buf_size, | |||
| void * | data | |||
| ) | [static] |
Definition at line 1042 of file huffyuv.c.
References av_log(), AV_LOG_ERROR, HYuvContext::avctx, HYuvContext::bits, HYuvContext::bitstream_bpp, DSPContext::bswap_buf, CODEC_FLAG2_NO_OUTPUT, CODEC_FLAG_PASS1, HYuvContext::context, DSPContext::diff_bytes, HYuvContext::dsp, emms_c, encode_422_bitstream(), encode_gray_bitstream(), FF_I_TYPE, HYuvContext::flags, AVCodecContext::flags2, flush_put_bits(), generate_bits_table(), generate_len_table(), HYuvContext::height, height, init_put_bits(), HYuvContext::interlaced, HYuvContext::len, MEDIAN, HYuvContext::pb, HYuvContext::picture, HYuvContext::picture_number, AVCodecContext::pix_fmt, PIX_FMT_YUV420P, PIX_FMT_YUV422P, PLANE, HYuvContext::predictor, AVCodecContext::priv_data, put_bits(), put_bits_count(), s, HYuvContext::stats, AVCodecContext::stats_out, store_table(), DSPContext::sub_hfyu_median_prediction, sub_left_prediction(), HYuvContext::temp, HYuvContext::width, width, and width2.

| static int encode_gray_bitstream | ( | HYuvContext * | s, | |
| int | count | |||
| ) | [static] |
Definition at line 684 of file huffyuv.c.
References av_log(), AV_LOG_ERROR, HYuvContext::avctx, HYuvContext::bits, PutBitContext::buf, PutBitContext::buf_end, CODEC_FLAG2_NO_OUTPUT, CODEC_FLAG_PASS1, HYuvContext::context, HYuvContext::flags, AVCodecContext::flags2, HYuvContext::len, HYuvContext::pb, put_bits(), put_bits_count(), HYuvContext::stats, and HYuvContext::temp.
Referenced by encode_frame().

| static int encode_init | ( | AVCodecContext * | avctx | ) | [static] |
Definition at line 497 of file huffyuv.c.
References alloc_temp(), av_log(), AV_LOG_ERROR, AV_LOG_INFO, av_mallocz(), HYuvContext::avctx, HYuvContext::bits, AVCodecContext::bits_per_sample, HYuvContext::bitstream_bpp, AVCodecContext::codec, CODEC_FLAG_INTERLACED_ME, CODEC_FLAG_PASS1, CODEC_FLAG_PASS2, CODEC_ID_HUFFYUV, AVCodecContext::coded_frame, common_init(), HYuvContext::context, AVCodecContext::context_model, HYuvContext::decorrelate, AVCodecContext::extradata, AVCodecContext::extradata_size, FF_COMPLIANCE_EXPERIMENTAL, HYuvContext::flags, AVCodecContext::flags, generate_bits_table(), generate_len_table(), HYuvContext::height, AVCodec::id, HYuvContext::interlaced, HYuvContext::len, HYuvContext::picture, HYuvContext::picture_number, AVCodecContext::pix_fmt, PIX_FMT_YUV420P, PIX_FMT_YUV422P, AVCodecContext::prediction_method, HYuvContext::predictor, AVCodecContext::priv_data, s, HYuvContext::stats, AVCodecContext::stats_in, AVCodecContext::stats_out, store_table(), AVCodecContext::strict_std_compliance, HYuvContext::version, and HYuvContext::width.

| static int generate_bits_table | ( | uint32_t * | dst, | |
| uint8_t * | len_table | |||
| ) | [static] |
Definition at line 221 of file huffyuv.c.
References av_log(), AV_LOG_ERROR, bits, and NULL.
Referenced by encode_frame(), encode_init(), and read_huffman_tables().

| static void generate_len_table | ( | uint8_t * | dst, | |
| uint64_t * | stats, | |||
| int | size | |||
| ) | [static] |
Definition at line 239 of file huffyuv.c.
References INT64_MAX, and offset.
Referenced by encode_frame(), and encode_init().
| static int read_huffman_tables | ( | HYuvContext * | s, | |
| uint8_t * | src, | |||
| int | length | |||
| ) | [static] |
Definition at line 295 of file huffyuv.c.
References HYuvContext::bits, free_vlc(), generate_bits_table(), get_bits_count(), init_get_bits(), init_vlc(), HYuvContext::len, read_len_table(), HYuvContext::vlc, and VLC_BITS.

| static void read_len_table | ( | uint8_t * | dst, | |
| GetBitContext * | gb | |||
| ) | [static] |
Definition at line 207 of file huffyuv.c.
References get_bits().
Referenced by read_huffman_tables(), and read_old_huffman_tables().

| static int read_old_huffman_tables | ( | HYuvContext * | s | ) | [static] |
Definition at line 319 of file huffyuv.c.
References HYuvContext::bits, HYuvContext::bitstream_bpp, classic_add_chroma, classic_add_luma, classic_shift_chroma, classic_shift_luma, fprintf, free_vlc(), init_get_bits(), init_vlc(), HYuvContext::len, memcpy, read_len_table(), HYuvContext::vlc, and VLC_BITS.
Referenced by decode_init().

| static int store_table | ( | HYuvContext * | s, | |
| uint8_t * | len, | |||
| uint8_t * | buf | |||
| ) | [static] |
| static int sub_left_prediction | ( | HYuvContext * | s, | |
| uint8_t * | dst, | |||
| uint8_t * | src, | |||
| int | w, | |||
| int | left | |||
| ) | [inline, static] |
Definition at line 187 of file huffyuv.c.
References DSPContext::diff_bytes, and HYuvContext::dsp.
Referenced by encode_frame().
const unsigned char classic_add_chroma[256] [static] |
Initial value:
{
3, 1, 2, 2, 2, 2, 3, 3, 7, 5, 7, 5, 8, 6, 11, 9,
7, 13, 11, 10, 9, 8, 7, 5, 9, 7, 6, 4, 7, 5, 8, 7,
11, 8, 13, 11, 19, 15, 22, 23, 20, 33, 32, 28, 27, 29, 51, 77,
43, 45, 76, 81, 46, 82, 75, 55, 56,144, 58, 80, 60, 74,147, 63,
143, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79,
80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 27, 30, 21, 22,
17, 14, 5, 6,100, 54, 47, 50, 51, 53,106,107,108,109,110,111,
112,113,114,115, 4,117,118, 92, 94,121,122, 3,124,103, 2, 1,
0,129,130,131,120,119,126,125,136,137,138,139,140,141,142,134,
135,132,133,104, 64,101, 62, 57,102, 95, 93, 59, 61, 28, 97, 96,
52, 49, 48, 29, 32, 25, 24, 46, 23, 98, 45, 44, 43, 20, 42, 41,
19, 18, 99, 40, 15, 39, 38, 16, 13, 12, 11, 37, 10, 9, 8, 36,
7,128,127,105,123,116, 35, 34, 33,145, 31, 79, 42,146, 78, 26,
83, 48, 49, 50, 44, 47, 26, 31, 30, 18, 17, 19, 21, 24, 25, 13,
14, 16, 17, 18, 20, 21, 12, 14, 15, 9, 10, 6, 9, 6, 5, 8,
6, 12, 8, 10, 7, 9, 6, 4, 6, 2, 2, 3, 3, 3, 3, 2,
}
Definition at line 110 of file huffyuv.c.
Referenced by read_old_huffman_tables().
const unsigned char classic_add_luma[256] [static] |
Initial value:
{
3, 9, 5, 12, 10, 35, 32, 29, 27, 50, 48, 45, 44, 41, 39, 37,
73, 70, 68, 65, 64, 61, 58, 56, 53, 50, 49, 46, 44, 41, 38, 36,
68, 65, 63, 61, 58, 55, 53, 51, 48, 46, 45, 43, 41, 39, 38, 36,
35, 33, 32, 30, 29, 27, 26, 25, 48, 47, 46, 44, 43, 41, 40, 39,
37, 36, 35, 34, 32, 31, 30, 28, 27, 26, 24, 23, 22, 20, 19, 37,
35, 34, 33, 31, 30, 29, 27, 26, 24, 23, 21, 20, 18, 17, 15, 29,
27, 26, 24, 22, 21, 19, 17, 16, 14, 26, 25, 23, 21, 19, 18, 16,
15, 27, 25, 23, 21, 19, 17, 16, 14, 26, 25, 23, 21, 18, 17, 14,
12, 17, 19, 13, 4, 9, 2, 11, 1, 7, 8, 0, 16, 3, 14, 6,
12, 10, 5, 15, 18, 11, 10, 13, 15, 16, 19, 20, 22, 24, 27, 15,
18, 20, 22, 24, 26, 14, 17, 20, 22, 24, 27, 15, 18, 20, 23, 25,
28, 16, 19, 22, 25, 28, 32, 36, 21, 25, 29, 33, 38, 42, 45, 49,
28, 31, 34, 37, 40, 42, 44, 47, 49, 50, 52, 54, 56, 57, 59, 60,
62, 64, 66, 67, 69, 35, 37, 39, 40, 42, 43, 45, 47, 48, 51, 52,
54, 55, 57, 59, 60, 62, 63, 66, 67, 69, 71, 72, 38, 40, 42, 43,
46, 47, 49, 51, 26, 28, 30, 31, 33, 34, 18, 19, 11, 13, 7, 8,
}
Definition at line 91 of file huffyuv.c.
Referenced by read_old_huffman_tables().
const unsigned char classic_shift_chroma[] [static] |
Initial value:
{
66,36,37,38,39,40,41,75,76,77,110,239,144,81,82,83,84,85,118,183,
56,57,88,89,56,89,154,57,58,57,26,141,57,56,58,57,58,57,184,119,
214,245,116,83,82,49,80,79,78,77,44,75,41,40,39,38,37,36,34, 0
}
Definition at line 85 of file huffyuv.c.
Referenced by read_old_huffman_tables().
const unsigned char classic_shift_luma[] [static] |
Initial value:
{
34,36,35,69,135,232,9,16,10,24,11,23,12,16,13,10,14,8,15,8,
16,8,17,20,16,10,207,206,205,236,11,8,10,21,9,23,8,8,199,70,
69,68, 0
}
Definition at line 79 of file huffyuv.c.
Referenced by read_old_huffman_tables().
Initial value:
{
"ffvhuff",
CODEC_TYPE_VIDEO,
CODEC_ID_FFVHUFF,
sizeof(HYuvContext),
decode_init,
NULL,
decode_end,
decode_frame,
CODEC_CAP_DR1 | CODEC_CAP_DRAW_HORIZ_BAND,
NULL
}
Definition at line 1235 of file huffyuv.c.
Referenced by avcodec_register_all().
Initial value:
{
"huffyuv",
CODEC_TYPE_VIDEO,
CODEC_ID_HUFFYUV,
sizeof(HYuvContext),
decode_init,
NULL,
decode_end,
decode_frame,
CODEC_CAP_DR1 | CODEC_CAP_DRAW_HORIZ_BAND,
NULL
}
Definition at line 1222 of file huffyuv.c.
Referenced by avcodec_register_all().
1.5.5