| 3529 | } |
| 3530 | |
| 3531 | static void |
| 3532 | icvWriteMat( CvFileStorage* fs, const char* name, |
| 3533 | const void* struct_ptr, CvAttrList /*attr*/ ) |
| 3534 | { |
| 3535 | const CvMat* mat = (const CvMat*)struct_ptr; |
| 3536 | char dt[16]; |
| 3537 | CvSize size; |
| 3538 | int y; |
| 3539 | |
| 3540 | assert( CV_IS_MAT_HDR_Z(mat) ); |
| 3541 | |
| 3542 | cvStartWriteStruct( fs, name, CV_NODE_MAP, CV_TYPE_NAME_MAT ); |
| 3543 | cvWriteInt( fs, "rows", mat->rows ); |
| 3544 | cvWriteInt( fs, "cols", mat->cols ); |
| 3545 | cvWriteString( fs, "dt", icvEncodeFormat( CV_MAT_TYPE(mat->type), dt ), 0 ); |
| 3546 | cvStartWriteStruct( fs, "data", CV_NODE_SEQ + CV_NODE_FLOW ); |
| 3547 | |
| 3548 | size = cvGetSize(mat); |
| 3549 | if( size.height > 0 && size.width > 0 && mat->data.ptr ) |
| 3550 | { |
| 3551 | if( CV_IS_MAT_CONT(mat->type) ) |
| 3552 | { |
| 3553 | size.width *= size.height; |
| 3554 | size.height = 1; |
| 3555 | } |
| 3556 | |
| 3557 | for( y = 0; y < size.height; y++ ) |
| 3558 | cvWriteRawData( fs, mat->data.ptr + (size_t)y*mat->step, size.width, dt ); |
| 3559 | } |
| 3560 | cvEndWriteStruct( fs ); |
| 3561 | cvEndWriteStruct( fs ); |
| 3562 | } |
| 3563 | |
| 3564 | |
| 3565 | static int |
nothing calls this directly
no test coverage detected