MCPcopy Create free account
hub / github.com/creatale/node-dv / UpdateTablesForFeature

Method UpdateTablesForFeature

deps/tesseract/classify/intmatcher.cpp:771–915  ·  view source on GitHub ↗

* For the given feature: prune protos, compute evidence, * update Feature Evidence, Proto Evidence, and Sum of Feature * Evidence tables. * @param ClassTemplate Prototypes & tables for a class * @param FeatureNum Current feature number (for DEBUG only) * @param Feature Pointer to a feature struct * @param tables Evidence tables * @param Debug Debugger flag: 1=debugger on * @return none */

Source from the content-addressed store, hash-verified

769 * @return none
770 */
771int IntegerMatcher::UpdateTablesForFeature(
772 INT_CLASS ClassTemplate,
773 BIT_VECTOR ProtoMask,
774 BIT_VECTOR ConfigMask,
775 int FeatureNum,
776 const INT_FEATURE_STRUCT* Feature,
777 ScratchEvidence *tables,
778 int Debug) {
779 uinT32 ConfigWord;
780 uinT32 ProtoWord;
781 uinT32 ProtoNum;
782 uinT32 ActualProtoNum;
783 uinT8 proto_byte;
784 inT32 proto_word_offset;
785 inT32 proto_offset;
786 uinT8 config_byte;
787 inT32 config_offset;
788 PROTO_SET ProtoSet;
789 uinT32 *ProtoPrunerPtr;
790 INT_PROTO Proto;
791 int ProtoSetIndex;
792 uinT8 Evidence;
793 uinT32 XFeatureAddress;
794 uinT32 YFeatureAddress;
795 uinT32 ThetaFeatureAddress;
796 uinT8* UINT8Pointer;
797 int ProtoIndex;
798 uinT8 Temp;
799 int* IntPointer;
800 int ConfigNum;
801 inT32 M3;
802 inT32 A3;
803 uinT32 A4;
804
805 tables->ClearFeatureEvidence(ClassTemplate);
806
807 /* Precompute Feature Address offset for Proto Pruning */
808 XFeatureAddress = ((Feature->X >> 2) << 1);
809 YFeatureAddress = (NUM_PP_BUCKETS << 1) + ((Feature->Y >> 2) << 1);
810 ThetaFeatureAddress = (NUM_PP_BUCKETS << 2) + ((Feature->Theta >> 2) << 1);
811
812 for (ProtoSetIndex = 0, ActualProtoNum = 0;
813 ProtoSetIndex < ClassTemplate->NumProtoSets; ProtoSetIndex++) {
814 ProtoSet = ClassTemplate->ProtoSets[ProtoSetIndex];
815 ProtoPrunerPtr = (uinT32 *) ((*ProtoSet).ProtoPruner);
816 for (ProtoNum = 0; ProtoNum < PROTOS_PER_PROTO_SET;
817 ProtoNum += (PROTOS_PER_PROTO_SET >> 1), ActualProtoNum +=
818 (PROTOS_PER_PROTO_SET >> 1), ProtoMask++, ProtoPrunerPtr++) {
819 /* Prune Protos of current Proto Set */
820 ProtoWord = *(ProtoPrunerPtr + XFeatureAddress);
821 ProtoWord &= *(ProtoPrunerPtr + YFeatureAddress);
822 ProtoWord &= *(ProtoPrunerPtr + ThetaFeatureAddress);
823 ProtoWord &= *ProtoMask;
824
825 if (ProtoWord != 0) {
826 proto_byte = ProtoWord & 0xff;
827 ProtoWord >>= 8;
828 proto_word_offset = 0;

Callers

nothing calls this directly

Calls 3

IMDebugConfigurationFunction · 0.85
IMDebugConfigurationSumFunction · 0.85
ClearFeatureEvidenceMethod · 0.80

Tested by

no test coverage detected