MCPcopy Index your code
hub / github.com/MapServer/MapServer / pam_acolorhashtoacolorhist

Function pam_acolorhashtoacolorhist

mapquantization.c:703–732  ·  view source on GitHub ↗
( acht, maxacolors )

Source from the content-addressed store, hash-verified

701
702
703static acolorhist_vector
704pam_acolorhashtoacolorhist( acht, maxacolors )
705acolorhash_table acht;
706int maxacolors;
707{
708 acolorhist_vector achv;
709 acolorhist_list achl;
710 int i, j;
711
712 /* Now collate the hash table into a simple acolorhist array. */
713 achv = (acolorhist_vector) malloc( maxacolors * sizeof(struct acolorhist_item) );
714 /* (Leave room for expansion by caller.) */
715 if ( achv == (acolorhist_vector) 0 ) {
716 fprintf( stderr, " out of memory generating histogram\n" );
717 exit(9);
718 }
719
720 /* Loop through the hash table. */
721 j = 0;
722 for ( i = 0; i < HASH_SIZE; ++i )
723 for ( achl = acht[i]; achl != (acolorhist_list) 0; achl = achl->next )
724 {
725 /* Add the new entry. */
726 achv[j] = achl->ch;
727 ++j;
728 }
729
730 /* All done. */
731 return achv;
732}
733
734
735

Callers 1

pam_computeacolorhistFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected