MCPcopy Create free account
hub / github.com/audeering/opensmile / resize

Method resize

src/core/dataMemoryLevel.cpp:540–569  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

538}
539
540int cMatrix::resize(long _new_nT) {
541 int ret=1;
542 if (_new_nT < nT) return 1;
543
544 FLOAT_DMEM *tmp = (FLOAT_DMEM *)crealloc(data, _new_nT*sizeof(FLOAT_DMEM)*N, nT*sizeof(FLOAT_DMEM)*N);
545 if (tmp==NULL) ret = 0;
546 else data = tmp;
547
548 if (ret) {
549 // tmeta
550 if (tmeta != NULL) {
551 TimeMetaInfo *old = tmeta;
552 tmeta = new (std::nothrow) TimeMetaInfo[_new_nT];
553 if (tmeta == NULL) { ret=0; tmeta = old; }
554 else {
555 if (!tmetaAlien) {
556 std::move(old, old + nT, tmeta);
557 delete[] old;
558 } else {
559 std::copy(old, old + nT, tmeta);
560 }
561 tmetaAlien = 0;
562 }
563 }
564 }
565
566 if (ret) nT = _new_nT;
567
568 return ret;
569}
570
571void cMatrix::copyData(void *dest, long destIdx, void *src, long srcIdx, long nT, long N, bool zeroSource) {
572 memcpy(&((FLOAT_DMEM *)dest)[destIdx * N], &((FLOAT_DMEM *)src)[srcIdx * N], sizeof(FLOAT_DMEM) * N * nT);

Callers 4

growLevelMethod · 0.45
runSingleThreadedMethod · 0.45
addVecToBufMethod · 0.45
loadBufferMethod · 0.45

Calls 1

creallocFunction · 0.85

Tested by 1

loadBufferMethod · 0.36