mirror of
https://github.com/pgpointcloud/pointcloud.git
synced 2025-12-08 20:36:04 +00:00
Finish up change to PCBYTE holder
This commit is contained in:
parent
f499fbc18a
commit
9b20f737ba
@ -221,6 +221,7 @@ static PCBYTES initbytes(uint8_t *bytes, size_t size, uint32_t interp)
|
||||
pcb.interpretation = interp;
|
||||
pcb.npoints = pcb.size / INTERPRETATION_SIZES[pcb.interpretation];
|
||||
pcb.compression = PC_DIM_NONE;
|
||||
return pcb;
|
||||
}
|
||||
|
||||
/*
|
||||
@ -372,7 +373,7 @@ test_sigbits_encoding()
|
||||
0110000000000000 24576
|
||||
*/
|
||||
bytes = "aabbcc";
|
||||
pcb = initbytes(bytes, strlen(bytes)/2, PC_UINT16);
|
||||
pcb = initbytes(bytes, strlen(bytes), PC_UINT16);
|
||||
count = pc_sigbits_count(&pcb);
|
||||
CU_ASSERT_EQUAL(count, 6);
|
||||
|
||||
@ -427,7 +428,7 @@ test_sigbits_encoding()
|
||||
};
|
||||
/* encoded 0110000101100 001 010 011 100 101 110 */
|
||||
bytes = (uint8_t*)bytes16;
|
||||
pcb = initbytes(bytes, nelems, PC_INT16);
|
||||
pcb = initbytes(bytes, nelems*2, PC_INT16);
|
||||
|
||||
/* Test the 16 bit implementation path */
|
||||
common16 = pc_sigbits_count_16(&pcb, &count);
|
||||
@ -464,9 +465,13 @@ test_sigbits_encoding()
|
||||
103291 /* 0000000000000001 1001 0011 0111 1011 */
|
||||
};
|
||||
bytes = (uint8_t*)bytes32;
|
||||
pcb = initbytes(bytes, nelems, PC_INT32);
|
||||
epcb = pc_bytes_sigbits_encode(pcb);
|
||||
pcb = initbytes(bytes, nelems*4, PC_INT32);
|
||||
|
||||
common32 = pc_sigbits_count_32(&pcb, &count);
|
||||
CU_ASSERT_EQUAL(count, 26); /* unique bit count */
|
||||
CU_ASSERT_EQUAL(common32, 103232);
|
||||
|
||||
epcb = pc_bytes_sigbits_encode(pcb);
|
||||
ebytes32 = (uint32_t*)(epcb.bytes);
|
||||
CU_ASSERT_EQUAL(ebytes32[0], 6); /* unique bit count */
|
||||
CU_ASSERT_EQUAL(ebytes32[1], 103232); /* common bits */
|
||||
@ -494,7 +499,7 @@ test_sigbits_encoding()
|
||||
24929 /* 0000000000000001 1001 0011 0111 1011 */
|
||||
};
|
||||
bytes = (uint8_t*)bytes16;
|
||||
pcb = initbytes(bytes, nelems, PC_INT16);
|
||||
pcb = initbytes(bytes, nelems*2, PC_INT16);
|
||||
epcb = pc_bytes_sigbits_encode(pcb);
|
||||
pcb2 = pc_bytes_sigbits_decode(epcb);
|
||||
pc_bytes_free(epcb);
|
||||
|
||||
@ -343,7 +343,7 @@ uint8_t
|
||||
pc_sigbits_count_8(const PCBYTES *pcb, uint32_t *nsigbits)
|
||||
{
|
||||
static uint8_t nbits = 8;
|
||||
uint8_t *bytes = pcb->bytes;
|
||||
uint8_t *bytes = (uint8_t*)(pcb->bytes);
|
||||
uint8_t elem_and = bytes[0];
|
||||
uint8_t elem_or = bytes[0];
|
||||
uint32_t commonbits = nbits;
|
||||
@ -457,22 +457,22 @@ pc_sigbits_count(const PCBYTES *pcb)
|
||||
uint32_t nbits = -1;
|
||||
switch ( size )
|
||||
{
|
||||
case 1:
|
||||
case 1: /* INT8, UINT8 */
|
||||
{
|
||||
uint8_t commonvalue = pc_sigbits_count_8(pcb, &nbits);
|
||||
break;
|
||||
}
|
||||
case 2:
|
||||
case 2: /* INT16, UINT16 */
|
||||
{
|
||||
uint16_t commonvalue = pc_sigbits_count_16(pcb, &nbits);
|
||||
break;
|
||||
}
|
||||
case 4:
|
||||
case 4: /* INT32, UINT32 */
|
||||
{
|
||||
uint32_t commonvalue = pc_sigbits_count_32(pcb, &nbits);
|
||||
break;
|
||||
}
|
||||
case 8:
|
||||
case 8: /* DOUBLE, INT64, UINT64 */
|
||||
{
|
||||
uint64_t commonvalue = pc_sigbits_count_64(pcb, &nbits);
|
||||
break;
|
||||
@ -587,7 +587,7 @@ pc_bytes_sigbits_encode_16(const PCBYTES pcb, uint16_t commonvalue, uint8_t comm
|
||||
{
|
||||
int i;
|
||||
int shift;
|
||||
uint8_t *bytes = (uint8_t*)(pcb.bytes);
|
||||
uint16_t *bytes = (uint16_t*)(pcb.bytes);
|
||||
|
||||
/* How wide are our words? */
|
||||
static int bitwidth = 16;
|
||||
@ -672,11 +672,11 @@ pc_bytes_sigbits_encode_16(const PCBYTES pcb, uint16_t commonvalue, uint8_t comm
|
||||
* Size of encoded array comes out in ebytes_size.
|
||||
*/
|
||||
PCBYTES
|
||||
pc_bytes_sigbits_encode_32(const PCBYTES pcb, uint16_t commonvalue, uint8_t commonbits)
|
||||
pc_bytes_sigbits_encode_32(const PCBYTES pcb, uint32_t commonvalue, uint8_t commonbits)
|
||||
{
|
||||
int i;
|
||||
int shift;
|
||||
uint8_t *bytes = (uint8_t*)(pcb.bytes);
|
||||
uint32_t *bytes = (uint32_t*)(pcb.bytes);
|
||||
|
||||
/* How wide are our words? */
|
||||
static int bitwidth = 32;
|
||||
|
||||
@ -172,9 +172,6 @@ pc_schema_free(PCSCHEMA *pcs)
|
||||
{
|
||||
int i;
|
||||
|
||||
if ( pcs->namehash )
|
||||
hashtable_destroy(pcs->namehash, 0);
|
||||
|
||||
for ( i = 0; i < pcs->ndims; i++ )
|
||||
{
|
||||
if ( pcs->dims[i] )
|
||||
@ -184,6 +181,10 @@ pc_schema_free(PCSCHEMA *pcs)
|
||||
}
|
||||
}
|
||||
pcfree(pcs->dims);
|
||||
|
||||
if ( pcs->namehash )
|
||||
hashtable_destroy(pcs->namehash, 0);
|
||||
|
||||
pcfree(pcs);
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user