annotate xvid_vbr.h @ 16307:03cd6abe5664

avoid reading more than maxlen bytes. Has the sideeffect that the amount read will be close to maxlen instead of minlen as before.
author reimar
date Thu, 25 Aug 2005 19:46:20 +0000
parents ef1daba63c30
children 401b440a6d76
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
7331
7ec253a97341 Import transcode-0.6.1.20020829 XviD VBR Library into mencoder DivX4 encoder
kmkaplan
parents:
diff changeset
1 /******************************************************************************
7ec253a97341 Import transcode-0.6.1.20020829 XviD VBR Library into mencoder DivX4 encoder
kmkaplan
parents:
diff changeset
2 *
7ec253a97341 Import transcode-0.6.1.20020829 XviD VBR Library into mencoder DivX4 encoder
kmkaplan
parents:
diff changeset
3 * XviD VBR Library
7ec253a97341 Import transcode-0.6.1.20020829 XviD VBR Library into mencoder DivX4 encoder
kmkaplan
parents:
diff changeset
4 *
7ec253a97341 Import transcode-0.6.1.20020829 XviD VBR Library into mencoder DivX4 encoder
kmkaplan
parents:
diff changeset
5 * Copyright (C) 2002 Edouard Gomez <ed.gomez@wanadoo.fr>
7ec253a97341 Import transcode-0.6.1.20020829 XviD VBR Library into mencoder DivX4 encoder
kmkaplan
parents:
diff changeset
6 *
7ec253a97341 Import transcode-0.6.1.20020829 XviD VBR Library into mencoder DivX4 encoder
kmkaplan
parents:
diff changeset
7 * The curve treatment algorithm is based on work done by Foxer <email?> and
7ec253a97341 Import transcode-0.6.1.20020829 XviD VBR Library into mencoder DivX4 encoder
kmkaplan
parents:
diff changeset
8 * Dirk Knop <dknop@gwdg.de> for the XviD vfw dynamic library.
7ec253a97341 Import transcode-0.6.1.20020829 XviD VBR Library into mencoder DivX4 encoder
kmkaplan
parents:
diff changeset
9 *
7ec253a97341 Import transcode-0.6.1.20020829 XviD VBR Library into mencoder DivX4 encoder
kmkaplan
parents:
diff changeset
10 * This program is free software; you can redistribute it and/or modify
7ec253a97341 Import transcode-0.6.1.20020829 XviD VBR Library into mencoder DivX4 encoder
kmkaplan
parents:
diff changeset
11 * it under the terms of the GNU General Public License as published by
7ec253a97341 Import transcode-0.6.1.20020829 XviD VBR Library into mencoder DivX4 encoder
kmkaplan
parents:
diff changeset
12 * the Free Software Foundation; either version 2 of the License, or
7ec253a97341 Import transcode-0.6.1.20020829 XviD VBR Library into mencoder DivX4 encoder
kmkaplan
parents:
diff changeset
13 * (at your option) any later version.
7ec253a97341 Import transcode-0.6.1.20020829 XviD VBR Library into mencoder DivX4 encoder
kmkaplan
parents:
diff changeset
14 *
7ec253a97341 Import transcode-0.6.1.20020829 XviD VBR Library into mencoder DivX4 encoder
kmkaplan
parents:
diff changeset
15 * This program is distributed in the hope that it will be useful,
7ec253a97341 Import transcode-0.6.1.20020829 XviD VBR Library into mencoder DivX4 encoder
kmkaplan
parents:
diff changeset
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
7ec253a97341 Import transcode-0.6.1.20020829 XviD VBR Library into mencoder DivX4 encoder
kmkaplan
parents:
diff changeset
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
7ec253a97341 Import transcode-0.6.1.20020829 XviD VBR Library into mencoder DivX4 encoder
kmkaplan
parents:
diff changeset
18 * GNU General Public License for more details.
7ec253a97341 Import transcode-0.6.1.20020829 XviD VBR Library into mencoder DivX4 encoder
kmkaplan
parents:
diff changeset
19 *
7ec253a97341 Import transcode-0.6.1.20020829 XviD VBR Library into mencoder DivX4 encoder
kmkaplan
parents:
diff changeset
20 * You should have received a copy of the GNU General Public License
7ec253a97341 Import transcode-0.6.1.20020829 XviD VBR Library into mencoder DivX4 encoder
kmkaplan
parents:
diff changeset
21 * along with this program; if not, write to the Free Software
7ec253a97341 Import transcode-0.6.1.20020829 XviD VBR Library into mencoder DivX4 encoder
kmkaplan
parents:
diff changeset
22 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
7ec253a97341 Import transcode-0.6.1.20020829 XviD VBR Library into mencoder DivX4 encoder
kmkaplan
parents:
diff changeset
23 *
7ec253a97341 Import transcode-0.6.1.20020829 XviD VBR Library into mencoder DivX4 encoder
kmkaplan
parents:
diff changeset
24 *****************************************************************************/
7ec253a97341 Import transcode-0.6.1.20020829 XviD VBR Library into mencoder DivX4 encoder
kmkaplan
parents:
diff changeset
25
7ec253a97341 Import transcode-0.6.1.20020829 XviD VBR Library into mencoder DivX4 encoder
kmkaplan
parents:
diff changeset
26 #ifndef __XVID_VBR_H__
7ec253a97341 Import transcode-0.6.1.20020829 XviD VBR Library into mencoder DivX4 encoder
kmkaplan
parents:
diff changeset
27 #define __XVID_VBR_H__
7ec253a97341 Import transcode-0.6.1.20020829 XviD VBR Library into mencoder DivX4 encoder
kmkaplan
parents:
diff changeset
28
7ec253a97341 Import transcode-0.6.1.20020829 XviD VBR Library into mencoder DivX4 encoder
kmkaplan
parents:
diff changeset
29 #define VBR_VERSION 0
7ec253a97341 Import transcode-0.6.1.20020829 XviD VBR Library into mencoder DivX4 encoder
kmkaplan
parents:
diff changeset
30
7ec253a97341 Import transcode-0.6.1.20020829 XviD VBR Library into mencoder DivX4 encoder
kmkaplan
parents:
diff changeset
31 /******************************************************************************
7ec253a97341 Import transcode-0.6.1.20020829 XviD VBR Library into mencoder DivX4 encoder
kmkaplan
parents:
diff changeset
32 * Function types used in the vbr controler
7ec253a97341 Import transcode-0.6.1.20020829 XviD VBR Library into mencoder DivX4 encoder
kmkaplan
parents:
diff changeset
33 *****************************************************************************/
7ec253a97341 Import transcode-0.6.1.20020829 XviD VBR Library into mencoder DivX4 encoder
kmkaplan
parents:
diff changeset
34
7ec253a97341 Import transcode-0.6.1.20020829 XviD VBR Library into mencoder DivX4 encoder
kmkaplan
parents:
diff changeset
35 typedef int (vbr_init_function)(void *state);
7ec253a97341 Import transcode-0.6.1.20020829 XviD VBR Library into mencoder DivX4 encoder
kmkaplan
parents:
diff changeset
36 typedef vbr_init_function *vbr_init_function_ptr;
7ec253a97341 Import transcode-0.6.1.20020829 XviD VBR Library into mencoder DivX4 encoder
kmkaplan
parents:
diff changeset
37
7ec253a97341 Import transcode-0.6.1.20020829 XviD VBR Library into mencoder DivX4 encoder
kmkaplan
parents:
diff changeset
38 typedef int (vbr_get_quant_function)(void *state);
7ec253a97341 Import transcode-0.6.1.20020829 XviD VBR Library into mencoder DivX4 encoder
kmkaplan
parents:
diff changeset
39 typedef vbr_get_quant_function *vbr_get_quant_function_ptr;
7ec253a97341 Import transcode-0.6.1.20020829 XviD VBR Library into mencoder DivX4 encoder
kmkaplan
parents:
diff changeset
40
7ec253a97341 Import transcode-0.6.1.20020829 XviD VBR Library into mencoder DivX4 encoder
kmkaplan
parents:
diff changeset
41 typedef int (vbr_get_intra_function)(void *state);
7ec253a97341 Import transcode-0.6.1.20020829 XviD VBR Library into mencoder DivX4 encoder
kmkaplan
parents:
diff changeset
42 typedef vbr_get_intra_function *vbr_get_intra_function_ptr;
7ec253a97341 Import transcode-0.6.1.20020829 XviD VBR Library into mencoder DivX4 encoder
kmkaplan
parents:
diff changeset
43
7ec253a97341 Import transcode-0.6.1.20020829 XviD VBR Library into mencoder DivX4 encoder
kmkaplan
parents:
diff changeset
44 typedef int (vbr_update_function)(void *state,
7ec253a97341 Import transcode-0.6.1.20020829 XviD VBR Library into mencoder DivX4 encoder
kmkaplan
parents:
diff changeset
45 int quant,
7ec253a97341 Import transcode-0.6.1.20020829 XviD VBR Library into mencoder DivX4 encoder
kmkaplan
parents:
diff changeset
46 int intra,
7ec253a97341 Import transcode-0.6.1.20020829 XviD VBR Library into mencoder DivX4 encoder
kmkaplan
parents:
diff changeset
47 int header_bytes,
7ec253a97341 Import transcode-0.6.1.20020829 XviD VBR Library into mencoder DivX4 encoder
kmkaplan
parents:
diff changeset
48 int total_bytes,
7ec253a97341 Import transcode-0.6.1.20020829 XviD VBR Library into mencoder DivX4 encoder
kmkaplan
parents:
diff changeset
49 int kblocks,
7ec253a97341 Import transcode-0.6.1.20020829 XviD VBR Library into mencoder DivX4 encoder
kmkaplan
parents:
diff changeset
50 int mblocks,
7ec253a97341 Import transcode-0.6.1.20020829 XviD VBR Library into mencoder DivX4 encoder
kmkaplan
parents:
diff changeset
51 int ublocks);
7ec253a97341 Import transcode-0.6.1.20020829 XviD VBR Library into mencoder DivX4 encoder
kmkaplan
parents:
diff changeset
52 typedef vbr_update_function *vbr_update_function_ptr;
7ec253a97341 Import transcode-0.6.1.20020829 XviD VBR Library into mencoder DivX4 encoder
kmkaplan
parents:
diff changeset
53
7ec253a97341 Import transcode-0.6.1.20020829 XviD VBR Library into mencoder DivX4 encoder
kmkaplan
parents:
diff changeset
54 typedef int (vbr_finish_function)(void *state);
7ec253a97341 Import transcode-0.6.1.20020829 XviD VBR Library into mencoder DivX4 encoder
kmkaplan
parents:
diff changeset
55 typedef vbr_finish_function *vbr_finish_function_ptr;
7ec253a97341 Import transcode-0.6.1.20020829 XviD VBR Library into mencoder DivX4 encoder
kmkaplan
parents:
diff changeset
56
7ec253a97341 Import transcode-0.6.1.20020829 XviD VBR Library into mencoder DivX4 encoder
kmkaplan
parents:
diff changeset
57 /******************************************************************************
7ec253a97341 Import transcode-0.6.1.20020829 XviD VBR Library into mencoder DivX4 encoder
kmkaplan
parents:
diff changeset
58 * The VBR CONTROLER structure - the spin of the library
7ec253a97341 Import transcode-0.6.1.20020829 XviD VBR Library into mencoder DivX4 encoder
kmkaplan
parents:
diff changeset
59 *****************************************************************************/
7ec253a97341 Import transcode-0.6.1.20020829 XviD VBR Library into mencoder DivX4 encoder
kmkaplan
parents:
diff changeset
60
7ec253a97341 Import transcode-0.6.1.20020829 XviD VBR Library into mencoder DivX4 encoder
kmkaplan
parents:
diff changeset
61 typedef struct _vbr_control_t
7ec253a97341 Import transcode-0.6.1.20020829 XviD VBR Library into mencoder DivX4 encoder
kmkaplan
parents:
diff changeset
62 {
7ec253a97341 Import transcode-0.6.1.20020829 XviD VBR Library into mencoder DivX4 encoder
kmkaplan
parents:
diff changeset
63
7ec253a97341 Import transcode-0.6.1.20020829 XviD VBR Library into mencoder DivX4 encoder
kmkaplan
parents:
diff changeset
64 /* All modes - specifies what VBR algorithm has to be used */
7ec253a97341 Import transcode-0.6.1.20020829 XviD VBR Library into mencoder DivX4 encoder
kmkaplan
parents:
diff changeset
65 int mode;
7ec253a97341 Import transcode-0.6.1.20020829 XviD VBR Library into mencoder DivX4 encoder
kmkaplan
parents:
diff changeset
66
7ec253a97341 Import transcode-0.6.1.20020829 XviD VBR Library into mencoder DivX4 encoder
kmkaplan
parents:
diff changeset
67 /* All modes - specifies what fps the movie uses */
7ec253a97341 Import transcode-0.6.1.20020829 XviD VBR Library into mencoder DivX4 encoder
kmkaplan
parents:
diff changeset
68 float fps;
7ec253a97341 Import transcode-0.6.1.20020829 XviD VBR Library into mencoder DivX4 encoder
kmkaplan
parents:
diff changeset
69
7ec253a97341 Import transcode-0.6.1.20020829 XviD VBR Library into mencoder DivX4 encoder
kmkaplan
parents:
diff changeset
70 /* All modes */
7ec253a97341 Import transcode-0.6.1.20020829 XviD VBR Library into mencoder DivX4 encoder
kmkaplan
parents:
diff changeset
71 int debug;
7ec253a97341 Import transcode-0.6.1.20020829 XviD VBR Library into mencoder DivX4 encoder
kmkaplan
parents:
diff changeset
72
7ec253a97341 Import transcode-0.6.1.20020829 XviD VBR Library into mencoder DivX4 encoder
kmkaplan
parents:
diff changeset
73 /*
7ec253a97341 Import transcode-0.6.1.20020829 XviD VBR Library into mencoder DivX4 encoder
kmkaplan
parents:
diff changeset
74 * For VBR_MODE_2PASS_1/2 - specifies from/to what file the vbr
7ec253a97341 Import transcode-0.6.1.20020829 XviD VBR Library into mencoder DivX4 encoder
kmkaplan
parents:
diff changeset
75 * controller has to write/read stats
7ec253a97341 Import transcode-0.6.1.20020829 XviD VBR Library into mencoder DivX4 encoder
kmkaplan
parents:
diff changeset
76 */
7ec253a97341 Import transcode-0.6.1.20020829 XviD VBR Library into mencoder DivX4 encoder
kmkaplan
parents:
diff changeset
77 char *filename;
7ec253a97341 Import transcode-0.6.1.20020829 XviD VBR Library into mencoder DivX4 encoder
kmkaplan
parents:
diff changeset
78
7ec253a97341 Import transcode-0.6.1.20020829 XviD VBR Library into mencoder DivX4 encoder
kmkaplan
parents:
diff changeset
79 /* For VBR_MODE_2PASS_2 - Target size */
7ec253a97341 Import transcode-0.6.1.20020829 XviD VBR Library into mencoder DivX4 encoder
kmkaplan
parents:
diff changeset
80 int desired_bitrate;
7ec253a97341 Import transcode-0.6.1.20020829 XviD VBR Library into mencoder DivX4 encoder
kmkaplan
parents:
diff changeset
81
7ec253a97341 Import transcode-0.6.1.20020829 XviD VBR Library into mencoder DivX4 encoder
kmkaplan
parents:
diff changeset
82 /* For VBR_MODE_2PASS_2 - Credits parameters */
7ec253a97341 Import transcode-0.6.1.20020829 XviD VBR Library into mencoder DivX4 encoder
kmkaplan
parents:
diff changeset
83 int credits_mode;
7ec253a97341 Import transcode-0.6.1.20020829 XviD VBR Library into mencoder DivX4 encoder
kmkaplan
parents:
diff changeset
84 int credits_start;
7ec253a97341 Import transcode-0.6.1.20020829 XviD VBR Library into mencoder DivX4 encoder
kmkaplan
parents:
diff changeset
85 int credits_start_begin;
7ec253a97341 Import transcode-0.6.1.20020829 XviD VBR Library into mencoder DivX4 encoder
kmkaplan
parents:
diff changeset
86 int credits_start_end;
7ec253a97341 Import transcode-0.6.1.20020829 XviD VBR Library into mencoder DivX4 encoder
kmkaplan
parents:
diff changeset
87 int credits_end;
7ec253a97341 Import transcode-0.6.1.20020829 XviD VBR Library into mencoder DivX4 encoder
kmkaplan
parents:
diff changeset
88 int credits_end_begin;
7ec253a97341 Import transcode-0.6.1.20020829 XviD VBR Library into mencoder DivX4 encoder
kmkaplan
parents:
diff changeset
89 int credits_end_end;
7ec253a97341 Import transcode-0.6.1.20020829 XviD VBR Library into mencoder DivX4 encoder
kmkaplan
parents:
diff changeset
90 int credits_quant_ratio;
7ec253a97341 Import transcode-0.6.1.20020829 XviD VBR Library into mencoder DivX4 encoder
kmkaplan
parents:
diff changeset
91 int credits_fixed_quant;
7ec253a97341 Import transcode-0.6.1.20020829 XviD VBR Library into mencoder DivX4 encoder
kmkaplan
parents:
diff changeset
92 int credits_quant_i;
7ec253a97341 Import transcode-0.6.1.20020829 XviD VBR Library into mencoder DivX4 encoder
kmkaplan
parents:
diff changeset
93 int credits_quant_p;
7ec253a97341 Import transcode-0.6.1.20020829 XviD VBR Library into mencoder DivX4 encoder
kmkaplan
parents:
diff changeset
94 int credits_start_size;
7ec253a97341 Import transcode-0.6.1.20020829 XviD VBR Library into mencoder DivX4 encoder
kmkaplan
parents:
diff changeset
95 int credits_end_size;
7ec253a97341 Import transcode-0.6.1.20020829 XviD VBR Library into mencoder DivX4 encoder
kmkaplan
parents:
diff changeset
96
7ec253a97341 Import transcode-0.6.1.20020829 XviD VBR Library into mencoder DivX4 encoder
kmkaplan
parents:
diff changeset
97 /* For VBR_MODE_2PASS_2 - keyframe parameters */
7ec253a97341 Import transcode-0.6.1.20020829 XviD VBR Library into mencoder DivX4 encoder
kmkaplan
parents:
diff changeset
98 int keyframe_boost;
7ec253a97341 Import transcode-0.6.1.20020829 XviD VBR Library into mencoder DivX4 encoder
kmkaplan
parents:
diff changeset
99 int kftreshold;
7ec253a97341 Import transcode-0.6.1.20020829 XviD VBR Library into mencoder DivX4 encoder
kmkaplan
parents:
diff changeset
100 int kfreduction;
7ec253a97341 Import transcode-0.6.1.20020829 XviD VBR Library into mencoder DivX4 encoder
kmkaplan
parents:
diff changeset
101 int min_key_interval;
7ec253a97341 Import transcode-0.6.1.20020829 XviD VBR Library into mencoder DivX4 encoder
kmkaplan
parents:
diff changeset
102 int max_key_interval;
7ec253a97341 Import transcode-0.6.1.20020829 XviD VBR Library into mencoder DivX4 encoder
kmkaplan
parents:
diff changeset
103
7ec253a97341 Import transcode-0.6.1.20020829 XviD VBR Library into mencoder DivX4 encoder
kmkaplan
parents:
diff changeset
104 /* For VBR_MODE_2PASS_2 - Normal curve */
7ec253a97341 Import transcode-0.6.1.20020829 XviD VBR Library into mencoder DivX4 encoder
kmkaplan
parents:
diff changeset
105 int curve_compression_high;
7ec253a97341 Import transcode-0.6.1.20020829 XviD VBR Library into mencoder DivX4 encoder
kmkaplan
parents:
diff changeset
106 int curve_compression_low;
7ec253a97341 Import transcode-0.6.1.20020829 XviD VBR Library into mencoder DivX4 encoder
kmkaplan
parents:
diff changeset
107
7ec253a97341 Import transcode-0.6.1.20020829 XviD VBR Library into mencoder DivX4 encoder
kmkaplan
parents:
diff changeset
108 /* For VBR_MODE_2PASS_2 - Alternate curve parameters */
7ec253a97341 Import transcode-0.6.1.20020829 XviD VBR Library into mencoder DivX4 encoder
kmkaplan
parents:
diff changeset
109 int use_alt_curve;
7ec253a97341 Import transcode-0.6.1.20020829 XviD VBR Library into mencoder DivX4 encoder
kmkaplan
parents:
diff changeset
110 int alt_curve_type;
7ec253a97341 Import transcode-0.6.1.20020829 XviD VBR Library into mencoder DivX4 encoder
kmkaplan
parents:
diff changeset
111 int alt_curve_low_dist;
7ec253a97341 Import transcode-0.6.1.20020829 XviD VBR Library into mencoder DivX4 encoder
kmkaplan
parents:
diff changeset
112 int alt_curve_high_dist;
7ec253a97341 Import transcode-0.6.1.20020829 XviD VBR Library into mencoder DivX4 encoder
kmkaplan
parents:
diff changeset
113 int alt_curve_min_rel_qual;
7ec253a97341 Import transcode-0.6.1.20020829 XviD VBR Library into mencoder DivX4 encoder
kmkaplan
parents:
diff changeset
114 int alt_curve_use_auto;
7ec253a97341 Import transcode-0.6.1.20020829 XviD VBR Library into mencoder DivX4 encoder
kmkaplan
parents:
diff changeset
115 int alt_curve_auto_str;
7ec253a97341 Import transcode-0.6.1.20020829 XviD VBR Library into mencoder DivX4 encoder
kmkaplan
parents:
diff changeset
116 int alt_curve_use_auto_bonus_bias;
7ec253a97341 Import transcode-0.6.1.20020829 XviD VBR Library into mencoder DivX4 encoder
kmkaplan
parents:
diff changeset
117 int alt_curve_bonus_bias;
7ec253a97341 Import transcode-0.6.1.20020829 XviD VBR Library into mencoder DivX4 encoder
kmkaplan
parents:
diff changeset
118 int bitrate_payback_method;
7ec253a97341 Import transcode-0.6.1.20020829 XviD VBR Library into mencoder DivX4 encoder
kmkaplan
parents:
diff changeset
119 int bitrate_payback_delay;
7ec253a97341 Import transcode-0.6.1.20020829 XviD VBR Library into mencoder DivX4 encoder
kmkaplan
parents:
diff changeset
120 int max_iquant;
7ec253a97341 Import transcode-0.6.1.20020829 XviD VBR Library into mencoder DivX4 encoder
kmkaplan
parents:
diff changeset
121 int min_iquant;
7ec253a97341 Import transcode-0.6.1.20020829 XviD VBR Library into mencoder DivX4 encoder
kmkaplan
parents:
diff changeset
122 int max_pquant;
7ec253a97341 Import transcode-0.6.1.20020829 XviD VBR Library into mencoder DivX4 encoder
kmkaplan
parents:
diff changeset
123 int min_pquant;
7436
ef1daba63c30 Sync with upstream version. According to Edouard Gomez:
kmkaplan
parents: 7331
diff changeset
124 int twopass_max_bitrate;
ef1daba63c30 Sync with upstream version. According to Edouard Gomez:
kmkaplan
parents: 7331
diff changeset
125 int twopass_max_overflow_improvement;
ef1daba63c30 Sync with upstream version. According to Edouard Gomez:
kmkaplan
parents: 7331
diff changeset
126 int twopass_max_overflow_degradation;
7331
7ec253a97341 Import transcode-0.6.1.20020829 XviD VBR Library into mencoder DivX4 encoder
kmkaplan
parents:
diff changeset
127
7ec253a97341 Import transcode-0.6.1.20020829 XviD VBR Library into mencoder DivX4 encoder
kmkaplan
parents:
diff changeset
128 /*
7ec253a97341 Import transcode-0.6.1.20020829 XviD VBR Library into mencoder DivX4 encoder
kmkaplan
parents:
diff changeset
129 * For VBR_MODE_FIXED_QUANT - the quantizer that has to be used for all
7ec253a97341 Import transcode-0.6.1.20020829 XviD VBR Library into mencoder DivX4 encoder
kmkaplan
parents:
diff changeset
130 * frames
7ec253a97341 Import transcode-0.6.1.20020829 XviD VBR Library into mencoder DivX4 encoder
kmkaplan
parents:
diff changeset
131 */
7ec253a97341 Import transcode-0.6.1.20020829 XviD VBR Library into mencoder DivX4 encoder
kmkaplan
parents:
diff changeset
132 int fixed_quant;
7ec253a97341 Import transcode-0.6.1.20020829 XviD VBR Library into mencoder DivX4 encoder
kmkaplan
parents:
diff changeset
133
7ec253a97341 Import transcode-0.6.1.20020829 XviD VBR Library into mencoder DivX4 encoder
kmkaplan
parents:
diff changeset
134 /* ----------- Internal data - Do not modify ----------- */
7ec253a97341 Import transcode-0.6.1.20020829 XviD VBR Library into mencoder DivX4 encoder
kmkaplan
parents:
diff changeset
135 void *debug_file;
7ec253a97341 Import transcode-0.6.1.20020829 XviD VBR Library into mencoder DivX4 encoder
kmkaplan
parents:
diff changeset
136 void *pass1_file;
7ec253a97341 Import transcode-0.6.1.20020829 XviD VBR Library into mencoder DivX4 encoder
kmkaplan
parents:
diff changeset
137
7ec253a97341 Import transcode-0.6.1.20020829 XviD VBR Library into mencoder DivX4 encoder
kmkaplan
parents:
diff changeset
138 long long desired_size;
7ec253a97341 Import transcode-0.6.1.20020829 XviD VBR Library into mencoder DivX4 encoder
kmkaplan
parents:
diff changeset
139
7ec253a97341 Import transcode-0.6.1.20020829 XviD VBR Library into mencoder DivX4 encoder
kmkaplan
parents:
diff changeset
140 int cur_frame;
7ec253a97341 Import transcode-0.6.1.20020829 XviD VBR Library into mencoder DivX4 encoder
kmkaplan
parents:
diff changeset
141 int nb_frames;
7ec253a97341 Import transcode-0.6.1.20020829 XviD VBR Library into mencoder DivX4 encoder
kmkaplan
parents:
diff changeset
142 int nb_keyframes;
7ec253a97341 Import transcode-0.6.1.20020829 XviD VBR Library into mencoder DivX4 encoder
kmkaplan
parents:
diff changeset
143
7ec253a97341 Import transcode-0.6.1.20020829 XviD VBR Library into mencoder DivX4 encoder
kmkaplan
parents:
diff changeset
144 int *keyframe_locations;
7ec253a97341 Import transcode-0.6.1.20020829 XviD VBR Library into mencoder DivX4 encoder
kmkaplan
parents:
diff changeset
145 int last_keyframe;
7ec253a97341 Import transcode-0.6.1.20020829 XviD VBR Library into mencoder DivX4 encoder
kmkaplan
parents:
diff changeset
146
7ec253a97341 Import transcode-0.6.1.20020829 XviD VBR Library into mencoder DivX4 encoder
kmkaplan
parents:
diff changeset
147 double credits_start_curve;
7ec253a97341 Import transcode-0.6.1.20020829 XviD VBR Library into mencoder DivX4 encoder
kmkaplan
parents:
diff changeset
148 double credits_end_curve;
7ec253a97341 Import transcode-0.6.1.20020829 XviD VBR Library into mencoder DivX4 encoder
kmkaplan
parents:
diff changeset
149 double movie_curve;
7ec253a97341 Import transcode-0.6.1.20020829 XviD VBR Library into mencoder DivX4 encoder
kmkaplan
parents:
diff changeset
150 double average_frame;
7ec253a97341 Import transcode-0.6.1.20020829 XviD VBR Library into mencoder DivX4 encoder
kmkaplan
parents:
diff changeset
151 double alt_curve_low;
7ec253a97341 Import transcode-0.6.1.20020829 XviD VBR Library into mencoder DivX4 encoder
kmkaplan
parents:
diff changeset
152 double alt_curve_low_diff;
7ec253a97341 Import transcode-0.6.1.20020829 XviD VBR Library into mencoder DivX4 encoder
kmkaplan
parents:
diff changeset
153 double alt_curve_high;
7ec253a97341 Import transcode-0.6.1.20020829 XviD VBR Library into mencoder DivX4 encoder
kmkaplan
parents:
diff changeset
154 double alt_curve_high_diff;
7ec253a97341 Import transcode-0.6.1.20020829 XviD VBR Library into mencoder DivX4 encoder
kmkaplan
parents:
diff changeset
155 double alt_curve_mid_qual;
7ec253a97341 Import transcode-0.6.1.20020829 XviD VBR Library into mencoder DivX4 encoder
kmkaplan
parents:
diff changeset
156 double alt_curve_qual_dev;
7ec253a97341 Import transcode-0.6.1.20020829 XviD VBR Library into mencoder DivX4 encoder
kmkaplan
parents:
diff changeset
157 double curve_bias_bonus;
7ec253a97341 Import transcode-0.6.1.20020829 XviD VBR Library into mencoder DivX4 encoder
kmkaplan
parents:
diff changeset
158 double curve_comp_scale;
7ec253a97341 Import transcode-0.6.1.20020829 XviD VBR Library into mencoder DivX4 encoder
kmkaplan
parents:
diff changeset
159 double curve_comp_error;
7ec253a97341 Import transcode-0.6.1.20020829 XviD VBR Library into mencoder DivX4 encoder
kmkaplan
parents:
diff changeset
160
7ec253a97341 Import transcode-0.6.1.20020829 XviD VBR Library into mencoder DivX4 encoder
kmkaplan
parents:
diff changeset
161 int pass1_quant;
7ec253a97341 Import transcode-0.6.1.20020829 XviD VBR Library into mencoder DivX4 encoder
kmkaplan
parents:
diff changeset
162 int pass1_intra;
7ec253a97341 Import transcode-0.6.1.20020829 XviD VBR Library into mencoder DivX4 encoder
kmkaplan
parents:
diff changeset
163 int pass1_bytes;
7ec253a97341 Import transcode-0.6.1.20020829 XviD VBR Library into mencoder DivX4 encoder
kmkaplan
parents:
diff changeset
164
7ec253a97341 Import transcode-0.6.1.20020829 XviD VBR Library into mencoder DivX4 encoder
kmkaplan
parents:
diff changeset
165 int bytes1;
7ec253a97341 Import transcode-0.6.1.20020829 XviD VBR Library into mencoder DivX4 encoder
kmkaplan
parents:
diff changeset
166 int bytes2;
7ec253a97341 Import transcode-0.6.1.20020829 XviD VBR Library into mencoder DivX4 encoder
kmkaplan
parents:
diff changeset
167 int desired_bytes2;
7ec253a97341 Import transcode-0.6.1.20020829 XviD VBR Library into mencoder DivX4 encoder
kmkaplan
parents:
diff changeset
168 int max_framesize;
7ec253a97341 Import transcode-0.6.1.20020829 XviD VBR Library into mencoder DivX4 encoder
kmkaplan
parents:
diff changeset
169 int last_quant;
7ec253a97341 Import transcode-0.6.1.20020829 XviD VBR Library into mencoder DivX4 encoder
kmkaplan
parents:
diff changeset
170 int quant_count[32];
7ec253a97341 Import transcode-0.6.1.20020829 XviD VBR Library into mencoder DivX4 encoder
kmkaplan
parents:
diff changeset
171 double quant_error[32];
7ec253a97341 Import transcode-0.6.1.20020829 XviD VBR Library into mencoder DivX4 encoder
kmkaplan
parents:
diff changeset
172
7ec253a97341 Import transcode-0.6.1.20020829 XviD VBR Library into mencoder DivX4 encoder
kmkaplan
parents:
diff changeset
173 int overflow;
7ec253a97341 Import transcode-0.6.1.20020829 XviD VBR Library into mencoder DivX4 encoder
kmkaplan
parents:
diff changeset
174 int KFoverflow;
7ec253a97341 Import transcode-0.6.1.20020829 XviD VBR Library into mencoder DivX4 encoder
kmkaplan
parents:
diff changeset
175 int KFoverflow_partial;
7ec253a97341 Import transcode-0.6.1.20020829 XviD VBR Library into mencoder DivX4 encoder
kmkaplan
parents:
diff changeset
176 int KF_idx;
7ec253a97341 Import transcode-0.6.1.20020829 XviD VBR Library into mencoder DivX4 encoder
kmkaplan
parents:
diff changeset
177
7ec253a97341 Import transcode-0.6.1.20020829 XviD VBR Library into mencoder DivX4 encoder
kmkaplan
parents:
diff changeset
178 int debug_quant_count[32];
7ec253a97341 Import transcode-0.6.1.20020829 XviD VBR Library into mencoder DivX4 encoder
kmkaplan
parents:
diff changeset
179
7ec253a97341 Import transcode-0.6.1.20020829 XviD VBR Library into mencoder DivX4 encoder
kmkaplan
parents:
diff changeset
180 /* ----------- Internal data - do not modify ----------- */
7ec253a97341 Import transcode-0.6.1.20020829 XviD VBR Library into mencoder DivX4 encoder
kmkaplan
parents:
diff changeset
181 vbr_init_function_ptr init;
7ec253a97341 Import transcode-0.6.1.20020829 XviD VBR Library into mencoder DivX4 encoder
kmkaplan
parents:
diff changeset
182 vbr_get_quant_function_ptr getquant;
7ec253a97341 Import transcode-0.6.1.20020829 XviD VBR Library into mencoder DivX4 encoder
kmkaplan
parents:
diff changeset
183 vbr_get_intra_function_ptr getintra;
7ec253a97341 Import transcode-0.6.1.20020829 XviD VBR Library into mencoder DivX4 encoder
kmkaplan
parents:
diff changeset
184 vbr_update_function_ptr update;
7ec253a97341 Import transcode-0.6.1.20020829 XviD VBR Library into mencoder DivX4 encoder
kmkaplan
parents:
diff changeset
185 vbr_finish_function_ptr finish;
7ec253a97341 Import transcode-0.6.1.20020829 XviD VBR Library into mencoder DivX4 encoder
kmkaplan
parents:
diff changeset
186
7ec253a97341 Import transcode-0.6.1.20020829 XviD VBR Library into mencoder DivX4 encoder
kmkaplan
parents:
diff changeset
187 }vbr_control_t;
7ec253a97341 Import transcode-0.6.1.20020829 XviD VBR Library into mencoder DivX4 encoder
kmkaplan
parents:
diff changeset
188
7ec253a97341 Import transcode-0.6.1.20020829 XviD VBR Library into mencoder DivX4 encoder
kmkaplan
parents:
diff changeset
189 /******************************************************************************
7ec253a97341 Import transcode-0.6.1.20020829 XviD VBR Library into mencoder DivX4 encoder
kmkaplan
parents:
diff changeset
190 * Constants
7ec253a97341 Import transcode-0.6.1.20020829 XviD VBR Library into mencoder DivX4 encoder
kmkaplan
parents:
diff changeset
191 *****************************************************************************/
7ec253a97341 Import transcode-0.6.1.20020829 XviD VBR Library into mencoder DivX4 encoder
kmkaplan
parents:
diff changeset
192
7ec253a97341 Import transcode-0.6.1.20020829 XviD VBR Library into mencoder DivX4 encoder
kmkaplan
parents:
diff changeset
193 /* Constants for the mode member */
7ec253a97341 Import transcode-0.6.1.20020829 XviD VBR Library into mencoder DivX4 encoder
kmkaplan
parents:
diff changeset
194 #define VBR_MODE_1PASS 0x01
7ec253a97341 Import transcode-0.6.1.20020829 XviD VBR Library into mencoder DivX4 encoder
kmkaplan
parents:
diff changeset
195 #define VBR_MODE_2PASS_1 0x02
7ec253a97341 Import transcode-0.6.1.20020829 XviD VBR Library into mencoder DivX4 encoder
kmkaplan
parents:
diff changeset
196 #define VBR_MODE_2PASS_2 0x04
7ec253a97341 Import transcode-0.6.1.20020829 XviD VBR Library into mencoder DivX4 encoder
kmkaplan
parents:
diff changeset
197 #define VBR_MODE_FIXED_QUANT 0x08
7ec253a97341 Import transcode-0.6.1.20020829 XviD VBR Library into mencoder DivX4 encoder
kmkaplan
parents:
diff changeset
198
7ec253a97341 Import transcode-0.6.1.20020829 XviD VBR Library into mencoder DivX4 encoder
kmkaplan
parents:
diff changeset
199 /* Constants for the credits mode */
7ec253a97341 Import transcode-0.6.1.20020829 XviD VBR Library into mencoder DivX4 encoder
kmkaplan
parents:
diff changeset
200 #define VBR_CREDITS_MODE_RATE 0x01
7ec253a97341 Import transcode-0.6.1.20020829 XviD VBR Library into mencoder DivX4 encoder
kmkaplan
parents:
diff changeset
201 #define VBR_CREDITS_MODE_QUANT 0x02
7ec253a97341 Import transcode-0.6.1.20020829 XviD VBR Library into mencoder DivX4 encoder
kmkaplan
parents:
diff changeset
202 #define VBR_CREDITS_MODE_SIZE 0x04
7ec253a97341 Import transcode-0.6.1.20020829 XviD VBR Library into mencoder DivX4 encoder
kmkaplan
parents:
diff changeset
203
7ec253a97341 Import transcode-0.6.1.20020829 XviD VBR Library into mencoder DivX4 encoder
kmkaplan
parents:
diff changeset
204 /* Alternate curve treatment types */
7ec253a97341 Import transcode-0.6.1.20020829 XviD VBR Library into mencoder DivX4 encoder
kmkaplan
parents:
diff changeset
205 #define VBR_ALT_CURVE_SOFT 0x01
7ec253a97341 Import transcode-0.6.1.20020829 XviD VBR Library into mencoder DivX4 encoder
kmkaplan
parents:
diff changeset
206 #define VBR_ALT_CURVE_LINEAR 0x02
7ec253a97341 Import transcode-0.6.1.20020829 XviD VBR Library into mencoder DivX4 encoder
kmkaplan
parents:
diff changeset
207 #define VBR_ALT_CURVE_AGGRESIVE 0x04
7ec253a97341 Import transcode-0.6.1.20020829 XviD VBR Library into mencoder DivX4 encoder
kmkaplan
parents:
diff changeset
208
7ec253a97341 Import transcode-0.6.1.20020829 XviD VBR Library into mencoder DivX4 encoder
kmkaplan
parents:
diff changeset
209 /* Payback modes */
7ec253a97341 Import transcode-0.6.1.20020829 XviD VBR Library into mencoder DivX4 encoder
kmkaplan
parents:
diff changeset
210 #define VBR_PAYBACK_BIAS 0x01
7ec253a97341 Import transcode-0.6.1.20020829 XviD VBR Library into mencoder DivX4 encoder
kmkaplan
parents:
diff changeset
211 #define VBR_PAYBACK_PROPORTIONAL 0x02
7ec253a97341 Import transcode-0.6.1.20020829 XviD VBR Library into mencoder DivX4 encoder
kmkaplan
parents:
diff changeset
212
7ec253a97341 Import transcode-0.6.1.20020829 XviD VBR Library into mencoder DivX4 encoder
kmkaplan
parents:
diff changeset
213 /******************************************************************************
7ec253a97341 Import transcode-0.6.1.20020829 XviD VBR Library into mencoder DivX4 encoder
kmkaplan
parents:
diff changeset
214 * VBR API
7ec253a97341 Import transcode-0.6.1.20020829 XviD VBR Library into mencoder DivX4 encoder
kmkaplan
parents:
diff changeset
215 *****************************************************************************/
7ec253a97341 Import transcode-0.6.1.20020829 XviD VBR Library into mencoder DivX4 encoder
kmkaplan
parents:
diff changeset
216
7ec253a97341 Import transcode-0.6.1.20020829 XviD VBR Library into mencoder DivX4 encoder
kmkaplan
parents:
diff changeset
217 extern int vbrSetDefaults(vbr_control_t *state);
7ec253a97341 Import transcode-0.6.1.20020829 XviD VBR Library into mencoder DivX4 encoder
kmkaplan
parents:
diff changeset
218 extern int vbrInit(vbr_control_t *state);
7ec253a97341 Import transcode-0.6.1.20020829 XviD VBR Library into mencoder DivX4 encoder
kmkaplan
parents:
diff changeset
219 extern int vbrGetQuant(vbr_control_t *state);
7ec253a97341 Import transcode-0.6.1.20020829 XviD VBR Library into mencoder DivX4 encoder
kmkaplan
parents:
diff changeset
220 extern int vbrGetIntra(vbr_control_t *state);
7ec253a97341 Import transcode-0.6.1.20020829 XviD VBR Library into mencoder DivX4 encoder
kmkaplan
parents:
diff changeset
221 extern int vbrUpdate(vbr_control_t *state,
7ec253a97341 Import transcode-0.6.1.20020829 XviD VBR Library into mencoder DivX4 encoder
kmkaplan
parents:
diff changeset
222 int quant,
7ec253a97341 Import transcode-0.6.1.20020829 XviD VBR Library into mencoder DivX4 encoder
kmkaplan
parents:
diff changeset
223 int intra,
7ec253a97341 Import transcode-0.6.1.20020829 XviD VBR Library into mencoder DivX4 encoder
kmkaplan
parents:
diff changeset
224 int header_bytes,
7ec253a97341 Import transcode-0.6.1.20020829 XviD VBR Library into mencoder DivX4 encoder
kmkaplan
parents:
diff changeset
225 int total_bytes,
7ec253a97341 Import transcode-0.6.1.20020829 XviD VBR Library into mencoder DivX4 encoder
kmkaplan
parents:
diff changeset
226 int kblocks,
7ec253a97341 Import transcode-0.6.1.20020829 XviD VBR Library into mencoder DivX4 encoder
kmkaplan
parents:
diff changeset
227 int mblocks,
7ec253a97341 Import transcode-0.6.1.20020829 XviD VBR Library into mencoder DivX4 encoder
kmkaplan
parents:
diff changeset
228 int ublocks);
7ec253a97341 Import transcode-0.6.1.20020829 XviD VBR Library into mencoder DivX4 encoder
kmkaplan
parents:
diff changeset
229 extern int vbrFinish(vbr_control_t *state);
7ec253a97341 Import transcode-0.6.1.20020829 XviD VBR Library into mencoder DivX4 encoder
kmkaplan
parents:
diff changeset
230
7ec253a97341 Import transcode-0.6.1.20020829 XviD VBR Library into mencoder DivX4 encoder
kmkaplan
parents:
diff changeset
231 #endif