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

Function cvSetSeqReaderPos

deps/opencv/modules/core/src/datastructs.cpp:1032–1121  ·  view source on GitHub ↗

Set reader position to given position, * either absolute or relative to the * current one: */

Source from the content-addressed store, hash-verified

1030 * current one:
1031 */
1032CV_IMPL void
1033cvSetSeqReaderPos( CvSeqReader* reader, int index, int is_relative )
1034{
1035 CvSeqBlock *block;
1036 int elem_size, count, total;
1037
1038 if( !reader || !reader->seq )
1039 CV_Error( CV_StsNullPtr, "" );
1040
1041 total = reader->seq->total;
1042 elem_size = reader->seq->elem_size;
1043
1044 if( !is_relative )
1045 {
1046 if( index < 0 )
1047 {
1048 if( index < -total )
1049 CV_Error( CV_StsOutOfRange, "" );
1050 index += total;
1051 }
1052 else if( index >= total )
1053 {
1054 index -= total;
1055 if( index >= total )
1056 CV_Error( CV_StsOutOfRange, "" );
1057 }
1058
1059 block = reader->seq->first;
1060 if( index >= (count = block->count) )
1061 {
1062 if( index + index <= total )
1063 {
1064 do
1065 {
1066 block = block->next;
1067 index -= count;
1068 }
1069 while( index >= (count = block->count) );
1070 }
1071 else
1072 {
1073 do
1074 {
1075 block = block->prev;
1076 total -= block->count;
1077 }
1078 while( index < total );
1079 index -= total;
1080 }
1081 }
1082 reader->ptr = block->data + index * elem_size;
1083 if( reader->block != block )
1084 {
1085 reader->block = block;
1086 reader->block_min = block->data;
1087 reader->block_max = block->data + block->count * elem_size;
1088 }
1089 }

Callers 13

cvCvtSeqToArrayFunction · 0.85
cvSeqSliceFunction · 0.85
cvSeqRemoveSliceFunction · 0.85
cvSeqInsertSliceFunction · 0.85
cvSeqSortFunction · 0.85
icvSeqFindNextElemFunction · 0.85
persistence.cppFile · 0.85
seekMethod · 0.85
operations.hppFile · 0.85
cvArcLengthFunction · 0.85
icvContourSecAreaFunction · 0.85
icvApproxPolyDPFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected