49 |
double total2 = 0.0; |
double total2 = 0.0; |
50 |
double dbytes, dbytes2; |
double dbytes, dbytes2; |
51 |
|
|
52 |
|
/* ensure free() is called safely */ |
53 |
|
codec->twopass.hintstream = NULL; |
54 |
|
twopass->nns1_array = NULL; |
55 |
|
twopass->nns2_array = NULL; |
56 |
|
|
57 |
if (codec->config.hinted_me) |
if (codec->config.hinted_me) |
58 |
{ |
{ |
59 |
codec->twopass.hintstream = malloc(100000); |
codec->twopass.hintstream = malloc(100000); |
665 |
break; |
break; |
666 |
} |
} |
667 |
|
|
668 |
|
if (bframes) |
669 |
twopass->average_bframe = (double)bframe_total / bframes / twopass->movie_curve; |
twopass->average_bframe = (double)bframe_total / bframes / twopass->movie_curve; |
670 |
|
|
671 |
|
if (pframes) |
672 |
twopass->average_pframe = (double)pframe_total / pframes / twopass->movie_curve; |
twopass->average_pframe = (double)pframe_total / pframes / twopass->movie_curve; |
673 |
|
else |
674 |
|
if (bframes) |
675 |
|
twopass->average_pframe = twopass->average_bframe; // b-frame packed bitstream fix |
676 |
|
else |
677 |
|
{ |
678 |
|
DEBUGERR("ERROR: No p-frames or b-frames were present in the 1st pass. Rate control cannot function properly!"); |
679 |
|
return ICERR_ERROR; |
680 |
|
} |
681 |
|
|
682 |
|
|
683 |
|
|