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

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

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

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

alac_decoder_init:
   61|  1.02k|{
   62|  1.02k|	int32_t		status = ALAC_noErr ;
   63|  1.02k|	ALACSpecificConfig theConfig ;
   64|  1.02k|	uint8_t * theActualCookie = (uint8_t *) inMagicCookie ;
   65|  1.02k|	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|  1.02k|	if (theActualCookie [4] == 'f' && theActualCookie [5] == 'r' && theActualCookie [6] == 'm' && theActualCookie [7] == 'a')
  ------------------
  |  Branch (74:6): [True: 7, False: 1.01k]
  |  Branch (74:36): [True: 6, False: 1]
  |  Branch (74:66): [True: 4, False: 2]
  |  Branch (74:96): [True: 1, False: 3]
  ------------------
   75|      1|	{
   76|      1|		theActualCookie += 12 ;
   77|      1|		theCookieBytesRemaining -= 12 ;
   78|      1|	}
   79|       |
   80|       |	// skip 'alac' atom header if present
   81|  1.02k|	if (theActualCookie [4] == 'a' && theActualCookie [5] == 'l' && theActualCookie [6] == 'a' && theActualCookie [7] == 'c')
  ------------------
  |  Branch (81:6): [True: 15, False: 1.01k]
  |  Branch (81:36): [True: 13, False: 2]
  |  Branch (81:66): [True: 5, False: 8]
  |  Branch (81:96): [True: 3, False: 2]
  ------------------
   82|      3|	{
   83|      3|		theActualCookie += 12 ;
   84|      3|		theCookieBytesRemaining -= 12 ;
   85|      3|	}
   86|       |
   87|       |	// read the ALACSpecificConfig
   88|  1.02k|	if (theCookieBytesRemaining >= sizeof (ALACSpecificConfig))
  ------------------
  |  Branch (88:6): [True: 930, False: 95]
  ------------------
   89|    930|	{
   90|    930|		theConfig.frameLength = psf_get_be32 (theActualCookie, offsetof (ALACSpecificConfig, frameLength)) ;
   91|       |
   92|    930|		if (theConfig.frameLength > ALAC_FRAME_LENGTH)
  ------------------
  |  |   33|    930|#define		ALAC_FRAME_LENGTH	4096
  ------------------
  |  Branch (92:7): [True: 17, False: 913]
  ------------------
   93|     17|			return fALAC_FrameLengthError ;
   94|       |
   95|    913|		theConfig.compatibleVersion = theActualCookie [offsetof (ALACSpecificConfig, compatibleVersion)] ;
   96|    913|		theConfig.bitDepth = theActualCookie [offsetof (ALACSpecificConfig, bitDepth)] ;
   97|    913|		theConfig.pb = theActualCookie [offsetof (ALACSpecificConfig, pb)] ;
   98|    913|		theConfig.mb = theActualCookie [offsetof (ALACSpecificConfig, mb)] ;
   99|    913|		theConfig.kb = theActualCookie [offsetof (ALACSpecificConfig, kb)] ;
  100|    913|		theConfig.numChannels = theActualCookie [offsetof (ALACSpecificConfig, numChannels)] ;
  101|    913|		theConfig.maxRun = psf_get_be16 (theActualCookie, offsetof (ALACSpecificConfig, maxRun)) ;
  102|    913|		theConfig.maxFrameBytes = psf_get_be32 (theActualCookie, offsetof (ALACSpecificConfig, maxFrameBytes)) ;
  103|    913|		theConfig.avgBitRate = psf_get_be32 (theActualCookie, offsetof (ALACSpecificConfig, avgBitRate)) ;
  104|    913|		theConfig.sampleRate = psf_get_be32 (theActualCookie, offsetof (ALACSpecificConfig, sampleRate)) ;
  105|       |
  106|    913|		p->mConfig = theConfig ;
  107|    913|		p->mNumChannels = theConfig.numChannels ;
  108|       |
  109|    913|		RequireAction (p->mConfig.compatibleVersion <= kALACVersion, return kALAC_IncompatibleVersion ;) ;
  ------------------
  |  |   39|    913|#define RequireAction(condition, action)		if (! (condition)) { action }
  |  |  ------------------
  |  |  |  Branch (39:47): [True: 3, False: 910]
  |  |  ------------------
  ------------------
  110|    910|		RequireAction ((p->mConfig.bitDepth >= 8 && p->mConfig.bitDepth <= 32), return kALAC_BadBitWidth ;) ;
  ------------------
  |  |   39|  1.81k|#define RequireAction(condition, action)		if (! (condition)) { action }
  |  |  ------------------
  |  |  |  Branch (39:50): [True: 904, False: 6]
  |  |  |  Branch (39:50): [True: 902, False: 2]
  |  |  ------------------
  ------------------
  111|    902|		RequireAction ((p->mMixBufferU != NULL) && (p->mMixBufferV != NULL) && (p->u.mPredictor != NULL),
  ------------------
  |  |   39|  3.60k|#define RequireAction(condition, action)		if (! (condition)) { action }
  |  |  ------------------
  |  |  |  Branch (39:50): [True: 902, False: 0]
  |  |  |  Branch (39:50): [True: 902, False: 0]
  |  |  |  Branch (39:50): [True: 902, False: 0]
  |  |  ------------------
  ------------------
  112|    902|						status = kALAC_MemFullError ; goto Exit ;) ;
  113|    902|	}
  114|     95|	else
  115|     95|	{
  116|     95|		status = kALAC_BadSpecificConfigSize ;
  117|     95|	}
  118|       |
  119|       |	// skip to Channel Layout Info
  120|       |	// theActualCookie += sizeof (ALACSpecificConfig) ;
  121|       |
  122|       |	// Currently, the Channel Layout Info portion of the magic cookie (as defined in the
  123|       |	// ALACMagicCookieDescription.txt document) is unused by the decoder.
  124|       |
  125|    997|Exit:
  126|    997|	return status ;
  127|  1.02k|}
alac_decode:
  136|  25.6k|{
  137|  25.6k|	BitBuffer		shiftBits ;
  138|  25.6k|	uint32_t		bits1, bits2 ;
  139|  25.6k|	uint8_t			tag ;
  140|  25.6k|	uint8_t			elementInstanceTag ;
  141|  25.6k|	AGParamRec		agParams ;
  142|  25.6k|	uint32_t		channelIndex ;
  143|  25.6k|	int16_t			coefsU [32] ;		// max possible size is 32 although NUMCOEPAIRS is the current limit
  144|  25.6k|	int16_t			coefsV [32] ;
  145|  25.6k|	uint8_t			numU, numV ;
  146|  25.6k|	uint8_t			mixBits ;
  147|  25.6k|	int8_t			mixRes ;
  148|  25.6k|	uint16_t		unusedHeader ;
  149|  25.6k|	uint8_t			escapeFlag ;
  150|  25.6k|	uint32_t		chanBits ;
  151|  25.6k|	uint8_t			bytesShifted ;
  152|  25.6k|	uint32_t		shift ;
  153|  25.6k|	uint8_t			modeU, modeV ;
  154|  25.6k|	uint32_t		denShiftU, denShiftV ;
  155|  25.6k|	uint16_t		pbFactorU, pbFactorV ;
  156|  25.6k|	uint16_t		pb ;
  157|  25.6k|	int32_t *		out32 ;
  158|  25.6k|	uint8_t			headerByte ;
  159|  25.6k|	uint8_t			partialFrame ;
  160|  25.6k|	uint32_t		extraBits ;
  161|  25.6k|	int32_t			val ;
  162|  25.6k|	uint32_t		i, j ;
  163|  25.6k|	int32_t			status ;
  164|  25.6k|	uint32_t		numChannels = p->mNumChannels ;
  165|       |
  166|  25.6k|	RequireAction ((bits != NULL) && (sampleBuffer != NULL) && (outNumSamples != NULL), return kALAC_ParamError ;) ;
  ------------------
  |  |   39|   102k|#define RequireAction(condition, action)		if (! (condition)) { action }
  |  |  ------------------
  |  |  |  Branch (39:50): [True: 25.6k, False: 0]
  |  |  |  Branch (39:50): [True: 25.6k, False: 0]
  |  |  |  Branch (39:50): [True: 25.6k, False: 0]
  |  |  ------------------
  ------------------
  167|  25.6k|	RequireAction (p->mNumChannels > 0, return kALAC_ZeroChannelCount ;) ;
  ------------------
  |  |   39|  25.6k|#define RequireAction(condition, action)		if (! (condition)) { action }
  |  |  ------------------
  |  |  |  Branch (39:47): [True: 1, False: 25.6k]
  |  |  ------------------
  ------------------
  168|       |
  169|  25.6k|	p->mActiveElements = 0 ;
  170|  25.6k|	channelIndex	= 0 ;
  171|       |
  172|  25.6k|	status = ALAC_noErr ;
  173|  25.6k|	*outNumSamples = numSamples ;
  174|       |
  175|  52.5k|	while (status == ALAC_noErr)
  ------------------
  |  Branch (175:9): [True: 49.8k, False: 2.74k]
  ------------------
  176|  49.8k|	{
  177|       |		// bail if we ran off the end of the buffer
  178|  49.8k|		RequireAction (bits->cur < bits->end, status = kALAC_ParamError ; goto Exit ;) ;
  ------------------
  |  |   39|  49.8k|#define RequireAction(condition, action)		if (! (condition)) { action }
  |  |  ------------------
  |  |  |  Branch (39:47): [True: 4.34k, False: 45.4k]
  |  |  ------------------
  ------------------
  179|       |
  180|       |		// copy global decode params for this element
  181|  45.4k|		pb = p->mConfig.pb ;
  182|       |
  183|       |		// read element tag
  184|  45.4k|		tag = BitBufferReadSmall (bits, 3) ;
  185|  45.4k|		switch (tag)
  ------------------
  |  Branch (185:11): [True: 45.4k, False: 0]
  ------------------
  186|  45.4k|		{
  187|  28.3k|			case ID_SCE:
  ------------------
  |  Branch (187:4): [True: 28.3k, False: 17.0k]
  ------------------
  188|  29.8k|			case ID_LFE:
  ------------------
  |  Branch (188:4): [True: 1.47k, False: 43.9k]
  ------------------
  189|  29.8k|			{
  190|       |				// mono/LFE channel
  191|  29.8k|				elementInstanceTag = BitBufferReadSmall (bits, 4) ;
  192|  29.8k|				p->mActiveElements |= (1u << elementInstanceTag) ;
  193|       |
  194|       |				// read the 12 unused header bits
  195|  29.8k|				unusedHeader = (uint16_t) BitBufferRead (bits, 12) ;
  196|  29.8k|				RequireAction (unusedHeader == 0, status = kALAC_ParamError ; goto Exit ;) ;
  ------------------
  |  |   39|  29.8k|#define RequireAction(condition, action)		if (! (condition)) { action }
  |  |  ------------------
  |  |  |  Branch (39:47): [True: 9.38k, False: 20.4k]
  |  |  ------------------
  ------------------
  197|       |
  198|       |				// read the 1-bit "partial frame" flag, 2-bit "shift-off" flag & 1-bit "escape" flag
  199|  20.4k|				headerByte = (uint8_t) BitBufferRead (bits, 4) ;
  200|       |
  201|  20.4k|				partialFrame = headerByte >> 3 ;
  202|       |
  203|  20.4k|				bytesShifted = (headerByte >> 1) & 0x3u ;
  204|  20.4k|				RequireAction (bytesShifted != 3, status = kALAC_ParamError ; goto Exit ;) ;
  ------------------
  |  |   39|  20.4k|#define RequireAction(condition, action)		if (! (condition)) { action }
  |  |  ------------------
  |  |  |  Branch (39:47): [True: 224, False: 20.2k]
  |  |  ------------------
  ------------------
  205|       |
  206|  20.2k|				shift = bytesShifted * 8 ;
  207|       |
  208|  20.2k|				escapeFlag = headerByte & 0x1 ;
  209|       |
  210|  20.2k|				chanBits = p->mConfig.bitDepth - (bytesShifted * 8) ;
  211|       |
  212|       |				// check for partial frame to override requested numSamples
  213|  20.2k|				if (partialFrame != 0)
  ------------------
  |  Branch (213:9): [True: 2.97k, False: 17.2k]
  ------------------
  214|  2.97k|				{
  215|  2.97k|					numSamples = BitBufferRead (bits, 16) << 16 ;
  216|  2.97k|					numSamples |= BitBufferRead (bits, 16) ;
  217|       |
  218|  2.97k|					RequireAction (numSamples < kALACDefaultFramesPerPacket, return kALAC_NumSamplesTooBig ;) ;
  ------------------
  |  |   39|  2.97k|#define RequireAction(condition, action)		if (! (condition)) { action }
  |  |  ------------------
  |  |  |  Branch (39:47): [True: 358, False: 2.61k]
  |  |  ------------------
  ------------------
  219|  2.61k|				}
  220|       |
  221|  19.8k|				if (escapeFlag == 0)
  ------------------
  |  Branch (221:9): [True: 16.8k, False: 3.09k]
  ------------------
  222|  16.8k|				{
  223|       |					// compressed frame, read rest of parameters
  224|  16.8k|					mixBits	= (uint8_t) BitBufferRead (bits, 8) ;
  225|  16.8k|					mixRes	= (int8_t) BitBufferRead (bits, 8) ;
  226|       |					//Assert ((mixBits == 0) && (mixRes == 0)) ;		// no mixing for mono
  227|       |
  228|  16.8k|					headerByte	= (uint8_t) BitBufferRead (bits, 8) ;
  229|  16.8k|					modeU		= headerByte >> 4 ;
  230|  16.8k|					denShiftU	= headerByte & 0xfu ;
  231|       |
  232|  16.8k|					headerByte	= (uint8_t) BitBufferRead (bits, 8) ;
  233|  16.8k|					pbFactorU	= headerByte >> 5 ;
  234|  16.8k|					numU		= headerByte & 0x1fu ;
  235|       |
  236|  67.4k|					for (i = 0 ; i < numU ; i++)
  ------------------
  |  Branch (236:19): [True: 50.6k, False: 16.8k]
  ------------------
  237|  50.6k|						coefsU [i] = (int16_t) BitBufferRead (bits, 16) ;
  238|       |
  239|       |					// if shift active, skip the shift buffer but remember where it starts
  240|  16.8k|					if (bytesShifted != 0)
  ------------------
  |  Branch (240:10): [True: 4.41k, False: 12.3k]
  ------------------
  241|  4.41k|					{
  242|  4.41k|						shiftBits = *bits ;
  243|  4.41k|						BitBufferAdvance (bits, (bytesShifted * 8) * numSamples) ;
  244|  4.41k|					}
  245|       |
  246|       |					// decompress
  247|  16.8k|					set_ag_params (&agParams, p->mConfig.mb, (pb * pbFactorU) / 4, p->mConfig.kb, numSamples, numSamples, p->mConfig.maxRun) ;
  248|  16.8k|					status = dyn_decomp (&agParams, bits, p->u.mPredictor, numSamples, chanBits, &bits1) ;
  249|  16.8k|					RequireNoErr (status, goto Exit ;) ;
  ------------------
  |  |   41|  16.8k|#define RequireNoErr(condition, action)			if (condition) { action }
  |  |  ------------------
  |  |  |  Branch (41:47): [True: 2.73k, False: 14.0k]
  |  |  ------------------
  ------------------
  250|       |
  251|  14.0k|					if (modeU == 0)
  ------------------
  |  Branch (251:10): [True: 10.0k, False: 4.02k]
  ------------------
  252|  10.0k|					{
  253|  10.0k|						unpc_block (p->u.mPredictor, p->mMixBufferU, numSamples, &coefsU [0], numU, chanBits, denShiftU) ;
  254|  10.0k|					}
  255|  4.02k|					else
  256|  4.02k|					{
  257|       |						// the special "numActive == 31" mode can be done in-place
  258|  4.02k|						unpc_block (p->u.mPredictor, p->u.mPredictor, numSamples, NULL, 31, chanBits, 0) ;
  259|  4.02k|						unpc_block (p->u.mPredictor, p->mMixBufferU, numSamples, &coefsU [0], numU, chanBits, denShiftU) ;
  260|  4.02k|					}
  261|  14.0k|				}
  262|  3.09k|				else
  263|  3.09k|				{
  264|       |					//Assert (bytesShifted == 0) ;
  265|       |
  266|       |					// uncompressed frame, copy data into the mix buffer to use common output code
  267|  3.09k|					shift = 32 - chanBits ;
  268|  3.09k|					if (chanBits <= 16)
  ------------------
  |  Branch (268:10): [True: 1.70k, False: 1.39k]
  ------------------
  269|  1.70k|					{
  270|   464k|						for (i = 0 ; i < numSamples ; i++)
  ------------------
  |  Branch (270:20): [True: 462k, False: 1.70k]
  ------------------
  271|   462k|						{
  272|   462k|							val = (int32_t) BitBufferRead (bits, (uint8_t) chanBits) ;
  273|   462k|							val = (val << shift) >> shift ;
  274|   462k|							p->mMixBufferU [i] = val ;
  275|   462k|						}
  276|  1.70k|					}
  277|  1.39k|					else
  278|  1.39k|					{
  279|       |						// BitBufferRead () can't read more than 16 bits at a time so break up the reads
  280|  1.39k|						extraBits = chanBits - 16 ;
  281|   521k|						for (i = 0 ; i < numSamples ; i++)
  ------------------
  |  Branch (281:20): [True: 519k, False: 1.39k]
  ------------------
  282|   519k|						{
  283|   519k|							val = (int32_t) BitBufferRead (bits, 16) ;
  284|   519k|							val = arith_shift_left (val, 16) >> shift ;
  285|   519k|							p->mMixBufferU [i] = val | BitBufferRead (bits, (uint8_t) extraBits) ;
  286|   519k|						}
  287|  1.39k|					}
  288|       |
  289|  3.09k|					mixBits = mixRes = 0 ;
  290|  3.09k|					bits1 = chanBits * numSamples ;
  291|  3.09k|					bytesShifted = 0 ;
  292|  3.09k|				}
  293|       |
  294|       |				// now read the shifted values into the shift buffer
  295|  17.1k|				if (bytesShifted != 0)
  ------------------
  |  Branch (295:9): [True: 3.80k, False: 13.3k]
  ------------------
  296|  3.80k|				{
  297|  3.80k|					shift = bytesShifted * 8 ;
  298|       |					//Assert (shift <= 16) ;
  299|       |
  300|  11.9k|					for (i = 0 ; i < numSamples ; i++)
  ------------------
  |  Branch (300:19): [True: 8.09k, False: 3.80k]
  ------------------
  301|  8.09k|						p->u.mShiftBuffer [i] = (uint16_t) BitBufferRead (&shiftBits, (uint8_t) shift) ;
  302|  3.80k|				}
  303|       |
  304|       |				// convert 32-bit integers into output buffer
  305|  17.1k|				switch (p->mConfig.bitDepth)
  ------------------
  |  Branch (305:13): [True: 14.7k, False: 2.44k]
  ------------------
  306|  17.1k|				{
  307|  2.12k|					case 16:
  ------------------
  |  Branch (307:6): [True: 2.12k, False: 15.0k]
  ------------------
  308|  2.12k|						out32 = sampleBuffer + channelIndex ;
  309|   157k|						for (i = 0, j = 0 ; i < numSamples ; i++, j += numChannels)
  ------------------
  |  Branch (309:27): [True: 155k, False: 2.12k]
  ------------------
  310|   155k|							out32 [j] = arith_shift_left (p->mMixBufferU [i], 16) ;
  311|  2.12k|						break ;
  312|  3.06k|					case 20:
  ------------------
  |  Branch (312:6): [True: 3.06k, False: 14.1k]
  ------------------
  313|  3.06k|						out32 = sampleBuffer + channelIndex ;
  314|  3.06k|						copyPredictorTo20 (p->mMixBufferU, out32, numChannels, numSamples) ;
  315|  3.06k|						break ;
  316|  4.58k|					case 24:
  ------------------
  |  Branch (316:6): [True: 4.58k, False: 12.5k]
  ------------------
  317|  4.58k|						out32 = sampleBuffer + channelIndex ;
  318|  4.58k|						if (bytesShifted != 0)
  ------------------
  |  Branch (318:11): [True: 1.10k, False: 3.47k]
  ------------------
  319|  1.10k|							copyPredictorTo24Shift (p->mMixBufferU, p->u.mShiftBuffer, out32, numChannels, numSamples, bytesShifted) ;
  320|  3.47k|						else
  321|  3.47k|							copyPredictorTo24 (p->mMixBufferU, out32, numChannels, numSamples) ;
  322|  4.58k|						break ;
  323|  4.95k|					case 32:
  ------------------
  |  Branch (323:6): [True: 4.95k, False: 12.2k]
  ------------------
  324|  4.95k|						out32 = sampleBuffer + channelIndex ;
  325|  4.95k|						if (bytesShifted != 0)
  ------------------
  |  Branch (325:11): [True: 1.64k, False: 3.31k]
  ------------------
  326|  1.64k|							copyPredictorTo32Shift (p->mMixBufferU, p->u.mShiftBuffer, out32, numChannels, numSamples, bytesShifted) ;
  327|  3.31k|						else
  328|  3.31k|							copyPredictorTo32 (p->mMixBufferU, out32, numChannels, numSamples) ;
  329|  4.95k|						break ;
  330|  17.1k|				}
  331|       |
  332|  17.1k|				channelIndex += 1 ;
  333|  17.1k|				*outNumSamples = numSamples ;
  334|  17.1k|				break ;
  335|  17.1k|			}
  336|       |
  337|  8.89k|			case ID_CPE:
  ------------------
  |  Branch (337:4): [True: 8.89k, False: 36.5k]
  ------------------
  338|  8.89k|			{
  339|       |				// if decoding this pair would take us over the max channels limit, bail
  340|  8.89k|				if ((channelIndex + 2) > numChannels)
  ------------------
  |  Branch (340:9): [True: 376, False: 8.51k]
  ------------------
  341|    376|					goto NoMoreChannels ;
  342|       |
  343|       |				// stereo channel pair
  344|  8.51k|				elementInstanceTag = BitBufferReadSmall (bits, 4) ;
  345|  8.51k|				p->mActiveElements |= (1u << elementInstanceTag) ;
  346|       |
  347|       |				// read the 12 unused header bits
  348|  8.51k|				unusedHeader = (uint16_t) BitBufferRead (bits, 12) ;
  349|  8.51k|				RequireAction (unusedHeader == 0, status = kALAC_ParamError ; goto Exit ;) ;
  ------------------
  |  |   39|  8.51k|#define RequireAction(condition, action)		if (! (condition)) { action }
  |  |  ------------------
  |  |  |  Branch (39:47): [True: 1.58k, False: 6.93k]
  |  |  ------------------
  ------------------
  350|       |
  351|       |				// read the 1-bit "partial frame" flag, 2-bit "shift-off" flag & 1-bit "escape" flag
  352|  6.93k|				headerByte = (uint8_t) BitBufferRead (bits, 4) ;
  353|       |
  354|  6.93k|				partialFrame = headerByte >> 3 ;
  355|       |
  356|  6.93k|				bytesShifted = (headerByte >> 1) & 0x3u ;
  357|  6.93k|				RequireAction (bytesShifted != 3, status = kALAC_ParamError ; goto Exit ;) ;
  ------------------
  |  |   39|  6.93k|#define RequireAction(condition, action)		if (! (condition)) { action }
  |  |  ------------------
  |  |  |  Branch (39:47): [True: 221, False: 6.71k]
  |  |  ------------------
  ------------------
  358|       |
  359|  6.71k|				shift = bytesShifted * 8 ;
  360|       |
  361|  6.71k|				escapeFlag = headerByte & 0x1 ;
  362|       |
  363|  6.71k|				chanBits = p->mConfig.bitDepth - (bytesShifted * 8) + 1 ;
  364|       |
  365|       |				// check for partial frame length to override requested numSamples
  366|  6.71k|				if (partialFrame != 0)
  ------------------
  |  Branch (366:9): [True: 3.54k, False: 3.16k]
  ------------------
  367|  3.54k|				{
  368|  3.54k|					numSamples = BitBufferRead (bits, 16) << 16 ;
  369|  3.54k|					numSamples |= BitBufferRead (bits, 16) ;
  370|       |
  371|  3.54k|					RequireAction (numSamples < kALACDefaultFramesPerPacket, return kALAC_NumSamplesTooBig ;) ;
  ------------------
  |  |   39|  3.54k|#define RequireAction(condition, action)		if (! (condition)) { action }
  |  |  ------------------
  |  |  |  Branch (39:47): [True: 283, False: 3.26k]
  |  |  ------------------
  ------------------
  372|  3.26k|				}
  373|       |
  374|  6.42k|				if (escapeFlag == 0)
  ------------------
  |  Branch (374:9): [True: 4.22k, False: 2.20k]
  ------------------
  375|  4.22k|				{
  376|       |					// compressed frame, read rest of parameters
  377|  4.22k|					mixBits		= (uint8_t) BitBufferRead (bits, 8) ;
  378|  4.22k|					mixRes		= (int8_t) BitBufferRead (bits, 8) ;
  379|       |
  380|  4.22k|					headerByte	= (uint8_t) BitBufferRead (bits, 8) ;
  381|  4.22k|					modeU		= headerByte >> 4 ;
  382|  4.22k|					denShiftU	= headerByte & 0xfu ;
  383|       |
  384|  4.22k|					headerByte	= (uint8_t) BitBufferRead (bits, 8) ;
  385|  4.22k|					pbFactorU	= headerByte >> 5 ;
  386|  4.22k|					numU		= headerByte & 0x1fu ;
  387|  13.4k|					for (i = 0 ; i < numU ; i++)
  ------------------
  |  Branch (387:19): [True: 9.20k, False: 4.22k]
  ------------------
  388|  9.20k|						coefsU [i] = (int16_t) BitBufferRead (bits, 16) ;
  389|       |
  390|  4.22k|					headerByte	= (uint8_t) BitBufferRead (bits, 8) ;
  391|  4.22k|					modeV		= headerByte >> 4 ;
  392|  4.22k|					denShiftV	= headerByte & 0xfu ;
  393|       |
  394|  4.22k|					headerByte	= (uint8_t) BitBufferRead (bits, 8) ;
  395|  4.22k|					pbFactorV	= headerByte >> 5 ;
  396|  4.22k|					numV		= headerByte & 0x1fu ;
  397|  18.9k|					for (i = 0 ; i < numV ; i++)
  ------------------
  |  Branch (397:19): [True: 14.7k, False: 4.22k]
  ------------------
  398|  14.7k|						coefsV [i] = (int16_t) BitBufferRead (bits, 16) ;
  399|       |
  400|       |					// if shift active, skip the interleaved shifted values but remember where they start
  401|  4.22k|					if (bytesShifted != 0)
  ------------------
  |  Branch (401:10): [True: 758, False: 3.46k]
  ------------------
  402|    758|					{
  403|    758|						shiftBits = *bits ;
  404|    758|						BitBufferAdvance (bits, (bytesShifted * 8) * 2 * numSamples) ;
  405|    758|					}
  406|       |
  407|       |					// decompress and run predictor for "left" channel
  408|  4.22k|					set_ag_params (&agParams, p->mConfig.mb, (pb * pbFactorU) / 4, p->mConfig.kb, numSamples, numSamples, p->mConfig.maxRun) ;
  409|  4.22k|					status = dyn_decomp (&agParams, bits, p->u.mPredictor, numSamples, chanBits, &bits1) ;
  410|  4.22k|					RequireNoErr (status, goto Exit ;) ;
  ------------------
  |  |   41|  4.22k|#define RequireNoErr(condition, action)			if (condition) { action }
  |  |  ------------------
  |  |  |  Branch (41:47): [True: 822, False: 3.40k]
  |  |  ------------------
  ------------------
  411|       |
  412|  3.40k|					if (modeU == 0)
  ------------------
  |  Branch (412:10): [True: 2.77k, False: 631]
  ------------------
  413|  2.77k|					{
  414|  2.77k|						unpc_block (p->u.mPredictor, p->mMixBufferU, numSamples, &coefsU [0], numU, chanBits, denShiftU) ;
  415|  2.77k|					}
  416|    631|					else
  417|    631|					{
  418|       |						// the special "numActive == 31" mode can be done in-place
  419|    631|						unpc_block (p->u.mPredictor, p->u.mPredictor, numSamples, NULL, 31, chanBits, 0) ;
  420|    631|						unpc_block (p->u.mPredictor, p->mMixBufferU, numSamples, &coefsU [0], numU, chanBits, denShiftU) ;
  421|    631|					}
  422|       |
  423|       |					// decompress and run predictor for "right" channel
  424|  3.40k|					set_ag_params (&agParams, p->mConfig.mb, (pb * pbFactorV) / 4, p->mConfig.kb, numSamples, numSamples, p->mConfig.maxRun) ;
  425|  3.40k|					status = dyn_decomp (&agParams, bits, p->u.mPredictor, numSamples, chanBits, &bits2) ;
  426|  3.40k|					RequireNoErr (status, goto Exit ;) ;
  ------------------
  |  |   41|  3.40k|#define RequireNoErr(condition, action)			if (condition) { action }
  |  |  ------------------
  |  |  |  Branch (41:47): [True: 230, False: 3.17k]
  |  |  ------------------
  ------------------
  427|       |
  428|  3.17k|					if (modeV == 0)
  ------------------
  |  Branch (428:10): [True: 1.50k, False: 1.66k]
  ------------------
  429|  1.50k|					{
  430|  1.50k|						unpc_block (p->u.mPredictor, p->mMixBufferV, numSamples, &coefsV [0], numV, chanBits, denShiftV) ;
  431|  1.50k|					}
  432|  1.66k|					else
  433|  1.66k|					{
  434|       |						// the special "numActive == 31" mode can be done in-place
  435|  1.66k|						unpc_block (p->u.mPredictor, p->u.mPredictor, numSamples, NULL, 31, chanBits, 0) ;
  436|  1.66k|						unpc_block (p->u.mPredictor, p->mMixBufferV, numSamples, &coefsV [0], numV, chanBits, denShiftV) ;
  437|  1.66k|					}
  438|  3.17k|				}
  439|  2.20k|				else
  440|  2.20k|				{
  441|       |					//Assert (bytesShifted == 0) ;
  442|       |
  443|       |					// uncompressed frame, copy data into the mix buffers to use common output code
  444|  2.20k|					chanBits = p->mConfig.bitDepth ;
  445|  2.20k|					shift = 32 - chanBits ;
  446|  2.20k|					if (chanBits <= 16)
  ------------------
  |  Branch (446:10): [True: 516, False: 1.68k]
  ------------------
  447|    516|					{
  448|  34.8k|						for (i = 0 ; i < numSamples ; i++)
  ------------------
  |  Branch (448:20): [True: 34.3k, False: 516]
  ------------------
  449|  34.3k|						{
  450|  34.3k|							val = (int32_t) BitBufferRead (bits, (uint8_t) chanBits) ;
  451|  34.3k|							val = (val << shift) >> shift ;
  452|  34.3k|							p->mMixBufferU [i] = val ;
  453|       |
  454|  34.3k|							val = (int32_t) BitBufferRead (bits, (uint8_t) chanBits) ;
  455|  34.3k|							val = (val << shift) >> shift ;
  456|  34.3k|							p->mMixBufferV [i] = val ;
  457|  34.3k|						}
  458|    516|					}
  459|  1.68k|					else
  460|  1.68k|					{
  461|       |						// BitBufferRead () can't read more than 16 bits at a time so break up the reads
  462|  1.68k|						extraBits = chanBits - 16 ;
  463|  47.0k|						for (i = 0 ; i < numSamples ; i++)
  ------------------
  |  Branch (463:20): [True: 45.3k, False: 1.68k]
  ------------------
  464|  45.3k|						{
  465|  45.3k|							val = (int32_t) BitBufferRead (bits, 16) ;
  466|  45.3k|							val = (((uint32_t) val) << 16) >> shift ;
  467|  45.3k|							p->mMixBufferU [i] = val | BitBufferRead (bits, (uint8_t) extraBits) ;
  468|       |
  469|  45.3k|							val = (int32_t) BitBufferRead (bits, 16) ;
  470|  45.3k|							val = ((uint32_t) val) >> shift ;
  471|  45.3k|							p->mMixBufferV [i] = val | BitBufferRead (bits, (uint8_t) extraBits) ;
  472|  45.3k|						}
  473|  1.68k|					}
  474|       |
  475|  2.20k|					bits1 = chanBits * numSamples ;
  476|  2.20k|					bits2 = chanBits * numSamples ;
  477|  2.20k|					mixBits = mixRes = 0 ;
  478|  2.20k|					bytesShifted = 0 ;
  479|  2.20k|				}
  480|       |
  481|       |				// now read the shifted values into the shift buffer
  482|  5.37k|				if (bytesShifted != 0)
  ------------------
  |  Branch (482:9): [True: 504, False: 4.87k]
  ------------------
  483|    504|				{
  484|    504|					shift = bytesShifted * 8 ;
  485|       |					//Assert (shift <= 16) ;
  486|       |
  487|  3.21k|					for (i = 0 ; i < (numSamples * 2) ; i += 2)
  ------------------
  |  Branch (487:19): [True: 2.70k, False: 504]
  ------------------
  488|  2.70k|					{
  489|  2.70k|						p->u.mShiftBuffer [i + 0] = (uint16_t) BitBufferRead (&shiftBits, (uint8_t) shift) ;
  490|  2.70k|						p->u.mShiftBuffer [i + 1] = (uint16_t) BitBufferRead (&shiftBits, (uint8_t) shift) ;
  491|  2.70k|					}
  492|    504|				}
  493|       |
  494|       |				// un-mix the data and convert to output format
  495|       |				// - note that mixRes = 0 means just interleave so we use that path for uncompressed frames
  496|  5.37k|				switch (p->mConfig.bitDepth)
  ------------------
  |  Branch (496:13): [True: 5.12k, False: 254]
  ------------------
  497|  5.37k|				{
  498|  1.07k|					case 16:
  ------------------
  |  Branch (498:6): [True: 1.07k, False: 4.30k]
  ------------------
  499|  1.07k|						out32 = sampleBuffer + channelIndex ;
  500|  1.07k|						unmix16 (p->mMixBufferU, p->mMixBufferV, out32, numChannels, numSamples, mixBits, mixRes) ;
  501|  1.07k|						break ;
  502|  1.34k|					case 20:
  ------------------
  |  Branch (502:6): [True: 1.34k, False: 4.02k]
  ------------------
  503|  1.34k|						out32 = sampleBuffer + channelIndex ;
  504|  1.34k|						unmix20 (p->mMixBufferU, p->mMixBufferV, out32, numChannels, numSamples, mixBits, mixRes) ;
  505|  1.34k|						break ;
  506|  1.42k|					case 24:
  ------------------
  |  Branch (506:6): [True: 1.42k, False: 3.95k]
  ------------------
  507|  1.42k|						out32 = sampleBuffer + channelIndex ;
  508|  1.42k|						unmix24 (p->mMixBufferU, p->mMixBufferV, out32, numChannels, numSamples,
  509|  1.42k|									mixBits, mixRes, p->u.mShiftBuffer, bytesShifted) ;
  510|  1.42k|						break ;
  511|  1.27k|					case 32:
  ------------------
  |  Branch (511:6): [True: 1.27k, False: 4.09k]
  ------------------
  512|  1.27k|						out32 = sampleBuffer + channelIndex ;
  513|  1.27k|						unmix32 (p->mMixBufferU, p->mMixBufferV, out32, numChannels, numSamples,
  514|  1.27k|									mixBits, mixRes, p->u.mShiftBuffer, bytesShifted) ;
  515|  1.27k|						break ;
  516|  5.37k|				}
  517|       |
  518|  5.37k|				channelIndex += 2 ;
  519|  5.37k|				*outNumSamples = numSamples ;
  520|  5.37k|				break ;
  521|  5.37k|			}
  522|       |
  523|    840|			case ID_CCE:
  ------------------
  |  Branch (523:4): [True: 840, False: 44.6k]
  ------------------
  524|  1.26k|			case ID_PCE:
  ------------------
  |  Branch (524:4): [True: 426, False: 45.0k]
  ------------------
  525|  1.26k|			{
  526|       |				// unsupported element, bail
  527|       |				//AssertNoErr (tag) ;
  528|  1.26k|				status = kALAC_UnsupportedElement ;
  529|  1.26k|				break ;
  530|    840|			}
  531|       |
  532|  1.58k|			case ID_DSE:
  ------------------
  |  Branch (532:4): [True: 1.58k, False: 43.8k]
  ------------------
  533|  1.58k|			{
  534|       |				// data stream element -- parse but ignore
  535|  1.58k|				status = alac_data_stream_element (bits) ;
  536|  1.58k|				break ;
  537|    840|			}
  538|       |
  539|  1.93k|			case ID_FIL:
  ------------------
  |  Branch (539:4): [True: 1.93k, False: 43.5k]
  ------------------
  540|  1.93k|			{
  541|       |				// fill element -- parse but ignore
  542|  1.93k|				status = alac_fill_element (bits) ;
  543|  1.93k|				break ;
  544|    840|			}
  545|       |
  546|  1.91k|			case ID_END:
  ------------------
  |  Branch (546:4): [True: 1.91k, False: 43.5k]
  ------------------
  547|  1.91k|			{
  548|       |				// frame end, all done so byte align the frame and check for overruns
  549|  1.91k|				BitBufferByteAlign (bits, false) ;
  550|       |				//Assert (bits->cur == bits->end) ;
  551|  1.91k|				goto Exit ;
  552|    840|			}
  553|  45.4k|		}
  554|       |
  555|  27.3k|#if 1 // ! DEBUG
  556|       |		// 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)
  557|       |		// - this also protects us if the config does not match the bitstream or crap data bits follow the audio bits
  558|  27.3k|		if (channelIndex >= numChannels)
  ------------------
  |  Branch (558:7): [True: 405, False: 26.9k]
  ------------------
  559|    405|			break ;
  560|  27.3k|#endif
  561|  27.3k|	}
  562|       |
  563|  3.52k|NoMoreChannels:
  564|       |
  565|       |	// if we get here and haven't decoded all of the requested channels, fill the remaining channels with zeros
  566|   177k|	for ( ; channelIndex < numChannels ; channelIndex++)
  ------------------
  |  Branch (566:10): [True: 174k, False: 3.52k]
  ------------------
  567|   174k|	{
  568|   174k|		int32_t *	fill32 = sampleBuffer + channelIndex ;
  569|   174k|		Zero32 (fill32, numSamples, numChannels) ;
  570|   174k|	}
  571|       |
  572|  24.9k|Exit:
  573|  24.9k|	return status ;
  574|  3.52k|}
alac_decoder.c:alac_fill_element:
  586|  1.93k|{
  587|  1.93k|	int16_t		count ;
  588|       |
  589|       |	// 4-bit count or (4-bit + 8-bit count) if 4-bit count == 15
  590|       |	// - plus this weird -1 thing I still don't fully understand
  591|  1.93k|	count = BitBufferReadSmall (bits, 4) ;
  592|  1.93k|	if (count == 15)
  ------------------
  |  Branch (592:6): [True: 259, False: 1.68k]
  ------------------
  593|    259|		count += (int16_t) BitBufferReadSmall (bits, 8) - 1 ;
  594|       |
  595|  1.93k|	BitBufferAdvance (bits, count * 8) ;
  596|       |
  597|  1.93k|	RequireAction (bits->cur <= bits->end, return kALAC_ParamError ;) ;
  ------------------
  |  |   39|  1.93k|#define RequireAction(condition, action)		if (! (condition)) { action }
  |  |  ------------------
  |  |  |  Branch (39:47): [True: 592, False: 1.34k]
  |  |  ------------------
  ------------------
  598|       |
  599|  1.34k|	return ALAC_noErr ;
  600|  1.93k|}
alac_decoder.c:alac_data_stream_element:
  608|  1.58k|{
  609|  1.58k|	int32_t		data_byte_align_flag ;
  610|  1.58k|	uint16_t		count ;
  611|       |
  612|       |	// the tag associates this data stream element with a given audio element
  613|       |
  614|       |	/* element_instance_tag = */ BitBufferReadSmall (bits, 4) ;
  615|       |
  616|  1.58k|	data_byte_align_flag = BitBufferReadOne (bits) ;
  617|       |
  618|       |	// 8-bit count or (8-bit + 8-bit count) if 8-bit count == 255
  619|  1.58k|	count = BitBufferReadSmall (bits, 8) ;
  620|  1.58k|	if (count == 255)
  ------------------
  |  Branch (620:6): [True: 224, False: 1.36k]
  ------------------
  621|    224|		count += BitBufferReadSmall (bits, 8) ;
  622|       |
  623|       |	// the align flag means the bitstream should be byte-aligned before reading the following data bytes
  624|  1.58k|	if (data_byte_align_flag)
  ------------------
  |  Branch (624:6): [True: 507, False: 1.07k]
  ------------------
  625|    507|		BitBufferByteAlign (bits, false) ;
  626|       |
  627|       |	// skip the data bytes
  628|  1.58k|	BitBufferAdvance (bits, count * 8) ;
  629|       |
  630|  1.58k|	RequireAction (bits->cur <= bits->end, return kALAC_ParamError ;) ;
  ------------------
  |  |   39|  1.58k|#define RequireAction(condition, action)		if (! (condition)) { action }
  |  |  ------------------
  |  |  |  Branch (39:47): [True: 887, False: 698]
  |  |  ------------------
  ------------------
  631|       |
  632|    698|	return ALAC_noErr ;
  633|  1.58k|}
alac_decoder.c:Zero32:
  640|   174k|{
  641|   174k|	if (stride == 1)
  ------------------
  |  Branch (641:6): [True: 631, False: 173k]
  ------------------
  642|    631|	{
  643|    631|		memset (buffer, 0, numItems * sizeof (int32_t)) ;
  644|    631|	}
  645|   173k|	else
  646|   173k|	{
  647|  33.2M|		for (uint32_t indx = 0 ; indx < (numItems * stride) ; indx += stride)
  ------------------
  |  Branch (647:28): [True: 33.0M, False: 173k]
  ------------------
  648|  33.0M|			buffer [indx] = 0 ;
  649|   173k|	}
  650|   174k|}

unpc_block:
   56|  26.9k|{
   57|  26.9k|	register int16_t	a0, a1, a2, a3 ;
   58|  26.9k|	register int32_t	b0, b1, b2, b3 ;
   59|  26.9k|	int32_t					j, k, lim ;
   60|  26.9k|	int32_t				sum1, sg, sgn, top, dd ;
   61|  26.9k|	int32_t *			pout ;
   62|  26.9k|	int32_t				del, del0 ;
   63|  26.9k|	uint32_t			chanshift = 32 - chanbits ;
   64|  26.9k|	int32_t				denhalf = 1 << (denshift - 1) ;
   65|       |
   66|  26.9k|	out [0] = pc1 [0] ;
   67|  26.9k|	if (numactive == 0)
  ------------------
  |  Branch (67:6): [True: 15.6k, False: 11.2k]
  ------------------
   68|  15.6k|	{
   69|       |		// just copy if numactive == 0 (but don't bother if in/out pointers the same)
   70|  15.6k|		if ((num > 1) && (pc1 != out))
  ------------------
  |  Branch (70:7): [True: 12.5k, False: 3.16k]
  |  Branch (70:20): [True: 12.5k, False: 0]
  ------------------
   71|  12.5k|			memcpy (&out [1], &pc1 [1], (num - 1) * sizeof (int32_t)) ;
   72|  15.6k|		return ;
   73|  15.6k|	}
   74|  11.2k|	if (numactive == 31)
  ------------------
  |  Branch (74:6): [True: 6.35k, False: 4.94k]
  ------------------
   75|  6.35k|	{
   76|       |		// short-circuit if numactive == 31
   77|  6.35k|		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|  6.35k|		prev = out [0] ;
   88|   999k|		for (j = 1 ; j < num ; j++)
  ------------------
  |  Branch (88:16): [True: 992k, False: 6.35k]
  ------------------
   89|   992k|		{
   90|   992k|			del = pc1 [j] + prev ;
   91|   992k|			prev = (del << chanshift) >> chanshift ;
   92|   992k|			out [j] = prev ;
   93|   992k|		}
   94|  6.35k|		return ;
   95|  6.35k|	}
   96|       |
   97|  30.6k|	for (j = 1 ; j <= numactive ; j++)
  ------------------
  |  Branch (97:15): [True: 25.6k, False: 4.94k]
  ------------------
   98|  25.6k|	{
   99|  25.6k|		del = pc1 [j] + out [j-1] ;
  100|  25.6k|		out [j] = arith_shift_left (del, chanshift) >> chanshift ;
  101|  25.6k|	}
  102|       |
  103|  4.94k|	lim = numactive + 1 ;
  104|       |
  105|  4.94k|	if (numactive == 4)
  ------------------
  |  Branch (105:6): [True: 1.11k, False: 3.82k]
  ------------------
  106|  1.11k|	{
  107|       |		// optimization for numactive == 4
  108|  1.11k|		register int16_t	ia0, ia1, ia2, ia3 ;
  109|  1.11k|		register int32_t	ib0, ib1, ib2, ib3 ;
  110|       |
  111|  1.11k|		ia0 = coefs [0] ;
  112|  1.11k|		ia1 = coefs [1] ;
  113|  1.11k|		ia2 = coefs [2] ;
  114|  1.11k|		ia3 = coefs [3] ;
  115|       |
  116|   433k|		for (j = lim ; j < num ; j++)
  ------------------
  |  Branch (116:18): [True: 431k, False: 1.11k]
  ------------------
  117|   431k|		{
  118|   431k|			LOOP_ALIGN
  119|       |
  120|   431k|			top = out [j - lim] ;
  121|   431k|			pout = out + j - 1 ;
  122|       |
  123|   431k|			ib0 = top - pout [0] ;
  124|   431k|			ib1 = top - pout [-1] ;
  125|   431k|			ib2 = top - pout [-2] ;
  126|   431k|			ib3 = top - pout [-3] ;
  127|       |
  128|   431k|			sum1 = (denhalf - ia0 * ib0 - ia1 * ib1 - ia2 * ib2 - ia3 * ib3) >> denshift ;
  129|       |
  130|   431k|			del = pc1 [j] ;
  131|   431k|			del0 = del ;
  132|   431k|			sg = sign_of_int (del) ;
  133|   431k|			del += top + sum1 ;
  134|       |
  135|   431k|			out [j] = arith_shift_left (del, chanshift) >> chanshift ;
  136|       |
  137|   431k|			if (sg > 0)
  ------------------
  |  Branch (137:8): [True: 32.9k, False: 398k]
  ------------------
  138|  32.9k|			{
  139|  32.9k|				sgn = sign_of_int (ib3) ;
  140|  32.9k|				ia3 -= sgn ;
  141|  32.9k|				del0 -= (4 - 3) * ((sgn * ib3) >> denshift) ;
  142|  32.9k|				if (del0 <= 0)
  ------------------
  |  Branch (142:9): [True: 8.14k, False: 24.7k]
  ------------------
  143|  8.14k|					continue ;
  144|       |
  145|  24.7k|				sgn = sign_of_int (ib2) ;
  146|  24.7k|				ia2 -= sgn ;
  147|  24.7k|				del0 -= (4 - 2) * ((sgn * ib2) >> denshift) ;
  148|  24.7k|				if (del0 <= 0)
  ------------------
  |  Branch (148:9): [True: 4.37k, False: 20.4k]
  ------------------
  149|  4.37k|					continue ;
  150|       |
  151|  20.4k|				sgn = sign_of_int (ib1) ;
  152|  20.4k|				ia1 -= sgn ;
  153|  20.4k|				del0 -= (4 - 1) * ((sgn * ib1) >> denshift) ;
  154|  20.4k|				if (del0 <= 0)
  ------------------
  |  Branch (154:9): [True: 3.50k, False: 16.9k]
  ------------------
  155|  3.50k|					continue ;
  156|       |
  157|  16.9k|				ia0 -= sign_of_int (ib0) ;
  158|  16.9k|			}
  159|   398k|			else if (sg < 0)
  ------------------
  |  Branch (159:13): [True: 49.3k, False: 349k]
  ------------------
  160|  49.3k|			{
  161|       |				// note: to avoid unnecessary negations, we flip the value of "sgn"
  162|  49.3k|				sgn = -sign_of_int (ib3) ;
  163|  49.3k|				ia3 -= sgn ;
  164|  49.3k|				del0 -= (4 - 3) * ((sgn * ib3) >> denshift) ;
  165|  49.3k|				if (del0 >= 0)
  ------------------
  |  Branch (165:9): [True: 8.26k, False: 41.0k]
  ------------------
  166|  8.26k|					continue ;
  167|       |
  168|  41.0k|				sgn = -sign_of_int (ib2) ;
  169|  41.0k|				ia2 -= sgn ;
  170|  41.0k|				del0 -= (4 - 2) * ((sgn * ib2) >> denshift) ;
  171|  41.0k|				if (del0 >= 0)
  ------------------
  |  Branch (171:9): [True: 8.56k, False: 32.4k]
  ------------------
  172|  8.56k|					continue ;
  173|       |
  174|  32.4k|				sgn = -sign_of_int (ib1) ;
  175|  32.4k|				ia1 -= sgn ;
  176|  32.4k|				del0 -= (4 - 1) * ((sgn * ib1) >> denshift) ;
  177|  32.4k|				if (del0 >= 0)
  ------------------
  |  Branch (177:9): [True: 6.80k, False: 25.6k]
  ------------------
  178|  6.80k|					continue ;
  179|       |
  180|  25.6k|				ia0 += sign_of_int (ib0) ;
  181|  25.6k|			}
  182|   431k|		}
  183|       |
  184|  1.11k|		coefs [0] = ia0 ;
  185|  1.11k|		coefs [1] = ia1 ;
  186|  1.11k|		coefs [2] = ia2 ;
  187|  1.11k|		coefs [3] = ia3 ;
  188|  1.11k|	}
  189|  3.82k|	else if (numactive == 8)
  ------------------
  |  Branch (189:11): [True: 824, False: 3.00k]
  ------------------
  190|    824|	{
  191|    824|		register int16_t	a4, a5, a6, a7 ;
  192|    824|		register int32_t	b4, b5, b6, b7 ;
  193|       |
  194|       |		// optimization for numactive == 8
  195|    824|		a0 = coefs [0] ;
  196|    824|		a1 = coefs [1] ;
  197|    824|		a2 = coefs [2] ;
  198|    824|		a3 = coefs [3] ;
  199|    824|		a4 = coefs [4] ;
  200|    824|		a5 = coefs [5] ;
  201|    824|		a6 = coefs [6] ;
  202|    824|		a7 = coefs [7] ;
  203|       |
  204|   416k|		for (j = lim ; j < num ; j++)
  ------------------
  |  Branch (204:18): [True: 415k, False: 824]
  ------------------
  205|   415k|		{
  206|   415k|			LOOP_ALIGN
  207|       |
  208|   415k|			top = out [j - lim] ;
  209|   415k|			pout = out + j - 1 ;
  210|       |
  211|   415k|			b0 = top - (*pout--) ;
  212|   415k|			b1 = top - (*pout--) ;
  213|   415k|			b2 = top - (*pout--) ;
  214|   415k|			b3 = top - (*pout--) ;
  215|   415k|			b4 = top - (*pout--) ;
  216|   415k|			b5 = top - (*pout--) ;
  217|   415k|			b6 = top - (*pout--) ;
  218|   415k|			b7 = top - (*pout) ;
  219|   415k|			pout += 8 ;
  220|       |
  221|   415k|			sum1 = (denhalf - a0 * b0 - a1 * b1 - a2 * b2 - a3 * b3
  222|   415k|					- a4 * b4 - a5 * b5 - a6 * b6 - a7 * b7) >> denshift ;
  223|       |
  224|   415k|			del = pc1 [j] ;
  225|   415k|			del0 = del ;
  226|   415k|			sg = sign_of_int (del) ;
  227|   415k|			del += top + sum1 ;
  228|       |
  229|   415k|			out [j] = arith_shift_left (del, chanshift) >> chanshift ;
  230|       |
  231|   415k|			if (sg > 0)
  ------------------
  |  Branch (231:8): [True: 207k, False: 208k]
  ------------------
  232|   207k|			{
  233|   207k|				sgn = sign_of_int (b7) ;
  234|   207k|				a7 -= sgn ;
  235|   207k|				del0 -= 1 * ((sgn * b7) >> denshift) ;
  236|   207k|				if (del0 <= 0)
  ------------------
  |  Branch (236:9): [True: 37.1k, False: 169k]
  ------------------
  237|  37.1k|					continue ;
  238|       |
  239|   169k|				sgn = sign_of_int (b6) ;
  240|   169k|				a6 -= sgn ;
  241|   169k|				del0 -= 2 * ((sgn * b6) >> denshift) ;
  242|   169k|				if (del0 <= 0)
  ------------------
  |  Branch (242:9): [True: 57.6k, False: 112k]
  ------------------
  243|  57.6k|					continue ;
  244|       |
  245|   112k|				sgn = sign_of_int (b5) ;
  246|   112k|				a5 -= sgn ;
  247|   112k|				del0 -= 3 * ((sgn * b5) >> denshift) ;
  248|   112k|				if (del0 <= 0)
  ------------------
  |  Branch (248:9): [True: 47.3k, False: 64.8k]
  ------------------
  249|  47.3k|					continue ;
  250|       |
  251|  64.8k|				sgn = sign_of_int (b4) ;
  252|  64.8k|				a4 -= sgn ;
  253|  64.8k|				del0 -= 4 * ((sgn * b4) >> denshift) ;
  254|  64.8k|				if (del0 <= 0)
  ------------------
  |  Branch (254:9): [True: 23.1k, False: 41.7k]
  ------------------
  255|  23.1k|					continue ;
  256|       |
  257|  41.7k|				sgn = sign_of_int (b3) ;
  258|  41.7k|				a3 -= sgn ;
  259|  41.7k|				del0 -= 5 * ((sgn * b3) >> denshift) ;
  260|  41.7k|				if (del0 <= 0)
  ------------------
  |  Branch (260:9): [True: 12.1k, False: 29.5k]
  ------------------
  261|  12.1k|					continue ;
  262|       |
  263|  29.5k|				sgn = sign_of_int (b2) ;
  264|  29.5k|				a2 -= sgn ;
  265|  29.5k|				del0 -= 6 * ((sgn * b2) >> denshift) ;
  266|  29.5k|				if (del0 <= 0)
  ------------------
  |  Branch (266:9): [True: 9.42k, False: 20.1k]
  ------------------
  267|  9.42k|					continue ;
  268|       |
  269|  20.1k|				sgn = sign_of_int (b1) ;
  270|  20.1k|				a1 -= sgn ;
  271|  20.1k|				del0 -= 7 * ((sgn * b1) >> denshift) ;
  272|  20.1k|				if (del0 <= 0)
  ------------------
  |  Branch (272:9): [True: 6.45k, False: 13.6k]
  ------------------
  273|  6.45k|					continue ;
  274|       |
  275|  13.6k|				a0 -= sign_of_int (b0) ;
  276|  13.6k|			}
  277|   208k|			else if (sg < 0)
  ------------------
  |  Branch (277:13): [True: 125k, False: 83.2k]
  ------------------
  278|   125k|			{
  279|       |				// note: to avoid unnecessary negations, we flip the value of "sgn"
  280|   125k|				sgn = -sign_of_int (b7) ;
  281|   125k|				a7 -= sgn ;
  282|   125k|				del0 -= 1 * ((sgn * b7) >> denshift) ;
  283|   125k|				if (del0 >= 0)
  ------------------
  |  Branch (283:9): [True: 27.2k, False: 98.1k]
  ------------------
  284|  27.2k|					continue ;
  285|       |
  286|  98.1k|				sgn = -sign_of_int (b6) ;
  287|  98.1k|				a6 -= sgn ;
  288|  98.1k|				del0 -= 2 * ((sgn * b6) >> denshift) ;
  289|  98.1k|				if (del0 >= 0)
  ------------------
  |  Branch (289:9): [True: 27.4k, False: 70.7k]
  ------------------
  290|  27.4k|					continue ;
  291|       |
  292|  70.7k|				sgn = -sign_of_int (b5) ;
  293|  70.7k|				a5 -= sgn ;
  294|  70.7k|				del0 -= 3 * ((sgn * b5) >> denshift) ;
  295|  70.7k|				if (del0 >= 0)
  ------------------
  |  Branch (295:9): [True: 28.6k, False: 42.0k]
  ------------------
  296|  28.6k|					continue ;
  297|       |
  298|  42.0k|				sgn = -sign_of_int (b4) ;
  299|  42.0k|				a4 -= sgn ;
  300|  42.0k|				del0 -= 4 * ((sgn * b4) >> denshift) ;
  301|  42.0k|				if (del0 >= 0)
  ------------------
  |  Branch (301:9): [True: 14.4k, False: 27.6k]
  ------------------
  302|  14.4k|					continue ;
  303|       |
  304|  27.6k|				sgn = -sign_of_int (b3) ;
  305|  27.6k|				a3 -= sgn ;
  306|  27.6k|				del0 -= 5 * ((sgn * b3) >> denshift) ;
  307|  27.6k|				if (del0 >= 0)
  ------------------
  |  Branch (307:9): [True: 6.02k, False: 21.6k]
  ------------------
  308|  6.02k|					continue ;
  309|       |
  310|  21.6k|				sgn = -sign_of_int (b2) ;
  311|  21.6k|				a2 -= sgn ;
  312|  21.6k|				del0 -= 6 * ((sgn * b2) >> denshift) ;
  313|  21.6k|				if (del0 >= 0)
  ------------------
  |  Branch (313:9): [True: 4.74k, False: 16.8k]
  ------------------
  314|  4.74k|					continue ;
  315|       |
  316|  16.8k|				sgn = -sign_of_int (b1) ;
  317|  16.8k|				a1 -= sgn ;
  318|  16.8k|				del0 -= 7 * ((sgn * b1) >> denshift) ;
  319|  16.8k|				if (del0 >= 0)
  ------------------
  |  Branch (319:9): [True: 5.60k, False: 11.2k]
  ------------------
  320|  5.60k|					continue ;
  321|       |
  322|  11.2k|				a0 += sign_of_int (b0) ;
  323|  11.2k|			}
  324|   415k|		}
  325|       |
  326|    824|		coefs [0] = a0 ;
  327|    824|		coefs [1] = a1 ;
  328|    824|		coefs [2] = a2 ;
  329|    824|		coefs [3] = a3 ;
  330|    824|		coefs [4] = a4 ;
  331|    824|		coefs [5] = a5 ;
  332|    824|		coefs [6] = a6 ;
  333|    824|		coefs [7] = a7 ;
  334|    824|	}
  335|  3.00k|	else
  336|  3.00k|	{
  337|       |		// general case
  338|   358k|		for (j = lim ; j < num ; j++)
  ------------------
  |  Branch (338:18): [True: 355k, False: 3.00k]
  ------------------
  339|   355k|		{
  340|   355k|			LOOP_ALIGN
  341|       |
  342|   355k|			sum1 = 0 ;
  343|   355k|			pout = out + j - 1 ;
  344|   355k|			top = out [j-lim] ;
  345|       |
  346|  4.00M|			for (k = 0 ; k < numactive ; k++)
  ------------------
  |  Branch (346:17): [True: 3.64M, False: 355k]
  ------------------
  347|  3.64M|				sum1 += coefs [k] * (pout [-k] - top) ;
  348|       |
  349|   355k|			del = pc1 [j] ;
  350|   355k|			del0 = del ;
  351|   355k|			sg = sign_of_int (del) ;
  352|   355k|			del += top + ((sum1 + denhalf) >> denshift) ;
  353|   355k|			out [j] = (del << chanshift) >> chanshift ;
  354|       |
  355|   355k|			if (sg > 0)
  ------------------
  |  Branch (355:8): [True: 124k, False: 231k]
  ------------------
  356|   124k|			{
  357|   893k|				for (k = (numactive - 1) ; k >= 0 ; k--)
  ------------------
  |  Branch (357:32): [True: 818k, False: 74.7k]
  ------------------
  358|   818k|				{
  359|   818k|					dd = top - pout [-k] ;
  360|   818k|					sgn = sign_of_int (dd) ;
  361|   818k|					coefs [k] -= sgn ;
  362|   818k|					del0 -= (numactive - k) * ((sgn * dd) >> denshift) ;
  363|   818k|					if (del0 <= 0)
  ------------------
  |  Branch (363:10): [True: 49.3k, False: 768k]
  ------------------
  364|  49.3k|						break ;
  365|   818k|				}
  366|   124k|			}
  367|   231k|			else if (sg < 0)
  ------------------
  |  Branch (367:13): [True: 181k, False: 49.5k]
  ------------------
  368|   181k|			{
  369|  1.51M|				for (k = (numactive - 1) ; k >= 0 ; k--)
  ------------------
  |  Branch (369:32): [True: 1.36M, False: 145k]
  ------------------
  370|  1.36M|				{
  371|  1.36M|					dd = top - pout [-k] ;
  372|  1.36M|					sgn = sign_of_int (dd) ;
  373|  1.36M|					coefs [k] += sgn ;
  374|  1.36M|					del0 -= (numactive - k) * ((-sgn * dd) >> denshift) ;
  375|  1.36M|					if (del0 >= 0)
  ------------------
  |  Branch (375:10): [True: 36.4k, False: 1.32M]
  ------------------
  376|  36.4k|						break ;
  377|  1.36M|				}
  378|   181k|			}
  379|   355k|		}
  380|  3.00k|	}
  381|  4.94k|}
dp_dec.c:sign_of_int:
   47|  4.70M|{
   48|  4.70M|	int32_t negishift ;
   49|       |
   50|  4.70M|	negishift = ((uint32_t) - i) >> 31 ;
   51|  4.70M|	return negishift | (i >> 31) ;
   52|  4.70M|}

unmix16:
   66|  1.07k|{
   67|  1.07k|	int32_t 	j ;
   68|       |
   69|  1.07k|	if (mixres != 0)
  ------------------
  |  Branch (69:6): [True: 544, False: 531]
  ------------------
   70|    544|	{
   71|       |		/* matrixed stereo */
   72|  2.01k|		for (j = 0 ; j < numSamples ; j++)
  ------------------
  |  Branch (72:16): [True: 1.47k, False: 544]
  ------------------
   73|  1.47k|		{
   74|  1.47k|			int32_t		l, r ;
   75|       |
   76|  1.47k|			l = u [j] + v [j] - ((mixres * v [j]) >> mixbits) ;
   77|  1.47k|			r = l - v [j] ;
   78|       |
   79|  1.47k|			out [0] = arith_shift_left (l, 16) ;
   80|  1.47k|			out [1] = arith_shift_left (r, 16) ;
   81|  1.47k|			out += stride ;
   82|  1.47k|		}
   83|    544|	}
   84|    531|	else
   85|    531|	{
   86|       |		/* Conventional separated stereo. */
   87|  28.7k|		for (j = 0 ; j < numSamples ; j++)
  ------------------
  |  Branch (87:16): [True: 28.2k, False: 531]
  ------------------
   88|  28.2k|		{
   89|  28.2k|			out [0] = u [j] << 16 ;
   90|  28.2k|			out [1] = v [j] << 16 ;
   91|  28.2k|			out += stride ;
   92|  28.2k|		}
   93|    531|	}
   94|  1.07k|}
unmix20:
  101|  1.34k|{
  102|  1.34k|	int32_t 	j ;
  103|       |
  104|  1.34k|	if (mixres != 0)
  ------------------
  |  Branch (104:6): [True: 567, False: 782]
  ------------------
  105|    567|	{
  106|       |		/* matrixed stereo */
  107|  1.73k|		for (j = 0 ; j < numSamples ; j++)
  ------------------
  |  Branch (107:16): [True: 1.17k, False: 567]
  ------------------
  108|  1.17k|		{
  109|  1.17k|			int32_t		l, r ;
  110|       |
  111|  1.17k|			l = u [j] + v [j] - ((mixres * v [j]) >> mixbits) ;
  112|  1.17k|			r = l - v [j] ;
  113|       |
  114|  1.17k|			out [0] = arith_shift_left (l, 12) ;
  115|  1.17k|			out [1] = arith_shift_left (r, 12) ;
  116|  1.17k|			out += stride ;
  117|  1.17k|		}
  118|    567|	}
  119|    782|	else
  120|    782|	{
  121|       |		/* Conventional separated stereo. */
  122|  6.41k|		for (j = 0 ; j < numSamples ; j++)
  ------------------
  |  Branch (122:16): [True: 5.63k, False: 782]
  ------------------
  123|  5.63k|		{
  124|  5.63k|			out [0] = arith_shift_left (u [j], 12) ;
  125|  5.63k|			out [1] = arith_shift_left (v [j], 12) ;
  126|  5.63k|			out += stride ;
  127|  5.63k|		}
  128|    782|	}
  129|  1.34k|}
unmix24:
  137|  1.42k|{
  138|  1.42k|	int32_t		shift = bytesShifted * 8 ;
  139|  1.42k|	int32_t		l, r ;
  140|  1.42k|	int32_t 		j, k ;
  141|       |
  142|  1.42k|	if (mixres != 0)
  ------------------
  |  Branch (142:6): [True: 721, False: 699]
  ------------------
  143|    721|	{
  144|       |		/* matrixed stereo */
  145|    721|		if (bytesShifted != 0)
  ------------------
  |  Branch (145:7): [True: 99, False: 622]
  ------------------
  146|     99|		{
  147|    838|			for (j = 0, k = 0 ; j < numSamples ; j++, k += 2)
  ------------------
  |  Branch (147:24): [True: 739, False: 99]
  ------------------
  148|    739|			{
  149|    739|				l = u [j] + v [j] - ((mixres * v [j]) >> mixbits) ;
  150|    739|				r = l - v [j] ;
  151|       |
  152|    739|				l = arith_shift_left (l, shift) | (uint32_t) shiftUV [k + 0] ;
  153|    739|				r = arith_shift_left (r, shift) | (uint32_t) shiftUV [k + 1] ;
  154|       |
  155|    739|				out [0] = arith_shift_left (l, 8) ;
  156|    739|				out [1] = arith_shift_left (r, 8) ;
  157|    739|				out += stride ;
  158|    739|			}
  159|     99|		}
  160|    622|		else
  161|    622|		{
  162|  3.31k|			for (j = 0 ; j < numSamples ; j++)
  ------------------
  |  Branch (162:17): [True: 2.68k, False: 622]
  ------------------
  163|  2.68k|			{
  164|  2.68k|				l = u [j] + v [j] - ((mixres * v [j]) >> mixbits) ;
  165|  2.68k|				r = l - v [j] ;
  166|       |
  167|  2.68k|				out [0] = l << 8 ;
  168|  2.68k|				out [1] = r << 8 ;
  169|  2.68k|				out += stride ;
  170|  2.68k|			}
  171|    622|		}
  172|    721|	}
  173|    699|	else
  174|    699|	{
  175|       |		/* Conventional separated stereo. */
  176|    699|		if (bytesShifted != 0)
  ------------------
  |  Branch (176:7): [True: 138, False: 561]
  ------------------
  177|    138|		{
  178|    919|			for (j = 0, k = 0 ; j < numSamples ; j++, k += 2)
  ------------------
  |  Branch (178:24): [True: 781, False: 138]
  ------------------
  179|    781|			{
  180|    781|				l = u [j] ;
  181|    781|				r = v [j] ;
  182|       |
  183|    781|				l = (l << shift) | (uint32_t) shiftUV [k + 0] ;
  184|    781|				r = (r << shift) | (uint32_t) shiftUV [k + 1] ;
  185|       |
  186|    781|				out [0] = l << 8 ;
  187|    781|				out [1] = r << 8 ;
  188|    781|				out += stride ;
  189|    781|			}
  190|    138|		}
  191|    561|		else
  192|    561|		{
  193|  11.4k|			for (j = 0 ; j < numSamples ; j++)
  ------------------
  |  Branch (193:17): [True: 10.8k, False: 561]
  ------------------
  194|  10.8k|			{
  195|  10.8k|				out [0] = u [j] << 8 ;
  196|  10.8k|				out [1] = v [j] << 8 ;
  197|  10.8k|				out += stride ;
  198|  10.8k|			}
  199|    561|		}
  200|    699|	}
  201|  1.42k|}
unmix32:
  211|  1.27k|{
  212|  1.27k|	int32_t		shift = bytesShifted * 8 ;
  213|  1.27k|	int32_t		l, r ;
  214|  1.27k|	int32_t 	j, k ;
  215|       |
  216|  1.27k|	if (mixres != 0)
  ------------------
  |  Branch (216:6): [True: 446, False: 831]
  ------------------
  217|    446|	{
  218|       |		//Assert (bytesShifted != 0) ;
  219|       |
  220|       |		/* matrixed stereo with shift */
  221|  1.27k|		for (j = 0, k = 0 ; j < numSamples ; j++, k += 2)
  ------------------
  |  Branch (221:23): [True: 833, False: 446]
  ------------------
  222|    833|		{
  223|    833|			int32_t		lt, rt ;
  224|       |
  225|    833|			lt = u [j] ;
  226|    833|			rt = v [j] ;
  227|       |
  228|    833|			l = lt + rt - ((mixres * rt) >> mixbits) ;
  229|    833|			r = l - rt ;
  230|       |
  231|    833|			out [0] = arith_shift_left (l, shift) | (uint32_t) shiftUV [k + 0] ;
  232|    833|			out [1] = arith_shift_left (r, shift) | (uint32_t) shiftUV [k + 1] ;
  233|    833|			out += stride ;
  234|    833|		}
  235|    446|	}
  236|    831|	else
  237|    831|	{
  238|    831|		if (bytesShifted == 0)
  ------------------
  |  Branch (238:7): [True: 627, False: 204]
  ------------------
  239|    627|		{
  240|       |			/* interleaving w/o shift */
  241|  33.3k|			for (j = 0 ; j < numSamples ; j++)
  ------------------
  |  Branch (241:17): [True: 32.7k, False: 627]
  ------------------
  242|  32.7k|			{
  243|  32.7k|				out [0] = u [j] ;
  244|  32.7k|				out [1] = v [j] ;
  245|  32.7k|				out += stride ;
  246|  32.7k|			}
  247|    627|		}
  248|    204|		else
  249|    204|		{
  250|       |			/* interleaving with shift */
  251|  1.25k|			for (j = 0, k = 0 ; j < numSamples ; j++, k += 2)
  ------------------
  |  Branch (251:24): [True: 1.05k, False: 204]
  ------------------
  252|  1.05k|			{
  253|  1.05k|				out [0] = (u [j] << shift) | (uint32_t) shiftUV [k + 0] ;
  254|  1.05k|				out [1] = (v [j] << shift) | (uint32_t) shiftUV [k + 1] ;
  255|  1.05k|				out += stride ;
  256|  1.05k|			}
  257|    204|		}
  258|    831|	}
  259|  1.27k|}
copyPredictorTo24:
  265|  3.47k|{
  266|  3.47k|	int32_t		j ;
  267|       |
  268|   875k|	for (j = 0 ; j < numSamples ; j++)
  ------------------
  |  Branch (268:15): [True: 871k, False: 3.47k]
  ------------------
  269|   871k|	{
  270|   871k|		out [0] = in [j] << 8 ;
  271|   871k|		out += stride ;
  272|   871k|	}
  273|  3.47k|}
copyPredictorTo24Shift:
  277|  1.10k|{
  278|  1.10k|	int32_t		shiftVal = bytesShifted * 8 ;
  279|  1.10k|	int32_t		j ;
  280|       |
  281|       |	//Assert (bytesShifted != 0) ;
  282|       |
  283|  3.45k|	for (j = 0 ; j < numSamples ; j++)
  ------------------
  |  Branch (283:15): [True: 2.35k, False: 1.10k]
  ------------------
  284|  2.35k|	{
  285|  2.35k|		int32_t		val = in [j] ;
  286|       |
  287|  2.35k|		val = arith_shift_left (val, shiftVal) | (uint32_t) shift [j] ;
  288|  2.35k|		out [0] = arith_shift_left (val, 8) ;
  289|  2.35k|		out += stride ;
  290|  2.35k|	}
  291|  1.10k|}
copyPredictorTo20:
  295|  3.06k|{
  296|  3.06k|	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|  68.3k|	for (j = 0 ; j < numSamples ; j++)
  ------------------
  |  Branch (300:15): [True: 65.3k, False: 3.06k]
  ------------------
  301|  65.3k|	{
  302|  65.3k|		out [0] = arith_shift_left (in [j], 12) ;
  303|  65.3k|		out += stride ;
  304|  65.3k|	}
  305|  3.06k|}
copyPredictorTo32:
  309|  3.31k|{
  310|  3.31k|	int32_t			i, j ;
  311|       |
  312|       |	// this is only a subroutine to abstract the "iPod can only output 16-bit data" problem
  313|   149k|	for (i = 0, j = 0 ; i < numSamples ; i++, j += stride)
  ------------------
  |  Branch (313:22): [True: 146k, False: 3.31k]
  ------------------
  314|   146k|		out [j] = arith_shift_left (in [i], 8) ;
  315|  3.31k|}
copyPredictorTo32Shift:
  319|  1.64k|{
  320|  1.64k|	int32_t *		op = out ;
  321|  1.64k|	uint32_t		shiftVal = bytesShifted * 8 ;
  322|  1.64k|	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|  5.16k|	for (j = 0 ; j < numSamples ; j++)
  ------------------
  |  Branch (327:15): [True: 3.51k, False: 1.64k]
  ------------------
  328|  3.51k|	{
  329|  3.51k|		op [0] = arith_shift_left (in [j], shiftVal) | (uint32_t) shift [j] ;
  330|  3.51k|		op += stride ;
  331|  3.51k|	}
  332|  1.64k|}

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

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

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

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

private_init_state:
  114|    546|{
  115|    546|	int		cnta ;
  116|       |
  117|    546|	state_ptr->yl = 34816 ;
  118|    546|	state_ptr->yu = 544 ;
  119|    546|	state_ptr->dms = 0 ;
  120|    546|	state_ptr->dml = 0 ;
  121|    546|	state_ptr->ap = 0 ;
  122|  1.63k|	for (cnta = 0 ; cnta < 2 ; cnta++)
  ------------------
  |  Branch (122:18): [True: 1.09k, False: 546]
  ------------------
  123|  1.09k|	{	state_ptr->a [cnta] = 0 ;
  124|  1.09k|		state_ptr->pk [cnta] = 0 ;
  125|  1.09k|		state_ptr->sr [cnta] = 32 ;
  126|  1.09k|		}
  127|  3.82k|	for (cnta = 0 ; cnta < 6 ; cnta++)
  ------------------
  |  Branch (127:18): [True: 3.27k, False: 546]
  ------------------
  128|  3.27k|	{	state_ptr->b [cnta] = 0 ;
  129|  3.27k|		state_ptr->dq [cnta] = 32 ;
  130|  3.27k|		}
  131|    546|	state_ptr->td = 0 ;
  132|    546|}	/* private_init_state */
g72x_reader_init:
  135|    546|{	G72x_STATE *pstate ;
  136|       |
  137|    546|	if ((pstate = g72x_state_new ()) == NULL)
  ------------------
  |  Branch (137:6): [True: 0, False: 546]
  ------------------
  138|      0|		return NULL ;
  139|       |
  140|    546|	private_init_state (pstate) ;
  141|       |
  142|    546|	pstate->encoder = NULL ;
  143|       |
  144|    546|	switch (codec)
  145|    546|	{	case G723_16_BITS_PER_SAMPLE : /* 2 bits per sample. */
  ------------------
  |  Branch (145:4): [True: 0, False: 546]
  ------------------
  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|    344|		case G723_24_BITS_PER_SAMPLE : /* 3 bits per sample. */
  ------------------
  |  Branch (154:3): [True: 344, False: 202]
  ------------------
  155|    344|				pstate->decoder = g723_24_decoder ;
  156|    344|				*blocksize = G723_24_BYTES_PER_BLOCK ;
  157|    344|				*samplesperblock = G723_24_SAMPLES_PER_BLOCK ;
  158|    344|				pstate->codec_bits = 3 ;
  159|    344|				pstate->blocksize = G723_24_BYTES_PER_BLOCK ;
  160|    344|				pstate->samplesperblock = G723_24_SAMPLES_PER_BLOCK ;
  161|    344|				break ;
  162|       |
  163|    121|		case G721_32_BITS_PER_SAMPLE : /* 4 bits per sample. */
  ------------------
  |  Branch (163:3): [True: 121, False: 425]
  ------------------
  164|    121|				pstate->decoder = g721_decoder ;
  165|    121|				*blocksize = G721_32_BYTES_PER_BLOCK ;
  166|    121|				*samplesperblock = G721_32_SAMPLES_PER_BLOCK ;
  167|    121|				pstate->codec_bits = 4 ;
  168|    121|				pstate->blocksize = G721_32_BYTES_PER_BLOCK ;
  169|    121|				pstate->samplesperblock = G721_32_SAMPLES_PER_BLOCK ;
  170|    121|				break ;
  171|       |
  172|     81|		case G721_40_BITS_PER_SAMPLE : /* 5 bits per sample. */
  ------------------
  |  Branch (172:3): [True: 81, False: 465]
  ------------------
  173|     81|				pstate->decoder = g723_40_decoder ;
  174|     81|				*blocksize = G721_40_BYTES_PER_BLOCK ;
  175|     81|				*samplesperblock = G721_40_SAMPLES_PER_BLOCK ;
  176|     81|				pstate->codec_bits = 5 ;
  177|     81|				pstate->blocksize = G721_40_BYTES_PER_BLOCK ;
  178|     81|				pstate->samplesperblock = G721_40_SAMPLES_PER_BLOCK ;
  179|     81|				break ;
  180|       |
  181|      0|		default :
  ------------------
  |  Branch (181:3): [True: 0, False: 546]
  ------------------
  182|      0|				free (pstate) ;
  183|      0|				return NULL ;
  184|    546|		} ;
  185|       |
  186|    546|	return pstate ;
  187|    546|}	/* g72x_reader_init */
g72x_decode_block:
  244|  17.3k|{	int	k, count ;
  245|       |
  246|  17.3k|	count = unpack_bytes (pstate->codec_bits, pstate->blocksize, block, samples) ;
  247|       |
  248|  2.10M|	for (k = 0 ; k < count ; k++)
  ------------------
  |  Branch (248:15): [True: 2.08M, False: 17.3k]
  ------------------
  249|  2.08M|		samples [k] = pstate->decoder (samples [k], pstate) ;
  250|       |
  251|  17.3k|	return 0 ;
  252|  17.3k|}	/* g72x_decode_block */
predictor_zero:
  272|  2.08M|{
  273|  2.08M|	int		i ;
  274|  2.08M|	int		sezi ;
  275|       |
  276|  2.08M|	sezi = fmult (state_ptr->b [0] >> 2, state_ptr->dq [0]) ;
  277|  12.5M|	for (i = 1 ; i < 6 ; i++)			/* ACCUM */
  ------------------
  |  Branch (277:15): [True: 10.4M, False: 2.08M]
  ------------------
  278|  10.4M|		sezi += fmult (state_ptr->b [i] >> 2, state_ptr->dq [i]) ;
  279|  2.08M|	return sezi ;
  280|  2.08M|}
predictor_pole:
  288|  2.08M|{
  289|  2.08M|	return (fmult (state_ptr->a [1] >> 2, state_ptr->sr [1]) +
  290|  2.08M|			fmult (state_ptr->a [0] >> 2, state_ptr->sr [0])) ;
  291|  2.08M|}
step_size:
  299|  2.08M|{
  300|  2.08M|	int		y ;
  301|  2.08M|	int		dif ;
  302|  2.08M|	int		al ;
  303|       |
  304|  2.08M|	if (state_ptr->ap >= 256)
  ------------------
  |  Branch (304:6): [True: 815k, False: 1.27M]
  ------------------
  305|   815k|		return (state_ptr->yu) ;
  306|  1.27M|	else {
  307|  1.27M|		y = state_ptr->yl >> 6 ;
  308|  1.27M|		dif = state_ptr->yu - y ;
  309|  1.27M|		al = state_ptr->ap >> 2 ;
  310|  1.27M|		if (dif > 0)
  ------------------
  |  Branch (310:7): [True: 514k, False: 755k]
  ------------------
  311|   514k|			y += (dif * al) >> 6 ;
  312|   755k|		else if (dif < 0)
  ------------------
  |  Branch (312:12): [True: 751k, False: 3.86k]
  ------------------
  313|   751k|			y += (dif * al + 0x3F) >> 6 ;
  314|  1.27M|		return y ;
  315|  1.27M|	}
  316|  2.08M|}
reconstruct:
  382|  2.08M|{
  383|  2.08M|	short		dql ;	/* Log of 'dq' magnitude */
  384|  2.08M|	short		dex ;	/* Integer part of log */
  385|  2.08M|	short		dqt ;
  386|  2.08M|	short		dq ;	/* Reconstructed difference signal sample */
  387|       |
  388|  2.08M|	dql = dqln + (y >> 2) ;	/* ADDA */
  389|       |
  390|  2.08M|	if (dql < 0)
  ------------------
  |  Branch (390:6): [True: 404k, False: 1.68M]
  ------------------
  391|   404k|		return ((sign) ? -0x8000 : 0) ;
  ------------------
  |  Branch (391:11): [True: 220k, False: 184k]
  ------------------
  392|  1.68M|	else		/* ANTILOG */
  393|  1.68M|	{	dex = (dql >> 7) & 15 ;
  394|  1.68M|		dqt = 128 + (dql & 127) ;
  395|  1.68M|		dq = (dqt << 7) >> (14 - dex) ;
  396|  1.68M|		return ((sign) ? (dq - 0x8000) : dq) ;
  ------------------
  |  Branch (396:11): [True: 681k, False: 998k]
  ------------------
  397|  1.68M|		}
  398|  2.08M|}
update:
  416|  2.08M|{
  417|  2.08M|	int		cnt ;
  418|  2.08M|	short		mag, expon ;	/* Adaptive predictor, FLOAT A */
  419|  2.08M|	short		a2p = 0 ;	/* LIMC */
  420|  2.08M|	short		a1ul ;		/* UPA1 */
  421|  2.08M|	short		pks1 ;		/* UPA2 */
  422|  2.08M|	short		fa1 ;
  423|  2.08M|	char		tr ;		/* tone/transition detector */
  424|  2.08M|	short		ylint, thr2, dqthr ;
  425|  2.08M|	short		ylfrac, thr1 ;
  426|  2.08M|	short		pk0 ;
  427|       |
  428|  2.08M|	pk0 = (dqsez < 0) ? 1 : 0 ;	/* needed in updating predictor poles */
  ------------------
  |  Branch (428:8): [True: 933k, False: 1.15M]
  ------------------
  429|       |
  430|  2.08M|	mag = dq & 0x7FFF ;		/* prediction difference magnitude */
  431|       |	/* TRANS */
  432|  2.08M|	ylint = state_ptr->yl >> 15 ;	/* exponent part of yl */
  433|  2.08M|	ylfrac = (state_ptr->yl >> 10) & 0x1F ;	/* fractional part of yl */
  434|  2.08M|	thr1 = (32 + ylfrac) << ylint ;		/* threshold */
  435|  2.08M|	thr2 = (ylint > 9) ? 31 << 10 : thr1 ;	/* limit thr2 to 31 << 10 */
  ------------------
  |  Branch (435:9): [True: 0, False: 2.08M]
  ------------------
  436|  2.08M|	dqthr = (thr2 + (thr2 >> 1)) >> 1 ;	/* dqthr = 0.75 * thr2 */
  437|  2.08M|	if (state_ptr->td == 0)		/* signal supposed voice */
  ------------------
  |  Branch (437:6): [True: 1.70M, False: 383k]
  ------------------
  438|  1.70M|		tr = 0 ;
  439|   383k|	else if (mag <= dqthr)		/* supposed data, but small mag */
  ------------------
  |  Branch (439:11): [True: 379k, False: 3.97k]
  ------------------
  440|   379k|		tr = 0 ;			/* treated as voice */
  441|  3.97k|	else				/* signal is data (modem) */
  442|  3.97k|		tr = 1 ;
  443|       |
  444|       |	/*
  445|       |	 * Quantizer scale factor adaptation.
  446|       |	 */
  447|       |
  448|       |	/* FUNCTW & FILTD & DELAY */
  449|       |	/* update non-steady state step size multiplier */
  450|  2.08M|	state_ptr->yu = y + ((wi - y) >> 5) ;
  451|       |
  452|       |	/* LIMB */
  453|  2.08M|	if (state_ptr->yu < 544)	/* 544 <= yu <= 5120 */
  ------------------
  |  Branch (453:6): [True: 75.5k, False: 2.01M]
  ------------------
  454|  75.5k|		state_ptr->yu = 544 ;
  455|  2.01M|	else if (state_ptr->yu > 5120)
  ------------------
  |  Branch (455:11): [True: 350k, False: 1.65M]
  ------------------
  456|   350k|		state_ptr->yu = 5120 ;
  457|       |
  458|       |	/* FILTE & DELAY */
  459|       |	/* update steady state step size multiplier */
  460|  2.08M|	state_ptr->yl += state_ptr->yu + ((-state_ptr->yl) >> 6) ;
  461|       |
  462|       |	/*
  463|       |	 * Adaptive predictor coefficients.
  464|       |	 */
  465|  2.08M|	if (tr == 1) {			/* reset a's and b's for modem signal */
  ------------------
  |  Branch (465:6): [True: 3.97k, False: 2.08M]
  ------------------
  466|  3.97k|		state_ptr->a [0] = 0 ;
  467|  3.97k|		state_ptr->a [1] = 0 ;
  468|  3.97k|		state_ptr->b [0] = 0 ;
  469|  3.97k|		state_ptr->b [1] = 0 ;
  470|  3.97k|		state_ptr->b [2] = 0 ;
  471|  3.97k|		state_ptr->b [3] = 0 ;
  472|  3.97k|		state_ptr->b [4] = 0 ;
  473|  3.97k|		state_ptr->b [5] = 0 ;
  474|  3.97k|		}
  475|  2.08M|	else			/* update a's and b's */
  476|  2.08M|	{	pks1 = pk0 ^ state_ptr->pk [0] ;		/* UPA2 */
  477|       |
  478|       |		/* update predictor pole a [1] */
  479|  2.08M|		a2p = state_ptr->a [1] - (state_ptr->a [1] >> 7) ;
  480|  2.08M|		if (dqsez != 0)
  ------------------
  |  Branch (480:7): [True: 1.88M, False: 200k]
  ------------------
  481|  1.88M|		{	fa1 = (pks1) ? state_ptr->a [0] : -state_ptr->a [0] ;
  ------------------
  |  Branch (481:11): [True: 610k, False: 1.27M]
  ------------------
  482|  1.88M|			if (fa1 < -8191)	/* a2p = function of fa1 */
  ------------------
  |  Branch (482:8): [True: 805k, False: 1.07M]
  ------------------
  483|   805k|				a2p -= 0x100 ;
  484|  1.07M|			else if (fa1 > 8191)
  ------------------
  |  Branch (484:13): [True: 313k, False: 762k]
  ------------------
  485|   313k|				a2p += 0xFF ;
  486|   762k|			else
  487|   762k|				a2p += fa1 >> 5 ;
  488|       |
  489|  1.88M|			if (pk0 ^ state_ptr->pk [1])
  ------------------
  |  Branch (489:8): [True: 979k, False: 901k]
  ------------------
  490|   979k|			{	/* LIMC */
  491|   979k|				if (a2p <= -12160)
  ------------------
  |  Branch (491:9): [True: 80.7k, False: 898k]
  ------------------
  492|  80.7k|					a2p = -12288 ;
  493|   898k|				else if (a2p >= 12416)
  ------------------
  |  Branch (493:14): [True: 0, False: 898k]
  ------------------
  494|      0|					a2p = 12288 ;
  495|   898k|				else
  496|   898k|					a2p -= 0x80 ;
  497|   979k|				}
  498|   901k|			else if (a2p <= -12416)
  ------------------
  |  Branch (498:13): [True: 141k, False: 759k]
  ------------------
  499|   141k|				a2p = -12288 ;
  500|   759k|			else if (a2p >= 12160)
  ------------------
  |  Branch (500:13): [True: 338, False: 759k]
  ------------------
  501|    338|				a2p = 12288 ;
  502|   759k|			else
  503|   759k|				a2p += 0x80 ;
  504|  1.88M|		}
  505|       |
  506|       |		/* TRIGB & DELAY */
  507|  2.08M|		state_ptr->a [1] = a2p ;
  508|       |
  509|       |		/* UPA1 */
  510|       |		/* update predictor pole a [0] */
  511|  2.08M|		state_ptr->a [0] -= state_ptr->a [0] >> 8 ;
  512|  2.08M|		if (dqsez != 0)
  ------------------
  |  Branch (512:7): [True: 1.88M, False: 200k]
  ------------------
  513|  1.88M|		{	if (pks1 == 0)
  ------------------
  |  Branch (513:9): [True: 1.27M, False: 610k]
  ------------------
  514|  1.27M|				state_ptr->a [0] += 192 ;
  515|   610k|			else
  516|   610k|				state_ptr->a [0] -= 192 ;
  517|  1.88M|			} ;
  518|       |
  519|       |		/* LIMD */
  520|  2.08M|		a1ul = 15360 - a2p ;
  521|  2.08M|		if (state_ptr->a [0] < -a1ul)
  ------------------
  |  Branch (521:7): [True: 3.22k, False: 2.07M]
  ------------------
  522|  3.22k|			state_ptr->a [0] = -a1ul ;
  523|  2.07M|		else if (state_ptr->a [0] > a1ul)
  ------------------
  |  Branch (523:12): [True: 700, False: 2.07M]
  ------------------
  524|    700|			state_ptr->a [0] = a1ul ;
  525|       |
  526|       |		/* UPB : update predictor zeros b [6] */
  527|  14.5M|		for (cnt = 0 ; cnt < 6 ; cnt++)
  ------------------
  |  Branch (527:18): [True: 12.4M, False: 2.08M]
  ------------------
  528|  12.4M|		{	if (code_size == 5)		/* for 40Kbps G.723 */
  ------------------
  |  Branch (528:9): [True: 8.87M, False: 3.61M]
  ------------------
  529|  8.87M|				state_ptr->b [cnt] -= state_ptr->b [cnt] >> 9 ;
  530|  3.61M|			else			/* for G.721 and 24Kbps G.723 */
  531|  3.61M|				state_ptr->b [cnt] -= state_ptr->b [cnt] >> 8 ;
  532|  12.4M|			if (dq & 0x7FFF)			/* XOR */
  ------------------
  |  Branch (532:8): [True: 10.0M, False: 2.42M]
  ------------------
  533|  10.0M|			{	if ((dq ^ state_ptr->dq [cnt]) >= 0)
  ------------------
  |  Branch (533:10): [True: 4.91M, False: 5.14M]
  ------------------
  534|  4.91M|					state_ptr->b [cnt] += 128 ;
  535|  5.14M|				else
  536|  5.14M|					state_ptr->b [cnt] -= 128 ;
  537|  10.0M|				}
  538|  12.4M|			}
  539|  2.08M|		}
  540|       |
  541|  12.5M|	for (cnt = 5 ; cnt > 0 ; cnt--)
  ------------------
  |  Branch (541:17): [True: 10.4M, False: 2.08M]
  ------------------
  542|  10.4M|		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|  2.08M|	if (mag == 0)
  ------------------
  |  Branch (544:6): [True: 404k, False: 1.68M]
  ------------------
  545|   404k|		state_ptr->dq [0] = (dq >= 0) ? 0x20 : 0xFC20 ;
  ------------------
  |  Branch (545:23): [True: 184k, False: 220k]
  ------------------
  546|  1.68M|	else
  547|  1.68M|	{	expon = quan (mag, power2, 15) ;
  548|  1.68M|		state_ptr->dq [0] = (dq >= 0) ?
  ------------------
  |  Branch (548:23): [True: 998k, False: 681k]
  ------------------
  549|   998k|			(expon << 6) + ((mag << 6) >> expon) :
  550|  1.68M|			(expon << 6) + ((mag << 6) >> expon) - 0x400 ;
  551|  1.68M|		}
  552|       |
  553|  2.08M|	state_ptr->sr [1] = state_ptr->sr [0] ;
  554|       |	/* FLOAT B : convert sr to 4-bit exp., 6-bit mantissa f.p. */
  555|  2.08M|	if (sr == 0)
  ------------------
  |  Branch (555:6): [True: 134k, False: 1.95M]
  ------------------
  556|   134k|		state_ptr->sr [0] = 0x20 ;
  557|  1.95M|	else if (sr > 0)
  ------------------
  |  Branch (557:11): [True: 972k, False: 979k]
  ------------------
  558|   972k|	{	expon = quan (sr, power2, 15) ;
  559|   972k|		state_ptr->sr [0] = (expon << 6) + ((sr << 6) >> expon) ;
  560|   972k|		}
  561|   979k|	else if (sr > -32768)
  ------------------
  |  Branch (561:11): [True: 979k, False: 196]
  ------------------
  562|   979k|	{	mag = -sr ;
  563|   979k|		expon = quan (mag, power2, 15) ;
  564|   979k|		state_ptr->sr [0] = (expon << 6) + ((mag << 6) >> expon) - 0x400 ;
  565|   979k|		}
  566|    196|	else
  567|    196|		state_ptr->sr [0] = (short) 0xFC20 ;
  568|       |
  569|       |	/* DELAY A */
  570|  2.08M|	state_ptr->pk [1] = state_ptr->pk [0] ;
  571|  2.08M|	state_ptr->pk [0] = pk0 ;
  572|       |
  573|       |	/* TONE */
  574|  2.08M|	if (tr == 1)		/* this sample has been treated as data */
  ------------------
  |  Branch (574:6): [True: 3.97k, False: 2.08M]
  ------------------
  575|  3.97k|		state_ptr->td = 0 ;	/* next one will be treated as voice */
  576|  2.08M|	else if (a2p < -11776)	/* small sample-to-sample correlation */
  ------------------
  |  Branch (576:11): [True: 384k, False: 1.69M]
  ------------------
  577|   384k|		state_ptr->td = 1 ;	/* signal may be data */
  578|  1.69M|	else				/* signal is voice */
  579|  1.69M|		state_ptr->td = 0 ;
  580|       |
  581|       |	/*
  582|       |	 * Adaptation speed control.
  583|       |	 */
  584|  2.08M|	state_ptr->dms += (fi - state_ptr->dms) >> 5 ;		/* FILTA */
  585|  2.08M|	state_ptr->dml += (((fi << 2) - state_ptr->dml) >> 7) ;	/* FILTB */
  586|       |
  587|  2.08M|	if (tr == 1)
  ------------------
  |  Branch (587:6): [True: 3.97k, False: 2.08M]
  ------------------
  588|  3.97k|		state_ptr->ap = 256 ;
  589|  2.08M|	else if (y < 1536)					/* SUBTC */
  ------------------
  |  Branch (589:11): [True: 122k, False: 1.95M]
  ------------------
  590|   122k|		state_ptr->ap += (0x200 - state_ptr->ap) >> 4 ;
  591|  1.95M|	else if (state_ptr->td == 1)
  ------------------
  |  Branch (591:11): [True: 383k, False: 1.57M]
  ------------------
  592|   383k|		state_ptr->ap += (0x200 - state_ptr->ap) >> 4 ;
  593|  1.57M|	else if (abs ((state_ptr->dms << 2) - state_ptr->dml) >= (state_ptr->dml >> 3))
  ------------------
  |  Branch (593:11): [True: 370k, False: 1.20M]
  ------------------
  594|   370k|		state_ptr->ap += (0x200 - state_ptr->ap) >> 4 ;
  595|  1.20M|	else
  596|  1.20M|		state_ptr->ap += (-state_ptr->ap) >> 4 ;
  597|       |
  598|  2.08M|	return ;
  599|  2.08M|} /* update */
g72x.c:g72x_state_new:
  103|    546|{	return calloc (1, sizeof (G72x_STATE)) ;
  104|    546|}
g72x.c:fmult:
   77|  16.6M|{
   78|  16.6M|	short		anmag, anexp, anmant ;
   79|  16.6M|	short		wanexp, wanmant ;
   80|  16.6M|	short		retval ;
   81|       |
   82|  16.6M|	anmag = (an > 0) ? an : ((-an) & 0x1FFF) ;
  ------------------
  |  Branch (82:10): [True: 7.75M, False: 8.93M]
  ------------------
   83|  16.6M|	anexp = quan (anmag, power2, 15) - 6 ;
   84|  16.6M|	anmant = (anmag == 0) ? 32 :
  ------------------
  |  Branch (84:11): [True: 240k, False: 16.4M]
  ------------------
   85|  16.6M|				(anexp >= 0) ? anmag >> anexp : anmag << -anexp ;
  ------------------
  |  Branch (85:5): [True: 15.2M, False: 1.20M]
  ------------------
   86|  16.6M|	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|  16.6M|	wanmant = (anmant * (srn & 0x3F)) >> 4 ;
   96|       |
   97|  16.6M|	retval = (wanexp >= 0) ? ((wanmant << wanexp) & 0x7FFF) : (wanmant >> -wanexp) ;
  ------------------
  |  Branch (97:11): [True: 10.6M, False: 6.04M]
  ------------------
   98|       |
   99|  16.6M|	return (((an ^ srn) < 0) ? -retval : retval) ;
  ------------------
  |  Branch (99:10): [True: 8.10M, False: 8.58M]
  ------------------
  100|  16.6M|}
g72x.c:quan:
   60|  20.3M|{
   61|  20.3M|	int		i ;
   62|       |
   63|   210M|	for (i = 0 ; i < size ; i++)
  ------------------
  |  Branch (63:15): [True: 209M, False: 434k]
  ------------------
   64|   209M|		if (val < *table++)
  ------------------
  |  Branch (64:7): [True: 19.8M, False: 189M]
  ------------------
   65|  19.8M|			break ;
   66|  20.3M|	return i ;
   67|  20.3M|}
g72x.c:unpack_bytes:
  606|  17.3k|{	unsigned int	in_buffer = 0 ;
  607|  17.3k|	unsigned char	in_byte ;
  608|  17.3k|	int				k, in_bits = 0, bindex = 0 ;
  609|       |
  610|  2.10M|	for (k = 0 ; bindex <= blocksize && k < G72x_BLOCK_SIZE ; k++)
  ------------------
  |  |   32|  2.10M|#define	G72x_BLOCK_SIZE		(3 * 5 * 8)
  ------------------
  |  Branch (610:15): [True: 2.10M, False: 0]
  |  Branch (610:38): [True: 2.08M, False: 17.3k]
  ------------------
  611|  2.08M|	{	if (in_bits < bits)
  ------------------
  |  Branch (611:8): [True: 1.15M, False: 929k]
  ------------------
  612|  1.15M|		{	in_byte = block [bindex++] ;
  613|       |
  614|  1.15M|			in_buffer |= (in_byte << in_bits) ;
  615|  1.15M|			in_bits += 8 ;
  616|  1.15M|			}
  617|  2.08M|		samples [k] = in_buffer & ((1 << bits) - 1) ;
  618|  2.08M|		in_buffer >>= bits ;
  619|  2.08M|		in_bits -= bits ;
  620|  2.08M|		} ;
  621|       |
  622|  17.3k|	return k ;
  623|  17.3k|} /* unpack_bytes */

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

gsm_sub:
   26|  38.9k|{
   27|  38.9k|	int32_t diff = (int32_t) a - (int32_t) b ;
   28|  38.9k|	return saturate (diff) ;
  ------------------
  |  |   17|  38.9k|	((x) < MIN_WORD ? MIN_WORD : (x) > MAX_WORD ? MAX_WORD: (x))
  |  |  ------------------
  |  |  |  |   51|  38.9k|#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|  38.9k|#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: 38.9k]
  |  |  |  Branch (17:31): [True: 0, False: 38.9k]
  |  |  ------------------
  ------------------
   29|  38.9k|}
gsm_asr:
  163|   260k|{
  164|   260k|	if (n >= 16) return - (a < 0) ;
  ------------------
  |  Branch (164:6): [True: 0, False: 260k]
  ------------------
  165|   260k|	if (n <= -16) return 0 ;
  ------------------
  |  Branch (165:6): [True: 0, False: 260k]
  ------------------
  166|   260k|	if (n < 0) return a << -n ;
  ------------------
  |  Branch (166:6): [True: 0, False: 260k]
  ------------------
  167|       |
  168|   260k|	return SASR_W (a, (int16_t) n) ;
  169|   260k|}
gsm_asl:
  172|  19.4k|{
  173|  19.4k|	if (n >= 16) return 0 ;
  ------------------
  |  Branch (173:6): [True: 0, False: 19.4k]
  ------------------
  174|  19.4k|	if (n <= -16) return - (a < 0) ;
  ------------------
  |  Branch (174:6): [True: 0, False: 19.4k]
  ------------------
  175|  19.4k|	if (n < 0) return gsm_asr (a, -n) ;
  ------------------
  |  Branch (175:6): [True: 6.59k, False: 12.9k]
  ------------------
  176|  12.9k|	return a << n ;
  177|  19.4k|}

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

decode.c:GSM_MULT_R:
  118|   779k|{	return (((int32_t) (a)) * ((int32_t) (b)) + 16384) >> 15 ;
  119|   779k|} /* GSM_MULT_R */
decode.c:GSM_ADD:
  150|  1.55M|{	int32_t ltmp ;
  151|       |
  152|  1.55M|	ltmp = ((int32_t) a) + ((int32_t) b) ;
  153|       |
  154|  1.55M|	if (ltmp >= MAX_WORD)
  ------------------
  |  |   52|  1.55M|#define	MAX_WORD	32767
  ------------------
  |  Branch (154:6): [True: 294k, False: 1.26M]
  ------------------
  155|   294k|		return MAX_WORD ;
  ------------------
  |  |   52|   294k|#define	MAX_WORD	32767
  ------------------
  156|  1.26M|	if (ltmp <= MIN_WORD)
  ------------------
  |  |   51|  1.26M|#define	MIN_WORD	(-32767 - 1)
  ------------------
  |  Branch (156:6): [True: 336k, False: 928k]
  ------------------
  157|   336k|		return MIN_WORD ;
  ------------------
  |  |   51|   336k|#define	MIN_WORD	(-32767 - 1)
  ------------------
  158|       |
  159|   928k|	return ltmp ;
  160|  1.26M|} /* GSM_ADD */
long_term.c:GSM_MULT_R:
  118|   779k|{	return (((int32_t) (a)) * ((int32_t) (b)) + 16384) >> 15 ;
  119|   779k|} /* GSM_MULT_R */
long_term.c:GSM_ADD:
  150|   779k|{	int32_t ltmp ;
  151|       |
  152|   779k|	ltmp = ((int32_t) a) + ((int32_t) b) ;
  153|       |
  154|   779k|	if (ltmp >= MAX_WORD)
  ------------------
  |  |   52|   779k|#define	MAX_WORD	32767
  ------------------
  |  Branch (154:6): [True: 54.8k, False: 725k]
  ------------------
  155|  54.8k|		return MAX_WORD ;
  ------------------
  |  |   52|  54.8k|#define	MAX_WORD	32767
  ------------------
  156|   725k|	if (ltmp <= MIN_WORD)
  ------------------
  |  |   51|   725k|#define	MIN_WORD	(-32767 - 1)
  ------------------
  |  Branch (156:6): [True: 2.39k, False: 722k]
  ------------------
  157|  2.39k|		return MIN_WORD ;
  ------------------
  |  |   51|  2.39k|#define	MIN_WORD	(-32767 - 1)
  ------------------
  158|       |
  159|   722k|	return ltmp ;
  160|   725k|} /* GSM_ADD */
rpe.c:SASR_W:
   60|  11.5k|{	if (x >= 0)
  ------------------
  |  Branch (60:7): [True: 11.5k, False: 0]
  ------------------
   61|  11.5k|		return x >> by ;
   62|      0|	return ~ ((~x) >> by) ;
   63|  11.5k|} /* SASR_W */
rpe.c:arith_shift_left:
  306|   253k|{	return (int32_t) (((uint32_t) x) << shift) ;
  307|   253k|} /* arith_shift_left */
rpe.c:GSM_MULT_R:
  118|   253k|{	return (((int32_t) (a)) * ((int32_t) (b)) + 16384) >> 15 ;
  119|   253k|} /* GSM_MULT_R */
rpe.c:GSM_ADD:
  150|   253k|{	int32_t ltmp ;
  151|       |
  152|   253k|	ltmp = ((int32_t) a) + ((int32_t) b) ;
  153|       |
  154|   253k|	if (ltmp >= MAX_WORD)
  ------------------
  |  |   52|   253k|#define	MAX_WORD	32767
  ------------------
  |  Branch (154:6): [True: 0, False: 253k]
  ------------------
  155|      0|		return MAX_WORD ;
  ------------------
  |  |   52|      0|#define	MAX_WORD	32767
  ------------------
  156|   253k|	if (ltmp <= MIN_WORD)
  ------------------
  |  |   51|   253k|#define	MIN_WORD	(-32767 - 1)
  ------------------
  |  Branch (156:6): [True: 0, False: 253k]
  ------------------
  157|      0|		return MIN_WORD ;
  ------------------
  |  |   51|      0|#define	MIN_WORD	(-32767 - 1)
  ------------------
  158|       |
  159|   253k|	return ltmp ;
  160|   253k|} /* GSM_ADD */
short_term.c:arith_shift_left:
  306|  38.9k|{	return (int32_t) (((uint32_t) x) << shift) ;
  307|  38.9k|} /* arith_shift_left */
short_term.c:GSM_ADD:
  150|  6.52M|{	int32_t ltmp ;
  151|       |
  152|  6.52M|	ltmp = ((int32_t) a) + ((int32_t) b) ;
  153|       |
  154|  6.52M|	if (ltmp >= MAX_WORD)
  ------------------
  |  |   52|  6.52M|#define	MAX_WORD	32767
  ------------------
  |  Branch (154:6): [True: 102k, False: 6.42M]
  ------------------
  155|   102k|		return MAX_WORD ;
  ------------------
  |  |   52|   102k|#define	MAX_WORD	32767
  ------------------
  156|  6.42M|	if (ltmp <= MIN_WORD)
  ------------------
  |  |   51|  6.42M|#define	MIN_WORD	(-32767 - 1)
  ------------------
  |  Branch (156:6): [True: 12.9k, False: 6.41M]
  ------------------
  157|  12.9k|		return MIN_WORD ;
  ------------------
  |  |   51|  12.9k|#define	MIN_WORD	(-32767 - 1)
  ------------------
  158|       |
  159|  6.41M|	return ltmp ;
  160|  6.42M|} /* GSM_ADD */
short_term.c:GSM_SUB:
  164|  6.27M|{	int32_t ltmp ;
  165|       |
  166|  6.27M|	ltmp = ((int32_t) a) - ((int32_t) b) ;
  167|       |
  168|  6.27M|	if (ltmp >= MAX_WORD)
  ------------------
  |  |   52|  6.27M|#define	MAX_WORD	32767
  ------------------
  |  Branch (168:6): [True: 186k, False: 6.09M]
  ------------------
  169|   186k|		ltmp = MAX_WORD ;
  ------------------
  |  |   52|   186k|#define	MAX_WORD	32767
  ------------------
  170|  6.09M|	else if (ltmp <= MIN_WORD)
  ------------------
  |  |   51|  6.09M|#define	MIN_WORD	(-32767 - 1)
  ------------------
  |  Branch (170:11): [True: 107k, False: 5.98M]
  ------------------
  171|   107k|		ltmp = MIN_WORD ;
  ------------------
  |  |   51|   107k|#define	MIN_WORD	(-32767 - 1)
  ------------------
  172|       |
  173|  6.27M|	return ltmp ;
  174|  6.27M|} /* GSM_SUB */
short_term.c:GSM_MULT_R:
  118|  38.9k|{	return (((int32_t) (a)) * ((int32_t) (b)) + 16384) >> 15 ;
  119|  38.9k|} /* GSM_MULT_R */
short_term.c:SASR_W:
   60|   311k|{	if (x >= 0)
  ------------------
  |  Branch (60:7): [True: 152k, False: 159k]
  ------------------
   61|   152k|		return x >> by ;
   62|   159k|	return ~ ((~x) >> by) ;
   63|   311k|} /* SASR_W */
add.c:SASR_W:
   60|   260k|{	if (x >= 0)
  ------------------
  |  Branch (60:7): [True: 124k, False: 136k]
  ------------------
   61|   124k|		return x >> by ;
   62|   136k|	return ~ ((~x) >> by) ;
   63|   260k|} /* SASR_W */

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

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

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

gsm_option:
   12|    309|{
   13|    309|	int 	result = -1 ;
   14|       |
   15|    309|	switch (opt) {
   16|      0|	case GSM_OPT_LTP_CUT:
  ------------------
  |  |   29|      0|#define	GSM_OPT_LTP_CUT		3
  ------------------
  |  Branch (16:2): [True: 0, False: 309]
  ------------------
   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: 309]
  ------------------
   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: 309]
  ------------------
   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: 309]
  ------------------
   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: 309]
  ------------------
   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|    309|	case GSM_OPT_WAV49:
  ------------------
  |  |   30|    309|#define	GSM_OPT_WAV49		4
  ------------------
  |  Branch (54:2): [True: 309, False: 0]
  ------------------
   55|       |
   56|    309|#ifdef WAV49
   57|    309|		result = r->wav_fmt ;
   58|    309|		if (val) r->wav_fmt = !!*val ;
  ------------------
  |  Branch (58:7): [True: 309, False: 0]
  ------------------
   59|    309|#endif
   60|    309|		break ;
   61|       |
   62|      0|	default:
  ------------------
  |  Branch (62:2): [True: 0, False: 309]
  ------------------
   63|      0|		break ;
   64|    309|	}
   65|    309|	return result ;
   66|    309|}

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

Gsm_RPE_Decoding:
  453|  19.4k|{
  454|  19.4k|	int16_t	expon, mant ;
  455|  19.4k|	int16_t	xMp [13] ;
  456|       |
  457|  19.4k|	APCM_quantization_xmaxc_to_exp_mant (xmaxcr, &expon, &mant) ;
  458|  19.4k|	APCM_inverse_quantization (xMcr, mant, expon, xMp) ;
  459|  19.4k|	RPE_grid_positioning (Mcr, xMp, erp) ;
  460|  19.4k|}
rpe.c:APCM_inverse_quantization:
  345|  19.4k|{
  346|  19.4k|	int	i ;
  347|  19.4k|	int16_t	temp, temp1, temp2, temp3 ;
  348|       |
  349|  19.4k|	assert (mant >= 0 && mant <= 7) ;
  ------------------
  |  Branch (349:2): [True: 0, False: 19.4k]
  |  Branch (349:2): [True: 0, False: 0]
  |  Branch (349:2): [True: 19.4k, False: 0]
  |  Branch (349:2): [True: 19.4k, False: 0]
  ------------------
  350|       |
  351|  19.4k|	temp1 = gsm_FAC [mant] ;	/* see 4.2-15 for mant */
  352|  19.4k|	temp2 = gsm_sub (6, expon) ;	/* see 4.2-15 for exp  */
  353|  19.4k|	temp3 = gsm_asl (1, gsm_sub (temp2, 1)) ;
  354|       |
  355|   272k|	for (i = 13 ; i-- ;)
  ------------------
  |  Branch (355:16): [True: 253k, False: 19.4k]
  ------------------
  356|   253k|	{	assert (*xMc <= 7 && *xMc >= 0) ;	/* 3 bit unsigned */
  ------------------
  |  Branch (356:4): [True: 0, False: 253k]
  |  Branch (356:4): [True: 0, False: 0]
  |  Branch (356:4): [True: 253k, False: 0]
  |  Branch (356:4): [True: 253k, False: 0]
  ------------------
  357|       |
  358|       |		/* temp = gsm_sub (*xMc++ << 1, 7) ; */
  359|   253k|		temp = (*xMc++ << 1) - 7 ;			/* restore sign   */
  360|   253k|		assert (temp <= 7 && temp >= -7) ;	/* 4 bit signed   */
  ------------------
  |  Branch (360:3): [True: 0, False: 253k]
  |  Branch (360:3): [True: 0, False: 0]
  |  Branch (360:3): [True: 253k, False: 0]
  |  Branch (360:3): [True: 253k, False: 0]
  ------------------
  361|       |
  362|   253k|		temp = arith_shift_left (temp, 12) ;	/* 16 bit signed  */
  363|   253k|		temp = GSM_MULT_R (temp1, temp) ;
  364|   253k|		temp = GSM_ADD (temp, temp3) ;
  365|   253k|		*xMp++ = gsm_asr (temp, temp2) ;
  366|   253k|	}
  367|  19.4k|}
rpe.c:RPE_grid_positioning:
  383|  19.4k|{
  384|  19.4k|	int	i = 13 ;
  385|       |
  386|  19.4k|	assert (0 <= Mc && Mc <= 3) ;
  ------------------
  |  Branch (386:2): [True: 0, False: 19.4k]
  |  Branch (386:2): [True: 0, False: 0]
  |  Branch (386:2): [True: 19.4k, False: 0]
  |  Branch (386:2): [True: 19.4k, False: 0]
  ------------------
  387|       |
  388|  19.4k|	switch (Mc)
  ------------------
  |  Branch (388:10): [True: 19.4k, False: 0]
  ------------------
  389|  19.4k|	{	case 3: *ep++ = 0 ;
  ------------------
  |  Branch (389:4): [True: 4.51k, False: 14.9k]
  ------------------
  390|       |				/* Falls through. */
  391|  10.5k|		case 2: do
  ------------------
  |  Branch (391:3): [True: 6.04k, False: 13.4k]
  ------------------
  392|   244k|				{	*ep++ = 0 ;
  393|       |				/* Falls through. */
  394|   246k|		case 1:		*ep++ = 0 ;
  ------------------
  |  Branch (394:3): [True: 2.36k, False: 17.1k]
  ------------------
  395|       |				/* Falls through. */
  396|   253k|		case 0:		*ep++ = *xMp++ ;
  ------------------
  |  Branch (396:3): [True: 6.56k, False: 12.9k]
  ------------------
  397|   253k|					} while (--i) ;
  ------------------
  |  Branch (397:15): [True: 233k, False: 19.4k]
  ------------------
  398|  19.4k|	}
  399|  49.9k|	while (++Mc < 4) *ep++ = 0 ;
  ------------------
  |  Branch (399:9): [True: 30.4k, False: 19.4k]
  ------------------
  400|  19.4k|}
rpe.c:APCM_quantization_xmaxc_to_exp_mant:
  216|  19.4k|{
  217|  19.4k|	int16_t	expon, mant ;
  218|       |
  219|       |	/* Compute expononent and mantissa of the decoded version of xmaxc
  220|       |	 */
  221|       |
  222|  19.4k|	expon = 0 ;
  223|  19.4k|	if (xmaxc > 15) expon = SASR_W (xmaxc, 3) - 1 ;
  ------------------
  |  Branch (223:6): [True: 11.5k, False: 7.91k]
  ------------------
  224|  19.4k|	mant = xmaxc - (expon << 3) ;
  225|       |
  226|  19.4k|	if (mant == 0)
  ------------------
  |  Branch (226:6): [True: 5.26k, False: 14.2k]
  ------------------
  227|  5.26k|	{	expon = -4 ;
  228|  5.26k|		mant = 7 ;
  229|  5.26k|		}
  230|  14.2k|	else
  231|  16.8k|	{	while (mant <= 7)
  ------------------
  |  Branch (231:11): [True: 2.59k, False: 14.2k]
  ------------------
  232|  2.59k|		{	mant = mant << 1 | 1 ;
  233|  2.59k|			expon-- ;
  234|  2.59k|			}
  235|  14.2k|		mant -= 8 ;
  236|  14.2k|		}
  237|       |
  238|  19.4k|	assert (expon >= -4 && expon <= 6) ;
  ------------------
  |  Branch (238:2): [True: 0, False: 19.4k]
  |  Branch (238:2): [True: 0, False: 0]
  |  Branch (238:2): [True: 19.4k, False: 0]
  |  Branch (238:2): [True: 19.4k, False: 0]
  ------------------
  239|  19.4k|	assert (mant >= 0 && mant <= 7) ;
  ------------------
  |  Branch (239:2): [True: 0, False: 19.4k]
  |  Branch (239:2): [True: 0, False: 0]
  |  Branch (239:2): [True: 19.4k, False: 0]
  |  Branch (239:2): [True: 19.4k, False: 0]
  ------------------
  240|       |
  241|  19.4k|	*expon_out = expon ;
  242|  19.4k|	*mant_out = mant ;
  243|  19.4k|}

Gsm_Short_Term_Synthesis_Filter:
  379|  4.87k|{
  380|  4.87k|	int16_t		* LARpp_j	= S->LARpp [S->j] ;
  381|  4.87k|	int16_t		* LARpp_j_1	= S->LARpp [S->j ^= 1] ;
  382|       |
  383|  4.87k|	int16_t		LARp [8] ;
  384|       |
  385|  4.87k|#undef	FILTER
  386|  4.87k|#if defined (FAST) && defined (USE_FLOAT_MUL)
  387|       |
  388|  4.87k|# 	define	FILTER 	(* (S->fast							\
  389|  4.87k|				? Fast_Short_term_synthesis_filtering	\
  390|  4.87k|				: Short_term_synthesis_filtering))
  391|       |#else
  392|       |#	define	FILTER	Short_term_synthesis_filtering
  393|       |#endif
  394|       |
  395|  4.87k|	Decoding_of_the_coded_Log_Area_Ratios (LARcr, LARpp_j) ;
  396|       |
  397|  4.87k|	Coefficients_0_12 (LARpp_j_1, LARpp_j, LARp) ;
  398|  4.87k|	LARp_to_rp (LARp) ;
  399|  4.87k|	FILTER (S, LARp, 13, wt, s) ;
  ------------------
  |  |  388|  4.87k|# 	define	FILTER 	(* (S->fast							\
  |  |  ------------------
  |  |  |  Branch (388:23): [True: 0, False: 4.87k]
  |  |  ------------------
  |  |  389|  4.87k|				? Fast_Short_term_synthesis_filtering	\
  |  |  390|  4.87k|				: Short_term_synthesis_filtering))
  ------------------
  400|       |
  401|  4.87k|	Coefficients_13_26 (LARpp_j_1, LARpp_j, LARp) ;
  402|  4.87k|	LARp_to_rp (LARp) ;
  403|  4.87k|	FILTER (S, LARp, 14, wt + 13, s + 13) ;
  ------------------
  |  |  388|  4.87k|# 	define	FILTER 	(* (S->fast							\
  |  |  ------------------
  |  |  |  Branch (388:23): [True: 0, False: 4.87k]
  |  |  ------------------
  |  |  389|  4.87k|				? Fast_Short_term_synthesis_filtering	\
  |  |  390|  4.87k|				: Short_term_synthesis_filtering))
  ------------------
  404|       |
  405|  4.87k|	Coefficients_27_39 (LARpp_j_1, LARpp_j, LARp) ;
  406|  4.87k|	LARp_to_rp (LARp) ;
  407|  4.87k|	FILTER (S, LARp, 13, wt + 27, s + 27) ;
  ------------------
  |  |  388|  4.87k|# 	define	FILTER 	(* (S->fast							\
  |  |  ------------------
  |  |  |  Branch (388:23): [True: 0, False: 4.87k]
  |  |  ------------------
  |  |  389|  4.87k|				? Fast_Short_term_synthesis_filtering	\
  |  |  390|  4.87k|				: Short_term_synthesis_filtering))
  ------------------
  408|       |
  409|  4.87k|	Coefficients_40_159 (LARpp_j, LARp) ;
  410|  4.87k|	LARp_to_rp (LARp) ;
  411|  4.87k|	FILTER (S, LARp, 120, wt + 40, s + 40) ;
  ------------------
  |  |  388|  4.87k|# 	define	FILTER 	(* (S->fast							\
  |  |  ------------------
  |  |  |  Branch (388:23): [True: 0, False: 4.87k]
  |  |  ------------------
  |  |  389|  4.87k|				? Fast_Short_term_synthesis_filtering	\
  |  |  390|  4.87k|				: Short_term_synthesis_filtering))
  ------------------
  412|  4.87k|}
short_term.c:Decoding_of_the_coded_Log_Area_Ratios:
   21|  4.87k|{
   22|  4.87k|	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|  4.87k|#undef	STEP
   48|  4.87k|#define	STEP(B, MIC, INVA)	\
   49|  4.87k|		temp1	= arith_shift_left (GSM_ADD (*LARc++, MIC), 10) ;	\
   50|  4.87k|		temp1	= GSM_SUB (temp1, B * 2) ;			\
   51|  4.87k|		temp1	= GSM_MULT_R (INVA, temp1) ;		\
   52|  4.87k|		*LARpp++ = GSM_ADD (temp1, temp1) ;
   53|       |
   54|  4.87k|	STEP (0, -32, 13107) ;
  ------------------
  |  |   49|  4.87k|		temp1	= arith_shift_left (GSM_ADD (*LARc++, MIC), 10) ;	\
  |  |   50|  4.87k|		temp1	= GSM_SUB (temp1, B * 2) ;			\
  |  |   51|  4.87k|		temp1	= GSM_MULT_R (INVA, temp1) ;		\
  |  |   52|  4.87k|		*LARpp++ = GSM_ADD (temp1, temp1) ;
  ------------------
   55|  4.87k|	STEP (0, -32, 13107) ;
  ------------------
  |  |   49|  4.87k|		temp1	= arith_shift_left (GSM_ADD (*LARc++, MIC), 10) ;	\
  |  |   50|  4.87k|		temp1	= GSM_SUB (temp1, B * 2) ;			\
  |  |   51|  4.87k|		temp1	= GSM_MULT_R (INVA, temp1) ;		\
  |  |   52|  4.87k|		*LARpp++ = GSM_ADD (temp1, temp1) ;
  ------------------
   56|  4.87k|	STEP (2048, -16, 13107) ;
  ------------------
  |  |   49|  4.87k|		temp1	= arith_shift_left (GSM_ADD (*LARc++, MIC), 10) ;	\
  |  |   50|  4.87k|		temp1	= GSM_SUB (temp1, B * 2) ;			\
  |  |   51|  4.87k|		temp1	= GSM_MULT_R (INVA, temp1) ;		\
  |  |   52|  4.87k|		*LARpp++ = GSM_ADD (temp1, temp1) ;
  ------------------
   57|  4.87k|	STEP (-2560, -16, 13107) ;
  ------------------
  |  |   49|  4.87k|		temp1	= arith_shift_left (GSM_ADD (*LARc++, MIC), 10) ;	\
  |  |   50|  4.87k|		temp1	= GSM_SUB (temp1, B * 2) ;			\
  |  |   51|  4.87k|		temp1	= GSM_MULT_R (INVA, temp1) ;		\
  |  |   52|  4.87k|		*LARpp++ = GSM_ADD (temp1, temp1) ;
  ------------------
   58|       |
   59|  4.87k|	STEP (94, -8, 19223) ;
  ------------------
  |  |   49|  4.87k|		temp1	= arith_shift_left (GSM_ADD (*LARc++, MIC), 10) ;	\
  |  |   50|  4.87k|		temp1	= GSM_SUB (temp1, B * 2) ;			\
  |  |   51|  4.87k|		temp1	= GSM_MULT_R (INVA, temp1) ;		\
  |  |   52|  4.87k|		*LARpp++ = GSM_ADD (temp1, temp1) ;
  ------------------
   60|  4.87k|	STEP (-1792, -8, 17476) ;
  ------------------
  |  |   49|  4.87k|		temp1	= arith_shift_left (GSM_ADD (*LARc++, MIC), 10) ;	\
  |  |   50|  4.87k|		temp1	= GSM_SUB (temp1, B * 2) ;			\
  |  |   51|  4.87k|		temp1	= GSM_MULT_R (INVA, temp1) ;		\
  |  |   52|  4.87k|		*LARpp++ = GSM_ADD (temp1, temp1) ;
  ------------------
   61|  4.87k|	STEP (-341, -4, 31454) ;
  ------------------
  |  |   49|  4.87k|		temp1	= arith_shift_left (GSM_ADD (*LARc++, MIC), 10) ;	\
  |  |   50|  4.87k|		temp1	= GSM_SUB (temp1, B * 2) ;			\
  |  |   51|  4.87k|		temp1	= GSM_MULT_R (INVA, temp1) ;		\
  |  |   52|  4.87k|		*LARpp++ = GSM_ADD (temp1, temp1) ;
  ------------------
   62|  4.87k|	STEP (-1144, -4, 29708) ;
  ------------------
  |  |   49|  4.87k|		temp1	= arith_shift_left (GSM_ADD (*LARc++, MIC), 10) ;	\
  |  |   50|  4.87k|		temp1	= GSM_SUB (temp1, B * 2) ;			\
  |  |   51|  4.87k|		temp1	= GSM_MULT_R (INVA, temp1) ;		\
  |  |   52|  4.87k|		*LARpp++ = GSM_ADD (temp1, temp1) ;
  ------------------
   63|       |
   64|       |	/* NOTE: the addition of *MIC is used to restore
   65|       |	 * 	 the sign of *LARc.
   66|       |	 */
   67|  4.87k|}
short_term.c:Coefficients_0_12:
   89|  4.87k|{
   90|  4.87k|	register int 	i ;
   91|       |
   92|  43.8k|	for (i = 1 ; i <= 8 ; i++, LARp++, LARpp_j_1++, LARpp_j++)
  ------------------
  |  Branch (92:15): [True: 38.9k, False: 4.87k]
  ------------------
   93|  38.9k|	{	*LARp = GSM_ADD (SASR_W (*LARpp_j_1, 2), SASR_W (*LARpp_j, 2)) ;
   94|  38.9k|		*LARp = GSM_ADD (*LARp, SASR_W (*LARpp_j_1, 1)) ;
   95|  38.9k|		}
   96|  4.87k|}
short_term.c:LARp_to_rp:
  141|  19.4k|{
  142|  19.4k|	register int 		i ;
  143|  19.4k|	register int16_t		temp ;
  144|       |
  145|   175k|	for (i = 1 ; i <= 8 ; i++, LARp++)
  ------------------
  |  Branch (145:15): [True: 155k, False: 19.4k]
  ------------------
  146|   155k|	{	/* 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|   155k|		if (*LARp < 0)
  ------------------
  |  Branch (155:7): [True: 83.2k, False: 72.7k]
  ------------------
  156|  83.2k|		{	temp = *LARp == MIN_WORD ? MAX_WORD : - (*LARp) ;
  ------------------
  |  |   51|  83.2k|#define	MIN_WORD	(-32767 - 1)
  ------------------
              		{	temp = *LARp == MIN_WORD ? MAX_WORD : - (*LARp) ;
  ------------------
  |  |   52|      0|#define	MAX_WORD	32767
  ------------------
  |  Branch (156:12): [True: 0, False: 83.2k]
  ------------------
  157|  83.2k|			*LARp = - ((temp < 11059) ? temp << 1
  ------------------
  |  Branch (157:15): [True: 61.9k, False: 21.2k]
  ------------------
  158|  83.2k|				: ((temp < 20070) ? temp + 11059
  ------------------
  |  Branch (158:8): [True: 11.6k, False: 9.63k]
  ------------------
  159|  21.2k|				: GSM_ADD ((int16_t) (temp >> 2), (int16_t) 26112))) ;
  160|  83.2k|			}
  161|  72.7k|		else
  162|  72.7k|		{	temp = *LARp ;
  163|  72.7k|			*LARp = (temp < 11059) ? temp << 1
  ------------------
  |  Branch (163:12): [True: 52.9k, False: 19.8k]
  ------------------
  164|  72.7k|				: ((temp < 20070) ? temp + 11059
  ------------------
  |  Branch (164:8): [True: 13.5k, False: 6.27k]
  ------------------
  165|  19.8k|				: GSM_ADD ((int16_t) (temp >> 2), (int16_t) 26112)) ;
  166|  72.7k|			}
  167|   155k|	}
  168|  19.4k|}
short_term.c:Coefficients_13_26:
  102|  4.87k|{
  103|  4.87k|	register int i ;
  104|  43.8k|	for (i = 1 ; i <= 8 ; i++, LARpp_j_1++, LARpp_j++, LARp++)
  ------------------
  |  Branch (104:15): [True: 38.9k, False: 4.87k]
  ------------------
  105|  38.9k|		*LARp = GSM_ADD (SASR_W (*LARpp_j_1, 1), SASR_W (*LARpp_j, 1)) ;
  106|  4.87k|}
short_term.c:Coefficients_27_39:
  112|  4.87k|{
  113|  4.87k|	register int i ;
  114|       |
  115|  43.8k|	for (i = 1 ; i <= 8 ; i++, LARpp_j_1++, LARpp_j++, LARp++)
  ------------------
  |  Branch (115:15): [True: 38.9k, False: 4.87k]
  ------------------
  116|  38.9k|	{	*LARp = GSM_ADD (SASR_W (*LARpp_j_1, 2), SASR_W (*LARpp_j, 2)) ;
  117|  38.9k|		*LARp = GSM_ADD (*LARp, SASR_W (*LARpp_j, 1)) ;
  118|  38.9k|		}
  119|  4.87k|}
short_term.c:Coefficients_40_159:
  125|  4.87k|{
  126|  4.87k|	register int i ;
  127|       |
  128|  43.8k|	for (i = 1 ; i <= 8 ; i++, LARp++, LARpp_j++)
  ------------------
  |  Branch (128:15): [True: 38.9k, False: 4.87k]
  ------------------
  129|  38.9k|		*LARp = *LARpp_j ;
  130|  4.87k|}
short_term.c:Short_term_synthesis_filtering:
  258|  19.4k|{
  259|  19.4k|	register int16_t		* v = S->v ;
  260|  19.4k|	register int		i ;
  261|  19.4k|	register int16_t		sri, tmp1, tmp2 ;
  262|       |
  263|   799k|	while (k--)
  ------------------
  |  Branch (263:9): [True: 779k, False: 19.4k]
  ------------------
  264|   779k|	{	sri = *wt++ ;
  265|  7.01M|		for (i = 8 ; i-- ; )
  ------------------
  |  Branch (265:16): [True: 6.23M, False: 779k]
  ------------------
  266|  6.23M|		{	/* sri = GSM_SUB(sri, gsm_mult_r(rrp[i], v [i])) ;
  267|       |			 */
  268|  6.23M|			tmp1 = rrp [i] ;
  269|  6.23M|			tmp2 = v [i] ;
  270|  6.23M|			tmp2 = (tmp1 == MIN_WORD && tmp2 == MIN_WORD
  ------------------
  |  |   51|  12.4M|#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: 6.23M]
  |  Branch (270:32): [True: 0, False: 0]
  ------------------
  271|  6.23M|				? MAX_WORD
  ------------------
  |  |   52|      0|#define	MAX_WORD	32767
  ------------------
  272|  6.23M|				: 0x0FFFF & (((int32_t) tmp1 * (int32_t) tmp2
  273|  6.23M|							+ 16384) >> 15)) ;
  274|       |
  275|  6.23M|			sri = GSM_SUB (sri, tmp2) ;
  276|       |
  277|       |			/* v [i+1] = GSM_ADD (v [i], gsm_mult_r(rrp[i], sri)) ;
  278|       |			 */
  279|  6.23M|			tmp1 = (tmp1 == MIN_WORD && sri == MIN_WORD
  ------------------
  |  |   51|  12.4M|#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: 6.23M]
  |  Branch (279:32): [True: 0, False: 0]
  ------------------
  280|  6.23M|				? MAX_WORD
  ------------------
  |  |   52|      0|#define	MAX_WORD	32767
  ------------------
  281|  6.23M|				: 0x0FFFF & (((int32_t) tmp1 * (int32_t) sri
  282|  6.23M|							+ 16384) >> 15)) ;
  283|       |
  284|  6.23M|			v [i + 1] = GSM_ADD (v [i], tmp1) ;
  285|  6.23M|		}
  286|   779k|		*sr++ = v [0] = sri ;
  287|   779k|	}
  288|  19.4k|}

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

alac_init:
  112|  1.09k|{	int error ;
  113|       |
  114|  1.09k|	if ((psf->codec_data = calloc (1, sizeof (ALAC_PRIVATE) + psf->sf.channels * sizeof (int) * ALAC_MAX_FRAME_SIZE)) == NULL)
  ------------------
  |  |   33|  1.09k|#define		ALAC_MAX_FRAME_SIZE		8192
  ------------------
  |  Branch (114:6): [True: 0, False: 1.09k]
  ------------------
  115|      0|		return SFE_MALLOC_FAILED ;
  116|       |
  117|  1.09k|	psf->codec_close = alac_close ;
  118|       |
  119|  1.09k|	switch (psf->file.mode)
  120|  1.09k|	{	case SFM_RDWR :
  ------------------
  |  Branch (120:4): [True: 0, False: 1.09k]
  ------------------
  121|      0|			return SFE_BAD_MODE_RW ;
  122|       |
  123|  1.09k|		case SFM_READ :
  ------------------
  |  Branch (123:3): [True: 1.09k, False: 0]
  ------------------
  124|  1.09k|			if ((error = alac_reader_init (psf, info)))
  ------------------
  |  Branch (124:8): [True: 198, False: 898]
  ------------------
  125|    198|				return error ;
  126|    898|			break ;
  127|       |
  128|    898|		case SFM_WRITE :
  ------------------
  |  Branch (128:3): [True: 0, False: 1.09k]
  ------------------
  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.09k]
  ------------------
  134|      0|			psf_log_printf (psf, "%s : Bad psf->file.mode.\n", __func__) ;
  135|      0|			return SFE_INTERNAL ;
  136|  1.09k|		} ;
  137|       |
  138|    898|	psf->byterate = alac_byterate ;
  139|       |
  140|    898|	return 0 ;
  141|  1.09k|} /* aiff_alac_init */
alac.c:alac_close:
  166|  1.09k|{	ALAC_PRIVATE *plac ;
  167|  1.09k|	BUF_UNION	ubuf ;
  168|       |
  169|  1.09k|	plac = psf->codec_data ;
  170|       |
  171|  1.09k|	if (psf->file.mode == SFM_WRITE)
  ------------------
  |  Branch (171:6): [True: 0, False: 1.09k]
  ------------------
  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.09k|	if (plac->pakt_info)
  ------------------
  |  Branch (216:6): [True: 1.02k, False: 71]
  ------------------
  217|  1.02k|		free (plac->pakt_info) ;
  218|  1.09k|	plac->pakt_info = NULL ;
  219|       |
  220|  1.09k|	return 0 ;
  221|  1.09k|} /* alac_close */
alac.c:alac_pakt_append:
  787|  41.2k|{
  788|  41.2k|	if (info->count >= info->allocated)
  ------------------
  |  Branch (788:6): [True: 567, False: 40.7k]
  ------------------
  789|    567|	{	PAKT_INFO * temp ;
  790|    567|		uint32_t newcount = info->allocated + info->allocated / 2 ;
  791|       |
  792|    567|		if ((temp = realloc (info, sizeof (PAKT_INFO) + newcount * sizeof (info->packet_size [0]))) == NULL)
  ------------------
  |  Branch (792:7): [True: 0, False: 567]
  ------------------
  793|      0|			return NULL ;
  794|       |
  795|    567|		info = temp ;
  796|    567|		info->allocated = newcount ;
  797|  41.2k|		} ;
  798|       |
  799|  41.2k|	info->packet_size [info->count++] = value ;
  800|  41.2k|	return info ;
  801|  41.2k|} /* alac_pakt_append */
alac.c:alac_reader_init:
  238|  1.09k|{	ALAC_PRIVATE	*plac ;
  239|  1.09k|	uint32_t		kuki_size ;
  240|  1.09k|	int				error ;
  241|  1.09k|	union			{ uint8_t kuki [512] ; uint32_t alignment ; } u ;
  242|       |
  243|  1.09k|	if (info == NULL)
  ------------------
  |  Branch (243:6): [True: 0, False: 1.09k]
  ------------------
  244|      0|	{	psf_log_printf (psf, "%s : ALAC_DECODER_INFO is NULL.\n", __func__) ;
  245|      0|		return SFE_INTERNAL ;
  246|  1.09k|		} ;
  247|       |
  248|  1.09k|	if (info->frames_per_packet > ALAC_FRAME_LENGTH)
  ------------------
  |  |   33|  1.09k|#define		ALAC_FRAME_LENGTH	4096
  ------------------
  |  Branch (248:6): [True: 7, False: 1.08k]
  ------------------
  249|      7|	{	psf_log_printf (psf, "*** Error : frames_per_packet (%u) is too big. ***\n", info->frames_per_packet) ;
  250|      7|		return SFE_INTERNAL ;
  251|  1.08k|		} ;
  252|       |
  253|  1.08k|	plac = psf->codec_data ;
  254|       |
  255|  1.08k|	plac->channels			= psf->sf.channels ;
  256|  1.08k|	plac->frames_per_block	= info->frames_per_packet ;
  257|  1.08k|	plac->bits_per_sample	= info->bits_per_sample ;
  258|       |
  259|  1.08k|	if (plac->pakt_info != NULL)
  ------------------
  |  Branch (259:6): [True: 0, False: 1.08k]
  ------------------
  260|      0|		free (plac->pakt_info) ;
  261|  1.08k|	plac->pakt_info = alac_pakt_read_decode (psf, info->pakt_offset) ;
  262|       |
  263|  1.08k|	if (plac->pakt_info == NULL)
  ------------------
  |  Branch (263:6): [True: 64, False: 1.02k]
  ------------------
  264|     64|	{	psf_log_printf (psf, "%s : alac_pkt_read() returns NULL.\n", __func__) ;
  265|     64|		return SFE_INTERNAL ;
  266|  1.02k|		} ;
  267|       |
  268|       |	/* Read in the ALAC cookie data and pass it to the init function. */
  269|  1.02k|	kuki_size = alac_kuki_read (psf, info->kuki_offset, u.kuki, sizeof (u.kuki)) ;
  270|       |
  271|  1.02k|	if ((error = alac_decoder_init (&plac->u.decoder, u.kuki, kuki_size)) != ALAC_noErr)
  ------------------
  |  Branch (271:6): [True: 123, False: 902]
  ------------------
  272|    123|	{	psf_log_printf (psf, "*** alac_decoder_init() returned %s. ***\n", alac_error_string (error)) ;
  273|    123|		return SFE_INTERNAL ;
  274|    902|		} ;
  275|       |
  276|       |
  277|    902|	if (plac->u.decoder.mNumChannels != (unsigned) psf->sf.channels)
  ------------------
  |  Branch (277:6): [True: 4, False: 898]
  ------------------
  278|      4|	{	psf_log_printf (psf, "*** Initialized decoder has %u channels, but it should be %d. ***\n", plac->u.decoder.mNumChannels, psf->sf.channels) ;
  279|      4|		return SFE_INTERNAL ;
  280|    898|		} ;
  281|       |
  282|    898|	switch (info->bits_per_sample)
  283|    898|	{	case 16 :
  ------------------
  |  Branch (283:4): [True: 359, False: 539]
  ------------------
  284|    538|		case 20 :
  ------------------
  |  Branch (284:3): [True: 179, False: 719]
  ------------------
  285|    876|		case 24 :
  ------------------
  |  Branch (285:3): [True: 338, False: 560]
  ------------------
  286|    898|		case 32 :
  ------------------
  |  Branch (286:3): [True: 22, False: 876]
  ------------------
  287|    898|			psf->read_short		= alac_read_s ;
  288|    898|			psf->read_int		= alac_read_i ;
  289|    898|			psf->read_float		= alac_read_f ;
  290|    898|			psf->read_double	= alac_read_d ;
  291|    898|			break ;
  292|       |
  293|      0|		default :
  ------------------
  |  Branch (293:3): [True: 0, False: 898]
  ------------------
  294|      0|			printf ("%s : info->bits_per_sample %u\n", __func__, info->bits_per_sample) ;
  295|      0|			return SFE_UNSUPPORTED_ENCODING ;
  296|    898|		} ;
  297|       |
  298|    898|	psf->codec_close	= alac_close ;
  299|    898|	psf->seek			= alac_seek ;
  300|       |
  301|    898|	psf->sf.frames		= alac_reader_calc_frames (psf, plac) ;
  302|    898|	alac_seek (psf, SFM_READ, 0) ;
  303|       |
  304|    898|	return 0 ;
  305|    898|} /* alac_reader_init */
alac.c:alac_pakt_read_decode:
  805|  1.08k|{	SF_CHUNK_INFO chunk_info ;
  806|  1.08k|	PAKT_INFO * info = NULL ;
  807|  1.08k|	uint8_t *pakt_data = NULL ;
  808|  1.08k|	uint32_t bcount, value = 1, pakt_size ;
  809|  1.08k|	SF_CHUNK_ITERATOR * chunk_iterator ;
  810|       |
  811|       |
  812|  1.08k|	memset (&chunk_info, 0, sizeof (chunk_info)) ;
  813|  1.08k|	snprintf (chunk_info.id, sizeof (chunk_info.id), "pakt") ;
  814|  1.08k|	chunk_info.id_size = 4 ;
  815|       |
  816|  1.08k|	if ((chunk_iterator = psf_get_chunk_iterator (psf, chunk_info.id)) == NULL)
  ------------------
  |  Branch (816:6): [True: 64, False: 1.02k]
  ------------------
  817|     64|	{	psf_log_printf (psf, "%s : no chunk iterator found\n", __func__) ;
  818|     64|		free (chunk_info.data) ;
  819|     64|		chunk_info.data = NULL ;
  820|     64|		return NULL ;
  821|  1.02k|		} ;
  822|       |
  823|  1.02k|	psf->get_chunk_size (psf, chunk_iterator, &chunk_info) ;
  824|       |
  825|  1.02k|	pakt_size = chunk_info.datalen ;
  826|  1.02k|	chunk_info.data = pakt_data = malloc (pakt_size + 5) ;
  827|  1.02k|	if (!chunk_info.data)
  ------------------
  |  Branch (827:6): [True: 0, False: 1.02k]
  ------------------
  828|      0|		return NULL ;
  829|       |
  830|  1.02k|	if ((bcount = psf->get_chunk_data (psf, chunk_iterator, &chunk_info)) != SF_ERR_NO_ERROR)
  ------------------
  |  Branch (830:6): [True: 0, False: 1.02k]
  ------------------
  831|      0|	{	while (chunk_iterator)
  ------------------
  |  Branch (831:11): [True: 0, False: 0]
  ------------------
  832|      0|			chunk_iterator = psf->next_chunk_iterator (psf, chunk_iterator) ;
  833|      0|		free (chunk_info.data) ;
  834|      0|		chunk_info.data = NULL ;
  835|      0|		return NULL ;
  836|  1.02k|		} ;
  837|       |
  838|  2.48k|	while (chunk_iterator)
  ------------------
  |  Branch (838:9): [True: 1.46k, False: 1.02k]
  ------------------
  839|  1.46k|		chunk_iterator = psf->next_chunk_iterator (psf, chunk_iterator) ;
  840|       |
  841|  1.02k|	info = alac_pakt_alloc (pakt_size / 4) ;
  842|       |
  843|       |	/* Start at 24 bytes in, skipping over the 'pakt' chunks header. */
  844|  42.3k|	for (bcount = 24 ; bcount < pakt_size && value != 0 ; )
  ------------------
  |  Branch (844:21): [True: 41.5k, False: 708]
  |  Branch (844:43): [True: 41.2k, False: 317]
  ------------------
  845|  41.2k|	{	uint8_t byte ;
  846|  41.2k|		int32_t count = 0 ;
  847|       |
  848|  41.2k|		value = 0 ;
  849|  41.2k|		do
  850|  42.3k|		{	byte = pakt_data [bcount + count] ;
  851|  42.3k|			value = (value << 7) + (byte & 0x7F) ;
  852|       |
  853|  42.3k|			count ++ ;
  854|  42.3k|			if (count > 5 || bcount + count > pakt_size)
  ------------------
  |  Branch (854:8): [True: 45, False: 42.2k]
  |  Branch (854:21): [True: 21, False: 42.2k]
  ------------------
  855|     66|			{	printf ("%s %d : Ooops! count %" PRIi32 "    bcount %" PRIu32 "\n", __func__, __LINE__, count, bcount) ;
  856|     66|				value = 0 ;
  857|     66|				break ;
  858|  42.2k|				} ;
  859|  42.2k|			}
  860|  42.2k|			while (byte & 0x80) ;
  ------------------
  |  Branch (860:11): [True: 1.04k, False: 41.2k]
  ------------------
  861|       |
  862|  41.2k|		bcount += count ;
  863|       |
  864|  41.2k|		if ((info = alac_pakt_append (info, value)) == NULL)
  ------------------
  |  Branch (864:7): [True: 0, False: 41.2k]
  ------------------
  865|      0|			goto FreeExit ;
  866|  41.2k|		} ;
  867|       |
  868|  1.02k|	free (pakt_data) ;
  869|       |
  870|  1.02k|	return info ;
  871|       |
  872|      0|FreeExit :
  873|      0|	free (pakt_data) ;
  874|      0|	free (info) ;
  875|       |	return NULL ;
  876|  1.02k|} /* alac_pakt_read_decode */
alac.c:alac_pakt_alloc:
  773|  1.02k|{	PAKT_INFO * info ;
  774|       |
  775|  1.02k|	if ((info = calloc (1, sizeof (PAKT_INFO) + initial_count * sizeof (info->packet_size [0]))) == NULL)
  ------------------
  |  Branch (775:6): [True: 0, False: 1.02k]
  ------------------
  776|      0|		return NULL ;
  777|       |
  778|  1.02k|	info->allocated = initial_count ;
  779|  1.02k|	info->current = 0 ;
  780|  1.02k|	info->count = 0 ;
  781|       |
  782|  1.02k|	return info ;
  783|  1.02k|} /* alac_pakt_alloc */
alac.c:alac_kuki_read:
  950|  1.02k|{	uint32_t marker ;
  951|  1.02k|	uint64_t kuki_size ;
  952|       |
  953|  1.02k|	if (psf_fseek (psf, kuki_offset, SEEK_SET) != kuki_offset)
  ------------------
  |  Branch (953:6): [True: 0, False: 1.02k]
  ------------------
  954|      0|		return 0 ;
  955|       |
  956|  1.02k|	psf_fread (&marker, 1, sizeof (marker), psf) ;
  957|  1.02k|	if (marker != MAKE_MARKER ('k', 'u', 'k', 'i'))
  ------------------
  |  |  122|  1.02k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
  |  Branch (957:6): [True: 75, False: 950]
  ------------------
  958|     75|		return 0 ;
  959|       |
  960|    950|	psf_fread (&kuki_size, 1, sizeof (kuki_size), psf) ;
  961|    950|	kuki_size = BE2H_64 (kuki_size) ;
  ------------------
  |  |  142|    950|	#define BE2H_64(x)			ENDSWAP_64 (x)
  |  |  ------------------
  |  |  |  |   36|    950|#define	ENDSWAP_64(x)		(bswap_64 (x))
  |  |  ------------------
  ------------------
  962|       |
  963|    950|	if (kuki_size == 0 || kuki_size > kuki_maxlen)
  ------------------
  |  Branch (963:6): [True: 3, False: 947]
  |  Branch (963:24): [True: 4, False: 943]
  ------------------
  964|      7|	{	psf_log_printf (psf, "%s : Bad size (%D) of 'kuki' chunk.\n", __func__, kuki_size) ;
  965|      7|		return 0 ;
  966|    943|		} ;
  967|       |
  968|    943|	psf_fread (kuki, 1, kuki_size, psf) ;
  969|       |
  970|    943|	return kuki_size ;
  971|    950|} /* alac_kuki_read */
alac.c:alac_error_string:
  977|    123|{	static char errstr [128] ;
  978|    123|	switch (error)
  979|    123|	{	CASE_NAME (kALAC_UnimplementedError) ;
  ------------------
  |  |  973|      0|#define CASE_NAME(x)	case x : return #x ; break ;
  |  |  ------------------
  |  |  |  Branch (973:22): [True: 0, False: 123]
  |  |  ------------------
  ------------------
  980|      0|		CASE_NAME (kALAC_FileNotFoundError) ;
  ------------------
  |  |  973|      0|#define CASE_NAME(x)	case x : return #x ; break ;
  |  |  ------------------
  |  |  |  Branch (973:22): [True: 0, False: 123]
  |  |  ------------------
  ------------------
  981|      0|		CASE_NAME (kALAC_ParamError) ;
  ------------------
  |  |  973|      0|#define CASE_NAME(x)	case x : return #x ; break ;
  |  |  ------------------
  |  |  |  Branch (973:22): [True: 0, False: 123]
  |  |  ------------------
  ------------------
  982|      0|		CASE_NAME (kALAC_MemFullError) ;
  ------------------
  |  |  973|      0|#define CASE_NAME(x)	case x : return #x ; break ;
  |  |  ------------------
  |  |  |  Branch (973:22): [True: 0, False: 123]
  |  |  ------------------
  ------------------
  983|     17|		CASE_NAME (fALAC_FrameLengthError) ;
  ------------------
  |  |  973|     17|#define CASE_NAME(x)	case x : return #x ; break ;
  |  |  ------------------
  |  |  |  Branch (973:22): [True: 17, False: 106]
  |  |  ------------------
  ------------------
  984|       |
  985|       |		/* Added for libsndfile */
  986|      8|		CASE_NAME (kALAC_BadBitWidth) ;
  ------------------
  |  |  973|      8|#define CASE_NAME(x)	case x : return #x ; break ;
  |  |  ------------------
  |  |  |  Branch (973:22): [True: 8, False: 115]
  |  |  ------------------
  ------------------
  987|      3|		CASE_NAME (kALAC_IncompatibleVersion) ;
  ------------------
  |  |  973|      3|#define CASE_NAME(x)	case x : return #x ; break ;
  |  |  ------------------
  |  |  |  Branch (973:22): [True: 3, False: 120]
  |  |  ------------------
  ------------------
  988|     95|		CASE_NAME (kALAC_BadSpecificConfigSize) ;
  ------------------
  |  |  973|     95|#define CASE_NAME(x)	case x : return #x ; break ;
  |  |  ------------------
  |  |  |  Branch (973:22): [True: 95, False: 28]
  |  |  ------------------
  ------------------
  989|      0|		CASE_NAME (kALAC_ZeroChannelCount) ;
  ------------------
  |  |  973|      0|#define CASE_NAME(x)	case x : return #x ; break ;
  |  |  ------------------
  |  |  |  Branch (973:22): [True: 0, False: 123]
  |  |  ------------------
  ------------------
  990|      0|		CASE_NAME (kALAC_NumSamplesTooBig) ;
  ------------------
  |  |  973|      0|#define CASE_NAME(x)	case x : return #x ; break ;
  |  |  ------------------
  |  |  |  Branch (973:22): [True: 0, False: 123]
  |  |  ------------------
  ------------------
  991|      0|		CASE_NAME (kALAC_UnsupportedElement) ;
  ------------------
  |  |  973|      0|#define CASE_NAME(x)	case x : return #x ; break ;
  |  |  ------------------
  |  |  |  Branch (973:22): [True: 0, False: 123]
  |  |  ------------------
  ------------------
  992|      0|		default :
  ------------------
  |  Branch (992:3): [True: 0, False: 123]
  ------------------
  993|      0|			break ;
  994|    123|		} ;
  995|       |
  996|      0|	snprintf (errstr, sizeof (errstr), "Unknown error %d", error) ;
  997|      0|	return errstr ;
  998|    123|} /* alac_error_string */
alac.c:alac_decode_block:
  405|  26.8k|{	ALAC_DECODER *pdec = &plac->u.decoder ;
  406|  26.8k|	uint32_t	packet_size ;
  407|  26.8k|	BitBuffer	bit_buffer ;
  408|       |
  409|  26.8k|	packet_size = alac_reader_next_packet_size (plac->pakt_info) ;
  410|  26.8k|	if (packet_size == 0)
  ------------------
  |  Branch (410:6): [True: 464, False: 26.3k]
  ------------------
  411|    464|	{	if (plac->pakt_info->current < plac->pakt_info->count)
  ------------------
  |  Branch (411:8): [True: 0, False: 464]
  ------------------
  412|      0|			psf_log_printf (psf, "packet_size is 0 (%d of %d)\n", plac->pakt_info->current, plac->pakt_info->count) ;
  413|    464|		return 0 ;
  414|  26.3k|		} ;
  415|       |
  416|  26.3k|	psf_fseek (psf, plac->input_data_pos, SEEK_SET) ;
  417|       |
  418|  26.3k|	if (packet_size > sizeof (plac->byte_buffer))
  ------------------
  |  Branch (418:6): [True: 61, False: 26.3k]
  ------------------
  419|     61|	{	psf_log_printf (psf, "%s : bad packet_size (%u)\n", __func__, packet_size) ;
  420|     61|		return 0 ;
  421|  26.3k|		} ;
  422|       |
  423|  26.3k|	if ((packet_size != psf_fread (plac->byte_buffer, 1, packet_size, psf)))
  ------------------
  |  Branch (423:6): [True: 693, False: 25.6k]
  ------------------
  424|    693|		return 0 ;
  425|       |
  426|  25.6k|	BitBufferInit (&bit_buffer, plac->byte_buffer, packet_size) ;
  427|       |
  428|  25.6k|	plac->input_data_pos += packet_size ;
  429|  25.6k|	plac->frames_this_block = 0 ;
  430|  25.6k|	alac_decode (pdec, &bit_buffer, plac->buffer, plac->frames_per_block, &plac->frames_this_block) ;
  431|       |
  432|  25.6k|	plac->partial_block_frames = 0 ;
  433|       |
  434|  25.6k|	return 1 ;
  435|  26.3k|} /* alac_decode_block */
alac.c:alac_reader_next_packet_size:
  371|  65.7k|{	if (info->current >= info->count)
  ------------------
  |  Branch (371:7): [True: 796, False: 64.9k]
  ------------------
  372|    796|		return 0 ;
  373|  64.9k|	return info->packet_size [info->current++] ;
  374|  65.7k|} /* alac_reader_next_packet_size */
alac.c:alac_read_f:
  521|  7.68M|{	ALAC_PRIVATE *plac ;
  522|  7.68M|	int			*iptr ;
  523|  7.68M|	int			k, readcount ;
  524|  7.68M|	sf_count_t	total = 0 ;
  525|  7.68M|	float		normfact ;
  526|       |
  527|  7.68M|	if ((plac = (ALAC_PRIVATE*) psf->codec_data) == NULL)
  ------------------
  |  Branch (527:6): [True: 0, False: 7.68M]
  ------------------
  528|      0|		return 0 ;
  529|       |
  530|  7.68M|	normfact = (psf->norm_float == SF_TRUE) ? 1.0 / ((float) 0x80000000) : 1.0 ;
  ------------------
  |  Branch (530:13): [True: 7.68M, False: 0]
  ------------------
  531|       |
  532|  15.3M|	while (len > 0)
  ------------------
  |  Branch (532:9): [True: 7.68M, False: 7.68M]
  ------------------
  533|  7.68M|	{	if (plac->partial_block_frames >= plac->frames_this_block && alac_decode_block (psf, plac) == 0)
  ------------------
  |  Branch (533:8): [True: 25.4k, False: 7.66M]
  |  Branch (533:65): [True: 370, False: 25.0k]
  ------------------
  534|    370|			break ;
  535|       |
  536|  7.68M|		readcount = (plac->frames_this_block - plac->partial_block_frames) * plac->channels ;
  537|  7.68M|		readcount = readcount > len ? (int) len : readcount ;
  ------------------
  |  Branch (537:15): [True: 7.66M, False: 25.0k]
  ------------------
  538|       |
  539|  7.68M|		iptr = plac->buffer + plac->partial_block_frames * plac->channels ;
  540|       |
  541|   180M|		for (k = 0 ; k < readcount ; k++)
  ------------------
  |  Branch (541:16): [True: 172M, False: 7.68M]
  ------------------
  542|   172M|			ptr [total + k] = normfact * iptr [k] ;
  543|       |
  544|  7.68M|		plac->partial_block_frames += readcount / plac->channels ;
  545|  7.68M|		total += readcount ;
  546|  7.68M|		len -= readcount ;
  547|  7.68M|		} ;
  548|       |
  549|  7.68M|	return total ;
  550|  7.68M|} /* alac_read_f */
alac.c:alac_seek:
  590|  1.79k|{	ALAC_PRIVATE *plac ;
  591|  1.79k|	int			newblock, newsample ;
  592|       |
  593|  1.79k|	if (! psf->codec_data)
  ------------------
  |  Branch (593:6): [True: 0, False: 1.79k]
  ------------------
  594|      0|		return 0 ;
  595|  1.79k|	plac = (ALAC_PRIVATE*) psf->codec_data ;
  596|       |
  597|  1.79k|	if (psf->datalength < 0 || psf->dataoffset < 0)
  ------------------
  |  Branch (597:6): [True: 4, False: 1.79k]
  |  Branch (597:29): [True: 0, False: 1.79k]
  ------------------
  598|      4|	{	psf->error = SFE_BAD_SEEK ;
  599|      4|		return PSF_SEEK_ERROR ;
  ------------------
  |  |   83|      4|#define	PSF_SEEK_ERROR			((sf_count_t) -1)
  ------------------
  600|  1.79k|		} ;
  601|       |
  602|  1.79k|	if (offset == 0)
  ------------------
  |  Branch (602:6): [True: 1.27k, False: 520]
  ------------------
  603|  1.27k|	{	psf_fseek (psf, psf->dataoffset, SEEK_SET) ;
  604|       |
  605|  1.27k|		plac->frames_this_block = 0 ;
  606|  1.27k|		plac->input_data_pos = psf->dataoffset ;
  607|  1.27k|		plac->pakt_info->current = 0 ;
  608|  1.27k|		return 0 ;
  609|  1.27k|		} ;
  610|       |
  611|    520|	if (offset < 0 || offset > plac->pakt_info->count * plac->frames_per_block)
  ------------------
  |  Branch (611:6): [True: 0, False: 520]
  |  Branch (611:20): [True: 0, False: 520]
  ------------------
  612|      0|	{	psf->error = SFE_BAD_SEEK ;
  613|      0|		return	PSF_SEEK_ERROR ;
  ------------------
  |  |   83|      0|#define	PSF_SEEK_ERROR			((sf_count_t) -1)
  ------------------
  614|    520|		} ;
  615|       |
  616|    520|	newblock	= offset / plac->frames_per_block ;
  617|    520|	newsample	= offset % plac->frames_per_block ;
  618|       |
  619|    520|	if (mode == SFM_READ)
  ------------------
  |  Branch (619:6): [True: 520, False: 0]
  ------------------
  620|    520|	{	plac->input_data_pos = psf->dataoffset + alac_pakt_block_offset (plac->pakt_info, newblock) ;
  621|       |
  622|    520|		plac->pakt_info->current = newblock ;
  623|    520|		alac_decode_block (psf, plac) ;
  624|    520|		plac->partial_block_frames = newsample ;
  625|    520|		}
  626|      0|	else
  627|      0|	{	/* What to do about write??? */
  628|      0|		psf->error = SFE_BAD_SEEK ;
  629|      0|		return	PSF_SEEK_ERROR ;
  ------------------
  |  |   83|      0|#define	PSF_SEEK_ERROR			((sf_count_t) -1)
  ------------------
  630|    520|		} ;
  631|       |
  632|    520|	return newblock * plac->frames_per_block + newsample ;
  633|    520|} /* alac_seek */
alac.c:alac_pakt_block_offset:
  939|    520|{	sf_count_t offset = 0 ;
  940|    520|	uint32_t k ;
  941|       |
  942|  37.8k|	for (k = 0 ; k < block ; k++)
  ------------------
  |  Branch (942:15): [True: 37.2k, False: 520]
  ------------------
  943|  37.2k|		offset += info->packet_size [k] ;
  944|       |
  945|    520|	return offset ;
  946|    520|} /* alac_pakt_block_offset */
alac.c:alac_reader_calc_frames:
  378|    898|{	sf_count_t	frames = 0 ;
  379|    898|	uint32_t	current_pos = 1, blocks = 0 ;
  380|       |
  381|    898|	plac->pakt_info->current = 0 ;
  382|       |
  383|  39.8k|	while (current_pos < psf->filelength && current_pos > 0)
  ------------------
  |  Branch (383:9): [True: 39.6k, False: 145]
  |  Branch (383:42): [True: 38.9k, False: 753]
  ------------------
  384|  38.9k|	{	current_pos = alac_reader_next_packet_size (plac->pakt_info) ;
  385|  38.9k|		blocks = current_pos > 0 ? blocks + 1 : blocks ;
  ------------------
  |  Branch (385:12): [True: 38.1k, False: 753]
  ------------------
  386|  38.9k|		} ;
  387|       |
  388|    898|	if (blocks == 0)
  ------------------
  |  Branch (388:6): [True: 1, False: 897]
  ------------------
  389|      1|		return 0 ;
  390|       |
  391|       |	/* Only count full blocks. */
  392|    897|	frames = plac->frames_per_block * (blocks - 1) ;
  393|       |
  394|    897|	alac_seek (psf, SFM_READ, frames) ;
  395|    897|	alac_decode_block (psf, plac) ;
  396|    897|	frames += plac->frames_this_block ;
  397|       |
  398|    897|	plac->pakt_info->current = 0 ;
  399|       |
  400|    897|	return frames ;
  401|    898|} /* alac_reader_calc_frames */

alaw_init:
   50|    290|{
   51|    290|	if (psf->file.mode == SFM_READ || psf->file.mode == SFM_RDWR)
  ------------------
  |  Branch (51:6): [True: 290, False: 0]
  |  Branch (51:36): [True: 0, False: 0]
  ------------------
   52|    290|	{	psf->read_short		= alaw_read_alaw2s ;
   53|    290|		psf->read_int		= alaw_read_alaw2i ;
   54|    290|		psf->read_float		= alaw_read_alaw2f ;
   55|    290|		psf->read_double	= alaw_read_alaw2d ;
   56|    290|		} ;
   57|       |
   58|    290|	if (psf->file.mode == SFM_WRITE || psf->file.mode == SFM_RDWR)
  ------------------
  |  Branch (58:6): [True: 0, False: 290]
  |  Branch (58:37): [True: 0, False: 290]
  ------------------
   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|    290|	psf->bytewidth = 1 ;
   66|    290|	psf->blockwidth = psf->sf.channels ;
   67|       |
   68|    290|	if (psf->filelength > psf->dataoffset)
  ------------------
  |  Branch (68:6): [True: 163, False: 127]
  ------------------
   69|    163|		psf->datalength = (psf->dataend) ? psf->dataend - psf->dataoffset : psf->filelength - psf->dataoffset ;
  ------------------
  |  Branch (69:21): [True: 80, False: 83]
  ------------------
   70|    127|	else
   71|    127|		psf->datalength = 0 ;
   72|       |
   73|    290|	psf->sf.frames = psf->blockwidth > 0 ? psf->datalength / psf->blockwidth : 0 ;
  ------------------
  |  Branch (73:19): [True: 242, False: 48]
  ------------------
   74|       |
   75|    290|	return 0 ;
   76|    290|} /* alaw_init */
alaw.c:alaw_read_alaw2f:
  410|  1.59k|{	BUF_UNION	ubuf ;
  411|  1.59k|	int			bufferlen, readcount ;
  412|  1.59k|	sf_count_t	total = 0 ;
  413|  1.59k|	float	normfact ;
  414|       |
  415|  1.59k|	normfact = (psf->norm_float == SF_TRUE) ? 1.0 / ((float) 0x8000) : 1.0 ;
  ------------------
  |  Branch (415:13): [True: 1.59k, False: 0]
  ------------------
  416|       |
  417|  1.59k|	bufferlen = ARRAY_LEN (ubuf.ucbuf) ;
  ------------------
  |  |   93|  1.59k|#define		ARRAY_LEN(x)	((int) (sizeof (x) / sizeof ((x) [0])))
  ------------------
  418|       |
  419|  3.13k|	while (len > 0)
  ------------------
  |  Branch (419:9): [True: 1.59k, False: 1.54k]
  ------------------
  420|  1.59k|	{	if (len < bufferlen)
  ------------------
  |  Branch (420:8): [True: 1.59k, False: 0]
  ------------------
  421|  1.59k|			bufferlen = (int) len ;
  422|  1.59k|		readcount = (int) psf_fread (ubuf.ucbuf, 1, bufferlen, psf) ;
  423|  1.59k|		alaw2f_array (ubuf.ucbuf, readcount, ptr + total, normfact) ;
  424|  1.59k|		total += readcount ;
  425|  1.59k|		if (readcount < bufferlen)
  ------------------
  |  Branch (425:7): [True: 45, False: 1.54k]
  ------------------
  426|     45|			break ;
  427|  1.54k|		len -= readcount ;
  428|  1.54k|		} ;
  429|       |
  430|  1.59k|	return total ;
  431|  1.59k|} /* alaw_read_alaw2f */
alaw.c:alaw2f_array:
  307|  1.18M|{	for (int i = 0 ; i < count ; i++)
  ------------------
  |  Branch (307:20): [True: 1.18M, False: 1.59k]
  ------------------
  308|  1.18M|		ptr [i] = normfact * alaw_decode [(int) buffer [i]] ;
  309|  1.59k|} /* alaw2f_array */

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

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

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

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

caf_open:
  114|  2.52k|{	CAF_PRIVATE * pcaf ;
  115|  2.52k|	int	subformat, format, error = 0 ;
  116|       |
  117|  2.52k|	if ((psf->container_data = calloc (1, sizeof (CAF_PRIVATE))) == NULL)
  ------------------
  |  Branch (117:6): [True: 0, False: 2.52k]
  ------------------
  118|      0|		return SFE_MALLOC_FAILED ;
  119|       |
  120|  2.52k|	pcaf = psf->container_data ;
  121|       |
  122|  2.52k|	if (psf->file.mode == SFM_READ || (psf->file.mode == SFM_RDWR && psf->filelength > 0))
  ------------------
  |  Branch (122:6): [True: 2.52k, False: 0]
  |  Branch (122:37): [True: 0, False: 0]
  |  Branch (122:67): [True: 0, False: 0]
  ------------------
  123|  2.52k|	{	if ((error = caf_read_header (psf)))
  ------------------
  |  Branch (123:8): [True: 1.41k, False: 1.11k]
  ------------------
  124|  1.41k|			return error ;
  125|       |
  126|  1.11k|		psf->next_chunk_iterator = caf_next_chunk_iterator ;
  127|  1.11k|		psf->get_chunk_size = caf_get_chunk_size ;
  128|  1.11k|		psf->get_chunk_data = caf_get_chunk_data ;
  129|  1.11k|		} ;
  130|       |
  131|  1.11k|	subformat = SF_CODEC (psf->sf.format) ;
  ------------------
  |  |  109|  1.11k|#define SF_CODEC(x)			((x) & SF_FORMAT_SUBMASK)
  ------------------
  132|       |
  133|  1.11k|	if (psf->file.mode == SFM_WRITE || psf->file.mode == SFM_RDWR)
  ------------------
  |  Branch (133:6): [True: 0, False: 1.11k]
  |  Branch (133:37): [True: 0, False: 1.11k]
  ------------------
  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) ;
  ------------------
  |  |  108|      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.11k|		} ;
  168|       |
  169|  1.11k|	psf->container_close = caf_close ;
  170|  1.11k|	psf->command = caf_command ;
  171|       |
  172|  1.11k|	switch (subformat)
  173|  1.11k|	{	case SF_FORMAT_PCM_S8 :
  ------------------
  |  Branch (173:4): [True: 1, False: 1.11k]
  ------------------
  174|      2|		case SF_FORMAT_PCM_16 :
  ------------------
  |  Branch (174:3): [True: 1, False: 1.11k]
  ------------------
  175|      3|		case SF_FORMAT_PCM_24 :
  ------------------
  |  Branch (175:3): [True: 1, False: 1.11k]
  ------------------
  176|      4|		case SF_FORMAT_PCM_32 :
  ------------------
  |  Branch (176:3): [True: 1, False: 1.11k]
  ------------------
  177|      4|					error = pcm_init (psf) ;
  178|      4|					break ;
  179|       |
  180|      1|		case SF_FORMAT_ULAW :
  ------------------
  |  Branch (180:3): [True: 1, False: 1.11k]
  ------------------
  181|      1|					error = ulaw_init (psf) ;
  182|      1|					break ;
  183|       |
  184|      1|		case SF_FORMAT_ALAW :
  ------------------
  |  Branch (184:3): [True: 1, False: 1.11k]
  ------------------
  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.11k]
  ------------------
  190|      1|					error = float32_init (psf) ;
  191|      1|					break ;
  192|       |
  193|      1|		case SF_FORMAT_DOUBLE :
  ------------------
  |  Branch (193:3): [True: 1, False: 1.11k]
  ------------------
  194|      1|					error = double64_init (psf) ;
  195|      1|					break ;
  196|       |
  197|    430|		case SF_FORMAT_ALAC_16 :
  ------------------
  |  Branch (197:3): [True: 430, False: 681]
  ------------------
  198|    646|		case SF_FORMAT_ALAC_20 :
  ------------------
  |  Branch (198:3): [True: 216, False: 895]
  ------------------
  199|  1.04k|		case SF_FORMAT_ALAC_24 :
  ------------------
  |  Branch (199:3): [True: 401, False: 710]
  ------------------
  200|  1.09k|		case SF_FORMAT_ALAC_32 :
  ------------------
  |  Branch (200:3): [True: 49, False: 1.06k]
  ------------------
  201|  1.09k|					if (psf->file.mode == SFM_READ)
  ------------------
  |  Branch (201:10): [True: 1.09k, False: 0]
  ------------------
  202|       |						/* Only pass the ALAC_DECODER_INFO in read mode. */
  203|  1.09k|						error = alac_init (psf, &pcaf->alac) ;
  204|      0|					else
  205|      0|						error = alac_init (psf, NULL) ;
  206|  1.09k|					break ;
  207|       |
  208|       |		/* Lite remove end */
  209|       |
  210|      7|		default :
  ------------------
  |  Branch (210:3): [True: 7, False: 1.10k]
  ------------------
  211|      7|			return SFE_UNSUPPORTED_ENCODING ;
  212|  1.11k|		} ;
  213|       |
  214|  1.10k|	return error ;
  215|  1.11k|} /* caf_open */
caf.c:caf_close:
  219|  1.11k|{
  220|  1.11k|	if (psf->file.mode == SFM_WRITE || psf->file.mode == SFM_RDWR)
  ------------------
  |  Branch (220:6): [True: 0, False: 1.11k]
  |  Branch (220:37): [True: 0, False: 1.11k]
  ------------------
  221|      0|	{	caf_write_tailer (psf) ;
  222|      0|		caf_write_header (psf, SF_TRUE) ;
  223|      0|		} ;
  224|       |
  225|  1.11k|	return 0 ;
  226|  1.11k|} /* caf_close */
caf.c:caf_read_header:
  338|  2.52k|{	CAF_PRIVATE	*pcaf ;
  339|  2.52k|	BUF_UNION	ubuf ;
  340|  2.52k|	DESC_CHUNK desc ;
  341|  2.52k|	sf_count_t chunk_size ;
  342|  2.52k|	double srate ;
  343|  2.52k|	short version, flags ;
  344|  2.52k|	int marker, k, have_data = 0, error ;
  345|       |
  346|  2.52k|	if ((pcaf = psf->container_data) == NULL)
  ------------------
  |  Branch (346:6): [True: 0, False: 2.52k]
  ------------------
  347|      0|		return SFE_INTERNAL ;
  348|       |
  349|  2.52k|	memset (&desc, 0, sizeof (desc)) ;
  350|       |
  351|       |	/* Set position to start of file to begin reading header. */
  352|  2.52k|	psf_binheader_readf (psf, "pmE2E2", 0, &marker, &version, &flags) ;
  353|  2.52k|	psf_log_printf (psf, "%M\n  Version : %d\n  Flags   : %x\n", marker, version, flags) ;
  354|  2.52k|	if (marker != caff_MARKER)
  ------------------
  |  |   40|  2.52k|#define caff_MARKER		MAKE_MARKER ('c', 'a', 'f', 'f')
  |  |  ------------------
  |  |  |  |  122|  2.52k|	#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.52k]
  ------------------
  355|      0|		return SFE_CAF_NOT_CAF ;
  356|       |
  357|  2.52k|	psf_binheader_readf (psf, "mE8b", &marker, &chunk_size, ubuf.ucbuf, 8) ;
  358|  2.52k|	srate = double64_be_read (ubuf.ucbuf) ;
  359|  2.52k|	snprintf (ubuf.cbuf, sizeof (ubuf.cbuf), "%5.3f", srate) ;
  360|  2.52k|	psf_log_printf (psf, "%M : %D\n  Sample rate  : %s\n", marker, chunk_size, ubuf.cbuf) ;
  361|  2.52k|	if (marker != desc_MARKER)
  ------------------
  |  |   43|  2.52k|#define desc_MARKER		MAKE_MARKER ('d', 'e', 's', 'c')
  |  |  ------------------
  |  |  |  |  122|  2.52k|	#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.52k]
  ------------------
  362|      0|		return SFE_CAF_NO_DESC ;
  363|       |
  364|  2.52k|	if (chunk_size < SIGNED_SIZEOF (DESC_CHUNK))
  ------------------
  |  |   91|  2.52k|#define		SIGNED_SIZEOF(x)	((int) sizeof (x))
  ------------------
  |  Branch (364:6): [True: 82, False: 2.44k]
  ------------------
  365|     82|	{	psf_log_printf (psf, "**** Chunk size too small. Should be > 32 bytes.\n") ;
  366|     82|		return SFE_MALFORMED_FILE ;
  367|  2.44k|		} ;
  368|       |
  369|  2.44k|	psf->sf.samplerate = psf_lrint (srate) ;
  370|       |
  371|  2.44k|	psf_binheader_readf (psf, "mE44444", &desc.fmt_id, &desc.fmt_flags, &desc.pkt_bytes, &desc.frames_per_packet,
  372|  2.44k|			&desc.channels_per_frame, &desc.bits_per_chan) ;
  373|  2.44k|	psf_log_printf (psf, "  Format id    : %M\n  Format flags : %x\n  Bytes / packet   : %u\n"
  374|  2.44k|			"  Frames / packet  : %u\n  Channels / frame : %u\n  Bits / channel   : %u\n",
  375|  2.44k|			desc.fmt_id, desc.fmt_flags, desc.pkt_bytes, desc.frames_per_packet, desc.channels_per_frame, desc.bits_per_chan) ;
  376|       |
  377|  2.44k|	if (desc.channels_per_frame > SF_MAX_CHANNELS)
  ------------------
  |  |  102|  2.44k|#define		SF_MAX_CHANNELS		1024
  ------------------
  |  Branch (377:6): [True: 1, False: 2.44k]
  ------------------
  378|      1|	{	psf_log_printf (psf, "**** Bad channels per frame value %u.\n", desc.channels_per_frame) ;
  379|      1|		return SFE_MALFORMED_FILE ;
  380|  2.44k|		} ;
  381|       |
  382|  2.44k|	if (chunk_size > SIGNED_SIZEOF (DESC_CHUNK))
  ------------------
  |  |   91|  2.44k|#define		SIGNED_SIZEOF(x)	((int) sizeof (x))
  ------------------
  |  Branch (382:6): [True: 2.44k, False: 1]
  ------------------
  383|  2.44k|		psf_binheader_readf (psf, "j", (int) (chunk_size - sizeof (DESC_CHUNK))) ;
  384|       |
  385|  2.44k|	psf->sf.channels = desc.channels_per_frame ;
  386|       |
  387|  13.6k|	while (1)
  ------------------
  |  Branch (387:9): [True: 13.6k, Folded]
  ------------------
  388|  13.6k|	{	marker = 0 ;
  389|  13.6k|		chunk_size = 0 ;
  390|       |
  391|  13.6k|		psf_binheader_readf (psf, "mE8", &marker, &chunk_size) ;
  392|  13.6k|		if (marker == 0)
  ------------------
  |  Branch (392:7): [True: 183, False: 13.4k]
  ------------------
  393|    183|		{	sf_count_t pos = psf_ftell (psf) ;
  394|    183|			psf_log_printf (psf, "Have 0 marker at position %D (0x%x).\n", pos, pos) ;
  395|    183|			break ;
  396|  13.4k|			} ;
  397|  13.4k|		if (chunk_size < 0)
  ------------------
  |  Branch (397:7): [True: 166, False: 13.2k]
  ------------------
  398|    166|		{	psf_log_printf (psf, "%M : %D *** Should be >= 0 ***\n", marker, chunk_size) ;
  399|    166|			break ;
  400|  13.2k|			} ;
  401|  13.2k|		if (chunk_size > psf->filelength)
  ------------------
  |  Branch (401:7): [True: 431, False: 12.8k]
  ------------------
  402|    431|			break ;
  403|       |
  404|  12.8k|		psf_store_read_chunk_u32 (&psf->rchunks, marker, psf_ftell (psf), chunk_size) ;
  405|       |
  406|  12.8k|		switch (marker)
  407|  12.8k|		{	case peak_MARKER :
  ------------------
  |  |   58|    348|#define peak_MARKER		MAKE_MARKER ('p', 'e', 'a', 'k')
  |  |  ------------------
  |  |  |  |  122|    348|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (407:5): [True: 348, False: 12.4k]
  ------------------
  408|    348|				psf_log_printf (psf, "%M : %D\n", marker, chunk_size) ;
  409|    348|				if (chunk_size != CAF_PEAK_CHUNK_SIZE (psf->sf.channels))
  ------------------
  |  |   67|    348|#define CAF_PEAK_CHUNK_SIZE(ch) 	((int) (sizeof (int) + ch * (sizeof (float) + 8)))
  ------------------
  |  Branch (409:9): [True: 1, False: 347]
  ------------------
  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|    347|					} ;
  414|       |
  415|    347|				if (psf->peak_info)
  ------------------
  |  Branch (415:9): [True: 321, False: 26]
  ------------------
  416|    321|				{	psf_log_printf (psf, "*** Found existing peak info, using last one.\n") ;
  417|    321|					free (psf->peak_info) ;
  418|    321|					psf->peak_info = NULL ;
  419|    321|					} ;
  420|    347|				if ((psf->peak_info = peak_info_calloc (psf->sf.channels)) == NULL)
  ------------------
  |  Branch (420:9): [True: 0, False: 347]
  ------------------
  421|      0|					return SFE_MALLOC_FAILED ;
  422|       |
  423|       |				/* read in rest of PEAK chunk. */
  424|    347|				psf_binheader_readf (psf, "E4", & (psf->peak_info->edit_number)) ;
  425|    347|				psf_log_printf (psf, "  edit count : %d\n", psf->peak_info->edit_number) ;
  426|       |
  427|    347|				psf_log_printf (psf, "     Ch   Position       Value\n") ;
  428|  1.03k|				for (k = 0 ; k < psf->sf.channels ; k++)
  ------------------
  |  Branch (428:18): [True: 685, False: 347]
  ------------------
  429|    685|				{	sf_count_t position ;
  430|    685|					float value ;
  431|       |
  432|    685|					psf_binheader_readf (psf, "Ef8", &value, &position) ;
  433|    685|					psf->peak_info->peaks [k].value = value ;
  434|    685|					psf->peak_info->peaks [k].position = position ;
  435|       |
  436|    685|					snprintf (ubuf.cbuf, sizeof (ubuf.cbuf), "    %2d   %-12" PRId64 "   %g\n", k, position, value) ;
  437|    685|					psf_log_printf (psf, ubuf.cbuf) ;
  438|    685|					} ;
  439|       |
  440|    347|				psf->peak_info->peak_loc = SF_PEAK_START ;
  441|    347|				break ;
  442|       |
  443|  3.94k|			case chan_MARKER :
  ------------------
  |  |   41|  3.94k|#define chan_MARKER		MAKE_MARKER ('c', 'h', 'a', 'n')
  |  |  ------------------
  |  |  |  |  122|  3.94k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (443:4): [True: 3.94k, False: 8.90k]
  ------------------
  444|  3.94k|				if (chunk_size < 12)
  ------------------
  |  Branch (444:9): [True: 2.03k, False: 1.91k]
  ------------------
  445|  2.03k|				{	psf_log_printf (psf, "%M : %D (should be >= 12)\n", marker, chunk_size) ;
  446|  2.03k|					psf_binheader_readf (psf, "j", (size_t) chunk_size) ;
  447|  2.03k|					break ;
  448|  2.03k|					}
  449|       |
  450|  1.91k|				psf_log_printf (psf, "%M : %D\n", marker, chunk_size) ;
  451|       |
  452|  1.91k|				if ((error = caf_read_chanmap (psf, chunk_size)))
  ------------------
  |  Branch (452:9): [True: 0, False: 1.91k]
  ------------------
  453|      0|					return error ;
  454|  1.91k|				break ;
  455|       |
  456|  1.91k|			case free_MARKER :
  ------------------
  |  |   45|    265|#define free_MARKER		MAKE_MARKER ('f', 'r', 'e', 'e')
  |  |  ------------------
  |  |  |  |  122|    265|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (456:4): [True: 265, False: 12.5k]
  ------------------
  457|    265|				psf_log_printf (psf, "%M : %D\n", marker, chunk_size) ;
  458|    265|				psf_binheader_readf (psf, "j", (size_t) chunk_size) ;
  459|    265|				break ;
  460|       |
  461|  1.87k|			case data_MARKER :
  ------------------
  |  |   42|  1.87k|#define data_MARKER		MAKE_MARKER ('d', 'a', 't', 'a')
  |  |  ------------------
  |  |  |  |  122|  1.87k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (461:4): [True: 1.87k, False: 10.9k]
  ------------------
  462|  1.87k|				psf_binheader_readf (psf, "E4", &k) ;
  463|  1.87k|				if (chunk_size == -1)
  ------------------
  |  Branch (463:9): [True: 0, False: 1.87k]
  ------------------
  464|      0|				{	psf_log_printf (psf, "%M : -1\n") ;
  465|      0|					chunk_size = psf->filelength - psf->header.indx ;
  466|      0|					}
  467|  1.87k|				else if (psf->filelength > 0 && chunk_size > psf->filelength - psf->header.indx + 10)
  ------------------
  |  Branch (467:14): [True: 1.87k, False: 0]
  |  Branch (467:37): [True: 128, False: 1.75k]
  ------------------
  468|    128|				{	psf_log_printf (psf, "%M : %D (should be %D)\n", marker, chunk_size, psf->filelength - psf->header.indx - 8) ;
  469|    128|					psf->datalength = psf->filelength - psf->header.indx - 8 ;
  470|    128|					}
  471|  1.75k|				else
  472|  1.75k|				{	psf_log_printf (psf, "%M : %D\n", marker, chunk_size) ;
  473|       |					/* Subtract the 4 bytes of the 'edit' field above. */
  474|  1.75k|					psf->datalength = chunk_size - 4 ;
  475|  1.75k|					} ;
  476|       |
  477|  1.87k|				psf_log_printf (psf, "  edit : %u\n", k) ;
  478|       |
  479|  1.87k|				psf->dataoffset = psf->header.indx ;
  480|  1.87k|				if (psf->datalength + psf->dataoffset < psf->filelength)
  ------------------
  |  Branch (480:9): [True: 1.81k, False: 64]
  ------------------
  481|  1.81k|					psf->dataend = psf->datalength + psf->dataoffset ;
  482|       |
  483|  1.87k|				psf_binheader_readf (psf, "j", (size_t) psf->datalength) ;
  484|  1.87k|				have_data = 1 ;
  485|  1.87k|				break ;
  486|       |
  487|  1.19k|			case kuki_MARKER :
  ------------------
  |  |   49|  1.19k|#define kuki_MARKER		MAKE_MARKER ('k', 'u', 'k', 'i')
  |  |  ------------------
  |  |  |  |  122|  1.19k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (487:4): [True: 1.19k, False: 11.6k]
  ------------------
  488|  1.19k|				psf_log_printf (psf, "%M : %D\n", marker, chunk_size) ;
  489|  1.19k|				pcaf->alac.kuki_offset = psf_ftell (psf) - 12 ;
  490|  1.19k|				psf_binheader_readf (psf, "j", (size_t) chunk_size) ;
  491|  1.19k|				break ;
  492|       |
  493|  3.08k|			case pakt_MARKER :
  ------------------
  |  |   57|  3.08k|#define pakt_MARKER		MAKE_MARKER ('p', 'a', 'k', 't')
  |  |  ------------------
  |  |  |  |  122|  3.08k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (493:4): [True: 3.08k, False: 9.76k]
  ------------------
  494|  3.08k|				if (chunk_size < 24)
  ------------------
  |  Branch (494:9): [True: 5, False: 3.07k]
  ------------------
  495|      5|				{	psf_log_printf (psf, "%M : %D (should be > 24)\n", marker, chunk_size) ;
  496|      5|					return SFE_MALFORMED_FILE ;
  497|      5|					}
  498|  3.07k|				else if (chunk_size > psf->filelength - psf->header.indx)
  ------------------
  |  Branch (498:14): [True: 9, False: 3.06k]
  ------------------
  499|      9|				{	psf_log_printf (psf, "%M : %D (should be < %D)\n", marker, chunk_size, psf->filelength - psf->header.indx) ;
  500|      9|					return SFE_MALFORMED_FILE ;
  501|      9|					}
  502|  3.06k|				else
  503|  3.06k|					psf_log_printf (psf, "%M : %D\n", marker, chunk_size) ;
  504|       |
  505|  3.06k|				psf_binheader_readf (psf, "E8844", &pcaf->alac.packets, &pcaf->alac.valid_frames,
  506|  3.06k|									&pcaf->alac.priming_frames, &pcaf->alac.remainder_frames) ;
  507|       |
  508|  3.06k|				psf_log_printf (psf,
  509|  3.06k|						"  Packets          : %D\n"
  510|  3.06k|						"  Valid frames     : %D\n"
  511|  3.06k|						"  Priming frames   : %d\n"
  512|  3.06k|						"  Remainder frames : %d\n",
  513|  3.06k|						pcaf->alac.packets, pcaf->alac.valid_frames, pcaf->alac.priming_frames,
  514|  3.06k|						pcaf->alac.remainder_frames
  515|  3.06k|						) ;
  516|       |
  517|  3.06k|				if (pcaf->alac.packets == 0 && pcaf->alac.valid_frames == 0
  ------------------
  |  Branch (517:9): [True: 1.45k, False: 1.61k]
  |  Branch (517:36): [True: 739, False: 718]
  ------------------
  518|    739|							&& pcaf->alac.priming_frames == 0 && pcaf->alac.remainder_frames == 0)
  ------------------
  |  Branch (518:11): [True: 611, False: 128]
  |  Branch (518:45): [True: 327, False: 284]
  ------------------
  519|    327|					psf_log_printf (psf, "*** 'pakt' chunk header is all zero.\n") ;
  520|       |
  521|  3.06k|				pcaf->alac.pakt_offset = psf_ftell (psf) - 12 ;
  522|  3.06k|				psf_binheader_readf (psf, "j", (size_t) chunk_size - 24) ;
  523|  3.06k|				break ;
  524|       |
  525|    998|			case info_MARKER :
  ------------------
  |  |   47|    998|#define info_MARKER		MAKE_MARKER ('i', 'n', 'f', 'o')
  |  |  ------------------
  |  |  |  |  122|    998|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (525:4): [True: 998, False: 11.8k]
  ------------------
  526|    998|				if (chunk_size < 4)
  ------------------
  |  Branch (526:9): [True: 3, False: 995]
  ------------------
  527|      3|				{	psf_log_printf (psf, "%M : %D (should be > 4)\n", marker, chunk_size) ;
  528|      3|					return SFE_MALFORMED_FILE ;
  529|      3|					}
  530|    995|				else if (chunk_size > psf->filelength - psf->header.indx)
  ------------------
  |  Branch (530:14): [True: 6, False: 989]
  ------------------
  531|      6|				{	psf_log_printf (psf, "%M : %D (should be < %D)\n", marker, chunk_size, psf->filelength - psf->header.indx) ;
  532|      6|					return SFE_MALFORMED_FILE ;
  533|    989|					} ;
  534|    989|				psf_log_printf (psf, "%M : %D\n", marker, chunk_size) ;
  535|    989|				if (chunk_size > 4)
  ------------------
  |  Branch (535:9): [True: 750, False: 239]
  ------------------
  536|    750|					caf_read_strings (psf, chunk_size - 4) ;
  537|    989|				break ;
  538|       |
  539|  1.13k|			default :
  ------------------
  |  Branch (539:4): [True: 1.13k, False: 11.7k]
  ------------------
  540|  1.13k|				psf_log_printf (psf, "%M : %D (skipped)\n", marker, chunk_size) ;
  541|  1.13k|				psf_binheader_readf (psf, "j", (size_t) chunk_size) ;
  542|  1.13k|				break ;
  543|  12.8k|			} ;
  544|       |
  545|  12.8k|		if (marker != data_MARKER && chunk_size >= 0xffffff00)
  ------------------
  |  |   42|  12.8k|#define data_MARKER		MAKE_MARKER ('d', 'a', 't', 'a')
  |  |  ------------------
  |  |  |  |  122|  25.6k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (545:7): [True: 10.9k, False: 1.87k]
  |  Branch (545:32): [True: 0, False: 10.9k]
  ------------------
  546|      0|			break ;
  547|       |
  548|  12.8k|		if (! psf->sf.seekable && have_data)
  ------------------
  |  Branch (548:7): [True: 0, False: 12.8k]
  |  Branch (548:29): [True: 0, False: 0]
  ------------------
  549|      0|			break ;
  550|       |
  551|  12.8k|		if (psf_ftell (psf) >= psf->filelength - SIGNED_SIZEOF (chunk_size))
  ------------------
  |  |   91|  12.8k|#define		SIGNED_SIZEOF(x)	((int) sizeof (x))
  ------------------
  |  Branch (551:7): [True: 1.63k, False: 11.1k]
  ------------------
  552|  1.63k|		{	psf_log_printf (psf, "End\n") ;
  553|  1.63k|			break ;
  554|  11.1k|			} ;
  555|  11.1k|		} ;
  556|       |
  557|  2.41k|	if (have_data == 0)
  ------------------
  |  Branch (557:6): [True: 986, False: 1.43k]
  ------------------
  558|    986|	{	psf_log_printf (psf, "**** Error, could not find 'data' chunk.\n") ;
  559|    986|		return SFE_MALFORMED_FILE ;
  560|  1.43k|		} ;
  561|       |
  562|  1.43k|	psf->endian = (desc.fmt_flags & 2) ? SF_ENDIAN_LITTLE : SF_ENDIAN_BIG ;
  ------------------
  |  Branch (562:16): [True: 749, False: 684]
  ------------------
  563|       |
  564|  1.43k|	psf_fseek (psf, psf->dataoffset, SEEK_SET) ;
  565|       |
  566|  1.43k|	if ((psf->sf.format = decode_desc_chunk (psf, &desc)) == 0)
  ------------------
  |  Branch (566:6): [True: 322, False: 1.11k]
  ------------------
  567|    322|		return SFE_UNSUPPORTED_ENCODING ;
  568|       |
  569|  1.11k|	if (psf->bytewidth > 0)
  ------------------
  |  Branch (569:6): [True: 8, False: 1.10k]
  ------------------
  570|      8|		psf->sf.frames = psf->datalength / psf->bytewidth ;
  571|       |
  572|  1.11k|	return 0 ;
  573|  1.43k|} /* caf_read_header */
caf.c:caf_read_chanmap:
  798|  1.91k|{	const AIFF_CAF_CHANNEL_MAP * map_info ;
  799|  1.91k|	unsigned channel_bitmap, channel_decriptions, bytesread ;
  800|  1.91k|	int layout_tag ;
  801|       |
  802|  1.91k|	bytesread = psf_binheader_readf (psf, "E444", &layout_tag, &channel_bitmap, &channel_decriptions) ;
  803|       |
  804|  1.91k|	map_info = aiff_caf_of_channel_layout_tag (layout_tag) ;
  805|       |
  806|  1.91k|	psf_log_printf (psf, "  Tag    : %x\n", layout_tag) ;
  807|  1.91k|	if (map_info)
  ------------------
  |  Branch (807:6): [True: 1.19k, False: 713]
  ------------------
  808|  1.19k|		psf_log_printf (psf, "  Layout : %s\n", map_info->name) ;
  809|       |
  810|  1.91k|	if (bytesread < chunk_size)
  ------------------
  |  Branch (810:6): [True: 963, False: 949]
  ------------------
  811|    963|		psf_binheader_readf (psf, "j", chunk_size - bytesread) ;
  812|       |
  813|  1.91k|	if (map_info && map_info->channel_map != NULL)
  ------------------
  |  Branch (813:6): [True: 1.19k, False: 713]
  |  Branch (813:18): [True: 325, False: 874]
  ------------------
  814|    325|	{	/* 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|    325|		size_t chanmap_size = (size_t) psf->sf.channels * sizeof (psf->channel_map [0]) ;
  820|    325|		size_t copy_size = SF_MIN (psf->sf.channels, layout_tag & 0xff) * sizeof (psf->channel_map [0]) ;
  ------------------
  |  |   96|    325|#define		SF_MIN(a, b)	((a) < (b) ? (a) : (b))
  |  |  ------------------
  |  |  |  Branch (96:24): [True: 239, False: 86]
  |  |  ------------------
  ------------------
  821|       |
  822|    325|		free (psf->channel_map) ;
  823|       |
  824|    325|		if ((psf->channel_map = calloc (1, chanmap_size)) == NULL)
  ------------------
  |  Branch (824:7): [True: 0, False: 325]
  ------------------
  825|      0|			return SFE_MALLOC_FAILED ;
  826|       |
  827|    325|		memcpy (psf->channel_map, map_info->channel_map, copy_size) ;
  828|  1.91k|		} ;
  829|       |
  830|  1.91k|	return 0 ;
  831|  1.91k|} /* caf_read_chanmap */
caf.c:caf_read_strings:
  848|    750|{	char *buf ;
  849|    750|	char *key, *value ;
  850|    750|	uint32_t count, hash ;
  851|       |
  852|    750|	if ((buf = malloc (chunk_size + 1)) == NULL)
  ------------------
  |  Branch (852:6): [True: 0, False: 750]
  ------------------
  853|      0|		return (psf->error = SFE_MALLOC_FAILED) ;
  854|       |
  855|    750|	psf_binheader_readf (psf, "E4b", &count, buf, (size_t) chunk_size) ;
  856|    750|	psf_log_printf (psf, " count: %u\n", count) ;
  857|       |
  858|       |	/* Force terminate `buf` to make sure. */
  859|    750|	buf [chunk_size] = 0 ;
  860|       |
  861|  57.9k|	for (key = buf ; key < buf + chunk_size ; )
  ------------------
  |  Branch (861:19): [True: 57.4k, False: 419]
  ------------------
  862|  57.4k|	{	value = key + strlen (key) + 1 ;
  863|  57.4k|		if (value > buf + chunk_size)
  ------------------
  |  Branch (863:7): [True: 331, False: 57.1k]
  ------------------
  864|    331|			break ;
  865|  57.1k|		psf_log_printf (psf, "   %-12s : %s\n", key, value) ;
  866|       |
  867|  57.1k|		hash = string_hash32 (key) ;
  868|  57.1k|		switch (hash)
  869|  57.1k|		{	case 0xC4861943 : /* 'title' */
  ------------------
  |  Branch (869:5): [True: 100, False: 57.0k]
  ------------------
  870|    100|				psf_store_string (psf, SF_STR_TITLE, value) ;
  871|    100|				break ;
  872|     74|			case 0xAD47A394 : /* 'software' */
  ------------------
  |  Branch (872:4): [True: 74, False: 57.0k]
  ------------------
  873|     74|				psf_store_string (psf, SF_STR_SOFTWARE, value) ;
  874|     74|				break ;
  875|    327|			case 0x5D178E2A : /* 'copyright' */
  ------------------
  |  Branch (875:4): [True: 327, False: 56.8k]
  ------------------
  876|    327|				psf_store_string (psf, SF_STR_COPYRIGHT, value) ;
  877|    327|				break ;
  878|     89|			case 0x60E4D0C8 : /* 'artist' */
  ------------------
  |  Branch (878:4): [True: 89, False: 57.0k]
  ------------------
  879|     89|				psf_store_string (psf, SF_STR_ARTIST, value) ;
  880|     89|				break ;
  881|    219|			case 0x83B5D16A : /* 'genre' */
  ------------------
  |  Branch (881:4): [True: 219, False: 56.9k]
  ------------------
  882|    219|				psf_store_string (psf, SF_STR_GENRE, value) ;
  883|    219|				break ;
  884|    200|			case 0x15E5FC88 : /* 'comment' */
  ------------------
  |  Branch (884:4): [True: 200, False: 56.9k]
  ------------------
  885|    594|			case 0x7C297D5B : /* 'comments' */
  ------------------
  |  Branch (885:4): [True: 394, False: 56.7k]
  ------------------
  886|    594|				psf_store_string (psf, SF_STR_COMMENT, value) ;
  887|    594|				break ;
  888|    223|			case 0x24A7C347 : /* 'tracknumber' */
  ------------------
  |  Branch (888:4): [True: 223, False: 56.9k]
  ------------------
  889|    223|				psf_store_string (psf, SF_STR_TRACKNUMBER, value) ;
  890|    223|				break ;
  891|    259|			case 0x50A31EB7 : /* 'date' */
  ------------------
  |  Branch (891:4): [True: 259, False: 56.8k]
  ------------------
  892|    259|				psf_store_string (psf, SF_STR_DATE, value) ;
  893|    259|				break ;
  894|    282|			case 0x6583545A : /* 'album' */
  ------------------
  |  Branch (894:4): [True: 282, False: 56.8k]
  ------------------
  895|    282|				psf_store_string (psf, SF_STR_ALBUM, value) ;
  896|    282|				break ;
  897|    113|			case 0xE7C64B6C : /* 'license' */
  ------------------
  |  Branch (897:4): [True: 113, False: 57.0k]
  ------------------
  898|    113|				psf_store_string (psf, SF_STR_LICENSE, value) ;
  899|    113|				break ;
  900|  54.8k|			default :
  ------------------
  |  Branch (900:4): [True: 54.8k, False: 2.28k]
  ------------------
  901|  54.8k|				psf_log_printf (psf, " Unhandled hash 0x%x : /* '%s' */\n", hash, key) ;
  902|  54.8k|				break ;
  903|  57.1k|			} ;
  904|       |
  905|  57.1k|		key = value + strlen (value) + 1 ;
  906|  57.1k|		} ;
  907|       |
  908|    750|	free (buf) ;
  909|       |
  910|    750|	return 0 ;
  911|    750|} /* caf_read_strings */
caf.c:string_hash32:
  836|  57.1k|{	uint32_t hash = 0x87654321 ;
  837|       |
  838|   201k|	while (str [0])
  ------------------
  |  Branch (838:9): [True: 144k, False: 57.1k]
  ------------------
  839|   144k|	{	hash = hash * 333 + str [0] ;
  840|   144k|		str ++ ;
  841|   144k|		} ;
  842|       |
  843|  57.1k|	return hash ;
  844|  57.1k|} /* string_hash32 */
caf.c:decode_desc_chunk:
  252|  1.43k|{	int format = SF_FORMAT_CAF ;
  253|       |
  254|  1.43k|	psf->sf.channels = desc->channels_per_frame ;
  255|       |
  256|  1.43k|	if (desc->fmt_id == alac_MARKER)
  ------------------
  |  |   38|  1.43k|#define alac_MARKER		MAKE_MARKER ('a', 'l', 'a', 'c')
  |  |  ------------------
  |  |  |  |  122|  1.43k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (256:6): [True: 1.10k, False: 330]
  ------------------
  257|  1.10k|	{	CAF_PRIVATE	*pcaf ;
  258|       |
  259|  1.10k|		if ((pcaf = psf->container_data) != NULL)
  ------------------
  |  Branch (259:7): [True: 1.10k, False: 0]
  ------------------
  260|  1.10k|		{	switch (desc->fmt_flags)
  261|  1.10k|			{	case 1 :
  ------------------
  |  Branch (261:6): [True: 430, False: 673]
  ------------------
  262|    430|					pcaf->alac.bits_per_sample = 16 ;
  263|    430|					format |= SF_FORMAT_ALAC_16 ;
  264|    430|					break ;
  265|    216|				case 2 :
  ------------------
  |  Branch (265:5): [True: 216, False: 887]
  ------------------
  266|    216|					pcaf->alac.bits_per_sample = 20 ;
  267|    216|					format |= SF_FORMAT_ALAC_20 ;
  268|    216|					break ;
  269|    401|				case 3 :
  ------------------
  |  Branch (269:5): [True: 401, False: 702]
  ------------------
  270|    401|					pcaf->alac.bits_per_sample = 24 ;
  271|    401|					format |= SF_FORMAT_ALAC_24 ;
  272|    401|					break ;
  273|     49|				case 4 :
  ------------------
  |  Branch (273:5): [True: 49, False: 1.05k]
  ------------------
  274|     49|					pcaf->alac.bits_per_sample = 32 ;
  275|     49|					format |= SF_FORMAT_ALAC_32 ;
  276|     49|					break ;
  277|      7|				default :
  ------------------
  |  Branch (277:5): [True: 7, False: 1.09k]
  ------------------
  278|      7|					psf_log_printf (psf, "Bad ALAC format flag value of %d\n", desc->fmt_flags) ;
  279|  1.10k|				} ;
  280|       |
  281|  1.10k|			pcaf->alac.frames_per_packet = desc->frames_per_packet ;
  282|  1.10k|			} ;
  283|       |
  284|  1.10k|		return format ;
  285|  1.10k|		} ;
  286|       |
  287|    330|	format |= psf->endian == SF_ENDIAN_LITTLE ? SF_ENDIAN_LITTLE : 0 ;
  ------------------
  |  Branch (287:12): [True: 129, False: 201]
  ------------------
  288|       |
  289|    330|	if (desc->fmt_id == lpcm_MARKER && desc->fmt_flags & 1)
  ------------------
  |  |   50|    330|#define lpcm_MARKER		MAKE_MARKER ('l', 'p', 'c', 'm')
  |  |  ------------------
  |  |  |  |  122|    660|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (289:6): [True: 162, False: 168]
  |  Branch (289:37): [True: 46, False: 116]
  ------------------
  290|     46|	{	/* Floating point data. */
  291|     46|		if (desc->bits_per_chan == 32 && desc->pkt_bytes == 4 * desc->channels_per_frame)
  ------------------
  |  Branch (291:7): [True: 2, False: 44]
  |  Branch (291:36): [True: 1, False: 1]
  ------------------
  292|      1|		{	psf->bytewidth = 4 ;
  293|      1|			return format | SF_FORMAT_FLOAT ;
  294|     45|			} ;
  295|     45|		if (desc->bits_per_chan == 64 && desc->pkt_bytes == 8 * desc->channels_per_frame)
  ------------------
  |  Branch (295:7): [True: 2, False: 43]
  |  Branch (295:36): [True: 1, False: 1]
  ------------------
  296|      1|		{	psf->bytewidth = 8 ;
  297|      1|			return format | SF_FORMAT_DOUBLE ;
  298|     44|			} ;
  299|    328|		} ;
  300|       |
  301|    328|	if (desc->fmt_id == lpcm_MARKER && (desc->fmt_flags & 1) == 0)
  ------------------
  |  |   50|    328|#define lpcm_MARKER		MAKE_MARKER ('l', 'p', 'c', 'm')
  |  |  ------------------
  |  |  |  |  122|    656|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (301:6): [True: 160, False: 168]
  |  Branch (301:37): [True: 116, False: 44]
  ------------------
  302|    116|	{	/* Integer data. */
  303|    116|		if (desc->bits_per_chan == 32 && desc->pkt_bytes == 4 * desc->channels_per_frame)
  ------------------
  |  Branch (303:7): [True: 19, False: 97]
  |  Branch (303:36): [True: 1, False: 18]
  ------------------
  304|      1|		{	psf->bytewidth = 4 ;
  305|      1|			return format | SF_FORMAT_PCM_32 ;
  306|    115|			} ;
  307|    115|		if (desc->bits_per_chan == 24 && desc->pkt_bytes == 3 * desc->channels_per_frame)
  ------------------
  |  Branch (307:7): [True: 2, False: 113]
  |  Branch (307:36): [True: 1, False: 1]
  ------------------
  308|      1|		{	psf->bytewidth = 3 ;
  309|      1|			return format | SF_FORMAT_PCM_24 ;
  310|    114|			} ;
  311|    114|		if (desc->bits_per_chan == 16 && desc->pkt_bytes == 2 * desc->channels_per_frame)
  ------------------
  |  Branch (311:7): [True: 2, False: 112]
  |  Branch (311:36): [True: 1, False: 1]
  ------------------
  312|      1|		{	psf->bytewidth = 2 ;
  313|      1|			return format | SF_FORMAT_PCM_16 ;
  314|    113|			} ;
  315|    113|		if (desc->bits_per_chan == 8 && desc->pkt_bytes == 1 * desc->channels_per_frame)
  ------------------
  |  Branch (315:7): [True: 38, False: 75]
  |  Branch (315:35): [True: 1, False: 37]
  ------------------
  316|      1|		{	psf->bytewidth = 1 ;
  317|      1|			return format | SF_FORMAT_PCM_S8 ;
  318|    112|			} ;
  319|    324|		} ;
  320|       |
  321|    324|	if (desc->fmt_id == alaw_MARKER && desc->bits_per_chan == 8)
  ------------------
  |  |   39|    324|#define alaw_MARKER		MAKE_MARKER ('a', 'l', 'a', 'w')
  |  |  ------------------
  |  |  |  |  122|    648|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (321:6): [True: 13, False: 311]
  |  Branch (321:37): [True: 1, False: 12]
  ------------------
  322|      1|	{	psf->bytewidth = 1 ;
  323|      1|		return format | SF_FORMAT_ALAW ;
  324|    323|		} ;
  325|       |
  326|    323|	if (desc->fmt_id == ulaw_MARKER && desc->bits_per_chan == 8)
  ------------------
  |  |   63|    323|#define ulaw_MARKER		MAKE_MARKER ('u', 'l', 'a', 'w')
  |  |  ------------------
  |  |  |  |  122|    646|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (326:6): [True: 18, False: 305]
  |  Branch (326:37): [True: 1, False: 17]
  ------------------
  327|      1|	{	psf->bytewidth = 1 ;
  328|      1|		return format | SF_FORMAT_ULAW ;
  329|    322|		} ;
  330|       |
  331|    322|	psf_log_printf (psf, "**** Unknown format identifier.\n") ;
  332|       |
  333|    322|	return 0 ;
  334|    323|} /* decode_desc_chunk */
caf.c:caf_next_chunk_iterator:
 1005|  1.46k|{	return psf_next_chunk_iterator (&psf->rchunks, iterator) ;
 1006|  1.46k|} /* caf_next_chunk_iterator */
caf.c:caf_get_chunk_size:
 1010|  1.02k|{	int indx ;
 1011|       |
 1012|  1.02k|	if ((indx = psf_find_read_chunk_iterator (&psf->rchunks, iterator)) < 0)
  ------------------
  |  Branch (1012:6): [True: 0, False: 1.02k]
  ------------------
 1013|      0|		return SFE_UNKNOWN_CHUNK ;
 1014|       |
 1015|  1.02k|	chunk_info->datalen = psf->rchunks.chunks [indx].len ;
 1016|       |
 1017|  1.02k|	return SFE_NO_ERROR ;
 1018|  1.02k|} /* caf_get_chunk_size */
caf.c:caf_get_chunk_data:
 1022|  1.02k|{	int indx ;
 1023|  1.02k|	sf_count_t pos ;
 1024|       |
 1025|  1.02k|	if ((indx = psf_find_read_chunk_iterator (&psf->rchunks, iterator)) < 0)
  ------------------
  |  Branch (1025:6): [True: 0, False: 1.02k]
  ------------------
 1026|      0|		return SFE_UNKNOWN_CHUNK ;
 1027|       |
 1028|  1.02k|	if (chunk_info->data == NULL)
  ------------------
  |  Branch (1028:6): [True: 0, False: 1.02k]
  ------------------
 1029|      0|		return SFE_BAD_CHUNK_DATA_PTR ;
 1030|       |
 1031|  1.02k|	chunk_info->id_size = psf->rchunks.chunks [indx].id_size ;
 1032|  1.02k|	memcpy (chunk_info->id, psf->rchunks.chunks [indx].id, sizeof (chunk_info->id) / sizeof (*chunk_info->id)) ;
 1033|       |
 1034|  1.02k|	pos = psf_ftell (psf) ;
 1035|  1.02k|	psf_fseek (psf, psf->rchunks.chunks [indx].offset, SEEK_SET) ;
 1036|  1.02k|	psf_fread (chunk_info->data, SF_MIN (chunk_info->datalen, psf->rchunks.chunks [indx].len), 1, psf) ;
  ------------------
  |  |   96|  1.02k|#define		SF_MIN(a, b)	((a) < (b) ? (a) : (b))
  |  |  ------------------
  |  |  |  Branch (96:24): [True: 0, False: 1.02k]
  |  |  ------------------
  ------------------
 1037|  1.02k|	psf_fseek (psf, pos, SEEK_SET) ;
 1038|       |
 1039|  1.02k|	return SFE_NO_ERROR ;
 1040|  1.02k|} /* caf_get_chunk_data */

cart_var_alloc:
   41|    243|{	SF_CART_INFO_16K* thing ;
   42|    243|	thing = malloc (sizeof (SF_CART_INFO_16K)) ;
   43|    243|	return thing ;
   44|    243|} /* cart_var_alloc */

aiff_caf_of_channel_layout_tag:
  247|  3.79k|{	const AIFF_CAF_CHANNEL_MAP * curr_map ;
  248|  3.79k|	unsigned k, len ;
  249|  3.79k|	int channels = tag & 0xffff ;
  250|       |
  251|  3.79k|	if (channels < 0 || channels >= ARRAY_LEN (map))
  ------------------
  |  |   93|  3.79k|#define		ARRAY_LEN(x)	((int) (sizeof (x) / sizeof ((x) [0])))
  ------------------
  |  Branch (251:6): [True: 0, False: 3.79k]
  |  Branch (251:22): [True: 300, False: 3.49k]
  ------------------
  252|    300|		return NULL ;
  253|       |
  254|  3.49k|	curr_map = map [channels].map ;
  255|  3.49k|	len = map [channels].len ;
  256|       |
  257|  15.9k|	for (k = 0 ; k < len ; k++)
  ------------------
  |  Branch (257:15): [True: 15.1k, False: 786]
  ------------------
  258|  15.1k|		if (curr_map [k].channel_layout_tag == tag)
  ------------------
  |  Branch (258:7): [True: 2.70k, False: 12.4k]
  ------------------
  259|  2.70k|			return curr_map + k ;
  260|       |
  261|    786|	return NULL ;
  262|  3.49k|} /* aiff_caf_of_channel_layout_tag */

psf_get_chunk_iterator:
   42|  1.08k|{	const READ_CHUNKS * pchk = &psf->rchunks ;
   43|  1.08k|	int idx ;
   44|       |
   45|  1.08k|	if (marker_str)
  ------------------
  |  Branch (45:6): [True: 1.08k, False: 0]
  ------------------
   46|  1.08k|		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|  1.08k|	if (idx < 0)
  ------------------
  |  Branch (50:6): [True: 64, False: 1.02k]
  ------------------
   51|     64|		return NULL ;
   52|       |
   53|  1.02k|	if (psf->iterator == NULL)
  ------------------
  |  Branch (53:6): [True: 1.02k, False: 0]
  ------------------
   54|  1.02k|	{	psf->iterator = calloc (1, sizeof (SF_CHUNK_ITERATOR)) ;
   55|  1.02k|		if (psf->iterator == NULL)
  ------------------
  |  Branch (55:7): [True: 0, False: 1.02k]
  ------------------
   56|      0|			return NULL ;
   57|  1.02k|		} ;
   58|       |
   59|  1.02k|	psf->iterator->sndfile = (SNDFILE *) psf ;
   60|       |
   61|  1.02k|	if (marker_str)
  ------------------
  |  Branch (61:6): [True: 1.02k, False: 0]
  ------------------
   62|  1.02k|	{	int64_t hash ;
   63|  1.02k|		size_t marker_len ;
   64|  1.02k|		union
   65|  1.02k|		{	uint32_t marker ;
   66|  1.02k|			char str [5] ;
   67|  1.02k|		} u ;
   68|       |
   69|  1.02k|		snprintf (u.str, sizeof (u.str), "%s", marker_str) ;
   70|       |
   71|  1.02k|		marker_len = strlen (marker_str) ;
   72|  1.02k|		if (marker_len > 64)
  ------------------
  |  Branch (72:7): [True: 0, False: 1.02k]
  ------------------
   73|      0|			marker_len = 64 ;
   74|       |
   75|  1.02k|		hash = marker_len > 4 ? hash_of_str (marker_str) : u.marker ;
  ------------------
  |  Branch (75:10): [True: 0, False: 1.02k]
  ------------------
   76|       |
   77|  1.02k|		memcpy (psf->iterator->id, marker_str, marker_len) ;
   78|  1.02k|		psf->iterator->id_size = (unsigned) marker_len ;
   79|  1.02k|		psf->iterator->hash = hash ;
   80|  1.02k|		}
   81|       |
   82|  1.02k|	psf->iterator->current = idx ;
   83|       |
   84|  1.02k|	return psf->iterator ;
   85|  1.02k|} /* psf_get_chunk_iterator */
psf_next_chunk_iterator:
   89|  1.46k|{	uint64_t hash = iterator->hash ;
   90|  1.46k|	uint32_t k ;
   91|       |
   92|  1.46k|	iterator->current++ ;
   93|       |
   94|  1.46k|	if (hash)
  ------------------
  |  Branch (94:6): [True: 1.46k, False: 0]
  ------------------
   95|  2.81k|	{	for (k = iterator->current ; k < pchk->used ; k++)
  ------------------
  |  Branch (95:33): [True: 1.78k, False: 1.02k]
  ------------------
   96|  1.78k|			if (pchk->chunks [k].hash == hash)
  ------------------
  |  Branch (96:8): [True: 436, False: 1.35k]
  ------------------
   97|    436|			{	iterator->current = k ;
   98|    436|				return iterator ;
   99|    436|				}
  100|  1.46k|		}
  101|      0|	else if (iterator->current < pchk->used)
  ------------------
  |  Branch (101:11): [True: 0, False: 0]
  ------------------
  102|      0|		return iterator ;
  103|       |
  104|       |	/* No match, clear iterator and return NULL */
  105|  1.02k|	memset (iterator, 0, sizeof (*iterator)) ;
  106|       |	return NULL ;
  107|  1.46k|} /* psf_next_chunk_iterator */
psf_store_read_chunk_u32:
  144|   913k|{	READ_CHUNK rchunk ;
  145|       |
  146|   913k|	memset (&rchunk, 0, sizeof (rchunk)) ;
  147|       |
  148|   913k|	rchunk.hash = marker ;
  149|   913k|	rchunk.mark32 = marker ;
  150|   913k|	rchunk.offset = offset ;
  151|   913k|	rchunk.len = len ;
  152|       |
  153|   913k|	rchunk.id_size = 4 ;
  154|   913k|	memcpy (rchunk.id, &marker, rchunk.id_size) ;
  155|       |
  156|   913k|	return psf_store_read_chunk (pchk, &rchunk) ;
  157|   913k|} /* psf_store_read_chunk_u32 */
psf_find_read_chunk_str:
  161|  1.08k|{	uint64_t hash ;
  162|  1.08k|	uint32_t k ;
  163|  1.08k|	union
  164|  1.08k|	{	uint32_t marker ;
  165|  1.08k|		char str [5] ;
  166|  1.08k|	} u ;
  167|       |
  168|  1.08k|	snprintf (u.str, sizeof (u.str), "%s", marker_str) ;
  169|       |
  170|  1.08k|	hash = strlen (marker_str) > 4 ? hash_of_str (marker_str) : u.marker ;
  ------------------
  |  Branch (170:9): [True: 0, False: 1.08k]
  ------------------
  171|       |
  172|  2.85k|	for (k = 0 ; k < pchk->used ; k++)
  ------------------
  |  Branch (172:15): [True: 2.79k, False: 64]
  ------------------
  173|  2.79k|		if (pchk->chunks [k].hash == hash)
  ------------------
  |  Branch (173:7): [True: 1.02k, False: 1.76k]
  ------------------
  174|  1.02k|			return k ;
  175|       |
  176|     64|	return -1 ;
  177|  1.08k|} /* psf_find_read_chunk_str */
psf_find_read_chunk_iterator:
  191|  2.05k|{	if (marker->current < pchk->used)
  ------------------
  |  Branch (191:7): [True: 2.05k, False: 0]
  ------------------
  192|  2.05k|		return marker->current ;
  193|       |
  194|      0|	return -1 ;
  195|  2.05k|} /* psf_find_read_chunk_iterator */
chunk.c:psf_store_read_chunk:
  111|   913k|{	if (pchk->count == 0)
  ------------------
  |  Branch (111:7): [True: 12.1k, False: 901k]
  ------------------
  112|  12.1k|	{	pchk->used = 0 ;
  113|  12.1k|		pchk->count = 20 ;
  114|  12.1k|		pchk->chunks = calloc (pchk->count, sizeof (READ_CHUNK)) ;
  115|  12.1k|		if (!pchk->chunks)
  ------------------
  |  Branch (115:7): [True: 0, False: 12.1k]
  ------------------
  116|      0|		{	return SFE_MALLOC_FAILED ;
  117|  12.1k|			} ;
  118|  12.1k|		}
  119|   901k|	else if (pchk->used > pchk->count)
  ------------------
  |  Branch (119:11): [True: 0, False: 901k]
  ------------------
  120|      0|		return SFE_INTERNAL ;
  121|   901k|	else if (pchk->used == pchk->count)
  ------------------
  |  Branch (121:11): [True: 6.23k, False: 895k]
  ------------------
  122|  6.23k|	{	READ_CHUNK * old_ptr = pchk->chunks ;
  123|  6.23k|		int new_count = 3 * (pchk->count + 1) / 2 ;
  124|       |
  125|  6.23k|		READ_CHUNK * new_chunks = realloc (old_ptr, new_count * sizeof (READ_CHUNK)) ;
  126|  6.23k|		if (new_chunks == NULL)
  ------------------
  |  Branch (126:7): [True: 0, False: 6.23k]
  ------------------
  127|      0|		{
  128|      0|			return SFE_MALLOC_FAILED ;
  129|  6.23k|			} else {
  130|  6.23k|			pchk->chunks = new_chunks;
  131|  6.23k|			} ;
  132|  6.23k|		pchk->count = new_count ;
  133|   913k|		} ;
  134|       |
  135|   913k|	pchk->chunks [pchk->used] = *rchunk ;
  136|       |
  137|   913k|	pchk->used ++ ;
  138|       |
  139|   913k|	return SFE_NO_ERROR ;
  140|   913k|} /* psf_store_read_chunk */

psf_allocate:
   44|  19.8k|{	SF_PRIVATE * psf ;
   45|       |
   46|  19.8k|	if ((psf = calloc (1, sizeof (SF_PRIVATE))) == NULL)
  ------------------
  |  Branch (46:6): [True: 0, False: 19.8k]
  ------------------
   47|      0|		return	NULL ;
   48|       |
   49|  19.8k|	if ((psf->header.ptr = calloc (1, INITIAL_HEADER_SIZE)) == NULL)
  ------------------
  |  |   39|  19.8k|#define	INITIAL_HEADER_SIZE	256
  ------------------
  |  Branch (49:6): [True: 0, False: 19.8k]
  ------------------
   50|      0|	{	free (psf) ;
   51|      0|		return	NULL ;
   52|  19.8k|		} ;
   53|  19.8k|	psf->header.len = INITIAL_HEADER_SIZE ;
  ------------------
  |  |   39|  19.8k|#define	INITIAL_HEADER_SIZE	256
  ------------------
   54|       |
   55|  19.8k|	return psf ;
   56|  19.8k|} /* psf_allocate */
psf_log_printf:
  106|  21.3M|{	va_list		ap ;
  107|  21.3M|	uint32_t	u, tens ;
  108|  21.3M|	int			d, shift, width, width_specifier, left_align, slen, precision ;
  109|  21.3M|	char		c, *strptr, istr [5], lead_char, sign_char ;
  110|       |
  111|  21.3M|	va_start (ap, format) ;
  112|       |
  113|   658M|	while ((c = *format++))
  ------------------
  |  Branch (113:9): [True: 636M, False: 21.3M]
  ------------------
  114|   636M|	{	if (c != '%')
  ------------------
  |  Branch (114:8): [True: 603M, False: 33.6M]
  ------------------
  115|   603M|		{	log_putchar (psf, c) ;
  116|   603M|			continue ;
  117|   603M|			} ;
  118|       |
  119|  33.6M|		if (format [0] == '%') /* Handle %% */
  ------------------
  |  Branch (119:7): [True: 0, False: 33.6M]
  ------------------
  120|      0|		{ 	log_putchar (psf, '%') ;
  121|      0|			format ++ ;
  122|      0|			continue ;
  123|  33.6M|			} ;
  124|       |
  125|  33.6M|		sign_char = 0 ;
  126|  33.6M|		left_align = SF_FALSE ;
  127|  33.6M|		while (1)
  ------------------
  |  Branch (127:10): [True: 33.6M, Folded]
  ------------------
  128|  33.6M|		{	switch (format [0])
  129|  33.6M|			{	case ' ' :
  ------------------
  |  Branch (129:6): [True: 0, False: 33.6M]
  ------------------
  130|      0|				case '+' :
  ------------------
  |  Branch (130:5): [True: 0, False: 33.6M]
  ------------------
  131|      0|					sign_char = format [0] ;
  132|      0|					format ++ ;
  133|      0|					continue ;
  134|       |
  135|  57.1k|				case '-' :
  ------------------
  |  Branch (135:5): [True: 57.1k, False: 33.6M]
  ------------------
  136|  57.1k|					left_align = SF_TRUE ;
  137|  57.1k|					format ++ ;
  138|  57.1k|					continue ;
  139|       |
  140|  33.6M|				default : break ;
  ------------------
  |  Branch (140:5): [True: 33.6M, False: 57.1k]
  ------------------
  141|  33.6M|				} ;
  142|       |
  143|  33.6M|			break ;
  144|  33.6M|			} ;
  145|       |
  146|  33.6M|		if (format [0] == 0)
  ------------------
  |  Branch (146:7): [True: 0, False: 33.6M]
  ------------------
  147|      0|			break ;
  148|       |
  149|  33.6M|		lead_char = ' ' ;
  150|  33.6M|		if (format [0] == '0')
  ------------------
  |  Branch (150:7): [True: 5.22M, False: 28.4M]
  ------------------
  151|  5.22M|			lead_char = '0' ;
  152|       |
  153|  33.6M|		width_specifier = 0 ;
  154|  44.2M|		while ((c = *format++) && isdigit (c))
  ------------------
  |  Branch (154:10): [True: 44.2M, False: 0]
  |  Branch (154:29): [True: 10.5M, False: 33.6M]
  ------------------
  155|  10.5M|			width_specifier = width_specifier * 10 + (c - '0') ;
  156|       |
  157|  33.6M|		precision = 0 ;
  158|  33.6M|		if (c == '.')
  ------------------
  |  Branch (158:7): [True: 106, False: 33.6M]
  ------------------
  159|    318|		{	while ((c = *format++) && isdigit (c))
  ------------------
  |  Branch (159:12): [True: 318, False: 0]
  |  Branch (159:31): [True: 212, False: 106]
  ------------------
  160|    212|				precision = precision * 10 + (c - '0') ;
  161|    106|			} ;
  162|       |
  163|  33.6M|		switch (c)
  164|  33.6M|		{	case 0 : /* NULL character. */
  ------------------
  |  Branch (164:5): [True: 0, False: 33.6M]
  ------------------
  165|      0|					va_end (ap) ;
  166|      0|					return ;
  167|       |
  168|  1.58M|			case 's': /* string */
  ------------------
  |  Branch (168:4): [True: 1.58M, False: 32.0M]
  ------------------
  169|  1.58M|					strptr = va_arg (ap, char *) ;
  170|  1.58M|					if (strptr == NULL)
  ------------------
  |  Branch (170:10): [True: 0, False: 1.58M]
  ------------------
  171|      0|						break ;
  172|  1.58M|					if (precision > 0)
  ------------------
  |  Branch (172:10): [True: 106, False: 1.58M]
  ------------------
  173|    106|						slen = strnlen (strptr, precision) ;
  174|  1.58M|					else
  175|  1.58M|						slen = strlen (strptr) ;
  176|  1.58M|					width_specifier = width_specifier >= slen ? width_specifier - slen : 0 ;
  ------------------
  |  Branch (176:24): [True: 1.30M, False: 278k]
  ------------------
  177|  1.58M|					if (left_align == SF_FALSE)
  ------------------
  |  Branch (177:10): [True: 1.52M, False: 57.1k]
  ------------------
  178|  1.52M|						while (width_specifier -- > 0)
  ------------------
  |  Branch (178:14): [True: 0, False: 1.52M]
  ------------------
  179|      0|							log_putchar (psf, ' ') ;
  180|  7.22M|					while (slen--)
  ------------------
  |  Branch (180:13): [True: 5.64M, False: 1.58M]
  ------------------
  181|  5.64M|						log_putchar (psf, *strptr++) ;
  182|  2.16M|					while (width_specifier -- > 0)
  ------------------
  |  Branch (182:13): [True: 589k, False: 1.58M]
  ------------------
  183|   589k|						log_putchar (psf, ' ') ;
  184|  1.58M|					break ;
  185|       |
  186|  17.1M|			case 'd': /* int */
  ------------------
  |  Branch (186:4): [True: 17.1M, False: 16.4M]
  ------------------
  187|  17.1M|					d = va_arg (ap, int) ;
  188|       |
  189|  17.1M|					if (d < 0)
  ------------------
  |  Branch (189:10): [True: 351k, False: 16.8M]
  ------------------
  190|   351k|					{	sign_char = '-' ;
  191|   351k|						if (lead_char != '0' && left_align == SF_FALSE)
  ------------------
  |  Branch (191:11): [True: 351k, False: 9]
  |  Branch (191:31): [True: 351k, False: 0]
  ------------------
  192|   351k|							width_specifier -- ;
  193|       |
  194|   351k|						u = - ((unsigned) d) ;
  195|   351k|						}
  196|  16.8M|					else
  197|  16.8M|					{	u = (unsigned) d ;
  198|  16.8M|						}
  199|       |
  200|  17.1M|					tens = 1 ;
  201|  17.1M|					width = 1 ;
  202|  43.8M|					while (u / tens >= 10)
  ------------------
  |  Branch (202:13): [True: 26.6M, False: 17.1M]
  ------------------
  203|  26.6M|					{	tens *= 10 ;
  204|  26.6M|						width ++ ;
  205|  26.6M|						} ;
  206|       |
  207|  17.1M|					width_specifier -= width ;
  208|       |
  209|  17.1M|					if (sign_char == ' ')
  ------------------
  |  Branch (209:10): [True: 0, False: 17.1M]
  ------------------
  210|      0|					{	log_putchar (psf, ' ') ;
  211|      0|						width_specifier -- ;
  212|      0|						} ;
  213|       |
  214|  17.1M|					if (left_align == SF_FALSE && lead_char != '0')
  ------------------
  |  Branch (214:10): [True: 17.1M, False: 0]
  |  Branch (214:36): [True: 17.1M, False: 73]
  ------------------
  215|  17.1M|					{	if (sign_char == '+')
  ------------------
  |  Branch (215:12): [True: 0, False: 17.1M]
  ------------------
  216|      0|							width_specifier -- ;
  217|       |
  218|  17.1M|						while (width_specifier -- > 0)
  ------------------
  |  Branch (218:14): [True: 4.14k, False: 17.1M]
  ------------------
  219|  4.14k|							log_putchar (psf, lead_char) ;
  220|  17.1M|						} ;
  221|       |
  222|  17.1M|					if (sign_char == '+' || sign_char == '-')
  ------------------
  |  Branch (222:10): [True: 0, False: 17.1M]
  |  Branch (222:30): [True: 351k, False: 16.8M]
  ------------------
  223|   351k|					{	log_putchar (psf, sign_char) ;
  224|   351k|						width_specifier -- ;
  225|   351k|						} ;
  226|       |
  227|  17.1M|					if (left_align == SF_FALSE)
  ------------------
  |  Branch (227:10): [True: 17.1M, False: 0]
  ------------------
  228|  17.1M|						while (width_specifier -- > 0)
  ------------------
  |  Branch (228:14): [True: 50, False: 17.1M]
  ------------------
  229|     50|							log_putchar (psf, lead_char) ;
  230|       |
  231|  60.9M|					while (tens > 0)
  ------------------
  |  Branch (231:13): [True: 43.8M, False: 17.1M]
  ------------------
  232|  43.8M|					{	log_putchar (psf, '0' + u / tens) ;
  233|  43.8M|						u %= tens ;
  234|  43.8M|						tens /= 10 ;
  235|  43.8M|						} ;
  236|       |
  237|  17.1M|					while (width_specifier -- > 0)
  ------------------
  |  Branch (237:13): [True: 0, False: 17.1M]
  ------------------
  238|      0|						log_putchar (psf, lead_char) ;
  239|  17.1M|					break ;
  240|       |
  241|   721k|			case 'D': /* sf_count_t */
  ------------------
  |  Branch (241:4): [True: 721k, False: 32.9M]
  ------------------
  242|   721k|					{	sf_count_t	D ;
  243|   721k|						uint64_t	U, Tens ;
  244|       |
  245|   721k|						D = va_arg (ap, sf_count_t) ;
  246|       |
  247|   721k|						if (D == 0)
  ------------------
  |  Branch (247:11): [True: 14.0k, False: 707k]
  ------------------
  248|  14.0k|						{	while (-- width_specifier > 0)
  ------------------
  |  Branch (248:16): [True: 0, False: 14.0k]
  ------------------
  249|      0|								log_putchar (psf, lead_char) ;
  250|  14.0k|							log_putchar (psf, '0') ;
  251|  14.0k|							break ;
  252|  14.0k|							}
  253|   707k|						else
  254|   707k|						{	if (D < 0)
  ------------------
  |  Branch (254:13): [True: 118k, False: 589k]
  ------------------
  255|   118k|							{	log_putchar (psf, '-') ;
  256|   118k|								U = - ((uint64_t) D) ;
  257|   118k|								}
  258|   589k|							else
  259|   589k|							{	U = (uint64_t) D ;
  260|   589k|								}
  261|   707k|							}
  262|       |
  263|   707k|						Tens = 1 ;
  264|   707k|						width = 1 ;
  265|  3.64M|						while (U / Tens >= 10)
  ------------------
  |  Branch (265:14): [True: 2.93M, False: 707k]
  ------------------
  266|  2.93M|						{	Tens *= 10 ;
  267|  2.93M|							width ++ ;
  268|  2.93M|							} ;
  269|       |
  270|   707k|						while (width_specifier > width)
  ------------------
  |  Branch (270:14): [True: 0, False: 707k]
  ------------------
  271|      0|						{	log_putchar (psf, lead_char) ;
  272|      0|							width_specifier-- ;
  273|      0|							} ;
  274|       |
  275|  4.35M|						while (Tens > 0)
  ------------------
  |  Branch (275:14): [True: 3.64M, False: 707k]
  ------------------
  276|  3.64M|						{	log_putchar (psf, '0' + U / Tens) ;
  277|  3.64M|							U %= Tens ;
  278|  3.64M|							Tens /= 10 ;
  279|  3.64M|							} ;
  280|   707k|						} ;
  281|   707k|					break ;
  282|       |
  283|  2.63M|			case 'u': /* unsigned int */
  ------------------
  |  Branch (283:4): [True: 2.63M, False: 30.9M]
  ------------------
  284|  2.63M|					u = va_arg (ap, unsigned int) ;
  285|       |
  286|  2.63M|					tens = 1 ;
  287|  2.63M|					width = 1 ;
  288|  14.7M|					while (u / tens >= 10)
  ------------------
  |  Branch (288:13): [True: 12.0M, False: 2.63M]
  ------------------
  289|  12.0M|					{	tens *= 10 ;
  290|  12.0M|						width ++ ;
  291|  12.0M|						} ;
  292|       |
  293|  2.63M|					width_specifier -= width ;
  294|       |
  295|  2.63M|					if (sign_char == ' ')
  ------------------
  |  Branch (295:10): [True: 0, False: 2.63M]
  ------------------
  296|      0|					{	log_putchar (psf, ' ') ;
  297|      0|						width_specifier -- ;
  298|      0|						} ;
  299|       |
  300|  2.63M|					if (left_align == SF_FALSE && lead_char != '0')
  ------------------
  |  Branch (300:10): [True: 2.63M, False: 0]
  |  Branch (300:36): [True: 2.63M, False: 1.35k]
  ------------------
  301|  2.63M|					{	if (sign_char == '+')
  ------------------
  |  Branch (301:12): [True: 0, False: 2.63M]
  ------------------
  302|      0|							width_specifier -- ;
  303|       |
  304|  2.70M|						while (width_specifier -- > 0)
  ------------------
  |  Branch (304:14): [True: 69.1k, False: 2.63M]
  ------------------
  305|  69.1k|							log_putchar (psf, lead_char) ;
  306|  2.63M|						} ;
  307|       |
  308|  2.63M|					if (sign_char == '+' || sign_char == '-')
  ------------------
  |  Branch (308:10): [True: 0, False: 2.63M]
  |  Branch (308:30): [True: 0, False: 2.63M]
  ------------------
  309|      0|					{	log_putchar (psf, sign_char) ;
  310|      0|						width_specifier -- ;
  311|      0|						} ;
  312|       |
  313|  2.63M|					if (left_align == SF_FALSE)
  ------------------
  |  Branch (313:10): [True: 2.63M, False: 0]
  ------------------
  314|  2.63M|						while (width_specifier -- > 0)
  ------------------
  |  Branch (314:14): [True: 1.11k, False: 2.63M]
  ------------------
  315|  1.11k|							log_putchar (psf, lead_char) ;
  316|       |
  317|  17.3M|					while (tens > 0)
  ------------------
  |  Branch (317:13): [True: 14.7M, False: 2.63M]
  ------------------
  318|  14.7M|					{	log_putchar (psf, '0' + u / tens) ;
  319|  14.7M|						u %= tens ;
  320|  14.7M|						tens /= 10 ;
  321|  14.7M|						} ;
  322|       |
  323|  2.63M|					while (width_specifier -- > 0)
  ------------------
  |  Branch (323:13): [True: 0, False: 2.63M]
  ------------------
  324|      0|						log_putchar (psf, lead_char) ;
  325|  2.63M|					break ;
  326|       |
  327|      0|			case 'c': /* char */
  ------------------
  |  Branch (327:4): [True: 0, False: 33.6M]
  ------------------
  328|      0|					c = va_arg (ap, int) & 0xFF ;
  329|      0|					log_putchar (psf, c) ;
  330|      0|					break ;
  331|       |
  332|  2.34M|			case 'x': /* hex */
  ------------------
  |  Branch (332:4): [True: 2.34M, False: 31.2M]
  ------------------
  333|  8.17M|			case 'X': /* hex */
  ------------------
  |  Branch (333:4): [True: 5.83M, False: 27.8M]
  ------------------
  334|  8.17M|					d = va_arg (ap, int) ;
  335|       |
  336|  8.17M|					if (d == 0)
  ------------------
  |  Branch (336:10): [True: 4.14M, False: 4.02M]
  ------------------
  337|  6.27M|					{	while (--width_specifier > 0)
  ------------------
  |  Branch (337:15): [True: 2.12M, False: 4.14M]
  ------------------
  338|  2.12M|							log_putchar (psf, lead_char) ;
  339|  4.14M|						log_putchar (psf, '0') ;
  340|  4.14M|						break ;
  341|  4.14M|						} ;
  342|  4.02M|					shift = 28 ;
  343|  4.02M|					width = (width_specifier < 8) ? 8 : width_specifier ;
  ------------------
  |  Branch (343:14): [True: 4.02M, False: 7.54k]
  ------------------
  344|  26.3M|					while (! ((((uint32_t) 0xF) << shift) & d))
  ------------------
  |  Branch (344:13): [True: 22.3M, False: 4.02M]
  ------------------
  345|  22.3M|					{	shift -= 4 ;
  346|  22.3M|						width -- ;
  347|  22.3M|						} ;
  348|       |
  349|  4.60M|					while (width > 0 && width_specifier > width)
  ------------------
  |  Branch (349:13): [True: 4.60M, False: 0]
  |  Branch (349:26): [True: 581k, False: 4.02M]
  ------------------
  350|   581k|					{	log_putchar (psf, lead_char) ;
  351|   581k|						width_specifier-- ;
  352|   581k|						} ;
  353|       |
  354|  13.9M|					while (shift >= 0)
  ------------------
  |  Branch (354:13): [True: 9.92M, False: 4.02M]
  ------------------
  355|  9.92M|					{	c = (d >> shift) & 0xF ;
  356|  9.92M|						log_putchar (psf, (c > 9) ? c + 'A' - 10 : c + '0') ;
  ------------------
  |  Branch (356:25): [True: 3.03M, False: 6.88M]
  ------------------
  357|  9.92M|						shift -= 4 ;
  358|  9.92M|						} ;
  359|  4.02M|					break ;
  360|       |
  361|  3.37M|			case 'M': /* int2str */
  ------------------
  |  Branch (361:4): [True: 3.37M, False: 30.2M]
  ------------------
  362|  3.37M|					d = va_arg (ap, int) ;
  363|  3.37M|					if (CPU_IS_LITTLE_ENDIAN)
  ------------------
  |  |   14|  3.37M|#define CPU_IS_LITTLE_ENDIAN 1
  |  |  ------------------
  |  |  |  Branch (14:30): [True: 3.37M, Folded]
  |  |  ------------------
  ------------------
  364|  3.37M|					{	istr [0] = d & 0xFF ;
  365|  3.37M|						istr [1] = (d >> 8) & 0xFF ;
  366|  3.37M|						istr [2] = (d >> 16) & 0xFF ;
  367|  3.37M|						istr [3] = (d >> 24) & 0xFF ;
  368|  3.37M|						}
  369|      0|					else
  370|      0|					{	istr [3] = d & 0xFF ;
  371|      0|						istr [2] = (d >> 8) & 0xFF ;
  372|      0|						istr [1] = (d >> 16) & 0xFF ;
  373|      0|						istr [0] = (d >> 24) & 0xFF ;
  374|      0|						} ;
  375|  3.37M|					istr [4] = 0 ;
  376|  3.37M|					strptr = istr ;
  377|  16.1M|					while (*strptr)
  ------------------
  |  Branch (377:13): [True: 12.8M, False: 3.37M]
  ------------------
  378|  12.8M|					{	c = *strptr++ ;
  379|  12.8M|						log_putchar (psf, psf_isprint (c) ? c : '.') ;
  ------------------
  |  Branch (379:25): [True: 11.4M, False: 1.33M]
  ------------------
  380|  12.8M|						} ;
  381|  3.37M|					break ;
  382|       |
  383|      0|			default :
  ------------------
  |  Branch (383:4): [True: 0, False: 33.6M]
  ------------------
  384|      0|					log_putchar (psf, '*') ;
  385|      0|					log_putchar (psf, c) ;
  386|      0|					log_putchar (psf, '*') ;
  387|      0|					break ;
  388|  33.6M|			} /* switch */
  389|  33.6M|		} /* while */
  390|       |
  391|  21.3M|	va_end (ap) ;
  392|  21.3M|	return ;
  393|  21.3M|} /* psf_log_printf */
psf_binheader_readf:
  984|  9.95M|{	va_list			argptr ;
  985|  9.95M|	sf_count_t		*countptr, countdata ;
  986|  9.95M|	unsigned char	*ucptr, sixteen_bytes [16] = { 0 } ;
  987|  9.95M|	unsigned int 	*intptr, intdata ;
  988|  9.95M|	unsigned short	*shortptr ;
  989|  9.95M|	char			*charptr ;
  990|  9.95M|	float			*floatptr ;
  991|  9.95M|	double			*doubleptr ;
  992|  9.95M|	char			c ;
  993|  9.95M|	int				byte_count = 0, count = 0 ;
  994|  9.95M|	int				read_bytes = 0 ;
  995|       |
  996|  9.95M|	if (! format)
  ------------------
  |  Branch (996:6): [True: 0, False: 9.95M]
  ------------------
  997|      0|		return psf_ftell (psf) ;
  998|       |
  999|  9.95M|	va_start (argptr, format) ;
 1000|       |
 1001|  31.5M|	while ((c = *format++))
  ------------------
  |  Branch (1001:9): [True: 21.7M, False: 9.79M]
  ------------------
 1002|  21.7M|	{
 1003|  21.7M|		read_bytes = 0 ;
 1004|  21.7M|		if (psf->header.indx + 16 >= psf->header.len && psf_bump_header_allocation (psf, 16))
  ------------------
  |  Branch (1004:7): [True: 163k, False: 21.5M]
  |  Branch (1004:51): [True: 159k, False: 4.18k]
  ------------------
 1005|   159k|			break ;
 1006|       |
 1007|  21.5M|		switch (c)
 1008|  21.5M|		{	case 'e' : /* All conversions are now from LE to host. */
  ------------------
  |  Branch (1008:5): [True: 990k, False: 20.5M]
  ------------------
 1009|   990k|					psf->rwf_endian = SF_ENDIAN_LITTLE ;
 1010|   990k|					break ;
 1011|       |
 1012|  3.17M|			case 'E' : /* All conversions are now from BE to host. */
  ------------------
  |  Branch (1012:4): [True: 3.17M, False: 18.3M]
  ------------------
 1013|  3.17M|					psf->rwf_endian = SF_ENDIAN_BIG ;
 1014|  3.17M|					break ;
 1015|       |
 1016|  4.04M|			case 'm' : /* 4 byte marker value eg 'RIFF' */
  ------------------
  |  Branch (1016:4): [True: 4.04M, False: 17.5M]
  ------------------
 1017|  4.04M|					intptr = va_arg (argptr, unsigned int*) ;
 1018|  4.04M|					*intptr = 0 ;
 1019|  4.04M|					ucptr = (unsigned char*) intptr ;
 1020|  4.04M|					read_bytes = header_read (psf, ucptr, sizeof (int)) ;
 1021|  4.04M|					*intptr = GET_MARKER (ucptr) ;
  ------------------
  |  |  833|  4.04M|#define	GET_MARKER(ptr)	(	((ptr) [0])			| ((ptr) [1] << 8) |	\
  |  |  834|  4.04M|							((ptr) [2] << 16)	| (((uint32_t) (ptr) [3]) << 24))
  ------------------
 1022|  4.04M|					break ;
 1023|       |
 1024|   135k|			case 'h' :
  ------------------
  |  Branch (1024:4): [True: 135k, False: 21.4M]
  ------------------
 1025|   135k|					intptr = va_arg (argptr, unsigned int*) ;
 1026|   135k|					*intptr = 0 ;
 1027|   135k|					ucptr = (unsigned char*) intptr ;
 1028|   135k|					read_bytes = header_read (psf, sixteen_bytes, sizeof (sixteen_bytes)) ;
 1029|   135k|					{	int k ;
 1030|   135k|						intdata = 0 ;
 1031|  2.31M|						for (k = 0 ; k < 16 ; k++)
  ------------------
  |  Branch (1031:20): [True: 2.17M, False: 135k]
  ------------------
 1032|  2.17M|							intdata ^= sixteen_bytes [k] << k ;
 1033|   135k|						}
 1034|   135k|					*intptr = intdata ;
 1035|   135k|					break ;
 1036|       |
 1037|   843k|			case '1' :
  ------------------
  |  Branch (1037:4): [True: 843k, False: 20.7M]
  ------------------
 1038|   843k|					charptr = va_arg (argptr, char*) ;
 1039|   843k|					*charptr = 0 ;
 1040|   843k|					read_bytes = header_read (psf, charptr, sizeof (char)) ;
 1041|   843k|					break ;
 1042|       |
 1043|  3.03M|			case '2' : /* 2 byte value with the current endian-ness */
  ------------------
  |  Branch (1043:4): [True: 3.03M, False: 18.5M]
  ------------------
 1044|  3.03M|					shortptr = va_arg (argptr, unsigned short*) ;
 1045|  3.03M|					*shortptr = 0 ;
 1046|  3.03M|					ucptr = (unsigned char*) shortptr ;
 1047|  3.03M|					read_bytes = header_read (psf, ucptr, sizeof (short)) ;
 1048|  3.03M|					if (psf->rwf_endian == SF_ENDIAN_BIG)
  ------------------
  |  Branch (1048:10): [True: 2.10M, False: 933k]
  ------------------
 1049|  2.10M|						*shortptr = GET_BE_SHORT (ucptr) ;
  ------------------
  |  |  841|  2.10M|#define	GET_BE_SHORT(ptr)	(((ptr) [0] << 8) | ((ptr) [1]))
  ------------------
 1050|   933k|					else
 1051|   933k|						*shortptr = GET_LE_SHORT (ucptr) ;
  ------------------
  |  |  840|   933k|#define	GET_LE_SHORT(ptr)	(((ptr) [1] << 8) | ((ptr) [0]))
  ------------------
 1052|  3.03M|					break ;
 1053|       |
 1054|  3.73k|			case '3' : /* 3 byte value with the current endian-ness */
  ------------------
  |  Branch (1054:4): [True: 3.73k, False: 21.5M]
  ------------------
 1055|  3.73k|					intptr = va_arg (argptr, unsigned int*) ;
 1056|  3.73k|					*intptr = 0 ;
 1057|  3.73k|					read_bytes = header_read (psf, sixteen_bytes, 3) ;
 1058|  3.73k|					if (psf->rwf_endian == SF_ENDIAN_BIG)
  ------------------
  |  Branch (1058:10): [True: 0, False: 3.73k]
  ------------------
 1059|      0|						*intptr = GET_BE_3BYTE (sixteen_bytes) ;
  ------------------
  |  |  844|      0|#define	GET_BE_3BYTE(ptr)	(	((ptr) [0] << 16) | ((ptr) [1] << 8) | ((ptr) [2]))
  ------------------
 1060|  3.73k|					else
 1061|  3.73k|						*intptr = GET_LE_3BYTE (sixteen_bytes) ;
  ------------------
  |  |  843|  3.73k|#define	GET_LE_3BYTE(ptr)	(	((ptr) [2] << 16) | ((ptr) [1] << 8) | ((ptr) [0]))
  ------------------
 1062|  3.73k|					break ;
 1063|       |
 1064|  5.85M|			case '4' : /* 4 byte value with the current endian-ness */
  ------------------
  |  Branch (1064:4): [True: 5.85M, False: 15.7M]
  ------------------
 1065|  5.85M|					intptr = va_arg (argptr, unsigned int*) ;
 1066|  5.85M|					*intptr = 0 ;
 1067|  5.85M|					ucptr = (unsigned char*) intptr ;
 1068|  5.85M|					read_bytes = header_read (psf, ucptr, sizeof (int)) ;
 1069|  5.85M|					if (psf->rwf_endian == SF_ENDIAN_BIG)
  ------------------
  |  Branch (1069:10): [True: 3.98M, False: 1.87M]
  ------------------
 1070|  3.98M|						*intptr = psf_get_be32 (ucptr, 0) ;
 1071|  1.87M|					else
 1072|  1.87M|						*intptr = psf_get_le32 (ucptr, 0) ;
 1073|  5.85M|					break ;
 1074|       |
 1075|   161k|			case '8' : /* 8 byte value with the current endian-ness */
  ------------------
  |  Branch (1075:4): [True: 161k, False: 21.4M]
  ------------------
 1076|   161k|					countptr = va_arg (argptr, sf_count_t *) ;
 1077|   161k|					*countptr = 0 ;
 1078|   161k|					read_bytes = header_read (psf, sixteen_bytes, 8) ;
 1079|   161k|					if (psf->rwf_endian == SF_ENDIAN_BIG)
  ------------------
  |  Branch (1079:10): [True: 22.9k, False: 138k]
  ------------------
 1080|  22.9k|						countdata = psf_get_be64 (sixteen_bytes, 0) ;
 1081|   138k|					else
 1082|   138k|						countdata = psf_get_le64 (sixteen_bytes, 0) ;
 1083|   161k|					*countptr = countdata ;
 1084|   161k|					break ;
 1085|       |
 1086|  31.4k|			case 'f' : /* Float conversion */
  ------------------
  |  Branch (1086:4): [True: 31.4k, False: 21.5M]
  ------------------
 1087|  31.4k|					floatptr = va_arg (argptr, float *) ;
 1088|  31.4k|					*floatptr = 0.0 ;
 1089|  31.4k|					read_bytes = header_read (psf, floatptr, sizeof (float)) ;
 1090|  31.4k|					if (psf->rwf_endian == SF_ENDIAN_BIG)
  ------------------
  |  Branch (1090:10): [True: 7.89k, False: 23.5k]
  ------------------
 1091|  7.89k|						*floatptr = float32_be_read ((unsigned char*) floatptr) ;
 1092|  23.5k|					else
 1093|  23.5k|						*floatptr = float32_le_read ((unsigned char*) floatptr) ;
 1094|  31.4k|					break ;
 1095|       |
 1096|    730|			case 'd' : /* double conversion */
  ------------------
  |  Branch (1096:4): [True: 730, False: 21.5M]
  ------------------
 1097|    730|					doubleptr = va_arg (argptr, double *) ;
 1098|    730|					*doubleptr = 0.0 ;
 1099|    730|					read_bytes = header_read (psf, doubleptr, sizeof (double)) ;
 1100|    730|					if (psf->rwf_endian == SF_ENDIAN_BIG)
  ------------------
  |  Branch (1100:10): [True: 140, False: 590]
  ------------------
 1101|    140|						*doubleptr = double64_be_read ((unsigned char*) doubleptr) ;
 1102|    590|					else
 1103|    590|						*doubleptr = double64_le_read ((unsigned char*) doubleptr) ;
 1104|    730|					break ;
 1105|       |
 1106|      0|			case 's' :
  ------------------
  |  Branch (1106:4): [True: 0, False: 21.5M]
  ------------------
 1107|      0|					psf_log_printf (psf, "Format conversion 's' not implemented yet.\n") ;
 1108|       |					/*
 1109|       |					strptr = va_arg (argptr, char *) ;
 1110|       |					size   = strlen (strptr) + 1 ;
 1111|       |					size  += (size & 1) ;
 1112|       |					longdata = H2LE_32 (size) ;
 1113|       |					get_int (psf, longdata) ;
 1114|       |					memcpy (&(psf->header.ptr [psf->header.indx]), strptr, size) ;
 1115|       |					psf->header.indx += size ;
 1116|       |					*/
 1117|      0|					break ;
 1118|       |
 1119|  1.14M|			case 'b' : /* Raw bytes */
  ------------------
  |  Branch (1119:4): [True: 1.14M, False: 20.4M]
  ------------------
 1120|  1.14M|					charptr = va_arg (argptr, char*) ;
 1121|  1.14M|					count = va_arg (argptr, size_t) ;
 1122|  1.14M|					memset (charptr, 0, count) ;
 1123|  1.14M|					read_bytes = header_read (psf, charptr, count) ;
 1124|  1.14M|					break ;
 1125|       |
 1126|    146|			case 'G' :
  ------------------
  |  Branch (1126:4): [True: 146, False: 21.5M]
  ------------------
 1127|    146|					charptr = va_arg (argptr, char*) ;
 1128|    146|					count = va_arg (argptr, size_t) ;
 1129|    146|					memset (charptr, 0, count) ;
 1130|       |
 1131|    146|					if (psf->header.indx + count >= psf->header.len && psf_bump_header_allocation (psf, count))
  ------------------
  |  Branch (1131:10): [True: 0, False: 146]
  |  Branch (1131:57): [True: 0, False: 0]
  ------------------
 1132|      0|						break ;
 1133|       |
 1134|    146|					read_bytes = header_gets (psf, charptr, count) ;
 1135|    146|					break ;
 1136|       |
 1137|      0|			case 'z' :
  ------------------
  |  Branch (1137:4): [True: 0, False: 21.5M]
  ------------------
 1138|      0|					psf_log_printf (psf, "Format conversion 'z' not implemented yet.\n") ;
 1139|       |					/*
 1140|       |					size    = va_arg (argptr, size_t) ;
 1141|       |					while (size)
 1142|       |					{	psf->header.ptr [psf->header.indx] = 0 ;
 1143|       |						psf->header.indx ++ ;
 1144|       |						size -- ;
 1145|       |						} ;
 1146|       |					*/
 1147|      0|					break ;
 1148|       |
 1149|  23.3k|			case 'p' :	/* Seek to position from start. */
  ------------------
  |  Branch (1149:4): [True: 23.3k, False: 21.5M]
  ------------------
 1150|  23.3k|					count = va_arg (argptr, size_t) ;
 1151|  23.3k|					header_seek (psf, count, SEEK_SET) ;
 1152|  23.3k|					byte_count = count ;
 1153|  23.3k|					break ;
 1154|       |
 1155|  2.10M|			case 'j' :	/* Seek to position from current position. */
  ------------------
  |  Branch (1155:4): [True: 2.10M, False: 19.4M]
  ------------------
 1156|  2.10M|					count = va_arg (argptr, size_t) ;
 1157|  2.10M|					header_seek (psf, count, SEEK_CUR) ;
 1158|  2.10M|					read_bytes = count ;
 1159|  2.10M|					break ;
 1160|       |
 1161|  2.50k|			case '!' : /* Clear buffer, forcing re-read. */
  ------------------
  |  Branch (1161:4): [True: 2.50k, False: 21.5M]
  ------------------
 1162|  2.50k|					psf->header.end = psf->header.indx = 0 ;
 1163|  2.50k|					break ;
 1164|       |
 1165|      0|			default :
  ------------------
  |  Branch (1165:4): [True: 0, False: 21.5M]
  ------------------
 1166|      0|				psf_log_printf (psf, "*** Invalid format specifier `%c'\n", c) ;
 1167|      0|				psf->error = SFE_INTERNAL ;
 1168|      0|				break ;
 1169|  21.5M|			} ;
 1170|       |
 1171|  21.5M|		if (read_bytes > 0 && byte_count > (INT_MAX - read_bytes))
  ------------------
  |  Branch (1171:7): [True: 12.4M, False: 9.10M]
  |  Branch (1171:25): [True: 1, False: 12.4M]
  ------------------
 1172|      1|		{	psf_log_printf (psf, "Header size exceeds INT_MAX. Aborting.", c) ;
 1173|      1|			psf->error = SFE_INTERNAL ;
 1174|      1|			break ;
 1175|      1|		} else
 1176|  21.5M|		{	byte_count += read_bytes ;
 1177|  21.5M|		} ;
 1178|       |
 1179|  21.5M|		} ;	/*end while*/
 1180|       |
 1181|  9.95M|	va_end (argptr) ;
 1182|       |
 1183|  9.95M|	return byte_count ;
 1184|  9.95M|} /* psf_binheader_readf */
psf_log_SF_INFO:
 1249|  1.33k|{	psf_log_printf (psf, "---------------------------------\n") ;
 1250|       |
 1251|  1.33k|	psf_log_printf (psf, " Sample rate :   %d\n", psf->sf.samplerate) ;
 1252|  1.33k|	if (psf->sf.frames == SF_COUNT_MAX)
  ------------------
  |  |  370|  1.33k|#define SF_COUNT_MAX	INT64_MAX
  ------------------
  |  Branch (1252:6): [True: 1, False: 1.33k]
  ------------------
 1253|      1|		psf_log_printf (psf, " Frames      :   unknown\n") ;
 1254|  1.33k|	else
 1255|  1.33k|		psf_log_printf (psf, " Frames      :   %D\n", psf->sf.frames) ;
 1256|  1.33k|	psf_log_printf (psf, " Channels    :   %d\n", psf->sf.channels) ;
 1257|       |
 1258|  1.33k|	psf_log_printf (psf, " Format      :   0x%X\n", psf->sf.format) ;
 1259|  1.33k|	psf_log_printf (psf, " Sections    :   %d\n", psf->sf.sections) ;
 1260|  1.33k|	psf_log_printf (psf, " Seekable    :   %s\n", psf->sf.seekable ? "TRUE" : "FALSE") ;
  ------------------
  |  Branch (1260:48): [True: 1.13k, False: 198]
  ------------------
 1261|       |
 1262|  1.33k|	psf_log_printf (psf, "---------------------------------\n") ;
 1263|  1.33k|} /* psf_dump_SFINFO */
psf_isprint:
 1270|  17.2M|{	return (ch >= ' ' && ch <= '~') ;
  ------------------
  |  Branch (1270:11): [True: 15.8M, False: 1.42M]
  |  Branch (1270:24): [True: 15.7M, False: 15.6k]
  ------------------
 1271|  17.2M|} /* psf_isprint */
psf_strlcpy:
 1281|  34.0k|{	strncpy (dest, src, n - 1) ;
 1282|  34.0k|	dest [n - 1] = 0 ;
 1283|  34.0k|} /* psf_strlcpy */
psf_memset:
 1301|  1.95k|{	char	*ptr ;
 1302|  1.95k|	int 	setcount ;
 1303|       |
 1304|  1.95k|	ptr = (char *) s ;
 1305|       |
 1306|  3.91k|	while (len > 0)
  ------------------
  |  Branch (1306:9): [True: 1.95k, False: 1.95k]
  ------------------
 1307|  1.95k|	{	setcount = (len > 0x10000000) ? 0x10000000 : (int) len ;
  ------------------
  |  Branch (1307:15): [True: 0, False: 1.95k]
  ------------------
 1308|       |
 1309|  1.95k|		memset (ptr, c, setcount) ;
 1310|       |
 1311|  1.95k|		ptr += setcount ;
 1312|  1.95k|		len -= setcount ;
 1313|  1.95k|		} ;
 1314|       |
 1315|  1.95k|	return s ;
 1316|  1.95k|} /* psf_memset */
psf_cues_alloc:
 1338|  1.50k|{	SF_CUES *pcues = calloc (1, SF_CUES_VAR_SIZE (cue_count)) ;
  ------------------
  |  | 1331|  1.50k|#define SF_CUES_VAR_SIZE(count)	(sizeof (SF_CUES_0) + count * sizeof (SF_CUE_POINT))
  ------------------
 1339|  1.50k|	if (pcues)
  ------------------
  |  Branch (1339:6): [True: 1.50k, False: 0]
  ------------------
 1340|  1.50k|	{	pcues->cue_count = cue_count ;
 1341|  1.50k|		} ;
 1342|  1.50k|	return pcues ;
 1343|  1.50k|} /* psf_cues_alloc */
psf_instrument_alloc:
 1376|  1.22k|{	SF_INSTRUMENT *instr ;
 1377|       |
 1378|  1.22k|	instr = calloc (1, sizeof (SF_INSTRUMENT)) ;
 1379|       |
 1380|  1.22k|	if (instr == NULL)
  ------------------
  |  Branch (1380:6): [True: 0, False: 1.22k]
  ------------------
 1381|      0|		return NULL ;
 1382|       |
 1383|       |	/* Set non-zero default values. */
 1384|  1.22k|	instr->basenote = -1 ;
 1385|  1.22k|	instr->velocity_lo = -1 ;
 1386|  1.22k|	instr->velocity_hi = -1 ;
 1387|  1.22k|	instr->key_lo = -1 ;
 1388|  1.22k|	instr->key_hi = -1 ;
 1389|       |
 1390|  1.22k|	return instr ;
 1391|  1.22k|} /* psf_instrument_alloc */
psf_sanitize_string:
 1395|    131|{
 1396|    131|	do
 1397|  92.8k|	{
 1398|  92.8k|		len -- ;
 1399|  92.8k|		cptr [len] = psf_isprint (cptr [len]) ? cptr [len] : '.' ;
  ------------------
  |  Branch (1399:16): [True: 7.21k, False: 85.5k]
  ------------------
 1400|  92.8k|	}
 1401|  92.8k|	while (len > 0) ;
  ------------------
  |  Branch (1401:9): [True: 92.6k, False: 131]
  ------------------
 1402|    131|} /* psf_sanitize_string */
s_bitwidth_to_subformat:
 1455|  8.06k|{	static int array [] =
 1456|  8.06k|	{	SF_FORMAT_PCM_S8, SF_FORMAT_PCM_16, SF_FORMAT_PCM_24, SF_FORMAT_PCM_32
 1457|  8.06k|		} ;
 1458|       |
 1459|  8.06k|	if (bits < 8 || bits > 32)
  ------------------
  |  Branch (1459:6): [True: 1.30k, False: 6.76k]
  |  Branch (1459:18): [True: 4.31k, False: 2.44k]
  ------------------
 1460|  5.61k|		return 0 ;
 1461|       |
 1462|  2.44k|	return array [((bits + 7) / 8) - 1] ;
 1463|  8.06k|} /* bitwidth_to_subformat */
u_bitwidth_to_subformat:
 1467|  13.7k|{	static int array [] =
 1468|  13.7k|	{	SF_FORMAT_PCM_U8, SF_FORMAT_PCM_16, SF_FORMAT_PCM_24, SF_FORMAT_PCM_32
 1469|  13.7k|		} ;
 1470|       |
 1471|  13.7k|	if (bits < 8 || bits > 32)
  ------------------
  |  Branch (1471:6): [True: 4.68k, False: 9.09k]
  |  Branch (1471:18): [True: 5.07k, False: 4.02k]
  ------------------
 1472|  9.75k|		return 0 ;
 1473|       |
 1474|  4.02k|	return array [((bits + 7) / 8) - 1] ;
 1475|  13.7k|} /* bitwidth_to_subformat */
psf_rand_int32:
 1485|  19.8k|{	static uint64_t value = 0 ;
 1486|  19.8k|	int k, count ;
 1487|       |
 1488|  19.8k|	if (value == 0)
  ------------------
  |  Branch (1488:6): [True: 1, False: 19.8k]
  ------------------
 1489|      1|	{
 1490|      1|#if HAVE_GETTIMEOFDAY
 1491|      1|		struct timeval tv ;
 1492|      1|		gettimeofday (&tv, NULL) ;
 1493|      1|		value = tv.tv_sec + tv.tv_usec ;
 1494|       |#else
 1495|       |		value = time (NULL) ;
 1496|       |#endif
 1497|      1|		} ;
 1498|       |
 1499|  19.8k|	count = 4 + (value & 7) ;
 1500|   178k|	for (k = 0 ; k < count ; k++)
  ------------------
  |  Branch (1500:15): [True: 158k, False: 19.8k]
  ------------------
 1501|   158k|		value = (11117 * value + 211231) & 0x7fffffff ;
 1502|       |
 1503|  19.8k|	return (int32_t) value ;
 1504|  19.8k|} /* psf_rand_int32 */
append_snprintf:
 1508|   139k|{	size_t len = strlen (dest) ;
 1509|       |
 1510|   139k|	if (len < maxlen)
  ------------------
  |  Branch (1510:6): [True: 139k, False: 0]
  ------------------
 1511|   139k|	{	va_list ap ;
 1512|       |
 1513|   139k|		va_start (ap, fmt) ;
 1514|   139k|		vsnprintf (dest + len, maxlen - len, fmt, ap) ;
 1515|   139k|		va_end (ap) ;
 1516|   139k|		} ;
 1517|       |
 1518|   139k|	return ;
 1519|   139k|} /* append_snprintf */
psf_decode_frame_count:
 1559|    231|{	sf_count_t count, readlen, total = 0 ;
 1560|    231|	BUF_UNION	ubuf ;
 1561|       |
 1562|       |	/* If we're reading from a pipe or the file is too long, just return SF_COUNT_MAX. */
 1563|    231|	if (psf_is_pipe (psf) || psf->datalength > 0x1000000)
  ------------------
  |  Branch (1563:6): [True: 0, False: 231]
  |  Branch (1563:27): [True: 0, False: 231]
  ------------------
 1564|      0|		return SF_COUNT_MAX ;
  ------------------
  |  |  370|      0|#define SF_COUNT_MAX	INT64_MAX
  ------------------
 1565|       |
 1566|    231|	psf_fseek (psf, psf->dataoffset, SEEK_SET) ;
 1567|       |
 1568|    231|	readlen = ARRAY_LEN (ubuf.ibuf) / psf->sf.channels ;
  ------------------
  |  |   93|    231|#define		ARRAY_LEN(x)	((int) (sizeof (x) / sizeof ((x) [0])))
  ------------------
 1569|    231|	readlen *= psf->sf.channels ;
 1570|       |
 1571|  8.76k|	while ((count = psf->read_int (psf, ubuf.ibuf, readlen)) > 0)
  ------------------
  |  Branch (1571:9): [True: 8.53k, False: 231]
  ------------------
 1572|  8.53k|		total += count ;
 1573|       |
 1574|    231|	psf_fseek (psf, psf->dataoffset, SEEK_SET) ;
 1575|       |
 1576|    231|	return total / psf->sf.channels ;
 1577|    231|} /* psf_decode_frame_count */
common.c:log_putchar:
   97|   701M|{	if (psf->parselog.indx < SIGNED_SIZEOF (psf->parselog.buf) - 1)
  ------------------
  |  |   91|   701M|#define		SIGNED_SIZEOF(x)	((int) sizeof (x))
  ------------------
  |  Branch (97:7): [True: 10.2M, False: 691M]
  ------------------
   98|  10.2M|	{	psf->parselog.buf [psf->parselog.indx++] = ch ;
   99|  10.2M|		psf->parselog.buf [psf->parselog.indx] = 0 ;
  100|  10.2M|		} ;
  101|   701M|	return ;
  102|   701M|} /* log_putchar */
common.c:psf_bump_header_allocation:
   60|   173k|{
   61|   173k|	sf_count_t newlen, smallest = INITIAL_HEADER_SIZE ;
  ------------------
  |  |   39|   173k|#define	INITIAL_HEADER_SIZE	256
  ------------------
   62|   173k|	void * ptr ;
   63|       |
   64|   173k|	newlen = (needed > psf->header.len) ? 2 * SF_MAX (needed, smallest) : 2 * psf->header.len ;
  ------------------
  |  |   95|  3.63k|#define		SF_MAX(a, b)	((a) > (b) ? (a) : (b))
  |  |  ------------------
  |  |  |  Branch (95:24): [True: 3.63k, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (64:11): [True: 3.63k, False: 169k]
  ------------------
   65|       |
   66|   173k|	if (newlen > 100 * 1024)
  ------------------
  |  Branch (66:6): [True: 165k, False: 7.37k]
  ------------------
   67|   165k|	{	psf_log_printf (psf, "Request for header allocation of %D denied.\n", newlen) ;
   68|   165k|		return 1 ;
   69|   165k|		}
   70|       |
   71|  7.37k|	if ((ptr = realloc (psf->header.ptr, newlen)) == NULL)
  ------------------
  |  Branch (71:6): [True: 0, False: 7.37k]
  ------------------
   72|      0|	{	psf_log_printf (psf, "realloc (%p, %D) failed\n", psf->header.ptr, newlen) ;
   73|      0|		psf->error = SFE_MALLOC_FAILED ;
   74|      0|		return 1 ;
   75|  7.37k|		} ;
   76|       |
   77|       |	/* Always zero-out new header memory to avoid un-initializer memory accesses. */
   78|  7.37k|	if (newlen > psf->header.len)
  ------------------
  |  Branch (78:6): [True: 7.37k, False: 0]
  ------------------
   79|  7.37k|		memset ((char *) ptr + psf->header.len, 0, newlen - psf->header.len) ;
   80|       |
   81|  7.37k|	psf->header.ptr = ptr ;
   82|  7.37k|	psf->header.len = newlen ;
   83|  7.37k|	return 0 ;
   84|  7.37k|} /* psf_bump_header_allocation */
common.c:header_read:
  866|  15.2M|{	int count = 0 ;
  867|       |
  868|  15.2M|	if (psf->header.indx + bytes >= psf->header.len && psf_bump_header_allocation (psf, bytes))
  ------------------
  |  Branch (868:6): [True: 2.66k, False: 15.2M]
  |  Branch (868:53): [True: 1.40k, False: 1.25k]
  ------------------
  869|  1.40k|		return count ;
  870|       |
  871|  15.2M|	if (psf->header.indx + bytes > psf->header.end)
  ------------------
  |  Branch (871:6): [True: 7.67M, False: 7.59M]
  ------------------
  872|  7.67M|	{	count = psf_fread (psf->header.ptr + psf->header.end, 1, bytes - (psf->header.end - psf->header.indx), psf) ;
  873|  7.67M|		if (count != bytes - (int) (psf->header.end - psf->header.indx))
  ------------------
  |  Branch (873:7): [True: 2.95M, False: 4.72M]
  ------------------
  874|  2.95M|		{	psf_log_printf (psf, "Error : psf_fread returned short count.\n") ;
  875|  2.95M|			return count ;
  876|  4.72M|			} ;
  877|  4.72M|		psf->header.end += count ;
  878|  12.3M|		} ;
  879|       |
  880|  12.3M|	memcpy (ptr, psf->header.ptr + psf->header.indx, bytes) ;
  881|  12.3M|	psf->header.indx += bytes ;
  882|       |
  883|  12.3M|	return bytes ;
  884|  15.2M|} /* header_read */
common.c:header_gets:
  957|    146|{	int		k ;
  958|       |
  959|    146|	if (psf->header.indx + bufsize >= psf->header.len && psf_bump_header_allocation (psf, bufsize))
  ------------------
  |  Branch (959:6): [True: 0, False: 146]
  |  Branch (959:55): [True: 0, False: 0]
  ------------------
  960|      0|		return 0 ;
  961|       |
  962|  3.35k|	for (k = 0 ; k < bufsize - 1 ; k++)
  ------------------
  |  Branch (962:15): [True: 3.26k, False: 92]
  ------------------
  963|  3.26k|	{	if (psf->header.indx < psf->header.end)
  ------------------
  |  Branch (963:8): [True: 1.00k, False: 2.26k]
  ------------------
  964|  1.00k|		{	ptr [k] = psf->header.ptr [psf->header.indx] ;
  965|  1.00k|			psf->header.indx ++ ;
  966|  1.00k|			}
  967|  2.26k|		else
  968|  2.26k|		{	psf->header.end += psf_fread (psf->header.ptr + psf->header.end, 1, 1, psf) ;
  969|  2.26k|			ptr [k] = psf->header.ptr [psf->header.indx] ;
  970|  2.26k|			psf->header.indx = psf->header.end ;
  971|  2.26k|			} ;
  972|       |
  973|  3.26k|		if (ptr [k] == '\n')
  ------------------
  |  Branch (973:7): [True: 54, False: 3.21k]
  ------------------
  974|     54|			break ;
  975|  3.26k|		} ;
  976|       |
  977|    146|	ptr [k] = 0 ;
  978|       |
  979|    146|	return k ;
  980|    146|} /* header_gets */
common.c:header_seek:
  888|  2.13M|{
  889|  2.13M|	switch (whence)
  890|  2.13M|	{	case SEEK_SET :
  ------------------
  |  Branch (890:4): [True: 23.3k, False: 2.10M]
  ------------------
  891|  23.3k|			if (psf->header.indx + position >= psf->header.len)
  ------------------
  |  Branch (891:8): [True: 279, False: 23.0k]
  ------------------
  892|    279|				psf_bump_header_allocation (psf, position) ;
  893|  23.3k|			if (position > psf->header.len)
  ------------------
  |  Branch (893:8): [True: 5, False: 23.3k]
  ------------------
  894|      5|			{	/* Too much header to cache so just seek instead. */
  895|      5|				psf->header.indx = psf->header.end = 0 ;
  896|      5|				psf_fseek (psf, position, whence) ;
  897|      5|				return ;
  898|  23.3k|				} ;
  899|  23.3k|			if (position > psf->header.end)
  ------------------
  |  Branch (899:8): [True: 990, False: 22.3k]
  ------------------
  900|    990|				psf->header.end += psf_fread (psf->header.ptr + psf->header.end, 1, position - psf->header.end, psf) ;
  901|  23.3k|			psf->header.indx = position ;
  902|  23.3k|			break ;
  903|       |
  904|  2.10M|		case SEEK_CUR :
  ------------------
  |  Branch (904:3): [True: 2.10M, False: 23.3k]
  ------------------
  905|  2.10M|			if (psf->header.indx + position >= psf->header.len)
  ------------------
  |  Branch (905:8): [True: 6.83k, False: 2.10M]
  ------------------
  906|  6.83k|				psf_bump_header_allocation (psf, position) ;
  907|       |
  908|  2.10M|			if (psf->header.indx + position < 0)
  ------------------
  |  Branch (908:8): [True: 273k, False: 1.83M]
  ------------------
  909|   273k|				break ;
  910|       |
  911|  1.83M|			if (psf->header.indx >= psf->header.len)
  ------------------
  |  Branch (911:8): [True: 0, False: 1.83M]
  ------------------
  912|      0|			{	psf_fseek (psf, position, whence) ;
  913|      0|				return ;
  914|  1.83M|				} ;
  915|       |
  916|  1.83M|			if (psf->header.indx + position <= psf->header.end)
  ------------------
  |  Branch (916:8): [True: 1.39M, False: 443k]
  ------------------
  917|  1.39M|			{	psf->header.indx += position ;
  918|  1.39M|				break ;
  919|  1.39M|				} ;
  920|       |
  921|   443k|			if (psf->header.indx + position > psf->header.len)
  ------------------
  |  Branch (921:8): [True: 5.17k, False: 438k]
  ------------------
  922|  5.17k|			{	/* Need to jump this without caching it. */
  923|  5.17k|				position -= (psf->header.end - psf->header.indx) ;
  924|  5.17k|				psf->header.indx = psf->header.end ;
  925|  5.17k|				if (psf->is_pipe)
  ------------------
  |  Branch (925:9): [True: 0, False: 5.17k]
  ------------------
  926|      0|				{
  927|       |					/* seeking is not supported on pipe input, so we read instead */
  928|      0|					size_t skip = position ;
  929|      0|					while (skip)
  ------------------
  |  Branch (929:13): [True: 0, False: 0]
  ------------------
  930|      0|					{	char junk [16 * 1024] ;
  931|      0|						size_t to_skip = SF_MIN (skip, sizeof (junk)) ;
  ------------------
  |  |   96|      0|#define		SF_MIN(a, b)	((a) < (b) ? (a) : (b))
  |  |  ------------------
  |  |  |  Branch (96:24): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  932|      0|						psf_fread (junk, 1, to_skip, psf) ;
  933|      0|						skip -= to_skip ;
  934|      0|						}
  935|      0|					}
  936|  5.17k|				else
  937|  5.17k|				{	psf_fseek (psf, position, SEEK_CUR) ;
  938|  5.17k|					}
  939|  5.17k|				break ;
  940|   438k|				} ;
  941|       |
  942|   438k|			psf->header.end += psf_fread (psf->header.ptr + psf->header.end, 1, position - (psf->header.end - psf->header.indx), psf) ;
  943|   438k|			psf->header.indx = psf->header.end ;
  944|   438k|			break ;
  945|       |
  946|      0|		case SEEK_END :
  ------------------
  |  Branch (946:3): [True: 0, False: 2.13M]
  ------------------
  947|      0|		default :
  ------------------
  |  Branch (947:3): [True: 0, False: 2.13M]
  ------------------
  948|      0|			psf_log_printf (psf, "Bad whence param in header_seek().\n") ;
  949|      0|			break ;
  950|  2.13M|		} ;
  951|       |
  952|  2.13M|	return ;
  953|  2.13M|} /* header_seek */

aiff.c:peak_info_calloc:
  233|  5.07k|{	return calloc (1, sizeof (PEAK_INFO) + channels * sizeof (PEAK_POS)) ;
  234|  5.07k|} /* peak_info_calloc */
aiff.c:make_size_t:
  279|  2.95k|{	return (size_t) x ;
  280|  2.95k|} /* make_size_t */
avr.c:arith_shift_left:
 1086|     91|{	return (int32_t) (((uint32_t) x) << shift) ;
 1087|     91|} /* arith_shift_left */
caf.c:peak_info_calloc:
  233|    347|{	return calloc (1, sizeof (PEAK_INFO) + channels * sizeof (PEAK_POS)) ;
  234|    347|} /* peak_info_calloc */
caf.c:psf_lrint:
  974|  2.44k|{
  975|  2.44k|	#ifdef USE_SSE2
  976|  2.44k|		return _mm_cvtsd_si32 (_mm_load_sd (&x)) ;
  977|       |	#else
  978|       |		return lrint (x) ;
  979|       |	#endif
  980|  2.44k|} /* psf_lrintf */
ircam.c:psf_lrintf:
  965|    381|{
  966|    381|	#ifdef USE_SSE2
  967|    381|		return _mm_cvtss_si32 (_mm_load_ss (&x)) ;
  968|       |	#else
  969|       |		return lrintf (x) ;
  970|       |	#endif
  971|    381|} /* psf_lrintf */
mat4.c:psf_lrint:
  974|    729|{
  975|    729|	#ifdef USE_SSE2
  976|    729|		return _mm_cvtsd_si32 (_mm_load_sd (&x)) ;
  977|       |	#else
  978|       |		return lrint (x) ;
  979|       |	#endif
  980|    729|} /* psf_lrintf */
mat5.c:psf_lrint:
  974|      1|{
  975|      1|	#ifdef USE_SSE2
  976|      1|		return _mm_cvtsd_si32 (_mm_load_sd (&x)) ;
  977|       |	#else
  978|       |		return lrint (x) ;
  979|       |	#endif
  980|      1|} /* psf_lrintf */
sds.c:arith_shift_left:
 1086|   134M|{	return (int32_t) (((uint32_t) x) << shift) ;
 1087|   134M|} /* arith_shift_left */
wavlike.c:make_size_t:
  279|  2.04k|{	return (size_t) x ;
  280|  2.04k|} /* make_size_t */
wavlike.c:peak_info_calloc:
  233|  7.81k|{	return calloc (1, sizeof (PEAK_INFO) + channels * sizeof (PEAK_POS)) ;
  234|  7.81k|} /* peak_info_calloc */
xi.c:arith_shift_left:
 1086|    196|{	return (int32_t) (((uint32_t) x) << shift) ;
 1087|    196|} /* arith_shift_left */
mpc2k.c:make_size_t:
  279|     15|{	return (size_t) x ;
  280|     15|} /* make_size_t */
dwvw.c:arith_shift_left:
 1086|  26.6M|{	return (int32_t) (((uint32_t) x) << shift) ;
 1087|  26.6M|} /* arith_shift_left */

double64_init:
   92|    311|{	static int double64_caps ;
   93|       |
   94|    311|	if (psf->sf.channels < 1 || psf->sf.channels > SF_MAX_CHANNELS)
  ------------------
  |  |  102|    246|#define		SF_MAX_CHANNELS		1024
  ------------------
  |  Branch (94:6): [True: 65, False: 246]
  |  Branch (94:30): [True: 3, False: 243]
  ------------------
   95|     68|	{	psf_log_printf (psf, "double64_init : internal error : channels = %d\n", psf->sf.channels) ;
   96|     68|		return SFE_INTERNAL ;
   97|    243|		} ;
   98|       |
   99|    243|	double64_caps = double64_get_capability (psf) ;
  100|       |
  101|    243|	psf->blockwidth = sizeof (double) * psf->sf.channels ;
  102|       |
  103|    243|	if (psf->file.mode == SFM_READ || psf->file.mode == SFM_RDWR)
  ------------------
  |  Branch (103:6): [True: 243, False: 0]
  |  Branch (103:36): [True: 0, False: 0]
  ------------------
  104|    243|	{	switch (psf->endian + double64_caps)
  105|    243|		{	case (SF_ENDIAN_BIG + DOUBLE_CAN_RW_BE) :
  ------------------
  |  Branch (105:5): [True: 0, False: 243]
  ------------------
  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|    133|			case (SF_ENDIAN_LITTLE + DOUBLE_CAN_RW_LE) :
  ------------------
  |  Branch (113:4): [True: 133, False: 110]
  ------------------
  114|    133|					psf->data_endswap = SF_FALSE ;
  115|    133|					psf->read_short		= host_read_d2s ;
  116|    133|					psf->read_int		= host_read_d2i ;
  117|    133|					psf->read_float		= host_read_d2f ;
  118|    133|					psf->read_double	= host_read_d ;
  119|    133|					break ;
  120|       |
  121|    110|			case (SF_ENDIAN_BIG + DOUBLE_CAN_RW_LE) :
  ------------------
  |  Branch (121:4): [True: 110, False: 133]
  ------------------
  122|    110|					psf->data_endswap = SF_TRUE ;
  123|    110|					psf->read_short		= host_read_d2s ;
  124|    110|					psf->read_int		= host_read_d2i ;
  125|    110|					psf->read_float		= host_read_d2f ;
  126|    110|					psf->read_double	= host_read_d ;
  127|    110|					break ;
  128|       |
  129|      0|			case (SF_ENDIAN_LITTLE + DOUBLE_CAN_RW_BE) :
  ------------------
  |  Branch (129:4): [True: 0, False: 243]
  ------------------
  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: 243]
  ------------------
  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: 243]
  ------------------
  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: 243]
  ------------------
  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: 243]
  ------------------
  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: 243]
  ------------------
  171|    243|			} ;
  172|    243|		} ;
  173|       |
  174|    243|	if (psf->file.mode == SFM_WRITE || psf->file.mode == SFM_RDWR)
  ------------------
  |  Branch (174:6): [True: 0, False: 243]
  |  Branch (174:37): [True: 0, False: 243]
  ------------------
  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|    243|		} ;
  244|       |
  245|    243|	if (psf->filelength > psf->dataoffset)
  ------------------
  |  Branch (245:6): [True: 177, False: 66]
  ------------------
  246|    177|	{	psf->datalength = (psf->dataend > 0) ? psf->dataend - psf->dataoffset :
  ------------------
  |  Branch (246:22): [True: 1, False: 176]
  ------------------
  247|    177|							psf->filelength - psf->dataoffset ;
  248|    177|		}
  249|     66|	else
  250|     66|		psf->datalength = 0 ;
  251|       |
  252|    243|	psf->sf.frames = psf->datalength / psf->blockwidth ;
  253|       |
  254|    243|	return 0 ;
  255|    243|} /* double64_init */
double64_be_read:
  285|  2.66k|{	int		exponent, negative, upper, lower ;
  286|  2.66k|	double	dvalue ;
  287|       |
  288|  2.66k|	negative = (cptr [0] & 0x80) ? 1 : 0 ;
  ------------------
  |  Branch (288:13): [True: 312, False: 2.35k]
  ------------------
  289|  2.66k|	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.66k|	upper = (((cptr [1] & 0xF) << 24) | (cptr [2] << 16) | (cptr [3] << 8) | cptr [4]) ;
  293|  2.66k|	lower = (cptr [5] << 16) | (cptr [6] << 8) | cptr [7] ;
  294|       |
  295|  2.66k|	if (exponent == 0 && upper == 0 && lower == 0)
  ------------------
  |  Branch (295:6): [True: 436, False: 2.23k]
  |  Branch (295:23): [True: 231, False: 205]
  |  Branch (295:37): [True: 198, False: 33]
  ------------------
  296|    198|		return 0.0 ;
  297|       |
  298|  2.46k|	dvalue = upper + lower / ((double) 0x1000000) ;
  299|  2.46k|	dvalue += 0x10000000 ;
  300|       |
  301|  2.46k|	exponent = exponent - 0x3FF ;
  302|       |
  303|  2.46k|	dvalue = dvalue / ((double) 0x10000000) ;
  304|       |
  305|  2.46k|	if (negative)
  ------------------
  |  Branch (305:6): [True: 312, False: 2.15k]
  ------------------
  306|    312|		dvalue *= -1 ;
  307|       |
  308|  2.46k|	if (exponent > 0)
  ------------------
  |  Branch (308:6): [True: 1.58k, False: 887]
  ------------------
  309|  1.58k|		dvalue *= pow (2.0, exponent) ;
  310|    887|	else if (exponent < 0)
  ------------------
  |  Branch (310:11): [True: 820, False: 67]
  ------------------
  311|    820|		dvalue /= pow (2.0, abs (exponent)) ;
  312|       |
  313|  2.46k|	return dvalue ;
  314|  2.66k|} /* double64_be_read */
double64_le_read:
  318|    590|{	int		exponent, negative, upper, lower ;
  319|    590|	double	dvalue ;
  320|       |
  321|    590|	negative = (cptr [7] & 0x80) ? 1 : 0 ;
  ------------------
  |  Branch (321:13): [True: 143, False: 447]
  ------------------
  322|    590|	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|    590|	upper = ((cptr [6] & 0xF) << 24) | (cptr [5] << 16) | (cptr [4] << 8) | cptr [3] ;
  326|    590|	lower = (cptr [2] << 16) | (cptr [1] << 8) | cptr [0] ;
  327|       |
  328|    590|	if (exponent == 0 && upper == 0 && lower == 0)
  ------------------
  |  Branch (328:6): [True: 236, False: 354]
  |  Branch (328:23): [True: 110, False: 126]
  |  Branch (328:37): [True: 66, False: 44]
  ------------------
  329|     66|		return 0.0 ;
  330|       |
  331|    524|	dvalue = upper + lower / ((double) 0x1000000) ;
  332|    524|	dvalue += 0x10000000 ;
  333|       |
  334|    524|	exponent = exponent - 0x3FF ;
  335|       |
  336|    524|	dvalue = dvalue / ((double) 0x10000000) ;
  337|       |
  338|    524|	if (negative)
  ------------------
  |  Branch (338:6): [True: 143, False: 381]
  ------------------
  339|    143|		dvalue *= -1 ;
  340|       |
  341|    524|	if (exponent > 0)
  ------------------
  |  Branch (341:6): [True: 158, False: 366]
  ------------------
  342|    158|		dvalue *= pow (2.0, exponent) ;
  343|    366|	else if (exponent < 0)
  ------------------
  |  Branch (343:11): [True: 363, False: 3]
  ------------------
  344|    363|		dvalue /= pow (2.0, abs (exponent)) ;
  345|       |
  346|    524|	return dvalue ;
  347|    590|} /* double64_le_read */
double64.c:double64_get_capability:
  459|    243|{	union
  460|    243|	{	double			d ;
  461|    243|		unsigned char	c [8] ;
  462|    243|	} data ;
  463|       |
  464|    243|	data.d = 1.234567890123456789 ; /* Some arbitrary value. */
  465|       |
  466|    243|	if (! psf->ieee_replace)
  ------------------
  |  Branch (466:6): [True: 243, False: 0]
  ------------------
  467|    243|	{	/* If this test is true ints and floats are compatible and little endian. */
  468|    243|		if (data.c [0] == 0xfb && data.c [1] == 0x59 && data.c [2] == 0x8c && data.c [3] == 0x42 &&
  ------------------
  |  Branch (468:7): [True: 243, False: 0]
  |  Branch (468:29): [True: 243, False: 0]
  |  Branch (468:51): [True: 243, False: 0]
  |  Branch (468:73): [True: 243, False: 0]
  ------------------
  469|    243|			data.c [4] == 0xca && data.c [5] == 0xc0 && data.c [6] == 0xf3 && data.c [7] == 0x3f)
  ------------------
  |  Branch (469:4): [True: 243, False: 0]
  |  Branch (469:26): [True: 243, False: 0]
  |  Branch (469:48): [True: 243, False: 0]
  |  Branch (469:70): [True: 243, False: 0]
  ------------------
  470|    243|			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|    243|} /* double64_get_capability */
double64.c:host_read_d2f:
  622|    748|{	BUF_UNION	ubuf ;
  623|    748|	int			bufferlen, readcount ;
  624|    748|	sf_count_t	total = 0 ;
  625|       |
  626|    748|	bufferlen = ARRAY_LEN (ubuf.dbuf) ;
  ------------------
  |  |   93|    748|#define		ARRAY_LEN(x)	((int) (sizeof (x) / sizeof ((x) [0])))
  ------------------
  627|       |
  628|  1.46k|	while (len > 0)
  ------------------
  |  Branch (628:9): [True: 748, False: 716]
  ------------------
  629|    748|	{	if (len < bufferlen)
  ------------------
  |  Branch (629:8): [True: 554, False: 194]
  ------------------
  630|    554|			bufferlen = (int) len ;
  631|    748|		readcount = (int) psf_fread (ubuf.dbuf, sizeof (double), bufferlen, psf) ;
  632|       |
  633|    748|		if (psf->data_endswap == SF_TRUE)
  ------------------
  |  Branch (633:7): [True: 535, False: 213]
  ------------------
  634|    535|			endswap_double_array (ubuf.dbuf, readcount) ;
  635|       |
  636|    748|		d2f_array (ubuf.dbuf, readcount, ptr + total) ;
  637|    748|		total += readcount ;
  638|    748|		len -= readcount ;
  639|    748|		if (readcount < bufferlen)
  ------------------
  |  Branch (639:7): [True: 32, False: 716]
  ------------------
  640|     32|			break ;
  641|    748|		} ;
  642|       |
  643|    748|	return total ;
  644|    748|} /* host_read_d2f */
double64.c:d2f_array:
  531|   192k|{	for (int i = 0 ; i < count ; i++)
  ------------------
  |  Branch (531:20): [True: 191k, False: 748]
  ------------------
  532|   191k|	{	dest [i] = src [i] ;
  533|   191k|		} ;
  534|    748|} /* 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|    231|{	DWVW_PRIVATE	*pdwvw ;
   81|       |
   82|    231|	if (psf->codec_data != NULL)
  ------------------
  |  Branch (82:6): [True: 0, False: 231]
  ------------------
   83|      0|	{	psf_log_printf (psf, "*** psf->codec_data is not NULL.\n") ;
   84|      0|		return SFE_INTERNAL ;
   85|    231|		} ;
   86|       |
   87|    231|	if (bitwidth > 24)
  ------------------
  |  Branch (87:6): [True: 0, False: 231]
  ------------------
   88|      0|		return SFE_DWVW_BAD_BITWIDTH ;
   89|       |
   90|    231|	if (psf->file.mode == SFM_RDWR)
  ------------------
  |  Branch (90:6): [True: 0, False: 231]
  ------------------
   91|      0|		return SFE_BAD_MODE_RW ;
   92|       |
   93|    231|	if ((pdwvw = calloc (1, sizeof (DWVW_PRIVATE))) == NULL)
  ------------------
  |  Branch (93:6): [True: 0, False: 231]
  ------------------
   94|      0|		return SFE_MALLOC_FAILED ;
   95|       |
   96|    231|	psf->codec_data = (void*) pdwvw ;
   97|    231|	pdwvw->bit_width 	= bitwidth ;
   98|    231|	dwvw_read_reset (pdwvw) ;
   99|       |
  100|    231|	if (psf->file.mode == SFM_READ)
  ------------------
  |  Branch (100:6): [True: 231, False: 0]
  ------------------
  101|    231|	{	psf->read_short		= dwvw_read_s ;
  102|    231|		psf->read_int		= dwvw_read_i ;
  103|    231|		psf->read_float		= dwvw_read_f ;
  104|    231|		psf->read_double	= dwvw_read_d ;
  105|    231|		} ;
  106|       |
  107|    231|	if (psf->file.mode == SFM_WRITE)
  ------------------
  |  Branch (107:6): [True: 0, False: 231]
  ------------------
  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|    231|	psf->codec_close = dwvw_close ;
  115|    231|	psf->seek = dwvw_seek ;
  116|    231|	psf->byterate = dwvw_byterate ;
  117|       |
  118|    231|	if (psf->file.mode == SFM_READ)
  ------------------
  |  Branch (118:6): [True: 231, False: 0]
  ------------------
  119|    231|	{	psf->sf.frames = psf_decode_frame_count (psf) ;
  120|    231|		dwvw_read_reset (pdwvw) ;
  121|    231|		} ;
  122|       |
  123|    231|	return 0 ;
  124|    231|} /* dwvw_init */
dwvw.c:dwvw_close:
  131|    231|{	DWVW_PRIVATE *pdwvw ;
  132|       |
  133|    231|	if (psf->codec_data == NULL)
  ------------------
  |  Branch (133:6): [True: 0, False: 231]
  ------------------
  134|      0|		return 0 ;
  135|    231|	pdwvw = (DWVW_PRIVATE*) psf->codec_data ;
  136|       |
  137|    231|	if (psf->file.mode == SFM_WRITE)
  ------------------
  |  Branch (137:6): [True: 0, False: 231]
  ------------------
  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|    231|	return 0 ;
  151|    231|} /* dwvw_close */
dwvw.c:dwvw_decode_data:
  306|  12.3k|{	int	count ;
  307|  12.3k|	int delta_width_modifier, delta_width, delta_negative, delta, sample ;
  308|       |
  309|       |	/* Restore state from last decode call. */
  310|  12.3k|	delta_width = pdwvw->last_delta_width ;
  311|  12.3k|	sample = pdwvw->last_sample ;
  312|       |
  313|  17.7M|	for (count = 0 ; count < len ; count++)
  ------------------
  |  Branch (313:19): [True: 17.7M, False: 11.9k]
  ------------------
  314|  17.7M|	{	/* If bit_count parameter is zero get the delta_width_modifier. */
  315|  17.7M|		delta_width_modifier = dwvw_decode_load_bits (psf, pdwvw, -1) ;
  316|       |
  317|       |		/* Check for end of input bit stream. Break loop if end. */
  318|  17.7M|		if (delta_width_modifier < 0 || (pdwvw->b.end == 0 && count == 0))
  ------------------
  |  Branch (318:7): [True: 136, False: 17.7M]
  |  Branch (318:36): [True: 88.1k, False: 17.6M]
  |  Branch (318:57): [True: 157, False: 87.9k]
  ------------------
  319|    293|			break ;
  320|       |
  321|  17.7M|		if (delta_width_modifier && dwvw_decode_load_bits (psf, pdwvw, 1))
  ------------------
  |  Branch (321:7): [True: 2.28M, False: 15.4M]
  |  Branch (321:31): [True: 816k, False: 1.46M]
  ------------------
  322|   816k|			delta_width_modifier = - delta_width_modifier ;
  323|       |
  324|       |		/* Calculate the current word width. */
  325|  17.7M|		delta_width = (delta_width + delta_width_modifier + pdwvw->bit_width) % pdwvw->bit_width ;
  326|       |
  327|       |		/* Load the delta. */
  328|  17.7M|		delta = 0 ;
  329|  17.7M|		if (delta_width)
  ------------------
  |  Branch (329:7): [True: 9.78M, False: 7.95M]
  ------------------
  330|  9.78M|		{	delta = dwvw_decode_load_bits (psf, pdwvw, delta_width - 1) | (1 << (delta_width - 1)) ;
  331|  9.78M|			delta_negative = dwvw_decode_load_bits (psf, pdwvw, 1) ;
  332|  9.78M|			if (delta == pdwvw->max_delta - 1)
  ------------------
  |  Branch (332:8): [True: 490k, False: 9.28M]
  ------------------
  333|   490k|				delta += dwvw_decode_load_bits (psf, pdwvw, 1) ;
  334|  9.78M|			if (delta_negative)
  ------------------
  |  Branch (334:8): [True: 7.72M, False: 2.05M]
  ------------------
  335|  7.72M|				delta = -delta ;
  336|  9.78M|			} ;
  337|       |
  338|       |		/* Calculate the sample */
  339|  17.7M|		sample += delta ;
  340|       |
  341|  17.7M|		if (sample >= pdwvw->max_delta)
  ------------------
  |  Branch (341:7): [True: 184k, False: 17.5M]
  ------------------
  342|   184k|			sample -= pdwvw->span ;
  343|  17.5M|		else if (sample < - pdwvw->max_delta)
  ------------------
  |  Branch (343:12): [True: 599k, False: 16.9M]
  ------------------
  344|   599k|			sample += pdwvw->span ;
  345|       |
  346|       |		/* Store the sample justifying to the most significant bit. */
  347|  17.7M|		ptr [count] = arith_shift_left (sample, 32 - pdwvw->bit_width) ;
  348|       |
  349|  17.7M|		if (pdwvw->b.end == 0 && pdwvw->bit_count == 0)
  ------------------
  |  Branch (349:7): [True: 88.0k, False: 17.6M]
  |  Branch (349:28): [True: 91, False: 87.9k]
  ------------------
  350|     91|			break ;
  351|  17.7M|		} ;
  352|       |
  353|  12.3k|	pdwvw->last_delta_width = delta_width ;
  354|  12.3k|	pdwvw->last_sample = sample ;
  355|       |
  356|  12.3k|	pdwvw->samplecount += count ;
  357|       |
  358|  12.3k|	return count ;
  359|  12.3k|} /* dwvw_decode_data */
dwvw.c:dwvw_decode_load_bits:
  363|  40.0M|{	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|  40.0M|	if (bit_count < 0)
  ------------------
  |  Branch (371:6): [True: 17.7M, False: 22.3M]
  ------------------
  372|  17.7M|	{	get_dwm = SF_TRUE ;
  373|       |		/* modify bit_count to ensure we have enough bits for finding dwm. */
  374|  17.7M|		bit_count = pdwvw->dwm_maxsize ;
  375|  17.7M|		} ;
  376|       |
  377|       |	/* Load bits in bit reseviour. */
  378|  48.9M|	while (pdwvw->bit_count < bit_count)
  ------------------
  |  Branch (378:9): [True: 8.91M, False: 40.0M]
  ------------------
  379|  8.91M|	{	if (pdwvw->b.index >= pdwvw->b.end)
  ------------------
  |  Branch (379:8): [True: 302k, False: 8.61M]
  ------------------
  380|   302k|		{	pdwvw->b.end = (int) psf_fread (pdwvw->b.buffer, 1, sizeof (pdwvw->b.buffer), psf) ;
  381|   302k|			pdwvw->b.index = 0 ;
  382|   302k|			} ;
  383|       |
  384|       |		/* Check for end of input stream. */
  385|  8.91M|		if (bit_count < 8 && pdwvw->b.end == 0)
  ------------------
  |  Branch (385:7): [True: 4.56M, False: 4.35M]
  |  Branch (385:24): [True: 27.4k, False: 4.53M]
  ------------------
  386|  27.4k|			return -1 ;
  387|       |
  388|  8.89M|		pdwvw->bits = arith_shift_left (pdwvw->bits, 8) ;
  389|       |
  390|  8.89M|		if (pdwvw->b.index < pdwvw->b.end)
  ------------------
  |  Branch (390:7): [True: 8.65M, False: 241k]
  ------------------
  391|  8.65M|		{	pdwvw->bits |= pdwvw->b.buffer [pdwvw->b.index] ;
  392|  8.65M|			pdwvw->b.index ++ ;
  393|  8.65M|			} ;
  394|  8.89M|		pdwvw->bit_count += 8 ;
  395|  40.0M|		} ;
  396|       |
  397|       |	/* If asked to get bits do so. */
  398|  40.0M|	if (! get_dwm)
  ------------------
  |  Branch (398:6): [True: 22.3M, False: 17.7M]
  ------------------
  399|  22.3M|	{	output = (pdwvw->bits >> (pdwvw->bit_count - bit_count)) & ((1 << bit_count) - 1) ;
  400|  22.3M|		pdwvw->bit_count -= bit_count ;
  401|  22.3M|		return output ;
  402|  22.3M|		} ;
  403|       |
  404|       |	/* Otherwise must have been asked to get delta_width_modifier. */
  405|  23.1M|	while (output < (pdwvw->dwm_maxsize))
  ------------------
  |  Branch (405:9): [True: 22.8M, False: 355k]
  ------------------
  406|  22.8M|	{	pdwvw->bit_count -= 1 ;
  407|  22.8M|		if (pdwvw->bits & (1 << pdwvw->bit_count))
  ------------------
  |  Branch (407:7): [True: 17.3M, False: 5.42M]
  ------------------
  408|  17.3M|			break ;
  409|  5.42M|		output += 1 ;
  410|  5.42M|		} ;
  411|       |
  412|  17.7M|	return output ;
  413|  40.0M|} /* dwvw_decode_load_bits */
dwvw.c:dwvw_read_i:
  217|  8.76k|{	DWVW_PRIVATE *pdwvw ;
  218|  8.76k|	int			readcount, count ;
  219|  8.76k|	sf_count_t	total = 0 ;
  220|       |
  221|  8.76k|	if (! psf->codec_data)
  ------------------
  |  Branch (221:6): [True: 0, False: 8.76k]
  ------------------
  222|      0|		return 0 ;
  223|  8.76k|	pdwvw = (DWVW_PRIVATE*) psf->codec_data ;
  224|       |
  225|  17.1k|	while (len > 0)
  ------------------
  |  Branch (225:9): [True: 8.76k, False: 8.39k]
  ------------------
  226|  8.76k|	{	readcount = (len > 0x10000000) ? 0x10000000 : (int) len ;
  ------------------
  |  Branch (226:16): [True: 0, False: 8.76k]
  ------------------
  227|       |
  228|  8.76k|		count = dwvw_decode_data (psf, pdwvw, ptr, readcount) ;
  229|       |
  230|  8.76k|		total += count ;
  231|  8.76k|		len -= count ;
  232|       |
  233|  8.76k|		if (count != readcount)
  ------------------
  |  Branch (233:7): [True: 370, False: 8.39k]
  ------------------
  234|    370|			break ;
  235|  8.76k|		} ;
  236|       |
  237|  8.76k|	return total ;
  238|  8.76k|} /* dwvw_read_i */
dwvw.c:dwvw_read_f:
  242|  3.54k|{	DWVW_PRIVATE *pdwvw ;
  243|  3.54k|	BUF_UNION	ubuf ;
  244|  3.54k|	int			*iptr ;
  245|  3.54k|	int			k, bufferlen, readcount = 0, count ;
  246|  3.54k|	sf_count_t	total = 0 ;
  247|  3.54k|	float	normfact ;
  248|       |
  249|  3.54k|	if (! psf->codec_data)
  ------------------
  |  Branch (249:6): [True: 0, False: 3.54k]
  ------------------
  250|      0|		return 0 ;
  251|  3.54k|	pdwvw = (DWVW_PRIVATE*) psf->codec_data ;
  252|       |
  253|  3.54k|	normfact = (psf->norm_float == SF_TRUE) ? 1.0 / ((float) 0x80000000) : 1.0 ;
  ------------------
  |  Branch (253:13): [True: 3.54k, False: 0]
  ------------------
  254|       |
  255|  3.54k|	iptr = ubuf.ibuf ;
  256|  3.54k|	bufferlen = ARRAY_LEN (ubuf.ibuf) ;
  ------------------
  |  |   93|  3.54k|#define		ARRAY_LEN(x)	((int) (sizeof (x) / sizeof ((x) [0])))
  ------------------
  257|  7.06k|	while (len > 0)
  ------------------
  |  Branch (257:9): [True: 3.54k, False: 3.52k]
  ------------------
  258|  3.54k|	{	readcount = (len >= bufferlen) ? bufferlen : (int) len ;
  ------------------
  |  Branch (258:16): [True: 0, False: 3.54k]
  ------------------
  259|  3.54k|		count = dwvw_decode_data (psf, pdwvw, iptr, readcount) ;
  260|   965k|		for (k = 0 ; k < readcount ; k++)
  ------------------
  |  Branch (260:16): [True: 961k, False: 3.54k]
  ------------------
  261|   961k|			ptr [total + k] = normfact * (float) (iptr [k]) ;
  262|       |
  263|  3.54k|		total += count ;
  264|  3.54k|		len -= readcount ;
  265|  3.54k|		if (count != readcount)
  ------------------
  |  Branch (265:7): [True: 14, False: 3.52k]
  ------------------
  266|     14|			break ;
  267|  3.54k|		} ;
  268|       |
  269|  3.54k|	return total ;
  270|  3.54k|} /* dwvw_read_f */
dwvw.c:dwvw_read_reset:
  417|    462|{	int bitwidth = pdwvw->bit_width ;
  418|       |
  419|    462|	memset (pdwvw, 0, sizeof (DWVW_PRIVATE)) ;
  420|       |
  421|    462|	pdwvw->bit_width	= bitwidth ;
  422|    462|	pdwvw->dwm_maxsize	= bitwidth / 2 ;
  423|    462|	pdwvw->max_delta	= 1 << (bitwidth - 1) ;
  424|    462|	pdwvw->span			= 1 << bitwidth ;
  425|    462|} /* dwvw_read_reset */

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

flac_open:
 1464|      1|{
 1465|      1|	psf_log_printf (psf, "This version of libsndfile was compiled without FLAC support.\n") ;
 1466|      1|	return SFE_UNIMPLEMENTED ;
 1467|      1|} /* flac_open */

float32_init:
   89|    324|{	static int float_caps ;
   90|       |
   91|    324|	if (psf->sf.channels < 1)
  ------------------
  |  Branch (91:6): [True: 41, False: 283]
  ------------------
   92|     41|	{	psf_log_printf (psf, "float32_init : internal error : channels = %d\n", psf->sf.channels) ;
   93|     41|		return SFE_INTERNAL ;
   94|    283|		} ;
   95|       |
   96|    283|	float_caps = float32_get_capability (psf) ;
   97|       |
   98|    283|	psf->blockwidth = sizeof (float) * psf->sf.channels ;
   99|       |
  100|    283|	if (psf->file.mode == SFM_READ || psf->file.mode == SFM_RDWR)
  ------------------
  |  Branch (100:6): [True: 283, False: 0]
  |  Branch (100:36): [True: 0, False: 0]
  ------------------
  101|    283|	{	switch (psf->endian + float_caps)
  102|    283|		{	case (SF_ENDIAN_BIG + FLOAT_CAN_RW_BE) :
  ------------------
  |  Branch (102:5): [True: 0, False: 283]
  ------------------
  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|    167|			case (SF_ENDIAN_LITTLE + FLOAT_CAN_RW_LE) :
  ------------------
  |  Branch (110:4): [True: 167, False: 116]
  ------------------
  111|    167|					psf->data_endswap = SF_FALSE ;
  112|    167|					psf->read_short		= host_read_f2s ;
  113|    167|					psf->read_int		= host_read_f2i ;
  114|    167|					psf->read_float		= host_read_f ;
  115|    167|					psf->read_double	= host_read_f2d ;
  116|    167|					break ;
  117|       |
  118|    116|			case (SF_ENDIAN_BIG + FLOAT_CAN_RW_LE) :
  ------------------
  |  Branch (118:4): [True: 116, False: 167]
  ------------------
  119|    116|					psf->data_endswap = SF_TRUE ;
  120|    116|					psf->read_short		= host_read_f2s ;
  121|    116|					psf->read_int		= host_read_f2i ;
  122|    116|					psf->read_float		= host_read_f ;
  123|    116|					psf->read_double	= host_read_f2d ;
  124|    116|					break ;
  125|       |
  126|      0|			case (SF_ENDIAN_LITTLE + FLOAT_CAN_RW_BE) :
  ------------------
  |  Branch (126:4): [True: 0, False: 283]
  ------------------
  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: 283]
  ------------------
  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: 283]
  ------------------
  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: 283]
  ------------------
  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: 283]
  ------------------
  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: 283]
  ------------------
  168|    283|			} ;
  169|    283|		} ;
  170|       |
  171|    283|	if (psf->file.mode == SFM_WRITE || psf->file.mode == SFM_RDWR)
  ------------------
  |  Branch (171:6): [True: 0, False: 283]
  |  Branch (171:37): [True: 0, False: 283]
  ------------------
  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|    283|		} ;
  241|       |
  242|    283|	if (psf->filelength > psf->dataoffset)
  ------------------
  |  Branch (242:6): [True: 225, False: 58]
  ------------------
  243|    225|	{	psf->datalength = (psf->dataend > 0) ? psf->dataend - psf->dataoffset :
  ------------------
  |  Branch (243:22): [True: 3, False: 222]
  ------------------
  244|    225|							psf->filelength - psf->dataoffset ;
  245|    225|		}
  246|     58|	else
  247|     58|		psf->datalength = 0 ;
  248|       |
  249|    283|	psf->sf.frames = psf->blockwidth > 0 ? psf->datalength / psf->blockwidth : 0 ;
  ------------------
  |  Branch (249:19): [True: 283, False: 0]
  ------------------
  250|       |
  251|    283|	return 0 ;
  252|    283|} /* float32_init */
float32_be_read:
  256|  7.89k|{	int		exponent, mantissa, negative ;
  257|  7.89k|	float	fvalue ;
  258|       |
  259|  7.89k|	negative = cptr [0] & 0x80 ;
  260|  7.89k|	exponent = ((cptr [0] & 0x7F) << 1) | ((cptr [1] & 0x80) ? 1 : 0) ;
  ------------------
  |  Branch (260:41): [True: 676, False: 7.22k]
  ------------------
  261|  7.89k|	mantissa = ((cptr [1] & 0x7F) << 16) | (cptr [2] << 8) | (cptr [3]) ;
  262|       |
  263|  7.89k|	if (! (exponent || mantissa))
  ------------------
  |  Branch (263:9): [True: 1.59k, False: 6.29k]
  |  Branch (263:21): [True: 5.11k, False: 1.18k]
  ------------------
  264|  1.18k|		return 0.0 ;
  265|       |
  266|  6.71k|	mantissa |= 0x800000 ;
  267|  6.71k|	exponent = exponent ? exponent - 127 : 0 ;
  ------------------
  |  Branch (267:13): [True: 1.59k, False: 5.11k]
  ------------------
  268|       |
  269|  6.71k|	fvalue = mantissa ? ((float) mantissa) / ((float) 0x800000) : 0.0 ;
  ------------------
  |  Branch (269:11): [True: 6.71k, False: 0]
  ------------------
  270|       |
  271|  6.71k|	if (negative)
  ------------------
  |  Branch (271:6): [True: 565, False: 6.14k]
  ------------------
  272|    565|		fvalue *= -1 ;
  273|       |
  274|  6.71k|	if (exponent > 0)
  ------------------
  |  Branch (274:6): [True: 663, False: 6.04k]
  ------------------
  275|    663|		fvalue *= pow (2.0, exponent) ;
  276|  6.04k|	else if (exponent < 0)
  ------------------
  |  Branch (276:11): [True: 934, False: 5.11k]
  ------------------
  277|    934|		fvalue /= pow (2.0, abs (exponent)) ;
  278|       |
  279|  6.71k|	return fvalue ;
  280|  7.89k|} /* float32_be_read */
float32_le_read:
  284|  23.5k|{	int		exponent, mantissa, negative ;
  285|  23.5k|	float	fvalue ;
  286|       |
  287|  23.5k|	negative = cptr [3] & 0x80 ;
  288|  23.5k|	exponent = ((cptr [3] & 0x7F) << 1) | ((cptr [2] & 0x80) ? 1 : 0) ;
  ------------------
  |  Branch (288:41): [True: 8.82k, False: 14.7k]
  ------------------
  289|  23.5k|	mantissa = ((cptr [2] & 0x7F) << 16) | (cptr [1] << 8) | (cptr [0]) ;
  290|       |
  291|  23.5k|	if (! (exponent || mantissa))
  ------------------
  |  Branch (291:9): [True: 15.5k, False: 8.03k]
  |  Branch (291:21): [True: 5.03k, False: 3.00k]
  ------------------
  292|  3.00k|		return 0.0 ;
  293|       |
  294|  20.5k|	mantissa |= 0x800000 ;
  295|  20.5k|	exponent = exponent ? exponent - 127 : 0 ;
  ------------------
  |  Branch (295:13): [True: 15.5k, False: 5.03k]
  ------------------
  296|       |
  297|  20.5k|	fvalue = mantissa ? ((float) mantissa) / ((float) 0x800000) : 0.0 ;
  ------------------
  |  Branch (297:11): [True: 20.5k, False: 0]
  ------------------
  298|       |
  299|  20.5k|	if (negative)
  ------------------
  |  Branch (299:6): [True: 9.28k, False: 11.2k]
  ------------------
  300|  9.28k|		fvalue *= -1 ;
  301|       |
  302|  20.5k|	if (exponent > 0)
  ------------------
  |  Branch (302:6): [True: 11.0k, False: 9.45k]
  ------------------
  303|  11.0k|		fvalue *= pow (2.0, exponent) ;
  304|  9.45k|	else if (exponent < 0)
  ------------------
  |  Branch (304:11): [True: 4.42k, False: 5.03k]
  ------------------
  305|  4.42k|		fvalue /= pow (2.0, abs (exponent)) ;
  306|       |
  307|  20.5k|	return fvalue ;
  308|  23.5k|} /* float32_le_read */
float32.c:float32_get_capability:
  410|    283|{	union
  411|    283|	{	float			f ;
  412|    283|		int				i ;
  413|    283|		unsigned char	c [4] ;
  414|    283|	} data ;
  415|       |
  416|    283|	data.f = (float) 1.23456789 ; /* Some arbitrary value. */
  417|       |
  418|    283|	if (! psf->ieee_replace)
  ------------------
  |  Branch (418:6): [True: 283, False: 0]
  ------------------
  419|    283|	{	/* If this test is true ints and floats are compatible and little endian. */
  420|    283|		if (data.c [0] == 0x52 && data.c [1] == 0x06 && data.c [2] == 0x9e && data.c [3] == 0x3f)
  ------------------
  |  Branch (420:7): [True: 283, False: 0]
  |  Branch (420:29): [True: 283, False: 0]
  |  Branch (420:51): [True: 283, False: 0]
  |  Branch (420:73): [True: 283, False: 0]
  ------------------
  421|    283|			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|    283|} /* float32_get_capability */
float32.c:host_read_f:
  574|    636|{	BUF_UNION	ubuf ;
  575|    636|	int			bufferlen, readcount ;
  576|    636|	sf_count_t	total = 0 ;
  577|       |
  578|    636|	if (psf->data_endswap != SF_TRUE)
  ------------------
  |  Branch (578:6): [True: 219, False: 417]
  ------------------
  579|    219|		return psf_fread (ptr, sizeof (float), len, psf) ;
  580|       |
  581|    417|	bufferlen = ARRAY_LEN (ubuf.fbuf) ;
  ------------------
  |  |   93|    417|#define		ARRAY_LEN(x)	((int) (sizeof (x) / sizeof ((x) [0])))
  ------------------
  582|       |
  583|    801|	while (len > 0)
  ------------------
  |  Branch (583:9): [True: 417, False: 384]
  ------------------
  584|    417|	{	if (len < bufferlen)
  ------------------
  |  Branch (584:8): [True: 417, False: 0]
  ------------------
  585|    417|			bufferlen = (int) len ;
  586|    417|		readcount = (int) psf_fread (ubuf.fbuf, sizeof (float), bufferlen, psf) ;
  587|       |
  588|    417|		endswap_int_copy ((int*) (ptr + total), ubuf.ibuf, readcount) ;
  589|       |
  590|    417|		total += readcount ;
  591|    417|		if (readcount < bufferlen)
  ------------------
  |  Branch (591:7): [True: 33, False: 384]
  ------------------
  592|     33|			break ;
  593|    384|		len -= readcount ;
  594|    384|		} ;
  595|       |
  596|    417|	return total ;
  597|    636|} /* host_read_f */

g72x_init:
   72|    548|{	G72x_PRIVATE	*pg72x ;
   73|    548|	int	bitspersample, bytesperblock, codec ;
   74|       |
   75|    548|	if (psf->codec_data != NULL)
  ------------------
  |  Branch (75:6): [True: 0, False: 548]
  ------------------
   76|      0|	{	psf_log_printf (psf, "*** psf->codec_data is not NULL.\n") ;
   77|      0|		return SFE_INTERNAL ;
   78|    548|		} ;
   79|       |
   80|    548|	psf->sf.seekable = SF_FALSE ;
   81|       |
   82|    548|	if (psf->sf.channels != 1)
  ------------------
  |  Branch (82:6): [True: 2, False: 546]
  ------------------
   83|      2|		return SFE_G72X_NOT_MONO ;
   84|       |
   85|    546|	if ((pg72x = calloc (1, sizeof (G72x_PRIVATE))) == NULL)
  ------------------
  |  Branch (85:6): [True: 0, False: 546]
  ------------------
   86|      0|		return SFE_MALLOC_FAILED ;
   87|       |
   88|    546|	psf->codec_data = (void*) pg72x ;
   89|       |
   90|    546|	pg72x->block_curr = 0 ;
   91|    546|	pg72x->sample_curr = 0 ;
   92|       |
   93|    546|	switch (SF_CODEC (psf->sf.format))
  ------------------
  |  |  109|    546|#define SF_CODEC(x)			((x) & SF_FORMAT_SUBMASK)
  ------------------
   94|    546|	{	case SF_FORMAT_G721_32 :
  ------------------
  |  Branch (94:4): [True: 121, False: 425]
  ------------------
   95|    121|				codec = G721_32_BITS_PER_SAMPLE ;
   96|    121|				bytesperblock = G721_32_BYTES_PER_BLOCK ;
   97|    121|				bitspersample = G721_32_BITS_PER_SAMPLE ;
   98|    121|				break ;
   99|       |
  100|    344|		case SF_FORMAT_G723_24:
  ------------------
  |  Branch (100:3): [True: 344, False: 202]
  ------------------
  101|    344|				codec = G723_24_BITS_PER_SAMPLE ;
  102|    344|				bytesperblock = G723_24_BYTES_PER_BLOCK ;
  103|    344|				bitspersample = G723_24_BITS_PER_SAMPLE ;
  104|    344|				break ;
  105|       |
  106|     81|		case SF_FORMAT_G723_40:
  ------------------
  |  Branch (106:3): [True: 81, False: 465]
  ------------------
  107|     81|				codec = G723_40_BITS_PER_SAMPLE ;
  108|     81|				bytesperblock = G723_40_BYTES_PER_BLOCK ;
  109|     81|				bitspersample = G723_40_BITS_PER_SAMPLE ;
  110|     81|				break ;
  111|       |
  112|      0|		default : return SFE_UNIMPLEMENTED ;
  ------------------
  |  Branch (112:3): [True: 0, False: 546]
  ------------------
  113|    546|		} ;
  114|       |
  115|    546|	psf->filelength = psf_get_filelen (psf) ;
  116|    546|	if (psf->filelength < psf->dataoffset)
  ------------------
  |  Branch (116:6): [True: 3, False: 543]
  ------------------
  117|      3|		psf->filelength = psf->dataoffset ;
  118|       |
  119|    546|	psf->datalength = psf->filelength - psf->dataoffset ;
  120|    546|	if (psf->dataend > 0)
  ------------------
  |  Branch (120:6): [True: 10, False: 536]
  ------------------
  121|     10|		psf->datalength -= psf->filelength - psf->dataend ;
  122|       |
  123|    546|	if (psf->file.mode == SFM_READ)
  ------------------
  |  Branch (123:6): [True: 546, False: 0]
  ------------------
  124|    546|	{	pg72x->private = g72x_reader_init (codec, &(pg72x->blocksize), &(pg72x->samplesperblock)) ;
  125|    546|		if (pg72x->private == NULL)
  ------------------
  |  Branch (125:7): [True: 0, False: 546]
  ------------------
  126|      0|			return SFE_MALLOC_FAILED ;
  127|       |
  128|    546|		pg72x->bytesperblock = bytesperblock ;
  129|       |
  130|    546|		psf->read_short		= g72x_read_s ;
  131|    546|		psf->read_int		= g72x_read_i ;
  132|    546|		psf->read_float		= g72x_read_f ;
  133|    546|		psf->read_double	= g72x_read_d ;
  134|       |
  135|    546|		psf->seek = g72x_seek ;
  136|       |
  137|    546|		if (psf->datalength % pg72x->blocksize)
  ------------------
  |  Branch (137:7): [True: 534, False: 12]
  ------------------
  138|    534|		{	psf_log_printf (psf, "*** Odd psf->datalength (%D) should be a multiple of %d\n", psf->datalength, pg72x->blocksize) ;
  139|    534|			pg72x->blocks_total = (psf->datalength / pg72x->blocksize) + 1 ;
  140|    534|			}
  141|     12|		else
  142|     12|			pg72x->blocks_total = psf->datalength / pg72x->blocksize ;
  143|       |
  144|    546|		psf->sf.frames = (sf_count_t) pg72x->blocks_total * pg72x->samplesperblock ;
  145|       |
  146|    546|		psf_g72x_decode_block (psf, pg72x) ;
  147|    546|		}
  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|    546|		} ;
  171|       |
  172|    546|	psf->codec_close	= g72x_close ;
  173|       |
  174|    546|	return 0 ;
  175|    546|} /* g72x_init */
g72x.c:psf_g72x_decode_block:
  183|  17.3k|{	int	k ;
  184|       |
  185|  17.3k|	pg72x->block_curr ++ ;
  186|  17.3k|	pg72x->sample_curr = 0 ;
  187|       |
  188|  17.3k|	if (pg72x->block_curr > pg72x->blocks_total)
  ------------------
  |  Branch (188:6): [True: 11, False: 17.3k]
  ------------------
  189|     11|	{	memset (pg72x->samples, 0, G72x_BLOCK_SIZE * sizeof (short)) ;
  ------------------
  |  |   32|     11|#define	G72x_BLOCK_SIZE		(3 * 5 * 8)
  ------------------
  190|     11|		return 1 ;
  191|  17.3k|		} ;
  192|       |
  193|  17.3k|	if ((k = psf_fread (pg72x->block, 1, pg72x->bytesperblock, psf)) != pg72x->bytesperblock)
  ------------------
  |  Branch (193:6): [True: 2.26k, False: 15.1k]
  ------------------
  194|  2.26k|		psf_log_printf (psf, "*** Warning : short read (%d != %d).\n", k, pg72x->bytesperblock) ;
  195|       |
  196|  17.3k|	pg72x->blocksize = k ;
  197|  17.3k|	g72x_decode_block (pg72x->private, pg72x->block, pg72x->samples) ;
  198|       |
  199|  17.3k|	return 1 ;
  200|  17.3k|} /* psf_g72x_decode_block */
g72x.c:g72x_read_block:
  204|  2.05M|{	int	count, total = 0, indx = 0 ;
  205|       |
  206|  4.11M|	while (indx < len)
  ------------------
  |  Branch (206:9): [True: 2.05M, False: 2.05M]
  ------------------
  207|  2.05M|	{	if (pg72x->block_curr > pg72x->blocks_total)
  ------------------
  |  Branch (207:8): [True: 0, False: 2.05M]
  ------------------
  208|      0|		{	memset (&(ptr [indx]), 0, (len - indx) * sizeof (short)) ;
  209|      0|			return total ;
  210|  2.05M|			} ;
  211|       |
  212|  2.05M|		if (pg72x->sample_curr >= pg72x->samplesperblock)
  ------------------
  |  Branch (212:7): [True: 16.8k, False: 2.04M]
  ------------------
  213|  16.8k|			psf_g72x_decode_block (psf, pg72x) ;
  214|       |
  215|  2.05M|		count = pg72x->samplesperblock - pg72x->sample_curr ;
  216|  2.05M|		count = (len - indx > count) ? count : len - indx ;
  ------------------
  |  Branch (216:11): [True: 0, False: 2.05M]
  ------------------
  217|       |
  218|  2.05M|		memcpy (&(ptr [indx]), &(pg72x->samples [pg72x->sample_curr]), count * sizeof (short)) ;
  219|  2.05M|		indx += count ;
  220|  2.05M|		pg72x->sample_curr += count ;
  221|  2.05M|		total = indx ;
  222|  2.05M|		} ;
  223|       |
  224|  2.05M|	return total ;
  225|  2.05M|} /* g72x_read_block */
g72x.c:g72x_read_f:
  284|  2.05M|{	BUF_UNION	ubuf ;
  285|  2.05M|	G72x_PRIVATE *pg72x ;
  286|  2.05M|	short		*sptr ;
  287|  2.05M|	int			k, bufferlen, readcount = 0, count ;
  288|  2.05M|	sf_count_t	total = 0 ;
  289|  2.05M|	float 		normfact ;
  290|       |
  291|  2.05M|	if (psf->codec_data == NULL)
  ------------------
  |  Branch (291:6): [True: 0, False: 2.05M]
  ------------------
  292|      0|		return 0 ;
  293|  2.05M|	pg72x = (G72x_PRIVATE*) psf->codec_data ;
  294|       |
  295|  2.05M|	normfact = (psf->norm_float == SF_TRUE) ? 1.0 / ((float) 0x8000) : 1.0 ;
  ------------------
  |  Branch (295:13): [True: 2.05M, False: 0]
  ------------------
  296|       |
  297|  2.05M|	sptr = ubuf.sbuf ;
  298|  2.05M|	bufferlen = SF_BUFFER_LEN / sizeof (short) ;
  ------------------
  |  |   77|  2.05M|#define	SF_BUFFER_LEN			(8192)
  ------------------
  299|  4.11M|	while (len > 0)
  ------------------
  |  Branch (299:9): [True: 2.05M, False: 2.05M]
  ------------------
  300|  2.05M|	{	readcount = (len >= bufferlen) ? bufferlen : (int) len ;
  ------------------
  |  Branch (300:16): [True: 0, False: 2.05M]
  ------------------
  301|  2.05M|		count = g72x_read_block (psf, pg72x, sptr, readcount) ;
  302|  4.11M|		for (k = 0 ; k < readcount ; k++)
  ------------------
  |  Branch (302:16): [True: 2.05M, False: 2.05M]
  ------------------
  303|  2.05M|			ptr [total + k] = normfact * sptr [k] ;
  304|       |
  305|  2.05M|		total += count ;
  306|  2.05M|		len -= readcount ;
  307|  2.05M|		if (count != readcount)
  ------------------
  |  Branch (307:7): [True: 0, False: 2.05M]
  ------------------
  308|      0|			break ;
  309|  2.05M|		} ;
  310|       |
  311|  2.05M|	return total ;
  312|  2.05M|} /* g72x_read_f */
g72x.c:g72x_close:
  587|    546|{	G72x_PRIVATE *pg72x ;
  588|       |
  589|    546|	pg72x = (G72x_PRIVATE*) psf->codec_data ;
  590|       |
  591|    546|	if (psf->file.mode == SFM_WRITE)
  ------------------
  |  Branch (591:6): [True: 0, False: 546]
  ------------------
  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|    546|	free (pg72x->private) ;
  605|       |
  606|    546|	return 0 ;
  607|    546|} /* g72x_close */

gsm610_init:
   79|    461|{	GSM610_PRIVATE	*pgsm610 ;
   80|    461|	int		true_flag = 1 ;
   81|       |
   82|    461|	if (psf->codec_data != NULL)
  ------------------
  |  Branch (82:6): [True: 0, False: 461]
  ------------------
   83|      0|	{	psf_log_printf (psf, "*** psf->codec_data is not NULL.\n") ;
   84|      0|		return SFE_INTERNAL ;
   85|    461|		} ;
   86|       |
   87|    461|	if (psf->file.mode == SFM_RDWR)
  ------------------
  |  Branch (87:6): [True: 0, False: 461]
  ------------------
   88|      0|		return SFE_BAD_MODE_RW ;
   89|       |
   90|    461|	psf->sf.seekable = SF_FALSE ;
   91|       |
   92|    461|	if ((pgsm610 = calloc (1, sizeof (GSM610_PRIVATE))) == NULL)
  ------------------
  |  Branch (92:6): [True: 0, False: 461]
  ------------------
   93|      0|		return SFE_MALLOC_FAILED ;
   94|       |
   95|    461|	psf->codec_data = pgsm610 ;
   96|       |
   97|    461|	memset (pgsm610, 0, sizeof (GSM610_PRIVATE)) ;
   98|       |
   99|       |/*============================================================
  100|       |
  101|       |Need separate gsm_data structs for encode and decode.
  102|       |
  103|       |============================================================*/
  104|       |
  105|    461|	if ((pgsm610->gsm_data = gsm_create ()) == NULL)
  ------------------
  |  Branch (105:6): [True: 0, False: 461]
  ------------------
  106|      0|		return SFE_MALLOC_FAILED ;
  107|       |
  108|    461|	switch (SF_CONTAINER (psf->sf.format))
  ------------------
  |  |  108|    461|#define SF_CONTAINER(x)		((x) & SF_FORMAT_TYPEMASK)
  ------------------
  109|    461|	{	case SF_FORMAT_WAV :
  ------------------
  |  Branch (109:4): [True: 278, False: 183]
  ------------------
  110|    278|		case SF_FORMAT_WAVEX :
  ------------------
  |  Branch (110:3): [True: 0, False: 461]
  ------------------
  111|    309|		case SF_FORMAT_W64 :
  ------------------
  |  Branch (111:3): [True: 31, False: 430]
  ------------------
  112|    309|			gsm_option (pgsm610->gsm_data, GSM_OPT_WAV49, &true_flag) ;
  ------------------
  |  |   30|    309|#define	GSM_OPT_WAV49		4
  ------------------
  113|       |
  114|    309|			pgsm610->encode_block = gsm610_wav_encode_block ;
  115|    309|			pgsm610->decode_block = gsm610_wav_decode_block ;
  116|       |
  117|    309|			pgsm610->samplesperblock = WAVLIKE_GSM610_SAMPLES ;
  ------------------
  |  |  335|    309|#define		WAVLIKE_GSM610_SAMPLES		320
  ------------------
  118|    309|			pgsm610->blocksize = WAVLIKE_GSM610_BLOCKSIZE ;
  ------------------
  |  |  334|    309|#define		WAVLIKE_GSM610_BLOCKSIZE	65
  ------------------
  119|    309|			break ;
  120|       |
  121|    152|		case SF_FORMAT_AIFF :
  ------------------
  |  Branch (121:3): [True: 152, False: 309]
  ------------------
  122|    152|		case SF_FORMAT_RAW :
  ------------------
  |  Branch (122:3): [True: 0, False: 461]
  ------------------
  123|    152|			pgsm610->encode_block = gsm610_encode_block ;
  124|    152|			pgsm610->decode_block = gsm610_decode_block ;
  125|       |
  126|    152|			pgsm610->samplesperblock = GSM610_SAMPLES ;
  ------------------
  |  |   33|    152|#define	GSM610_SAMPLES			160
  ------------------
  127|    152|			pgsm610->blocksize = GSM610_BLOCKSIZE ;
  ------------------
  |  |   32|    152|#define	GSM610_BLOCKSIZE		33
  ------------------
  128|    152|			break ;
  129|       |
  130|      0|		default :
  ------------------
  |  Branch (130:3): [True: 0, False: 461]
  ------------------
  131|      0|			return SFE_INTERNAL ;
  132|      0|			break ;
  133|    461|		} ;
  134|       |
  135|    461|	if (psf->file.mode == SFM_READ)
  ------------------
  |  Branch (135:6): [True: 461, False: 0]
  ------------------
  136|    461|	{	if (psf->datalength % pgsm610->blocksize == 0)
  ------------------
  |  Branch (136:8): [True: 14, False: 447]
  ------------------
  137|     14|			pgsm610->blocks = psf->datalength / pgsm610->blocksize ;
  138|    447|		else if (psf->datalength % pgsm610->blocksize == 1 && pgsm610->blocksize == GSM610_BLOCKSIZE)
  ------------------
  |  |   32|     53|#define	GSM610_BLOCKSIZE		33
  ------------------
  |  Branch (138:12): [True: 53, False: 394]
  |  Branch (138:57): [True: 2, False: 51]
  ------------------
  139|      2|		{	/*
  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|      2|			pgsm610->blocks = psf->datalength / pgsm610->blocksize ;
  147|      2|			}
  148|    445|		else
  149|    445|		{	psf_log_printf (psf, "*** Warning : data chunk seems to be truncated.\n") ;
  150|    445|			pgsm610->blocks = psf->datalength / pgsm610->blocksize + 1 ;
  151|    445|			} ;
  152|       |
  153|    461|		psf->sf.frames = (sf_count_t) pgsm610->samplesperblock * pgsm610->blocks ;
  154|       |
  155|    461|		psf_fseek (psf, psf->dataoffset, SEEK_SET) ;
  156|       |
  157|    461|		pgsm610->decode_block (psf, pgsm610) ;	/* Read first block. */
  158|       |
  159|    461|		psf->read_short		= gsm610_read_s ;
  160|    461|		psf->read_int		= gsm610_read_i ;
  161|    461|		psf->read_float		= gsm610_read_f ;
  162|    461|		psf->read_double	= gsm610_read_d ;
  163|    461|		} ;
  164|       |
  165|    461|	if (psf->file.mode == SFM_WRITE)
  ------------------
  |  Branch (165:6): [True: 0, False: 461]
  ------------------
  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|    461|	psf->codec_close = gsm610_close ;
  176|       |
  177|    461|	psf->seek = gsm610_seek ;
  178|       |
  179|    461|	psf->filelength = psf_get_filelen (psf) ;
  180|    461|	psf->datalength = psf->filelength - psf->dataoffset ;
  181|       |
  182|    461|	return 0 ;
  183|    461|} /* gsm610_init */
gsm610.c:gsm610_wav_decode_block:
  191|  1.84k|{	int	k ;
  192|       |
  193|  1.84k|	pgsm610->blockcount ++ ;
  194|  1.84k|	pgsm610->samplecount = 0 ;
  195|       |
  196|  1.84k|	if (pgsm610->blockcount > pgsm610->blocks)
  ------------------
  |  Branch (196:6): [True: 31, False: 1.81k]
  ------------------
  197|     31|	{	memset (pgsm610->samples, 0, sizeof (pgsm610->samples)) ;
  198|     31|		return 1 ;
  199|  1.81k|		} ;
  200|       |
  201|  1.81k|	if ((k = (int) psf_fread (pgsm610->block, 1, WAVLIKE_GSM610_BLOCKSIZE, psf)) != WAVLIKE_GSM610_BLOCKSIZE)
  ------------------
  |  |  334|  1.81k|#define		WAVLIKE_GSM610_BLOCKSIZE	65
  ------------------
              	if ((k = (int) psf_fread (pgsm610->block, 1, WAVLIKE_GSM610_BLOCKSIZE, psf)) != WAVLIKE_GSM610_BLOCKSIZE)
  ------------------
  |  |  334|  1.81k|#define		WAVLIKE_GSM610_BLOCKSIZE	65
  ------------------
  |  Branch (201:6): [True: 276, False: 1.53k]
  ------------------
  202|    276|		psf_log_printf (psf, "*** Warning : short read (%d != %d).\n", k, WAVLIKE_GSM610_BLOCKSIZE) ;
  ------------------
  |  |  334|    276|#define		WAVLIKE_GSM610_BLOCKSIZE	65
  ------------------
  203|       |
  204|  1.81k|	if (gsm_decode (pgsm610->gsm_data, pgsm610->block, pgsm610->samples) < 0)
  ------------------
  |  Branch (204:6): [True: 0, False: 1.81k]
  ------------------
  205|      0|	{	psf_log_printf (psf, "Error from WAV gsm_decode() on frame : %d\n", pgsm610->blockcount) ;
  206|      0|		return 0 ;
  207|  1.81k|		} ;
  208|       |
  209|  1.81k|	if (gsm_decode (pgsm610->gsm_data, pgsm610->block + (WAVLIKE_GSM610_BLOCKSIZE + 1) / 2, pgsm610->samples + WAVLIKE_GSM610_SAMPLES / 2) < 0)
  ------------------
  |  |  334|  1.81k|#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|  1.81k|#define		WAVLIKE_GSM610_SAMPLES		320
  ------------------
  |  Branch (209:6): [True: 0, False: 1.81k]
  ------------------
  210|      0|	{	psf_log_printf (psf, "Error from WAV gsm_decode() on frame : %d.5\n", pgsm610->blockcount) ;
  211|      0|		return 0 ;
  212|  1.81k|		} ;
  213|       |
  214|  1.81k|	return 1 ;
  215|  1.81k|} /* gsm610_wav_decode_block */
gsm610.c:gsm610_decode_block:
  219|  3.18k|{	int	k ;
  220|       |
  221|  3.18k|	pgsm610->blockcount ++ ;
  222|  3.18k|	pgsm610->samplecount = 0 ;
  223|       |
  224|  3.18k|	if (pgsm610->blockcount > pgsm610->blocks)
  ------------------
  |  Branch (224:6): [True: 58, False: 3.12k]
  ------------------
  225|     58|	{	memset (pgsm610->samples, 0, sizeof (pgsm610->samples)) ;
  226|     58|		return 1 ;
  227|  3.12k|		} ;
  228|       |
  229|  3.12k|	if ((k = (int) psf_fread (pgsm610->block, 1, GSM610_BLOCKSIZE, psf)) != GSM610_BLOCKSIZE)
  ------------------
  |  |   32|  3.12k|#define	GSM610_BLOCKSIZE		33
  ------------------
              	if ((k = (int) psf_fread (pgsm610->block, 1, GSM610_BLOCKSIZE, psf)) != GSM610_BLOCKSIZE)
  ------------------
  |  |   32|  3.12k|#define	GSM610_BLOCKSIZE		33
  ------------------
  |  Branch (229:6): [True: 74, False: 3.05k]
  ------------------
  230|     74|		psf_log_printf (psf, "*** Warning : short read (%d != %d).\n", k, GSM610_BLOCKSIZE) ;
  ------------------
  |  |   32|     74|#define	GSM610_BLOCKSIZE		33
  ------------------
  231|       |
  232|  3.12k|	if (gsm_decode (pgsm610->gsm_data, pgsm610->block, pgsm610->samples) < 0)
  ------------------
  |  Branch (232:6): [True: 1.88k, False: 1.24k]
  ------------------
  233|  1.88k|	{	psf_log_printf (psf, "Error from standard gsm_decode() on frame : %d\n", pgsm610->blockcount) ;
  234|  1.88k|		return 0 ;
  235|  1.88k|		} ;
  236|       |
  237|  1.24k|	return 1 ;
  238|  3.12k|} /* gsm610_decode_block */
gsm610.c:gsm610_read_block:
  242|   575k|{	int	count, total = 0, indx = 0 ;
  243|       |
  244|  1.15M|	while (indx < len)
  ------------------
  |  Branch (244:9): [True: 578k, False: 575k]
  ------------------
  245|   578k|	{	if (pgsm610->blockcount >= pgsm610->blocks && pgsm610->samplecount >= pgsm610->samplesperblock)
  ------------------
  |  Branch (245:8): [True: 80.7k, False: 498k]
  |  Branch (245:50): [True: 78, False: 80.6k]
  ------------------
  246|     78|		{	memset (ptr + indx, 0, (len - indx) * sizeof (short)) ;
  247|     78|			return total ;
  248|   578k|			} ;
  249|       |
  250|   578k|		if (pgsm610->samplecount >= pgsm610->samplesperblock)
  ------------------
  |  Branch (250:7): [True: 4.56k, False: 574k]
  ------------------
  251|  4.56k|			pgsm610->decode_block (psf, pgsm610) ;
  252|       |
  253|   578k|		count = pgsm610->samplesperblock - pgsm610->samplecount ;
  254|   578k|		count = (len - indx > count) ? count : len - indx ;
  ------------------
  |  Branch (254:11): [True: 2.98k, False: 575k]
  ------------------
  255|       |
  256|   578k|		memcpy (&(ptr [indx]), &(pgsm610->samples [pgsm610->samplecount]), count * sizeof (short)) ;
  257|   578k|		indx += count ;
  258|   578k|		pgsm610->samplecount += count ;
  259|   578k|		total = indx ;
  260|   578k|		} ;
  261|       |
  262|   575k|	return total ;
  263|   575k|} /* gsm610_read_block */
gsm610.c:gsm610_read_f:
  318|   575k|{	GSM610_PRIVATE *pgsm610 ;
  319|   575k|	BUF_UNION	ubuf ;
  320|   575k|	short		*sptr ;
  321|   575k|	int			k, bufferlen, readcount = 0, count ;
  322|   575k|	sf_count_t	total = 0 ;
  323|   575k|	float		normfact ;
  324|       |
  325|   575k|	if (psf->codec_data == NULL)
  ------------------
  |  Branch (325:6): [True: 0, False: 575k]
  ------------------
  326|      0|		return 0 ;
  327|   575k|	pgsm610 = (GSM610_PRIVATE*) psf->codec_data ;
  328|       |
  329|   575k|	normfact = (psf->norm_float == SF_TRUE) ? 1.0 / ((float) 0x8000) : 1.0 ;
  ------------------
  |  Branch (329:13): [True: 575k, False: 0]
  ------------------
  330|       |
  331|   575k|	sptr = ubuf.sbuf ;
  332|   575k|	bufferlen = ARRAY_LEN (ubuf.sbuf) ;
  ------------------
  |  |   93|   575k|#define		ARRAY_LEN(x)	((int) (sizeof (x) / sizeof ((x) [0])))
  ------------------
  333|  1.15M|	while (len > 0)
  ------------------
  |  Branch (333:9): [True: 575k, False: 575k]
  ------------------
  334|   575k|	{	readcount = (len >= bufferlen) ? bufferlen : (int) len ;
  ------------------
  |  Branch (334:16): [True: 0, False: 575k]
  ------------------
  335|   575k|		count = gsm610_read_block (psf, pgsm610, sptr, readcount) ;
  336|  1.66M|		for (k = 0 ; k < readcount ; k++)
  ------------------
  |  Branch (336:16): [True: 1.08M, False: 575k]
  ------------------
  337|  1.08M|			ptr [total + k] = normfact * sptr [k] ;
  338|       |
  339|   575k|		total += count ;
  340|   575k|		len -= readcount ;
  341|   575k|		} ;
  342|   575k|	return total ;
  343|   575k|} /* gsm610_read_f */
gsm610.c:gsm610_close:
  608|    461|{	GSM610_PRIVATE *pgsm610 ;
  609|       |
  610|    461|	if (psf->codec_data == NULL)
  ------------------
  |  Branch (610:6): [True: 0, False: 461]
  ------------------
  611|      0|		return 0 ;
  612|       |
  613|    461|	pgsm610 = (GSM610_PRIVATE*) psf->codec_data ;
  614|       |
  615|    461|	if (psf->file.mode == SFM_WRITE)
  ------------------
  |  Branch (615:6): [True: 0, False: 461]
  ------------------
  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|    461|	if (pgsm610->gsm_data)
  ------------------
  |  Branch (624:6): [True: 461, False: 0]
  ------------------
  625|    461|		gsm_destroy (pgsm610->gsm_data) ;
  626|       |
  627|    461|	return 0 ;
  628|    461|} /* gsm610_close */

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

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

wavlike_ima_init:
  109|    142|{	int error ;
  110|       |
  111|    142|	if (psf->codec_data != NULL)
  ------------------
  |  Branch (111:6): [True: 0, False: 142]
  ------------------
  112|      0|	{	psf_log_printf (psf, "*** psf->codec_data is not NULL.\n") ;
  113|      0|		return SFE_INTERNAL ;
  114|    142|		} ;
  115|       |
  116|    142|	if (psf->file.mode == SFM_RDWR)
  ------------------
  |  Branch (116:6): [True: 0, False: 142]
  ------------------
  117|      0|		return SFE_BAD_MODE_RW ;
  118|       |
  119|    142|	if (psf->file.mode == SFM_READ)
  ------------------
  |  Branch (119:6): [True: 142, False: 0]
  ------------------
  120|    142|		if ((error = ima_reader_init (psf, blockalign, samplesperblock)))
  ------------------
  |  Branch (120:7): [True: 32, False: 110]
  ------------------
  121|     32|			return error ;
  122|       |
  123|    110|	if (psf->file.mode == SFM_WRITE)
  ------------------
  |  Branch (123:6): [True: 0, False: 110]
  ------------------
  124|      0|		if ((error = ima_writer_init (psf, blockalign)))
  ------------------
  |  Branch (124:7): [True: 0, False: 0]
  ------------------
  125|      0|			return error ;
  126|       |
  127|    110|	psf->codec_close = ima_close ;
  128|    110|	psf->seek = wavlike_ima_seek ;
  129|       |
  130|    110|	return 0 ;
  131|    110|} /* wavlike_ima_init */
aiff_ima_init:
  135|    150|{	int error ;
  136|       |
  137|    150|	if (psf->file.mode == SFM_RDWR)
  ------------------
  |  Branch (137:6): [True: 0, False: 150]
  ------------------
  138|      0|		return SFE_BAD_MODE_RW ;
  139|       |
  140|    150|	if (psf->file.mode == SFM_READ)
  ------------------
  |  Branch (140:6): [True: 150, False: 0]
  ------------------
  141|    150|		if ((error = ima_reader_init (psf, blockalign, samplesperblock)))
  ------------------
  |  Branch (141:7): [True: 0, False: 150]
  ------------------
  142|      0|			return error ;
  143|       |
  144|    150|	if (psf->file.mode == SFM_WRITE)
  ------------------
  |  Branch (144:6): [True: 0, False: 150]
  ------------------
  145|      0|		if ((error = ima_writer_init (psf, blockalign)))
  ------------------
  |  Branch (145:7): [True: 0, False: 0]
  ------------------
  146|      0|			return error ;
  147|       |
  148|    150|	psf->codec_close = ima_close ;
  149|    150|	psf->seek = aiff_ima_seek ;
  150|       |
  151|    150|	return 0 ;
  152|    150|} /* aiff_ima_init */
ima_adpcm.c:ima_close:
  156|    260|{	IMA_ADPCM_PRIVATE *pima ;
  157|       |
  158|    260|	pima = (IMA_ADPCM_PRIVATE*) psf->codec_data ;
  159|       |
  160|    260|	if (psf->file.mode == SFM_WRITE)
  ------------------
  |  Branch (160:6): [True: 0, False: 260]
  ------------------
  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|    260|	return 0 ;
  171|    260|} /* ima_close */
ima_adpcm.c:ima_reader_init:
  179|    292|{	IMA_ADPCM_PRIVATE	*pima ;
  180|    292|	int		pimasize, count ;
  181|       |
  182|    292|	if (psf->file.mode != SFM_READ)
  ------------------
  |  Branch (182:6): [True: 0, False: 292]
  ------------------
  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|    292|	count = ((samplesperblock - 2) | 7) + 2 ;
  190|    292|	pimasize = sizeof (IMA_ADPCM_PRIVATE) + psf->sf.channels * (blockalign + samplesperblock + sizeof (short) * count) ;
  191|       |
  192|    292|	if (! (pima = calloc (1, pimasize)))
  ------------------
  |  Branch (192:6): [True: 0, False: 292]
  ------------------
  193|      0|		return SFE_MALLOC_FAILED ;
  194|       |
  195|    292|	psf->codec_data = (void*) pima ;
  196|       |
  197|    292|	pima->samples	= pima->data ;
  198|    292|	pima->block		= (unsigned char*) (pima->data + samplesperblock * psf->sf.channels) ;
  199|       |
  200|    292|	pima->channels			= psf->sf.channels ;
  201|    292|	pima->blocksize			= blockalign ;
  202|    292|	pima->samplesperblock	= samplesperblock ;
  203|       |
  204|    292|	psf->filelength = psf_get_filelen (psf) ;
  205|    292|	psf->datalength = (psf->dataend) ? psf->dataend - psf->dataoffset :
  ------------------
  |  Branch (205:20): [True: 34, False: 258]
  ------------------
  206|    292|							psf->filelength - psf->dataoffset ;
  207|       |
  208|    292|	if (pima->blocksize <= 0)
  ------------------
  |  Branch (208:6): [True: 2, False: 290]
  ------------------
  209|      2|	{	psf_log_printf (psf, "*** Error : pima->blocksize should be > 0.\n") ;
  210|      2|		return SFE_INTERNAL ;
  211|    290|		} ;
  212|       |
  213|    290|	if (pima->samplesperblock <= 0)
  ------------------
  |  Branch (213:6): [True: 0, False: 290]
  ------------------
  214|      0|	{	psf_log_printf (psf, "*** Error : pima->samplesperblock should be > 0.\n") ;
  215|      0|		return SFE_INTERNAL ;
  216|    290|		} ;
  217|       |
  218|    290|	if (psf->datalength % pima->blocksize)
  ------------------
  |  Branch (218:6): [True: 247, False: 43]
  ------------------
  219|    247|		pima->blocks = psf->datalength / pima->blocksize + 1 ;
  220|     43|	else
  221|     43|		pima->blocks = psf->datalength / pima->blocksize ;
  222|       |
  223|    290|	switch (SF_CONTAINER (psf->sf.format))
  ------------------
  |  |  108|    290|#define SF_CONTAINER(x)		((x) & SF_FORMAT_TYPEMASK)
  ------------------
  224|    290|	{	case SF_FORMAT_WAV :
  ------------------
  |  Branch (224:4): [True: 139, False: 151]
  ------------------
  225|    140|		case SF_FORMAT_W64 :
  ------------------
  |  Branch (225:3): [True: 1, False: 289]
  ------------------
  226|    140|				count = 2 * (pima->blocksize - 4 * pima->channels) / pima->channels + 1 ;
  227|       |
  228|    140|				if (pima->samplesperblock != count)
  ------------------
  |  Branch (228:9): [True: 30, False: 110]
  ------------------
  229|     30|				{	psf_log_printf (psf, "*** Error : samplesperblock should be %d.\n", count) ;
  230|     30|					return SFE_INTERNAL ;
  231|    110|					} ;
  232|       |
  233|    110|				pima->decode_block = wavlike_ima_decode_block ;
  234|       |
  235|    110|				psf->sf.frames = (sf_count_t) pima->samplesperblock * pima->blocks ;
  236|    110|				break ;
  237|       |
  238|    150|		case SF_FORMAT_AIFF :
  ------------------
  |  Branch (238:3): [True: 150, False: 140]
  ------------------
  239|    150|				psf_log_printf (psf, "still need to check block count\n") ;
  240|    150|				pima->decode_block = aiff_ima_decode_block ;
  241|    150|				psf->sf.frames = (sf_count_t) pima->samplesperblock * pima->blocks / pima->channels ;
  242|    150|				break ;
  243|       |
  244|      0|		default :
  ------------------
  |  Branch (244:3): [True: 0, False: 290]
  ------------------
  245|      0|				psf_log_printf (psf, "ima_reader_init: bad psf->sf.format\n") ;
  246|      0|				return SFE_INTERNAL ;
  247|    290|		} ;
  248|       |
  249|    260|	pima->decode_block (psf, pima) ;	/* Read first block. */
  250|       |
  251|    260|	psf->read_short		= ima_read_s ;
  252|    260|	psf->read_int		= ima_read_i ;
  253|    260|	psf->read_float		= ima_read_f ;
  254|    260|	psf->read_double	= ima_read_d ;
  255|       |
  256|    260|	return 0 ;
  257|    290|} /* ima_reader_init */
ima_adpcm.c:wavlike_ima_decode_block:
  390|  77.5k|{	int		chan, k, predictor, blockindx, indx, indxstart, diff ;
  391|  77.5k|	short	step, bytecode, stepindx [2] = { 0 } ;
  392|       |
  393|  77.5k|	pima->blockcount ++ ;
  394|  77.5k|	pima->samplecount = 0 ;
  395|       |
  396|  77.5k|	if (pima->blockcount > pima->blocks)
  ------------------
  |  Branch (396:6): [True: 2, False: 77.5k]
  ------------------
  397|      2|	{	memset (pima->samples, 0, pima->samplesperblock * pima->channels * sizeof (short)) ;
  398|      2|		return 1 ;
  399|  77.5k|		} ;
  400|       |
  401|  77.5k|	if ((k = (int) psf_fread (pima->block, 1, pima->blocksize, psf)) != pima->blocksize)
  ------------------
  |  Branch (401:6): [True: 93, False: 77.4k]
  ------------------
  402|     93|		psf_log_printf (psf, "*** Warning : short read (%d != %d).\n", k, pima->blocksize) ;
  403|       |
  404|       |	/* Read and check the block header. */
  405|       |
  406|   155k|	for (chan = 0 ; chan < pima->channels ; chan++)
  ------------------
  |  Branch (406:18): [True: 78.1k, False: 77.5k]
  ------------------
  407|  78.1k|	{	predictor = pima->block [chan*4] | (pima->block [chan*4+1] << 8) ;
  408|  78.1k|		if (predictor & 0x8000)
  ------------------
  |  Branch (408:7): [True: 15.3k, False: 62.8k]
  ------------------
  409|  15.3k|			predictor -= 0x10000 ;
  410|       |
  411|  78.1k|		stepindx [chan] = pima->block [chan*4+2] ;
  412|  78.1k|		stepindx [chan] = clamp_ima_step_index (stepindx [chan]) ;
  413|       |
  414|       |
  415|  78.1k|		if (pima->block [chan*4+3] != 0)
  ------------------
  |  Branch (415:7): [True: 30.9k, False: 47.1k]
  ------------------
  416|  30.9k|			psf_log_printf (psf, "IMA ADPCM synchronisation error.\n") ;
  417|       |
  418|  78.1k|		pima->samples [chan] = predictor ;
  419|  78.1k|		} ;
  420|       |
  421|       |	/*
  422|       |	**	Pull apart the packed 4 bit samples and store them in their
  423|       |	**	correct sample positions.
  424|       |	*/
  425|       |
  426|  77.5k|	blockindx = 4 * pima->channels ;
  427|       |
  428|  77.5k|	indxstart = pima->channels ;
  429|   154k|	while (blockindx < pima->blocksize)
  ------------------
  |  Branch (429:9): [True: 77.3k, False: 77.5k]
  ------------------
  430|   155k|	{	for (chan = 0 ; chan < pima->channels ; chan++)
  ------------------
  |  Branch (430:20): [True: 78.1k, False: 77.3k]
  ------------------
  431|  78.1k|		{	indx = indxstart + chan ;
  432|   390k|			for (k = 0 ; k < 4 ; k++)
  ------------------
  |  Branch (432:17): [True: 312k, False: 78.1k]
  ------------------
  433|   312k|			{	bytecode = pima->block [blockindx++] ;
  434|   312k|				pima->samples [indx] = bytecode & 0x0F ;
  435|   312k|				indx += pima->channels ;
  436|   312k|				pima->samples [indx] = (bytecode >> 4) & 0x0F ;
  437|   312k|				indx += pima->channels ;
  438|   312k|				} ;
  439|  78.1k|			} ;
  440|  77.3k|		indxstart += 8 * pima->channels ;
  441|  77.3k|		} ;
  442|       |
  443|       |	/* Decode the encoded 4 bit samples. */
  444|       |
  445|   241k|	for (k = pima->channels ; k < (pima->samplesperblock * pima->channels) ; k ++)
  ------------------
  |  Branch (445:28): [True: 163k, False: 77.5k]
  ------------------
  446|   163k|	{	chan = (pima->channels > 1) ? (k % 2) : 0 ;
  ------------------
  |  Branch (446:11): [True: 10.0k, False: 153k]
  ------------------
  447|       |
  448|   163k|		bytecode = pima->samples [k] & 0xF ;
  449|       |
  450|   163k|		step = ima_step_size [stepindx [chan]] ;
  451|   163k|		predictor = pima->samples [k - pima->channels] ;
  452|       |
  453|   163k|		diff = step >> 3 ;
  454|   163k|		if (bytecode & 1)
  ------------------
  |  Branch (454:7): [True: 33.8k, False: 130k]
  ------------------
  455|  33.8k|			diff += step >> 2 ;
  456|   163k|		if (bytecode & 2)
  ------------------
  |  Branch (456:7): [True: 32.0k, False: 131k]
  ------------------
  457|  32.0k|			diff += step >> 1 ;
  458|   163k|		if (bytecode & 4)
  ------------------
  |  Branch (458:7): [True: 42.2k, False: 121k]
  ------------------
  459|  42.2k|			diff += step ;
  460|   163k|		if (bytecode & 8)
  ------------------
  |  Branch (460:7): [True: 33.3k, False: 130k]
  ------------------
  461|  33.3k|			diff = -diff ;
  462|       |
  463|   163k|		predictor += diff ;
  464|       |
  465|   163k|		if (predictor > 32767)
  ------------------
  |  Branch (465:7): [True: 12.4k, False: 151k]
  ------------------
  466|  12.4k|			predictor = 32767 ;
  467|   151k|		else if (predictor < -32768)
  ------------------
  |  Branch (467:12): [True: 23.1k, False: 128k]
  ------------------
  468|  23.1k|			predictor = -32768 ;
  469|       |
  470|   163k|		stepindx [chan] += ima_indx_adjust [bytecode] ;
  471|   163k|		stepindx [chan] = clamp_ima_step_index (stepindx [chan]) ;
  472|       |
  473|   163k|		pima->samples [k] = predictor ;
  474|   163k|		} ;
  475|       |
  476|  77.5k|	return 1 ;
  477|  77.5k|} /* wavlike_ima_decode_block */
ima_adpcm.c:clamp_ima_step_index:
   95|   857k|{	if (indx < 0)
  ------------------
  |  Branch (95:7): [True: 468k, False: 389k]
  ------------------
   96|   468k|		return 0 ;
   97|   389k|	if (indx >= ARRAY_LEN (ima_step_size))
  ------------------
  |  |   93|   389k|#define		ARRAY_LEN(x)	((int) (sizeof (x) / sizeof ((x) [0])))
  ------------------
  |  Branch (97:6): [True: 156k, False: 233k]
  ------------------
   98|   156k|		return ARRAY_LEN (ima_step_size) - 1 ;
  ------------------
  |  |   93|   156k|#define		ARRAY_LEN(x)	((int) (sizeof (x) / sizeof ((x) [0])))
  ------------------
   99|       |
  100|   233k|	return indx ;
  101|   389k|} /* clamp_ima_step_index */
ima_adpcm.c:aiff_ima_decode_block:
  261|  5.81k|{	unsigned char *blockdata ;
  262|  5.81k|	int		chan, k, diff, bytecode, predictor ;
  263|  5.81k|	short	step, stepindx, *sampledata ;
  264|       |
  265|  5.81k|	pima->blockcount += pima->channels ;
  266|  5.81k|	pima->samplecount = 0 ;
  267|       |
  268|  5.81k|	if (pima->blockcount > pima->blocks)
  ------------------
  |  Branch (268:6): [True: 39, False: 5.77k]
  ------------------
  269|     39|	{	memset (pima->samples, 0, pima->samplesperblock * pima->channels * sizeof (short)) ;
  270|     39|		return 1 ;
  271|  5.77k|		} ;
  272|       |
  273|  5.77k|	if ((k = (int) psf_fread (pima->block, 1, pima->blocksize * pima->channels, psf)) != pima->blocksize * pima->channels)
  ------------------
  |  Branch (273:6): [True: 88, False: 5.68k]
  ------------------
  274|     88|		psf_log_printf (psf, "*** Warning : short read (%d != %d).\n", k, pima->blocksize) ;
  275|       |
  276|       |	/* Read and check the block header. */
  277|  15.2k|	for (chan = 0 ; chan < pima->channels ; chan++)
  ------------------
  |  Branch (277:18): [True: 9.47k, False: 5.77k]
  ------------------
  278|  9.47k|	{	blockdata = pima->block + chan * 34 ;
  279|  9.47k|		sampledata = pima->samples + chan ;
  280|       |
  281|       |		/* Sign-extend from 16 bits to 32. */
  282|  9.47k|		predictor = (int) ((short) ((blockdata [0] << 8) | (blockdata [1] & 0x80))) ;
  283|       |
  284|  9.47k|		stepindx = blockdata [1] & 0x7F ;
  285|  9.47k|		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|   312k|		for (k = 0 ; k < pima->blocksize - 2 ; k++)
  ------------------
  |  Branch (291:16): [True: 303k, False: 9.47k]
  ------------------
  292|   303k|		{	bytecode = blockdata [k + 2] ;
  293|   303k|			sampledata [pima->channels * (2 * k + 0)] = bytecode & 0xF ;
  294|   303k|			sampledata [pima->channels * (2 * k + 1)] = (bytecode >> 4) & 0xF ;
  295|   303k|			} ;
  296|       |
  297|       |		/* Decode the encoded 4 bit samples. */
  298|   615k|		for (k = 0 ; k < pima->samplesperblock ; k ++)
  ------------------
  |  Branch (298:16): [True: 606k, False: 9.47k]
  ------------------
  299|   606k|		{	step = ima_step_size [stepindx] ;
  300|       |
  301|   606k|			bytecode = pima->samples [pima->channels * k + chan] ;
  302|       |
  303|   606k|			stepindx += ima_indx_adjust [bytecode] ;
  304|   606k|			stepindx = clamp_ima_step_index (stepindx) ;
  305|       |
  306|   606k|			diff = step >> 3 ;
  307|   606k|			if (bytecode & 1)	diff += step >> 2 ;
  ------------------
  |  Branch (307:8): [True: 130k, False: 475k]
  ------------------
  308|   606k|			if (bytecode & 2)	diff += step >> 1 ;
  ------------------
  |  Branch (308:8): [True: 129k, False: 476k]
  ------------------
  309|   606k|			if (bytecode & 4)	diff += step ;
  ------------------
  |  Branch (309:8): [True: 131k, False: 475k]
  ------------------
  310|   606k|			if (bytecode & 8)	diff = -diff ;
  ------------------
  |  Branch (310:8): [True: 113k, False: 492k]
  ------------------
  311|       |
  312|   606k|			predictor += diff ;
  313|   606k|			if (predictor < -32768)
  ------------------
  |  Branch (313:8): [True: 76.0k, False: 530k]
  ------------------
  314|  76.0k|				predictor = -32768 ;
  315|   530k|			else if (predictor > 32767)
  ------------------
  |  Branch (315:13): [True: 47.0k, False: 483k]
  ------------------
  316|  47.0k|				predictor = 32767 ;
  317|       |
  318|   606k|			pima->samples [pima->channels * k + chan] = predictor ;
  319|   606k|			} ;
  320|  9.47k|		} ;
  321|       |
  322|  5.77k|	return 1 ;
  323|  5.81k|} /* aiff_ima_decode_block */
ima_adpcm.c:ima_read_block:
  569|   601k|{	int		count, total = 0, indx = 0 ;
  570|       |
  571|  1.20M|	while (indx < len)
  ------------------
  |  Branch (571:9): [True: 601k, False: 601k]
  ------------------
  572|   601k|	{	if (pima->blockcount >= pima->blocks && pima->samplecount >= pima->samplesperblock)
  ------------------
  |  Branch (572:8): [True: 7.74k, False: 593k]
  |  Branch (572:44): [True: 0, False: 7.74k]
  ------------------
  573|      0|		{	memset (&(ptr [indx]), 0, (size_t) ((len - indx) * sizeof (short))) ;
  574|      0|			return total ;
  575|   601k|			} ;
  576|       |
  577|   601k|		if (pima->samplecount >= pima->samplesperblock)
  ------------------
  |  Branch (577:7): [True: 83.0k, False: 518k]
  ------------------
  578|  83.0k|			pima->decode_block (psf, pima) ;
  579|       |
  580|   601k|		count = (pima->samplesperblock - pima->samplecount) * pima->channels ;
  581|   601k|		count = (len - indx > count) ? count : len - indx ;
  ------------------
  |  Branch (581:11): [True: 0, False: 601k]
  ------------------
  582|       |
  583|   601k|		memcpy (&(ptr [indx]), &(pima->samples [pima->samplecount * pima->channels]), count * sizeof (short)) ;
  584|   601k|		indx += count ;
  585|   601k|		pima->samplecount += count / pima->channels ;
  586|   601k|		total = indx ;
  587|   601k|		} ;
  588|       |
  589|   601k|	return total ;
  590|   601k|} /* ima_read_block */
ima_adpcm.c:ima_read_f:
  646|   601k|{	IMA_ADPCM_PRIVATE *pima ;
  647|   601k|	BUF_UNION	ubuf ;
  648|   601k|	short		*sptr ;
  649|   601k|	int			k, bufferlen, readcount, count ;
  650|   601k|	sf_count_t	total = 0 ;
  651|   601k|	float		normfact ;
  652|       |
  653|   601k|	if (! psf->codec_data)
  ------------------
  |  Branch (653:6): [True: 0, False: 601k]
  ------------------
  654|      0|		return 0 ;
  655|   601k|	pima = (IMA_ADPCM_PRIVATE*) psf->codec_data ;
  656|       |
  657|   601k|	normfact = (psf->norm_float == SF_TRUE) ? 1.0 / ((float) 0x8000) : 1.0 ;
  ------------------
  |  Branch (657:13): [True: 601k, False: 0]
  ------------------
  658|       |
  659|   601k|	sptr = ubuf.sbuf ;
  660|   601k|	bufferlen = ARRAY_LEN (ubuf.sbuf) ;
  ------------------
  |  |   93|   601k|#define		ARRAY_LEN(x)	((int) (sizeof (x) / sizeof ((x) [0])))
  ------------------
  661|  1.20M|	while (len > 0)
  ------------------
  |  Branch (661:9): [True: 601k, False: 601k]
  ------------------
  662|   601k|	{	readcount = (len >= bufferlen) ? bufferlen : (int) len ;
  ------------------
  |  Branch (662:16): [True: 0, False: 601k]
  ------------------
  663|   601k|		count = ima_read_block (psf, pima, sptr, readcount) ;
  664|  1.45M|		for (k = 0 ; k < readcount ; k++)
  ------------------
  |  Branch (664:16): [True: 849k, False: 601k]
  ------------------
  665|   849k|			ptr [total + k] = normfact * (float) (sptr [k]) ;
  666|   601k|		total += count ;
  667|   601k|		len -= readcount ;
  668|   601k|		if (count != readcount)
  ------------------
  |  Branch (668:7): [True: 0, False: 601k]
  ------------------
  669|      0|			break ;
  670|   601k|		} ;
  671|       |
  672|   601k|	return total ;
  673|   601k|} /* ima_read_f */

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

mat4_open:
   77|    762|{	int		subformat, error = 0 ;
   78|       |
   79|    762|	if (psf->file.mode == SFM_READ || (psf->file.mode == SFM_RDWR && psf->filelength > 0))
  ------------------
  |  Branch (79:6): [True: 762, False: 0]
  |  Branch (79:37): [True: 0, False: 0]
  |  Branch (79:67): [True: 0, False: 0]
  ------------------
   80|    762|	{	if ((error = mat4_read_header (psf)))
  ------------------
  |  Branch (80:8): [True: 509, False: 253]
  ------------------
   81|    509|			return error ;
   82|    762|		} ;
   83|       |
   84|    253|	if ((SF_CONTAINER (psf->sf.format)) != SF_FORMAT_MAT4)
  ------------------
  |  |  108|    253|#define SF_CONTAINER(x)		((x) & SF_FORMAT_TYPEMASK)
  ------------------
  |  Branch (84:6): [True: 0, False: 253]
  ------------------
   85|      0|		return	SFE_BAD_OPEN_FORMAT ;
   86|       |
   87|    253|	subformat = SF_CODEC (psf->sf.format) ;
  ------------------
  |  |  109|    253|#define SF_CODEC(x)			((x) & SF_FORMAT_SUBMASK)
  ------------------
   88|       |
   89|    253|	if (psf->file.mode == SFM_WRITE || psf->file.mode == SFM_RDWR)
  ------------------
  |  Branch (89:6): [True: 0, False: 253]
  |  Branch (89:37): [True: 0, False: 253]
  ------------------
   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) ;
  ------------------
  |  |  110|      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|    253|		} ;
  104|       |
  105|    253|	psf->container_close = mat4_close ;
  106|       |
  107|    253|	psf->blockwidth = (sf_count_t) psf->bytewidth * psf->sf.channels ;
  108|       |
  109|    253|	switch (subformat)
  110|    253|	{	case SF_FORMAT_PCM_16 :
  ------------------
  |  Branch (110:4): [True: 44, False: 209]
  ------------------
  111|     57|		case SF_FORMAT_PCM_32 :
  ------------------
  |  Branch (111:3): [True: 13, False: 240]
  ------------------
  112|     57|				error = pcm_init (psf) ;
  113|     57|				break ;
  114|       |
  115|     54|		case SF_FORMAT_FLOAT :
  ------------------
  |  Branch (115:3): [True: 54, False: 199]
  ------------------
  116|     54|				error = float32_init (psf) ;
  117|     54|				break ;
  118|       |
  119|    142|		case SF_FORMAT_DOUBLE :
  ------------------
  |  Branch (119:3): [True: 142, False: 111]
  ------------------
  120|    142|				error = double64_init (psf) ;
  121|    142|				break ;
  122|       |
  123|      0|		default : break ;
  ------------------
  |  Branch (123:3): [True: 0, False: 253]
  ------------------
  124|    253|		} ;
  125|       |
  126|    253|	return error ;
  127|    253|} /* mat4_open */
mat4.c:mat4_close:
  134|    253|{
  135|    253|	if (psf->file.mode == SFM_WRITE || psf->file.mode == SFM_RDWR)
  ------------------
  |  Branch (135:6): [True: 0, False: 253]
  |  Branch (135:37): [True: 0, False: 253]
  ------------------
  136|      0|		mat4_write_header (psf, SF_TRUE) ;
  137|       |
  138|    253|	return 0 ;
  139|    253|} /* mat4_close */
mat4.c:mat4_read_header:
  206|    762|{	char	buffer [256] ;
  207|    762|	uint32_t marker, namesize ;
  208|    762|	int		rows, cols, imag ;
  209|    762|	double	value ;
  210|    762|	const char *marker_str ;
  211|    762|	char	name [64] ;
  212|       |
  213|    762|	psf_binheader_readf (psf, "pm", 0, &marker) ;
  214|       |
  215|       |	/* MAT4 file must start with a double for the samplerate. */
  216|    762|	if (marker == MAT4_BE_DOUBLE)
  ------------------
  |  |   42|    762|#define MAT4_BE_DOUBLE	(MAKE_MARKER (0, 0, 0x03, 0xE8))
  |  |  ------------------
  |  |  |  |  122|    762|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (216:6): [True: 143, False: 619]
  ------------------
  217|    143|	{	psf->endian = psf->rwf_endian = SF_ENDIAN_BIG ;
  218|    143|		marker_str = "big endian double" ;
  219|    143|		}
  220|    619|	else if (marker == MAT4_LE_DOUBLE)
  ------------------
  |  |   43|    619|#define MAT4_LE_DOUBLE	(MAKE_MARKER (0, 0, 0, 0))
  |  |  ------------------
  |  |  |  |  122|    619|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (220:11): [True: 619, False: 0]
  ------------------
  221|    619|	{	psf->endian = psf->rwf_endian = SF_ENDIAN_LITTLE ;
  222|    619|		marker_str = "little endian double" ;
  223|    619|		}
  224|      0|	else
  225|      0|		return SFE_UNIMPLEMENTED ;
  226|       |
  227|    762|	psf_log_printf (psf, "GNU Octave 2.0 / MATLAB v4.2 format\nMarker : %s\n", marker_str) ;
  228|       |
  229|    762|	psf_binheader_readf (psf, "444", &rows, &cols, &imag) ;
  230|       |
  231|    762|	psf_log_printf (psf, " Rows  : %d\n Cols  : %d\n Imag  : %s\n", rows, cols, imag ? "True" : "False") ;
  ------------------
  |  Branch (231:78): [True: 678, False: 84]
  ------------------
  232|       |
  233|    762|	psf_binheader_readf (psf, "4", &namesize) ;
  234|       |
  235|    762|	if (namesize >= SIGNED_SIZEOF (name))
  ------------------
  |  |   91|    762|#define		SIGNED_SIZEOF(x)	((int) sizeof (x))
  ------------------
  |  Branch (235:6): [True: 33, False: 729]
  ------------------
  236|     33|		return SFE_MAT4_BAD_NAME ;
  237|       |
  238|    729|	psf_binheader_readf (psf, "b", name, namesize) ;
  239|    729|	name [namesize] = 0 ;
  240|       |
  241|    729|	psf_log_printf (psf, " Name  : %s\n", name) ;
  242|       |
  243|    729|	psf_binheader_readf (psf, "d", &value) ;
  244|       |
  245|    729|	snprintf (buffer, sizeof (buffer), " Value : %f\n", value) ;
  246|    729|	psf_log_printf (psf, buffer) ;
  247|       |
  248|    729|	if ((rows != 1) || (cols != 1))
  ------------------
  |  Branch (248:6): [True: 0, False: 729]
  |  Branch (248:21): [True: 0, False: 729]
  ------------------
  249|      0|		return SFE_MAT4_NO_SAMPLERATE ;
  250|       |
  251|    729|	psf->sf.samplerate = psf_lrint (value) ;
  252|       |
  253|       |	/* Now write out the audio data. */
  254|       |
  255|    729|	psf_binheader_readf (psf, "m", &marker) ;
  256|       |
  257|    729|	psf_log_printf (psf, "Marker : %s\n", mat4_marker_to_str (marker)) ;
  258|       |
  259|    729|	psf_binheader_readf (psf, "444", &rows, &cols, &imag) ;
  260|       |
  261|    729|	psf_log_printf (psf, " Rows  : %d\n Cols  : %d\n Imag  : %s\n", rows, cols, imag ? "True" : "False") ;
  ------------------
  |  Branch (261:78): [True: 218, False: 511]
  ------------------
  262|       |
  263|    729|	psf_binheader_readf (psf, "4", &namesize) ;
  264|       |
  265|    729|	if (namesize >= SIGNED_SIZEOF (name))
  ------------------
  |  |   91|    729|#define		SIGNED_SIZEOF(x)	((int) sizeof (x))
  ------------------
  |  Branch (265:6): [True: 39, False: 690]
  ------------------
  266|     39|		return SFE_MAT4_BAD_NAME ;
  267|       |
  268|    690|	psf_binheader_readf (psf, "b", name, namesize) ;
  269|    690|	name [namesize] = 0 ;
  270|       |
  271|    690|	psf_log_printf (psf, " Name  : %s\n", name) ;
  272|       |
  273|    690|	psf->dataoffset = psf_ftell (psf) ;
  274|       |
  275|    690|	if (rows == 0)
  ------------------
  |  Branch (275:6): [True: 173, False: 517]
  ------------------
  276|    173|	{	psf_log_printf (psf, "*** Error : zero channel count.\n") ;
  277|    173|		return SFE_CHANNEL_COUNT_ZERO ;
  278|    173|		}
  279|    517|	else if (rows > SF_MAX_CHANNELS)
  ------------------
  |  |  102|    517|#define		SF_MAX_CHANNELS		1024
  ------------------
  |  Branch (279:11): [True: 23, False: 494]
  ------------------
  280|     23|	{	psf_log_printf (psf, "*** Error : channel count %d > SF_MAX_CHANNELS.\n", rows) ;
  281|     23|		return SFE_CHANNEL_COUNT ;
  282|    494|		} ;
  283|       |
  284|    494|	psf->sf.channels	= rows ;
  285|    494|	psf->sf.frames		= cols ;
  286|       |
  287|    494|	psf->sf.format = psf->endian | SF_FORMAT_MAT4 ;
  288|    494|	switch (marker)
  289|    494|	{	case MAT4_BE_DOUBLE :
  ------------------
  |  |   42|      3|#define MAT4_BE_DOUBLE	(MAKE_MARKER (0, 0, 0x03, 0xE8))
  |  |  ------------------
  |  |  |  |  122|      3|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (289:4): [True: 3, False: 491]
  ------------------
  290|    142|		case MAT4_LE_DOUBLE :
  ------------------
  |  |   43|    142|#define MAT4_LE_DOUBLE	(MAKE_MARKER (0, 0, 0, 0))
  |  |  ------------------
  |  |  |  |  122|    142|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (290:3): [True: 139, False: 355]
  ------------------
  291|    142|				psf->sf.format |= SF_FORMAT_DOUBLE ;
  292|    142|				psf->bytewidth = 8 ;
  293|    142|				break ;
  294|       |
  295|      1|		case MAT4_BE_FLOAT :
  ------------------
  |  |   45|      1|#define MAT4_BE_FLOAT	(MAKE_MARKER (0, 0, 0x03, 0xF2))
  |  |  ------------------
  |  |  |  |  122|      1|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (295:3): [True: 1, False: 493]
  ------------------
  296|     54|		case MAT4_LE_FLOAT :
  ------------------
  |  |   46|     54|#define MAT4_LE_FLOAT	(MAKE_MARKER (0x0A, 0, 0, 0))
  |  |  ------------------
  |  |  |  |  122|     54|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (296:3): [True: 53, False: 441]
  ------------------
  297|     54|				psf->sf.format |= SF_FORMAT_FLOAT ;
  298|     54|				psf->bytewidth = 4 ;
  299|     54|				break ;
  300|       |
  301|      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 (301:3): [True: 1, False: 493]
  ------------------
  302|     13|		case MAT4_LE_PCM_32	:
  ------------------
  |  |   49|     13|#define MAT4_LE_PCM_32	(MAKE_MARKER (0x14, 0, 0, 0))
  |  |  ------------------
  |  |  |  |  122|     13|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (302:3): [True: 12, False: 482]
  ------------------
  303|     13|				psf->sf.format |= SF_FORMAT_PCM_32 ;
  304|     13|				psf->bytewidth = 4 ;
  305|     13|				break ;
  306|       |
  307|     12|		case MAT4_BE_PCM_16	:
  ------------------
  |  |   51|     12|#define MAT4_BE_PCM_16	(MAKE_MARKER (0, 0, 0x04, 0x06))
  |  |  ------------------
  |  |  |  |  122|     12|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (307:3): [True: 12, False: 482]
  ------------------
  308|     44|		case MAT4_LE_PCM_16	:
  ------------------
  |  |   52|     44|#define MAT4_LE_PCM_16	(MAKE_MARKER (0x1E, 0, 0, 0))
  |  |  ------------------
  |  |  |  |  122|     44|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (308:3): [True: 32, False: 462]
  ------------------
  309|     44|				psf->sf.format |= SF_FORMAT_PCM_16 ;
  310|     44|				psf->bytewidth = 2 ;
  311|     44|				break ;
  312|       |
  313|    241|		default :
  ------------------
  |  Branch (313:3): [True: 241, False: 253]
  ------------------
  314|    241|				psf_log_printf (psf, "*** Error : Bad marker %08X\n", marker) ;
  315|    241|				return SFE_UNIMPLEMENTED ;
  316|    494|		} ;
  317|       |
  318|    253|	if ((psf->filelength - psf->dataoffset) < psf->sf.channels * psf->sf.frames * psf->bytewidth)
  ------------------
  |  Branch (318:6): [True: 5, False: 248]
  ------------------
  319|      5|	{	psf_log_printf (psf, "*** File seems to be truncated. %D <--> %D\n",
  320|      5|				psf->filelength - psf->dataoffset, psf->sf.channels * psf->sf.frames * psf->bytewidth) ;
  321|      5|		}
  322|    248|	else if ((psf->filelength - psf->dataoffset) > psf->sf.channels * psf->sf.frames * psf->bytewidth)
  ------------------
  |  Branch (322:11): [True: 219, False: 29]
  ------------------
  323|    219|		psf->dataend = psf->dataoffset + (sf_count_t) rows * (sf_count_t) cols * psf->bytewidth ;
  324|       |
  325|    253|	psf->datalength = psf->filelength - psf->dataoffset - psf->dataend ;
  326|       |
  327|    253|	psf->sf.sections = 1 ;
  328|       |
  329|    253|	return 0 ;
  330|    494|} /* mat4_read_header */
mat4.c:mat4_marker_to_str:
  368|    729|{	static char str [32] ;
  369|       |
  370|    729|	switch (marker)
  ------------------
  |  Branch (370:10): [True: 347, False: 382]
  ------------------
  371|    729|	{
  372|     14|		case MAT4_BE_PCM_16	:	return "big endian 16 bit PCM" ;
  ------------------
  |  |   51|     14|#define MAT4_BE_PCM_16	(MAKE_MARKER (0, 0, 0x04, 0x06))
  |  |  ------------------
  |  |  |  |  122|     14|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (372:3): [True: 14, False: 715]
  ------------------
  373|     33|		case MAT4_LE_PCM_16	:	return "little endian 16 bit PCM" ;
  ------------------
  |  |   52|     33|#define MAT4_LE_PCM_16	(MAKE_MARKER (0x1E, 0, 0, 0))
  |  |  ------------------
  |  |  |  |  122|     33|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (373:3): [True: 33, False: 696]
  ------------------
  374|       |
  375|      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 (375:3): [True: 2, False: 727]
  ------------------
  376|     13|		case MAT4_LE_PCM_32	:	return "little endian 32 bit PCM" ;
  ------------------
  |  |   49|     13|#define MAT4_LE_PCM_32	(MAKE_MARKER (0x14, 0, 0, 0))
  |  |  ------------------
  |  |  |  |  122|     13|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (376:3): [True: 13, False: 716]
  ------------------
  377|       |
  378|       |
  379|      2|		case MAT4_BE_FLOAT :	return "big endian float" ;
  ------------------
  |  |   45|      2|#define MAT4_BE_FLOAT	(MAKE_MARKER (0, 0, 0x03, 0xF2))
  |  |  ------------------
  |  |  |  |  122|      2|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (379:3): [True: 2, False: 727]
  ------------------
  380|     55|		case MAT4_LE_FLOAT :	return "big endian float" ;
  ------------------
  |  |   46|     55|#define MAT4_LE_FLOAT	(MAKE_MARKER (0x0A, 0, 0, 0))
  |  |  ------------------
  |  |  |  |  122|     55|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (380:3): [True: 55, False: 674]
  ------------------
  381|       |
  382|      4|		case MAT4_BE_DOUBLE	:	return "big endian double" ;
  ------------------
  |  |   42|      4|#define MAT4_BE_DOUBLE	(MAKE_MARKER (0, 0, 0x03, 0xE8))
  |  |  ------------------
  |  |  |  |  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: 725]
  ------------------
  383|    224|		case MAT4_LE_DOUBLE	:	return "little endian double" ;
  ------------------
  |  |   43|    224|#define MAT4_LE_DOUBLE	(MAKE_MARKER (0, 0, 0, 0))
  |  |  ------------------
  |  |  |  |  122|    224|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (383:3): [True: 224, False: 505]
  ------------------
  384|    729|		} ;
  385|       |
  386|       |	/* This is a little unsafe but is really only for debugging. */
  387|    382|	str [sizeof (str) - 1] = 0 ;
  388|    382|	snprintf (str, sizeof (str) - 1, "%08X", marker) ;
  389|    382|	return str ;
  390|    729|} /* mat4_marker_to_str */

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

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

mpeg_init:
  153|      4|{
  154|      4|	psf_log_printf (psf, "This version of libsndfile was compiled without MPEG support.\n") ;
  155|      4|	return SFE_UNIMPLEMENTED ;
  156|      4|} /* 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|    178|{	MSADPCM_PRIVATE	*pms ;
  120|    178|	unsigned int	pmssize ;
  121|    178|	int				count ;
  122|       |
  123|    178|	if (psf->codec_data != NULL)
  ------------------
  |  Branch (123:6): [True: 0, False: 178]
  ------------------
  124|      0|	{	psf_log_printf (psf, "*** psf->codec_data is not NULL.\n") ;
  125|      0|		return SFE_INTERNAL ;
  126|    178|		} ;
  127|       |
  128|    178|	if (psf->file.mode == SFM_WRITE)
  ------------------
  |  Branch (128:6): [True: 0, False: 178]
  ------------------
  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|    178|	if (samplesperblock < 7 * psf->sf.channels)
  ------------------
  |  Branch (132:6): [True: 3, False: 175]
  ------------------
  133|      3|	{	psf_log_printf (psf, "*** Error samplesperblock (%d) should be >= %d.\n", samplesperblock, 7 * psf->sf.channels) ;
  134|      3|		return SFE_INTERNAL ;
  135|    175|		} ;
  136|       |
  137|    175|	if (2 * blockalign < samplesperblock * psf->sf.channels)
  ------------------
  |  Branch (137:6): [True: 1, False: 174]
  ------------------
  138|      1|	{	psf_log_printf (psf, "*** Error blockalign (%d) should be >= %d.\n", blockalign, samplesperblock * psf->sf.channels / 2) ;
  139|      1|		return SFE_INTERNAL ;
  140|    174|		} ;
  141|       |
  142|    174|	pmssize = sizeof (MSADPCM_PRIVATE) + blockalign + 3 * psf->sf.channels * samplesperblock ;
  143|       |
  144|    174|	if (! (psf->codec_data = calloc (1, pmssize)))
  ------------------
  |  Branch (144:6): [True: 0, False: 174]
  ------------------
  145|      0|		return SFE_MALLOC_FAILED ;
  146|    174|	pms = (MSADPCM_PRIVATE*) psf->codec_data ;
  147|       |
  148|    174|	pms->sync_error = 0 ;
  149|    174|	pms->samples	= pms->dummydata ;
  150|    174|	pms->block		= (unsigned char*) (pms->dummydata + psf->sf.channels * samplesperblock) ;
  151|       |
  152|    174|	pms->channels	= psf->sf.channels ;
  153|    174|	pms->blocksize	= blockalign ;
  154|    174|	pms->samplesperblock = samplesperblock ;
  155|       |
  156|    174|	if (pms->blocksize <= 0)
  ------------------
  |  Branch (156:6): [True: 0, False: 174]
  ------------------
  157|      0|	{	psf_log_printf (psf, "*** Error : pms->blocksize should be > 0.\n") ;
  158|      0|		return SFE_INTERNAL ;
  159|    174|		} ;
  160|       |
  161|    174|	if (psf->file.mode == SFM_READ)
  ------------------
  |  Branch (161:6): [True: 174, False: 0]
  ------------------
  162|    174|	{	pms->dataremaining = psf->datalength ;
  163|       |
  164|    174|		if (psf->datalength % pms->blocksize)
  ------------------
  |  Branch (164:7): [True: 114, False: 60]
  ------------------
  165|    114|			pms->blocks = psf->datalength / pms->blocksize + 1 ;
  166|     60|		else
  167|     60|			pms->blocks = psf->datalength / pms->blocksize ;
  168|       |
  169|    174|		count = 2 * (pms->blocksize - 6 * pms->channels) / pms->channels ;
  170|    174|		if (pms->samplesperblock != count)
  ------------------
  |  Branch (170:7): [True: 14, False: 160]
  ------------------
  171|     14|		{	psf_log_printf (psf, "*** Error : samplesperblock should be %d.\n", count) ;
  172|     14|			return SFE_INTERNAL ;
  173|    160|			} ;
  174|       |
  175|    160|		psf->sf.frames = (psf->datalength / pms->blocksize) * pms->samplesperblock ;
  176|       |
  177|    160|		msadpcm_decode_block (psf, pms) ;
  178|       |
  179|    160|		psf->read_short		= msadpcm_read_s ;
  180|    160|		psf->read_int		= msadpcm_read_i ;
  181|    160|		psf->read_float		= msadpcm_read_f ;
  182|    160|		psf->read_double	= msadpcm_read_d ;
  183|    160|		} ;
  184|       |
  185|    160|	if (psf->file.mode == SFM_WRITE)
  ------------------
  |  Branch (185:6): [True: 0, False: 160]
  ------------------
  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|    160|	psf->codec_close = msadpcm_close ;
  197|    160|	psf->seek = msadpcm_seek ;
  198|       |
  199|    160|	return 0 ;
  200|    174|} /* wavlike_msadpcm_init */
ms_adpcm.c:msadpcm_decode_block:
  218|  25.4k|{	int		chan, k, blockindx, sampleindx ;
  219|  25.4k|	short	bytecode, bpred [2], chan_idelta [2] ;
  220|       |
  221|  25.4k|	int predict ;
  222|  25.4k|	int current ;
  223|  25.4k|	int idelta ;
  224|       |
  225|  25.4k|	pms->blockcount ++ ;
  226|  25.4k|	pms->samplecount = 0 ;
  227|       |
  228|  25.4k|	if (pms->blockcount > pms->blocks)
  ------------------
  |  Branch (228:6): [True: 4, False: 25.4k]
  ------------------
  229|      4|	{	memset (pms->samples, 0, pms->samplesperblock * pms->channels) ;
  230|      4|		return 1 ;
  231|  25.4k|		} ;
  232|       |
  233|  25.4k|	if ((k = (int) psf_fread (pms->block, 1, pms->blocksize, psf)) != pms->blocksize)
  ------------------
  |  Branch (233:6): [True: 115, False: 25.3k]
  ------------------
  234|    115|	{	psf_log_printf (psf, "*** Warning : short read (%d != %d).\n", k, pms->blocksize) ;
  235|    115|		if (k <= 0)
  ------------------
  |  Branch (235:7): [True: 3, False: 112]
  ------------------
  236|      3|			return 1 ;
  237|  25.4k|		} ;
  238|       |
  239|       |	/* Read and check the block header. */
  240|       |
  241|  25.4k|	if (pms->channels == 1)
  ------------------
  |  Branch (241:6): [True: 1.28k, False: 24.1k]
  ------------------
  242|  1.28k|	{	bpred [0] = msadpcm_get_bpred (psf, pms, pms->block [0]) ;
  243|       |
  244|  1.28k|		chan_idelta [0] = pms->block [1] | (pms->block [2] << 8) ;
  245|  1.28k|		chan_idelta [1] = 0 ;
  246|       |
  247|  1.28k|		pms->samples [1] = pms->block [3] | (pms->block [4] << 8) ;
  248|  1.28k|		pms->samples [0] = pms->block [5] | (pms->block [6] << 8) ;
  249|  1.28k|		blockindx = 7 ;
  250|  1.28k|		}
  251|  24.1k|	else
  252|  24.1k|	{	bpred [0] = msadpcm_get_bpred (psf, pms, pms->block [0]) ;
  253|  24.1k|		bpred [1] = msadpcm_get_bpred (psf, pms, pms->block [1]) ;
  254|       |
  255|  24.1k|		chan_idelta [0] = pms->block [2] | (pms->block [3] << 8) ;
  256|  24.1k|		chan_idelta [1] = pms->block [4] | (pms->block [5] << 8) ;
  257|       |
  258|  24.1k|		pms->samples [2] = pms->block [6] | (pms->block [7] << 8) ;
  259|  24.1k|		pms->samples [3] = pms->block [8] | (pms->block [9] << 8) ;
  260|       |
  261|  24.1k|		pms->samples [0] = pms->block [10] | (pms->block [11] << 8) ;
  262|  24.1k|		pms->samples [1] = pms->block [12] | (pms->block [13] << 8) ;
  263|       |
  264|  24.1k|		blockindx = 14 ;
  265|  24.1k|		} ;
  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|  25.4k|	sampleindx = 2 * pms->channels ;
  283|   813k|	while (blockindx < pms->blocksize)
  ------------------
  |  Branch (283:9): [True: 788k, False: 25.4k]
  ------------------
  284|   788k|	{	bytecode = pms->block [blockindx++] ;
  285|   788k|		pms->samples [sampleindx++] = (bytecode >> 4) & 0x0F ;
  286|   788k|		pms->samples [sampleindx++] = bytecode & 0x0F ;
  287|   788k|		} ;
  288|       |
  289|       |	/* Decode the encoded 4 bit samples. */
  290|       |
  291|  1.60M|	for (k = 2 * pms->channels ; k < (pms->samplesperblock * pms->channels) ; k ++)
  ------------------
  |  Branch (291:31): [True: 1.57M, False: 25.4k]
  ------------------
  292|  1.57M|	{	chan = (pms->channels > 1) ? (k % 2) : 0 ;
  ------------------
  |  Branch (292:11): [True: 1.54M, False: 30.5k]
  ------------------
  293|       |
  294|  1.57M|		bytecode = pms->samples [k] & 0xF ;
  295|       |
  296|       |		/* Compute next Adaptive Scale Factor (ASF) */
  297|  1.57M|		idelta = chan_idelta [chan] ;
  298|  1.57M|		chan_idelta [chan] = (AdaptationTable [bytecode] * idelta) >> 8 ;	/* => / 256 => FIXED_POINT_ADAPTATION_BASE == 256 */
  299|  1.57M|		if (chan_idelta [chan] < 16)
  ------------------
  |  Branch (299:7): [True: 1.52M, False: 48.7k]
  ------------------
  300|  1.52M|			chan_idelta [chan] = 16 ;
  301|  1.57M|		if (bytecode & 0x8)
  ------------------
  |  Branch (301:7): [True: 19.3k, False: 1.55M]
  ------------------
  302|  19.3k|			bytecode -= 0x10 ;
  303|       |
  304|  1.57M|		predict = ((pms->samples [k - pms->channels] * AdaptCoeff1 [bpred [chan]])
  305|  1.57M|					+ (pms->samples [k - 2 * pms->channels] * AdaptCoeff2 [bpred [chan]])) >> 8 ; /* => / 256 => FIXED_POINT_COEFF_BASE == 256 */
  306|  1.57M|		current = (bytecode * idelta) + predict ;
  307|       |
  308|  1.57M|		if (current > 32767)
  ------------------
  |  Branch (308:7): [True: 16.9k, False: 1.55M]
  ------------------
  309|  16.9k|			current = 32767 ;
  310|  1.55M|		else if (current < -32768)
  ------------------
  |  Branch (310:12): [True: 9.94k, False: 1.54M]
  ------------------
  311|  9.94k|			current = -32768 ;
  312|       |
  313|  1.57M|		pms->samples [k] = current ;
  314|  1.57M|		} ;
  315|       |
  316|  25.4k|	return 0 ;
  317|  25.4k|} /* msadpcm_decode_block */
ms_adpcm.c:msadpcm_get_bpred:
  205|  49.5k|{	if (value >= WAVLIKE_MSADPCM_ADAPT_COEFF_COUNT)
  ------------------
  |  |  343|  49.5k|#define	WAVLIKE_MSADPCM_ADAPT_COEFF_COUNT	7
  ------------------
  |  Branch (205:7): [True: 2.33k, False: 47.2k]
  ------------------
  206|  2.33k|	{	if (pms->sync_error == 0)
  ------------------
  |  Branch (206:8): [True: 118, False: 2.21k]
  ------------------
  207|    118|		{	pms->sync_error = 1 ;
  208|    118|			psf_log_printf (psf, "MS ADPCM synchronisation error (%u should be < %u).\n", value, WAVLIKE_MSADPCM_ADAPT_COEFF_COUNT) ;
  ------------------
  |  |  343|    118|#define	WAVLIKE_MSADPCM_ADAPT_COEFF_COUNT	7
  ------------------
  209|    118|			} ;
  210|  2.33k|		return 0 ;
  211|  47.2k|		} ;
  212|  47.2k|	return value ;
  213|  49.5k|} /* msadpcm_get_bpred */
ms_adpcm.c:msadpcm_read_block:
  321|   808k|{	int	count, total = 0, indx = 0 ;
  322|       |
  323|  1.61M|	while (indx < len)
  ------------------
  |  Branch (323:9): [True: 808k, False: 808k]
  ------------------
  324|   808k|	{	if (pms->blockcount >= pms->blocks && pms->samplecount >= pms->samplesperblock)
  ------------------
  |  Branch (324:8): [True: 962, False: 807k]
  |  Branch (324:42): [True: 0, False: 962]
  ------------------
  325|      0|		{	memset (&(ptr [indx]), 0, (size_t) ((len - indx) * sizeof (short))) ;
  326|      0|			return total ;
  327|   808k|			} ;
  328|       |
  329|   808k|		if (pms->samplecount >= pms->samplesperblock)
  ------------------
  |  Branch (329:7): [True: 25.2k, False: 783k]
  ------------------
  330|  25.2k|			if (msadpcm_decode_block (psf, pms) != 0)
  ------------------
  |  Branch (330:8): [True: 0, False: 25.2k]
  ------------------
  331|      0|				return total ;
  332|       |
  333|   808k|		count = (pms->samplesperblock - pms->samplecount) * pms->channels ;
  334|   808k|		count = (len - indx > count) ? count : len - indx ;
  ------------------
  |  Branch (334:11): [True: 0, False: 808k]
  ------------------
  335|       |
  336|   808k|		memcpy (&(ptr [indx]), &(pms->samples [pms->samplecount * pms->channels]), count * sizeof (short)) ;
  337|   808k|		indx += count ;
  338|   808k|		pms->samplecount += count / pms->channels ;
  339|   808k|		total = indx ;
  340|   808k|		} ;
  341|       |
  342|   808k|	return total ;
  343|   808k|} /* msadpcm_read_block */
ms_adpcm.c:msadpcm_read_f:
  402|   808k|{	MSADPCM_PRIVATE *pms ;
  403|   808k|	BUF_UNION	ubuf ;
  404|   808k|	short		*sptr ;
  405|   808k|	int			k, bufferlen, readcount = 0, count ;
  406|   808k|	sf_count_t	total = 0 ;
  407|   808k|	float		normfact ;
  408|       |
  409|   808k|	if (! psf->codec_data)
  ------------------
  |  Branch (409:6): [True: 0, False: 808k]
  ------------------
  410|      0|		return 0 ;
  411|   808k|	pms = (MSADPCM_PRIVATE*) psf->codec_data ;
  412|       |
  413|   808k|	normfact = (psf->norm_float == SF_TRUE) ? 1.0 / ((float) 0x8000) : 1.0 ;
  ------------------
  |  Branch (413:13): [True: 808k, False: 0]
  ------------------
  414|   808k|	sptr = ubuf.sbuf ;
  415|   808k|	bufferlen = ARRAY_LEN (ubuf.sbuf) ;
  ------------------
  |  |   93|   808k|#define		ARRAY_LEN(x)	((int) (sizeof (x) / sizeof ((x) [0])))
  ------------------
  416|  1.61M|	while (len > 0)
  ------------------
  |  Branch (416:9): [True: 808k, False: 808k]
  ------------------
  417|   808k|	{	readcount = (len >= bufferlen) ? bufferlen : (int) len ;
  ------------------
  |  Branch (417:16): [True: 0, False: 808k]
  ------------------
  418|       |
  419|   808k|		if ((count = (int) msadpcm_read_block (psf, pms, sptr, readcount)) <= 0)
  ------------------
  |  Branch (419:7): [True: 0, False: 808k]
  ------------------
  420|      0|			return -1 ;
  421|       |
  422|  2.41M|		for (k = 0 ; k < readcount ; k++)
  ------------------
  |  Branch (422:16): [True: 1.60M, False: 808k]
  ------------------
  423|  1.60M|			ptr [total + k] = normfact * (float) (sptr [k]) ;
  424|   808k|		total += count ;
  425|   808k|		len -= readcount ;
  426|   808k|		if (count != readcount)
  ------------------
  |  Branch (426:7): [True: 0, False: 808k]
  ------------------
  427|      0|			break ;
  428|   808k|		} ;
  429|   808k|	return total ;
  430|   808k|} /* msadpcm_read_f */
ms_adpcm.c:msadpcm_close:
  785|    160|{	MSADPCM_PRIVATE *pms ;
  786|       |
  787|    160|	pms = (MSADPCM_PRIVATE*) psf->codec_data ;
  788|       |
  789|    160|	if (psf->file.mode == SFM_WRITE)
  ------------------
  |  Branch (789:6): [True: 0, False: 160]
  ------------------
  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|    160|	return 0 ;
  799|    160|} /* msadpcm_close */

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

nms_adpcm_init:
 1026|    256|{	NMS_ADPCM_PRIVATE	*pnms ;
 1027|       |
 1028|    256|	if (psf->codec_data != NULL)
  ------------------
  |  Branch (1028:6): [True: 0, False: 256]
  ------------------
 1029|      0|	{	psf_log_printf (psf, "*** psf->codec_data is not NULL.\n") ;
 1030|      0|		return SFE_INTERNAL ;
 1031|    256|		} ;
 1032|       |
 1033|    256|	psf->sf.seekable = SF_FALSE ;
 1034|       |
 1035|    256|	if (psf->sf.channels != 1)
  ------------------
  |  Branch (1035:6): [True: 0, False: 256]
  ------------------
 1036|      0|		return SFE_NMS_ADPCM_NOT_MONO ;
 1037|       |
 1038|    256|	if ((pnms = calloc (1, sizeof (NMS_ADPCM_PRIVATE))) == NULL)
  ------------------
  |  Branch (1038:6): [True: 0, False: 256]
  ------------------
 1039|      0|		return SFE_MALLOC_FAILED ;
 1040|       |
 1041|    256|	psf->codec_data = (void*) pnms ;
 1042|       |
 1043|    256|	pnms->block_curr = 0 ;
 1044|    256|	pnms->sample_curr = 0 ;
 1045|       |
 1046|    256|	switch (SF_CODEC (psf->sf.format))
  ------------------
  |  |  109|    256|#define SF_CODEC(x)			((x) & SF_FORMAT_SUBMASK)
  ------------------
 1047|    256|	{	case SF_FORMAT_NMS_ADPCM_16 :
  ------------------
  |  Branch (1047:4): [True: 181, False: 75]
  ------------------
 1048|    181|					pnms->type = NMS16 ;
 1049|    181|					pnms->shortsperblock = NMS_BLOCK_SHORTS_16 ;
  ------------------
  |  |   46|    181|#define NMS_BLOCK_SHORTS_16 21
  ------------------
 1050|    181|					break ;
 1051|     37|		case SF_FORMAT_NMS_ADPCM_24 :
  ------------------
  |  Branch (1051:3): [True: 37, False: 219]
  ------------------
 1052|     37|					pnms->type = NMS24 ;
 1053|     37|					pnms->shortsperblock = NMS_BLOCK_SHORTS_24 ;
  ------------------
  |  |   45|     37|#define NMS_BLOCK_SHORTS_24 31
  ------------------
 1054|     37|					break ;
 1055|     38|		case SF_FORMAT_NMS_ADPCM_32 :
  ------------------
  |  Branch (1055:3): [True: 38, False: 218]
  ------------------
 1056|     38|					pnms->type = NMS32 ;
 1057|     38|					pnms->shortsperblock = NMS_BLOCK_SHORTS_32 ;
  ------------------
  |  |   44|     38|#define NMS_BLOCK_SHORTS_32 41
  ------------------
 1058|     38|					break ;
 1059|       |
 1060|      0|		default : return SFE_UNIMPLEMENTED ;
  ------------------
  |  Branch (1060:3): [True: 0, False: 256]
  ------------------
 1061|    256|	} ;
 1062|    256|	nms_adpcm_codec_init (&pnms->state, pnms->type) ;
 1063|       |
 1064|    256|	psf->filelength = psf_get_filelen (psf) ;
 1065|    256|	if (psf->filelength < psf->dataoffset)
  ------------------
  |  Branch (1065:6): [True: 0, False: 256]
  ------------------
 1066|      0|		psf->filelength = psf->dataoffset ;
 1067|       |
 1068|    256|	psf->datalength = psf->filelength - psf->dataoffset ;
 1069|    256|	if (psf->dataend > 0)
  ------------------
  |  Branch (1069:6): [True: 16, False: 240]
  ------------------
 1070|     16|		psf->datalength -= psf->filelength - psf->dataend ;
 1071|       |
 1072|    256|	if (psf->file.mode == SFM_READ)
  ------------------
  |  Branch (1072:6): [True: 256, False: 0]
  ------------------
 1073|    256|	{	psf->read_short		= nms_adpcm_read_s ;
 1074|    256|		psf->read_int		= nms_adpcm_read_i ;
 1075|    256|		psf->read_float		= nms_adpcm_read_f ;
 1076|    256|		psf->read_double	= nms_adpcm_read_d ;
 1077|    256|		}
 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|    256|	if (psf->datalength % (pnms->shortsperblock * sizeof (short)))
  ------------------
  |  Branch (1085:6): [True: 235, False: 21]
  ------------------
 1086|    235|	{	psf_log_printf (psf, "*** Odd psf->datalength (%D) should be a multiple of %d\n",
 1087|    235|						psf->datalength, pnms->shortsperblock * sizeof (short)) ;
 1088|    235|		pnms->blocks_total = (psf->datalength / (pnms->shortsperblock * sizeof (short))) + 1 ;
 1089|    235|		}
 1090|     21|	else
 1091|     21|		pnms->blocks_total = psf->datalength / (pnms->shortsperblock * sizeof (short)) ;
 1092|       |
 1093|    256|	psf->sf.frames		= (sf_count_t) pnms->blocks_total * NMS_SAMPLES_PER_BLOCK ;
  ------------------
  |  |   43|    256|#define NMS_SAMPLES_PER_BLOCK 160
  ------------------
 1094|    256|	psf->codec_close	= nms_adpcm_close ;
 1095|    256|	psf->seek			= nms_adpcm_seek ;
 1096|       |
 1097|    256|	return 0 ;
 1098|    256|} /* nms_adpcm_init */
nms_adpcm.c:nms_adpcm_codec_init:
  303|    256|{	memset (s, 0, sizeof (struct nms_adpcm_state)) ;
  304|    256|	s->t_off = (type == NMS32) ? 16 : (type == NMS24) ? 8 : 0 ;
  ------------------
  |  Branch (304:13): [True: 38, False: 218]
  |  Branch (304:36): [True: 37, False: 181]
  ------------------
  305|    256|} /* nms_adpcm_codec_init */
nms_adpcm.c:nms_adpcm_read_block:
  719|  6.51M|{	int	count, indx = 0 ;
  720|       |
  721|  13.0M|	while (indx < len)
  ------------------
  |  Branch (721:9): [True: 6.51M, False: 6.51M]
  ------------------
  722|  6.51M|	{	if (pnms->sample_curr >= NMS_SAMPLES_PER_BLOCK)
  ------------------
  |  |   43|  6.51M|#define NMS_SAMPLES_PER_BLOCK 160
  ------------------
  |  Branch (722:8): [True: 40.4k, False: 6.47M]
  ------------------
  723|  40.4k|		{	pnms->block_curr ++ ;
  724|  40.4k|			pnms->sample_curr = 0 ;
  725|  40.4k|			} ;
  726|       |
  727|  6.51M|		if (pnms->block_curr > pnms->blocks_total)
  ------------------
  |  Branch (727:7): [True: 0, False: 6.51M]
  ------------------
  728|      0|		{	memset (&(ptr [indx]), 0, (len - indx) * sizeof (short)) ;
  729|      0|			return indx ;
  730|  6.51M|			} ;
  731|       |
  732|  6.51M|		if (pnms->sample_curr == 0)
  ------------------
  |  Branch (732:7): [True: 40.7k, False: 6.47M]
  ------------------
  733|  40.7k|			psf_nms_adpcm_decode_block (psf, pnms) ;
  734|       |
  735|  6.51M|		count = NMS_SAMPLES_PER_BLOCK - pnms->sample_curr ;
  ------------------
  |  |   43|  6.51M|#define NMS_SAMPLES_PER_BLOCK 160
  ------------------
  736|  6.51M|		if (len - indx < count)
  ------------------
  |  Branch (736:7): [True: 6.47M, False: 40.7k]
  ------------------
  737|  6.47M|			count = len - indx ;
  738|       |
  739|  6.51M|		memcpy (&(ptr [indx]), &(pnms->samples [pnms->sample_curr]), count * sizeof (short)) ;
  740|  6.51M|		indx += count ;
  741|  6.51M|		pnms->sample_curr += count ;
  742|  6.51M|		} ;
  743|       |
  744|  6.51M|	return indx ;
  745|  6.51M|} /* nms_adpcm_read_block */
nms_adpcm.c:psf_nms_adpcm_decode_block:
  702|  40.7k|{	int k ;
  703|       |
  704|  40.7k|	if ((k = (int) psf_fread (pnms->block, sizeof (short), pnms->shortsperblock, psf)) != pnms->shortsperblock)
  ------------------
  |  Branch (704:6): [True: 228, False: 40.4k]
  ------------------
  705|    228|	{	psf_log_printf (psf, "*** Warning : short read (%d != %d).\n", k, pnms->shortsperblock) ;
  706|    228|		memset (pnms->block + k, 0, (pnms->shortsperblock - k) * sizeof (short)) ;
  707|    228|		} ;
  708|       |
  709|  40.7k|	if (CPU_IS_BIG_ENDIAN)
  ------------------
  |  |   11|  40.7k|#define CPU_IS_BIG_ENDIAN 0
  |  |  ------------------
  |  |  |  Branch (11:27): [Folded, False: 40.7k]
  |  |  ------------------
  ------------------
  710|      0|		endswap_short_array ((signed short *) pnms->block, pnms->shortsperblock) ;
  711|       |
  712|  40.7k|	nms_adpcm_decode_block (psf, pnms, pnms->block, pnms->samples) ;
  713|       |
  714|  40.7k|	return 1 ;
  715|  40.7k|} /* nms_adpcm_decode_block */
nms_adpcm.c:nms_adpcm_decode_block:
  638|  40.7k|{	int k ;
  639|       |
  640|  40.7k|	switch (pnms->type)
  641|  40.7k|	{	case NMS16 :
  ------------------
  |  Branch (641:4): [True: 38.8k, False: 1.82k]
  ------------------
  642|  38.8k|			nms_adpcm_block_unpack_16 (block, samples, NULL) ;
  643|  38.8k|			break ;
  644|  1.09k|		case NMS24 :
  ------------------
  |  Branch (644:3): [True: 1.09k, False: 39.6k]
  ------------------
  645|  1.09k|			nms_adpcm_block_unpack_24 (block, samples, NULL) ;
  646|  1.09k|			break ;
  647|    729|		case NMS32 :
  ------------------
  |  Branch (647:3): [True: 729, False: 39.9k]
  ------------------
  648|    729|			nms_adpcm_block_unpack_32 (block, samples, NULL) ;
  649|    729|			break ;
  650|       |
  651|      0|		default :
  ------------------
  |  Branch (651:3): [True: 0, False: 40.7k]
  ------------------
  652|      0|			psf_log_printf (psf, "*** Error : Unhandled NMS ADPCM type %d.\n", pnms->type) ;
  653|      0|			return 0 ;
  654|  40.7k|		} ;
  655|       |
  656|  6.55M|	for (k = 0 ; k < NMS_SAMPLES_PER_BLOCK ; k++)
  ------------------
  |  |   43|  6.55M|#define NMS_SAMPLES_PER_BLOCK 160
  ------------------
  |  Branch (656:15): [True: 6.51M, False: 40.7k]
  ------------------
  657|  6.51M|		samples [k] = nms_adpcm_decode_sample (&pnms->state, samples [k]) ;
  658|       |
  659|  40.7k|	return NMS_SAMPLES_PER_BLOCK ;
  ------------------
  |  |   43|  40.7k|#define NMS_SAMPLES_PER_BLOCK 160
  ------------------
  660|  40.7k|} /* nms_adpcm_decode_block */
nms_adpcm.c:nms_adpcm_block_unpack_16:
  453|  38.8k|{	int k ;
  454|  38.8k|	uint16_t w = 0 ;
  455|       |
  456|  1.59M|	for (k = 0 ; k < NMS_SAMPLES_PER_BLOCK ; )
  ------------------
  |  |   43|  1.59M|#define NMS_SAMPLES_PER_BLOCK 160
  ------------------
  |  Branch (456:15): [True: 1.55M, False: 38.8k]
  ------------------
  457|  1.55M|	{	/*
  458|       |		** k % 8 == [0-3]: Top 2-bits of a nibble
  459|       |		** k % 8 == [4-7]: Bottom 2-bits of a nibble
  460|       |		*/
  461|  1.55M|		if ((k & 4) == 0)
  ------------------
  |  Branch (461:7): [True: 777k, False: 777k]
  ------------------
  462|   777k|			w = *(block++) ;
  463|   777k|		else
  464|   777k|			w <<= 2 ;
  465|  1.55M|		codewords [k++] = (w >> 12) & 0xc ;
  466|  1.55M|		codewords [k++] = (w >> 8) & 0xc ;
  467|  1.55M|		codewords [k++] = (w >> 4) & 0xc ;
  468|  1.55M|		codewords [k++] = w & 0xc ;
  469|  1.55M|		} ;
  470|       |
  471|       |	/*
  472|       |	** Every block ends with a short representing a RMS-approximation for the
  473|       |	** block.
  474|       |	**/
  475|  38.8k|	if (rms)
  ------------------
  |  Branch (475:6): [True: 0, False: 38.8k]
  ------------------
  476|      0|		*rms = *block ;
  477|  38.8k|} /* nms_adpcm_unpack_16 */
nms_adpcm.c:nms_adpcm_block_unpack_24:
  486|  1.09k|{	int k ;
  487|  1.09k|	uint16_t w = 0, residual = 0 ;
  488|       |
  489|  44.7k|	for (k = 0 ; k < NMS_SAMPLES_PER_BLOCK ; )
  ------------------
  |  |   43|  44.7k|#define NMS_SAMPLES_PER_BLOCK 160
  ------------------
  |  Branch (489:15): [True: 43.6k, False: 1.09k]
  ------------------
  490|  43.6k|	{		/*
  491|       |		** k % 16 == [0, 11]: Unpack new nibble, build residual
  492|       |		** k % 16 == [12, 15]: Unpack residual
  493|       |		*/
  494|  43.6k|		if ((k & 12) != 12)
  ------------------
  |  Branch (494:7): [True: 32.7k, False: 10.9k]
  ------------------
  495|  32.7k|		{	w = *(block++) ;
  496|  32.7k|			residual = (residual << 1) | (w & 0x1111) ;
  497|  32.7k|			}
  498|  10.9k|		else
  499|  10.9k|		{	w = residual << 1 ;
  500|  10.9k|			residual = 0 ;
  501|  10.9k|			} ;
  502|  43.6k|		codewords [k++] = (w >> 12) & 0xe ;
  503|  43.6k|		codewords [k++] = (w >> 8) & 0xe ;
  504|  43.6k|		codewords [k++] = (w >> 4) & 0xe ;
  505|  43.6k|		codewords [k++] = w & 0xe ;
  506|  43.6k|		} ;
  507|       |
  508|       |	/*
  509|       |	** Every block ends with a short representing a RMS-approximation for the
  510|       |	** block.
  511|       |	**/
  512|  1.09k|	if (rms)
  ------------------
  |  Branch (512:6): [True: 0, False: 1.09k]
  ------------------
  513|      0|		*rms = *block ;
  514|  1.09k|} /* nms_adpcm_unpack_24 */
nms_adpcm.c:nms_adpcm_block_unpack_32:
  523|    729|{	int k ;
  524|    729|	uint16_t w = 0 ;
  525|       |
  526|  29.8k|	for (k = 0 ; k < NMS_SAMPLES_PER_BLOCK ; )
  ------------------
  |  |   43|  29.8k|#define NMS_SAMPLES_PER_BLOCK 160
  ------------------
  |  Branch (526:15): [True: 29.1k, False: 729]
  ------------------
  527|  29.1k|	{	w = *(block++) ;
  528|  29.1k|		codewords [k++] = (w >> 12) & 0xf ;
  529|  29.1k|		codewords [k++] = (w >> 8) & 0xf ;
  530|  29.1k|		codewords [k++] = (w >> 4) & 0xf ;
  531|  29.1k|		codewords [k++] = w & 0xf ;
  532|  29.1k|		} ;
  533|       |	/*
  534|       |	** Every block ends with a short representing a RMS-approximation for the
  535|       |	** block.
  536|       |	**/
  537|    729|	if (rms)
  ------------------
  |  Branch (537:6): [True: 0, False: 729]
  ------------------
  538|      0|		*rms = *block ;
  539|    729|} /* nms_adpcm_unpack_32 */
nms_adpcm.c:nms_adpcm_decode_sample:
  409|  6.51M|{	int_fast32_t sl ;
  410|       |
  411|  6.51M|	nms_adpcm_update (s) ;
  412|  6.51M|	sl = nms_adpcm_reconstruct_sample (s, I) ;
  413|       |
  414|       |	/* Clamp to [-0x1fdf, 0x1fdf] (just under 14 bits resolution) */
  415|  6.51M|	if (sl < -0x1fdf)
  ------------------
  |  Branch (415:6): [True: 307k, False: 6.20M]
  ------------------
  416|   307k|		sl = -0x1fdf ;
  417|  6.20M|	else if (sl > 0x1fdf)
  ------------------
  |  Branch (417:11): [True: 352k, False: 5.85M]
  ------------------
  418|   352k|		sl = 0x1fdf ;
  419|       |
  420|       |	/* Expand from 14 to 16 bits */
  421|  6.51M|	sl = (sl * 0x7fff) / 0x1fdf ;
  422|       |
  423|  6.51M|	return (int16_t) sl ;
  424|  6.51M|} /* nms_adpcm_decode_sample */
nms_adpcm.c:nms_adpcm_update:
  196|  6.51M|{	/* Variable names from ITU G.726 spec */
  197|  6.51M|	short a1ul, fa1 ;
  198|  6.51M|	int_fast32_t se ;
  199|  6.51M|	int i ;
  200|       |
  201|       |	/* Decay and Modify the scale factor in the log domain based on the codeword. */
  202|  6.51M|	s->yl = ((s->yl *0xf8) >> 8) + table_scale_factor_step [s->t_off + (s->Ik & 7)] ;
  203|  6.51M|	if (s->yl < 2171)
  ------------------
  |  Branch (203:6): [True: 4.22M, False: 2.28M]
  ------------------
  204|  4.22M|		s->yl = 2171 ;
  205|  2.28M|	else if (s->yl > 20480)
  ------------------
  |  Branch (205:11): [True: 205k, False: 2.07M]
  ------------------
  206|   205k|		s->yl = 20480 ;
  207|  6.51M|	s->y = nms_adpcm_antilog (s->yl) ;
  208|       |
  209|       |	/* Update the zero predictor coefficients. */
  210|  45.5M|	for (i = 0 ; i < 6 ; i++)
  ------------------
  |  Branch (210:15): [True: 39.0M, False: 6.51M]
  ------------------
  211|  39.0M|	{	s->b [i] = (s->b [i] * 0xff) >> 8 ;
  212|  39.0M|		if ((s->d_q [0] ^ s->d_q [i + 1]) >= 0)
  ------------------
  |  Branch (212:7): [True: 34.6M, False: 4.45M]
  ------------------
  213|  34.6M|			s->b [i] += 128 ;
  214|  4.45M|		else
  215|  4.45M|			s->b [i] -= 128 ;
  216|  39.0M|		}
  217|       |
  218|       |	/* Update the pole predictor coefficients. */
  219|  6.51M|	fa1 = s->a [0] >> 5 ;
  220|  6.51M|	if (fa1 < -256)
  ------------------
  |  Branch (220:6): [True: 62.2k, False: 6.45M]
  ------------------
  221|  62.2k|		fa1 = -256 ;
  222|  6.45M|	else if (fa1 > 256)
  ------------------
  |  Branch (222:11): [True: 6.07M, False: 372k]
  ------------------
  223|  6.07M|		fa1 = 256 ;
  224|       |
  225|  6.51M|	s->a [0] = (s->a [0] * 0xff) >> 8 ;
  226|  6.51M|	if (s->p [0] != 0 && s->p [1] != 0 && ((s->p [0] ^ s->p [1]) < 0))
  ------------------
  |  Branch (226:6): [True: 2.26M, False: 4.24M]
  |  Branch (226:23): [True: 2.25M, False: 11.5k]
  |  Branch (226:40): [True: 506k, False: 1.75M]
  ------------------
  227|   506k|		s->a [0] -= 192 ;
  228|  6.00M|	else
  229|  6.00M|	{	s->a [0] += 192 ;
  230|  6.00M|		fa1 = -fa1 ;
  231|  6.00M|		}
  232|       |
  233|  6.51M|	s->a [1] = fa1 + ((s->a [1] * 0xfe) >> 8) ;
  234|  6.51M|	if (s->p [0] != 0 && s->p [2] != 0 && ((s->p [0] ^ s->p [2]) < 0))
  ------------------
  |  Branch (234:6): [True: 2.26M, False: 4.24M]
  |  Branch (234:23): [True: 2.25M, False: 14.2k]
  |  Branch (234:40): [True: 363k, False: 1.89M]
  ------------------
  235|   363k|		s->a [1] -= 128 ;
  236|  6.14M|	else
  237|  6.14M|		s->a [1] += 128 ;
  238|       |
  239|       |	/* Stability constraints. */
  240|  6.51M|	if (s->a [1] < -12288)
  ------------------
  |  Branch (240:6): [True: 4.95M, False: 1.55M]
  ------------------
  241|  4.95M|		s->a [1] = -12288 ;
  242|  1.55M|	else if (s->a [1] > 12288)
  ------------------
  |  Branch (242:11): [True: 11.5k, False: 1.54M]
  ------------------
  243|  11.5k|		s->a [1] = 12288 ;
  244|  6.51M|	a1ul = 15360 - s->a [1] ;
  245|  6.51M|	if (s->a [0] >= a1ul)
  ------------------
  |  Branch (245:6): [True: 5.19M, False: 1.31M]
  ------------------
  246|  5.19M|		s->a [0] = a1ul ;
  247|  1.31M|	else
  248|  1.31M|	{	a1ul = -a1ul ;
  249|  1.31M|		if (s->a [0] < a1ul)
  ------------------
  |  Branch (249:7): [True: 28.2k, False: 1.28M]
  ------------------
  250|  28.2k|			s->a [0] = a1ul ;
  251|  1.31M|		} ;
  252|       |
  253|       |	/* Compute the zero predictor estimate and rotate past deltas. */
  254|  6.51M|	se = 0 ;
  255|  45.5M|	for (i = 5 ; i >= 0 ; i--)
  ------------------
  |  Branch (255:15): [True: 39.0M, False: 6.51M]
  ------------------
  256|  39.0M|	{	se += (int_fast32_t) s->d_q [i] * s->b [i] ;
  257|  39.0M|		s->d_q [i + 1] = s->d_q [i] ;
  258|  39.0M|		} ;
  259|  6.51M|	s->s_ez = se >> 14 ;
  260|       |
  261|       |	/* Complete the signal estimate. */
  262|  6.51M|	se += (int_fast32_t) s->a [0] * s->s_r [0] ;
  263|  6.51M|	se += (int_fast32_t) s->a [1] * s->s_r [1] ;
  264|  6.51M|	s->s_e = se >> 14 ;
  265|       |
  266|       |	/* Rotate members to prepare for next iteration. */
  267|  6.51M|	s->s_r [1] = s->s_r [0] ;
  268|  6.51M|	s->p [2] = s->p [1] ;
  269|  6.51M|	s->p [1] = s->p [0] ;
  270|  6.51M|} /* nms_adpcm_update */
nms_adpcm.c:nms_adpcm_antilog:
  184|  6.51M|{	int_fast32_t r ;
  185|       |
  186|  6.51M|	r = 0x1000 ;
  187|  6.51M|	r += (((int_fast32_t) (exp & 0x3f) * 0x166b) >> 12) ;
  188|  6.51M|	r *= table_expn [(exp & 0x7c0) >> 6] ;
  189|  6.51M|	r >>= (26 - (exp >> 11)) ;
  190|       |
  191|  6.51M|	return (short) r ;
  192|  6.51M|} /* nms_adpcm_antilog */
nms_adpcm.c:nms_adpcm_reconstruct_sample:
  275|  6.51M|{	/* Variable names from ITU G.726 spec */
  276|  6.51M|	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|  6.51M|	dqx = table_step [s->t_off + (I & 7)] * s->y ;
  286|  6.51M|	if (I & 8)
  ------------------
  |  Branch (286:6): [True: 768k, False: 5.74M]
  ------------------
  287|   768k|		dqx = -dqx ;
  288|       |
  289|       |	/* Take from delta scale to actual scale. */
  290|  6.51M|	dqx >>= 12 ;
  291|       |
  292|       |	/* Set variables used as input for the next predictor update. */
  293|  6.51M|	s->d_q [0] = dqx ;
  294|  6.51M|	s->s_r [0] = s->s_e + dqx ;
  295|  6.51M|	s->Ik = I & 0xf ;
  296|  6.51M|	s->p [0] = s->s_ez + dqx ;
  297|       |
  298|  6.51M|	return s->s_r [0] ;
  299|  6.51M|} /* nms_adpcm_reconstruct_sample */
nms_adpcm.c:nms_adpcm_read_f:
  804|  6.51M|{	BUF_UNION	ubuf ;
  805|  6.51M|	NMS_ADPCM_PRIVATE *pnms ;
  806|  6.51M|	short		*sptr ;
  807|  6.51M|	int			k, bufferlen, readcount = 0, count ;
  808|  6.51M|	sf_count_t	total = 0 ;
  809|  6.51M|	float 		normfact ;
  810|       |
  811|  6.51M|	if (psf->codec_data == NULL)
  ------------------
  |  Branch (811:6): [True: 0, False: 6.51M]
  ------------------
  812|      0|		return 0 ;
  813|  6.51M|	pnms = (NMS_ADPCM_PRIVATE*) psf->codec_data ;
  814|       |
  815|  6.51M|	normfact = (psf->norm_float == SF_TRUE) ? 1.0 / ((float) 0x8000) : 1.0 ;
  ------------------
  |  Branch (815:13): [True: 6.51M, False: 0]
  ------------------
  816|       |
  817|  6.51M|	sptr = ubuf.sbuf ;
  818|  6.51M|	bufferlen = SF_BUFFER_LEN / sizeof (short) ;
  ------------------
  |  |   77|  6.51M|#define	SF_BUFFER_LEN			(8192)
  ------------------
  819|  13.0M|	while (len > 0)
  ------------------
  |  Branch (819:9): [True: 6.51M, False: 6.51M]
  ------------------
  820|  6.51M|	{	readcount = (len >= bufferlen) ? bufferlen : (int) len ;
  ------------------
  |  Branch (820:16): [True: 0, False: 6.51M]
  ------------------
  821|  6.51M|		count = nms_adpcm_read_block (psf, pnms, sptr, readcount) ;
  822|  13.0M|		for (k = 0 ; k < readcount ; k++)
  ------------------
  |  Branch (822:16): [True: 6.51M, False: 6.51M]
  ------------------
  823|  6.51M|			ptr [total + k] = normfact * sptr [k] ;
  824|       |
  825|  6.51M|		total += count ;
  826|  6.51M|		len -= readcount ;
  827|  6.51M|		if (count != readcount)
  ------------------
  |  Branch (827:7): [True: 0, False: 6.51M]
  ------------------
  828|      0|			break ;
  829|  6.51M|		} ;
  830|       |
  831|  6.51M|	return total ;
  832|  6.51M|} /* nms_adpcm_read_f */
nms_adpcm.c:nms_adpcm_close:
 1102|    256|{	NMS_ADPCM_PRIVATE *pnms ;
 1103|       |
 1104|    256|	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|    256|	if (psf->file.mode == SFM_WRITE)
  ------------------
  |  Branch (1110:6): [True: 0, False: 256]
  ------------------
 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|    256|	return 0 ;
 1121|    256|} /* 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|    140|{	int		subformat, error, endian ;
  104|       |
  105|    140| 	psf->dataoffset = PAF_HEADER_LENGTH ;
  ------------------
  |  |   43|    140|#define	PAF_HEADER_LENGTH 			2048
  ------------------
  106|       |
  107|    140|	if (psf->file.mode == SFM_READ || (psf->file.mode == SFM_RDWR && psf->filelength > 0))
  ------------------
  |  Branch (107:6): [True: 140, False: 0]
  |  Branch (107:37): [True: 0, False: 0]
  |  Branch (107:67): [True: 0, False: 0]
  ------------------
  108|    140|	{	if ((error = paf_read_header (psf)))
  ------------------
  |  Branch (108:8): [True: 51, False: 89]
  ------------------
  109|     51|			return error ;
  110|    140|		} ;
  111|       |
  112|     89|	subformat = SF_CODEC (psf->sf.format) ;
  ------------------
  |  |  109|     89|#define SF_CODEC(x)			((x) & SF_FORMAT_SUBMASK)
  ------------------
  113|       |
  114|     89|	if (psf->file.mode == SFM_WRITE || psf->file.mode == SFM_RDWR)
  ------------------
  |  Branch (114:6): [True: 0, False: 89]
  |  Branch (114:37): [True: 0, False: 89]
  ------------------
  115|      0|	{	if ((SF_CONTAINER (psf->sf.format)) != SF_FORMAT_PAF)
  ------------------
  |  |  108|      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) ;
  ------------------
  |  |  110|      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|     89|		} ;
  131|       |
  132|     89|	switch (subformat)
  133|     89|	{	case SF_FORMAT_PCM_S8 :
  ------------------
  |  Branch (133:4): [True: 2, False: 87]
  ------------------
  134|      2|					psf->bytewidth = 1 ;
  135|      2|					error = pcm_init (psf) ;
  136|      2|					break ;
  137|       |
  138|      4|		case SF_FORMAT_PCM_16 :
  ------------------
  |  Branch (138:3): [True: 4, False: 85]
  ------------------
  139|      4|					psf->bytewidth = 2 ;
  140|      4|					error = pcm_init (psf) ;
  141|      4|					break ;
  142|       |
  143|     83|		case SF_FORMAT_PCM_24 :
  ------------------
  |  Branch (143:3): [True: 83, False: 6]
  ------------------
  144|       |					/* No bytewidth because of whacky 24 bit encoding. */
  145|     83|					error = paf24_init (psf) ;
  146|     83|					break ;
  147|       |
  148|      0|		default : return SFE_PAF_UNKNOWN_FORMAT ;
  ------------------
  |  Branch (148:3): [True: 0, False: 89]
  ------------------
  149|     89|		} ;
  150|       |
  151|     89|	return error ;
  152|     89|} /* paf_open */
paf.c:paf_read_header:
  159|    140|{	PAF_FMT		paf_fmt ;
  160|    140|	int			marker ;
  161|       |
  162|    140|	if (psf->filelength < PAF_HEADER_LENGTH)
  ------------------
  |  |   43|    140|#define	PAF_HEADER_LENGTH 			2048
  ------------------
  |  Branch (162:6): [True: 2, False: 138]
  ------------------
  163|      2|		return SFE_PAF_SHORT_HEADER ;
  164|       |
  165|    138|	memset (&paf_fmt, 0, sizeof (paf_fmt)) ;
  166|    138|	psf_binheader_readf (psf, "pm", 0, &marker) ;
  167|       |
  168|    138|	psf_log_printf (psf, "Signature   : '%M'\n", marker) ;
  169|       |
  170|    138|	if (marker == PAF_MARKER)
  ------------------
  |  |   37|    138|#define PAF_MARKER	(MAKE_MARKER (' ', 'p', 'a', 'f'))
  |  |  ------------------
  |  |  |  |  122|    138|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (170:6): [True: 129, False: 9]
  ------------------
  171|    129|	{	psf_binheader_readf (psf, "E444444", &(paf_fmt.version), &(paf_fmt.endianness),
  172|    129|			&(paf_fmt.samplerate), &(paf_fmt.format), &(paf_fmt.channels), &(paf_fmt.source)) ;
  173|    129|		}
  174|      9|	else if (marker == FAP_MARKER)
  ------------------
  |  |   36|      9|#define FAP_MARKER	(MAKE_MARKER ('f', 'a', 'p', ' '))
  |  |  ------------------
  |  |  |  |  122|      9|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (174:11): [True: 9, False: 0]
  ------------------
  175|      9|	{	psf_binheader_readf (psf, "e444444", &(paf_fmt.version), &(paf_fmt.endianness),
  176|      9|			&(paf_fmt.samplerate), &(paf_fmt.format), &(paf_fmt.channels), &(paf_fmt.source)) ;
  177|      9|		}
  178|      0|	else
  179|      0|		return SFE_PAF_NO_MARKER ;
  180|       |
  181|    138|	psf_log_printf (psf, "Version     : %d\n", paf_fmt.version) ;
  182|       |
  183|    138|	if (paf_fmt.version != 0)
  ------------------
  |  Branch (183:6): [True: 2, False: 136]
  ------------------
  184|      2|	{	psf_log_printf (psf, "*** Bad version number. should be zero.\n") ;
  185|      2|		return SFE_PAF_VERSION ;
  186|    136|		} ;
  187|       |
  188|    136|	psf_log_printf (psf, "Sample Rate : %d\n", paf_fmt.samplerate) ;
  189|    136|	psf_log_printf (psf, "Channels    : %d\n", paf_fmt.channels) ;
  190|       |
  191|    136|	psf_log_printf (psf, "Endianness  : %d => ", paf_fmt.endianness) ;
  192|    136|	if (paf_fmt.endianness)
  ------------------
  |  Branch (192:6): [True: 94, False: 42]
  ------------------
  193|     94|	{	psf_log_printf (psf, "Little\n", paf_fmt.endianness) ;
  194|     94|		psf->endian = SF_ENDIAN_LITTLE ;
  195|     94|		}
  196|     42|	else
  197|     42|	{	psf_log_printf (psf, "Big\n", paf_fmt.endianness) ;
  198|     42|		psf->endian = SF_ENDIAN_BIG ;
  199|     42|		} ;
  200|       |
  201|    136|	if (paf_fmt.channels < 1 || paf_fmt.channels > SF_MAX_CHANNELS)
  ------------------
  |  |  102|    112|#define		SF_MAX_CHANNELS		1024
  ------------------
  |  Branch (201:6): [True: 24, False: 112]
  |  Branch (201:30): [True: 14, False: 98]
  ------------------
  202|     38|		return SFE_PAF_BAD_CHANNELS ;
  203|       |
  204|     98|	psf->datalength = psf->filelength - psf->dataoffset ;
  205|       |
  206|     98|	psf_binheader_readf (psf, "p", (int) psf->dataoffset) ;
  207|       |
  208|     98|	psf->sf.samplerate	= paf_fmt.samplerate ;
  209|     98|	psf->sf.channels 	= paf_fmt.channels ;
  210|       |
  211|       |	/* Only fill in type major. */
  212|     98|	psf->sf.format = SF_FORMAT_PAF ;
  213|       |
  214|     98|	psf_log_printf (psf, "Format      : %d => ", paf_fmt.format) ;
  215|       |
  216|       |	/* PAF is by default big endian. */
  217|     98|	psf->sf.format |= paf_fmt.endianness ? SF_ENDIAN_LITTLE : SF_ENDIAN_BIG ;
  ------------------
  |  Branch (217:20): [True: 59, False: 39]
  ------------------
  218|       |
  219|     98|	switch (paf_fmt.format)
  220|     98|	{	case PAF_PCM_S8 :
  ------------------
  |  Branch (220:4): [True: 2, False: 96]
  ------------------
  221|      2|					psf_log_printf (psf, "8 bit linear PCM\n") ;
  222|      2|					psf->bytewidth = 1 ;
  223|       |
  224|      2|					psf->sf.format |= SF_FORMAT_PCM_S8 ;
  225|       |
  226|      2|					psf->blockwidth = (sf_count_t) psf->bytewidth * psf->sf.channels ;
  227|      2|					psf->sf.frames = psf->datalength / psf->blockwidth ;
  228|      2|					break ;
  229|       |
  230|      4|		case PAF_PCM_16 :
  ------------------
  |  Branch (230:3): [True: 4, False: 94]
  ------------------
  231|      4|					psf_log_printf (psf, "16 bit linear PCM\n") ;
  232|      4|					psf->bytewidth = 2 ;
  233|       |
  234|      4|					psf->sf.format |= SF_FORMAT_PCM_16 ;
  235|       |
  236|      4|					psf->blockwidth = (sf_count_t) psf->bytewidth * psf->sf.channels ;
  237|      4|					psf->sf.frames = psf->datalength / psf->blockwidth ;
  238|      4|					break ;
  239|       |
  240|     83|		case PAF_PCM_24 :
  ------------------
  |  Branch (240:3): [True: 83, False: 15]
  ------------------
  241|     83|					psf_log_printf (psf, "24 bit linear PCM\n") ;
  242|     83|					psf->bytewidth = 3 ;
  243|       |
  244|     83|					psf->sf.format |= SF_FORMAT_PCM_24 ;
  245|       |
  246|     83|					psf->blockwidth = 0 ;
  247|     83|					psf->sf.frames = PAF24_SAMPLES_PER_BLOCK * psf->datalength /
  ------------------
  |  |   45|     83|#define	PAF24_SAMPLES_PER_BLOCK		10
  ------------------
  248|     83|											(PAF24_BLOCK_SIZE * psf->sf.channels) ;
  ------------------
  |  |   46|     83|#define	PAF24_BLOCK_SIZE			32
  ------------------
  249|     83|					break ;
  250|       |
  251|      9|		default :	psf_log_printf (psf, "Unknown\n") ;
  ------------------
  |  Branch (251:3): [True: 9, False: 89]
  ------------------
  252|      9|					return SFE_PAF_UNKNOWN_FORMAT ;
  253|      0|					break ;
  254|     98|		} ;
  255|       |
  256|     89|	psf_log_printf (psf, "Source      : %d => ", paf_fmt.source) ;
  257|       |
  258|     89|	switch (paf_fmt.source)
  259|     89|	{	case 1 : psf_log_printf (psf, "Analog Recording\n") ;
  ------------------
  |  Branch (259:4): [True: 12, False: 77]
  ------------------
  260|     12|					break ;
  261|      1|		case 2 : psf_log_printf (psf, "Digital Transfer\n") ;
  ------------------
  |  Branch (261:3): [True: 1, False: 88]
  ------------------
  262|      1|					break ;
  263|      5|		case 3 : psf_log_printf (psf, "Multi-track Mixdown\n") ;
  ------------------
  |  Branch (263:3): [True: 5, False: 84]
  ------------------
  264|      5|					break ;
  265|      3|		case 5 : psf_log_printf (psf, "Audio Resulting From DSP Processing\n") ;
  ------------------
  |  Branch (265:3): [True: 3, False: 86]
  ------------------
  266|      3|					break ;
  267|     68|		default : psf_log_printf (psf, "Unknown\n") ;
  ------------------
  |  Branch (267:3): [True: 68, False: 21]
  ------------------
  268|     68|					break ;
  269|     89|		} ;
  270|       |
  271|     89|	return 0 ;
  272|     89|} /* paf_read_header */
paf.c:paf24_init:
  346|     83|{	PAF24_PRIVATE	*ppaf24 ;
  347|     83|	int	paf24size ;
  348|       |
  349|     83|	paf24size = sizeof (PAF24_PRIVATE) + psf->sf.channels *
  350|     83|					(PAF24_BLOCK_SIZE + PAF24_SAMPLES_PER_BLOCK * sizeof (int)) ;
  ------------------
  |  |   46|     83|#define	PAF24_BLOCK_SIZE			32
  ------------------
              					(PAF24_BLOCK_SIZE + PAF24_SAMPLES_PER_BLOCK * sizeof (int)) ;
  ------------------
  |  |   45|     83|#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|     83|	psf->last_op = 0 ;
  357|       |
  358|     83|	if (! (psf->codec_data = calloc (1, paf24size)))
  ------------------
  |  Branch (358:6): [True: 0, False: 83]
  ------------------
  359|      0|		return SFE_MALLOC_FAILED ;
  360|       |
  361|     83|	ppaf24 = (PAF24_PRIVATE*) psf->codec_data ;
  362|       |
  363|     83|	ppaf24->channels	= psf->sf.channels ;
  364|     83|	ppaf24->samples		= ppaf24->data ;
  365|     83|	ppaf24->block		= ppaf24->data + PAF24_SAMPLES_PER_BLOCK * ppaf24->channels ;
  ------------------
  |  |   45|     83|#define	PAF24_SAMPLES_PER_BLOCK		10
  ------------------
  366|       |
  367|     83|	ppaf24->blocksize = PAF24_BLOCK_SIZE * ppaf24->channels ;
  ------------------
  |  |   46|     83|#define	PAF24_BLOCK_SIZE			32
  ------------------
  368|       |
  369|     83|	if (psf->file.mode == SFM_READ || psf->file.mode == SFM_RDWR)
  ------------------
  |  Branch (369:6): [True: 83, False: 0]
  |  Branch (369:36): [True: 0, False: 0]
  ------------------
  370|     83|	{	paf24_read_block (psf, ppaf24) ;	/* Read first block. */
  371|       |
  372|     83|		psf->read_short		= paf24_read_s ;
  373|     83|		psf->read_int		= paf24_read_i ;
  374|     83|		psf->read_float		= paf24_read_f ;
  375|     83|		psf->read_double	= paf24_read_d ;
  376|     83|		} ;
  377|       |
  378|     83|	if (psf->file.mode == SFM_WRITE || psf->file.mode == SFM_RDWR)
  ------------------
  |  Branch (378:6): [True: 0, False: 83]
  |  Branch (378:37): [True: 0, False: 83]
  ------------------
  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|     83|	psf->seek	= paf24_seek ;
  386|     83|	psf->container_close	= paf24_close ;
  387|       |
  388|     83|	psf->filelength = psf_get_filelen (psf) ;
  389|     83|	psf->datalength = psf->filelength - psf->dataoffset ;
  390|       |
  391|     83|	if (psf->datalength % PAF24_BLOCK_SIZE)
  ------------------
  |  |   46|     83|#define	PAF24_BLOCK_SIZE			32
  ------------------
  |  Branch (391:6): [True: 68, False: 15]
  ------------------
  392|     68|	{	if (psf->file.mode == SFM_READ)
  ------------------
  |  Branch (392:8): [True: 68, False: 0]
  ------------------
  393|     68|			psf_log_printf (psf, "*** Warning : file seems to be truncated.\n") ;
  394|     68|		ppaf24->max_blocks = psf->datalength / ppaf24->blocksize + 1 ;
  395|     68|		}
  396|     15|	else
  397|     15|		ppaf24->max_blocks = psf->datalength / ppaf24->blocksize ;
  398|       |
  399|     83|	ppaf24->read_block = 0 ;
  400|     83|	if (psf->file.mode == SFM_RDWR)
  ------------------
  |  Branch (400:6): [True: 0, False: 83]
  ------------------
  401|      0|		ppaf24->write_block = ppaf24->max_blocks ;
  402|     83|	else
  403|     83|		ppaf24->write_block = 0 ;
  404|       |
  405|     83|	psf->sf.frames = PAF24_SAMPLES_PER_BLOCK * ppaf24->max_blocks ;
  ------------------
  |  |   45|     83|#define	PAF24_SAMPLES_PER_BLOCK		10
  ------------------
  406|     83|	ppaf24->sample_count = psf->sf.frames ;
  407|       |
  408|     83|	return 0 ;
  409|     83|} /* paf24_init */
paf.c:paf24_read_block:
  484|  55.7k|{	int				k, channel ;
  485|  55.7k|	unsigned char	*cptr ;
  486|       |
  487|  55.7k|	ppaf24->read_block ++ ;
  488|  55.7k|	ppaf24->read_count = 0 ;
  489|       |
  490|  55.7k|	if (ppaf24->read_block * PAF24_SAMPLES_PER_BLOCK > ppaf24->sample_count)
  ------------------
  |  |   45|  55.7k|#define	PAF24_SAMPLES_PER_BLOCK		10
  ------------------
  |  Branch (490:6): [True: 83, False: 55.6k]
  ------------------
  491|     83|	{	memset (ppaf24->samples, 0, PAF24_SAMPLES_PER_BLOCK * ppaf24->channels) ;
  ------------------
  |  |   45|     83|#define	PAF24_SAMPLES_PER_BLOCK		10
  ------------------
  492|     83|		return 1 ;
  493|  55.6k|		} ;
  494|       |
  495|       |	/* Read the block. */
  496|  55.6k|	if ((k = (int) psf_fread (ppaf24->block, 1, ppaf24->blocksize, psf)) != ppaf24->blocksize)
  ------------------
  |  Branch (496:6): [True: 66, False: 55.6k]
  ------------------
  497|     66|		psf_log_printf (psf, "*** Warning : short read (%d != %d).\n", k, ppaf24->blocksize) ;
  498|       |
  499|       |	/* Do endian swapping if necessary. */
  500|  55.6k|	if ((CPU_IS_BIG_ENDIAN && psf->endian == SF_ENDIAN_LITTLE) || (CPU_IS_LITTLE_ENDIAN && psf->endian == SF_ENDIAN_BIG))
  ------------------
  |  |   11|   111k|#define CPU_IS_BIG_ENDIAN 0
  |  |  ------------------
  |  |  |  Branch (11:27): [Folded, False: 55.6k]
  |  |  ------------------
  ------------------
              	if ((CPU_IS_BIG_ENDIAN && psf->endian == SF_ENDIAN_LITTLE) || (CPU_IS_LITTLE_ENDIAN && psf->endian == SF_ENDIAN_BIG))
  ------------------
  |  |   14|   111k|#define CPU_IS_LITTLE_ENDIAN 1
  |  |  ------------------
  |  |  |  Branch (14:30): [True: 55.6k, Folded]
  |  |  ------------------
  ------------------
  |  Branch (500:28): [True: 0, False: 0]
  |  Branch (500:89): [True: 4.35k, False: 51.3k]
  ------------------
  501|  4.35k|		endswap_int_array (ppaf24->block, 8 * ppaf24->channels) ;
  502|       |
  503|       |	/* Unpack block. */
  504|   655k|	for (k = 0 ; k < PAF24_SAMPLES_PER_BLOCK * ppaf24->channels ; k++)
  ------------------
  |  |   45|   655k|#define	PAF24_SAMPLES_PER_BLOCK		10
  ------------------
  |  Branch (504:15): [True: 599k, False: 55.6k]
  ------------------
  505|   599k|	{	channel = k % ppaf24->channels ;
  506|   599k|		cptr = ((unsigned char *) ppaf24->block) + PAF24_BLOCK_SIZE * channel + 3 * (k / ppaf24->channels) ;
  ------------------
  |  |   46|   599k|#define	PAF24_BLOCK_SIZE			32
  ------------------
  507|   599k|		ppaf24->samples [k] = (cptr [0] << 8) | (cptr [1] << 16) | (((unsigned) cptr [2]) << 24) ;
  508|   599k|		} ;
  509|       |
  510|  55.6k|	return 1 ;
  511|  55.7k|} /* paf24_read_block */
paf.c:paf24_read:
  515|   556k|{	int	count, total = 0 ;
  516|       |
  517|  1.11M|	while (total < len)
  ------------------
  |  Branch (517:9): [True: 556k, False: 556k]
  ------------------
  518|   556k|	{	if (ppaf24->read_block * PAF24_SAMPLES_PER_BLOCK >= ppaf24->sample_count)
  ------------------
  |  |   45|   556k|#define	PAF24_SAMPLES_PER_BLOCK		10
  ------------------
  |  Branch (518:8): [True: 73, False: 556k]
  ------------------
  519|     73|		{	memset (&(ptr [total]), 0, (len - total) * sizeof (int)) ;
  520|     73|			return total ;
  521|   556k|			} ;
  522|       |
  523|   556k|		if (ppaf24->read_count >= PAF24_SAMPLES_PER_BLOCK)
  ------------------
  |  |   45|   556k|#define	PAF24_SAMPLES_PER_BLOCK		10
  ------------------
  |  Branch (523:7): [True: 55.6k, False: 500k]
  ------------------
  524|  55.6k|			paf24_read_block (psf, ppaf24) ;
  525|       |
  526|   556k|		count = (PAF24_SAMPLES_PER_BLOCK - ppaf24->read_count) * ppaf24->channels ;
  ------------------
  |  |   45|   556k|#define	PAF24_SAMPLES_PER_BLOCK		10
  ------------------
  527|   556k|		count = (len - total > count) ? count : len - total ;
  ------------------
  |  Branch (527:11): [True: 0, False: 556k]
  ------------------
  528|       |
  529|   556k|		memcpy (&(ptr [total]), &(ppaf24->samples [ppaf24->read_count * ppaf24->channels]), count * sizeof (int)) ;
  530|   556k|		total += count ;
  531|   556k|		ppaf24->read_count += count / ppaf24->channels ;
  532|   556k|		} ;
  533|       |
  534|   556k|	return total ;
  535|   556k|} /* paf24_read */
paf.c:paf24_read_f:
  578|   556k|{	BUF_UNION		ubuf ;
  579|   556k|	PAF24_PRIVATE 	*ppaf24 ;
  580|   556k|	int				*iptr ;
  581|   556k|	int				k, bufferlen, readcount, count ;
  582|   556k|	sf_count_t		total = 0 ;
  583|   556k|	float			normfact ;
  584|       |
  585|   556k|	if (psf->codec_data == NULL)
  ------------------
  |  Branch (585:6): [True: 0, False: 556k]
  ------------------
  586|      0|		return 0 ;
  587|   556k|	ppaf24 = (PAF24_PRIVATE*) psf->codec_data ;
  588|       |
  589|   556k|	normfact = (psf->norm_float == SF_TRUE) ? (1.0 / 0x80000000) : (1.0 / 0x100) ;
  ------------------
  |  Branch (589:13): [True: 556k, False: 0]
  ------------------
  590|       |
  591|   556k|	iptr = ubuf.ibuf ;
  592|   556k|	bufferlen = ARRAY_LEN (ubuf.ibuf) ;
  ------------------
  |  |   93|   556k|#define		ARRAY_LEN(x)	((int) (sizeof (x) / sizeof ((x) [0])))
  ------------------
  593|  1.11M|	while (len > 0)
  ------------------
  |  Branch (593:9): [True: 556k, False: 556k]
  ------------------
  594|   556k|	{	readcount = (len >= bufferlen) ? bufferlen : (int) len ;
  ------------------
  |  Branch (594:16): [True: 0, False: 556k]
  ------------------
  595|   556k|		count = paf24_read (psf, ppaf24, iptr, readcount) ;
  596|  1.11M|		for (k = 0 ; k < readcount ; k++)
  ------------------
  |  Branch (596:16): [True: 561k, False: 556k]
  ------------------
  597|   561k|			ptr [total + k] = normfact * iptr [k] ;
  598|   556k|		total += count ;
  599|   556k|		len -= readcount ;
  600|   556k|		} ;
  601|   556k|	return total ;
  602|   556k|} /* paf24_read_f */
paf.c:paf24_seek:
  413|     73|{	PAF24_PRIVATE	*ppaf24 ;
  414|     73|	int				newblock, newsample ;
  415|       |
  416|     73|	if (psf->codec_data == NULL)
  ------------------
  |  Branch (416:6): [True: 0, False: 73]
  ------------------
  417|      0|	{	psf->error = SFE_INTERNAL ;
  418|      0|		return PSF_SEEK_ERROR ;
  ------------------
  |  |   83|      0|#define	PSF_SEEK_ERROR			((sf_count_t) -1)
  ------------------
  419|     73|		} ;
  420|       |
  421|     73|	ppaf24 = (PAF24_PRIVATE*) psf->codec_data ;
  422|       |
  423|     73|	if (mode == SFM_READ && ppaf24->write_count > 0)
  ------------------
  |  Branch (423:6): [True: 73, False: 0]
  |  Branch (423:26): [True: 0, False: 73]
  ------------------
  424|      0|		paf24_write_block (psf, ppaf24) ;
  425|       |
  426|     73|	newblock	= offset / PAF24_SAMPLES_PER_BLOCK ;
  ------------------
  |  |   45|     73|#define	PAF24_SAMPLES_PER_BLOCK		10
  ------------------
  427|     73|	newsample	= offset % PAF24_SAMPLES_PER_BLOCK ;
  ------------------
  |  |   45|     73|#define	PAF24_SAMPLES_PER_BLOCK		10
  ------------------
  428|       |
  429|     73|	switch (mode)
  430|     73|	{	case SFM_READ :
  ------------------
  |  Branch (430:4): [True: 73, False: 0]
  ------------------
  431|     73|				if (psf->last_op == SFM_WRITE && ppaf24->write_count)
  ------------------
  |  Branch (431:9): [True: 0, False: 73]
  |  Branch (431:38): [True: 0, False: 0]
  ------------------
  432|      0|					paf24_write_block (psf, ppaf24) ;
  433|       |
  434|     73|				psf_fseek (psf, psf->dataoffset + newblock * ppaf24->blocksize, SEEK_SET) ;
  435|     73|				ppaf24->read_block = newblock ;
  436|     73|				paf24_read_block (psf, ppaf24) ;
  437|     73|				ppaf24->read_count = newsample ;
  438|     73|				break ;
  439|       |
  440|      0|		case SFM_WRITE :
  ------------------
  |  Branch (440:3): [True: 0, False: 73]
  ------------------
  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 ;
  ------------------
  |  |   83|      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: 73]
  ------------------
  456|      0|				psf->error = SFE_BAD_SEEK ;
  457|      0|				return PSF_SEEK_ERROR ;
  ------------------
  |  |   83|      0|#define	PSF_SEEK_ERROR			((sf_count_t) -1)
  ------------------
  458|     73|		} ;
  459|       |
  460|     73|	return newblock * PAF24_SAMPLES_PER_BLOCK + newsample ;
  ------------------
  |  |   45|     73|#define	PAF24_SAMPLES_PER_BLOCK		10
  ------------------
  461|     73|} /* paf24_seek */
paf.c:paf24_close:
  465|     83|{	PAF24_PRIVATE *ppaf24 ;
  466|       |
  467|     83|	if (psf->codec_data == NULL)
  ------------------
  |  Branch (467:6): [True: 0, False: 83]
  ------------------
  468|      0|		return 0 ;
  469|       |
  470|     83|	ppaf24 = (PAF24_PRIVATE*) psf->codec_data ;
  471|       |
  472|     83|	if (psf->file.mode == SFM_WRITE || psf->file.mode == SFM_RDWR)
  ------------------
  |  Branch (472:6): [True: 0, False: 83]
  |  Branch (472:37): [True: 0, False: 83]
  ------------------
  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|     83|	return 0 ;
  478|     83|} /* paf24_close */

pcm_init:
  123|    798|{	int chars = 0 ;
  124|       |
  125|    798|	if (psf->bytewidth == 0 || psf->sf.channels == 0)
  ------------------
  |  Branch (125:6): [True: 6, False: 792]
  |  Branch (125:29): [True: 35, False: 757]
  ------------------
  126|     41|	{	psf_log_printf (psf, "pcm_init : internal error : bytewitdh = %d, channels = %d\n", psf->bytewidth, psf->sf.channels) ;
  127|     41|		return SFE_INTERNAL ;
  128|    757|		} ;
  129|       |
  130|    757|	psf->blockwidth = (sf_count_t) psf->bytewidth * psf->sf.channels ;
  131|       |
  132|    757|	if ((SF_CODEC (psf->sf.format)) == SF_FORMAT_PCM_S8)
  ------------------
  |  |  109|    757|#define SF_CODEC(x)			((x) & SF_FORMAT_SUBMASK)
  ------------------
  |  Branch (132:6): [True: 161, False: 596]
  ------------------
  133|    161|		chars = SF_CHARS_SIGNED ;
  134|    596|	else if ((SF_CODEC (psf->sf.format)) == SF_FORMAT_PCM_U8)
  ------------------
  |  |  109|    596|#define SF_CODEC(x)			((x) & SF_FORMAT_SUBMASK)
  ------------------
  |  Branch (134:11): [True: 117, False: 479]
  ------------------
  135|    117|		chars = SF_CHARS_UNSIGNED ;
  136|       |
  137|       |#if CPU_IS_BIG_ENDIAN
  138|       |	psf->data_endswap = (psf->endian == SF_ENDIAN_BIG) ? SF_FALSE : SF_TRUE ;
  139|       |#else
  140|    757|	psf->data_endswap = (psf->endian == SF_ENDIAN_LITTLE) ? SF_FALSE : SF_TRUE ;
  ------------------
  |  Branch (140:22): [True: 356, False: 401]
  ------------------
  141|    757|#endif
  142|       |
  143|    757|	if (psf->file.mode == SFM_READ || psf->file.mode == SFM_RDWR)
  ------------------
  |  Branch (143:6): [True: 757, False: 0]
  |  Branch (143:36): [True: 0, False: 0]
  ------------------
  144|    757|	{	switch (psf->bytewidth * 0x10000 + psf->endian + chars)
  145|    757|		{	case (0x10000 + SF_ENDIAN_BIG + SF_CHARS_SIGNED) :
  ------------------
  |  Branch (145:5): [True: 141, False: 616]
  ------------------
  146|    161|			case (0x10000 + SF_ENDIAN_LITTLE + SF_CHARS_SIGNED) :
  ------------------
  |  Branch (146:4): [True: 20, False: 737]
  ------------------
  147|    161|					psf->read_short		= pcm_read_sc2s ;
  148|    161|					psf->read_int		= pcm_read_sc2i ;
  149|    161|					psf->read_float		= pcm_read_sc2f ;
  150|    161|					psf->read_double	= pcm_read_sc2d ;
  151|    161|					break ;
  152|     15|			case (0x10000 + SF_ENDIAN_BIG + SF_CHARS_UNSIGNED) :
  ------------------
  |  Branch (152:4): [True: 15, False: 742]
  ------------------
  153|     89|			case (0x10000 + SF_ENDIAN_LITTLE + SF_CHARS_UNSIGNED) :
  ------------------
  |  Branch (153:4): [True: 74, False: 683]
  ------------------
  154|     89|					psf->read_short		= pcm_read_uc2s ;
  155|     89|					psf->read_int		= pcm_read_uc2i ;
  156|     89|					psf->read_float		= pcm_read_uc2f ;
  157|     89|					psf->read_double	= pcm_read_uc2d ;
  158|     89|					break ;
  159|       |
  160|    134|			case (2 * 0x10000 + SF_ENDIAN_BIG) :
  ------------------
  |  Branch (160:4): [True: 134, False: 623]
  ------------------
  161|    134|					psf->read_short		= pcm_read_bes2s ;
  162|    134|					psf->read_int		= pcm_read_bes2i ;
  163|    134|					psf->read_float		= pcm_read_bes2f ;
  164|    134|					psf->read_double	= pcm_read_bes2d ;
  165|    134|					break ;
  166|     40|			case (3 * 0x10000 + SF_ENDIAN_BIG) :
  ------------------
  |  Branch (166:4): [True: 40, False: 717]
  ------------------
  167|     40|					psf->read_short		= pcm_read_bet2s ;
  168|     40|					psf->read_int		= pcm_read_bet2i ;
  169|     40|					psf->read_float		= pcm_read_bet2f ;
  170|     40|					psf->read_double	= pcm_read_bet2d ;
  171|     40|					break ;
  172|     43|			case (4 * 0x10000 + SF_ENDIAN_BIG) :
  ------------------
  |  Branch (172:4): [True: 43, False: 714]
  ------------------
  173|       |
  174|     43|					psf->read_short		= pcm_read_bei2s ;
  175|     43|					psf->read_int		= pcm_read_bei2i ;
  176|     43|					psf->read_float		= pcm_read_bei2f ;
  177|     43|					psf->read_double	= pcm_read_bei2d ;
  178|     43|					break ;
  179|       |
  180|    112|			case (2 * 0x10000 + SF_ENDIAN_LITTLE) :
  ------------------
  |  Branch (180:4): [True: 112, False: 645]
  ------------------
  181|    112|					psf->read_short		= pcm_read_les2s ;
  182|    112|					psf->read_int		= pcm_read_les2i ;
  183|    112|					psf->read_float		= pcm_read_les2f ;
  184|    112|					psf->read_double	= pcm_read_les2d ;
  185|    112|					break ;
  186|     74|			case (3 * 0x10000 + SF_ENDIAN_LITTLE) :
  ------------------
  |  Branch (186:4): [True: 74, False: 683]
  ------------------
  187|     74|					psf->read_short		= pcm_read_let2s ;
  188|     74|					psf->read_int		= pcm_read_let2i ;
  189|     74|					psf->read_float		= pcm_read_let2f ;
  190|     74|					psf->read_double	= pcm_read_let2d ;
  191|     74|					break ;
  192|     76|			case (4 * 0x10000 + SF_ENDIAN_LITTLE) :
  ------------------
  |  Branch (192:4): [True: 76, False: 681]
  ------------------
  193|     76|					psf->read_short		= pcm_read_lei2s ;
  194|     76|					psf->read_int		= pcm_read_lei2i ;
  195|     76|					psf->read_float		= pcm_read_lei2f ;
  196|     76|					psf->read_double	= pcm_read_lei2d ;
  197|     76|					break ;
  198|     28|			default :
  ------------------
  |  Branch (198:4): [True: 28, False: 729]
  ------------------
  199|     28|				psf_log_printf (psf, "pcm.c returning SFE_UNIMPLEMENTED\nbytewidth %d    endian %d\n", psf->bytewidth, psf->endian) ;
  200|     28|				return SFE_UNIMPLEMENTED ;
  201|    757|			} ;
  202|    729|		} ;
  203|       |
  204|    729|	if (psf->file.mode == SFM_WRITE || psf->file.mode == SFM_RDWR)
  ------------------
  |  Branch (204:6): [True: 0, False: 729]
  |  Branch (204:37): [True: 0, False: 729]
  ------------------
  205|      0|	{	switch (psf->bytewidth * 0x10000 + psf->endian + chars)
  206|      0|		{	case (0x10000 + SF_ENDIAN_BIG + SF_CHARS_SIGNED) :
  ------------------
  |  Branch (206:5): [True: 0, False: 0]
  ------------------
  207|      0|			case (0x10000 + SF_ENDIAN_LITTLE + SF_CHARS_SIGNED) :
  ------------------
  |  Branch (207:4): [True: 0, False: 0]
  ------------------
  208|      0|					psf->write_short	= pcm_write_s2sc ;
  209|      0|					psf->write_int		= pcm_write_i2sc ;
  210|      0|					psf->write_float	= pcm_write_f2sc ;
  211|      0|					psf->write_double	= pcm_write_d2sc ;
  212|      0|					break ;
  213|      0|			case (0x10000 + SF_ENDIAN_BIG + SF_CHARS_UNSIGNED) :
  ------------------
  |  Branch (213:4): [True: 0, False: 0]
  ------------------
  214|      0|			case (0x10000 + SF_ENDIAN_LITTLE + SF_CHARS_UNSIGNED) :
  ------------------
  |  Branch (214:4): [True: 0, False: 0]
  ------------------
  215|      0|					psf->write_short	= pcm_write_s2uc ;
  216|      0|					psf->write_int		= pcm_write_i2uc ;
  217|      0|					psf->write_float	= pcm_write_f2uc ;
  218|      0|					psf->write_double	= pcm_write_d2uc ;
  219|      0|					break ;
  220|       |
  221|      0|			case (2 * 0x10000 + SF_ENDIAN_BIG) :
  ------------------
  |  Branch (221:4): [True: 0, False: 0]
  ------------------
  222|      0|					psf->write_short	= pcm_write_s2bes ;
  223|      0|					psf->write_int		= pcm_write_i2bes ;
  224|      0|					psf->write_float	= pcm_write_f2bes ;
  225|      0|					psf->write_double	= pcm_write_d2bes ;
  226|      0|					break ;
  227|       |
  228|      0|			case (3 * 0x10000 + SF_ENDIAN_BIG) :
  ------------------
  |  Branch (228:4): [True: 0, False: 0]
  ------------------
  229|      0|					psf->write_short	= pcm_write_s2bet ;
  230|      0|					psf->write_int		= pcm_write_i2bet ;
  231|      0|					psf->write_float	= pcm_write_f2bet ;
  232|      0|					psf->write_double	= pcm_write_d2bet ;
  233|      0|					break ;
  234|       |
  235|      0|			case (4 * 0x10000 + SF_ENDIAN_BIG) :
  ------------------
  |  Branch (235:4): [True: 0, False: 0]
  ------------------
  236|      0|					psf->write_short	= pcm_write_s2bei ;
  237|      0|					psf->write_int		= pcm_write_i2bei ;
  238|      0|					psf->write_float	= pcm_write_f2bei ;
  239|      0|					psf->write_double	= pcm_write_d2bei ;
  240|      0|					break ;
  241|       |
  242|      0|			case (2 * 0x10000 + SF_ENDIAN_LITTLE) :
  ------------------
  |  Branch (242:4): [True: 0, False: 0]
  ------------------
  243|      0|					psf->write_short	= pcm_write_s2les ;
  244|      0|					psf->write_int		= pcm_write_i2les ;
  245|      0|					psf->write_float	= pcm_write_f2les ;
  246|      0|					psf->write_double	= pcm_write_d2les ;
  247|      0|					break ;
  248|       |
  249|      0|			case (3 * 0x10000 + SF_ENDIAN_LITTLE) :
  ------------------
  |  Branch (249:4): [True: 0, False: 0]
  ------------------
  250|      0|					psf->write_short	= pcm_write_s2let ;
  251|      0|					psf->write_int		= pcm_write_i2let ;
  252|      0|					psf->write_float	= pcm_write_f2let ;
  253|      0|					psf->write_double	= pcm_write_d2let ;
  254|      0|					break ;
  255|       |
  256|      0|			case (4 * 0x10000 + SF_ENDIAN_LITTLE) :
  ------------------
  |  Branch (256:4): [True: 0, False: 0]
  ------------------
  257|      0|					psf->write_short	= pcm_write_s2lei ;
  258|      0|					psf->write_int		= pcm_write_i2lei ;
  259|      0|					psf->write_float	= pcm_write_f2lei ;
  260|      0|					psf->write_double	= pcm_write_d2lei ;
  261|      0|					break ;
  262|       |
  263|      0|			default :
  ------------------
  |  Branch (263:4): [True: 0, False: 0]
  ------------------
  264|      0|				psf_log_printf (psf, "pcm.c returning SFE_UNIMPLEMENTED\nbytewidth %d    endian %d\n", psf->bytewidth, psf->endian) ;
  265|      0|				return SFE_UNIMPLEMENTED ;
  266|      0|			} ;
  267|       |
  268|    729|		} ;
  269|       |
  270|    729|	if (psf->filelength > psf->dataoffset)
  ------------------
  |  Branch (270:6): [True: 444, False: 285]
  ------------------
  271|    444|	{	psf->datalength = (psf->dataend > 0) ? psf->dataend - psf->dataoffset :
  ------------------
  |  Branch (271:22): [True: 34, False: 410]
  ------------------
  272|    444|							psf->filelength - psf->dataoffset ;
  273|    444|		}
  274|    285|	else
  275|    285|		psf->datalength = 0 ;
  276|       |
  277|    729|	psf->sf.frames = psf->blockwidth > 0 ? psf->datalength / psf->blockwidth : 0 ;
  ------------------
  |  Branch (277:19): [True: 598, False: 131]
  ------------------
  278|       |
  279|    729|	return 0 ;
  280|    729|} /* pcm_init */
pcm.c:pcm_read_sc2f:
  981|    276|{	BUF_UNION	ubuf ;
  982|    276|	int			bufferlen, readcount ;
  983|    276|	sf_count_t	total = 0 ;
  984|    276|	float	normfact ;
  985|       |
  986|    276|	normfact = (psf->norm_float == SF_TRUE) ? 1.0 / ((float) 0x80) : 1.0 ;
  ------------------
  |  Branch (986:13): [True: 276, False: 0]
  ------------------
  987|       |
  988|    276|	bufferlen = ARRAY_LEN (ubuf.scbuf) ;
  ------------------
  |  |   93|    276|#define		ARRAY_LEN(x)	((int) (sizeof (x) / sizeof ((x) [0])))
  ------------------
  989|       |
  990|    538|	while (len > 0)
  ------------------
  |  Branch (990:9): [True: 276, False: 262]
  ------------------
  991|    276|	{	if (len < bufferlen)
  ------------------
  |  Branch (991:8): [True: 276, False: 0]
  ------------------
  992|    276|			bufferlen = (int) len ;
  993|    276|		readcount = (int) psf_fread (ubuf.scbuf, sizeof (signed char), bufferlen, psf) ;
  994|    276|		sc2f_array (ubuf.scbuf, readcount, ptr + total, normfact) ;
  995|    276|		total += readcount ;
  996|    276|		if (readcount < bufferlen)
  ------------------
  |  Branch (996:7): [True: 14, False: 262]
  ------------------
  997|     14|			break ;
  998|    262|		len -= readcount ;
  999|    262|		} ;
 1000|       |
 1001|    276|	return total ;
 1002|    276|} /* pcm_read_sc2f */
pcm.c:sc2f_array:
  385|  3.60k|{	for (int i = 0 ; i < count ; i++)
  ------------------
  |  Branch (385:20): [True: 3.32k, False: 276]
  ------------------
  386|  3.32k|		dest [i] = ((float) src [i]) * normfact ;
  387|    276|} /* sc2f_array */
pcm.c:pcm_read_uc2f:
 1006|  35.7k|{	BUF_UNION	ubuf ;
 1007|  35.7k|	int			bufferlen, readcount ;
 1008|  35.7k|	sf_count_t	total = 0 ;
 1009|  35.7k|	float	normfact ;
 1010|       |
 1011|  35.7k|	normfact = (psf->norm_float == SF_TRUE) ? 1.0 / ((float) 0x80) : 1.0 ;
  ------------------
  |  Branch (1011:13): [True: 35.7k, False: 0]
  ------------------
 1012|       |
 1013|  35.7k|	bufferlen = ARRAY_LEN (ubuf.ucbuf) ;
  ------------------
  |  |   93|  35.7k|#define		ARRAY_LEN(x)	((int) (sizeof (x) / sizeof ((x) [0])))
  ------------------
 1014|       |
 1015|  71.5k|	while (len > 0)
  ------------------
  |  Branch (1015:9): [True: 35.7k, False: 35.7k]
  ------------------
 1016|  35.7k|	{	if (len < bufferlen)
  ------------------
  |  Branch (1016:8): [True: 35.7k, False: 0]
  ------------------
 1017|  35.7k|			bufferlen = (int) len ;
 1018|  35.7k|		readcount = (int) psf_fread (ubuf.ucbuf, sizeof (unsigned char), bufferlen, psf) ;
 1019|  35.7k|		uc2f_array (ubuf.ucbuf, readcount, ptr + total, normfact) ;
 1020|  35.7k|		total += readcount ;
 1021|  35.7k|		if (readcount < bufferlen)
  ------------------
  |  Branch (1021:7): [True: 0, False: 35.7k]
  ------------------
 1022|      0|			break ;
 1023|  35.7k|		len -= readcount ;
 1024|  35.7k|		} ;
 1025|       |
 1026|  35.7k|	return total ;
 1027|  35.7k|} /* pcm_read_uc2f */
pcm.c:uc2f_array:
  391|  7.48M|{	for (int i = 0 ; i < count ; i++)
  ------------------
  |  Branch (391:20): [True: 7.44M, False: 35.7k]
  ------------------
  392|  7.44M|		dest [i] = (((int) src [i]) - 128) * normfact ;
  393|  35.7k|} /* uc2f_array */
pcm.c:pcm_read_bes2f:
 1031|    362|{	BUF_UNION	ubuf ;
 1032|    362|	int			bufferlen, readcount ;
 1033|    362|	sf_count_t	total = 0 ;
 1034|    362|	float	normfact ;
 1035|       |
 1036|    362|	normfact = (psf->norm_float == SF_TRUE) ? 1.0 / ((float) 0x8000) : 1.0 ;
  ------------------
  |  Branch (1036:13): [True: 362, False: 0]
  ------------------
 1037|       |
 1038|    362|	bufferlen = ARRAY_LEN (ubuf.sbuf) ;
  ------------------
  |  |   93|    362|#define		ARRAY_LEN(x)	((int) (sizeof (x) / sizeof ((x) [0])))
  ------------------
 1039|       |
 1040|    718|	while (len > 0)
  ------------------
  |  Branch (1040:9): [True: 362, False: 356]
  ------------------
 1041|    362|	{	if (len < bufferlen)
  ------------------
  |  Branch (1041:8): [True: 362, False: 0]
  ------------------
 1042|    362|			bufferlen = (int) len ;
 1043|    362|		readcount = (int) psf_fread (ubuf.sbuf, sizeof (short), bufferlen, psf) ;
 1044|    362|		bes2f_array (ubuf.sbuf, readcount, ptr + total, normfact) ;
 1045|    362|		total += readcount ;
 1046|    362|		if (readcount < bufferlen)
  ------------------
  |  Branch (1046:7): [True: 6, False: 356]
  ------------------
 1047|      6|			break ;
 1048|    356|		len -= readcount ;
 1049|    356|		} ;
 1050|       |
 1051|    362|	return total ;
 1052|    362|} /* pcm_read_bes2f */
pcm.c:bes2f_array:
  408|    362|{	short			value ;
  409|       |
  410|    919|	for (int i = 0 ; i < count ; i++)
  ------------------
  |  Branch (410:19): [True: 557, False: 362]
  ------------------
  411|    557|	{	value = src [i] ;
  412|       |		value = BE2H_16 (value) ;
  ------------------
  |  |  140|    557|	#define BE2H_16(x)			ENDSWAP_16 (x)
  |  |  ------------------
  |  |  |  |   34|    557|#define	ENDSWAP_16(x)		(bswap_16 (x))
  |  |  ------------------
  ------------------
  413|    557|		dest [i] = ((float) value) * normfact ;
  414|    557|		} ;
  415|    362|} /* bes2f_array */
pcm.c:pcm_read_les2f:
 1056|    279|{	BUF_UNION	ubuf ;
 1057|    279|	int			bufferlen, readcount ;
 1058|    279|	sf_count_t	total = 0 ;
 1059|    279|	float	normfact ;
 1060|       |
 1061|    279|	normfact = (psf->norm_float == SF_TRUE) ? 1.0 / ((float) 0x8000) : 1.0 ;
  ------------------
  |  Branch (1061:13): [True: 279, False: 0]
  ------------------
 1062|       |
 1063|    279|	bufferlen = ARRAY_LEN (ubuf.sbuf) ;
  ------------------
  |  |   93|    279|#define		ARRAY_LEN(x)	((int) (sizeof (x) / sizeof ((x) [0])))
  ------------------
 1064|       |
 1065|    529|	while (len > 0)
  ------------------
  |  Branch (1065:9): [True: 279, False: 250]
  ------------------
 1066|    279|	{	if (len < bufferlen)
  ------------------
  |  Branch (1066:8): [True: 279, False: 0]
  ------------------
 1067|    279|			bufferlen = (int) len ;
 1068|    279|		readcount = (int) psf_fread (ubuf.sbuf, sizeof (short), bufferlen, psf) ;
 1069|    279|		les2f_array (ubuf.sbuf, readcount, ptr + total, normfact) ;
 1070|    279|		total += readcount ;
 1071|    279|		if (readcount < bufferlen)
  ------------------
  |  Branch (1071:7): [True: 29, False: 250]
  ------------------
 1072|     29|			break ;
 1073|    250|		len -= readcount ;
 1074|    250|		} ;
 1075|       |
 1076|    279|	return total ;
 1077|    279|} /* pcm_read_les2f */
pcm.c:les2f_array:
  397|    279|{	short	value ;
  398|       |
  399|  1.24k|	for (int i = 0 ; i < count ; i++)
  ------------------
  |  Branch (399:19): [True: 963, False: 279]
  ------------------
  400|    963|	{	value = src [i] ;
  401|    963|		value = LE2H_16 (value) ;
  ------------------
  |  |  137|    963|	#define LE2H_16(x)			(x)
  ------------------
  402|    963|		dest [i] = ((float) value) * normfact ;
  403|    963|		} ;
  404|    279|} /* les2f_array */
pcm.c:pcm_read_bet2f:
 1081|    401|{	BUF_UNION	ubuf ;
 1082|    401|	int			bufferlen, readcount ;
 1083|    401|	sf_count_t	total = 0 ;
 1084|    401|	float	normfact ;
 1085|       |
 1086|       |	/* Special normfactor because tribyte value is read into an int. */
 1087|    401|	normfact = (psf->norm_float == SF_TRUE) ? 1.0 / ((float) 0x80000000) : 1.0 / 256.0 ;
  ------------------
  |  Branch (1087:13): [True: 401, False: 0]
  ------------------
 1088|       |
 1089|    401|	bufferlen = sizeof (ubuf.ucbuf) / SIZEOF_TRIBYTE ;
  ------------------
  |  |   35|    401|#define	SIZEOF_TRIBYTE	3
  ------------------
 1090|       |
 1091|    778|	while (len > 0)
  ------------------
  |  Branch (1091:9): [True: 401, False: 377]
  ------------------
 1092|    401|	{	if (len < bufferlen)
  ------------------
  |  Branch (1092:8): [True: 401, False: 0]
  ------------------
 1093|    401|			bufferlen = (int) len ;
 1094|    401|		readcount = (int) psf_fread (ubuf.ucbuf, SIZEOF_TRIBYTE, bufferlen, psf) ;
  ------------------
  |  |   35|    401|#define	SIZEOF_TRIBYTE	3
  ------------------
 1095|    401|		bet2f_array ((tribyte*) (ubuf.ucbuf), readcount, ptr + total, normfact) ;
 1096|    401|		total += readcount ;
 1097|    401|		if (readcount < bufferlen)
  ------------------
  |  Branch (1097:7): [True: 24, False: 377]
  ------------------
 1098|     24|			break ;
 1099|    377|		len -= readcount ;
 1100|    377|		} ;
 1101|       |
 1102|    401|	return total ;
 1103|    401|} /* pcm_read_bet2f */
pcm.c:bet2f_array:
  429|    401|{	int value ;
  430|       |
  431|    982|	for (int i = 0 ; i < count ; i++)
  ------------------
  |  Branch (431:19): [True: 581, False: 401]
  ------------------
  432|    581|	{	value = psf_get_be24 (src [i].bytes, 0) ;
  433|    581|		dest [i] = ((float) value) * normfact ;
  434|    581|		} ;
  435|    401|} /* bet2f_array */
pcm.c:pcm_read_let2f:
 1107|   495k|{	BUF_UNION	ubuf ;
 1108|   495k|	int			bufferlen, readcount ;
 1109|   495k|	sf_count_t	total = 0 ;
 1110|   495k|	float	normfact ;
 1111|       |
 1112|       |	/* Special normfactor because tribyte value is read into an int. */
 1113|   495k|	normfact = (psf->norm_float == SF_TRUE) ? 1.0 / ((float) 0x80000000) : 1.0 / 256.0 ;
  ------------------
  |  Branch (1113:13): [True: 495k, False: 0]
  ------------------
 1114|       |
 1115|   495k|	bufferlen = sizeof (ubuf.ucbuf) / SIZEOF_TRIBYTE ;
  ------------------
  |  |   35|   495k|#define	SIZEOF_TRIBYTE	3
  ------------------
 1116|       |
 1117|   990k|	while (len > 0)
  ------------------
  |  Branch (1117:9): [True: 495k, False: 495k]
  ------------------
 1118|   495k|	{	if (len < bufferlen)
  ------------------
  |  Branch (1118:8): [True: 495k, False: 0]
  ------------------
 1119|   495k|			bufferlen = (int) len ;
 1120|   495k|		readcount = (int) psf_fread (ubuf.ucbuf, SIZEOF_TRIBYTE, bufferlen, psf) ;
  ------------------
  |  |   35|   495k|#define	SIZEOF_TRIBYTE	3
  ------------------
 1121|   495k|		let2f_array ((tribyte*) (ubuf.ucbuf), readcount, ptr + total, normfact) ;
 1122|   495k|		total += readcount ;
 1123|   495k|		if (readcount < bufferlen)
  ------------------
  |  Branch (1123:7): [True: 31, False: 495k]
  ------------------
 1124|     31|			break ;
 1125|   495k|		len -= readcount ;
 1126|   495k|		} ;
 1127|       |
 1128|   495k|	return total ;
 1129|   495k|} /* pcm_read_let2f */
pcm.c:let2f_array:
  419|   495k|{	int value ;
  420|       |
  421|  2.50M|	for (int i = 0 ; i < count ; i++)
  ------------------
  |  Branch (421:19): [True: 2.00M, False: 495k]
  ------------------
  422|  2.00M|	{	value = psf_get_le24 (src [i].bytes, 0) ;
  423|  2.00M|		dest [i] = ((float) value) * normfact ;
  424|  2.00M|		} ;
  425|   495k|} /* let2f_array */
pcm.c:pcm_read_bei2f:
 1133|    216|{	BUF_UNION	ubuf ;
 1134|    216|	int			bufferlen, readcount ;
 1135|    216|	sf_count_t	total = 0 ;
 1136|    216|	float	normfact ;
 1137|       |
 1138|    216|	normfact = (psf->norm_float == SF_TRUE) ? 1.0 / ((float) 0x80000000) : 1.0 ;
  ------------------
  |  Branch (1138:13): [True: 216, False: 0]
  ------------------
 1139|       |
 1140|    216|	bufferlen = ARRAY_LEN (ubuf.ibuf) ;
  ------------------
  |  |   93|    216|#define		ARRAY_LEN(x)	((int) (sizeof (x) / sizeof ((x) [0])))
  ------------------
 1141|       |
 1142|    424|	while (len > 0)
  ------------------
  |  Branch (1142:9): [True: 216, False: 208]
  ------------------
 1143|    216|	{	if (len < bufferlen)
  ------------------
  |  Branch (1143:8): [True: 216, False: 0]
  ------------------
 1144|    216|			bufferlen = (int) len ;
 1145|    216|		readcount = (int) psf_fread (ubuf.ibuf, sizeof (int), bufferlen, psf) ;
 1146|    216|		bei2f_array (ubuf.ibuf, readcount, ptr + total, normfact) ;
 1147|    216|		total += readcount ;
 1148|    216|		if (readcount < bufferlen)
  ------------------
  |  Branch (1148:7): [True: 8, False: 208]
  ------------------
 1149|      8|			break ;
 1150|    208|		len -= readcount ;
 1151|    208|		} ;
 1152|       |
 1153|    216|	return total ;
 1154|    216|} /* pcm_read_bei2f */
pcm.c:bei2f_array:
  450|    216|{	int 			value ;
  451|       |
  452|    624|	for (int i = 0 ; i < count ; i++)
  ------------------
  |  Branch (452:19): [True: 408, False: 216]
  ------------------
  453|    408|	{	value = src [i] ;
  454|       |		value = BE2H_32 (value) ;
  ------------------
  |  |  141|    408|	#define BE2H_32(x)			ENDSWAP_32 (x)
  |  |  ------------------
  |  |  |  |   35|    408|#define	ENDSWAP_32(x)		(bswap_32 (x))
  |  |  ------------------
  ------------------
  455|    408|		dest [i] = ((float) value) * normfact ;
  456|    408|		} ;
  457|    216|} /* bei2f_array */
pcm.c:pcm_read_lei2f:
 1158|  16.9k|{	BUF_UNION	ubuf ;
 1159|  16.9k|	int			bufferlen, readcount ;
 1160|  16.9k|	sf_count_t	total = 0 ;
 1161|  16.9k|	float	normfact ;
 1162|       |
 1163|  16.9k|	normfact = (psf->norm_float == SF_TRUE) ? 1.0 / ((float) 0x80000000) : 1.0 ;
  ------------------
  |  Branch (1163:13): [True: 16.9k, False: 0]
  ------------------
 1164|       |
 1165|  16.9k|	bufferlen = ARRAY_LEN (ubuf.ibuf) ;
  ------------------
  |  |   93|  16.9k|#define		ARRAY_LEN(x)	((int) (sizeof (x) / sizeof ((x) [0])))
  ------------------
 1166|       |
 1167|  33.9k|	while (len > 0)
  ------------------
  |  Branch (1167:9): [True: 16.9k, False: 16.9k]
  ------------------
 1168|  16.9k|	{	if (len < bufferlen)
  ------------------
  |  Branch (1168:8): [True: 16.9k, False: 0]
  ------------------
 1169|  16.9k|			bufferlen = (int) len ;
 1170|  16.9k|		readcount = (int) psf_fread (ubuf.ibuf, sizeof (int), bufferlen, psf) ;
 1171|  16.9k|		lei2f_array (ubuf.ibuf, readcount, ptr + total, normfact) ;
 1172|  16.9k|		total += readcount ;
 1173|  16.9k|		if (readcount < bufferlen)
  ------------------
  |  Branch (1173:7): [True: 25, False: 16.9k]
  ------------------
 1174|     25|			break ;
 1175|  16.9k|		len -= readcount ;
 1176|  16.9k|		} ;
 1177|       |
 1178|  16.9k|	return total ;
 1179|  16.9k|} /* pcm_read_lei2f */
pcm.c:lei2f_array:
  439|  16.9k|{	int 			value ;
  440|       |
  441|  92.9k|	for (int i = 0 ; i < count ; i++)
  ------------------
  |  Branch (441:19): [True: 75.9k, False: 16.9k]
  ------------------
  442|  75.9k|	{	value = src [i] ;
  443|  75.9k|		value = LE2H_32 (value) ;
  ------------------
  |  |  138|  75.9k|	#define LE2H_32(x)			(x)
  ------------------
  444|  75.9k|		dest [i] = ((float) value) * normfact ;
  445|  75.9k|		} ;
  446|  16.9k|} /* lei2f_array */

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

rf64_open:
   87|  2.32k|{	WAVLIKE_PRIVATE *wpriv ;
   88|  2.32k|	int	subformat, error = 0 ;
   89|  2.32k|	int blockalign, framesperblock ;
   90|       |
   91|  2.32k|	if ((wpriv = calloc (1, sizeof (WAVLIKE_PRIVATE))) == NULL)
  ------------------
  |  Branch (91:6): [True: 0, False: 2.32k]
  ------------------
   92|      0|		return SFE_MALLOC_FAILED ;
   93|  2.32k|	psf->container_data = wpriv ;
   94|  2.32k|	wpriv->wavex_ambisonic = SF_AMBISONIC_NONE ;
   95|       |
   96|       |	/* All RF64 files are little endian. */
   97|  2.32k|	psf->endian = SF_ENDIAN_LITTLE ;
   98|       |
   99|  2.32k|	psf->strings.flags = SF_STR_ALLOW_START | SF_STR_ALLOW_END ;
  100|       |
  101|  2.32k|	if (psf->file.mode == SFM_READ || (psf->file.mode == SFM_RDWR && psf->filelength > 0))
  ------------------
  |  Branch (101:6): [True: 2.32k, False: 0]
  |  Branch (101:37): [True: 0, False: 0]
  |  Branch (101:67): [True: 0, False: 0]
  ------------------
  102|  2.32k|	{	if ((error = rf64_read_header (psf, &blockalign, &framesperblock)) != 0)
  ------------------
  |  Branch (102:8): [True: 1.90k, False: 428]
  ------------------
  103|  1.90k|			return error ;
  104|       |
  105|    428|		psf->next_chunk_iterator = rf64_next_chunk_iterator ;
  106|    428|		psf->get_chunk_size = rf64_get_chunk_size ;
  107|    428|		psf->get_chunk_data = rf64_get_chunk_data ;
  108|    428|		} ;
  109|       |
  110|    428|	if ((psf->sf.format & SF_FORMAT_TYPEMASK) != SF_FORMAT_RF64)
  ------------------
  |  Branch (110:6): [True: 0, False: 428]
  ------------------
  111|      0|		return	SFE_BAD_OPEN_FORMAT ;
  112|       |
  113|    428|	subformat = psf->sf.format & SF_FORMAT_SUBMASK ;
  114|       |
  115|    428|	if (psf->file.mode == SFM_WRITE || psf->file.mode == SFM_RDWR)
  ------------------
  |  Branch (115:6): [True: 0, False: 428]
  |  Branch (115:37): [True: 0, False: 428]
  ------------------
  116|      0|	{	if (psf->is_pipe)
  ------------------
  |  Branch (116:8): [True: 0, False: 0]
  ------------------
  117|      0|			return SFE_NO_PIPE_WRITE ;
  118|       |
  119|      0|		psf->blockwidth = (sf_count_t) psf->bytewidth * psf->sf.channels ;
  120|       |
  121|      0|		if ((error = rf64_write_header (psf, SF_FALSE)))
  ------------------
  |  Branch (121:7): [True: 0, False: 0]
  ------------------
  122|      0|			return error ;
  123|       |
  124|      0|		psf->write_header = rf64_write_header ;
  125|      0|		psf->set_chunk = rf64_set_chunk ;
  126|    428|		} ;
  127|       |
  128|    428|	psf->container_close = rf64_close ;
  129|    428|	psf->command = rf64_command ;
  130|       |
  131|    428|	switch (subformat)
  132|    428|	{	case SF_FORMAT_PCM_U8 :
  ------------------
  |  Branch (132:4): [True: 12, False: 416]
  ------------------
  133|     14|		case SF_FORMAT_PCM_16 :
  ------------------
  |  Branch (133:3): [True: 2, False: 426]
  ------------------
  134|     32|		case SF_FORMAT_PCM_24 :
  ------------------
  |  Branch (134:3): [True: 18, False: 410]
  ------------------
  135|     43|		case SF_FORMAT_PCM_32 :
  ------------------
  |  Branch (135:3): [True: 11, False: 417]
  ------------------
  136|     43|					error = pcm_init (psf) ;
  137|     43|					break ;
  138|       |
  139|    161|		case SF_FORMAT_ULAW :
  ------------------
  |  Branch (139:3): [True: 161, False: 267]
  ------------------
  140|    161|					error = ulaw_init (psf) ;
  141|    161|					break ;
  142|       |
  143|     82|		case SF_FORMAT_ALAW :
  ------------------
  |  Branch (143:3): [True: 82, False: 346]
  ------------------
  144|     82|					error = alaw_init (psf) ;
  145|     82|					break ;
  146|       |
  147|       |		/* Lite remove start */
  148|     46|		case SF_FORMAT_FLOAT :
  ------------------
  |  Branch (148:3): [True: 46, False: 382]
  ------------------
  149|     46|					error = float32_init (psf) ;
  150|     46|					break ;
  151|       |
  152|     26|		case SF_FORMAT_DOUBLE :
  ------------------
  |  Branch (152:3): [True: 26, False: 402]
  ------------------
  153|     26|					error = double64_init (psf) ;
  154|     26|					break ;
  155|       |
  156|       |		/* Lite remove end */
  157|       |
  158|     70|		default : 	return SFE_UNIMPLEMENTED ;
  ------------------
  |  Branch (158:3): [True: 70, False: 358]
  ------------------
  159|    428|		} ;
  160|       |
  161|    358|	return error ;
  162|    428|} /* rf64_open */
rf64.c:rf64_read_header:
  180|  2.32k|{	WAVLIKE_PRIVATE	*wpriv ;
  181|  2.32k|	WAV_FMT		*wav_fmt ;
  182|  2.32k|	sf_count_t riff_size = 0, frame_count = 0, ds64_datalength = 0 ;
  183|  2.32k|	uint32_t marks [2], marker, chunk_size, parsestage = 0 ;
  184|  2.32k|	int error, done = 0, format = 0 ;
  185|       |
  186|  2.32k|	if ((wpriv = psf->container_data) == NULL)
  ------------------
  |  Branch (186:6): [True: 0, False: 2.32k]
  ------------------
  187|      0|		return SFE_INTERNAL ;
  188|  2.32k|	wav_fmt = &wpriv->wav_fmt ;
  189|       |
  190|       |	/* Set position to start of file to begin reading header. */
  191|  2.32k|	psf_binheader_readf (psf, "pmmm", 0, &marker, marks, marks + 1) ;
  192|  2.32k|	if (marker != RF64_MARKER || marks [1] != WAVE_MARKER)
  ------------------
  |  |   43|  2.32k|#define	RF64_MARKER		MAKE_MARKER ('R', 'F', '6', '4')
  |  |  ------------------
  |  |  |  |  122|  4.65k|	#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.32k|#define	WAVE_MARKER		MAKE_MARKER ('W', 'A', 'V', 'E')
  |  |  ------------------
  |  |  |  |  122|  2.32k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (192:6): [True: 0, False: 2.32k]
  |  Branch (192:31): [True: 0, False: 2.32k]
  ------------------
  193|      0|		return SFE_RF64_NOT_RF64 ;
  194|       |
  195|  2.32k|	if (marks [0] == FFFF_MARKER)
  ------------------
  |  |   46|  2.32k|#define	FFFF_MARKER		MAKE_MARKER (0xff, 0xff, 0xff, 0xff)
  |  |  ------------------
  |  |  |  |  122|  2.32k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (195:6): [True: 7, False: 2.32k]
  ------------------
  196|      7|		psf_log_printf (psf, "%M\n  %M\n", RF64_MARKER, WAVE_MARKER) ;
  ------------------
  |  |   43|      7|#define	RF64_MARKER		MAKE_MARKER ('R', 'F', '6', '4')
  |  |  ------------------
  |  |  |  |  122|      7|	#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|      7|#define	WAVE_MARKER		MAKE_MARKER ('W', 'A', 'V', 'E')
  |  |  ------------------
  |  |  |  |  122|      7|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  197|  2.32k|	else
  198|  2.32k|		psf_log_printf (psf, "%M : 0x%x (should be 0xFFFFFFFF)\n  %M\n", RF64_MARKER, WAVE_MARKER) ;
  ------------------
  |  |   43|  2.32k|#define	RF64_MARKER		MAKE_MARKER ('R', 'F', '6', '4')
  |  |  ------------------
  |  |  |  |  122|  2.32k|	#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.32k|#define	WAVE_MARKER		MAKE_MARKER ('W', 'A', 'V', 'E')
  |  |  ------------------
  |  |  |  |  122|  2.32k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  199|       |
  200|   845k|	while (!done)
  ------------------
  |  Branch (200:9): [True: 845k, False: 10]
  ------------------
  201|   845k|	{
  202|   845k|		marker = chunk_size = 0 ;
  203|   845k|		psf_binheader_readf (psf, "em4", &marker, &chunk_size) ;
  204|       |
  205|   845k|		if (marker == 0)
  ------------------
  |  Branch (205:7): [True: 408, False: 845k]
  ------------------
  206|    408|		{	sf_count_t pos = psf_ftell (psf) ;
  207|    408|			psf_log_printf (psf, "Have 0 marker at position %D (0x%x).\n", pos, pos) ;
  208|    408|			break ;
  209|   845k|			} ;
  210|       |
  211|   845k|		psf_store_read_chunk_u32 (&psf->rchunks, marker, psf_ftell (psf), chunk_size) ;
  212|       |
  213|   845k|		switch (marker)
  214|   845k|		{	case ds64_MARKER :
  ------------------
  |  |   48|  10.1k|#define	ds64_MARKER		MAKE_MARKER ('d', 's', '6', '4')
  |  |  ------------------
  |  |  |  |  122|  10.1k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (214:5): [True: 10.1k, False: 834k]
  ------------------
  215|  10.1k|				if (parsestage & HAVE_ds64)
  ------------------
  |  Branch (215:9): [True: 9.15k, False: 1.04k]
  ------------------
  216|  9.15k|				{	psf_log_printf (psf, "*** Second 'ds64' chunk?\n") ;
  217|  9.15k|					break ;
  218|  9.15k|					} ;
  219|       |
  220|  1.04k|				{	unsigned int table_len, bytesread ;
  221|       |
  222|       |					/* Read ds64 sizes (3 8-byte words). */
  223|  1.04k|					bytesread = psf_binheader_readf (psf, "888", &riff_size, &ds64_datalength, &frame_count) ;
  224|       |
  225|       |					/* Read table length. */
  226|  1.04k|					bytesread += psf_binheader_readf (psf, "4", &table_len) ;
  227|       |					/* Skip table for now. (this was "table_len + 4", why?) */
  228|  1.04k|					bytesread += psf_binheader_readf (psf, "j", table_len) ;
  229|       |
  230|  1.04k|					if (chunk_size == bytesread)
  ------------------
  |  Branch (230:10): [True: 2, False: 1.04k]
  ------------------
  231|      2|						psf_log_printf (psf, "%M : %u\n", marker, chunk_size) ;
  232|  1.04k|					else if (chunk_size >= bytesread + 4)
  ------------------
  |  Branch (232:15): [True: 95, False: 949]
  ------------------
  233|     95|					{	unsigned int next ;
  234|     95|						psf_binheader_readf (psf, "m", &next) ;
  235|     95|						if (next == fmt_MARKER)
  ------------------
  |  |   49|     95|#define	fmt_MARKER		MAKE_MARKER ('f', 'm', 't', ' ')
  |  |  ------------------
  |  |  |  |  122|     95|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (235:11): [True: 4, False: 91]
  ------------------
  236|      4|						{	psf_log_printf (psf, "%M : %u (should be %u)\n", marker, chunk_size, bytesread) ;
  237|      4|							psf_binheader_readf (psf, "j", -4) ;
  238|      4|							}
  239|     91|						else
  240|     91|						{	psf_log_printf (psf, "%M : %u\n", marker, chunk_size) ;
  241|     91|							psf_binheader_readf (psf, "j", chunk_size - bytesread - 4) ;
  242|     91|							} ;
  243|     95|						} ;
  244|       |
  245|  1.04k|					if (psf->filelength - 8 != riff_size)
  ------------------
  |  Branch (245:10): [True: 1.04k, False: 1]
  ------------------
  246|  1.04k|						psf_log_printf (psf, "  Riff size : %D (should be %D)\n", riff_size, psf->filelength - 8) ;
  247|      1|					else
  248|      1|						psf_log_printf (psf, "  Riff size : %D\n", riff_size) ;
  249|       |
  250|  1.04k|					psf_log_printf (psf, "  Data size : %D\n", ds64_datalength) ;
  251|       |
  252|  1.04k|					psf_log_printf (psf, "  Frames    : %D\n", frame_count) ;
  253|  1.04k|					psf_log_printf (psf, "  Table length : %u\n", table_len) ;
  254|       |
  255|  1.04k|					} ;
  256|  1.04k|				parsestage |= HAVE_ds64 ;
  257|  1.04k|				break ;
  258|       |
  259|   127k|			case fmt_MARKER:
  ------------------
  |  |   49|   127k|#define	fmt_MARKER		MAKE_MARKER ('f', 'm', 't', ' ')
  |  |  ------------------
  |  |  |  |  122|   127k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (259:4): [True: 127k, False: 717k]
  ------------------
  260|   127k|					psf_log_printf (psf, "%M : %u\n", marker, chunk_size) ;
  261|   127k|					if ((error = wavlike_read_fmt_chunk (psf, chunk_size)) != 0)
  ------------------
  |  Branch (261:10): [True: 131, False: 127k]
  ------------------
  262|    131|						return error ;
  263|   127k|					format = wav_fmt->format ;
  264|   127k|					parsestage |= HAVE_fmt ;
  265|   127k|					break ;
  266|       |
  267|  15.1k|			case bext_MARKER :
  ------------------
  |  |   53|  15.1k|#define bext_MARKER		MAKE_MARKER ('b', 'e', 'x', 't')
  |  |  ------------------
  |  |  |  |  122|  15.1k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (267:4): [True: 15.1k, False: 829k]
  ------------------
  268|  15.1k|					if ((error = wavlike_read_bext_chunk (psf, chunk_size)) != 0)
  ------------------
  |  Branch (268:10): [True: 0, False: 15.1k]
  ------------------
  269|      0|						return error ;
  270|  15.1k|					parsestage |= HAVE_bext ;
  271|  15.1k|					break ;
  272|       |
  273|  1.90k|			case cart_MARKER :
  ------------------
  |  |   54|  1.90k|#define cart_MARKER		MAKE_MARKER ('c', 'a', 'r', 't')
  |  |  ------------------
  |  |  |  |  122|  1.90k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (273:4): [True: 1.90k, False: 843k]
  ------------------
  274|  1.90k|					if ((error = wavlike_read_cart_chunk (psf, chunk_size)) != 0)
  ------------------
  |  Branch (274:10): [True: 0, False: 1.90k]
  ------------------
  275|      0|						return error ;
  276|  1.90k|					parsestage |= HAVE_cart ;
  277|  1.90k|					break ;
  278|       |
  279|  71.6k|			case INFO_MARKER :
  ------------------
  |  |   37|  71.6k|#define INFO_MARKER		MAKE_MARKER ('I', 'N', 'F', 'O')
  |  |  ------------------
  |  |  |  |  122|  71.6k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (279:4): [True: 71.6k, False: 773k]
  ------------------
  280|  77.5k|			case LIST_MARKER :
  ------------------
  |  |   57|  77.5k|#define LIST_MARKER		MAKE_MARKER ('L', 'I', 'S', 'T')
  |  |  ------------------
  |  |  |  |  122|  77.5k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (280:4): [True: 5.87k, False: 839k]
  ------------------
  281|  77.5k|					if ((error = wavlike_subchunk_parse (psf, marker, chunk_size)) != 0)
  ------------------
  |  Branch (281:10): [True: 0, False: 77.5k]
  ------------------
  282|      0|						return error ;
  283|  77.5k|					parsestage |= HAVE_other ;
  284|  77.5k|					break ;
  285|       |
  286|  7.51k|			case PEAK_MARKER :
  ------------------
  |  |   40|  7.51k|#define PEAK_MARKER		MAKE_MARKER ('P', 'E', 'A', 'K')
  |  |  ------------------
  |  |  |  |  122|  7.51k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (286:4): [True: 7.51k, False: 837k]
  ------------------
  287|  7.51k|					if ((parsestage & (HAVE_ds64 | HAVE_fmt)) != (HAVE_ds64 | HAVE_fmt))
  ------------------
  |  Branch (287:10): [True: 1, False: 7.51k]
  ------------------
  288|      1|						return SFE_RF64_PEAK_B4_FMT ;
  289|       |
  290|  7.51k|					parsestage |= HAVE_PEAK ;
  291|       |
  292|  7.51k|					psf_log_printf (psf, "%M : %u\n", marker, chunk_size) ;
  293|  7.51k|					if ((error = wavlike_read_peak_chunk (psf, chunk_size)) != 0)
  ------------------
  |  Branch (293:10): [True: 1, False: 7.51k]
  ------------------
  294|      1|						return error ;
  295|  7.51k|					psf->peak_info->peak_loc = ((parsestage & HAVE_data) == 0) ? SF_PEAK_START : SF_PEAK_END ;
  ------------------
  |  Branch (295:33): [True: 7.51k, False: 0]
  ------------------
  296|  7.51k|					break ;
  297|       |
  298|   334k|			case data_MARKER :
  ------------------
  |  |   51|   334k|#define	data_MARKER		MAKE_MARKER ('d', 'a', 't', 'a')
  |  |  ------------------
  |  |  |  |  122|   334k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (298:4): [True: 334k, False: 510k]
  ------------------
  299|       |				/* see wav for more sophisticated parsing -> implement state machine with parsestage */
  300|       |
  301|   334k|				if (HAVE_CHUNK (HAVE_ds64))
  ------------------
  |  |  176|   334k|#define HAVE_CHUNK(CHUNK)	((parsestage & CHUNK) != 0)
  |  |  ------------------
  |  |  |  Branch (176:27): [True: 333k, False: 1.04k]
  |  |  ------------------
  ------------------
  302|   333k|				{	if (chunk_size == 0xffffffff)
  ------------------
  |  Branch (302:11): [True: 5.92k, False: 327k]
  ------------------
  303|  5.92k|						psf_log_printf (psf, "%M : 0x%x\n", marker, chunk_size) ;
  304|   327k|					else
  305|   327k|						psf_log_printf (psf, "%M : 0x%x (should be 0xffffffff\n", marker, chunk_size) ;
  306|   333k|					psf->datalength = ds64_datalength ;
  307|   333k|					}
  308|  1.04k|				else
  309|  1.04k|				{	if (chunk_size == 0xffffffff)
  ------------------
  |  Branch (309:11): [True: 448, False: 596]
  ------------------
  310|    448|					{	psf_log_printf (psf, "%M : 0x%x\n", marker, chunk_size) ;
  311|    448|						psf_log_printf (psf, "  *** Data length not specified no 'ds64' chunk.\n") ;
  312|    448|						}
  313|    596|					else
  314|    596|					{	psf_log_printf (psf, "%M : 0x%x\n**** Weird, RF64 file without a 'ds64' chunk and no valid 'data' size.\n", marker, chunk_size) ;
  315|    596|						psf->datalength = chunk_size ;
  316|    596|						} ;
  317|  1.04k|					} ;
  318|       |
  319|   334k|				psf->dataoffset = psf_ftell (psf) ;
  320|       |
  321|   334k|				if (psf->dataoffset > 0)
  ------------------
  |  Branch (321:9): [True: 332k, False: 2.46k]
  ------------------
  322|   332k|				{	if (chunk_size == 0 && riff_size == 8 && psf->filelength > 44)
  ------------------
  |  Branch (322:11): [True: 151k, False: 180k]
  |  Branch (322:30): [True: 2, False: 151k]
  |  Branch (322:48): [True: 2, False: 0]
  ------------------
  323|      2|					{	psf_log_printf (psf, "  *** Looks like a WAV file which wasn't closed properly. Fixing it.\n") ;
  324|      2|						psf->datalength = psf->filelength - psf->dataoffset ;
  325|      2|						} ;
  326|       |
  327|       |					/* Only set dataend if there really is data at the end. */
  328|   332k|					if (psf->datalength + psf->dataoffset < psf->filelength)
  ------------------
  |  Branch (328:10): [True: 331k, False: 226]
  ------------------
  329|   331k|						psf->dataend = psf->datalength + psf->dataoffset ;
  330|       |
  331|   332k|					if (!psf->sf.seekable || psf->dataoffset < 0)
  ------------------
  |  Branch (331:10): [True: 0, False: 332k]
  |  Branch (331:31): [True: 0, False: 332k]
  ------------------
  332|      0|						break ;
  333|       |
  334|       |					/* Seek past data and continue reading header. */
  335|   332k|					psf_fseek (psf, psf->datalength, SEEK_CUR) ;
  336|       |
  337|   332k|					if (psf_ftell (psf) != psf->datalength + psf->dataoffset)
  ------------------
  |  Branch (337:10): [True: 241k, False: 90.9k]
  ------------------
  338|   241k|						psf_log_printf (psf, "  *** psf_fseek past end error ***\n") ;
  339|   334k|					} ;
  340|   334k|				break ;
  341|       |
  342|  1.37k|			case JUNK_MARKER :
  ------------------
  |  |   45|  1.37k|#define	JUNK_MARKER		MAKE_MARKER ('J', 'U', 'N', 'K')
  |  |  ------------------
  |  |  |  |  122|  1.37k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (342:4): [True: 1.37k, False: 843k]
  ------------------
  343|  2.67k|			case PAD_MARKER :
  ------------------
  |  |   39|  2.67k|#define PAD_MARKER		MAKE_MARKER ('P', 'A', 'D', ' ')
  |  |  ------------------
  |  |  |  |  122|  2.67k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (343:4): [True: 1.29k, False: 843k]
  ------------------
  344|  2.67k|				psf_log_printf (psf, "%M : %d\n", marker, chunk_size) ;
  345|  2.67k|				psf_binheader_readf (psf, "j", chunk_size) ;
  346|  2.67k|				break ;
  347|       |
  348|   267k|			default :
  ------------------
  |  Branch (348:4): [True: 267k, False: 577k]
  ------------------
  349|   267k|					if (chunk_size >= 0xffff0000)
  ------------------
  |  Branch (349:10): [True: 17, False: 267k]
  ------------------
  350|     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) ;
  351|     17|						done = SF_TRUE ;
  352|     17|						break ;
  353|   267k|						} ;
  354|       |
  355|   267k|					if (isprint ((marker >> 24) & 0xFF) && isprint ((marker >> 16) & 0xFF)
  ------------------
  |  Branch (355:10): [True: 267k, False: 125]
  |  Branch (355:45): [True: 267k, False: 103]
  ------------------
  356|   267k|						&& isprint ((marker >> 8) & 0xFF) && isprint (marker & 0xFF))
  ------------------
  |  Branch (356:10): [True: 267k, False: 74]
  |  Branch (356:44): [True: 267k, False: 52]
  ------------------
  357|   267k|					{	psf_log_printf (psf, "*** %M : %d (unknown marker)\n", marker, chunk_size) ;
  358|   267k|						psf_binheader_readf (psf, "j", chunk_size) ;
  359|   267k|						break ;
  360|   267k|						} ;
  361|    354|					if (psf_ftell (psf) & 0x03)
  ------------------
  |  Branch (361:10): [True: 133, False: 221]
  ------------------
  362|    133|					{	psf_log_printf (psf, "  Unknown chunk marker at position 0x%x. Resynching.\n", chunk_size - 4) ;
  363|    133|						psf_binheader_readf (psf, "j", -3) ;
  364|    133|						break ;
  365|    221|						} ;
  366|    221|					psf_log_printf (psf, "*** Unknown chunk marker (0x%X) at position 0x%X. Exiting parser.\n", marker, psf_ftell (psf) - 4) ;
  367|    221|					done = SF_TRUE ;
  368|    221|					break ;
  369|   845k|			} ;	/* switch (marker) */
  370|       |
  371|       |		/* The 'data' chunk, a chunk size of 0xffffffff means that the 'data' chunk size
  372|       |		** is actually given by the ds64_datalength field.
  373|       |		*/
  374|   844k|		if (marker != data_MARKER && chunk_size >= psf->filelength)
  ------------------
  |  |   51|   844k|#define	data_MARKER		MAKE_MARKER ('d', 'a', 't', 'a')
  |  |  ------------------
  |  |  |  |  122|  1.68M|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (374:7): [True: 510k, False: 334k]
  |  Branch (374:32): [True: 1.02k, False: 509k]
  ------------------
  375|  1.02k|		{	psf_log_printf (psf, "*** Chunk size %u > file length %D. Exiting parser.\n", chunk_size, psf->filelength) ;
  376|  1.02k|			break ;
  377|   843k|			} ;
  378|       |
  379|   843k|		if (psf_ftell (psf) >= psf->filelength - SIGNED_SIZEOF (marker))
  ------------------
  |  |   91|   843k|#define		SIGNED_SIZEOF(x)	((int) sizeof (x))
  ------------------
  |  Branch (379:7): [True: 751, False: 843k]
  ------------------
  380|    751|		{	psf_log_printf (psf, "End\n") ;
  381|    751|			break ;
  382|   843k|			} ;
  383|   843k|		} ;
  384|       |
  385|  2.19k|	if (psf->dataoffset <= 0)
  ------------------
  |  Branch (385:6): [True: 1.19k, False: 999]
  ------------------
  386|  1.19k|		return SFE_RF64_NO_DATA ;
  387|       |
  388|    999|	if (psf->sf.channels < 1)
  ------------------
  |  Branch (388:6): [True: 520, False: 479]
  ------------------
  389|    520|		return SFE_CHANNEL_COUNT_ZERO ;
  390|       |
  391|    479|	if (psf->sf.channels > SF_MAX_CHANNELS)
  ------------------
  |  |  102|    479|#define		SF_MAX_CHANNELS		1024
  ------------------
  |  Branch (391:6): [True: 32, False: 447]
  ------------------
  392|     32|		return SFE_CHANNEL_COUNT ;
  393|       |
  394|       |	/* WAVs can be little or big endian */
  395|    447|	psf->endian = psf->rwf_endian ;
  396|       |
  397|    447|	psf_fseek (psf, psf->dataoffset, SEEK_SET) ;
  398|       |
  399|    447|	if (psf->is_pipe == 0)
  ------------------
  |  Branch (399:6): [True: 447, False: 0]
  ------------------
  400|    447|	{	/*
  401|       |		** Check for 'wvpk' at the start of the DATA section. Not able to
  402|       |		** handle this.
  403|       |		*/
  404|    447|		psf_binheader_readf (psf, "4", &marker) ;
  405|    447|		if (marker == wvpk_MARKER || marker == OggS_MARKER)
  ------------------
  |  |   56|    447|#define wvpk_MARKER		MAKE_MARKER ('w', 'v', 'p', 'k')
  |  |  ------------------
  |  |  |  |  122|    894|	#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|    446|#define OggS_MARKER		MAKE_MARKER ('O', 'g', 'g', 'S')
  |  |  ------------------
  |  |  |  |  122|    446|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (405:7): [True: 1, False: 446]
  |  Branch (405:32): [True: 1, False: 445]
  ------------------
  406|      2|			return SFE_WAV_WVPK_DATA ;
  407|    447|		} ;
  408|       |
  409|       |	/* Seek to start of DATA section. */
  410|    445|	psf_fseek (psf, psf->dataoffset, SEEK_SET) ;
  411|       |
  412|    445|	if (psf->blockwidth)
  ------------------
  |  Branch (412:6): [True: 363, False: 82]
  ------------------
  413|    363|	{	if (psf->filelength - psf->dataoffset < psf->datalength)
  ------------------
  |  Branch (413:8): [True: 125, False: 238]
  ------------------
  414|    125|			psf->sf.frames = (psf->filelength - psf->dataoffset) / psf->blockwidth ;
  415|    238|		else
  416|    238|			psf->sf.frames = psf->datalength / psf->blockwidth ;
  417|    363|		} ;
  418|       |
  419|    445|	if (frame_count != psf->sf.frames)
  ------------------
  |  Branch (419:6): [True: 368, False: 77]
  ------------------
  420|    368|		psf_log_printf (psf, "*** Calculated frame count %d does not match value from 'ds64' chunk of %d.\n", psf->sf.frames, frame_count) ;
  421|       |
  422|    445|	switch (format)
  423|    445|	{
  424|     22|		case WAVE_FORMAT_EXTENSIBLE :
  ------------------
  |  Branch (424:3): [True: 22, False: 423]
  ------------------
  425|       |
  426|       |			/* with WAVE_FORMAT_EXTENSIBLE the psf->sf.format field is already set. We just have to set the major to rf64 */
  427|     22|			psf->sf.format = (psf->sf.format & ~SF_FORMAT_TYPEMASK) | SF_FORMAT_RF64 ;
  428|       |
  429|     22|			if (psf->sf.format == (SF_FORMAT_WAVEX | SF_FORMAT_MS_ADPCM))
  ------------------
  |  Branch (429:8): [True: 0, False: 22]
  ------------------
  430|      0|			{	*blockalign = wav_fmt->msadpcm.blockalign ;
  431|      0|				*framesperblock = wav_fmt->msadpcm.samplesperblock ;
  432|      0|				} ;
  433|     22|			break ;
  434|       |
  435|     69|		case WAVE_FORMAT_PCM :
  ------------------
  |  Branch (435:3): [True: 69, False: 376]
  ------------------
  436|     69|					psf->sf.format = SF_FORMAT_RF64 | u_bitwidth_to_subformat (psf->bytewidth * 8) ;
  437|     69|					break ;
  438|       |
  439|    160|		case WAVE_FORMAT_MULAW :
  ------------------
  |  Branch (439:3): [True: 160, False: 285]
  ------------------
  440|    160|		case IBM_FORMAT_MULAW :
  ------------------
  |  Branch (440:3): [True: 0, False: 445]
  ------------------
  441|    160|					psf->sf.format = (SF_FORMAT_RF64 | SF_FORMAT_ULAW) ;
  442|    160|					break ;
  443|       |
  444|     80|		case WAVE_FORMAT_ALAW :
  ------------------
  |  Branch (444:3): [True: 80, False: 365]
  ------------------
  445|     80|		case IBM_FORMAT_ALAW :
  ------------------
  |  Branch (445:3): [True: 0, False: 445]
  ------------------
  446|     80|					psf->sf.format = (SF_FORMAT_RF64 | SF_FORMAT_ALAW) ;
  447|     80|					break ;
  448|       |
  449|     11|		case WAVE_FORMAT_MS_ADPCM :
  ------------------
  |  Branch (449:3): [True: 11, False: 434]
  ------------------
  450|     11|					psf->sf.format = (SF_FORMAT_RF64 | SF_FORMAT_MS_ADPCM) ;
  451|     11|					*blockalign = wav_fmt->msadpcm.blockalign ;
  452|     11|					*framesperblock = wav_fmt->msadpcm.samplesperblock ;
  453|     11|					break ;
  454|       |
  455|      9|		case WAVE_FORMAT_IMA_ADPCM :
  ------------------
  |  Branch (455:3): [True: 9, False: 436]
  ------------------
  456|      9|					psf->sf.format = (SF_FORMAT_RF64 | SF_FORMAT_IMA_ADPCM) ;
  457|      9|					*blockalign = wav_fmt->ima.blockalign ;
  458|      9|					*framesperblock = wav_fmt->ima.samplesperblock ;
  459|      9|					break ;
  460|       |
  461|      8|		case WAVE_FORMAT_GSM610 :
  ------------------
  |  Branch (461:3): [True: 8, False: 437]
  ------------------
  462|      8|					psf->sf.format = (SF_FORMAT_RF64 | SF_FORMAT_GSM610) ;
  463|      8|					break ;
  464|       |
  465|     60|		case WAVE_FORMAT_IEEE_FLOAT :
  ------------------
  |  Branch (465:3): [True: 60, False: 385]
  ------------------
  466|     60|					psf->sf.format = SF_FORMAT_RF64 ;
  467|     60|					psf->sf.format |= (psf->bytewidth == 8) ? SF_FORMAT_DOUBLE : SF_FORMAT_FLOAT ;
  ------------------
  |  Branch (467:24): [True: 18, False: 42]
  ------------------
  468|     60|					break ;
  469|       |
  470|      9|		case WAVE_FORMAT_G721_ADPCM :
  ------------------
  |  Branch (470:3): [True: 9, False: 436]
  ------------------
  471|      9|					psf->sf.format = SF_FORMAT_RF64 | SF_FORMAT_G721_32 ;
  472|      9|					break ;
  473|       |
  474|     17|		default : return SFE_UNIMPLEMENTED ;
  ------------------
  |  Branch (474:3): [True: 17, False: 428]
  ------------------
  475|    445|		} ;
  476|       |
  477|    428|	if (wpriv->fmt_is_broken)
  ------------------
  |  Branch (477:6): [True: 27, False: 401]
  ------------------
  478|     27|		wavlike_analyze (psf) ;
  479|       |
  480|       |	/* Only set the format endian-ness if its non-standard big-endian. */
  481|    428|	if (psf->endian == SF_ENDIAN_BIG)
  ------------------
  |  Branch (481:6): [True: 0, False: 428]
  ------------------
  482|      0|		psf->sf.format |= SF_ENDIAN_BIG ;
  483|       |
  484|    428|	return 0 ;
  485|    445|} /* rf64_read_header */
rf64.c:rf64_close:
  805|    428|{
  806|    428|	if (psf->file.mode == SFM_WRITE || psf->file.mode == SFM_RDWR)
  ------------------
  |  Branch (806:6): [True: 0, False: 428]
  |  Branch (806:37): [True: 0, False: 428]
  ------------------
  807|      0|	{	rf64_write_tailer (psf) ;
  808|      0|		rf64_write_header (psf, SF_TRUE) ;
  809|      0|		} ;
  810|       |
  811|    428|	return 0 ;
  812|    428|} /* 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|    379|{	SDS_PRIVATE	*psds ;
  107|    379|	int			error = 0 ;
  108|       |
  109|       |	/* Hmmmm, need this here to pass update_header_test. */
  110|    379|	psf->sf.frames = 0 ;
  111|       |
  112|    379|	if (! (psds = calloc (1, sizeof (SDS_PRIVATE))))
  ------------------
  |  Branch (112:6): [True: 0, False: 379]
  ------------------
  113|      0|		return SFE_MALLOC_FAILED ;
  114|    379|	psf->codec_data = psds ;
  115|       |
  116|    379|	if (psf->file.mode == SFM_READ || (psf->file.mode == SFM_RDWR && psf->filelength > 0))
  ------------------
  |  Branch (116:6): [True: 379, False: 0]
  |  Branch (116:37): [True: 0, False: 0]
  |  Branch (116:67): [True: 0, False: 0]
  ------------------
  117|    379|	{	if ((error = sds_read_header (psf, psds)))
  ------------------
  |  Branch (117:8): [True: 18, False: 361]
  ------------------
  118|     18|			return error ;
  119|    379|		} ;
  120|       |
  121|    361|	if ((SF_CONTAINER (psf->sf.format)) != SF_FORMAT_SDS)
  ------------------
  |  |  108|    361|#define SF_CONTAINER(x)		((x) & SF_FORMAT_TYPEMASK)
  ------------------
  |  Branch (121:6): [True: 0, False: 361]
  ------------------
  122|      0|		return	SFE_BAD_OPEN_FORMAT ;
  123|       |
  124|    361|	if (psf->file.mode == SFM_WRITE || psf->file.mode == SFM_RDWR)
  ------------------
  |  Branch (124:6): [True: 0, False: 361]
  |  Branch (124:37): [True: 0, False: 361]
  ------------------
  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|    361|		} ;
  132|       |
  133|    361|	if ((error = sds_init (psf, psds)) != 0)
  ------------------
  |  Branch (133:6): [True: 8, False: 353]
  ------------------
  134|      8|		return error ;
  135|       |
  136|    353|	psf->container_close = sds_close ;
  137|    353|	psf->seek = sds_seek ;
  138|    353|	psf->byterate = sds_byterate ;
  139|       |
  140|    353|	psf->blockwidth = 0 ;
  141|       |
  142|    353|	return error ;
  143|    361|} /* sds_open */
sds.c:sds_close:
  150|    353|{
  151|    353|	if (psf->file.mode == SFM_WRITE || psf->file.mode == SFM_RDWR)
  ------------------
  |  Branch (151:6): [True: 0, False: 353]
  |  Branch (151:37): [True: 0, False: 353]
  ------------------
  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|    353|		} ;
  166|       |
  167|    353|	return 0 ;
  168|    353|} /* sds_close */
sds.c:sds_init:
  172|    361|{
  173|    361|	if (psds->bitwidth < 8 || psds->bitwidth > 28)
  ------------------
  |  Branch (173:6): [True: 5, False: 356]
  |  Branch (173:28): [True: 3, False: 353]
  ------------------
  174|      8|		return (psf->error = SFE_SDS_BAD_BIT_WIDTH) ;
  175|       |
  176|    353|	if (psds->bitwidth < 14)
  ------------------
  |  Branch (176:6): [True: 117, False: 236]
  ------------------
  177|    117|	{	psds->reader = sds_2byte_read ;
  178|    117|		psds->writer = sds_2byte_write ;
  179|    117|		psds->samplesperblock = SDS_AUDIO_BYTES_PER_BLOCK / 2 ;
  ------------------
  |  |   38|    117|#define SDS_AUDIO_BYTES_PER_BLOCK	120
  ------------------
  180|    117|		}
  181|    236|	else if (psds->bitwidth < 21)
  ------------------
  |  Branch (181:11): [True: 119, False: 117]
  ------------------
  182|    119|	{	psds->reader = sds_3byte_read ;
  183|    119|		psds->writer = sds_3byte_write ;
  184|    119|		psds->samplesperblock = SDS_AUDIO_BYTES_PER_BLOCK / 3 ;
  ------------------
  |  |   38|    119|#define SDS_AUDIO_BYTES_PER_BLOCK	120
  ------------------
  185|    119|		}
  186|    117|	else
  187|    117|	{	psds->reader = sds_4byte_read ;
  188|    117|		psds->writer = sds_4byte_write ;
  189|    117|		psds->samplesperblock = SDS_AUDIO_BYTES_PER_BLOCK / 4 ;
  ------------------
  |  |   38|    117|#define SDS_AUDIO_BYTES_PER_BLOCK	120
  ------------------
  190|    117|		} ;
  191|       |
  192|    353|	if (psf->file.mode == SFM_READ || psf->file.mode == SFM_RDWR)
  ------------------
  |  Branch (192:6): [True: 353, False: 0]
  |  Branch (192:36): [True: 0, False: 0]
  ------------------
  193|    353|	{	psf->read_short		= sds_read_s ;
  194|    353|		psf->read_int		= sds_read_i ;
  195|    353|		psf->read_float		= sds_read_f ;
  196|    353|		psf->read_double	= sds_read_d ;
  197|       |
  198|       |		/* Read first block. */
  199|    353|		psds->reader (psf, psds) ;
  200|    353|		} ;
  201|       |
  202|    353|	if (psf->file.mode == SFM_WRITE || psf->file.mode == SFM_RDWR)
  ------------------
  |  Branch (202:6): [True: 0, False: 353]
  |  Branch (202:37): [True: 0, False: 353]
  ------------------
  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|    353|	return 0 ;
  210|    361|} /* sds_init */
sds.c:sds_2byte_read:
  422|  1.12M|{	unsigned char *ucptr, checksum ;
  423|  1.12M|	unsigned int sample ;
  424|  1.12M|	int 	k ;
  425|       |
  426|  1.12M|	psds->read_block ++ ;
  427|  1.12M|	psds->read_count = 0 ;
  428|       |
  429|  1.12M|	if (psds->read_block * psds->samplesperblock > psds->frames)
  ------------------
  |  Branch (429:6): [True: 100, False: 1.12M]
  ------------------
  430|    100|	{	memset (psds->read_samples, 0, psds->samplesperblock * sizeof (int)) ;
  431|    100|		return 1 ;
  432|  1.12M|		} ;
  433|       |
  434|  1.12M|	if ((k = (int) psf_fread (psds->read_data, 1, SDS_BLOCK_SIZE, psf)) != SDS_BLOCK_SIZE)
  ------------------
  |  |   36|  1.12M|#define SDS_BLOCK_SIZE				127
  ------------------
              	if ((k = (int) psf_fread (psds->read_data, 1, SDS_BLOCK_SIZE, psf)) != SDS_BLOCK_SIZE)
  ------------------
  |  |   36|  1.12M|#define SDS_BLOCK_SIZE				127
  ------------------
  |  Branch (434:6): [True: 1.12M, False: 1.68k]
  ------------------
  435|  1.12M|		psf_log_printf (psf, "*** Warning : short read (%d != %d).\n", k, SDS_BLOCK_SIZE) ;
  ------------------
  |  |   36|  1.12M|#define SDS_BLOCK_SIZE				127
  ------------------
  436|       |
  437|  1.12M|	if (psds->read_data [0] != 0xF0)
  ------------------
  |  Branch (437:6): [True: 949k, False: 172k]
  ------------------
  438|   949k|	{	printf ("Error A : %02X\n", psds->read_data [0] & 0xFF) ;
  439|   949k|		} ;
  440|       |
  441|  1.12M|	checksum = psds->read_data [1] ;
  442|  1.12M|	if (checksum != 0x7E)
  ------------------
  |  Branch (442:6): [True: 992k, False: 130k]
  ------------------
  443|   992k|	{	printf ("Error 1 : %02X\n", checksum & 0xFF) ;
  444|   992k|		}
  445|       |
  446|   139M|	for (k = 2 ; k <= SDS_BLOCK_SIZE - 3 ; k ++)
  ------------------
  |  |   36|   139M|#define SDS_BLOCK_SIZE				127
  ------------------
  |  Branch (446:15): [True: 138M, False: 1.12M]
  ------------------
  447|   138M|		checksum ^= psds->read_data [k] ;
  448|       |
  449|  1.12M|	checksum &= 0x7F ;
  450|       |
  451|  1.12M|	if (checksum != psds->read_data [SDS_BLOCK_SIZE - 2])
  ------------------
  |  |   36|  1.12M|#define SDS_BLOCK_SIZE				127
  ------------------
  |  Branch (451:6): [True: 605k, False: 516k]
  ------------------
  452|   605k|	{	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|   605k|#define SDS_BLOCK_SIZE				127
  ------------------
  453|   605k|		} ;
  454|       |
  455|  1.12M|	ucptr = psds->read_data + 5 ;
  456|  68.4M|	for (k = 0 ; k < 120 ; k += 2)
  ------------------
  |  Branch (456:15): [True: 67.3M, False: 1.12M]
  ------------------
  457|  67.3M|	{	sample = arith_shift_left (ucptr [k], 25) | arith_shift_left (ucptr [k + 1], 18) ;
  458|  67.3M|		psds->read_samples [k / 2] = (int) (sample - 0x80000000) ;
  459|  67.3M|		} ;
  460|       |
  461|  1.12M|	return 1 ;
  462|  1.12M|} /* sds_2byte_read */
sds.c:sds_3byte_read:
  466|  1.58M|{	unsigned char *ucptr, checksum ;
  467|  1.58M|	unsigned int sample ;
  468|  1.58M|	int 	k ;
  469|       |
  470|  1.58M|	psds->read_block ++ ;
  471|  1.58M|	psds->read_count = 0 ;
  472|       |
  473|  1.58M|	if (psds->read_block * psds->samplesperblock > psds->frames)
  ------------------
  |  Branch (473:6): [True: 95, False: 1.58M]
  ------------------
  474|     95|	{	memset (psds->read_samples, 0, psds->samplesperblock * sizeof (int)) ;
  475|     95|		return 1 ;
  476|  1.58M|		} ;
  477|       |
  478|  1.58M|	if ((k = (int) psf_fread (psds->read_data, 1, SDS_BLOCK_SIZE, psf)) != SDS_BLOCK_SIZE)
  ------------------
  |  |   36|  1.58M|#define SDS_BLOCK_SIZE				127
  ------------------
              	if ((k = (int) psf_fread (psds->read_data, 1, SDS_BLOCK_SIZE, psf)) != SDS_BLOCK_SIZE)
  ------------------
  |  |   36|  1.58M|#define SDS_BLOCK_SIZE				127
  ------------------
  |  Branch (478:6): [True: 1.57M, False: 10.5k]
  ------------------
  479|  1.57M|		psf_log_printf (psf, "*** Warning : short read (%d != %d).\n", k, SDS_BLOCK_SIZE) ;
  ------------------
  |  |   36|  1.57M|#define SDS_BLOCK_SIZE				127
  ------------------
  480|       |
  481|  1.58M|	if (psds->read_data [0] != 0xF0)
  ------------------
  |  Branch (481:6): [True: 1.37M, False: 209k]
  ------------------
  482|  1.37M|	{	printf ("Error A : %02X\n", psds->read_data [0] & 0xFF) ;
  483|  1.37M|		} ;
  484|       |
  485|  1.58M|	checksum = psds->read_data [1] ;
  486|  1.58M|	if (checksum != 0x7E)
  ------------------
  |  Branch (486:6): [True: 1.48M, False: 102k]
  ------------------
  487|  1.48M|	{	printf ("Error 1 : %02X\n", checksum & 0xFF) ;
  488|  1.48M|		}
  489|       |
  490|   196M|	for (k = 2 ; k <= SDS_BLOCK_SIZE - 3 ; k ++)
  ------------------
  |  |   36|   196M|#define SDS_BLOCK_SIZE				127
  ------------------
  |  Branch (490:15): [True: 195M, False: 1.58M]
  ------------------
  491|   195M|		checksum ^= psds->read_data [k] ;
  492|       |
  493|  1.58M|	checksum &= 0x7F ;
  494|       |
  495|  1.58M|	if (checksum != psds->read_data [SDS_BLOCK_SIZE - 2])
  ------------------
  |  |   36|  1.58M|#define SDS_BLOCK_SIZE				127
  ------------------
  |  Branch (495:6): [True: 822k, False: 764k]
  ------------------
  496|   822k|	{	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|   822k|#define SDS_BLOCK_SIZE				127
  ------------------
  497|   822k|		} ;
  498|       |
  499|  1.58M|	ucptr = psds->read_data + 5 ;
  500|  65.0M|	for (k = 0 ; k < 120 ; k += 3)
  ------------------
  |  Branch (500:15): [True: 63.4M, False: 1.58M]
  ------------------
  501|  63.4M|	{	sample = (((uint32_t) ucptr [k]) << 25) | (ucptr [k + 1] << 18) | (ucptr [k + 2] << 11) ;
  502|  63.4M|		psds->read_samples [k / 3] = (int) (sample - 0x80000000) ;
  503|  63.4M|		} ;
  504|       |
  505|  1.58M|	return 1 ;
  506|  1.58M|} /* sds_3byte_read */
sds.c:sds_4byte_read:
  510|  2.29M|{	unsigned char *ucptr, checksum ;
  511|  2.29M|	uint32_t sample ;
  512|  2.29M|	int 	k ;
  513|       |
  514|  2.29M|	psds->read_block ++ ;
  515|  2.29M|	psds->read_count = 0 ;
  516|       |
  517|  2.29M|	if (psds->read_block * psds->samplesperblock > psds->frames)
  ------------------
  |  Branch (517:6): [True: 90, False: 2.29M]
  ------------------
  518|     90|	{	memset (psds->read_samples, 0, psds->samplesperblock * sizeof (int)) ;
  519|     90|		return 1 ;
  520|  2.29M|		} ;
  521|       |
  522|  2.29M|	if ((k = (int) psf_fread (psds->read_data, 1, SDS_BLOCK_SIZE, psf)) != SDS_BLOCK_SIZE)
  ------------------
  |  |   36|  2.29M|#define SDS_BLOCK_SIZE				127
  ------------------
              	if ((k = (int) psf_fread (psds->read_data, 1, SDS_BLOCK_SIZE, psf)) != SDS_BLOCK_SIZE)
  ------------------
  |  |   36|  2.29M|#define SDS_BLOCK_SIZE				127
  ------------------
  |  Branch (522:6): [True: 2.29M, False: 4.93k]
  ------------------
  523|  2.29M|		psf_log_printf (psf, "*** Warning : short read (%d != %d).\n", k, SDS_BLOCK_SIZE) ;
  ------------------
  |  |   36|  2.29M|#define SDS_BLOCK_SIZE				127
  ------------------
  524|       |
  525|  2.29M|	if (psds->read_data [0] != 0xF0)
  ------------------
  |  Branch (525:6): [True: 2.02M, False: 274k]
  ------------------
  526|  2.02M|	{	printf ("Error A : %02X\n", psds->read_data [0] & 0xFF) ;
  527|  2.02M|		} ;
  528|       |
  529|  2.29M|	checksum = psds->read_data [1] ;
  530|  2.29M|	if (checksum != 0x7E)
  ------------------
  |  Branch (530:6): [True: 2.16M, False: 137k]
  ------------------
  531|  2.16M|	{	printf ("Error 1 : %02X\n", checksum & 0xFF) ;
  532|  2.16M|		}
  533|       |
  534|   284M|	for (k = 2 ; k <= SDS_BLOCK_SIZE - 3 ; k ++)
  ------------------
  |  |   36|   284M|#define SDS_BLOCK_SIZE				127
  ------------------
  |  Branch (534:15): [True: 282M, False: 2.29M]
  ------------------
  535|   282M|		checksum ^= psds->read_data [k] ;
  536|       |
  537|  2.29M|	checksum &= 0x7F ;
  538|       |
  539|  2.29M|	if (checksum != psds->read_data [SDS_BLOCK_SIZE - 2])
  ------------------
  |  |   36|  2.29M|#define SDS_BLOCK_SIZE				127
  ------------------
  |  Branch (539:6): [True: 1.17M, False: 1.12M]
  ------------------
  540|  1.17M|	{	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.17M|#define SDS_BLOCK_SIZE				127
  ------------------
  541|  1.17M|		} ;
  542|       |
  543|  2.29M|	ucptr = psds->read_data + 5 ;
  544|  71.2M|	for (k = 0 ; k < 120 ; k += 4)
  ------------------
  |  Branch (544:15): [True: 68.9M, False: 2.29M]
  ------------------
  545|  68.9M|	{	sample = (((uint32_t) ucptr [k]) << 25) | (ucptr [k + 1] << 18) | (ucptr [k + 2] << 11) | (ucptr [k + 3] << 4) ;
  546|  68.9M|		psds->read_samples [k / 4] = (int) (sample - 0x80000000) ;
  547|  68.9M|		} ;
  548|       |
  549|  2.29M|	return 1 ;
  550|  2.29M|} /* sds_4byte_read */
sds.c:sds_read:
  659|   199M|{	int	count, total = 0 ;
  660|       |
  661|   399M|	while (total < len)
  ------------------
  |  Branch (661:9): [True: 199M, False: 199M]
  ------------------
  662|   199M|	{	if (psds->read_block * psds->samplesperblock >= psds->frames)
  ------------------
  |  Branch (662:8): [True: 254, False: 199M]
  ------------------
  663|    254|		{	memset (&(ptr [total]), 0, (len - total) * sizeof (int)) ;
  664|    254|			return total ;
  665|   199M|			} ;
  666|       |
  667|   199M|		if (psds->read_count >= psds->samplesperblock)
  ------------------
  |  Branch (667:7): [True: 5.00M, False: 194M]
  ------------------
  668|  5.00M|			psds->reader (psf, psds) ;
  669|       |
  670|   199M|		count = (psds->samplesperblock - psds->read_count) ;
  671|   199M|		count = (len - total > count) ? count : len - total ;
  ------------------
  |  Branch (671:11): [True: 0, False: 199M]
  ------------------
  672|       |
  673|   199M|		memcpy (&(ptr [total]), &(psds->read_samples [psds->read_count]), count * sizeof (int)) ;
  674|   199M|		total += count ;
  675|   199M|		psds->read_count += count ;
  676|   199M|		} ;
  677|       |
  678|   199M|	return total ;
  679|   199M|} /* sds_read */
sds.c:sds_read_f:
  595|   199M|{	BUF_UNION	ubuf ;
  596|   199M|	SDS_PRIVATE	*psds ;
  597|   199M|	int			*iptr ;
  598|   199M|	int			k, bufferlen, readcount, count ;
  599|   199M|	sf_count_t	total = 0 ;
  600|   199M|	float		normfact ;
  601|       |
  602|   199M|	if (psf->codec_data == NULL)
  ------------------
  |  Branch (602:6): [True: 0, False: 199M]
  ------------------
  603|      0|		return 0 ;
  604|   199M|	psds = (SDS_PRIVATE*) psf->codec_data ;
  605|       |
  606|   199M|	if (psf->norm_float == SF_TRUE)
  ------------------
  |  Branch (606:6): [True: 199M, False: 0]
  ------------------
  607|   199M|		normfact = 1.0 / 0x80000000 ;
  608|      0|	else
  609|      0|		normfact = 1.0 / (1 << psds->bitwidth) ;
  610|       |
  611|   199M|	iptr = ubuf.ibuf ;
  612|   199M|	bufferlen = ARRAY_LEN (ubuf.ibuf) ;
  ------------------
  |  |   93|   199M|#define		ARRAY_LEN(x)	((int) (sizeof (x) / sizeof ((x) [0])))
  ------------------
  613|   399M|	while (len > 0)
  ------------------
  |  Branch (613:9): [True: 199M, False: 199M]
  ------------------
  614|   199M|	{	readcount = (len >= bufferlen) ? bufferlen : (int) len ;
  ------------------
  |  Branch (614:16): [True: 0, False: 199M]
  ------------------
  615|   199M|		count = sds_read (psf, psds, iptr, readcount) ;
  616|   399M|		for (k = 0 ; k < readcount ; k++)
  ------------------
  |  Branch (616:16): [True: 199M, False: 199M]
  ------------------
  617|   199M|			ptr [total + k] = normfact * iptr [k] ;
  618|   199M|		total += count ;
  619|   199M|		len -= readcount ;
  620|   199M|		} ;
  621|       |
  622|   199M|	return total ;
  623|   199M|} /* sds_read_f */
sds.c:sds_read_header:
  214|    379|{	unsigned char	channel, bitwidth, loop_type, byte ;
  215|    379|	unsigned short	sample_no, marker ;
  216|    379|	unsigned int	samp_period, data_length, sustain_loop_start, sustain_loop_end ;
  217|    379|	int		bytesread, blockcount ;
  218|       |
  219|       |	/* Set position to start of file to begin reading header. */
  220|    379|	bytesread = psf_binheader_readf (psf, "pE211", 0, &marker, &channel, &byte) ;
  221|       |
  222|    379|	if (marker != 0xF07E || byte != 0x01)
  ------------------
  |  Branch (222:6): [True: 0, False: 379]
  |  Branch (222:26): [True: 0, False: 379]
  ------------------
  223|      0|		return SFE_SDS_NOT_SDS ;
  224|       |
  225|    379|	bytesread += psf_binheader_readf (psf, "e2", &sample_no) ;
  226|    379|	sample_no = SDS_3BYTE_TO_INT_DECODE (sample_no) ;
  ------------------
  |  |   40|    379|#define SDS_3BYTE_TO_INT_DECODE(x) (((x) & 0x7F) | (((x) & 0x7F00) >> 1) | (((x) & 0x7F0000) >> 2))
  ------------------
  227|       |
  228|    379|	psf_log_printf (psf, "Midi Sample Dump Standard (.sds)\nF07E\n"
  229|    379|						" Midi Channel  : %d\n Sample Number : %d\n",
  230|    379|						channel, sample_no) ;
  231|       |
  232|    379|	bytesread += psf_binheader_readf (psf, "e13", &bitwidth, &samp_period) ;
  233|       |
  234|    379|	samp_period = SDS_3BYTE_TO_INT_DECODE (samp_period) ;
  ------------------
  |  |   40|    379|#define SDS_3BYTE_TO_INT_DECODE(x) (((x) & 0x7F) | (((x) & 0x7F00) >> 1) | (((x) & 0x7F0000) >> 2))
  ------------------
  235|       |
  236|    379|	psds->bitwidth = bitwidth ;
  237|       |
  238|    379|	if (psds->bitwidth > 1)
  ------------------
  |  Branch (238:6): [True: 378, False: 1]
  ------------------
  239|    378|		psf_log_printf (psf, " Bit Width     : %d\n", psds->bitwidth) ;
  240|      1|	else
  241|      1|	{	psf_log_printf (psf, " Bit Width     : %d (should be > 1)\n", psds->bitwidth) ;
  242|      1|		return SFE_SDS_BAD_BIT_WIDTH ;
  243|    378|		} ;
  244|       |
  245|    378|	if (samp_period > 0)
  ------------------
  |  Branch (245:6): [True: 343, False: 35]
  ------------------
  246|    343|	{	psf->sf.samplerate = 1000000000 / samp_period ;
  247|       |
  248|    343|		psf_log_printf (psf, " Sample Period : %d\n"
  249|    343|							" Sample Rate   : %d\n",
  250|    343|							samp_period, psf->sf.samplerate) ;
  251|    343|		}
  252|     35|	else
  253|     35|	{	psf->sf.samplerate = 16000 ;
  254|       |
  255|     35|		psf_log_printf (psf, " Sample Period : %d (should be > 0)\n"
  256|     35|							" Sample Rate   : %d (guessed)\n",
  257|     35|							samp_period, psf->sf.samplerate) ;
  258|     35|		} ;
  259|       |
  260|    378|	bytesread += psf_binheader_readf (psf, "e3331", &data_length, &sustain_loop_start, &sustain_loop_end, &loop_type) ;
  261|       |
  262|    378|	data_length = SDS_3BYTE_TO_INT_DECODE (data_length) ;
  ------------------
  |  |   40|    378|#define SDS_3BYTE_TO_INT_DECODE(x) (((x) & 0x7F) | (((x) & 0x7F00) >> 1) | (((x) & 0x7F0000) >> 2))
  ------------------
  263|       |
  264|    378|	psf->sf.frames = psds->frames = data_length ;
  265|       |
  266|    378|	sustain_loop_start = SDS_3BYTE_TO_INT_DECODE (sustain_loop_start) ;
  ------------------
  |  |   40|    378|#define SDS_3BYTE_TO_INT_DECODE(x) (((x) & 0x7F) | (((x) & 0x7F00) >> 1) | (((x) & 0x7F0000) >> 2))
  ------------------
  267|    378|	sustain_loop_end = SDS_3BYTE_TO_INT_DECODE (sustain_loop_end) ;
  ------------------
  |  |   40|    378|#define SDS_3BYTE_TO_INT_DECODE(x) (((x) & 0x7F) | (((x) & 0x7F00) >> 1) | (((x) & 0x7F0000) >> 2))
  ------------------
  268|       |
  269|    378|	psf_log_printf (psf, 	" Sustain Loop\n"
  270|    378|							"     Start     : %d\n"
  271|    378|							"     End       : %d\n"
  272|    378|							"     Loop Type : %d\n",
  273|    378|			sustain_loop_start, sustain_loop_end, loop_type) ;
  274|       |
  275|    378|	psf->dataoffset = SDS_DATA_OFFSET ;
  ------------------
  |  |   35|    378|#define	SDS_DATA_OFFSET				0x15
  ------------------
  276|    378|	psf->datalength = psf->filelength - psf->dataoffset ;
  277|       |
  278|    378|	bytesread += psf_binheader_readf (psf, "1", &byte) ;
  279|    378|	if (byte != 0xF7)
  ------------------
  |  Branch (279:6): [True: 375, False: 3]
  ------------------
  280|    375|		psf_log_printf (psf, "bad end : %X\n", byte & 0xFF) ;
  281|       |
  282|  1.25k|	for (blockcount = 0 ; bytesread < psf->filelength ; blockcount++)
  ------------------
  |  Branch (282:24): [True: 912, False: 341]
  ------------------
  283|    912|	{
  284|    912|		bytesread += (int) psf_fread (&marker, 1, 2, psf) ;
  285|       |
  286|    912|		if (marker == 0)
  ------------------
  |  Branch (286:7): [True: 37, False: 875]
  ------------------
  287|     37|			break ;
  288|       |
  289|    875|		psf_fseek (psf, SDS_BLOCK_SIZE - 2, SEEK_CUR) ;
  ------------------
  |  |   36|    875|#define SDS_BLOCK_SIZE				127
  ------------------
  290|    875|		bytesread += SDS_BLOCK_SIZE - 2 ;
  ------------------
  |  |   36|    875|#define SDS_BLOCK_SIZE				127
  ------------------
  291|    875|		} ;
  292|       |
  293|    378|	psf_log_printf (psf, "\nBlocks         : %d\n", blockcount) ;
  294|    378|	psds->total_blocks = blockcount ;
  295|       |
  296|    378|	psds->samplesperblock = SDS_AUDIO_BYTES_PER_BLOCK / ((psds->bitwidth + 6) / 7) ;
  ------------------
  |  |   38|    378|#define SDS_AUDIO_BYTES_PER_BLOCK	120
  ------------------
  297|    378|	psf_log_printf (psf, "Samples/Block  : %d\n", psds->samplesperblock) ;
  298|       |
  299|    378|	psf_log_printf (psf, "Frames         : %d\n", blockcount * psds->samplesperblock) ;
  300|       |
  301|       |	/* Always Mono */
  302|    378|	psf->sf.channels = 1 ;
  303|    378|	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|    378|	switch ((psds->bitwidth + 7) / 8)
  310|    378|	{	case 1 :
  ------------------
  |  Branch (310:4): [True: 46, False: 332]
  ------------------
  311|     46|			psf->sf.format = SF_FORMAT_SDS | SF_FORMAT_PCM_S8 ;
  312|     46|			break ;
  313|       |
  314|    143|		case 2 :
  ------------------
  |  Branch (314:3): [True: 143, False: 235]
  ------------------
  315|    143|			psf->sf.format = SF_FORMAT_SDS | SF_FORMAT_PCM_16 ;
  316|    143|			break ;
  317|       |
  318|    114|		case 3 :
  ------------------
  |  Branch (318:3): [True: 114, False: 264]
  ------------------
  319|    114|			psf->sf.format = SF_FORMAT_SDS | SF_FORMAT_PCM_24 ;
  320|    114|			break ;
  321|       |
  322|     58|		case 4 :
  ------------------
  |  Branch (322:3): [True: 58, False: 320]
  ------------------
  323|     58|			psf->sf.format = SF_FORMAT_SDS | SF_FORMAT_PCM_32 ;
  324|     58|			break ;
  325|       |
  326|     17|		default :
  ------------------
  |  Branch (326:3): [True: 17, False: 361]
  ------------------
  327|     17|			psf_log_printf (psf, "*** Weird byte width (%d)\n", (psds->bitwidth + 7) / 8) ;
  328|     17|			return SFE_SDS_BAD_BIT_WIDTH ;
  329|    378|		} ;
  330|       |
  331|    361|	psf_fseek (psf, SDS_DATA_OFFSET, SEEK_SET) ;
  ------------------
  |  |   35|    361|#define	SDS_DATA_OFFSET				0x15
  ------------------
  332|       |
  333|    361|	return 0 ;
  334|    378|} /* sds_read_header */

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

sf_open_virtual:
  473|  19.8k|{	SF_PRIVATE 	*psf ;
  474|       |
  475|       |	/* Make sure we have a valid set of virtual pointers. */
  476|  19.8k|	if (sfvirtual->get_filelen == NULL)
  ------------------
  |  Branch (476:6): [True: 0, False: 19.8k]
  ------------------
  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.8k|		} ;
  481|       |
  482|  19.8k|	if ((sfvirtual->seek == NULL || sfvirtual->tell == NULL) && sfinfo->seekable)
  ------------------
  |  Branch (482:7): [True: 0, False: 19.8k]
  |  Branch (482:34): [True: 0, False: 19.8k]
  |  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.8k|		} ;
  487|       |
  488|  19.8k|	if ((mode == SFM_READ || mode == SFM_RDWR) && sfvirtual->read == NULL)
  ------------------
  |  Branch (488:7): [True: 19.8k, False: 0]
  |  Branch (488:27): [True: 0, False: 0]
  |  Branch (488:48): [True: 0, False: 19.8k]
  ------------------
  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.8k|		} ;
  493|       |
  494|  19.8k|	if ((mode == SFM_WRITE || mode == SFM_RDWR) && sfvirtual->write == NULL)
  ------------------
  |  Branch (494:7): [True: 0, False: 19.8k]
  |  Branch (494:28): [True: 0, False: 19.8k]
  |  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.8k|		} ;
  499|       |
  500|  19.8k|	if ((psf = psf_allocate ()) == NULL)
  ------------------
  |  Branch (500:6): [True: 0, False: 19.8k]
  ------------------
  501|      0|	{	sf_errno = SFE_MALLOC_FAILED ;
  502|      0|		return	NULL ;
  503|  19.8k|		} ;
  504|       |
  505|  19.8k|	psf_init_files (psf) ;
  506|       |
  507|  19.8k|	psf->virtual_io = SF_TRUE ;
  508|  19.8k|	psf->vio = *sfvirtual ;
  509|  19.8k|	psf->vio_user_data = user_data ;
  510|       |
  511|  19.8k|	psf->file.mode = mode ;
  512|       |
  513|  19.8k|	return psf_open_file (psf, sfinfo) ;
  514|  19.8k|} /* sf_open_virtual */
sf_close:
  518|  3.04k|{	SF_PRIVATE	*psf ;
  519|       |
  520|  3.04k|	VALIDATE_SNDFILE_AND_ASSIGN_PSF (sndfile, psf, 1) ;
  ------------------
  |  |  326|  3.04k|		{	if ((a) == NULL)						\
  |  |  ------------------
  |  |  |  Branch (326:9): [True: 0, False: 3.04k]
  |  |  ------------------
  |  |  327|  3.04k|			{	sf_errno = SFE_BAD_SNDFILE_PTR ;	\
  |  |  328|      0|				return 0 ;							\
  |  |  329|  3.04k|				} ;									\
  |  |  330|  3.04k|			(b) = (SF_PRIVATE*) (a) ;				\
  |  |  331|  3.04k|			if ((b)->virtual_io == SF_FALSE &&		\
  |  |  ------------------
  |  |  |  Branch (331:8): [True: 0, False: 3.04k]
  |  |  ------------------
  |  |  332|  3.04k|				psf_file_valid (b) == 0)			\
  |  |  ------------------
  |  |  |  Branch (332:5): [True: 0, False: 0]
  |  |  ------------------
  |  |  333|  3.04k|			{	(b)->error = SFE_BAD_FILE_PTR ;		\
  |  |  334|      0|				return 0 ;							\
  |  |  335|  3.04k|				} ;									\
  |  |  336|  3.04k|			if ((b)->Magick != SNDFILE_MAGICK)		\
  |  |  ------------------
  |  |  |  |   41|  3.04k|#define		SNDFILE_MAGICK	0x1234C0DE
  |  |  ------------------
  |  |  |  Branch (336:8): [True: 0, False: 3.04k]
  |  |  ------------------
  |  |  337|  3.04k|			{	(b)->error = SFE_BAD_SNDFILE_PTR ;	\
  |  |  338|      0|				return 0 ;							\
  |  |  339|  3.04k|				} ;									\
  |  |  340|  3.04k|			if (c) (b)->error = 0 ;					\
  |  |  ------------------
  |  |  |  Branch (340:8): [True: 3.04k, Folded]
  |  |  ------------------
  |  |  341|  3.04k|			}
  ------------------
  521|       |
  522|  3.04k|	return psf_close (psf) ;
  523|  6.09k|} /* 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|   909k|	for (k = 0 ; SndfileErrors [k].str ; k++)
  ------------------
  |  Branch (555:15): [True: 909k, False: 0]
  ------------------
  556|   909k|		if (errnum == SndfileErrors [k].error)
  ------------------
  |  Branch (556:7): [True: 15.0k, False: 894k]
  ------------------
  557|  15.0k|			return SndfileErrors [k].str ;
  558|       |
  559|      0|	return bad_errnum ;
  560|  15.0k|} /* sf_error_number */
sf_readf_float:
 2020|   219M|{	SF_PRIVATE 	*psf ;
 2021|   219M|	sf_count_t	count, extra ;
 2022|       |
 2023|   219M|	if (frames == 0)
  ------------------
  |  Branch (2023:6): [True: 0, False: 219M]
  ------------------
 2024|      0|		return 0 ;
 2025|       |
 2026|   876M|	VALIDATE_SNDFILE_AND_ASSIGN_PSF (sndfile, psf, 1) ;
  ------------------
  |  |  326|   219M|		{	if ((a) == NULL)						\
  |  |  ------------------
  |  |  |  Branch (326:9): [True: 0, False: 219M]
  |  |  ------------------
  |  |  327|   219M|			{	sf_errno = SFE_BAD_SNDFILE_PTR ;	\
  |  |  328|      0|				return 0 ;							\
  |  |  329|   219M|				} ;									\
  |  |  330|   219M|			(b) = (SF_PRIVATE*) (a) ;				\
  |  |  331|   219M|			if ((b)->virtual_io == SF_FALSE &&		\
  |  |  ------------------
  |  |  |  Branch (331:8): [True: 0, False: 219M]
  |  |  ------------------
  |  |  332|   219M|				psf_file_valid (b) == 0)			\
  |  |  ------------------
  |  |  |  Branch (332:5): [True: 0, False: 0]
  |  |  ------------------
  |  |  333|   219M|			{	(b)->error = SFE_BAD_FILE_PTR ;		\
  |  |  334|      0|				return 0 ;							\
  |  |  335|   219M|				} ;									\
  |  |  336|   219M|			if ((b)->Magick != SNDFILE_MAGICK)		\
  |  |  ------------------
  |  |  |  |   41|   219M|#define		SNDFILE_MAGICK	0x1234C0DE
  |  |  ------------------
  |  |  |  Branch (336:8): [True: 0, False: 219M]
  |  |  ------------------
  |  |  337|   219M|			{	(b)->error = SFE_BAD_SNDFILE_PTR ;	\
  |  |  338|      0|				return 0 ;							\
  |  |  339|   219M|				} ;									\
  |  |  340|   219M|			if (c) (b)->error = 0 ;					\
  |  |  ------------------
  |  |  |  Branch (340:8): [True: 219M, Folded]
  |  |  ------------------
  |  |  341|   219M|			}
  ------------------
 2027|       |
 2028|   876M|	if (frames <= 0)
  ------------------
  |  Branch (2028:6): [True: 0, False: 219M]
  ------------------
 2029|      0|	{	psf->error = SFE_NEGATIVE_RW_LEN ;
 2030|      0|		return 0 ;
 2031|   219M|		} ;
 2032|       |
 2033|   219M|	if (psf->file.mode == SFM_WRITE)
  ------------------
  |  Branch (2033:6): [True: 0, False: 219M]
  ------------------
 2034|      0|	{	psf->error = SFE_NOT_READMODE ;
 2035|      0|		return 0 ;
 2036|   219M|		} ;
 2037|       |
 2038|   219M|	if (psf->read_current >= psf->sf.frames)
  ------------------
  |  Branch (2038:6): [True: 1.95k, False: 219M]
  ------------------
 2039|  1.95k|	{	psf_memset (ptr, 0, frames * psf->sf.channels * sizeof (float)) ;
 2040|  1.95k|		return 0 ;
 2041|   219M|		} ;
 2042|       |
 2043|   219M|	if (psf->read_float == NULL || psf->seek == NULL)
  ------------------
  |  Branch (2043:6): [True: 1, False: 219M]
  |  Branch (2043:33): [True: 0, False: 219M]
  ------------------
 2044|      1|	{	psf->error = SFE_UNIMPLEMENTED ;
 2045|      1|		return	0 ;
 2046|   219M|		} ;
 2047|       |
 2048|   219M|	if (psf->last_op != SFM_READ)
  ------------------
  |  Branch (2048:6): [True: 73, False: 219M]
  ------------------
 2049|     73|		if (psf->seek (psf, SFM_READ, psf->read_current) < 0)
  ------------------
  |  Branch (2049:7): [True: 0, False: 73]
  ------------------
 2050|      0|			return 0 ;
 2051|       |
 2052|   219M|	count = psf->read_float (psf, ptr, frames * psf->sf.channels) ;
 2053|       |
 2054|   219M|	if (psf->read_current + count / psf->sf.channels <= psf->sf.frames)
  ------------------
  |  Branch (2054:6): [True: 219M, False: 0]
  ------------------
 2055|   219M|		psf->read_current += count / psf->sf.channels ;
 2056|      0|	else
 2057|      0|	{	count = (psf->sf.frames - psf->read_current) * psf->sf.channels ;
 2058|      0|		extra = frames * psf->sf.channels - count ;
 2059|      0|		psf_memset (ptr + count, 0, extra * sizeof (float)) ;
 2060|      0|		psf->read_current = psf->sf.frames ;
 2061|      0|		} ;
 2062|       |
 2063|   219M|	psf->last_op = SFM_READ ;
 2064|       |
 2065|   219M|	return count / psf->sf.channels ;
 2066|   219M|} /* sf_readf_float */
psf_open_file:
 3010|  19.8k|{	int		error, format ;
 3011|       |
 3012|  19.8k|	sf_errno = error = 0 ;
 3013|  19.8k|	sf_parselog [0] = 0 ;
 3014|       |
 3015|  19.8k|	if (psf->error)
  ------------------
  |  Branch (3015:6): [True: 0, False: 19.8k]
  ------------------
 3016|      0|	{	error = psf->error ;
 3017|      0|		goto error_exit ;
 3018|  19.8k|		} ;
 3019|       |
 3020|  19.8k|	if (psf->file.mode != SFM_READ && psf->file.mode != SFM_WRITE && psf->file.mode != SFM_RDWR)
  ------------------
  |  Branch (3020:6): [True: 0, False: 19.8k]
  |  Branch (3020:36): [True: 0, False: 0]
  |  Branch (3020:67): [True: 0, False: 0]
  ------------------
 3021|      0|	{	error = SFE_BAD_OPEN_MODE ;
 3022|      0|		goto error_exit ;
 3023|  19.8k|		} ;
 3024|       |
 3025|  19.8k|	if (sfinfo == NULL)
  ------------------
  |  Branch (3025:6): [True: 0, False: 19.8k]
  ------------------
 3026|      0|	{	error = SFE_BAD_SF_INFO_PTR ;
 3027|      0|		goto error_exit ;
 3028|  19.8k|		} ;
 3029|       |
 3030|  19.8k|	if (psf->file.mode == SFM_READ)
  ------------------
  |  Branch (3030:6): [True: 19.8k, False: 0]
  ------------------
 3031|  19.8k|	{	if ((SF_CONTAINER (sfinfo->format)) == SF_FORMAT_RAW)
  ------------------
  |  |  108|  19.8k|#define SF_CONTAINER(x)		((x) & SF_FORMAT_TYPEMASK)
  ------------------
  |  Branch (3031:8): [True: 0, False: 19.8k]
  ------------------
 3032|      0|		{	if (sf_format_check (sfinfo) == 0)
  ------------------
  |  Branch (3032:9): [True: 0, False: 0]
  ------------------
 3033|      0|			{	error = SFE_RAW_BAD_FORMAT ;
 3034|      0|				goto error_exit ;
 3035|      0|				} ;
 3036|      0|			}
 3037|  19.8k|		else
 3038|  19.8k|			memset (sfinfo, 0, sizeof (SF_INFO)) ;
 3039|  19.8k|		} ;
 3040|       |
 3041|  19.8k|	memcpy (&psf->sf, sfinfo, sizeof (SF_INFO)) ;
 3042|       |
 3043|  19.8k|	psf->Magick 		= SNDFILE_MAGICK ;
  ------------------
  |  |   41|  19.8k|#define		SNDFILE_MAGICK	0x1234C0DE
  ------------------
 3044|  19.8k|	psf->norm_float 	= SF_TRUE ;
 3045|  19.8k|	psf->norm_double	= SF_TRUE ;
 3046|  19.8k|	psf->dataoffset		= -1 ;
 3047|  19.8k|	psf->datalength		= -1 ;
 3048|  19.8k|	psf->read_current	= -1 ;
 3049|  19.8k|	psf->write_current	= -1 ;
 3050|  19.8k|	psf->auto_header 	= SF_FALSE ;
 3051|  19.8k|	psf->rwf_endian		= SF_ENDIAN_LITTLE ;
 3052|  19.8k|	psf->seek			= psf_default_seek ;
 3053|  19.8k|	psf->float_int_mult = 0 ;
 3054|  19.8k|	psf->float_max		= -1.0 ;
 3055|       |
 3056|       |	/* An attempt at a per SF_PRIVATE unique id. */
 3057|  19.8k|	psf->unique_id		= psf_rand_int32 () ;
 3058|       |
 3059|  19.8k|	psf->sf.sections = 1 ;
 3060|       |
 3061|  19.8k|	psf->is_pipe = psf_is_pipe (psf) ;
 3062|       |
 3063|  19.8k|	if (psf->is_pipe)
  ------------------
  |  Branch (3063:6): [True: 0, False: 19.8k]
  ------------------
 3064|      0|	{	psf->sf.seekable = SF_FALSE ;
 3065|      0|		psf->filelength = SF_COUNT_MAX ;
  ------------------
  |  |  370|      0|#define SF_COUNT_MAX	INT64_MAX
  ------------------
 3066|      0|		}
 3067|  19.8k|	else
 3068|  19.8k|	{	psf->sf.seekable = SF_TRUE ;
 3069|       |
 3070|       |		/* File is open, so get the length. */
 3071|  19.8k|		psf->filelength = psf_get_filelen (psf) ;
 3072|  19.8k|		} ;
 3073|       |
 3074|  19.8k|	if (psf->fileoffset > 0)
  ------------------
  |  Branch (3074:6): [True: 0, False: 19.8k]
  ------------------
 3075|      0|	{	switch (psf->file.mode)
  ------------------
  |  Branch (3075:12): [True: 0, False: 0]
  ------------------
 3076|      0|		{	case SFM_READ :
  ------------------
  |  Branch (3076:5): [True: 0, False: 0]
  ------------------
 3077|      0|				if (psf->filelength < 44)
  ------------------
  |  Branch (3077:9): [True: 0, False: 0]
  ------------------
 3078|      0|				{	psf_log_printf (psf, "Short filelength: %D (fileoffset: %D)\n", psf->filelength, psf->fileoffset) ;
 3079|      0|					error = SFE_BAD_OFFSET ;
 3080|      0|					goto error_exit ;
 3081|      0|					} ;
 3082|      0|				break ;
 3083|       |
 3084|      0|			case SFM_WRITE :
  ------------------
  |  Branch (3084:4): [True: 0, False: 0]
  ------------------
 3085|      0|				psf->fileoffset = 0 ;
 3086|      0|				psf_fseek (psf, 0, SEEK_END) ;
 3087|      0|				psf->fileoffset = psf_ftell (psf) ;
 3088|      0|				break ;
 3089|       |
 3090|      0|			case SFM_RDWR :
  ------------------
  |  Branch (3090:4): [True: 0, False: 0]
  ------------------
 3091|      0|				error = SFE_NO_EMBEDDED_RDWR ;
 3092|      0|				goto error_exit ;
 3093|      0|			} ;
 3094|       |
 3095|      0|		psf_log_printf (psf, "Embedded file offset : %D\n", psf->fileoffset) ;
 3096|  19.8k|		} ;
 3097|       |
 3098|  19.8k|	if (psf->filelength == SF_COUNT_MAX)
  ------------------
  |  |  370|  19.8k|#define SF_COUNT_MAX	INT64_MAX
  ------------------
  |  Branch (3098:6): [True: 0, False: 19.8k]
  ------------------
 3099|      0|		psf_log_printf (psf, "Length : unknown\n") ;
 3100|  19.8k|	else
 3101|  19.8k|		psf_log_printf (psf, "Length : %D\n", psf->filelength) ;
 3102|       |
 3103|  19.8k|	if (psf->file.mode == SFM_WRITE || (psf->file.mode == SFM_RDWR && psf->filelength == 0))
  ------------------
  |  Branch (3103:6): [True: 0, False: 19.8k]
  |  Branch (3103:38): [True: 0, False: 19.8k]
  |  Branch (3103:68): [True: 0, False: 0]
  ------------------
 3104|      0|	{	/* If the file is being opened for write or RDWR and the file is currently
 3105|       |		** empty, then the SF_INFO struct must contain valid data.
 3106|       |		*/
 3107|      0|		if ((SF_CONTAINER (psf->sf.format)) == 0)
  ------------------
  |  |  108|      0|#define SF_CONTAINER(x)		((x) & SF_FORMAT_TYPEMASK)
  ------------------
  |  Branch (3107:7): [True: 0, False: 0]
  ------------------
 3108|      0|		{	error = SFE_ZERO_MAJOR_FORMAT ;
 3109|      0|			goto error_exit ;
 3110|      0|			} ;
 3111|      0|		if ((SF_CODEC (psf->sf.format)) == 0)
  ------------------
  |  |  109|      0|#define SF_CODEC(x)			((x) & SF_FORMAT_SUBMASK)
  ------------------
  |  Branch (3111:7): [True: 0, False: 0]
  ------------------
 3112|      0|		{	error = SFE_ZERO_MINOR_FORMAT ;
 3113|      0|			goto error_exit ;
 3114|      0|			} ;
 3115|       |
 3116|      0|		if (sf_format_check (&psf->sf) == 0)
  ------------------
  |  Branch (3116:7): [True: 0, False: 0]
  ------------------
 3117|      0|		{	error = SFE_BAD_OPEN_FORMAT ;
 3118|      0|			goto error_exit ;
 3119|      0|			} ;
 3120|      0|		}
 3121|  19.8k|	else if ((SF_CONTAINER (psf->sf.format)) != SF_FORMAT_RAW)
  ------------------
  |  |  108|  19.8k|#define SF_CONTAINER(x)		((x) & SF_FORMAT_TYPEMASK)
  ------------------
  |  Branch (3121:11): [True: 19.8k, False: 0]
  ------------------
 3122|  19.8k|	{	/* If type RAW has not been specified then need to figure out file type. */
 3123|  19.8k|		psf->sf.format = guess_file_type (psf) ;
 3124|       |
 3125|  19.8k|		if (psf->sf.format == 0)
  ------------------
  |  Branch (3125:7): [True: 1.93k, False: 17.9k]
  ------------------
 3126|  1.93k|			psf->sf.format = format_from_extension (psf) ;
 3127|  19.8k|		} ;
 3128|       |
 3129|       |	/* Prevent unnecessary seeks */
 3130|  19.8k|	psf->last_op = psf->file.mode ;
 3131|       |
 3132|       |	/* Set bytewidth if known. */
 3133|  19.8k|	switch (SF_CODEC (psf->sf.format))
  ------------------
  |  |  109|  19.8k|#define SF_CODEC(x)			((x) & SF_FORMAT_SUBMASK)
  |  |  ------------------
  |  |  |  Branch (109:23): [True: 0, False: 19.8k]
  |  |  ------------------
  ------------------
 3134|  19.8k|	{	case SF_FORMAT_PCM_S8 :
  ------------------
  |  Branch (3134:4): [True: 0, False: 19.8k]
  ------------------
 3135|      0|		case SF_FORMAT_PCM_U8 :
  ------------------
  |  Branch (3135:3): [True: 0, False: 19.8k]
  ------------------
 3136|      0|		case SF_FORMAT_ULAW :
  ------------------
  |  Branch (3136:3): [True: 0, False: 19.8k]
  ------------------
 3137|      0|		case SF_FORMAT_ALAW :
  ------------------
  |  Branch (3137:3): [True: 0, False: 19.8k]
  ------------------
 3138|      0|		case SF_FORMAT_DPCM_8 :
  ------------------
  |  Branch (3138:3): [True: 0, False: 19.8k]
  ------------------
 3139|      0|				psf->bytewidth = 1 ;
 3140|      0|				break ;
 3141|       |
 3142|      0|		case SF_FORMAT_PCM_16 :
  ------------------
  |  Branch (3142:3): [True: 0, False: 19.8k]
  ------------------
 3143|      0|		case SF_FORMAT_DPCM_16 :
  ------------------
  |  Branch (3143:3): [True: 0, False: 19.8k]
  ------------------
 3144|      0|				psf->bytewidth = 2 ;
 3145|      0|				break ;
 3146|       |
 3147|      0|		case SF_FORMAT_PCM_24 :
  ------------------
  |  Branch (3147:3): [True: 0, False: 19.8k]
  ------------------
 3148|      0|				psf->bytewidth = 3 ;
 3149|      0|				break ;
 3150|       |
 3151|      0|		case SF_FORMAT_PCM_32 :
  ------------------
  |  Branch (3151:3): [True: 0, False: 19.8k]
  ------------------
 3152|      0|		case SF_FORMAT_FLOAT :
  ------------------
  |  Branch (3152:3): [True: 0, False: 19.8k]
  ------------------
 3153|      0|				psf->bytewidth = 4 ;
 3154|      0|				break ;
 3155|       |
 3156|      0|		case SF_FORMAT_DOUBLE :
  ------------------
  |  Branch (3156:3): [True: 0, False: 19.8k]
  ------------------
 3157|      0|				psf->bytewidth = 8 ;
 3158|      0|				break ;
 3159|  19.8k|		} ;
 3160|       |
 3161|       |	/* Call the initialisation function for the relevant file type. */
 3162|  19.8k|	switch (SF_CONTAINER (psf->sf.format))
  ------------------
  |  |  108|  19.8k|#define SF_CONTAINER(x)		((x) & SF_FORMAT_TYPEMASK)
  ------------------
 3163|  19.8k|	{	case	SF_FORMAT_WAV :
  ------------------
  |  Branch (3163:4): [True: 4.63k, False: 15.2k]
  ------------------
 3164|  4.63k|		case	SF_FORMAT_WAVEX :
  ------------------
  |  Branch (3164:3): [True: 0, False: 19.8k]
  ------------------
 3165|  4.63k|				error = wav_open (psf) ;
 3166|  4.63k|				break ;
 3167|       |
 3168|  2.99k|		case	SF_FORMAT_AIFF :
  ------------------
  |  Branch (3168:3): [True: 2.99k, False: 16.8k]
  ------------------
 3169|  2.99k|				error = aiff_open (psf) ;
 3170|  2.99k|				break ;
 3171|       |
 3172|  1.33k|		case	SF_FORMAT_AU :
  ------------------
  |  Branch (3172:3): [True: 1.33k, False: 18.5k]
  ------------------
 3173|  1.33k|				error = au_open (psf) ;
 3174|  1.33k|				break ;
 3175|       |
 3176|      0|		case	SF_FORMAT_RAW :
  ------------------
  |  Branch (3176:3): [True: 0, False: 19.8k]
  ------------------
 3177|      0|				error = raw_open (psf) ;
 3178|      0|				break ;
 3179|       |
 3180|    722|		case	SF_FORMAT_W64 :
  ------------------
  |  Branch (3180:3): [True: 722, False: 19.1k]
  ------------------
 3181|    722|				error = w64_open (psf) ;
 3182|    722|				break ;
 3183|       |
 3184|  2.32k|		case	SF_FORMAT_RF64 :
  ------------------
  |  Branch (3184:3): [True: 2.32k, False: 17.5k]
  ------------------
 3185|  2.32k|				error = rf64_open (psf) ;
 3186|  2.32k|				break ;
 3187|       |
 3188|       |		/* Lite remove start */
 3189|    140|		case	SF_FORMAT_PAF :
  ------------------
  |  Branch (3189:3): [True: 140, False: 19.7k]
  ------------------
 3190|    140|				error = paf_open (psf) ;
 3191|    140|				break ;
 3192|       |
 3193|    559|		case	SF_FORMAT_SVX :
  ------------------
  |  Branch (3193:3): [True: 559, False: 19.2k]
  ------------------
 3194|    559|				error = svx_open (psf) ;
 3195|    559|				break ;
 3196|       |
 3197|     85|		case	SF_FORMAT_NIST :
  ------------------
  |  Branch (3197:3): [True: 85, False: 19.7k]
  ------------------
 3198|     85|				error = nist_open (psf) ;
 3199|     85|				break ;
 3200|       |
 3201|    403|		case	SF_FORMAT_IRCAM :
  ------------------
  |  Branch (3201:3): [True: 403, False: 19.4k]
  ------------------
 3202|    403|				error = ircam_open (psf) ;
 3203|    403|				break ;
 3204|       |
 3205|    211|		case	SF_FORMAT_VOC :
  ------------------
  |  Branch (3205:3): [True: 211, False: 19.6k]
  ------------------
 3206|    211|				error = voc_open (psf) ;
 3207|    211|				break ;
 3208|       |
 3209|    379|		case	SF_FORMAT_SDS :
  ------------------
  |  Branch (3209:3): [True: 379, False: 19.4k]
  ------------------
 3210|    379|				error = sds_open (psf) ;
 3211|    379|				break ;
 3212|       |
 3213|      1|		case	SF_FORMAT_OGG :
  ------------------
  |  Branch (3213:3): [True: 1, False: 19.8k]
  ------------------
 3214|      1|				error = ogg_open (psf) ;
 3215|      1|				break ;
 3216|       |
 3217|      2|		case	SF_FORMAT_TXW :
  ------------------
  |  Branch (3217:3): [True: 2, False: 19.8k]
  ------------------
 3218|      2|				error = txw_open (psf) ;
 3219|      2|				break ;
 3220|       |
 3221|     64|		case	SF_FORMAT_WVE :
  ------------------
  |  Branch (3221:3): [True: 64, False: 19.7k]
  ------------------
 3222|     64|				error = wve_open (psf) ;
 3223|     64|				break ;
 3224|       |
 3225|      1|		case	SF_FORMAT_DWD :
  ------------------
  |  Branch (3225:3): [True: 1, False: 19.8k]
  ------------------
 3226|      1|				error = dwd_open (psf) ;
 3227|      1|				break ;
 3228|       |
 3229|    762|		case	SF_FORMAT_MAT4 :
  ------------------
  |  Branch (3229:3): [True: 762, False: 19.0k]
  ------------------
 3230|    762|				error = mat4_open (psf) ;
 3231|    762|				break ;
 3232|       |
 3233|    290|		case	SF_FORMAT_MAT5 :
  ------------------
  |  Branch (3233:3): [True: 290, False: 19.5k]
  ------------------
 3234|    290|				error = mat5_open (psf) ;
 3235|    290|				break ;
 3236|       |
 3237|    146|		case	SF_FORMAT_PVF :
  ------------------
  |  Branch (3237:3): [True: 146, False: 19.6k]
  ------------------
 3238|    146|				error = pvf_open (psf) ;
 3239|    146|				break ;
 3240|       |
 3241|    148|		case	SF_FORMAT_XI :
  ------------------
  |  Branch (3241:3): [True: 148, False: 19.6k]
  ------------------
 3242|    148|				error = xi_open (psf) ;
 3243|    148|				break ;
 3244|       |
 3245|     56|		case	SF_FORMAT_HTK :
  ------------------
  |  Branch (3245:3): [True: 56, False: 19.7k]
  ------------------
 3246|     56|				error = htk_open (psf) ;
 3247|     56|				break ;
 3248|       |
 3249|      0|		case	SF_FORMAT_SD2 :
  ------------------
  |  Branch (3249:3): [True: 0, False: 19.8k]
  ------------------
 3250|      0|				error = sd2_open (psf) ;
 3251|      0|				break ;
 3252|       |
 3253|      1|		case	SF_FORMAT_REX2 :
  ------------------
  |  Branch (3253:3): [True: 1, False: 19.8k]
  ------------------
 3254|      1|				error = rx2_open (psf) ;
 3255|      1|				break ;
 3256|       |
 3257|     91|		case	SF_FORMAT_AVR :
  ------------------
  |  Branch (3257:3): [True: 91, False: 19.7k]
  ------------------
 3258|     91|				error = avr_open (psf) ;
 3259|     91|				break ;
 3260|       |
 3261|      1|		case	SF_FORMAT_FLAC :
  ------------------
  |  Branch (3261:3): [True: 1, False: 19.8k]
  ------------------
 3262|      1|				error = flac_open (psf) ;
 3263|      1|				break ;
 3264|       |
 3265|  2.52k|		case	SF_FORMAT_CAF :
  ------------------
  |  Branch (3265:3): [True: 2.52k, False: 17.3k]
  ------------------
 3266|  2.52k|				error = caf_open (psf) ;
 3267|  2.52k|				break ;
 3268|       |
 3269|     15|		case	SF_FORMAT_MPC2K :
  ------------------
  |  Branch (3269:3): [True: 15, False: 19.8k]
  ------------------
 3270|     15|				error = mpc2k_open (psf) ;
 3271|     15|				break ;
 3272|       |
 3273|     14|		case	SF_FORMAT_MPEG :
  ------------------
  |  Branch (3273:3): [True: 14, False: 19.8k]
  ------------------
 3274|     14|				error = mpeg_open (psf) ;
 3275|     14|				break ;
 3276|       |
 3277|       |		/* Lite remove end */
 3278|       |
 3279|  1.93k|		default :
  ------------------
  |  Branch (3279:3): [True: 1.93k, False: 17.9k]
  ------------------
 3280|  1.93k|				error = SF_ERR_UNRECOGNISED_FORMAT ;
 3281|  19.8k|		} ;
 3282|       |
 3283|  19.8k|	if (error)
  ------------------
  |  Branch (3283:6): [True: 14.6k, False: 5.20k]
  ------------------
 3284|  14.6k|		goto error_exit ;
 3285|       |
 3286|       |	/* For now, check whether embedding is supported. */
 3287|  5.20k|	format = SF_CONTAINER (psf->sf.format) ;
  ------------------
  |  |  108|  5.20k|#define SF_CONTAINER(x)		((x) & SF_FORMAT_TYPEMASK)
  ------------------
 3288|  5.20k|	if (psf->fileoffset > 0)
  ------------------
  |  Branch (3288:6): [True: 143, False: 5.06k]
  ------------------
 3289|    143|	{	switch (format)
 3290|    143|		{	case SF_FORMAT_WAV :
  ------------------
  |  Branch (3290:5): [True: 18, False: 125]
  ------------------
 3291|     19|			case SF_FORMAT_WAVEX :
  ------------------
  |  Branch (3291:4): [True: 1, False: 142]
  ------------------
 3292|     22|			case SF_FORMAT_AIFF :
  ------------------
  |  Branch (3292:4): [True: 3, False: 140]
  ------------------
 3293|     82|			case SF_FORMAT_AU :
  ------------------
  |  Branch (3293:4): [True: 60, False: 83]
  ------------------
 3294|       |				/* Actual embedded files. */
 3295|     82|				break ;
 3296|       |
 3297|      0|			case SF_FORMAT_MPEG :
  ------------------
  |  Branch (3297:4): [True: 0, False: 143]
  ------------------
 3298|      0|			case SF_FORMAT_FLAC :
  ------------------
  |  Branch (3298:4): [True: 0, False: 143]
  ------------------
 3299|       |				/* Flac with an ID3v2 header? */
 3300|      0|				break ;
 3301|       |
 3302|     61|			default :
  ------------------
  |  Branch (3302:4): [True: 61, False: 82]
  ------------------
 3303|     61|				error = SFE_NO_EMBED_SUPPORT ;
 3304|     61|				goto error_exit ;
 3305|    143|			} ;
 3306|  5.14k|		} ;
 3307|       |
 3308|  5.14k|	if (psf->fileoffset > 0)
  ------------------
  |  Branch (3308:6): [True: 82, False: 5.06k]
  ------------------
 3309|     82|		psf_log_printf (psf, "Embedded file length : %D\n", psf->filelength) ;
 3310|       |
 3311|  5.14k|	if (psf->file.mode == SFM_RDWR && sf_format_check (&psf->sf) == 0)
  ------------------
  |  Branch (3311:6): [True: 0, False: 5.14k]
  |  Branch (3311:36): [True: 0, False: 0]
  ------------------
 3312|      0|	{	error = SFE_BAD_MODE_RW ;
 3313|      0|		goto error_exit ;
 3314|  5.14k|		} ;
 3315|       |
 3316|  5.14k|	if (validate_sfinfo (&psf->sf) == 0)
  ------------------
  |  Branch (3316:6): [True: 1.33k, False: 3.81k]
  ------------------
 3317|  1.33k|	{	psf_log_SF_INFO (psf) ;
 3318|  1.33k|		save_header_info (psf) ;
 3319|  1.33k|		error = SFE_BAD_SF_INFO ;
 3320|  1.33k|		goto error_exit ;
 3321|  3.81k|		} ;
 3322|       |
 3323|  3.81k|	if (validate_psf (psf) == 0)
  ------------------
  |  Branch (3323:6): [True: 770, False: 3.04k]
  ------------------
 3324|    770|	{	save_header_info (psf) ;
 3325|    770|		error = SFE_INTERNAL ;
 3326|    770|		goto error_exit ;
 3327|  3.04k|		} ;
 3328|       |
 3329|  3.04k|	psf->read_current = 0 ;
 3330|  3.04k|	psf->write_current = 0 ;
 3331|  3.04k|	if (psf->file.mode == SFM_RDWR)
  ------------------
  |  Branch (3331:6): [True: 0, False: 3.04k]
  ------------------
 3332|      0|	{	psf->write_current = psf->sf.frames ;
 3333|      0|		psf->have_written = psf->sf.frames > 0 ? SF_TRUE : SF_FALSE ;
  ------------------
  |  Branch (3333:23): [True: 0, False: 0]
  ------------------
 3334|      0|		} ;
 3335|       |
 3336|  3.04k|	memcpy (sfinfo, &psf->sf, sizeof (SF_INFO)) ;
 3337|       |
 3338|  3.04k|	if (psf->file.mode == SFM_WRITE)
  ------------------
  |  Branch (3338:6): [True: 0, False: 3.04k]
  ------------------
 3339|      0|	{	/* Zero out these fields. */
 3340|      0|		sfinfo->frames = 0 ;
 3341|      0|		sfinfo->sections = 0 ;
 3342|      0|		sfinfo->seekable = 0 ;
 3343|      0|		} ;
 3344|       |
 3345|  3.04k|	return (SNDFILE *) psf ;
 3346|       |
 3347|  16.7k|error_exit :
 3348|  16.7k|	sf_errno = error ;
 3349|       |
 3350|  16.7k|	if (error == SFE_SYSTEM)
  ------------------
  |  Branch (3350:6): [True: 0, False: 16.7k]
  ------------------
 3351|      0|		snprintf (sf_syserr, sizeof (sf_syserr), "%s", psf->syserr) ;
 3352|  16.7k|	snprintf (sf_parselog, sizeof (sf_parselog), "%s", psf->parselog.buf) ;
 3353|       |
 3354|  16.7k|	switch (error)
 3355|  16.7k|	{	case SF_ERR_SYSTEM :
  ------------------
  |  Branch (3355:4): [True: 0, False: 16.7k]
  ------------------
 3356|    329|		case SF_ERR_UNSUPPORTED_ENCODING :
  ------------------
  |  Branch (3356:3): [True: 329, False: 16.4k]
  ------------------
 3357|  1.74k|		case SFE_UNIMPLEMENTED :
  ------------------
  |  Branch (3357:3): [True: 1.41k, False: 15.3k]
  ------------------
 3358|  1.74k|			break ;
 3359|       |
 3360|      0|		case SFE_RAW_BAD_FORMAT :
  ------------------
  |  Branch (3360:3): [True: 0, False: 16.7k]
  ------------------
 3361|      0|			break ;
 3362|       |
 3363|  15.0k|		default :
  ------------------
  |  Branch (3363:3): [True: 15.0k, False: 1.74k]
  ------------------
 3364|  15.0k|			if (psf->file.mode == SFM_READ)
  ------------------
  |  Branch (3364:8): [True: 15.0k, False: 0]
  ------------------
 3365|  15.0k|			{	psf_log_printf (psf, "Parse error : %s\n", sf_error_number (error)) ;
 3366|  15.0k|				error = SF_ERR_MALFORMED_FILE ;
 3367|  15.0k|				} ;
 3368|  16.7k|		} ;
 3369|       |
 3370|  16.7k|	psf_close (psf) ;
 3371|       |	return NULL ;
 3372|  16.7k|} /* psf_open_file */
sndfile.c:psf_close:
 2965|  19.8k|{	uint32_t k ;
 2966|  19.8k|	int	error = 0 ;
 2967|       |
 2968|  19.8k|	if (psf->codec_close)
  ------------------
  |  Branch (2968:6): [True: 3.01k, False: 16.8k]
  ------------------
 2969|  3.01k|	{	error = psf->codec_close (psf) ;
 2970|       |		/* To prevent it being called in psf->container_close(). */
 2971|  3.01k|		psf->codec_close = NULL ;
 2972|  3.01k|		} ;
 2973|       |
 2974|  19.8k|	if (psf->container_close)
  ------------------
  |  Branch (2974:6): [True: 8.05k, False: 11.7k]
  ------------------
 2975|  8.05k|		error = psf->container_close (psf) ;
 2976|       |
 2977|  19.8k|	error = psf_fclose (psf) ;
 2978|  19.8k|	psf_close_rsrc (psf) ;
 2979|       |
 2980|       |	/* For an ISO C compliant implementation it is ok to free a NULL pointer. */
 2981|  19.8k|	free (psf->header.ptr) ;
 2982|  19.8k|	free (psf->container_data) ;
 2983|  19.8k|	free (psf->codec_data) ;
 2984|  19.8k|	free (psf->interleave) ;
 2985|  19.8k|	free (psf->dither) ;
 2986|  19.8k|	free (psf->peak_info) ;
 2987|  19.8k|	free (psf->broadcast_16k) ;
 2988|  19.8k|	free (psf->loop_info) ;
 2989|  19.8k|	free (psf->instrument) ;
 2990|  19.8k|	free (psf->cues) ;
 2991|  19.8k|	free (psf->channel_map) ;
 2992|  19.8k|	free (psf->format_desc) ;
 2993|  19.8k|	free (psf->strings.storage) ;
 2994|       |
 2995|  19.8k|	if (psf->wchunks.chunks)
  ------------------
  |  Branch (2995:6): [True: 0, False: 19.8k]
  ------------------
 2996|      0|		for (k = 0 ; k < psf->wchunks.used ; k++)
  ------------------
  |  Branch (2996:16): [True: 0, False: 0]
  ------------------
 2997|      0|			free (psf->wchunks.chunks [k].data) ;
 2998|  19.8k|	free (psf->rchunks.chunks) ;
 2999|  19.8k|	free (psf->wchunks.chunks) ;
 3000|  19.8k|	free (psf->iterator) ;
 3001|  19.8k|	free (psf->cart_16k) ;
 3002|       |
 3003|  19.8k|	free (psf) ;
 3004|       |
 3005|  19.8k|	return error ;
 3006|  19.8k|} /* psf_close */
sndfile.c:guess_file_type:
 2783|  19.8k|{	uint32_t buffer [3], format ;
 2784|       |
 2785|  22.3k|retry:
 2786|  22.3k|	if (psf_binheader_readf (psf, "b", &buffer, SIGNED_SIZEOF (buffer)) != SIGNED_SIZEOF (buffer))
  ------------------
  |  |   91|  22.3k|#define		SIGNED_SIZEOF(x)	((int) sizeof (x))
  ------------------
              	if (psf_binheader_readf (psf, "b", &buffer, SIGNED_SIZEOF (buffer)) != SIGNED_SIZEOF (buffer))
  ------------------
  |  |   91|  22.3k|#define		SIGNED_SIZEOF(x)	((int) sizeof (x))
  ------------------
  |  Branch (2786:6): [True: 73, False: 22.2k]
  ------------------
 2787|     73|	{	psf->error = SFE_BAD_FILE_READ ;
 2788|     73|		return 0 ;
 2789|  22.2k|		} ;
 2790|       |
 2791|  22.2k|	if ((buffer [0] == MAKE_MARKER ('R', 'I', 'F', 'F') || buffer [0] == MAKE_MARKER ('R', 'I', 'F', 'X'))
  ------------------
  |  |  122|  44.5k|	#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|  17.8k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
  |  Branch (2791:7): [True: 4.46k, False: 17.8k]
  |  Branch (2791:57): [True: 227, False: 17.5k]
  ------------------
 2792|  4.68k|			&& buffer [2] == MAKE_MARKER ('W', 'A', 'V', 'E'))
  ------------------
  |  |  122|  4.68k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
  |  Branch (2792:7): [True: 4.63k, False: 53]
  ------------------
 2793|  4.63k|		return SF_FORMAT_WAV ;
 2794|       |
 2795|  17.6k|	if (buffer [0] == MAKE_MARKER ('F', 'O', 'R', 'M'))
  ------------------
  |  |  122|  17.6k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
  |  Branch (2795:6): [True: 3.69k, False: 13.9k]
  ------------------
 2796|  3.69k|	{	if (buffer [2] == MAKE_MARKER ('A', 'I', 'F', 'F') || buffer [2] == MAKE_MARKER ('A', 'I', 'F', 'C'))
  ------------------
  |  |  122|  7.39k|	#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|  3.12k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
  |  Branch (2796:8): [True: 566, False: 3.12k]
  |  Branch (2796:58): [True: 2.42k, False: 700]
  ------------------
 2797|  2.99k|			return SF_FORMAT_AIFF ;
 2798|    700|		if (buffer [2] == MAKE_MARKER ('8', 'S', 'V', 'X') || buffer [2] == MAKE_MARKER ('1', '6', 'S', 'V'))
  ------------------
  |  |  122|  1.40k|	#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|    632|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
  |  Branch (2798:7): [True: 68, False: 632]
  |  Branch (2798:57): [True: 491, False: 141]
  ------------------
 2799|    559|			return SF_FORMAT_SVX ;
 2800|    141|		return 0 ;
 2801|  13.9k|		} ;
 2802|       |
 2803|  13.9k|	if (buffer [0] == MAKE_MARKER ('.', 's', 'n', 'd') || buffer [0] == MAKE_MARKER ('d', 'n', 's', '.'))
  ------------------
  |  |  122|  27.8k|	#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|  13.4k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
  |  Branch (2803:6): [True: 548, False: 13.4k]
  |  Branch (2803:56): [True: 784, False: 12.6k]
  ------------------
 2804|  1.33k|		return SF_FORMAT_AU ;
 2805|       |
 2806|  12.6k|	if ((buffer [0] == MAKE_MARKER ('f', 'a', 'p', ' ') || buffer [0] == MAKE_MARKER (' ', 'p', 'a', 'f')))
  ------------------
  |  |  122|  25.2k|	#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|  12.6k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
  |  Branch (2806:7): [True: 10, False: 12.6k]
  |  Branch (2806:57): [True: 130, False: 12.4k]
  ------------------
 2807|    140|		return SF_FORMAT_PAF ;
 2808|       |
 2809|  12.4k|	if (buffer [0] == MAKE_MARKER ('N', 'I', 'S', 'T'))
  ------------------
  |  |  122|  12.4k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
  |  Branch (2809:6): [True: 85, False: 12.3k]
  ------------------
 2810|     85|		return SF_FORMAT_NIST ;
 2811|       |
 2812|  12.3k|	if (buffer [0] == MAKE_MARKER ('C', 'r', 'e', 'a') && buffer [1] == MAKE_MARKER ('t', 'i', 'v', 'e'))
  ------------------
  |  |  122|  24.7k|	#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|    262|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
  |  Branch (2812:6): [True: 262, False: 12.1k]
  |  Branch (2812:56): [True: 211, False: 51]
  ------------------
 2813|    211|		return SF_FORMAT_VOC ;
 2814|       |
 2815|  12.1k|	if ((buffer [0] & MAKE_MARKER (0xFF, 0xFF, 0xF8, 0xFF)) == MAKE_MARKER (0x64, 0xA3, 0x00, 0x00) ||
  ------------------
  |  |  122|  12.1k|	#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|  24.3k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
  |  Branch (2815:6): [True: 275, False: 11.9k]
  ------------------
 2816|  11.9k|		(buffer [0] & MAKE_MARKER (0xFF, 0xF8, 0xFF, 0xFF)) == MAKE_MARKER (0x00, 0x00, 0xA3, 0x64))
  ------------------
  |  |  122|  11.9k|	#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|  11.9k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
  |  Branch (2816:3): [True: 128, False: 11.7k]
  ------------------
 2817|    403|		return SF_FORMAT_IRCAM ;
 2818|       |
 2819|  11.7k|	if (buffer [0] == MAKE_MARKER ('r', 'i', 'f', 'f'))
  ------------------
  |  |  122|  11.7k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
  |  Branch (2819:6): [True: 722, False: 11.0k]
  ------------------
 2820|    722|		return SF_FORMAT_W64 ;
 2821|       |
 2822|  11.0k|	if (buffer [0] == MAKE_MARKER (0, 0, 0x03, 0xE8) && buffer [1] == MAKE_MARKER (0, 0, 0, 1) &&
  ------------------
  |  |  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 (0, 0, 0x03, 0xE8) && buffer [1] == MAKE_MARKER (0, 0, 0, 1) &&
  ------------------
  |  |  122|  11.2k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
  |  Branch (2822:6): [True: 224, False: 10.8k]
  |  Branch (2822:54): [True: 182, False: 42]
  ------------------
 2823|    182|								buffer [2] == MAKE_MARKER (0, 0, 0, 1))
  ------------------
  |  |  122|    182|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
  |  Branch (2823:9): [True: 143, False: 39]
  ------------------
 2824|    143|		return SF_FORMAT_MAT4 ;
 2825|       |
 2826|  10.9k|	if (buffer [0] == MAKE_MARKER (0, 0, 0, 0) && buffer [1] == MAKE_MARKER (1, 0, 0, 0) &&
  ------------------
  |  |  122|  21.8k|	#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|  11.6k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
  |  Branch (2826:6): [True: 744, False: 10.1k]
  |  Branch (2826:48): [True: 665, False: 79]
  ------------------
 2827|    665|								buffer [2] == MAKE_MARKER (1, 0, 0, 0))
  ------------------
  |  |  122|    665|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
  |  Branch (2827:9): [True: 619, False: 46]
  ------------------
 2828|    619|		return SF_FORMAT_MAT4 ;
 2829|       |
 2830|  10.2k|	if (buffer [0] == MAKE_MARKER ('M', 'A', 'T', 'L') && buffer [1] == MAKE_MARKER ('A', 'B', ' ', '5'))
  ------------------
  |  |  122|  20.5k|	#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|    332|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
  |  Branch (2830:6): [True: 332, False: 9.96k]
  |  Branch (2830:56): [True: 290, False: 42]
  ------------------
 2831|    290|		return SF_FORMAT_MAT5 ;
 2832|       |
 2833|  10.0k|	if (buffer [0] == MAKE_MARKER ('P', 'V', 'F', '1'))
  ------------------
  |  |  122|  10.0k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
  |  Branch (2833:6): [True: 146, False: 9.85k]
  ------------------
 2834|    146|		return SF_FORMAT_PVF ;
 2835|       |
 2836|  9.85k|	if (buffer [0] == MAKE_MARKER ('E', 'x', 't', 'e') && buffer [1] == MAKE_MARKER ('n', 'd', 'e', 'd') &&
  ------------------
  |  |  122|  19.7k|	#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|  10.0k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
  |  Branch (2836:6): [True: 203, False: 9.65k]
  |  Branch (2836:56): [True: 165, False: 38]
  ------------------
 2837|    165|								buffer [2] == MAKE_MARKER (' ', 'I', 'n', 's'))
  ------------------
  |  |  122|    165|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
  |  Branch (2837:9): [True: 148, False: 17]
  ------------------
 2838|    148|		return SF_FORMAT_XI ;
 2839|       |
 2840|  9.70k|	if (buffer [0] == MAKE_MARKER ('c', 'a', 'f', 'f') && buffer [2] == MAKE_MARKER ('d', 'e', 's', 'c'))
  ------------------
  |  |  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 ('c', 'a', 'f', 'f') && buffer [2] == MAKE_MARKER ('d', 'e', 's', 'c'))
  ------------------
  |  |  122|  2.57k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
  |  Branch (2840:6): [True: 2.57k, False: 7.13k]
  |  Branch (2840:56): [True: 2.52k, False: 48]
  ------------------
 2841|  2.52k|		return SF_FORMAT_CAF ;
 2842|       |
 2843|  7.18k|	if (buffer [0] == MAKE_MARKER ('O', 'g', 'g', 'S'))
  ------------------
  |  |  122|  7.18k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
  |  Branch (2843:6): [True: 1, False: 7.18k]
  ------------------
 2844|      1|		return SF_FORMAT_OGG ;
 2845|       |
 2846|  7.18k|	if (buffer [0] == MAKE_MARKER ('A', 'L', 'a', 'w') && buffer [1] == MAKE_MARKER ('S', 'o', 'u', 'n')
  ------------------
  |  |  122|  14.3k|	#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|  7.34k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
  |  Branch (2846:6): [True: 158, False: 7.02k]
  |  Branch (2846:56): [True: 109, False: 49]
  ------------------
 2847|    109|			&& buffer [2] == MAKE_MARKER ('d', 'F', 'i', 'l'))
  ------------------
  |  |  122|    109|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
  |  Branch (2847:7): [True: 64, False: 45]
  ------------------
 2848|     64|		return SF_FORMAT_WVE ;
 2849|       |
 2850|  7.11k|	if (buffer [0] == MAKE_MARKER ('D', 'i', 'a', 'm') && buffer [1] == MAKE_MARKER ('o', 'n', 'd', 'W')
  ------------------
  |  |  122|  14.2k|	#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|  7.20k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
  |  Branch (2850:6): [True: 82, False: 7.03k]
  |  Branch (2850:56): [True: 37, False: 45]
  ------------------
 2851|     37|			&& buffer [2] == MAKE_MARKER ('a', 'r', 'e', ' '))
  ------------------
  |  |  122|     37|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
  |  Branch (2851:7): [True: 1, False: 36]
  ------------------
 2852|      1|		return SF_FORMAT_DWD ;
 2853|       |
 2854|  7.11k|	if (buffer [0] == MAKE_MARKER ('L', 'M', '8', '9') || buffer [0] == MAKE_MARKER ('5', '3', 0, 0))
  ------------------
  |  |  122|  14.2k|	#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|  7.11k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
  |  Branch (2854:6): [True: 1, False: 7.11k]
  |  Branch (2854:56): [True: 1, False: 7.11k]
  ------------------
 2855|      2|		return SF_FORMAT_TXW ;
 2856|       |
 2857|  7.11k|	if ((buffer [0] & MAKE_MARKER (0xFF, 0xFF, 0x80, 0xFF)) == MAKE_MARKER (0xF0, 0x7E, 0, 0x01))
  ------------------
  |  |  122|  7.11k|	#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|  7.11k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
  |  Branch (2857:6): [True: 379, False: 6.73k]
  ------------------
 2858|    379|		return SF_FORMAT_SDS ;
 2859|       |
 2860|  6.73k|	if ((buffer [0] & MAKE_MARKER (0xFF, 0xFF, 0, 0)) == MAKE_MARKER (1, 4, 0, 0))
  ------------------
  |  |  122|  6.73k|	#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|  6.73k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
  |  Branch (2860:6): [True: 15, False: 6.72k]
  ------------------
 2861|     15|		return SF_FORMAT_MPC2K ;
 2862|       |
 2863|  6.72k|	if (buffer [0] == MAKE_MARKER ('C', 'A', 'T', ' ') && buffer [2] == MAKE_MARKER ('R', 'E', 'X', '2'))
  ------------------
  |  |  122|  13.4k|	#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|     19|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
  |  Branch (2863:6): [True: 19, False: 6.70k]
  |  Branch (2863:56): [True: 1, False: 18]
  ------------------
 2864|      1|		return SF_FORMAT_REX2 ;
 2865|       |
 2866|  6.72k|	if (buffer [0] == MAKE_MARKER (0x30, 0x26, 0xB2, 0x75) && buffer [1] == MAKE_MARKER (0x8E, 0x66, 0xCF, 0x11))
  ------------------
  |  |  122|  13.4k|	#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|     40|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
  |  Branch (2866:6): [True: 40, False: 6.68k]
  |  Branch (2866:60): [True: 1, False: 39]
  ------------------
 2867|      1|		return 0 /*-SF_FORMAT_WMA-*/ ;
 2868|       |
 2869|       |	/* HMM (Hidden Markov Model) Tool Kit. */
 2870|  6.71k|	if (buffer [2] == MAKE_MARKER (0, 2, 0, 0) && 2 * ((int64_t) BE2H_32 (buffer [0])) + 12 == psf->filelength)
  ------------------
  |  |  122|  13.4k|	#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|    398|	#define BE2H_32(x)			ENDSWAP_32 (x)
  |  |  ------------------
  |  |  |  |   35|    398|#define	ENDSWAP_32(x)		(bswap_32 (x))
  |  |  ------------------
  ------------------
  |  Branch (2870:6): [True: 398, False: 6.32k]
  |  Branch (2870:48): [True: 56, False: 342]
  ------------------
 2871|     56|		return SF_FORMAT_HTK ;
 2872|       |
 2873|  6.66k|	if (buffer [0] == MAKE_MARKER ('f', 'L', 'a', 'C'))
  ------------------
  |  |  122|  6.66k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
  |  Branch (2873:6): [True: 1, False: 6.66k]
  ------------------
 2874|      1|		return SF_FORMAT_FLAC ;
 2875|       |
 2876|  6.66k|	if (buffer [0] == MAKE_MARKER ('2', 'B', 'I', 'T'))
  ------------------
  |  |  122|  6.66k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
  |  Branch (2876:6): [True: 91, False: 6.57k]
  ------------------
 2877|     91|		return SF_FORMAT_AVR ;
 2878|       |
 2879|  6.57k|	if (buffer [0] == MAKE_MARKER ('R', 'F', '6', '4') && buffer [2] == MAKE_MARKER ('W', 'A', 'V', 'E'))
  ------------------
  |  |  122|  13.1k|	#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.37k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
  |  Branch (2879:6): [True: 2.37k, False: 4.19k]
  |  Branch (2879:56): [True: 2.32k, False: 48]
  ------------------
 2880|  2.32k|		return SF_FORMAT_RF64 ;
 2881|       |
 2882|  4.24k|	if (buffer [0] == MAKE_MARKER ('I', 'D', '3', 2) || buffer [0] == MAKE_MARKER ('I', 'D', '3', 3)
  ------------------
  |  |  122|  8.48k|	#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|  7.87k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
  |  Branch (2882:6): [True: 613, False: 3.62k]
  |  Branch (2882:54): [True: 830, False: 2.79k]
  ------------------
 2883|  2.79k|			|| buffer [0] == MAKE_MARKER ('I', 'D', '3', 4))
  ------------------
  |  |  122|  2.79k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
  |  Branch (2883:7): [True: 1.11k, False: 1.68k]
  ------------------
 2884|  2.55k|	{	psf_log_printf (psf, "Found 'ID3' marker.\n") ;
 2885|  2.55k|		if (id3_skip (psf))
  ------------------
  |  Branch (2885:7): [True: 2.50k, False: 51]
  ------------------
 2886|  2.50k|			goto retry ;
 2887|     51|		return 0 ;
 2888|  2.55k|		} ;
 2889|       |
 2890|       |	/* ID3v2 tags + MPEG */
 2891|  1.68k|	if (psf->id3_header.len > 0 && (format = identify_mpeg (buffer [0])) != 0)
  ------------------
  |  Branch (2891:6): [True: 45, False: 1.63k]
  |  Branch (2891:33): [True: 3, False: 42]
  ------------------
 2892|      3|		return format ;
 2893|       |
 2894|       |	/* Turtle Beach SMP 16-bit */
 2895|  1.68k|	if (buffer [0] == MAKE_MARKER ('S', 'O', 'U', 'N') && buffer [1] == MAKE_MARKER ('D', ' ', 'S', 'A'))
  ------------------
  |  |  122|  3.36k|	#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|     32|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
  |  Branch (2895:6): [True: 32, False: 1.64k]
  |  Branch (2895:56): [True: 1, False: 31]
  ------------------
 2896|      1|		return 0 ;
 2897|       |
 2898|       |	/* Yamaha sampler format. */
 2899|  1.67k|	if (buffer [0] == MAKE_MARKER ('S', 'Y', '8', '0') || buffer [0] == MAKE_MARKER ('S', 'Y', '8', '5'))
  ------------------
  |  |  122|  3.35k|	#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.67k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
  |  Branch (2899:6): [True: 1, False: 1.67k]
  |  Branch (2899:56): [True: 1, False: 1.67k]
  ------------------
 2900|      2|		return 0 ;
 2901|       |
 2902|  1.67k|	if (buffer [0] == MAKE_MARKER ('a', 'j', 'k', 'g'))
  ------------------
  |  |  122|  1.67k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
  |  Branch (2902:6): [True: 1, False: 1.67k]
  ------------------
 2903|      1|		return 0 /*-SF_FORMAT_SHN-*/ ;
 2904|       |
 2905|       |	/* This must be (almost) the last one. */
 2906|  1.67k|	if (psf->filelength > 0 && (format = try_resource_fork (psf)) != 0)
  ------------------
  |  Branch (2906:6): [True: 1.67k, False: 0]
  |  Branch (2906:29): [True: 0, False: 1.67k]
  ------------------
 2907|      0|		return format ;
 2908|       |
 2909|       |	/* MPEG with no ID3v2 tags. Only have the MPEG sync header for
 2910|       |	 * identification and it is quite brief, and prone to false positives.
 2911|       |	 * Check for this last, even after resource forks. */
 2912|  1.67k|	if (psf->id3_header.len == 0 && (format = identify_mpeg (buffer [0])) != 0)
  ------------------
  |  Branch (2912:6): [True: 1.63k, False: 42]
  |  Branch (2912:34): [True: 11, False: 1.62k]
  ------------------
 2913|     11|		return format ;
 2914|       |
 2915|  1.66k|	return 0 ;
 2916|  1.67k|} /* guess_file_type */
sndfile.c:identify_mpeg:
 2772|  1.67k|{	if ((marker & MAKE_MARKER (0xFF, 0xE0, 0, 0)) == MAKE_MARKER (0xFF, 0xE0, 0, 0) && /* Frame sync */
  ------------------
  |  |  122|  1.67k|	#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.35k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
  |  Branch (2772:7): [True: 33, False: 1.64k]
  ------------------
 2773|     33|		(marker & MAKE_MARKER (0, 0x18, 0, 0)) != MAKE_MARKER (0, 0x08, 0, 0) && /* Valid MPEG version */
  ------------------
  |  |  122|     33|	#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.71k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
  |  Branch (2773:3): [True: 30, False: 3]
  ------------------
 2774|     30|		(marker & MAKE_MARKER (0, 0x06, 0, 0)) != MAKE_MARKER (0, 0, 0, 0) && /* Valid layer description */
  ------------------
  |  |  122|     30|	#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.70k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
  |  Branch (2774:3): [True: 26, False: 4]
  ------------------
 2775|     26|		(marker & MAKE_MARKER (0, 0, 0xF0, 0)) != MAKE_MARKER (0, 0, 0xF0, 0) && /* Valid bitrate */
  ------------------
  |  |  122|     26|	#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.70k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
  |  Branch (2775:3): [True: 19, False: 7]
  ------------------
 2776|     19|		(marker & MAKE_MARKER (0, 0, 0x0C, 0)) != MAKE_MARKER (0, 0, 0x0C, 0)) /* Valid samplerate */
  ------------------
  |  |  122|     19|	#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|     19|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
  |  Branch (2776:3): [True: 14, False: 5]
  ------------------
 2777|     14|		return SF_FORMAT_MPEG ;
 2778|  1.66k|	return 0 ;
 2779|  1.67k|} /* identify_mpeg */
sndfile.c:try_resource_fork:
 2689|  1.67k|{	int old_error = psf->error ;
 2690|       |
 2691|       |	/* Set READ mode now, to see if resource fork exists. */
 2692|  1.67k|	psf->rsrc.mode = SFM_READ ;
 2693|  1.67k|	if (psf_open_rsrc (psf) != 0)
  ------------------
  |  Branch (2693:6): [True: 1.67k, False: 0]
  ------------------
 2694|  1.67k|	{	psf->error = old_error ;
 2695|  1.67k|		return 0 ;
 2696|  1.67k|		} ;
 2697|       |
 2698|       |	/* More checking here. */
 2699|      0|	psf_log_printf (psf, "Resource fork : %s\n", psf->rsrc.path) ;
 2700|       |
 2701|      0|	return SF_FORMAT_SD2 ;
 2702|  1.67k|} /* try_resource_fork */
sndfile.c:format_from_extension:
 2706|  1.93k|{	char *cptr ;
 2707|  1.93k|	char buffer [16] ;
 2708|  1.93k|	int format = 0 ;
 2709|       |
 2710|  1.93k|	if ((cptr = strrchr (psf->file.name, '.')) == NULL)
  ------------------
  |  Branch (2710:6): [True: 1.93k, False: 0]
  ------------------
 2711|  1.93k|		return 0 ;
 2712|       |
 2713|      0|	cptr ++ ;
 2714|      0|	if (strlen (cptr) > sizeof (buffer) - 1)
  ------------------
  |  Branch (2714:6): [True: 0, False: 0]
  ------------------
 2715|      0|		return 0 ;
 2716|       |
 2717|      0|	psf_strlcpy (buffer, sizeof (buffer), cptr) ;
 2718|      0|	buffer [sizeof (buffer) - 1] = 0 ;
 2719|       |
 2720|       |	/* Convert everything in the buffer to lower case. */
 2721|      0|	cptr = buffer ;
 2722|      0|	while (*cptr)
  ------------------
  |  Branch (2722:9): [True: 0, False: 0]
  ------------------
 2723|      0|	{	*cptr = tolower ((unsigned char) *cptr) ;
  ------------------
  |  Branch (2723:12): [True: 0, False: 0]
  |  Branch (2723:12): [True: 0, False: 0]
  |  Branch (2723:12): [Folded, False: 0]
  ------------------
 2724|      0|		cptr ++ ;
 2725|      0|		} ;
 2726|       |
 2727|      0|	cptr = buffer ;
 2728|       |
 2729|      0|	if (strcmp (cptr, "au") == 0)
  ------------------
  |  Branch (2729:6): [True: 0, False: 0]
  ------------------
 2730|      0|	{	psf->sf.channels = 1 ;
 2731|      0|		psf->sf.samplerate = 8000 ;
 2732|      0|		format = SF_FORMAT_RAW | SF_FORMAT_ULAW ;
 2733|      0|		}
 2734|      0|	else if (strcmp (cptr, "snd") == 0)
  ------------------
  |  Branch (2734:11): [True: 0, False: 0]
  ------------------
 2735|      0|	{	psf->sf.channels = 1 ;
 2736|      0|		psf->sf.samplerate = 8000 ;
 2737|      0|		format = SF_FORMAT_RAW | SF_FORMAT_ULAW ;
 2738|      0|		}
 2739|       |
 2740|      0|	else if (strcmp (cptr, "vox") == 0 || strcmp (cptr, "vox8") == 0)
  ------------------
  |  Branch (2740:11): [True: 0, False: 0]
  |  Branch (2740:40): [True: 0, False: 0]
  ------------------
 2741|      0|	{	psf->sf.channels = 1 ;
 2742|      0|		psf->sf.samplerate = 8000 ;
 2743|      0|		format = SF_FORMAT_RAW | SF_FORMAT_VOX_ADPCM ;
 2744|      0|		}
 2745|      0|	else if (strcmp (cptr, "vox6") == 0)
  ------------------
  |  Branch (2745:11): [True: 0, False: 0]
  ------------------
 2746|      0|	{	psf->sf.channels = 1 ;
 2747|      0|		psf->sf.samplerate = 6000 ;
 2748|      0|		format = SF_FORMAT_RAW | SF_FORMAT_VOX_ADPCM ;
 2749|      0|		}
 2750|      0|	else if (strcmp (cptr, "gsm") == 0)
  ------------------
  |  Branch (2750:11): [True: 0, False: 0]
  ------------------
 2751|      0|	{	psf->sf.channels = 1 ;
 2752|      0|		psf->sf.samplerate = 8000 ;
 2753|      0|		format = SF_FORMAT_RAW | SF_FORMAT_GSM610 ;
 2754|      0|		}
 2755|      0|	else if (strcmp (cptr, "mp3") == 0)
  ------------------
  |  Branch (2755:11): [True: 0, False: 0]
  ------------------
 2756|      0|	{	/*
 2757|       |		 * MPEG streams are quite tollerate of crap. If we couldn't identify a
 2758|       |		 * MP3 stream, but it has a .mp3 extension, let libmpg123 have a try.
 2759|       |		 */
 2760|      0|		format = SF_FORMAT_MPEG ;
 2761|      0|		}
 2762|       |
 2763|       |	/* For RAW files, make sure the dataoffset if set correctly. */
 2764|      0|	if ((SF_CONTAINER (format)) == SF_FORMAT_RAW)
  ------------------
  |  |  108|      0|#define SF_CONTAINER(x)		((x) & SF_FORMAT_TYPEMASK)
  ------------------
  |  Branch (2764:6): [True: 0, False: 0]
  ------------------
 2765|      0|		psf->dataoffset = 0 ;
 2766|       |
 2767|      0|	return format ;
 2768|      0|} /* format_from_extension */
sndfile.c:validate_sfinfo:
 2921|  5.14k|{	if (sfinfo->samplerate < 1)
  ------------------
  |  Branch (2921:7): [True: 1.05k, False: 4.09k]
  ------------------
 2922|  1.05k|		return 0 ;
 2923|  4.09k|	if (sfinfo->frames < 0)
  ------------------
  |  Branch (2923:6): [True: 136, False: 3.95k]
  ------------------
 2924|    136|		return 0 ;
 2925|  3.95k|	if ((sfinfo->channels < 1) || (sfinfo->channels > SF_MAX_CHANNELS))
  ------------------
  |  |  102|  3.87k|#define		SF_MAX_CHANNELS		1024
  ------------------
  |  Branch (2925:6): [True: 80, False: 3.87k]
  |  Branch (2925:32): [True: 29, False: 3.84k]
  ------------------
 2926|    109|		return 0 ;
 2927|  3.84k|	if ((SF_CONTAINER (sfinfo->format)) == 0)
  ------------------
  |  |  108|  3.84k|#define SF_CONTAINER(x)		((x) & SF_FORMAT_TYPEMASK)
  ------------------
  |  Branch (2927:6): [True: 0, False: 3.84k]
  ------------------
 2928|      0|		return 0 ;
 2929|  3.84k|	if ((SF_CODEC (sfinfo->format)) == 0)
  ------------------
  |  |  109|  3.84k|#define SF_CODEC(x)			((x) & SF_FORMAT_SUBMASK)
  ------------------
  |  Branch (2929:6): [True: 33, False: 3.81k]
  ------------------
 2930|     33|		return 0 ;
 2931|  3.81k|	if (sfinfo->sections < 1)
  ------------------
  |  Branch (2931:6): [True: 0, False: 3.81k]
  ------------------
 2932|      0|		return 0 ;
 2933|  3.81k|	return 1 ;
 2934|  3.81k|} /* validate_sfinfo */
sndfile.c:save_header_info:
 2957|  2.10k|{	snprintf (sf_parselog, sizeof (sf_parselog), "%s", psf->parselog.buf) ;
 2958|  2.10k|} /* save_header_info */
sndfile.c:validate_psf:
 2938|  3.81k|{
 2939|  3.81k|	if (psf->datalength < 0)
  ------------------
  |  Branch (2939:6): [True: 267, False: 3.54k]
  ------------------
 2940|    267|	{	psf_log_printf (psf, "Invalid SF_PRIVATE field : datalength == %D.\n", psf->datalength) ;
 2941|    267|		return 0 ;
 2942|  3.54k|		} ;
 2943|  3.54k|	if (psf->dataoffset < 0)
  ------------------
  |  Branch (2943:6): [True: 428, False: 3.12k]
  ------------------
 2944|    428|	{	psf_log_printf (psf, "Invalid SF_PRIVATE field : dataoffset == %D.\n", psf->dataoffset) ;
 2945|    428|		return 0 ;
 2946|  3.12k|		} ;
 2947|  3.12k|	if (psf->blockwidth && psf->blockwidth != psf->sf.channels * psf->bytewidth)
  ------------------
  |  Branch (2947:6): [True: 895, False: 2.22k]
  |  Branch (2947:25): [True: 75, False: 820]
  ------------------
 2948|     75|	{	psf_log_printf (psf, "Invalid SF_PRIVATE field : channels * bytewidth == %d.\n",
 2949|     75|								psf->sf.channels * psf->bytewidth) ;
 2950|     75|		return 0 ;
 2951|  3.04k|		} ;
 2952|  3.04k|	return 1 ;
 2953|  3.12k|} /* validate_psf */

psf_store_string:
   32|   125k|{	char	new_str [128] ;
   33|   125k|	size_t	str_len ;
   34|   125k|	int		k, str_flags ;
   35|       |
   36|   125k|	if (str == NULL)
  ------------------
  |  Branch (36:6): [True: 0, False: 125k]
  ------------------
   37|      0|		return SFE_STR_BAD_STRING ;
   38|       |
   39|   125k|	str_len = strlen (str) ;
   40|       |
   41|       |	/* A few extra checks for write mode. */
   42|   125k|	if (psf->file.mode == SFM_WRITE || psf->file.mode == SFM_RDWR)
  ------------------
  |  Branch (42:6): [True: 0, False: 125k]
  |  Branch (42:37): [True: 0, False: 125k]
  ------------------
   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|   125k|		} ;
   51|       |
   52|       |	/* Find the next free slot in table. */
   53|  4.07M|	for (k = 0 ; k < SF_MAX_STRINGS ; k++)
  ------------------
  |  |   80|  4.07M|#define SF_MAX_STRINGS			(32)
  ------------------
  |  Branch (53:15): [True: 3.94M, False: 121k]
  ------------------
   54|  3.94M|	{	/* If we find a matching entry clear it. */
   55|  3.94M|		if (psf->strings.data [k].type == str_type)
  ------------------
  |  Branch (55:7): [True: 3.49k, False: 3.94M]
  ------------------
   56|  3.49k|			psf->strings.data [k].type = -1 ;
   57|       |
   58|  3.94M|		if (psf->strings.data [k].type == 0)
  ------------------
  |  Branch (58:7): [True: 3.94k, False: 3.94M]
  ------------------
   59|  3.94k|			break ;
   60|  3.94M|		} ;
   61|       |
   62|       |	/* Determine flags */
   63|   125k|	str_flags = SF_STR_LOCATE_START ;
   64|   125k|	if (psf->file.mode == SFM_RDWR || psf->have_written)
  ------------------
  |  Branch (64:6): [True: 0, False: 125k]
  |  Branch (64:36): [True: 0, False: 125k]
  ------------------
   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|   125k|		} ;
   69|       |
   70|       |	/* More sanity checking. */
   71|   125k|	if (k >= SF_MAX_STRINGS)
  ------------------
  |  |   80|   125k|#define SF_MAX_STRINGS			(32)
  ------------------
  |  Branch (71:6): [True: 121k, False: 3.94k]
  ------------------
   72|   121k|		return SFE_STR_MAX_COUNT ;
   73|       |
   74|  3.94k|	if (k == 0 && psf->strings.storage_used != 0)
  ------------------
  |  Branch (74:6): [True: 435, False: 3.51k]
  |  Branch (74:16): [True: 0, False: 435]
  ------------------
   75|      0|	{	psf_log_printf (psf, "SFE_STR_WEIRD : k == 0 && psf->strings.storage_used != 0\n") ;
   76|      0|		return SFE_STR_WEIRD ;
   77|  3.94k|		} ;
   78|       |
   79|  3.94k|	if (k != 0 && psf->strings.storage_used == 0)
  ------------------
  |  Branch (79:6): [True: 3.51k, False: 435]
  |  Branch (79:16): [True: 0, False: 3.51k]
  ------------------
   80|      0|	{	psf_log_printf (psf, "SFE_STR_WEIRD : k != 0 && psf->strings.storage_used == 0\n") ;
   81|      0|		return SFE_STR_WEIRD ;
   82|  3.94k|		} ;
   83|       |
   84|       |	/* Special case for the first string. */
   85|  3.94k|	if (k == 0)
  ------------------
  |  Branch (85:6): [True: 435, False: 3.51k]
  ------------------
   86|    435|		psf->strings.storage_used = 0 ;
   87|       |
   88|  3.94k|	switch (str_type)
   89|  3.94k|	{	case SF_STR_SOFTWARE :
  ------------------
  |  Branch (89:4): [True: 516, False: 3.42k]
  ------------------
   90|       |				/* In write mode, want to append libsndfile-version to string. */
   91|    516|				if (psf->file.mode == SFM_WRITE || psf->file.mode == SFM_RDWR)
  ------------------
  |  Branch (91:9): [True: 0, False: 516]
  |  Branch (91:40): [True: 0, False: 516]
  ------------------
   92|      0|				{	if (strstr (str, PACKAGE_NAME) == NULL)
  ------------------
  |  |  200|      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) ;
  ------------------
  |  |  200|      0|#define PACKAGE_NAME "libsndfile"
  ------------------
              							snprintf (new_str, sizeof (new_str), "%s-%s", PACKAGE_NAME, PACKAGE_VERSION) ;
  ------------------
  |  |  212|      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) ;
  ------------------
  |  |  200|      0|#define PACKAGE_NAME "libsndfile"
  ------------------
              							snprintf (new_str, sizeof (new_str), "%s (%s-%s)", str, PACKAGE_NAME, PACKAGE_VERSION) ;
  ------------------
  |  |  212|      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|    516|				break ;
  108|       |
  109|    651|		case SF_STR_TITLE :
  ------------------
  |  Branch (109:3): [True: 651, False: 3.29k]
  ------------------
  110|  1.05k|		case SF_STR_COPYRIGHT :
  ------------------
  |  Branch (110:3): [True: 406, False: 3.53k]
  ------------------
  111|  1.62k|		case SF_STR_ARTIST :
  ------------------
  |  Branch (111:3): [True: 570, False: 3.37k]
  ------------------
  112|  2.25k|		case SF_STR_COMMENT :
  ------------------
  |  Branch (112:3): [True: 624, False: 3.32k]
  ------------------
  113|  2.52k|		case SF_STR_DATE :
  ------------------
  |  Branch (113:3): [True: 271, False: 3.67k]
  ------------------
  114|  2.78k|		case SF_STR_ALBUM :
  ------------------
  |  Branch (114:3): [True: 259, False: 3.68k]
  ------------------
  115|  2.87k|		case SF_STR_LICENSE :
  ------------------
  |  Branch (115:3): [True: 98, False: 3.84k]
  ------------------
  116|  3.17k|		case SF_STR_TRACKNUMBER :
  ------------------
  |  Branch (116:3): [True: 293, False: 3.65k]
  ------------------
  117|  3.42k|		case SF_STR_GENRE :
  ------------------
  |  Branch (117:3): [True: 257, False: 3.68k]
  ------------------
  118|  3.42k|				break ;
  119|       |
  120|      0|		default :
  ------------------
  |  Branch (120:3): [True: 0, False: 3.94k]
  ------------------
  121|      0|			psf_log_printf (psf, "%s : SFE_STR_BAD_TYPE\n", __func__) ;
  122|      0|			return SFE_STR_BAD_TYPE ;
  123|  3.94k|		} ;
  124|       |
  125|       |	/* Plus one to catch string terminator. */
  126|  3.94k|	str_len = strlen (str) + 1 ;
  127|       |
  128|  3.94k|	if (psf->strings.storage_used + str_len + 1 > psf->strings.storage_len)
  ------------------
  |  Branch (128:6): [True: 467, False: 3.47k]
  ------------------
  129|    467|	{	char * temp = psf->strings.storage ;
  130|    467|		size_t newlen = 2 * psf->strings.storage_len + str_len + 1 ;
  131|       |
  132|    467|		newlen = newlen < 256 ? 256 : newlen ;
  ------------------
  |  Branch (132:12): [True: 417, False: 50]
  ------------------
  133|       |
  134|    467|		char * new_storage = realloc(temp, newlen);
  135|    467|		if (new_storage == NULL)
  ------------------
  |  Branch (135:7): [True: 0, False: 467]
  ------------------
  136|      0|		{
  137|      0|			return SFE_MALLOC_FAILED ;
  138|    467|			} else {
  139|    467|			psf->strings.storage = new_storage;
  140|    467|			} ;
  141|       |
  142|    467|		psf->strings.storage_len = newlen ;
  143|  3.94k|		} ;
  144|       |
  145|  3.94k|	psf->strings.data [k].type = str_type ;
  146|  3.94k|	psf->strings.data [k].offset = psf->strings.storage_used ;
  147|  3.94k|	psf->strings.data [k].flags = str_flags ;
  148|       |
  149|  3.94k|	memcpy (psf->strings.storage + psf->strings.storage_used, str, str_len) ;
  150|  3.94k|	psf->strings.storage_used += str_len ;
  151|       |
  152|  3.94k|	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|  3.94k|	return 0 ;
  160|  3.94k|} /* psf_store_string */

svx_open:
   83|    559|{	int error ;
   84|       |
   85|    559|	if (psf->file.mode == SFM_READ || (psf->file.mode == SFM_RDWR && psf->filelength > 0))
  ------------------
  |  Branch (85:6): [True: 559, False: 0]
  |  Branch (85:37): [True: 0, False: 0]
  |  Branch (85:67): [True: 0, False: 0]
  ------------------
   86|    559|	{	if ((error = svx_read_header (psf)))
  ------------------
  |  Branch (86:8): [True: 538, False: 21]
  ------------------
   87|    538|			return error ;
   88|       |
   89|     21|		psf->endian = SF_ENDIAN_BIG ;			/* All SVX files are big endian. */
   90|       |
   91|     21|		psf->blockwidth = (sf_count_t) psf->sf.channels * psf->bytewidth ;
   92|     21|		if (psf->blockwidth)
  ------------------
  |  Branch (92:7): [True: 21, False: 0]
  ------------------
   93|     21|			psf->sf.frames = psf->datalength / psf->blockwidth ;
   94|       |
   95|     21|		psf_fseek (psf, psf->dataoffset, SEEK_SET) ;
   96|     21|		} ;
   97|       |
   98|     21|	if (psf->file.mode == SFM_WRITE || psf->file.mode == SFM_RDWR)
  ------------------
  |  Branch (98:6): [True: 0, False: 21]
  |  Branch (98:37): [True: 0, False: 21]
  ------------------
   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)
  ------------------
  |  |  108|      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) ;
  ------------------
  |  |  110|      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|     21|		} ;
  118|       |
  119|     21|	psf->container_close = svx_close ;
  120|       |
  121|     21|	if ((error = pcm_init (psf)))
  ------------------
  |  Branch (121:6): [True: 0, False: 21]
  ------------------
  122|      0|		return error ;
  123|       |
  124|     21|	return 0 ;
  125|     21|} /* svx_open */
svx.c:svx_read_header:
  132|    559|{	VHDR_CHUNK		vhdr ;
  133|    559|	uint32_t		chunk_size, marker ;
  134|    559|	int				filetype = 0, parsestage = 0, done = 0 ;
  135|    559|	int 			bytecount = 0, channels ;
  136|       |
  137|    559|	if (psf->filelength > 0xFFFFFFFFLL)
  ------------------
  |  Branch (137:6): [True: 0, False: 559]
  ------------------
  138|      0|		psf_log_printf (psf, "Warning : filelength > 0xffffffff. This is bad!!!!\n") ;
  139|       |
  140|    559|	memset (&vhdr, 0, sizeof (vhdr)) ;
  141|    559|	psf_binheader_readf (psf, "p", 0) ;
  142|       |
  143|       |	/* Set default number of channels. Modify later if necessary */
  144|    559|	psf->sf.channels = 1 ;
  145|       |
  146|    559|	psf->sf.format = SF_FORMAT_SVX ;
  147|       |
  148|  1.89M|	while (! done)
  ------------------
  |  Branch (148:9): [True: 1.89M, False: 48]
  ------------------
  149|  1.89M|	{	psf_binheader_readf (psf, "Em4", &marker, &chunk_size) ;
  150|       |
  151|  1.89M|		switch (marker)
  152|  1.89M|		{	case FORM_MARKER :
  ------------------
  |  |   35|    560|#define FORM_MARKER	(MAKE_MARKER ('F', 'O', 'R', 'M'))
  |  |  ------------------
  |  |  |  |  122|    560|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (152:5): [True: 560, False: 1.89M]
  ------------------
  153|    560|					if (parsestage)
  ------------------
  |  Branch (153:10): [True: 1, False: 559]
  ------------------
  154|      1|						return SFE_SVX_NO_FORM ;
  155|       |
  156|    559|					if (chunk_size != psf->filelength - 2 * sizeof (chunk_size))
  ------------------
  |  Branch (156:10): [True: 558, False: 1]
  ------------------
  157|    558|						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|    559|					parsestage |= HAVE_FORM ;
  161|       |
  162|    559|					psf_binheader_readf (psf, "m", &marker) ;
  163|       |
  164|    559|					filetype = marker ;
  165|    559|					psf_log_printf (psf, " %M\n", marker) ;
  166|    559|					parsestage |= HAVE_SVX ;
  167|    559|					break ;
  168|       |
  169|   266k|			case VHDR_MARKER :
  ------------------
  |  |   38|   266k|#define VHDR_MARKER	(MAKE_MARKER ('V', 'H', 'D', 'R'))
  |  |  ------------------
  |  |  |  |  122|   266k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (169:4): [True: 266k, False: 1.62M]
  ------------------
  170|   266k|					if (! (parsestage & (HAVE_FORM | HAVE_SVX)))
  ------------------
  |  Branch (170:10): [True: 0, False: 266k]
  ------------------
  171|      0|						return SFE_SVX_NO_FORM ;
  172|       |
  173|   266k|					psf_log_printf (psf, " VHDR : %d\n", chunk_size) ;
  174|       |
  175|   266k|					psf_binheader_readf (psf, "E4442114", &(vhdr.oneShotHiSamples), &(vhdr.repeatHiSamples),
  176|   266k|						&(vhdr.samplesPerHiCycle), &(vhdr.samplesPerSec), &(vhdr.octave), &(vhdr.compression),
  177|   266k|						&(vhdr.volume)) ;
  178|       |
  179|   266k|					psf_log_printf (psf, "  OneShotHiSamples  : %d\n", vhdr.oneShotHiSamples) ;
  180|   266k|					psf_log_printf (psf, "  RepeatHiSamples   : %d\n", vhdr.repeatHiSamples) ;
  181|   266k|					psf_log_printf (psf, "  samplesPerHiCycle : %d\n", vhdr.samplesPerHiCycle) ;
  182|   266k|					psf_log_printf (psf, "  Sample Rate       : %d\n", vhdr.samplesPerSec) ;
  183|   266k|					psf_log_printf (psf, "  Octave            : %d\n", vhdr.octave) ;
  184|       |
  185|   266k|					psf_log_printf (psf, "  Compression       : %d => ", vhdr.compression) ;
  186|       |
  187|   266k|					switch (vhdr.compression)
  ------------------
  |  Branch (187:14): [True: 266k, False: 448]
  ------------------
  188|   266k|					{	case 0 : psf_log_printf (psf, "None.\n") ;
  ------------------
  |  Branch (188:8): [True: 265k, False: 1.15k]
  ------------------
  189|   265k|								break ;
  190|    253|						case 1 : psf_log_printf (psf, "Fibonacci delta\n") ;
  ------------------
  |  Branch (190:7): [True: 253, False: 266k]
  ------------------
  191|    253|								break ;
  192|    457|						case 2 : psf_log_printf (psf, "Exponential delta\n") ;
  ------------------
  |  Branch (192:7): [True: 457, False: 266k]
  ------------------
  193|    457|								break ;
  194|   266k|						} ;
  195|       |
  196|   266k|					psf_log_printf (psf, "  Volume            : %d\n", vhdr.volume) ;
  197|       |
  198|   266k|					psf->sf.samplerate 	= vhdr.samplesPerSec ;
  199|       |
  200|   266k|					if (filetype == SVX8_MARKER)
  ------------------
  |  |   36|   266k|#define SVX8_MARKER	(MAKE_MARKER ('8', 'S', 'V', 'X'))
  |  |  ------------------
  |  |  |  |  122|   266k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (200:10): [True: 1.21k, False: 265k]
  ------------------
  201|  1.21k|					{	psf->sf.format |= SF_FORMAT_PCM_S8 ;
  202|  1.21k|						psf->bytewidth = 1 ;
  203|  1.21k|						}
  204|   265k|					else if (filetype == SV16_MARKER)
  ------------------
  |  |   37|   265k|#define SV16_MARKER	(MAKE_MARKER ('1', '6', 'S', 'V'))
  |  |  ------------------
  |  |  |  |  122|   265k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (204:15): [True: 265k, False: 0]
  ------------------
  205|   265k|					{	psf->sf.format |= SF_FORMAT_PCM_16 ;
  206|   265k|						psf->bytewidth = 2 ;
  207|   265k|						} ;
  208|       |
  209|   266k|					parsestage |= HAVE_VHDR ;
  210|   266k|					break ;
  211|       |
  212|   266k|			case BODY_MARKER :
  ------------------
  |  |   39|   266k|#define BODY_MARKER	(MAKE_MARKER ('B', 'O', 'D', 'Y'))
  |  |  ------------------
  |  |  |  |  122|   266k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (212:4): [True: 266k, False: 1.62M]
  ------------------
  213|   266k|					if (! (parsestage & HAVE_VHDR))
  ------------------
  |  Branch (213:10): [True: 1, False: 266k]
  ------------------
  214|      1|						return SFE_SVX_NO_BODY ;
  215|       |
  216|   266k|					psf->datalength = chunk_size ;
  217|       |
  218|   266k|					psf->dataoffset = psf_ftell (psf) ;
  219|   266k|					if (psf->dataoffset < 0)
  ------------------
  |  Branch (219:10): [True: 0, False: 266k]
  ------------------
  220|      0|						return SFE_SVX_NO_BODY ;
  221|       |
  222|   266k|					if (psf->datalength > psf->filelength - psf->dataoffset)
  ------------------
  |  Branch (222:10): [True: 1, False: 266k]
  ------------------
  223|      1|					{	psf_log_printf (psf, " BODY : %D (should be %D)\n", psf->datalength, psf->filelength - psf->dataoffset) ;
  224|      1|						psf->datalength = psf->filelength - psf->dataoffset ;
  225|      1|						}
  226|   266k|					else
  227|   266k|						psf_log_printf (psf, " BODY : %D\n", psf->datalength) ;
  228|       |
  229|   266k|					parsestage |= HAVE_BODY ;
  230|       |
  231|   266k|					if (! psf->sf.seekable)
  ------------------
  |  Branch (231:10): [True: 0, False: 266k]
  ------------------
  232|      0|						break ;
  233|       |
  234|   266k|					psf_fseek (psf, psf->datalength, SEEK_CUR) ;
  235|   266k|					break ;
  236|       |
  237|    628|			case NAME_MARKER :
  ------------------
  |  |   45|    628|#define NAME_MARKER	(MAKE_MARKER ('N', 'A', 'M', 'E'))
  |  |  ------------------
  |  |  |  |  122|    628|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (237:4): [True: 628, False: 1.89M]
  ------------------
  238|    628|					if (! (parsestage & HAVE_SVX))
  ------------------
  |  Branch (238:10): [True: 0, False: 628]
  ------------------
  239|      0|						return SFE_SVX_NO_FORM ;
  240|       |
  241|    628|					psf_log_printf (psf, " %M : %u\n", marker, chunk_size) ;
  242|       |
  243|    628|					if (strlen (psf->file.name) != chunk_size)
  ------------------
  |  Branch (243:10): [True: 355, False: 273]
  ------------------
  244|    355|					{	if (chunk_size > sizeof (psf->file.name) - 1)
  ------------------
  |  Branch (244:12): [True: 41, False: 314]
  ------------------
  245|     41|							return SFE_SVX_BAD_NAME_LENGTH ;
  246|       |
  247|    314|						psf_binheader_readf (psf, "b", psf->file.name, chunk_size) ;
  248|    314|						psf->file.name [chunk_size] = 0 ;
  249|    314|						}
  250|    273|					else
  251|    273|						psf_binheader_readf (psf, "j", chunk_size) ;
  252|    587|					break ;
  253|       |
  254|    587|			case ANNO_MARKER :
  ------------------
  |  |   47|    303|#define ANNO_MARKER	(MAKE_MARKER ('A', 'N', 'N', 'O'))
  |  |  ------------------
  |  |  |  |  122|    303|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (254:4): [True: 303, False: 1.89M]
  ------------------
  255|    303|					if (! (parsestage & HAVE_SVX))
  ------------------
  |  Branch (255:10): [True: 0, False: 303]
  ------------------
  256|      0|						return SFE_SVX_NO_FORM ;
  257|       |
  258|    303|					psf_log_printf (psf, " %M : %u\n", marker, chunk_size) ;
  259|       |
  260|    303|					psf_binheader_readf (psf, "j", chunk_size) ;
  261|    303|					break ;
  262|       |
  263|  1.38k|			case CHAN_MARKER :
  ------------------
  |  |   48|  1.38k|#define CHAN_MARKER	(MAKE_MARKER ('C', 'H', 'A', 'N'))
  |  |  ------------------
  |  |  |  |  122|  1.38k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (263:4): [True: 1.38k, False: 1.89M]
  ------------------
  264|  1.38k|					if (! (parsestage & HAVE_SVX))
  ------------------
  |  Branch (264:10): [True: 0, False: 1.38k]
  ------------------
  265|      0|						return SFE_SVX_NO_FORM ;
  266|       |
  267|  1.38k|					psf_log_printf (psf, " %M : %u\n", marker, chunk_size) ;
  268|       |
  269|  1.38k|					bytecount += psf_binheader_readf (psf, "E4", &channels) ;
  270|       |
  271|  1.38k|					if (channels == 2 || channels == 4)
  ------------------
  |  Branch (271:10): [True: 320, False: 1.06k]
  |  Branch (271:27): [True: 364, False: 701]
  ------------------
  272|    684|						psf_log_printf (psf, "  Channels : %d => mono\n", channels) ;
  273|    701|					else if (channels == 6)
  ------------------
  |  Branch (273:15): [True: 270, False: 431]
  ------------------
  274|    270|					{	psf->sf.channels = 2 ;
  275|    270|						psf_log_printf (psf, "  Channels : %d => stereo\n", channels) ;
  276|    270|						}
  277|    431|					else
  278|    431|						psf_log_printf (psf, "  Channels : %d *** assuming mono\n", channels) ;
  279|       |
  280|  1.38k|					psf_binheader_readf (psf, "j", chunk_size - bytecount) ;
  281|  1.38k|					break ;
  282|       |
  283|       |
  284|  1.29k|			case AUTH_MARKER :
  ------------------
  |  |   46|  1.29k|#define AUTH_MARKER	(MAKE_MARKER ('A', 'U', 'T', 'H'))
  |  |  ------------------
  |  |  |  |  122|  1.29k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (284:4): [True: 1.29k, False: 1.89M]
  ------------------
  285|   268k|			case c_MARKER :
  ------------------
  |  |   44|   268k|#define c_MARKER	(MAKE_MARKER ('(', 'c', ')', ' '))
  |  |  ------------------
  |  |  |  |  122|   268k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (285:4): [True: 267k, False: 1.62M]
  ------------------
  286|   268k|					if (! (parsestage & HAVE_SVX))
  ------------------
  |  Branch (286:10): [True: 0, False: 268k]
  ------------------
  287|      0|						return SFE_SVX_NO_FORM ;
  288|       |
  289|   268k|					psf_log_printf (psf, " %M : %u\n", marker, chunk_size) ;
  290|       |
  291|   268k|					psf_binheader_readf (psf, "j", chunk_size) ;
  292|   268k|					break ;
  293|       |
  294|  1.08M|			default :
  ------------------
  |  Branch (294:4): [True: 1.08M, False: 804k]
  ------------------
  295|  1.08M|					if (chunk_size >= 0xffff0000)
  ------------------
  |  Branch (295:10): [True: 20, False: 1.08M]
  ------------------
  296|     20|					{	done = SF_TRUE ;
  297|     20|						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|     20|						break ;
  299|  1.08M|						} ;
  300|       |
  301|  1.08M|					if (psf_isprint ((marker >> 24) & 0xFF) && psf_isprint ((marker >> 16) & 0xFF)
  ------------------
  |  Branch (301:10): [True: 1.07M, False: 14.9k]
  |  Branch (301:49): [True: 1.07M, False: 1.51k]
  ------------------
  302|  1.07M|						&& psf_isprint ((marker >> 8) & 0xFF) && psf_isprint (marker & 0xFF))
  ------------------
  |  Branch (302:10): [True: 1.07M, False: 2.04k]
  |  Branch (302:48): [True: 1.06M, False: 659]
  ------------------
  303|  1.06M|					{	psf_log_printf (psf, "%M : %u (unknown marker)\n", marker, chunk_size) ;
  304|  1.06M|						psf_binheader_readf (psf, "j", chunk_size) ;
  305|  1.06M|						break ;
  306|  1.06M|						} ;
  307|  19.1k|					if ((chunk_size = psf_ftell (psf)) & 0x03)
  ------------------
  |  Branch (307:10): [True: 19.0k, False: 96]
  ------------------
  308|  19.0k|					{	psf_log_printf (psf, "  Unknown chunk marker at position %d. Resynching.\n", chunk_size - 4) ;
  309|       |
  310|  19.0k|						chunk_size = chunk_size & 3 ;
  311|  19.0k|						psf_binheader_readf (psf, "j", 4 - chunk_size) ;
  312|  19.0k|						break ;
  313|  19.0k|						} ;
  314|     96|					psf_log_printf (psf, "*** Unknown chunk marker (%X) at position %D. Exiting parser.\n", marker, psf_ftell (psf) - 8) ;
  315|     96|					done = SF_TRUE ;
  316|  1.89M|			} ;	/* switch (marker) */
  317|       |
  318|  1.89M|		if (! psf->sf.seekable && (parsestage & HAVE_BODY))
  ------------------
  |  Branch (318:7): [True: 0, False: 1.89M]
  |  Branch (318:29): [True: 0, False: 0]
  ------------------
  319|      0|			break ;
  320|       |
  321|  1.89M|		if (psf_ftell (psf) >= psf->filelength - SIGNED_SIZEOF (chunk_size))
  ------------------
  |  |   91|  1.89M|#define		SIGNED_SIZEOF(x)	((int) sizeof (x))
  ------------------
  |  Branch (321:7): [True: 468, False: 1.89M]
  ------------------
  322|    468|			break ;
  323|  1.89M|		} ; /* while (1) */
  324|       |
  325|    516|	if (vhdr.compression)
  ------------------
  |  Branch (325:6): [True: 42, False: 474]
  ------------------
  326|     42|		return SFE_SVX_BAD_COMP ;
  327|       |
  328|    474|	if (psf->dataoffset <= 0)
  ------------------
  |  Branch (328:6): [True: 453, False: 21]
  ------------------
  329|    453|		return SFE_SVX_NO_DATA ;
  330|       |
  331|     21|	return 0 ;
  332|    474|} /* svx_read_header */
svx.c:svx_close:
  336|     21|{
  337|     21|	if (psf->file.mode == SFM_WRITE || psf->file.mode == SFM_RDWR)
  ------------------
  |  Branch (337:6): [True: 0, False: 21]
  |  Branch (337:37): [True: 0, False: 21]
  ------------------
  338|      0|		svx_write_header (psf, SF_TRUE) ;
  339|       |
  340|     21|	return 0 ;
  341|     21|} /* 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|    337|{
   40|    337|	if (psf->file.mode == SFM_READ || psf->file.mode == SFM_RDWR)
  ------------------
  |  Branch (40:6): [True: 337, False: 0]
  |  Branch (40:36): [True: 0, False: 0]
  ------------------
   41|    337|	{	psf->read_short		= ulaw_read_ulaw2s ;
   42|    337|		psf->read_int		= ulaw_read_ulaw2i ;
   43|    337|		psf->read_float		= ulaw_read_ulaw2f ;
   44|    337|		psf->read_double	= ulaw_read_ulaw2d ;
   45|    337|		} ;
   46|       |
   47|    337|	if (psf->file.mode == SFM_WRITE || psf->file.mode == SFM_RDWR)
  ------------------
  |  Branch (47:6): [True: 0, False: 337]
  |  Branch (47:37): [True: 0, False: 337]
  ------------------
   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|    337|	psf->bytewidth = 1 ;
   55|    337|	psf->blockwidth = psf->sf.channels ;
   56|       |
   57|    337|	if (psf->filelength > psf->dataoffset)
  ------------------
  |  Branch (57:6): [True: 251, False: 86]
  ------------------
   58|    251|		psf->datalength = (psf->dataend) ? psf->dataend - psf->dataoffset :
  ------------------
  |  Branch (58:21): [True: 122, False: 129]
  ------------------
   59|    251|							psf->filelength - psf->dataoffset ;
   60|     86|	else
   61|     86|		psf->datalength = 0 ;
   62|       |
   63|    337|	psf->sf.frames = psf->blockwidth > 0 ? psf->datalength / psf->blockwidth : 0 ;
  ------------------
  |  Branch (63:19): [True: 299, False: 38]
  ------------------
   64|       |
   65|    337|	return 0 ;
   66|    337|} /* ulaw_init */
ulaw.c:ulaw_read_ulaw2f:
  911|    796|{	BUF_UNION	ubuf ;
  912|    796|	int			bufferlen, readcount ;
  913|    796|	sf_count_t	total = 0 ;
  914|    796|	float	normfact ;
  915|       |
  916|    796|	normfact = (psf->norm_float == SF_TRUE) ? 1.0 / ((float) 0x8000) : 1.0 ;
  ------------------
  |  Branch (916:13): [True: 796, False: 0]
  ------------------
  917|       |
  918|    796|	bufferlen = ARRAY_LEN (ubuf.ucbuf) ;
  ------------------
  |  |   93|    796|#define		ARRAY_LEN(x)	((int) (sizeof (x) / sizeof ((x) [0])))
  ------------------
  919|       |
  920|  1.55k|	while (len > 0)
  ------------------
  |  Branch (920:9): [True: 796, False: 754]
  ------------------
  921|    796|	{	if (len < bufferlen)
  ------------------
  |  Branch (921:8): [True: 796, False: 0]
  ------------------
  922|    796|			bufferlen = (int) len ;
  923|    796|		readcount = (int) psf_fread (ubuf.ucbuf, 1, bufferlen, psf) ;
  924|    796|		ulaw2f_array (ubuf.ucbuf, readcount, ptr + total, normfact) ;
  925|    796|		total += readcount ;
  926|    796|		if (readcount < bufferlen)
  ------------------
  |  Branch (926:7): [True: 42, False: 754]
  ------------------
  927|     42|			break ;
  928|    754|		len -= readcount ;
  929|    754|		} ;
  930|       |
  931|    796|	return total ;
  932|    796|} /* ulaw_read_ulaw2f */
ulaw.c:ulaw2f_array:
  808|  9.56k|{	for (int i = 0 ; i < count ; i++)
  ------------------
  |  Branch (808:20): [True: 8.77k, False: 796]
  ------------------
  809|  8.77k|		ptr [i] = normfact * ulaw_decode [(int) buffer [i]] ;
  810|    796|} /* ulaw2f_array */

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

w64_open:
  125|    722|{	WAVLIKE_PRIVATE * wpriv ;
  126|    722|	int	subformat, error, blockalign = 0, framesperblock = 0 ;
  127|       |
  128|    722|	if ((wpriv = calloc (1, sizeof (WAVLIKE_PRIVATE))) == NULL)
  ------------------
  |  Branch (128:6): [True: 0, False: 722]
  ------------------
  129|      0|		return SFE_MALLOC_FAILED ;
  130|    722|	psf->container_data = wpriv ;
  131|       |
  132|    722|	if (psf->file.mode == SFM_READ || (psf->file.mode == SFM_RDWR &&psf->filelength > 0))
  ------------------
  |  Branch (132:6): [True: 722, False: 0]
  |  Branch (132:37): [True: 0, False: 0]
  |  Branch (132:66): [True: 0, False: 0]
  ------------------
  133|    722|	{	if ((error = w64_read_header (psf, &blockalign, &framesperblock)))
  ------------------
  |  Branch (133:8): [True: 601, False: 121]
  ------------------
  134|    601|			return error ;
  135|    722|		} ;
  136|       |
  137|    121|	if ((SF_CONTAINER (psf->sf.format)) != SF_FORMAT_W64)
  ------------------
  |  |  108|    121|#define SF_CONTAINER(x)		((x) & SF_FORMAT_TYPEMASK)
  ------------------
  |  Branch (137:6): [True: 0, False: 121]
  ------------------
  138|      0|		return	SFE_BAD_OPEN_FORMAT ;
  139|       |
  140|    121|	subformat = SF_CODEC (psf->sf.format) ;
  ------------------
  |  |  109|    121|#define SF_CODEC(x)			((x) & SF_FORMAT_SUBMASK)
  ------------------
  141|       |
  142|    121|	if (psf->file.mode == SFM_WRITE || psf->file.mode == SFM_RDWR)
  ------------------
  |  Branch (142:6): [True: 0, False: 121]
  |  Branch (142:37): [True: 0, False: 121]
  ------------------
  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 (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 ;
  ------------------
  |  |  370|      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|    121|		} ;
  169|       |
  170|    121|	psf->container_close = w64_close ;
  171|       |
  172|    121|	switch (subformat)
  173|    121|	{	case SF_FORMAT_PCM_U8 :
  ------------------
  |  Branch (173:4): [True: 26, False: 95]
  ------------------
  174|     26|					error = pcm_init (psf) ;
  175|     26|					break ;
  176|       |
  177|      1|		case SF_FORMAT_PCM_16 :
  ------------------
  |  Branch (177:3): [True: 1, False: 120]
  ------------------
  178|      5|		case SF_FORMAT_PCM_24 :
  ------------------
  |  Branch (178:3): [True: 4, False: 117]
  ------------------
  179|      7|		case SF_FORMAT_PCM_32 :
  ------------------
  |  Branch (179:3): [True: 2, False: 119]
  ------------------
  180|      7|					error = pcm_init (psf) ;
  181|      7|					break ;
  182|       |
  183|      7|		case SF_FORMAT_ULAW :
  ------------------
  |  Branch (183:3): [True: 7, False: 114]
  ------------------
  184|      7|					error = ulaw_init (psf) ;
  185|      7|					break ;
  186|       |
  187|      5|		case SF_FORMAT_ALAW :
  ------------------
  |  Branch (187:3): [True: 5, False: 116]
  ------------------
  188|      5|					error = alaw_init (psf) ;
  189|      5|					break ;
  190|       |
  191|       |		/* Lite remove start */
  192|     12|		case SF_FORMAT_FLOAT :
  ------------------
  |  Branch (192:3): [True: 12, False: 109]
  ------------------
  193|     12|					error = float32_init (psf) ;
  194|     12|					break ;
  195|       |
  196|      4|		case SF_FORMAT_DOUBLE :
  ------------------
  |  Branch (196:3): [True: 4, False: 117]
  ------------------
  197|      4|					error = double64_init (psf) ;
  198|      4|					break ;
  199|       |
  200|      2|		case SF_FORMAT_IMA_ADPCM :
  ------------------
  |  Branch (200:3): [True: 2, False: 119]
  ------------------
  201|      2|					error = wavlike_ima_init (psf, blockalign, framesperblock) ;
  202|      2|					break ;
  203|       |
  204|     12|		case SF_FORMAT_MS_ADPCM :
  ------------------
  |  Branch (204:3): [True: 12, False: 109]
  ------------------
  205|     12|					error = wavlike_msadpcm_init (psf, blockalign, framesperblock) ;
  206|     12|					break ;
  207|       |		/* Lite remove end */
  208|       |
  209|     31|		case SF_FORMAT_GSM610 :
  ------------------
  |  Branch (209:3): [True: 31, False: 90]
  ------------------
  210|     31|					error = gsm610_init (psf) ;
  211|     31|					break ;
  212|       |
  213|     15|		default : 	return SFE_UNIMPLEMENTED ;
  ------------------
  |  Branch (213:3): [True: 15, False: 106]
  ------------------
  214|    121|		} ;
  215|       |
  216|    106|	return error ;
  217|    121|} /* w64_open */
w64.c:w64_read_header:
  225|    722|{	WAVLIKE_PRIVATE *wpriv ;
  226|    722|	WAV_FMT 	*wav_fmt ;
  227|    722|	int			dword = 0, marker, format = 0 ;
  228|    722|	sf_count_t	chunk_size, bytesread = 0 ;
  229|    722|	int			parsestage = 0, error, done = 0 ;
  230|       |
  231|    722|	if ((wpriv = psf->container_data) == NULL)
  ------------------
  |  Branch (231:6): [True: 0, False: 722]
  ------------------
  232|      0|		return SFE_INTERNAL ;
  233|    722|	wav_fmt = &wpriv->wav_fmt ;
  234|       |
  235|       |	/* Set position to start of file to begin reading header. */
  236|    722|	psf_binheader_readf (psf, "p", 0) ;
  237|       |
  238|   135k|	while (! done)
  ------------------
  |  Branch (238:9): [True: 135k, False: 0]
  ------------------
  239|   135k|	{	/* Each new chunk must start on an 8 byte boundary, so jump if needed. */
  240|   135k|		if (psf->header.indx & 0x7)
  ------------------
  |  Branch (240:7): [True: 3.32k, False: 132k]
  ------------------
  241|  3.32k|			psf_binheader_readf (psf, "j", 8 - (psf->header.indx & 0x7)) ;
  242|       |
  243|       |		/* Generate hash of 16 byte marker. */
  244|   135k|		marker = 0 ;
  245|   135k|		chunk_size = 0 ;
  246|       |
  247|   135k|		bytesread = psf_binheader_readf (psf, "eh8", &marker, &chunk_size) ;
  248|   135k|		if (bytesread == 0)
  ------------------
  |  Branch (248:7): [True: 45, False: 135k]
  ------------------
  249|     45|			break ;
  250|   135k|		switch (marker)
  251|   135k|		{	case riff_HASH16 :
  ------------------
  |  |   50|    306|#define	riff_HASH16 MAKE_HASH16 ('r', 'i', 'f', 'f', 0x2E, 0x91, 0xCF, 0x11, \
  |  |  ------------------
  |  |  |  |   41|    306|			(	(x0)			^ ((x1) << 1)	^ ((x2) << 2)	^ ((x3) << 3) ^	\
  |  |  |  |   42|    306|				((x4) << 4) 	^ ((x5) << 5)	^ ((x6) << 6)	^ ((x7) << 7) ^	\
  |  |  |  |   43|    306|				((x8) << 8) 	^ ((x9) << 9)	^ ((xa) << 10)	^ ((xb) << 11) ^ \
  |  |  |  |   44|    306|				((xc) << 12) 	^ ((xd) << 13)	^ ((xe) << 14)	^ ((xf) << 15)	)
  |  |  ------------------
  |  |   51|    306|								0xA5, 0xD6, 0x28, 0xDB, 0x04, 0xC1, 0x00, 0x00)
  ------------------
  |  Branch (251:5): [True: 306, False: 135k]
  ------------------
  252|    306|					if (parsestage)
  ------------------
  |  Branch (252:10): [True: 10, False: 296]
  ------------------
  253|     10|						return SFE_W64_NO_RIFF ;
  254|       |
  255|    296|					if (psf->filelength != chunk_size)
  ------------------
  |  Branch (255:10): [True: 295, False: 1]
  ------------------
  256|    295|						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|    296|					parsestage |= HAVE_riff ;
  261|       |
  262|    296|					bytesread += psf_binheader_readf (psf, "h", &marker) ;
  263|    296|					if (marker == wave_HASH16)
  ------------------
  |  |   53|    296|#define	wave_HASH16 	MAKE_HASH16 ('w', 'a', 'v', 'e', 0xF3, 0xAC, 0xD3, 0x11, \
  |  |  ------------------
  |  |  |  |   41|    296|			(	(x0)			^ ((x1) << 1)	^ ((x2) << 2)	^ ((x3) << 3) ^	\
  |  |  |  |   42|    296|				((x4) << 4) 	^ ((x5) << 5)	^ ((x6) << 6)	^ ((x7) << 7) ^	\
  |  |  |  |   43|    296|				((x8) << 8) 	^ ((x9) << 9)	^ ((xa) << 10)	^ ((xb) << 11) ^ \
  |  |  |  |   44|    296|				((xc) << 12) 	^ ((xd) << 13)	^ ((xe) << 14)	^ ((xf) << 15)	)
  |  |  ------------------
  ------------------
  |  Branch (263:10): [True: 196, False: 100]
  ------------------
  264|    196|					{ 	if ((parsestage & HAVE_riff) != HAVE_riff)
  ------------------
  |  Branch (264:13): [True: 0, False: 196]
  ------------------
  265|      0|							return SFE_W64_NO_WAVE ;
  266|    196|						psf_log_printf (psf, "wave\n") ;
  267|    196|						parsestage |= HAVE_wave ;
  268|    296|					} ;
  269|    296|					chunk_size = 0 ;
  270|    296|					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: 135k]
  ------------------
  273|      1|					psf_log_printf (psf, "Looks like an ACID file. Exiting.\n") ;
  274|      1|					return SFE_UNIMPLEMENTED ;
  275|       |
  276|  9.62k|			case fmt_HASH16 :
  ------------------
  |  |   56|  9.62k|#define	fmt_HASH16 		MAKE_HASH16 ('f', 'm', 't', ' ', 0xF3, 0xAC, 0xD3, 0x11, \
  |  |  ------------------
  |  |  |  |   41|  9.62k|			(	(x0)			^ ((x1) << 1)	^ ((x2) << 2)	^ ((x3) << 3) ^	\
  |  |  |  |   42|  9.62k|				((x4) << 4) 	^ ((x5) << 5)	^ ((x6) << 6)	^ ((x7) << 7) ^	\
  |  |  |  |   43|  9.62k|				((x8) << 8) 	^ ((x9) << 9)	^ ((xa) << 10)	^ ((xb) << 11) ^ \
  |  |  |  |   44|  9.62k|				((xc) << 12) 	^ ((xd) << 13)	^ ((xe) << 14)	^ ((xf) << 15)	)
  |  |  ------------------
  |  |   57|  9.62k|								0x8C, 0xD1, 0x00, 0xC0, 0x4F, 0x8E, 0xDB, 0x8A)
  ------------------
  |  Branch (276:4): [True: 9.62k, False: 125k]
  ------------------
  277|  9.62k|					if ((parsestage & (HAVE_riff | HAVE_wave)) != (HAVE_riff | HAVE_wave))
  ------------------
  |  Branch (277:10): [True: 1, False: 9.62k]
  ------------------
  278|      1|						return SFE_WAV_NO_FMT ;
  279|       |
  280|  9.62k|					psf_log_printf (psf, " fmt : %D\n", chunk_size) ;
  281|       |
  282|       |					/* size of 16 byte marker and 8 byte chunk_size value. */
  283|  9.62k|					chunk_size -= 24 ;
  284|       |
  285|  9.62k|					if ((error = wavlike_read_fmt_chunk (psf, (int) chunk_size)))
  ------------------
  |  Branch (285:10): [True: 6, False: 9.61k]
  ------------------
  286|      6|						return error ;
  287|       |
  288|  9.61k|					if (chunk_size % 8)
  ------------------
  |  Branch (288:10): [True: 4.77k, False: 4.84k]
  ------------------
  289|  4.77k|						psf_binheader_readf (psf, "j", 8 - (chunk_size % 8)) ;
  290|       |
  291|  9.61k|					format		= wav_fmt->format ;
  292|  9.61k|					parsestage |= HAVE_fmt ;
  293|  9.61k|					chunk_size = 0 ;
  294|  9.61k|					break ;
  295|       |
  296|    200|			case fact_HASH16:
  ------------------
  |  |   59|    200|#define	fact_HASH16 	MAKE_HASH16 ('f', 'a', 'c', 't', 0xF3, 0xAC, 0xD3, 0x11, \
  |  |  ------------------
  |  |  |  |   41|    200|			(	(x0)			^ ((x1) << 1)	^ ((x2) << 2)	^ ((x3) << 3) ^	\
  |  |  |  |   42|    200|				((x4) << 4) 	^ ((x5) << 5)	^ ((x6) << 6)	^ ((x7) << 7) ^	\
  |  |  |  |   43|    200|				((x8) << 8) 	^ ((x9) << 9)	^ ((xa) << 10)	^ ((xb) << 11) ^ \
  |  |  |  |   44|    200|				((xc) << 12) 	^ ((xd) << 13)	^ ((xe) << 14)	^ ((xf) << 15)	)
  |  |  ------------------
  |  |   60|    200|								0x8C, 0xD1, 0x00, 0xC0, 0x4F, 0x8E, 0xDB, 0x8A)
  ------------------
  |  Branch (296:4): [True: 200, False: 135k]
  ------------------
  297|    200|					{	sf_count_t frames ;
  298|       |
  299|    200|						psf_binheader_readf (psf, "e8", &frames) ;
  300|    200|						psf_log_printf (psf, "fact : %D\n  frames : %D\n",
  301|    200|										chunk_size, frames) ;
  302|    200|						} ;
  303|    200|					chunk_size = 0 ;
  304|    200|					break ;
  305|       |
  306|       |
  307|  31.7k|			case data_HASH16 :
  ------------------
  |  |   62|  31.7k|#define	data_HASH16 	MAKE_HASH16 ('d', 'a', 't', 'a', 0xF3, 0xAC, 0xD3, 0x11, \
  |  |  ------------------
  |  |  |  |   41|  31.7k|			(	(x0)			^ ((x1) << 1)	^ ((x2) << 2)	^ ((x3) << 3) ^	\
  |  |  |  |   42|  31.7k|				((x4) << 4) 	^ ((x5) << 5)	^ ((x6) << 6)	^ ((x7) << 7) ^	\
  |  |  |  |   43|  31.7k|				((x8) << 8) 	^ ((x9) << 9)	^ ((xa) << 10)	^ ((xb) << 11) ^ \
  |  |  |  |   44|  31.7k|				((xc) << 12) 	^ ((xd) << 13)	^ ((xe) << 14)	^ ((xf) << 15)	)
  |  |  ------------------
  |  |   63|  31.7k|								0x8C, 0xD1, 0x00, 0xC0, 0x4F, 0x8E, 0xDB, 0x8A)
  ------------------
  |  Branch (307:4): [True: 31.7k, False: 103k]
  ------------------
  308|  31.7k|					if ((parsestage & (HAVE_riff | HAVE_wave | HAVE_fmt)) != (HAVE_riff | HAVE_wave | HAVE_fmt))
  ------------------
  |  Branch (308:10): [True: 2, False: 31.7k]
  ------------------
  309|      2|						return SFE_W64_NO_DATA ;
  310|       |
  311|  31.7k|					psf->dataoffset = psf_ftell (psf) ;
  312|  31.7k|					psf->datalength = SF_MIN (chunk_size - 24, psf->filelength - psf->dataoffset) ;
  ------------------
  |  |   96|  31.7k|#define		SF_MIN(a, b)	((a) < (b) ? (a) : (b))
  |  |  ------------------
  |  |  |  Branch (96:24): [True: 29.8k, False: 1.89k]
  |  |  ------------------
  ------------------
  313|       |
  314|  31.7k|					if (chunk_size % 8)
  ------------------
  |  Branch (314:10): [True: 13.6k, False: 18.0k]
  ------------------
  315|  13.6k|						chunk_size += 8 - (chunk_size % 8) ;
  316|       |
  317|  31.7k|					psf_log_printf (psf, "data : %D\n", chunk_size) ;
  318|       |
  319|  31.7k|					parsestage |= HAVE_data ;
  320|       |
  321|  31.7k|					if (! psf->sf.seekable)
  ------------------
  |  Branch (321:10): [True: 0, False: 31.7k]
  ------------------
  322|      0|						break ;
  323|       |
  324|       |					/* Seek past data and continue reading header. */
  325|  31.7k|					psf_fseek (psf, chunk_size, SEEK_CUR) ;
  326|  31.7k|					chunk_size = 0 ;
  327|  31.7k|					break ;
  328|       |
  329|  1.09k|			case levl_HASH16 :
  ------------------
  |  |   68|  1.09k|#define	levl_HASH16		MAKE_HASH16 (0x6c, 0x65, 0x76, 0x6c, 0xf3, 0xac, 0xd3, 0x11, \
  |  |  ------------------
  |  |  |  |   41|  1.09k|			(	(x0)			^ ((x1) << 1)	^ ((x2) << 2)	^ ((x3) << 3) ^	\
  |  |  |  |   42|  1.09k|				((x4) << 4) 	^ ((x5) << 5)	^ ((x6) << 6)	^ ((x7) << 7) ^	\
  |  |  |  |   43|  1.09k|				((x8) << 8) 	^ ((x9) << 9)	^ ((xa) << 10)	^ ((xb) << 11) ^ \
  |  |  |  |   44|  1.09k|				((xc) << 12) 	^ ((xd) << 13)	^ ((xe) << 14)	^ ((xf) << 15)	)
  |  |  ------------------
  |  |   69|  1.09k|								0xd1, 0x8c, 0x00, 0xC0, 0x4F, 0x8E, 0xDB, 0x8A)
  ------------------
  |  Branch (329:4): [True: 1.09k, False: 134k]
  ------------------
  330|  1.09k|					psf_log_printf (psf, "levl : %D\n", chunk_size) ;
  331|  1.09k|					break ;
  332|       |
  333|     66|			case list_HASH16 :
  ------------------
  |  |   71|     66|#define list_HASH16		MAKE_HASH16 (0x6C, 0x69, 0x73, 0x74, 0x2F, 0x91, 0xCF, 0x11, \
  |  |  ------------------
  |  |  |  |   41|     66|			(	(x0)			^ ((x1) << 1)	^ ((x2) << 2)	^ ((x3) << 3) ^	\
  |  |  |  |   42|     66|				((x4) << 4) 	^ ((x5) << 5)	^ ((x6) << 6)	^ ((x7) << 7) ^	\
  |  |  |  |   43|     66|				((x8) << 8) 	^ ((x9) << 9)	^ ((xa) << 10)	^ ((xb) << 11) ^ \
  |  |  |  |   44|     66|				((xc) << 12) 	^ ((xd) << 13)	^ ((xe) << 14)	^ ((xf) << 15)	)
  |  |  ------------------
  |  |   72|     66|								0xA5, 0xD6, 0x28, 0xDB, 0x04, 0xC1, 0x00, 0x00)
  ------------------
  |  Branch (333:4): [True: 66, False: 135k]
  ------------------
  334|     66|					psf_log_printf (psf, "list : %D\n", chunk_size) ;
  335|     66|					break ;
  336|       |
  337|  1.31k|			case junk_HASH16 :
  ------------------
  |  |   74|  1.31k|#define junk_HASH16		MAKE_HASH16 (0x6A, 0x75, 0x6E, 0x6b, 0xF3, 0xAC, 0xD3, 0x11, \
  |  |  ------------------
  |  |  |  |   41|  1.31k|			(	(x0)			^ ((x1) << 1)	^ ((x2) << 2)	^ ((x3) << 3) ^	\
  |  |  |  |   42|  1.31k|				((x4) << 4) 	^ ((x5) << 5)	^ ((x6) << 6)	^ ((x7) << 7) ^	\
  |  |  |  |   43|  1.31k|				((x8) << 8) 	^ ((x9) << 9)	^ ((xa) << 10)	^ ((xb) << 11) ^ \
  |  |  |  |   44|  1.31k|				((xc) << 12) 	^ ((xd) << 13)	^ ((xe) << 14)	^ ((xf) << 15)	)
  |  |  ------------------
  |  |   75|  1.31k|								0x8C, 0xD1, 0x00, 0xC0, 0x4f, 0x8E, 0xDB, 0x8A)
  ------------------
  |  Branch (337:4): [True: 1.31k, False: 134k]
  ------------------
  338|  1.31k|					psf_log_printf (psf, "junk : %D\n", chunk_size) ;
  339|  1.31k|					break ;
  340|       |
  341|  1.38k|			case bext_HASH16 :
  ------------------
  |  |   77|  1.38k|#define bext_HASH16		MAKE_HASH16 (0x62, 0x65, 0x78, 0x74, 0xf3, 0xac, 0xd3, 0xaa, \
  |  |  ------------------
  |  |  |  |   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)	)
  |  |  ------------------
  |  |   78|  1.38k|								0xd1, 0x8c, 0x00, 0xC0, 0x4F, 0x8E, 0xDB, 0x8A)
  ------------------
  |  Branch (341:4): [True: 1.38k, False: 134k]
  ------------------
  342|  1.38k|					psf_log_printf (psf, "bext : %D\n", chunk_size) ;
  343|  1.38k|					break ;
  344|       |
  345|  1.14k|			case MARKER_HASH16 :
  ------------------
  |  |   80|  1.14k|#define MARKER_HASH16	MAKE_HASH16 (0x56, 0x62, 0xf7, 0xab, 0x2d, 0x39, 0xd2, 0x11, \
  |  |  ------------------
  |  |  |  |   41|  1.14k|			(	(x0)			^ ((x1) << 1)	^ ((x2) << 2)	^ ((x3) << 3) ^	\
  |  |  |  |   42|  1.14k|				((x4) << 4) 	^ ((x5) << 5)	^ ((x6) << 6)	^ ((x7) << 7) ^	\
  |  |  |  |   43|  1.14k|				((x8) << 8) 	^ ((x9) << 9)	^ ((xa) << 10)	^ ((xb) << 11) ^ \
  |  |  |  |   44|  1.14k|				((xc) << 12) 	^ ((xd) << 13)	^ ((xe) << 14)	^ ((xf) << 15)	)
  |  |  ------------------
  |  |   81|  1.14k|								0x86, 0xc7, 0x00, 0xc0, 0x4f, 0x8e, 0xdb, 0x8a)
  ------------------
  |  Branch (345:4): [True: 1.14k, False: 134k]
  ------------------
  346|  1.14k|					psf_log_printf (psf, "marker : %D\n", chunk_size) ;
  347|  1.14k|					break ;
  348|       |
  349|  1.55k|			case SUMLIST_HASH16 :
  ------------------
  |  |   83|  1.55k|#define	SUMLIST_HASH16	MAKE_HASH16 (0xBC, 0x94, 0x5F, 0x92, 0x5A, 0x52, 0xD2, 0x11, \
  |  |  ------------------
  |  |  |  |   41|  1.55k|			(	(x0)			^ ((x1) << 1)	^ ((x2) << 2)	^ ((x3) << 3) ^	\
  |  |  |  |   42|  1.55k|				((x4) << 4) 	^ ((x5) << 5)	^ ((x6) << 6)	^ ((x7) << 7) ^	\
  |  |  |  |   43|  1.55k|				((x8) << 8) 	^ ((x9) << 9)	^ ((xa) << 10)	^ ((xb) << 11) ^ \
  |  |  |  |   44|  1.55k|				((xc) << 12) 	^ ((xd) << 13)	^ ((xe) << 14)	^ ((xf) << 15)	)
  |  |  ------------------
  |  |   84|  1.55k|								0x86, 0xDC, 0x00, 0xC0, 0x4F, 0x8E, 0xDB, 0x8A)
  ------------------
  |  Branch (349:4): [True: 1.55k, False: 134k]
  ------------------
  350|  1.55k|					psf_log_printf (psf, "summary list : %D\n", chunk_size) ;
  351|  1.55k|					break ;
  352|       |
  353|  87.1k|			default :
  ------------------
  |  Branch (353:4): [True: 87.1k, False: 48.4k]
  ------------------
  354|  87.1k|					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) ;
  355|  87.1k|					break ;
  356|   135k|			} ;	/* switch (dword) */
  357|       |
  358|   135k|		if (chunk_size >= psf->filelength)
  ------------------
  |  Branch (358:7): [True: 212, False: 135k]
  ------------------
  359|    212|		{	psf_log_printf (psf, "*** Chunk size %u > file length %D. Exiting parser.\n", chunk_size, psf->filelength) ;
  360|    212|			break ;
  361|   135k|			} ;
  362|       |
  363|   135k|		if (psf->sf.seekable == 0 && (parsestage & HAVE_data))
  ------------------
  |  Branch (363:7): [True: 0, False: 135k]
  |  Branch (363:32): [True: 0, False: 0]
  ------------------
  364|      0|			break ;
  365|       |
  366|   135k|		if (psf_ftell (psf) >= (psf->filelength - (2 * SIGNED_SIZEOF (dword))))
  ------------------
  |  |   91|   135k|#define		SIGNED_SIZEOF(x)	((int) sizeof (x))
  ------------------
  |  Branch (366:7): [True: 445, False: 134k]
  ------------------
  367|    445|			break ;
  368|       |
  369|   134k|		if (chunk_size > 0 && chunk_size < 0xffff0000)
  ------------------
  |  Branch (369:7): [True: 5.32k, False: 129k]
  |  Branch (369:25): [True: 5.32k, False: 0]
  ------------------
  370|  5.32k|		{	dword = chunk_size ;
  371|  5.32k|			psf_binheader_readf (psf, "j", dword - 24) ;
  372|  5.32k|			} ;
  373|   134k|		} ; /* while (1) */
  374|       |
  375|    702|	if (psf->dataoffset <= 0)
  ------------------
  |  Branch (375:6): [True: 538, False: 164]
  ------------------
  376|    538|		return SFE_W64_NO_DATA ;
  377|       |
  378|    164|	if (psf->sf.channels < 1)
  ------------------
  |  Branch (378:6): [True: 16, False: 148]
  ------------------
  379|     16|		return SFE_CHANNEL_COUNT_ZERO ;
  380|       |
  381|    148|	if (psf->sf.channels > SF_MAX_CHANNELS)
  ------------------
  |  |  102|    148|#define		SF_MAX_CHANNELS		1024
  ------------------
  |  Branch (381:6): [True: 24, False: 124]
  ------------------
  382|     24|		return SFE_CHANNEL_COUNT ;
  383|       |
  384|    124|	psf->endian = SF_ENDIAN_LITTLE ;		/* All W64 files are little endian. */
  385|       |
  386|    124|	if (psf_ftell (psf) != psf->dataoffset)
  ------------------
  |  Branch (386:6): [True: 104, False: 20]
  ------------------
  387|    104|		psf_fseek (psf, psf->dataoffset, SEEK_SET) ;
  388|       |
  389|    124|	if (psf->blockwidth)
  ------------------
  |  Branch (389:6): [True: 73, False: 51]
  ------------------
  390|     73|	{	if (psf->filelength - psf->dataoffset < psf->datalength)
  ------------------
  |  Branch (390:8): [True: 0, False: 73]
  ------------------
  391|      0|			psf->sf.frames = (psf->filelength - psf->dataoffset) / psf->blockwidth ;
  392|     73|		else
  393|     73|			psf->sf.frames = psf->datalength / psf->blockwidth ;
  394|     73|		} ;
  395|       |
  396|    124|	switch (format)
  397|    124|	{	case WAVE_FORMAT_PCM :
  ------------------
  |  Branch (397:4): [True: 47, False: 77]
  ------------------
  398|     48|		case WAVE_FORMAT_EXTENSIBLE :
  ------------------
  |  Branch (398:3): [True: 1, False: 123]
  ------------------
  399|       |					/* extensible might be FLOAT, MULAW, etc as well! */
  400|     48|					psf->sf.format = SF_FORMAT_W64 | u_bitwidth_to_subformat (psf->bytewidth * 8) ;
  401|     48|					break ;
  402|       |
  403|      7|		case WAVE_FORMAT_MULAW :
  ------------------
  |  Branch (403:3): [True: 7, False: 117]
  ------------------
  404|      7|					psf->sf.format = (SF_FORMAT_W64 | SF_FORMAT_ULAW) ;
  405|      7|					break ;
  406|       |
  407|      5|		case WAVE_FORMAT_ALAW :
  ------------------
  |  Branch (407:3): [True: 5, False: 119]
  ------------------
  408|      5|					psf->sf.format = (SF_FORMAT_W64 | SF_FORMAT_ALAW) ;
  409|      5|					break ;
  410|       |
  411|     12|		case WAVE_FORMAT_MS_ADPCM :
  ------------------
  |  Branch (411:3): [True: 12, False: 112]
  ------------------
  412|     12|					psf->sf.format = (SF_FORMAT_W64 | SF_FORMAT_MS_ADPCM) ;
  413|     12|					*blockalign = wav_fmt->msadpcm.blockalign ;
  414|     12|					*framesperblock = wav_fmt->msadpcm.samplesperblock ;
  415|     12|					break ;
  416|       |
  417|      2|		case WAVE_FORMAT_IMA_ADPCM :
  ------------------
  |  Branch (417:3): [True: 2, False: 122]
  ------------------
  418|      2|					psf->sf.format = (SF_FORMAT_W64 | SF_FORMAT_IMA_ADPCM) ;
  419|      2|					*blockalign = wav_fmt->ima.blockalign ;
  420|      2|					*framesperblock = wav_fmt->ima.samplesperblock ;
  421|      2|					break ;
  422|       |
  423|     31|		case WAVE_FORMAT_GSM610 :
  ------------------
  |  Branch (423:3): [True: 31, False: 93]
  ------------------
  424|     31|					psf->sf.format = (SF_FORMAT_W64 | SF_FORMAT_GSM610) ;
  425|     31|					break ;
  426|       |
  427|     16|		case WAVE_FORMAT_IEEE_FLOAT :
  ------------------
  |  Branch (427:3): [True: 16, False: 108]
  ------------------
  428|     16|					psf->sf.format = SF_FORMAT_W64 ;
  429|     16|					psf->sf.format |= (psf->bytewidth == 8) ? SF_FORMAT_DOUBLE : SF_FORMAT_FLOAT ;
  ------------------
  |  Branch (429:24): [True: 4, False: 12]
  ------------------
  430|     16|					break ;
  431|       |
  432|      3|		default : return SFE_UNIMPLEMENTED ;
  ------------------
  |  Branch (432:3): [True: 3, False: 121]
  ------------------
  433|    124|		} ;
  434|       |
  435|    121|	return 0 ;
  436|    124|} /* w64_read_header */
w64.c:w64_close:
  634|    121|{
  635|    121|	if (psf->file.mode == SFM_WRITE || psf->file.mode == SFM_RDWR)
  ------------------
  |  Branch (635:6): [True: 0, False: 121]
  |  Branch (635:37): [True: 0, False: 121]
  ------------------
  636|      0|		w64_write_header (psf, SF_TRUE) ;
  637|       |
  638|    121|	return 0 ;
  639|    121|} /* w64_close */

wav_open:
  163|  4.63k|{	WAVLIKE_PRIVATE * wpriv ;
  164|  4.63k|	int	format, subformat, error, blockalign = 0, framesperblock = 0 ;
  165|       |
  166|  4.63k|	if ((wpriv = calloc (1, sizeof (WAVLIKE_PRIVATE))) == NULL)
  ------------------
  |  Branch (166:6): [True: 0, False: 4.63k]
  ------------------
  167|      0|		return SFE_MALLOC_FAILED ;
  168|  4.63k|	psf->container_data = wpriv ;
  169|       |
  170|  4.63k|	wpriv->wavex_ambisonic = SF_AMBISONIC_NONE ;
  171|  4.63k|	psf->strings.flags = SF_STR_ALLOW_START | SF_STR_ALLOW_END ;
  172|       |
  173|  4.63k|	if (psf->file.mode == SFM_READ || (psf->file.mode == SFM_RDWR && psf->filelength > 0))
  ------------------
  |  Branch (173:6): [True: 4.63k, False: 0]
  |  Branch (173:37): [True: 0, False: 0]
  |  Branch (173:67): [True: 0, False: 0]
  ------------------
  174|  4.63k|	{	if ((error = wav_read_header (psf, &blockalign, &framesperblock)))
  ------------------
  |  Branch (174:8): [True: 3.66k, False: 966]
  ------------------
  175|  3.66k|			return error ;
  176|       |
  177|    966|		psf->next_chunk_iterator = wav_next_chunk_iterator ;
  178|    966|		psf->get_chunk_size = wav_get_chunk_size ;
  179|    966|		psf->get_chunk_data = wav_get_chunk_data ;
  180|    966|		} ;
  181|       |
  182|    966|	subformat = SF_CODEC (psf->sf.format) ;
  ------------------
  |  |  109|    966|#define SF_CODEC(x)			((x) & SF_FORMAT_SUBMASK)
  ------------------
  183|       |
  184|    966|	if (psf->file.mode == SFM_WRITE || psf->file.mode == SFM_RDWR)
  ------------------
  |  Branch (184:6): [True: 0, False: 966]
  |  Branch (184:37): [True: 0, False: 966]
  ------------------
  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) ;
  ------------------
  |  |  108|      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) ;
  ------------------
  |  |  110|      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 (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|    966|		} ;
  235|       |
  236|    966|	psf->container_close = wav_close ;
  237|    966|	psf->command = wav_command ;
  238|       |
  239|    966|	switch (subformat)
  240|    966|	{	case SF_FORMAT_PCM_U8 :
  ------------------
  |  Branch (240:4): [True: 6, False: 960]
  ------------------
  241|      7|		case SF_FORMAT_PCM_16 :
  ------------------
  |  Branch (241:3): [True: 1, False: 965]
  ------------------
  242|     25|		case SF_FORMAT_PCM_24 :
  ------------------
  |  Branch (242:3): [True: 18, False: 948]
  ------------------
  243|     27|		case SF_FORMAT_PCM_32 :
  ------------------
  |  Branch (243:3): [True: 2, False: 964]
  ------------------
  244|     27|					error = pcm_init (psf) ;
  245|     27|					break ;
  246|       |
  247|      3|		case SF_FORMAT_ULAW :
  ------------------
  |  Branch (247:3): [True: 3, False: 963]
  ------------------
  248|      3|					error = ulaw_init (psf) ;
  249|      3|					break ;
  250|       |
  251|      4|		case SF_FORMAT_ALAW :
  ------------------
  |  Branch (251:3): [True: 4, False: 962]
  ------------------
  252|      4|					error = alaw_init (psf) ;
  253|      4|					break ;
  254|       |
  255|       |		/* Lite remove start */
  256|     43|		case SF_FORMAT_FLOAT :
  ------------------
  |  Branch (256:3): [True: 43, False: 923]
  ------------------
  257|     43|					error = float32_init (psf) ;
  258|     43|					break ;
  259|       |
  260|      6|		case SF_FORMAT_DOUBLE :
  ------------------
  |  Branch (260:3): [True: 6, False: 960]
  ------------------
  261|      6|					error = double64_init (psf) ;
  262|      6|					break ;
  263|       |
  264|    140|		case SF_FORMAT_IMA_ADPCM :
  ------------------
  |  Branch (264:3): [True: 140, False: 826]
  ------------------
  265|    140|					error = wavlike_ima_init (psf, blockalign, framesperblock) ;
  266|    140|					break ;
  267|       |
  268|    166|		case SF_FORMAT_MS_ADPCM :
  ------------------
  |  Branch (268:3): [True: 166, False: 800]
  ------------------
  269|    166|					error = wavlike_msadpcm_init (psf, blockalign, framesperblock) ;
  270|    166|					break ;
  271|       |
  272|     23|		case SF_FORMAT_G721_32 :
  ------------------
  |  Branch (272:3): [True: 23, False: 943]
  ------------------
  273|     23|					error = g72x_init (psf) ;
  274|     23|					break ;
  275|       |
  276|    181|		case SF_FORMAT_NMS_ADPCM_16 :
  ------------------
  |  Branch (276:3): [True: 181, False: 785]
  ------------------
  277|    218|		case SF_FORMAT_NMS_ADPCM_24 :
  ------------------
  |  Branch (277:3): [True: 37, False: 929]
  ------------------
  278|    256|		case SF_FORMAT_NMS_ADPCM_32 :
  ------------------
  |  Branch (278:3): [True: 38, False: 928]
  ------------------
  279|    256|					error = nms_adpcm_init (psf) ;
  280|    256|					break ;
  281|       |
  282|       |		/* Lite remove end */
  283|       |
  284|    278|		case SF_FORMAT_GSM610 :
  ------------------
  |  Branch (284:3): [True: 278, False: 688]
  ------------------
  285|    278|					error = gsm610_init (psf) ;
  286|    278|					break ;
  287|       |
  288|      4|		case SF_FORMAT_MPEG_LAYER_III :
  ------------------
  |  Branch (288:3): [True: 4, False: 962]
  ------------------
  289|      4|					error = mpeg_init (psf, SF_BITRATE_MODE_CONSTANT, SF_FALSE) ;
  290|      4|					break ;
  291|       |
  292|     16|		default : 	return SFE_UNIMPLEMENTED ;
  ------------------
  |  Branch (292:3): [True: 16, False: 950]
  ------------------
  293|    966|		} ;
  294|       |
  295|    950|	if (psf->file.mode == SFM_WRITE || (psf->file.mode == SFM_RDWR && psf->filelength == 0))
  ------------------
  |  Branch (295:6): [True: 0, False: 950]
  |  Branch (295:38): [True: 0, False: 950]
  |  Branch (295:68): [True: 0, False: 0]
  ------------------
  296|      0|		return psf->write_header (psf, SF_FALSE) ;
  297|       |
  298|    950|	return error ;
  299|    950|} /* wav_open */
wav.c:wav_read_header:
  307|  4.63k|{	WAVLIKE_PRIVATE	*wpriv ;
  308|  4.63k|	WAV_FMT		*wav_fmt ;
  309|  4.63k|	FACT_CHUNK	fact_chunk ;
  310|  4.63k|	uint32_t	marker, chunk_size = 0, RIFFsize = 0, done = 0 ;
  311|  4.63k|	int			parsestage = 0, error, format = 0 ;
  312|       |
  313|  4.63k|	if (psf->is_pipe == 0 && psf->filelength > 0xFFFFFFFFLL)
  ------------------
  |  Branch (313:6): [True: 4.63k, False: 0]
  |  Branch (313:27): [True: 0, False: 4.63k]
  ------------------
  314|      0|		psf_log_printf (psf, "Warning : filelength > 0xffffffff. This is bad!!!!\n") ;
  315|       |
  316|  4.63k|	if ((wpriv = psf->container_data) == NULL)
  ------------------
  |  Branch (316:6): [True: 0, False: 4.63k]
  ------------------
  317|      0|		return SFE_INTERNAL ;
  318|  4.63k|	wav_fmt = &wpriv->wav_fmt ;
  319|       |
  320|       |	/* Set position to start of file to begin reading header. */
  321|  4.63k|	psf_binheader_readf (psf, "pmj", 0, &marker, -4) ;
  322|  4.63k|	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.63k|	psf->rwf_endian = (marker == RIFF_MARKER) ? SF_ENDIAN_LITTLE : SF_ENDIAN_BIG ;
  ------------------
  |  |   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 (328:20): [True: 4.40k, False: 226]
  ------------------
  329|       |
  330|  22.2k|	while (! done)
  ------------------
  |  Branch (330:9): [True: 22.2k, False: 21]
  ------------------
  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: 14, False: 22.2k]
  ------------------
  336|     14|		{	sf_count_t pos = psf_ftell (psf) ;
  337|     14|			psf_log_printf (psf, "Have 0 marker at position %D (0x%x).\n", pos, pos) ;
  338|     14|			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.41k|#define RIFF_MARKER		(MAKE_MARKER ('R', 'I', 'F', 'F'))
  |  |  ------------------
  |  |  |  |  122|  4.41k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (344:5): [True: 4.41k, False: 17.8k]
  ------------------
  345|  4.63k|			case RIFX_MARKER :
  ------------------
  |  |   39|  4.63k|#define RIFX_MARKER		(MAKE_MARKER ('R', 'I', 'F', 'X'))
  |  |  ------------------
  |  |  |  |  122|  4.63k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (345:4): [True: 227, False: 21.9k]
  ------------------
  346|  4.63k|					if (parsestage)
  ------------------
  |  Branch (346:10): [True: 4, False: 4.63k]
  ------------------
  347|      4|						return SFE_WAV_NO_RIFF ;
  348|       |
  349|  4.63k|					parsestage |= HAVE_RIFF ;
  350|       |
  351|  4.63k|					RIFFsize = chunk_size ;
  352|       |
  353|  4.63k|					if (psf->fileoffset > 0 && psf->filelength > RIFFsize + 8)
  ------------------
  |  Branch (353:10): [True: 209, False: 4.42k]
  |  Branch (353:33): [True: 163, False: 46]
  ------------------
  354|    163|					{	/* Set file length. */
  355|    163|						psf->filelength = RIFFsize + 8 ;
  356|    163|						if (marker == RIFF_MARKER)
  ------------------
  |  |   38|    163|#define RIFF_MARKER		(MAKE_MARKER ('R', 'I', 'F', 'F'))
  |  |  ------------------
  |  |  |  |  122|    163|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (356:11): [True: 155, False: 8]
  ------------------
  357|    155|							psf_log_printf (psf, "RIFF : %u\n", RIFFsize) ;
  358|      8|						else
  359|      8|							psf_log_printf (psf, "RIFX : %u\n", RIFFsize) ;
  360|    163|						}
  361|  4.47k|					else if (psf->filelength < RIFFsize + 2 * SIGNED_SIZEOF (marker))
  ------------------
  |  |   91|  4.47k|#define		SIGNED_SIZEOF(x)	((int) sizeof (x))
  ------------------
  |  Branch (361:15): [True: 4.35k, False: 116]
  ------------------
  362|  4.35k|					{	if (marker == RIFF_MARKER)
  ------------------
  |  |   38|  4.35k|#define RIFF_MARKER		(MAKE_MARKER ('R', 'I', 'F', 'F'))
  |  |  ------------------
  |  |  |  |  122|  4.35k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (362:12): [True: 4.14k, False: 207]
  ------------------
  363|  4.14k|							psf_log_printf (psf, "RIFF : %u (should be %D)\n", RIFFsize, psf->filelength - 2 * SIGNED_SIZEOF (marker)) ;
  ------------------
  |  |   91|  4.14k|#define		SIGNED_SIZEOF(x)	((int) sizeof (x))
  ------------------
  364|    207|						else
  365|    207|							psf_log_printf (psf, "RIFX : %u (should be %D)\n", RIFFsize, psf->filelength - 2 * SIGNED_SIZEOF (marker)) ;
  ------------------
  |  |   91|    207|#define		SIGNED_SIZEOF(x)	((int) sizeof (x))
  ------------------
  366|       |
  367|  4.35k|						RIFFsize = psf->filelength - 2 * SIGNED_SIZEOF (RIFFsize) ;
  ------------------
  |  |   91|  4.35k|#define		SIGNED_SIZEOF(x)	((int) sizeof (x))
  ------------------
  368|  4.35k|						}
  369|    116|					else
  370|    116|					{	if (marker == RIFF_MARKER)
  ------------------
  |  |   38|    116|#define RIFF_MARKER		(MAKE_MARKER ('R', 'I', 'F', 'F'))
  |  |  ------------------
  |  |  |  |  122|    116|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (370:12): [True: 105, False: 11]
  ------------------
  371|    105|							psf_log_printf (psf, "RIFF : %u\n", RIFFsize) ;
  372|     11|						else
  373|     11|							psf_log_printf (psf, "RIFX : %u\n", RIFFsize) ;
  374|    116|					} ;
  375|       |
  376|  4.63k|					psf_binheader_readf (psf, "m", &marker) ;
  377|  4.63k|					if (marker != WAVE_MARKER)
  ------------------
  |  |   40|  4.63k|#define WAVE_MARKER		(MAKE_MARKER ('W', 'A', 'V', 'E'))
  |  |  ------------------
  |  |  |  |  122|  4.63k|	#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.63k]
  ------------------
  378|      0|						return SFE_WAV_NO_WAVE ;
  379|  4.63k|					parsestage |= HAVE_WAVE ;
  380|  4.63k|					psf_log_printf (psf, "WAVE\n") ;
  381|  4.63k|					chunk_size = 0 ;
  382|  4.63k|					break ;
  383|       |
  384|  1.79k|			case fmt_MARKER :
  ------------------
  |  |   41|  1.79k|#define fmt_MARKER		(MAKE_MARKER ('f', 'm', 't', ' '))
  |  |  ------------------
  |  |  |  |  122|  1.79k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (384:4): [True: 1.79k, False: 20.4k]
  ------------------
  385|  1.79k|					if ((parsestage & (HAVE_RIFF | HAVE_WAVE)) != (HAVE_RIFF | HAVE_WAVE))
  ------------------
  |  Branch (385:10): [True: 0, False: 1.79k]
  ------------------
  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|  1.79k|					if (parsestage & HAVE_fmt)
  ------------------
  |  Branch (389:10): [True: 201, False: 1.59k]
  ------------------
  390|    201|						break ;
  391|       |
  392|  1.59k|					parsestage |= HAVE_fmt ;
  393|       |
  394|  1.59k|					psf_log_printf (psf, "fmt  : %d\n", chunk_size) ;
  395|       |
  396|  1.59k|					if ((error = wavlike_read_fmt_chunk (psf, chunk_size)))
  ------------------
  |  Branch (396:10): [True: 276, False: 1.32k]
  ------------------
  397|    276|						return error ;
  398|       |
  399|  1.32k|					format = wav_fmt->format ;
  400|  1.32k|					break ;
  401|       |
  402|  1.43k|			case data_MARKER :
  ------------------
  |  |   32|  1.43k|#define data_MARKER		MAKE_MARKER ('d', 'a', 't', 'a')
  |  |  ------------------
  |  |  |  |  122|  1.43k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (402:4): [True: 1.43k, False: 20.7k]
  ------------------
  403|  1.43k|					if ((parsestage & (HAVE_RIFF | HAVE_WAVE | HAVE_fmt)) != (HAVE_RIFF | HAVE_WAVE | HAVE_fmt))
  ------------------
  |  Branch (403:10): [True: 1, False: 1.43k]
  ------------------
  404|      1|						return SFE_WAV_NO_DATA ;
  405|       |
  406|  1.43k|					if (psf->file.mode == SFM_RDWR && (parsestage & HAVE_other) != 0)
  ------------------
  |  Branch (406:10): [True: 0, False: 1.43k]
  |  Branch (406:40): [True: 0, False: 0]
  ------------------
  407|      0|						return SFE_RDWR_BAD_HEADER ;
  408|       |
  409|  1.43k|					parsestage |= HAVE_data ;
  410|       |
  411|  1.43k|					psf->datalength = chunk_size ;
  412|  1.43k|					if (psf->datalength & 1)
  ------------------
  |  Branch (412:10): [True: 764, False: 669]
  ------------------
  413|    764|						psf_log_printf (psf, "*** 'data' chunk should be an even number of bytes in length.\n") ;
  414|       |
  415|  1.43k|					psf->dataoffset = psf_ftell (psf) ;
  416|       |
  417|  1.43k|					if (psf->dataoffset > 0)
  ------------------
  |  Branch (417:10): [True: 1.43k, False: 0]
  ------------------
  418|  1.43k|					{	if (chunk_size == 0 && RIFFsize == 8 && psf->filelength > 44)
  ------------------
  |  Branch (418:12): [True: 332, False: 1.10k]
  |  Branch (418:31): [True: 19, False: 313]
  |  Branch (418:48): [True: 11, False: 8]
  ------------------
  419|     11|						{	psf_log_printf (psf, "*** Looks like a WAV file which wasn't closed properly. Fixing it.\n") ;
  420|     11|							psf->datalength = psf->filelength - psf->dataoffset ;
  421|     11|							} ;
  422|       |
  423|  1.43k|						if (psf->datalength > psf->filelength - psf->dataoffset)
  ------------------
  |  Branch (423:11): [True: 889, False: 544]
  ------------------
  424|    889|						{	psf_log_printf (psf, "data : %D (should be %D)\n", psf->datalength, psf->filelength - psf->dataoffset) ;
  425|    889|							psf->datalength = psf->filelength - psf->dataoffset ;
  426|    889|							}
  427|    544|						else
  428|    544|							psf_log_printf (psf, "data : %D\n", psf->datalength) ;
  429|       |
  430|       |						/* Only set dataend if there really is data at the end. */
  431|  1.43k|						if (psf->datalength + psf->dataoffset < psf->filelength)
  ------------------
  |  Branch (431:11): [True: 477, False: 956]
  ------------------
  432|    477|							psf->dataend = psf->datalength + psf->dataoffset ;
  433|       |
  434|  1.43k|						psf->datalength += chunk_size & 1 ;
  435|  1.43k|						chunk_size = 0 ;
  436|  1.43k|						} ;
  437|       |
  438|  1.43k|					if (! psf->sf.seekable || psf->dataoffset < 0)
  ------------------
  |  Branch (438:10): [True: 0, False: 1.43k]
  |  Branch (438:32): [True: 0, False: 1.43k]
  ------------------
  439|      0|						break ;
  440|       |
  441|       |					/* Seek past data and continue reading header. */
  442|  1.43k|					psf_fseek (psf, psf->datalength, SEEK_CUR) ;
  443|       |
  444|  1.43k|					if (psf_ftell (psf) != psf->datalength + psf->dataoffset)
  ------------------
  |  Branch (444:10): [True: 539, False: 894]
  ------------------
  445|    539|						psf_log_printf (psf, "*** psf_fseek past end error ***\n") ;
  446|  1.43k|					break ;
  447|       |
  448|  1.22k|			case fact_MARKER :
  ------------------
  |  |   42|  1.22k|#define fact_MARKER		(MAKE_MARKER ('f', 'a', 'c', 't'))
  |  |  ------------------
  |  |  |  |  122|  1.22k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (448:4): [True: 1.22k, False: 20.9k]
  ------------------
  449|  1.22k|					if ((parsestage & (HAVE_RIFF | HAVE_WAVE)) != (HAVE_RIFF | HAVE_WAVE))
  ------------------
  |  Branch (449:10): [True: 0, False: 1.22k]
  ------------------
  450|      0|						return SFE_WAV_BAD_FACT ;
  451|       |
  452|  1.22k|					parsestage |= HAVE_fact ;
  453|       |
  454|  1.22k|					if ((parsestage & HAVE_fmt) != HAVE_fmt)
  ------------------
  |  Branch (454:10): [True: 712, False: 509]
  ------------------
  455|    712|						psf_log_printf (psf, "*** Should have 'fmt ' chunk before 'fact'\n") ;
  456|       |
  457|  1.22k|					psf_binheader_readf (psf, "4", & (fact_chunk.frames)) ;
  458|       |
  459|  1.22k|					if (chunk_size > SIGNED_SIZEOF (fact_chunk))
  ------------------
  |  |   91|  1.22k|#define		SIGNED_SIZEOF(x)	((int) sizeof (x))
  ------------------
  |  Branch (459:10): [True: 56, False: 1.16k]
  ------------------
  460|     56|						psf_binheader_readf (psf, "j", (int) (chunk_size - SIGNED_SIZEOF (fact_chunk))) ;
  ------------------
  |  |   91|     56|#define		SIGNED_SIZEOF(x)	((int) sizeof (x))
  ------------------
  461|       |
  462|  1.22k|					if (chunk_size)
  ------------------
  |  Branch (462:10): [True: 465, False: 756]
  ------------------
  463|    465|						psf_log_printf (psf, "%M : %u\n", marker, chunk_size) ;
  464|    756|					else
  465|    756|						psf_log_printf (psf, "%M : %u (should not be zero)\n", marker, chunk_size) ;
  466|       |
  467|  1.22k|					psf_log_printf (psf, "  frames  : %d\n", fact_chunk.frames) ;
  468|  1.22k|					break ;
  469|       |
  470|    331|			case PEAK_MARKER :
  ------------------
  |  |   40|    331|#define PEAK_MARKER		MAKE_MARKER ('P', 'E', 'A', 'K')
  |  |  ------------------
  |  |  |  |  122|    331|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (470:4): [True: 331, False: 21.8k]
  ------------------
  471|    331|					if ((parsestage & (HAVE_RIFF | HAVE_WAVE | HAVE_fmt)) != (HAVE_RIFF | HAVE_WAVE | HAVE_fmt))
  ------------------
  |  Branch (471:10): [True: 1, False: 330]
  ------------------
  472|      1|						return SFE_WAV_PEAK_B4_FMT ;
  473|       |
  474|    330|					parsestage |= HAVE_PEAK ;
  475|       |
  476|    330|					psf_log_printf (psf, "%M : %u\n", marker, chunk_size) ;
  477|    330|					if ((error = wavlike_read_peak_chunk (psf, chunk_size)) != 0)
  ------------------
  |  Branch (477:10): [True: 29, False: 301]
  ------------------
  478|     29|						return error ;
  479|    301|					psf->peak_info->peak_loc = ((parsestage & HAVE_data) == 0) ? SF_PEAK_START : SF_PEAK_END ;
  ------------------
  |  Branch (479:33): [True: 301, False: 0]
  ------------------
  480|    301|					break ;
  481|       |
  482|  1.07k|			case cue_MARKER :
  ------------------
  |  |   44|  1.07k|#define cue_MARKER		(MAKE_MARKER ('c', 'u', 'e', ' '))
  |  |  ------------------
  |  |  |  |  122|  1.07k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (482:4): [True: 1.07k, False: 21.1k]
  ------------------
  483|  1.07k|					parsestage |= HAVE_other ;
  484|       |
  485|  1.07k|					{	uint32_t thisread, bytesread, cue_count, position, offset ;
  486|  1.07k|						int id, chunk_id, chunk_start, block_start, cue_index ;
  487|       |
  488|  1.07k|						bytesread = psf_binheader_readf (psf, "4", &cue_count) ;
  489|  1.07k|						psf_log_printf (psf, "%M : %u\n", marker, chunk_size) ;
  490|       |
  491|  1.07k|						if (cue_count > 2500) /* 2500 is close to the largest number of cues possible because of block sizes */
  ------------------
  |  Branch (491:11): [True: 288, False: 788]
  ------------------
  492|    288|						{	psf_log_printf (psf, "  Count : %u (skipping)\n", cue_count) ;
  493|    288|							psf_binheader_readf (psf, "j", chunk_size - bytesread) ;
  494|    288|							break ;
  495|    788|							} ;
  496|       |
  497|    788|						psf_log_printf (psf, "  Count : %d\n", cue_count) ;
  498|       |
  499|    788|						if (psf->cues)
  ------------------
  |  Branch (499:11): [True: 591, False: 197]
  ------------------
  500|    591|						{	free (psf->cues) ;
  501|    591|							psf->cues = NULL ;
  502|    591|							} ;
  503|       |
  504|    788|						if ((psf->cues = psf_cues_alloc (cue_count)) == NULL)
  ------------------
  |  Branch (504:11): [True: 0, False: 788]
  ------------------
  505|      0|							return SFE_MALLOC_FAILED ;
  506|       |
  507|    788|						cue_index = 0 ;
  508|       |
  509|  4.85k|						while (cue_count)
  ------------------
  |  Branch (509:14): [True: 4.13k, False: 722]
  ------------------
  510|  4.13k|						{
  511|  4.13k|							if ((thisread = psf_binheader_readf (psf, "e44m444", &id, &position, &chunk_id, &chunk_start, &block_start, &offset)) == 0)
  ------------------
  |  Branch (511:12): [True: 66, False: 4.06k]
  ------------------
  512|     66|								break ;
  513|  4.06k|							bytesread += thisread ;
  514|       |
  515|  4.06k|							if (cue_index < 10) /* avoid swamping log buffer with cues */
  ------------------
  |  Branch (515:12): [True: 3.55k, False: 515]
  ------------------
  516|  3.55k|								psf_log_printf (psf,	"   Cue ID : %2d"
  517|  3.55k|											"  Pos : %5u  Chunk : %M"
  518|  3.55k|											"  Chk Start : %d  Blk Start : %d"
  519|  3.55k|											"  Offset : %5d\n",
  520|  3.55k|										id, position, chunk_id, chunk_start, block_start, offset) ;
  521|    515|							else if (cue_index == 10)
  ------------------
  |  Branch (521:17): [True: 300, False: 215]
  ------------------
  522|    300|								psf_log_printf (psf,	"   (Skipping)\n") ;
  523|       |
  524|  4.06k|							psf->cues->cue_points [cue_index].indx = id ;
  525|  4.06k|							psf->cues->cue_points [cue_index].position = position ;
  526|  4.06k|							psf->cues->cue_points [cue_index].fcc_chunk = chunk_id ;
  527|  4.06k|							psf->cues->cue_points [cue_index].chunk_start = chunk_start ;
  528|  4.06k|							psf->cues->cue_points [cue_index].block_start = block_start ;
  529|  4.06k|							psf->cues->cue_points [cue_index].sample_offset = offset ;
  530|  4.06k|							psf->cues->cue_points [cue_index].name [0] = '\0' ;
  531|  4.06k|							cue_count -- ;
  532|  4.06k|							cue_index ++ ;
  533|  4.06k|							} ;
  534|       |
  535|    788|						if (bytesread != chunk_size)
  ------------------
  |  Branch (535:11): [True: 530, False: 258]
  ------------------
  536|    530|						{	psf_log_printf (psf, "**** Chunk size weirdness (%d != %d)\n", chunk_size, bytesread) ;
  537|    530|							psf_binheader_readf (psf, "j", chunk_size - bytesread) ;
  538|    530|							} ;
  539|    788|						} ;
  540|    788|					break ;
  541|       |
  542|  1.15k|			case smpl_MARKER :
  ------------------
  |  |   48|  1.15k|#define smpl_MARKER		(MAKE_MARKER ('s', 'm', 'p', 'l'))
  |  |  ------------------
  |  |  |  |  122|  1.15k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (542:4): [True: 1.15k, False: 21.0k]
  ------------------
  543|  1.15k|					parsestage |= HAVE_other ;
  544|       |
  545|  1.15k|					psf_log_printf (psf, "smpl : %u\n", chunk_size) ;
  546|       |
  547|  1.15k|					if ((error = wav_read_smpl_chunk (psf, chunk_size)))
  ------------------
  |  Branch (547:10): [True: 0, False: 1.15k]
  ------------------
  548|      0|						return error ;
  549|  1.15k|					break ;
  550|       |
  551|  2.04k|			case acid_MARKER :
  ------------------
  |  |   52|  2.04k|#define acid_MARKER		(MAKE_MARKER ('a', 'c', 'i', 'd'))
  |  |  ------------------
  |  |  |  |  122|  2.04k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (551:4): [True: 2.04k, False: 20.1k]
  ------------------
  552|  2.04k|					parsestage |= HAVE_other ;
  553|       |
  554|  2.04k|					psf_log_printf (psf, "acid : %u\n", chunk_size) ;
  555|       |
  556|  2.04k|					if ((error = wav_read_acid_chunk (psf, chunk_size)))
  ------------------
  |  Branch (556:10): [True: 0, False: 2.04k]
  ------------------
  557|      0|						return error ;
  558|  2.04k|					break ;
  559|       |
  560|  2.04k|			case INFO_MARKER :
  ------------------
  |  |   37|  1.39k|#define INFO_MARKER		MAKE_MARKER ('I', 'N', 'F', 'O')
  |  |  ------------------
  |  |  |  |  122|  1.39k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (560:4): [True: 1.39k, False: 20.8k]
  ------------------
  561|  1.62k|			case LIST_MARKER :
  ------------------
  |  |   38|  1.62k|#define LIST_MARKER		MAKE_MARKER ('L', 'I', 'S', 'T')
  |  |  ------------------
  |  |  |  |  122|  1.62k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (561:4): [True: 225, False: 21.9k]
  ------------------
  562|  1.62k|					parsestage |= HAVE_other ;
  563|       |
  564|  1.62k|					if ((error = wavlike_subchunk_parse (psf, marker, chunk_size)) != 0)
  ------------------
  |  Branch (564:10): [True: 0, False: 1.62k]
  ------------------
  565|      0|						return error ;
  566|  1.62k|					break ;
  567|       |
  568|  1.62k|			case bext_MARKER :
  ------------------
  |  |   30|    233|#define bext_MARKER		MAKE_MARKER ('b', 'e', 'x', 't')
  |  |  ------------------
  |  |  |  |  122|    233|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (568:4): [True: 233, False: 21.9k]
  ------------------
  569|       |					/*
  570|       |					The 'bext' chunk can actually be updated, so don't need to set this.
  571|       |					parsestage |= HAVE_other ;
  572|       |					*/
  573|    233|					if ((error = wavlike_read_bext_chunk (psf, chunk_size)))
  ------------------
  |  Branch (573:10): [True: 0, False: 233]
  ------------------
  574|      0|						return error ;
  575|    233|					break ;
  576|       |
  577|    233|			case PAD_MARKER :
  ------------------
  |  |   39|    201|#define PAD_MARKER		MAKE_MARKER ('P', 'A', 'D', ' ')
  |  |  ------------------
  |  |  |  |  122|    201|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (577:4): [True: 201, False: 22.0k]
  ------------------
  578|       |					/*
  579|       |					We can eat into a 'PAD ' chunk if we need to.
  580|       |					parsestage |= HAVE_other ;
  581|       |					*/
  582|    201|					psf_log_printf (psf, "%M : %u\n", marker, chunk_size) ;
  583|    201|					psf_binheader_readf (psf, "j", chunk_size) ;
  584|    201|					break ;
  585|       |
  586|    291|			case cart_MARKER:
  ------------------
  |  |   31|    291|#define cart_MARKER		MAKE_MARKER ('c', 'a', 'r', 't')
  |  |  ------------------
  |  |  |  |  122|    291|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (586:4): [True: 291, False: 21.9k]
  ------------------
  587|    291|					if ((error = wavlike_read_cart_chunk (psf, chunk_size)))
  ------------------
  |  Branch (587:10): [True: 0, False: 291]
  ------------------
  588|      0|						return error ;
  589|    291|					break ;
  590|       |
  591|    291|			case iXML_MARKER : /* See http://en.wikipedia.org/wiki/IXML */
  ------------------
  |  |   49|     69|#define iXML_MARKER		(MAKE_MARKER ('i', 'X', 'M', 'L'))
  |  |  ------------------
  |  |  |  |  122|     69|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (591:4): [True: 69, False: 22.1k]
  ------------------
  592|    374|			case strc_MARKER : /* Multiple of 32 bytes. */
  ------------------
  |  |   53|    374|#define strc_MARKER		(MAKE_MARKER ('s', 't', 'r', 'c'))
  |  |  ------------------
  |  |  |  |  122|    374|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (592:4): [True: 305, False: 21.9k]
  ------------------
  593|    440|			case afsp_MARKER :
  ------------------
  |  |   54|    440|#define afsp_MARKER		(MAKE_MARKER ('a', 'f', 's', 'p'))
  |  |  ------------------
  |  |  |  |  122|    440|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (593:4): [True: 66, False: 22.1k]
  ------------------
  594|    642|			case clm_MARKER :
  ------------------
  |  |   55|    642|#define clm_MARKER		(MAKE_MARKER ('c', 'l', 'm', ' '))
  |  |  ------------------
  |  |  |  |  122|    642|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (594:4): [True: 202, False: 22.0k]
  ------------------
  595|    660|			case elmo_MARKER :
  ------------------
  |  |   56|    660|#define elmo_MARKER		(MAKE_MARKER ('e', 'l', 'm', 'o'))
  |  |  ------------------
  |  |  |  |  122|    660|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (595:4): [True: 18, False: 22.2k]
  ------------------
  596|    730|			case levl_MARKER :
  ------------------
  |  |   50|    730|#define levl_MARKER		(MAKE_MARKER ('l', 'e', 'v', 'l'))
  |  |  ------------------
  |  |  |  |  122|    730|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (596:4): [True: 70, False: 22.1k]
  ------------------
  597|    929|			case plst_MARKER :
  ------------------
  |  |   47|    929|#define plst_MARKER		(MAKE_MARKER ('p', 'l', 's', 't'))
  |  |  ------------------
  |  |  |  |  122|    929|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (597:4): [True: 199, False: 22.0k]
  ------------------
  598|  1.12k|			case minf_MARKER :
  ------------------
  |  |   59|  1.12k|#define minf_MARKER		(MAKE_MARKER ('m', 'i', 'n', 'f'))
  |  |  ------------------
  |  |  |  |  122|  1.12k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (598:4): [True: 196, False: 22.0k]
  ------------------
  599|  1.19k|			case elm1_MARKER :
  ------------------
  |  |   60|  1.19k|#define elm1_MARKER		(MAKE_MARKER ('e', 'l', 'm', '1'))
  |  |  ------------------
  |  |  |  |  122|  1.19k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (599:4): [True: 71, False: 22.1k]
  ------------------
  600|  1.26k|			case regn_MARKER :
  ------------------
  |  |   61|  1.26k|#define regn_MARKER		(MAKE_MARKER ('r', 'e', 'g', 'n'))
  |  |  ------------------
  |  |  |  |  122|  1.26k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (600:4): [True: 71, False: 22.1k]
  ------------------
  601|  1.33k|			case ovwf_MARKER :
  ------------------
  |  |   62|  1.33k|#define ovwf_MARKER		(MAKE_MARKER ('o', 'v', 'w', 'f'))
  |  |  ------------------
  |  |  |  |  122|  1.33k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (601:4): [True: 66, False: 22.1k]
  ------------------
  602|  1.52k|			case inst_MARKER :
  ------------------
  |  |   68|  1.52k|#define inst_MARKER		(MAKE_MARKER ('i', 'n', 's', 't'))
  |  |  ------------------
  |  |  |  |  122|  1.52k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (602:4): [True: 196, False: 22.0k]
  ------------------
  603|  1.59k|			case AFAn_MARKER :
  ------------------
  |  |   69|  1.59k|#define AFAn_MARKER		(MAKE_MARKER ('A', 'F', 'A', 'n'))
  |  |  ------------------
  |  |  |  |  122|  1.59k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (603:4): [True: 66, False: 22.1k]
  ------------------
  604|  1.79k|			case umid_MARKER :
  ------------------
  |  |   63|  1.79k|#define umid_MARKER		(MAKE_MARKER ('u', 'm', 'i', 'd'))
  |  |  ------------------
  |  |  |  |  122|  1.79k|	#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.99k|			case SyLp_MARKER :
  ------------------
  |  |   64|  1.99k|#define SyLp_MARKER		(MAKE_MARKER ('S', 'y', 'L', 'p'))
  |  |  ------------------
  |  |  |  |  122|  1.99k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (605:4): [True: 208, False: 22.0k]
  ------------------
  606|  2.06k|			case Cr8r_MARKER :
  ------------------
  |  |   65|  2.06k|#define Cr8r_MARKER		(MAKE_MARKER ('C', 'r', '8', 'r'))
  |  |  ------------------
  |  |  |  |  122|  2.06k|	#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.13k|			case JUNK_MARKER :
  ------------------
  |  |   66|  2.13k|#define JUNK_MARKER		(MAKE_MARKER ('J', 'U', 'N', 'K'))
  |  |  ------------------
  |  |  |  |  122|  2.13k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (607:4): [True: 68, False: 22.1k]
  ------------------
  608|  2.21k|			case PMX_MARKER :
  ------------------
  |  |   67|  2.21k|#define PMX_MARKER		(MAKE_MARKER ('_', 'P', 'M', 'X'))
  |  |  ------------------
  |  |  |  |  122|  2.21k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (608:4): [True: 80, False: 22.1k]
  ------------------
  609|  2.30k|			case DISP_MARKER :
  ------------------
  |  |   36|  2.30k|#define DISP_MARKER		MAKE_MARKER ('D', 'I', 'S', 'P')
  |  |  ------------------
  |  |  |  |  122|  2.30k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (609:4): [True: 95, False: 22.1k]
  ------------------
  610|  2.79k|			case MEXT_MARKER :
  ------------------
  |  |   51|  2.79k|#define MEXT_MARKER		(MAKE_MARKER ('M', 'E', 'X', 'T'))
  |  |  ------------------
  |  |  |  |  122|  2.79k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (610:4): [True: 485, False: 21.7k]
  ------------------
  611|  2.86k|			case FLLR_MARKER :
  ------------------
  |  |   57|  2.86k|#define FLLR_MARKER		(MAKE_MARKER ('F', 'L', 'L', 'R'))
  |  |  ------------------
  |  |  |  |  122|  2.86k|	#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.86k|					psf_log_printf (psf, "%M : %u\n", marker, chunk_size) ;
  613|  2.86k|					psf_binheader_readf (psf, "j", chunk_size) ;
  614|  2.86k|					break ;
  615|       |
  616|  3.29k|			default :
  ------------------
  |  Branch (616:4): [True: 3.29k, False: 18.9k]
  ------------------
  617|  3.29k|					if (chunk_size >= 0xffff0000)
  ------------------
  |  Branch (617:10): [True: 21, False: 3.27k]
  ------------------
  618|     21|					{	done = SF_TRUE ;
  619|     21|						psf_log_printf (psf, "*** Unknown chunk marker (%X) at position %D with length %u. Exiting parser.\n", marker, psf_ftell (psf) - 8, chunk_size) ;
  620|     21|						break ;
  621|  3.27k|						} ;
  622|       |
  623|  3.27k|					if ((marker & TAG__MARKER_MASK) == TAG__MARKER &&
  ------------------
  |  |   78|  3.27k|#define TAG__MARKER_MASK (MAKE_MARKER (0xff, 0xff, 0xff, 0))
  |  |  ------------------
  |  |  |  |  122|  3.27k|	#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|  6.55k|#define TAG__MARKER (MAKE_MARKER ('T', 'A', 'G', 0))
  |  |  ------------------
  |  |  |  |  122|  3.27k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (623:10): [True: 78, False: 3.20k]
  ------------------
  624|     78|						psf_ftell (psf) - 8 + 128 == psf->filelength)
  ------------------
  |  Branch (624:7): [True: 1, False: 77]
  ------------------
  625|      1|					{	psf_log_printf (psf, "*** Hit ID3v1 trailer. Exiting parser.\n") ;
  626|      1|						chunk_size = 128 ;
  627|      1|						done = SF_TRUE ;
  628|      1|						parsestage |= HAVE_other ;
  629|      1|						break ;
  630|  3.27k|						} ;
  631|       |
  632|  3.27k|					if (psf_isprint ((marker >> 24) & 0xFF) && psf_isprint ((marker >> 16) & 0xFF)
  ------------------
  |  Branch (632:10): [True: 2.92k, False: 354]
  |  Branch (632:49): [True: 2.39k, False: 531]
  ------------------
  633|  2.39k|						&& psf_isprint ((marker >> 8) & 0xFF) && psf_isprint (marker & 0xFF))
  ------------------
  |  Branch (633:10): [True: 1.76k, False: 625]
  |  Branch (633:48): [True: 1.40k, False: 362]
  ------------------
  634|  1.40k|					{	psf_log_printf (psf, "*** %M : %u (unknown marker)\n", marker, chunk_size) ;
  635|  1.40k|						psf_binheader_readf (psf, "j", chunk_size) ;
  636|  1.40k|						break ;
  637|  1.87k|						} ;
  638|  1.87k|					if (psf_ftell (psf) & 0x03)
  ------------------
  |  Branch (638:10): [True: 1.61k, False: 261]
  ------------------
  639|  1.61k|					{	psf_log_printf (psf, "  Unknown chunk marker at position %D. Resynching.\n", psf_ftell (psf) - 8) ;
  640|  1.61k|						psf_binheader_readf (psf, "j", -3) ;
  641|       |						/* File is too messed up so we prevent editing in RDWR mode here. */
  642|  1.61k|						parsestage |= HAVE_other ;
  643|  1.61k|						break ;
  644|  1.61k|						} ;
  645|    261|					psf_log_printf (psf, "*** Unknown chunk marker (%X) at position %D. Exiting parser.\n", marker, psf_ftell (psf) - 8) ;
  646|    261|					done = SF_TRUE ;
  647|    261|					break ;
  648|  22.2k|			} ;	/* switch (marker) */
  649|       |
  650|  21.9k|		if (chunk_size >= psf->filelength)
  ------------------
  |  Branch (650:7): [True: 2.10k, False: 19.8k]
  ------------------
  651|  2.10k|		{	psf_log_printf (psf, "*** Chunk size %u > file length %D. Exiting parser.\n", chunk_size, psf->filelength) ;
  652|  2.10k|			break ;
  653|  19.8k|			} ;
  654|       |
  655|  19.8k|		if (! psf->sf.seekable && (parsestage & HAVE_data))
  ------------------
  |  Branch (655:7): [True: 0, False: 19.8k]
  |  Branch (655:29): [True: 0, False: 0]
  ------------------
  656|      0|			break ;
  657|       |
  658|  19.8k|		if (psf_ftell (psf) >= psf->filelength - SIGNED_SIZEOF (chunk_size))
  ------------------
  |  |   91|  19.8k|#define		SIGNED_SIZEOF(x)	((int) sizeof (x))
  ------------------
  |  Branch (658:7): [True: 2.18k, False: 17.6k]
  ------------------
  659|  2.18k|		{	psf_log_printf (psf, "End\n") ;
  660|  2.18k|			break ;
  661|  17.6k|			} ;
  662|  17.6k|		} ; /* while (1) */
  663|       |
  664|  4.32k|	if (psf->dataoffset <= 0)
  ------------------
  |  Branch (664:6): [True: 3.32k, False: 994]
  ------------------
  665|  3.32k|		return SFE_WAV_NO_DATA ;
  666|       |
  667|    994|	if (psf->sf.channels < 1)
  ------------------
  |  Branch (667:6): [True: 2, False: 992]
  ------------------
  668|      2|		return SFE_CHANNEL_COUNT_ZERO ;
  669|       |
  670|    992|	if (psf->sf.channels > SF_MAX_CHANNELS)
  ------------------
  |  |  102|    992|#define		SF_MAX_CHANNELS		1024
  ------------------
  |  Branch (670:6): [True: 23, False: 969]
  ------------------
  671|     23|		return SFE_CHANNEL_COUNT ;
  672|       |
  673|    969|	if (format != WAVE_FORMAT_PCM && (parsestage & HAVE_fact) == 0)
  ------------------
  |  Branch (673:6): [True: 924, False: 45]
  |  Branch (673:35): [True: 920, False: 4]
  ------------------
  674|    920|		psf_log_printf (psf, "**** All non-PCM format files should have a 'fact' chunk.\n") ;
  675|       |
  676|       |	/* WAVs can be little or big endian */
  677|    969|	psf->endian = psf->rwf_endian ;
  678|       |
  679|    969|	psf_fseek (psf, psf->dataoffset, SEEK_SET) ;
  680|       |
  681|    969|	if (psf->is_pipe == 0)
  ------------------
  |  Branch (681:6): [True: 969, False: 0]
  ------------------
  682|    969|	{	/*
  683|       |		** Check for 'wvpk' at the start of the DATA section. Not able to
  684|       |		** handle this.
  685|       |		*/
  686|    969|		psf_binheader_readf (psf, "4", &marker) ;
  687|    969|		if (marker == wvpk_MARKER || marker == OggS_MARKER)
  ------------------
  |  |   73|  1.93k|#define wvpk_MARKER (MAKE_MARKER ('w', 'v', 'p', 'k'))
  |  |  ------------------
  |  |  |  |  122|    969|	#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|    968|#define OggS_MARKER (MAKE_MARKER ('O', 'g', 'g', 'S'))
  |  |  ------------------
  |  |  |  |  122|    968|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (687:7): [True: 1, False: 968]
  |  Branch (687:32): [True: 1, False: 967]
  ------------------
  688|      2|			return SFE_WAV_WVPK_DATA ;
  689|    969|		} ;
  690|       |
  691|       |	/* Seek to start of DATA section. */
  692|    967|	psf_fseek (psf, psf->dataoffset, SEEK_SET) ;
  693|       |
  694|    967|	if (psf->blockwidth)
  ------------------
  |  Branch (694:6): [True: 81, False: 886]
  ------------------
  695|     81|	{	if (psf->filelength - psf->dataoffset < psf->datalength)
  ------------------
  |  Branch (695:8): [True: 21, False: 60]
  ------------------
  696|     21|			psf->sf.frames = (psf->filelength - psf->dataoffset) / psf->blockwidth ;
  697|     60|		else
  698|     60|			psf->sf.frames = psf->datalength / psf->blockwidth ;
  699|     81|		} ;
  700|       |
  701|    967|	switch (format)
  702|    967|	{	case WAVE_FORMAT_EXTENSIBLE :
  ------------------
  |  Branch (702:4): [True: 4, False: 963]
  ------------------
  703|      4|			if (psf->sf.format == (SF_FORMAT_WAVEX | SF_FORMAT_MS_ADPCM))
  ------------------
  |  Branch (703:8): [True: 2, False: 2]
  ------------------
  704|      2|			{	*blockalign = wav_fmt->msadpcm.blockalign ;
  705|      2|				*framesperblock = wav_fmt->msadpcm.samplesperblock ;
  706|      2|				} ;
  707|      4|			break ;
  708|       |
  709|    257|		case WAVE_FORMAT_NMS_VBXADPCM :
  ------------------
  |  Branch (709:3): [True: 257, False: 710]
  ------------------
  710|    257|			switch (wav_fmt->min.bitwidth)
  711|    257|			{	case 2 :
  ------------------
  |  Branch (711:6): [True: 181, False: 76]
  ------------------
  712|    181|					psf->sf.format = SF_FORMAT_WAV | SF_FORMAT_NMS_ADPCM_16 ;
  713|    181|					break ;
  714|     37|				case 3 :
  ------------------
  |  Branch (714:5): [True: 37, False: 220]
  ------------------
  715|     37|					psf->sf.format = SF_FORMAT_WAV | SF_FORMAT_NMS_ADPCM_24 ;
  716|     37|					break ;
  717|     38|				case 4 :
  ------------------
  |  Branch (717:5): [True: 38, False: 219]
  ------------------
  718|     38|					psf->sf.format = SF_FORMAT_WAV | SF_FORMAT_NMS_ADPCM_32 ;
  719|     38|					break ;
  720|       |
  721|      1|				default :
  ------------------
  |  Branch (721:5): [True: 1, False: 256]
  ------------------
  722|      1|					return SFE_UNIMPLEMENTED ;
  723|    257|				}
  724|    256|				break ;
  725|       |
  726|    256|		case WAVE_FORMAT_PCM :
  ------------------
  |  Branch (726:3): [True: 43, False: 924]
  ------------------
  727|     43|					psf->sf.format = SF_FORMAT_WAV | u_bitwidth_to_subformat (psf->bytewidth * 8) ;
  728|     43|					break ;
  729|       |
  730|      3|		case WAVE_FORMAT_MULAW :
  ------------------
  |  Branch (730:3): [True: 3, False: 964]
  ------------------
  731|      3|		case IBM_FORMAT_MULAW :
  ------------------
  |  Branch (731:3): [True: 0, False: 967]
  ------------------
  732|      3|					psf->sf.format = (SF_FORMAT_WAV | SF_FORMAT_ULAW) ;
  733|      3|					break ;
  734|       |
  735|      4|		case WAVE_FORMAT_ALAW :
  ------------------
  |  Branch (735:3): [True: 4, False: 963]
  ------------------
  736|      4|		case IBM_FORMAT_ALAW :
  ------------------
  |  Branch (736:3): [True: 0, False: 967]
  ------------------
  737|      4|					psf->sf.format = (SF_FORMAT_WAV | SF_FORMAT_ALAW) ;
  738|      4|					break ;
  739|       |
  740|    164|		case WAVE_FORMAT_MS_ADPCM :
  ------------------
  |  Branch (740:3): [True: 164, False: 803]
  ------------------
  741|    164|					psf->sf.format = (SF_FORMAT_WAV | SF_FORMAT_MS_ADPCM) ;
  742|    164|					*blockalign = wav_fmt->msadpcm.blockalign ;
  743|    164|					*framesperblock = wav_fmt->msadpcm.samplesperblock ;
  744|    164|					break ;
  745|       |
  746|    140|		case WAVE_FORMAT_IMA_ADPCM :
  ------------------
  |  Branch (746:3): [True: 140, False: 827]
  ------------------
  747|    140|					psf->sf.format = (SF_FORMAT_WAV | SF_FORMAT_IMA_ADPCM) ;
  748|    140|					*blockalign = wav_fmt->ima.blockalign ;
  749|    140|					*framesperblock = wav_fmt->ima.samplesperblock ;
  750|    140|					break ;
  751|       |
  752|    278|		case WAVE_FORMAT_GSM610 :
  ------------------
  |  Branch (752:3): [True: 278, False: 689]
  ------------------
  753|    278|					psf->sf.format = (SF_FORMAT_WAV | SF_FORMAT_GSM610) ;
  754|    278|					break ;
  755|       |
  756|     47|		case WAVE_FORMAT_IEEE_FLOAT :
  ------------------
  |  Branch (756:3): [True: 47, False: 920]
  ------------------
  757|     47|					psf->sf.format = SF_FORMAT_WAV ;
  758|     47|					psf->sf.format |= (psf->bytewidth == 8) ? SF_FORMAT_DOUBLE : SF_FORMAT_FLOAT ;
  ------------------
  |  Branch (758:24): [True: 6, False: 41]
  ------------------
  759|     47|					break ;
  760|       |
  761|     23|		case WAVE_FORMAT_G721_ADPCM :
  ------------------
  |  Branch (761:3): [True: 23, False: 944]
  ------------------
  762|     23|					psf->sf.format = SF_FORMAT_WAV | SF_FORMAT_G721_32 ;
  763|     23|					break ;
  764|       |
  765|      4|		case WAVE_FORMAT_MPEGLAYER3 :
  ------------------
  |  Branch (765:3): [True: 4, False: 963]
  ------------------
  766|      4|					psf->sf.format = SF_FORMAT_WAV | SF_FORMAT_MPEG_LAYER_III ;
  767|      4|					if (parsestage & HAVE_fact)
  ------------------
  |  Branch (767:10): [True: 3, False: 1]
  ------------------
  768|      3|						psf->sf.frames = fact_chunk.frames ;
  769|      4|					break ;
  770|       |
  771|      0|		default : return SFE_UNIMPLEMENTED ;
  ------------------
  |  Branch (771:3): [True: 0, False: 967]
  ------------------
  772|    967|		} ;
  773|       |
  774|    966|	if (wpriv->fmt_is_broken)
  ------------------
  |  Branch (774:6): [True: 14, False: 952]
  ------------------
  775|     14|		wavlike_analyze (psf) ;
  776|       |
  777|       |	/* Only set the format endian-ness if its non-standard big-endian. */
  778|    966|	if (psf->endian == SF_ENDIAN_BIG)
  ------------------
  |  Branch (778:6): [True: 0, False: 966]
  ------------------
  779|      0|		psf->sf.format |= SF_ENDIAN_BIG ;
  780|       |
  781|    966|	return 0 ;
  782|    967|} /* wav_read_header */
wav.c:wav_read_smpl_chunk:
 1377|  1.15k|{	char buffer [512] ;
 1378|  1.15k|	uint32_t thisread, bytesread = 0, dword, sampler_data, loop_count, actually_loop_count = 0 ;
 1379|  1.15k|	uint32_t note, pitch, start, end, type = -1, count ;
 1380|  1.15k|	int j, k ;
 1381|       |
 1382|  1.15k|	chunklen += (chunklen & 1) ;
 1383|       |
 1384|  1.15k|	bytesread += psf_binheader_readf (psf, "4", &dword) ;
 1385|  1.15k|	psf_log_printf (psf, "  Manufacturer : %X\n", dword) ;
 1386|       |
 1387|  1.15k|	bytesread += psf_binheader_readf (psf, "4", &dword) ;
 1388|  1.15k|	psf_log_printf (psf, "  Product      : %u\n", dword) ;
 1389|       |
 1390|  1.15k|	bytesread += psf_binheader_readf (psf, "4", &dword) ;
 1391|  1.15k|	psf_log_printf (psf, "  Period       : %u nsec\n", dword) ;
 1392|       |
 1393|  1.15k|	bytesread += psf_binheader_readf (psf, "4", &note) ;
 1394|  1.15k|	psf_log_printf (psf, "  Midi Note    : %u\n", note) ;
 1395|       |
 1396|  1.15k|	bytesread += psf_binheader_readf (psf, "4", &pitch) ;
 1397|  1.15k|	if (pitch != 0)
  ------------------
  |  Branch (1397:6): [True: 814, False: 345]
  ------------------
 1398|    814|	{	snprintf (buffer, sizeof (buffer), "%f",
 1399|    814|					(1.0 * 0x80000000) / ((uint32_t) pitch)) ;
 1400|    814|		psf_log_printf (psf, "  Pitch Fract. : %s\n", buffer) ;
 1401|    814|		}
 1402|    345|	else
 1403|    345|		psf_log_printf (psf, "  Pitch Fract. : 0\n") ;
 1404|       |
 1405|  1.15k|	bytesread += psf_binheader_readf (psf, "4", &dword) ;
 1406|  1.15k|	psf_log_printf (psf, "  SMPTE Format : %u\n", dword) ;
 1407|       |
 1408|  1.15k|	bytesread += psf_binheader_readf (psf, "4", &dword) ;
 1409|  1.15k|	snprintf (buffer, sizeof (buffer), "%02"PRIu32 ":%02"PRIu32 ":%02"PRIu32
 1410|  1.15k|				" %02"PRIu32 "", (dword >> 24) & 0x7F, (dword >> 16) & 0x7F,
 1411|  1.15k|				(dword >> 8) & 0x7F, dword & 0x7F) ;
 1412|  1.15k|	psf_log_printf (psf, "  SMPTE Offset : %s\n", buffer) ;
 1413|       |
 1414|  1.15k|	bytesread += psf_binheader_readf (psf, "4", &loop_count) ;
 1415|  1.15k|	psf_log_printf (psf, "  Loop Count   : %u\n", loop_count) ;
 1416|       |
 1417|  1.15k|	if (loop_count == 0 && chunklen == bytesread)
  ------------------
  |  Branch (1417:6): [True: 396, False: 763]
  |  Branch (1417:25): [True: 90, False: 306]
  ------------------
 1418|     90|		return 0 ;
 1419|       |
 1420|       |	/* Sampler Data holds the number of data bytes after the CUE chunks which
 1421|       |	** is not actually CUE data. Display value after CUE data.
 1422|       |	*/
 1423|  1.06k|	bytesread += psf_binheader_readf (psf, "4", &sampler_data) ;
 1424|       |
 1425|  1.06k|	if (psf->instrument)
  ------------------
  |  Branch (1425:6): [True: 772, False: 297]
  ------------------
 1426|    772|	{	psf_log_printf (psf, "  Found more than one SMPL chunk, using last one.\n") ;
 1427|    772|		free (psf->instrument) ;
 1428|    772|		psf->instrument = NULL ;
 1429|    772|		} ;
 1430|  1.06k|	if ((psf->instrument = psf_instrument_alloc ()) == NULL)
  ------------------
  |  Branch (1430:6): [True: 0, False: 1.06k]
  ------------------
 1431|      0|		return SFE_MALLOC_FAILED ;
 1432|       |
 1433|  1.06k|	psf->instrument->loop_count = loop_count ;
 1434|       |
 1435|  6.25k|	for (j = 0 ; loop_count > 0 && chunklen - bytesread >= 24 ; j ++)
  ------------------
  |  Branch (1435:15): [True: 5.95k, False: 306]
  |  Branch (1435:33): [True: 5.28k, False: 665]
  ------------------
 1436|  5.28k|	{	if ((thisread = psf_binheader_readf (psf, "4", &dword)) == 0)
  ------------------
  |  Branch (1436:8): [True: 98, False: 5.18k]
  ------------------
 1437|     98|			break ;
 1438|  5.18k|		bytesread += thisread ;
 1439|  5.18k|		psf_log_printf (psf, "    Cue ID : %2u", dword) ;
 1440|       |
 1441|  5.18k|		bytesread += psf_binheader_readf (psf, "4", &type) ;
 1442|  5.18k|		psf_log_printf (psf, "  Type : %2u", type) ;
 1443|       |
 1444|  5.18k|		bytesread += psf_binheader_readf (psf, "4", &start) ;
 1445|  5.18k|		psf_log_printf (psf, "  Start : %5u", start) ;
 1446|       |
 1447|  5.18k|		bytesread += psf_binheader_readf (psf, "4", &end) ;
 1448|  5.18k|		psf_log_printf (psf, "  End : %5u", end) ;
 1449|       |
 1450|  5.18k|		bytesread += psf_binheader_readf (psf, "4", &dword) ;
 1451|  5.18k|		psf_log_printf (psf, "  Fraction : %5u", dword) ;
 1452|       |
 1453|  5.18k|		bytesread += psf_binheader_readf (psf, "4", &count) ;
 1454|  5.18k|		psf_log_printf (psf, "  Count : %5u\n", count) ;
 1455|       |
 1456|  5.18k|		if (j < ARRAY_LEN (psf->instrument->loops))
  ------------------
  |  |   93|  5.18k|#define		ARRAY_LEN(x)	((int) (sizeof (x) / sizeof ((x) [0])))
  ------------------
  |  Branch (1456:7): [True: 2.05k, False: 3.13k]
  ------------------
 1457|  2.05k|		{	psf->instrument->loops [j].start = start ;
 1458|  2.05k|			psf->instrument->loops [j].end = end + 1 ;
 1459|  2.05k|			psf->instrument->loops [j].count = count ;
 1460|       |
 1461|  2.05k|			switch (type)
 1462|  2.05k|			{	case 0 :
  ------------------
  |  Branch (1462:6): [True: 721, False: 1.33k]
  ------------------
 1463|    721|					psf->instrument->loops [j].mode = SF_LOOP_FORWARD ;
 1464|    721|					break ;
 1465|    104|				case 1 :
  ------------------
  |  Branch (1465:5): [True: 104, False: 1.95k]
  ------------------
 1466|    104|					psf->instrument->loops [j].mode = SF_LOOP_ALTERNATING ;
 1467|    104|					break ;
 1468|     17|				case 2 :
  ------------------
  |  Branch (1468:5): [True: 17, False: 2.03k]
  ------------------
 1469|     17|					psf->instrument->loops [j].mode = SF_LOOP_BACKWARD ;
 1470|     17|					break ;
 1471|  1.21k|				default:
  ------------------
  |  Branch (1471:5): [True: 1.21k, False: 842]
  ------------------
 1472|  1.21k|					psf->instrument->loops [j].mode = SF_LOOP_NONE ;
 1473|  1.21k|					break ;
 1474|  2.05k|				} ;
 1475|  5.18k|			} ;
 1476|  5.18k|		actually_loop_count ++ ;
 1477|  5.18k|		} ;
 1478|       |
 1479|  1.06k|	if (actually_loop_count > ARRAY_LEN (psf->instrument->loops))
  ------------------
  |  |   93|  1.06k|#define		ARRAY_LEN(x)	((int) (sizeof (x) / sizeof ((x) [0])))
  ------------------
  |  Branch (1479:6): [True: 117, False: 952]
  ------------------
 1480|    117|	{
 1481|    117|		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)) ;
  ------------------
  |  |   93|    117|#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)) ;
  ------------------
  |  |   93|    117|#define		ARRAY_LEN(x)	((int) (sizeof (x) / sizeof ((x) [0])))
  ------------------
 1482|    117|		psf->instrument->loop_count = ARRAY_LEN (psf->instrument->loops) ;
  ------------------
  |  |   93|    117|#define		ARRAY_LEN(x)	((int) (sizeof (x) / sizeof ((x) [0])))
  ------------------
 1483|    117|		}
 1484|    952|	else if (loop_count != actually_loop_count)
  ------------------
  |  Branch (1484:11): [True: 646, False: 306]
  ------------------
 1485|    646|	{	psf_log_printf (psf, "*** Warning, actual Loop Points count != Loop Count, changing Loop Count from %u to %u\n", loop_count, actually_loop_count) ;
 1486|    646|		psf->instrument->loop_count = actually_loop_count ;
 1487|    646|		} ;
 1488|       |
 1489|  1.06k|	if (chunklen - bytesread == 0)
  ------------------
  |  Branch (1489:6): [True: 387, False: 682]
  ------------------
 1490|    387|	{	if (sampler_data != 0)
  ------------------
  |  Branch (1490:8): [True: 254, False: 133]
  ------------------
 1491|    254|			psf_log_printf (psf, "  Sampler Data : %u (should be 0)\n", sampler_data) ;
 1492|    133|		else
 1493|    133|			psf_log_printf (psf, "  Sampler Data : %u\n", sampler_data) ;
 1494|    387|		}
 1495|    682|	else
 1496|    682|	{	if (sampler_data != chunklen - bytesread)
  ------------------
  |  Branch (1496:8): [True: 600, False: 82]
  ------------------
 1497|    600|		{	psf_log_printf (psf, "  Sampler Data : %u (should have been %u)\n", sampler_data, chunklen - bytesread) ;
 1498|    600|			sampler_data = chunklen - bytesread ;
 1499|    600|			}
 1500|     82|		else
 1501|     82|			psf_log_printf (psf, "  Sampler Data : %u\n", sampler_data) ;
 1502|       |
 1503|    682|		psf_log_printf (psf, "      ") ;
 1504|  7.39k|		for (k = 0 ; k < (int) sampler_data ; k++)
  ------------------
  |  Branch (1504:16): [True: 6.84k, False: 545]
  ------------------
 1505|  6.84k|		{	char ch ;
 1506|       |
 1507|  6.84k|			if (k > 0 && (k % 20) == 0)
  ------------------
  |  Branch (1507:8): [True: 6.38k, False: 459]
  |  Branch (1507:17): [True: 222, False: 6.16k]
  ------------------
 1508|    222|				psf_log_printf (psf, "\n      ") ;
 1509|       |
 1510|  6.84k|			if ((thisread = psf_binheader_readf (psf, "1", &ch)) == 0)
  ------------------
  |  Branch (1510:8): [True: 137, False: 6.70k]
  ------------------
 1511|    137|				break ;
 1512|  6.70k|			bytesread += thisread ;
 1513|  6.70k|			psf_log_printf (psf, "%02X ", ch & 0xFF) ;
 1514|  6.70k|			} ;
 1515|       |
 1516|    682|		psf_log_printf (psf, "\n") ;
 1517|    682|		} ;
 1518|       |
 1519|  1.06k|	psf->instrument->basenote = note ;
 1520|  1.06k|	psf->instrument->detune = (int8_t) (pitch / (0x40000000 / 25.0) + 0.5) ;
 1521|  1.06k|	psf->instrument->gain = 1 ;
 1522|  1.06k|	psf->instrument->velocity_lo = psf->instrument->key_lo = 0 ;
 1523|  1.06k|	psf->instrument->velocity_hi = psf->instrument->key_hi = 127 ;
 1524|       |
 1525|  1.06k|	return 0 ;
 1526|  1.06k|} /* wav_read_smpl_chunk */
wav.c:wav_read_acid_chunk:
 1561|  2.04k|{	char buffer [512] ;
 1562|  2.04k|	uint32_t bytesread = 0 ;
 1563|  2.04k|	int	beats, flags ;
 1564|  2.04k|	short rootnote, q1, meter_denom, meter_numer ;
 1565|  2.04k|	float q2, tempo ;
 1566|       |
 1567|  2.04k|	chunklen += (chunklen & 1) ;
 1568|       |
 1569|  2.04k|	bytesread += psf_binheader_readf (psf, "422f", &flags, &rootnote, &q1, &q2) ;
 1570|       |
 1571|  2.04k|	snprintf (buffer, sizeof (buffer), "%f", q2) ;
 1572|       |
 1573|  2.04k|	psf_log_printf (psf, "  Flags     : 0x%04x (%s,%s,%s,%s,%s)\n", flags,
 1574|  2.04k|			(flags & 0x01) ? "OneShot" : "Loop",
  ------------------
  |  Branch (1574:4): [True: 1.85k, False: 189]
  ------------------
 1575|  2.04k|			(flags & 0x02) ? "RootNoteValid" : "RootNoteInvalid",
  ------------------
  |  Branch (1575:4): [True: 369, False: 1.67k]
  ------------------
 1576|  2.04k|			(flags & 0x04) ? "StretchOn" : "StretchOff",
  ------------------
  |  Branch (1576:4): [True: 366, False: 1.68k]
  ------------------
 1577|  2.04k|			(flags & 0x08) ? "DiskBased" : "RAMBased",
  ------------------
  |  Branch (1577:4): [True: 198, False: 1.85k]
  ------------------
 1578|  2.04k|			(flags & 0x10) ? "??On" : "??Off") ;
  ------------------
  |  Branch (1578:4): [True: 204, False: 1.84k]
  ------------------
 1579|       |
 1580|  2.04k|	psf_log_printf (psf, "  Root note : 0x%x\n  ????      : 0x%04x\n  ????      : %s\n",
 1581|  2.04k|				rootnote, q1, buffer) ;
 1582|       |
 1583|  2.04k|	bytesread += psf_binheader_readf (psf, "422f", &beats, &meter_denom, &meter_numer, &tempo) ;
 1584|  2.04k|	snprintf (buffer, sizeof (buffer), "%f", tempo) ;
 1585|  2.04k|	psf_log_printf (psf, "  Beats     : %d\n  Meter     : %d/%d\n  Tempo     : %s\n",
 1586|  2.04k|				beats, meter_numer, meter_denom, buffer) ;
 1587|       |
 1588|  2.04k|	psf_binheader_readf (psf, "j", chunklen - bytesread) ;
 1589|       |
 1590|  2.04k|	if (psf->loop_info)
  ------------------
  |  Branch (1590:6): [True: 1.98k, False: 67]
  ------------------
 1591|  1.98k|	{	psf_log_printf (psf, "  Found existing loop info, using last one.\n") ;
 1592|  1.98k|		free (psf->loop_info) ;
 1593|  1.98k|		psf->loop_info = NULL ;
 1594|  1.98k|		} ;
 1595|  2.04k|	if ((psf->loop_info = calloc (1, sizeof (SF_LOOP_INFO))) == NULL)
  ------------------
  |  Branch (1595:6): [True: 0, False: 2.04k]
  ------------------
 1596|      0|		return SFE_MALLOC_FAILED ;
 1597|       |
 1598|  2.04k|	psf->loop_info->time_sig_num	= meter_numer ;
 1599|  2.04k|	psf->loop_info->time_sig_den	= meter_denom ;
 1600|  2.04k|	psf->loop_info->loop_mode		= (flags & 0x01) ? SF_LOOP_NONE : SF_LOOP_FORWARD ;
  ------------------
  |  Branch (1600:31): [True: 1.85k, False: 189]
  ------------------
 1601|  2.04k|	psf->loop_info->num_beats		= beats ;
 1602|  2.04k|	psf->loop_info->bpm				= tempo ;
 1603|  2.04k|	psf->loop_info->root_key		= (flags & 0x02) ? rootnote : -1 ;
  ------------------
  |  Branch (1603:30): [True: 369, False: 1.67k]
  ------------------
 1604|       |
 1605|  2.04k|	return 0 ;
 1606|  2.04k|} /* wav_read_acid_chunk */
wav.c:wav_close:
 1318|    966|{
 1319|    966|	if (psf->file.mode == SFM_WRITE || psf->file.mode == SFM_RDWR)
  ------------------
  |  Branch (1319:6): [True: 0, False: 966]
  |  Branch (1319:37): [True: 0, False: 966]
  ------------------
 1320|      0|	{	wav_write_tailer (psf) ;
 1321|       |
 1322|      0|		if (psf->file.mode == SFM_RDWR)
  ------------------
  |  Branch (1322:7): [True: 0, False: 0]
  ------------------
 1323|      0|		{	sf_count_t current = psf_ftell (psf) ;
 1324|       |
 1325|       |			/*
 1326|       |			**	If the mode is RDWR and the current position is less than the
 1327|       |			**	filelength, truncate the file.
 1328|       |			*/
 1329|       |
 1330|      0|			if (current < psf->filelength)
  ------------------
  |  Branch (1330:8): [True: 0, False: 0]
  ------------------
 1331|      0|			{	psf_ftruncate (psf, current) ;
 1332|      0|				psf->filelength = current ;
 1333|      0|				} ;
 1334|      0|			} ;
 1335|       |
 1336|      0|		psf->write_header (psf, SF_TRUE) ;
 1337|      0|		} ;
 1338|       |
 1339|    966|	return 0 ;
 1340|    966|} /* wav_close */

wavlike_read_fmt_chunk:
  125|   139k|{	WAVLIKE_PRIVATE * wpriv ;
  126|   139k|	WAV_FMT *wav_fmt ;
  127|   139k|	int	bytesread, k, bytespersec = 0 ;
  128|       |
  129|   139k|	if ((wpriv = psf->container_data) == NULL)
  ------------------
  |  Branch (129:6): [True: 0, False: 139k]
  ------------------
  130|      0|		return SFE_INTERNAL ;
  131|   139k|	wav_fmt = &wpriv->wav_fmt ;
  132|       |
  133|   139k|	memset (wav_fmt, 0, sizeof (WAV_FMT)) ;
  134|       |
  135|   139k|	if (fmtsize < 16)
  ------------------
  |  Branch (135:6): [True: 65, False: 139k]
  ------------------
  136|     65|		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|   139k|	bytesread = psf_binheader_readf (psf, "224422",
  142|   139k|					&(wav_fmt->format), &(wav_fmt->min.channels),
  143|   139k|					&(wav_fmt->min.samplerate), &(wav_fmt->min.bytespersec),
  144|   139k|					&(wav_fmt->min.blockalign), &(wav_fmt->min.bitwidth)) ;
  145|       |
  146|   139k|	psf_log_printf (psf, "  Format        : 0x%X => %s\n", wav_fmt->format, wavlike_format_str (wav_fmt->format)) ;
  147|   139k|	psf_log_printf (psf, "  Channels      : %d\n", wav_fmt->min.channels) ;
  148|   139k|	psf_log_printf (psf, "  Sample Rate   : %d\n", wav_fmt->min.samplerate) ;
  149|       |
  150|   139k|	if (wav_fmt->format == WAVE_FORMAT_PCM && wav_fmt->min.blockalign == 0
  ------------------
  |  Branch (150:6): [True: 19.7k, False: 119k]
  |  Branch (150:44): [True: 12.2k, False: 7.52k]
  ------------------
  151|  12.2k|		&& wav_fmt->min.bitwidth > 0 && wav_fmt->min.channels > 0)
  ------------------
  |  Branch (151:6): [True: 9.10k, False: 3.11k]
  |  Branch (151:35): [True: 5.09k, False: 4.01k]
  ------------------
  152|  5.09k|	{	wav_fmt->min.blockalign = wav_fmt->min.bitwidth / 8 + (wav_fmt->min.bitwidth % 8 > 0 ? 1 : 0) ;
  ------------------
  |  Branch (152:59): [True: 28, False: 5.06k]
  ------------------
  153|  5.09k|		wav_fmt->min.blockalign *= wav_fmt->min.channels ;
  154|  5.09k|		psf_log_printf (psf, "  Block Align   : 0 (should be %d)\n", wav_fmt->min.blockalign) ;
  155|  5.09k|		}
  156|   134k|	else
  157|   134k|		psf_log_printf (psf, "  Block Align   : %d\n", wav_fmt->min.blockalign) ;
  158|       |
  159|   139k|	if (wav_fmt->format == WAVE_FORMAT_PCM && wav_fmt->min.bitwidth == 24 &&
  ------------------
  |  Branch (159:6): [True: 19.7k, False: 119k]
  |  Branch (159:44): [True: 6.52k, False: 13.2k]
  ------------------
  160|  6.52k|			wav_fmt->min.blockalign == 4 * wav_fmt->min.channels)
  ------------------
  |  Branch (160:4): [True: 2.74k, False: 3.78k]
  ------------------
  161|  2.74k|	{	psf_log_printf (psf, "  Bit Width     : 24\n") ;
  162|       |
  163|  2.74k|		psf_log_printf (psf, "\n"
  164|  2.74k|			"  Ambiguous information in 'fmt ' chunk. Possible file types:\n"
  165|  2.74k|			"    0) Invalid IEEE float file generated by Syntrillium's Cooledit!\n"
  166|  2.74k|			"    1) File generated by ALSA's arecord containing 24 bit samples in 32 bit containers.\n"
  167|  2.74k|			"    2) 24 bit file with incorrect Block Align value.\n"
  168|  2.74k|			"\n") ;
  169|       |
  170|  2.74k|		wpriv->fmt_is_broken = 1 ;
  171|  2.74k|		}
  172|   136k|	else if (wav_fmt->min.bitwidth == 0)
  ------------------
  |  Branch (172:11): [True: 22.4k, False: 113k]
  ------------------
  173|  22.4k|	{	switch (wav_fmt->format)
  174|  22.4k|		{	case WAVE_FORMAT_GSM610 :
  ------------------
  |  Branch (174:5): [True: 2.61k, False: 19.8k]
  ------------------
  175|  2.61k|			case WAVE_FORMAT_IPP_ITU_G_723_1 :
  ------------------
  |  Branch (175:4): [True: 1, False: 22.4k]
  ------------------
  176|  7.22k|			case WAVE_FORMAT_MPEGLAYER3 :
  ------------------
  |  Branch (176:4): [True: 4.61k, False: 17.8k]
  ------------------
  177|  7.22k|					psf_log_printf (psf, "  Bit Width     : %d\n", wav_fmt->min.bitwidth) ;
  178|  7.22k|					break ;
  179|  15.2k|			default :
  ------------------
  |  Branch (179:4): [True: 15.2k, False: 7.22k]
  ------------------
  180|  15.2k|					psf_log_printf (psf, "  Bit Width     : %d (should not be 0)\n", wav_fmt->min.bitwidth) ;
  181|  22.4k|			}
  182|  22.4k|		}
  183|   113k|	else
  184|   113k|	{	switch (wav_fmt->format)
  185|   113k|		{	case WAVE_FORMAT_GSM610 :
  ------------------
  |  Branch (185:5): [True: 4.48k, False: 109k]
  ------------------
  186|  4.49k|			case WAVE_FORMAT_IPP_ITU_G_723_1 :
  ------------------
  |  Branch (186:4): [True: 1, False: 113k]
  ------------------
  187|  10.0k|			case WAVE_FORMAT_MPEGLAYER3 :
  ------------------
  |  Branch (187:4): [True: 5.57k, False: 108k]
  ------------------
  188|  10.0k|					psf_log_printf (psf, "  Bit Width     : %d (should be 0)\n", wav_fmt->min.bitwidth) ;
  189|  10.0k|					break ;
  190|   103k|			default :
  ------------------
  |  Branch (190:4): [True: 103k, False: 10.0k]
  ------------------
  191|   103k|					psf_log_printf (psf, "  Bit Width     : %d\n", wav_fmt->min.bitwidth) ;
  192|   113k|			}
  193|   139k|		} ;
  194|       |
  195|   139k|	psf->sf.samplerate	= wav_fmt->min.samplerate ;
  196|   139k|	psf->sf.frames 		= 0 ;					/* Correct this when reading data chunk. */
  197|   139k|	psf->sf.channels	= wav_fmt->min.channels ;
  198|       |
  199|   139k|	switch (wav_fmt->format)
  200|   139k|	{	case WAVE_FORMAT_PCM :
  ------------------
  |  Branch (200:4): [True: 19.7k, False: 119k]
  ------------------
  201|  32.4k|		case WAVE_FORMAT_IEEE_FLOAT :
  ------------------
  |  Branch (201:3): [True: 12.7k, False: 126k]
  ------------------
  202|  32.4k|				bytespersec = wav_fmt->min.samplerate * wav_fmt->min.blockalign ;
  203|  32.4k|				if (wav_fmt->min.bytespersec != (unsigned) bytespersec)
  ------------------
  |  Branch (203:9): [True: 24.5k, False: 7.94k]
  ------------------
  204|  24.5k|					psf_log_printf (psf, "  Bytes/sec     : %d (should be %d)\n", wav_fmt->min.bytespersec, bytespersec) ;
  205|  7.94k|				else
  206|  7.94k|					psf_log_printf (psf, "  Bytes/sec     : %d\n", wav_fmt->min.bytespersec) ;
  207|       |
  208|  32.4k|				psf->bytewidth = BITWIDTH2BYTES (wav_fmt->min.bitwidth) ;
  ------------------
  |  |   85|  32.4k|#define	BITWIDTH2BYTES(x)	(((x) + 7) / 8)
  ------------------
  209|  32.4k|				break ;
  210|       |
  211|  5.77k|		case WAVE_FORMAT_ALAW :
  ------------------
  |  Branch (211:3): [True: 5.77k, False: 133k]
  ------------------
  212|  13.4k|		case WAVE_FORMAT_MULAW :
  ------------------
  |  Branch (212:3): [True: 7.71k, False: 131k]
  ------------------
  213|  13.4k|				if (wav_fmt->min.bytespersec != wav_fmt->min.samplerate * wav_fmt->min.blockalign)
  ------------------
  |  Branch (213:9): [True: 9.81k, False: 3.67k]
  ------------------
  214|  9.81k|					psf_log_printf (psf, "  Bytes/sec     : %d (should be %d)\n", wav_fmt->min.bytespersec, wav_fmt->min.samplerate * wav_fmt->min.blockalign) ;
  215|  3.67k|				else
  216|  3.67k|					psf_log_printf (psf, "  Bytes/sec     : %d\n", wav_fmt->min.bytespersec) ;
  217|       |
  218|  13.4k|				psf->bytewidth = 1 ;
  219|  13.4k|				if (fmtsize >= 18)
  ------------------
  |  Branch (219:9): [True: 10.3k, False: 3.09k]
  ------------------
  220|  10.3k|				{	bytesread += psf_binheader_readf (psf, "2", &(wav_fmt->size20.extrabytes)) ;
  221|  10.3k|					psf_log_printf (psf, "  Extra Bytes   : %d\n", wav_fmt->size20.extrabytes) ;
  222|  10.3k|					} ;
  223|  13.4k|				break ;
  224|       |
  225|  7.41k|		case WAVE_FORMAT_IMA_ADPCM :
  ------------------
  |  Branch (225:3): [True: 7.41k, False: 131k]
  ------------------
  226|  7.41k|				if (wav_fmt->min.bitwidth != 4)
  ------------------
  |  Branch (226:9): [True: 6, False: 7.40k]
  ------------------
  227|      6|					return SFE_WAV_ADPCM_NOT4BIT ;
  228|  7.40k|				if (wav_fmt->min.channels < 1 || wav_fmt->min.channels > 2)
  ------------------
  |  Branch (228:9): [True: 1, False: 7.40k]
  |  Branch (228:38): [True: 1, False: 7.40k]
  ------------------
  229|      2|					return SFE_WAV_ADPCM_CHANNELS ;
  230|       |
  231|  7.40k|				bytesread += psf_binheader_readf (psf, "22", &(wav_fmt->ima.extrabytes), &(wav_fmt->ima.samplesperblock)) ;
  232|  7.40k|				psf_log_printf (psf, "  Extra Bytes   : %d\n", wav_fmt->ima.extrabytes) ;
  233|  7.40k|				if (wav_fmt->ima.samplesperblock < 1)
  ------------------
  |  Branch (233:9): [True: 1, False: 7.40k]
  ------------------
  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|  7.40k|				else
  238|  7.40k|					psf_log_printf (psf, "  Samples/Block : %d\n", wav_fmt->ima.samplesperblock) ;
  239|       |
  240|  7.40k|				bytespersec = (wav_fmt->ima.samplerate * wav_fmt->ima.blockalign) / wav_fmt->ima.samplesperblock ;
  241|  7.40k|				if (wav_fmt->ima.bytespersec != (unsigned) bytespersec)
  ------------------
  |  Branch (241:9): [True: 4.02k, False: 3.38k]
  ------------------
  242|  4.02k|					psf_log_printf (psf, "  Bytes/sec     : %d (should be %d)\n", wav_fmt->ima.bytespersec, bytespersec) ;
  243|  3.38k|				else
  244|  3.38k|					psf_log_printf (psf, "  Bytes/sec     : %d\n", wav_fmt->ima.bytespersec) ;
  245|       |
  246|  7.40k|				break ;
  247|       |
  248|  12.9k|		case WAVE_FORMAT_MS_ADPCM :
  ------------------
  |  Branch (248:3): [True: 12.9k, False: 126k]
  ------------------
  249|  12.9k|				if (wav_fmt->msadpcm.bitwidth != 4)
  ------------------
  |  Branch (249:9): [True: 9, False: 12.8k]
  ------------------
  250|      9|					return SFE_WAV_ADPCM_NOT4BIT ;
  251|  12.8k|				if (wav_fmt->msadpcm.channels < 1 || wav_fmt->msadpcm.channels > 2)
  ------------------
  |  Branch (251:9): [True: 1, False: 12.8k]
  |  Branch (251:42): [True: 10, False: 12.8k]
  ------------------
  252|     11|					return SFE_WAV_ADPCM_CHANNELS ;
  253|       |
  254|  12.8k|				bytesread += psf_binheader_readf (psf, "222", &(wav_fmt->msadpcm.extrabytes),
  255|  12.8k|								&(wav_fmt->msadpcm.samplesperblock), &(wav_fmt->msadpcm.numcoeffs)) ;
  256|       |
  257|  12.8k|				psf_log_printf (psf, "  Extra Bytes   : %d\n", wav_fmt->msadpcm.extrabytes) ;
  258|  12.8k|				if (wav_fmt->ima.samplesperblock < 1)
  ------------------
  |  Branch (258:9): [True: 1, False: 12.8k]
  ------------------
  259|      1|				{	psf_log_printf (psf, "  Samples/Block : %d (should be > 0)\n", wav_fmt->ima.samplesperblock) ;
  260|      1|					return SFE_WAV_ADPCM_SAMPLES ;
  261|      1|					}
  262|  12.8k|				else
  263|  12.8k|					psf_log_printf (psf, "  Samples/Block : %d\n", wav_fmt->ima.samplesperblock) ;
  264|       |
  265|  12.8k|				bytespersec = (wav_fmt->min.samplerate * wav_fmt->min.blockalign) / wav_fmt->msadpcm.samplesperblock ;
  266|  12.8k|				if (wav_fmt->min.bytespersec == (unsigned) bytespersec)
  ------------------
  |  Branch (266:9): [True: 3.48k, False: 9.39k]
  ------------------
  267|  3.48k|					psf_log_printf (psf, "  Bytes/sec     : %d\n", wav_fmt->min.bytespersec) ;
  268|  9.39k|				else if (wav_fmt->min.bytespersec == (wav_fmt->min.samplerate / wav_fmt->msadpcm.samplesperblock) * wav_fmt->min.blockalign)
  ------------------
  |  Branch (268:14): [True: 3.52k, False: 5.86k]
  ------------------
  269|  3.52k|					psf_log_printf (psf, "  Bytes/sec     : %d (should be %d (MS BUG!))\n", wav_fmt->min.bytespersec, bytespersec) ;
  270|  5.86k|				else
  271|  5.86k|					psf_log_printf (psf, "  Bytes/sec     : %d (should be %d)\n", wav_fmt->min.bytespersec, bytespersec) ;
  272|       |
  273|  12.8k|				if (wav_fmt->msadpcm.numcoeffs > ARRAY_LEN (wav_fmt->msadpcm.coeffs))
  ------------------
  |  |   93|  12.8k|#define		ARRAY_LEN(x)	((int) (sizeof (x) / sizeof ((x) [0])))
  ------------------
  |  Branch (273:9): [True: 7.07k, False: 5.80k]
  ------------------
  274|  7.07k|				{	psf_log_printf (psf, "  No. of Coeffs : %d (should be <= %d)\n", wav_fmt->msadpcm.numcoeffs, ARRAY_LEN (wav_fmt->msadpcm.coeffs)) ;
  ------------------
  |  |   93|  7.07k|#define		ARRAY_LEN(x)	((int) (sizeof (x) / sizeof ((x) [0])))
  ------------------
  275|  7.07k|					wav_fmt->msadpcm.numcoeffs = ARRAY_LEN (wav_fmt->msadpcm.coeffs) ;
  ------------------
  |  |   93|  7.07k|#define		ARRAY_LEN(x)	((int) (sizeof (x) / sizeof ((x) [0])))
  ------------------
  276|  7.07k|					}
  277|  5.80k|				else
  278|  5.80k|					psf_log_printf (psf, "  No. of Coeffs : %d\n", wav_fmt->msadpcm.numcoeffs) ;
  279|       |
  280|  12.8k|				psf_log_printf (psf, "    Index   Coeffs1   Coeffs2\n") ;
  281|  62.4k|				for (k = 0 ; k < wav_fmt->msadpcm.numcoeffs ; k++)
  ------------------
  |  Branch (281:18): [True: 49.5k, False: 12.8k]
  ------------------
  282|  49.5k|				{	char buffer [128] ;
  283|       |
  284|  49.5k|					bytesread +=
  285|  49.5k|						psf_binheader_readf (psf, "22", &(wav_fmt->msadpcm.coeffs [k].coeff1), &(wav_fmt->msadpcm.coeffs [k].coeff2)) ;
  286|  49.5k|					snprintf (buffer, sizeof (buffer), "     %2d     %7d   %7d\n", k, wav_fmt->msadpcm.coeffs [k].coeff1, wav_fmt->msadpcm.coeffs [k].coeff2) ;
  287|  49.5k|					psf_log_printf (psf, buffer) ;
  288|  49.5k|					} ;
  289|  12.8k|				break ;
  290|       |
  291|  7.10k|		case WAVE_FORMAT_GSM610 :
  ------------------
  |  Branch (291:3): [True: 7.10k, False: 132k]
  ------------------
  292|  7.10k|				if (wav_fmt->gsm610.channels != 1 || wav_fmt->gsm610.blockalign != 65)
  ------------------
  |  Branch (292:9): [True: 7, False: 7.09k]
  |  Branch (292:42): [True: 6, False: 7.08k]
  ------------------
  293|     13|					return SFE_WAV_GSM610_FORMAT ;
  294|       |
  295|  7.08k|				bytesread +=
  296|  7.08k|				psf_binheader_readf (psf, "22", &(wav_fmt->gsm610.extrabytes), &(wav_fmt->gsm610.samplesperblock)) ;
  297|       |
  298|  7.08k|				if (wav_fmt->gsm610.samplesperblock != 320)
  ------------------
  |  Branch (298:9): [True: 3, False: 7.08k]
  ------------------
  299|      3|					return SFE_WAV_GSM610_FORMAT ;
  300|       |
  301|  7.08k|				bytespersec = (wav_fmt->gsm610.samplerate * wav_fmt->gsm610.blockalign) / wav_fmt->gsm610.samplesperblock ;
  302|  7.08k|				if (wav_fmt->gsm610.bytespersec != (unsigned) bytespersec)
  ------------------
  |  Branch (302:9): [True: 4.48k, False: 2.59k]
  ------------------
  303|  4.48k|					psf_log_printf (psf, "  Bytes/sec     : %d (should be %d)\n", wav_fmt->gsm610.bytespersec, bytespersec) ;
  304|  2.59k|				else
  305|  2.59k|					psf_log_printf (psf, "  Bytes/sec     : %d\n", wav_fmt->gsm610.bytespersec) ;
  306|       |
  307|  7.08k|				psf_log_printf (psf, "  Extra Bytes   : %d\n", wav_fmt->gsm610.extrabytes) ;
  308|  7.08k|				psf_log_printf (psf, "  Samples/Block : %d\n", wav_fmt->gsm610.samplesperblock) ;
  309|  7.08k|				break ;
  310|       |
  311|  10.1k|		case WAVE_FORMAT_MPEGLAYER3 :
  ------------------
  |  Branch (311:3): [True: 10.1k, False: 128k]
  ------------------
  312|  10.1k|				bytesread += psf_binheader_readf (psf, "24222", &(wav_fmt->mpeg3.extrabytes),
  313|  10.1k|					&(wav_fmt->mpeg3.id), &(wav_fmt->mpeg3.flags), &(wav_fmt->mpeg3.blocksize),
  314|  10.1k|					&(wav_fmt->mpeg3.samplesperblock), &(wav_fmt->mpeg3.codecdelay)) ;
  315|       |
  316|  10.1k|				psf_log_printf (psf, "  Bytes/sec     : %d\n", wav_fmt->mpeg3.bytespersec) ;
  317|  10.1k|				psf_log_printf (psf, "  Extra Bytes   : %d\n", wav_fmt->mpeg3.extrabytes) ;
  318|  10.1k|				if (wav_fmt->mpeg3.id != 1)
  ------------------
  |  Branch (318:9): [True: 6.28k, False: 3.90k]
  ------------------
  319|  6.28k|					psf_log_printf (psf, "  ID            : %d (unknown, should be 1)\n", wav_fmt->mpeg3.id) ;
  320|  3.90k|				else
  321|  3.90k|					psf_log_printf (psf, "  ID            : MPEGLAYER3_ID_MPEG\n") ;
  322|  10.1k|				psf_log_printf (psf, "  Flags         : 0x%08x\n", wav_fmt->mpeg3.flags) ;
  323|  10.1k|				psf_log_printf (psf, "  Block Size    : %d\n", wav_fmt->mpeg3.blocksize) ;
  324|  10.1k|				psf_log_printf (psf, "  Samples/Block : %d\n", wav_fmt->mpeg3.samplesperblock) ;
  325|  10.1k|				psf_log_printf (psf, "  Codec Delay   : %d samples\n", wav_fmt->mpeg3.codecdelay) ;
  326|  10.1k|				break ;
  327|       |
  328|  32.9k|		case WAVE_FORMAT_EXTENSIBLE :
  ------------------
  |  Branch (328:3): [True: 32.9k, False: 106k]
  ------------------
  329|  32.9k|				if (wav_fmt->ext.bytespersec != wav_fmt->ext.samplerate * wav_fmt->ext.blockalign)
  ------------------
  |  Branch (329:9): [True: 26.1k, False: 6.76k]
  ------------------
  330|  26.1k|					psf_log_printf (psf, "  Bytes/sec     : %d (should be %d)\n", wav_fmt->ext.bytespersec, wav_fmt->ext.samplerate * wav_fmt->ext.blockalign) ;
  331|  6.76k|				else
  332|  6.76k|					psf_log_printf (psf, "  Bytes/sec     : %d\n", wav_fmt->ext.bytespersec) ;
  333|       |
  334|  32.9k|				bytesread +=
  335|  32.9k|				psf_binheader_readf (psf, "224", &(wav_fmt->ext.extrabytes), &(wav_fmt->ext.validbits),
  336|  32.9k|						&(wav_fmt->ext.channelmask)) ;
  337|       |
  338|  32.9k|				psf_log_printf (psf, "  Valid Bits    : %d\n", wav_fmt->ext.validbits) ;
  339|       |
  340|  32.9k|				if (wav_fmt->ext.channelmask == 0)
  ------------------
  |  Branch (340:9): [True: 3.58k, False: 29.3k]
  ------------------
  341|  3.58k|					psf_log_printf (psf, "  Channel Mask  : 0x0 (should not be zero)\n") ;
  342|  29.3k|				else
  343|  29.3k|				{	char buffer [512] ;
  344|  29.3k|					unsigned bit ;
  345|       |
  346|  29.3k|					wpriv->wavex_channelmask = wav_fmt->ext.channelmask ;
  347|       |
  348|       |					/* It's probably wise to ignore the channel mask if it is all zero */
  349|  29.3k|					free (psf->channel_map) ;
  350|       |
  351|  29.3k|					if ((psf->channel_map = calloc (psf->sf.channels, sizeof (psf->channel_map [0]))) == NULL)
  ------------------
  |  Branch (351:10): [True: 0, False: 29.3k]
  ------------------
  352|      0|						return SFE_MALLOC_FAILED ;
  353|       |
  354|       |					/* Terminate the buffer we're going to append_snprintf into. */
  355|  29.3k|					buffer [0] = 0 ;
  356|       |
  357|   407k|					for (bit = k = 0 ; bit < ARRAY_LEN (channel_mask_bits) && k < psf->sf.channels ; bit++)
  ------------------
  |  |   93|   814k|#define		ARRAY_LEN(x)	((int) (sizeof (x) / sizeof ((x) [0])))
  ------------------
  |  Branch (357:25): [True: 387k, False: 20.1k]
  |  Branch (357:64): [True: 377k, False: 9.16k]
  ------------------
  358|   377k|					{
  359|   377k|						if (wav_fmt->ext.channelmask & (1 << bit))
  ------------------
  |  Branch (359:11): [True: 139k, False: 238k]
  ------------------
  360|   139k|						{	if (k > psf->sf.channels)
  ------------------
  |  Branch (360:13): [True: 0, False: 139k]
  ------------------
  361|      0|							{	psf_log_printf (psf, "*** More channel map bits than there are channels.\n") ;
  362|      0|								break ;
  363|   139k|								} ;
  364|       |
  365|   139k|							psf->channel_map [k++] = channel_mask_bits [bit].id ;
  366|   139k|							append_snprintf (buffer, sizeof (buffer), "%s, ", channel_mask_bits [bit].name) ;
  367|   377k|							} ;
  368|   377k|						} ;
  369|       |
  370|       |					/* Remove trailing ", ". */
  371|  29.3k|					bit = strlen (buffer) ;
  372|  29.3k|					if (bit >= 2)
  ------------------
  |  Branch (372:10): [True: 18.5k, False: 10.7k]
  ------------------
  373|  18.5k|					{	buffer [--bit] = 0 ;
  374|  18.5k|						buffer [--bit] = 0 ;
  375|  18.5k|						} ;
  376|       |
  377|  29.3k|					if (k != psf->sf.channels)
  ------------------
  |  Branch (377:10): [True: 17.1k, False: 12.1k]
  ------------------
  378|  17.1k|					{	psf_log_printf (psf, "  Channel Mask  : 0x%X\n", wav_fmt->ext.channelmask) ;
  379|  17.1k|						psf_log_printf (psf, "*** Less channel map bits than there are channels.\n") ;
  380|  17.1k|						}
  381|  12.1k|					else
  382|  12.1k|						psf_log_printf (psf, "  Channel Mask  : 0x%X (%s)\n", wav_fmt->ext.channelmask, buffer) ;
  383|  32.9k|					} ;
  384|       |
  385|  32.9k|				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|  32.9k|				psf_log_printf (psf, "  Subformat\n") ;
  389|  32.9k|				psf_log_printf (psf, "    esf_field1 : 0x%X\n", wav_fmt->ext.esf.esf_field1) ;
  390|  32.9k|				psf_log_printf (psf, "    esf_field2 : 0x%X\n", wav_fmt->ext.esf.esf_field2) ;
  391|  32.9k|				psf_log_printf (psf, "    esf_field3 : 0x%X\n", wav_fmt->ext.esf.esf_field3) ;
  392|  32.9k|				psf_log_printf (psf, "    esf_field4 : ") ;
  393|   296k|				for (k = 0 ; k < 8 ; k++)
  ------------------
  |  Branch (393:18): [True: 263k, False: 32.9k]
  ------------------
  394|   263k|				{	bytesread += psf_binheader_readf (psf, "1", &(wav_fmt->ext.esf.esf_field4 [k])) ;
  395|   263k|					psf_log_printf (psf, "0x%X ", wav_fmt->ext.esf.esf_field4 [k] & 0xFF) ;
  396|   263k|					} ;
  397|  32.9k|				psf_log_printf (psf, "\n") ;
  398|  32.9k|				psf->bytewidth = BITWIDTH2BYTES (wav_fmt->ext.bitwidth) ;
  ------------------
  |  |   85|  32.9k|#define	BITWIDTH2BYTES(x)	(((x) + 7) / 8)
  ------------------
  399|       |
  400|       |				/* Compare GUIDs for known ones. */
  401|  32.9k|				if (wavex_guid_equal (&wav_fmt->ext.esf, &MSGUID_SUBTYPE_PCM))
  ------------------
  |  Branch (401:9): [True: 6.62k, False: 26.3k]
  ------------------
  402|  6.62k|				{	psf->sf.format = SF_FORMAT_WAVEX | u_bitwidth_to_subformat (psf->bytewidth * 8) ;
  403|  6.62k|					psf_log_printf (psf, "    format : pcm\n") ;
  404|  6.62k|					}
  405|  26.3k|				else if (wavex_guid_equal (&wav_fmt->ext.esf, &MSGUID_SUBTYPE_MS_ADPCM))
  ------------------
  |  Branch (405:14): [True: 3.76k, False: 22.5k]
  ------------------
  406|  3.76k|				{	psf->sf.format = (SF_FORMAT_WAVEX | SF_FORMAT_MS_ADPCM) ;
  407|  3.76k|					psf_log_printf (psf, "    format : ms adpcm\n") ;
  408|  3.76k|					}
  409|  22.5k|				else if (wavex_guid_equal (&wav_fmt->ext.esf, &MSGUID_SUBTYPE_IEEE_FLOAT))
  ------------------
  |  Branch (409:14): [True: 4.30k, False: 18.2k]
  ------------------
  410|  4.30k|				{	psf->sf.format = SF_FORMAT_WAVEX | ((psf->bytewidth == 8) ? SF_FORMAT_DOUBLE : SF_FORMAT_FLOAT) ;
  ------------------
  |  Branch (410:43): [True: 1.96k, False: 2.33k]
  ------------------
  411|  4.30k|					psf_log_printf (psf, "    format : IEEE float\n") ;
  412|  4.30k|					}
  413|  18.2k|				else if (wavex_guid_equal (&wav_fmt->ext.esf, &MSGUID_SUBTYPE_ALAW))
  ------------------
  |  Branch (413:14): [True: 3.17k, False: 15.0k]
  ------------------
  414|  3.17k|				{	psf->sf.format = (SF_FORMAT_WAVEX | SF_FORMAT_ALAW) ;
  415|  3.17k|					psf_log_printf (psf, "    format : A-law\n") ;
  416|  3.17k|					}
  417|  15.0k|				else if (wavex_guid_equal (&wav_fmt->ext.esf, &MSGUID_SUBTYPE_MULAW))
  ------------------
  |  Branch (417:14): [True: 2.87k, False: 12.1k]
  ------------------
  418|  2.87k|				{	psf->sf.format = (SF_FORMAT_WAVEX | SF_FORMAT_ULAW) ;
  419|  2.87k|					psf_log_printf (psf, "    format : u-law\n") ;
  420|  2.87k|					}
  421|  12.1k|				else if (wavex_guid_equal (&wav_fmt->ext.esf, &MSGUID_SUBTYPE_AMBISONIC_B_FORMAT_PCM))
  ------------------
  |  Branch (421:14): [True: 7.00k, False: 5.18k]
  ------------------
  422|  7.00k|				{	psf->sf.format = SF_FORMAT_WAVEX | u_bitwidth_to_subformat (psf->bytewidth * 8) ;
  423|  7.00k|					psf_log_printf (psf, "    format : pcm (Ambisonic B)\n") ;
  424|  7.00k|					wpriv->wavex_ambisonic = SF_AMBISONIC_B_FORMAT ;
  425|  7.00k|					}
  426|  5.18k|				else if (wavex_guid_equal (&wav_fmt->ext.esf, &MSGUID_SUBTYPE_AMBISONIC_B_FORMAT_IEEE_FLOAT))
  ------------------
  |  Branch (426:14): [True: 5.00k, False: 175]
  ------------------
  427|  5.00k|				{	psf->sf.format = SF_FORMAT_WAVEX | ((psf->bytewidth == 8) ? SF_FORMAT_DOUBLE : SF_FORMAT_FLOAT) ;
  ------------------
  |  Branch (427:43): [True: 987, False: 4.01k]
  ------------------
  428|  5.00k|					psf_log_printf (psf, "    format : IEEE float (Ambisonic B)\n") ;
  429|  5.00k|					wpriv->wavex_ambisonic = SF_AMBISONIC_B_FORMAT ;
  430|  5.00k|					}
  431|    175|				else
  432|    175|					return SFE_UNIMPLEMENTED ;
  433|       |
  434|  32.7k|				break ;
  435|       |
  436|  32.7k|		case WAVE_FORMAT_G721_ADPCM :
  ------------------
  |  Branch (436:3): [True: 12.9k, False: 126k]
  ------------------
  437|  12.9k|				psf_log_printf (psf, "  Bytes/sec     : %d\n", wav_fmt->g72x.bytespersec) ;
  438|  12.9k|				if (fmtsize >= 20)
  ------------------
  |  Branch (438:9): [True: 5.26k, False: 7.71k]
  ------------------
  439|  5.26k|				{	bytesread += psf_binheader_readf (psf, "22", &(wav_fmt->g72x.extrabytes), &(wav_fmt->g72x.auxblocksize)) ;
  440|  5.26k|					if (wav_fmt->g72x.extrabytes == 0)
  ------------------
  |  Branch (440:10): [True: 2.14k, False: 3.12k]
  ------------------
  441|  2.14k|						psf_log_printf (psf, "  Extra Bytes   : %d (should be 2)\n", wav_fmt->g72x.extrabytes) ;
  442|  3.12k|					else
  443|  3.12k|						psf_log_printf (psf, "  Extra Bytes   : %d\n", wav_fmt->g72x.extrabytes) ;
  444|  5.26k|					psf_log_printf (psf, "  Aux Blk Size  : %d\n", wav_fmt->g72x.auxblocksize) ;
  445|  5.26k|					}
  446|  7.71k|				else if (fmtsize == 18)
  ------------------
  |  Branch (446:14): [True: 5.07k, False: 2.64k]
  ------------------
  447|  5.07k|				{	bytesread += psf_binheader_readf (psf, "2", &(wav_fmt->g72x.extrabytes)) ;
  448|  5.07k|					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.52k, False: 1.54k]
  ------------------
  449|  5.07k|					}
  450|  2.64k|				else
  451|  2.64k|					psf_log_printf (psf, "*** 'fmt ' chunk should be bigger than this!\n") ;
  452|  12.9k|				break ;
  453|       |
  454|  9.57k|		case WAVE_FORMAT_NMS_VBXADPCM :
  ------------------
  |  Branch (454:3): [True: 9.57k, False: 129k]
  ------------------
  455|  9.57k|				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: 2, False: 9.56k]
  |  Branch (455:39): [True: 7, False: 9.56k]
  |  Branch (455:68): [True: 17, False: 9.54k]
  ------------------
  456|     26|					return SFE_WAV_NMS_FORMAT ;
  457|       |
  458|  9.54k|				bytespersec = (wav_fmt->min.samplerate * wav_fmt->min.blockalign) / 160 ;
  459|  9.54k|				if (wav_fmt->min.bytespersec == (unsigned) bytespersec)
  ------------------
  |  Branch (459:9): [True: 3.18k, False: 6.35k]
  ------------------
  460|  3.18k|					psf_log_printf (psf, "  Bytes/sec     : %d\n", wav_fmt->min.bytespersec) ;
  461|  6.35k|				else
  462|  6.35k|					psf_log_printf (psf, "  Bytes/sec     : %d (should be %d)\n", wav_fmt->min.bytespersec, bytespersec) ;
  463|  9.54k|				if (fmtsize >= 18)
  ------------------
  |  Branch (463:9): [True: 2.91k, False: 6.63k]
  ------------------
  464|  2.91k|				{	bytesread += psf_binheader_readf (psf, "2", &(wav_fmt->size20.extrabytes)) ;
  465|  2.91k|					psf_log_printf (psf, "  Extra Bytes   : %d\n", wav_fmt->size20.extrabytes) ;
  466|  2.91k|					} ;
  467|  9.54k|				break ;
  468|       |
  469|     80|		default :
  ------------------
  |  Branch (469:3): [True: 80, False: 139k]
  ------------------
  470|     80|				psf_log_printf (psf, "*** No 'fmt ' chunk dumper for this format!\n") ;
  471|     80|				return SFE_WAV_BAD_FMT ;
  472|   139k|		} ;
  473|       |
  474|   138k|	if (bytesread > fmtsize)
  ------------------
  |  Branch (474:6): [True: 21, False: 138k]
  ------------------
  475|     21|	{	psf_log_printf (psf, "*** wavlike_read_fmt_chunk (bytesread > fmtsize)\n") ;
  476|     21|		return SFE_WAV_BAD_FMT ;
  477|     21|		}
  478|   138k|	else
  479|   138k|		psf_binheader_readf (psf, "j", fmtsize - bytesread) ;
  480|       |
  481|   138k|	psf->blockwidth = wav_fmt->min.channels * psf->bytewidth ;
  482|       |
  483|   138k|	return 0 ;
  484|   138k|} /* wavlike_read_fmt_chunk */
wavlike_analyze:
  524|     41|{	unsigned char buffer [4096] ;
  525|     41|	AUDIO_DETECT ad ;
  526|     41|	int format = 0 ;
  527|       |
  528|     41|	if (psf->is_pipe)
  ------------------
  |  Branch (528:6): [True: 0, False: 41]
  ------------------
  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|     41|		} ;
  532|       |
  533|     41|	psf_log_printf (psf, "---------------------------------------------------\n"
  534|     41|						"Format is known to be broken. Using detection code.\n") ;
  535|       |
  536|       |	/* Code goes here. */
  537|     41|	ad.endianness = SF_ENDIAN_LITTLE ;
  538|     41|	ad.channels = psf->sf.channels ;
  539|       |
  540|     41|	psf_fseek (psf, 3 * 4 * 50, SEEK_SET) ;
  541|       |
  542|  1.89k|	while (psf_fread (buffer, 1, sizeof (buffer), psf) == sizeof (buffer))
  ------------------
  |  Branch (542:9): [True: 1.86k, False: 30]
  ------------------
  543|  1.86k|	{	format = audio_detect (psf, &ad, buffer, sizeof (buffer)) ;
  544|  1.86k|		if (format != 0)
  ------------------
  |  Branch (544:7): [True: 11, False: 1.85k]
  ------------------
  545|     11|			break ;
  546|  1.86k|		} ;
  547|       |
  548|       |	/* Seek to start of DATA section. */
  549|     41|	psf_fseek (psf, psf->dataoffset, SEEK_SET) ;
  550|       |
  551|     41|	if (format == 0)
  ------------------
  |  Branch (551:6): [True: 30, False: 11]
  ------------------
  552|     30|	{	psf_log_printf (psf, "wavlike_analyze : detection failed.\n") ;
  553|     30|		return ;
  554|     30|		} ;
  555|       |
  556|     11|	switch (format)
  557|     11|	{	case SF_FORMAT_PCM_32 :
  ------------------
  |  Branch (557:4): [True: 10, False: 1]
  ------------------
  558|     11|		case SF_FORMAT_FLOAT :
  ------------------
  |  Branch (558:3): [True: 1, False: 10]
  ------------------
  559|     11|			psf_log_printf (psf, "wavlike_analyze : found format : 0x%X\n", format) ;
  560|     11|			psf->sf.format = (psf->sf.format & ~SF_FORMAT_SUBMASK) + format ;
  561|     11|			psf->bytewidth = 4 ;
  562|     11|			psf->blockwidth = (sf_count_t) psf->sf.channels * psf->bytewidth ;
  563|     11|			break ;
  564|       |
  565|      0|		case SF_FORMAT_PCM_24 :
  ------------------
  |  Branch (565:3): [True: 0, False: 11]
  ------------------
  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: 11]
  ------------------
  573|      0|			psf_log_printf (psf, "wavlike_analyze : unhandled format : 0x%X\n", format) ;
  574|      0|			break ;
  575|     11|		} ;
  576|       |
  577|     11|	return ;
  578|     11|} /* wavlike_analyze */
wavlike_format_str:
  702|   139k|{	int lower, upper, mid ;
  703|       |
  704|   139k|	lower = -1 ;
  705|   139k|	upper = sizeof (wave_descs) / sizeof (WAV_FORMAT_DESC) ;
  706|       |
  707|       |	/* binary search */
  708|   139k|	if ((wave_descs [0].ID <= k) && (k <= wave_descs [upper - 1].ID))
  ------------------
  |  Branch (708:6): [True: 139k, False: 12]
  |  Branch (708:34): [True: 139k, False: 1]
  ------------------
  709|   139k|	{
  710|   859k|		while (lower + 1 < upper)
  ------------------
  |  Branch (710:10): [True: 859k, False: 60]
  ------------------
  711|   859k|		{	mid = (upper + lower) / 2 ;
  712|       |
  713|   859k|			if (k == wave_descs [mid].ID)
  ------------------
  |  Branch (713:8): [True: 139k, False: 720k]
  ------------------
  714|   139k|				return wave_descs [mid].name ;
  715|   720k|			if (k < wave_descs [mid].ID)
  ------------------
  |  Branch (715:8): [True: 391k, False: 328k]
  ------------------
  716|   391k|				upper = mid ;
  717|   328k|			else
  718|   328k|				lower = mid ;
  719|   720k|			} ;
  720|     73|		} ;
  721|       |
  722|     73|	return "Unknown format" ;
  723|   139k|} /* wavlike_format_str */
wavlike_read_bext_chunk:
  738|  15.3k|{
  739|  15.3k|	SF_BROADCAST_INFO_16K * b ;
  740|  15.3k|	uint32_t bytes = 0 ;
  741|       |
  742|  15.3k|	if (chunksize < WAV_BEXT_MIN_CHUNK_SIZE)
  ------------------
  |  |   33|  15.3k|#define WAV_BEXT_MIN_CHUNK_SIZE		602
  ------------------
  |  Branch (742:6): [True: 15.1k, False: 251]
  ------------------
  743|  15.1k|	{	psf_log_printf (psf, "bext : %u (should be >= %d)\n", chunksize, WAV_BEXT_MIN_CHUNK_SIZE) ;
  ------------------
  |  |   33|  15.1k|#define WAV_BEXT_MIN_CHUNK_SIZE		602
  ------------------
  744|  15.1k|		psf_binheader_readf (psf, "j", chunksize) ;
  745|  15.1k|		return 0 ;
  746|  15.1k|		} ;
  747|       |
  748|    251|	if (chunksize > WAV_BEXT_MAX_CHUNK_SIZE)
  ------------------
  |  |   34|    251|#define WAV_BEXT_MAX_CHUNK_SIZE		(10 * 1024)
  ------------------
  |  Branch (748:6): [True: 83, False: 168]
  ------------------
  749|     83|	{	psf_log_printf (psf, "bext : %u (should be < %d)\n", chunksize, WAV_BEXT_MAX_CHUNK_SIZE) ;
  ------------------
  |  |   34|     83|#define WAV_BEXT_MAX_CHUNK_SIZE		(10 * 1024)
  ------------------
  750|     83|		psf_binheader_readf (psf, "j", chunksize) ;
  751|     83|		return 0 ;
  752|    168|		} ;
  753|       |
  754|    168|	if (chunksize >= sizeof (SF_BROADCAST_INFO_16K))
  ------------------
  |  Branch (754:6): [True: 0, False: 168]
  ------------------
  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|    168|		} ;
  759|       |
  760|    168|	psf_log_printf (psf, "bext : %u\n", chunksize) ;
  761|       |
  762|    168|	if (!psf->broadcast_16k)
  ------------------
  |  Branch (762:6): [True: 25, False: 143]
  ------------------
  763|     25|	{	psf->broadcast_16k = broadcast_var_alloc () ;
  764|     25|		if (!psf->broadcast_16k)
  ------------------
  |  Branch (764:7): [True: 0, False: 25]
  ------------------
  765|      0|		{	psf->error = SFE_MALLOC_FAILED ;
  766|      0|			return psf->error ;
  767|      0|			}
  768|     25|		}
  769|    143|	else
  770|    143|	{	psf_log_printf (psf, "bext : found more than one bext chunk, using last one.\n") ;
  771|    143|		memset (psf->broadcast_16k, 0, sizeof (SF_BROADCAST_INFO_16K)) ;
  772|    143|		}
  773|       |
  774|    168|	b = psf->broadcast_16k ;
  775|       |
  776|    168|	bytes += psf_binheader_readf (psf, "b", b->description, sizeof (b->description)) ;
  777|    168|	bytes += psf_binheader_readf (psf, "b", b->originator, sizeof (b->originator)) ;
  778|    168|	bytes += psf_binheader_readf (psf, "b", b->originator_reference, sizeof (b->originator_reference)) ;
  779|    168|	bytes += psf_binheader_readf (psf, "b", b->origination_date, sizeof (b->origination_date)) ;
  780|    168|	bytes += psf_binheader_readf (psf, "b", b->origination_time, sizeof (b->origination_time)) ;
  781|    168|	bytes += psf_binheader_readf (psf, "442", &b->time_reference_low, &b->time_reference_high, &b->version) ;
  782|    168|	bytes += psf_binheader_readf (psf, "b", &b->umid, sizeof (b->umid)) ;
  783|    168|	bytes += psf_binheader_readf (psf, "22", &b->loudness_value, &b->loudness_range) ;
  784|    168|	bytes += psf_binheader_readf (psf, "222", &b->max_true_peak_level, &b->max_momentary_loudness, &b->max_shortterm_loudness) ;
  785|    168|	bytes += psf_binheader_readf (psf, "j", 180) ;
  786|       |
  787|    168|	if (chunksize > WAV_BEXT_MIN_CHUNK_SIZE)
  ------------------
  |  |   33|    168|#define WAV_BEXT_MIN_CHUNK_SIZE		602
  ------------------
  |  Branch (787:6): [True: 142, False: 26]
  ------------------
  788|    142|	{	/* File has coding history data. */
  789|       |
  790|    142|		b->coding_history_size = chunksize - WAV_BEXT_MIN_CHUNK_SIZE ;
  ------------------
  |  |   33|    142|#define WAV_BEXT_MIN_CHUNK_SIZE		602
  ------------------
  791|       |
  792|       |		/* We do not parse the coding history */
  793|    142|		bytes += psf_binheader_readf (psf, "b", BHWv (b->coding_history), BHWz (b->coding_history_size)) ;
  ------------------
  |  |  133|    142|#define BHWv(x) ((const void *) (x))
  ------------------
              		bytes += psf_binheader_readf (psf, "b", BHWv (b->coding_history), BHWz (b->coding_history_size)) ;
  ------------------
  |  |  134|    142|#define BHWz(x) ((size_t) (x))
  ------------------
  794|    142|		} ;
  795|       |
  796|    168|	if (bytes < chunksize)
  ------------------
  |  Branch (796:6): [True: 25, False: 143]
  ------------------
  797|     25|		psf_binheader_readf (psf, "j", BHWj (chunksize - bytes)) ;
  ------------------
  |  |  129|     25|#define BHWj(x) ((size_t) (x))
  ------------------
  798|       |
  799|    168|	return 0 ;
  800|    168|} /* wavlike_read_bext_chunk */
wavlike_read_cart_chunk:
  837|  2.19k|{	SF_CART_INFO_16K *c ;
  838|  2.19k|	uint32_t bytes = 0 ;
  839|  2.19k|	int k ;
  840|       |
  841|  2.19k|	if (chunksize < WAV_CART_MIN_CHUNK_SIZE)
  ------------------
  |  |   36|  2.19k|#define WAV_CART_MIN_CHUNK_SIZE		2048
  ------------------
  |  Branch (841:6): [True: 611, False: 1.58k]
  ------------------
  842|    611|	{	psf_log_printf (psf, "cart : %u (should be >= %d)\n", chunksize, WAV_CART_MIN_CHUNK_SIZE) ;
  ------------------
  |  |   36|    611|#define WAV_CART_MIN_CHUNK_SIZE		2048
  ------------------
  843|    611|		psf_binheader_readf (psf, "j", chunksize) ;
  844|    611|		return 0 ;
  845|  1.58k|		} ;
  846|  1.58k|	if (chunksize > WAV_CART_MAX_CHUNK_SIZE)
  ------------------
  |  |   37|  1.58k|#define WAV_CART_MAX_CHUNK_SIZE		0xffffffff
  ------------------
  |  Branch (846:6): [True: 0, False: 1.58k]
  ------------------
  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.58k|		} ;
  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.58k|	if (chunksize >= sizeof (SF_CART_INFO_16K) - 4)
  ------------------
  |  Branch (856:6): [True: 1.33k, False: 243]
  ------------------
  857|  1.33k|	{	psf_log_printf (psf, "cart : %u too big to be handled\n", chunksize) ;
  858|  1.33k|		psf_binheader_readf (psf, "j", chunksize) ;
  859|  1.33k|		return 0 ;
  860|  1.33k|		} ;
  861|       |
  862|    243|	psf_log_printf (psf, "cart : %u\n", chunksize) ;
  863|       |
  864|    243|	if (psf->cart_16k)
  ------------------
  |  Branch (864:6): [True: 205, False: 38]
  ------------------
  865|    205|	{	psf_log_printf (psf, "  Found more than one cart chunk, using last one.\n") ;
  866|    205|		free (psf->cart_16k) ;
  867|    205|		psf->cart_16k = NULL ;
  868|    205|		} ;
  869|       |
  870|    243|	if ((psf->cart_16k = cart_var_alloc ()) == NULL)
  ------------------
  |  Branch (870:6): [True: 0, False: 243]
  ------------------
  871|      0|	{	psf->error = SFE_MALLOC_FAILED ;
  872|      0|		return psf->error ;
  873|    243|		} ;
  874|       |
  875|    243|	c = psf->cart_16k ;
  876|    243|	bytes += psf_binheader_readf (psf, "b", c->version, sizeof (c->version)) ;
  877|    243|	bytes += psf_binheader_readf (psf, "b", c->title, sizeof (c->title)) ;
  878|    243|	bytes += psf_binheader_readf (psf, "b", c->artist, sizeof (c->artist)) ;
  879|    243|	bytes += psf_binheader_readf (psf, "b", c->cut_id, sizeof (c->cut_id)) ;
  880|    243|	bytes += psf_binheader_readf (psf, "b", c->client_id, sizeof (c->client_id)) ;
  881|    243|	bytes += psf_binheader_readf (psf, "b", c->category, sizeof (c->category)) ;
  882|    243|	bytes += psf_binheader_readf (psf, "b", c->classification, sizeof (c->classification)) ;
  883|    243|	bytes += psf_binheader_readf (psf, "b", c->out_cue, sizeof (c->out_cue)) ;
  884|    243|	bytes += psf_binheader_readf (psf, "b", c->start_date, sizeof (c->start_date)) ;
  885|    243|	bytes += psf_binheader_readf (psf, "b", c->start_time, sizeof (c->start_time)) ;
  886|    243|	bytes += psf_binheader_readf (psf, "b", c->end_date, sizeof (c->end_date)) ;
  887|    243|	bytes += psf_binheader_readf (psf, "b", c->end_time, sizeof (c->end_time)) ;
  888|    243|	bytes += psf_binheader_readf (psf, "b", c->producer_app_id, sizeof (c->producer_app_id)) ;
  889|    243|	bytes += psf_binheader_readf (psf, "b", c->producer_app_version, sizeof (c->producer_app_version)) ;
  890|    243|	bytes += psf_binheader_readf (psf, "b", c->user_def, sizeof (c->user_def)) ;
  891|    243|	bytes += psf_binheader_readf (psf, "e4", &c->level_reference, sizeof (c->level_reference)) ;
  892|       |
  893|  2.18k|	for (k = 0 ; k < ARRAY_LEN (c->post_timers) ; k++)
  ------------------
  |  |   93|  2.18k|#define		ARRAY_LEN(x)	((int) (sizeof (x) / sizeof ((x) [0])))
  ------------------
  |  Branch (893:15): [True: 1.94k, False: 243]
  ------------------
  894|  1.94k|		bytes += psf_binheader_readf (psf, "b4", &c->post_timers [k].usage, make_size_t (4), &c->post_timers [k].value) ;
  895|       |
  896|    243|	bytes += psf_binheader_readf (psf, "b", c->reserved, sizeof (c->reserved)) ;
  897|    243|	bytes += psf_binheader_readf (psf, "b", c->url, sizeof (c->url)) ;
  898|       |
  899|    243|	if (chunksize > WAV_CART_MIN_CHUNK_SIZE)
  ------------------
  |  |   36|    243|#define WAV_CART_MIN_CHUNK_SIZE		2048
  ------------------
  |  Branch (899:6): [True: 104, False: 139]
  ------------------
  900|    104|	{	/* File has tag text. */
  901|    104|		c->tag_text_size = chunksize - WAV_CART_MIN_CHUNK_SIZE ;
  ------------------
  |  |   36|    104|#define WAV_CART_MIN_CHUNK_SIZE		2048
  ------------------
  902|    104|		bytes += psf_binheader_readf (psf, "b", c->tag_text, make_size_t (c->tag_text_size)) ;
  903|    104|		} ;
  904|       |
  905|    243|	if (bytes < chunksize)
  ------------------
  |  Branch (905:6): [True: 43, False: 200]
  ------------------
  906|     43|		psf_log_printf (psf, "  %d trailing bytes in cart chunk.\n", chunksize - bytes) ;
  907|       |
  908|    243|	return 0 ;
  909|    243|} /* wavlike_read_cart_chunk */
wavlike_subchunk_parse:
  956|  79.1k|{	sf_count_t	current_pos ;
  957|  79.1k|	char		buffer [2048] ;
  958|  79.1k|	uint32_t 	chunk_size, bytesread = 0 ;
  959|       |
  960|  79.1k|	current_pos = psf_fseek (psf, 0, SEEK_CUR) ;
  961|       |
  962|  79.1k|	if (chunk_length <= 8)
  ------------------
  |  Branch (962:6): [True: 2.52k, False: 76.6k]
  ------------------
  963|  2.52k|	{	/* This case is for broken files generated by PEAK. */
  964|  2.52k|		psf_log_printf (psf, "%M : %u (weird length)\n", chunk, chunk_length) ;
  965|  2.52k|		psf_binheader_readf (psf, "mj", &chunk, chunk_length - 4) ;
  966|  2.52k|		psf_log_printf (psf, "  %M\n", chunk) ;
  967|  2.52k|		return 0 ;
  968|  76.6k|		} ;
  969|       |
  970|  76.6k|	if (current_pos + chunk_length > psf->filelength)
  ------------------
  |  Branch (970:6): [True: 47.0k, False: 29.5k]
  ------------------
  971|  47.0k|	{	psf_log_printf (psf, "%M : %u (should be %d)\n", chunk, chunk_length, (int) (psf->filelength - current_pos)) ;
  972|  47.0k|		chunk_length = psf->filelength - current_pos ;
  973|  47.0k|		}
  974|  29.5k|	else
  975|  29.5k|		psf_log_printf (psf, "%M : %u\n", chunk, chunk_length) ;
  976|       |
  977|   498k|	while (bytesread < chunk_length)
  ------------------
  |  Branch (977:9): [True: 488k, False: 10.0k]
  ------------------
  978|   488k|	{	uint32_t thisread ;
  979|       |
  980|   488k|		if ((thisread = psf_binheader_readf (psf, "m", &chunk)) == 0)
  ------------------
  |  Branch (980:7): [True: 190, False: 488k]
  ------------------
  981|    190|			break ;
  982|   488k|		bytesread += thisread ;
  983|       |
  984|   488k|		switch (chunk)
  985|   488k|		{	case adtl_MARKER :
  ------------------
  |  |   29|    253|#define adtl_MARKER		MAKE_MARKER ('a', 'd', 't', 'l')
  |  |  ------------------
  |  |  |  |  122|    253|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (985:5): [True: 253, False: 487k]
  ------------------
  986|    827|			case INFO_MARKER :
  ------------------
  |  |   37|    827|#define INFO_MARKER		MAKE_MARKER ('I', 'N', 'F', 'O')
  |  |  ------------------
  |  |  |  |  122|    827|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (986:4): [True: 574, False: 487k]
  ------------------
  987|       |					/* These markers don't contain anything, not even a chunk length. */
  988|    827|					psf_log_printf (psf, "  %M\n", chunk) ;
  989|    827|					continue ;
  990|       |
  991|   148k|			case exif_MARKER :
  ------------------
  |  |   58|   148k|#define exif_MARKER		MAKE_MARKER ('e', 'x', 'i', 'f')
  |  |  ------------------
  |  |  |  |  122|   148k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (991:4): [True: 148k, False: 339k]
  ------------------
  992|   148k|					psf_log_printf (psf, "  %M\n", chunk) ;
  993|   148k|					if (chunk_length > bytesread)
  ------------------
  |  Branch (993:10): [True: 147k, False: 1.12k]
  ------------------
  994|   147k|						bytesread += exif_subchunk_parse (psf, chunk_length - bytesread) ;
  995|   148k|					continue ;
  996|       |
  997|  7.01k|			case data_MARKER :
  ------------------
  |  |   32|  7.01k|#define data_MARKER		MAKE_MARKER ('d', 'a', 't', 'a')
  |  |  ------------------
  |  |  |  |  122|  7.01k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (997:4): [True: 7.01k, False: 481k]
  ------------------
  998|  7.01k|					psf_log_printf (psf, "  %M inside a LIST block??? Backing out.\n", chunk) ;
  999|       |					/* Jump back four bytes and return to caller. */
 1000|  7.01k|					psf_binheader_readf (psf, "j", -4) ;
 1001|  7.01k|					return 0 ;
 1002|       |
 1003|  4.94k|			case 0 :
  ------------------
  |  Branch (1003:4): [True: 4.94k, False: 483k]
  ------------------
 1004|       |					/*
 1005|       |					**	Four zero bytes where a marker was expected. Assume this means
 1006|       |					**	the rest of the chunk is garbage.
 1007|       |					*/
 1008|  4.94k|					psf_log_printf (psf, "    *** Found weird-ass zero marker. Jumping to end of chunk.\n") ;
 1009|  4.94k|					goto cleanup_subchunk_parse ;
 1010|       |
 1011|   326k|			default :
  ------------------
  |  Branch (1011:4): [True: 326k, False: 161k]
  ------------------
 1012|   326k|					break ;
 1013|   488k|			} ;
 1014|       |
 1015|   326k|		switch (chunk)
 1016|   326k|		{	case ISFT_MARKER :
  ------------------
  |  |   42|  1.65k|#define ISFT_MARKER		MAKE_MARKER ('I', 'S', 'F', 'T')
  |  |  ------------------
  |  |  |  |  122|  1.65k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (1016:5): [True: 1.65k, False: 324k]
  ------------------
 1017|  4.30k|			case ICOP_MARKER :
  ------------------
  |  |   50|  4.30k|#define ICOP_MARKER		MAKE_MARKER ('I', 'C', 'O', 'P')
  |  |  ------------------
  |  |  |  |  122|  4.30k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (1017:4): [True: 2.65k, False: 323k]
  ------------------
 1018|  4.52k|			case IARL_MARKER :
  ------------------
  |  |   45|  4.52k|#define IARL_MARKER		MAKE_MARKER ('I', 'A', 'R', 'L')
  |  |  ------------------
  |  |  |  |  122|  4.52k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (1018:4): [True: 213, False: 326k]
  ------------------
 1019|   104k|			case IART_MARKER :
  ------------------
  |  |   46|   104k|#define IART_MARKER		MAKE_MARKER ('I', 'A', 'R', 'T')
  |  |  ------------------
  |  |  |  |  122|   104k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (1019:4): [True: 100k, False: 226k]
  ------------------
 1020|   113k|			case ICMT_MARKER :
  ------------------
  |  |   54|   113k|#define ICMT_MARKER		MAKE_MARKER ('I', 'C', 'M', 'T')
  |  |  ------------------
  |  |  |  |  122|   113k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (1020:4): [True: 8.76k, False: 317k]
  ------------------
 1021|   116k|			case ICRD_MARKER :
  ------------------
  |  |   43|   116k|#define ICRD_MARKER		MAKE_MARKER ('I', 'C', 'R', 'D')
  |  |  ------------------
  |  |  |  |  122|   116k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (1021:4): [True: 3.08k, False: 323k]
  ------------------
 1022|   118k|			case IENG_MARKER :
  ------------------
  |  |   48|   118k|#define IENG_MARKER		MAKE_MARKER ('I', 'E', 'N', 'G')
  |  |  ------------------
  |  |  |  |  122|   118k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (1022:4): [True: 1.94k, False: 324k]
  ------------------
 1023|   120k|			case IGNR_MARKER :
  ------------------
  |  |   49|   120k|#define IGNR_MARKER		MAKE_MARKER ('I', 'G', 'N', 'R')
  |  |  ------------------
  |  |  |  |  122|   120k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (1023:4): [True: 1.82k, False: 324k]
  ------------------
 1024|   125k|			case INAM_MARKER :
  ------------------
  |  |   47|   125k|#define INAM_MARKER		MAKE_MARKER ('I', 'N', 'A', 'M')
  |  |  ------------------
  |  |  |  |  122|   125k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (1024:4): [True: 5.51k, False: 321k]
  ------------------
 1025|   128k|			case IPRD_MARKER :
  ------------------
  |  |   51|   128k|#define IPRD_MARKER		MAKE_MARKER ('I', 'P', 'R', 'D')
  |  |  ------------------
  |  |  |  |  122|   128k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (1025:4): [True: 2.47k, False: 324k]
  ------------------
 1026|   132k|			case ISBJ_MARKER :
  ------------------
  |  |   53|   132k|#define ISBJ_MARKER		MAKE_MARKER ('I', 'S', 'B', 'J')
  |  |  ------------------
  |  |  |  |  122|   132k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (1026:4): [True: 3.98k, False: 322k]
  ------------------
 1027|   134k|			case ISRC_MARKER :
  ------------------
  |  |   52|   134k|#define ISRC_MARKER		MAKE_MARKER ('I', 'S', 'R', 'C')
  |  |  ------------------
  |  |  |  |  122|   134k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (1027:4): [True: 2.19k, False: 324k]
  ------------------
 1028|   134k|			case IAUT_MARKER :
  ------------------
  |  |   55|   134k|#define IAUT_MARKER		MAKE_MARKER ('I', 'A', 'U', 'T')
  |  |  ------------------
  |  |  |  |  122|   134k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (1028:4): [True: 204, False: 326k]
  ------------------
 1029|   136k|			case ITRK_MARKER :
  ------------------
  |  |   56|   136k|#define ITRK_MARKER		MAKE_MARKER ('I', 'T', 'R', 'K')
  |  |  ------------------
  |  |  |  |  122|   136k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (1029:4): [True: 1.93k, False: 324k]
  ------------------
 1030|   136k|					bytesread += psf_binheader_readf (psf, "4", &chunk_size) ;
 1031|   136k|					chunk_size += (chunk_size & 1) ;
 1032|   136k|					if (chunk_size >= SIGNED_SIZEOF (buffer) || bytesread + chunk_size > chunk_length)
  ------------------
  |  |   91|   273k|#define		SIGNED_SIZEOF(x)	((int) sizeof (x))
  ------------------
  |  Branch (1032:10): [True: 8.29k, False: 128k]
  |  Branch (1032:50): [True: 5.18k, False: 123k]
  ------------------
 1033|  13.4k|					{	psf_log_printf (psf, "  *** %M : %u (too big)\n", chunk, chunk_size) ;
 1034|  13.4k|						goto cleanup_subchunk_parse ;
 1035|   123k|						} ;
 1036|       |
 1037|   123k|					bytesread += psf_binheader_readf (psf, "b", buffer, chunk_size) ;
 1038|   123k|					buffer [chunk_size] = 0 ;
 1039|   123k|					psf_log_printf (psf, "    %M : %s\n", chunk, buffer) ;
 1040|   123k|					break ;
 1041|       |
 1042|  13.6k|			case labl_MARKER :
  ------------------
  |  |   33|  13.6k|#define labl_MARKER		MAKE_MARKER ('l', 'a', 'b', 'l')
  |  |  ------------------
  |  |  |  |  122|  13.6k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (1042:4): [True: 13.6k, False: 312k]
  ------------------
 1043|  13.6k|					{	int mark_id ;
 1044|       |
 1045|  13.6k|						bytesread += psf_binheader_readf (psf, "44", &chunk_size, &mark_id) ;
 1046|  13.6k|						chunk_size -= 4 ;
 1047|  13.6k|						chunk_size += (chunk_size & 1) ;
 1048|  13.6k|						if (chunk_size < 1 || chunk_size >= SIGNED_SIZEOF (buffer) || bytesread + chunk_size > chunk_length)
  ------------------
  |  |   91|  24.7k|#define		SIGNED_SIZEOF(x)	((int) sizeof (x))
  ------------------
  |  Branch (1048:11): [True: 2.59k, False: 11.0k]
  |  Branch (1048:29): [True: 3.49k, False: 7.57k]
  |  Branch (1048:69): [True: 2.62k, False: 4.95k]
  ------------------
 1049|  8.71k|						{	psf_log_printf (psf, "  *** %M : %u (too big)\n", chunk, chunk_size) ;
 1050|  8.71k|							goto cleanup_subchunk_parse ;
 1051|  8.71k|							} ;
 1052|       |
 1053|  4.95k|						bytesread += psf_binheader_readf (psf, "b", buffer, chunk_size) ;
 1054|  4.95k|						buffer [chunk_size] = 0 ;
 1055|       |
 1056|  4.95k|						if (mark_id < 10) /* avoid swamping log buffer with labels */
  ------------------
  |  Branch (1056:11): [True: 1.48k, False: 3.47k]
  ------------------
 1057|  1.48k|							psf_log_printf (psf, "    %M : %u : %s\n", chunk, mark_id, buffer) ;
 1058|  3.47k|						else if (mark_id == 10)
  ------------------
  |  Branch (1058:16): [True: 1.08k, False: 2.39k]
  ------------------
 1059|  1.08k|							psf_log_printf (psf, "    (Skipping)\n") ;
 1060|       |
 1061|  4.95k|						if (psf->cues)
  ------------------
  |  Branch (1061:11): [True: 723, False: 4.23k]
  ------------------
 1062|    723| 						{	unsigned int i = 0 ;
 1063|       |
 1064|       |							/* find id to store label */
 1065|  2.42k|							while (i < psf->cues->cue_count && psf->cues->cue_points [i].indx != mark_id)
  ------------------
  |  Branch (1065:15): [True: 1.94k, False: 487]
  |  Branch (1065:43): [True: 1.70k, False: 236]
  ------------------
 1066|  1.70k|								i++ ;
 1067|       |
 1068|    723|							if (i < psf->cues->cue_count)
  ------------------
  |  Branch (1068:12): [True: 236, False: 487]
  ------------------
 1069|    236|								memcpy (psf->cues->cue_points [i].name, buffer, sizeof (psf->cues->cue_points [i].name)) ;
 1070|    723|							} ;
 1071|  4.95k|						} ;
 1072|  4.95k|					break ;
 1073|       |
 1074|  4.93k|			case DISP_MARKER :
  ------------------
  |  |   36|  4.93k|#define DISP_MARKER		MAKE_MARKER ('D', 'I', 'S', 'P')
  |  |  ------------------
  |  |  |  |  122|  4.93k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (1074:4): [True: 4.93k, False: 321k]
  ------------------
 1075|  8.28k|			case ltxt_MARKER :
  ------------------
  |  |   34|  8.28k|#define ltxt_MARKER		MAKE_MARKER ('l', 't', 'x', 't')
  |  |  ------------------
  |  |  |  |  122|  8.28k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (1075:4): [True: 3.34k, False: 323k]
  ------------------
 1076|  9.29k|			case note_MARKER :
  ------------------
  |  |   35|  9.29k|#define note_MARKER		MAKE_MARKER ('n', 'o', 't', 'e')
  |  |  ------------------
  |  |  |  |  122|  9.29k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (1076:4): [True: 1.00k, False: 325k]
  ------------------
 1077|  9.29k|					bytesread += psf_binheader_readf (psf, "4", &chunk_size) ;
 1078|  9.29k|					chunk_size += (chunk_size & 1) ;
 1079|  9.29k|					if (chunk_size >= SIGNED_SIZEOF (buffer) || bytesread + chunk_size > chunk_length)
  ------------------
  |  |   91|  18.5k|#define		SIGNED_SIZEOF(x)	((int) sizeof (x))
  ------------------
  |  Branch (1079:10): [True: 2.95k, False: 6.34k]
  |  Branch (1079:50): [True: 3.78k, False: 2.55k]
  ------------------
 1080|  6.74k|					{	psf_log_printf (psf, "  *** %M : %u (too big)\n", chunk, chunk_size) ;
 1081|  6.74k|						goto cleanup_subchunk_parse ;
 1082|  6.74k|						} ;
 1083|       |
 1084|  2.55k|					psf_log_printf (psf, "    %M : %u\n", chunk, chunk_size) ;
 1085|  2.55k|					goto cleanup_subchunk_parse ;
 1086|       |
 1087|   166k|			default :
  ------------------
  |  Branch (1087:4): [True: 166k, False: 159k]
  ------------------
 1088|   166k|					bytesread += psf_binheader_readf (psf, "4", &chunk_size) ;
 1089|   166k|					chunk_size += (chunk_size & 1) ;
 1090|   166k|					if (bytesread + chunk_size > chunk_length)
  ------------------
  |  Branch (1090:10): [True: 22.9k, False: 144k]
  ------------------
 1091|  22.9k|					{	psf_log_printf (psf, "  *** %M : %u (too big)\n", chunk, chunk_size) ;
 1092|  22.9k|						goto cleanup_subchunk_parse ;
 1093|  22.9k|						}
 1094|   144k|					else
 1095|   144k|					{	psf_log_printf (psf, "    %M : %u\n", chunk, chunk_size) ;
 1096|   144k|						bytesread += psf_binheader_readf (psf, "j", chunk_size) ;
 1097|   144k|						} ;
 1098|   144k|					break ;
 1099|   326k|			} ;
 1100|       |
 1101|   272k|		switch (chunk)
  ------------------
  |  Branch (1101:11): [True: 121k, False: 150k]
  ------------------
 1102|   272k|		{	case ISFT_MARKER :
  ------------------
  |  |   42|  1.38k|#define ISFT_MARKER		MAKE_MARKER ('I', 'S', 'F', 'T')
  |  |  ------------------
  |  |  |  |  122|  1.38k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (1102:5): [True: 1.38k, False: 270k]
  ------------------
 1103|  1.38k|					psf_store_string (psf, SF_STR_SOFTWARE, buffer) ;
 1104|  1.38k|					break ;
 1105|  2.34k|			case ICOP_MARKER :
  ------------------
  |  |   50|  2.34k|#define ICOP_MARKER		MAKE_MARKER ('I', 'C', 'O', 'P')
  |  |  ------------------
  |  |  |  |  122|  2.34k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (1105:4): [True: 2.34k, False: 269k]
  ------------------
 1106|  2.34k|					psf_store_string (psf, SF_STR_COPYRIGHT, buffer) ;
 1107|  2.34k|					break ;
 1108|  4.25k|			case INAM_MARKER :
  ------------------
  |  |   47|  4.25k|#define INAM_MARKER		MAKE_MARKER ('I', 'N', 'A', 'M')
  |  |  ------------------
  |  |  |  |  122|  4.25k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (1108:4): [True: 4.25k, False: 267k]
  ------------------
 1109|  4.25k|					psf_store_string (psf, SF_STR_TITLE, buffer) ;
 1110|  4.25k|					break ;
 1111|  99.2k|			case IART_MARKER :
  ------------------
  |  |   46|  99.2k|#define IART_MARKER		MAKE_MARKER ('I', 'A', 'R', 'T')
  |  |  ------------------
  |  |  |  |  122|  99.2k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (1111:4): [True: 99.2k, False: 172k]
  ------------------
 1112|  99.2k|					psf_store_string (psf, SF_STR_ARTIST, buffer) ;
 1113|  99.2k|					break ;
 1114|  6.59k|			case ICMT_MARKER :
  ------------------
  |  |   54|  6.59k|#define ICMT_MARKER		MAKE_MARKER ('I', 'C', 'M', 'T')
  |  |  ------------------
  |  |  |  |  122|  6.59k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (1114:4): [True: 6.59k, False: 265k]
  ------------------
 1115|  6.59k|					psf_store_string (psf, SF_STR_COMMENT, buffer) ;
 1116|  6.59k|					break ;
 1117|  2.45k|			case ICRD_MARKER :
  ------------------
  |  |   43|  2.45k|#define ICRD_MARKER		MAKE_MARKER ('I', 'C', 'R', 'D')
  |  |  ------------------
  |  |  |  |  122|  2.45k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (1117:4): [True: 2.45k, False: 269k]
  ------------------
 1118|  2.45k|					psf_store_string (psf, SF_STR_DATE, buffer) ;
 1119|  2.45k|					break ;
 1120|  1.82k|			case IGNR_MARKER :
  ------------------
  |  |   49|  1.82k|#define IGNR_MARKER		MAKE_MARKER ('I', 'G', 'N', 'R')
  |  |  ------------------
  |  |  |  |  122|  1.82k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (1120:4): [True: 1.82k, False: 270k]
  ------------------
 1121|  1.82k|					psf_store_string (psf, SF_STR_GENRE, buffer) ;
 1122|  1.82k|					break ;
 1123|  1.81k|			case IPRD_MARKER :
  ------------------
  |  |   51|  1.81k|#define IPRD_MARKER		MAKE_MARKER ('I', 'P', 'R', 'D')
  |  |  ------------------
  |  |  |  |  122|  1.81k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (1123:4): [True: 1.81k, False: 270k]
  ------------------
 1124|  1.81k|					psf_store_string (psf, SF_STR_ALBUM, buffer) ;
 1125|  1.81k|					break ;
 1126|  1.92k|			case ITRK_MARKER :
  ------------------
  |  |   56|  1.92k|#define ITRK_MARKER		MAKE_MARKER ('I', 'T', 'R', 'K')
  |  |  ------------------
  |  |  |  |  122|  1.92k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (1126:4): [True: 1.92k, False: 270k]
  ------------------
 1127|  1.92k|					psf_store_string (psf, SF_STR_TRACKNUMBER, buffer) ;
 1128|  1.92k|					break ;
 1129|   272k|			} ;
 1130|   272k|		} ;
 1131|       |
 1132|  69.6k|cleanup_subchunk_parse :
 1133|       |
 1134|  69.6k|	if (chunk_length > bytesread)
  ------------------
  |  Branch (1134:6): [True: 52.3k, False: 17.2k]
  ------------------
 1135|  52.3k|		bytesread += psf_binheader_readf (psf, "j", chunk_length - bytesread) ;
 1136|       |
 1137|  69.6k|	return 0 ;
 1138|  10.2k|} /* wavlike_subchunk_parse */
wavlike_read_peak_chunk:
 1208|  7.84k|{	char		buffer [256] ;
 1209|  7.84k|	uint32_t uk ;
 1210|       |
 1211|  7.84k|	if (chunk_size != WAVLIKE_PEAK_CHUNK_SIZE (psf->sf.channels))
  ------------------
  |  |  337|  7.84k|#define		WAVLIKE_PEAK_CHUNK_SIZE(ch) (2 * sizeof (int) + ch * (sizeof (float) + sizeof (int)))
  ------------------
  |  Branch (1211:6): [True: 30, False: 7.81k]
  ------------------
 1212|     30|	{	psf_binheader_readf (psf, "j", chunk_size) ;
 1213|     30|		psf_log_printf (psf, "*** File PEAK chunk size doesn't fit with number of channels (%d).\n", psf->sf.channels) ;
 1214|     30|		return SFE_WAV_BAD_PEAK ;
 1215|  7.81k|		} ;
 1216|       |
 1217|  7.81k|	if (psf->peak_info)
  ------------------
  |  Branch (1217:6): [True: 7.72k, False: 88]
  ------------------
 1218|  7.72k|	{	psf_log_printf (psf, "*** Found existing peak info, using last one.\n") ;
 1219|  7.72k|		free (psf->peak_info) ;
 1220|  7.72k|		psf->peak_info = NULL ;
 1221|  7.72k|		} ;
 1222|  7.81k|	if ((psf->peak_info = peak_info_calloc (psf->sf.channels)) == NULL)
  ------------------
  |  Branch (1222:6): [True: 0, False: 7.81k]
  ------------------
 1223|      0|		return SFE_MALLOC_FAILED ;
 1224|       |
 1225|       |	/* read in rest of PEAK chunk. */
 1226|  7.81k|	psf_binheader_readf (psf, "44", & (psf->peak_info->version), & (psf->peak_info->timestamp)) ;
 1227|       |
 1228|  7.81k|	if (psf->peak_info->version != 1)
  ------------------
  |  Branch (1228:6): [True: 4.55k, False: 3.26k]
  ------------------
 1229|  4.55k|		psf_log_printf (psf, "  version    : %d *** (should be version 1)\n", psf->peak_info->version) ;
 1230|  3.26k|	else
 1231|  3.26k|		psf_log_printf (psf, "  version    : %d\n", psf->peak_info->version) ;
 1232|       |
 1233|  7.81k|	psf_log_printf (psf, "  time stamp : %d\n", psf->peak_info->timestamp) ;
 1234|  7.81k|	psf_log_printf (psf, "    Ch   Position       Value\n") ;
 1235|       |
 1236|  27.5k|	for (uk = 0 ; uk < (uint32_t) psf->sf.channels ; uk++)
  ------------------
  |  Branch (1236:16): [True: 19.7k, False: 7.81k]
  ------------------
 1237|  19.7k|	{	float value ;
 1238|  19.7k|		uint32_t position ;
 1239|       |
 1240|  19.7k|		psf_binheader_readf (psf, "f4", &value, &position) ;
 1241|  19.7k|		psf->peak_info->peaks [uk].value = value ;
 1242|  19.7k|		psf->peak_info->peaks [uk].position = position ;
 1243|       |
 1244|  19.7k|		snprintf (buffer, sizeof (buffer), "    %2d   %-12" PRId64 "   %g\n",
 1245|  19.7k|				uk, psf->peak_info->peaks [uk].position, psf->peak_info->peaks [uk].value) ;
 1246|  19.7k|		buffer [sizeof (buffer) - 1] = 0 ;
 1247|  19.7k|		psf_log_printf (psf, "%s", buffer) ;
 1248|  19.7k|		} ;
 1249|       |
 1250|  7.81k|	return 0 ;
 1251|  7.81k|} /* wavlike_read_peak_chunk */
wavlike.c:wavex_guid_equal:
  118|   132k|{	return !memcmp (first, second, sizeof (EXT_SUBFORMAT)) ;
  119|   132k|} /* wavex_guid_equal */
wavlike.c:exif_subchunk_parse:
 1293|   147k|{	uint32_t marker, dword = 0, vmajor = -1, vminor = -1, bytesread = 0 ;
 1294|   147k|	char buf [4096] ;
 1295|   147k|	int thisread ;
 1296|       |
 1297|   717k|	while (bytesread < length)
  ------------------
  |  Branch (1297:9): [True: 712k, False: 4.66k]
  ------------------
 1298|   712k|	{
 1299|   712k|		if ((thisread = psf_binheader_readf (psf, "m", &marker)) == 0)
  ------------------
  |  Branch (1299:7): [True: 126, False: 712k]
  ------------------
 1300|    126|			break ;
 1301|   712k|		bytesread += thisread ;
 1302|       |
 1303|   712k|		switch (marker)
 1304|   712k|		{
 1305|  43.2k|			case 0 : /* camera padding? */
  ------------------
  |  Branch (1305:4): [True: 43.2k, False: 669k]
  ------------------
 1306|  43.2k|				break ;
 1307|       |
 1308|  1.35k|			case ever_MARKER :
  ------------------
  |  |   59|  1.35k|#define ever_MARKER		MAKE_MARKER ('e', 'v', 'e', 'r')
  |  |  ------------------
  |  |  |  |  122|  1.35k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (1308:4): [True: 1.35k, False: 711k]
  ------------------
 1309|  1.35k|				bytesread += psf_binheader_readf (psf, "j4", 4, &dword) ;
 1310|  1.35k|				vmajor = 10 * (((dword >> 24) & 0xff) - '0') + (((dword >> 16) & 0xff) - '0') ;
 1311|  1.35k|				vminor = 10 * (((dword >> 8) & 0xff) - '0') + ((dword & 0xff) - '0') ;
 1312|  1.35k|				psf_log_printf (psf, "    EXIF Version : %u.%02u\n", vmajor, vminor) ;
 1313|  1.35k|				break ;
 1314|       |
 1315|  3.90k|			case olym_MARKER :
  ------------------
  |  |   66|  3.90k|#define olym_MARKER		MAKE_MARKER ('o', 'l', 'y', 'm')
  |  |  ------------------
  |  |  |  |  122|  3.90k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (1315:4): [True: 3.90k, False: 708k]
  ------------------
 1316|  3.90k|				bytesread += psf_binheader_readf (psf, "4", &dword) ;
 1317|  3.90k|				psf_log_printf (psf, "%M : %u\n", marker, dword) ;
 1318|  3.90k|				if (dword > length || bytesread + dword > length)
  ------------------
  |  Branch (1318:9): [True: 1.21k, False: 2.69k]
  |  Branch (1318:27): [True: 1.39k, False: 1.29k]
  ------------------
 1319|  2.61k|					break ;
 1320|  1.29k|				dword += (dword & 1) ;
 1321|  1.29k|				bytesread += psf_binheader_readf (psf, "j", dword) ;
 1322|  1.29k|				break ;
 1323|       |
 1324|   108k|			case emnt_MARKER : /* design information: null-terminated string */
  ------------------
  |  |   63|   108k|#define emnt_MARKER		MAKE_MARKER ('e', 'm', 'n', 't')
  |  |  ------------------
  |  |  |  |  122|   108k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (1324:4): [True: 108k, False: 603k]
  ------------------
 1325|   187k|			case emdl_MARKER : /* model name ; null-terminated string */
  ------------------
  |  |   62|   187k|#define emdl_MARKER		MAKE_MARKER ('e', 'm', 'd', 'l')
  |  |  ------------------
  |  |  |  |  122|   187k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (1325:4): [True: 79.0k, False: 633k]
  ------------------
 1326|   188k|			case ecor_MARKER : /* manufacturer: null-terminated string */
  ------------------
  |  |   61|   188k|#define ecor_MARKER		MAKE_MARKER ('e', 'c', 'o', 'r')
  |  |  ------------------
  |  |  |  |  122|   188k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (1326:4): [True: 271, False: 712k]
  ------------------
 1327|   188k|			case etim_MARKER : /* creation time: null-terminated string in the format "hour:minute:second.subsecond" */
  ------------------
  |  |   60|   188k|#define etim_MARKER		MAKE_MARKER ('e', 't', 'i', 'm')
  |  |  ------------------
  |  |  |  |  122|   188k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (1327:4): [True: 233, False: 712k]
  ------------------
 1328|   188k|			case erel_MARKER : /* relation info: null-terminated string (filename) */
  ------------------
  |  |   64|   188k|#define erel_MARKER		MAKE_MARKER ('e', 'r', 'e', 'l')
  |  |  ------------------
  |  |  |  |  122|   188k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (1328:4): [True: 441, False: 712k]
  ------------------
 1329|   189k|			case eucm_MARKER : /* user comment: 4-byte size follows, then possibly unicode data */
  ------------------
  |  |   65|   189k|#define eucm_MARKER		MAKE_MARKER ('e', 'u', 'c', 'm')
  |  |  ------------------
  |  |  |  |  122|   189k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (1329:4): [True: 336, False: 712k]
  ------------------
 1330|   189k|				bytesread += psf_binheader_readf (psf, "4", &dword) ;
 1331|   189k|				bytesread += sizeof (dword) ;
 1332|   189k|				dword += (dword & 1) ;
 1333|       |
 1334|   189k|				if (dword >= sizeof (buf))
  ------------------
  |  Branch (1334:9): [True: 140k, False: 48.2k]
  ------------------
 1335|   140k|				{	psf_log_printf (psf, "*** Marker '%M' is too big %u\n\n", marker, dword) ;
 1336|   140k|					return bytesread ;
 1337|   140k|					} ;
 1338|       |
 1339|  48.2k|				bytesread += exif_fill_and_sink (psf, buf, sizeof (buf), dword) ;
 1340|       |
 1341|       |				/* BAD - don't know what's going on here -- maybe a bug in the camera */
 1342|       |				/* field should be NULL-terminated but there's no room for it with the reported number */
 1343|       |				/*  example output:     emdl : 8 (EX-Z1050) */
 1344|  48.2k|				if (marker == emdl_MARKER && dword == strlen (buf) /* should be >= strlen+1*/)
  ------------------
  |  |   62|  48.2k|#define emdl_MARKER		MAKE_MARKER ('e', 'm', 'd', 'l')
  |  |  ------------------
  |  |  |  |  122|  96.4k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (1344:9): [True: 46.4k, False: 1.83k]
  |  Branch (1344:34): [True: 10.3k, False: 36.0k]
  ------------------
 1345|  10.3k|				{	psf_log_printf (psf, "    *** field size too small for string (sinking 2 bytes)\n") ;
 1346|  10.3k|					bytesread += psf_binheader_readf (psf, "j", 2) ;
 1347|  10.3k|					} ;
 1348|       |
 1349|  48.2k|				psf_log_printf (psf, "    %M : %u (%s)\n", marker, dword, buf) ;
 1350|  48.2k|				if (dword > length)
  ------------------
  |  Branch (1350:9): [True: 1.86k, False: 46.3k]
  ------------------
 1351|  1.86k|					return bytesread ;
 1352|  46.3k|				break ;
 1353|       |
 1354|   474k|			default :
  ------------------
  |  Branch (1354:4): [True: 474k, False: 237k]
  ------------------
 1355|   474k|				psf_log_printf (psf, "    *** %M (%u): -- ignored --\n", marker, marker) ;
 1356|   474k|				break ;
 1357|   712k|			} ;
 1358|   569k|		} ;
 1359|       |
 1360|  4.78k|	return bytesread ;
 1361|   147k|} /* exif_subchunk_parse */
wavlike.c:exif_fill_and_sink:
 1271|  48.2k|{
 1272|  48.2k|	size_t bytesread = 0 ;
 1273|       |
 1274|  48.2k|	buf [0] = 0 ;
 1275|  48.2k|	bufsz -= 1 ;
 1276|  48.2k|	if (toread < bufsz)
  ------------------
  |  Branch (1276:6): [True: 48.2k, False: 0]
  ------------------
 1277|  48.2k|		bufsz = toread ;
 1278|  48.2k|	bytesread = psf_binheader_readf (psf, "b", buf, bufsz) ;
 1279|  48.2k|	buf [bufsz] = 0 ;
 1280|       |
 1281|  48.2k|	if (bytesread == bufsz && toread > bufsz)
  ------------------
  |  Branch (1281:6): [True: 48.2k, False: 43]
  |  Branch (1281:28): [True: 0, False: 48.2k]
  ------------------
 1282|      0|		bytesread += psf_binheader_readf (psf, "j", toread - bufsz) ;
 1283|       |
 1284|  48.2k|	return bytesread ;
 1285|  48.2k|} /* exif_fill_and_sink */

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

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

