22 |
* along with this program; if not, write to the Free Software |
* along with this program; if not, write to the Free Software |
23 |
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
24 |
* |
* |
25 |
* $Id: plugin_2pass1.c,v 1.1.2.2 2003-04-08 14:01:09 suxen_drol Exp $ |
* $Id: plugin_2pass1.c,v 1.1.2.4 2003-05-17 13:36:38 suxen_drol Exp $ |
26 |
* |
* |
27 |
*****************************************************************************/ |
*****************************************************************************/ |
28 |
|
|
36 |
typedef struct |
typedef struct |
37 |
{ |
{ |
38 |
FILE * stat_file; |
FILE * stat_file; |
39 |
|
|
40 |
|
double fq_error; |
41 |
} rc_2pass1_t; |
} rc_2pass1_t; |
42 |
|
|
43 |
|
|
70 |
fprintf(rc->stat_file, "start\n"); |
fprintf(rc->stat_file, "start\n"); |
71 |
fprintf(rc->stat_file, "type quantizer length kblocks mblocks ublocks\n"); */ |
fprintf(rc->stat_file, "type quantizer length kblocks mblocks ublocks\n"); */ |
72 |
|
|
73 |
|
rc->fq_error = 0; |
74 |
|
|
75 |
*handle = rc; |
*handle = rc; |
76 |
return(0); |
return(0); |
77 |
} |
} |
79 |
|
|
80 |
static int rc_2pass1_destroy(rc_2pass1_t * rc, xvid_plg_destroy_t * destroy) |
static int rc_2pass1_destroy(rc_2pass1_t * rc, xvid_plg_destroy_t * destroy) |
81 |
{ |
{ |
|
//fprintf(rc->stat_file, "stop\n"); |
|
82 |
fclose(rc->stat_file); |
fclose(rc->stat_file); |
83 |
|
|
84 |
free(rc); |
free(rc); |
88 |
|
|
89 |
static int rc_2pass1_before(rc_2pass1_t * rc, xvid_plg_data_t * data) |
static int rc_2pass1_before(rc_2pass1_t * rc, xvid_plg_data_t * data) |
90 |
{ |
{ |
91 |
|
if (data->quant <= 0) { |
92 |
|
if (data->zone && data->zone->mode == XVID_ZONE_QUANT) { |
93 |
|
rc->fq_error += (double)data->zone->increment / (double)data->zone->base; |
94 |
|
data->quant = (int)rc->fq_error; |
95 |
|
rc->fq_error -= data->quant; |
96 |
|
|
97 |
|
}else { |
98 |
data->quant = 2; |
data->quant = 2; |
99 |
data->type = XVID_TYPE_AUTO; |
} |
100 |
|
} |
101 |
return 0; |
return 0; |
102 |
} |
} |
103 |
|
|