45 :
INT_MEMBER(language_model_debug_level, 0,
"Language model debug level",
46 dict->getImage()->getCCUtil()->params()),
48 "Turn on/off the use of character ngram model",
49 dict->getImage()->getCCUtil()->params()),
51 "Maximum order of the character ngram model",
52 dict->getImage()->getCCUtil()->params()),
53 INT_MEMBER(language_model_viterbi_list_max_num_prunable, 10,
54 "Maximum number of prunable (those for which"
55 " PrunablePath() is true) entries in each viterbi list"
56 " recorded in BLOB_CHOICEs",
57 dict->getImage()->getCCUtil()->params()),
58 INT_MEMBER(language_model_viterbi_list_max_size, 500,
59 "Maximum size of viterbi lists recorded in BLOB_CHOICEs",
60 dict->getImage()->getCCUtil()->params()),
62 "To avoid overly small denominators use this as the "
63 "floor of the probability returned by the ngram model.",
64 dict->getImage()->getCCUtil()->params()),
66 "Average classifier score of a non-matching unichar.",
67 dict->getImage()->getCCUtil()->params()),
68 BOOL_MEMBER(language_model_ngram_use_only_first_uft8_step, false,
69 "Use only the first UTF8 step of the given string"
70 " when computing log probabilities.",
71 dict->getImage()->getCCUtil()->params()),
73 "Strength of the character ngram model relative to the"
74 " character classifier ",
75 dict->getImage()->getCCUtil()->params()),
76 BOOL_MEMBER(language_model_ngram_space_delimited_language, true,
77 "Words are delimited by space",
78 dict->getImage()->getCCUtil()->params()),
79 INT_MEMBER(language_model_min_compound_length, 3,
80 "Minimum length of compound words",
81 dict->getImage()->getCCUtil()->params()),
82 INT_MEMBER(language_model_fixed_length_choices_depth, 3,
83 "Depth of blob choice lists to explore"
84 " when fixed length dawgs are on",
85 dict->getImage()->getCCUtil()->params()),
87 "Penalty for words not in the frequent word dictionary",
88 dict->getImage()->getCCUtil()->params()),
90 "Penalty for non-dictionary words",
91 dict->getImage()->getCCUtil()->params()),
93 "Penalty for inconsistent punctuation",
94 dict->getImage()->getCCUtil()->params()),
96 "Penalty for inconsistent case",
97 dict->getImage()->getCCUtil()->params()),
99 "Penalty for inconsistent script",
100 dict->getImage()->getCCUtil()->params()),
102 "Penalty for inconsistent character type",
103 dict->getImage()->getCCUtil()->params()),
107 "Penalty for inconsistent font",
108 dict->getImage()->getCCUtil()->params()),
110 "Penalty for inconsistent spacing",
111 dict->getImage()->getCCUtil()->params()),
114 dict->getImage()->getCCUtil()->params()),
116 "Use sigmoidal score for certainty",
117 dict->getImage()->getCCUtil()->params()),
118 fontinfo_table_(fontinfo_table), dict_(dict),
119 fixed_pitch_(false), max_char_wh_ratio_(0.0),
120 acceptable_choice_found_(false) {
124 0.0, NO_PERM, kAnyWordLength, -1);
143 bool fixed_pitch,
float best_choice_cert,
float max_char_wh_ratio,
155 for (
int col = 0; col < ratings->
dimension(); ++col) {
156 for (
int row = col+1; row < ratings->
dimension(); ++row) {
160 float worst_piece_cert;
163 &worst_piece_cert, &fragmented);
165 worst_piece_cert, fragmented, best_choice_cert,
167 chunks_record, pain_points);
180 int dawg_index = (*beginning_active_dawgs_)[i].dawg_index;
181 if (dawg_index <= dict_->GetMaxFixedLengthDawgIndex() &&
215 if (blamer_bundle !=
NULL &&
219 blamer_debug +=
"Blamer computing correct_segmentation_cols\n";
220 int curr_box_col = 0;
221 int next_box_col = 0;
224 for (
int truth_idx = 0;
228 inT16 curr_box_x = next_box_x;
231 blamer_debug.
add_str_int(
"Box x coord vs. truth: ", curr_box_x);
233 blamer_debug +=
"\n";
236 }
else if (curr_box_x >=
245 blamer_debug +=
"\n";
246 curr_box_col = next_box_col;
252 blamer_debug.
add_str_int(
"Blamer failed to find correct segmentation"
254 if (blob ==
NULL) blamer_debug +=
" blob == NULL";
255 blamer_debug +=
")\n";
260 blamer_debug +=
"\n";
268 if (blamer_bundle !=
NULL) {
281 BLOB_CHOICE_IT b_it(choices);
282 for (b_it.mark_cycle_pt(); !b_it.cycled_list(); b_it.forward()) {
283 if (b_it.data()->language_model_state() !=
NULL) {
285 b_it.data()->language_model_state());
287 b_it.data()->set_language_model_state(
NULL);
294 int curr_col,
int curr_row,
295 BLOB_CHOICE_LIST *curr_list,
296 BLOB_CHOICE_LIST *parent_list,
303 tprintf(
"\nUpdateState: col=%d row=%d (changed=0x%x parent=%p)\n",
304 curr_col, curr_row, changed, parent_list);
313 ViterbiStateEntry_IT vit;
314 BLOB_CHOICE_IT c_it(curr_list);
315 int c_it_counter = 0;
316 bool first_iteration =
true;
320 for (c_it.mark_cycle_pt(); !c_it.cycled_list(); c_it.forward()) {
326 if (!curr_list->singleton() && c_it.data()->unichar_id() == 0)
continue;
335 if (first_lower == c_it.data()) top_choice_flags |=
kLowerCaseFlag;
336 if (first_upper == c_it.data()) top_choice_flags |=
kUpperCaseFlag;
338 if (parent_list ==
NULL) {
340 top_choice_flags, denom, word_end, curr_col, curr_row,
341 c_it.data(),
NULL,
NULL, pain_points, best_path_by_column,
342 chunks_record, best_choice_bundle, blamer_bundle);
344 BLOB_CHOICE_IT p_it(parent_list);
345 for (p_it.mark_cycle_pt(); !p_it.cycled_list(); p_it.forward()) {
348 p_it.data()->language_model_state());
354 for (vit.mark_cycle_pt(); !vit.cycled_list(); vit.forward()) {
358 vit.data()->dawg_info) &&
365 if (!just_classified && !vit.data()->updated)
continue;
369 top_choice_flags, denom, word_end, curr_col, curr_row,
370 c_it.data(), p_it.data(), vit.data(), pain_points,
371 best_path_by_column, chunks_record,
372 best_choice_bundle, blamer_bundle);
376 first_iteration =
false;
388 tprintf(
"ProblematicPath: inconsistent\n");
397 tprintf(
"ProblematicPath: dict word terminated\n");
407 tprintf(
"ProblematicPath: small ngram prob\n");
419 tprintf(
"ProblematicPath: non-alpha middle\n");
427 BLOB_CHOICE_LIST *curr_list,
431 BLOB_CHOICE_IT c_it(curr_list);
434 for (c_it.mark_cycle_pt(); !c_it.cycled_list(); c_it.forward()) {
435 UNICHAR_ID unichar_id = c_it.data()->unichar_id();
437 if (first_unichar ==
NULL) first_unichar = c_it.data();
439 *first_lower = c_it.data();
442 *first_upper = c_it.data();
446 if (*first_lower ==
NULL) *first_lower = first_unichar;
447 if (*first_upper ==
NULL) *first_upper = first_unichar;
454 int curr_col,
int curr_row,
463 ViterbiStateEntry_IT vit;
465 tprintf(
"\nAddViterbiStateEntry for unichar %s rating=%.4f"
466 " certainty=%.4f top_choice_flags=0x%x parent_vse=%p\n",
470 tprintf(
"Existing viterbi list:\n");
471 vit.set_to_list(&(reinterpret_cast<LanguageModelState *>(
473 for (vit.mark_cycle_pt(); !vit.cycled_list(); vit.forward()) {
484 tprintf(
"AddViterbiStateEntry: viterbi list is full!\n");
490 float optimistic_cost = 0.0f;
492 if (parent_vse !=
NULL) optimistic_cost += parent_vse->
cost;
496 tprintf(
"Discarded ViterbiEntry with high cost %.4f"
497 " best_choice->rating()=%.4f\n", optimistic_cost,
506 chunks_record, &consistency_info);
511 curr_col, curr_row, *b, parent_vse, &changed);
514 float ratings_sum = b->
rating();
517 parent_vse, b, &top_choice_flags, &changed);
524 denom, curr_col, curr_row, parent_vse, parent_b, &changed);
531 if (ngram_info !=
NULL) ngram_info->
pruned =
true;
537 tprintf(
"Language model components did not like this entry\n");
547 parent_vse, chunks_record, &associate_stats);
548 if (parent_vse !=
NULL) {
556 (parent_vse ==
NULL) ? 1 : (parent_vse->
length+1),
557 (dawg_info ==
NULL) ? 0.0f : 1.0f,
558 dawg_info, ngram_info, consistency_info, associate_stats, parent_vse);
574 tprintf(
"Discarded ViterbiEntry with high cost %g max cost %g\n",
585 associate_stats, top_choice_flags, dawg_info, ngram_info);
601 for (vit.mark_cycle_pt(); !vit.cycled_list(); vit.forward()) {
615 if (prunable_counter > 0 &&
620 if (prunable_counter == 0) {
623 tprintf(
"Set viterbi_state_entries_prunable_max_cost to %.4f\n",
626 prunable_counter = -1;
635 tprintf(
"Updated viterbi list (max cost %g):\n",
638 for (vit.mark_cycle_pt(); !vit.cycled_list(); vit.forward()) {
647 best_choice_bundle, blamer_bundle);
653 float avg_cost = new_vse->
cost /
static_cast<float>(curr_row+1);
654 for (
int c = curr_col; c <= curr_row; ++c) {
655 if (avg_cost < (*best_path_by_column)[c].avg_cost) {
656 (*best_path_by_column)[c].avg_cost = avg_cost;
657 (*best_path_by_column)[c].best_vse = new_vse;
658 (*best_path_by_column)[c].best_b = b;
660 tprintf(
"Set best_path_by_column[%d]=(%g %p)\n",
661 c, avg_cost, new_vse);
672 tprintf(
"%s ViterbiStateEntry %p with ratings_sum=%.4f length=%d cost=%.4f",
678 tprintf(
" inconsistent=(punc %d case %d chartype %d script %d)\n",
686 tprintf(
" ngram_cost=%g context=%s ngram pruned=%d",
714 ratings_sum, dawg_info, consistency_info);
718 if (*top_choice_flags == 0x0)
return;
723 for (vit.mark_cycle_pt(); !vit.cycled_list(); vit.forward()) {
725 vit.data()->ratings_sum, vit.data()->dawg_info,
726 vit.data()->consistency_info)) {
729 *top_choice_flags &= ~(vit.data()->top_choice_flags);
734 tprintf(
"GenerateTopChoiceInfo: top_choice_flags=0x%x\n",
737 *changed |= *top_choice_flags;
741 bool word_end,
int script_id,
742 int curr_col,
int curr_row,
750 if (parent_vse ==
NULL ||
763 if (!use_fixed_length_dawgs && word_end &&
780 if (parent_vse ==
NULL || word_end ||
786 bool has_word_ending =
false;
790 assert(pdawg !=
NULL);
793 has_word_ending =
true;
797 if (!has_word_ending)
return NULL;
807 beginning_word_dawgs += (*beginning_active_dawgs_)[i];
830 if (use_fixed_length_dawgs) {
831 if (dawg_info ==
NULL) {
845 const char *unichar,
float certainty,
float denom,
846 int curr_col,
int curr_row,
851 const char *pcontext_ptr =
"";
852 int pcontext_unichar_step_len = 0;
853 if (parent_vse ==
NULL) {
858 pcontext_unichar_step_len =
862 int unichar_step_len = 0;
866 pcontext_ptr, &unichar_step_len,
867 &pruned, &ngram_prob);
873 if (curr_row > curr_col) {
874 ngram_cost += (curr_row - curr_col) * ngram_cost;
875 ngram_prob += (curr_row - curr_col) * ngram_prob;
878 if (parent_vse !=
NULL) {
884 int num_remove = (unichar_step_len + pcontext_unichar_step_len -
886 if (num_remove > 0) pcontext_unichar_step_len -= num_remove;
887 while (num_remove > 0 && *pcontext_ptr !=
'\0') {
898 pcontext_ptr, pcontext_unichar_step_len, pruned, ngram_prob, ngram_cost);
899 ngram_info->
context += unichar;
909 int *unichar_step_len,
910 bool *found_small_prob,
912 const char *context_ptr = context;
913 char *modified_context =
NULL;
914 char *modified_context_end =
NULL;
915 const char *unichar_ptr = unichar;
916 const char *unichar_end = unichar_ptr + strlen(unichar_ptr);
919 while (unichar_ptr < unichar_end &&
922 tprintf(
"prob(%s | %s)=%g\n", unichar_ptr, context_ptr,
926 ++(*unichar_step_len);
932 if (unichar_ptr < unichar_end) {
933 if (modified_context ==
NULL) {
934 int context_len = strlen(context);
936 new char[context_len + strlen(unichar_ptr) + step + 1];
937 strncpy(modified_context, context, context_len);
938 modified_context_end = modified_context + context_len;
939 context_ptr = modified_context;
941 strncpy(modified_context_end, unichar_ptr - step, step);
942 modified_context_end += step;
943 *modified_context_end =
'\0';
946 prob /=
static_cast<float>(*unichar_step_len);
949 *found_small_prob =
true;
951 *ngram_prob = -1.0*log(prob);
955 tprintf(
"-log [ p(%s) * p(%s | %s) ] = -log(%g*%g) = %g\n", unichar,
956 unichar, context_ptr,
CertaintyScore(certainty)/denom, prob, cost);
958 if (modified_context !=
NULL)
delete[] modified_context;
963 if (curr_list->empty())
return 1.0
f;
966 BLOB_CHOICE_IT c_it(curr_list);
967 for (c_it.mark_cycle_pt(); !c_it.cycled_list(); c_it.forward()) {
1002 consistency_info->
punc_ref = NO_EDGE;
1008 if (consistency_info->
punc_ref == NO_EDGE ||
1016 node, pattern_unichar_id, word_end) : NO_EDGE;
1017 if (consistency_info->
punc_ref == NO_EDGE) {
1032 }
else if ((parent_b !=
NULL) && unicharset.
get_isupper(unichar_id)) {
1055 if (parent_vse !=
NULL &&
1061 consistency_info->
script_id = parent_script_id;
1063 if (consistency_info->
script_id != parent_script_id) {
1078 if (parent_b !=
NULL) {
1079 int fontinfo_id = -1;
1088 tprintf(
"pfont %s pfont %s font %s font2 %s common %s(%d)\n",
1099 bool expected_gap_found =
false;
1102 if (fontinfo_id >= 0) {
1104 parent_b->
unichar_id(), unichar_id, &temp_gap)) {
1105 expected_gap = temp_gap;
1106 expected_gap_found =
true;
1111 int num_addends = 0;
1114 for (
int i = 0; i < 4; ++i) {
1117 }
else if (i == 1) {
1119 }
else if (i == 2) {
1125 parent_b->
unichar_id(), unichar_id, &temp_gap)) {
1126 expected_gap += temp_gap;
1130 expected_gap_found = (num_addends > 0);
1131 if (num_addends > 0) expected_gap /=
static_cast<float>(num_addends);
1133 if (expected_gap_found) {
1137 float gap_ratio = expected_gap / actual_gap;
1139 if (gap_ratio < 1/2 || gap_ratio > 2) {
1143 tprintf(
"spacing for %s(%d) %s(%d) col %d: expected %g actual %g\n",
1146 unichar_id, curr_col, expected_gap, actual_gap);
1153 float ratings_sum,
int length,
float dawg_score,
1159 float adjustment = 1.0f;
1160 if (dawg_info ==
NULL || dawg_info->
permuter != FREQ_DAWG_PERM) {
1163 if (dawg_score == 0.0
f) {
1169 }
else if (dawg_score < 1.0
f) {
1173 adjustment += associate_stats.
shape_cost /
static_cast<float>(length);
1180 return ratings_sum * adjustment;
1193 for (i = 0; i < vse->
length; ++i) {
1196 float *certainties =
new float[vse->
length];
1205 &temp_best_char_choices, certainties,
1206 &dawg_score, &temp_state,
1207 blamer_bundle, &truth_path);
1223 tprintf(
"UpdateBestChoice() constructed word %s\n", word_str.
string());
1250 tprintf(
"Updated vse cost to %g (dawg_score %g full_wh_ratio_var %g)\n",
1264 certainties,
false, word, temp_best_char_choices);
1268 bool modified_blobs;
1277 best_choice_bundle->
updated =
true;
1280 for (i = 0; i < temp_best_char_choices.
size(); ++i) {
1281 BLOB_CHOICE_LIST *cc_list =
new BLOB_CHOICE_LIST();
1288 tprintf(
"Updated best choice\n");
1301 best_choice_bundle->
best_vse = vse;
1302 best_choice_bundle->
best_b = b;
1303 best_choice_bundle->
fixpt = fixpt;
1305 if (blamer_bundle !=
NULL) {
1313 if (blamer_bundle !=
NULL) {
1326 delete[] certainties;
1380 float certainties[],
1386 if (truth_path !=
NULL) {
1388 (blamer_bundle !=
NULL &&
1392 const uinT64 kHighestBitOn = 0x8000000000000000LL;
1400 bool dawg_score_done =
true;
1401 if (dawg_score !=
NULL) {
1408 }
else if (vse->
length == 1) {
1410 dawg_score_done =
true;
1412 dawg_score_done =
false;
1417 int covered_by_fixed_length_dawgs = 0;
1420 int fixed_length_num_unichars_to_skip = 0;
1424 float full_wh_ratio_mean = 0.0f;
1428 static_cast<float>(vse->
length));
1436 for (i = (vse->
length-1); i >= 0; --i) {
1437 if (blamer_bundle !=
NULL && truth_path !=
NULL && *truth_path) {
1442 *truth_path =
false;
1447 if (certainties !=
NULL) certainties[i] = curr_b->
certainty();
1448 if (best_char_choices !=
NULL) {
1452 if (state !=
NULL) {
1461 state_uint |= kHighestBitOn;
1470 &fixed_length_num_unichars_to_skip,
1471 &covered_by_fixed_length_dawgs,
1472 dawg_score, &dawg_score_done);
1477 if ((full_wh_ratio_mean != 0.0
f &&
1483 tprintf(
"full_wh_ratio_var += (%g-%g)^2\n",
1503 if (full_wh_ratio_mean != 0.0
f) {
1507 if (state !=
NULL) {
1509 state->
part2 = state_uint;
1511 state->
part1 = state_uint;
1528 const DawgInfoVector &active_dawgs,
int word_index,
int word_length,
1529 int *skip,
int *covered,
float *dawg_score,
bool *dawg_score_done) {
1531 tprintf(
"UpdateCoveredByFixedLengthDawgs for index %d skip=%d\n",
1532 word_index, *skip, word_length);
1538 int best_index = -1;
1539 for (
int d = 0; d < active_dawgs.
size(); ++d) {
1540 int dawg_index = (active_dawgs[d]).dawg_index;
1545 if (word_index == (word_length - 1)) {
1547 *dawg_score_done =
true;
1553 if ((active_dawgs[d]).ref != NO_EDGE &&
1555 dawg_index > best_index) {
1556 best_index = dawg_index;
1560 tprintf(
"dawg_index %d, ref %d, eow %d\n", dawg_index,
1561 (active_dawgs[d]).ref,
1562 ((active_dawgs[d]).ref != NO_EDGE &&
1567 if (best_index != -1) {
1568 *skip = best_index - 1;
1569 *covered += best_index;
1573 if (word_index == 0) {
1575 *dawg_score = (
static_cast<float>(*covered) /
1576 static_cast<float>(word_length));
1577 *dawg_score_done =
true;
1584 float best_choice_cert,
1588 for (
int i = 0; i < non_empty_rows.
length(); ++i) {
1589 int row = non_empty_rows[i];
1591 tprintf(
"\nLooking for pain points in col=%d row=%d\n", col, row);
1595 col, row, pain_points, chunks_record);
1598 col, row, best_choice_cert, pain_points,
1599 best_path_by_column, chunks_record);
1609 BLOB_CHOICE_IT bit(chunks_record->
ratings->
get(col, row));
1610 bool fragmented =
false;
1611 for (bit.mark_cycle_pt(); !bit.cycled_list(); bit.forward()) {
1617 bit.data()->language_model_state());
1618 if (lms ==
NULL)
continue;
1620 for (vit.mark_cycle_pt(); !vit.cycled_list(); vit.forward()) {
1631 -1.0f, fragmented, -1.0f,
1635 chunks_record, pain_points);
1648 -1.0f, fragmented, -1.0f,
1652 chunks_record, pain_points);
1656 -1.0
f, fragmented, -1.0
f,
1660 chunks_record, pain_points);
1669 int col,
int row,
float best_choice_cert,
1675 BLOB_CHOICE_LIST *blist = ratings->
get(col, row);
1677 if (blist->empty())
return;
1678 BLOB_CHOICE_IT bit(blist);
1679 bool fragment =
false;
1685 if (bit.data()->language_model_state() ==
NULL)
return;
1686 ViterbiStateEntry_IT vit(&(reinterpret_cast<LanguageModelState *>(
1687 bit.data()->language_model_state())->viterbi_state_entries));
1688 if (vit.empty())
return;
1691 bool path_is_promising =
true;
1693 float potential_avg_cost =
1695 static_cast<float>(row+1));
1697 tprintf(
"potential_avg_cost %g best cost %g\n",
1698 potential_avg_cost, (*best_path_by_column)[col].avg_cost);
1700 if (potential_avg_cost >= (*best_path_by_column)[col].avg_cost) {
1701 path_is_promising =
false;
1707 if (col > 0 && (*best_path_by_column)[col-1].best_vse !=
NULL) {
1710 ((*best_path_by_column)[col-1].best_b)->language_model_state());
1712 best_parent_vse = (*best_path_by_column)[col-1].best_vse;
1713 best_parent_b = (*best_path_by_column)[col-1].best_b;
1715 tprintf(
"Setting best_parent_vse to %p\n", best_parent_vse);
1721 bool best_not_prolonged = (best_parent_vse != vse->
parent_vse);
1725 BLOB_CHOICE_IT tmp_bit;
1726 if (best_not_prolonged ||
1727 (path_is_promising &&
1730 float worst_piece_cert;
1734 &worst_piece_cert, &fragmented);
1737 worst_piece_cert, fragmented, best_choice_cert,
1739 chunks_record, pain_points);
1743 &worst_piece_cert, &fragmented);
1745 worst_piece_cert, fragmented, best_choice_cert,
1747 chunks_record, pain_points);
1780 for (d = 0; d < best_choice_bundle->
fixpt.
size(); ++d) {
1791 int punc_streak_end_row = -1;
1792 int punc_streak_length = 0;
1793 float punc_streak_min_cert = 0.0f;
1796 tprintf(
"\nGenerating pain points for best path=%p\n", curr_vse);
1800 while (curr_vse !=
NULL) {
1805 tprintf(
"Looking at unichar %s\n",
1815 if (danger_end !=
NULL) {
1817 for (d = 0; d < danger_end[word_index].
size(); ++d) {
1818 danger_end[word_index][d].end = pp_row;
1819 danger_begin[danger_end[word_index][d].begin].
push_back(
1820 danger_end[word_index][d]);
1824 for (d = 0; d < danger_begin[word_index].size(); ++d) {
1826 tprintf(
"Generating pain point from %sambiguity\n",
1827 danger_begin[word_index][d].dangerous ?
"dangerous " :
"");
1830 danger_begin[word_index][d].dangerous ?
1837 chunks_record, pain_points);
1847 tprintf(
"Generating pain point from a problematic sub-path\n");
1849 float worst_piece_cert;
1853 &worst_piece_cert, &fragment);
1856 worst_piece_cert,
true,
1859 chunks_record, pain_points);
1863 &worst_piece_cert, &fragment);
1866 worst_piece_cert,
true,
1869 chunks_record, pain_points);
1877 if (punc_streak_end_row == -1) punc_streak_end_row = pp_row;
1878 punc_streak_length++;
1879 if (curr_b->
certainty() < punc_streak_min_cert)
1880 punc_streak_min_cert = curr_b->
certainty();
1883 if (punc_streak_end_row != -1 && punc_streak_length > 1) {
1885 tprintf(
"Generating pain point from a punctuation streak\n");
1891 punc_streak_min_cert,
true,
1894 chunks_record, pain_points);
1900 punc_streak_min_cert,
true,
1903 chunks_record, pain_points);
1906 punc_streak_end_row = -1;
1907 punc_streak_length = 0;
1908 punc_streak_min_cert = 0.0f;
1917 if (danger_end !=
NULL) {
1918 delete[] danger_begin;
1919 delete[] danger_end;
1924 int col,
int row,
bool ok_to_extend,
float priority,
1925 float worst_piece_cert,
bool fragmented,
float best_choice_cert,
1926 float max_char_wh_ratio,
1934 tprintf(
"\nGenerating pain point for col=%d row=%d priority=%g parent=",
1935 col, row, priority);
1936 if (parent_vse !=
NULL) {
1946 chunks_record, &associate_stats);
1956 chunks_record, &associate_stats);
1962 tprintf(
"Discarded pain point with a bad shape\n");
1971 if (worst_piece_cert < best_choice_cert) {
1972 worst_piece_cert = best_choice_cert;
1978 tprintf(
"worst_piece_cert=%g fragmented=%d\n",
1979 worst_piece_cert, fragmented);
1982 if (parent_vse !=
NULL) {
1983 priority *= sqrt(parent_vse->
cost / static_cast<float>(col));
1987 priority /= sqrt(static_cast<double>(parent_vse->
length));
1995 tprintf(
"Added pain point with priority %g\n", priority);