libmimic 1.0.4
mimic-private.h
1/* Copyright (C) 2005 Ole André Vadla Ravnås <oleavr@gmail.com>
2 *
3 * This library is free software; you can redistribute it and/or
4 * modify it under the terms of the GNU Lesser General Public
5 * License as published by the Free Software Foundation; either
6 * version 2.1 of the License, or (at your option) any later version.
7 *
8 * This library is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 * Lesser General Public License for more details.
12 *
13 * You should have received a copy of the GNU Lesser General Public
14 * License along with this library; if not, write to the Free Software
15 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16 */
17
18#ifndef MIMIC_PRIVATE_H
19#define MIMIC_PRIVATE_H
20
21#include "mimic.h"
22
23#define ENCODER_BUFFER_SIZE 16384
24#define ENCODER_QUALITY_DEFAULT 0
25#define ENCODER_QUALITY_MIN 0
26#define ENCODER_QUALITY_MAX 10000
27
28struct _MimCtx {
29 gboolean encoder_initialized;
30 gboolean decoder_initialized;
31
32 gint frame_width;
33 gint frame_height;
34 gint quality;
35 gint num_coeffs;
36
37 gint y_stride;
38 gint y_row_count;
39 gint y_size;
40
41 gint crcb_stride;
42 gint crcb_row_count;
43 gint crcb_size;
44
45 gint num_vblocks_y;
46 gint num_hblocks_y;
47
48 gint num_vblocks_cbcr;
49 gint num_hblocks_cbcr;
50
51 guchar *cur_frame_buf;
52 guchar *prev_frame_buf;
53
54 gchar vlcdec_lookup[2296];
55
56 gchar *data_buffer;
57 guint data_index;
58
59 guint32 cur_chunk;
60 gint cur_chunk_len;
61
62 guint32 *chunk_ptr;
63 gboolean read_odd;
64
65 gint frame_num;
66
67 gint ptr_index;
68 guchar *buf_ptrs[16];
69};
70
71typedef struct {
72 guchar length1;
73 guint32 part1;
74
75 guchar length2;
76 guint32 part2;
77} VlcSymbol;
78
79typedef struct {
80 guint32 magic;
81 guchar pos_add;
82 guchar num_bits;
83} VlcMagic;
84
85void _mimic_init(MimCtx *ctx, gint width, gint height);
86guchar _clamp_value(gint value);
87
88guint32 _read_bits(MimCtx *ctx, gint num_bits);
89void _write_bits(MimCtx *ctx, guint32 bits, gint length);
90
91void _vlc_encode_block(MimCtx *ctx, const gint *block, gint num_coeffs);
92gboolean _vlc_decode_block(MimCtx *ctx, gint *block, gint num_coeffs);
93
94void _fdct_quant_block(MimCtx *ctx, gint *block, const guchar *src,
95 gint stride, gboolean is_chrom, gint num_coeffs);
96void _idct_dequant_block(MimCtx *ctx, gint *block, gboolean is_chrom);
97
98VlcMagic *_find_magic(guint magic);
99void _initialize_vlcdec_lookup(gchar *lookup_tbl);
100
101void _rgb_to_yuv(const guchar *input_rgb,
102 guchar *output_y,
103 guchar *output_cb,
104 guchar *output_cr,
105 gint width,
106 gint height);
107void _yuv_to_rgb(const guchar *input_y,
108 const guchar *input_cb,
109 const guchar *input_cr,
110 guchar *output_rgb,
111 guint width,
112 guint height);
113
114void _deblock(guchar *blocks, guint stride, guint row_count);
115
116#endif // MIMIC_PRIVATE_H
117
Definition mimic-private.h:79
Definition mimic-private.h:71
Definition mimic-private.h:28