MCPcopy Create free account
hub / github.com/OpenDriveLab/OpenLane / rleEncode

Function rleEncode

eval/CIPO_evaluation/common/maskApi.c:49–58  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

47}
48
49void rleEncode( RLE *R, const byte *M, siz h, siz w, siz n ) {
50 siz i, j, k, a=w*h; uint c, *cnts; byte p;
51 cnts = malloc(sizeof(uint)*(a+1));
52 for(i=0; i<n; i++) {
53 const byte *T=M+a*i; k=0; p=0; c=0;
54 for(j=0; j<a; j++) { if(T[j]!=p) { cnts[k++]=c; c=0; p=T[j]; } c++; }
55 cnts[k++]=c; rleInit(R+i,h,w,k,cnts);
56 }
57 free(cnts);
58}
59
60void rleDecode( const RLE *R, byte *M, siz n ) {
61 siz i, j, k; for( i=0; i<n; i++ ) {

Callers 1

Calls 1

rleInitFunction · 0.85

Tested by

no test coverage detected