_Z12sf_init_filePKhmPP14sf_private_tagP8VIO_DATAP13SF_VIRTUAL_IOP7SF_INFO:
   96|  19.6k|{
   97|       |   // Initialize the virtual IO structure.
   98|  19.6k|   vio->get_filelen = vfget_filelen ;
   99|  19.6k|   vio->seek = vfseek ;
  100|  19.6k|   vio->read = vfread ;
  101|  19.6k|   vio->write = vfwrite ;
  102|  19.6k|   vio->tell = vftell ;
  103|       |
  104|       |   // Initialize the VIO user data.
  105|  19.6k|   vio_data->data = data ;
  106|  19.6k|   vio_data->length = size ;
  107|  19.6k|   vio_data->offset = 0 ;
  108|       |
  109|  19.6k|   memset(sndfile_info, 0, sizeof(SF_INFO)) ;
  110|       |
  111|       |   // Try and open the virtual file.
  112|  19.6k|   *sndfile = sf_open_virtual(vio, SFM_READ, sndfile_info, vio_data) ;
  113|       |
  114|  19.6k|   if (sndfile_info->channels == 0)
  ------------------
  |  Branch (114:8): [True: 16.4k, False: 3.21k]
  ------------------
  115|  16.4k|		 return -1 ;
  116|       |
  117|  3.21k|   if (sndfile_info->channels > 1024 * 1024)
  ------------------
  |  Branch (117:8): [True: 0, False: 3.21k]
  ------------------
  118|      0|		 return -1 ;
  119|       |
  120|  3.21k|   return 0;
  121|  3.21k|}
sndfile_fuzzer.cc:_ZL13vfget_filelenPv:
   14|  21.4k|{  VIO_DATA *vf = (VIO_DATA *)user_data ;
   15|  21.4k|   return vf->length ;
   16|  21.4k|}
sndfile_fuzzer.cc:_ZL6vfseekliPv:
   19|  1.81M|{
   20|  1.81M|  VIO_DATA *vf = (VIO_DATA *)user_data ;
   21|  1.81M|  sf_count_t new_offset ;
   22|       |
   23|  1.81M|  switch (whence)
   24|  1.81M|  {   case SEEK_SET :
  ------------------
  |  Branch (24:7): [True: 15.5k, False: 1.80M]
  ------------------
   25|  15.5k|        new_offset = offset ;
   26|  15.5k|        break ;
   27|       |
   28|  1.80M|    case SEEK_CUR :
  ------------------
  |  Branch (28:5): [True: 1.80M, False: 15.5k]
  ------------------
   29|  1.80M|        new_offset = vf->offset + offset ;
   30|  1.80M|        break ;
   31|       |
   32|      0|    case SEEK_END :
  ------------------
  |  Branch (32:5): [True: 0, False: 1.81M]
  ------------------
   33|      0|        new_offset = vf->length + offset ;
   34|      0|        break ;
   35|       |
   36|      0|    default :
  ------------------
  |  Branch (36:5): [True: 0, False: 1.81M]
  ------------------
   37|       |        // SEEK_DATA and SEEK_HOLE are not supported by this function.
   38|      0|        errno = EINVAL ;
   39|      0|        return -1 ;
   40|      0|        break ;
   41|  1.81M|  }
   42|       |
   43|       |  /* Ensure you can't seek outside the data */
   44|  1.81M|  if (new_offset > vf->length)
  ------------------
  |  Branch (44:7): [True: 3.90k, False: 1.81M]
  ------------------
   45|  3.90k|  {  /* Trying to seek past the end of the data */
   46|  3.90k|     printf("vf overseek: new_offset(%" PRId64 ") > vf->length(%" PRId64 ");"
   47|  3.90k|            "  whence(%d), vf->offset(%" PRId64 "), offset(%" PRId64 ")\n",
   48|  3.90k|            new_offset, vf->length, whence, vf->offset, offset) ;
   49|  3.90k|     new_offset = vf->length ;
   50|  3.90k|  }
   51|  1.81M|  else if (new_offset < 0)
  ------------------
  |  Branch (51:12): [True: 204k, False: 1.60M]
  ------------------
   52|   204k|  {  /* Trying to seek before the start of the data */
   53|   204k|     printf("vf underseek: new_offset(%" PRId64 ") < 0;  whence(%d), vf->offset"
   54|   204k|            "(%" PRId64 "), vf->length(%" PRId64 "), offset(%" PRId64 ")\n",
   55|   204k|            new_offset, whence, vf->offset, vf->length, offset) ;
   56|   204k|     new_offset = 0 ;
   57|   204k|  }
   58|  1.81M|  vf->offset = new_offset ;
   59|       |
   60|  1.81M|  return vf->offset ;
   61|  1.81M|}
sndfile_fuzzer.cc:_ZL6vfreadPvlS_:
   64|  12.3M|{  VIO_DATA *vf = (VIO_DATA *)user_data ;
   65|       |
   66|  12.3M|   if (vf->offset + count > vf->length)
  ------------------
  |  Branch (66:8): [True: 6.58M, False: 5.77M]
  ------------------
   67|  6.58M|     count = vf->length - vf->offset ;
   68|       |
   69|  12.3M|   memcpy(ptr, vf->data + vf->offset, count) ;
   70|  12.3M|   vf->offset += count ;
   71|       |
   72|  12.3M|   return count ;
   73|  12.3M|}
sndfile_fuzzer.cc:_ZL6vftellPv:
   86|  16.6M|{ VIO_DATA *vf = (VIO_DATA *)user_data ;
   87|       |
   88|  16.6M|  return vf->offset ;
   89|  16.6M|}

LLVMFuzzerTestOneInput:
   11|  19.6k|{  VIO_DATA vio_data ;
   12|  19.6k|   SF_VIRTUAL_IO vio ;
   13|  19.6k|   SF_INFO sndfile_info ;
   14|  19.6k|   SNDFILE *sndfile = NULL ;
   15|  19.6k|   float* read_buffer = NULL ;
   16|       |
   17|  19.6k|   int err = sf_init_file(data, size, &sndfile, &vio_data, &vio, &sndfile_info) ;
   18|  19.6k|   if (err)
  ------------------
  |  Branch (18:8): [True: 16.4k, False: 3.21k]
  ------------------
   19|  16.4k|     goto EXIT_LABEL ;
   20|       |
   21|       |   // Just the right number of channels. Create some buffer space for reading.
   22|  3.21k|   read_buffer = (float*)malloc(sizeof(float) * sndfile_info.channels);
   23|  3.21k|   if (read_buffer == NULL)
  ------------------
  |  Branch (23:8): [True: 0, False: 3.21k]
  ------------------
   24|      0|     abort() ;
   25|       |
   26|   171M|   while (sf_readf_float(sndfile, read_buffer, 1))
  ------------------
  |  Branch (26:11): [True: 171M, False: 3.21k]
  ------------------
   27|   171M|   {
   28|       |     // Do nothing with the data.
   29|   171M|   }
   30|       |
   31|  19.6k|EXIT_LABEL:
   32|       |
   33|  19.6k|   if (sndfile != NULL)
  ------------------
  |  Branch (33:8): [True: 3.21k, False: 16.4k]
  ------------------
   34|  3.21k|     sf_close(sndfile) ;
   35|       |
   36|  19.6k|   free(read_buffer) ;
   37|       |
   38|  19.6k|   return 0 ;
   39|  3.21k|}

BitBufferInit:
   35|  2.60k|{
   36|  2.60k|	bits->cur		= buffer ;
   37|  2.60k|	bits->end		= bits->cur + byteSize ;
   38|  2.60k|	bits->bitIndex	= 0 ;
   39|  2.60k|	bits->byteSize	= byteSize ;
   40|  2.60k|}
BitBufferRead:
   45|   659k|{
   46|   659k|	uint32_t		returnBits ;
   47|       |
   48|       |	//Assert (numBits <= 16) ;
   49|       |
   50|   659k|	returnBits = ((uint32_t) bits->cur [0] << 16) | ((uint32_t) bits->cur [1] << 8) | ((uint32_t) bits->cur [2]) ;
   51|   659k|	returnBits = returnBits << bits->bitIndex ;
   52|   659k|	returnBits &= 0x00FFFFFF ;
   53|       |
   54|   659k|	bits->bitIndex += numBits ;
   55|       |
   56|   659k|	returnBits = returnBits >> (24 - numBits) ;
   57|       |
   58|   659k|	bits->cur		+= (bits->bitIndex >> 3) ;
   59|   659k|	bits->bitIndex	&= 7 ;
   60|       |
   61|       |	//Assert (bits->cur <= bits->end) ;
   62|       |
   63|   659k|	return returnBits ;
   64|   659k|}
BitBufferReadSmall:
   70|  16.6k|{
   71|  16.6k|	uint16_t		returnBits ;
   72|       |
   73|       |	//Assert (numBits <= 8) ;
   74|       |
   75|  16.6k|	returnBits = (bits->cur [0] << 8) | bits->cur [1] ;
   76|  16.6k|	returnBits = returnBits << bits->bitIndex ;
   77|       |
   78|  16.6k|	bits->bitIndex += numBits ;
   79|       |
   80|  16.6k|	returnBits = returnBits >> (16 - numBits) ;
   81|       |
   82|  16.6k|	bits->cur		+= (bits->bitIndex >> 3) ;
   83|  16.6k|	bits->bitIndex	&= 7 ;
   84|       |
   85|       |	//Assert (bits->cur <= bits->end) ;
   86|       |
   87|  16.6k|	return (uint8_t) returnBits ;
   88|  16.6k|}
BitBufferReadOne:
   94|    606|{
   95|    606|	uint8_t		returnBits ;
   96|       |
   97|    606|	returnBits = (bits->cur [0] >> (7 - bits->bitIndex)) & 1 ;
   98|       |
   99|    606|	bits->bitIndex++ ;
  100|       |
  101|    606|	bits->cur		+= (bits->bitIndex >> 3) ;
  102|    606|	bits->bitIndex	&= 7 ;
  103|       |
  104|       |	//Assert (bits->cur <= bits->end) ;
  105|       |
  106|    606|	return returnBits ;
  107|    606|}
BitBufferByteAlign:
  151|  1.21k|{
  152|       |	// align bit buffer to next byte boundary, writing zeros if requested
  153|  1.21k|	if (bits->bitIndex == 0)
  ------------------
  |  Branch (153:6): [True: 233, False: 985]
  ------------------
  154|    233|		return ;
  155|       |
  156|    985|	if (addZeros)
  ------------------
  |  Branch (156:6): [True: 0, False: 985]
  ------------------
  157|      0|		BitBufferWrite (bits, 0, 8 - bits->bitIndex) ;
  158|    985|	else
  159|    985|		BitBufferAdvance (bits, 8 - bits->bitIndex) ;
  160|    985|}
BitBufferAdvance:
  165|  8.24k|{
  166|  8.24k|	if (numBits)
  ------------------
  |  Branch (166:6): [True: 6.37k, False: 1.86k]
  ------------------
  167|  6.37k|	{
  168|  6.37k|		bits->bitIndex += numBits ;
  169|  6.37k|		bits->cur += (bits->bitIndex >> 3) ;
  170|  6.37k|		bits->bitIndex &= 7 ;
  171|  6.37k|	}
  172|  8.24k|}

set_ag_params:
   71|  5.24k|{
   72|  5.24k|	params->mb = params->mb0 = m ;
   73|  5.24k|	params->pb = p ;
   74|  5.24k|	params->kb = k ;
   75|  5.24k|	params->wb = (1u << params->kb) - 1 ;
   76|  5.24k|	params->qb = QB-params->pb ;
  ------------------
  |  |   37|  5.24k|#define QB			(1 << QBSHIFT)
  |  |  ------------------
  |  |  |  |   36|  5.24k|#define QBSHIFT		9
  |  |  ------------------
  ------------------
   77|  5.24k|	params->fw = f ;
   78|  5.24k|	params->sw = s ;
   79|  5.24k|	params->maxrun = maxrun ;
   80|  5.24k|}
dyn_decomp:
  271|  5.24k|{
  272|  5.24k|	uint8_t 		*in ;
  273|  5.24k|	int32_t			*outPtr = pc ;
  274|  5.24k|	uint32_t 	bitPos, startPos, maxPos ;
  275|  5.24k|	uint32_t		j, m, k, n, c, mz ;
  276|  5.24k|	int32_t			del, zmode ;
  277|  5.24k|	uint32_t 	mb ;
  278|  5.24k|	uint32_t	pb_local = params->pb ;
  279|  5.24k|	uint32_t	kb_local = params->kb ;
  280|  5.24k|	uint32_t	wb_local = params->wb ;
  281|  5.24k|	int32_t				status ;
  282|       |
  283|  5.24k|	RequireAction ((bitstream != NULL) && (pc != NULL) && (outNumBits != NULL), return kALAC_ParamError ;) ;
  ------------------
  |  |   39|  20.9k|#define RequireAction(condition, action)		if (! (condition)) { action }
  |  |  ------------------
  |  |  |  Branch (39:50): [True: 5.24k, False: 0]
  |  |  |  Branch (39:50): [True: 5.24k, False: 0]
  |  |  |  Branch (39:50): [True: 5.24k, False: 0]
  |  |  ------------------
  ------------------
  284|  5.24k|	*outNumBits = 0 ;
  285|       |
  286|  5.24k|	in = bitstream->cur ;
  287|  5.24k|	startPos = bitstream->bitIndex ;
  288|  5.24k|	maxPos = bitstream->byteSize * 8 ;
  289|  5.24k|	bitPos = startPos ;
  290|       |
  291|  5.24k|	mb = params->mb0 ;
  292|  5.24k|	zmode = 0 ;
  293|       |
  294|  5.24k|	c = 0 ;
  295|  5.24k|	status = ALAC_noErr ;
  296|       |
  297|   105k|	while (c < (uint32_t) numSamples)
  ------------------
  |  Branch (297:9): [True: 100k, False: 5.14k]
  ------------------
  298|   100k|	{
  299|       |		// bail if we've run off the end of the buffer
  300|   100k|		RequireAction (bitPos < maxPos, status = kALAC_ParamError ; goto Exit ;) ;
  ------------------
  |  |   39|   100k|#define RequireAction(condition, action)		if (! (condition)) { action }
  |  |  ------------------
  |  |  |  Branch (39:47): [True: 65, False: 100k]
  |  |  ------------------
  ------------------
  301|       |
  302|   100k|		m = (mb) >> QBSHIFT ;
  ------------------
  |  |   36|   100k|#define QBSHIFT		9
  ------------------
  303|   100k|		k = lg3a (m) ;
  304|       |
  305|   100k|		k = arithmin (k, kb_local) ;
  ------------------
  |  |  102|   100k|#define arithmin(a, b) ((a) < (b) ? (a) : (b))
  |  |  ------------------
  |  |  |  Branch (102:25): [True: 73.9k, False: 26.3k]
  |  |  ------------------
  ------------------
  306|   100k|		m = (1 << k) - 1 ;
  307|       |
  308|   100k|		n = dyn_get_32bit (in, &bitPos, m, k, maxSize) ;
  309|       |
  310|       |		// least significant bit is sign bit
  311|   100k|		{
  312|   100k|			uint32_t	ndecode = n + zmode ;
  313|   100k|			int32_t		multiplier = - (int) (ndecode & 1) ;
  314|       |
  315|   100k|			multiplier |= 1 ;
  316|   100k|			del = ((ndecode+1) >> 1) * (multiplier) ;
  317|   100k|		}
  318|       |
  319|   100k|		*outPtr++ = del ;
  320|       |
  321|   100k|		c++ ;
  322|       |
  323|   100k|		mb = pb_local * (n + zmode) + mb - ((pb_local * mb) >> QBSHIFT) ;
  ------------------
  |  |   36|   100k|#define QBSHIFT		9
  ------------------
  324|       |
  325|       |		// update mean tracking
  326|   100k|		if (n > N_MAX_MEAN_CLAMP)
  ------------------
  |  |   41|   100k|#define N_MAX_MEAN_CLAMP		0xffff
  ------------------
  |  Branch (326:7): [True: 2.39k, False: 97.9k]
  ------------------
  327|  2.39k|			mb = N_MEAN_CLAMP_VAL ;
  ------------------
  |  |   42|  2.39k|#define N_MEAN_CLAMP_VAL		0xffff
  ------------------
  328|       |
  329|   100k|		zmode = 0 ;
  330|       |
  331|   100k|		if (((mb << MMULSHIFT) < QB) && (c < (uint32_t) numSamples))
  ------------------
  |  |   43|   100k|#define MMULSHIFT	2
  ------------------
              		if (((mb << MMULSHIFT) < QB) && (c < (uint32_t) numSamples))
  ------------------
  |  |   37|   100k|#define QB			(1 << QBSHIFT)
  |  |  ------------------
  |  |  |  |   36|   100k|#define QBSHIFT		9
  |  |  ------------------
  ------------------
  |  Branch (331:7): [True: 12.9k, False: 87.3k]
  |  Branch (331:35): [True: 12.3k, False: 627]
  ------------------
  332|  12.3k|		{
  333|  12.3k|			zmode = 1 ;
  334|  12.3k|			k = lead (mb) - BITOFF + ((mb + MOFF) >> MDENSHIFT) ;
  ------------------
  |  |   47|  12.3k|#define BITOFF 24
  ------------------
              			k = lead (mb) - BITOFF + ((mb + MOFF) >> MDENSHIFT) ;
  ------------------
  |  |   45|  12.3k|#define MOFF		((1 << (MDENSHIFT - 2)))
  |  |  ------------------
  |  |  |  |   44|  12.3k|#define MDENSHIFT	(QBSHIFT - MMULSHIFT - 1)
  |  |  |  |  ------------------
  |  |  |  |  |  |   36|  12.3k|#define QBSHIFT		9
  |  |  |  |  ------------------
  |  |  |  |               #define MDENSHIFT	(QBSHIFT - MMULSHIFT - 1)
  |  |  |  |  ------------------
  |  |  |  |  |  |   43|  12.3k|#define MMULSHIFT	2
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
              			k = lead (mb) - BITOFF + ((mb + MOFF) >> MDENSHIFT) ;
  ------------------
  |  |   44|  12.3k|#define MDENSHIFT	(QBSHIFT - MMULSHIFT - 1)
  |  |  ------------------
  |  |  |  |   36|  12.3k|#define QBSHIFT		9
  |  |  ------------------
  |  |               #define MDENSHIFT	(QBSHIFT - MMULSHIFT - 1)
  |  |  ------------------
  |  |  |  |   43|  12.3k|#define MMULSHIFT	2
  |  |  ------------------
  ------------------
  335|  12.3k|			mz = ((1 << k) - 1) & wb_local ;
  336|       |
  337|  12.3k|			n = dyn_get (in, &bitPos, mz, k) ;
  338|       |
  339|  12.3k|			RequireAction (c+n <= (uint32_t) numSamples, status = kALAC_ParamError ; goto Exit ;) ;
  ------------------
  |  |   39|  12.3k|#define RequireAction(condition, action)		if (! (condition)) { action }
  |  |  ------------------
  |  |  |  Branch (39:47): [True: 29, False: 12.3k]
  |  |  ------------------
  ------------------
  340|       |
  341|  29.5k|			for (j = 0 ; j < n ; j++)
  ------------------
  |  Branch (341:17): [True: 17.2k, False: 12.3k]
  ------------------
  342|  17.2k|			{
  343|  17.2k|				*outPtr++ = 0 ;
  344|  17.2k|				++c ;
  345|  17.2k|			}
  346|       |
  347|  12.3k|			if (n >= 65535)
  ------------------
  |  Branch (347:8): [True: 0, False: 12.3k]
  ------------------
  348|      0|				zmode = 0 ;
  349|       |
  350|  12.3k|			mb = 0 ;
  351|  12.3k|		}
  352|   100k|	}
  353|       |
  354|  5.24k|Exit:
  355|  5.24k|	*outNumBits = (bitPos - startPos) ;
  356|  5.24k|	BitBufferAdvance (bitstream, *outNumBits) ;
  357|  5.24k|	RequireAction (bitstream->cur <= bitstream->end, status = kALAC_ParamError ;) ;
  ------------------
  |  |   39|  5.24k|#define RequireAction(condition, action)		if (! (condition)) { action }
  |  |  ------------------
  |  |  |  Branch (39:47): [True: 213, False: 5.02k]
  |  |  ------------------
  ------------------
  358|       |
  359|  5.24k|	return status ;
  360|  5.24k|}
ag_dec.c:lg3a:
  105|   100k|{
  106|   100k|	int32_t result ;
  107|       |
  108|   100k|	x += 3 ;
  109|   100k|	result = lead (x) ;
  110|       |
  111|   100k|	return 31 - result ;
  112|   100k|}
ag_dec.c:dyn_get_32bit:
  219|   100k|{
  220|   100k|	uint32_t	tempbits = *bitPos ;
  221|   100k|	uint32_t		v ;
  222|   100k|	uint32_t		streamlong ;
  223|   100k|	uint32_t		result ;
  224|       |
  225|   100k|	streamlong = read32bit (in + (tempbits >> 3)) ;
  226|   100k|	streamlong <<= (tempbits & 7) ;
  227|       |
  228|       |	/* find the number of bits in the prefix */
  229|   100k|	{
  230|   100k|		uint32_t notI = ~streamlong ;
  231|   100k|		result = lead (notI) ;
  232|   100k|	}
  233|       |
  234|   100k|	if (result >= MAX_PREFIX_32)
  ------------------
  |  |   52|   100k|#define MAX_PREFIX_32			9
  ------------------
  |  Branch (234:6): [True: 2.53k, False: 97.8k]
  ------------------
  235|  2.53k|	{
  236|  2.53k|		result = getstreambits (in, tempbits+MAX_PREFIX_32, maxbits) ;
  ------------------
  |  |   52|  2.53k|#define MAX_PREFIX_32			9
  ------------------
  237|  2.53k|		tempbits += MAX_PREFIX_32 + maxbits ;
  ------------------
  |  |   52|  2.53k|#define MAX_PREFIX_32			9
  ------------------
  238|  2.53k|	}
  239|  97.8k|	else
  240|  97.8k|	{
  241|       |		/* all of the bits must fit within the long we have loaded*/
  242|       |		//Assert (k<=14) ;
  243|       |		//Assert (result<MAX_PREFIX_32) ;
  244|       |		//Assert (result+1+k <= 32) ;
  245|       |
  246|  97.8k|		tempbits += result ;
  247|  97.8k|		tempbits += 1 ;
  248|       |
  249|  97.8k|		if (k != 1)
  ------------------
  |  Branch (249:7): [True: 19.0k, False: 78.7k]
  ------------------
  250|  19.0k|		{
  251|  19.0k|			streamlong <<= result + 1 ;
  252|  19.0k|			v = get_next_fromlong (streamlong, k) ;
  ------------------
  |  |  129|  19.0k|#define get_next_fromlong(inlong, suff)		((inlong) >> (32 - (suff)))
  ------------------
  253|  19.0k|			tempbits += k ;
  254|  19.0k|			tempbits -= 1 ;
  255|  19.0k|			result = result*m ;
  256|       |
  257|  19.0k|			if (v >= 2)
  ------------------
  |  Branch (257:8): [True: 9.58k, False: 9.43k]
  ------------------
  258|  9.58k|			{
  259|  9.58k|				result += (v-1) ;
  260|  9.58k|				tempbits += 1 ;
  261|  9.58k|			}
  262|  19.0k|		}
  263|  97.8k|	}
  264|       |
  265|   100k|	*bitPos = tempbits ;
  266|       |
  267|   100k|	return result ;
  268|   100k|}
ag_dec.c:read32bit:
  115|   115k|{
  116|       |	// embedded CPUs typically can't read unaligned 32-bit words so just read the bytes
  117|   115k|	uint32_t		value ;
  118|       |
  119|   115k|	value = ((uint32_t) buffer [0] << 24) | ((uint32_t) buffer [1] << 16) |
  120|   115k|				((uint32_t) buffer [2] << 8) | (uint32_t) buffer [3] ;
  121|   115k|	return value ;
  122|       |
  123|   115k|}
ag_dec.c:getstreambits:
  134|  2.53k|{
  135|  2.53k|	uint32_t	load1, load2 ;
  136|  2.53k|	uint32_t	byteoffset = bitoffset / 8 ;
  137|  2.53k|	uint32_t	result ;
  138|       |
  139|       |	//Assert (numbits <= 32) ;
  140|       |
  141|  2.53k|	load1 = read32bit (in + byteoffset) ;
  142|       |
  143|  2.53k|	if ((numbits + (bitoffset & 0x7)) > 32)
  ------------------
  |  Branch (143:6): [True: 562, False: 1.97k]
  ------------------
  144|    562|	{
  145|    562|		int32_t load2shift ;
  146|       |
  147|    562|		result = load1 << (bitoffset & 0x7) ;
  148|    562|		load2 = (uint32_t) in [byteoffset + 4] ;
  149|    562|		load2shift = (8 - (numbits + (bitoffset & 0x7) - 32)) ;
  150|    562|		load2 >>= load2shift ;
  151|    562|		result >>= (32 - numbits) ;
  152|    562|		result |= load2 ;
  153|    562|	}
  154|  1.97k|	else
  155|  1.97k|	{
  156|  1.97k|		result = load1 >> (32 - numbits - (bitoffset & 7)) ;
  157|  1.97k|	}
  158|       |
  159|       |	// a shift of >= "the number of bits in the type of the value being shifted" results in undefined
  160|       |	// behavior so don't try to shift by 32
  161|  2.53k|	if (numbits != (sizeof (result) * 8))
  ------------------
  |  Branch (161:6): [True: 2.08k, False: 450]
  ------------------
  162|  2.08k|		result &= ~ (0xfffffffful << numbits) ;
  163|       |
  164|  2.53k|	return result ;
  165|  2.53k|}
ag_dec.c:lead:
   89|   225k|{
   90|   225k|	long j ;
   91|   225k|	unsigned long c = (1ul << 31) ;
   92|       |
   93|  3.54M|	for (j = 0 ; j < 32 ; j++)
  ------------------
  |  Branch (93:15): [True: 3.54M, False: 3.51k]
  ------------------
   94|  3.54M|	{
   95|  3.54M|		if ((c & m) != 0)
  ------------------
  |  Branch (95:7): [True: 221k, False: 3.32M]
  ------------------
   96|   221k|			break ;
   97|  3.32M|		c >>= 1 ;
   98|  3.32M|	}
   99|   225k|	return j ;
  100|   225k|}
ag_dec.c:dyn_get:
  169|  12.3k|{
  170|  12.3k|	uint32_t	tempbits = *bitPos ;
  171|  12.3k|	uint32_t		result ;
  172|  12.3k|	uint32_t		pre = 0, v ;
  173|  12.3k|	uint32_t		streamlong ;
  174|       |
  175|  12.3k|	streamlong = read32bit (in + (tempbits >> 3)) ;
  176|  12.3k|	streamlong <<= (tempbits & 7) ;
  177|       |
  178|       |	/* find the number of bits in the prefix */
  179|  12.3k|	{
  180|  12.3k|		uint32_t	notI = ~streamlong ;
  181|  12.3k|		pre = lead (notI) ;
  182|  12.3k|	}
  183|       |
  184|  12.3k|	if (pre >= MAX_PREFIX_16)
  ------------------
  |  |   50|  12.3k|#define MAX_PREFIX_16			9
  ------------------
  |  Branch (184:6): [True: 43, False: 12.2k]
  ------------------
  185|     43|	{
  186|     43|		pre = MAX_PREFIX_16 ;
  ------------------
  |  |   50|     43|#define MAX_PREFIX_16			9
  ------------------
  187|     43|		tempbits += pre ;
  188|     43|		streamlong <<= pre ;
  189|     43|		result = get_next_fromlong (streamlong, MAX_DATATYPE_BITS_16) ;
  ------------------
  |  |  129|     43|#define get_next_fromlong(inlong, suff)		((inlong) >> (32 - (suff)))
  ------------------
  190|     43|		tempbits += MAX_DATATYPE_BITS_16 ;
  ------------------
  |  |   55|     43|#define MAX_DATATYPE_BITS_16	16
  ------------------
  191|       |
  192|     43|	}
  193|  12.2k|	else
  194|  12.2k|	{
  195|       |		// all of the bits must fit within the long we have loaded
  196|       |		//Assert (pre+1+k <= 32) ;
  197|       |
  198|  12.2k|		tempbits += pre ;
  199|  12.2k|		tempbits += 1 ;
  200|  12.2k|		streamlong <<= pre + 1 ;
  201|  12.2k|		v = get_next_fromlong (streamlong, k) ;
  ------------------
  |  |  129|  12.2k|#define get_next_fromlong(inlong, suff)		((inlong) >> (32 - (suff)))
  ------------------
  202|  12.2k|		tempbits += k ;
  203|       |
  204|  12.2k|		result = pre*m + v-1 ;
  205|       |
  206|  12.2k|		if (v < 2)
  ------------------
  |  Branch (206:7): [True: 10.9k, False: 1.32k]
  ------------------
  207|  10.9k|		{
  208|  10.9k|			result -= (v-1) ;
  209|  10.9k|			tempbits -= 1 ;
  210|  10.9k|		}
  211|  12.2k|	}
  212|       |
  213|  12.3k|	*bitPos = tempbits ;
  214|  12.3k|	return result ;
  215|  12.3k|}

alac_decoder_init:
   61|    950|{
   62|    950|	int32_t		status = ALAC_noErr ;
   63|    950|	ALACSpecificConfig theConfig ;
   64|    950|	uint8_t * theActualCookie = (uint8_t *) inMagicCookie ;
   65|    950|	uint32_t theCookieBytesRemaining = inMagicCookieSize ;
   66|       |
   67|       |	// For historical reasons the decoder needs to be resilient to magic cookies vended by older encoders.
   68|       |	// As specified in the ALACMagicCookieDescription.txt document, there may be additional data encapsulating
   69|       |	// the ALACSpecificConfig. This would consist of format ('frma') and 'alac' atoms which precede the
   70|       |	// ALACSpecificConfig.
   71|       |	// See ALACMagicCookieDescription.txt for additional documentation concerning the 'magic cookie'
   72|       |
   73|       |	// skip format ('frma') atom if present
   74|    950|	if (theActualCookie [4] == 'f' && theActualCookie [5] == 'r' && theActualCookie [6] == 'm' && theActualCookie [7] == 'a')
  ------------------
  |  Branch (74:6): [True: 5, False: 945]
  |  Branch (74:36): [True: 4, False: 1]
  |  Branch (74:66): [True: 3, False: 1]
  |  Branch (74:96): [True: 1, False: 2]
  ------------------
   75|      1|	{
   76|      1|		theActualCookie += 12 ;
   77|      1|		theCookieBytesRemaining -= 12 ;
   78|      1|	}
   79|       |
   80|       |	// skip 'alac' atom header if present
   81|    950|	if (theActualCookie [4] == 'a' && theActualCookie [5] == 'l' && theActualCookie [6] == 'a' && theActualCookie [7] == 'c')
  ------------------
  |  Branch (81:6): [True: 6, False: 944]
  |  Branch (81:36): [True: 5, False: 1]
  |  Branch (81:66): [True: 2, False: 3]
  |  Branch (81:96): [True: 1, False: 1]
  ------------------
   82|      1|	{
   83|      1|		theActualCookie += 12 ;
   84|      1|		theCookieBytesRemaining -= 12 ;
   85|      1|	}
   86|       |
   87|       |	// read the ALACSpecificConfig
   88|    950|	if (theCookieBytesRemaining >= sizeof (ALACSpecificConfig))
  ------------------
  |  Branch (88:6): [True: 814, False: 136]
  ------------------
   89|    814|	{
   90|    814|		theConfig.frameLength = psf_get_be32 (theActualCookie, offsetof (ALACSpecificConfig, frameLength)) ;
   91|       |
   92|    814|		if (theConfig.frameLength > ALAC_FRAME_LENGTH)
  ------------------
  |  |   33|    814|#define		ALAC_FRAME_LENGTH	4096
  ------------------
  |  Branch (92:7): [True: 14, False: 800]
  ------------------
   93|     14|			return fALAC_FrameLengthError ;
   94|       |
   95|    800|		theConfig.compatibleVersion = theActualCookie [offsetof (ALACSpecificConfig, compatibleVersion)] ;
   96|    800|		theConfig.bitDepth = theActualCookie [offsetof (ALACSpecificConfig, bitDepth)] ;
   97|    800|		theConfig.pb = theActualCookie [offsetof (ALACSpecificConfig, pb)] ;
   98|    800|		theConfig.mb = theActualCookie [offsetof (ALACSpecificConfig, mb)] ;
   99|    800|		theConfig.kb = theActualCookie [offsetof (ALACSpecificConfig, kb)] ;
  100|    800|		theConfig.numChannels = theActualCookie [offsetof (ALACSpecificConfig, numChannels)] ;
  101|    800|		theConfig.maxRun = psf_get_be16 (theActualCookie, offsetof (ALACSpecificConfig, maxRun)) ;
  102|    800|		theConfig.maxFrameBytes = psf_get_be32 (theActualCookie, offsetof (ALACSpecificConfig, maxFrameBytes)) ;
  103|    800|		theConfig.avgBitRate = psf_get_be32 (theActualCookie, offsetof (ALACSpecificConfig, avgBitRate)) ;
  104|    800|		theConfig.sampleRate = psf_get_be32 (theActualCookie, offsetof (ALACSpecificConfig, sampleRate)) ;
  105|       |
  106|    800|		p->mConfig = theConfig ;
  107|    800|		p->mNumChannels = theConfig.numChannels ;
  108|       |
  109|    800|		RequireAction (p->mConfig.compatibleVersion <= kALACVersion, return kALAC_IncompatibleVersion ;) ;
  ------------------
  |  |   39|    800|#define RequireAction(condition, action)		if (! (condition)) { action }
  |  |  ------------------
  |  |  |  Branch (39:47): [True: 8, False: 792]
  |  |  ------------------
  ------------------
  110|    792|		RequireAction ((p->mConfig.bitDepth >= 8 && p->mConfig.bitDepth <= 32), return kALAC_BadBitWidth ;) ;
  ------------------
  |  |   39|  1.58k|#define RequireAction(condition, action)		if (! (condition)) { action }
  |  |  ------------------
  |  |  |  Branch (39:50): [True: 790, False: 2]
  |  |  |  Branch (39:50): [True: 787, False: 3]
  |  |  ------------------
  ------------------
  111|       |		// dyn_get_32bit () needs prefix + 1 + kb <= 32 with a prefix below MAX_PREFIX_32 (9).
  112|    787|		RequireAction ((p->mConfig.kb >= 1 && p->mConfig.kb <= 23), return kALAC_ParamError ;) ;
  ------------------
  |  |   39|  1.57k|#define RequireAction(condition, action)		if (! (condition)) { action }
  |  |  ------------------
  |  |  |  Branch (39:50): [True: 783, False: 4]
  |  |  |  Branch (39:50): [True: 776, False: 7]
  |  |  ------------------
  ------------------
  113|    776|		RequireAction ((p->mMixBufferU != NULL) && (p->mMixBufferV != NULL) && (p->u.mPredictor != NULL),
  ------------------
  |  |   39|  3.10k|#define RequireAction(condition, action)		if (! (condition)) { action }
  |  |  ------------------
  |  |  |  Branch (39:50): [True: 776, False: 0]
  |  |  |  Branch (39:50): [True: 776, False: 0]
  |  |  |  Branch (39:50): [True: 776, False: 0]
  |  |  ------------------
  ------------------
  114|    776|						status = kALAC_MemFullError ; goto Exit ;) ;
  115|    776|	}
  116|    136|	else
  117|    136|	{
  118|    136|		status = kALAC_BadSpecificConfigSize ;
  119|    136|	}
  120|       |
  121|       |	// skip to Channel Layout Info
  122|       |	// theActualCookie += sizeof (ALACSpecificConfig) ;
  123|       |
  124|       |	// Currently, the Channel Layout Info portion of the magic cookie (as defined in the
  125|       |	// ALACMagicCookieDescription.txt document) is unused by the decoder.
  126|       |
  127|    912|Exit:
  128|    912|	return status ;
  129|    950|}
alac_decode:
  138|  2.60k|{
  139|  2.60k|	BitBuffer		shiftBits ;
  140|  2.60k|	uint32_t		bits1, bits2 ;
  141|  2.60k|	uint8_t			tag ;
  142|  2.60k|	uint8_t			elementInstanceTag ;
  143|  2.60k|	AGParamRec		agParams ;
  144|  2.60k|	uint32_t		channelIndex ;
  145|  2.60k|	int16_t			coefsU [32] ;		// max possible size is 32 although NUMCOEPAIRS is the current limit
  146|  2.60k|	int16_t			coefsV [32] ;
  147|  2.60k|	uint8_t			numU, numV ;
  148|  2.60k|	uint8_t			mixBits ;
  149|  2.60k|	int8_t			mixRes ;
  150|  2.60k|	uint16_t		unusedHeader ;
  151|  2.60k|	uint8_t			escapeFlag ;
  152|  2.60k|	uint32_t		chanBits ;
  153|  2.60k|	uint8_t			bytesShifted ;
  154|  2.60k|	uint32_t		shift ;
  155|  2.60k|	uint8_t			modeU, modeV ;
  156|  2.60k|	uint32_t		denShiftU, denShiftV ;
  157|  2.60k|	uint16_t		pbFactorU, pbFactorV ;
  158|  2.60k|	uint16_t		pb ;
  159|  2.60k|	int32_t *		out32 ;
  160|  2.60k|	uint8_t			headerByte ;
  161|  2.60k|	uint8_t			partialFrame ;
  162|  2.60k|	uint32_t		extraBits ;
  163|  2.60k|	int32_t			val ;
  164|  2.60k|	uint32_t		i, j ;
  165|  2.60k|	int32_t			status ;
  166|  2.60k|	uint32_t		numChannels = p->mNumChannels ;
  167|       |
  168|  2.60k|	RequireAction ((bits != NULL) && (sampleBuffer != NULL) && (outNumSamples != NULL), return kALAC_ParamError ;) ;
  ------------------
  |  |   39|  10.4k|#define RequireAction(condition, action)		if (! (condition)) { action }
  |  |  ------------------
  |  |  |  Branch (39:50): [True: 2.60k, False: 0]
  |  |  |  Branch (39:50): [True: 2.60k, False: 0]
  |  |  |  Branch (39:50): [True: 2.60k, False: 0]
  |  |  ------------------
  ------------------
  169|  2.60k|	RequireAction (p->mNumChannels > 0, return kALAC_ZeroChannelCount ;) ;
  ------------------
  |  |   39|  2.60k|#define RequireAction(condition, action)		if (! (condition)) { action }
  |  |  ------------------
  |  |  |  Branch (39:47): [True: 1, False: 2.60k]
  |  |  ------------------
  ------------------
  170|       |
  171|  2.60k|	p->mActiveElements = 0 ;
  172|  2.60k|	channelIndex	= 0 ;
  173|       |
  174|  2.60k|	status = ALAC_noErr ;
  175|  2.60k|	*outNumSamples = numSamples ;
  176|       |
  177|  8.88k|	while (status == ALAC_noErr)
  ------------------
  |  Branch (177:9): [True: 8.75k, False: 130]
  ------------------
  178|  8.75k|	{
  179|       |		// bail if we ran off the end of the buffer
  180|  8.75k|		RequireAction (bits->cur < bits->end, status = kALAC_ParamError ; goto Exit ;) ;
  ------------------
  |  |   39|  8.75k|#define RequireAction(condition, action)		if (! (condition)) { action }
  |  |  ------------------
  |  |  |  Branch (39:47): [True: 93, False: 8.66k]
  |  |  ------------------
  ------------------
  181|       |
  182|       |		// copy global decode params for this element
  183|  8.66k|		pb = p->mConfig.pb ;
  184|       |
  185|       |		// read element tag
  186|  8.66k|		tag = BitBufferReadSmall (bits, 3) ;
  187|  8.66k|		switch (tag)
  ------------------
  |  Branch (187:11): [True: 8.66k, False: 0]
  ------------------
  188|  8.66k|		{
  189|  4.77k|			case ID_SCE:
  ------------------
  |  Branch (189:4): [True: 4.77k, False: 3.88k]
  ------------------
  190|  4.93k|			case ID_LFE:
  ------------------
  |  Branch (190:4): [True: 160, False: 8.50k]
  ------------------
  191|  4.93k|			{
  192|       |				// mono/LFE channel
  193|  4.93k|				elementInstanceTag = BitBufferReadSmall (bits, 4) ;
  194|  4.93k|				p->mActiveElements |= (1u << elementInstanceTag) ;
  195|       |
  196|       |				// read the 12 unused header bits
  197|  4.93k|				unusedHeader = (uint16_t) BitBufferRead (bits, 12) ;
  198|  4.93k|				RequireAction (unusedHeader == 0, status = kALAC_ParamError ; goto Exit ;) ;
  ------------------
  |  |   39|  4.93k|#define RequireAction(condition, action)		if (! (condition)) { action }
  |  |  ------------------
  |  |  |  Branch (39:47): [True: 243, False: 4.69k]
  |  |  ------------------
  ------------------
  199|       |
  200|       |				// read the 1-bit "partial frame" flag, 2-bit "shift-off" flag & 1-bit "escape" flag
  201|  4.69k|				headerByte = (uint8_t) BitBufferRead (bits, 4) ;
  202|       |
  203|  4.69k|				partialFrame = headerByte >> 3 ;
  204|       |
  205|  4.69k|				bytesShifted = (headerByte >> 1) & 0x3u ;
  206|  4.69k|				RequireAction (bytesShifted != 3, status = kALAC_ParamError ; goto Exit ;) ;
  ------------------
  |  |   39|  4.69k|#define RequireAction(condition, action)		if (! (condition)) { action }
  |  |  ------------------
  |  |  |  Branch (39:47): [True: 5, False: 4.68k]
  |  |  ------------------
  ------------------
  207|       |
  208|  4.68k|				shift = bytesShifted * 8 ;
  209|       |
  210|  4.68k|				escapeFlag = headerByte & 0x1 ;
  211|       |
  212|  4.68k|				chanBits = p->mConfig.bitDepth - (bytesShifted * 8) ;
  213|  4.68k|				RequireAction (chanBits >= 1 && chanBits <= 32, status = kALAC_ParamError ; goto Exit ;) ;
  ------------------
  |  |   39|  9.36k|#define RequireAction(condition, action)		if (! (condition)) { action }
  |  |  ------------------
  |  |  |  Branch (39:50): [True: 4.68k, False: 3]
  |  |  |  Branch (39:50): [True: 4.67k, False: 8]
  |  |  ------------------
  ------------------
  214|       |
  215|       |				// check for partial frame to override requested numSamples
  216|  4.67k|				if (partialFrame != 0)
  ------------------
  |  Branch (216:9): [True: 242, False: 4.43k]
  ------------------
  217|    242|				{
  218|    242|					numSamples = BitBufferRead (bits, 16) << 16 ;
  219|    242|					numSamples |= BitBufferRead (bits, 16) ;
  220|       |
  221|    242|					RequireAction (numSamples < kALACDefaultFramesPerPacket, return kALAC_NumSamplesTooBig ;) ;
  ------------------
  |  |   39|    242|#define RequireAction(condition, action)		if (! (condition)) { action }
  |  |  ------------------
  |  |  |  Branch (39:47): [True: 10, False: 232]
  |  |  ------------------
  ------------------
  222|    232|				}
  223|       |
  224|  4.66k|				if (escapeFlag == 0)
  ------------------
  |  Branch (224:9): [True: 4.28k, False: 381]
  ------------------
  225|  4.28k|				{
  226|       |					// compressed frame, read rest of parameters
  227|  4.28k|					mixBits	= (uint8_t) BitBufferRead (bits, 8) ;
  228|  4.28k|					mixRes	= (int8_t) BitBufferRead (bits, 8) ;
  229|       |					//Assert ((mixBits == 0) && (mixRes == 0)) ;		// no mixing for mono
  230|       |
  231|  4.28k|					headerByte	= (uint8_t) BitBufferRead (bits, 8) ;
  232|  4.28k|					modeU		= headerByte >> 4 ;
  233|  4.28k|					denShiftU	= headerByte & 0xfu ;
  234|       |
  235|  4.28k|					headerByte	= (uint8_t) BitBufferRead (bits, 8) ;
  236|  4.28k|					pbFactorU	= headerByte >> 5 ;
  237|  4.28k|					numU		= headerByte & 0x1fu ;
  238|       |
  239|  11.9k|					for (i = 0 ; i < numU ; i++)
  ------------------
  |  Branch (239:19): [True: 7.67k, False: 4.28k]
  ------------------
  240|  7.67k|						coefsU [i] = (int16_t) BitBufferRead (bits, 16) ;
  241|       |
  242|       |					// if shift active, skip the shift buffer but remember where it starts
  243|  4.28k|					if (bytesShifted != 0)
  ------------------
  |  Branch (243:10): [True: 168, False: 4.11k]
  ------------------
  244|    168|					{
  245|    168|						shiftBits = *bits ;
  246|    168|						BitBufferAdvance (bits, (bytesShifted * 8) * numSamples) ;
  247|    168|					}
  248|       |
  249|       |					// decompress
  250|  4.28k|					set_ag_params (&agParams, p->mConfig.mb, (pb * pbFactorU) / 4, p->mConfig.kb, numSamples, numSamples, p->mConfig.maxRun) ;
  251|  4.28k|					status = dyn_decomp (&agParams, bits, p->u.mPredictor, numSamples, chanBits, &bits1) ;
  252|  4.28k|					RequireNoErr (status, goto Exit ;) ;
  ------------------
  |  |   41|  4.28k|#define RequireNoErr(condition, action)			if (condition) { action }
  |  |  ------------------
  |  |  |  Branch (41:47): [True: 202, False: 4.08k]
  |  |  ------------------
  ------------------
  253|       |
  254|  4.08k|					if (modeU == 0)
  ------------------
  |  Branch (254:10): [True: 3.33k, False: 751]
  ------------------
  255|  3.33k|					{
  256|  3.33k|						unpc_block (p->u.mPredictor, p->mMixBufferU, numSamples, &coefsU [0], numU, chanBits, denShiftU) ;
  257|  3.33k|					}
  258|    751|					else
  259|    751|					{
  260|       |						// the special "numActive == 31" mode can be done in-place
  261|    751|						unpc_block (p->u.mPredictor, p->u.mPredictor, numSamples, NULL, 31, chanBits, 0) ;
  262|    751|						unpc_block (p->u.mPredictor, p->mMixBufferU, numSamples, &coefsU [0], numU, chanBits, denShiftU) ;
  263|    751|					}
  264|  4.08k|				}
  265|    381|				else
  266|    381|				{
  267|       |					//Assert (bytesShifted == 0) ;
  268|       |
  269|       |					// uncompressed frame, copy data into the mix buffer to use common output code
  270|    381|					shift = 32 - chanBits ;
  271|    381|					if (chanBits <= 16)
  ------------------
  |  Branch (271:10): [True: 186, False: 195]
  ------------------
  272|    186|					{
  273|   190k|						for (i = 0 ; i < numSamples ; i++)
  ------------------
  |  Branch (273:20): [True: 190k, False: 186]
  ------------------
  274|   190k|						{
  275|   190k|							val = (int32_t) BitBufferRead (bits, (uint8_t) chanBits) ;
  276|   190k|							val = arith_shift_left (val, shift) >> shift ;
  277|   190k|							p->mMixBufferU [i] = val ;
  278|   190k|						}
  279|    186|					}
  280|    195|					else
  281|    195|					{
  282|       |						// BitBufferRead () can't read more than 16 bits at a time so break up the reads
  283|    195|						extraBits = chanBits - 16 ;
  284|   184k|						for (i = 0 ; i < numSamples ; i++)
  ------------------
  |  Branch (284:20): [True: 184k, False: 195]
  ------------------
  285|   184k|						{
  286|   184k|							val = (int32_t) BitBufferRead (bits, 16) ;
  287|   184k|							val = arith_shift_left (val, 16) >> shift ;
  288|   184k|							p->mMixBufferU [i] = val | BitBufferRead (bits, (uint8_t) extraBits) ;
  289|   184k|						}
  290|    195|					}
  291|       |
  292|    381|					mixBits = mixRes = 0 ;
  293|    381|					bits1 = chanBits * numSamples ;
  294|    381|					bytesShifted = 0 ;
  295|    381|				}
  296|       |
  297|       |				// now read the shifted values into the shift buffer
  298|  4.46k|				if (bytesShifted != 0)
  ------------------
  |  Branch (298:9): [True: 162, False: 4.30k]
  ------------------
  299|    162|				{
  300|    162|					shift = bytesShifted * 8 ;
  301|       |					//Assert (shift <= 16) ;
  302|       |
  303|  1.46k|					for (i = 0 ; i < numSamples ; i++)
  ------------------
  |  Branch (303:19): [True: 1.30k, False: 162]
  ------------------
  304|  1.30k|						p->u.mShiftBuffer [i] = (uint16_t) BitBufferRead (&shiftBits, (uint8_t) shift) ;
  305|    162|				}
  306|       |
  307|       |				// convert 32-bit integers into output buffer
  308|  4.46k|				switch (p->mConfig.bitDepth)
  ------------------
  |  Branch (308:13): [True: 3.66k, False: 799]
  ------------------
  309|  4.46k|				{
  310|    849|					case 16:
  ------------------
  |  Branch (310:6): [True: 849, False: 3.61k]
  ------------------
  311|    849|						out32 = sampleBuffer + channelIndex ;
  312|  6.87k|						for (i = 0, j = 0 ; i < numSamples ; i++, j += numChannels)
  ------------------
  |  Branch (312:27): [True: 6.02k, False: 849]
  ------------------
  313|  6.02k|							out32 [j] = arith_shift_left (p->mMixBufferU [i], 16) ;
  314|    849|						break ;
  315|    735|					case 20:
  ------------------
  |  Branch (315:6): [True: 735, False: 3.72k]
  ------------------
  316|    735|						out32 = sampleBuffer + channelIndex ;
  317|    735|						copyPredictorTo20 (p->mMixBufferU, out32, numChannels, numSamples) ;
  318|    735|						break ;
  319|  1.15k|					case 24:
  ------------------
  |  Branch (319:6): [True: 1.15k, False: 3.30k]
  ------------------
  320|  1.15k|						out32 = sampleBuffer + channelIndex ;
  321|  1.15k|						if (bytesShifted != 0)
  ------------------
  |  Branch (321:11): [True: 59, False: 1.09k]
  ------------------
  322|     59|							copyPredictorTo24Shift (p->mMixBufferU, p->u.mShiftBuffer, out32, numChannels, numSamples, bytesShifted) ;
  323|  1.09k|						else
  324|  1.09k|							copyPredictorTo24 (p->mMixBufferU, out32, numChannels, numSamples) ;
  325|  1.15k|						break ;
  326|    925|					case 32:
  ------------------
  |  Branch (326:6): [True: 925, False: 3.53k]
  ------------------
  327|    925|						out32 = sampleBuffer + channelIndex ;
  328|    925|						if (bytesShifted != 0)
  ------------------
  |  Branch (328:11): [True: 72, False: 853]
  ------------------
  329|     72|							copyPredictorTo32Shift (p->mMixBufferU, p->u.mShiftBuffer, out32, numChannels, numSamples, bytesShifted) ;
  330|    853|						else
  331|    853|							copyPredictorTo32 (p->mMixBufferU, out32, numChannels, numSamples) ;
  332|    925|						break ;
  333|  4.46k|				}
  334|       |
  335|  4.46k|				channelIndex += 1 ;
  336|  4.46k|				*outNumSamples = numSamples ;
  337|  4.46k|				break ;
  338|  4.46k|			}
  339|       |
  340|    967|			case ID_CPE:
  ------------------
  |  Branch (340:4): [True: 967, False: 7.69k]
  ------------------
  341|    967|			{
  342|       |				// if decoding this pair would take us over the max channels limit, bail
  343|    967|				if ((channelIndex + 2) > numChannels)
  ------------------
  |  Branch (343:9): [True: 261, False: 706]
  ------------------
  344|    261|					goto NoMoreChannels ;
  345|       |
  346|       |				// stereo channel pair
  347|    706|				elementInstanceTag = BitBufferReadSmall (bits, 4) ;
  348|    706|				p->mActiveElements |= (1u << elementInstanceTag) ;
  349|       |
  350|       |				// read the 12 unused header bits
  351|    706|				unusedHeader = (uint16_t) BitBufferRead (bits, 12) ;
  352|    706|				RequireAction (unusedHeader == 0, status = kALAC_ParamError ; goto Exit ;) ;
  ------------------
  |  |   39|    706|#define RequireAction(condition, action)		if (! (condition)) { action }
  |  |  ------------------
  |  |  |  Branch (39:47): [True: 20, False: 686]
  |  |  ------------------
  ------------------
  353|       |
  354|       |				// read the 1-bit "partial frame" flag, 2-bit "shift-off" flag & 1-bit "escape" flag
  355|    686|				headerByte = (uint8_t) BitBufferRead (bits, 4) ;
  356|       |
  357|    686|				partialFrame = headerByte >> 3 ;
  358|       |
  359|    686|				bytesShifted = (headerByte >> 1) & 0x3u ;
  360|    686|				RequireAction (bytesShifted != 3, status = kALAC_ParamError ; goto Exit ;) ;
  ------------------
  |  |   39|    686|#define RequireAction(condition, action)		if (! (condition)) { action }
  |  |  ------------------
  |  |  |  Branch (39:47): [True: 5, False: 681]
  |  |  ------------------
  ------------------
  361|       |
  362|    681|				shift = bytesShifted * 8 ;
  363|       |
  364|    681|				escapeFlag = headerByte & 0x1 ;
  365|       |
  366|    681|				chanBits = p->mConfig.bitDepth - (bytesShifted * 8) + 1 ;
  367|       |
  368|       |				// check for partial frame length to override requested numSamples
  369|    681|				if (partialFrame != 0)
  ------------------
  |  Branch (369:9): [True: 265, False: 416]
  ------------------
  370|    265|				{
  371|    265|					numSamples = BitBufferRead (bits, 16) << 16 ;
  372|    265|					numSamples |= BitBufferRead (bits, 16) ;
  373|       |
  374|    265|					RequireAction (numSamples < kALACDefaultFramesPerPacket, return kALAC_NumSamplesTooBig ;) ;
  ------------------
  |  |   39|    265|#define RequireAction(condition, action)		if (! (condition)) { action }
  |  |  ------------------
  |  |  |  Branch (39:47): [True: 7, False: 258]
  |  |  ------------------
  ------------------
  375|    258|				}
  376|       |
  377|    674|				if (escapeFlag == 0)
  ------------------
  |  Branch (377:9): [True: 511, False: 163]
  ------------------
  378|    511|				{
  379|       |					// compressed frame, read rest of parameters
  380|    511|					mixBits		= (uint8_t) BitBufferRead (bits, 8) ;
  381|    511|					mixRes		= (int8_t) BitBufferRead (bits, 8) ;
  382|    511|					RequireAction (mixBits < 32, status = kALAC_ParamError ; goto Exit ;) ;
  ------------------
  |  |   39|    511|#define RequireAction(condition, action)		if (! (condition)) { action }
  |  |  ------------------
  |  |  |  Branch (39:47): [True: 6, False: 505]
  |  |  ------------------
  ------------------
  383|       |
  384|       |					// Not checked with the header: an uncompressed frame replaces chanBits with the bit depth.
  385|    505|					RequireAction (chanBits >= 1 && chanBits <= 32, status = kALAC_ParamError ; goto Exit ;) ;
  ------------------
  |  |   39|  1.00k|#define RequireAction(condition, action)		if (! (condition)) { action }
  |  |  ------------------
  |  |  |  Branch (39:50): [True: 502, False: 3]
  |  |  |  Branch (39:50): [True: 493, False: 9]
  |  |  ------------------
  ------------------
  386|       |
  387|    493|					headerByte	= (uint8_t) BitBufferRead (bits, 8) ;
  388|    493|					modeU		= headerByte >> 4 ;
  389|    493|					denShiftU	= headerByte & 0xfu ;
  390|       |
  391|    493|					headerByte	= (uint8_t) BitBufferRead (bits, 8) ;
  392|    493|					pbFactorU	= headerByte >> 5 ;
  393|    493|					numU		= headerByte & 0x1fu ;
  394|  2.36k|					for (i = 0 ; i < numU ; i++)
  ------------------
  |  Branch (394:19): [True: 1.87k, False: 493]
  ------------------
  395|  1.87k|						coefsU [i] = (int16_t) BitBufferRead (bits, 16) ;
  396|       |
  397|    493|					headerByte	= (uint8_t) BitBufferRead (bits, 8) ;
  398|    493|					modeV		= headerByte >> 4 ;
  399|    493|					denShiftV	= headerByte & 0xfu ;
  400|       |
  401|    493|					headerByte	= (uint8_t) BitBufferRead (bits, 8) ;
  402|    493|					pbFactorV	= headerByte >> 5 ;
  403|    493|					numV		= headerByte & 0x1fu ;
  404|  3.07k|					for (i = 0 ; i < numV ; i++)
  ------------------
  |  Branch (404:19): [True: 2.58k, False: 493]
  ------------------
  405|  2.58k|						coefsV [i] = (int16_t) BitBufferRead (bits, 16) ;
  406|       |
  407|       |					// if shift active, skip the interleaved shifted values but remember where they start
  408|    493|					if (bytesShifted != 0)
  ------------------
  |  Branch (408:10): [True: 164, False: 329]
  ------------------
  409|    164|					{
  410|    164|						shiftBits = *bits ;
  411|    164|						BitBufferAdvance (bits, (bytesShifted * 8) * 2 * numSamples) ;
  412|    164|					}
  413|       |
  414|       |					// decompress and run predictor for "left" channel
  415|    493|					set_ag_params (&agParams, p->mConfig.mb, (pb * pbFactorU) / 4, p->mConfig.kb, numSamples, numSamples, p->mConfig.maxRun) ;
  416|    493|					status = dyn_decomp (&agParams, bits, p->u.mPredictor, numSamples, chanBits, &bits1) ;
  417|    493|					RequireNoErr (status, goto Exit ;) ;
  ------------------
  |  |   41|    493|#define RequireNoErr(condition, action)			if (condition) { action }
  |  |  ------------------
  |  |  |  Branch (41:47): [True: 27, False: 466]
  |  |  ------------------
  ------------------
  418|       |
  419|    466|					if (modeU == 0)
  ------------------
  |  Branch (419:10): [True: 212, False: 254]
  ------------------
  420|    212|					{
  421|    212|						unpc_block (p->u.mPredictor, p->mMixBufferU, numSamples, &coefsU [0], numU, chanBits, denShiftU) ;
  422|    212|					}
  423|    254|					else
  424|    254|					{
  425|       |						// the special "numActive == 31" mode can be done in-place
  426|    254|						unpc_block (p->u.mPredictor, p->u.mPredictor, numSamples, NULL, 31, chanBits, 0) ;
  427|    254|						unpc_block (p->u.mPredictor, p->mMixBufferU, numSamples, &coefsU [0], numU, chanBits, denShiftU) ;
  428|    254|					}
  429|       |
  430|       |					// decompress and run predictor for "right" channel
  431|    466|					set_ag_params (&agParams, p->mConfig.mb, (pb * pbFactorV) / 4, p->mConfig.kb, numSamples, numSamples, p->mConfig.maxRun) ;
  432|    466|					status = dyn_decomp (&agParams, bits, p->u.mPredictor, numSamples, chanBits, &bits2) ;
  433|    466|					RequireNoErr (status, goto Exit ;) ;
  ------------------
  |  |   41|    466|#define RequireNoErr(condition, action)			if (condition) { action }
  |  |  ------------------
  |  |  |  Branch (41:47): [True: 11, False: 455]
  |  |  ------------------
  ------------------
  434|       |
  435|    455|					if (modeV == 0)
  ------------------
  |  Branch (435:10): [True: 229, False: 226]
  ------------------
  436|    229|					{
  437|    229|						unpc_block (p->u.mPredictor, p->mMixBufferV, numSamples, &coefsV [0], numV, chanBits, denShiftV) ;
  438|    229|					}
  439|    226|					else
  440|    226|					{
  441|       |						// the special "numActive == 31" mode can be done in-place
  442|    226|						unpc_block (p->u.mPredictor, p->u.mPredictor, numSamples, NULL, 31, chanBits, 0) ;
  443|    226|						unpc_block (p->u.mPredictor, p->mMixBufferV, numSamples, &coefsV [0], numV, chanBits, denShiftV) ;
  444|    226|					}
  445|    455|				}
  446|    163|				else
  447|    163|				{
  448|       |					//Assert (bytesShifted == 0) ;
  449|       |
  450|       |					// uncompressed frame, copy data into the mix buffers to use common output code
  451|    163|					chanBits = p->mConfig.bitDepth ;
  452|    163|					shift = 32 - chanBits ;
  453|    163|					if (chanBits <= 16)
  ------------------
  |  Branch (453:10): [True: 40, False: 123]
  ------------------
  454|     40|					{
  455|  6.60k|						for (i = 0 ; i < numSamples ; i++)
  ------------------
  |  Branch (455:20): [True: 6.56k, False: 40]
  ------------------
  456|  6.56k|						{
  457|  6.56k|							val = (int32_t) BitBufferRead (bits, (uint8_t) chanBits) ;
  458|  6.56k|							val = arith_shift_left (val, shift) >> shift ;
  459|  6.56k|							p->mMixBufferU [i] = val ;
  460|       |
  461|  6.56k|							val = (int32_t) BitBufferRead (bits, (uint8_t) chanBits) ;
  462|  6.56k|							val = arith_shift_left (val, shift) >> shift ;
  463|  6.56k|							p->mMixBufferV [i] = val ;
  464|  6.56k|						}
  465|     40|					}
  466|    123|					else
  467|    123|					{
  468|       |						// BitBufferRead () can't read more than 16 bits at a time so break up the reads
  469|    123|						extraBits = chanBits - 16 ;
  470|  9.64k|						for (i = 0 ; i < numSamples ; i++)
  ------------------
  |  Branch (470:20): [True: 9.52k, False: 123]
  ------------------
  471|  9.52k|						{
  472|  9.52k|							val = (int32_t) BitBufferRead (bits, 16) ;
  473|  9.52k|							val = (((uint32_t) val) << 16) >> shift ;
  474|  9.52k|							p->mMixBufferU [i] = val | BitBufferRead (bits, (uint8_t) extraBits) ;
  475|       |
  476|  9.52k|							val = (int32_t) BitBufferRead (bits, 16) ;
  477|  9.52k|							val = ((uint32_t) val) >> shift ;
  478|  9.52k|							p->mMixBufferV [i] = val | BitBufferRead (bits, (uint8_t) extraBits) ;
  479|  9.52k|						}
  480|    123|					}
  481|       |
  482|    163|					bits1 = chanBits * numSamples ;
  483|    163|					bits2 = chanBits * numSamples ;
  484|    163|					mixBits = mixRes = 0 ;
  485|    163|					bytesShifted = 0 ;
  486|    163|				}
  487|       |
  488|       |				// now read the shifted values into the shift buffer
  489|    618|				if (bytesShifted != 0)
  ------------------
  |  Branch (489:9): [True: 161, False: 457]
  ------------------
  490|    161|				{
  491|    161|					shift = bytesShifted * 8 ;
  492|       |					//Assert (shift <= 16) ;
  493|       |
  494|  1.73k|					for (i = 0 ; i < (numSamples * 2) ; i += 2)
  ------------------
  |  Branch (494:19): [True: 1.56k, False: 161]
  ------------------
  495|  1.56k|					{
  496|  1.56k|						p->u.mShiftBuffer [i + 0] = (uint16_t) BitBufferRead (&shiftBits, (uint8_t) shift) ;
  497|  1.56k|						p->u.mShiftBuffer [i + 1] = (uint16_t) BitBufferRead (&shiftBits, (uint8_t) shift) ;
  498|  1.56k|					}
  499|    161|				}
  500|       |
  501|       |				// un-mix the data and convert to output format
  502|       |				// - note that mixRes = 0 means just interleave so we use that path for uncompressed frames
  503|    618|				switch (p->mConfig.bitDepth)
  ------------------
  |  Branch (503:13): [True: 526, False: 92]
  ------------------
  504|    618|				{
  505|    125|					case 16:
  ------------------
  |  Branch (505:6): [True: 125, False: 493]
  ------------------
  506|    125|						out32 = sampleBuffer + channelIndex ;
  507|    125|						unmix16 (p->mMixBufferU, p->mMixBufferV, out32, numChannels, numSamples, mixBits, mixRes) ;
  508|    125|						break ;
  509|    104|					case 20:
  ------------------
  |  Branch (509:6): [True: 104, False: 514]
  ------------------
  510|    104|						out32 = sampleBuffer + channelIndex ;
  511|    104|						unmix20 (p->mMixBufferU, p->mMixBufferV, out32, numChannels, numSamples, mixBits, mixRes) ;
  512|    104|						break ;
  513|    186|					case 24:
  ------------------
  |  Branch (513:6): [True: 186, False: 432]
  ------------------
  514|    186|						out32 = sampleBuffer + channelIndex ;
  515|    186|						unmix24 (p->mMixBufferU, p->mMixBufferV, out32, numChannels, numSamples,
  516|    186|									mixBits, mixRes, p->u.mShiftBuffer, bytesShifted) ;
  517|    186|						break ;
  518|    111|					case 32:
  ------------------
  |  Branch (518:6): [True: 111, False: 507]
  ------------------
  519|    111|						out32 = sampleBuffer + channelIndex ;
  520|    111|						unmix32 (p->mMixBufferU, p->mMixBufferV, out32, numChannels, numSamples,
  521|    111|									mixBits, mixRes, p->u.mShiftBuffer, bytesShifted) ;
  522|    111|						break ;
  523|    618|				}
  524|       |
  525|    618|				channelIndex += 2 ;
  526|    618|				*outNumSamples = numSamples ;
  527|    618|				break ;
  528|    618|			}
  529|       |
  530|     46|			case ID_CCE:
  ------------------
  |  Branch (530:4): [True: 46, False: 8.61k]
  ------------------
  531|     94|			case ID_PCE:
  ------------------
  |  Branch (531:4): [True: 48, False: 8.61k]
  ------------------
  532|     94|			{
  533|       |				// unsupported element, bail
  534|       |				//AssertNoErr (tag) ;
  535|     94|				status = kALAC_UnsupportedElement ;
  536|     94|				break ;
  537|     46|			}
  538|       |
  539|    606|			case ID_DSE:
  ------------------
  |  Branch (539:4): [True: 606, False: 8.05k]
  ------------------
  540|    606|			{
  541|       |				// data stream element -- parse but ignore
  542|    606|				status = alac_data_stream_element (bits) ;
  543|    606|				break ;
  544|     46|			}
  545|       |
  546|  1.07k|			case ID_FIL:
  ------------------
  |  Branch (546:4): [True: 1.07k, False: 7.58k]
  ------------------
  547|  1.07k|			{
  548|       |				// fill element -- parse but ignore
  549|  1.07k|				status = alac_fill_element (bits) ;
  550|  1.07k|				break ;
  551|     46|			}
  552|       |
  553|    983|			case ID_END:
  ------------------
  |  Branch (553:4): [True: 983, False: 7.67k]
  ------------------
  554|    983|			{
  555|       |				// frame end, all done so byte align the frame and check for overruns
  556|    983|				BitBufferByteAlign (bits, false) ;
  557|       |				//Assert (bits->cur == bits->end) ;
  558|    983|				goto Exit ;
  559|     46|			}
  560|  8.66k|		}
  561|       |
  562|  6.85k|#if 1 // ! DEBUG
  563|       |		// if we've decoded all of our channels, bail (but not in debug b/c we want to know if we're seeing bad bits)
  564|       |		// - this also protects us if the config does not match the bitstream or crap data bits follow the audio bits
  565|  6.85k|		if (channelIndex >= numChannels)
  ------------------
  |  Branch (565:7): [True: 574, False: 6.28k]
  ------------------
  566|    574|			break ;
  567|  6.85k|#endif
  568|  6.85k|	}
  569|       |
  570|    965|NoMoreChannels:
  571|       |
  572|       |	// if we get here and haven't decoded all of the requested channels, fill the remaining channels with zeros
  573|  5.99k|	for ( ; channelIndex < numChannels ; channelIndex++)
  ------------------
  |  Branch (573:10): [True: 5.02k, False: 965]
  ------------------
  574|  5.02k|	{
  575|  5.02k|		int32_t *	fill32 = sampleBuffer + channelIndex ;
  576|  5.02k|		Zero32 (fill32, numSamples, numChannels) ;
  577|  5.02k|	}
  578|       |
  579|  2.58k|Exit:
  580|  2.58k|	return status ;
  581|    965|}
alac_decoder.c:alac_fill_element:
  593|  1.07k|{
  594|  1.07k|	int16_t		count ;
  595|       |
  596|       |	// 4-bit count or (4-bit + 8-bit count) if 4-bit count == 15
  597|       |	// - plus this weird -1 thing I still don't fully understand
  598|  1.07k|	count = BitBufferReadSmall (bits, 4) ;
  599|  1.07k|	if (count == 15)
  ------------------
  |  Branch (599:6): [True: 15, False: 1.06k]
  ------------------
  600|     15|		count += (int16_t) BitBufferReadSmall (bits, 8) - 1 ;
  601|       |
  602|  1.07k|	BitBufferAdvance (bits, count * 8) ;
  603|       |
  604|  1.07k|	RequireAction (bits->cur <= bits->end, return kALAC_ParamError ;) ;
  ------------------
  |  |   39|  1.07k|#define RequireAction(condition, action)		if (! (condition)) { action }
  |  |  ------------------
  |  |  |  Branch (39:47): [True: 14, False: 1.06k]
  |  |  ------------------
  ------------------
  605|       |
  606|  1.06k|	return ALAC_noErr ;
  607|  1.07k|}
alac_decoder.c:alac_data_stream_element:
  615|    606|{
  616|    606|	int32_t		data_byte_align_flag ;
  617|    606|	uint16_t		count ;
  618|       |
  619|       |	// the tag associates this data stream element with a given audio element
  620|       |
  621|       |	/* element_instance_tag = */ BitBufferReadSmall (bits, 4) ;
  622|       |
  623|    606|	data_byte_align_flag = BitBufferReadOne (bits) ;
  624|       |
  625|       |	// 8-bit count or (8-bit + 8-bit count) if 8-bit count == 255
  626|    606|	count = BitBufferReadSmall (bits, 8) ;
  627|    606|	if (count == 255)
  ------------------
  |  Branch (627:6): [True: 11, False: 595]
  ------------------
  628|     11|		count += BitBufferReadSmall (bits, 8) ;
  629|       |
  630|       |	// the align flag means the bitstream should be byte-aligned before reading the following data bytes
  631|    606|	if (data_byte_align_flag)
  ------------------
  |  Branch (631:6): [True: 235, False: 371]
  ------------------
  632|    235|		BitBufferByteAlign (bits, false) ;
  633|       |
  634|       |	// skip the data bytes
  635|    606|	BitBufferAdvance (bits, count * 8) ;
  636|       |
  637|    606|	RequireAction (bits->cur <= bits->end, return kALAC_ParamError ;) ;
  ------------------
  |  |   39|    606|#define RequireAction(condition, action)		if (! (condition)) { action }
  |  |  ------------------
  |  |  |  Branch (39:47): [True: 22, False: 584]
  |  |  ------------------
  ------------------
  638|       |
  639|    584|	return ALAC_noErr ;
  640|    606|}
alac_decoder.c:Zero32:
  647|  5.02k|{
  648|  5.02k|	if (stride == 1)
  ------------------
  |  Branch (648:6): [True: 240, False: 4.78k]
  ------------------
  649|    240|	{
  650|    240|		memset (buffer, 0, numItems * sizeof (int32_t)) ;
  651|    240|	}
  652|  4.78k|	else
  653|  4.78k|	{
  654|   602k|		for (uint32_t indx = 0 ; indx < (numItems * stride) ; indx += stride)
  ------------------
  |  Branch (654:28): [True: 597k, False: 4.78k]
  ------------------
  655|   597k|			buffer [indx] = 0 ;
  656|  4.78k|	}
  657|  5.02k|}

unpc_block:
   56|  6.23k|{
   57|  6.23k|	register int16_t	a0, a1, a2, a3 ;
   58|  6.23k|	register int32_t	b0, b1, b2, b3 ;
   59|  6.23k|	int32_t					j, k, lim ;
   60|  6.23k|	int32_t				sum1, sg, sgn, top, dd ;
   61|  6.23k|	int32_t *			pout ;
   62|  6.23k|	int32_t				del, del0 ;
   63|  6.23k|	uint32_t			chanshift = 32 - chanbits ;
   64|  6.23k|	int32_t				denhalf = denshift ? 1 << (denshift - 1) : 0 ;
  ------------------
  |  Branch (64:23): [True: 1.12k, False: 5.10k]
  ------------------
   65|       |
   66|  6.23k|	out [0] = pc1 [0] ;
   67|  6.23k|	if (numactive == 0)
  ------------------
  |  Branch (67:6): [True: 3.83k, False: 2.40k]
  ------------------
   68|  3.83k|	{
   69|       |		// just copy if numactive == 0 (but don't bother if in/out pointers the same)
   70|  3.83k|		if ((num > 1) && (pc1 != out))
  ------------------
  |  Branch (70:7): [True: 2.19k, False: 1.63k]
  |  Branch (70:20): [True: 2.19k, False: 0]
  ------------------
   71|  2.19k|			memcpy (&out [1], &pc1 [1], (num - 1) * sizeof (int32_t)) ;
   72|  3.83k|		return ;
   73|  3.83k|	}
   74|  2.40k|	if (numactive == 31)
  ------------------
  |  Branch (74:6): [True: 1.26k, False: 1.13k]
  ------------------
   75|  1.26k|	{
   76|       |		// short-circuit if numactive == 31
   77|  1.26k|		int32_t		prev ;
   78|       |
   79|       |		/*	this code is written such that the in/out buffers can be the same
   80|       |			to conserve buffer space on embedded devices like the iPod
   81|       |
   82|       |			(original code)
   83|       |			for (j = 1 ; j < num ; j++)
   84|       |				del = pc1 [j] + out [j-1] ;
   85|       |				out [j] = (del << chanshift) >> chanshift ;
   86|       |		*/
   87|  1.26k|		prev = out [0] ;
   88|  57.5k|		for (j = 1 ; j < num ; j++)
  ------------------
  |  Branch (88:16): [True: 56.2k, False: 1.26k]
  ------------------
   89|  56.2k|		{
   90|  56.2k|			del = pc1 [j] + prev ;
   91|  56.2k|			prev = (del << chanshift) >> chanshift ;
   92|  56.2k|			out [j] = prev ;
   93|  56.2k|		}
   94|  1.26k|		return ;
   95|  1.26k|	}
   96|       |
   97|  10.3k|	for (j = 1 ; j <= numactive ; j++)
  ------------------
  |  Branch (97:15): [True: 9.24k, False: 1.13k]
  ------------------
   98|  9.24k|	{
   99|  9.24k|		del = pc1 [j] + out [j-1] ;
  100|  9.24k|		out [j] = arith_shift_left (del, chanshift) >> chanshift ;
  101|  9.24k|	}
  102|       |
  103|  1.13k|	lim = numactive + 1 ;
  104|       |
  105|  1.13k|	if (numactive == 4)
  ------------------
  |  Branch (105:6): [True: 236, False: 901]
  ------------------
  106|    236|	{
  107|       |		// optimization for numactive == 4
  108|    236|		register int16_t	ia0, ia1, ia2, ia3 ;
  109|    236|		register int32_t	ib0, ib1, ib2, ib3 ;
  110|       |
  111|    236|		ia0 = coefs [0] ;
  112|    236|		ia1 = coefs [1] ;
  113|    236|		ia2 = coefs [2] ;
  114|    236|		ia3 = coefs [3] ;
  115|       |
  116|  9.73k|		for (j = lim ; j < num ; j++)
  ------------------
  |  Branch (116:18): [True: 9.50k, False: 236]
  ------------------
  117|  9.50k|		{
  118|  9.50k|			LOOP_ALIGN
  119|       |
  120|  9.50k|			top = out [j - lim] ;
  121|  9.50k|			pout = out + j - 1 ;
  122|       |
  123|  9.50k|			ib0 = top - pout [0] ;
  124|  9.50k|			ib1 = top - pout [-1] ;
  125|  9.50k|			ib2 = top - pout [-2] ;
  126|  9.50k|			ib3 = top - pout [-3] ;
  127|       |
  128|  9.50k|			sum1 = (denhalf - ia0 * ib0 - ia1 * ib1 - ia2 * ib2 - ia3 * ib3) >> denshift ;
  129|       |
  130|  9.50k|			del = pc1 [j] ;
  131|  9.50k|			del0 = del ;
  132|  9.50k|			sg = sign_of_int (del) ;
  133|  9.50k|			del += top + sum1 ;
  134|       |
  135|  9.50k|			out [j] = arith_shift_left (del, chanshift) >> chanshift ;
  136|       |
  137|  9.50k|			if (sg > 0)
  ------------------
  |  Branch (137:8): [True: 3.22k, False: 6.27k]
  ------------------
  138|  3.22k|			{
  139|  3.22k|				sgn = sign_of_int (ib3) ;
  140|  3.22k|				ia3 -= sgn ;
  141|  3.22k|				del0 -= (4 - 3) * ((sgn * ib3) >> denshift) ;
  142|  3.22k|				if (del0 <= 0)
  ------------------
  |  Branch (142:9): [True: 987, False: 2.24k]
  ------------------
  143|    987|					continue ;
  144|       |
  145|  2.24k|				sgn = sign_of_int (ib2) ;
  146|  2.24k|				ia2 -= sgn ;
  147|  2.24k|				del0 -= (4 - 2) * ((sgn * ib2) >> denshift) ;
  148|  2.24k|				if (del0 <= 0)
  ------------------
  |  Branch (148:9): [True: 513, False: 1.72k]
  ------------------
  149|    513|					continue ;
  150|       |
  151|  1.72k|				sgn = sign_of_int (ib1) ;
  152|  1.72k|				ia1 -= sgn ;
  153|  1.72k|				del0 -= (4 - 1) * ((sgn * ib1) >> denshift) ;
  154|  1.72k|				if (del0 <= 0)
  ------------------
  |  Branch (154:9): [True: 420, False: 1.30k]
  ------------------
  155|    420|					continue ;
  156|       |
  157|  1.30k|				ia0 -= sign_of_int (ib0) ;
  158|  1.30k|			}
  159|  6.27k|			else if (sg < 0)
  ------------------
  |  Branch (159:13): [True: 4.29k, False: 1.98k]
  ------------------
  160|  4.29k|			{
  161|       |				// note: to avoid unnecessary negations, we flip the value of "sgn"
  162|  4.29k|				sgn = -sign_of_int (ib3) ;
  163|  4.29k|				ia3 -= sgn ;
  164|  4.29k|				del0 -= (4 - 3) * ((sgn * ib3) >> denshift) ;
  165|  4.29k|				if (del0 >= 0)
  ------------------
  |  Branch (165:9): [True: 2.52k, False: 1.76k]
  ------------------
  166|  2.52k|					continue ;
  167|       |
  168|  1.76k|				sgn = -sign_of_int (ib2) ;
  169|  1.76k|				ia2 -= sgn ;
  170|  1.76k|				del0 -= (4 - 2) * ((sgn * ib2) >> denshift) ;
  171|  1.76k|				if (del0 >= 0)
  ------------------
  |  Branch (171:9): [True: 428, False: 1.34k]
  ------------------
  172|    428|					continue ;
  173|       |
  174|  1.34k|				sgn = -sign_of_int (ib1) ;
  175|  1.34k|				ia1 -= sgn ;
  176|  1.34k|				del0 -= (4 - 1) * ((sgn * ib1) >> denshift) ;
  177|  1.34k|				if (del0 >= 0)
  ------------------
  |  Branch (177:9): [True: 449, False: 892]
  ------------------
  178|    449|					continue ;
  179|       |
  180|    892|				ia0 += sign_of_int (ib0) ;
  181|    892|			}
  182|  9.50k|		}
  183|       |
  184|    236|		coefs [0] = ia0 ;
  185|    236|		coefs [1] = ia1 ;
  186|    236|		coefs [2] = ia2 ;
  187|    236|		coefs [3] = ia3 ;
  188|    236|	}
  189|    901|	else if (numactive == 8)
  ------------------
  |  Branch (189:11): [True: 201, False: 700]
  ------------------
  190|    201|	{
  191|    201|		register int16_t	a4, a5, a6, a7 ;
  192|    201|		register int32_t	b4, b5, b6, b7 ;
  193|       |
  194|       |		// optimization for numactive == 8
  195|    201|		a0 = coefs [0] ;
  196|    201|		a1 = coefs [1] ;
  197|    201|		a2 = coefs [2] ;
  198|    201|		a3 = coefs [3] ;
  199|    201|		a4 = coefs [4] ;
  200|    201|		a5 = coefs [5] ;
  201|    201|		a6 = coefs [6] ;
  202|    201|		a7 = coefs [7] ;
  203|       |
  204|  13.6k|		for (j = lim ; j < num ; j++)
  ------------------
  |  Branch (204:18): [True: 13.4k, False: 201]
  ------------------
  205|  13.4k|		{
  206|  13.4k|			LOOP_ALIGN
  207|       |
  208|  13.4k|			top = out [j - lim] ;
  209|  13.4k|			pout = out + j - 1 ;
  210|       |
  211|  13.4k|			b0 = top - (*pout--) ;
  212|  13.4k|			b1 = top - (*pout--) ;
  213|  13.4k|			b2 = top - (*pout--) ;
  214|  13.4k|			b3 = top - (*pout--) ;
  215|  13.4k|			b4 = top - (*pout--) ;
  216|  13.4k|			b5 = top - (*pout--) ;
  217|  13.4k|			b6 = top - (*pout--) ;
  218|  13.4k|			b7 = top - (*pout) ;
  219|  13.4k|			pout += 8 ;
  220|       |
  221|  13.4k|			sum1 = (denhalf - a0 * b0 - a1 * b1 - a2 * b2 - a3 * b3
  222|  13.4k|					- a4 * b4 - a5 * b5 - a6 * b6 - a7 * b7) >> denshift ;
  223|       |
  224|  13.4k|			del = pc1 [j] ;
  225|  13.4k|			del0 = del ;
  226|  13.4k|			sg = sign_of_int (del) ;
  227|  13.4k|			del += top + sum1 ;
  228|       |
  229|  13.4k|			out [j] = arith_shift_left (del, chanshift) >> chanshift ;
  230|       |
  231|  13.4k|			if (sg > 0)
  ------------------
  |  Branch (231:8): [True: 5.70k, False: 7.76k]
  ------------------
  232|  5.70k|			{
  233|  5.70k|				sgn = sign_of_int (b7) ;
  234|  5.70k|				a7 -= sgn ;
  235|  5.70k|				del0 -= 1 * ((sgn * b7) >> denshift) ;
  236|  5.70k|				if (del0 <= 0)
  ------------------
  |  Branch (236:9): [True: 609, False: 5.09k]
  ------------------
  237|    609|					continue ;
  238|       |
  239|  5.09k|				sgn = sign_of_int (b6) ;
  240|  5.09k|				a6 -= sgn ;
  241|  5.09k|				del0 -= 2 * ((sgn * b6) >> denshift) ;
  242|  5.09k|				if (del0 <= 0)
  ------------------
  |  Branch (242:9): [True: 275, False: 4.82k]
  ------------------
  243|    275|					continue ;
  244|       |
  245|  4.82k|				sgn = sign_of_int (b5) ;
  246|  4.82k|				a5 -= sgn ;
  247|  4.82k|				del0 -= 3 * ((sgn * b5) >> denshift) ;
  248|  4.82k|				if (del0 <= 0)
  ------------------
  |  Branch (248:9): [True: 524, False: 4.30k]
  ------------------
  249|    524|					continue ;
  250|       |
  251|  4.30k|				sgn = sign_of_int (b4) ;
  252|  4.30k|				a4 -= sgn ;
  253|  4.30k|				del0 -= 4 * ((sgn * b4) >> denshift) ;
  254|  4.30k|				if (del0 <= 0)
  ------------------
  |  Branch (254:9): [True: 620, False: 3.68k]
  ------------------
  255|    620|					continue ;
  256|       |
  257|  3.68k|				sgn = sign_of_int (b3) ;
  258|  3.68k|				a3 -= sgn ;
  259|  3.68k|				del0 -= 5 * ((sgn * b3) >> denshift) ;
  260|  3.68k|				if (del0 <= 0)
  ------------------
  |  Branch (260:9): [True: 750, False: 2.93k]
  ------------------
  261|    750|					continue ;
  262|       |
  263|  2.93k|				sgn = sign_of_int (b2) ;
  264|  2.93k|				a2 -= sgn ;
  265|  2.93k|				del0 -= 6 * ((sgn * b2) >> denshift) ;
  266|  2.93k|				if (del0 <= 0)
  ------------------
  |  Branch (266:9): [True: 699, False: 2.23k]
  ------------------
  267|    699|					continue ;
  268|       |
  269|  2.23k|				sgn = sign_of_int (b1) ;
  270|  2.23k|				a1 -= sgn ;
  271|  2.23k|				del0 -= 7 * ((sgn * b1) >> denshift) ;
  272|  2.23k|				if (del0 <= 0)
  ------------------
  |  Branch (272:9): [True: 576, False: 1.65k]
  ------------------
  273|    576|					continue ;
  274|       |
  275|  1.65k|				a0 -= sign_of_int (b0) ;
  276|  1.65k|			}
  277|  7.76k|			else if (sg < 0)
  ------------------
  |  Branch (277:13): [True: 6.71k, False: 1.04k]
  ------------------
  278|  6.71k|			{
  279|       |				// note: to avoid unnecessary negations, we flip the value of "sgn"
  280|  6.71k|				sgn = -sign_of_int (b7) ;
  281|  6.71k|				a7 -= sgn ;
  282|  6.71k|				del0 -= 1 * ((sgn * b7) >> denshift) ;
  283|  6.71k|				if (del0 >= 0)
  ------------------
  |  Branch (283:9): [True: 1.15k, False: 5.55k]
  ------------------
  284|  1.15k|					continue ;
  285|       |
  286|  5.55k|				sgn = -sign_of_int (b6) ;
  287|  5.55k|				a6 -= sgn ;
  288|  5.55k|				del0 -= 2 * ((sgn * b6) >> denshift) ;
  289|  5.55k|				if (del0 >= 0)
  ------------------
  |  Branch (289:9): [True: 533, False: 5.02k]
  ------------------
  290|    533|					continue ;
  291|       |
  292|  5.02k|				sgn = -sign_of_int (b5) ;
  293|  5.02k|				a5 -= sgn ;
  294|  5.02k|				del0 -= 3 * ((sgn * b5) >> denshift) ;
  295|  5.02k|				if (del0 >= 0)
  ------------------
  |  Branch (295:9): [True: 660, False: 4.36k]
  ------------------
  296|    660|					continue ;
  297|       |
  298|  4.36k|				sgn = -sign_of_int (b4) ;
  299|  4.36k|				a4 -= sgn ;
  300|  4.36k|				del0 -= 4 * ((sgn * b4) >> denshift) ;
  301|  4.36k|				if (del0 >= 0)
  ------------------
  |  Branch (301:9): [True: 709, False: 3.65k]
  ------------------
  302|    709|					continue ;
  303|       |
  304|  3.65k|				sgn = -sign_of_int (b3) ;
  305|  3.65k|				a3 -= sgn ;
  306|  3.65k|				del0 -= 5 * ((sgn * b3) >> denshift) ;
  307|  3.65k|				if (del0 >= 0)
  ------------------
  |  Branch (307:9): [True: 645, False: 3.01k]
  ------------------
  308|    645|					continue ;
  309|       |
  310|  3.01k|				sgn = -sign_of_int (b2) ;
  311|  3.01k|				a2 -= sgn ;
  312|  3.01k|				del0 -= 6 * ((sgn * b2) >> denshift) ;
  313|  3.01k|				if (del0 >= 0)
  ------------------
  |  Branch (313:9): [True: 553, False: 2.45k]
  ------------------
  314|    553|					continue ;
  315|       |
  316|  2.45k|				sgn = -sign_of_int (b1) ;
  317|  2.45k|				a1 -= sgn ;
  318|  2.45k|				del0 -= 7 * ((sgn * b1) >> denshift) ;
  319|  2.45k|				if (del0 >= 0)
  ------------------
  |  Branch (319:9): [True: 544, False: 1.91k]
  ------------------
  320|    544|					continue ;
  321|       |
  322|  1.91k|				a0 += sign_of_int (b0) ;
  323|  1.91k|			}
  324|  13.4k|		}
  325|       |
  326|    201|		coefs [0] = a0 ;
  327|    201|		coefs [1] = a1 ;
  328|    201|		coefs [2] = a2 ;
  329|    201|		coefs [3] = a3 ;
  330|    201|		coefs [4] = a4 ;
  331|    201|		coefs [5] = a5 ;
  332|    201|		coefs [6] = a6 ;
  333|    201|		coefs [7] = a7 ;
  334|    201|	}
  335|    700|	else
  336|    700|	{
  337|       |		// general case
  338|  22.4k|		for (j = lim ; j < num ; j++)
  ------------------
  |  Branch (338:18): [True: 21.7k, False: 700]
  ------------------
  339|  21.7k|		{
  340|  21.7k|			LOOP_ALIGN
  341|       |
  342|  21.7k|			sum1 = 0 ;
  343|  21.7k|			pout = out + j - 1 ;
  344|  21.7k|			top = out [j-lim] ;
  345|       |
  346|   313k|			for (k = 0 ; k < numactive ; k++)
  ------------------
  |  Branch (346:17): [True: 291k, False: 21.7k]
  ------------------
  347|   291k|				sum1 += coefs [k] * (pout [-k] - top) ;
  348|       |
  349|  21.7k|			del = pc1 [j] ;
  350|  21.7k|			del0 = del ;
  351|  21.7k|			sg = sign_of_int (del) ;
  352|  21.7k|			del += top + ((sum1 + denhalf) >> denshift) ;
  353|  21.7k|			out [j] = (del << chanshift) >> chanshift ;
  354|       |
  355|  21.7k|			if (sg > 0)
  ------------------
  |  Branch (355:8): [True: 7.93k, False: 13.7k]
  ------------------
  356|  7.93k|			{
  357|   125k|				for (k = (numactive - 1) ; k >= 0 ; k--)
  ------------------
  |  Branch (357:32): [True: 119k, False: 6.44k]
  ------------------
  358|   119k|				{
  359|   119k|					dd = top - pout [-k] ;
  360|   119k|					sgn = sign_of_int (dd) ;
  361|   119k|					coefs [k] -= sgn ;
  362|   119k|					del0 -= (numactive - k) * ((sgn * dd) >> denshift) ;
  363|   119k|					if (del0 <= 0)
  ------------------
  |  Branch (363:10): [True: 1.49k, False: 117k]
  ------------------
  364|  1.49k|						break ;
  365|   119k|				}
  366|  7.93k|			}
  367|  13.7k|			else if (sg < 0)
  ------------------
  |  Branch (367:13): [True: 10.7k, False: 3.03k]
  ------------------
  368|  10.7k|			{
  369|   118k|				for (k = (numactive - 1) ; k >= 0 ; k--)
  ------------------
  |  Branch (369:32): [True: 111k, False: 6.82k]
  ------------------
  370|   111k|				{
  371|   111k|					dd = top - pout [-k] ;
  372|   111k|					sgn = sign_of_int (dd) ;
  373|   111k|					coefs [k] += sgn ;
  374|   111k|					del0 -= (numactive - k) * ((-sgn * dd) >> denshift) ;
  375|   111k|					if (del0 >= 0)
  ------------------
  |  Branch (375:10): [True: 3.91k, False: 107k]
  ------------------
  376|  3.91k|						break ;
  377|   111k|				}
  378|  10.7k|			}
  379|  21.7k|		}
  380|    700|	}
  381|  1.13k|}
dp_dec.c:sign_of_int:
   47|   355k|{
   48|   355k|	int32_t negishift ;
   49|       |
   50|   355k|	negishift = ((uint32_t) - i) >> 31 ;
   51|   355k|	return negishift | (i >> 31) ;
   52|   355k|}

unmix16:
   66|    125|{
   67|    125|	int32_t 	j ;
   68|       |
   69|    125|	if (mixres != 0)
  ------------------
  |  Branch (69:6): [True: 69, False: 56]
  ------------------
   70|     69|	{
   71|       |		/* matrixed stereo */
   72|  4.09k|		for (j = 0 ; j < numSamples ; j++)
  ------------------
  |  Branch (72:16): [True: 4.02k, False: 69]
  ------------------
   73|  4.02k|		{
   74|  4.02k|			int32_t		l, r ;
   75|       |
   76|  4.02k|			l = u [j] + v [j] - ((mixres * v [j]) >> mixbits) ;
   77|  4.02k|			r = l - v [j] ;
   78|       |
   79|  4.02k|			out [0] = arith_shift_left (l, 16) ;
   80|  4.02k|			out [1] = arith_shift_left (r, 16) ;
   81|  4.02k|			out += stride ;
   82|  4.02k|		}
   83|     69|	}
   84|     56|	else
   85|     56|	{
   86|       |		/* Conventional separated stereo. */
   87|  4.53k|		for (j = 0 ; j < numSamples ; j++)
  ------------------
  |  Branch (87:16): [True: 4.47k, False: 56]
  ------------------
   88|  4.47k|		{
   89|  4.47k|			out [0] = arith_shift_left (u [j], 16) ;
   90|  4.47k|			out [1] = arith_shift_left (v [j], 16) ;
   91|  4.47k|			out += stride ;
   92|  4.47k|		}
   93|     56|	}
   94|    125|}
unmix20:
  101|    104|{
  102|    104|	int32_t 	j ;
  103|       |
  104|    104|	if (mixres != 0)
  ------------------
  |  Branch (104:6): [True: 55, False: 49]
  ------------------
  105|     55|	{
  106|       |		/* matrixed stereo */
  107|    824|		for (j = 0 ; j < numSamples ; j++)
  ------------------
  |  Branch (107:16): [True: 769, False: 55]
  ------------------
  108|    769|		{
  109|    769|			int32_t		l, r ;
  110|       |
  111|    769|			l = u [j] + v [j] - ((mixres * v [j]) >> mixbits) ;
  112|    769|			r = l - v [j] ;
  113|       |
  114|    769|			out [0] = arith_shift_left (l, 12) ;
  115|    769|			out [1] = arith_shift_left (r, 12) ;
  116|    769|			out += stride ;
  117|    769|		}
  118|     55|	}
  119|     49|	else
  120|     49|	{
  121|       |		/* Conventional separated stereo. */
  122|  3.23k|		for (j = 0 ; j < numSamples ; j++)
  ------------------
  |  Branch (122:16): [True: 3.18k, False: 49]
  ------------------
  123|  3.18k|		{
  124|  3.18k|			out [0] = arith_shift_left (u [j], 12) ;
  125|  3.18k|			out [1] = arith_shift_left (v [j], 12) ;
  126|  3.18k|			out += stride ;
  127|  3.18k|		}
  128|     49|	}
  129|    104|}
unmix24:
  137|    186|{
  138|    186|	int32_t		shift = bytesShifted * 8 ;
  139|    186|	int32_t		l, r ;
  140|    186|	int32_t 		j, k ;
  141|       |
  142|    186|	if (mixres != 0)
  ------------------
  |  Branch (142:6): [True: 98, False: 88]
  ------------------
  143|     98|	{
  144|       |		/* matrixed stereo */
  145|     98|		if (bytesShifted != 0)
  ------------------
  |  Branch (145:7): [True: 45, False: 53]
  ------------------
  146|     45|		{
  147|    372|			for (j = 0, k = 0 ; j < numSamples ; j++, k += 2)
  ------------------
  |  Branch (147:24): [True: 327, False: 45]
  ------------------
  148|    327|			{
  149|    327|				l = u [j] + v [j] - ((mixres * v [j]) >> mixbits) ;
  150|    327|				r = l - v [j] ;
  151|       |
  152|    327|				l = arith_shift_left (l, shift) | (uint32_t) shiftUV [k + 0] ;
  153|    327|				r = arith_shift_left (r, shift) | (uint32_t) shiftUV [k + 1] ;
  154|       |
  155|    327|				out [0] = arith_shift_left (l, 8) ;
  156|    327|				out [1] = arith_shift_left (r, 8) ;
  157|    327|				out += stride ;
  158|    327|			}
  159|     45|		}
  160|     53|		else
  161|     53|		{
  162|    837|			for (j = 0 ; j < numSamples ; j++)
  ------------------
  |  Branch (162:17): [True: 784, False: 53]
  ------------------
  163|    784|			{
  164|    784|				l = u [j] + v [j] - ((mixres * v [j]) >> mixbits) ;
  165|    784|				r = l - v [j] ;
  166|       |
  167|    784|				out [0] = arith_shift_left (l, 8) ;
  168|    784|				out [1] = arith_shift_left (r, 8) ;
  169|    784|				out += stride ;
  170|    784|			}
  171|     53|		}
  172|     98|	}
  173|     88|	else
  174|     88|	{
  175|       |		/* Conventional separated stereo. */
  176|     88|		if (bytesShifted != 0)
  ------------------
  |  Branch (176:7): [True: 31, False: 57]
  ------------------
  177|     31|		{
  178|    355|			for (j = 0, k = 0 ; j < numSamples ; j++, k += 2)
  ------------------
  |  Branch (178:24): [True: 324, False: 31]
  ------------------
  179|    324|			{
  180|    324|				l = u [j] ;
  181|    324|				r = v [j] ;
  182|       |
  183|    324|				l = arith_shift_left (l, shift) | (uint32_t) shiftUV [k + 0] ;
  184|    324|				r = arith_shift_left (r, shift) | (uint32_t) shiftUV [k + 1] ;
  185|       |
  186|    324|				out [0] = arith_shift_left (l, 8) ;
  187|    324|				out [1] = arith_shift_left (r, 8) ;
  188|    324|				out += stride ;
  189|    324|			}
  190|     31|		}
  191|     57|		else
  192|     57|		{
  193|    828|			for (j = 0 ; j < numSamples ; j++)
  ------------------
  |  Branch (193:17): [True: 771, False: 57]
  ------------------
  194|    771|			{
  195|    771|				out [0] = arith_shift_left (u [j], 8) ;
  196|    771|				out [1] = arith_shift_left (v [j], 8) ;
  197|    771|				out += stride ;
  198|    771|			}
  199|     57|		}
  200|     88|	}
  201|    186|}
unmix32:
  211|    111|{
  212|    111|	int32_t		shift = bytesShifted * 8 ;
  213|    111|	int32_t		l, r ;
  214|    111|	int32_t 	j, k ;
  215|       |
  216|    111|	if (mixres != 0)
  ------------------
  |  Branch (216:6): [True: 33, False: 78]
  ------------------
  217|     33|	{
  218|       |		//Assert (bytesShifted != 0) ;
  219|       |
  220|       |		/* matrixed stereo with shift */
  221|    612|		for (j = 0, k = 0 ; j < numSamples ; j++, k += 2)
  ------------------
  |  Branch (221:23): [True: 579, False: 33]
  ------------------
  222|    579|		{
  223|    579|			int32_t		lt, rt ;
  224|       |
  225|    579|			lt = u [j] ;
  226|    579|			rt = v [j] ;
  227|       |
  228|    579|			l = lt + rt - ((mixres * rt) >> mixbits) ;
  229|    579|			r = l - rt ;
  230|       |
  231|    579|			out [0] = arith_shift_left (l, shift) | (uint32_t) shiftUV [k + 0] ;
  232|    579|			out [1] = arith_shift_left (r, shift) | (uint32_t) shiftUV [k + 1] ;
  233|    579|			out += stride ;
  234|    579|		}
  235|     33|	}
  236|     78|	else
  237|     78|	{
  238|     78|		if (bytesShifted == 0)
  ------------------
  |  Branch (238:7): [True: 49, False: 29]
  ------------------
  239|     49|		{
  240|       |			/* interleaving w/o shift */
  241|  5.76k|			for (j = 0 ; j < numSamples ; j++)
  ------------------
  |  Branch (241:17): [True: 5.72k, False: 49]
  ------------------
  242|  5.72k|			{
  243|  5.72k|				out [0] = u [j] ;
  244|  5.72k|				out [1] = v [j] ;
  245|  5.72k|				out += stride ;
  246|  5.72k|			}
  247|     49|		}
  248|     29|		else
  249|     29|		{
  250|       |			/* interleaving with shift */
  251|    360|			for (j = 0, k = 0 ; j < numSamples ; j++, k += 2)
  ------------------
  |  Branch (251:24): [True: 331, False: 29]
  ------------------
  252|    331|			{
  253|    331|				out [0] = arith_shift_left (u [j], shift) | (uint32_t) shiftUV [k + 0] ;
  254|    331|				out [1] = arith_shift_left (v [j], shift) | (uint32_t) shiftUV [k + 1] ;
  255|    331|				out += stride ;
  256|    331|			}
  257|     29|		}
  258|     78|	}
  259|    111|}
copyPredictorTo24:
  265|  1.09k|{
  266|  1.09k|	int32_t		j ;
  267|       |
  268|   325k|	for (j = 0 ; j < numSamples ; j++)
  ------------------
  |  Branch (268:15): [True: 324k, False: 1.09k]
  ------------------
  269|   324k|	{
  270|   324k|		out [0] = arith_shift_left (in [j], 8) ;
  271|   324k|		out += stride ;
  272|   324k|	}
  273|  1.09k|}
copyPredictorTo24Shift:
  277|     59|{
  278|     59|	int32_t		shiftVal = bytesShifted * 8 ;
  279|     59|	int32_t		j ;
  280|       |
  281|       |	//Assert (bytesShifted != 0) ;
  282|       |
  283|    455|	for (j = 0 ; j < numSamples ; j++)
  ------------------
  |  Branch (283:15): [True: 396, False: 59]
  ------------------
  284|    396|	{
  285|    396|		int32_t		val = in [j] ;
  286|       |
  287|    396|		val = arith_shift_left (val, shiftVal) | (uint32_t) shift [j] ;
  288|    396|		out [0] = arith_shift_left (val, 8) ;
  289|    396|		out += stride ;
  290|    396|	}
  291|     59|}
copyPredictorTo20:
  295|    735|{
  296|    735|	int32_t		j ;
  297|       |
  298|       |	// 32-bit predictor values are right-aligned but 20-bit output values should be left-aligned
  299|       |	// in the 24-bit output buffer
  300|  10.8k|	for (j = 0 ; j < numSamples ; j++)
  ------------------
  |  Branch (300:15): [True: 10.0k, False: 735]
  ------------------
  301|  10.0k|	{
  302|  10.0k|		out [0] = arith_shift_left (in [j], 12) ;
  303|  10.0k|		out += stride ;
  304|  10.0k|	}
  305|    735|}
copyPredictorTo32:
  309|    853|{
  310|    853|	int32_t			i, j ;
  311|       |
  312|       |	// this is only a subroutine to abstract the "iPod can only output 16-bit data" problem
  313|  21.7k|	for (i = 0, j = 0 ; i < numSamples ; i++, j += stride)
  ------------------
  |  Branch (313:22): [True: 20.8k, False: 853]
  ------------------
  314|  20.8k|		out [j] = arith_shift_left (in [i], 8) ;
  315|    853|}
copyPredictorTo32Shift:
  319|     72|{
  320|     72|	int32_t *		op = out ;
  321|     72|	uint32_t		shiftVal = bytesShifted * 8 ;
  322|     72|	int32_t			j ;
  323|       |
  324|       |	//Assert (bytesShifted != 0) ;
  325|       |
  326|       |	// this is only a subroutine to abstract the "iPod can only output 16-bit data" problem
  327|    487|	for (j = 0 ; j < numSamples ; j++)
  ------------------
  |  Branch (327:15): [True: 415, False: 72]
  ------------------
  328|    415|	{
  329|    415|		op [0] = arith_shift_left (in [j], shiftVal) | (uint32_t) shift [j] ;
  330|    415|		op += stride ;
  331|    415|	}
  332|     72|}

alac_decoder.c:arith_shift_left:
   30|   394k|{	return (int32_t) (((uint32_t) x) << shift) ;
   31|   394k|} /* arith_shift_left */
dp_dec.c:arith_shift_left:
   30|  32.2k|{	return (int32_t) (((uint32_t) x) << shift) ;
   31|  32.2k|} /* arith_shift_left */
matrix_dec.c:arith_shift_left:
   30|   389k|{	return (int32_t) (((uint32_t) x) << shift) ;
   31|   389k|} /* arith_shift_left */

g721_decoder:
  129|  90.6k|{
  130|  90.6k|	short		sezi, sei, sez, se ;	/* ACCUM */
  131|  90.6k|	short		y ;			/* MIX */
  132|  90.6k|	short		sr ;			/* ADDB */
  133|  90.6k|	short		dq ;
  134|  90.6k|	short		dqsez ;
  135|       |
  136|  90.6k|	i &= 0x0f ;			/* mask to get proper bits */
  137|  90.6k|	sezi = predictor_zero (state_ptr) ;
  138|  90.6k|	sez = sezi >> 1 ;
  139|  90.6k|	sei = sezi + predictor_pole (state_ptr) ;
  140|  90.6k|	se = sei >> 1 ;			/* se = estimated signal */
  141|       |
  142|  90.6k|	y = step_size (state_ptr) ;	/* dynamic quantizer step size */
  143|       |
  144|  90.6k|	dq = reconstruct (i & 0x08, _dqlntab [i], y) ; /* quantized diff. */
  145|       |
  146|  90.6k|	sr = (dq < 0) ? (se - (dq & 0x3FFF)) : se + dq ;	/* reconst. signal */
  ------------------
  |  Branch (146:7): [True: 40.5k, False: 50.0k]
  ------------------
  147|       |
  148|  90.6k|	dqsez = sr - se + sez ;			/* pole prediction diff. */
  149|       |
  150|  90.6k|	update (4, y, arith_shift_left (_witab [i], 5), _fitab [i], dq, sr, dqsez, state_ptr) ;
  151|       |
  152|       |	/* sr was 14-bit dynamic range */
  153|  90.6k|	return arith_shift_left (sr, 2) ;
  154|  90.6k|}

g723_24_decoder:
  115|  4.56M|{
  116|  4.56M|	short		sezi, sei, sez, se ;	/* ACCUM */
  117|  4.56M|	short		y ;			/* MIX */
  118|  4.56M|	short		sr ;			/* ADDB */
  119|  4.56M|	short		dq ;
  120|  4.56M|	short		dqsez ;
  121|       |
  122|  4.56M|	i &= 0x07 ;			/* mask to get proper bits */
  123|  4.56M|	sezi = predictor_zero (state_ptr) ;
  124|  4.56M|	sez = sezi >> 1 ;
  125|  4.56M|	sei = sezi + predictor_pole (state_ptr) ;
  126|  4.56M|	se = sei >> 1 ;			/* se = estimated signal */
  127|       |
  128|  4.56M|	y = step_size (state_ptr) ;	/* adaptive quantizer step size */
  129|  4.56M|	dq = reconstruct (i & 0x04, _dqlntab [i], y) ; /* unquantize pred diff */
  130|       |
  131|  4.56M|	sr = (dq < 0) ? (se - (dq & 0x3FFF)) : (se + dq) ; /* reconst. signal */
  ------------------
  |  Branch (131:7): [True: 2.02M, False: 2.54M]
  ------------------
  132|       |
  133|  4.56M|	dqsez = sr - se + sez ;			/* pole prediction diff. */
  134|       |
  135|  4.56M|	update (3, y, _witab [i], _fitab [i], dq, sr, dqsez, state_ptr) ;
  136|       |
  137|  4.56M|	return arith_shift_left (sr, 2) ;	/* sr was of 14-bit dynamic range */
  138|  4.56M|}

g723_40_decoder:
  129|  1.00M|{
  130|  1.00M|	short		sezi, sei, sez, se ;	/* ACCUM */
  131|  1.00M|	short		y ;			/* MIX */
  132|  1.00M|	short		sr ;			/* ADDB */
  133|  1.00M|	short		dq ;
  134|  1.00M|	short		dqsez ;
  135|       |
  136|  1.00M|	i &= 0x1f ;			/* mask to get proper bits */
  137|  1.00M|	sezi = predictor_zero (state_ptr) ;
  138|  1.00M|	sez = sezi >> 1 ;
  139|  1.00M|	sei = sezi + predictor_pole (state_ptr) ;
  140|  1.00M|	se = sei >> 1 ;			/* se = estimated signal */
  141|       |
  142|  1.00M|	y = step_size (state_ptr) ;	/* adaptive quantizer step size */
  143|  1.00M|	dq = reconstruct (i & 0x10, _dqlntab [i], y) ;	/* estimation diff. */
  144|       |
  145|  1.00M|	sr = (dq < 0) ? (se - (dq & 0x7FFF)) : (se + dq) ; /* reconst. signal */
  ------------------
  |  Branch (145:7): [True: 381k, False: 622k]
  ------------------
  146|       |
  147|  1.00M|	dqsez = sr - se + sez ;		/* pole prediction diff. */
  148|       |
  149|  1.00M|	update (5, y, _witab [i], _fitab [i], dq, sr, dqsez, state_ptr) ;
  150|       |
  151|  1.00M|	return arith_shift_left (sr, 2) ;	/* sr was of 14-bit dynamic range */
  152|  1.00M|}

private_init_state:
  114|    553|{
  115|    553|	int		cnta ;
  116|       |
  117|    553|	state_ptr->yl = 34816 ;
  118|    553|	state_ptr->yu = 544 ;
  119|    553|	state_ptr->dms = 0 ;
  120|    553|	state_ptr->dml = 0 ;
  121|    553|	state_ptr->ap = 0 ;
  122|  1.65k|	for (cnta = 0 ; cnta < 2 ; cnta++)
  ------------------
  |  Branch (122:18): [True: 1.10k, False: 553]
  ------------------
  123|  1.10k|	{	state_ptr->a [cnta] = 0 ;
  124|  1.10k|		state_ptr->pk [cnta] = 0 ;
  125|  1.10k|		state_ptr->sr [cnta] = 32 ;
  126|  1.10k|		}
  127|  3.87k|	for (cnta = 0 ; cnta < 6 ; cnta++)
  ------------------
  |  Branch (127:18): [True: 3.31k, False: 553]
  ------------------
  128|  3.31k|	{	state_ptr->b [cnta] = 0 ;
  129|  3.31k|		state_ptr->dq [cnta] = 32 ;
  130|  3.31k|		}
  131|    553|	state_ptr->td = 0 ;
  132|    553|}	/* private_init_state */
g72x_reader_init:
  135|    553|{	G72x_STATE *pstate ;
  136|       |
  137|    553|	if ((pstate = g72x_state_new ()) == NULL)
  ------------------
  |  Branch (137:6): [True: 0, False: 553]
  ------------------
  138|      0|		return NULL ;
  139|       |
  140|    553|	private_init_state (pstate) ;
  141|       |
  142|    553|	pstate->encoder = NULL ;
  143|       |
  144|    553|	switch (codec)
  145|    553|	{	case G723_16_BITS_PER_SAMPLE : /* 2 bits per sample. */
  ------------------
  |  Branch (145:4): [True: 0, False: 553]
  ------------------
  146|      0|				pstate->decoder = g723_16_decoder ;
  147|      0|				*blocksize = G723_16_BYTES_PER_BLOCK ;
  148|      0|				*samplesperblock = G723_16_SAMPLES_PER_BLOCK ;
  149|      0|				pstate->codec_bits = 2 ;
  150|      0|				pstate->blocksize = G723_16_BYTES_PER_BLOCK ;
  151|      0|				pstate->samplesperblock = G723_16_SAMPLES_PER_BLOCK ;
  152|      0|				break ;
  153|       |
  154|    381|		case G723_24_BITS_PER_SAMPLE : /* 3 bits per sample. */
  ------------------
  |  Branch (154:3): [True: 381, False: 172]
  ------------------
  155|    381|				pstate->decoder = g723_24_decoder ;
  156|    381|				*blocksize = G723_24_BYTES_PER_BLOCK ;
  157|    381|				*samplesperblock = G723_24_SAMPLES_PER_BLOCK ;
  158|    381|				pstate->codec_bits = 3 ;
  159|    381|				pstate->blocksize = G723_24_BYTES_PER_BLOCK ;
  160|    381|				pstate->samplesperblock = G723_24_SAMPLES_PER_BLOCK ;
  161|    381|				break ;
  162|       |
  163|     94|		case G721_32_BITS_PER_SAMPLE : /* 4 bits per sample. */
  ------------------
  |  Branch (163:3): [True: 94, False: 459]
  ------------------
  164|     94|				pstate->decoder = g721_decoder ;
  165|     94|				*blocksize = G721_32_BYTES_PER_BLOCK ;
  166|     94|				*samplesperblock = G721_32_SAMPLES_PER_BLOCK ;
  167|     94|				pstate->codec_bits = 4 ;
  168|     94|				pstate->blocksize = G721_32_BYTES_PER_BLOCK ;
  169|     94|				pstate->samplesperblock = G721_32_SAMPLES_PER_BLOCK ;
  170|     94|				break ;
  171|       |
  172|     78|		case G721_40_BITS_PER_SAMPLE : /* 5 bits per sample. */
  ------------------
  |  Branch (172:3): [True: 78, False: 475]
  ------------------
  173|     78|				pstate->decoder = g723_40_decoder ;
  174|     78|				*blocksize = G721_40_BYTES_PER_BLOCK ;
  175|     78|				*samplesperblock = G721_40_SAMPLES_PER_BLOCK ;
  176|     78|				pstate->codec_bits = 5 ;
  177|     78|				pstate->blocksize = G721_40_BYTES_PER_BLOCK ;
  178|     78|				pstate->samplesperblock = G721_40_SAMPLES_PER_BLOCK ;
  179|     78|				break ;
  180|       |
  181|      0|		default :
  ------------------
  |  Branch (181:3): [True: 0, False: 553]
  ------------------
  182|      0|				free (pstate) ;
  183|      0|				return NULL ;
  184|    553|		} ;
  185|       |
  186|    553|	return pstate ;
  187|    553|}	/* g72x_reader_init */
g72x_decode_block:
  244|  47.1k|{	int	k, count ;
  245|       |
  246|  47.1k|	count = unpack_bytes (pstate->codec_bits, pstate->blocksize, block, samples) ;
  247|       |
  248|  5.70M|	for (k = 0 ; k < count ; k++)
  ------------------
  |  Branch (248:15): [True: 5.65M, False: 47.1k]
  ------------------
  249|  5.65M|		samples [k] = pstate->decoder (samples [k], pstate) ;
  250|       |
  251|  47.1k|	return 0 ;
  252|  47.1k|}	/* g72x_decode_block */
predictor_zero:
  272|  5.65M|{
  273|  5.65M|	int		i ;
  274|  5.65M|	int		sezi ;
  275|       |
  276|  5.65M|	sezi = fmult (state_ptr->b [0] >> 2, state_ptr->dq [0]) ;
  277|  33.9M|	for (i = 1 ; i < 6 ; i++)			/* ACCUM */
  ------------------
  |  Branch (277:15): [True: 28.2M, False: 5.65M]
  ------------------
  278|  28.2M|		sezi += fmult (state_ptr->b [i] >> 2, state_ptr->dq [i]) ;
  279|  5.65M|	return sezi ;
  280|  5.65M|}
predictor_pole:
  288|  5.65M|{
  289|  5.65M|	return (fmult (state_ptr->a [1] >> 2, state_ptr->sr [1]) +
  290|  5.65M|			fmult (state_ptr->a [0] >> 2, state_ptr->sr [0])) ;
  291|  5.65M|}
step_size:
  299|  5.65M|{
  300|  5.65M|	int		y ;
  301|  5.65M|	int		dif ;
  302|  5.65M|	int		al ;
  303|       |
  304|  5.65M|	if (state_ptr->ap >= 256)
  ------------------
  |  Branch (304:6): [True: 3.01M, False: 2.64M]
  ------------------
  305|  3.01M|		return (state_ptr->yu) ;
  306|  2.64M|	else {
  307|  2.64M|		y = state_ptr->yl >> 6 ;
  308|  2.64M|		dif = state_ptr->yu - y ;
  309|  2.64M|		al = state_ptr->ap >> 2 ;
  310|  2.64M|		if (dif > 0)
  ------------------
  |  Branch (310:7): [True: 872k, False: 1.77M]
  ------------------
  311|   872k|			y += (dif * al) >> 6 ;
  312|  1.77M|		else if (dif < 0)
  ------------------
  |  Branch (312:12): [True: 1.77M, False: 2.63k]
  ------------------
  313|  1.77M|			y += (dif * al + 0x3F) >> 6 ;
  314|  2.64M|		return y ;
  315|  2.64M|	}
  316|  5.65M|}
reconstruct:
  382|  5.65M|{
  383|  5.65M|	short		dql ;	/* Log of 'dq' magnitude */
  384|  5.65M|	short		dex ;	/* Integer part of log */
  385|  5.65M|	short		dqt ;
  386|  5.65M|	short		dq ;	/* Reconstructed difference signal sample */
  387|       |
  388|  5.65M|	dql = dqln + (y >> 2) ;	/* ADDA */
  389|       |
  390|  5.65M|	if (dql < 0)
  ------------------
  |  Branch (390:6): [True: 2.55M, False: 3.10M]
  ------------------
  391|  2.55M|		return ((sign) ? -0x8000 : 0) ;
  ------------------
  |  Branch (391:11): [True: 867k, False: 1.68M]
  ------------------
  392|  3.10M|	else		/* ANTILOG */
  393|  3.10M|	{	dex = (dql >> 7) & 15 ;
  394|  3.10M|		dqt = 128 + (dql & 127) ;
  395|  3.10M|		dq = (dqt << 7) >> (14 - dex) ;
  396|  3.10M|		return ((sign) ? (dq - 0x8000) : dq) ;
  ------------------
  |  Branch (396:11): [True: 1.57M, False: 1.52M]
  ------------------
  397|  3.10M|		}
  398|  5.65M|}
update:
  416|  5.65M|{
  417|  5.65M|	int		cnt ;
  418|  5.65M|	short		mag, expon ;	/* Adaptive predictor, FLOAT A */
  419|  5.65M|	short		a2p = 0 ;	/* LIMC */
  420|  5.65M|	short		a1ul ;		/* UPA1 */
  421|  5.65M|	short		pks1 ;		/* UPA2 */
  422|  5.65M|	short		fa1 ;
  423|  5.65M|	char		tr ;		/* tone/transition detector */
  424|  5.65M|	short		ylint, thr2, dqthr ;
  425|  5.65M|	short		ylfrac, thr1 ;
  426|  5.65M|	short		pk0 ;
  427|       |
  428|  5.65M|	pk0 = (dqsez < 0) ? 1 : 0 ;	/* needed in updating predictor poles */
  ------------------
  |  Branch (428:8): [True: 1.61M, False: 4.04M]
  ------------------
  429|       |
  430|  5.65M|	mag = dq & 0x7FFF ;		/* prediction difference magnitude */
  431|       |	/* TRANS */
  432|  5.65M|	ylint = state_ptr->yl >> 15 ;	/* exponent part of yl */
  433|  5.65M|	ylfrac = (state_ptr->yl >> 10) & 0x1F ;	/* fractional part of yl */
  434|  5.65M|	thr1 = (32 + ylfrac) << ylint ;		/* threshold */
  435|  5.65M|	thr2 = (ylint > 9) ? 31 << 10 : thr1 ;	/* limit thr2 to 31 << 10 */
  ------------------
  |  Branch (435:9): [True: 0, False: 5.65M]
  ------------------
  436|  5.65M|	dqthr = (thr2 + (thr2 >> 1)) >> 1 ;	/* dqthr = 0.75 * thr2 */
  437|  5.65M|	if (state_ptr->td == 0)		/* signal supposed voice */
  ------------------
  |  Branch (437:6): [True: 5.30M, False: 358k]
  ------------------
  438|  5.30M|		tr = 0 ;
  439|   358k|	else if (mag <= dqthr)		/* supposed data, but small mag */
  ------------------
  |  Branch (439:11): [True: 355k, False: 3.19k]
  ------------------
  440|   355k|		tr = 0 ;			/* treated as voice */
  441|  3.19k|	else				/* signal is data (modem) */
  442|  3.19k|		tr = 1 ;
  443|       |
  444|       |	/*
  445|       |	 * Quantizer scale factor adaptation.
  446|       |	 */
  447|       |
  448|       |	/* FUNCTW & FILTD & DELAY */
  449|       |	/* update non-steady state step size multiplier */
  450|  5.65M|	state_ptr->yu = y + ((wi - y) >> 5) ;
  451|       |
  452|       |	/* LIMB */
  453|  5.65M|	if (state_ptr->yu < 544)	/* 544 <= yu <= 5120 */
  ------------------
  |  Branch (453:6): [True: 1.73M, False: 3.91M]
  ------------------
  454|  1.73M|		state_ptr->yu = 544 ;
  455|  3.91M|	else if (state_ptr->yu > 5120)
  ------------------
  |  Branch (455:11): [True: 675k, False: 3.24M]
  ------------------
  456|   675k|		state_ptr->yu = 5120 ;
  457|       |
  458|       |	/* FILTE & DELAY */
  459|       |	/* update steady state step size multiplier */
  460|  5.65M|	state_ptr->yl += state_ptr->yu + ((-state_ptr->yl) >> 6) ;
  461|       |
  462|       |	/*
  463|       |	 * Adaptive predictor coefficients.
  464|       |	 */
  465|  5.65M|	if (tr == 1) {			/* reset a's and b's for modem signal */
  ------------------
  |  Branch (465:6): [True: 3.19k, False: 5.65M]
  ------------------
  466|  3.19k|		state_ptr->a [0] = 0 ;
  467|  3.19k|		state_ptr->a [1] = 0 ;
  468|  3.19k|		state_ptr->b [0] = 0 ;
  469|  3.19k|		state_ptr->b [1] = 0 ;
  470|  3.19k|		state_ptr->b [2] = 0 ;
  471|  3.19k|		state_ptr->b [3] = 0 ;
  472|  3.19k|		state_ptr->b [4] = 0 ;
  473|  3.19k|		state_ptr->b [5] = 0 ;
  474|  3.19k|		}
  475|  5.65M|	else			/* update a's and b's */
  476|  5.65M|	{	pks1 = pk0 ^ state_ptr->pk [0] ;		/* UPA2 */
  477|       |
  478|       |		/* update predictor pole a [1] */
  479|  5.65M|		a2p = state_ptr->a [1] - (state_ptr->a [1] >> 7) ;
  480|  5.65M|		if (dqsez != 0)
  ------------------
  |  Branch (480:7): [True: 3.62M, False: 2.03M]
  ------------------
  481|  3.62M|		{	fa1 = (pks1) ? state_ptr->a [0] : -state_ptr->a [0] ;
  ------------------
  |  Branch (481:11): [True: 1.58M, False: 2.03M]
  ------------------
  482|  3.62M|			if (fa1 < -8191)	/* a2p = function of fa1 */
  ------------------
  |  Branch (482:8): [True: 777k, False: 2.84M]
  ------------------
  483|   777k|				a2p -= 0x100 ;
  484|  2.84M|			else if (fa1 > 8191)
  ------------------
  |  Branch (484:13): [True: 276k, False: 2.56M]
  ------------------
  485|   276k|				a2p += 0xFF ;
  486|  2.56M|			else
  487|  2.56M|				a2p += fa1 >> 5 ;
  488|       |
  489|  3.62M|			if (pk0 ^ state_ptr->pk [1])
  ------------------
  |  Branch (489:8): [True: 1.83M, False: 1.78M]
  ------------------
  490|  1.83M|			{	/* LIMC */
  491|  1.83M|				if (a2p <= -12160)
  ------------------
  |  Branch (491:9): [True: 70.0k, False: 1.76M]
  ------------------
  492|  70.0k|					a2p = -12288 ;
  493|  1.76M|				else if (a2p >= 12416)
  ------------------
  |  Branch (493:14): [True: 0, False: 1.76M]
  ------------------
  494|      0|					a2p = 12288 ;
  495|  1.76M|				else
  496|  1.76M|					a2p -= 0x80 ;
  497|  1.83M|				}
  498|  1.78M|			else if (a2p <= -12416)
  ------------------
  |  Branch (498:13): [True: 161k, False: 1.62M]
  ------------------
  499|   161k|				a2p = -12288 ;
  500|  1.62M|			else if (a2p >= 12160)
  ------------------
  |  Branch (500:13): [True: 219, False: 1.62M]
  ------------------
  501|    219|				a2p = 12288 ;
  502|  1.62M|			else
  503|  1.62M|				a2p += 0x80 ;
  504|  3.62M|		}
  505|       |
  506|       |		/* TRIGB & DELAY */
  507|  5.65M|		state_ptr->a [1] = a2p ;
  508|       |
  509|       |		/* UPA1 */
  510|       |		/* update predictor pole a [0] */
  511|  5.65M|		state_ptr->a [0] -= state_ptr->a [0] >> 8 ;
  512|  5.65M|		if (dqsez != 0)
  ------------------
  |  Branch (512:7): [True: 3.62M, False: 2.03M]
  ------------------
  513|  3.62M|		{	if (pks1 == 0)
  ------------------
  |  Branch (513:9): [True: 2.03M, False: 1.58M]
  ------------------
  514|  2.03M|				state_ptr->a [0] += 192 ;
  515|  1.58M|			else
  516|  1.58M|				state_ptr->a [0] -= 192 ;
  517|  3.62M|			} ;
  518|       |
  519|       |		/* LIMD */
  520|  5.65M|		a1ul = 15360 - a2p ;
  521|  5.65M|		if (state_ptr->a [0] < -a1ul)
  ------------------
  |  Branch (521:7): [True: 61.6k, False: 5.59M]
  ------------------
  522|  61.6k|			state_ptr->a [0] = -a1ul ;
  523|  5.59M|		else if (state_ptr->a [0] > a1ul)
  ------------------
  |  Branch (523:12): [True: 1.93k, False: 5.59M]
  ------------------
  524|  1.93k|			state_ptr->a [0] = a1ul ;
  525|       |
  526|       |		/* UPB : update predictor zeros b [6] */
  527|  39.5M|		for (cnt = 0 ; cnt < 6 ; cnt++)
  ------------------
  |  Branch (527:18): [True: 33.9M, False: 5.65M]
  ------------------
  528|  33.9M|		{	if (code_size == 5)		/* for 40Kbps G.723 */
  ------------------
  |  Branch (528:9): [True: 6.01M, False: 27.9M]
  ------------------
  529|  6.01M|				state_ptr->b [cnt] -= state_ptr->b [cnt] >> 9 ;
  530|  27.9M|			else			/* for G.721 and 24Kbps G.723 */
  531|  27.9M|				state_ptr->b [cnt] -= state_ptr->b [cnt] >> 8 ;
  532|  33.9M|			if (dq & 0x7FFF)			/* XOR */
  ------------------
  |  Branch (532:8): [True: 18.6M, False: 15.3M]
  ------------------
  533|  18.6M|			{	if ((dq ^ state_ptr->dq [cnt]) >= 0)
  ------------------
  |  Branch (533:10): [True: 8.52M, False: 10.0M]
  ------------------
  534|  8.52M|					state_ptr->b [cnt] += 128 ;
  535|  10.0M|				else
  536|  10.0M|					state_ptr->b [cnt] -= 128 ;
  537|  18.6M|				}
  538|  33.9M|			}
  539|  5.65M|		}
  540|       |
  541|  33.9M|	for (cnt = 5 ; cnt > 0 ; cnt--)
  ------------------
  |  Branch (541:17): [True: 28.2M, False: 5.65M]
  ------------------
  542|  28.2M|		state_ptr->dq [cnt] = state_ptr->dq [cnt - 1] ;
  543|       |	/* FLOAT A : convert dq [0] to 4-bit exp, 6-bit mantissa f.p. */
  544|  5.65M|	if (mag == 0)
  ------------------
  |  Branch (544:6): [True: 2.55M, False: 3.10M]
  ------------------
  545|  2.55M|		state_ptr->dq [0] = (dq >= 0) ? 0x20 : 0xFC20 ;
  ------------------
  |  Branch (545:23): [True: 1.68M, False: 867k]
  ------------------
  546|  3.10M|	else
  547|  3.10M|	{	expon = quan (mag, power2, 15) ;
  548|  3.10M|		state_ptr->dq [0] = (dq >= 0) ?
  ------------------
  |  Branch (548:23): [True: 1.52M, False: 1.57M]
  ------------------
  549|  1.52M|			(expon << 6) + ((mag << 6) >> expon) :
  550|  3.10M|			(expon << 6) + ((mag << 6) >> expon) - 0x400 ;
  551|  3.10M|		}
  552|       |
  553|  5.65M|	state_ptr->sr [1] = state_ptr->sr [0] ;
  554|       |	/* FLOAT B : convert sr to 4-bit exp., 6-bit mantissa f.p. */
  555|  5.65M|	if (sr == 0)
  ------------------
  |  Branch (555:6): [True: 1.90M, False: 3.75M]
  ------------------
  556|  1.90M|		state_ptr->sr [0] = 0x20 ;
  557|  3.75M|	else if (sr > 0)
  ------------------
  |  Branch (557:11): [True: 2.04M, False: 1.71M]
  ------------------
  558|  2.04M|	{	expon = quan (sr, power2, 15) ;
  559|  2.04M|		state_ptr->sr [0] = (expon << 6) + ((sr << 6) >> expon) ;
  560|  2.04M|		}
  561|  1.71M|	else if (sr > -32768)
  ------------------
  |  Branch (561:11): [True: 1.71M, False: 197]
  ------------------
  562|  1.71M|	{	mag = -sr ;
  563|  1.71M|		expon = quan (mag, power2, 15) ;
  564|  1.71M|		state_ptr->sr [0] = (expon << 6) + ((mag << 6) >> expon) - 0x400 ;
  565|  1.71M|		}
  566|    197|	else
  567|    197|		state_ptr->sr [0] = (short) 0xFC20 ;
  568|       |
  569|       |	/* DELAY A */
  570|  5.65M|	state_ptr->pk [1] = state_ptr->pk [0] ;
  571|  5.65M|	state_ptr->pk [0] = pk0 ;
  572|       |
  573|       |	/* TONE */
  574|  5.65M|	if (tr == 1)		/* this sample has been treated as data */
  ------------------
  |  Branch (574:6): [True: 3.19k, False: 5.65M]
  ------------------
  575|  3.19k|		state_ptr->td = 0 ;	/* next one will be treated as voice */
  576|  5.65M|	else if (a2p < -11776)	/* small sample-to-sample correlation */
  ------------------
  |  Branch (576:11): [True: 359k, False: 5.29M]
  ------------------
  577|   359k|		state_ptr->td = 1 ;	/* signal may be data */
  578|  5.29M|	else				/* signal is voice */
  579|  5.29M|		state_ptr->td = 0 ;
  580|       |
  581|       |	/*
  582|       |	 * Adaptation speed control.
  583|       |	 */
  584|  5.65M|	state_ptr->dms += (fi - state_ptr->dms) >> 5 ;		/* FILTA */
  585|  5.65M|	state_ptr->dml += (((fi << 2) - state_ptr->dml) >> 7) ;	/* FILTB */
  586|       |
  587|  5.65M|	if (tr == 1)
  ------------------
  |  Branch (587:6): [True: 3.19k, False: 5.65M]
  ------------------
  588|  3.19k|		state_ptr->ap = 256 ;
  589|  5.65M|	else if (y < 1536)					/* SUBTC */
  ------------------
  |  Branch (589:11): [True: 1.98M, False: 3.66M]
  ------------------
  590|  1.98M|		state_ptr->ap += (0x200 - state_ptr->ap) >> 4 ;
  591|  3.66M|	else if (state_ptr->td == 1)
  ------------------
  |  Branch (591:11): [True: 305k, False: 3.36M]
  ------------------
  592|   305k|		state_ptr->ap += (0x200 - state_ptr->ap) >> 4 ;
  593|  3.36M|	else if (abs ((state_ptr->dms << 2) - state_ptr->dml) >= (state_ptr->dml >> 3))
  ------------------
  |  Branch (593:11): [True: 737k, False: 2.62M]
  ------------------
  594|   737k|		state_ptr->ap += (0x200 - state_ptr->ap) >> 4 ;
  595|  2.62M|	else
  596|  2.62M|		state_ptr->ap += (-state_ptr->ap) >> 4 ;
  597|       |
  598|  5.65M|	return ;
  599|  5.65M|} /* update */
g72x.c:g72x_state_new:
  103|    553|{	return calloc (1, sizeof (G72x_STATE)) ;
  104|    553|}
g72x.c:fmult:
   77|  45.2M|{
   78|  45.2M|	short		anmag, anexp, anmant ;
   79|  45.2M|	short		wanexp, wanmant ;
   80|  45.2M|	short		retval ;
   81|       |
   82|  45.2M|	anmag = (an > 0) ? an : ((-an) & 0x1FFF) ;
  ------------------
  |  Branch (82:10): [True: 24.5M, False: 20.7M]
  ------------------
   83|  45.2M|	anexp = quan (anmag, power2, 15) - 6 ;
   84|  45.2M|	anmant = (anmag == 0) ? 32 :
  ------------------
  |  Branch (84:11): [True: 4.74M, False: 40.5M]
  ------------------
   85|  45.2M|				(anexp >= 0) ? anmag >> anexp : anmag << -anexp ;
  ------------------
  |  Branch (85:5): [True: 36.0M, False: 4.46M]
  ------------------
   86|  45.2M|	wanexp = anexp + ((srn >> 6) & 0xF) - 13 ;
   87|       |
   88|       |	/*
   89|       |	** The original was :
   90|       |	**		wanmant = (anmant * (srn & 0x3F) + 0x30) >> 4 ;
   91|       |	** but could see no valid reason for the + 0x30.
   92|       |	** Removed it and it improved the SNR of the codec.
   93|       |	*/
   94|       |
   95|  45.2M|	wanmant = (anmant * (srn & 0x3F)) >> 4 ;
   96|       |
   97|  45.2M|	retval = (wanexp >= 0) ? ((wanmant << wanexp) & 0x7FFF) : (wanmant >> -wanexp) ;
  ------------------
  |  Branch (97:11): [True: 19.1M, False: 26.1M]
  ------------------
   98|       |
   99|  45.2M|	return (((an ^ srn) < 0) ? -retval : retval) ;
  ------------------
  |  Branch (99:10): [True: 18.1M, False: 27.1M]
  ------------------
  100|  45.2M|}
g72x.c:quan:
   60|  52.1M|{
   61|  52.1M|	int		i ;
   62|       |
   63|   472M|	for (i = 0 ; i < size ; i++)
  ------------------
  |  Branch (63:15): [True: 472M, False: 654k]
  ------------------
   64|   472M|		if (val < *table++)
  ------------------
  |  Branch (64:7): [True: 51.4M, False: 420M]
  ------------------
   65|  51.4M|			break ;
   66|  52.1M|	return i ;
   67|  52.1M|}
g72x.c:unpack_bytes:
  606|  47.1k|{	unsigned int	in_buffer = 0 ;
  607|  47.1k|	unsigned char	in_byte ;
  608|  47.1k|	int				k, in_bits = 0, bindex = 0 ;
  609|       |
  610|  5.70M|	for (k = 0 ; bindex <= blocksize && k < G72x_BLOCK_SIZE ; k++)
  ------------------
  |  |   32|  5.70M|#define	G72x_BLOCK_SIZE		(3 * 5 * 8)
  ------------------
  |  Branch (610:15): [True: 5.70M, False: 0]
  |  Branch (610:38): [True: 5.65M, False: 47.1k]
  ------------------
  611|  5.65M|	{	if (in_bits < bits)
  ------------------
  |  Branch (611:8): [True: 2.38M, False: 3.27M]
  ------------------
  612|  2.38M|		{	in_byte = block [bindex++] ;
  613|       |
  614|  2.38M|			in_buffer |= (in_byte << in_bits) ;
  615|  2.38M|			in_bits += 8 ;
  616|  2.38M|			}
  617|  5.65M|		samples [k] = in_buffer & ((1 << bits) - 1) ;
  618|  5.65M|		in_buffer >>= bits ;
  619|  5.65M|		in_bits -= bits ;
  620|  5.65M|		} ;
  621|       |
  622|  47.1k|	return k ;
  623|  47.1k|} /* unpack_bytes */

g721.c:arith_shift_left:
  119|   181k|{	return (int) (((unsigned int) x) << shift) ;
  120|   181k|} /* arith_shift_left */
g723_24.c:arith_shift_left:
  119|  4.56M|{	return (int) (((unsigned int) x) << shift) ;
  120|  4.56M|} /* arith_shift_left */
g723_40.c:arith_shift_left:
  119|  1.00M|{	return (int) (((unsigned int) x) << shift) ;
  120|  1.00M|} /* arith_shift_left */

gsm_sub:
   26|  77.0k|{
   27|  77.0k|	int32_t diff = (int32_t) a - (int32_t) b ;
   28|  77.0k|	return saturate (diff) ;
  ------------------
  |  |   17|  77.0k|	((x) < MIN_WORD ? MIN_WORD : (x) > MAX_WORD ? MAX_WORD: (x))
  |  |  ------------------
  |  |  |  |   51|  77.0k|#define	MIN_WORD	(-32767 - 1)
  |  |  ------------------
  |  |               	((x) < MIN_WORD ? MIN_WORD : (x) > MAX_WORD ? MAX_WORD: (x))
  |  |  ------------------
  |  |  |  |   51|      0|#define	MIN_WORD	(-32767 - 1)
  |  |  ------------------
  |  |               	((x) < MIN_WORD ? MIN_WORD : (x) > MAX_WORD ? MAX_WORD: (x))
  |  |  ------------------
  |  |  |  |   52|  77.0k|#define	MAX_WORD	32767
  |  |  ------------------
  |  |               	((x) < MIN_WORD ? MIN_WORD : (x) > MAX_WORD ? MAX_WORD: (x))
  |  |  ------------------
  |  |  |  |   52|      0|#define	MAX_WORD	32767
  |  |  ------------------
  |  |  |  Branch (17:3): [True: 0, False: 77.0k]
  |  |  |  Branch (17:31): [True: 0, False: 77.0k]
  |  |  ------------------
  ------------------
   29|  77.0k|}
gsm_asr:
  163|   511k|{
  164|   511k|	if (n >= 16) return - (a < 0) ;
  ------------------
  |  Branch (164:6): [True: 0, False: 511k]
  ------------------
  165|   511k|	if (n <= -16) return 0 ;
  ------------------
  |  Branch (165:6): [True: 0, False: 511k]
  ------------------
  166|   511k|	if (n < 0) return a << -n ;
  ------------------
  |  Branch (166:6): [True: 0, False: 511k]
  ------------------
  167|       |
  168|   511k|	return SASR_W (a, (int16_t) n) ;
  169|   511k|}
gsm_asl:
  172|  38.5k|{
  173|  38.5k|	if (n >= 16) return 0 ;
  ------------------
  |  Branch (173:6): [True: 0, False: 38.5k]
  ------------------
  174|  38.5k|	if (n <= -16) return - (a < 0) ;
  ------------------
  |  Branch (174:6): [True: 0, False: 38.5k]
  ------------------
  175|  38.5k|	if (n < 0) return gsm_asr (a, -n) ;
  ------------------
  |  Branch (175:6): [True: 10.3k, False: 28.1k]
  ------------------
  176|  28.1k|	return a << n ;
  177|  38.5k|}

Gsm_Decoder:
   43|  9.63k|{
   44|  9.63k|	int		j, k ;
   45|  9.63k|	int16_t		erp [40], wt [160] ;
   46|  9.63k|	int16_t		*drp = S->dp0 + 120 ;
   47|       |
   48|  48.1k|	for (j = 0 ; j <= 3 ; j++, xmaxcr++, bcr++, Ncr++, Mcr++, xMcr += 13)
  ------------------
  |  Branch (48:15): [True: 38.5k, False: 9.63k]
  ------------------
   49|  38.5k|	{	Gsm_RPE_Decoding (/*-S,-*/ *xmaxcr, *Mcr, xMcr, erp) ;
   50|  38.5k|		Gsm_Long_Term_Synthesis_Filtering (S, *Ncr, *bcr, erp, drp) ;
   51|       |
   52|  1.57M|		for (k = 0 ; k <= 39 ; k++) wt [j * 40 + k] = drp [k] ;
  ------------------
  |  Branch (52:16): [True: 1.54M, False: 38.5k]
  ------------------
   53|  38.5k|		}
   54|       |
   55|  9.63k|	Gsm_Short_Term_Synthesis_Filter (S, LARcr, wt, s) ;
   56|  9.63k|	Postprocessing (S, s) ;
   57|  9.63k|}
decode.c:Postprocessing:
   18|  9.63k|{
   19|  9.63k|	register int		k ;
   20|  9.63k|	register int16_t		msr = S->msr ;
   21|  9.63k|	register int16_t		tmp ;
   22|       |
   23|  1.55M|	for (k = 160 ; k-- ; s++)
  ------------------
  |  Branch (23:17): [True: 1.54M, False: 9.63k]
  ------------------
   24|  1.54M|	{	tmp = GSM_MULT_R (msr, 28180) ;
   25|  1.54M|		msr = GSM_ADD (*s, tmp) ;			/* Deemphasis 	     */
   26|  1.54M|		*s = GSM_ADD (msr, msr) & 0xFFF8 ;	/* Truncation & Upscaling */
   27|  1.54M|		}
   28|  9.63k|	S->msr = msr ;
   29|  9.63k|}

decode.c:GSM_MULT_R:
  118|  1.54M|{	return (((int32_t) (a)) * ((int32_t) (b)) + 16384) >> 15 ;
  119|  1.54M|} /* GSM_MULT_R */
decode.c:GSM_ADD:
  150|  3.08M|{	int32_t ltmp ;
  151|       |
  152|  3.08M|	ltmp = ((int32_t) a) + ((int32_t) b) ;
  153|       |
  154|  3.08M|	if (ltmp >= MAX_WORD)
  ------------------
  |  |   52|  3.08M|#define	MAX_WORD	32767
  ------------------
  |  Branch (154:6): [True: 403k, False: 2.67M]
  ------------------
  155|   403k|		return MAX_WORD ;
  ------------------
  |  |   52|   403k|#define	MAX_WORD	32767
  ------------------
  156|  2.67M|	if (ltmp <= MIN_WORD)
  ------------------
  |  |   51|  2.67M|#define	MIN_WORD	(-32767 - 1)
  ------------------
  |  Branch (156:6): [True: 842k, False: 1.83M]
  ------------------
  157|   842k|		return MIN_WORD ;
  ------------------
  |  |   51|   842k|#define	MIN_WORD	(-32767 - 1)
  ------------------
  158|       |
  159|  1.83M|	return ltmp ;
  160|  2.67M|} /* GSM_ADD */
long_term.c:GSM_MULT_R:
  118|  1.54M|{	return (((int32_t) (a)) * ((int32_t) (b)) + 16384) >> 15 ;
  119|  1.54M|} /* GSM_MULT_R */
long_term.c:GSM_ADD:
  150|  1.54M|{	int32_t ltmp ;
  151|       |
  152|  1.54M|	ltmp = ((int32_t) a) + ((int32_t) b) ;
  153|       |
  154|  1.54M|	if (ltmp >= MAX_WORD)
  ------------------
  |  |   52|  1.54M|#define	MAX_WORD	32767
  ------------------
  |  Branch (154:6): [True: 73.7k, False: 1.46M]
  ------------------
  155|  73.7k|		return MAX_WORD ;
  ------------------
  |  |   52|  73.7k|#define	MAX_WORD	32767
  ------------------
  156|  1.46M|	if (ltmp <= MIN_WORD)
  ------------------
  |  |   51|  1.46M|#define	MIN_WORD	(-32767 - 1)
  ------------------
  |  Branch (156:6): [True: 2.55k, False: 1.46M]
  ------------------
  157|  2.55k|		return MIN_WORD ;
  ------------------
  |  |   51|  2.55k|#define	MIN_WORD	(-32767 - 1)
  ------------------
  158|       |
  159|  1.46M|	return ltmp ;
  160|  1.46M|} /* GSM_ADD */
rpe.c:SASR_W:
   60|  20.8k|{	if (x >= 0)
  ------------------
  |  Branch (60:7): [True: 20.8k, False: 0]
  ------------------
   61|  20.8k|		return x >> by ;
   62|      0|	return ~ ((~x) >> by) ;
   63|  20.8k|} /* SASR_W */
rpe.c:arith_shift_left:
  306|   500k|{	return (int32_t) (((uint32_t) x) << shift) ;
  307|   500k|} /* arith_shift_left */
rpe.c:GSM_MULT_R:
  118|   500k|{	return (((int32_t) (a)) * ((int32_t) (b)) + 16384) >> 15 ;
  119|   500k|} /* GSM_MULT_R */
rpe.c:GSM_ADD:
  150|   500k|{	int32_t ltmp ;
  151|       |
  152|   500k|	ltmp = ((int32_t) a) + ((int32_t) b) ;
  153|       |
  154|   500k|	if (ltmp >= MAX_WORD)
  ------------------
  |  |   52|   500k|#define	MAX_WORD	32767
  ------------------
  |  Branch (154:6): [True: 0, False: 500k]
  ------------------
  155|      0|		return MAX_WORD ;
  ------------------
  |  |   52|      0|#define	MAX_WORD	32767
  ------------------
  156|   500k|	if (ltmp <= MIN_WORD)
  ------------------
  |  |   51|   500k|#define	MIN_WORD	(-32767 - 1)
  ------------------
  |  Branch (156:6): [True: 0, False: 500k]
  ------------------
  157|      0|		return MIN_WORD ;
  ------------------
  |  |   51|      0|#define	MIN_WORD	(-32767 - 1)
  ------------------
  158|       |
  159|   500k|	return ltmp ;
  160|   500k|} /* GSM_ADD */
short_term.c:arith_shift_left:
  306|  77.0k|{	return (int32_t) (((uint32_t) x) << shift) ;
  307|  77.0k|} /* arith_shift_left */
short_term.c:GSM_ADD:
  150|  12.8M|{	int32_t ltmp ;
  151|       |
  152|  12.8M|	ltmp = ((int32_t) a) + ((int32_t) b) ;
  153|       |
  154|  12.8M|	if (ltmp >= MAX_WORD)
  ------------------
  |  |   52|  12.8M|#define	MAX_WORD	32767
  ------------------
  |  Branch (154:6): [True: 163k, False: 12.7M]
  ------------------
  155|   163k|		return MAX_WORD ;
  ------------------
  |  |   52|   163k|#define	MAX_WORD	32767
  ------------------
  156|  12.7M|	if (ltmp <= MIN_WORD)
  ------------------
  |  |   51|  12.7M|#define	MIN_WORD	(-32767 - 1)
  ------------------
  |  Branch (156:6): [True: 17.2k, False: 12.7M]
  ------------------
  157|  17.2k|		return MIN_WORD ;
  ------------------
  |  |   51|  17.2k|#define	MIN_WORD	(-32767 - 1)
  ------------------
  158|       |
  159|  12.7M|	return ltmp ;
  160|  12.7M|} /* GSM_ADD */
short_term.c:GSM_SUB:
  164|  12.4M|{	int32_t ltmp ;
  165|       |
  166|  12.4M|	ltmp = ((int32_t) a) - ((int32_t) b) ;
  167|       |
  168|  12.4M|	if (ltmp >= MAX_WORD)
  ------------------
  |  |   52|  12.4M|#define	MAX_WORD	32767
  ------------------
  |  Branch (168:6): [True: 303k, False: 12.1M]
  ------------------
  169|   303k|		ltmp = MAX_WORD ;
  ------------------
  |  |   52|   303k|#define	MAX_WORD	32767
  ------------------
  170|  12.1M|	else if (ltmp <= MIN_WORD)
  ------------------
  |  |   51|  12.1M|#define	MIN_WORD	(-32767 - 1)
  ------------------
  |  Branch (170:11): [True: 200k, False: 11.9M]
  ------------------
  171|   200k|		ltmp = MIN_WORD ;
  ------------------
  |  |   51|   200k|#define	MIN_WORD	(-32767 - 1)
  ------------------
  172|       |
  173|  12.4M|	return ltmp ;
  174|  12.4M|} /* GSM_SUB */
short_term.c:GSM_MULT_R:
  118|  77.0k|{	return (((int32_t) (a)) * ((int32_t) (b)) + 16384) >> 15 ;
  119|  77.0k|} /* GSM_MULT_R */
short_term.c:SASR_W:
   60|   616k|{	if (x >= 0)
  ------------------
  |  Branch (60:7): [True: 285k, False: 330k]
  ------------------
   61|   285k|		return x >> by ;
   62|   330k|	return ~ ((~x) >> by) ;
   63|   616k|} /* SASR_W */
add.c:SASR_W:
   60|   511k|{	if (x >= 0)
  ------------------
  |  Branch (60:7): [True: 226k, False: 284k]
  ------------------
   61|   226k|		return x >> by ;
   62|   284k|	return ~ ((~x) >> by) ;
   63|   511k|} /* SASR_W */

gsm_create:
   19|    518|{
   20|    518|	gsm r ;
   21|       |
   22|    518|	r = malloc (sizeof (struct gsm_state)) ;
   23|    518|	if (!r) return r ;
  ------------------
  |  Branch (23:6): [True: 0, False: 518]
  ------------------
   24|       |
   25|    518|	memset ((char *) r, 0, sizeof (struct gsm_state)) ;
   26|    518|	r->nrp = 40 ;
   27|       |
   28|    518|	return r ;
   29|    518|}

gsm_decode:
   12|  28.3k|{
   13|  28.3k|	int16_t LARc [8], Nc [4], Mc [4], bc [4], xmaxc [4], xmc [13 * 4] ;
   14|       |
   15|  28.3k|#ifdef WAV49
   16|  28.3k|	if (s->wav_fmt)
  ------------------
  |  Branch (16:6): [True: 7.67k, False: 20.7k]
  ------------------
   17|  7.67k|	{	uint16_t sr = 0 ;
   18|       |
   19|  7.67k|		s->frame_index = !s->frame_index ;
   20|  7.67k|		if (s->frame_index)
  ------------------
  |  Branch (20:7): [True: 3.83k, False: 3.83k]
  ------------------
   21|  3.83k|		{	sr = *c++ ;
   22|  3.83k|			LARc [0] = sr & 0x3f ; sr >>= 6 ;
   23|  3.83k|			sr |= (uint16_t) *c++ << 2 ;
   24|  3.83k|			LARc [1] = sr & 0x3f ; sr >>= 6 ;
   25|  3.83k|			sr |= (uint16_t) *c++ << 4 ;
   26|  3.83k|			LARc [2] = sr & 0x1f ; sr >>= 5 ;
   27|  3.83k|			LARc [3] = sr & 0x1f ; sr >>= 5 ;
   28|  3.83k|			sr |= (uint16_t) *c++ << 2 ;
   29|  3.83k|			LARc [4] = sr & 0xf ; sr >>= 4 ;
   30|  3.83k|			LARc [5] = sr & 0xf ; sr >>= 4 ;
   31|  3.83k|			sr |= (uint16_t) *c++ << 2 ;			/* 5 */
   32|  3.83k|			LARc [6] = sr & 0x7 ; sr >>= 3 ;
   33|  3.83k|			LARc [7] = sr & 0x7 ; sr >>= 3 ;
   34|  3.83k|			sr |= (uint16_t) *c++ << 4 ;
   35|  3.83k|			Nc [0] = sr & 0x7f ; sr >>= 7 ;
   36|  3.83k|			bc [0] = sr & 0x3 ; sr >>= 2 ;
   37|  3.83k|			Mc [0] = sr & 0x3 ; sr >>= 2 ;
   38|  3.83k|			sr |= (uint16_t) *c++ << 1 ;
   39|  3.83k|			xmaxc [0] = sr & 0x3f ; sr >>= 6 ;
   40|  3.83k|			xmc [0] = sr & 0x7 ; sr >>= 3 ;
   41|  3.83k|			sr = *c++ ;
   42|  3.83k|			xmc [1] = sr & 0x7 ; sr >>= 3 ;
   43|  3.83k|			xmc [2] = sr & 0x7 ; sr >>= 3 ;
   44|  3.83k|			sr |= (uint16_t) *c++ << 2 ;
   45|  3.83k|			xmc [3] = sr & 0x7 ; sr >>= 3 ;
   46|  3.83k|			xmc [4] = sr & 0x7 ; sr >>= 3 ;
   47|  3.83k|			xmc [5] = sr & 0x7 ; sr >>= 3 ;
   48|  3.83k|			sr |= (uint16_t) *c++ << 1 ;			/* 10 */
   49|  3.83k|			xmc [6] = sr & 0x7 ; sr >>= 3 ;
   50|  3.83k|			xmc [7] = sr & 0x7 ; sr >>= 3 ;
   51|  3.83k|			xmc [8] = sr & 0x7 ; sr >>= 3 ;
   52|  3.83k|			sr = *c++ ;
   53|  3.83k|			xmc [9] = sr & 0x7 ; sr >>= 3 ;
   54|  3.83k|			xmc [10] = sr & 0x7 ; sr >>= 3 ;
   55|  3.83k|			sr |= (uint16_t) *c++ << 2 ;
   56|  3.83k|			xmc [11] = sr & 0x7 ; sr >>= 3 ;
   57|  3.83k|			xmc [12] = sr & 0x7 ; sr >>= 3 ;
   58|  3.83k|			sr |= (uint16_t) *c++ << 4 ;
   59|  3.83k|			Nc [1] = sr & 0x7f ; sr >>= 7 ;
   60|  3.83k|			bc [1] = sr & 0x3 ; sr >>= 2 ;
   61|  3.83k|			Mc [1] = sr & 0x3 ; sr >>= 2 ;
   62|  3.83k|			sr |= (uint16_t) *c++ << 1 ;
   63|  3.83k|			xmaxc [1] = sr & 0x3f ; sr >>= 6 ;
   64|  3.83k|			xmc [13] = sr & 0x7 ; sr >>= 3 ;
   65|  3.83k|			sr = *c++ ;				/* 15 */
   66|  3.83k|			xmc [14] = sr & 0x7 ; sr >>= 3 ;
   67|  3.83k|			xmc [15] = sr & 0x7 ; sr >>= 3 ;
   68|  3.83k|			sr |= (uint16_t) *c++ << 2 ;
   69|  3.83k|			xmc [16] = sr & 0x7 ; sr >>= 3 ;
   70|  3.83k|			xmc [17] = sr & 0x7 ; sr >>= 3 ;
   71|  3.83k|			xmc [18] = sr & 0x7 ; sr >>= 3 ;
   72|  3.83k|			sr |= (uint16_t) *c++ << 1 ;
   73|  3.83k|			xmc [19] = sr & 0x7 ; sr >>= 3 ;
   74|  3.83k|			xmc [20] = sr & 0x7 ; sr >>= 3 ;
   75|  3.83k|			xmc [21] = sr & 0x7 ; sr >>= 3 ;
   76|  3.83k|			sr = *c++ ;
   77|  3.83k|			xmc [22] = sr & 0x7 ; sr >>= 3 ;
   78|  3.83k|			xmc [23] = sr & 0x7 ; sr >>= 3 ;
   79|  3.83k|			sr |= (uint16_t) *c++ << 2 ;
   80|  3.83k|			xmc [24] = sr & 0x7 ; sr >>= 3 ;
   81|  3.83k|			xmc [25] = sr & 0x7 ; sr >>= 3 ;
   82|  3.83k|			sr |= (uint16_t) *c++ << 4 ;			/* 20 */
   83|  3.83k|			Nc [2] = sr & 0x7f ; sr >>= 7 ;
   84|  3.83k|			bc [2] = sr & 0x3 ; sr >>= 2 ;
   85|  3.83k|			Mc [2] = sr & 0x3 ; sr >>= 2 ;
   86|  3.83k|			sr |= (uint16_t) *c++ << 1 ;
   87|  3.83k|			xmaxc [2] = sr & 0x3f ; sr >>= 6 ;
   88|  3.83k|			xmc [26] = sr & 0x7 ; sr >>= 3 ;
   89|  3.83k|			sr = *c++ ;
   90|  3.83k|			xmc [27] = sr & 0x7 ; sr >>= 3 ;
   91|  3.83k|			xmc [28] = sr & 0x7 ; sr >>= 3 ;
   92|  3.83k|			sr |= (uint16_t) *c++ << 2 ;
   93|  3.83k|			xmc [29] = sr & 0x7 ; sr >>= 3 ;
   94|  3.83k|			xmc [30] = sr & 0x7 ; sr >>= 3 ;
   95|  3.83k|			xmc [31] = sr & 0x7 ; sr >>= 3 ;
   96|  3.83k|			sr |= (uint16_t) *c++ << 1 ;
   97|  3.83k|			xmc [32] = sr & 0x7 ; sr >>= 3 ;
   98|  3.83k|			xmc [33] = sr & 0x7 ; sr >>= 3 ;
   99|  3.83k|			xmc [34] = sr & 0x7 ; sr >>= 3 ;
  100|  3.83k|			sr = *c++ ;				/* 25 */
  101|  3.83k|			xmc [35] = sr & 0x7 ; sr >>= 3 ;
  102|  3.83k|			xmc [36] = sr & 0x7 ; sr >>= 3 ;
  103|  3.83k|			sr |= (uint16_t) *c++ << 2 ;
  104|  3.83k|			xmc [37] = sr & 0x7 ; sr >>= 3 ;
  105|  3.83k|			xmc [38] = sr & 0x7 ; sr >>= 3 ;
  106|  3.83k|			sr |= (uint16_t) *c++ << 4 ;
  107|  3.83k|			Nc [3] = sr & 0x7f ; sr >>= 7 ;
  108|  3.83k|			bc [3] = sr & 0x3 ; sr >>= 2 ;
  109|  3.83k|			Mc [3] = sr & 0x3 ; sr >>= 2 ;
  110|  3.83k|			sr |= (uint16_t) *c++ << 1 ;
  111|  3.83k|			xmaxc [3] = sr & 0x3f ; sr >>= 6 ;
  112|  3.83k|			xmc [39] = sr & 0x7 ; sr >>= 3 ;
  113|  3.83k|			sr = *c++ ;
  114|  3.83k|			xmc [40] = sr & 0x7 ; sr >>= 3 ;
  115|  3.83k|			xmc [41] = sr & 0x7 ; sr >>= 3 ;
  116|  3.83k|			sr |= (uint16_t) *c++ << 2 ;			/* 30 */
  117|  3.83k|			xmc [42] = sr & 0x7 ; sr >>= 3 ;
  118|  3.83k|			xmc [43] = sr & 0x7 ; sr >>= 3 ;
  119|  3.83k|			xmc [44] = sr & 0x7 ; sr >>= 3 ;
  120|  3.83k|			sr |= (uint16_t) *c++ << 1 ;
  121|  3.83k|			xmc [45] = sr & 0x7 ; sr >>= 3 ;
  122|  3.83k|			xmc [46] = sr & 0x7 ; sr >>= 3 ;
  123|  3.83k|			xmc [47] = sr & 0x7 ; sr >>= 3 ;
  124|  3.83k|			sr = *c++ ;
  125|  3.83k|			xmc [48] = sr & 0x7 ; sr >>= 3 ;
  126|  3.83k|			xmc [49] = sr & 0x7 ; sr >>= 3 ;
  127|  3.83k|			sr |= (uint16_t) *c++ << 2 ;
  128|  3.83k|			xmc [50] = sr & 0x7 ; sr >>= 3 ;
  129|  3.83k|			xmc [51] = sr & 0x7 ; sr >>= 3 ;
  130|       |
  131|  3.83k|			s->frame_chain = sr & 0xf ;
  132|  3.83k|		}
  133|  3.83k|		else {
  134|  3.83k|			sr = s->frame_chain ;
  135|  3.83k|			sr |= (uint16_t) *c++ << 4 ;			/* 1 */
  136|  3.83k|			LARc [0] = sr & 0x3f ; sr >>= 6 ;
  137|  3.83k|			LARc [1] = sr & 0x3f ; sr >>= 6 ;
  138|  3.83k|			sr = *c++ ;
  139|  3.83k|			LARc [2] = sr & 0x1f ; sr >>= 5 ;
  140|  3.83k|			sr |= (uint16_t) *c++ << 3 ;
  141|  3.83k|			LARc [3] = sr & 0x1f ; sr >>= 5 ;
  142|  3.83k|			LARc [4] = sr & 0xf ; sr >>= 4 ;
  143|  3.83k|			sr |= (uint16_t) *c++ << 2 ;
  144|  3.83k|			LARc [5] = sr & 0xf ; sr >>= 4 ;
  145|  3.83k|			LARc [6] = sr & 0x7 ; sr >>= 3 ;
  146|  3.83k|			LARc [7] = sr & 0x7 ; sr >>= 3 ;
  147|  3.83k|			sr = *c++ ;				/* 5 */
  148|  3.83k|			Nc [0] = sr & 0x7f ; sr >>= 7 ;
  149|  3.83k|			sr |= (uint16_t) *c++ << 1 ;
  150|  3.83k|			bc [0] = sr & 0x3 ; sr >>= 2 ;
  151|  3.83k|			Mc [0] = sr & 0x3 ; sr >>= 2 ;
  152|  3.83k|			sr |= (uint16_t) *c++ << 5 ;
  153|  3.83k|			xmaxc [0] = sr & 0x3f ; sr >>= 6 ;
  154|  3.83k|			xmc [0] = sr & 0x7 ; sr >>= 3 ;
  155|  3.83k|			xmc [1] = sr & 0x7 ; sr >>= 3 ;
  156|  3.83k|			sr |= (uint16_t) *c++ << 1 ;
  157|  3.83k|			xmc [2] = sr & 0x7 ; sr >>= 3 ;
  158|  3.83k|			xmc [3] = sr & 0x7 ; sr >>= 3 ;
  159|  3.83k|			xmc [4] = sr & 0x7 ; sr >>= 3 ;
  160|  3.83k|			sr = *c++ ;
  161|  3.83k|			xmc [5] = sr & 0x7 ; sr >>= 3 ;
  162|  3.83k|			xmc [6] = sr & 0x7 ; sr >>= 3 ;
  163|  3.83k|			sr |= (uint16_t) *c++ << 2 ;			/* 10 */
  164|  3.83k|			xmc [7] = sr & 0x7 ; sr >>= 3 ;
  165|  3.83k|			xmc [8] = sr & 0x7 ; sr >>= 3 ;
  166|  3.83k|			xmc [9] = sr & 0x7 ; sr >>= 3 ;
  167|  3.83k|			sr |= (uint16_t) *c++ << 1 ;
  168|  3.83k|			xmc [10] = sr & 0x7 ; sr >>= 3 ;
  169|  3.83k|			xmc [11] = sr & 0x7 ; sr >>= 3 ;
  170|  3.83k|			xmc [12] = sr & 0x7 ; sr >>= 3 ;
  171|  3.83k|			sr = *c++ ;
  172|  3.83k|			Nc [1] = sr & 0x7f ; sr >>= 7 ;
  173|  3.83k|			sr |= (uint16_t) *c++ << 1 ;
  174|  3.83k|			bc [1] = sr & 0x3 ; sr >>= 2 ;
  175|  3.83k|			Mc [1] = sr & 0x3 ; sr >>= 2 ;
  176|  3.83k|			sr |= (uint16_t) *c++ << 5 ;
  177|  3.83k|			xmaxc [1] = sr & 0x3f ; sr >>= 6 ;
  178|  3.83k|			xmc [13] = sr & 0x7 ; sr >>= 3 ;
  179|  3.83k|			xmc [14] = sr & 0x7 ; sr >>= 3 ;
  180|  3.83k|			sr |= (uint16_t) *c++ << 1 ;			/* 15 */
  181|  3.83k|			xmc [15] = sr & 0x7 ; sr >>= 3 ;
  182|  3.83k|			xmc [16] = sr & 0x7 ; sr >>= 3 ;
  183|  3.83k|			xmc [17] = sr & 0x7 ; sr >>= 3 ;
  184|  3.83k|			sr = *c++ ;
  185|  3.83k|			xmc [18] = sr & 0x7 ; sr >>= 3 ;
  186|  3.83k|			xmc [19] = sr & 0x7 ; sr >>= 3 ;
  187|  3.83k|			sr |= (uint16_t) *c++ << 2 ;
  188|  3.83k|			xmc [20] = sr & 0x7 ; sr >>= 3 ;
  189|  3.83k|			xmc [21] = sr & 0x7 ; sr >>= 3 ;
  190|  3.83k|			xmc [22] = sr & 0x7 ; sr >>= 3 ;
  191|  3.83k|			sr |= (uint16_t) *c++ << 1 ;
  192|  3.83k|			xmc [23] = sr & 0x7 ; sr >>= 3 ;
  193|  3.83k|			xmc [24] = sr & 0x7 ; sr >>= 3 ;
  194|  3.83k|			xmc [25] = sr & 0x7 ; sr >>= 3 ;
  195|  3.83k|			sr = *c++ ;
  196|  3.83k|			Nc [2] = sr & 0x7f ; sr >>= 7 ;
  197|  3.83k|			sr |= (uint16_t) *c++ << 1 ;			/* 20 */
  198|  3.83k|			bc [2] = sr & 0x3 ; sr >>= 2 ;
  199|  3.83k|			Mc [2] = sr & 0x3 ; sr >>= 2 ;
  200|  3.83k|			sr |= (uint16_t) *c++ << 5 ;
  201|  3.83k|			xmaxc [2] = sr & 0x3f ; sr >>= 6 ;
  202|  3.83k|			xmc [26] = sr & 0x7 ; sr >>= 3 ;
  203|  3.83k|			xmc [27] = sr & 0x7 ; sr >>= 3 ;
  204|  3.83k|			sr |= (uint16_t) *c++ << 1 ;
  205|  3.83k|			xmc [28] = sr & 0x7 ; sr >>= 3 ;
  206|  3.83k|			xmc [29] = sr & 0x7 ; sr >>= 3 ;
  207|  3.83k|			xmc [30] = sr & 0x7 ; sr >>= 3 ;
  208|  3.83k|			sr = *c++ ;
  209|  3.83k|			xmc [31] = sr & 0x7 ; sr >>= 3 ;
  210|  3.83k|			xmc [32] = sr & 0x7 ; sr >>= 3 ;
  211|  3.83k|			sr |= (uint16_t) *c++ << 2 ;
  212|  3.83k|			xmc [33] = sr & 0x7 ; sr >>= 3 ;
  213|  3.83k|			xmc [34] = sr & 0x7 ; sr >>= 3 ;
  214|  3.83k|			xmc [35] = sr & 0x7 ; sr >>= 3 ;
  215|  3.83k|			sr |= (uint16_t) *c++ << 1 ;			/* 25 */
  216|  3.83k|			xmc [36] = sr & 0x7 ; sr >>= 3 ;
  217|  3.83k|			xmc [37] = sr & 0x7 ; sr >>= 3 ;
  218|  3.83k|			xmc [38] = sr & 0x7 ; sr >>= 3 ;
  219|  3.83k|			sr = *c++ ;
  220|  3.83k|			Nc [3] = sr & 0x7f ; sr >>= 7 ;
  221|  3.83k|			sr |= (uint16_t) *c++ << 1 ;
  222|  3.83k|			bc [3] = sr & 0x3 ; sr >>= 2 ;
  223|  3.83k|			Mc [3] = sr & 0x3 ; sr >>= 2 ;
  224|  3.83k|			sr |= (uint16_t) *c++ << 5 ;
  225|  3.83k|			xmaxc [3] = sr & 0x3f ; sr >>= 6 ;
  226|  3.83k|			xmc [39] = sr & 0x7 ; sr >>= 3 ;
  227|  3.83k|			xmc [40] = sr & 0x7 ; sr >>= 3 ;
  228|  3.83k|			sr |= (uint16_t) *c++ << 1 ;
  229|  3.83k|			xmc [41] = sr & 0x7 ; sr >>= 3 ;
  230|  3.83k|			xmc [42] = sr & 0x7 ; sr >>= 3 ;
  231|  3.83k|			xmc [43] = sr & 0x7 ; sr >>= 3 ;
  232|  3.83k|			sr = *c++ ;				/* 30 */
  233|  3.83k|			xmc [44] = sr & 0x7 ; sr >>= 3 ;
  234|  3.83k|			xmc [45] = sr & 0x7 ; sr >>= 3 ;
  235|  3.83k|			sr |= (uint16_t) *c++ << 2 ;
  236|  3.83k|			xmc [46] = sr & 0x7 ; sr >>= 3 ;
  237|  3.83k|			xmc [47] = sr & 0x7 ; sr >>= 3 ;
  238|  3.83k|			xmc [48] = sr & 0x7 ; sr >>= 3 ;
  239|  3.83k|			sr |= (uint16_t) *c++ << 1 ;
  240|  3.83k|			xmc [49] = sr & 0x7 ; sr >>= 3 ;
  241|  3.83k|			xmc [50] = sr & 0x7 ; sr >>= 3 ;
  242|  3.83k|			xmc [51] = sr & 0x7 ; sr >>= 3 ;
  243|  3.83k|		}
  244|  7.67k|	}
  245|  20.7k|	else
  246|  20.7k|#endif
  247|  20.7k|	{
  248|       |		/* GSM_MAGIC = (*c >> 4) & 0xF ; */
  249|       |
  250|  20.7k|		if (((*c >> 4) & 0x0F) != GSM_MAGIC) return -1 ;
  ------------------
  |  |   21|  20.7k|#define GSM_MAGIC			0xD			/* 13 kbit/s RPE-LTP */
  ------------------
  |  Branch (250:7): [True: 18.7k, False: 1.95k]
  ------------------
  251|       |
  252|  1.95k|		LARc [0] = (*c++ & 0xF) << 2 ;		/* 1 */
  253|  1.95k|		LARc [0] |= (*c >> 6) & 0x3 ;
  254|  1.95k|		LARc [1] = *c++ & 0x3F ;
  255|  1.95k|		LARc [2] = (*c >> 3) & 0x1F ;
  256|  1.95k|		LARc [3] = (*c++ & 0x7) << 2 ;
  257|  1.95k|		LARc [3] |= (*c >> 6) & 0x3 ;
  258|  1.95k|		LARc [4] = (*c >> 2) & 0xF ;
  259|  1.95k|		LARc [5] = (*c++ & 0x3) << 2 ;
  260|  1.95k|		LARc [5] |= (*c >> 6) & 0x3 ;
  261|  1.95k|		LARc [6] = (*c >> 3) & 0x7 ;
  262|  1.95k|		LARc [7] = *c++ & 0x7 ;
  263|  1.95k|		Nc [0] = (*c >> 1) & 0x7F ;
  264|  1.95k|		bc [0] = (*c++ & 0x1) << 1 ;
  265|  1.95k|		bc [0] |= (*c >> 7) & 0x1 ;
  266|  1.95k|		Mc [0] = (*c >> 5) & 0x3 ;
  267|  1.95k|		xmaxc [0] = (*c++ & 0x1F) << 1 ;
  268|  1.95k|		xmaxc [0] |= (*c >> 7) & 0x1 ;
  269|  1.95k|		xmc [0] = (*c >> 4) & 0x7 ;
  270|  1.95k|		xmc [1] = (*c >> 1) & 0x7 ;
  271|  1.95k|		xmc [2] = (*c++ & 0x1) << 2 ;
  272|  1.95k|		xmc [2] |= (*c >> 6) & 0x3 ;
  273|  1.95k|		xmc [3] = (*c >> 3) & 0x7 ;
  274|  1.95k|		xmc [4] = *c++ & 0x7 ;
  275|  1.95k|		xmc [5] = (*c >> 5) & 0x7 ;
  276|  1.95k|		xmc [6] = (*c >> 2) & 0x7 ;
  277|  1.95k|		xmc [7] = (*c++ & 0x3) << 1 ;		/* 10 */
  278|  1.95k|		xmc [7] |= (*c >> 7) & 0x1 ;
  279|  1.95k|		xmc [8] = (*c >> 4) & 0x7 ;
  280|  1.95k|		xmc [9] = (*c >> 1) & 0x7 ;
  281|  1.95k|		xmc [10] = (*c++ & 0x1) << 2 ;
  282|  1.95k|		xmc [10] |= (*c >> 6) & 0x3 ;
  283|  1.95k|		xmc [11] = (*c >> 3) & 0x7 ;
  284|  1.95k|		xmc [12] = *c++ & 0x7 ;
  285|  1.95k|		Nc [1] = (*c >> 1) & 0x7F ;
  286|  1.95k|		bc [1] = (*c++ & 0x1) << 1 ;
  287|  1.95k|		bc [1] |= (*c >> 7) & 0x1 ;
  288|  1.95k|		Mc [1] = (*c >> 5) & 0x3 ;
  289|  1.95k|		xmaxc [1] = (*c++ & 0x1F) << 1 ;
  290|  1.95k|		xmaxc [1] |= (*c >> 7) & 0x1 ;
  291|  1.95k|		xmc [13] = (*c >> 4) & 0x7 ;
  292|  1.95k|		xmc [14] = (*c >> 1) & 0x7 ;
  293|  1.95k|		xmc [15] = (*c++ & 0x1) << 2 ;
  294|  1.95k|		xmc [15] |= (*c >> 6) & 0x3 ;
  295|  1.95k|		xmc [16] = (*c >> 3) & 0x7 ;
  296|  1.95k|		xmc [17] = *c++ & 0x7 ;
  297|  1.95k|		xmc [18] = (*c >> 5) & 0x7 ;
  298|  1.95k|		xmc [19] = (*c >> 2) & 0x7 ;
  299|  1.95k|		xmc [20] = (*c++ & 0x3) << 1 ;
  300|  1.95k|		xmc [20] |= (*c >> 7) & 0x1 ;
  301|  1.95k|		xmc [21] = (*c >> 4) & 0x7 ;
  302|  1.95k|		xmc [22] = (*c >> 1) & 0x7 ;
  303|  1.95k|		xmc [23] = (*c++ & 0x1) << 2 ;
  304|  1.95k|		xmc [23] |= (*c >> 6) & 0x3 ;
  305|  1.95k|		xmc [24] = (*c >> 3) & 0x7 ;
  306|  1.95k|		xmc [25] = *c++ & 0x7 ;
  307|  1.95k|		Nc [2] = (*c >> 1) & 0x7F ;
  308|  1.95k|		bc [2] = (*c++ & 0x1) << 1 ;		/* 20 */
  309|  1.95k|		bc [2] |= (*c >> 7) & 0x1 ;
  310|  1.95k|		Mc [2] = (*c >> 5) & 0x3 ;
  311|  1.95k|		xmaxc [2] = (*c++ & 0x1F) << 1 ;
  312|  1.95k|		xmaxc [2] |= (*c >> 7) & 0x1 ;
  313|  1.95k|		xmc [26] = (*c >> 4) & 0x7 ;
  314|  1.95k|		xmc [27] = (*c >> 1) & 0x7 ;
  315|  1.95k|		xmc [28] = (*c++ & 0x1) << 2 ;
  316|  1.95k|		xmc [28] |= (*c >> 6) & 0x3 ;
  317|  1.95k|		xmc [29] = (*c >> 3) & 0x7 ;
  318|  1.95k|		xmc [30] = *c++ & 0x7 ;
  319|  1.95k|		xmc [31] = (*c >> 5) & 0x7 ;
  320|  1.95k|		xmc [32] = (*c >> 2) & 0x7 ;
  321|  1.95k|		xmc [33] = (*c++ & 0x3) << 1 ;
  322|  1.95k|		xmc [33] |= (*c >> 7) & 0x1 ;
  323|  1.95k|		xmc [34] = (*c >> 4) & 0x7 ;
  324|  1.95k|		xmc [35] = (*c >> 1) & 0x7 ;
  325|  1.95k|		xmc [36] = (*c++ & 0x1) << 2 ;
  326|  1.95k|		xmc [36] |= (*c >> 6) & 0x3 ;
  327|  1.95k|		xmc [37] = (*c >> 3) & 0x7 ;
  328|  1.95k|		xmc [38] = *c++ & 0x7 ;
  329|  1.95k|		Nc [3] = (*c >> 1) & 0x7F ;
  330|  1.95k|		bc [3] = (*c++ & 0x1) << 1 ;
  331|  1.95k|		bc [3] |= (*c >> 7) & 0x1 ;
  332|  1.95k|		Mc [3] = (*c >> 5) & 0x3 ;
  333|  1.95k|		xmaxc [3] = (*c++ & 0x1F) << 1 ;
  334|  1.95k|		xmaxc [3] |= (*c >> 7) & 0x1 ;
  335|  1.95k|		xmc [39] = (*c >> 4) & 0x7 ;
  336|  1.95k|		xmc [40] = (*c >> 1) & 0x7 ;
  337|  1.95k|		xmc [41] = (*c++ & 0x1) << 2 ;
  338|  1.95k|		xmc [41] |= (*c >> 6) & 0x3 ;
  339|  1.95k|		xmc [42] = (*c >> 3) & 0x7 ;
  340|  1.95k|		xmc [43] = *c++ & 0x7 ;			/* 30  */
  341|  1.95k|		xmc [44] = (*c >> 5) & 0x7 ;
  342|  1.95k|		xmc [45] = (*c >> 2) & 0x7 ;
  343|  1.95k|		xmc [46] = (*c++ & 0x3) << 1 ;
  344|  1.95k|		xmc [46] |= (*c >> 7) & 0x1 ;
  345|  1.95k|		xmc [47] = (*c >> 4) & 0x7 ;
  346|  1.95k|		xmc [48] = (*c >> 1) & 0x7 ;
  347|  1.95k|		xmc [49] = (*c++ & 0x1) << 2 ;
  348|  1.95k|		xmc [49] |= (*c >> 6) & 0x3 ;
  349|  1.95k|		xmc [50] = (*c >> 3) & 0x7 ;
  350|  1.95k|		xmc [51] = *c & 0x7 ;			/* 33 */
  351|  1.95k|	}
  352|       |
  353|  9.63k|	Gsm_Decoder (s, LARc, Nc, bc, Mc, xmaxc, xmc, target) ;
  354|       |
  355|  9.63k|	return 0 ;
  356|  28.3k|}

gsm_destroy:
   21|    518|{
   22|    518|	if (S)
  ------------------
  |  Branch (22:6): [True: 518, False: 0]
  ------------------
   23|    518|		free ((char *) S) ;
   24|    518|}

gsm_option:
   12|    347|{
   13|    347|	int 	result = -1 ;
   14|       |
   15|    347|	switch (opt) {
   16|      0|	case GSM_OPT_LTP_CUT:
  ------------------
  |  |   29|      0|#define	GSM_OPT_LTP_CUT		3
  ------------------
  |  Branch (16:2): [True: 0, False: 347]
  ------------------
   17|       |#ifdef 	LTP_CUT
   18|       |		result = r->ltp_cut ;
   19|       |		if (val) r->ltp_cut = *val ;
   20|       |#endif
   21|      0|		break ;
   22|       |
   23|      0|	case GSM_OPT_VERBOSE:
  ------------------
  |  |   27|      0|#define	GSM_OPT_VERBOSE		1
  ------------------
  |  Branch (23:2): [True: 0, False: 347]
  ------------------
   24|      0|#ifndef	NDEBUG
   25|      0|		result = r->verbose ;
   26|      0|		if (val) r->verbose = *val ;
  ------------------
  |  Branch (26:7): [True: 0, False: 0]
  ------------------
   27|      0|#endif
   28|      0|		break ;
   29|       |
   30|      0|	case GSM_OPT_FAST:
  ------------------
  |  |   28|      0|#define	GSM_OPT_FAST		2
  ------------------
  |  Branch (30:2): [True: 0, False: 347]
  ------------------
   31|       |
   32|      0|#if	defined (FAST) && defined (USE_FLOAT_MUL)
   33|      0|		result = r->fast ;
   34|      0|		if (val) r->fast = !!*val ;
  ------------------
  |  Branch (34:7): [True: 0, False: 0]
  ------------------
   35|      0|#endif
   36|      0|		break ;
   37|       |
   38|      0|	case GSM_OPT_FRAME_CHAIN:
  ------------------
  |  |   32|      0|#define	GSM_OPT_FRAME_CHAIN	6
  ------------------
  |  Branch (38:2): [True: 0, False: 347]
  ------------------
   39|       |
   40|      0|#ifdef WAV49
   41|      0|		result = r->frame_chain ;
   42|      0|		if (val) r->frame_chain = *val ;
  ------------------
  |  Branch (42:7): [True: 0, False: 0]
  ------------------
   43|      0|#endif
   44|      0|		break ;
   45|       |
   46|      0|	case GSM_OPT_FRAME_INDEX:
  ------------------
  |  |   31|      0|#define	GSM_OPT_FRAME_INDEX	5
  ------------------
  |  Branch (46:2): [True: 0, False: 347]
  ------------------
   47|       |
   48|      0|#ifdef WAV49
   49|      0|		result = r->frame_index ;
   50|      0|		if (val) r->frame_index = *val ;
  ------------------
  |  Branch (50:7): [True: 0, False: 0]
  ------------------
   51|      0|#endif
   52|      0|		break ;
   53|       |
   54|    347|	case GSM_OPT_WAV49:
  ------------------
  |  |   30|    347|#define	GSM_OPT_WAV49		4
  ------------------
  |  Branch (54:2): [True: 347, False: 0]
  ------------------
   55|       |
   56|    347|#ifdef WAV49
   57|    347|		result = r->wav_fmt ;
   58|    347|		if (val) r->wav_fmt = !!*val ;
  ------------------
  |  Branch (58:7): [True: 347, False: 0]
  ------------------
   59|    347|#endif
   60|    347|		break ;
   61|       |
   62|      0|	default:
  ------------------
  |  Branch (62:2): [True: 0, False: 347]
  ------------------
   63|      0|		break ;
   64|    347|	}
   65|    347|	return result ;
   66|    347|}

Gsm_Long_Term_Synthesis_Filtering:
  902|  38.5k|{
  903|  38.5k|	register int 		k ;
  904|  38.5k|	int16_t			brp, drpp, Nr ;
  905|       |
  906|       |	/*  Check the limits of Nr.
  907|       |	 */
  908|  38.5k|	Nr = Ncr < 40 || Ncr > 120 ? S->nrp : Ncr ;
  ------------------
  |  Branch (908:7): [True: 16.2k, False: 22.3k]
  |  Branch (908:19): [True: 4.98k, False: 17.3k]
  ------------------
  909|  38.5k|	S->nrp = Nr ;
  910|  38.5k|	assert (Nr >= 40 && Nr <= 120) ;
  ------------------
  |  Branch (910:2): [True: 0, False: 38.5k]
  |  Branch (910:2): [True: 0, False: 0]
  |  Branch (910:2): [True: 38.5k, False: 0]
  |  Branch (910:2): [True: 38.5k, False: 0]
  ------------------
  911|       |
  912|       |	/*  Decoding of the LTP gain bcr
  913|       |	 */
  914|  38.5k|	brp = gsm_QLB [bcr] ;
  915|       |
  916|       |	/*  Computation of the reconstructed short term residual
  917|       |	 *  signal drp [0..39]
  918|       |	 */
  919|  38.5k|	assert (brp != MIN_WORD) ;
  ------------------
  |  Branch (919:2): [True: 0, False: 38.5k]
  |  Branch (919:2): [True: 38.5k, False: 0]
  ------------------
  920|       |
  921|  1.57M|	for (k = 0 ; k <= 39 ; k++)
  ------------------
  |  Branch (921:15): [True: 1.54M, False: 38.5k]
  ------------------
  922|  1.54M|	{	drpp = GSM_MULT_R (brp, drp [k - Nr]) ;
  923|  1.54M|		drp [k] = GSM_ADD (erp [k], drpp) ;
  924|  1.54M|		}
  925|       |
  926|       |	/*
  927|       |	 *  Update of the reconstructed short term residual signal
  928|       |	 *  drp [-1..-120]
  929|       |	 */
  930|       |
  931|  4.66M|	for (k = 0 ; k <= 119 ; k++) drp [-120 + k] = drp [-80 + k] ;
  ------------------
  |  Branch (931:15): [True: 4.62M, False: 38.5k]
  ------------------
  932|  38.5k|}

Gsm_RPE_Decoding:
  453|  38.5k|{
  454|  38.5k|	int16_t	expon, mant ;
  455|  38.5k|	int16_t	xMp [13] ;
  456|       |
  457|  38.5k|	APCM_quantization_xmaxc_to_exp_mant (xmaxcr, &expon, &mant) ;
  458|  38.5k|	APCM_inverse_quantization (xMcr, mant, expon, xMp) ;
  459|  38.5k|	RPE_grid_positioning (Mcr, xMp, erp) ;
  460|  38.5k|}
rpe.c:APCM_inverse_quantization:
  345|  38.5k|{
  346|  38.5k|	int	i ;
  347|  38.5k|	int16_t	temp, temp1, temp2, temp3 ;
  348|       |
  349|  38.5k|	assert (mant >= 0 && mant <= 7) ;
  ------------------
  |  Branch (349:2): [True: 0, False: 38.5k]
  |  Branch (349:2): [True: 0, False: 0]
  |  Branch (349:2): [True: 38.5k, False: 0]
  |  Branch (349:2): [True: 38.5k, False: 0]
  ------------------
  350|       |
  351|  38.5k|	temp1 = gsm_FAC [mant] ;	/* see 4.2-15 for mant */
  352|  38.5k|	temp2 = gsm_sub (6, expon) ;	/* see 4.2-15 for exp  */
  353|  38.5k|	temp3 = gsm_asl (1, gsm_sub (temp2, 1)) ;
  354|       |
  355|   539k|	for (i = 13 ; i-- ;)
  ------------------
  |  Branch (355:16): [True: 500k, False: 38.5k]
  ------------------
  356|   500k|	{	assert (*xMc <= 7 && *xMc >= 0) ;	/* 3 bit unsigned */
  ------------------
  |  Branch (356:4): [True: 0, False: 500k]
  |  Branch (356:4): [True: 0, False: 0]
  |  Branch (356:4): [True: 500k, False: 0]
  |  Branch (356:4): [True: 500k, False: 0]
  ------------------
  357|       |
  358|       |		/* temp = gsm_sub (*xMc++ << 1, 7) ; */
  359|   500k|		temp = (*xMc++ << 1) - 7 ;			/* restore sign   */
  360|   500k|		assert (temp <= 7 && temp >= -7) ;	/* 4 bit signed   */
  ------------------
  |  Branch (360:3): [True: 0, False: 500k]
  |  Branch (360:3): [True: 0, False: 0]
  |  Branch (360:3): [True: 500k, False: 0]
  |  Branch (360:3): [True: 500k, False: 0]
  ------------------
  361|       |
  362|   500k|		temp = arith_shift_left (temp, 12) ;	/* 16 bit signed  */
  363|   500k|		temp = GSM_MULT_R (temp1, temp) ;
  364|   500k|		temp = GSM_ADD (temp, temp3) ;
  365|   500k|		*xMp++ = gsm_asr (temp, temp2) ;
  366|   500k|	}
  367|  38.5k|}
rpe.c:RPE_grid_positioning:
  383|  38.5k|{
  384|  38.5k|	int	i = 13 ;
  385|       |
  386|  38.5k|	assert (0 <= Mc && Mc <= 3) ;
  ------------------
  |  Branch (386:2): [True: 0, False: 38.5k]
  |  Branch (386:2): [True: 0, False: 0]
  |  Branch (386:2): [True: 38.5k, False: 0]
  |  Branch (386:2): [True: 38.5k, False: 0]
  ------------------
  387|       |
  388|  38.5k|	switch (Mc)
  ------------------
  |  Branch (388:10): [True: 38.5k, False: 0]
  ------------------
  389|  38.5k|	{	case 3: *ep++ = 0 ;
  ------------------
  |  Branch (389:4): [True: 10.2k, False: 28.2k]
  ------------------
  390|       |				/* Falls through. */
  391|  20.2k|		case 2: do
  ------------------
  |  Branch (391:3): [True: 9.97k, False: 28.5k]
  ------------------
  392|   482k|				{	*ep++ = 0 ;
  393|       |				/* Falls through. */
  394|   486k|		case 1:		*ep++ = 0 ;
  ------------------
  |  Branch (394:3): [True: 3.87k, False: 34.6k]
  ------------------
  395|       |				/* Falls through. */
  396|   500k|		case 0:		*ep++ = *xMp++ ;
  ------------------
  |  Branch (396:3): [True: 14.3k, False: 24.1k]
  ------------------
  397|   500k|					} while (--i) ;
  ------------------
  |  Branch (397:15): [True: 462k, False: 38.5k]
  ------------------
  398|  38.5k|	}
  399|  99.3k|	while (++Mc < 4) *ep++ = 0 ;
  ------------------
  |  Branch (399:9): [True: 60.8k, False: 38.5k]
  ------------------
  400|  38.5k|}
rpe.c:APCM_quantization_xmaxc_to_exp_mant:
  216|  38.5k|{
  217|  38.5k|	int16_t	expon, mant ;
  218|       |
  219|       |	/* Compute expononent and mantissa of the decoded version of xmaxc
  220|       |	 */
  221|       |
  222|  38.5k|	expon = 0 ;
  223|  38.5k|	if (xmaxc > 15) expon = SASR_W (xmaxc, 3) - 1 ;
  ------------------
  |  Branch (223:6): [True: 20.8k, False: 17.6k]
  ------------------
  224|  38.5k|	mant = xmaxc - (expon << 3) ;
  225|       |
  226|  38.5k|	if (mant == 0)
  ------------------
  |  Branch (226:6): [True: 10.0k, False: 28.4k]
  ------------------
  227|  10.0k|	{	expon = -4 ;
  228|  10.0k|		mant = 7 ;
  229|  10.0k|		}
  230|  28.4k|	else
  231|  33.7k|	{	while (mant <= 7)
  ------------------
  |  Branch (231:11): [True: 5.30k, False: 28.4k]
  ------------------
  232|  5.30k|		{	mant = mant << 1 | 1 ;
  233|  5.30k|			expon-- ;
  234|  5.30k|			}
  235|  28.4k|		mant -= 8 ;
  236|  28.4k|		}
  237|       |
  238|  38.5k|	assert (expon >= -4 && expon <= 6) ;
  ------------------
  |  Branch (238:2): [True: 0, False: 38.5k]
  |  Branch (238:2): [True: 0, False: 0]
  |  Branch (238:2): [True: 38.5k, False: 0]
  |  Branch (238:2): [True: 38.5k, False: 0]
  ------------------
  239|  38.5k|	assert (mant >= 0 && mant <= 7) ;
  ------------------
  |  Branch (239:2): [True: 0, False: 38.5k]
  |  Branch (239:2): [True: 0, False: 0]
  |  Branch (239:2): [True: 38.5k, False: 0]
  |  Branch (239:2): [True: 38.5k, False: 0]
  ------------------
  240|       |
  241|  38.5k|	*expon_out = expon ;
  242|  38.5k|	*mant_out = mant ;
  243|  38.5k|}

Gsm_Short_Term_Synthesis_Filter:
  379|  9.63k|{
  380|  9.63k|	int16_t		* LARpp_j	= S->LARpp [S->j] ;
  381|  9.63k|	int16_t		* LARpp_j_1	= S->LARpp [S->j ^= 1] ;
  382|       |
  383|  9.63k|	int16_t		LARp [8] ;
  384|       |
  385|  9.63k|#undef	FILTER
  386|  9.63k|#if defined (FAST) && defined (USE_FLOAT_MUL)
  387|       |
  388|  9.63k|# 	define	FILTER 	(* (S->fast							\
  389|  9.63k|				? Fast_Short_term_synthesis_filtering	\
  390|  9.63k|				: Short_term_synthesis_filtering))
  391|       |#else
  392|       |#	define	FILTER	Short_term_synthesis_filtering
  393|       |#endif
  394|       |
  395|  9.63k|	Decoding_of_the_coded_Log_Area_Ratios (LARcr, LARpp_j) ;
  396|       |
  397|  9.63k|	Coefficients_0_12 (LARpp_j_1, LARpp_j, LARp) ;
  398|  9.63k|	LARp_to_rp (LARp) ;
  399|  9.63k|	FILTER (S, LARp, 13, wt, s) ;
  ------------------
  |  |  388|  9.63k|# 	define	FILTER 	(* (S->fast							\
  |  |  ------------------
  |  |  |  Branch (388:23): [True: 0, False: 9.63k]
  |  |  ------------------
  |  |  389|  9.63k|				? Fast_Short_term_synthesis_filtering	\
  |  |  390|  9.63k|				: Short_term_synthesis_filtering))
  ------------------
  400|       |
  401|  9.63k|	Coefficients_13_26 (LARpp_j_1, LARpp_j, LARp) ;
  402|  9.63k|	LARp_to_rp (LARp) ;
  403|  9.63k|	FILTER (S, LARp, 14, wt + 13, s + 13) ;
  ------------------
  |  |  388|  9.63k|# 	define	FILTER 	(* (S->fast							\
  |  |  ------------------
  |  |  |  Branch (388:23): [True: 0, False: 9.63k]
  |  |  ------------------
  |  |  389|  9.63k|				? Fast_Short_term_synthesis_filtering	\
  |  |  390|  9.63k|				: Short_term_synthesis_filtering))
  ------------------
  404|       |
  405|  9.63k|	Coefficients_27_39 (LARpp_j_1, LARpp_j, LARp) ;
  406|  9.63k|	LARp_to_rp (LARp) ;
  407|  9.63k|	FILTER (S, LARp, 13, wt + 27, s + 27) ;
  ------------------
  |  |  388|  9.63k|# 	define	FILTER 	(* (S->fast							\
  |  |  ------------------
  |  |  |  Branch (388:23): [True: 0, False: 9.63k]
  |  |  ------------------
  |  |  389|  9.63k|				? Fast_Short_term_synthesis_filtering	\
  |  |  390|  9.63k|				: Short_term_synthesis_filtering))
  ------------------
  408|       |
  409|  9.63k|	Coefficients_40_159 (LARpp_j, LARp) ;
  410|  9.63k|	LARp_to_rp (LARp) ;
  411|  9.63k|	FILTER (S, LARp, 120, wt + 40, s + 40) ;
  ------------------
  |  |  388|  9.63k|# 	define	FILTER 	(* (S->fast							\
  |  |  ------------------
  |  |  |  Branch (388:23): [True: 0, False: 9.63k]
  |  |  ------------------
  |  |  389|  9.63k|				? Fast_Short_term_synthesis_filtering	\
  |  |  390|  9.63k|				: Short_term_synthesis_filtering))
  ------------------
  412|  9.63k|}
short_term.c:Decoding_of_the_coded_Log_Area_Ratios:
   21|  9.63k|{
   22|  9.63k|	register int16_t	temp1 ;
   23|       |
   24|       |	/*  This procedure requires for efficient implementation
   25|       |	 *  two tables.
   26|       | 	 *
   27|       |	 *  INVA[1..8] = integer((32768 * 8) / real_A[1..8])
   28|       |	 *  MIC[1..8]  = minimum value of the LARc[1..8]
   29|       |	 */
   30|       |
   31|       |	/*  Compute the LARpp[1..8]
   32|       |	 */
   33|       |
   34|       |	/* 	for (i = 1; i <= 8; i++, B++, MIC++, INVA++, LARc++, LARpp++) {
   35|       |	 *
   36|       |	 *		temp1  = GSM_ADD (*LARc, *MIC) << 10;
   37|       |	 *		temp2  = *B << 1;
   38|       |	 *		temp1  = GSM_SUB(temp1, temp2) ;
   39|       |	 *
   40|       |	 *		assert(*INVA != MIN_WORD) ;
   41|       |	 *
   42|       |	 *		temp1  = GSM_MULT_R (*INVA, temp1) ;
   43|       |	 *		*LARpp = GSM_ADD (temp1, temp1) ;
   44|       |	 *	}
   45|       |	 */
   46|       |
   47|  9.63k|#undef	STEP
   48|  9.63k|#define	STEP(B, MIC, INVA)	\
   49|  9.63k|		temp1	= arith_shift_left (GSM_ADD (*LARc++, MIC), 10) ;	\
   50|  9.63k|		temp1	= GSM_SUB (temp1, B * 2) ;			\
   51|  9.63k|		temp1	= GSM_MULT_R (INVA, temp1) ;		\
   52|  9.63k|		*LARpp++ = GSM_ADD (temp1, temp1) ;
   53|       |
   54|  9.63k|	STEP (0, -32, 13107) ;
  ------------------
  |  |   49|  9.63k|		temp1	= arith_shift_left (GSM_ADD (*LARc++, MIC), 10) ;	\
  |  |   50|  9.63k|		temp1	= GSM_SUB (temp1, B * 2) ;			\
  |  |   51|  9.63k|		temp1	= GSM_MULT_R (INVA, temp1) ;		\
  |  |   52|  9.63k|		*LARpp++ = GSM_ADD (temp1, temp1) ;
  ------------------
   55|  9.63k|	STEP (0, -32, 13107) ;
  ------------------
  |  |   49|  9.63k|		temp1	= arith_shift_left (GSM_ADD (*LARc++, MIC), 10) ;	\
  |  |   50|  9.63k|		temp1	= GSM_SUB (temp1, B * 2) ;			\
  |  |   51|  9.63k|		temp1	= GSM_MULT_R (INVA, temp1) ;		\
  |  |   52|  9.63k|		*LARpp++ = GSM_ADD (temp1, temp1) ;
  ------------------
   56|  9.63k|	STEP (2048, -16, 13107) ;
  ------------------
  |  |   49|  9.63k|		temp1	= arith_shift_left (GSM_ADD (*LARc++, MIC), 10) ;	\
  |  |   50|  9.63k|		temp1	= GSM_SUB (temp1, B * 2) ;			\
  |  |   51|  9.63k|		temp1	= GSM_MULT_R (INVA, temp1) ;		\
  |  |   52|  9.63k|		*LARpp++ = GSM_ADD (temp1, temp1) ;
  ------------------
   57|  9.63k|	STEP (-2560, -16, 13107) ;
  ------------------
  |  |   49|  9.63k|		temp1	= arith_shift_left (GSM_ADD (*LARc++, MIC), 10) ;	\
  |  |   50|  9.63k|		temp1	= GSM_SUB (temp1, B * 2) ;			\
  |  |   51|  9.63k|		temp1	= GSM_MULT_R (INVA, temp1) ;		\
  |  |   52|  9.63k|		*LARpp++ = GSM_ADD (temp1, temp1) ;
  ------------------
   58|       |
   59|  9.63k|	STEP (94, -8, 19223) ;
  ------------------
  |  |   49|  9.63k|		temp1	= arith_shift_left (GSM_ADD (*LARc++, MIC), 10) ;	\
  |  |   50|  9.63k|		temp1	= GSM_SUB (temp1, B * 2) ;			\
  |  |   51|  9.63k|		temp1	= GSM_MULT_R (INVA, temp1) ;		\
  |  |   52|  9.63k|		*LARpp++ = GSM_ADD (temp1, temp1) ;
  ------------------
   60|  9.63k|	STEP (-1792, -8, 17476) ;
  ------------------
  |  |   49|  9.63k|		temp1	= arith_shift_left (GSM_ADD (*LARc++, MIC), 10) ;	\
  |  |   50|  9.63k|		temp1	= GSM_SUB (temp1, B * 2) ;			\
  |  |   51|  9.63k|		temp1	= GSM_MULT_R (INVA, temp1) ;		\
  |  |   52|  9.63k|		*LARpp++ = GSM_ADD (temp1, temp1) ;
  ------------------
   61|  9.63k|	STEP (-341, -4, 31454) ;
  ------------------
  |  |   49|  9.63k|		temp1	= arith_shift_left (GSM_ADD (*LARc++, MIC), 10) ;	\
  |  |   50|  9.63k|		temp1	= GSM_SUB (temp1, B * 2) ;			\
  |  |   51|  9.63k|		temp1	= GSM_MULT_R (INVA, temp1) ;		\
  |  |   52|  9.63k|		*LARpp++ = GSM_ADD (temp1, temp1) ;
  ------------------
   62|  9.63k|	STEP (-1144, -4, 29708) ;
  ------------------
  |  |   49|  9.63k|		temp1	= arith_shift_left (GSM_ADD (*LARc++, MIC), 10) ;	\
  |  |   50|  9.63k|		temp1	= GSM_SUB (temp1, B * 2) ;			\
  |  |   51|  9.63k|		temp1	= GSM_MULT_R (INVA, temp1) ;		\
  |  |   52|  9.63k|		*LARpp++ = GSM_ADD (temp1, temp1) ;
  ------------------
   63|       |
   64|       |	/* NOTE: the addition of *MIC is used to restore
   65|       |	 * 	 the sign of *LARc.
   66|       |	 */
   67|  9.63k|}
short_term.c:Coefficients_0_12:
   89|  9.63k|{
   90|  9.63k|	register int 	i ;
   91|       |
   92|  86.6k|	for (i = 1 ; i <= 8 ; i++, LARp++, LARpp_j_1++, LARpp_j++)
  ------------------
  |  Branch (92:15): [True: 77.0k, False: 9.63k]
  ------------------
   93|  77.0k|	{	*LARp = GSM_ADD (SASR_W (*LARpp_j_1, 2), SASR_W (*LARpp_j, 2)) ;
   94|  77.0k|		*LARp = GSM_ADD (*LARp, SASR_W (*LARpp_j_1, 1)) ;
   95|  77.0k|		}
   96|  9.63k|}
short_term.c:LARp_to_rp:
  141|  38.5k|{
  142|  38.5k|	register int 		i ;
  143|  38.5k|	register int16_t		temp ;
  144|       |
  145|   346k|	for (i = 1 ; i <= 8 ; i++, LARp++)
  ------------------
  |  Branch (145:15): [True: 308k, False: 38.5k]
  ------------------
  146|   308k|	{	/* temp = GSM_ABS(*LARp) ;
  147|       |	         *
  148|       |		 * if (temp < 11059) temp <<= 1;
  149|       |		 * else if (temp < 20070) temp += 11059;
  150|       |		 * else temp = GSM_ADD (temp >> 2, 26112) ;
  151|       |		 *
  152|       |		 * *LARp = *LARp < 0 ? -temp : temp;
  153|       |		 */
  154|       |
  155|   308k|		if (*LARp < 0)
  ------------------
  |  Branch (155:7): [True: 173k, False: 134k]
  ------------------
  156|   173k|		{	temp = *LARp == MIN_WORD ? MAX_WORD : - (*LARp) ;
  ------------------
  |  |   51|   173k|#define	MIN_WORD	(-32767 - 1)
  ------------------
              		{	temp = *LARp == MIN_WORD ? MAX_WORD : - (*LARp) ;
  ------------------
  |  |   52|      0|#define	MAX_WORD	32767
  ------------------
  |  Branch (156:12): [True: 0, False: 173k]
  ------------------
  157|   173k|			*LARp = - ((temp < 11059) ? temp << 1
  ------------------
  |  Branch (157:15): [True: 128k, False: 45.2k]
  ------------------
  158|   173k|				: ((temp < 20070) ? temp + 11059
  ------------------
  |  Branch (158:8): [True: 26.5k, False: 18.6k]
  ------------------
  159|  45.2k|				: GSM_ADD ((int16_t) (temp >> 2), (int16_t) 26112))) ;
  160|   173k|			}
  161|   134k|		else
  162|   134k|		{	temp = *LARp ;
  163|   134k|			*LARp = (temp < 11059) ? temp << 1
  ------------------
  |  Branch (163:12): [True: 104k, False: 29.7k]
  ------------------
  164|   134k|				: ((temp < 20070) ? temp + 11059
  ------------------
  |  Branch (164:8): [True: 21.1k, False: 8.60k]
  ------------------
  165|  29.7k|				: GSM_ADD ((int16_t) (temp >> 2), (int16_t) 26112)) ;
  166|   134k|			}
  167|   308k|	}
  168|  38.5k|}
short_term.c:Coefficients_13_26:
  102|  9.63k|{
  103|  9.63k|	register int i ;
  104|  86.6k|	for (i = 1 ; i <= 8 ; i++, LARpp_j_1++, LARpp_j++, LARp++)
  ------------------
  |  Branch (104:15): [True: 77.0k, False: 9.63k]
  ------------------
  105|  77.0k|		*LARp = GSM_ADD (SASR_W (*LARpp_j_1, 1), SASR_W (*LARpp_j, 1)) ;
  106|  9.63k|}
short_term.c:Coefficients_27_39:
  112|  9.63k|{
  113|  9.63k|	register int i ;
  114|       |
  115|  86.6k|	for (i = 1 ; i <= 8 ; i++, LARpp_j_1++, LARpp_j++, LARp++)
  ------------------
  |  Branch (115:15): [True: 77.0k, False: 9.63k]
  ------------------
  116|  77.0k|	{	*LARp = GSM_ADD (SASR_W (*LARpp_j_1, 2), SASR_W (*LARpp_j, 2)) ;
  117|  77.0k|		*LARp = GSM_ADD (*LARp, SASR_W (*LARpp_j, 1)) ;
  118|  77.0k|		}
  119|  9.63k|}
short_term.c:Coefficients_40_159:
  125|  9.63k|{
  126|  9.63k|	register int i ;
  127|       |
  128|  86.6k|	for (i = 1 ; i <= 8 ; i++, LARp++, LARpp_j++)
  ------------------
  |  Branch (128:15): [True: 77.0k, False: 9.63k]
  ------------------
  129|  77.0k|		*LARp = *LARpp_j ;
  130|  9.63k|}
short_term.c:Short_term_synthesis_filtering:
  258|  38.5k|{
  259|  38.5k|	register int16_t		* v = S->v ;
  260|  38.5k|	register int		i ;
  261|  38.5k|	register int16_t		sri, tmp1, tmp2 ;
  262|       |
  263|  1.57M|	while (k--)
  ------------------
  |  Branch (263:9): [True: 1.54M, False: 38.5k]
  ------------------
  264|  1.54M|	{	sri = *wt++ ;
  265|  13.8M|		for (i = 8 ; i-- ; )
  ------------------
  |  Branch (265:16): [True: 12.3M, False: 1.54M]
  ------------------
  266|  12.3M|		{	/* sri = GSM_SUB(sri, gsm_mult_r(rrp[i], v [i])) ;
  267|       |			 */
  268|  12.3M|			tmp1 = rrp [i] ;
  269|  12.3M|			tmp2 = v [i] ;
  270|  12.3M|			tmp2 = (tmp1 == MIN_WORD && tmp2 == MIN_WORD
  ------------------
  |  |   51|  24.6M|#define	MIN_WORD	(-32767 - 1)
  ------------------
              			tmp2 = (tmp1 == MIN_WORD && tmp2 == MIN_WORD
  ------------------
  |  |   51|      0|#define	MIN_WORD	(-32767 - 1)
  ------------------
  |  Branch (270:12): [True: 0, False: 12.3M]
  |  Branch (270:32): [True: 0, False: 0]
  ------------------
  271|  12.3M|				? MAX_WORD
  ------------------
  |  |   52|      0|#define	MAX_WORD	32767
  ------------------
  272|  12.3M|				: 0x0FFFF & (((int32_t) tmp1 * (int32_t) tmp2
  273|  12.3M|							+ 16384) >> 15)) ;
  274|       |
  275|  12.3M|			sri = GSM_SUB (sri, tmp2) ;
  276|       |
  277|       |			/* v [i+1] = GSM_ADD (v [i], gsm_mult_r(rrp[i], sri)) ;
  278|       |			 */
  279|  12.3M|			tmp1 = (tmp1 == MIN_WORD && sri == MIN_WORD
  ------------------
  |  |   51|  24.6M|#define	MIN_WORD	(-32767 - 1)
  ------------------
              			tmp1 = (tmp1 == MIN_WORD && sri == MIN_WORD
  ------------------
  |  |   51|      0|#define	MIN_WORD	(-32767 - 1)
  ------------------
  |  Branch (279:12): [True: 0, False: 12.3M]
  |  Branch (279:32): [True: 0, False: 0]
  ------------------
  280|  12.3M|				? MAX_WORD
  ------------------
  |  |   52|      0|#define	MAX_WORD	32767
  ------------------
  281|  12.3M|				: 0x0FFFF & (((int32_t) tmp1 * (int32_t) sri
  282|  12.3M|							+ 16384) >> 15)) ;
  283|       |
  284|  12.3M|			v [i + 1] = GSM_ADD (v [i], tmp1) ;
  285|  12.3M|		}
  286|  1.54M|		*sr++ = v [0] = sri ;
  287|  1.54M|	}
  288|  38.5k|}

aiff_open:
  236|  3.07k|{	COMM_CHUNK comm_fmt ;
  237|  3.07k|	int error = 0, subformat ;
  238|       |
  239|  3.07k|	memset (&comm_fmt, 0, sizeof (comm_fmt)) ;
  240|       |
  241|  3.07k|	subformat = SF_CODEC (psf->sf.format) ;
  ------------------
  |  |  102|  3.07k|#define SF_CODEC(x)			((x) & SF_FORMAT_SUBMASK)
  ------------------
  242|       |
  243|  3.07k|	if ((psf->container_data = calloc (1, sizeof (AIFF_PRIVATE))) == NULL)
  ------------------
  |  Branch (243:6): [True: 0, False: 3.07k]
  ------------------
  244|      0|		return SFE_MALLOC_FAILED ;
  245|       |
  246|  3.07k|	psf->container_close = aiff_close ;
  247|       |
  248|  3.07k|	if (psf->file.mode == SFM_READ || (psf->file.mode == SFM_RDWR && psf->filelength > 0))
  ------------------
  |  Branch (248:6): [True: 3.07k, False: 0]
  |  Branch (248:37): [True: 0, False: 0]
  |  Branch (248:67): [True: 0, False: 0]
  ------------------
  249|  3.07k|	{	if ((error = aiff_read_header (psf, &comm_fmt)))
  ------------------
  |  Branch (249:8): [True: 2.15k, False: 920]
  ------------------
  250|  2.15k|			return error ;
  251|       |
  252|    920|		psf->next_chunk_iterator = aiff_next_chunk_iterator ;
  253|    920|		psf->get_chunk_size = aiff_get_chunk_size ;
  254|    920|		psf->get_chunk_data = aiff_get_chunk_data ;
  255|       |
  256|    920|		psf_fseek (psf, psf->dataoffset, SEEK_SET) ;
  257|    920|		} ;
  258|       |
  259|    920|	if (psf->file.mode == SFM_WRITE || psf->file.mode == SFM_RDWR)
  ------------------
  |  Branch (259:6): [True: 0, False: 920]
  |  Branch (259:37): [True: 0, False: 920]
  ------------------
  260|      0|	{	if (psf->is_pipe)
  ------------------
  |  Branch (260:8): [True: 0, False: 0]
  ------------------
  261|      0|			return SFE_NO_PIPE_WRITE ;
  262|       |
  263|      0|		if ((SF_CONTAINER (psf->sf.format)) != SF_FORMAT_AIFF)
  ------------------
  |  |  101|      0|#define SF_CONTAINER(x)		((x) & SF_FORMAT_TYPEMASK)
  ------------------
  |  Branch (263:7): [True: 0, False: 0]
  ------------------
  264|      0|			return SFE_BAD_OPEN_FORMAT ;
  265|       |
  266|      0|		if (psf->file.mode == SFM_WRITE && (subformat == SF_FORMAT_FLOAT || subformat == SF_FORMAT_DOUBLE))
  ------------------
  |  Branch (266:7): [True: 0, False: 0]
  |  Branch (266:39): [True: 0, False: 0]
  |  Branch (266:71): [True: 0, False: 0]
  ------------------
  267|      0|		{	if ((psf->peak_info = peak_info_calloc (psf->sf.channels)) == NULL)
  ------------------
  |  Branch (267:9): [True: 0, False: 0]
  ------------------
  268|      0|				return SFE_MALLOC_FAILED ;
  269|      0|			psf->peak_info->peak_loc = SF_PEAK_START ;
  270|      0|			} ;
  271|       |
  272|      0|		if (psf->file.mode != SFM_RDWR || psf->filelength < 40)
  ------------------
  |  Branch (272:7): [True: 0, False: 0]
  |  Branch (272:37): [True: 0, False: 0]
  ------------------
  273|      0|		{	psf->filelength = 0 ;
  274|      0|			psf->datalength = 0 ;
  275|      0|			psf->dataoffset = 0 ;
  276|      0|			psf->sf.frames = 0 ;
  277|      0|			} ;
  278|       |
  279|      0|		psf->strings.flags = SF_STR_ALLOW_START | SF_STR_ALLOW_END ;
  280|       |
  281|      0|		if ((error = aiff_write_header (psf, SF_FALSE)))
  ------------------
  |  Branch (281:7): [True: 0, False: 0]
  ------------------
  282|      0|			return error ;
  283|       |
  284|      0|		psf->write_header	= aiff_write_header ;
  285|      0|		psf->set_chunk		= aiff_set_chunk ;
  286|    920|		} ;
  287|       |
  288|    920|	psf->command = aiff_command ;
  289|       |
  290|    920|	switch (SF_CODEC (psf->sf.format))
  ------------------
  |  |  102|    920|#define SF_CODEC(x)			((x) & SF_FORMAT_SUBMASK)
  ------------------
  291|    920|	{	case SF_FORMAT_PCM_U8 :
  ------------------
  |  Branch (291:4): [True: 28, False: 892]
  ------------------
  292|     28|				error = pcm_init (psf) ;
  293|     28|				break ;
  294|       |
  295|      5|		case SF_FORMAT_PCM_S8 :
  ------------------
  |  Branch (295:3): [True: 5, False: 915]
  ------------------
  296|      5|				error = pcm_init (psf) ;
  297|      5|				break ;
  298|       |
  299|     25|		case SF_FORMAT_PCM_16 :
  ------------------
  |  Branch (299:3): [True: 25, False: 895]
  ------------------
  300|     31|		case SF_FORMAT_PCM_24 :
  ------------------
  |  Branch (300:3): [True: 6, False: 914]
  ------------------
  301|     41|		case SF_FORMAT_PCM_32 :
  ------------------
  |  Branch (301:3): [True: 10, False: 910]
  ------------------
  302|     41|				error = pcm_init (psf) ;
  303|     41|				break ;
  304|       |
  305|     20|		case SF_FORMAT_ULAW :
  ------------------
  |  Branch (305:3): [True: 20, False: 900]
  ------------------
  306|     20|				error = ulaw_init (psf) ;
  307|     20|				break ;
  308|       |
  309|     18|		case SF_FORMAT_ALAW :
  ------------------
  |  Branch (309:3): [True: 18, False: 902]
  ------------------
  310|     18|				error = alaw_init (psf) ;
  311|     18|				break ;
  312|       |
  313|       |		/* Lite remove start */
  314|     28|		case SF_FORMAT_FLOAT :
  ------------------
  |  Branch (314:3): [True: 28, False: 892]
  ------------------
  315|     28|				error = float32_init (psf) ;
  316|     28|				break ;
  317|       |
  318|     25|		case SF_FORMAT_DOUBLE :
  ------------------
  |  Branch (318:3): [True: 25, False: 895]
  ------------------
  319|     25|				error = double64_init (psf) ;
  320|     25|				break ;
  321|       |
  322|      6|		case SF_FORMAT_DWVW_12 :
  ------------------
  |  Branch (322:3): [True: 6, False: 914]
  ------------------
  323|      6|				if (psf->sf.frames > comm_fmt.numSampleFrames)
  ------------------
  |  Branch (323:9): [True: 0, False: 6]
  ------------------
  324|      0|					psf->sf.frames = comm_fmt.numSampleFrames ;
  325|      6|				break ;
  326|       |
  327|     72|		case SF_FORMAT_DWVW_16 :
  ------------------
  |  Branch (327:3): [True: 72, False: 848]
  ------------------
  328|     72|				error = dwvw_init (psf, 16) ;
  329|     72|				if (psf->sf.frames > comm_fmt.numSampleFrames)
  ------------------
  |  Branch (329:9): [True: 4, False: 68]
  ------------------
  330|      4|					psf->sf.frames = comm_fmt.numSampleFrames ;
  331|     72|				break ;
  332|       |
  333|     43|		case SF_FORMAT_DWVW_24 :
  ------------------
  |  Branch (333:3): [True: 43, False: 877]
  ------------------
  334|     43|				error = dwvw_init (psf, 24) ;
  335|     43|				if (psf->sf.frames > comm_fmt.numSampleFrames)
  ------------------
  |  Branch (335:9): [True: 7, False: 36]
  ------------------
  336|      7|					psf->sf.frames = comm_fmt.numSampleFrames ;
  337|     43|				break ;
  338|       |
  339|    162|		case SF_FORMAT_DWVW_N :
  ------------------
  |  Branch (339:3): [True: 162, False: 758]
  ------------------
  340|    162|				if (psf->file.mode != SFM_READ)
  ------------------
  |  Branch (340:9): [True: 0, False: 162]
  ------------------
  341|      0|				{	error = SFE_DWVW_BAD_BITWIDTH ;
  342|      0|					break ;
  343|    162|					} ;
  344|    162|				if (comm_fmt.sampleSize >= 8 && comm_fmt.sampleSize < 24)
  ------------------
  |  Branch (344:9): [True: 157, False: 5]
  |  Branch (344:37): [True: 152, False: 5]
  ------------------
  345|    152|				{	error = dwvw_init (psf, comm_fmt.sampleSize) ;
  346|    152|					if (psf->sf.frames > comm_fmt.numSampleFrames)
  ------------------
  |  Branch (346:10): [True: 18, False: 134]
  ------------------
  347|     18|						psf->sf.frames = comm_fmt.numSampleFrames ;
  348|    152|					break ;
  349|    152|					} ;
  350|     10|				psf_log_printf (psf, "AIFC/DWVW : Bad bitwidth %d\n", comm_fmt.sampleSize) ;
  351|     10|				error = SFE_DWVW_BAD_BITWIDTH ;
  352|     10|				break ;
  353|       |
  354|    163|		case SF_FORMAT_IMA_ADPCM :
  ------------------
  |  Branch (354:3): [True: 163, False: 757]
  ------------------
  355|       |				/*
  356|       |				**	IMA ADPCM encoded AIFF files always have a block length
  357|       |				**	of 34 which decodes to 64 samples.
  358|       |				*/
  359|    163|				error = aiff_ima_init (psf, AIFC_IMA4_BLOCK_LEN, AIFC_IMA4_SAMPLES_PER_BLOCK) ;
  ------------------
  |  |  107|    163|#define AIFC_IMA4_BLOCK_LEN				34
  ------------------
              				error = aiff_ima_init (psf, AIFC_IMA4_BLOCK_LEN, AIFC_IMA4_SAMPLES_PER_BLOCK) ;
  ------------------
  |  |  108|    163|#define AIFC_IMA4_SAMPLES_PER_BLOCK		64
  ------------------
  360|    163|				break ;
  361|       |		/* Lite remove end */
  362|       |
  363|    171|		case SF_FORMAT_GSM610 :
  ------------------
  |  Branch (363:3): [True: 171, False: 749]
  ------------------
  364|    171|				error = gsm610_init (psf) ;
  365|    171|				if (psf->sf.frames > comm_fmt.numSampleFrames)
  ------------------
  |  Branch (365:9): [True: 23, False: 148]
  ------------------
  366|     23|					psf->sf.frames = comm_fmt.numSampleFrames ;
  367|    171|				break ;
  368|       |
  369|    138|		default : return SFE_UNIMPLEMENTED ;
  ------------------
  |  Branch (369:3): [True: 138, False: 782]
  ------------------
  370|    920|		} ;
  371|       |
  372|    782|	if (psf->file.mode != SFM_WRITE && psf->sf.frames - comm_fmt.numSampleFrames != 0)
  ------------------
  |  Branch (372:6): [True: 782, False: 0]
  |  Branch (372:37): [True: 674, False: 108]
  ------------------
  373|    674|	{	psf_log_printf (psf,
  374|    674|			"*** Frame count read from 'COMM' chunk (%u) not equal to frame count\n"
  375|    674|			"*** calculated from length of 'SSND' chunk (%u).\n",
  376|    674|			comm_fmt.numSampleFrames, (uint32_t) psf->sf.frames) ;
  377|    674|		} ;
  378|       |
  379|    782|	return error ;
  380|    920|} /* aiff_open */
aiff.c:aiff_read_header:
  399|  3.07k|{	SSND_CHUNK	ssnd_fmt ;
  400|  3.07k|	AIFF_PRIVATE *paiff ;
  401|  3.07k|	BUF_UNION	ubuf ;
  402|  3.07k|	uint32_t	chunk_size = 0, FORMsize, SSNDsize, bytesread, mark_count = 0 ;
  403|  3.07k|	int			k, found_chunk = 0, done = 0, error = 0 ;
  404|  3.07k|	char		*cptr ;
  405|  3.07k|	int			instr_found = 0, mark_found = 0 ;
  406|  3.07k|	SF_CUE_POINT *cue_points = NULL ;
  407|       |
  408|  3.07k|	if (psf->filelength > 0xFFFFFFFFLL)
  ------------------
  |  Branch (408:6): [True: 0, False: 3.07k]
  ------------------
  409|      0|		psf_log_printf (psf, "Warning : filelength > 0xffffffff. This is bad!!!!\n") ;
  410|       |
  411|  3.07k|	if ((paiff = psf->container_data) == NULL)
  ------------------
  |  Branch (411:6): [True: 0, False: 3.07k]
  ------------------
  412|      0|		return SFE_INTERNAL ;
  413|       |
  414|  3.07k|	paiff->comm_offset = 0 ;
  415|  3.07k|	paiff->ssnd_offset = 0 ;
  416|       |
  417|       |	/* Set position to start of file to begin reading header. */
  418|  3.07k|	psf_binheader_readf (psf, "p", 0) ;
  419|       |
  420|  3.07k|	memset (comm_fmt, 0, sizeof (COMM_CHUNK)) ;
  421|       |
  422|       |	/* Until recently AIF* file were all BIG endian. */
  423|  3.07k|	psf->endian = SF_ENDIAN_BIG ;
  424|       |
  425|       |	/*	AIFF files can apparently have their chunks in any order. However, they
  426|       |	**	must have a FORM chunk. Approach here is to read all the chunks one by
  427|       |	**	one and then check for the mandatory chunks at the end.
  428|       |	*/
  429|  31.5k|	while (! done)
  ------------------
  |  Branch (429:9): [True: 31.5k, False: 21]
  ------------------
  430|  31.5k|	{	unsigned	marker ;
  431|  31.5k|		size_t jump = chunk_size & 1 ;
  432|       |
  433|  31.5k|		marker = chunk_size = 0 ;
  434|  31.5k|		psf_binheader_readf (psf, "Ejm4", jump, &marker, &chunk_size) ;
  435|  31.5k|		if (marker == 0)
  ------------------
  |  Branch (435:7): [True: 9, False: 31.5k]
  ------------------
  436|      9|		{	sf_count_t pos = psf_ftell (psf) ;
  437|      9|			psf_log_printf (psf, "Have 0 marker at position %D (0x%x).\n", pos, pos) ;
  438|      9|			break ;
  439|  31.5k|			} ;
  440|       |
  441|  31.5k|		if (psf->file.mode == SFM_RDWR && (found_chunk & HAVE_SSND))
  ------------------
  |  Branch (441:7): [True: 0, False: 31.5k]
  |  Branch (441:37): [True: 0, False: 0]
  ------------------
  442|      0|			return SFE_AIFF_RW_SSND_NOT_LAST ;
  443|       |
  444|  31.5k|		psf_store_read_chunk_u32 (&psf->rchunks, marker, psf_ftell (psf), chunk_size) ;
  445|       |
  446|  31.5k|		switch (marker)
  447|  31.5k|		{	case FORM_MARKER :
  ------------------
  |  |   38|  3.07k|#define FORM_MARKER		(MAKE_MARKER ('F', 'O', 'R', 'M'))
  |  |  ------------------
  |  |  |  |  122|  3.07k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (447:5): [True: 3.07k, False: 28.4k]
  ------------------
  448|  3.07k|					if (found_chunk)
  ------------------
  |  Branch (448:10): [True: 2, False: 3.07k]
  ------------------
  449|      2|						return SFE_AIFF_NO_FORM ;
  450|       |
  451|  3.07k|					FORMsize = chunk_size ;
  452|       |
  453|  3.07k|					found_chunk |= HAVE_FORM ;
  454|  3.07k|					psf_binheader_readf (psf, "m", &marker) ;
  455|  3.07k|					switch (marker)
  456|  3.07k|					{	case AIFC_MARKER :
  ------------------
  |  |   40|  2.34k|#define AIFC_MARKER		(MAKE_MARKER ('A', 'I', 'F', 'C'))
  |  |  ------------------
  |  |  |  |  122|  2.34k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (456:8): [True: 2.34k, False: 727]
  ------------------
  457|  3.07k|						case AIFF_MARKER :
  ------------------
  |  |   39|  3.07k|#define AIFF_MARKER		(MAKE_MARKER ('A', 'I', 'F', 'F'))
  |  |  ------------------
  |  |  |  |  122|  3.07k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (457:7): [True: 727, False: 2.34k]
  ------------------
  458|  3.07k|							found_chunk |= (marker == AIFC_MARKER) ? (HAVE_AIFC | HAVE_AIFF) : HAVE_AIFF ;
  ------------------
  |  |   40|  3.07k|#define AIFC_MARKER		(MAKE_MARKER ('A', 'I', 'F', 'C'))
  |  |  ------------------
  |  |  |  |  122|  3.07k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (458:23): [True: 2.34k, False: 727]
  ------------------
  459|  3.07k|							break ;
  460|      0|						default :
  ------------------
  |  Branch (460:7): [True: 0, False: 3.07k]
  ------------------
  461|      0|							break ;
  462|  3.07k|						} ;
  463|       |
  464|  3.07k|					if (psf->fileoffset > 0 && psf->filelength > FORMsize + 8)
  ------------------
  |  Branch (464:10): [True: 62, False: 3.00k]
  |  Branch (464:33): [True: 41, False: 21]
  ------------------
  465|     41|					{	/* Set file length. */
  466|     41|						psf->filelength = FORMsize + 8 ;
  467|     41|						psf_log_printf (psf, "FORM : %u\n %M\n", FORMsize, marker) ;
  468|     41|						}
  469|  3.02k|					else if (FORMsize != psf->filelength - 2 * SIGNED_SIZEOF (chunk_size))
  ------------------
  |  |   86|  3.02k|#define		SIGNED_SIZEOF(x)	((int) sizeof (x))
  ------------------
  |  Branch (469:15): [True: 3.02k, False: 2]
  ------------------
  470|  3.02k|					{	chunk_size = psf->filelength - 2 * sizeof (chunk_size) ;
  471|  3.02k|						psf_log_printf (psf, "FORM : %u (should be %u)\n %M\n", FORMsize, chunk_size, marker) ;
  472|  3.02k|						FORMsize = chunk_size ;
  473|  3.02k|						}
  474|      2|					else
  475|      2|						psf_log_printf (psf, "FORM : %u\n %M\n", FORMsize, marker) ;
  476|       |					/* Set this to 0, so we don't jump a byte when parsing the next marker. */
  477|  3.07k|					chunk_size = 0 ;
  478|  3.07k|					break ;
  479|       |
  480|       |
  481|  7.48k|			case COMM_MARKER :
  ------------------
  |  |   41|  7.48k|#define COMM_MARKER		(MAKE_MARKER ('C', 'O', 'M', 'M'))
  |  |  ------------------
  |  |  |  |  122|  7.48k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (481:4): [True: 7.48k, False: 24.0k]
  ------------------
  482|  7.48k|					paiff->comm_offset = psf_ftell (psf) - 8 ;
  483|  7.48k|					chunk_size += chunk_size & 1 ;
  484|  7.48k|					comm_fmt->size = chunk_size ;
  485|  7.48k|					if ((error = aiff_read_comm_chunk (psf, comm_fmt)) != 0)
  ------------------
  |  Branch (485:10): [True: 465, False: 7.01k]
  ------------------
  486|    465|						return error ;
  487|       |
  488|  7.01k|					found_chunk |= HAVE_COMM ;
  489|  7.01k|					break ;
  490|       |
  491|    626|			case PEAK_MARKER :
  ------------------
  |  |   56|    626|#define PEAK_MARKER		(MAKE_MARKER ('P', 'E', 'A', 'K'))
  |  |  ------------------
  |  |  |  |  122|    626|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (491:4): [True: 626, False: 30.9k]
  ------------------
  492|       |					/* Must have COMM chunk before PEAK chunk. */
  493|    626|					if ((found_chunk & (HAVE_FORM | HAVE_AIFF | HAVE_COMM)) != (HAVE_FORM | HAVE_AIFF | HAVE_COMM))
  ------------------
  |  Branch (493:10): [True: 1, False: 625]
  ------------------
  494|      1|						return SFE_AIFF_PEAK_B4_COMM ;
  495|       |
  496|    625|					psf_log_printf (psf, "%M : %d\n", marker, chunk_size) ;
  497|    625|					if (chunk_size != AIFF_PEAK_CHUNK_SIZE (psf->sf.channels))
  ------------------
  |  |  110|    625|#define AIFF_PEAK_CHUNK_SIZE(ch)	(2 * sizeof (int) + ch * (sizeof (float) + sizeof (int)))
  ------------------
  |  Branch (497:10): [True: 17, False: 608]
  ------------------
  498|     17|					{	psf_binheader_readf (psf, "j", chunk_size) ;
  499|     17|						psf_log_printf (psf, "*** File PEAK chunk too big.\n") ;
  500|     17|						return SFE_WAV_BAD_PEAK ;
  501|    608|						} ;
  502|       |
  503|    608|					if (psf->peak_info)
  ------------------
  |  Branch (503:10): [True: 415, False: 193]
  ------------------
  504|    415|					{	psf_log_printf (psf, "*** Found existing peak info, using last one.\n") ;
  505|    415|						free (psf->peak_info) ;
  506|    415|						psf->peak_info = NULL ;
  507|    415|						} ;
  508|    608|					if ((psf->peak_info = peak_info_calloc (psf->sf.channels)) == NULL)
  ------------------
  |  Branch (508:10): [True: 0, False: 608]
  ------------------
  509|      0|						return SFE_MALLOC_FAILED ;
  510|       |
  511|       |					/* Read in rest of PEAK chunk. */
  512|    608|					psf_binheader_readf (psf, "E44", &(psf->peak_info->version), &(psf->peak_info->timestamp)) ;
  513|       |
  514|    608|					if (psf->peak_info->version != 1)
  ------------------
  |  Branch (514:10): [True: 256, False: 352]
  ------------------
  515|    256|						psf_log_printf (psf, "  version    : %d *** (should be version 1)\n", psf->peak_info->version) ;
  516|    352|					else
  517|    352|						psf_log_printf (psf, "  version    : %d\n", psf->peak_info->version) ;
  518|       |
  519|    608|					psf_log_printf (psf, "  time stamp : %d\n", psf->peak_info->timestamp) ;
  520|    608|					psf_log_printf (psf, "    Ch   Position       Value\n") ;
  521|       |
  522|    608|					cptr = ubuf.cbuf ;
  523|  4.60k|					for (k = 0 ; k < psf->sf.channels ; k++)
  ------------------
  |  Branch (523:19): [True: 3.99k, False: 608]
  ------------------
  524|  3.99k|					{	float value ;
  525|  3.99k|						uint32_t position ;
  526|       |
  527|  3.99k|						psf_binheader_readf (psf, "Ef4", &value, &position) ;
  528|  3.99k|						psf->peak_info->peaks [k].value = value ;
  529|  3.99k|						psf->peak_info->peaks [k].position = position ;
  530|       |
  531|  3.99k|						snprintf (cptr, sizeof (ubuf.scbuf), "    %2d   %-12" PRId64 "   %g\n",
  532|  3.99k|								k, psf->peak_info->peaks [k].position, psf->peak_info->peaks [k].value) ;
  533|  3.99k|						cptr [sizeof (ubuf.scbuf) - 1] = 0 ;
  534|  3.99k|						psf_log_printf (psf, "%s", cptr) ;
  535|  3.99k|						} ;
  536|       |
  537|    608|					psf->peak_info->peak_loc = ((found_chunk & HAVE_SSND) == 0) ? SF_PEAK_START : SF_PEAK_END ;
  ------------------
  |  Branch (537:33): [True: 465, False: 143]
  ------------------
  538|    608|					break ;
  539|       |
  540|  1.83k|			case SSND_MARKER :
  ------------------
  |  |   42|  1.83k|#define SSND_MARKER		(MAKE_MARKER ('S', 'S', 'N', 'D'))
  |  |  ------------------
  |  |  |  |  122|  1.83k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (540:4): [True: 1.83k, False: 29.6k]
  ------------------
  541|  1.83k|					if ((found_chunk & HAVE_AIFC) && (found_chunk & HAVE_FVER) == 0)
  ------------------
  |  Branch (541:10): [True: 1.43k, False: 400]
  |  Branch (541:39): [True: 1.39k, False: 40]
  ------------------
  542|  1.39k|						psf_log_printf (psf, "*** Valid AIFC files should have an FVER chunk.\n") ;
  543|       |
  544|  1.83k|					paiff->ssnd_offset = psf_ftell (psf) - 8 ;
  545|  1.83k|					SSNDsize = chunk_size ;
  546|  1.83k|					psf_binheader_readf (psf, "E44", &(ssnd_fmt.offset), &(ssnd_fmt.blocksize)) ;
  547|       |
  548|  1.83k|					psf->datalength = SSNDsize - sizeof (ssnd_fmt) ;
  549|  1.83k|					psf->dataoffset = psf_ftell (psf) ;
  550|       |
  551|  1.83k|					if (psf->datalength > psf->filelength - psf->dataoffset || psf->datalength < 0)
  ------------------
  |  Branch (551:10): [True: 400, False: 1.43k]
  |  Branch (551:65): [True: 46, False: 1.39k]
  ------------------
  552|    446|					{	psf_log_printf (psf, " SSND : %u (should be %D)\n", SSNDsize, psf->filelength - psf->dataoffset + sizeof (SSND_CHUNK)) ;
  553|    446|						psf->datalength = psf->filelength - psf->dataoffset ;
  554|    446|						}
  555|  1.39k|					else
  556|  1.39k|						psf_log_printf (psf, " SSND : %u\n", SSNDsize) ;
  557|       |
  558|  1.83k|					if (ssnd_fmt.offset == 0 || psf->dataoffset + ssnd_fmt.offset == ssnd_fmt.blocksize)
  ------------------
  |  Branch (558:10): [True: 591, False: 1.24k]
  |  Branch (558:34): [True: 1, False: 1.24k]
  ------------------
  559|    592|					{	psf_log_printf (psf, "  Offset     : %u\n", ssnd_fmt.offset) ;
  560|    592|						psf_log_printf (psf, "  Block Size : %u\n", ssnd_fmt.blocksize) ;
  561|       |
  562|    592|						psf->dataoffset += ssnd_fmt.offset ;
  563|    592|						psf->datalength -= ssnd_fmt.offset ;
  564|    592|						}
  565|  1.24k|					else
  566|  1.24k|					{	psf_log_printf (psf, "  Offset     : %u\n", ssnd_fmt.offset) ;
  567|  1.24k|						psf_log_printf (psf, "  Block Size : %u ???\n", ssnd_fmt.blocksize) ;
  568|  1.24k|						psf->dataoffset += ssnd_fmt.offset ;
  569|  1.24k|						psf->datalength -= ssnd_fmt.offset ;
  570|  1.24k|						} ;
  571|       |
  572|       |					/* Only set dataend if there really is data at the end. */
  573|  1.83k|					if (psf->datalength + psf->dataoffset < psf->filelength)
  ------------------
  |  Branch (573:10): [True: 1.38k, False: 453]
  ------------------
  574|  1.38k|						psf->dataend = psf->datalength + psf->dataoffset ;
  575|       |
  576|  1.83k|					found_chunk |= HAVE_SSND ;
  577|       |
  578|  1.83k|					if (! psf->sf.seekable)
  ------------------
  |  Branch (578:10): [True: 0, False: 1.83k]
  ------------------
  579|      0|						break ;
  580|       |
  581|       |					/* Seek to end of SSND chunk. */
  582|  1.83k|					psf_fseek (psf, psf->dataoffset + psf->datalength, SEEK_SET) ;
  583|  1.83k|					break ;
  584|       |
  585|  1.74k|			case c_MARKER :
  ------------------
  |  |   48|  1.74k|#define c_MARKER		(MAKE_MARKER ('(', 'c', ')', ' '))
  |  |  ------------------
  |  |  |  |  122|  1.74k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (585:4): [True: 1.74k, False: 29.7k]
  ------------------
  586|  1.74k|					if (chunk_size == 0)
  ------------------
  |  Branch (586:10): [True: 1.47k, False: 273]
  ------------------
  587|  1.47k|						break ;
  588|    273|					if (chunk_size >= SIGNED_SIZEOF (ubuf.scbuf))
  ------------------
  |  |   86|    273|#define		SIGNED_SIZEOF(x)	((int) sizeof (x))
  ------------------
  |  Branch (588:10): [True: 19, False: 254]
  ------------------
  589|     19|					{	psf_log_printf (psf, " %M : %d (too big)\n", marker, chunk_size) ;
  590|     19|						return SFE_INTERNAL ;
  591|    254|						} ;
  592|       |
  593|    254|					cptr = ubuf.cbuf ;
  594|    254|					psf_binheader_readf (psf, "b", cptr, chunk_size + (chunk_size & 1)) ;
  595|    254|					cptr [chunk_size] = 0 ;
  596|       |
  597|    254|					psf_sanitize_string (cptr, chunk_size) ;
  598|       |
  599|    254|					psf_log_printf (psf, " %M : %s\n", marker, cptr) ;
  600|    254|					psf_store_string (psf, SF_STR_COPYRIGHT, cptr) ;
  601|    254|					chunk_size += chunk_size & 1 ;
  602|    254|					break ;
  603|       |
  604|    734|			case AUTH_MARKER :
  ------------------
  |  |   50|    734|#define AUTH_MARKER		(MAKE_MARKER ('A', 'U', 'T', 'H'))
  |  |  ------------------
  |  |  |  |  122|    734|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (604:4): [True: 734, False: 30.7k]
  ------------------
  605|    734|					if (chunk_size == 0)
  ------------------
  |  Branch (605:10): [True: 427, False: 307]
  ------------------
  606|    427|						break ;
  607|    307|					if (chunk_size >= SIGNED_SIZEOF (ubuf.scbuf) - 1)
  ------------------
  |  |   86|    307|#define		SIGNED_SIZEOF(x)	((int) sizeof (x))
  ------------------
  |  Branch (607:10): [True: 17, False: 290]
  ------------------
  608|     17|					{	psf_log_printf (psf, " %M : %d (too big)\n", marker, chunk_size) ;
  609|     17|						return SFE_INTERNAL ;
  610|    290|						} ;
  611|       |
  612|    290|					cptr = ubuf.cbuf ;
  613|    290|					psf_binheader_readf (psf, "b", cptr, chunk_size + (chunk_size & 1)) ;
  614|    290|					cptr [chunk_size] = 0 ;
  615|    290|					psf_log_printf (psf, " %M : %s\n", marker, cptr) ;
  616|    290|					psf_store_string (psf, SF_STR_ARTIST, cptr) ;
  617|    290|					chunk_size += chunk_size & 1 ;
  618|    290|					break ;
  619|       |
  620|    501|			case COMT_MARKER :
  ------------------
  |  |   52|    501|#define COMT_MARKER		(MAKE_MARKER ('C', 'O', 'M', 'T'))
  |  |  ------------------
  |  |  |  |  122|    501|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (620:4): [True: 501, False: 31.0k]
  ------------------
  621|    501|				{	uint16_t count, id, len ;
  622|    501|					uint32_t timestamp, bytes ;
  623|       |
  624|    501|					if (chunk_size == 0)
  ------------------
  |  Branch (624:10): [True: 75, False: 426]
  ------------------
  625|     75|						break ;
  626|    426|					bytes = chunk_size ;
  627|    426|					bytes -= psf_binheader_readf (psf, "E2", &count) ;
  628|    426|					psf_log_printf (psf, " %M : %d\n  count  : %d\n", marker, chunk_size, count) ;
  629|       |
  630|   684k|					for (k = 0 ; k < count ; k++)
  ------------------
  |  Branch (630:19): [True: 683k, False: 424]
  ------------------
  631|   683k|					{	bytes -= psf_binheader_readf (psf, "E422", &timestamp, &id, &len) ;
  632|   683k|						psf_log_printf (psf, "   time   : 0x%x\n   marker : %x\n   length : %d\n", timestamp, id, len) ;
  633|       |
  634|   683k|						if (len + 1 > SIGNED_SIZEOF (ubuf.scbuf))
  ------------------
  |  |   86|   683k|#define		SIGNED_SIZEOF(x)	((int) sizeof (x))
  ------------------
  |  Branch (634:11): [True: 2, False: 683k]
  ------------------
  635|      2|						{	psf_log_printf (psf, "\nError : string length (%d) too big.\n", len) ;
  636|      2|							return SFE_INTERNAL ;
  637|   683k|							} ;
  638|       |
  639|   683k|						cptr = ubuf.cbuf ;
  640|   683k|						bytes -= psf_binheader_readf (psf, "b", cptr, len) ;
  641|   683k|						cptr [len] = 0 ;
  642|   683k|						psf_log_printf (psf, "   string : %s\n", cptr) ;
  643|   683k|						} ;
  644|       |
  645|    424|					if (bytes > 0)
  ------------------
  |  Branch (645:10): [True: 150, False: 274]
  ------------------
  646|    150|						psf_binheader_readf (psf, "j", bytes) ;
  647|    424|					} ;
  648|    424|					break ;
  649|       |
  650|  5.20k|			case APPL_MARKER :
  ------------------
  |  |   45|  5.20k|#define APPL_MARKER		(MAKE_MARKER ('A', 'P', 'P', 'L'))
  |  |  ------------------
  |  |  |  |  122|  5.20k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (650:4): [True: 5.20k, False: 26.3k]
  ------------------
  651|  5.20k|				{	unsigned appl_marker ;
  652|       |
  653|  5.20k|					if (chunk_size == 0)
  ------------------
  |  Branch (653:10): [True: 4.33k, False: 871]
  ------------------
  654|  4.33k|						break ;
  655|    871|					if (chunk_size >= SIGNED_SIZEOF (ubuf.scbuf) - 1)
  ------------------
  |  |   86|    871|#define		SIGNED_SIZEOF(x)	((int) sizeof (x))
  ------------------
  |  Branch (655:10): [True: 76, False: 795]
  ------------------
  656|     76|					{	psf_log_printf (psf, " %M : %u (too big, skipping)\n", marker, chunk_size) ;
  657|     76|						psf_binheader_readf (psf, "j", chunk_size + (chunk_size & 1)) ;
  658|     76|						break ;
  659|    795|						} ;
  660|       |
  661|    795|					if (chunk_size < 4)
  ------------------
  |  Branch (661:10): [True: 205, False: 590]
  ------------------
  662|    205|					{	psf_log_printf (psf, " %M : %d (too small, skipping)\n", marker, chunk_size) ;
  663|    205|						psf_binheader_readf (psf, "j", chunk_size + (chunk_size & 1)) ;
  664|    205|						break ;
  665|    590|						} ;
  666|       |
  667|    590|					cptr = ubuf.cbuf ;
  668|    590|					psf_binheader_readf (psf, "mb", &appl_marker, cptr, chunk_size + (chunk_size & 1) - 4) ;
  669|    590|					cptr [chunk_size] = 0 ;
  670|       |
  671|  2.40k|					for (k = 0 ; k < (int) chunk_size ; k++)
  ------------------
  |  Branch (671:19): [True: 2.02k, False: 383]
  ------------------
  672|  2.02k|						if (! psf_isprint (cptr [k]))
  ------------------
  |  Branch (672:11): [True: 207, False: 1.81k]
  ------------------
  673|    207|						{	cptr [k] = 0 ;
  674|    207|							break ;
  675|    207|							} ;
  676|       |
  677|    590|					psf_log_printf (psf, " %M : %d\n  AppSig : %M\n  Name   : %s\n", marker, chunk_size, appl_marker, cptr) ;
  678|    590|					psf_store_string (psf, SF_STR_SOFTWARE, cptr) ;
  679|    590|					chunk_size += chunk_size & 1 ;
  680|    590|					} ;
  681|    590|					break ;
  682|       |
  683|    198|			case NAME_MARKER :
  ------------------
  |  |   49|    198|#define NAME_MARKER		(MAKE_MARKER ('N', 'A', 'M', 'E'))
  |  |  ------------------
  |  |  |  |  122|    198|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (683:4): [True: 198, False: 31.3k]
  ------------------
  684|    198|					if (chunk_size == 0)
  ------------------
  |  Branch (684:10): [True: 72, False: 126]
  ------------------
  685|     72|						break ;
  686|    126|					if (chunk_size >= SIGNED_SIZEOF (ubuf.scbuf) - 2)
  ------------------
  |  |   86|    126|#define		SIGNED_SIZEOF(x)	((int) sizeof (x))
  ------------------
  |  Branch (686:10): [True: 43, False: 83]
  ------------------
  687|     43|					{	psf_log_printf (psf, " %M : %d (too big)\n", marker, chunk_size) ;
  688|     43|						return SFE_INTERNAL ;
  689|     83|						} ;
  690|       |
  691|     83|					cptr = ubuf.cbuf ;
  692|     83|					psf_binheader_readf (psf, "b", cptr, chunk_size + (chunk_size & 1)) ;
  693|     83|					cptr [chunk_size] = 0 ;
  694|     83|					psf_log_printf (psf, " %M : %s\n", marker, cptr) ;
  695|     83|					psf_store_string (psf, SF_STR_TITLE, cptr) ;
  696|     83|					chunk_size += chunk_size & 1 ;
  697|     83|					break ;
  698|       |
  699|    815|			case ANNO_MARKER :
  ------------------
  |  |   51|    815|#define ANNO_MARKER		(MAKE_MARKER ('A', 'N', 'N', 'O'))
  |  |  ------------------
  |  |  |  |  122|    815|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (699:4): [True: 815, False: 30.7k]
  ------------------
  700|    815|					if (chunk_size == 0)
  ------------------
  |  Branch (700:10): [True: 427, False: 388]
  ------------------
  701|    427|						break ;
  702|    388|					if (chunk_size >= SIGNED_SIZEOF (ubuf.scbuf) - 2)
  ------------------
  |  |   86|    388|#define		SIGNED_SIZEOF(x)	((int) sizeof (x))
  ------------------
  |  Branch (702:10): [True: 41, False: 347]
  ------------------
  703|     41|					{	psf_log_printf (psf, " %M : %d (too big)\n", marker, chunk_size) ;
  704|     41|						return SFE_INTERNAL ;
  705|    347|						} ;
  706|       |
  707|    347|					cptr = ubuf.cbuf ;
  708|    347|					psf_binheader_readf (psf, "b", cptr, chunk_size + (chunk_size & 1)) ;
  709|    347|					cptr [chunk_size] = 0 ;
  710|    347|					psf_log_printf (psf, " %M : %s\n", marker, cptr) ;
  711|    347|					psf_store_string (psf, SF_STR_COMMENT, cptr) ;
  712|    347|					chunk_size += chunk_size & 1 ;
  713|    347|					break ;
  714|       |
  715|  1.53k|			case INST_MARKER :
  ------------------
  |  |   44|  1.53k|#define INST_MARKER		(MAKE_MARKER ('I', 'N', 'S', 'T'))
  |  |  ------------------
  |  |  |  |  122|  1.53k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (715:4): [True: 1.53k, False: 29.9k]
  ------------------
  716|  1.53k|					if (chunk_size != SIZEOF_INST_CHUNK)
  ------------------
  |  |  102|  1.53k|#define SIZEOF_INST_CHUNK		20
  ------------------
  |  Branch (716:10): [True: 369, False: 1.16k]
  ------------------
  717|    369|					{	psf_log_printf (psf, " %M : %d (should be %d)\n", marker, chunk_size, SIZEOF_INST_CHUNK) ;
  ------------------
  |  |  102|    369|#define SIZEOF_INST_CHUNK		20
  ------------------
  718|    369|						psf_binheader_readf (psf, "j", chunk_size) ;
  719|    369|						break ;
  720|  1.16k|						} ;
  721|  1.16k|					psf_log_printf (psf, " %M : %d\n", marker, chunk_size) ;
  722|  1.16k|					{	uint8_t bytes [6] ;
  723|  1.16k|						int16_t gain ;
  724|       |
  725|  1.16k|						if (psf->instrument == NULL && (psf->instrument = psf_instrument_alloc ()) == NULL)
  ------------------
  |  Branch (725:11): [True: 81, False: 1.08k]
  |  Branch (725:38): [True: 0, False: 81]
  ------------------
  726|      0|							return SFE_MALLOC_FAILED ;
  727|       |
  728|  1.16k|						psf_binheader_readf (psf, "b", bytes, 6) ;
  729|  1.16k|						psf_log_printf (psf, "  Base Note : %u\n  Detune    : %u\n"
  730|  1.16k|											"  Low  Note : %u\n  High Note : %u\n"
  731|  1.16k|											"  Low  Vel. : %u\n  High Vel. : %u\n",
  732|  1.16k|											bytes [0], bytes [1], bytes [2], bytes [3], bytes [4], bytes [5]) ;
  733|  1.16k|						psf->instrument->basenote = bytes [0] ;
  734|  1.16k|						psf->instrument->detune = bytes [1] ;
  735|  1.16k|						psf->instrument->key_lo = bytes [2] ;
  736|  1.16k|						psf->instrument->key_hi = bytes [3] ;
  737|  1.16k|						psf->instrument->velocity_lo = bytes [4] ;
  738|  1.16k|						psf->instrument->velocity_hi = bytes [5] ;
  739|  1.16k|						psf_binheader_readf (psf, "E2", &gain) ;
  740|  1.16k|						psf->instrument->gain = gain ;
  741|  1.16k|						psf_log_printf (psf, "  Gain (dB) : %d\n", gain) ;
  742|  1.16k|						} ;
  743|  1.16k|					{	int16_t	mode ; /* 0 - no loop, 1 - forward looping, 2 - backward looping */
  744|  1.16k|						const char	*loop_mode ;
  745|  1.16k|						uint16_t begin, end ;
  746|       |
  747|  1.16k|						psf_binheader_readf (psf, "E222", &mode, &begin, &end) ;
  748|  1.16k|						loop_mode = get_loop_mode_str (mode) ;
  749|  1.16k|						mode = get_loop_mode (mode) ;
  750|  1.16k|						if (mode == SF_LOOP_NONE)
  ------------------
  |  Branch (750:11): [True: 668, False: 498]
  ------------------
  751|    668|						{	psf->instrument->loop_count = 0 ;
  752|    668|							psf->instrument->loops [0].mode = SF_LOOP_NONE ;
  753|    668|							}
  754|    498|						else
  755|    498|						{	psf->instrument->loop_count = 1 ;
  756|    498|							psf->instrument->loops [0].mode = SF_LOOP_FORWARD ;
  757|    498|							psf->instrument->loops [0].start = begin ;
  758|    498|							psf->instrument->loops [0].end = end ;
  759|    498|							psf->instrument->loops [0].count = 0 ;
  760|    498|							} ;
  761|  1.16k|						psf_log_printf (psf, "  Sustain\n   mode  : %d => %s\n   begin : %u\n   end   : %u\n",
  762|  1.16k|											mode, loop_mode, begin, end) ;
  763|  1.16k|						psf_binheader_readf (psf, "E222", &mode, &begin, &end) ;
  764|  1.16k|						loop_mode = get_loop_mode_str (mode) ;
  765|  1.16k|						mode = get_loop_mode (mode) ;
  766|  1.16k|						if (mode == SF_LOOP_NONE)
  ------------------
  |  Branch (766:11): [True: 779, False: 387]
  ------------------
  767|    779|							psf->instrument->loops [1].mode = SF_LOOP_NONE ;
  768|    387|						else
  769|    387|						{	psf->instrument->loop_count += 1 ;
  770|    387|							psf->instrument->loops [1].mode = SF_LOOP_FORWARD ;
  771|    387|							psf->instrument->loops [1].start = begin ;
  772|    387|							psf->instrument->loops [1].end = end ;
  773|    387|							psf->instrument->loops [1].count = 0 ;
  774|    387|							} ;
  775|  1.16k|						psf_log_printf (psf, "  Release\n   mode  : %d => %s\n   begin : %u\n   end   : %u\n",
  776|  1.16k|										mode, loop_mode, begin, end) ;
  777|  1.16k|						} ;
  778|  1.16k|					instr_found++ ;
  779|  1.16k|					break ;
  780|       |
  781|    615|			case basc_MARKER :
  ------------------
  |  |   57|    615|#define basc_MARKER		(MAKE_MARKER ('b', 'a', 's', 'c'))
  |  |  ------------------
  |  |  |  |  122|    615|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (781:4): [True: 615, False: 30.9k]
  ------------------
  782|    615|					psf_log_printf (psf, " basc : %u\n", chunk_size) ;
  783|       |
  784|    615|					if ((error = aiff_read_basc_chunk (psf, chunk_size)))
  ------------------
  |  Branch (784:10): [True: 0, False: 615]
  ------------------
  785|      0|						return error ;
  786|    615|					break ;
  787|       |
  788|    716|			case MARK_MARKER :
  ------------------
  |  |   43|    716|#define MARK_MARKER		(MAKE_MARKER ('M', 'A', 'R', 'K'))
  |  |  ------------------
  |  |  |  |  122|    716|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (788:4): [True: 716, False: 30.8k]
  ------------------
  789|    716|					psf_log_printf (psf, " %M : %d\n", marker, chunk_size) ;
  790|    716|					{	uint16_t mark_id, n = 0 ;
  791|    716|						uint32_t position ;
  792|       |
  793|    716|						bytesread = psf_binheader_readf (psf, "E2", &n) ;
  794|    716|						mark_count = n ;
  795|    716|						psf_log_printf (psf, "  Count : %u\n", mark_count) ;
  796|    716|						if (paiff->markstr != NULL)
  ------------------
  |  Branch (796:11): [True: 623, False: 93]
  ------------------
  797|    623|						{	psf_log_printf (psf, "*** Second MARK chunk found. Throwing away the first.\n") ;
  798|    623|							free (paiff->markstr) ;
  799|    623|							} ;
  800|    716|						paiff->markstr = calloc (mark_count, sizeof (MARK_ID_POS)) ;
  801|    716|						if (paiff->markstr == NULL)
  ------------------
  |  Branch (801:11): [True: 0, False: 716]
  ------------------
  802|      0|							return SFE_MALLOC_FAILED ;
  803|       |
  804|    716|						if (mark_count > 2500) /* 2500 is close to the largest number of cues possible because of block sizes */
  ------------------
  |  Branch (804:11): [True: 228, False: 488]
  ------------------
  805|    228|						{	psf_log_printf (psf, "  More than 2500 markers, skipping!\n") ;
  806|    228|							psf_binheader_readf (psf, "j", chunk_size - bytesread) ;
  807|    228|							break ;
  808|    488|						} ;
  809|       |
  810|    488|						if (psf->cues)
  ------------------
  |  Branch (810:11): [True: 409, False: 79]
  ------------------
  811|    409|						{	free (psf->cues) ;
  812|    409|							psf->cues = NULL ;
  813|    409|							} ;
  814|    488|						if ((psf->cues = psf_cues_alloc (mark_count)) == NULL)
  ------------------
  |  Branch (814:11): [True: 0, False: 488]
  ------------------
  815|      0|							return SFE_MALLOC_FAILED ;
  816|       |
  817|    488|						cue_points = psf_cues_points (psf->cues) ;
  818|       |
  819|  35.7k|						for (n = 0 ; n < mark_count && bytesread < chunk_size ; n++)
  ------------------
  |  Branch (819:20): [True: 35.3k, False: 382]
  |  Branch (819:38): [True: 35.2k, False: 106]
  ------------------
  820|  35.2k|						{	uint32_t pstr_len ;
  821|  35.2k|							uint8_t ch ;
  822|       |
  823|  35.2k|							bytesread += psf_binheader_readf (psf, "E241", &mark_id, &position, &ch) ;
  824|  35.2k|							psf_log_printf (psf, "   Mark ID  : %u\n   Position : %u\n", mark_id, position) ;
  825|       |
  826|  35.2k|							cue_points [n].indx = mark_id ;
  827|  35.2k|							cue_points [n].position = 0 ;
  828|  35.2k|							cue_points [n].fcc_chunk = MAKE_MARKER ('d', 'a', 't', 'a') ; /* always data */
  ------------------
  |  |  122|  35.2k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
  829|  35.2k|							cue_points [n].chunk_start = 0 ;
  830|  35.2k|							cue_points [n].block_start = 0 ;
  831|  35.2k|							cue_points [n].sample_offset = position ;
  832|       |
  833|  35.2k|							pstr_len = (ch & 1) ? ch : ch + 1 ;
  ------------------
  |  Branch (833:19): [True: 206, False: 35.0k]
  ------------------
  834|       |
  835|  35.2k|							if (pstr_len < sizeof (ubuf.scbuf) - 1)
  ------------------
  |  Branch (835:12): [True: 35.2k, False: 0]
  ------------------
  836|  35.2k|							{	bytesread += psf_binheader_readf (psf, "b", ubuf.scbuf, pstr_len) ;
  837|  35.2k|								ubuf.scbuf [pstr_len] = 0 ;
  838|  35.2k|								}
  839|      0|							else
  840|      0|							{	uint32_t read_len = pstr_len - (sizeof (ubuf.scbuf) - 1) ;
  841|      0|								bytesread += psf_binheader_readf (psf, "bj", ubuf.scbuf, read_len, pstr_len - read_len) ;
  842|      0|								ubuf.scbuf [sizeof (ubuf.scbuf) - 1] = 0 ;
  843|      0|								}
  844|       |
  845|  35.2k|							psf_log_printf (psf, "   Name     : %s\n", ubuf.scbuf) ;
  846|       |
  847|  35.2k|							psf_strlcpy (cue_points [n].name, sizeof (cue_points [n].name), ubuf.cbuf) ;
  848|       |
  849|  35.2k|							paiff->markstr [n].markerID = mark_id ;
  850|  35.2k|							paiff->markstr [n].position = position ;
  851|       |							/*
  852|       |							**	TODO if ubuf.scbuf is equal to
  853|       |							**	either Beg_loop, Beg loop or beg loop and spam
  854|       |							**	if (psf->instrument == NULL && (psf->instrument = psf_instrument_alloc ()) == NULL)
  855|       |							**		return SFE_MALLOC_FAILED ;
  856|       |							*/
  857|  35.2k|							} ;
  858|    488|						} ;
  859|    488|					mark_found++ ;
  860|    488|					psf_binheader_readf (psf, "j", chunk_size - bytesread) ;
  861|    488|					break ;
  862|       |
  863|    214|			case FVER_MARKER :
  ------------------
  |  |   53|    214|#define FVER_MARKER		(MAKE_MARKER ('F', 'V', 'E', 'R'))
  |  |  ------------------
  |  |  |  |  122|    214|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (863:4): [True: 214, False: 31.3k]
  ------------------
  864|    214|					found_chunk |= HAVE_FVER ;
  865|       |					/* Falls through. */
  866|       |
  867|    421|			case SFX_MARKER :
  ------------------
  |  |   54|    421|#define SFX_MARKER		(MAKE_MARKER ('S', 'F', 'X', '!'))
  |  |  ------------------
  |  |  |  |  122|    421|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (867:4): [True: 207, False: 31.3k]
  ------------------
  868|    421|					psf_log_printf (psf, " %M : %d\n", marker, chunk_size) ;
  869|    421|					psf_binheader_readf (psf, "j", chunk_size) ;
  870|    421|					break ;
  871|       |
  872|    204|			case NONE_MARKER :
  ------------------
  |  |   60|    204|#define NONE_MARKER		(MAKE_MARKER ('N', 'O', 'N', 'E'))
  |  |  ------------------
  |  |  |  |  122|    204|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (872:4): [True: 204, False: 31.3k]
  ------------------
  873|       |					/* Fix for broken AIFC files with incorrect COMM chunk length. */
  874|    204|					chunk_size = (chunk_size >> 24) - 3 ;
  875|    204|					psf_log_printf (psf, " %M : %d\n", marker, chunk_size) ;
  876|    204|					psf_binheader_readf (psf, "j", make_size_t (chunk_size)) ;
  877|    204|					break ;
  878|       |
  879|  1.96k|			case CHAN_MARKER :
  ------------------
  |  |   46|  1.96k|#define CHAN_MARKER		(MAKE_MARKER ('C', 'H', 'A', 'N'))
  |  |  ------------------
  |  |  |  |  122|  1.96k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (879:4): [True: 1.96k, False: 29.5k]
  ------------------
  880|  1.96k|					if (chunk_size < 12)
  ------------------
  |  Branch (880:10): [True: 304, False: 1.66k]
  ------------------
  881|    304|					{	psf_log_printf (psf, " %M : %d (should be >= 12)\n", marker, chunk_size) ;
  882|    304|						psf_binheader_readf (psf, "j", chunk_size) ;
  883|    304|						break ;
  884|    304|						}
  885|       |
  886|  1.66k|					psf_log_printf (psf, " %M : %d\n", marker, chunk_size) ;
  887|       |
  888|  1.66k|					if ((error = aiff_read_chanmap (psf, chunk_size)))
  ------------------
  |  Branch (888:10): [True: 0, False: 1.66k]
  ------------------
  889|      0|						return error ;
  890|  1.66k|					break ;
  891|       |
  892|  3.85k|			default :
  ------------------
  |  Branch (892:4): [True: 3.85k, False: 27.6k]
  ------------------
  893|  3.85k|					if (chunk_size >= 0xffff0000)
  ------------------
  |  Branch (893:10): [True: 40, False: 3.81k]
  ------------------
  894|     40|					{	done = SF_TRUE ;
  895|     40|						psf_log_printf (psf, "*** Unknown chunk marker (%X) at position %D with length %u. Exiting parser.\n", marker, psf_ftell (psf) - 8, chunk_size) ;
  896|     40|						break ;
  897|  3.81k|						} ;
  898|       |
  899|  3.81k|					if (psf_isprint ((marker >> 24) & 0xFF) && psf_isprint ((marker >> 16) & 0xFF)
  ------------------
  |  Branch (899:10): [True: 3.26k, False: 546]
  |  Branch (899:49): [True: 2.79k, False: 473]
  ------------------
  900|  2.79k|						&& psf_isprint ((marker >> 8) & 0xFF) && psf_isprint (marker & 0xFF))
  ------------------
  |  Branch (900:10): [True: 2.17k, False: 624]
  |  Branch (900:48): [True: 1.65k, False: 511]
  ------------------
  901|  1.65k|					{	psf_log_printf (psf, " %M : %u (unknown marker)\n", marker, chunk_size) ;
  902|       |
  903|  1.65k|						psf_binheader_readf (psf, "j", chunk_size) ;
  904|  1.65k|						break ;
  905|  2.15k|						} ;
  906|       |
  907|  2.15k|					if (psf_ftell (psf) & 0x03)
  ------------------
  |  Branch (907:10): [True: 1.68k, False: 466]
  ------------------
  908|  1.68k|					{	psf_log_printf (psf, "  Unknown chunk marker at position %D. Resynching.\n", psf_ftell (psf) - 8) ;
  909|  1.68k|						psf_binheader_readf (psf, "j", -3) ;
  910|  1.68k|						break ;
  911|  1.68k|						} ;
  912|    466|					psf_log_printf (psf, "*** Unknown chunk marker %X at position %D. Exiting parser.\n", marker, psf_ftell (psf)) ;
  913|    466|					done = SF_TRUE ;
  914|    466|					break ;
  915|  31.5k|			} ;	/* switch (marker) */
  916|       |
  917|  30.9k|		if (chunk_size >= psf->filelength)
  ------------------
  |  Branch (917:7): [True: 1.84k, False: 29.0k]
  ------------------
  918|  1.84k|		{	psf_log_printf (psf, "*** Chunk size %u > file length %D. Exiting parser.\n", chunk_size, psf->filelength) ;
  919|  1.84k|			break ;
  920|  29.0k|			} ;
  921|       |
  922|  29.0k|		if ((! psf->sf.seekable) && (found_chunk & HAVE_SSND))
  ------------------
  |  Branch (922:7): [True: 0, False: 29.0k]
  |  Branch (922:31): [True: 0, False: 0]
  ------------------
  923|      0|			break ;
  924|       |
  925|  29.0k|		if (psf_ftell (psf) >= psf->filelength - (2 * SIGNED_SIZEOF (int32_t)))
  ------------------
  |  |   86|  29.0k|#define		SIGNED_SIZEOF(x)	((int) sizeof (x))
  ------------------
  |  Branch (925:7): [True: 589, False: 28.4k]
  ------------------
  926|    589|			break ;
  927|  29.0k|		} ; /* while (1) */
  928|       |
  929|  2.46k|	if (instr_found && mark_found)
  ------------------
  |  Branch (929:6): [True: 81, False: 2.38k]
  |  Branch (929:21): [True: 32, False: 49]
  ------------------
  930|     32|	{	int ji, str_index ;
  931|       |		/* Next loop will convert markers to loop positions for internal handling */
  932|     63|		for (ji = 0 ; ji < psf->instrument->loop_count ; ji ++)
  ------------------
  |  Branch (932:17): [True: 31, False: 32]
  ------------------
  933|     31|		{	if (ji < ARRAY_LEN (psf->instrument->loops))
  ------------------
  |  |   88|     31|#define		ARRAY_LEN(x)	((int) (sizeof (x) / sizeof ((x) [0])))
  ------------------
  |  Branch (933:9): [True: 31, False: 0]
  ------------------
  934|     31|			{	psf->instrument->loops [ji].start = marker_to_position (paiff->markstr, psf->instrument->loops [ji].start, mark_count) ;
  935|     31|				psf->instrument->loops [ji].end = marker_to_position (paiff->markstr, psf->instrument->loops [ji].end, mark_count) ;
  936|     31|				psf->instrument->loops [ji].mode = SF_LOOP_FORWARD ;
  937|     31|				} ;
  938|     31|			} ;
  939|       |
  940|       |		/* The markers that correspond to loop positions can now be removed from cues struct */
  941|     32|		if (psf->cues->cue_count > (uint32_t) (psf->instrument->loop_count * 2))
  ------------------
  |  Branch (941:7): [True: 29, False: 3]
  ------------------
  942|     29|		{	uint32_t j ;
  943|       |
  944|  14.8k|			for (j = 0 ; j < psf->cues->cue_count - (uint32_t) (psf->instrument->loop_count * 2) ; j ++)
  ------------------
  |  Branch (944:17): [True: 14.7k, False: 29]
  ------------------
  945|  14.7k|			{	/* This simply copies the information in cues above loop positions and writes it at current count instead */
  946|  14.7k|				cue_points [j].indx = cue_points [j + psf->instrument->loop_count * 2].indx ;
  947|  14.7k|				cue_points [j].position = cue_points [j + psf->instrument->loop_count * 2].position ;
  948|  14.7k|				cue_points [j].fcc_chunk = cue_points [j + psf->instrument->loop_count * 2].fcc_chunk ;
  949|  14.7k|				cue_points [j].chunk_start = cue_points [j + psf->instrument->loop_count * 2].chunk_start ;
  950|  14.7k|				cue_points [j].block_start = cue_points [j + psf->instrument->loop_count * 2].block_start ;
  951|  14.7k|				cue_points [j].sample_offset = cue_points [j + psf->instrument->loop_count * 2].sample_offset ;
  952|  3.79M|				for (str_index = 0 ; str_index < 256 ; str_index++)
  ------------------
  |  Branch (952:26): [True: 3.78M, False: 14.7k]
  ------------------
  953|  3.78M|					cue_points [j].name [str_index] = cue_points [j + psf->instrument->loop_count * 2].name [str_index] ;
  954|  14.7k|				} ;
  955|     29|			psf->cues->cue_count -= psf->instrument->loop_count * 2 ;
  956|     29|			} else
  957|      3|			{	/* All the cues were in fact loop positions so we can actually remove the cues altogether */
  958|      3|				free (psf->cues) ;
  959|      3|				psf->cues = NULL ;
  960|      3|				}
  961|     32|		} ;
  962|       |
  963|  2.46k|	if (psf->sf.channels < 1)
  ------------------
  |  Branch (963:6): [True: 1.54k, False: 920]
  ------------------
  964|  1.54k|		return SFE_CHANNEL_COUNT_ZERO ;
  965|       |
  966|    920|	if (psf->sf.channels > SF_MAX_CHANNELS)
  ------------------
  |  |   95|    920|#define		SF_MAX_CHANNELS		1024
  ------------------
  |  Branch (966:6): [True: 0, False: 920]
  ------------------
  967|      0|		return SFE_CHANNEL_COUNT ;
  968|       |
  969|    920|	if (! (found_chunk & HAVE_FORM))
  ------------------
  |  Branch (969:6): [True: 0, False: 920]
  ------------------
  970|      0|		return SFE_AIFF_NO_FORM ;
  971|       |
  972|    920|	if (! (found_chunk & HAVE_AIFF))
  ------------------
  |  Branch (972:6): [True: 0, False: 920]
  ------------------
  973|      0|		return SFE_AIFF_COMM_NO_FORM ;
  974|       |
  975|    920|	if (! (found_chunk & HAVE_COMM))
  ------------------
  |  Branch (975:6): [True: 0, False: 920]
  ------------------
  976|      0|		return SFE_AIFF_SSND_NO_COMM ;
  977|       |
  978|    920|	if (! psf->dataoffset)
  ------------------
  |  Branch (978:6): [True: 0, False: 920]
  ------------------
  979|      0|		return SFE_AIFF_NO_DATA ;
  980|       |
  981|    920|	return 0 ;
  982|    920|} /* aiff_read_header */
aiff.c:aiff_read_comm_chunk:
 1003|  7.48k|{	BUF_UNION	ubuf ;
 1004|  7.48k|	int subformat, samplerate ;
 1005|       |
 1006|  7.48k|	ubuf.scbuf [0] = 0 ;
 1007|       |
 1008|       |	/* The COMM chunk has an int aligned to an odd word boundary. Some
 1009|       |	** processors are not able to deal with this (ie bus fault) so we have
 1010|       |	** to take special care.
 1011|       |	*/
 1012|       |
 1013|  7.48k|	psf_binheader_readf (psf, "E242b", &(comm_fmt->numChannels), &(comm_fmt->numSampleFrames),
 1014|  7.48k|				&(comm_fmt->sampleSize), &(comm_fmt->sampleRate), SIGNED_SIZEOF (comm_fmt->sampleRate)) ;
  ------------------
  |  |   86|  7.48k|#define		SIGNED_SIZEOF(x)	((int) sizeof (x))
  ------------------
 1015|       |
 1016|  7.48k|	if (comm_fmt->size > 0x10000 && (comm_fmt->size & 0xffff) == 0)
  ------------------
  |  Branch (1016:6): [True: 421, False: 7.05k]
  |  Branch (1016:34): [True: 59, False: 362]
  ------------------
 1017|     59|	{	psf_log_printf (psf, " COMM : %d (0x%x) *** should be ", comm_fmt->size, comm_fmt->size) ;
 1018|     59|		comm_fmt->size = ENDSWAP_32 (comm_fmt->size) ;
  ------------------
  |  |   35|     59|#define	ENDSWAP_32(x)		(bswap_32 (x))
  ------------------
 1019|     59|		psf_log_printf (psf, "%d (0x%x)\n", comm_fmt->size, comm_fmt->size) ;
 1020|     59|		}
 1021|  7.42k|	else
 1022|  7.42k|		psf_log_printf (psf, " COMM : %d\n", comm_fmt->size) ;
 1023|       |
 1024|  7.48k|	if (comm_fmt->size == SIZEOF_AIFF_COMM)
  ------------------
  |  |   98|  7.48k|#define SIZEOF_AIFF_COMM		18
  ------------------
  |  Branch (1024:6): [True: 587, False: 6.89k]
  ------------------
 1025|    587|		comm_fmt->encoding = NONE_MARKER ;
  ------------------
  |  |   60|    587|#define NONE_MARKER		(MAKE_MARKER ('N', 'O', 'N', 'E'))
  |  |  ------------------
  |  |  |  |  122|    587|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
 1026|  6.89k|	else if (comm_fmt->size == SIZEOF_AIFC_COMM_MIN)
  ------------------
  |  |   99|  6.89k|#define SIZEOF_AIFC_COMM_MIN	22
  ------------------
  |  Branch (1026:11): [True: 999, False: 5.89k]
  ------------------
 1027|    999|		psf_binheader_readf (psf, "Em", &(comm_fmt->encoding)) ;
 1028|  5.89k|	else if (comm_fmt->size >= SIZEOF_AIFC_COMM)
  ------------------
  |  |  100|  5.89k|#define SIZEOF_AIFC_COMM		24
  ------------------
  |  Branch (1028:11): [True: 1.59k, False: 4.30k]
  ------------------
 1029|  1.59k|	{	uint8_t encoding_len ;
 1030|  1.59k|		unsigned read_len ;
 1031|       |
 1032|  1.59k|		psf_binheader_readf (psf, "Em1", &(comm_fmt->encoding), &encoding_len) ;
 1033|       |
 1034|  1.59k|		comm_fmt->size = SF_MIN (sizeof (ubuf.scbuf), make_size_t (comm_fmt->size)) ;
  ------------------
  |  |   91|  1.59k|#define		SF_MIN(a, b)	((a) < (b) ? (a) : (b))
  |  |  ------------------
  |  |  |  Branch (91:24): [True: 438, False: 1.15k]
  |  |  ------------------
  ------------------
 1035|  1.59k|		memset (ubuf.scbuf, 0, comm_fmt->size) ;
 1036|  1.59k|		read_len = comm_fmt->size - SIZEOF_AIFC_COMM + 1 ;
  ------------------
  |  |  100|  1.59k|#define SIZEOF_AIFC_COMM		24
  ------------------
 1037|  1.59k|		psf_binheader_readf (psf, "b", ubuf.scbuf, read_len) ;
 1038|  1.59k|		ubuf.scbuf [read_len + 1] = 0 ;
 1039|  1.59k|		} ;
 1040|       |
 1041|  7.48k|	samplerate = tenbytefloat2int (comm_fmt->sampleRate) ;
 1042|       |
 1043|  7.48k|	psf_log_printf (psf, "  Sample Rate : %d\n", samplerate) ;
 1044|  7.48k|	psf_log_printf (psf, "  Frames      : %u%s\n", comm_fmt->numSampleFrames, (comm_fmt->numSampleFrames == 0 && psf->filelength > 104) ? " (Should not be 0)" : "") ;
  ------------------
  |  Branch (1044:77): [True: 498, False: 6.98k]
  |  Branch (1044:111): [True: 378, False: 120]
  ------------------
 1045|       |
 1046|  7.48k|	if (comm_fmt->numChannels < 1 || comm_fmt->numChannels > SF_MAX_CHANNELS)
  ------------------
  |  |   95|  7.39k|#define		SF_MAX_CHANNELS		1024
  ------------------
  |  Branch (1046:6): [True: 90, False: 7.39k]
  |  Branch (1046:35): [True: 34, False: 7.35k]
  ------------------
 1047|    124|	{	psf_log_printf (psf, "  Channels    : %d (should be >= 1 and < %d)\n", comm_fmt->numChannels, SF_MAX_CHANNELS) ;
  ------------------
  |  |   95|    124|#define		SF_MAX_CHANNELS		1024
  ------------------
 1048|    124|		return SFE_CHANNEL_COUNT_BAD ;
 1049|  7.35k|		} ;
 1050|       |
 1051|  7.35k|	psf_log_printf (psf, "  Channels    : %d\n", comm_fmt->numChannels) ;
 1052|       |
 1053|       |	/* Found some broken 'fl32' files with comm.samplesize == 16. Fix it here. */
 1054|  7.35k|	if ((comm_fmt->encoding == fl32_MARKER || comm_fmt->encoding == FL32_MARKER) && comm_fmt->sampleSize != 32)
  ------------------
  |  |   69|  14.7k|#define fl32_MARKER		(MAKE_MARKER ('f', 'l', '3', '2'))
  |  |  ------------------
  |  |  |  |  122|  7.35k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
              	if ((comm_fmt->encoding == fl32_MARKER || comm_fmt->encoding == FL32_MARKER) && comm_fmt->sampleSize != 32)
  ------------------
  |  |   70|  6.42k|#define FL32_MARKER		(MAKE_MARKER ('F', 'L', '3', '2'))
  |  |  ------------------
  |  |  |  |  122|  6.42k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (1054:7): [True: 927, False: 6.42k]
  |  Branch (1054:44): [True: 433, False: 5.99k]
  |  Branch (1054:82): [True: 923, False: 437]
  ------------------
 1055|    923|	{	psf_log_printf (psf, "  Sample Size : %d (should be 32)\n", comm_fmt->sampleSize) ;
 1056|    923|		comm_fmt->sampleSize = 32 ;
 1057|    923|		}
 1058|  6.43k|	else if ((comm_fmt->encoding == fl64_MARKER || comm_fmt->encoding == FL64_MARKER) && comm_fmt->sampleSize != 64)
  ------------------
  |  |   71|  12.8k|#define fl64_MARKER		(MAKE_MARKER ('f', 'l', '6', '4'))
  |  |  ------------------
  |  |  |  |  122|  6.43k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
              	else if ((comm_fmt->encoding == fl64_MARKER || comm_fmt->encoding == FL64_MARKER) && comm_fmt->sampleSize != 64)
  ------------------
  |  |   72|  6.32k|#define FL64_MARKER		(MAKE_MARKER ('F', 'L', '6', '4'))
  |  |  ------------------
  |  |  |  |  122|  6.32k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (1058:12): [True: 112, False: 6.32k]
  |  Branch (1058:49): [True: 793, False: 5.52k]
  |  Branch (1058:87): [True: 868, False: 37]
  ------------------
 1059|    868|	{	psf_log_printf (psf, "  Sample Size : %d (should be 64)\n", comm_fmt->sampleSize) ;
 1060|    868|		comm_fmt->sampleSize = 64 ;
 1061|    868|		}
 1062|  5.56k|	else
 1063|  5.56k|		psf_log_printf (psf, "  Sample Size : %d\n", comm_fmt->sampleSize) ;
 1064|       |
 1065|       |
 1066|  7.35k|	if ((psf->sf.channels != comm_fmt->numChannels) && psf->peak_info)
  ------------------
  |  Branch (1066:6): [True: 3.60k, False: 3.75k]
  |  Branch (1066:53): [True: 127, False: 3.47k]
  ------------------
 1067|    127|	{	psf_log_printf (psf, "  *** channel count changed, discarding existing PEAK chunk\n") ;
 1068|    127|		free (psf->peak_info) ;
 1069|    127|		psf->peak_info = NULL ;
 1070|    127|		} ;
 1071|       |
 1072|  7.35k|	subformat = s_bitwidth_to_subformat (comm_fmt->sampleSize) ;
 1073|       |
 1074|  7.35k|	psf->sf.samplerate = samplerate ;
 1075|  7.35k|	psf->sf.frames = comm_fmt->numSampleFrames ;
 1076|  7.35k|	psf->sf.channels = comm_fmt->numChannels ;
 1077|  7.35k|	psf->bytewidth = BITWIDTH2BYTES (comm_fmt->sampleSize) ;
  ------------------
  |  |   80|  7.35k|#define	BITWIDTH2BYTES(x)	(((x) + 7) / 8)
  ------------------
 1078|       |
 1079|  7.35k|	psf->endian = SF_ENDIAN_BIG ;
 1080|       |
 1081|  7.35k|	switch (comm_fmt->encoding)
 1082|  7.35k|	{	case NONE_MARKER :
  ------------------
  |  |   60|    599|#define NONE_MARKER		(MAKE_MARKER ('N', 'O', 'N', 'E'))
  |  |  ------------------
  |  |  |  |  122|    599|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (1082:4): [True: 599, False: 6.75k]
  ------------------
 1083|    599|				psf->sf.format = (SF_FORMAT_AIFF | subformat) ;
 1084|    599|				break ;
 1085|       |
 1086|     87|		case twos_MARKER :
  ------------------
  |  |   62|     87|#define twos_MARKER		(MAKE_MARKER ('t', 'w', 'o', 's'))
  |  |  ------------------
  |  |  |  |  122|     87|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (1086:3): [True: 87, False: 7.26k]
  ------------------
 1087|    451|		case in24_MARKER :
  ------------------
  |  |   64|    451|#define in24_MARKER		(MAKE_MARKER ('i', 'n', '2', '4'))
  |  |  ------------------
  |  |  |  |  122|    451|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (1087:3): [True: 364, False: 6.99k]
  ------------------
 1088|    519|		case in32_MARKER :
  ------------------
  |  |   66|    519|#define in32_MARKER		(MAKE_MARKER ('i', 'n', '3', '2'))
  |  |  ------------------
  |  |  |  |  122|    519|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (1088:3): [True: 68, False: 7.28k]
  ------------------
 1089|    519|				psf->sf.format = (SF_ENDIAN_BIG | SF_FORMAT_AIFF | subformat) ;
 1090|    519|				break ;
 1091|       |
 1092|    195|		case sowt_MARKER :
  ------------------
  |  |   61|    195|#define sowt_MARKER		(MAKE_MARKER ('s', 'o', 'w', 't'))
  |  |  ------------------
  |  |  |  |  122|    195|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (1092:3): [True: 195, False: 7.16k]
  ------------------
 1093|    497|		case ni24_MARKER :
  ------------------
  |  |   65|    497|#define ni24_MARKER		(MAKE_MARKER ('4', '2', 'n', '1'))
  |  |  ------------------
  |  |  |  |  122|    497|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (1093:3): [True: 302, False: 7.05k]
  ------------------
 1094|    531|		case ni32_MARKER :
  ------------------
  |  |   67|    531|#define ni32_MARKER		(MAKE_MARKER ('2', '3', 'n', 'i'))
  |  |  ------------------
  |  |  |  |  122|    531|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (1094:3): [True: 34, False: 7.32k]
  ------------------
 1095|    531|				psf->endian = SF_ENDIAN_LITTLE ;
 1096|    531|				psf->sf.format = (SF_ENDIAN_LITTLE | SF_FORMAT_AIFF | subformat) ;
 1097|    531|				break ;
 1098|       |
 1099|    927|		case fl32_MARKER :
  ------------------
  |  |   69|    927|#define fl32_MARKER		(MAKE_MARKER ('f', 'l', '3', '2'))
  |  |  ------------------
  |  |  |  |  122|    927|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (1099:3): [True: 927, False: 6.42k]
  ------------------
 1100|  1.36k|		case FL32_MARKER :
  ------------------
  |  |   70|  1.36k|#define FL32_MARKER		(MAKE_MARKER ('F', 'L', '3', '2'))
  |  |  ------------------
  |  |  |  |  122|  1.36k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (1100:3): [True: 433, False: 6.92k]
  ------------------
 1101|  1.36k|				psf->sf.format = (SF_FORMAT_AIFF | SF_FORMAT_FLOAT) ;
 1102|  1.36k|				break ;
 1103|       |
 1104|    219|		case ulaw_MARKER :
  ------------------
  |  |   74|    219|#define ulaw_MARKER		(MAKE_MARKER ('u', 'l', 'a', 'w'))
  |  |  ------------------
  |  |  |  |  122|    219|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (1104:3): [True: 219, False: 7.13k]
  ------------------
 1105|    467|		case ULAW_MARKER :
  ------------------
  |  |   75|    467|#define ULAW_MARKER		(MAKE_MARKER ('U', 'L', 'A', 'W'))
  |  |  ------------------
  |  |  |  |  122|    467|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (1105:3): [True: 248, False: 7.10k]
  ------------------
 1106|    467|				psf->sf.format = (SF_FORMAT_AIFF | SF_FORMAT_ULAW) ;
 1107|    467|				break ;
 1108|       |
 1109|    205|		case alaw_MARKER :
  ------------------
  |  |   76|    205|#define alaw_MARKER		(MAKE_MARKER ('a', 'l', 'a', 'w'))
  |  |  ------------------
  |  |  |  |  122|    205|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (1109:3): [True: 205, False: 7.15k]
  ------------------
 1110|    363|		case ALAW_MARKER :
  ------------------
  |  |   77|    363|#define ALAW_MARKER		(MAKE_MARKER ('A', 'L', 'A', 'W'))
  |  |  ------------------
  |  |  |  |  122|    363|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (1110:3): [True: 158, False: 7.19k]
  ------------------
 1111|    363|				psf->sf.format = (SF_FORMAT_AIFF | SF_FORMAT_ALAW) ;
 1112|    363|				break ;
 1113|       |
 1114|    112|		case fl64_MARKER :
  ------------------
  |  |   71|    112|#define fl64_MARKER		(MAKE_MARKER ('f', 'l', '6', '4'))
  |  |  ------------------
  |  |  |  |  122|    112|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (1114:3): [True: 112, False: 7.24k]
  ------------------
 1115|    905|		case FL64_MARKER :
  ------------------
  |  |   72|    905|#define FL64_MARKER		(MAKE_MARKER ('F', 'L', '6', '4'))
  |  |  ------------------
  |  |  |  |  122|    905|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (1115:3): [True: 793, False: 6.56k]
  ------------------
 1116|    905|				psf->sf.format = (SF_FORMAT_AIFF | SF_FORMAT_DOUBLE) ;
 1117|    905|				break ;
 1118|       |
 1119|    105|		case raw_MARKER :
  ------------------
  |  |   63|    105|#define raw_MARKER		(MAKE_MARKER ('r', 'a', 'w', ' '))
  |  |  ------------------
  |  |  |  |  122|    105|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (1119:3): [True: 105, False: 7.25k]
  ------------------
 1120|    105|				psf->sf.format = (SF_FORMAT_AIFF | SF_FORMAT_PCM_U8) ;
 1121|    105|				break ;
 1122|       |
 1123|  1.10k|		case DWVW_MARKER :
  ------------------
  |  |   79|  1.10k|#define DWVW_MARKER		(MAKE_MARKER ('D', 'W', 'V', 'W'))
  |  |  ------------------
  |  |  |  |  122|  1.10k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (1123:3): [True: 1.10k, False: 6.25k]
  ------------------
 1124|  1.10k|				psf->sf.format = SF_FORMAT_AIFF ;
 1125|  1.10k|				switch (comm_fmt->sampleSize)
 1126|  1.10k|				{	case 12 :
  ------------------
  |  Branch (1126:7): [True: 87, False: 1.01k]
  ------------------
 1127|     87|						psf->sf.format |= SF_FORMAT_DWVW_12 ;
 1128|     87|						break ;
 1129|    393|					case 16 :
  ------------------
  |  Branch (1129:6): [True: 393, False: 713]
  ------------------
 1130|    393|						psf->sf.format |= SF_FORMAT_DWVW_16 ;
 1131|    393|						break ;
 1132|    235|					case 24 :
  ------------------
  |  Branch (1132:6): [True: 235, False: 871]
  ------------------
 1133|    235|						psf->sf.format |= SF_FORMAT_DWVW_24 ;
 1134|    235|						break ;
 1135|       |
 1136|    391|					default :
  ------------------
  |  Branch (1136:6): [True: 391, False: 715]
  ------------------
 1137|    391|						psf->sf.format |= SF_FORMAT_DWVW_N ;
 1138|    391|						break ;
 1139|  1.10k|					} ;
 1140|  1.10k|				break ;
 1141|       |
 1142|    393|		case GSM_MARKER :
  ------------------
  |  |   80|    393|#define GSM_MARKER		(MAKE_MARKER ('G', 'S', 'M', ' '))
  |  |  ------------------
  |  |  |  |  122|    393|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (1142:3): [True: 393, False: 6.96k]
  ------------------
 1143|    393|				psf->sf.format = (SF_FORMAT_AIFF | SF_FORMAT_GSM610) ;
 1144|    393|				break ;
 1145|       |
 1146|       |
 1147|    667|		case ima4_MARKER :
  ------------------
  |  |   81|    667|#define ima4_MARKER		(MAKE_MARKER ('i', 'm', 'a', '4'))
  |  |  ------------------
  |  |  |  |  122|    667|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (1147:3): [True: 667, False: 6.68k]
  ------------------
 1148|    667|				psf->endian = SF_ENDIAN_BIG ;
 1149|    667|				psf->sf.format = (SF_FORMAT_AIFF | SF_FORMAT_IMA_ADPCM) ;
 1150|    667|				break ;
 1151|       |
 1152|    341|		default :
  ------------------
  |  Branch (1152:3): [True: 341, False: 7.01k]
  ------------------
 1153|    341|			psf_log_printf (psf, "AIFC : Unimplemented format : %M\n", comm_fmt->encoding) ;
 1154|    341|			return SFE_UNIMPLEMENTED ;
 1155|  7.35k|		} ;
 1156|       |
 1157|  7.01k|	if (! ubuf.scbuf [0])
  ------------------
  |  Branch (1157:6): [True: 6.05k, False: 956]
  ------------------
 1158|  6.05k|		psf_log_printf (psf, "  Encoding    : %M\n", comm_fmt->encoding) ;
 1159|    956|	else
 1160|    956|		psf_log_printf (psf, "  Encoding    : %M => %s\n", comm_fmt->encoding, ubuf.scbuf) ;
 1161|       |
 1162|  7.01k|	return 0 ;
 1163|  7.35k|} /* aiff_read_comm_chunk */
aiff.c:tenbytefloat2int:
 1648|  7.48k|{	int val = 3 ;
 1649|       |
 1650|  7.48k|	if (bytes [0] & 0x80)	/* Negative number. */
  ------------------
  |  Branch (1650:6): [True: 870, False: 6.61k]
  ------------------
 1651|    870|		return 0 ;
 1652|       |
 1653|  6.61k|	if (bytes [0] <= 0x3F)	/* Less than 1. */
  ------------------
  |  Branch (1653:6): [True: 3.96k, False: 2.64k]
  ------------------
 1654|  3.96k|		return 1 ;
 1655|       |
 1656|  2.64k|	if (bytes [0] > 0x40)	/* Way too big. */
  ------------------
  |  Branch (1656:6): [True: 853, False: 1.79k]
  ------------------
 1657|    853|		return 0x4000000 ;
 1658|       |
 1659|  1.79k|	if (bytes [0] == 0x40 && bytes [1] > 0x1C) /* Too big. */
  ------------------
  |  Branch (1659:6): [True: 1.79k, False: 0]
  |  Branch (1659:27): [True: 1.05k, False: 740]
  ------------------
 1660|  1.05k|		return 800000000 ;
 1661|       |
 1662|       |	/* Ok, can handle it. */
 1663|       |
 1664|    740|	val = (bytes [2] << 23) | (bytes [3] << 15) | (bytes [4] << 7) | (bytes [5] >> 1) ;
 1665|       |
 1666|    740|	val >>= (29 - bytes [1]) ;
 1667|       |
 1668|    740|	return val ;
 1669|  1.79k|} /* tenbytefloat2int */
aiff.c:get_loop_mode_str:
 1617|  2.33k|{	switch (mode)
  ------------------
  |  Branch (1617:11): [True: 1.01k, False: 1.31k]
  ------------------
 1618|  2.33k|	{	case 0 : return "none" ;
  ------------------
  |  Branch (1618:4): [True: 131, False: 2.20k]
  ------------------
 1619|    381|		case 1 : return "forward" ;
  ------------------
  |  Branch (1619:3): [True: 381, False: 1.95k]
  ------------------
 1620|    504|		case 2 : return "backward" ;
  ------------------
  |  Branch (1620:3): [True: 504, False: 1.82k]
  ------------------
 1621|  2.33k|		} ;
 1622|       |
 1623|  1.31k|	return "*** unknown" ;
 1624|  2.33k|} /* get_loop_mode_str */
aiff.c:get_loop_mode:
 1628|  2.33k|{	switch (mode)
  ------------------
  |  Branch (1628:11): [True: 1.01k, False: 1.31k]
  ------------------
 1629|  2.33k|	{	case 0 : return SF_LOOP_NONE ;
  ------------------
  |  Branch (1629:4): [True: 131, False: 2.20k]
  ------------------
 1630|    381|		case 1 : return SF_LOOP_FORWARD ;
  ------------------
  |  Branch (1630:3): [True: 381, False: 1.95k]
  ------------------
 1631|    504|		case 2 : return SF_LOOP_BACKWARD ;
  ------------------
  |  Branch (1631:3): [True: 504, False: 1.82k]
  ------------------
 1632|  2.33k|		} ;
 1633|       |
 1634|  1.31k|	return SF_LOOP_NONE ;
 1635|  2.33k|} /* get_loop_mode */
aiff.c:aiff_read_basc_chunk:
 1707|    615|{	const char * type_str ;
 1708|    615|	basc_CHUNK bc ;
 1709|    615|	sf_count_t count ;
 1710|       |
 1711|    615|	count = psf_binheader_readf (psf, "E442", &bc.version, &bc.numBeats, &bc.rootNote) ;
 1712|    615|	count += psf_binheader_readf (psf, "E222", &bc.scaleType, &bc.sigNumerator, &bc.sigDenominator) ;
 1713|    615|	count += psf_binheader_readf (psf, "E2j", &bc.loopType, datasize - sizeof (bc)) ;
 1714|       |
 1715|    615|	psf_log_printf (psf, "  Version ? : %u\n  Num Beats : %u\n  Root Note : 0x%x\n",
 1716|    615|						bc.version, bc.numBeats, bc.rootNote) ;
 1717|       |
 1718|    615|	switch (bc.scaleType)
 1719|    615|	{	case basc_SCALE_MINOR :
  ------------------
  |  Branch (1719:4): [True: 8, False: 607]
  ------------------
 1720|      8|				type_str = "MINOR" ;
 1721|      8|				break ;
 1722|      5|		case basc_SCALE_MAJOR :
  ------------------
  |  Branch (1722:3): [True: 5, False: 610]
  ------------------
 1723|      5|				type_str = "MAJOR" ;
 1724|      5|				break ;
 1725|    197|		case basc_SCALE_NEITHER :
  ------------------
  |  Branch (1725:3): [True: 197, False: 418]
  ------------------
 1726|    197|				type_str = "NEITHER" ;
 1727|    197|				break ;
 1728|    140|		case basc_SCALE_BOTH :
  ------------------
  |  Branch (1728:3): [True: 140, False: 475]
  ------------------
 1729|    140|				type_str = "BOTH" ;
 1730|    140|				break ;
 1731|    265|		default :
  ------------------
  |  Branch (1731:3): [True: 265, False: 350]
  ------------------
 1732|    265|				type_str = "!!WRONG!!" ;
 1733|    265|				break ;
 1734|    615|		} ;
 1735|       |
 1736|    615|	psf_log_printf (psf, "  ScaleType : 0x%x (%s)\n", bc.scaleType, type_str) ;
 1737|    615|	psf_log_printf (psf, "  Time Sig  : %d/%d\n", bc.sigNumerator, bc.sigDenominator) ;
 1738|       |
 1739|    615|	switch (bc.loopType)
 1740|    615|	{	case basc_TYPE_ONE_SHOT :
  ------------------
  |  Branch (1740:4): [True: 8, False: 607]
  ------------------
 1741|      8|				type_str = "One Shot" ;
 1742|      8|				break ;
 1743|     46|		case basc_TYPE_LOOP :
  ------------------
  |  Branch (1743:3): [True: 46, False: 569]
  ------------------
 1744|     46|				type_str = "Loop" ;
 1745|     46|				break ;
 1746|    561|		default:
  ------------------
  |  Branch (1746:3): [True: 561, False: 54]
  ------------------
 1747|    561|				type_str = "!!WRONG!!" ;
 1748|    561|				break ;
 1749|    615|		} ;
 1750|       |
 1751|    615|	psf_log_printf (psf, "  Loop Type : 0x%x (%s)\n", bc.loopType, type_str) ;
 1752|       |
 1753|    615|	if (psf->loop_info)
  ------------------
  |  Branch (1753:6): [True: 555, False: 60]
  ------------------
 1754|    555|	{	psf_log_printf (psf, "  Found existing loop info, using last one.\n") ;
 1755|    555|		free (psf->loop_info) ;
 1756|    555|		psf->loop_info = NULL ;
 1757|    555|		} ;
 1758|    615|	if ((psf->loop_info = calloc (1, sizeof (SF_LOOP_INFO))) == NULL)
  ------------------
  |  Branch (1758:6): [True: 0, False: 615]
  ------------------
 1759|      0|		return SFE_MALLOC_FAILED ;
 1760|       |
 1761|    615|	psf->loop_info->time_sig_num	= bc.sigNumerator ;
 1762|    615|	psf->loop_info->time_sig_den	= bc.sigDenominator ;
 1763|    615|	psf->loop_info->loop_mode		= (bc.loopType == basc_TYPE_ONE_SHOT) ? SF_LOOP_NONE : SF_LOOP_FORWARD ;
  ------------------
  |  Branch (1763:31): [True: 8, False: 607]
  ------------------
 1764|    615|	psf->loop_info->num_beats		= bc.numBeats ;
 1765|       |
 1766|       |	/* Can always be recalculated from other known fields. */
 1767|    615|	psf->loop_info->bpm = (1.0 / psf->sf.frames) * psf->sf.samplerate
 1768|    615|							* ((bc.numBeats * 4.0) / bc.sigDenominator) * 60.0 ;
 1769|    615|	psf->loop_info->root_key = bc.rootNote ;
 1770|       |
 1771|    615|	if (count < datasize)
  ------------------
  |  Branch (1771:6): [True: 606, False: 9]
  ------------------
 1772|    606|		psf_binheader_readf (psf, "j", datasize - count) ;
 1773|       |
 1774|    615|	return 0 ;
 1775|    615|} /* aiff_read_basc_chunk */
aiff.c:aiff_read_chanmap:
 1780|  1.66k|{	const AIFF_CAF_CHANNEL_MAP * map_info ;
 1781|  1.66k|	unsigned channel_bitmap, channel_decriptions, bytesread ;
 1782|  1.66k|	int layout_tag ;
 1783|       |
 1784|  1.66k|	bytesread = psf_binheader_readf (psf, "444", &layout_tag, &channel_bitmap, &channel_decriptions) ;
 1785|       |
 1786|  1.66k|	if ((map_info = aiff_caf_of_channel_layout_tag (layout_tag)) == NULL)
  ------------------
  |  Branch (1786:6): [True: 332, False: 1.33k]
  ------------------
 1787|    332|		return 0 ;
 1788|       |
 1789|  1.33k|	psf_log_printf (psf, "  Tag    : %x\n", layout_tag) ;
 1790|  1.33k|	if (map_info)
  ------------------
  |  Branch (1790:6): [True: 1.33k, False: 0]
  ------------------
 1791|  1.33k|		psf_log_printf (psf, "  Layout : %s\n", map_info->name) ;
 1792|       |
 1793|  1.33k|	if (bytesread < dword)
  ------------------
  |  Branch (1793:6): [True: 489, False: 843]
  ------------------
 1794|    489|		psf_binheader_readf (psf, "j", dword - bytesread) ;
 1795|       |
 1796|  1.33k|	if (map_info->channel_map != NULL)
  ------------------
  |  Branch (1796:6): [True: 1.07k, False: 259]
  ------------------
 1797|  1.07k|	{	/* The channel map buffer must hold psf->sf.channels entries, because that
 1798|       |		** is how many SFC_GET_CHANNEL_MAP_INFO and the channel-layout matcher read
 1799|       |		** back. The layout tag may describe fewer channels than the file declares,
 1800|       |		** so size the allocation by the channel count and copy only the smaller of
 1801|       |		** the two to avoid a heap over-read. */
 1802|  1.07k|		size_t chanmap_size = (size_t) psf->sf.channels * sizeof (psf->channel_map [0]) ;
 1803|  1.07k|		size_t copy_size = SF_MIN (psf->sf.channels, layout_tag & 0xffff) * sizeof (psf->channel_map [0]) ;
  ------------------
  |  |   91|  1.07k|#define		SF_MIN(a, b)	((a) < (b) ? (a) : (b))
  |  |  ------------------
  |  |  |  Branch (91:24): [True: 140, False: 933]
  |  |  ------------------
  ------------------
 1804|       |
 1805|  1.07k|		free (psf->channel_map) ;
 1806|       |
 1807|  1.07k|		if ((psf->channel_map = calloc (1, chanmap_size)) == NULL)
  ------------------
  |  Branch (1807:7): [True: 0, False: 1.07k]
  ------------------
 1808|      0|			return SFE_MALLOC_FAILED ;
 1809|       |
 1810|  1.07k|		memcpy (psf->channel_map, map_info->channel_map, copy_size) ;
 1811|  1.33k|		} ;
 1812|       |
 1813|  1.33k|	return 0 ;
 1814|  1.33k|} /* aiff_read_chanmap */
aiff.c:marker_to_position:
  389|     62|{	int i ;
  390|       |
  391|  16.6k|	for (i = 0 ; i < marksize ; i++)
  ------------------
  |  Branch (391:15): [True: 16.6k, False: 36]
  ------------------
  392|  16.6k|		if (m [i].markerID == n)
  ------------------
  |  Branch (392:7): [True: 26, False: 16.6k]
  ------------------
  393|     26|			return m [i].position ;
  394|     36|	return 0 ;
  395|     62|} /* marker_to_position */
aiff.c:aiff_close:
  986|  3.07k|{	AIFF_PRIVATE *paiff = psf->container_data ;
  987|       |
  988|  3.07k|	if (paiff != NULL && paiff->markstr != NULL)
  ------------------
  |  Branch (988:6): [True: 3.07k, False: 0]
  |  Branch (988:23): [True: 93, False: 2.97k]
  ------------------
  989|     93|	{	free (paiff->markstr) ;
  990|     93|		paiff->markstr = NULL ;
  991|     93|		} ;
  992|       |
  993|  3.07k|	if (psf->file.mode == SFM_WRITE || psf->file.mode == SFM_RDWR)
  ------------------
  |  Branch (993:6): [True: 0, False: 3.07k]
  |  Branch (993:37): [True: 0, False: 3.07k]
  ------------------
  994|      0|	{	aiff_write_tailer (psf) ;
  995|      0|		aiff_write_header (psf, SF_TRUE) ;
  996|      0|		} ;
  997|       |
  998|  3.07k|	return 0 ;
  999|  3.07k|} /* aiff_close */

alac_init:
  112|  1.00k|{	int error ;
  113|       |
  114|  1.00k|	if ((psf->codec_data = calloc (1, sizeof (ALAC_PRIVATE) + psf->sf.channels * sizeof (int) * ALAC_MAX_FRAME_SIZE)) == NULL)
  ------------------
  |  |   33|  1.00k|#define		ALAC_MAX_FRAME_SIZE		8192
  ------------------
  |  Branch (114:6): [True: 0, False: 1.00k]
  ------------------
  115|      0|		return SFE_MALLOC_FAILED ;
  116|       |
  117|  1.00k|	psf->codec_close = alac_close ;
  118|       |
  119|  1.00k|	switch (psf->file.mode)
  120|  1.00k|	{	case SFM_RDWR :
  ------------------
  |  Branch (120:4): [True: 0, False: 1.00k]
  ------------------
  121|      0|			return SFE_BAD_MODE_RW ;
  122|       |
  123|  1.00k|		case SFM_READ :
  ------------------
  |  Branch (123:3): [True: 1.00k, False: 0]
  ------------------
  124|  1.00k|			if ((error = alac_reader_init (psf, info)))
  ------------------
  |  Branch (124:8): [True: 233, False: 775]
  ------------------
  125|    233|				return error ;
  126|    775|			break ;
  127|       |
  128|    775|		case SFM_WRITE :
  ------------------
  |  Branch (128:3): [True: 0, False: 1.00k]
  ------------------
  129|      0|			if ((error = alac_writer_init (psf)))
  ------------------
  |  Branch (129:8): [True: 0, False: 0]
  ------------------
  130|      0|				return error ;
  131|      0|			break ;
  132|       |
  133|      0|		default :
  ------------------
  |  Branch (133:3): [True: 0, False: 1.00k]
  ------------------
  134|      0|			psf_log_printf (psf, "%s : Bad psf->file.mode.\n", __func__) ;
  135|      0|			return SFE_INTERNAL ;
  136|  1.00k|		} ;
  137|       |
  138|    775|	psf->byterate = alac_byterate ;
  139|       |
  140|    775|	return 0 ;
  141|  1.00k|} /* aiff_alac_init */
alac.c:alac_close:
  166|  1.00k|{	ALAC_PRIVATE *plac ;
  167|  1.00k|	BUF_UNION	ubuf ;
  168|       |
  169|  1.00k|	plac = psf->codec_data ;
  170|       |
  171|  1.00k|	if (psf->file.mode == SFM_WRITE)
  ------------------
  |  Branch (171:6): [True: 0, False: 1.00k]
  ------------------
  172|      0|	{	ALAC_ENCODER *penc = &plac->u.encoder ;
  173|      0|		SF_CHUNK_INFO chunk_info ;
  174|      0|		sf_count_t readcount ;
  175|      0|		uint8_t kuki_data [1024] ;
  176|      0|		uint32_t pakt_size = 0, saved_partial_block_frames ;
  177|       |
  178|      0|		plac->final_write_block = 1 ;
  179|      0|		saved_partial_block_frames = plac->partial_block_frames ;
  180|       |
  181|       |		/*	If a block has been partially assembled, write it out as the final block. */
  182|      0|		if (plac->partial_block_frames && plac->partial_block_frames < plac->frames_per_block)
  ------------------
  |  Branch (182:7): [True: 0, False: 0]
  |  Branch (182:37): [True: 0, False: 0]
  ------------------
  183|      0|			alac_encode_block (plac) ;
  184|       |
  185|      0|		plac->partial_block_frames = saved_partial_block_frames ;
  186|       |
  187|      0|		alac_get_magic_cookie (penc, kuki_data, &plac->kuki_size) ;
  188|       |
  189|      0|		memset (&chunk_info, 0, sizeof (chunk_info)) ;
  190|      0|		chunk_info.id_size = snprintf (chunk_info.id, sizeof (chunk_info.id), "kuki") ;
  191|      0|		chunk_info.data = kuki_data ;
  192|      0|		chunk_info.datalen = plac->kuki_size ;
  193|      0|		psf_save_write_chunk (&psf->wchunks, &chunk_info) ;
  194|       |
  195|      0|		memset (&chunk_info, 0, sizeof (chunk_info)) ;
  196|      0|		chunk_info.id_size = snprintf (chunk_info.id, sizeof (chunk_info.id), "pakt") ;
  197|      0|		chunk_info.data = alac_pakt_encode (psf, &pakt_size) ;
  198|      0|		chunk_info.datalen = pakt_size ;
  199|      0|		psf_save_write_chunk (&psf->wchunks, &chunk_info) ;
  200|       |
  201|      0|		free (chunk_info.data) ;
  202|      0|		chunk_info.data = NULL ;
  203|       |
  204|      0|		psf->write_header (psf, 1) ;
  205|       |
  206|      0|		if (plac->enctmp != NULL)
  ------------------
  |  Branch (206:7): [True: 0, False: 0]
  ------------------
  207|      0|		{	fseek (plac->enctmp, 0, SEEK_SET) ;
  208|       |
  209|      0|			while ((readcount = fread (ubuf.ucbuf, 1, sizeof (ubuf.ucbuf), plac->enctmp)) > 0)
  ------------------
  |  Branch (209:11): [True: 0, False: 0]
  ------------------
  210|      0|				psf_fwrite (ubuf.ucbuf, 1, readcount, psf) ;
  211|      0|			fclose (plac->enctmp) ;
  212|      0|			remove (plac->enctmpname) ;
  213|      0|			} ;
  214|      0|		} ;
  215|       |
  216|  1.00k|	if (plac->pakt_info)
  ------------------
  |  Branch (216:6): [True: 950, False: 58]
  ------------------
  217|    950|		free (plac->pakt_info) ;
  218|  1.00k|	plac->pakt_info = NULL ;
  219|       |
  220|  1.00k|	return 0 ;
  221|  1.00k|} /* alac_close */
alac.c:alac_pakt_append:
  794|  7.23k|{
  795|  7.23k|	if (info->count >= info->allocated)
  ------------------
  |  Branch (795:6): [True: 163, False: 7.07k]
  ------------------
  796|    163|	{	PAKT_INFO * temp ;
  797|    163|		uint32_t newcount = info->allocated + info->allocated / 2 ;
  798|       |
  799|    163|		if ((temp = realloc (info, sizeof (PAKT_INFO) + newcount * sizeof (info->packet_size [0]))) == NULL)
  ------------------
  |  Branch (799:7): [True: 0, False: 163]
  ------------------
  800|      0|			return NULL ;
  801|       |
  802|    163|		info = temp ;
  803|    163|		info->allocated = newcount ;
  804|  7.23k|		} ;
  805|       |
  806|  7.23k|	info->packet_size [info->count++] = value ;
  807|  7.23k|	return info ;
  808|  7.23k|} /* alac_pakt_append */
alac.c:alac_reader_init:
  238|  1.00k|{	ALAC_PRIVATE	*plac ;
  239|  1.00k|	uint32_t		kuki_size ;
  240|  1.00k|	int				error ;
  241|  1.00k|	union			{ uint8_t kuki [512] ; uint32_t alignment ; } u ;
  242|       |
  243|  1.00k|	if (info == NULL)
  ------------------
  |  Branch (243:6): [True: 0, False: 1.00k]
  ------------------
  244|      0|	{	psf_log_printf (psf, "%s : ALAC_DECODER_INFO is NULL.\n", __func__) ;
  245|      0|		return SFE_INTERNAL ;
  246|  1.00k|		} ;
  247|       |
  248|  1.00k|	if (info->frames_per_packet > ALAC_FRAME_LENGTH)
  ------------------
  |  |   33|  1.00k|#define		ALAC_FRAME_LENGTH	4096
  ------------------
  |  Branch (248:6): [True: 22, False: 986]
  ------------------
  249|     22|	{	psf_log_printf (psf, "*** Error : frames_per_packet (%u) is too big. ***\n", info->frames_per_packet) ;
  250|     22|		return SFE_INTERNAL ;
  251|    986|		} ;
  252|       |
  253|    986|	plac = psf->codec_data ;
  254|       |
  255|    986|	plac->channels			= psf->sf.channels ;
  256|    986|	plac->frames_per_block	= info->frames_per_packet ;
  257|    986|	plac->bits_per_sample	= info->bits_per_sample ;
  258|       |
  259|    986|	if (plac->pakt_info != NULL)
  ------------------
  |  Branch (259:6): [True: 0, False: 986]
  ------------------
  260|      0|		free (plac->pakt_info) ;
  261|    986|	plac->pakt_info = alac_pakt_read_decode (psf, info->pakt_offset) ;
  262|       |
  263|    986|	if (plac->pakt_info == NULL)
  ------------------
  |  Branch (263:6): [True: 36, False: 950]
  ------------------
  264|     36|	{	psf_log_printf (psf, "%s : alac_pkt_read() returns NULL.\n", __func__) ;
  265|     36|		return SFE_INTERNAL ;
  266|    950|		} ;
  267|       |
  268|       |	/* Read in the ALAC cookie data and pass it to the init function. */
  269|    950|	kuki_size = alac_kuki_read (psf, info->kuki_offset, u.kuki, sizeof (u.kuki)) ;
  270|       |
  271|    950|	if ((error = alac_decoder_init (&plac->u.decoder, u.kuki, kuki_size)) != ALAC_noErr)
  ------------------
  |  Branch (271:6): [True: 174, False: 776]
  ------------------
  272|    174|	{	psf_log_printf (psf, "*** alac_decoder_init() returned %s. ***\n", alac_error_string (error)) ;
  273|    174|		return SFE_INTERNAL ;
  274|    776|		} ;
  275|       |
  276|       |
  277|    776|	if (plac->u.decoder.mNumChannels != (unsigned) psf->sf.channels)
  ------------------
  |  Branch (277:6): [True: 1, False: 775]
  ------------------
  278|      1|	{	psf_log_printf (psf, "*** Initialized decoder has %u channels, but it should be %d. ***\n", plac->u.decoder.mNumChannels, psf->sf.channels) ;
  279|      1|		return SFE_INTERNAL ;
  280|    775|		} ;
  281|       |
  282|    775|	switch (info->bits_per_sample)
  283|    775|	{	case 16 :
  ------------------
  |  Branch (283:4): [True: 51, False: 724]
  ------------------
  284|    288|		case 20 :
  ------------------
  |  Branch (284:3): [True: 237, False: 538]
  ------------------
  285|    653|		case 24 :
  ------------------
  |  Branch (285:3): [True: 365, False: 410]
  ------------------
  286|    775|		case 32 :
  ------------------
  |  Branch (286:3): [True: 122, False: 653]
  ------------------
  287|    775|			psf->read_short		= alac_read_s ;
  288|    775|			psf->read_int		= alac_read_i ;
  289|    775|			psf->read_float		= alac_read_f ;
  290|    775|			psf->read_double	= alac_read_d ;
  291|    775|			break ;
  292|       |
  293|      0|		default :
  ------------------
  |  Branch (293:3): [True: 0, False: 775]
  ------------------
  294|      0|			printf ("%s : info->bits_per_sample %u\n", __func__, info->bits_per_sample) ;
  295|      0|			return SFE_UNSUPPORTED_ENCODING ;
  296|    775|		} ;
  297|       |
  298|    775|	psf->codec_close	= alac_close ;
  299|    775|	psf->seek			= alac_seek ;
  300|       |
  301|    775|	psf->sf.frames		= alac_reader_calc_frames (psf, plac) ;
  302|    775|	alac_seek (psf, SFM_READ, 0) ;
  303|       |
  304|    775|	return 0 ;
  305|    775|} /* alac_reader_init */
alac.c:alac_pakt_read_decode:
  812|    986|{	SF_CHUNK_INFO chunk_info ;
  813|    986|	PAKT_INFO * info = NULL, * temp ;
  814|    986|	uint8_t *pakt_data = NULL ;
  815|    986|	uint32_t bcount, value = 1, pakt_size ;
  816|    986|	SF_CHUNK_ITERATOR * chunk_iterator ;
  817|       |
  818|       |
  819|    986|	memset (&chunk_info, 0, sizeof (chunk_info)) ;
  820|    986|	snprintf (chunk_info.id, sizeof (chunk_info.id), "pakt") ;
  821|    986|	chunk_info.id_size = 4 ;
  822|       |
  823|    986|	if ((chunk_iterator = psf_get_chunk_iterator (psf, chunk_info.id)) == NULL)
  ------------------
  |  Branch (823:6): [True: 36, False: 950]
  ------------------
  824|     36|	{	psf_log_printf (psf, "%s : no chunk iterator found\n", __func__) ;
  825|     36|		free (chunk_info.data) ;
  826|     36|		chunk_info.data = NULL ;
  827|     36|		return NULL ;
  828|    950|		} ;
  829|       |
  830|    950|	psf->get_chunk_size (psf, chunk_iterator, &chunk_info) ;
  831|       |
  832|    950|	pakt_size = chunk_info.datalen ;
  833|    950|	if (pakt_size > UINT32_MAX-5 )
  ------------------
  |  Branch (833:6): [True: 0, False: 950]
  ------------------
  834|      0|		return NULL;
  835|    950|	chunk_info.data = pakt_data = malloc (pakt_size + 5) ;
  836|    950|	if (!chunk_info.data)
  ------------------
  |  Branch (836:6): [True: 0, False: 950]
  ------------------
  837|      0|		return NULL ;
  838|       |
  839|    950|	if ((bcount = psf->get_chunk_data (psf, chunk_iterator, &chunk_info)) != SF_ERR_NO_ERROR)
  ------------------
  |  Branch (839:6): [True: 0, False: 950]
  ------------------
  840|      0|	{	while (chunk_iterator)
  ------------------
  |  Branch (840:11): [True: 0, False: 0]
  ------------------
  841|      0|			chunk_iterator = psf->next_chunk_iterator (psf, chunk_iterator) ;
  842|      0|		free (chunk_info.data) ;
  843|      0|		chunk_info.data = NULL ;
  844|      0|		return NULL ;
  845|    950|		} ;
  846|       |
  847|  2.22k|	while (chunk_iterator)
  ------------------
  |  Branch (847:9): [True: 1.27k, False: 950]
  ------------------
  848|  1.27k|		chunk_iterator = psf->next_chunk_iterator (psf, chunk_iterator) ;
  849|       |
  850|    950|	info = alac_pakt_alloc (pakt_size / 4) ;
  851|       |
  852|       |	/* Start at 24 bytes in, skipping over the 'pakt' chunks header. */
  853|  8.18k|	for (bcount = 24 ; bcount < pakt_size && value != 0 ; )
  ------------------
  |  Branch (853:21): [True: 7.40k, False: 777]
  |  Branch (853:43): [True: 7.23k, False: 173]
  ------------------
  854|  7.23k|	{	uint8_t byte ;
  855|  7.23k|		int32_t count = 0 ;
  856|       |
  857|  7.23k|		value = 0 ;
  858|  7.23k|		do
  859|  8.05k|		{	byte = pakt_data [bcount + count] ;
  860|  8.05k|			value = (value << 7) + (byte & 0x7F) ;
  861|       |
  862|  8.05k|			count ++ ;
  863|  8.05k|			if (count > 5 || bcount + count > pakt_size)
  ------------------
  |  Branch (863:8): [True: 16, False: 8.03k]
  |  Branch (863:21): [True: 44, False: 7.99k]
  ------------------
  864|     60|			{	printf ("%s %d : Ooops! count %" PRIi32 "    bcount %" PRIu32 "\n", __func__, __LINE__, count, bcount) ;
  865|     60|				value = 0 ;
  866|     60|				break ;
  867|  7.99k|				} ;
  868|  7.99k|			}
  869|  7.99k|			while (byte & 0x80) ;
  ------------------
  |  Branch (869:11): [True: 820, False: 7.17k]
  ------------------
  870|       |
  871|  7.23k|		bcount += count ;
  872|       |
  873|  7.23k|		if ((temp = alac_pakt_append (info, value)) == NULL)
  ------------------
  |  Branch (873:7): [True: 0, False: 7.23k]
  ------------------
  874|      0|			goto FreeExit ;
  875|  7.23k|		info = temp ;
  876|  7.23k|		} ;
  877|       |
  878|    950|	free (pakt_data) ;
  879|       |
  880|    950|	return info ;
  881|       |
  882|      0|FreeExit :
  883|      0|	free (pakt_data) ;
  884|      0|	free (info) ;
  885|       |	return NULL ;
  886|    950|} /* alac_pakt_read_decode */
alac.c:alac_pakt_alloc:
  780|    950|{	PAKT_INFO * info ;
  781|       |
  782|    950|	if ((info = calloc (1, sizeof (PAKT_INFO) + initial_count * sizeof (info->packet_size [0]))) == NULL)
  ------------------
  |  Branch (782:6): [True: 0, False: 950]
  ------------------
  783|      0|		return NULL ;
  784|       |
  785|    950|	info->allocated = initial_count ;
  786|    950|	info->current = 0 ;
  787|    950|	info->count = 0 ;
  788|       |
  789|    950|	return info ;
  790|    950|} /* alac_pakt_alloc */
alac.c:alac_kuki_read:
  960|    950|{	uint32_t marker ;
  961|    950|	uint64_t kuki_size ;
  962|       |
  963|    950|	if (psf_fseek (psf, kuki_offset, SEEK_SET) != kuki_offset)
  ------------------
  |  Branch (963:6): [True: 0, False: 950]
  ------------------
  964|      0|		return 0 ;
  965|       |
  966|    950|	psf_fread (&marker, 1, sizeof (marker), psf) ;
  967|    950|	if (marker != MAKE_MARKER ('k', 'u', 'k', 'i'))
  ------------------
  |  |  122|    950|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
  |  Branch (967:6): [True: 127, False: 823]
  ------------------
  968|    127|		return 0 ;
  969|       |
  970|    823|	psf_fread (&kuki_size, 1, sizeof (kuki_size), psf) ;
  971|    823|	kuki_size = BE2H_64 (kuki_size) ;
  ------------------
  |  |  142|    823|	#define BE2H_64(x)			ENDSWAP_64 (x)
  |  |  ------------------
  |  |  |  |   36|    823|#define	ENDSWAP_64(x)		(bswap_64 (x))
  |  |  ------------------
  ------------------
  972|       |
  973|    823|	if (kuki_size == 0 || kuki_size > kuki_maxlen)
  ------------------
  |  Branch (973:6): [True: 3, False: 820]
  |  Branch (973:24): [True: 3, False: 817]
  ------------------
  974|      6|	{	psf_log_printf (psf, "%s : Bad size (%D) of 'kuki' chunk.\n", __func__, kuki_size) ;
  975|      6|		return 0 ;
  976|    817|		} ;
  977|       |
  978|    817|	psf_fread (kuki, 1, kuki_size, psf) ;
  979|       |
  980|    817|	return kuki_size ;
  981|    823|} /* alac_kuki_read */
alac.c:alac_error_string:
  987|    957|{	static char errstr [128] ;
  988|    957|	switch (error)
  989|    957|	{	CASE_NAME (kALAC_UnimplementedError) ;
  ------------------
  |  |  983|      0|#define CASE_NAME(x)	case x : return #x ; break ;
  |  |  ------------------
  |  |  |  Branch (983:22): [True: 0, False: 957]
  |  |  ------------------
  ------------------
  990|      0|		CASE_NAME (kALAC_FileNotFoundError) ;
  ------------------
  |  |  983|      0|#define CASE_NAME(x)	case x : return #x ; break ;
  |  |  ------------------
  |  |  |  Branch (983:22): [True: 0, False: 957]
  |  |  ------------------
  ------------------
  991|    682|		CASE_NAME (kALAC_ParamError) ;
  ------------------
  |  |  983|    682|#define CASE_NAME(x)	case x : return #x ; break ;
  |  |  ------------------
  |  |  |  Branch (983:22): [True: 682, False: 275]
  |  |  ------------------
  ------------------
  992|      0|		CASE_NAME (kALAC_MemFullError) ;
  ------------------
  |  |  983|      0|#define CASE_NAME(x)	case x : return #x ; break ;
  |  |  ------------------
  |  |  |  Branch (983:22): [True: 0, False: 957]
  |  |  ------------------
  ------------------
  993|     14|		CASE_NAME (fALAC_FrameLengthError) ;
  ------------------
  |  |  983|     14|#define CASE_NAME(x)	case x : return #x ; break ;
  |  |  ------------------
  |  |  |  Branch (983:22): [True: 14, False: 943]
  |  |  ------------------
  ------------------
  994|       |
  995|       |		/* Added for libsndfile */
  996|      5|		CASE_NAME (kALAC_BadBitWidth) ;
  ------------------
  |  |  983|      5|#define CASE_NAME(x)	case x : return #x ; break ;
  |  |  ------------------
  |  |  |  Branch (983:22): [True: 5, False: 952]
  |  |  ------------------
  ------------------
  997|      8|		CASE_NAME (kALAC_IncompatibleVersion) ;
  ------------------
  |  |  983|      8|#define CASE_NAME(x)	case x : return #x ; break ;
  |  |  ------------------
  |  |  |  Branch (983:22): [True: 8, False: 949]
  |  |  ------------------
  ------------------
  998|    136|		CASE_NAME (kALAC_BadSpecificConfigSize) ;
  ------------------
  |  |  983|    136|#define CASE_NAME(x)	case x : return #x ; break ;
  |  |  ------------------
  |  |  |  Branch (983:22): [True: 136, False: 821]
  |  |  ------------------
  ------------------
  999|      1|		CASE_NAME (kALAC_ZeroChannelCount) ;
  ------------------
  |  |  983|      1|#define CASE_NAME(x)	case x : return #x ; break ;
  |  |  ------------------
  |  |  |  Branch (983:22): [True: 1, False: 956]
  |  |  ------------------
  ------------------
 1000|     17|		CASE_NAME (kALAC_NumSamplesTooBig) ;
  ------------------
  |  |  983|     17|#define CASE_NAME(x)	case x : return #x ; break ;
  |  |  ------------------
  |  |  |  Branch (983:22): [True: 17, False: 940]
  |  |  ------------------
  ------------------
 1001|     94|		CASE_NAME (kALAC_UnsupportedElement) ;
  ------------------
  |  |  983|     94|#define CASE_NAME(x)	case x : return #x ; break ;
  |  |  ------------------
  |  |  |  Branch (983:22): [True: 94, False: 863]
  |  |  ------------------
  ------------------
 1002|      0|		default :
  ------------------
  |  Branch (1002:3): [True: 0, False: 957]
  ------------------
 1003|      0|			break ;
 1004|    957|		} ;
 1005|       |
 1006|      0|	snprintf (errstr, sizeof (errstr), "Unknown error %d", error) ;
 1007|      0|	return errstr ;
 1008|    957|} /* alac_error_string */
alac.c:alac_decode_block:
  405|  3.15k|{	ALAC_DECODER *pdec = &plac->u.decoder ;
  406|  3.15k|	uint32_t	packet_size ;
  407|  3.15k|	BitBuffer	bit_buffer ;
  408|  3.15k|	int32_t		error ;
  409|       |
  410|  3.15k|	packet_size = alac_reader_next_packet_size (plac->pakt_info) ;
  411|  3.15k|	if (packet_size == 0)
  ------------------
  |  Branch (411:6): [True: 344, False: 2.80k]
  ------------------
  412|    344|	{	if (plac->pakt_info->current < plac->pakt_info->count)
  ------------------
  |  Branch (412:8): [True: 0, False: 344]
  ------------------
  413|      0|			psf_log_printf (psf, "packet_size is 0 (%d of %d)\n", plac->pakt_info->current, plac->pakt_info->count) ;
  414|    344|		return 0 ;
  415|  2.80k|		} ;
  416|       |
  417|  2.80k|	psf_fseek (psf, plac->input_data_pos, SEEK_SET) ;
  418|       |
  419|  2.80k|	if (packet_size > sizeof (plac->byte_buffer))
  ------------------
  |  Branch (419:6): [True: 13, False: 2.79k]
  ------------------
  420|     13|	{	psf_log_printf (psf, "%s : bad packet_size (%u)\n", __func__, packet_size) ;
  421|     13|		return 0 ;
  422|  2.79k|		} ;
  423|       |
  424|  2.79k|	if ((packet_size != psf_fread (plac->byte_buffer, 1, packet_size, psf)))
  ------------------
  |  Branch (424:6): [True: 192, False: 2.60k]
  ------------------
  425|    192|		return 0 ;
  426|       |
  427|  2.60k|	BitBufferInit (&bit_buffer, plac->byte_buffer, packet_size) ;
  428|       |
  429|  2.60k|	plac->input_data_pos += packet_size ;
  430|  2.60k|	plac->frames_this_block = 0 ;
  431|  2.60k|	if ((error = alac_decode (pdec, &bit_buffer, plac->buffer, plac->frames_per_block, &plac->frames_this_block)) != ALAC_noErr)
  ------------------
  |  Branch (431:6): [True: 783, False: 1.81k]
  ------------------
  432|    783|	{	psf_log_printf (psf, "*** alac_decode() returned %s. ***\n", alac_error_string (error)) ;
  433|    783|		plac->frames_this_block = 0 ;
  434|    783|		return 0 ;
  435|  1.81k|		} ;
  436|       |
  437|  1.81k|	plac->partial_block_frames = 0 ;
  438|       |
  439|  1.81k|	return 1 ;
  440|  2.60k|} /* alac_decode_block */
alac.c:alac_reader_next_packet_size:
  371|  8.92k|{	if (info->current >= info->count)
  ------------------
  |  Branch (371:7): [True: 895, False: 8.03k]
  ------------------
  372|    895|		return 0 ;
  373|  8.03k|	return info->packet_size [info->current++] ;
  374|  8.92k|} /* alac_reader_next_packet_size */
alac.c:alac_read_f:
  528|  1.67M|{	ALAC_PRIVATE *plac ;
  529|  1.67M|	int			*iptr ;
  530|  1.67M|	int			k, readcount ;
  531|  1.67M|	sf_count_t	total = 0 ;
  532|  1.67M|	float		normfact ;
  533|       |
  534|  1.67M|	if ((plac = (ALAC_PRIVATE*) psf->codec_data) == NULL)
  ------------------
  |  Branch (534:6): [True: 0, False: 1.67M]
  ------------------
  535|      0|		return 0 ;
  536|       |
  537|  1.67M|	normfact = (psf->norm_float == SF_TRUE) ? 1.0 / ((float) 0x80000000) : 1.0 ;
  ------------------
  |  Branch (537:13): [True: 1.67M, False: 0]
  ------------------
  538|       |
  539|  3.34M|	while (len > 0)
  ------------------
  |  Branch (539:9): [True: 1.67M, False: 1.67M]
  ------------------
  540|  1.67M|	{	if (plac->partial_block_frames >= plac->frames_this_block && alac_decode_block (psf, plac) == 0)
  ------------------
  |  Branch (540:8): [True: 2.01k, False: 1.67M]
  |  Branch (540:65): [True: 342, False: 1.67k]
  ------------------
  541|    342|			break ;
  542|       |
  543|  1.67M|		readcount = (plac->frames_this_block - plac->partial_block_frames) * plac->channels ;
  544|  1.67M|		readcount = readcount > len ? (int) len : readcount ;
  ------------------
  |  Branch (544:15): [True: 1.67M, False: 1.67k]
  ------------------
  545|       |
  546|  1.67M|		iptr = plac->buffer + plac->partial_block_frames * plac->channels ;
  547|       |
  548|  4.33M|		for (k = 0 ; k < readcount ; k++)
  ------------------
  |  Branch (548:16): [True: 2.65M, False: 1.67M]
  ------------------
  549|  2.65M|			ptr [total + k] = normfact * iptr [k] ;
  550|       |
  551|  1.67M|		plac->partial_block_frames += readcount / plac->channels ;
  552|  1.67M|		total += readcount ;
  553|  1.67M|		len -= readcount ;
  554|  1.67M|		} ;
  555|       |
  556|  1.67M|	return total ;
  557|  1.67M|} /* alac_read_f */
alac.c:alac_seek:
  597|  1.54k|{	ALAC_PRIVATE *plac ;
  598|  1.54k|	int			newblock, newsample ;
  599|       |
  600|  1.54k|	if (! psf->codec_data)
  ------------------
  |  Branch (600:6): [True: 0, False: 1.54k]
  ------------------
  601|      0|		return 0 ;
  602|  1.54k|	plac = (ALAC_PRIVATE*) psf->codec_data ;
  603|       |
  604|  1.54k|	if (psf->datalength < 0 || psf->dataoffset < 0)
  ------------------
  |  Branch (604:6): [True: 4, False: 1.54k]
  |  Branch (604:29): [True: 0, False: 1.54k]
  ------------------
  605|      4|	{	psf->error = SFE_BAD_SEEK ;
  606|      4|		return PSF_SEEK_ERROR ;
  ------------------
  |  |   78|      4|#define	PSF_SEEK_ERROR			((sf_count_t) -1)
  ------------------
  607|  1.54k|		} ;
  608|       |
  609|  1.54k|	if (offset == 0)
  ------------------
  |  Branch (609:6): [True: 1.17k, False: 366]
  ------------------
  610|  1.17k|	{	psf_fseek (psf, psf->dataoffset, SEEK_SET) ;
  611|       |
  612|  1.17k|		plac->frames_this_block = 0 ;
  613|  1.17k|		plac->input_data_pos = psf->dataoffset ;
  614|  1.17k|		plac->pakt_info->current = 0 ;
  615|  1.17k|		return 0 ;
  616|  1.17k|		} ;
  617|       |
  618|    366|	if (offset < 0 || offset > plac->pakt_info->count * plac->frames_per_block)
  ------------------
  |  Branch (618:6): [True: 0, False: 366]
  |  Branch (618:20): [True: 0, False: 366]
  ------------------
  619|      0|	{	psf->error = SFE_BAD_SEEK ;
  620|      0|		return	PSF_SEEK_ERROR ;
  ------------------
  |  |   78|      0|#define	PSF_SEEK_ERROR			((sf_count_t) -1)
  ------------------
  621|    366|		} ;
  622|       |
  623|    366|	newblock	= offset / plac->frames_per_block ;
  624|    366|	newsample	= offset % plac->frames_per_block ;
  625|       |
  626|    366|	if (mode == SFM_READ)
  ------------------
  |  Branch (626:6): [True: 366, False: 0]
  ------------------
  627|    366|	{	plac->input_data_pos = psf->dataoffset + alac_pakt_block_offset (plac->pakt_info, newblock) ;
  628|       |
  629|    366|		plac->pakt_info->current = newblock ;
  630|    366|		alac_decode_block (psf, plac) ;
  631|    366|		plac->partial_block_frames = newsample ;
  632|    366|		}
  633|      0|	else
  634|      0|	{	/* What to do about write??? */
  635|      0|		psf->error = SFE_BAD_SEEK ;
  636|      0|		return	PSF_SEEK_ERROR ;
  ------------------
  |  |   78|      0|#define	PSF_SEEK_ERROR			((sf_count_t) -1)
  ------------------
  637|    366|		} ;
  638|       |
  639|    366|	return newblock * plac->frames_per_block + newsample ;
  640|    366|} /* alac_seek */
alac.c:alac_pakt_block_offset:
  949|    366|{	sf_count_t offset = 0 ;
  950|    366|	uint32_t k ;
  951|       |
  952|  4.66k|	for (k = 0 ; k < block ; k++)
  ------------------
  |  Branch (952:15): [True: 4.29k, False: 366]
  ------------------
  953|  4.29k|		offset += info->packet_size [k] ;
  954|       |
  955|    366|	return offset ;
  956|    366|} /* alac_pakt_block_offset */
alac.c:alac_reader_calc_frames:
  378|    775|{	sf_count_t	frames = 0 ;
  379|    775|	uint32_t	current_pos = 1, blocks = 0 ;
  380|       |
  381|    775|	plac->pakt_info->current = 0 ;
  382|       |
  383|  6.55k|	while (current_pos < psf->filelength && current_pos > 0)
  ------------------
  |  Branch (383:9): [True: 6.48k, False: 70]
  |  Branch (383:42): [True: 5.77k, False: 705]
  ------------------
  384|  5.77k|	{	current_pos = alac_reader_next_packet_size (plac->pakt_info) ;
  385|  5.77k|		blocks = current_pos > 0 ? blocks + 1 : blocks ;
  ------------------
  |  Branch (385:12): [True: 5.07k, False: 705]
  ------------------
  386|  5.77k|		} ;
  387|       |
  388|    775|	if (blocks == 0)
  ------------------
  |  Branch (388:6): [True: 3, False: 772]
  ------------------
  389|      3|		return 0 ;
  390|       |
  391|       |	/* Only count full blocks. */
  392|    772|	frames = plac->frames_per_block * (blocks - 1) ;
  393|       |
  394|    772|	alac_seek (psf, SFM_READ, frames) ;
  395|    772|	alac_decode_block (psf, plac) ;
  396|    772|	frames += plac->frames_this_block ;
  397|       |
  398|    772|	plac->pakt_info->current = 0 ;
  399|       |
  400|    772|	return frames ;
  401|    775|} /* alac_reader_calc_frames */

alaw_init:
   50|    366|{
   51|    366|	if (psf->file.mode == SFM_READ || psf->file.mode == SFM_RDWR)
  ------------------
  |  Branch (51:6): [True: 366, False: 0]
  |  Branch (51:36): [True: 0, False: 0]
  ------------------
   52|    366|	{	psf->read_short		= alaw_read_alaw2s ;
   53|    366|		psf->read_int		= alaw_read_alaw2i ;
   54|    366|		psf->read_float		= alaw_read_alaw2f ;
   55|    366|		psf->read_double	= alaw_read_alaw2d ;
   56|    366|		} ;
   57|       |
   58|    366|	if (psf->file.mode == SFM_WRITE || psf->file.mode == SFM_RDWR)
  ------------------
  |  Branch (58:6): [True: 0, False: 366]
  |  Branch (58:37): [True: 0, False: 366]
  ------------------
   59|      0|	{	psf->write_short	= alaw_write_s2alaw ;
   60|      0|		psf->write_int		= alaw_write_i2alaw ;
   61|      0|		psf->write_float	= alaw_write_f2alaw ;
   62|      0|		psf->write_double	= alaw_write_d2alaw ;
   63|      0|		} ;
   64|       |
   65|    366|	psf->bytewidth = 1 ;
   66|    366|	psf->blockwidth = psf->sf.channels ;
   67|       |
   68|    366|	if (psf->filelength > psf->dataoffset)
  ------------------
  |  Branch (68:6): [True: 231, False: 135]
  ------------------
   69|    231|		psf->datalength = (psf->dataend) ? psf->dataend - psf->dataoffset : psf->filelength - psf->dataoffset ;
  ------------------
  |  Branch (69:21): [True: 98, False: 133]
  ------------------
   70|    135|	else
   71|    135|		psf->datalength = 0 ;
   72|       |
   73|    366|	psf->sf.frames = psf->blockwidth > 0 ? psf->datalength / psf->blockwidth : 0 ;
  ------------------
  |  Branch (73:19): [True: 309, False: 57]
  ------------------
   74|       |
   75|    366|	return 0 ;
   76|    366|} /* alaw_init */
alaw.c:alaw_read_alaw2f:
  416|  1.08M|{	BUF_UNION	ubuf ;
  417|  1.08M|	int			bufferlen, readcount ;
  418|  1.08M|	sf_count_t	total = 0 ;
  419|  1.08M|	float	normfact ;
  420|       |
  421|  1.08M|	normfact = (psf->norm_float == SF_TRUE) ? 1.0 / ((float) 0x8000) : 1.0 ;
  ------------------
  |  Branch (421:13): [True: 1.08M, False: 0]
  ------------------
  422|       |
  423|  1.08M|	bufferlen = ARRAY_LEN (ubuf.ucbuf) ;
  ------------------
  |  |   88|  1.08M|#define		ARRAY_LEN(x)	((int) (sizeof (x) / sizeof ((x) [0])))
  ------------------
  424|       |
  425|  2.16M|	while (len > 0)
  ------------------
  |  Branch (425:9): [True: 1.08M, False: 1.08M]
  ------------------
  426|  1.08M|	{	if (len < bufferlen)
  ------------------
  |  Branch (426:8): [True: 1.08M, False: 0]
  ------------------
  427|  1.08M|			bufferlen = (int) len ;
  428|  1.08M|		readcount = (int) psf_fread (ubuf.ucbuf, 1, bufferlen, psf) ;
  429|  1.08M|		alaw2f_array (ubuf.ucbuf, readcount, ptr + total, normfact) ;
  430|  1.08M|		total += readcount ;
  431|  1.08M|		if (readcount < bufferlen)
  ------------------
  |  Branch (431:7): [True: 55, False: 1.08M]
  ------------------
  432|     55|			break ;
  433|  1.08M|		len -= readcount ;
  434|  1.08M|		} ;
  435|       |
  436|  1.08M|	return total ;
  437|  1.08M|} /* alaw_read_alaw2f */
alaw.c:alaw2f_array:
  307|  4.67M|{	for (int i = 0 ; i < count ; i++)
  ------------------
  |  Branch (307:20): [True: 3.59M, False: 1.08M]
  ------------------
  308|  3.59M|		ptr [i] = normfact * alaw_decode [(int) buffer [i]] ;
  309|  1.08M|} /* alaw2f_array */

au_open:
  106|  1.46k|{	int		subformat ;
  107|  1.46k|	int		error = 0 ;
  108|       |
  109|  1.46k|	if (psf->file.mode == SFM_READ || (psf->file.mode == SFM_RDWR && psf->filelength > 0))
  ------------------
  |  Branch (109:6): [True: 1.46k, False: 0]
  |  Branch (109:37): [True: 0, False: 0]
  |  Branch (109:67): [True: 0, False: 0]
  ------------------
  110|  1.46k|	{	if ((error = au_read_header (psf)))
  ------------------
  |  Branch (110:8): [True: 168, False: 1.29k]
  ------------------
  111|    168|			return error ;
  112|  1.46k|		} ;
  113|       |
  114|  1.29k|	if ((SF_CONTAINER (psf->sf.format)) != SF_FORMAT_AU)
  ------------------
  |  |  101|  1.29k|#define SF_CONTAINER(x)		((x) & SF_FORMAT_TYPEMASK)
  ------------------
  |  Branch (114:6): [True: 24, False: 1.26k]
  ------------------
  115|     24|		return	SFE_BAD_OPEN_FORMAT ;
  116|       |
  117|  1.26k|	subformat = SF_CODEC (psf->sf.format) ;
  ------------------
  |  |  102|  1.26k|#define SF_CODEC(x)			((x) & SF_FORMAT_SUBMASK)
  ------------------
  118|       |
  119|  1.26k|	if (psf->file.mode == SFM_WRITE || psf->file.mode == SFM_RDWR)
  ------------------
  |  Branch (119:6): [True: 0, False: 1.26k]
  |  Branch (119:37): [True: 0, False: 1.26k]
  ------------------
  120|      0|	{	psf->endian = SF_ENDIAN (psf->sf.format) ;
  ------------------
  |  |  103|      0|#define SF_ENDIAN(x)		((x) & SF_FORMAT_ENDMASK)
  ------------------
  121|      0|		if (CPU_IS_LITTLE_ENDIAN && psf->endian == SF_ENDIAN_CPU)
  ------------------
  |  |   14|      0|#define CPU_IS_LITTLE_ENDIAN 1
  |  |  ------------------
  |  |  |  Branch (14:30): [True: 0, Folded]
  |  |  ------------------
  ------------------
  |  Branch (121:31): [True: 0, False: 0]
  ------------------
  122|      0|			psf->endian = SF_ENDIAN_LITTLE ;
  123|      0|		else if (psf->endian != SF_ENDIAN_LITTLE)
  ------------------
  |  Branch (123:12): [True: 0, False: 0]
  ------------------
  124|      0|			psf->endian = SF_ENDIAN_BIG ;
  125|       |
  126|      0|		if (au_write_header (psf, SF_FALSE))
  ------------------
  |  Branch (126:7): [True: 0, False: 0]
  ------------------
  127|      0|			return psf->error ;
  128|       |
  129|      0|		psf->write_header = au_write_header ;
  130|  1.26k|		} ;
  131|       |
  132|  1.26k|	psf->container_close = au_close ;
  133|       |
  134|  1.26k|	psf->blockwidth = (sf_count_t) psf->bytewidth * psf->sf.channels ;
  135|       |
  136|  1.26k|	switch (subformat)
  137|  1.26k|	{	case SF_FORMAT_ULAW :	/* 8-bit Ulaw encoding. */
  ------------------
  |  Branch (137:4): [True: 139, False: 1.12k]
  ------------------
  138|    139|				ulaw_init (psf) ;
  139|    139|				break ;
  140|       |
  141|     34|		case SF_FORMAT_PCM_S8 :	/* 8-bit linear PCM. */
  ------------------
  |  Branch (141:3): [True: 34, False: 1.23k]
  ------------------
  142|     34|				error = pcm_init (psf) ;
  143|     34|				break ;
  144|       |
  145|     64|		case SF_FORMAT_PCM_16 :	/* 16-bit linear PCM. */
  ------------------
  |  Branch (145:3): [True: 64, False: 1.20k]
  ------------------
  146|    148|		case SF_FORMAT_PCM_24 :	/* 24-bit linear PCM */
  ------------------
  |  Branch (146:3): [True: 84, False: 1.18k]
  ------------------
  147|    194|		case SF_FORMAT_PCM_32 :	/* 32-bit linear PCM. */
  ------------------
  |  Branch (147:3): [True: 46, False: 1.22k]
  ------------------
  148|    194|				error = pcm_init (psf) ;
  149|    194|				break ;
  150|       |
  151|     98|		case SF_FORMAT_ALAW :	/* 8-bit Alaw encoding. */
  ------------------
  |  Branch (151:3): [True: 98, False: 1.17k]
  ------------------
  152|     98|				alaw_init (psf) ;
  153|     98|				break ;
  154|       |
  155|       |		/* Lite remove start */
  156|    127|		case SF_FORMAT_FLOAT :	/* 32-bit floats. */
  ------------------
  |  Branch (156:3): [True: 127, False: 1.14k]
  ------------------
  157|    127|				error = float32_init (psf) ;
  158|    127|				break ;
  159|       |
  160|    131|		case SF_FORMAT_DOUBLE :	/* 64-bit double precision floats. */
  ------------------
  |  Branch (160:3): [True: 131, False: 1.13k]
  ------------------
  161|    131|				error = double64_init (psf) ;
  162|    131|				break ;
  163|       |
  164|     84|		case SF_FORMAT_G721_32 :
  ------------------
  |  Branch (164:3): [True: 84, False: 1.18k]
  ------------------
  165|     84|				error = g72x_init (psf) ;
  166|     84|				psf->sf.seekable = SF_FALSE ;
  167|     84|				break ;
  168|       |
  169|    382|		case SF_FORMAT_G723_24 :
  ------------------
  |  Branch (169:3): [True: 382, False: 886]
  ------------------
  170|    382|				error = g72x_init (psf) ;
  171|    382|				psf->sf.seekable = SF_FALSE ;
  172|    382|				break ;
  173|       |
  174|     79|		case SF_FORMAT_G723_40 :
  ------------------
  |  Branch (174:3): [True: 79, False: 1.18k]
  ------------------
  175|     79|				error = g72x_init (psf) ;
  176|     79|				psf->sf.seekable = SF_FALSE ;
  177|     79|				break ;
  178|       |		/* Lite remove end */
  179|       |
  180|      0|		default :	break ;
  ------------------
  |  Branch (180:3): [True: 0, False: 1.26k]
  ------------------
  181|  1.26k|		} ;
  182|       |
  183|  1.26k|	return error ;
  184|  1.26k|} /* au_open */
au.c:au_close:
  191|  1.26k|{
  192|  1.26k|	if (psf->file.mode == SFM_WRITE || psf->file.mode == SFM_RDWR)
  ------------------
  |  Branch (192:6): [True: 0, False: 1.26k]
  |  Branch (192:37): [True: 0, False: 1.26k]
  ------------------
  193|      0|		au_write_header (psf, SF_TRUE) ;
  194|       |
  195|  1.26k|	return 0 ;
  196|  1.26k|} /* au_close */
au.c:au_read_header:
  292|  1.46k|{	AU_FMT	au_fmt ;
  293|  1.46k|	int		marker, dword ;
  294|  1.46k|	sf_count_t data_end ;
  295|       |
  296|  1.46k|	memset (&au_fmt, 0, sizeof (au_fmt)) ;
  297|  1.46k|	psf_binheader_readf (psf, "pm", 0, &marker) ;
  298|  1.46k|	psf_log_printf (psf, "%M\n", marker) ;
  299|       |
  300|  1.46k|	if (marker == DOTSND_MARKER)
  ------------------
  |  |   34|  1.46k|#define DOTSND_MARKER	(MAKE_MARKER ('.', 's', 'n', 'd'))
  |  |  ------------------
  |  |  |  |  122|  1.46k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (300:6): [True: 732, False: 728]
  ------------------
  301|    732|	{	psf->endian = SF_ENDIAN_BIG ;
  302|       |
  303|    732|		psf_binheader_readf (psf, "E44444", &(au_fmt.dataoffset), &(au_fmt.datasize),
  304|    732|					&(au_fmt.encoding), &(au_fmt.samplerate), &(au_fmt.channels)) ;
  305|    732|		}
  306|    728|	else if (marker == DNSDOT_MARKER)
  ------------------
  |  |   35|    728|#define DNSDOT_MARKER	(MAKE_MARKER ('d', 'n', 's', '.'))
  |  |  ------------------
  |  |  |  |  122|    728|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (306:11): [True: 728, False: 0]
  ------------------
  307|    728|	{	psf->endian = SF_ENDIAN_LITTLE ;
  308|    728|		psf_binheader_readf (psf, "e44444", &(au_fmt.dataoffset), &(au_fmt.datasize),
  309|    728|					&(au_fmt.encoding), &(au_fmt.samplerate), &(au_fmt.channels)) ;
  310|    728|		}
  311|      0|	else
  312|      0|		return SFE_AU_NO_DOTSND ;
  313|       |
  314|  1.46k|	psf_log_printf (psf, "  Data Offset : %d\n", au_fmt.dataoffset) ;
  315|       |
  316|  1.46k|	if (psf->fileoffset > 0 && au_fmt.datasize == -1)
  ------------------
  |  Branch (316:6): [True: 71, False: 1.38k]
  |  Branch (316:29): [True: 1, False: 70]
  ------------------
  317|      1|	{	psf_log_printf (psf, "  Data Size   : -1\n") ;
  318|      1|		return SFE_AU_EMBED_BAD_LEN ;
  319|  1.45k|		} ;
  320|       |
  321|  1.45k|	data_end = (sf_count_t) au_fmt.dataoffset + (sf_count_t) au_fmt.datasize ;
  322|  1.45k|	if (psf->fileoffset > 0)
  ------------------
  |  Branch (322:6): [True: 70, False: 1.38k]
  ------------------
  323|     70|	{	psf->filelength = data_end ;
  324|     70|		psf_log_printf (psf, "  Data Size   : %d\n", au_fmt.datasize) ;
  325|     70|		}
  326|  1.38k|	else if (au_fmt.datasize == -1 || data_end == psf->filelength)
  ------------------
  |  Branch (326:11): [True: 19, False: 1.37k]
  |  Branch (326:36): [True: 2, False: 1.36k]
  ------------------
  327|     21|		psf_log_printf (psf, "  Data Size   : %d\n", au_fmt.datasize) ;
  328|  1.36k|	else if (data_end < psf->filelength)
  ------------------
  |  Branch (328:11): [True: 526, False: 842]
  ------------------
  329|    526|	{	psf->filelength = data_end ;
  330|    526|		psf_log_printf (psf, "  Data Size   : %d\n", au_fmt.datasize) ;
  331|    526|		}
  332|    842|	else
  333|    842|	{	dword = psf->filelength - au_fmt.dataoffset ;
  334|    842|		psf_log_printf (psf, "  Data Size   : %d (should be %d)\n", au_fmt.datasize, dword) ;
  335|    842|		au_fmt.datasize = dword ;
  336|    842|		} ;
  337|       |
  338|  1.45k| 	psf->dataoffset = au_fmt.dataoffset ;
  339|  1.45k|	psf->datalength = psf->filelength - psf->dataoffset ;
  340|       |
  341|  1.45k|	if (psf_ftell (psf) < psf->dataoffset)
  ------------------
  |  Branch (341:6): [True: 302, False: 1.15k]
  ------------------
  342|    302|		psf_binheader_readf (psf, "j", psf->dataoffset - psf_ftell (psf)) ;
  343|       |
  344|  1.45k|	psf->sf.samplerate	= au_fmt.samplerate ;
  345|  1.45k|	psf->sf.channels 	= au_fmt.channels ;
  346|       |
  347|       |	/* Only fill in type major. */
  348|  1.45k|	if (psf->endian == SF_ENDIAN_BIG)
  ------------------
  |  Branch (348:6): [True: 731, False: 728]
  ------------------
  349|    731|		psf->sf.format = SF_FORMAT_AU ;
  350|    728|	else if (psf->endian == SF_ENDIAN_LITTLE)
  ------------------
  |  Branch (350:11): [True: 728, False: 0]
  ------------------
  351|    728|		psf->sf.format = SF_ENDIAN_LITTLE | SF_FORMAT_AU ;
  352|       |
  353|  1.45k|	psf_log_printf (psf, "  Encoding    : %d => ", au_fmt.encoding) ;
  354|       |
  355|  1.45k|	psf->sf.format = SF_ENDIAN (psf->sf.format) ;
  ------------------
  |  |  103|  1.45k|#define SF_ENDIAN(x)		((x) & SF_FORMAT_ENDMASK)
  ------------------
  356|       |
  357|  1.45k|	switch (au_fmt.encoding)
  358|  1.45k|	{	case AU_ENCODING_ULAW_8 :
  ------------------
  |  Branch (358:4): [True: 139, False: 1.32k]
  ------------------
  359|    139|				psf->sf.format |= SF_FORMAT_AU | SF_FORMAT_ULAW ;
  360|    139|				psf->bytewidth = 1 ;	/* Before decoding */
  361|    139|				psf_log_printf (psf, "8-bit ISDN u-law\n") ;
  362|    139|				break ;
  363|       |
  364|     34|		case AU_ENCODING_PCM_8 :
  ------------------
  |  Branch (364:3): [True: 34, False: 1.42k]
  ------------------
  365|     34|				psf->sf.format |= SF_FORMAT_AU | SF_FORMAT_PCM_S8 ;
  366|     34|				psf->bytewidth = 1 ;
  367|     34|				psf_log_printf (psf, "8-bit linear PCM\n") ;
  368|     34|				break ;
  369|       |
  370|     64|		case AU_ENCODING_PCM_16 :
  ------------------
  |  Branch (370:3): [True: 64, False: 1.39k]
  ------------------
  371|     64|				psf->sf.format |= SF_FORMAT_AU | SF_FORMAT_PCM_16 ;
  372|     64|				psf->bytewidth = 2 ;
  373|     64|				psf_log_printf (psf, "16-bit linear PCM\n") ;
  374|     64|				break ;
  375|       |
  376|     84|		case AU_ENCODING_PCM_24 :
  ------------------
  |  Branch (376:3): [True: 84, False: 1.37k]
  ------------------
  377|     84|				psf->sf.format |= SF_FORMAT_AU | SF_FORMAT_PCM_24 ;
  378|     84|				psf->bytewidth = 3 ;
  379|     84|				psf_log_printf (psf, "24-bit linear PCM\n") ;
  380|     84|				break ;
  381|       |
  382|     46|		case AU_ENCODING_PCM_32 :
  ------------------
  |  Branch (382:3): [True: 46, False: 1.41k]
  ------------------
  383|     46|				psf->sf.format |= SF_FORMAT_AU | SF_FORMAT_PCM_32 ;
  384|     46|				psf->bytewidth = 4 ;
  385|     46|				psf_log_printf (psf, "32-bit linear PCM\n") ;
  386|     46|				break ;
  387|       |
  388|    129|		case AU_ENCODING_FLOAT :
  ------------------
  |  Branch (388:3): [True: 129, False: 1.33k]
  ------------------
  389|    129|				psf->sf.format |= SF_FORMAT_AU | SF_FORMAT_FLOAT ;
  390|    129|				psf->bytewidth = 4 ;
  391|    129|				psf_log_printf (psf, "32-bit float\n") ;
  392|    129|				break ;
  393|       |
  394|    131|		case AU_ENCODING_DOUBLE :
  ------------------
  |  Branch (394:3): [True: 131, False: 1.32k]
  ------------------
  395|    131|				psf->sf.format |= SF_FORMAT_AU | SF_FORMAT_DOUBLE ;
  396|    131|				psf->bytewidth = 8 ;
  397|    131|				psf_log_printf (psf, "64-bit double precision float\n") ;
  398|    131|				break ;
  399|       |
  400|     98|		case AU_ENCODING_ALAW_8 :
  ------------------
  |  Branch (400:3): [True: 98, False: 1.36k]
  ------------------
  401|     98|				psf->sf.format |= SF_FORMAT_AU | SF_FORMAT_ALAW ;
  402|     98|				psf->bytewidth = 1 ;	/* Before decoding */
  403|     98|				psf_log_printf (psf, "8-bit ISDN A-law\n") ;
  404|     98|				break ;
  405|       |
  406|     84|		case AU_ENCODING_ADPCM_G721_32 :
  ------------------
  |  Branch (406:3): [True: 84, False: 1.37k]
  ------------------
  407|     84|				psf->sf.format |= SF_FORMAT_AU | SF_FORMAT_G721_32 ;
  408|     84|				psf->bytewidth = 0 ;
  409|     84|				psf_log_printf (psf, "G721 32kbs ADPCM\n") ;
  410|     84|				break ;
  411|       |
  412|    382|		case AU_ENCODING_ADPCM_G723_24 :
  ------------------
  |  Branch (412:3): [True: 382, False: 1.07k]
  ------------------
  413|    382|				psf->sf.format |= SF_FORMAT_AU | SF_FORMAT_G723_24 ;
  414|    382|				psf->bytewidth = 0 ;
  415|    382|				psf_log_printf (psf, "G723 24kbs ADPCM\n") ;
  416|    382|				break ;
  417|       |
  418|     79|		case AU_ENCODING_ADPCM_G723_40 :
  ------------------
  |  Branch (418:3): [True: 79, False: 1.38k]
  ------------------
  419|     79|				psf->sf.format |= SF_FORMAT_AU | SF_FORMAT_G723_40 ;
  420|     79|				psf->bytewidth = 0 ;
  421|     79|				psf_log_printf (psf, "G723 40kbs ADPCM\n") ;
  422|     79|				break ;
  423|       |
  424|      1|		case AU_ENCODING_ADPCM_G722 :
  ------------------
  |  Branch (424:3): [True: 1, False: 1.45k]
  ------------------
  425|      1|				psf_log_printf (psf, "G722 64 kbs ADPCM (unsupported)\n") ;
  426|      1|				break ;
  427|       |
  428|      3|		case AU_ENCODING_NEXT :
  ------------------
  |  Branch (428:3): [True: 3, False: 1.45k]
  ------------------
  429|      3|				psf_log_printf (psf, "Weird NeXT encoding format (unsupported)\n") ;
  430|      3|				break ;
  431|       |
  432|    185|		default :
  ------------------
  |  Branch (432:3): [True: 185, False: 1.27k]
  ------------------
  433|    185|				psf_log_printf (psf, "Unknown!!\n") ;
  434|    185|				break ;
  435|  1.45k|		} ;
  436|       |
  437|  1.45k|	psf_log_printf (psf, "  Sample Rate : %d\n", au_fmt.samplerate) ;
  438|  1.45k|	if (au_fmt.channels < 1)
  ------------------
  |  Branch (438:6): [True: 85, False: 1.37k]
  ------------------
  439|     85|	{	psf_log_printf (psf, "  Channels    : %d  **** should be >= 1\n", au_fmt.channels) ;
  440|     85|		return SFE_CHANNEL_COUNT_ZERO ;
  441|     85|		}
  442|  1.37k|	else if (au_fmt.channels > SF_MAX_CHANNELS)
  ------------------
  |  |   95|  1.37k|#define		SF_MAX_CHANNELS		1024
  ------------------
  |  Branch (442:11): [True: 82, False: 1.29k]
  ------------------
  443|     82|	{	psf_log_printf (psf, "  Channels    : %d  **** should be <= %d\n", au_fmt.channels, SF_MAX_CHANNELS) ;
  ------------------
  |  |   95|     82|#define		SF_MAX_CHANNELS		1024
  ------------------
  444|     82|		return SFE_CHANNEL_COUNT ;
  445|  1.29k|		} ;
  446|       |
  447|  1.29k|	psf_log_printf (psf, "  Channels    : %d\n", au_fmt.channels) ;
  448|       |
  449|  1.29k|	psf->blockwidth = (sf_count_t) psf->sf.channels * psf->bytewidth ;
  450|       |
  451|  1.29k|	if (! psf->sf.frames && psf->blockwidth)
  ------------------
  |  Branch (451:6): [True: 1.29k, False: 0]
  |  Branch (451:26): [True: 723, False: 569]
  ------------------
  452|    723|		psf->sf.frames = (psf->filelength - psf->dataoffset) / psf->blockwidth ;
  453|       |
  454|  1.29k|	return 0 ;
  455|  1.45k|} /* au_read_header */

audio_detect:
   48|  2.46k|{	VOTE vote ;
   49|       |
   50|  2.46k|	if (psf == NULL)
  ------------------
  |  Branch (50:6): [True: 0, False: 2.46k]
  ------------------
   51|      0|		return 0 ;
   52|       |
   53|  2.46k|	if (ad == NULL || datalen < 256)
  ------------------
  |  Branch (53:6): [True: 0, False: 2.46k]
  |  Branch (53:20): [True: 0, False: 2.46k]
  ------------------
   54|      0|		return 0 ;
   55|       |
   56|  2.46k|	vote_for_format (&vote, data, datalen) ;
   57|       |
   58|  2.46k|	psf_log_printf (psf, "audio_detect :\n"
   59|  2.46k|			"    le_float     : %d\n"
   60|  2.46k|			"    be_float     : %d\n"
   61|  2.46k|			"    le_int_24_32 : %d\n"
   62|  2.46k|			"    be_int_24_32 : %d\n",
   63|  2.46k|			vote.le_float, vote.be_float, vote.le_int_24_32, vote.be_int_24_32) ;
   64|       |
   65|  2.46k|	if (0) puts (psf->parselog.buf) ;
  ------------------
  |  Branch (65:6): [Folded, False: 2.46k]
  ------------------
   66|       |
   67|  2.46k|	if (ad->endianness == SF_ENDIAN_LITTLE && vote.le_float > (3 * datalen) / 4)
  ------------------
  |  Branch (67:6): [True: 2.46k, False: 0]
  |  Branch (67:44): [True: 5, False: 2.45k]
  ------------------
   68|      5|	{	/* Almost certainly 32 bit floats. */
   69|      5|		return SF_FORMAT_FLOAT ;
   70|  2.45k|		} ;
   71|       |
   72|  2.45k|	if (ad->endianness == SF_ENDIAN_LITTLE && vote.le_int_24_32 > (3 * datalen) / 4)
  ------------------
  |  Branch (72:6): [True: 2.45k, False: 0]
  |  Branch (72:44): [True: 7, False: 2.45k]
  ------------------
   73|      7|	{	/* Almost certainly 24 bit data stored in 32 bit ints. */
   74|      7|		return SF_FORMAT_PCM_32 ;
   75|  2.45k|		} ;
   76|       |
   77|  2.45k|	return 0 ;
   78|  2.45k|} /* data_detect */
audio_detect.c:vote_for_format:
   82|  2.46k|{
   83|  2.46k|	int k ;
   84|       |
   85|  2.46k|	memset (vote, 0, sizeof (VOTE)) ;
   86|       |
   87|  2.46k|	datalen -= datalen % 4 ;
   88|       |
   89|  10.0M|	for (k = 0 ; k < datalen ; k ++)
  ------------------
  |  Branch (89:15): [True: 10.0M, False: 2.46k]
  ------------------
   90|  10.0M|	{	if ((k % 4) == 0)
  ------------------
  |  Branch (90:8): [True: 2.52M, False: 7.56M]
  ------------------
   91|  2.52M|		{	if (data [k] == 0 && data [k + 1] != 0)
  ------------------
  |  Branch (91:9): [True: 2.40M, False: 119k]
  |  Branch (91:26): [True: 9.92k, False: 2.39M]
  ------------------
   92|  9.92k|				vote->le_int_24_32 += 4 ;
   93|       |
   94|  2.52M|			if (data [2] != 0 && data [3] == 0)
  ------------------
  |  Branch (94:8): [True: 126k, False: 2.39M]
  |  Branch (94:25): [True: 7.16k, False: 119k]
  ------------------
   95|  7.16k|				vote->le_int_24_32 += 4 ;
   96|       |
   97|  2.52M|			if (data [0] != 0 && data [3] > 0x43 && data [3] < 0x4B)
  ------------------
  |  Branch (97:8): [True: 126k, False: 2.39M]
  |  Branch (97:25): [True: 79.8k, False: 47.1k]
  |  Branch (97:44): [True: 5.12k, False: 74.7k]
  ------------------
   98|  5.12k|				vote->le_float += 4 ;
   99|       |
  100|  2.52M|			if (data [3] != 0 && data [0] > 0x43 && data [0] < 0x4B)
  ------------------
  |  Branch (100:8): [True: 129k, False: 2.39M]
  |  Branch (100:25): [True: 81.9k, False: 47.1k]
  |  Branch (100:44): [True: 4.09k, False: 77.8k]
  ------------------
  101|  4.09k|				vote->be_float += 4 ;
  102|  2.52M|			} ;
  103|  10.0M|		} ;
  104|       |
  105|  2.46k|	return ;
  106|  2.46k|} /* vote_for_format */

avr_open:
   79|    106|{	int		error = 0 ;
   80|       |
   81|    106|	if (psf->file.mode == SFM_READ || (psf->file.mode == SFM_RDWR && psf->filelength > 0))
  ------------------
  |  Branch (81:6): [True: 106, False: 0]
  |  Branch (81:37): [True: 0, False: 0]
  |  Branch (81:67): [True: 0, False: 0]
  ------------------
   82|    106|	{	if ((error = avr_read_header (psf)))
  ------------------
  |  Branch (82:8): [True: 41, False: 65]
  ------------------
   83|     41|			return error ;
   84|    106|		} ;
   85|       |
   86|     65|	if ((SF_CONTAINER (psf->sf.format)) != SF_FORMAT_AVR)
  ------------------
  |  |  101|     65|#define SF_CONTAINER(x)		((x) & SF_FORMAT_TYPEMASK)
  ------------------
  |  Branch (86:6): [True: 0, False: 65]
  ------------------
   87|      0|		return	SFE_BAD_OPEN_FORMAT ;
   88|       |
   89|     65|	if (psf->file.mode == SFM_WRITE || psf->file.mode == SFM_RDWR)
  ------------------
  |  Branch (89:6): [True: 0, False: 65]
  |  Branch (89:37): [True: 0, False: 65]
  ------------------
   90|      0|	{	psf->endian = SF_ENDIAN_BIG ;
   91|       |
   92|      0|		if (avr_write_header (psf, SF_FALSE))
  ------------------
  |  Branch (92:7): [True: 0, False: 0]
  ------------------
   93|      0|			return psf->error ;
   94|       |
   95|      0|		psf->write_header = avr_write_header ;
   96|     65|		} ;
   97|       |
   98|     65|	psf->container_close = avr_close ;
   99|       |
  100|     65|	psf->blockwidth = (sf_count_t) psf->bytewidth * psf->sf.channels ;
  101|       |
  102|     65|	error = pcm_init (psf) ;
  103|       |
  104|     65|	return error ;
  105|     65|} /* avr_open */
avr.c:avr_read_header:
  109|    106|{	AVR_HEADER	hdr ;
  110|       |
  111|    106|	memset (&hdr, 0, sizeof (hdr)) ;
  112|       |
  113|    106|	psf_binheader_readf (psf, "pmb", 0, &hdr.marker, &hdr.name, sizeof (hdr.name)) ;
  114|    106|	psf_log_printf (psf, "%M\n", hdr.marker) ;
  115|       |
  116|    106|	if (hdr.marker != TWOBIT_MARKER)
  ------------------
  |  |   28|    106|#define TWOBIT_MARKER	(MAKE_MARKER ('2', 'B', 'I', 'T'))
  |  |  ------------------
  |  |  |  |  122|    106|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (116:6): [True: 0, False: 106]
  ------------------
  117|      0|		return SFE_AVR_NOT_AVR ;
  118|       |
  119|    106|	psf_log_printf (psf, "  Name        : %s\n", hdr.name) ;
  120|       |
  121|    106|	psf_binheader_readf (psf, "E22222", &hdr.mono, &hdr.rez, &hdr.sign, &hdr.loop, &hdr.midi) ;
  122|       |
  123|    106|	psf->sf.channels = (hdr.mono & 1) + 1 ;
  124|       |
  125|    106|	psf_log_printf (psf, "  Channels    : %d\n  Bit width   : %d\n  Signed      : %s\n",
  126|    106|			(hdr.mono & 1) + 1, hdr.rez, hdr.sign ? "yes" : "no") ;
  ------------------
  |  Branch (126:33): [True: 98, False: 8]
  ------------------
  127|       |
  128|    106|	switch (arith_shift_left (hdr.rez, 16) + (hdr.sign & 1))
  129|    106|	{	case ((8 << 16) + 0) :
  ------------------
  |  Branch (129:4): [True: 21, False: 85]
  ------------------
  130|     21|			psf->sf.format = SF_FORMAT_AVR | SF_FORMAT_PCM_U8 ;
  131|     21|			psf->bytewidth = 1 ;
  132|     21|			break ;
  133|       |
  134|     42|		case ((8 << 16) + 1) :
  ------------------
  |  Branch (134:3): [True: 42, False: 64]
  ------------------
  135|     42|			psf->sf.format = SF_FORMAT_AVR | SF_FORMAT_PCM_S8 ;
  136|     42|			psf->bytewidth = 1 ;
  137|     42|			break ;
  138|       |
  139|      2|		case ((16 << 16) + 1) :
  ------------------
  |  Branch (139:3): [True: 2, False: 104]
  ------------------
  140|      2|			psf->sf.format = SF_FORMAT_AVR | SF_FORMAT_PCM_16 ;
  141|      2|			psf->bytewidth = 2 ;
  142|      2|			break ;
  143|       |
  144|     41|		default :
  ------------------
  |  Branch (144:3): [True: 41, False: 65]
  ------------------
  145|     41|			psf_log_printf (psf, "Error : bad rez/sign combination.\n") ;
  146|     41|			return SFE_AVR_BAD_REZ_SIGN ;
  147|    106|		} ;
  148|       |
  149|     65|	psf_binheader_readf (psf, "E4444", &hdr.srate, &hdr.frames, &hdr.lbeg, &hdr.lend) ;
  150|       |
  151|     65|	psf->sf.frames = hdr.frames ;
  152|     65|	psf->sf.samplerate = hdr.srate ;
  153|       |
  154|     65|	psf_log_printf (psf, "  Frames      : %D\n", psf->sf.frames) ;
  155|     65|	psf_log_printf (psf, "  Sample rate : %d\n", psf->sf.samplerate) ;
  156|       |
  157|     65|	psf_binheader_readf (psf, "E222", &hdr.res1, &hdr.res2, &hdr.res3) ;
  158|     65|	psf_binheader_readf (psf, "bb", hdr.ext, sizeof (hdr.ext), hdr.user, sizeof (hdr.user)) ;
  159|       |
  160|     65|	psf_log_printf (psf, "  Ext         : %.20s\n  User        : %.64s\n", hdr.ext, hdr.user) ;
  161|       |
  162|     65|	psf->endian = SF_ENDIAN_BIG ;
  163|       |
  164|     65| 	psf->dataoffset = AVR_HDR_SIZE ;
  ------------------
  |  |   29|     65|#define	AVR_HDR_SIZE	128
  ------------------
  165|     65|	psf->datalength = (sf_count_t) hdr.frames * (hdr.rez / 8) ;
  166|       |
  167|     65|	if (psf->fileoffset > 0)
  ------------------
  |  Branch (167:6): [True: 1, False: 64]
  ------------------
  168|      1|		psf->filelength = AVR_HDR_SIZE + psf->datalength ;
  ------------------
  |  |   29|      1|#define	AVR_HDR_SIZE	128
  ------------------
  169|       |
  170|     65|	if (psf_ftell (psf) != psf->dataoffset)
  ------------------
  |  Branch (170:6): [True: 64, False: 1]
  ------------------
  171|     64|		psf_binheader_readf (psf, "j", psf->dataoffset - psf_ftell (psf)) ;
  172|       |
  173|     65|	psf->blockwidth = (sf_count_t) psf->sf.channels * psf->bytewidth ;
  174|       |
  175|     65|	if (psf->sf.frames == 0 && psf->blockwidth)
  ------------------
  |  Branch (175:6): [True: 5, False: 60]
  |  Branch (175:29): [True: 5, False: 0]
  ------------------
  176|      5|		psf->sf.frames = (psf->filelength - psf->dataoffset) / psf->blockwidth ;
  177|       |
  178|     65|	return 0 ;
  179|    106|} /* avr_read_header */
avr.c:avr_close:
  238|     65|{
  239|     65|	if (psf->file.mode == SFM_WRITE || psf->file.mode == SFM_RDWR)
  ------------------
  |  Branch (239:6): [True: 0, False: 65]
  |  Branch (239:37): [True: 0, False: 65]
  ------------------
  240|      0|		avr_write_header (psf, SF_TRUE) ;
  241|       |
  242|     65|	return 0 ;
  243|     65|} /* avr_close */

broadcast_var_alloc:
   41|     34|{	return calloc (1, sizeof (SF_BROADCAST_INFO_16K)) ;
   42|     34|} /* broadcast_var_alloc */

caf_open:
  114|  2.34k|{	CAF_PRIVATE * pcaf ;
  115|  2.34k|	int	subformat, format, error = 0 ;
  116|       |
  117|  2.34k|	if ((psf->container_data = calloc (1, sizeof (CAF_PRIVATE))) == NULL)
  ------------------
  |  Branch (117:6): [True: 0, False: 2.34k]
  ------------------
  118|      0|		return SFE_MALLOC_FAILED ;
  119|       |
  120|  2.34k|	pcaf = psf->container_data ;
  121|       |
  122|  2.34k|	if (psf->file.mode == SFM_READ || (psf->file.mode == SFM_RDWR && psf->filelength > 0))
  ------------------
  |  Branch (122:6): [True: 2.34k, False: 0]
  |  Branch (122:37): [True: 0, False: 0]
  |  Branch (122:67): [True: 0, False: 0]
  ------------------
  123|  2.34k|	{	if ((error = caf_read_header (psf)))
  ------------------
  |  Branch (123:8): [True: 1.31k, False: 1.03k]
  ------------------
  124|  1.31k|			return error ;
  125|       |
  126|  1.03k|		psf->next_chunk_iterator = caf_next_chunk_iterator ;
  127|  1.03k|		psf->get_chunk_size = caf_get_chunk_size ;
  128|  1.03k|		psf->get_chunk_data = caf_get_chunk_data ;
  129|  1.03k|		} ;
  130|       |
  131|  1.03k|	subformat = SF_CODEC (psf->sf.format) ;
  ------------------
  |  |  102|  1.03k|#define SF_CODEC(x)			((x) & SF_FORMAT_SUBMASK)
  ------------------
  132|       |
  133|  1.03k|	if (psf->file.mode == SFM_WRITE || psf->file.mode == SFM_RDWR)
  ------------------
  |  Branch (133:6): [True: 0, False: 1.03k]
  |  Branch (133:37): [True: 0, False: 1.03k]
  ------------------
  134|      0|	{	if (psf->is_pipe)
  ------------------
  |  Branch (134:8): [True: 0, False: 0]
  ------------------
  135|      0|			return SFE_NO_PIPE_WRITE ;
  136|       |
  137|      0|		format = SF_CONTAINER (psf->sf.format) ;
  ------------------
  |  |  101|      0|#define SF_CONTAINER(x)		((x) & SF_FORMAT_TYPEMASK)
  ------------------
  138|      0|		if (format != SF_FORMAT_CAF)
  ------------------
  |  Branch (138:7): [True: 0, False: 0]
  ------------------
  139|      0|			return	SFE_BAD_OPEN_FORMAT ;
  140|       |
  141|      0|		psf->blockwidth = (sf_count_t) psf->bytewidth * psf->sf.channels ;
  142|       |
  143|      0|		if (psf->file.mode != SFM_RDWR || psf->filelength < 44)
  ------------------
  |  Branch (143:7): [True: 0, False: 0]
  |  Branch (143:37): [True: 0, False: 0]
  ------------------
  144|      0|		{	psf->filelength = 0 ;
  145|      0|			psf->datalength = 0 ;
  146|      0|			psf->dataoffset = 0 ;
  147|      0|			psf->sf.frames = 0 ;
  148|      0|			} ;
  149|       |
  150|      0|		psf->strings.flags = SF_STR_ALLOW_START | SF_STR_ALLOW_END ;
  151|       |
  152|       |		/*
  153|       |		**	By default, add the peak chunk to floating point files. Default behaviour
  154|       |		**	can be switched off using sf_command (SFC_SET_PEAK_CHUNK, SF_FALSE).
  155|       |		*/
  156|      0|		if (psf->file.mode == SFM_WRITE && (subformat == SF_FORMAT_FLOAT || subformat == SF_FORMAT_DOUBLE))
  ------------------
  |  Branch (156:7): [True: 0, False: 0]
  |  Branch (156:39): [True: 0, False: 0]
  |  Branch (156:71): [True: 0, False: 0]
  ------------------
  157|      0|		{	if ((psf->peak_info = peak_info_calloc (psf->sf.channels)) == NULL)
  ------------------
  |  Branch (157:9): [True: 0, False: 0]
  ------------------
  158|      0|				return SFE_MALLOC_FAILED ;
  159|      0|			psf->peak_info->peak_loc = SF_PEAK_START ;
  160|      0|			} ;
  161|       |
  162|      0|		if ((error = caf_write_header (psf, SF_FALSE)) != 0)
  ------------------
  |  Branch (162:7): [True: 0, False: 0]
  ------------------
  163|      0|			return error ;
  164|       |
  165|      0|		psf->write_header	= caf_write_header ;
  166|      0|		psf->set_chunk		= caf_set_chunk ;
  167|  1.03k|		} ;
  168|       |
  169|  1.03k|	psf->container_close = caf_close ;
  170|  1.03k|	psf->command = caf_command ;
  171|       |
  172|  1.03k|	switch (subformat)
  173|  1.03k|	{	case SF_FORMAT_PCM_S8 :
  ------------------
  |  Branch (173:4): [True: 1, False: 1.02k]
  ------------------
  174|      2|		case SF_FORMAT_PCM_16 :
  ------------------
  |  Branch (174:3): [True: 1, False: 1.02k]
  ------------------
  175|      3|		case SF_FORMAT_PCM_24 :
  ------------------
  |  Branch (175:3): [True: 1, False: 1.02k]
  ------------------
  176|      4|		case SF_FORMAT_PCM_32 :
  ------------------
  |  Branch (176:3): [True: 1, False: 1.02k]
  ------------------
  177|      4|					error = pcm_init (psf) ;
  178|      4|					break ;
  179|       |
  180|      1|		case SF_FORMAT_ULAW :
  ------------------
  |  Branch (180:3): [True: 1, False: 1.02k]
  ------------------
  181|      1|					error = ulaw_init (psf) ;
  182|      1|					break ;
  183|       |
  184|      1|		case SF_FORMAT_ALAW :
  ------------------
  |  Branch (184:3): [True: 1, False: 1.02k]
  ------------------
  185|      1|					error = alaw_init (psf) ;
  186|      1|					break ;
  187|       |
  188|       |		/* Lite remove start */
  189|      1|		case SF_FORMAT_FLOAT :
  ------------------
  |  Branch (189:3): [True: 1, False: 1.02k]
  ------------------
  190|      1|					error = float32_init (psf) ;
  191|      1|					break ;
  192|       |
  193|      1|		case SF_FORMAT_DOUBLE :
  ------------------
  |  Branch (193:3): [True: 1, False: 1.02k]
  ------------------
  194|      1|					error = double64_init (psf) ;
  195|      1|					break ;
  196|       |
  197|     70|		case SF_FORMAT_ALAC_16 :
  ------------------
  |  Branch (197:3): [True: 70, False: 960]
  ------------------
  198|    399|		case SF_FORMAT_ALAC_20 :
  ------------------
  |  Branch (198:3): [True: 329, False: 701]
  ------------------
  199|    851|		case SF_FORMAT_ALAC_24 :
  ------------------
  |  Branch (199:3): [True: 452, False: 578]
  ------------------
  200|  1.00k|		case SF_FORMAT_ALAC_32 :
  ------------------
  |  Branch (200:3): [True: 157, False: 873]
  ------------------
  201|  1.00k|					if (psf->file.mode == SFM_READ)
  ------------------
  |  Branch (201:10): [True: 1.00k, False: 0]
  ------------------
  202|       |						/* Only pass the ALAC_DECODER_INFO in read mode. */
  203|  1.00k|						error = alac_init (psf, &pcaf->alac) ;
  204|      0|					else
  205|      0|						error = alac_init (psf, NULL) ;
  206|  1.00k|					break ;
  207|       |
  208|       |		/* Lite remove end */
  209|       |
  210|     14|		default :
  ------------------
  |  Branch (210:3): [True: 14, False: 1.01k]
  ------------------
  211|     14|			return SFE_UNSUPPORTED_ENCODING ;
  212|  1.03k|		} ;
  213|       |
  214|  1.01k|	return error ;
  215|  1.03k|} /* caf_open */
caf.c:caf_close:
  219|  1.03k|{
  220|  1.03k|	if (psf->file.mode == SFM_WRITE || psf->file.mode == SFM_RDWR)
  ------------------
  |  Branch (220:6): [True: 0, False: 1.03k]
  |  Branch (220:37): [True: 0, False: 1.03k]
  ------------------
  221|      0|	{	caf_write_tailer (psf) ;
  222|      0|		caf_write_header (psf, SF_TRUE) ;
  223|      0|		} ;
  224|       |
  225|  1.03k|	return 0 ;
  226|  1.03k|} /* caf_close */
caf.c:caf_read_header:
  338|  2.34k|{	CAF_PRIVATE	*pcaf ;
  339|  2.34k|	BUF_UNION	ubuf ;
  340|  2.34k|	DESC_CHUNK desc ;
  341|  2.34k|	sf_count_t chunk_size ;
  342|  2.34k|	double srate ;
  343|  2.34k|	short version, flags ;
  344|  2.34k|	int marker, k, have_data = 0, error ;
  345|       |
  346|  2.34k|	if ((pcaf = psf->container_data) == NULL)
  ------------------
  |  Branch (346:6): [True: 0, False: 2.34k]
  ------------------
  347|      0|		return SFE_INTERNAL ;
  348|       |
  349|  2.34k|	memset (&desc, 0, sizeof (desc)) ;
  350|       |
  351|       |	/* Set position to start of file to begin reading header. */
  352|  2.34k|	psf_binheader_readf (psf, "pmE2E2", 0, &marker, &version, &flags) ;
  353|  2.34k|	psf_log_printf (psf, "%M\n  Version : %d\n  Flags   : %x\n", marker, version, flags) ;
  354|  2.34k|	if (marker != caff_MARKER)
  ------------------
  |  |   40|  2.34k|#define caff_MARKER		MAKE_MARKER ('c', 'a', 'f', 'f')
  |  |  ------------------
  |  |  |  |  122|  2.34k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (354:6): [True: 0, False: 2.34k]
  ------------------
  355|      0|		return SFE_CAF_NOT_CAF ;
  356|       |
  357|  2.34k|	psf_binheader_readf (psf, "mE8b", &marker, &chunk_size, ubuf.ucbuf, 8) ;
  358|  2.34k|	srate = double64_be_read (ubuf.ucbuf) ;
  359|  2.34k|	snprintf (ubuf.cbuf, sizeof (ubuf.cbuf), "%5.3f", srate) ;
  360|  2.34k|	psf_log_printf (psf, "%M : %D\n  Sample rate  : %s\n", marker, chunk_size, ubuf.cbuf) ;
  361|  2.34k|	if (marker != desc_MARKER)
  ------------------
  |  |   43|  2.34k|#define desc_MARKER		MAKE_MARKER ('d', 'e', 's', 'c')
  |  |  ------------------
  |  |  |  |  122|  2.34k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (361:6): [True: 0, False: 2.34k]
  ------------------
  362|      0|		return SFE_CAF_NO_DESC ;
  363|       |
  364|  2.34k|	if (chunk_size < SIGNED_SIZEOF (DESC_CHUNK))
  ------------------
  |  |   86|  2.34k|#define		SIGNED_SIZEOF(x)	((int) sizeof (x))
  ------------------
  |  Branch (364:6): [True: 70, False: 2.27k]
  ------------------
  365|     70|	{	psf_log_printf (psf, "**** Chunk size too small. Should be > 32 bytes.\n") ;
  366|     70|		return SFE_MALFORMED_FILE ;
  367|  2.27k|		} ;
  368|       |
  369|  2.27k|	psf->sf.samplerate = psf_lrint (srate) ;
  370|       |
  371|  2.27k|	psf_binheader_readf (psf, "mE44444", &desc.fmt_id, &desc.fmt_flags, &desc.pkt_bytes, &desc.frames_per_packet,
  372|  2.27k|			&desc.channels_per_frame, &desc.bits_per_chan) ;
  373|  2.27k|	psf_log_printf (psf, "  Format id    : %M\n  Format flags : %x\n  Bytes / packet   : %u\n"
  374|  2.27k|			"  Frames / packet  : %u\n  Channels / frame : %u\n  Bits / channel   : %u\n",
  375|  2.27k|			desc.fmt_id, desc.fmt_flags, desc.pkt_bytes, desc.frames_per_packet, desc.channels_per_frame, desc.bits_per_chan) ;
  376|       |
  377|  2.27k|	if (desc.channels_per_frame > SF_MAX_CHANNELS)
  ------------------
  |  |   95|  2.27k|#define		SF_MAX_CHANNELS		1024
  ------------------
  |  Branch (377:6): [True: 24, False: 2.25k]
  ------------------
  378|     24|	{	psf_log_printf (psf, "**** Bad channels per frame value %u.\n", desc.channels_per_frame) ;
  379|     24|		return SFE_MALFORMED_FILE ;
  380|  2.25k|		} ;
  381|       |
  382|  2.25k|	if (chunk_size > SIGNED_SIZEOF (DESC_CHUNK))
  ------------------
  |  |   86|  2.25k|#define		SIGNED_SIZEOF(x)	((int) sizeof (x))
  ------------------
  |  Branch (382:6): [True: 2.25k, False: 1]
  ------------------
  383|  2.25k|		psf_binheader_readf (psf, "j", (int) (chunk_size - sizeof (DESC_CHUNK))) ;
  384|       |
  385|  2.25k|	psf->sf.channels = desc.channels_per_frame ;
  386|       |
  387|  12.5k|	while (1)
  ------------------
  |  Branch (387:9): [True: 12.5k, Folded]
  ------------------
  388|  12.5k|	{	marker = 0 ;
  389|  12.5k|		chunk_size = 0 ;
  390|       |
  391|  12.5k|		psf_binheader_readf (psf, "mE8", &marker, &chunk_size) ;
  392|  12.5k|		if (marker == 0)
  ------------------
  |  Branch (392:7): [True: 205, False: 12.3k]
  ------------------
  393|    205|		{	sf_count_t pos = psf_ftell (psf) ;
  394|    205|			psf_log_printf (psf, "Have 0 marker at position %D (0x%x).\n", pos, pos) ;
  395|    205|			break ;
  396|  12.3k|			} ;
  397|  12.3k|		if (chunk_size < 0)
  ------------------
  |  Branch (397:7): [True: 232, False: 12.1k]
  ------------------
  398|    232|		{	psf_log_printf (psf, "%M : %D *** Should be >= 0 ***\n", marker, chunk_size) ;
  399|    232|			break ;
  400|  12.1k|			} ;
  401|  12.1k|		if (chunk_size > psf->filelength)
  ------------------
  |  Branch (401:7): [True: 556, False: 11.5k]
  ------------------
  402|    556|			break ;
  403|       |
  404|  11.5k|		psf_store_read_chunk_u32 (&psf->rchunks, marker, psf_ftell (psf), chunk_size) ;
  405|       |
  406|  11.5k|		switch (marker)
  407|  11.5k|		{	case peak_MARKER :
  ------------------
  |  |   58|    319|#define peak_MARKER		MAKE_MARKER ('p', 'e', 'a', 'k')
  |  |  ------------------
  |  |  |  |  122|    319|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (407:5): [True: 319, False: 11.2k]
  ------------------
  408|    319|				psf_log_printf (psf, "%M : %D\n", marker, chunk_size) ;
  409|    319|				if (chunk_size != CAF_PEAK_CHUNK_SIZE (psf->sf.channels))
  ------------------
  |  |   67|    319|#define CAF_PEAK_CHUNK_SIZE(ch) 	((int) (sizeof (int) + ch * (sizeof (float) + 8)))
  ------------------
  |  Branch (409:9): [True: 1, False: 318]
  ------------------
  410|      1|				{	psf_binheader_readf (psf, "j", (size_t) chunk_size) ;
  411|      1|					psf_log_printf (psf, "*** File PEAK chunk %D should be %d.\n", chunk_size, CAF_PEAK_CHUNK_SIZE (psf->sf.channels)) ;
  ------------------
  |  |   67|      1|#define CAF_PEAK_CHUNK_SIZE(ch) 	((int) (sizeof (int) + ch * (sizeof (float) + 8)))
  ------------------
  412|      1|					return SFE_CAF_BAD_PEAK ;
  413|    318|					} ;
  414|       |
  415|    318|				if (psf->peak_info)
  ------------------
  |  Branch (415:9): [True: 292, False: 26]
  ------------------
  416|    292|				{	psf_log_printf (psf, "*** Found existing peak info, using last one.\n") ;
  417|    292|					free (psf->peak_info) ;
  418|    292|					psf->peak_info = NULL ;
  419|    292|					} ;
  420|    318|				if ((psf->peak_info = peak_info_calloc (psf->sf.channels)) == NULL)
  ------------------
  |  Branch (420:9): [True: 0, False: 318]
  ------------------
  421|      0|					return SFE_MALLOC_FAILED ;
  422|       |
  423|       |				/* read in rest of PEAK chunk. */
  424|    318|				psf_binheader_readf (psf, "E4", & (psf->peak_info->edit_number)) ;
  425|    318|				psf_log_printf (psf, "  edit count : %d\n", psf->peak_info->edit_number) ;
  426|       |
  427|    318|				psf_log_printf (psf, "     Ch   Position       Value\n") ;
  428|    808|				for (k = 0 ; k < psf->sf.channels ; k++)
  ------------------
  |  Branch (428:18): [True: 490, False: 318]
  ------------------
  429|    490|				{	sf_count_t position ;
  430|    490|					float value ;
  431|       |
  432|    490|					psf_binheader_readf (psf, "Ef8", &value, &position) ;
  433|    490|					psf->peak_info->peaks [k].value = value ;
  434|    490|					psf->peak_info->peaks [k].position = position ;
  435|       |
  436|    490|					snprintf (ubuf.cbuf, sizeof (ubuf.cbuf), "    %2d   %-12" PRId64 "   %g\n", k, position, value) ;
  437|    490|					psf_log_printf (psf, ubuf.cbuf) ;
  438|    490|					} ;
  439|       |
  440|    318|				psf->peak_info->peak_loc = SF_PEAK_START ;
  441|    318|				break ;
  442|       |
  443|  3.60k|			case chan_MARKER :
  ------------------
  |  |   41|  3.60k|#define chan_MARKER		MAKE_MARKER ('c', 'h', 'a', 'n')
  |  |  ------------------
  |  |  |  |  122|  3.60k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (443:4): [True: 3.60k, False: 7.95k]
  ------------------
  444|  3.60k|				if (chunk_size < 12)
  ------------------
  |  Branch (444:9): [True: 1.93k, False: 1.66k]
  ------------------
  445|  1.93k|				{	psf_log_printf (psf, "%M : %D (should be >= 12)\n", marker, chunk_size) ;
  446|  1.93k|					psf_binheader_readf (psf, "j", (size_t) chunk_size) ;
  447|  1.93k|					break ;
  448|  1.93k|					}
  449|       |
  450|  1.66k|				psf_log_printf (psf, "%M : %D\n", marker, chunk_size) ;
  451|       |
  452|  1.66k|				if ((error = caf_read_chanmap (psf, chunk_size)))
  ------------------
  |  Branch (452:9): [True: 0, False: 1.66k]
  ------------------
  453|      0|					return error ;
  454|  1.66k|				break ;
  455|       |
  456|  1.66k|			case free_MARKER :
  ------------------
  |  |   45|     79|#define free_MARKER		MAKE_MARKER ('f', 'r', 'e', 'e')
  |  |  ------------------
  |  |  |  |  122|     79|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (456:4): [True: 79, False: 11.4k]
  ------------------
  457|     79|				psf_log_printf (psf, "%M : %D\n", marker, chunk_size) ;
  458|     79|				psf_binheader_readf (psf, "j", (size_t) chunk_size) ;
  459|     79|				break ;
  460|       |
  461|  1.59k|			case data_MARKER :
  ------------------
  |  |   42|  1.59k|#define data_MARKER		MAKE_MARKER ('d', 'a', 't', 'a')
  |  |  ------------------
  |  |  |  |  122|  1.59k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (461:4): [True: 1.59k, False: 9.95k]
  ------------------
  462|  1.59k|				psf_binheader_readf (psf, "E4", &k) ;
  463|  1.59k|				if (chunk_size == -1)
  ------------------
  |  Branch (463:9): [True: 0, False: 1.59k]
  ------------------
  464|      0|				{	psf_log_printf (psf, "%M : -1\n") ;
  465|      0|					chunk_size = psf->filelength - psf->header.indx ;
  466|      0|					}
  467|  1.59k|				else if (psf->filelength > 0 && chunk_size > psf->filelength - psf->header.indx + 10)
  ------------------
  |  Branch (467:14): [True: 1.59k, False: 0]
  |  Branch (467:37): [True: 126, False: 1.47k]
  ------------------
  468|    126|				{	psf_log_printf (psf, "%M : %D (should be %D)\n", marker, chunk_size, psf->filelength - psf->header.indx - 8) ;
  469|    126|					psf->datalength = psf->filelength - psf->header.indx - 8 ;
  470|    126|					}
  471|  1.47k|				else
  472|  1.47k|				{	psf_log_printf (psf, "%M : %D\n", marker, chunk_size) ;
  473|       |					/* Subtract the 4 bytes of the 'edit' field above. */
  474|  1.47k|					psf->datalength = chunk_size - 4 ;
  475|  1.47k|					} ;
  476|       |
  477|  1.59k|				psf_log_printf (psf, "  edit : %u\n", k) ;
  478|       |
  479|  1.59k|				psf->dataoffset = psf->header.indx ;
  480|  1.59k|				if (psf->datalength + psf->dataoffset < psf->filelength)
  ------------------
  |  Branch (480:9): [True: 1.53k, False: 59]
  ------------------
  481|  1.53k|					psf->dataend = psf->datalength + psf->dataoffset ;
  482|       |
  483|  1.59k|				psf_binheader_readf (psf, "j", (size_t) psf->datalength) ;
  484|  1.59k|				have_data = 1 ;
  485|  1.59k|				break ;
  486|       |
  487|    924|			case kuki_MARKER :
  ------------------
  |  |   49|    924|#define kuki_MARKER		MAKE_MARKER ('k', 'u', 'k', 'i')
  |  |  ------------------
  |  |  |  |  122|    924|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (487:4): [True: 924, False: 10.6k]
  ------------------
  488|    924|				psf_log_printf (psf, "%M : %D\n", marker, chunk_size) ;
  489|    924|				pcaf->alac.kuki_offset = psf_ftell (psf) - 12 ;
  490|    924|				psf_binheader_readf (psf, "j", (size_t) chunk_size) ;
  491|    924|				break ;
  492|       |
  493|  2.47k|			case pakt_MARKER :
  ------------------
  |  |   57|  2.47k|#define pakt_MARKER		MAKE_MARKER ('p', 'a', 'k', 't')
  |  |  ------------------
  |  |  |  |  122|  2.47k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (493:4): [True: 2.47k, False: 9.07k]
  ------------------
  494|  2.47k|				if (chunk_size < 24)
  ------------------
  |  Branch (494:9): [True: 1, False: 2.47k]
  ------------------
  495|      1|				{	psf_log_printf (psf, "%M : %D (should be > 24)\n", marker, chunk_size) ;
  496|      1|					return SFE_MALFORMED_FILE ;
  497|      1|					}
  498|  2.47k|				else if (chunk_size > psf->filelength - psf->header.indx)
  ------------------
  |  Branch (498:14): [True: 13, False: 2.46k]
  ------------------
  499|     13|				{	psf_log_printf (psf, "%M : %D (should be < %D)\n", marker, chunk_size, psf->filelength - psf->header.indx) ;
  500|     13|					return SFE_MALFORMED_FILE ;
  501|     13|					}
  502|  2.46k|				else
  503|  2.46k|					psf_log_printf (psf, "%M : %D\n", marker, chunk_size) ;
  504|       |
  505|  2.46k|				psf_binheader_readf (psf, "E8844", &pcaf->alac.packets, &pcaf->alac.valid_frames,
  506|  2.46k|									&pcaf->alac.priming_frames, &pcaf->alac.remainder_frames) ;
  507|       |
  508|  2.46k|				psf_log_printf (psf,
  509|  2.46k|						"  Packets          : %D\n"
  510|  2.46k|						"  Valid frames     : %D\n"
  511|  2.46k|						"  Priming frames   : %d\n"
  512|  2.46k|						"  Remainder frames : %d\n",
  513|  2.46k|						pcaf->alac.packets, pcaf->alac.valid_frames, pcaf->alac.priming_frames,
  514|  2.46k|						pcaf->alac.remainder_frames
  515|  2.46k|						) ;
  516|       |
  517|  2.46k|				if (pcaf->alac.packets == 0 && pcaf->alac.valid_frames == 0
  ------------------
  |  Branch (517:9): [True: 1.12k, False: 1.34k]
  |  Branch (517:36): [True: 539, False: 582]
  ------------------
  518|    539|							&& pcaf->alac.priming_frames == 0 && pcaf->alac.remainder_frames == 0)
  ------------------
  |  Branch (518:11): [True: 447, False: 92]
  |  Branch (518:45): [True: 299, False: 148]
  ------------------
  519|    299|					psf_log_printf (psf, "*** 'pakt' chunk header is all zero.\n") ;
  520|       |
  521|  2.46k|				pcaf->alac.pakt_offset = psf_ftell (psf) - 12 ;
  522|  2.46k|				psf_binheader_readf (psf, "j", (size_t) chunk_size - 24) ;
  523|  2.46k|				break ;
  524|       |
  525|  1.72k|			case info_MARKER :
  ------------------
  |  |   47|  1.72k|#define info_MARKER		MAKE_MARKER ('i', 'n', 'f', 'o')
  |  |  ------------------
  |  |  |  |  122|  1.72k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (525:4): [True: 1.72k, False: 9.82k]
  ------------------
  526|  1.72k|				if (chunk_size < 4)
  ------------------
  |  Branch (526:9): [True: 2, False: 1.72k]
  ------------------
  527|      2|				{	psf_log_printf (psf, "%M : %D (should be > 4)\n", marker, chunk_size) ;
  528|      2|					return SFE_MALFORMED_FILE ;
  529|      2|					}
  530|  1.72k|				else if (chunk_size > psf->filelength - psf->header.indx)
  ------------------
  |  Branch (530:14): [True: 2, False: 1.72k]
  ------------------
  531|      2|				{	psf_log_printf (psf, "%M : %D (should be < %D)\n", marker, chunk_size, psf->filelength - psf->header.indx) ;
  532|      2|					return SFE_MALFORMED_FILE ;
  533|  1.72k|					} ;
  534|  1.72k|				psf_log_printf (psf, "%M : %D\n", marker, chunk_size) ;
  535|  1.72k|				if (chunk_size > 4)
  ------------------
  |  Branch (535:9): [True: 1.50k, False: 214]
  ------------------
  536|  1.50k|					caf_read_strings (psf, chunk_size - 4) ;
  537|  1.72k|				break ;
  538|       |
  539|    835|			default :
  ------------------
  |  Branch (539:4): [True: 835, False: 10.7k]
  ------------------
  540|    835|				psf_log_printf (psf, "%M : %D (skipped)\n", marker, chunk_size) ;
  541|    835|				psf_binheader_readf (psf, "j", (size_t) chunk_size) ;
  542|    835|				break ;
  543|  11.5k|			} ;
  544|       |
  545|  11.5k|		if (marker != data_MARKER && chunk_size >= 0xffffff00)
  ------------------
  |  |   42|  11.5k|#define data_MARKER		MAKE_MARKER ('d', 'a', 't', 'a')
  |  |  ------------------
  |  |  |  |  122|  23.0k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (545:7): [True: 9.94k, False: 1.59k]
  |  Branch (545:32): [True: 0, False: 9.94k]
  ------------------
  546|      0|			break ;
  547|       |
  548|  11.5k|		if (! psf->sf.seekable && have_data)
  ------------------
  |  Branch (548:7): [True: 0, False: 11.5k]
  |  Branch (548:29): [True: 0, False: 0]
  ------------------
  549|      0|			break ;
  550|       |
  551|  11.5k|		if (psf_ftell (psf) >= psf->filelength - SIGNED_SIZEOF (chunk_size))
  ------------------
  |  |   86|  11.5k|#define		SIGNED_SIZEOF(x)	((int) sizeof (x))
  ------------------
  |  Branch (551:7): [True: 1.24k, False: 10.2k]
  ------------------
  552|  1.24k|		{	psf_log_printf (psf, "End\n") ;
  553|  1.24k|			break ;
  554|  10.2k|			} ;
  555|  10.2k|		} ;
  556|       |
  557|  2.23k|	if (have_data == 0)
  ------------------
  |  Branch (557:6): [True: 940, False: 1.29k]
  ------------------
  558|    940|	{	psf_log_printf (psf, "**** Error, could not find 'data' chunk.\n") ;
  559|    940|		return SFE_MALFORMED_FILE ;
  560|  1.29k|		} ;
  561|       |
  562|  1.29k|	psf->endian = (desc.fmt_flags & 2) ? SF_ENDIAN_LITTLE : SF_ENDIAN_BIG ;
  ------------------
  |  Branch (562:16): [True: 909, False: 384]
  ------------------
  563|       |
  564|  1.29k|	psf_fseek (psf, psf->dataoffset, SEEK_SET) ;
  565|       |
  566|  1.29k|	if ((psf->sf.format = decode_desc_chunk (psf, &desc)) == 0)
  ------------------
  |  Branch (566:6): [True: 263, False: 1.03k]
  ------------------
  567|    263|		return SFE_UNSUPPORTED_ENCODING ;
  568|       |
  569|  1.03k|	if (psf->bytewidth > 0)
  ------------------
  |  Branch (569:6): [True: 8, False: 1.02k]
  ------------------
  570|      8|		psf->sf.frames = psf->datalength / psf->bytewidth ;
  571|       |
  572|  1.03k|	return 0 ;
  573|  1.29k|} /* caf_read_header */
caf.c:caf_read_chanmap:
  798|  1.66k|{	const AIFF_CAF_CHANNEL_MAP * map_info ;
  799|  1.66k|	unsigned channel_bitmap, channel_decriptions, bytesread ;
  800|  1.66k|	int layout_tag ;
  801|       |
  802|  1.66k|	bytesread = psf_binheader_readf (psf, "E444", &layout_tag, &channel_bitmap, &channel_decriptions) ;
  803|       |
  804|  1.66k|	map_info = aiff_caf_of_channel_layout_tag (layout_tag) ;
  805|       |
  806|  1.66k|	psf_log_printf (psf, "  Tag    : %x\n", layout_tag) ;
  807|  1.66k|	if (map_info)
  ------------------
  |  Branch (807:6): [True: 918, False: 745]
  ------------------
  808|    918|		psf_log_printf (psf, "  Layout : %s\n", map_info->name) ;
  809|       |
  810|  1.66k|	if (bytesread < chunk_size)
  ------------------
  |  Branch (810:6): [True: 1.13k, False: 532]
  ------------------
  811|  1.13k|		psf_binheader_readf (psf, "j", chunk_size - bytesread) ;
  812|       |
  813|  1.66k|	if (map_info && map_info->channel_map != NULL)
  ------------------
  |  Branch (813:6): [True: 918, False: 745]
  |  Branch (813:18): [True: 441, False: 477]
  ------------------
  814|    441|	{	/* The channel map buffer must hold psf->sf.channels entries, because that
  815|       |		** is how many SFC_GET_CHANNEL_MAP_INFO and the channel-layout matcher read
  816|       |		** back. The layout tag may describe fewer channels than the file declares,
  817|       |		** so size the allocation by the channel count and copy only the smaller of
  818|       |		** the two to avoid a heap over-read. */
  819|    441|		size_t chanmap_size = (size_t) psf->sf.channels * sizeof (psf->channel_map [0]) ;
  820|    441|		size_t copy_size = SF_MIN (psf->sf.channels, layout_tag & 0xff) * sizeof (psf->channel_map [0]) ;
  ------------------
  |  |   91|    441|#define		SF_MIN(a, b)	((a) < (b) ? (a) : (b))
  |  |  ------------------
  |  |  |  Branch (91:24): [True: 290, False: 151]
  |  |  ------------------
  ------------------
  821|       |
  822|    441|		free (psf->channel_map) ;
  823|       |
  824|    441|		if ((psf->channel_map = calloc (1, chanmap_size)) == NULL)
  ------------------
  |  Branch (824:7): [True: 0, False: 441]
  ------------------
  825|      0|			return SFE_MALLOC_FAILED ;
  826|       |
  827|    441|		memcpy (psf->channel_map, map_info->channel_map, copy_size) ;
  828|  1.66k|		} ;
  829|       |
  830|  1.66k|	return 0 ;
  831|  1.66k|} /* caf_read_chanmap */
caf.c:caf_read_strings:
  848|  1.50k|{	char *buf ;
  849|  1.50k|	char *key, *value ;
  850|  1.50k|	uint32_t count, hash ;
  851|       |
  852|  1.50k|	if ((buf = malloc (chunk_size + 1)) == NULL)
  ------------------
  |  Branch (852:6): [True: 0, False: 1.50k]
  ------------------
  853|      0|		return (psf->error = SFE_MALLOC_FAILED) ;
  854|       |
  855|  1.50k|	psf_binheader_readf (psf, "E4b", &count, buf, (size_t) chunk_size) ;
  856|  1.50k|	psf_log_printf (psf, " count: %u\n", count) ;
  857|       |
  858|       |	/* Force terminate `buf` to make sure. */
  859|  1.50k|	buf [chunk_size] = 0 ;
  860|       |
  861|  40.0k|	for (key = buf ; key < buf + chunk_size ; )
  ------------------
  |  Branch (861:19): [True: 38.9k, False: 1.10k]
  ------------------
  862|  38.9k|	{	value = key + strlen (key) + 1 ;
  863|  38.9k|		if (value > buf + chunk_size)
  ------------------
  |  Branch (863:7): [True: 404, False: 38.5k]
  ------------------
  864|    404|			break ;
  865|  38.5k|		psf_log_printf (psf, "   %-12s : %s\n", key, value) ;
  866|       |
  867|  38.5k|		hash = string_hash32 (key) ;
  868|  38.5k|		switch (hash)
  869|  38.5k|		{	case 0xC4861943 : /* 'title' */
  ------------------
  |  Branch (869:5): [True: 89, False: 38.5k]
  ------------------
  870|     89|				psf_store_string (psf, SF_STR_TITLE, value) ;
  871|     89|				break ;
  872|    214|			case 0xAD47A394 : /* 'software' */
  ------------------
  |  Branch (872:4): [True: 214, False: 38.3k]
  ------------------
  873|    214|				psf_store_string (psf, SF_STR_SOFTWARE, value) ;
  874|    214|				break ;
  875|    325|			case 0x5D178E2A : /* 'copyright' */
  ------------------
  |  Branch (875:4): [True: 325, False: 38.2k]
  ------------------
  876|    325|				psf_store_string (psf, SF_STR_COPYRIGHT, value) ;
  877|    325|				break ;
  878|     77|			case 0x60E4D0C8 : /* 'artist' */
  ------------------
  |  Branch (878:4): [True: 77, False: 38.5k]
  ------------------
  879|     77|				psf_store_string (psf, SF_STR_ARTIST, value) ;
  880|     77|				break ;
  881|    217|			case 0x83B5D16A : /* 'genre' */
  ------------------
  |  Branch (881:4): [True: 217, False: 38.3k]
  ------------------
  882|    217|				psf_store_string (psf, SF_STR_GENRE, value) ;
  883|    217|				break ;
  884|    266|			case 0x15E5FC88 : /* 'comment' */
  ------------------
  |  Branch (884:4): [True: 266, False: 38.3k]
  ------------------
  885|    370|			case 0x7C297D5B : /* 'comments' */
  ------------------
  |  Branch (885:4): [True: 104, False: 38.4k]
  ------------------
  886|    370|				psf_store_string (psf, SF_STR_COMMENT, value) ;
  887|    370|				break ;
  888|    416|			case 0x24A7C347 : /* 'tracknumber' */
  ------------------
  |  Branch (888:4): [True: 416, False: 38.1k]
  ------------------
  889|    416|				psf_store_string (psf, SF_STR_TRACKNUMBER, value) ;
  890|    416|				break ;
  891|    224|			case 0x50A31EB7 : /* 'date' */
  ------------------
  |  Branch (891:4): [True: 224, False: 38.3k]
  ------------------
  892|    224|				psf_store_string (psf, SF_STR_DATE, value) ;
  893|    224|				break ;
  894|     41|			case 0x6583545A : /* 'album' */
  ------------------
  |  Branch (894:4): [True: 41, False: 38.5k]
  ------------------
  895|     41|				psf_store_string (psf, SF_STR_ALBUM, value) ;
  896|     41|				break ;
  897|    794|			case 0xE7C64B6C : /* 'license' */
  ------------------
  |  Branch (897:4): [True: 794, False: 37.7k]
  ------------------
  898|    794|				psf_store_string (psf, SF_STR_LICENSE, value) ;
  899|    794|				break ;
  900|  35.8k|			default :
  ------------------
  |  Branch (900:4): [True: 35.8k, False: 2.76k]
  ------------------
  901|  35.8k|				psf_log_printf (psf, " Unhandled hash 0x%x : /* '%s' */\n", hash, key) ;
  902|  35.8k|				break ;
  903|  38.5k|			} ;
  904|       |
  905|  38.5k|		key = value + strlen (value) + 1 ;
  906|  38.5k|		} ;
  907|       |
  908|  1.50k|	free (buf) ;
  909|       |
  910|  1.50k|	return 0 ;
  911|  1.50k|} /* caf_read_strings */
caf.c:string_hash32:
  836|  38.5k|{	uint32_t hash = 0x87654321 ;
  837|       |
  838|   135k|	while (str [0])
  ------------------
  |  Branch (838:9): [True: 97.0k, False: 38.5k]
  ------------------
  839|  97.0k|	{	hash = hash * 333 + str [0] ;
  840|  97.0k|		str ++ ;
  841|  97.0k|		} ;
  842|       |
  843|  38.5k|	return hash ;
  844|  38.5k|} /* string_hash32 */
caf.c:decode_desc_chunk:
  252|  1.29k|{	int format = SF_FORMAT_CAF ;
  253|       |
  254|  1.29k|	psf->sf.channels = desc->channels_per_frame ;
  255|       |
  256|  1.29k|	if (desc->fmt_id == alac_MARKER)
  ------------------
  |  |   38|  1.29k|#define alac_MARKER		MAKE_MARKER ('a', 'l', 'a', 'c')
  |  |  ------------------
  |  |  |  |  122|  1.29k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (256:6): [True: 1.02k, False: 271]
  ------------------
  257|  1.02k|	{	CAF_PRIVATE	*pcaf ;
  258|       |
  259|  1.02k|		if ((pcaf = psf->container_data) != NULL)
  ------------------
  |  Branch (259:7): [True: 1.02k, False: 0]
  ------------------
  260|  1.02k|		{	switch (desc->fmt_flags)
  261|  1.02k|			{	case 1 :
  ------------------
  |  Branch (261:6): [True: 70, False: 952]
  ------------------
  262|     70|					pcaf->alac.bits_per_sample = 16 ;
  263|     70|					format |= SF_FORMAT_ALAC_16 ;
  264|     70|					break ;
  265|    329|				case 2 :
  ------------------
  |  Branch (265:5): [True: 329, False: 693]
  ------------------
  266|    329|					pcaf->alac.bits_per_sample = 20 ;
  267|    329|					format |= SF_FORMAT_ALAC_20 ;
  268|    329|					break ;
  269|    452|				case 3 :
  ------------------
  |  Branch (269:5): [True: 452, False: 570]
  ------------------
  270|    452|					pcaf->alac.bits_per_sample = 24 ;
  271|    452|					format |= SF_FORMAT_ALAC_24 ;
  272|    452|					break ;
  273|    157|				case 4 :
  ------------------
  |  Branch (273:5): [True: 157, False: 865]
  ------------------
  274|    157|					pcaf->alac.bits_per_sample = 32 ;
  275|    157|					format |= SF_FORMAT_ALAC_32 ;
  276|    157|					break ;
  277|     14|				default :
  ------------------
  |  Branch (277:5): [True: 14, False: 1.00k]
  ------------------
  278|     14|					psf_log_printf (psf, "Bad ALAC format flag value of %d\n", desc->fmt_flags) ;
  279|  1.02k|				} ;
  280|       |
  281|  1.02k|			pcaf->alac.frames_per_packet = desc->frames_per_packet ;
  282|  1.02k|			} ;
  283|       |
  284|  1.02k|		return format ;
  285|  1.02k|		} ;
  286|       |
  287|    271|	format |= psf->endian == SF_ENDIAN_LITTLE ? SF_ENDIAN_LITTLE : 0 ;
  ------------------
  |  Branch (287:12): [True: 122, False: 149]
  ------------------
  288|       |
  289|    271|	if (desc->fmt_id == lpcm_MARKER && desc->fmt_flags & 1)
  ------------------
  |  |   50|    271|#define lpcm_MARKER		MAKE_MARKER ('l', 'p', 'c', 'm')
  |  |  ------------------
  |  |  |  |  122|    542|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (289:6): [True: 129, False: 142]
  |  Branch (289:37): [True: 39, False: 90]
  ------------------
  290|     39|	{	/* Floating point data. */
  291|     39|		if (desc->bits_per_chan == 32 && desc->pkt_bytes == 4 * desc->channels_per_frame)
  ------------------
  |  Branch (291:7): [True: 2, False: 37]
  |  Branch (291:36): [True: 1, False: 1]
  ------------------
  292|      1|		{	psf->bytewidth = 4 ;
  293|      1|			return format | SF_FORMAT_FLOAT ;
  294|     38|			} ;
  295|     38|		if (desc->bits_per_chan == 64 && desc->pkt_bytes == 8 * desc->channels_per_frame)
  ------------------
  |  Branch (295:7): [True: 31, False: 7]
  |  Branch (295:36): [True: 1, False: 30]
  ------------------
  296|      1|		{	psf->bytewidth = 8 ;
  297|      1|			return format | SF_FORMAT_DOUBLE ;
  298|     37|			} ;
  299|    269|		} ;
  300|       |
  301|    269|	if (desc->fmt_id == lpcm_MARKER && (desc->fmt_flags & 1) == 0)
  ------------------
  |  |   50|    269|#define lpcm_MARKER		MAKE_MARKER ('l', 'p', 'c', 'm')
  |  |  ------------------
  |  |  |  |  122|    538|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (301:6): [True: 127, False: 142]
  |  Branch (301:37): [True: 90, False: 37]
  ------------------
  302|     90|	{	/* Integer data. */
  303|     90|		if (desc->bits_per_chan == 32 && desc->pkt_bytes == 4 * desc->channels_per_frame)
  ------------------
  |  Branch (303:7): [True: 2, False: 88]
  |  Branch (303:36): [True: 1, False: 1]
  ------------------
  304|      1|		{	psf->bytewidth = 4 ;
  305|      1|			return format | SF_FORMAT_PCM_32 ;
  306|     89|			} ;
  307|     89|		if (desc->bits_per_chan == 24 && desc->pkt_bytes == 3 * desc->channels_per_frame)
  ------------------
  |  Branch (307:7): [True: 4, False: 85]
  |  Branch (307:36): [True: 1, False: 3]
  ------------------
  308|      1|		{	psf->bytewidth = 3 ;
  309|      1|			return format | SF_FORMAT_PCM_24 ;
  310|     88|			} ;
  311|     88|		if (desc->bits_per_chan == 16 && desc->pkt_bytes == 2 * desc->channels_per_frame)
  ------------------
  |  Branch (311:7): [True: 3, False: 85]
  |  Branch (311:36): [True: 1, False: 2]
  ------------------
  312|      1|		{	psf->bytewidth = 2 ;
  313|      1|			return format | SF_FORMAT_PCM_16 ;
  314|     87|			} ;
  315|     87|		if (desc->bits_per_chan == 8 && desc->pkt_bytes == 1 * desc->channels_per_frame)
  ------------------
  |  Branch (315:7): [True: 32, False: 55]
  |  Branch (315:35): [True: 1, False: 31]
  ------------------
  316|      1|		{	psf->bytewidth = 1 ;
  317|      1|			return format | SF_FORMAT_PCM_S8 ;
  318|     86|			} ;
  319|    265|		} ;
  320|       |
  321|    265|	if (desc->fmt_id == alaw_MARKER && desc->bits_per_chan == 8)
  ------------------
  |  |   39|    265|#define alaw_MARKER		MAKE_MARKER ('a', 'l', 'a', 'w')
  |  |  ------------------
  |  |  |  |  122|    530|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (321:6): [True: 33, False: 232]
  |  Branch (321:37): [True: 1, False: 32]
  ------------------
  322|      1|	{	psf->bytewidth = 1 ;
  323|      1|		return format | SF_FORMAT_ALAW ;
  324|    264|		} ;
  325|       |
  326|    264|	if (desc->fmt_id == ulaw_MARKER && desc->bits_per_chan == 8)
  ------------------
  |  |   63|    264|#define ulaw_MARKER		MAKE_MARKER ('u', 'l', 'a', 'w')
  |  |  ------------------
  |  |  |  |  122|    528|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (326:6): [True: 2, False: 262]
  |  Branch (326:37): [True: 1, False: 1]
  ------------------
  327|      1|	{	psf->bytewidth = 1 ;
  328|      1|		return format | SF_FORMAT_ULAW ;
  329|    263|		} ;
  330|       |
  331|    263|	psf_log_printf (psf, "**** Unknown format identifier.\n") ;
  332|       |
  333|    263|	return 0 ;
  334|    264|} /* decode_desc_chunk */
caf.c:caf_next_chunk_iterator:
 1005|  1.27k|{	return psf_next_chunk_iterator (&psf->rchunks, iterator) ;
 1006|  1.27k|} /* caf_next_chunk_iterator */
caf.c:caf_get_chunk_size:
 1010|    950|{	int indx ;
 1011|       |
 1012|    950|	if ((indx = psf_find_read_chunk_iterator (&psf->rchunks, iterator)) < 0)
  ------------------
  |  Branch (1012:6): [True: 0, False: 950]
  ------------------
 1013|      0|		return SFE_UNKNOWN_CHUNK ;
 1014|       |
 1015|    950|	chunk_info->datalen = psf->rchunks.chunks [indx].len ;
 1016|       |
 1017|    950|	return SFE_NO_ERROR ;
 1018|    950|} /* caf_get_chunk_size */
caf.c:caf_get_chunk_data:
 1022|    950|{	int indx ;
 1023|    950|	sf_count_t pos ;
 1024|       |
 1025|    950|	if ((indx = psf_find_read_chunk_iterator (&psf->rchunks, iterator)) < 0)
  ------------------
  |  Branch (1025:6): [True: 0, False: 950]
  ------------------
 1026|      0|		return SFE_UNKNOWN_CHUNK ;
 1027|       |
 1028|    950|	if (chunk_info->data == NULL)
  ------------------
  |  Branch (1028:6): [True: 0, False: 950]
  ------------------
 1029|      0|		return SFE_BAD_CHUNK_DATA_PTR ;
 1030|       |
 1031|    950|	chunk_info->id_size = psf->rchunks.chunks [indx].id_size ;
 1032|    950|	memcpy (chunk_info->id, psf->rchunks.chunks [indx].id, sizeof (chunk_info->id) / sizeof (*chunk_info->id)) ;
 1033|       |
 1034|    950|	pos = psf_ftell (psf) ;
 1035|    950|	psf_fseek (psf, psf->rchunks.chunks [indx].offset, SEEK_SET) ;
 1036|    950|	psf_fread (chunk_info->data, SF_MIN (chunk_info->datalen, psf->rchunks.chunks [indx].len), 1, psf) ;
  ------------------
  |  |   91|    950|#define		SF_MIN(a, b)	((a) < (b) ? (a) : (b))
  |  |  ------------------
  |  |  |  Branch (91:24): [True: 0, False: 950]
  |  |  ------------------
  ------------------
 1037|    950|	psf_fseek (psf, pos, SEEK_SET) ;
 1038|       |
 1039|    950|	return SFE_NO_ERROR ;
 1040|    950|} /* caf_get_chunk_data */

cart_var_alloc:
   41|    240|{	return calloc (1, sizeof (SF_CART_INFO_16K)) ;
   42|    240|} /* cart_var_alloc */

aiff_caf_of_channel_layout_tag:
  247|  3.32k|{	const AIFF_CAF_CHANNEL_MAP * curr_map ;
  248|  3.32k|	unsigned k, len ;
  249|  3.32k|	int channels = tag & 0xffff ;
  250|       |
  251|  3.32k|	if (channels < 0 || channels >= ARRAY_LEN (map))
  ------------------
  |  |   88|  3.32k|#define		ARRAY_LEN(x)	((int) (sizeof (x) / sizeof ((x) [0])))
  ------------------
  |  Branch (251:6): [True: 0, False: 3.32k]
  |  Branch (251:22): [True: 349, False: 2.97k]
  ------------------
  252|    349|		return NULL ;
  253|       |
  254|  2.97k|	curr_map = map [channels].map ;
  255|  2.97k|	len = map [channels].len ;
  256|       |
  257|  13.1k|	for (k = 0 ; k < len ; k++)
  ------------------
  |  Branch (257:15): [True: 12.3k, False: 728]
  ------------------
  258|  12.3k|		if (curr_map [k].channel_layout_tag == tag)
  ------------------
  |  Branch (258:7): [True: 2.25k, False: 10.1k]
  ------------------
  259|  2.25k|			return curr_map + k ;
  260|       |
  261|    728|	return NULL ;
  262|  2.97k|} /* aiff_caf_of_channel_layout_tag */

psf_get_chunk_iterator:
   42|    986|{	const READ_CHUNKS * pchk = &psf->rchunks ;
   43|    986|	int idx ;
   44|       |
   45|    986|	if (marker_str)
  ------------------
  |  Branch (45:6): [True: 986, False: 0]
  ------------------
   46|    986|		idx = psf_find_read_chunk_str (pchk, marker_str) ;
   47|      0|	else
   48|      0|		idx = pchk->used > 0 ? 0 : -1 ;
  ------------------
  |  Branch (48:9): [True: 0, False: 0]
  ------------------
   49|       |
   50|    986|	if (idx < 0)
  ------------------
  |  Branch (50:6): [True: 36, False: 950]
  ------------------
   51|     36|		return NULL ;
   52|       |
   53|    950|	if (psf->iterator == NULL)
  ------------------
  |  Branch (53:6): [True: 950, False: 0]
  ------------------
   54|    950|	{	psf->iterator = calloc (1, sizeof (SF_CHUNK_ITERATOR)) ;
   55|    950|		if (psf->iterator == NULL)
  ------------------
  |  Branch (55:7): [True: 0, False: 950]
  ------------------
   56|      0|			return NULL ;
   57|    950|		} ;
   58|       |
   59|    950|	psf->iterator->sndfile = (SNDFILE *) psf ;
   60|       |
   61|    950|	if (marker_str)
  ------------------
  |  Branch (61:6): [True: 950, False: 0]
  ------------------
   62|    950|	{	int64_t hash ;
   63|    950|		size_t marker_len ;
   64|    950|		union
   65|    950|		{	uint32_t marker ;
   66|    950|			char str [5] ;
   67|    950|		} u ;
   68|       |
   69|       |		/* snprintf () stops at the terminator, so clear the rest first. */
   70|    950|		u.marker = 0 ;
   71|    950|		snprintf (u.str, sizeof (u.str), "%s", marker_str) ;
   72|       |
   73|    950|		marker_len = strlen (marker_str) ;
   74|    950|		if (marker_len > 64)
  ------------------
  |  Branch (74:7): [True: 0, False: 950]
  ------------------
   75|      0|			marker_len = 64 ;
   76|       |
   77|    950|		hash = marker_len > 4 ? hash_of_str (marker_str) : u.marker ;
  ------------------
  |  Branch (77:10): [True: 0, False: 950]
  ------------------
   78|       |
   79|    950|		memcpy (psf->iterator->id, marker_str, marker_len) ;
   80|    950|		psf->iterator->id_size = (unsigned) marker_len ;
   81|    950|		psf->iterator->hash = hash ;
   82|    950|		}
   83|       |
   84|    950|	psf->iterator->current = idx ;
   85|       |
   86|    950|	return psf->iterator ;
   87|    950|} /* psf_get_chunk_iterator */
psf_next_chunk_iterator:
   91|  1.27k|{	uint64_t hash = iterator->hash ;
   92|  1.27k|	uint32_t k ;
   93|       |
   94|  1.27k|	iterator->current++ ;
   95|       |
   96|  1.27k|	if (hash)
  ------------------
  |  Branch (96:6): [True: 1.27k, False: 0]
  ------------------
   97|  2.53k|	{	for (k = iterator->current ; k < pchk->used ; k++)
  ------------------
  |  Branch (97:33): [True: 1.58k, False: 950]
  ------------------
   98|  1.58k|			if (pchk->chunks [k].hash == hash)
  ------------------
  |  Branch (98:8): [True: 323, False: 1.26k]
  ------------------
   99|    323|			{	iterator->current = k ;
  100|    323|				return iterator ;
  101|    323|				}
  102|  1.27k|		}
  103|      0|	else if (iterator->current < pchk->used)
  ------------------
  |  Branch (103:11): [True: 0, False: 0]
  ------------------
  104|      0|		return iterator ;
  105|       |
  106|       |	/* No match, clear iterator and return NULL */
  107|    950|	memset (iterator, 0, sizeof (*iterator)) ;
  108|       |	return NULL ;
  109|  1.27k|} /* psf_next_chunk_iterator */
psf_store_read_chunk_u32:
  146|   643k|{	READ_CHUNK rchunk ;
  147|       |
  148|   643k|	memset (&rchunk, 0, sizeof (rchunk)) ;
  149|       |
  150|   643k|	rchunk.hash = marker ;
  151|   643k|	rchunk.mark32 = marker ;
  152|   643k|	rchunk.offset = offset ;
  153|   643k|	rchunk.len = len ;
  154|       |
  155|   643k|	rchunk.id_size = 4 ;
  156|   643k|	memcpy (rchunk.id, &marker, rchunk.id_size) ;
  157|       |
  158|   643k|	return psf_store_read_chunk (pchk, &rchunk) ;
  159|   643k|} /* psf_store_read_chunk_u32 */
psf_find_read_chunk_str:
  163|    986|{	uint64_t hash ;
  164|    986|	uint32_t k ;
  165|    986|	union
  166|    986|	{	uint32_t marker ;
  167|    986|		char str [5] ;
  168|    986|	} u ;
  169|       |
  170|       |	/* snprintf () stops at the terminator, so clear the rest first. */
  171|    986|	u.marker = 0 ;
  172|    986|	snprintf (u.str, sizeof (u.str), "%s", marker_str) ;
  173|       |
  174|    986|	hash = strlen (marker_str) > 4 ? hash_of_str (marker_str) : u.marker ;
  ------------------
  |  Branch (174:9): [True: 0, False: 986]
  ------------------
  175|       |
  176|  3.40k|	for (k = 0 ; k < pchk->used ; k++)
  ------------------
  |  Branch (176:15): [True: 3.37k, False: 36]
  ------------------
  177|  3.37k|		if (pchk->chunks [k].hash == hash)
  ------------------
  |  Branch (177:7): [True: 950, False: 2.42k]
  ------------------
  178|    950|			return k ;
  179|       |
  180|     36|	return -1 ;
  181|    986|} /* psf_find_read_chunk_str */
psf_find_read_chunk_iterator:
  195|  1.90k|{	if (marker->current < pchk->used)
  ------------------
  |  Branch (195:7): [True: 1.90k, False: 0]
  ------------------
  196|  1.90k|		return marker->current ;
  197|       |
  198|      0|	return -1 ;
  199|  1.90k|} /* psf_find_read_chunk_iterator */
chunk.c:psf_store_read_chunk:
  113|   643k|{	if (pchk->count == 0)
  ------------------
  |  Branch (113:7): [True: 11.9k, False: 631k]
  ------------------
  114|  11.9k|	{	pchk->used = 0 ;
  115|  11.9k|		pchk->count = 20 ;
  116|  11.9k|		pchk->chunks = calloc (pchk->count, sizeof (READ_CHUNK)) ;
  117|  11.9k|		if (!pchk->chunks)
  ------------------
  |  Branch (117:7): [True: 0, False: 11.9k]
  ------------------
  118|      0|		{	return SFE_MALLOC_FAILED ;
  119|  11.9k|			} ;
  120|  11.9k|		}
  121|   631k|	else if (pchk->used > pchk->count)
  ------------------
  |  Branch (121:11): [True: 0, False: 631k]
  ------------------
  122|      0|		return SFE_INTERNAL ;
  123|   631k|	else if (pchk->used == pchk->count)
  ------------------
  |  Branch (123:11): [True: 4.73k, False: 627k]
  ------------------
  124|  4.73k|	{	READ_CHUNK * old_ptr = pchk->chunks ;
  125|  4.73k|		int new_count = 3 * (pchk->count + 1) / 2 ;
  126|       |
  127|  4.73k|		READ_CHUNK * new_chunks = realloc (old_ptr, new_count * sizeof (READ_CHUNK)) ;
  128|  4.73k|		if (new_chunks == NULL)
  ------------------
  |  Branch (128:7): [True: 0, False: 4.73k]
  ------------------
  129|      0|		{
  130|      0|			return SFE_MALLOC_FAILED ;
  131|  4.73k|			} else {
  132|  4.73k|			pchk->chunks = new_chunks;
  133|  4.73k|			} ;
  134|  4.73k|		pchk->count = new_count ;
  135|   643k|		} ;
  136|       |
  137|   643k|	pchk->chunks [pchk->used] = *rchunk ;
  138|       |
  139|   643k|	pchk->used ++ ;
  140|       |
  141|   643k|	return SFE_NO_ERROR ;
  142|   643k|} /* psf_store_read_chunk */

psf_allocate:
   51|  19.6k|{	SF_PRIVATE * psf ;
   52|       |
   53|  19.6k|	if ((psf = calloc (1, sizeof (SF_PRIVATE))) == NULL)
  ------------------
  |  Branch (53:6): [True: 0, False: 19.6k]
  ------------------
   54|      0|		return	NULL ;
   55|       |
   56|  19.6k|	if ((psf->header.ptr = calloc (1, INITIAL_HEADER_SIZE)) == NULL)
  ------------------
  |  |   46|  19.6k|#define	INITIAL_HEADER_SIZE	256
  ------------------
  |  Branch (56:6): [True: 0, False: 19.6k]
  ------------------
   57|      0|	{	free (psf) ;
   58|      0|		return	NULL ;
   59|  19.6k|		} ;
   60|  19.6k|	psf->header.len = INITIAL_HEADER_SIZE ;
  ------------------
  |  |   46|  19.6k|#define	INITIAL_HEADER_SIZE	256
  ------------------
   61|       |
   62|  19.6k|	return psf ;
   63|  19.6k|} /* psf_allocate */
psf_log_printf:
  113|  39.7M|{	va_list		ap ;
  114|  39.7M|	uint32_t	u, tens ;
  115|  39.7M|	int			d, shift, width, width_specifier, left_align, slen, precision ;
  116|  39.7M|	char		c, *strptr, istr [5], lead_char, sign_char ;
  117|       |
  118|  39.7M|	va_start (ap, format) ;
  119|       |
  120|   932M|	while ((c = *format++))
  ------------------
  |  Branch (120:9): [True: 892M, False: 39.7M]
  ------------------
  121|   892M|	{	if (c != '%')
  ------------------
  |  Branch (121:8): [True: 832M, False: 59.9M]
  ------------------
  122|   832M|		{	log_putchar (psf, c) ;
  123|   832M|			continue ;
  124|   832M|			} ;
  125|       |
  126|  59.9M|		if (format [0] == '%') /* Handle %% */
  ------------------
  |  Branch (126:7): [True: 0, False: 59.9M]
  ------------------
  127|      0|		{ 	log_putchar (psf, '%') ;
  128|      0|			format ++ ;
  129|      0|			continue ;
  130|  59.9M|			} ;
  131|       |
  132|  59.9M|		sign_char = 0 ;
  133|  59.9M|		left_align = SF_FALSE ;
  134|  60.0M|		while (1)
  ------------------
  |  Branch (134:10): [True: 60.0M, Folded]
  ------------------
  135|  60.0M|		{	switch (format [0])
  136|  60.0M|			{	case ' ' :
  ------------------
  |  Branch (136:6): [True: 0, False: 60.0M]
  ------------------
  137|      0|				case '+' :
  ------------------
  |  Branch (137:5): [True: 0, False: 60.0M]
  ------------------
  138|      0|					sign_char = format [0] ;
  139|      0|					format ++ ;
  140|      0|					continue ;
  141|       |
  142|  38.5k|				case '-' :
  ------------------
  |  Branch (142:5): [True: 38.5k, False: 59.9M]
  ------------------
  143|  38.5k|					left_align = SF_TRUE ;
  144|  38.5k|					format ++ ;
  145|  38.5k|					continue ;
  146|       |
  147|  59.9M|				default : break ;
  ------------------
  |  Branch (147:5): [True: 59.9M, False: 38.5k]
  ------------------
  148|  60.0M|				} ;
  149|       |
  150|  59.9M|			break ;
  151|  60.0M|			} ;
  152|       |
  153|  59.9M|		if (format [0] == 0)
  ------------------
  |  Branch (153:7): [True: 0, False: 59.9M]
  ------------------
  154|      0|			break ;
  155|       |
  156|  59.9M|		lead_char = ' ' ;
  157|  59.9M|		if (format [0] == '0')
  ------------------
  |  Branch (157:7): [True: 4.84M, False: 55.1M]
  ------------------
  158|  4.84M|			lead_char = '0' ;
  159|       |
  160|  59.9M|		width_specifier = 0 ;
  161|  69.7M|		while ((c = *format++) && isdigit (c))
  ------------------
  |  Branch (161:10): [True: 69.7M, False: 0]
  |  Branch (161:29): [True: 9.81M, False: 59.9M]
  ------------------
  162|  9.81M|			width_specifier = width_specifier * 10 + (c - '0') ;
  163|       |
  164|  59.9M|		precision = 0 ;
  165|  59.9M|		if (c == '.')
  ------------------
  |  Branch (165:7): [True: 130, False: 59.9M]
  ------------------
  166|    390|		{	while ((c = *format++) && isdigit (c))
  ------------------
  |  Branch (166:12): [True: 390, False: 0]
  |  Branch (166:31): [True: 260, False: 130]
  ------------------
  167|    260|				precision = precision * 10 + (c - '0') ;
  168|    130|			} ;
  169|       |
  170|  59.9M|		switch (c)
  171|  59.9M|		{	case 0 : /* NULL character. */
  ------------------
  |  Branch (171:5): [True: 0, False: 59.9M]
  ------------------
  172|      0|					va_end (ap) ;
  173|      0|					return ;
  174|       |
  175|  1.49M|			case 's': /* string */
  ------------------
  |  Branch (175:4): [True: 1.49M, False: 58.4M]
  ------------------
  176|  1.49M|					strptr = va_arg (ap, char *) ;
  177|  1.49M|					if (strptr == NULL)
  ------------------
  |  Branch (177:10): [True: 0, False: 1.49M]
  ------------------
  178|      0|						break ;
  179|  1.49M|					if (precision > 0)
  ------------------
  |  Branch (179:10): [True: 130, False: 1.49M]
  ------------------
  180|    130|						slen = strnlen (strptr, precision) ;
  181|  1.49M|					else
  182|  1.49M|						slen = strlen (strptr) ;
  183|  1.49M|					width_specifier = width_specifier >= slen ? width_specifier - slen : 0 ;
  ------------------
  |  Branch (183:24): [True: 1.32M, False: 164k]
  ------------------
  184|  1.49M|					if (left_align == SF_FALSE)
  ------------------
  |  Branch (184:10): [True: 1.45M, False: 38.5k]
  ------------------
  185|  1.45M|						while (width_specifier -- > 0)
  ------------------
  |  Branch (185:14): [True: 0, False: 1.45M]
  ------------------
  186|      0|							log_putchar (psf, ' ') ;
  187|  4.37M|					while (slen--)
  ------------------
  |  Branch (187:13): [True: 2.88M, False: 1.49M]
  ------------------
  188|  2.88M|						log_putchar (psf, *strptr++) ;
  189|  1.88M|					while (width_specifier -- > 0)
  ------------------
  |  Branch (189:13): [True: 388k, False: 1.49M]
  ------------------
  190|   388k|						log_putchar (psf, ' ') ;
  191|  1.49M|					break ;
  192|       |
  193|  23.4M|			case 'd': /* int */
  ------------------
  |  Branch (193:4): [True: 23.4M, False: 36.5M]
  ------------------
  194|  23.4M|					d = va_arg (ap, int) ;
  195|       |
  196|  23.4M|					if (d < 0)
  ------------------
  |  Branch (196:10): [True: 27.5k, False: 23.4M]
  ------------------
  197|  27.5k|					{	sign_char = '-' ;
  198|  27.5k|						if (lead_char != '0' && left_align == SF_FALSE)
  ------------------
  |  Branch (198:11): [True: 27.4k, False: 31]
  |  Branch (198:31): [True: 27.4k, False: 0]
  ------------------
  199|  27.4k|							width_specifier -- ;
  200|       |
  201|  27.5k|						u = - ((unsigned) d) ;
  202|  27.5k|						}
  203|  23.4M|					else
  204|  23.4M|					{	u = (unsigned) d ;
  205|  23.4M|						}
  206|       |
  207|  23.4M|					tens = 1 ;
  208|  23.4M|					width = 1 ;
  209|  90.9M|					while (u / tens >= 10)
  ------------------
  |  Branch (209:13): [True: 67.5M, False: 23.4M]
  ------------------
  210|  67.5M|					{	tens *= 10 ;
  211|  67.5M|						width ++ ;
  212|  67.5M|						} ;
  213|       |
  214|  23.4M|					width_specifier -= width ;
  215|       |
  216|  23.4M|					if (sign_char == ' ')
  ------------------
  |  Branch (216:10): [True: 0, False: 23.4M]
  ------------------
  217|      0|					{	log_putchar (psf, ' ') ;
  218|      0|						width_specifier -- ;
  219|      0|						} ;
  220|       |
  221|  23.4M|					if (left_align == SF_FALSE && lead_char != '0')
  ------------------
  |  Branch (221:10): [True: 23.4M, False: 0]
  |  Branch (221:36): [True: 23.4M, False: 112]
  ------------------
  222|  23.4M|					{	if (sign_char == '+')
  ------------------
  |  Branch (222:12): [True: 0, False: 23.4M]
  ------------------
  223|      0|							width_specifier -- ;
  224|       |
  225|  23.4M|						while (width_specifier -- > 0)
  ------------------
  |  Branch (225:14): [True: 2.82k, False: 23.4M]
  ------------------
  226|  2.82k|							log_putchar (psf, lead_char) ;
  227|  23.4M|						} ;
  228|       |
  229|  23.4M|					if (sign_char == '+' || sign_char == '-')
  ------------------
  |  Branch (229:10): [True: 0, False: 23.4M]
  |  Branch (229:30): [True: 27.5k, False: 23.4M]
  ------------------
  230|  27.5k|					{	log_putchar (psf, sign_char) ;
  231|  27.5k|						width_specifier -- ;
  232|  27.5k|						} ;
  233|       |
  234|  23.4M|					if (left_align == SF_FALSE)
  ------------------
  |  Branch (234:10): [True: 23.4M, False: 0]
  ------------------
  235|  23.4M|						while (width_specifier -- > 0)
  ------------------
  |  Branch (235:14): [True: 43, False: 23.4M]
  ------------------
  236|     43|							log_putchar (psf, lead_char) ;
  237|       |
  238|   114M|					while (tens > 0)
  ------------------
  |  Branch (238:13): [True: 90.9M, False: 23.4M]
  ------------------
  239|  90.9M|					{	log_putchar (psf, '0' + u / tens) ;
  240|  90.9M|						u %= tens ;
  241|  90.9M|						tens /= 10 ;
  242|  90.9M|						} ;
  243|       |
  244|  23.4M|					while (width_specifier -- > 0)
  ------------------
  |  Branch (244:13): [True: 0, False: 23.4M]
  ------------------
  245|      0|						log_putchar (psf, lead_char) ;
  246|  23.4M|					break ;
  247|       |
  248|  1.79M|			case 'D': /* sf_count_t */
  ------------------
  |  Branch (248:4): [True: 1.79M, False: 58.1M]
  ------------------
  249|  1.79M|					{	sf_count_t	D ;
  250|  1.79M|						uint64_t	U, Tens ;
  251|       |
  252|  1.79M|						D = va_arg (ap, sf_count_t) ;
  253|       |
  254|  1.79M|						if (D == 0)
  ------------------
  |  Branch (254:11): [True: 11.0k, False: 1.78M]
  ------------------
  255|  11.0k|						{	while (-- width_specifier > 0)
  ------------------
  |  Branch (255:16): [True: 0, False: 11.0k]
  ------------------
  256|      0|								log_putchar (psf, lead_char) ;
  257|  11.0k|							log_putchar (psf, '0') ;
  258|  11.0k|							break ;
  259|  11.0k|							}
  260|  1.78M|						else
  261|  1.78M|						{	if (D < 0)
  ------------------
  |  Branch (261:13): [True: 95.5k, False: 1.68M]
  ------------------
  262|  95.5k|							{	log_putchar (psf, '-') ;
  263|  95.5k|								U = - ((uint64_t) D) ;
  264|  95.5k|								}
  265|  1.68M|							else
  266|  1.68M|							{	U = (uint64_t) D ;
  267|  1.68M|								}
  268|  1.78M|							}
  269|       |
  270|  1.78M|						Tens = 1 ;
  271|  1.78M|						width = 1 ;
  272|  3.95M|						while (U / Tens >= 10)
  ------------------
  |  Branch (272:14): [True: 2.17M, False: 1.78M]
  ------------------
  273|  2.17M|						{	Tens *= 10 ;
  274|  2.17M|							width ++ ;
  275|  2.17M|							} ;
  276|       |
  277|  1.78M|						while (width_specifier > width)
  ------------------
  |  Branch (277:14): [True: 0, False: 1.78M]
  ------------------
  278|      0|						{	log_putchar (psf, lead_char) ;
  279|      0|							width_specifier-- ;
  280|      0|							} ;
  281|       |
  282|  5.73M|						while (Tens > 0)
  ------------------
  |  Branch (282:14): [True: 3.95M, False: 1.78M]
  ------------------
  283|  3.95M|						{	log_putchar (psf, '0' + U / Tens) ;
  284|  3.95M|							U %= Tens ;
  285|  3.95M|							Tens /= 10 ;
  286|  3.95M|							} ;
  287|  1.78M|						} ;
  288|  1.78M|					break ;
  289|       |
  290|  12.6M|			case 'u': /* unsigned int */
  ------------------
  |  Branch (290:4): [True: 12.6M, False: 47.3M]
  ------------------
  291|  12.6M|					u = va_arg (ap, unsigned int) ;
  292|       |
  293|  12.6M|					tens = 1 ;
  294|  12.6M|					width = 1 ;
  295|  97.1M|					while (u / tens >= 10)
  ------------------
  |  Branch (295:13): [True: 84.5M, False: 12.6M]
  ------------------
  296|  84.5M|					{	tens *= 10 ;
  297|  84.5M|						width ++ ;
  298|  84.5M|						} ;
  299|       |
  300|  12.6M|					width_specifier -= width ;
  301|       |
  302|  12.6M|					if (sign_char == ' ')
  ------------------
  |  Branch (302:10): [True: 0, False: 12.6M]
  ------------------
  303|      0|					{	log_putchar (psf, ' ') ;
  304|      0|						width_specifier -- ;
  305|      0|						} ;
  306|       |
  307|  12.6M|					if (left_align == SF_FALSE && lead_char != '0')
  ------------------
  |  Branch (307:10): [True: 12.6M, False: 0]
  |  Branch (307:36): [True: 12.6M, False: 775]
  ------------------
  308|  12.6M|					{	if (sign_char == '+')
  ------------------
  |  Branch (308:12): [True: 0, False: 12.6M]
  ------------------
  309|      0|							width_specifier -- ;
  310|       |
  311|  12.7M|						while (width_specifier -- > 0)
  ------------------
  |  Branch (311:14): [True: 67.5k, False: 12.6M]
  ------------------
  312|  67.5k|							log_putchar (psf, lead_char) ;
  313|  12.6M|						} ;
  314|       |
  315|  12.6M|					if (sign_char == '+' || sign_char == '-')
  ------------------
  |  Branch (315:10): [True: 0, False: 12.6M]
  |  Branch (315:30): [True: 0, False: 12.6M]
  ------------------
  316|      0|					{	log_putchar (psf, sign_char) ;
  317|      0|						width_specifier -- ;
  318|      0|						} ;
  319|       |
  320|  12.6M|					if (left_align == SF_FALSE)
  ------------------
  |  Branch (320:10): [True: 12.6M, False: 0]
  ------------------
  321|  12.6M|						while (width_specifier -- > 0)
  ------------------
  |  Branch (321:14): [True: 560, False: 12.6M]
  ------------------
  322|    560|							log_putchar (psf, lead_char) ;
  323|       |
  324|   109M|					while (tens > 0)
  ------------------
  |  Branch (324:13): [True: 97.1M, False: 12.6M]
  ------------------
  325|  97.1M|					{	log_putchar (psf, '0' + u / tens) ;
  326|  97.1M|						u %= tens ;
  327|  97.1M|						tens /= 10 ;
  328|  97.1M|						} ;
  329|       |
  330|  12.6M|					while (width_specifier -- > 0)
  ------------------
  |  Branch (330:13): [True: 0, False: 12.6M]
  ------------------
  331|      0|						log_putchar (psf, lead_char) ;
  332|  12.6M|					break ;
  333|       |
  334|      0|			case 'c': /* char */
  ------------------
  |  Branch (334:4): [True: 0, False: 59.9M]
  ------------------
  335|      0|					c = va_arg (ap, int) & 0xFF ;
  336|      0|					log_putchar (psf, c) ;
  337|      0|					break ;
  338|       |
  339|  1.63M|			case 'x': /* hex */
  ------------------
  |  Branch (339:4): [True: 1.63M, False: 58.3M]
  ------------------
  340|  6.55M|			case 'X': /* hex */
  ------------------
  |  Branch (340:4): [True: 4.92M, False: 55.0M]
  ------------------
  341|  6.55M|					d = va_arg (ap, int) ;
  342|       |
  343|  6.55M|					if (d == 0)
  ------------------
  |  Branch (343:10): [True: 3.07M, False: 3.48M]
  ------------------
  344|  4.85M|					{	while (--width_specifier > 0)
  ------------------
  |  Branch (344:15): [True: 1.77M, False: 3.07M]
  ------------------
  345|  1.77M|							log_putchar (psf, lead_char) ;
  346|  3.07M|						log_putchar (psf, '0') ;
  347|  3.07M|						break ;
  348|  3.48M|						} ;
  349|  3.48M|					shift = 28 ;
  350|  3.48M|					width = (width_specifier < 8) ? 8 : width_specifier ;
  ------------------
  |  Branch (350:14): [True: 3.48M, False: 157]
  ------------------
  351|  23.3M|					while (! ((((uint32_t) 0xF) << shift) & d))
  ------------------
  |  Branch (351:13): [True: 19.8M, False: 3.48M]
  ------------------
  352|  19.8M|					{	shift -= 4 ;
  353|  19.8M|						width -- ;
  354|  19.8M|						} ;
  355|       |
  356|  4.24M|					while (width > 0 && width_specifier > width)
  ------------------
  |  Branch (356:13): [True: 4.24M, False: 0]
  |  Branch (356:26): [True: 762k, False: 3.48M]
  ------------------
  357|   762k|					{	log_putchar (psf, lead_char) ;
  358|   762k|						width_specifier-- ;
  359|   762k|						} ;
  360|       |
  361|  11.5M|					while (shift >= 0)
  ------------------
  |  Branch (361:13): [True: 8.05M, False: 3.48M]
  ------------------
  362|  8.05M|					{	c = (d >> shift) & 0xF ;
  363|  8.05M|						log_putchar (psf, (c > 9) ? c + 'A' - 10 : c + '0') ;
  ------------------
  |  Branch (363:25): [True: 2.54M, False: 5.50M]
  ------------------
  364|  8.05M|						shift -= 4 ;
  365|  8.05M|						} ;
  366|  3.48M|					break ;
  367|       |
  368|  14.0M|			case 'M': /* int2str */
  ------------------
  |  Branch (368:4): [True: 14.0M, False: 45.9M]
  ------------------
  369|  14.0M|					d = va_arg (ap, int) ;
  370|  14.0M|					if (CPU_IS_LITTLE_ENDIAN)
  ------------------
  |  |   14|  14.0M|#define CPU_IS_LITTLE_ENDIAN 1
  |  |  ------------------
  |  |  |  Branch (14:30): [True: 14.0M, Folded]
  |  |  ------------------
  ------------------
  371|  14.0M|					{	istr [0] = d & 0xFF ;
  372|  14.0M|						istr [1] = (d >> 8) & 0xFF ;
  373|  14.0M|						istr [2] = (d >> 16) & 0xFF ;
  374|  14.0M|						istr [3] = (d >> 24) & 0xFF ;
  375|  14.0M|						}
  376|      0|					else
  377|      0|					{	istr [3] = d & 0xFF ;
  378|      0|						istr [2] = (d >> 8) & 0xFF ;
  379|      0|						istr [1] = (d >> 16) & 0xFF ;
  380|      0|						istr [0] = (d >> 24) & 0xFF ;
  381|      0|						} ;
  382|  14.0M|					istr [4] = 0 ;
  383|  14.0M|					strptr = istr ;
  384|  69.0M|					while (*strptr)
  ------------------
  |  Branch (384:13): [True: 54.9M, False: 14.0M]
  ------------------
  385|  54.9M|					{	c = *strptr++ ;
  386|  54.9M|						log_putchar (psf, psf_isprint (c) ? c : '.') ;
  ------------------
  |  Branch (386:25): [True: 51.2M, False: 3.69M]
  ------------------
  387|  54.9M|						} ;
  388|  14.0M|					break ;
  389|       |
  390|      0|			default :
  ------------------
  |  Branch (390:4): [True: 0, False: 59.9M]
  ------------------
  391|      0|					log_putchar (psf, '*') ;
  392|      0|					log_putchar (psf, c) ;
  393|      0|					log_putchar (psf, '*') ;
  394|      0|					break ;
  395|  59.9M|			} /* switch */
  396|  59.9M|		} /* while */
  397|       |
  398|  39.7M|	va_end (ap) ;
  399|  39.7M|	return ;
  400|  39.7M|} /* psf_log_printf */
psf_binheader_readf:
 1022|  33.8M|{	va_list			argptr ;
 1023|  33.8M|	sf_count_t		*countptr, countdata ;
 1024|  33.8M|	unsigned char	sixteen_bytes [16] = { 0 } ;
 1025|  33.8M|	unsigned int 	*intptr, intdata ;
 1026|  33.8M|	unsigned short	*shortptr ;
 1027|  33.8M|	char			*charptr ;
 1028|  33.8M|	float			*floatptr ;
 1029|  33.8M|	double			*doubleptr ;
 1030|  33.8M|	char			c ;
 1031|  33.8M|	int				byte_count = 0, count = 0 ;
 1032|  33.8M|	int				read_bytes = 0 ;
 1033|       |
 1034|  33.8M|	if (! format)
  ------------------
  |  Branch (1034:6): [True: 0, False: 33.8M]
  ------------------
 1035|      0|		return psf_ftell (psf) ;
 1036|       |
 1037|  33.8M|	va_start (argptr, format) ;
 1038|       |
 1039|   108M|	while ((c = *format++))
  ------------------
  |  Branch (1039:9): [True: 74.4M, False: 33.7M]
  ------------------
 1040|  74.4M|	{
 1041|  74.4M|		read_bytes = 0 ;
 1042|  74.4M|		if (psf->header.indx + 16 >= psf->header.len && psf_bump_header_allocation (psf, 16))
  ------------------
  |  Branch (1042:7): [True: 83.2k, False: 74.3M]
  |  Branch (1042:51): [True: 80.0k, False: 3.19k]
  ------------------
 1043|  80.0k|			break ;
 1044|       |
 1045|  74.3M|		switch (c)
 1046|  74.3M|		{	case 'e' : /* All conversions are now from LE to host. */
  ------------------
  |  Branch (1046:5): [True: 688k, False: 73.6M]
  ------------------
 1047|   688k|					psf->rwf_endian = SF_ENDIAN_LITTLE ;
 1048|   688k|					break ;
 1049|       |
 1050|  15.4M|			case 'E' : /* All conversions are now from BE to host. */
  ------------------
  |  Branch (1050:4): [True: 15.4M, False: 58.9M]
  ------------------
 1051|  15.4M|					psf->rwf_endian = SF_ENDIAN_BIG ;
 1052|  15.4M|					break ;
 1053|       |
 1054|  17.1M|			case 'm' : /* 4 byte marker value eg 'RIFF' */
  ------------------
  |  Branch (1054:4): [True: 17.1M, False: 57.2M]
  ------------------
 1055|  17.1M|					intptr = va_arg (argptr, unsigned int*) ;
 1056|  17.1M|					store_uint (intptr, 0) ;
 1057|  17.1M|					read_bytes = header_read (psf, sixteen_bytes, sizeof (int)) ;
 1058|  17.1M|					store_uint (intptr, GET_MARKER (sixteen_bytes)) ;
  ------------------
  |  |  840|  17.1M|#define	GET_MARKER(ptr)	(	((ptr) [0])			| ((ptr) [1] << 8) |	\
  |  |  841|  17.1M|							((ptr) [2] << 16)	| (((uint32_t) (ptr) [3]) << 24))
  ------------------
 1059|  17.1M|					break ;
 1060|       |
 1061|   100k|			case 'h' :
  ------------------
  |  Branch (1061:4): [True: 100k, False: 74.2M]
  ------------------
 1062|   100k|					intptr = va_arg (argptr, unsigned int*) ;
 1063|   100k|					store_uint (intptr, 0) ;
 1064|   100k|					read_bytes = header_read (psf, sixteen_bytes, sizeof (sixteen_bytes)) ;
 1065|   100k|					{	int k ;
 1066|   100k|						intdata = 0 ;
 1067|  1.70M|						for (k = 0 ; k < 16 ; k++)
  ------------------
  |  Branch (1067:20): [True: 1.60M, False: 100k]
  ------------------
 1068|  1.60M|							intdata ^= sixteen_bytes [k] << k ;
 1069|   100k|						}
 1070|   100k|					store_uint (intptr, intdata) ;
 1071|   100k|					break ;
 1072|       |
 1073|  2.98M|			case '1' :
  ------------------
  |  Branch (1073:4): [True: 2.98M, False: 71.3M]
  ------------------
 1074|  2.98M|					charptr = va_arg (argptr, char*) ;
 1075|  2.98M|					*charptr = 0 ;
 1076|  2.98M|					read_bytes = header_read (psf, charptr, sizeof (char)) ;
 1077|  2.98M|					break ;
 1078|       |
 1079|  2.84M|			case '2' : /* 2 byte value with the current endian-ness */
  ------------------
  |  Branch (1079:4): [True: 2.84M, False: 71.5M]
  ------------------
 1080|  2.84M|					shortptr = va_arg (argptr, unsigned short*) ;
 1081|  2.84M|					store_ushort (shortptr, 0) ;
 1082|  2.84M|					read_bytes = header_read (psf, sixteen_bytes, sizeof (short)) ;
 1083|  2.84M|					if (psf->rwf_endian == SF_ENDIAN_BIG)
  ------------------
  |  Branch (1083:10): [True: 2.82M, False: 19.2k]
  ------------------
 1084|  2.82M|						store_ushort (shortptr, GET_BE_SHORT (sixteen_bytes)) ;
  ------------------
  |  |  848|  2.82M|#define	GET_BE_SHORT(ptr)	(((ptr) [0] << 8) | ((ptr) [1]))
  ------------------
 1085|  19.2k|					else
 1086|  19.2k|						store_ushort (shortptr, GET_LE_SHORT (sixteen_bytes)) ;
  ------------------
  |  |  847|  19.2k|#define	GET_LE_SHORT(ptr)	(((ptr) [1] << 8) | ((ptr) [0]))
  ------------------
 1087|  2.84M|					break ;
 1088|       |
 1089|  2.28k|			case '3' : /* 3 byte value with the current endian-ness */
  ------------------
  |  Branch (1089:4): [True: 2.28k, False: 74.3M]
  ------------------
 1090|  2.28k|					intptr = va_arg (argptr, unsigned int*) ;
 1091|  2.28k|					store_uint (intptr, 0) ;
 1092|  2.28k|					read_bytes = header_read (psf, sixteen_bytes, 3) ;
 1093|  2.28k|					if (psf->rwf_endian == SF_ENDIAN_BIG)
  ------------------
  |  Branch (1093:10): [True: 0, False: 2.28k]
  ------------------
 1094|      0|						store_uint (intptr, GET_BE_3BYTE (sixteen_bytes)) ;
  ------------------
  |  |  851|      0|#define	GET_BE_3BYTE(ptr)	(	((ptr) [0] << 16) | ((ptr) [1] << 8) | ((ptr) [2]))
  ------------------
 1095|  2.28k|					else
 1096|  2.28k|						store_uint (intptr, GET_LE_3BYTE (sixteen_bytes)) ;
  ------------------
  |  |  850|  2.28k|#define	GET_LE_3BYTE(ptr)	(	((ptr) [2] << 16) | ((ptr) [1] << 8) | ((ptr) [0]))
  ------------------
 1097|  2.28k|					break ;
 1098|       |
 1099|  22.3M|			case '4' : /* 4 byte value with the current endian-ness */
  ------------------
  |  Branch (1099:4): [True: 22.3M, False: 51.9M]
  ------------------
 1100|  22.3M|					intptr = va_arg (argptr, unsigned int*) ;
 1101|  22.3M|					store_uint (intptr, 0) ;
 1102|  22.3M|					read_bytes = header_read (psf, sixteen_bytes, sizeof (int)) ;
 1103|  22.3M|					if (psf->rwf_endian == SF_ENDIAN_BIG)
  ------------------
  |  Branch (1103:10): [True: 19.8M, False: 2.51M]
  ------------------
 1104|  19.8M|						store_uint (intptr, psf_get_be32 (sixteen_bytes, 0)) ;
 1105|  2.51M|					else
 1106|  2.51M|						store_uint (intptr, psf_get_le32 (sixteen_bytes, 0)) ;
 1107|  22.3M|					break ;
 1108|       |
 1109|   124k|			case '8' : /* 8 byte value with the current endian-ness */
  ------------------
  |  Branch (1109:4): [True: 124k, False: 74.2M]
  ------------------
 1110|   124k|					countptr = va_arg (argptr, sf_count_t *) ;
 1111|   124k|					store_count (countptr, 0) ;
 1112|   124k|					read_bytes = header_read (psf, sixteen_bytes, 8) ;
 1113|   124k|					if (psf->rwf_endian == SF_ENDIAN_BIG)
  ------------------
  |  Branch (1113:10): [True: 20.3k, False: 104k]
  ------------------
 1114|  20.3k|						countdata = psf_get_be64 (sixteen_bytes, 0) ;
 1115|   104k|					else
 1116|   104k|						countdata = psf_get_le64 (sixteen_bytes, 0) ;
 1117|   124k|					store_count (countptr, countdata) ;
 1118|   124k|					break ;
 1119|       |
 1120|  41.7k|			case 'f' : /* Float conversion */
  ------------------
  |  Branch (1120:4): [True: 41.7k, False: 74.3M]
  ------------------
 1121|  41.7k|					floatptr = va_arg (argptr, float *) ;
 1122|  41.7k|					store_float (floatptr, 0.0) ;
 1123|  41.7k|					read_bytes = header_read (psf, sixteen_bytes, sizeof (float)) ;
 1124|  41.7k|					if (psf->rwf_endian == SF_ENDIAN_BIG)
  ------------------
  |  Branch (1124:10): [True: 6.19k, False: 35.5k]
  ------------------
 1125|  6.19k|						store_float (floatptr, float32_be_read (sixteen_bytes)) ;
 1126|  35.5k|					else
 1127|  35.5k|						store_float (floatptr, float32_le_read (sixteen_bytes)) ;
 1128|  41.7k|					break ;
 1129|       |
 1130|    576|			case 'd' : /* double conversion */
  ------------------
  |  Branch (1130:4): [True: 576, False: 74.3M]
  ------------------
 1131|    576|					doubleptr = va_arg (argptr, double *) ;
 1132|    576|					store_double (doubleptr, 0.0) ;
 1133|    576|					read_bytes = header_read (psf, sixteen_bytes, sizeof (double)) ;
 1134|    576|					if (psf->rwf_endian == SF_ENDIAN_BIG)
  ------------------
  |  Branch (1134:10): [True: 54, False: 522]
  ------------------
 1135|     54|						store_double (doubleptr, double64_be_read (sixteen_bytes)) ;
 1136|    522|					else
 1137|    522|						store_double (doubleptr, double64_le_read (sixteen_bytes)) ;
 1138|    576|					break ;
 1139|       |
 1140|      0|			case 's' :
  ------------------
  |  Branch (1140:4): [True: 0, False: 74.3M]
  ------------------
 1141|      0|					psf_log_printf (psf, "Format conversion 's' not implemented yet.\n") ;
 1142|       |					/*
 1143|       |					strptr = va_arg (argptr, char *) ;
 1144|       |					size   = strlen (strptr) + 1 ;
 1145|       |					size  += (size & 1) ;
 1146|       |					longdata = H2LE_32 (size) ;
 1147|       |					get_int (psf, longdata) ;
 1148|       |					memcpy (&(psf->header.ptr [psf->header.indx]), strptr, size) ;
 1149|       |					psf->header.indx += size ;
 1150|       |					*/
 1151|      0|					break ;
 1152|       |
 1153|  1.30M|			case 'b' : /* Raw bytes */
  ------------------
  |  Branch (1153:4): [True: 1.30M, False: 73.0M]
  ------------------
 1154|  1.30M|					charptr = va_arg (argptr, char*) ;
 1155|  1.30M|					count = va_arg (argptr, size_t) ;
 1156|  1.30M|					memset (charptr, 0, count) ;
 1157|  1.30M|					read_bytes = header_read (psf, charptr, count) ;
 1158|  1.30M|					break ;
 1159|       |
 1160|    134|			case 'G' :
  ------------------
  |  Branch (1160:4): [True: 134, False: 74.3M]
  ------------------
 1161|    134|					charptr = va_arg (argptr, char*) ;
 1162|    134|					count = va_arg (argptr, size_t) ;
 1163|    134|					memset (charptr, 0, count) ;
 1164|       |
 1165|    134|					if (psf->header.indx + count >= psf->header.len && psf_bump_header_allocation (psf, count))
  ------------------
  |  Branch (1165:10): [True: 0, False: 134]
  |  Branch (1165:57): [True: 0, False: 0]
  ------------------
 1166|      0|						break ;
 1167|       |
 1168|    134|					read_bytes = header_gets (psf, charptr, count) ;
 1169|    134|					break ;
 1170|       |
 1171|      0|			case 'z' :
  ------------------
  |  Branch (1171:4): [True: 0, False: 74.3M]
  ------------------
 1172|      0|					psf_log_printf (psf, "Format conversion 'z' not implemented yet.\n") ;
 1173|       |					/*
 1174|       |					size    = va_arg (argptr, size_t) ;
 1175|       |					while (size)
 1176|       |					{	psf->header.ptr [psf->header.indx] = 0 ;
 1177|       |						psf->header.indx ++ ;
 1178|       |						size -- ;
 1179|       |						} ;
 1180|       |					*/
 1181|      0|					break ;
 1182|       |
 1183|  21.6k|			case 'p' :	/* Seek to position from start. */
  ------------------
  |  Branch (1183:4): [True: 21.6k, False: 74.3M]
  ------------------
 1184|  21.6k|					count = va_arg (argptr, size_t) ;
 1185|  21.6k|					header_seek (psf, count, SEEK_SET) ;
 1186|  21.6k|					byte_count = count ;
 1187|  21.6k|					break ;
 1188|       |
 1189|  11.2M|			case 'j' :	/* Seek to position from current position. */
  ------------------
  |  Branch (1189:4): [True: 11.2M, False: 63.0M]
  ------------------
 1190|  11.2M|					count = va_arg (argptr, size_t) ;
 1191|  11.2M|					header_seek (psf, count, SEEK_CUR) ;
 1192|  11.2M|					read_bytes = count ;
 1193|  11.2M|					break ;
 1194|       |
 1195|  1.75k|			case '!' : /* Clear buffer, forcing re-read. */
  ------------------
  |  Branch (1195:4): [True: 1.75k, False: 74.3M]
  ------------------
 1196|  1.75k|					psf->header.end = psf->header.indx = 0 ;
 1197|  1.75k|					break ;
 1198|       |
 1199|      0|			default :
  ------------------
  |  Branch (1199:4): [True: 0, False: 74.3M]
  ------------------
 1200|      0|				psf_log_printf (psf, "*** Invalid format specifier `%c'\n", c) ;
 1201|      0|				psf->error = SFE_INTERNAL ;
 1202|      0|				break ;
 1203|  74.3M|			} ;
 1204|       |
 1205|  74.3M|		if (read_bytes > 0 && byte_count > (INT_MAX - read_bytes))
  ------------------
  |  Branch (1205:7): [True: 46.9M, False: 27.4M]
  |  Branch (1205:25): [True: 3, False: 46.9M]
  ------------------
 1206|      3|		{	psf_log_printf (psf, "Header size exceeds INT_MAX. Aborting.", c) ;
 1207|      3|			psf->error = SFE_INTERNAL ;
 1208|      3|			break ;
 1209|      3|		} else
 1210|  74.3M|		{	byte_count += read_bytes ;
 1211|  74.3M|		} ;
 1212|       |
 1213|  74.3M|		} ;	/*end while*/
 1214|       |
 1215|  33.8M|	va_end (argptr) ;
 1216|       |
 1217|  33.8M|	return byte_count ;
 1218|  33.8M|} /* psf_binheader_readf */
psf_log_SF_INFO:
 1283|  1.15k|{	psf_log_printf (psf, "---------------------------------\n") ;
 1284|       |
 1285|  1.15k|	psf_log_printf (psf, " Sample rate :   %d\n", psf->sf.samplerate) ;
 1286|  1.15k|	if (psf->sf.frames == SF_COUNT_MAX)
  ------------------
  |  |  371|  1.15k|#define SF_COUNT_MAX	INT64_MAX
  ------------------
  |  Branch (1286:6): [True: 1, False: 1.15k]
  ------------------
 1287|      1|		psf_log_printf (psf, " Frames      :   unknown\n") ;
 1288|  1.15k|	else
 1289|  1.15k|		psf_log_printf (psf, " Frames      :   %D\n", psf->sf.frames) ;
 1290|  1.15k|	psf_log_printf (psf, " Channels    :   %d\n", psf->sf.channels) ;
 1291|       |
 1292|  1.15k|	psf_log_printf (psf, " Format      :   0x%X\n", psf->sf.format) ;
 1293|  1.15k|	psf_log_printf (psf, " Sections    :   %d\n", psf->sf.sections) ;
 1294|  1.15k|	psf_log_printf (psf, " Seekable    :   %s\n", psf->sf.seekable ? "TRUE" : "FALSE") ;
  ------------------
  |  Branch (1294:48): [True: 987, False: 170]
  ------------------
 1295|       |
 1296|  1.15k|	psf_log_printf (psf, "---------------------------------\n") ;
 1297|  1.15k|} /* psf_dump_SFINFO */
psf_isprint:
 1304|  72.9M|{	return (ch >= ' ' && ch <= '~') ;
  ------------------
  |  Branch (1304:11): [True: 69.1M, False: 3.81M]
  |  Branch (1304:24): [True: 69.1M, False: 10.6k]
  ------------------
 1305|  72.9M|} /* psf_isprint */
psf_strlcpy:
 1315|  35.4k|{	strncpy (dest, src, n - 1) ;
 1316|  35.4k|	dest [n - 1] = 0 ;
 1317|  35.4k|} /* psf_strlcpy */
psf_memset:
 1335|  2.20k|{	char	*ptr ;
 1336|  2.20k|	int 	setcount ;
 1337|       |
 1338|  2.20k|	ptr = (char *) s ;
 1339|       |
 1340|  4.40k|	while (len > 0)
  ------------------
  |  Branch (1340:9): [True: 2.20k, False: 2.20k]
  ------------------
 1341|  2.20k|	{	setcount = (len > 0x10000000) ? 0x10000000 : (int) len ;
  ------------------
  |  Branch (1341:15): [True: 0, False: 2.20k]
  ------------------
 1342|       |
 1343|  2.20k|		memset (ptr, c, setcount) ;
 1344|       |
 1345|  2.20k|		ptr += setcount ;
 1346|  2.20k|		len -= setcount ;
 1347|  2.20k|		} ;
 1348|       |
 1349|  2.20k|	return s ;
 1350|  2.20k|} /* psf_memset */
psf_cues_alloc:
 1372|  1.09k|{	SF_CUES *pcues = calloc (1, SF_CUES_VAR_SIZE (cue_count)) ;
  ------------------
  |  | 1365|  1.09k|#define SF_CUES_VAR_SIZE(count)	(sizeof (SF_CUES_0) + count * sizeof (SF_CUE_POINT))
  ------------------
 1373|  1.09k|	if (pcues)
  ------------------
  |  Branch (1373:6): [True: 1.09k, False: 0]
  ------------------
 1374|  1.09k|	{	pcues->cue_count = cue_count ;
 1375|  1.09k|		} ;
 1376|  1.09k|	return pcues ;
 1377|  1.09k|} /* psf_cues_alloc */
psf_instrument_alloc:
 1410|  1.85k|{	SF_INSTRUMENT *instr ;
 1411|       |
 1412|  1.85k|	instr = calloc (1, sizeof (SF_INSTRUMENT)) ;
 1413|       |
 1414|  1.85k|	if (instr == NULL)
  ------------------
  |  Branch (1414:6): [True: 0, False: 1.85k]
  ------------------
 1415|      0|		return NULL ;
 1416|       |
 1417|       |	/* Set non-zero default values. */
 1418|  1.85k|	instr->basenote = -1 ;
 1419|  1.85k|	instr->velocity_lo = -1 ;
 1420|  1.85k|	instr->velocity_hi = -1 ;
 1421|  1.85k|	instr->key_lo = -1 ;
 1422|  1.85k|	instr->key_hi = -1 ;
 1423|       |
 1424|  1.85k|	return instr ;
 1425|  1.85k|} /* psf_instrument_alloc */
psf_sanitize_string:
 1429|    254|{
 1430|    254|	do
 1431|   125k|	{
 1432|   125k|		len -- ;
 1433|   125k|		cptr [len] = psf_isprint (cptr [len]) ? cptr [len] : '.' ;
  ------------------
  |  Branch (1433:16): [True: 18.3k, False: 106k]
  ------------------
 1434|   125k|	}
 1435|   125k|	while (len > 0) ;
  ------------------
  |  Branch (1435:9): [True: 125k, False: 254]
  ------------------
 1436|    254|} /* psf_sanitize_string */
s_bitwidth_to_subformat:
 1489|  7.35k|{	static int array [] =
 1490|  7.35k|	{	SF_FORMAT_PCM_S8, SF_FORMAT_PCM_16, SF_FORMAT_PCM_24, SF_FORMAT_PCM_32
 1491|  7.35k|		} ;
 1492|       |
 1493|  7.35k|	if (bits < 8 || bits > 32)
  ------------------
  |  Branch (1493:6): [True: 1.27k, False: 6.08k]
  |  Branch (1493:18): [True: 3.41k, False: 2.67k]
  ------------------
 1494|  4.68k|		return 0 ;
 1495|       |
 1496|  2.67k|	return array [((bits + 7) / 8) - 1] ;
 1497|  7.35k|} /* bitwidth_to_subformat */
u_bitwidth_to_subformat:
 1501|    240|{	static int array [] =
 1502|    240|	{	SF_FORMAT_PCM_U8, SF_FORMAT_PCM_16, SF_FORMAT_PCM_24, SF_FORMAT_PCM_32
 1503|    240|		} ;
 1504|       |
 1505|    240|	if (bits < 8 || bits > 32)
  ------------------
  |  Branch (1505:6): [True: 12, False: 228]
  |  Branch (1505:18): [True: 100, False: 128]
  ------------------
 1506|    112|		return 0 ;
 1507|       |
 1508|    128|	return array [((bits + 7) / 8) - 1] ;
 1509|    240|} /* bitwidth_to_subformat */
psf_rand_int32:
 1519|  19.6k|{	static uint64_t value = 0 ;
 1520|  19.6k|	int k, count ;
 1521|       |
 1522|  19.6k|	if (value == 0)
  ------------------
  |  Branch (1522:6): [True: 1, False: 19.6k]
  ------------------
 1523|      1|	{
 1524|      1|#if HAVE_GETTIMEOFDAY
 1525|      1|		struct timeval tv ;
 1526|      1|		gettimeofday (&tv, NULL) ;
 1527|      1|		value = tv.tv_sec + tv.tv_usec ;
 1528|       |#else
 1529|       |		value = time (NULL) ;
 1530|       |#endif
 1531|      1|		} ;
 1532|       |
 1533|  19.6k|	count = 4 + (value & 7) ;
 1534|   176k|	for (k = 0 ; k < count ; k++)
  ------------------
  |  Branch (1534:15): [True: 157k, False: 19.6k]
  ------------------
 1535|   157k|		value = (11117 * value + 211231) & 0x7fffffff ;
 1536|       |
 1537|  19.6k|	return (int32_t) value ;
 1538|  19.6k|} /* psf_rand_int32 */
append_snprintf:
 1542|  1.05k|{	size_t len = strlen (dest) ;
 1543|       |
 1544|  1.05k|	if (len < maxlen)
  ------------------
  |  Branch (1544:6): [True: 1.05k, False: 0]
  ------------------
 1545|  1.05k|	{	va_list ap ;
 1546|       |
 1547|  1.05k|		va_start (ap, fmt) ;
 1548|  1.05k|		vsnprintf (dest + len, maxlen - len, fmt, ap) ;
 1549|  1.05k|		va_end (ap) ;
 1550|  1.05k|		} ;
 1551|       |
 1552|  1.05k|	return ;
 1553|  1.05k|} /* append_snprintf */
psf_decode_frame_count:
 1593|    267|{	sf_count_t count, readlen, total = 0 ;
 1594|    267|	BUF_UNION	ubuf ;
 1595|       |
 1596|       |	/* If we're reading from a pipe or the file is too long, just return SF_COUNT_MAX. */
 1597|    267|	if (psf_is_pipe (psf) || psf->datalength > 0x1000000)
  ------------------
  |  Branch (1597:6): [True: 0, False: 267]
  |  Branch (1597:27): [True: 0, False: 267]
  ------------------
 1598|      0|		return SF_COUNT_MAX ;
  ------------------
  |  |  371|      0|#define SF_COUNT_MAX	INT64_MAX
  ------------------
 1599|       |
 1600|    267|	psf_fseek (psf, psf->dataoffset, SEEK_SET) ;
 1601|       |
 1602|    267|	readlen = ARRAY_LEN (ubuf.ibuf) / psf->sf.channels ;
  ------------------
  |  |   88|    267|#define		ARRAY_LEN(x)	((int) (sizeof (x) / sizeof ((x) [0])))
  ------------------
 1603|    267|	readlen *= psf->sf.channels ;
 1604|       |
 1605|  3.53k|	while ((count = psf->read_int (psf, ubuf.ibuf, readlen)) > 0)
  ------------------
  |  Branch (1605:9): [True: 3.27k, False: 267]
  ------------------
 1606|  3.27k|		total += count ;
 1607|       |
 1608|    267|	psf_fseek (psf, psf->dataoffset, SEEK_SET) ;
 1609|       |
 1610|    267|	return total / psf->sf.channels ;
 1611|    267|} /* psf_decode_frame_count */
common.c:log_putchar:
  104|  1.09G|{	if (psf->parselog.indx < SIGNED_SIZEOF (psf->parselog.buf) - 1)
  ------------------
  |  |   86|  1.09G|#define		SIGNED_SIZEOF(x)	((int) sizeof (x))
  ------------------
  |  Branch (104:7): [True: 10.0M, False: 1.08G]
  ------------------
  105|  10.0M|	{	psf->parselog.buf [psf->parselog.indx++] = ch ;
  106|  10.0M|		psf->parselog.buf [psf->parselog.indx] = 0 ;
  107|  10.0M|		} ;
  108|  1.09G|	return ;
  109|  1.09G|} /* log_putchar */
common.c:psf_bump_header_allocation:
   67|  92.7k|{
   68|  92.7k|	sf_count_t newlen, smallest = INITIAL_HEADER_SIZE ;
  ------------------
  |  |   46|  92.7k|#define	INITIAL_HEADER_SIZE	256
  ------------------
   69|  92.7k|	void * ptr ;
   70|       |
   71|  92.7k|	newlen = (needed > psf->header.len) ? 2 * SF_MAX (needed, smallest) : 2 * psf->header.len ;
  ------------------
  |  |   90|  4.38k|#define		SF_MAX(a, b)	((a) > (b) ? (a) : (b))
  |  |  ------------------
  |  |  |  Branch (90:24): [True: 4.38k, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (71:11): [True: 4.38k, False: 88.3k]
  ------------------
   72|       |
   73|  92.7k|	if (newlen > 100 * 1024)
  ------------------
  |  Branch (73:6): [True: 86.7k, False: 5.99k]
  ------------------
   74|  86.7k|	{	psf_log_printf (psf, "Request for header allocation of %D denied.\n", newlen) ;
   75|  86.7k|		return 1 ;
   76|  86.7k|		}
   77|       |
   78|  5.99k|	if ((ptr = realloc (psf->header.ptr, newlen)) == NULL)
  ------------------
  |  Branch (78:6): [True: 0, False: 5.99k]
  ------------------
   79|      0|	{	psf_log_printf (psf, "realloc (%p, %D) failed\n", psf->header.ptr, newlen) ;
   80|      0|		psf->error = SFE_MALLOC_FAILED ;
   81|      0|		return 1 ;
   82|  5.99k|		} ;
   83|       |
   84|       |	/* Always zero-out new header memory to avoid un-initializer memory accesses. */
   85|  5.99k|	if (newlen > psf->header.len)
  ------------------
  |  Branch (85:6): [True: 5.99k, False: 0]
  ------------------
   86|  5.99k|		memset ((char *) ptr + psf->header.len, 0, newlen - psf->header.len) ;
   87|       |
   88|  5.99k|	psf->header.ptr = ptr ;
   89|  5.99k|	psf->header.len = newlen ;
   90|  5.99k|	return 0 ;
   91|  5.99k|} /* psf_bump_header_allocation */
common.c:store_uint:
  997|  79.2M|{	memcpy (ptr, &value, sizeof (value)) ;
  998|  79.2M|} /* store_uint */
common.c:header_read:
  873|  46.9M|{	int count = 0 ;
  874|       |
  875|  46.9M|	if (psf->header.indx + bytes >= psf->header.len && psf_bump_header_allocation (psf, bytes))
  ------------------
  |  Branch (875:6): [True: 2.37k, False: 46.9M]
  |  Branch (875:53): [True: 1.25k, False: 1.12k]
  ------------------
  876|  1.25k|		return count ;
  877|       |
  878|  46.9M|	if (psf->header.indx + bytes > psf->header.end)
  ------------------
  |  Branch (878:6): [True: 4.86M, False: 42.0M]
  ------------------
  879|  4.86M|	{	count = psf_fread (psf->header.ptr + psf->header.end, 1, bytes - (psf->header.end - psf->header.indx), psf) ;
  880|  4.86M|		if (count != bytes - (int) (psf->header.end - psf->header.indx))
  ------------------
  |  Branch (880:7): [True: 2.20M, False: 2.66M]
  ------------------
  881|  2.20M|		{	psf_log_printf (psf, "Error : psf_fread returned short count.\n") ;
  882|  2.20M|			return count ;
  883|  2.66M|			} ;
  884|  2.66M|		psf->header.end += count ;
  885|  44.6M|		} ;
  886|       |
  887|  44.6M|	memcpy (ptr, psf->header.ptr + psf->header.indx, bytes) ;
  888|  44.6M|	psf->header.indx += bytes ;
  889|       |
  890|  44.6M|	return bytes ;
  891|  46.9M|} /* header_read */
common.c:store_ushort:
 1002|  5.69M|{	memcpy (ptr, &value, sizeof (value)) ;
 1003|  5.69M|} /* store_ushort */
common.c:store_count:
 1007|   248k|{	memcpy (ptr, &value, sizeof (value)) ;
 1008|   248k|} /* store_count */
common.c:store_float:
 1012|  83.5k|{	memcpy (ptr, &value, sizeof (value)) ;
 1013|  83.5k|} /* store_float */
common.c:store_double:
 1017|  1.15k|{	memcpy (ptr, &value, sizeof (value)) ;
 1018|  1.15k|} /* store_double */
common.c:header_gets:
  964|    134|{	int		k ;
  965|       |
  966|    134|	if (psf->header.indx + bufsize >= psf->header.len && psf_bump_header_allocation (psf, bufsize))
  ------------------
  |  Branch (966:6): [True: 0, False: 134]
  |  Branch (966:55): [True: 0, False: 0]
  ------------------
  967|      0|		return 0 ;
  968|       |
  969|  3.22k|	for (k = 0 ; k < bufsize - 1 ; k++)
  ------------------
  |  Branch (969:15): [True: 3.13k, False: 91]
  ------------------
  970|  3.13k|	{	if (psf->header.indx < psf->header.end)
  ------------------
  |  Branch (970:8): [True: 920, False: 2.21k]
  ------------------
  971|    920|		{	ptr [k] = psf->header.ptr [psf->header.indx] ;
  972|    920|			psf->header.indx ++ ;
  973|    920|			}
  974|  2.21k|		else
  975|  2.21k|		{	psf->header.end += psf_fread (psf->header.ptr + psf->header.end, 1, 1, psf) ;
  976|  2.21k|			ptr [k] = psf->header.ptr [psf->header.indx] ;
  977|  2.21k|			psf->header.indx = psf->header.end ;
  978|  2.21k|			} ;
  979|       |
  980|  3.13k|		if (ptr [k] == '\n')
  ------------------
  |  Branch (980:7): [True: 43, False: 3.09k]
  ------------------
  981|     43|			break ;
  982|  3.13k|		} ;
  983|       |
  984|    134|	ptr [k] = 0 ;
  985|       |
  986|    134|	return k ;
  987|    134|} /* header_gets */
common.c:header_seek:
  895|  11.3M|{
  896|  11.3M|	switch (whence)
  897|  11.3M|	{	case SEEK_SET :
  ------------------
  |  Branch (897:4): [True: 21.6k, False: 11.2M]
  ------------------
  898|  21.6k|			if (psf->header.indx + position >= psf->header.len)
  ------------------
  |  Branch (898:8): [True: 237, False: 21.4k]
  ------------------
  899|    237|				psf_bump_header_allocation (psf, position) ;
  900|  21.6k|			if (position > psf->header.len)
  ------------------
  |  Branch (900:8): [True: 6, False: 21.6k]
  ------------------
  901|      6|			{	/* Too much header to cache so just seek instead. */
  902|      6|				psf->header.indx = psf->header.end = 0 ;
  903|      6|				psf_fseek (psf, position, whence) ;
  904|      6|				return ;
  905|  21.6k|				} ;
  906|  21.6k|			if (position > psf->header.end)
  ------------------
  |  Branch (906:8): [True: 786, False: 20.8k]
  ------------------
  907|    786|				psf->header.end += psf_fread (psf->header.ptr + psf->header.end, 1, position - psf->header.end, psf) ;
  908|  21.6k|			psf->header.indx = position ;
  909|  21.6k|			break ;
  910|       |
  911|  11.2M|		case SEEK_CUR :
  ------------------
  |  Branch (911:3): [True: 11.2M, False: 21.6k]
  ------------------
  912|  11.2M|			if (psf->header.indx + position >= psf->header.len)
  ------------------
  |  Branch (912:8): [True: 6.83k, False: 11.2M]
  ------------------
  913|  6.83k|				psf_bump_header_allocation (psf, position) ;
  914|       |
  915|  11.2M|			if (psf->header.indx + position < 0)
  ------------------
  |  Branch (915:8): [True: 5.85M, False: 5.43M]
  ------------------
  916|  5.85M|				break ;
  917|       |
  918|  5.43M|			if (psf->header.indx >= psf->header.len)
  ------------------
  |  Branch (918:8): [True: 0, False: 5.43M]
  ------------------
  919|      0|			{	psf_fseek (psf, position, whence) ;
  920|      0|				return ;
  921|  5.43M|				} ;
  922|       |
  923|  5.43M|			if (psf->header.indx + position <= psf->header.end)
  ------------------
  |  Branch (923:8): [True: 5.11M, False: 323k]
  ------------------
  924|  5.11M|			{	psf->header.indx += position ;
  925|  5.11M|				break ;
  926|  5.11M|				} ;
  927|       |
  928|   323k|			if (psf->header.indx + position > psf->header.len)
  ------------------
  |  Branch (928:8): [True: 5.39k, False: 317k]
  ------------------
  929|  5.39k|			{	/* Need to jump this without caching it. */
  930|  5.39k|				position -= (psf->header.end - psf->header.indx) ;
  931|  5.39k|				psf->header.indx = psf->header.end ;
  932|  5.39k|				if (psf->is_pipe)
  ------------------
  |  Branch (932:9): [True: 0, False: 5.39k]
  ------------------
  933|      0|				{
  934|       |					/* seeking is not supported on pipe input, so we read instead */
  935|      0|					size_t skip = position ;
  936|      0|					while (skip)
  ------------------
  |  Branch (936:13): [True: 0, False: 0]
  ------------------
  937|      0|					{	char junk [16 * 1024] ;
  938|      0|						size_t to_skip = SF_MIN (skip, sizeof (junk)) ;
  ------------------
  |  |   91|      0|#define		SF_MIN(a, b)	((a) < (b) ? (a) : (b))
  |  |  ------------------
  |  |  |  Branch (91:24): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  939|      0|						psf_fread (junk, 1, to_skip, psf) ;
  940|      0|						skip -= to_skip ;
  941|      0|						}
  942|      0|					}
  943|  5.39k|				else
  944|  5.39k|				{	psf_fseek (psf, position, SEEK_CUR) ;
  945|  5.39k|					}
  946|  5.39k|				break ;
  947|   317k|				} ;
  948|       |
  949|   317k|			psf->header.end += psf_fread (psf->header.ptr + psf->header.end, 1, position - (psf->header.end - psf->header.indx), psf) ;
  950|   317k|			psf->header.indx = psf->header.end ;
  951|   317k|			break ;
  952|       |
  953|      0|		case SEEK_END :
  ------------------
  |  Branch (953:3): [True: 0, False: 11.3M]
  ------------------
  954|      0|		default :
  ------------------
  |  Branch (954:3): [True: 0, False: 11.3M]
  ------------------
  955|      0|			psf_log_printf (psf, "Bad whence param in header_seek().\n") ;
  956|      0|			break ;
  957|  11.3M|		} ;
  958|       |
  959|  11.3M|	return ;
  960|  11.3M|} /* header_seek */

aiff.c:peak_info_calloc:
  226|    608|{	return calloc (1, sizeof (PEAK_INFO) + channels * sizeof (PEAK_POS)) ;
  227|    608|} /* peak_info_calloc */
aiff.c:psf_cues_points:
  983|    488|{	return cues->cue_points ;
  984|    488|} /* psf_cues_points */
aiff.c:make_size_t:
  272|  2.95k|{	return (size_t) x ;
  273|  2.95k|} /* make_size_t */
avr.c:arith_shift_left:
 1080|    106|{	return (int32_t) (((uint32_t) x) << shift) ;
 1081|    106|} /* arith_shift_left */
caf.c:peak_info_calloc:
  226|    318|{	return calloc (1, sizeof (PEAK_INFO) + channels * sizeof (PEAK_POS)) ;
  227|    318|} /* peak_info_calloc */
caf.c:psf_lrint:
  958|  2.27k|{
  959|  2.27k|	#ifdef USE_SSE2
  960|  2.27k|		return _mm_cvtsd_si32 (_mm_load_sd (&x)) ;
  961|       |	#else
  962|       |		return lrint (x) ;
  963|       |	#endif
  964|  2.27k|} /* psf_lrintf */
ircam.c:psf_lrintf:
  949|    339|{
  950|    339|	#ifdef USE_SSE2
  951|    339|		return _mm_cvtss_si32 (_mm_load_ss (&x)) ;
  952|       |	#else
  953|       |		return lrintf (x) ;
  954|       |	#endif
  955|    339|} /* psf_lrintf */
mat4.c:psf_lrint:
  958|    573|{
  959|    573|	#ifdef USE_SSE2
  960|    573|		return _mm_cvtsd_si32 (_mm_load_sd (&x)) ;
  961|       |	#else
  962|       |		return lrint (x) ;
  963|       |	#endif
  964|    573|} /* psf_lrintf */
mat5.c:psf_lrint:
  958|      3|{
  959|      3|	#ifdef USE_SSE2
  960|      3|		return _mm_cvtsd_si32 (_mm_load_sd (&x)) ;
  961|       |	#else
  962|       |		return lrint (x) ;
  963|       |	#endif
  964|      3|} /* psf_lrintf */
sds.c:arith_shift_left:
 1080|   104M|{	return (int32_t) (((uint32_t) x) << shift) ;
 1081|   104M|} /* arith_shift_left */
wavlike.c:make_size_t:
  272|  2.01k|{	return (size_t) x ;
  273|  2.01k|} /* make_size_t */
wavlike.c:psf_cues_points:
  983|    755|{	return cues->cue_points ;
  984|    755|} /* psf_cues_points */
wavlike.c:peak_info_calloc:
  226|  11.5k|{	return calloc (1, sizeof (PEAK_INFO) + channels * sizeof (PEAK_POS)) ;
  227|  11.5k|} /* peak_info_calloc */
wav.c:psf_cues_points:
  983|    604|{	return cues->cue_points ;
  984|    604|} /* psf_cues_points */
xi.c:arith_shift_left:
 1080|    769|{	return (int32_t) (((uint32_t) x) << shift) ;
 1081|    769|} /* arith_shift_left */
mpc2k.c:make_size_t:
  272|     16|{	return (size_t) x ;
  273|     16|} /* make_size_t */
dwvw.c:arith_shift_left:
 1080|  14.8M|{	return (int32_t) (((uint32_t) x) << shift) ;
 1081|  14.8M|} /* arith_shift_left */

double64_init:
   92|    344|{	static int double64_caps ;
   93|       |
   94|    344|	if (psf->sf.channels < 1 || psf->sf.channels > SF_MAX_CHANNELS)
  ------------------
  |  |   95|    318|#define		SF_MAX_CHANNELS		1024
  ------------------
  |  Branch (94:6): [True: 26, False: 318]
  |  Branch (94:30): [True: 12, False: 306]
  ------------------
   95|     38|	{	psf_log_printf (psf, "double64_init : internal error : channels = %d\n", psf->sf.channels) ;
   96|     38|		return SFE_INTERNAL ;
   97|    306|		} ;
   98|       |
   99|    306|	double64_caps = double64_get_capability (psf) ;
  100|       |
  101|    306|	psf->blockwidth = sizeof (double) * psf->sf.channels ;
  102|       |
  103|    306|	if (psf->file.mode == SFM_READ || psf->file.mode == SFM_RDWR)
  ------------------
  |  Branch (103:6): [True: 306, False: 0]
  |  Branch (103:36): [True: 0, False: 0]
  ------------------
  104|    306|	{	switch (psf->endian + double64_caps)
  105|    306|		{	case (SF_ENDIAN_BIG + DOUBLE_CAN_RW_BE) :
  ------------------
  |  Branch (105:5): [True: 0, False: 306]
  ------------------
  106|      0|					psf->data_endswap = SF_FALSE ;
  107|      0|					psf->read_short		= host_read_d2s ;
  108|      0|					psf->read_int		= host_read_d2i ;
  109|      0|					psf->read_float		= host_read_d2f ;
  110|      0|					psf->read_double	= host_read_d ;
  111|      0|					break ;
  112|       |
  113|    189|			case (SF_ENDIAN_LITTLE + DOUBLE_CAN_RW_LE) :
  ------------------
  |  Branch (113:4): [True: 189, False: 117]
  ------------------
  114|    189|					psf->data_endswap = SF_FALSE ;
  115|    189|					psf->read_short		= host_read_d2s ;
  116|    189|					psf->read_int		= host_read_d2i ;
  117|    189|					psf->read_float		= host_read_d2f ;
  118|    189|					psf->read_double	= host_read_d ;
  119|    189|					break ;
  120|       |
  121|    117|			case (SF_ENDIAN_BIG + DOUBLE_CAN_RW_LE) :
  ------------------
  |  Branch (121:4): [True: 117, False: 189]
  ------------------
  122|    117|					psf->data_endswap = SF_TRUE ;
  123|    117|					psf->read_short		= host_read_d2s ;
  124|    117|					psf->read_int		= host_read_d2i ;
  125|    117|					psf->read_float		= host_read_d2f ;
  126|    117|					psf->read_double	= host_read_d ;
  127|    117|					break ;
  128|       |
  129|      0|			case (SF_ENDIAN_LITTLE + DOUBLE_CAN_RW_BE) :
  ------------------
  |  Branch (129:4): [True: 0, False: 306]
  ------------------
  130|      0|					psf->data_endswap = SF_TRUE ;
  131|      0|					psf->read_short		= host_read_d2s ;
  132|      0|					psf->read_int		= host_read_d2i ;
  133|      0|					psf->read_float		= host_read_d2f ;
  134|      0|					psf->read_double	= host_read_d ;
  135|      0|					break ;
  136|       |
  137|       |			/* When the CPU is not IEEE compatible. */
  138|      0|			case (SF_ENDIAN_BIG + DOUBLE_BROKEN_BE) :
  ------------------
  |  Branch (138:4): [True: 0, False: 306]
  ------------------
  139|      0|					psf->data_endswap = SF_FALSE ;
  140|      0|					psf->read_short		= replace_read_d2s ;
  141|      0|					psf->read_int		= replace_read_d2i ;
  142|      0|					psf->read_float		= replace_read_d2f ;
  143|      0|					psf->read_double	= replace_read_d ;
  144|      0|					break ;
  145|       |
  146|      0|			case (SF_ENDIAN_LITTLE + DOUBLE_BROKEN_LE) :
  ------------------
  |  Branch (146:4): [True: 0, False: 306]
  ------------------
  147|      0|					psf->data_endswap = SF_FALSE ;
  148|      0|					psf->read_short		= replace_read_d2s ;
  149|      0|					psf->read_int		= replace_read_d2i ;
  150|      0|					psf->read_float		= replace_read_d2f ;
  151|      0|					psf->read_double	= replace_read_d ;
  152|      0|					break ;
  153|       |
  154|      0|			case (SF_ENDIAN_BIG + DOUBLE_BROKEN_LE) :
  ------------------
  |  Branch (154:4): [True: 0, False: 306]
  ------------------
  155|      0|					psf->data_endswap = SF_TRUE ;
  156|      0|					psf->read_short		= replace_read_d2s ;
  157|      0|					psf->read_int		= replace_read_d2i ;
  158|      0|					psf->read_float		= replace_read_d2f ;
  159|      0|					psf->read_double	= replace_read_d ;
  160|      0|					break ;
  161|       |
  162|      0|			case (SF_ENDIAN_LITTLE + DOUBLE_BROKEN_BE) :
  ------------------
  |  Branch (162:4): [True: 0, False: 306]
  ------------------
  163|      0|					psf->data_endswap = SF_TRUE ;
  164|      0|					psf->read_short		= replace_read_d2s ;
  165|      0|					psf->read_int		= replace_read_d2i ;
  166|      0|					psf->read_float		= replace_read_d2f ;
  167|      0|					psf->read_double	= replace_read_d ;
  168|      0|					break ;
  169|       |
  170|      0|			default : break ;
  ------------------
  |  Branch (170:4): [True: 0, False: 306]
  ------------------
  171|    306|			} ;
  172|    306|		} ;
  173|       |
  174|    306|	if (psf->file.mode == SFM_WRITE || psf->file.mode == SFM_RDWR)
  ------------------
  |  Branch (174:6): [True: 0, False: 306]
  |  Branch (174:37): [True: 0, False: 306]
  ------------------
  175|      0|	{	switch (psf->endian + double64_caps)
  176|      0|		{	case (SF_ENDIAN_LITTLE + DOUBLE_CAN_RW_LE) :
  ------------------
  |  Branch (176:5): [True: 0, False: 0]
  ------------------
  177|      0|					psf->data_endswap = SF_FALSE ;
  178|      0|					psf->write_short	= host_write_s2d ;
  179|      0|					psf->write_int		= host_write_i2d ;
  180|      0|					psf->write_float	= host_write_f2d ;
  181|      0|					psf->write_double	= host_write_d ;
  182|      0|					break ;
  183|       |
  184|      0|			case (SF_ENDIAN_BIG + DOUBLE_CAN_RW_BE) :
  ------------------
  |  Branch (184:4): [True: 0, False: 0]
  ------------------
  185|      0|					psf->data_endswap = SF_FALSE ;
  186|      0|					psf->write_short	= host_write_s2d ;
  187|      0|					psf->write_int		= host_write_i2d ;
  188|      0|					psf->write_float	= host_write_f2d ;
  189|      0|					psf->write_double	= host_write_d ;
  190|      0|					break ;
  191|       |
  192|      0|			case (SF_ENDIAN_BIG + DOUBLE_CAN_RW_LE) :
  ------------------
  |  Branch (192:4): [True: 0, False: 0]
  ------------------
  193|      0|					psf->data_endswap = SF_TRUE ;
  194|      0|					psf->write_short	= host_write_s2d ;
  195|      0|					psf->write_int		= host_write_i2d ;
  196|      0|					psf->write_float	= host_write_f2d ;
  197|      0|					psf->write_double	= host_write_d ;
  198|      0|					break ;
  199|       |
  200|      0|			case (SF_ENDIAN_LITTLE + DOUBLE_CAN_RW_BE) :
  ------------------
  |  Branch (200:4): [True: 0, False: 0]
  ------------------
  201|      0|					psf->data_endswap = SF_TRUE ;
  202|      0|					psf->write_short	= host_write_s2d ;
  203|      0|					psf->write_int		= host_write_i2d ;
  204|      0|					psf->write_float	= host_write_f2d ;
  205|      0|					psf->write_double	= host_write_d ;
  206|      0|					break ;
  207|       |
  208|       |			/* When the CPU is not IEEE compatible. */
  209|      0|			case (SF_ENDIAN_LITTLE + DOUBLE_BROKEN_LE) :
  ------------------
  |  Branch (209:4): [True: 0, False: 0]
  ------------------
  210|      0|					psf->data_endswap = SF_FALSE ;
  211|      0|					psf->write_short	= replace_write_s2d ;
  212|      0|					psf->write_int		= replace_write_i2d ;
  213|      0|					psf->write_float	= replace_write_f2d ;
  214|      0|					psf->write_double	= replace_write_d ;
  215|      0|					break ;
  216|       |
  217|      0|			case (SF_ENDIAN_BIG + DOUBLE_BROKEN_BE) :
  ------------------
  |  Branch (217:4): [True: 0, False: 0]
  ------------------
  218|      0|					psf->data_endswap = SF_FALSE ;
  219|      0|					psf->write_short	= replace_write_s2d ;
  220|      0|					psf->write_int		= replace_write_i2d ;
  221|      0|					psf->write_float	= replace_write_f2d ;
  222|      0|					psf->write_double	= replace_write_d ;
  223|      0|					break ;
  224|       |
  225|      0|			case (SF_ENDIAN_BIG + DOUBLE_BROKEN_LE) :
  ------------------
  |  Branch (225:4): [True: 0, False: 0]
  ------------------
  226|      0|					psf->data_endswap = SF_TRUE ;
  227|      0|					psf->write_short	= replace_write_s2d ;
  228|      0|					psf->write_int		= replace_write_i2d ;
  229|      0|					psf->write_float	= replace_write_f2d ;
  230|      0|					psf->write_double	= replace_write_d ;
  231|      0|					break ;
  232|       |
  233|      0|			case (SF_ENDIAN_LITTLE + DOUBLE_BROKEN_BE) :
  ------------------
  |  Branch (233:4): [True: 0, False: 0]
  ------------------
  234|      0|					psf->data_endswap = SF_TRUE ;
  235|      0|					psf->write_short	= replace_write_s2d ;
  236|      0|					psf->write_int		= replace_write_i2d ;
  237|      0|					psf->write_float	= replace_write_f2d ;
  238|      0|					psf->write_double	= replace_write_d ;
  239|      0|					break ;
  240|       |
  241|      0|			default : break ;
  ------------------
  |  Branch (241:4): [True: 0, False: 0]
  ------------------
  242|      0|			} ;
  243|    306|		} ;
  244|       |
  245|    306|	if (psf->filelength > psf->dataoffset)
  ------------------
  |  Branch (245:6): [True: 192, False: 114]
  ------------------
  246|    192|	{	psf->datalength = (psf->dataend > 0) ? psf->dataend - psf->dataoffset :
  ------------------
  |  Branch (246:22): [True: 4, False: 188]
  ------------------
  247|    192|							psf->filelength - psf->dataoffset ;
  248|    192|		}
  249|    114|	else
  250|    114|		psf->datalength = 0 ;
  251|       |
  252|    306|	psf->sf.frames = psf->datalength / psf->blockwidth ;
  253|       |
  254|    306|	return 0 ;
  255|    306|} /* double64_init */
double64_be_read:
  285|  2.40k|{	int		exponent, negative, upper, lower ;
  286|  2.40k|	double	dvalue ;
  287|       |
  288|  2.40k|	negative = (cptr [0] & 0x80) ? 1 : 0 ;
  ------------------
  |  Branch (288:13): [True: 306, False: 2.09k]
  ------------------
  289|  2.40k|	exponent = ((cptr [0] & 0x7F) << 4) | ((cptr [1] >> 4) & 0xF) ;
  290|       |
  291|       |	/* Might not have a 64 bit long, so load the mantissa into a double. */
  292|  2.40k|	upper = (((cptr [1] & 0xF) << 24) | (cptr [2] << 16) | (cptr [3] << 8) | cptr [4]) ;
  293|  2.40k|	lower = (cptr [5] << 16) | (cptr [6] << 8) | cptr [7] ;
  294|       |
  295|  2.40k|	if (exponent == 0 && upper == 0 && lower == 0)
  ------------------
  |  Branch (295:6): [True: 311, False: 2.08k]
  |  Branch (295:23): [True: 167, False: 144]
  |  Branch (295:37): [True: 155, False: 12]
  ------------------
  296|    155|		return 0.0 ;
  297|       |
  298|  2.24k|	dvalue = upper + lower / ((double) 0x1000000) ;
  299|  2.24k|	dvalue += 0x10000000 ;
  300|       |
  301|  2.24k|	exponent = exponent - 0x3FF ;
  302|       |
  303|  2.24k|	dvalue = dvalue / ((double) 0x10000000) ;
  304|       |
  305|  2.24k|	if (negative)
  ------------------
  |  Branch (305:6): [True: 306, False: 1.93k]
  ------------------
  306|    306|		dvalue *= -1 ;
  307|       |
  308|  2.24k|	if (exponent > 0)
  ------------------
  |  Branch (308:6): [True: 1.67k, False: 572]
  ------------------
  309|  1.67k|		dvalue *= pow (2.0, exponent) ;
  310|    572|	else if (exponent < 0)
  ------------------
  |  Branch (310:11): [True: 541, False: 31]
  ------------------
  311|    541|		dvalue /= pow (2.0, abs (exponent)) ;
  312|       |
  313|  2.24k|	return dvalue ;
  314|  2.40k|} /* double64_be_read */
double64_le_read:
  318|    522|{	int		exponent, negative, upper, lower ;
  319|    522|	double	dvalue ;
  320|       |
  321|    522|	negative = (cptr [7] & 0x80) ? 1 : 0 ;
  ------------------
  |  Branch (321:13): [True: 137, False: 385]
  ------------------
  322|    522|	exponent = ((cptr [7] & 0x7F) << 4) | ((cptr [6] >> 4) & 0xF) ;
  323|       |
  324|       |	/* Might not have a 64 bit long, so load the mantissa into a double. */
  325|    522|	upper = ((cptr [6] & 0xF) << 24) | (cptr [5] << 16) | (cptr [4] << 8) | cptr [3] ;
  326|    522|	lower = (cptr [2] << 16) | (cptr [1] << 8) | cptr [0] ;
  327|       |
  328|    522|	if (exponent == 0 && upper == 0 && lower == 0)
  ------------------
  |  Branch (328:6): [True: 259, False: 263]
  |  Branch (328:23): [True: 132, False: 127]
  |  Branch (328:37): [True: 75, False: 57]
  ------------------
  329|     75|		return 0.0 ;
  330|       |
  331|    447|	dvalue = upper + lower / ((double) 0x1000000) ;
  332|    447|	dvalue += 0x10000000 ;
  333|       |
  334|    447|	exponent = exponent - 0x3FF ;
  335|       |
  336|    447|	dvalue = dvalue / ((double) 0x10000000) ;
  337|       |
  338|    447|	if (negative)
  ------------------
  |  Branch (338:6): [True: 137, False: 310]
  ------------------
  339|    137|		dvalue *= -1 ;
  340|       |
  341|    447|	if (exponent > 0)
  ------------------
  |  Branch (341:6): [True: 133, False: 314]
  ------------------
  342|    133|		dvalue *= pow (2.0, exponent) ;
  343|    314|	else if (exponent < 0)
  ------------------
  |  Branch (343:11): [True: 309, False: 5]
  ------------------
  344|    309|		dvalue /= pow (2.0, abs (exponent)) ;
  345|       |
  346|    447|	return dvalue ;
  347|    522|} /* double64_le_read */
double64.c:double64_get_capability:
  459|    306|{	union
  460|    306|	{	double			d ;
  461|    306|		unsigned char	c [8] ;
  462|    306|	} data ;
  463|       |
  464|    306|	data.d = 1.234567890123456789 ; /* Some arbitrary value. */
  465|       |
  466|    306|	if (! psf->ieee_replace)
  ------------------
  |  Branch (466:6): [True: 306, False: 0]
  ------------------
  467|    306|	{	/* If this test is true ints and floats are compatible and little endian. */
  468|    306|		if (data.c [0] == 0xfb && data.c [1] == 0x59 && data.c [2] == 0x8c && data.c [3] == 0x42 &&
  ------------------
  |  Branch (468:7): [True: 306, False: 0]
  |  Branch (468:29): [True: 306, False: 0]
  |  Branch (468:51): [True: 306, False: 0]
  |  Branch (468:73): [True: 306, False: 0]
  ------------------
  469|    306|			data.c [4] == 0xca && data.c [5] == 0xc0 && data.c [6] == 0xf3 && data.c [7] == 0x3f)
  ------------------
  |  Branch (469:4): [True: 306, False: 0]
  |  Branch (469:26): [True: 306, False: 0]
  |  Branch (469:48): [True: 306, False: 0]
  |  Branch (469:70): [True: 306, False: 0]
  ------------------
  470|    306|			return DOUBLE_CAN_RW_LE ;
  471|       |
  472|       |		/* If this test is true ints and floats are compatible and big endian. */
  473|      0|		if (data.c [0] == 0x3f && data.c [1] == 0xf3 && data.c [2] == 0xc0 && data.c [3] == 0xca &&
  ------------------
  |  Branch (473:7): [True: 0, False: 0]
  |  Branch (473:29): [True: 0, False: 0]
  |  Branch (473:51): [True: 0, False: 0]
  |  Branch (473:73): [True: 0, False: 0]
  ------------------
  474|      0|			data.c [4] == 0x42 && data.c [5] == 0x8c && data.c [6] == 0x59 && data.c [7] == 0xfb)
  ------------------
  |  Branch (474:4): [True: 0, False: 0]
  |  Branch (474:26): [True: 0, False: 0]
  |  Branch (474:48): [True: 0, False: 0]
  |  Branch (474:70): [True: 0, False: 0]
  ------------------
  475|      0|			return DOUBLE_CAN_RW_BE ;
  476|      0|		} ;
  477|       |
  478|       |	/* Doubles are broken. Don't expect reading or writing to be fast. */
  479|      0|	psf_log_printf (psf, "Using IEEE replacement code for double.\n") ;
  480|       |
  481|      0|	return (CPU_IS_LITTLE_ENDIAN) ? DOUBLE_BROKEN_LE : DOUBLE_BROKEN_BE ;
  ------------------
  |  |   14|      0|#define CPU_IS_LITTLE_ENDIAN 1
  ------------------
  |  Branch (481:9): [True: 0, Folded]
  ------------------
  482|    306|} /* double64_get_capability */
double64.c:host_read_d2f:
  622|    818|{	BUF_UNION	ubuf ;
  623|    818|	int			bufferlen, readcount ;
  624|    818|	sf_count_t	total = 0 ;
  625|       |
  626|    818|	bufferlen = ARRAY_LEN (ubuf.dbuf) ;
  ------------------
  |  |   88|    818|#define		ARRAY_LEN(x)	((int) (sizeof (x) / sizeof ((x) [0])))
  ------------------
  627|       |
  628|  1.60k|	while (len > 0)
  ------------------
  |  Branch (628:9): [True: 818, False: 785]
  ------------------
  629|    818|	{	if (len < bufferlen)
  ------------------
  |  Branch (629:8): [True: 750, False: 68]
  ------------------
  630|    750|			bufferlen = (int) len ;
  631|    818|		readcount = (int) psf_fread (ubuf.dbuf, sizeof (double), bufferlen, psf) ;
  632|       |
  633|    818|		if (psf->data_endswap == SF_TRUE)
  ------------------
  |  Branch (633:7): [True: 406, False: 412]
  ------------------
  634|    406|			endswap_double_array (ubuf.dbuf, readcount) ;
  635|       |
  636|    818|		d2f_array (ubuf.dbuf, readcount, ptr + total) ;
  637|    818|		total += readcount ;
  638|    818|		len -= readcount ;
  639|    818|		if (readcount < bufferlen)
  ------------------
  |  Branch (639:7): [True: 33, False: 785]
  ------------------
  640|     33|			break ;
  641|    818|		} ;
  642|       |
  643|    818|	return total ;
  644|    818|} /* host_read_d2f */
double64.c:d2f_array:
  531|  62.2k|{	for (int i = 0 ; i < count ; i++)
  ------------------
  |  Branch (531:20): [True: 61.4k, False: 818]
  ------------------
  532|  61.4k|	{	dest [i] = src [i] ;
  533|  61.4k|		} ;
  534|    818|} /* d2f_array */

dwd_open:
   34|      1|{	if (psf)
  ------------------
  |  Branch (34:7): [True: 1, False: 0]
  ------------------
   35|      1|		return SFE_UNIMPLEMENTED ;
   36|      0|	return 0 ;
   37|      1|} /* dwd_open */

dwvw_init:
   80|    267|{	DWVW_PRIVATE	*pdwvw ;
   81|       |
   82|    267|	if (psf->codec_data != NULL)
  ------------------
  |  Branch (82:6): [True: 0, False: 267]
  ------------------
   83|      0|	{	psf_log_printf (psf, "*** psf->codec_data is not NULL.\n") ;
   84|      0|		return SFE_INTERNAL ;
   85|    267|		} ;
   86|       |
   87|    267|	if (bitwidth > 24)
  ------------------
  |  Branch (87:6): [True: 0, False: 267]
  ------------------
   88|      0|		return SFE_DWVW_BAD_BITWIDTH ;
   89|       |
   90|    267|	if (psf->file.mode == SFM_RDWR)
  ------------------
  |  Branch (90:6): [True: 0, False: 267]
  ------------------
   91|      0|		return SFE_BAD_MODE_RW ;
   92|       |
   93|    267|	if ((pdwvw = calloc (1, sizeof (DWVW_PRIVATE))) == NULL)
  ------------------
  |  Branch (93:6): [True: 0, False: 267]
  ------------------
   94|      0|		return SFE_MALLOC_FAILED ;
   95|       |
   96|    267|	psf->codec_data = (void*) pdwvw ;
   97|    267|	pdwvw->bit_width 	= bitwidth ;
   98|    267|	dwvw_read_reset (pdwvw) ;
   99|       |
  100|    267|	if (psf->file.mode == SFM_READ)
  ------------------
  |  Branch (100:6): [True: 267, False: 0]
  ------------------
  101|    267|	{	psf->read_short		= dwvw_read_s ;
  102|    267|		psf->read_int		= dwvw_read_i ;
  103|    267|		psf->read_float		= dwvw_read_f ;
  104|    267|		psf->read_double	= dwvw_read_d ;
  105|    267|		} ;
  106|       |
  107|    267|	if (psf->file.mode == SFM_WRITE)
  ------------------
  |  Branch (107:6): [True: 0, False: 267]
  ------------------
  108|      0|	{	psf->write_short	= dwvw_write_s ;
  109|      0|		psf->write_int		= dwvw_write_i ;
  110|      0|		psf->write_float	= dwvw_write_f ;
  111|      0|		psf->write_double	= dwvw_write_d ;
  112|      0|		} ;
  113|       |
  114|    267|	psf->codec_close = dwvw_close ;
  115|    267|	psf->seek = dwvw_seek ;
  116|    267|	psf->byterate = dwvw_byterate ;
  117|       |
  118|    267|	if (psf->file.mode == SFM_READ)
  ------------------
  |  Branch (118:6): [True: 267, False: 0]
  ------------------
  119|    267|	{	psf->sf.frames = psf_decode_frame_count (psf) ;
  120|    267|		dwvw_read_reset (pdwvw) ;
  121|    267|		} ;
  122|       |
  123|    267|	return 0 ;
  124|    267|} /* dwvw_init */
dwvw.c:dwvw_close:
  131|    267|{	DWVW_PRIVATE *pdwvw ;
  132|       |
  133|    267|	if (psf->codec_data == NULL)
  ------------------
  |  Branch (133:6): [True: 0, False: 267]
  ------------------
  134|      0|		return 0 ;
  135|    267|	pdwvw = (DWVW_PRIVATE*) psf->codec_data ;
  136|       |
  137|    267|	if (psf->file.mode == SFM_WRITE)
  ------------------
  |  Branch (137:6): [True: 0, False: 267]
  ------------------
  138|      0|	{	static int last_values [12] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } ;
  139|       |
  140|       |		/* Write 8 zero samples to fully flush output. */
  141|      0|		dwvw_encode_data (psf, pdwvw, last_values, 12) ;
  142|       |
  143|       |		/* Write the last buffer worth of data to disk. */
  144|      0|		psf_fwrite (pdwvw->b.buffer, 1, pdwvw->b.index, psf) ;
  145|       |
  146|      0|		if (psf->write_header)
  ------------------
  |  Branch (146:7): [True: 0, False: 0]
  ------------------
  147|      0|			psf->write_header (psf, SF_TRUE) ;
  148|      0|		} ;
  149|       |
  150|    267|	return 0 ;
  151|    267|} /* dwvw_close */
dwvw.c:dwvw_decode_data:
  306|  9.67k|{	int	count ;
  307|  9.67k|	int delta_width_modifier, delta_width, delta_negative, delta, sample ;
  308|       |
  309|       |	/* Restore state from last decode call. */
  310|  9.67k|	delta_width = pdwvw->last_delta_width ;
  311|  9.67k|	sample = pdwvw->last_sample ;
  312|       |
  313|  7.46M|	for (count = 0 ; count < len ; count++)
  ------------------
  |  Branch (313:19): [True: 7.45M, False: 9.24k]
  ------------------
  314|  7.45M|	{	/* If bit_count parameter is zero get the delta_width_modifier. */
  315|  7.45M|		delta_width_modifier = dwvw_decode_load_bits (psf, pdwvw, -1) ;
  316|       |
  317|       |		/* Check for end of input bit stream. Break loop if end. */
  318|  7.45M|		if (delta_width_modifier < 0 || (pdwvw->b.end == 0 && count == 0))
  ------------------
  |  Branch (318:7): [True: 116, False: 7.45M]
  |  Branch (318:36): [True: 103k, False: 7.35M]
  |  Branch (318:57): [True: 211, False: 103k]
  ------------------
  319|    327|			break ;
  320|       |
  321|  7.45M|		if (delta_width_modifier && dwvw_decode_load_bits (psf, pdwvw, 1))
  ------------------
  |  Branch (321:7): [True: 1.96M, False: 5.48M]
  |  Branch (321:31): [True: 512k, False: 1.45M]
  ------------------
  322|   512k|			delta_width_modifier = - delta_width_modifier ;
  323|       |
  324|       |		/* Calculate the current word width. */
  325|  7.45M|		delta_width = (delta_width + delta_width_modifier + pdwvw->bit_width) % pdwvw->bit_width ;
  326|       |
  327|       |		/* Load the delta. */
  328|  7.45M|		delta = 0 ;
  329|  7.45M|		if (delta_width)
  ------------------
  |  Branch (329:7): [True: 6.00M, False: 1.44M]
  ------------------
  330|  6.00M|		{	delta = dwvw_decode_load_bits (psf, pdwvw, delta_width - 1) | (1 << (delta_width - 1)) ;
  331|  6.00M|			delta_negative = dwvw_decode_load_bits (psf, pdwvw, 1) ;
  332|  6.00M|			if (delta == pdwvw->max_delta - 1)
  ------------------
  |  Branch (332:8): [True: 381k, False: 5.62M]
  ------------------
  333|   381k|				delta += dwvw_decode_load_bits (psf, pdwvw, 1) ;
  334|  6.00M|			if (delta_negative)
  ------------------
  |  Branch (334:8): [True: 4.02M, False: 1.97M]
  ------------------
  335|  4.02M|				delta = -delta ;
  336|  6.00M|			} ;
  337|       |
  338|       |		/* Calculate the sample */
  339|  7.45M|		sample += delta ;
  340|       |
  341|  7.45M|		if (sample >= pdwvw->max_delta)
  ------------------
  |  Branch (341:7): [True: 195k, False: 7.25M]
  ------------------
  342|   195k|			sample -= pdwvw->span ;
  343|  7.25M|		else if (sample < - pdwvw->max_delta)
  ------------------
  |  Branch (343:12): [True: 413k, False: 6.84M]
  ------------------
  344|   413k|			sample += pdwvw->span ;
  345|       |
  346|       |		/* Store the sample justifying to the most significant bit. */
  347|  7.45M|		ptr [count] = arith_shift_left (sample, 32 - pdwvw->bit_width) ;
  348|       |
  349|  7.45M|		if (pdwvw->b.end == 0 && pdwvw->bit_count == 0)
  ------------------
  |  Branch (349:7): [True: 103k, False: 7.35M]
  |  Branch (349:28): [True: 106, False: 103k]
  ------------------
  350|    106|			break ;
  351|  7.45M|		} ;
  352|       |
  353|  9.67k|	pdwvw->last_delta_width = delta_width ;
  354|  9.67k|	pdwvw->last_sample = sample ;
  355|       |
  356|  9.67k|	pdwvw->samplecount += count ;
  357|       |
  358|  9.67k|	return count ;
  359|  9.67k|} /* dwvw_decode_data */
dwvw.c:dwvw_decode_load_bits:
  363|  21.8M|{	int output = 0, get_dwm = SF_FALSE ;
  364|       |
  365|       |	/*
  366|       |	**	Depending on the value of parameter bit_count, either get the
  367|       |	**	required number of bits (ie bit_count > 0) or the
  368|       |	**	delta_width_modifier (otherwise).
  369|       |	*/
  370|       |
  371|  21.8M|	if (bit_count < 0)
  ------------------
  |  Branch (371:6): [True: 7.45M, False: 14.3M]
  ------------------
  372|  7.45M|	{	get_dwm = SF_TRUE ;
  373|       |		/* modify bit_count to ensure we have enough bits for finding dwm. */
  374|  7.45M|		bit_count = pdwvw->dwm_maxsize ;
  375|  7.45M|		} ;
  376|       |
  377|       |	/* Load bits in bit reseviour. */
  378|  29.1M|	while (pdwvw->bit_count < bit_count)
  ------------------
  |  Branch (378:9): [True: 7.37M, False: 21.7M]
  ------------------
  379|  7.37M|	{	if (pdwvw->b.index >= pdwvw->b.end)
  ------------------
  |  Branch (379:8): [True: 338k, False: 7.03M]
  ------------------
  380|   338k|		{	pdwvw->b.end = (int) psf_fread (pdwvw->b.buffer, 1, sizeof (pdwvw->b.buffer), psf) ;
  381|   338k|			pdwvw->b.index = 0 ;
  382|   338k|			} ;
  383|       |
  384|       |		/* Check for end of input stream. */
  385|  7.37M|		if (bit_count < 8 && pdwvw->b.end == 0)
  ------------------
  |  Branch (385:7): [True: 2.55M, False: 4.82M]
  |  Branch (385:24): [True: 27.9k, False: 2.52M]
  ------------------
  386|  27.9k|			return -1 ;
  387|       |
  388|  7.34M|		pdwvw->bits = arith_shift_left (pdwvw->bits, 8) ;
  389|       |
  390|  7.34M|		if (pdwvw->b.index < pdwvw->b.end)
  ------------------
  |  Branch (390:7): [True: 7.06M, False: 283k]
  ------------------
  391|  7.06M|		{	pdwvw->bits |= pdwvw->b.buffer [pdwvw->b.index] ;
  392|  7.06M|			pdwvw->b.index ++ ;
  393|  7.06M|			} ;
  394|  7.34M|		pdwvw->bit_count += 8 ;
  395|  21.7M|		} ;
  396|       |
  397|       |	/* If asked to get bits do so. */
  398|  21.7M|	if (! get_dwm)
  ------------------
  |  Branch (398:6): [True: 14.3M, False: 7.45M]
  ------------------
  399|  14.3M|	{	output = (pdwvw->bits >> (pdwvw->bit_count - bit_count)) & ((1 << bit_count) - 1) ;
  400|  14.3M|		pdwvw->bit_count -= bit_count ;
  401|  14.3M|		return output ;
  402|  14.3M|		} ;
  403|       |
  404|       |	/* Otherwise must have been asked to get delta_width_modifier. */
  405|  13.3M|	while (output < (pdwvw->dwm_maxsize))
  ------------------
  |  Branch (405:9): [True: 13.0M, False: 244k]
  ------------------
  406|  13.0M|	{	pdwvw->bit_count -= 1 ;
  407|  13.0M|		if (pdwvw->bits & (1 << pdwvw->bit_count))
  ------------------
  |  Branch (407:7): [True: 7.21M, False: 5.88M]
  ------------------
  408|  7.21M|			break ;
  409|  5.88M|		output += 1 ;
  410|  5.88M|		} ;
  411|       |
  412|  7.45M|	return output ;
  413|  21.7M|} /* dwvw_decode_load_bits */
dwvw.c:dwvw_read_i:
  217|  3.53k|{	DWVW_PRIVATE *pdwvw ;
  218|  3.53k|	int			readcount, count ;
  219|  3.53k|	sf_count_t	total = 0 ;
  220|       |
  221|  3.53k|	if (! psf->codec_data)
  ------------------
  |  Branch (221:6): [True: 0, False: 3.53k]
  ------------------
  222|      0|		return 0 ;
  223|  3.53k|	pdwvw = (DWVW_PRIVATE*) psf->codec_data ;
  224|       |
  225|  6.66k|	while (len > 0)
  ------------------
  |  Branch (225:9): [True: 3.53k, False: 3.12k]
  ------------------
  226|  3.53k|	{	readcount = (len > 0x10000000) ? 0x10000000 : (int) len ;
  ------------------
  |  Branch (226:16): [True: 0, False: 3.53k]
  ------------------
  227|       |
  228|  3.53k|		count = dwvw_decode_data (psf, pdwvw, ptr, readcount) ;
  229|       |
  230|  3.53k|		total += count ;
  231|  3.53k|		len -= count ;
  232|       |
  233|  3.53k|		if (count != readcount)
  ------------------
  |  Branch (233:7): [True: 415, False: 3.12k]
  ------------------
  234|    415|			break ;
  235|  3.53k|		} ;
  236|       |
  237|  3.53k|	return total ;
  238|  3.53k|} /* dwvw_read_i */
dwvw.c:dwvw_read_f:
  242|  6.13k|{	DWVW_PRIVATE *pdwvw ;
  243|  6.13k|	BUF_UNION	ubuf ;
  244|  6.13k|	int			*iptr ;
  245|  6.13k|	int			k, bufferlen, readcount = 0, count ;
  246|  6.13k|	sf_count_t	total = 0 ;
  247|  6.13k|	float	normfact ;
  248|       |
  249|  6.13k|	if (! psf->codec_data)
  ------------------
  |  Branch (249:6): [True: 0, False: 6.13k]
  ------------------
  250|      0|		return 0 ;
  251|  6.13k|	pdwvw = (DWVW_PRIVATE*) psf->codec_data ;
  252|       |
  253|  6.13k|	normfact = (psf->norm_float == SF_TRUE) ? 1.0 / ((float) 0x80000000) : 1.0 ;
  ------------------
  |  Branch (253:13): [True: 6.13k, False: 0]
  ------------------
  254|       |
  255|  6.13k|	iptr = ubuf.ibuf ;
  256|  6.13k|	bufferlen = ARRAY_LEN (ubuf.ibuf) ;
  ------------------
  |  |   88|  6.13k|#define		ARRAY_LEN(x)	((int) (sizeof (x) / sizeof ((x) [0])))
  ------------------
  257|  12.2k|	while (len > 0)
  ------------------
  |  Branch (257:9): [True: 6.13k, False: 6.12k]
  ------------------
  258|  6.13k|	{	readcount = (len >= bufferlen) ? bufferlen : (int) len ;
  ------------------
  |  Branch (258:16): [True: 0, False: 6.13k]
  ------------------
  259|  6.13k|		count = dwvw_decode_data (psf, pdwvw, iptr, readcount) ;
  260|  1.89M|		for (k = 0 ; k < readcount ; k++)
  ------------------
  |  Branch (260:16): [True: 1.88M, False: 6.13k]
  ------------------
  261|  1.88M|			ptr [total + k] = normfact * (float) (iptr [k]) ;
  262|       |
  263|  6.13k|		total += count ;
  264|  6.13k|		len -= readcount ;
  265|  6.13k|		if (count != readcount)
  ------------------
  |  Branch (265:7): [True: 18, False: 6.12k]
  ------------------
  266|     18|			break ;
  267|  6.13k|		} ;
  268|       |
  269|  6.13k|	return total ;
  270|  6.13k|} /* dwvw_read_f */
dwvw.c:dwvw_read_reset:
  417|    534|{	int bitwidth = pdwvw->bit_width ;
  418|       |
  419|    534|	memset (pdwvw, 0, sizeof (DWVW_PRIVATE)) ;
  420|       |
  421|    534|	pdwvw->bit_width	= bitwidth ;
  422|    534|	pdwvw->dwm_maxsize	= bitwidth / 2 ;
  423|    534|	pdwvw->max_delta	= 1 << (bitwidth - 1) ;
  424|    534|	pdwvw->span			= 1 << bitwidth ;
  425|    534|} /* dwvw_read_reset */

psf_fclose:
  144|  19.6k|{	int retval ;
  145|       |
  146|  19.6k|	if (psf->virtual_io)
  ------------------
  |  Branch (146:6): [True: 19.6k, False: 0]
  ------------------
  147|  19.6k|		return 0 ;
  148|       |
  149|      0|	if (psf->file.do_not_close_descriptor)
  ------------------
  |  Branch (149:6): [True: 0, False: 0]
  ------------------
  150|      0|	{	psf->file.filedes = -1 ;
  151|      0|		return 0 ;
  152|      0|		} ;
  153|       |
  154|      0|	if ((retval = psf_close_fd (psf->file.filedes)) == -1)
  ------------------
  |  Branch (154:6): [True: 0, False: 0]
  ------------------
  155|      0|		psf_log_syserr (psf, errno) ;
  156|       |
  157|      0|	psf->file.filedes = -1 ;
  158|       |
  159|      0|	return retval ;
  160|      0|} /* psf_fclose */
psf_open_rsrc:
  164|  1.63k|{	size_t count ;
  165|       |
  166|  1.63k|	if (psf->rsrc.filedes > 0)
  ------------------
  |  Branch (166:6): [True: 0, False: 1.63k]
  ------------------
  167|      0|		return 0 ;
  168|       |
  169|       |	/* Test for MacOSX style resource fork on HPFS or HPFS+ filesystems. */
  170|  1.63k|	count = snprintf (psf->rsrc.path, sizeof (psf->rsrc.path), "%s/..namedfork/rsrc", psf->file.path) ;
  171|  1.63k|	psf->error = SFE_NO_ERROR ;
  172|  1.63k|	if (count < sizeof (psf->rsrc.path))
  ------------------
  |  Branch (172:6): [True: 1.63k, False: 0]
  ------------------
  173|  1.63k|	{	if ((psf->rsrc.filedes = psf_open_fd (&psf->rsrc)) >= 0)
  ------------------
  |  Branch (173:8): [True: 0, False: 1.63k]
  ------------------
  174|      0|		{	psf->rsrclength = psf_get_filelen_fd (psf->rsrc.filedes) ;
  175|      0|			if (psf->rsrclength > 0 || (psf->rsrc.mode & SFM_WRITE))
  ------------------
  |  Branch (175:8): [True: 0, False: 0]
  |  Branch (175:31): [True: 0, False: 0]
  ------------------
  176|      0|				return SFE_NO_ERROR ;
  177|      0|			psf_close_fd (psf->rsrc.filedes) ;
  178|      0|			psf->rsrc.filedes = -1 ;
  179|  1.63k|			} ;
  180|       |
  181|  1.63k|		if (psf->rsrc.filedes == - SFE_BAD_OPEN_MODE)
  ------------------
  |  Branch (181:7): [True: 0, False: 1.63k]
  ------------------
  182|      0|		{	psf->error = SFE_BAD_OPEN_MODE ;
  183|      0|			return psf->error ;
  184|  1.63k|			} ;
  185|  1.63k|		} ;
  186|       |
  187|       |	/*
  188|       |	** Now try for a resource fork stored as a separate file in the same
  189|       |	** directory, but preceded with a dot underscore.
  190|       |	*/
  191|  1.63k|	count = snprintf (psf->rsrc.path, sizeof (psf->rsrc.path), "%s._%s", psf->file.dir, psf->file.name) ;
  192|  1.63k|	psf->error = SFE_NO_ERROR ;
  193|  1.63k|	if (count < sizeof (psf->rsrc.path) && (psf->rsrc.filedes = psf_open_fd (&psf->rsrc)) >= 0)
  ------------------
  |  Branch (193:6): [True: 1.63k, False: 0]
  |  Branch (193:41): [True: 0, False: 1.63k]
  ------------------
  194|      0|	{	psf->rsrclength = psf_get_filelen_fd (psf->rsrc.filedes) ;
  195|      0|		return SFE_NO_ERROR ;
  196|  1.63k|		} ;
  197|       |
  198|       |	/*
  199|       |	** Now try for a resource fork stored in a separate file in the
  200|       |	** .AppleDouble/ directory.
  201|       |	*/
  202|  1.63k|	count = snprintf (psf->rsrc.path, sizeof (psf->rsrc.path), "%s.AppleDouble/%s", psf->file.dir, psf->file.name) ;
  203|  1.63k|	psf->error = SFE_NO_ERROR ;
  204|  1.63k|	if (count < sizeof (psf->rsrc.path))
  ------------------
  |  Branch (204:6): [True: 1.63k, False: 0]
  ------------------
  205|  1.63k|	{	if ((psf->rsrc.filedes = psf_open_fd (&psf->rsrc)) >= 0)
  ------------------
  |  Branch (205:8): [True: 0, False: 1.63k]
  ------------------
  206|      0|		{	psf->rsrclength = psf_get_filelen_fd (psf->rsrc.filedes) ;
  207|      0|			return SFE_NO_ERROR ;
  208|  1.63k|			} ;
  209|       |
  210|       |		/* No resource file found. */
  211|  1.63k|		if (psf->rsrc.filedes == -1)
  ------------------
  |  Branch (211:7): [True: 1.63k, False: 0]
  ------------------
  212|  1.63k|			psf_log_syserr (psf, errno) ;
  213|  1.63k|		}
  214|      0|	else
  215|      0|	{	psf->error = SFE_OPEN_FAILED ;
  216|  1.63k|		} ;
  217|       |
  218|  1.63k|	psf->rsrc.filedes = -1 ;
  219|       |
  220|  1.63k|	return psf->error ;
  221|  1.63k|} /* psf_open_rsrc */
psf_get_filelen:
  225|  21.4k|{	sf_count_t	filelen ;
  226|       |
  227|  21.4k|	if (psf->virtual_io)
  ------------------
  |  Branch (227:6): [True: 21.4k, False: 0]
  ------------------
  228|  21.4k|		return psf->vio.get_filelen (psf->vio_user_data) ;
  229|       |
  230|      0|	filelen = psf_get_filelen_fd (psf->file.filedes) ;
  231|       |
  232|      0|	if (filelen == -1)
  ------------------
  |  Branch (232:6): [True: 0, False: 0]
  ------------------
  233|      0|	{	psf_log_syserr (psf, errno) ;
  234|      0|		return (sf_count_t) -1 ;
  235|      0|		} ;
  236|       |
  237|      0|	if (filelen == -SFE_BAD_STAT_SIZE)
  ------------------
  |  Branch (237:6): [True: 0, False: 0]
  ------------------
  238|      0|	{	psf->error = SFE_BAD_STAT_SIZE ;
  239|      0|		return (sf_count_t) -1 ;
  240|      0|		} ;
  241|       |
  242|      0|	switch (psf->file.mode)
  243|      0|	{	case SFM_WRITE :
  ------------------
  |  Branch (243:4): [True: 0, False: 0]
  ------------------
  244|      0|			filelen = filelen - psf->fileoffset ;
  245|      0|			break ;
  246|       |
  247|      0|		case SFM_READ :
  ------------------
  |  Branch (247:3): [True: 0, False: 0]
  ------------------
  248|      0|			if (psf->fileoffset > 0 && psf->filelength > 0)
  ------------------
  |  Branch (248:8): [True: 0, False: 0]
  |  Branch (248:31): [True: 0, False: 0]
  ------------------
  249|      0|				filelen = psf->filelength ;
  250|      0|			break ;
  251|       |
  252|      0|		case SFM_RDWR :
  ------------------
  |  Branch (252:3): [True: 0, False: 0]
  ------------------
  253|       |			/*
  254|       |			** Cannot open embedded files SFM_RDWR so we don't need to
  255|       |			** subtract psf->fileoffset. We already have the answer we
  256|       |			** need.
  257|       |			*/
  258|      0|			break ;
  259|       |
  260|      0|		default :
  ------------------
  |  Branch (260:3): [True: 0, False: 0]
  ------------------
  261|       |			/* Shouldn't be here, so return error. */
  262|      0|			filelen = -1 ;
  263|      0|		} ;
  264|       |
  265|      0|	return filelen ;
  266|      0|} /* psf_get_filelen */
psf_close_rsrc:
  270|  19.6k|{	psf_close_fd (psf->rsrc.filedes) ;
  271|  19.6k|	psf->rsrc.filedes = -1 ;
  272|  19.6k|	return 0 ;
  273|  19.6k|} /* psf_close_rsrc */
psf_fseek:
  313|  1.81M|{	sf_count_t	absolute_position ;
  314|       |
  315|  1.81M|	if (psf->virtual_io)
  ------------------
  |  Branch (315:6): [True: 1.81M, False: 0]
  ------------------
  316|  1.81M|		return psf->vio.seek (offset, whence, psf->vio_user_data) ;
  317|       |
  318|       |	/* When decoding from pipes sometimes see seeks to the pipeoffset, which appears to mean do nothing. */
  319|      0|	if (psf->is_pipe)
  ------------------
  |  Branch (319:6): [True: 0, False: 0]
  ------------------
  320|      0|	{	if (whence != SEEK_SET || offset != psf->pipeoffset)
  ------------------
  |  Branch (320:8): [True: 0, False: 0]
  |  Branch (320:30): [True: 0, False: 0]
  ------------------
  321|      0|			psf_log_printf (psf, "psf_fseek : pipe seek to value other than pipeoffset\n") ;
  322|      0|		return offset ;
  323|      0|		}
  324|       |
  325|      0|	switch (whence)
  326|      0|	{	case SEEK_SET :
  ------------------
  |  Branch (326:4): [True: 0, False: 0]
  ------------------
  327|      0|				offset += psf->fileoffset ;
  328|      0|				break ;
  329|       |
  330|      0|		case SEEK_END :
  ------------------
  |  Branch (330:3): [True: 0, False: 0]
  ------------------
  331|      0|				break ;
  332|       |
  333|      0|		case SEEK_CUR :
  ------------------
  |  Branch (333:3): [True: 0, False: 0]
  ------------------
  334|      0|				break ;
  335|       |
  336|      0|		default :
  ------------------
  |  Branch (336:3): [True: 0, False: 0]
  ------------------
  337|       |				/* We really should not be here. */
  338|      0|				psf_log_printf (psf, "psf_fseek : whence is %d *****.\n", whence) ;
  339|      0|				return 0 ;
  340|      0|		} ;
  341|       |
  342|      0|	absolute_position = lseek (psf->file.filedes, offset, whence) ;
  343|       |
  344|      0|	if (absolute_position < 0)
  ------------------
  |  Branch (344:6): [True: 0, False: 0]
  ------------------
  345|      0|		psf_log_syserr (psf, errno) ;
  346|       |
  347|      0|	return absolute_position - psf->fileoffset ;
  348|      0|} /* psf_fseek */
psf_fread:
  352|  12.3M|{	sf_count_t total = 0 ;
  353|  12.3M|	ssize_t	count ;
  354|       |
  355|  12.3M|	items *= bytes ;
  356|       |
  357|       |	/* Do this check after the multiplication above. */
  358|  12.3M|	if (items <= 0)
  ------------------
  |  Branch (358:6): [True: 0, False: 12.3M]
  ------------------
  359|      0|		return 0 ;
  360|       |
  361|  12.3M|	if (psf->virtual_io)
  ------------------
  |  Branch (361:6): [True: 12.3M, False: 0]
  ------------------
  362|  12.3M|		return psf->vio.read (ptr, items, psf->vio_user_data) / bytes ;
  363|       |
  364|      0|	while (items > 0)
  ------------------
  |  Branch (364:9): [True: 0, False: 0]
  ------------------
  365|      0|	{	/* Break the read down to a sensible size. */
  366|      0|		count = (items > SENSIBLE_SIZE) ? SENSIBLE_SIZE : (ssize_t) items ;
  ------------------
  |  |   73|      0|#define	SENSIBLE_SIZE	(0x40000000)
  ------------------
              		count = (items > SENSIBLE_SIZE) ? SENSIBLE_SIZE : (ssize_t) items ;
  ------------------
  |  |   73|      0|#define	SENSIBLE_SIZE	(0x40000000)
  ------------------
  |  Branch (366:11): [True: 0, False: 0]
  ------------------
  367|       |
  368|      0|		count = read (psf->file.filedes, ((char*) ptr) + total, (size_t) count) ;
  369|       |
  370|      0|		if (count == -1)
  ------------------
  |  Branch (370:7): [True: 0, False: 0]
  ------------------
  371|      0|		{	if (errno == EINTR)
  ------------------
  |  Branch (371:9): [True: 0, False: 0]
  ------------------
  372|      0|				continue ;
  373|       |
  374|      0|			psf_log_syserr (psf, errno) ;
  375|      0|			break ;
  376|      0|			} ;
  377|       |
  378|      0|		if (count == 0)
  ------------------
  |  Branch (378:7): [True: 0, False: 0]
  ------------------
  379|      0|			break ;
  380|       |
  381|      0|		total += count ;
  382|      0|		items -= count ;
  383|      0|		} ;
  384|       |
  385|      0|	if (psf->is_pipe)
  ------------------
  |  Branch (385:6): [True: 0, False: 0]
  ------------------
  386|      0|		psf->pipeoffset += total ;
  387|       |
  388|      0|	return total / bytes ;
  389|  12.3M|} /* psf_fread */
psf_ftell:
  437|  16.6M|{	sf_count_t pos ;
  438|       |
  439|  16.6M|	if (psf->virtual_io)
  ------------------
  |  Branch (439:6): [True: 16.6M, False: 0]
  ------------------
  440|  16.6M|		return psf->vio.tell (psf->vio_user_data) ;
  441|       |
  442|      0|	if (psf->is_pipe)
  ------------------
  |  Branch (442:6): [True: 0, False: 0]
  ------------------
  443|      0|		return psf->pipeoffset ;
  444|       |
  445|      0|	pos = lseek (psf->file.filedes, 0, SEEK_CUR) ;
  446|       |
  447|      0|	if (pos == ((sf_count_t) -1))
  ------------------
  |  Branch (447:6): [True: 0, False: 0]
  ------------------
  448|      0|	{	psf_log_syserr (psf, errno) ;
  449|      0|		return -1 ;
  450|      0|		} ;
  451|       |
  452|      0|	return pos - psf->fileoffset ;
  453|      0|} /* psf_ftell */
psf_is_pipe:
  495|  19.9k|{	struct stat statbuf ;
  496|       |
  497|  19.9k|	if (psf->virtual_io)
  ------------------
  |  Branch (497:6): [True: 19.9k, False: 0]
  ------------------
  498|  19.9k|		return SF_FALSE ;
  499|       |
  500|      0|	if (fstat (psf->file.filedes, &statbuf) == -1)
  ------------------
  |  Branch (500:6): [True: 0, False: 0]
  ------------------
  501|      0|	{	psf_log_syserr (psf, errno) ;
  502|       |		/* Default to maximum safety. */
  503|      0|		return SF_TRUE ;
  504|      0|		} ;
  505|       |
  506|      0|	if (S_ISFIFO (statbuf.st_mode) || S_ISSOCK (statbuf.st_mode))
  ------------------
  |  Branch (506:6): [True: 0, False: 0]
  |  Branch (506:36): [True: 0, False: 0]
  ------------------
  507|      0|		return SF_TRUE ;
  508|       |
  509|      0|	return SF_FALSE ;
  510|      0|} /* psf_is_pipe */
psf_init_files:
  553|  19.6k|{	psf->file.filedes = -1 ;
  554|  19.6k|	psf->rsrc.filedes = -1 ;
  555|  19.6k|	psf->file.savedes = -1 ;
  556|  19.6k|} /* psf_init_files */
file_io.c:psf_close_fd:
  457|  19.6k|{	int retval ;
  458|       |
  459|  19.6k|	if (fd < 0)
  ------------------
  |  Branch (459:6): [True: 19.6k, False: 0]
  ------------------
  460|  19.6k|		return 0 ;
  461|       |
  462|      0|	while ((retval = close (fd)) == -1 && errno == EINTR)
  ------------------
  |  Branch (462:9): [True: 0, False: 0]
  |  Branch (462:40): [True: 0, False: 0]
  ------------------
  463|      0|		/* Do nothing. */ ;
  464|       |
  465|      0|	return retval ;
  466|  19.6k|} /* psf_close_fd */
file_io.c:psf_open_fd:
  575|  4.90k|{	int fd, oflag, mode ;
  576|       |
  577|       |	/*
  578|       |	** Sanity check. If everything is OK, this test and the printfs will
  579|       |	** be optimised out. This is meant to catch the problems caused by
  580|       |	** "sfconfig.h" being included after <stdio.h>.
  581|       |	*/
  582|  4.90k|	if (sizeof (sf_count_t) != 8)
  ------------------
  |  Branch (582:6): [Folded, False: 4.90k]
  ------------------
  583|      0|	{	puts ("\n\n*** Fatal error : sizeof (sf_count_t) != 8") ;
  584|      0|		puts ("*** This means that libsndfile was not configured correctly.\n") ;
  585|      0|		exit (1) ;
  586|  4.90k|		} ;
  587|       |
  588|  4.90k|	switch (pfile->mode)
  589|  4.90k|	{	case SFM_READ :
  ------------------
  |  Branch (589:4): [True: 4.90k, False: 0]
  ------------------
  590|  4.90k|				oflag = O_RDONLY | O_BINARY ;
  ------------------
  |  |   81|  4.90k|#define O_BINARY 0
  ------------------
  591|  4.90k|				mode = 0 ;
  592|  4.90k|				break ;
  593|       |
  594|      0|		case SFM_WRITE :
  ------------------
  |  Branch (594:3): [True: 0, False: 4.90k]
  ------------------
  595|      0|				oflag = O_WRONLY | O_CREAT | O_TRUNC | O_BINARY ;
  ------------------
  |  |   81|      0|#define O_BINARY 0
  ------------------
  596|      0|				mode = S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH ;
  597|      0|				break ;
  598|       |
  599|      0|		case SFM_RDWR :
  ------------------
  |  Branch (599:3): [True: 0, False: 4.90k]
  ------------------
  600|      0|				oflag = O_RDWR | O_CREAT | O_BINARY ;
  ------------------
  |  |   81|      0|#define O_BINARY 0
  ------------------
  601|      0|				mode = S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH ;
  602|      0|				break ;
  603|       |
  604|      0|		default :
  ------------------
  |  Branch (604:3): [True: 0, False: 4.90k]
  ------------------
  605|      0|				return - SFE_BAD_OPEN_MODE ;
  606|      0|				break ;
  607|  4.90k|		} ;
  608|       |
  609|  4.90k|	if (mode == 0)
  ------------------
  |  Branch (609:6): [True: 4.90k, False: 0]
  ------------------
  610|  4.90k|		fd = open (pfile->path, oflag) ;
  611|      0|	else
  612|      0|		fd = open (pfile->path, oflag, mode) ;
  613|       |
  614|  4.90k|	return fd ;
  615|  4.90k|} /* psf_open_fd */
file_io.c:psf_log_syserr:
  619|  1.63k|{
  620|       |	/* Only log an error if no error has been set yet. */
  621|  1.63k|	if (psf->error == 0)
  ------------------
  |  Branch (621:6): [True: 1.63k, False: 0]
  ------------------
  622|  1.63k|	{	psf->error = SFE_SYSTEM ;
  623|  1.63k|		snprintf (psf->syserr, sizeof (psf->syserr), "System error : %s.", strerror (error)) ;
  624|  1.63k|		} ;
  625|       |
  626|  1.63k|	return ;
  627|  1.63k|} /* psf_log_syserr */

flac_open:
 1615|      1|{
 1616|      1|	psf_log_printf (psf, "This version of libsndfile was compiled without FLAC support.\n") ;
 1617|      1|	return SFE_UNIMPLEMENTED ;
 1618|      1|} /* flac_open */

float32_init:
   89|    332|{	static int float_caps ;
   90|       |
   91|    332|	if (psf->sf.channels < 1)
  ------------------
  |  Branch (91:6): [True: 29, False: 303]
  ------------------
   92|     29|	{	psf_log_printf (psf, "float32_init : internal error : channels = %d\n", psf->sf.channels) ;
   93|     29|		return SFE_INTERNAL ;
   94|    303|		} ;
   95|       |
   96|    303|	float_caps = float32_get_capability (psf) ;
   97|       |
   98|    303|	psf->blockwidth = sizeof (float) * psf->sf.channels ;
   99|       |
  100|    303|	if (psf->file.mode == SFM_READ || psf->file.mode == SFM_RDWR)
  ------------------
  |  Branch (100:6): [True: 303, False: 0]
  |  Branch (100:36): [True: 0, False: 0]
  ------------------
  101|    303|	{	switch (psf->endian + float_caps)
  102|    303|		{	case (SF_ENDIAN_BIG + FLOAT_CAN_RW_BE) :
  ------------------
  |  Branch (102:5): [True: 0, False: 303]
  ------------------
  103|      0|					psf->data_endswap = SF_FALSE ;
  104|      0|					psf->read_short		= host_read_f2s ;
  105|      0|					psf->read_int		= host_read_f2i ;
  106|      0|					psf->read_float		= host_read_f ;
  107|      0|					psf->read_double	= host_read_f2d ;
  108|      0|					break ;
  109|       |
  110|    156|			case (SF_ENDIAN_LITTLE + FLOAT_CAN_RW_LE) :
  ------------------
  |  Branch (110:4): [True: 156, False: 147]
  ------------------
  111|    156|					psf->data_endswap = SF_FALSE ;
  112|    156|					psf->read_short		= host_read_f2s ;
  113|    156|					psf->read_int		= host_read_f2i ;
  114|    156|					psf->read_float		= host_read_f ;
  115|    156|					psf->read_double	= host_read_f2d ;
  116|    156|					break ;
  117|       |
  118|    147|			case (SF_ENDIAN_BIG + FLOAT_CAN_RW_LE) :
  ------------------
  |  Branch (118:4): [True: 147, False: 156]
  ------------------
  119|    147|					psf->data_endswap = SF_TRUE ;
  120|    147|					psf->read_short		= host_read_f2s ;
  121|    147|					psf->read_int		= host_read_f2i ;
  122|    147|					psf->read_float		= host_read_f ;
  123|    147|					psf->read_double	= host_read_f2d ;
  124|    147|					break ;
  125|       |
  126|      0|			case (SF_ENDIAN_LITTLE + FLOAT_CAN_RW_BE) :
  ------------------
  |  Branch (126:4): [True: 0, False: 303]
  ------------------
  127|      0|					psf->data_endswap = SF_TRUE ;
  128|      0|					psf->read_short		= host_read_f2s ;
  129|      0|					psf->read_int		= host_read_f2i ;
  130|      0|					psf->read_float		= host_read_f ;
  131|      0|					psf->read_double	= host_read_f2d ;
  132|      0|					break ;
  133|       |
  134|       |			/* When the CPU is not IEEE compatible. */
  135|      0|			case (SF_ENDIAN_BIG + FLOAT_BROKEN_LE) :
  ------------------
  |  Branch (135:4): [True: 0, False: 303]
  ------------------
  136|      0|					psf->data_endswap = SF_TRUE ;
  137|      0|					psf->read_short		= replace_read_f2s ;
  138|      0|					psf->read_int		= replace_read_f2i ;
  139|      0|					psf->read_float		= replace_read_f ;
  140|      0|					psf->read_double	= replace_read_f2d ;
  141|      0|					break ;
  142|       |
  143|      0|			case (SF_ENDIAN_LITTLE + FLOAT_BROKEN_LE) :
  ------------------
  |  Branch (143:4): [True: 0, False: 303]
  ------------------
  144|      0|					psf->data_endswap = SF_FALSE ;
  145|      0|					psf->read_short		= replace_read_f2s ;
  146|      0|					psf->read_int		= replace_read_f2i ;
  147|      0|					psf->read_float		= replace_read_f ;
  148|      0|					psf->read_double	= replace_read_f2d ;
  149|      0|					break ;
  150|       |
  151|      0|			case (SF_ENDIAN_BIG + FLOAT_BROKEN_BE) :
  ------------------
  |  Branch (151:4): [True: 0, False: 303]
  ------------------
  152|      0|					psf->data_endswap = SF_FALSE ;
  153|      0|					psf->read_short		= replace_read_f2s ;
  154|      0|					psf->read_int		= replace_read_f2i ;
  155|      0|					psf->read_float		= replace_read_f ;
  156|      0|					psf->read_double	= replace_read_f2d ;
  157|      0|					break ;
  158|       |
  159|      0|			case (SF_ENDIAN_LITTLE + FLOAT_BROKEN_BE) :
  ------------------
  |  Branch (159:4): [True: 0, False: 303]
  ------------------
  160|      0|					psf->data_endswap = SF_TRUE ;
  161|      0|					psf->read_short		= replace_read_f2s ;
  162|      0|					psf->read_int		= replace_read_f2i ;
  163|      0|					psf->read_float		= replace_read_f ;
  164|      0|					psf->read_double	= replace_read_f2d ;
  165|      0|					break ;
  166|       |
  167|      0|			default : break ;
  ------------------
  |  Branch (167:4): [True: 0, False: 303]
  ------------------
  168|    303|			} ;
  169|    303|		} ;
  170|       |
  171|    303|	if (psf->file.mode == SFM_WRITE || psf->file.mode == SFM_RDWR)
  ------------------
  |  Branch (171:6): [True: 0, False: 303]
  |  Branch (171:37): [True: 0, False: 303]
  ------------------
  172|      0|	{	switch (psf->endian + float_caps)
  173|      0|		{	case (SF_ENDIAN_LITTLE + FLOAT_CAN_RW_LE) :
  ------------------
  |  Branch (173:5): [True: 0, False: 0]
  ------------------
  174|      0|					psf->data_endswap = SF_FALSE ;
  175|      0|					psf->write_short	= host_write_s2f ;
  176|      0|					psf->write_int		= host_write_i2f ;
  177|      0|					psf->write_float	= host_write_f ;
  178|      0|					psf->write_double	= host_write_d2f ;
  179|      0|					break ;
  180|       |
  181|      0|			case (SF_ENDIAN_BIG + FLOAT_CAN_RW_BE) :
  ------------------
  |  Branch (181:4): [True: 0, False: 0]
  ------------------
  182|      0|					psf->data_endswap = SF_FALSE ;
  183|      0|					psf->write_short	= host_write_s2f ;
  184|      0|					psf->write_int		= host_write_i2f ;
  185|      0|					psf->write_float	= host_write_f ;
  186|      0|					psf->write_double	= host_write_d2f ;
  187|      0|					break ;
  188|       |
  189|      0|			case (SF_ENDIAN_BIG + FLOAT_CAN_RW_LE) :
  ------------------
  |  Branch (189:4): [True: 0, False: 0]
  ------------------
  190|      0|					psf->data_endswap = SF_TRUE ;
  191|      0|					psf->write_short	= host_write_s2f ;
  192|      0|					psf->write_int		= host_write_i2f ;
  193|      0|					psf->write_float	= host_write_f ;
  194|      0|					psf->write_double	= host_write_d2f ;
  195|      0|					break ;
  196|       |
  197|      0|			case (SF_ENDIAN_LITTLE + FLOAT_CAN_RW_BE) :
  ------------------
  |  Branch (197:4): [True: 0, False: 0]
  ------------------
  198|      0|					psf->data_endswap = SF_TRUE ;
  199|      0|					psf->write_short	= host_write_s2f ;
  200|      0|					psf->write_int		= host_write_i2f ;
  201|      0|					psf->write_float	= host_write_f ;
  202|      0|					psf->write_double	= host_write_d2f ;
  203|      0|					break ;
  204|       |
  205|       |			/* When the CPU is not IEEE compatible. */
  206|      0|			case (SF_ENDIAN_BIG + FLOAT_BROKEN_LE) :
  ------------------
  |  Branch (206:4): [True: 0, False: 0]
  ------------------
  207|      0|					psf->data_endswap = SF_TRUE ;
  208|      0|					psf->write_short	= replace_write_s2f ;
  209|      0|					psf->write_int		= replace_write_i2f ;
  210|      0|					psf->write_float	= replace_write_f ;
  211|      0|					psf->write_double	= replace_write_d2f ;
  212|      0|					break ;
  213|       |
  214|      0|			case (SF_ENDIAN_LITTLE + FLOAT_BROKEN_LE) :
  ------------------
  |  Branch (214:4): [True: 0, False: 0]
  ------------------
  215|      0|					psf->data_endswap = SF_FALSE ;
  216|      0|					psf->write_short	= replace_write_s2f ;
  217|      0|					psf->write_int		= replace_write_i2f ;
  218|      0|					psf->write_float	= replace_write_f ;
  219|      0|					psf->write_double	= replace_write_d2f ;
  220|      0|					break ;
  221|       |
  222|      0|			case (SF_ENDIAN_BIG + FLOAT_BROKEN_BE) :
  ------------------
  |  Branch (222:4): [True: 0, False: 0]
  ------------------
  223|      0|					psf->data_endswap = SF_FALSE ;
  224|      0|					psf->write_short	= replace_write_s2f ;
  225|      0|					psf->write_int		= replace_write_i2f ;
  226|      0|					psf->write_float	= replace_write_f ;
  227|      0|					psf->write_double	= replace_write_d2f ;
  228|      0|					break ;
  229|       |
  230|      0|			case (SF_ENDIAN_LITTLE + FLOAT_BROKEN_BE) :
  ------------------
  |  Branch (230:4): [True: 0, False: 0]
  ------------------
  231|      0|					psf->data_endswap = SF_TRUE ;
  232|      0|					psf->write_short	= replace_write_s2f ;
  233|      0|					psf->write_int		= replace_write_i2f ;
  234|      0|					psf->write_float	= replace_write_f ;
  235|      0|					psf->write_double	= replace_write_d2f ;
  236|      0|					break ;
  237|       |
  238|      0|			default : break ;
  ------------------
  |  Branch (238:4): [True: 0, False: 0]
  ------------------
  239|      0|			} ;
  240|    303|		} ;
  241|       |
  242|    303|	if (psf->filelength > psf->dataoffset)
  ------------------
  |  Branch (242:6): [True: 233, False: 70]
  ------------------
  243|    233|	{	psf->datalength = (psf->dataend > 0) ? psf->dataend - psf->dataoffset :
  ------------------
  |  Branch (243:22): [True: 6, False: 227]
  ------------------
  244|    233|							psf->filelength - psf->dataoffset ;
  245|    233|		}
  246|     70|	else
  247|     70|		psf->datalength = 0 ;
  248|       |
  249|    303|	psf->sf.frames = psf->blockwidth > 0 ? psf->datalength / psf->blockwidth : 0 ;
  ------------------
  |  Branch (249:19): [True: 303, False: 0]
  ------------------
  250|       |
  251|    303|	return 0 ;
  252|    303|} /* float32_init */
float32_be_read:
  256|  6.19k|{	int		exponent, mantissa, negative ;
  257|  6.19k|	float	fvalue ;
  258|       |
  259|  6.19k|	negative = cptr [0] & 0x80 ;
  260|  6.19k|	exponent = ((cptr [0] & 0x7F) << 1) | ((cptr [1] & 0x80) ? 1 : 0) ;
  ------------------
  |  Branch (260:41): [True: 653, False: 5.54k]
  ------------------
  261|  6.19k|	mantissa = ((cptr [1] & 0x7F) << 16) | (cptr [2] << 8) | (cptr [3]) ;
  262|       |
  263|  6.19k|	if (! (exponent || mantissa))
  ------------------
  |  Branch (263:9): [True: 1.66k, False: 4.53k]
  |  Branch (263:21): [True: 815, False: 3.72k]
  ------------------
  264|  3.72k|		return 0.0 ;
  265|       |
  266|  2.47k|	mantissa |= 0x800000 ;
  267|  2.47k|	exponent = exponent ? exponent - 127 : 0 ;
  ------------------
  |  Branch (267:13): [True: 1.66k, False: 815]
  ------------------
  268|       |
  269|  2.47k|	fvalue = mantissa ? ((float) mantissa) / ((float) 0x800000) : 0.0 ;
  ------------------
  |  Branch (269:11): [True: 2.47k, False: 0]
  ------------------
  270|       |
  271|  2.47k|	if (negative)
  ------------------
  |  Branch (271:6): [True: 666, False: 1.80k]
  ------------------
  272|    666|		fvalue *= -1 ;
  273|       |
  274|  2.47k|	if (exponent > 0)
  ------------------
  |  Branch (274:6): [True: 1.00k, False: 1.46k]
  ------------------
  275|  1.00k|		fvalue *= pow (2.0, exponent) ;
  276|  1.46k|	else if (exponent < 0)
  ------------------
  |  Branch (276:11): [True: 653, False: 815]
  ------------------
  277|    653|		fvalue /= pow (2.0, abs (exponent)) ;
  278|       |
  279|  2.47k|	return fvalue ;
  280|  6.19k|} /* float32_be_read */
float32_le_read:
  284|  35.5k|{	int		exponent, mantissa, negative ;
  285|  35.5k|	float	fvalue ;
  286|       |
  287|  35.5k|	negative = cptr [3] & 0x80 ;
  288|  35.5k|	exponent = ((cptr [3] & 0x7F) << 1) | ((cptr [2] & 0x80) ? 1 : 0) ;
  ------------------
  |  Branch (288:41): [True: 14.7k, False: 20.7k]
  ------------------
  289|  35.5k|	mantissa = ((cptr [2] & 0x7F) << 16) | (cptr [1] << 8) | (cptr [0]) ;
  290|       |
  291|  35.5k|	if (! (exponent || mantissa))
  ------------------
  |  Branch (291:9): [True: 20.1k, False: 15.4k]
  |  Branch (291:21): [True: 4.96k, False: 10.4k]
  ------------------
  292|  10.4k|		return 0.0 ;
  293|       |
  294|  25.1k|	mantissa |= 0x800000 ;
  295|  25.1k|	exponent = exponent ? exponent - 127 : 0 ;
  ------------------
  |  Branch (295:13): [True: 20.1k, False: 4.96k]
  ------------------
  296|       |
  297|  25.1k|	fvalue = mantissa ? ((float) mantissa) / ((float) 0x800000) : 0.0 ;
  ------------------
  |  Branch (297:11): [True: 25.1k, False: 0]
  ------------------
  298|       |
  299|  25.1k|	if (negative)
  ------------------
  |  Branch (299:6): [True: 11.0k, False: 14.0k]
  ------------------
  300|  11.0k|		fvalue *= -1 ;
  301|       |
  302|  25.1k|	if (exponent > 0)
  ------------------
  |  Branch (302:6): [True: 12.9k, False: 12.2k]
  ------------------
  303|  12.9k|		fvalue *= pow (2.0, exponent) ;
  304|  12.2k|	else if (exponent < 0)
  ------------------
  |  Branch (304:11): [True: 7.24k, False: 4.96k]
  ------------------
  305|  7.24k|		fvalue /= pow (2.0, abs (exponent)) ;
  306|       |
  307|  25.1k|	return fvalue ;
  308|  35.5k|} /* float32_le_read */
float32.c:float32_get_capability:
  410|    303|{	union
  411|    303|	{	float			f ;
  412|    303|		int				i ;
  413|    303|		unsigned char	c [4] ;
  414|    303|	} data ;
  415|       |
  416|    303|	data.f = (float) 1.23456789 ; /* Some arbitrary value. */
  417|       |
  418|    303|	if (! psf->ieee_replace)
  ------------------
  |  Branch (418:6): [True: 303, False: 0]
  ------------------
  419|    303|	{	/* If this test is true ints and floats are compatible and little endian. */
  420|    303|		if (data.c [0] == 0x52 && data.c [1] == 0x06 && data.c [2] == 0x9e && data.c [3] == 0x3f)
  ------------------
  |  Branch (420:7): [True: 303, False: 0]
  |  Branch (420:29): [True: 303, False: 0]
  |  Branch (420:51): [True: 303, False: 0]
  |  Branch (420:73): [True: 303, False: 0]
  ------------------
  421|    303|			return FLOAT_CAN_RW_LE ;
  422|       |
  423|       |		/* If this test is true ints and floats are compatible and big endian. */
  424|      0|		if (data.c [3] == 0x52 && data.c [2] == 0x06 && data.c [1] == 0x9e && data.c [0] == 0x3f)
  ------------------
  |  Branch (424:7): [True: 0, False: 0]
  |  Branch (424:29): [True: 0, False: 0]
  |  Branch (424:51): [True: 0, False: 0]
  |  Branch (424:73): [True: 0, False: 0]
  ------------------
  425|      0|			return FLOAT_CAN_RW_BE ;
  426|      0|		} ;
  427|       |
  428|       |	/* Floats are broken. Don't expect reading or writing to be fast. */
  429|      0|	psf_log_printf (psf, "Using IEEE replacement code for float.\n") ;
  430|       |
  431|      0|	return (CPU_IS_LITTLE_ENDIAN) ? FLOAT_BROKEN_LE : FLOAT_BROKEN_BE ;
  ------------------
  |  |   14|      0|#define CPU_IS_LITTLE_ENDIAN 1
  ------------------
  |  Branch (431:9): [True: 0, Folded]
  ------------------
  432|    303|} /* float32_get_capability */
float32.c:host_read_f:
  574|  2.93k|{	BUF_UNION	ubuf ;
  575|  2.93k|	int			bufferlen, readcount ;
  576|  2.93k|	sf_count_t	total = 0 ;
  577|       |
  578|  2.93k|	if (psf->data_endswap != SF_TRUE)
  ------------------
  |  Branch (578:6): [True: 2.65k, False: 288]
  ------------------
  579|  2.65k|		return psf_fread (ptr, sizeof (float), len, psf) ;
  580|       |
  581|    288|	bufferlen = ARRAY_LEN (ubuf.fbuf) ;
  ------------------
  |  |   88|    288|#define		ARRAY_LEN(x)	((int) (sizeof (x) / sizeof ((x) [0])))
  ------------------
  582|       |
  583|    542|	while (len > 0)
  ------------------
  |  Branch (583:9): [True: 288, False: 254]
  ------------------
  584|    288|	{	if (len < bufferlen)
  ------------------
  |  Branch (584:8): [True: 288, False: 0]
  ------------------
  585|    288|			bufferlen = (int) len ;
  586|    288|		readcount = (int) psf_fread (ubuf.fbuf, sizeof (float), bufferlen, psf) ;
  587|       |
  588|    288|		endswap_int_copy ((int*) (ptr + total), ubuf.ibuf, readcount) ;
  589|       |
  590|    288|		total += readcount ;
  591|    288|		if (readcount < bufferlen)
  ------------------
  |  Branch (591:7): [True: 34, False: 254]
  ------------------
  592|     34|			break ;
  593|    254|		len -= readcount ;
  594|    254|		} ;
  595|       |
  596|    288|	return total ;
  597|  2.93k|} /* host_read_f */

g72x_init:
   72|    557|{	G72x_PRIVATE	*pg72x ;
   73|    557|	int	bitspersample, bytesperblock, codec ;
   74|       |
   75|    557|	if (psf->codec_data != NULL)
  ------------------
  |  Branch (75:6): [True: 0, False: 557]
  ------------------
   76|      0|	{	psf_log_printf (psf, "*** psf->codec_data is not NULL.\n") ;
   77|      0|		return SFE_INTERNAL ;
   78|    557|		} ;
   79|       |
   80|    557|	psf->sf.seekable = SF_FALSE ;
   81|       |
   82|    557|	if (psf->sf.channels != 1)
  ------------------
  |  Branch (82:6): [True: 4, False: 553]
  ------------------
   83|      4|		return SFE_G72X_NOT_MONO ;
   84|       |
   85|    553|	if ((pg72x = calloc (1, sizeof (G72x_PRIVATE))) == NULL)
  ------------------
  |  Branch (85:6): [True: 0, False: 553]
  ------------------
   86|      0|		return SFE_MALLOC_FAILED ;
   87|       |
   88|    553|	psf->codec_data = (void*) pg72x ;
   89|       |
   90|    553|	pg72x->block_curr = 0 ;
   91|    553|	pg72x->sample_curr = 0 ;
   92|       |
   93|    553|	switch (SF_CODEC (psf->sf.format))
  ------------------
  |  |  102|    553|#define SF_CODEC(x)			((x) & SF_FORMAT_SUBMASK)
  ------------------
   94|    553|	{	case SF_FORMAT_G721_32 :
  ------------------
  |  Branch (94:4): [True: 94, False: 459]
  ------------------
   95|     94|				codec = G721_32_BITS_PER_SAMPLE ;
   96|     94|				bytesperblock = G721_32_BYTES_PER_BLOCK ;
   97|     94|				bitspersample = G721_32_BITS_PER_SAMPLE ;
   98|     94|				break ;
   99|       |
  100|    381|		case SF_FORMAT_G723_24:
  ------------------
  |  Branch (100:3): [True: 381, False: 172]
  ------------------
  101|    381|				codec = G723_24_BITS_PER_SAMPLE ;
  102|    381|				bytesperblock = G723_24_BYTES_PER_BLOCK ;
  103|    381|				bitspersample = G723_24_BITS_PER_SAMPLE ;
  104|    381|				break ;
  105|       |
  106|     78|		case SF_FORMAT_G723_40:
  ------------------
  |  Branch (106:3): [True: 78, False: 475]
  ------------------
  107|     78|				codec = G723_40_BITS_PER_SAMPLE ;
  108|     78|				bytesperblock = G723_40_BYTES_PER_BLOCK ;
  109|     78|				bitspersample = G723_40_BITS_PER_SAMPLE ;
  110|     78|				break ;
  111|       |
  112|      0|		default : return SFE_UNIMPLEMENTED ;
  ------------------
  |  Branch (112:3): [True: 0, False: 553]
  ------------------
  113|    553|		} ;
  114|       |
  115|    553|	psf->filelength = psf_get_filelen (psf) ;
  116|    553|	if (psf->filelength < psf->dataoffset)
  ------------------
  |  Branch (116:6): [True: 5, False: 548]
  ------------------
  117|      5|		psf->filelength = psf->dataoffset ;
  118|       |
  119|    553|	psf->datalength = psf->filelength - psf->dataoffset ;
  120|    553|	if (psf->dataend > 0)
  ------------------
  |  Branch (120:6): [True: 6, False: 547]
  ------------------
  121|      6|		psf->datalength -= psf->filelength - psf->dataend ;
  122|       |
  123|    553|	if (psf->file.mode == SFM_READ)
  ------------------
  |  Branch (123:6): [True: 553, False: 0]
  ------------------
  124|    553|	{	pg72x->private = g72x_reader_init (codec, &(pg72x->blocksize), &(pg72x->samplesperblock)) ;
  125|    553|		if (pg72x->private == NULL)
  ------------------
  |  Branch (125:7): [True: 0, False: 553]
  ------------------
  126|      0|			return SFE_MALLOC_FAILED ;
  127|       |
  128|    553|		pg72x->bytesperblock = bytesperblock ;
  129|       |
  130|    553|		psf->read_short		= g72x_read_s ;
  131|    553|		psf->read_int		= g72x_read_i ;
  132|    553|		psf->read_float		= g72x_read_f ;
  133|    553|		psf->read_double	= g72x_read_d ;
  134|       |
  135|    553|		psf->seek = g72x_seek ;
  136|       |
  137|    553|		if (psf->datalength % pg72x->blocksize)
  ------------------
  |  Branch (137:7): [True: 537, False: 16]
  ------------------
  138|    537|		{	psf_log_printf (psf, "*** Odd psf->datalength (%D) should be a multiple of %d\n", psf->datalength, pg72x->blocksize) ;
  139|    537|			pg72x->blocks_total = (psf->datalength / pg72x->blocksize) + 1 ;
  140|    537|			}
  141|     16|		else
  142|     16|			pg72x->blocks_total = psf->datalength / pg72x->blocksize ;
  143|       |
  144|    553|		psf->sf.frames = (sf_count_t) pg72x->blocks_total * pg72x->samplesperblock ;
  145|       |
  146|    553|		psf_g72x_decode_block (psf, pg72x) ;
  147|    553|		}
  148|      0|	else if (psf->file.mode == SFM_WRITE)
  ------------------
  |  Branch (148:11): [True: 0, False: 0]
  ------------------
  149|      0|	{	pg72x->private = g72x_writer_init (codec, &(pg72x->blocksize), &(pg72x->samplesperblock)) ;
  150|      0|		if (pg72x->private == NULL)
  ------------------
  |  Branch (150:7): [True: 0, False: 0]
  ------------------
  151|      0|			return SFE_MALLOC_FAILED ;
  152|       |
  153|      0|		pg72x->bytesperblock = bytesperblock ;
  154|       |
  155|      0|		psf->write_short	= g72x_write_s ;
  156|      0|		psf->write_int		= g72x_write_i ;
  157|      0|		psf->write_float	= g72x_write_f ;
  158|      0|		psf->write_double	= g72x_write_d ;
  159|       |
  160|      0|		if (psf->datalength % pg72x->blocksize)
  ------------------
  |  Branch (160:7): [True: 0, False: 0]
  ------------------
  161|      0|			pg72x->blocks_total = (psf->datalength / pg72x->blocksize) + 1 ;
  162|      0|		else
  163|      0|			pg72x->blocks_total = psf->datalength / pg72x->blocksize ;
  164|       |
  165|      0|		if (psf->datalength > 0)
  ------------------
  |  Branch (165:7): [True: 0, False: 0]
  ------------------
  166|      0|			psf->sf.frames = (8 * psf->datalength) / bitspersample ;
  167|       |
  168|      0|		if ((psf->sf.frames * bitspersample) / 8 != psf->datalength)
  ------------------
  |  Branch (168:7): [True: 0, False: 0]
  ------------------
  169|      0|			psf_log_printf (psf, "*** Warning : weird psf->datalength.\n") ;
  170|    553|		} ;
  171|       |
  172|    553|	psf->codec_close	= g72x_close ;
  173|       |
  174|    553|	return 0 ;
  175|    553|} /* g72x_init */
g72x.c:psf_g72x_decode_block:
  183|  47.1k|{	int	k ;
  184|       |
  185|  47.1k|	pg72x->block_curr ++ ;
  186|  47.1k|	pg72x->sample_curr = 0 ;
  187|       |
  188|  47.1k|	if (pg72x->block_curr > pg72x->blocks_total)
  ------------------
  |  Branch (188:6): [True: 8, False: 47.1k]
  ------------------
  189|      8|	{	memset (pg72x->samples, 0, G72x_BLOCK_SIZE * sizeof (short)) ;
  ------------------
  |  |   32|      8|#define	G72x_BLOCK_SIZE		(3 * 5 * 8)
  ------------------
  190|      8|		return 1 ;
  191|  47.1k|		} ;
  192|       |
  193|  47.1k|	if ((k = psf_fread (pg72x->block, 1, pg72x->bytesperblock, psf)) != pg72x->bytesperblock)
  ------------------
  |  Branch (193:6): [True: 2.27k, False: 44.8k]
  ------------------
  194|  2.27k|		psf_log_printf (psf, "*** Warning : short read (%d != %d).\n", k, pg72x->bytesperblock) ;
  195|       |
  196|  47.1k|	pg72x->blocksize = k ;
  197|  47.1k|	g72x_decode_block (pg72x->private, pg72x->block, pg72x->samples) ;
  198|       |
  199|  47.1k|	return 1 ;
  200|  47.1k|} /* psf_g72x_decode_block */
g72x.c:g72x_read_block:
  204|  5.63M|{	int	count, total = 0, indx = 0 ;
  205|       |
  206|  11.2M|	while (indx < len)
  ------------------
  |  Branch (206:9): [True: 5.63M, False: 5.63M]
  ------------------
  207|  5.63M|	{	if (pg72x->block_curr > pg72x->blocks_total)
  ------------------
  |  Branch (207:8): [True: 0, False: 5.63M]
  ------------------
  208|      0|		{	memset (&(ptr [indx]), 0, (len - indx) * sizeof (short)) ;
  209|      0|			return total ;
  210|  5.63M|			} ;
  211|       |
  212|  5.63M|		if (pg72x->sample_curr >= pg72x->samplesperblock)
  ------------------
  |  Branch (212:7): [True: 46.6k, False: 5.58M]
  ------------------
  213|  46.6k|			psf_g72x_decode_block (psf, pg72x) ;
  214|       |
  215|  5.63M|		count = pg72x->samplesperblock - pg72x->sample_curr ;
  216|  5.63M|		count = (len - indx > count) ? count : len - indx ;
  ------------------
  |  Branch (216:11): [True: 0, False: 5.63M]
  ------------------
  217|       |
  218|  5.63M|		memcpy (&(ptr [indx]), &(pg72x->samples [pg72x->sample_curr]), count * sizeof (short)) ;
  219|  5.63M|		indx += count ;
  220|  5.63M|		pg72x->sample_curr += count ;
  221|  5.63M|		total = indx ;
  222|  5.63M|		} ;
  223|       |
  224|  5.63M|	return total ;
  225|  5.63M|} /* g72x_read_block */
g72x.c:g72x_read_f:
  284|  5.63M|{	BUF_UNION	ubuf ;
  285|  5.63M|	G72x_PRIVATE *pg72x ;
  286|  5.63M|	short		*sptr ;
  287|  5.63M|	int			k, bufferlen, readcount = 0, count ;
  288|  5.63M|	sf_count_t	total = 0 ;
  289|  5.63M|	float 		normfact ;
  290|       |
  291|  5.63M|	if (psf->codec_data == NULL)
  ------------------
  |  Branch (291:6): [True: 0, False: 5.63M]
  ------------------
  292|      0|		return 0 ;
  293|  5.63M|	pg72x = (G72x_PRIVATE*) psf->codec_data ;
  294|       |
  295|  5.63M|	normfact = (psf->norm_float == SF_TRUE) ? 1.0 / ((float) 0x8000) : 1.0 ;
  ------------------
  |  Branch (295:13): [True: 5.63M, False: 0]
  ------------------
  296|       |
  297|  5.63M|	sptr = ubuf.sbuf ;
  298|  5.63M|	bufferlen = SF_BUFFER_LEN / sizeof (short) ;
  ------------------
  |  |   72|  5.63M|#define	SF_BUFFER_LEN			(8192)
  ------------------
  299|  11.2M|	while (len > 0)
  ------------------
  |  Branch (299:9): [True: 5.63M, False: 5.63M]
  ------------------
  300|  5.63M|	{	readcount = (len >= bufferlen) ? bufferlen : (int) len ;
  ------------------
  |  Branch (300:16): [True: 0, False: 5.63M]
  ------------------
  301|  5.63M|		count = g72x_read_block (psf, pg72x, sptr, readcount) ;
  302|  11.2M|		for (k = 0 ; k < readcount ; k++)
  ------------------
  |  Branch (302:16): [True: 5.63M, False: 5.63M]
  ------------------
  303|  5.63M|			ptr [total + k] = normfact * sptr [k] ;
  304|       |
  305|  5.63M|		total += count ;
  306|  5.63M|		len -= readcount ;
  307|  5.63M|		if (count != readcount)
  ------------------
  |  Branch (307:7): [True: 0, False: 5.63M]
  ------------------
  308|      0|			break ;
  309|  5.63M|		} ;
  310|       |
  311|  5.63M|	return total ;
  312|  5.63M|} /* g72x_read_f */
g72x.c:g72x_close:
  587|    553|{	G72x_PRIVATE *pg72x ;
  588|       |
  589|    553|	pg72x = (G72x_PRIVATE*) psf->codec_data ;
  590|       |
  591|    553|	if (psf->file.mode == SFM_WRITE)
  ------------------
  |  Branch (591:6): [True: 0, False: 553]
  ------------------
  592|      0|	{	/*	If a block has been partially assembled, write it out
  593|       |		**	as the final block.
  594|       |		*/
  595|       |
  596|      0|		if (pg72x->sample_curr && pg72x->sample_curr < G72x_BLOCK_SIZE)
  ------------------
  |  |   32|      0|#define	G72x_BLOCK_SIZE		(3 * 5 * 8)
  ------------------
  |  Branch (596:7): [True: 0, False: 0]
  |  Branch (596:29): [True: 0, False: 0]
  ------------------
  597|      0|			psf_g72x_encode_block (psf, pg72x) ;
  598|       |
  599|      0|		if (psf->write_header)
  ------------------
  |  Branch (599:7): [True: 0, False: 0]
  ------------------
  600|      0|			psf->write_header (psf, SF_FALSE) ;
  601|      0|		} ;
  602|       |
  603|       |	/* Only free the pointer allocated by g72x_(reader|writer)_init. */
  604|    553|	free (pg72x->private) ;
  605|       |
  606|    553|	return 0 ;
  607|    553|} /* g72x_close */

gsm610_init:
   79|    518|{	GSM610_PRIVATE	*pgsm610 ;
   80|    518|	int		true_flag = 1 ;
   81|       |
   82|    518|	if (psf->codec_data != NULL)
  ------------------
  |  Branch (82:6): [True: 0, False: 518]
  ------------------
   83|      0|	{	psf_log_printf (psf, "*** psf->codec_data is not NULL.\n") ;
   84|      0|		return SFE_INTERNAL ;
   85|    518|		} ;
   86|       |
   87|    518|	if (psf->file.mode == SFM_RDWR)
  ------------------
  |  Branch (87:6): [True: 0, False: 518]
  ------------------
   88|      0|		return SFE_BAD_MODE_RW ;
   89|       |
   90|    518|	psf->sf.seekable = SF_FALSE ;
   91|       |
   92|    518|	if ((pgsm610 = calloc (1, sizeof (GSM610_PRIVATE))) == NULL)
  ------------------
  |  Branch (92:6): [True: 0, False: 518]
  ------------------
   93|      0|		return SFE_MALLOC_FAILED ;
   94|       |
   95|    518|	psf->codec_data = pgsm610 ;
   96|       |
   97|    518|	memset (pgsm610, 0, sizeof (GSM610_PRIVATE)) ;
   98|       |
   99|       |/*============================================================
  100|       |
  101|       |Need separate gsm_data structs for encode and decode.
  102|       |
  103|       |============================================================*/
  104|       |
  105|    518|	if ((pgsm610->gsm_data = gsm_create ()) == NULL)
  ------------------
  |  Branch (105:6): [True: 0, False: 518]
  ------------------
  106|      0|		return SFE_MALLOC_FAILED ;
  107|       |
  108|    518|	switch (SF_CONTAINER (psf->sf.format))
  ------------------
  |  |  101|    518|#define SF_CONTAINER(x)		((x) & SF_FORMAT_TYPEMASK)
  ------------------
  109|    518|	{	case SF_FORMAT_WAV :
  ------------------
  |  Branch (109:4): [True: 298, False: 220]
  ------------------
  110|    298|		case SF_FORMAT_WAVEX :
  ------------------
  |  Branch (110:3): [True: 0, False: 518]
  ------------------
  111|    347|		case SF_FORMAT_W64 :
  ------------------
  |  Branch (111:3): [True: 49, False: 469]
  ------------------
  112|    347|			gsm_option (pgsm610->gsm_data, GSM_OPT_WAV49, &true_flag) ;
  ------------------
  |  |   30|    347|#define	GSM_OPT_WAV49		4
  ------------------
  113|       |
  114|    347|			pgsm610->encode_block = gsm610_wav_encode_block ;
  115|    347|			pgsm610->decode_block = gsm610_wav_decode_block ;
  116|       |
  117|    347|			pgsm610->samplesperblock = WAVLIKE_GSM610_SAMPLES ;
  ------------------
  |  |  335|    347|#define		WAVLIKE_GSM610_SAMPLES		320
  ------------------
  118|    347|			pgsm610->blocksize = WAVLIKE_GSM610_BLOCKSIZE ;
  ------------------
  |  |  334|    347|#define		WAVLIKE_GSM610_BLOCKSIZE	65
  ------------------
  119|    347|			break ;
  120|       |
  121|    171|		case SF_FORMAT_AIFF :
  ------------------
  |  Branch (121:3): [True: 171, False: 347]
  ------------------
  122|    171|		case SF_FORMAT_RAW :
  ------------------
  |  Branch (122:3): [True: 0, False: 518]
  ------------------
  123|    171|			pgsm610->encode_block = gsm610_encode_block ;
  124|    171|			pgsm610->decode_block = gsm610_decode_block ;
  125|       |
  126|    171|			pgsm610->samplesperblock = GSM610_SAMPLES ;
  ------------------
  |  |   33|    171|#define	GSM610_SAMPLES			160
  ------------------
  127|    171|			pgsm610->blocksize = GSM610_BLOCKSIZE ;
  ------------------
  |  |   32|    171|#define	GSM610_BLOCKSIZE		33
  ------------------
  128|    171|			break ;
  129|       |
  130|      0|		default :
  ------------------
  |  Branch (130:3): [True: 0, False: 518]
  ------------------
  131|      0|			return SFE_INTERNAL ;
  132|      0|			break ;
  133|    518|		} ;
  134|       |
  135|    518|	if (psf->file.mode == SFM_READ)
  ------------------
  |  Branch (135:6): [True: 518, False: 0]
  ------------------
  136|    518|	{	if (psf->datalength % pgsm610->blocksize == 0)
  ------------------
  |  Branch (136:8): [True: 20, False: 498]
  ------------------
  137|     20|			pgsm610->blocks = psf->datalength / pgsm610->blocksize ;
  138|    498|		else if (psf->datalength % pgsm610->blocksize == 1 && pgsm610->blocksize == GSM610_BLOCKSIZE)
  ------------------
  |  |   32|     54|#define	GSM610_BLOCKSIZE		33
  ------------------
  |  Branch (138:12): [True: 54, False: 444]
  |  Branch (138:57): [True: 3, False: 51]
  ------------------
  139|      3|		{	/*
  140|       |			**	Weird AIFF specific case.
  141|       |			**	AIFF chunks must be at an even offset from the start of file and
  142|       |			**	GSM610_BLOCKSIZE is odd which can result in an odd length SSND
  143|       |			**	chunk. The SSND chunk then gets padded on write which means that
  144|       |			**	when it is read the datalength is too big by 1.
  145|       |			*/
  146|      3|			pgsm610->blocks = psf->datalength / pgsm610->blocksize ;
  147|      3|			}
  148|    495|		else
  149|    495|		{	psf_log_printf (psf, "*** Warning : data chunk seems to be truncated.\n") ;
  150|    495|			pgsm610->blocks = psf->datalength / pgsm610->blocksize + 1 ;
  151|    495|			} ;
  152|       |
  153|    518|		psf->sf.frames = (sf_count_t) pgsm610->samplesperblock * pgsm610->blocks ;
  154|       |
  155|    518|		psf_fseek (psf, psf->dataoffset, SEEK_SET) ;
  156|       |
  157|    518|		pgsm610->decode_block (psf, pgsm610) ;	/* Read first block. */
  158|       |
  159|    518|		psf->read_short		= gsm610_read_s ;
  160|    518|		psf->read_int		= gsm610_read_i ;
  161|    518|		psf->read_float		= gsm610_read_f ;
  162|    518|		psf->read_double	= gsm610_read_d ;
  163|    518|		} ;
  164|       |
  165|    518|	if (psf->file.mode == SFM_WRITE)
  ------------------
  |  Branch (165:6): [True: 0, False: 518]
  ------------------
  166|      0|	{	pgsm610->blockcount = 0 ;
  167|      0|		pgsm610->samplecount = 0 ;
  168|       |
  169|      0|		psf->write_short	= gsm610_write_s ;
  170|      0|		psf->write_int		= gsm610_write_i ;
  171|      0|		psf->write_float	= gsm610_write_f ;
  172|      0|		psf->write_double	= gsm610_write_d ;
  173|      0|		} ;
  174|       |
  175|    518|	psf->codec_close = gsm610_close ;
  176|       |
  177|    518|	psf->seek = gsm610_seek ;
  178|       |
  179|    518|	psf->filelength = psf_get_filelen (psf) ;
  180|    518|	psf->datalength = psf->filelength - psf->dataoffset ;
  181|       |
  182|    518|	return 0 ;
  183|    518|} /* gsm610_init */
gsm610.c:gsm610_wav_decode_block:
  191|  3.87k|{	int	k ;
  192|       |
  193|  3.87k|	pgsm610->blockcount ++ ;
  194|  3.87k|	pgsm610->samplecount = 0 ;
  195|       |
  196|  3.87k|	if (pgsm610->blockcount > pgsm610->blocks)
  ------------------
  |  Branch (196:6): [True: 41, False: 3.83k]
  ------------------
  197|     41|	{	memset (pgsm610->samples, 0, sizeof (pgsm610->samples)) ;
  198|     41|		return 1 ;
  199|  3.83k|		} ;
  200|       |
  201|  3.83k|	if ((k = (int) psf_fread (pgsm610->block, 1, WAVLIKE_GSM610_BLOCKSIZE, psf)) != WAVLIKE_GSM610_BLOCKSIZE)
  ------------------
  |  |  334|  3.83k|#define		WAVLIKE_GSM610_BLOCKSIZE	65
  ------------------
              	if ((k = (int) psf_fread (pgsm610->block, 1, WAVLIKE_GSM610_BLOCKSIZE, psf)) != WAVLIKE_GSM610_BLOCKSIZE)
  ------------------
  |  |  334|  3.83k|#define		WAVLIKE_GSM610_BLOCKSIZE	65
  ------------------
  |  Branch (201:6): [True: 302, False: 3.53k]
  ------------------
  202|    302|		psf_log_printf (psf, "*** Warning : short read (%d != %d).\n", k, WAVLIKE_GSM610_BLOCKSIZE) ;
  ------------------
  |  |  334|    302|#define		WAVLIKE_GSM610_BLOCKSIZE	65
  ------------------
  203|       |
  204|  3.83k|	if (gsm_decode (pgsm610->gsm_data, pgsm610->block, pgsm610->samples) < 0)
  ------------------
  |  Branch (204:6): [True: 0, False: 3.83k]
  ------------------
  205|      0|	{	psf_log_printf (psf, "Error from WAV gsm_decode() on frame : %d\n", pgsm610->blockcount) ;
  206|      0|		return 0 ;
  207|  3.83k|		} ;
  208|       |
  209|  3.83k|	if (gsm_decode (pgsm610->gsm_data, pgsm610->block + (WAVLIKE_GSM610_BLOCKSIZE + 1) / 2, pgsm610->samples + WAVLIKE_GSM610_SAMPLES / 2) < 0)
  ------------------
  |  |  334|  3.83k|#define		WAVLIKE_GSM610_BLOCKSIZE	65
  ------------------
              	if (gsm_decode (pgsm610->gsm_data, pgsm610->block + (WAVLIKE_GSM610_BLOCKSIZE + 1) / 2, pgsm610->samples + WAVLIKE_GSM610_SAMPLES / 2) < 0)
  ------------------
  |  |  335|  3.83k|#define		WAVLIKE_GSM610_SAMPLES		320
  ------------------
  |  Branch (209:6): [True: 0, False: 3.83k]
  ------------------
  210|      0|	{	psf_log_printf (psf, "Error from WAV gsm_decode() on frame : %d.5\n", pgsm610->blockcount) ;
  211|      0|		return 0 ;
  212|  3.83k|		} ;
  213|       |
  214|  3.83k|	return 1 ;
  215|  3.83k|} /* gsm610_wav_decode_block */
gsm610.c:gsm610_decode_block:
  219|  20.7k|{	int	k ;
  220|       |
  221|  20.7k|	pgsm610->blockcount ++ ;
  222|  20.7k|	pgsm610->samplecount = 0 ;
  223|       |
  224|  20.7k|	if (pgsm610->blockcount > pgsm610->blocks)
  ------------------
  |  Branch (224:6): [True: 43, False: 20.7k]
  ------------------
  225|     43|	{	memset (pgsm610->samples, 0, sizeof (pgsm610->samples)) ;
  226|     43|		return 1 ;
  227|  20.7k|		} ;
  228|       |
  229|  20.7k|	if ((k = (int) psf_fread (pgsm610->block, 1, GSM610_BLOCKSIZE, psf)) != GSM610_BLOCKSIZE)
  ------------------
  |  |   32|  20.7k|#define	GSM610_BLOCKSIZE		33
  ------------------
              	if ((k = (int) psf_fread (pgsm610->block, 1, GSM610_BLOCKSIZE, psf)) != GSM610_BLOCKSIZE)
  ------------------
  |  |   32|  20.7k|#define	GSM610_BLOCKSIZE		33
  ------------------
  |  Branch (229:6): [True: 77, False: 20.6k]
  ------------------
  230|     77|		psf_log_printf (psf, "*** Warning : short read (%d != %d).\n", k, GSM610_BLOCKSIZE) ;
  ------------------
  |  |   32|     77|#define	GSM610_BLOCKSIZE		33
  ------------------
  231|       |
  232|  20.7k|	if (gsm_decode (pgsm610->gsm_data, pgsm610->block, pgsm610->samples) < 0)
  ------------------
  |  Branch (232:6): [True: 18.7k, False: 1.95k]
  ------------------
  233|  18.7k|	{	psf_log_printf (psf, "Error from standard gsm_decode() on frame : %d\n", pgsm610->blockcount) ;
  234|  18.7k|		return 0 ;
  235|  18.7k|		} ;
  236|       |
  237|  1.95k|	return 1 ;
  238|  20.7k|} /* gsm610_decode_block */
gsm610.c:gsm610_read_block:
  242|  1.32M|{	int	count, total = 0, indx = 0 ;
  243|       |
  244|  2.67M|	while (indx < len)
  ------------------
  |  Branch (244:9): [True: 1.34M, False: 1.32M]
  ------------------
  245|  1.34M|	{	if (pgsm610->blockcount >= pgsm610->blocks && pgsm610->samplecount >= pgsm610->samplesperblock)
  ------------------
  |  Branch (245:8): [True: 82.6k, False: 1.26M]
  |  Branch (245:50): [True: 75, False: 82.5k]
  ------------------
  246|     75|		{	memset (ptr + indx, 0, (len - indx) * sizeof (short)) ;
  247|     75|			return total ;
  248|  1.34M|			} ;
  249|       |
  250|  1.34M|		if (pgsm610->samplecount >= pgsm610->samplesperblock)
  ------------------
  |  Branch (250:7): [True: 24.1k, False: 1.32M]
  ------------------
  251|  24.1k|			pgsm610->decode_block (psf, pgsm610) ;
  252|       |
  253|  1.34M|		count = pgsm610->samplesperblock - pgsm610->samplecount ;
  254|  1.34M|		count = (len - indx > count) ? count : len - indx ;
  ------------------
  |  Branch (254:11): [True: 19.9k, False: 1.32M]
  ------------------
  255|       |
  256|  1.34M|		memcpy (&(ptr [indx]), &(pgsm610->samples [pgsm610->samplecount]), count * sizeof (short)) ;
  257|  1.34M|		indx += count ;
  258|  1.34M|		pgsm610->samplecount += count ;
  259|  1.34M|		total = indx ;
  260|  1.34M|		} ;
  261|       |
  262|  1.32M|	return total ;
  263|  1.32M|} /* gsm610_read_block */
gsm610.c:gsm610_read_f:
  318|  1.32M|{	GSM610_PRIVATE *pgsm610 ;
  319|  1.32M|	BUF_UNION	ubuf ;
  320|  1.32M|	short		*sptr ;
  321|  1.32M|	int			k, bufferlen, readcount = 0, count ;
  322|  1.32M|	sf_count_t	total = 0 ;
  323|  1.32M|	float		normfact ;
  324|       |
  325|  1.32M|	if (psf->codec_data == NULL)
  ------------------
  |  Branch (325:6): [True: 0, False: 1.32M]
  ------------------
  326|      0|		return 0 ;
  327|  1.32M|	pgsm610 = (GSM610_PRIVATE*) psf->codec_data ;
  328|       |
  329|  1.32M|	normfact = (psf->norm_float == SF_TRUE) ? 1.0 / ((float) 0x8000) : 1.0 ;
  ------------------
  |  Branch (329:13): [True: 1.32M, False: 0]
  ------------------
  330|       |
  331|  1.32M|	sptr = ubuf.sbuf ;
  332|  1.32M|	bufferlen = ARRAY_LEN (ubuf.sbuf) ;
  ------------------
  |  |   88|  1.32M|#define		ARRAY_LEN(x)	((int) (sizeof (x) / sizeof ((x) [0])))
  ------------------
  333|  2.65M|	while (len > 0)
  ------------------
  |  Branch (333:9): [True: 1.32M, False: 1.32M]
  ------------------
  334|  1.32M|	{	readcount = (len >= bufferlen) ? bufferlen : (int) len ;
  ------------------
  |  Branch (334:16): [True: 0, False: 1.32M]
  ------------------
  335|  1.32M|		count = gsm610_read_block (psf, pgsm610, sptr, readcount) ;
  336|  5.85M|		for (k = 0 ; k < readcount ; k++)
  ------------------
  |  Branch (336:16): [True: 4.52M, False: 1.32M]
  ------------------
  337|  4.52M|			ptr [total + k] = normfact * sptr [k] ;
  338|       |
  339|  1.32M|		total += count ;
  340|  1.32M|		len -= readcount ;
  341|  1.32M|		} ;
  342|  1.32M|	return total ;
  343|  1.32M|} /* gsm610_read_f */
gsm610.c:gsm610_close:
  608|    518|{	GSM610_PRIVATE *pgsm610 ;
  609|       |
  610|    518|	if (psf->codec_data == NULL)
  ------------------
  |  Branch (610:6): [True: 0, False: 518]
  ------------------
  611|      0|		return 0 ;
  612|       |
  613|    518|	pgsm610 = (GSM610_PRIVATE*) psf->codec_data ;
  614|       |
  615|    518|	if (psf->file.mode == SFM_WRITE)
  ------------------
  |  Branch (615:6): [True: 0, False: 518]
  ------------------
  616|      0|	{	/*	If a block has been partially assembled, write it out
  617|       |		**	as the final block.
  618|       |		*/
  619|       |
  620|      0|		if (pgsm610->samplecount && pgsm610->samplecount < pgsm610->samplesperblock)
  ------------------
  |  Branch (620:7): [True: 0, False: 0]
  |  Branch (620:31): [True: 0, False: 0]
  ------------------
  621|      0|			pgsm610->encode_block (psf, pgsm610) ;
  622|      0|		} ;
  623|       |
  624|    518|	if (pgsm610->gsm_data)
  ------------------
  |  Branch (624:6): [True: 518, False: 0]
  ------------------
  625|    518|		gsm_destroy (pgsm610->gsm_data) ;
  626|       |
  627|    518|	return 0 ;
  628|    518|} /* gsm610_close */

htk_open:
   52|     77|{	int		subformat ;
   53|     77|	int		error = 0 ;
   54|       |
   55|     77|	if (psf->is_pipe)
  ------------------
  |  Branch (55:6): [True: 0, False: 77]
  ------------------
   56|      0|		return SFE_HTK_NO_PIPE ;
   57|       |
   58|     77|	if (psf->file.mode == SFM_READ || (psf->file.mode == SFM_RDWR && psf->filelength > 0))
  ------------------
  |  Branch (58:6): [True: 77, False: 0]
  |  Branch (58:37): [True: 0, False: 0]
  |  Branch (58:67): [True: 0, False: 0]
  ------------------
   59|     77|	{	if ((error = htk_read_header (psf)))
  ------------------
  |  Branch (59:8): [True: 0, False: 77]
  ------------------
   60|      0|			return error ;
   61|     77|		} ;
   62|       |
   63|     77|	subformat = SF_CODEC (psf->sf.format) ;
  ------------------
  |  |  102|     77|#define SF_CODEC(x)			((x) & SF_FORMAT_SUBMASK)
  ------------------
   64|       |
   65|     77|	if (psf->file.mode == SFM_WRITE || psf->file.mode == SFM_RDWR)
  ------------------
  |  Branch (65:6): [True: 0, False: 77]
  |  Branch (65:37): [True: 0, False: 77]
  ------------------
   66|      0|	{	if ((SF_CONTAINER (psf->sf.format)) != SF_FORMAT_HTK)
  ------------------
  |  |  101|      0|#define SF_CONTAINER(x)		((x) & SF_FORMAT_TYPEMASK)
  ------------------
  |  Branch (66:8): [True: 0, False: 0]
  ------------------
   67|      0|			return	SFE_BAD_OPEN_FORMAT ;
   68|       |
   69|      0|		psf->endian = SF_ENDIAN_BIG ;
   70|       |
   71|      0|		if (htk_write_header (psf, SF_FALSE))
  ------------------
  |  Branch (71:7): [True: 0, False: 0]
  ------------------
   72|      0|			return psf->error ;
   73|       |
   74|      0|		psf->write_header = htk_write_header ;
   75|     77|		} ;
   76|       |
   77|     77|	psf->container_close = htk_close ;
   78|       |
   79|     77|	psf->blockwidth = (sf_count_t) psf->bytewidth * psf->sf.channels ;
   80|       |
   81|     77|	switch (subformat)
   82|     77|	{	case SF_FORMAT_PCM_16 :	/* 16-bit linear PCM. */
  ------------------
  |  Branch (82:4): [True: 77, False: 0]
  ------------------
   83|     77|				error = pcm_init (psf) ;
   84|     77|				break ;
   85|       |
   86|      0|		default : break ;
  ------------------
  |  Branch (86:3): [True: 0, False: 77]
  ------------------
   87|     77|		} ;
   88|       |
   89|     77|	return error ;
   90|     77|} /* htk_open */
htk.c:htk_close:
   97|     77|{
   98|     77|	if (psf->file.mode == SFM_WRITE || psf->file.mode == SFM_RDWR)
  ------------------
  |  Branch (98:6): [True: 0, False: 77]
  |  Branch (98:37): [True: 0, False: 77]
  ------------------
   99|      0|		htk_write_header (psf, SF_TRUE) ;
  100|       |
  101|     77|	return 0 ;
  102|     77|} /* htk_close */
htk.c:htk_read_header:
  187|     77|{	int		sample_count, sample_period, marker ;
  188|       |
  189|     77|	psf_binheader_readf (psf, "pE444", 0, &sample_count, &sample_period, &marker) ;
  190|       |
  191|     77|	if (2 * sample_count + 12 != psf->filelength)
  ------------------
  |  Branch (191:6): [True: 0, False: 77]
  ------------------
  192|      0|		return SFE_HTK_BAD_FILE_LEN ;
  ------------------
  |  |   34|      0|#define	SFE_HTK_BAD_FILE_LEN 	1666
  ------------------
  193|       |
  194|     77|	if (marker != 0x20000)
  ------------------
  |  Branch (194:6): [True: 0, False: 77]
  ------------------
  195|      0|		return SFE_HTK_NOT_WAVEFORM ;
  ------------------
  |  |   35|      0|#define	SFE_HTK_NOT_WAVEFORM	1667
  ------------------
  196|       |
  197|     77|	psf->sf.channels = 1 ;
  198|       |
  199|       |	/*
  200|       |	**	A period above 10000000 (one sample per second) truncates the sample
  201|       |	**	rate to zero, which the header writer then divides by.
  202|       |	*/
  203|     77|	if (sample_period > 0 && sample_period <= 10000000)
  ------------------
  |  Branch (203:6): [True: 42, False: 35]
  |  Branch (203:27): [True: 22, False: 20]
  ------------------
  204|     22|	{	psf->sf.samplerate = 10000000 / sample_period ;
  205|     22|		psf_log_printf (psf, "HTK Waveform file\n  Sample Count  : %d\n  Sample Period : %d => %d Hz\n",
  206|     22|					sample_count, sample_period, psf->sf.samplerate) ;
  207|     22|		}
  208|     55|	else
  209|     55|	{	psf->sf.samplerate = 16000 ;
  210|     55|		psf_log_printf (psf, "HTK Waveform file\n  Sample Count  : %d\n  Sample Period : %d (should be 1 to 10000000) => Guessed sample rate %d Hz\n",
  211|     55|					sample_count, sample_period, psf->sf.samplerate) ;
  212|     55|		} ;
  213|       |
  214|     77|	psf->sf.format = SF_FORMAT_HTK | SF_FORMAT_PCM_16 ;
  215|     77|	psf->bytewidth = 2 ;
  216|       |
  217|       |	/* HTK always has a 12 byte header. */
  218|     77|	psf->dataoffset = 12 ;
  219|     77|	psf->endian = SF_ENDIAN_BIG ;
  220|       |
  221|     77|	psf->datalength = psf->filelength - psf->dataoffset ;
  222|       |
  223|     77|	psf->blockwidth = (sf_count_t) psf->sf.channels * psf->bytewidth ;
  224|       |
  225|     77|	if (! psf->sf.frames && psf->blockwidth)
  ------------------
  |  Branch (225:6): [True: 77, False: 0]
  |  Branch (225:26): [True: 77, False: 0]
  ------------------
  226|     77|		psf->sf.frames = (psf->filelength - psf->dataoffset) / psf->blockwidth ;
  227|       |
  228|     77|	return 0 ;
  229|     77|} /* htk_read_header */

id3_skip:
   68|  1.80k|{	unsigned char	buf [10] ;
   69|  1.80k|	int	offset ;
   70|       |
   71|  1.80k|	memset (buf, 0, sizeof (buf)) ;
   72|  1.80k|	psf_binheader_readf (psf, "pb", 0, buf, 10) ;
   73|       |
   74|  1.80k|	if (buf [0] == 'I' && buf [1] == 'D' && buf [2] == '3')
  ------------------
  |  Branch (74:6): [True: 1.80k, False: 0]
  |  Branch (74:24): [True: 1.80k, False: 0]
  |  Branch (74:42): [True: 1.80k, False: 0]
  ------------------
   75|  1.80k|	{	psf->id3_header.minor_version = buf [3] ;
   76|  1.80k|		offset = buf [6] & 0x7f ;
   77|  1.80k|		offset = (offset << 7) | (buf [7] & 0x7f) ;
   78|  1.80k|		offset = (offset << 7) | (buf [8] & 0x7f) ;
   79|  1.80k|		offset = (offset << 7) | (buf [9] & 0x7f) ;
   80|       |
   81|       |		/*
   82|       |		** ID3 count field is how many bytes of ID3v2 header FOLLOW the ten
   83|       |		** bytes of header magic and offset, NOT the total ID3v2 header len.
   84|       |		*/
   85|  1.80k|		psf->id3_header.len = offset + 10 ;
   86|  1.80k|		psf->id3_header.offset = psf->fileoffset ;
   87|       |
   88|  1.80k|		psf_log_printf (psf, "  ID3v2.%d header length :	%d\n----------------------------------------\n",
   89|  1.80k|			psf->id3_header.minor_version, psf->id3_header.len) ;
   90|       |
   91|       |		/* Never want to jump backwards in a file. */
   92|  1.80k|		if (offset < 0)
  ------------------
  |  Branch (92:7): [True: 0, False: 1.80k]
  ------------------
   93|      0|			return 0 ;
   94|       |
   95|       |		/* Position ourselves at the new file offset. */
   96|  1.80k|		if (psf->fileoffset + psf->id3_header.len < psf->filelength)
  ------------------
  |  Branch (96:7): [True: 1.75k, False: 51]
  ------------------
   97|  1.75k|		{	psf_binheader_readf (psf, "p!", psf->id3_header.len) ;
   98|  1.75k|			psf->fileoffset += psf->id3_header.len ;
   99|  1.75k|			return 1 ;
  100|  1.75k|			} ;
  101|     51|		} ;
  102|       |
  103|     51|	return 0 ;
  104|  1.80k|} /* id3_skip */

wavlike_ima_init:
  109|    190|{	int error ;
  110|       |
  111|    190|	if (psf->codec_data != NULL)
  ------------------
  |  Branch (111:6): [True: 0, False: 190]
  ------------------
  112|      0|	{	psf_log_printf (psf, "*** psf->codec_data is not NULL.\n") ;
  113|      0|		return SFE_INTERNAL ;
  114|    190|		} ;
  115|       |
  116|    190|	if (psf->file.mode == SFM_RDWR)
  ------------------
  |  Branch (116:6): [True: 0, False: 190]
  ------------------
  117|      0|		return SFE_BAD_MODE_RW ;
  118|       |
  119|    190|	if (psf->file.mode == SFM_READ)
  ------------------
  |  Branch (119:6): [True: 190, False: 0]
  ------------------
  120|    190|		if ((error = ima_reader_init (psf, blockalign, samplesperblock)))
  ------------------
  |  Branch (120:7): [True: 53, False: 137]
  ------------------
  121|     53|			return error ;
  122|       |
  123|    137|	if (psf->file.mode == SFM_WRITE)
  ------------------
  |  Branch (123:6): [True: 0, False: 137]
  ------------------
  124|      0|		if ((error = ima_writer_init (psf, blockalign)))
  ------------------
  |  Branch (124:7): [True: 0, False: 0]
  ------------------
  125|      0|			return error ;
  126|       |
  127|    137|	psf->codec_close = ima_close ;
  128|    137|	psf->seek = wavlike_ima_seek ;
  129|       |
  130|    137|	return 0 ;
  131|    137|} /* wavlike_ima_init */
aiff_ima_init:
  135|    163|{	int error ;
  136|       |
  137|    163|	if (psf->file.mode == SFM_RDWR)
  ------------------
  |  Branch (137:6): [True: 0, False: 163]
  ------------------
  138|      0|		return SFE_BAD_MODE_RW ;
  139|       |
  140|    163|	if (psf->file.mode == SFM_READ)
  ------------------
  |  Branch (140:6): [True: 163, False: 0]
  ------------------
  141|    163|		if ((error = ima_reader_init (psf, blockalign, samplesperblock)))
  ------------------
  |  Branch (141:7): [True: 0, False: 163]
  ------------------
  142|      0|			return error ;
  143|       |
  144|    163|	if (psf->file.mode == SFM_WRITE)
  ------------------
  |  Branch (144:6): [True: 0, False: 163]
  ------------------
  145|      0|		if ((error = ima_writer_init (psf, blockalign)))
  ------------------
  |  Branch (145:7): [True: 0, False: 0]
  ------------------
  146|      0|			return error ;
  147|       |
  148|    163|	psf->codec_close = ima_close ;
  149|    163|	psf->seek = aiff_ima_seek ;
  150|       |
  151|    163|	return 0 ;
  152|    163|} /* aiff_ima_init */
ima_adpcm.c:ima_close:
  156|    300|{	IMA_ADPCM_PRIVATE *pima ;
  157|       |
  158|    300|	pima = (IMA_ADPCM_PRIVATE*) psf->codec_data ;
  159|       |
  160|    300|	if (psf->file.mode == SFM_WRITE)
  ------------------
  |  Branch (160:6): [True: 0, False: 300]
  ------------------
  161|      0|	{	/*	If a block has been partially assembled, write it out
  162|       |		**	as the final block.
  163|       |		*/
  164|      0|		if (pima->samplecount && pima->samplecount < pima->samplesperblock)
  ------------------
  |  Branch (164:7): [True: 0, False: 0]
  |  Branch (164:28): [True: 0, False: 0]
  ------------------
  165|      0|			pima->encode_block (psf, pima) ;
  166|       |
  167|      0|		psf->sf.frames = (sf_count_t) pima->samplesperblock * pima->blockcount / psf->sf.channels ;
  168|      0|		} ;
  169|       |
  170|    300|	return 0 ;
  171|    300|} /* ima_close */
ima_adpcm.c:ima_reader_init:
  179|    353|{	IMA_ADPCM_PRIVATE	*pima ;
  180|    353|	int		pimasize, count ;
  181|       |
  182|    353|	if (psf->file.mode != SFM_READ)
  ------------------
  |  Branch (182:6): [True: 0, False: 353]
  ------------------
  183|      0|		return SFE_BAD_MODE_RW ;
  184|       |
  185|       |	/*
  186|       |	**	Allocate enough space for 1 more than a multiple of 8 samples
  187|       |	**	to avoid having to branch when pulling apart the nibbles.
  188|       |	*/
  189|    353|	count = ((samplesperblock - 2) | 7) + 2 ;
  190|    353|	pimasize = sizeof (IMA_ADPCM_PRIVATE) + psf->sf.channels * (blockalign + samplesperblock + sizeof (short) * count) ;
  191|       |
  192|    353|	if (! (pima = calloc (1, pimasize)))
  ------------------
  |  Branch (192:6): [True: 0, False: 353]
  ------------------
  193|      0|		return SFE_MALLOC_FAILED ;
  194|       |
  195|    353|	psf->codec_data = (void*) pima ;
  196|       |
  197|    353|	pima->samples	= pima->data ;
  198|    353|	pima->block		= (unsigned char*) (pima->data + samplesperblock * psf->sf.channels) ;
  199|       |
  200|    353|	pima->channels			= psf->sf.channels ;
  201|    353|	pima->blocksize			= blockalign ;
  202|    353|	pima->samplesperblock	= samplesperblock ;
  203|       |
  204|    353|	psf->filelength = psf_get_filelen (psf) ;
  205|    353|	psf->datalength = (psf->dataend) ? psf->dataend - psf->dataoffset :
  ------------------
  |  Branch (205:20): [True: 35, False: 318]
  ------------------
  206|    353|							psf->filelength - psf->dataoffset ;
  207|       |
  208|    353|	if (pima->blocksize <= 0)
  ------------------
  |  Branch (208:6): [True: 2, False: 351]
  ------------------
  209|      2|	{	psf_log_printf (psf, "*** Error : pima->blocksize should be > 0.\n") ;
  210|      2|		return SFE_INTERNAL ;
  211|    351|		} ;
  212|       |
  213|    351|	if (pima->samplesperblock <= 0)
  ------------------
  |  Branch (213:6): [True: 0, False: 351]
  ------------------
  214|      0|	{	psf_log_printf (psf, "*** Error : pima->samplesperblock should be > 0.\n") ;
  215|      0|		return SFE_INTERNAL ;
  216|    351|		} ;
  217|       |
  218|    351|	if (psf->datalength % pima->blocksize)
  ------------------
  |  Branch (218:6): [True: 292, False: 59]
  ------------------
  219|    292|		pima->blocks = psf->datalength / pima->blocksize + 1 ;
  220|     59|	else
  221|     59|		pima->blocks = psf->datalength / pima->blocksize ;
  222|       |
  223|    351|	switch (SF_CONTAINER (psf->sf.format))
  ------------------
  |  |  101|    351|#define SF_CONTAINER(x)		((x) & SF_FORMAT_TYPEMASK)
  ------------------
  224|    351|	{	case SF_FORMAT_WAV :
  ------------------
  |  Branch (224:4): [True: 187, False: 164]
  ------------------
  225|    188|		case SF_FORMAT_W64 :
  ------------------
  |  Branch (225:3): [True: 1, False: 350]
  ------------------
  226|    188|				count = 2 * (pima->blocksize - 4 * pima->channels) / pima->channels + 1 ;
  227|       |
  228|    188|				if (pima->samplesperblock != count)
  ------------------
  |  Branch (228:9): [True: 51, False: 137]
  ------------------
  229|     51|				{	psf_log_printf (psf, "*** Error : samplesperblock should be %d.\n", count) ;
  230|     51|					return SFE_INTERNAL ;
  231|    137|					} ;
  232|       |
  233|    137|				pima->decode_block = wavlike_ima_decode_block ;
  234|       |
  235|    137|				psf->sf.frames = (sf_count_t) pima->samplesperblock * pima->blocks ;
  236|    137|				break ;
  237|       |
  238|    163|		case SF_FORMAT_AIFF :
  ------------------
  |  Branch (238:3): [True: 163, False: 188]
  ------------------
  239|    163|				psf_log_printf (psf, "still need to check block count\n") ;
  240|    163|				pima->decode_block = aiff_ima_decode_block ;
  241|    163|				psf->sf.frames = (sf_count_t) pima->samplesperblock * pima->blocks / pima->channels ;
  242|    163|				break ;
  243|       |
  244|      0|		default :
  ------------------
  |  Branch (244:3): [True: 0, False: 351]
  ------------------
  245|      0|				psf_log_printf (psf, "ima_reader_init: bad psf->sf.format\n") ;
  246|      0|				return SFE_INTERNAL ;
  247|    351|		} ;
  248|       |
  249|    300|	pima->decode_block (psf, pima) ;	/* Read first block. */
  250|       |
  251|    300|	psf->read_short		= ima_read_s ;
  252|    300|	psf->read_int		= ima_read_i ;
  253|    300|	psf->read_float		= ima_read_f ;
  254|    300|	psf->read_double	= ima_read_d ;
  255|       |
  256|    300|	return 0 ;
  257|    351|} /* ima_reader_init */
ima_adpcm.c:wavlike_ima_decode_block:
  390|  58.7k|{	int		chan, k, predictor, blockindx, indx, indxstart, diff ;
  391|  58.7k|	short	step, bytecode, stepindx [2] = { 0 } ;
  392|       |
  393|  58.7k|	pima->blockcount ++ ;
  394|  58.7k|	pima->samplecount = 0 ;
  395|       |
  396|  58.7k|	if (pima->blockcount > pima->blocks)
  ------------------
  |  Branch (396:6): [True: 2, False: 58.7k]
  ------------------
  397|      2|	{	memset (pima->samples, 0, pima->samplesperblock * pima->channels * sizeof (short)) ;
  398|      2|		return 1 ;
  399|  58.7k|		} ;
  400|       |
  401|  58.7k|	if ((k = (int) psf_fread (pima->block, 1, pima->blocksize, psf)) != pima->blocksize)
  ------------------
  |  Branch (401:6): [True: 120, False: 58.6k]
  ------------------
  402|    120|		psf_log_printf (psf, "*** Warning : short read (%d != %d).\n", k, pima->blocksize) ;
  403|       |
  404|       |	/* Read and check the block header. */
  405|       |
  406|   118k|	for (chan = 0 ; chan < pima->channels ; chan++)
  ------------------
  |  Branch (406:18): [True: 59.3k, False: 58.7k]
  ------------------
  407|  59.3k|	{	predictor = pima->block [chan*4] | (pima->block [chan*4+1] << 8) ;
  408|  59.3k|		if (predictor & 0x8000)
  ------------------
  |  Branch (408:7): [True: 11.8k, False: 47.4k]
  ------------------
  409|  11.8k|			predictor -= 0x10000 ;
  410|       |
  411|  59.3k|		stepindx [chan] = pima->block [chan*4+2] ;
  412|  59.3k|		stepindx [chan] = clamp_ima_step_index (stepindx [chan]) ;
  413|       |
  414|       |
  415|  59.3k|		if (pima->block [chan*4+3] != 0)
  ------------------
  |  Branch (415:7): [True: 34.8k, False: 24.4k]
  ------------------
  416|  34.8k|			psf_log_printf (psf, "IMA ADPCM synchronisation error.\n") ;
  417|       |
  418|  59.3k|		pima->samples [chan] = predictor ;
  419|  59.3k|		} ;
  420|       |
  421|       |	/*
  422|       |	**	Pull apart the packed 4 bit samples and store them in their
  423|       |	**	correct sample positions.
  424|       |	*/
  425|       |
  426|  58.7k|	blockindx = 4 * pima->channels ;
  427|       |
  428|  58.7k|	indxstart = pima->channels ;
  429|   129k|	while (blockindx < pima->blocksize)
  ------------------
  |  Branch (429:9): [True: 71.2k, False: 58.7k]
  ------------------
  430|   143k|	{	for (chan = 0 ; chan < pima->channels ; chan++)
  ------------------
  |  Branch (430:20): [True: 71.8k, False: 71.2k]
  ------------------
  431|  71.8k|		{	indx = indxstart + chan ;
  432|   359k|			for (k = 0 ; k < 4 ; k++)
  ------------------
  |  Branch (432:17): [True: 287k, False: 71.8k]
  ------------------
  433|   287k|			{	bytecode = pima->block [blockindx++] ;
  434|   287k|				pima->samples [indx] = bytecode & 0x0F ;
  435|   287k|				indx += pima->channels ;
  436|   287k|				pima->samples [indx] = (bytecode >> 4) & 0x0F ;
  437|   287k|				indx += pima->channels ;
  438|   287k|				} ;
  439|  71.8k|			} ;
  440|  71.2k|		indxstart += 8 * pima->channels ;
  441|  71.2k|		} ;
  442|       |
  443|       |	/* Decode the encoded 4 bit samples. */
  444|       |
  445|   285k|	for (k = pima->channels ; k < (pima->samplesperblock * pima->channels) ; k ++)
  ------------------
  |  Branch (445:28): [True: 226k, False: 58.7k]
  ------------------
  446|   226k|	{	chan = (pima->channels > 1) ? (k % 2) : 0 ;
  ------------------
  |  Branch (446:11): [True: 8.17k, False: 218k]
  ------------------
  447|       |
  448|   226k|		bytecode = pima->samples [k] & 0xF ;
  449|       |
  450|   226k|		step = ima_step_size [stepindx [chan]] ;
  451|   226k|		predictor = pima->samples [k - pima->channels] ;
  452|       |
  453|   226k|		diff = step >> 3 ;
  454|   226k|		if (bytecode & 1)
  ------------------
  |  Branch (454:7): [True: 36.9k, False: 189k]
  ------------------
  455|  36.9k|			diff += step >> 2 ;
  456|   226k|		if (bytecode & 2)
  ------------------
  |  Branch (456:7): [True: 38.2k, False: 188k]
  ------------------
  457|  38.2k|			diff += step >> 1 ;
  458|   226k|		if (bytecode & 4)
  ------------------
  |  Branch (458:7): [True: 39.7k, False: 187k]
  ------------------
  459|  39.7k|			diff += step ;
  460|   226k|		if (bytecode & 8)
  ------------------
  |  Branch (460:7): [True: 33.8k, False: 193k]
  ------------------
  461|  33.8k|			diff = -diff ;
  462|       |
  463|   226k|		predictor += diff ;
  464|       |
  465|   226k|		if (predictor > 32767)
  ------------------
  |  Branch (465:7): [True: 12.2k, False: 214k]
  ------------------
  466|  12.2k|			predictor = 32767 ;
  467|   214k|		else if (predictor < -32768)
  ------------------
  |  Branch (467:12): [True: 13.9k, False: 200k]
  ------------------
  468|  13.9k|			predictor = -32768 ;
  469|       |
  470|   226k|		stepindx [chan] += ima_indx_adjust [bytecode] ;
  471|   226k|		stepindx [chan] = clamp_ima_step_index (stepindx [chan]) ;
  472|       |
  473|   226k|		pima->samples [k] = predictor ;
  474|   226k|		} ;
  475|       |
  476|  58.7k|	return 1 ;
  477|  58.7k|} /* wavlike_ima_decode_block */
ima_adpcm.c:clamp_ima_step_index:
   95|   648k|{	if (indx < 0)
  ------------------
  |  Branch (95:7): [True: 400k, False: 248k]
  ------------------
   96|   400k|		return 0 ;
   97|   248k|	if (indx >= ARRAY_LEN (ima_step_size))
  ------------------
  |  |   88|   248k|#define		ARRAY_LEN(x)	((int) (sizeof (x) / sizeof ((x) [0])))
  ------------------
  |  Branch (97:6): [True: 78.7k, False: 169k]
  ------------------
   98|  78.7k|		return ARRAY_LEN (ima_step_size) - 1 ;
  ------------------
  |  |   88|  78.7k|#define		ARRAY_LEN(x)	((int) (sizeof (x) / sizeof ((x) [0])))
  ------------------
   99|       |
  100|   169k|	return indx ;
  101|   248k|} /* clamp_ima_step_index */
ima_adpcm.c:aiff_ima_decode_block:
  261|  1.91k|{	unsigned char *blockdata ;
  262|  1.91k|	int		chan, k, diff, bytecode, predictor ;
  263|  1.91k|	short	step, stepindx, *sampledata ;
  264|       |
  265|  1.91k|	pima->blockcount += pima->channels ;
  266|  1.91k|	pima->samplecount = 0 ;
  267|       |
  268|  1.91k|	if (pima->blockcount > pima->blocks)
  ------------------
  |  Branch (268:6): [True: 54, False: 1.85k]
  ------------------
  269|     54|	{	memset (pima->samples, 0, pima->samplesperblock * pima->channels * sizeof (short)) ;
  270|     54|		return 1 ;
  271|  1.85k|		} ;
  272|       |
  273|  1.85k|	if ((k = (int) psf_fread (pima->block, 1, pima->blocksize * pima->channels, psf)) != pima->blocksize * pima->channels)
  ------------------
  |  Branch (273:6): [True: 84, False: 1.77k]
  ------------------
  274|     84|		psf_log_printf (psf, "*** Warning : short read (%d != %d).\n", k, pima->blocksize) ;
  275|       |
  276|       |	/* Read and check the block header. */
  277|  7.43k|	for (chan = 0 ; chan < pima->channels ; chan++)
  ------------------
  |  Branch (277:18): [True: 5.57k, False: 1.85k]
  ------------------
  278|  5.57k|	{	blockdata = pima->block + chan * 34 ;
  279|  5.57k|		sampledata = pima->samples + chan ;
  280|       |
  281|       |		/* Sign-extend from 16 bits to 32. */
  282|  5.57k|		predictor = (int) ((short) ((blockdata [0] << 8) | (blockdata [1] & 0x80))) ;
  283|       |
  284|  5.57k|		stepindx = blockdata [1] & 0x7F ;
  285|  5.57k|		stepindx = clamp_ima_step_index (stepindx) ;
  286|       |
  287|       |		/*
  288|       |		**	Pull apart the packed 4 bit samples and store them in their
  289|       |		**	correct sample positions.
  290|       |		*/
  291|   183k|		for (k = 0 ; k < pima->blocksize - 2 ; k++)
  ------------------
  |  Branch (291:16): [True: 178k, False: 5.57k]
  ------------------
  292|   178k|		{	bytecode = blockdata [k + 2] ;
  293|   178k|			sampledata [pima->channels * (2 * k + 0)] = bytecode & 0xF ;
  294|   178k|			sampledata [pima->channels * (2 * k + 1)] = (bytecode >> 4) & 0xF ;
  295|   178k|			} ;
  296|       |
  297|       |		/* Decode the encoded 4 bit samples. */
  298|   362k|		for (k = 0 ; k < pima->samplesperblock ; k ++)
  ------------------
  |  Branch (298:16): [True: 356k, False: 5.57k]
  ------------------
  299|   356k|		{	step = ima_step_size [stepindx] ;
  300|       |
  301|   356k|			bytecode = pima->samples [pima->channels * k + chan] ;
  302|       |
  303|   356k|			stepindx += ima_indx_adjust [bytecode] ;
  304|   356k|			stepindx = clamp_ima_step_index (stepindx) ;
  305|       |
  306|   356k|			diff = step >> 3 ;
  307|   356k|			if (bytecode & 1)	diff += step >> 2 ;
  ------------------
  |  Branch (307:8): [True: 42.2k, False: 314k]
  ------------------
  308|   356k|			if (bytecode & 2)	diff += step >> 1 ;
  ------------------
  |  Branch (308:8): [True: 47.2k, False: 309k]
  ------------------
  309|   356k|			if (bytecode & 4)	diff += step ;
  ------------------
  |  Branch (309:8): [True: 56.7k, False: 299k]
  ------------------
  310|   356k|			if (bytecode & 8)	diff = -diff ;
  ------------------
  |  Branch (310:8): [True: 44.0k, False: 312k]
  ------------------
  311|       |
  312|   356k|			predictor += diff ;
  313|   356k|			if (predictor < -32768)
  ------------------
  |  Branch (313:8): [True: 25.1k, False: 331k]
  ------------------
  314|  25.1k|				predictor = -32768 ;
  315|   331k|			else if (predictor > 32767)
  ------------------
  |  Branch (315:13): [True: 26.4k, False: 305k]
  ------------------
  316|  26.4k|				predictor = 32767 ;
  317|       |
  318|   356k|			pima->samples [pima->channels * k + chan] = predictor ;
  319|   356k|			} ;
  320|  5.57k|		} ;
  321|       |
  322|  1.85k|	return 1 ;
  323|  1.91k|} /* aiff_ima_decode_block */
ima_adpcm.c:ima_read_block:
  569|   395k|{	int		count, total = 0, indx = 0 ;
  570|       |
  571|   791k|	while (indx < len)
  ------------------
  |  Branch (571:9): [True: 395k, False: 395k]
  ------------------
  572|   395k|	{	if (pima->blockcount >= pima->blocks && pima->samplecount >= pima->samplesperblock)
  ------------------
  |  Branch (572:8): [True: 106k, False: 288k]
  |  Branch (572:44): [True: 0, False: 106k]
  ------------------
  573|      0|		{	memset (&(ptr [indx]), 0, (size_t) ((len - indx) * sizeof (short))) ;
  574|      0|			return total ;
  575|   395k|			} ;
  576|       |
  577|   395k|		if (pima->samplecount >= pima->samplesperblock)
  ------------------
  |  Branch (577:7): [True: 60.4k, False: 335k]
  ------------------
  578|  60.4k|			pima->decode_block (psf, pima) ;
  579|       |
  580|   395k|		count = (pima->samplesperblock - pima->samplecount) * pima->channels ;
  581|   395k|		count = (len - indx > count) ? count : len - indx ;
  ------------------
  |  Branch (581:11): [True: 0, False: 395k]
  ------------------
  582|       |
  583|   395k|		memcpy (&(ptr [indx]), &(pima->samples [pima->samplecount * pima->channels]), count * sizeof (short)) ;
  584|   395k|		indx += count ;
  585|   395k|		pima->samplecount += count / pima->channels ;
  586|   395k|		total = indx ;
  587|   395k|		} ;
  588|       |
  589|   395k|	return total ;
  590|   395k|} /* ima_read_block */
ima_adpcm.c:ima_read_f:
  646|   395k|{	IMA_ADPCM_PRIVATE *pima ;
  647|   395k|	BUF_UNION	ubuf ;
  648|   395k|	short		*sptr ;
  649|   395k|	int			k, bufferlen, readcount, count ;
  650|   395k|	sf_count_t	total = 0 ;
  651|   395k|	float		normfact ;
  652|       |
  653|   395k|	if (! psf->codec_data)
  ------------------
  |  Branch (653:6): [True: 0, False: 395k]
  ------------------
  654|      0|		return 0 ;
  655|   395k|	pima = (IMA_ADPCM_PRIVATE*) psf->codec_data ;
  656|       |
  657|   395k|	normfact = (psf->norm_float == SF_TRUE) ? 1.0 / ((float) 0x8000) : 1.0 ;
  ------------------
  |  Branch (657:13): [True: 395k, False: 0]
  ------------------
  658|       |
  659|   395k|	sptr = ubuf.sbuf ;
  660|   395k|	bufferlen = ARRAY_LEN (ubuf.sbuf) ;
  ------------------
  |  |   88|   395k|#define		ARRAY_LEN(x)	((int) (sizeof (x) / sizeof ((x) [0])))
  ------------------
  661|   791k|	while (len > 0)
  ------------------
  |  Branch (661:9): [True: 395k, False: 395k]
  ------------------
  662|   395k|	{	readcount = (len >= bufferlen) ? bufferlen : (int) len ;
  ------------------
  |  Branch (662:16): [True: 0, False: 395k]
  ------------------
  663|   395k|		count = ima_read_block (psf, pima, sptr, readcount) ;
  664|  1.02M|		for (k = 0 ; k < readcount ; k++)
  ------------------
  |  Branch (664:16): [True: 628k, False: 395k]
  ------------------
  665|   628k|			ptr [total + k] = normfact * (float) (sptr [k]) ;
  666|   395k|		total += count ;
  667|   395k|		len -= readcount ;
  668|   395k|		if (count != readcount)
  ------------------
  |  Branch (668:7): [True: 0, False: 395k]
  ------------------
  669|      0|			break ;
  670|   395k|		} ;
  671|       |
  672|   395k|	return total ;
  673|   395k|} /* ima_read_f */

ircam_open:
   80|    362|{	int		subformat ;
   81|    362|	int		error = SFE_NO_ERROR ;
   82|       |
   83|    362|	if (psf->file.mode == SFM_READ || (psf->file.mode == SFM_RDWR && psf->filelength > 0))
  ------------------
  |  Branch (83:6): [True: 362, False: 0]
  |  Branch (83:37): [True: 0, False: 0]
  |  Branch (83:67): [True: 0, False: 0]
  ------------------
   84|    362|	{	if ((error = ircam_read_header (psf)))
  ------------------
  |  Branch (84:8): [True: 221, False: 141]
  ------------------
   85|    221|			return error ;
   86|    362|		} ;
   87|       |
   88|    141|	subformat = SF_CODEC (psf->sf.format) ;
  ------------------
  |  |  102|    141|#define SF_CODEC(x)			((x) & SF_FORMAT_SUBMASK)
  ------------------
   89|       |
   90|    141|	if (psf->file.mode == SFM_WRITE || psf->file.mode == SFM_RDWR)
  ------------------
  |  Branch (90:6): [True: 0, False: 141]
  |  Branch (90:37): [True: 0, False: 141]
  ------------------
   91|      0|	{	if ((SF_CONTAINER (psf->sf.format)) != SF_FORMAT_IRCAM)
  ------------------
  |  |  101|      0|#define SF_CONTAINER(x)		((x) & SF_FORMAT_TYPEMASK)
  ------------------
  |  Branch (91:8): [True: 0, False: 0]
  ------------------
   92|      0|			return	SFE_BAD_OPEN_FORMAT ;
   93|       |
   94|      0|		psf->endian = SF_ENDIAN (psf->sf.format) ;
  ------------------
  |  |  103|      0|#define SF_ENDIAN(x)		((x) & SF_FORMAT_ENDMASK)
  ------------------
   95|      0|		if (psf->endian == 0 || psf->endian == SF_ENDIAN_CPU)
  ------------------
  |  Branch (95:7): [True: 0, False: 0]
  |  Branch (95:27): [True: 0, False: 0]
  ------------------
   96|      0|			psf->endian = (CPU_IS_BIG_ENDIAN) ? SF_ENDIAN_BIG : SF_ENDIAN_LITTLE ;
  ------------------
  |  |   11|      0|#define CPU_IS_BIG_ENDIAN 0
  ------------------
  |  Branch (96:18): [Folded, False: 0]
  ------------------
   97|       |
   98|      0|		psf->dataoffset = IRCAM_DATA_OFFSET ;
  ------------------
  |  |   47|      0|#define IRCAM_DATA_OFFSET	(1024)
  ------------------
   99|       |
  100|      0|		if ((error = ircam_write_header (psf, SF_FALSE)))
  ------------------
  |  Branch (100:7): [True: 0, False: 0]
  ------------------
  101|      0|			return error ;
  102|       |
  103|      0|		psf->write_header = ircam_write_header ;
  104|    141|		} ;
  105|       |
  106|    141|	psf->container_close = ircam_close ;
  107|       |
  108|    141|	switch (subformat)
  109|    141|	{	case SF_FORMAT_ULAW :		/* 8-bit Ulaw encoding. */
  ------------------
  |  Branch (109:4): [True: 5, False: 136]
  ------------------
  110|      5|				error = ulaw_init (psf) ;
  111|      5|				break ;
  112|       |
  113|     56|		case SF_FORMAT_ALAW :		/* 8-bit Alaw encoding. */
  ------------------
  |  Branch (113:3): [True: 56, False: 85]
  ------------------
  114|     56|				error = alaw_init (psf) ;
  115|     56|				break ;
  116|       |
  117|     35|		case SF_FORMAT_PCM_16 :	/* 16-bit linear PCM. */
  ------------------
  |  Branch (117:3): [True: 35, False: 106]
  ------------------
  118|     43|		case SF_FORMAT_PCM_32 :	/* 32-bit linear PCM. */
  ------------------
  |  Branch (118:3): [True: 8, False: 133]
  ------------------
  119|     43|				error = pcm_init (psf) ;
  120|     43|				break ;
  121|       |
  122|     37|		case SF_FORMAT_FLOAT :	/* 32-bit linear PCM. */
  ------------------
  |  Branch (122:3): [True: 37, False: 104]
  ------------------
  123|     37|				error = float32_init (psf) ;
  124|     37|				break ;
  125|       |
  126|      0|		default : break ;
  ------------------
  |  Branch (126:3): [True: 0, False: 141]
  ------------------
  127|    141|		} ;
  128|       |
  129|    141|	return error ;
  130|    141|} /* ircam_open */
ircam.c:ircam_read_header:
  137|    362|{	unsigned int	marker, encoding ;
  138|    362|	float			samplerate ;
  139|    362|	int				error = SFE_NO_ERROR ;
  140|       |
  141|    362|	psf_binheader_readf (psf, "epmf44", 0, &marker, &samplerate, &(psf->sf.channels), &encoding) ;
  142|       |
  143|    362|	if (((marker & IRCAM_BE_MASK) != IRCAM_BE_MARKER) && ((marker & IRCAM_LE_MASK) != IRCAM_LE_MARKER))
  ------------------
  |  |   38|    362|#define IRCAM_BE_MASK		(MAKE_MARKER (0xFF, 0xFF, 0x00, 0xFF))
  |  |  ------------------
  |  |  |  |  122|    362|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
              	if (((marker & IRCAM_BE_MASK) != IRCAM_BE_MARKER) && ((marker & IRCAM_LE_MASK) != IRCAM_LE_MARKER))
  ------------------
  |  |   39|    362|#define IRCAM_BE_MARKER		(MAKE_MARKER (0x64, 0xA3, 0x00, 0x00))
  |  |  ------------------
  |  |  |  |  122|    362|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
              	if (((marker & IRCAM_BE_MASK) != IRCAM_BE_MARKER) && ((marker & IRCAM_LE_MASK) != IRCAM_LE_MARKER))
  ------------------
  |  |   41|     83|#define IRCAM_LE_MASK		(MAKE_MARKER (0xFF, 0x00, 0xFF, 0xFF))
  |  |  ------------------
  |  |  |  |  122|     83|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
              	if (((marker & IRCAM_BE_MASK) != IRCAM_BE_MARKER) && ((marker & IRCAM_LE_MASK) != IRCAM_LE_MARKER))
  ------------------
  |  |   42|     83|#define IRCAM_LE_MARKER		(MAKE_MARKER (0x00, 0x00, 0xA3, 0x64))
  |  |  ------------------
  |  |  |  |  122|     83|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (143:6): [True: 83, False: 279]
  |  Branch (143:55): [True: 0, False: 83]
  ------------------
  144|      0|	{	psf_log_printf (psf, "marker: 0x%X\n", marker) ;
  145|      0|		return SFE_IRCAM_NO_MARKER ;
  146|    362|		} ;
  147|       |
  148|    362|	psf->endian = SF_ENDIAN_LITTLE ;
  149|       |
  150|    362|	if (psf->sf.channels > SF_MAX_CHANNELS)
  ------------------
  |  |   95|    362|#define		SF_MAX_CHANNELS		1024
  ------------------
  |  Branch (150:6): [True: 162, False: 200]
  ------------------
  151|    162|	{	psf_binheader_readf (psf, "Epmf44", 0, &marker, &samplerate, &(psf->sf.channels), &encoding) ;
  152|       |
  153|       |		/* Sanity checking for endian-ness detection. */
  154|    162|		if (psf->sf.channels > SF_MAX_CHANNELS)
  ------------------
  |  |   95|    162|#define		SF_MAX_CHANNELS		1024
  ------------------
  |  Branch (154:7): [True: 23, False: 139]
  ------------------
  155|     23|		{	psf_log_printf (psf, "marker: 0x%X\n", marker) ;
  156|     23|			return SFE_IRCAM_BAD_CHANNELS ;
  157|    139|			} ;
  158|       |
  159|    139|		psf->endian = SF_ENDIAN_BIG ;
  160|    339|		} ;
  161|       |
  162|    339|	psf_log_printf (psf, "marker: 0x%X\n", marker) ;
  163|       |
  164|    339|	psf->sf.samplerate = psf_lrintf (samplerate) ;
  165|       |
  166|    339|	psf_log_printf (psf,	"  Sample Rate : %d\n"
  167|    339|							"  Channels    : %d\n"
  168|    339|							"  Encoding    : %X => %s\n",
  169|    339|						psf->sf.samplerate, psf->sf.channels, encoding, get_encoding_str (encoding)) ;
  170|       |
  171|    339|	switch (encoding)
  172|    339|	{	case IRCAM_PCM_16 :
  ------------------
  |  Branch (172:4): [True: 35, False: 304]
  ------------------
  173|     35|				psf->bytewidth = 2 ;
  174|     35|				psf->blockwidth = (sf_count_t) psf->sf.channels * psf->bytewidth ;
  175|       |
  176|     35|				psf->sf.format = SF_FORMAT_IRCAM | SF_FORMAT_PCM_16 ;
  177|     35|				break ;
  178|       |
  179|      8|		case IRCAM_PCM_32 :
  ------------------
  |  Branch (179:3): [True: 8, False: 331]
  ------------------
  180|      8|				psf->bytewidth = 4 ;
  181|      8|				psf->blockwidth = (sf_count_t) psf->sf.channels * psf->bytewidth ;
  182|       |
  183|      8|				psf->sf.format = SF_FORMAT_IRCAM | SF_FORMAT_PCM_32 ;
  184|      8|				break ;
  185|       |
  186|     37|		case IRCAM_FLOAT :
  ------------------
  |  Branch (186:3): [True: 37, False: 302]
  ------------------
  187|     37|				psf->bytewidth = 4 ;
  188|     37|				psf->blockwidth = (sf_count_t) psf->sf.channels * psf->bytewidth ;
  189|       |
  190|     37|				psf->sf.format = SF_FORMAT_IRCAM | SF_FORMAT_FLOAT ;
  191|     37|				break ;
  192|       |
  193|     56|		case IRCAM_ALAW :
  ------------------
  |  Branch (193:3): [True: 56, False: 283]
  ------------------
  194|     56|				psf->bytewidth = 1 ;
  195|     56|				psf->blockwidth = (sf_count_t) psf->sf.channels * psf->bytewidth ;
  196|       |
  197|     56|				psf->sf.format = SF_FORMAT_IRCAM | SF_FORMAT_ALAW ;
  198|     56|				break ;
  199|       |
  200|      5|		case IRCAM_ULAW :
  ------------------
  |  Branch (200:3): [True: 5, False: 334]
  ------------------
  201|      5|				psf->bytewidth = 1 ;
  202|      5|				psf->blockwidth = (sf_count_t) psf->sf.channels * psf->bytewidth ;
  203|       |
  204|      5|				psf->sf.format = SF_FORMAT_IRCAM | SF_FORMAT_ULAW ;
  205|      5|				break ;
  206|       |
  207|    198|		default :
  ------------------
  |  Branch (207:3): [True: 198, False: 141]
  ------------------
  208|    198|				error = SFE_IRCAM_UNKNOWN_FORMAT ;
  209|    198|				break ;
  210|    339|		} ;
  211|       |
  212|    339|	if (psf->endian == SF_ENDIAN_BIG)
  ------------------
  |  Branch (212:6): [True: 139, False: 200]
  ------------------
  213|    139|		psf->sf.format |= SF_ENDIAN_BIG ;
  214|    200|	else
  215|    200|		psf->sf.format |= SF_ENDIAN_LITTLE ;
  216|       |
  217|    339|	if (error)
  ------------------
  |  Branch (217:6): [True: 198, False: 141]
  ------------------
  218|    198|		return error ;
  219|       |
  220|    141|	psf->dataoffset = IRCAM_DATA_OFFSET ;
  ------------------
  |  |   47|    141|#define IRCAM_DATA_OFFSET	(1024)
  ------------------
  221|    141|	psf->datalength = psf->filelength - psf->dataoffset ;
  222|       |
  223|    141|	if (psf->sf.frames == 0 && psf->blockwidth)
  ------------------
  |  Branch (223:6): [True: 141, False: 0]
  |  Branch (223:29): [True: 137, False: 4]
  ------------------
  224|    137|		psf->sf.frames = psf->datalength / psf->blockwidth ;
  225|       |
  226|    141|	psf_log_printf (psf, "  Samples     : %d\n", psf->sf.frames) ;
  227|       |
  228|    141|	psf_binheader_readf (psf, "p", IRCAM_DATA_OFFSET) ;
  ------------------
  |  |   47|    141|#define IRCAM_DATA_OFFSET	(1024)
  ------------------
  229|       |
  230|    141|	return 0 ;
  231|    339|} /* ircam_read_header */
ircam.c:get_encoding_str:
  314|    339|{	switch (encoding)
  ------------------
  |  Branch (314:11): [True: 141, False: 198]
  ------------------
  315|    339|	{	case IRCAM_PCM_16	: return "16 bit PCM" ;
  ------------------
  |  Branch (315:4): [True: 35, False: 304]
  ------------------
  316|     37|		case IRCAM_FLOAT	: return "32 bit float" ;
  ------------------
  |  Branch (316:3): [True: 37, False: 302]
  ------------------
  317|     56|		case IRCAM_ALAW		: return "A law" ;
  ------------------
  |  Branch (317:3): [True: 56, False: 283]
  ------------------
  318|      5|		case IRCAM_ULAW		: return "u law" ;
  ------------------
  |  Branch (318:3): [True: 5, False: 334]
  ------------------
  319|      8|		case IRCAM_PCM_32	: return "32 bit PCM" ;
  ------------------
  |  Branch (319:3): [True: 8, False: 331]
  ------------------
  320|    339|		} ;
  321|    198|	return "Unknown encoding" ;
  322|    339|} /* get_encoding_str */
ircam.c:ircam_close:
  235|    141|{
  236|    141|	psf_log_printf (psf, "close\n") ;
  237|       |
  238|    141|	return 0 ;
  239|    141|} /* ircam_close */

mat4_open:
   77|    607|{	int		subformat, error = 0 ;
   78|       |
   79|    607|	if (psf->file.mode == SFM_READ || (psf->file.mode == SFM_RDWR && psf->filelength > 0))
  ------------------
  |  Branch (79:6): [True: 607, False: 0]
  |  Branch (79:37): [True: 0, False: 0]
  |  Branch (79:67): [True: 0, False: 0]
  ------------------
   80|    607|	{	if ((error = mat4_read_header (psf)))
  ------------------
  |  Branch (80:8): [True: 396, False: 211]
  ------------------
   81|    396|			return error ;
   82|    607|		} ;
   83|       |
   84|    211|	if ((SF_CONTAINER (psf->sf.format)) != SF_FORMAT_MAT4)
  ------------------
  |  |  101|    211|#define SF_CONTAINER(x)		((x) & SF_FORMAT_TYPEMASK)
  ------------------
  |  Branch (84:6): [True: 0, False: 211]
  ------------------
   85|      0|		return	SFE_BAD_OPEN_FORMAT ;
   86|       |
   87|    211|	subformat = SF_CODEC (psf->sf.format) ;
  ------------------
  |  |  102|    211|#define SF_CODEC(x)			((x) & SF_FORMAT_SUBMASK)
  ------------------
   88|       |
   89|    211|	if (psf->file.mode == SFM_WRITE || psf->file.mode == SFM_RDWR)
  ------------------
  |  Branch (89:6): [True: 0, False: 211]
  |  Branch (89:37): [True: 0, False: 211]
  ------------------
   90|      0|	{	if (psf->is_pipe)
  ------------------
  |  Branch (90:8): [True: 0, False: 0]
  ------------------
   91|      0|			return SFE_NO_PIPE_WRITE ;
   92|       |
   93|      0|		psf->endian = SF_ENDIAN (psf->sf.format) ;
  ------------------
  |  |  103|      0|#define SF_ENDIAN(x)		((x) & SF_FORMAT_ENDMASK)
  ------------------
   94|      0|		if (CPU_IS_LITTLE_ENDIAN && (psf->endian == SF_ENDIAN_CPU || psf->endian == 0))
  ------------------
  |  |   14|      0|#define CPU_IS_LITTLE_ENDIAN 1
  |  |  ------------------
  |  |  |  Branch (14:30): [True: 0, Folded]
  |  |  ------------------
  ------------------
  |  Branch (94:32): [True: 0, False: 0]
  |  Branch (94:64): [True: 0, False: 0]
  ------------------
   95|      0|			psf->endian = SF_ENDIAN_LITTLE ;
   96|      0|		else if (CPU_IS_BIG_ENDIAN && (psf->endian == SF_ENDIAN_CPU || psf->endian == 0))
  ------------------
  |  |   11|      0|#define CPU_IS_BIG_ENDIAN 0
  |  |  ------------------
  |  |  |  Branch (11:27): [Folded, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (96:34): [True: 0, False: 0]
  |  Branch (96:66): [True: 0, False: 0]
  ------------------
   97|      0|			psf->endian = SF_ENDIAN_BIG ;
   98|       |
   99|      0|		if ((error = mat4_write_header (psf, SF_FALSE)))
  ------------------
  |  Branch (99:7): [True: 0, False: 0]
  ------------------
  100|      0|			return error ;
  101|       |
  102|      0|		psf->write_header = mat4_write_header ;
  103|    211|		} ;
  104|       |
  105|    211|	psf->container_close = mat4_close ;
  106|       |
  107|    211|	psf->blockwidth = (sf_count_t) psf->bytewidth * psf->sf.channels ;
  108|       |
  109|    211|	switch (subformat)
  110|    211|	{	case SF_FORMAT_PCM_16 :
  ------------------
  |  Branch (110:4): [True: 15, False: 196]
  ------------------
  111|     48|		case SF_FORMAT_PCM_32 :
  ------------------
  |  Branch (111:3): [True: 33, False: 178]
  ------------------
  112|     48|				error = pcm_init (psf) ;
  113|     48|				break ;
  114|       |
  115|     43|		case SF_FORMAT_FLOAT :
  ------------------
  |  Branch (115:3): [True: 43, False: 168]
  ------------------
  116|     43|				error = float32_init (psf) ;
  117|     43|				break ;
  118|       |
  119|    120|		case SF_FORMAT_DOUBLE :
  ------------------
  |  Branch (119:3): [True: 120, False: 91]
  ------------------
  120|    120|				error = double64_init (psf) ;
  121|    120|				break ;
  122|       |
  123|      0|		default : break ;
  ------------------
  |  Branch (123:3): [True: 0, False: 211]
  ------------------
  124|    211|		} ;
  125|       |
  126|    211|	return error ;
  127|    211|} /* mat4_open */
mat4.c:mat4_close:
  134|    211|{
  135|    211|	if (psf->file.mode == SFM_WRITE || psf->file.mode == SFM_RDWR)
  ------------------
  |  Branch (135:6): [True: 0, False: 211]
  |  Branch (135:37): [True: 0, False: 211]
  ------------------
  136|      0|		mat4_write_header (psf, SF_TRUE) ;
  137|       |
  138|    211|	return 0 ;
  139|    211|} /* mat4_close */
mat4.c:mat4_read_header:
  206|    607|{	char	buffer [256] ;
  207|    607|	uint32_t marker, namesize ;
  208|    607|	int		rows, cols, imag ;
  209|    607|	sf_count_t	datasize ;
  210|    607|	double	value ;
  211|    607|	const char *marker_str ;
  212|    607|	char	name [64] ;
  213|       |
  214|    607|	psf_binheader_readf (psf, "pm", 0, &marker) ;
  215|       |
  216|       |	/* MAT4 file must start with a double for the samplerate. */
  217|    607|	if (marker == MAT4_BE_DOUBLE)
  ------------------
  |  |   42|    607|#define MAT4_BE_DOUBLE	(MAKE_MARKER (0, 0, 0x03, 0xE8))
  |  |  ------------------
  |  |  |  |  122|    607|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (217:6): [True: 54, False: 553]
  ------------------
  218|     54|	{	psf->endian = psf->rwf_endian = SF_ENDIAN_BIG ;
  219|     54|		marker_str = "big endian double" ;
  220|     54|		}
  221|    553|	else if (marker == MAT4_LE_DOUBLE)
  ------------------
  |  |   43|    553|#define MAT4_LE_DOUBLE	(MAKE_MARKER (0, 0, 0, 0))
  |  |  ------------------
  |  |  |  |  122|    553|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (221:11): [True: 553, False: 0]
  ------------------
  222|    553|	{	psf->endian = psf->rwf_endian = SF_ENDIAN_LITTLE ;
  223|    553|		marker_str = "little endian double" ;
  224|    553|		}
  225|      0|	else
  226|      0|		return SFE_UNIMPLEMENTED ;
  227|       |
  228|    607|	psf_log_printf (psf, "GNU Octave 2.0 / MATLAB v4.2 format\nMarker : %s\n", marker_str) ;
  229|       |
  230|    607|	psf_binheader_readf (psf, "444", &rows, &cols, &imag) ;
  231|       |
  232|    607|	psf_log_printf (psf, " Rows  : %d\n Cols  : %d\n Imag  : %s\n", rows, cols, imag ? "True" : "False") ;
  ------------------
  |  Branch (232:78): [True: 513, False: 94]
  ------------------
  233|       |
  234|    607|	psf_binheader_readf (psf, "4", &namesize) ;
  235|       |
  236|    607|	if (namesize >= SIGNED_SIZEOF (name))
  ------------------
  |  |   86|    607|#define		SIGNED_SIZEOF(x)	((int) sizeof (x))
  ------------------
  |  Branch (236:6): [True: 34, False: 573]
  ------------------
  237|     34|		return SFE_MAT4_BAD_NAME ;
  238|       |
  239|    573|	psf_binheader_readf (psf, "b", name, namesize) ;
  240|    573|	name [namesize] = 0 ;
  241|       |
  242|    573|	psf_log_printf (psf, " Name  : %s\n", name) ;
  243|       |
  244|    573|	psf_binheader_readf (psf, "d", &value) ;
  245|       |
  246|    573|	snprintf (buffer, sizeof (buffer), " Value : %f\n", value) ;
  247|    573|	psf_log_printf (psf, buffer) ;
  248|       |
  249|    573|	if ((rows != 1) || (cols != 1))
  ------------------
  |  Branch (249:6): [True: 0, False: 573]
  |  Branch (249:21): [True: 0, False: 573]
  ------------------
  250|      0|		return SFE_MAT4_NO_SAMPLERATE ;
  251|       |
  252|    573|	psf->sf.samplerate = psf_lrint (value) ;
  253|       |
  254|       |	/* Now write out the audio data. */
  255|       |
  256|    573|	psf_binheader_readf (psf, "m", &marker) ;
  257|       |
  258|    573|	psf_log_printf (psf, "Marker : %s\n", mat4_marker_to_str (marker)) ;
  259|       |
  260|    573|	psf_binheader_readf (psf, "444", &rows, &cols, &imag) ;
  261|       |
  262|    573|	psf_log_printf (psf, " Rows  : %d\n Cols  : %d\n Imag  : %s\n", rows, cols, imag ? "True" : "False") ;
  ------------------
  |  Branch (262:78): [True: 408, False: 165]
  ------------------
  263|       |
  264|    573|	psf_binheader_readf (psf, "4", &namesize) ;
  265|       |
  266|    573|	if (namesize >= SIGNED_SIZEOF (name))
  ------------------
  |  |   86|    573|#define		SIGNED_SIZEOF(x)	((int) sizeof (x))
  ------------------
  |  Branch (266:6): [True: 38, False: 535]
  ------------------
  267|     38|		return SFE_MAT4_BAD_NAME ;
  268|       |
  269|    535|	psf_binheader_readf (psf, "b", name, namesize) ;
  270|    535|	name [namesize] = 0 ;
  271|       |
  272|    535|	psf_log_printf (psf, " Name  : %s\n", name) ;
  273|       |
  274|    535|	psf->dataoffset = psf_ftell (psf) ;
  275|       |
  276|    535|	if (rows == 0)
  ------------------
  |  Branch (276:6): [True: 148, False: 387]
  ------------------
  277|    148|	{	psf_log_printf (psf, "*** Error : zero channel count.\n") ;
  278|    148|		return SFE_CHANNEL_COUNT_ZERO ;
  279|    148|		}
  280|    387|	else if (rows < 0)
  ------------------
  |  Branch (280:11): [True: 43, False: 344]
  ------------------
  281|     43|	{	psf_log_printf (psf, "*** Error : negative channel count %d.\n", rows) ;
  282|     43|		return SFE_CHANNEL_COUNT_BAD ;
  283|     43|		}
  284|    344|	else if (rows > SF_MAX_CHANNELS)
  ------------------
  |  |   95|    344|#define		SF_MAX_CHANNELS		1024
  ------------------
  |  Branch (284:11): [True: 25, False: 319]
  ------------------
  285|     25|	{	psf_log_printf (psf, "*** Error : channel count %d > SF_MAX_CHANNELS.\n", rows) ;
  286|     25|		return SFE_CHANNEL_COUNT ;
  287|    319|		} ;
  288|       |
  289|    319|	psf->sf.channels	= rows ;
  290|    319|	psf->sf.frames		= cols ;
  291|       |
  292|    319|	psf->sf.format = psf->endian | SF_FORMAT_MAT4 ;
  293|    319|	switch (marker)
  294|    319|	{	case MAT4_BE_DOUBLE :
  ------------------
  |  |   42|      5|#define MAT4_BE_DOUBLE	(MAKE_MARKER (0, 0, 0x03, 0xE8))
  |  |  ------------------
  |  |  |  |  122|      5|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (294:4): [True: 5, False: 314]
  ------------------
  295|    120|		case MAT4_LE_DOUBLE :
  ------------------
  |  |   43|    120|#define MAT4_LE_DOUBLE	(MAKE_MARKER (0, 0, 0, 0))
  |  |  ------------------
  |  |  |  |  122|    120|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (295:3): [True: 115, False: 204]
  ------------------
  296|    120|				psf->sf.format |= SF_FORMAT_DOUBLE ;
  297|    120|				psf->bytewidth = 8 ;
  298|    120|				break ;
  299|       |
  300|      3|		case MAT4_BE_FLOAT :
  ------------------
  |  |   45|      3|#define MAT4_BE_FLOAT	(MAKE_MARKER (0, 0, 0x03, 0xF2))
  |  |  ------------------
  |  |  |  |  122|      3|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (300:3): [True: 3, False: 316]
  ------------------
  301|     43|		case MAT4_LE_FLOAT :
  ------------------
  |  |   46|     43|#define MAT4_LE_FLOAT	(MAKE_MARKER (0x0A, 0, 0, 0))
  |  |  ------------------
  |  |  |  |  122|     43|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (301:3): [True: 40, False: 279]
  ------------------
  302|     43|				psf->sf.format |= SF_FORMAT_FLOAT ;
  303|     43|				psf->bytewidth = 4 ;
  304|     43|				break ;
  305|       |
  306|      1|		case MAT4_BE_PCM_32	:
  ------------------
  |  |   48|      1|#define MAT4_BE_PCM_32	(MAKE_MARKER (0, 0, 0x03, 0xFC))
  |  |  ------------------
  |  |  |  |  122|      1|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (306:3): [True: 1, False: 318]
  ------------------
  307|     33|		case MAT4_LE_PCM_32	:
  ------------------
  |  |   49|     33|#define MAT4_LE_PCM_32	(MAKE_MARKER (0x14, 0, 0, 0))
  |  |  ------------------
  |  |  |  |  122|     33|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (307:3): [True: 32, False: 287]
  ------------------
  308|     33|				psf->sf.format |= SF_FORMAT_PCM_32 ;
  309|     33|				psf->bytewidth = 4 ;
  310|     33|				break ;
  311|       |
  312|      2|		case MAT4_BE_PCM_16	:
  ------------------
  |  |   51|      2|#define MAT4_BE_PCM_16	(MAKE_MARKER (0, 0, 0x04, 0x06))
  |  |  ------------------
  |  |  |  |  122|      2|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (312:3): [True: 2, False: 317]
  ------------------
  313|     15|		case MAT4_LE_PCM_16	:
  ------------------
  |  |   52|     15|#define MAT4_LE_PCM_16	(MAKE_MARKER (0x1E, 0, 0, 0))
  |  |  ------------------
  |  |  |  |  122|     15|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (313:3): [True: 13, False: 306]
  ------------------
  314|     15|				psf->sf.format |= SF_FORMAT_PCM_16 ;
  315|     15|				psf->bytewidth = 2 ;
  316|     15|				break ;
  317|       |
  318|    108|		default :
  ------------------
  |  Branch (318:3): [True: 108, False: 211]
  ------------------
  319|    108|				psf_log_printf (psf, "*** Error : Bad marker %08X\n", marker) ;
  320|    108|				return SFE_UNIMPLEMENTED ;
  321|    319|		} ;
  322|       |
  323|       |	/* rows and cols are 32 bit values taken from the file. Now that rows has
  324|       |	** been checked to be in the range [1, SF_MAX_CHANNELS] the product cannot
  325|       |	** overflow sf_count_t. */
  326|    211|	datasize = (sf_count_t) rows * (sf_count_t) cols * psf->bytewidth ;
  327|       |
  328|    211|	if ((psf->filelength - psf->dataoffset) < datasize)
  ------------------
  |  Branch (328:6): [True: 18, False: 193]
  ------------------
  329|     18|	{	psf_log_printf (psf, "*** File seems to be truncated. %D <--> %D\n",
  330|     18|				psf->filelength - psf->dataoffset, datasize) ;
  331|     18|		}
  332|    193|	else if ((psf->filelength - psf->dataoffset) > datasize)
  ------------------
  |  Branch (332:11): [True: 191, False: 2]
  ------------------
  333|    191|		psf->dataend = psf->dataoffset + datasize ;
  334|       |
  335|    211|	psf->datalength = psf->filelength - psf->dataoffset - psf->dataend ;
  336|       |
  337|    211|	psf->sf.sections = 1 ;
  338|       |
  339|    211|	return 0 ;
  340|    319|} /* mat4_read_header */
mat4.c:mat4_marker_to_str:
  378|    573|{	static char str [32] ;
  379|       |
  380|    573|	switch (marker)
  ------------------
  |  Branch (380:10): [True: 309, False: 264]
  ------------------
  381|    573|	{
  382|      4|		case MAT4_BE_PCM_16	:	return "big endian 16 bit PCM" ;
  ------------------
  |  |   51|      4|#define MAT4_BE_PCM_16	(MAKE_MARKER (0, 0, 0x04, 0x06))
  |  |  ------------------
  |  |  |  |  122|      4|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (382:3): [True: 4, False: 569]
  ------------------
  383|     14|		case MAT4_LE_PCM_16	:	return "little endian 16 bit PCM" ;
  ------------------
  |  |   52|     14|#define MAT4_LE_PCM_16	(MAKE_MARKER (0x1E, 0, 0, 0))
  |  |  ------------------
  |  |  |  |  122|     14|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (383:3): [True: 14, False: 559]
  ------------------
  384|       |
  385|      2|		case MAT4_BE_PCM_32	:	return "big endian 32 bit PCM" ;
  ------------------
  |  |   48|      2|#define MAT4_BE_PCM_32	(MAKE_MARKER (0, 0, 0x03, 0xFC))
  |  |  ------------------
  |  |  |  |  122|      2|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (385:3): [True: 2, False: 571]
  ------------------
  386|     33|		case MAT4_LE_PCM_32	:	return "little endian 32 bit PCM" ;
  ------------------
  |  |   49|     33|#define MAT4_LE_PCM_32	(MAKE_MARKER (0x14, 0, 0, 0))
  |  |  ------------------
  |  |  |  |  122|     33|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (386:3): [True: 33, False: 540]
  ------------------
  387|       |
  388|       |
  389|      4|		case MAT4_BE_FLOAT :	return "big endian float" ;
  ------------------
  |  |   45|      4|#define MAT4_BE_FLOAT	(MAKE_MARKER (0, 0, 0x03, 0xF2))
  |  |  ------------------
  |  |  |  |  122|      4|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (389:3): [True: 4, False: 569]
  ------------------
  390|     43|		case MAT4_LE_FLOAT :	return "big endian float" ;
  ------------------
  |  |   46|     43|#define MAT4_LE_FLOAT	(MAKE_MARKER (0x0A, 0, 0, 0))
  |  |  ------------------
  |  |  |  |  122|     43|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (390:3): [True: 43, False: 530]
  ------------------
  391|       |
  392|      6|		case MAT4_BE_DOUBLE	:	return "big endian double" ;
  ------------------
  |  |   42|      6|#define MAT4_BE_DOUBLE	(MAKE_MARKER (0, 0, 0x03, 0xE8))
  |  |  ------------------
  |  |  |  |  122|      6|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (392:3): [True: 6, False: 567]
  ------------------
  393|    203|		case MAT4_LE_DOUBLE	:	return "little endian double" ;
  ------------------
  |  |   43|    203|#define MAT4_LE_DOUBLE	(MAKE_MARKER (0, 0, 0, 0))
  |  |  ------------------
  |  |  |  |  122|    203|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (393:3): [True: 203, False: 370]
  ------------------
  394|    573|		} ;
  395|       |
  396|       |	/* This is a little unsafe but is really only for debugging. */
  397|    264|	str [sizeof (str) - 1] = 0 ;
  398|    264|	snprintf (str, sizeof (str) - 1, "%08X", marker) ;
  399|    264|	return str ;
  400|    573|} /* mat4_marker_to_str */

mat5_open:
   87|    357|{	int		subformat, error = 0 ;
   88|       |
   89|    357|	if (psf->file.mode == SFM_READ || (psf->file.mode == SFM_RDWR && psf->filelength > 0))
  ------------------
  |  Branch (89:6): [True: 357, False: 0]
  |  Branch (89:37): [True: 0, False: 0]
  |  Branch (89:67): [True: 0, False: 0]
  ------------------
   90|    357|	{	if ((error = mat5_read_header (psf)))
  ------------------
  |  Branch (90:8): [True: 315, False: 42]
  ------------------
   91|    315|			return error ;
   92|    357|		} ;
   93|       |
   94|     42|	if ((SF_CONTAINER (psf->sf.format)) != SF_FORMAT_MAT5)
  ------------------
  |  |  101|     42|#define SF_CONTAINER(x)		((x) & SF_FORMAT_TYPEMASK)
  ------------------
  |  Branch (94:6): [True: 0, False: 42]
  ------------------
   95|      0|		return	SFE_BAD_OPEN_FORMAT ;
   96|       |
   97|     42|	subformat = SF_CODEC (psf->sf.format) ;
  ------------------
  |  |  102|     42|#define SF_CODEC(x)			((x) & SF_FORMAT_SUBMASK)
  ------------------
   98|       |
   99|     42|	if (psf->file.mode == SFM_WRITE || psf->file.mode == SFM_RDWR)
  ------------------
  |  Branch (99:6): [True: 0, False: 42]
  |  Branch (99:37): [True: 0, False: 42]
  ------------------
  100|      0|	{	if (psf->is_pipe)
  ------------------
  |  Branch (100:8): [True: 0, False: 0]
  ------------------
  101|      0|			return SFE_NO_PIPE_WRITE ;
  102|       |
  103|      0|		psf->endian = SF_ENDIAN (psf->sf.format) ;
  ------------------
  |  |  103|      0|#define SF_ENDIAN(x)		((x) & SF_FORMAT_ENDMASK)
  ------------------
  104|      0|		if (CPU_IS_LITTLE_ENDIAN && (psf->endian == SF_ENDIAN_CPU || psf->endian == 0))
  ------------------
  |  |   14|      0|#define CPU_IS_LITTLE_ENDIAN 1
  |  |  ------------------
  |  |  |  Branch (14:30): [True: 0, Folded]
  |  |  ------------------
  ------------------
  |  Branch (104:32): [True: 0, False: 0]
  |  Branch (104:64): [True: 0, False: 0]
  ------------------
  105|      0|			psf->endian = SF_ENDIAN_LITTLE ;
  106|      0|		else if (CPU_IS_BIG_ENDIAN && (psf->endian == SF_ENDIAN_CPU || psf->endian == 0))
  ------------------
  |  |   11|      0|#define CPU_IS_BIG_ENDIAN 0
  |  |  ------------------
  |  |  |  Branch (11:27): [Folded, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (106:34): [True: 0, False: 0]
  |  Branch (106:66): [True: 0, False: 0]
  ------------------
  107|      0|			psf->endian = SF_ENDIAN_BIG ;
  108|       |
  109|      0|		if ((error = mat5_write_header (psf, SF_FALSE)))
  ------------------
  |  Branch (109:7): [True: 0, False: 0]
  ------------------
  110|      0|			return error ;
  111|       |
  112|      0|		psf->write_header = mat5_write_header ;
  113|     42|		} ;
  114|       |
  115|     42|	psf->container_close = mat5_close ;
  116|       |
  117|     42|	psf->blockwidth = (sf_count_t) psf->bytewidth * psf->sf.channels ;
  118|       |
  119|     42|	switch (subformat)
  120|     42|	{	case SF_FORMAT_PCM_U8 :
  ------------------
  |  Branch (120:4): [True: 1, False: 41]
  ------------------
  121|      2|		case SF_FORMAT_PCM_16 :
  ------------------
  |  Branch (121:3): [True: 1, False: 41]
  ------------------
  122|      3|		case SF_FORMAT_PCM_32 :
  ------------------
  |  Branch (122:3): [True: 1, False: 41]
  ------------------
  123|      3|				error = pcm_init (psf) ;
  124|      3|				break ;
  125|       |
  126|      2|		case SF_FORMAT_FLOAT :
  ------------------
  |  Branch (126:3): [True: 2, False: 40]
  ------------------
  127|      2|				error = float32_init (psf) ;
  128|      2|				break ;
  129|       |
  130|     37|		case SF_FORMAT_DOUBLE :
  ------------------
  |  Branch (130:3): [True: 37, False: 5]
  ------------------
  131|     37|				error = double64_init (psf) ;
  132|     37|				break ;
  133|       |
  134|      0|		default : break ;
  ------------------
  |  Branch (134:3): [True: 0, False: 42]
  ------------------
  135|     42|		} ;
  136|       |
  137|     42|	return error ;
  138|     42|} /* mat5_open */
mat5.c:mat5_close:
  145|     42|{
  146|     42|	if (psf->file.mode == SFM_WRITE || psf->file.mode == SFM_RDWR)
  ------------------
  |  Branch (146:6): [True: 0, False: 42]
  |  Branch (146:37): [True: 0, False: 42]
  ------------------
  147|      0|		mat5_write_header (psf, SF_TRUE) ;
  148|       |
  149|     42|	return 0 ;
  150|     42|} /* mat5_close */
mat5.c:mat5_read_header:
  261|    357|{	char	buffer [256], name [32] ;
  262|    357|	short	version, endian ;
  263|    357|	int		type, flags1, flags2, rows, cols ;
  264|    357|	unsigned size ;
  265|    357|	int		have_samplerate = 1 ;
  266|       |
  267|    357|	psf_binheader_readf (psf, "pb", 0, buffer, 124) ;
  268|       |
  269|    357|	buffer [125] = 0 ;
  270|       |
  271|    357|	if (strlen (buffer) >= 124)
  ------------------
  |  Branch (271:6): [True: 1, False: 356]
  ------------------
  272|      1|		return SFE_UNIMPLEMENTED ;
  273|       |
  274|    356|	if (strstr (buffer, "MATLAB 5.0 MAT-file") == buffer)
  ------------------
  |  Branch (274:6): [True: 80, False: 276]
  ------------------
  275|     80|		psf_log_printf (psf, "%s\n", buffer) ;
  276|       |
  277|       |
  278|    356|	psf_binheader_readf (psf, "E22", &version, &endian) ;
  279|       |
  280|    356|	if (endian == MI_MARKER)
  ------------------
  |  |   45|    356|#define MI_MARKER	(('M' << 8) + 'I')
  ------------------
  |  Branch (280:6): [True: 1, False: 355]
  ------------------
  281|      1|	{	psf->endian = psf->rwf_endian = SF_ENDIAN_BIG ;
  282|      1|		if (CPU_IS_LITTLE_ENDIAN) version = ENDSWAP_16 (version) ;
  ------------------
  |  |   14|      1|#define CPU_IS_LITTLE_ENDIAN 1
  |  |  ------------------
  |  |  |  Branch (14:30): [True: 1, Folded]
  |  |  ------------------
  ------------------
              		if (CPU_IS_LITTLE_ENDIAN) version = ENDSWAP_16 (version) ;
  ------------------
  |  |   34|      1|#define	ENDSWAP_16(x)		(bswap_16 (x))
  ------------------
  283|      1|		}
  284|    355|	else if (endian == IM_MARKER)
  ------------------
  |  |   44|    355|#define IM_MARKER	(('I' << 8) + 'M')
  ------------------
  |  Branch (284:11): [True: 331, False: 24]
  ------------------
  285|    331|	{	psf->endian = psf->rwf_endian = SF_ENDIAN_LITTLE ;
  286|    331|		if (CPU_IS_BIG_ENDIAN) version = ENDSWAP_16 (version) ;
  ------------------
  |  |   11|    331|#define CPU_IS_BIG_ENDIAN 0
  |  |  ------------------
  |  |  |  Branch (11:27): [Folded, False: 331]
  |  |  ------------------
  ------------------
              		if (CPU_IS_BIG_ENDIAN) version = ENDSWAP_16 (version) ;
  ------------------
  |  |   34|      0|#define	ENDSWAP_16(x)		(bswap_16 (x))
  ------------------
  287|    331|		}
  288|     24|	else
  289|     24|		return SFE_MAT5_BAD_ENDIAN ;
  290|       |
  291|    332|	if ((CPU_IS_LITTLE_ENDIAN && endian == IM_MARKER) ||
  ------------------
  |  |   14|    664|#define CPU_IS_LITTLE_ENDIAN 1
  |  |  ------------------
  |  |  |  Branch (14:30): [True: 332, Folded]
  |  |  ------------------
  ------------------
              	if ((CPU_IS_LITTLE_ENDIAN && endian == IM_MARKER) ||
  ------------------
  |  |   44|    332|#define IM_MARKER	(('I' << 8) + 'M')
  ------------------
  |  Branch (291:31): [True: 331, False: 1]
  ------------------
  292|      0|			(CPU_IS_BIG_ENDIAN && endian == MI_MARKER))
  ------------------
  |  |   11|      0|#define CPU_IS_BIG_ENDIAN 0
  |  |  ------------------
  |  |  |  Branch (11:27): [Folded, False: 0]
  |  |  ------------------
  ------------------
              			(CPU_IS_BIG_ENDIAN && endian == MI_MARKER))
  ------------------
  |  |   45|      0|#define MI_MARKER	(('M' << 8) + 'I')
  ------------------
  |  Branch (292:26): [True: 0, False: 0]
  ------------------
  293|    331|		version = ENDSWAP_16 (version) ;
  ------------------
  |  |   34|    331|#define	ENDSWAP_16(x)		(bswap_16 (x))
  ------------------
  294|       |
  295|    332|	psf_log_printf (psf, "Version : 0x%04X\n", version) ;
  296|    332|	psf_log_printf (psf, "Endian  : 0x%04X => %s\n", endian,
  297|    332|				(psf->endian == SF_ENDIAN_LITTLE) ? "Little" : "Big") ;
  ------------------
  |  Branch (297:5): [True: 331, False: 1]
  ------------------
  298|       |
  299|       |	/*========================================================*/
  300|    332|	psf_binheader_readf (psf, "44", &type, &size) ;
  301|    332|	psf_log_printf (psf, "Block\n Type : %X    Size : %d\n", type, size) ;
  302|       |
  303|    332|	if (type != MAT5_TYPE_ARRAY)
  ------------------
  |  Branch (303:6): [True: 19, False: 313]
  ------------------
  304|     19|		return SFE_MAT5_NO_BLOCK ;
  305|       |
  306|    313|	psf_binheader_readf (psf, "44", &type, &size) ;
  307|    313|	psf_log_printf (psf, "    Type : %X    Size : %d\n", type, size) ;
  308|       |
  309|    313|	if (type != MAT5_TYPE_UINT32)
  ------------------
  |  Branch (309:6): [True: 1, False: 312]
  ------------------
  310|      1|		return SFE_MAT5_NO_BLOCK ;
  311|       |
  312|    312|	psf_binheader_readf (psf, "44", &flags1, &flags2) ;
  313|    312|	psf_log_printf (psf, "    Flg1 : %X    Flg2 : %d\n", flags1, flags2) ;
  314|       |
  315|    312|	psf_binheader_readf (psf, "44", &type, &size) ;
  316|    312|	psf_log_printf (psf, "    Type : %X    Size : %d\n", type, size) ;
  317|       |
  318|    312|	if (type != MAT5_TYPE_INT32)
  ------------------
  |  Branch (318:6): [True: 1, False: 311]
  ------------------
  319|      1|		return SFE_MAT5_NO_BLOCK ;
  320|       |
  321|    311|	psf_binheader_readf (psf, "44", &rows, &cols) ;
  322|    311|	psf_log_printf (psf, "    Rows : %d    Cols : %d\n", rows, cols) ;
  323|       |
  324|    311|	if (rows != 1 || cols != 1)
  ------------------
  |  Branch (324:6): [True: 126, False: 185]
  |  Branch (324:19): [True: 34, False: 151]
  ------------------
  325|    160|	{	if (psf->sf.samplerate == 0)
  ------------------
  |  Branch (325:8): [True: 160, False: 0]
  ------------------
  326|    160|			psf->sf.samplerate = 44100 ;
  327|    160|		have_samplerate = 0 ;
  328|    160|		}
  329|    311|	psf_binheader_readf (psf, "4", &type) ;
  330|       |
  331|    311|	if (type == MAT5_TYPE_SCHAR)
  ------------------
  |  Branch (331:6): [True: 42, False: 269]
  ------------------
  332|     42|	{	psf_binheader_readf (psf, "4", &size) ;
  333|     42|		psf_log_printf (psf, "    Type : %X    Size : %d\n", type, size) ;
  334|     42|		if (size > SIGNED_SIZEOF (name) - 1)
  ------------------
  |  |   86|     42|#define		SIGNED_SIZEOF(x)	((int) sizeof (x))
  ------------------
  |  Branch (334:7): [True: 23, False: 19]
  ------------------
  335|     23|		{	psf_log_printf (psf, "Error : Bad name length.\n") ;
  336|     23|			return SFE_MAT5_NO_BLOCK ;
  337|     23|			} ;
  338|       |
  339|     19|		psf_binheader_readf (psf, "bj", name, size, (8 - (size % 8)) % 8) ;
  340|     19|		name [size] = 0 ;
  341|     19|		}
  342|    269|	else if ((type & 0xFFFF) == MAT5_TYPE_SCHAR)
  ------------------
  |  Branch (342:11): [True: 230, False: 39]
  ------------------
  343|    230|	{	size = type >> 16 ;
  344|    230|		if (size > 4)
  ------------------
  |  Branch (344:7): [True: 13, False: 217]
  ------------------
  345|     13|		{	psf_log_printf (psf, "Error : Bad name length.\n") ;
  346|     13|			return SFE_MAT5_NO_BLOCK ;
  347|    217|			} ;
  348|       |
  349|    217|		psf_log_printf (psf, "    Type : %X\n", type) ;
  350|    217|		psf_binheader_readf (psf, "4", &name) ;
  351|    217|		name [size] = 0 ;
  352|    217|		}
  353|     39|	else
  354|     39|		return SFE_MAT5_NO_BLOCK ;
  355|       |
  356|    236|	psf_log_printf (psf, "    Name : %s\n", name) ;
  357|       |
  358|       |	/*-----------------------------------------*/
  359|       |
  360|    236|	psf_binheader_readf (psf, "44", &type, &size) ;
  361|       |
  362|    236|	if (!have_samplerate)
  ------------------
  |  Branch (362:6): [True: 93, False: 143]
  ------------------
  363|     93|		goto skip_samplerate ;
  364|       |
  365|    143|	switch (type)
  366|    143|	{	case MAT5_TYPE_DOUBLE :
  ------------------
  |  Branch (366:4): [True: 3, False: 140]
  ------------------
  367|      3|				{	double	samplerate ;
  368|       |
  369|      3|					psf_binheader_readf (psf, "d", &samplerate) ;
  370|      3|					snprintf (name, sizeof (name), "%f\n", samplerate) ;
  371|      3|					psf_log_printf (psf, "    Val  : %s\n", name) ;
  372|       |
  373|      3|					psf->sf.samplerate = psf_lrint (samplerate) ;
  374|      3|					} ;
  375|      3|				break ;
  376|       |
  377|     94|		case MAT5_TYPE_COMP_USHORT :
  ------------------
  |  Branch (377:3): [True: 94, False: 49]
  ------------------
  378|     94|				{	unsigned short samplerate ;
  379|       |
  380|     94|					psf_binheader_readf (psf, "j2j", -4, &samplerate, 2) ;
  381|     94|					psf_log_printf (psf, "    Val  : %u\n", samplerate) ;
  382|     94|					psf->sf.samplerate = samplerate ;
  383|     94|					}
  384|     94|				break ;
  385|       |
  386|      1|		case MAT5_TYPE_COMP_UINT :
  ------------------
  |  Branch (386:3): [True: 1, False: 142]
  ------------------
  387|      1|				psf_log_printf (psf, "    Val  : %u\n", size) ;
  388|      1|				psf->sf.samplerate = size ;
  389|      1|				break ;
  390|       |
  391|     45|		default :
  ------------------
  |  Branch (391:3): [True: 45, False: 98]
  ------------------
  392|     45|			psf_log_printf (psf, "    Type : %X    Size : %d  ***\n", type, size) ;
  393|     45|			return SFE_MAT5_SAMPLE_RATE ;
  394|    143|		} ;
  395|       |
  396|       |	/*-----------------------------------------*/
  397|       |
  398|       |
  399|     98|	psf_binheader_readf (psf, "44", &type, &size) ;
  400|     98|	psf_log_printf (psf, " Type : %X    Size : %d\n", type, size) ;
  401|       |
  402|     98|	if (type != MAT5_TYPE_ARRAY)
  ------------------
  |  Branch (402:6): [True: 12, False: 86]
  ------------------
  403|     12|		return SFE_MAT5_NO_BLOCK ;
  404|       |
  405|     86|	psf_binheader_readf (psf, "44", &type, &size) ;
  406|     86|	psf_log_printf (psf, "    Type : %X    Size : %d\n", type, size) ;
  407|       |
  408|     86|	if (type != MAT5_TYPE_UINT32)
  ------------------
  |  Branch (408:6): [True: 19, False: 67]
  ------------------
  409|     19|		return SFE_MAT5_NO_BLOCK ;
  410|       |
  411|     67|	psf_binheader_readf (psf, "44", &flags1, &flags2) ;
  412|     67|	psf_log_printf (psf, "    Flg1 : %X    Flg2 : %d\n", flags1, flags2) ;
  413|       |
  414|     67|	psf_binheader_readf (psf, "44", &type, &size) ;
  415|     67|	psf_log_printf (psf, "    Type : %X    Size : %d\n", type, size) ;
  416|       |
  417|     67|	if (type != MAT5_TYPE_INT32)
  ------------------
  |  Branch (417:6): [True: 1, False: 66]
  ------------------
  418|      1|		return SFE_MAT5_NO_BLOCK ;
  419|       |
  420|     66|	psf_binheader_readf (psf, "44", &rows, &cols) ;
  421|     66|	psf_log_printf (psf, "    Rows : %X    Cols : %d\n", rows, cols) ;
  422|       |
  423|     66|	psf_binheader_readf (psf, "4", &type) ;
  424|       |
  425|     66|	if (type == MAT5_TYPE_SCHAR)
  ------------------
  |  Branch (425:6): [True: 33, False: 33]
  ------------------
  426|     33|	{	psf_binheader_readf (psf, "4", &size) ;
  427|     33|		psf_log_printf (psf, "    Type : %X    Size : %d\n", type, size) ;
  428|     33|		if (size > SIGNED_SIZEOF (name) - 1)
  ------------------
  |  |   86|     33|#define		SIGNED_SIZEOF(x)	((int) sizeof (x))
  ------------------
  |  Branch (428:7): [True: 29, False: 4]
  ------------------
  429|     29|		{	psf_log_printf (psf, "Error : Bad name length.\n") ;
  430|     29|			return SFE_MAT5_NO_BLOCK ;
  431|     29|			} ;
  432|       |
  433|      4|		psf_binheader_readf (psf, "bj", name, size, (8 - (size % 8)) % 8) ;
  434|      4|		name [size] = 0 ;
  435|      4|		}
  436|     33|	else if ((type & 0xFFFF) == MAT5_TYPE_SCHAR)
  ------------------
  |  Branch (436:11): [True: 31, False: 2]
  ------------------
  437|     31|	{	size = type >> 16 ;
  438|     31|		if (size > 4)
  ------------------
  |  Branch (438:7): [True: 29, False: 2]
  ------------------
  439|     29|		{	psf_log_printf (psf, "Error : Bad name length.\n") ;
  440|     29|			return SFE_MAT5_NO_BLOCK ;
  441|     29|			} ;
  442|       |
  443|      2|		psf_log_printf (psf, "    Type : %X\n", type) ;
  444|      2|		psf_binheader_readf (psf, "4", &name) ;
  445|      2|		name [size] = 0 ;
  446|      2|		}
  447|      2|	else
  448|      2|		return SFE_MAT5_NO_BLOCK ;
  449|       |
  450|      6|	psf_log_printf (psf, "    Name : %s\n", name) ;
  451|       |
  452|      6|	psf_binheader_readf (psf, "44", &type, &size) ;
  453|      6|	psf_log_printf (psf, "    Type : %X    Size : %d\n", type, size) ;
  454|       |
  455|     99|skip_samplerate :
  456|       |	/*++++++++++++++++++++++++++++++++++++++++++++++++++*/
  457|       |
  458|     99|	if (rows == 0 && cols == 0)
  ------------------
  |  Branch (458:6): [True: 34, False: 65]
  |  Branch (458:19): [True: 1, False: 33]
  ------------------
  459|      1|	{	psf_log_printf (psf, "*** Error : zero channel count.\n") ;
  460|      1|		return SFE_CHANNEL_COUNT_ZERO ;
  461|     98|		} ;
  462|       |
  463|     98|	psf->sf.channels	= rows ;
  464|     98|	psf->sf.frames		= cols ;
  465|       |
  466|     98|	psf->sf.format = psf->endian | SF_FORMAT_MAT5 ;
  467|       |
  468|     98|	switch (type)
  469|     98|	{	case MAT5_TYPE_DOUBLE :
  ------------------
  |  Branch (469:4): [True: 37, False: 61]
  ------------------
  470|     37|				psf_log_printf (psf, "Data type : double\n") ;
  471|     37|				psf->sf.format |= SF_FORMAT_DOUBLE ;
  472|     37|				psf->bytewidth = 8 ;
  473|     37|				break ;
  474|       |
  475|      2|		case MAT5_TYPE_FLOAT :
  ------------------
  |  Branch (475:3): [True: 2, False: 96]
  ------------------
  476|      2|				psf_log_printf (psf, "Data type : float\n") ;
  477|      2|				psf->sf.format |= SF_FORMAT_FLOAT ;
  478|      2|				psf->bytewidth = 4 ;
  479|      2|				break ;
  480|       |
  481|      1|		case MAT5_TYPE_INT32 :
  ------------------
  |  Branch (481:3): [True: 1, False: 97]
  ------------------
  482|      1|				psf_log_printf (psf, "Data type : 32 bit PCM\n") ;
  483|      1|				psf->sf.format |= SF_FORMAT_PCM_32 ;
  484|      1|				psf->bytewidth = 4 ;
  485|      1|				break ;
  486|       |
  487|      1|		case MAT5_TYPE_INT16 :
  ------------------
  |  Branch (487:3): [True: 1, False: 97]
  ------------------
  488|      1|				psf_log_printf (psf, "Data type : 16 bit PCM\n") ;
  489|      1|				psf->sf.format |= SF_FORMAT_PCM_16 ;
  490|      1|				psf->bytewidth = 2 ;
  491|      1|				break ;
  492|       |
  493|      1|		case MAT5_TYPE_UCHAR :
  ------------------
  |  Branch (493:3): [True: 1, False: 97]
  ------------------
  494|      1|				psf_log_printf (psf, "Data type : unsigned 8 bit PCM\n") ;
  495|      1|				psf->sf.format |= SF_FORMAT_PCM_U8 ;
  496|      1|				psf->bytewidth = 1 ;
  497|      1|				break ;
  498|       |
  499|     56|		default :
  ------------------
  |  Branch (499:3): [True: 56, False: 42]
  ------------------
  500|     56|				psf_log_printf (psf, "*** Error : Bad marker %08X\n", type) ;
  501|     56|				return SFE_UNIMPLEMENTED ;
  502|     98|		} ;
  503|       |
  504|     42|	psf->dataoffset = psf_ftell (psf) ;
  505|     42|	psf->datalength = psf->filelength - psf->dataoffset ;
  506|       |
  507|     42|	return 0 ;
  508|     98|} /* mat5_read_header */

mpc2k_open:
   64|     16|{	int		error = 0 ;
   65|       |
   66|     16|	if (psf->file.mode == SFM_READ || (psf->file.mode == SFM_RDWR && psf->filelength > 0))
  ------------------
  |  Branch (66:6): [True: 16, False: 0]
  |  Branch (66:37): [True: 0, False: 0]
  |  Branch (66:67): [True: 0, False: 0]
  ------------------
   67|     16|	{	if ((error = mpc2k_read_header (psf)))
  ------------------
  |  Branch (67:8): [True: 0, False: 16]
  ------------------
   68|      0|			return error ;
   69|     16|		} ;
   70|       |
   71|     16|	if ((SF_CONTAINER (psf->sf.format)) != SF_FORMAT_MPC2K)
  ------------------
  |  |  101|     16|#define SF_CONTAINER(x)		((x) & SF_FORMAT_TYPEMASK)
  ------------------
  |  Branch (71:6): [True: 0, False: 16]
  ------------------
   72|      0|		return	SFE_BAD_OPEN_FORMAT ;
   73|       |
   74|     16|	if (psf->file.mode == SFM_WRITE || psf->file.mode == SFM_RDWR)
  ------------------
  |  Branch (74:6): [True: 0, False: 16]
  |  Branch (74:37): [True: 0, False: 16]
  ------------------
   75|      0|	{	if (mpc2k_write_header (psf, SF_FALSE))
  ------------------
  |  Branch (75:8): [True: 0, False: 0]
  ------------------
   76|      0|			return psf->error ;
   77|       |
   78|      0|		psf->write_header = mpc2k_write_header ;
   79|     16|		} ;
   80|       |
   81|     16|	psf->container_close = mpc2k_close ;
   82|       |
   83|     16|	psf->blockwidth = (sf_count_t) psf->bytewidth * psf->sf.channels ;
   84|       |
   85|     16|	error = pcm_init (psf) ;
   86|       |
   87|     16|	return error ;
   88|     16|} /* mpc2k_open */
mpc2k.c:mpc2k_close:
   95|     16|{
   96|     16|	if (psf->file.mode == SFM_WRITE || psf->file.mode == SFM_RDWR)
  ------------------
  |  Branch (96:6): [True: 0, False: 16]
  |  Branch (96:37): [True: 0, False: 16]
  ------------------
   97|      0|		mpc2k_write_header (psf, SF_TRUE) ;
   98|       |
   99|     16|	return 0 ;
  100|     16|} /* mpc2k_close */
mpc2k.c:mpc2k_read_header:
  158|     16|{	char sample_name [HEADER_NAME_LEN + 1] ;
  159|     16|	unsigned char bytes [4] ;
  160|     16|	uint32_t sample_start, loop_end, sample_frames, loop_length ;
  161|     16|	uint16_t sample_rate ;
  162|       |
  163|     16|	psf_binheader_readf (psf, "pebb", 0, bytes, 2, sample_name, make_size_t (HEADER_NAME_LEN)) ;
  ------------------
  |  |   47|     16|#define HEADER_NAME_LEN		17	/* Length of name string. */
  ------------------
  164|       |
  165|     16|	if (bytes [0] != 1 || bytes [1] != 4)
  ------------------
  |  Branch (165:6): [True: 0, False: 16]
  |  Branch (165:24): [True: 0, False: 16]
  ------------------
  166|      0|		return SFE_MPC_NO_MARKER ;
  167|       |
  168|     16|	sample_name [HEADER_NAME_LEN] = 0 ;
  ------------------
  |  |   47|     16|#define HEADER_NAME_LEN		17	/* Length of name string. */
  ------------------
  169|       |
  170|     16|	psf_log_printf (psf, "MPC2000\n  Name         : %s\n", sample_name) ;
  171|       |
  172|     16|	psf_binheader_readf (psf, "eb4444", bytes, 3, &sample_start, &loop_end, &sample_frames, &loop_length) ;
  173|       |
  174|     16|	psf->sf.channels = bytes [2] ? 2 : 1 ;
  ------------------
  |  Branch (174:21): [True: 12, False: 4]
  ------------------
  175|       |
  176|     16|	psf_log_printf (psf, "  Level        : %d\n  Tune         : %d\n  Stereo       : %s\n", bytes [0], bytes [1], bytes [2] ? "Yes" : "No") ;
  ------------------
  |  Branch (176:112): [True: 12, False: 4]
  ------------------
  177|       |
  178|     16|	psf_log_printf (psf, "  Sample start : %d\n  Loop end     : %d\n  Frames       : %d\n  Length       : %d\n", sample_start, loop_end, sample_frames, loop_length) ;
  179|       |
  180|     16|	psf_binheader_readf (psf, "eb2", bytes, 2, &sample_rate) ;
  181|       |
  182|     16|	psf_log_printf (psf, "  Loop mode    : %s\n  Beats        : %d\n  Sample rate  : %d\nEnd\n", bytes [0] ? "None" : "Fwd", bytes [1], sample_rate) ;
  ------------------
  |  Branch (182:95): [True: 14, False: 2]
  ------------------
  183|       |
  184|     16|	psf->sf.samplerate = sample_rate ;
  185|       |
  186|     16|	psf->sf.format = SF_FORMAT_MPC2K | SF_FORMAT_PCM_16 ;
  187|       |
  188|     16|	psf->dataoffset = psf_ftell (psf) ;
  189|       |
  190|       |	/* Always 16 bit little endian data. */
  191|     16|	psf->bytewidth = 2 ;
  192|     16|	psf->endian = SF_ENDIAN_LITTLE ;
  193|       |
  194|     16|	psf->datalength = psf->filelength - psf->dataoffset ;
  195|     16|	psf->blockwidth = (sf_count_t) psf->sf.channels * psf->bytewidth ;
  196|     16|	psf->sf.frames = psf->datalength / psf->blockwidth ;
  197|       |
  198|     16|	psf->sf.frames = (psf->filelength - psf->dataoffset) / psf->blockwidth ;
  199|       |
  200|     16|	return 0 ;
  201|     16|} /* mpc2k_read_header */

mpeg_init:
  153|      2|{
  154|      2|	psf_log_printf (psf, "This version of libsndfile was compiled without MPEG support.\n") ;
  155|      2|	return SFE_UNIMPLEMENTED ;
  156|      2|} /* mpeg_init */
mpeg_open:
  160|     14|{
  161|     14|	psf_log_printf (psf, "This version of libsndfile was compiled without MP3 support.\n") ;
  162|     14|	return SFE_UNIMPLEMENTED ;
  163|     14|} /* mpeg_open */

wavlike_msadpcm_init:
  119|    177|{	MSADPCM_PRIVATE	*pms ;
  120|    177|	unsigned int	pmssize ;
  121|    177|	int				count ;
  122|       |
  123|    177|	if (psf->codec_data != NULL)
  ------------------
  |  Branch (123:6): [True: 0, False: 177]
  ------------------
  124|      0|	{	psf_log_printf (psf, "*** psf->codec_data is not NULL.\n") ;
  125|      0|		return SFE_INTERNAL ;
  126|    177|		} ;
  127|       |
  128|    177|	if (psf->file.mode == SFM_WRITE)
  ------------------
  |  Branch (128:6): [True: 0, False: 177]
  ------------------
  129|      0|		samplesperblock = 2 + 2 * (blockalign - 7 * psf->sf.channels) / psf->sf.channels ;
  130|       |
  131|       |	/* There's 7 samples per channel in the preamble of each block */
  132|    177|	if (samplesperblock < 7 * psf->sf.channels)
  ------------------
  |  Branch (132:6): [True: 3, False: 174]
  ------------------
  133|      3|	{	psf_log_printf (psf, "*** Error samplesperblock (%d) should be >= %d.\n", samplesperblock, 7 * psf->sf.channels) ;
  134|      3|		return SFE_INTERNAL ;
  135|    174|		} ;
  136|       |
  137|    174|	if (2 * blockalign < samplesperblock * psf->sf.channels)
  ------------------
  |  Branch (137:6): [True: 5, False: 169]
  ------------------
  138|      5|	{	psf_log_printf (psf, "*** Error blockalign (%d) should be >= %d.\n", blockalign, samplesperblock * psf->sf.channels / 2) ;
  139|      5|		return SFE_INTERNAL ;
  140|    169|		} ;
  141|       |
  142|    169|	pmssize = sizeof (MSADPCM_PRIVATE) + blockalign + 3 * psf->sf.channels * samplesperblock ;
  143|       |
  144|    169|	if (! (psf->codec_data = calloc (1, pmssize)))
  ------------------
  |  Branch (144:6): [True: 0, False: 169]
  ------------------
  145|      0|		return SFE_MALLOC_FAILED ;
  146|    169|	pms = (MSADPCM_PRIVATE*) psf->codec_data ;
  147|       |
  148|    169|	pms->sync_error = 0 ;
  149|    169|	pms->samples	= pms->dummydata ;
  150|    169|	pms->block		= (unsigned char*) (pms->dummydata + psf->sf.channels * samplesperblock) ;
  151|       |
  152|    169|	pms->channels	= psf->sf.channels ;
  153|    169|	pms->blocksize	= blockalign ;
  154|    169|	pms->samplesperblock = samplesperblock ;
  155|       |
  156|    169|	if (pms->blocksize <= 0)
  ------------------
  |  Branch (156:6): [True: 0, False: 169]
  ------------------
  157|      0|	{	psf_log_printf (psf, "*** Error : pms->blocksize should be > 0.\n") ;
  158|      0|		return SFE_INTERNAL ;
  159|    169|		} ;
  160|       |
  161|    169|	if (psf->file.mode == SFM_READ)
  ------------------
  |  Branch (161:6): [True: 169, False: 0]
  ------------------
  162|    169|	{	pms->dataremaining = psf->datalength ;
  163|       |
  164|    169|		if (psf->datalength % pms->blocksize)
  ------------------
  |  Branch (164:7): [True: 113, False: 56]
  ------------------
  165|    113|			pms->blocks = psf->datalength / pms->blocksize + 1 ;
  166|     56|		else
  167|     56|			pms->blocks = psf->datalength / pms->blocksize ;
  168|       |
  169|    169|		count = 2 * (pms->blocksize - 6 * pms->channels) / pms->channels ;
  170|    169|		if (pms->samplesperblock != count)
  ------------------
  |  Branch (170:7): [True: 35, False: 134]
  ------------------
  171|     35|		{	psf_log_printf (psf, "*** Error : samplesperblock should be %d.\n", count) ;
  172|     35|			return SFE_INTERNAL ;
  173|    134|			} ;
  174|       |
  175|    134|		psf->sf.frames = (psf->datalength / pms->blocksize) * pms->samplesperblock ;
  176|       |
  177|    134|		msadpcm_decode_block (psf, pms) ;
  178|       |
  179|    134|		psf->read_short		= msadpcm_read_s ;
  180|    134|		psf->read_int		= msadpcm_read_i ;
  181|    134|		psf->read_float		= msadpcm_read_f ;
  182|    134|		psf->read_double	= msadpcm_read_d ;
  183|    134|		} ;
  184|       |
  185|    134|	if (psf->file.mode == SFM_WRITE)
  ------------------
  |  Branch (185:6): [True: 0, False: 134]
  ------------------
  186|      0|	{	pms->samples = pms->dummydata ;
  187|       |
  188|      0|		pms->samplecount = 0 ;
  189|       |
  190|      0|		psf->write_short	= msadpcm_write_s ;
  191|      0|		psf->write_int		= msadpcm_write_i ;
  192|      0|		psf->write_float	= msadpcm_write_f ;
  193|      0|		psf->write_double	= msadpcm_write_d ;
  194|      0|		} ;
  195|       |
  196|    134|	psf->codec_close = msadpcm_close ;
  197|    134|	psf->seek = msadpcm_seek ;
  198|       |
  199|    134|	return 0 ;
  200|    169|} /* wavlike_msadpcm_init */
ms_adpcm.c:msadpcm_decode_block:
  218|  1.73k|{	int		chan, k, blockindx, sampleindx ;
  219|  1.73k|	short	bytecode, bpred [2], chan_idelta [2] ;
  220|       |
  221|  1.73k|	int predict ;
  222|  1.73k|	int current ;
  223|  1.73k|	int idelta ;
  224|       |
  225|  1.73k|	pms->blockcount ++ ;
  226|  1.73k|	pms->samplecount = 0 ;
  227|       |
  228|  1.73k|	if (pms->blockcount > pms->blocks)
  ------------------
  |  Branch (228:6): [True: 2, False: 1.73k]
  ------------------
  229|      2|	{	memset (pms->samples, 0, pms->samplesperblock * pms->channels) ;
  230|      2|		return 1 ;
  231|  1.73k|		} ;
  232|       |
  233|  1.73k|	if ((k = (int) psf_fread (pms->block, 1, pms->blocksize, psf)) != pms->blocksize)
  ------------------
  |  Branch (233:6): [True: 89, False: 1.64k]
  ------------------
  234|     89|	{	psf_log_printf (psf, "*** Warning : short read (%d != %d).\n", k, pms->blocksize) ;
  235|     89|		if (k <= 0)
  ------------------
  |  Branch (235:7): [True: 5, False: 84]
  ------------------
  236|      5|			return 1 ;
  237|  1.72k|		} ;
  238|       |
  239|       |	/* Read and check the block header. */
  240|       |
  241|  1.72k|	if (pms->channels == 1)
  ------------------
  |  Branch (241:6): [True: 1.05k, False: 675]
  ------------------
  242|  1.05k|	{	bpred [0] = msadpcm_get_bpred (psf, pms, pms->block [0]) ;
  243|       |
  244|  1.05k|		chan_idelta [0] = pms->block [1] | (pms->block [2] << 8) ;
  245|  1.05k|		chan_idelta [1] = 0 ;
  246|       |
  247|  1.05k|		pms->samples [1] = pms->block [3] | (pms->block [4] << 8) ;
  248|  1.05k|		pms->samples [0] = pms->block [5] | (pms->block [6] << 8) ;
  249|  1.05k|		blockindx = 7 ;
  250|  1.05k|		}
  251|    675|	else
  252|    675|	{	bpred [0] = msadpcm_get_bpred (psf, pms, pms->block [0]) ;
  253|    675|		bpred [1] = msadpcm_get_bpred (psf, pms, pms->block [1]) ;
  254|       |
  255|    675|		chan_idelta [0] = pms->block [2] | (pms->block [3] << 8) ;
  256|    675|		chan_idelta [1] = pms->block [4] | (pms->block [5] << 8) ;
  257|       |
  258|    675|		pms->samples [2] = pms->block [6] | (pms->block [7] << 8) ;
  259|    675|		pms->samples [3] = pms->block [8] | (pms->block [9] << 8) ;
  260|       |
  261|    675|		pms->samples [0] = pms->block [10] | (pms->block [11] << 8) ;
  262|    675|		pms->samples [1] = pms->block [12] | (pms->block [13] << 8) ;
  263|       |
  264|    675|		blockindx = 14 ;
  265|    675|		} ;
  266|       |
  267|       |	/*--------------------------------------------------------
  268|       |	This was left over from a time when calculations were done
  269|       |	as ints rather than shorts. Keep this around as a reminder
  270|       |	in case I ever find a file which decodes incorrectly.
  271|       |
  272|       |    if (chan_idelta [0] & 0x8000)
  273|       |		chan_idelta [0] -= 0x10000 ;
  274|       |    if (chan_idelta [1] & 0x8000)
  275|       |		chan_idelta [1] -= 0x10000 ;
  276|       |	--------------------------------------------------------*/
  277|       |
  278|       |	/* Pull apart the packed 4 bit samples and store them in their
  279|       |	** correct sample positions.
  280|       |	*/
  281|       |
  282|  1.72k|	sampleindx = 2 * pms->channels ;
  283|  51.5k|	while (blockindx < pms->blocksize)
  ------------------
  |  Branch (283:9): [True: 49.8k, False: 1.72k]
  ------------------
  284|  49.8k|	{	bytecode = pms->block [blockindx++] ;
  285|  49.8k|		pms->samples [sampleindx++] = (bytecode >> 4) & 0x0F ;
  286|  49.8k|		pms->samples [sampleindx++] = bytecode & 0x0F ;
  287|  49.8k|		} ;
  288|       |
  289|       |	/* Decode the encoded 4 bit samples. */
  290|       |
  291|   101k|	for (k = 2 * pms->channels ; k < (pms->samplesperblock * pms->channels) ; k ++)
  ------------------
  |  Branch (291:31): [True: 99.6k, False: 1.72k]
  ------------------
  292|  99.6k|	{	chan = (pms->channels > 1) ? (k % 2) : 0 ;
  ------------------
  |  Branch (292:11): [True: 52.2k, False: 47.4k]
  ------------------
  293|       |
  294|  99.6k|		bytecode = pms->samples [k] & 0xF ;
  295|       |
  296|       |		/* Compute next Adaptive Scale Factor (ASF) */
  297|  99.6k|		idelta = chan_idelta [chan] ;
  298|  99.6k|		chan_idelta [chan] = (AdaptationTable [bytecode] * idelta) >> 8 ;	/* => / 256 => FIXED_POINT_ADAPTATION_BASE == 256 */
  299|  99.6k|		if (chan_idelta [chan] < 16)
  ------------------
  |  Branch (299:7): [True: 75.4k, False: 24.2k]
  ------------------
  300|  75.4k|			chan_idelta [chan] = 16 ;
  301|  99.6k|		if (bytecode & 0x8)
  ------------------
  |  Branch (301:7): [True: 10.0k, False: 89.6k]
  ------------------
  302|  10.0k|			bytecode -= 0x10 ;
  303|       |
  304|  99.6k|		predict = ((pms->samples [k - pms->channels] * AdaptCoeff1 [bpred [chan]])
  305|  99.6k|					+ (pms->samples [k - 2 * pms->channels] * AdaptCoeff2 [bpred [chan]])) >> 8 ; /* => / 256 => FIXED_POINT_COEFF_BASE == 256 */
  306|  99.6k|		current = (bytecode * idelta) + predict ;
  307|       |
  308|  99.6k|		if (current > 32767)
  ------------------
  |  Branch (308:7): [True: 4.75k, False: 94.9k]
  ------------------
  309|  4.75k|			current = 32767 ;
  310|  94.9k|		else if (current < -32768)
  ------------------
  |  Branch (310:12): [True: 2.57k, False: 92.3k]
  ------------------
  311|  2.57k|			current = -32768 ;
  312|       |
  313|  99.6k|		pms->samples [k] = current ;
  314|  99.6k|		} ;
  315|       |
  316|  1.72k|	return 0 ;
  317|  1.73k|} /* msadpcm_decode_block */
ms_adpcm.c:msadpcm_get_bpred:
  205|  2.40k|{	if (value >= WAVLIKE_MSADPCM_ADAPT_COEFF_COUNT)
  ------------------
  |  |  343|  2.40k|#define	WAVLIKE_MSADPCM_ADAPT_COEFF_COUNT	7
  ------------------
  |  Branch (205:7): [True: 1.33k, False: 1.06k]
  ------------------
  206|  1.33k|	{	if (pms->sync_error == 0)
  ------------------
  |  Branch (206:8): [True: 103, False: 1.23k]
  ------------------
  207|    103|		{	pms->sync_error = 1 ;
  208|    103|			psf_log_printf (psf, "MS ADPCM synchronisation error (%u should be < %u).\n", value, WAVLIKE_MSADPCM_ADAPT_COEFF_COUNT) ;
  ------------------
  |  |  343|    103|#define	WAVLIKE_MSADPCM_ADAPT_COEFF_COUNT	7
  ------------------
  209|    103|			} ;
  210|  1.33k|		return 0 ;
  211|  1.33k|		} ;
  212|  1.06k|	return value ;
  213|  2.40k|} /* msadpcm_get_bpred */
ms_adpcm.c:msadpcm_read_block:
  321|  25.7k|{	int	count, total = 0, indx = 0 ;
  322|       |
  323|  51.5k|	while (indx < len)
  ------------------
  |  Branch (323:9): [True: 25.7k, False: 25.7k]
  ------------------
  324|  25.7k|	{	if (pms->blockcount >= pms->blocks && pms->samplecount >= pms->samplesperblock)
  ------------------
  |  Branch (324:8): [True: 962, False: 24.8k]
  |  Branch (324:42): [True: 0, False: 962]
  ------------------
  325|      0|		{	memset (&(ptr [indx]), 0, (size_t) ((len - indx) * sizeof (short))) ;
  326|      0|			return total ;
  327|  25.7k|			} ;
  328|       |
  329|  25.7k|		if (pms->samplecount >= pms->samplesperblock)
  ------------------
  |  Branch (329:7): [True: 1.60k, False: 24.1k]
  ------------------
  330|  1.60k|			if (msadpcm_decode_block (psf, pms) != 0)
  ------------------
  |  Branch (330:8): [True: 0, False: 1.60k]
  ------------------
  331|      0|				return total ;
  332|       |
  333|  25.7k|		count = (pms->samplesperblock - pms->samplecount) * pms->channels ;
  334|  25.7k|		count = (len - indx > count) ? count : len - indx ;
  ------------------
  |  Branch (334:11): [True: 0, False: 25.7k]
  ------------------
  335|       |
  336|  25.7k|		memcpy (&(ptr [indx]), &(pms->samples [pms->samplecount * pms->channels]), count * sizeof (short)) ;
  337|  25.7k|		indx += count ;
  338|  25.7k|		pms->samplecount += count / pms->channels ;
  339|  25.7k|		total = indx ;
  340|  25.7k|		} ;
  341|       |
  342|  25.7k|	return total ;
  343|  25.7k|} /* msadpcm_read_block */
ms_adpcm.c:msadpcm_read_f:
  402|  25.7k|{	MSADPCM_PRIVATE *pms ;
  403|  25.7k|	BUF_UNION	ubuf ;
  404|  25.7k|	short		*sptr ;
  405|  25.7k|	int			k, bufferlen, readcount = 0, count ;
  406|  25.7k|	sf_count_t	total = 0 ;
  407|  25.7k|	float		normfact ;
  408|       |
  409|  25.7k|	if (! psf->codec_data)
  ------------------
  |  Branch (409:6): [True: 0, False: 25.7k]
  ------------------
  410|      0|		return 0 ;
  411|  25.7k|	pms = (MSADPCM_PRIVATE*) psf->codec_data ;
  412|       |
  413|  25.7k|	normfact = (psf->norm_float == SF_TRUE) ? 1.0 / ((float) 0x8000) : 1.0 ;
  ------------------
  |  Branch (413:13): [True: 25.7k, False: 0]
  ------------------
  414|  25.7k|	sptr = ubuf.sbuf ;
  415|  25.7k|	bufferlen = ARRAY_LEN (ubuf.sbuf) ;
  ------------------
  |  |   88|  25.7k|#define		ARRAY_LEN(x)	((int) (sizeof (x) / sizeof ((x) [0])))
  ------------------
  416|  51.5k|	while (len > 0)
  ------------------
  |  Branch (416:9): [True: 25.7k, False: 25.7k]
  ------------------
  417|  25.7k|	{	readcount = (len >= bufferlen) ? bufferlen : (int) len ;
  ------------------
  |  Branch (417:16): [True: 0, False: 25.7k]
  ------------------
  418|       |
  419|  25.7k|		if ((count = (int) msadpcm_read_block (psf, pms, sptr, readcount)) <= 0)
  ------------------
  |  Branch (419:7): [True: 0, False: 25.7k]
  ------------------
  420|      0|			return -1 ;
  421|       |
  422|  65.9k|		for (k = 0 ; k < readcount ; k++)
  ------------------
  |  Branch (422:16): [True: 40.2k, False: 25.7k]
  ------------------
  423|  40.2k|			ptr [total + k] = normfact * (float) (sptr [k]) ;
  424|  25.7k|		total += count ;
  425|  25.7k|		len -= readcount ;
  426|  25.7k|		if (count != readcount)
  ------------------
  |  Branch (426:7): [True: 0, False: 25.7k]
  ------------------
  427|      0|			break ;
  428|  25.7k|		} ;
  429|  25.7k|	return total ;
  430|  25.7k|} /* msadpcm_read_f */
ms_adpcm.c:msadpcm_close:
  785|    134|{	MSADPCM_PRIVATE *pms ;
  786|       |
  787|    134|	pms = (MSADPCM_PRIVATE*) psf->codec_data ;
  788|       |
  789|    134|	if (psf->file.mode == SFM_WRITE)
  ------------------
  |  Branch (789:6): [True: 0, False: 134]
  ------------------
  790|      0|	{	/*  Now we know static int for certain the length of the file we can
  791|       |		**  re-write the header.
  792|       |		*/
  793|       |
  794|      0|		if (pms->samplecount && pms->samplecount < pms->samplesperblock)
  ------------------
  |  Branch (794:7): [True: 0, False: 0]
  |  Branch (794:27): [True: 0, False: 0]
  ------------------
  795|      0|			msadpcm_encode_block (psf, pms) ;
  796|      0|		} ;
  797|       |
  798|    134|	return 0 ;
  799|    134|} /* msadpcm_close */

nist_open:
   55|    125|{	int error ;
   56|       |
   57|    125|	if (psf->file.mode == SFM_READ || (psf->file.mode == SFM_RDWR && psf->filelength > 0))
  ------------------
  |  Branch (57:6): [True: 125, False: 0]
  |  Branch (57:37): [True: 0, False: 0]
  |  Branch (57:67): [True: 0, False: 0]
  ------------------
   58|    125|	{	if ((error = nist_read_header (psf)))
  ------------------
  |  Branch (58:8): [True: 104, False: 21]
  ------------------
   59|    104|			return error ;
   60|    125|		} ;
   61|       |
   62|     21|	if (psf->file.mode == SFM_WRITE || psf->file.mode == SFM_RDWR)
  ------------------
  |  Branch (62:6): [True: 0, False: 21]
  |  Branch (62:37): [True: 0, False: 21]
  ------------------
   63|      0|	{	if (psf->is_pipe)
  ------------------
  |  Branch (63:8): [True: 0, False: 0]
  ------------------
   64|      0|			return SFE_NO_PIPE_WRITE ;
   65|       |
   66|      0|		if ((SF_CONTAINER (psf->sf.format)) != SF_FORMAT_NIST)
  ------------------
  |  |  101|      0|#define SF_CONTAINER(x)		((x) & SF_FORMAT_TYPEMASK)
  ------------------
  |  Branch (66:7): [True: 0, False: 0]
  ------------------
   67|      0|			return	SFE_BAD_OPEN_FORMAT ;
   68|       |
   69|      0|		psf->endian = SF_ENDIAN (psf->sf.format) ;
  ------------------
  |  |  103|      0|#define SF_ENDIAN(x)		((x) & SF_FORMAT_ENDMASK)
  ------------------
   70|      0|		if (psf->endian == 0 || psf->endian == SF_ENDIAN_CPU)
  ------------------
  |  Branch (70:7): [True: 0, False: 0]
  |  Branch (70:27): [True: 0, False: 0]
  ------------------
   71|      0|			psf->endian = (CPU_IS_BIG_ENDIAN) ? SF_ENDIAN_BIG : SF_ENDIAN_LITTLE ;
  ------------------
  |  |   11|      0|#define CPU_IS_BIG_ENDIAN 0
  ------------------
  |  Branch (71:18): [Folded, False: 0]
  ------------------
   72|       |
   73|      0|		psf->blockwidth = (sf_count_t) psf->bytewidth * psf->sf.channels ;
   74|      0|		psf->sf.frames = 0 ;
   75|       |
   76|      0|		if ((error = nist_write_header (psf, SF_FALSE)))
  ------------------
  |  Branch (76:7): [True: 0, False: 0]
  ------------------
   77|      0|			return error ;
   78|       |
   79|      0|		psf->write_header = nist_write_header ;
   80|     21|		} ;
   81|       |
   82|     21|	psf->container_close = nist_close ;
   83|       |
   84|     21|	switch (SF_CODEC (psf->sf.format))
  ------------------
  |  |  102|     21|#define SF_CODEC(x)			((x) & SF_FORMAT_SUBMASK)
  ------------------
   85|     21|	{	case SF_FORMAT_PCM_S8 :
  ------------------
  |  Branch (85:4): [True: 1, False: 20]
  ------------------
   86|      1|				error = pcm_init (psf) ;
   87|      1|				break ;
   88|       |
   89|      1|		case SF_FORMAT_PCM_16 :
  ------------------
  |  Branch (89:3): [True: 1, False: 20]
  ------------------
   90|      2|		case SF_FORMAT_PCM_24 :
  ------------------
  |  Branch (90:3): [True: 1, False: 20]
  ------------------
   91|      3|		case SF_FORMAT_PCM_32 :
  ------------------
  |  Branch (91:3): [True: 1, False: 20]
  ------------------
   92|      3|				error = pcm_init (psf) ;
   93|      3|				break ;
   94|       |
   95|      2|		case SF_FORMAT_ULAW :
  ------------------
  |  Branch (95:3): [True: 2, False: 19]
  ------------------
   96|      2|				error = ulaw_init (psf) ;
   97|      2|				break ;
   98|       |
   99|      1|		case SF_FORMAT_ALAW :
  ------------------
  |  Branch (99:3): [True: 1, False: 20]
  ------------------
  100|      1|				error = alaw_init (psf) ;
  101|      1|				break ;
  102|       |
  103|     14|		default : error = SFE_UNIMPLEMENTED ;
  ------------------
  |  Branch (103:3): [True: 14, False: 7]
  ------------------
  104|     14|				break ;
  105|     21|		} ;
  106|       |
  107|     21|	return error ;
  108|     21|} /* nist_open */
nist.c:nist_read_header:
  121|    125|{	char	psf_header [NIST_HEADER_LENGTH + 2] ;
  122|    125|	int		bitwidth = 0, count, encoding ;
  123|    125|	unsigned bytes = 0 ;
  124|    125|	char 	str [64], *cptr ;
  125|    125|	long	samples ;
  126|       |
  127|       |	/* Go to start of file and read in the whole header. */
  128|    125|	psf_binheader_readf (psf, "pb", 0, psf_header, NIST_HEADER_LENGTH) ;
  ------------------
  |  |   40|    125|#define	NIST_HEADER_LENGTH	1024
  ------------------
  129|       |
  130|       |	/* Header is a string, so make sure it is null terminated. */
  131|    125|	psf_header [NIST_HEADER_LENGTH] = 0 ;
  ------------------
  |  |   40|    125|#define	NIST_HEADER_LENGTH	1024
  ------------------
  132|       |
  133|       |	/* Now trim the header after the end marker. */
  134|    125|	if ((cptr = strstr (psf_header, "end_head")))
  ------------------
  |  Branch (134:6): [True: 7, False: 118]
  ------------------
  135|      7|	{	cptr += strlen ("end_head") + 1 ;
  136|      7|		cptr [0] = 0 ;
  137|      7|		} ;
  138|       |
  139|    125|	if (strstr (psf_header, bad_header) == psf_header)
  ------------------
  |  Branch (139:6): [True: 1, False: 124]
  ------------------
  140|      1|		return SFE_NIST_CRLF_CONVERISON ;
  141|       |
  142|       |	/* Make sure its a NIST file. */
  143|    124|	if (strstr (psf_header, "NIST_1A\n") != psf_header)
  ------------------
  |  Branch (143:6): [True: 3, False: 121]
  ------------------
  144|      3|	{	psf_log_printf (psf, "Not a NIST file.\n") ;
  145|      3|		return SFE_NIST_BAD_HEADER ;
  146|    121|		} ;
  147|       |
  148|    121|	if (sscanf (psf_header, "NIST_1A\n%d\n", &count) == 1)
  ------------------
  |  Branch (148:6): [True: 82, False: 39]
  ------------------
  149|     82|		psf->dataoffset = count ;
  150|     39|	else
  151|     39|	{	psf_log_printf (psf, "*** Suspicious header length.\n") ;
  152|     39|		psf->dataoffset = NIST_HEADER_LENGTH ;
  ------------------
  |  |   40|     39|#define	NIST_HEADER_LENGTH	1024
  ------------------
  153|     39|		} ;
  154|       |
  155|       |	/* Determine sample encoding, start by assuming PCM. */
  156|    121|	encoding = SF_FORMAT_PCM_U8 ;
  157|    121|	if ((cptr = strstr (psf_header, "sample_coding -s")))
  ------------------
  |  Branch (157:6): [True: 87, False: 34]
  ------------------
  158|     87|	{	if (sscanf (cptr, "sample_coding -s%d %63s", &count, str) != 2)
  ------------------
  |  Branch (158:8): [True: 1, False: 86]
  ------------------
  159|      1|		{	psf_log_printf (psf, "*** Could not parse 'sample_coding' field.\n") ;
  160|      1|			return SFE_NIST_BAD_ENCODING ;
  161|     86|			} ;
  162|       |
  163|     86|		if (strcmp (str, "pcm") == 0)
  ------------------
  |  Branch (163:7): [True: 6, False: 80]
  ------------------
  164|      6|		{	/* Correct this later when we find out the bitwidth. */
  165|      6|			encoding = SF_FORMAT_PCM_U8 ;
  166|      6|			}
  167|     80|		else if (strcmp (str, "alaw") == 0)
  ------------------
  |  Branch (167:12): [True: 2, False: 78]
  ------------------
  168|      2|			encoding = SF_FORMAT_ALAW ;
  169|     78|		else if ((strcmp (str, "ulaw") == 0) || (strcmp (str, "mu-law") == 0))
  ------------------
  |  Branch (169:12): [True: 1, False: 77]
  |  Branch (169:43): [True: 1, False: 76]
  ------------------
  170|      2|			encoding = SF_FORMAT_ULAW ;
  171|     76|		else
  172|     76|		{	psf_log_printf (psf, "*** Unknown encoding : %s\n", str) ;
  173|     76|			encoding = 0 ;
  174|     76|			} ;
  175|    120|		} ;
  176|       |
  177|    120|	if ((cptr = strstr (psf_header, "channel_count -i ")) != NULL)
  ------------------
  |  Branch (177:6): [True: 21, False: 99]
  ------------------
  178|     21|		sscanf (cptr, "channel_count -i %d", &(psf->sf.channels)) ;
  179|       |
  180|    120|	if ((cptr = strstr (psf_header, "sample_rate -i ")) != NULL)
  ------------------
  |  Branch (180:6): [True: 18, False: 102]
  ------------------
  181|     18|		sscanf (cptr, "sample_rate -i %d", &(psf->sf.samplerate)) ;
  182|       |
  183|    120|	if ((cptr = strstr (psf_header, "sample_count -i ")) != NULL)
  ------------------
  |  Branch (183:6): [True: 56, False: 64]
  ------------------
  184|     56|	{	if (sscanf (cptr, "sample_count -i %ld", &samples) == 1)
  ------------------
  |  Branch (184:8): [True: 49, False: 7]
  ------------------
  185|     49|			psf->sf.frames = samples ;
  186|     56|		} ;
  187|       |
  188|    120|	if ((cptr = strstr (psf_header, "sample_n_bytes -i ")) != NULL)
  ------------------
  |  Branch (188:6): [True: 51, False: 69]
  ------------------
  189|     51|		sscanf (cptr, "sample_n_bytes -i %d", &(psf->bytewidth)) ;
  190|       |
  191|       |	/* Default endian-ness (for 8 bit, u-law, A-law. */
  192|    120|	psf->endian = (CPU_IS_BIG_ENDIAN) ? SF_ENDIAN_BIG : SF_ENDIAN_LITTLE ;
  ------------------
  |  |   11|    120|#define CPU_IS_BIG_ENDIAN 0
  ------------------
  |  Branch (192:16): [Folded, False: 120]
  ------------------
  193|       |
  194|       |	/* This is where we figure out endian-ness. */
  195|    120|	if ((cptr = strstr (psf_header, "sample_byte_format -s"))
  ------------------
  |  Branch (195:6): [True: 84, False: 36]
  ------------------
  196|     84|		&& sscanf (cptr, "sample_byte_format -s%u %8s", &bytes, str) == 2)
  ------------------
  |  Branch (196:6): [True: 80, False: 4]
  ------------------
  197|     80|	{
  198|     80|		if (bytes != strlen (str))
  ------------------
  |  Branch (198:7): [True: 76, False: 4]
  ------------------
  199|     76|			psf_log_printf (psf, "Weird sample_byte_format : strlen '%s' != %d\n", str, bytes) ;
  200|       |
  201|     80|		if (bytes > 1)
  ------------------
  |  Branch (201:7): [True: 75, False: 5]
  ------------------
  202|     75|		{	if (psf->bytewidth == 0)
  ------------------
  |  Branch (202:9): [True: 38, False: 37]
  ------------------
  203|     38|				psf->bytewidth = bytes ;
  204|     37|			else if (psf->bytewidth - bytes != 0)
  ------------------
  |  Branch (204:13): [True: 36, False: 1]
  ------------------
  205|     36|			{	psf_log_printf (psf, "psf->bytewidth (%d) != bytes (%d)\n", psf->bytewidth, bytes) ;
  206|     36|				return SFE_NIST_BAD_ENCODING ;
  207|     39|				} ;
  208|       |
  209|     39|			if (strcmp (str, "01") == 0)
  ------------------
  |  Branch (209:8): [True: 5, False: 34]
  ------------------
  210|      5|				psf->endian = SF_ENDIAN_LITTLE ;
  211|     34|			else if (strcmp (str, "10") == 0)
  ------------------
  |  Branch (211:13): [True: 7, False: 27]
  ------------------
  212|      7|				psf->endian = SF_ENDIAN_BIG ;
  213|     27|			else
  214|     27|			{	psf_log_printf (psf, "Weird endian-ness : %s\n", str) ;
  215|     27|				return SFE_NIST_BAD_ENCODING ;
  216|     27|				} ;
  217|     17|			} ;
  218|       |
  219|     17|		psf->sf.format |= psf->endian ;
  220|     57|		} ;
  221|       |
  222|     57|	if ((cptr = strstr (psf_header, "sample_sig_bits -i ")))
  ------------------
  |  Branch (222:6): [True: 6, False: 51]
  ------------------
  223|      6|		sscanf (cptr, "sample_sig_bits -i %d", &bitwidth) ;
  224|       |
  225|     57|	if (strstr (psf_header, "channels_interleaved -s5 FALSE"))
  ------------------
  |  Branch (225:6): [True: 5, False: 52]
  ------------------
  226|      5|	{	psf_log_printf (psf, "Non-interleaved data unsupported.\n", str) ;
  227|      5|		return SFE_NIST_BAD_ENCODING ;
  228|     52|		} ;
  229|       |
  230|     52|	psf->blockwidth = (sf_count_t) psf->sf.channels * psf->bytewidth ;
  231|     52|	psf->datalength = psf->filelength - psf->dataoffset ;
  232|       |
  233|     52|	psf_fseek (psf, psf->dataoffset, SEEK_SET) ;
  234|       |
  235|     52|	if (encoding == SF_FORMAT_PCM_U8)
  ------------------
  |  Branch (235:6): [True: 18, False: 34]
  ------------------
  236|     18|	{	switch (psf->bytewidth)
  237|     18|		{	case 1 :
  ------------------
  |  Branch (237:5): [True: 1, False: 17]
  ------------------
  238|      1|					psf->sf.format |= SF_FORMAT_PCM_S8 ;
  239|      1|					break ;
  240|       |
  241|      1|			case 2 :
  ------------------
  |  Branch (241:4): [True: 1, False: 17]
  ------------------
  242|      1|					psf->sf.format |= SF_FORMAT_PCM_16 ;
  243|      1|					break ;
  244|       |
  245|      1|			case 3 :
  ------------------
  |  Branch (245:4): [True: 1, False: 17]
  ------------------
  246|      1|					psf->sf.format |= SF_FORMAT_PCM_24 ;
  247|      1|					break ;
  248|       |
  249|      1|			case 4 :
  ------------------
  |  Branch (249:4): [True: 1, False: 17]
  ------------------
  250|      1|					psf->sf.format |= SF_FORMAT_PCM_32 ;
  251|      1|					break ;
  252|       |
  253|     14|			default : break ;
  ------------------
  |  Branch (253:4): [True: 14, False: 4]
  ------------------
  254|     18|			} ;
  255|     18|		}
  256|     34|	else if (encoding != 0)
  ------------------
  |  Branch (256:11): [True: 3, False: 31]
  ------------------
  257|      3|		psf->sf.format |= encoding ;
  258|     31|	else
  259|     31|		return SFE_UNIMPLEMENTED ;
  260|       |
  261|       |	/* Sanitize psf->sf.format. */
  262|     21|	switch (SF_CODEC (psf->sf.format))
  ------------------
  |  |  102|     21|#define SF_CODEC(x)			((x) & SF_FORMAT_SUBMASK)
  ------------------
  263|     21|	{	case SF_FORMAT_ULAW :
  ------------------
  |  Branch (263:4): [True: 2, False: 19]
  ------------------
  264|      3|		case SF_FORMAT_ALAW :
  ------------------
  |  Branch (264:3): [True: 1, False: 20]
  ------------------
  265|      3|		case SF_FORMAT_PCM_U8 :
  ------------------
  |  Branch (265:3): [True: 0, False: 21]
  ------------------
  266|       |			/* Blank out endian bits. */
  267|      3|			psf->sf.format = SF_FORMAT_NIST | SF_CODEC (psf->sf.format) ;
  ------------------
  |  |  102|      3|#define SF_CODEC(x)			((x) & SF_FORMAT_SUBMASK)
  ------------------
  268|      3|			break ;
  269|       |
  270|     18|		default :
  ------------------
  |  Branch (270:3): [True: 18, False: 3]
  ------------------
  271|     18|			break ;
  272|     21|		} ;
  273|       |
  274|     21|	return 0 ;
  275|     21|} /* nist_read_header */
nist.c:nist_close:
  279|     21|{
  280|     21|	if (psf->file.mode == SFM_WRITE || psf->file.mode == SFM_RDWR)
  ------------------
  |  Branch (280:6): [True: 0, False: 21]
  |  Branch (280:37): [True: 0, False: 21]
  ------------------
  281|      0|		nist_write_header (psf, SF_TRUE) ;
  282|       |
  283|     21|	return 0 ;
  284|     21|} /* nist_close */

nms_adpcm_init:
 1026|    241|{	NMS_ADPCM_PRIVATE	*pnms ;
 1027|       |
 1028|    241|	if (psf->codec_data != NULL)
  ------------------
  |  Branch (1028:6): [True: 0, False: 241]
  ------------------
 1029|      0|	{	psf_log_printf (psf, "*** psf->codec_data is not NULL.\n") ;
 1030|      0|		return SFE_INTERNAL ;
 1031|    241|		} ;
 1032|       |
 1033|    241|	psf->sf.seekable = SF_FALSE ;
 1034|       |
 1035|    241|	if (psf->sf.channels != 1)
  ------------------
  |  Branch (1035:6): [True: 0, False: 241]
  ------------------
 1036|      0|		return SFE_NMS_ADPCM_NOT_MONO ;
 1037|       |
 1038|    241|	if ((pnms = calloc (1, sizeof (NMS_ADPCM_PRIVATE))) == NULL)
  ------------------
  |  Branch (1038:6): [True: 0, False: 241]
  ------------------
 1039|      0|		return SFE_MALLOC_FAILED ;
 1040|       |
 1041|    241|	psf->codec_data = (void*) pnms ;
 1042|       |
 1043|    241|	pnms->block_curr = 0 ;
 1044|    241|	pnms->sample_curr = 0 ;
 1045|       |
 1046|    241|	switch (SF_CODEC (psf->sf.format))
  ------------------
  |  |  102|    241|#define SF_CODEC(x)			((x) & SF_FORMAT_SUBMASK)
  ------------------
 1047|    241|	{	case SF_FORMAT_NMS_ADPCM_16 :
  ------------------
  |  Branch (1047:4): [True: 167, False: 74]
  ------------------
 1048|    167|					pnms->type = NMS16 ;
 1049|    167|					pnms->shortsperblock = NMS_BLOCK_SHORTS_16 ;
  ------------------
  |  |   46|    167|#define NMS_BLOCK_SHORTS_16 21
  ------------------
 1050|    167|					break ;
 1051|     42|		case SF_FORMAT_NMS_ADPCM_24 :
  ------------------
  |  Branch (1051:3): [True: 42, False: 199]
  ------------------
 1052|     42|					pnms->type = NMS24 ;
 1053|     42|					pnms->shortsperblock = NMS_BLOCK_SHORTS_24 ;
  ------------------
  |  |   45|     42|#define NMS_BLOCK_SHORTS_24 31
  ------------------
 1054|     42|					break ;
 1055|     32|		case SF_FORMAT_NMS_ADPCM_32 :
  ------------------
  |  Branch (1055:3): [True: 32, False: 209]
  ------------------
 1056|     32|					pnms->type = NMS32 ;
 1057|     32|					pnms->shortsperblock = NMS_BLOCK_SHORTS_32 ;
  ------------------
  |  |   44|     32|#define NMS_BLOCK_SHORTS_32 41
  ------------------
 1058|     32|					break ;
 1059|       |
 1060|      0|		default : return SFE_UNIMPLEMENTED ;
  ------------------
  |  Branch (1060:3): [True: 0, False: 241]
  ------------------
 1061|    241|	} ;
 1062|    241|	nms_adpcm_codec_init (&pnms->state, pnms->type) ;
 1063|       |
 1064|    241|	psf->filelength = psf_get_filelen (psf) ;
 1065|    241|	if (psf->filelength < psf->dataoffset)
  ------------------
  |  Branch (1065:6): [True: 0, False: 241]
  ------------------
 1066|      0|		psf->filelength = psf->dataoffset ;
 1067|       |
 1068|    241|	psf->datalength = psf->filelength - psf->dataoffset ;
 1069|    241|	if (psf->dataend > 0)
  ------------------
  |  Branch (1069:6): [True: 4, False: 237]
  ------------------
 1070|      4|		psf->datalength -= psf->filelength - psf->dataend ;
 1071|       |
 1072|    241|	if (psf->file.mode == SFM_READ)
  ------------------
  |  Branch (1072:6): [True: 241, False: 0]
  ------------------
 1073|    241|	{	psf->read_short		= nms_adpcm_read_s ;
 1074|    241|		psf->read_int		= nms_adpcm_read_i ;
 1075|    241|		psf->read_float		= nms_adpcm_read_f ;
 1076|    241|		psf->read_double	= nms_adpcm_read_d ;
 1077|    241|		}
 1078|      0|	else if (psf->file.mode == SFM_WRITE)
  ------------------
  |  Branch (1078:11): [True: 0, False: 0]
  ------------------
 1079|      0|	{	psf->write_short	= nms_adpcm_write_s ;
 1080|      0|		psf->write_int		= nms_adpcm_write_i ;
 1081|      0|		psf->write_float	= nms_adpcm_write_f ;
 1082|      0|		psf->write_double	= nms_adpcm_write_d ;
 1083|      0|		} ;
 1084|       |
 1085|    241|	if (psf->datalength % (pnms->shortsperblock * sizeof (short)))
  ------------------
  |  Branch (1085:6): [True: 229, False: 12]
  ------------------
 1086|    229|	{	psf_log_printf (psf, "*** Odd psf->datalength (%D) should be a multiple of %d\n",
 1087|    229|						psf->datalength, pnms->shortsperblock * sizeof (short)) ;
 1088|    229|		pnms->blocks_total = (psf->datalength / (pnms->shortsperblock * sizeof (short))) + 1 ;
 1089|    229|		}
 1090|     12|	else
 1091|     12|		pnms->blocks_total = psf->datalength / (pnms->shortsperblock * sizeof (short)) ;
 1092|       |
 1093|    241|	psf->sf.frames		= (sf_count_t) pnms->blocks_total * NMS_SAMPLES_PER_BLOCK ;
  ------------------
  |  |   43|    241|#define NMS_SAMPLES_PER_BLOCK 160
  ------------------
 1094|    241|	psf->codec_close	= nms_adpcm_close ;
 1095|    241|	psf->seek			= nms_adpcm_seek ;
 1096|       |
 1097|    241|	return 0 ;
 1098|    241|} /* nms_adpcm_init */
nms_adpcm.c:nms_adpcm_codec_init:
  303|    241|{	memset (s, 0, sizeof (struct nms_adpcm_state)) ;
  304|    241|	s->t_off = (type == NMS32) ? 16 : (type == NMS24) ? 8 : 0 ;
  ------------------
  |  Branch (304:13): [True: 32, False: 209]
  |  Branch (304:36): [True: 42, False: 167]
  ------------------
  305|    241|} /* nms_adpcm_codec_init */
nms_adpcm.c:nms_adpcm_read_block:
  719|   816k|{	int	count, indx = 0 ;
  720|       |
  721|  1.63M|	while (indx < len)
  ------------------
  |  Branch (721:9): [True: 816k, False: 816k]
  ------------------
  722|   816k|	{	if (pnms->sample_curr >= NMS_SAMPLES_PER_BLOCK)
  ------------------
  |  |   43|   816k|#define NMS_SAMPLES_PER_BLOCK 160
  ------------------
  |  Branch (722:8): [True: 4.86k, False: 811k]
  ------------------
  723|  4.86k|		{	pnms->block_curr ++ ;
  724|  4.86k|			pnms->sample_curr = 0 ;
  725|  4.86k|			} ;
  726|       |
  727|   816k|		if (pnms->block_curr > pnms->blocks_total)
  ------------------
  |  Branch (727:7): [True: 0, False: 816k]
  ------------------
  728|      0|		{	memset (&(ptr [indx]), 0, (len - indx) * sizeof (short)) ;
  729|      0|			return indx ;
  730|   816k|			} ;
  731|       |
  732|   816k|		if (pnms->sample_curr == 0)
  ------------------
  |  Branch (732:7): [True: 5.10k, False: 811k]
  ------------------
  733|  5.10k|			psf_nms_adpcm_decode_block (psf, pnms) ;
  734|       |
  735|   816k|		count = NMS_SAMPLES_PER_BLOCK - pnms->sample_curr ;
  ------------------
  |  |   43|   816k|#define NMS_SAMPLES_PER_BLOCK 160
  ------------------
  736|   816k|		if (len - indx < count)
  ------------------
  |  Branch (736:7): [True: 811k, False: 5.10k]
  ------------------
  737|   811k|			count = len - indx ;
  738|       |
  739|   816k|		memcpy (&(ptr [indx]), &(pnms->samples [pnms->sample_curr]), count * sizeof (short)) ;
  740|   816k|		indx += count ;
  741|   816k|		pnms->sample_curr += count ;
  742|   816k|		} ;
  743|       |
  744|   816k|	return indx ;
  745|   816k|} /* nms_adpcm_read_block */
nms_adpcm.c:psf_nms_adpcm_decode_block:
  702|  5.10k|{	int k ;
  703|       |
  704|  5.10k|	if ((k = (int) psf_fread (pnms->block, sizeof (short), pnms->shortsperblock, psf)) != pnms->shortsperblock)
  ------------------
  |  Branch (704:6): [True: 226, False: 4.87k]
  ------------------
  705|    226|	{	psf_log_printf (psf, "*** Warning : short read (%d != %d).\n", k, pnms->shortsperblock) ;
  706|    226|		memset (pnms->block + k, 0, (pnms->shortsperblock - k) * sizeof (short)) ;
  707|    226|		} ;
  708|       |
  709|  5.10k|	if (CPU_IS_BIG_ENDIAN)
  ------------------
  |  |   11|  5.10k|#define CPU_IS_BIG_ENDIAN 0
  |  |  ------------------
  |  |  |  Branch (11:27): [Folded, False: 5.10k]
  |  |  ------------------
  ------------------
  710|      0|		endswap_short_array ((signed short *) pnms->block, pnms->shortsperblock) ;
  711|       |
  712|  5.10k|	nms_adpcm_decode_block (psf, pnms, pnms->block, pnms->samples) ;
  713|       |
  714|  5.10k|	return 1 ;
  715|  5.10k|} /* nms_adpcm_decode_block */
nms_adpcm.c:nms_adpcm_decode_block:
  638|  5.10k|{	int k ;
  639|       |
  640|  5.10k|	switch (pnms->type)
  641|  5.10k|	{	case NMS16 :
  ------------------
  |  Branch (641:4): [True: 3.33k, False: 1.77k]
  ------------------
  642|  3.33k|			nms_adpcm_block_unpack_16 (block, samples, NULL) ;
  643|  3.33k|			break ;
  644|    984|		case NMS24 :
  ------------------
  |  Branch (644:3): [True: 984, False: 4.11k]
  ------------------
  645|    984|			nms_adpcm_block_unpack_24 (block, samples, NULL) ;
  646|    984|			break ;
  647|    788|		case NMS32 :
  ------------------
  |  Branch (647:3): [True: 788, False: 4.31k]
  ------------------
  648|    788|			nms_adpcm_block_unpack_32 (block, samples, NULL) ;
  649|    788|			break ;
  650|       |
  651|      0|		default :
  ------------------
  |  Branch (651:3): [True: 0, False: 5.10k]
  ------------------
  652|      0|			psf_log_printf (psf, "*** Error : Unhandled NMS ADPCM type %d.\n", pnms->type) ;
  653|      0|			return 0 ;
  654|  5.10k|		} ;
  655|       |
  656|   821k|	for (k = 0 ; k < NMS_SAMPLES_PER_BLOCK ; k++)
  ------------------
  |  |   43|   821k|#define NMS_SAMPLES_PER_BLOCK 160
  ------------------
  |  Branch (656:15): [True: 816k, False: 5.10k]
  ------------------
  657|   816k|		samples [k] = nms_adpcm_decode_sample (&pnms->state, samples [k]) ;
  658|       |
  659|  5.10k|	return NMS_SAMPLES_PER_BLOCK ;
  ------------------
  |  |   43|  5.10k|#define NMS_SAMPLES_PER_BLOCK 160
  ------------------
  660|  5.10k|} /* nms_adpcm_decode_block */
nms_adpcm.c:nms_adpcm_block_unpack_16:
  453|  3.33k|{	int k ;
  454|  3.33k|	uint16_t w = 0 ;
  455|       |
  456|   136k|	for (k = 0 ; k < NMS_SAMPLES_PER_BLOCK ; )
  ------------------
  |  |   43|   136k|#define NMS_SAMPLES_PER_BLOCK 160
  ------------------
  |  Branch (456:15): [True: 133k, False: 3.33k]
  ------------------
  457|   133k|	{	/*
  458|       |		** k % 8 == [0-3]: Top 2-bits of a nibble
  459|       |		** k % 8 == [4-7]: Bottom 2-bits of a nibble
  460|       |		*/
  461|   133k|		if ((k & 4) == 0)
  ------------------
  |  Branch (461:7): [True: 66.6k, False: 66.6k]
  ------------------
  462|  66.6k|			w = *(block++) ;
  463|  66.6k|		else
  464|  66.6k|			w <<= 2 ;
  465|   133k|		codewords [k++] = (w >> 12) & 0xc ;
  466|   133k|		codewords [k++] = (w >> 8) & 0xc ;
  467|   133k|		codewords [k++] = (w >> 4) & 0xc ;
  468|   133k|		codewords [k++] = w & 0xc ;
  469|   133k|		} ;
  470|       |
  471|       |	/*
  472|       |	** Every block ends with a short representing a RMS-approximation for the
  473|       |	** block.
  474|       |	**/
  475|  3.33k|	if (rms)
  ------------------
  |  Branch (475:6): [True: 0, False: 3.33k]
  ------------------
  476|      0|		*rms = *block ;
  477|  3.33k|} /* nms_adpcm_unpack_16 */
nms_adpcm.c:nms_adpcm_block_unpack_24:
  486|    984|{	int k ;
  487|    984|	uint16_t w = 0, residual = 0 ;
  488|       |
  489|  40.3k|	for (k = 0 ; k < NMS_SAMPLES_PER_BLOCK ; )
  ------------------
  |  |   43|  40.3k|#define NMS_SAMPLES_PER_BLOCK 160
  ------------------
  |  Branch (489:15): [True: 39.3k, False: 984]
  ------------------
  490|  39.3k|	{		/*
  491|       |		** k % 16 == [0, 11]: Unpack new nibble, build residual
  492|       |		** k % 16 == [12, 15]: Unpack residual
  493|       |		*/
  494|  39.3k|		if ((k & 12) != 12)
  ------------------
  |  Branch (494:7): [True: 29.5k, False: 9.84k]
  ------------------
  495|  29.5k|		{	w = *(block++) ;
  496|  29.5k|			residual = (residual << 1) | (w & 0x1111) ;
  497|  29.5k|			}
  498|  9.84k|		else
  499|  9.84k|		{	w = residual << 1 ;
  500|  9.84k|			residual = 0 ;
  501|  9.84k|			} ;
  502|  39.3k|		codewords [k++] = (w >> 12) & 0xe ;
  503|  39.3k|		codewords [k++] = (w >> 8) & 0xe ;
  504|  39.3k|		codewords [k++] = (w >> 4) & 0xe ;
  505|  39.3k|		codewords [k++] = w & 0xe ;
  506|  39.3k|		} ;
  507|       |
  508|       |	/*
  509|       |	** Every block ends with a short representing a RMS-approximation for the
  510|       |	** block.
  511|       |	**/
  512|    984|	if (rms)
  ------------------
  |  Branch (512:6): [True: 0, False: 984]
  ------------------
  513|      0|		*rms = *block ;
  514|    984|} /* nms_adpcm_unpack_24 */
nms_adpcm.c:nms_adpcm_block_unpack_32:
  523|    788|{	int k ;
  524|    788|	uint16_t w = 0 ;
  525|       |
  526|  32.3k|	for (k = 0 ; k < NMS_SAMPLES_PER_BLOCK ; )
  ------------------
  |  |   43|  32.3k|#define NMS_SAMPLES_PER_BLOCK 160
  ------------------
  |  Branch (526:15): [True: 31.5k, False: 788]
  ------------------
  527|  31.5k|	{	w = *(block++) ;
  528|  31.5k|		codewords [k++] = (w >> 12) & 0xf ;
  529|  31.5k|		codewords [k++] = (w >> 8) & 0xf ;
  530|  31.5k|		codewords [k++] = (w >> 4) & 0xf ;
  531|  31.5k|		codewords [k++] = w & 0xf ;
  532|  31.5k|		} ;
  533|       |	/*
  534|       |	** Every block ends with a short representing a RMS-approximation for the
  535|       |	** block.
  536|       |	**/
  537|    788|	if (rms)
  ------------------
  |  Branch (537:6): [True: 0, False: 788]
  ------------------
  538|      0|		*rms = *block ;
  539|    788|} /* nms_adpcm_unpack_32 */
nms_adpcm.c:nms_adpcm_decode_sample:
  409|   816k|{	int_fast32_t sl ;
  410|       |
  411|   816k|	nms_adpcm_update (s) ;
  412|   816k|	sl = nms_adpcm_reconstruct_sample (s, I) ;
  413|       |
  414|       |	/* Clamp to [-0x1fdf, 0x1fdf] (just under 14 bits resolution) */
  415|   816k|	if (sl < -0x1fdf)
  ------------------
  |  Branch (415:6): [True: 159k, False: 656k]
  ------------------
  416|   159k|		sl = -0x1fdf ;
  417|   656k|	else if (sl > 0x1fdf)
  ------------------
  |  Branch (417:11): [True: 160k, False: 495k]
  ------------------
  418|   160k|		sl = 0x1fdf ;
  419|       |
  420|       |	/* Expand from 14 to 16 bits */
  421|   816k|	sl = (sl * 0x7fff) / 0x1fdf ;
  422|       |
  423|   816k|	return (int16_t) sl ;
  424|   816k|} /* nms_adpcm_decode_sample */
nms_adpcm.c:nms_adpcm_update:
  196|   816k|{	/* Variable names from ITU G.726 spec */
  197|   816k|	short a1ul, fa1 ;
  198|   816k|	int_fast32_t se ;
  199|   816k|	int i ;
  200|       |
  201|       |	/* Decay and Modify the scale factor in the log domain based on the codeword. */
  202|   816k|	s->yl = ((s->yl *0xf8) >> 8) + table_scale_factor_step [s->t_off + (s->Ik & 7)] ;
  203|   816k|	if (s->yl < 2171)
  ------------------
  |  Branch (203:6): [True: 61.3k, False: 754k]
  ------------------
  204|  61.3k|		s->yl = 2171 ;
  205|   754k|	else if (s->yl > 20480)
  ------------------
  |  Branch (205:11): [True: 173k, False: 581k]
  ------------------
  206|   173k|		s->yl = 20480 ;
  207|   816k|	s->y = nms_adpcm_antilog (s->yl) ;
  208|       |
  209|       |	/* Update the zero predictor coefficients. */
  210|  5.71M|	for (i = 0 ; i < 6 ; i++)
  ------------------
  |  Branch (210:15): [True: 4.89M, False: 816k]
  ------------------
  211|  4.89M|	{	s->b [i] = (s->b [i] * 0xff) >> 8 ;
  212|  4.89M|		if ((s->d_q [0] ^ s->d_q [i + 1]) >= 0)
  ------------------
  |  Branch (212:7): [True: 3.39M, False: 1.49M]
  ------------------
  213|  3.39M|			s->b [i] += 128 ;
  214|  1.49M|		else
  215|  1.49M|			s->b [i] -= 128 ;
  216|  4.89M|		}
  217|       |
  218|       |	/* Update the pole predictor coefficients. */
  219|   816k|	fa1 = s->a [0] >> 5 ;
  220|   816k|	if (fa1 < -256)
  ------------------
  |  Branch (220:6): [True: 77.8k, False: 738k]
  ------------------
  221|  77.8k|		fa1 = -256 ;
  222|   738k|	else if (fa1 > 256)
  ------------------
  |  Branch (222:11): [True: 678k, False: 60.0k]
  ------------------
  223|   678k|		fa1 = 256 ;
  224|       |
  225|   816k|	s->a [0] = (s->a [0] * 0xff) >> 8 ;
  226|   816k|	if (s->p [0] != 0 && s->p [1] != 0 && ((s->p [0] ^ s->p [1]) < 0))
  ------------------
  |  Branch (226:6): [True: 750k, False: 65.9k]
  |  Branch (226:23): [True: 746k, False: 3.61k]
  |  Branch (226:40): [True: 175k, False: 570k]
  ------------------
  227|   175k|		s->a [0] -= 192 ;
  228|   640k|	else
  229|   640k|	{	s->a [0] += 192 ;
  230|   640k|		fa1 = -fa1 ;
  231|   640k|		}
  232|       |
  233|   816k|	s->a [1] = fa1 + ((s->a [1] * 0xfe) >> 8) ;
  234|   816k|	if (s->p [0] != 0 && s->p [2] != 0 && ((s->p [0] ^ s->p [2]) < 0))
  ------------------
  |  Branch (234:6): [True: 750k, False: 65.9k]
  |  Branch (234:23): [True: 746k, False: 4.36k]
  |  Branch (234:40): [True: 127k, False: 618k]
  ------------------
  235|   127k|		s->a [1] -= 128 ;
  236|   689k|	else
  237|   689k|		s->a [1] += 128 ;
  238|       |
  239|       |	/* Stability constraints. */
  240|   816k|	if (s->a [1] < -12288)
  ------------------
  |  Branch (240:6): [True: 450k, False: 365k]
  ------------------
  241|   450k|		s->a [1] = -12288 ;
  242|   365k|	else if (s->a [1] > 12288)
  ------------------
  |  Branch (242:11): [True: 3.00k, False: 362k]
  ------------------
  243|  3.00k|		s->a [1] = 12288 ;
  244|   816k|	a1ul = 15360 - s->a [1] ;
  245|   816k|	if (s->a [0] >= a1ul)
  ------------------
  |  Branch (245:6): [True: 365k, False: 450k]
  ------------------
  246|   365k|		s->a [0] = a1ul ;
  247|   450k|	else
  248|   450k|	{	a1ul = -a1ul ;
  249|   450k|		if (s->a [0] < a1ul)
  ------------------
  |  Branch (249:7): [True: 55.5k, False: 395k]
  ------------------
  250|  55.5k|			s->a [0] = a1ul ;
  251|   450k|		} ;
  252|       |
  253|       |	/* Compute the zero predictor estimate and rotate past deltas. */
  254|   816k|	se = 0 ;
  255|  5.71M|	for (i = 5 ; i >= 0 ; i--)
  ------------------
  |  Branch (255:15): [True: 4.89M, False: 816k]
  ------------------
  256|  4.89M|	{	se += (int_fast32_t) s->d_q [i] * s->b [i] ;
  257|  4.89M|		s->d_q [i + 1] = s->d_q [i] ;
  258|  4.89M|		} ;
  259|   816k|	s->s_ez = se >> 14 ;
  260|       |
  261|       |	/* Complete the signal estimate. */
  262|   816k|	se += (int_fast32_t) s->a [0] * s->s_r [0] ;
  263|   816k|	se += (int_fast32_t) s->a [1] * s->s_r [1] ;
  264|   816k|	s->s_e = se >> 14 ;
  265|       |
  266|       |	/* Rotate members to prepare for next iteration. */
  267|   816k|	s->s_r [1] = s->s_r [0] ;
  268|   816k|	s->p [2] = s->p [1] ;
  269|   816k|	s->p [1] = s->p [0] ;
  270|   816k|} /* nms_adpcm_update */
nms_adpcm.c:nms_adpcm_antilog:
  184|   816k|{	int_fast32_t r ;
  185|       |
  186|   816k|	r = 0x1000 ;
  187|   816k|	r += (((int_fast32_t) (exp & 0x3f) * 0x166b) >> 12) ;
  188|   816k|	r *= table_expn [(exp & 0x7c0) >> 6] ;
  189|   816k|	r >>= (26 - (exp >> 11)) ;
  190|       |
  191|   816k|	return (short) r ;
  192|   816k|} /* nms_adpcm_antilog */
nms_adpcm.c:nms_adpcm_reconstruct_sample:
  275|   816k|{	/* Variable names from ITU G.726 spec */
  276|   816k|	int_fast32_t dqx ;
  277|       |
  278|       |	/*
  279|       |	** The ordering of the 12-bit right-shift is a precision loss. It agrees
  280|       |	** with the output of a 16-bit NMSVCE.DLL, but disagrees with the output
  281|       |	** of a CG6565 board.
  282|       |	*/
  283|       |
  284|       |	/* Look up the delta, scale and sign it. */
  285|   816k|	dqx = table_step [s->t_off + (I & 7)] * s->y ;
  286|   816k|	if (I & 8)
  ------------------
  |  Branch (286:6): [True: 326k, False: 489k]
  ------------------
  287|   326k|		dqx = -dqx ;
  288|       |
  289|       |	/* Take from delta scale to actual scale. */
  290|   816k|	dqx >>= 12 ;
  291|       |
  292|       |	/* Set variables used as input for the next predictor update. */
  293|   816k|	s->d_q [0] = dqx ;
  294|   816k|	s->s_r [0] = s->s_e + dqx ;
  295|   816k|	s->Ik = I & 0xf ;
  296|   816k|	s->p [0] = s->s_ez + dqx ;
  297|       |
  298|   816k|	return s->s_r [0] ;
  299|   816k|} /* nms_adpcm_reconstruct_sample */
nms_adpcm.c:nms_adpcm_read_f:
  804|   816k|{	BUF_UNION	ubuf ;
  805|   816k|	NMS_ADPCM_PRIVATE *pnms ;
  806|   816k|	short		*sptr ;
  807|   816k|	int			k, bufferlen, readcount = 0, count ;
  808|   816k|	sf_count_t	total = 0 ;
  809|   816k|	float 		normfact ;
  810|       |
  811|   816k|	if (psf->codec_data == NULL)
  ------------------
  |  Branch (811:6): [True: 0, False: 816k]
  ------------------
  812|      0|		return 0 ;
  813|   816k|	pnms = (NMS_ADPCM_PRIVATE*) psf->codec_data ;
  814|       |
  815|   816k|	normfact = (psf->norm_float == SF_TRUE) ? 1.0 / ((float) 0x8000) : 1.0 ;
  ------------------
  |  Branch (815:13): [True: 816k, False: 0]
  ------------------
  816|       |
  817|   816k|	sptr = ubuf.sbuf ;
  818|   816k|	bufferlen = SF_BUFFER_LEN / sizeof (short) ;
  ------------------
  |  |   72|   816k|#define	SF_BUFFER_LEN			(8192)
  ------------------
  819|  1.63M|	while (len > 0)
  ------------------
  |  Branch (819:9): [True: 816k, False: 816k]
  ------------------
  820|   816k|	{	readcount = (len >= bufferlen) ? bufferlen : (int) len ;
  ------------------
  |  Branch (820:16): [True: 0, False: 816k]
  ------------------
  821|   816k|		count = nms_adpcm_read_block (psf, pnms, sptr, readcount) ;
  822|  1.63M|		for (k = 0 ; k < readcount ; k++)
  ------------------
  |  Branch (822:16): [True: 816k, False: 816k]
  ------------------
  823|   816k|			ptr [total + k] = normfact * sptr [k] ;
  824|       |
  825|   816k|		total += count ;
  826|   816k|		len -= readcount ;
  827|   816k|		if (count != readcount)
  ------------------
  |  Branch (827:7): [True: 0, False: 816k]
  ------------------
  828|      0|			break ;
  829|   816k|		} ;
  830|       |
  831|   816k|	return total ;
  832|   816k|} /* nms_adpcm_read_f */
nms_adpcm.c:nms_adpcm_close:
 1102|    241|{	NMS_ADPCM_PRIVATE *pnms ;
 1103|       |
 1104|    241|	pnms = (NMS_ADPCM_PRIVATE*) psf->codec_data ;
 1105|       |
 1106|       |	/*
 1107|       |	** If a block has been partially assembled, write it out as the final
 1108|       |	** block.
 1109|       |	*/
 1110|    241|	if (psf->file.mode == SFM_WRITE)
  ------------------
  |  Branch (1110:6): [True: 0, False: 241]
  ------------------
 1111|      0|	{	if (pnms->sample_curr && pnms->sample_curr < NMS_SAMPLES_PER_BLOCK)
  ------------------
  |  |   43|      0|#define NMS_SAMPLES_PER_BLOCK 160
  ------------------
  |  Branch (1111:8): [True: 0, False: 0]
  |  Branch (1111:29): [True: 0, False: 0]
  ------------------
 1112|      0|		{	memset (pnms->samples + pnms->sample_curr, 0, (NMS_SAMPLES_PER_BLOCK - pnms->sample_curr) * sizeof (short)) ;
  ------------------
  |  |   43|      0|#define NMS_SAMPLES_PER_BLOCK 160
  ------------------
 1113|      0|			psf_nms_adpcm_encode_block (psf, pnms) ;
 1114|      0|			}
 1115|       |
 1116|      0|		if (psf->write_header)
  ------------------
  |  Branch (1116:7): [True: 0, False: 0]
  ------------------
 1117|      0|			psf->write_header (psf, SF_FALSE) ;
 1118|      0|		}
 1119|       |
 1120|    241|	return 0 ;
 1121|    241|} /* nms_adpcm_close */

ogg_open:
  920|      1|{
  921|      1|	psf_log_printf (psf, "This version of libsndfile was compiled without Ogg/Vorbis support.\n") ;
  922|      1|	return SFE_UNIMPLEMENTED ;
  923|      1|} /* ogg_open */

paf_open:
  103|    137|{	int		subformat, error, endian ;
  104|       |
  105|    137| 	psf->dataoffset = PAF_HEADER_LENGTH ;
  ------------------
  |  |   43|    137|#define	PAF_HEADER_LENGTH 			2048
  ------------------
  106|       |
  107|    137|	if (psf->file.mode == SFM_READ || (psf->file.mode == SFM_RDWR && psf->filelength > 0))
  ------------------
  |  Branch (107:6): [True: 137, False: 0]
  |  Branch (107:37): [True: 0, False: 0]
  |  Branch (107:67): [True: 0, False: 0]
  ------------------
  108|    137|	{	if ((error = paf_read_header (psf)))
  ------------------
  |  Branch (108:8): [True: 60, False: 77]
  ------------------
  109|     60|			return error ;
  110|    137|		} ;
  111|       |
  112|     77|	subformat = SF_CODEC (psf->sf.format) ;
  ------------------
  |  |  102|     77|#define SF_CODEC(x)			((x) & SF_FORMAT_SUBMASK)
  ------------------
  113|       |
  114|     77|	if (psf->file.mode == SFM_WRITE || psf->file.mode == SFM_RDWR)
  ------------------
  |  Branch (114:6): [True: 0, False: 77]
  |  Branch (114:37): [True: 0, False: 77]
  ------------------
  115|      0|	{	if ((SF_CONTAINER (psf->sf.format)) != SF_FORMAT_PAF)
  ------------------
  |  |  101|      0|#define SF_CONTAINER(x)		((x) & SF_FORMAT_TYPEMASK)
  ------------------
  |  Branch (115:8): [True: 0, False: 0]
  ------------------
  116|      0|			return	SFE_BAD_OPEN_FORMAT ;
  117|       |
  118|      0|		endian = SF_ENDIAN (psf->sf.format) ;
  ------------------
  |  |  103|      0|#define SF_ENDIAN(x)		((x) & SF_FORMAT_ENDMASK)
  ------------------
  119|       |
  120|       |		/* PAF is by default big endian. */
  121|      0|		psf->endian = SF_ENDIAN_BIG ;
  122|       |
  123|      0|		if (endian == SF_ENDIAN_LITTLE || (CPU_IS_LITTLE_ENDIAN && (endian == SF_ENDIAN_CPU)))
  ------------------
  |  |   14|      0|#define CPU_IS_LITTLE_ENDIAN 1
  |  |  ------------------
  |  |  |  Branch (14:30): [True: 0, Folded]
  |  |  ------------------
  ------------------
  |  Branch (123:7): [True: 0, False: 0]
  |  Branch (123:62): [True: 0, False: 0]
  ------------------
  124|      0|			psf->endian = SF_ENDIAN_LITTLE ;
  125|       |
  126|      0|		if ((error = paf_write_header (psf, SF_FALSE)))
  ------------------
  |  Branch (126:7): [True: 0, False: 0]
  ------------------
  127|      0|			return error ;
  128|       |
  129|      0|		psf->write_header = paf_write_header ;
  130|     77|		} ;
  131|       |
  132|     77|	switch (subformat)
  133|     77|	{	case SF_FORMAT_PCM_S8 :
  ------------------
  |  Branch (133:4): [True: 1, False: 76]
  ------------------
  134|      1|					psf->bytewidth = 1 ;
  135|      1|					error = pcm_init (psf) ;
  136|      1|					break ;
  137|       |
  138|      5|		case SF_FORMAT_PCM_16 :
  ------------------
  |  Branch (138:3): [True: 5, False: 72]
  ------------------
  139|      5|					psf->bytewidth = 2 ;
  140|      5|					error = pcm_init (psf) ;
  141|      5|					break ;
  142|       |
  143|     71|		case SF_FORMAT_PCM_24 :
  ------------------
  |  Branch (143:3): [True: 71, False: 6]
  ------------------
  144|       |					/* No bytewidth because of whacky 24 bit encoding. */
  145|     71|					error = paf24_init (psf) ;
  146|     71|					break ;
  147|       |
  148|      0|		default : return SFE_PAF_UNKNOWN_FORMAT ;
  ------------------
  |  Branch (148:3): [True: 0, False: 77]
  ------------------
  149|     77|		} ;
  150|       |
  151|     77|	return error ;
  152|     77|} /* paf_open */
paf.c:paf_read_header:
  159|    137|{	PAF_FMT		paf_fmt ;
  160|    137|	int			marker ;
  161|       |
  162|    137|	if (psf->filelength < PAF_HEADER_LENGTH)
  ------------------
  |  |   43|    137|#define	PAF_HEADER_LENGTH 			2048
  ------------------
  |  Branch (162:6): [True: 3, False: 134]
  ------------------
  163|      3|		return SFE_PAF_SHORT_HEADER ;
  164|       |
  165|    134|	memset (&paf_fmt, 0, sizeof (paf_fmt)) ;
  166|    134|	psf_binheader_readf (psf, "pm", 0, &marker) ;
  167|       |
  168|    134|	psf_log_printf (psf, "Signature   : '%M'\n", marker) ;
  169|       |
  170|    134|	if (marker == PAF_MARKER)
  ------------------
  |  |   37|    134|#define PAF_MARKER	(MAKE_MARKER (' ', 'p', 'a', 'f'))
  |  |  ------------------
  |  |  |  |  122|    134|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (170:6): [True: 119, False: 15]
  ------------------
  171|    119|	{	psf_binheader_readf (psf, "E444444", &(paf_fmt.version), &(paf_fmt.endianness),
  172|    119|			&(paf_fmt.samplerate), &(paf_fmt.format), &(paf_fmt.channels), &(paf_fmt.source)) ;
  173|    119|		}
  174|     15|	else if (marker == FAP_MARKER)
  ------------------
  |  |   36|     15|#define FAP_MARKER	(MAKE_MARKER ('f', 'a', 'p', ' '))
  |  |  ------------------
  |  |  |  |  122|     15|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (174:11): [True: 15, False: 0]
  ------------------
  175|     15|	{	psf_binheader_readf (psf, "e444444", &(paf_fmt.version), &(paf_fmt.endianness),
  176|     15|			&(paf_fmt.samplerate), &(paf_fmt.format), &(paf_fmt.channels), &(paf_fmt.source)) ;
  177|     15|		}
  178|      0|	else
  179|      0|		return SFE_PAF_NO_MARKER ;
  180|       |
  181|    134|	psf_log_printf (psf, "Version     : %d\n", paf_fmt.version) ;
  182|       |
  183|    134|	if (paf_fmt.version != 0)
  ------------------
  |  Branch (183:6): [True: 3, False: 131]
  ------------------
  184|      3|	{	psf_log_printf (psf, "*** Bad version number. should be zero.\n") ;
  185|      3|		return SFE_PAF_VERSION ;
  186|    131|		} ;
  187|       |
  188|    131|	psf_log_printf (psf, "Sample Rate : %d\n", paf_fmt.samplerate) ;
  189|    131|	psf_log_printf (psf, "Channels    : %d\n", paf_fmt.channels) ;
  190|       |
  191|    131|	psf_log_printf (psf, "Endianness  : %d => ", paf_fmt.endianness) ;
  192|    131|	if (paf_fmt.endianness)
  ------------------
  |  Branch (192:6): [True: 82, False: 49]
  ------------------
  193|     82|	{	psf_log_printf (psf, "Little\n", paf_fmt.endianness) ;
  194|     82|		psf->endian = SF_ENDIAN_LITTLE ;
  195|     82|		}
  196|     49|	else
  197|     49|	{	psf_log_printf (psf, "Big\n", paf_fmt.endianness) ;
  198|     49|		psf->endian = SF_ENDIAN_BIG ;
  199|     49|		} ;
  200|       |
  201|    131|	if (paf_fmt.channels < 1 || paf_fmt.channels > SF_MAX_CHANNELS)
  ------------------
  |  |   95|     99|#define		SF_MAX_CHANNELS		1024
  ------------------
  |  Branch (201:6): [True: 32, False: 99]
  |  Branch (201:30): [True: 16, False: 83]
  ------------------
  202|     48|		return SFE_PAF_BAD_CHANNELS ;
  203|       |
  204|     83|	psf->datalength = psf->filelength - psf->dataoffset ;
  205|       |
  206|     83|	psf_binheader_readf (psf, "p", (int) psf->dataoffset) ;
  207|       |
  208|     83|	psf->sf.samplerate	= paf_fmt.samplerate ;
  209|     83|	psf->sf.channels 	= paf_fmt.channels ;
  210|       |
  211|       |	/* Only fill in type major. */
  212|     83|	psf->sf.format = SF_FORMAT_PAF ;
  213|       |
  214|     83|	psf_log_printf (psf, "Format      : %d => ", paf_fmt.format) ;
  215|       |
  216|       |	/* PAF is by default big endian. */
  217|     83|	psf->sf.format |= paf_fmt.endianness ? SF_ENDIAN_LITTLE : SF_ENDIAN_BIG ;
  ------------------
  |  Branch (217:20): [True: 53, False: 30]
  ------------------
  218|       |
  219|     83|	switch (paf_fmt.format)
  220|     83|	{	case PAF_PCM_S8 :
  ------------------
  |  Branch (220:4): [True: 1, False: 82]
  ------------------
  221|      1|					psf_log_printf (psf, "8 bit linear PCM\n") ;
  222|      1|					psf->bytewidth = 1 ;
  223|       |
  224|      1|					psf->sf.format |= SF_FORMAT_PCM_S8 ;
  225|       |
  226|      1|					psf->blockwidth = (sf_count_t) psf->bytewidth * psf->sf.channels ;
  227|      1|					psf->sf.frames = psf->datalength / psf->blockwidth ;
  228|      1|					break ;
  229|       |
  230|      5|		case PAF_PCM_16 :
  ------------------
  |  Branch (230:3): [True: 5, False: 78]
  ------------------
  231|      5|					psf_log_printf (psf, "16 bit linear PCM\n") ;
  232|      5|					psf->bytewidth = 2 ;
  233|       |
  234|      5|					psf->sf.format |= SF_FORMAT_PCM_16 ;
  235|       |
  236|      5|					psf->blockwidth = (sf_count_t) psf->bytewidth * psf->sf.channels ;
  237|      5|					psf->sf.frames = psf->datalength / psf->blockwidth ;
  238|      5|					break ;
  239|       |
  240|     71|		case PAF_PCM_24 :
  ------------------
  |  Branch (240:3): [True: 71, False: 12]
  ------------------
  241|     71|					psf_log_printf (psf, "24 bit linear PCM\n") ;
  242|     71|					psf->bytewidth = 3 ;
  243|       |
  244|     71|					psf->sf.format |= SF_FORMAT_PCM_24 ;
  245|       |
  246|     71|					psf->blockwidth = 0 ;
  247|     71|					psf->sf.frames = PAF24_SAMPLES_PER_BLOCK * psf->datalength /
  ------------------
  |  |   45|     71|#define	PAF24_SAMPLES_PER_BLOCK		10
  ------------------
  248|     71|											(PAF24_BLOCK_SIZE * psf->sf.channels) ;
  ------------------
  |  |   46|     71|#define	PAF24_BLOCK_SIZE			32
  ------------------
  249|     71|					break ;
  250|       |
  251|      6|		default :	psf_log_printf (psf, "Unknown\n") ;
  ------------------
  |  Branch (251:3): [True: 6, False: 77]
  ------------------
  252|      6|					return SFE_PAF_UNKNOWN_FORMAT ;
  253|      0|					break ;
  254|     83|		} ;
  255|       |
  256|     77|	psf_log_printf (psf, "Source      : %d => ", paf_fmt.source) ;
  257|       |
  258|     77|	switch (paf_fmt.source)
  259|     77|	{	case 1 : psf_log_printf (psf, "Analog Recording\n") ;
  ------------------
  |  Branch (259:4): [True: 4, False: 73]
  ------------------
  260|      4|					break ;
  261|      2|		case 2 : psf_log_printf (psf, "Digital Transfer\n") ;
  ------------------
  |  Branch (261:3): [True: 2, False: 75]
  ------------------
  262|      2|					break ;
  263|      1|		case 3 : psf_log_printf (psf, "Multi-track Mixdown\n") ;
  ------------------
  |  Branch (263:3): [True: 1, False: 76]
  ------------------
  264|      1|					break ;
  265|      2|		case 5 : psf_log_printf (psf, "Audio Resulting From DSP Processing\n") ;
  ------------------
  |  Branch (265:3): [True: 2, False: 75]
  ------------------
  266|      2|					break ;
  267|     68|		default : psf_log_printf (psf, "Unknown\n") ;
  ------------------
  |  Branch (267:3): [True: 68, False: 9]
  ------------------
  268|     68|					break ;
  269|     77|		} ;
  270|       |
  271|     77|	return 0 ;
  272|     77|} /* paf_read_header */
paf.c:paf24_init:
  346|     71|{	PAF24_PRIVATE	*ppaf24 ;
  347|     71|	int	paf24size ;
  348|       |
  349|     71|	paf24size = sizeof (PAF24_PRIVATE) + psf->sf.channels *
  350|     71|					(PAF24_BLOCK_SIZE + PAF24_SAMPLES_PER_BLOCK * sizeof (int)) ;
  ------------------
  |  |   46|     71|#define	PAF24_BLOCK_SIZE			32
  ------------------
              					(PAF24_BLOCK_SIZE + PAF24_SAMPLES_PER_BLOCK * sizeof (int)) ;
  ------------------
  |  |   45|     71|#define	PAF24_SAMPLES_PER_BLOCK		10
  ------------------
  351|       |
  352|       |	/*
  353|       |	**	Not exactly sure why this needs to be here but the tests
  354|       |	**	fail without it.
  355|       |	*/
  356|     71|	psf->last_op = 0 ;
  357|       |
  358|     71|	if (! (psf->codec_data = calloc (1, paf24size)))
  ------------------
  |  Branch (358:6): [True: 0, False: 71]
  ------------------
  359|      0|		return SFE_MALLOC_FAILED ;
  360|       |
  361|     71|	ppaf24 = (PAF24_PRIVATE*) psf->codec_data ;
  362|       |
  363|     71|	ppaf24->channels	= psf->sf.channels ;
  364|     71|	ppaf24->samples		= ppaf24->data ;
  365|     71|	ppaf24->block		= ppaf24->data + PAF24_SAMPLES_PER_BLOCK * ppaf24->channels ;
  ------------------
  |  |   45|     71|#define	PAF24_SAMPLES_PER_BLOCK		10
  ------------------
  366|       |
  367|     71|	ppaf24->blocksize = PAF24_BLOCK_SIZE * ppaf24->channels ;
  ------------------
  |  |   46|     71|#define	PAF24_BLOCK_SIZE			32
  ------------------
  368|       |
  369|     71|	if (psf->file.mode == SFM_READ || psf->file.mode == SFM_RDWR)
  ------------------
  |  Branch (369:6): [True: 71, False: 0]
  |  Branch (369:36): [True: 0, False: 0]
  ------------------
  370|     71|	{	paf24_read_block (psf, ppaf24) ;	/* Read first block. */
  371|       |
  372|     71|		psf->read_short		= paf24_read_s ;
  373|     71|		psf->read_int		= paf24_read_i ;
  374|     71|		psf->read_float		= paf24_read_f ;
  375|     71|		psf->read_double	= paf24_read_d ;
  376|     71|		} ;
  377|       |
  378|     71|	if (psf->file.mode == SFM_WRITE || psf->file.mode == SFM_RDWR)
  ------------------
  |  Branch (378:6): [True: 0, False: 71]
  |  Branch (378:37): [True: 0, False: 71]
  ------------------
  379|      0|	{	psf->write_short	= paf24_write_s ;
  380|      0|		psf->write_int		= paf24_write_i ;
  381|      0|		psf->write_float	= paf24_write_f ;
  382|      0|		psf->write_double	= paf24_write_d ;
  383|      0|		} ;
  384|       |
  385|     71|	psf->seek	= paf24_seek ;
  386|     71|	psf->container_close	= paf24_close ;
  387|       |
  388|     71|	psf->filelength = psf_get_filelen (psf) ;
  389|     71|	psf->datalength = psf->filelength - psf->dataoffset ;
  390|       |
  391|     71|	if (psf->datalength % PAF24_BLOCK_SIZE)
  ------------------
  |  |   46|     71|#define	PAF24_BLOCK_SIZE			32
  ------------------
  |  Branch (391:6): [True: 58, False: 13]
  ------------------
  392|     58|	{	if (psf->file.mode == SFM_READ)
  ------------------
  |  Branch (392:8): [True: 58, False: 0]
  ------------------
  393|     58|			psf_log_printf (psf, "*** Warning : file seems to be truncated.\n") ;
  394|     58|		ppaf24->max_blocks = psf->datalength / ppaf24->blocksize + 1 ;
  395|     58|		}
  396|     13|	else
  397|     13|		ppaf24->max_blocks = psf->datalength / ppaf24->blocksize ;
  398|       |
  399|     71|	ppaf24->read_block = 0 ;
  400|     71|	if (psf->file.mode == SFM_RDWR)
  ------------------
  |  Branch (400:6): [True: 0, False: 71]
  ------------------
  401|      0|		ppaf24->write_block = ppaf24->max_blocks ;
  402|     71|	else
  403|     71|		ppaf24->write_block = 0 ;
  404|       |
  405|     71|	psf->sf.frames = PAF24_SAMPLES_PER_BLOCK * ppaf24->max_blocks ;
  ------------------
  |  |   45|     71|#define	PAF24_SAMPLES_PER_BLOCK		10
  ------------------
  406|     71|	ppaf24->sample_count = psf->sf.frames ;
  407|       |
  408|     71|	return 0 ;
  409|     71|} /* paf24_init */
paf.c:paf24_read_block:
  484|  4.85k|{	int				k, channel ;
  485|  4.85k|	unsigned char	*cptr ;
  486|       |
  487|  4.85k|	ppaf24->read_block ++ ;
  488|  4.85k|	ppaf24->read_count = 0 ;
  489|       |
  490|  4.85k|	if (ppaf24->read_block * PAF24_SAMPLES_PER_BLOCK > ppaf24->sample_count)
  ------------------
  |  |   45|  4.85k|#define	PAF24_SAMPLES_PER_BLOCK		10
  ------------------
  |  Branch (490:6): [True: 71, False: 4.78k]
  ------------------
  491|     71|	{	memset (ppaf24->samples, 0, PAF24_SAMPLES_PER_BLOCK * ppaf24->channels) ;
  ------------------
  |  |   45|     71|#define	PAF24_SAMPLES_PER_BLOCK		10
  ------------------
  492|     71|		return 1 ;
  493|  4.78k|		} ;
  494|       |
  495|       |	/* Read the block. */
  496|  4.78k|	if ((k = (int) psf_fread (ppaf24->block, 1, ppaf24->blocksize, psf)) != ppaf24->blocksize)
  ------------------
  |  Branch (496:6): [True: 56, False: 4.73k]
  ------------------
  497|     56|		psf_log_printf (psf, "*** Warning : short read (%d != %d).\n", k, ppaf24->blocksize) ;
  498|       |
  499|       |	/* Do endian swapping if necessary. */
  500|  4.78k|	if ((CPU_IS_BIG_ENDIAN && psf->endian == SF_ENDIAN_LITTLE) || (CPU_IS_LITTLE_ENDIAN && psf->endian == SF_ENDIAN_BIG))
  ------------------
  |  |   11|  9.57k|#define CPU_IS_BIG_ENDIAN 0
  |  |  ------------------
  |  |  |  Branch (11:27): [Folded, False: 4.78k]
  |  |  ------------------
  ------------------
              	if ((CPU_IS_BIG_ENDIAN && psf->endian == SF_ENDIAN_LITTLE) || (CPU_IS_LITTLE_ENDIAN && psf->endian == SF_ENDIAN_BIG))
  ------------------
  |  |   14|  9.57k|#define CPU_IS_LITTLE_ENDIAN 1
  |  |  ------------------
  |  |  |  Branch (14:30): [True: 4.78k, Folded]
  |  |  ------------------
  ------------------
  |  Branch (500:28): [True: 0, False: 0]
  |  Branch (500:89): [True: 3.38k, False: 1.40k]
  ------------------
  501|  3.38k|		endswap_int_array (ppaf24->block, 8 * ppaf24->channels) ;
  502|       |
  503|       |	/* Unpack block. */
  504|  79.5k|	for (k = 0 ; k < PAF24_SAMPLES_PER_BLOCK * ppaf24->channels ; k++)
  ------------------
  |  |   45|  79.5k|#define	PAF24_SAMPLES_PER_BLOCK		10
  ------------------
  |  Branch (504:15): [True: 74.7k, False: 4.78k]
  ------------------
  505|  74.7k|	{	channel = k % ppaf24->channels ;
  506|  74.7k|		cptr = ((unsigned char *) ppaf24->block) + PAF24_BLOCK_SIZE * channel + 3 * (k / ppaf24->channels) ;
  ------------------
  |  |   46|  74.7k|#define	PAF24_BLOCK_SIZE			32
  ------------------
  507|  74.7k|		ppaf24->samples [k] = (cptr [0] << 8) | (cptr [1] << 16) | (((unsigned) cptr [2]) << 24) ;
  508|  74.7k|		} ;
  509|       |
  510|  4.78k|	return 1 ;
  511|  4.85k|} /* paf24_read_block */
paf.c:paf24_read:
  515|  47.3k|{	int	count, total = 0 ;
  516|       |
  517|  94.6k|	while (total < len)
  ------------------
  |  Branch (517:9): [True: 47.3k, False: 47.3k]
  ------------------
  518|  47.3k|	{	if (ppaf24->read_block * PAF24_SAMPLES_PER_BLOCK >= ppaf24->sample_count)
  ------------------
  |  |   45|  47.3k|#define	PAF24_SAMPLES_PER_BLOCK		10
  ------------------
  |  Branch (518:8): [True: 62, False: 47.3k]
  ------------------
  519|     62|		{	memset (&(ptr [total]), 0, (len - total) * sizeof (int)) ;
  520|     62|			return total ;
  521|  47.3k|			} ;
  522|       |
  523|  47.3k|		if (ppaf24->read_count >= PAF24_SAMPLES_PER_BLOCK)
  ------------------
  |  |   45|  47.3k|#define	PAF24_SAMPLES_PER_BLOCK		10
  ------------------
  |  Branch (523:7): [True: 4.72k, False: 42.5k]
  ------------------
  524|  4.72k|			paf24_read_block (psf, ppaf24) ;
  525|       |
  526|  47.3k|		count = (PAF24_SAMPLES_PER_BLOCK - ppaf24->read_count) * ppaf24->channels ;
  ------------------
  |  |   45|  47.3k|#define	PAF24_SAMPLES_PER_BLOCK		10
  ------------------
  527|  47.3k|		count = (len - total > count) ? count : len - total ;
  ------------------
  |  Branch (527:11): [True: 0, False: 47.3k]
  ------------------
  528|       |
  529|  47.3k|		memcpy (&(ptr [total]), &(ppaf24->samples [ppaf24->read_count * ppaf24->channels]), count * sizeof (int)) ;
  530|  47.3k|		total += count ;
  531|  47.3k|		ppaf24->read_count += count / ppaf24->channels ;
  532|  47.3k|		} ;
  533|       |
  534|  47.3k|	return total ;
  535|  47.3k|} /* paf24_read */
paf.c:paf24_read_f:
  578|  47.3k|{	BUF_UNION		ubuf ;
  579|  47.3k|	PAF24_PRIVATE 	*ppaf24 ;
  580|  47.3k|	int				*iptr ;
  581|  47.3k|	int				k, bufferlen, readcount, count ;
  582|  47.3k|	sf_count_t		total = 0 ;
  583|  47.3k|	float			normfact ;
  584|       |
  585|  47.3k|	if (psf->codec_data == NULL)
  ------------------
  |  Branch (585:6): [True: 0, False: 47.3k]
  ------------------
  586|      0|		return 0 ;
  587|  47.3k|	ppaf24 = (PAF24_PRIVATE*) psf->codec_data ;
  588|       |
  589|  47.3k|	normfact = (psf->norm_float == SF_TRUE) ? (1.0 / 0x80000000) : (1.0 / 0x100) ;
  ------------------
  |  Branch (589:13): [True: 47.3k, False: 0]
  ------------------
  590|       |
  591|  47.3k|	iptr = ubuf.ibuf ;
  592|  47.3k|	bufferlen = ARRAY_LEN (ubuf.ibuf) ;
  ------------------
  |  |   88|  47.3k|#define		ARRAY_LEN(x)	((int) (sizeof (x) / sizeof ((x) [0])))
  ------------------
  593|  94.7k|	while (len > 0)
  ------------------
  |  Branch (593:9): [True: 47.3k, False: 47.3k]
  ------------------
  594|  47.3k|	{	readcount = (len >= bufferlen) ? bufferlen : (int) len ;
  ------------------
  |  Branch (594:16): [True: 0, False: 47.3k]
  ------------------
  595|  47.3k|		count = paf24_read (psf, ppaf24, iptr, readcount) ;
  596|  98.2k|		for (k = 0 ; k < readcount ; k++)
  ------------------
  |  Branch (596:16): [True: 50.8k, False: 47.3k]
  ------------------
  597|  50.8k|			ptr [total + k] = normfact * iptr [k] ;
  598|  47.3k|		total += count ;
  599|  47.3k|		len -= readcount ;
  600|  47.3k|		} ;
  601|  47.3k|	return total ;
  602|  47.3k|} /* paf24_read_f */
paf.c:paf24_seek:
  413|     62|{	PAF24_PRIVATE	*ppaf24 ;
  414|     62|	int				newblock, newsample ;
  415|       |
  416|     62|	if (psf->codec_data == NULL)
  ------------------
  |  Branch (416:6): [True: 0, False: 62]
  ------------------
  417|      0|	{	psf->error = SFE_INTERNAL ;
  418|      0|		return PSF_SEEK_ERROR ;
  ------------------
  |  |   78|      0|#define	PSF_SEEK_ERROR			((sf_count_t) -1)
  ------------------
  419|     62|		} ;
  420|       |
  421|     62|	ppaf24 = (PAF24_PRIVATE*) psf->codec_data ;
  422|       |
  423|     62|	if (mode == SFM_READ && ppaf24->write_count > 0)
  ------------------
  |  Branch (423:6): [True: 62, False: 0]
  |  Branch (423:26): [True: 0, False: 62]
  ------------------
  424|      0|		paf24_write_block (psf, ppaf24) ;
  425|       |
  426|     62|	newblock	= offset / PAF24_SAMPLES_PER_BLOCK ;
  ------------------
  |  |   45|     62|#define	PAF24_SAMPLES_PER_BLOCK		10
  ------------------
  427|     62|	newsample	= offset % PAF24_SAMPLES_PER_BLOCK ;
  ------------------
  |  |   45|     62|#define	PAF24_SAMPLES_PER_BLOCK		10
  ------------------
  428|       |
  429|     62|	switch (mode)
  430|     62|	{	case SFM_READ :
  ------------------
  |  Branch (430:4): [True: 62, False: 0]
  ------------------
  431|     62|				if (psf->last_op == SFM_WRITE && ppaf24->write_count)
  ------------------
  |  Branch (431:9): [True: 0, False: 62]
  |  Branch (431:38): [True: 0, False: 0]
  ------------------
  432|      0|					paf24_write_block (psf, ppaf24) ;
  433|       |
  434|     62|				psf_fseek (psf, psf->dataoffset + newblock * ppaf24->blocksize, SEEK_SET) ;
  435|     62|				ppaf24->read_block = newblock ;
  436|     62|				paf24_read_block (psf, ppaf24) ;
  437|     62|				ppaf24->read_count = newsample ;
  438|     62|				break ;
  439|       |
  440|      0|		case SFM_WRITE :
  ------------------
  |  Branch (440:3): [True: 0, False: 62]
  ------------------
  441|      0|				if (offset > ppaf24->sample_count)
  ------------------
  |  Branch (441:9): [True: 0, False: 0]
  ------------------
  442|      0|				{	psf->error = SFE_BAD_SEEK ;
  443|      0|					return PSF_SEEK_ERROR ;
  ------------------
  |  |   78|      0|#define	PSF_SEEK_ERROR			((sf_count_t) -1)
  ------------------
  444|      0|					} ;
  445|       |
  446|      0|				if (psf->last_op == SFM_WRITE && ppaf24->write_count)
  ------------------
  |  Branch (446:9): [True: 0, False: 0]
  |  Branch (446:38): [True: 0, False: 0]
  ------------------
  447|      0|					paf24_write_block (psf, ppaf24) ;
  448|       |
  449|      0|				psf_fseek (psf, psf->dataoffset + newblock * ppaf24->blocksize, SEEK_SET) ;
  450|      0|				ppaf24->write_block = newblock ;
  451|      0|				paf24_read_block (psf, ppaf24) ;
  452|      0|				ppaf24->write_count = newsample ;
  453|      0|				break ;
  454|       |
  455|      0|		default :
  ------------------
  |  Branch (455:3): [True: 0, False: 62]
  ------------------
  456|      0|				psf->error = SFE_BAD_SEEK ;
  457|      0|				return PSF_SEEK_ERROR ;
  ------------------
  |  |   78|      0|#define	PSF_SEEK_ERROR			((sf_count_t) -1)
  ------------------
  458|     62|		} ;
  459|       |
  460|     62|	return newblock * PAF24_SAMPLES_PER_BLOCK + newsample ;
  ------------------
  |  |   45|     62|#define	PAF24_SAMPLES_PER_BLOCK		10
  ------------------
  461|     62|} /* paf24_seek */
paf.c:paf24_close:
  465|     71|{	PAF24_PRIVATE *ppaf24 ;
  466|       |
  467|     71|	if (psf->codec_data == NULL)
  ------------------
  |  Branch (467:6): [True: 0, False: 71]
  ------------------
  468|      0|		return 0 ;
  469|       |
  470|     71|	ppaf24 = (PAF24_PRIVATE*) psf->codec_data ;
  471|       |
  472|     71|	if (psf->file.mode == SFM_WRITE || psf->file.mode == SFM_RDWR)
  ------------------
  |  Branch (472:6): [True: 0, False: 71]
  |  Branch (472:37): [True: 0, False: 71]
  ------------------
  473|      0|	{	if (ppaf24->write_count > 0)
  ------------------
  |  Branch (473:8): [True: 0, False: 0]
  ------------------
  474|      0|			paf24_write_block (psf, ppaf24) ;
  475|      0|		} ;
  476|       |
  477|     71|	return 0 ;
  478|     71|} /* paf24_close */

pcm_init:
  131|    881|{	int chars = 0 ;
  132|       |
  133|    881|	if (psf->bytewidth == 0 || psf->sf.channels == 0)
  ------------------
  |  Branch (133:6): [True: 2, False: 879]
  |  Branch (133:29): [True: 20, False: 859]
  ------------------
  134|     22|	{	psf_log_printf (psf, "pcm_init : internal error : bytewitdh = %d, channels = %d\n", psf->bytewidth, psf->sf.channels) ;
  135|     22|		return SFE_INTERNAL ;
  136|    859|		} ;
  137|       |
  138|    859|	psf->blockwidth = (sf_count_t) psf->bytewidth * psf->sf.channels ;
  139|       |
  140|    859|	if ((SF_CODEC (psf->sf.format)) == SF_FORMAT_PCM_S8)
  ------------------
  |  |  102|    859|#define SF_CODEC(x)			((x) & SF_FORMAT_SUBMASK)
  ------------------
  |  Branch (140:6): [True: 192, False: 667]
  ------------------
  141|    192|		chars = SF_CHARS_SIGNED ;
  142|    667|	else if ((SF_CODEC (psf->sf.format)) == SF_FORMAT_PCM_U8)
  ------------------
  |  |  102|    667|#define SF_CODEC(x)			((x) & SF_FORMAT_SUBMASK)
  ------------------
  |  Branch (142:11): [True: 126, False: 541]
  ------------------
  143|    126|		chars = SF_CHARS_UNSIGNED ;
  144|       |
  145|       |#if CPU_IS_BIG_ENDIAN
  146|       |	psf->data_endswap = (psf->endian == SF_ENDIAN_BIG) ? SF_FALSE : SF_TRUE ;
  147|       |#else
  148|    859|	psf->data_endswap = (psf->endian == SF_ENDIAN_LITTLE) ? SF_FALSE : SF_TRUE ;
  ------------------
  |  Branch (148:22): [True: 389, False: 470]
  ------------------
  149|    859|#endif
  150|       |
  151|    859|	if (psf->file.mode == SFM_READ || psf->file.mode == SFM_RDWR)
  ------------------
  |  Branch (151:6): [True: 859, False: 0]
  |  Branch (151:36): [True: 0, False: 0]
  ------------------
  152|    859|	{	switch (psf->bytewidth * 0x10000 + psf->endian + chars)
  153|    859|		{	case (0x10000 + SF_ENDIAN_BIG + SF_CHARS_SIGNED) :
  ------------------
  |  Branch (153:5): [True: 175, False: 684]
  ------------------
  154|    192|			case (0x10000 + SF_ENDIAN_LITTLE + SF_CHARS_SIGNED) :
  ------------------
  |  Branch (154:4): [True: 17, False: 842]
  ------------------
  155|    192|					psf->read_short		= pcm_read_sc2s ;
  156|    192|					psf->read_int		= pcm_read_sc2i ;
  157|    192|					psf->read_float		= pcm_read_sc2f ;
  158|    192|					psf->read_double	= pcm_read_sc2d ;
  159|    192|					break ;
  160|     21|			case (0x10000 + SF_ENDIAN_BIG + SF_CHARS_UNSIGNED) :
  ------------------
  |  Branch (160:4): [True: 21, False: 838]
  ------------------
  161|    110|			case (0x10000 + SF_ENDIAN_LITTLE + SF_CHARS_UNSIGNED) :
  ------------------
  |  Branch (161:4): [True: 89, False: 770]
  ------------------
  162|    110|					psf->read_short		= pcm_read_uc2s ;
  163|    110|					psf->read_int		= pcm_read_uc2i ;
  164|    110|					psf->read_float		= pcm_read_uc2f ;
  165|    110|					psf->read_double	= pcm_read_uc2d ;
  166|    110|					break ;
  167|       |
  168|    161|			case (2 * 0x10000 + SF_ENDIAN_BIG) :
  ------------------
  |  Branch (168:4): [True: 161, False: 698]
  ------------------
  169|    161|					psf->read_short		= pcm_read_bes2s ;
  170|    161|					psf->read_int		= pcm_read_bes2i ;
  171|    161|					psf->read_float		= pcm_read_bes2f ;
  172|    161|					psf->read_double	= pcm_read_bes2d ;
  173|    161|					break ;
  174|     45|			case (3 * 0x10000 + SF_ENDIAN_BIG) :
  ------------------
  |  Branch (174:4): [True: 45, False: 814]
  ------------------
  175|     45|					psf->read_short		= pcm_read_bet2s ;
  176|     45|					psf->read_int		= pcm_read_bet2i ;
  177|     45|					psf->read_float		= pcm_read_bet2f ;
  178|     45|					psf->read_double	= pcm_read_bet2d ;
  179|     45|					break ;
  180|     42|			case (4 * 0x10000 + SF_ENDIAN_BIG) :
  ------------------
  |  Branch (180:4): [True: 42, False: 817]
  ------------------
  181|       |
  182|     42|					psf->read_short		= pcm_read_bei2s ;
  183|     42|					psf->read_int		= pcm_read_bei2i ;
  184|     42|					psf->read_float		= pcm_read_bei2f ;
  185|     42|					psf->read_double	= pcm_read_bei2d ;
  186|     42|					break ;
  187|       |
  188|    105|			case (2 * 0x10000 + SF_ENDIAN_LITTLE) :
  ------------------
  |  Branch (188:4): [True: 105, False: 754]
  ------------------
  189|    105|					psf->read_short		= pcm_read_les2s ;
  190|    105|					psf->read_int		= pcm_read_les2i ;
  191|    105|					psf->read_float		= pcm_read_les2f ;
  192|    105|					psf->read_double	= pcm_read_les2d ;
  193|    105|					break ;
  194|    103|			case (3 * 0x10000 + SF_ENDIAN_LITTLE) :
  ------------------
  |  Branch (194:4): [True: 103, False: 756]
  ------------------
  195|    103|					psf->read_short		= pcm_read_let2s ;
  196|    103|					psf->read_int		= pcm_read_let2i ;
  197|    103|					psf->read_float		= pcm_read_let2f ;
  198|    103|					psf->read_double	= pcm_read_let2d ;
  199|    103|					break ;
  200|     85|			case (4 * 0x10000 + SF_ENDIAN_LITTLE) :
  ------------------
  |  Branch (200:4): [True: 85, False: 774]
  ------------------
  201|     85|					psf->read_short		= pcm_read_lei2s ;
  202|     85|					psf->read_int		= pcm_read_lei2i ;
  203|     85|					psf->read_float		= pcm_read_lei2f ;
  204|     85|					psf->read_double	= pcm_read_lei2d ;
  205|     85|					break ;
  206|     16|			default :
  ------------------
  |  Branch (206:4): [True: 16, False: 843]
  ------------------
  207|     16|				psf_log_printf (psf, "pcm.c returning SFE_UNIMPLEMENTED\nbytewidth %d    endian %d\n", psf->bytewidth, psf->endian) ;
  208|     16|				return SFE_UNIMPLEMENTED ;
  209|    859|			} ;
  210|    843|		} ;
  211|       |
  212|    843|	if (psf->file.mode == SFM_WRITE || psf->file.mode == SFM_RDWR)
  ------------------
  |  Branch (212:6): [True: 0, False: 843]
  |  Branch (212:37): [True: 0, False: 843]
  ------------------
  213|      0|	{	switch (psf->bytewidth * 0x10000 + psf->endian + chars)
  214|      0|		{	case (0x10000 + SF_ENDIAN_BIG + SF_CHARS_SIGNED) :
  ------------------
  |  Branch (214:5): [True: 0, False: 0]
  ------------------
  215|      0|			case (0x10000 + SF_ENDIAN_LITTLE + SF_CHARS_SIGNED) :
  ------------------
  |  Branch (215:4): [True: 0, False: 0]
  ------------------
  216|      0|					psf->write_short	= pcm_write_s2sc ;
  217|      0|					psf->write_int		= pcm_write_i2sc ;
  218|      0|					psf->write_float	= pcm_write_f2sc ;
  219|      0|					psf->write_double	= pcm_write_d2sc ;
  220|      0|					break ;
  221|      0|			case (0x10000 + SF_ENDIAN_BIG + SF_CHARS_UNSIGNED) :
  ------------------
  |  Branch (221:4): [True: 0, False: 0]
  ------------------
  222|      0|			case (0x10000 + SF_ENDIAN_LITTLE + SF_CHARS_UNSIGNED) :
  ------------------
  |  Branch (222:4): [True: 0, False: 0]
  ------------------
  223|      0|					psf->write_short	= pcm_write_s2uc ;
  224|      0|					psf->write_int		= pcm_write_i2uc ;
  225|      0|					psf->write_float	= pcm_write_f2uc ;
  226|      0|					psf->write_double	= pcm_write_d2uc ;
  227|      0|					break ;
  228|       |
  229|      0|			case (2 * 0x10000 + SF_ENDIAN_BIG) :
  ------------------
  |  Branch (229:4): [True: 0, False: 0]
  ------------------
  230|      0|					psf->write_short	= pcm_write_s2bes ;
  231|      0|					psf->write_int		= pcm_write_i2bes ;
  232|      0|					psf->write_float	= pcm_write_f2bes ;
  233|      0|					psf->write_double	= pcm_write_d2bes ;
  234|      0|					break ;
  235|       |
  236|      0|			case (3 * 0x10000 + SF_ENDIAN_BIG) :
  ------------------
  |  Branch (236:4): [True: 0, False: 0]
  ------------------
  237|      0|					psf->write_short	= pcm_write_s2bet ;
  238|      0|					psf->write_int		= pcm_write_i2bet ;
  239|      0|					psf->write_float	= pcm_write_f2bet ;
  240|      0|					psf->write_double	= pcm_write_d2bet ;
  241|      0|					break ;
  242|       |
  243|      0|			case (4 * 0x10000 + SF_ENDIAN_BIG) :
  ------------------
  |  Branch (243:4): [True: 0, False: 0]
  ------------------
  244|      0|					psf->write_short	= pcm_write_s2bei ;
  245|      0|					psf->write_int		= pcm_write_i2bei ;
  246|      0|					psf->write_float	= pcm_write_f2bei ;
  247|      0|					psf->write_double	= pcm_write_d2bei ;
  248|      0|					break ;
  249|       |
  250|      0|			case (2 * 0x10000 + SF_ENDIAN_LITTLE) :
  ------------------
  |  Branch (250:4): [True: 0, False: 0]
  ------------------
  251|      0|					psf->write_short	= pcm_write_s2les ;
  252|      0|					psf->write_int		= pcm_write_i2les ;
  253|      0|					psf->write_float	= pcm_write_f2les ;
  254|      0|					psf->write_double	= pcm_write_d2les ;
  255|      0|					break ;
  256|       |
  257|      0|			case (3 * 0x10000 + SF_ENDIAN_LITTLE) :
  ------------------
  |  Branch (257:4): [True: 0, False: 0]
  ------------------
  258|      0|					psf->write_short	= pcm_write_s2let ;
  259|      0|					psf->write_int		= pcm_write_i2let ;
  260|      0|					psf->write_float	= pcm_write_f2let ;
  261|      0|					psf->write_double	= pcm_write_d2let ;
  262|      0|					break ;
  263|       |
  264|      0|			case (4 * 0x10000 + SF_ENDIAN_LITTLE) :
  ------------------
  |  Branch (264:4): [True: 0, False: 0]
  ------------------
  265|      0|					psf->write_short	= pcm_write_s2lei ;
  266|      0|					psf->write_int		= pcm_write_i2lei ;
  267|      0|					psf->write_float	= pcm_write_f2lei ;
  268|      0|					psf->write_double	= pcm_write_d2lei ;
  269|      0|					break ;
  270|       |
  271|      0|			default :
  ------------------
  |  Branch (271:4): [True: 0, False: 0]
  ------------------
  272|      0|				psf_log_printf (psf, "pcm.c returning SFE_UNIMPLEMENTED\nbytewidth %d    endian %d\n", psf->bytewidth, psf->endian) ;
  273|      0|				return SFE_UNIMPLEMENTED ;
  274|      0|			} ;
  275|       |
  276|    843|		} ;
  277|       |
  278|    843|	if (psf->filelength > psf->dataoffset)
  ------------------
  |  Branch (278:6): [True: 493, False: 350]
  ------------------
  279|    493|	{	psf->datalength = (psf->dataend > 0) ? psf->dataend - psf->dataoffset :
  ------------------
  |  Branch (279:22): [True: 37, False: 456]
  ------------------
  280|    493|							psf->filelength - psf->dataoffset ;
  281|    493|		}
  282|    350|	else
  283|    350|		psf->datalength = 0 ;
  284|       |
  285|    843|	psf->sf.frames = psf->blockwidth > 0 ? psf->datalength / psf->blockwidth : 0 ;
  ------------------
  |  Branch (285:19): [True: 747, False: 96]
  ------------------
  286|       |
  287|    843|	return 0 ;
  288|    843|} /* pcm_init */
pcm.c:pcm_read_sc2f:
  989|    318|{	BUF_UNION	ubuf ;
  990|    318|	int			bufferlen, readcount ;
  991|    318|	sf_count_t	total = 0 ;
  992|    318|	float	normfact ;
  993|       |
  994|    318|	normfact = (psf->norm_float == SF_TRUE) ? 1.0 / ((float) 0x80) : 1.0 ;
  ------------------
  |  Branch (994:13): [True: 318, False: 0]
  ------------------
  995|       |
  996|    318|	bufferlen = ARRAY_LEN (ubuf.scbuf) ;
  ------------------
  |  |   88|    318|#define		ARRAY_LEN(x)	((int) (sizeof (x) / sizeof ((x) [0])))
  ------------------
  997|       |
  998|    628|	while (len > 0)
  ------------------
  |  Branch (998:9): [True: 318, False: 310]
  ------------------
  999|    318|	{	if (len < bufferlen)
  ------------------
  |  Branch (999:8): [True: 318, False: 0]
  ------------------
 1000|    318|			bufferlen = (int) len ;
 1001|    318|		readcount = (int) psf_fread (ubuf.scbuf, sizeof (signed char), bufferlen, psf) ;
 1002|    318|		sc2f_array (ubuf.scbuf, readcount, ptr + total, normfact) ;
 1003|    318|		total += readcount ;
 1004|    318|		if (readcount < bufferlen)
  ------------------
  |  Branch (1004:7): [True: 8, False: 310]
  ------------------
 1005|      8|			break ;
 1006|    310|		len -= readcount ;
 1007|    310|		} ;
 1008|       |
 1009|    318|	return total ;
 1010|    318|} /* pcm_read_sc2f */
pcm.c:sc2f_array:
  393|    858|{	for (int i = 0 ; i < count ; i++)
  ------------------
  |  Branch (393:20): [True: 540, False: 318]
  ------------------
  394|    540|		dest [i] = ((float) src [i]) * normfact ;
  395|    318|} /* sc2f_array */
pcm.c:pcm_read_uc2f:
 1014|   587k|{	BUF_UNION	ubuf ;
 1015|   587k|	int			bufferlen, readcount ;
 1016|   587k|	sf_count_t	total = 0 ;
 1017|   587k|	float	normfact ;
 1018|       |
 1019|   587k|	normfact = (psf->norm_float == SF_TRUE) ? 1.0 / ((float) 0x80) : 1.0 ;
  ------------------
  |  Branch (1019:13): [True: 587k, False: 0]
  ------------------
 1020|       |
 1021|   587k|	bufferlen = ARRAY_LEN (ubuf.ucbuf) ;
  ------------------
  |  |   88|   587k|#define		ARRAY_LEN(x)	((int) (sizeof (x) / sizeof ((x) [0])))
  ------------------
 1022|       |
 1023|  1.17M|	while (len > 0)
  ------------------
  |  Branch (1023:9): [True: 587k, False: 587k]
  ------------------
 1024|   587k|	{	if (len < bufferlen)
  ------------------
  |  Branch (1024:8): [True: 587k, False: 0]
  ------------------
 1025|   587k|			bufferlen = (int) len ;
 1026|   587k|		readcount = (int) psf_fread (ubuf.ucbuf, sizeof (unsigned char), bufferlen, psf) ;
 1027|   587k|		uc2f_array (ubuf.ucbuf, readcount, ptr + total, normfact) ;
 1028|   587k|		total += readcount ;
 1029|   587k|		if (readcount < bufferlen)
  ------------------
  |  Branch (1029:7): [True: 0, False: 587k]
  ------------------
 1030|      0|			break ;
 1031|   587k|		len -= readcount ;
 1032|   587k|		} ;
 1033|       |
 1034|   587k|	return total ;
 1035|   587k|} /* pcm_read_uc2f */
pcm.c:uc2f_array:
  399|  1.64M|{	for (int i = 0 ; i < count ; i++)
  ------------------
  |  Branch (399:20): [True: 1.06M, False: 587k]
  ------------------
  400|  1.06M|		dest [i] = (((int) src [i]) - 128) * normfact ;
  401|   587k|} /* uc2f_array */
pcm.c:pcm_read_bes2f:
 1039|    415|{	BUF_UNION	ubuf ;
 1040|    415|	int			bufferlen, readcount ;
 1041|    415|	sf_count_t	total = 0 ;
 1042|    415|	float	normfact ;
 1043|       |
 1044|    415|	normfact = (psf->norm_float == SF_TRUE) ? 1.0 / ((float) 0x8000) : 1.0 ;
  ------------------
  |  Branch (1044:13): [True: 415, False: 0]
  ------------------
 1045|       |
 1046|    415|	bufferlen = ARRAY_LEN (ubuf.sbuf) ;
  ------------------
  |  |   88|    415|#define		ARRAY_LEN(x)	((int) (sizeof (x) / sizeof ((x) [0])))
  ------------------
 1047|       |
 1048|    824|	while (len > 0)
  ------------------
  |  Branch (1048:9): [True: 415, False: 409]
  ------------------
 1049|    415|	{	if (len < bufferlen)
  ------------------
  |  Branch (1049:8): [True: 415, False: 0]
  ------------------
 1050|    415|			bufferlen = (int) len ;
 1051|    415|		readcount = (int) psf_fread (ubuf.sbuf, sizeof (short), bufferlen, psf) ;
 1052|    415|		bes2f_array (ubuf.sbuf, readcount, ptr + total, normfact) ;
 1053|    415|		total += readcount ;
 1054|    415|		if (readcount < bufferlen)
  ------------------
  |  Branch (1054:7): [True: 6, False: 409]
  ------------------
 1055|      6|			break ;
 1056|    409|		len -= readcount ;
 1057|    409|		} ;
 1058|       |
 1059|    415|	return total ;
 1060|    415|} /* pcm_read_bes2f */
pcm.c:bes2f_array:
  416|    415|{	short			value ;
  417|       |
  418|  1.02k|	for (int i = 0 ; i < count ; i++)
  ------------------
  |  Branch (418:19): [True: 607, False: 415]
  ------------------
  419|    607|	{	value = src [i] ;
  420|       |		value = BE2H_16 (value) ;
  ------------------
  |  |  140|    607|	#define BE2H_16(x)			ENDSWAP_16 (x)
  |  |  ------------------
  |  |  |  |   34|    607|#define	ENDSWAP_16(x)		(bswap_16 (x))
  |  |  ------------------
  ------------------
  421|    607|		dest [i] = ((float) value) * normfact ;
  422|    607|		} ;
  423|    415|} /* bes2f_array */
pcm.c:pcm_read_les2f:
 1064|    371|{	BUF_UNION	ubuf ;
 1065|    371|	int			bufferlen, readcount ;
 1066|    371|	sf_count_t	total = 0 ;
 1067|    371|	float	normfact ;
 1068|       |
 1069|    371|	normfact = (psf->norm_float == SF_TRUE) ? 1.0 / ((float) 0x8000) : 1.0 ;
  ------------------
  |  Branch (1069:13): [True: 371, False: 0]
  ------------------
 1070|       |
 1071|    371|	bufferlen = ARRAY_LEN (ubuf.sbuf) ;
  ------------------
  |  |   88|    371|#define		ARRAY_LEN(x)	((int) (sizeof (x) / sizeof ((x) [0])))
  ------------------
 1072|       |
 1073|    720|	while (len > 0)
  ------------------
  |  Branch (1073:9): [True: 371, False: 349]
  ------------------
 1074|    371|	{	if (len < bufferlen)
  ------------------
  |  Branch (1074:8): [True: 371, False: 0]
  ------------------
 1075|    371|			bufferlen = (int) len ;
 1076|    371|		readcount = (int) psf_fread (ubuf.sbuf, sizeof (short), bufferlen, psf) ;
 1077|    371|		les2f_array (ubuf.sbuf, readcount, ptr + total, normfact) ;
 1078|    371|		total += readcount ;
 1079|    371|		if (readcount < bufferlen)
  ------------------
  |  Branch (1079:7): [True: 22, False: 349]
  ------------------
 1080|     22|			break ;
 1081|    349|		len -= readcount ;
 1082|    349|		} ;
 1083|       |
 1084|    371|	return total ;
 1085|    371|} /* pcm_read_les2f */
pcm.c:les2f_array:
  405|    371|{	short	value ;
  406|       |
  407|    948|	for (int i = 0 ; i < count ; i++)
  ------------------
  |  Branch (407:19): [True: 577, False: 371]
  ------------------
  408|    577|	{	value = src [i] ;
  409|    577|		value = LE2H_16 (value) ;
  ------------------
  |  |  137|    577|	#define LE2H_16(x)			(x)
  ------------------
  410|    577|		dest [i] = ((float) value) * normfact ;
  411|    577|		} ;
  412|    371|} /* les2f_array */
pcm.c:pcm_read_bet2f:
 1089|    408|{	BUF_UNION	ubuf ;
 1090|    408|	int			bufferlen, readcount ;
 1091|    408|	sf_count_t	total = 0 ;
 1092|    408|	float	normfact ;
 1093|       |
 1094|       |	/* Special normfactor because tribyte value is read into an int. */
 1095|    408|	normfact = (psf->norm_float == SF_TRUE) ? 1.0 / ((float) 0x80000000) : 1.0 / 256.0 ;
  ------------------
  |  Branch (1095:13): [True: 408, False: 0]
  ------------------
 1096|       |
 1097|    408|	bufferlen = sizeof (ubuf.ucbuf) / SIZEOF_TRIBYTE ;
  ------------------
  |  |   41|    408|#define	SIZEOF_TRIBYTE	3
  ------------------
 1098|       |
 1099|    787|	while (len > 0)
  ------------------
  |  Branch (1099:9): [True: 408, False: 379]
  ------------------
 1100|    408|	{	if (len < bufferlen)
  ------------------
  |  Branch (1100:8): [True: 408, False: 0]
  ------------------
 1101|    408|			bufferlen = (int) len ;
 1102|    408|		readcount = (int) psf_fread (ubuf.ucbuf, SIZEOF_TRIBYTE, bufferlen, psf) ;
  ------------------
  |  |   41|    408|#define	SIZEOF_TRIBYTE	3
  ------------------
 1103|    408|		bet2f_array ((tribyte*) (ubuf.ucbuf), readcount, ptr + total, normfact) ;
 1104|    408|		total += readcount ;
 1105|    408|		if (readcount < bufferlen)
  ------------------
  |  Branch (1105:7): [True: 29, False: 379]
  ------------------
 1106|     29|			break ;
 1107|    379|		len -= readcount ;
 1108|    379|		} ;
 1109|       |
 1110|    408|	return total ;
 1111|    408|} /* pcm_read_bet2f */
pcm.c:bet2f_array:
  437|    408|{	int value ;
  438|       |
  439|  1.03k|	for (int i = 0 ; i < count ; i++)
  ------------------
  |  Branch (439:19): [True: 622, False: 408]
  ------------------
  440|    622|	{	value = psf_get_be24 (src [i].bytes, 0) ;
  441|    622|		dest [i] = ((float) value) * normfact ;
  442|    622|		} ;
  443|    408|} /* bet2f_array */
pcm.c:pcm_read_let2f:
 1115|   801k|{	BUF_UNION	ubuf ;
 1116|   801k|	int			bufferlen, readcount ;
 1117|   801k|	sf_count_t	total = 0 ;
 1118|   801k|	float	normfact ;
 1119|       |
 1120|       |	/* Special normfactor because tribyte value is read into an int. */
 1121|   801k|	normfact = (psf->norm_float == SF_TRUE) ? 1.0 / ((float) 0x80000000) : 1.0 / 256.0 ;
  ------------------
  |  Branch (1121:13): [True: 801k, False: 0]
  ------------------
 1122|       |
 1123|   801k|	bufferlen = sizeof (ubuf.ucbuf) / SIZEOF_TRIBYTE ;
  ------------------
  |  |   41|   801k|#define	SIZEOF_TRIBYTE	3
  ------------------
 1124|       |
 1125|  1.60M|	while (len > 0)
  ------------------
  |  Branch (1125:9): [True: 801k, False: 801k]
  ------------------
 1126|   801k|	{	if (len < bufferlen)
  ------------------
  |  Branch (1126:8): [True: 801k, False: 0]
  ------------------
 1127|   801k|			bufferlen = (int) len ;
 1128|   801k|		readcount = (int) psf_fread (ubuf.ucbuf, SIZEOF_TRIBYTE, bufferlen, psf) ;
  ------------------
  |  |   41|   801k|#define	SIZEOF_TRIBYTE	3
  ------------------
 1129|   801k|		let2f_array ((tribyte*) (ubuf.ucbuf), readcount, ptr + total, normfact) ;
 1130|   801k|		total += readcount ;
 1131|   801k|		if (readcount < bufferlen)
  ------------------
  |  Branch (1131:7): [True: 32, False: 801k]
  ------------------
 1132|     32|			break ;
 1133|   801k|		len -= readcount ;
 1134|   801k|		} ;
 1135|       |
 1136|   801k|	return total ;
 1137|   801k|} /* pcm_read_let2f */
pcm.c:let2f_array:
  427|   801k|{	int value ;
  428|       |
  429|  4.06M|	for (int i = 0 ; i < count ; i++)
  ------------------
  |  Branch (429:19): [True: 3.25M, False: 801k]
  ------------------
  430|  3.25M|	{	value = psf_get_le24 (src [i].bytes, 0) ;
  431|  3.25M|		dest [i] = ((float) value) * normfact ;
  432|  3.25M|		} ;
  433|   801k|} /* let2f_array */
pcm.c:pcm_read_bei2f:
 1141|    347|{	BUF_UNION	ubuf ;
 1142|    347|	int			bufferlen, readcount ;
 1143|    347|	sf_count_t	total = 0 ;
 1144|    347|	float	normfact ;
 1145|       |
 1146|    347|	normfact = (psf->norm_float == SF_TRUE) ? 1.0 / ((float) 0x80000000) : 1.0 ;
  ------------------
  |  Branch (1146:13): [True: 347, False: 0]
  ------------------
 1147|       |
 1148|    347|	bufferlen = ARRAY_LEN (ubuf.ibuf) ;
  ------------------
  |  |   88|    347|#define		ARRAY_LEN(x)	((int) (sizeof (x) / sizeof ((x) [0])))
  ------------------
 1149|       |
 1150|    682|	while (len > 0)
  ------------------
  |  Branch (1150:9): [True: 347, False: 335]
  ------------------
 1151|    347|	{	if (len < bufferlen)
  ------------------
  |  Branch (1151:8): [True: 347, False: 0]
  ------------------
 1152|    347|			bufferlen = (int) len ;
 1153|    347|		readcount = (int) psf_fread (ubuf.ibuf, sizeof (int), bufferlen, psf) ;
 1154|    347|		bei2f_array (ubuf.ibuf, readcount, ptr + total, normfact) ;
 1155|    347|		total += readcount ;
 1156|    347|		if (readcount < bufferlen)
  ------------------
  |  Branch (1156:7): [True: 12, False: 335]
  ------------------
 1157|     12|			break ;
 1158|    335|		len -= readcount ;
 1159|    335|		} ;
 1160|       |
 1161|    347|	return total ;
 1162|    347|} /* pcm_read_bei2f */
pcm.c:bei2f_array:
  458|    347|{	int 			value ;
  459|       |
  460|    971|	for (int i = 0 ; i < count ; i++)
  ------------------
  |  Branch (460:19): [True: 624, False: 347]
  ------------------
  461|    624|	{	value = src [i] ;
  462|       |		value = BE2H_32 (value) ;
  ------------------
  |  |  141|    624|	#define BE2H_32(x)			ENDSWAP_32 (x)
  |  |  ------------------
  |  |  |  |   35|    624|#define	ENDSWAP_32(x)		(bswap_32 (x))
  |  |  ------------------
  ------------------
  463|    624|		dest [i] = ((float) value) * normfact ;
  464|    624|		} ;
  465|    347|} /* bei2f_array */
pcm.c:pcm_read_lei2f:
 1166|  29.0k|{	BUF_UNION	ubuf ;
 1167|  29.0k|	int			bufferlen, readcount ;
 1168|  29.0k|	sf_count_t	total = 0 ;
 1169|  29.0k|	float	normfact ;
 1170|       |
 1171|  29.0k|	normfact = (psf->norm_float == SF_TRUE) ? 1.0 / ((float) 0x80000000) : 1.0 ;
  ------------------
  |  Branch (1171:13): [True: 29.0k, False: 0]
  ------------------
 1172|       |
 1173|  29.0k|	bufferlen = ARRAY_LEN (ubuf.ibuf) ;
  ------------------
  |  |   88|  29.0k|#define		ARRAY_LEN(x)	((int) (sizeof (x) / sizeof ((x) [0])))
  ------------------
 1174|       |
 1175|  58.0k|	while (len > 0)
  ------------------
  |  Branch (1175:9): [True: 29.0k, False: 29.0k]
  ------------------
 1176|  29.0k|	{	if (len < bufferlen)
  ------------------
  |  Branch (1176:8): [True: 29.0k, False: 0]
  ------------------
 1177|  29.0k|			bufferlen = (int) len ;
 1178|  29.0k|		readcount = (int) psf_fread (ubuf.ibuf, sizeof (int), bufferlen, psf) ;
 1179|  29.0k|		lei2f_array (ubuf.ibuf, readcount, ptr + total, normfact) ;
 1180|  29.0k|		total += readcount ;
 1181|  29.0k|		if (readcount < bufferlen)
  ------------------
  |  Branch (1181:7): [True: 19, False: 29.0k]
  ------------------
 1182|     19|			break ;
 1183|  29.0k|		len -= readcount ;
 1184|  29.0k|		} ;
 1185|       |
 1186|  29.0k|	return total ;
 1187|  29.0k|} /* pcm_read_lei2f */
pcm.c:lei2f_array:
  447|  29.0k|{	int 			value ;
  448|       |
  449|   148k|	for (int i = 0 ; i < count ; i++)
  ------------------
  |  Branch (449:19): [True: 119k, False: 29.0k]
  ------------------
  450|   119k|	{	value = src [i] ;
  451|   119k|		value = LE2H_32 (value) ;
  ------------------
  |  |  138|   119k|	#define LE2H_32(x)			(x)
  ------------------
  452|   119k|		dest [i] = ((float) value) * normfact ;
  453|   119k|		} ;
  454|  29.0k|} /* lei2f_array */

pvf_open:
   51|    134|{	int		subformat ;
   52|    134|	int		error = 0 ;
   53|       |
   54|    134|	if (psf->file.mode == SFM_READ || (psf->file.mode == SFM_RDWR && psf->filelength > 0))
  ------------------
  |  Branch (54:6): [True: 134, False: 0]
  |  Branch (54:37): [True: 0, False: 0]
  |  Branch (54:67): [True: 0, False: 0]
  ------------------
   55|    134|	{	if ((error = pvf_read_header (psf)))
  ------------------
  |  Branch (55:8): [True: 15, False: 119]
  ------------------
   56|     15|			return error ;
   57|    134|		} ;
   58|       |
   59|    119|	subformat = SF_CODEC (psf->sf.format) ;
  ------------------
  |  |  102|    119|#define SF_CODEC(x)			((x) & SF_FORMAT_SUBMASK)
  ------------------
   60|       |
   61|    119|	if (psf->file.mode == SFM_WRITE || psf->file.mode == SFM_RDWR)
  ------------------
  |  Branch (61:6): [True: 0, False: 119]
  |  Branch (61:37): [True: 0, False: 119]
  ------------------
   62|      0|	{	if ((SF_CONTAINER (psf->sf.format)) != SF_FORMAT_PVF)
  ------------------
  |  |  101|      0|#define SF_CONTAINER(x)		((x) & SF_FORMAT_TYPEMASK)
  ------------------
  |  Branch (62:8): [True: 0, False: 0]
  ------------------
   63|      0|			return	SFE_BAD_OPEN_FORMAT ;
   64|       |
   65|      0|		psf->endian = SF_ENDIAN_BIG ;
   66|       |
   67|      0|		if (pvf_write_header (psf, SF_FALSE))
  ------------------
  |  Branch (67:7): [True: 0, False: 0]
  ------------------
   68|      0|			return psf->error ;
   69|       |
   70|      0|		psf->write_header = pvf_write_header ;
   71|    119|		} ;
   72|       |
   73|    119|	psf->container_close = pvf_close ;
   74|       |
   75|    119|	psf->blockwidth = (sf_count_t) psf->bytewidth * psf->sf.channels ;
   76|       |
   77|    119|	switch (subformat)
   78|    119|	{	case SF_FORMAT_PCM_S8 :	/* 8-bit linear PCM. */
  ------------------
  |  Branch (78:4): [True: 93, False: 26]
  ------------------
   79|    103|		case SF_FORMAT_PCM_16 :	/* 16-bit linear PCM. */
  ------------------
  |  Branch (79:3): [True: 10, False: 109]
  ------------------
   80|    119|		case SF_FORMAT_PCM_32 :	/* 32-bit linear PCM. */
  ------------------
  |  Branch (80:3): [True: 16, False: 103]
  ------------------
   81|    119|				error = pcm_init (psf) ;
   82|    119|				break ;
   83|       |
   84|      0|		default :	break ;
  ------------------
  |  Branch (84:3): [True: 0, False: 119]
  ------------------
   85|    119|		} ;
   86|       |
   87|    119|	return error ;
   88|    119|} /* pvf_open */
pvf.c:pvf_close:
   95|    119|{
   96|    119|	return 0 ;
   97|    119|} /* pvf_close */
pvf.c:pvf_read_header:
  136|    134|{	char	buffer [32] ;
  137|    134|	int		marker, channels, samplerate, bitwidth ;
  138|       |
  139|    134|	psf_binheader_readf (psf, "pmj", 0, &marker, 1) ;
  140|    134|	psf_log_printf (psf, "%M\n", marker) ;
  141|       |
  142|    134|	if (marker != PVF1_MARKER)
  ------------------
  |  |   34|    134|#define PVF1_MARKER		(MAKE_MARKER ('P', 'V', 'F', '1'))
  |  |  ------------------
  |  |  |  |  122|    134|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (142:6): [True: 0, False: 134]
  ------------------
  143|      0|		return SFE_PVF_NO_PVF1 ;
  144|       |
  145|       |	/* Grab characters up until a newline which is replaced by an EOS. */
  146|    134|	psf_binheader_readf (psf, "G", buffer, sizeof (buffer)) ;
  147|       |
  148|    134|	if (sscanf (buffer, "%d %d %d", &channels, &samplerate, &bitwidth) != 3)
  ------------------
  |  Branch (148:6): [True: 13, False: 121]
  ------------------
  149|     13|		return SFE_PVF_BAD_HEADER ;
  150|       |
  151|    121|	psf_log_printf (psf, " Channels    : %d\n Sample rate : %d\n Bit width   : %d\n",
  152|    121|				channels, samplerate, bitwidth) ;
  153|       |
  154|    121|	psf->sf.channels = channels ;
  155|    121|	psf->sf.samplerate = samplerate ;
  156|       |
  157|    121|	switch (bitwidth)
  158|    121|	{	case 8 :
  ------------------
  |  Branch (158:4): [True: 93, False: 28]
  ------------------
  159|     93|				psf->sf.format = SF_FORMAT_PVF | SF_FORMAT_PCM_S8 ;
  160|     93|				psf->bytewidth = 1 ;
  161|     93|				break ;
  162|       |
  163|     10|		case 16 :
  ------------------
  |  Branch (163:3): [True: 10, False: 111]
  ------------------
  164|     10|				psf->sf.format = SF_FORMAT_PVF | SF_FORMAT_PCM_16 ;
  165|     10|				psf->bytewidth = 2 ;
  166|     10|				break ;
  167|     16|		case 32 :
  ------------------
  |  Branch (167:3): [True: 16, False: 105]
  ------------------
  168|     16|				psf->sf.format = SF_FORMAT_PVF | SF_FORMAT_PCM_32 ;
  169|     16|				psf->bytewidth = 4 ;
  170|     16|				break ;
  171|       |
  172|      2|		default :
  ------------------
  |  Branch (172:3): [True: 2, False: 119]
  ------------------
  173|      2|				return SFE_PVF_BAD_BITWIDTH ;
  174|    121|		} ;
  175|       |
  176|    119|	psf->dataoffset = psf_ftell (psf) ;
  177|    119|	psf_log_printf (psf, " Data Offset : %D\n", psf->dataoffset) ;
  178|       |
  179|    119|	psf->endian = SF_ENDIAN_BIG ;
  180|       |
  181|    119|	psf->datalength = psf->filelength - psf->dataoffset ;
  182|    119|	psf->blockwidth = (sf_count_t) psf->sf.channels * psf->bytewidth ;
  183|       |
  184|    119|	if (! psf->sf.frames && psf->blockwidth)
  ------------------
  |  Branch (184:6): [True: 119, False: 0]
  |  Branch (184:26): [True: 116, False: 3]
  ------------------
  185|    116|		psf->sf.frames = (psf->filelength - psf->dataoffset) / psf->blockwidth ;
  186|       |
  187|    119|	return 0 ;
  188|    121|} /* pvf_read_header */

rf64_open:
   88|  2.03k|{	WAVLIKE_PRIVATE *wpriv ;
   89|  2.03k|	int	subformat, error = 0 ;
   90|  2.03k|	int blockalign, framesperblock ;
   91|       |
   92|  2.03k|	if ((wpriv = calloc (1, sizeof (WAVLIKE_PRIVATE))) == NULL)
  ------------------
  |  Branch (92:6): [True: 0, False: 2.03k]
  ------------------
   93|      0|		return SFE_MALLOC_FAILED ;
   94|  2.03k|	psf->container_data = wpriv ;
   95|  2.03k|	wpriv->wavex_ambisonic = SF_AMBISONIC_NONE ;
   96|       |
   97|       |	/* All RF64 files are little endian. */
   98|  2.03k|	psf->endian = SF_ENDIAN_LITTLE ;
   99|       |
  100|  2.03k|	psf->strings.flags = SF_STR_ALLOW_START | SF_STR_ALLOW_END ;
  101|       |
  102|  2.03k|	if (psf->file.mode == SFM_READ || (psf->file.mode == SFM_RDWR && psf->filelength > 0))
  ------------------
  |  Branch (102:6): [True: 2.03k, False: 0]
  |  Branch (102:37): [True: 0, False: 0]
  |  Branch (102:67): [True: 0, False: 0]
  ------------------
  103|  2.03k|	{	if ((error = rf64_read_header (psf, &blockalign, &framesperblock)) != 0)
  ------------------
  |  Branch (103:8): [True: 1.63k, False: 404]
  ------------------
  104|  1.63k|			return error ;
  105|       |
  106|    404|		psf->next_chunk_iterator = rf64_next_chunk_iterator ;
  107|    404|		psf->get_chunk_size = rf64_get_chunk_size ;
  108|    404|		psf->get_chunk_data = rf64_get_chunk_data ;
  109|    404|		} ;
  110|       |
  111|    404|	if ((psf->sf.format & SF_FORMAT_TYPEMASK) != SF_FORMAT_RF64)
  ------------------
  |  Branch (111:6): [True: 0, False: 404]
  ------------------
  112|      0|		return	SFE_BAD_OPEN_FORMAT ;
  113|       |
  114|    404|	subformat = psf->sf.format & SF_FORMAT_SUBMASK ;
  115|       |
  116|    404|	if (psf->file.mode == SFM_WRITE || psf->file.mode == SFM_RDWR)
  ------------------
  |  Branch (116:6): [True: 0, False: 404]
  |  Branch (116:37): [True: 0, False: 404]
  ------------------
  117|      0|	{	if (psf->is_pipe)
  ------------------
  |  Branch (117:8): [True: 0, False: 0]
  ------------------
  118|      0|			return SFE_NO_PIPE_WRITE ;
  119|       |
  120|      0|		psf->blockwidth = (sf_count_t) psf->bytewidth * psf->sf.channels ;
  121|       |
  122|      0|		if ((error = rf64_write_header (psf, SF_FALSE)))
  ------------------
  |  Branch (122:7): [True: 0, False: 0]
  ------------------
  123|      0|			return error ;
  124|       |
  125|      0|		psf->write_header = rf64_write_header ;
  126|      0|		psf->set_chunk = rf64_set_chunk ;
  127|    404|		} ;
  128|       |
  129|    404|	psf->container_close = rf64_close ;
  130|    404|	psf->command = rf64_command ;
  131|       |
  132|    404|	switch (subformat)
  133|    404|	{	case SF_FORMAT_PCM_U8 :
  ------------------
  |  Branch (133:4): [True: 16, False: 388]
  ------------------
  134|     17|		case SF_FORMAT_PCM_16 :
  ------------------
  |  Branch (134:3): [True: 1, False: 403]
  ------------------
  135|     52|		case SF_FORMAT_PCM_24 :
  ------------------
  |  Branch (135:3): [True: 35, False: 369]
  ------------------
  136|     60|		case SF_FORMAT_PCM_32 :
  ------------------
  |  Branch (136:3): [True: 8, False: 396]
  ------------------
  137|     60|					error = pcm_init (psf) ;
  138|     60|					break ;
  139|       |
  140|    126|		case SF_FORMAT_ULAW :
  ------------------
  |  Branch (140:3): [True: 126, False: 278]
  ------------------
  141|    126|					error = ulaw_init (psf) ;
  142|    126|					break ;
  143|       |
  144|    104|		case SF_FORMAT_ALAW :
  ------------------
  |  Branch (144:3): [True: 104, False: 300]
  ------------------
  145|    104|					error = alaw_init (psf) ;
  146|    104|					break ;
  147|       |
  148|       |		/* Lite remove start */
  149|     55|		case SF_FORMAT_FLOAT :
  ------------------
  |  Branch (149:3): [True: 55, False: 349]
  ------------------
  150|     55|					error = float32_init (psf) ;
  151|     55|					break ;
  152|       |
  153|     21|		case SF_FORMAT_DOUBLE :
  ------------------
  |  Branch (153:3): [True: 21, False: 383]
  ------------------
  154|     21|					error = double64_init (psf) ;
  155|     21|					break ;
  156|       |
  157|       |		/* Lite remove end */
  158|       |
  159|     38|		default : 	return SFE_UNIMPLEMENTED ;
  ------------------
  |  Branch (159:3): [True: 38, False: 366]
  ------------------
  160|    404|		} ;
  161|       |
  162|    366|	return error ;
  163|    404|} /* rf64_open */
rf64.c:rf64_read_header:
  181|  2.03k|{	WAVLIKE_PRIVATE	*wpriv ;
  182|  2.03k|	WAV_FMT		*wav_fmt ;
  183|  2.03k|	sf_count_t riff_size = 0, frame_count = 0, ds64_datalength = 0 ;
  184|  2.03k|	uint32_t marks [2], marker, chunk_size, parsestage = 0 ;
  185|  2.03k|	int error, done = 0, format = 0 ;
  186|       |
  187|  2.03k|	if ((wpriv = psf->container_data) == NULL)
  ------------------
  |  Branch (187:6): [True: 0, False: 2.03k]
  ------------------
  188|      0|		return SFE_INTERNAL ;
  189|  2.03k|	wav_fmt = &wpriv->wav_fmt ;
  190|       |
  191|       |	/* Set position to start of file to begin reading header. */
  192|  2.03k|	psf_binheader_readf (psf, "pmmm", 0, &marker, marks, marks + 1) ;
  193|  2.03k|	if (marker != RF64_MARKER || marks [1] != WAVE_MARKER)
  ------------------
  |  |   43|  2.03k|#define	RF64_MARKER		MAKE_MARKER ('R', 'F', '6', '4')
  |  |  ------------------
  |  |  |  |  122|  4.07k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
              	if (marker != RF64_MARKER || marks [1] != WAVE_MARKER)
  ------------------
  |  |   47|  2.03k|#define	WAVE_MARKER		MAKE_MARKER ('W', 'A', 'V', 'E')
  |  |  ------------------
  |  |  |  |  122|  2.03k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (193:6): [True: 0, False: 2.03k]
  |  Branch (193:31): [True: 0, False: 2.03k]
  ------------------
  194|      0|		return SFE_RF64_NOT_RF64 ;
  195|       |
  196|  2.03k|	if (marks [0] == FFFF_MARKER)
  ------------------
  |  |   46|  2.03k|#define	FFFF_MARKER		MAKE_MARKER (0xff, 0xff, 0xff, 0xff)
  |  |  ------------------
  |  |  |  |  122|  2.03k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (196:6): [True: 4, False: 2.03k]
  ------------------
  197|      4|		psf_log_printf (psf, "%M\n  %M\n", RF64_MARKER, WAVE_MARKER) ;
  ------------------
  |  |   43|      4|#define	RF64_MARKER		MAKE_MARKER ('R', 'F', '6', '4')
  |  |  ------------------
  |  |  |  |  122|      4|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
              		psf_log_printf (psf, "%M\n  %M\n", RF64_MARKER, WAVE_MARKER) ;
  ------------------
  |  |   47|      4|#define	WAVE_MARKER		MAKE_MARKER ('W', 'A', 'V', 'E')
  |  |  ------------------
  |  |  |  |  122|      4|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  198|  2.03k|	else
  199|  2.03k|		psf_log_printf (psf, "%M : 0x%x (should be 0xFFFFFFFF)\n  %M\n", RF64_MARKER, WAVE_MARKER) ;
  ------------------
  |  |   43|  2.03k|#define	RF64_MARKER		MAKE_MARKER ('R', 'F', '6', '4')
  |  |  ------------------
  |  |  |  |  122|  2.03k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
              		psf_log_printf (psf, "%M : 0x%x (should be 0xFFFFFFFF)\n  %M\n", RF64_MARKER, WAVE_MARKER) ;
  ------------------
  |  |   47|  2.03k|#define	WAVE_MARKER		MAKE_MARKER ('W', 'A', 'V', 'E')
  |  |  ------------------
  |  |  |  |  122|  2.03k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  200|       |
  201|   578k|	while (!done)
  ------------------
  |  Branch (201:9): [True: 578k, False: 18]
  ------------------
  202|   578k|	{
  203|   578k|		marker = chunk_size = 0 ;
  204|   578k|		psf_binheader_readf (psf, "em4", &marker, &chunk_size) ;
  205|       |
  206|   578k|		if (marker == 0)
  ------------------
  |  Branch (206:7): [True: 357, False: 578k]
  ------------------
  207|    357|		{	sf_count_t pos = psf_ftell (psf) ;
  208|    357|			psf_log_printf (psf, "Have 0 marker at position %D (0x%x).\n", pos, pos) ;
  209|    357|			break ;
  210|   578k|			} ;
  211|       |
  212|   578k|		psf_store_read_chunk_u32 (&psf->rchunks, marker, psf_ftell (psf), chunk_size) ;
  213|       |
  214|   578k|		switch (marker)
  215|   578k|		{	case ds64_MARKER :
  ------------------
  |  |   48|  7.89k|#define	ds64_MARKER		MAKE_MARKER ('d', 's', '6', '4')
  |  |  ------------------
  |  |  |  |  122|  7.89k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (215:5): [True: 7.89k, False: 570k]
  ------------------
  216|  7.89k|				if (parsestage & HAVE_ds64)
  ------------------
  |  Branch (216:9): [True: 6.91k, False: 975]
  ------------------
  217|  6.91k|				{	psf_log_printf (psf, "*** Second 'ds64' chunk?\n") ;
  218|  6.91k|					break ;
  219|  6.91k|					} ;
  220|       |
  221|    975|				{	unsigned int table_len, bytesread ;
  222|       |
  223|       |					/* Read ds64 sizes (3 8-byte words). */
  224|    975|					bytesread = psf_binheader_readf (psf, "888", &riff_size, &ds64_datalength, &frame_count) ;
  225|       |
  226|       |					/* Read table length. */
  227|    975|					bytesread += psf_binheader_readf (psf, "4", &table_len) ;
  228|       |					/* Skip table for now. (this was "table_len + 4", why?) */
  229|    975|					bytesread += psf_binheader_readf (psf, "j", table_len) ;
  230|       |
  231|    975|					if (chunk_size == bytesread)
  ------------------
  |  Branch (231:10): [True: 1, False: 974]
  ------------------
  232|      1|						psf_log_printf (psf, "%M : %u\n", marker, chunk_size) ;
  233|    974|					else if (chunk_size >= bytesread + 4)
  ------------------
  |  Branch (233:15): [True: 147, False: 827]
  ------------------
  234|    147|					{	unsigned int next ;
  235|    147|						psf_binheader_readf (psf, "m", &next) ;
  236|    147|						if (next == fmt_MARKER)
  ------------------
  |  |   49|    147|#define	fmt_MARKER		MAKE_MARKER ('f', 'm', 't', ' ')
  |  |  ------------------
  |  |  |  |  122|    147|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (236:11): [True: 1, False: 146]
  ------------------
  237|      1|						{	psf_log_printf (psf, "%M : %u (should be %u)\n", marker, chunk_size, bytesread) ;
  238|      1|							psf_binheader_readf (psf, "j", -4) ;
  239|      1|							}
  240|    146|						else
  241|    146|						{	psf_log_printf (psf, "%M : %u\n", marker, chunk_size) ;
  242|    146|							psf_binheader_readf (psf, "j", chunk_size - bytesread - 4) ;
  243|    146|							} ;
  244|    147|						} ;
  245|       |
  246|    975|					if (psf->filelength - 8 != riff_size)
  ------------------
  |  Branch (246:10): [True: 974, False: 1]
  ------------------
  247|    974|						psf_log_printf (psf, "  Riff size : %D (should be %D)\n", riff_size, psf->filelength - 8) ;
  248|      1|					else
  249|      1|						psf_log_printf (psf, "  Riff size : %D\n", riff_size) ;
  250|       |
  251|    975|					psf_log_printf (psf, "  Data size : %D\n", ds64_datalength) ;
  252|       |
  253|    975|					psf_log_printf (psf, "  Frames    : %D\n", frame_count) ;
  254|    975|					psf_log_printf (psf, "  Table length : %u\n", table_len) ;
  255|       |
  256|    975|					} ;
  257|    975|				parsestage |= HAVE_ds64 ;
  258|    975|				break ;
  259|       |
  260|  20.4k|			case fmt_MARKER:
  ------------------
  |  |   49|  20.4k|#define	fmt_MARKER		MAKE_MARKER ('f', 'm', 't', ' ')
  |  |  ------------------
  |  |  |  |  122|  20.4k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (260:4): [True: 20.4k, False: 557k]
  ------------------
  261|  20.4k|					if (parsestage & HAVE_fmt)
  ------------------
  |  Branch (261:10): [True: 19.9k, False: 502]
  ------------------
  262|  19.9k|					{	psf_log_printf (psf, "*** Second 'fmt ' chunk?\n") ;
  263|  19.9k|						psf_binheader_readf (psf, "j", chunk_size) ;
  264|  19.9k|						break ;
  265|  19.9k|						} ;
  266|       |
  267|    502|					psf_log_printf (psf, "%M : %u\n", marker, chunk_size) ;
  268|    502|					if ((error = wavlike_read_fmt_chunk (psf, chunk_size)) != 0)
  ------------------
  |  Branch (268:10): [True: 29, False: 473]
  ------------------
  269|     29|						return error ;
  270|    473|					format = wav_fmt->format ;
  271|    473|					parsestage |= HAVE_fmt ;
  272|    473|					break ;
  273|       |
  274|  9.50k|			case bext_MARKER :
  ------------------
  |  |   53|  9.50k|#define bext_MARKER		MAKE_MARKER ('b', 'e', 'x', 't')
  |  |  ------------------
  |  |  |  |  122|  9.50k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (274:4): [True: 9.50k, False: 568k]
  ------------------
  275|  9.50k|					if ((error = wavlike_read_bext_chunk (psf, chunk_size)) != 0)
  ------------------
  |  Branch (275:10): [True: 0, False: 9.50k]
  ------------------
  276|      0|						return error ;
  277|  9.50k|					parsestage |= HAVE_bext ;
  278|  9.50k|					break ;
  279|       |
  280|  1.37k|			case cart_MARKER :
  ------------------
  |  |   54|  1.37k|#define cart_MARKER		MAKE_MARKER ('c', 'a', 'r', 't')
  |  |  ------------------
  |  |  |  |  122|  1.37k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (280:4): [True: 1.37k, False: 577k]
  ------------------
  281|  1.37k|					if ((error = wavlike_read_cart_chunk (psf, chunk_size)) != 0)
  ------------------
  |  Branch (281:10): [True: 0, False: 1.37k]
  ------------------
  282|      0|						return error ;
  283|  1.37k|					parsestage |= HAVE_cart ;
  284|  1.37k|					break ;
  285|       |
  286|  91.5k|			case INFO_MARKER :
  ------------------
  |  |   37|  91.5k|#define INFO_MARKER		MAKE_MARKER ('I', 'N', 'F', 'O')
  |  |  ------------------
  |  |  |  |  122|  91.5k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (286:4): [True: 91.5k, False: 486k]
  ------------------
  287|  95.1k|			case LIST_MARKER :
  ------------------
  |  |   57|  95.1k|#define LIST_MARKER		MAKE_MARKER ('L', 'I', 'S', 'T')
  |  |  ------------------
  |  |  |  |  122|  95.1k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (287:4): [True: 3.57k, False: 574k]
  ------------------
  288|  95.1k|					if ((error = wavlike_subchunk_parse (psf, marker, chunk_size)) != 0)
  ------------------
  |  Branch (288:10): [True: 0, False: 95.1k]
  ------------------
  289|      0|						return error ;
  290|  95.1k|					parsestage |= HAVE_other ;
  291|  95.1k|					break ;
  292|       |
  293|  13.2k|			case PEAK_MARKER :
  ------------------
  |  |   40|  13.2k|#define PEAK_MARKER		MAKE_MARKER ('P', 'E', 'A', 'K')
  |  |  ------------------
  |  |  |  |  122|  13.2k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (293:4): [True: 13.2k, False: 565k]
  ------------------
  294|  13.2k|					if ((parsestage & (HAVE_ds64 | HAVE_fmt)) != (HAVE_ds64 | HAVE_fmt))
  ------------------
  |  Branch (294:10): [True: 1, False: 13.2k]
  ------------------
  295|      1|						return SFE_RF64_PEAK_B4_FMT ;
  296|       |
  297|  13.2k|					parsestage |= HAVE_PEAK ;
  298|       |
  299|  13.2k|					psf_log_printf (psf, "%M : %u\n", marker, chunk_size) ;
  300|  13.2k|					if ((error = wavlike_read_peak_chunk (psf, chunk_size)) != 0)
  ------------------
  |  Branch (300:10): [True: 0, False: 13.2k]
  ------------------
  301|      0|						return error ;
  302|  13.2k|					if (psf->peak_info != NULL)
  ------------------
  |  Branch (302:10): [True: 11.2k, False: 2.04k]
  ------------------
  303|  11.2k|						psf->peak_info->peak_loc = ((parsestage & HAVE_data) == 0) ? SF_PEAK_START : SF_PEAK_END ;
  ------------------
  |  Branch (303:34): [True: 11.2k, False: 0]
  ------------------
  304|  13.2k|					break ;
  305|       |
  306|   212k|			case data_MARKER :
  ------------------
  |  |   51|   212k|#define	data_MARKER		MAKE_MARKER ('d', 'a', 't', 'a')
  |  |  ------------------
  |  |  |  |  122|   212k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (306:4): [True: 212k, False: 365k]
  ------------------
  307|       |				/* see wav for more sophisticated parsing -> implement state machine with parsestage */
  308|       |
  309|   212k|				if (HAVE_CHUNK (HAVE_ds64))
  ------------------
  |  |  177|   212k|#define HAVE_CHUNK(CHUNK)	((parsestage & CHUNK) != 0)
  |  |  ------------------
  |  |  |  Branch (177:27): [True: 212k, False: 577]
  |  |  ------------------
  ------------------
  310|   212k|				{	if (chunk_size == 0xffffffff)
  ------------------
  |  Branch (310:11): [True: 8.78k, False: 203k]
  ------------------
  311|  8.78k|						psf_log_printf (psf, "%M : 0x%x\n", marker, chunk_size) ;
  312|   203k|					else
  313|   203k|						psf_log_printf (psf, "%M : 0x%x (should be 0xffffffff\n", marker, chunk_size) ;
  314|   212k|					psf->datalength = ds64_datalength ;
  315|   212k|					}
  316|    577|				else
  317|    577|				{	if (chunk_size == 0xffffffff)
  ------------------
  |  Branch (317:11): [True: 103, False: 474]
  ------------------
  318|    103|					{	psf_log_printf (psf, "%M : 0x%x\n", marker, chunk_size) ;
  319|    103|						psf_log_printf (psf, "  *** Data length not specified no 'ds64' chunk.\n") ;
  320|    103|						}
  321|    474|					else
  322|    474|					{	psf_log_printf (psf, "%M : 0x%x\n**** Weird, RF64 file without a 'ds64' chunk and no valid 'data' size.\n", marker, chunk_size) ;
  323|    474|						psf->datalength = chunk_size ;
  324|    474|						} ;
  325|    577|					} ;
  326|       |
  327|   212k|				psf->dataoffset = psf_ftell (psf) ;
  328|       |
  329|   212k|				if (psf->dataoffset > 0)
  ------------------
  |  Branch (329:9): [True: 211k, False: 1.09k]
  ------------------
  330|   211k|				{	if (chunk_size == 0 && riff_size == 8 && psf->filelength > 44)
  ------------------
  |  Branch (330:11): [True: 8.11k, False: 203k]
  |  Branch (330:30): [True: 1, False: 8.11k]
  |  Branch (330:48): [True: 1, False: 0]
  ------------------
  331|      1|					{	psf_log_printf (psf, "  *** Looks like a WAV file which wasn't closed properly. Fixing it.\n") ;
  332|      1|						psf->datalength = psf->filelength - psf->dataoffset ;
  333|      1|						} ;
  334|       |
  335|       |					/* Only set dataend if there really is data at the end. */
  336|   211k|					if (psf->datalength + psf->dataoffset < psf->filelength)
  ------------------
  |  Branch (336:10): [True: 211k, False: 216]
  ------------------
  337|   211k|						psf->dataend = psf->datalength + psf->dataoffset ;
  338|       |
  339|   211k|					if (!psf->sf.seekable || psf->dataoffset < 0)
  ------------------
  |  Branch (339:10): [True: 0, False: 211k]
  |  Branch (339:31): [True: 0, False: 211k]
  ------------------
  340|      0|						break ;
  341|       |
  342|       |					/* Seek past data and continue reading header. */
  343|   211k|					psf_fseek (psf, psf->datalength, SEEK_CUR) ;
  344|       |
  345|   211k|					if (psf_ftell (psf) != psf->datalength + psf->dataoffset)
  ------------------
  |  Branch (345:10): [True: 194k, False: 17.4k]
  ------------------
  346|   194k|						psf_log_printf (psf, "  *** psf_fseek past end error ***\n") ;
  347|   212k|					} ;
  348|   212k|				break ;
  349|       |
  350|    293|			case iXML_MARKER :
  ------------------
  |  |   58|    293|#define iXML_MARKER		MAKE_MARKER ('i', 'X', 'M', 'L')
  |  |  ------------------
  |  |  |  |  122|    293|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (350:4): [True: 293, False: 578k]
  ------------------
  351|    604|			case JUNK_MARKER :
  ------------------
  |  |   45|    604|#define	JUNK_MARKER		MAKE_MARKER ('J', 'U', 'N', 'K')
  |  |  ------------------
  |  |  |  |  122|    604|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (351:4): [True: 311, False: 578k]
  ------------------
  352|  2.47k|			case PAD_MARKER :
  ------------------
  |  |   39|  2.47k|#define PAD_MARKER		MAKE_MARKER ('P', 'A', 'D', ' ')
  |  |  ------------------
  |  |  |  |  122|  2.47k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (352:4): [True: 1.86k, False: 576k]
  ------------------
  353|  2.47k|				psf_log_printf (psf, "%M : %d\n", marker, chunk_size) ;
  354|  2.47k|				psf_binheader_readf (psf, "j", chunk_size) ;
  355|  2.47k|				break ;
  356|       |
  357|   215k|			default :
  ------------------
  |  Branch (357:4): [True: 215k, False: 362k]
  ------------------
  358|   215k|					if (chunk_size >= 0xffff0000)
  ------------------
  |  Branch (358:10): [True: 31, False: 215k]
  ------------------
  359|     31|					{	psf_log_printf (psf, "*** Unknown chunk marker (%X) at position %D with length %u. Exiting parser.\n", marker, psf_ftell (psf) - 8, chunk_size) ;
  360|     31|						done = SF_TRUE ;
  361|     31|						break ;
  362|   215k|						} ;
  363|       |
  364|   215k|					if (isprint ((marker >> 24) & 0xFF) && isprint ((marker >> 16) & 0xFF)
  ------------------
  |  Branch (364:10): [True: 215k, False: 176]
  |  Branch (364:45): [True: 215k, False: 84]
  ------------------
  365|   215k|						&& isprint ((marker >> 8) & 0xFF) && isprint (marker & 0xFF))
  ------------------
  |  Branch (365:10): [True: 215k, False: 72]
  |  Branch (365:44): [True: 215k, False: 58]
  ------------------
  366|   215k|					{	psf_log_printf (psf, "*** %M : %d (unknown marker)\n", marker, chunk_size) ;
  367|   215k|						psf_binheader_readf (psf, "j", chunk_size) ;
  368|   215k|						break ;
  369|   215k|						} ;
  370|    390|					if (psf_ftell (psf) & 0x03)
  ------------------
  |  Branch (370:10): [True: 135, False: 255]
  ------------------
  371|    135|					{	psf_log_printf (psf, "  Unknown chunk marker at position 0x%x. Resynching.\n", chunk_size - 4) ;
  372|    135|						psf_binheader_readf (psf, "j", -3) ;
  373|    135|						break ;
  374|    255|						} ;
  375|    255|					psf_log_printf (psf, "*** Unknown chunk marker (0x%X) at position 0x%X. Exiting parser.\n", marker, psf_ftell (psf) - 4) ;
  376|    255|					done = SF_TRUE ;
  377|    255|					break ;
  378|   578k|			} ;	/* switch (marker) */
  379|       |
  380|       |		/* The 'data' chunk, a chunk size of 0xffffffff means that the 'data' chunk size
  381|       |		** is actually given by the ds64_datalength field.
  382|       |		*/
  383|   578k|		if (marker != data_MARKER && chunk_size >= psf->filelength)
  ------------------
  |  |   51|   578k|#define	data_MARKER		MAKE_MARKER ('d', 'a', 't', 'a')
  |  |  ------------------
  |  |  |  |  122|  1.15M|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (383:7): [True: 365k, False: 212k]
  |  Branch (383:32): [True: 1.25k, False: 364k]
  ------------------
  384|  1.25k|		{	psf_log_printf (psf, "*** Chunk size %u > file length %D. Exiting parser.\n", chunk_size, psf->filelength) ;
  385|  1.25k|			break ;
  386|   577k|			} ;
  387|       |
  388|   577k|		if (psf_ftell (psf) >= psf->filelength - SIGNED_SIZEOF (marker))
  ------------------
  |  |   86|   577k|#define		SIGNED_SIZEOF(x)	((int) sizeof (x))
  ------------------
  |  Branch (388:7): [True: 375, False: 576k]
  ------------------
  389|    375|		{	psf_log_printf (psf, "End\n") ;
  390|    375|			break ;
  391|   576k|			} ;
  392|   576k|		} ;
  393|       |
  394|  2.00k|	if (psf->dataoffset <= 0)
  ------------------
  |  Branch (394:6): [True: 1.05k, False: 947]
  ------------------
  395|  1.05k|		return SFE_RF64_NO_DATA ;
  396|       |
  397|    947|	if (psf->sf.channels < 1)
  ------------------
  |  Branch (397:6): [True: 521, False: 426]
  ------------------
  398|    521|		return SFE_CHANNEL_COUNT_ZERO ;
  399|       |
  400|    426|	if (psf->sf.channels > SF_MAX_CHANNELS)
  ------------------
  |  |   95|    426|#define		SF_MAX_CHANNELS		1024
  ------------------
  |  Branch (400:6): [True: 18, False: 408]
  ------------------
  401|     18|		return SFE_CHANNEL_COUNT ;
  402|       |
  403|       |	/* WAVs can be little or big endian */
  404|    408|	psf->endian = psf->rwf_endian ;
  405|       |
  406|    408|	psf_fseek (psf, psf->dataoffset, SEEK_SET) ;
  407|       |
  408|    408|	if (psf->is_pipe == 0)
  ------------------
  |  Branch (408:6): [True: 408, False: 0]
  ------------------
  409|    408|	{	/*
  410|       |		** Check for 'wvpk' at the start of the DATA section. Not able to
  411|       |		** handle this.
  412|       |		*/
  413|    408|		psf_binheader_readf (psf, "4", &marker) ;
  414|    408|		if (marker == wvpk_MARKER || marker == OggS_MARKER)
  ------------------
  |  |   56|    408|#define wvpk_MARKER		MAKE_MARKER ('w', 'v', 'p', 'k')
  |  |  ------------------
  |  |  |  |  122|    816|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
              		if (marker == wvpk_MARKER || marker == OggS_MARKER)
  ------------------
  |  |   55|    407|#define OggS_MARKER		MAKE_MARKER ('O', 'g', 'g', 'S')
  |  |  ------------------
  |  |  |  |  122|    407|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (414:7): [True: 1, False: 407]
  |  Branch (414:32): [True: 1, False: 406]
  ------------------
  415|      2|			return SFE_WAV_WVPK_DATA ;
  416|    408|		} ;
  417|       |
  418|       |	/* Seek to start of DATA section. */
  419|    406|	psf_fseek (psf, psf->dataoffset, SEEK_SET) ;
  420|       |
  421|    406|	if (psf->blockwidth)
  ------------------
  |  Branch (421:6): [True: 382, False: 24]
  ------------------
  422|    382|	{	if (psf->filelength - psf->dataoffset < psf->datalength)
  ------------------
  |  Branch (422:8): [True: 115, False: 267]
  ------------------
  423|    115|			psf->sf.frames = (psf->filelength - psf->dataoffset) / psf->blockwidth ;
  424|    267|		else
  425|    267|			psf->sf.frames = psf->datalength / psf->blockwidth ;
  426|    382|		} ;
  427|       |
  428|    406|	if (frame_count != psf->sf.frames)
  ------------------
  |  Branch (428:6): [True: 340, False: 66]
  ------------------
  429|    340|		psf_log_printf (psf, "*** Calculated frame count %d does not match value from 'ds64' chunk of %d.\n", psf->sf.frames, frame_count) ;
  430|       |
  431|    406|	switch (format)
  432|    406|	{
  433|      5|		case WAVE_FORMAT_EXTENSIBLE :
  ------------------
  |  Branch (433:3): [True: 5, False: 401]
  ------------------
  434|       |
  435|       |			/* with WAVE_FORMAT_EXTENSIBLE the psf->sf.format field is already set. We just have to set the major to rf64 */
  436|      5|			psf->sf.format = (psf->sf.format & ~SF_FORMAT_TYPEMASK) | SF_FORMAT_RF64 ;
  437|       |
  438|      5|			if (psf->sf.format == (SF_FORMAT_WAVEX | SF_FORMAT_MS_ADPCM))
  ------------------
  |  Branch (438:8): [True: 0, False: 5]
  ------------------
  439|      0|			{	*blockalign = wav_fmt->msadpcm.blockalign ;
  440|      0|				*framesperblock = wav_fmt->msadpcm.samplesperblock ;
  441|      0|				} ;
  442|      5|			break ;
  443|       |
  444|     90|		case WAVE_FORMAT_PCM :
  ------------------
  |  Branch (444:3): [True: 90, False: 316]
  ------------------
  445|     90|					psf->sf.format = SF_FORMAT_RF64 | u_bitwidth_to_subformat (psf->bytewidth * 8) ;
  446|     90|					break ;
  447|       |
  448|    125|		case WAVE_FORMAT_MULAW :
  ------------------
  |  Branch (448:3): [True: 125, False: 281]
  ------------------
  449|    125|		case IBM_FORMAT_MULAW :
  ------------------
  |  Branch (449:3): [True: 0, False: 406]
  ------------------
  450|    125|					psf->sf.format = (SF_FORMAT_RF64 | SF_FORMAT_ULAW) ;
  451|    125|					break ;
  452|       |
  453|    104|		case WAVE_FORMAT_ALAW :
  ------------------
  |  Branch (453:3): [True: 104, False: 302]
  ------------------
  454|    104|		case IBM_FORMAT_ALAW :
  ------------------
  |  Branch (454:3): [True: 0, False: 406]
  ------------------
  455|    104|					psf->sf.format = (SF_FORMAT_RF64 | SF_FORMAT_ALAW) ;
  456|    104|					break ;
  457|       |
  458|      2|		case WAVE_FORMAT_MS_ADPCM :
  ------------------
  |  Branch (458:3): [True: 2, False: 404]
  ------------------
  459|      2|					psf->sf.format = (SF_FORMAT_RF64 | SF_FORMAT_MS_ADPCM) ;
  460|      2|					*blockalign = wav_fmt->msadpcm.blockalign ;
  461|      2|					*framesperblock = wav_fmt->msadpcm.samplesperblock ;
  462|      2|					break ;
  463|       |
  464|      1|		case WAVE_FORMAT_IMA_ADPCM :
  ------------------
  |  Branch (464:3): [True: 1, False: 405]
  ------------------
  465|      1|					psf->sf.format = (SF_FORMAT_RF64 | SF_FORMAT_IMA_ADPCM) ;
  466|      1|					*blockalign = wav_fmt->ima.blockalign ;
  467|      1|					*framesperblock = wav_fmt->ima.samplesperblock ;
  468|      1|					break ;
  469|       |
  470|      3|		case WAVE_FORMAT_GSM610 :
  ------------------
  |  Branch (470:3): [True: 3, False: 403]
  ------------------
  471|      3|					psf->sf.format = (SF_FORMAT_RF64 | SF_FORMAT_GSM610) ;
  472|      3|					break ;
  473|       |
  474|     69|		case WAVE_FORMAT_IEEE_FLOAT :
  ------------------
  |  Branch (474:3): [True: 69, False: 337]
  ------------------
  475|     69|					psf->sf.format = SF_FORMAT_RF64 ;
  476|     69|					psf->sf.format |= (psf->bytewidth == 8) ? SF_FORMAT_DOUBLE : SF_FORMAT_FLOAT ;
  ------------------
  |  Branch (476:24): [True: 18, False: 51]
  ------------------
  477|     69|					break ;
  478|       |
  479|      5|		case WAVE_FORMAT_G721_ADPCM :
  ------------------
  |  Branch (479:3): [True: 5, False: 401]
  ------------------
  480|      5|					psf->sf.format = SF_FORMAT_RF64 | SF_FORMAT_G721_32 ;
  481|      5|					break ;
  482|       |
  483|      2|		default : return SFE_UNIMPLEMENTED ;
  ------------------
  |  Branch (483:3): [True: 2, False: 404]
  ------------------
  484|    406|		} ;
  485|       |
  486|    404|	if (wpriv->fmt_is_broken)
  ------------------
  |  Branch (486:6): [True: 29, False: 375]
  ------------------
  487|     29|		wavlike_analyze (psf) ;
  488|       |
  489|       |	/* Only set the format endian-ness if its non-standard big-endian. */
  490|    404|	if (psf->endian == SF_ENDIAN_BIG)
  ------------------
  |  Branch (490:6): [True: 0, False: 404]
  ------------------
  491|      0|		psf->sf.format |= SF_ENDIAN_BIG ;
  492|       |
  493|    404|	return 0 ;
  494|    406|} /* rf64_read_header */
rf64.c:rf64_close:
  814|    404|{
  815|    404|	if (psf->file.mode == SFM_WRITE || psf->file.mode == SFM_RDWR)
  ------------------
  |  Branch (815:6): [True: 0, False: 404]
  |  Branch (815:37): [True: 0, False: 404]
  ------------------
  816|      0|	{	rf64_write_tailer (psf) ;
  817|      0|		rf64_write_header (psf, SF_TRUE) ;
  818|      0|		} ;
  819|       |
  820|    404|	return 0 ;
  821|    404|} /* rf64_close */

rx2_open:
   34|      1|{	if (psf)
  ------------------
  |  Branch (34:7): [True: 1, False: 0]
  ------------------
   35|      1|		return SFE_UNIMPLEMENTED ;
   36|      0|	return 0 ;
   37|      1|} /* rx2_open */

sds_open:
  106|    334|{	SDS_PRIVATE	*psds ;
  107|    334|	int			error = 0 ;
  108|       |
  109|       |	/* Hmmmm, need this here to pass update_header_test. */
  110|    334|	psf->sf.frames = 0 ;
  111|       |
  112|    334|	if (! (psds = calloc (1, sizeof (SDS_PRIVATE))))
  ------------------
  |  Branch (112:6): [True: 0, False: 334]
  ------------------
  113|      0|		return SFE_MALLOC_FAILED ;
  114|    334|	psf->codec_data = psds ;
  115|       |
  116|    334|	if (psf->file.mode == SFM_READ || (psf->file.mode == SFM_RDWR && psf->filelength > 0))
  ------------------
  |  Branch (116:6): [True: 334, False: 0]
  |  Branch (116:37): [True: 0, False: 0]
  |  Branch (116:67): [True: 0, False: 0]
  ------------------
  117|    334|	{	if ((error = sds_read_header (psf, psds)))
  ------------------
  |  Branch (117:8): [True: 22, False: 312]
  ------------------
  118|     22|			return error ;
  119|    334|		} ;
  120|       |
  121|    312|	if ((SF_CONTAINER (psf->sf.format)) != SF_FORMAT_SDS)
  ------------------
  |  |  101|    312|#define SF_CONTAINER(x)		((x) & SF_FORMAT_TYPEMASK)
  ------------------
  |  Branch (121:6): [True: 0, False: 312]
  ------------------
  122|      0|		return	SFE_BAD_OPEN_FORMAT ;
  123|       |
  124|    312|	if (psf->file.mode == SFM_WRITE || psf->file.mode == SFM_RDWR)
  ------------------
  |  Branch (124:6): [True: 0, False: 312]
  |  Branch (124:37): [True: 0, False: 312]
  ------------------
  125|      0|	{	if (sds_write_header (psf, SF_FALSE))
  ------------------
  |  Branch (125:8): [True: 0, False: 0]
  ------------------
  126|      0|			return psf->error ;
  127|       |
  128|      0|		psf->write_header = sds_write_header ;
  129|       |
  130|      0|		psf_fseek (psf, SDS_DATA_OFFSET, SEEK_SET) ;
  ------------------
  |  |   35|      0|#define	SDS_DATA_OFFSET				0x15
  ------------------
  131|    312|		} ;
  132|       |
  133|    312|	if ((error = sds_init (psf, psds)) != 0)
  ------------------
  |  Branch (133:6): [True: 7, False: 305]
  ------------------
  134|      7|		return error ;
  135|       |
  136|    305|	psf->container_close = sds_close ;
  137|    305|	psf->seek = sds_seek ;
  138|    305|	psf->byterate = sds_byterate ;
  139|       |
  140|    305|	psf->blockwidth = 0 ;
  141|       |
  142|    305|	return error ;
  143|    312|} /* sds_open */
sds.c:sds_close:
  150|    305|{
  151|    305|	if (psf->file.mode == SFM_WRITE || psf->file.mode == SFM_RDWR)
  ------------------
  |  Branch (151:6): [True: 0, False: 305]
  |  Branch (151:37): [True: 0, False: 305]
  ------------------
  152|      0|	{	SDS_PRIVATE *psds ;
  153|       |
  154|      0|		if ((psds = (SDS_PRIVATE *) psf->codec_data) == NULL)
  ------------------
  |  Branch (154:7): [True: 0, False: 0]
  ------------------
  155|      0|		{	psf_log_printf (psf, "*** Bad psf->codec_data ptr.\n") ;
  156|      0|			return SFE_INTERNAL ;
  157|      0|			} ;
  158|       |
  159|      0|		if (psds->write_count > 0)
  ------------------
  |  Branch (159:7): [True: 0, False: 0]
  ------------------
  160|      0|		{	memset (&(psds->write_data [psds->write_count]), 0, (psds->samplesperblock - psds->write_count) * sizeof (int)) ;
  161|      0|			psds->writer (psf, psds) ;
  162|      0|			} ;
  163|       |
  164|      0|		sds_write_header (psf, SF_TRUE) ;
  165|    305|		} ;
  166|       |
  167|    305|	return 0 ;
  168|    305|} /* sds_close */
sds.c:sds_init:
  172|    312|{
  173|    312|	if (psds->bitwidth < 8 || psds->bitwidth > 28)
  ------------------
  |  Branch (173:6): [True: 5, False: 307]
  |  Branch (173:28): [True: 2, False: 305]
  ------------------
  174|      7|		return (psf->error = SFE_SDS_BAD_BIT_WIDTH) ;
  175|       |
  176|    305|	if (psds->bitwidth < 14)
  ------------------
  |  Branch (176:6): [True: 104, False: 201]
  ------------------
  177|    104|	{	psds->reader = sds_2byte_read ;
  178|    104|		psds->writer = sds_2byte_write ;
  179|    104|		psds->samplesperblock = SDS_AUDIO_BYTES_PER_BLOCK / 2 ;
  ------------------
  |  |   38|    104|#define SDS_AUDIO_BYTES_PER_BLOCK	120
  ------------------
  180|    104|		}
  181|    201|	else if (psds->bitwidth < 21)
  ------------------
  |  Branch (181:11): [True: 93, False: 108]
  ------------------
  182|     93|	{	psds->reader = sds_3byte_read ;
  183|     93|		psds->writer = sds_3byte_write ;
  184|     93|		psds->samplesperblock = SDS_AUDIO_BYTES_PER_BLOCK / 3 ;
  ------------------
  |  |   38|     93|#define SDS_AUDIO_BYTES_PER_BLOCK	120
  ------------------
  185|     93|		}
  186|    108|	else
  187|    108|	{	psds->reader = sds_4byte_read ;
  188|    108|		psds->writer = sds_4byte_write ;
  189|    108|		psds->samplesperblock = SDS_AUDIO_BYTES_PER_BLOCK / 4 ;
  ------------------
  |  |   38|    108|#define SDS_AUDIO_BYTES_PER_BLOCK	120
  ------------------
  190|    108|		} ;
  191|       |
  192|    305|	if (psf->file.mode == SFM_READ || psf->file.mode == SFM_RDWR)
  ------------------
  |  Branch (192:6): [True: 305, False: 0]
  |  Branch (192:36): [True: 0, False: 0]
  ------------------
  193|    305|	{	psf->read_short		= sds_read_s ;
  194|    305|		psf->read_int		= sds_read_i ;
  195|    305|		psf->read_float		= sds_read_f ;
  196|    305|		psf->read_double	= sds_read_d ;
  197|       |
  198|       |		/* Read first block. */
  199|    305|		psds->reader (psf, psds) ;
  200|    305|		} ;
  201|       |
  202|    305|	if (psf->file.mode == SFM_WRITE || psf->file.mode == SFM_RDWR)
  ------------------
  |  Branch (202:6): [True: 0, False: 305]
  |  Branch (202:37): [True: 0, False: 305]
  ------------------
  203|      0|	{	psf->write_short	= sds_write_s ;
  204|      0|		psf->write_int		= sds_write_i ;
  205|      0|		psf->write_float	= sds_write_f ;
  206|      0|		psf->write_double	= sds_write_d ;
  207|      0|		} ;
  208|       |
  209|    305|	return 0 ;
  210|    312|} /* sds_init */
sds.c:sds_2byte_read:
  422|   874k|{	unsigned char *ucptr, checksum ;
  423|   874k|	unsigned int sample ;
  424|   874k|	int 	k ;
  425|       |
  426|   874k|	psds->read_block ++ ;
  427|   874k|	psds->read_count = 0 ;
  428|       |
  429|   874k|	if (psds->read_block * psds->samplesperblock > psds->frames)
  ------------------
  |  Branch (429:6): [True: 82, False: 874k]
  ------------------
  430|     82|	{	memset (psds->read_samples, 0, psds->samplesperblock * sizeof (int)) ;
  431|     82|		return 1 ;
  432|   874k|		} ;
  433|       |
  434|   874k|	if ((k = (int) psf_fread (psds->read_data, 1, SDS_BLOCK_SIZE, psf)) != SDS_BLOCK_SIZE)
  ------------------
  |  |   36|   874k|#define SDS_BLOCK_SIZE				127
  ------------------
              	if ((k = (int) psf_fread (psds->read_data, 1, SDS_BLOCK_SIZE, psf)) != SDS_BLOCK_SIZE)
  ------------------
  |  |   36|   874k|#define SDS_BLOCK_SIZE				127
  ------------------
  |  Branch (434:6): [True: 873k, False: 823]
  ------------------
  435|   873k|		psf_log_printf (psf, "*** Warning : short read (%d != %d).\n", k, SDS_BLOCK_SIZE) ;
  ------------------
  |  |   36|   873k|#define SDS_BLOCK_SIZE				127
  ------------------
  436|       |
  437|   874k|	if (psds->read_data [0] != 0xF0)
  ------------------
  |  Branch (437:6): [True: 752k, False: 121k]
  ------------------
  438|   752k|	{	printf ("Error A : %02X\n", psds->read_data [0] & 0xFF) ;
  439|   752k|		} ;
  440|       |
  441|   874k|	checksum = psds->read_data [1] ;
  442|   874k|	if (checksum != 0x7E)
  ------------------
  |  Branch (442:6): [True: 737k, False: 136k]
  ------------------
  443|   737k|	{	printf ("Error 1 : %02X\n", checksum & 0xFF) ;
  444|   737k|		}
  445|       |
  446|   108M|	for (k = 2 ; k <= SDS_BLOCK_SIZE - 3 ; k ++)
  ------------------
  |  |   36|   108M|#define SDS_BLOCK_SIZE				127
  ------------------
  |  Branch (446:15): [True: 107M, False: 874k]
  ------------------
  447|   107M|		checksum ^= psds->read_data [k] ;
  448|       |
  449|   874k|	checksum &= 0x7F ;
  450|       |
  451|   874k|	if (checksum != psds->read_data [SDS_BLOCK_SIZE - 2])
  ------------------
  |  |   36|   874k|#define SDS_BLOCK_SIZE				127
  ------------------
  |  Branch (451:6): [True: 541k, False: 332k]
  ------------------
  452|   541k|	{	psf_log_printf (psf, "Block %d : checksum is %02X should be %02X\n", psds->read_data [4], checksum, psds->read_data [SDS_BLOCK_SIZE - 2]) ;
  ------------------
  |  |   36|   541k|#define SDS_BLOCK_SIZE				127
  ------------------
  453|   541k|		} ;
  454|       |
  455|   874k|	ucptr = psds->read_data + 5 ;
  456|  53.3M|	for (k = 0 ; k < 120 ; k += 2)
  ------------------
  |  Branch (456:15): [True: 52.4M, False: 874k]
  ------------------
  457|  52.4M|	{	sample = arith_shift_left (ucptr [k], 25) | arith_shift_left (ucptr [k + 1], 18) ;
  458|  52.4M|		psds->read_samples [k / 2] = (int) (sample - 0x80000000) ;
  459|  52.4M|		} ;
  460|       |
  461|   874k|	return 1 ;
  462|   874k|} /* sds_2byte_read */
sds.c:sds_3byte_read:
  466|  1.11M|{	unsigned char *ucptr, checksum ;
  467|  1.11M|	unsigned int sample ;
  468|  1.11M|	int 	k ;
  469|       |
  470|  1.11M|	psds->read_block ++ ;
  471|  1.11M|	psds->read_count = 0 ;
  472|       |
  473|  1.11M|	if (psds->read_block * psds->samplesperblock > psds->frames)
  ------------------
  |  Branch (473:6): [True: 70, False: 1.11M]
  ------------------
  474|     70|	{	memset (psds->read_samples, 0, psds->samplesperblock * sizeof (int)) ;
  475|     70|		return 1 ;
  476|  1.11M|		} ;
  477|       |
  478|  1.11M|	if ((k = (int) psf_fread (psds->read_data, 1, SDS_BLOCK_SIZE, psf)) != SDS_BLOCK_SIZE)
  ------------------
  |  |   36|  1.11M|#define SDS_BLOCK_SIZE				127
  ------------------
              	if ((k = (int) psf_fread (psds->read_data, 1, SDS_BLOCK_SIZE, psf)) != SDS_BLOCK_SIZE)
  ------------------
  |  |   36|  1.11M|#define SDS_BLOCK_SIZE				127
  ------------------
  |  Branch (478:6): [True: 1.11M, False: 196]
  ------------------
  479|  1.11M|		psf_log_printf (psf, "*** Warning : short read (%d != %d).\n", k, SDS_BLOCK_SIZE) ;
  ------------------
  |  |   36|  1.11M|#define SDS_BLOCK_SIZE				127
  ------------------
  480|       |
  481|  1.11M|	if (psds->read_data [0] != 0xF0)
  ------------------
  |  Branch (481:6): [True: 1.02M, False: 92.0k]
  ------------------
  482|  1.02M|	{	printf ("Error A : %02X\n", psds->read_data [0] & 0xFF) ;
  483|  1.02M|		} ;
  484|       |
  485|  1.11M|	checksum = psds->read_data [1] ;
  486|  1.11M|	if (checksum != 0x7E)
  ------------------
  |  Branch (486:6): [True: 989k, False: 124k]
  ------------------
  487|   989k|	{	printf ("Error 1 : %02X\n", checksum & 0xFF) ;
  488|   989k|		}
  489|       |
  490|   138M|	for (k = 2 ; k <= SDS_BLOCK_SIZE - 3 ; k ++)
  ------------------
  |  |   36|   138M|#define SDS_BLOCK_SIZE				127
  ------------------
  |  Branch (490:15): [True: 137M, False: 1.11M]
  ------------------
  491|   137M|		checksum ^= psds->read_data [k] ;
  492|       |
  493|  1.11M|	checksum &= 0x7F ;
  494|       |
  495|  1.11M|	if (checksum != psds->read_data [SDS_BLOCK_SIZE - 2])
  ------------------
  |  |   36|  1.11M|#define SDS_BLOCK_SIZE				127
  ------------------
  |  Branch (495:6): [True: 622k, False: 491k]
  ------------------
  496|   622k|	{	psf_log_printf (psf, "Block %d : checksum is %02X should be %02X\n", psds->read_data [4], checksum, psds->read_data [SDS_BLOCK_SIZE - 2]) ;
  ------------------
  |  |   36|   622k|#define SDS_BLOCK_SIZE				127
  ------------------
  497|   622k|		} ;
  498|       |
  499|  1.11M|	ucptr = psds->read_data + 5 ;
  500|  45.6M|	for (k = 0 ; k < 120 ; k += 3)
  ------------------
  |  Branch (500:15): [True: 44.5M, False: 1.11M]
  ------------------
  501|  44.5M|	{	sample = (((uint32_t) ucptr [k]) << 25) | (ucptr [k + 1] << 18) | (ucptr [k + 2] << 11) ;
  502|  44.5M|		psds->read_samples [k / 3] = (int) (sample - 0x80000000) ;
  503|  44.5M|		} ;
  504|       |
  505|  1.11M|	return 1 ;
  506|  1.11M|} /* sds_3byte_read */
sds.c:sds_4byte_read:
  510|  2.07M|{	unsigned char *ucptr, checksum ;
  511|  2.07M|	uint32_t sample ;
  512|  2.07M|	int 	k ;
  513|       |
  514|  2.07M|	psds->read_block ++ ;
  515|  2.07M|	psds->read_count = 0 ;
  516|       |
  517|  2.07M|	if (psds->read_block * psds->samplesperblock > psds->frames)
  ------------------
  |  Branch (517:6): [True: 85, False: 2.07M]
  ------------------
  518|     85|	{	memset (psds->read_samples, 0, psds->samplesperblock * sizeof (int)) ;
  519|     85|		return 1 ;
  520|  2.07M|		} ;
  521|       |
  522|  2.07M|	if ((k = (int) psf_fread (psds->read_data, 1, SDS_BLOCK_SIZE, psf)) != SDS_BLOCK_SIZE)
  ------------------
  |  |   36|  2.07M|#define SDS_BLOCK_SIZE				127
  ------------------
              	if ((k = (int) psf_fread (psds->read_data, 1, SDS_BLOCK_SIZE, psf)) != SDS_BLOCK_SIZE)
  ------------------
  |  |   36|  2.07M|#define SDS_BLOCK_SIZE				127
  ------------------
  |  Branch (522:6): [True: 2.07M, False: 1.45k]
  ------------------
  523|  2.07M|		psf_log_printf (psf, "*** Warning : short read (%d != %d).\n", k, SDS_BLOCK_SIZE) ;
  ------------------
  |  |   36|  2.07M|#define SDS_BLOCK_SIZE				127
  ------------------
  524|       |
  525|  2.07M|	if (psds->read_data [0] != 0xF0)
  ------------------
  |  Branch (525:6): [True: 1.86M, False: 213k]
  ------------------
  526|  1.86M|	{	printf ("Error A : %02X\n", psds->read_data [0] & 0xFF) ;
  527|  1.86M|		} ;
  528|       |
  529|  2.07M|	checksum = psds->read_data [1] ;
  530|  2.07M|	if (checksum != 0x7E)
  ------------------
  |  Branch (530:6): [True: 1.59M, False: 479k]
  ------------------
  531|  1.59M|	{	printf ("Error 1 : %02X\n", checksum & 0xFF) ;
  532|  1.59M|		}
  533|       |
  534|   257M|	for (k = 2 ; k <= SDS_BLOCK_SIZE - 3 ; k ++)
  ------------------
  |  |   36|   257M|#define SDS_BLOCK_SIZE				127
  ------------------
  |  Branch (534:15): [True: 255M, False: 2.07M]
  ------------------
  535|   255M|		checksum ^= psds->read_data [k] ;
  536|       |
  537|  2.07M|	checksum &= 0x7F ;
  538|       |
  539|  2.07M|	if (checksum != psds->read_data [SDS_BLOCK_SIZE - 2])
  ------------------
  |  |   36|  2.07M|#define SDS_BLOCK_SIZE				127
  ------------------
  |  Branch (539:6): [True: 1.25M, False: 823k]
  ------------------
  540|  1.25M|	{	psf_log_printf (psf, "Block %d : checksum is %02X should be %02X\n", psds->read_data [4], checksum, psds->read_data [SDS_BLOCK_SIZE - 2]) ;
  ------------------
  |  |   36|  1.25M|#define SDS_BLOCK_SIZE				127
  ------------------
  541|  1.25M|		} ;
  542|       |
  543|  2.07M|	ucptr = psds->read_data + 5 ;
  544|  64.3M|	for (k = 0 ; k < 120 ; k += 4)
  ------------------
  |  Branch (544:15): [True: 62.2M, False: 2.07M]
  ------------------
  545|  62.2M|	{	sample = (((uint32_t) ucptr [k]) << 25) | (ucptr [k + 1] << 18) | (ucptr [k + 2] << 11) | (ucptr [k + 3] << 4) ;
  546|  62.2M|		psds->read_samples [k / 4] = (int) (sample - 0x80000000) ;
  547|  62.2M|		} ;
  548|       |
  549|  2.07M|	return 1 ;
  550|  2.07M|} /* sds_4byte_read */
sds.c:sds_read:
  659|   159M|{	int	count, total = 0 ;
  660|       |
  661|   318M|	while (total < len)
  ------------------
  |  Branch (661:9): [True: 159M, False: 159M]
  ------------------
  662|   159M|	{	if (psds->read_block * psds->samplesperblock >= psds->frames)
  ------------------
  |  Branch (662:8): [True: 217, False: 159M]
  ------------------
  663|    217|		{	memset (&(ptr [total]), 0, (len - total) * sizeof (int)) ;
  664|    217|			return total ;
  665|   159M|			} ;
  666|       |
  667|   159M|		if (psds->read_count >= psds->samplesperblock)
  ------------------
  |  Branch (667:7): [True: 4.06M, False: 155M]
  ------------------
  668|  4.06M|			psds->reader (psf, psds) ;
  669|       |
  670|   159M|		count = (psds->samplesperblock - psds->read_count) ;
  671|   159M|		count = (len - total > count) ? count : len - total ;
  ------------------
  |  Branch (671:11): [True: 0, False: 159M]
  ------------------
  672|       |
  673|   159M|		memcpy (&(ptr [total]), &(psds->read_samples [psds->read_count]), count * sizeof (int)) ;
  674|   159M|		total += count ;
  675|   159M|		psds->read_count += count ;
  676|   159M|		} ;
  677|       |
  678|   159M|	return total ;
  679|   159M|} /* sds_read */
sds.c:sds_read_f:
  595|   159M|{	BUF_UNION	ubuf ;
  596|   159M|	SDS_PRIVATE	*psds ;
  597|   159M|	int			*iptr ;
  598|   159M|	int			k, bufferlen, readcount, count ;
  599|   159M|	sf_count_t	total = 0 ;
  600|   159M|	float		normfact ;
  601|       |
  602|   159M|	if (psf->codec_data == NULL)
  ------------------
  |  Branch (602:6): [True: 0, False: 159M]
  ------------------
  603|      0|		return 0 ;
  604|   159M|	psds = (SDS_PRIVATE*) psf->codec_data ;
  605|       |
  606|   159M|	if (psf->norm_float == SF_TRUE)
  ------------------
  |  Branch (606:6): [True: 159M, False: 0]
  ------------------
  607|   159M|		normfact = 1.0 / 0x80000000 ;
  608|      0|	else
  609|      0|		normfact = 1.0 / (1 << psds->bitwidth) ;
  610|       |
  611|   159M|	iptr = ubuf.ibuf ;
  612|   159M|	bufferlen = ARRAY_LEN (ubuf.ibuf) ;
  ------------------
  |  |   88|   159M|#define		ARRAY_LEN(x)	((int) (sizeof (x) / sizeof ((x) [0])))
  ------------------
  613|   318M|	while (len > 0)
  ------------------
  |  Branch (613:9): [True: 159M, False: 159M]
  ------------------
  614|   159M|	{	readcount = (len >= bufferlen) ? bufferlen : (int) len ;
  ------------------
  |  Branch (614:16): [True: 0, False: 159M]
  ------------------
  615|   159M|		count = sds_read (psf, psds, iptr, readcount) ;
  616|   318M|		for (k = 0 ; k < readcount ; k++)
  ------------------
  |  Branch (616:16): [True: 159M, False: 159M]
  ------------------
  617|   159M|			ptr [total + k] = normfact * iptr [k] ;
  618|   159M|		total += count ;
  619|   159M|		len -= readcount ;
  620|   159M|		} ;
  621|       |
  622|   159M|	return total ;
  623|   159M|} /* sds_read_f */
sds.c:sds_read_header:
  214|    334|{	unsigned char	channel, bitwidth, loop_type, byte ;
  215|    334|	unsigned short	sample_no, marker ;
  216|    334|	unsigned int	samp_period, data_length, sustain_loop_start, sustain_loop_end ;
  217|    334|	int		bytesread, blockcount ;
  218|       |
  219|       |	/* Set position to start of file to begin reading header. */
  220|    334|	bytesread = psf_binheader_readf (psf, "pE211", 0, &marker, &channel, &byte) ;
  221|       |
  222|    334|	if (marker != 0xF07E || byte != 0x01)
  ------------------
  |  Branch (222:6): [True: 0, False: 334]
  |  Branch (222:26): [True: 0, False: 334]
  ------------------
  223|      0|		return SFE_SDS_NOT_SDS ;
  224|       |
  225|    334|	bytesread += psf_binheader_readf (psf, "e2", &sample_no) ;
  226|    334|	sample_no = SDS_3BYTE_TO_INT_DECODE (sample_no) ;
  ------------------
  |  |   40|    334|#define SDS_3BYTE_TO_INT_DECODE(x) (((x) & 0x7F) | (((x) & 0x7F00) >> 1) | (((x) & 0x7F0000) >> 2))
  ------------------
  227|       |
  228|    334|	psf_log_printf (psf, "Midi Sample Dump Standard (.sds)\nF07E\n"
  229|    334|						" Midi Channel  : %d\n Sample Number : %d\n",
  230|    334|						channel, sample_no) ;
  231|       |
  232|    334|	bytesread += psf_binheader_readf (psf, "e13", &bitwidth, &samp_period) ;
  233|       |
  234|    334|	samp_period = SDS_3BYTE_TO_INT_DECODE (samp_period) ;
  ------------------
  |  |   40|    334|#define SDS_3BYTE_TO_INT_DECODE(x) (((x) & 0x7F) | (((x) & 0x7F00) >> 1) | (((x) & 0x7F0000) >> 2))
  ------------------
  235|       |
  236|    334|	psds->bitwidth = bitwidth ;
  237|       |
  238|    334|	if (psds->bitwidth > 1)
  ------------------
  |  Branch (238:6): [True: 332, False: 2]
  ------------------
  239|    332|		psf_log_printf (psf, " Bit Width     : %d\n", psds->bitwidth) ;
  240|      2|	else
  241|      2|	{	psf_log_printf (psf, " Bit Width     : %d (should be > 1)\n", psds->bitwidth) ;
  242|      2|		return SFE_SDS_BAD_BIT_WIDTH ;
  243|    332|		} ;
  244|       |
  245|    332|	if (samp_period > 0)
  ------------------
  |  Branch (245:6): [True: 312, False: 20]
  ------------------
  246|    312|	{	psf->sf.samplerate = 1000000000 / samp_period ;
  247|       |
  248|    312|		psf_log_printf (psf, " Sample Period : %d\n"
  249|    312|							" Sample Rate   : %d\n",
  250|    312|							samp_period, psf->sf.samplerate) ;
  251|    312|		}
  252|     20|	else
  253|     20|	{	psf->sf.samplerate = 16000 ;
  254|       |
  255|     20|		psf_log_printf (psf, " Sample Period : %d (should be > 0)\n"
  256|     20|							" Sample Rate   : %d (guessed)\n",
  257|     20|							samp_period, psf->sf.samplerate) ;
  258|     20|		} ;
  259|       |
  260|    332|	bytesread += psf_binheader_readf (psf, "e3331", &data_length, &sustain_loop_start, &sustain_loop_end, &loop_type) ;
  261|       |
  262|    332|	data_length = SDS_3BYTE_TO_INT_DECODE (data_length) ;
  ------------------
  |  |   40|    332|#define SDS_3BYTE_TO_INT_DECODE(x) (((x) & 0x7F) | (((x) & 0x7F00) >> 1) | (((x) & 0x7F0000) >> 2))
  ------------------
  263|       |
  264|    332|	psf->sf.frames = psds->frames = data_length ;
  265|       |
  266|    332|	sustain_loop_start = SDS_3BYTE_TO_INT_DECODE (sustain_loop_start) ;
  ------------------
  |  |   40|    332|#define SDS_3BYTE_TO_INT_DECODE(x) (((x) & 0x7F) | (((x) & 0x7F00) >> 1) | (((x) & 0x7F0000) >> 2))
  ------------------
  267|    332|	sustain_loop_end = SDS_3BYTE_TO_INT_DECODE (sustain_loop_end) ;
  ------------------
  |  |   40|    332|#define SDS_3BYTE_TO_INT_DECODE(x) (((x) & 0x7F) | (((x) & 0x7F00) >> 1) | (((x) & 0x7F0000) >> 2))
  ------------------
  268|       |
  269|    332|	psf_log_printf (psf, 	" Sustain Loop\n"
  270|    332|							"     Start     : %d\n"
  271|    332|							"     End       : %d\n"
  272|    332|							"     Loop Type : %d\n",
  273|    332|			sustain_loop_start, sustain_loop_end, loop_type) ;
  274|       |
  275|    332|	psf->dataoffset = SDS_DATA_OFFSET ;
  ------------------
  |  |   35|    332|#define	SDS_DATA_OFFSET				0x15
  ------------------
  276|    332|	psf->datalength = psf->filelength - psf->dataoffset ;
  277|       |
  278|    332|	bytesread += psf_binheader_readf (psf, "1", &byte) ;
  279|    332|	if (byte != 0xF7)
  ------------------
  |  Branch (279:6): [True: 330, False: 2]
  ------------------
  280|    330|		psf_log_printf (psf, "bad end : %X\n", byte & 0xFF) ;
  281|       |
  282|  1.27k|	for (blockcount = 0 ; bytesread < psf->filelength ; blockcount++)
  ------------------
  |  Branch (282:24): [True: 968, False: 310]
  ------------------
  283|    968|	{
  284|    968|		bytesread += (int) psf_fread (&marker, 1, 2, psf) ;
  285|       |
  286|    968|		if (marker == 0)
  ------------------
  |  Branch (286:7): [True: 22, False: 946]
  ------------------
  287|     22|			break ;
  288|       |
  289|    946|		psf_fseek (psf, SDS_BLOCK_SIZE - 2, SEEK_CUR) ;
  ------------------
  |  |   36|    946|#define SDS_BLOCK_SIZE				127
  ------------------
  290|    946|		bytesread += SDS_BLOCK_SIZE - 2 ;
  ------------------
  |  |   36|    946|#define SDS_BLOCK_SIZE				127
  ------------------
  291|    946|		} ;
  292|       |
  293|    332|	psf_log_printf (psf, "\nBlocks         : %d\n", blockcount) ;
  294|    332|	psds->total_blocks = blockcount ;
  295|       |
  296|    332|	psds->samplesperblock = SDS_AUDIO_BYTES_PER_BLOCK / ((psds->bitwidth + 6) / 7) ;
  ------------------
  |  |   38|    332|#define SDS_AUDIO_BYTES_PER_BLOCK	120
  ------------------
  297|    332|	psf_log_printf (psf, "Samples/Block  : %d\n", psds->samplesperblock) ;
  298|       |
  299|    332|	psf_log_printf (psf, "Frames         : %d\n", blockcount * psds->samplesperblock) ;
  300|       |
  301|       |	/* Always Mono */
  302|    332|	psf->sf.channels = 1 ;
  303|    332|	psf->sf.sections = 1 ;
  304|       |
  305|       |	/*
  306|       |	** Lie to the user about PCM bit width. Always round up to
  307|       |	** the next multiple of 8.
  308|       |	*/
  309|    332|	switch ((psds->bitwidth + 7) / 8)
  310|    332|	{	case 1 :
  ------------------
  |  Branch (310:4): [True: 19, False: 313]
  ------------------
  311|     19|			psf->sf.format = SF_FORMAT_SDS | SF_FORMAT_PCM_S8 ;
  312|     19|			break ;
  313|       |
  314|    123|		case 2 :
  ------------------
  |  Branch (314:3): [True: 123, False: 209]
  ------------------
  315|    123|			psf->sf.format = SF_FORMAT_SDS | SF_FORMAT_PCM_16 ;
  316|    123|			break ;
  317|       |
  318|    109|		case 3 :
  ------------------
  |  Branch (318:3): [True: 109, False: 223]
  ------------------
  319|    109|			psf->sf.format = SF_FORMAT_SDS | SF_FORMAT_PCM_24 ;
  320|    109|			break ;
  321|       |
  322|     61|		case 4 :
  ------------------
  |  Branch (322:3): [True: 61, False: 271]
  ------------------
  323|     61|			psf->sf.format = SF_FORMAT_SDS | SF_FORMAT_PCM_32 ;
  324|     61|			break ;
  325|       |
  326|     20|		default :
  ------------------
  |  Branch (326:3): [True: 20, False: 312]
  ------------------
  327|     20|			psf_log_printf (psf, "*** Weird byte width (%d)\n", (psds->bitwidth + 7) / 8) ;
  328|     20|			return SFE_SDS_BAD_BIT_WIDTH ;
  329|    332|		} ;
  330|       |
  331|    312|	psf_fseek (psf, SDS_DATA_OFFSET, SEEK_SET) ;
  ------------------
  |  |   35|    312|#define	SDS_DATA_OFFSET				0x15
  ------------------
  332|       |
  333|    312|	return 0 ;
  334|    332|} /* sds_read_header */

paf.c:endswap_int_array:
  301|  3.38k|{
  302|  47.5k|	for (int i = 0 ; i < len ; i++)
  ------------------
  |  Branch (302:19): [True: 44.1k, False: 3.38k]
  ------------------
  303|  44.1k|	{	int temp = ptr [i] ;
  304|       |		ptr [i] = ENDSWAP_32 (temp) ;
  ------------------
  |  |   35|  44.1k|#define	ENDSWAP_32(x)		(bswap_32 (x))
  ------------------
  305|  44.1k|		} ;
  306|  3.38k|} /* endswap_int_array */
common.c:psf_get_be32:
  241|  19.8M|{	int32_t value = ((uint32_t) ptr [offset]) << 24 ;
  242|  19.8M|	value += ptr [offset + 1] << 16 ;
  243|  19.8M|	value += ptr [offset + 2] << 8 ;
  244|  19.8M|	value += ptr [offset + 3] ;
  245|  19.8M|	return value ;
  246|  19.8M|} /* psf_get_be32 */
common.c:psf_get_le32:
  250|  2.51M|{	int32_t value = ((uint32_t) ptr [offset + 3]) << 24 ;
  251|  2.51M|	value += ptr [offset + 2] << 16 ;
  252|  2.51M|	value += ptr [offset + 1] << 8 ;
  253|  2.51M|	value += ptr [offset] ;
  254|  2.51M|	return value ;
  255|  2.51M|} /* psf_get_le32 */
common.c:psf_get_be64:
  207|  20.3k|{	int64_t value ;
  208|       |
  209|  20.3k|	value = (int64_t) ((uint64_t) ptr [offset] << 24) ;
  210|  20.3k|	value += (int64_t) ((uint64_t) ptr [offset + 1] << 16) ;
  211|  20.3k|	value += (int64_t) ((uint64_t) ptr [offset + 2] << 8) ;
  212|  20.3k|	value += ptr [offset + 3] ;
  213|       |
  214|  20.3k|	value = (int64_t) (((uint64_t) value) << 32) ;
  215|       |
  216|  20.3k|	value += (int64_t) ((uint64_t) ptr [offset + 4] << 24) ;
  217|  20.3k|	value += (int64_t) ((uint64_t) ptr [offset + 5] << 16) ;
  218|  20.3k|	value += (int64_t) ((uint64_t) ptr [offset + 6] << 8) ;
  219|  20.3k|	value += ptr [offset + 7] ;
  220|  20.3k|	return value ;
  221|  20.3k|} /* psf_get_be64 */
common.c:psf_get_le64:
  225|   104k|{	int64_t value = (int64_t) ((uint64_t) ptr [offset + 7] << 24) ;
  226|   104k|	value += (int64_t) ((uint64_t) ptr [offset + 6] << 16) ;
  227|   104k|	value += (int64_t) ((uint64_t) ptr [offset + 5] << 8) ;
  228|   104k|	value += ptr [offset + 4] ;
  229|       |
  230|   104k|	value = (int64_t) (((uint64_t) value) << 32) ;
  231|       |
  232|   104k|	value += (int64_t) ((uint64_t) ptr [offset + 3] << 24) ;
  233|   104k|	value += (int64_t) ((uint64_t) ptr [offset + 2] << 16) ;
  234|   104k|	value += (int64_t) ((uint64_t) ptr [offset + 1] << 8) ;
  235|   104k|	value += ptr [offset] ;
  236|   104k|	return value ;
  237|   104k|} /* psf_get_le64 */
double64.c:endswap_double_array:
  346|    406|{	endswap_int64_t_array ((int64_t *) ptr, len) ;
  347|    406|} /* endswap_double_array */
double64.c:endswap_int64_t_array:
  321|    406|{
  322|  61.4k|	for (int i = 0 ; i < len ; i++)
  ------------------
  |  Branch (322:19): [True: 60.9k, False: 406]
  ------------------
  323|  60.9k|	{	int64_t value = ptr [i] ;
  324|       |		ptr [i] = ENDSWAP_64 (value) ;
  ------------------
  |  |   36|  60.9k|#define	ENDSWAP_64(x)		(bswap_64 (x))
  ------------------
  325|  60.9k|		} ;
  326|    406|} /* endswap_int64_t_array */
float32.c:endswap_int_copy:
  310|    288|{
  311|  2.77k|	for (int i = 0 ; i < len ; i++)
  ------------------
  |  Branch (311:19): [True: 2.49k, False: 288]
  ------------------
  312|  2.49k|	{	dest [i] = ENDSWAP_32 (src [i]) ;
  ------------------
  |  |   35|  2.49k|#define	ENDSWAP_32(x)		(bswap_32 (x))
  ------------------
  313|  2.49k|		} ;
  314|    288|} /* endswap_int_copy */
pcm.c:psf_get_be24:
  259|    622|{	int32_t value = ((uint32_t) ptr [offset]) << 24 ;
  260|    622|	value += ptr [offset + 1] << 16 ;
  261|    622|	value += ptr [offset + 2] << 8 ;
  262|    622|	return value ;
  263|    622|} /* psf_get_be24 */
pcm.c:psf_get_le24:
  267|  3.25M|{	int32_t value = ((uint32_t) ptr [offset + 2]) << 24 ;
  268|  3.25M|	value += ptr [offset + 1] << 16 ;
  269|  3.25M|	value += ptr [offset] << 8 ;
  270|  3.25M|	return value ;
  271|  3.25M|} /* psf_get_le24 */
alac_decoder.c:psf_get_be32:
  241|  3.21k|{	int32_t value = ((uint32_t) ptr [offset]) << 24 ;
  242|  3.21k|	value += ptr [offset + 1] << 16 ;
  243|  3.21k|	value += ptr [offset + 2] << 8 ;
  244|  3.21k|	value += ptr [offset + 3] ;
  245|  3.21k|	return value ;
  246|  3.21k|} /* psf_get_be32 */
alac_decoder.c:psf_get_be16:
  275|    800|{	return (int16_t) (ptr [offset] << 8) + ptr [offset + 1] ;
  276|    800|} /* psf_get_be16 */

sf_open_virtual:
  473|  19.6k|{	SF_PRIVATE 	*psf ;
  474|       |
  475|       |	/* Make sure we have a valid set of virtual pointers. */
  476|  19.6k|	if (sfvirtual->get_filelen == NULL)
  ------------------
  |  Branch (476:6): [True: 0, False: 19.6k]
  ------------------
  477|      0|	{	sf_errno = SFE_BAD_VIRTUAL_IO ;
  478|      0|		snprintf (sf_parselog, sizeof (sf_parselog), "Bad vio_get_filelen in SF_VIRTUAL_IO struct.\n") ;
  479|      0|		return NULL ;
  480|  19.6k|		} ;
  481|       |
  482|  19.6k|	if ((sfvirtual->seek == NULL || sfvirtual->tell == NULL) && sfinfo->seekable)
  ------------------
  |  Branch (482:7): [True: 0, False: 19.6k]
  |  Branch (482:34): [True: 0, False: 19.6k]
  |  Branch (482:62): [True: 0, False: 0]
  ------------------
  483|      0|	{	sf_errno = SFE_BAD_VIRTUAL_IO ;
  484|      0|		snprintf (sf_parselog, sizeof (sf_parselog), "Bad vio_seek / vio_tell in SF_VIRTUAL_IO struct.\n") ;
  485|      0|		return NULL ;
  486|  19.6k|		} ;
  487|       |
  488|  19.6k|	if ((mode == SFM_READ || mode == SFM_RDWR) && sfvirtual->read == NULL)
  ------------------
  |  Branch (488:7): [True: 19.6k, False: 0]
  |  Branch (488:27): [True: 0, False: 0]
  |  Branch (488:48): [True: 0, False: 19.6k]
  ------------------
  489|      0|	{	sf_errno = SFE_BAD_VIRTUAL_IO ;
  490|      0|		snprintf (sf_parselog, sizeof (sf_parselog), "Bad vio_read in SF_VIRTUAL_IO struct.\n") ;
  491|      0|		return NULL ;
  492|  19.6k|		} ;
  493|       |
  494|  19.6k|	if ((mode == SFM_WRITE || mode == SFM_RDWR) && sfvirtual->write == NULL)
  ------------------
  |  Branch (494:7): [True: 0, False: 19.6k]
  |  Branch (494:28): [True: 0, False: 19.6k]
  |  Branch (494:49): [True: 0, False: 0]
  ------------------
  495|      0|	{	sf_errno = SFE_BAD_VIRTUAL_IO ;
  496|      0|		snprintf (sf_parselog, sizeof (sf_parselog), "Bad vio_write in SF_VIRTUAL_IO struct.\n") ;
  497|      0|		return NULL ;
  498|  19.6k|		} ;
  499|       |
  500|  19.6k|	if ((psf = psf_allocate ()) == NULL)
  ------------------
  |  Branch (500:6): [True: 0, False: 19.6k]
  ------------------
  501|      0|	{	sf_errno = SFE_MALLOC_FAILED ;
  502|      0|		return	NULL ;
  503|  19.6k|		} ;
  504|       |
  505|  19.6k|	psf_init_files (psf) ;
  506|       |
  507|  19.6k|	psf->virtual_io = SF_TRUE ;
  508|  19.6k|	psf->vio = *sfvirtual ;
  509|  19.6k|	psf->vio_user_data = user_data ;
  510|       |
  511|  19.6k|	psf->file.mode = mode ;
  512|       |
  513|  19.6k|	return psf_open_file (psf, sfinfo) ;
  514|  19.6k|} /* sf_open_virtual */
sf_close:
  518|  3.21k|{	SF_PRIVATE	*psf ;
  519|       |
  520|  3.21k|	VALIDATE_SNDFILE_AND_ASSIGN_PSF (sndfile, psf, 1) ;
  ------------------
  |  |  326|  3.21k|		{	if ((a) == NULL)						\
  |  |  ------------------
  |  |  |  Branch (326:9): [True: 0, False: 3.21k]
  |  |  ------------------
  |  |  327|  3.21k|			{	sf_errno = SFE_BAD_SNDFILE_PTR ;	\
  |  |  328|      0|				return 0 ;							\
  |  |  329|  3.21k|				} ;									\
  |  |  330|  3.21k|			(b) = (SF_PRIVATE*) (a) ;				\
  |  |  331|  3.21k|			if ((b)->virtual_io == SF_FALSE &&		\
  |  |  ------------------
  |  |  |  Branch (331:8): [True: 0, False: 3.21k]
  |  |  ------------------
  |  |  332|  3.21k|				psf_file_valid (b) == 0)			\
  |  |  ------------------
  |  |  |  Branch (332:5): [True: 0, False: 0]
  |  |  ------------------
  |  |  333|  3.21k|			{	(b)->error = SFE_BAD_FILE_PTR ;		\
  |  |  334|      0|				return 0 ;							\
  |  |  335|  3.21k|				} ;									\
  |  |  336|  3.21k|			if ((b)->Magick != SNDFILE_MAGICK)		\
  |  |  ------------------
  |  |  |  |   41|  3.21k|#define		SNDFILE_MAGICK	0x1234C0DE
  |  |  ------------------
  |  |  |  Branch (336:8): [True: 0, False: 3.21k]
  |  |  ------------------
  |  |  337|  3.21k|			{	(b)->error = SFE_BAD_SNDFILE_PTR ;	\
  |  |  338|      0|				return 0 ;							\
  |  |  339|  3.21k|				} ;									\
  |  |  340|  3.21k|			if (c) (b)->error = 0 ;					\
  |  |  ------------------
  |  |  |  Branch (340:8): [True: 3.21k, Folded]
  |  |  ------------------
  |  |  341|  3.21k|			}
  ------------------
  521|       |
  522|  3.21k|	return psf_close (psf) ;
  523|  6.43k|} /* sf_close */
sf_error_number:
  542|  15.0k|{	static const char *bad_errnum =
  543|  15.0k|		"No error defined for this error number. This is a bug in libsndfile." ;
  544|  15.0k|	int	k ;
  545|       |
  546|  15.0k|	if (errnum == SFE_MAX_ERROR)
  ------------------
  |  Branch (546:6): [True: 0, False: 15.0k]
  ------------------
  547|      0|		return SndfileErrors [0].str ;
  548|       |
  549|  15.0k|	if (errnum < 0 || errnum > SFE_MAX_ERROR)
  ------------------
  |  Branch (549:6): [True: 0, False: 15.0k]
  |  Branch (549:20): [True: 0, False: 15.0k]
  ------------------
  550|      0|	{	/* This really shouldn't happen in release versions. */
  551|      0|		printf ("Not a valid error number (%d).\n", errnum) ;
  552|      0|		return bad_errnum ;
  553|  15.0k|		} ;
  554|       |
  555|   895k|	for (k = 0 ; SndfileErrors [k].str ; k++)
  ------------------
  |  Branch (555:15): [True: 895k, False: 0]
  ------------------
  556|   895k|		if (errnum == SndfileErrors [k].error)
  ------------------
  |  Branch (556:7): [True: 15.0k, False: 880k]
  ------------------
  557|  15.0k|			return SndfileErrors [k].str ;
  558|       |
  559|      0|	return bad_errnum ;
  560|  15.0k|} /* sf_error_number */
sf_readf_float:
 2026|   171M|{	SF_PRIVATE 	*psf ;
 2027|   171M|	sf_count_t	count, extra ;
 2028|       |
 2029|   171M|	if (frames == 0)
  ------------------
  |  Branch (2029:6): [True: 0, False: 171M]
  ------------------
 2030|      0|		return 0 ;
 2031|       |
 2032|   687M|	VALIDATE_SNDFILE_AND_ASSIGN_PSF (sndfile, psf, 1) ;
  ------------------
  |  |  326|   171M|		{	if ((a) == NULL)						\
  |  |  ------------------
  |  |  |  Branch (326:9): [True: 0, False: 171M]
  |  |  ------------------
  |  |  327|   171M|			{	sf_errno = SFE_BAD_SNDFILE_PTR ;	\
  |  |  328|      0|				return 0 ;							\
  |  |  329|   171M|				} ;									\
  |  |  330|   171M|			(b) = (SF_PRIVATE*) (a) ;				\
  |  |  331|   171M|			if ((b)->virtual_io == SF_FALSE &&		\
  |  |  ------------------
  |  |  |  Branch (331:8): [True: 0, False: 171M]
  |  |  ------------------
  |  |  332|   171M|				psf_file_valid (b) == 0)			\
  |  |  ------------------
  |  |  |  Branch (332:5): [True: 0, False: 0]
  |  |  ------------------
  |  |  333|   171M|			{	(b)->error = SFE_BAD_FILE_PTR ;		\
  |  |  334|      0|				return 0 ;							\
  |  |  335|   171M|				} ;									\
  |  |  336|   171M|			if ((b)->Magick != SNDFILE_MAGICK)		\
  |  |  ------------------
  |  |  |  |   41|   171M|#define		SNDFILE_MAGICK	0x1234C0DE
  |  |  ------------------
  |  |  |  Branch (336:8): [True: 0, False: 171M]
  |  |  ------------------
  |  |  337|   171M|			{	(b)->error = SFE_BAD_SNDFILE_PTR ;	\
  |  |  338|      0|				return 0 ;							\
  |  |  339|   171M|				} ;									\
  |  |  340|   171M|			if (c) (b)->error = 0 ;					\
  |  |  ------------------
  |  |  |  Branch (340:8): [True: 171M, Folded]
  |  |  ------------------
  |  |  341|   171M|			}
  ------------------
 2033|       |
 2034|   687M|	if (frames <= 0)
  ------------------
  |  Branch (2034:6): [True: 0, False: 171M]
  ------------------
 2035|      0|	{	psf->error = SFE_NEGATIVE_RW_LEN ;
 2036|      0|		return 0 ;
 2037|   171M|		} ;
 2038|       |
 2039|   171M|	if (psf->file.mode == SFM_WRITE)
  ------------------
  |  Branch (2039:6): [True: 0, False: 171M]
  ------------------
 2040|      0|	{	psf->error = SFE_NOT_READMODE ;
 2041|      0|		return 0 ;
 2042|   171M|		} ;
 2043|       |
 2044|   171M|	if (psf->read_current >= psf->sf.frames)
  ------------------
  |  Branch (2044:6): [True: 2.20k, False: 171M]
  ------------------
 2045|  2.20k|	{	psf_memset (ptr, 0, frames * psf->sf.channels * sizeof (float)) ;
 2046|  2.20k|		return 0 ;
 2047|   171M|		} ;
 2048|       |
 2049|   171M|	if (psf->read_float == NULL || psf->seek == NULL)
  ------------------
  |  Branch (2049:6): [True: 1, False: 171M]
  |  Branch (2049:33): [True: 0, False: 171M]
  ------------------
 2050|      1|	{	psf->error = SFE_UNIMPLEMENTED ;
 2051|      1|		return	0 ;
 2052|   171M|		} ;
 2053|       |
 2054|   171M|	if (psf->last_op != SFM_READ)
  ------------------
  |  Branch (2054:6): [True: 62, False: 171M]
  ------------------
 2055|     62|		if (psf->seek (psf, SFM_READ, psf->read_current) < 0)
  ------------------
  |  Branch (2055:7): [True: 0, False: 62]
  ------------------
 2056|      0|			return 0 ;
 2057|       |
 2058|   171M|	count = psf->read_float (psf, ptr, frames * psf->sf.channels) ;
 2059|       |
 2060|   171M|	if (psf->read_current + count / psf->sf.channels <= psf->sf.frames)
  ------------------
  |  Branch (2060:6): [True: 171M, False: 0]
  ------------------
 2061|   171M|		psf->read_current += count / psf->sf.channels ;
 2062|      0|	else
 2063|      0|	{	count = (psf->sf.frames - psf->read_current) * psf->sf.channels ;
 2064|      0|		extra = frames * psf->sf.channels - count ;
 2065|      0|		psf_memset (ptr + count, 0, extra * sizeof (float)) ;
 2066|      0|		psf->read_current = psf->sf.frames ;
 2067|      0|		} ;
 2068|       |
 2069|   171M|	psf->last_op = SFM_READ ;
 2070|       |
 2071|   171M|	return count / psf->sf.channels ;
 2072|   171M|} /* sf_readf_float */
psf_open_file:
 3016|  19.6k|{	int		error, format ;
 3017|       |
 3018|  19.6k|	sf_errno = error = 0 ;
 3019|  19.6k|	sf_parselog [0] = 0 ;
 3020|       |
 3021|  19.6k|	if (psf->error)
  ------------------
  |  Branch (3021:6): [True: 0, False: 19.6k]
  ------------------
 3022|      0|	{	error = psf->error ;
 3023|      0|		goto error_exit ;
 3024|  19.6k|		} ;
 3025|       |
 3026|  19.6k|	if (psf->file.mode != SFM_READ && psf->file.mode != SFM_WRITE && psf->file.mode != SFM_RDWR)
  ------------------
  |  Branch (3026:6): [True: 0, False: 19.6k]
  |  Branch (3026:36): [True: 0, False: 0]
  |  Branch (3026:67): [True: 0, False: 0]
  ------------------
 3027|      0|	{	error = SFE_BAD_OPEN_MODE ;
 3028|      0|		goto error_exit ;
 3029|  19.6k|		} ;
 3030|       |
 3031|  19.6k|	if (sfinfo == NULL)
  ------------------
  |  Branch (3031:6): [True: 0, False: 19.6k]
  ------------------
 3032|      0|	{	error = SFE_BAD_SF_INFO_PTR ;
 3033|      0|		goto error_exit ;
 3034|  19.6k|		} ;
 3035|       |
 3036|  19.6k|	if (psf->file.mode == SFM_READ)
  ------------------
  |  Branch (3036:6): [True: 19.6k, False: 0]
  ------------------
 3037|  19.6k|	{	if ((SF_CONTAINER (sfinfo->format)) == SF_FORMAT_RAW)
  ------------------
  |  |  101|  19.6k|#define SF_CONTAINER(x)		((x) & SF_FORMAT_TYPEMASK)
  ------------------
  |  Branch (3037:8): [True: 0, False: 19.6k]
  ------------------
 3038|      0|		{	if (sf_format_check (sfinfo) == 0)
  ------------------
  |  Branch (3038:9): [True: 0, False: 0]
  ------------------
 3039|      0|			{	error = SFE_RAW_BAD_FORMAT ;
 3040|      0|				goto error_exit ;
 3041|      0|				} ;
 3042|      0|			}
 3043|  19.6k|		else
 3044|  19.6k|			memset (sfinfo, 0, sizeof (SF_INFO)) ;
 3045|  19.6k|		} ;
 3046|       |
 3047|  19.6k|	memcpy (&psf->sf, sfinfo, sizeof (SF_INFO)) ;
 3048|       |
 3049|  19.6k|	psf->Magick 		= SNDFILE_MAGICK ;
  ------------------
  |  |   41|  19.6k|#define		SNDFILE_MAGICK	0x1234C0DE
  ------------------
 3050|  19.6k|	psf->norm_float 	= SF_TRUE ;
 3051|  19.6k|	psf->norm_double	= SF_TRUE ;
 3052|  19.6k|	psf->dataoffset		= -1 ;
 3053|  19.6k|	psf->datalength		= -1 ;
 3054|  19.6k|	psf->read_current	= -1 ;
 3055|  19.6k|	psf->write_current	= -1 ;
 3056|  19.6k|	psf->auto_header 	= SF_FALSE ;
 3057|  19.6k|	psf->rwf_endian		= SF_ENDIAN_LITTLE ;
 3058|  19.6k|	psf->seek			= psf_default_seek ;
 3059|  19.6k|	psf->float_int_mult = 0 ;
 3060|  19.6k|	psf->float_max		= -1.0 ;
 3061|       |
 3062|       |	/* An attempt at a per SF_PRIVATE unique id. */
 3063|  19.6k|	psf->unique_id		= psf_rand_int32 () ;
 3064|       |
 3065|  19.6k|	psf->sf.sections = 1 ;
 3066|       |
 3067|  19.6k|	psf->is_pipe = psf_is_pipe (psf) ;
 3068|       |
 3069|  19.6k|	if (psf->is_pipe)
  ------------------
  |  Branch (3069:6): [True: 0, False: 19.6k]
  ------------------
 3070|      0|	{	psf->sf.seekable = SF_FALSE ;
 3071|      0|		psf->filelength = SF_COUNT_MAX ;
  ------------------
  |  |  371|      0|#define SF_COUNT_MAX	INT64_MAX
  ------------------
 3072|      0|		}
 3073|  19.6k|	else
 3074|  19.6k|	{	psf->sf.seekable = SF_TRUE ;
 3075|       |
 3076|       |		/* File is open, so get the length. */
 3077|  19.6k|		psf->filelength = psf_get_filelen (psf) ;
 3078|  19.6k|		} ;
 3079|       |
 3080|  19.6k|	if (psf->fileoffset > 0)
  ------------------
  |  Branch (3080:6): [True: 0, False: 19.6k]
  ------------------
 3081|      0|	{	switch (psf->file.mode)
  ------------------
  |  Branch (3081:12): [True: 0, False: 0]
  ------------------
 3082|      0|		{	case SFM_READ :
  ------------------
  |  Branch (3082:5): [True: 0, False: 0]
  ------------------
 3083|      0|				if (psf->filelength < 44)
  ------------------
  |  Branch (3083:9): [True: 0, False: 0]
  ------------------
 3084|      0|				{	psf_log_printf (psf, "Short filelength: %D (fileoffset: %D)\n", psf->filelength, psf->fileoffset) ;
 3085|      0|					error = SFE_BAD_OFFSET ;
 3086|      0|					goto error_exit ;
 3087|      0|					} ;
 3088|      0|				break ;
 3089|       |
 3090|      0|			case SFM_WRITE :
  ------------------
  |  Branch (3090:4): [True: 0, False: 0]
  ------------------
 3091|      0|				psf->fileoffset = 0 ;
 3092|      0|				psf_fseek (psf, 0, SEEK_END) ;
 3093|      0|				psf->fileoffset = psf_ftell (psf) ;
 3094|      0|				break ;
 3095|       |
 3096|      0|			case SFM_RDWR :
  ------------------
  |  Branch (3096:4): [True: 0, False: 0]
  ------------------
 3097|      0|				error = SFE_NO_EMBEDDED_RDWR ;
 3098|      0|				goto error_exit ;
 3099|      0|			} ;
 3100|       |
 3101|      0|		psf_log_printf (psf, "Embedded file offset : %D\n", psf->fileoffset) ;
 3102|  19.6k|		} ;
 3103|       |
 3104|  19.6k|	if (psf->filelength == SF_COUNT_MAX)
  ------------------
  |  |  371|  19.6k|#define SF_COUNT_MAX	INT64_MAX
  ------------------
  |  Branch (3104:6): [True: 0, False: 19.6k]
  ------------------
 3105|      0|		psf_log_printf (psf, "Length : unknown\n") ;
 3106|  19.6k|	else
 3107|  19.6k|		psf_log_printf (psf, "Length : %D\n", psf->filelength) ;
 3108|       |
 3109|  19.6k|	if (psf->file.mode == SFM_WRITE || (psf->file.mode == SFM_RDWR && psf->filelength == 0))
  ------------------
  |  Branch (3109:6): [True: 0, False: 19.6k]
  |  Branch (3109:38): [True: 0, False: 19.6k]
  |  Branch (3109:68): [True: 0, False: 0]
  ------------------
 3110|      0|	{	/* If the file is being opened for write or RDWR and the file is currently
 3111|       |		** empty, then the SF_INFO struct must contain valid data.
 3112|       |		*/
 3113|      0|		if ((SF_CONTAINER (psf->sf.format)) == 0)
  ------------------
  |  |  101|      0|#define SF_CONTAINER(x)		((x) & SF_FORMAT_TYPEMASK)
  ------------------
  |  Branch (3113:7): [True: 0, False: 0]
  ------------------
 3114|      0|		{	error = SFE_ZERO_MAJOR_FORMAT ;
 3115|      0|			goto error_exit ;
 3116|      0|			} ;
 3117|      0|		if ((SF_CODEC (psf->sf.format)) == 0)
  ------------------
  |  |  102|      0|#define SF_CODEC(x)			((x) & SF_FORMAT_SUBMASK)
  ------------------
  |  Branch (3117:7): [True: 0, False: 0]
  ------------------
 3118|      0|		{	error = SFE_ZERO_MINOR_FORMAT ;
 3119|      0|			goto error_exit ;
 3120|      0|			} ;
 3121|       |
 3122|      0|		if (sf_format_check (&psf->sf) == 0)
  ------------------
  |  Branch (3122:7): [True: 0, False: 0]
  ------------------
 3123|      0|		{	error = SFE_BAD_OPEN_FORMAT ;
 3124|      0|			goto error_exit ;
 3125|      0|			} ;
 3126|       |
 3127|       |		/* Header writers divide by the sample rate (htk.c, sds.c, voc.c). */
 3128|      0|		if (psf->sf.samplerate < 1)
  ------------------
  |  Branch (3128:7): [True: 0, False: 0]
  ------------------
 3129|      0|		{	error = SFE_BAD_SF_INFO ;
 3130|      0|			goto error_exit ;
 3131|      0|			} ;
 3132|      0|		}
 3133|  19.6k|	else if ((SF_CONTAINER (psf->sf.format)) != SF_FORMAT_RAW)
  ------------------
  |  |  101|  19.6k|#define SF_CONTAINER(x)		((x) & SF_FORMAT_TYPEMASK)
  ------------------
  |  Branch (3133:11): [True: 19.6k, False: 0]
  ------------------
 3134|  19.6k|	{	/* If type RAW has not been specified then need to figure out file type. */
 3135|  19.6k|		psf->sf.format = guess_file_type (psf) ;
 3136|       |
 3137|  19.6k|		if (psf->sf.format == 0)
  ------------------
  |  Branch (3137:7): [True: 1.86k, False: 17.7k]
  ------------------
 3138|  1.86k|			psf->sf.format = format_from_extension (psf) ;
 3139|  19.6k|		} ;
 3140|       |
 3141|       |	/* Prevent unnecessary seeks */
 3142|  19.6k|	psf->last_op = psf->file.mode ;
 3143|       |
 3144|       |	/* Set bytewidth if known. */
 3145|  19.6k|	switch (SF_CODEC (psf->sf.format))
  ------------------
  |  |  102|  19.6k|#define SF_CODEC(x)			((x) & SF_FORMAT_SUBMASK)
  |  |  ------------------
  |  |  |  Branch (102:23): [True: 0, False: 19.6k]
  |  |  ------------------
  ------------------
 3146|  19.6k|	{	case SF_FORMAT_PCM_S8 :
  ------------------
  |  Branch (3146:4): [True: 0, False: 19.6k]
  ------------------
 3147|      0|		case SF_FORMAT_PCM_U8 :
  ------------------
  |  Branch (3147:3): [True: 0, False: 19.6k]
  ------------------
 3148|      0|		case SF_FORMAT_ULAW :
  ------------------
  |  Branch (3148:3): [True: 0, False: 19.6k]
  ------------------
 3149|      0|		case SF_FORMAT_ALAW :
  ------------------
  |  Branch (3149:3): [True: 0, False: 19.6k]
  ------------------
 3150|      0|		case SF_FORMAT_DPCM_8 :
  ------------------
  |  Branch (3150:3): [True: 0, False: 19.6k]
  ------------------
 3151|      0|				psf->bytewidth = 1 ;
 3152|      0|				break ;
 3153|       |
 3154|      0|		case SF_FORMAT_PCM_16 :
  ------------------
  |  Branch (3154:3): [True: 0, False: 19.6k]
  ------------------
 3155|      0|		case SF_FORMAT_DPCM_16 :
  ------------------
  |  Branch (3155:3): [True: 0, False: 19.6k]
  ------------------
 3156|      0|				psf->bytewidth = 2 ;
 3157|      0|				break ;
 3158|       |
 3159|      0|		case SF_FORMAT_PCM_24 :
  ------------------
  |  Branch (3159:3): [True: 0, False: 19.6k]
  ------------------
 3160|      0|				psf->bytewidth = 3 ;
 3161|      0|				break ;
 3162|       |
 3163|      0|		case SF_FORMAT_PCM_32 :
  ------------------
  |  Branch (3163:3): [True: 0, False: 19.6k]
  ------------------
 3164|      0|		case SF_FORMAT_FLOAT :
  ------------------
  |  Branch (3164:3): [True: 0, False: 19.6k]
  ------------------
 3165|      0|				psf->bytewidth = 4 ;
 3166|      0|				break ;
 3167|       |
 3168|      0|		case SF_FORMAT_DOUBLE :
  ------------------
  |  Branch (3168:3): [True: 0, False: 19.6k]
  ------------------
 3169|      0|				psf->bytewidth = 8 ;
 3170|      0|				break ;
 3171|  19.6k|		} ;
 3172|       |
 3173|       |	/* Call the initialisation function for the relevant file type. */
 3174|  19.6k|	switch (SF_CONTAINER (psf->sf.format))
  ------------------
  |  |  101|  19.6k|#define SF_CONTAINER(x)		((x) & SF_FORMAT_TYPEMASK)
  ------------------
 3175|  19.6k|	{	case	SF_FORMAT_WAV :
  ------------------
  |  Branch (3175:4): [True: 4.84k, False: 14.7k]
  ------------------
 3176|  4.84k|		case	SF_FORMAT_WAVEX :
  ------------------
  |  Branch (3176:3): [True: 0, False: 19.6k]
  ------------------
 3177|  4.84k|				error = wav_open (psf) ;
 3178|  4.84k|				break ;
 3179|       |
 3180|  3.07k|		case	SF_FORMAT_AIFF :
  ------------------
  |  Branch (3180:3): [True: 3.07k, False: 16.5k]
  ------------------
 3181|  3.07k|				error = aiff_open (psf) ;
 3182|  3.07k|				break ;
 3183|       |
 3184|  1.46k|		case	SF_FORMAT_AU :
  ------------------
  |  Branch (3184:3): [True: 1.46k, False: 18.1k]
  ------------------
 3185|  1.46k|				error = au_open (psf) ;
 3186|  1.46k|				break ;
 3187|       |
 3188|      0|		case	SF_FORMAT_RAW :
  ------------------
  |  Branch (3188:3): [True: 0, False: 19.6k]
  ------------------
 3189|      0|				error = raw_open (psf) ;
 3190|      0|				break ;
 3191|       |
 3192|    690|		case	SF_FORMAT_W64 :
  ------------------
  |  Branch (3192:3): [True: 690, False: 18.9k]
  ------------------
 3193|    690|				error = w64_open (psf) ;
 3194|    690|				break ;
 3195|       |
 3196|  2.03k|		case	SF_FORMAT_RF64 :
  ------------------
  |  Branch (3196:3): [True: 2.03k, False: 17.6k]
  ------------------
 3197|  2.03k|				error = rf64_open (psf) ;
 3198|  2.03k|				break ;
 3199|       |
 3200|       |		/* Lite remove start */
 3201|    137|		case	SF_FORMAT_PAF :
  ------------------
  |  Branch (3201:3): [True: 137, False: 19.5k]
  ------------------
 3202|    137|				error = paf_open (psf) ;
 3203|    137|				break ;
 3204|       |
 3205|    507|		case	SF_FORMAT_SVX :
  ------------------
  |  Branch (3205:3): [True: 507, False: 19.1k]
  ------------------
 3206|    507|				error = svx_open (psf) ;
 3207|    507|				break ;
 3208|       |
 3209|    125|		case	SF_FORMAT_NIST :
  ------------------
  |  Branch (3209:3): [True: 125, False: 19.5k]
  ------------------
 3210|    125|				error = nist_open (psf) ;
 3211|    125|				break ;
 3212|       |
 3213|    362|		case	SF_FORMAT_IRCAM :
  ------------------
  |  Branch (3213:3): [True: 362, False: 19.2k]
  ------------------
 3214|    362|				error = ircam_open (psf) ;
 3215|    362|				break ;
 3216|       |
 3217|    267|		case	SF_FORMAT_VOC :
  ------------------
  |  Branch (3217:3): [True: 267, False: 19.3k]
  ------------------
 3218|    267|				error = voc_open (psf) ;
 3219|    267|				break ;
 3220|       |
 3221|    334|		case	SF_FORMAT_SDS :
  ------------------
  |  Branch (3221:3): [True: 334, False: 19.3k]
  ------------------
 3222|    334|				error = sds_open (psf) ;
 3223|    334|				break ;
 3224|       |
 3225|      1|		case	SF_FORMAT_OGG :
  ------------------
  |  Branch (3225:3): [True: 1, False: 19.6k]
  ------------------
 3226|      1|				error = ogg_open (psf) ;
 3227|      1|				break ;
 3228|       |
 3229|      2|		case	SF_FORMAT_TXW :
  ------------------
  |  Branch (3229:3): [True: 2, False: 19.6k]
  ------------------
 3230|      2|				error = txw_open (psf) ;
 3231|      2|				break ;
 3232|       |
 3233|    111|		case	SF_FORMAT_WVE :
  ------------------
  |  Branch (3233:3): [True: 111, False: 19.5k]
  ------------------
 3234|    111|				error = wve_open (psf) ;
 3235|    111|				break ;
 3236|       |
 3237|      1|		case	SF_FORMAT_DWD :
  ------------------
  |  Branch (3237:3): [True: 1, False: 19.6k]
  ------------------
 3238|      1|				error = dwd_open (psf) ;
 3239|      1|				break ;
 3240|       |
 3241|    607|		case	SF_FORMAT_MAT4 :
  ------------------
  |  Branch (3241:3): [True: 607, False: 19.0k]
  ------------------
 3242|    607|				error = mat4_open (psf) ;
 3243|    607|				break ;
 3244|       |
 3245|    357|		case	SF_FORMAT_MAT5 :
  ------------------
  |  Branch (3245:3): [True: 357, False: 19.2k]
  ------------------
 3246|    357|				error = mat5_open (psf) ;
 3247|    357|				break ;
 3248|       |
 3249|    134|		case	SF_FORMAT_PVF :
  ------------------
  |  Branch (3249:3): [True: 134, False: 19.5k]
  ------------------
 3250|    134|				error = pvf_open (psf) ;
 3251|    134|				break ;
 3252|       |
 3253|    166|		case	SF_FORMAT_XI :
  ------------------
  |  Branch (3253:3): [True: 166, False: 19.4k]
  ------------------
 3254|    166|				error = xi_open (psf) ;
 3255|    166|				break ;
 3256|       |
 3257|     77|		case	SF_FORMAT_HTK :
  ------------------
  |  Branch (3257:3): [True: 77, False: 19.5k]
  ------------------
 3258|     77|				error = htk_open (psf) ;
 3259|     77|				break ;
 3260|       |
 3261|      0|		case	SF_FORMAT_SD2 :
  ------------------
  |  Branch (3261:3): [True: 0, False: 19.6k]
  ------------------
 3262|      0|				error = sd2_open (psf) ;
 3263|      0|				break ;
 3264|       |
 3265|      1|		case	SF_FORMAT_REX2 :
  ------------------
  |  Branch (3265:3): [True: 1, False: 19.6k]
  ------------------
 3266|      1|				error = rx2_open (psf) ;
 3267|      1|				break ;
 3268|       |
 3269|    106|		case	SF_FORMAT_AVR :
  ------------------
  |  Branch (3269:3): [True: 106, False: 19.5k]
  ------------------
 3270|    106|				error = avr_open (psf) ;
 3271|    106|				break ;
 3272|       |
 3273|      1|		case	SF_FORMAT_FLAC :
  ------------------
  |  Branch (3273:3): [True: 1, False: 19.6k]
  ------------------
 3274|      1|				error = flac_open (psf) ;
 3275|      1|				break ;
 3276|       |
 3277|  2.34k|		case	SF_FORMAT_CAF :
  ------------------
  |  Branch (3277:3): [True: 2.34k, False: 17.2k]
  ------------------
 3278|  2.34k|				error = caf_open (psf) ;
 3279|  2.34k|				break ;
 3280|       |
 3281|     16|		case	SF_FORMAT_MPC2K :
  ------------------
  |  Branch (3281:3): [True: 16, False: 19.6k]
  ------------------
 3282|     16|				error = mpc2k_open (psf) ;
 3283|     16|				break ;
 3284|       |
 3285|     14|		case	SF_FORMAT_MPEG :
  ------------------
  |  Branch (3285:3): [True: 14, False: 19.6k]
  ------------------
 3286|     14|				error = mpeg_open (psf) ;
 3287|     14|				break ;
 3288|       |
 3289|       |		/* Lite remove end */
 3290|       |
 3291|  1.86k|		default :
  ------------------
  |  Branch (3291:3): [True: 1.86k, False: 17.7k]
  ------------------
 3292|  1.86k|				error = SF_ERR_UNRECOGNISED_FORMAT ;
 3293|  19.6k|		} ;
 3294|       |
 3295|  19.6k|	if (error)
  ------------------
  |  Branch (3295:6): [True: 14.2k, False: 5.38k]
  ------------------
 3296|  14.2k|		goto error_exit ;
 3297|       |
 3298|       |	/* For now, check whether embedding is supported. */
 3299|  5.38k|	format = SF_CONTAINER (psf->sf.format) ;
  ------------------
  |  |  101|  5.38k|#define SF_CONTAINER(x)		((x) & SF_FORMAT_TYPEMASK)
  ------------------
 3300|  5.38k|	if (psf->fileoffset > 0)
  ------------------
  |  Branch (3300:6): [True: 139, False: 5.24k]
  ------------------
 3301|    139|	{	switch (format)
 3302|    139|		{	case SF_FORMAT_WAV :
  ------------------
  |  Branch (3302:5): [True: 14, False: 125]
  ------------------
 3303|     15|			case SF_FORMAT_WAVEX :
  ------------------
  |  Branch (3303:4): [True: 1, False: 138]
  ------------------
 3304|     16|			case SF_FORMAT_AIFF :
  ------------------
  |  Branch (3304:4): [True: 1, False: 138]
  ------------------
 3305|     64|			case SF_FORMAT_AU :
  ------------------
  |  Branch (3305:4): [True: 48, False: 91]
  ------------------
 3306|       |				/* Actual embedded files. */
 3307|     64|				break ;
 3308|       |
 3309|      0|			case SF_FORMAT_MPEG :
  ------------------
  |  Branch (3309:4): [True: 0, False: 139]
  ------------------
 3310|      0|			case SF_FORMAT_FLAC :
  ------------------
  |  Branch (3310:4): [True: 0, False: 139]
  ------------------
 3311|       |				/* Flac with an ID3v2 header? */
 3312|      0|				break ;
 3313|       |
 3314|     75|			default :
  ------------------
  |  Branch (3314:4): [True: 75, False: 64]
  ------------------
 3315|     75|				error = SFE_NO_EMBED_SUPPORT ;
 3316|     75|				goto error_exit ;
 3317|    139|			} ;
 3318|  5.30k|		} ;
 3319|       |
 3320|  5.30k|	if (psf->fileoffset > 0)
  ------------------
  |  Branch (3320:6): [True: 64, False: 5.24k]
  ------------------
 3321|     64|		psf_log_printf (psf, "Embedded file length : %D\n", psf->filelength) ;
 3322|       |
 3323|  5.30k|	if (psf->file.mode == SFM_RDWR && sf_format_check (&psf->sf) == 0)
  ------------------
  |  Branch (3323:6): [True: 0, False: 5.30k]
  |  Branch (3323:36): [True: 0, False: 0]
  ------------------
 3324|      0|	{	error = SFE_BAD_MODE_RW ;
 3325|      0|		goto error_exit ;
 3326|  5.30k|		} ;
 3327|       |
 3328|  5.30k|	if (validate_sfinfo (&psf->sf) == 0)
  ------------------
  |  Branch (3328:6): [True: 1.15k, False: 4.15k]
  ------------------
 3329|  1.15k|	{	psf_log_SF_INFO (psf) ;
 3330|  1.15k|		save_header_info (psf) ;
 3331|  1.15k|		error = SFE_BAD_SF_INFO ;
 3332|  1.15k|		goto error_exit ;
 3333|  4.15k|		} ;
 3334|       |
 3335|  4.15k|	if (validate_psf (psf) == 0)
  ------------------
  |  Branch (3335:6): [True: 933, False: 3.21k]
  ------------------
 3336|    933|	{	save_header_info (psf) ;
 3337|    933|		error = SFE_INTERNAL ;
 3338|    933|		goto error_exit ;
 3339|  3.21k|		} ;
 3340|       |
 3341|  3.21k|	psf->read_current = 0 ;
 3342|  3.21k|	psf->write_current = 0 ;
 3343|  3.21k|	if (psf->file.mode == SFM_RDWR)
  ------------------
  |  Branch (3343:6): [True: 0, False: 3.21k]
  ------------------
 3344|      0|	{	psf->write_current = psf->sf.frames ;
 3345|      0|		psf->have_written = psf->sf.frames > 0 ? SF_TRUE : SF_FALSE ;
  ------------------
  |  Branch (3345:23): [True: 0, False: 0]
  ------------------
 3346|      0|		} ;
 3347|       |
 3348|  3.21k|	memcpy (sfinfo, &psf->sf, sizeof (SF_INFO)) ;
 3349|       |
 3350|  3.21k|	if (psf->file.mode == SFM_WRITE)
  ------------------
  |  Branch (3350:6): [True: 0, False: 3.21k]
  ------------------
 3351|      0|	{	/* Zero out these fields. */
 3352|      0|		sfinfo->frames = 0 ;
 3353|      0|		sfinfo->sections = 0 ;
 3354|      0|		sfinfo->seekable = 0 ;
 3355|      0|		} ;
 3356|       |
 3357|  3.21k|	return (SNDFILE *) psf ;
 3358|       |
 3359|  16.4k|error_exit :
 3360|  16.4k|	sf_errno = error ;
 3361|       |
 3362|  16.4k|	if (error == SFE_SYSTEM)
  ------------------
  |  Branch (3362:6): [True: 0, False: 16.4k]
  ------------------
 3363|      0|		snprintf (sf_syserr, sizeof (sf_syserr), "%s", psf->syserr) ;
 3364|  16.4k|	snprintf (sf_parselog, sizeof (sf_parselog), "%s", psf->parselog.buf) ;
 3365|       |
 3366|  16.4k|	switch (error)
 3367|  16.4k|	{	case SF_ERR_SYSTEM :
  ------------------
  |  Branch (3367:4): [True: 0, False: 16.4k]
  ------------------
 3368|    277|		case SF_ERR_UNSUPPORTED_ENCODING :
  ------------------
  |  Branch (3368:3): [True: 277, False: 16.1k]
  ------------------
 3369|  1.34k|		case SFE_UNIMPLEMENTED :
  ------------------
  |  Branch (3369:3): [True: 1.06k, False: 15.3k]
  ------------------
 3370|  1.34k|			break ;
 3371|       |
 3372|      0|		case SFE_RAW_BAD_FORMAT :
  ------------------
  |  Branch (3372:3): [True: 0, False: 16.4k]
  ------------------
 3373|      0|			break ;
 3374|       |
 3375|  15.0k|		default :
  ------------------
  |  Branch (3375:3): [True: 15.0k, False: 1.34k]
  ------------------
 3376|  15.0k|			if (psf->file.mode == SFM_READ)
  ------------------
  |  Branch (3376:8): [True: 15.0k, False: 0]
  ------------------
 3377|  15.0k|			{	psf_log_printf (psf, "Parse error : %s\n", sf_error_number (error)) ;
 3378|  15.0k|				error = SF_ERR_MALFORMED_FILE ;
 3379|  15.0k|				} ;
 3380|  16.4k|		} ;
 3381|       |
 3382|  16.4k|	psf_close (psf) ;
 3383|       |	return NULL ;
 3384|  16.4k|} /* psf_open_file */
sndfile.c:psf_close:
 2971|  19.6k|{	uint32_t k ;
 2972|  19.6k|	int	error = 0 ;
 2973|       |
 2974|  19.6k|	if (psf->codec_close)
  ------------------
  |  Branch (2974:6): [True: 3.02k, False: 16.6k]
  ------------------
 2975|  3.02k|	{	error = psf->codec_close (psf) ;
 2976|       |		/* To prevent it being called in psf->container_close(). */
 2977|  3.02k|		psf->codec_close = NULL ;
 2978|  3.02k|		} ;
 2979|       |
 2980|  19.6k|	if (psf->container_close)
  ------------------
  |  Branch (2980:6): [True: 8.29k, False: 11.3k]
  ------------------
 2981|  8.29k|		error = psf->container_close (psf) ;
 2982|       |
 2983|  19.6k|	error = psf_fclose (psf) ;
 2984|  19.6k|	psf_close_rsrc (psf) ;
 2985|       |
 2986|       |	/* For an ISO C compliant implementation it is ok to free a NULL pointer. */
 2987|  19.6k|	free (psf->header.ptr) ;
 2988|  19.6k|	free (psf->container_data) ;
 2989|  19.6k|	free (psf->codec_data) ;
 2990|  19.6k|	free (psf->interleave) ;
 2991|  19.6k|	free (psf->dither) ;
 2992|  19.6k|	free (psf->peak_info) ;
 2993|  19.6k|	free (psf->broadcast_16k) ;
 2994|  19.6k|	free (psf->loop_info) ;
 2995|  19.6k|	free (psf->instrument) ;
 2996|  19.6k|	free (psf->cues) ;
 2997|  19.6k|	free (psf->channel_map) ;
 2998|  19.6k|	free (psf->format_desc) ;
 2999|  19.6k|	free (psf->strings.storage) ;
 3000|       |
 3001|  19.6k|	if (psf->wchunks.chunks)
  ------------------
  |  Branch (3001:6): [True: 0, False: 19.6k]
  ------------------
 3002|      0|		for (k = 0 ; k < psf->wchunks.used ; k++)
  ------------------
  |  Branch (3002:16): [True: 0, False: 0]
  ------------------
 3003|      0|			free (psf->wchunks.chunks [k].data) ;
 3004|  19.6k|	free (psf->rchunks.chunks) ;
 3005|  19.6k|	free (psf->wchunks.chunks) ;
 3006|  19.6k|	free (psf->iterator) ;
 3007|  19.6k|	free (psf->cart_16k) ;
 3008|       |
 3009|  19.6k|	free (psf) ;
 3010|       |
 3011|  19.6k|	return error ;
 3012|  19.6k|} /* psf_close */
sndfile.c:guess_file_type:
 2789|  19.6k|{	uint32_t buffer [3], format ;
 2790|       |
 2791|  21.3k|retry:
 2792|  21.3k|	if (psf_binheader_readf (psf, "b", &buffer, SIGNED_SIZEOF (buffer)) != SIGNED_SIZEOF (buffer))
  ------------------
  |  |   86|  21.3k|#define		SIGNED_SIZEOF(x)	((int) sizeof (x))
  ------------------
              	if (psf_binheader_readf (psf, "b", &buffer, SIGNED_SIZEOF (buffer)) != SIGNED_SIZEOF (buffer))
  ------------------
  |  |   86|  21.3k|#define		SIGNED_SIZEOF(x)	((int) sizeof (x))
  ------------------
  |  Branch (2792:6): [True: 47, False: 21.3k]
  ------------------
 2793|     47|	{	psf->error = SFE_BAD_FILE_READ ;
 2794|     47|		return 0 ;
 2795|  21.3k|		} ;
 2796|       |
 2797|  21.3k|	if ((buffer [0] == MAKE_MARKER ('R', 'I', 'F', 'F') || buffer [0] == MAKE_MARKER ('R', 'I', 'F', 'X'))
  ------------------
  |  |  122|  42.6k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
              	if ((buffer [0] == MAKE_MARKER ('R', 'I', 'F', 'F') || buffer [0] == MAKE_MARKER ('R', 'I', 'F', 'X'))
  ------------------
  |  |  122|  16.6k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
  |  Branch (2797:7): [True: 4.68k, False: 16.6k]
  |  Branch (2797:57): [True: 215, False: 16.4k]
  ------------------
 2798|  4.89k|			&& buffer [2] == MAKE_MARKER ('W', 'A', 'V', 'E'))
  ------------------
  |  |  122|  4.89k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
  |  Branch (2798:7): [True: 4.84k, False: 53]
  ------------------
 2799|  4.84k|		return SF_FORMAT_WAV ;
 2800|       |
 2801|  16.4k|	if (buffer [0] == MAKE_MARKER ('F', 'O', 'R', 'M'))
  ------------------
  |  |  122|  16.4k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
  |  Branch (2801:6): [True: 3.71k, False: 12.7k]
  ------------------
 2802|  3.71k|	{	if (buffer [2] == MAKE_MARKER ('A', 'I', 'F', 'F') || buffer [2] == MAKE_MARKER ('A', 'I', 'F', 'C'))
  ------------------
  |  |  122|  7.42k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
              	{	if (buffer [2] == MAKE_MARKER ('A', 'I', 'F', 'F') || buffer [2] == MAKE_MARKER ('A', 'I', 'F', 'C'))
  ------------------
  |  |  122|  2.98k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
  |  Branch (2802:8): [True: 727, False: 2.98k]
  |  Branch (2802:58): [True: 2.34k, False: 644]
  ------------------
 2803|  3.07k|			return SF_FORMAT_AIFF ;
 2804|    644|		if (buffer [2] == MAKE_MARKER ('8', 'S', 'V', 'X') || buffer [2] == MAKE_MARKER ('1', '6', 'S', 'V'))
  ------------------
  |  |  122|  1.28k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
              		if (buffer [2] == MAKE_MARKER ('8', 'S', 'V', 'X') || buffer [2] == MAKE_MARKER ('1', '6', 'S', 'V'))
  ------------------
  |  |  122|    549|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
  |  Branch (2804:7): [True: 95, False: 549]
  |  Branch (2804:57): [True: 412, False: 137]
  ------------------
 2805|    507|			return SF_FORMAT_SVX ;
 2806|    137|		return 0 ;
 2807|  12.7k|		} ;
 2808|       |
 2809|  12.7k|	if (buffer [0] == MAKE_MARKER ('.', 's', 'n', 'd') || buffer [0] == MAKE_MARKER ('d', 'n', 's', '.'))
  ------------------
  |  |  122|  25.5k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
              	if (buffer [0] == MAKE_MARKER ('.', 's', 'n', 'd') || buffer [0] == MAKE_MARKER ('d', 'n', 's', '.'))
  ------------------
  |  |  122|  12.0k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
  |  Branch (2809:6): [True: 732, False: 12.0k]
  |  Branch (2809:56): [True: 728, False: 11.3k]
  ------------------
 2810|  1.46k|		return SF_FORMAT_AU ;
 2811|       |
 2812|  11.3k|	if ((buffer [0] == MAKE_MARKER ('f', 'a', 'p', ' ') || buffer [0] == MAKE_MARKER (' ', 'p', 'a', 'f')))
  ------------------
  |  |  122|  22.6k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
              	if ((buffer [0] == MAKE_MARKER ('f', 'a', 'p', ' ') || buffer [0] == MAKE_MARKER (' ', 'p', 'a', 'f')))
  ------------------
  |  |  122|  11.3k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
  |  Branch (2812:7): [True: 16, False: 11.3k]
  |  Branch (2812:57): [True: 121, False: 11.1k]
  ------------------
 2813|    137|		return SF_FORMAT_PAF ;
 2814|       |
 2815|  11.1k|	if (buffer [0] == MAKE_MARKER ('N', 'I', 'S', 'T'))
  ------------------
  |  |  122|  11.1k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
  |  Branch (2815:6): [True: 125, False: 11.0k]
  ------------------
 2816|    125|		return SF_FORMAT_NIST ;
 2817|       |
 2818|  11.0k|	if (buffer [0] == MAKE_MARKER ('C', 'r', 'e', 'a') && buffer [1] == MAKE_MARKER ('t', 'i', 'v', 'e'))
  ------------------
  |  |  122|  22.1k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
              	if (buffer [0] == MAKE_MARKER ('C', 'r', 'e', 'a') && buffer [1] == MAKE_MARKER ('t', 'i', 'v', 'e'))
  ------------------
  |  |  122|    317|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
  |  Branch (2818:6): [True: 317, False: 10.7k]
  |  Branch (2818:56): [True: 267, False: 50]
  ------------------
 2819|    267|		return SF_FORMAT_VOC ;
 2820|       |
 2821|  10.7k|	if ((buffer [0] & MAKE_MARKER (0xFF, 0xFF, 0xF8, 0xFF)) == MAKE_MARKER (0x64, 0xA3, 0x00, 0x00) ||
  ------------------
  |  |  122|  10.7k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
              	if ((buffer [0] & MAKE_MARKER (0xFF, 0xFF, 0xF8, 0xFF)) == MAKE_MARKER (0x64, 0xA3, 0x00, 0x00) ||
  ------------------
  |  |  122|  21.5k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
  |  Branch (2821:6): [True: 279, False: 10.5k]
  ------------------
 2822|  10.5k|		(buffer [0] & MAKE_MARKER (0xFF, 0xF8, 0xFF, 0xFF)) == MAKE_MARKER (0x00, 0x00, 0xA3, 0x64))
  ------------------
  |  |  122|  10.5k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
              		(buffer [0] & MAKE_MARKER (0xFF, 0xF8, 0xFF, 0xFF)) == MAKE_MARKER (0x00, 0x00, 0xA3, 0x64))
  ------------------
  |  |  122|  10.5k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
  |  Branch (2822:3): [True: 83, False: 10.4k]
  ------------------
 2823|    362|		return SF_FORMAT_IRCAM ;
 2824|       |
 2825|  10.4k|	if (buffer [0] == MAKE_MARKER ('r', 'i', 'f', 'f'))
  ------------------
  |  |  122|  10.4k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
  |  Branch (2825:6): [True: 690, False: 9.74k]
  ------------------
 2826|    690|		return SF_FORMAT_W64 ;
 2827|       |
 2828|  9.74k|	if (buffer [0] == MAKE_MARKER (0, 0, 0x03, 0xE8) && buffer [1] == MAKE_MARKER (0, 0, 0, 1) &&
  ------------------
  |  |  122|  19.4k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
              	if (buffer [0] == MAKE_MARKER (0, 0, 0x03, 0xE8) && buffer [1] == MAKE_MARKER (0, 0, 0, 1) &&
  ------------------
  |  |  122|  9.88k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
  |  Branch (2828:6): [True: 142, False: 9.60k]
  |  Branch (2828:54): [True: 92, False: 50]
  ------------------
 2829|     92|								buffer [2] == MAKE_MARKER (0, 0, 0, 1))
  ------------------
  |  |  122|     92|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
  |  Branch (2829:9): [True: 54, False: 38]
  ------------------
 2830|     54|		return SF_FORMAT_MAT4 ;
 2831|       |
 2832|  9.69k|	if (buffer [0] == MAKE_MARKER (0, 0, 0, 0) && buffer [1] == MAKE_MARKER (1, 0, 0, 0) &&
  ------------------
  |  |  122|  19.3k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
              	if (buffer [0] == MAKE_MARKER (0, 0, 0, 0) && buffer [1] == MAKE_MARKER (1, 0, 0, 0) &&
  ------------------
  |  |  122|  10.3k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
  |  Branch (2832:6): [True: 685, False: 9.00k]
  |  Branch (2832:48): [True: 597, False: 88]
  ------------------
 2833|    597|								buffer [2] == MAKE_MARKER (1, 0, 0, 0))
  ------------------
  |  |  122|    597|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
  |  Branch (2833:9): [True: 553, False: 44]
  ------------------
 2834|    553|		return SF_FORMAT_MAT4 ;
 2835|       |
 2836|  9.13k|	if (buffer [0] == MAKE_MARKER ('M', 'A', 'T', 'L') && buffer [1] == MAKE_MARKER ('A', 'B', ' ', '5'))
  ------------------
  |  |  122|  18.2k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
              	if (buffer [0] == MAKE_MARKER ('M', 'A', 'T', 'L') && buffer [1] == MAKE_MARKER ('A', 'B', ' ', '5'))
  ------------------
  |  |  122|    391|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
  |  Branch (2836:6): [True: 391, False: 8.74k]
  |  Branch (2836:56): [True: 357, False: 34]
  ------------------
 2837|    357|		return SF_FORMAT_MAT5 ;
 2838|       |
 2839|  8.78k|	if (buffer [0] == MAKE_MARKER ('P', 'V', 'F', '1'))
  ------------------
  |  |  122|  8.78k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
  |  Branch (2839:6): [True: 134, False: 8.64k]
  ------------------
 2840|    134|		return SF_FORMAT_PVF ;
 2841|       |
 2842|  8.64k|	if (buffer [0] == MAKE_MARKER ('E', 'x', 't', 'e') && buffer [1] == MAKE_MARKER ('n', 'd', 'e', 'd') &&
  ------------------
  |  |  122|  17.2k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
              	if (buffer [0] == MAKE_MARKER ('E', 'x', 't', 'e') && buffer [1] == MAKE_MARKER ('n', 'd', 'e', 'd') &&
  ------------------
  |  |  122|  8.87k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
  |  Branch (2842:6): [True: 225, False: 8.42k]
  |  Branch (2842:56): [True: 179, False: 46]
  ------------------
 2843|    179|								buffer [2] == MAKE_MARKER (' ', 'I', 'n', 's'))
  ------------------
  |  |  122|    179|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
  |  Branch (2843:9): [True: 166, False: 13]
  ------------------
 2844|    166|		return SF_FORMAT_XI ;
 2845|       |
 2846|  8.48k|	if (buffer [0] == MAKE_MARKER ('c', 'a', 'f', 'f') && buffer [2] == MAKE_MARKER ('d', 'e', 's', 'c'))
  ------------------
  |  |  122|  16.9k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
              	if (buffer [0] == MAKE_MARKER ('c', 'a', 'f', 'f') && buffer [2] == MAKE_MARKER ('d', 'e', 's', 'c'))
  ------------------
  |  |  122|  2.38k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
  |  Branch (2846:6): [True: 2.38k, False: 6.09k]
  |  Branch (2846:56): [True: 2.34k, False: 43]
  ------------------
 2847|  2.34k|		return SF_FORMAT_CAF ;
 2848|       |
 2849|  6.13k|	if (buffer [0] == MAKE_MARKER ('O', 'g', 'g', 'S'))
  ------------------
  |  |  122|  6.13k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
  |  Branch (2849:6): [True: 1, False: 6.13k]
  ------------------
 2850|      1|		return SF_FORMAT_OGG ;
 2851|       |
 2852|  6.13k|	if (buffer [0] == MAKE_MARKER ('A', 'L', 'a', 'w') && buffer [1] == MAKE_MARKER ('S', 'o', 'u', 'n')
  ------------------
  |  |  122|  12.2k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
              	if (buffer [0] == MAKE_MARKER ('A', 'L', 'a', 'w') && buffer [1] == MAKE_MARKER ('S', 'o', 'u', 'n')
  ------------------
  |  |  122|  6.34k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
  |  Branch (2852:6): [True: 209, False: 5.92k]
  |  Branch (2852:56): [True: 161, False: 48]
  ------------------
 2853|    161|			&& buffer [2] == MAKE_MARKER ('d', 'F', 'i', 'l'))
  ------------------
  |  |  122|    161|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
  |  Branch (2853:7): [True: 111, False: 50]
  ------------------
 2854|    111|		return SF_FORMAT_WVE ;
 2855|       |
 2856|  6.02k|	if (buffer [0] == MAKE_MARKER ('D', 'i', 'a', 'm') && buffer [1] == MAKE_MARKER ('o', 'n', 'd', 'W')
  ------------------
  |  |  122|  12.0k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
              	if (buffer [0] == MAKE_MARKER ('D', 'i', 'a', 'm') && buffer [1] == MAKE_MARKER ('o', 'n', 'd', 'W')
  ------------------
  |  |  122|  6.08k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
  |  Branch (2856:6): [True: 58, False: 5.96k]
  |  Branch (2856:56): [True: 23, False: 35]
  ------------------
 2857|     23|			&& buffer [2] == MAKE_MARKER ('a', 'r', 'e', ' '))
  ------------------
  |  |  122|     23|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
  |  Branch (2857:7): [True: 1, False: 22]
  ------------------
 2858|      1|		return SF_FORMAT_DWD ;
 2859|       |
 2860|  6.02k|	if (buffer [0] == MAKE_MARKER ('L', 'M', '8', '9') || buffer [0] == MAKE_MARKER ('5', '3', 0, 0))
  ------------------
  |  |  122|  12.0k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
              	if (buffer [0] == MAKE_MARKER ('L', 'M', '8', '9') || buffer [0] == MAKE_MARKER ('5', '3', 0, 0))
  ------------------
  |  |  122|  6.02k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
  |  Branch (2860:6): [True: 1, False: 6.02k]
  |  Branch (2860:56): [True: 1, False: 6.01k]
  ------------------
 2861|      2|		return SF_FORMAT_TXW ;
 2862|       |
 2863|  6.01k|	if ((buffer [0] & MAKE_MARKER (0xFF, 0xFF, 0x80, 0xFF)) == MAKE_MARKER (0xF0, 0x7E, 0, 0x01))
  ------------------
  |  |  122|  6.01k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
              	if ((buffer [0] & MAKE_MARKER (0xFF, 0xFF, 0x80, 0xFF)) == MAKE_MARKER (0xF0, 0x7E, 0, 0x01))
  ------------------
  |  |  122|  6.01k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
  |  Branch (2863:6): [True: 334, False: 5.68k]
  ------------------
 2864|    334|		return SF_FORMAT_SDS ;
 2865|       |
 2866|  5.68k|	if ((buffer [0] & MAKE_MARKER (0xFF, 0xFF, 0, 0)) == MAKE_MARKER (1, 4, 0, 0))
  ------------------
  |  |  122|  5.68k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
              	if ((buffer [0] & MAKE_MARKER (0xFF, 0xFF, 0, 0)) == MAKE_MARKER (1, 4, 0, 0))
  ------------------
  |  |  122|  5.68k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
  |  Branch (2866:6): [True: 16, False: 5.66k]
  ------------------
 2867|     16|		return SF_FORMAT_MPC2K ;
 2868|       |
 2869|  5.66k|	if (buffer [0] == MAKE_MARKER ('C', 'A', 'T', ' ') && buffer [2] == MAKE_MARKER ('R', 'E', 'X', '2'))
  ------------------
  |  |  122|  11.3k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
              	if (buffer [0] == MAKE_MARKER ('C', 'A', 'T', ' ') && buffer [2] == MAKE_MARKER ('R', 'E', 'X', '2'))
  ------------------
  |  |  122|     11|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
  |  Branch (2869:6): [True: 11, False: 5.65k]
  |  Branch (2869:56): [True: 1, False: 10]
  ------------------
 2870|      1|		return SF_FORMAT_REX2 ;
 2871|       |
 2872|  5.66k|	if (buffer [0] == MAKE_MARKER (0x30, 0x26, 0xB2, 0x75) && buffer [1] == MAKE_MARKER (0x8E, 0x66, 0xCF, 0x11))
  ------------------
  |  |  122|  11.3k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
              	if (buffer [0] == MAKE_MARKER (0x30, 0x26, 0xB2, 0x75) && buffer [1] == MAKE_MARKER (0x8E, 0x66, 0xCF, 0x11))
  ------------------
  |  |  122|     34|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
  |  Branch (2872:6): [True: 34, False: 5.63k]
  |  Branch (2872:60): [True: 1, False: 33]
  ------------------
 2873|      1|		return 0 /*-SF_FORMAT_WMA-*/ ;
 2874|       |
 2875|       |	/* HMM (Hidden Markov Model) Tool Kit. */
 2876|  5.66k|	if (buffer [2] == MAKE_MARKER (0, 2, 0, 0) && 2 * ((int64_t) BE2H_32 (buffer [0])) + 12 == psf->filelength)
  ------------------
  |  |  122|  11.3k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
              	if (buffer [2] == MAKE_MARKER (0, 2, 0, 0) && 2 * ((int64_t) BE2H_32 (buffer [0])) + 12 == psf->filelength)
  ------------------
  |  |  141|    446|	#define BE2H_32(x)			ENDSWAP_32 (x)
  |  |  ------------------
  |  |  |  |   35|    446|#define	ENDSWAP_32(x)		(bswap_32 (x))
  |  |  ------------------
  ------------------
  |  Branch (2876:6): [True: 446, False: 5.22k]
  |  Branch (2876:48): [True: 77, False: 369]
  ------------------
 2877|     77|		return SF_FORMAT_HTK ;
 2878|       |
 2879|  5.59k|	if (buffer [0] == MAKE_MARKER ('f', 'L', 'a', 'C'))
  ------------------
  |  |  122|  5.59k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
  |  Branch (2879:6): [True: 1, False: 5.58k]
  ------------------
 2880|      1|		return SF_FORMAT_FLAC ;
 2881|       |
 2882|  5.58k|	if (buffer [0] == MAKE_MARKER ('2', 'B', 'I', 'T'))
  ------------------
  |  |  122|  5.58k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
  |  Branch (2882:6): [True: 106, False: 5.48k]
  ------------------
 2883|    106|		return SF_FORMAT_AVR ;
 2884|       |
 2885|  5.48k|	if (buffer [0] == MAKE_MARKER ('R', 'F', '6', '4') && buffer [2] == MAKE_MARKER ('W', 'A', 'V', 'E'))
  ------------------
  |  |  122|  10.9k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
              	if (buffer [0] == MAKE_MARKER ('R', 'F', '6', '4') && buffer [2] == MAKE_MARKER ('W', 'A', 'V', 'E'))
  ------------------
  |  |  122|  2.08k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
  |  Branch (2885:6): [True: 2.08k, False: 3.39k]
  |  Branch (2885:56): [True: 2.03k, False: 51]
  ------------------
 2886|  2.03k|		return SF_FORMAT_RF64 ;
 2887|       |
 2888|  3.44k|	if (buffer [0] == MAKE_MARKER ('I', 'D', '3', 2) || buffer [0] == MAKE_MARKER ('I', 'D', '3', 3)
  ------------------
  |  |  122|  6.89k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
              	if (buffer [0] == MAKE_MARKER ('I', 'D', '3', 2) || buffer [0] == MAKE_MARKER ('I', 'D', '3', 3)
  ------------------
  |  |  122|  6.36k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
  |  Branch (2888:6): [True: 534, False: 2.91k]
  |  Branch (2888:54): [True: 695, False: 2.21k]
  ------------------
 2889|  2.21k|			|| buffer [0] == MAKE_MARKER ('I', 'D', '3', 4))
  ------------------
  |  |  122|  2.21k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
  |  Branch (2889:7): [True: 574, False: 1.64k]
  ------------------
 2890|  1.80k|	{	psf_log_printf (psf, "Found 'ID3' marker.\n") ;
 2891|  1.80k|		if (id3_skip (psf))
  ------------------
  |  Branch (2891:7): [True: 1.75k, False: 51]
  ------------------
 2892|  1.75k|			goto retry ;
 2893|     51|		return 0 ;
 2894|  1.80k|		} ;
 2895|       |
 2896|       |	/* ID3v2 tags + MPEG */
 2897|  1.64k|	if (psf->id3_header.len > 0 && (format = identify_mpeg (buffer [0])) != 0)
  ------------------
  |  Branch (2897:6): [True: 32, False: 1.61k]
  |  Branch (2897:33): [True: 5, False: 27]
  ------------------
 2898|      5|		return format ;
 2899|       |
 2900|       |	/* Turtle Beach SMP 16-bit */
 2901|  1.64k|	if (buffer [0] == MAKE_MARKER ('S', 'O', 'U', 'N') && buffer [1] == MAKE_MARKER ('D', ' ', 'S', 'A'))
  ------------------
  |  |  122|  3.28k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
              	if (buffer [0] == MAKE_MARKER ('S', 'O', 'U', 'N') && buffer [1] == MAKE_MARKER ('D', ' ', 'S', 'A'))
  ------------------
  |  |  122|     42|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
  |  Branch (2901:6): [True: 42, False: 1.59k]
  |  Branch (2901:56): [True: 1, False: 41]
  ------------------
 2902|      1|		return 0 ;
 2903|       |
 2904|       |	/* Yamaha sampler format. */
 2905|  1.63k|	if (buffer [0] == MAKE_MARKER ('S', 'Y', '8', '0') || buffer [0] == MAKE_MARKER ('S', 'Y', '8', '5'))
  ------------------
  |  |  122|  3.27k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
              	if (buffer [0] == MAKE_MARKER ('S', 'Y', '8', '0') || buffer [0] == MAKE_MARKER ('S', 'Y', '8', '5'))
  ------------------
  |  |  122|  1.63k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
  |  Branch (2905:6): [True: 1, False: 1.63k]
  |  Branch (2905:56): [True: 1, False: 1.63k]
  ------------------
 2906|      2|		return 0 ;
 2907|       |
 2908|  1.63k|	if (buffer [0] == MAKE_MARKER ('a', 'j', 'k', 'g'))
  ------------------
  |  |  122|  1.63k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
  |  Branch (2908:6): [True: 1, False: 1.63k]
  ------------------
 2909|      1|		return 0 /*-SF_FORMAT_SHN-*/ ;
 2910|       |
 2911|       |	/* This must be (almost) the last one. */
 2912|  1.63k|	if (psf->filelength > 0 && (format = try_resource_fork (psf)) != 0)
  ------------------
  |  Branch (2912:6): [True: 1.63k, False: 0]
  |  Branch (2912:29): [True: 0, False: 1.63k]
  ------------------
 2913|      0|		return format ;
 2914|       |
 2915|       |	/* MPEG with no ID3v2 tags. Only have the MPEG sync header for
 2916|       |	 * identification and it is quite brief, and prone to false positives.
 2917|       |	 * Check for this last, even after resource forks. */
 2918|  1.63k|	if (psf->id3_header.len == 0 && (format = identify_mpeg (buffer [0])) != 0)
  ------------------
  |  Branch (2918:6): [True: 1.61k, False: 26]
  |  Branch (2918:34): [True: 9, False: 1.60k]
  ------------------
 2919|      9|		return format ;
 2920|       |
 2921|  1.62k|	return 0 ;
 2922|  1.63k|} /* guess_file_type */
sndfile.c:identify_mpeg:
 2778|  1.64k|{	if ((marker & MAKE_MARKER (0xFF, 0xE0, 0, 0)) == MAKE_MARKER (0xFF, 0xE0, 0, 0) && /* Frame sync */
  ------------------
  |  |  122|  1.64k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
              {	if ((marker & MAKE_MARKER (0xFF, 0xE0, 0, 0)) == MAKE_MARKER (0xFF, 0xE0, 0, 0) && /* Frame sync */
  ------------------
  |  |  122|  3.28k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
  |  Branch (2778:7): [True: 41, False: 1.60k]
  ------------------
 2779|     41|		(marker & MAKE_MARKER (0, 0x18, 0, 0)) != MAKE_MARKER (0, 0x08, 0, 0) && /* Valid MPEG version */
  ------------------
  |  |  122|     41|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
              		(marker & MAKE_MARKER (0, 0x18, 0, 0)) != MAKE_MARKER (0, 0x08, 0, 0) && /* Valid MPEG version */
  ------------------
  |  |  122|  1.68k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
  |  Branch (2779:3): [True: 38, False: 3]
  ------------------
 2780|     38|		(marker & MAKE_MARKER (0, 0x06, 0, 0)) != MAKE_MARKER (0, 0, 0, 0) && /* Valid layer description */
  ------------------
  |  |  122|     38|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
              		(marker & MAKE_MARKER (0, 0x06, 0, 0)) != MAKE_MARKER (0, 0, 0, 0) && /* Valid layer description */
  ------------------
  |  |  122|  1.68k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
  |  Branch (2780:3): [True: 34, False: 4]
  ------------------
 2781|     34|		(marker & MAKE_MARKER (0, 0, 0xF0, 0)) != MAKE_MARKER (0, 0, 0xF0, 0) && /* Valid bitrate */
  ------------------
  |  |  122|     34|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
              		(marker & MAKE_MARKER (0, 0, 0xF0, 0)) != MAKE_MARKER (0, 0, 0xF0, 0) && /* Valid bitrate */
  ------------------
  |  |  122|  1.67k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
  |  Branch (2781:3): [True: 23, False: 11]
  ------------------
 2782|     23|		(marker & MAKE_MARKER (0, 0, 0x0C, 0)) != MAKE_MARKER (0, 0, 0x0C, 0)) /* Valid samplerate */
  ------------------
  |  |  122|     23|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
              		(marker & MAKE_MARKER (0, 0, 0x0C, 0)) != MAKE_MARKER (0, 0, 0x0C, 0)) /* Valid samplerate */
  ------------------
  |  |  122|     23|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
  |  Branch (2782:3): [True: 14, False: 9]
  ------------------
 2783|     14|		return SF_FORMAT_MPEG ;
 2784|  1.62k|	return 0 ;
 2785|  1.64k|} /* identify_mpeg */
sndfile.c:try_resource_fork:
 2695|  1.63k|{	int old_error = psf->error ;
 2696|       |
 2697|       |	/* Set READ mode now, to see if resource fork exists. */
 2698|  1.63k|	psf->rsrc.mode = SFM_READ ;
 2699|  1.63k|	if (psf_open_rsrc (psf) != 0)
  ------------------
  |  Branch (2699:6): [True: 1.63k, False: 0]
  ------------------
 2700|  1.63k|	{	psf->error = old_error ;
 2701|  1.63k|		return 0 ;
 2702|  1.63k|		} ;
 2703|       |
 2704|       |	/* More checking here. */
 2705|      0|	psf_log_printf (psf, "Resource fork : %s\n", psf->rsrc.path) ;
 2706|       |
 2707|      0|	return SF_FORMAT_SD2 ;
 2708|  1.63k|} /* try_resource_fork */
sndfile.c:format_from_extension:
 2712|  1.86k|{	char *cptr ;
 2713|  1.86k|	char buffer [16] ;
 2714|  1.86k|	int format = 0 ;
 2715|       |
 2716|  1.86k|	if ((cptr = strrchr (psf->file.name, '.')) == NULL)
  ------------------
  |  Branch (2716:6): [True: 1.86k, False: 0]
  ------------------
 2717|  1.86k|		return 0 ;
 2718|       |
 2719|      0|	cptr ++ ;
 2720|      0|	if (strlen (cptr) > sizeof (buffer) - 1)
  ------------------
  |  Branch (2720:6): [True: 0, False: 0]
  ------------------
 2721|      0|		return 0 ;
 2722|       |
 2723|      0|	psf_strlcpy (buffer, sizeof (buffer), cptr) ;
 2724|      0|	buffer [sizeof (buffer) - 1] = 0 ;
 2725|       |
 2726|       |	/* Convert everything in the buffer to lower case. */
 2727|      0|	cptr = buffer ;
 2728|      0|	while (*cptr)
  ------------------
  |  Branch (2728:9): [True: 0, False: 0]
  ------------------
 2729|      0|	{	*cptr = tolower ((unsigned char) *cptr) ;
  ------------------
  |  Branch (2729:12): [True: 0, False: 0]
  |  Branch (2729:12): [True: 0, False: 0]
  |  Branch (2729:12): [Folded, False: 0]
  ------------------
 2730|      0|		cptr ++ ;
 2731|      0|		} ;
 2732|       |
 2733|      0|	cptr = buffer ;
 2734|       |
 2735|      0|	if (strcmp (cptr, "au") == 0)
  ------------------
  |  Branch (2735:6): [True: 0, False: 0]
  ------------------
 2736|      0|	{	psf->sf.channels = 1 ;
 2737|      0|		psf->sf.samplerate = 8000 ;
 2738|      0|		format = SF_FORMAT_RAW | SF_FORMAT_ULAW ;
 2739|      0|		}
 2740|      0|	else if (strcmp (cptr, "snd") == 0)
  ------------------
  |  Branch (2740:11): [True: 0, False: 0]
  ------------------
 2741|      0|	{	psf->sf.channels = 1 ;
 2742|      0|		psf->sf.samplerate = 8000 ;
 2743|      0|		format = SF_FORMAT_RAW | SF_FORMAT_ULAW ;
 2744|      0|		}
 2745|       |
 2746|      0|	else if (strcmp (cptr, "vox") == 0 || strcmp (cptr, "vox8") == 0)
  ------------------
  |  Branch (2746:11): [True: 0, False: 0]
  |  Branch (2746:40): [True: 0, False: 0]
  ------------------
 2747|      0|	{	psf->sf.channels = 1 ;
 2748|      0|		psf->sf.samplerate = 8000 ;
 2749|      0|		format = SF_FORMAT_RAW | SF_FORMAT_VOX_ADPCM ;
 2750|      0|		}
 2751|      0|	else if (strcmp (cptr, "vox6") == 0)
  ------------------
  |  Branch (2751:11): [True: 0, False: 0]
  ------------------
 2752|      0|	{	psf->sf.channels = 1 ;
 2753|      0|		psf->sf.samplerate = 6000 ;
 2754|      0|		format = SF_FORMAT_RAW | SF_FORMAT_VOX_ADPCM ;
 2755|      0|		}
 2756|      0|	else if (strcmp (cptr, "gsm") == 0)
  ------------------
  |  Branch (2756:11): [True: 0, False: 0]
  ------------------
 2757|      0|	{	psf->sf.channels = 1 ;
 2758|      0|		psf->sf.samplerate = 8000 ;
 2759|      0|		format = SF_FORMAT_RAW | SF_FORMAT_GSM610 ;
 2760|      0|		}
 2761|      0|	else if (strcmp (cptr, "mp3") == 0)
  ------------------
  |  Branch (2761:11): [True: 0, False: 0]
  ------------------
 2762|      0|	{	/*
 2763|       |		 * MPEG streams are quite tollerate of crap. If we couldn't identify a
 2764|       |		 * MP3 stream, but it has a .mp3 extension, let libmpg123 have a try.
 2765|       |		 */
 2766|      0|		format = SF_FORMAT_MPEG ;
 2767|      0|		}
 2768|       |
 2769|       |	/* For RAW files, make sure the dataoffset if set correctly. */
 2770|      0|	if ((SF_CONTAINER (format)) == SF_FORMAT_RAW)
  ------------------
  |  |  101|      0|#define SF_CONTAINER(x)		((x) & SF_FORMAT_TYPEMASK)
  ------------------
  |  Branch (2770:6): [True: 0, False: 0]
  ------------------
 2771|      0|		psf->dataoffset = 0 ;
 2772|       |
 2773|      0|	return format ;
 2774|      0|} /* format_from_extension */
sndfile.c:validate_sfinfo:
 2927|  5.30k|{	if (sfinfo->samplerate < 1)
  ------------------
  |  Branch (2927:7): [True: 824, False: 4.48k]
  ------------------
 2928|    824|		return 0 ;
 2929|  4.48k|	if (sfinfo->frames < 0)
  ------------------
  |  Branch (2929:6): [True: 193, False: 4.29k]
  ------------------
 2930|    193|		return 0 ;
 2931|  4.29k|	if ((sfinfo->channels < 1) || (sfinfo->channels > SF_MAX_CHANNELS))
  ------------------
  |  |   95|  4.20k|#define		SF_MAX_CHANNELS		1024
  ------------------
  |  Branch (2931:6): [True: 86, False: 4.20k]
  |  Branch (2931:32): [True: 30, False: 4.17k]
  ------------------
 2932|    116|		return 0 ;
 2933|  4.17k|	if ((SF_CONTAINER (sfinfo->format)) == 0)
  ------------------
  |  |  101|  4.17k|#define SF_CONTAINER(x)		((x) & SF_FORMAT_TYPEMASK)
  ------------------
  |  Branch (2933:6): [True: 0, False: 4.17k]
  ------------------
 2934|      0|		return 0 ;
 2935|  4.17k|	if ((SF_CODEC (sfinfo->format)) == 0)
  ------------------
  |  |  102|  4.17k|#define SF_CODEC(x)			((x) & SF_FORMAT_SUBMASK)
  ------------------
  |  Branch (2935:6): [True: 24, False: 4.15k]
  ------------------
 2936|     24|		return 0 ;
 2937|  4.15k|	if (sfinfo->sections < 1)
  ------------------
  |  Branch (2937:6): [True: 0, False: 4.15k]
  ------------------
 2938|      0|		return 0 ;
 2939|  4.15k|	return 1 ;
 2940|  4.15k|} /* validate_sfinfo */
sndfile.c:save_header_info:
 2963|  2.09k|{	snprintf (sf_parselog, sizeof (sf_parselog), "%s", psf->parselog.buf) ;
 2964|  2.09k|} /* save_header_info */
sndfile.c:validate_psf:
 2944|  4.15k|{
 2945|  4.15k|	if (psf->datalength < 0)
  ------------------
  |  Branch (2945:6): [True: 255, False: 3.89k]
  ------------------
 2946|    255|	{	psf_log_printf (psf, "Invalid SF_PRIVATE field : datalength == %D.\n", psf->datalength) ;
 2947|    255|		return 0 ;
 2948|  3.89k|		} ;
 2949|  3.89k|	if (psf->dataoffset < 0)
  ------------------
  |  Branch (2949:6): [True: 600, False: 3.29k]
  ------------------
 2950|    600|	{	psf_log_printf (psf, "Invalid SF_PRIVATE field : dataoffset == %D.\n", psf->dataoffset) ;
 2951|    600|		return 0 ;
 2952|  3.29k|		} ;
 2953|  3.29k|	if (psf->blockwidth && psf->blockwidth != psf->sf.channels * psf->bytewidth)
  ------------------
  |  Branch (2953:6): [True: 1.11k, False: 2.18k]
  |  Branch (2953:25): [True: 78, False: 1.03k]
  ------------------
 2954|     78|	{	psf_log_printf (psf, "Invalid SF_PRIVATE field : channels * bytewidth == %d.\n",
 2955|     78|								psf->sf.channels * psf->bytewidth) ;
 2956|     78|		return 0 ;
 2957|  3.21k|		} ;
 2958|  3.21k|	return 1 ;
 2959|  3.29k|} /* validate_psf */

psf_store_string:
   32|   524k|{	char	new_str [128] ;
   33|   524k|	size_t	str_len ;
   34|   524k|	int		k, str_flags ;
   35|       |
   36|   524k|	if (str == NULL)
  ------------------
  |  Branch (36:6): [True: 0, False: 524k]
  ------------------
   37|      0|		return SFE_STR_BAD_STRING ;
   38|       |
   39|   524k|	str_len = strlen (str) ;
   40|       |
   41|       |	/* A few extra checks for write mode. */
   42|   524k|	if (psf->file.mode == SFM_WRITE || psf->file.mode == SFM_RDWR)
  ------------------
  |  Branch (42:6): [True: 0, False: 524k]
  |  Branch (42:37): [True: 0, False: 524k]
  ------------------
   43|      0|	{	if ((psf->strings.flags & SF_STR_ALLOW_START) == 0)
  ------------------
  |  Branch (43:8): [True: 0, False: 0]
  ------------------
   44|      0|			return SFE_STR_NO_SUPPORT ;
   45|      0|		if (psf->have_written && (psf->strings.flags & SF_STR_ALLOW_END) == 0)
  ------------------
  |  Branch (45:7): [True: 0, False: 0]
  |  Branch (45:28): [True: 0, False: 0]
  ------------------
   46|      0|			return SFE_STR_NO_SUPPORT ;
   47|       |		/* Only allow zero length strings for software. */
   48|      0|		if (str_type != SF_STR_SOFTWARE && str_len == 0)
  ------------------
  |  Branch (48:7): [True: 0, False: 0]
  |  Branch (48:38): [True: 0, False: 0]
  ------------------
   49|      0|			return SFE_STR_BAD_STRING ;
   50|   524k|		} ;
   51|       |
   52|       |	/* Find the next free slot in table. */
   53|  17.2M|	for (k = 0 ; k < SF_MAX_STRINGS ; k++)
  ------------------
  |  |   75|  17.2M|#define SF_MAX_STRINGS			(32)
  ------------------
  |  Branch (53:15): [True: 16.7M, False: 520k]
  ------------------
   54|  16.7M|	{	/* If we find a matching entry clear it. */
   55|  16.7M|		if (psf->strings.data [k].type == str_type)
  ------------------
  |  Branch (55:7): [True: 3.63k, False: 16.7M]
  ------------------
   56|  3.63k|			psf->strings.data [k].type = -1 ;
   57|       |
   58|  16.7M|		if (psf->strings.data [k].type == 0)
  ------------------
  |  Branch (58:7): [True: 4.19k, False: 16.7M]
  ------------------
   59|  4.19k|			break ;
   60|  16.7M|		} ;
   61|       |
   62|       |	/* Determine flags */
   63|   524k|	str_flags = SF_STR_LOCATE_START ;
   64|   524k|	if (psf->file.mode == SFM_RDWR || psf->have_written)
  ------------------
  |  Branch (64:6): [True: 0, False: 524k]
  |  Branch (64:36): [True: 0, False: 524k]
  ------------------
   65|      0|	{	if ((psf->strings.flags & SF_STR_ALLOW_END) == 0)
  ------------------
  |  Branch (65:8): [True: 0, False: 0]
  ------------------
   66|      0|			return SFE_STR_NO_ADD_END ;
   67|      0|		str_flags = SF_STR_LOCATE_END ;
   68|   524k|		} ;
   69|       |
   70|       |	/* More sanity checking. */
   71|   524k|	if (k >= SF_MAX_STRINGS)
  ------------------
  |  |   75|   524k|#define SF_MAX_STRINGS			(32)
  ------------------
  |  Branch (71:6): [True: 520k, False: 4.19k]
  ------------------
   72|   520k|		return SFE_STR_MAX_COUNT ;
   73|       |
   74|  4.19k|	if (k == 0 && psf->strings.storage_used != 0)
  ------------------
  |  Branch (74:6): [True: 512, False: 3.68k]
  |  Branch (74:16): [True: 0, False: 512]
  ------------------
   75|      0|	{	psf_log_printf (psf, "SFE_STR_WEIRD : k == 0 && psf->strings.storage_used != 0\n") ;
   76|      0|		return SFE_STR_WEIRD ;
   77|  4.19k|		} ;
   78|       |
   79|  4.19k|	if (k != 0 && psf->strings.storage_used == 0)
  ------------------
  |  Branch (79:6): [True: 3.68k, False: 512]
  |  Branch (79:16): [True: 0, False: 3.68k]
  ------------------
   80|      0|	{	psf_log_printf (psf, "SFE_STR_WEIRD : k != 0 && psf->strings.storage_used == 0\n") ;
   81|      0|		return SFE_STR_WEIRD ;
   82|  4.19k|		} ;
   83|       |
   84|       |	/* Special case for the first string. */
   85|  4.19k|	if (k == 0)
  ------------------
  |  Branch (85:6): [True: 512, False: 3.68k]
  ------------------
   86|    512|		psf->strings.storage_used = 0 ;
   87|       |
   88|  4.19k|	switch (str_type)
   89|  4.19k|	{	case SF_STR_SOFTWARE :
  ------------------
  |  Branch (89:4): [True: 708, False: 3.49k]
  ------------------
   90|       |				/* In write mode, want to append libsndfile-version to string. */
   91|    708|				if (psf->file.mode == SFM_WRITE || psf->file.mode == SFM_RDWR)
  ------------------
  |  Branch (91:9): [True: 0, False: 708]
  |  Branch (91:40): [True: 0, False: 708]
  ------------------
   92|      0|				{	if (strstr (str, PACKAGE_NAME) == NULL)
  ------------------
  |  |  164|      0|#define PACKAGE_NAME "libsndfile"
  ------------------
  |  Branch (92:11): [True: 0, False: 0]
  ------------------
   93|      0|					{	/*
   94|       |						** If the supplied string does not already contain a
   95|       |						** libsndfile-X.Y.Z component, then add it.
   96|       |						*/
   97|      0|						if (strlen (str) == 0)
  ------------------
  |  Branch (97:11): [True: 0, False: 0]
  ------------------
   98|      0|							snprintf (new_str, sizeof (new_str), "%s-%s", PACKAGE_NAME, PACKAGE_VERSION) ;
  ------------------
  |  |  164|      0|#define PACKAGE_NAME "libsndfile"
  ------------------
              							snprintf (new_str, sizeof (new_str), "%s-%s", PACKAGE_NAME, PACKAGE_VERSION) ;
  ------------------
  |  |  176|      0|#define PACKAGE_VERSION "1.2.2"
  ------------------
   99|      0|						else
  100|      0|							snprintf (new_str, sizeof (new_str), "%s (%s-%s)", str, PACKAGE_NAME, PACKAGE_VERSION) ;
  ------------------
  |  |  164|      0|#define PACKAGE_NAME "libsndfile"
  ------------------
              							snprintf (new_str, sizeof (new_str), "%s (%s-%s)", str, PACKAGE_NAME, PACKAGE_VERSION) ;
  ------------------
  |  |  176|      0|#define PACKAGE_VERSION "1.2.2"
  ------------------
  101|      0|						}
  102|      0|					else
  103|      0|						snprintf (new_str, sizeof (new_str), "%s", str) ;
  104|       |
  105|      0|					str = new_str ;
  106|      0|					} ;
  107|    708|				break ;
  108|       |
  109|    516|		case SF_STR_TITLE :
  ------------------
  |  Branch (109:3): [True: 516, False: 3.68k]
  ------------------
  110|    956|		case SF_STR_COPYRIGHT :
  ------------------
  |  Branch (110:3): [True: 440, False: 3.75k]
  ------------------
  111|  1.48k|		case SF_STR_ARTIST :
  ------------------
  |  Branch (111:3): [True: 530, False: 3.66k]
  ------------------
  112|  2.07k|		case SF_STR_COMMENT :
  ------------------
  |  Branch (112:3): [True: 591, False: 3.60k]
  ------------------
  113|  2.26k|		case SF_STR_DATE :
  ------------------
  |  Branch (113:3): [True: 187, False: 4.01k]
  ------------------
  114|  2.52k|		case SF_STR_ALBUM :
  ------------------
  |  Branch (114:3): [True: 262, False: 3.93k]
  ------------------
  115|  2.64k|		case SF_STR_LICENSE :
  ------------------
  |  Branch (115:3): [True: 118, False: 4.08k]
  ------------------
  116|  3.07k|		case SF_STR_TRACKNUMBER :
  ------------------
  |  Branch (116:3): [True: 429, False: 3.76k]
  ------------------
  117|  3.49k|		case SF_STR_GENRE :
  ------------------
  |  Branch (117:3): [True: 417, False: 3.78k]
  ------------------
  118|  3.49k|				break ;
  119|       |
  120|      0|		default :
  ------------------
  |  Branch (120:3): [True: 0, False: 4.19k]
  ------------------
  121|      0|			psf_log_printf (psf, "%s : SFE_STR_BAD_TYPE\n", __func__) ;
  122|      0|			return SFE_STR_BAD_TYPE ;
  123|  4.19k|		} ;
  124|       |
  125|       |	/* Plus one to catch string terminator. */
  126|  4.19k|	str_len = strlen (str) + 1 ;
  127|       |
  128|  4.19k|	if (psf->strings.storage_used + str_len + 1 > psf->strings.storage_len)
  ------------------
  |  Branch (128:6): [True: 551, False: 3.64k]
  ------------------
  129|    551|	{	char * temp = psf->strings.storage ;
  130|    551|		size_t newlen = 2 * psf->strings.storage_len + str_len + 1 ;
  131|       |
  132|    551|		newlen = newlen < 256 ? 256 : newlen ;
  ------------------
  |  Branch (132:12): [True: 492, False: 59]
  ------------------
  133|       |
  134|    551|		char * new_storage = realloc(temp, newlen);
  135|    551|		if (new_storage == NULL)
  ------------------
  |  Branch (135:7): [True: 0, False: 551]
  ------------------
  136|      0|		{
  137|      0|			return SFE_MALLOC_FAILED ;
  138|    551|			} else {
  139|    551|			psf->strings.storage = new_storage;
  140|    551|			} ;
  141|       |
  142|    551|		psf->strings.storage_len = newlen ;
  143|  4.19k|		} ;
  144|       |
  145|  4.19k|	psf->strings.data [k].type = str_type ;
  146|  4.19k|	psf->strings.data [k].offset = psf->strings.storage_used ;
  147|  4.19k|	psf->strings.data [k].flags = str_flags ;
  148|       |
  149|  4.19k|	memcpy (psf->strings.storage + psf->strings.storage_used, str, str_len) ;
  150|  4.19k|	psf->strings.storage_used += str_len ;
  151|       |
  152|  4.19k|	psf->strings.flags |= str_flags ;
  153|       |
  154|       |#if STRINGS_DEBUG
  155|       |	printf ("storage_used         : %zd / %zd\n", psf->strings.storage_used, psf->strings.storage_len) ;
  156|       |	psf_hexdump (psf->strings.storage, psf->strings.storage_used) ;
  157|       |#endif
  158|       |
  159|  4.19k|	return 0 ;
  160|  4.19k|} /* psf_store_string */

svx_open:
   83|    507|{	int error ;
   84|       |
   85|    507|	if (psf->file.mode == SFM_READ || (psf->file.mode == SFM_RDWR && psf->filelength > 0))
  ------------------
  |  Branch (85:6): [True: 507, False: 0]
  |  Branch (85:37): [True: 0, False: 0]
  |  Branch (85:67): [True: 0, False: 0]
  ------------------
   86|    507|	{	if ((error = svx_read_header (psf)))
  ------------------
  |  Branch (86:8): [True: 479, False: 28]
  ------------------
   87|    479|			return error ;
   88|       |
   89|     28|		psf->endian = SF_ENDIAN_BIG ;			/* All SVX files are big endian. */
   90|       |
   91|     28|		psf->blockwidth = (sf_count_t) psf->sf.channels * psf->bytewidth ;
   92|     28|		if (psf->blockwidth)
  ------------------
  |  Branch (92:7): [True: 28, False: 0]
  ------------------
   93|     28|			psf->sf.frames = psf->datalength / psf->blockwidth ;
   94|       |
   95|     28|		psf_fseek (psf, psf->dataoffset, SEEK_SET) ;
   96|     28|		} ;
   97|       |
   98|     28|	if (psf->file.mode == SFM_WRITE || psf->file.mode == SFM_RDWR)
  ------------------
  |  Branch (98:6): [True: 0, False: 28]
  |  Branch (98:37): [True: 0, False: 28]
  ------------------
   99|      0|	{	if (psf->is_pipe)
  ------------------
  |  Branch (99:8): [True: 0, False: 0]
  ------------------
  100|      0|			return SFE_NO_PIPE_WRITE ;
  101|       |
  102|      0|		if ((SF_CONTAINER (psf->sf.format)) != SF_FORMAT_SVX)
  ------------------
  |  |  101|      0|#define SF_CONTAINER(x)		((x) & SF_FORMAT_TYPEMASK)
  ------------------
  |  Branch (102:7): [True: 0, False: 0]
  ------------------
  103|      0|			return	SFE_BAD_OPEN_FORMAT ;
  104|       |
  105|      0|		psf->endian = SF_ENDIAN (psf->sf.format) ;
  ------------------
  |  |  103|      0|#define SF_ENDIAN(x)		((x) & SF_FORMAT_ENDMASK)
  ------------------
  106|       |
  107|      0|		if (psf->endian == SF_ENDIAN_LITTLE || (CPU_IS_LITTLE_ENDIAN && psf->endian == SF_ENDIAN_CPU))
  ------------------
  |  |   14|      0|#define CPU_IS_LITTLE_ENDIAN 1
  |  |  ------------------
  |  |  |  Branch (14:30): [True: 0, Folded]
  |  |  ------------------
  ------------------
  |  Branch (107:7): [True: 0, False: 0]
  |  Branch (107:67): [True: 0, False: 0]
  ------------------
  108|      0|			return SFE_BAD_ENDIAN ;
  109|       |
  110|      0|		psf->endian = SF_ENDIAN_BIG ;			/* All SVX files are big endian. */
  111|       |
  112|      0|		error = svx_write_header (psf, SF_FALSE) ;
  113|      0|		if (error)
  ------------------
  |  Branch (113:7): [True: 0, False: 0]
  ------------------
  114|      0|			return error ;
  115|       |
  116|      0|		psf->write_header = svx_write_header ;
  117|     28|		} ;
  118|       |
  119|     28|	psf->container_close = svx_close ;
  120|       |
  121|     28|	if ((error = pcm_init (psf)))
  ------------------
  |  Branch (121:6): [True: 0, False: 28]
  ------------------
  122|      0|		return error ;
  123|       |
  124|     28|	return 0 ;
  125|     28|} /* svx_open */
svx.c:svx_read_header:
  132|    507|{	VHDR_CHUNK		vhdr ;
  133|    507|	uint32_t		chunk_size, marker ;
  134|    507|	int				filetype = 0, parsestage = 0, done = 0 ;
  135|    507|	int 			bytecount = 0, channels ;
  136|       |
  137|    507|	if (psf->filelength > 0xFFFFFFFFLL)
  ------------------
  |  Branch (137:6): [True: 0, False: 507]
  ------------------
  138|      0|		psf_log_printf (psf, "Warning : filelength > 0xffffffff. This is bad!!!!\n") ;
  139|       |
  140|    507|	memset (&vhdr, 0, sizeof (vhdr)) ;
  141|    507|	psf_binheader_readf (psf, "p", 0) ;
  142|       |
  143|       |	/* Set default number of channels. Modify later if necessary */
  144|    507|	psf->sf.channels = 1 ;
  145|       |
  146|    507|	psf->sf.format = SF_FORMAT_SVX ;
  147|       |
  148|  13.2M|	while (! done)
  ------------------
  |  Branch (148:9): [True: 13.2M, False: 61]
  ------------------
  149|  13.2M|	{	psf_binheader_readf (psf, "Em4", &marker, &chunk_size) ;
  150|       |
  151|  13.2M|		switch (marker)
  152|  13.2M|		{	case FORM_MARKER :
  ------------------
  |  |   35|    508|#define FORM_MARKER	(MAKE_MARKER ('F', 'O', 'R', 'M'))
  |  |  ------------------
  |  |  |  |  122|    508|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (152:5): [True: 508, False: 13.2M]
  ------------------
  153|    508|					if (parsestage)
  ------------------
  |  Branch (153:10): [True: 1, False: 507]
  ------------------
  154|      1|						return SFE_SVX_NO_FORM ;
  155|       |
  156|    507|					if (chunk_size != psf->filelength - 2 * sizeof (chunk_size))
  ------------------
  |  Branch (156:10): [True: 506, False: 1]
  ------------------
  157|    506|						psf_log_printf (psf, "FORM : %u (should be %u)\n", chunk_size, (uint32_t) psf->filelength - 2 * sizeof (chunk_size)) ;
  158|      1|					else
  159|      1|						psf_log_printf (psf, "FORM : %u\n", chunk_size) ;
  160|    507|					parsestage |= HAVE_FORM ;
  161|       |
  162|    507|					psf_binheader_readf (psf, "m", &marker) ;
  163|       |
  164|    507|					filetype = marker ;
  165|    507|					psf_log_printf (psf, " %M\n", marker) ;
  166|    507|					parsestage |= HAVE_SVX ;
  167|    507|					break ;
  168|       |
  169|  1.46M|			case VHDR_MARKER :
  ------------------
  |  |   38|  1.46M|#define VHDR_MARKER	(MAKE_MARKER ('V', 'H', 'D', 'R'))
  |  |  ------------------
  |  |  |  |  122|  1.46M|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (169:4): [True: 1.46M, False: 11.7M]
  ------------------
  170|  1.46M|					if (! (parsestage & (HAVE_FORM | HAVE_SVX)))
  ------------------
  |  Branch (170:10): [True: 0, False: 1.46M]
  ------------------
  171|      0|						return SFE_SVX_NO_FORM ;
  172|       |
  173|  1.46M|					psf_log_printf (psf, " VHDR : %d\n", chunk_size) ;
  174|       |
  175|  1.46M|					psf_binheader_readf (psf, "E4442114", &(vhdr.oneShotHiSamples), &(vhdr.repeatHiSamples),
  176|  1.46M|						&(vhdr.samplesPerHiCycle), &(vhdr.samplesPerSec), &(vhdr.octave), &(vhdr.compression),
  177|  1.46M|						&(vhdr.volume)) ;
  178|       |
  179|  1.46M|					psf_log_printf (psf, "  OneShotHiSamples  : %d\n", vhdr.oneShotHiSamples) ;
  180|  1.46M|					psf_log_printf (psf, "  RepeatHiSamples   : %d\n", vhdr.repeatHiSamples) ;
  181|  1.46M|					psf_log_printf (psf, "  samplesPerHiCycle : %d\n", vhdr.samplesPerHiCycle) ;
  182|  1.46M|					psf_log_printf (psf, "  Sample Rate       : %d\n", vhdr.samplesPerSec) ;
  183|  1.46M|					psf_log_printf (psf, "  Octave            : %d\n", vhdr.octave) ;
  184|       |
  185|  1.46M|					psf_log_printf (psf, "  Compression       : %d => ", vhdr.compression) ;
  186|       |
  187|  1.46M|					switch (vhdr.compression)
  ------------------
  |  Branch (187:14): [True: 1.46M, False: 371]
  ------------------
  188|  1.46M|					{	case 0 : psf_log_printf (psf, "None.\n") ;
  ------------------
  |  Branch (188:8): [True: 1.46M, False: 1.06k]
  ------------------
  189|  1.46M|								break ;
  190|    306|						case 1 : psf_log_printf (psf, "Fibonacci delta\n") ;
  ------------------
  |  Branch (190:7): [True: 306, False: 1.46M]
  ------------------
  191|    306|								break ;
  192|    385|						case 2 : psf_log_printf (psf, "Exponential delta\n") ;
  ------------------
  |  Branch (192:7): [True: 385, False: 1.46M]
  ------------------
  193|    385|								break ;
  194|  1.46M|						} ;
  195|       |
  196|  1.46M|					psf_log_printf (psf, "  Volume            : %d\n", vhdr.volume) ;
  197|       |
  198|  1.46M|					psf->sf.samplerate 	= vhdr.samplesPerSec ;
  199|       |
  200|  1.46M|					if (filetype == SVX8_MARKER)
  ------------------
  |  |   36|  1.46M|#define SVX8_MARKER	(MAKE_MARKER ('8', 'S', 'V', 'X'))
  |  |  ------------------
  |  |  |  |  122|  1.46M|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (200:10): [True: 1.45M, False: 8.55k]
  ------------------
  201|  1.45M|					{	psf->sf.format |= SF_FORMAT_PCM_S8 ;
  202|  1.45M|						psf->bytewidth = 1 ;
  203|  1.45M|						}
  204|  8.55k|					else if (filetype == SV16_MARKER)
  ------------------
  |  |   37|  8.55k|#define SV16_MARKER	(MAKE_MARKER ('1', '6', 'S', 'V'))
  |  |  ------------------
  |  |  |  |  122|  8.55k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (204:15): [True: 8.55k, False: 0]
  ------------------
  205|  8.55k|					{	psf->sf.format |= SF_FORMAT_PCM_16 ;
  206|  8.55k|						psf->bytewidth = 2 ;
  207|  8.55k|						} ;
  208|       |
  209|  1.46M|					parsestage |= HAVE_VHDR ;
  210|  1.46M|					break ;
  211|       |
  212|  1.46M|			case BODY_MARKER :
  ------------------
  |  |   39|  1.46M|#define BODY_MARKER	(MAKE_MARKER ('B', 'O', 'D', 'Y'))
  |  |  ------------------
  |  |  |  |  122|  1.46M|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (212:4): [True: 1.46M, False: 11.7M]
  ------------------
  213|  1.46M|					if (! (parsestage & HAVE_VHDR))
  ------------------
  |  Branch (213:10): [True: 1, False: 1.46M]
  ------------------
  214|      1|						return SFE_SVX_NO_BODY ;
  215|       |
  216|  1.46M|					psf->datalength = chunk_size ;
  217|       |
  218|  1.46M|					psf->dataoffset = psf_ftell (psf) ;
  219|  1.46M|					if (psf->dataoffset < 0)
  ------------------
  |  Branch (219:10): [True: 0, False: 1.46M]
  ------------------
  220|      0|						return SFE_SVX_NO_BODY ;
  221|       |
  222|  1.46M|					if (psf->datalength > psf->filelength - psf->dataoffset)
  ------------------
  |  Branch (222:10): [True: 4, False: 1.46M]
  ------------------
  223|      4|					{	psf_log_printf (psf, " BODY : %D (should be %D)\n", psf->datalength, psf->filelength - psf->dataoffset) ;
  224|      4|						psf->datalength = psf->filelength - psf->dataoffset ;
  225|      4|						}
  226|  1.46M|					else
  227|  1.46M|						psf_log_printf (psf, " BODY : %D\n", psf->datalength) ;
  228|       |
  229|  1.46M|					parsestage |= HAVE_BODY ;
  230|       |
  231|  1.46M|					if (! psf->sf.seekable)
  ------------------
  |  Branch (231:10): [True: 0, False: 1.46M]
  ------------------
  232|      0|						break ;
  233|       |
  234|  1.46M|					psf_fseek (psf, psf->datalength, SEEK_CUR) ;
  235|  1.46M|					break ;
  236|       |
  237|  1.45M|			case NAME_MARKER :
  ------------------
  |  |   45|  1.45M|#define NAME_MARKER	(MAKE_MARKER ('N', 'A', 'M', 'E'))
  |  |  ------------------
  |  |  |  |  122|  1.45M|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (237:4): [True: 1.45M, False: 11.7M]
  ------------------
  238|  1.45M|					if (! (parsestage & HAVE_SVX))
  ------------------
  |  Branch (238:10): [True: 0, False: 1.45M]
  ------------------
  239|      0|						return SFE_SVX_NO_FORM ;
  240|       |
  241|  1.45M|					psf_log_printf (psf, " %M : %u\n", marker, chunk_size) ;
  242|       |
  243|  1.45M|					if (strlen (psf->file.name) != chunk_size)
  ------------------
  |  Branch (243:10): [True: 520, False: 1.45M]
  ------------------
  244|    520|					{	if (chunk_size > sizeof (psf->file.name) - 1)
  ------------------
  |  Branch (244:12): [True: 16, False: 504]
  ------------------
  245|     16|							return SFE_SVX_BAD_NAME_LENGTH ;
  246|       |
  247|    504|						psf_binheader_readf (psf, "b", psf->file.name, chunk_size) ;
  248|    504|						psf->file.name [chunk_size] = 0 ;
  249|    504|						}
  250|  1.45M|					else
  251|  1.45M|						psf_binheader_readf (psf, "j", chunk_size) ;
  252|  1.45M|					break ;
  253|       |
  254|  1.45M|			case ANNO_MARKER :
  ------------------
  |  |   47|    224|#define ANNO_MARKER	(MAKE_MARKER ('A', 'N', 'N', 'O'))
  |  |  ------------------
  |  |  |  |  122|    224|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (254:4): [True: 224, False: 13.2M]
  ------------------
  255|    224|					if (! (parsestage & HAVE_SVX))
  ------------------
  |  Branch (255:10): [True: 0, False: 224]
  ------------------
  256|      0|						return SFE_SVX_NO_FORM ;
  257|       |
  258|    224|					psf_log_printf (psf, " %M : %u\n", marker, chunk_size) ;
  259|       |
  260|    224|					psf_binheader_readf (psf, "j", chunk_size) ;
  261|    224|					break ;
  262|       |
  263|  1.33k|			case CHAN_MARKER :
  ------------------
  |  |   48|  1.33k|#define CHAN_MARKER	(MAKE_MARKER ('C', 'H', 'A', 'N'))
  |  |  ------------------
  |  |  |  |  122|  1.33k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (263:4): [True: 1.33k, False: 13.2M]
  ------------------
  264|  1.33k|					if (! (parsestage & HAVE_SVX))
  ------------------
  |  Branch (264:10): [True: 0, False: 1.33k]
  ------------------
  265|      0|						return SFE_SVX_NO_FORM ;
  266|       |
  267|  1.33k|					psf_log_printf (psf, " %M : %u\n", marker, chunk_size) ;
  268|       |
  269|  1.33k|					bytecount += psf_binheader_readf (psf, "E4", &channels) ;
  270|       |
  271|  1.33k|					if (channels == 2 || channels == 4)
  ------------------
  |  Branch (271:10): [True: 216, False: 1.12k]
  |  Branch (271:27): [True: 289, False: 833]
  ------------------
  272|    505|						psf_log_printf (psf, "  Channels : %d => mono\n", channels) ;
  273|    833|					else if (channels == 6)
  ------------------
  |  Branch (273:15): [True: 270, False: 563]
  ------------------
  274|    270|					{	psf->sf.channels = 2 ;
  275|    270|						psf_log_printf (psf, "  Channels : %d => stereo\n", channels) ;
  276|    270|						}
  277|    563|					else
  278|    563|						psf_log_printf (psf, "  Channels : %d *** assuming mono\n", channels) ;
  279|       |
  280|  1.33k|					psf_binheader_readf (psf, "j", chunk_size - bytecount) ;
  281|  1.33k|					break ;
  282|       |
  283|       |
  284|  1.45M|			case AUTH_MARKER :
  ------------------
  |  |   46|  1.45M|#define AUTH_MARKER	(MAKE_MARKER ('A', 'U', 'T', 'H'))
  |  |  ------------------
  |  |  |  |  122|  1.45M|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (284:4): [True: 1.45M, False: 11.7M]
  ------------------
  285|  4.38M|			case c_MARKER :
  ------------------
  |  |   44|  4.38M|#define c_MARKER	(MAKE_MARKER ('(', 'c', ')', ' '))
  |  |  ------------------
  |  |  |  |  122|  4.38M|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (285:4): [True: 2.92M, False: 10.3M]
  ------------------
  286|  4.38M|					if (! (parsestage & HAVE_SVX))
  ------------------
  |  Branch (286:10): [True: 0, False: 4.38M]
  ------------------
  287|      0|						return SFE_SVX_NO_FORM ;
  288|       |
  289|  4.38M|					psf_log_printf (psf, " %M : %u\n", marker, chunk_size) ;
  290|       |
  291|  4.38M|					psf_binheader_readf (psf, "j", chunk_size) ;
  292|  4.38M|					break ;
  293|       |
  294|  4.45M|			default :
  ------------------
  |  Branch (294:4): [True: 4.45M, False: 8.77M]
  ------------------
  295|  4.45M|					if (chunk_size >= 0xffff0000)
  ------------------
  |  Branch (295:10): [True: 17, False: 4.45M]
  ------------------
  296|     17|					{	done = SF_TRUE ;
  297|     17|						psf_log_printf (psf, "*** Unknown chunk marker (%X) at position %D with length %u. Exiting parser.\n", marker, psf_ftell (psf) - 8, chunk_size) ;
  298|     17|						break ;
  299|  4.45M|						} ;
  300|       |
  301|  4.45M|					if (psf_isprint ((marker >> 24) & 0xFF) && psf_isprint ((marker >> 16) & 0xFF)
  ------------------
  |  Branch (301:10): [True: 4.44M, False: 14.5k]
  |  Branch (301:49): [True: 4.44M, False: 1.32k]
  ------------------
  302|  4.44M|						&& psf_isprint ((marker >> 8) & 0xFF) && psf_isprint (marker & 0xFF))
  ------------------
  |  Branch (302:10): [True: 4.44M, False: 1.48k]
  |  Branch (302:48): [True: 4.44M, False: 632]
  ------------------
  303|  4.44M|					{	psf_log_printf (psf, "%M : %u (unknown marker)\n", marker, chunk_size) ;
  304|  4.44M|						psf_binheader_readf (psf, "j", chunk_size) ;
  305|  4.44M|						break ;
  306|  4.44M|						} ;
  307|  17.9k|					if ((chunk_size = psf_ftell (psf)) & 0x03)
  ------------------
  |  Branch (307:10): [True: 17.8k, False: 117]
  ------------------
  308|  17.8k|					{	psf_log_printf (psf, "  Unknown chunk marker at position %d. Resynching.\n", chunk_size - 4) ;
  309|       |
  310|  17.8k|						chunk_size = chunk_size & 3 ;
  311|  17.8k|						psf_binheader_readf (psf, "j", 4 - chunk_size) ;
  312|  17.8k|						break ;
  313|  17.8k|						} ;
  314|    117|					psf_log_printf (psf, "*** Unknown chunk marker (%X) at position %D. Exiting parser.\n", marker, psf_ftell (psf) - 8) ;
  315|    117|					done = SF_TRUE ;
  316|  13.2M|			} ;	/* switch (marker) */
  317|       |
  318|  13.2M|		if (! psf->sf.seekable && (parsestage & HAVE_BODY))
  ------------------
  |  Branch (318:7): [True: 0, False: 13.2M]
  |  Branch (318:29): [True: 0, False: 0]
  ------------------
  319|      0|			break ;
  320|       |
  321|  13.2M|		if (psf_ftell (psf) >= psf->filelength - SIGNED_SIZEOF (chunk_size))
  ------------------
  |  |   86|  13.2M|#define		SIGNED_SIZEOF(x)	((int) sizeof (x))
  ------------------
  |  Branch (321:7): [True: 428, False: 13.2M]
  ------------------
  322|    428|			break ;
  323|  13.2M|		} ; /* while (1) */
  324|       |
  325|    489|	if (vhdr.compression)
  ------------------
  |  Branch (325:6): [True: 55, False: 434]
  ------------------
  326|     55|		return SFE_SVX_BAD_COMP ;
  327|       |
  328|    434|	if (psf->dataoffset <= 0)
  ------------------
  |  Branch (328:6): [True: 406, False: 28]
  ------------------
  329|    406|		return SFE_SVX_NO_DATA ;
  330|       |
  331|     28|	return 0 ;
  332|    434|} /* svx_read_header */
svx.c:svx_close:
  336|     28|{
  337|     28|	if (psf->file.mode == SFM_WRITE || psf->file.mode == SFM_RDWR)
  ------------------
  |  Branch (337:6): [True: 0, False: 28]
  |  Branch (337:37): [True: 0, False: 28]
  ------------------
  338|      0|		svx_write_header (psf, SF_TRUE) ;
  339|       |
  340|     28|	return 0 ;
  341|     28|} /* svx_close */

txw_open:
   41|      2|{	if (psf)
  ------------------
  |  Branch (41:7): [True: 2, False: 0]
  ------------------
   42|      2|		return SFE_UNIMPLEMENTED ;
   43|      0|	return 0 ;
   44|      2|} /* txw_open */

ulaw_init:
   39|    301|{
   40|    301|	if (psf->file.mode == SFM_READ || psf->file.mode == SFM_RDWR)
  ------------------
  |  Branch (40:6): [True: 301, False: 0]
  |  Branch (40:36): [True: 0, False: 0]
  ------------------
   41|    301|	{	psf->read_short		= ulaw_read_ulaw2s ;
   42|    301|		psf->read_int		= ulaw_read_ulaw2i ;
   43|    301|		psf->read_float		= ulaw_read_ulaw2f ;
   44|    301|		psf->read_double	= ulaw_read_ulaw2d ;
   45|    301|		} ;
   46|       |
   47|    301|	if (psf->file.mode == SFM_WRITE || psf->file.mode == SFM_RDWR)
  ------------------
  |  Branch (47:6): [True: 0, False: 301]
  |  Branch (47:37): [True: 0, False: 301]
  ------------------
   48|      0|	{	psf->write_short	= ulaw_write_s2ulaw ;
   49|      0|		psf->write_int		= ulaw_write_i2ulaw ;
   50|      0|		psf->write_float	= ulaw_write_f2ulaw ;
   51|      0|		psf->write_double	= ulaw_write_d2ulaw ;
   52|      0|		} ;
   53|       |
   54|    301|	psf->bytewidth = 1 ;
   55|    301|	psf->blockwidth = psf->sf.channels ;
   56|       |
   57|    301|	if (psf->filelength > psf->dataoffset)
  ------------------
  |  Branch (57:6): [True: 245, False: 56]
  ------------------
   58|    245|		psf->datalength = (psf->dataend) ? psf->dataend - psf->dataoffset :
  ------------------
  |  Branch (58:21): [True: 105, False: 140]
  ------------------
   59|    245|							psf->filelength - psf->dataoffset ;
   60|     56|	else
   61|     56|		psf->datalength = 0 ;
   62|       |
   63|    301|	psf->sf.frames = psf->blockwidth > 0 ? psf->datalength / psf->blockwidth : 0 ;
  ------------------
  |  Branch (63:19): [True: 292, False: 9]
  ------------------
   64|       |
   65|    301|	return 0 ;
   66|    301|} /* ulaw_init */
ulaw.c:ulaw_read_ulaw2f:
  917|   110k|{	BUF_UNION	ubuf ;
  918|   110k|	int			bufferlen, readcount ;
  919|   110k|	sf_count_t	total = 0 ;
  920|   110k|	float	normfact ;
  921|       |
  922|   110k|	normfact = (psf->norm_float == SF_TRUE) ? 1.0 / ((float) 0x8000) : 1.0 ;
  ------------------
  |  Branch (922:13): [True: 110k, False: 0]
  ------------------
  923|       |
  924|   110k|	bufferlen = ARRAY_LEN (ubuf.ucbuf) ;
  ------------------
  |  |   88|   110k|#define		ARRAY_LEN(x)	((int) (sizeof (x) / sizeof ((x) [0])))
  ------------------
  925|       |
  926|   220k|	while (len > 0)
  ------------------
  |  Branch (926:9): [True: 110k, False: 110k]
  ------------------
  927|   110k|	{	if (len < bufferlen)
  ------------------
  |  Branch (927:8): [True: 110k, False: 0]
  ------------------
  928|   110k|			bufferlen = (int) len ;
  929|   110k|		readcount = (int) psf_fread (ubuf.ucbuf, 1, bufferlen, psf) ;
  930|   110k|		ulaw2f_array (ubuf.ucbuf, readcount, ptr + total, normfact) ;
  931|   110k|		total += readcount ;
  932|   110k|		if (readcount < bufferlen)
  ------------------
  |  Branch (932:7): [True: 42, False: 110k]
  ------------------
  933|     42|			break ;
  934|   110k|		len -= readcount ;
  935|   110k|		} ;
  936|       |
  937|   110k|	return total ;
  938|   110k|} /* ulaw_read_ulaw2f */
ulaw.c:ulaw2f_array:
  808|   448k|{	for (int i = 0 ; i < count ; i++)
  ------------------
  |  Branch (808:20): [True: 337k, False: 110k]
  ------------------
  809|   337k|		ptr [i] = normfact * ulaw_decode [(int) buffer [i]] ;
  810|   110k|} /* ulaw2f_array */

voc_open:
  105|    267|{	int subformat, error = 0 ;
  106|       |
  107|    267|	if (psf->is_pipe)
  ------------------
  |  Branch (107:6): [True: 0, False: 267]
  ------------------
  108|      0|		return SFE_VOC_NO_PIPE ;
  109|       |
  110|    267|	if (psf->file.mode == SFM_READ || (psf->file.mode == SFM_RDWR && psf->filelength > 0))
  ------------------
  |  Branch (110:6): [True: 267, False: 0]
  |  Branch (110:37): [True: 0, False: 0]
  |  Branch (110:67): [True: 0, False: 0]
  ------------------
  111|    267|	{	if ((error = voc_read_header (psf)))
  ------------------
  |  Branch (111:8): [True: 182, False: 85]
  ------------------
  112|    182|			return error ;
  113|    267|		} ;
  114|       |
  115|     85|	subformat = SF_CODEC (psf->sf.format) ;
  ------------------
  |  |  102|     85|#define SF_CODEC(x)			((x) & SF_FORMAT_SUBMASK)
  ------------------
  116|       |
  117|     85|	if (psf->file.mode == SFM_WRITE || psf->file.mode == SFM_RDWR)
  ------------------
  |  Branch (117:6): [True: 0, False: 85]
  |  Branch (117:37): [True: 0, False: 85]
  ------------------
  118|      0|	{	if ((SF_CONTAINER (psf->sf.format)) != SF_FORMAT_VOC)
  ------------------
  |  |  101|      0|#define SF_CONTAINER(x)		((x) & SF_FORMAT_TYPEMASK)
  ------------------
  |  Branch (118:8): [True: 0, False: 0]
  ------------------
  119|      0|			return	SFE_BAD_OPEN_FORMAT ;
  120|       |
  121|      0|		psf->endian = SF_ENDIAN_LITTLE ;
  122|       |
  123|      0|		if ((error = voc_write_header (psf, SF_FALSE)))
  ------------------
  |  Branch (123:7): [True: 0, False: 0]
  ------------------
  124|      0|			return error ;
  125|       |
  126|      0|		psf->write_header = voc_write_header ;
  127|     85|		} ;
  128|       |
  129|     85|	psf->blockwidth = (sf_count_t) psf->bytewidth * psf->sf.channels ;
  130|       |
  131|     85|	psf->container_close = voc_close ;
  132|       |
  133|     85|	switch (subformat)
  134|     85|	{	case SF_FORMAT_PCM_U8 :
  ------------------
  |  Branch (134:4): [True: 41, False: 44]
  ------------------
  135|     44|		case SF_FORMAT_PCM_16 :
  ------------------
  |  Branch (135:3): [True: 3, False: 82]
  ------------------
  136|     44|				error = pcm_init (psf) ;
  137|     44|				break ;
  138|       |
  139|      2|		case SF_FORMAT_ALAW :
  ------------------
  |  Branch (139:3): [True: 2, False: 83]
  ------------------
  140|      2|				error = alaw_init (psf) ;
  141|      2|				break ;
  142|       |
  143|      3|		case SF_FORMAT_ULAW :
  ------------------
  |  Branch (143:3): [True: 3, False: 82]
  ------------------
  144|      3|				error = ulaw_init (psf) ;
  145|      3|				break ;
  146|       |
  147|     36|		default : return SFE_UNIMPLEMENTED ;
  ------------------
  |  Branch (147:3): [True: 36, False: 49]
  ------------------
  148|     85|		} ;
  149|       |
  150|     49|	return error ;
  151|     85|} /* voc_open */
voc.c:voc_read_header:
  158|    267|{	VOC_DATA	*pvoc ;
  159|    267|	char	creative [20] ;
  160|    267|	unsigned char block_type, rate_byte ;
  161|    267|	short	version, checksum, encoding, dataoffset ;
  162|    267|	int		offset ;
  163|       |
  164|       |	/* Set position to start of file to begin reading header. */
  165|    267|	offset = psf_binheader_readf (psf, "pb", 0, creative, SIGNED_SIZEOF (creative)) ;
  ------------------
  |  |   86|    267|#define		SIGNED_SIZEOF(x)	((int) sizeof (x))
  ------------------
  166|       |
  167|    267|	if (creative [sizeof (creative) - 1] != 0x1A)
  ------------------
  |  Branch (167:6): [True: 9, False: 258]
  ------------------
  168|      9|		return SFE_VOC_NO_CREATIVE ;
  169|       |
  170|       |	/* Terminate the string. */
  171|    258|	creative [sizeof (creative) - 1] = 0 ;
  172|       |
  173|    258|	if (strcmp ("Creative Voice File", creative))
  ------------------
  |  Branch (173:6): [True: 73, False: 185]
  ------------------
  174|     73|		return SFE_VOC_NO_CREATIVE ;
  175|       |
  176|    185|	psf_log_printf (psf, "%s\n", creative) ;
  177|       |
  178|    185|	offset += psf_binheader_readf (psf, "e222", &dataoffset, &version, &checksum) ;
  179|       |
  180|    185|	psf->dataoffset = dataoffset ;
  181|       |
  182|    185|	psf_log_printf (psf, 	"dataoffset : %d\n"
  183|    185|							"version    : 0x%X\n"
  184|    185|							"checksum   : 0x%X\n", psf->dataoffset, version, checksum) ;
  185|       |
  186|    185|	if (version != 0x010A && version != 0x0114)
  ------------------
  |  Branch (186:6): [True: 178, False: 7]
  |  Branch (186:27): [True: 14, False: 164]
  ------------------
  187|     14|		return SFE_VOC_BAD_VERSION ;
  188|       |
  189|    171|	if (! (psf->codec_data = malloc (sizeof (VOC_DATA))))
  ------------------
  |  Branch (189:6): [True: 0, False: 171]
  ------------------
  190|      0|		return SFE_MALLOC_FAILED ;
  191|       |
  192|    171|	pvoc = (VOC_DATA*) psf->codec_data ;
  193|       |
  194|    171|	memset (pvoc, 0, sizeof (VOC_DATA)) ;
  195|       |
  196|       |	/* Set the default encoding now. */
  197|    171|	psf->sf.format = SF_FORMAT_VOC ; /* Major format */
  198|    171|	encoding = SF_FORMAT_PCM_U8 ; /* Minor format */
  199|    171|	psf->endian = SF_ENDIAN_LITTLE ;
  200|       |
  201|    987|	while (1)
  ------------------
  |  Branch (201:9): [True: 987, Folded]
  ------------------
  202|    987|	{	char header [256] ;
  203|    987|		unsigned size ;
  204|    987|		short count ;
  205|       |
  206|    987|		block_type = 0 ;
  207|    987|		offset += psf_binheader_readf (psf, "1", &block_type) ;
  208|       |
  209|    987|		switch (block_type)
  210|    987|		{	case VOC_ASCII :
  ------------------
  |  Branch (210:5): [True: 619, False: 368]
  ------------------
  211|    619|					offset += psf_binheader_readf (psf, "e3", &size) ;
  212|       |
  213|    619|					psf_log_printf (psf, " ASCII : %d\n", size) ;
  214|       |
  215|    619|					if (size < sizeof (header) - 1)
  ------------------
  |  Branch (215:10): [True: 577, False: 42]
  ------------------
  216|    577|					{	offset += psf_binheader_readf (psf, "b", header, size) ;
  217|    577|						header [size] = 0 ;
  218|    577|						psf_log_printf (psf, "  text : %s\n", header) ;
  219|    577|						continue ;
  220|    577|						}
  221|       |
  222|     42|					offset += psf_binheader_readf (psf, "j", size) ;
  223|     42|					continue ;
  224|       |
  225|    197|			case VOC_REPEAT :
  ------------------
  |  Branch (225:4): [True: 197, False: 790]
  ------------------
  226|    197|					offset += psf_binheader_readf (psf, "e32", &size, &count) ;
  227|    197|					psf_log_printf (psf, " Repeat : %d\n", count) ;
  228|    197|					continue ;
  229|       |
  230|      9|			case VOC_SOUND_DATA :
  ------------------
  |  Branch (230:4): [True: 9, False: 978]
  ------------------
  231|     21|			case VOC_EXTENDED :
  ------------------
  |  Branch (231:4): [True: 12, False: 975]
  ------------------
  232|    135|			case VOC_EXTENDED_II :
  ------------------
  |  Branch (232:4): [True: 114, False: 873]
  ------------------
  233|    135|					break ;
  234|       |
  235|     36|			default : psf_log_printf (psf, "*** Weird block marker (%d)\n", block_type) ;
  ------------------
  |  Branch (235:4): [True: 36, False: 951]
  ------------------
  236|    987|			} ;
  237|       |
  238|    171|		break ;
  239|    987|		} ;
  240|       |
  241|    171|	if (block_type == VOC_SOUND_DATA)
  ------------------
  |  Branch (241:6): [True: 9, False: 162]
  ------------------
  242|      9|	{	unsigned char compression ;
  243|      9|		int 	size ;
  244|       |
  245|      9|		offset += psf_binheader_readf (psf, "e311", &size, &rate_byte, &compression) ;
  246|       |
  247|      9|		psf->sf.samplerate = 1000000 / (256 - (rate_byte & 0xFF)) ;
  248|       |
  249|      9|		psf_log_printf (psf, " Sound Data : %d\n  sr   : %d => %dHz\n  comp : %d\n",
  250|      9|								size, rate_byte, psf->sf.samplerate, compression) ;
  251|       |
  252|      9|		if (offset + size - 1 > psf->filelength)
  ------------------
  |  Branch (252:7): [True: 1, False: 8]
  ------------------
  253|      1|		{	psf_log_printf (psf, "Seems to be a truncated file.\n") ;
  254|      1|			psf_log_printf (psf, "offset: %d    size: %d    sum: %d    filelength: %D\n", offset, size, offset + size, psf->filelength) ;
  255|      1|			return SFE_VOC_BAD_SECTIONS ;
  256|      1|			}
  257|      8|		else if (psf->filelength - offset - size > 4)
  ------------------
  |  Branch (257:12): [True: 1, False: 7]
  ------------------
  258|      1|		{	psf_log_printf (psf, "Seems to be a multi-segment file (#1).\n") ;
  259|      1|			psf_log_printf (psf, "offset: %d    size: %d    sum: %d    filelength: %D\n", offset, size, offset + size, psf->filelength) ;
  260|      1|			return SFE_VOC_BAD_SECTIONS ;
  261|      7|			} ;
  262|       |
  263|      7|		psf->dataoffset = offset ;
  264|      7|		psf->dataend	= psf->filelength - 1 ;
  265|       |
  266|      7|		psf->sf.channels = 1 ;
  267|      7|		psf->bytewidth = 1 ;
  268|       |
  269|      7|		psf->sf.format = SF_FORMAT_VOC | SF_FORMAT_PCM_U8 ;
  270|       |
  271|      7|		return 0 ;
  272|    162|		} ;
  273|       |
  274|    162|	if (block_type == VOC_EXTENDED)
  ------------------
  |  Branch (274:6): [True: 12, False: 150]
  ------------------
  275|     12|	{	unsigned char pack, stereo, compression ;
  276|     12|		unsigned short rate_short ;
  277|     12|		int		size ;
  278|       |
  279|     12|		offset += psf_binheader_readf (psf, "e3211", &size, &rate_short, &pack, &stereo) ;
  280|       |
  281|     12|		psf_log_printf (psf, " Extended : %d\n", size) ;
  282|     12|		if (size == 4)
  ------------------
  |  Branch (282:7): [True: 1, False: 11]
  ------------------
  283|      1|			psf_log_printf (psf, "  size   : 4\n") ;
  284|     11|		else
  285|     11|			psf_log_printf (psf, "  size   : %d (should be 4)\n", size) ;
  286|       |
  287|     12|		psf_log_printf (psf,	"  pack   : %d\n"
  288|     12|								"  stereo : %s\n", pack, (stereo ? "yes" : "no")) ;
  ------------------
  |  Branch (288:35): [True: 5, False: 7]
  ------------------
  289|       |
  290|     12|		if (stereo)
  ------------------
  |  Branch (290:7): [True: 5, False: 7]
  ------------------
  291|      5|		{	psf->sf.channels = 2 ;
  292|      5|			psf->sf.samplerate = 128000000 / (65536 - rate_short) ;
  293|      5|			}
  294|      7|		else
  295|      7|		{	psf->sf.channels = 1 ;
  296|      7|			psf->sf.samplerate = 256000000 / (65536 - rate_short) ;
  297|      7|			} ;
  298|       |
  299|     12|		psf_log_printf (psf, "  sr     : %d => %dHz\n", (rate_short & 0xFFFF), psf->sf.samplerate) ;
  300|       |
  301|     12|		offset += psf_binheader_readf (psf, "1", &block_type) ;
  302|       |
  303|     12|		if (block_type != VOC_SOUND_DATA)
  ------------------
  |  Branch (303:7): [True: 5, False: 7]
  ------------------
  304|      5|		{	psf_log_printf (psf, "*** Expecting VOC_SOUND_DATA section.\n") ;
  305|      5|			return SFE_VOC_BAD_FORMAT ;
  306|      7|			} ;
  307|       |
  308|      7|		offset += psf_binheader_readf (psf, "e311", &size, &rate_byte, &compression) ;
  309|       |
  310|      7|		psf_log_printf (psf,	" Sound Data : %d\n"
  311|      7|								"  sr     : %d\n"
  312|      7|								"  comp   : %d\n", size, rate_byte, compression) ;
  313|       |
  314|       |
  315|      7|		if (offset + size - 1 > psf->filelength)
  ------------------
  |  Branch (315:7): [True: 1, False: 6]
  ------------------
  316|      1|		{	psf_log_printf (psf, "Seems to be a truncated file.\n") ;
  317|      1|			psf_log_printf (psf, "offset: %d    size: %d    sum: %d    filelength: %D\n", offset, size, offset + size, psf->filelength) ;
  318|      1|			return SFE_VOC_BAD_SECTIONS ;
  319|      1|			}
  320|      6|		else if (offset + size - 1 < psf->filelength)
  ------------------
  |  Branch (320:12): [True: 4, False: 2]
  ------------------
  321|      4|		{	psf_log_printf (psf, "Seems to be a multi-segment file (#2).\n") ;
  322|      4|			psf_log_printf (psf, "offset: %d    size: %d    sum: %d    filelength: %D\n", offset, size, offset + size, psf->filelength) ;
  323|      4|			return SFE_VOC_BAD_SECTIONS ;
  324|      4|			} ;
  325|       |
  326|      2|		psf->dataoffset = offset ;
  327|      2|		psf->dataend = psf->filelength - 1 ;
  328|       |
  329|      2|		psf->bytewidth = 1 ;
  330|       |
  331|      2|		psf->sf.format = SF_FORMAT_VOC | SF_FORMAT_PCM_U8 ;
  332|       |
  333|      2|		return 0 ;
  334|      7|		}
  335|       |
  336|    150|	if (block_type == VOC_EXTENDED_II)
  ------------------
  |  Branch (336:6): [True: 114, False: 36]
  ------------------
  337|    114|	{	unsigned char bitwidth, channels ;
  338|    114|		int size, fourbytes ;
  339|       |
  340|    114|		offset += psf_binheader_readf (psf, "e341124", &size, &psf->sf.samplerate,
  341|    114|								&bitwidth, &channels, &encoding, &fourbytes) ;
  342|       |
  343|    114|		if (size * 2 == psf->filelength - 39)
  ------------------
  |  Branch (343:7): [True: 1, False: 113]
  ------------------
  344|      1|		{	int temp_size = psf->filelength - 31 ;
  345|       |
  346|      1|			psf_log_printf (psf, " Extended II : %d (SoX bug: should be %d)\n", size, temp_size) ;
  347|      1|			size = temp_size ;
  348|      1|			}
  349|    113|		else
  350|    113|			psf_log_printf (psf, " Extended II : %d\n", size) ;
  351|       |
  352|    114|		psf_log_printf (psf,	"  sample rate : %d\n"
  353|    114|								"  bit width   : %d\n"
  354|    114|								"  channels    : %d\n", psf->sf.samplerate, bitwidth, channels) ;
  355|       |
  356|       |		/*
  357|       |		**	Unlike the other blocks, this one carries the sample rate as it
  358|       |		**	stands instead of a constant to derive it from, so it is the one
  359|       |		**	place a file can hand us a rate the header writer would divide by.
  360|       |		*/
  361|    114|		if (psf->sf.samplerate < 1)
  ------------------
  |  Branch (361:7): [True: 35, False: 79]
  ------------------
  362|     35|		{	psf_log_printf (psf, "*** Sample rate should be > 0.\n") ;
  363|     35|			return SFE_MALFORMED_FILE ;
  364|     79|			} ;
  365|       |
  366|     79|		if (bitwidth == 16 && encoding == 0)
  ------------------
  |  Branch (366:7): [True: 5, False: 74]
  |  Branch (366:25): [True: 1, False: 4]
  ------------------
  367|      1|		{	encoding = 4 ;
  368|      1|			psf_log_printf (psf, "  encoding    : 0 (SoX bug: should be 4 for 16 bit signed PCM)\n") ;
  369|      1|			}
  370|     78|		else
  371|     78|			psf_log_printf (psf, "  encoding    : %d => %s\n", encoding, voc_encoding2str (encoding)) ;
  372|       |
  373|       |
  374|     79|		psf_log_printf (psf, "  fourbytes   : %X\n", fourbytes) ;
  375|       |
  376|     79|		psf->sf.channels = channels ;
  377|       |
  378|     79|		psf->dataoffset = offset ;
  379|     79|		psf->dataend	= psf->filelength - 1 ;
  380|       |
  381|     79|		if (size + 31 == psf->filelength + 1)
  ------------------
  |  Branch (381:7): [True: 3, False: 76]
  ------------------
  382|      3|		{	/* Hack for reading files produced using
  383|       |			** sf_command (SFC_UPDATE_HEADER_NOW).
  384|       |			*/
  385|      3|			psf_log_printf (psf, "Missing zero byte at end of file.\n") ;
  386|      3|			size = psf->filelength - 30 ;
  387|      3|			psf->dataend = 0 ;
  388|      3|			}
  389|     76|		else if (size + 31 > psf->filelength)
  ------------------
  |  Branch (389:12): [True: 39, False: 37]
  ------------------
  390|     39|		{	psf_log_printf (psf, "Seems to be a truncated file.\n") ;
  391|     39|			size = psf->filelength - 31 ;
  392|     39|			}
  393|     37|		else if (size + 31 < psf->filelength)
  ------------------
  |  Branch (393:12): [True: 36, False: 1]
  ------------------
  394|     36|			psf_log_printf (psf, "Seems to be a multi-segment file (#3).\n") ;
  395|       |
  396|     79|		switch (encoding)
  397|     79|		{	case 0 :
  ------------------
  |  Branch (397:5): [True: 32, False: 47]
  ------------------
  398|     32|					psf->sf.format = SF_FORMAT_VOC | SF_FORMAT_PCM_U8 ;
  399|     32|					psf->bytewidth = 1 ;
  400|     32|					break ;
  401|       |
  402|      3|			case 4 :
  ------------------
  |  Branch (402:4): [True: 3, False: 76]
  ------------------
  403|      3|					psf->sf.format = SF_FORMAT_VOC | SF_FORMAT_PCM_16 ;
  404|      3|					psf->bytewidth = 2 ;
  405|      3|					break ;
  406|       |
  407|      2|			case 6 :
  ------------------
  |  Branch (407:4): [True: 2, False: 77]
  ------------------
  408|      2|					psf->sf.format = SF_FORMAT_VOC | SF_FORMAT_ALAW ;
  409|      2|					psf->bytewidth = 1 ;
  410|      2|					break ;
  411|       |
  412|      3|			case 7 :
  ------------------
  |  Branch (412:4): [True: 3, False: 76]
  ------------------
  413|      3|					psf->sf.format = SF_FORMAT_VOC | SF_FORMAT_ULAW ;
  414|      3|					psf->bytewidth = 1 ;
  415|      3|					break ;
  416|       |
  417|     39|			default : /* Unknown */
  ------------------
  |  Branch (417:4): [True: 39, False: 40]
  ------------------
  418|     39|					return SFE_VOC_BAD_FORMAT ;
  419|      0|					break ;
  420|     79|			} ;
  421|       |
  422|     76|		} ;
  423|       |
  424|     76|	return 0 ;
  425|    150|} /* voc_read_header */
voc.c:voc_encoding2str:
  562|     78|{
  563|     78|	switch (encoding)
  564|     78|	{	case 0 :	return "8 bit unsigned PCM" ;
  ------------------
  |  Branch (564:4): [True: 32, False: 46]
  ------------------
  565|      2|		case 4 :	return "16 bit signed PCM" ;
  ------------------
  |  Branch (565:3): [True: 2, False: 76]
  ------------------
  566|      2|		case 6 :	return "A-law" ;
  ------------------
  |  Branch (566:3): [True: 2, False: 76]
  ------------------
  567|      3|		case 7 :	return "u-law" ;
  ------------------
  |  Branch (567:3): [True: 3, False: 75]
  ------------------
  568|     39|		default :	break ;
  ------------------
  |  Branch (568:3): [True: 39, False: 39]
  ------------------
  569|     78|		}
  570|     39|	return "*** Unknown ***" ;
  571|     78|} /* voc_encoding2str */
voc.c:voc_close:
  541|     85|{
  542|     85|	if (psf->file.mode == SFM_WRITE || psf->file.mode == SFM_RDWR)
  ------------------
  |  Branch (542:6): [True: 0, False: 85]
  |  Branch (542:37): [True: 0, False: 85]
  ------------------
  543|      0|	{	/*  Now we know for certain the length of the file we can re-write
  544|       |		**	correct values for the FORM, 8SVX and BODY chunks.
  545|       |		*/
  546|      0|		unsigned char byte = VOC_TERMINATOR ;
  547|       |
  548|       |
  549|      0|		psf_fseek (psf, 0, SEEK_END) ;
  550|       |
  551|       |		/* Write terminator */
  552|      0|		psf_fwrite (&byte, 1, 1, psf) ;
  553|       |
  554|      0|		voc_write_header (psf, SF_TRUE) ;
  555|      0|		} ;
  556|       |
  557|     85|	return 0 ;
  558|     85|} /* voc_close */

w64_open:
  125|    690|{	WAVLIKE_PRIVATE * wpriv ;
  126|    690|	int	subformat, error, blockalign = 0, framesperblock = 0 ;
  127|       |
  128|    690|	if ((wpriv = calloc (1, sizeof (WAVLIKE_PRIVATE))) == NULL)
  ------------------
  |  Branch (128:6): [True: 0, False: 690]
  ------------------
  129|      0|		return SFE_MALLOC_FAILED ;
  130|    690|	psf->container_data = wpriv ;
  131|       |
  132|    690|	if (psf->file.mode == SFM_READ || (psf->file.mode == SFM_RDWR &&psf->filelength > 0))
  ------------------
  |  Branch (132:6): [True: 690, False: 0]
  |  Branch (132:37): [True: 0, False: 0]
  |  Branch (132:66): [True: 0, False: 0]
  ------------------
  133|    690|	{	if ((error = w64_read_header (psf, &blockalign, &framesperblock)))
  ------------------
  |  Branch (133:8): [True: 515, False: 175]
  ------------------
  134|    515|			return error ;
  135|    690|		} ;
  136|       |
  137|    175|	if ((SF_CONTAINER (psf->sf.format)) != SF_FORMAT_W64)
  ------------------
  |  |  101|    175|#define SF_CONTAINER(x)		((x) & SF_FORMAT_TYPEMASK)
  ------------------
  |  Branch (137:6): [True: 0, False: 175]
  ------------------
  138|      0|		return	SFE_BAD_OPEN_FORMAT ;
  139|       |
  140|    175|	subformat = SF_CODEC (psf->sf.format) ;
  ------------------
  |  |  102|    175|#define SF_CODEC(x)			((x) & SF_FORMAT_SUBMASK)
  ------------------
  141|       |
  142|    175|	if (psf->file.mode == SFM_WRITE || psf->file.mode == SFM_RDWR)
  ------------------
  |  Branch (142:6): [True: 0, False: 175]
  |  Branch (142:37): [True: 0, False: 175]
  ------------------
  143|      0|	{	if (psf->is_pipe)
  ------------------
  |  Branch (143:8): [True: 0, False: 0]
  ------------------
  144|      0|			return SFE_NO_PIPE_WRITE ;
  145|       |
  146|      0|		psf->endian = SF_ENDIAN_LITTLE ;		/* All W64 files are little endian. */
  147|       |
  148|      0|		psf->blockwidth = (sf_count_t) psf->bytewidth * psf->sf.channels ;
  149|       |
  150|      0|		if (subformat == SF_FORMAT_IMA_ADPCM || subformat == SF_FORMAT_MS_ADPCM)
  ------------------
  |  Branch (150:7): [True: 0, False: 0]
  |  Branch (150:43): [True: 0, False: 0]
  ------------------
  151|      0|		{	blockalign = wavlike_srate2blocksize ((sf_count_t) psf->sf.samplerate * psf->sf.channels) ;
  152|      0|			framesperblock = -1 ;
  153|       |
  154|       |			/*
  155|       |			** At this point we don't know the file length so set it stupidly high, but not
  156|       |			** so high that it triggers undefined behaviour when something is added to it.
  157|       |			*/
  158|      0|			psf->filelength = SF_COUNT_MAX - 10000 ;
  ------------------
  |  |  371|      0|#define SF_COUNT_MAX	INT64_MAX
  ------------------
  159|      0|			psf->datalength = psf->filelength ;
  160|      0|			if (psf->sf.frames <= 0)
  ------------------
  |  Branch (160:8): [True: 0, False: 0]
  ------------------
  161|      0|				psf->sf.frames = (psf->blockwidth) ? psf->filelength / psf->blockwidth : psf->filelength ;
  ------------------
  |  Branch (161:22): [True: 0, False: 0]
  ------------------
  162|      0|			} ;
  163|       |
  164|      0|		if ((error = w64_write_header (psf, SF_FALSE)))
  ------------------
  |  Branch (164:7): [True: 0, False: 0]
  ------------------
  165|      0|			return error ;
  166|       |
  167|      0|		psf->write_header = w64_write_header ;
  168|    175|		} ;
  169|       |
  170|    175|	psf->container_close = w64_close ;
  171|       |
  172|    175|	switch (subformat)
  173|    175|	{	case SF_FORMAT_PCM_U8 :
  ------------------
  |  Branch (173:4): [True: 20, False: 155]
  ------------------
  174|     20|					error = pcm_init (psf) ;
  175|     20|					break ;
  176|       |
  177|      3|		case SF_FORMAT_PCM_16 :
  ------------------
  |  Branch (177:3): [True: 3, False: 172]
  ------------------
  178|      4|		case SF_FORMAT_PCM_24 :
  ------------------
  |  Branch (178:3): [True: 1, False: 174]
  ------------------
  179|      7|		case SF_FORMAT_PCM_32 :
  ------------------
  |  Branch (179:3): [True: 3, False: 172]
  ------------------
  180|      7|					error = pcm_init (psf) ;
  181|      7|					break ;
  182|       |
  183|      4|		case SF_FORMAT_ULAW :
  ------------------
  |  Branch (183:3): [True: 4, False: 171]
  ------------------
  184|      4|					error = ulaw_init (psf) ;
  185|      4|					break ;
  186|       |
  187|      8|		case SF_FORMAT_ALAW :
  ------------------
  |  Branch (187:3): [True: 8, False: 167]
  ------------------
  188|      8|					error = alaw_init (psf) ;
  189|      8|					break ;
  190|       |
  191|       |		/* Lite remove start */
  192|      6|		case SF_FORMAT_FLOAT :
  ------------------
  |  Branch (192:3): [True: 6, False: 169]
  ------------------
  193|      6|					error = float32_init (psf) ;
  194|      6|					break ;
  195|       |
  196|      3|		case SF_FORMAT_DOUBLE :
  ------------------
  |  Branch (196:3): [True: 3, False: 172]
  ------------------
  197|      3|					error = double64_init (psf) ;
  198|      3|					break ;
  199|       |
  200|      1|		case SF_FORMAT_IMA_ADPCM :
  ------------------
  |  Branch (200:3): [True: 1, False: 174]
  ------------------
  201|      1|					error = wavlike_ima_init (psf, blockalign, framesperblock) ;
  202|      1|					break ;
  203|       |
  204|     13|		case SF_FORMAT_MS_ADPCM :
  ------------------
  |  Branch (204:3): [True: 13, False: 162]
  ------------------
  205|     13|					error = wavlike_msadpcm_init (psf, blockalign, framesperblock) ;
  206|     13|					break ;
  207|       |		/* Lite remove end */
  208|       |
  209|     49|		case SF_FORMAT_GSM610 :
  ------------------
  |  Branch (209:3): [True: 49, False: 126]
  ------------------
  210|     49|					error = gsm610_init (psf) ;
  211|     49|					break ;
  212|       |
  213|     64|		default : 	return SFE_UNIMPLEMENTED ;
  ------------------
  |  Branch (213:3): [True: 64, False: 111]
  ------------------
  214|    175|		} ;
  215|       |
  216|    111|	return error ;
  217|    175|} /* w64_open */
w64.c:w64_read_header:
  225|    690|{	WAVLIKE_PRIVATE *wpriv ;
  226|    690|	WAV_FMT 	*wav_fmt ;
  227|    690|	int			dword = 0, marker, format = 0 ;
  228|    690|	sf_count_t	chunk_size, bytesread = 0 ;
  229|    690|	int			parsestage = 0, error, done = 0 ;
  230|       |
  231|    690|	if ((wpriv = psf->container_data) == NULL)
  ------------------
  |  Branch (231:6): [True: 0, False: 690]
  ------------------
  232|      0|		return SFE_INTERNAL ;
  233|    690|	wav_fmt = &wpriv->wav_fmt ;
  234|       |
  235|       |	/* Set position to start of file to begin reading header. */
  236|    690|	psf_binheader_readf (psf, "p", 0) ;
  237|       |
  238|   100k|	while (! done)
  ------------------
  |  Branch (238:9): [True: 100k, False: 0]
  ------------------
  239|   100k|	{	/* Each new chunk must start on an 8 byte boundary, so jump if needed. */
  240|   100k|		if (psf->header.indx & 0x7)
  ------------------
  |  Branch (240:7): [True: 2.47k, False: 97.7k]
  ------------------
  241|  2.47k|			psf_binheader_readf (psf, "j", 8 - (psf->header.indx & 0x7)) ;
  242|       |
  243|       |		/* Generate hash of 16 byte marker. */
  244|   100k|		marker = 0 ;
  245|   100k|		chunk_size = 0 ;
  246|       |
  247|   100k|		bytesread = psf_binheader_readf (psf, "eh8", &marker, &chunk_size) ;
  248|   100k|		if (bytesread == 0)
  ------------------
  |  Branch (248:7): [True: 35, False: 100k]
  ------------------
  249|     35|			break ;
  250|   100k|		switch (marker)
  251|   100k|		{	case riff_HASH16 :
  ------------------
  |  |   50|    303|#define	riff_HASH16 MAKE_HASH16 ('r', 'i', 'f', 'f', 0x2E, 0x91, 0xCF, 0x11, \
  |  |  ------------------
  |  |  |  |   41|    303|			(	(x0)			^ ((x1) << 1)	^ ((x2) << 2)	^ ((x3) << 3) ^	\
  |  |  |  |   42|    303|				((x4) << 4) 	^ ((x5) << 5)	^ ((x6) << 6)	^ ((x7) << 7) ^	\
  |  |  |  |   43|    303|				((x8) << 8) 	^ ((x9) << 9)	^ ((xa) << 10)	^ ((xb) << 11) ^ \
  |  |  |  |   44|    303|				((xc) << 12) 	^ ((xd) << 13)	^ ((xe) << 14)	^ ((xf) << 15)	)
  |  |  ------------------
  |  |   51|    303|								0xA5, 0xD6, 0x28, 0xDB, 0x04, 0xC1, 0x00, 0x00)
  ------------------
  |  Branch (251:5): [True: 303, False: 99.9k]
  ------------------
  252|    303|					if (parsestage)
  ------------------
  |  Branch (252:10): [True: 5, False: 298]
  ------------------
  253|      5|						return SFE_W64_NO_RIFF ;
  254|       |
  255|    298|					if (psf->filelength != chunk_size)
  ------------------
  |  Branch (255:10): [True: 297, False: 1]
  ------------------
  256|    297|						psf_log_printf (psf, "riff : %D (should be %D)\n", chunk_size, psf->filelength) ;
  257|      1|					else
  258|      1|						psf_log_printf (psf, "riff : %D\n", chunk_size) ;
  259|       |
  260|    298|					parsestage |= HAVE_riff ;
  261|       |
  262|    298|					bytesread += psf_binheader_readf (psf, "h", &marker) ;
  263|    298|					if (marker == wave_HASH16)
  ------------------
  |  |   53|    298|#define	wave_HASH16 	MAKE_HASH16 ('w', 'a', 'v', 'e', 0xF3, 0xAC, 0xD3, 0x11, \
  |  |  ------------------
  |  |  |  |   41|    298|			(	(x0)			^ ((x1) << 1)	^ ((x2) << 2)	^ ((x3) << 3) ^	\
  |  |  |  |   42|    298|				((x4) << 4) 	^ ((x5) << 5)	^ ((x6) << 6)	^ ((x7) << 7) ^	\
  |  |  |  |   43|    298|				((x8) << 8) 	^ ((x9) << 9)	^ ((xa) << 10)	^ ((xb) << 11) ^ \
  |  |  |  |   44|    298|				((xc) << 12) 	^ ((xd) << 13)	^ ((xe) << 14)	^ ((xf) << 15)	)
  |  |  ------------------
  ------------------
  |  Branch (263:10): [True: 204, False: 94]
  ------------------
  264|    204|					{ 	if ((parsestage & HAVE_riff) != HAVE_riff)
  ------------------
  |  Branch (264:13): [True: 0, False: 204]
  ------------------
  265|      0|							return SFE_W64_NO_WAVE ;
  266|    204|						psf_log_printf (psf, "wave\n") ;
  267|    204|						parsestage |= HAVE_wave ;
  268|    298|					} ;
  269|    298|					chunk_size = 0 ;
  270|    298|					break ;
  271|       |
  272|      1|			case ACID_HASH16:
  ------------------
  |  |   65|      1|#define	ACID_HASH16 	MAKE_HASH16 (0x6D, 0x07, 0x1C, 0xEA, 0xA3, 0xEF, 0x78, 0x4C, \
  |  |  ------------------
  |  |  |  |   41|      1|			(	(x0)			^ ((x1) << 1)	^ ((x2) << 2)	^ ((x3) << 3) ^	\
  |  |  |  |   42|      1|				((x4) << 4) 	^ ((x5) << 5)	^ ((x6) << 6)	^ ((x7) << 7) ^	\
  |  |  |  |   43|      1|				((x8) << 8) 	^ ((x9) << 9)	^ ((xa) << 10)	^ ((xb) << 11) ^ \
  |  |  |  |   44|      1|				((xc) << 12) 	^ ((xd) << 13)	^ ((xe) << 14)	^ ((xf) << 15)	)
  |  |  ------------------
  |  |   66|      1|								0x90, 0x57, 0x7F, 0x79, 0xEE, 0x25, 0x2A, 0xAE)
  ------------------
  |  Branch (272:4): [True: 1, False: 100k]
  ------------------
  273|      1|					psf_log_printf (psf, "Looks like an ACID file. Exiting.\n") ;
  274|      1|					return SFE_UNIMPLEMENTED ;
  275|       |
  276|  1.82k|			case fmt_HASH16 :
  ------------------
  |  |   56|  1.82k|#define	fmt_HASH16 		MAKE_HASH16 ('f', 'm', 't', ' ', 0xF3, 0xAC, 0xD3, 0x11, \
  |  |  ------------------
  |  |  |  |   41|  1.82k|			(	(x0)			^ ((x1) << 1)	^ ((x2) << 2)	^ ((x3) << 3) ^	\
  |  |  |  |   42|  1.82k|				((x4) << 4) 	^ ((x5) << 5)	^ ((x6) << 6)	^ ((x7) << 7) ^	\
  |  |  |  |   43|  1.82k|				((x8) << 8) 	^ ((x9) << 9)	^ ((xa) << 10)	^ ((xb) << 11) ^ \
  |  |  |  |   44|  1.82k|				((xc) << 12) 	^ ((xd) << 13)	^ ((xe) << 14)	^ ((xf) << 15)	)
  |  |  ------------------
  |  |   57|  1.82k|								0x8C, 0xD1, 0x00, 0xC0, 0x4F, 0x8E, 0xDB, 0x8A)
  ------------------
  |  Branch (276:4): [True: 1.82k, False: 98.4k]
  ------------------
  277|  1.82k|					if ((parsestage & (HAVE_riff | HAVE_wave)) != (HAVE_riff | HAVE_wave))
  ------------------
  |  Branch (277:10): [True: 1, False: 1.82k]
  ------------------
  278|      1|						return SFE_WAV_NO_FMT ;
  279|       |
  280|  1.82k|					if (parsestage & HAVE_fmt)
  ------------------
  |  Branch (280:10): [True: 1.62k, False: 202]
  ------------------
  281|  1.62k|					{	psf_log_printf (psf, "*** Second 'fmt ' chunk?\n") ;
  282|  1.62k|						break ;
  283|  1.62k|						} ;
  284|       |
  285|    202|					psf_log_printf (psf, " fmt : %D\n", chunk_size) ;
  286|       |
  287|       |					/* size of 16 byte marker and 8 byte chunk_size value. */
  288|    202|					chunk_size -= 24 ;
  289|       |
  290|    202|					if ((error = wavlike_read_fmt_chunk (psf, (int) chunk_size)))
  ------------------
  |  Branch (290:10): [True: 2, False: 200]
  ------------------
  291|      2|						return error ;
  292|       |
  293|    200|					if (chunk_size % 8)
  ------------------
  |  Branch (293:10): [True: 111, False: 89]
  ------------------
  294|    111|						psf_binheader_readf (psf, "j", 8 - (chunk_size % 8)) ;
  295|       |
  296|    200|					format		= wav_fmt->format ;
  297|    200|					parsestage |= HAVE_fmt ;
  298|    200|					chunk_size = 0 ;
  299|    200|					break ;
  300|       |
  301|    917|			case fact_HASH16:
  ------------------
  |  |   59|    917|#define	fact_HASH16 	MAKE_HASH16 ('f', 'a', 'c', 't', 0xF3, 0xAC, 0xD3, 0x11, \
  |  |  ------------------
  |  |  |  |   41|    917|			(	(x0)			^ ((x1) << 1)	^ ((x2) << 2)	^ ((x3) << 3) ^	\
  |  |  |  |   42|    917|				((x4) << 4) 	^ ((x5) << 5)	^ ((x6) << 6)	^ ((x7) << 7) ^	\
  |  |  |  |   43|    917|				((x8) << 8) 	^ ((x9) << 9)	^ ((xa) << 10)	^ ((xb) << 11) ^ \
  |  |  |  |   44|    917|				((xc) << 12) 	^ ((xd) << 13)	^ ((xe) << 14)	^ ((xf) << 15)	)
  |  |  ------------------
  |  |   60|    917|								0x8C, 0xD1, 0x00, 0xC0, 0x4F, 0x8E, 0xDB, 0x8A)
  ------------------
  |  Branch (301:4): [True: 917, False: 99.3k]
  ------------------
  302|    917|					{	sf_count_t frames ;
  303|       |
  304|    917|						psf_binheader_readf (psf, "e8", &frames) ;
  305|    917|						psf_log_printf (psf, "fact : %D\n  frames : %D\n",
  306|    917|										chunk_size, frames) ;
  307|    917|						} ;
  308|    917|					chunk_size = 0 ;
  309|    917|					break ;
  310|       |
  311|       |
  312|  18.2k|			case data_HASH16 :
  ------------------
  |  |   62|  18.2k|#define	data_HASH16 	MAKE_HASH16 ('d', 'a', 't', 'a', 0xF3, 0xAC, 0xD3, 0x11, \
  |  |  ------------------
  |  |  |  |   41|  18.2k|			(	(x0)			^ ((x1) << 1)	^ ((x2) << 2)	^ ((x3) << 3) ^	\
  |  |  |  |   42|  18.2k|				((x4) << 4) 	^ ((x5) << 5)	^ ((x6) << 6)	^ ((x7) << 7) ^	\
  |  |  |  |   43|  18.2k|				((x8) << 8) 	^ ((x9) << 9)	^ ((xa) << 10)	^ ((xb) << 11) ^ \
  |  |  |  |   44|  18.2k|				((xc) << 12) 	^ ((xd) << 13)	^ ((xe) << 14)	^ ((xf) << 15)	)
  |  |  ------------------
  |  |   63|  18.2k|								0x8C, 0xD1, 0x00, 0xC0, 0x4F, 0x8E, 0xDB, 0x8A)
  ------------------
  |  Branch (312:4): [True: 18.2k, False: 81.9k]
  ------------------
  313|  18.2k|					if ((parsestage & (HAVE_riff | HAVE_wave | HAVE_fmt)) != (HAVE_riff | HAVE_wave | HAVE_fmt))
  ------------------
  |  Branch (313:10): [True: 3, False: 18.2k]
  ------------------
  314|      3|						return SFE_W64_NO_DATA ;
  315|       |
  316|  18.2k|					psf->dataoffset = psf_ftell (psf) ;
  317|  18.2k|					psf->datalength = SF_MIN (chunk_size - 24, psf->filelength - psf->dataoffset) ;
  ------------------
  |  |   91|  18.2k|#define		SF_MIN(a, b)	((a) < (b) ? (a) : (b))
  |  |  ------------------
  |  |  |  Branch (91:24): [True: 18.2k, False: 51]
  |  |  ------------------
  ------------------
  318|       |
  319|  18.2k|					if (chunk_size % 8)
  ------------------
  |  Branch (319:10): [True: 10.7k, False: 7.54k]
  ------------------
  320|  10.7k|						chunk_size += 8 - (chunk_size % 8) ;
  321|       |
  322|  18.2k|					psf_log_printf (psf, "data : %D\n", chunk_size) ;
  323|       |
  324|  18.2k|					parsestage |= HAVE_data ;
  325|       |
  326|  18.2k|					if (! psf->sf.seekable)
  ------------------
  |  Branch (326:10): [True: 0, False: 18.2k]
  ------------------
  327|      0|						break ;
  328|       |
  329|       |					/* Seek past data and continue reading header. */
  330|  18.2k|					psf_fseek (psf, chunk_size, SEEK_CUR) ;
  331|  18.2k|					chunk_size = 0 ;
  332|  18.2k|					break ;
  333|       |
  334|  1.13k|			case levl_HASH16 :
  ------------------
  |  |   68|  1.13k|#define	levl_HASH16		MAKE_HASH16 (0x6c, 0x65, 0x76, 0x6c, 0xf3, 0xac, 0xd3, 0x11, \
  |  |  ------------------
  |  |  |  |   41|  1.13k|			(	(x0)			^ ((x1) << 1)	^ ((x2) << 2)	^ ((x3) << 3) ^	\
  |  |  |  |   42|  1.13k|				((x4) << 4) 	^ ((x5) << 5)	^ ((x6) << 6)	^ ((x7) << 7) ^	\
  |  |  |  |   43|  1.13k|				((x8) << 8) 	^ ((x9) << 9)	^ ((xa) << 10)	^ ((xb) << 11) ^ \
  |  |  |  |   44|  1.13k|				((xc) << 12) 	^ ((xd) << 13)	^ ((xe) << 14)	^ ((xf) << 15)	)
  |  |  ------------------
  |  |   69|  1.13k|								0xd1, 0x8c, 0x00, 0xC0, 0x4F, 0x8E, 0xDB, 0x8A)
  ------------------
  |  Branch (334:4): [True: 1.13k, False: 99.0k]
  ------------------
  335|  1.13k|					psf_log_printf (psf, "levl : %D\n", chunk_size) ;
  336|  1.13k|					break ;
  337|       |
  338|     34|			case list_HASH16 :
  ------------------
  |  |   71|     34|#define list_HASH16		MAKE_HASH16 (0x6C, 0x69, 0x73, 0x74, 0x2F, 0x91, 0xCF, 0x11, \
  |  |  ------------------
  |  |  |  |   41|     34|			(	(x0)			^ ((x1) << 1)	^ ((x2) << 2)	^ ((x3) << 3) ^	\
  |  |  |  |   42|     34|				((x4) << 4) 	^ ((x5) << 5)	^ ((x6) << 6)	^ ((x7) << 7) ^	\
  |  |  |  |   43|     34|				((x8) << 8) 	^ ((x9) << 9)	^ ((xa) << 10)	^ ((xb) << 11) ^ \
  |  |  |  |   44|     34|				((xc) << 12) 	^ ((xd) << 13)	^ ((xe) << 14)	^ ((xf) << 15)	)
  |  |  ------------------
  |  |   72|     34|								0xA5, 0xD6, 0x28, 0xDB, 0x04, 0xC1, 0x00, 0x00)
  ------------------
  |  Branch (338:4): [True: 34, False: 100k]
  ------------------
  339|     34|					psf_log_printf (psf, "list : %D\n", chunk_size) ;
  340|     34|					break ;
  341|       |
  342|  1.33k|			case junk_HASH16 :
  ------------------
  |  |   74|  1.33k|#define junk_HASH16		MAKE_HASH16 (0x6A, 0x75, 0x6E, 0x6b, 0xF3, 0xAC, 0xD3, 0x11, \
  |  |  ------------------
  |  |  |  |   41|  1.33k|			(	(x0)			^ ((x1) << 1)	^ ((x2) << 2)	^ ((x3) << 3) ^	\
  |  |  |  |   42|  1.33k|				((x4) << 4) 	^ ((x5) << 5)	^ ((x6) << 6)	^ ((x7) << 7) ^	\
  |  |  |  |   43|  1.33k|				((x8) << 8) 	^ ((x9) << 9)	^ ((xa) << 10)	^ ((xb) << 11) ^ \
  |  |  |  |   44|  1.33k|				((xc) << 12) 	^ ((xd) << 13)	^ ((xe) << 14)	^ ((xf) << 15)	)
  |  |  ------------------
  |  |   75|  1.33k|								0x8C, 0xD1, 0x00, 0xC0, 0x4f, 0x8E, 0xDB, 0x8A)
  ------------------
  |  Branch (342:4): [True: 1.33k, False: 98.9k]
  ------------------
  343|  1.33k|					psf_log_printf (psf, "junk : %D\n", chunk_size) ;
  344|  1.33k|					break ;
  345|       |
  346|  1.13k|			case bext_HASH16 :
  ------------------
  |  |   77|  1.13k|#define bext_HASH16		MAKE_HASH16 (0x62, 0x65, 0x78, 0x74, 0xf3, 0xac, 0xd3, 0xaa, \
  |  |  ------------------
  |  |  |  |   41|  1.13k|			(	(x0)			^ ((x1) << 1)	^ ((x2) << 2)	^ ((x3) << 3) ^	\
  |  |  |  |   42|  1.13k|				((x4) << 4) 	^ ((x5) << 5)	^ ((x6) << 6)	^ ((x7) << 7) ^	\
  |  |  |  |   43|  1.13k|				((x8) << 8) 	^ ((x9) << 9)	^ ((xa) << 10)	^ ((xb) << 11) ^ \
  |  |  |  |   44|  1.13k|				((xc) << 12) 	^ ((xd) << 13)	^ ((xe) << 14)	^ ((xf) << 15)	)
  |  |  ------------------
  |  |   78|  1.13k|								0xd1, 0x8c, 0x00, 0xC0, 0x4F, 0x8E, 0xDB, 0x8A)
  ------------------
  |  Branch (346:4): [True: 1.13k, False: 99.0k]
  ------------------
  347|  1.13k|					psf_log_printf (psf, "bext : %D\n", chunk_size) ;
  348|  1.13k|					break ;
  349|       |
  350|  1.07k|			case MARKER_HASH16 :
  ------------------
  |  |   80|  1.07k|#define MARKER_HASH16	MAKE_HASH16 (0x56, 0x62, 0xf7, 0xab, 0x2d, 0x39, 0xd2, 0x11, \
  |  |  ------------------
  |  |  |  |   41|  1.07k|			(	(x0)			^ ((x1) << 1)	^ ((x2) << 2)	^ ((x3) << 3) ^	\
  |  |  |  |   42|  1.07k|				((x4) << 4) 	^ ((x5) << 5)	^ ((x6) << 6)	^ ((x7) << 7) ^	\
  |  |  |  |   43|  1.07k|				((x8) << 8) 	^ ((x9) << 9)	^ ((xa) << 10)	^ ((xb) << 11) ^ \
  |  |  |  |   44|  1.07k|				((xc) << 12) 	^ ((xd) << 13)	^ ((xe) << 14)	^ ((xf) << 15)	)
  |  |  ------------------
  |  |   81|  1.07k|								0x86, 0xc7, 0x00, 0xc0, 0x4f, 0x8e, 0xdb, 0x8a)
  ------------------
  |  Branch (350:4): [True: 1.07k, False: 99.1k]
  ------------------
  351|  1.07k|					psf_log_printf (psf, "marker : %D\n", chunk_size) ;
  352|  1.07k|					break ;
  353|       |
  354|  1.38k|			case SUMLIST_HASH16 :
  ------------------
  |  |   83|  1.38k|#define	SUMLIST_HASH16	MAKE_HASH16 (0xBC, 0x94, 0x5F, 0x92, 0x5A, 0x52, 0xD2, 0x11, \
  |  |  ------------------
  |  |  |  |   41|  1.38k|			(	(x0)			^ ((x1) << 1)	^ ((x2) << 2)	^ ((x3) << 3) ^	\
  |  |  |  |   42|  1.38k|				((x4) << 4) 	^ ((x5) << 5)	^ ((x6) << 6)	^ ((x7) << 7) ^	\
  |  |  |  |   43|  1.38k|				((x8) << 8) 	^ ((x9) << 9)	^ ((xa) << 10)	^ ((xb) << 11) ^ \
  |  |  |  |   44|  1.38k|				((xc) << 12) 	^ ((xd) << 13)	^ ((xe) << 14)	^ ((xf) << 15)	)
  |  |  ------------------
  |  |   84|  1.38k|								0x86, 0xDC, 0x00, 0xC0, 0x4F, 0x8E, 0xDB, 0x8A)
  ------------------
  |  Branch (354:4): [True: 1.38k, False: 98.8k]
  ------------------
  355|  1.38k|					psf_log_printf (psf, "summary list : %D\n", chunk_size) ;
  356|  1.38k|					break ;
  357|       |
  358|  72.8k|			default :
  ------------------
  |  Branch (358:4): [True: 72.8k, False: 27.4k]
  ------------------
  359|  72.8k|					psf_log_printf (psf, "*** Unknown chunk marker (%X) at position %D with length %D. Skipping and continuing.\n", marker, psf_ftell (psf) - 8, chunk_size) ;
  360|  72.8k|					break ;
  361|   100k|			} ;	/* switch (dword) */
  362|       |
  363|   100k|		if (chunk_size >= psf->filelength)
  ------------------
  |  Branch (363:7): [True: 256, False: 99.9k]
  ------------------
  364|    256|		{	psf_log_printf (psf, "*** Chunk size %u > file length %D. Exiting parser.\n", chunk_size, psf->filelength) ;
  365|    256|			break ;
  366|  99.9k|			} ;
  367|       |
  368|  99.9k|		if (psf->sf.seekable == 0 && (parsestage & HAVE_data))
  ------------------
  |  Branch (368:7): [True: 0, False: 99.9k]
  |  Branch (368:32): [True: 0, False: 0]
  ------------------
  369|      0|			break ;
  370|       |
  371|  99.9k|		if (psf_ftell (psf) >= (psf->filelength - (2 * SIGNED_SIZEOF (dword))))
  ------------------
  |  |   86|  99.9k|#define		SIGNED_SIZEOF(x)	((int) sizeof (x))
  ------------------
  |  Branch (371:7): [True: 387, False: 99.5k]
  ------------------
  372|    387|			break ;
  373|       |
  374|  99.5k|		if (chunk_size > 0 && chunk_size < 0xffff0000)
  ------------------
  |  Branch (374:7): [True: 2.78k, False: 96.7k]
  |  Branch (374:25): [True: 2.78k, False: 0]
  ------------------
  375|  2.78k|		{	dword = chunk_size ;
  376|  2.78k|			psf_binheader_readf (psf, "j", dword - 24) ;
  377|  2.78k|			} ;
  378|  99.5k|		} ; /* while (1) */
  379|       |
  380|    678|	if (psf->dataoffset <= 0)
  ------------------
  |  Branch (380:6): [True: 487, False: 191]
  ------------------
  381|    487|		return SFE_W64_NO_DATA ;
  382|       |
  383|    191|	if (psf->sf.channels < 1)
  ------------------
  |  Branch (383:6): [True: 4, False: 187]
  ------------------
  384|      4|		return SFE_CHANNEL_COUNT_ZERO ;
  385|       |
  386|    187|	if (psf->sf.channels > SF_MAX_CHANNELS)
  ------------------
  |  |   95|    187|#define		SF_MAX_CHANNELS		1024
  ------------------
  |  Branch (386:6): [True: 9, False: 178]
  ------------------
  387|      9|		return SFE_CHANNEL_COUNT ;
  388|       |
  389|    178|	psf->endian = SF_ENDIAN_LITTLE ;		/* All W64 files are little endian. */
  390|       |
  391|    178|	if (psf_ftell (psf) != psf->dataoffset)
  ------------------
  |  Branch (391:6): [True: 157, False: 21]
  ------------------
  392|    157|		psf_fseek (psf, psf->dataoffset, SEEK_SET) ;
  393|       |
  394|    178|	if (psf->blockwidth)
  ------------------
  |  Branch (394:6): [True: 107, False: 71]
  ------------------
  395|    107|	{	if (psf->filelength - psf->dataoffset < psf->datalength)
  ------------------
  |  Branch (395:8): [True: 0, False: 107]
  ------------------
  396|      0|			psf->sf.frames = (psf->filelength - psf->dataoffset) / psf->blockwidth ;
  397|    107|		else
  398|    107|			psf->sf.frames = psf->datalength / psf->blockwidth ;
  399|    107|		} ;
  400|       |
  401|    178|	switch (format)
  402|    178|	{	case WAVE_FORMAT_PCM :
  ------------------
  |  Branch (402:4): [True: 88, False: 90]
  ------------------
  403|     91|		case WAVE_FORMAT_EXTENSIBLE :
  ------------------
  |  Branch (403:3): [True: 3, False: 175]
  ------------------
  404|       |					/* extensible might be FLOAT, MULAW, etc as well! */
  405|     91|					psf->sf.format = SF_FORMAT_W64 | u_bitwidth_to_subformat (psf->bytewidth * 8) ;
  406|     91|					break ;
  407|       |
  408|      4|		case WAVE_FORMAT_MULAW :
  ------------------
  |  Branch (408:3): [True: 4, False: 174]
  ------------------
  409|      4|					psf->sf.format = (SF_FORMAT_W64 | SF_FORMAT_ULAW) ;
  410|      4|					break ;
  411|       |
  412|      8|		case WAVE_FORMAT_ALAW :
  ------------------
  |  Branch (412:3): [True: 8, False: 170]
  ------------------
  413|      8|					psf->sf.format = (SF_FORMAT_W64 | SF_FORMAT_ALAW) ;
  414|      8|					break ;
  415|       |
  416|     13|		case WAVE_FORMAT_MS_ADPCM :
  ------------------
  |  Branch (416:3): [True: 13, False: 165]
  ------------------
  417|     13|					psf->sf.format = (SF_FORMAT_W64 | SF_FORMAT_MS_ADPCM) ;
  418|     13|					*blockalign = wav_fmt->msadpcm.blockalign ;
  419|     13|					*framesperblock = wav_fmt->msadpcm.samplesperblock ;
  420|     13|					break ;
  421|       |
  422|      1|		case WAVE_FORMAT_IMA_ADPCM :
  ------------------
  |  Branch (422:3): [True: 1, False: 177]
  ------------------
  423|      1|					psf->sf.format = (SF_FORMAT_W64 | SF_FORMAT_IMA_ADPCM) ;
  424|      1|					*blockalign = wav_fmt->ima.blockalign ;
  425|      1|					*framesperblock = wav_fmt->ima.samplesperblock ;
  426|      1|					break ;
  427|       |
  428|     49|		case WAVE_FORMAT_GSM610 :
  ------------------
  |  Branch (428:3): [True: 49, False: 129]
  ------------------
  429|     49|					psf->sf.format = (SF_FORMAT_W64 | SF_FORMAT_GSM610) ;
  430|     49|					break ;
  431|       |
  432|      9|		case WAVE_FORMAT_IEEE_FLOAT :
  ------------------
  |  Branch (432:3): [True: 9, False: 169]
  ------------------
  433|      9|					psf->sf.format = SF_FORMAT_W64 ;
  434|      9|					psf->sf.format |= (psf->bytewidth == 8) ? SF_FORMAT_DOUBLE : SF_FORMAT_FLOAT ;
  ------------------
  |  Branch (434:24): [True: 3, False: 6]
  ------------------
  435|      9|					break ;
  436|       |
  437|      3|		default : return SFE_UNIMPLEMENTED ;
  ------------------
  |  Branch (437:3): [True: 3, False: 175]
  ------------------
  438|    178|		} ;
  439|       |
  440|    175|	return 0 ;
  441|    178|} /* w64_read_header */
w64.c:w64_close:
  639|    175|{
  640|    175|	if (psf->file.mode == SFM_WRITE || psf->file.mode == SFM_RDWR)
  ------------------
  |  Branch (640:6): [True: 0, False: 175]
  |  Branch (640:37): [True: 0, False: 175]
  ------------------
  641|      0|		w64_write_header (psf, SF_TRUE) ;
  642|       |
  643|    175|	return 0 ;
  644|    175|} /* w64_close */

wav_open:
  163|  4.84k|{	WAVLIKE_PRIVATE * wpriv ;
  164|  4.84k|	int	format, subformat, error, blockalign = 0, framesperblock = 0 ;
  165|       |
  166|  4.84k|	if ((wpriv = calloc (1, sizeof (WAVLIKE_PRIVATE))) == NULL)
  ------------------
  |  Branch (166:6): [True: 0, False: 4.84k]
  ------------------
  167|      0|		return SFE_MALLOC_FAILED ;
  168|  4.84k|	psf->container_data = wpriv ;
  169|       |
  170|  4.84k|	wpriv->wavex_ambisonic = SF_AMBISONIC_NONE ;
  171|  4.84k|	psf->strings.flags = SF_STR_ALLOW_START | SF_STR_ALLOW_END ;
  172|       |
  173|  4.84k|	if (psf->file.mode == SFM_READ || (psf->file.mode == SFM_RDWR && psf->filelength > 0))
  ------------------
  |  Branch (173:6): [True: 4.84k, False: 0]
  |  Branch (173:37): [True: 0, False: 0]
  |  Branch (173:67): [True: 0, False: 0]
  ------------------
  174|  4.84k|	{	if ((error = wav_read_header (psf, &blockalign, &framesperblock)))
  ------------------
  |  Branch (174:8): [True: 3.83k, False: 1.00k]
  ------------------
  175|  3.83k|			return error ;
  176|       |
  177|  1.00k|		psf->next_chunk_iterator = wav_next_chunk_iterator ;
  178|  1.00k|		psf->get_chunk_size = wav_get_chunk_size ;
  179|  1.00k|		psf->get_chunk_data = wav_get_chunk_data ;
  180|  1.00k|		} ;
  181|       |
  182|  1.00k|	subformat = SF_CODEC (psf->sf.format) ;
  ------------------
  |  |  102|  1.00k|#define SF_CODEC(x)			((x) & SF_FORMAT_SUBMASK)
  ------------------
  183|       |
  184|  1.00k|	if (psf->file.mode == SFM_WRITE || psf->file.mode == SFM_RDWR)
  ------------------
  |  Branch (184:6): [True: 0, False: 1.00k]
  |  Branch (184:37): [True: 0, False: 1.00k]
  ------------------
  185|      0|	{	if (psf->is_pipe)
  ------------------
  |  Branch (185:8): [True: 0, False: 0]
  ------------------
  186|      0|			return SFE_NO_PIPE_WRITE ;
  187|       |
  188|      0|		wpriv->wavex_ambisonic = SF_AMBISONIC_NONE ;
  189|       |
  190|      0|		format = SF_CONTAINER (psf->sf.format) ;
  ------------------
  |  |  101|      0|#define SF_CONTAINER(x)		((x) & SF_FORMAT_TYPEMASK)
  ------------------
  191|      0|		if (format != SF_FORMAT_WAV && format != SF_FORMAT_WAVEX)
  ------------------
  |  Branch (191:7): [True: 0, False: 0]
  |  Branch (191:34): [True: 0, False: 0]
  ------------------
  192|      0|			return	SFE_BAD_OPEN_FORMAT ;
  193|       |
  194|      0|		psf->blockwidth = (sf_count_t) psf->bytewidth * psf->sf.channels ;
  195|       |
  196|       |		/* RIFF WAVs are little-endian, RIFX WAVs are big-endian, default to little */
  197|      0|		psf->endian = SF_ENDIAN (psf->sf.format) ;
  ------------------
  |  |  103|      0|#define SF_ENDIAN(x)		((x) & SF_FORMAT_ENDMASK)
  ------------------
  198|      0|		if (CPU_IS_BIG_ENDIAN && psf->endian == SF_ENDIAN_CPU)
  ------------------
  |  |   11|      0|#define CPU_IS_BIG_ENDIAN 0
  |  |  ------------------
  |  |  |  Branch (11:27): [Folded, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (198:28): [True: 0, False: 0]
  ------------------
  199|      0|			psf->endian = SF_ENDIAN_BIG ;
  200|      0|		else if (psf->endian != SF_ENDIAN_BIG)
  ------------------
  |  Branch (200:12): [True: 0, False: 0]
  ------------------
  201|      0|			psf->endian = SF_ENDIAN_LITTLE ;
  202|       |
  203|      0|		if (psf->file.mode != SFM_RDWR || psf->filelength < 44)
  ------------------
  |  Branch (203:7): [True: 0, False: 0]
  |  Branch (203:37): [True: 0, False: 0]
  ------------------
  204|      0|		{	psf->filelength = 0 ;
  205|      0|			psf->datalength = 0 ;
  206|      0|			psf->dataoffset = 0 ;
  207|      0|			psf->sf.frames = 0 ;
  208|      0|			} ;
  209|       |
  210|      0|#if (ENABLE_EXPERIMENTAL_CODE == 0)
  211|       |		/* For now, don't support writing MPEGLAYER3 WAVs, as we can't guarantee that
  212|       |		** such a file written by libsndfile would have the same length when opened again.
  213|       |		*/
  214|      0|		if (subformat == SF_FORMAT_MPEG_LAYER_III)
  ------------------
  |  Branch (214:7): [True: 0, False: 0]
  ------------------
  215|      0|			return SFE_UNSUPPORTED_ENCODING ;
  216|      0|#endif
  217|       |
  218|      0|		if (subformat == SF_FORMAT_IMA_ADPCM || subformat == SF_FORMAT_MS_ADPCM)
  ------------------
  |  Branch (218:7): [True: 0, False: 0]
  |  Branch (218:43): [True: 0, False: 0]
  ------------------
  219|      0|		{	blockalign = wavlike_srate2blocksize ((sf_count_t) psf->sf.samplerate * psf->sf.channels) ;
  220|      0|			framesperblock = -1 ; /* Corrected later. */
  221|      0|			} ;
  222|       |
  223|       |		/* By default, add the peak chunk to floating point files. Default behaviour
  224|       |		** can be switched off using sf_command (SFC_SET_PEAK_CHUNK, SF_FALSE).
  225|       |		*/
  226|      0|		if (psf->file.mode == SFM_WRITE && (subformat == SF_FORMAT_FLOAT || subformat == SF_FORMAT_DOUBLE))
  ------------------
  |  Branch (226:7): [True: 0, False: 0]
  |  Branch (226:39): [True: 0, False: 0]
  |  Branch (226:71): [True: 0, False: 0]
  ------------------
  227|      0|		{	if ((psf->peak_info = peak_info_calloc (psf->sf.channels)) == NULL)
  ------------------
  |  Branch (227:9): [True: 0, False: 0]
  ------------------
  228|      0|				return SFE_MALLOC_FAILED ;
  229|      0|			psf->peak_info->peak_loc = SF_PEAK_START ;
  230|      0|			} ;
  231|       |
  232|      0|		psf->write_header	= wav_write_header ;
  233|      0|		psf->set_chunk		= wav_set_chunk ;
  234|  1.00k|		} ;
  235|       |
  236|  1.00k|	psf->container_close = wav_close ;
  237|  1.00k|	psf->command = wav_command ;
  238|       |
  239|  1.00k|	switch (subformat)
  240|  1.00k|	{	case SF_FORMAT_PCM_U8 :
  ------------------
  |  Branch (240:4): [True: 7, False: 1.00k]
  ------------------
  241|      8|		case SF_FORMAT_PCM_16 :
  ------------------
  |  Branch (241:3): [True: 1, False: 1.00k]
  ------------------
  242|     30|		case SF_FORMAT_PCM_24 :
  ------------------
  |  Branch (242:3): [True: 22, False: 985]
  ------------------
  243|     35|		case SF_FORMAT_PCM_32 :
  ------------------
  |  Branch (243:3): [True: 5, False: 1.00k]
  ------------------
  244|     35|					error = pcm_init (psf) ;
  245|     35|					break ;
  246|       |
  247|      1|		case SF_FORMAT_ULAW :
  ------------------
  |  Branch (247:3): [True: 1, False: 1.00k]
  ------------------
  248|      1|					error = ulaw_init (psf) ;
  249|      1|					break ;
  250|       |
  251|      9|		case SF_FORMAT_ALAW :
  ------------------
  |  Branch (251:3): [True: 9, False: 998]
  ------------------
  252|      9|					error = alaw_init (psf) ;
  253|      9|					break ;
  254|       |
  255|       |		/* Lite remove start */
  256|     33|		case SF_FORMAT_FLOAT :
  ------------------
  |  Branch (256:3): [True: 33, False: 974]
  ------------------
  257|     33|					error = float32_init (psf) ;
  258|     33|					break ;
  259|       |
  260|      6|		case SF_FORMAT_DOUBLE :
  ------------------
  |  Branch (260:3): [True: 6, False: 1.00k]
  ------------------
  261|      6|					error = double64_init (psf) ;
  262|      6|					break ;
  263|       |
  264|    189|		case SF_FORMAT_IMA_ADPCM :
  ------------------
  |  Branch (264:3): [True: 189, False: 818]
  ------------------
  265|    189|					error = wavlike_ima_init (psf, blockalign, framesperblock) ;
  266|    189|					break ;
  267|       |
  268|    164|		case SF_FORMAT_MS_ADPCM :
  ------------------
  |  Branch (268:3): [True: 164, False: 843]
  ------------------
  269|    164|					error = wavlike_msadpcm_init (psf, blockalign, framesperblock) ;
  270|    164|					break ;
  271|       |
  272|     12|		case SF_FORMAT_G721_32 :
  ------------------
  |  Branch (272:3): [True: 12, False: 995]
  ------------------
  273|     12|					error = g72x_init (psf) ;
  274|     12|					break ;
  275|       |
  276|    167|		case SF_FORMAT_NMS_ADPCM_16 :
  ------------------
  |  Branch (276:3): [True: 167, False: 840]
  ------------------
  277|    209|		case SF_FORMAT_NMS_ADPCM_24 :
  ------------------
  |  Branch (277:3): [True: 42, False: 965]
  ------------------
  278|    241|		case SF_FORMAT_NMS_ADPCM_32 :
  ------------------
  |  Branch (278:3): [True: 32, False: 975]
  ------------------
  279|    241|					error = nms_adpcm_init (psf) ;
  280|    241|					break ;
  281|       |
  282|       |		/* Lite remove end */
  283|       |
  284|    298|		case SF_FORMAT_GSM610 :
  ------------------
  |  Branch (284:3): [True: 298, False: 709]
  ------------------
  285|    298|					error = gsm610_init (psf) ;
  286|    298|					break ;
  287|       |
  288|      2|		case SF_FORMAT_MPEG_LAYER_III :
  ------------------
  |  Branch (288:3): [True: 2, False: 1.00k]
  ------------------
  289|      2|					error = mpeg_init (psf, SF_BITRATE_MODE_CONSTANT, SF_FALSE) ;
  290|      2|					break ;
  291|       |
  292|     17|		default : 	return SFE_UNIMPLEMENTED ;
  ------------------
  |  Branch (292:3): [True: 17, False: 990]
  ------------------
  293|  1.00k|		} ;
  294|       |
  295|    990|	if (psf->file.mode == SFM_WRITE || (psf->file.mode == SFM_RDWR && psf->filelength == 0))
  ------------------
  |  Branch (295:6): [True: 0, False: 990]
  |  Branch (295:38): [True: 0, False: 990]
  |  Branch (295:68): [True: 0, False: 0]
  ------------------
  296|      0|		return psf->write_header (psf, SF_FALSE) ;
  297|       |
  298|    990|	return error ;
  299|    990|} /* wav_open */
wav.c:wav_read_header:
  307|  4.84k|{	WAVLIKE_PRIVATE	*wpriv ;
  308|  4.84k|	WAV_FMT		*wav_fmt ;
  309|  4.84k|	FACT_CHUNK	fact_chunk ;
  310|  4.84k|	uint32_t	marker, chunk_size = 0, RIFFsize = 0, done = 0 ;
  311|  4.84k|	int			parsestage = 0, error, format = 0 ;
  312|       |
  313|  4.84k|	if (psf->is_pipe == 0 && psf->filelength > 0xFFFFFFFFLL)
  ------------------
  |  Branch (313:6): [True: 4.84k, False: 0]
  |  Branch (313:27): [True: 0, False: 4.84k]
  ------------------
  314|      0|		psf_log_printf (psf, "Warning : filelength > 0xffffffff. This is bad!!!!\n") ;
  315|       |
  316|  4.84k|	if ((wpriv = psf->container_data) == NULL)
  ------------------
  |  Branch (316:6): [True: 0, False: 4.84k]
  ------------------
  317|      0|		return SFE_INTERNAL ;
  318|  4.84k|	wav_fmt = &wpriv->wav_fmt ;
  319|       |
  320|       |	/* Set position to start of file to begin reading header. */
  321|  4.84k|	psf_binheader_readf (psf, "pmj", 0, &marker, -4) ;
  322|  4.84k|	psf->header.indx = 0 ;
  323|       |
  324|       |	/* RIFX signifies big-endian format for all header and data  to prevent
  325|       |	** lots of code copying here, we'll set the psf->rwf_endian flag once here,
  326|       |	** and never specify endian-ness for all other header ops/
  327|       |	*/
  328|  4.84k|	psf->rwf_endian = (marker == RIFF_MARKER) ? SF_ENDIAN_LITTLE : SF_ENDIAN_BIG ;
  ------------------
  |  |   38|  4.84k|#define RIFF_MARKER		(MAKE_MARKER ('R', 'I', 'F', 'F'))
  |  |  ------------------
  |  |  |  |  122|  4.84k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (328:20): [True: 4.63k, False: 211]
  ------------------
  329|       |
  330|  22.2k|	while (! done)
  ------------------
  |  Branch (330:9): [True: 22.2k, False: 26]
  ------------------
  331|  22.2k|	{	size_t jump = chunk_size & 1 ;
  332|       |
  333|  22.2k|		marker = chunk_size = 0 ;
  334|  22.2k|		psf_binheader_readf (psf, "jm4", jump, &marker, &chunk_size) ;
  335|  22.2k|		if (marker == 0)
  ------------------
  |  Branch (335:7): [True: 11, False: 22.2k]
  ------------------
  336|     11|		{	sf_count_t pos = psf_ftell (psf) ;
  337|     11|			psf_log_printf (psf, "Have 0 marker at position %D (0x%x).\n", pos, pos) ;
  338|     11|			break ;
  339|  22.2k|			} ;
  340|       |
  341|  22.2k|		psf_store_read_chunk_u32 (&psf->rchunks, marker, psf_ftell (psf), chunk_size) ;
  342|       |
  343|  22.2k|		switch (marker)
  344|  22.2k|		{	case RIFF_MARKER :
  ------------------
  |  |   38|  4.63k|#define RIFF_MARKER		(MAKE_MARKER ('R', 'I', 'F', 'F'))
  |  |  ------------------
  |  |  |  |  122|  4.63k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (344:5): [True: 4.63k, False: 17.5k]
  ------------------
  345|  4.84k|			case RIFX_MARKER :
  ------------------
  |  |   39|  4.84k|#define RIFX_MARKER		(MAKE_MARKER ('R', 'I', 'F', 'X'))
  |  |  ------------------
  |  |  |  |  122|  4.84k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (345:4): [True: 212, False: 21.9k]
  ------------------
  346|  4.84k|					if (parsestage)
  ------------------
  |  Branch (346:10): [True: 2, False: 4.84k]
  ------------------
  347|      2|						return SFE_WAV_NO_RIFF ;
  348|       |
  349|  4.84k|					parsestage |= HAVE_RIFF ;
  350|       |
  351|  4.84k|					RIFFsize = chunk_size ;
  352|       |
  353|  4.84k|					if (psf->fileoffset > 0 && psf->filelength > RIFFsize + 8)
  ------------------
  |  Branch (353:10): [True: 207, False: 4.63k]
  |  Branch (353:33): [True: 185, False: 22]
  ------------------
  354|    185|					{	/* Set file length. */
  355|    185|						psf->filelength = RIFFsize + 8 ;
  356|    185|						if (marker == RIFF_MARKER)
  ------------------
  |  |   38|    185|#define RIFF_MARKER		(MAKE_MARKER ('R', 'I', 'F', 'F'))
  |  |  ------------------
  |  |  |  |  122|    185|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (356:11): [True: 182, False: 3]
  ------------------
  357|    182|							psf_log_printf (psf, "RIFF : %u\n", RIFFsize) ;
  358|      3|						else
  359|      3|							psf_log_printf (psf, "RIFX : %u\n", RIFFsize) ;
  360|    185|						}
  361|  4.65k|					else if (psf->filelength < RIFFsize + 2 * SIGNED_SIZEOF (marker))
  ------------------
  |  |   86|  4.65k|#define		SIGNED_SIZEOF(x)	((int) sizeof (x))
  ------------------
  |  Branch (361:15): [True: 4.49k, False: 167]
  ------------------
  362|  4.49k|					{	if (marker == RIFF_MARKER)
  ------------------
  |  |   38|  4.49k|#define RIFF_MARKER		(MAKE_MARKER ('R', 'I', 'F', 'F'))
  |  |  ------------------
  |  |  |  |  122|  4.49k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (362:12): [True: 4.30k, False: 182]
  ------------------
  363|  4.30k|							psf_log_printf (psf, "RIFF : %u (should be %D)\n", RIFFsize, psf->filelength - 2 * SIGNED_SIZEOF (marker)) ;
  ------------------
  |  |   86|  4.30k|#define		SIGNED_SIZEOF(x)	((int) sizeof (x))
  ------------------
  364|    182|						else
  365|    182|							psf_log_printf (psf, "RIFX : %u (should be %D)\n", RIFFsize, psf->filelength - 2 * SIGNED_SIZEOF (marker)) ;
  ------------------
  |  |   86|    182|#define		SIGNED_SIZEOF(x)	((int) sizeof (x))
  ------------------
  366|       |
  367|  4.49k|						RIFFsize = psf->filelength - 2 * SIGNED_SIZEOF (RIFFsize) ;
  ------------------
  |  |   86|  4.49k|#define		SIGNED_SIZEOF(x)	((int) sizeof (x))
  ------------------
  368|  4.49k|						}
  369|    167|					else
  370|    167|					{	if (marker == RIFF_MARKER)
  ------------------
  |  |   38|    167|#define RIFF_MARKER		(MAKE_MARKER ('R', 'I', 'F', 'F'))
  |  |  ------------------
  |  |  |  |  122|    167|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (370:12): [True: 141, False: 26]
  ------------------
  371|    141|							psf_log_printf (psf, "RIFF : %u\n", RIFFsize) ;
  372|     26|						else
  373|     26|							psf_log_printf (psf, "RIFX : %u\n", RIFFsize) ;
  374|    167|					} ;
  375|       |
  376|  4.84k|					psf_binheader_readf (psf, "m", &marker) ;
  377|  4.84k|					if (marker != WAVE_MARKER)
  ------------------
  |  |   40|  4.84k|#define WAVE_MARKER		(MAKE_MARKER ('W', 'A', 'V', 'E'))
  |  |  ------------------
  |  |  |  |  122|  4.84k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (377:10): [True: 0, False: 4.84k]
  ------------------
  378|      0|						return SFE_WAV_NO_WAVE ;
  379|  4.84k|					parsestage |= HAVE_WAVE ;
  380|  4.84k|					psf_log_printf (psf, "WAVE\n") ;
  381|  4.84k|					chunk_size = 0 ;
  382|  4.84k|					break ;
  383|       |
  384|  2.03k|			case fmt_MARKER :
  ------------------
  |  |   41|  2.03k|#define fmt_MARKER		(MAKE_MARKER ('f', 'm', 't', ' '))
  |  |  ------------------
  |  |  |  |  122|  2.03k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (384:4): [True: 2.03k, False: 20.1k]
  ------------------
  385|  2.03k|					if ((parsestage & (HAVE_RIFF | HAVE_WAVE)) != (HAVE_RIFF | HAVE_WAVE))
  ------------------
  |  Branch (385:10): [True: 0, False: 2.03k]
  ------------------
  386|      0|						return SFE_WAV_NO_FMT ;
  387|       |
  388|       |					/* If this file has a SECOND fmt chunk, I don't want to know about it. */
  389|  2.03k|					if (parsestage & HAVE_fmt)
  ------------------
  |  Branch (389:10): [True: 202, False: 1.83k]
  ------------------
  390|    202|						break ;
  391|       |
  392|  1.83k|					parsestage |= HAVE_fmt ;
  393|       |
  394|  1.83k|					psf_log_printf (psf, "fmt  : %d\n", chunk_size) ;
  395|       |
  396|  1.83k|					if ((error = wavlike_read_fmt_chunk (psf, chunk_size)))
  ------------------
  |  Branch (396:10): [True: 370, False: 1.46k]
  ------------------
  397|    370|						return error ;
  398|       |
  399|  1.46k|					format = wav_fmt->format ;
  400|  1.46k|					break ;
  401|       |
  402|  1.47k|			case data_MARKER :
  ------------------
  |  |   32|  1.47k|#define data_MARKER		MAKE_MARKER ('d', 'a', 't', 'a')
  |  |  ------------------
  |  |  |  |  122|  1.47k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (402:4): [True: 1.47k, False: 20.7k]
  ------------------
  403|  1.47k|					if ((parsestage & (HAVE_RIFF | HAVE_WAVE | HAVE_fmt)) != (HAVE_RIFF | HAVE_WAVE | HAVE_fmt))
  ------------------
  |  Branch (403:10): [True: 1, False: 1.47k]
  ------------------
  404|      1|						return SFE_WAV_NO_DATA ;
  405|       |
  406|  1.47k|					if (psf->file.mode == SFM_RDWR && (parsestage & HAVE_other) != 0)
  ------------------
  |  Branch (406:10): [True: 0, False: 1.47k]
  |  Branch (406:40): [True: 0, False: 0]
  ------------------
  407|      0|						return SFE_RDWR_BAD_HEADER ;
  408|       |
  409|  1.47k|					parsestage |= HAVE_data ;
  410|       |
  411|  1.47k|					psf->datalength = chunk_size ;
  412|  1.47k|					if (psf->datalength & 1)
  ------------------
  |  Branch (412:10): [True: 838, False: 634]
  ------------------
  413|    838|						psf_log_printf (psf, "*** 'data' chunk should be an even number of bytes in length.\n") ;
  414|       |
  415|  1.47k|					psf->dataoffset = psf_ftell (psf) ;
  416|       |
  417|  1.47k|					if (psf->dataoffset > 0)
  ------------------
  |  Branch (417:10): [True: 1.47k, False: 0]
  ------------------
  418|  1.47k|					{	if (chunk_size == 0 && RIFFsize == 8 && psf->filelength > 44)
  ------------------
  |  Branch (418:12): [True: 251, False: 1.22k]
  |  Branch (418:31): [True: 13, False: 238]
  |  Branch (418:48): [True: 12, False: 1]
  ------------------
  419|     12|						{	psf_log_printf (psf, "*** Looks like a WAV file which wasn't closed properly. Fixing it.\n") ;
  420|     12|							psf->datalength = psf->filelength - psf->dataoffset ;
  421|     12|							} ;
  422|       |
  423|  1.47k|						if (psf->datalength > psf->filelength - psf->dataoffset)
  ------------------
  |  Branch (423:11): [True: 1.00k, False: 472]
  ------------------
  424|  1.00k|						{	psf_log_printf (psf, "data : %D (should be %D)\n", psf->datalength, psf->filelength - psf->dataoffset) ;
  425|  1.00k|							psf->datalength = psf->filelength - psf->dataoffset ;
  426|  1.00k|							}
  427|    472|						else
  428|    472|							psf_log_printf (psf, "data : %D\n", psf->datalength) ;
  429|       |
  430|       |						/* Only set dataend if there really is data at the end. */
  431|  1.47k|						if (psf->datalength + psf->dataoffset < psf->filelength)
  ------------------
  |  Branch (431:11): [True: 456, False: 1.01k]
  ------------------
  432|    456|							psf->dataend = psf->datalength + psf->dataoffset ;
  433|       |
  434|  1.47k|						psf->datalength += chunk_size & 1 ;
  435|  1.47k|						chunk_size = 0 ;
  436|  1.47k|						} ;
  437|       |
  438|  1.47k|					if (! psf->sf.seekable || psf->dataoffset < 0)
  ------------------
  |  Branch (438:10): [True: 0, False: 1.47k]
  |  Branch (438:32): [True: 0, False: 1.47k]
  ------------------
  439|      0|						break ;
  440|       |
  441|       |					/* Seek past data and continue reading header. */
  442|  1.47k|					psf_fseek (psf, psf->datalength, SEEK_CUR) ;
  443|       |
  444|  1.47k|					if (psf_ftell (psf) != psf->datalength + psf->dataoffset)
  ------------------
  |  Branch (444:10): [True: 616, False: 856]
  ------------------
  445|    616|						psf_log_printf (psf, "*** psf_fseek past end error ***\n") ;
  446|  1.47k|					break ;
  447|       |
  448|    956|			case fact_MARKER :
  ------------------
  |  |   42|    956|#define fact_MARKER		(MAKE_MARKER ('f', 'a', 'c', 't'))
  |  |  ------------------
  |  |  |  |  122|    956|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (448:4): [True: 956, False: 21.2k]
  ------------------
  449|    956|					if ((parsestage & (HAVE_RIFF | HAVE_WAVE)) != (HAVE_RIFF | HAVE_WAVE))
  ------------------
  |  Branch (449:10): [True: 0, False: 956]
  ------------------
  450|      0|						return SFE_WAV_BAD_FACT ;
  451|       |
  452|    956|					parsestage |= HAVE_fact ;
  453|       |
  454|    956|					if ((parsestage & HAVE_fmt) != HAVE_fmt)
  ------------------
  |  Branch (454:10): [True: 658, False: 298]
  ------------------
  455|    658|						psf_log_printf (psf, "*** Should have 'fmt ' chunk before 'fact'\n") ;
  456|       |
  457|    956|					psf_binheader_readf (psf, "4", & (fact_chunk.frames)) ;
  458|       |
  459|    956|					if (chunk_size > SIGNED_SIZEOF (fact_chunk))
  ------------------
  |  |   86|    956|#define		SIGNED_SIZEOF(x)	((int) sizeof (x))
  ------------------
  |  Branch (459:10): [True: 234, False: 722]
  ------------------
  460|    234|						psf_binheader_readf (psf, "j", (int) (chunk_size - SIGNED_SIZEOF (fact_chunk))) ;
  ------------------
  |  |   86|    234|#define		SIGNED_SIZEOF(x)	((int) sizeof (x))
  ------------------
  461|       |
  462|    956|					if (chunk_size)
  ------------------
  |  Branch (462:10): [True: 549, False: 407]
  ------------------
  463|    549|						psf_log_printf (psf, "%M : %u\n", marker, chunk_size) ;
  464|    407|					else
  465|    407|						psf_log_printf (psf, "%M : %u (should not be zero)\n", marker, chunk_size) ;
  466|       |
  467|    956|					psf_log_printf (psf, "  frames  : %d\n", fact_chunk.frames) ;
  468|    956|					break ;
  469|       |
  470|    501|			case PEAK_MARKER :
  ------------------
  |  |   40|    501|#define PEAK_MARKER		MAKE_MARKER ('P', 'E', 'A', 'K')
  |  |  ------------------
  |  |  |  |  122|    501|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (470:4): [True: 501, False: 21.7k]
  ------------------
  471|    501|					if ((parsestage & (HAVE_RIFF | HAVE_WAVE | HAVE_fmt)) != (HAVE_RIFF | HAVE_WAVE | HAVE_fmt))
  ------------------
  |  Branch (471:10): [True: 1, False: 500]
  ------------------
  472|      1|						return SFE_WAV_PEAK_B4_FMT ;
  473|       |
  474|    500|					parsestage |= HAVE_PEAK ;
  475|       |
  476|    500|					psf_log_printf (psf, "%M : %u\n", marker, chunk_size) ;
  477|    500|					if ((error = wavlike_read_peak_chunk (psf, chunk_size)) != 0)
  ------------------
  |  Branch (477:10): [True: 0, False: 500]
  ------------------
  478|      0|						return error ;
  479|    500|					if (psf->peak_info != NULL)
  ------------------
  |  Branch (479:10): [True: 279, False: 221]
  ------------------
  480|    279|						psf->peak_info->peak_loc = ((parsestage & HAVE_data) == 0) ? SF_PEAK_START : SF_PEAK_END ;
  ------------------
  |  Branch (480:34): [True: 176, False: 103]
  ------------------
  481|    500|					break ;
  482|       |
  483|    879|			case cue_MARKER :
  ------------------
  |  |   44|    879|#define cue_MARKER		(MAKE_MARKER ('c', 'u', 'e', ' '))
  |  |  ------------------
  |  |  |  |  122|    879|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (483:4): [True: 879, False: 21.3k]
  ------------------
  484|    879|					parsestage |= HAVE_other ;
  485|       |
  486|    879|					{	uint32_t thisread, bytesread, cue_count, position, offset ;
  487|    879|						int id, chunk_id, chunk_start, block_start, cue_index ;
  488|    879|						SF_CUE_POINT *cue_points ;
  489|       |
  490|    879|						bytesread = psf_binheader_readf (psf, "4", &cue_count) ;
  491|    879|						psf_log_printf (psf, "%M : %u\n", marker, chunk_size) ;
  492|       |
  493|    879|						if (cue_count > 2500) /* 2500 is close to the largest number of cues possible because of block sizes */
  ------------------
  |  Branch (493:11): [True: 275, False: 604]
  ------------------
  494|    275|						{	psf_log_printf (psf, "  Count : %u (skipping)\n", cue_count) ;
  495|    275|							psf_binheader_readf (psf, "j", chunk_size - bytesread) ;
  496|    275|							break ;
  497|    604|							} ;
  498|       |
  499|    604|						psf_log_printf (psf, "  Count : %d\n", cue_count) ;
  500|       |
  501|    604|						if (psf->cues)
  ------------------
  |  Branch (501:11): [True: 472, False: 132]
  ------------------
  502|    472|						{	free (psf->cues) ;
  503|    472|							psf->cues = NULL ;
  504|    472|							} ;
  505|       |
  506|    604|						if ((psf->cues = psf_cues_alloc (cue_count)) == NULL)
  ------------------
  |  Branch (506:11): [True: 0, False: 604]
  ------------------
  507|      0|							return SFE_MALLOC_FAILED ;
  508|       |
  509|    604|						cue_points = psf_cues_points (psf->cues) ;
  510|    604|						cue_index = 0 ;
  511|       |
  512|  5.01k|						while (cue_count)
  ------------------
  |  Branch (512:14): [True: 4.45k, False: 560]
  ------------------
  513|  4.45k|						{
  514|  4.45k|							if ((thisread = psf_binheader_readf (psf, "e44m444", &id, &position, &chunk_id, &chunk_start, &block_start, &offset)) == 0)
  ------------------
  |  Branch (514:12): [True: 44, False: 4.41k]
  ------------------
  515|     44|								break ;
  516|  4.41k|							bytesread += thisread ;
  517|       |
  518|  4.41k|							if (cue_index < 10) /* avoid swamping log buffer with cues */
  ------------------
  |  Branch (518:12): [True: 2.03k, False: 2.37k]
  ------------------
  519|  2.03k|								psf_log_printf (psf,	"   Cue ID : %2d"
  520|  2.03k|											"  Pos : %5u  Chunk : %M"
  521|  2.03k|											"  Chk Start : %d  Blk Start : %d"
  522|  2.03k|											"  Offset : %5d\n",
  523|  2.03k|										id, position, chunk_id, chunk_start, block_start, offset) ;
  524|  2.37k|							else if (cue_index == 10)
  ------------------
  |  Branch (524:17): [True: 140, False: 2.23k]
  ------------------
  525|    140|								psf_log_printf (psf,	"   (Skipping)\n") ;
  526|       |
  527|  4.41k|							cue_points [cue_index].indx = id ;
  528|  4.41k|							cue_points [cue_index].position = position ;
  529|  4.41k|							cue_points [cue_index].fcc_chunk = chunk_id ;
  530|  4.41k|							cue_points [cue_index].chunk_start = chunk_start ;
  531|  4.41k|							cue_points [cue_index].block_start = block_start ;
  532|  4.41k|							cue_points [cue_index].sample_offset = offset ;
  533|  4.41k|							cue_points [cue_index].name [0] = '\0' ;
  534|  4.41k|							cue_count -- ;
  535|  4.41k|							cue_index ++ ;
  536|  4.41k|							} ;
  537|       |
  538|    604|						if (bytesread != chunk_size)
  ------------------
  |  Branch (538:11): [True: 344, False: 260]
  ------------------
  539|    344|						{	psf_log_printf (psf, "**** Chunk size weirdness (%d != %d)\n", chunk_size, bytesread) ;
  540|    344|							psf_binheader_readf (psf, "j", chunk_size - bytesread) ;
  541|    344|							} ;
  542|    604|						} ;
  543|    604|					break ;
  544|       |
  545|  1.73k|			case smpl_MARKER :
  ------------------
  |  |   48|  1.73k|#define smpl_MARKER		(MAKE_MARKER ('s', 'm', 'p', 'l'))
  |  |  ------------------
  |  |  |  |  122|  1.73k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (545:4): [True: 1.73k, False: 20.4k]
  ------------------
  546|  1.73k|					parsestage |= HAVE_other ;
  547|       |
  548|  1.73k|					psf_log_printf (psf, "smpl : %u\n", chunk_size) ;
  549|       |
  550|  1.73k|					if ((error = wav_read_smpl_chunk (psf, chunk_size)))
  ------------------
  |  Branch (550:10): [True: 0, False: 1.73k]
  ------------------
  551|      0|						return error ;
  552|  1.73k|					break ;
  553|       |
  554|  1.73k|			case acid_MARKER :
  ------------------
  |  |   52|  1.10k|#define acid_MARKER		(MAKE_MARKER ('a', 'c', 'i', 'd'))
  |  |  ------------------
  |  |  |  |  122|  1.10k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (554:4): [True: 1.10k, False: 21.0k]
  ------------------
  555|  1.10k|					parsestage |= HAVE_other ;
  556|       |
  557|  1.10k|					psf_log_printf (psf, "acid : %u\n", chunk_size) ;
  558|       |
  559|  1.10k|					if ((error = wav_read_acid_chunk (psf, chunk_size)))
  ------------------
  |  Branch (559:10): [True: 0, False: 1.10k]
  ------------------
  560|      0|						return error ;
  561|  1.10k|					break ;
  562|       |
  563|  1.26k|			case INFO_MARKER :
  ------------------
  |  |   37|  1.26k|#define INFO_MARKER		MAKE_MARKER ('I', 'N', 'F', 'O')
  |  |  ------------------
  |  |  |  |  122|  1.26k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (563:4): [True: 1.26k, False: 20.9k]
  ------------------
  564|  1.34k|			case LIST_MARKER :
  ------------------
  |  |   38|  1.34k|#define LIST_MARKER		MAKE_MARKER ('L', 'I', 'S', 'T')
  |  |  ------------------
  |  |  |  |  122|  1.34k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (564:4): [True: 79, False: 22.1k]
  ------------------
  565|  1.34k|					parsestage |= HAVE_other ;
  566|       |
  567|  1.34k|					if ((error = wavlike_subchunk_parse (psf, marker, chunk_size)) != 0)
  ------------------
  |  Branch (567:10): [True: 0, False: 1.34k]
  ------------------
  568|      0|						return error ;
  569|  1.34k|					break ;
  570|       |
  571|  1.34k|			case bext_MARKER :
  ------------------
  |  |   30|    121|#define bext_MARKER		MAKE_MARKER ('b', 'e', 'x', 't')
  |  |  ------------------
  |  |  |  |  122|    121|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (571:4): [True: 121, False: 22.0k]
  ------------------
  572|       |					/*
  573|       |					The 'bext' chunk can actually be updated, so don't need to set this.
  574|       |					parsestage |= HAVE_other ;
  575|       |					*/
  576|    121|					if ((error = wavlike_read_bext_chunk (psf, chunk_size)))
  ------------------
  |  Branch (576:10): [True: 0, False: 121]
  ------------------
  577|      0|						return error ;
  578|    121|					break ;
  579|       |
  580|    195|			case PAD_MARKER :
  ------------------
  |  |   39|    195|#define PAD_MARKER		MAKE_MARKER ('P', 'A', 'D', ' ')
  |  |  ------------------
  |  |  |  |  122|    195|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (580:4): [True: 195, False: 22.0k]
  ------------------
  581|       |					/*
  582|       |					We can eat into a 'PAD ' chunk if we need to.
  583|       |					parsestage |= HAVE_other ;
  584|       |					*/
  585|    195|					psf_log_printf (psf, "%M : %u\n", marker, chunk_size) ;
  586|    195|					psf_binheader_readf (psf, "j", chunk_size) ;
  587|    195|					break ;
  588|       |
  589|    276|			case cart_MARKER:
  ------------------
  |  |   31|    276|#define cart_MARKER		MAKE_MARKER ('c', 'a', 'r', 't')
  |  |  ------------------
  |  |  |  |  122|    276|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (589:4): [True: 276, False: 21.9k]
  ------------------
  590|    276|					if ((error = wavlike_read_cart_chunk (psf, chunk_size)))
  ------------------
  |  Branch (590:10): [True: 0, False: 276]
  ------------------
  591|      0|						return error ;
  592|    276|					break ;
  593|       |
  594|    276|			case iXML_MARKER : /* See http://en.wikipedia.org/wiki/IXML */
  ------------------
  |  |   49|    197|#define iXML_MARKER		(MAKE_MARKER ('i', 'X', 'M', 'L'))
  |  |  ------------------
  |  |  |  |  122|    197|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (594:4): [True: 197, False: 22.0k]
  ------------------
  595|    404|			case strc_MARKER : /* Multiple of 32 bytes. */
  ------------------
  |  |   53|    404|#define strc_MARKER		(MAKE_MARKER ('s', 't', 'r', 'c'))
  |  |  ------------------
  |  |  |  |  122|    404|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (595:4): [True: 207, False: 21.9k]
  ------------------
  596|    502|			case afsp_MARKER :
  ------------------
  |  |   54|    502|#define afsp_MARKER		(MAKE_MARKER ('a', 'f', 's', 'p'))
  |  |  ------------------
  |  |  |  |  122|    502|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (596:4): [True: 98, False: 22.1k]
  ------------------
  597|    712|			case clm_MARKER :
  ------------------
  |  |   55|    712|#define clm_MARKER		(MAKE_MARKER ('c', 'l', 'm', ' '))
  |  |  ------------------
  |  |  |  |  122|    712|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (597:4): [True: 210, False: 21.9k]
  ------------------
  598|    920|			case elmo_MARKER :
  ------------------
  |  |   56|    920|#define elmo_MARKER		(MAKE_MARKER ('e', 'l', 'm', 'o'))
  |  |  ------------------
  |  |  |  |  122|    920|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (598:4): [True: 208, False: 21.9k]
  ------------------
  599|    989|			case levl_MARKER :
  ------------------
  |  |   50|    989|#define levl_MARKER		(MAKE_MARKER ('l', 'e', 'v', 'l'))
  |  |  ------------------
  |  |  |  |  122|    989|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (599:4): [True: 69, False: 22.1k]
  ------------------
  600|  1.21k|			case plst_MARKER :
  ------------------
  |  |   47|  1.21k|#define plst_MARKER		(MAKE_MARKER ('p', 'l', 's', 't'))
  |  |  ------------------
  |  |  |  |  122|  1.21k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (600:4): [True: 230, False: 21.9k]
  ------------------
  601|  1.28k|			case minf_MARKER :
  ------------------
  |  |   59|  1.28k|#define minf_MARKER		(MAKE_MARKER ('m', 'i', 'n', 'f'))
  |  |  ------------------
  |  |  |  |  122|  1.28k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (601:4): [True: 67, False: 22.1k]
  ------------------
  602|  1.35k|			case elm1_MARKER :
  ------------------
  |  |   60|  1.35k|#define elm1_MARKER		(MAKE_MARKER ('e', 'l', 'm', '1'))
  |  |  ------------------
  |  |  |  |  122|  1.35k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (602:4): [True: 73, False: 22.1k]
  ------------------
  603|  1.55k|			case regn_MARKER :
  ------------------
  |  |   61|  1.55k|#define regn_MARKER		(MAKE_MARKER ('r', 'e', 'g', 'n'))
  |  |  ------------------
  |  |  |  |  122|  1.55k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (603:4): [True: 195, False: 22.0k]
  ------------------
  604|  1.75k|			case ovwf_MARKER :
  ------------------
  |  |   62|  1.75k|#define ovwf_MARKER		(MAKE_MARKER ('o', 'v', 'w', 'f'))
  |  |  ------------------
  |  |  |  |  122|  1.75k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (604:4): [True: 196, False: 22.0k]
  ------------------
  605|  1.81k|			case inst_MARKER :
  ------------------
  |  |   68|  1.81k|#define inst_MARKER		(MAKE_MARKER ('i', 'n', 's', 't'))
  |  |  ------------------
  |  |  |  |  122|  1.81k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (605:4): [True: 68, False: 22.1k]
  ------------------
  606|  1.88k|			case AFAn_MARKER :
  ------------------
  |  |   69|  1.88k|#define AFAn_MARKER		(MAKE_MARKER ('A', 'F', 'A', 'n'))
  |  |  ------------------
  |  |  |  |  122|  1.88k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (606:4): [True: 66, False: 22.1k]
  ------------------
  607|  2.08k|			case umid_MARKER :
  ------------------
  |  |   63|  2.08k|#define umid_MARKER		(MAKE_MARKER ('u', 'm', 'i', 'd'))
  |  |  ------------------
  |  |  |  |  122|  2.08k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (607:4): [True: 199, False: 22.0k]
  ------------------
  608|  2.16k|			case SyLp_MARKER :
  ------------------
  |  |   64|  2.16k|#define SyLp_MARKER		(MAKE_MARKER ('S', 'y', 'L', 'p'))
  |  |  ------------------
  |  |  |  |  122|  2.16k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (608:4): [True: 86, False: 22.1k]
  ------------------
  609|  2.25k|			case Cr8r_MARKER :
  ------------------
  |  |   65|  2.25k|#define Cr8r_MARKER		(MAKE_MARKER ('C', 'r', '8', 'r'))
  |  |  ------------------
  |  |  |  |  122|  2.25k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (609:4): [True: 86, False: 22.1k]
  ------------------
  610|  2.33k|			case JUNK_MARKER :
  ------------------
  |  |   66|  2.33k|#define JUNK_MARKER		(MAKE_MARKER ('J', 'U', 'N', 'K'))
  |  |  ------------------
  |  |  |  |  122|  2.33k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (610:4): [True: 76, False: 22.1k]
  ------------------
  611|  2.40k|			case PMX_MARKER :
  ------------------
  |  |   67|  2.40k|#define PMX_MARKER		(MAKE_MARKER ('_', 'P', 'M', 'X'))
  |  |  ------------------
  |  |  |  |  122|  2.40k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (611:4): [True: 71, False: 22.1k]
  ------------------
  612|  2.59k|			case DISP_MARKER :
  ------------------
  |  |   36|  2.59k|#define DISP_MARKER		MAKE_MARKER ('D', 'I', 'S', 'P')
  |  |  ------------------
  |  |  |  |  122|  2.59k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (612:4): [True: 197, False: 22.0k]
  ------------------
  613|  2.80k|			case MEXT_MARKER :
  ------------------
  |  |   51|  2.80k|#define MEXT_MARKER		(MAKE_MARKER ('M', 'E', 'X', 'T'))
  |  |  ------------------
  |  |  |  |  122|  2.80k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (613:4): [True: 202, False: 22.0k]
  ------------------
  614|  3.00k|			case FLLR_MARKER :
  ------------------
  |  |   57|  3.00k|#define FLLR_MARKER		(MAKE_MARKER ('F', 'L', 'L', 'R'))
  |  |  ------------------
  |  |  |  |  122|  3.00k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (614:4): [True: 207, False: 21.9k]
  ------------------
  615|  3.00k|					psf_log_printf (psf, "%M : %u\n", marker, chunk_size) ;
  616|  3.00k|					psf_binheader_readf (psf, "j", chunk_size) ;
  617|  3.00k|					break ;
  618|       |
  619|  3.73k|			default :
  ------------------
  |  Branch (619:4): [True: 3.73k, False: 18.4k]
  ------------------
  620|  3.73k|					if (chunk_size >= 0xffff0000)
  ------------------
  |  Branch (620:10): [True: 23, False: 3.71k]
  ------------------
  621|     23|					{	done = SF_TRUE ;
  622|     23|						psf_log_printf (psf, "*** Unknown chunk marker (%X) at position %D with length %u. Exiting parser.\n", marker, psf_ftell (psf) - 8, chunk_size) ;
  623|     23|						break ;
  624|  3.71k|						} ;
  625|       |
  626|  3.71k|					if ((marker & TAG__MARKER_MASK) == TAG__MARKER &&
  ------------------
  |  |   78|  3.71k|#define TAG__MARKER_MASK (MAKE_MARKER (0xff, 0xff, 0xff, 0))
  |  |  ------------------
  |  |  |  |  122|  3.71k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
              					if ((marker & TAG__MARKER_MASK) == TAG__MARKER &&
  ------------------
  |  |   77|  7.42k|#define TAG__MARKER (MAKE_MARKER ('T', 'A', 'G', 0))
  |  |  ------------------
  |  |  |  |  122|  3.71k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (626:10): [True: 88, False: 3.62k]
  ------------------
  627|     88|						psf_ftell (psf) - 8 + 128 == psf->filelength)
  ------------------
  |  Branch (627:7): [True: 1, False: 87]
  ------------------
  628|      1|					{	psf_log_printf (psf, "*** Hit ID3v1 trailer. Exiting parser.\n") ;
  629|      1|						chunk_size = 128 ;
  630|      1|						done = SF_TRUE ;
  631|      1|						parsestage |= HAVE_other ;
  632|      1|						break ;
  633|  3.71k|						} ;
  634|       |
  635|  3.71k|					if (psf_isprint ((marker >> 24) & 0xFF) && psf_isprint ((marker >> 16) & 0xFF)
  ------------------
  |  Branch (635:10): [True: 3.15k, False: 553]
  |  Branch (635:49): [True: 2.55k, False: 599]
  ------------------
  636|  2.55k|						&& psf_isprint ((marker >> 8) & 0xFF) && psf_isprint (marker & 0xFF))
  ------------------
  |  Branch (636:10): [True: 1.75k, False: 803]
  |  Branch (636:48): [True: 1.18k, False: 569]
  ------------------
  637|  1.18k|					{	psf_log_printf (psf, "*** %M : %u (unknown marker)\n", marker, chunk_size) ;
  638|  1.18k|						psf_binheader_readf (psf, "j", chunk_size) ;
  639|  1.18k|						break ;
  640|  2.52k|						} ;
  641|  2.52k|					if (psf_ftell (psf) & 0x03)
  ------------------
  |  Branch (641:10): [True: 2.20k, False: 319]
  ------------------
  642|  2.20k|					{	psf_log_printf (psf, "  Unknown chunk marker at position %D. Resynching.\n", psf_ftell (psf) - 8) ;
  643|  2.20k|						psf_binheader_readf (psf, "j", -3) ;
  644|       |						/* File is too messed up so we prevent editing in RDWR mode here. */
  645|  2.20k|						parsestage |= HAVE_other ;
  646|  2.20k|						break ;
  647|  2.20k|						} ;
  648|    319|					psf_log_printf (psf, "*** Unknown chunk marker (%X) at position %D. Exiting parser.\n", marker, psf_ftell (psf) - 8) ;
  649|    319|					done = SF_TRUE ;
  650|    319|					break ;
  651|  22.2k|			} ;	/* switch (marker) */
  652|       |
  653|  21.8k|		if (chunk_size >= psf->filelength)
  ------------------
  |  Branch (653:7): [True: 2.99k, False: 18.8k]
  ------------------
  654|  2.99k|		{	psf_log_printf (psf, "*** Chunk size %u > file length %D. Exiting parser.\n", chunk_size, psf->filelength) ;
  655|  2.99k|			break ;
  656|  18.8k|			} ;
  657|       |
  658|  18.8k|		if (! psf->sf.seekable && (parsestage & HAVE_data))
  ------------------
  |  Branch (658:7): [True: 0, False: 18.8k]
  |  Branch (658:29): [True: 0, False: 0]
  ------------------
  659|      0|			break ;
  660|       |
  661|  18.8k|		if (psf_ftell (psf) >= psf->filelength - SIGNED_SIZEOF (chunk_size))
  ------------------
  |  |   86|  18.8k|#define		SIGNED_SIZEOF(x)	((int) sizeof (x))
  ------------------
  |  Branch (661:7): [True: 1.44k, False: 17.3k]
  ------------------
  662|  1.44k|		{	psf_log_printf (psf, "End\n") ;
  663|  1.44k|			break ;
  664|  17.3k|			} ;
  665|  17.3k|		} ; /* while (1) */
  666|       |
  667|  4.46k|	if (psf->dataoffset <= 0)
  ------------------
  |  Branch (667:6): [True: 3.42k, False: 1.04k]
  ------------------
  668|  3.42k|		return SFE_WAV_NO_DATA ;
  669|       |
  670|  1.04k|	if (psf->sf.channels < 1)
  ------------------
  |  Branch (670:6): [True: 10, False: 1.03k]
  ------------------
  671|     10|		return SFE_CHANNEL_COUNT_ZERO ;
  672|       |
  673|  1.03k|	if (psf->sf.channels > SF_MAX_CHANNELS)
  ------------------
  |  |   95|  1.03k|#define		SF_MAX_CHANNELS		1024
  ------------------
  |  Branch (673:6): [True: 27, False: 1.01k]
  ------------------
  674|     27|		return SFE_CHANNEL_COUNT ;
  675|       |
  676|  1.01k|	if (format != WAVE_FORMAT_PCM && (parsestage & HAVE_fact) == 0)
  ------------------
  |  Branch (676:6): [True: 955, False: 55]
  |  Branch (676:35): [True: 953, False: 2]
  ------------------
  677|    953|		psf_log_printf (psf, "**** All non-PCM format files should have a 'fact' chunk.\n") ;
  678|       |
  679|       |	/* WAVs can be little or big endian */
  680|  1.01k|	psf->endian = psf->rwf_endian ;
  681|       |
  682|  1.01k|	psf_fseek (psf, psf->dataoffset, SEEK_SET) ;
  683|       |
  684|  1.01k|	if (psf->is_pipe == 0)
  ------------------
  |  Branch (684:6): [True: 1.01k, False: 0]
  ------------------
  685|  1.01k|	{	/*
  686|       |		** Check for 'wvpk' at the start of the DATA section. Not able to
  687|       |		** handle this.
  688|       |		*/
  689|  1.01k|		psf_binheader_readf (psf, "4", &marker) ;
  690|  1.01k|		if (marker == wvpk_MARKER || marker == OggS_MARKER)
  ------------------
  |  |   73|  2.02k|#define wvpk_MARKER (MAKE_MARKER ('w', 'v', 'p', 'k'))
  |  |  ------------------
  |  |  |  |  122|  1.01k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
              		if (marker == wvpk_MARKER || marker == OggS_MARKER)
  ------------------
  |  |   74|  1.00k|#define OggS_MARKER (MAKE_MARKER ('O', 'g', 'g', 'S'))
  |  |  ------------------
  |  |  |  |  122|  1.00k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (690:7): [True: 1, False: 1.00k]
  |  Branch (690:32): [True: 1, False: 1.00k]
  ------------------
  691|      2|			return SFE_WAV_WVPK_DATA ;
  692|  1.01k|		} ;
  693|       |
  694|       |	/* Seek to start of DATA section. */
  695|  1.00k|	psf_fseek (psf, psf->dataoffset, SEEK_SET) ;
  696|       |
  697|  1.00k|	if (psf->blockwidth)
  ------------------
  |  Branch (697:6): [True: 94, False: 914]
  ------------------
  698|     94|	{	if (psf->filelength - psf->dataoffset < psf->datalength)
  ------------------
  |  Branch (698:8): [True: 34, False: 60]
  ------------------
  699|     34|			psf->sf.frames = (psf->filelength - psf->dataoffset) / psf->blockwidth ;
  700|     60|		else
  701|     60|			psf->sf.frames = psf->datalength / psf->blockwidth ;
  702|     94|		} ;
  703|       |
  704|  1.00k|	switch (format)
  705|  1.00k|	{	case WAVE_FORMAT_EXTENSIBLE :
  ------------------
  |  Branch (705:4): [True: 5, False: 1.00k]
  ------------------
  706|      5|			if (psf->sf.format == (SF_FORMAT_WAVEX | SF_FORMAT_MS_ADPCM))
  ------------------
  |  Branch (706:8): [True: 3, False: 2]
  ------------------
  707|      3|			{	*blockalign = wav_fmt->msadpcm.blockalign ;
  708|      3|				*framesperblock = wav_fmt->msadpcm.samplesperblock ;
  709|      3|				} ;
  710|      5|			break ;
  711|       |
  712|    242|		case WAVE_FORMAT_NMS_VBXADPCM :
  ------------------
  |  Branch (712:3): [True: 242, False: 766]
  ------------------
  713|    242|			switch (wav_fmt->min.bitwidth)
  714|    242|			{	case 2 :
  ------------------
  |  Branch (714:6): [True: 167, False: 75]
  ------------------
  715|    167|					psf->sf.format = SF_FORMAT_WAV | SF_FORMAT_NMS_ADPCM_16 ;
  716|    167|					break ;
  717|     42|				case 3 :
  ------------------
  |  Branch (717:5): [True: 42, False: 200]
  ------------------
  718|     42|					psf->sf.format = SF_FORMAT_WAV | SF_FORMAT_NMS_ADPCM_24 ;
  719|     42|					break ;
  720|     32|				case 4 :
  ------------------
  |  Branch (720:5): [True: 32, False: 210]
  ------------------
  721|     32|					psf->sf.format = SF_FORMAT_WAV | SF_FORMAT_NMS_ADPCM_32 ;
  722|     32|					break ;
  723|       |
  724|      1|				default :
  ------------------
  |  Branch (724:5): [True: 1, False: 241]
  ------------------
  725|      1|					return SFE_UNIMPLEMENTED ;
  726|    242|				}
  727|    241|				break ;
  728|       |
  729|    241|		case WAVE_FORMAT_PCM :
  ------------------
  |  Branch (729:3): [True: 53, False: 955]
  ------------------
  730|     53|					psf->sf.format = SF_FORMAT_WAV | u_bitwidth_to_subformat (psf->bytewidth * 8) ;
  731|     53|					break ;
  732|       |
  733|      1|		case WAVE_FORMAT_MULAW :
  ------------------
  |  Branch (733:3): [True: 1, False: 1.00k]
  ------------------
  734|      1|		case IBM_FORMAT_MULAW :
  ------------------
  |  Branch (734:3): [True: 0, False: 1.00k]
  ------------------
  735|      1|					psf->sf.format = (SF_FORMAT_WAV | SF_FORMAT_ULAW) ;
  736|      1|					break ;
  737|       |
  738|      9|		case WAVE_FORMAT_ALAW :
  ------------------
  |  Branch (738:3): [True: 9, False: 999]
  ------------------
  739|      9|		case IBM_FORMAT_ALAW :
  ------------------
  |  Branch (739:3): [True: 0, False: 1.00k]
  ------------------
  740|      9|					psf->sf.format = (SF_FORMAT_WAV | SF_FORMAT_ALAW) ;
  741|      9|					break ;
  742|       |
  743|    161|		case WAVE_FORMAT_MS_ADPCM :
  ------------------
  |  Branch (743:3): [True: 161, False: 847]
  ------------------
  744|    161|					psf->sf.format = (SF_FORMAT_WAV | SF_FORMAT_MS_ADPCM) ;
  745|    161|					*blockalign = wav_fmt->msadpcm.blockalign ;
  746|    161|					*framesperblock = wav_fmt->msadpcm.samplesperblock ;
  747|    161|					break ;
  748|       |
  749|    189|		case WAVE_FORMAT_IMA_ADPCM :
  ------------------
  |  Branch (749:3): [True: 189, False: 819]
  ------------------
  750|    189|					psf->sf.format = (SF_FORMAT_WAV | SF_FORMAT_IMA_ADPCM) ;
  751|    189|					*blockalign = wav_fmt->ima.blockalign ;
  752|    189|					*framesperblock = wav_fmt->ima.samplesperblock ;
  753|    189|					break ;
  754|       |
  755|    298|		case WAVE_FORMAT_GSM610 :
  ------------------
  |  Branch (755:3): [True: 298, False: 710]
  ------------------
  756|    298|					psf->sf.format = (SF_FORMAT_WAV | SF_FORMAT_GSM610) ;
  757|    298|					break ;
  758|       |
  759|     36|		case WAVE_FORMAT_IEEE_FLOAT :
  ------------------
  |  Branch (759:3): [True: 36, False: 972]
  ------------------
  760|     36|					psf->sf.format = SF_FORMAT_WAV ;
  761|     36|					psf->sf.format |= (psf->bytewidth == 8) ? SF_FORMAT_DOUBLE : SF_FORMAT_FLOAT ;
  ------------------
  |  Branch (761:24): [True: 6, False: 30]
  ------------------
  762|     36|					break ;
  763|       |
  764|     12|		case WAVE_FORMAT_G721_ADPCM :
  ------------------
  |  Branch (764:3): [True: 12, False: 996]
  ------------------
  765|     12|					psf->sf.format = SF_FORMAT_WAV | SF_FORMAT_G721_32 ;
  766|     12|					break ;
  767|       |
  768|      2|		case WAVE_FORMAT_MPEGLAYER3 :
  ------------------
  |  Branch (768:3): [True: 2, False: 1.00k]
  ------------------
  769|      2|					psf->sf.format = SF_FORMAT_WAV | SF_FORMAT_MPEG_LAYER_III ;
  770|      2|					if (parsestage & HAVE_fact)
  ------------------
  |  Branch (770:10): [True: 1, False: 1]
  ------------------
  771|      1|						psf->sf.frames = fact_chunk.frames ;
  772|      2|					break ;
  773|       |
  774|      0|		default : return SFE_UNIMPLEMENTED ;
  ------------------
  |  Branch (774:3): [True: 0, False: 1.00k]
  ------------------
  775|  1.00k|		} ;
  776|       |
  777|  1.00k|	if (wpriv->fmt_is_broken)
  ------------------
  |  Branch (777:6): [True: 19, False: 988]
  ------------------
  778|     19|		wavlike_analyze (psf) ;
  779|       |
  780|       |	/* Only set the format endian-ness if its non-standard big-endian. */
  781|  1.00k|	if (psf->endian == SF_ENDIAN_BIG)
  ------------------
  |  Branch (781:6): [True: 1, False: 1.00k]
  ------------------
  782|      1|		psf->sf.format |= SF_ENDIAN_BIG ;
  783|       |
  784|  1.00k|	return 0 ;
  785|  1.00k|} /* wav_read_header */
wav.c:wav_read_smpl_chunk:
 1381|  1.73k|{	char buffer [512] ;
 1382|  1.73k|	uint32_t thisread, bytesread = 0, dword, sampler_data, loop_count, actually_loop_count = 0 ;
 1383|  1.73k|	uint32_t note, pitch, start, end, type = -1, count ;
 1384|  1.73k|	int j, k ;
 1385|       |
 1386|  1.73k|	chunklen += (chunklen & 1) ;
 1387|       |
 1388|  1.73k|	bytesread += psf_binheader_readf (psf, "4", &dword) ;
 1389|  1.73k|	psf_log_printf (psf, "  Manufacturer : %X\n", dword) ;
 1390|       |
 1391|  1.73k|	bytesread += psf_binheader_readf (psf, "4", &dword) ;
 1392|  1.73k|	psf_log_printf (psf, "  Product      : %u\n", dword) ;
 1393|       |
 1394|  1.73k|	bytesread += psf_binheader_readf (psf, "4", &dword) ;
 1395|  1.73k|	psf_log_printf (psf, "  Period       : %u nsec\n", dword) ;
 1396|       |
 1397|  1.73k|	bytesread += psf_binheader_readf (psf, "4", &note) ;
 1398|  1.73k|	psf_log_printf (psf, "  Midi Note    : %u\n", note) ;
 1399|       |
 1400|  1.73k|	bytesread += psf_binheader_readf (psf, "4", &pitch) ;
 1401|  1.73k|	if (pitch != 0)
  ------------------
  |  Branch (1401:6): [True: 616, False: 1.11k]
  ------------------
 1402|    616|	{	snprintf (buffer, sizeof (buffer), "%f",
 1403|    616|					(1.0 * 0x80000000) / ((uint32_t) pitch)) ;
 1404|    616|		psf_log_printf (psf, "  Pitch Fract. : %s\n", buffer) ;
 1405|    616|		}
 1406|  1.11k|	else
 1407|  1.11k|		psf_log_printf (psf, "  Pitch Fract. : 0\n") ;
 1408|       |
 1409|  1.73k|	bytesread += psf_binheader_readf (psf, "4", &dword) ;
 1410|  1.73k|	psf_log_printf (psf, "  SMPTE Format : %u\n", dword) ;
 1411|       |
 1412|  1.73k|	bytesread += psf_binheader_readf (psf, "4", &dword) ;
 1413|  1.73k|	snprintf (buffer, sizeof (buffer), "%02"PRIu32 ":%02"PRIu32 ":%02"PRIu32
 1414|  1.73k|				" %02"PRIu32 "", (dword >> 24) & 0x7F, (dword >> 16) & 0x7F,
 1415|  1.73k|				(dword >> 8) & 0x7F, dword & 0x7F) ;
 1416|  1.73k|	psf_log_printf (psf, "  SMPTE Offset : %s\n", buffer) ;
 1417|       |
 1418|  1.73k|	bytesread += psf_binheader_readf (psf, "4", &loop_count) ;
 1419|  1.73k|	psf_log_printf (psf, "  Loop Count   : %u\n", loop_count) ;
 1420|       |
 1421|  1.73k|	if (loop_count == 0 && chunklen == bytesread)
  ------------------
  |  Branch (1421:6): [True: 662, False: 1.07k]
  |  Branch (1421:25): [True: 72, False: 590]
  ------------------
 1422|     72|		return 0 ;
 1423|       |
 1424|       |	/* Sampler Data holds the number of data bytes after the CUE chunks which
 1425|       |	** is not actually CUE data. Display value after CUE data.
 1426|       |	*/
 1427|  1.66k|	bytesread += psf_binheader_readf (psf, "4", &sampler_data) ;
 1428|       |
 1429|  1.66k|	if (psf->instrument)
  ------------------
  |  Branch (1429:6): [True: 1.35k, False: 310]
  ------------------
 1430|  1.35k|	{	psf_log_printf (psf, "  Found more than one SMPL chunk, using last one.\n") ;
 1431|  1.35k|		free (psf->instrument) ;
 1432|  1.35k|		psf->instrument = NULL ;
 1433|  1.35k|		} ;
 1434|  1.66k|	if ((psf->instrument = psf_instrument_alloc ()) == NULL)
  ------------------
  |  Branch (1434:6): [True: 0, False: 1.66k]
  ------------------
 1435|      0|		return SFE_MALLOC_FAILED ;
 1436|       |
 1437|  1.66k|	psf->instrument->loop_count = loop_count ;
 1438|       |
 1439|  8.63k|	for (j = 0 ; loop_count > 0 && chunklen - bytesread >= 24 ; j ++)
  ------------------
  |  Branch (1439:15): [True: 8.04k, False: 590]
  |  Branch (1439:33): [True: 7.07k, False: 965]
  ------------------
 1440|  7.07k|	{	if ((thisread = psf_binheader_readf (psf, "4", &dword)) == 0)
  ------------------
  |  Branch (1440:8): [True: 108, False: 6.96k]
  ------------------
 1441|    108|			break ;
 1442|  6.96k|		bytesread += thisread ;
 1443|  6.96k|		psf_log_printf (psf, "    Cue ID : %2u", dword) ;
 1444|       |
 1445|  6.96k|		bytesread += psf_binheader_readf (psf, "4", &type) ;
 1446|  6.96k|		psf_log_printf (psf, "  Type : %2u", type) ;
 1447|       |
 1448|  6.96k|		bytesread += psf_binheader_readf (psf, "4", &start) ;
 1449|  6.96k|		psf_log_printf (psf, "  Start : %5u", start) ;
 1450|       |
 1451|  6.96k|		bytesread += psf_binheader_readf (psf, "4", &end) ;
 1452|  6.96k|		psf_log_printf (psf, "  End : %5u", end) ;
 1453|       |
 1454|  6.96k|		bytesread += psf_binheader_readf (psf, "4", &dword) ;
 1455|  6.96k|		psf_log_printf (psf, "  Fraction : %5u", dword) ;
 1456|       |
 1457|  6.96k|		bytesread += psf_binheader_readf (psf, "4", &count) ;
 1458|  6.96k|		psf_log_printf (psf, "  Count : %5u\n", count) ;
 1459|       |
 1460|  6.96k|		if (j < ARRAY_LEN (psf->instrument->loops))
  ------------------
  |  |   88|  6.96k|#define		ARRAY_LEN(x)	((int) (sizeof (x) / sizeof ((x) [0])))
  ------------------
  |  Branch (1460:7): [True: 1.18k, False: 5.78k]
  ------------------
 1461|  1.18k|		{	psf->instrument->loops [j].start = start ;
 1462|  1.18k|			psf->instrument->loops [j].end = end + 1 ;
 1463|  1.18k|			psf->instrument->loops [j].count = count ;
 1464|       |
 1465|  1.18k|			switch (type)
 1466|  1.18k|			{	case 0 :
  ------------------
  |  Branch (1466:6): [True: 275, False: 909]
  ------------------
 1467|    275|					psf->instrument->loops [j].mode = SF_LOOP_FORWARD ;
 1468|    275|					break ;
 1469|     18|				case 1 :
  ------------------
  |  Branch (1469:5): [True: 18, False: 1.16k]
  ------------------
 1470|     18|					psf->instrument->loops [j].mode = SF_LOOP_ALTERNATING ;
 1471|     18|					break ;
 1472|      6|				case 2 :
  ------------------
  |  Branch (1472:5): [True: 6, False: 1.17k]
  ------------------
 1473|      6|					psf->instrument->loops [j].mode = SF_LOOP_BACKWARD ;
 1474|      6|					break ;
 1475|    885|				default:
  ------------------
  |  Branch (1475:5): [True: 885, False: 299]
  ------------------
 1476|    885|					psf->instrument->loops [j].mode = SF_LOOP_NONE ;
 1477|    885|					break ;
 1478|  1.18k|				} ;
 1479|  6.96k|			} ;
 1480|  6.96k|		actually_loop_count ++ ;
 1481|  6.96k|		} ;
 1482|       |
 1483|  1.66k|	if (actually_loop_count > ARRAY_LEN (psf->instrument->loops))
  ------------------
  |  |   88|  1.66k|#define		ARRAY_LEN(x)	((int) (sizeof (x) / sizeof ((x) [0])))
  ------------------
  |  Branch (1483:6): [True: 61, False: 1.60k]
  ------------------
 1484|     61|	{
 1485|     61|		psf_log_printf (psf, "*** Warning, actual Loop Points count exceeds %u, changing Loop Count from %u to %u\n", ARRAY_LEN (psf->instrument->loops), loop_count, ARRAY_LEN (psf->instrument->loops)) ;
  ------------------
  |  |   88|     61|#define		ARRAY_LEN(x)	((int) (sizeof (x) / sizeof ((x) [0])))
  ------------------
              		psf_log_printf (psf, "*** Warning, actual Loop Points count exceeds %u, changing Loop Count from %u to %u\n", ARRAY_LEN (psf->instrument->loops), loop_count, ARRAY_LEN (psf->instrument->loops)) ;
  ------------------
  |  |   88|     61|#define		ARRAY_LEN(x)	((int) (sizeof (x) / sizeof ((x) [0])))
  ------------------
 1486|     61|		psf->instrument->loop_count = ARRAY_LEN (psf->instrument->loops) ;
  ------------------
  |  |   88|     61|#define		ARRAY_LEN(x)	((int) (sizeof (x) / sizeof ((x) [0])))
  ------------------
 1487|     61|		}
 1488|  1.60k|	else if (loop_count != actually_loop_count)
  ------------------
  |  Branch (1488:11): [True: 1.01k, False: 590]
  ------------------
 1489|  1.01k|	{	psf_log_printf (psf, "*** Warning, actual Loop Points count != Loop Count, changing Loop Count from %u to %u\n", loop_count, actually_loop_count) ;
 1490|  1.01k|		psf->instrument->loop_count = actually_loop_count ;
 1491|  1.01k|		} ;
 1492|       |
 1493|  1.66k|	if (chunklen - bytesread == 0)
  ------------------
  |  Branch (1493:6): [True: 1.09k, False: 566]
  ------------------
 1494|  1.09k|	{	if (sampler_data != 0)
  ------------------
  |  Branch (1494:8): [True: 483, False: 614]
  ------------------
 1495|    483|			psf_log_printf (psf, "  Sampler Data : %u (should be 0)\n", sampler_data) ;
 1496|    614|		else
 1497|    614|			psf_log_printf (psf, "  Sampler Data : %u\n", sampler_data) ;
 1498|  1.09k|		}
 1499|    566|	else
 1500|    566|	{	if (sampler_data != chunklen - bytesread)
  ------------------
  |  Branch (1500:8): [True: 454, False: 112]
  ------------------
 1501|    454|		{	psf_log_printf (psf, "  Sampler Data : %u (should have been %u)\n", sampler_data, chunklen - bytesread) ;
 1502|    454|			sampler_data = chunklen - bytesread ;
 1503|    454|			}
 1504|    112|		else
 1505|    112|			psf_log_printf (psf, "  Sampler Data : %u\n", sampler_data) ;
 1506|       |
 1507|    566|		psf_log_printf (psf, "      ") ;
 1508|  6.20k|		for (k = 0 ; k < (int) sampler_data ; k++)
  ------------------
  |  Branch (1508:16): [True: 5.79k, False: 406]
  ------------------
 1509|  5.79k|		{	char ch ;
 1510|       |
 1511|  5.79k|			if (k > 0 && (k % 20) == 0)
  ------------------
  |  Branch (1511:8): [True: 5.45k, False: 343]
  |  Branch (1511:17): [True: 225, False: 5.22k]
  ------------------
 1512|    225|				psf_log_printf (psf, "\n      ") ;
 1513|       |
 1514|  5.79k|			if ((thisread = psf_binheader_readf (psf, "1", &ch)) == 0)
  ------------------
  |  Branch (1514:8): [True: 160, False: 5.63k]
  ------------------
 1515|    160|				break ;
 1516|  5.63k|			bytesread += thisread ;
 1517|  5.63k|			psf_log_printf (psf, "%02X ", ch & 0xFF) ;
 1518|  5.63k|			} ;
 1519|       |
 1520|    566|		psf_log_printf (psf, "\n") ;
 1521|    566|		} ;
 1522|       |
 1523|  1.66k|	psf->instrument->basenote = note ;
 1524|  1.66k|	psf->instrument->detune = (int8_t) (pitch / (0x40000000 / 25.0) + 0.5) ;
 1525|  1.66k|	psf->instrument->gain = 1 ;
 1526|  1.66k|	psf->instrument->velocity_lo = psf->instrument->key_lo = 0 ;
 1527|  1.66k|	psf->instrument->velocity_hi = psf->instrument->key_hi = 127 ;
 1528|       |
 1529|  1.66k|	return 0 ;
 1530|  1.66k|} /* wav_read_smpl_chunk */
wav.c:wav_read_acid_chunk:
 1565|  1.10k|{	char buffer [512] ;
 1566|  1.10k|	uint32_t bytesread = 0 ;
 1567|  1.10k|	int	beats, flags ;
 1568|  1.10k|	short rootnote, q1, meter_denom, meter_numer ;
 1569|  1.10k|	float q2, tempo ;
 1570|       |
 1571|  1.10k|	chunklen += (chunklen & 1) ;
 1572|       |
 1573|  1.10k|	bytesread += psf_binheader_readf (psf, "422f", &flags, &rootnote, &q1, &q2) ;
 1574|       |
 1575|  1.10k|	snprintf (buffer, sizeof (buffer), "%f", q2) ;
 1576|       |
 1577|  1.10k|	psf_log_printf (psf, "  Flags     : 0x%04x (%s,%s,%s,%s,%s)\n", flags,
 1578|  1.10k|			(flags & 0x01) ? "OneShot" : "Loop",
  ------------------
  |  Branch (1578:4): [True: 610, False: 494]
  ------------------
 1579|  1.10k|			(flags & 0x02) ? "RootNoteValid" : "RootNoteInvalid",
  ------------------
  |  Branch (1579:4): [True: 331, False: 773]
  ------------------
 1580|  1.10k|			(flags & 0x04) ? "StretchOn" : "StretchOff",
  ------------------
  |  Branch (1580:4): [True: 503, False: 601]
  ------------------
 1581|  1.10k|			(flags & 0x08) ? "DiskBased" : "RAMBased",
  ------------------
  |  Branch (1581:4): [True: 41, False: 1.06k]
  ------------------
 1582|  1.10k|			(flags & 0x10) ? "??On" : "??Off") ;
  ------------------
  |  Branch (1582:4): [True: 48, False: 1.05k]
  ------------------
 1583|       |
 1584|  1.10k|	psf_log_printf (psf, "  Root note : 0x%x\n  ????      : 0x%04x\n  ????      : %s\n",
 1585|  1.10k|				rootnote, q1, buffer) ;
 1586|       |
 1587|  1.10k|	bytesread += psf_binheader_readf (psf, "422f", &beats, &meter_denom, &meter_numer, &tempo) ;
 1588|  1.10k|	snprintf (buffer, sizeof (buffer), "%f", tempo) ;
 1589|  1.10k|	psf_log_printf (psf, "  Beats     : %d\n  Meter     : %d/%d\n  Tempo     : %s\n",
 1590|  1.10k|				beats, meter_numer, meter_denom, buffer) ;
 1591|       |
 1592|  1.10k|	psf_binheader_readf (psf, "j", chunklen - bytesread) ;
 1593|       |
 1594|  1.10k|	if (psf->loop_info)
  ------------------
  |  Branch (1594:6): [True: 1.02k, False: 79]
  ------------------
 1595|  1.02k|	{	psf_log_printf (psf, "  Found existing loop info, using last one.\n") ;
 1596|  1.02k|		free (psf->loop_info) ;
 1597|  1.02k|		psf->loop_info = NULL ;
 1598|  1.02k|		} ;
 1599|  1.10k|	if ((psf->loop_info = calloc (1, sizeof (SF_LOOP_INFO))) == NULL)
  ------------------
  |  Branch (1599:6): [True: 0, False: 1.10k]
  ------------------
 1600|      0|		return SFE_MALLOC_FAILED ;
 1601|       |
 1602|  1.10k|	psf->loop_info->time_sig_num	= meter_numer ;
 1603|  1.10k|	psf->loop_info->time_sig_den	= meter_denom ;
 1604|  1.10k|	psf->loop_info->loop_mode		= (flags & 0x01) ? SF_LOOP_NONE : SF_LOOP_FORWARD ;
  ------------------
  |  Branch (1604:31): [True: 610, False: 494]
  ------------------
 1605|  1.10k|	psf->loop_info->num_beats		= beats ;
 1606|  1.10k|	psf->loop_info->bpm				= tempo ;
 1607|  1.10k|	psf->loop_info->root_key		= (flags & 0x02) ? rootnote : -1 ;
  ------------------
  |  Branch (1607:30): [True: 331, False: 773]
  ------------------
 1608|       |
 1609|  1.10k|	return 0 ;
 1610|  1.10k|} /* wav_read_acid_chunk */
wav.c:wav_close:
 1322|  1.00k|{
 1323|  1.00k|	if (psf->file.mode == SFM_WRITE || psf->file.mode == SFM_RDWR)
  ------------------
  |  Branch (1323:6): [True: 0, False: 1.00k]
  |  Branch (1323:37): [True: 0, False: 1.00k]
  ------------------
 1324|      0|	{	wav_write_tailer (psf) ;
 1325|       |
 1326|      0|		if (psf->file.mode == SFM_RDWR)
  ------------------
  |  Branch (1326:7): [True: 0, False: 0]
  ------------------
 1327|      0|		{	sf_count_t current = psf_ftell (psf) ;
 1328|       |
 1329|       |			/*
 1330|       |			**	If the mode is RDWR and the current position is less than the
 1331|       |			**	filelength, truncate the file.
 1332|       |			*/
 1333|       |
 1334|      0|			if (current < psf->filelength)
  ------------------
  |  Branch (1334:8): [True: 0, False: 0]
  ------------------
 1335|      0|			{	psf_ftruncate (psf, current) ;
 1336|      0|				psf->filelength = current ;
 1337|      0|				} ;
 1338|      0|			} ;
 1339|       |
 1340|      0|		psf->write_header (psf, SF_TRUE) ;
 1341|      0|		} ;
 1342|       |
 1343|  1.00k|	return 0 ;
 1344|  1.00k|} /* wav_close */

wavlike_read_fmt_chunk:
  125|  2.53k|{	WAVLIKE_PRIVATE * wpriv ;
  126|  2.53k|	WAV_FMT *wav_fmt ;
  127|  2.53k|	int	bytesread, k, bytespersec = 0 ;
  128|       |
  129|  2.53k|	if ((wpriv = psf->container_data) == NULL)
  ------------------
  |  Branch (129:6): [True: 0, False: 2.53k]
  ------------------
  130|      0|		return SFE_INTERNAL ;
  131|  2.53k|	wav_fmt = &wpriv->wav_fmt ;
  132|       |
  133|  2.53k|	memset (wav_fmt, 0, sizeof (WAV_FMT)) ;
  134|       |
  135|  2.53k|	if (fmtsize < 16)
  ------------------
  |  Branch (135:6): [True: 37, False: 2.49k]
  ------------------
  136|     37|		return SFE_WAV_FMT_SHORT ;
  137|       |
  138|       |	/* assume psf->rwf_endian is already properly set */
  139|       |
  140|       |	/* Read the minimal WAV file header here. */
  141|  2.49k|	bytesread = psf_binheader_readf (psf, "224422",
  142|  2.49k|					&(wav_fmt->format), &(wav_fmt->min.channels),
  143|  2.49k|					&(wav_fmt->min.samplerate), &(wav_fmt->min.bytespersec),
  144|  2.49k|					&(wav_fmt->min.blockalign), &(wav_fmt->min.bitwidth)) ;
  145|       |
  146|  2.49k|	psf_log_printf (psf, "  Format        : 0x%X => %s\n", wav_fmt->format, wavlike_format_str (wav_fmt->format)) ;
  147|  2.49k|	psf_log_printf (psf, "  Channels      : %d\n", wav_fmt->min.channels) ;
  148|  2.49k|	psf_log_printf (psf, "  Sample Rate   : %d\n", wav_fmt->min.samplerate) ;
  149|       |
  150|  2.49k|	if (wav_fmt->format == WAVE_FORMAT_PCM && wav_fmt->min.blockalign == 0
  ------------------
  |  Branch (150:6): [True: 326, False: 2.17k]
  |  Branch (150:44): [True: 54, False: 272]
  ------------------
  151|     54|		&& wav_fmt->min.bitwidth > 0 && wav_fmt->min.channels > 0)
  ------------------
  |  Branch (151:6): [True: 37, False: 17]
  |  Branch (151:35): [True: 32, False: 5]
  ------------------
  152|     32|	{	wav_fmt->min.blockalign = wav_fmt->min.bitwidth / 8 + (wav_fmt->min.bitwidth % 8 > 0 ? 1 : 0) ;
  ------------------
  |  Branch (152:59): [True: 19, False: 13]
  ------------------
  153|     32|		wav_fmt->min.blockalign *= wav_fmt->min.channels ;
  154|     32|		psf_log_printf (psf, "  Block Align   : 0 (should be %d)\n", wav_fmt->min.blockalign) ;
  155|     32|		}
  156|  2.46k|	else
  157|  2.46k|		psf_log_printf (psf, "  Block Align   : %d\n", wav_fmt->min.blockalign) ;
  158|       |
  159|  2.49k|	if (wav_fmt->format == WAVE_FORMAT_PCM && wav_fmt->min.bitwidth == 24 &&
  ------------------
  |  Branch (159:6): [True: 326, False: 2.17k]
  |  Branch (159:44): [True: 65, False: 261]
  ------------------
  160|     65|			wav_fmt->min.blockalign == 4 * wav_fmt->min.channels)
  ------------------
  |  Branch (160:4): [True: 49, False: 16]
  ------------------
  161|     49|	{	psf_log_printf (psf, "  Bit Width     : 24\n") ;
  162|       |
  163|     49|		psf_log_printf (psf, "\n"
  164|     49|			"  Ambiguous information in 'fmt ' chunk. Possible file types:\n"
  165|     49|			"    0) Invalid IEEE float file generated by Syntrillium's Cooledit!\n"
  166|     49|			"    1) File generated by ALSA's arecord containing 24 bit samples in 32 bit containers.\n"
  167|     49|			"    2) 24 bit file with incorrect Block Align value.\n"
  168|     49|			"\n") ;
  169|       |
  170|     49|		wpriv->fmt_is_broken = 1 ;
  171|     49|		}
  172|  2.45k|	else if (wav_fmt->min.bitwidth == 0)
  ------------------
  |  Branch (172:11): [True: 197, False: 2.25k]
  ------------------
  173|    197|	{	switch (wav_fmt->format)
  174|    197|		{	case WAVE_FORMAT_GSM610 :
  ------------------
  |  Branch (174:5): [True: 8, False: 189]
  ------------------
  175|      9|			case WAVE_FORMAT_IPP_ITU_G_723_1 :
  ------------------
  |  Branch (175:4): [True: 1, False: 196]
  ------------------
  176|     15|			case WAVE_FORMAT_MPEGLAYER3 :
  ------------------
  |  Branch (176:4): [True: 6, False: 191]
  ------------------
  177|     15|					psf_log_printf (psf, "  Bit Width     : %d\n", wav_fmt->min.bitwidth) ;
  178|     15|					break ;
  179|    182|			default :
  ------------------
  |  Branch (179:4): [True: 182, False: 15]
  ------------------
  180|    182|					psf_log_printf (psf, "  Bit Width     : %d (should not be 0)\n", wav_fmt->min.bitwidth) ;
  181|    197|			}
  182|    197|		}
  183|  2.25k|	else
  184|  2.25k|	{	switch (wav_fmt->format)
  185|  2.25k|		{	case WAVE_FORMAT_GSM610 :
  ------------------
  |  Branch (185:5): [True: 368, False: 1.88k]
  ------------------
  186|    369|			case WAVE_FORMAT_IPP_ITU_G_723_1 :
  ------------------
  |  Branch (186:4): [True: 1, False: 2.25k]
  ------------------
  187|    386|			case WAVE_FORMAT_MPEGLAYER3 :
  ------------------
  |  Branch (187:4): [True: 17, False: 2.23k]
  ------------------
  188|    386|					psf_log_printf (psf, "  Bit Width     : %d (should be 0)\n", wav_fmt->min.bitwidth) ;
  189|    386|					break ;
  190|  1.86k|			default :
  ------------------
  |  Branch (190:4): [True: 1.86k, False: 386]
  ------------------
  191|  1.86k|					psf_log_printf (psf, "  Bit Width     : %d\n", wav_fmt->min.bitwidth) ;
  192|  2.25k|			}
  193|  2.49k|		} ;
  194|       |
  195|  2.49k|	psf->sf.samplerate	= wav_fmt->min.samplerate ;
  196|  2.49k|	psf->sf.frames 		= 0 ;					/* Correct this when reading data chunk. */
  197|  2.49k|	psf->sf.channels	= wav_fmt->min.channels ;
  198|       |
  199|  2.49k|	switch (wav_fmt->format)
  200|  2.49k|	{	case WAVE_FORMAT_PCM :
  ------------------
  |  Branch (200:4): [True: 326, False: 2.17k]
  ------------------
  201|    579|		case WAVE_FORMAT_IEEE_FLOAT :
  ------------------
  |  Branch (201:3): [True: 253, False: 2.24k]
  ------------------
  202|    579|				bytespersec = wav_fmt->min.samplerate * wav_fmt->min.blockalign ;
  203|    579|				if (wav_fmt->min.bytespersec != (unsigned) bytespersec)
  ------------------
  |  Branch (203:9): [True: 547, False: 32]
  ------------------
  204|    547|					psf_log_printf (psf, "  Bytes/sec     : %d (should be %d)\n", wav_fmt->min.bytespersec, bytespersec) ;
  205|     32|				else
  206|     32|					psf_log_printf (psf, "  Bytes/sec     : %d\n", wav_fmt->min.bytespersec) ;
  207|       |
  208|    579|				psf->bytewidth = BITWIDTH2BYTES (wav_fmt->min.bitwidth) ;
  ------------------
  |  |   80|    579|#define	BITWIDTH2BYTES(x)	(((x) + 7) / 8)
  ------------------
  209|    579|				break ;
  210|       |
  211|    165|		case WAVE_FORMAT_ALAW :
  ------------------
  |  Branch (211:3): [True: 165, False: 2.33k]
  ------------------
  212|    356|		case WAVE_FORMAT_MULAW :
  ------------------
  |  Branch (212:3): [True: 191, False: 2.30k]
  ------------------
  213|    356|				if (wav_fmt->min.bytespersec != wav_fmt->min.samplerate * wav_fmt->min.blockalign)
  ------------------
  |  Branch (213:9): [True: 333, False: 23]
  ------------------
  214|    333|					psf_log_printf (psf, "  Bytes/sec     : %d (should be %d)\n", wav_fmt->min.bytespersec, wav_fmt->min.samplerate * wav_fmt->min.blockalign) ;
  215|     23|				else
  216|     23|					psf_log_printf (psf, "  Bytes/sec     : %d\n", wav_fmt->min.bytespersec) ;
  217|       |
  218|    356|				psf->bytewidth = 1 ;
  219|    356|				if (fmtsize >= 18)
  ------------------
  |  Branch (219:9): [True: 289, False: 67]
  ------------------
  220|    289|				{	bytesread += psf_binheader_readf (psf, "2", &(wav_fmt->size20.extrabytes)) ;
  221|    289|					psf_log_printf (psf, "  Extra Bytes   : %d\n", wav_fmt->size20.extrabytes) ;
  222|    289|					} ;
  223|    356|				break ;
  224|       |
  225|    237|		case WAVE_FORMAT_IMA_ADPCM :
  ------------------
  |  Branch (225:3): [True: 237, False: 2.26k]
  ------------------
  226|    237|				if (wav_fmt->min.bitwidth != 4)
  ------------------
  |  Branch (226:9): [True: 2, False: 235]
  ------------------
  227|      2|					return SFE_WAV_ADPCM_NOT4BIT ;
  228|    235|				if (wav_fmt->min.channels < 1 || wav_fmt->min.channels > 2)
  ------------------
  |  Branch (228:9): [True: 1, False: 234]
  |  Branch (228:38): [True: 3, False: 231]
  ------------------
  229|      4|					return SFE_WAV_ADPCM_CHANNELS ;
  230|       |
  231|    231|				bytesread += psf_binheader_readf (psf, "22", &(wav_fmt->ima.extrabytes), &(wav_fmt->ima.samplesperblock)) ;
  232|    231|				psf_log_printf (psf, "  Extra Bytes   : %d\n", wav_fmt->ima.extrabytes) ;
  233|    231|				if (wav_fmt->ima.samplesperblock < 1)
  ------------------
  |  Branch (233:9): [True: 1, False: 230]
  ------------------
  234|      1|				{	psf_log_printf (psf, "  Samples/Block : %d (should be > 0)\n", wav_fmt->ima.samplesperblock) ;
  235|      1|					return SFE_WAV_ADPCM_SAMPLES ;
  236|      1|					}
  237|    230|				else
  238|    230|					psf_log_printf (psf, "  Samples/Block : %d\n", wav_fmt->ima.samplesperblock) ;
  239|       |
  240|    230|				bytespersec = (wav_fmt->ima.samplerate * wav_fmt->ima.blockalign) / wav_fmt->ima.samplesperblock ;
  241|    230|				if (wav_fmt->ima.bytespersec != (unsigned) bytespersec)
  ------------------
  |  Branch (241:9): [True: 228, False: 2]
  ------------------
  242|    228|					psf_log_printf (psf, "  Bytes/sec     : %d (should be %d)\n", wav_fmt->ima.bytespersec, bytespersec) ;
  243|      2|				else
  244|      2|					psf_log_printf (psf, "  Bytes/sec     : %d\n", wav_fmt->ima.bytespersec) ;
  245|       |
  246|    230|				break ;
  247|       |
  248|    254|		case WAVE_FORMAT_MS_ADPCM :
  ------------------
  |  Branch (248:3): [True: 254, False: 2.24k]
  ------------------
  249|    254|				if (wav_fmt->msadpcm.bitwidth != 4)
  ------------------
  |  Branch (249:9): [True: 16, False: 238]
  ------------------
  250|     16|					return SFE_WAV_ADPCM_NOT4BIT ;
  251|    238|				if (wav_fmt->msadpcm.channels < 1 || wav_fmt->msadpcm.channels > 2)
  ------------------
  |  Branch (251:9): [True: 1, False: 237]
  |  Branch (251:42): [True: 9, False: 228]
  ------------------
  252|     10|					return SFE_WAV_ADPCM_CHANNELS ;
  253|       |
  254|    228|				bytesread += psf_binheader_readf (psf, "222", &(wav_fmt->msadpcm.extrabytes),
  255|    228|								&(wav_fmt->msadpcm.samplesperblock), &(wav_fmt->msadpcm.numcoeffs)) ;
  256|       |
  257|    228|				psf_log_printf (psf, "  Extra Bytes   : %d\n", wav_fmt->msadpcm.extrabytes) ;
  258|    228|				if (wav_fmt->ima.samplesperblock < 1)
  ------------------
  |  Branch (258:9): [True: 4, False: 224]
  ------------------
  259|      4|				{	psf_log_printf (psf, "  Samples/Block : %d (should be > 0)\n", wav_fmt->ima.samplesperblock) ;
  260|      4|					return SFE_WAV_ADPCM_SAMPLES ;
  261|      4|					}
  262|    224|				else
  263|    224|					psf_log_printf (psf, "  Samples/Block : %d\n", wav_fmt->ima.samplesperblock) ;
  264|       |
  265|    224|				bytespersec = (wav_fmt->min.samplerate * wav_fmt->min.blockalign) / wav_fmt->msadpcm.samplesperblock ;
  266|    224|				if (wav_fmt->min.bytespersec == (unsigned) bytespersec)
  ------------------
  |  Branch (266:9): [True: 1, False: 223]
  ------------------
  267|      1|					psf_log_printf (psf, "  Bytes/sec     : %d\n", wav_fmt->min.bytespersec) ;
  268|    223|				else if (wav_fmt->min.bytespersec == (wav_fmt->min.samplerate / wav_fmt->msadpcm.samplesperblock) * wav_fmt->min.blockalign)
  ------------------
  |  Branch (268:14): [True: 2, False: 221]
  ------------------
  269|      2|					psf_log_printf (psf, "  Bytes/sec     : %d (should be %d (MS BUG!))\n", wav_fmt->min.bytespersec, bytespersec) ;
  270|    221|				else
  271|    221|					psf_log_printf (psf, "  Bytes/sec     : %d (should be %d)\n", wav_fmt->min.bytespersec, bytespersec) ;
  272|       |
  273|    224|				if (wav_fmt->msadpcm.numcoeffs > ARRAY_LEN (wav_fmt->msadpcm.coeffs))
  ------------------
  |  |   88|    224|#define		ARRAY_LEN(x)	((int) (sizeof (x) / sizeof ((x) [0])))
  ------------------
  |  Branch (273:9): [True: 55, False: 169]
  ------------------
  274|     55|				{	psf_log_printf (psf, "  No. of Coeffs : %d (should be <= %d)\n", wav_fmt->msadpcm.numcoeffs, ARRAY_LEN (wav_fmt->msadpcm.coeffs)) ;
  ------------------
  |  |   88|     55|#define		ARRAY_LEN(x)	((int) (sizeof (x) / sizeof ((x) [0])))
  ------------------
  275|     55|					wav_fmt->msadpcm.numcoeffs = ARRAY_LEN (wav_fmt->msadpcm.coeffs) ;
  ------------------
  |  |   88|     55|#define		ARRAY_LEN(x)	((int) (sizeof (x) / sizeof ((x) [0])))
  ------------------
  276|     55|					}
  277|    169|				else
  278|    169|					psf_log_printf (psf, "  No. of Coeffs : %d\n", wav_fmt->msadpcm.numcoeffs) ;
  279|       |
  280|    224|				psf_log_printf (psf, "    Index   Coeffs1   Coeffs2\n") ;
  281|    625|				for (k = 0 ; k < wav_fmt->msadpcm.numcoeffs ; k++)
  ------------------
  |  Branch (281:18): [True: 401, False: 224]
  ------------------
  282|    401|				{	char buffer [128] ;
  283|       |
  284|    401|					bytesread +=
  285|    401|						psf_binheader_readf (psf, "22", &(wav_fmt->msadpcm.coeffs [k].coeff1), &(wav_fmt->msadpcm.coeffs [k].coeff2)) ;
  286|    401|					snprintf (buffer, sizeof (buffer), "     %2d     %7d   %7d\n", k, wav_fmt->msadpcm.coeffs [k].coeff1, wav_fmt->msadpcm.coeffs [k].coeff2) ;
  287|    401|					psf_log_printf (psf, buffer) ;
  288|    401|					} ;
  289|    224|				break ;
  290|       |
  291|    376|		case WAVE_FORMAT_GSM610 :
  ------------------
  |  Branch (291:3): [True: 376, False: 2.12k]
  ------------------
  292|    376|				if (wav_fmt->gsm610.channels != 1 || wav_fmt->gsm610.blockalign != 65)
  ------------------
  |  Branch (292:9): [True: 2, False: 374]
  |  Branch (292:42): [True: 9, False: 365]
  ------------------
  293|     11|					return SFE_WAV_GSM610_FORMAT ;
  294|       |
  295|    365|				bytesread +=
  296|    365|				psf_binheader_readf (psf, "22", &(wav_fmt->gsm610.extrabytes), &(wav_fmt->gsm610.samplesperblock)) ;
  297|       |
  298|    365|				if (wav_fmt->gsm610.samplesperblock != 320)
  ------------------
  |  Branch (298:9): [True: 3, False: 362]
  ------------------
  299|      3|					return SFE_WAV_GSM610_FORMAT ;
  300|       |
  301|    362|				bytespersec = (wav_fmt->gsm610.samplerate * wav_fmt->gsm610.blockalign) / wav_fmt->gsm610.samplesperblock ;
  302|    362|				if (wav_fmt->gsm610.bytespersec != (unsigned) bytespersec)
  ------------------
  |  Branch (302:9): [True: 352, False: 10]
  ------------------
  303|    352|					psf_log_printf (psf, "  Bytes/sec     : %d (should be %d)\n", wav_fmt->gsm610.bytespersec, bytespersec) ;
  304|     10|				else
  305|     10|					psf_log_printf (psf, "  Bytes/sec     : %d\n", wav_fmt->gsm610.bytespersec) ;
  306|       |
  307|    362|				psf_log_printf (psf, "  Extra Bytes   : %d\n", wav_fmt->gsm610.extrabytes) ;
  308|    362|				psf_log_printf (psf, "  Samples/Block : %d\n", wav_fmt->gsm610.samplesperblock) ;
  309|    362|				break ;
  310|       |
  311|     23|		case WAVE_FORMAT_MPEGLAYER3 :
  ------------------
  |  Branch (311:3): [True: 23, False: 2.47k]
  ------------------
  312|     23|				bytesread += psf_binheader_readf (psf, "24222", &(wav_fmt->mpeg3.extrabytes),
  313|     23|					&(wav_fmt->mpeg3.id), &(wav_fmt->mpeg3.flags), &(wav_fmt->mpeg3.blocksize),
  314|     23|					&(wav_fmt->mpeg3.samplesperblock), &(wav_fmt->mpeg3.codecdelay)) ;
  315|       |
  316|     23|				psf_log_printf (psf, "  Bytes/sec     : %d\n", wav_fmt->mpeg3.bytespersec) ;
  317|     23|				psf_log_printf (psf, "  Extra Bytes   : %d\n", wav_fmt->mpeg3.extrabytes) ;
  318|     23|				if (wav_fmt->mpeg3.id != 1)
  ------------------
  |  Branch (318:9): [True: 22, False: 1]
  ------------------
  319|     22|					psf_log_printf (psf, "  ID            : %d (unknown, should be 1)\n", wav_fmt->mpeg3.id) ;
  320|      1|				else
  321|      1|					psf_log_printf (psf, "  ID            : MPEGLAYER3_ID_MPEG\n") ;
  322|     23|				psf_log_printf (psf, "  Flags         : 0x%08x\n", wav_fmt->mpeg3.flags) ;
  323|     23|				psf_log_printf (psf, "  Block Size    : %d\n", wav_fmt->mpeg3.blocksize) ;
  324|     23|				psf_log_printf (psf, "  Samples/Block : %d\n", wav_fmt->mpeg3.samplesperblock) ;
  325|     23|				psf_log_printf (psf, "  Codec Delay   : %d samples\n", wav_fmt->mpeg3.codecdelay) ;
  326|     23|				break ;
  327|       |
  328|    203|		case WAVE_FORMAT_EXTENSIBLE :
  ------------------
  |  Branch (328:3): [True: 203, False: 2.29k]
  ------------------
  329|    203|				if (wav_fmt->ext.bytespersec != wav_fmt->ext.samplerate * wav_fmt->ext.blockalign)
  ------------------
  |  Branch (329:9): [True: 200, False: 3]
  ------------------
  330|    200|					psf_log_printf (psf, "  Bytes/sec     : %d (should be %d)\n", wav_fmt->ext.bytespersec, wav_fmt->ext.samplerate * wav_fmt->ext.blockalign) ;
  331|      3|				else
  332|      3|					psf_log_printf (psf, "  Bytes/sec     : %d\n", wav_fmt->ext.bytespersec) ;
  333|       |
  334|    203|				bytesread +=
  335|    203|				psf_binheader_readf (psf, "224", &(wav_fmt->ext.extrabytes), &(wav_fmt->ext.validbits),
  336|    203|						&(wav_fmt->ext.channelmask)) ;
  337|       |
  338|    203|				psf_log_printf (psf, "  Valid Bits    : %d\n", wav_fmt->ext.validbits) ;
  339|       |
  340|    203|				if (wav_fmt->ext.channelmask == 0)
  ------------------
  |  Branch (340:9): [True: 46, False: 157]
  ------------------
  341|     46|					psf_log_printf (psf, "  Channel Mask  : 0x0 (should not be zero)\n") ;
  342|    157|				else
  343|    157|				{	char buffer [512] ;
  344|    157|					unsigned bit ;
  345|       |
  346|    157|					wpriv->wavex_channelmask = wav_fmt->ext.channelmask ;
  347|       |
  348|       |					/* It's probably wise to ignore the channel mask if it is all zero */
  349|    157|					free (psf->channel_map) ;
  350|       |
  351|    157|					if ((psf->channel_map = calloc (psf->sf.channels, sizeof (psf->channel_map [0]))) == NULL)
  ------------------
  |  Branch (351:10): [True: 0, False: 157]
  ------------------
  352|      0|						return SFE_MALLOC_FAILED ;
  353|       |
  354|       |					/* Terminate the buffer we're going to append_snprintf into. */
  355|    157|					buffer [0] = 0 ;
  356|       |
  357|  2.69k|					for (bit = k = 0 ; bit < ARRAY_LEN (channel_mask_bits) && k < psf->sf.channels ; bit++)
  ------------------
  |  |   88|  5.39k|#define		ARRAY_LEN(x)	((int) (sizeof (x) / sizeof ((x) [0])))
  ------------------
  |  Branch (357:25): [True: 2.56k, False: 136]
  |  Branch (357:64): [True: 2.54k, False: 21]
  ------------------
  358|  2.54k|					{
  359|  2.54k|						if (wav_fmt->ext.channelmask & (1 << bit))
  ------------------
  |  Branch (359:11): [True: 1.05k, False: 1.49k]
  ------------------
  360|  1.05k|						{	if (k > psf->sf.channels)
  ------------------
  |  Branch (360:13): [True: 0, False: 1.05k]
  ------------------
  361|      0|							{	psf_log_printf (psf, "*** More channel map bits than there are channels.\n") ;
  362|      0|								break ;
  363|  1.05k|								} ;
  364|       |
  365|  1.05k|							psf->channel_map [k++] = channel_mask_bits [bit].id ;
  366|  1.05k|							append_snprintf (buffer, sizeof (buffer), "%s, ", channel_mask_bits [bit].name) ;
  367|  2.54k|							} ;
  368|  2.54k|						} ;
  369|       |
  370|       |					/* Remove trailing ", ". */
  371|    157|					bit = strlen (buffer) ;
  372|    157|					if (bit >= 2)
  ------------------
  |  Branch (372:10): [True: 144, False: 13]
  ------------------
  373|    144|					{	buffer [--bit] = 0 ;
  374|    144|						buffer [--bit] = 0 ;
  375|    144|						} ;
  376|       |
  377|    157|					if (k != psf->sf.channels)
  ------------------
  |  Branch (377:10): [True: 136, False: 21]
  ------------------
  378|    136|					{	psf_log_printf (psf, "  Channel Mask  : 0x%X\n", wav_fmt->ext.channelmask) ;
  379|    136|						psf_log_printf (psf, "*** Less channel map bits than there are channels.\n") ;
  380|    136|						}
  381|     21|					else
  382|     21|						psf_log_printf (psf, "  Channel Mask  : 0x%X (%s)\n", wav_fmt->ext.channelmask, buffer) ;
  383|    203|					} ;
  384|       |
  385|    203|				bytesread += psf_binheader_readf (psf, "422", &(wav_fmt->ext.esf.esf_field1), &(wav_fmt->ext.esf.esf_field2), &(wav_fmt->ext.esf.esf_field3)) ;
  386|       |
  387|       |				/* compare the esf_fields with each known GUID? and print? */
  388|    203|				psf_log_printf (psf, "  Subformat\n") ;
  389|    203|				psf_log_printf (psf, "    esf_field1 : 0x%X\n", wav_fmt->ext.esf.esf_field1) ;
  390|    203|				psf_log_printf (psf, "    esf_field2 : 0x%X\n", wav_fmt->ext.esf.esf_field2) ;
  391|    203|				psf_log_printf (psf, "    esf_field3 : 0x%X\n", wav_fmt->ext.esf.esf_field3) ;
  392|    203|				psf_log_printf (psf, "    esf_field4 : ") ;
  393|  1.82k|				for (k = 0 ; k < 8 ; k++)
  ------------------
  |  Branch (393:18): [True: 1.62k, False: 203]
  ------------------
  394|  1.62k|				{	bytesread += psf_binheader_readf (psf, "1", &(wav_fmt->ext.esf.esf_field4 [k])) ;
  395|  1.62k|					psf_log_printf (psf, "0x%X ", wav_fmt->ext.esf.esf_field4 [k] & 0xFF) ;
  396|  1.62k|					} ;
  397|    203|				psf_log_printf (psf, "\n") ;
  398|    203|				psf->bytewidth = BITWIDTH2BYTES (wav_fmt->ext.bitwidth) ;
  ------------------
  |  |   80|    203|#define	BITWIDTH2BYTES(x)	(((x) + 7) / 8)
  ------------------
  399|       |
  400|       |				/* Compare GUIDs for known ones. */
  401|    203|				if (wavex_guid_equal (&wav_fmt->ext.esf, &MSGUID_SUBTYPE_PCM))
  ------------------
  |  Branch (401:9): [True: 4, False: 199]
  ------------------
  402|      4|				{	psf->sf.format = SF_FORMAT_WAVEX | u_bitwidth_to_subformat (psf->bytewidth * 8) ;
  403|      4|					psf_log_printf (psf, "    format : pcm\n") ;
  404|      4|					}
  405|    199|				else if (wavex_guid_equal (&wav_fmt->ext.esf, &MSGUID_SUBTYPE_MS_ADPCM))
  ------------------
  |  Branch (405:14): [True: 4, False: 195]
  ------------------
  406|      4|				{	psf->sf.format = (SF_FORMAT_WAVEX | SF_FORMAT_MS_ADPCM) ;
  407|      4|					psf_log_printf (psf, "    format : ms adpcm\n") ;
  408|      4|					}
  409|    195|				else if (wavex_guid_equal (&wav_fmt->ext.esf, &MSGUID_SUBTYPE_IEEE_FLOAT))
  ------------------
  |  Branch (409:14): [True: 8, False: 187]
  ------------------
  410|      8|				{	psf->sf.format = SF_FORMAT_WAVEX | ((psf->bytewidth == 8) ? SF_FORMAT_DOUBLE : SF_FORMAT_FLOAT) ;
  ------------------
  |  Branch (410:43): [True: 2, False: 6]
  ------------------
  411|      8|					psf_log_printf (psf, "    format : IEEE float\n") ;
  412|      8|					}
  413|    187|				else if (wavex_guid_equal (&wav_fmt->ext.esf, &MSGUID_SUBTYPE_ALAW))
  ------------------
  |  Branch (413:14): [True: 1, False: 186]
  ------------------
  414|      1|				{	psf->sf.format = (SF_FORMAT_WAVEX | SF_FORMAT_ALAW) ;
  415|      1|					psf_log_printf (psf, "    format : A-law\n") ;
  416|      1|					}
  417|    186|				else if (wavex_guid_equal (&wav_fmt->ext.esf, &MSGUID_SUBTYPE_MULAW))
  ------------------
  |  Branch (417:14): [True: 2, False: 184]
  ------------------
  418|      2|				{	psf->sf.format = (SF_FORMAT_WAVEX | SF_FORMAT_ULAW) ;
  419|      2|					psf_log_printf (psf, "    format : u-law\n") ;
  420|      2|					}
  421|    184|				else if (wavex_guid_equal (&wav_fmt->ext.esf, &MSGUID_SUBTYPE_AMBISONIC_B_FORMAT_PCM))
  ------------------
  |  Branch (421:14): [True: 2, False: 182]
  ------------------
  422|      2|				{	psf->sf.format = SF_FORMAT_WAVEX | u_bitwidth_to_subformat (psf->bytewidth * 8) ;
  423|      2|					psf_log_printf (psf, "    format : pcm (Ambisonic B)\n") ;
  424|      2|					wpriv->wavex_ambisonic = SF_AMBISONIC_B_FORMAT ;
  425|      2|					}
  426|    182|				else if (wavex_guid_equal (&wav_fmt->ext.esf, &MSGUID_SUBTYPE_AMBISONIC_B_FORMAT_IEEE_FLOAT))
  ------------------
  |  Branch (426:14): [True: 4, False: 178]
  ------------------
  427|      4|				{	psf->sf.format = SF_FORMAT_WAVEX | ((psf->bytewidth == 8) ? SF_FORMAT_DOUBLE : SF_FORMAT_FLOAT) ;
  ------------------
  |  Branch (427:43): [True: 3, False: 1]
  ------------------
  428|      4|					psf_log_printf (psf, "    format : IEEE float (Ambisonic B)\n") ;
  429|      4|					wpriv->wavex_ambisonic = SF_AMBISONIC_B_FORMAT ;
  430|      4|					}
  431|    178|				else
  432|    178|					return SFE_UNIMPLEMENTED ;
  433|       |
  434|     25|				break ;
  435|       |
  436|     65|		case WAVE_FORMAT_G721_ADPCM :
  ------------------
  |  Branch (436:3): [True: 65, False: 2.43k]
  ------------------
  437|     65|				psf_log_printf (psf, "  Bytes/sec     : %d\n", wav_fmt->g72x.bytespersec) ;
  438|     65|				if (fmtsize >= 20)
  ------------------
  |  Branch (438:9): [True: 40, False: 25]
  ------------------
  439|     40|				{	bytesread += psf_binheader_readf (psf, "22", &(wav_fmt->g72x.extrabytes), &(wav_fmt->g72x.auxblocksize)) ;
  440|     40|					if (wav_fmt->g72x.extrabytes == 0)
  ------------------
  |  Branch (440:10): [True: 30, False: 10]
  ------------------
  441|     30|						psf_log_printf (psf, "  Extra Bytes   : %d (should be 2)\n", wav_fmt->g72x.extrabytes) ;
  442|     10|					else
  443|     10|						psf_log_printf (psf, "  Extra Bytes   : %d\n", wav_fmt->g72x.extrabytes) ;
  444|     40|					psf_log_printf (psf, "  Aux Blk Size  : %d\n", wav_fmt->g72x.auxblocksize) ;
  445|     40|					}
  446|     25|				else if (fmtsize == 18)
  ------------------
  |  Branch (446:14): [True: 4, False: 21]
  ------------------
  447|      4|				{	bytesread += psf_binheader_readf (psf, "2", &(wav_fmt->g72x.extrabytes)) ;
  448|      4|					psf_log_printf (psf, "  Extra Bytes   : %d%s\n", wav_fmt->g72x.extrabytes, wav_fmt->g72x.extrabytes != 0 ? " (should be 0)" : "") ;
  ------------------
  |  Branch (448:81): [True: 3, False: 1]
  ------------------
  449|      4|					}
  450|     21|				else
  451|     21|					psf_log_printf (psf, "*** 'fmt ' chunk should be bigger than this!\n") ;
  452|     65|				break ;
  453|       |
  454|    325|		case WAVE_FORMAT_NMS_VBXADPCM :
  ------------------
  |  Branch (454:3): [True: 325, False: 2.17k]
  ------------------
  455|    325|				if (wav_fmt->min.channels != 1 || wav_fmt->min.bitwidth < 2 || wav_fmt->min.bitwidth * 20 + 2 != wav_fmt->min.blockalign)
  ------------------
  |  Branch (455:9): [True: 15, False: 310]
  |  Branch (455:39): [True: 1, False: 309]
  |  Branch (455:68): [True: 21, False: 288]
  ------------------
  456|     37|					return SFE_WAV_NMS_FORMAT ;
  457|       |
  458|    288|				bytespersec = (wav_fmt->min.samplerate * wav_fmt->min.blockalign) / 160 ;
  459|    288|				if (wav_fmt->min.bytespersec == (unsigned) bytespersec)
  ------------------
  |  Branch (459:9): [True: 1, False: 287]
  ------------------
  460|      1|					psf_log_printf (psf, "  Bytes/sec     : %d\n", wav_fmt->min.bytespersec) ;
  461|    287|				else
  462|    287|					psf_log_printf (psf, "  Bytes/sec     : %d (should be %d)\n", wav_fmt->min.bytespersec, bytespersec) ;
  463|    288|				if (fmtsize >= 18)
  ------------------
  |  Branch (463:9): [True: 36, False: 252]
  ------------------
  464|     36|				{	bytesread += psf_binheader_readf (psf, "2", &(wav_fmt->size20.extrabytes)) ;
  465|     36|					psf_log_printf (psf, "  Extra Bytes   : %d\n", wav_fmt->size20.extrabytes) ;
  466|     36|					} ;
  467|    288|				break ;
  468|       |
  469|     81|		default :
  ------------------
  |  Branch (469:3): [True: 81, False: 2.41k]
  ------------------
  470|     81|				psf_log_printf (psf, "*** No 'fmt ' chunk dumper for this format!\n") ;
  471|     81|				return SFE_WAV_BAD_FMT ;
  472|  2.49k|		} ;
  473|       |
  474|  2.15k|	if (bytesread > fmtsize)
  ------------------
  |  Branch (474:6): [True: 17, False: 2.13k]
  ------------------
  475|     17|	{	psf_log_printf (psf, "*** wavlike_read_fmt_chunk (bytesread > fmtsize)\n") ;
  476|     17|		return SFE_WAV_BAD_FMT ;
  477|     17|		}
  478|  2.13k|	else
  479|  2.13k|		psf_binheader_readf (psf, "j", fmtsize - bytesread) ;
  480|       |
  481|  2.13k|	psf->blockwidth = wav_fmt->min.channels * psf->bytewidth ;
  482|       |
  483|  2.13k|	return 0 ;
  484|  2.15k|} /* wavlike_read_fmt_chunk */
wavlike_analyze:
  524|     48|{	unsigned char buffer [4096] ;
  525|     48|	AUDIO_DETECT ad ;
  526|     48|	int format = 0 ;
  527|       |
  528|     48|	if (psf->is_pipe)
  ------------------
  |  Branch (528:6): [True: 0, False: 48]
  ------------------
  529|      0|	{	psf_log_printf (psf, "*** Error : Reading from a pipe. Can't analyze data section to figure out real data format.\n\n") ;
  530|      0|		return ;
  531|     48|		} ;
  532|       |
  533|     48|	psf_log_printf (psf, "---------------------------------------------------\n"
  534|     48|						"Format is known to be broken. Using detection code.\n") ;
  535|       |
  536|       |	/* Code goes here. */
  537|     48|	ad.endianness = SF_ENDIAN_LITTLE ;
  538|     48|	ad.channels = psf->sf.channels ;
  539|       |
  540|     48|	psf_fseek (psf, 3 * 4 * 50, SEEK_SET) ;
  541|       |
  542|  2.50k|	while (psf_fread (buffer, 1, sizeof (buffer), psf) == sizeof (buffer))
  ------------------
  |  Branch (542:9): [True: 2.46k, False: 36]
  ------------------
  543|  2.46k|	{	format = audio_detect (psf, &ad, buffer, sizeof (buffer)) ;
  544|  2.46k|		if (format != 0)
  ------------------
  |  Branch (544:7): [True: 12, False: 2.45k]
  ------------------
  545|     12|			break ;
  546|  2.46k|		} ;
  547|       |
  548|       |	/* Seek to start of DATA section. */
  549|     48|	psf_fseek (psf, psf->dataoffset, SEEK_SET) ;
  550|       |
  551|     48|	if (format == 0)
  ------------------
  |  Branch (551:6): [True: 36, False: 12]
  ------------------
  552|     36|	{	psf_log_printf (psf, "wavlike_analyze : detection failed.\n") ;
  553|     36|		return ;
  554|     36|		} ;
  555|       |
  556|     12|	switch (format)
  557|     12|	{	case SF_FORMAT_PCM_32 :
  ------------------
  |  Branch (557:4): [True: 7, False: 5]
  ------------------
  558|     12|		case SF_FORMAT_FLOAT :
  ------------------
  |  Branch (558:3): [True: 5, False: 7]
  ------------------
  559|     12|			psf_log_printf (psf, "wavlike_analyze : found format : 0x%X\n", format) ;
  560|     12|			psf->sf.format = (psf->sf.format & ~SF_FORMAT_SUBMASK) + format ;
  561|     12|			psf->bytewidth = 4 ;
  562|     12|			psf->blockwidth = (sf_count_t) psf->sf.channels * psf->bytewidth ;
  563|     12|			break ;
  564|       |
  565|      0|		case SF_FORMAT_PCM_24 :
  ------------------
  |  Branch (565:3): [True: 0, False: 12]
  ------------------
  566|      0|			psf_log_printf (psf, "wavlike_analyze : found format : 0x%X\n", format) ;
  567|      0|			psf->sf.format = (psf->sf.format & ~SF_FORMAT_SUBMASK) + format ;
  568|      0|			psf->bytewidth = 3 ;
  569|      0|			psf->blockwidth = (sf_count_t) psf->sf.channels * psf->bytewidth ;
  570|      0|			break ;
  571|       |
  572|      0|		default :
  ------------------
  |  Branch (572:3): [True: 0, False: 12]
  ------------------
  573|      0|			psf_log_printf (psf, "wavlike_analyze : unhandled format : 0x%X\n", format) ;
  574|      0|			break ;
  575|     12|		} ;
  576|       |
  577|     12|	return ;
  578|     12|} /* wavlike_analyze */
wavlike_format_str:
  702|  2.49k|{	int lower, upper, mid ;
  703|       |
  704|  2.49k|	lower = -1 ;
  705|  2.49k|	upper = sizeof (wave_descs) / sizeof (WAV_FORMAT_DESC) ;
  706|       |
  707|       |	/* binary search */
  708|  2.49k|	if ((wave_descs [0].ID <= k) && (k <= wave_descs [upper - 1].ID))
  ------------------
  |  Branch (708:6): [True: 2.49k, False: 5]
  |  Branch (708:34): [True: 2.49k, False: 2]
  ------------------
  709|  2.49k|	{
  710|  14.8k|		while (lower + 1 < upper)
  ------------------
  |  Branch (710:10): [True: 14.7k, False: 68]
  ------------------
  711|  14.7k|		{	mid = (upper + lower) / 2 ;
  712|       |
  713|  14.7k|			if (k == wave_descs [mid].ID)
  ------------------
  |  Branch (713:8): [True: 2.42k, False: 12.3k]
  ------------------
  714|  2.42k|				return wave_descs [mid].name ;
  715|  12.3k|			if (k < wave_descs [mid].ID)
  ------------------
  |  Branch (715:8): [True: 8.38k, False: 3.95k]
  ------------------
  716|  8.38k|				upper = mid ;
  717|  3.95k|			else
  718|  3.95k|				lower = mid ;
  719|  12.3k|			} ;
  720|     75|		} ;
  721|       |
  722|     75|	return "Unknown format" ;
  723|  2.49k|} /* wavlike_format_str */
wavlike_read_bext_chunk:
  738|  9.62k|{
  739|  9.62k|	SF_BROADCAST_INFO_16K * b ;
  740|  9.62k|	uint32_t bytes = 0 ;
  741|       |
  742|  9.62k|	if (chunksize < WAV_BEXT_MIN_CHUNK_SIZE)
  ------------------
  |  |   33|  9.62k|#define WAV_BEXT_MIN_CHUNK_SIZE		602
  ------------------
  |  Branch (742:6): [True: 9.10k, False: 526]
  ------------------
  743|  9.10k|	{	psf_log_printf (psf, "bext : %u (should be >= %d)\n", chunksize, WAV_BEXT_MIN_CHUNK_SIZE) ;
  ------------------
  |  |   33|  9.10k|#define WAV_BEXT_MIN_CHUNK_SIZE		602
  ------------------
  744|  9.10k|		psf_binheader_readf (psf, "j", chunksize) ;
  745|  9.10k|		return 0 ;
  746|  9.10k|		} ;
  747|       |
  748|    526|	if (chunksize > WAV_BEXT_MAX_CHUNK_SIZE)
  ------------------
  |  |   34|    526|#define WAV_BEXT_MAX_CHUNK_SIZE		(10 * 1024)
  ------------------
  |  Branch (748:6): [True: 128, False: 398]
  ------------------
  749|    128|	{	psf_log_printf (psf, "bext : %u (should be < %d)\n", chunksize, WAV_BEXT_MAX_CHUNK_SIZE) ;
  ------------------
  |  |   34|    128|#define WAV_BEXT_MAX_CHUNK_SIZE		(10 * 1024)
  ------------------
  750|    128|		psf_binheader_readf (psf, "j", chunksize) ;
  751|    128|		return 0 ;
  752|    398|		} ;
  753|       |
  754|    398|	if (chunksize >= sizeof (SF_BROADCAST_INFO_16K))
  ------------------
  |  Branch (754:6): [True: 0, False: 398]
  ------------------
  755|      0|	{	psf_log_printf (psf, "bext : %u too big to be handled\n", chunksize) ;
  756|      0|		psf_binheader_readf (psf, "j", chunksize) ;
  757|      0|		return 0 ;
  758|    398|		} ;
  759|       |
  760|    398|	psf_log_printf (psf, "bext : %u\n", chunksize) ;
  761|       |
  762|    398|	if (!psf->broadcast_16k)
  ------------------
  |  Branch (762:6): [True: 34, False: 364]
  ------------------
  763|     34|	{	psf->broadcast_16k = broadcast_var_alloc () ;
  764|     34|		if (!psf->broadcast_16k)
  ------------------
  |  Branch (764:7): [True: 0, False: 34]
  ------------------
  765|      0|		{	psf->error = SFE_MALLOC_FAILED ;
  766|      0|			return psf->error ;
  767|      0|			}
  768|     34|		}
  769|    364|	else
  770|    364|	{	psf_log_printf (psf, "bext : found more than one bext chunk, using last one.\n") ;
  771|    364|		memset (psf->broadcast_16k, 0, sizeof (SF_BROADCAST_INFO_16K)) ;
  772|    364|		}
  773|       |
  774|    398|	b = psf->broadcast_16k ;
  775|       |
  776|    398|	bytes += psf_binheader_readf (psf, "b", b->description, sizeof (b->description)) ;
  777|    398|	bytes += psf_binheader_readf (psf, "b", b->originator, sizeof (b->originator)) ;
  778|    398|	bytes += psf_binheader_readf (psf, "b", b->originator_reference, sizeof (b->originator_reference)) ;
  779|    398|	bytes += psf_binheader_readf (psf, "b", b->origination_date, sizeof (b->origination_date)) ;
  780|    398|	bytes += psf_binheader_readf (psf, "b", b->origination_time, sizeof (b->origination_time)) ;
  781|    398|	bytes += psf_binheader_readf (psf, "442", &b->time_reference_low, &b->time_reference_high, &b->version) ;
  782|    398|	bytes += psf_binheader_readf (psf, "b", &b->umid, sizeof (b->umid)) ;
  783|    398|	bytes += psf_binheader_readf (psf, "22", &b->loudness_value, &b->loudness_range) ;
  784|    398|	bytes += psf_binheader_readf (psf, "222", &b->max_true_peak_level, &b->max_momentary_loudness, &b->max_shortterm_loudness) ;
  785|    398|	bytes += psf_binheader_readf (psf, "j", 180) ;
  786|       |
  787|    398|	if (chunksize > WAV_BEXT_MIN_CHUNK_SIZE)
  ------------------
  |  |   33|    398|#define WAV_BEXT_MIN_CHUNK_SIZE		602
  ------------------
  |  Branch (787:6): [True: 271, False: 127]
  ------------------
  788|    271|	{	/* File has coding history data. */
  789|       |
  790|    271|		b->coding_history_size = chunksize - WAV_BEXT_MIN_CHUNK_SIZE ;
  ------------------
  |  |   33|    271|#define WAV_BEXT_MIN_CHUNK_SIZE		602
  ------------------
  791|       |
  792|       |		/* We do not parse the coding history */
  793|    271|		bytes += psf_binheader_readf (psf, "b", BHWv (b->coding_history), BHWz (b->coding_history_size)) ;
  ------------------
  |  |  126|    271|#define BHWv(x) ((const void *) (x))
  ------------------
              		bytes += psf_binheader_readf (psf, "b", BHWv (b->coding_history), BHWz (b->coding_history_size)) ;
  ------------------
  |  |  127|    271|#define BHWz(x) ((size_t) (x))
  ------------------
  794|    271|		} ;
  795|       |
  796|    398|	if (bytes < chunksize)
  ------------------
  |  Branch (796:6): [True: 37, False: 361]
  ------------------
  797|     37|		psf_binheader_readf (psf, "j", BHWj (chunksize - bytes)) ;
  ------------------
  |  |  122|     37|#define BHWj(x) ((size_t) (x))
  ------------------
  798|       |
  799|    398|	return 0 ;
  800|    398|} /* wavlike_read_bext_chunk */
wavlike_read_cart_chunk:
  837|  1.65k|{	SF_CART_INFO_16K *c ;
  838|  1.65k|	uint32_t bytes = 0 ;
  839|  1.65k|	int k ;
  840|       |
  841|  1.65k|	if (chunksize < WAV_CART_MIN_CHUNK_SIZE)
  ------------------
  |  |   36|  1.65k|#define WAV_CART_MIN_CHUNK_SIZE		2048
  ------------------
  |  Branch (841:6): [True: 323, False: 1.33k]
  ------------------
  842|    323|	{	psf_log_printf (psf, "cart : %u (should be >= %d)\n", chunksize, WAV_CART_MIN_CHUNK_SIZE) ;
  ------------------
  |  |   36|    323|#define WAV_CART_MIN_CHUNK_SIZE		2048
  ------------------
  843|    323|		psf_binheader_readf (psf, "j", chunksize) ;
  844|    323|		return 0 ;
  845|  1.33k|		} ;
  846|  1.33k|	if (chunksize > WAV_CART_MAX_CHUNK_SIZE)
  ------------------
  |  |   37|  1.33k|#define WAV_CART_MAX_CHUNK_SIZE		0xffffffff
  ------------------
  |  Branch (846:6): [True: 0, False: 1.33k]
  ------------------
  847|      0|	{	psf_log_printf (psf, "cart : %u (should be < %d)\n", chunksize, WAV_CART_MAX_CHUNK_SIZE) ;
  ------------------
  |  |   37|      0|#define WAV_CART_MAX_CHUNK_SIZE		0xffffffff
  ------------------
  848|      0|		psf_binheader_readf (psf, "j", chunksize) ;
  849|      0|		return 0 ;
  850|  1.33k|		} ;
  851|       |
  852|       |	/*
  853|       |	**	SF_CART_INFO_16K has an extra field 'tag_text_size' that isn't part
  854|       |	**	of the chunk, so don't include it in the size check.
  855|       |	*/
  856|  1.33k|	if (chunksize >= sizeof (SF_CART_INFO_16K) - 4)
  ------------------
  |  Branch (856:6): [True: 1.09k, False: 240]
  ------------------
  857|  1.09k|	{	psf_log_printf (psf, "cart : %u too big to be handled\n", chunksize) ;
  858|  1.09k|		psf_binheader_readf (psf, "j", chunksize) ;
  859|  1.09k|		return 0 ;
  860|  1.09k|		} ;
  861|       |
  862|    240|	psf_log_printf (psf, "cart : %u\n", chunksize) ;
  863|       |
  864|    240|	if (psf->cart_16k)
  ------------------
  |  Branch (864:6): [True: 208, False: 32]
  ------------------
  865|    208|	{	psf_log_printf (psf, "  Found more than one cart chunk, using last one.\n") ;
  866|    208|		free (psf->cart_16k) ;
  867|    208|		psf->cart_16k = NULL ;
  868|    208|		} ;
  869|       |
  870|    240|	if ((psf->cart_16k = cart_var_alloc ()) == NULL)
  ------------------
  |  Branch (870:6): [True: 0, False: 240]
  ------------------
  871|      0|	{	psf->error = SFE_MALLOC_FAILED ;
  872|      0|		return psf->error ;
  873|    240|		} ;
  874|       |
  875|    240|	c = psf->cart_16k ;
  876|    240|	bytes += psf_binheader_readf (psf, "b", c->version, sizeof (c->version)) ;
  877|    240|	bytes += psf_binheader_readf (psf, "b", c->title, sizeof (c->title)) ;
  878|    240|	bytes += psf_binheader_readf (psf, "b", c->artist, sizeof (c->artist)) ;
  879|    240|	bytes += psf_binheader_readf (psf, "b", c->cut_id, sizeof (c->cut_id)) ;
  880|    240|	bytes += psf_binheader_readf (psf, "b", c->client_id, sizeof (c->client_id)) ;
  881|    240|	bytes += psf_binheader_readf (psf, "b", c->category, sizeof (c->category)) ;
  882|    240|	bytes += psf_binheader_readf (psf, "b", c->classification, sizeof (c->classification)) ;
  883|    240|	bytes += psf_binheader_readf (psf, "b", c->out_cue, sizeof (c->out_cue)) ;
  884|    240|	bytes += psf_binheader_readf (psf, "b", c->start_date, sizeof (c->start_date)) ;
  885|    240|	bytes += psf_binheader_readf (psf, "b", c->start_time, sizeof (c->start_time)) ;
  886|    240|	bytes += psf_binheader_readf (psf, "b", c->end_date, sizeof (c->end_date)) ;
  887|    240|	bytes += psf_binheader_readf (psf, "b", c->end_time, sizeof (c->end_time)) ;
  888|    240|	bytes += psf_binheader_readf (psf, "b", c->producer_app_id, sizeof (c->producer_app_id)) ;
  889|    240|	bytes += psf_binheader_readf (psf, "b", c->producer_app_version, sizeof (c->producer_app_version)) ;
  890|    240|	bytes += psf_binheader_readf (psf, "b", c->user_def, sizeof (c->user_def)) ;
  891|    240|	bytes += psf_binheader_readf (psf, "e4", &c->level_reference, sizeof (c->level_reference)) ;
  892|       |
  893|  2.16k|	for (k = 0 ; k < ARRAY_LEN (c->post_timers) ; k++)
  ------------------
  |  |   88|  2.16k|#define		ARRAY_LEN(x)	((int) (sizeof (x) / sizeof ((x) [0])))
  ------------------
  |  Branch (893:15): [True: 1.92k, False: 240]
  ------------------
  894|  1.92k|		bytes += psf_binheader_readf (psf, "b4", &c->post_timers [k].usage, make_size_t (4), &c->post_timers [k].value) ;
  895|       |
  896|    240|	bytes += psf_binheader_readf (psf, "b", c->reserved, sizeof (c->reserved)) ;
  897|    240|	bytes += psf_binheader_readf (psf, "b", c->url, sizeof (c->url)) ;
  898|       |
  899|    240|	if (chunksize > WAV_CART_MIN_CHUNK_SIZE)
  ------------------
  |  |   36|    240|#define WAV_CART_MIN_CHUNK_SIZE		2048
  ------------------
  |  Branch (899:6): [True: 98, False: 142]
  ------------------
  900|     98|	{	/* File has tag text. */
  901|     98|		c->tag_text_size = chunksize - WAV_CART_MIN_CHUNK_SIZE ;
  ------------------
  |  |   36|     98|#define WAV_CART_MIN_CHUNK_SIZE		2048
  ------------------
  902|     98|		bytes += psf_binheader_readf (psf, "b", c->tag_text, make_size_t (c->tag_text_size)) ;
  903|     98|		} ;
  904|       |
  905|    240|	if (bytes < chunksize)
  ------------------
  |  Branch (905:6): [True: 38, False: 202]
  ------------------
  906|     38|		psf_log_printf (psf, "  %d trailing bytes in cart chunk.\n", chunksize - bytes) ;
  907|       |
  908|    240|	return 0 ;
  909|    240|} /* wavlike_read_cart_chunk */
wavlike_subchunk_parse:
  956|  96.4k|{	sf_count_t	current_pos ;
  957|  96.4k|	char		buffer [2048] ;
  958|  96.4k|	uint32_t 	chunk_size, bytesread = 0 ;
  959|       |
  960|  96.4k|	current_pos = psf_fseek (psf, 0, SEEK_CUR) ;
  961|       |
  962|  96.4k|	if (chunk_length <= 8)
  ------------------
  |  Branch (962:6): [True: 1.89k, False: 94.5k]
  ------------------
  963|  1.89k|	{	/* This case is for broken files generated by PEAK. */
  964|  1.89k|		psf_log_printf (psf, "%M : %u (weird length)\n", chunk, chunk_length) ;
  965|  1.89k|		psf_binheader_readf (psf, "mj", &chunk, chunk_length - 4) ;
  966|  1.89k|		psf_log_printf (psf, "  %M\n", chunk) ;
  967|  1.89k|		return 0 ;
  968|  94.5k|		} ;
  969|       |
  970|  94.5k|	if (current_pos + chunk_length > psf->filelength)
  ------------------
  |  Branch (970:6): [True: 48.1k, False: 46.3k]
  ------------------
  971|  48.1k|	{	psf_log_printf (psf, "%M : %u (should be %d)\n", chunk, chunk_length, (int) (psf->filelength - current_pos)) ;
  972|  48.1k|		chunk_length = psf->filelength - current_pos ;
  973|  48.1k|		}
  974|  46.3k|	else
  975|  46.3k|		psf_log_printf (psf, "%M : %u\n", chunk, chunk_length) ;
  976|       |
  977|  1.73M|	while (bytesread < chunk_length)
  ------------------
  |  Branch (977:9): [True: 1.72M, False: 16.2k]
  ------------------
  978|  1.72M|	{	uint32_t thisread ;
  979|       |
  980|  1.72M|		if ((thisread = psf_binheader_readf (psf, "m", &chunk)) == 0)
  ------------------
  |  Branch (980:7): [True: 219, False: 1.72M]
  ------------------
  981|    219|			break ;
  982|  1.72M|		bytesread += thisread ;
  983|       |
  984|  1.72M|		switch (chunk)
  985|  1.72M|		{	case adtl_MARKER :
  ------------------
  |  |   29|    199|#define adtl_MARKER		MAKE_MARKER ('a', 'd', 't', 'l')
  |  |  ------------------
  |  |  |  |  122|    199|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (985:5): [True: 199, False: 1.71M]
  ------------------
  986|  1.65k|			case INFO_MARKER :
  ------------------
  |  |   37|  1.65k|#define INFO_MARKER		MAKE_MARKER ('I', 'N', 'F', 'O')
  |  |  ------------------
  |  |  |  |  122|  1.65k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (986:4): [True: 1.45k, False: 1.71M]
  ------------------
  987|       |					/* These markers don't contain anything, not even a chunk length. */
  988|  1.65k|					psf_log_printf (psf, "  %M\n", chunk) ;
  989|  1.65k|					continue ;
  990|       |
  991|   550k|			case exif_MARKER :
  ------------------
  |  |   58|   550k|#define exif_MARKER		MAKE_MARKER ('e', 'x', 'i', 'f')
  |  |  ------------------
  |  |  |  |  122|   550k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (991:4): [True: 550k, False: 1.16M]
  ------------------
  992|   550k|					psf_log_printf (psf, "  %M\n", chunk) ;
  993|   550k|					if (chunk_length > bytesread)
  ------------------
  |  Branch (993:10): [True: 549k, False: 1.11k]
  ------------------
  994|   549k|						bytesread += exif_subchunk_parse (psf, chunk_length - bytesread) ;
  995|   550k|					continue ;
  996|       |
  997|  15.2k|			case data_MARKER :
  ------------------
  |  |   32|  15.2k|#define data_MARKER		MAKE_MARKER ('d', 'a', 't', 'a')
  |  |  ------------------
  |  |  |  |  122|  15.2k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (997:4): [True: 15.2k, False: 1.70M]
  ------------------
  998|  15.2k|					psf_log_printf (psf, "  %M inside a LIST block??? Backing out.\n", chunk) ;
  999|       |					/* Jump back four bytes and return to caller. */
 1000|  15.2k|					psf_binheader_readf (psf, "j", -4) ;
 1001|  15.2k|					return 0 ;
 1002|       |
 1003|  5.69k|			case 0 :
  ------------------
  |  Branch (1003:4): [True: 5.69k, False: 1.71M]
  ------------------
 1004|       |					/*
 1005|       |					**	Four zero bytes where a marker was expected. Assume this means
 1006|       |					**	the rest of the chunk is garbage.
 1007|       |					*/
 1008|  5.69k|					psf_log_printf (psf, "    *** Found weird-ass zero marker. Jumping to end of chunk.\n") ;
 1009|  5.69k|					goto cleanup_subchunk_parse ;
 1010|       |
 1011|  1.14M|			default :
  ------------------
  |  Branch (1011:4): [True: 1.14M, False: 572k]
  ------------------
 1012|  1.14M|					break ;
 1013|  1.72M|			} ;
 1014|       |
 1015|  1.14M|		switch (chunk)
 1016|  1.14M|		{	case ISFT_MARKER :
  ------------------
  |  |   42|  1.32k|#define ISFT_MARKER		MAKE_MARKER ('I', 'S', 'F', 'T')
  |  |  ------------------
  |  |  |  |  122|  1.32k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (1016:5): [True: 1.32k, False: 1.14M]
  ------------------
 1017|  5.49k|			case ICOP_MARKER :
  ------------------
  |  |   50|  5.49k|#define ICOP_MARKER		MAKE_MARKER ('I', 'C', 'O', 'P')
  |  |  ------------------
  |  |  |  |  122|  5.49k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (1017:4): [True: 4.17k, False: 1.14M]
  ------------------
 1018|  5.69k|			case IARL_MARKER :
  ------------------
  |  |   45|  5.69k|#define IARL_MARKER		MAKE_MARKER ('I', 'A', 'R', 'L')
  |  |  ------------------
  |  |  |  |  122|  5.69k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (1018:4): [True: 196, False: 1.14M]
  ------------------
 1019|   511k|			case IART_MARKER :
  ------------------
  |  |   46|   511k|#define IART_MARKER		MAKE_MARKER ('I', 'A', 'R', 'T')
  |  |  ------------------
  |  |  |  |  122|   511k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (1019:4): [True: 505k, False: 641k]
  ------------------
 1020|   518k|			case ICMT_MARKER :
  ------------------
  |  |   54|   518k|#define ICMT_MARKER		MAKE_MARKER ('I', 'C', 'M', 'T')
  |  |  ------------------
  |  |  |  |  122|   518k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (1020:4): [True: 7.28k, False: 1.14M]
  ------------------
 1021|   519k|			case ICRD_MARKER :
  ------------------
  |  |   43|   519k|#define ICRD_MARKER		MAKE_MARKER ('I', 'C', 'R', 'D')
  |  |  ------------------
  |  |  |  |  122|   519k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (1021:4): [True: 695, False: 1.14M]
  ------------------
 1022|   522k|			case IENG_MARKER :
  ------------------
  |  |   48|   522k|#define IENG_MARKER		MAKE_MARKER ('I', 'E', 'N', 'G')
  |  |  ------------------
  |  |  |  |  122|   522k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (1022:4): [True: 2.99k, False: 1.14M]
  ------------------
 1023|   525k|			case IGNR_MARKER :
  ------------------
  |  |   49|   525k|#define IGNR_MARKER		MAKE_MARKER ('I', 'G', 'N', 'R')
  |  |  ------------------
  |  |  |  |  122|   525k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (1023:4): [True: 3.56k, False: 1.14M]
  ------------------
 1024|   528k|			case INAM_MARKER :
  ------------------
  |  |   47|   528k|#define INAM_MARKER		MAKE_MARKER ('I', 'N', 'A', 'M')
  |  |  ------------------
  |  |  |  |  122|   528k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (1024:4): [True: 3.24k, False: 1.14M]
  ------------------
 1025|   530k|			case IPRD_MARKER :
  ------------------
  |  |   51|   530k|#define IPRD_MARKER		MAKE_MARKER ('I', 'P', 'R', 'D')
  |  |  ------------------
  |  |  |  |  122|   530k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (1025:4): [True: 1.75k, False: 1.14M]
  ------------------
 1026|   533k|			case ISBJ_MARKER :
  ------------------
  |  |   53|   533k|#define ISBJ_MARKER		MAKE_MARKER ('I', 'S', 'B', 'J')
  |  |  ------------------
  |  |  |  |  122|   533k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (1026:4): [True: 3.20k, False: 1.14M]
  ------------------
 1027|   536k|			case ISRC_MARKER :
  ------------------
  |  |   52|   536k|#define ISRC_MARKER		MAKE_MARKER ('I', 'S', 'R', 'C')
  |  |  ------------------
  |  |  |  |  122|   536k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (1027:4): [True: 2.21k, False: 1.14M]
  ------------------
 1028|   536k|			case IAUT_MARKER :
  ------------------
  |  |   55|   536k|#define IAUT_MARKER		MAKE_MARKER ('I', 'A', 'U', 'T')
  |  |  ------------------
  |  |  |  |  122|   536k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (1028:4): [True: 323, False: 1.14M]
  ------------------
 1029|   538k|			case ITRK_MARKER :
  ------------------
  |  |   56|   538k|#define ITRK_MARKER		MAKE_MARKER ('I', 'T', 'R', 'K')
  |  |  ------------------
  |  |  |  |  122|   538k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (1029:4): [True: 1.85k, False: 1.14M]
  ------------------
 1030|   538k|					bytesread += psf_binheader_readf (psf, "4", &chunk_size) ;
 1031|   538k|					chunk_size += (chunk_size & 1) ;
 1032|   538k|					if (chunk_size >= SIGNED_SIZEOF (buffer) || bytesread + chunk_size > chunk_length)
  ------------------
  |  |   86|  1.07M|#define		SIGNED_SIZEOF(x)	((int) sizeof (x))
  ------------------
  |  Branch (1032:10): [True: 11.8k, False: 526k]
  |  Branch (1032:50): [True: 5.95k, False: 520k]
  ------------------
 1033|  17.7k|					{	psf_log_printf (psf, "  *** %M : %u (too big)\n", chunk, chunk_size) ;
 1034|  17.7k|						goto cleanup_subchunk_parse ;
 1035|   520k|						} ;
 1036|       |
 1037|   520k|					bytesread += psf_binheader_readf (psf, "b", buffer, chunk_size) ;
 1038|   520k|					buffer [chunk_size] = 0 ;
 1039|   520k|					psf_log_printf (psf, "    %M : %s\n", chunk, buffer) ;
 1040|   520k|					break ;
 1041|       |
 1042|  18.0k|			case labl_MARKER :
  ------------------
  |  |   33|  18.0k|#define labl_MARKER		MAKE_MARKER ('l', 'a', 'b', 'l')
  |  |  ------------------
  |  |  |  |  122|  18.0k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (1042:4): [True: 18.0k, False: 1.12M]
  ------------------
 1043|  18.0k|					{	int mark_id ;
 1044|       |
 1045|  18.0k|						bytesread += psf_binheader_readf (psf, "44", &chunk_size, &mark_id) ;
 1046|  18.0k|						chunk_size -= 4 ;
 1047|  18.0k|						chunk_size += (chunk_size & 1) ;
 1048|  18.0k|						if (chunk_size < 1 || chunk_size >= SIGNED_SIZEOF (buffer) || bytesread + chunk_size > chunk_length)
  ------------------
  |  |   86|  33.1k|#define		SIGNED_SIZEOF(x)	((int) sizeof (x))
  ------------------
  |  Branch (1048:11): [True: 2.89k, False: 15.1k]
  |  Branch (1048:29): [True: 4.06k, False: 11.0k]
  |  Branch (1048:69): [True: 4.45k, False: 6.62k]
  ------------------
 1049|  11.4k|						{	psf_log_printf (psf, "  *** %M : %u (too big)\n", chunk, chunk_size) ;
 1050|  11.4k|							goto cleanup_subchunk_parse ;
 1051|  11.4k|							} ;
 1052|       |
 1053|  6.62k|						bytesread += psf_binheader_readf (psf, "b", buffer, chunk_size) ;
 1054|  6.62k|						buffer [chunk_size] = 0 ;
 1055|       |
 1056|  6.62k|						if (mark_id < 10) /* avoid swamping log buffer with labels */
  ------------------
  |  Branch (1056:11): [True: 2.48k, False: 4.13k]
  ------------------
 1057|  2.48k|							psf_log_printf (psf, "    %M : %u : %s\n", chunk, mark_id, buffer) ;
 1058|  4.13k|						else if (mark_id == 10)
  ------------------
  |  Branch (1058:16): [True: 997, False: 3.14k]
  ------------------
 1059|    997|							psf_log_printf (psf, "    (Skipping)\n") ;
 1060|       |
 1061|  6.62k|						if (psf->cues)
  ------------------
  |  Branch (1061:11): [True: 755, False: 5.86k]
  ------------------
 1062|    755| 						{	unsigned int i = 0 ;
 1063|    755|							SF_CUE_POINT *cue_points = psf_cues_points (psf->cues) ;
 1064|       |
 1065|       |							/* find id to store label */
 1066|  3.19k|							while (i < psf->cues->cue_count && cue_points [i].indx != mark_id)
  ------------------
  |  Branch (1066:15): [True: 2.63k, False: 554]
  |  Branch (1066:43): [True: 2.43k, False: 201]
  ------------------
 1067|  2.43k|								i++ ;
 1068|       |
 1069|    755|							if (i < psf->cues->cue_count)
  ------------------
  |  Branch (1069:12): [True: 201, False: 554]
  ------------------
 1070|    201|								psf_strlcpy (cue_points [i].name, sizeof (cue_points [i].name), buffer) ;
 1071|    755|							} ;
 1072|  6.62k|						} ;
 1073|  6.62k|					break ;
 1074|       |
 1075|  4.24k|			case DISP_MARKER :
  ------------------
  |  |   36|  4.24k|#define DISP_MARKER		MAKE_MARKER ('D', 'I', 'S', 'P')
  |  |  ------------------
  |  |  |  |  122|  4.24k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (1075:4): [True: 4.24k, False: 1.14M]
  ------------------
 1076|  6.85k|			case ltxt_MARKER :
  ------------------
  |  |   34|  6.85k|#define ltxt_MARKER		MAKE_MARKER ('l', 't', 'x', 't')
  |  |  ------------------
  |  |  |  |  122|  6.85k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (1076:4): [True: 2.60k, False: 1.14M]
  ------------------
 1077|  8.11k|			case note_MARKER :
  ------------------
  |  |   35|  8.11k|#define note_MARKER		MAKE_MARKER ('n', 'o', 't', 'e')
  |  |  ------------------
  |  |  |  |  122|  8.11k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (1077:4): [True: 1.26k, False: 1.14M]
  ------------------
 1078|  8.11k|					bytesread += psf_binheader_readf (psf, "4", &chunk_size) ;
 1079|  8.11k|					chunk_size += (chunk_size & 1) ;
 1080|  8.11k|					if (chunk_size >= SIGNED_SIZEOF (buffer) || bytesread + chunk_size > chunk_length)
  ------------------
  |  |   86|  16.2k|#define		SIGNED_SIZEOF(x)	((int) sizeof (x))
  ------------------
  |  Branch (1080:10): [True: 3.98k, False: 4.13k]
  |  Branch (1080:50): [True: 2.20k, False: 1.93k]
  ------------------
 1081|  6.18k|					{	psf_log_printf (psf, "  *** %M : %u (too big)\n", chunk, chunk_size) ;
 1082|  6.18k|						goto cleanup_subchunk_parse ;
 1083|  6.18k|						} ;
 1084|       |
 1085|  1.93k|					psf_log_printf (psf, "    %M : %u\n", chunk, chunk_size) ;
 1086|  1.93k|					goto cleanup_subchunk_parse ;
 1087|       |
 1088|   582k|			default :
  ------------------
  |  Branch (1088:4): [True: 582k, False: 564k]
  ------------------
 1089|   582k|					bytesread += psf_binheader_readf (psf, "4", &chunk_size) ;
 1090|   582k|					chunk_size += (chunk_size & 1) ;
 1091|   582k|					if (bytesread + chunk_size > chunk_length)
  ------------------
  |  Branch (1091:10): [True: 19.8k, False: 563k]
  ------------------
 1092|  19.8k|					{	psf_log_printf (psf, "  *** %M : %u (too big)\n", chunk, chunk_size) ;
 1093|  19.8k|						goto cleanup_subchunk_parse ;
 1094|  19.8k|						}
 1095|   563k|					else
 1096|   563k|					{	psf_log_printf (psf, "    %M : %u\n", chunk, chunk_size) ;
 1097|   563k|						bytesread += psf_binheader_readf (psf, "j", chunk_size) ;
 1098|   563k|						} ;
 1099|   563k|					break ;
 1100|  1.14M|			} ;
 1101|       |
 1102|  1.09M|		switch (chunk)
  ------------------
  |  Branch (1102:11): [True: 520k, False: 569k]
  ------------------
 1103|  1.09M|		{	case ISFT_MARKER :
  ------------------
  |  |   42|  1.32k|#define ISFT_MARKER		MAKE_MARKER ('I', 'S', 'F', 'T')
  |  |  ------------------
  |  |  |  |  122|  1.32k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (1103:5): [True: 1.32k, False: 1.08M]
  ------------------
 1104|  1.32k|					psf_store_string (psf, SF_STR_SOFTWARE, buffer) ;
 1105|  1.32k|					break ;
 1106|  2.46k|			case ICOP_MARKER :
  ------------------
  |  |   50|  2.46k|#define ICOP_MARKER		MAKE_MARKER ('I', 'C', 'O', 'P')
  |  |  ------------------
  |  |  |  |  122|  2.46k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (1106:4): [True: 2.46k, False: 1.08M]
  ------------------
 1107|  2.46k|					psf_store_string (psf, SF_STR_COPYRIGHT, buffer) ;
 1108|  2.46k|					break ;
 1109|  2.94k|			case INAM_MARKER :
  ------------------
  |  |   47|  2.94k|#define INAM_MARKER		MAKE_MARKER ('I', 'N', 'A', 'M')
  |  |  ------------------
  |  |  |  |  122|  2.94k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (1109:4): [True: 2.94k, False: 1.08M]
  ------------------
 1110|  2.94k|					psf_store_string (psf, SF_STR_TITLE, buffer) ;
 1111|  2.94k|					break ;
 1112|   502k|			case IART_MARKER :
  ------------------
  |  |   46|   502k|#define IART_MARKER		MAKE_MARKER ('I', 'A', 'R', 'T')
  |  |  ------------------
  |  |  |  |  122|   502k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (1112:4): [True: 502k, False: 587k]
  ------------------
 1113|   502k|					psf_store_string (psf, SF_STR_ARTIST, buffer) ;
 1114|   502k|					break ;
 1115|  4.68k|			case ICMT_MARKER :
  ------------------
  |  |   54|  4.68k|#define ICMT_MARKER		MAKE_MARKER ('I', 'C', 'M', 'T')
  |  |  ------------------
  |  |  |  |  122|  4.68k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (1115:4): [True: 4.68k, False: 1.08M]
  ------------------
 1116|  4.68k|					psf_store_string (psf, SF_STR_COMMENT, buffer) ;
 1117|  4.68k|					break ;
 1118|    688|			case ICRD_MARKER :
  ------------------
  |  |   43|    688|#define ICRD_MARKER		MAKE_MARKER ('I', 'C', 'R', 'D')
  |  |  ------------------
  |  |  |  |  122|    688|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (1118:4): [True: 688, False: 1.08M]
  ------------------
 1119|    688|					psf_store_string (psf, SF_STR_DATE, buffer) ;
 1120|    688|					break ;
 1121|  2.92k|			case IGNR_MARKER :
  ------------------
  |  |   49|  2.92k|#define IGNR_MARKER		MAKE_MARKER ('I', 'G', 'N', 'R')
  |  |  ------------------
  |  |  |  |  122|  2.92k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (1121:4): [True: 2.92k, False: 1.08M]
  ------------------
 1122|  2.92k|					psf_store_string (psf, SF_STR_GENRE, buffer) ;
 1123|  2.92k|					break ;
 1124|  1.18k|			case IPRD_MARKER :
  ------------------
  |  |   51|  1.18k|#define IPRD_MARKER		MAKE_MARKER ('I', 'P', 'R', 'D')
  |  |  ------------------
  |  |  |  |  122|  1.18k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (1124:4): [True: 1.18k, False: 1.08M]
  ------------------
 1125|  1.18k|					psf_store_string (psf, SF_STR_ALBUM, buffer) ;
 1126|  1.18k|					break ;
 1127|  1.83k|			case ITRK_MARKER :
  ------------------
  |  |   56|  1.83k|#define ITRK_MARKER		MAKE_MARKER ('I', 'T', 'R', 'K')
  |  |  ------------------
  |  |  |  |  122|  1.83k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (1127:4): [True: 1.83k, False: 1.08M]
  ------------------
 1128|  1.83k|					psf_store_string (psf, SF_STR_TRACKNUMBER, buffer) ;
 1129|  1.83k|					break ;
 1130|  1.09M|			} ;
 1131|  1.09M|		} ;
 1132|       |
 1133|  79.3k|cleanup_subchunk_parse :
 1134|       |
 1135|  79.3k|	if (chunk_length > bytesread)
  ------------------
  |  Branch (1135:6): [True: 55.3k, False: 23.9k]
  ------------------
 1136|  55.3k|		bytesread += psf_binheader_readf (psf, "j", chunk_length - bytesread) ;
 1137|       |
 1138|  79.3k|	return 0 ;
 1139|  16.4k|} /* wavlike_subchunk_parse */
wavlike_read_peak_chunk:
 1209|  13.7k|{	char		buffer [256] ;
 1210|  13.7k|	uint32_t uk ;
 1211|       |
 1212|  13.7k|	if (chunk_size != WAVLIKE_PEAK_CHUNK_SIZE (psf->sf.channels))
  ------------------
  |  |  337|  13.7k|#define		WAVLIKE_PEAK_CHUNK_SIZE(ch) (2 * sizeof (int) + ch * (sizeof (float) + sizeof (int)))
  ------------------
  |  Branch (1212:6): [True: 2.27k, False: 11.5k]
  ------------------
 1213|  2.27k|	{	/* Some writers (e.g. Adobe Audition) write a PEAK chunk holding a
 1214|       |		** single peak value for the whole file instead of one value per
 1215|       |		** channel. The chunk is optional metadata, so skip it and continue
 1216|       |		** reading the file instead of failing to open it.
 1217|       |		*/
 1218|  2.27k|		psf_binheader_readf (psf, "j", chunk_size) ;
 1219|  2.27k|		psf_log_printf (psf, "*** File PEAK chunk size doesn't fit with number of channels (%d), skipping PEAK information.\n", psf->sf.channels) ;
 1220|  2.27k|		return 0 ;
 1221|  11.5k|		} ;
 1222|       |
 1223|  11.5k|	if (psf->peak_info)
  ------------------
  |  Branch (1223:6): [True: 11.4k, False: 84]
  ------------------
 1224|  11.4k|	{	psf_log_printf (psf, "*** Found existing peak info, using last one.\n") ;
 1225|  11.4k|		free (psf->peak_info) ;
 1226|  11.4k|		psf->peak_info = NULL ;
 1227|  11.4k|		} ;
 1228|  11.5k|	if ((psf->peak_info = peak_info_calloc (psf->sf.channels)) == NULL)
  ------------------
  |  Branch (1228:6): [True: 0, False: 11.5k]
  ------------------
 1229|      0|		return SFE_MALLOC_FAILED ;
 1230|       |
 1231|       |	/* read in rest of PEAK chunk. */
 1232|  11.5k|	psf_binheader_readf (psf, "44", & (psf->peak_info->version), & (psf->peak_info->timestamp)) ;
 1233|       |
 1234|  11.5k|	if (psf->peak_info->version != 1)
  ------------------
  |  Branch (1234:6): [True: 7.90k, False: 3.61k]
  ------------------
 1235|  7.90k|		psf_log_printf (psf, "  version    : %d *** (should be version 1)\n", psf->peak_info->version) ;
 1236|  3.61k|	else
 1237|  3.61k|		psf_log_printf (psf, "  version    : %d\n", psf->peak_info->version) ;
 1238|       |
 1239|  11.5k|	psf_log_printf (psf, "  time stamp : %d\n", psf->peak_info->timestamp) ;
 1240|  11.5k|	psf_log_printf (psf, "    Ch   Position       Value\n") ;
 1241|       |
 1242|  46.1k|	for (uk = 0 ; uk < (uint32_t) psf->sf.channels ; uk++)
  ------------------
  |  Branch (1242:16): [True: 34.5k, False: 11.5k]
  ------------------
 1243|  34.5k|	{	float value ;
 1244|  34.5k|		uint32_t position ;
 1245|       |
 1246|  34.5k|		psf_binheader_readf (psf, "f4", &value, &position) ;
 1247|  34.5k|		psf->peak_info->peaks [uk].value = value ;
 1248|  34.5k|		psf->peak_info->peaks [uk].position = position ;
 1249|       |
 1250|  34.5k|		snprintf (buffer, sizeof (buffer), "    %2d   %-12" PRId64 "   %g\n",
 1251|  34.5k|				uk, psf->peak_info->peaks [uk].position, psf->peak_info->peaks [uk].value) ;
 1252|  34.5k|		buffer [sizeof (buffer) - 1] = 0 ;
 1253|  34.5k|		psf_log_printf (psf, "%s", buffer) ;
 1254|  34.5k|		} ;
 1255|       |
 1256|  11.5k|	return 0 ;
 1257|  11.5k|} /* wavlike_read_peak_chunk */
wavlike.c:wavex_guid_equal:
  118|  1.33k|{	return !memcmp (first, second, sizeof (EXT_SUBFORMAT)) ;
  119|  1.33k|} /* wavex_guid_equal */
wavlike.c:exif_subchunk_parse:
 1299|   549k|{	uint32_t marker, dword = 0, vmajor = -1, vminor = -1, bytesread = 0 ;
 1300|   549k|	char buf [4096] ;
 1301|   549k|	int thisread ;
 1302|       |
 1303|  1.47M|	while (bytesread < length)
  ------------------
  |  Branch (1303:9): [True: 1.47M, False: 5.70k]
  ------------------
 1304|  1.47M|	{
 1305|  1.47M|		if ((thisread = psf_binheader_readf (psf, "m", &marker)) == 0)
  ------------------
  |  Branch (1305:7): [True: 103, False: 1.47M]
  ------------------
 1306|    103|			break ;
 1307|  1.47M|		bytesread += thisread ;
 1308|       |
 1309|  1.47M|		switch (marker)
 1310|  1.47M|		{
 1311|  35.5k|			case 0 : /* camera padding? */
  ------------------
  |  Branch (1311:4): [True: 35.5k, False: 1.43M]
  ------------------
 1312|  35.5k|				break ;
 1313|       |
 1314|    775|			case ever_MARKER :
  ------------------
  |  |   59|    775|#define ever_MARKER		MAKE_MARKER ('e', 'v', 'e', 'r')
  |  |  ------------------
  |  |  |  |  122|    775|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (1314:4): [True: 775, False: 1.47M]
  ------------------
 1315|    775|				bytesread += psf_binheader_readf (psf, "j4", 4, &dword) ;
 1316|    775|				vmajor = 10 * (((dword >> 24) & 0xff) - '0') + (((dword >> 16) & 0xff) - '0') ;
 1317|    775|				vminor = 10 * (((dword >> 8) & 0xff) - '0') + ((dword & 0xff) - '0') ;
 1318|    775|				psf_log_printf (psf, "    EXIF Version : %u.%02u\n", vmajor, vminor) ;
 1319|    775|				break ;
 1320|       |
 1321|  3.37k|			case olym_MARKER :
  ------------------
  |  |   66|  3.37k|#define olym_MARKER		MAKE_MARKER ('o', 'l', 'y', 'm')
  |  |  ------------------
  |  |  |  |  122|  3.37k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (1321:4): [True: 3.37k, False: 1.46M]
  ------------------
 1322|  3.37k|				bytesread += psf_binheader_readf (psf, "4", &dword) ;
 1323|  3.37k|				psf_log_printf (psf, "%M : %u\n", marker, dword) ;
 1324|  3.37k|				if (dword > length || bytesread + dword > length)
  ------------------
  |  Branch (1324:9): [True: 1.49k, False: 1.88k]
  |  Branch (1324:27): [True: 605, False: 1.28k]
  ------------------
 1325|  2.09k|					break ;
 1326|  1.28k|				dword += (dword & 1) ;
 1327|  1.28k|				bytesread += psf_binheader_readf (psf, "j", dword) ;
 1328|  1.28k|				break ;
 1329|       |
 1330|   507k|			case emnt_MARKER : /* design information: null-terminated string */
  ------------------
  |  |   63|   507k|#define emnt_MARKER		MAKE_MARKER ('e', 'm', 'n', 't')
  |  |  ------------------
  |  |  |  |  122|   507k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (1330:4): [True: 507k, False: 965k]
  ------------------
 1331|   584k|			case emdl_MARKER : /* model name ; null-terminated string */
  ------------------
  |  |   62|   584k|#define emdl_MARKER		MAKE_MARKER ('e', 'm', 'd', 'l')
  |  |  ------------------
  |  |  |  |  122|   584k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (1331:4): [True: 76.2k, False: 1.39M]
  ------------------
 1332|   584k|			case ecor_MARKER : /* manufacturer: null-terminated string */
  ------------------
  |  |   61|   584k|#define ecor_MARKER		MAKE_MARKER ('e', 'c', 'o', 'r')
  |  |  ------------------
  |  |  |  |  122|   584k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (1332:4): [True: 360, False: 1.47M]
  ------------------
 1333|   585k|			case etim_MARKER : /* creation time: null-terminated string in the format "hour:minute:second.subsecond" */
  ------------------
  |  |   60|   585k|#define etim_MARKER		MAKE_MARKER ('e', 't', 'i', 'm')
  |  |  ------------------
  |  |  |  |  122|   585k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (1333:4): [True: 580, False: 1.47M]
  ------------------
 1334|   585k|			case erel_MARKER : /* relation info: null-terminated string (filename) */
  ------------------
  |  |   64|   585k|#define erel_MARKER		MAKE_MARKER ('e', 'r', 'e', 'l')
  |  |  ------------------
  |  |  |  |  122|   585k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (1334:4): [True: 751, False: 1.47M]
  ------------------
 1335|   586k|			case eucm_MARKER : /* user comment: 4-byte size follows, then possibly unicode data */
  ------------------
  |  |   65|   586k|#define eucm_MARKER		MAKE_MARKER ('e', 'u', 'c', 'm')
  |  |  ------------------
  |  |  |  |  122|   586k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (1335:4): [True: 330, False: 1.47M]
  ------------------
 1336|   586k|				bytesread += psf_binheader_readf (psf, "4", &dword) ;
 1337|   586k|				bytesread += sizeof (dword) ;
 1338|   586k|				dword += (dword & 1) ;
 1339|       |
 1340|   586k|				if (dword >= sizeof (buf))
  ------------------
  |  Branch (1340:9): [True: 541k, False: 44.8k]
  ------------------
 1341|   541k|				{	psf_log_printf (psf, "*** Marker '%M' is too big %u\n\n", marker, dword) ;
 1342|   541k|					return bytesread ;
 1343|   541k|					} ;
 1344|       |
 1345|  44.8k|				bytesread += exif_fill_and_sink (psf, buf, sizeof (buf), dword) ;
 1346|       |
 1347|       |				/* BAD - don't know what's going on here -- maybe a bug in the camera */
 1348|       |				/* field should be NULL-terminated but there's no room for it with the reported number */
 1349|       |				/*  example output:     emdl : 8 (EX-Z1050) */
 1350|  44.8k|				if (marker == emdl_MARKER && dword == strlen (buf) /* should be >= strlen+1*/)
  ------------------
  |  |   62|  44.8k|#define emdl_MARKER		MAKE_MARKER ('e', 'm', 'd', 'l')
  |  |  ------------------
  |  |  |  |  122|  89.6k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (1350:9): [True: 43.5k, False: 1.25k]
  |  Branch (1350:34): [True: 10.4k, False: 33.1k]
  ------------------
 1351|  10.4k|				{	psf_log_printf (psf, "    *** field size too small for string (sinking 2 bytes)\n") ;
 1352|  10.4k|					bytesread += psf_binheader_readf (psf, "j", 2) ;
 1353|  10.4k|					} ;
 1354|       |
 1355|  44.8k|				psf_log_printf (psf, "    %M : %u (%s)\n", marker, dword, buf) ;
 1356|  44.8k|				if (dword > length)
  ------------------
  |  Branch (1356:9): [True: 1.83k, False: 42.9k]
  ------------------
 1357|  1.83k|					return bytesread ;
 1358|  42.9k|				break ;
 1359|       |
 1360|   847k|			default :
  ------------------
  |  Branch (1360:4): [True: 847k, False: 625k]
  ------------------
 1361|   847k|				psf_log_printf (psf, "    *** %M (%u): -- ignored --\n", marker, marker) ;
 1362|   847k|				break ;
 1363|  1.47M|			} ;
 1364|   930k|		} ;
 1365|       |
 1366|  5.81k|	return bytesread ;
 1367|   549k|} /* exif_subchunk_parse */
wavlike.c:exif_fill_and_sink:
 1277|  44.8k|{
 1278|  44.8k|	size_t bytesread = 0 ;
 1279|       |
 1280|  44.8k|	buf [0] = 0 ;
 1281|  44.8k|	bufsz -= 1 ;
 1282|  44.8k|	if (toread < bufsz)
  ------------------
  |  Branch (1282:6): [True: 44.8k, False: 0]
  ------------------
 1283|  44.8k|		bufsz = toread ;
 1284|  44.8k|	bytesread = psf_binheader_readf (psf, "b", buf, bufsz) ;
 1285|  44.8k|	buf [bufsz] = 0 ;
 1286|       |
 1287|  44.8k|	if (bytesread == bufsz && toread > bufsz)
  ------------------
  |  Branch (1287:6): [True: 44.7k, False: 58]
  |  Branch (1287:28): [True: 0, False: 44.7k]
  ------------------
 1288|      0|		bytesread += psf_binheader_readf (psf, "j", toread - bufsz) ;
 1289|       |
 1290|  44.8k|	return bytesread ;
 1291|  44.8k|} /* exif_fill_and_sink */

wve_open:
   56|    111|{	int	error = 0 ;
   57|       |
   58|    111|	if (psf->is_pipe)
  ------------------
  |  Branch (58:6): [True: 0, False: 111]
  ------------------
   59|      0|		return SFE_WVE_NO_PIPE ;
   60|       |
   61|    111|	if (psf->file.mode == SFM_READ || (psf->file.mode == SFM_RDWR && psf->filelength > 0))
  ------------------
  |  Branch (61:6): [True: 111, False: 0]
  |  Branch (61:37): [True: 0, False: 0]
  |  Branch (61:67): [True: 0, False: 0]
  ------------------
   62|    111|	{	if ((error = wve_read_header (psf)))
  ------------------
  |  Branch (62:8): [True: 42, False: 69]
  ------------------
   63|     42|			return error ;
   64|    111|		} ;
   65|       |
   66|     69|	if (psf->file.mode == SFM_WRITE || psf->file.mode == SFM_RDWR)
  ------------------
  |  Branch (66:6): [True: 0, False: 69]
  |  Branch (66:37): [True: 0, False: 69]
  ------------------
   67|      0|	{	if ((SF_CONTAINER (psf->sf.format)) != SF_FORMAT_WVE)
  ------------------
  |  |  101|      0|#define SF_CONTAINER(x)		((x) & SF_FORMAT_TYPEMASK)
  ------------------
  |  Branch (67:8): [True: 0, False: 0]
  ------------------
   68|      0|			return	SFE_BAD_OPEN_FORMAT ;
   69|       |
   70|      0|		psf->endian = SF_ENDIAN_BIG ;
   71|       |
   72|      0|		if ((error = wve_write_header (psf, SF_FALSE)))
  ------------------
  |  Branch (72:7): [True: 0, False: 0]
  ------------------
   73|      0|			return error ;
   74|       |
   75|      0|		psf->write_header = wve_write_header ;
   76|     69|		} ;
   77|       |
   78|     69|	psf->blockwidth = (sf_count_t) psf->bytewidth * psf->sf.channels ;
   79|       |
   80|     69|	psf->container_close = wve_close ;
   81|       |
   82|     69|	error = alaw_init (psf) ;
   83|       |
   84|     69|	return error ;
   85|     69|} /* wve_open */
wve.c:wve_read_header:
   92|    111|{	int marker ;
   93|    111|	unsigned short version, padding, repeats, trash ;
   94|    111|	unsigned datalength ;
   95|       |
   96|       |	/* Set position to start of file to begin reading header. */
   97|    111|	psf_binheader_readf (psf, "pm", 0, &marker) ;
   98|    111|	if (marker != ALAW_MARKER)
  ------------------
  |  |   35|    111|#define ALAW_MARKER			MAKE_MARKER ('A', 'L', 'a', 'w')
  |  |  ------------------
  |  |  |  |  122|    111|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (98:6): [True: 0, False: 111]
  ------------------
   99|      0|	{	psf_log_printf (psf, "Could not find '%M'\n", ALAW_MARKER) ;
  ------------------
  |  |   35|      0|#define ALAW_MARKER			MAKE_MARKER ('A', 'L', 'a', 'w')
  |  |  ------------------
  |  |  |  |  122|      0|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  100|      0|		return SFE_WVE_NOT_WVE ;
  101|    111|		} ;
  102|       |
  103|    111|	psf_binheader_readf (psf, "m", &marker) ;
  104|    111|	if (marker != SOUN_MARKER)
  ------------------
  |  |   36|    111|#define SOUN_MARKER			MAKE_MARKER ('S', 'o', 'u', 'n')
  |  |  ------------------
  |  |  |  |  122|    111|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (104:6): [True: 0, False: 111]
  ------------------
  105|      0|	{	psf_log_printf (psf, "Could not find '%M'\n", SOUN_MARKER) ;
  ------------------
  |  |   36|      0|#define SOUN_MARKER			MAKE_MARKER ('S', 'o', 'u', 'n')
  |  |  ------------------
  |  |  |  |  122|      0|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  106|      0|		return SFE_WVE_NOT_WVE ;
  107|    111|		} ;
  108|       |
  109|    111|	psf_binheader_readf (psf, "m", &marker) ;
  110|    111|	if (marker != DFIL_MARKER)
  ------------------
  |  |   37|    111|#define DFIL_MARKER			MAKE_MARKER ('d', 'F', 'i', 'l')
  |  |  ------------------
  |  |  |  |  122|    111|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (110:6): [True: 0, False: 111]
  ------------------
  111|      0|	{	psf_log_printf (psf, "Could not find '%M'\n", DFIL_MARKER) ;
  ------------------
  |  |   37|      0|#define DFIL_MARKER			MAKE_MARKER ('d', 'F', 'i', 'l')
  |  |  ------------------
  |  |  |  |  122|      0|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  112|      0|		return SFE_WVE_NOT_WVE ;
  113|    111|		} ;
  114|       |
  115|    111|	psf_binheader_readf (psf, "m", &marker) ;
  116|    111|	if (marker != ESSN_MARKER)
  ------------------
  |  |   38|    111|#define ESSN_MARKER			MAKE_MARKER ('e', '*', '*', '\0')
  |  |  ------------------
  |  |  |  |  122|    111|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (116:6): [True: 42, False: 69]
  ------------------
  117|     42|	{	psf_log_printf (psf, "Could not find '%M'\n", ESSN_MARKER) ;
  ------------------
  |  |   38|     42|#define ESSN_MARKER			MAKE_MARKER ('e', '*', '*', '\0')
  |  |  ------------------
  |  |  |  |  122|     42|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  118|     42|		return SFE_WVE_NOT_WVE ;
  119|     69|		} ;
  120|       |
  121|     69|	psf_binheader_readf (psf, "E2", &version) ;
  122|       |
  123|     69|	psf_log_printf (psf, "Psion Palmtop Alaw (.wve)\n"
  124|     69|			"  Sample Rate : 8000\n"
  125|     69|			"  Channels    : 1\n"
  126|     69|			"  Encoding    : A-law\n") ;
  127|       |
  128|     69|	if (version != PSION_VERSION)
  ------------------
  |  |   39|     69|#define PSION_VERSION		((unsigned short) 3856)
  ------------------
  |  Branch (128:6): [True: 68, False: 1]
  ------------------
  129|     68|		psf_log_printf (psf, "Psion version %d should be %d\n", version, PSION_VERSION) ;
  ------------------
  |  |   39|     68|#define PSION_VERSION		((unsigned short) 3856)
  ------------------
  130|       |
  131|     69|	psf_binheader_readf (psf, "E4", &datalength) ;
  132|     69|	psf->dataoffset = PSION_DATAOFFSET ;
  ------------------
  |  |   40|     69|#define PSION_DATAOFFSET	0x20
  ------------------
  133|     69|	if (datalength != psf->filelength - psf->dataoffset)
  ------------------
  |  Branch (133:6): [True: 68, False: 1]
  ------------------
  134|     68|	{	psf->datalength = psf->filelength - psf->dataoffset ;
  135|     68|		psf_log_printf (psf, "Data length %d should be %D\n", datalength, psf->datalength) ;
  136|     68|		}
  137|      1|	else
  138|      1|		psf->datalength = datalength ;
  139|       |
  140|     69|	psf_binheader_readf (psf, "E22222", &padding, &repeats, &trash, &trash, &trash) ;
  141|       |
  142|     69|	psf->sf.format		= SF_FORMAT_WVE | SF_FORMAT_ALAW ;
  143|     69|	psf->sf.samplerate	= 8000 ;
  144|     69|	psf->sf.frames		= psf->datalength ;
  145|     69|	psf->sf.channels	= 1 ;
  146|       |
  147|     69|	return SFE_NO_ERROR ;
  148|    111|} /* wve_read_header */
wve.c:wve_close:
  200|     69|{
  201|     69|	if (psf->file.mode == SFM_WRITE || psf->file.mode == SFM_RDWR)
  ------------------
  |  Branch (201:6): [True: 0, False: 69]
  |  Branch (201:37): [True: 0, False: 69]
  ------------------
  202|      0|	{	/*  Now we know for certain the length of the file we can re-write
  203|       |		**	the header.
  204|       |		*/
  205|      0|		wve_write_header (psf, SF_TRUE) ;
  206|      0|		} ;
  207|       |
  208|     69|	return 0 ;
  209|     69|} /* wve_close */

xi_open:
   65|    166|{	XI_PRIVATE *pxi ;
   66|    166|	int		subformat, error = 0 ;
   67|       |
   68|    166|	if (psf->is_pipe)
  ------------------
  |  Branch (68:6): [True: 0, False: 166]
  ------------------
   69|      0|		return SFE_XI_NO_PIPE ;
   70|       |
   71|    166|	if (psf->codec_data)
  ------------------
  |  Branch (71:6): [True: 0, False: 166]
  ------------------
   72|      0|		pxi = psf->codec_data ;
   73|    166|	else if ((pxi = calloc (1, sizeof (XI_PRIVATE))) == NULL)
  ------------------
  |  Branch (73:11): [True: 0, False: 166]
  ------------------
   74|      0|		return SFE_MALLOC_FAILED ;
   75|       |
   76|    166|	psf->codec_data = pxi ;
   77|       |
   78|    166|	if (psf->file.mode == SFM_READ || (psf->file.mode == SFM_RDWR && psf->filelength > 0))
  ------------------
  |  Branch (78:6): [True: 166, False: 0]
  |  Branch (78:37): [True: 0, False: 0]
  |  Branch (78:67): [True: 0, False: 0]
  ------------------
   79|    166|	{	if ((error = xi_read_header (psf)))
  ------------------
  |  Branch (79:8): [True: 71, False: 95]
  ------------------
   80|     71|			return error ;
   81|    166|		} ;
   82|       |
   83|     95|	subformat = SF_CODEC (psf->sf.format) ;
  ------------------
  |  |  102|     95|#define SF_CODEC(x)			((x) & SF_FORMAT_SUBMASK)
  ------------------
   84|       |
   85|     95|	if (psf->file.mode == SFM_WRITE || psf->file.mode == SFM_RDWR)
  ------------------
  |  Branch (85:6): [True: 0, False: 95]
  |  Branch (85:37): [True: 0, False: 95]
  ------------------
   86|      0|	{	if ((SF_CONTAINER (psf->sf.format)) != SF_FORMAT_XI)
  ------------------
  |  |  101|      0|#define SF_CONTAINER(x)		((x) & SF_FORMAT_TYPEMASK)
  ------------------
  |  Branch (86:8): [True: 0, False: 0]
  ------------------
   87|      0|			return	SFE_BAD_OPEN_FORMAT ;
   88|       |
   89|      0|		psf->endian = SF_ENDIAN_LITTLE ;
   90|      0|		psf->sf.channels = 1 ; /* Always mono */
   91|      0|		psf->sf.samplerate = 44100 ; /* Always */
   92|       |
   93|       |		/* Set up default instrument and software name. */
   94|      0|		memcpy (pxi->filename, "Default Name            ", sizeof (pxi->filename)) ;
   95|      0|		memcpy (pxi->software, PACKAGE_NAME "-" PACKAGE_VERSION "               ", sizeof (pxi->software)) ;
  ------------------
  |  |  164|      0|#define PACKAGE_NAME "libsndfile"
  ------------------
   96|       |
   97|      0|		memset (pxi->sample_name, 0, sizeof (pxi->sample_name)) ;
   98|      0|		snprintf (pxi->sample_name, sizeof (pxi->sample_name), "%s", "Sample #1") ;
   99|       |
  100|      0|		pxi->sample_flags = (subformat == SF_FORMAT_DPCM_16) ? 16 : 0 ;
  ------------------
  |  Branch (100:23): [True: 0, False: 0]
  ------------------
  101|       |
  102|      0|		if (xi_write_header (psf, SF_FALSE))
  ------------------
  |  Branch (102:7): [True: 0, False: 0]
  ------------------
  103|      0|			return psf->error ;
  104|       |
  105|      0|		psf->write_header = xi_write_header ;
  106|     95|		} ;
  107|       |
  108|     95|	psf->container_close = xi_close ;
  109|     95|	psf->seek = dpcm_seek ;
  110|       |
  111|     95|	psf->sf.seekable = SF_FALSE ;
  112|       |
  113|     95|	psf->blockwidth = (sf_count_t) psf->bytewidth * psf->sf.channels ;
  114|       |
  115|     95|	switch (subformat)
  116|     95|	{	case SF_FORMAT_DPCM_8 :		/* 8-bit differential PCM. */
  ------------------
  |  Branch (116:4): [True: 45, False: 50]
  ------------------
  117|     69|		case SF_FORMAT_DPCM_16 :	/* 16-bit differential PCM. */
  ------------------
  |  Branch (117:3): [True: 24, False: 71]
  ------------------
  118|     69|				error = dpcm_init (psf) ;
  119|     69|				break ;
  120|       |
  121|     26|		default : break ;
  ------------------
  |  Branch (121:3): [True: 26, False: 69]
  ------------------
  122|     95|		} ;
  123|       |
  124|     95|	return error ;
  125|     95|} /* xi_open */
xi.c:xi_close:
  132|     95|{
  133|     95|	return 0 ;
  134|     95|} /* xi_close */
xi.c:dpcm_init:
  161|     69|{	if (psf->bytewidth == 0 || psf->sf.channels == 0)
  ------------------
  |  Branch (161:7): [True: 0, False: 69]
  |  Branch (161:30): [True: 0, False: 69]
  ------------------
  162|      0|		return SFE_INTERNAL ;
  163|       |
  164|     69|	psf->blockwidth = (sf_count_t) psf->bytewidth * psf->sf.channels ;
  165|       |
  166|     69|	if (psf->file.mode == SFM_READ || psf->file.mode == SFM_RDWR)
  ------------------
  |  Branch (166:6): [True: 69, False: 0]
  |  Branch (166:36): [True: 0, False: 0]
  ------------------
  167|     69|	{	switch (psf->bytewidth)
  168|     69|		{	case 1 :
  ------------------
  |  Branch (168:5): [True: 45, False: 24]
  ------------------
  169|     45|					psf->read_short		= dpcm_read_dsc2s ;
  170|     45|					psf->read_int		= dpcm_read_dsc2i ;
  171|     45|					psf->read_float		= dpcm_read_dsc2f ;
  172|     45|					psf->read_double	= dpcm_read_dsc2d ;
  173|     45|					break ;
  174|     24|			case 2 :
  ------------------
  |  Branch (174:4): [True: 24, False: 45]
  ------------------
  175|     24|					psf->read_short		= dpcm_read_dles2s ;
  176|     24|					psf->read_int		= dpcm_read_dles2i ;
  177|     24|					psf->read_float		= dpcm_read_dles2f ;
  178|     24|					psf->read_double	= dpcm_read_dles2d ;
  179|     24|					break ;
  180|      0|			default :
  ------------------
  |  Branch (180:4): [True: 0, False: 69]
  ------------------
  181|      0|				psf_log_printf (psf, "dpcm_init() returning SFE_UNIMPLEMENTED\n") ;
  182|      0|				return SFE_UNIMPLEMENTED ;
  183|     69|			} ;
  184|     69|		} ;
  185|       |
  186|     69|	if (psf->file.mode == SFM_WRITE || psf->file.mode == SFM_RDWR)
  ------------------
  |  Branch (186:6): [True: 0, False: 69]
  |  Branch (186:37): [True: 0, False: 69]
  ------------------
  187|      0|	{	switch (psf->bytewidth)
  188|      0|		{	case 1 :
  ------------------
  |  Branch (188:5): [True: 0, False: 0]
  ------------------
  189|      0|					psf->write_short	= dpcm_write_s2dsc ;
  190|      0|					psf->write_int		= dpcm_write_i2dsc ;
  191|      0|					psf->write_float	= dpcm_write_f2dsc ;
  192|      0|					psf->write_double	= dpcm_write_d2dsc ;
  193|      0|					break ;
  194|      0|			case 2 :
  ------------------
  |  Branch (194:4): [True: 0, False: 0]
  ------------------
  195|      0|					psf->write_short	= dpcm_write_s2dles ;
  196|      0|					psf->write_int		= dpcm_write_i2dles ;
  197|      0|					psf->write_float	= dpcm_write_f2dles ;
  198|      0|					psf->write_double	= dpcm_write_d2dles ;
  199|      0|					break ;
  200|      0|			default :
  ------------------
  |  Branch (200:4): [True: 0, False: 0]
  ------------------
  201|      0|				psf_log_printf (psf, "dpcm_init() returning SFE_UNIMPLEMENTED\n") ;
  202|      0|				return SFE_UNIMPLEMENTED ;
  203|      0|			} ;
  204|     69|		} ;
  205|       |
  206|     69|	psf->filelength = psf_get_filelen (psf) ;
  207|     69|	psf->datalength = (psf->dataend) ? psf->dataend - psf->dataoffset :
  ------------------
  |  Branch (207:20): [True: 0, False: 69]
  ------------------
  208|     69|							psf->filelength - psf->dataoffset ;
  209|     69|	psf->sf.frames = psf->datalength / psf->blockwidth ;
  210|       |
  211|     69|	return 0 ;
  212|     69|} /* dpcm_init */
xi.c:dpcm_read_dsc2f:
  558|    769|{	BUF_UNION	ubuf ;
  559|    769|	XI_PRIVATE	*pxi ;
  560|    769|	int			bufferlen, readcount ;
  561|    769|	sf_count_t	total = 0 ;
  562|    769|	float		normfact ;
  563|       |
  564|    769|	if ((pxi = psf->codec_data) == NULL)
  ------------------
  |  Branch (564:6): [True: 0, False: 769]
  ------------------
  565|      0|		return 0 ;
  566|       |
  567|    769|	normfact = (psf->norm_float == SF_TRUE) ? 1.0 / ((float) 0x80) : 1.0 ;
  ------------------
  |  Branch (567:13): [True: 769, False: 0]
  ------------------
  568|       |
  569|    769|	bufferlen = ARRAY_LEN (ubuf.ucbuf) ;
  ------------------
  |  |   88|    769|#define		ARRAY_LEN(x)	((int) (sizeof (x) / sizeof ((x) [0])))
  ------------------
  570|       |
  571|  1.53k|	while (len > 0)
  ------------------
  |  Branch (571:9): [True: 769, False: 769]
  ------------------
  572|    769|	{	if (len < bufferlen)
  ------------------
  |  Branch (572:8): [True: 769, False: 0]
  ------------------
  573|    769|			bufferlen = (int) len ;
  574|    769|		readcount = (int) psf_fread (ubuf.scbuf, sizeof (signed char), bufferlen, psf) ;
  575|    769|		dsc2f_array (pxi, ubuf.scbuf, readcount, ptr + total, normfact) ;
  576|    769|		total += readcount ;
  577|    769|		if (readcount < bufferlen)
  ------------------
  |  Branch (577:7): [True: 0, False: 769]
  ------------------
  578|      0|			break ;
  579|    769|		len -= readcount ;
  580|    769|		} ;
  581|       |
  582|    769|	return total ;
  583|    769|} /* dpcm_read_dsc2f */
xi.c:dsc2f_array:
  998|    769|{	signed char	last_val ;
  999|    769|	int			k ;
 1000|       |
 1001|    769|	last_val = pxi->last_16 >> 8 ;
 1002|       |
 1003|  1.53k|	for (k = 0 ; k < count ; k++)
  ------------------
  |  Branch (1003:15): [True: 769, False: 769]
  ------------------
 1004|    769|	{	last_val += src [k] ;
 1005|    769|		dest [k] = last_val * normfact ;
 1006|    769|		} ;
 1007|       |
 1008|    769|	pxi->last_16 = arith_shift_left (last_val, 8) ;
 1009|    769|} /* dsc2f_array */
xi.c:dpcm_read_dles2f:
  671|    363|{	BUF_UNION	ubuf ;
  672|    363|	XI_PRIVATE	*pxi ;
  673|    363|	int			bufferlen, readcount ;
  674|    363|	sf_count_t	total = 0 ;
  675|    363|	float		normfact ;
  676|       |
  677|    363|	if ((pxi = psf->codec_data) == NULL)
  ------------------
  |  Branch (677:6): [True: 0, False: 363]
  ------------------
  678|      0|		return 0 ;
  679|       |
  680|    363|	normfact = (psf->norm_float == SF_TRUE) ? 1.0 / ((float) 0x8000) : 1.0 ;
  ------------------
  |  Branch (680:13): [True: 363, False: 0]
  ------------------
  681|       |
  682|    363|	bufferlen = ARRAY_LEN (ubuf.sbuf) ;
  ------------------
  |  |   88|    363|#define		ARRAY_LEN(x)	((int) (sizeof (x) / sizeof ((x) [0])))
  ------------------
  683|       |
  684|    726|	while (len > 0)
  ------------------
  |  Branch (684:9): [True: 363, False: 363]
  ------------------
  685|    363|	{	if (len < bufferlen)
  ------------------
  |  Branch (685:8): [True: 363, False: 0]
  ------------------
  686|    363|			bufferlen = (int) len ;
  687|    363|		readcount = (int) psf_fread (ubuf.sbuf, sizeof (short), bufferlen, psf) ;
  688|    363|		dles2f_array (pxi, ubuf.sbuf, readcount, ptr + total, normfact) ;
  689|    363|		total += readcount ;
  690|    363|		if (readcount < bufferlen)
  ------------------
  |  Branch (690:7): [True: 0, False: 363]
  ------------------
  691|      0|			break ;
  692|    363|		len -= readcount ;
  693|    363|		} ;
  694|       |
  695|    363|	return total ;
  696|    363|} /* dpcm_read_dles2f */
xi.c:dles2f_array:
 1128|    363|{	short	last_val ;
 1129|    363|	int		k ;
 1130|       |
 1131|    363|	last_val = pxi->last_16 ;
 1132|       |
 1133|    726|	for (k = 0 ; k < count ; k++)
  ------------------
  |  Branch (1133:15): [True: 363, False: 363]
  ------------------
 1134|    363|	{	last_val += LE2H_16 (src [k]) ;
  ------------------
  |  |  137|    363|	#define LE2H_16(x)			(x)
  ------------------
 1135|    363|		dest [k] = last_val * normfact ;
 1136|    363|		} ;
 1137|       |
 1138|    363|	pxi->last_16 = last_val ;
 1139|    363|} /* dles2f_array */
xi.c:xi_read_header:
  331|    166|{	char	buffer [64], name [32] ;
  332|    166|	short	version, fade_out, sample_count ;
  333|    166|	int		k, loop_begin, loop_end ;
  334|    166|	int 	sample_sizes [MAX_XI_SAMPLES] ;
  335|       |
  336|    166|	psf_binheader_readf (psf, "pb", 0, buffer, 21) ;
  337|       |
  338|    166|	memset (sample_sizes, 0, sizeof (sample_sizes)) ;
  339|       |
  340|    166|	buffer [20] = 0 ;
  341|    166|	if (strcmp (buffer, "Extended Instrument:") != 0)
  ------------------
  |  Branch (341:6): [True: 47, False: 119]
  ------------------
  342|     47|		return SFE_XI_BAD_HEADER ;
  343|       |
  344|    119|	memset (buffer, 0, sizeof (buffer)) ;
  345|    119|	psf_binheader_readf (psf, "b", buffer, 23) ;
  346|       |
  347|    119|	if (buffer [22] != 0x1A)
  ------------------
  |  Branch (347:6): [True: 7, False: 112]
  ------------------
  348|      7|		return SFE_XI_BAD_HEADER ;
  349|       |
  350|    112|	buffer [22] = 0 ;
  351|    669|	for (k = 21 ; k >= 0 && buffer [k] == ' ' ; k --)
  ------------------
  |  Branch (351:16): [True: 668, False: 1]
  |  Branch (351:26): [True: 557, False: 111]
  ------------------
  352|    557|		buffer [k] = 0 ;
  353|       |
  354|    112|	psf_log_printf (psf, "Extended Instrument : %s\n", buffer) ;
  355|    112|	psf_store_string (psf, SF_STR_TITLE, buffer) ;
  356|       |
  357|    112|	psf_binheader_readf (psf, "be2", buffer, 20, &version) ;
  358|    112|	buffer [19] = 0 ;
  359|    462|	for (k = 18 ; k >= 0 && buffer [k] == ' ' ; k --)
  ------------------
  |  Branch (359:16): [True: 461, False: 1]
  |  Branch (359:26): [True: 350, False: 111]
  ------------------
  360|    350|		buffer [k] = 0 ;
  361|       |
  362|    112|	psf_log_printf (psf, "Software : %s\nVersion  : %d.%02d\n", buffer, version / 256, version % 256) ;
  363|    112|	psf_store_string (psf, SF_STR_SOFTWARE, buffer) ;
  364|       |
  365|       |	/* Jump note numbers (96), volume envelope (48), pan envelope (48),
  366|       |	** volume points (1), pan points (1)
  367|       |	*/
  368|    112|	psf_binheader_readf (psf, "j", 96 + 48 + 48 + 1 + 1) ;
  369|       |
  370|    112|	psf_binheader_readf (psf, "b", buffer, 12) ;
  371|    112|	psf_log_printf (psf, "Volume Loop\n  sustain : %u\n  begin   : %u\n  end     : %u\n",
  372|    112|						buffer [0], buffer [1], buffer [2]) ;
  373|    112|	psf_log_printf (psf, "Pan Loop\n  sustain : %u\n  begin   : %u\n  end     : %u\n",
  374|    112|						buffer [3], buffer [4], buffer [5]) ;
  375|    112|	psf_log_printf (psf, "Envelope Flags\n  volume  : 0x%X\n  pan     : 0x%X\n",
  376|    112|				buffer [6] & 0xFF, buffer [7] & 0xFF) ;
  377|       |
  378|    112|	psf_log_printf (psf, "Vibrato\n  type    : %u\n  sweep   : %u\n  depth   : %u\n  rate    : %u\n",
  379|    112|				buffer [8], buffer [9], buffer [10], buffer [11]) ;
  380|       |
  381|       |	/*
  382|       |	** Read fade_out then jump reserved (2 bytes) and ???? (20 bytes) and
  383|       |	** sample_count.
  384|       |	*/
  385|    112|	psf_binheader_readf (psf, "e2j2", &fade_out, 2 + 20, &sample_count) ;
  386|    112|	psf_log_printf (psf, "Fade out  : %d\n", fade_out) ;
  387|       |
  388|       |	/* XI file can contain up to 16 samples. */
  389|    112|	if (sample_count > MAX_XI_SAMPLES)
  ------------------
  |  |   32|    112|#define	MAX_XI_SAMPLES	16
  ------------------
  |  Branch (389:6): [True: 1, False: 111]
  ------------------
  390|      1|		return SFE_XI_EXCESS_SAMPLES ;
  391|       |
  392|    111|	if (psf->instrument == NULL && (psf->instrument = psf_instrument_alloc ()) == NULL)
  ------------------
  |  Branch (392:6): [True: 111, False: 0]
  |  Branch (392:33): [True: 0, False: 111]
  ------------------
  393|      0|		return SFE_MALLOC_FAILED ;
  394|       |
  395|    111|	psf->instrument->basenote = 0 ;
  396|       |	/* Log all data for each sample. */
  397|    555|	for (k = 0 ; k < sample_count ; k++)
  ------------------
  |  Branch (397:15): [True: 444, False: 111]
  ------------------
  398|    444|	{	psf_binheader_readf (psf, "e444", &(sample_sizes [k]), &loop_begin, &loop_end) ;
  399|       |
  400|       |		/* Read 5 know bytes, 1 unknown byte and 22 name bytes. */
  401|    444|		psf_binheader_readf (psf, "bb", buffer, 6, name, 22) ;
  402|    444|		name [21] = 0 ;
  403|       |
  404|    444|		psf_log_printf (psf, "Sample #%d\n  name    : %s\n", k + 1, name) ;
  405|       |
  406|    444|		psf_log_printf (psf, "  size    : %d\n", sample_sizes [k]) ;
  407|       |
  408|    444|		psf_log_printf (psf, "  loop\n    begin : %d\n    end   : %d\n", loop_begin, loop_end) ;
  409|       |
  410|    444|		psf_log_printf (psf, "  volume  : %u\n  f. tune : %d\n  flags   : 0x%02X ",
  411|    444|					buffer [0] & 0xFF, buffer [1] & 0xFF, buffer [2] & 0xFF) ;
  412|       |
  413|    444|		psf_log_printf (psf, " (") ;
  414|    444|		if (buffer [2] & 1)
  ------------------
  |  Branch (414:7): [True: 94, False: 350]
  ------------------
  415|     94|			psf_log_printf (psf, " Loop") ;
  416|    444|		if (buffer [2] & 2)
  ------------------
  |  Branch (416:7): [True: 80, False: 364]
  ------------------
  417|     80|			psf_log_printf (psf, " PingPong") ;
  418|    444|		psf_log_printf (psf, (buffer [2] & 16) ? " 16bit" : " 8bit") ;
  ------------------
  |  Branch (418:24): [True: 79, False: 365]
  ------------------
  419|    444|		psf_log_printf (psf, " )\n") ;
  420|       |
  421|    444|		psf_log_printf (psf, "  pan     : %u\n  note    : %d\n  namelen : %d\n",
  422|    444|					buffer [3] & 0xFF, buffer [4], buffer [5]) ;
  423|       |
  424|    444|		psf->instrument->basenote = buffer [4] ;
  425|    444|		if (buffer [2] & 1)
  ------------------
  |  Branch (425:7): [True: 94, False: 350]
  ------------------
  426|     94|		{	psf->instrument->loop_count = 1 ;
  427|     94|			psf->instrument->loops [0].mode = (buffer [2] & 2) ? SF_LOOP_ALTERNATING : SF_LOOP_FORWARD ;
  ------------------
  |  Branch (427:38): [True: 68, False: 26]
  ------------------
  428|     94|			psf->instrument->loops [0].start = loop_begin ;
  429|     94|			psf->instrument->loops [0].end = loop_end ;
  430|     94|			} ;
  431|       |
  432|    444|		if (k != 0)
  ------------------
  |  Branch (432:7): [True: 359, False: 85]
  ------------------
  433|    359|			continue ;
  434|       |
  435|     85|		if (buffer [2] & 16)
  ------------------
  |  Branch (435:7): [True: 33, False: 52]
  ------------------
  436|     33|		{	psf->sf.format = SF_FORMAT_XI | SF_FORMAT_DPCM_16 ;
  437|     33|			psf->bytewidth = 2 ;
  438|     33|			}
  439|     52|		else
  440|     52|		{	psf->sf.format = SF_FORMAT_XI | SF_FORMAT_DPCM_8 ;
  441|     52|			psf->bytewidth = 1 ;
  442|     52|			} ;
  443|     85|		} ;
  444|       |
  445|    381|	while (sample_count > 1 && sample_sizes [sample_count - 1] == 0)
  ------------------
  |  Branch (445:9): [True: 304, False: 77]
  |  Branch (445:29): [True: 270, False: 34]
  ------------------
  446|    270|		sample_count -- ;
  447|       |
  448|       |	/* Currently, we can only handle 1 sample per file. */
  449|       |
  450|    111|	if (sample_count > 2)
  ------------------
  |  Branch (450:6): [True: 16, False: 95]
  ------------------
  451|     16|	{	psf_log_printf (psf, "*** Sample count is less than 16 but more than 1.\n") ;
  452|     16|		psf_log_printf (psf, "  sample count : %d    sample_sizes [%d] : %d\n",
  453|     16|						sample_count, sample_count - 1, sample_sizes [sample_count - 1]) ;
  454|     16|		return SFE_XI_EXCESS_SAMPLES ;
  455|     95|		} ;
  456|       |
  457|     95|	psf->datalength = sample_sizes [0] ;
  458|       |
  459|     95|	psf->dataoffset = psf_ftell (psf) ;
  460|     95|	if (psf->dataoffset < 0)
  ------------------
  |  Branch (460:6): [True: 0, False: 95]
  ------------------
  461|      0|	{	psf_log_printf (psf, "*** Bad Data Offset : %D\n", psf->dataoffset) ;
  462|      0|		return SFE_BAD_OFFSET ;
  463|     95|		} ;
  464|     95|	psf_log_printf (psf, "Data Offset : %D\n", psf->dataoffset) ;
  465|       |
  466|     95|	if (psf->dataoffset + psf->datalength > psf->filelength)
  ------------------
  |  Branch (466:6): [True: 19, False: 76]
  ------------------
  467|     19|	{	psf_log_printf (psf, "*** File seems to be truncated. Should be at least %D bytes long.\n",
  468|     19|				psf->dataoffset + sample_sizes [0]) ;
  469|     19|		psf->datalength = psf->filelength - psf->dataoffset ;
  470|     19|		} ;
  471|       |
  472|     95|	if (psf_fseek (psf, psf->dataoffset, SEEK_SET) != psf->dataoffset)
  ------------------
  |  Branch (472:6): [True: 0, False: 95]
  ------------------
  473|      0|		return SFE_BAD_SEEK ;
  474|       |
  475|     95|	psf->endian = SF_ENDIAN_LITTLE ;
  476|     95|	psf->sf.channels = 1 ; /* Always mono */
  477|     95|	psf->sf.samplerate = 44100 ; /* Always */
  478|       |
  479|     95|	psf->blockwidth = (sf_count_t) psf->sf.channels * psf->bytewidth ;
  480|       |
  481|     95|	if (! psf->sf.frames && psf->blockwidth)
  ------------------
  |  Branch (481:6): [True: 95, False: 0]
  |  Branch (481:26): [True: 69, False: 26]
  ------------------
  482|     69|		psf->sf.frames = (psf->filelength - psf->dataoffset) / psf->blockwidth ;
  483|       |
  484|     95|	psf->instrument->gain = 1 ;
  485|     95|	psf->instrument->velocity_lo = psf->instrument->key_lo = 0 ;
  486|     95|	psf->instrument->velocity_hi = psf->instrument->key_hi = 127 ;
  487|       |
  488|     95|	return 0 ;
  489|     95|} /* xi_read_header */

