708 |
for (i=0 ; i<32 ; ++i) |
for (i=0 ; i<32 ; ++i) |
709 |
{ |
{ |
710 |
quant_error[i] = 0.0; |
quant_error[i] = 0.0; |
711 |
|
twopass->quant_count[i] = 0; |
712 |
} |
} |
713 |
|
|
714 |
curve_comp_error = 0.0; |
curve_comp_error = 0.0; |
1039 |
|
|
1040 |
NNSTATS nns1; |
NNSTATS nns1; |
1041 |
DWORD wrote; |
DWORD wrote; |
1042 |
|
int credits_pos; |
1043 |
char* quant_type; |
char* quant_type; |
1044 |
|
|
1045 |
if (codec->framenum == 0) |
if (codec->framenum == 0) |
1086 |
case DLG_MODE_2PASS_2_INT : |
case DLG_MODE_2PASS_2_INT : |
1087 |
case DLG_MODE_2PASS_2_EXT : |
case DLG_MODE_2PASS_2_EXT : |
1088 |
codec->twopass.overflow += codec->twopass.desired_bytes2 - frame->length; |
codec->twopass.overflow += codec->twopass.desired_bytes2 - frame->length; |
1089 |
DEBUG2ND(frame->quant, quant_type, frame->intra, codec->twopass.bytes1, codec->twopass.desired_bytes2, frame->length, codec->twopass.overflow, codec_is_in_credits(&codec->config, codec->framenum)) |
|
1090 |
|
credits_pos = codec_is_in_credits(&codec->config, codec->framenum); |
1091 |
|
if (!credits_pos) |
1092 |
|
codec->twopass.quant_count[frame->quant]++; |
1093 |
|
|
1094 |
|
DEBUG2ND(frame->quant, quant_type, frame->intra, codec->twopass.bytes1, codec->twopass.desired_bytes2, frame->length, codec->twopass.overflow, credits_pos) |
1095 |
break; |
break; |
1096 |
|
|
1097 |
default: |
default: |
1101 |
return ICERR_OK; |
return ICERR_OK; |
1102 |
} |
} |
1103 |
|
|
1104 |
|
void codec_2pass_finish(CODEC* codec) |
1105 |
|
{ |
1106 |
|
int i; |
1107 |
|
char s[100]; |
1108 |
|
if (codec->config.mode == DLG_MODE_2PASS_2_EXT || codec->config.mode == DLG_MODE_2PASS_2_INT) |
1109 |
|
{ |
1110 |
|
// output the quantizer distribution for this encode. |
1111 |
|
|
1112 |
|
OutputDebugString("Quantizer distribution for 2nd pass:"); |
1113 |
|
for (i=1; i<=31; i++) |
1114 |
|
{ |
1115 |
|
if (codec->twopass.quant_count[i]) |
1116 |
|
{ |
1117 |
|
wsprintf(s, "Q:%i:%i", i, codec->twopass.quant_count[i]); |
1118 |
|
OutputDebugString(s); |
1119 |
|
} |
1120 |
|
} |
1121 |
|
return; |
1122 |
|
} |
1123 |
|
} |