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

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

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

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

alac_decoder_init:
   61|  1.01k|{
   62|  1.01k|	int32_t		status = ALAC_noErr ;
   63|  1.01k|	ALACSpecificConfig theConfig ;
   64|  1.01k|	uint8_t * theActualCookie = (uint8_t *) inMagicCookie ;
   65|  1.01k|	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.01k|	if (theActualCookie [4] == 'f' && theActualCookie [5] == 'r' && theActualCookie [6] == 'm' && theActualCookie [7] == 'a')
  ------------------
  |  Branch (74:6): [True: 9, False: 1.00k]
  |  Branch (74:36): [True: 4, False: 5]
  |  Branch (74:66): [True: 2, False: 2]
  |  Branch (74:96): [True: 1, False: 1]
  ------------------
   75|      1|	{
   76|      1|		theActualCookie += 12 ;
   77|      1|		theCookieBytesRemaining -= 12 ;
   78|      1|	}
   79|       |
   80|       |	// skip 'alac' atom header if present
   81|  1.01k|	if (theActualCookie [4] == 'a' && theActualCookie [5] == 'l' && theActualCookie [6] == 'a' && theActualCookie [7] == 'c')
  ------------------
  |  Branch (81:6): [True: 11, False: 1.00k]
  |  Branch (81:36): [True: 9, False: 2]
  |  Branch (81:66): [True: 3, False: 6]
  |  Branch (81:96): [True: 2, False: 1]
  ------------------
   82|      2|	{
   83|      2|		theActualCookie += 12 ;
   84|      2|		theCookieBytesRemaining -= 12 ;
   85|      2|	}
   86|       |
   87|       |	// read the ALACSpecificConfig
   88|  1.01k|	if (theCookieBytesRemaining >= sizeof (ALACSpecificConfig))
  ------------------
  |  Branch (88:6): [True: 921, False: 94]
  ------------------
   89|    921|	{
   90|    921|		theConfig.frameLength = psf_get_be32 (theActualCookie, offsetof (ALACSpecificConfig, frameLength)) ;
   91|       |
   92|    921|		if (theConfig.frameLength > ALAC_FRAME_LENGTH)
  ------------------
  |  |   33|    921|#define		ALAC_FRAME_LENGTH	4096
  ------------------
  |  Branch (92:7): [True: 24, False: 897]
  ------------------
   93|     24|			return fALAC_FrameLengthError ;
   94|       |
   95|    897|		theConfig.compatibleVersion = theActualCookie [offsetof (ALACSpecificConfig, compatibleVersion)] ;
   96|    897|		theConfig.bitDepth = theActualCookie [offsetof (ALACSpecificConfig, bitDepth)] ;
   97|    897|		theConfig.pb = theActualCookie [offsetof (ALACSpecificConfig, pb)] ;
   98|    897|		theConfig.mb = theActualCookie [offsetof (ALACSpecificConfig, mb)] ;
   99|    897|		theConfig.kb = theActualCookie [offsetof (ALACSpecificConfig, kb)] ;
  100|    897|		theConfig.numChannels = theActualCookie [offsetof (ALACSpecificConfig, numChannels)] ;
  101|    897|		theConfig.maxRun = psf_get_be16 (theActualCookie, offsetof (ALACSpecificConfig, maxRun)) ;
  102|    897|		theConfig.maxFrameBytes = psf_get_be32 (theActualCookie, offsetof (ALACSpecificConfig, maxFrameBytes)) ;
  103|    897|		theConfig.avgBitRate = psf_get_be32 (theActualCookie, offsetof (ALACSpecificConfig, avgBitRate)) ;
  104|    897|		theConfig.sampleRate = psf_get_be32 (theActualCookie, offsetof (ALACSpecificConfig, sampleRate)) ;
  105|       |
  106|    897|		p->mConfig = theConfig ;
  107|    897|		p->mNumChannels = theConfig.numChannels ;
  108|       |
  109|    897|		RequireAction (p->mConfig.compatibleVersion <= kALACVersion, return kALAC_IncompatibleVersion ;) ;
  ------------------
  |  |   39|    897|#define RequireAction(condition, action)		if (! (condition)) { action }
  |  |  ------------------
  |  |  |  Branch (39:47): [True: 3, False: 894]
  |  |  ------------------
  ------------------
  110|    894|		RequireAction ((p->mConfig.bitDepth >= 8 && p->mConfig.bitDepth <= 32), return kALAC_BadBitWidth ;) ;
  ------------------
  |  |   39|  1.78k|#define RequireAction(condition, action)		if (! (condition)) { action }
  |  |  ------------------
  |  |  |  Branch (39:50): [True: 890, False: 4]
  |  |  |  Branch (39:50): [True: 886, False: 4]
  |  |  ------------------
  ------------------
  111|    886|		RequireAction ((p->mMixBufferU != NULL) && (p->mMixBufferV != NULL) && (p->u.mPredictor != NULL),
  ------------------
  |  |   39|  3.54k|#define RequireAction(condition, action)		if (! (condition)) { action }
  |  |  ------------------
  |  |  |  Branch (39:50): [True: 886, False: 0]
  |  |  |  Branch (39:50): [True: 886, False: 0]
  |  |  |  Branch (39:50): [True: 886, False: 0]
  |  |  ------------------
  ------------------
  112|    886|						status = kALAC_MemFullError ; goto Exit ;) ;
  113|    886|	}
  114|     94|	else
  115|     94|	{
  116|     94|		status = kALAC_BadSpecificConfigSize ;
  117|     94|	}
  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|    980|Exit:
  126|    980|	return status ;
  127|  1.01k|}
alac_decode:
  136|  27.6k|{
  137|  27.6k|	BitBuffer		shiftBits ;
  138|  27.6k|	uint32_t		bits1, bits2 ;
  139|  27.6k|	uint8_t			tag ;
  140|  27.6k|	uint8_t			elementInstanceTag ;
  141|  27.6k|	AGParamRec		agParams ;
  142|  27.6k|	uint32_t		channelIndex ;
  143|  27.6k|	int16_t			coefsU [32] ;		// max possible size is 32 although NUMCOEPAIRS is the current limit
  144|  27.6k|	int16_t			coefsV [32] ;
  145|  27.6k|	uint8_t			numU, numV ;
  146|  27.6k|	uint8_t			mixBits ;
  147|  27.6k|	int8_t			mixRes ;
  148|  27.6k|	uint16_t		unusedHeader ;
  149|  27.6k|	uint8_t			escapeFlag ;
  150|  27.6k|	uint32_t		chanBits ;
  151|  27.6k|	uint8_t			bytesShifted ;
  152|  27.6k|	uint32_t		shift ;
  153|  27.6k|	uint8_t			modeU, modeV ;
  154|  27.6k|	uint32_t		denShiftU, denShiftV ;
  155|  27.6k|	uint16_t		pbFactorU, pbFactorV ;
  156|  27.6k|	uint16_t		pb ;
  157|  27.6k|	int32_t *		out32 ;
  158|  27.6k|	uint8_t			headerByte ;
  159|  27.6k|	uint8_t			partialFrame ;
  160|  27.6k|	uint32_t		extraBits ;
  161|  27.6k|	int32_t			val ;
  162|  27.6k|	uint32_t		i, j ;
  163|  27.6k|	int32_t			status ;
  164|  27.6k|	uint32_t		numChannels = p->mNumChannels ;
  165|       |
  166|  27.6k|	RequireAction ((bits != NULL) && (sampleBuffer != NULL) && (outNumSamples != NULL), return kALAC_ParamError ;) ;
  ------------------
  |  |   39|   110k|#define RequireAction(condition, action)		if (! (condition)) { action }
  |  |  ------------------
  |  |  |  Branch (39:50): [True: 27.6k, False: 0]
  |  |  |  Branch (39:50): [True: 27.6k, False: 0]
  |  |  |  Branch (39:50): [True: 27.6k, False: 0]
  |  |  ------------------
  ------------------
  167|  27.6k|	RequireAction (p->mNumChannels > 0, return kALAC_ZeroChannelCount ;) ;
  ------------------
  |  |   39|  27.6k|#define RequireAction(condition, action)		if (! (condition)) { action }
  |  |  ------------------
  |  |  |  Branch (39:47): [True: 1, False: 27.6k]
  |  |  ------------------
  ------------------
  168|       |
  169|  27.6k|	p->mActiveElements = 0 ;
  170|  27.6k|	channelIndex	= 0 ;
  171|       |
  172|  27.6k|	status = ALAC_noErr ;
  173|  27.6k|	*outNumSamples = numSamples ;
  174|       |
  175|  54.5k|	while (status == ALAC_noErr)
  ------------------
  |  Branch (175:9): [True: 51.4k, False: 3.04k]
  ------------------
  176|  51.4k|	{
  177|       |		// bail if we ran off the end of the buffer
  178|  51.4k|		RequireAction (bits->cur < bits->end, status = kALAC_ParamError ; goto Exit ;) ;
  ------------------
  |  |   39|  51.4k|#define RequireAction(condition, action)		if (! (condition)) { action }
  |  |  ------------------
  |  |  |  Branch (39:47): [True: 4.27k, False: 47.2k]
  |  |  ------------------
  ------------------
  179|       |
  180|       |		// copy global decode params for this element
  181|  47.2k|		pb = p->mConfig.pb ;
  182|       |
  183|       |		// read element tag
  184|  47.2k|		tag = BitBufferReadSmall (bits, 3) ;
  185|  47.2k|		switch (tag)
  ------------------
  |  Branch (185:11): [True: 47.2k, False: 0]
  ------------------
  186|  47.2k|		{
  187|  30.5k|			case ID_SCE:
  ------------------
  |  Branch (187:4): [True: 30.5k, False: 16.6k]
  ------------------
  188|  31.8k|			case ID_LFE:
  ------------------
  |  Branch (188:4): [True: 1.28k, False: 45.9k]
  ------------------
  189|  31.8k|			{
  190|       |				// mono/LFE channel
  191|  31.8k|				elementInstanceTag = BitBufferReadSmall (bits, 4) ;
  192|  31.8k|				p->mActiveElements |= (1u << elementInstanceTag) ;
  193|       |
  194|       |				// read the 12 unused header bits
  195|  31.8k|				unusedHeader = (uint16_t) BitBufferRead (bits, 12) ;
  196|  31.8k|				RequireAction (unusedHeader == 0, status = kALAC_ParamError ; goto Exit ;) ;
  ------------------
  |  |   39|  31.8k|#define RequireAction(condition, action)		if (! (condition)) { action }
  |  |  ------------------
  |  |  |  Branch (39:47): [True: 10.6k, False: 21.1k]
  |  |  ------------------
  ------------------
  197|       |
  198|       |				// read the 1-bit "partial frame" flag, 2-bit "shift-off" flag & 1-bit "escape" flag
  199|  21.1k|				headerByte = (uint8_t) BitBufferRead (bits, 4) ;
  200|       |
  201|  21.1k|				partialFrame = headerByte >> 3 ;
  202|       |
  203|  21.1k|				bytesShifted = (headerByte >> 1) & 0x3u ;
  204|  21.1k|				RequireAction (bytesShifted != 3, status = kALAC_ParamError ; goto Exit ;) ;
  ------------------
  |  |   39|  21.1k|#define RequireAction(condition, action)		if (! (condition)) { action }
  |  |  ------------------
  |  |  |  Branch (39:47): [True: 470, False: 20.6k]
  |  |  ------------------
  ------------------
  205|       |
  206|  20.6k|				shift = bytesShifted * 8 ;
  207|       |
  208|  20.6k|				escapeFlag = headerByte & 0x1 ;
  209|       |
  210|  20.6k|				chanBits = p->mConfig.bitDepth - (bytesShifted * 8) ;
  211|       |
  212|       |				// check for partial frame to override requested numSamples
  213|  20.6k|				if (partialFrame != 0)
  ------------------
  |  Branch (213:9): [True: 2.81k, False: 17.8k]
  ------------------
  214|  2.81k|				{
  215|  2.81k|					numSamples = BitBufferRead (bits, 16) << 16 ;
  216|  2.81k|					numSamples |= BitBufferRead (bits, 16) ;
  217|       |
  218|  2.81k|					RequireAction (numSamples < kALACDefaultFramesPerPacket, return kALAC_NumSamplesTooBig ;) ;
  ------------------
  |  |   39|  2.81k|#define RequireAction(condition, action)		if (! (condition)) { action }
  |  |  ------------------
  |  |  |  Branch (39:47): [True: 548, False: 2.26k]
  |  |  ------------------
  ------------------
  219|  2.26k|				}
  220|       |
  221|  20.1k|				if (escapeFlag == 0)
  ------------------
  |  Branch (221:9): [True: 17.0k, False: 3.08k]
  ------------------
  222|  17.0k|				{
  223|       |					// compressed frame, read rest of parameters
  224|  17.0k|					mixBits	= (uint8_t) BitBufferRead (bits, 8) ;
  225|  17.0k|					mixRes	= (int8_t) BitBufferRead (bits, 8) ;
  226|       |					//Assert ((mixBits == 0) && (mixRes == 0)) ;		// no mixing for mono
  227|       |
  228|  17.0k|					headerByte	= (uint8_t) BitBufferRead (bits, 8) ;
  229|  17.0k|					modeU		= headerByte >> 4 ;
  230|  17.0k|					denShiftU	= headerByte & 0xfu ;
  231|       |
  232|  17.0k|					headerByte	= (uint8_t) BitBufferRead (bits, 8) ;
  233|  17.0k|					pbFactorU	= headerByte >> 5 ;
  234|  17.0k|					numU		= headerByte & 0x1fu ;
  235|       |
  236|  59.7k|					for (i = 0 ; i < numU ; i++)
  ------------------
  |  Branch (236:19): [True: 42.6k, False: 17.0k]
  ------------------
  237|  42.6k|						coefsU [i] = (int16_t) BitBufferRead (bits, 16) ;
  238|       |
  239|       |					// if shift active, skip the shift buffer but remember where it starts
  240|  17.0k|					if (bytesShifted != 0)
  ------------------
  |  Branch (240:10): [True: 4.55k, False: 12.4k]
  ------------------
  241|  4.55k|					{
  242|  4.55k|						shiftBits = *bits ;
  243|  4.55k|						BitBufferAdvance (bits, (bytesShifted * 8) * numSamples) ;
  244|  4.55k|					}
  245|       |
  246|       |					// decompress
  247|  17.0k|					set_ag_params (&agParams, p->mConfig.mb, (pb * pbFactorU) / 4, p->mConfig.kb, numSamples, numSamples, p->mConfig.maxRun) ;
  248|  17.0k|					status = dyn_decomp (&agParams, bits, p->u.mPredictor, numSamples, chanBits, &bits1) ;
  249|  17.0k|					RequireNoErr (status, goto Exit ;) ;
  ------------------
  |  |   41|  17.0k|#define RequireNoErr(condition, action)			if (condition) { action }
  |  |  ------------------
  |  |  |  Branch (41:47): [True: 2.85k, False: 14.1k]
  |  |  ------------------
  ------------------
  250|       |
  251|  14.1k|					if (modeU == 0)
  ------------------
  |  Branch (251:10): [True: 10.3k, False: 3.80k]
  ------------------
  252|  10.3k|					{
  253|  10.3k|						unpc_block (p->u.mPredictor, p->mMixBufferU, numSamples, &coefsU [0], numU, chanBits, denShiftU) ;
  254|  10.3k|					}
  255|  3.80k|					else
  256|  3.80k|					{
  257|       |						// the special "numActive == 31" mode can be done in-place
  258|  3.80k|						unpc_block (p->u.mPredictor, p->u.mPredictor, numSamples, NULL, 31, chanBits, 0) ;
  259|  3.80k|						unpc_block (p->u.mPredictor, p->mMixBufferU, numSamples, &coefsU [0], numU, chanBits, denShiftU) ;
  260|  3.80k|					}
  261|  14.1k|				}
  262|  3.08k|				else
  263|  3.08k|				{
  264|       |					//Assert (bytesShifted == 0) ;
  265|       |
  266|       |					// uncompressed frame, copy data into the mix buffer to use common output code
  267|  3.08k|					shift = 32 - chanBits ;
  268|  3.08k|					if (chanBits <= 16)
  ------------------
  |  Branch (268:10): [True: 1.52k, False: 1.56k]
  ------------------
  269|  1.52k|					{
  270|   475k|						for (i = 0 ; i < numSamples ; i++)
  ------------------
  |  Branch (270:20): [True: 474k, False: 1.52k]
  ------------------
  271|   474k|						{
  272|   474k|							val = (int32_t) BitBufferRead (bits, (uint8_t) chanBits) ;
  273|   474k|							val = (val << shift) >> shift ;
  274|   474k|							p->mMixBufferU [i] = val ;
  275|   474k|						}
  276|  1.52k|					}
  277|  1.56k|					else
  278|  1.56k|					{
  279|       |						// BitBufferRead () can't read more than 16 bits at a time so break up the reads
  280|  1.56k|						extraBits = chanBits - 16 ;
  281|   662k|						for (i = 0 ; i < numSamples ; i++)
  ------------------
  |  Branch (281:20): [True: 660k, False: 1.56k]
  ------------------
  282|   660k|						{
  283|   660k|							val = (int32_t) BitBufferRead (bits, 16) ;
  284|   660k|							val = arith_shift_left (val, 16) >> shift ;
  285|   660k|							p->mMixBufferU [i] = val | BitBufferRead (bits, (uint8_t) extraBits) ;
  286|   660k|						}
  287|  1.56k|					}
  288|       |
  289|  3.08k|					mixBits = mixRes = 0 ;
  290|  3.08k|					bits1 = chanBits * numSamples ;
  291|  3.08k|					bytesShifted = 0 ;
  292|  3.08k|				}
  293|       |
  294|       |				// now read the shifted values into the shift buffer
  295|  17.2k|				if (bytesShifted != 0)
  ------------------
  |  Branch (295:9): [True: 4.08k, False: 13.1k]
  ------------------
  296|  4.08k|				{
  297|  4.08k|					shift = bytesShifted * 8 ;
  298|       |					//Assert (shift <= 16) ;
  299|       |
  300|  12.2k|					for (i = 0 ; i < numSamples ; i++)
  ------------------
  |  Branch (300:19): [True: 8.19k, False: 4.08k]
  ------------------
  301|  8.19k|						p->u.mShiftBuffer [i] = (uint16_t) BitBufferRead (&shiftBits, (uint8_t) shift) ;
  302|  4.08k|				}
  303|       |
  304|       |				// convert 32-bit integers into output buffer
  305|  17.2k|				switch (p->mConfig.bitDepth)
  ------------------
  |  Branch (305:13): [True: 14.7k, False: 2.51k]
  ------------------
  306|  17.2k|				{
  307|  1.74k|					case 16:
  ------------------
  |  Branch (307:6): [True: 1.74k, False: 15.5k]
  ------------------
  308|  1.74k|						out32 = sampleBuffer + channelIndex ;
  309|  67.2k|						for (i = 0, j = 0 ; i < numSamples ; i++, j += numChannels)
  ------------------
  |  Branch (309:27): [True: 65.4k, False: 1.74k]
  ------------------
  310|  65.4k|							out32 [j] = arith_shift_left (p->mMixBufferU [i], 16) ;
  311|  1.74k|						break ;
  312|  2.62k|					case 20:
  ------------------
  |  Branch (312:6): [True: 2.62k, False: 14.6k]
  ------------------
  313|  2.62k|						out32 = sampleBuffer + channelIndex ;
  314|  2.62k|						copyPredictorTo20 (p->mMixBufferU, out32, numChannels, numSamples) ;
  315|  2.62k|						break ;
  316|  4.92k|					case 24:
  ------------------
  |  Branch (316:6): [True: 4.92k, False: 12.3k]
  ------------------
  317|  4.92k|						out32 = sampleBuffer + channelIndex ;
  318|  4.92k|						if (bytesShifted != 0)
  ------------------
  |  Branch (318:11): [True: 966, False: 3.96k]
  ------------------
  319|    966|							copyPredictorTo24Shift (p->mMixBufferU, p->u.mShiftBuffer, out32, numChannels, numSamples, bytesShifted) ;
  320|  3.96k|						else
  321|  3.96k|							copyPredictorTo24 (p->mMixBufferU, out32, numChannels, numSamples) ;
  322|  4.92k|						break ;
  323|  5.46k|					case 32:
  ------------------
  |  Branch (323:6): [True: 5.46k, False: 11.7k]
  ------------------
  324|  5.46k|						out32 = sampleBuffer + channelIndex ;
  325|  5.46k|						if (bytesShifted != 0)
  ------------------
  |  Branch (325:11): [True: 2.03k, False: 3.42k]
  ------------------
  326|  2.03k|							copyPredictorTo32Shift (p->mMixBufferU, p->u.mShiftBuffer, out32, numChannels, numSamples, bytesShifted) ;
  327|  3.42k|						else
  328|  3.42k|							copyPredictorTo32 (p->mMixBufferU, out32, numChannels, numSamples) ;
  329|  5.46k|						break ;
  330|  17.2k|				}
  331|       |
  332|  17.2k|				channelIndex += 1 ;
  333|  17.2k|				*outNumSamples = numSamples ;
  334|  17.2k|				break ;
  335|  17.2k|			}
  336|       |
  337|  9.26k|			case ID_CPE:
  ------------------
  |  Branch (337:4): [True: 9.26k, False: 37.9k]
  ------------------
  338|  9.26k|			{
  339|       |				// if decoding this pair would take us over the max channels limit, bail
  340|  9.26k|				if ((channelIndex + 2) > numChannels)
  ------------------
  |  Branch (340:9): [True: 272, False: 8.99k]
  ------------------
  341|    272|					goto NoMoreChannels ;
  342|       |
  343|       |				// stereo channel pair
  344|  8.99k|				elementInstanceTag = BitBufferReadSmall (bits, 4) ;
  345|  8.99k|				p->mActiveElements |= (1u << elementInstanceTag) ;
  346|       |
  347|       |				// read the 12 unused header bits
  348|  8.99k|				unusedHeader = (uint16_t) BitBufferRead (bits, 12) ;
  349|  8.99k|				RequireAction (unusedHeader == 0, status = kALAC_ParamError ; goto Exit ;) ;
  ------------------
  |  |   39|  8.99k|#define RequireAction(condition, action)		if (! (condition)) { action }
  |  |  ------------------
  |  |  |  Branch (39:47): [True: 1.60k, False: 7.38k]
  |  |  ------------------
  ------------------
  350|       |
  351|       |				// read the 1-bit "partial frame" flag, 2-bit "shift-off" flag & 1-bit "escape" flag
  352|  7.38k|				headerByte = (uint8_t) BitBufferRead (bits, 4) ;
  353|       |
  354|  7.38k|				partialFrame = headerByte >> 3 ;
  355|       |
  356|  7.38k|				bytesShifted = (headerByte >> 1) & 0x3u ;
  357|  7.38k|				RequireAction (bytesShifted != 3, status = kALAC_ParamError ; goto Exit ;) ;
  ------------------
  |  |   39|  7.38k|#define RequireAction(condition, action)		if (! (condition)) { action }
  |  |  ------------------
  |  |  |  Branch (39:47): [True: 264, False: 7.12k]
  |  |  ------------------
  ------------------
  358|       |
  359|  7.12k|				shift = bytesShifted * 8 ;
  360|       |
  361|  7.12k|				escapeFlag = headerByte & 0x1 ;
  362|       |
  363|  7.12k|				chanBits = p->mConfig.bitDepth - (bytesShifted * 8) + 1 ;
  364|       |
  365|       |				// check for partial frame length to override requested numSamples
  366|  7.12k|				if (partialFrame != 0)
  ------------------
  |  Branch (366:9): [True: 3.58k, False: 3.53k]
  ------------------
  367|  3.58k|				{
  368|  3.58k|					numSamples = BitBufferRead (bits, 16) << 16 ;
  369|  3.58k|					numSamples |= BitBufferRead (bits, 16) ;
  370|       |
  371|  3.58k|					RequireAction (numSamples < kALACDefaultFramesPerPacket, return kALAC_NumSamplesTooBig ;) ;
  ------------------
  |  |   39|  3.58k|#define RequireAction(condition, action)		if (! (condition)) { action }
  |  |  ------------------
  |  |  |  Branch (39:47): [True: 399, False: 3.18k]
  |  |  ------------------
  ------------------
  372|  3.18k|				}
  373|       |
  374|  6.72k|				if (escapeFlag == 0)
  ------------------
  |  Branch (374:9): [True: 4.41k, False: 2.30k]
  ------------------
  375|  4.41k|				{
  376|       |					// compressed frame, read rest of parameters
  377|  4.41k|					mixBits		= (uint8_t) BitBufferRead (bits, 8) ;
  378|  4.41k|					mixRes		= (int8_t) BitBufferRead (bits, 8) ;
  379|       |
  380|  4.41k|					headerByte	= (uint8_t) BitBufferRead (bits, 8) ;
  381|  4.41k|					modeU		= headerByte >> 4 ;
  382|  4.41k|					denShiftU	= headerByte & 0xfu ;
  383|       |
  384|  4.41k|					headerByte	= (uint8_t) BitBufferRead (bits, 8) ;
  385|  4.41k|					pbFactorU	= headerByte >> 5 ;
  386|  4.41k|					numU		= headerByte & 0x1fu ;
  387|  13.2k|					for (i = 0 ; i < numU ; i++)
  ------------------
  |  Branch (387:19): [True: 8.81k, False: 4.41k]
  ------------------
  388|  8.81k|						coefsU [i] = (int16_t) BitBufferRead (bits, 16) ;
  389|       |
  390|  4.41k|					headerByte	= (uint8_t) BitBufferRead (bits, 8) ;
  391|  4.41k|					modeV		= headerByte >> 4 ;
  392|  4.41k|					denShiftV	= headerByte & 0xfu ;
  393|       |
  394|  4.41k|					headerByte	= (uint8_t) BitBufferRead (bits, 8) ;
  395|  4.41k|					pbFactorV	= headerByte >> 5 ;
  396|  4.41k|					numV		= headerByte & 0x1fu ;
  397|  22.4k|					for (i = 0 ; i < numV ; i++)
  ------------------
  |  Branch (397:19): [True: 18.0k, False: 4.41k]
  ------------------
  398|  18.0k|						coefsV [i] = (int16_t) BitBufferRead (bits, 16) ;
  399|       |
  400|       |					// if shift active, skip the interleaved shifted values but remember where they start
  401|  4.41k|					if (bytesShifted != 0)
  ------------------
  |  Branch (401:10): [True: 872, False: 3.54k]
  ------------------
  402|    872|					{
  403|    872|						shiftBits = *bits ;
  404|    872|						BitBufferAdvance (bits, (bytesShifted * 8) * 2 * numSamples) ;
  405|    872|					}
  406|       |
  407|       |					// decompress and run predictor for "left" channel
  408|  4.41k|					set_ag_params (&agParams, p->mConfig.mb, (pb * pbFactorU) / 4, p->mConfig.kb, numSamples, numSamples, p->mConfig.maxRun) ;
  409|  4.41k|					status = dyn_decomp (&agParams, bits, p->u.mPredictor, numSamples, chanBits, &bits1) ;
  410|  4.41k|					RequireNoErr (status, goto Exit ;) ;
  ------------------
  |  |   41|  4.41k|#define RequireNoErr(condition, action)			if (condition) { action }
  |  |  ------------------
  |  |  |  Branch (41:47): [True: 1.00k, False: 3.41k]
  |  |  ------------------
  ------------------
  411|       |
  412|  3.41k|					if (modeU == 0)
  ------------------
  |  Branch (412:10): [True: 2.77k, False: 640]
  ------------------
  413|  2.77k|					{
  414|  2.77k|						unpc_block (p->u.mPredictor, p->mMixBufferU, numSamples, &coefsU [0], numU, chanBits, denShiftU) ;
  415|  2.77k|					}
  416|    640|					else
  417|    640|					{
  418|       |						// the special "numActive == 31" mode can be done in-place
  419|    640|						unpc_block (p->u.mPredictor, p->u.mPredictor, numSamples, NULL, 31, chanBits, 0) ;
  420|    640|						unpc_block (p->u.mPredictor, p->mMixBufferU, numSamples, &coefsU [0], numU, chanBits, denShiftU) ;
  421|    640|					}
  422|       |
  423|       |					// decompress and run predictor for "right" channel
  424|  3.41k|					set_ag_params (&agParams, p->mConfig.mb, (pb * pbFactorV) / 4, p->mConfig.kb, numSamples, numSamples, p->mConfig.maxRun) ;
  425|  3.41k|					status = dyn_decomp (&agParams, bits, p->u.mPredictor, numSamples, chanBits, &bits2) ;
  426|  3.41k|					RequireNoErr (status, goto Exit ;) ;
  ------------------
  |  |   41|  3.41k|#define RequireNoErr(condition, action)			if (condition) { action }
  |  |  ------------------
  |  |  |  Branch (41:47): [True: 235, False: 3.17k]
  |  |  ------------------
  ------------------
  427|       |
  428|  3.17k|					if (modeV == 0)
  ------------------
  |  Branch (428:10): [True: 1.47k, False: 1.70k]
  ------------------
  429|  1.47k|					{
  430|  1.47k|						unpc_block (p->u.mPredictor, p->mMixBufferV, numSamples, &coefsV [0], numV, chanBits, denShiftV) ;
  431|  1.47k|					}
  432|  1.70k|					else
  433|  1.70k|					{
  434|       |						// the special "numActive == 31" mode can be done in-place
  435|  1.70k|						unpc_block (p->u.mPredictor, p->u.mPredictor, numSamples, NULL, 31, chanBits, 0) ;
  436|  1.70k|						unpc_block (p->u.mPredictor, p->mMixBufferV, numSamples, &coefsV [0], numV, chanBits, denShiftV) ;
  437|  1.70k|					}
  438|  3.17k|				}
  439|  2.30k|				else
  440|  2.30k|				{
  441|       |					//Assert (bytesShifted == 0) ;
  442|       |
  443|       |					// uncompressed frame, copy data into the mix buffers to use common output code
  444|  2.30k|					chanBits = p->mConfig.bitDepth ;
  445|  2.30k|					shift = 32 - chanBits ;
  446|  2.30k|					if (chanBits <= 16)
  ------------------
  |  Branch (446:10): [True: 563, False: 1.74k]
  ------------------
  447|    563|					{
  448|  24.0k|						for (i = 0 ; i < numSamples ; i++)
  ------------------
  |  Branch (448:20): [True: 23.4k, False: 563]
  ------------------
  449|  23.4k|						{
  450|  23.4k|							val = (int32_t) BitBufferRead (bits, (uint8_t) chanBits) ;
  451|  23.4k|							val = (val << shift) >> shift ;
  452|  23.4k|							p->mMixBufferU [i] = val ;
  453|       |
  454|  23.4k|							val = (int32_t) BitBufferRead (bits, (uint8_t) chanBits) ;
  455|  23.4k|							val = (val << shift) >> shift ;
  456|  23.4k|							p->mMixBufferV [i] = val ;
  457|  23.4k|						}
  458|    563|					}
  459|  1.74k|					else
  460|  1.74k|					{
  461|       |						// BitBufferRead () can't read more than 16 bits at a time so break up the reads
  462|  1.74k|						extraBits = chanBits - 16 ;
  463|  63.3k|						for (i = 0 ; i < numSamples ; i++)
  ------------------
  |  Branch (463:20): [True: 61.6k, False: 1.74k]
  ------------------
  464|  61.6k|						{
  465|  61.6k|							val = (int32_t) BitBufferRead (bits, 16) ;
  466|  61.6k|							val = (((uint32_t) val) << 16) >> shift ;
  467|  61.6k|							p->mMixBufferU [i] = val | BitBufferRead (bits, (uint8_t) extraBits) ;
  468|       |
  469|  61.6k|							val = (int32_t) BitBufferRead (bits, 16) ;
  470|  61.6k|							val = ((uint32_t) val) >> shift ;
  471|  61.6k|							p->mMixBufferV [i] = val | BitBufferRead (bits, (uint8_t) extraBits) ;
  472|  61.6k|						}
  473|  1.74k|					}
  474|       |
  475|  2.30k|					bits1 = chanBits * numSamples ;
  476|  2.30k|					bits2 = chanBits * numSamples ;
  477|  2.30k|					mixBits = mixRes = 0 ;
  478|  2.30k|					bytesShifted = 0 ;
  479|  2.30k|				}
  480|       |
  481|       |				// now read the shifted values into the shift buffer
  482|  5.48k|				if (bytesShifted != 0)
  ------------------
  |  Branch (482:9): [True: 515, False: 4.97k]
  ------------------
  483|    515|				{
  484|    515|					shift = bytesShifted * 8 ;
  485|       |					//Assert (shift <= 16) ;
  486|       |
  487|  3.16k|					for (i = 0 ; i < (numSamples * 2) ; i += 2)
  ------------------
  |  Branch (487:19): [True: 2.64k, False: 515]
  ------------------
  488|  2.64k|					{
  489|  2.64k|						p->u.mShiftBuffer [i + 0] = (uint16_t) BitBufferRead (&shiftBits, (uint8_t) shift) ;
  490|  2.64k|						p->u.mShiftBuffer [i + 1] = (uint16_t) BitBufferRead (&shiftBits, (uint8_t) shift) ;
  491|  2.64k|					}
  492|    515|				}
  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.48k|				switch (p->mConfig.bitDepth)
  ------------------
  |  Branch (496:13): [True: 5.19k, False: 289]
  ------------------
  497|  5.48k|				{
  498|    977|					case 16:
  ------------------
  |  Branch (498:6): [True: 977, False: 4.51k]
  ------------------
  499|    977|						out32 = sampleBuffer + channelIndex ;
  500|    977|						unmix16 (p->mMixBufferU, p->mMixBufferV, out32, numChannels, numSamples, mixBits, mixRes) ;
  501|    977|						break ;
  502|  1.28k|					case 20:
  ------------------
  |  Branch (502:6): [True: 1.28k, False: 4.20k]
  ------------------
  503|  1.28k|						out32 = sampleBuffer + channelIndex ;
  504|  1.28k|						unmix20 (p->mMixBufferU, p->mMixBufferV, out32, numChannels, numSamples, mixBits, mixRes) ;
  505|  1.28k|						break ;
  506|  1.43k|					case 24:
  ------------------
  |  Branch (506:6): [True: 1.43k, False: 4.04k]
  ------------------
  507|  1.43k|						out32 = sampleBuffer + channelIndex ;
  508|  1.43k|						unmix24 (p->mMixBufferU, p->mMixBufferV, out32, numChannels, numSamples,
  509|  1.43k|									mixBits, mixRes, p->u.mShiftBuffer, bytesShifted) ;
  510|  1.43k|						break ;
  511|  1.49k|					case 32:
  ------------------
  |  Branch (511:6): [True: 1.49k, False: 3.98k]
  ------------------
  512|  1.49k|						out32 = sampleBuffer + channelIndex ;
  513|  1.49k|						unmix32 (p->mMixBufferU, p->mMixBufferV, out32, numChannels, numSamples,
  514|  1.49k|									mixBits, mixRes, p->u.mShiftBuffer, bytesShifted) ;
  515|  1.49k|						break ;
  516|  5.48k|				}
  517|       |
  518|  5.48k|				channelIndex += 2 ;
  519|  5.48k|				*outNumSamples = numSamples ;
  520|  5.48k|				break ;
  521|  5.48k|			}
  522|       |
  523|  1.08k|			case ID_CCE:
  ------------------
  |  Branch (523:4): [True: 1.08k, False: 46.1k]
  ------------------
  524|  1.53k|			case ID_PCE:
  ------------------
  |  Branch (524:4): [True: 451, False: 46.7k]
  ------------------
  525|  1.53k|			{
  526|       |				// unsupported element, bail
  527|       |				//AssertNoErr (tag) ;
  528|  1.53k|				status = kALAC_UnsupportedElement ;
  529|  1.53k|				break ;
  530|  1.08k|			}
  531|       |
  532|  1.33k|			case ID_DSE:
  ------------------
  |  Branch (532:4): [True: 1.33k, False: 45.8k]
  ------------------
  533|  1.33k|			{
  534|       |				// data stream element -- parse but ignore
  535|  1.33k|				status = alac_data_stream_element (bits) ;
  536|  1.33k|				break ;
  537|  1.08k|			}
  538|       |
  539|  1.69k|			case ID_FIL:
  ------------------
  |  Branch (539:4): [True: 1.69k, False: 45.5k]
  ------------------
  540|  1.69k|			{
  541|       |				// fill element -- parse but ignore
  542|  1.69k|				status = alac_fill_element (bits) ;
  543|  1.69k|				break ;
  544|  1.08k|			}
  545|       |
  546|  1.54k|			case ID_END:
  ------------------
  |  Branch (546:4): [True: 1.54k, False: 45.6k]
  ------------------
  547|  1.54k|			{
  548|       |				// frame end, all done so byte align the frame and check for overruns
  549|  1.54k|				BitBufferByteAlign (bits, false) ;
  550|       |				//Assert (bits->cur == bits->end) ;
  551|  1.54k|				goto Exit ;
  552|  1.08k|			}
  553|  47.2k|		}
  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: 478, False: 26.8k]
  ------------------
  559|    478|			break ;
  560|  27.3k|#endif
  561|  27.3k|	}
  562|       |
  563|  3.79k|NoMoreChannels:
  564|       |
  565|       |	// if we get here and haven't decoded all of the requested channels, fill the remaining channels with zeros
  566|   201k|	for ( ; channelIndex < numChannels ; channelIndex++)
  ------------------
  |  Branch (566:10): [True: 197k, False: 3.79k]
  ------------------
  567|   197k|	{
  568|   197k|		int32_t *	fill32 = sampleBuffer + channelIndex ;
  569|   197k|		Zero32 (fill32, numSamples, numChannels) ;
  570|   197k|	}
  571|       |
  572|  26.7k|Exit:
  573|  26.7k|	return status ;
  574|  3.79k|}
alac_decoder.c:alac_fill_element:
  586|  1.69k|{
  587|  1.69k|	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.69k|	count = BitBufferReadSmall (bits, 4) ;
  592|  1.69k|	if (count == 15)
  ------------------
  |  Branch (592:6): [True: 240, False: 1.45k]
  ------------------
  593|    240|		count += (int16_t) BitBufferReadSmall (bits, 8) - 1 ;
  594|       |
  595|  1.69k|	BitBufferAdvance (bits, count * 8) ;
  596|       |
  597|  1.69k|	RequireAction (bits->cur <= bits->end, return kALAC_ParamError ;) ;
  ------------------
  |  |   39|  1.69k|#define RequireAction(condition, action)		if (! (condition)) { action }
  |  |  ------------------
  |  |  |  Branch (39:47): [True: 744, False: 948]
  |  |  ------------------
  ------------------
  598|       |
  599|    948|	return ALAC_noErr ;
  600|  1.69k|}
alac_decoder.c:alac_data_stream_element:
  608|  1.33k|{
  609|  1.33k|	int32_t		data_byte_align_flag ;
  610|  1.33k|	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.33k|	data_byte_align_flag = BitBufferReadOne (bits) ;
  617|       |
  618|       |	// 8-bit count or (8-bit + 8-bit count) if 8-bit count == 255
  619|  1.33k|	count = BitBufferReadSmall (bits, 8) ;
  620|  1.33k|	if (count == 255)
  ------------------
  |  Branch (620:6): [True: 236, False: 1.09k]
  ------------------
  621|    236|		count += BitBufferReadSmall (bits, 8) ;
  622|       |
  623|       |	// the align flag means the bitstream should be byte-aligned before reading the following data bytes
  624|  1.33k|	if (data_byte_align_flag)
  ------------------
  |  Branch (624:6): [True: 515, False: 817]
  ------------------
  625|    515|		BitBufferByteAlign (bits, false) ;
  626|       |
  627|       |	// skip the data bytes
  628|  1.33k|	BitBufferAdvance (bits, count * 8) ;
  629|       |
  630|  1.33k|	RequireAction (bits->cur <= bits->end, return kALAC_ParamError ;) ;
  ------------------
  |  |   39|  1.33k|#define RequireAction(condition, action)		if (! (condition)) { action }
  |  |  ------------------
  |  |  |  Branch (39:47): [True: 765, False: 567]
  |  |  ------------------
  ------------------
  631|       |
  632|    567|	return ALAC_noErr ;
  633|  1.33k|}
alac_decoder.c:Zero32:
  640|   197k|{
  641|   197k|	if (stride == 1)
  ------------------
  |  Branch (641:6): [True: 547, False: 197k]
  ------------------
  642|    547|	{
  643|    547|		memset (buffer, 0, numItems * sizeof (int32_t)) ;
  644|    547|	}
  645|   197k|	else
  646|   197k|	{
  647|  35.6M|		for (uint32_t indx = 0 ; indx < (numItems * stride) ; indx += stride)
  ------------------
  |  Branch (647:28): [True: 35.4M, False: 197k]
  ------------------
  648|  35.4M|			buffer [indx] = 0 ;
  649|   197k|	}
  650|   197k|}

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.7k, False: 11.1k]
  ------------------
   68|  15.7k|	{
   69|       |		// just copy if numactive == 0 (but don't bother if in/out pointers the same)
   70|  15.7k|		if ((num > 1) && (pc1 != out))
  ------------------
  |  Branch (70:7): [True: 12.5k, False: 3.18k]
  |  Branch (70:20): [True: 12.5k, False: 0]
  ------------------
   71|  12.5k|			memcpy (&out [1], &pc1 [1], (num - 1) * sizeof (int32_t)) ;
   72|  15.7k|		return ;
   73|  15.7k|	}
   74|  11.1k|	if (numactive == 31)
  ------------------
  |  Branch (74:6): [True: 6.19k, False: 4.99k]
  ------------------
   75|  6.19k|	{
   76|       |		// short-circuit if numactive == 31
   77|  6.19k|		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.19k|		prev = out [0] ;
   88|   945k|		for (j = 1 ; j < num ; j++)
  ------------------
  |  Branch (88:16): [True: 938k, False: 6.19k]
  ------------------
   89|   938k|		{
   90|   938k|			del = pc1 [j] + prev ;
   91|   938k|			prev = (del << chanshift) >> chanshift ;
   92|   938k|			out [j] = prev ;
   93|   938k|		}
   94|  6.19k|		return ;
   95|  6.19k|	}
   96|       |
   97|  30.2k|	for (j = 1 ; j <= numactive ; j++)
  ------------------
  |  Branch (97:15): [True: 25.2k, False: 4.99k]
  ------------------
   98|  25.2k|	{
   99|  25.2k|		del = pc1 [j] + out [j-1] ;
  100|  25.2k|		out [j] = arith_shift_left (del, chanshift) >> chanshift ;
  101|  25.2k|	}
  102|       |
  103|  4.99k|	lim = numactive + 1 ;
  104|       |
  105|  4.99k|	if (numactive == 4)
  ------------------
  |  Branch (105:6): [True: 1.08k, False: 3.90k]
  ------------------
  106|  1.08k|	{
  107|       |		// optimization for numactive == 4
  108|  1.08k|		register int16_t	ia0, ia1, ia2, ia3 ;
  109|  1.08k|		register int32_t	ib0, ib1, ib2, ib3 ;
  110|       |
  111|  1.08k|		ia0 = coefs [0] ;
  112|  1.08k|		ia1 = coefs [1] ;
  113|  1.08k|		ia2 = coefs [2] ;
  114|  1.08k|		ia3 = coefs [3] ;
  115|       |
  116|   430k|		for (j = lim ; j < num ; j++)
  ------------------
  |  Branch (116:18): [True: 429k, False: 1.08k]
  ------------------
  117|   429k|		{
  118|   429k|			LOOP_ALIGN
  119|       |
  120|   429k|			top = out [j - lim] ;
  121|   429k|			pout = out + j - 1 ;
  122|       |
  123|   429k|			ib0 = top - pout [0] ;
  124|   429k|			ib1 = top - pout [-1] ;
  125|   429k|			ib2 = top - pout [-2] ;
  126|   429k|			ib3 = top - pout [-3] ;
  127|       |
  128|   429k|			sum1 = (denhalf - ia0 * ib0 - ia1 * ib1 - ia2 * ib2 - ia3 * ib3) >> denshift ;
  129|       |
  130|   429k|			del = pc1 [j] ;
  131|   429k|			del0 = del ;
  132|   429k|			sg = sign_of_int (del) ;
  133|   429k|			del += top + sum1 ;
  134|       |
  135|   429k|			out [j] = arith_shift_left (del, chanshift) >> chanshift ;
  136|       |
  137|   429k|			if (sg > 0)
  ------------------
  |  Branch (137:8): [True: 23.7k, False: 405k]
  ------------------
  138|  23.7k|			{
  139|  23.7k|				sgn = sign_of_int (ib3) ;
  140|  23.7k|				ia3 -= sgn ;
  141|  23.7k|				del0 -= (4 - 3) * ((sgn * ib3) >> denshift) ;
  142|  23.7k|				if (del0 <= 0)
  ------------------
  |  Branch (142:9): [True: 6.94k, False: 16.7k]
  ------------------
  143|  6.94k|					continue ;
  144|       |
  145|  16.7k|				sgn = sign_of_int (ib2) ;
  146|  16.7k|				ia2 -= sgn ;
  147|  16.7k|				del0 -= (4 - 2) * ((sgn * ib2) >> denshift) ;
  148|  16.7k|				if (del0 <= 0)
  ------------------
  |  Branch (148:9): [True: 6.96k, False: 9.80k]
  ------------------
  149|  6.96k|					continue ;
  150|       |
  151|  9.80k|				sgn = sign_of_int (ib1) ;
  152|  9.80k|				ia1 -= sgn ;
  153|  9.80k|				del0 -= (4 - 1) * ((sgn * ib1) >> denshift) ;
  154|  9.80k|				if (del0 <= 0)
  ------------------
  |  Branch (154:9): [True: 3.23k, False: 6.57k]
  ------------------
  155|  3.23k|					continue ;
  156|       |
  157|  6.57k|				ia0 -= sign_of_int (ib0) ;
  158|  6.57k|			}
  159|   405k|			else if (sg < 0)
  ------------------
  |  Branch (159:13): [True: 43.7k, False: 362k]
  ------------------
  160|  43.7k|			{
  161|       |				// note: to avoid unnecessary negations, we flip the value of "sgn"
  162|  43.7k|				sgn = -sign_of_int (ib3) ;
  163|  43.7k|				ia3 -= sgn ;
  164|  43.7k|				del0 -= (4 - 3) * ((sgn * ib3) >> denshift) ;
  165|  43.7k|				if (del0 >= 0)
  ------------------
  |  Branch (165:9): [True: 9.13k, False: 34.5k]
  ------------------
  166|  9.13k|					continue ;
  167|       |
  168|  34.5k|				sgn = -sign_of_int (ib2) ;
  169|  34.5k|				ia2 -= sgn ;
  170|  34.5k|				del0 -= (4 - 2) * ((sgn * ib2) >> denshift) ;
  171|  34.5k|				if (del0 >= 0)
  ------------------
  |  Branch (171:9): [True: 6.47k, False: 28.1k]
  ------------------
  172|  6.47k|					continue ;
  173|       |
  174|  28.1k|				sgn = -sign_of_int (ib1) ;
  175|  28.1k|				ia1 -= sgn ;
  176|  28.1k|				del0 -= (4 - 1) * ((sgn * ib1) >> denshift) ;
  177|  28.1k|				if (del0 >= 0)
  ------------------
  |  Branch (177:9): [True: 3.91k, False: 24.1k]
  ------------------
  178|  3.91k|					continue ;
  179|       |
  180|  24.1k|				ia0 += sign_of_int (ib0) ;
  181|  24.1k|			}
  182|   429k|		}
  183|       |
  184|  1.08k|		coefs [0] = ia0 ;
  185|  1.08k|		coefs [1] = ia1 ;
  186|  1.08k|		coefs [2] = ia2 ;
  187|  1.08k|		coefs [3] = ia3 ;
  188|  1.08k|	}
  189|  3.90k|	else if (numactive == 8)
  ------------------
  |  Branch (189:11): [True: 776, False: 3.12k]
  ------------------
  190|    776|	{
  191|    776|		register int16_t	a4, a5, a6, a7 ;
  192|    776|		register int32_t	b4, b5, b6, b7 ;
  193|       |
  194|       |		// optimization for numactive == 8
  195|    776|		a0 = coefs [0] ;
  196|    776|		a1 = coefs [1] ;
  197|    776|		a2 = coefs [2] ;
  198|    776|		a3 = coefs [3] ;
  199|    776|		a4 = coefs [4] ;
  200|    776|		a5 = coefs [5] ;
  201|    776|		a6 = coefs [6] ;
  202|    776|		a7 = coefs [7] ;
  203|       |
  204|   431k|		for (j = lim ; j < num ; j++)
  ------------------
  |  Branch (204:18): [True: 430k, False: 776]
  ------------------
  205|   430k|		{
  206|   430k|			LOOP_ALIGN
  207|       |
  208|   430k|			top = out [j - lim] ;
  209|   430k|			pout = out + j - 1 ;
  210|       |
  211|   430k|			b0 = top - (*pout--) ;
  212|   430k|			b1 = top - (*pout--) ;
  213|   430k|			b2 = top - (*pout--) ;
  214|   430k|			b3 = top - (*pout--) ;
  215|   430k|			b4 = top - (*pout--) ;
  216|   430k|			b5 = top - (*pout--) ;
  217|   430k|			b6 = top - (*pout--) ;
  218|   430k|			b7 = top - (*pout) ;
  219|   430k|			pout += 8 ;
  220|       |
  221|   430k|			sum1 = (denhalf - a0 * b0 - a1 * b1 - a2 * b2 - a3 * b3
  222|   430k|					- a4 * b4 - a5 * b5 - a6 * b6 - a7 * b7) >> denshift ;
  223|       |
  224|   430k|			del = pc1 [j] ;
  225|   430k|			del0 = del ;
  226|   430k|			sg = sign_of_int (del) ;
  227|   430k|			del += top + sum1 ;
  228|       |
  229|   430k|			out [j] = arith_shift_left (del, chanshift) >> chanshift ;
  230|       |
  231|   430k|			if (sg > 0)
  ------------------
  |  Branch (231:8): [True: 209k, False: 220k]
  ------------------
  232|   209k|			{
  233|   209k|				sgn = sign_of_int (b7) ;
  234|   209k|				a7 -= sgn ;
  235|   209k|				del0 -= 1 * ((sgn * b7) >> denshift) ;
  236|   209k|				if (del0 <= 0)
  ------------------
  |  Branch (236:9): [True: 35.0k, False: 174k]
  ------------------
  237|  35.0k|					continue ;
  238|       |
  239|   174k|				sgn = sign_of_int (b6) ;
  240|   174k|				a6 -= sgn ;
  241|   174k|				del0 -= 2 * ((sgn * b6) >> denshift) ;
  242|   174k|				if (del0 <= 0)
  ------------------
  |  Branch (242:9): [True: 55.2k, False: 119k]
  ------------------
  243|  55.2k|					continue ;
  244|       |
  245|   119k|				sgn = sign_of_int (b5) ;
  246|   119k|				a5 -= sgn ;
  247|   119k|				del0 -= 3 * ((sgn * b5) >> denshift) ;
  248|   119k|				if (del0 <= 0)
  ------------------
  |  Branch (248:9): [True: 44.3k, False: 74.7k]
  ------------------
  249|  44.3k|					continue ;
  250|       |
  251|  74.7k|				sgn = sign_of_int (b4) ;
  252|  74.7k|				a4 -= sgn ;
  253|  74.7k|				del0 -= 4 * ((sgn * b4) >> denshift) ;
  254|  74.7k|				if (del0 <= 0)
  ------------------
  |  Branch (254:9): [True: 22.4k, False: 52.2k]
  ------------------
  255|  22.4k|					continue ;
  256|       |
  257|  52.2k|				sgn = sign_of_int (b3) ;
  258|  52.2k|				a3 -= sgn ;
  259|  52.2k|				del0 -= 5 * ((sgn * b3) >> denshift) ;
  260|  52.2k|				if (del0 <= 0)
  ------------------
  |  Branch (260:9): [True: 8.69k, False: 43.5k]
  ------------------
  261|  8.69k|					continue ;
  262|       |
  263|  43.5k|				sgn = sign_of_int (b2) ;
  264|  43.5k|				a2 -= sgn ;
  265|  43.5k|				del0 -= 6 * ((sgn * b2) >> denshift) ;
  266|  43.5k|				if (del0 <= 0)
  ------------------
  |  Branch (266:9): [True: 4.50k, False: 39.0k]
  ------------------
  267|  4.50k|					continue ;
  268|       |
  269|  39.0k|				sgn = sign_of_int (b1) ;
  270|  39.0k|				a1 -= sgn ;
  271|  39.0k|				del0 -= 7 * ((sgn * b1) >> denshift) ;
  272|  39.0k|				if (del0 <= 0)
  ------------------
  |  Branch (272:9): [True: 2.54k, False: 36.4k]
  ------------------
  273|  2.54k|					continue ;
  274|       |
  275|  36.4k|				a0 -= sign_of_int (b0) ;
  276|  36.4k|			}
  277|   220k|			else if (sg < 0)
  ------------------
  |  Branch (277:13): [True: 115k, False: 105k]
  ------------------
  278|   115k|			{
  279|       |				// note: to avoid unnecessary negations, we flip the value of "sgn"
  280|   115k|				sgn = -sign_of_int (b7) ;
  281|   115k|				a7 -= sgn ;
  282|   115k|				del0 -= 1 * ((sgn * b7) >> denshift) ;
  283|   115k|				if (del0 >= 0)
  ------------------
  |  Branch (283:9): [True: 12.1k, False: 103k]
  ------------------
  284|  12.1k|					continue ;
  285|       |
  286|   103k|				sgn = -sign_of_int (b6) ;
  287|   103k|				a6 -= sgn ;
  288|   103k|				del0 -= 2 * ((sgn * b6) >> denshift) ;
  289|   103k|				if (del0 >= 0)
  ------------------
  |  Branch (289:9): [True: 20.0k, False: 83.1k]
  ------------------
  290|  20.0k|					continue ;
  291|       |
  292|  83.1k|				sgn = -sign_of_int (b5) ;
  293|  83.1k|				a5 -= sgn ;
  294|  83.1k|				del0 -= 3 * ((sgn * b5) >> denshift) ;
  295|  83.1k|				if (del0 >= 0)
  ------------------
  |  Branch (295:9): [True: 26.0k, False: 57.1k]
  ------------------
  296|  26.0k|					continue ;
  297|       |
  298|  57.1k|				sgn = -sign_of_int (b4) ;
  299|  57.1k|				a4 -= sgn ;
  300|  57.1k|				del0 -= 4 * ((sgn * b4) >> denshift) ;
  301|  57.1k|				if (del0 >= 0)
  ------------------
  |  Branch (301:9): [True: 18.8k, False: 38.3k]
  ------------------
  302|  18.8k|					continue ;
  303|       |
  304|  38.3k|				sgn = -sign_of_int (b3) ;
  305|  38.3k|				a3 -= sgn ;
  306|  38.3k|				del0 -= 5 * ((sgn * b3) >> denshift) ;
  307|  38.3k|				if (del0 >= 0)
  ------------------
  |  Branch (307:9): [True: 12.1k, False: 26.1k]
  ------------------
  308|  12.1k|					continue ;
  309|       |
  310|  26.1k|				sgn = -sign_of_int (b2) ;
  311|  26.1k|				a2 -= sgn ;
  312|  26.1k|				del0 -= 6 * ((sgn * b2) >> denshift) ;
  313|  26.1k|				if (del0 >= 0)
  ------------------
  |  Branch (313:9): [True: 7.94k, False: 18.1k]
  ------------------
  314|  7.94k|					continue ;
  315|       |
  316|  18.1k|				sgn = -sign_of_int (b1) ;
  317|  18.1k|				a1 -= sgn ;
  318|  18.1k|				del0 -= 7 * ((sgn * b1) >> denshift) ;
  319|  18.1k|				if (del0 >= 0)
  ------------------
  |  Branch (319:9): [True: 4.66k, False: 13.5k]
  ------------------
  320|  4.66k|					continue ;
  321|       |
  322|  13.5k|				a0 += sign_of_int (b0) ;
  323|  13.5k|			}
  324|   430k|		}
  325|       |
  326|    776|		coefs [0] = a0 ;
  327|    776|		coefs [1] = a1 ;
  328|    776|		coefs [2] = a2 ;
  329|    776|		coefs [3] = a3 ;
  330|    776|		coefs [4] = a4 ;
  331|    776|		coefs [5] = a5 ;
  332|    776|		coefs [6] = a6 ;
  333|    776|		coefs [7] = a7 ;
  334|    776|	}
  335|  3.12k|	else
  336|  3.12k|	{
  337|       |		// general case
  338|   713k|		for (j = lim ; j < num ; j++)
  ------------------
  |  Branch (338:18): [True: 710k, False: 3.12k]
  ------------------
  339|   710k|		{
  340|   710k|			LOOP_ALIGN
  341|       |
  342|   710k|			sum1 = 0 ;
  343|   710k|			pout = out + j - 1 ;
  344|   710k|			top = out [j-lim] ;
  345|       |
  346|  4.62M|			for (k = 0 ; k < numactive ; k++)
  ------------------
  |  Branch (346:17): [True: 3.91M, False: 710k]
  ------------------
  347|  3.91M|				sum1 += coefs [k] * (pout [-k] - top) ;
  348|       |
  349|   710k|			del = pc1 [j] ;
  350|   710k|			del0 = del ;
  351|   710k|			sg = sign_of_int (del) ;
  352|   710k|			del += top + ((sum1 + denhalf) >> denshift) ;
  353|   710k|			out [j] = (del << chanshift) >> chanshift ;
  354|       |
  355|   710k|			if (sg > 0)
  ------------------
  |  Branch (355:8): [True: 100k, False: 609k]
  ------------------
  356|   100k|			{
  357|   681k|				for (k = (numactive - 1) ; k >= 0 ; k--)
  ------------------
  |  Branch (357:32): [True: 628k, False: 52.6k]
  ------------------
  358|   628k|				{
  359|   628k|					dd = top - pout [-k] ;
  360|   628k|					sgn = sign_of_int (dd) ;
  361|   628k|					coefs [k] -= sgn ;
  362|   628k|					del0 -= (numactive - k) * ((sgn * dd) >> denshift) ;
  363|   628k|					if (del0 <= 0)
  ------------------
  |  Branch (363:10): [True: 48.3k, False: 580k]
  ------------------
  364|  48.3k|						break ;
  365|   628k|				}
  366|   100k|			}
  367|   609k|			else if (sg < 0)
  ------------------
  |  Branch (367:13): [True: 155k, False: 453k]
  ------------------
  368|   155k|			{
  369|  1.50M|				for (k = (numactive - 1) ; k >= 0 ; k--)
  ------------------
  |  Branch (369:32): [True: 1.38M, False: 121k]
  ------------------
  370|  1.38M|				{
  371|  1.38M|					dd = top - pout [-k] ;
  372|  1.38M|					sgn = sign_of_int (dd) ;
  373|  1.38M|					coefs [k] += sgn ;
  374|  1.38M|					del0 -= (numactive - k) * ((-sgn * dd) >> denshift) ;
  375|  1.38M|					if (del0 >= 0)
  ------------------
  |  Branch (375:10): [True: 34.3k, False: 1.34M]
  ------------------
  376|  34.3k|						break ;
  377|  1.38M|				}
  378|   155k|			}
  379|   710k|		}
  380|  3.12k|	}
  381|  4.99k|}
dp_dec.c:sign_of_int:
   47|  4.97M|{
   48|  4.97M|	int32_t negishift ;
   49|       |
   50|  4.97M|	negishift = ((uint32_t) - i) >> 31 ;
   51|  4.97M|	return negishift | (i >> 31) ;
   52|  4.97M|}

unmix16:
   66|    977|{
   67|    977|	int32_t 	j ;
   68|       |
   69|    977|	if (mixres != 0)
  ------------------
  |  Branch (69:6): [True: 476, False: 501]
  ------------------
   70|    476|	{
   71|       |		/* matrixed stereo */
   72|  2.04k|		for (j = 0 ; j < numSamples ; j++)
  ------------------
  |  Branch (72:16): [True: 1.56k, False: 476]
  ------------------
   73|  1.56k|		{
   74|  1.56k|			int32_t		l, r ;
   75|       |
   76|  1.56k|			l = u [j] + v [j] - ((mixres * v [j]) >> mixbits) ;
   77|  1.56k|			r = l - v [j] ;
   78|       |
   79|  1.56k|			out [0] = arith_shift_left (l, 16) ;
   80|  1.56k|			out [1] = arith_shift_left (r, 16) ;
   81|  1.56k|			out += stride ;
   82|  1.56k|		}
   83|    476|	}
   84|    501|	else
   85|    501|	{
   86|       |		/* Conventional separated stereo. */
   87|  24.3k|		for (j = 0 ; j < numSamples ; j++)
  ------------------
  |  Branch (87:16): [True: 23.8k, False: 501]
  ------------------
   88|  23.8k|		{
   89|  23.8k|			out [0] = u [j] << 16 ;
   90|  23.8k|			out [1] = v [j] << 16 ;
   91|  23.8k|			out += stride ;
   92|  23.8k|		}
   93|    501|	}
   94|    977|}
unmix20:
  101|  1.28k|{
  102|  1.28k|	int32_t 	j ;
  103|       |
  104|  1.28k|	if (mixres != 0)
  ------------------
  |  Branch (104:6): [True: 581, False: 703]
  ------------------
  105|    581|	{
  106|       |		/* matrixed stereo */
  107|  12.7k|		for (j = 0 ; j < numSamples ; j++)
  ------------------
  |  Branch (107:16): [True: 12.1k, False: 581]
  ------------------
  108|  12.1k|		{
  109|  12.1k|			int32_t		l, r ;
  110|       |
  111|  12.1k|			l = u [j] + v [j] - ((mixres * v [j]) >> mixbits) ;
  112|  12.1k|			r = l - v [j] ;
  113|       |
  114|  12.1k|			out [0] = arith_shift_left (l, 12) ;
  115|  12.1k|			out [1] = arith_shift_left (r, 12) ;
  116|  12.1k|			out += stride ;
  117|  12.1k|		}
  118|    581|	}
  119|    703|	else
  120|    703|	{
  121|       |		/* Conventional separated stereo. */
  122|  7.45k|		for (j = 0 ; j < numSamples ; j++)
  ------------------
  |  Branch (122:16): [True: 6.75k, False: 703]
  ------------------
  123|  6.75k|		{
  124|  6.75k|			out [0] = arith_shift_left (u [j], 12) ;
  125|  6.75k|			out [1] = arith_shift_left (v [j], 12) ;
  126|  6.75k|			out += stride ;
  127|  6.75k|		}
  128|    703|	}
  129|  1.28k|}
unmix24:
  137|  1.43k|{
  138|  1.43k|	int32_t		shift = bytesShifted * 8 ;
  139|  1.43k|	int32_t		l, r ;
  140|  1.43k|	int32_t 		j, k ;
  141|       |
  142|  1.43k|	if (mixres != 0)
  ------------------
  |  Branch (142:6): [True: 772, False: 666]
  ------------------
  143|    772|	{
  144|       |		/* matrixed stereo */
  145|    772|		if (bytesShifted != 0)
  ------------------
  |  Branch (145:7): [True: 113, False: 659]
  ------------------
  146|    113|		{
  147|    857|			for (j = 0, k = 0 ; j < numSamples ; j++, k += 2)
  ------------------
  |  Branch (147:24): [True: 744, False: 113]
  ------------------
  148|    744|			{
  149|    744|				l = u [j] + v [j] - ((mixres * v [j]) >> mixbits) ;
  150|    744|				r = l - v [j] ;
  151|       |
  152|    744|				l = arith_shift_left (l, shift) | (uint32_t) shiftUV [k + 0] ;
  153|    744|				r = arith_shift_left (r, shift) | (uint32_t) shiftUV [k + 1] ;
  154|       |
  155|    744|				out [0] = arith_shift_left (l, 8) ;
  156|    744|				out [1] = arith_shift_left (r, 8) ;
  157|    744|				out += stride ;
  158|    744|			}
  159|    113|		}
  160|    659|		else
  161|    659|		{
  162|  6.96k|			for (j = 0 ; j < numSamples ; j++)
  ------------------
  |  Branch (162:17): [True: 6.30k, False: 659]
  ------------------
  163|  6.30k|			{
  164|  6.30k|				l = u [j] + v [j] - ((mixres * v [j]) >> mixbits) ;
  165|  6.30k|				r = l - v [j] ;
  166|       |
  167|  6.30k|				out [0] = l << 8 ;
  168|  6.30k|				out [1] = r << 8 ;
  169|  6.30k|				out += stride ;
  170|  6.30k|			}
  171|    659|		}
  172|    772|	}
  173|    666|	else
  174|    666|	{
  175|       |		/* Conventional separated stereo. */
  176|    666|		if (bytesShifted != 0)
  ------------------
  |  Branch (176:7): [True: 125, False: 541]
  ------------------
  177|    125|		{
  178|    900|			for (j = 0, k = 0 ; j < numSamples ; j++, k += 2)
  ------------------
  |  Branch (178:24): [True: 775, False: 125]
  ------------------
  179|    775|			{
  180|    775|				l = u [j] ;
  181|    775|				r = v [j] ;
  182|       |
  183|    775|				l = (l << shift) | (uint32_t) shiftUV [k + 0] ;
  184|    775|				r = (r << shift) | (uint32_t) shiftUV [k + 1] ;
  185|       |
  186|    775|				out [0] = l << 8 ;
  187|    775|				out [1] = r << 8 ;
  188|    775|				out += stride ;
  189|    775|			}
  190|    125|		}
  191|    541|		else
  192|    541|		{
  193|  12.1k|			for (j = 0 ; j < numSamples ; j++)
  ------------------
  |  Branch (193:17): [True: 11.6k, False: 541]
  ------------------
  194|  11.6k|			{
  195|  11.6k|				out [0] = u [j] << 8 ;
  196|  11.6k|				out [1] = v [j] << 8 ;
  197|  11.6k|				out += stride ;
  198|  11.6k|			}
  199|    541|		}
  200|    666|	}
  201|  1.43k|}
unmix32:
  211|  1.49k|{
  212|  1.49k|	int32_t		shift = bytesShifted * 8 ;
  213|  1.49k|	int32_t		l, r ;
  214|  1.49k|	int32_t 	j, k ;
  215|       |
  216|  1.49k|	if (mixres != 0)
  ------------------
  |  Branch (216:6): [True: 502, False: 997]
  ------------------
  217|    502|	{
  218|       |		//Assert (bytesShifted != 0) ;
  219|       |
  220|       |		/* matrixed stereo with shift */
  221|  1.42k|		for (j = 0, k = 0 ; j < numSamples ; j++, k += 2)
  ------------------
  |  Branch (221:23): [True: 925, False: 502]
  ------------------
  222|    925|		{
  223|    925|			int32_t		lt, rt ;
  224|       |
  225|    925|			lt = u [j] ;
  226|    925|			rt = v [j] ;
  227|       |
  228|    925|			l = lt + rt - ((mixres * rt) >> mixbits) ;
  229|    925|			r = l - rt ;
  230|       |
  231|    925|			out [0] = arith_shift_left (l, shift) | (uint32_t) shiftUV [k + 0] ;
  232|    925|			out [1] = arith_shift_left (r, shift) | (uint32_t) shiftUV [k + 1] ;
  233|    925|			out += stride ;
  234|    925|		}
  235|    502|	}
  236|    997|	else
  237|    997|	{
  238|    997|		if (bytesShifted == 0)
  ------------------
  |  Branch (238:7): [True: 773, False: 224]
  ------------------
  239|    773|		{
  240|       |			/* interleaving w/o shift */
  241|  51.1k|			for (j = 0 ; j < numSamples ; j++)
  ------------------
  |  Branch (241:17): [True: 50.3k, False: 773]
  ------------------
  242|  50.3k|			{
  243|  50.3k|				out [0] = u [j] ;
  244|  50.3k|				out [1] = v [j] ;
  245|  50.3k|				out += stride ;
  246|  50.3k|			}
  247|    773|		}
  248|    224|		else
  249|    224|		{
  250|       |			/* interleaving with shift */
  251|  1.29k|			for (j = 0, k = 0 ; j < numSamples ; j++, k += 2)
  ------------------
  |  Branch (251:24): [True: 1.06k, False: 224]
  ------------------
  252|  1.06k|			{
  253|  1.06k|				out [0] = (u [j] << shift) | (uint32_t) shiftUV [k + 0] ;
  254|  1.06k|				out [1] = (v [j] << shift) | (uint32_t) shiftUV [k + 1] ;
  255|  1.06k|				out += stride ;
  256|  1.06k|			}
  257|    224|		}
  258|    997|	}
  259|  1.49k|}
copyPredictorTo24:
  265|  3.96k|{
  266|  3.96k|	int32_t		j ;
  267|       |
  268|   889k|	for (j = 0 ; j < numSamples ; j++)
  ------------------
  |  Branch (268:15): [True: 885k, False: 3.96k]
  ------------------
  269|   885k|	{
  270|   885k|		out [0] = in [j] << 8 ;
  271|   885k|		out += stride ;
  272|   885k|	}
  273|  3.96k|}
copyPredictorTo24Shift:
  277|    966|{
  278|    966|	int32_t		shiftVal = bytesShifted * 8 ;
  279|    966|	int32_t		j ;
  280|       |
  281|       |	//Assert (bytesShifted != 0) ;
  282|       |
  283|  3.09k|	for (j = 0 ; j < numSamples ; j++)
  ------------------
  |  Branch (283:15): [True: 2.12k, False: 966]
  ------------------
  284|  2.12k|	{
  285|  2.12k|		int32_t		val = in [j] ;
  286|       |
  287|  2.12k|		val = arith_shift_left (val, shiftVal) | (uint32_t) shift [j] ;
  288|  2.12k|		out [0] = arith_shift_left (val, 8) ;
  289|  2.12k|		out += stride ;
  290|  2.12k|	}
  291|    966|}
copyPredictorTo20:
  295|  2.62k|{
  296|  2.62k|	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|  92.2k|	for (j = 0 ; j < numSamples ; j++)
  ------------------
  |  Branch (300:15): [True: 89.6k, False: 2.62k]
  ------------------
  301|  89.6k|	{
  302|  89.6k|		out [0] = arith_shift_left (in [j], 12) ;
  303|  89.6k|		out += stride ;
  304|  89.6k|	}
  305|  2.62k|}
copyPredictorTo32:
  309|  3.42k|{
  310|  3.42k|	int32_t			i, j ;
  311|       |
  312|       |	// this is only a subroutine to abstract the "iPod can only output 16-bit data" problem
  313|   168k|	for (i = 0, j = 0 ; i < numSamples ; i++, j += stride)
  ------------------
  |  Branch (313:22): [True: 165k, False: 3.42k]
  ------------------
  314|   165k|		out [j] = arith_shift_left (in [i], 8) ;
  315|  3.42k|}
copyPredictorTo32Shift:
  319|  2.03k|{
  320|  2.03k|	int32_t *		op = out ;
  321|  2.03k|	uint32_t		shiftVal = bytesShifted * 8 ;
  322|  2.03k|	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.53k|	for (j = 0 ; j < numSamples ; j++)
  ------------------
  |  Branch (327:15): [True: 3.50k, False: 2.03k]
  ------------------
  328|  3.50k|	{
  329|  3.50k|		op [0] = arith_shift_left (in [j], shiftVal) | (uint32_t) shift [j] ;
  330|  3.50k|		op += stride ;
  331|  3.50k|	}
  332|  2.03k|}

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

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

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

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

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

g721.c:arith_shift_left:
  119|  52.5k|{	return (int) (((unsigned int) x) << shift) ;
  120|  52.5k|} /* arith_shift_left */
g723_24.c:arith_shift_left:
  119|   530k|{	return (int) (((unsigned int) x) << shift) ;
  120|   530k|} /* arith_shift_left */
g723_40.c:arith_shift_left:
  119|   224k|{	return (int) (((unsigned int) x) << shift) ;
  120|   224k|} /* arith_shift_left */

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

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

decode.c:GSM_MULT_R:
  118|   729k|{	return (((int32_t) (a)) * ((int32_t) (b)) + 16384) >> 15 ;
  119|   729k|} /* GSM_MULT_R */
decode.c:GSM_ADD:
  150|  1.45M|{	int32_t ltmp ;
  151|       |
  152|  1.45M|	ltmp = ((int32_t) a) + ((int32_t) b) ;
  153|       |
  154|  1.45M|	if (ltmp >= MAX_WORD)
  ------------------
  |  |   52|  1.45M|#define	MAX_WORD	32767
  ------------------
  |  Branch (154:6): [True: 308k, False: 1.15M]
  ------------------
  155|   308k|		return MAX_WORD ;
  ------------------
  |  |   52|   308k|#define	MAX_WORD	32767
  ------------------
  156|  1.15M|	if (ltmp <= MIN_WORD)
  ------------------
  |  |   51|  1.15M|#define	MIN_WORD	(-32767 - 1)
  ------------------
  |  Branch (156:6): [True: 200k, False: 949k]
  ------------------
  157|   200k|		return MIN_WORD ;
  ------------------
  |  |   51|   200k|#define	MIN_WORD	(-32767 - 1)
  ------------------
  158|       |
  159|   949k|	return ltmp ;
  160|  1.15M|} /* GSM_ADD */
long_term.c:GSM_MULT_R:
  118|   729k|{	return (((int32_t) (a)) * ((int32_t) (b)) + 16384) >> 15 ;
  119|   729k|} /* GSM_MULT_R */
long_term.c:GSM_ADD:
  150|   729k|{	int32_t ltmp ;
  151|       |
  152|   729k|	ltmp = ((int32_t) a) + ((int32_t) b) ;
  153|       |
  154|   729k|	if (ltmp >= MAX_WORD)
  ------------------
  |  |   52|   729k|#define	MAX_WORD	32767
  ------------------
  |  Branch (154:6): [True: 65.6k, False: 663k]
  ------------------
  155|  65.6k|		return MAX_WORD ;
  ------------------
  |  |   52|  65.6k|#define	MAX_WORD	32767
  ------------------
  156|   663k|	if (ltmp <= MIN_WORD)
  ------------------
  |  |   51|   663k|#define	MIN_WORD	(-32767 - 1)
  ------------------
  |  Branch (156:6): [True: 1.23k, False: 662k]
  ------------------
  157|  1.23k|		return MIN_WORD ;
  ------------------
  |  |   51|  1.23k|#define	MIN_WORD	(-32767 - 1)
  ------------------
  158|       |
  159|   662k|	return ltmp ;
  160|   663k|} /* GSM_ADD */
rpe.c:SASR_W:
   60|  11.4k|{	if (x >= 0)
  ------------------
  |  Branch (60:7): [True: 11.4k, False: 0]
  ------------------
   61|  11.4k|		return x >> by ;
   62|      0|	return ~ ((~x) >> by) ;
   63|  11.4k|} /* SASR_W */
rpe.c:arith_shift_left:
  306|   236k|{	return (int32_t) (((uint32_t) x) << shift) ;
  307|   236k|} /* arith_shift_left */
rpe.c:GSM_MULT_R:
  118|   236k|{	return (((int32_t) (a)) * ((int32_t) (b)) + 16384) >> 15 ;
  119|   236k|} /* GSM_MULT_R */
rpe.c:GSM_ADD:
  150|   236k|{	int32_t ltmp ;
  151|       |
  152|   236k|	ltmp = ((int32_t) a) + ((int32_t) b) ;
  153|       |
  154|   236k|	if (ltmp >= MAX_WORD)
  ------------------
  |  |   52|   236k|#define	MAX_WORD	32767
  ------------------
  |  Branch (154:6): [True: 0, False: 236k]
  ------------------
  155|      0|		return MAX_WORD ;
  ------------------
  |  |   52|      0|#define	MAX_WORD	32767
  ------------------
  156|   236k|	if (ltmp <= MIN_WORD)
  ------------------
  |  |   51|   236k|#define	MIN_WORD	(-32767 - 1)
  ------------------
  |  Branch (156:6): [True: 0, False: 236k]
  ------------------
  157|      0|		return MIN_WORD ;
  ------------------
  |  |   51|      0|#define	MIN_WORD	(-32767 - 1)
  ------------------
  158|       |
  159|   236k|	return ltmp ;
  160|   236k|} /* GSM_ADD */
short_term.c:arith_shift_left:
  306|  36.4k|{	return (int32_t) (((uint32_t) x) << shift) ;
  307|  36.4k|} /* arith_shift_left */
short_term.c:GSM_ADD:
  150|  6.10M|{	int32_t ltmp ;
  151|       |
  152|  6.10M|	ltmp = ((int32_t) a) + ((int32_t) b) ;
  153|       |
  154|  6.10M|	if (ltmp >= MAX_WORD)
  ------------------
  |  |   52|  6.10M|#define	MAX_WORD	32767
  ------------------
  |  Branch (154:6): [True: 135k, False: 5.96M]
  ------------------
  155|   135k|		return MAX_WORD ;
  ------------------
  |  |   52|   135k|#define	MAX_WORD	32767
  ------------------
  156|  5.96M|	if (ltmp <= MIN_WORD)
  ------------------
  |  |   51|  5.96M|#define	MIN_WORD	(-32767 - 1)
  ------------------
  |  Branch (156:6): [True: 11.7k, False: 5.95M]
  ------------------
  157|  11.7k|		return MIN_WORD ;
  ------------------
  |  |   51|  11.7k|#define	MIN_WORD	(-32767 - 1)
  ------------------
  158|       |
  159|  5.95M|	return ltmp ;
  160|  5.96M|} /* GSM_ADD */
short_term.c:GSM_SUB:
  164|  5.86M|{	int32_t ltmp ;
  165|       |
  166|  5.86M|	ltmp = ((int32_t) a) - ((int32_t) b) ;
  167|       |
  168|  5.86M|	if (ltmp >= MAX_WORD)
  ------------------
  |  |   52|  5.86M|#define	MAX_WORD	32767
  ------------------
  |  Branch (168:6): [True: 259k, False: 5.60M]
  ------------------
  169|   259k|		ltmp = MAX_WORD ;
  ------------------
  |  |   52|   259k|#define	MAX_WORD	32767
  ------------------
  170|  5.60M|	else if (ltmp <= MIN_WORD)
  ------------------
  |  |   51|  5.60M|#define	MIN_WORD	(-32767 - 1)
  ------------------
  |  Branch (170:11): [True: 139k, False: 5.46M]
  ------------------
  171|   139k|		ltmp = MIN_WORD ;
  ------------------
  |  |   51|   139k|#define	MIN_WORD	(-32767 - 1)
  ------------------
  172|       |
  173|  5.86M|	return ltmp ;
  174|  5.86M|} /* GSM_SUB */
short_term.c:GSM_MULT_R:
  118|  36.4k|{	return (((int32_t) (a)) * ((int32_t) (b)) + 16384) >> 15 ;
  119|  36.4k|} /* GSM_MULT_R */
short_term.c:SASR_W:
   60|   291k|{	if (x >= 0)
  ------------------
  |  Branch (60:7): [True: 158k, False: 133k]
  ------------------
   61|   158k|		return x >> by ;
   62|   133k|	return ~ ((~x) >> by) ;
   63|   291k|} /* SASR_W */
add.c:SASR_W:
   60|   245k|{	if (x >= 0)
  ------------------
  |  Branch (60:7): [True: 130k, False: 115k]
  ------------------
   61|   130k|		return x >> by ;
   62|   115k|	return ~ ((~x) >> by) ;
   63|   245k|} /* SASR_W */

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

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

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

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

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

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

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

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

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

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

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

audio_detect:
   48|  1.99k|{	VOTE vote ;
   49|       |
   50|  1.99k|	if (psf == NULL)
  ------------------
  |  Branch (50:6): [True: 0, False: 1.99k]
  ------------------
   51|      0|		return 0 ;
   52|       |
   53|  1.99k|	if (ad == NULL || datalen < 256)
  ------------------
  |  Branch (53:6): [True: 0, False: 1.99k]
  |  Branch (53:20): [True: 0, False: 1.99k]
  ------------------
   54|      0|		return 0 ;
   55|       |
   56|  1.99k|	vote_for_format (&vote, data, datalen) ;
   57|       |
   58|  1.99k|	psf_log_printf (psf, "audio_detect :\n"
   59|  1.99k|			"    le_float     : %d\n"
   60|  1.99k|			"    be_float     : %d\n"
   61|  1.99k|			"    le_int_24_32 : %d\n"
   62|  1.99k|			"    be_int_24_32 : %d\n",
   63|  1.99k|			vote.le_float, vote.be_float, vote.le_int_24_32, vote.be_int_24_32) ;
   64|       |
   65|  1.99k|	if (0) puts (psf->parselog.buf) ;
  ------------------
  |  Branch (65:6): [Folded, False: 1.99k]
  ------------------
   66|       |
   67|  1.99k|	if (ad->endianness == SF_ENDIAN_LITTLE && vote.le_float > (3 * datalen) / 4)
  ------------------
  |  Branch (67:6): [True: 1.99k, False: 0]
  |  Branch (67:44): [True: 3, False: 1.99k]
  ------------------
   68|      3|	{	/* Almost certainly 32 bit floats. */
   69|      3|		return SF_FORMAT_FLOAT ;
   70|  1.99k|		} ;
   71|       |
   72|  1.99k|	if (ad->endianness == SF_ENDIAN_LITTLE && vote.le_int_24_32 > (3 * datalen) / 4)
  ------------------
  |  Branch (72:6): [True: 1.99k, False: 0]
  |  Branch (72:44): [True: 7, False: 1.98k]
  ------------------
   73|      7|	{	/* Almost certainly 24 bit data stored in 32 bit ints. */
   74|      7|		return SF_FORMAT_PCM_32 ;
   75|  1.98k|		} ;
   76|       |
   77|  1.98k|	return 0 ;
   78|  1.99k|} /* data_detect */
audio_detect.c:vote_for_format:
   82|  1.99k|{
   83|  1.99k|	int k ;
   84|       |
   85|  1.99k|	memset (vote, 0, sizeof (VOTE)) ;
   86|       |
   87|  1.99k|	datalen -= datalen % 4 ;
   88|       |
   89|  8.17M|	for (k = 0 ; k < datalen ; k ++)
  ------------------
  |  Branch (89:15): [True: 8.17M, False: 1.99k]
  ------------------
   90|  8.17M|	{	if ((k % 4) == 0)
  ------------------
  |  Branch (90:8): [True: 2.04M, False: 6.12M]
  ------------------
   91|  2.04M|		{	if (data [k] == 0 && data [k + 1] != 0)
  ------------------
  |  Branch (91:9): [True: 1.98M, False: 54.1k]
  |  Branch (91:26): [True: 9.71k, False: 1.97M]
  ------------------
   92|  9.71k|				vote->le_int_24_32 += 4 ;
   93|       |
   94|  2.04M|			if (data [2] != 0 && data [3] == 0)
  ------------------
  |  Branch (94:8): [True: 61.4k, False: 1.98M]
  |  Branch (94:25): [True: 7.16k, False: 54.2k]
  ------------------
   95|  7.16k|				vote->le_int_24_32 += 4 ;
   96|       |
   97|  2.04M|			if (data [0] != 0 && data [3] > 0x43 && data [3] < 0x4B)
  ------------------
  |  Branch (97:8): [True: 62.4k, False: 1.98M]
  |  Branch (97:25): [True: 35.8k, False: 26.6k]
  |  Branch (97:44): [True: 3.07k, False: 32.7k]
  ------------------
   98|  3.07k|				vote->le_float += 4 ;
   99|       |
  100|  2.04M|			if (data [3] != 0 && data [0] > 0x43 && data [0] < 0x4B)
  ------------------
  |  Branch (100:8): [True: 66.5k, False: 1.97M]
  |  Branch (100:25): [True: 31.7k, False: 34.8k]
  |  Branch (100:44): [True: 1.02k, False: 30.7k]
  ------------------
  101|  1.02k|				vote->be_float += 4 ;
  102|  2.04M|			} ;
  103|  8.17M|		} ;
  104|       |
  105|  1.99k|	return ;
  106|  1.99k|} /* vote_for_format */

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

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

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

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

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

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

psf_allocate:
   44|  18.9k|{	SF_PRIVATE * psf ;
   45|       |
   46|  18.9k|	if ((psf = calloc (1, sizeof (SF_PRIVATE))) == NULL)
  ------------------
  |  Branch (46:6): [True: 0, False: 18.9k]
  ------------------
   47|      0|		return	NULL ;
   48|       |
   49|  18.9k|	if ((psf->header.ptr = calloc (1, INITIAL_HEADER_SIZE)) == NULL)
  ------------------
  |  |   39|  18.9k|#define	INITIAL_HEADER_SIZE	256
  ------------------
  |  Branch (49:6): [True: 0, False: 18.9k]
  ------------------
   50|      0|	{	free (psf) ;
   51|      0|		return	NULL ;
   52|  18.9k|		} ;
   53|  18.9k|	psf->header.len = INITIAL_HEADER_SIZE ;
  ------------------
  |  |   39|  18.9k|#define	INITIAL_HEADER_SIZE	256
  ------------------
   54|       |
   55|  18.9k|	return psf ;
   56|  18.9k|} /* psf_allocate */
psf_log_printf:
  106|  19.0M|{	va_list		ap ;
  107|  19.0M|	uint32_t	u, tens ;
  108|  19.0M|	int			d, shift, width, width_specifier, left_align, slen, precision ;
  109|  19.0M|	char		c, *strptr, istr [5], lead_char, sign_char ;
  110|       |
  111|  19.0M|	va_start (ap, format) ;
  112|       |
  113|   659M|	while ((c = *format++))
  ------------------
  |  Branch (113:9): [True: 640M, False: 19.0M]
  ------------------
  114|   640M|	{	if (c != '%')
  ------------------
  |  Branch (114:8): [True: 609M, False: 30.4M]
  ------------------
  115|   609M|		{	log_putchar (psf, c) ;
  116|   609M|			continue ;
  117|   609M|			} ;
  118|       |
  119|  30.4M|		if (format [0] == '%') /* Handle %% */
  ------------------
  |  Branch (119:7): [True: 0, False: 30.4M]
  ------------------
  120|      0|		{ 	log_putchar (psf, '%') ;
  121|      0|			format ++ ;
  122|      0|			continue ;
  123|  30.4M|			} ;
  124|       |
  125|  30.4M|		sign_char = 0 ;
  126|  30.4M|		left_align = SF_FALSE ;
  127|  30.5M|		while (1)
  ------------------
  |  Branch (127:10): [True: 30.5M, Folded]
  ------------------
  128|  30.5M|		{	switch (format [0])
  129|  30.5M|			{	case ' ' :
  ------------------
  |  Branch (129:6): [True: 0, False: 30.5M]
  ------------------
  130|      0|				case '+' :
  ------------------
  |  Branch (130:5): [True: 0, False: 30.5M]
  ------------------
  131|      0|					sign_char = format [0] ;
  132|      0|					format ++ ;
  133|      0|					continue ;
  134|       |
  135|   109k|				case '-' :
  ------------------
  |  Branch (135:5): [True: 109k, False: 30.4M]
  ------------------
  136|   109k|					left_align = SF_TRUE ;
  137|   109k|					format ++ ;
  138|   109k|					continue ;
  139|       |
  140|  30.4M|				default : break ;
  ------------------
  |  Branch (140:5): [True: 30.4M, False: 109k]
  ------------------
  141|  30.5M|				} ;
  142|       |
  143|  30.4M|			break ;
  144|  30.5M|			} ;
  145|       |
  146|  30.4M|		if (format [0] == 0)
  ------------------
  |  Branch (146:7): [True: 0, False: 30.4M]
  ------------------
  147|      0|			break ;
  148|       |
  149|  30.4M|		lead_char = ' ' ;
  150|  30.4M|		if (format [0] == '0')
  ------------------
  |  Branch (150:7): [True: 5.54M, False: 24.9M]
  ------------------
  151|  5.54M|			lead_char = '0' ;
  152|       |
  153|  30.4M|		width_specifier = 0 ;
  154|  41.7M|		while ((c = *format++) && isdigit (c))
  ------------------
  |  Branch (154:10): [True: 41.7M, False: 0]
  |  Branch (154:29): [True: 11.3M, False: 30.4M]
  ------------------
  155|  11.3M|			width_specifier = width_specifier * 10 + (c - '0') ;
  156|       |
  157|  30.4M|		precision = 0 ;
  158|  30.4M|		if (c == '.')
  ------------------
  |  Branch (158:7): [True: 100, False: 30.4M]
  ------------------
  159|    300|		{	while ((c = *format++) && isdigit (c))
  ------------------
  |  Branch (159:12): [True: 300, False: 0]
  |  Branch (159:31): [True: 200, False: 100]
  ------------------
  160|    200|				precision = precision * 10 + (c - '0') ;
  161|    100|			} ;
  162|       |
  163|  30.4M|		switch (c)
  164|  30.4M|		{	case 0 : /* NULL character. */
  ------------------
  |  Branch (164:5): [True: 0, False: 30.4M]
  ------------------
  165|      0|					va_end (ap) ;
  166|      0|					return ;
  167|       |
  168|  2.15M|			case 's': /* string */
  ------------------
  |  Branch (168:4): [True: 2.15M, False: 28.3M]
  ------------------
  169|  2.15M|					strptr = va_arg (ap, char *) ;
  170|  2.15M|					if (strptr == NULL)
  ------------------
  |  Branch (170:10): [True: 0, False: 2.15M]
  ------------------
  171|      0|						break ;
  172|  2.15M|					if (precision > 0)
  ------------------
  |  Branch (172:10): [True: 100, False: 2.15M]
  ------------------
  173|    100|						slen = strnlen (strptr, precision) ;
  174|  2.15M|					else
  175|  2.15M|						slen = strlen (strptr) ;
  176|  2.15M|					width_specifier = width_specifier >= slen ? width_specifier - slen : 0 ;
  ------------------
  |  Branch (176:24): [True: 1.97M, False: 172k]
  ------------------
  177|  2.15M|					if (left_align == SF_FALSE)
  ------------------
  |  Branch (177:10): [True: 2.04M, False: 109k]
  ------------------
  178|  2.04M|						while (width_specifier -- > 0)
  ------------------
  |  Branch (178:14): [True: 0, False: 2.04M]
  ------------------
  179|      0|							log_putchar (psf, ' ') ;
  180|  5.45M|					while (slen--)
  ------------------
  |  Branch (180:13): [True: 3.29M, False: 2.15M]
  ------------------
  181|  3.29M|						log_putchar (psf, *strptr++) ;
  182|  3.29M|					while (width_specifier -- > 0)
  ------------------
  |  Branch (182:13): [True: 1.14M, False: 2.15M]
  ------------------
  183|  1.14M|						log_putchar (psf, ' ') ;
  184|  2.15M|					break ;
  185|       |
  186|  15.7M|			case 'd': /* int */
  ------------------
  |  Branch (186:4): [True: 15.7M, False: 14.7M]
  ------------------
  187|  15.7M|					d = va_arg (ap, int) ;
  188|       |
  189|  15.7M|					if (d < 0)
  ------------------
  |  Branch (189:10): [True: 55.3k, False: 15.6M]
  ------------------
  190|  55.3k|					{	sign_char = '-' ;
  191|  55.3k|						if (lead_char != '0' && left_align == SF_FALSE)
  ------------------
  |  Branch (191:11): [True: 55.2k, False: 29]
  |  Branch (191:31): [True: 55.2k, False: 0]
  ------------------
  192|  55.2k|							width_specifier -- ;
  193|       |
  194|  55.3k|						u = - ((unsigned) d) ;
  195|  55.3k|						}
  196|  15.6M|					else
  197|  15.6M|					{	u = (unsigned) d ;
  198|  15.6M|						}
  199|       |
  200|  15.7M|					tens = 1 ;
  201|  15.7M|					width = 1 ;
  202|  30.4M|					while (u / tens >= 10)
  ------------------
  |  Branch (202:13): [True: 14.7M, False: 15.7M]
  ------------------
  203|  14.7M|					{	tens *= 10 ;
  204|  14.7M|						width ++ ;
  205|  14.7M|						} ;
  206|       |
  207|  15.7M|					width_specifier -= width ;
  208|       |
  209|  15.7M|					if (sign_char == ' ')
  ------------------
  |  Branch (209:10): [True: 0, False: 15.7M]
  ------------------
  210|      0|					{	log_putchar (psf, ' ') ;
  211|      0|						width_specifier -- ;
  212|      0|						} ;
  213|       |
  214|  15.7M|					if (left_align == SF_FALSE && lead_char != '0')
  ------------------
  |  Branch (214:10): [True: 15.7M, False: 0]
  |  Branch (214:36): [True: 15.7M, False: 109]
  ------------------
  215|  15.7M|					{	if (sign_char == '+')
  ------------------
  |  Branch (215:12): [True: 0, False: 15.7M]
  ------------------
  216|      0|							width_specifier -- ;
  217|       |
  218|  15.7M|						while (width_specifier -- > 0)
  ------------------
  |  Branch (218:14): [True: 3.94k, False: 15.7M]
  ------------------
  219|  3.94k|							log_putchar (psf, lead_char) ;
  220|  15.7M|						} ;
  221|       |
  222|  15.7M|					if (sign_char == '+' || sign_char == '-')
  ------------------
  |  Branch (222:10): [True: 0, False: 15.7M]
  |  Branch (222:30): [True: 55.3k, False: 15.6M]
  ------------------
  223|  55.3k|					{	log_putchar (psf, sign_char) ;
  224|  55.3k|						width_specifier -- ;
  225|  55.3k|						} ;
  226|       |
  227|  15.7M|					if (left_align == SF_FALSE)
  ------------------
  |  Branch (227:10): [True: 15.7M, False: 0]
  ------------------
  228|  15.7M|						while (width_specifier -- > 0)
  ------------------
  |  Branch (228:14): [True: 38, False: 15.7M]
  ------------------
  229|     38|							log_putchar (psf, lead_char) ;
  230|       |
  231|  46.1M|					while (tens > 0)
  ------------------
  |  Branch (231:13): [True: 30.4M, False: 15.7M]
  ------------------
  232|  30.4M|					{	log_putchar (psf, '0' + u / tens) ;
  233|  30.4M|						u %= tens ;
  234|  30.4M|						tens /= 10 ;
  235|  30.4M|						} ;
  236|       |
  237|  15.7M|					while (width_specifier -- > 0)
  ------------------
  |  Branch (237:13): [True: 0, False: 15.7M]
  ------------------
  238|      0|						log_putchar (psf, lead_char) ;
  239|  15.7M|					break ;
  240|       |
  241|   428k|			case 'D': /* sf_count_t */
  ------------------
  |  Branch (241:4): [True: 428k, False: 30.0M]
  ------------------
  242|   428k|					{	sf_count_t	D ;
  243|   428k|						uint64_t	U, Tens ;
  244|       |
  245|   428k|						D = va_arg (ap, sf_count_t) ;
  246|       |
  247|   428k|						if (D == 0)
  ------------------
  |  Branch (247:11): [True: 10.3k, False: 418k]
  ------------------
  248|  10.3k|						{	while (-- width_specifier > 0)
  ------------------
  |  Branch (248:16): [True: 0, False: 10.3k]
  ------------------
  249|      0|								log_putchar (psf, lead_char) ;
  250|  10.3k|							log_putchar (psf, '0') ;
  251|  10.3k|							break ;
  252|  10.3k|							}
  253|   418k|						else
  254|   418k|						{	if (D < 0)
  ------------------
  |  Branch (254:13): [True: 91.5k, False: 326k]
  ------------------
  255|  91.5k|							{	log_putchar (psf, '-') ;
  256|  91.5k|								U = - ((uint64_t) D) ;
  257|  91.5k|								}
  258|   326k|							else
  259|   326k|							{	U = (uint64_t) D ;
  260|   326k|								}
  261|   418k|							}
  262|       |
  263|   418k|						Tens = 1 ;
  264|   418k|						width = 1 ;
  265|  2.88M|						while (U / Tens >= 10)
  ------------------
  |  Branch (265:14): [True: 2.46M, False: 418k]
  ------------------
  266|  2.46M|						{	Tens *= 10 ;
  267|  2.46M|							width ++ ;
  268|  2.46M|							} ;
  269|       |
  270|   418k|						while (width_specifier > width)
  ------------------
  |  Branch (270:14): [True: 0, False: 418k]
  ------------------
  271|      0|						{	log_putchar (psf, lead_char) ;
  272|      0|							width_specifier-- ;
  273|      0|							} ;
  274|       |
  275|  3.30M|						while (Tens > 0)
  ------------------
  |  Branch (275:14): [True: 2.88M, False: 418k]
  ------------------
  276|  2.88M|						{	log_putchar (psf, '0' + U / Tens) ;
  277|  2.88M|							U %= Tens ;
  278|  2.88M|							Tens /= 10 ;
  279|  2.88M|							} ;
  280|   418k|						} ;
  281|   418k|					break ;
  282|       |
  283|  1.32M|			case 'u': /* unsigned int */
  ------------------
  |  Branch (283:4): [True: 1.32M, False: 29.1M]
  ------------------
  284|  1.32M|					u = va_arg (ap, unsigned int) ;
  285|       |
  286|  1.32M|					tens = 1 ;
  287|  1.32M|					width = 1 ;
  288|  8.73M|					while (u / tens >= 10)
  ------------------
  |  Branch (288:13): [True: 7.40M, False: 1.32M]
  ------------------
  289|  7.40M|					{	tens *= 10 ;
  290|  7.40M|						width ++ ;
  291|  7.40M|						} ;
  292|       |
  293|  1.32M|					width_specifier -= width ;
  294|       |
  295|  1.32M|					if (sign_char == ' ')
  ------------------
  |  Branch (295:10): [True: 0, False: 1.32M]
  ------------------
  296|      0|					{	log_putchar (psf, ' ') ;
  297|      0|						width_specifier -- ;
  298|      0|						} ;
  299|       |
  300|  1.32M|					if (left_align == SF_FALSE && lead_char != '0')
  ------------------
  |  Branch (300:10): [True: 1.32M, False: 0]
  |  Branch (300:36): [True: 1.31M, False: 1.41k]
  ------------------
  301|  1.31M|					{	if (sign_char == '+')
  ------------------
  |  Branch (301:12): [True: 0, False: 1.31M]
  ------------------
  302|      0|							width_specifier -- ;
  303|       |
  304|  1.33M|						while (width_specifier -- > 0)
  ------------------
  |  Branch (304:14): [True: 12.4k, False: 1.31M]
  ------------------
  305|  12.4k|							log_putchar (psf, lead_char) ;
  306|  1.31M|						} ;
  307|       |
  308|  1.32M|					if (sign_char == '+' || sign_char == '-')
  ------------------
  |  Branch (308:10): [True: 0, False: 1.32M]
  |  Branch (308:30): [True: 0, False: 1.32M]
  ------------------
  309|      0|					{	log_putchar (psf, sign_char) ;
  310|      0|						width_specifier -- ;
  311|      0|						} ;
  312|       |
  313|  1.32M|					if (left_align == SF_FALSE)
  ------------------
  |  Branch (313:10): [True: 1.32M, False: 0]
  ------------------
  314|  1.32M|						while (width_specifier -- > 0)
  ------------------
  |  Branch (314:14): [True: 998, False: 1.32M]
  ------------------
  315|    998|							log_putchar (psf, lead_char) ;
  316|       |
  317|  10.0M|					while (tens > 0)
  ------------------
  |  Branch (317:13): [True: 8.73M, False: 1.32M]
  ------------------
  318|  8.73M|					{	log_putchar (psf, '0' + u / tens) ;
  319|  8.73M|						u %= tens ;
  320|  8.73M|						tens /= 10 ;
  321|  8.73M|						} ;
  322|       |
  323|  1.32M|					while (width_specifier -- > 0)
  ------------------
  |  Branch (323:13): [True: 0, False: 1.32M]
  ------------------
  324|      0|						log_putchar (psf, lead_char) ;
  325|  1.32M|					break ;
  326|       |
  327|      0|			case 'c': /* char */
  ------------------
  |  Branch (327:4): [True: 0, False: 30.4M]
  ------------------
  328|      0|					c = va_arg (ap, int) & 0xFF ;
  329|      0|					log_putchar (psf, c) ;
  330|      0|					break ;
  331|       |
  332|  3.38M|			case 'x': /* hex */
  ------------------
  |  Branch (332:4): [True: 3.38M, False: 27.0M]
  ------------------
  333|  9.00M|			case 'X': /* hex */
  ------------------
  |  Branch (333:4): [True: 5.61M, False: 24.8M]
  ------------------
  334|  9.00M|					d = va_arg (ap, int) ;
  335|       |
  336|  9.00M|					if (d == 0)
  ------------------
  |  Branch (336:10): [True: 5.05M, False: 3.94M]
  ------------------
  337|  7.20M|					{	while (--width_specifier > 0)
  ------------------
  |  Branch (337:15): [True: 2.14M, False: 5.05M]
  ------------------
  338|  2.14M|							log_putchar (psf, lead_char) ;
  339|  5.05M|						log_putchar (psf, '0') ;
  340|  5.05M|						break ;
  341|  5.05M|						} ;
  342|  3.94M|					shift = 28 ;
  343|  3.94M|					width = (width_specifier < 8) ? 8 : width_specifier ;
  ------------------
  |  Branch (343:14): [True: 3.94M, False: 246]
  ------------------
  344|  25.6M|					while (! ((((uint32_t) 0xF) << shift) & d))
  ------------------
  |  Branch (344:13): [True: 21.6M, False: 3.94M]
  ------------------
  345|  21.6M|					{	shift -= 4 ;
  346|  21.6M|						width -- ;
  347|  21.6M|						} ;
  348|       |
  349|  4.46M|					while (width > 0 && width_specifier > width)
  ------------------
  |  Branch (349:13): [True: 4.46M, False: 0]
  |  Branch (349:26): [True: 519k, False: 3.94M]
  ------------------
  350|   519k|					{	log_putchar (psf, lead_char) ;
  351|   519k|						width_specifier-- ;
  352|   519k|						} ;
  353|       |
  354|  13.8M|					while (shift >= 0)
  ------------------
  |  Branch (354:13): [True: 9.92M, False: 3.94M]
  ------------------
  355|  9.92M|					{	c = (d >> shift) & 0xF ;
  356|  9.92M|						log_putchar (psf, (c > 9) ? c + 'A' - 10 : c + '0') ;
  ------------------
  |  Branch (356:25): [True: 2.43M, False: 7.49M]
  ------------------
  357|  9.92M|						shift -= 4 ;
  358|  9.92M|						} ;
  359|  3.94M|					break ;
  360|       |
  361|  1.87M|			case 'M': /* int2str */
  ------------------
  |  Branch (361:4): [True: 1.87M, False: 28.6M]
  ------------------
  362|  1.87M|					d = va_arg (ap, int) ;
  363|  1.87M|					if (CPU_IS_LITTLE_ENDIAN)
  ------------------
  |  |   14|  1.87M|#define CPU_IS_LITTLE_ENDIAN 1
  |  |  ------------------
  |  |  |  Branch (14:30): [True: 1.87M, Folded]
  |  |  ------------------
  ------------------
  364|  1.87M|					{	istr [0] = d & 0xFF ;
  365|  1.87M|						istr [1] = (d >> 8) & 0xFF ;
  366|  1.87M|						istr [2] = (d >> 16) & 0xFF ;
  367|  1.87M|						istr [3] = (d >> 24) & 0xFF ;
  368|  1.87M|						}
  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|  1.87M|					istr [4] = 0 ;
  376|  1.87M|					strptr = istr ;
  377|  8.65M|					while (*strptr)
  ------------------
  |  Branch (377:13): [True: 6.77M, False: 1.87M]
  ------------------
  378|  6.77M|					{	c = *strptr++ ;
  379|  6.77M|						log_putchar (psf, psf_isprint (c) ? c : '.') ;
  ------------------
  |  Branch (379:25): [True: 5.56M, False: 1.20M]
  ------------------
  380|  6.77M|						} ;
  381|  1.87M|					break ;
  382|       |
  383|      0|			default :
  ------------------
  |  Branch (383:4): [True: 0, False: 30.4M]
  ------------------
  384|      0|					log_putchar (psf, '*') ;
  385|      0|					log_putchar (psf, c) ;
  386|      0|					log_putchar (psf, '*') ;
  387|      0|					break ;
  388|  30.4M|			} /* switch */
  389|  30.4M|		} /* while */
  390|       |
  391|  19.0M|	va_end (ap) ;
  392|  19.0M|	return ;
  393|  19.0M|} /* psf_log_printf */
psf_binheader_readf:
 1015|  6.90M|{	va_list			argptr ;
 1016|  6.90M|	sf_count_t		*countptr, countdata ;
 1017|  6.90M|	unsigned char	sixteen_bytes [16] = { 0 } ;
 1018|  6.90M|	unsigned int 	*intptr, intdata ;
 1019|  6.90M|	unsigned short	*shortptr ;
 1020|  6.90M|	char			*charptr ;
 1021|  6.90M|	float			*floatptr ;
 1022|  6.90M|	double			*doubleptr ;
 1023|  6.90M|	char			c ;
 1024|  6.90M|	int				byte_count = 0, count = 0 ;
 1025|  6.90M|	int				read_bytes = 0 ;
 1026|       |
 1027|  6.90M|	if (! format)
  ------------------
  |  Branch (1027:6): [True: 0, False: 6.90M]
  ------------------
 1028|      0|		return psf_ftell (psf) ;
 1029|       |
 1030|  6.90M|	va_start (argptr, format) ;
 1031|       |
 1032|  20.5M|	while ((c = *format++))
  ------------------
  |  Branch (1032:9): [True: 13.8M, False: 6.75M]
  ------------------
 1033|  13.8M|	{
 1034|  13.8M|		read_bytes = 0 ;
 1035|  13.8M|		if (psf->header.indx + 16 >= psf->header.len && psf_bump_header_allocation (psf, 16))
  ------------------
  |  Branch (1035:7): [True: 161k, False: 13.6M]
  |  Branch (1035:51): [True: 158k, False: 3.13k]
  ------------------
 1036|   158k|			break ;
 1037|       |
 1038|  13.6M|		switch (c)
 1039|  13.6M|		{	case 'e' : /* All conversions are now from LE to host. */
  ------------------
  |  Branch (1039:5): [True: 625k, False: 13.0M]
  ------------------
 1040|   625k|					psf->rwf_endian = SF_ENDIAN_LITTLE ;
 1041|   625k|					break ;
 1042|       |
 1043|  1.87M|			case 'E' : /* All conversions are now from BE to host. */
  ------------------
  |  Branch (1043:4): [True: 1.87M, False: 11.7M]
  ------------------
 1044|  1.87M|					psf->rwf_endian = SF_ENDIAN_BIG ;
 1045|  1.87M|					break ;
 1046|       |
 1047|  2.09M|			case 'm' : /* 4 byte marker value eg 'RIFF' */
  ------------------
  |  Branch (1047:4): [True: 2.09M, False: 11.5M]
  ------------------
 1048|  2.09M|					intptr = va_arg (argptr, unsigned int*) ;
 1049|  2.09M|					store_uint (intptr, 0) ;
 1050|  2.09M|					read_bytes = header_read (psf, sixteen_bytes, sizeof (int)) ;
 1051|  2.09M|					store_uint (intptr, GET_MARKER (sixteen_bytes)) ;
  ------------------
  |  |  833|  2.09M|#define	GET_MARKER(ptr)	(	((ptr) [0])			| ((ptr) [1] << 8) |	\
  |  |  834|  2.09M|							((ptr) [2] << 16)	| (((uint32_t) (ptr) [3]) << 24))
  ------------------
 1052|  2.09M|					break ;
 1053|       |
 1054|  97.8k|			case 'h' :
  ------------------
  |  Branch (1054:4): [True: 97.8k, False: 13.5M]
  ------------------
 1055|  97.8k|					intptr = va_arg (argptr, unsigned int*) ;
 1056|  97.8k|					store_uint (intptr, 0) ;
 1057|  97.8k|					read_bytes = header_read (psf, sixteen_bytes, sizeof (sixteen_bytes)) ;
 1058|  97.8k|					{	int k ;
 1059|  97.8k|						intdata = 0 ;
 1060|  1.66M|						for (k = 0 ; k < 16 ; k++)
  ------------------
  |  Branch (1060:20): [True: 1.56M, False: 97.8k]
  ------------------
 1061|  1.56M|							intdata ^= sixteen_bytes [k] << k ;
 1062|  97.8k|						}
 1063|  97.8k|					store_uint (intptr, intdata) ;
 1064|  97.8k|					break ;
 1065|       |
 1066|   108k|			case '1' :
  ------------------
  |  Branch (1066:4): [True: 108k, False: 13.5M]
  ------------------
 1067|   108k|					charptr = va_arg (argptr, char*) ;
 1068|   108k|					*charptr = 0 ;
 1069|   108k|					read_bytes = header_read (psf, charptr, sizeof (char)) ;
 1070|   108k|					break ;
 1071|       |
 1072|  3.01M|			case '2' : /* 2 byte value with the current endian-ness */
  ------------------
  |  Branch (1072:4): [True: 3.01M, False: 10.6M]
  ------------------
 1073|  3.01M|					shortptr = va_arg (argptr, unsigned short*) ;
 1074|  3.01M|					store_ushort (shortptr, 0) ;
 1075|  3.01M|					read_bytes = header_read (psf, sixteen_bytes, sizeof (short)) ;
 1076|  3.01M|					if (psf->rwf_endian == SF_ENDIAN_BIG)
  ------------------
  |  Branch (1076:10): [True: 2.99M, False: 17.3k]
  ------------------
 1077|  2.99M|						store_ushort (shortptr, GET_BE_SHORT (sixteen_bytes)) ;
  ------------------
  |  |  841|  2.99M|#define	GET_BE_SHORT(ptr)	(((ptr) [0] << 8) | ((ptr) [1]))
  ------------------
 1078|  17.3k|					else
 1079|  17.3k|						store_ushort (shortptr, GET_LE_SHORT (sixteen_bytes)) ;
  ------------------
  |  |  840|  17.3k|#define	GET_LE_SHORT(ptr)	(((ptr) [1] << 8) | ((ptr) [0]))
  ------------------
 1080|  3.01M|					break ;
 1081|       |
 1082|  3.74k|			case '3' : /* 3 byte value with the current endian-ness */
  ------------------
  |  Branch (1082:4): [True: 3.74k, False: 13.6M]
  ------------------
 1083|  3.74k|					intptr = va_arg (argptr, unsigned int*) ;
 1084|  3.74k|					store_uint (intptr, 0) ;
 1085|  3.74k|					read_bytes = header_read (psf, sixteen_bytes, 3) ;
 1086|  3.74k|					if (psf->rwf_endian == SF_ENDIAN_BIG)
  ------------------
  |  Branch (1086:10): [True: 0, False: 3.74k]
  ------------------
 1087|      0|						store_uint (intptr, GET_BE_3BYTE (sixteen_bytes)) ;
  ------------------
  |  |  844|      0|#define	GET_BE_3BYTE(ptr)	(	((ptr) [0] << 16) | ((ptr) [1] << 8) | ((ptr) [2]))
  ------------------
 1088|  3.74k|					else
 1089|  3.74k|						store_uint (intptr, GET_LE_3BYTE (sixteen_bytes)) ;
  ------------------
  |  |  843|  3.74k|#define	GET_LE_3BYTE(ptr)	(	((ptr) [2] << 16) | ((ptr) [1] << 8) | ((ptr) [0]))
  ------------------
 1090|  3.74k|					break ;
 1091|       |
 1092|  3.19M|			case '4' : /* 4 byte value with the current endian-ness */
  ------------------
  |  Branch (1092:4): [True: 3.19M, False: 10.4M]
  ------------------
 1093|  3.19M|					intptr = va_arg (argptr, unsigned int*) ;
 1094|  3.19M|					store_uint (intptr, 0) ;
 1095|  3.19M|					read_bytes = header_read (psf, sixteen_bytes, sizeof (int)) ;
 1096|  3.19M|					if (psf->rwf_endian == SF_ENDIAN_BIG)
  ------------------
  |  Branch (1096:10): [True: 1.97M, False: 1.22M]
  ------------------
 1097|  1.97M|						store_uint (intptr, psf_get_be32 (sixteen_bytes, 0)) ;
 1098|  1.22M|					else
 1099|  1.22M|						store_uint (intptr, psf_get_le32 (sixteen_bytes, 0)) ;
 1100|  3.19M|					break ;
 1101|       |
 1102|   122k|			case '8' : /* 8 byte value with the current endian-ness */
  ------------------
  |  Branch (1102:4): [True: 122k, False: 13.5M]
  ------------------
 1103|   122k|					countptr = va_arg (argptr, sf_count_t *) ;
 1104|   122k|					store_count (countptr, 0) ;
 1105|   122k|					read_bytes = header_read (psf, sixteen_bytes, 8) ;
 1106|   122k|					if (psf->rwf_endian == SF_ENDIAN_BIG)
  ------------------
  |  Branch (1106:10): [True: 22.2k, False: 100k]
  ------------------
 1107|  22.2k|						countdata = psf_get_be64 (sixteen_bytes, 0) ;
 1108|   100k|					else
 1109|   100k|						countdata = psf_get_le64 (sixteen_bytes, 0) ;
 1110|   122k|					store_count (countptr, countdata) ;
 1111|   122k|					break ;
 1112|       |
 1113|  37.9k|			case 'f' : /* Float conversion */
  ------------------
  |  Branch (1113:4): [True: 37.9k, False: 13.6M]
  ------------------
 1114|  37.9k|					floatptr = va_arg (argptr, float *) ;
 1115|  37.9k|					store_float (floatptr, 0.0) ;
 1116|  37.9k|					read_bytes = header_read (psf, sixteen_bytes, sizeof (float)) ;
 1117|  37.9k|					if (psf->rwf_endian == SF_ENDIAN_BIG)
  ------------------
  |  Branch (1117:10): [True: 5.15k, False: 32.7k]
  ------------------
 1118|  5.15k|						store_float (floatptr, float32_be_read (sixteen_bytes)) ;
 1119|  32.7k|					else
 1120|  32.7k|						store_float (floatptr, float32_le_read (sixteen_bytes)) ;
 1121|  37.9k|					break ;
 1122|       |
 1123|    611|			case 'd' : /* double conversion */
  ------------------
  |  Branch (1123:4): [True: 611, False: 13.6M]
  ------------------
 1124|    611|					doubleptr = va_arg (argptr, double *) ;
 1125|    611|					store_double (doubleptr, 0.0) ;
 1126|    611|					read_bytes = header_read (psf, sixteen_bytes, sizeof (double)) ;
 1127|    611|					if (psf->rwf_endian == SF_ENDIAN_BIG)
  ------------------
  |  Branch (1127:10): [True: 114, False: 497]
  ------------------
 1128|    114|						store_double (doubleptr, double64_be_read (sixteen_bytes)) ;
 1129|    497|					else
 1130|    497|						store_double (doubleptr, double64_le_read (sixteen_bytes)) ;
 1131|    611|					break ;
 1132|       |
 1133|      0|			case 's' :
  ------------------
  |  Branch (1133:4): [True: 0, False: 13.6M]
  ------------------
 1134|      0|					psf_log_printf (psf, "Format conversion 's' not implemented yet.\n") ;
 1135|       |					/*
 1136|       |					strptr = va_arg (argptr, char *) ;
 1137|       |					size   = strlen (strptr) + 1 ;
 1138|       |					size  += (size & 1) ;
 1139|       |					longdata = H2LE_32 (size) ;
 1140|       |					get_int (psf, longdata) ;
 1141|       |					memcpy (&(psf->header.ptr [psf->header.indx]), strptr, size) ;
 1142|       |					psf->header.indx += size ;
 1143|       |					*/
 1144|      0|					break ;
 1145|       |
 1146|  1.70M|			case 'b' : /* Raw bytes */
  ------------------
  |  Branch (1146:4): [True: 1.70M, False: 11.9M]
  ------------------
 1147|  1.70M|					charptr = va_arg (argptr, char*) ;
 1148|  1.70M|					count = va_arg (argptr, size_t) ;
 1149|  1.70M|					memset (charptr, 0, count) ;
 1150|  1.70M|					read_bytes = header_read (psf, charptr, count) ;
 1151|  1.70M|					break ;
 1152|       |
 1153|    138|			case 'G' :
  ------------------
  |  Branch (1153:4): [True: 138, False: 13.6M]
  ------------------
 1154|    138|					charptr = va_arg (argptr, char*) ;
 1155|    138|					count = va_arg (argptr, size_t) ;
 1156|    138|					memset (charptr, 0, count) ;
 1157|       |
 1158|    138|					if (psf->header.indx + count >= psf->header.len && psf_bump_header_allocation (psf, count))
  ------------------
  |  Branch (1158:10): [True: 0, False: 138]
  |  Branch (1158:57): [True: 0, False: 0]
  ------------------
 1159|      0|						break ;
 1160|       |
 1161|    138|					read_bytes = header_gets (psf, charptr, count) ;
 1162|    138|					break ;
 1163|       |
 1164|      0|			case 'z' :
  ------------------
  |  Branch (1164:4): [True: 0, False: 13.6M]
  ------------------
 1165|      0|					psf_log_printf (psf, "Format conversion 'z' not implemented yet.\n") ;
 1166|       |					/*
 1167|       |					size    = va_arg (argptr, size_t) ;
 1168|       |					while (size)
 1169|       |					{	psf->header.ptr [psf->header.indx] = 0 ;
 1170|       |						psf->header.indx ++ ;
 1171|       |						size -- ;
 1172|       |						} ;
 1173|       |					*/
 1174|      0|					break ;
 1175|       |
 1176|  22.1k|			case 'p' :	/* Seek to position from start. */
  ------------------
  |  Branch (1176:4): [True: 22.1k, False: 13.6M]
  ------------------
 1177|  22.1k|					count = va_arg (argptr, size_t) ;
 1178|  22.1k|					header_seek (psf, count, SEEK_SET) ;
 1179|  22.1k|					byte_count = count ;
 1180|  22.1k|					break ;
 1181|       |
 1182|   735k|			case 'j' :	/* Seek to position from current position. */
  ------------------
  |  Branch (1182:4): [True: 735k, False: 12.9M]
  ------------------
 1183|   735k|					count = va_arg (argptr, size_t) ;
 1184|   735k|					header_seek (psf, count, SEEK_CUR) ;
 1185|   735k|					read_bytes = count ;
 1186|   735k|					break ;
 1187|       |
 1188|  2.41k|			case '!' : /* Clear buffer, forcing re-read. */
  ------------------
  |  Branch (1188:4): [True: 2.41k, False: 13.6M]
  ------------------
 1189|  2.41k|					psf->header.end = psf->header.indx = 0 ;
 1190|  2.41k|					break ;
 1191|       |
 1192|      0|			default :
  ------------------
  |  Branch (1192:4): [True: 0, False: 13.6M]
  ------------------
 1193|      0|				psf_log_printf (psf, "*** Invalid format specifier `%c'\n", c) ;
 1194|      0|				psf->error = SFE_INTERNAL ;
 1195|      0|				break ;
 1196|  13.6M|			} ;
 1197|       |
 1198|  13.6M|		if (read_bytes > 0 && byte_count > (INT_MAX - read_bytes))
  ------------------
  |  Branch (1198:7): [True: 4.74M, False: 8.90M]
  |  Branch (1198:25): [True: 1, False: 4.74M]
  ------------------
 1199|      1|		{	psf_log_printf (psf, "Header size exceeds INT_MAX. Aborting.", c) ;
 1200|      1|			psf->error = SFE_INTERNAL ;
 1201|      1|			break ;
 1202|      1|		} else
 1203|  13.6M|		{	byte_count += read_bytes ;
 1204|  13.6M|		} ;
 1205|       |
 1206|  13.6M|		} ;	/*end while*/
 1207|       |
 1208|  6.90M|	va_end (argptr) ;
 1209|       |
 1210|  6.90M|	return byte_count ;
 1211|  6.90M|} /* psf_binheader_readf */
psf_log_SF_INFO:
 1276|  1.06k|{	psf_log_printf (psf, "---------------------------------\n") ;
 1277|       |
 1278|  1.06k|	psf_log_printf (psf, " Sample rate :   %d\n", psf->sf.samplerate) ;
 1279|  1.06k|	if (psf->sf.frames == SF_COUNT_MAX)
  ------------------
  |  |  370|  1.06k|#define SF_COUNT_MAX	INT64_MAX
  ------------------
  |  Branch (1279:6): [True: 1, False: 1.06k]
  ------------------
 1280|      1|		psf_log_printf (psf, " Frames      :   unknown\n") ;
 1281|  1.06k|	else
 1282|  1.06k|		psf_log_printf (psf, " Frames      :   %D\n", psf->sf.frames) ;
 1283|  1.06k|	psf_log_printf (psf, " Channels    :   %d\n", psf->sf.channels) ;
 1284|       |
 1285|  1.06k|	psf_log_printf (psf, " Format      :   0x%X\n", psf->sf.format) ;
 1286|  1.06k|	psf_log_printf (psf, " Sections    :   %d\n", psf->sf.sections) ;
 1287|  1.06k|	psf_log_printf (psf, " Seekable    :   %s\n", psf->sf.seekable ? "TRUE" : "FALSE") ;
  ------------------
  |  Branch (1287:48): [True: 864, False: 199]
  ------------------
 1288|       |
 1289|  1.06k|	psf_log_printf (psf, "---------------------------------\n") ;
 1290|  1.06k|} /* psf_dump_SFINFO */
psf_isprint:
 1297|  7.52M|{	return (ch >= ' ' && ch <= '~') ;
  ------------------
  |  Branch (1297:11): [True: 6.19M, False: 1.32M]
  |  Branch (1297:24): [True: 6.18M, False: 11.3k]
  ------------------
 1298|  7.52M|} /* psf_isprint */
psf_strlcpy:
 1308|  28.0k|{	strncpy (dest, src, n - 1) ;
 1309|  28.0k|	dest [n - 1] = 0 ;
 1310|  28.0k|} /* psf_strlcpy */
psf_memset:
 1328|  1.96k|{	char	*ptr ;
 1329|  1.96k|	int 	setcount ;
 1330|       |
 1331|  1.96k|	ptr = (char *) s ;
 1332|       |
 1333|  3.93k|	while (len > 0)
  ------------------
  |  Branch (1333:9): [True: 1.96k, False: 1.96k]
  ------------------
 1334|  1.96k|	{	setcount = (len > 0x10000000) ? 0x10000000 : (int) len ;
  ------------------
  |  Branch (1334:15): [True: 0, False: 1.96k]
  ------------------
 1335|       |
 1336|  1.96k|		memset (ptr, c, setcount) ;
 1337|       |
 1338|  1.96k|		ptr += setcount ;
 1339|  1.96k|		len -= setcount ;
 1340|  1.96k|		} ;
 1341|       |
 1342|  1.96k|	return s ;
 1343|  1.96k|} /* psf_memset */
psf_cues_alloc:
 1365|  1.17k|{	SF_CUES *pcues = calloc (1, SF_CUES_VAR_SIZE (cue_count)) ;
  ------------------
  |  | 1358|  1.17k|#define SF_CUES_VAR_SIZE(count)	(sizeof (SF_CUES_0) + count * sizeof (SF_CUE_POINT))
  ------------------
 1366|  1.17k|	if (pcues)
  ------------------
  |  Branch (1366:6): [True: 1.17k, False: 0]
  ------------------
 1367|  1.17k|	{	pcues->cue_count = cue_count ;
 1368|  1.17k|		} ;
 1369|  1.17k|	return pcues ;
 1370|  1.17k|} /* psf_cues_alloc */
psf_instrument_alloc:
 1403|  1.11k|{	SF_INSTRUMENT *instr ;
 1404|       |
 1405|  1.11k|	instr = calloc (1, sizeof (SF_INSTRUMENT)) ;
 1406|       |
 1407|  1.11k|	if (instr == NULL)
  ------------------
  |  Branch (1407:6): [True: 0, False: 1.11k]
  ------------------
 1408|      0|		return NULL ;
 1409|       |
 1410|       |	/* Set non-zero default values. */
 1411|  1.11k|	instr->basenote = -1 ;
 1412|  1.11k|	instr->velocity_lo = -1 ;
 1413|  1.11k|	instr->velocity_hi = -1 ;
 1414|  1.11k|	instr->key_lo = -1 ;
 1415|  1.11k|	instr->key_hi = -1 ;
 1416|       |
 1417|  1.11k|	return instr ;
 1418|  1.11k|} /* psf_instrument_alloc */
psf_sanitize_string:
 1422|    330|{
 1423|    330|	do
 1424|   140k|	{
 1425|   140k|		len -- ;
 1426|   140k|		cptr [len] = psf_isprint (cptr [len]) ? cptr [len] : '.' ;
  ------------------
  |  Branch (1426:16): [True: 38.1k, False: 102k]
  ------------------
 1427|   140k|	}
 1428|   140k|	while (len > 0) ;
  ------------------
  |  Branch (1428:9): [True: 140k, False: 330]
  ------------------
 1429|    330|} /* psf_sanitize_string */
s_bitwidth_to_subformat:
 1482|  7.60k|{	static int array [] =
 1483|  7.60k|	{	SF_FORMAT_PCM_S8, SF_FORMAT_PCM_16, SF_FORMAT_PCM_24, SF_FORMAT_PCM_32
 1484|  7.60k|		} ;
 1485|       |
 1486|  7.60k|	if (bits < 8 || bits > 32)
  ------------------
  |  Branch (1486:6): [True: 1.14k, False: 6.45k]
  |  Branch (1486:18): [True: 3.71k, False: 2.73k]
  ------------------
 1487|  4.86k|		return 0 ;
 1488|       |
 1489|  2.73k|	return array [((bits + 7) / 8) - 1] ;
 1490|  7.60k|} /* bitwidth_to_subformat */
u_bitwidth_to_subformat:
 1494|    232|{	static int array [] =
 1495|    232|	{	SF_FORMAT_PCM_U8, SF_FORMAT_PCM_16, SF_FORMAT_PCM_24, SF_FORMAT_PCM_32
 1496|    232|		} ;
 1497|       |
 1498|    232|	if (bits < 8 || bits > 32)
  ------------------
  |  Branch (1498:6): [True: 13, False: 219]
  |  Branch (1498:18): [True: 73, False: 146]
  ------------------
 1499|     86|		return 0 ;
 1500|       |
 1501|    146|	return array [((bits + 7) / 8) - 1] ;
 1502|    232|} /* bitwidth_to_subformat */
psf_rand_int32:
 1512|  18.9k|{	static uint64_t value = 0 ;
 1513|  18.9k|	int k, count ;
 1514|       |
 1515|  18.9k|	if (value == 0)
  ------------------
  |  Branch (1515:6): [True: 1, False: 18.9k]
  ------------------
 1516|      1|	{
 1517|      1|#if HAVE_GETTIMEOFDAY
 1518|      1|		struct timeval tv ;
 1519|      1|		gettimeofday (&tv, NULL) ;
 1520|      1|		value = tv.tv_sec + tv.tv_usec ;
 1521|       |#else
 1522|       |		value = time (NULL) ;
 1523|       |#endif
 1524|      1|		} ;
 1525|       |
 1526|  18.9k|	count = 4 + (value & 7) ;
 1527|   170k|	for (k = 0 ; k < count ; k++)
  ------------------
  |  Branch (1527:15): [True: 151k, False: 18.9k]
  ------------------
 1528|   151k|		value = (11117 * value + 211231) & 0x7fffffff ;
 1529|       |
 1530|  18.9k|	return (int32_t) value ;
 1531|  18.9k|} /* psf_rand_int32 */
append_snprintf:
 1535|  1.06k|{	size_t len = strlen (dest) ;
 1536|       |
 1537|  1.06k|	if (len < maxlen)
  ------------------
  |  Branch (1537:6): [True: 1.06k, False: 0]
  ------------------
 1538|  1.06k|	{	va_list ap ;
 1539|       |
 1540|  1.06k|		va_start (ap, fmt) ;
 1541|  1.06k|		vsnprintf (dest + len, maxlen - len, fmt, ap) ;
 1542|  1.06k|		va_end (ap) ;
 1543|  1.06k|		} ;
 1544|       |
 1545|  1.06k|	return ;
 1546|  1.06k|} /* append_snprintf */
psf_decode_frame_count:
 1586|    243|{	sf_count_t count, readlen, total = 0 ;
 1587|    243|	BUF_UNION	ubuf ;
 1588|       |
 1589|       |	/* If we're reading from a pipe or the file is too long, just return SF_COUNT_MAX. */
 1590|    243|	if (psf_is_pipe (psf) || psf->datalength > 0x1000000)
  ------------------
  |  Branch (1590:6): [True: 0, False: 243]
  |  Branch (1590:27): [True: 0, False: 243]
  ------------------
 1591|      0|		return SF_COUNT_MAX ;
  ------------------
  |  |  370|      0|#define SF_COUNT_MAX	INT64_MAX
  ------------------
 1592|       |
 1593|    243|	psf_fseek (psf, psf->dataoffset, SEEK_SET) ;
 1594|       |
 1595|    243|	readlen = ARRAY_LEN (ubuf.ibuf) / psf->sf.channels ;
  ------------------
  |  |   93|    243|#define		ARRAY_LEN(x)	((int) (sizeof (x) / sizeof ((x) [0])))
  ------------------
 1596|    243|	readlen *= psf->sf.channels ;
 1597|       |
 1598|  6.42k|	while ((count = psf->read_int (psf, ubuf.ibuf, readlen)) > 0)
  ------------------
  |  Branch (1598:9): [True: 6.18k, False: 243]
  ------------------
 1599|  6.18k|		total += count ;
 1600|       |
 1601|    243|	psf_fseek (psf, psf->dataoffset, SEEK_SET) ;
 1602|       |
 1603|    243|	return total / psf->sf.channels ;
 1604|    243|} /* psf_decode_frame_count */
common.c:log_putchar:
   97|   680M|{	if (psf->parselog.indx < SIGNED_SIZEOF (psf->parselog.buf) - 1)
  ------------------
  |  |   91|   680M|#define		SIGNED_SIZEOF(x)	((int) sizeof (x))
  ------------------
  |  Branch (97:7): [True: 9.81M, False: 670M]
  ------------------
   98|  9.81M|	{	psf->parselog.buf [psf->parselog.indx++] = ch ;
   99|  9.81M|		psf->parselog.buf [psf->parselog.indx] = 0 ;
  100|  9.81M|		} ;
  101|   680M|	return ;
  102|   680M|} /* log_putchar */
common.c:psf_bump_header_allocation:
   60|   170k|{
   61|   170k|	sf_count_t newlen, smallest = INITIAL_HEADER_SIZE ;
  ------------------
  |  |   39|   170k|#define	INITIAL_HEADER_SIZE	256
  ------------------
   62|   170k|	void * ptr ;
   63|       |
   64|   170k|	newlen = (needed > psf->header.len) ? 2 * SF_MAX (needed, smallest) : 2 * psf->header.len ;
  ------------------
  |  |   95|  3.91k|#define		SF_MAX(a, b)	((a) > (b) ? (a) : (b))
  |  |  ------------------
  |  |  |  Branch (95:24): [True: 3.91k, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (64:11): [True: 3.91k, False: 166k]
  ------------------
   65|       |
   66|   170k|	if (newlen > 100 * 1024)
  ------------------
  |  Branch (66:6): [True: 164k, False: 6.04k]
  ------------------
   67|   164k|	{	psf_log_printf (psf, "Request for header allocation of %D denied.\n", newlen) ;
   68|   164k|		return 1 ;
   69|   164k|		}
   70|       |
   71|  6.04k|	if ((ptr = realloc (psf->header.ptr, newlen)) == NULL)
  ------------------
  |  Branch (71:6): [True: 0, False: 6.04k]
  ------------------
   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|  6.04k|		} ;
   76|       |
   77|       |	/* Always zero-out new header memory to avoid un-initializer memory accesses. */
   78|  6.04k|	if (newlen > psf->header.len)
  ------------------
  |  Branch (78:6): [True: 6.04k, False: 0]
  ------------------
   79|  6.04k|		memset ((char *) ptr + psf->header.len, 0, newlen - psf->header.len) ;
   80|       |
   81|  6.04k|	psf->header.ptr = ptr ;
   82|  6.04k|	psf->header.len = newlen ;
   83|  6.04k|	return 0 ;
   84|  6.04k|} /* psf_bump_header_allocation */
common.c:store_uint:
  990|  10.8M|{	memcpy (ptr, &value, sizeof (value)) ;
  991|  10.8M|} /* store_uint */
common.c:header_read:
  866|  10.3M|{	int count = 0 ;
  867|       |
  868|  10.3M|	if (psf->header.indx + bytes >= psf->header.len && psf_bump_header_allocation (psf, bytes))
  ------------------
  |  Branch (868:6): [True: 2.62k, False: 10.3M]
  |  Branch (868:53): [True: 1.39k, False: 1.22k]
  ------------------
  869|  1.39k|		return count ;
  870|       |
  871|  10.3M|	if (psf->header.indx + bytes > psf->header.end)
  ------------------
  |  Branch (871:6): [True: 7.10M, False: 3.28M]
  ------------------
  872|  7.10M|	{	count = psf_fread (psf->header.ptr + psf->header.end, 1, bytes - (psf->header.end - psf->header.indx), psf) ;
  873|  7.10M|		if (count != bytes - (int) (psf->header.end - psf->header.indx))
  ------------------
  |  Branch (873:7): [True: 4.51M, False: 2.59M]
  ------------------
  874|  4.51M|		{	psf_log_printf (psf, "Error : psf_fread returned short count.\n") ;
  875|  4.51M|			return count ;
  876|  4.51M|			} ;
  877|  2.59M|		psf->header.end += count ;
  878|  5.87M|		} ;
  879|       |
  880|  5.87M|	memcpy (ptr, psf->header.ptr + psf->header.indx, bytes) ;
  881|  5.87M|	psf->header.indx += bytes ;
  882|       |
  883|  5.87M|	return bytes ;
  884|  10.3M|} /* header_read */
common.c:store_ushort:
  995|  6.03M|{	memcpy (ptr, &value, sizeof (value)) ;
  996|  6.03M|} /* store_ushort */
common.c:store_count:
 1000|   245k|{	memcpy (ptr, &value, sizeof (value)) ;
 1001|   245k|} /* store_count */
common.c:store_float:
 1005|  75.8k|{	memcpy (ptr, &value, sizeof (value)) ;
 1006|  75.8k|} /* store_float */
common.c:store_double:
 1010|  1.22k|{	memcpy (ptr, &value, sizeof (value)) ;
 1011|  1.22k|} /* store_double */
common.c:header_gets:
  957|    138|{	int		k ;
  958|       |
  959|    138|	if (psf->header.indx + bufsize >= psf->header.len && psf_bump_header_allocation (psf, bufsize))
  ------------------
  |  Branch (959:6): [True: 0, False: 138]
  |  Branch (959:55): [True: 0, False: 0]
  ------------------
  960|      0|		return 0 ;
  961|       |
  962|  3.28k|	for (k = 0 ; k < bufsize - 1 ; k++)
  ------------------
  |  Branch (962:15): [True: 3.18k, False: 91]
  ------------------
  963|  3.18k|	{	if (psf->header.indx < psf->header.end)
  ------------------
  |  Branch (963:8): [True: 948, False: 2.24k]
  ------------------
  964|    948|		{	ptr [k] = psf->header.ptr [psf->header.indx] ;
  965|    948|			psf->header.indx ++ ;
  966|    948|			}
  967|  2.24k|		else
  968|  2.24k|		{	psf->header.end += psf_fread (psf->header.ptr + psf->header.end, 1, 1, psf) ;
  969|  2.24k|			ptr [k] = psf->header.ptr [psf->header.indx] ;
  970|  2.24k|			psf->header.indx = psf->header.end ;
  971|  2.24k|			} ;
  972|       |
  973|  3.18k|		if (ptr [k] == '\n')
  ------------------
  |  Branch (973:7): [True: 47, False: 3.14k]
  ------------------
  974|     47|			break ;
  975|  3.18k|		} ;
  976|       |
  977|    138|	ptr [k] = 0 ;
  978|       |
  979|    138|	return k ;
  980|    138|} /* header_gets */
common.c:header_seek:
  888|   758k|{
  889|   758k|	switch (whence)
  890|   758k|	{	case SEEK_SET :
  ------------------
  |  Branch (890:4): [True: 22.1k, False: 735k]
  ------------------
  891|  22.1k|			if (psf->header.indx + position >= psf->header.len)
  ------------------
  |  Branch (891:8): [True: 184, False: 21.9k]
  ------------------
  892|    184|				psf_bump_header_allocation (psf, position) ;
  893|  22.1k|			if (position > psf->header.len)
  ------------------
  |  Branch (893:8): [True: 4, False: 22.1k]
  ------------------
  894|      4|			{	/* Too much header to cache so just seek instead. */
  895|      4|				psf->header.indx = psf->header.end = 0 ;
  896|      4|				psf_fseek (psf, position, whence) ;
  897|      4|				return ;
  898|  22.1k|				} ;
  899|  22.1k|			if (position > psf->header.end)
  ------------------
  |  Branch (899:8): [True: 736, False: 21.4k]
  ------------------
  900|    736|				psf->header.end += psf_fread (psf->header.ptr + psf->header.end, 1, position - psf->header.end, psf) ;
  901|  22.1k|			psf->header.indx = position ;
  902|  22.1k|			break ;
  903|       |
  904|   735k|		case SEEK_CUR :
  ------------------
  |  Branch (904:3): [True: 735k, False: 22.1k]
  ------------------
  905|   735k|			if (psf->header.indx + position >= psf->header.len)
  ------------------
  |  Branch (905:8): [True: 6.12k, False: 729k]
  ------------------
  906|  6.12k|				psf_bump_header_allocation (psf, position) ;
  907|       |
  908|   735k|			if (psf->header.indx + position < 0)
  ------------------
  |  Branch (908:8): [True: 37.9k, False: 698k]
  ------------------
  909|  37.9k|				break ;
  910|       |
  911|   698k|			if (psf->header.indx >= psf->header.len)
  ------------------
  |  Branch (911:8): [True: 0, False: 698k]
  ------------------
  912|      0|			{	psf_fseek (psf, position, whence) ;
  913|      0|				return ;
  914|   698k|				} ;
  915|       |
  916|   698k|			if (psf->header.indx + position <= psf->header.end)
  ------------------
  |  Branch (916:8): [True: 424k, False: 273k]
  ------------------
  917|   424k|			{	psf->header.indx += position ;
  918|   424k|				break ;
  919|   424k|				} ;
  920|       |
  921|   273k|			if (psf->header.indx + position > psf->header.len)
  ------------------
  |  Branch (921:8): [True: 4.61k, False: 268k]
  ------------------
  922|  4.61k|			{	/* Need to jump this without caching it. */
  923|  4.61k|				position -= (psf->header.end - psf->header.indx) ;
  924|  4.61k|				psf->header.indx = psf->header.end ;
  925|  4.61k|				if (psf->is_pipe)
  ------------------
  |  Branch (925:9): [True: 0, False: 4.61k]
  ------------------
  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|  4.61k|				else
  937|  4.61k|				{	psf_fseek (psf, position, SEEK_CUR) ;
  938|  4.61k|					}
  939|  4.61k|				break ;
  940|   268k|				} ;
  941|       |
  942|   268k|			psf->header.end += psf_fread (psf->header.ptr + psf->header.end, 1, position - (psf->header.end - psf->header.indx), psf) ;
  943|   268k|			psf->header.indx = psf->header.end ;
  944|   268k|			break ;
  945|       |
  946|      0|		case SEEK_END :
  ------------------
  |  Branch (946:3): [True: 0, False: 758k]
  ------------------
  947|      0|		default :
  ------------------
  |  Branch (947:3): [True: 0, False: 758k]
  ------------------
  948|      0|			psf_log_printf (psf, "Bad whence param in header_seek().\n") ;
  949|      0|			break ;
  950|   758k|		} ;
  951|       |
  952|   758k|	return ;
  953|   758k|} /* header_seek */

aiff.c:peak_info_calloc:
  233|  1.61k|{	return calloc (1, sizeof (PEAK_INFO) + channels * sizeof (PEAK_POS)) ;
  234|  1.61k|} /* peak_info_calloc */
aiff.c:make_size_t:
  279|  3.07k|{	return (size_t) x ;
  280|  3.07k|} /* make_size_t */
avr.c:arith_shift_left:
 1086|     90|{	return (int32_t) (((uint32_t) x) << shift) ;
 1087|     90|} /* arith_shift_left */
caf.c:peak_info_calloc:
  233|    284|{	return calloc (1, sizeof (PEAK_INFO) + channels * sizeof (PEAK_POS)) ;
  234|    284|} /* peak_info_calloc */
caf.c:psf_lrint:
  974|  2.33k|{
  975|  2.33k|	#ifdef USE_SSE2
  976|  2.33k|		return _mm_cvtsd_si32 (_mm_load_sd (&x)) ;
  977|       |	#else
  978|       |		return lrint (x) ;
  979|       |	#endif
  980|  2.33k|} /* psf_lrintf */
ircam.c:psf_lrintf:
  965|    266|{
  966|    266|	#ifdef USE_SSE2
  967|    266|		return _mm_cvtss_si32 (_mm_load_ss (&x)) ;
  968|       |	#else
  969|       |		return lrintf (x) ;
  970|       |	#endif
  971|    266|} /* psf_lrintf */
mat4.c:psf_lrint:
  974|    609|{
  975|    609|	#ifdef USE_SSE2
  976|    609|		return _mm_cvtsd_si32 (_mm_load_sd (&x)) ;
  977|       |	#else
  978|       |		return lrint (x) ;
  979|       |	#endif
  980|    609|} /* psf_lrintf */
mat5.c:psf_lrint:
  974|      2|{
  975|      2|	#ifdef USE_SSE2
  976|      2|		return _mm_cvtsd_si32 (_mm_load_sd (&x)) ;
  977|       |	#else
  978|       |		return lrint (x) ;
  979|       |	#endif
  980|      2|} /* psf_lrintf */
sds.c:arith_shift_left:
 1086|   153M|{	return (int32_t) (((uint32_t) x) << shift) ;
 1087|   153M|} /* arith_shift_left */
wavlike.c:make_size_t:
  279|  1.67k|{	return (size_t) x ;
  280|  1.67k|} /* make_size_t */
wavlike.c:peak_info_calloc:
  233|  11.1k|{	return calloc (1, sizeof (PEAK_INFO) + channels * sizeof (PEAK_POS)) ;
  234|  11.1k|} /* peak_info_calloc */
xi.c:arith_shift_left:
 1086|    916|{	return (int32_t) (((uint32_t) x) << shift) ;
 1087|    916|} /* arith_shift_left */
mpc2k.c:make_size_t:
  279|     10|{	return (size_t) x ;
  280|     10|} /* make_size_t */
dwvw.c:arith_shift_left:
 1086|  21.6M|{	return (int32_t) (((uint32_t) x) << shift) ;
 1087|  21.6M|} /* arith_shift_left */

double64_init:
   92|    296|{	static int double64_caps ;
   93|       |
   94|    296|	if (psf->sf.channels < 1 || psf->sf.channels > SF_MAX_CHANNELS)
  ------------------
  |  |  102|    215|#define		SF_MAX_CHANNELS		1024
  ------------------
  |  Branch (94:6): [True: 81, False: 215]
  |  Branch (94:30): [True: 1, False: 214]
  ------------------
   95|     82|	{	psf_log_printf (psf, "double64_init : internal error : channels = %d\n", psf->sf.channels) ;
   96|     82|		return SFE_INTERNAL ;
   97|    214|		} ;
   98|       |
   99|    214|	double64_caps = double64_get_capability (psf) ;
  100|       |
  101|    214|	psf->blockwidth = sizeof (double) * psf->sf.channels ;
  102|       |
  103|    214|	if (psf->file.mode == SFM_READ || psf->file.mode == SFM_RDWR)
  ------------------
  |  Branch (103:6): [True: 214, False: 0]
  |  Branch (103:36): [True: 0, False: 0]
  ------------------
  104|    214|	{	switch (psf->endian + double64_caps)
  105|    214|		{	case (SF_ENDIAN_BIG + DOUBLE_CAN_RW_BE) :
  ------------------
  |  Branch (105:5): [True: 0, False: 214]
  ------------------
  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|    129|			case (SF_ENDIAN_LITTLE + DOUBLE_CAN_RW_LE) :
  ------------------
  |  Branch (113:4): [True: 129, False: 85]
  ------------------
  114|    129|					psf->data_endswap = SF_FALSE ;
  115|    129|					psf->read_short		= host_read_d2s ;
  116|    129|					psf->read_int		= host_read_d2i ;
  117|    129|					psf->read_float		= host_read_d2f ;
  118|    129|					psf->read_double	= host_read_d ;
  119|    129|					break ;
  120|       |
  121|     85|			case (SF_ENDIAN_BIG + DOUBLE_CAN_RW_LE) :
  ------------------
  |  Branch (121:4): [True: 85, False: 129]
  ------------------
  122|     85|					psf->data_endswap = SF_TRUE ;
  123|     85|					psf->read_short		= host_read_d2s ;
  124|     85|					psf->read_int		= host_read_d2i ;
  125|     85|					psf->read_float		= host_read_d2f ;
  126|     85|					psf->read_double	= host_read_d ;
  127|     85|					break ;
  128|       |
  129|      0|			case (SF_ENDIAN_LITTLE + DOUBLE_CAN_RW_BE) :
  ------------------
  |  Branch (129:4): [True: 0, False: 214]
  ------------------
  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: 214]
  ------------------
  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: 214]
  ------------------
  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: 214]
  ------------------
  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: 214]
  ------------------
  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: 214]
  ------------------
  171|    214|			} ;
  172|    214|		} ;
  173|       |
  174|    214|	if (psf->file.mode == SFM_WRITE || psf->file.mode == SFM_RDWR)
  ------------------
  |  Branch (174:6): [True: 0, False: 214]
  |  Branch (174:37): [True: 0, False: 214]
  ------------------
  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|    214|		} ;
  244|       |
  245|    214|	if (psf->filelength > psf->dataoffset)
  ------------------
  |  Branch (245:6): [True: 163, False: 51]
  ------------------
  246|    163|	{	psf->datalength = (psf->dataend > 0) ? psf->dataend - psf->dataoffset :
  ------------------
  |  Branch (246:22): [True: 2, False: 161]
  ------------------
  247|    163|							psf->filelength - psf->dataoffset ;
  248|    163|		}
  249|     51|	else
  250|     51|		psf->datalength = 0 ;
  251|       |
  252|    214|	psf->sf.frames = psf->datalength / psf->blockwidth ;
  253|       |
  254|    214|	return 0 ;
  255|    214|} /* double64_init */
double64_be_read:
  285|  2.52k|{	int		exponent, negative, upper, lower ;
  286|  2.52k|	double	dvalue ;
  287|       |
  288|  2.52k|	negative = (cptr [0] & 0x80) ? 1 : 0 ;
  ------------------
  |  Branch (288:13): [True: 302, False: 2.22k]
  ------------------
  289|  2.52k|	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.52k|	upper = (((cptr [1] & 0xF) << 24) | (cptr [2] << 16) | (cptr [3] << 8) | cptr [4]) ;
  293|  2.52k|	lower = (cptr [5] << 16) | (cptr [6] << 8) | cptr [7] ;
  294|       |
  295|  2.52k|	if (exponent == 0 && upper == 0 && lower == 0)
  ------------------
  |  Branch (295:6): [True: 295, False: 2.23k]
  |  Branch (295:23): [True: 176, False: 119]
  |  Branch (295:37): [True: 163, False: 13]
  ------------------
  296|    163|		return 0.0 ;
  297|       |
  298|  2.36k|	dvalue = upper + lower / ((double) 0x1000000) ;
  299|  2.36k|	dvalue += 0x10000000 ;
  300|       |
  301|  2.36k|	exponent = exponent - 0x3FF ;
  302|       |
  303|  2.36k|	dvalue = dvalue / ((double) 0x10000000) ;
  304|       |
  305|  2.36k|	if (negative)
  ------------------
  |  Branch (305:6): [True: 302, False: 2.06k]
  ------------------
  306|    302|		dvalue *= -1 ;
  307|       |
  308|  2.36k|	if (exponent > 0)
  ------------------
  |  Branch (308:6): [True: 1.81k, False: 553]
  ------------------
  309|  1.81k|		dvalue *= pow (2.0, exponent) ;
  310|    553|	else if (exponent < 0)
  ------------------
  |  Branch (310:11): [True: 509, False: 44]
  ------------------
  311|    509|		dvalue /= pow (2.0, abs (exponent)) ;
  312|       |
  313|  2.36k|	return dvalue ;
  314|  2.52k|} /* double64_be_read */
double64_le_read:
  318|    497|{	int		exponent, negative, upper, lower ;
  319|    497|	double	dvalue ;
  320|       |
  321|    497|	negative = (cptr [7] & 0x80) ? 1 : 0 ;
  ------------------
  |  Branch (321:13): [True: 136, False: 361]
  ------------------
  322|    497|	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|    497|	upper = ((cptr [6] & 0xF) << 24) | (cptr [5] << 16) | (cptr [4] << 8) | cptr [3] ;
  326|    497|	lower = (cptr [2] << 16) | (cptr [1] << 8) | cptr [0] ;
  327|       |
  328|    497|	if (exponent == 0 && upper == 0 && lower == 0)
  ------------------
  |  Branch (328:6): [True: 202, False: 295]
  |  Branch (328:23): [True: 110, False: 92]
  |  Branch (328:37): [True: 58, False: 52]
  ------------------
  329|     58|		return 0.0 ;
  330|       |
  331|    439|	dvalue = upper + lower / ((double) 0x1000000) ;
  332|    439|	dvalue += 0x10000000 ;
  333|       |
  334|    439|	exponent = exponent - 0x3FF ;
  335|       |
  336|    439|	dvalue = dvalue / ((double) 0x10000000) ;
  337|       |
  338|    439|	if (negative)
  ------------------
  |  Branch (338:6): [True: 136, False: 303]
  ------------------
  339|    136|		dvalue *= -1 ;
  340|       |
  341|    439|	if (exponent > 0)
  ------------------
  |  Branch (341:6): [True: 136, False: 303]
  ------------------
  342|    136|		dvalue *= pow (2.0, exponent) ;
  343|    303|	else if (exponent < 0)
  ------------------
  |  Branch (343:11): [True: 299, False: 4]
  ------------------
  344|    299|		dvalue /= pow (2.0, abs (exponent)) ;
  345|       |
  346|    439|	return dvalue ;
  347|    497|} /* double64_le_read */
double64.c:double64_get_capability:
  459|    214|{	union
  460|    214|	{	double			d ;
  461|    214|		unsigned char	c [8] ;
  462|    214|	} data ;
  463|       |
  464|    214|	data.d = 1.234567890123456789 ; /* Some arbitrary value. */
  465|       |
  466|    214|	if (! psf->ieee_replace)
  ------------------
  |  Branch (466:6): [True: 214, False: 0]
  ------------------
  467|    214|	{	/* If this test is true ints and floats are compatible and little endian. */
  468|    214|		if (data.c [0] == 0xfb && data.c [1] == 0x59 && data.c [2] == 0x8c && data.c [3] == 0x42 &&
  ------------------
  |  Branch (468:7): [True: 214, False: 0]
  |  Branch (468:29): [True: 214, False: 0]
  |  Branch (468:51): [True: 214, False: 0]
  |  Branch (468:73): [True: 214, False: 0]
  ------------------
  469|    214|			data.c [4] == 0xca && data.c [5] == 0xc0 && data.c [6] == 0xf3 && data.c [7] == 0x3f)
  ------------------
  |  Branch (469:4): [True: 214, False: 0]
  |  Branch (469:26): [True: 214, False: 0]
  |  Branch (469:48): [True: 214, False: 0]
  |  Branch (469:70): [True: 214, False: 0]
  ------------------
  470|    214|			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|    214|} /* double64_get_capability */
double64.c:host_read_d2f:
  622|    632|{	BUF_UNION	ubuf ;
  623|    632|	int			bufferlen, readcount ;
  624|    632|	sf_count_t	total = 0 ;
  625|       |
  626|    632|	bufferlen = ARRAY_LEN (ubuf.dbuf) ;
  ------------------
  |  |   93|    632|#define		ARRAY_LEN(x)	((int) (sizeof (x) / sizeof ((x) [0])))
  ------------------
  627|       |
  628|  1.23k|	while (len > 0)
  ------------------
  |  Branch (628:9): [True: 632, False: 598]
  ------------------
  629|    632|	{	if (len < bufferlen)
  ------------------
  |  Branch (629:8): [True: 566, False: 66]
  ------------------
  630|    566|			bufferlen = (int) len ;
  631|    632|		readcount = (int) psf_fread (ubuf.dbuf, sizeof (double), bufferlen, psf) ;
  632|       |
  633|    632|		if (psf->data_endswap == SF_TRUE)
  ------------------
  |  Branch (633:7): [True: 420, False: 212]
  ------------------
  634|    420|			endswap_double_array (ubuf.dbuf, readcount) ;
  635|       |
  636|    632|		d2f_array (ubuf.dbuf, readcount, ptr + total) ;
  637|    632|		total += readcount ;
  638|    632|		len -= readcount ;
  639|    632|		if (readcount < bufferlen)
  ------------------
  |  Branch (639:7): [True: 34, False: 598]
  ------------------
  640|     34|			break ;
  641|    632|		} ;
  642|       |
  643|    632|	return total ;
  644|    632|} /* host_read_d2f */
double64.c:d2f_array:
  531|  61.9k|{	for (int i = 0 ; i < count ; i++)
  ------------------
  |  Branch (531:20): [True: 61.3k, False: 632]
  ------------------
  532|  61.3k|	{	dest [i] = src [i] ;
  533|  61.3k|		} ;
  534|    632|} /* 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|    243|{	DWVW_PRIVATE	*pdwvw ;
   81|       |
   82|    243|	if (psf->codec_data != NULL)
  ------------------
  |  Branch (82:6): [True: 0, False: 243]
  ------------------
   83|      0|	{	psf_log_printf (psf, "*** psf->codec_data is not NULL.\n") ;
   84|      0|		return SFE_INTERNAL ;
   85|    243|		} ;
   86|       |
   87|    243|	if (bitwidth > 24)
  ------------------
  |  Branch (87:6): [True: 0, False: 243]
  ------------------
   88|      0|		return SFE_DWVW_BAD_BITWIDTH ;
   89|       |
   90|    243|	if (psf->file.mode == SFM_RDWR)
  ------------------
  |  Branch (90:6): [True: 0, False: 243]
  ------------------
   91|      0|		return SFE_BAD_MODE_RW ;
   92|       |
   93|    243|	if ((pdwvw = calloc (1, sizeof (DWVW_PRIVATE))) == NULL)
  ------------------
  |  Branch (93:6): [True: 0, False: 243]
  ------------------
   94|      0|		return SFE_MALLOC_FAILED ;
   95|       |
   96|    243|	psf->codec_data = (void*) pdwvw ;
   97|    243|	pdwvw->bit_width 	= bitwidth ;
   98|    243|	dwvw_read_reset (pdwvw) ;
   99|       |
  100|    243|	if (psf->file.mode == SFM_READ)
  ------------------
  |  Branch (100:6): [True: 243, False: 0]
  ------------------
  101|    243|	{	psf->read_short		= dwvw_read_s ;
  102|    243|		psf->read_int		= dwvw_read_i ;
  103|    243|		psf->read_float		= dwvw_read_f ;
  104|    243|		psf->read_double	= dwvw_read_d ;
  105|    243|		} ;
  106|       |
  107|    243|	if (psf->file.mode == SFM_WRITE)
  ------------------
  |  Branch (107:6): [True: 0, False: 243]
  ------------------
  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|    243|	psf->codec_close = dwvw_close ;
  115|    243|	psf->seek = dwvw_seek ;
  116|    243|	psf->byterate = dwvw_byterate ;
  117|       |
  118|    243|	if (psf->file.mode == SFM_READ)
  ------------------
  |  Branch (118:6): [True: 243, False: 0]
  ------------------
  119|    243|	{	psf->sf.frames = psf_decode_frame_count (psf) ;
  120|    243|		dwvw_read_reset (pdwvw) ;
  121|    243|		} ;
  122|       |
  123|    243|	return 0 ;
  124|    243|} /* dwvw_init */
dwvw.c:dwvw_close:
  131|    243|{	DWVW_PRIVATE *pdwvw ;
  132|       |
  133|    243|	if (psf->codec_data == NULL)
  ------------------
  |  Branch (133:6): [True: 0, False: 243]
  ------------------
  134|      0|		return 0 ;
  135|    243|	pdwvw = (DWVW_PRIVATE*) psf->codec_data ;
  136|       |
  137|    243|	if (psf->file.mode == SFM_WRITE)
  ------------------
  |  Branch (137:6): [True: 0, False: 243]
  ------------------
  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|    243|	return 0 ;
  151|    243|} /* dwvw_close */
dwvw.c:dwvw_decode_data:
  306|  10.2k|{	int	count ;
  307|  10.2k|	int delta_width_modifier, delta_width, delta_negative, delta, sample ;
  308|       |
  309|       |	/* Restore state from last decode call. */
  310|  10.2k|	delta_width = pdwvw->last_delta_width ;
  311|  10.2k|	sample = pdwvw->last_sample ;
  312|       |
  313|  12.9M|	for (count = 0 ; count < len ; count++)
  ------------------
  |  Branch (313:19): [True: 12.9M, False: 9.83k]
  ------------------
  314|  12.9M|	{	/* If bit_count parameter is zero get the delta_width_modifier. */
  315|  12.9M|		delta_width_modifier = dwvw_decode_load_bits (psf, pdwvw, -1) ;
  316|       |
  317|       |		/* Check for end of input bit stream. Break loop if end. */
  318|  12.9M|		if (delta_width_modifier < 0 || (pdwvw->b.end == 0 && count == 0))
  ------------------
  |  Branch (318:7): [True: 140, False: 12.9M]
  |  Branch (318:36): [True: 75.5k, False: 12.8M]
  |  Branch (318:57): [True: 177, False: 75.3k]
  ------------------
  319|    317|			break ;
  320|       |
  321|  12.9M|		if (delta_width_modifier && dwvw_decode_load_bits (psf, pdwvw, 1))
  ------------------
  |  Branch (321:7): [True: 2.79M, False: 10.1M]
  |  Branch (321:31): [True: 1.00M, False: 1.79M]
  ------------------
  322|  1.00M|			delta_width_modifier = - delta_width_modifier ;
  323|       |
  324|       |		/* Calculate the current word width. */
  325|  12.9M|		delta_width = (delta_width + delta_width_modifier + pdwvw->bit_width) % pdwvw->bit_width ;
  326|       |
  327|       |		/* Load the delta. */
  328|  12.9M|		delta = 0 ;
  329|  12.9M|		if (delta_width)
  ------------------
  |  Branch (329:7): [True: 10.7M, False: 2.17M]
  ------------------
  330|  10.7M|		{	delta = dwvw_decode_load_bits (psf, pdwvw, delta_width - 1) | (1 << (delta_width - 1)) ;
  331|  10.7M|			delta_negative = dwvw_decode_load_bits (psf, pdwvw, 1) ;
  332|  10.7M|			if (delta == pdwvw->max_delta - 1)
  ------------------
  |  Branch (332:8): [True: 630k, False: 10.1M]
  ------------------
  333|   630k|				delta += dwvw_decode_load_bits (psf, pdwvw, 1) ;
  334|  10.7M|			if (delta_negative)
  ------------------
  |  Branch (334:8): [True: 7.83M, False: 2.94M]
  ------------------
  335|  7.83M|				delta = -delta ;
  336|  10.7M|			} ;
  337|       |
  338|       |		/* Calculate the sample */
  339|  12.9M|		sample += delta ;
  340|       |
  341|  12.9M|		if (sample >= pdwvw->max_delta)
  ------------------
  |  Branch (341:7): [True: 356k, False: 12.5M]
  ------------------
  342|   356k|			sample -= pdwvw->span ;
  343|  12.5M|		else if (sample < - pdwvw->max_delta)
  ------------------
  |  Branch (343:12): [True: 726k, False: 11.8M]
  ------------------
  344|   726k|			sample += pdwvw->span ;
  345|       |
  346|       |		/* Store the sample justifying to the most significant bit. */
  347|  12.9M|		ptr [count] = arith_shift_left (sample, 32 - pdwvw->bit_width) ;
  348|       |
  349|  12.9M|		if (pdwvw->b.end == 0 && pdwvw->bit_count == 0)
  ------------------
  |  Branch (349:7): [True: 75.4k, False: 12.8M]
  |  Branch (349:28): [True: 100, False: 75.3k]
  ------------------
  350|    100|			break ;
  351|  12.9M|		} ;
  352|       |
  353|  10.2k|	pdwvw->last_delta_width = delta_width ;
  354|  10.2k|	pdwvw->last_sample = sample ;
  355|       |
  356|  10.2k|	pdwvw->samplecount += count ;
  357|       |
  358|  10.2k|	return count ;
  359|  10.2k|} /* dwvw_decode_data */
dwvw.c:dwvw_decode_load_bits:
  363|  37.9M|{	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|  37.9M|	if (bit_count < 0)
  ------------------
  |  Branch (371:6): [True: 12.9M, False: 24.9M]
  ------------------
  372|  12.9M|	{	get_dwm = SF_TRUE ;
  373|       |		/* modify bit_count to ensure we have enough bits for finding dwm. */
  374|  12.9M|		bit_count = pdwvw->dwm_maxsize ;
  375|  12.9M|		} ;
  376|       |
  377|       |	/* Load bits in bit reseviour. */
  378|  46.6M|	while (pdwvw->bit_count < bit_count)
  ------------------
  |  Branch (378:9): [True: 8.76M, False: 37.9M]
  ------------------
  379|  8.76M|	{	if (pdwvw->b.index >= pdwvw->b.end)
  ------------------
  |  Branch (379:8): [True: 264k, False: 8.49M]
  ------------------
  380|   264k|		{	pdwvw->b.end = (int) psf_fread (pdwvw->b.buffer, 1, sizeof (pdwvw->b.buffer), psf) ;
  381|   264k|			pdwvw->b.index = 0 ;
  382|   264k|			} ;
  383|       |
  384|       |		/* Check for end of input stream. */
  385|  8.76M|		if (bit_count < 8 && pdwvw->b.end == 0)
  ------------------
  |  Branch (385:7): [True: 6.24M, False: 2.51M]
  |  Branch (385:24): [True: 23.8k, False: 6.22M]
  ------------------
  386|  23.8k|			return -1 ;
  387|       |
  388|  8.74M|		pdwvw->bits = arith_shift_left (pdwvw->bits, 8) ;
  389|       |
  390|  8.74M|		if (pdwvw->b.index < pdwvw->b.end)
  ------------------
  |  Branch (390:7): [True: 8.53M, False: 207k]
  ------------------
  391|  8.53M|		{	pdwvw->bits |= pdwvw->b.buffer [pdwvw->b.index] ;
  392|  8.53M|			pdwvw->b.index ++ ;
  393|  8.53M|			} ;
  394|  8.74M|		pdwvw->bit_count += 8 ;
  395|  37.9M|		} ;
  396|       |
  397|       |	/* If asked to get bits do so. */
  398|  37.9M|	if (! get_dwm)
  ------------------
  |  Branch (398:6): [True: 24.9M, False: 12.9M]
  ------------------
  399|  24.9M|	{	output = (pdwvw->bits >> (pdwvw->bit_count - bit_count)) & ((1 << bit_count) - 1) ;
  400|  24.9M|		pdwvw->bit_count -= bit_count ;
  401|  24.9M|		return output ;
  402|  24.9M|		} ;
  403|       |
  404|       |	/* Otherwise must have been asked to get delta_width_modifier. */
  405|  19.2M|	while (output < (pdwvw->dwm_maxsize))
  ------------------
  |  Branch (405:9): [True: 18.7M, False: 496k]
  ------------------
  406|  18.7M|	{	pdwvw->bit_count -= 1 ;
  407|  18.7M|		if (pdwvw->bits & (1 << pdwvw->bit_count))
  ------------------
  |  Branch (407:7): [True: 12.4M, False: 6.29M]
  ------------------
  408|  12.4M|			break ;
  409|  6.29M|		output += 1 ;
  410|  6.29M|		} ;
  411|       |
  412|  12.9M|	return output ;
  413|  37.9M|} /* dwvw_decode_load_bits */
dwvw.c:dwvw_read_i:
  217|  6.42k|{	DWVW_PRIVATE *pdwvw ;
  218|  6.42k|	int			readcount, count ;
  219|  6.42k|	sf_count_t	total = 0 ;
  220|       |
  221|  6.42k|	if (! psf->codec_data)
  ------------------
  |  Branch (221:6): [True: 0, False: 6.42k]
  ------------------
  222|      0|		return 0 ;
  223|  6.42k|	pdwvw = (DWVW_PRIVATE*) psf->codec_data ;
  224|       |
  225|  12.4k|	while (len > 0)
  ------------------
  |  Branch (225:9): [True: 6.42k, False: 6.02k]
  ------------------
  226|  6.42k|	{	readcount = (len > 0x10000000) ? 0x10000000 : (int) len ;
  ------------------
  |  Branch (226:16): [True: 0, False: 6.42k]
  ------------------
  227|       |
  228|  6.42k|		count = dwvw_decode_data (psf, pdwvw, ptr, readcount) ;
  229|       |
  230|  6.42k|		total += count ;
  231|  6.42k|		len -= count ;
  232|       |
  233|  6.42k|		if (count != readcount)
  ------------------
  |  Branch (233:7): [True: 400, False: 6.02k]
  ------------------
  234|    400|			break ;
  235|  6.42k|		} ;
  236|       |
  237|  6.42k|	return total ;
  238|  6.42k|} /* dwvw_read_i */
dwvw.c:dwvw_read_f:
  242|  3.82k|{	DWVW_PRIVATE *pdwvw ;
  243|  3.82k|	BUF_UNION	ubuf ;
  244|  3.82k|	int			*iptr ;
  245|  3.82k|	int			k, bufferlen, readcount = 0, count ;
  246|  3.82k|	sf_count_t	total = 0 ;
  247|  3.82k|	float	normfact ;
  248|       |
  249|  3.82k|	if (! psf->codec_data)
  ------------------
  |  Branch (249:6): [True: 0, False: 3.82k]
  ------------------
  250|      0|		return 0 ;
  251|  3.82k|	pdwvw = (DWVW_PRIVATE*) psf->codec_data ;
  252|       |
  253|  3.82k|	normfact = (psf->norm_float == SF_TRUE) ? 1.0 / ((float) 0x80000000) : 1.0 ;
  ------------------
  |  Branch (253:13): [True: 3.82k, False: 0]
  ------------------
  254|       |
  255|  3.82k|	iptr = ubuf.ibuf ;
  256|  3.82k|	bufferlen = ARRAY_LEN (ubuf.ibuf) ;
  ------------------
  |  |   93|  3.82k|#define		ARRAY_LEN(x)	((int) (sizeof (x) / sizeof ((x) [0])))
  ------------------
  257|  7.63k|	while (len > 0)
  ------------------
  |  Branch (257:9): [True: 3.82k, False: 3.80k]
  ------------------
  258|  3.82k|	{	readcount = (len >= bufferlen) ? bufferlen : (int) len ;
  ------------------
  |  Branch (258:16): [True: 0, False: 3.82k]
  ------------------
  259|  3.82k|		count = dwvw_decode_data (psf, pdwvw, iptr, readcount) ;
  260|  1.04M|		for (k = 0 ; k < readcount ; k++)
  ------------------
  |  Branch (260:16): [True: 1.04M, False: 3.82k]
  ------------------
  261|  1.04M|			ptr [total + k] = normfact * (float) (iptr [k]) ;
  262|       |
  263|  3.82k|		total += count ;
  264|  3.82k|		len -= readcount ;
  265|  3.82k|		if (count != readcount)
  ------------------
  |  Branch (265:7): [True: 17, False: 3.80k]
  ------------------
  266|     17|			break ;
  267|  3.82k|		} ;
  268|       |
  269|  3.82k|	return total ;
  270|  3.82k|} /* dwvw_read_f */
dwvw.c:dwvw_read_reset:
  417|    486|{	int bitwidth = pdwvw->bit_width ;
  418|       |
  419|    486|	memset (pdwvw, 0, sizeof (DWVW_PRIVATE)) ;
  420|       |
  421|    486|	pdwvw->bit_width	= bitwidth ;
  422|    486|	pdwvw->dwm_maxsize	= bitwidth / 2 ;
  423|    486|	pdwvw->max_delta	= 1 << (bitwidth - 1) ;
  424|    486|	pdwvw->span			= 1 << bitwidth ;
  425|    486|} /* dwvw_read_reset */

psf_fclose:
  137|  18.9k|{	int retval ;
  138|       |
  139|  18.9k|	if (psf->virtual_io)
  ------------------
  |  Branch (139:6): [True: 18.9k, False: 0]
  ------------------
  140|  18.9k|		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.65k|{	size_t count ;
  158|       |
  159|  1.65k|	if (psf->rsrc.filedes > 0)
  ------------------
  |  Branch (159:6): [True: 0, False: 1.65k]
  ------------------
  160|      0|		return 0 ;
  161|       |
  162|       |	/* Test for MacOSX style resource fork on HPFS or HPFS+ filesystems. */
  163|  1.65k|	count = snprintf (psf->rsrc.path, sizeof (psf->rsrc.path), "%s/..namedfork/rsrc", psf->file.path) ;
  164|  1.65k|	psf->error = SFE_NO_ERROR ;
  165|  1.65k|	if (count < sizeof (psf->rsrc.path))
  ------------------
  |  Branch (165:6): [True: 1.65k, False: 0]
  ------------------
  166|  1.65k|	{	if ((psf->rsrc.filedes = psf_open_fd (&psf->rsrc)) >= 0)
  ------------------
  |  Branch (166:8): [True: 0, False: 1.65k]
  ------------------
  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.65k|			} ;
  173|       |
  174|  1.65k|		if (psf->rsrc.filedes == - SFE_BAD_OPEN_MODE)
  ------------------
  |  Branch (174:7): [True: 0, False: 1.65k]
  ------------------
  175|      0|		{	psf->error = SFE_BAD_OPEN_MODE ;
  176|      0|			return psf->error ;
  177|  1.65k|			} ;
  178|  1.65k|		} ;
  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.65k|	count = snprintf (psf->rsrc.path, sizeof (psf->rsrc.path), "%s._%s", psf->file.dir, psf->file.name) ;
  185|  1.65k|	psf->error = SFE_NO_ERROR ;
  186|  1.65k|	if (count < sizeof (psf->rsrc.path) && (psf->rsrc.filedes = psf_open_fd (&psf->rsrc)) >= 0)
  ------------------
  |  Branch (186:6): [True: 1.65k, False: 0]
  |  Branch (186:41): [True: 0, False: 1.65k]
  ------------------
  187|      0|	{	psf->rsrclength = psf_get_filelen_fd (psf->rsrc.filedes) ;
  188|      0|		return SFE_NO_ERROR ;
  189|  1.65k|		} ;
  190|       |
  191|       |	/*
  192|       |	** Now try for a resource fork stored in a separate file in the
  193|       |	** .AppleDouble/ directory.
  194|       |	*/
  195|  1.65k|	count = snprintf (psf->rsrc.path, sizeof (psf->rsrc.path), "%s.AppleDouble/%s", psf->file.dir, psf->file.name) ;
  196|  1.65k|	psf->error = SFE_NO_ERROR ;
  197|  1.65k|	if (count < sizeof (psf->rsrc.path))
  ------------------
  |  Branch (197:6): [True: 1.65k, False: 0]
  ------------------
  198|  1.65k|	{	if ((psf->rsrc.filedes = psf_open_fd (&psf->rsrc)) >= 0)
  ------------------
  |  Branch (198:8): [True: 0, False: 1.65k]
  ------------------
  199|      0|		{	psf->rsrclength = psf_get_filelen_fd (psf->rsrc.filedes) ;
  200|      0|			return SFE_NO_ERROR ;
  201|  1.65k|			} ;
  202|       |
  203|       |		/* No resource file found. */
  204|  1.65k|		if (psf->rsrc.filedes == -1)
  ------------------
  |  Branch (204:7): [True: 1.65k, False: 0]
  ------------------
  205|  1.65k|			psf_log_syserr (psf, errno) ;
  206|  1.65k|		}
  207|      0|	else
  208|      0|	{	psf->error = SFE_OPEN_FAILED ;
  209|  1.65k|		} ;
  210|       |
  211|  1.65k|	psf->rsrc.filedes = -1 ;
  212|       |
  213|  1.65k|	return psf->error ;
  214|  1.65k|} /* psf_open_rsrc */
psf_get_filelen:
  218|  20.5k|{	sf_count_t	filelen ;
  219|       |
  220|  20.5k|	if (psf->virtual_io)
  ------------------
  |  Branch (220:6): [True: 20.5k, False: 0]
  ------------------
  221|  20.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|  18.9k|{	psf_close_fd (psf->rsrc.filedes) ;
  264|  18.9k|	psf->rsrc.filedes = -1 ;
  265|  18.9k|	return 0 ;
  266|  18.9k|} /* psf_close_rsrc */
psf_fseek:
  306|   402k|{	sf_count_t	absolute_position ;
  307|       |
  308|   402k|	if (psf->virtual_io)
  ------------------
  |  Branch (308:6): [True: 402k, False: 0]
  ------------------
  309|   402k|		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.1M|{	sf_count_t total = 0 ;
  346|  14.1M|	ssize_t	count ;
  347|       |
  348|  14.1M|	if (psf->virtual_io)
  ------------------
  |  Branch (348:6): [True: 14.1M, False: 0]
  ------------------
  349|  14.1M|		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|  2.12M|{	sf_count_t pos ;
  431|       |
  432|  2.12M|	if (psf->virtual_io)
  ------------------
  |  Branch (432:6): [True: 2.12M, False: 0]
  ------------------
  433|  2.12M|		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|  19.1k|{	struct stat statbuf ;
  489|       |
  490|  19.1k|	if (psf->virtual_io)
  ------------------
  |  Branch (490:6): [True: 19.1k, False: 0]
  ------------------
  491|  19.1k|		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|  18.9k|{	psf->file.filedes = -1 ;
  547|  18.9k|	psf->rsrc.filedes = -1 ;
  548|  18.9k|	psf->file.savedes = -1 ;
  549|  18.9k|} /* psf_init_files */
file_io.c:psf_close_fd:
  450|  18.9k|{	int retval ;
  451|       |
  452|  18.9k|	if (fd < 0)
  ------------------
  |  Branch (452:6): [True: 18.9k, False: 0]
  ------------------
  453|  18.9k|		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|  18.9k|} /* psf_close_fd */
file_io.c:psf_open_fd:
  568|  4.95k|{	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|  4.95k|	if (sizeof (sf_count_t) != 8)
  ------------------
  |  Branch (575:6): [Folded, False: 4.95k]
  ------------------
  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|  4.95k|		} ;
  580|       |
  581|  4.95k|	switch (pfile->mode)
  582|  4.95k|	{	case SFM_READ :
  ------------------
  |  Branch (582:4): [True: 4.95k, False: 0]
  ------------------
  583|  4.95k|				oflag = O_RDONLY | O_BINARY ;
  ------------------
  |  |   74|  4.95k|#define O_BINARY 0
  ------------------
  584|  4.95k|				mode = 0 ;
  585|  4.95k|				break ;
  586|       |
  587|      0|		case SFM_WRITE :
  ------------------
  |  Branch (587:3): [True: 0, False: 4.95k]
  ------------------
  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: 4.95k]
  ------------------
  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: 4.95k]
  ------------------
  598|      0|				return - SFE_BAD_OPEN_MODE ;
  599|      0|				break ;
  600|  4.95k|		} ;
  601|       |
  602|  4.95k|	if (mode == 0)
  ------------------
  |  Branch (602:6): [True: 4.95k, False: 0]
  ------------------
  603|  4.95k|		fd = open (pfile->path, oflag) ;
  604|      0|	else
  605|      0|		fd = open (pfile->path, oflag, mode) ;
  606|       |
  607|  4.95k|	return fd ;
  608|  4.95k|} /* psf_open_fd */
file_io.c:psf_log_syserr:
  612|  1.65k|{
  613|       |	/* Only log an error if no error has been set yet. */
  614|  1.65k|	if (psf->error == 0)
  ------------------
  |  Branch (614:6): [True: 1.65k, False: 0]
  ------------------
  615|  1.65k|	{	psf->error = SFE_SYSTEM ;
  616|  1.65k|		snprintf (psf->syserr, sizeof (psf->syserr), "System error : %s.", strerror (error)) ;
  617|  1.65k|		} ;
  618|       |
  619|  1.65k|	return ;
  620|  1.65k|} /* 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|    295|{	static int float_caps ;
   90|       |
   91|    295|	if (psf->sf.channels < 1)
  ------------------
  |  Branch (91:6): [True: 14, False: 281]
  ------------------
   92|     14|	{	psf_log_printf (psf, "float32_init : internal error : channels = %d\n", psf->sf.channels) ;
   93|     14|		return SFE_INTERNAL ;
   94|    281|		} ;
   95|       |
   96|    281|	float_caps = float32_get_capability (psf) ;
   97|       |
   98|    281|	psf->blockwidth = sizeof (float) * psf->sf.channels ;
   99|       |
  100|    281|	if (psf->file.mode == SFM_READ || psf->file.mode == SFM_RDWR)
  ------------------
  |  Branch (100:6): [True: 281, False: 0]
  |  Branch (100:36): [True: 0, False: 0]
  ------------------
  101|    281|	{	switch (psf->endian + float_caps)
  102|    281|		{	case (SF_ENDIAN_BIG + FLOAT_CAN_RW_BE) :
  ------------------
  |  Branch (102:5): [True: 0, False: 281]
  ------------------
  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|    165|			case (SF_ENDIAN_LITTLE + FLOAT_CAN_RW_LE) :
  ------------------
  |  Branch (110:4): [True: 165, False: 116]
  ------------------
  111|    165|					psf->data_endswap = SF_FALSE ;
  112|    165|					psf->read_short		= host_read_f2s ;
  113|    165|					psf->read_int		= host_read_f2i ;
  114|    165|					psf->read_float		= host_read_f ;
  115|    165|					psf->read_double	= host_read_f2d ;
  116|    165|					break ;
  117|       |
  118|    116|			case (SF_ENDIAN_BIG + FLOAT_CAN_RW_LE) :
  ------------------
  |  Branch (118:4): [True: 116, False: 165]
  ------------------
  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: 281]
  ------------------
  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: 281]
  ------------------
  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: 281]
  ------------------
  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: 281]
  ------------------
  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: 281]
  ------------------
  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: 281]
  ------------------
  168|    281|			} ;
  169|    281|		} ;
  170|       |
  171|    281|	if (psf->file.mode == SFM_WRITE || psf->file.mode == SFM_RDWR)
  ------------------
  |  Branch (171:6): [True: 0, False: 281]
  |  Branch (171:37): [True: 0, False: 281]
  ------------------
  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|    281|		} ;
  241|       |
  242|    281|	if (psf->filelength > psf->dataoffset)
  ------------------
  |  Branch (242:6): [True: 209, False: 72]
  ------------------
  243|    209|	{	psf->datalength = (psf->dataend > 0) ? psf->dataend - psf->dataoffset :
  ------------------
  |  Branch (243:22): [True: 1, False: 208]
  ------------------
  244|    209|							psf->filelength - psf->dataoffset ;
  245|    209|		}
  246|     72|	else
  247|     72|		psf->datalength = 0 ;
  248|       |
  249|    281|	psf->sf.frames = psf->blockwidth > 0 ? psf->datalength / psf->blockwidth : 0 ;
  ------------------
  |  Branch (249:19): [True: 281, False: 0]
  ------------------
  250|       |
  251|    281|	return 0 ;
  252|    281|} /* float32_init */
float32_be_read:
  256|  5.15k|{	int		exponent, mantissa, negative ;
  257|  5.15k|	float	fvalue ;
  258|       |
  259|  5.15k|	negative = cptr [0] & 0x80 ;
  260|  5.15k|	exponent = ((cptr [0] & 0x7F) << 1) | ((cptr [1] & 0x80) ? 1 : 0) ;
  ------------------
  |  Branch (260:41): [True: 788, False: 4.36k]
  ------------------
  261|  5.15k|	mantissa = ((cptr [1] & 0x7F) << 16) | (cptr [2] << 8) | (cptr [3]) ;
  262|       |
  263|  5.15k|	if (! (exponent || mantissa))
  ------------------
  |  Branch (263:9): [True: 1.88k, False: 3.27k]
  |  Branch (263:21): [True: 1.77k, False: 1.49k]
  ------------------
  264|  1.49k|		return 0.0 ;
  265|       |
  266|  3.65k|	mantissa |= 0x800000 ;
  267|  3.65k|	exponent = exponent ? exponent - 127 : 0 ;
  ------------------
  |  Branch (267:13): [True: 1.88k, False: 1.77k]
  ------------------
  268|       |
  269|  3.65k|	fvalue = mantissa ? ((float) mantissa) / ((float) 0x800000) : 0.0 ;
  ------------------
  |  Branch (269:11): [True: 3.65k, False: 0]
  ------------------
  270|       |
  271|  3.65k|	if (negative)
  ------------------
  |  Branch (271:6): [True: 1.08k, False: 2.57k]
  ------------------
  272|  1.08k|		fvalue *= -1 ;
  273|       |
  274|  3.65k|	if (exponent > 0)
  ------------------
  |  Branch (274:6): [True: 720, False: 2.93k]
  ------------------
  275|    720|		fvalue *= pow (2.0, exponent) ;
  276|  2.93k|	else if (exponent < 0)
  ------------------
  |  Branch (276:11): [True: 1.16k, False: 1.77k]
  ------------------
  277|  1.16k|		fvalue /= pow (2.0, abs (exponent)) ;
  278|       |
  279|  3.65k|	return fvalue ;
  280|  5.15k|} /* float32_be_read */
float32_le_read:
  284|  32.7k|{	int		exponent, mantissa, negative ;
  285|  32.7k|	float	fvalue ;
  286|       |
  287|  32.7k|	negative = cptr [3] & 0x80 ;
  288|  32.7k|	exponent = ((cptr [3] & 0x7F) << 1) | ((cptr [2] & 0x80) ? 1 : 0) ;
  ------------------
  |  Branch (288:41): [True: 10.9k, False: 21.8k]
  ------------------
  289|  32.7k|	mantissa = ((cptr [2] & 0x7F) << 16) | (cptr [1] << 8) | (cptr [0]) ;
  290|       |
  291|  32.7k|	if (! (exponent || mantissa))
  ------------------
  |  Branch (291:9): [True: 23.4k, False: 9.29k]
  |  Branch (291:21): [True: 5.69k, False: 3.59k]
  ------------------
  292|  3.59k|		return 0.0 ;
  293|       |
  294|  29.1k|	mantissa |= 0x800000 ;
  295|  29.1k|	exponent = exponent ? exponent - 127 : 0 ;
  ------------------
  |  Branch (295:13): [True: 23.4k, False: 5.69k]
  ------------------
  296|       |
  297|  29.1k|	fvalue = mantissa ? ((float) mantissa) / ((float) 0x800000) : 0.0 ;
  ------------------
  |  Branch (297:11): [True: 29.1k, False: 0]
  ------------------
  298|       |
  299|  29.1k|	if (negative)
  ------------------
  |  Branch (299:6): [True: 14.9k, False: 14.1k]
  ------------------
  300|  14.9k|		fvalue *= -1 ;
  301|       |
  302|  29.1k|	if (exponent > 0)
  ------------------
  |  Branch (302:6): [True: 14.2k, False: 14.9k]
  ------------------
  303|  14.2k|		fvalue *= pow (2.0, exponent) ;
  304|  14.9k|	else if (exponent < 0)
  ------------------
  |  Branch (304:11): [True: 9.23k, False: 5.70k]
  ------------------
  305|  9.23k|		fvalue /= pow (2.0, abs (exponent)) ;
  306|       |
  307|  29.1k|	return fvalue ;
  308|  32.7k|} /* float32_le_read */
float32.c:float32_get_capability:
  410|    281|{	union
  411|    281|	{	float			f ;
  412|    281|		int				i ;
  413|    281|		unsigned char	c [4] ;
  414|    281|	} data ;
  415|       |
  416|    281|	data.f = (float) 1.23456789 ; /* Some arbitrary value. */
  417|       |
  418|    281|	if (! psf->ieee_replace)
  ------------------
  |  Branch (418:6): [True: 281, False: 0]
  ------------------
  419|    281|	{	/* If this test is true ints and floats are compatible and little endian. */
  420|    281|		if (data.c [0] == 0x52 && data.c [1] == 0x06 && data.c [2] == 0x9e && data.c [3] == 0x3f)
  ------------------
  |  Branch (420:7): [True: 281, False: 0]
  |  Branch (420:29): [True: 281, False: 0]
  |  Branch (420:51): [True: 281, False: 0]
  |  Branch (420:73): [True: 281, False: 0]
  ------------------
  421|    281|			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|    281|} /* float32_get_capability */
float32.c:host_read_f:
  574|  1.66k|{	BUF_UNION	ubuf ;
  575|  1.66k|	int			bufferlen, readcount ;
  576|  1.66k|	sf_count_t	total = 0 ;
  577|       |
  578|  1.66k|	if (psf->data_endswap != SF_TRUE)
  ------------------
  |  Branch (578:6): [True: 1.26k, False: 403]
  ------------------
  579|  1.26k|		return psf_fread (ptr, sizeof (float), len, psf) ;
  580|       |
  581|    403|	bufferlen = ARRAY_LEN (ubuf.fbuf) ;
  ------------------
  |  |   93|    403|#define		ARRAY_LEN(x)	((int) (sizeof (x) / sizeof ((x) [0])))
  ------------------
  582|       |
  583|    783|	while (len > 0)
  ------------------
  |  Branch (583:9): [True: 403, False: 380]
  ------------------
  584|    403|	{	if (len < bufferlen)
  ------------------
  |  Branch (584:8): [True: 403, False: 0]
  ------------------
  585|    403|			bufferlen = (int) len ;
  586|    403|		readcount = (int) psf_fread (ubuf.fbuf, sizeof (float), bufferlen, psf) ;
  587|       |
  588|    403|		endswap_int_copy ((int*) (ptr + total), ubuf.ibuf, readcount) ;
  589|       |
  590|    403|		total += readcount ;
  591|    403|		if (readcount < bufferlen)
  ------------------
  |  Branch (591:7): [True: 23, False: 380]
  ------------------
  592|     23|			break ;
  593|    380|		len -= readcount ;
  594|    380|		} ;
  595|       |
  596|    403|	return total ;
  597|  1.66k|} /* host_read_f */

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

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

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

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

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

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

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

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

mpc2k_open:
   64|     10|{	int		error = 0 ;
   65|       |
   66|     10|	if (psf->file.mode == SFM_READ || (psf->file.mode == SFM_RDWR && psf->filelength > 0))
  ------------------
  |  Branch (66:6): [True: 10, False: 0]
  |  Branch (66:37): [True: 0, False: 0]
  |  Branch (66:67): [True: 0, False: 0]
  ------------------
   67|     10|	{	if ((error = mpc2k_read_header (psf)))
  ------------------
  |  Branch (67:8): [True: 0, False: 10]
  ------------------
   68|      0|			return error ;
   69|     10|		} ;
   70|       |
   71|     10|	if ((SF_CONTAINER (psf->sf.format)) != SF_FORMAT_MPC2K)
  ------------------
  |  |  108|     10|#define SF_CONTAINER(x)		((x) & SF_FORMAT_TYPEMASK)
  ------------------
  |  Branch (71:6): [True: 0, False: 10]
  ------------------
   72|      0|		return	SFE_BAD_OPEN_FORMAT ;
   73|       |
   74|     10|	if (psf->file.mode == SFM_WRITE || psf->file.mode == SFM_RDWR)
  ------------------
  |  Branch (74:6): [True: 0, False: 10]
  |  Branch (74:37): [True: 0, False: 10]
  ------------------
   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|     10|		} ;
   80|       |
   81|     10|	psf->container_close = mpc2k_close ;
   82|       |
   83|     10|	psf->blockwidth = (sf_count_t) psf->bytewidth * psf->sf.channels ;
   84|       |
   85|     10|	error = pcm_init (psf) ;
   86|       |
   87|     10|	return error ;
   88|     10|} /* mpc2k_open */
mpc2k.c:mpc2k_close:
   95|     10|{
   96|     10|	if (psf->file.mode == SFM_WRITE || psf->file.mode == SFM_RDWR)
  ------------------
  |  Branch (96:6): [True: 0, False: 10]
  |  Branch (96:37): [True: 0, False: 10]
  ------------------
   97|      0|		mpc2k_write_header (psf, SF_TRUE) ;
   98|       |
   99|     10|	return 0 ;
  100|     10|} /* mpc2k_close */
mpc2k.c:mpc2k_read_header:
  158|     10|{	char sample_name [HEADER_NAME_LEN + 1] ;
  159|     10|	unsigned char bytes [4] ;
  160|     10|	uint32_t sample_start, loop_end, sample_frames, loop_length ;
  161|     10|	uint16_t sample_rate ;
  162|       |
  163|     10|	psf_binheader_readf (psf, "pebb", 0, bytes, 2, sample_name, make_size_t (HEADER_NAME_LEN)) ;
  ------------------
  |  |   47|     10|#define HEADER_NAME_LEN		17	/* Length of name string. */
  ------------------
  164|       |
  165|     10|	if (bytes [0] != 1 || bytes [1] != 4)
  ------------------
  |  Branch (165:6): [True: 0, False: 10]
  |  Branch (165:24): [True: 0, False: 10]
  ------------------
  166|      0|		return SFE_MPC_NO_MARKER ;
  167|       |
  168|     10|	sample_name [HEADER_NAME_LEN] = 0 ;
  ------------------
  |  |   47|     10|#define HEADER_NAME_LEN		17	/* Length of name string. */
  ------------------
  169|       |
  170|     10|	psf_log_printf (psf, "MPC2000\n  Name         : %s\n", sample_name) ;
  171|       |
  172|     10|	psf_binheader_readf (psf, "eb4444", bytes, 3, &sample_start, &loop_end, &sample_frames, &loop_length) ;
  173|       |
  174|     10|	psf->sf.channels = bytes [2] ? 2 : 1 ;
  ------------------
  |  Branch (174:21): [True: 8, False: 2]
  ------------------
  175|       |
  176|     10|	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: 8, False: 2]
  ------------------
  177|       |
  178|     10|	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|     10|	psf_binheader_readf (psf, "eb2", bytes, 2, &sample_rate) ;
  181|       |
  182|     10|	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: 9, False: 1]
  ------------------
  183|       |
  184|     10|	psf->sf.samplerate = sample_rate ;
  185|       |
  186|     10|	psf->sf.format = SF_FORMAT_MPC2K | SF_FORMAT_PCM_16 ;
  187|       |
  188|     10|	psf->dataoffset = psf_ftell (psf) ;
  189|       |
  190|       |	/* Always 16 bit little endian data. */
  191|     10|	psf->bytewidth = 2 ;
  192|     10|	psf->endian = SF_ENDIAN_LITTLE ;
  193|       |
  194|     10|	psf->datalength = psf->filelength - psf->dataoffset ;
  195|     10|	psf->blockwidth = (sf_count_t) psf->sf.channels * psf->bytewidth ;
  196|     10|	psf->sf.frames = psf->datalength / psf->blockwidth ;
  197|       |
  198|     10|	psf->sf.frames = (psf->filelength - psf->dataoffset) / psf->blockwidth ;
  199|       |
  200|     10|	return 0 ;
  201|     10|} /* 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|    198|{	MSADPCM_PRIVATE	*pms ;
  120|    198|	unsigned int	pmssize ;
  121|    198|	int				count ;
  122|       |
  123|    198|	if (psf->codec_data != NULL)
  ------------------
  |  Branch (123:6): [True: 0, False: 198]
  ------------------
  124|      0|	{	psf_log_printf (psf, "*** psf->codec_data is not NULL.\n") ;
  125|      0|		return SFE_INTERNAL ;
  126|    198|		} ;
  127|       |
  128|    198|	if (psf->file.mode == SFM_WRITE)
  ------------------
  |  Branch (128:6): [True: 0, False: 198]
  ------------------
  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|    198|	if (samplesperblock < 7 * psf->sf.channels)
  ------------------
  |  Branch (132:6): [True: 4, False: 194]
  ------------------
  133|      4|	{	psf_log_printf (psf, "*** Error samplesperblock (%d) should be >= %d.\n", samplesperblock, 7 * psf->sf.channels) ;
  134|      4|		return SFE_INTERNAL ;
  135|    194|		} ;
  136|       |
  137|    194|	if (2 * blockalign < samplesperblock * psf->sf.channels)
  ------------------
  |  Branch (137:6): [True: 6, False: 188]
  ------------------
  138|      6|	{	psf_log_printf (psf, "*** Error blockalign (%d) should be >= %d.\n", blockalign, samplesperblock * psf->sf.channels / 2) ;
  139|      6|		return SFE_INTERNAL ;
  140|    188|		} ;
  141|       |
  142|    188|	pmssize = sizeof (MSADPCM_PRIVATE) + blockalign + 3 * psf->sf.channels * samplesperblock ;
  143|       |
  144|    188|	if (! (psf->codec_data = calloc (1, pmssize)))
  ------------------
  |  Branch (144:6): [True: 0, False: 188]
  ------------------
  145|      0|		return SFE_MALLOC_FAILED ;
  146|    188|	pms = (MSADPCM_PRIVATE*) psf->codec_data ;
  147|       |
  148|    188|	pms->sync_error = 0 ;
  149|    188|	pms->samples	= pms->dummydata ;
  150|    188|	pms->block		= (unsigned char*) (pms->dummydata + psf->sf.channels * samplesperblock) ;
  151|       |
  152|    188|	pms->channels	= psf->sf.channels ;
  153|    188|	pms->blocksize	= blockalign ;
  154|    188|	pms->samplesperblock = samplesperblock ;
  155|       |
  156|    188|	if (pms->blocksize <= 0)
  ------------------
  |  Branch (156:6): [True: 0, False: 188]
  ------------------
  157|      0|	{	psf_log_printf (psf, "*** Error : pms->blocksize should be > 0.\n") ;
  158|      0|		return SFE_INTERNAL ;
  159|    188|		} ;
  160|       |
  161|    188|	if (psf->file.mode == SFM_READ)
  ------------------
  |  Branch (161:6): [True: 188, False: 0]
  ------------------
  162|    188|	{	pms->dataremaining = psf->datalength ;
  163|       |
  164|    188|		if (psf->datalength % pms->blocksize)
  ------------------
  |  Branch (164:7): [True: 134, False: 54]
  ------------------
  165|    134|			pms->blocks = psf->datalength / pms->blocksize + 1 ;
  166|     54|		else
  167|     54|			pms->blocks = psf->datalength / pms->blocksize ;
  168|       |
  169|    188|		count = 2 * (pms->blocksize - 6 * pms->channels) / pms->channels ;
  170|    188|		if (pms->samplesperblock != count)
  ------------------
  |  Branch (170:7): [True: 32, False: 156]
  ------------------
  171|     32|		{	psf_log_printf (psf, "*** Error : samplesperblock should be %d.\n", count) ;
  172|     32|			return SFE_INTERNAL ;
  173|    156|			} ;
  174|       |
  175|    156|		psf->sf.frames = (psf->datalength / pms->blocksize) * pms->samplesperblock ;
  176|       |
  177|    156|		msadpcm_decode_block (psf, pms) ;
  178|       |
  179|    156|		psf->read_short		= msadpcm_read_s ;
  180|    156|		psf->read_int		= msadpcm_read_i ;
  181|    156|		psf->read_float		= msadpcm_read_f ;
  182|    156|		psf->read_double	= msadpcm_read_d ;
  183|    156|		} ;
  184|       |
  185|    156|	if (psf->file.mode == SFM_WRITE)
  ------------------
  |  Branch (185:6): [True: 0, False: 156]
  ------------------
  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|    156|	psf->codec_close = msadpcm_close ;
  197|    156|	psf->seek = msadpcm_seek ;
  198|       |
  199|    156|	return 0 ;
  200|    188|} /* wavlike_msadpcm_init */
ms_adpcm.c:msadpcm_decode_block:
  218|  2.04k|{	int		chan, k, blockindx, sampleindx ;
  219|  2.04k|	short	bytecode, bpred [2], chan_idelta [2] ;
  220|       |
  221|  2.04k|	int predict ;
  222|  2.04k|	int current ;
  223|  2.04k|	int idelta ;
  224|       |
  225|  2.04k|	pms->blockcount ++ ;
  226|  2.04k|	pms->samplecount = 0 ;
  227|       |
  228|  2.04k|	if (pms->blockcount > pms->blocks)
  ------------------
  |  Branch (228:6): [True: 7, False: 2.03k]
  ------------------
  229|      7|	{	memset (pms->samples, 0, pms->samplesperblock * pms->channels) ;
  230|      7|		return 1 ;
  231|  2.03k|		} ;
  232|       |
  233|  2.03k|	if ((k = (int) psf_fread (pms->block, 1, pms->blocksize, psf)) != pms->blocksize)
  ------------------
  |  Branch (233:6): [True: 101, False: 1.93k]
  ------------------
  234|    101|	{	psf_log_printf (psf, "*** Warning : short read (%d != %d).\n", k, pms->blocksize) ;
  235|    101|		if (k <= 0)
  ------------------
  |  Branch (235:7): [True: 5, False: 96]
  ------------------
  236|      5|			return 1 ;
  237|  2.03k|		} ;
  238|       |
  239|       |	/* Read and check the block header. */
  240|       |
  241|  2.03k|	if (pms->channels == 1)
  ------------------
  |  Branch (241:6): [True: 1.26k, False: 772]
  ------------------
  242|  1.26k|	{	bpred [0] = msadpcm_get_bpred (psf, pms, pms->block [0]) ;
  243|       |
  244|  1.26k|		chan_idelta [0] = pms->block [1] | (pms->block [2] << 8) ;
  245|  1.26k|		chan_idelta [1] = 0 ;
  246|       |
  247|  1.26k|		pms->samples [1] = pms->block [3] | (pms->block [4] << 8) ;
  248|  1.26k|		pms->samples [0] = pms->block [5] | (pms->block [6] << 8) ;
  249|  1.26k|		blockindx = 7 ;
  250|  1.26k|		}
  251|    772|	else
  252|    772|	{	bpred [0] = msadpcm_get_bpred (psf, pms, pms->block [0]) ;
  253|    772|		bpred [1] = msadpcm_get_bpred (psf, pms, pms->block [1]) ;
  254|       |
  255|    772|		chan_idelta [0] = pms->block [2] | (pms->block [3] << 8) ;
  256|    772|		chan_idelta [1] = pms->block [4] | (pms->block [5] << 8) ;
  257|       |
  258|    772|		pms->samples [2] = pms->block [6] | (pms->block [7] << 8) ;
  259|    772|		pms->samples [3] = pms->block [8] | (pms->block [9] << 8) ;
  260|       |
  261|    772|		pms->samples [0] = pms->block [10] | (pms->block [11] << 8) ;
  262|    772|		pms->samples [1] = pms->block [12] | (pms->block [13] << 8) ;
  263|       |
  264|    772|		blockindx = 14 ;
  265|    772|		} ;
  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|  2.03k|	sampleindx = 2 * pms->channels ;
  283|   181k|	while (blockindx < pms->blocksize)
  ------------------
  |  Branch (283:9): [True: 179k, False: 2.03k]
  ------------------
  284|   179k|	{	bytecode = pms->block [blockindx++] ;
  285|   179k|		pms->samples [sampleindx++] = (bytecode >> 4) & 0x0F ;
  286|   179k|		pms->samples [sampleindx++] = bytecode & 0x0F ;
  287|   179k|		} ;
  288|       |
  289|       |	/* Decode the encoded 4 bit samples. */
  290|       |
  291|   360k|	for (k = 2 * pms->channels ; k < (pms->samplesperblock * pms->channels) ; k ++)
  ------------------
  |  Branch (291:31): [True: 358k, False: 2.03k]
  ------------------
  292|   358k|	{	chan = (pms->channels > 1) ? (k % 2) : 0 ;
  ------------------
  |  Branch (292:11): [True: 77.3k, False: 280k]
  ------------------
  293|       |
  294|   358k|		bytecode = pms->samples [k] & 0xF ;
  295|       |
  296|       |		/* Compute next Adaptive Scale Factor (ASF) */
  297|   358k|		idelta = chan_idelta [chan] ;
  298|   358k|		chan_idelta [chan] = (AdaptationTable [bytecode] * idelta) >> 8 ;	/* => / 256 => FIXED_POINT_ADAPTATION_BASE == 256 */
  299|   358k|		if (chan_idelta [chan] < 16)
  ------------------
  |  Branch (299:7): [True: 328k, False: 29.9k]
  ------------------
  300|   328k|			chan_idelta [chan] = 16 ;
  301|   358k|		if (bytecode & 0x8)
  ------------------
  |  Branch (301:7): [True: 12.1k, False: 346k]
  ------------------
  302|  12.1k|			bytecode -= 0x10 ;
  303|       |
  304|   358k|		predict = ((pms->samples [k - pms->channels] * AdaptCoeff1 [bpred [chan]])
  305|   358k|					+ (pms->samples [k - 2 * pms->channels] * AdaptCoeff2 [bpred [chan]])) >> 8 ; /* => / 256 => FIXED_POINT_COEFF_BASE == 256 */
  306|   358k|		current = (bytecode * idelta) + predict ;
  307|       |
  308|   358k|		if (current > 32767)
  ------------------
  |  Branch (308:7): [True: 5.96k, False: 352k]
  ------------------
  309|  5.96k|			current = 32767 ;
  310|   352k|		else if (current < -32768)
  ------------------
  |  Branch (310:12): [True: 3.82k, False: 348k]
  ------------------
  311|  3.82k|			current = -32768 ;
  312|       |
  313|   358k|		pms->samples [k] = current ;
  314|   358k|		} ;
  315|       |
  316|  2.03k|	return 0 ;
  317|  2.03k|} /* msadpcm_decode_block */
ms_adpcm.c:msadpcm_get_bpred:
  205|  2.80k|{	if (value >= WAVLIKE_MSADPCM_ADAPT_COEFF_COUNT)
  ------------------
  |  |  343|  2.80k|#define	WAVLIKE_MSADPCM_ADAPT_COEFF_COUNT	7
  ------------------
  |  Branch (205:7): [True: 1.70k, False: 1.10k]
  ------------------
  206|  1.70k|	{	if (pms->sync_error == 0)
  ------------------
  |  Branch (206:8): [True: 118, False: 1.58k]
  ------------------
  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|  1.70k|		return 0 ;
  211|  1.70k|		} ;
  212|  1.10k|	return value ;
  213|  2.80k|} /* msadpcm_get_bpred */
ms_adpcm.c:msadpcm_read_block:
  321|  27.8k|{	int	count, total = 0, indx = 0 ;
  322|       |
  323|  55.6k|	while (indx < len)
  ------------------
  |  Branch (323:9): [True: 27.8k, False: 27.8k]
  ------------------
  324|  27.8k|	{	if (pms->blockcount >= pms->blocks && pms->samplecount >= pms->samplesperblock)
  ------------------
  |  Branch (324:8): [True: 839, False: 26.9k]
  |  Branch (324:42): [True: 0, False: 839]
  ------------------
  325|      0|		{	memset (&(ptr [indx]), 0, (size_t) ((len - indx) * sizeof (short))) ;
  326|      0|			return total ;
  327|  27.8k|			} ;
  328|       |
  329|  27.8k|		if (pms->samplecount >= pms->samplesperblock)
  ------------------
  |  Branch (329:7): [True: 1.89k, False: 25.9k]
  ------------------
  330|  1.89k|			if (msadpcm_decode_block (psf, pms) != 0)
  ------------------
  |  Branch (330:8): [True: 0, False: 1.89k]
  ------------------
  331|      0|				return total ;
  332|       |
  333|  27.8k|		count = (pms->samplesperblock - pms->samplecount) * pms->channels ;
  334|  27.8k|		count = (len - indx > count) ? count : len - indx ;
  ------------------
  |  Branch (334:11): [True: 0, False: 27.8k]
  ------------------
  335|       |
  336|  27.8k|		memcpy (&(ptr [indx]), &(pms->samples [pms->samplecount * pms->channels]), count * sizeof (short)) ;
  337|  27.8k|		indx += count ;
  338|  27.8k|		pms->samplecount += count / pms->channels ;
  339|  27.8k|		total = indx ;
  340|  27.8k|		} ;
  341|       |
  342|  27.8k|	return total ;
  343|  27.8k|} /* msadpcm_read_block */
ms_adpcm.c:msadpcm_read_f:
  402|  27.8k|{	MSADPCM_PRIVATE *pms ;
  403|  27.8k|	BUF_UNION	ubuf ;
  404|  27.8k|	short		*sptr ;
  405|  27.8k|	int			k, bufferlen, readcount = 0, count ;
  406|  27.8k|	sf_count_t	total = 0 ;
  407|  27.8k|	float		normfact ;
  408|       |
  409|  27.8k|	if (! psf->codec_data)
  ------------------
  |  Branch (409:6): [True: 0, False: 27.8k]
  ------------------
  410|      0|		return 0 ;
  411|  27.8k|	pms = (MSADPCM_PRIVATE*) psf->codec_data ;
  412|       |
  413|  27.8k|	normfact = (psf->norm_float == SF_TRUE) ? 1.0 / ((float) 0x8000) : 1.0 ;
  ------------------
  |  Branch (413:13): [True: 27.8k, False: 0]
  ------------------
  414|  27.8k|	sptr = ubuf.sbuf ;
  415|  27.8k|	bufferlen = ARRAY_LEN (ubuf.sbuf) ;
  ------------------
  |  |   93|  27.8k|#define		ARRAY_LEN(x)	((int) (sizeof (x) / sizeof ((x) [0])))
  ------------------
  416|  55.6k|	while (len > 0)
  ------------------
  |  Branch (416:9): [True: 27.8k, False: 27.8k]
  ------------------
  417|  27.8k|	{	readcount = (len >= bufferlen) ? bufferlen : (int) len ;
  ------------------
  |  Branch (417:16): [True: 0, False: 27.8k]
  ------------------
  418|       |
  419|  27.8k|		if ((count = (int) msadpcm_read_block (psf, pms, sptr, readcount)) <= 0)
  ------------------
  |  Branch (419:7): [True: 0, False: 27.8k]
  ------------------
  420|      0|			return -1 ;
  421|       |
  422|  70.3k|		for (k = 0 ; k < readcount ; k++)
  ------------------
  |  Branch (422:16): [True: 42.5k, False: 27.8k]
  ------------------
  423|  42.5k|			ptr [total + k] = normfact * (float) (sptr [k]) ;
  424|  27.8k|		total += count ;
  425|  27.8k|		len -= readcount ;
  426|  27.8k|		if (count != readcount)
  ------------------
  |  Branch (426:7): [True: 0, False: 27.8k]
  ------------------
  427|      0|			break ;
  428|  27.8k|		} ;
  429|  27.8k|	return total ;
  430|  27.8k|} /* msadpcm_read_f */
ms_adpcm.c:msadpcm_close:
  785|    156|{	MSADPCM_PRIVATE *pms ;
  786|       |
  787|    156|	pms = (MSADPCM_PRIVATE*) psf->codec_data ;
  788|       |
  789|    156|	if (psf->file.mode == SFM_WRITE)
  ------------------
  |  Branch (789:6): [True: 0, False: 156]
  ------------------
  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|    156|	return 0 ;
  799|    156|} /* msadpcm_close */

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

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

pcm_init:
  123|    803|{	int chars = 0 ;
  124|       |
  125|    803|	if (psf->bytewidth == 0 || psf->sf.channels == 0)
  ------------------
  |  Branch (125:6): [True: 3, False: 800]
  |  Branch (125:29): [True: 20, False: 780]
  ------------------
  126|     23|	{	psf_log_printf (psf, "pcm_init : internal error : bytewitdh = %d, channels = %d\n", psf->bytewidth, psf->sf.channels) ;
  127|     23|		return SFE_INTERNAL ;
  128|    780|		} ;
  129|       |
  130|    780|	psf->blockwidth = (sf_count_t) psf->bytewidth * psf->sf.channels ;
  131|       |
  132|    780|	if ((SF_CODEC (psf->sf.format)) == SF_FORMAT_PCM_S8)
  ------------------
  |  |  109|    780|#define SF_CODEC(x)			((x) & SF_FORMAT_SUBMASK)
  ------------------
  |  Branch (132:6): [True: 149, False: 631]
  ------------------
  133|    149|		chars = SF_CHARS_SIGNED ;
  134|    631|	else if ((SF_CODEC (psf->sf.format)) == SF_FORMAT_PCM_U8)
  ------------------
  |  |  109|    631|#define SF_CODEC(x)			((x) & SF_FORMAT_SUBMASK)
  ------------------
  |  Branch (134:11): [True: 132, False: 499]
  ------------------
  135|    132|		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|    780|	psf->data_endswap = (psf->endian == SF_ENDIAN_LITTLE) ? SF_FALSE : SF_TRUE ;
  ------------------
  |  Branch (140:22): [True: 390, False: 390]
  ------------------
  141|    780|#endif
  142|       |
  143|    780|	if (psf->file.mode == SFM_READ || psf->file.mode == SFM_RDWR)
  ------------------
  |  Branch (143:6): [True: 780, False: 0]
  |  Branch (143:36): [True: 0, False: 0]
  ------------------
  144|    780|	{	switch (psf->bytewidth * 0x10000 + psf->endian + chars)
  145|    780|		{	case (0x10000 + SF_ENDIAN_BIG + SF_CHARS_SIGNED) :
  ------------------
  |  Branch (145:5): [True: 128, False: 652]
  ------------------
  146|    149|			case (0x10000 + SF_ENDIAN_LITTLE + SF_CHARS_SIGNED) :
  ------------------
  |  Branch (146:4): [True: 21, False: 759]
  ------------------
  147|    149|					psf->read_short		= pcm_read_sc2s ;
  148|    149|					psf->read_int		= pcm_read_sc2i ;
  149|    149|					psf->read_float		= pcm_read_sc2f ;
  150|    149|					psf->read_double	= pcm_read_sc2d ;
  151|    149|					break ;
  152|     16|			case (0x10000 + SF_ENDIAN_BIG + SF_CHARS_UNSIGNED) :
  ------------------
  |  Branch (152:4): [True: 16, False: 764]
  ------------------
  153|     95|			case (0x10000 + SF_ENDIAN_LITTLE + SF_CHARS_UNSIGNED) :
  ------------------
  |  Branch (153:4): [True: 79, False: 701]
  ------------------
  154|     95|					psf->read_short		= pcm_read_uc2s ;
  155|     95|					psf->read_int		= pcm_read_uc2i ;
  156|     95|					psf->read_float		= pcm_read_uc2f ;
  157|     95|					psf->read_double	= pcm_read_uc2d ;
  158|     95|					break ;
  159|       |
  160|    137|			case (2 * 0x10000 + SF_ENDIAN_BIG) :
  ------------------
  |  Branch (160:4): [True: 137, False: 643]
  ------------------
  161|    137|					psf->read_short		= pcm_read_bes2s ;
  162|    137|					psf->read_int		= pcm_read_bes2i ;
  163|    137|					psf->read_float		= pcm_read_bes2f ;
  164|    137|					psf->read_double	= pcm_read_bes2d ;
  165|    137|					break ;
  166|     37|			case (3 * 0x10000 + SF_ENDIAN_BIG) :
  ------------------
  |  Branch (166:4): [True: 37, False: 743]
  ------------------
  167|     37|					psf->read_short		= pcm_read_bet2s ;
  168|     37|					psf->read_int		= pcm_read_bet2i ;
  169|     37|					psf->read_float		= pcm_read_bet2f ;
  170|     37|					psf->read_double	= pcm_read_bet2d ;
  171|     37|					break ;
  172|     35|			case (4 * 0x10000 + SF_ENDIAN_BIG) :
  ------------------
  |  Branch (172:4): [True: 35, False: 745]
  ------------------
  173|       |
  174|     35|					psf->read_short		= pcm_read_bei2s ;
  175|     35|					psf->read_int		= pcm_read_bei2i ;
  176|     35|					psf->read_float		= pcm_read_bei2f ;
  177|     35|					psf->read_double	= pcm_read_bei2d ;
  178|     35|					break ;
  179|       |
  180|    119|			case (2 * 0x10000 + SF_ENDIAN_LITTLE) :
  ------------------
  |  Branch (180:4): [True: 119, False: 661]
  ------------------
  181|    119|					psf->read_short		= pcm_read_les2s ;
  182|    119|					psf->read_int		= pcm_read_les2i ;
  183|    119|					psf->read_float		= pcm_read_les2f ;
  184|    119|					psf->read_double	= pcm_read_les2d ;
  185|    119|					break ;
  186|    103|			case (3 * 0x10000 + SF_ENDIAN_LITTLE) :
  ------------------
  |  Branch (186:4): [True: 103, False: 677]
  ------------------
  187|    103|					psf->read_short		= pcm_read_let2s ;
  188|    103|					psf->read_int		= pcm_read_let2i ;
  189|    103|					psf->read_float		= pcm_read_let2f ;
  190|    103|					psf->read_double	= pcm_read_let2d ;
  191|    103|					break ;
  192|     68|			case (4 * 0x10000 + SF_ENDIAN_LITTLE) :
  ------------------
  |  Branch (192:4): [True: 68, False: 712]
  ------------------
  193|     68|					psf->read_short		= pcm_read_lei2s ;
  194|     68|					psf->read_int		= pcm_read_lei2i ;
  195|     68|					psf->read_float		= pcm_read_lei2f ;
  196|     68|					psf->read_double	= pcm_read_lei2d ;
  197|     68|					break ;
  198|     37|			default :
  ------------------
  |  Branch (198:4): [True: 37, False: 743]
  ------------------
  199|     37|				psf_log_printf (psf, "pcm.c returning SFE_UNIMPLEMENTED\nbytewidth %d    endian %d\n", psf->bytewidth, psf->endian) ;
  200|     37|				return SFE_UNIMPLEMENTED ;
  201|    780|			} ;
  202|    743|		} ;
  203|       |
  204|    743|	if (psf->file.mode == SFM_WRITE || psf->file.mode == SFM_RDWR)
  ------------------
  |  Branch (204:6): [True: 0, False: 743]
  |  Branch (204:37): [True: 0, False: 743]
  ------------------
  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|    743|		} ;
  269|       |
  270|    743|	if (psf->filelength > psf->dataoffset)
  ------------------
  |  Branch (270:6): [True: 461, False: 282]
  ------------------
  271|    461|	{	psf->datalength = (psf->dataend > 0) ? psf->dataend - psf->dataoffset :
  ------------------
  |  Branch (271:22): [True: 23, False: 438]
  ------------------
  272|    461|							psf->filelength - psf->dataoffset ;
  273|    461|		}
  274|    282|	else
  275|    282|		psf->datalength = 0 ;
  276|       |
  277|    743|	psf->sf.frames = psf->blockwidth > 0 ? psf->datalength / psf->blockwidth : 0 ;
  ------------------
  |  Branch (277:19): [True: 610, False: 133]
  ------------------
  278|       |
  279|    743|	return 0 ;
  280|    743|} /* pcm_init */
pcm.c:pcm_read_sc2f:
  981|    267|{	BUF_UNION	ubuf ;
  982|    267|	int			bufferlen, readcount ;
  983|    267|	sf_count_t	total = 0 ;
  984|    267|	float	normfact ;
  985|       |
  986|    267|	normfact = (psf->norm_float == SF_TRUE) ? 1.0 / ((float) 0x80) : 1.0 ;
  ------------------
  |  Branch (986:13): [True: 267, False: 0]
  ------------------
  987|       |
  988|    267|	bufferlen = ARRAY_LEN (ubuf.scbuf) ;
  ------------------
  |  |   93|    267|#define		ARRAY_LEN(x)	((int) (sizeof (x) / sizeof ((x) [0])))
  ------------------
  989|       |
  990|    520|	while (len > 0)
  ------------------
  |  Branch (990:9): [True: 267, False: 253]
  ------------------
  991|    267|	{	if (len < bufferlen)
  ------------------
  |  Branch (991:8): [True: 267, False: 0]
  ------------------
  992|    267|			bufferlen = (int) len ;
  993|    267|		readcount = (int) psf_fread (ubuf.scbuf, sizeof (signed char), bufferlen, psf) ;
  994|    267|		sc2f_array (ubuf.scbuf, readcount, ptr + total, normfact) ;
  995|    267|		total += readcount ;
  996|    267|		if (readcount < bufferlen)
  ------------------
  |  Branch (996:7): [True: 14, False: 253]
  ------------------
  997|     14|			break ;
  998|    253|		len -= readcount ;
  999|    253|		} ;
 1000|       |
 1001|    267|	return total ;
 1002|    267|} /* pcm_read_sc2f */
pcm.c:sc2f_array:
  385|  1.01k|{	for (int i = 0 ; i < count ; i++)
  ------------------
  |  Branch (385:20): [True: 751, False: 267]
  ------------------
  386|    751|		dest [i] = ((float) src [i]) * normfact ;
  387|    267|} /* sc2f_array */
pcm.c:pcm_read_uc2f:
 1006|    354|{	BUF_UNION	ubuf ;
 1007|    354|	int			bufferlen, readcount ;
 1008|    354|	sf_count_t	total = 0 ;
 1009|    354|	float	normfact ;
 1010|       |
 1011|    354|	normfact = (psf->norm_float == SF_TRUE) ? 1.0 / ((float) 0x80) : 1.0 ;
  ------------------
  |  Branch (1011:13): [True: 354, False: 0]
  ------------------
 1012|       |
 1013|    354|	bufferlen = ARRAY_LEN (ubuf.ucbuf) ;
  ------------------
  |  |   93|    354|#define		ARRAY_LEN(x)	((int) (sizeof (x) / sizeof ((x) [0])))
  ------------------
 1014|       |
 1015|    708|	while (len > 0)
  ------------------
  |  Branch (1015:9): [True: 354, False: 354]
  ------------------
 1016|    354|	{	if (len < bufferlen)
  ------------------
  |  Branch (1016:8): [True: 354, False: 0]
  ------------------
 1017|    354|			bufferlen = (int) len ;
 1018|    354|		readcount = (int) psf_fread (ubuf.ucbuf, sizeof (unsigned char), bufferlen, psf) ;
 1019|    354|		uc2f_array (ubuf.ucbuf, readcount, ptr + total, normfact) ;
 1020|    354|		total += readcount ;
 1021|    354|		if (readcount < bufferlen)
  ------------------
  |  Branch (1021:7): [True: 0, False: 354]
  ------------------
 1022|      0|			break ;
 1023|    354|		len -= readcount ;
 1024|    354|		} ;
 1025|       |
 1026|    354|	return total ;
 1027|    354|} /* pcm_read_uc2f */
pcm.c:uc2f_array:
  391|  2.18k|{	for (int i = 0 ; i < count ; i++)
  ------------------
  |  Branch (391:20): [True: 1.83k, False: 354]
  ------------------
  392|  1.83k|		dest [i] = (((int) src [i]) - 128) * normfact ;
  393|    354|} /* uc2f_array */
pcm.c:pcm_read_bes2f:
 1031|    431|{	BUF_UNION	ubuf ;
 1032|    431|	int			bufferlen, readcount ;
 1033|    431|	sf_count_t	total = 0 ;
 1034|    431|	float	normfact ;
 1035|       |
 1036|    431|	normfact = (psf->norm_float == SF_TRUE) ? 1.0 / ((float) 0x8000) : 1.0 ;
  ------------------
  |  Branch (1036:13): [True: 431, False: 0]
  ------------------
 1037|       |
 1038|    431|	bufferlen = ARRAY_LEN (ubuf.sbuf) ;
  ------------------
  |  |   93|    431|#define		ARRAY_LEN(x)	((int) (sizeof (x) / sizeof ((x) [0])))
  ------------------
 1039|       |
 1040|    852|	while (len > 0)
  ------------------
  |  Branch (1040:9): [True: 431, False: 421]
  ------------------
 1041|    431|	{	if (len < bufferlen)
  ------------------
  |  Branch (1041:8): [True: 431, False: 0]
  ------------------
 1042|    431|			bufferlen = (int) len ;
 1043|    431|		readcount = (int) psf_fread (ubuf.sbuf, sizeof (short), bufferlen, psf) ;
 1044|    431|		bes2f_array (ubuf.sbuf, readcount, ptr + total, normfact) ;
 1045|    431|		total += readcount ;
 1046|    431|		if (readcount < bufferlen)
  ------------------
  |  Branch (1046:7): [True: 10, False: 421]
  ------------------
 1047|     10|			break ;
 1048|    421|		len -= readcount ;
 1049|    421|		} ;
 1050|       |
 1051|    431|	return total ;
 1052|    431|} /* pcm_read_bes2f */
pcm.c:bes2f_array:
  408|    431|{	short			value ;
  409|       |
  410|  1.05k|	for (int i = 0 ; i < count ; i++)
  ------------------
  |  Branch (410:19): [True: 625, False: 431]
  ------------------
  411|    625|	{	value = src [i] ;
  412|       |		value = BE2H_16 (value) ;
  ------------------
  |  |  140|    625|	#define BE2H_16(x)			ENDSWAP_16 (x)
  |  |  ------------------
  |  |  |  |   34|    625|#define	ENDSWAP_16(x)		(bswap_16 (x))
  |  |  ------------------
  ------------------
  413|    625|		dest [i] = ((float) value) * normfact ;
  414|    625|		} ;
  415|    431|} /* bes2f_array */
pcm.c:pcm_read_les2f:
 1056|    271|{	BUF_UNION	ubuf ;
 1057|    271|	int			bufferlen, readcount ;
 1058|    271|	sf_count_t	total = 0 ;
 1059|    271|	float	normfact ;
 1060|       |
 1061|    271|	normfact = (psf->norm_float == SF_TRUE) ? 1.0 / ((float) 0x8000) : 1.0 ;
  ------------------
  |  Branch (1061:13): [True: 271, False: 0]
  ------------------
 1062|       |
 1063|    271|	bufferlen = ARRAY_LEN (ubuf.sbuf) ;
  ------------------
  |  |   93|    271|#define		ARRAY_LEN(x)	((int) (sizeof (x) / sizeof ((x) [0])))
  ------------------
 1064|       |
 1065|    521|	while (len > 0)
  ------------------
  |  Branch (1065:9): [True: 271, False: 250]
  ------------------
 1066|    271|	{	if (len < bufferlen)
  ------------------
  |  Branch (1066:8): [True: 271, False: 0]
  ------------------
 1067|    271|			bufferlen = (int) len ;
 1068|    271|		readcount = (int) psf_fread (ubuf.sbuf, sizeof (short), bufferlen, psf) ;
 1069|    271|		les2f_array (ubuf.sbuf, readcount, ptr + total, normfact) ;
 1070|    271|		total += readcount ;
 1071|    271|		if (readcount < bufferlen)
  ------------------
  |  Branch (1071:7): [True: 21, False: 250]
  ------------------
 1072|     21|			break ;
 1073|    250|		len -= readcount ;
 1074|    250|		} ;
 1075|       |
 1076|    271|	return total ;
 1077|    271|} /* pcm_read_les2f */
pcm.c:les2f_array:
  397|    271|{	short	value ;
  398|       |
  399|    729|	for (int i = 0 ; i < count ; i++)
  ------------------
  |  Branch (399:19): [True: 458, False: 271]
  ------------------
  400|    458|	{	value = src [i] ;
  401|    458|		value = LE2H_16 (value) ;
  ------------------
  |  |  137|    458|	#define LE2H_16(x)			(x)
  ------------------
  402|    458|		dest [i] = ((float) value) * normfact ;
  403|    458|		} ;
  404|    271|} /* les2f_array */
pcm.c:pcm_read_bet2f:
 1081|    400|{	BUF_UNION	ubuf ;
 1082|    400|	int			bufferlen, readcount ;
 1083|    400|	sf_count_t	total = 0 ;
 1084|    400|	float	normfact ;
 1085|       |
 1086|       |	/* Special normfactor because tribyte value is read into an int. */
 1087|    400|	normfact = (psf->norm_float == SF_TRUE) ? 1.0 / ((float) 0x80000000) : 1.0 / 256.0 ;
  ------------------
  |  Branch (1087:13): [True: 400, False: 0]
  ------------------
 1088|       |
 1089|    400|	bufferlen = sizeof (ubuf.ucbuf) / SIZEOF_TRIBYTE ;
  ------------------
  |  |   35|    400|#define	SIZEOF_TRIBYTE	3
  ------------------
 1090|       |
 1091|    780|	while (len > 0)
  ------------------
  |  Branch (1091:9): [True: 400, False: 380]
  ------------------
 1092|    400|	{	if (len < bufferlen)
  ------------------
  |  Branch (1092:8): [True: 400, False: 0]
  ------------------
 1093|    400|			bufferlen = (int) len ;
 1094|    400|		readcount = (int) psf_fread (ubuf.ucbuf, SIZEOF_TRIBYTE, bufferlen, psf) ;
  ------------------
  |  |   35|    400|#define	SIZEOF_TRIBYTE	3
  ------------------
 1095|    400|		bet2f_array ((tribyte*) (ubuf.ucbuf), readcount, ptr + total, normfact) ;
 1096|    400|		total += readcount ;
 1097|    400|		if (readcount < bufferlen)
  ------------------
  |  Branch (1097:7): [True: 20, False: 380]
  ------------------
 1098|     20|			break ;
 1099|    380|		len -= readcount ;
 1100|    380|		} ;
 1101|       |
 1102|    400|	return total ;
 1103|    400|} /* pcm_read_bet2f */
pcm.c:bet2f_array:
  429|    400|{	int value ;
  430|       |
  431|    989|	for (int i = 0 ; i < count ; i++)
  ------------------
  |  Branch (431:19): [True: 589, False: 400]
  ------------------
  432|    589|	{	value = psf_get_be24 (src [i].bytes, 0) ;
  433|    589|		dest [i] = ((float) value) * normfact ;
  434|    589|		} ;
  435|    400|} /* bet2f_array */
pcm.c:pcm_read_let2f:
 1107|   661k|{	BUF_UNION	ubuf ;
 1108|   661k|	int			bufferlen, readcount ;
 1109|   661k|	sf_count_t	total = 0 ;
 1110|   661k|	float	normfact ;
 1111|       |
 1112|       |	/* Special normfactor because tribyte value is read into an int. */
 1113|   661k|	normfact = (psf->norm_float == SF_TRUE) ? 1.0 / ((float) 0x80000000) : 1.0 / 256.0 ;
  ------------------
  |  Branch (1113:13): [True: 661k, False: 0]
  ------------------
 1114|       |
 1115|   661k|	bufferlen = sizeof (ubuf.ucbuf) / SIZEOF_TRIBYTE ;
  ------------------
  |  |   35|   661k|#define	SIZEOF_TRIBYTE	3
  ------------------
 1116|       |
 1117|  1.32M|	while (len > 0)
  ------------------
  |  Branch (1117:9): [True: 661k, False: 661k]
  ------------------
 1118|   661k|	{	if (len < bufferlen)
  ------------------
  |  Branch (1118:8): [True: 661k, False: 0]
  ------------------
 1119|   661k|			bufferlen = (int) len ;
 1120|   661k|		readcount = (int) psf_fread (ubuf.ucbuf, SIZEOF_TRIBYTE, bufferlen, psf) ;
  ------------------
  |  |   35|   661k|#define	SIZEOF_TRIBYTE	3
  ------------------
 1121|   661k|		let2f_array ((tribyte*) (ubuf.ucbuf), readcount, ptr + total, normfact) ;
 1122|   661k|		total += readcount ;
 1123|   661k|		if (readcount < bufferlen)
  ------------------
  |  Branch (1123:7): [True: 20, False: 661k]
  ------------------
 1124|     20|			break ;
 1125|   661k|		len -= readcount ;
 1126|   661k|		} ;
 1127|       |
 1128|   661k|	return total ;
 1129|   661k|} /* pcm_read_let2f */
pcm.c:let2f_array:
  419|   661k|{	int value ;
  420|       |
  421|  3.34M|	for (int i = 0 ; i < count ; i++)
  ------------------
  |  Branch (421:19): [True: 2.68M, False: 661k]
  ------------------
  422|  2.68M|	{	value = psf_get_le24 (src [i].bytes, 0) ;
  423|  2.68M|		dest [i] = ((float) value) * normfact ;
  424|  2.68M|		} ;
  425|   661k|} /* 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|    427|	while (len > 0)
  ------------------
  |  Branch (1142:9): [True: 216, False: 211]
  ------------------
 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: 5, False: 211]
  ------------------
 1149|      5|			break ;
 1150|    211|		len -= readcount ;
 1151|    211|		} ;
 1152|       |
 1153|    216|	return total ;
 1154|    216|} /* pcm_read_bei2f */
pcm.c:bei2f_array:
  450|    216|{	int 			value ;
  451|       |
  452|    626|	for (int i = 0 ; i < count ; i++)
  ------------------
  |  Branch (452:19): [True: 410, False: 216]
  ------------------
  453|    410|	{	value = src [i] ;
  454|       |		value = BE2H_32 (value) ;
  ------------------
  |  |  141|    410|	#define BE2H_32(x)			ENDSWAP_32 (x)
  |  |  ------------------
  |  |  |  |   35|    410|#define	ENDSWAP_32(x)		(bswap_32 (x))
  |  |  ------------------
  ------------------
  455|    410|		dest [i] = ((float) value) * normfact ;
  456|    410|		} ;
  457|    216|} /* bei2f_array */
pcm.c:pcm_read_lei2f:
 1158|  17.0k|{	BUF_UNION	ubuf ;
 1159|  17.0k|	int			bufferlen, readcount ;
 1160|  17.0k|	sf_count_t	total = 0 ;
 1161|  17.0k|	float	normfact ;
 1162|       |
 1163|  17.0k|	normfact = (psf->norm_float == SF_TRUE) ? 1.0 / ((float) 0x80000000) : 1.0 ;
  ------------------
  |  Branch (1163:13): [True: 17.0k, False: 0]
  ------------------
 1164|       |
 1165|  17.0k|	bufferlen = ARRAY_LEN (ubuf.ibuf) ;
  ------------------
  |  |   93|  17.0k|#define		ARRAY_LEN(x)	((int) (sizeof (x) / sizeof ((x) [0])))
  ------------------
 1166|       |
 1167|  34.1k|	while (len > 0)
  ------------------
  |  Branch (1167:9): [True: 17.0k, False: 17.0k]
  ------------------
 1168|  17.0k|	{	if (len < bufferlen)
  ------------------
  |  Branch (1168:8): [True: 17.0k, False: 0]
  ------------------
 1169|  17.0k|			bufferlen = (int) len ;
 1170|  17.0k|		readcount = (int) psf_fread (ubuf.ibuf, sizeof (int), bufferlen, psf) ;
 1171|  17.0k|		lei2f_array (ubuf.ibuf, readcount, ptr + total, normfact) ;
 1172|  17.0k|		total += readcount ;
 1173|  17.0k|		if (readcount < bufferlen)
  ------------------
  |  Branch (1173:7): [True: 23, False: 17.0k]
  ------------------
 1174|     23|			break ;
 1175|  17.0k|		len -= readcount ;
 1176|  17.0k|		} ;
 1177|       |
 1178|  17.0k|	return total ;
 1179|  17.0k|} /* pcm_read_lei2f */
pcm.c:lei2f_array:
  439|  17.0k|{	int 			value ;
  440|       |
  441|  91.3k|	for (int i = 0 ; i < count ; i++)
  ------------------
  |  Branch (441:19): [True: 74.2k, False: 17.0k]
  ------------------
  442|  74.2k|	{	value = src [i] ;
  443|  74.2k|		value = LE2H_32 (value) ;
  ------------------
  |  |  138|  74.2k|	#define LE2H_32(x)			(x)
  ------------------
  444|  74.2k|		dest [i] = ((float) value) * normfact ;
  445|  74.2k|		} ;
  446|  17.0k|} /* lei2f_array */

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

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

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

sf_open_virtual:
  473|  18.9k|{	SF_PRIVATE 	*psf ;
  474|       |
  475|       |	/* Make sure we have a valid set of virtual pointers. */
  476|  18.9k|	if (sfvirtual->get_filelen == NULL)
  ------------------
  |  Branch (476:6): [True: 0, False: 18.9k]
  ------------------
  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|  18.9k|		} ;
  481|       |
  482|  18.9k|	if ((sfvirtual->seek == NULL || sfvirtual->tell == NULL) && sfinfo->seekable)
  ------------------
  |  Branch (482:7): [True: 0, False: 18.9k]
  |  Branch (482:34): [True: 0, False: 18.9k]
  |  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|  18.9k|		} ;
  487|       |
  488|  18.9k|	if ((mode == SFM_READ || mode == SFM_RDWR) && sfvirtual->read == NULL)
  ------------------
  |  Branch (488:7): [True: 18.9k, False: 0]
  |  Branch (488:27): [True: 0, False: 0]
  |  Branch (488:48): [True: 0, False: 18.9k]
  ------------------
  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|  18.9k|		} ;
  493|       |
  494|  18.9k|	if ((mode == SFM_WRITE || mode == SFM_RDWR) && sfvirtual->write == NULL)
  ------------------
  |  Branch (494:7): [True: 0, False: 18.9k]
  |  Branch (494:28): [True: 0, False: 18.9k]
  |  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|  18.9k|		} ;
  499|       |
  500|  18.9k|	if ((psf = psf_allocate ()) == NULL)
  ------------------
  |  Branch (500:6): [True: 0, False: 18.9k]
  ------------------
  501|      0|	{	sf_errno = SFE_MALLOC_FAILED ;
  502|      0|		return	NULL ;
  503|  18.9k|		} ;
  504|       |
  505|  18.9k|	psf_init_files (psf) ;
  506|       |
  507|  18.9k|	psf->virtual_io = SF_TRUE ;
  508|  18.9k|	psf->vio = *sfvirtual ;
  509|  18.9k|	psf->vio_user_data = user_data ;
  510|       |
  511|  18.9k|	psf->file.mode = mode ;
  512|       |
  513|  18.9k|	return psf_open_file (psf, sfinfo) ;
  514|  18.9k|} /* sf_open_virtual */
sf_close:
  518|  3.09k|{	SF_PRIVATE	*psf ;
  519|       |
  520|  3.09k|	VALIDATE_SNDFILE_AND_ASSIGN_PSF (sndfile, psf, 1) ;
  ------------------
  |  |  326|  3.09k|		{	if ((a) == NULL)						\
  |  |  ------------------
  |  |  |  Branch (326:9): [True: 0, False: 3.09k]
  |  |  ------------------
  |  |  327|  3.09k|			{	sf_errno = SFE_BAD_SNDFILE_PTR ;	\
  |  |  328|      0|				return 0 ;							\
  |  |  329|  3.09k|				} ;									\
  |  |  330|  3.09k|			(b) = (SF_PRIVATE*) (a) ;				\
  |  |  331|  3.09k|			if ((b)->virtual_io == SF_FALSE &&		\
  |  |  ------------------
  |  |  |  Branch (331:8): [True: 0, False: 3.09k]
  |  |  ------------------
  |  |  332|  3.09k|				psf_file_valid (b) == 0)			\
  |  |  ------------------
  |  |  |  Branch (332:5): [True: 0, False: 0]
  |  |  ------------------
  |  |  333|  3.09k|			{	(b)->error = SFE_BAD_FILE_PTR ;		\
  |  |  334|      0|				return 0 ;							\
  |  |  335|  3.09k|				} ;									\
  |  |  336|  3.09k|			if ((b)->Magick != SNDFILE_MAGICK)		\
  |  |  ------------------
  |  |  |  |   41|  3.09k|#define		SNDFILE_MAGICK	0x1234C0DE
  |  |  ------------------
  |  |  |  Branch (336:8): [True: 0, False: 3.09k]
  |  |  ------------------
  |  |  337|  3.09k|			{	(b)->error = SFE_BAD_SNDFILE_PTR ;	\
  |  |  338|      0|				return 0 ;							\
  |  |  339|  3.09k|				} ;									\
  |  |  340|  3.09k|			if (c) (b)->error = 0 ;					\
  |  |  ------------------
  |  |  |  Branch (340:8): [True: 3.09k, Folded]
  |  |  ------------------
  |  |  341|  3.09k|			}
  ------------------
  521|       |
  522|  3.09k|	return psf_close (psf) ;
  523|  6.19k|} /* sf_close */
sf_error_number:
  542|  14.2k|{	static const char *bad_errnum =
  543|  14.2k|		"No error defined for this error number. This is a bug in libsndfile." ;
  544|  14.2k|	int	k ;
  545|       |
  546|  14.2k|	if (errnum == SFE_MAX_ERROR)
  ------------------
  |  Branch (546:6): [True: 0, False: 14.2k]
  ------------------
  547|      0|		return SndfileErrors [0].str ;
  548|       |
  549|  14.2k|	if (errnum < 0 || errnum > SFE_MAX_ERROR)
  ------------------
  |  Branch (549:6): [True: 0, False: 14.2k]
  |  Branch (549:20): [True: 0, False: 14.2k]
  ------------------
  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|  14.2k|		} ;
  554|       |
  555|   857k|	for (k = 0 ; SndfileErrors [k].str ; k++)
  ------------------
  |  Branch (555:15): [True: 857k, False: 0]
  ------------------
  556|   857k|		if (errnum == SndfileErrors [k].error)
  ------------------
  |  Branch (556:7): [True: 14.2k, False: 843k]
  ------------------
  557|  14.2k|			return SndfileErrors [k].str ;
  558|       |
  559|      0|	return bad_errnum ;
  560|  14.2k|} /* sf_error_number */
sf_readf_float:
 2020|   233M|{	SF_PRIVATE 	*psf ;
 2021|   233M|	sf_count_t	count, extra ;
 2022|       |
 2023|   233M|	if (frames == 0)
  ------------------
  |  Branch (2023:6): [True: 0, False: 233M]
  ------------------
 2024|      0|		return 0 ;
 2025|       |
 2026|   933M|	VALIDATE_SNDFILE_AND_ASSIGN_PSF (sndfile, psf, 1) ;
  ------------------
  |  |  326|   233M|		{	if ((a) == NULL)						\
  |  |  ------------------
  |  |  |  Branch (326:9): [True: 0, False: 233M]
  |  |  ------------------
  |  |  327|   233M|			{	sf_errno = SFE_BAD_SNDFILE_PTR ;	\
  |  |  328|      0|				return 0 ;							\
  |  |  329|   233M|				} ;									\
  |  |  330|   233M|			(b) = (SF_PRIVATE*) (a) ;				\
  |  |  331|   233M|			if ((b)->virtual_io == SF_FALSE &&		\
  |  |  ------------------
  |  |  |  Branch (331:8): [True: 0, False: 233M]
  |  |  ------------------
  |  |  332|   233M|				psf_file_valid (b) == 0)			\
  |  |  ------------------
  |  |  |  Branch (332:5): [True: 0, False: 0]
  |  |  ------------------
  |  |  333|   233M|			{	(b)->error = SFE_BAD_FILE_PTR ;		\
  |  |  334|      0|				return 0 ;							\
  |  |  335|   233M|				} ;									\
  |  |  336|   233M|			if ((b)->Magick != SNDFILE_MAGICK)		\
  |  |  ------------------
  |  |  |  |   41|   233M|#define		SNDFILE_MAGICK	0x1234C0DE
  |  |  ------------------
  |  |  |  Branch (336:8): [True: 0, False: 233M]
  |  |  ------------------
  |  |  337|   233M|			{	(b)->error = SFE_BAD_SNDFILE_PTR ;	\
  |  |  338|      0|				return 0 ;							\
  |  |  339|   233M|				} ;									\
  |  |  340|   233M|			if (c) (b)->error = 0 ;					\
  |  |  ------------------
  |  |  |  Branch (340:8): [True: 233M, Folded]
  |  |  ------------------
  |  |  341|   233M|			}
  ------------------
 2027|       |
 2028|   933M|	if (frames <= 0)
  ------------------
  |  Branch (2028:6): [True: 0, False: 233M]
  ------------------
 2029|      0|	{	psf->error = SFE_NEGATIVE_RW_LEN ;
 2030|      0|		return 0 ;
 2031|   233M|		} ;
 2032|       |
 2033|   233M|	if (psf->file.mode == SFM_WRITE)
  ------------------
  |  Branch (2033:6): [True: 0, False: 233M]
  ------------------
 2034|      0|	{	psf->error = SFE_NOT_READMODE ;
 2035|      0|		return 0 ;
 2036|   233M|		} ;
 2037|       |
 2038|   233M|	if (psf->read_current >= psf->sf.frames)
  ------------------
  |  Branch (2038:6): [True: 1.96k, False: 233M]
  ------------------
 2039|  1.96k|	{	psf_memset (ptr, 0, frames * psf->sf.channels * sizeof (float)) ;
 2040|  1.96k|		return 0 ;
 2041|   233M|		} ;
 2042|       |
 2043|   233M|	if (psf->read_float == NULL || psf->seek == NULL)
  ------------------
  |  Branch (2043:6): [True: 1, False: 233M]
  |  Branch (2043:33): [True: 0, False: 233M]
  ------------------
 2044|      1|	{	psf->error = SFE_UNIMPLEMENTED ;
 2045|      1|		return	0 ;
 2046|   233M|		} ;
 2047|       |
 2048|   233M|	if (psf->last_op != SFM_READ)
  ------------------
  |  Branch (2048:6): [True: 65, False: 233M]
  ------------------
 2049|     65|		if (psf->seek (psf, SFM_READ, psf->read_current) < 0)
  ------------------
  |  Branch (2049:7): [True: 0, False: 65]
  ------------------
 2050|      0|			return 0 ;
 2051|       |
 2052|   233M|	count = psf->read_float (psf, ptr, frames * psf->sf.channels) ;
 2053|       |
 2054|   233M|	if (psf->read_current + count / psf->sf.channels <= psf->sf.frames)
  ------------------
  |  Branch (2054:6): [True: 233M, False: 0]
  ------------------
 2055|   233M|		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|   233M|	psf->last_op = SFM_READ ;
 2064|       |
 2065|   233M|	return count / psf->sf.channels ;
 2066|   233M|} /* sf_readf_float */
psf_open_file:
 3010|  18.9k|{	int		error, format ;
 3011|       |
 3012|  18.9k|	sf_errno = error = 0 ;
 3013|  18.9k|	sf_parselog [0] = 0 ;
 3014|       |
 3015|  18.9k|	if (psf->error)
  ------------------
  |  Branch (3015:6): [True: 0, False: 18.9k]
  ------------------
 3016|      0|	{	error = psf->error ;
 3017|      0|		goto error_exit ;
 3018|  18.9k|		} ;
 3019|       |
 3020|  18.9k|	if (psf->file.mode != SFM_READ && psf->file.mode != SFM_WRITE && psf->file.mode != SFM_RDWR)
  ------------------
  |  Branch (3020:6): [True: 0, False: 18.9k]
  |  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|  18.9k|		} ;
 3024|       |
 3025|  18.9k|	if (sfinfo == NULL)
  ------------------
  |  Branch (3025:6): [True: 0, False: 18.9k]
  ------------------
 3026|      0|	{	error = SFE_BAD_SF_INFO_PTR ;
 3027|      0|		goto error_exit ;
 3028|  18.9k|		} ;
 3029|       |
 3030|  18.9k|	if (psf->file.mode == SFM_READ)
  ------------------
  |  Branch (3030:6): [True: 18.9k, False: 0]
  ------------------
 3031|  18.9k|	{	if ((SF_CONTAINER (sfinfo->format)) == SF_FORMAT_RAW)
  ------------------
  |  |  108|  18.9k|#define SF_CONTAINER(x)		((x) & SF_FORMAT_TYPEMASK)
  ------------------
  |  Branch (3031:8): [True: 0, False: 18.9k]
  ------------------
 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|  18.9k|		else
 3038|  18.9k|			memset (sfinfo, 0, sizeof (SF_INFO)) ;
 3039|  18.9k|		} ;
 3040|       |
 3041|  18.9k|	memcpy (&psf->sf, sfinfo, sizeof (SF_INFO)) ;
 3042|       |
 3043|  18.9k|	psf->Magick 		= SNDFILE_MAGICK ;
  ------------------
  |  |   41|  18.9k|#define		SNDFILE_MAGICK	0x1234C0DE
  ------------------
 3044|  18.9k|	psf->norm_float 	= SF_TRUE ;
 3045|  18.9k|	psf->norm_double	= SF_TRUE ;
 3046|  18.9k|	psf->dataoffset		= -1 ;
 3047|  18.9k|	psf->datalength		= -1 ;
 3048|  18.9k|	psf->read_current	= -1 ;
 3049|  18.9k|	psf->write_current	= -1 ;
 3050|  18.9k|	psf->auto_header 	= SF_FALSE ;
 3051|  18.9k|	psf->rwf_endian		= SF_ENDIAN_LITTLE ;
 3052|  18.9k|	psf->seek			= psf_default_seek ;
 3053|  18.9k|	psf->float_int_mult = 0 ;
 3054|  18.9k|	psf->float_max		= -1.0 ;
 3055|       |
 3056|       |	/* An attempt at a per SF_PRIVATE unique id. */
 3057|  18.9k|	psf->unique_id		= psf_rand_int32 () ;
 3058|       |
 3059|  18.9k|	psf->sf.sections = 1 ;
 3060|       |
 3061|  18.9k|	psf->is_pipe = psf_is_pipe (psf) ;
 3062|       |
 3063|  18.9k|	if (psf->is_pipe)
  ------------------
  |  Branch (3063:6): [True: 0, False: 18.9k]
  ------------------
 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|  18.9k|	else
 3068|  18.9k|	{	psf->sf.seekable = SF_TRUE ;
 3069|       |
 3070|       |		/* File is open, so get the length. */
 3071|  18.9k|		psf->filelength = psf_get_filelen (psf) ;
 3072|  18.9k|		} ;
 3073|       |
 3074|  18.9k|	if (psf->fileoffset > 0)
  ------------------
  |  Branch (3074:6): [True: 0, False: 18.9k]
  ------------------
 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|  18.9k|		} ;
 3097|       |
 3098|  18.9k|	if (psf->filelength == SF_COUNT_MAX)
  ------------------
  |  |  370|  18.9k|#define SF_COUNT_MAX	INT64_MAX
  ------------------
  |  Branch (3098:6): [True: 0, False: 18.9k]
  ------------------
 3099|      0|		psf_log_printf (psf, "Length : unknown\n") ;
 3100|  18.9k|	else
 3101|  18.9k|		psf_log_printf (psf, "Length : %D\n", psf->filelength) ;
 3102|       |
 3103|  18.9k|	if (psf->file.mode == SFM_WRITE || (psf->file.mode == SFM_RDWR && psf->filelength == 0))
  ------------------
  |  Branch (3103:6): [True: 0, False: 18.9k]
  |  Branch (3103:38): [True: 0, False: 18.9k]
  |  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|  18.9k|	else if ((SF_CONTAINER (psf->sf.format)) != SF_FORMAT_RAW)
  ------------------
  |  |  108|  18.9k|#define SF_CONTAINER(x)		((x) & SF_FORMAT_TYPEMASK)
  ------------------
  |  Branch (3121:11): [True: 18.9k, False: 0]
  ------------------
 3122|  18.9k|	{	/* If type RAW has not been specified then need to figure out file type. */
 3123|  18.9k|		psf->sf.format = guess_file_type (psf) ;
 3124|       |
 3125|  18.9k|		if (psf->sf.format == 0)
  ------------------
  |  Branch (3125:7): [True: 1.90k, False: 17.0k]
  ------------------
 3126|  1.90k|			psf->sf.format = format_from_extension (psf) ;
 3127|  18.9k|		} ;
 3128|       |
 3129|       |	/* Prevent unnecessary seeks */
 3130|  18.9k|	psf->last_op = psf->file.mode ;
 3131|       |
 3132|       |	/* Set bytewidth if known. */
 3133|  18.9k|	switch (SF_CODEC (psf->sf.format))
  ------------------
  |  |  109|  18.9k|#define SF_CODEC(x)			((x) & SF_FORMAT_SUBMASK)
  |  |  ------------------
  |  |  |  Branch (109:23): [True: 0, False: 18.9k]
  |  |  ------------------
  ------------------
 3134|  18.9k|	{	case SF_FORMAT_PCM_S8 :
  ------------------
  |  Branch (3134:4): [True: 0, False: 18.9k]
  ------------------
 3135|      0|		case SF_FORMAT_PCM_U8 :
  ------------------
  |  Branch (3135:3): [True: 0, False: 18.9k]
  ------------------
 3136|      0|		case SF_FORMAT_ULAW :
  ------------------
  |  Branch (3136:3): [True: 0, False: 18.9k]
  ------------------
 3137|      0|		case SF_FORMAT_ALAW :
  ------------------
  |  Branch (3137:3): [True: 0, False: 18.9k]
  ------------------
 3138|      0|		case SF_FORMAT_DPCM_8 :
  ------------------
  |  Branch (3138:3): [True: 0, False: 18.9k]
  ------------------
 3139|      0|				psf->bytewidth = 1 ;
 3140|      0|				break ;
 3141|       |
 3142|      0|		case SF_FORMAT_PCM_16 :
  ------------------
  |  Branch (3142:3): [True: 0, False: 18.9k]
  ------------------
 3143|      0|		case SF_FORMAT_DPCM_16 :
  ------------------
  |  Branch (3143:3): [True: 0, False: 18.9k]
  ------------------
 3144|      0|				psf->bytewidth = 2 ;
 3145|      0|				break ;
 3146|       |
 3147|      0|		case SF_FORMAT_PCM_24 :
  ------------------
  |  Branch (3147:3): [True: 0, False: 18.9k]
  ------------------
 3148|      0|				psf->bytewidth = 3 ;
 3149|      0|				break ;
 3150|       |
 3151|      0|		case SF_FORMAT_PCM_32 :
  ------------------
  |  Branch (3151:3): [True: 0, False: 18.9k]
  ------------------
 3152|      0|		case SF_FORMAT_FLOAT :
  ------------------
  |  Branch (3152:3): [True: 0, False: 18.9k]
  ------------------
 3153|      0|				psf->bytewidth = 4 ;
 3154|      0|				break ;
 3155|       |
 3156|      0|		case SF_FORMAT_DOUBLE :
  ------------------
  |  Branch (3156:3): [True: 0, False: 18.9k]
  ------------------
 3157|      0|				psf->bytewidth = 8 ;
 3158|      0|				break ;
 3159|  18.9k|		} ;
 3160|       |
 3161|       |	/* Call the initialisation function for the relevant file type. */
 3162|  18.9k|	switch (SF_CONTAINER (psf->sf.format))
  ------------------
  |  |  108|  18.9k|#define SF_CONTAINER(x)		((x) & SF_FORMAT_TYPEMASK)
  ------------------
 3163|  18.9k|	{	case	SF_FORMAT_WAV :
  ------------------
  |  Branch (3163:4): [True: 4.36k, False: 14.5k]
  ------------------
 3164|  4.36k|		case	SF_FORMAT_WAVEX :
  ------------------
  |  Branch (3164:3): [True: 0, False: 18.9k]
  ------------------
 3165|  4.36k|				error = wav_open (psf) ;
 3166|  4.36k|				break ;
 3167|       |
 3168|  3.03k|		case	SF_FORMAT_AIFF :
  ------------------
  |  Branch (3168:3): [True: 3.03k, False: 15.8k]
  ------------------
 3169|  3.03k|				error = aiff_open (psf) ;
 3170|  3.03k|				break ;
 3171|       |
 3172|  1.29k|		case	SF_FORMAT_AU :
  ------------------
  |  Branch (3172:3): [True: 1.29k, False: 17.6k]
  ------------------
 3173|  1.29k|				error = au_open (psf) ;
 3174|  1.29k|				break ;
 3175|       |
 3176|      0|		case	SF_FORMAT_RAW :
  ------------------
  |  Branch (3176:3): [True: 0, False: 18.9k]
  ------------------
 3177|      0|				error = raw_open (psf) ;
 3178|      0|				break ;
 3179|       |
 3180|    732|		case	SF_FORMAT_W64 :
  ------------------
  |  Branch (3180:3): [True: 732, False: 18.2k]
  ------------------
 3181|    732|				error = w64_open (psf) ;
 3182|    732|				break ;
 3183|       |
 3184|  2.01k|		case	SF_FORMAT_RF64 :
  ------------------
  |  Branch (3184:3): [True: 2.01k, False: 16.9k]
  ------------------
 3185|  2.01k|				error = rf64_open (psf) ;
 3186|  2.01k|				break ;
 3187|       |
 3188|       |		/* Lite remove start */
 3189|    142|		case	SF_FORMAT_PAF :
  ------------------
  |  Branch (3189:3): [True: 142, False: 18.7k]
  ------------------
 3190|    142|				error = paf_open (psf) ;
 3191|    142|				break ;
 3192|       |
 3193|    501|		case	SF_FORMAT_SVX :
  ------------------
  |  Branch (3193:3): [True: 501, False: 18.4k]
  ------------------
 3194|    501|				error = svx_open (psf) ;
 3195|    501|				break ;
 3196|       |
 3197|    117|		case	SF_FORMAT_NIST :
  ------------------
  |  Branch (3197:3): [True: 117, False: 18.8k]
  ------------------
 3198|    117|				error = nist_open (psf) ;
 3199|    117|				break ;
 3200|       |
 3201|    279|		case	SF_FORMAT_IRCAM :
  ------------------
  |  Branch (3201:3): [True: 279, False: 18.6k]
  ------------------
 3202|    279|				error = ircam_open (psf) ;
 3203|    279|				break ;
 3204|       |
 3205|    253|		case	SF_FORMAT_VOC :
  ------------------
  |  Branch (3205:3): [True: 253, False: 18.6k]
  ------------------
 3206|    253|				error = voc_open (psf) ;
 3207|    253|				break ;
 3208|       |
 3209|    382|		case	SF_FORMAT_SDS :
  ------------------
  |  Branch (3209:3): [True: 382, False: 18.5k]
  ------------------
 3210|    382|				error = sds_open (psf) ;
 3211|    382|				break ;
 3212|       |
 3213|      1|		case	SF_FORMAT_OGG :
  ------------------
  |  Branch (3213:3): [True: 1, False: 18.9k]
  ------------------
 3214|      1|				error = ogg_open (psf) ;
 3215|      1|				break ;
 3216|       |
 3217|      2|		case	SF_FORMAT_TXW :
  ------------------
  |  Branch (3217:3): [True: 2, False: 18.9k]
  ------------------
 3218|      2|				error = txw_open (psf) ;
 3219|      2|				break ;
 3220|       |
 3221|     83|		case	SF_FORMAT_WVE :
  ------------------
  |  Branch (3221:3): [True: 83, False: 18.8k]
  ------------------
 3222|     83|				error = wve_open (psf) ;
 3223|     83|				break ;
 3224|       |
 3225|      1|		case	SF_FORMAT_DWD :
  ------------------
  |  Branch (3225:3): [True: 1, False: 18.9k]
  ------------------
 3226|      1|				error = dwd_open (psf) ;
 3227|      1|				break ;
 3228|       |
 3229|    650|		case	SF_FORMAT_MAT4 :
  ------------------
  |  Branch (3229:3): [True: 650, False: 18.2k]
  ------------------
 3230|    650|				error = mat4_open (psf) ;
 3231|    650|				break ;
 3232|       |
 3233|    262|		case	SF_FORMAT_MAT5 :
  ------------------
  |  Branch (3233:3): [True: 262, False: 18.6k]
  ------------------
 3234|    262|				error = mat5_open (psf) ;
 3235|    262|				break ;
 3236|       |
 3237|    138|		case	SF_FORMAT_PVF :
  ------------------
  |  Branch (3237:3): [True: 138, False: 18.7k]
  ------------------
 3238|    138|				error = pvf_open (psf) ;
 3239|    138|				break ;
 3240|       |
 3241|    185|		case	SF_FORMAT_XI :
  ------------------
  |  Branch (3241:3): [True: 185, False: 18.7k]
  ------------------
 3242|    185|				error = xi_open (psf) ;
 3243|    185|				break ;
 3244|       |
 3245|     49|		case	SF_FORMAT_HTK :
  ------------------
  |  Branch (3245:3): [True: 49, False: 18.8k]
  ------------------
 3246|     49|				error = htk_open (psf) ;
 3247|     49|				break ;
 3248|       |
 3249|      0|		case	SF_FORMAT_SD2 :
  ------------------
  |  Branch (3249:3): [True: 0, False: 18.9k]
  ------------------
 3250|      0|				error = sd2_open (psf) ;
 3251|      0|				break ;
 3252|       |
 3253|      1|		case	SF_FORMAT_REX2 :
  ------------------
  |  Branch (3253:3): [True: 1, False: 18.9k]
  ------------------
 3254|      1|				error = rx2_open (psf) ;
 3255|      1|				break ;
 3256|       |
 3257|     90|		case	SF_FORMAT_AVR :
  ------------------
  |  Branch (3257:3): [True: 90, False: 18.8k]
  ------------------
 3258|     90|				error = avr_open (psf) ;
 3259|     90|				break ;
 3260|       |
 3261|      1|		case	SF_FORMAT_FLAC :
  ------------------
  |  Branch (3261:3): [True: 1, False: 18.9k]
  ------------------
 3262|      1|				error = flac_open (psf) ;
 3263|      1|				break ;
 3264|       |
 3265|  2.41k|		case	SF_FORMAT_CAF :
  ------------------
  |  Branch (3265:3): [True: 2.41k, False: 16.5k]
  ------------------
 3266|  2.41k|				error = caf_open (psf) ;
 3267|  2.41k|				break ;
 3268|       |
 3269|     10|		case	SF_FORMAT_MPC2K :
  ------------------
  |  Branch (3269:3): [True: 10, False: 18.9k]
  ------------------
 3270|     10|				error = mpc2k_open (psf) ;
 3271|     10|				break ;
 3272|       |
 3273|     14|		case	SF_FORMAT_MPEG :
  ------------------
  |  Branch (3273:3): [True: 14, False: 18.9k]
  ------------------
 3274|     14|				error = mpeg_open (psf) ;
 3275|     14|				break ;
 3276|       |
 3277|       |		/* Lite remove end */
 3278|       |
 3279|  1.90k|		default :
  ------------------
  |  Branch (3279:3): [True: 1.90k, False: 17.0k]
  ------------------
 3280|  1.90k|				error = SF_ERR_UNRECOGNISED_FORMAT ;
 3281|  18.9k|		} ;
 3282|       |
 3283|  18.9k|	if (error)
  ------------------
  |  Branch (3283:6): [True: 13.8k, False: 5.03k]
  ------------------
 3284|  13.8k|		goto error_exit ;
 3285|       |
 3286|       |	/* For now, check whether embedding is supported. */
 3287|  5.03k|	format = SF_CONTAINER (psf->sf.format) ;
  ------------------
  |  |  108|  5.03k|#define SF_CONTAINER(x)		((x) & SF_FORMAT_TYPEMASK)
  ------------------
 3288|  5.03k|	if (psf->fileoffset > 0)
  ------------------
  |  Branch (3288:6): [True: 117, False: 4.91k]
  ------------------
 3289|    117|	{	switch (format)
 3290|    117|		{	case SF_FORMAT_WAV :
  ------------------
  |  Branch (3290:5): [True: 18, False: 99]
  ------------------
 3291|     19|			case SF_FORMAT_WAVEX :
  ------------------
  |  Branch (3291:4): [True: 1, False: 116]
  ------------------
 3292|     23|			case SF_FORMAT_AIFF :
  ------------------
  |  Branch (3292:4): [True: 4, False: 113]
  ------------------
 3293|     56|			case SF_FORMAT_AU :
  ------------------
  |  Branch (3293:4): [True: 33, False: 84]
  ------------------
 3294|       |				/* Actual embedded files. */
 3295|     56|				break ;
 3296|       |
 3297|      0|			case SF_FORMAT_MPEG :
  ------------------
  |  Branch (3297:4): [True: 0, False: 117]
  ------------------
 3298|      0|			case SF_FORMAT_FLAC :
  ------------------
  |  Branch (3298:4): [True: 0, False: 117]
  ------------------
 3299|       |				/* Flac with an ID3v2 header? */
 3300|      0|				break ;
 3301|       |
 3302|     61|			default :
  ------------------
  |  Branch (3302:4): [True: 61, False: 56]
  ------------------
 3303|     61|				error = SFE_NO_EMBED_SUPPORT ;
 3304|     61|				goto error_exit ;
 3305|    117|			} ;
 3306|  4.97k|		} ;
 3307|       |
 3308|  4.97k|	if (psf->fileoffset > 0)
  ------------------
  |  Branch (3308:6): [True: 56, False: 4.91k]
  ------------------
 3309|     56|		psf_log_printf (psf, "Embedded file length : %D\n", psf->filelength) ;
 3310|       |
 3311|  4.97k|	if (psf->file.mode == SFM_RDWR && sf_format_check (&psf->sf) == 0)
  ------------------
  |  Branch (3311:6): [True: 0, False: 4.97k]
  |  Branch (3311:36): [True: 0, False: 0]
  ------------------
 3312|      0|	{	error = SFE_BAD_MODE_RW ;
 3313|      0|		goto error_exit ;
 3314|  4.97k|		} ;
 3315|       |
 3316|  4.97k|	if (validate_sfinfo (&psf->sf) == 0)
  ------------------
  |  Branch (3316:6): [True: 1.06k, False: 3.91k]
  ------------------
 3317|  1.06k|	{	psf_log_SF_INFO (psf) ;
 3318|  1.06k|		save_header_info (psf) ;
 3319|  1.06k|		error = SFE_BAD_SF_INFO ;
 3320|  1.06k|		goto error_exit ;
 3321|  3.91k|		} ;
 3322|       |
 3323|  3.91k|	if (validate_psf (psf) == 0)
  ------------------
  |  Branch (3323:6): [True: 816, False: 3.09k]
  ------------------
 3324|    816|	{	save_header_info (psf) ;
 3325|    816|		error = SFE_INTERNAL ;
 3326|    816|		goto error_exit ;
 3327|  3.09k|		} ;
 3328|       |
 3329|  3.09k|	psf->read_current = 0 ;
 3330|  3.09k|	psf->write_current = 0 ;
 3331|  3.09k|	if (psf->file.mode == SFM_RDWR)
  ------------------
  |  Branch (3331:6): [True: 0, False: 3.09k]
  ------------------
 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.09k|	memcpy (sfinfo, &psf->sf, sizeof (SF_INFO)) ;
 3337|       |
 3338|  3.09k|	if (psf->file.mode == SFM_WRITE)
  ------------------
  |  Branch (3338:6): [True: 0, False: 3.09k]
  ------------------
 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.09k|	return (SNDFILE *) psf ;
 3346|       |
 3347|  15.8k|error_exit :
 3348|  15.8k|	sf_errno = error ;
 3349|       |
 3350|  15.8k|	if (error == SFE_SYSTEM)
  ------------------
  |  Branch (3350:6): [True: 0, False: 15.8k]
  ------------------
 3351|      0|		snprintf (sf_syserr, sizeof (sf_syserr), "%s", psf->syserr) ;
 3352|  15.8k|	snprintf (sf_parselog, sizeof (sf_parselog), "%s", psf->parselog.buf) ;
 3353|       |
 3354|  15.8k|	switch (error)
 3355|  15.8k|	{	case SF_ERR_SYSTEM :
  ------------------
  |  Branch (3355:4): [True: 0, False: 15.8k]
  ------------------
 3356|    271|		case SF_ERR_UNSUPPORTED_ENCODING :
  ------------------
  |  Branch (3356:3): [True: 271, False: 15.5k]
  ------------------
 3357|  1.60k|		case SFE_UNIMPLEMENTED :
  ------------------
  |  Branch (3357:3): [True: 1.33k, False: 14.5k]
  ------------------
 3358|  1.60k|			break ;
 3359|       |
 3360|      0|		case SFE_RAW_BAD_FORMAT :
  ------------------
  |  Branch (3360:3): [True: 0, False: 15.8k]
  ------------------
 3361|      0|			break ;
 3362|       |
 3363|  14.2k|		default :
  ------------------
  |  Branch (3363:3): [True: 14.2k, False: 1.60k]
  ------------------
 3364|  14.2k|			if (psf->file.mode == SFM_READ)
  ------------------
  |  Branch (3364:8): [True: 14.2k, False: 0]
  ------------------
 3365|  14.2k|			{	psf_log_printf (psf, "Parse error : %s\n", sf_error_number (error)) ;
 3366|  14.2k|				error = SF_ERR_MALFORMED_FILE ;
 3367|  14.2k|				} ;
 3368|  15.8k|		} ;
 3369|       |
 3370|  15.8k|	psf_close (psf) ;
 3371|       |	return NULL ;
 3372|  15.8k|} /* psf_open_file */
sndfile.c:psf_close:
 2965|  18.9k|{	uint32_t k ;
 2966|  18.9k|	int	error = 0 ;
 2967|       |
 2968|  18.9k|	if (psf->codec_close)
  ------------------
  |  Branch (2968:6): [True: 2.93k, False: 15.9k]
  ------------------
 2969|  2.93k|	{	error = psf->codec_close (psf) ;
 2970|       |		/* To prevent it being called in psf->container_close(). */
 2971|  2.93k|		psf->codec_close = NULL ;
 2972|  2.93k|		} ;
 2973|       |
 2974|  18.9k|	if (psf->container_close)
  ------------------
  |  Branch (2974:6): [True: 7.92k, False: 11.0k]
  ------------------
 2975|  7.92k|		error = psf->container_close (psf) ;
 2976|       |
 2977|  18.9k|	error = psf_fclose (psf) ;
 2978|  18.9k|	psf_close_rsrc (psf) ;
 2979|       |
 2980|       |	/* For an ISO C compliant implementation it is ok to free a NULL pointer. */
 2981|  18.9k|	free (psf->header.ptr) ;
 2982|  18.9k|	free (psf->container_data) ;
 2983|  18.9k|	free (psf->codec_data) ;
 2984|  18.9k|	free (psf->interleave) ;
 2985|  18.9k|	free (psf->dither) ;
 2986|  18.9k|	free (psf->peak_info) ;
 2987|  18.9k|	free (psf->broadcast_16k) ;
 2988|  18.9k|	free (psf->loop_info) ;
 2989|  18.9k|	free (psf->instrument) ;
 2990|  18.9k|	free (psf->cues) ;
 2991|  18.9k|	free (psf->channel_map) ;
 2992|  18.9k|	free (psf->format_desc) ;
 2993|  18.9k|	free (psf->strings.storage) ;
 2994|       |
 2995|  18.9k|	if (psf->wchunks.chunks)
  ------------------
  |  Branch (2995:6): [True: 0, False: 18.9k]
  ------------------
 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|  18.9k|	free (psf->rchunks.chunks) ;
 2999|  18.9k|	free (psf->wchunks.chunks) ;
 3000|  18.9k|	free (psf->iterator) ;
 3001|  18.9k|	free (psf->cart_16k) ;
 3002|       |
 3003|  18.9k|	free (psf) ;
 3004|       |
 3005|  18.9k|	return error ;
 3006|  18.9k|} /* psf_close */
sndfile.c:guess_file_type:
 2783|  18.9k|{	uint32_t buffer [3], format ;
 2784|       |
 2785|  21.3k|retry:
 2786|  21.3k|	if (psf_binheader_readf (psf, "b", &buffer, SIGNED_SIZEOF (buffer)) != SIGNED_SIZEOF (buffer))
  ------------------
  |  |   91|  21.3k|#define		SIGNED_SIZEOF(x)	((int) sizeof (x))
  ------------------
              	if (psf_binheader_readf (psf, "b", &buffer, SIGNED_SIZEOF (buffer)) != SIGNED_SIZEOF (buffer))
  ------------------
  |  |   91|  21.3k|#define		SIGNED_SIZEOF(x)	((int) sizeof (x))
  ------------------
  |  Branch (2786:6): [True: 63, False: 21.2k]
  ------------------
 2787|     63|	{	psf->error = SFE_BAD_FILE_READ ;
 2788|     63|		return 0 ;
 2789|  21.2k|		} ;
 2790|       |
 2791|  21.2k|	if ((buffer [0] == MAKE_MARKER ('R', 'I', 'F', 'F') || buffer [0] == MAKE_MARKER ('R', 'I', 'F', 'X'))
  ------------------
  |  |  122|  42.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.0k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
  |  Branch (2791:7): [True: 4.20k, False: 17.0k]
  |  Branch (2791:57): [True: 212, False: 16.8k]
  ------------------
 2792|  4.41k|			&& buffer [2] == MAKE_MARKER ('W', 'A', 'V', 'E'))
  ------------------
  |  |  122|  4.41k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
  |  Branch (2792:7): [True: 4.36k, False: 50]
  ------------------
 2793|  4.36k|		return SF_FORMAT_WAV ;
 2794|       |
 2795|  16.9k|	if (buffer [0] == MAKE_MARKER ('F', 'O', 'R', 'M'))
  ------------------
  |  |  122|  16.9k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
  |  Branch (2795:6): [True: 3.68k, False: 13.2k]
  ------------------
 2796|  3.68k|	{	if (buffer [2] == MAKE_MARKER ('A', 'I', 'F', 'F') || buffer [2] == MAKE_MARKER ('A', 'I', 'F', 'C'))
  ------------------
  |  |  122|  7.36k|	#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.03k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
  |  Branch (2796:8): [True: 650, False: 3.03k]
  |  Branch (2796:58): [True: 2.38k, False: 645]
  ------------------
 2797|  3.03k|			return SF_FORMAT_AIFF ;
 2798|    645|		if (buffer [2] == MAKE_MARKER ('8', 'S', 'V', 'X') || buffer [2] == MAKE_MARKER ('1', '6', 'S', 'V'))
  ------------------
  |  |  122|  1.29k|	#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|    581|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
  |  Branch (2798:7): [True: 64, False: 581]
  |  Branch (2798:57): [True: 437, False: 144]
  ------------------
 2799|    501|			return SF_FORMAT_SVX ;
 2800|    144|		return 0 ;
 2801|  13.2k|		} ;
 2802|       |
 2803|  13.2k|	if (buffer [0] == MAKE_MARKER ('.', 's', 'n', 'd') || buffer [0] == MAKE_MARKER ('d', 'n', 's', '.'))
  ------------------
  |  |  122|  26.4k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
              	if (buffer [0] == MAKE_MARKER ('.', 's', 'n', 'd') || buffer [0] == MAKE_MARKER ('d', 'n', 's', '.'))
  ------------------
  |  |  122|  12.7k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
  |  Branch (2803:6): [True: 491, False: 12.7k]
  |  Branch (2803:56): [True: 806, False: 11.9k]
  ------------------
 2804|  1.29k|		return SF_FORMAT_AU ;
 2805|       |
 2806|  11.9k|	if ((buffer [0] == MAKE_MARKER ('f', 'a', 'p', ' ') || buffer [0] == MAKE_MARKER (' ', 'p', 'a', 'f')))
  ------------------
  |  |  122|  23.8k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
              	if ((buffer [0] == MAKE_MARKER ('f', 'a', 'p', ' ') || buffer [0] == MAKE_MARKER (' ', 'p', 'a', 'f')))
  ------------------
  |  |  122|  11.9k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
  |  Branch (2806:7): [True: 8, False: 11.9k]
  |  Branch (2806:57): [True: 134, False: 11.7k]
  ------------------
 2807|    142|		return SF_FORMAT_PAF ;
 2808|       |
 2809|  11.7k|	if (buffer [0] == MAKE_MARKER ('N', 'I', 'S', 'T'))
  ------------------
  |  |  122|  11.7k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
  |  Branch (2809:6): [True: 117, False: 11.6k]
  ------------------
 2810|    117|		return SF_FORMAT_NIST ;
 2811|       |
 2812|  11.6k|	if (buffer [0] == MAKE_MARKER ('C', 'r', 'e', 'a') && buffer [1] == MAKE_MARKER ('t', 'i', 'v', 'e'))
  ------------------
  |  |  122|  23.3k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
              	if (buffer [0] == MAKE_MARKER ('C', 'r', 'e', 'a') && buffer [1] == MAKE_MARKER ('t', 'i', 'v', 'e'))
  ------------------
  |  |  122|    292|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
  |  Branch (2812:6): [True: 292, False: 11.3k]
  |  Branch (2812:56): [True: 253, False: 39]
  ------------------
 2813|    253|		return SF_FORMAT_VOC ;
 2814|       |
 2815|  11.4k|	if ((buffer [0] & MAKE_MARKER (0xFF, 0xFF, 0xF8, 0xFF)) == MAKE_MARKER (0x64, 0xA3, 0x00, 0x00) ||
  ------------------
  |  |  122|  11.4k|	#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|  22.8k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
  |  Branch (2815:6): [True: 191, False: 11.2k]
  ------------------
 2816|  11.2k|		(buffer [0] & MAKE_MARKER (0xFF, 0xF8, 0xFF, 0xFF)) == MAKE_MARKER (0x00, 0x00, 0xA3, 0x64))
  ------------------
  |  |  122|  11.2k|	#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.2k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
  |  Branch (2816:3): [True: 88, False: 11.1k]
  ------------------
 2817|    279|		return SF_FORMAT_IRCAM ;
 2818|       |
 2819|  11.1k|	if (buffer [0] == MAKE_MARKER ('r', 'i', 'f', 'f'))
  ------------------
  |  |  122|  11.1k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
  |  Branch (2819:6): [True: 732, False: 10.4k]
  ------------------
 2820|    732|		return SF_FORMAT_W64 ;
 2821|       |
 2822|  10.4k|	if (buffer [0] == MAKE_MARKER (0, 0, 0x03, 0xE8) && buffer [1] == MAKE_MARKER (0, 0, 0, 1) &&
  ------------------
  |  |  122|  20.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, 0x03, 0xE8) && buffer [1] == MAKE_MARKER (0, 0, 0, 1) &&
  ------------------
  |  |  122|  10.6k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
  |  Branch (2822:6): [True: 192, False: 10.2k]
  |  Branch (2822:54): [True: 144, False: 48]
  ------------------
 2823|    144|								buffer [2] == MAKE_MARKER (0, 0, 0, 1))
  ------------------
  |  |  122|    144|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
  |  Branch (2823:9): [True: 117, False: 27]
  ------------------
 2824|    117|		return SF_FORMAT_MAT4 ;
 2825|       |
 2826|  10.2k|	if (buffer [0] == MAKE_MARKER (0, 0, 0, 0) && buffer [1] == MAKE_MARKER (1, 0, 0, 0) &&
  ------------------
  |  |  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 (0, 0, 0, 0) && buffer [1] == MAKE_MARKER (1, 0, 0, 0) &&
  ------------------
  |  |  122|  10.9k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
  |  Branch (2826:6): [True: 655, False: 9.63k]
  |  Branch (2826:48): [True: 577, False: 78]
  ------------------
 2827|    577|								buffer [2] == MAKE_MARKER (1, 0, 0, 0))
  ------------------
  |  |  122|    577|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
  |  Branch (2827:9): [True: 533, False: 44]
  ------------------
 2828|    533|		return SF_FORMAT_MAT4 ;
 2829|       |
 2830|  9.76k|	if (buffer [0] == MAKE_MARKER ('M', 'A', 'T', 'L') && buffer [1] == MAKE_MARKER ('A', 'B', ' ', '5'))
  ------------------
  |  |  122|  19.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|    300|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
  |  Branch (2830:6): [True: 300, False: 9.46k]
  |  Branch (2830:56): [True: 262, False: 38]
  ------------------
 2831|    262|		return SF_FORMAT_MAT5 ;
 2832|       |
 2833|  9.49k|	if (buffer [0] == MAKE_MARKER ('P', 'V', 'F', '1'))
  ------------------
  |  |  122|  9.49k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
  |  Branch (2833:6): [True: 138, False: 9.36k]
  ------------------
 2834|    138|		return SF_FORMAT_PVF ;
 2835|       |
 2836|  9.36k|	if (buffer [0] == MAKE_MARKER ('E', 'x', 't', 'e') && buffer [1] == MAKE_MARKER ('n', 'd', 'e', 'd') &&
  ------------------
  |  |  122|  18.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|  9.62k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
  |  Branch (2836:6): [True: 264, False: 9.09k]
  |  Branch (2836:56): [True: 215, False: 49]
  ------------------
 2837|    215|								buffer [2] == MAKE_MARKER (' ', 'I', 'n', 's'))
  ------------------
  |  |  122|    215|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
  |  Branch (2837:9): [True: 185, False: 30]
  ------------------
 2838|    185|		return SF_FORMAT_XI ;
 2839|       |
 2840|  9.17k|	if (buffer [0] == MAKE_MARKER ('c', 'a', 'f', 'f') && buffer [2] == MAKE_MARKER ('d', 'e', 's', 'c'))
  ------------------
  |  |  122|  18.3k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
              	if (buffer [0] == MAKE_MARKER ('c', 'a', 'f', 'f') && buffer [2] == MAKE_MARKER ('d', 'e', 's', 'c'))
  ------------------
  |  |  122|  2.46k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
  |  Branch (2840:6): [True: 2.46k, False: 6.71k]
  |  Branch (2840:56): [True: 2.41k, False: 48]
  ------------------
 2841|  2.41k|		return SF_FORMAT_CAF ;
 2842|       |
 2843|  6.76k|	if (buffer [0] == MAKE_MARKER ('O', 'g', 'g', 'S'))
  ------------------
  |  |  122|  6.76k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
  |  Branch (2843:6): [True: 1, False: 6.75k]
  ------------------
 2844|      1|		return SF_FORMAT_OGG ;
 2845|       |
 2846|  6.75k|	if (buffer [0] == MAKE_MARKER ('A', 'L', 'a', 'w') && buffer [1] == MAKE_MARKER ('S', 'o', 'u', 'n')
  ------------------
  |  |  122|  13.5k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
              	if (buffer [0] == MAKE_MARKER ('A', 'L', 'a', 'w') && buffer [1] == MAKE_MARKER ('S', 'o', 'u', 'n')
  ------------------
  |  |  122|  6.92k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
  |  Branch (2846:6): [True: 168, False: 6.59k]
  |  Branch (2846:56): [True: 122, False: 46]
  ------------------
 2847|    122|			&& buffer [2] == MAKE_MARKER ('d', 'F', 'i', 'l'))
  ------------------
  |  |  122|    122|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
  |  Branch (2847:7): [True: 83, False: 39]
  ------------------
 2848|     83|		return SF_FORMAT_WVE ;
 2849|       |
 2850|  6.67k|	if (buffer [0] == MAKE_MARKER ('D', 'i', 'a', 'm') && buffer [1] == MAKE_MARKER ('o', 'n', 'd', 'W')
  ------------------
  |  |  122|  13.3k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
              	if (buffer [0] == MAKE_MARKER ('D', 'i', 'a', 'm') && buffer [1] == MAKE_MARKER ('o', 'n', 'd', 'W')
  ------------------
  |  |  122|  6.76k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
  |  Branch (2850:6): [True: 87, False: 6.58k]
  |  Branch (2850:56): [True: 40, False: 47]
  ------------------
 2851|     40|			&& buffer [2] == MAKE_MARKER ('a', 'r', 'e', ' '))
  ------------------
  |  |  122|     40|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
  |  Branch (2851:7): [True: 1, False: 39]
  ------------------
 2852|      1|		return SF_FORMAT_DWD ;
 2853|       |
 2854|  6.67k|	if (buffer [0] == MAKE_MARKER ('L', 'M', '8', '9') || buffer [0] == MAKE_MARKER ('5', '3', 0, 0))
  ------------------
  |  |  122|  13.3k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
              	if (buffer [0] == MAKE_MARKER ('L', 'M', '8', '9') || buffer [0] == MAKE_MARKER ('5', '3', 0, 0))
  ------------------
  |  |  122|  6.67k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
  |  Branch (2854:6): [True: 1, False: 6.67k]
  |  Branch (2854:56): [True: 1, False: 6.67k]
  ------------------
 2855|      2|		return SF_FORMAT_TXW ;
 2856|       |
 2857|  6.67k|	if ((buffer [0] & MAKE_MARKER (0xFF, 0xFF, 0x80, 0xFF)) == MAKE_MARKER (0xF0, 0x7E, 0, 0x01))
  ------------------
  |  |  122|  6.67k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
              	if ((buffer [0] & MAKE_MARKER (0xFF, 0xFF, 0x80, 0xFF)) == MAKE_MARKER (0xF0, 0x7E, 0, 0x01))
  ------------------
  |  |  122|  6.67k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
  |  Branch (2857:6): [True: 382, False: 6.29k]
  ------------------
 2858|    382|		return SF_FORMAT_SDS ;
 2859|       |
 2860|  6.29k|	if ((buffer [0] & MAKE_MARKER (0xFF, 0xFF, 0, 0)) == MAKE_MARKER (1, 4, 0, 0))
  ------------------
  |  |  122|  6.29k|	#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.29k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
  |  Branch (2860:6): [True: 10, False: 6.28k]
  ------------------
 2861|     10|		return SF_FORMAT_MPC2K ;
 2862|       |
 2863|  6.28k|	if (buffer [0] == MAKE_MARKER ('C', 'A', 'T', ' ') && buffer [2] == MAKE_MARKER ('R', 'E', 'X', '2'))
  ------------------
  |  |  122|  12.5k|	#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|     14|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
  |  Branch (2863:6): [True: 14, False: 6.26k]
  |  Branch (2863:56): [True: 1, False: 13]
  ------------------
 2864|      1|		return SF_FORMAT_REX2 ;
 2865|       |
 2866|  6.28k|	if (buffer [0] == MAKE_MARKER (0x30, 0x26, 0xB2, 0x75) && buffer [1] == MAKE_MARKER (0x8E, 0x66, 0xCF, 0x11))
  ------------------
  |  |  122|  12.5k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
              	if (buffer [0] == MAKE_MARKER (0x30, 0x26, 0xB2, 0x75) && buffer [1] == MAKE_MARKER (0x8E, 0x66, 0xCF, 0x11))
  ------------------
  |  |  122|     34|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
  |  Branch (2866:6): [True: 34, False: 6.24k]
  |  Branch (2866:60): [True: 1, False: 33]
  ------------------
 2867|      1|		return 0 /*-SF_FORMAT_WMA-*/ ;
 2868|       |
 2869|       |	/* HMM (Hidden Markov Model) Tool Kit. */
 2870|  6.27k|	if (buffer [2] == MAKE_MARKER (0, 2, 0, 0) && 2 * ((int64_t) BE2H_32 (buffer [0])) + 12 == psf->filelength)
  ------------------
  |  |  122|  12.5k|	#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|    447|	#define BE2H_32(x)			ENDSWAP_32 (x)
  |  |  ------------------
  |  |  |  |   35|    447|#define	ENDSWAP_32(x)		(bswap_32 (x))
  |  |  ------------------
  ------------------
  |  Branch (2870:6): [True: 447, False: 5.83k]
  |  Branch (2870:48): [True: 49, False: 398]
  ------------------
 2871|     49|		return SF_FORMAT_HTK ;
 2872|       |
 2873|  6.23k|	if (buffer [0] == MAKE_MARKER ('f', 'L', 'a', 'C'))
  ------------------
  |  |  122|  6.23k|	#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.22k]
  ------------------
 2874|      1|		return SF_FORMAT_FLAC ;
 2875|       |
 2876|  6.22k|	if (buffer [0] == MAKE_MARKER ('2', 'B', 'I', 'T'))
  ------------------
  |  |  122|  6.22k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
  |  Branch (2876:6): [True: 90, False: 6.13k]
  ------------------
 2877|     90|		return SF_FORMAT_AVR ;
 2878|       |
 2879|  6.13k|	if (buffer [0] == MAKE_MARKER ('R', 'F', '6', '4') && buffer [2] == MAKE_MARKER ('W', 'A', 'V', 'E'))
  ------------------
  |  |  122|  12.2k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
              	if (buffer [0] == MAKE_MARKER ('R', 'F', '6', '4') && buffer [2] == MAKE_MARKER ('W', 'A', 'V', 'E'))
  ------------------
  |  |  122|  2.04k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
  |  Branch (2879:6): [True: 2.04k, False: 4.09k]
  |  Branch (2879:56): [True: 2.01k, False: 35]
  ------------------
 2880|  2.01k|		return SF_FORMAT_RF64 ;
 2881|       |
 2882|  4.12k|	if (buffer [0] == MAKE_MARKER ('I', 'D', '3', 2) || buffer [0] == MAKE_MARKER ('I', 'D', '3', 3)
  ------------------
  |  |  122|  8.25k|	#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.66k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
  |  Branch (2882:6): [True: 582, False: 3.54k]
  |  Branch (2882:54): [True: 660, False: 2.88k]
  ------------------
 2883|  2.88k|			|| buffer [0] == MAKE_MARKER ('I', 'D', '3', 4))
  ------------------
  |  |  122|  2.88k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
  |  Branch (2883:7): [True: 1.22k, False: 1.66k]
  ------------------
 2884|  2.46k|	{	psf_log_printf (psf, "Found 'ID3' marker.\n") ;
 2885|  2.46k|		if (id3_skip (psf))
  ------------------
  |  Branch (2885:7): [True: 2.41k, False: 51]
  ------------------
 2886|  2.41k|			goto retry ;
 2887|     51|		return 0 ;
 2888|  2.46k|		} ;
 2889|       |
 2890|       |	/* ID3v2 tags + MPEG */
 2891|  1.66k|	if (psf->id3_header.len > 0 && (format = identify_mpeg (buffer [0])) != 0)
  ------------------
  |  Branch (2891:6): [True: 40, False: 1.62k]
  |  Branch (2891:33): [True: 6, False: 34]
  ------------------
 2892|      6|		return format ;
 2893|       |
 2894|       |	/* Turtle Beach SMP 16-bit */
 2895|  1.65k|	if (buffer [0] == MAKE_MARKER ('S', 'O', 'U', 'N') && buffer [1] == MAKE_MARKER ('D', ' ', 'S', 'A'))
  ------------------
  |  |  122|  3.31k|	#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|     31|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
  |  Branch (2895:6): [True: 31, False: 1.62k]
  |  Branch (2895:56): [True: 1, False: 30]
  ------------------
 2896|      1|		return 0 ;
 2897|       |
 2898|       |	/* Yamaha sampler format. */
 2899|  1.65k|	if (buffer [0] == MAKE_MARKER ('S', 'Y', '8', '0') || buffer [0] == MAKE_MARKER ('S', 'Y', '8', '5'))
  ------------------
  |  |  122|  3.30k|	#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.65k|	#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.65k]
  |  Branch (2899:56): [True: 1, False: 1.65k]
  ------------------
 2900|      2|		return 0 ;
 2901|       |
 2902|  1.65k|	if (buffer [0] == MAKE_MARKER ('a', 'j', 'k', 'g'))
  ------------------
  |  |  122|  1.65k|	#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.65k]
  ------------------
 2903|      1|		return 0 /*-SF_FORMAT_SHN-*/ ;
 2904|       |
 2905|       |	/* This must be (almost) the last one. */
 2906|  1.65k|	if (psf->filelength > 0 && (format = try_resource_fork (psf)) != 0)
  ------------------
  |  Branch (2906:6): [True: 1.65k, False: 0]
  |  Branch (2906:29): [True: 0, False: 1.65k]
  ------------------
 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.65k|	if (psf->id3_header.len == 0 && (format = identify_mpeg (buffer [0])) != 0)
  ------------------
  |  Branch (2912:6): [True: 1.61k, False: 34]
  |  Branch (2912:34): [True: 8, False: 1.60k]
  ------------------
 2913|      8|		return format ;
 2914|       |
 2915|  1.64k|	return 0 ;
 2916|  1.65k|} /* guess_file_type */
sndfile.c:identify_mpeg:
 2772|  1.65k|{	if ((marker & MAKE_MARKER (0xFF, 0xE0, 0, 0)) == MAKE_MARKER (0xFF, 0xE0, 0, 0) && /* Frame sync */
  ------------------
  |  |  122|  1.65k|	#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.31k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
  |  Branch (2772:7): [True: 46, False: 1.61k]
  ------------------
 2773|     46|		(marker & MAKE_MARKER (0, 0x18, 0, 0)) != MAKE_MARKER (0, 0x08, 0, 0) && /* Valid MPEG version */
  ------------------
  |  |  122|     46|	#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.70k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
  |  Branch (2773:3): [True: 43, False: 3]
  ------------------
 2774|     43|		(marker & MAKE_MARKER (0, 0x06, 0, 0)) != MAKE_MARKER (0, 0, 0, 0) && /* Valid layer description */
  ------------------
  |  |  122|     43|	#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: 40, False: 3]
  ------------------
 2775|     40|		(marker & MAKE_MARKER (0, 0, 0xF0, 0)) != MAKE_MARKER (0, 0, 0xF0, 0) && /* Valid bitrate */
  ------------------
  |  |  122|     40|	#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.69k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
  |  Branch (2775:3): [True: 24, False: 16]
  ------------------
 2776|     24|		(marker & MAKE_MARKER (0, 0, 0x0C, 0)) != MAKE_MARKER (0, 0, 0x0C, 0)) /* Valid samplerate */
  ------------------
  |  |  122|     24|	#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|     24|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
  |  Branch (2776:3): [True: 14, False: 10]
  ------------------
 2777|     14|		return SF_FORMAT_MPEG ;
 2778|  1.64k|	return 0 ;
 2779|  1.65k|} /* identify_mpeg */
sndfile.c:try_resource_fork:
 2689|  1.65k|{	int old_error = psf->error ;
 2690|       |
 2691|       |	/* Set READ mode now, to see if resource fork exists. */
 2692|  1.65k|	psf->rsrc.mode = SFM_READ ;
 2693|  1.65k|	if (psf_open_rsrc (psf) != 0)
  ------------------
  |  Branch (2693:6): [True: 1.65k, False: 0]
  ------------------
 2694|  1.65k|	{	psf->error = old_error ;
 2695|  1.65k|		return 0 ;
 2696|  1.65k|		} ;
 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.65k|} /* try_resource_fork */
sndfile.c:format_from_extension:
 2706|  1.90k|{	char *cptr ;
 2707|  1.90k|	char buffer [16] ;
 2708|  1.90k|	int format = 0 ;
 2709|       |
 2710|  1.90k|	if ((cptr = strrchr (psf->file.name, '.')) == NULL)
  ------------------
  |  Branch (2710:6): [True: 1.90k, False: 0]
  ------------------
 2711|  1.90k|		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|  4.97k|{	if (sfinfo->samplerate < 1)
  ------------------
  |  Branch (2921:7): [True: 785, False: 4.19k]
  ------------------
 2922|    785|		return 0 ;
 2923|  4.19k|	if (sfinfo->frames < 0)
  ------------------
  |  Branch (2923:6): [True: 164, False: 4.02k]
  ------------------
 2924|    164|		return 0 ;
 2925|  4.02k|	if ((sfinfo->channels < 1) || (sfinfo->channels > SF_MAX_CHANNELS))
  ------------------
  |  |  102|  3.95k|#define		SF_MAX_CHANNELS		1024
  ------------------
  |  Branch (2925:6): [True: 68, False: 3.95k]
  |  Branch (2925:32): [True: 28, False: 3.93k]
  ------------------
 2926|     96|		return 0 ;
 2927|  3.93k|	if ((SF_CONTAINER (sfinfo->format)) == 0)
  ------------------
  |  |  108|  3.93k|#define SF_CONTAINER(x)		((x) & SF_FORMAT_TYPEMASK)
  ------------------
  |  Branch (2927:6): [True: 0, False: 3.93k]
  ------------------
 2928|      0|		return 0 ;
 2929|  3.93k|	if ((SF_CODEC (sfinfo->format)) == 0)
  ------------------
  |  |  109|  3.93k|#define SF_CODEC(x)			((x) & SF_FORMAT_SUBMASK)
  ------------------
  |  Branch (2929:6): [True: 18, False: 3.91k]
  ------------------
 2930|     18|		return 0 ;
 2931|  3.91k|	if (sfinfo->sections < 1)
  ------------------
  |  Branch (2931:6): [True: 0, False: 3.91k]
  ------------------
 2932|      0|		return 0 ;
 2933|  3.91k|	return 1 ;
 2934|  3.91k|} /* validate_sfinfo */
sndfile.c:save_header_info:
 2957|  1.87k|{	snprintf (sf_parselog, sizeof (sf_parselog), "%s", psf->parselog.buf) ;
 2958|  1.87k|} /* save_header_info */
sndfile.c:validate_psf:
 2938|  3.91k|{
 2939|  3.91k|	if (psf->datalength < 0)
  ------------------
  |  Branch (2939:6): [True: 252, False: 3.66k]
  ------------------
 2940|    252|	{	psf_log_printf (psf, "Invalid SF_PRIVATE field : datalength == %D.\n", psf->datalength) ;
 2941|    252|		return 0 ;
 2942|  3.66k|		} ;
 2943|  3.66k|	if (psf->dataoffset < 0)
  ------------------
  |  Branch (2943:6): [True: 511, False: 3.14k]
  ------------------
 2944|    511|	{	psf_log_printf (psf, "Invalid SF_PRIVATE field : dataoffset == %D.\n", psf->dataoffset) ;
 2945|    511|		return 0 ;
 2946|  3.14k|		} ;
 2947|  3.14k|	if (psf->blockwidth && psf->blockwidth != psf->sf.channels * psf->bytewidth)
  ------------------
  |  Branch (2947:6): [True: 907, False: 2.24k]
  |  Branch (2947:25): [True: 53, False: 854]
  ------------------
 2948|     53|	{	psf_log_printf (psf, "Invalid SF_PRIVATE field : channels * bytewidth == %d.\n",
 2949|     53|								psf->sf.channels * psf->bytewidth) ;
 2950|     53|		return 0 ;
 2951|  3.09k|		} ;
 2952|  3.09k|	return 1 ;
 2953|  3.14k|} /* validate_psf */

psf_store_string:
   32|   127k|{	char	new_str [128] ;
   33|   127k|	size_t	str_len ;
   34|   127k|	int		k, str_flags ;
   35|       |
   36|   127k|	if (str == NULL)
  ------------------
  |  Branch (36:6): [True: 0, False: 127k]
  ------------------
   37|      0|		return SFE_STR_BAD_STRING ;
   38|       |
   39|   127k|	str_len = strlen (str) ;
   40|       |
   41|       |	/* A few extra checks for write mode. */
   42|   127k|	if (psf->file.mode == SFM_WRITE || psf->file.mode == SFM_RDWR)
  ------------------
  |  Branch (42:6): [True: 0, False: 127k]
  |  Branch (42:37): [True: 0, False: 127k]
  ------------------
   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|   127k|		} ;
   51|       |
   52|       |	/* Find the next free slot in table. */
   53|  4.13M|	for (k = 0 ; k < SF_MAX_STRINGS ; k++)
  ------------------
  |  |   80|  4.13M|#define SF_MAX_STRINGS			(32)
  ------------------
  |  Branch (53:15): [True: 4.01M, False: 123k]
  ------------------
   54|  4.01M|	{	/* If we find a matching entry clear it. */
   55|  4.01M|		if (psf->strings.data [k].type == str_type)
  ------------------
  |  Branch (55:7): [True: 3.86k, False: 4.00M]
  ------------------
   56|  3.86k|			psf->strings.data [k].type = -1 ;
   57|       |
   58|  4.01M|		if (psf->strings.data [k].type == 0)
  ------------------
  |  Branch (58:7): [True: 4.40k, False: 4.00M]
  ------------------
   59|  4.40k|			break ;
   60|  4.01M|		} ;
   61|       |
   62|       |	/* Determine flags */
   63|   127k|	str_flags = SF_STR_LOCATE_START ;
   64|   127k|	if (psf->file.mode == SFM_RDWR || psf->have_written)
  ------------------
  |  Branch (64:6): [True: 0, False: 127k]
  |  Branch (64:36): [True: 0, False: 127k]
  ------------------
   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|   127k|		} ;
   69|       |
   70|       |	/* More sanity checking. */
   71|   127k|	if (k >= SF_MAX_STRINGS)
  ------------------
  |  |   80|   127k|#define SF_MAX_STRINGS			(32)
  ------------------
  |  Branch (71:6): [True: 123k, False: 4.40k]
  ------------------
   72|   123k|		return SFE_STR_MAX_COUNT ;
   73|       |
   74|  4.40k|	if (k == 0 && psf->strings.storage_used != 0)
  ------------------
  |  Branch (74:6): [True: 502, False: 3.90k]
  |  Branch (74:16): [True: 0, False: 502]
  ------------------
   75|      0|	{	psf_log_printf (psf, "SFE_STR_WEIRD : k == 0 && psf->strings.storage_used != 0\n") ;
   76|      0|		return SFE_STR_WEIRD ;
   77|  4.40k|		} ;
   78|       |
   79|  4.40k|	if (k != 0 && psf->strings.storage_used == 0)
  ------------------
  |  Branch (79:6): [True: 3.90k, False: 502]
  |  Branch (79:16): [True: 0, False: 3.90k]
  ------------------
   80|      0|	{	psf_log_printf (psf, "SFE_STR_WEIRD : k != 0 && psf->strings.storage_used == 0\n") ;
   81|      0|		return SFE_STR_WEIRD ;
   82|  4.40k|		} ;
   83|       |
   84|       |	/* Special case for the first string. */
   85|  4.40k|	if (k == 0)
  ------------------
  |  Branch (85:6): [True: 502, False: 3.90k]
  ------------------
   86|    502|		psf->strings.storage_used = 0 ;
   87|       |
   88|  4.40k|	switch (str_type)
   89|  4.40k|	{	case SF_STR_SOFTWARE :
  ------------------
  |  Branch (89:4): [True: 577, False: 3.83k]
  ------------------
   90|       |				/* In write mode, want to append libsndfile-version to string. */
   91|    577|				if (psf->file.mode == SFM_WRITE || psf->file.mode == SFM_RDWR)
  ------------------
  |  Branch (91:9): [True: 0, False: 577]
  |  Branch (91:40): [True: 0, False: 577]
  ------------------
   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|    577|				break ;
  108|       |
  109|    680|		case SF_STR_TITLE :
  ------------------
  |  Branch (109:3): [True: 680, False: 3.72k]
  ------------------
  110|  1.31k|		case SF_STR_COPYRIGHT :
  ------------------
  |  Branch (110:3): [True: 632, False: 3.77k]
  ------------------
  111|  1.84k|		case SF_STR_ARTIST :
  ------------------
  |  Branch (111:3): [True: 528, False: 3.88k]
  ------------------
  112|  2.45k|		case SF_STR_COMMENT :
  ------------------
  |  Branch (112:3): [True: 615, False: 3.79k]
  ------------------
  113|  2.76k|		case SF_STR_DATE :
  ------------------
  |  Branch (113:3): [True: 309, False: 4.09k]
  ------------------
  114|  3.03k|		case SF_STR_ALBUM :
  ------------------
  |  Branch (114:3): [True: 271, False: 4.13k]
  ------------------
  115|  3.14k|		case SF_STR_LICENSE :
  ------------------
  |  Branch (115:3): [True: 105, False: 4.30k]
  ------------------
  116|  3.39k|		case SF_STR_TRACKNUMBER :
  ------------------
  |  Branch (116:3): [True: 256, False: 4.15k]
  ------------------
  117|  3.83k|		case SF_STR_GENRE :
  ------------------
  |  Branch (117:3): [True: 435, False: 3.97k]
  ------------------
  118|  3.83k|				break ;
  119|       |
  120|      0|		default :
  ------------------
  |  Branch (120:3): [True: 0, False: 4.40k]
  ------------------
  121|      0|			psf_log_printf (psf, "%s : SFE_STR_BAD_TYPE\n", __func__) ;
  122|      0|			return SFE_STR_BAD_TYPE ;
  123|  4.40k|		} ;
  124|       |
  125|       |	/* Plus one to catch string terminator. */
  126|  4.40k|	str_len = strlen (str) + 1 ;
  127|       |
  128|  4.40k|	if (psf->strings.storage_used + str_len + 1 > psf->strings.storage_len)
  ------------------
  |  Branch (128:6): [True: 551, False: 3.85k]
  ------------------
  129|    551|	{	char * temp = psf->strings.storage ;
  130|    551|		size_t newlen = 2 * psf->strings.storage_len + str_len + 1 ;
  131|       |
  132|    551|		newlen = newlen < 256 ? 256 : newlen ;
  ------------------
  |  Branch (132:12): [True: 482, False: 69]
  ------------------
  133|       |
  134|    551|		char * new_storage = realloc(temp, newlen);
  135|    551|		if (new_storage == NULL)
  ------------------
  |  Branch (135:7): [True: 0, False: 551]
  ------------------
  136|      0|		{
  137|      0|			return SFE_MALLOC_FAILED ;
  138|    551|			} else {
  139|    551|			psf->strings.storage = new_storage;
  140|    551|			} ;
  141|       |
  142|    551|		psf->strings.storage_len = newlen ;
  143|  4.40k|		} ;
  144|       |
  145|  4.40k|	psf->strings.data [k].type = str_type ;
  146|  4.40k|	psf->strings.data [k].offset = psf->strings.storage_used ;
  147|  4.40k|	psf->strings.data [k].flags = str_flags ;
  148|       |
  149|  4.40k|	memcpy (psf->strings.storage + psf->strings.storage_used, str, str_len) ;
  150|  4.40k|	psf->strings.storage_used += str_len ;
  151|       |
  152|  4.40k|	psf->strings.flags |= str_flags ;
  153|       |
  154|       |#if STRINGS_DEBUG
  155|       |	printf ("storage_used         : %zd / %zd\n", psf->strings.storage_used, psf->strings.storage_len) ;
  156|       |	psf_hexdump (psf->strings.storage, psf->strings.storage_used) ;
  157|       |#endif
  158|       |
  159|  4.40k|	return 0 ;
  160|  4.40k|} /* psf_store_string */

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

voc_open:
  105|    253|{	int subformat, error = 0 ;
  106|       |
  107|    253|	if (psf->is_pipe)
  ------------------
  |  Branch (107:6): [True: 0, False: 253]
  ------------------
  108|      0|		return SFE_VOC_NO_PIPE ;
  109|       |
  110|    253|	if (psf->file.mode == SFM_READ || (psf->file.mode == SFM_RDWR && psf->filelength > 0))
  ------------------
  |  Branch (110:6): [True: 253, False: 0]
  |  Branch (110:37): [True: 0, False: 0]
  |  Branch (110:67): [True: 0, False: 0]
  ------------------
  111|    253|	{	if ((error = voc_read_header (psf)))
  ------------------
  |  Branch (111:8): [True: 177, False: 76]
  ------------------
  112|    177|			return error ;
  113|    253|		} ;
  114|       |
  115|     76|	subformat = SF_CODEC (psf->sf.format) ;
  ------------------
  |  |  109|     76|#define SF_CODEC(x)			((x) & SF_FORMAT_SUBMASK)
  ------------------
  116|       |
  117|     76|	if (psf->file.mode == SFM_WRITE || psf->file.mode == SFM_RDWR)
  ------------------
  |  Branch (117:6): [True: 0, False: 76]
  |  Branch (117:37): [True: 0, False: 76]
  ------------------
  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|     76|		} ;
  128|       |
  129|     76|	psf->blockwidth = (sf_count_t) psf->bytewidth * psf->sf.channels ;
  130|       |
  131|     76|	psf->container_close = voc_close ;
  132|       |
  133|     76|	switch (subformat)
  134|     76|	{	case SF_FORMAT_PCM_U8 :
  ------------------
  |  Branch (134:4): [True: 30, False: 46]
  ------------------
  135|     36|		case SF_FORMAT_PCM_16 :
  ------------------
  |  Branch (135:3): [True: 6, False: 70]
  ------------------
  136|     36|				error = pcm_init (psf) ;
  137|     36|				break ;
  138|       |
  139|      3|		case SF_FORMAT_ALAW :
  ------------------
  |  Branch (139:3): [True: 3, False: 73]
  ------------------
  140|      3|				error = alaw_init (psf) ;
  141|      3|				break ;
  142|       |
  143|      2|		case SF_FORMAT_ULAW :
  ------------------
  |  Branch (143:3): [True: 2, False: 74]
  ------------------
  144|      2|				error = ulaw_init (psf) ;
  145|      2|				break ;
  146|       |
  147|     35|		default : return SFE_UNIMPLEMENTED ;
  ------------------
  |  Branch (147:3): [True: 35, False: 41]
  ------------------
  148|     76|		} ;
  149|       |
  150|     41|	return error ;
  151|     76|} /* voc_open */
voc.c:voc_read_header:
  158|    253|{	VOC_DATA	*pvoc ;
  159|    253|	char	creative [20] ;
  160|    253|	unsigned char block_type, rate_byte ;
  161|    253|	short	version, checksum, encoding, dataoffset ;
  162|    253|	int		offset ;
  163|       |
  164|       |	/* Set position to start of file to begin reading header. */
  165|    253|	offset = psf_binheader_readf (psf, "pb", 0, creative, SIGNED_SIZEOF (creative)) ;
  ------------------
  |  |   91|    253|#define		SIGNED_SIZEOF(x)	((int) sizeof (x))
  ------------------
  166|       |
  167|    253|	if (creative [sizeof (creative) - 1] != 0x1A)
  ------------------
  |  Branch (167:6): [True: 2, False: 251]
  ------------------
  168|      2|		return SFE_VOC_NO_CREATIVE ;
  169|       |
  170|       |	/* Terminate the string. */
  171|    251|	creative [sizeof (creative) - 1] = 0 ;
  172|       |
  173|    251|	if (strcmp ("Creative Voice File", creative))
  ------------------
  |  Branch (173:6): [True: 66, False: 185]
  ------------------
  174|     66|		return SFE_VOC_NO_CREATIVE ;
  175|       |
  176|    185|	psf_log_printf (psf, "%s\n", creative) ;
  177|       |
  178|    185|	offset += psf_binheader_readf (psf, "e222", &dataoffset, &version, &checksum) ;
  179|       |
  180|    185|	psf->dataoffset = dataoffset ;
  181|       |
  182|    185|	psf_log_printf (psf, 	"dataoffset : %d\n"
  183|    185|							"version    : 0x%X\n"
  184|    185|							"checksum   : 0x%X\n", psf->dataoffset, version, checksum) ;
  185|       |
  186|    185|	if (version != 0x010A && version != 0x0114)
  ------------------
  |  Branch (186:6): [True: 162, False: 23]
  |  Branch (186:27): [True: 10, False: 152]
  ------------------
  187|     10|		return SFE_VOC_BAD_VERSION ;
  188|       |
  189|    175|	if (! (psf->codec_data = malloc (sizeof (VOC_DATA))))
  ------------------
  |  Branch (189:6): [True: 0, False: 175]
  ------------------
  190|      0|		return SFE_MALLOC_FAILED ;
  191|       |
  192|    175|	pvoc = (VOC_DATA*) psf->codec_data ;
  193|       |
  194|    175|	memset (pvoc, 0, sizeof (VOC_DATA)) ;
  195|       |
  196|       |	/* Set the default encoding now. */
  197|    175|	psf->sf.format = SF_FORMAT_VOC ; /* Major format */
  198|    175|	encoding = SF_FORMAT_PCM_U8 ; /* Minor format */
  199|    175|	psf->endian = SF_ENDIAN_LITTLE ;
  200|       |
  201|  2.23k|	while (1)
  ------------------
  |  Branch (201:9): [True: 2.23k, Folded]
  ------------------
  202|  2.23k|	{	char header [256] ;
  203|  2.23k|		unsigned size ;
  204|  2.23k|		short count ;
  205|       |
  206|  2.23k|		block_type = 0 ;
  207|  2.23k|		offset += psf_binheader_readf (psf, "1", &block_type) ;
  208|       |
  209|  2.23k|		switch (block_type)
  210|  2.23k|		{	case VOC_ASCII :
  ------------------
  |  Branch (210:5): [True: 1.84k, False: 393]
  ------------------
  211|  1.84k|					offset += psf_binheader_readf (psf, "e3", &size) ;
  212|       |
  213|  1.84k|					psf_log_printf (psf, " ASCII : %d\n", size) ;
  214|       |
  215|  1.84k|					if (size < sizeof (header) - 1)
  ------------------
  |  Branch (215:10): [True: 1.75k, False: 90]
  ------------------
  216|  1.75k|					{	offset += psf_binheader_readf (psf, "b", header, size) ;
  217|  1.75k|						header [size] = 0 ;
  218|  1.75k|						psf_log_printf (psf, "  text : %s\n", header) ;
  219|  1.75k|						continue ;
  220|  1.75k|						}
  221|       |
  222|     90|					offset += psf_binheader_readf (psf, "j", size) ;
  223|     90|					continue ;
  224|       |
  225|    218|			case VOC_REPEAT :
  ------------------
  |  Branch (225:4): [True: 218, False: 2.01k]
  ------------------
  226|    218|					offset += psf_binheader_readf (psf, "e32", &size, &count) ;
  227|    218|					psf_log_printf (psf, " Repeat : %d\n", count) ;
  228|    218|					continue ;
  229|       |
  230|     28|			case VOC_SOUND_DATA :
  ------------------
  |  Branch (230:4): [True: 28, False: 2.20k]
  ------------------
  231|     57|			case VOC_EXTENDED :
  ------------------
  |  Branch (231:4): [True: 29, False: 2.20k]
  ------------------
  232|    140|			case VOC_EXTENDED_II :
  ------------------
  |  Branch (232:4): [True: 83, False: 2.15k]
  ------------------
  233|    140|					break ;
  234|       |
  235|     35|			default : psf_log_printf (psf, "*** Weird block marker (%d)\n", block_type) ;
  ------------------
  |  Branch (235:4): [True: 35, False: 2.20k]
  ------------------
  236|  2.23k|			} ;
  237|       |
  238|    175|		break ;
  239|  2.23k|		} ;
  240|       |
  241|    175|	if (block_type == VOC_SOUND_DATA)
  ------------------
  |  Branch (241:6): [True: 28, False: 147]
  ------------------
  242|     28|	{	unsigned char compression ;
  243|     28|		int 	size ;
  244|       |
  245|     28|		offset += psf_binheader_readf (psf, "e311", &size, &rate_byte, &compression) ;
  246|       |
  247|     28|		psf->sf.samplerate = 1000000 / (256 - (rate_byte & 0xFF)) ;
  248|       |
  249|     28|		psf_log_printf (psf, " Sound Data : %d\n  sr   : %d => %dHz\n  comp : %d\n",
  250|     28|								size, rate_byte, psf->sf.samplerate, compression) ;
  251|       |
  252|     28|		if (offset + size - 1 > psf->filelength)
  ------------------
  |  Branch (252:7): [True: 2, False: 26]
  ------------------
  253|      2|		{	psf_log_printf (psf, "Seems to be a truncated file.\n") ;
  254|      2|			psf_log_printf (psf, "offset: %d    size: %d    sum: %d    filelength: %D\n", offset, size, offset + size, psf->filelength) ;
  255|      2|			return SFE_VOC_BAD_SECTIONS ;
  256|      2|			}
  257|     26|		else if (psf->filelength - offset - size > 4)
  ------------------
  |  Branch (257:12): [True: 18, False: 8]
  ------------------
  258|     18|		{	psf_log_printf (psf, "Seems to be a multi-segment file (#1).\n") ;
  259|     18|			psf_log_printf (psf, "offset: %d    size: %d    sum: %d    filelength: %D\n", offset, size, offset + size, psf->filelength) ;
  260|     18|			return SFE_VOC_BAD_SECTIONS ;
  261|     18|			} ;
  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|    147|		} ;
  273|       |
  274|    147|	if (block_type == VOC_EXTENDED)
  ------------------
  |  Branch (274:6): [True: 29, False: 118]
  ------------------
  275|     29|	{	unsigned char pack, stereo, compression ;
  276|     29|		unsigned short rate_short ;
  277|     29|		int		size ;
  278|       |
  279|     29|		offset += psf_binheader_readf (psf, "e3211", &size, &rate_short, &pack, &stereo) ;
  280|       |
  281|     29|		psf_log_printf (psf, " Extended : %d\n", size) ;
  282|     29|		if (size == 4)
  ------------------
  |  Branch (282:7): [True: 1, False: 28]
  ------------------
  283|      1|			psf_log_printf (psf, "  size   : 4\n") ;
  284|     28|		else
  285|     28|			psf_log_printf (psf, "  size   : %d (should be 4)\n", size) ;
  286|       |
  287|     29|		psf_log_printf (psf,	"  pack   : %d\n"
  288|     29|								"  stereo : %s\n", pack, (stereo ? "yes" : "no")) ;
  ------------------
  |  Branch (288:35): [True: 21, False: 8]
  ------------------
  289|       |
  290|     29|		if (stereo)
  ------------------
  |  Branch (290:7): [True: 21, False: 8]
  ------------------
  291|     21|		{	psf->sf.channels = 2 ;
  292|     21|			psf->sf.samplerate = 128000000 / (65536 - rate_short) ;
  293|     21|			}
  294|      8|		else
  295|      8|		{	psf->sf.channels = 1 ;
  296|      8|			psf->sf.samplerate = 256000000 / (65536 - rate_short) ;
  297|      8|			} ;
  298|       |
  299|     29|		psf_log_printf (psf, "  sr     : %d => %dHz\n", (rate_short & 0xFFFF), psf->sf.samplerate) ;
  300|       |
  301|     29|		offset += psf_binheader_readf (psf, "1", &block_type) ;
  302|       |
  303|     29|		if (block_type != VOC_SOUND_DATA)
  ------------------
  |  Branch (303:7): [True: 11, False: 18]
  ------------------
  304|     11|		{	psf_log_printf (psf, "*** Expecting VOC_SOUND_DATA section.\n") ;
  305|     11|			return SFE_VOC_BAD_FORMAT ;
  306|     18|			} ;
  307|       |
  308|     18|		offset += psf_binheader_readf (psf, "e311", &size, &rate_byte, &compression) ;
  309|       |
  310|     18|		psf_log_printf (psf,	" Sound Data : %d\n"
  311|     18|								"  sr     : %d\n"
  312|     18|								"  comp   : %d\n", size, rate_byte, compression) ;
  313|       |
  314|       |
  315|     18|		if (offset + size - 1 > psf->filelength)
  ------------------
  |  Branch (315:7): [True: 5, False: 13]
  ------------------
  316|      5|		{	psf_log_printf (psf, "Seems to be a truncated file.\n") ;
  317|      5|			psf_log_printf (psf, "offset: %d    size: %d    sum: %d    filelength: %D\n", offset, size, offset + size, psf->filelength) ;
  318|      5|			return SFE_VOC_BAD_SECTIONS ;
  319|      5|			}
  320|     13|		else if (offset + size - 1 < psf->filelength)
  ------------------
  |  Branch (320:12): [True: 12, False: 1]
  ------------------
  321|     12|		{	psf_log_printf (psf, "Seems to be a multi-segment file (#2).\n") ;
  322|     12|			psf_log_printf (psf, "offset: %d    size: %d    sum: %d    filelength: %D\n", offset, size, offset + size, psf->filelength) ;
  323|     12|			return SFE_VOC_BAD_SECTIONS ;
  324|     12|			} ;
  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|     18|		}
  335|       |
  336|    118|	if (block_type == VOC_EXTENDED_II)
  ------------------
  |  Branch (336:6): [True: 83, False: 35]
  ------------------
  337|     83|	{	unsigned char bitwidth, channels ;
  338|     83|		int size, fourbytes ;
  339|       |
  340|     83|		offset += psf_binheader_readf (psf, "e341124", &size, &psf->sf.samplerate,
  341|     83|								&bitwidth, &channels, &encoding, &fourbytes) ;
  342|       |
  343|     83|		if (size * 2 == psf->filelength - 39)
  ------------------
  |  Branch (343:7): [True: 1, False: 82]
  ------------------
  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|     82|		else
  350|     82|			psf_log_printf (psf, " Extended II : %d\n", size) ;
  351|       |
  352|     83|		psf_log_printf (psf,	"  sample rate : %d\n"
  353|     83|								"  bit width   : %d\n"
  354|     83|								"  channels    : %d\n", psf->sf.samplerate, bitwidth, channels) ;
  355|       |
  356|     83|		if (bitwidth == 16 && encoding == 0)
  ------------------
  |  Branch (356:7): [True: 18, False: 65]
  |  Branch (356:25): [True: 5, False: 13]
  ------------------
  357|      5|		{	encoding = 4 ;
  358|      5|			psf_log_printf (psf, "  encoding    : 0 (SoX bug: should be 4 for 16 bit signed PCM)\n") ;
  359|      5|			}
  360|     78|		else
  361|     78|			psf_log_printf (psf, "  encoding    : %d => %s\n", encoding, voc_encoding2str (encoding)) ;
  362|       |
  363|       |
  364|     83|		psf_log_printf (psf, "  fourbytes   : %X\n", fourbytes) ;
  365|       |
  366|     83|		psf->sf.channels = channels ;
  367|       |
  368|     83|		psf->dataoffset = offset ;
  369|     83|		psf->dataend	= psf->filelength - 1 ;
  370|       |
  371|     83|		if (size + 31 == psf->filelength + 1)
  ------------------
  |  Branch (371:7): [True: 2, False: 81]
  ------------------
  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|     81|		else if (size + 31 > psf->filelength)
  ------------------
  |  Branch (379:12): [True: 47, False: 34]
  ------------------
  380|     47|		{	psf_log_printf (psf, "Seems to be a truncated file.\n") ;
  381|     47|			size = psf->filelength - 31 ;
  382|     47|			}
  383|     34|		else if (size + 31 < psf->filelength)
  ------------------
  |  Branch (383:12): [True: 32, False: 2]
  ------------------
  384|     32|			psf_log_printf (psf, "Seems to be a multi-segment file (#3).\n") ;
  385|       |
  386|     83|		switch (encoding)
  387|     83|		{	case 0 :
  ------------------
  |  Branch (387:5): [True: 21, False: 62]
  ------------------
  388|     21|					psf->sf.format = SF_FORMAT_VOC | SF_FORMAT_PCM_U8 ;
  389|     21|					psf->bytewidth = 1 ;
  390|     21|					break ;
  391|       |
  392|      6|			case 4 :
  ------------------
  |  Branch (392:4): [True: 6, False: 77]
  ------------------
  393|      6|					psf->sf.format = SF_FORMAT_VOC | SF_FORMAT_PCM_16 ;
  394|      6|					psf->bytewidth = 2 ;
  395|      6|					break ;
  396|       |
  397|      3|			case 6 :
  ------------------
  |  Branch (397:4): [True: 3, False: 80]
  ------------------
  398|      3|					psf->sf.format = SF_FORMAT_VOC | SF_FORMAT_ALAW ;
  399|      3|					psf->bytewidth = 1 ;
  400|      3|					break ;
  401|       |
  402|      2|			case 7 :
  ------------------
  |  Branch (402:4): [True: 2, False: 81]
  ------------------
  403|      2|					psf->sf.format = SF_FORMAT_VOC | SF_FORMAT_ULAW ;
  404|      2|					psf->bytewidth = 1 ;
  405|      2|					break ;
  406|       |
  407|     51|			default : /* Unknown */
  ------------------
  |  Branch (407:4): [True: 51, False: 32]
  ------------------
  408|     51|					return SFE_VOC_BAD_FORMAT ;
  409|      0|					break ;
  410|     83|			} ;
  411|       |
  412|     67|		} ;
  413|       |
  414|     67|	return 0 ;
  415|    118|} /* voc_read_header */
voc.c:voc_encoding2str:
  552|     78|{
  553|     78|	switch (encoding)
  554|     78|	{	case 0 :	return "8 bit unsigned PCM" ;
  ------------------
  |  Branch (554:4): [True: 21, False: 57]
  ------------------
  555|      1|		case 4 :	return "16 bit signed PCM" ;
  ------------------
  |  Branch (555:3): [True: 1, False: 77]
  ------------------
  556|      3|		case 6 :	return "A-law" ;
  ------------------
  |  Branch (556:3): [True: 3, False: 75]
  ------------------
  557|      2|		case 7 :	return "u-law" ;
  ------------------
  |  Branch (557:3): [True: 2, False: 76]
  ------------------
  558|     51|		default :	break ;
  ------------------
  |  Branch (558:3): [True: 51, False: 27]
  ------------------
  559|     78|		}
  560|     51|	return "*** Unknown ***" ;
  561|     78|} /* voc_encoding2str */
voc.c:voc_close:
  531|     76|{
  532|     76|	if (psf->file.mode == SFM_WRITE || psf->file.mode == SFM_RDWR)
  ------------------
  |  Branch (532:6): [True: 0, False: 76]
  |  Branch (532:37): [True: 0, False: 76]
  ------------------
  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|     76|	return 0 ;
  548|     76|} /* voc_close */

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

wav_open:
  163|  4.36k|{	WAVLIKE_PRIVATE * wpriv ;
  164|  4.36k|	int	format, subformat, error, blockalign = 0, framesperblock = 0 ;
  165|       |
  166|  4.36k|	if ((wpriv = calloc (1, sizeof (WAVLIKE_PRIVATE))) == NULL)
  ------------------
  |  Branch (166:6): [True: 0, False: 4.36k]
  ------------------
  167|      0|		return SFE_MALLOC_FAILED ;
  168|  4.36k|	psf->container_data = wpriv ;
  169|       |
  170|  4.36k|	wpriv->wavex_ambisonic = SF_AMBISONIC_NONE ;
  171|  4.36k|	psf->strings.flags = SF_STR_ALLOW_START | SF_STR_ALLOW_END ;
  172|       |
  173|  4.36k|	if (psf->file.mode == SFM_READ || (psf->file.mode == SFM_RDWR && psf->filelength > 0))
  ------------------
  |  Branch (173:6): [True: 4.36k, False: 0]
  |  Branch (173:37): [True: 0, False: 0]
  |  Branch (173:67): [True: 0, False: 0]
  ------------------
  174|  4.36k|	{	if ((error = wav_read_header (psf, &blockalign, &framesperblock)))
  ------------------
  |  Branch (174:8): [True: 3.38k, False: 982]
  ------------------
  175|  3.38k|			return error ;
  176|       |
  177|    982|		psf->next_chunk_iterator = wav_next_chunk_iterator ;
  178|    982|		psf->get_chunk_size = wav_get_chunk_size ;
  179|    982|		psf->get_chunk_data = wav_get_chunk_data ;
  180|    982|		} ;
  181|       |
  182|    982|	subformat = SF_CODEC (psf->sf.format) ;
  ------------------
  |  |  109|    982|#define SF_CODEC(x)			((x) & SF_FORMAT_SUBMASK)
  ------------------
  183|       |
  184|    982|	if (psf->file.mode == SFM_WRITE || psf->file.mode == SFM_RDWR)
  ------------------
  |  Branch (184:6): [True: 0, False: 982]
  |  Branch (184:37): [True: 0, False: 982]
  ------------------
  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 ((sf_count_t) psf->sf.samplerate * psf->sf.channels) ;
  220|      0|			framesperblock = -1 ; /* Corrected later. */
  221|      0|			} ;
  222|       |
  223|       |		/* By default, add the peak chunk to floating point files. Default behaviour
  224|       |		** can be switched off using sf_command (SFC_SET_PEAK_CHUNK, SF_FALSE).
  225|       |		*/
  226|      0|		if (psf->file.mode == SFM_WRITE && (subformat == SF_FORMAT_FLOAT || subformat == SF_FORMAT_DOUBLE))
  ------------------
  |  Branch (226:7): [True: 0, False: 0]
  |  Branch (226:39): [True: 0, False: 0]
  |  Branch (226:71): [True: 0, False: 0]
  ------------------
  227|      0|		{	if ((psf->peak_info = peak_info_calloc (psf->sf.channels)) == NULL)
  ------------------
  |  Branch (227:9): [True: 0, False: 0]
  ------------------
  228|      0|				return SFE_MALLOC_FAILED ;
  229|      0|			psf->peak_info->peak_loc = SF_PEAK_START ;
  230|      0|			} ;
  231|       |
  232|      0|		psf->write_header	= wav_write_header ;
  233|      0|		psf->set_chunk		= wav_set_chunk ;
  234|    982|		} ;
  235|       |
  236|    982|	psf->container_close = wav_close ;
  237|    982|	psf->command = wav_command ;
  238|       |
  239|    982|	switch (subformat)
  240|    982|	{	case SF_FORMAT_PCM_U8 :
  ------------------
  |  Branch (240:4): [True: 10, False: 972]
  ------------------
  241|     11|		case SF_FORMAT_PCM_16 :
  ------------------
  |  Branch (241:3): [True: 1, False: 981]
  ------------------
  242|     32|		case SF_FORMAT_PCM_24 :
  ------------------
  |  Branch (242:3): [True: 21, False: 961]
  ------------------
  243|     34|		case SF_FORMAT_PCM_32 :
  ------------------
  |  Branch (243:3): [True: 2, False: 980]
  ------------------
  244|     34|					error = pcm_init (psf) ;
  245|     34|					break ;
  246|       |
  247|      5|		case SF_FORMAT_ULAW :
  ------------------
  |  Branch (247:3): [True: 5, False: 977]
  ------------------
  248|      5|					error = ulaw_init (psf) ;
  249|      5|					break ;
  250|       |
  251|      4|		case SF_FORMAT_ALAW :
  ------------------
  |  Branch (251:3): [True: 4, False: 978]
  ------------------
  252|      4|					error = alaw_init (psf) ;
  253|      4|					break ;
  254|       |
  255|       |		/* Lite remove start */
  256|     23|		case SF_FORMAT_FLOAT :
  ------------------
  |  Branch (256:3): [True: 23, False: 959]
  ------------------
  257|     23|					error = float32_init (psf) ;
  258|     23|					break ;
  259|       |
  260|      5|		case SF_FORMAT_DOUBLE :
  ------------------
  |  Branch (260:3): [True: 5, False: 977]
  ------------------
  261|      5|					error = double64_init (psf) ;
  262|      5|					break ;
  263|       |
  264|    169|		case SF_FORMAT_IMA_ADPCM :
  ------------------
  |  Branch (264:3): [True: 169, False: 813]
  ------------------
  265|    169|					error = wavlike_ima_init (psf, blockalign, framesperblock) ;
  266|    169|					break ;
  267|       |
  268|    186|		case SF_FORMAT_MS_ADPCM :
  ------------------
  |  Branch (268:3): [True: 186, False: 796]
  ------------------
  269|    186|					error = wavlike_msadpcm_init (psf, blockalign, framesperblock) ;
  270|    186|					break ;
  271|       |
  272|     17|		case SF_FORMAT_G721_32 :
  ------------------
  |  Branch (272:3): [True: 17, False: 965]
  ------------------
  273|     17|					error = g72x_init (psf) ;
  274|     17|					break ;
  275|       |
  276|    160|		case SF_FORMAT_NMS_ADPCM_16 :
  ------------------
  |  Branch (276:3): [True: 160, False: 822]
  ------------------
  277|    191|		case SF_FORMAT_NMS_ADPCM_24 :
  ------------------
  |  Branch (277:3): [True: 31, False: 951]
  ------------------
  278|    224|		case SF_FORMAT_NMS_ADPCM_32 :
  ------------------
  |  Branch (278:3): [True: 33, False: 949]
  ------------------
  279|    224|					error = nms_adpcm_init (psf) ;
  280|    224|					break ;
  281|       |
  282|       |		/* Lite remove end */
  283|       |
  284|    297|		case SF_FORMAT_GSM610 :
  ------------------
  |  Branch (284:3): [True: 297, False: 685]
  ------------------
  285|    297|					error = gsm610_init (psf) ;
  286|    297|					break ;
  287|       |
  288|      4|		case SF_FORMAT_MPEG_LAYER_III :
  ------------------
  |  Branch (288:3): [True: 4, False: 978]
  ------------------
  289|      4|					error = mpeg_init (psf, SF_BITRATE_MODE_CONSTANT, SF_FALSE) ;
  290|      4|					break ;
  291|       |
  292|     14|		default : 	return SFE_UNIMPLEMENTED ;
  ------------------
  |  Branch (292:3): [True: 14, False: 968]
  ------------------
  293|    982|		} ;
  294|       |
  295|    968|	if (psf->file.mode == SFM_WRITE || (psf->file.mode == SFM_RDWR && psf->filelength == 0))
  ------------------
  |  Branch (295:6): [True: 0, False: 968]
  |  Branch (295:38): [True: 0, False: 968]
  |  Branch (295:68): [True: 0, False: 0]
  ------------------
  296|      0|		return psf->write_header (psf, SF_FALSE) ;
  297|       |
  298|    968|	return error ;
  299|    968|} /* wav_open */
wav.c:wav_read_header:
  307|  4.36k|{	WAVLIKE_PRIVATE	*wpriv ;
  308|  4.36k|	WAV_FMT		*wav_fmt ;
  309|  4.36k|	FACT_CHUNK	fact_chunk ;
  310|  4.36k|	uint32_t	marker, chunk_size = 0, RIFFsize = 0, done = 0 ;
  311|  4.36k|	int			parsestage = 0, error, format = 0 ;
  312|       |
  313|  4.36k|	if (psf->is_pipe == 0 && psf->filelength > 0xFFFFFFFFLL)
  ------------------
  |  Branch (313:6): [True: 4.36k, False: 0]
  |  Branch (313:27): [True: 0, False: 4.36k]
  ------------------
  314|      0|		psf_log_printf (psf, "Warning : filelength > 0xffffffff. This is bad!!!!\n") ;
  315|       |
  316|  4.36k|	if ((wpriv = psf->container_data) == NULL)
  ------------------
  |  Branch (316:6): [True: 0, False: 4.36k]
  ------------------
  317|      0|		return SFE_INTERNAL ;
  318|  4.36k|	wav_fmt = &wpriv->wav_fmt ;
  319|       |
  320|       |	/* Set position to start of file to begin reading header. */
  321|  4.36k|	psf_binheader_readf (psf, "pmj", 0, &marker, -4) ;
  322|  4.36k|	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.36k|	psf->rwf_endian = (marker == RIFF_MARKER) ? SF_ENDIAN_LITTLE : SF_ENDIAN_BIG ;
  ------------------
  |  |   38|  4.36k|#define RIFF_MARKER		(MAKE_MARKER ('R', 'I', 'F', 'F'))
  |  |  ------------------
  |  |  |  |  122|  4.36k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (328:20): [True: 4.15k, False: 210]
  ------------------
  329|       |
  330|  21.1k|	while (! done)
  ------------------
  |  Branch (330:9): [True: 21.1k, False: 63]
  ------------------
  331|  21.1k|	{	size_t jump = chunk_size & 1 ;
  332|       |
  333|  21.1k|		marker = chunk_size = 0 ;
  334|  21.1k|		psf_binheader_readf (psf, "jm4", jump, &marker, &chunk_size) ;
  335|  21.1k|		if (marker == 0)
  ------------------
  |  Branch (335:7): [True: 14, False: 21.1k]
  ------------------
  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|  21.1k|			} ;
  340|       |
  341|  21.1k|		psf_store_read_chunk_u32 (&psf->rchunks, marker, psf_ftell (psf), chunk_size) ;
  342|       |
  343|  21.1k|		switch (marker)
  344|  21.1k|		{	case RIFF_MARKER :
  ------------------
  |  |   38|  4.15k|#define RIFF_MARKER		(MAKE_MARKER ('R', 'I', 'F', 'F'))
  |  |  ------------------
  |  |  |  |  122|  4.15k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (344:5): [True: 4.15k, False: 16.9k]
  ------------------
  345|  4.37k|			case RIFX_MARKER :
  ------------------
  |  |   39|  4.37k|#define RIFX_MARKER		(MAKE_MARKER ('R', 'I', 'F', 'X'))
  |  |  ------------------
  |  |  |  |  122|  4.37k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (345:4): [True: 211, False: 20.9k]
  ------------------
  346|  4.37k|					if (parsestage)
  ------------------
  |  Branch (346:10): [True: 2, False: 4.36k]
  ------------------
  347|      2|						return SFE_WAV_NO_RIFF ;
  348|       |
  349|  4.36k|					parsestage |= HAVE_RIFF ;
  350|       |
  351|  4.36k|					RIFFsize = chunk_size ;
  352|       |
  353|  4.36k|					if (psf->fileoffset > 0 && psf->filelength > RIFFsize + 8)
  ------------------
  |  Branch (353:10): [True: 155, False: 4.21k]
  |  Branch (353:33): [True: 133, False: 22]
  ------------------
  354|    133|					{	/* Set file length. */
  355|    133|						psf->filelength = RIFFsize + 8 ;
  356|    133|						if (marker == RIFF_MARKER)
  ------------------
  |  |   38|    133|#define RIFF_MARKER		(MAKE_MARKER ('R', 'I', 'F', 'F'))
  |  |  ------------------
  |  |  |  |  122|    133|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (356:11): [True: 130, False: 3]
  ------------------
  357|    130|							psf_log_printf (psf, "RIFF : %u\n", RIFFsize) ;
  358|      3|						else
  359|      3|							psf_log_printf (psf, "RIFX : %u\n", RIFFsize) ;
  360|    133|						}
  361|  4.23k|					else if (psf->filelength < RIFFsize + 2 * SIGNED_SIZEOF (marker))
  ------------------
  |  |   91|  4.23k|#define		SIGNED_SIZEOF(x)	((int) sizeof (x))
  ------------------
  |  Branch (361:15): [True: 4.06k, False: 173]
  ------------------
  362|  4.06k|					{	if (marker == RIFF_MARKER)
  ------------------
  |  |   38|  4.06k|#define RIFF_MARKER		(MAKE_MARKER ('R', 'I', 'F', 'F'))
  |  |  ------------------
  |  |  |  |  122|  4.06k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (362:12): [True: 3.87k, False: 191]
  ------------------
  363|  3.87k|							psf_log_printf (psf, "RIFF : %u (should be %D)\n", RIFFsize, psf->filelength - 2 * SIGNED_SIZEOF (marker)) ;
  ------------------
  |  |   91|  3.87k|#define		SIGNED_SIZEOF(x)	((int) sizeof (x))
  ------------------
  364|    191|						else
  365|    191|							psf_log_printf (psf, "RIFX : %u (should be %D)\n", RIFFsize, psf->filelength - 2 * SIGNED_SIZEOF (marker)) ;
  ------------------
  |  |   91|    191|#define		SIGNED_SIZEOF(x)	((int) sizeof (x))
  ------------------
  366|       |
  367|  4.06k|						RIFFsize = psf->filelength - 2 * SIGNED_SIZEOF (RIFFsize) ;
  ------------------
  |  |   91|  4.06k|#define		SIGNED_SIZEOF(x)	((int) sizeof (x))
  ------------------
  368|  4.06k|						}
  369|    173|					else
  370|    173|					{	if (marker == RIFF_MARKER)
  ------------------
  |  |   38|    173|#define RIFF_MARKER		(MAKE_MARKER ('R', 'I', 'F', 'F'))
  |  |  ------------------
  |  |  |  |  122|    173|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (370:12): [True: 157, False: 16]
  ------------------
  371|    157|							psf_log_printf (psf, "RIFF : %u\n", RIFFsize) ;
  372|     16|						else
  373|     16|							psf_log_printf (psf, "RIFX : %u\n", RIFFsize) ;
  374|    173|					} ;
  375|       |
  376|  4.36k|					psf_binheader_readf (psf, "m", &marker) ;
  377|  4.36k|					if (marker != WAVE_MARKER)
  ------------------
  |  |   40|  4.36k|#define WAVE_MARKER		(MAKE_MARKER ('W', 'A', 'V', 'E'))
  |  |  ------------------
  |  |  |  |  122|  4.36k|	#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.36k]
  ------------------
  378|      0|						return SFE_WAV_NO_WAVE ;
  379|  4.36k|					parsestage |= HAVE_WAVE ;
  380|  4.36k|					psf_log_printf (psf, "WAVE\n") ;
  381|  4.36k|					chunk_size = 0 ;
  382|  4.36k|					break ;
  383|       |
  384|  1.68k|			case fmt_MARKER :
  ------------------
  |  |   41|  1.68k|#define fmt_MARKER		(MAKE_MARKER ('f', 'm', 't', ' '))
  |  |  ------------------
  |  |  |  |  122|  1.68k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (384:4): [True: 1.68k, False: 19.4k]
  ------------------
  385|  1.68k|					if ((parsestage & (HAVE_RIFF | HAVE_WAVE)) != (HAVE_RIFF | HAVE_WAVE))
  ------------------
  |  Branch (385:10): [True: 0, False: 1.68k]
  ------------------
  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.68k|					if (parsestage & HAVE_fmt)
  ------------------
  |  Branch (389:10): [True: 71, False: 1.61k]
  ------------------
  390|     71|						break ;
  391|       |
  392|  1.61k|					parsestage |= HAVE_fmt ;
  393|       |
  394|  1.61k|					psf_log_printf (psf, "fmt  : %d\n", chunk_size) ;
  395|       |
  396|  1.61k|					if ((error = wavlike_read_fmt_chunk (psf, chunk_size)))
  ------------------
  |  Branch (396:10): [True: 299, False: 1.31k]
  ------------------
  397|    299|						return error ;
  398|       |
  399|  1.31k|					format = wav_fmt->format ;
  400|  1.31k|					break ;
  401|       |
  402|  1.49k|			case data_MARKER :
  ------------------
  |  |   32|  1.49k|#define data_MARKER		MAKE_MARKER ('d', 'a', 't', 'a')
  |  |  ------------------
  |  |  |  |  122|  1.49k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (402:4): [True: 1.49k, False: 19.6k]
  ------------------
  403|  1.49k|					if ((parsestage & (HAVE_RIFF | HAVE_WAVE | HAVE_fmt)) != (HAVE_RIFF | HAVE_WAVE | HAVE_fmt))
  ------------------
  |  Branch (403:10): [True: 1, False: 1.48k]
  ------------------
  404|      1|						return SFE_WAV_NO_DATA ;
  405|       |
  406|  1.48k|					if (psf->file.mode == SFM_RDWR && (parsestage & HAVE_other) != 0)
  ------------------
  |  Branch (406:10): [True: 0, False: 1.48k]
  |  Branch (406:40): [True: 0, False: 0]
  ------------------
  407|      0|						return SFE_RDWR_BAD_HEADER ;
  408|       |
  409|  1.48k|					parsestage |= HAVE_data ;
  410|       |
  411|  1.48k|					psf->datalength = chunk_size ;
  412|  1.48k|					if (psf->datalength & 1)
  ------------------
  |  Branch (412:10): [True: 810, False: 679]
  ------------------
  413|    810|						psf_log_printf (psf, "*** 'data' chunk should be an even number of bytes in length.\n") ;
  414|       |
  415|  1.48k|					psf->dataoffset = psf_ftell (psf) ;
  416|       |
  417|  1.48k|					if (psf->dataoffset > 0)
  ------------------
  |  Branch (417:10): [True: 1.48k, False: 0]
  ------------------
  418|  1.48k|					{	if (chunk_size == 0 && RIFFsize == 8 && psf->filelength > 44)
  ------------------
  |  Branch (418:12): [True: 280, False: 1.20k]
  |  Branch (418:31): [True: 13, False: 267]
  |  Branch (418:48): [True: 12, False: 1]
  ------------------
  419|     12|						{	psf_log_printf (psf, "*** Looks like a WAV file which wasn't closed properly. Fixing it.\n") ;
  420|     12|							psf->datalength = psf->filelength - psf->dataoffset ;
  421|     12|							} ;
  422|       |
  423|  1.48k|						if (psf->datalength > psf->filelength - psf->dataoffset)
  ------------------
  |  Branch (423:11): [True: 979, False: 510]
  ------------------
  424|    979|						{	psf_log_printf (psf, "data : %D (should be %D)\n", psf->datalength, psf->filelength - psf->dataoffset) ;
  425|    979|							psf->datalength = psf->filelength - psf->dataoffset ;
  426|    979|							}
  427|    510|						else
  428|    510|							psf_log_printf (psf, "data : %D\n", psf->datalength) ;
  429|       |
  430|       |						/* Only set dataend if there really is data at the end. */
  431|  1.48k|						if (psf->datalength + psf->dataoffset < psf->filelength)
  ------------------
  |  Branch (431:11): [True: 493, False: 996]
  ------------------
  432|    493|							psf->dataend = psf->datalength + psf->dataoffset ;
  433|       |
  434|  1.48k|						psf->datalength += chunk_size & 1 ;
  435|  1.48k|						chunk_size = 0 ;
  436|  1.48k|						} ;
  437|       |
  438|  1.48k|					if (! psf->sf.seekable || psf->dataoffset < 0)
  ------------------
  |  Branch (438:10): [True: 0, False: 1.48k]
  |  Branch (438:32): [True: 0, False: 1.48k]
  ------------------
  439|      0|						break ;
  440|       |
  441|       |					/* Seek past data and continue reading header. */
  442|  1.48k|					psf_fseek (psf, psf->datalength, SEEK_CUR) ;
  443|       |
  444|  1.48k|					if (psf_ftell (psf) != psf->datalength + psf->dataoffset)
  ------------------
  |  Branch (444:10): [True: 561, False: 928]
  ------------------
  445|    561|						psf_log_printf (psf, "*** psf_fseek past end error ***\n") ;
  446|  1.48k|					break ;
  447|       |
  448|  1.02k|			case fact_MARKER :
  ------------------
  |  |   42|  1.02k|#define fact_MARKER		(MAKE_MARKER ('f', 'a', 'c', 't'))
  |  |  ------------------
  |  |  |  |  122|  1.02k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (448:4): [True: 1.02k, False: 20.0k]
  ------------------
  449|  1.02k|					if ((parsestage & (HAVE_RIFF | HAVE_WAVE)) != (HAVE_RIFF | HAVE_WAVE))
  ------------------
  |  Branch (449:10): [True: 0, False: 1.02k]
  ------------------
  450|      0|						return SFE_WAV_BAD_FACT ;
  451|       |
  452|  1.02k|					parsestage |= HAVE_fact ;
  453|       |
  454|  1.02k|					if ((parsestage & HAVE_fmt) != HAVE_fmt)
  ------------------
  |  Branch (454:10): [True: 759, False: 263]
  ------------------
  455|    759|						psf_log_printf (psf, "*** Should have 'fmt ' chunk before 'fact'\n") ;
  456|       |
  457|  1.02k|					psf_binheader_readf (psf, "4", & (fact_chunk.frames)) ;
  458|       |
  459|  1.02k|					if (chunk_size > SIGNED_SIZEOF (fact_chunk))
  ------------------
  |  |   91|  1.02k|#define		SIGNED_SIZEOF(x)	((int) sizeof (x))
  ------------------
  |  Branch (459:10): [True: 245, False: 777]
  ------------------
  460|    245|						psf_binheader_readf (psf, "j", (int) (chunk_size - SIGNED_SIZEOF (fact_chunk))) ;
  ------------------
  |  |   91|    245|#define		SIGNED_SIZEOF(x)	((int) sizeof (x))
  ------------------
  461|       |
  462|  1.02k|					if (chunk_size)
  ------------------
  |  Branch (462:10): [True: 570, False: 452]
  ------------------
  463|    570|						psf_log_printf (psf, "%M : %u\n", marker, chunk_size) ;
  464|    452|					else
  465|    452|						psf_log_printf (psf, "%M : %u (should not be zero)\n", marker, chunk_size) ;
  466|       |
  467|  1.02k|					psf_log_printf (psf, "  frames  : %d\n", fact_chunk.frames) ;
  468|  1.02k|					break ;
  469|       |
  470|    119|			case PEAK_MARKER :
  ------------------
  |  |   40|    119|#define PEAK_MARKER		MAKE_MARKER ('P', 'E', 'A', 'K')
  |  |  ------------------
  |  |  |  |  122|    119|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (470:4): [True: 119, False: 20.9k]
  ------------------
  471|    119|					if ((parsestage & (HAVE_RIFF | HAVE_WAVE | HAVE_fmt)) != (HAVE_RIFF | HAVE_WAVE | HAVE_fmt))
  ------------------
  |  Branch (471:10): [True: 1, False: 118]
  ------------------
  472|      1|						return SFE_WAV_PEAK_B4_FMT ;
  473|       |
  474|    118|					parsestage |= HAVE_PEAK ;
  475|       |
  476|    118|					psf_log_printf (psf, "%M : %u\n", marker, chunk_size) ;
  477|    118|					if ((error = wavlike_read_peak_chunk (psf, chunk_size)) != 0)
  ------------------
  |  Branch (477:10): [True: 2, False: 116]
  ------------------
  478|      2|						return error ;
  479|    116|					psf->peak_info->peak_loc = ((parsestage & HAVE_data) == 0) ? SF_PEAK_START : SF_PEAK_END ;
  ------------------
  |  Branch (479:33): [True: 96, False: 20]
  ------------------
  480|    116|					break ;
  481|       |
  482|    939|			case cue_MARKER :
  ------------------
  |  |   44|    939|#define cue_MARKER		(MAKE_MARKER ('c', 'u', 'e', ' '))
  |  |  ------------------
  |  |  |  |  122|    939|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (482:4): [True: 939, False: 20.1k]
  ------------------
  483|    939|					parsestage |= HAVE_other ;
  484|       |
  485|    939|					{	uint32_t thisread, bytesread, cue_count, position, offset ;
  486|    939|						int id, chunk_id, chunk_start, block_start, cue_index ;
  487|       |
  488|    939|						bytesread = psf_binheader_readf (psf, "4", &cue_count) ;
  489|    939|						psf_log_printf (psf, "%M : %u\n", marker, chunk_size) ;
  490|       |
  491|    939|						if (cue_count > 2500) /* 2500 is close to the largest number of cues possible because of block sizes */
  ------------------
  |  Branch (491:11): [True: 264, False: 675]
  ------------------
  492|    264|						{	psf_log_printf (psf, "  Count : %u (skipping)\n", cue_count) ;
  493|    264|							psf_binheader_readf (psf, "j", chunk_size - bytesread) ;
  494|    264|							break ;
  495|    675|							} ;
  496|       |
  497|    675|						psf_log_printf (psf, "  Count : %d\n", cue_count) ;
  498|       |
  499|    675|						if (psf->cues)
  ------------------
  |  Branch (499:11): [True: 536, False: 139]
  ------------------
  500|    536|						{	free (psf->cues) ;
  501|    536|							psf->cues = NULL ;
  502|    536|							} ;
  503|       |
  504|    675|						if ((psf->cues = psf_cues_alloc (cue_count)) == NULL)
  ------------------
  |  Branch (504:11): [True: 0, False: 675]
  ------------------
  505|      0|							return SFE_MALLOC_FAILED ;
  506|       |
  507|    675|						cue_index = 0 ;
  508|       |
  509|  6.37k|						while (cue_count)
  ------------------
  |  Branch (509:14): [True: 5.74k, False: 628]
  ------------------
  510|  5.74k|						{
  511|  5.74k|							if ((thisread = psf_binheader_readf (psf, "e44m444", &id, &position, &chunk_id, &chunk_start, &block_start, &offset)) == 0)
  ------------------
  |  Branch (511:12): [True: 47, False: 5.69k]
  ------------------
  512|     47|								break ;
  513|  5.69k|							bytesread += thisread ;
  514|       |
  515|  5.69k|							if (cue_index < 10) /* avoid swamping log buffer with cues */
  ------------------
  |  Branch (515:12): [True: 2.92k, False: 2.77k]
  ------------------
  516|  2.92k|								psf_log_printf (psf,	"   Cue ID : %2d"
  517|  2.92k|											"  Pos : %5u  Chunk : %M"
  518|  2.92k|											"  Chk Start : %d  Blk Start : %d"
  519|  2.92k|											"  Offset : %5d\n",
  520|  2.92k|										id, position, chunk_id, chunk_start, block_start, offset) ;
  521|  2.77k|							else if (cue_index == 10)
  ------------------
  |  Branch (521:17): [True: 246, False: 2.52k]
  ------------------
  522|    246|								psf_log_printf (psf,	"   (Skipping)\n") ;
  523|       |
  524|  5.69k|							psf->cues->cue_points [cue_index].indx = id ;
  525|  5.69k|							psf->cues->cue_points [cue_index].position = position ;
  526|  5.69k|							psf->cues->cue_points [cue_index].fcc_chunk = chunk_id ;
  527|  5.69k|							psf->cues->cue_points [cue_index].chunk_start = chunk_start ;
  528|  5.69k|							psf->cues->cue_points [cue_index].block_start = block_start ;
  529|  5.69k|							psf->cues->cue_points [cue_index].sample_offset = offset ;
  530|  5.69k|							psf->cues->cue_points [cue_index].name [0] = '\0' ;
  531|  5.69k|							cue_count -- ;
  532|  5.69k|							cue_index ++ ;
  533|  5.69k|							} ;
  534|       |
  535|    675|						if (bytesread != chunk_size)
  ------------------
  |  Branch (535:11): [True: 428, False: 247]
  ------------------
  536|    428|						{	psf_log_printf (psf, "**** Chunk size weirdness (%d != %d)\n", chunk_size, bytesread) ;
  537|    428|							psf_binheader_readf (psf, "j", chunk_size - bytesread) ;
  538|    428|							} ;
  539|    675|						} ;
  540|    675|					break ;
  541|       |
  542|  1.03k|			case smpl_MARKER :
  ------------------
  |  |   48|  1.03k|#define smpl_MARKER		(MAKE_MARKER ('s', 'm', 'p', 'l'))
  |  |  ------------------
  |  |  |  |  122|  1.03k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (542:4): [True: 1.03k, False: 20.0k]
  ------------------
  543|  1.03k|					parsestage |= HAVE_other ;
  544|       |
  545|  1.03k|					psf_log_printf (psf, "smpl : %u\n", chunk_size) ;
  546|       |
  547|  1.03k|					if ((error = wav_read_smpl_chunk (psf, chunk_size)))
  ------------------
  |  Branch (547:10): [True: 0, False: 1.03k]
  ------------------
  548|      0|						return error ;
  549|  1.03k|					break ;
  550|       |
  551|  1.22k|			case acid_MARKER :
  ------------------
  |  |   52|  1.22k|#define acid_MARKER		(MAKE_MARKER ('a', 'c', 'i', 'd'))
  |  |  ------------------
  |  |  |  |  122|  1.22k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (551:4): [True: 1.22k, False: 19.8k]
  ------------------
  552|  1.22k|					parsestage |= HAVE_other ;
  553|       |
  554|  1.22k|					psf_log_printf (psf, "acid : %u\n", chunk_size) ;
  555|       |
  556|  1.22k|					if ((error = wav_read_acid_chunk (psf, chunk_size)))
  ------------------
  |  Branch (556:10): [True: 0, False: 1.22k]
  ------------------
  557|      0|						return error ;
  558|  1.22k|					break ;
  559|       |
  560|  1.28k|			case INFO_MARKER :
  ------------------
  |  |   37|  1.28k|#define INFO_MARKER		MAKE_MARKER ('I', 'N', 'F', 'O')
  |  |  ------------------
  |  |  |  |  122|  1.28k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (560:4): [True: 1.28k, False: 19.8k]
  ------------------
  561|  1.52k|			case LIST_MARKER :
  ------------------
  |  |   38|  1.52k|#define LIST_MARKER		MAKE_MARKER ('L', 'I', 'S', 'T')
  |  |  ------------------
  |  |  |  |  122|  1.52k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (561:4): [True: 240, False: 20.8k]
  ------------------
  562|  1.52k|					parsestage |= HAVE_other ;
  563|       |
  564|  1.52k|					if ((error = wavlike_subchunk_parse (psf, marker, chunk_size)) != 0)
  ------------------
  |  Branch (564:10): [True: 0, False: 1.52k]
  ------------------
  565|      0|						return error ;
  566|  1.52k|					break ;
  567|       |
  568|  1.52k|			case bext_MARKER :
  ------------------
  |  |   30|    119|#define bext_MARKER		MAKE_MARKER ('b', 'e', 'x', 't')
  |  |  ------------------
  |  |  |  |  122|    119|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (568:4): [True: 119, False: 20.9k]
  ------------------
  569|       |					/*
  570|       |					The 'bext' chunk can actually be updated, so don't need to set this.
  571|       |					parsestage |= HAVE_other ;
  572|       |					*/
  573|    119|					if ((error = wavlike_read_bext_chunk (psf, chunk_size)))
  ------------------
  |  Branch (573:10): [True: 0, False: 119]
  ------------------
  574|      0|						return error ;
  575|    119|					break ;
  576|       |
  577|    194|			case PAD_MARKER :
  ------------------
  |  |   39|    194|#define PAD_MARKER		MAKE_MARKER ('P', 'A', 'D', ' ')
  |  |  ------------------
  |  |  |  |  122|    194|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (577:4): [True: 194, False: 20.9k]
  ------------------
  578|       |					/*
  579|       |					We can eat into a 'PAD ' chunk if we need to.
  580|       |					parsestage |= HAVE_other ;
  581|       |					*/
  582|    194|					psf_log_printf (psf, "%M : %u\n", marker, chunk_size) ;
  583|    194|					psf_binheader_readf (psf, "j", chunk_size) ;
  584|    194|					break ;
  585|       |
  586|     90|			case cart_MARKER:
  ------------------
  |  |   31|     90|#define cart_MARKER		MAKE_MARKER ('c', 'a', 'r', 't')
  |  |  ------------------
  |  |  |  |  122|     90|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (586:4): [True: 90, False: 21.0k]
  ------------------
  587|     90|					if ((error = wavlike_read_cart_chunk (psf, chunk_size)))
  ------------------
  |  Branch (587:10): [True: 0, False: 90]
  ------------------
  588|      0|						return error ;
  589|     90|					break ;
  590|       |
  591|    135|			case iXML_MARKER : /* See http://en.wikipedia.org/wiki/IXML */
  ------------------
  |  |   49|    135|#define iXML_MARKER		(MAKE_MARKER ('i', 'X', 'M', 'L'))
  |  |  ------------------
  |  |  |  |  122|    135|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (591:4): [True: 135, False: 20.9k]
  ------------------
  592|    344|			case strc_MARKER : /* Multiple of 32 bytes. */
  ------------------
  |  |   53|    344|#define strc_MARKER		(MAKE_MARKER ('s', 't', 'r', 'c'))
  |  |  ------------------
  |  |  |  |  122|    344|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (592:4): [True: 209, False: 20.9k]
  ------------------
  593|    579|			case afsp_MARKER :
  ------------------
  |  |   54|    579|#define afsp_MARKER		(MAKE_MARKER ('a', 'f', 's', 'p'))
  |  |  ------------------
  |  |  |  |  122|    579|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (593:4): [True: 235, False: 20.8k]
  ------------------
  594|    645|			case clm_MARKER :
  ------------------
  |  |   55|    645|#define clm_MARKER		(MAKE_MARKER ('c', 'l', 'm', ' '))
  |  |  ------------------
  |  |  |  |  122|    645|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (594:4): [True: 66, False: 21.0k]
  ------------------
  595|    719|			case elmo_MARKER :
  ------------------
  |  |   56|    719|#define elmo_MARKER		(MAKE_MARKER ('e', 'l', 'm', 'o'))
  |  |  ------------------
  |  |  |  |  122|    719|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (595:4): [True: 74, False: 21.0k]
  ------------------
  596|    794|			case levl_MARKER :
  ------------------
  |  |   50|    794|#define levl_MARKER		(MAKE_MARKER ('l', 'e', 'v', 'l'))
  |  |  ------------------
  |  |  |  |  122|    794|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (596:4): [True: 75, False: 21.0k]
  ------------------
  597|    992|			case plst_MARKER :
  ------------------
  |  |   47|    992|#define plst_MARKER		(MAKE_MARKER ('p', 'l', 's', 't'))
  |  |  ------------------
  |  |  |  |  122|    992|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (597:4): [True: 198, False: 20.9k]
  ------------------
  598|  1.06k|			case minf_MARKER :
  ------------------
  |  |   59|  1.06k|#define minf_MARKER		(MAKE_MARKER ('m', 'i', 'n', 'f'))
  |  |  ------------------
  |  |  |  |  122|  1.06k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (598:4): [True: 77, False: 21.0k]
  ------------------
  599|  1.27k|			case elm1_MARKER :
  ------------------
  |  |   60|  1.27k|#define elm1_MARKER		(MAKE_MARKER ('e', 'l', 'm', '1'))
  |  |  ------------------
  |  |  |  |  122|  1.27k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (599:4): [True: 204, False: 20.9k]
  ------------------
  600|  1.50k|			case regn_MARKER :
  ------------------
  |  |   61|  1.50k|#define regn_MARKER		(MAKE_MARKER ('r', 'e', 'g', 'n'))
  |  |  ------------------
  |  |  |  |  122|  1.50k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (600:4): [True: 229, False: 20.8k]
  ------------------
  601|  1.60k|			case ovwf_MARKER :
  ------------------
  |  |   62|  1.60k|#define ovwf_MARKER		(MAKE_MARKER ('o', 'v', 'w', 'f'))
  |  |  ------------------
  |  |  |  |  122|  1.60k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (601:4): [True: 107, False: 21.0k]
  ------------------
  602|  1.85k|			case inst_MARKER :
  ------------------
  |  |   68|  1.85k|#define inst_MARKER		(MAKE_MARKER ('i', 'n', 's', 't'))
  |  |  ------------------
  |  |  |  |  122|  1.85k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (602:4): [True: 241, False: 20.8k]
  ------------------
  603|  2.07k|			case AFAn_MARKER :
  ------------------
  |  |   69|  2.07k|#define AFAn_MARKER		(MAKE_MARKER ('A', 'F', 'A', 'n'))
  |  |  ------------------
  |  |  |  |  122|  2.07k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (603:4): [True: 223, False: 20.8k]
  ------------------
  604|  2.27k|			case umid_MARKER :
  ------------------
  |  |   63|  2.27k|#define umid_MARKER		(MAKE_MARKER ('u', 'm', 'i', 'd'))
  |  |  ------------------
  |  |  |  |  122|  2.27k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (604:4): [True: 204, False: 20.9k]
  ------------------
  605|  2.54k|			case SyLp_MARKER :
  ------------------
  |  |   64|  2.54k|#define SyLp_MARKER		(MAKE_MARKER ('S', 'y', 'L', 'p'))
  |  |  ------------------
  |  |  |  |  122|  2.54k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (605:4): [True: 271, False: 20.8k]
  ------------------
  606|  2.76k|			case Cr8r_MARKER :
  ------------------
  |  |   65|  2.76k|#define Cr8r_MARKER		(MAKE_MARKER ('C', 'r', '8', 'r'))
  |  |  ------------------
  |  |  |  |  122|  2.76k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (606:4): [True: 218, False: 20.8k]
  ------------------
  607|  2.84k|			case JUNK_MARKER :
  ------------------
  |  |   66|  2.84k|#define JUNK_MARKER		(MAKE_MARKER ('J', 'U', 'N', 'K'))
  |  |  ------------------
  |  |  |  |  122|  2.84k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (607:4): [True: 83, False: 21.0k]
  ------------------
  608|  2.93k|			case PMX_MARKER :
  ------------------
  |  |   67|  2.93k|#define PMX_MARKER		(MAKE_MARKER ('_', 'P', 'M', 'X'))
  |  |  ------------------
  |  |  |  |  122|  2.93k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (608:4): [True: 86, False: 21.0k]
  ------------------
  609|  3.13k|			case DISP_MARKER :
  ------------------
  |  |   36|  3.13k|#define DISP_MARKER		MAKE_MARKER ('D', 'I', 'S', 'P')
  |  |  ------------------
  |  |  |  |  122|  3.13k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (609:4): [True: 196, False: 20.9k]
  ------------------
  610|  3.41k|			case MEXT_MARKER :
  ------------------
  |  |   51|  3.41k|#define MEXT_MARKER		(MAKE_MARKER ('M', 'E', 'X', 'T'))
  |  |  ------------------
  |  |  |  |  122|  3.41k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (610:4): [True: 286, False: 20.8k]
  ------------------
  611|  3.63k|			case FLLR_MARKER :
  ------------------
  |  |   57|  3.63k|#define FLLR_MARKER		(MAKE_MARKER ('F', 'L', 'L', 'R'))
  |  |  ------------------
  |  |  |  |  122|  3.63k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (611:4): [True: 222, False: 20.8k]
  ------------------
  612|  3.63k|					psf_log_printf (psf, "%M : %u\n", marker, chunk_size) ;
  613|  3.63k|					psf_binheader_readf (psf, "j", chunk_size) ;
  614|  3.63k|					break ;
  615|       |
  616|  3.66k|			default :
  ------------------
  |  Branch (616:4): [True: 3.66k, False: 17.4k]
  ------------------
  617|  3.66k|					if (chunk_size >= 0xffff0000)
  ------------------
  |  Branch (617:10): [True: 34, False: 3.62k]
  ------------------
  618|     34|					{	done = SF_TRUE ;
  619|     34|						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|     34|						break ;
  621|  3.62k|						} ;
  622|       |
  623|  3.62k|					if ((marker & TAG__MARKER_MASK) == TAG__MARKER &&
  ------------------
  |  |   78|  3.62k|#define TAG__MARKER_MASK (MAKE_MARKER (0xff, 0xff, 0xff, 0))
  |  |  ------------------
  |  |  |  |  122|  3.62k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
              					if ((marker & TAG__MARKER_MASK) == TAG__MARKER &&
  ------------------
  |  |   77|  7.25k|#define TAG__MARKER (MAKE_MARKER ('T', 'A', 'G', 0))
  |  |  ------------------
  |  |  |  |  122|  3.62k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (623:10): [True: 216, False: 3.41k]
  ------------------
  624|    216|						psf_ftell (psf) - 8 + 128 == psf->filelength)
  ------------------
  |  Branch (624:7): [True: 1, False: 215]
  ------------------
  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.62k|						} ;
  631|       |
  632|  3.62k|					if (psf_isprint ((marker >> 24) & 0xFF) && psf_isprint ((marker >> 16) & 0xFF)
  ------------------
  |  Branch (632:10): [True: 2.99k, False: 637]
  |  Branch (632:49): [True: 2.57k, False: 419]
  ------------------
  633|  2.57k|						&& psf_isprint ((marker >> 8) & 0xFF) && psf_isprint (marker & 0xFF))
  ------------------
  |  Branch (633:10): [True: 2.08k, False: 484]
  |  Branch (633:48): [True: 1.37k, False: 710]
  ------------------
  634|  1.37k|					{	psf_log_printf (psf, "*** %M : %u (unknown marker)\n", marker, chunk_size) ;
  635|  1.37k|						psf_binheader_readf (psf, "j", chunk_size) ;
  636|  1.37k|						break ;
  637|  2.25k|						} ;
  638|  2.25k|					if (psf_ftell (psf) & 0x03)
  ------------------
  |  Branch (638:10): [True: 1.94k, False: 307]
  ------------------
  639|  1.94k|					{	psf_log_printf (psf, "  Unknown chunk marker at position %D. Resynching.\n", psf_ftell (psf) - 8) ;
  640|  1.94k|						psf_binheader_readf (psf, "j", -3) ;
  641|       |						/* File is too messed up so we prevent editing in RDWR mode here. */
  642|  1.94k|						parsestage |= HAVE_other ;
  643|  1.94k|						break ;
  644|  1.94k|						} ;
  645|    307|					psf_log_printf (psf, "*** Unknown chunk marker (%X) at position %D. Exiting parser.\n", marker, psf_ftell (psf) - 8) ;
  646|    307|					done = SF_TRUE ;
  647|    307|					break ;
  648|  21.1k|			} ;	/* switch (marker) */
  649|       |
  650|  20.8k|		if (chunk_size >= psf->filelength)
  ------------------
  |  Branch (650:7): [True: 2.57k, False: 18.2k]
  ------------------
  651|  2.57k|		{	psf_log_printf (psf, "*** Chunk size %u > file length %D. Exiting parser.\n", chunk_size, psf->filelength) ;
  652|  2.57k|			break ;
  653|  18.2k|			} ;
  654|       |
  655|  18.2k|		if (! psf->sf.seekable && (parsestage & HAVE_data))
  ------------------
  |  Branch (655:7): [True: 0, False: 18.2k]
  |  Branch (655:29): [True: 0, False: 0]
  ------------------
  656|      0|			break ;
  657|       |
  658|  18.2k|		if (psf_ftell (psf) >= psf->filelength - SIGNED_SIZEOF (chunk_size))
  ------------------
  |  |   91|  18.2k|#define		SIGNED_SIZEOF(x)	((int) sizeof (x))
  ------------------
  |  Branch (658:7): [True: 1.41k, False: 16.8k]
  ------------------
  659|  1.41k|		{	psf_log_printf (psf, "End\n") ;
  660|  1.41k|			break ;
  661|  16.8k|			} ;
  662|  16.8k|		} ; /* while (1) */
  663|       |
  664|  4.06k|	if (psf->dataoffset <= 0)
  ------------------
  |  Branch (664:6): [True: 3.04k, False: 1.02k]
  ------------------
  665|  3.04k|		return SFE_WAV_NO_DATA ;
  666|       |
  667|  1.02k|	if (psf->sf.channels < 1)
  ------------------
  |  Branch (667:6): [True: 6, False: 1.01k]
  ------------------
  668|      6|		return SFE_CHANNEL_COUNT_ZERO ;
  669|       |
  670|  1.01k|	if (psf->sf.channels > SF_MAX_CHANNELS)
  ------------------
  |  |  102|  1.01k|#define		SF_MAX_CHANNELS		1024
  ------------------
  |  Branch (670:6): [True: 31, False: 985]
  ------------------
  671|     31|		return SFE_CHANNEL_COUNT ;
  672|       |
  673|    985|	if (format != WAVE_FORMAT_PCM && (parsestage & HAVE_fact) == 0)
  ------------------
  |  Branch (673:6): [True: 934, False: 51]
  |  Branch (673:35): [True: 930, False: 4]
  ------------------
  674|    930|		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|    985|	psf->endian = psf->rwf_endian ;
  678|       |
  679|    985|	psf_fseek (psf, psf->dataoffset, SEEK_SET) ;
  680|       |
  681|    985|	if (psf->is_pipe == 0)
  ------------------
  |  Branch (681:6): [True: 985, False: 0]
  ------------------
  682|    985|	{	/*
  683|       |		** Check for 'wvpk' at the start of the DATA section. Not able to
  684|       |		** handle this.
  685|       |		*/
  686|    985|		psf_binheader_readf (psf, "4", &marker) ;
  687|    985|		if (marker == wvpk_MARKER || marker == OggS_MARKER)
  ------------------
  |  |   73|  1.97k|#define wvpk_MARKER (MAKE_MARKER ('w', 'v', 'p', 'k'))
  |  |  ------------------
  |  |  |  |  122|    985|	#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|    984|#define OggS_MARKER (MAKE_MARKER ('O', 'g', 'g', 'S'))
  |  |  ------------------
  |  |  |  |  122|    984|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (687:7): [True: 1, False: 984]
  |  Branch (687:32): [True: 1, False: 983]
  ------------------
  688|      2|			return SFE_WAV_WVPK_DATA ;
  689|    985|		} ;
  690|       |
  691|       |	/* Seek to start of DATA section. */
  692|    983|	psf_fseek (psf, psf->dataoffset, SEEK_SET) ;
  693|       |
  694|    983|	if (psf->blockwidth)
  ------------------
  |  Branch (694:6): [True: 73, False: 910]
  ------------------
  695|     73|	{	if (psf->filelength - psf->dataoffset < psf->datalength)
  ------------------
  |  Branch (695:8): [True: 24, False: 49]
  ------------------
  696|     24|			psf->sf.frames = (psf->filelength - psf->dataoffset) / psf->blockwidth ;
  697|     49|		else
  698|     49|			psf->sf.frames = psf->datalength / psf->blockwidth ;
  699|     73|		} ;
  700|       |
  701|    983|	switch (format)
  702|    983|	{	case WAVE_FORMAT_EXTENSIBLE :
  ------------------
  |  Branch (702:4): [True: 4, False: 979]
  ------------------
  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|    225|		case WAVE_FORMAT_NMS_VBXADPCM :
  ------------------
  |  Branch (709:3): [True: 225, False: 758]
  ------------------
  710|    225|			switch (wav_fmt->min.bitwidth)
  711|    225|			{	case 2 :
  ------------------
  |  Branch (711:6): [True: 160, False: 65]
  ------------------
  712|    160|					psf->sf.format = SF_FORMAT_WAV | SF_FORMAT_NMS_ADPCM_16 ;
  713|    160|					break ;
  714|     31|				case 3 :
  ------------------
  |  Branch (714:5): [True: 31, False: 194]
  ------------------
  715|     31|					psf->sf.format = SF_FORMAT_WAV | SF_FORMAT_NMS_ADPCM_24 ;
  716|     31|					break ;
  717|     33|				case 4 :
  ------------------
  |  Branch (717:5): [True: 33, False: 192]
  ------------------
  718|     33|					psf->sf.format = SF_FORMAT_WAV | SF_FORMAT_NMS_ADPCM_32 ;
  719|     33|					break ;
  720|       |
  721|      1|				default :
  ------------------
  |  Branch (721:5): [True: 1, False: 224]
  ------------------
  722|      1|					return SFE_UNIMPLEMENTED ;
  723|    225|				}
  724|    224|				break ;
  725|       |
  726|    224|		case WAVE_FORMAT_PCM :
  ------------------
  |  Branch (726:3): [True: 49, False: 934]
  ------------------
  727|     49|					psf->sf.format = SF_FORMAT_WAV | u_bitwidth_to_subformat (psf->bytewidth * 8) ;
  728|     49|					break ;
  729|       |
  730|      5|		case WAVE_FORMAT_MULAW :
  ------------------
  |  Branch (730:3): [True: 5, False: 978]
  ------------------
  731|      5|		case IBM_FORMAT_MULAW :
  ------------------
  |  Branch (731:3): [True: 0, False: 983]
  ------------------
  732|      5|					psf->sf.format = (SF_FORMAT_WAV | SF_FORMAT_ULAW) ;
  733|      5|					break ;
  734|       |
  735|      4|		case WAVE_FORMAT_ALAW :
  ------------------
  |  Branch (735:3): [True: 4, False: 979]
  ------------------
  736|      4|		case IBM_FORMAT_ALAW :
  ------------------
  |  Branch (736:3): [True: 0, False: 983]
  ------------------
  737|      4|					psf->sf.format = (SF_FORMAT_WAV | SF_FORMAT_ALAW) ;
  738|      4|					break ;
  739|       |
  740|    184|		case WAVE_FORMAT_MS_ADPCM :
  ------------------
  |  Branch (740:3): [True: 184, False: 799]
  ------------------
  741|    184|					psf->sf.format = (SF_FORMAT_WAV | SF_FORMAT_MS_ADPCM) ;
  742|    184|					*blockalign = wav_fmt->msadpcm.blockalign ;
  743|    184|					*framesperblock = wav_fmt->msadpcm.samplesperblock ;
  744|    184|					break ;
  745|       |
  746|    169|		case WAVE_FORMAT_IMA_ADPCM :
  ------------------
  |  Branch (746:3): [True: 169, False: 814]
  ------------------
  747|    169|					psf->sf.format = (SF_FORMAT_WAV | SF_FORMAT_IMA_ADPCM) ;
  748|    169|					*blockalign = wav_fmt->ima.blockalign ;
  749|    169|					*framesperblock = wav_fmt->ima.samplesperblock ;
  750|    169|					break ;
  751|       |
  752|    297|		case WAVE_FORMAT_GSM610 :
  ------------------
  |  Branch (752:3): [True: 297, False: 686]
  ------------------
  753|    297|					psf->sf.format = (SF_FORMAT_WAV | SF_FORMAT_GSM610) ;
  754|    297|					break ;
  755|       |
  756|     25|		case WAVE_FORMAT_IEEE_FLOAT :
  ------------------
  |  Branch (756:3): [True: 25, False: 958]
  ------------------
  757|     25|					psf->sf.format = SF_FORMAT_WAV ;
  758|     25|					psf->sf.format |= (psf->bytewidth == 8) ? SF_FORMAT_DOUBLE : SF_FORMAT_FLOAT ;
  ------------------
  |  Branch (758:24): [True: 5, False: 20]
  ------------------
  759|     25|					break ;
  760|       |
  761|     17|		case WAVE_FORMAT_G721_ADPCM :
  ------------------
  |  Branch (761:3): [True: 17, False: 966]
  ------------------
  762|     17|					psf->sf.format = SF_FORMAT_WAV | SF_FORMAT_G721_32 ;
  763|     17|					break ;
  764|       |
  765|      4|		case WAVE_FORMAT_MPEGLAYER3 :
  ------------------
  |  Branch (765:3): [True: 4, False: 979]
  ------------------
  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: 983]
  ------------------
  772|    983|		} ;
  773|       |
  774|    982|	if (wpriv->fmt_is_broken)
  ------------------
  |  Branch (774:6): [True: 19, False: 963]
  ------------------
  775|     19|		wavlike_analyze (psf) ;
  776|       |
  777|       |	/* Only set the format endian-ness if its non-standard big-endian. */
  778|    982|	if (psf->endian == SF_ENDIAN_BIG)
  ------------------
  |  Branch (778:6): [True: 0, False: 982]
  ------------------
  779|      0|		psf->sf.format |= SF_ENDIAN_BIG ;
  780|       |
  781|    982|	return 0 ;
  782|    983|} /* wav_read_header */
wav.c:wav_read_smpl_chunk:
 1377|  1.03k|{	char buffer [512] ;
 1378|  1.03k|	uint32_t thisread, bytesread = 0, dword, sampler_data, loop_count, actually_loop_count = 0 ;
 1379|  1.03k|	uint32_t note, pitch, start, end, type = -1, count ;
 1380|  1.03k|	int j, k ;
 1381|       |
 1382|  1.03k|	chunklen += (chunklen & 1) ;
 1383|       |
 1384|  1.03k|	bytesread += psf_binheader_readf (psf, "4", &dword) ;
 1385|  1.03k|	psf_log_printf (psf, "  Manufacturer : %X\n", dword) ;
 1386|       |
 1387|  1.03k|	bytesread += psf_binheader_readf (psf, "4", &dword) ;
 1388|  1.03k|	psf_log_printf (psf, "  Product      : %u\n", dword) ;
 1389|       |
 1390|  1.03k|	bytesread += psf_binheader_readf (psf, "4", &dword) ;
 1391|  1.03k|	psf_log_printf (psf, "  Period       : %u nsec\n", dword) ;
 1392|       |
 1393|  1.03k|	bytesread += psf_binheader_readf (psf, "4", &note) ;
 1394|  1.03k|	psf_log_printf (psf, "  Midi Note    : %u\n", note) ;
 1395|       |
 1396|  1.03k|	bytesread += psf_binheader_readf (psf, "4", &pitch) ;
 1397|  1.03k|	if (pitch != 0)
  ------------------
  |  Branch (1397:6): [True: 666, False: 367]
  ------------------
 1398|    666|	{	snprintf (buffer, sizeof (buffer), "%f",
 1399|    666|					(1.0 * 0x80000000) / ((uint32_t) pitch)) ;
 1400|    666|		psf_log_printf (psf, "  Pitch Fract. : %s\n", buffer) ;
 1401|    666|		}
 1402|    367|	else
 1403|    367|		psf_log_printf (psf, "  Pitch Fract. : 0\n") ;
 1404|       |
 1405|  1.03k|	bytesread += psf_binheader_readf (psf, "4", &dword) ;
 1406|  1.03k|	psf_log_printf (psf, "  SMPTE Format : %u\n", dword) ;
 1407|       |
 1408|  1.03k|	bytesread += psf_binheader_readf (psf, "4", &dword) ;
 1409|  1.03k|	snprintf (buffer, sizeof (buffer), "%02"PRIu32 ":%02"PRIu32 ":%02"PRIu32
 1410|  1.03k|				" %02"PRIu32 "", (dword >> 24) & 0x7F, (dword >> 16) & 0x7F,
 1411|  1.03k|				(dword >> 8) & 0x7F, dword & 0x7F) ;
 1412|  1.03k|	psf_log_printf (psf, "  SMPTE Offset : %s\n", buffer) ;
 1413|       |
 1414|  1.03k|	bytesread += psf_binheader_readf (psf, "4", &loop_count) ;
 1415|  1.03k|	psf_log_printf (psf, "  Loop Count   : %u\n", loop_count) ;
 1416|       |
 1417|  1.03k|	if (loop_count == 0 && chunklen == bytesread)
  ------------------
  |  Branch (1417:6): [True: 442, False: 591]
  |  Branch (1417:25): [True: 116, False: 326]
  ------------------
 1418|    116|		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|    917|	bytesread += psf_binheader_readf (psf, "4", &sampler_data) ;
 1424|       |
 1425|    917|	if (psf->instrument)
  ------------------
  |  Branch (1425:6): [True: 635, False: 282]
  ------------------
 1426|    635|	{	psf_log_printf (psf, "  Found more than one SMPL chunk, using last one.\n") ;
 1427|    635|		free (psf->instrument) ;
 1428|    635|		psf->instrument = NULL ;
 1429|    635|		} ;
 1430|    917|	if ((psf->instrument = psf_instrument_alloc ()) == NULL)
  ------------------
  |  Branch (1430:6): [True: 0, False: 917]
  ------------------
 1431|      0|		return SFE_MALLOC_FAILED ;
 1432|       |
 1433|    917|	psf->instrument->loop_count = loop_count ;
 1434|       |
 1435|  2.37k|	for (j = 0 ; loop_count > 0 && chunklen - bytesread >= 24 ; j ++)
  ------------------
  |  Branch (1435:15): [True: 2.04k, False: 326]
  |  Branch (1435:33): [True: 1.56k, False: 478]
  ------------------
 1436|  1.56k|	{	if ((thisread = psf_binheader_readf (psf, "4", &dword)) == 0)
  ------------------
  |  Branch (1436:8): [True: 113, False: 1.45k]
  ------------------
 1437|    113|			break ;
 1438|  1.45k|		bytesread += thisread ;
 1439|  1.45k|		psf_log_printf (psf, "    Cue ID : %2u", dword) ;
 1440|       |
 1441|  1.45k|		bytesread += psf_binheader_readf (psf, "4", &type) ;
 1442|  1.45k|		psf_log_printf (psf, "  Type : %2u", type) ;
 1443|       |
 1444|  1.45k|		bytesread += psf_binheader_readf (psf, "4", &start) ;
 1445|  1.45k|		psf_log_printf (psf, "  Start : %5u", start) ;
 1446|       |
 1447|  1.45k|		bytesread += psf_binheader_readf (psf, "4", &end) ;
 1448|  1.45k|		psf_log_printf (psf, "  End : %5u", end) ;
 1449|       |
 1450|  1.45k|		bytesread += psf_binheader_readf (psf, "4", &dword) ;
 1451|  1.45k|		psf_log_printf (psf, "  Fraction : %5u", dword) ;
 1452|       |
 1453|  1.45k|		bytesread += psf_binheader_readf (psf, "4", &count) ;
 1454|  1.45k|		psf_log_printf (psf, "  Count : %5u\n", count) ;
 1455|       |
 1456|  1.45k|		if (j < ARRAY_LEN (psf->instrument->loops))
  ------------------
  |  |   93|  1.45k|#define		ARRAY_LEN(x)	((int) (sizeof (x) / sizeof ((x) [0])))
  ------------------
  |  Branch (1456:7): [True: 941, False: 515]
  ------------------
 1457|    941|		{	psf->instrument->loops [j].start = start ;
 1458|    941|			psf->instrument->loops [j].end = end + 1 ;
 1459|    941|			psf->instrument->loops [j].count = count ;
 1460|       |
 1461|    941|			switch (type)
 1462|    941|			{	case 0 :
  ------------------
  |  Branch (1462:6): [True: 298, False: 643]
  ------------------
 1463|    298|					psf->instrument->loops [j].mode = SF_LOOP_FORWARD ;
 1464|    298|					break ;
 1465|     28|				case 1 :
  ------------------
  |  Branch (1465:5): [True: 28, False: 913]
  ------------------
 1466|     28|					psf->instrument->loops [j].mode = SF_LOOP_ALTERNATING ;
 1467|     28|					break ;
 1468|     13|				case 2 :
  ------------------
  |  Branch (1468:5): [True: 13, False: 928]
  ------------------
 1469|     13|					psf->instrument->loops [j].mode = SF_LOOP_BACKWARD ;
 1470|     13|					break ;
 1471|    602|				default:
  ------------------
  |  Branch (1471:5): [True: 602, False: 339]
  ------------------
 1472|    602|					psf->instrument->loops [j].mode = SF_LOOP_NONE ;
 1473|    602|					break ;
 1474|    941|				} ;
 1475|  1.45k|			} ;
 1476|  1.45k|		actually_loop_count ++ ;
 1477|  1.45k|		} ;
 1478|       |
 1479|    917|	if (actually_loop_count > ARRAY_LEN (psf->instrument->loops))
  ------------------
  |  |   93|    917|#define		ARRAY_LEN(x)	((int) (sizeof (x) / sizeof ((x) [0])))
  ------------------
  |  Branch (1479:6): [True: 47, False: 870]
  ------------------
 1480|     47|	{
 1481|     47|		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|     47|#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|     47|#define		ARRAY_LEN(x)	((int) (sizeof (x) / sizeof ((x) [0])))
  ------------------
 1482|     47|		psf->instrument->loop_count = ARRAY_LEN (psf->instrument->loops) ;
  ------------------
  |  |   93|     47|#define		ARRAY_LEN(x)	((int) (sizeof (x) / sizeof ((x) [0])))
  ------------------
 1483|     47|		}
 1484|    870|	else if (loop_count != actually_loop_count)
  ------------------
  |  Branch (1484:11): [True: 544, False: 326]
  ------------------
 1485|    544|	{	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|    544|		psf->instrument->loop_count = actually_loop_count ;
 1487|    544|		} ;
 1488|       |
 1489|    917|	if (chunklen - bytesread == 0)
  ------------------
  |  Branch (1489:6): [True: 396, False: 521]
  ------------------
 1490|    396|	{	if (sampler_data != 0)
  ------------------
  |  Branch (1490:8): [True: 246, False: 150]
  ------------------
 1491|    246|			psf_log_printf (psf, "  Sampler Data : %u (should be 0)\n", sampler_data) ;
 1492|    150|		else
 1493|    150|			psf_log_printf (psf, "  Sampler Data : %u\n", sampler_data) ;
 1494|    396|		}
 1495|    521|	else
 1496|    521|	{	if (sampler_data != chunklen - bytesread)
  ------------------
  |  Branch (1496:8): [True: 426, False: 95]
  ------------------
 1497|    426|		{	psf_log_printf (psf, "  Sampler Data : %u (should have been %u)\n", sampler_data, chunklen - bytesread) ;
 1498|    426|			sampler_data = chunklen - bytesread ;
 1499|    426|			}
 1500|     95|		else
 1501|     95|			psf_log_printf (psf, "  Sampler Data : %u\n", sampler_data) ;
 1502|       |
 1503|    521|		psf_log_printf (psf, "      ") ;
 1504|  5.97k|		for (k = 0 ; k < (int) sampler_data ; k++)
  ------------------
  |  Branch (1504:16): [True: 5.60k, False: 375]
  ------------------
 1505|  5.60k|		{	char ch ;
 1506|       |
 1507|  5.60k|			if (k > 0 && (k % 20) == 0)
  ------------------
  |  Branch (1507:8): [True: 5.31k, False: 291]
  |  Branch (1507:17): [True: 223, False: 5.08k]
  ------------------
 1508|    223|				psf_log_printf (psf, "\n      ") ;
 1509|       |
 1510|  5.60k|			if ((thisread = psf_binheader_readf (psf, "1", &ch)) == 0)
  ------------------
  |  Branch (1510:8): [True: 146, False: 5.45k]
  ------------------
 1511|    146|				break ;
 1512|  5.45k|			bytesread += thisread ;
 1513|  5.45k|			psf_log_printf (psf, "%02X ", ch & 0xFF) ;
 1514|  5.45k|			} ;
 1515|       |
 1516|    521|		psf_log_printf (psf, "\n") ;
 1517|    521|		} ;
 1518|       |
 1519|    917|	psf->instrument->basenote = note ;
 1520|    917|	psf->instrument->detune = (int8_t) (pitch / (0x40000000 / 25.0) + 0.5) ;
 1521|    917|	psf->instrument->gain = 1 ;
 1522|    917|	psf->instrument->velocity_lo = psf->instrument->key_lo = 0 ;
 1523|    917|	psf->instrument->velocity_hi = psf->instrument->key_hi = 127 ;
 1524|       |
 1525|    917|	return 0 ;
 1526|    917|} /* wav_read_smpl_chunk */
wav.c:wav_read_acid_chunk:
 1561|  1.22k|{	char buffer [512] ;
 1562|  1.22k|	uint32_t bytesread = 0 ;
 1563|  1.22k|	int	beats, flags ;
 1564|  1.22k|	short rootnote, q1, meter_denom, meter_numer ;
 1565|  1.22k|	float q2, tempo ;
 1566|       |
 1567|  1.22k|	chunklen += (chunklen & 1) ;
 1568|       |
 1569|  1.22k|	bytesread += psf_binheader_readf (psf, "422f", &flags, &rootnote, &q1, &q2) ;
 1570|       |
 1571|  1.22k|	snprintf (buffer, sizeof (buffer), "%f", q2) ;
 1572|       |
 1573|  1.22k|	psf_log_printf (psf, "  Flags     : 0x%04x (%s,%s,%s,%s,%s)\n", flags,
 1574|  1.22k|			(flags & 0x01) ? "OneShot" : "Loop",
  ------------------
  |  Branch (1574:4): [True: 943, False: 283]
  ------------------
 1575|  1.22k|			(flags & 0x02) ? "RootNoteValid" : "RootNoteInvalid",
  ------------------
  |  Branch (1575:4): [True: 356, False: 870]
  ------------------
 1576|  1.22k|			(flags & 0x04) ? "StretchOn" : "StretchOff",
  ------------------
  |  Branch (1576:4): [True: 324, False: 902]
  ------------------
 1577|  1.22k|			(flags & 0x08) ? "DiskBased" : "RAMBased",
  ------------------
  |  Branch (1577:4): [True: 65, False: 1.16k]
  ------------------
 1578|  1.22k|			(flags & 0x10) ? "??On" : "??Off") ;
  ------------------
  |  Branch (1578:4): [True: 70, False: 1.15k]
  ------------------
 1579|       |
 1580|  1.22k|	psf_log_printf (psf, "  Root note : 0x%x\n  ????      : 0x%04x\n  ????      : %s\n",
 1581|  1.22k|				rootnote, q1, buffer) ;
 1582|       |
 1583|  1.22k|	bytesread += psf_binheader_readf (psf, "422f", &beats, &meter_denom, &meter_numer, &tempo) ;
 1584|  1.22k|	snprintf (buffer, sizeof (buffer), "%f", tempo) ;
 1585|  1.22k|	psf_log_printf (psf, "  Beats     : %d\n  Meter     : %d/%d\n  Tempo     : %s\n",
 1586|  1.22k|				beats, meter_numer, meter_denom, buffer) ;
 1587|       |
 1588|  1.22k|	psf_binheader_readf (psf, "j", chunklen - bytesread) ;
 1589|       |
 1590|  1.22k|	if (psf->loop_info)
  ------------------
  |  Branch (1590:6): [True: 1.15k, False: 71]
  ------------------
 1591|  1.15k|	{	psf_log_printf (psf, "  Found existing loop info, using last one.\n") ;
 1592|  1.15k|		free (psf->loop_info) ;
 1593|  1.15k|		psf->loop_info = NULL ;
 1594|  1.15k|		} ;
 1595|  1.22k|	if ((psf->loop_info = calloc (1, sizeof (SF_LOOP_INFO))) == NULL)
  ------------------
  |  Branch (1595:6): [True: 0, False: 1.22k]
  ------------------
 1596|      0|		return SFE_MALLOC_FAILED ;
 1597|       |
 1598|  1.22k|	psf->loop_info->time_sig_num	= meter_numer ;
 1599|  1.22k|	psf->loop_info->time_sig_den	= meter_denom ;
 1600|  1.22k|	psf->loop_info->loop_mode		= (flags & 0x01) ? SF_LOOP_NONE : SF_LOOP_FORWARD ;
  ------------------
  |  Branch (1600:31): [True: 943, False: 283]
  ------------------
 1601|  1.22k|	psf->loop_info->num_beats		= beats ;
 1602|  1.22k|	psf->loop_info->bpm				= tempo ;
 1603|  1.22k|	psf->loop_info->root_key		= (flags & 0x02) ? rootnote : -1 ;
  ------------------
  |  Branch (1603:30): [True: 356, False: 870]
  ------------------
 1604|       |
 1605|  1.22k|	return 0 ;
 1606|  1.22k|} /* wav_read_acid_chunk */
wav.c:wav_close:
 1318|    982|{
 1319|    982|	if (psf->file.mode == SFM_WRITE || psf->file.mode == SFM_RDWR)
  ------------------
  |  Branch (1319:6): [True: 0, False: 982]
  |  Branch (1319:37): [True: 0, False: 982]
  ------------------
 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|    982|	return 0 ;
 1340|    982|} /* wav_close */

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

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

