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

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

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

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

alac_decoder_init:
   61|  1.05k|{
   62|  1.05k|	int32_t		status = ALAC_noErr ;
   63|  1.05k|	ALACSpecificConfig theConfig ;
   64|  1.05k|	uint8_t * theActualCookie = (uint8_t *) inMagicCookie ;
   65|  1.05k|	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.05k|	if (theActualCookie [4] == 'f' && theActualCookie [5] == 'r' && theActualCookie [6] == 'm' && theActualCookie [7] == 'a')
  ------------------
  |  Branch (74:6): [True: 7, False: 1.04k]
  |  Branch (74:36): [True: 3, False: 4]
  |  Branch (74:66): [True: 2, False: 1]
  |  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.05k|	if (theActualCookie [4] == 'a' && theActualCookie [5] == 'l' && theActualCookie [6] == 'a' && theActualCookie [7] == 'c')
  ------------------
  |  Branch (81:6): [True: 11, False: 1.04k]
  |  Branch (81:36): [True: 9, False: 2]
  |  Branch (81:66): [True: 5, False: 4]
  |  Branch (81:96): [True: 3, False: 2]
  ------------------
   82|      3|	{
   83|      3|		theActualCookie += 12 ;
   84|      3|		theCookieBytesRemaining -= 12 ;
   85|      3|	}
   86|       |
   87|       |	// read the ALACSpecificConfig
   88|  1.05k|	if (theCookieBytesRemaining >= sizeof (ALACSpecificConfig))
  ------------------
  |  Branch (88:6): [True: 947, False: 104]
  ------------------
   89|    947|	{
   90|    947|		theConfig.frameLength = psf_get_be32 (theActualCookie, offsetof (ALACSpecificConfig, frameLength)) ;
   91|       |
   92|    947|		if (theConfig.frameLength > ALAC_FRAME_LENGTH)
  ------------------
  |  |   33|    947|#define		ALAC_FRAME_LENGTH	4096
  ------------------
  |  Branch (92:7): [True: 17, False: 930]
  ------------------
   93|     17|			return fALAC_FrameLengthError ;
   94|       |
   95|    930|		theConfig.compatibleVersion = theActualCookie [offsetof (ALACSpecificConfig, compatibleVersion)] ;
   96|    930|		theConfig.bitDepth = theActualCookie [offsetof (ALACSpecificConfig, bitDepth)] ;
   97|    930|		theConfig.pb = theActualCookie [offsetof (ALACSpecificConfig, pb)] ;
   98|    930|		theConfig.mb = theActualCookie [offsetof (ALACSpecificConfig, mb)] ;
   99|    930|		theConfig.kb = theActualCookie [offsetof (ALACSpecificConfig, kb)] ;
  100|    930|		theConfig.numChannels = theActualCookie [offsetof (ALACSpecificConfig, numChannels)] ;
  101|    930|		theConfig.maxRun = psf_get_be16 (theActualCookie, offsetof (ALACSpecificConfig, maxRun)) ;
  102|    930|		theConfig.maxFrameBytes = psf_get_be32 (theActualCookie, offsetof (ALACSpecificConfig, maxFrameBytes)) ;
  103|    930|		theConfig.avgBitRate = psf_get_be32 (theActualCookie, offsetof (ALACSpecificConfig, avgBitRate)) ;
  104|    930|		theConfig.sampleRate = psf_get_be32 (theActualCookie, offsetof (ALACSpecificConfig, sampleRate)) ;
  105|       |
  106|    930|		p->mConfig = theConfig ;
  107|    930|		p->mNumChannels = theConfig.numChannels ;
  108|       |
  109|    930|		RequireAction (p->mConfig.compatibleVersion <= kALACVersion, return kALAC_IncompatibleVersion ;) ;
  ------------------
  |  |   39|    930|#define RequireAction(condition, action)		if (! (condition)) { action }
  |  |  ------------------
  |  |  |  Branch (39:47): [True: 3, False: 927]
  |  |  ------------------
  ------------------
  110|    927|		RequireAction ((p->mConfig.bitDepth >= 8 && p->mConfig.bitDepth <= 32), return kALAC_BadBitWidth ;) ;
  ------------------
  |  |   39|  1.84k|#define RequireAction(condition, action)		if (! (condition)) { action }
  |  |  ------------------
  |  |  |  Branch (39:50): [True: 921, False: 6]
  |  |  |  Branch (39:50): [True: 919, False: 2]
  |  |  ------------------
  ------------------
  111|    919|		RequireAction ((p->mMixBufferU != NULL) && (p->mMixBufferV != NULL) && (p->u.mPredictor != NULL),
  ------------------
  |  |   39|  3.67k|#define RequireAction(condition, action)		if (! (condition)) { action }
  |  |  ------------------
  |  |  |  Branch (39:50): [True: 919, False: 0]
  |  |  |  Branch (39:50): [True: 919, False: 0]
  |  |  |  Branch (39:50): [True: 919, False: 0]
  |  |  ------------------
  ------------------
  112|    919|						status = kALAC_MemFullError ; goto Exit ;) ;
  113|    919|	}
  114|    104|	else
  115|    104|	{
  116|    104|		status = kALAC_BadSpecificConfigSize ;
  117|    104|	}
  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|  1.02k|Exit:
  126|  1.02k|	return status ;
  127|  1.05k|}
alac_decode:
  136|  29.7k|{
  137|  29.7k|	BitBuffer		shiftBits ;
  138|  29.7k|	uint32_t		bits1, bits2 ;
  139|  29.7k|	uint8_t			tag ;
  140|  29.7k|	uint8_t			elementInstanceTag ;
  141|  29.7k|	AGParamRec		agParams ;
  142|  29.7k|	uint32_t		channelIndex ;
  143|  29.7k|	int16_t			coefsU [32] ;		// max possible size is 32 although NUMCOEPAIRS is the current limit
  144|  29.7k|	int16_t			coefsV [32] ;
  145|  29.7k|	uint8_t			numU, numV ;
  146|  29.7k|	uint8_t			mixBits ;
  147|  29.7k|	int8_t			mixRes ;
  148|  29.7k|	uint16_t		unusedHeader ;
  149|  29.7k|	uint8_t			escapeFlag ;
  150|  29.7k|	uint32_t		chanBits ;
  151|  29.7k|	uint8_t			bytesShifted ;
  152|  29.7k|	uint32_t		shift ;
  153|  29.7k|	uint8_t			modeU, modeV ;
  154|  29.7k|	uint32_t		denShiftU, denShiftV ;
  155|  29.7k|	uint16_t		pbFactorU, pbFactorV ;
  156|  29.7k|	uint16_t		pb ;
  157|  29.7k|	int32_t *		out32 ;
  158|  29.7k|	uint8_t			headerByte ;
  159|  29.7k|	uint8_t			partialFrame ;
  160|  29.7k|	uint32_t		extraBits ;
  161|  29.7k|	int32_t			val ;
  162|  29.7k|	uint32_t		i, j ;
  163|  29.7k|	int32_t			status ;
  164|  29.7k|	uint32_t		numChannels = p->mNumChannels ;
  165|       |
  166|  29.7k|	RequireAction ((bits != NULL) && (sampleBuffer != NULL) && (outNumSamples != NULL), return kALAC_ParamError ;) ;
  ------------------
  |  |   39|   119k|#define RequireAction(condition, action)		if (! (condition)) { action }
  |  |  ------------------
  |  |  |  Branch (39:50): [True: 29.7k, False: 0]
  |  |  |  Branch (39:50): [True: 29.7k, False: 0]
  |  |  |  Branch (39:50): [True: 29.7k, False: 0]
  |  |  ------------------
  ------------------
  167|  29.7k|	RequireAction (p->mNumChannels > 0, return kALAC_ZeroChannelCount ;) ;
  ------------------
  |  |   39|  29.7k|#define RequireAction(condition, action)		if (! (condition)) { action }
  |  |  ------------------
  |  |  |  Branch (39:47): [True: 2, False: 29.7k]
  |  |  ------------------
  ------------------
  168|       |
  169|  29.7k|	p->mActiveElements = 0 ;
  170|  29.7k|	channelIndex	= 0 ;
  171|       |
  172|  29.7k|	status = ALAC_noErr ;
  173|  29.7k|	*outNumSamples = numSamples ;
  174|       |
  175|  57.5k|	while (status == ALAC_noErr)
  ------------------
  |  Branch (175:9): [True: 54.4k, False: 3.15k]
  ------------------
  176|  54.4k|	{
  177|       |		// bail if we ran off the end of the buffer
  178|  54.4k|		RequireAction (bits->cur < bits->end, status = kALAC_ParamError ; goto Exit ;) ;
  ------------------
  |  |   39|  54.4k|#define RequireAction(condition, action)		if (! (condition)) { action }
  |  |  ------------------
  |  |  |  Branch (39:47): [True: 4.64k, False: 49.7k]
  |  |  ------------------
  ------------------
  179|       |
  180|       |		// copy global decode params for this element
  181|  49.7k|		pb = p->mConfig.pb ;
  182|       |
  183|       |		// read element tag
  184|  49.7k|		tag = BitBufferReadSmall (bits, 3) ;
  185|  49.7k|		switch (tag)
  ------------------
  |  Branch (185:11): [True: 49.7k, False: 0]
  ------------------
  186|  49.7k|		{
  187|  30.1k|			case ID_SCE:
  ------------------
  |  Branch (187:4): [True: 30.1k, False: 19.5k]
  ------------------
  188|  32.0k|			case ID_LFE:
  ------------------
  |  Branch (188:4): [True: 1.83k, False: 47.9k]
  ------------------
  189|  32.0k|			{
  190|       |				// mono/LFE channel
  191|  32.0k|				elementInstanceTag = BitBufferReadSmall (bits, 4) ;
  192|  32.0k|				p->mActiveElements |= (1u << elementInstanceTag) ;
  193|       |
  194|       |				// read the 12 unused header bits
  195|  32.0k|				unusedHeader = (uint16_t) BitBufferRead (bits, 12) ;
  196|  32.0k|				RequireAction (unusedHeader == 0, status = kALAC_ParamError ; goto Exit ;) ;
  ------------------
  |  |   39|  32.0k|#define RequireAction(condition, action)		if (! (condition)) { action }
  |  |  ------------------
  |  |  |  Branch (39:47): [True: 10.4k, False: 21.5k]
  |  |  ------------------
  ------------------
  197|       |
  198|       |				// read the 1-bit "partial frame" flag, 2-bit "shift-off" flag & 1-bit "escape" flag
  199|  21.5k|				headerByte = (uint8_t) BitBufferRead (bits, 4) ;
  200|       |
  201|  21.5k|				partialFrame = headerByte >> 3 ;
  202|       |
  203|  21.5k|				bytesShifted = (headerByte >> 1) & 0x3u ;
  204|  21.5k|				RequireAction (bytesShifted != 3, status = kALAC_ParamError ; goto Exit ;) ;
  ------------------
  |  |   39|  21.5k|#define RequireAction(condition, action)		if (! (condition)) { action }
  |  |  ------------------
  |  |  |  Branch (39:47): [True: 229, False: 21.3k]
  |  |  ------------------
  ------------------
  205|       |
  206|  21.3k|				shift = bytesShifted * 8 ;
  207|       |
  208|  21.3k|				escapeFlag = headerByte & 0x1 ;
  209|       |
  210|  21.3k|				chanBits = p->mConfig.bitDepth - (bytesShifted * 8) ;
  211|       |
  212|       |				// check for partial frame to override requested numSamples
  213|  21.3k|				if (partialFrame != 0)
  ------------------
  |  Branch (213:9): [True: 2.94k, False: 18.4k]
  ------------------
  214|  2.94k|				{
  215|  2.94k|					numSamples = BitBufferRead (bits, 16) << 16 ;
  216|  2.94k|					numSamples |= BitBufferRead (bits, 16) ;
  217|       |
  218|  2.94k|					RequireAction (numSamples < kALACDefaultFramesPerPacket, return kALAC_NumSamplesTooBig ;) ;
  ------------------
  |  |   39|  2.94k|#define RequireAction(condition, action)		if (! (condition)) { action }
  |  |  ------------------
  |  |  |  Branch (39:47): [True: 640, False: 2.30k]
  |  |  ------------------
  ------------------
  219|  2.30k|				}
  220|       |
  221|  20.7k|				if (escapeFlag == 0)
  ------------------
  |  Branch (221:9): [True: 17.7k, False: 2.92k]
  ------------------
  222|  17.7k|				{
  223|       |					// compressed frame, read rest of parameters
  224|  17.7k|					mixBits	= (uint8_t) BitBufferRead (bits, 8) ;
  225|  17.7k|					mixRes	= (int8_t) BitBufferRead (bits, 8) ;
  226|       |					//Assert ((mixBits == 0) && (mixRes == 0)) ;		// no mixing for mono
  227|       |
  228|  17.7k|					headerByte	= (uint8_t) BitBufferRead (bits, 8) ;
  229|  17.7k|					modeU		= headerByte >> 4 ;
  230|  17.7k|					denShiftU	= headerByte & 0xfu ;
  231|       |
  232|  17.7k|					headerByte	= (uint8_t) BitBufferRead (bits, 8) ;
  233|  17.7k|					pbFactorU	= headerByte >> 5 ;
  234|  17.7k|					numU		= headerByte & 0x1fu ;
  235|       |
  236|  69.6k|					for (i = 0 ; i < numU ; i++)
  ------------------
  |  Branch (236:19): [True: 51.8k, False: 17.7k]
  ------------------
  237|  51.8k|						coefsU [i] = (int16_t) BitBufferRead (bits, 16) ;
  238|       |
  239|       |					// if shift active, skip the shift buffer but remember where it starts
  240|  17.7k|					if (bytesShifted != 0)
  ------------------
  |  Branch (240:10): [True: 4.02k, False: 13.7k]
  ------------------
  241|  4.02k|					{
  242|  4.02k|						shiftBits = *bits ;
  243|  4.02k|						BitBufferAdvance (bits, (bytesShifted * 8) * numSamples) ;
  244|  4.02k|					}
  245|       |
  246|       |					// decompress
  247|  17.7k|					set_ag_params (&agParams, p->mConfig.mb, (pb * pbFactorU) / 4, p->mConfig.kb, numSamples, numSamples, p->mConfig.maxRun) ;
  248|  17.7k|					status = dyn_decomp (&agParams, bits, p->u.mPredictor, numSamples, chanBits, &bits1) ;
  249|  17.7k|					RequireNoErr (status, goto Exit ;) ;
  ------------------
  |  |   41|  17.7k|#define RequireNoErr(condition, action)			if (condition) { action }
  |  |  ------------------
  |  |  |  Branch (41:47): [True: 3.20k, False: 14.5k]
  |  |  ------------------
  ------------------
  250|       |
  251|  14.5k|					if (modeU == 0)
  ------------------
  |  Branch (251:10): [True: 10.6k, False: 3.98k]
  ------------------
  252|  10.6k|					{
  253|  10.6k|						unpc_block (p->u.mPredictor, p->mMixBufferU, numSamples, &coefsU [0], numU, chanBits, denShiftU) ;
  254|  10.6k|					}
  255|  3.98k|					else
  256|  3.98k|					{
  257|       |						// the special "numActive == 31" mode can be done in-place
  258|  3.98k|						unpc_block (p->u.mPredictor, p->u.mPredictor, numSamples, NULL, 31, chanBits, 0) ;
  259|  3.98k|						unpc_block (p->u.mPredictor, p->mMixBufferU, numSamples, &coefsU [0], numU, chanBits, denShiftU) ;
  260|  3.98k|					}
  261|  14.5k|				}
  262|  2.92k|				else
  263|  2.92k|				{
  264|       |					//Assert (bytesShifted == 0) ;
  265|       |
  266|       |					// uncompressed frame, copy data into the mix buffer to use common output code
  267|  2.92k|					shift = 32 - chanBits ;
  268|  2.92k|					if (chanBits <= 16)
  ------------------
  |  Branch (268:10): [True: 1.65k, False: 1.26k]
  ------------------
  269|  1.65k|					{
  270|   676k|						for (i = 0 ; i < numSamples ; i++)
  ------------------
  |  Branch (270:20): [True: 675k, False: 1.65k]
  ------------------
  271|   675k|						{
  272|   675k|							val = (int32_t) BitBufferRead (bits, (uint8_t) chanBits) ;
  273|   675k|							val = (val << shift) >> shift ;
  274|   675k|							p->mMixBufferU [i] = val ;
  275|   675k|						}
  276|  1.65k|					}
  277|  1.26k|					else
  278|  1.26k|					{
  279|       |						// BitBufferRead () can't read more than 16 bits at a time so break up the reads
  280|  1.26k|						extraBits = chanBits - 16 ;
  281|   495k|						for (i = 0 ; i < numSamples ; i++)
  ------------------
  |  Branch (281:20): [True: 494k, False: 1.26k]
  ------------------
  282|   494k|						{
  283|   494k|							val = (int32_t) BitBufferRead (bits, 16) ;
  284|   494k|							val = arith_shift_left (val, 16) >> shift ;
  285|   494k|							p->mMixBufferU [i] = val | BitBufferRead (bits, (uint8_t) extraBits) ;
  286|   494k|						}
  287|  1.26k|					}
  288|       |
  289|  2.92k|					mixBits = mixRes = 0 ;
  290|  2.92k|					bits1 = chanBits * numSamples ;
  291|  2.92k|					bytesShifted = 0 ;
  292|  2.92k|				}
  293|       |
  294|       |				// now read the shifted values into the shift buffer
  295|  17.5k|				if (bytesShifted != 0)
  ------------------
  |  Branch (295:9): [True: 3.49k, False: 14.0k]
  ------------------
  296|  3.49k|				{
  297|  3.49k|					shift = bytesShifted * 8 ;
  298|       |					//Assert (shift <= 16) ;
  299|       |
  300|  10.9k|					for (i = 0 ; i < numSamples ; i++)
  ------------------
  |  Branch (300:19): [True: 7.44k, False: 3.49k]
  ------------------
  301|  7.44k|						p->u.mShiftBuffer [i] = (uint16_t) BitBufferRead (&shiftBits, (uint8_t) shift) ;
  302|  3.49k|				}
  303|       |
  304|       |				// convert 32-bit integers into output buffer
  305|  17.5k|				switch (p->mConfig.bitDepth)
  ------------------
  |  Branch (305:13): [True: 14.9k, False: 2.54k]
  ------------------
  306|  17.5k|				{
  307|  1.90k|					case 16:
  ------------------
  |  Branch (307:6): [True: 1.90k, False: 15.6k]
  ------------------
  308|  1.90k|						out32 = sampleBuffer + channelIndex ;
  309|   104k|						for (i = 0, j = 0 ; i < numSamples ; i++, j += numChannels)
  ------------------
  |  Branch (309:27): [True: 102k, False: 1.90k]
  ------------------
  310|   102k|							out32 [j] = arith_shift_left (p->mMixBufferU [i], 16) ;
  311|  1.90k|						break ;
  312|  2.15k|					case 20:
  ------------------
  |  Branch (312:6): [True: 2.15k, False: 15.3k]
  ------------------
  313|  2.15k|						out32 = sampleBuffer + channelIndex ;
  314|  2.15k|						copyPredictorTo20 (p->mMixBufferU, out32, numChannels, numSamples) ;
  315|  2.15k|						break ;
  316|  5.84k|					case 24:
  ------------------
  |  Branch (316:6): [True: 5.84k, False: 11.6k]
  ------------------
  317|  5.84k|						out32 = sampleBuffer + channelIndex ;
  318|  5.84k|						if (bytesShifted != 0)
  ------------------
  |  Branch (318:11): [True: 1.07k, False: 4.77k]
  ------------------
  319|  1.07k|							copyPredictorTo24Shift (p->mMixBufferU, p->u.mShiftBuffer, out32, numChannels, numSamples, bytesShifted) ;
  320|  4.77k|						else
  321|  4.77k|							copyPredictorTo24 (p->mMixBufferU, out32, numChannels, numSamples) ;
  322|  5.84k|						break ;
  323|  5.06k|					case 32:
  ------------------
  |  Branch (323:6): [True: 5.06k, False: 12.4k]
  ------------------
  324|  5.06k|						out32 = sampleBuffer + channelIndex ;
  325|  5.06k|						if (bytesShifted != 0)
  ------------------
  |  Branch (325:11): [True: 1.82k, False: 3.24k]
  ------------------
  326|  1.82k|							copyPredictorTo32Shift (p->mMixBufferU, p->u.mShiftBuffer, out32, numChannels, numSamples, bytesShifted) ;
  327|  3.24k|						else
  328|  3.24k|							copyPredictorTo32 (p->mMixBufferU, out32, numChannels, numSamples) ;
  329|  5.06k|						break ;
  330|  17.5k|				}
  331|       |
  332|  17.5k|				channelIndex += 1 ;
  333|  17.5k|				*outNumSamples = numSamples ;
  334|  17.5k|				break ;
  335|  17.5k|			}
  336|       |
  337|  10.0k|			case ID_CPE:
  ------------------
  |  Branch (337:4): [True: 10.0k, False: 39.7k]
  ------------------
  338|  10.0k|			{
  339|       |				// if decoding this pair would take us over the max channels limit, bail
  340|  10.0k|				if ((channelIndex + 2) > numChannels)
  ------------------
  |  Branch (340:9): [True: 280, False: 9.73k]
  ------------------
  341|    280|					goto NoMoreChannels ;
  342|       |
  343|       |				// stereo channel pair
  344|  9.73k|				elementInstanceTag = BitBufferReadSmall (bits, 4) ;
  345|  9.73k|				p->mActiveElements |= (1u << elementInstanceTag) ;
  346|       |
  347|       |				// read the 12 unused header bits
  348|  9.73k|				unusedHeader = (uint16_t) BitBufferRead (bits, 12) ;
  349|  9.73k|				RequireAction (unusedHeader == 0, status = kALAC_ParamError ; goto Exit ;) ;
  ------------------
  |  |   39|  9.73k|#define RequireAction(condition, action)		if (! (condition)) { action }
  |  |  ------------------
  |  |  |  Branch (39:47): [True: 2.36k, False: 7.36k]
  |  |  ------------------
  ------------------
  350|       |
  351|       |				// read the 1-bit "partial frame" flag, 2-bit "shift-off" flag & 1-bit "escape" flag
  352|  7.36k|				headerByte = (uint8_t) BitBufferRead (bits, 4) ;
  353|       |
  354|  7.36k|				partialFrame = headerByte >> 3 ;
  355|       |
  356|  7.36k|				bytesShifted = (headerByte >> 1) & 0x3u ;
  357|  7.36k|				RequireAction (bytesShifted != 3, status = kALAC_ParamError ; goto Exit ;) ;
  ------------------
  |  |   39|  7.36k|#define RequireAction(condition, action)		if (! (condition)) { action }
  |  |  ------------------
  |  |  |  Branch (39:47): [True: 246, 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.89k, False: 3.22k]
  ------------------
  367|  3.89k|				{
  368|  3.89k|					numSamples = BitBufferRead (bits, 16) << 16 ;
  369|  3.89k|					numSamples |= BitBufferRead (bits, 16) ;
  370|       |
  371|  3.89k|					RequireAction (numSamples < kALACDefaultFramesPerPacket, return kALAC_NumSamplesTooBig ;) ;
  ------------------
  |  |   39|  3.89k|#define RequireAction(condition, action)		if (! (condition)) { action }
  |  |  ------------------
  |  |  |  Branch (39:47): [True: 426, False: 3.47k]
  |  |  ------------------
  ------------------
  372|  3.47k|				}
  373|       |
  374|  6.69k|				if (escapeFlag == 0)
  ------------------
  |  Branch (374:9): [True: 4.08k, False: 2.61k]
  ------------------
  375|  4.08k|				{
  376|       |					// compressed frame, read rest of parameters
  377|  4.08k|					mixBits		= (uint8_t) BitBufferRead (bits, 8) ;
  378|  4.08k|					mixRes		= (int8_t) BitBufferRead (bits, 8) ;
  379|       |
  380|  4.08k|					headerByte	= (uint8_t) BitBufferRead (bits, 8) ;
  381|  4.08k|					modeU		= headerByte >> 4 ;
  382|  4.08k|					denShiftU	= headerByte & 0xfu ;
  383|       |
  384|  4.08k|					headerByte	= (uint8_t) BitBufferRead (bits, 8) ;
  385|  4.08k|					pbFactorU	= headerByte >> 5 ;
  386|  4.08k|					numU		= headerByte & 0x1fu ;
  387|  13.4k|					for (i = 0 ; i < numU ; i++)
  ------------------
  |  Branch (387:19): [True: 9.32k, False: 4.08k]
  ------------------
  388|  9.32k|						coefsU [i] = (int16_t) BitBufferRead (bits, 16) ;
  389|       |
  390|  4.08k|					headerByte	= (uint8_t) BitBufferRead (bits, 8) ;
  391|  4.08k|					modeV		= headerByte >> 4 ;
  392|  4.08k|					denShiftV	= headerByte & 0xfu ;
  393|       |
  394|  4.08k|					headerByte	= (uint8_t) BitBufferRead (bits, 8) ;
  395|  4.08k|					pbFactorV	= headerByte >> 5 ;
  396|  4.08k|					numV		= headerByte & 0x1fu ;
  397|  22.0k|					for (i = 0 ; i < numV ; i++)
  ------------------
  |  Branch (397:19): [True: 18.0k, False: 4.08k]
  ------------------
  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.08k|					if (bytesShifted != 0)
  ------------------
  |  Branch (401:10): [True: 871, False: 3.21k]
  ------------------
  402|    871|					{
  403|    871|						shiftBits = *bits ;
  404|    871|						BitBufferAdvance (bits, (bytesShifted * 8) * 2 * numSamples) ;
  405|    871|					}
  406|       |
  407|       |					// decompress and run predictor for "left" channel
  408|  4.08k|					set_ag_params (&agParams, p->mConfig.mb, (pb * pbFactorU) / 4, p->mConfig.kb, numSamples, numSamples, p->mConfig.maxRun) ;
  409|  4.08k|					status = dyn_decomp (&agParams, bits, p->u.mPredictor, numSamples, chanBits, &bits1) ;
  410|  4.08k|					RequireNoErr (status, goto Exit ;) ;
  ------------------
  |  |   41|  4.08k|#define RequireNoErr(condition, action)			if (condition) { action }
  |  |  ------------------
  |  |  |  Branch (41:47): [True: 937, False: 3.14k]
  |  |  ------------------
  ------------------
  411|       |
  412|  3.14k|					if (modeU == 0)
  ------------------
  |  Branch (412:10): [True: 2.44k, False: 697]
  ------------------
  413|  2.44k|					{
  414|  2.44k|						unpc_block (p->u.mPredictor, p->mMixBufferU, numSamples, &coefsU [0], numU, chanBits, denShiftU) ;
  415|  2.44k|					}
  416|    697|					else
  417|    697|					{
  418|       |						// the special "numActive == 31" mode can be done in-place
  419|    697|						unpc_block (p->u.mPredictor, p->u.mPredictor, numSamples, NULL, 31, chanBits, 0) ;
  420|    697|						unpc_block (p->u.mPredictor, p->mMixBufferU, numSamples, &coefsU [0], numU, chanBits, denShiftU) ;
  421|    697|					}
  422|       |
  423|       |					// decompress and run predictor for "right" channel
  424|  3.14k|					set_ag_params (&agParams, p->mConfig.mb, (pb * pbFactorV) / 4, p->mConfig.kb, numSamples, numSamples, p->mConfig.maxRun) ;
  425|  3.14k|					status = dyn_decomp (&agParams, bits, p->u.mPredictor, numSamples, chanBits, &bits2) ;
  426|  3.14k|					RequireNoErr (status, goto Exit ;) ;
  ------------------
  |  |   41|  3.14k|#define RequireNoErr(condition, action)			if (condition) { action }
  |  |  ------------------
  |  |  |  Branch (41:47): [True: 291, False: 2.85k]
  |  |  ------------------
  ------------------
  427|       |
  428|  2.85k|					if (modeV == 0)
  ------------------
  |  Branch (428:10): [True: 1.32k, False: 1.53k]
  ------------------
  429|  1.32k|					{
  430|  1.32k|						unpc_block (p->u.mPredictor, p->mMixBufferV, numSamples, &coefsV [0], numV, chanBits, denShiftV) ;
  431|  1.32k|					}
  432|  1.53k|					else
  433|  1.53k|					{
  434|       |						// the special "numActive == 31" mode can be done in-place
  435|  1.53k|						unpc_block (p->u.mPredictor, p->u.mPredictor, numSamples, NULL, 31, chanBits, 0) ;
  436|  1.53k|						unpc_block (p->u.mPredictor, p->mMixBufferV, numSamples, &coefsV [0], numV, chanBits, denShiftV) ;
  437|  1.53k|					}
  438|  2.85k|				}
  439|  2.61k|				else
  440|  2.61k|				{
  441|       |					//Assert (bytesShifted == 0) ;
  442|       |
  443|       |					// uncompressed frame, copy data into the mix buffers to use common output code
  444|  2.61k|					chanBits = p->mConfig.bitDepth ;
  445|  2.61k|					shift = 32 - chanBits ;
  446|  2.61k|					if (chanBits <= 16)
  ------------------
  |  Branch (446:10): [True: 601, False: 2.01k]
  ------------------
  447|    601|					{
  448|  29.1k|						for (i = 0 ; i < numSamples ; i++)
  ------------------
  |  Branch (448:20): [True: 28.5k, False: 601]
  ------------------
  449|  28.5k|						{
  450|  28.5k|							val = (int32_t) BitBufferRead (bits, (uint8_t) chanBits) ;
  451|  28.5k|							val = (val << shift) >> shift ;
  452|  28.5k|							p->mMixBufferU [i] = val ;
  453|       |
  454|  28.5k|							val = (int32_t) BitBufferRead (bits, (uint8_t) chanBits) ;
  455|  28.5k|							val = (val << shift) >> shift ;
  456|  28.5k|							p->mMixBufferV [i] = val ;
  457|  28.5k|						}
  458|    601|					}
  459|  2.01k|					else
  460|  2.01k|					{
  461|       |						// BitBufferRead () can't read more than 16 bits at a time so break up the reads
  462|  2.01k|						extraBits = chanBits - 16 ;
  463|  67.0k|						for (i = 0 ; i < numSamples ; i++)
  ------------------
  |  Branch (463:20): [True: 65.0k, False: 2.01k]
  ------------------
  464|  65.0k|						{
  465|  65.0k|							val = (int32_t) BitBufferRead (bits, 16) ;
  466|  65.0k|							val = (((uint32_t) val) << 16) >> shift ;
  467|  65.0k|							p->mMixBufferU [i] = val | BitBufferRead (bits, (uint8_t) extraBits) ;
  468|       |
  469|  65.0k|							val = (int32_t) BitBufferRead (bits, 16) ;
  470|  65.0k|							val = ((uint32_t) val) >> shift ;
  471|  65.0k|							p->mMixBufferV [i] = val | BitBufferRead (bits, (uint8_t) extraBits) ;
  472|  65.0k|						}
  473|  2.01k|					}
  474|       |
  475|  2.61k|					bits1 = chanBits * numSamples ;
  476|  2.61k|					bits2 = chanBits * numSamples ;
  477|  2.61k|					mixBits = mixRes = 0 ;
  478|  2.61k|					bytesShifted = 0 ;
  479|  2.61k|				}
  480|       |
  481|       |				// now read the shifted values into the shift buffer
  482|  5.46k|				if (bytesShifted != 0)
  ------------------
  |  Branch (482:9): [True: 514, False: 4.95k]
  ------------------
  483|    514|				{
  484|    514|					shift = bytesShifted * 8 ;
  485|       |					//Assert (shift <= 16) ;
  486|       |
  487|  2.96k|					for (i = 0 ; i < (numSamples * 2) ; i += 2)
  ------------------
  |  Branch (487:19): [True: 2.45k, False: 514]
  ------------------
  488|  2.45k|					{
  489|  2.45k|						p->u.mShiftBuffer [i + 0] = (uint16_t) BitBufferRead (&shiftBits, (uint8_t) shift) ;
  490|  2.45k|						p->u.mShiftBuffer [i + 1] = (uint16_t) BitBufferRead (&shiftBits, (uint8_t) shift) ;
  491|  2.45k|					}
  492|    514|				}
  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.46k|				switch (p->mConfig.bitDepth)
  ------------------
  |  Branch (496:13): [True: 5.05k, False: 415]
  ------------------
  497|  5.46k|				{
  498|  1.02k|					case 16:
  ------------------
  |  Branch (498:6): [True: 1.02k, False: 4.44k]
  ------------------
  499|  1.02k|						out32 = sampleBuffer + channelIndex ;
  500|  1.02k|						unmix16 (p->mMixBufferU, p->mMixBufferV, out32, numChannels, numSamples, mixBits, mixRes) ;
  501|  1.02k|						break ;
  502|  1.07k|					case 20:
  ------------------
  |  Branch (502:6): [True: 1.07k, False: 4.39k]
  ------------------
  503|  1.07k|						out32 = sampleBuffer + channelIndex ;
  504|  1.07k|						unmix20 (p->mMixBufferU, p->mMixBufferV, out32, numChannels, numSamples, mixBits, mixRes) ;
  505|  1.07k|						break ;
  506|  1.46k|					case 24:
  ------------------
  |  Branch (506:6): [True: 1.46k, False: 4.00k]
  ------------------
  507|  1.46k|						out32 = sampleBuffer + channelIndex ;
  508|  1.46k|						unmix24 (p->mMixBufferU, p->mMixBufferV, out32, numChannels, numSamples,
  509|  1.46k|									mixBits, mixRes, p->u.mShiftBuffer, bytesShifted) ;
  510|  1.46k|						break ;
  511|  1.49k|					case 32:
  ------------------
  |  Branch (511:6): [True: 1.49k, False: 3.97k]
  ------------------
  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.46k|				}
  517|       |
  518|  5.46k|				channelIndex += 2 ;
  519|  5.46k|				*outNumSamples = numSamples ;
  520|  5.46k|				break ;
  521|  5.46k|			}
  522|       |
  523|  1.26k|			case ID_CCE:
  ------------------
  |  Branch (523:4): [True: 1.26k, False: 48.5k]
  ------------------
  524|  1.74k|			case ID_PCE:
  ------------------
  |  Branch (524:4): [True: 480, False: 49.3k]
  ------------------
  525|  1.74k|			{
  526|       |				// unsupported element, bail
  527|       |				//AssertNoErr (tag) ;
  528|  1.74k|				status = kALAC_UnsupportedElement ;
  529|  1.74k|				break ;
  530|  1.26k|			}
  531|       |
  532|  1.77k|			case ID_DSE:
  ------------------
  |  Branch (532:4): [True: 1.77k, False: 48.0k]
  ------------------
  533|  1.77k|			{
  534|       |				// data stream element -- parse but ignore
  535|  1.77k|				status = alac_data_stream_element (bits) ;
  536|  1.77k|				break ;
  537|  1.26k|			}
  538|       |
  539|  1.81k|			case ID_FIL:
  ------------------
  |  Branch (539:4): [True: 1.81k, False: 47.9k]
  ------------------
  540|  1.81k|			{
  541|       |				// fill element -- parse but ignore
  542|  1.81k|				status = alac_fill_element (bits) ;
  543|  1.81k|				break ;
  544|  1.26k|			}
  545|       |
  546|  2.41k|			case ID_END:
  ------------------
  |  Branch (546:4): [True: 2.41k, False: 47.3k]
  ------------------
  547|  2.41k|			{
  548|       |				// frame end, all done so byte align the frame and check for overruns
  549|  2.41k|				BitBufferByteAlign (bits, false) ;
  550|       |				//Assert (bits->cur == bits->end) ;
  551|  2.41k|				goto Exit ;
  552|  1.26k|			}
  553|  49.7k|		}
  554|       |
  555|  28.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|  28.3k|		if (channelIndex >= numChannels)
  ------------------
  |  Branch (558:7): [True: 513, False: 27.8k]
  ------------------
  559|    513|			break ;
  560|  28.3k|#endif
  561|  28.3k|	}
  562|       |
  563|  3.94k|NoMoreChannels:
  564|       |
  565|       |	// if we get here and haven't decoded all of the requested channels, fill the remaining channels with zeros
  566|   170k|	for ( ; channelIndex < numChannels ; channelIndex++)
  ------------------
  |  Branch (566:10): [True: 166k, False: 3.94k]
  ------------------
  567|   166k|	{
  568|   166k|		int32_t *	fill32 = sampleBuffer + channelIndex ;
  569|   166k|		Zero32 (fill32, numSamples, numChannels) ;
  570|   166k|	}
  571|       |
  572|  28.7k|Exit:
  573|  28.7k|	return status ;
  574|  3.94k|}
alac_decoder.c:alac_fill_element:
  586|  1.81k|{
  587|  1.81k|	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.81k|	count = BitBufferReadSmall (bits, 4) ;
  592|  1.81k|	if (count == 15)
  ------------------
  |  Branch (592:6): [True: 240, False: 1.57k]
  ------------------
  593|    240|		count += (int16_t) BitBufferReadSmall (bits, 8) - 1 ;
  594|       |
  595|  1.81k|	BitBufferAdvance (bits, count * 8) ;
  596|       |
  597|  1.81k|	RequireAction (bits->cur <= bits->end, return kALAC_ParamError ;) ;
  ------------------
  |  |   39|  1.81k|#define RequireAction(condition, action)		if (! (condition)) { action }
  |  |  ------------------
  |  |  |  Branch (39:47): [True: 484, False: 1.32k]
  |  |  ------------------
  ------------------
  598|       |
  599|  1.32k|	return ALAC_noErr ;
  600|  1.81k|}
alac_decoder.c:alac_data_stream_element:
  608|  1.77k|{
  609|  1.77k|	int32_t		data_byte_align_flag ;
  610|  1.77k|	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.77k|	data_byte_align_flag = BitBufferReadOne (bits) ;
  617|       |
  618|       |	// 8-bit count or (8-bit + 8-bit count) if 8-bit count == 255
  619|  1.77k|	count = BitBufferReadSmall (bits, 8) ;
  620|  1.77k|	if (count == 255)
  ------------------
  |  Branch (620:6): [True: 208, False: 1.56k]
  ------------------
  621|    208|		count += BitBufferReadSmall (bits, 8) ;
  622|       |
  623|       |	// the align flag means the bitstream should be byte-aligned before reading the following data bytes
  624|  1.77k|	if (data_byte_align_flag)
  ------------------
  |  Branch (624:6): [True: 759, False: 1.01k]
  ------------------
  625|    759|		BitBufferByteAlign (bits, false) ;
  626|       |
  627|       |	// skip the data bytes
  628|  1.77k|	BitBufferAdvance (bits, count * 8) ;
  629|       |
  630|  1.77k|	RequireAction (bits->cur <= bits->end, return kALAC_ParamError ;) ;
  ------------------
  |  |   39|  1.77k|#define RequireAction(condition, action)		if (! (condition)) { action }
  |  |  ------------------
  |  |  |  Branch (39:47): [True: 926, False: 850]
  |  |  ------------------
  ------------------
  631|       |
  632|    850|	return ALAC_noErr ;
  633|  1.77k|}
alac_decoder.c:Zero32:
  640|   166k|{
  641|   166k|	if (stride == 1)
  ------------------
  |  Branch (641:6): [True: 621, False: 165k]
  ------------------
  642|    621|	{
  643|    621|		memset (buffer, 0, numItems * sizeof (int32_t)) ;
  644|    621|	}
  645|   165k|	else
  646|   165k|	{
  647|  28.9M|		for (uint32_t indx = 0 ; indx < (numItems * stride) ; indx += stride)
  ------------------
  |  Branch (647:28): [True: 28.7M, False: 165k]
  ------------------
  648|  28.7M|			buffer [indx] = 0 ;
  649|   165k|	}
  650|   166k|}

unpc_block:
   56|  26.8k|{
   57|  26.8k|	register int16_t	a0, a1, a2, a3 ;
   58|  26.8k|	register int32_t	b0, b1, b2, b3 ;
   59|  26.8k|	int32_t					j, k, lim ;
   60|  26.8k|	int32_t				sum1, sg, sgn, top, dd ;
   61|  26.8k|	int32_t *			pout ;
   62|  26.8k|	int32_t				del, del0 ;
   63|  26.8k|	uint32_t			chanshift = 32 - chanbits ;
   64|  26.8k|	int32_t				denhalf = 1 << (denshift - 1) ;
   65|       |
   66|  26.8k|	out [0] = pc1 [0] ;
   67|  26.8k|	if (numactive == 0)
  ------------------
  |  Branch (67:6): [True: 15.4k, False: 11.3k]
  ------------------
   68|  15.4k|	{
   69|       |		// just copy if numactive == 0 (but don't bother if in/out pointers the same)
   70|  15.4k|		if ((num > 1) && (pc1 != out))
  ------------------
  |  Branch (70:7): [True: 12.4k, False: 3.03k]
  |  Branch (70:20): [True: 12.4k, False: 0]
  ------------------
   71|  12.4k|			memcpy (&out [1], &pc1 [1], (num - 1) * sizeof (int32_t)) ;
   72|  15.4k|		return ;
   73|  15.4k|	}
   74|  11.3k|	if (numactive == 31)
  ------------------
  |  Branch (74:6): [True: 6.23k, False: 5.08k]
  ------------------
   75|  6.23k|	{
   76|       |		// short-circuit if numactive == 31
   77|  6.23k|		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.23k|		prev = out [0] ;
   88|  1.25M|		for (j = 1 ; j < num ; j++)
  ------------------
  |  Branch (88:16): [True: 1.25M, False: 6.23k]
  ------------------
   89|  1.25M|		{
   90|  1.25M|			del = pc1 [j] + prev ;
   91|  1.25M|			prev = (del << chanshift) >> chanshift ;
   92|  1.25M|			out [j] = prev ;
   93|  1.25M|		}
   94|  6.23k|		return ;
   95|  6.23k|	}
   96|       |
   97|  32.3k|	for (j = 1 ; j <= numactive ; j++)
  ------------------
  |  Branch (97:15): [True: 27.3k, False: 5.08k]
  ------------------
   98|  27.3k|	{
   99|  27.3k|		del = pc1 [j] + out [j-1] ;
  100|  27.3k|		out [j] = arith_shift_left (del, chanshift) >> chanshift ;
  101|  27.3k|	}
  102|       |
  103|  5.08k|	lim = numactive + 1 ;
  104|       |
  105|  5.08k|	if (numactive == 4)
  ------------------
  |  Branch (105:6): [True: 1.24k, False: 3.84k]
  ------------------
  106|  1.24k|	{
  107|       |		// optimization for numactive == 4
  108|  1.24k|		register int16_t	ia0, ia1, ia2, ia3 ;
  109|  1.24k|		register int32_t	ib0, ib1, ib2, ib3 ;
  110|       |
  111|  1.24k|		ia0 = coefs [0] ;
  112|  1.24k|		ia1 = coefs [1] ;
  113|  1.24k|		ia2 = coefs [2] ;
  114|  1.24k|		ia3 = coefs [3] ;
  115|       |
  116|   497k|		for (j = lim ; j < num ; j++)
  ------------------
  |  Branch (116:18): [True: 496k, False: 1.24k]
  ------------------
  117|   496k|		{
  118|   496k|			LOOP_ALIGN
  119|       |
  120|   496k|			top = out [j - lim] ;
  121|   496k|			pout = out + j - 1 ;
  122|       |
  123|   496k|			ib0 = top - pout [0] ;
  124|   496k|			ib1 = top - pout [-1] ;
  125|   496k|			ib2 = top - pout [-2] ;
  126|   496k|			ib3 = top - pout [-3] ;
  127|       |
  128|   496k|			sum1 = (denhalf - ia0 * ib0 - ia1 * ib1 - ia2 * ib2 - ia3 * ib3) >> denshift ;
  129|       |
  130|   496k|			del = pc1 [j] ;
  131|   496k|			del0 = del ;
  132|   496k|			sg = sign_of_int (del) ;
  133|   496k|			del += top + sum1 ;
  134|       |
  135|   496k|			out [j] = arith_shift_left (del, chanshift) >> chanshift ;
  136|       |
  137|   496k|			if (sg > 0)
  ------------------
  |  Branch (137:8): [True: 37.8k, False: 458k]
  ------------------
  138|  37.8k|			{
  139|  37.8k|				sgn = sign_of_int (ib3) ;
  140|  37.8k|				ia3 -= sgn ;
  141|  37.8k|				del0 -= (4 - 3) * ((sgn * ib3) >> denshift) ;
  142|  37.8k|				if (del0 <= 0)
  ------------------
  |  Branch (142:9): [True: 6.82k, False: 31.0k]
  ------------------
  143|  6.82k|					continue ;
  144|       |
  145|  31.0k|				sgn = sign_of_int (ib2) ;
  146|  31.0k|				ia2 -= sgn ;
  147|  31.0k|				del0 -= (4 - 2) * ((sgn * ib2) >> denshift) ;
  148|  31.0k|				if (del0 <= 0)
  ------------------
  |  Branch (148:9): [True: 3.33k, False: 27.6k]
  ------------------
  149|  3.33k|					continue ;
  150|       |
  151|  27.6k|				sgn = sign_of_int (ib1) ;
  152|  27.6k|				ia1 -= sgn ;
  153|  27.6k|				del0 -= (4 - 1) * ((sgn * ib1) >> denshift) ;
  154|  27.6k|				if (del0 <= 0)
  ------------------
  |  Branch (154:9): [True: 1.66k, False: 26.0k]
  ------------------
  155|  1.66k|					continue ;
  156|       |
  157|  26.0k|				ia0 -= sign_of_int (ib0) ;
  158|  26.0k|			}
  159|   458k|			else if (sg < 0)
  ------------------
  |  Branch (159:13): [True: 46.7k, False: 411k]
  ------------------
  160|  46.7k|			{
  161|       |				// note: to avoid unnecessary negations, we flip the value of "sgn"
  162|  46.7k|				sgn = -sign_of_int (ib3) ;
  163|  46.7k|				ia3 -= sgn ;
  164|  46.7k|				del0 -= (4 - 3) * ((sgn * ib3) >> denshift) ;
  165|  46.7k|				if (del0 >= 0)
  ------------------
  |  Branch (165:9): [True: 10.6k, False: 36.1k]
  ------------------
  166|  10.6k|					continue ;
  167|       |
  168|  36.1k|				sgn = -sign_of_int (ib2) ;
  169|  36.1k|				ia2 -= sgn ;
  170|  36.1k|				del0 -= (4 - 2) * ((sgn * ib2) >> denshift) ;
  171|  36.1k|				if (del0 >= 0)
  ------------------
  |  Branch (171:9): [True: 7.57k, False: 28.5k]
  ------------------
  172|  7.57k|					continue ;
  173|       |
  174|  28.5k|				sgn = -sign_of_int (ib1) ;
  175|  28.5k|				ia1 -= sgn ;
  176|  28.5k|				del0 -= (4 - 1) * ((sgn * ib1) >> denshift) ;
  177|  28.5k|				if (del0 >= 0)
  ------------------
  |  Branch (177:9): [True: 6.60k, False: 21.9k]
  ------------------
  178|  6.60k|					continue ;
  179|       |
  180|  21.9k|				ia0 += sign_of_int (ib0) ;
  181|  21.9k|			}
  182|   496k|		}
  183|       |
  184|  1.24k|		coefs [0] = ia0 ;
  185|  1.24k|		coefs [1] = ia1 ;
  186|  1.24k|		coefs [2] = ia2 ;
  187|  1.24k|		coefs [3] = ia3 ;
  188|  1.24k|	}
  189|  3.84k|	else if (numactive == 8)
  ------------------
  |  Branch (189:11): [True: 887, False: 2.95k]
  ------------------
  190|    887|	{
  191|    887|		register int16_t	a4, a5, a6, a7 ;
  192|    887|		register int32_t	b4, b5, b6, b7 ;
  193|       |
  194|       |		// optimization for numactive == 8
  195|    887|		a0 = coefs [0] ;
  196|    887|		a1 = coefs [1] ;
  197|    887|		a2 = coefs [2] ;
  198|    887|		a3 = coefs [3] ;
  199|    887|		a4 = coefs [4] ;
  200|    887|		a5 = coefs [5] ;
  201|    887|		a6 = coefs [6] ;
  202|    887|		a7 = coefs [7] ;
  203|       |
  204|   549k|		for (j = lim ; j < num ; j++)
  ------------------
  |  Branch (204:18): [True: 548k, False: 887]
  ------------------
  205|   548k|		{
  206|   548k|			LOOP_ALIGN
  207|       |
  208|   548k|			top = out [j - lim] ;
  209|   548k|			pout = out + j - 1 ;
  210|       |
  211|   548k|			b0 = top - (*pout--) ;
  212|   548k|			b1 = top - (*pout--) ;
  213|   548k|			b2 = top - (*pout--) ;
  214|   548k|			b3 = top - (*pout--) ;
  215|   548k|			b4 = top - (*pout--) ;
  216|   548k|			b5 = top - (*pout--) ;
  217|   548k|			b6 = top - (*pout--) ;
  218|   548k|			b7 = top - (*pout) ;
  219|   548k|			pout += 8 ;
  220|       |
  221|   548k|			sum1 = (denhalf - a0 * b0 - a1 * b1 - a2 * b2 - a3 * b3
  222|   548k|					- a4 * b4 - a5 * b5 - a6 * b6 - a7 * b7) >> denshift ;
  223|       |
  224|   548k|			del = pc1 [j] ;
  225|   548k|			del0 = del ;
  226|   548k|			sg = sign_of_int (del) ;
  227|   548k|			del += top + sum1 ;
  228|       |
  229|   548k|			out [j] = arith_shift_left (del, chanshift) >> chanshift ;
  230|       |
  231|   548k|			if (sg > 0)
  ------------------
  |  Branch (231:8): [True: 229k, False: 319k]
  ------------------
  232|   229k|			{
  233|   229k|				sgn = sign_of_int (b7) ;
  234|   229k|				a7 -= sgn ;
  235|   229k|				del0 -= 1 * ((sgn * b7) >> denshift) ;
  236|   229k|				if (del0 <= 0)
  ------------------
  |  Branch (236:9): [True: 62.1k, False: 167k]
  ------------------
  237|  62.1k|					continue ;
  238|       |
  239|   167k|				sgn = sign_of_int (b6) ;
  240|   167k|				a6 -= sgn ;
  241|   167k|				del0 -= 2 * ((sgn * b6) >> denshift) ;
  242|   167k|				if (del0 <= 0)
  ------------------
  |  Branch (242:9): [True: 60.8k, False: 106k]
  ------------------
  243|  60.8k|					continue ;
  244|       |
  245|   106k|				sgn = sign_of_int (b5) ;
  246|   106k|				a5 -= sgn ;
  247|   106k|				del0 -= 3 * ((sgn * b5) >> denshift) ;
  248|   106k|				if (del0 <= 0)
  ------------------
  |  Branch (248:9): [True: 48.5k, False: 57.6k]
  ------------------
  249|  48.5k|					continue ;
  250|       |
  251|  57.6k|				sgn = sign_of_int (b4) ;
  252|  57.6k|				a4 -= sgn ;
  253|  57.6k|				del0 -= 4 * ((sgn * b4) >> denshift) ;
  254|  57.6k|				if (del0 <= 0)
  ------------------
  |  Branch (254:9): [True: 24.2k, False: 33.3k]
  ------------------
  255|  24.2k|					continue ;
  256|       |
  257|  33.3k|				sgn = sign_of_int (b3) ;
  258|  33.3k|				a3 -= sgn ;
  259|  33.3k|				del0 -= 5 * ((sgn * b3) >> denshift) ;
  260|  33.3k|				if (del0 <= 0)
  ------------------
  |  Branch (260:9): [True: 10.5k, False: 22.8k]
  ------------------
  261|  10.5k|					continue ;
  262|       |
  263|  22.8k|				sgn = sign_of_int (b2) ;
  264|  22.8k|				a2 -= sgn ;
  265|  22.8k|				del0 -= 6 * ((sgn * b2) >> denshift) ;
  266|  22.8k|				if (del0 <= 0)
  ------------------
  |  Branch (266:9): [True: 4.86k, False: 17.9k]
  ------------------
  267|  4.86k|					continue ;
  268|       |
  269|  17.9k|				sgn = sign_of_int (b1) ;
  270|  17.9k|				a1 -= sgn ;
  271|  17.9k|				del0 -= 7 * ((sgn * b1) >> denshift) ;
  272|  17.9k|				if (del0 <= 0)
  ------------------
  |  Branch (272:9): [True: 2.76k, False: 15.2k]
  ------------------
  273|  2.76k|					continue ;
  274|       |
  275|  15.2k|				a0 -= sign_of_int (b0) ;
  276|  15.2k|			}
  277|   319k|			else if (sg < 0)
  ------------------
  |  Branch (277:13): [True: 171k, False: 148k]
  ------------------
  278|   171k|			{
  279|       |				// note: to avoid unnecessary negations, we flip the value of "sgn"
  280|   171k|				sgn = -sign_of_int (b7) ;
  281|   171k|				a7 -= sgn ;
  282|   171k|				del0 -= 1 * ((sgn * b7) >> denshift) ;
  283|   171k|				if (del0 >= 0)
  ------------------
  |  Branch (283:9): [True: 42.7k, False: 128k]
  ------------------
  284|  42.7k|					continue ;
  285|       |
  286|   128k|				sgn = -sign_of_int (b6) ;
  287|   128k|				a6 -= sgn ;
  288|   128k|				del0 -= 2 * ((sgn * b6) >> denshift) ;
  289|   128k|				if (del0 >= 0)
  ------------------
  |  Branch (289:9): [True: 33.9k, False: 94.4k]
  ------------------
  290|  33.9k|					continue ;
  291|       |
  292|  94.4k|				sgn = -sign_of_int (b5) ;
  293|  94.4k|				a5 -= sgn ;
  294|  94.4k|				del0 -= 3 * ((sgn * b5) >> denshift) ;
  295|  94.4k|				if (del0 >= 0)
  ------------------
  |  Branch (295:9): [True: 37.6k, False: 56.7k]
  ------------------
  296|  37.6k|					continue ;
  297|       |
  298|  56.7k|				sgn = -sign_of_int (b4) ;
  299|  56.7k|				a4 -= sgn ;
  300|  56.7k|				del0 -= 4 * ((sgn * b4) >> denshift) ;
  301|  56.7k|				if (del0 >= 0)
  ------------------
  |  Branch (301:9): [True: 19.6k, False: 37.1k]
  ------------------
  302|  19.6k|					continue ;
  303|       |
  304|  37.1k|				sgn = -sign_of_int (b3) ;
  305|  37.1k|				a3 -= sgn ;
  306|  37.1k|				del0 -= 5 * ((sgn * b3) >> denshift) ;
  307|  37.1k|				if (del0 >= 0)
  ------------------
  |  Branch (307:9): [True: 8.14k, False: 28.9k]
  ------------------
  308|  8.14k|					continue ;
  309|       |
  310|  28.9k|				sgn = -sign_of_int (b2) ;
  311|  28.9k|				a2 -= sgn ;
  312|  28.9k|				del0 -= 6 * ((sgn * b2) >> denshift) ;
  313|  28.9k|				if (del0 >= 0)
  ------------------
  |  Branch (313:9): [True: 6.14k, False: 22.8k]
  ------------------
  314|  6.14k|					continue ;
  315|       |
  316|  22.8k|				sgn = -sign_of_int (b1) ;
  317|  22.8k|				a1 -= sgn ;
  318|  22.8k|				del0 -= 7 * ((sgn * b1) >> denshift) ;
  319|  22.8k|				if (del0 >= 0)
  ------------------
  |  Branch (319:9): [True: 5.65k, False: 17.1k]
  ------------------
  320|  5.65k|					continue ;
  321|       |
  322|  17.1k|				a0 += sign_of_int (b0) ;
  323|  17.1k|			}
  324|   548k|		}
  325|       |
  326|    887|		coefs [0] = a0 ;
  327|    887|		coefs [1] = a1 ;
  328|    887|		coefs [2] = a2 ;
  329|    887|		coefs [3] = a3 ;
  330|    887|		coefs [4] = a4 ;
  331|    887|		coefs [5] = a5 ;
  332|    887|		coefs [6] = a6 ;
  333|    887|		coefs [7] = a7 ;
  334|    887|	}
  335|  2.95k|	else
  336|  2.95k|	{
  337|       |		// general case
  338|   540k|		for (j = lim ; j < num ; j++)
  ------------------
  |  Branch (338:18): [True: 537k, False: 2.95k]
  ------------------
  339|   537k|		{
  340|   537k|			LOOP_ALIGN
  341|       |
  342|   537k|			sum1 = 0 ;
  343|   537k|			pout = out + j - 1 ;
  344|   537k|			top = out [j-lim] ;
  345|       |
  346|  6.06M|			for (k = 0 ; k < numactive ; k++)
  ------------------
  |  Branch (346:17): [True: 5.53M, False: 537k]
  ------------------
  347|  5.53M|				sum1 += coefs [k] * (pout [-k] - top) ;
  348|       |
  349|   537k|			del = pc1 [j] ;
  350|   537k|			del0 = del ;
  351|   537k|			sg = sign_of_int (del) ;
  352|   537k|			del += top + ((sum1 + denhalf) >> denshift) ;
  353|   537k|			out [j] = (del << chanshift) >> chanshift ;
  354|       |
  355|   537k|			if (sg > 0)
  ------------------
  |  Branch (355:8): [True: 180k, False: 356k]
  ------------------
  356|   180k|			{
  357|  1.37M|				for (k = (numactive - 1) ; k >= 0 ; k--)
  ------------------
  |  Branch (357:32): [True: 1.25M, False: 115k]
  ------------------
  358|  1.25M|				{
  359|  1.25M|					dd = top - pout [-k] ;
  360|  1.25M|					sgn = sign_of_int (dd) ;
  361|  1.25M|					coefs [k] -= sgn ;
  362|  1.25M|					del0 -= (numactive - k) * ((sgn * dd) >> denshift) ;
  363|  1.25M|					if (del0 <= 0)
  ------------------
  |  Branch (363:10): [True: 65.1k, False: 1.18M]
  ------------------
  364|  65.1k|						break ;
  365|  1.25M|				}
  366|   180k|			}
  367|   356k|			else if (sg < 0)
  ------------------
  |  Branch (367:13): [True: 265k, False: 91.4k]
  ------------------
  368|   265k|			{
  369|  2.61M|				for (k = (numactive - 1) ; k >= 0 ; k--)
  ------------------
  |  Branch (369:32): [True: 2.37M, False: 238k]
  ------------------
  370|  2.37M|				{
  371|  2.37M|					dd = top - pout [-k] ;
  372|  2.37M|					sgn = sign_of_int (dd) ;
  373|  2.37M|					coefs [k] += sgn ;
  374|  2.37M|					del0 -= (numactive - k) * ((-sgn * dd) >> denshift) ;
  375|  2.37M|					if (del0 >= 0)
  ------------------
  |  Branch (375:10): [True: 26.4k, False: 2.35M]
  ------------------
  376|  26.4k|						break ;
  377|  2.37M|				}
  378|   265k|			}
  379|   537k|		}
  380|  2.95k|	}
  381|  5.08k|}
dp_dec.c:sign_of_int:
   47|  6.67M|{
   48|  6.67M|	int32_t negishift ;
   49|       |
   50|  6.67M|	negishift = ((uint32_t) - i) >> 31 ;
   51|  6.67M|	return negishift | (i >> 31) ;
   52|  6.67M|}

unmix16:
   66|  1.02k|{
   67|  1.02k|	int32_t 	j ;
   68|       |
   69|  1.02k|	if (mixres != 0)
  ------------------
  |  Branch (69:6): [True: 423, False: 603]
  ------------------
   70|    423|	{
   71|       |		/* matrixed stereo */
   72|  1.97k|		for (j = 0 ; j < numSamples ; j++)
  ------------------
  |  Branch (72:16): [True: 1.55k, False: 423]
  ------------------
   73|  1.55k|		{
   74|  1.55k|			int32_t		l, r ;
   75|       |
   76|  1.55k|			l = u [j] + v [j] - ((mixres * v [j]) >> mixbits) ;
   77|  1.55k|			r = l - v [j] ;
   78|       |
   79|  1.55k|			out [0] = arith_shift_left (l, 16) ;
   80|  1.55k|			out [1] = arith_shift_left (r, 16) ;
   81|  1.55k|			out += stride ;
   82|  1.55k|		}
   83|    423|	}
   84|    603|	else
   85|    603|	{
   86|       |		/* Conventional separated stereo. */
   87|  29.4k|		for (j = 0 ; j < numSamples ; j++)
  ------------------
  |  Branch (87:16): [True: 28.8k, False: 603]
  ------------------
   88|  28.8k|		{
   89|  28.8k|			out [0] = u [j] << 16 ;
   90|  28.8k|			out [1] = v [j] << 16 ;
   91|  28.8k|			out += stride ;
   92|  28.8k|		}
   93|    603|	}
   94|  1.02k|}
unmix20:
  101|  1.07k|{
  102|  1.07k|	int32_t 	j ;
  103|       |
  104|  1.07k|	if (mixres != 0)
  ------------------
  |  Branch (104:6): [True: 455, False: 617]
  ------------------
  105|    455|	{
  106|       |		/* matrixed stereo */
  107|  5.21k|		for (j = 0 ; j < numSamples ; j++)
  ------------------
  |  Branch (107:16): [True: 4.75k, False: 455]
  ------------------
  108|  4.75k|		{
  109|  4.75k|			int32_t		l, r ;
  110|       |
  111|  4.75k|			l = u [j] + v [j] - ((mixres * v [j]) >> mixbits) ;
  112|  4.75k|			r = l - v [j] ;
  113|       |
  114|  4.75k|			out [0] = arith_shift_left (l, 12) ;
  115|  4.75k|			out [1] = arith_shift_left (r, 12) ;
  116|  4.75k|			out += stride ;
  117|  4.75k|		}
  118|    455|	}
  119|    617|	else
  120|    617|	{
  121|       |		/* Conventional separated stereo. */
  122|  5.86k|		for (j = 0 ; j < numSamples ; j++)
  ------------------
  |  Branch (122:16): [True: 5.24k, False: 617]
  ------------------
  123|  5.24k|		{
  124|  5.24k|			out [0] = arith_shift_left (u [j], 12) ;
  125|  5.24k|			out [1] = arith_shift_left (v [j], 12) ;
  126|  5.24k|			out += stride ;
  127|  5.24k|		}
  128|    617|	}
  129|  1.07k|}
unmix24:
  137|  1.46k|{
  138|  1.46k|	int32_t		shift = bytesShifted * 8 ;
  139|  1.46k|	int32_t		l, r ;
  140|  1.46k|	int32_t 		j, k ;
  141|       |
  142|  1.46k|	if (mixres != 0)
  ------------------
  |  Branch (142:6): [True: 661, False: 801]
  ------------------
  143|    661|	{
  144|       |		/* matrixed stereo */
  145|    661|		if (bytesShifted != 0)
  ------------------
  |  Branch (145:7): [True: 107, False: 554]
  ------------------
  146|    107|		{
  147|    897|			for (j = 0, k = 0 ; j < numSamples ; j++, k += 2)
  ------------------
  |  Branch (147:24): [True: 790, False: 107]
  ------------------
  148|    790|			{
  149|    790|				l = u [j] + v [j] - ((mixres * v [j]) >> mixbits) ;
  150|    790|				r = l - v [j] ;
  151|       |
  152|    790|				l = arith_shift_left (l, shift) | (uint32_t) shiftUV [k + 0] ;
  153|    790|				r = arith_shift_left (r, shift) | (uint32_t) shiftUV [k + 1] ;
  154|       |
  155|    790|				out [0] = arith_shift_left (l, 8) ;
  156|    790|				out [1] = arith_shift_left (r, 8) ;
  157|    790|				out += stride ;
  158|    790|			}
  159|    107|		}
  160|    554|		else
  161|    554|		{
  162|  5.73k|			for (j = 0 ; j < numSamples ; j++)
  ------------------
  |  Branch (162:17): [True: 5.18k, False: 554]
  ------------------
  163|  5.18k|			{
  164|  5.18k|				l = u [j] + v [j] - ((mixres * v [j]) >> mixbits) ;
  165|  5.18k|				r = l - v [j] ;
  166|       |
  167|  5.18k|				out [0] = l << 8 ;
  168|  5.18k|				out [1] = r << 8 ;
  169|  5.18k|				out += stride ;
  170|  5.18k|			}
  171|    554|		}
  172|    661|	}
  173|    801|	else
  174|    801|	{
  175|       |		/* Conventional separated stereo. */
  176|    801|		if (bytesShifted != 0)
  ------------------
  |  Branch (176:7): [True: 206, False: 595]
  ------------------
  177|    206|		{
  178|  1.14k|			for (j = 0, k = 0 ; j < numSamples ; j++, k += 2)
  ------------------
  |  Branch (178:24): [True: 942, False: 206]
  ------------------
  179|    942|			{
  180|    942|				l = u [j] ;
  181|    942|				r = v [j] ;
  182|       |
  183|    942|				l = (l << shift) | (uint32_t) shiftUV [k + 0] ;
  184|    942|				r = (r << shift) | (uint32_t) shiftUV [k + 1] ;
  185|       |
  186|    942|				out [0] = l << 8 ;
  187|    942|				out [1] = r << 8 ;
  188|    942|				out += stride ;
  189|    942|			}
  190|    206|		}
  191|    595|		else
  192|    595|		{
  193|  21.6k|			for (j = 0 ; j < numSamples ; j++)
  ------------------
  |  Branch (193:17): [True: 21.0k, False: 595]
  ------------------
  194|  21.0k|			{
  195|  21.0k|				out [0] = u [j] << 8 ;
  196|  21.0k|				out [1] = v [j] << 8 ;
  197|  21.0k|				out += stride ;
  198|  21.0k|			}
  199|    595|		}
  200|    801|	}
  201|  1.46k|}
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: 513, False: 980]
  ------------------
  217|    513|	{
  218|       |		//Assert (bytesShifted != 0) ;
  219|       |
  220|       |		/* matrixed stereo with shift */
  221|  1.52k|		for (j = 0, k = 0 ; j < numSamples ; j++, k += 2)
  ------------------
  |  Branch (221:23): [True: 1.01k, False: 513]
  ------------------
  222|  1.01k|		{
  223|  1.01k|			int32_t		lt, rt ;
  224|       |
  225|  1.01k|			lt = u [j] ;
  226|  1.01k|			rt = v [j] ;
  227|       |
  228|  1.01k|			l = lt + rt - ((mixres * rt) >> mixbits) ;
  229|  1.01k|			r = l - rt ;
  230|       |
  231|  1.01k|			out [0] = arith_shift_left (l, shift) | (uint32_t) shiftUV [k + 0] ;
  232|  1.01k|			out [1] = arith_shift_left (r, shift) | (uint32_t) shiftUV [k + 1] ;
  233|  1.01k|			out += stride ;
  234|  1.01k|		}
  235|    513|	}
  236|    980|	else
  237|    980|	{
  238|    980|		if (bytesShifted == 0)
  ------------------
  |  Branch (238:7): [True: 827, False: 153]
  ------------------
  239|    827|		{
  240|       |			/* interleaving w/o shift */
  241|  45.4k|			for (j = 0 ; j < numSamples ; j++)
  ------------------
  |  Branch (241:17): [True: 44.6k, False: 827]
  ------------------
  242|  44.6k|			{
  243|  44.6k|				out [0] = u [j] ;
  244|  44.6k|				out [1] = v [j] ;
  245|  44.6k|				out += stride ;
  246|  44.6k|			}
  247|    827|		}
  248|    153|		else
  249|    153|		{
  250|       |			/* interleaving with shift */
  251|    766|			for (j = 0, k = 0 ; j < numSamples ; j++, k += 2)
  ------------------
  |  Branch (251:24): [True: 613, False: 153]
  ------------------
  252|    613|			{
  253|    613|				out [0] = (u [j] << shift) | (uint32_t) shiftUV [k + 0] ;
  254|    613|				out [1] = (v [j] << shift) | (uint32_t) shiftUV [k + 1] ;
  255|    613|				out += stride ;
  256|    613|			}
  257|    153|		}
  258|    980|	}
  259|  1.49k|}
copyPredictorTo24:
  265|  4.77k|{
  266|  4.77k|	int32_t		j ;
  267|       |
  268|  1.37M|	for (j = 0 ; j < numSamples ; j++)
  ------------------
  |  Branch (268:15): [True: 1.37M, False: 4.77k]
  ------------------
  269|  1.37M|	{
  270|  1.37M|		out [0] = in [j] << 8 ;
  271|  1.37M|		out += stride ;
  272|  1.37M|	}
  273|  4.77k|}
copyPredictorTo24Shift:
  277|  1.07k|{
  278|  1.07k|	int32_t		shiftVal = bytesShifted * 8 ;
  279|  1.07k|	int32_t		j ;
  280|       |
  281|       |	//Assert (bytesShifted != 0) ;
  282|       |
  283|  3.79k|	for (j = 0 ; j < numSamples ; j++)
  ------------------
  |  Branch (283:15): [True: 2.71k, False: 1.07k]
  ------------------
  284|  2.71k|	{
  285|  2.71k|		int32_t		val = in [j] ;
  286|       |
  287|  2.71k|		val = arith_shift_left (val, shiftVal) | (uint32_t) shift [j] ;
  288|  2.71k|		out [0] = arith_shift_left (val, 8) ;
  289|  2.71k|		out += stride ;
  290|  2.71k|	}
  291|  1.07k|}
copyPredictorTo20:
  295|  2.15k|{
  296|  2.15k|	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|  90.7k|	for (j = 0 ; j < numSamples ; j++)
  ------------------
  |  Branch (300:15): [True: 88.5k, False: 2.15k]
  ------------------
  301|  88.5k|	{
  302|  88.5k|		out [0] = arith_shift_left (in [j], 12) ;
  303|  88.5k|		out += stride ;
  304|  88.5k|	}
  305|  2.15k|}
copyPredictorTo32:
  309|  3.24k|{
  310|  3.24k|	int32_t			i, j ;
  311|       |
  312|       |	// this is only a subroutine to abstract the "iPod can only output 16-bit data" problem
  313|   236k|	for (i = 0, j = 0 ; i < numSamples ; i++, j += stride)
  ------------------
  |  Branch (313:22): [True: 233k, False: 3.24k]
  ------------------
  314|   233k|		out [j] = arith_shift_left (in [i], 8) ;
  315|  3.24k|}
copyPredictorTo32Shift:
  319|  1.82k|{
  320|  1.82k|	int32_t *		op = out ;
  321|  1.82k|	uint32_t		shiftVal = bytesShifted * 8 ;
  322|  1.82k|	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.26k|	for (j = 0 ; j < numSamples ; j++)
  ------------------
  |  Branch (327:15): [True: 3.44k, False: 1.82k]
  ------------------
  328|  3.44k|	{
  329|  3.44k|		op [0] = arith_shift_left (in [j], shiftVal) | (uint32_t) shift [j] ;
  330|  3.44k|		op += stride ;
  331|  3.44k|	}
  332|  1.82k|}

alac_decoder.c:arith_shift_left:
   30|   597k|{	return (int32_t) (((uint32_t) x) << shift) ;
   31|   597k|} /* arith_shift_left */
dp_dec.c:arith_shift_left:
   30|  1.07M|{	return (int32_t) (((uint32_t) x) << shift) ;
   31|  1.07M|} /* arith_shift_left */
matrix_dec.c:arith_shift_left:
   30|   358k|{	return (int32_t) (((uint32_t) x) << shift) ;
   31|   358k|} /* arith_shift_left */

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

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

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

private_init_state:
  114|    526|{
  115|    526|	int		cnta ;
  116|       |
  117|    526|	state_ptr->yl = 34816 ;
  118|    526|	state_ptr->yu = 544 ;
  119|    526|	state_ptr->dms = 0 ;
  120|    526|	state_ptr->dml = 0 ;
  121|    526|	state_ptr->ap = 0 ;
  122|  1.57k|	for (cnta = 0 ; cnta < 2 ; cnta++)
  ------------------
  |  Branch (122:18): [True: 1.05k, False: 526]
  ------------------
  123|  1.05k|	{	state_ptr->a [cnta] = 0 ;
  124|  1.05k|		state_ptr->pk [cnta] = 0 ;
  125|  1.05k|		state_ptr->sr [cnta] = 32 ;
  126|  1.05k|		}
  127|  3.68k|	for (cnta = 0 ; cnta < 6 ; cnta++)
  ------------------
  |  Branch (127:18): [True: 3.15k, False: 526]
  ------------------
  128|  3.15k|	{	state_ptr->b [cnta] = 0 ;
  129|  3.15k|		state_ptr->dq [cnta] = 32 ;
  130|  3.15k|		}
  131|    526|	state_ptr->td = 0 ;
  132|    526|}	/* private_init_state */
g72x_reader_init:
  135|    526|{	G72x_STATE *pstate ;
  136|       |
  137|    526|	if ((pstate = g72x_state_new ()) == NULL)
  ------------------
  |  Branch (137:6): [True: 0, False: 526]
  ------------------
  138|      0|		return NULL ;
  139|       |
  140|    526|	private_init_state (pstate) ;
  141|       |
  142|    526|	pstate->encoder = NULL ;
  143|       |
  144|    526|	switch (codec)
  145|    526|	{	case G723_16_BITS_PER_SAMPLE : /* 2 bits per sample. */
  ------------------
  |  Branch (145:4): [True: 0, False: 526]
  ------------------
  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: 192]
  ------------------
  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|    110|		case G721_32_BITS_PER_SAMPLE : /* 4 bits per sample. */
  ------------------
  |  Branch (163:3): [True: 110, False: 416]
  ------------------
  164|    110|				pstate->decoder = g721_decoder ;
  165|    110|				*blocksize = G721_32_BYTES_PER_BLOCK ;
  166|    110|				*samplesperblock = G721_32_SAMPLES_PER_BLOCK ;
  167|    110|				pstate->codec_bits = 4 ;
  168|    110|				pstate->blocksize = G721_32_BYTES_PER_BLOCK ;
  169|    110|				pstate->samplesperblock = G721_32_SAMPLES_PER_BLOCK ;
  170|    110|				break ;
  171|       |
  172|     82|		case G721_40_BITS_PER_SAMPLE : /* 5 bits per sample. */
  ------------------
  |  Branch (172:3): [True: 82, False: 444]
  ------------------
  173|     82|				pstate->decoder = g723_40_decoder ;
  174|     82|				*blocksize = G721_40_BYTES_PER_BLOCK ;
  175|     82|				*samplesperblock = G721_40_SAMPLES_PER_BLOCK ;
  176|     82|				pstate->codec_bits = 5 ;
  177|     82|				pstate->blocksize = G721_40_BYTES_PER_BLOCK ;
  178|     82|				pstate->samplesperblock = G721_40_SAMPLES_PER_BLOCK ;
  179|     82|				break ;
  180|       |
  181|      0|		default :
  ------------------
  |  Branch (181:3): [True: 0, False: 526]
  ------------------
  182|      0|				free (pstate) ;
  183|      0|				return NULL ;
  184|    526|		} ;
  185|       |
  186|    526|	return pstate ;
  187|    526|}	/* g72x_reader_init */
g72x_decode_block:
  244|  6.88k|{	int	k, count ;
  245|       |
  246|  6.88k|	count = unpack_bytes (pstate->codec_bits, pstate->blocksize, block, samples) ;
  247|       |
  248|   832k|	for (k = 0 ; k < count ; k++)
  ------------------
  |  Branch (248:15): [True: 826k, False: 6.88k]
  ------------------
  249|   826k|		samples [k] = pstate->decoder (samples [k], pstate) ;
  250|       |
  251|  6.88k|	return 0 ;
  252|  6.88k|}	/* g72x_decode_block */
predictor_zero:
  272|   826k|{
  273|   826k|	int		i ;
  274|   826k|	int		sezi ;
  275|       |
  276|   826k|	sezi = fmult (state_ptr->b [0] >> 2, state_ptr->dq [0]) ;
  277|  4.95M|	for (i = 1 ; i < 6 ; i++)			/* ACCUM */
  ------------------
  |  Branch (277:15): [True: 4.13M, False: 826k]
  ------------------
  278|  4.13M|		sezi += fmult (state_ptr->b [i] >> 2, state_ptr->dq [i]) ;
  279|   826k|	return sezi ;
  280|   826k|}
predictor_pole:
  288|   826k|{
  289|   826k|	return (fmult (state_ptr->a [1] >> 2, state_ptr->sr [1]) +
  290|   826k|			fmult (state_ptr->a [0] >> 2, state_ptr->sr [0])) ;
  291|   826k|}
step_size:
  299|   826k|{
  300|   826k|	int		y ;
  301|   826k|	int		dif ;
  302|   826k|	int		al ;
  303|       |
  304|   826k|	if (state_ptr->ap >= 256)
  ------------------
  |  Branch (304:6): [True: 519k, False: 306k]
  ------------------
  305|   519k|		return (state_ptr->yu) ;
  306|   306k|	else {
  307|   306k|		y = state_ptr->yl >> 6 ;
  308|   306k|		dif = state_ptr->yu - y ;
  309|   306k|		al = state_ptr->ap >> 2 ;
  310|   306k|		if (dif > 0)
  ------------------
  |  Branch (310:7): [True: 110k, False: 195k]
  ------------------
  311|   110k|			y += (dif * al) >> 6 ;
  312|   195k|		else if (dif < 0)
  ------------------
  |  Branch (312:12): [True: 192k, False: 3.27k]
  ------------------
  313|   192k|			y += (dif * al + 0x3F) >> 6 ;
  314|   306k|		return y ;
  315|   306k|	}
  316|   826k|}
reconstruct:
  382|   826k|{
  383|   826k|	short		dql ;	/* Log of 'dq' magnitude */
  384|   826k|	short		dex ;	/* Integer part of log */
  385|   826k|	short		dqt ;
  386|   826k|	short		dq ;	/* Reconstructed difference signal sample */
  387|       |
  388|   826k|	dql = dqln + (y >> 2) ;	/* ADDA */
  389|       |
  390|   826k|	if (dql < 0)
  ------------------
  |  Branch (390:6): [True: 396k, False: 429k]
  ------------------
  391|   396k|		return ((sign) ? -0x8000 : 0) ;
  ------------------
  |  Branch (391:11): [True: 213k, False: 183k]
  ------------------
  392|   429k|	else		/* ANTILOG */
  393|   429k|	{	dex = (dql >> 7) & 15 ;
  394|   429k|		dqt = 128 + (dql & 127) ;
  395|   429k|		dq = (dqt << 7) >> (14 - dex) ;
  396|   429k|		return ((sign) ? (dq - 0x8000) : dq) ;
  ------------------
  |  Branch (396:11): [True: 198k, False: 230k]
  ------------------
  397|   429k|		}
  398|   826k|}
update:
  416|   826k|{
  417|   826k|	int		cnt ;
  418|   826k|	short		mag, expon ;	/* Adaptive predictor, FLOAT A */
  419|   826k|	short		a2p = 0 ;	/* LIMC */
  420|   826k|	short		a1ul ;		/* UPA1 */
  421|   826k|	short		pks1 ;		/* UPA2 */
  422|   826k|	short		fa1 ;
  423|   826k|	char		tr ;		/* tone/transition detector */
  424|   826k|	short		ylint, thr2, dqthr ;
  425|   826k|	short		ylfrac, thr1 ;
  426|   826k|	short		pk0 ;
  427|       |
  428|   826k|	pk0 = (dqsez < 0) ? 1 : 0 ;	/* needed in updating predictor poles */
  ------------------
  |  Branch (428:8): [True: 310k, False: 515k]
  ------------------
  429|       |
  430|   826k|	mag = dq & 0x7FFF ;		/* prediction difference magnitude */
  431|       |	/* TRANS */
  432|   826k|	ylint = state_ptr->yl >> 15 ;	/* exponent part of yl */
  433|   826k|	ylfrac = (state_ptr->yl >> 10) & 0x1F ;	/* fractional part of yl */
  434|   826k|	thr1 = (32 + ylfrac) << ylint ;		/* threshold */
  435|   826k|	thr2 = (ylint > 9) ? 31 << 10 : thr1 ;	/* limit thr2 to 31 << 10 */
  ------------------
  |  Branch (435:9): [True: 0, False: 826k]
  ------------------
  436|   826k|	dqthr = (thr2 + (thr2 >> 1)) >> 1 ;	/* dqthr = 0.75 * thr2 */
  437|   826k|	if (state_ptr->td == 0)		/* signal supposed voice */
  ------------------
  |  Branch (437:6): [True: 759k, False: 66.5k]
  ------------------
  438|   759k|		tr = 0 ;
  439|  66.5k|	else if (mag <= dqthr)		/* supposed data, but small mag */
  ------------------
  |  Branch (439:11): [True: 65.7k, False: 841]
  ------------------
  440|  65.7k|		tr = 0 ;			/* treated as voice */
  441|    841|	else				/* signal is data (modem) */
  442|    841|		tr = 1 ;
  443|       |
  444|       |	/*
  445|       |	 * Quantizer scale factor adaptation.
  446|       |	 */
  447|       |
  448|       |	/* FUNCTW & FILTD & DELAY */
  449|       |	/* update non-steady state step size multiplier */
  450|   826k|	state_ptr->yu = y + ((wi - y) >> 5) ;
  451|       |
  452|       |	/* LIMB */
  453|   826k|	if (state_ptr->yu < 544)	/* 544 <= yu <= 5120 */
  ------------------
  |  Branch (453:6): [True: 82.9k, False: 743k]
  ------------------
  454|  82.9k|		state_ptr->yu = 544 ;
  455|   743k|	else if (state_ptr->yu > 5120)
  ------------------
  |  Branch (455:11): [True: 66.5k, False: 676k]
  ------------------
  456|  66.5k|		state_ptr->yu = 5120 ;
  457|       |
  458|       |	/* FILTE & DELAY */
  459|       |	/* update steady state step size multiplier */
  460|   826k|	state_ptr->yl += state_ptr->yu + ((-state_ptr->yl) >> 6) ;
  461|       |
  462|       |	/*
  463|       |	 * Adaptive predictor coefficients.
  464|       |	 */
  465|   826k|	if (tr == 1) {			/* reset a's and b's for modem signal */
  ------------------
  |  Branch (465:6): [True: 841, False: 825k]
  ------------------
  466|    841|		state_ptr->a [0] = 0 ;
  467|    841|		state_ptr->a [1] = 0 ;
  468|    841|		state_ptr->b [0] = 0 ;
  469|    841|		state_ptr->b [1] = 0 ;
  470|    841|		state_ptr->b [2] = 0 ;
  471|    841|		state_ptr->b [3] = 0 ;
  472|    841|		state_ptr->b [4] = 0 ;
  473|    841|		state_ptr->b [5] = 0 ;
  474|    841|		}
  475|   825k|	else			/* update a's and b's */
  476|   825k|	{	pks1 = pk0 ^ state_ptr->pk [0] ;		/* UPA2 */
  477|       |
  478|       |		/* update predictor pole a [1] */
  479|   825k|		a2p = state_ptr->a [1] - (state_ptr->a [1] >> 7) ;
  480|   825k|		if (dqsez != 0)
  ------------------
  |  Branch (480:7): [True: 624k, False: 200k]
  ------------------
  481|   624k|		{	fa1 = (pks1) ? state_ptr->a [0] : -state_ptr->a [0] ;
  ------------------
  |  Branch (481:11): [True: 255k, False: 369k]
  ------------------
  482|   624k|			if (fa1 < -8191)	/* a2p = function of fa1 */
  ------------------
  |  Branch (482:8): [True: 206k, False: 418k]
  ------------------
  483|   206k|				a2p -= 0x100 ;
  484|   418k|			else if (fa1 > 8191)
  ------------------
  |  Branch (484:13): [True: 81.5k, False: 336k]
  ------------------
  485|  81.5k|				a2p += 0xFF ;
  486|   336k|			else
  487|   336k|				a2p += fa1 >> 5 ;
  488|       |
  489|   624k|			if (pk0 ^ state_ptr->pk [1])
  ------------------
  |  Branch (489:8): [True: 357k, False: 267k]
  ------------------
  490|   357k|			{	/* LIMC */
  491|   357k|				if (a2p <= -12160)
  ------------------
  |  Branch (491:9): [True: 22.4k, False: 334k]
  ------------------
  492|  22.4k|					a2p = -12288 ;
  493|   334k|				else if (a2p >= 12416)
  ------------------
  |  Branch (493:14): [True: 0, False: 334k]
  ------------------
  494|      0|					a2p = 12288 ;
  495|   334k|				else
  496|   334k|					a2p -= 0x80 ;
  497|   357k|				}
  498|   267k|			else if (a2p <= -12416)
  ------------------
  |  Branch (498:13): [True: 13.2k, False: 254k]
  ------------------
  499|  13.2k|				a2p = -12288 ;
  500|   254k|			else if (a2p >= 12160)
  ------------------
  |  Branch (500:13): [True: 233, False: 253k]
  ------------------
  501|    233|				a2p = 12288 ;
  502|   253k|			else
  503|   253k|				a2p += 0x80 ;
  504|   624k|		}
  505|       |
  506|       |		/* TRIGB & DELAY */
  507|   825k|		state_ptr->a [1] = a2p ;
  508|       |
  509|       |		/* UPA1 */
  510|       |		/* update predictor pole a [0] */
  511|   825k|		state_ptr->a [0] -= state_ptr->a [0] >> 8 ;
  512|   825k|		if (dqsez != 0)
  ------------------
  |  Branch (512:7): [True: 624k, False: 200k]
  ------------------
  513|   624k|		{	if (pks1 == 0)
  ------------------
  |  Branch (513:9): [True: 369k, False: 255k]
  ------------------
  514|   369k|				state_ptr->a [0] += 192 ;
  515|   255k|			else
  516|   255k|				state_ptr->a [0] -= 192 ;
  517|   624k|			} ;
  518|       |
  519|       |		/* LIMD */
  520|   825k|		a1ul = 15360 - a2p ;
  521|   825k|		if (state_ptr->a [0] < -a1ul)
  ------------------
  |  Branch (521:7): [True: 1.88k, False: 823k]
  ------------------
  522|  1.88k|			state_ptr->a [0] = -a1ul ;
  523|   823k|		else if (state_ptr->a [0] > a1ul)
  ------------------
  |  Branch (523:12): [True: 1.72k, False: 821k]
  ------------------
  524|  1.72k|			state_ptr->a [0] = a1ul ;
  525|       |
  526|       |		/* UPB : update predictor zeros b [6] */
  527|  5.77M|		for (cnt = 0 ; cnt < 6 ; cnt++)
  ------------------
  |  Branch (527:18): [True: 4.95M, False: 825k]
  ------------------
  528|  4.95M|		{	if (code_size == 5)		/* for 40Kbps G.723 */
  ------------------
  |  Branch (528:9): [True: 1.29M, False: 3.66M]
  ------------------
  529|  1.29M|				state_ptr->b [cnt] -= state_ptr->b [cnt] >> 9 ;
  530|  3.66M|			else			/* for G.721 and 24Kbps G.723 */
  531|  3.66M|				state_ptr->b [cnt] -= state_ptr->b [cnt] >> 8 ;
  532|  4.95M|			if (dq & 0x7FFF)			/* XOR */
  ------------------
  |  Branch (532:8): [True: 2.57M, False: 2.38M]
  ------------------
  533|  2.57M|			{	if ((dq ^ state_ptr->dq [cnt]) >= 0)
  ------------------
  |  Branch (533:10): [True: 1.25M, False: 1.31M]
  ------------------
  534|  1.25M|					state_ptr->b [cnt] += 128 ;
  535|  1.31M|				else
  536|  1.31M|					state_ptr->b [cnt] -= 128 ;
  537|  2.57M|				}
  538|  4.95M|			}
  539|   825k|		}
  540|       |
  541|  4.95M|	for (cnt = 5 ; cnt > 0 ; cnt--)
  ------------------
  |  Branch (541:17): [True: 4.13M, False: 826k]
  ------------------
  542|  4.13M|		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|   826k|	if (mag == 0)
  ------------------
  |  Branch (544:6): [True: 396k, False: 429k]
  ------------------
  545|   396k|		state_ptr->dq [0] = (dq >= 0) ? 0x20 : 0xFC20 ;
  ------------------
  |  Branch (545:23): [True: 183k, False: 213k]
  ------------------
  546|   429k|	else
  547|   429k|	{	expon = quan (mag, power2, 15) ;
  548|   429k|		state_ptr->dq [0] = (dq >= 0) ?
  ------------------
  |  Branch (548:23): [True: 230k, False: 198k]
  ------------------
  549|   230k|			(expon << 6) + ((mag << 6) >> expon) :
  550|   429k|			(expon << 6) + ((mag << 6) >> expon) - 0x400 ;
  551|   429k|		}
  552|       |
  553|   826k|	state_ptr->sr [1] = state_ptr->sr [0] ;
  554|       |	/* FLOAT B : convert sr to 4-bit exp., 6-bit mantissa f.p. */
  555|   826k|	if (sr == 0)
  ------------------
  |  Branch (555:6): [True: 135k, False: 690k]
  ------------------
  556|   135k|		state_ptr->sr [0] = 0x20 ;
  557|   690k|	else if (sr > 0)
  ------------------
  |  Branch (557:11): [True: 342k, False: 348k]
  ------------------
  558|   342k|	{	expon = quan (sr, power2, 15) ;
  559|   342k|		state_ptr->sr [0] = (expon << 6) + ((sr << 6) >> expon) ;
  560|   342k|		}
  561|   348k|	else if (sr > -32768)
  ------------------
  |  Branch (561:11): [True: 347k, False: 68]
  ------------------
  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|     68|	else
  567|     68|		state_ptr->sr [0] = (short) 0xFC20 ;
  568|       |
  569|       |	/* DELAY A */
  570|   826k|	state_ptr->pk [1] = state_ptr->pk [0] ;
  571|   826k|	state_ptr->pk [0] = pk0 ;
  572|       |
  573|       |	/* TONE */
  574|   826k|	if (tr == 1)		/* this sample has been treated as data */
  ------------------
  |  Branch (574:6): [True: 841, False: 825k]
  ------------------
  575|    841|		state_ptr->td = 0 ;	/* next one will be treated as voice */
  576|   825k|	else if (a2p < -11776)	/* small sample-to-sample correlation */
  ------------------
  |  Branch (576:11): [True: 66.6k, False: 758k]
  ------------------
  577|  66.6k|		state_ptr->td = 1 ;	/* signal may be data */
  578|   758k|	else				/* signal is voice */
  579|   758k|		state_ptr->td = 0 ;
  580|       |
  581|       |	/*
  582|       |	 * Adaptation speed control.
  583|       |	 */
  584|   826k|	state_ptr->dms += (fi - state_ptr->dms) >> 5 ;		/* FILTA */
  585|   826k|	state_ptr->dml += (((fi << 2) - state_ptr->dml) >> 7) ;	/* FILTB */
  586|       |
  587|   826k|	if (tr == 1)
  ------------------
  |  Branch (587:6): [True: 841, False: 825k]
  ------------------
  588|    841|		state_ptr->ap = 256 ;
  589|   825k|	else if (y < 1536)					/* SUBTC */
  ------------------
  |  Branch (589:11): [True: 138k, False: 686k]
  ------------------
  590|   138k|		state_ptr->ap += (0x200 - state_ptr->ap) >> 4 ;
  591|   686k|	else if (state_ptr->td == 1)
  ------------------
  |  Branch (591:11): [True: 65.9k, False: 621k]
  ------------------
  592|  65.9k|		state_ptr->ap += (0x200 - state_ptr->ap) >> 4 ;
  593|   621k|	else if (abs ((state_ptr->dms << 2) - state_ptr->dml) >= (state_ptr->dml >> 3))
  ------------------
  |  Branch (593:11): [True: 317k, False: 303k]
  ------------------
  594|   317k|		state_ptr->ap += (0x200 - state_ptr->ap) >> 4 ;
  595|   303k|	else
  596|   303k|		state_ptr->ap += (-state_ptr->ap) >> 4 ;
  597|       |
  598|   826k|	return ;
  599|   826k|} /* update */
g72x.c:g72x_state_new:
  103|    526|{	return calloc (1, sizeof (G72x_STATE)) ;
  104|    526|}
g72x.c:fmult:
   77|  6.60M|{
   78|  6.60M|	short		anmag, anexp, anmant ;
   79|  6.60M|	short		wanexp, wanmant ;
   80|  6.60M|	short		retval ;
   81|       |
   82|  6.60M|	anmag = (an > 0) ? an : ((-an) & 0x1FFF) ;
  ------------------
  |  Branch (82:10): [True: 2.75M, False: 3.85M]
  ------------------
   83|  6.60M|	anexp = quan (anmag, power2, 15) - 6 ;
   84|  6.60M|	anmant = (anmag == 0) ? 32 :
  ------------------
  |  Branch (84:11): [True: 233k, False: 6.37M]
  ------------------
   85|  6.60M|				(anexp >= 0) ? anmag >> anexp : anmag << -anexp ;
  ------------------
  |  Branch (85:5): [True: 5.97M, False: 396k]
  ------------------
   86|  6.60M|	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.60M|	wanmant = (anmant * (srn & 0x3F)) >> 4 ;
   96|       |
   97|  6.60M|	retval = (wanexp >= 0) ? ((wanmant << wanexp) & 0x7FFF) : (wanmant >> -wanexp) ;
  ------------------
  |  Branch (97:11): [True: 2.53M, False: 4.07M]
  ------------------
   98|       |
   99|  6.60M|	return (((an ^ srn) < 0) ? -retval : retval) ;
  ------------------
  |  Branch (99:10): [True: 3.09M, False: 3.51M]
  ------------------
  100|  6.60M|}
g72x.c:quan:
   60|  7.72M|{
   61|  7.72M|	int		i ;
   62|       |
   63|  76.9M|	for (i = 0 ; i < size ; i++)
  ------------------
  |  Branch (63:15): [True: 76.8M, False: 56.4k]
  ------------------
   64|  76.8M|		if (val < *table++)
  ------------------
  |  Branch (64:7): [True: 7.67M, False: 69.1M]
  ------------------
   65|  7.67M|			break ;
   66|  7.72M|	return i ;
   67|  7.72M|}
g72x.c:unpack_bytes:
  606|  6.88k|{	unsigned int	in_buffer = 0 ;
  607|  6.88k|	unsigned char	in_byte ;
  608|  6.88k|	int				k, in_bits = 0, bindex = 0 ;
  609|       |
  610|   832k|	for (k = 0 ; bindex <= blocksize && k < G72x_BLOCK_SIZE ; k++)
  ------------------
  |  |   32|   832k|#define	G72x_BLOCK_SIZE		(3 * 5 * 8)
  ------------------
  |  Branch (610:15): [True: 832k, False: 0]
  |  Branch (610:38): [True: 826k, False: 6.88k]
  ------------------
  611|   826k|	{	if (in_bits < bits)
  ------------------
  |  Branch (611:8): [True: 367k, False: 458k]
  ------------------
  612|   367k|		{	in_byte = block [bindex++] ;
  613|       |
  614|   367k|			in_buffer |= (in_byte << in_bits) ;
  615|   367k|			in_bits += 8 ;
  616|   367k|			}
  617|   826k|		samples [k] = in_buffer & ((1 << bits) - 1) ;
  618|   826k|		in_buffer >>= bits ;
  619|   826k|		in_bits -= bits ;
  620|   826k|		} ;
  621|       |
  622|  6.88k|	return k ;
  623|  6.88k|} /* unpack_bytes */

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

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

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

decode.c:GSM_MULT_R:
  118|  1.98M|{	return (((int32_t) (a)) * ((int32_t) (b)) + 16384) >> 15 ;
  119|  1.98M|} /* GSM_MULT_R */
decode.c:GSM_ADD:
  150|  3.96M|{	int32_t ltmp ;
  151|       |
  152|  3.96M|	ltmp = ((int32_t) a) + ((int32_t) b) ;
  153|       |
  154|  3.96M|	if (ltmp >= MAX_WORD)
  ------------------
  |  |   52|  3.96M|#define	MAX_WORD	32767
  ------------------
  |  Branch (154:6): [True: 576k, False: 3.39M]
  ------------------
  155|   576k|		return MAX_WORD ;
  ------------------
  |  |   52|   576k|#define	MAX_WORD	32767
  ------------------
  156|  3.39M|	if (ltmp <= MIN_WORD)
  ------------------
  |  |   51|  3.39M|#define	MIN_WORD	(-32767 - 1)
  ------------------
  |  Branch (156:6): [True: 410k, False: 2.98M]
  ------------------
  157|   410k|		return MIN_WORD ;
  ------------------
  |  |   51|   410k|#define	MIN_WORD	(-32767 - 1)
  ------------------
  158|       |
  159|  2.98M|	return ltmp ;
  160|  3.39M|} /* GSM_ADD */
long_term.c:GSM_MULT_R:
  118|  1.98M|{	return (((int32_t) (a)) * ((int32_t) (b)) + 16384) >> 15 ;
  119|  1.98M|} /* GSM_MULT_R */
long_term.c:GSM_ADD:
  150|  1.98M|{	int32_t ltmp ;
  151|       |
  152|  1.98M|	ltmp = ((int32_t) a) + ((int32_t) b) ;
  153|       |
  154|  1.98M|	if (ltmp >= MAX_WORD)
  ------------------
  |  |   52|  1.98M|#define	MAX_WORD	32767
  ------------------
  |  Branch (154:6): [True: 54.9k, False: 1.92M]
  ------------------
  155|  54.9k|		return MAX_WORD ;
  ------------------
  |  |   52|  54.9k|#define	MAX_WORD	32767
  ------------------
  156|  1.92M|	if (ltmp <= MIN_WORD)
  ------------------
  |  |   51|  1.92M|#define	MIN_WORD	(-32767 - 1)
  ------------------
  |  Branch (156:6): [True: 1.07k, False: 1.92M]
  ------------------
  157|  1.07k|		return MIN_WORD ;
  ------------------
  |  |   51|  1.07k|#define	MIN_WORD	(-32767 - 1)
  ------------------
  158|       |
  159|  1.92M|	return ltmp ;
  160|  1.92M|} /* GSM_ADD */
rpe.c:SASR_W:
   60|  41.9k|{	if (x >= 0)
  ------------------
  |  Branch (60:7): [True: 41.9k, False: 0]
  ------------------
   61|  41.9k|		return x >> by ;
   62|      0|	return ~ ((~x) >> by) ;
   63|  41.9k|} /* SASR_W */
rpe.c:arith_shift_left:
  306|   644k|{	return (int32_t) (((uint32_t) x) << shift) ;
  307|   644k|} /* arith_shift_left */
rpe.c:GSM_MULT_R:
  118|   644k|{	return (((int32_t) (a)) * ((int32_t) (b)) + 16384) >> 15 ;
  119|   644k|} /* GSM_MULT_R */
rpe.c:GSM_ADD:
  150|   644k|{	int32_t ltmp ;
  151|       |
  152|   644k|	ltmp = ((int32_t) a) + ((int32_t) b) ;
  153|       |
  154|   644k|	if (ltmp >= MAX_WORD)
  ------------------
  |  |   52|   644k|#define	MAX_WORD	32767
  ------------------
  |  Branch (154:6): [True: 0, False: 644k]
  ------------------
  155|      0|		return MAX_WORD ;
  ------------------
  |  |   52|      0|#define	MAX_WORD	32767
  ------------------
  156|   644k|	if (ltmp <= MIN_WORD)
  ------------------
  |  |   51|   644k|#define	MIN_WORD	(-32767 - 1)
  ------------------
  |  Branch (156:6): [True: 0, False: 644k]
  ------------------
  157|      0|		return MIN_WORD ;
  ------------------
  |  |   51|      0|#define	MIN_WORD	(-32767 - 1)
  ------------------
  158|       |
  159|   644k|	return ltmp ;
  160|   644k|} /* GSM_ADD */
short_term.c:arith_shift_left:
  306|  99.1k|{	return (int32_t) (((uint32_t) x) << shift) ;
  307|  99.1k|} /* arith_shift_left */
short_term.c:GSM_ADD:
  150|  16.5M|{	int32_t ltmp ;
  151|       |
  152|  16.5M|	ltmp = ((int32_t) a) + ((int32_t) b) ;
  153|       |
  154|  16.5M|	if (ltmp >= MAX_WORD)
  ------------------
  |  |   52|  16.5M|#define	MAX_WORD	32767
  ------------------
  |  Branch (154:6): [True: 118k, False: 16.4M]
  ------------------
  155|   118k|		return MAX_WORD ;
  ------------------
  |  |   52|   118k|#define	MAX_WORD	32767
  ------------------
  156|  16.4M|	if (ltmp <= MIN_WORD)
  ------------------
  |  |   51|  16.4M|#define	MIN_WORD	(-32767 - 1)
  ------------------
  |  Branch (156:6): [True: 13.1k, False: 16.4M]
  ------------------
  157|  13.1k|		return MIN_WORD ;
  ------------------
  |  |   51|  13.1k|#define	MIN_WORD	(-32767 - 1)
  ------------------
  158|       |
  159|  16.4M|	return ltmp ;
  160|  16.4M|} /* GSM_ADD */
short_term.c:GSM_SUB:
  164|  15.9M|{	int32_t ltmp ;
  165|       |
  166|  15.9M|	ltmp = ((int32_t) a) - ((int32_t) b) ;
  167|       |
  168|  15.9M|	if (ltmp >= MAX_WORD)
  ------------------
  |  |   52|  15.9M|#define	MAX_WORD	32767
  ------------------
  |  Branch (168:6): [True: 238k, False: 15.7M]
  ------------------
  169|   238k|		ltmp = MAX_WORD ;
  ------------------
  |  |   52|   238k|#define	MAX_WORD	32767
  ------------------
  170|  15.7M|	else if (ltmp <= MIN_WORD)
  ------------------
  |  |   51|  15.7M|#define	MIN_WORD	(-32767 - 1)
  ------------------
  |  Branch (170:11): [True: 133k, False: 15.5M]
  ------------------
  171|   133k|		ltmp = MIN_WORD ;
  ------------------
  |  |   51|   133k|#define	MIN_WORD	(-32767 - 1)
  ------------------
  172|       |
  173|  15.9M|	return ltmp ;
  174|  15.9M|} /* GSM_SUB */
short_term.c:GSM_MULT_R:
  118|  99.1k|{	return (((int32_t) (a)) * ((int32_t) (b)) + 16384) >> 15 ;
  119|  99.1k|} /* GSM_MULT_R */
short_term.c:SASR_W:
   60|   793k|{	if (x >= 0)
  ------------------
  |  Branch (60:7): [True: 400k, False: 393k]
  ------------------
   61|   400k|		return x >> by ;
   62|   393k|	return ~ ((~x) >> by) ;
   63|   793k|} /* SASR_W */
add.c:SASR_W:
   60|   652k|{	if (x >= 0)
  ------------------
  |  Branch (60:7): [True: 340k, False: 312k]
  ------------------
   61|   340k|		return x >> by ;
   62|   312k|	return ~ ((~x) >> by) ;
   63|   652k|} /* SASR_W */

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

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

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

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

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

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

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

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

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

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

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

audio_detect:
   48|  2.49k|{	VOTE vote ;
   49|       |
   50|  2.49k|	if (psf == NULL)
  ------------------
  |  Branch (50:6): [True: 0, False: 2.49k]
  ------------------
   51|      0|		return 0 ;
   52|       |
   53|  2.49k|	if (ad == NULL || datalen < 256)
  ------------------
  |  Branch (53:6): [True: 0, False: 2.49k]
  |  Branch (53:20): [True: 0, False: 2.49k]
  ------------------
   54|      0|		return 0 ;
   55|       |
   56|  2.49k|	vote_for_format (&vote, data, datalen) ;
   57|       |
   58|  2.49k|	psf_log_printf (psf, "audio_detect :\n"
   59|  2.49k|			"    le_float     : %d\n"
   60|  2.49k|			"    be_float     : %d\n"
   61|  2.49k|			"    le_int_24_32 : %d\n"
   62|  2.49k|			"    be_int_24_32 : %d\n",
   63|  2.49k|			vote.le_float, vote.be_float, vote.le_int_24_32, vote.be_int_24_32) ;
   64|       |
   65|  2.49k|	if (0) puts (psf->parselog.buf) ;
  ------------------
  |  Branch (65:6): [Folded, False: 2.49k]
  ------------------
   66|       |
   67|  2.49k|	if (ad->endianness == SF_ENDIAN_LITTLE && vote.le_float > (3 * datalen) / 4)
  ------------------
  |  Branch (67:6): [True: 2.49k, False: 0]
  |  Branch (67:44): [True: 7, False: 2.48k]
  ------------------
   68|      7|	{	/* Almost certainly 32 bit floats. */
   69|      7|		return SF_FORMAT_FLOAT ;
   70|  2.48k|		} ;
   71|       |
   72|  2.48k|	if (ad->endianness == SF_ENDIAN_LITTLE && vote.le_int_24_32 > (3 * datalen) / 4)
  ------------------
  |  Branch (72:6): [True: 2.48k, False: 0]
  |  Branch (72:44): [True: 12, False: 2.47k]
  ------------------
   73|     12|	{	/* Almost certainly 24 bit data stored in 32 bit ints. */
   74|     12|		return SF_FORMAT_PCM_32 ;
   75|  2.47k|		} ;
   76|       |
   77|  2.47k|	return 0 ;
   78|  2.48k|} /* data_detect */
audio_detect.c:vote_for_format:
   82|  2.49k|{
   83|  2.49k|	int k ;
   84|       |
   85|  2.49k|	memset (vote, 0, sizeof (VOTE)) ;
   86|       |
   87|  2.49k|	datalen -= datalen % 4 ;
   88|       |
   89|  10.2M|	for (k = 0 ; k < datalen ; k ++)
  ------------------
  |  Branch (89:15): [True: 10.1M, False: 2.49k]
  ------------------
   90|  10.1M|	{	if ((k % 4) == 0)
  ------------------
  |  Branch (90:8): [True: 2.54M, False: 7.64M]
  ------------------
   91|  2.54M|		{	if (data [k] == 0 && data [k + 1] != 0)
  ------------------
  |  Branch (91:9): [True: 2.42M, False: 120k]
  |  Branch (91:26): [True: 15.6k, False: 2.41M]
  ------------------
   92|  15.6k|				vote->le_int_24_32 += 4 ;
   93|       |
   94|  2.54M|			if (data [2] != 0 && data [3] == 0)
  ------------------
  |  Branch (94:8): [True: 119k, False: 2.42M]
  |  Branch (94:25): [True: 12.2k, False: 107k]
  ------------------
   95|  12.2k|				vote->le_int_24_32 += 4 ;
   96|       |
   97|  2.54M|			if (data [0] != 0 && data [3] > 0x43 && data [3] < 0x4B)
  ------------------
  |  Branch (97:8): [True: 125k, False: 2.42M]
  |  Branch (97:25): [True: 60.4k, False: 65.5k]
  |  Branch (97:44): [True: 7.16k, False: 53.2k]
  ------------------
   98|  7.16k|				vote->le_float += 4 ;
   99|       |
  100|  2.54M|			if (data [3] != 0 && data [0] > 0x43 && data [0] < 0x4B)
  ------------------
  |  Branch (100:8): [True: 125k, False: 2.42M]
  |  Branch (100:25): [True: 54.2k, False: 71.6k]
  |  Branch (100:44): [True: 5.12k, False: 49.1k]
  ------------------
  101|  5.12k|				vote->be_float += 4 ;
  102|  2.54M|			} ;
  103|  10.1M|		} ;
  104|       |
  105|  2.49k|	return ;
  106|  2.49k|} /* vote_for_format */

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

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

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

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

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

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

psf_allocate:
   44|  18.1k|{	SF_PRIVATE * psf ;
   45|       |
   46|  18.1k|	if ((psf = calloc (1, sizeof (SF_PRIVATE))) == NULL)
  ------------------
  |  Branch (46:6): [True: 0, False: 18.1k]
  ------------------
   47|      0|		return	NULL ;
   48|       |
   49|  18.1k|	if ((psf->header.ptr = calloc (1, INITIAL_HEADER_SIZE)) == NULL)
  ------------------
  |  |   39|  18.1k|#define	INITIAL_HEADER_SIZE	256
  ------------------
  |  Branch (49:6): [True: 0, False: 18.1k]
  ------------------
   50|      0|	{	free (psf) ;
   51|      0|		return	NULL ;
   52|  18.1k|		} ;
   53|  18.1k|	psf->header.len = INITIAL_HEADER_SIZE ;
  ------------------
  |  |   39|  18.1k|#define	INITIAL_HEADER_SIZE	256
  ------------------
   54|       |
   55|  18.1k|	return psf ;
   56|  18.1k|} /* psf_allocate */
psf_log_printf:
  106|  15.0M|{	va_list		ap ;
  107|  15.0M|	uint32_t	u, tens ;
  108|  15.0M|	int			d, shift, width, width_specifier, left_align, slen, precision ;
  109|  15.0M|	char		c, *strptr, istr [5], lead_char, sign_char ;
  110|       |
  111|  15.0M|	va_start (ap, format) ;
  112|       |
  113|   519M|	while ((c = *format++))
  ------------------
  |  Branch (113:9): [True: 504M, False: 15.0M]
  ------------------
  114|   504M|	{	if (c != '%')
  ------------------
  |  Branch (114:8): [True: 477M, False: 26.8M]
  ------------------
  115|   477M|		{	log_putchar (psf, c) ;
  116|   477M|			continue ;
  117|   477M|			} ;
  118|       |
  119|  26.8M|		if (format [0] == '%') /* Handle %% */
  ------------------
  |  Branch (119:7): [True: 0, False: 26.8M]
  ------------------
  120|      0|		{ 	log_putchar (psf, '%') ;
  121|      0|			format ++ ;
  122|      0|			continue ;
  123|  26.8M|			} ;
  124|       |
  125|  26.8M|		sign_char = 0 ;
  126|  26.8M|		left_align = SF_FALSE ;
  127|  27.0M|		while (1)
  ------------------
  |  Branch (127:10): [True: 27.0M, Folded]
  ------------------
  128|  27.0M|		{	switch (format [0])
  129|  27.0M|			{	case ' ' :
  ------------------
  |  Branch (129:6): [True: 0, False: 27.0M]
  ------------------
  130|      0|				case '+' :
  ------------------
  |  Branch (130:5): [True: 0, False: 27.0M]
  ------------------
  131|      0|					sign_char = format [0] ;
  132|      0|					format ++ ;
  133|      0|					continue ;
  134|       |
  135|   187k|				case '-' :
  ------------------
  |  Branch (135:5): [True: 187k, False: 26.8M]
  ------------------
  136|   187k|					left_align = SF_TRUE ;
  137|   187k|					format ++ ;
  138|   187k|					continue ;
  139|       |
  140|  26.8M|				default : break ;
  ------------------
  |  Branch (140:5): [True: 26.8M, False: 187k]
  ------------------
  141|  27.0M|				} ;
  142|       |
  143|  26.8M|			break ;
  144|  27.0M|			} ;
  145|       |
  146|  26.8M|		if (format [0] == 0)
  ------------------
  |  Branch (146:7): [True: 0, False: 26.8M]
  ------------------
  147|      0|			break ;
  148|       |
  149|  26.8M|		lead_char = ' ' ;
  150|  26.8M|		if (format [0] == '0')
  ------------------
  |  Branch (150:7): [True: 5.86M, False: 20.9M]
  ------------------
  151|  5.86M|			lead_char = '0' ;
  152|       |
  153|  26.8M|		width_specifier = 0 ;
  154|  39.0M|		while ((c = *format++) && isdigit (c))
  ------------------
  |  Branch (154:10): [True: 39.0M, False: 0]
  |  Branch (154:29): [True: 12.1M, False: 26.8M]
  ------------------
  155|  12.1M|			width_specifier = width_specifier * 10 + (c - '0') ;
  156|       |
  157|  26.8M|		precision = 0 ;
  158|  26.8M|		if (c == '.')
  ------------------
  |  Branch (158:7): [True: 78, False: 26.8M]
  ------------------
  159|    234|		{	while ((c = *format++) && isdigit (c))
  ------------------
  |  Branch (159:12): [True: 234, False: 0]
  |  Branch (159:31): [True: 156, False: 78]
  ------------------
  160|    156|				precision = precision * 10 + (c - '0') ;
  161|     78|			} ;
  162|       |
  163|  26.8M|		switch (c)
  164|  26.8M|		{	case 0 : /* NULL character. */
  ------------------
  |  Branch (164:5): [True: 0, False: 26.8M]
  ------------------
  165|      0|					va_end (ap) ;
  166|      0|					return ;
  167|       |
  168|  1.55M|			case 's': /* string */
  ------------------
  |  Branch (168:4): [True: 1.55M, False: 25.3M]
  ------------------
  169|  1.55M|					strptr = va_arg (ap, char *) ;
  170|  1.55M|					if (strptr == NULL)
  ------------------
  |  Branch (170:10): [True: 0, False: 1.55M]
  ------------------
  171|      0|						break ;
  172|  1.55M|					if (precision > 0)
  ------------------
  |  Branch (172:10): [True: 78, False: 1.55M]
  ------------------
  173|     78|						slen = strnlen (strptr, precision) ;
  174|  1.55M|					else
  175|  1.55M|						slen = strlen (strptr) ;
  176|  1.55M|					width_specifier = width_specifier >= slen ? width_specifier - slen : 0 ;
  ------------------
  |  Branch (176:24): [True: 1.39M, False: 161k]
  ------------------
  177|  1.55M|					if (left_align == SF_FALSE)
  ------------------
  |  Branch (177:10): [True: 1.37M, False: 187k]
  ------------------
  178|  1.37M|						while (width_specifier -- > 0)
  ------------------
  |  Branch (178:14): [True: 0, False: 1.37M]
  ------------------
  179|      0|							log_putchar (psf, ' ') ;
  180|  4.61M|					while (slen--)
  ------------------
  |  Branch (180:13): [True: 3.05M, False: 1.55M]
  ------------------
  181|  3.05M|						log_putchar (psf, *strptr++) ;
  182|  3.66M|					while (width_specifier -- > 0)
  ------------------
  |  Branch (182:13): [True: 2.10M, False: 1.55M]
  ------------------
  183|  2.10M|						log_putchar (psf, ' ') ;
  184|  1.55M|					break ;
  185|       |
  186|  14.4M|			case 'd': /* int */
  ------------------
  |  Branch (186:4): [True: 14.4M, False: 12.4M]
  ------------------
  187|  14.4M|					d = va_arg (ap, int) ;
  188|       |
  189|  14.4M|					if (d < 0)
  ------------------
  |  Branch (189:10): [True: 51.5k, False: 14.3M]
  ------------------
  190|  51.5k|					{	sign_char = '-' ;
  191|  51.5k|						if (lead_char != '0' && left_align == SF_FALSE)
  ------------------
  |  Branch (191:11): [True: 51.5k, False: 37]
  |  Branch (191:31): [True: 51.5k, False: 0]
  ------------------
  192|  51.5k|							width_specifier -- ;
  193|       |
  194|  51.5k|						u = - ((unsigned) d) ;
  195|  51.5k|						}
  196|  14.3M|					else
  197|  14.3M|					{	u = (unsigned) d ;
  198|  14.3M|						}
  199|       |
  200|  14.4M|					tens = 1 ;
  201|  14.4M|					width = 1 ;
  202|  28.4M|					while (u / tens >= 10)
  ------------------
  |  Branch (202:13): [True: 14.0M, False: 14.4M]
  ------------------
  203|  14.0M|					{	tens *= 10 ;
  204|  14.0M|						width ++ ;
  205|  14.0M|						} ;
  206|       |
  207|  14.4M|					width_specifier -= width ;
  208|       |
  209|  14.4M|					if (sign_char == ' ')
  ------------------
  |  Branch (209:10): [True: 0, False: 14.4M]
  ------------------
  210|      0|					{	log_putchar (psf, ' ') ;
  211|      0|						width_specifier -- ;
  212|      0|						} ;
  213|       |
  214|  14.4M|					if (left_align == SF_FALSE && lead_char != '0')
  ------------------
  |  Branch (214:10): [True: 14.4M, False: 0]
  |  Branch (214:36): [True: 14.4M, False: 108]
  ------------------
  215|  14.4M|					{	if (sign_char == '+')
  ------------------
  |  Branch (215:12): [True: 0, False: 14.4M]
  ------------------
  216|      0|							width_specifier -- ;
  217|       |
  218|  14.4M|						while (width_specifier -- > 0)
  ------------------
  |  Branch (218:14): [True: 3.09k, False: 14.4M]
  ------------------
  219|  3.09k|							log_putchar (psf, lead_char) ;
  220|  14.4M|						} ;
  221|       |
  222|  14.4M|					if (sign_char == '+' || sign_char == '-')
  ------------------
  |  Branch (222:10): [True: 0, False: 14.4M]
  |  Branch (222:30): [True: 51.5k, False: 14.3M]
  ------------------
  223|  51.5k|					{	log_putchar (psf, sign_char) ;
  224|  51.5k|						width_specifier -- ;
  225|  51.5k|						} ;
  226|       |
  227|  14.4M|					if (left_align == SF_FALSE)
  ------------------
  |  Branch (227:10): [True: 14.4M, False: 0]
  ------------------
  228|  14.4M|						while (width_specifier -- > 0)
  ------------------
  |  Branch (228:14): [True: 40, False: 14.4M]
  ------------------
  229|     40|							log_putchar (psf, lead_char) ;
  230|       |
  231|  42.9M|					while (tens > 0)
  ------------------
  |  Branch (231:13): [True: 28.4M, False: 14.4M]
  ------------------
  232|  28.4M|					{	log_putchar (psf, '0' + u / tens) ;
  233|  28.4M|						u %= tens ;
  234|  28.4M|						tens /= 10 ;
  235|  28.4M|						} ;
  236|       |
  237|  14.4M|					while (width_specifier -- > 0)
  ------------------
  |  Branch (237:13): [True: 0, False: 14.4M]
  ------------------
  238|      0|						log_putchar (psf, lead_char) ;
  239|  14.4M|					break ;
  240|       |
  241|   440k|			case 'D': /* sf_count_t */
  ------------------
  |  Branch (241:4): [True: 440k, False: 26.4M]
  ------------------
  242|   440k|					{	sf_count_t	D ;
  243|   440k|						uint64_t	U, Tens ;
  244|       |
  245|   440k|						D = va_arg (ap, sf_count_t) ;
  246|       |
  247|   440k|						if (D == 0)
  ------------------
  |  Branch (247:11): [True: 14.5k, False: 426k]
  ------------------
  248|  14.5k|						{	while (-- width_specifier > 0)
  ------------------
  |  Branch (248:16): [True: 0, False: 14.5k]
  ------------------
  249|      0|								log_putchar (psf, lead_char) ;
  250|  14.5k|							log_putchar (psf, '0') ;
  251|  14.5k|							break ;
  252|  14.5k|							}
  253|   426k|						else
  254|   426k|						{	if (D < 0)
  ------------------
  |  Branch (254:13): [True: 94.6k, False: 331k]
  ------------------
  255|  94.6k|							{	log_putchar (psf, '-') ;
  256|  94.6k|								U = - ((uint64_t) D) ;
  257|  94.6k|								}
  258|   331k|							else
  259|   331k|							{	U = (uint64_t) D ;
  260|   331k|								}
  261|   426k|							}
  262|       |
  263|   426k|						Tens = 1 ;
  264|   426k|						width = 1 ;
  265|  2.95M|						while (U / Tens >= 10)
  ------------------
  |  Branch (265:14): [True: 2.52M, False: 426k]
  ------------------
  266|  2.52M|						{	Tens *= 10 ;
  267|  2.52M|							width ++ ;
  268|  2.52M|							} ;
  269|       |
  270|   426k|						while (width_specifier > width)
  ------------------
  |  Branch (270:14): [True: 0, False: 426k]
  ------------------
  271|      0|						{	log_putchar (psf, lead_char) ;
  272|      0|							width_specifier-- ;
  273|      0|							} ;
  274|       |
  275|  3.37M|						while (Tens > 0)
  ------------------
  |  Branch (275:14): [True: 2.95M, False: 426k]
  ------------------
  276|  2.95M|						{	log_putchar (psf, '0' + U / Tens) ;
  277|  2.95M|							U %= Tens ;
  278|  2.95M|							Tens /= 10 ;
  279|  2.95M|							} ;
  280|   426k|						} ;
  281|   426k|					break ;
  282|       |
  283|  1.09M|			case 'u': /* unsigned int */
  ------------------
  |  Branch (283:4): [True: 1.09M, False: 25.7M]
  ------------------
  284|  1.09M|					u = va_arg (ap, unsigned int) ;
  285|       |
  286|  1.09M|					tens = 1 ;
  287|  1.09M|					width = 1 ;
  288|  6.41M|					while (u / tens >= 10)
  ------------------
  |  Branch (288:13): [True: 5.32M, False: 1.09M]
  ------------------
  289|  5.32M|					{	tens *= 10 ;
  290|  5.32M|						width ++ ;
  291|  5.32M|						} ;
  292|       |
  293|  1.09M|					width_specifier -= width ;
  294|       |
  295|  1.09M|					if (sign_char == ' ')
  ------------------
  |  Branch (295:10): [True: 0, False: 1.09M]
  ------------------
  296|      0|					{	log_putchar (psf, ' ') ;
  297|      0|						width_specifier -- ;
  298|      0|						} ;
  299|       |
  300|  1.09M|					if (left_align == SF_FALSE && lead_char != '0')
  ------------------
  |  Branch (300:10): [True: 1.09M, False: 0]
  |  Branch (300:36): [True: 1.08M, False: 1.57k]
  ------------------
  301|  1.08M|					{	if (sign_char == '+')
  ------------------
  |  Branch (301:12): [True: 0, False: 1.08M]
  ------------------
  302|      0|							width_specifier -- ;
  303|       |
  304|  1.15M|						while (width_specifier -- > 0)
  ------------------
  |  Branch (304:14): [True: 64.9k, False: 1.08M]
  ------------------
  305|  64.9k|							log_putchar (psf, lead_char) ;
  306|  1.08M|						} ;
  307|       |
  308|  1.09M|					if (sign_char == '+' || sign_char == '-')
  ------------------
  |  Branch (308:10): [True: 0, False: 1.09M]
  |  Branch (308:30): [True: 0, False: 1.09M]
  ------------------
  309|      0|					{	log_putchar (psf, sign_char) ;
  310|      0|						width_specifier -- ;
  311|      0|						} ;
  312|       |
  313|  1.09M|					if (left_align == SF_FALSE)
  ------------------
  |  Branch (313:10): [True: 1.09M, False: 0]
  ------------------
  314|  1.09M|						while (width_specifier -- > 0)
  ------------------
  |  Branch (314:14): [True: 1.26k, False: 1.09M]
  ------------------
  315|  1.26k|							log_putchar (psf, lead_char) ;
  316|       |
  317|  7.50M|					while (tens > 0)
  ------------------
  |  Branch (317:13): [True: 6.41M, False: 1.09M]
  ------------------
  318|  6.41M|					{	log_putchar (psf, '0' + u / tens) ;
  319|  6.41M|						u %= tens ;
  320|  6.41M|						tens /= 10 ;
  321|  6.41M|						} ;
  322|       |
  323|  1.09M|					while (width_specifier -- > 0)
  ------------------
  |  Branch (323:13): [True: 0, False: 1.09M]
  ------------------
  324|      0|						log_putchar (psf, lead_char) ;
  325|  1.09M|					break ;
  326|       |
  327|      0|			case 'c': /* char */
  ------------------
  |  Branch (327:4): [True: 0, False: 26.8M]
  ------------------
  328|      0|					c = va_arg (ap, int) & 0xFF ;
  329|      0|					log_putchar (psf, c) ;
  330|      0|					break ;
  331|       |
  332|  1.99M|			case 'x': /* hex */
  ------------------
  |  Branch (332:4): [True: 1.99M, False: 24.8M]
  ------------------
  333|  7.93M|			case 'X': /* hex */
  ------------------
  |  Branch (333:4): [True: 5.94M, False: 20.9M]
  ------------------
  334|  7.93M|					d = va_arg (ap, int) ;
  335|       |
  336|  7.93M|					if (d == 0)
  ------------------
  |  Branch (336:10): [True: 3.76M, False: 4.16M]
  ------------------
  337|  6.08M|					{	while (--width_specifier > 0)
  ------------------
  |  Branch (337:15): [True: 2.32M, False: 3.76M]
  ------------------
  338|  2.32M|							log_putchar (psf, lead_char) ;
  339|  3.76M|						log_putchar (psf, '0') ;
  340|  3.76M|						break ;
  341|  4.16M|						} ;
  342|  4.16M|					shift = 28 ;
  343|  4.16M|					width = (width_specifier < 8) ? 8 : width_specifier ;
  ------------------
  |  Branch (343:14): [True: 4.16M, False: 244]
  ------------------
  344|  26.6M|					while (! ((((uint32_t) 0xF) << shift) & d))
  ------------------
  |  Branch (344:13): [True: 22.5M, False: 4.16M]
  ------------------
  345|  22.5M|					{	shift -= 4 ;
  346|  22.5M|						width -- ;
  347|  22.5M|						} ;
  348|       |
  349|  4.73M|					while (width > 0 && width_specifier > width)
  ------------------
  |  Branch (349:13): [True: 4.73M, False: 0]
  |  Branch (349:26): [True: 569k, False: 4.16M]
  ------------------
  350|   569k|					{	log_putchar (psf, lead_char) ;
  351|   569k|						width_specifier-- ;
  352|   569k|						} ;
  353|       |
  354|  15.0M|					while (shift >= 0)
  ------------------
  |  Branch (354:13): [True: 10.8M, False: 4.16M]
  ------------------
  355|  10.8M|					{	c = (d >> shift) & 0xF ;
  356|  10.8M|						log_putchar (psf, (c > 9) ? c + 'A' - 10 : c + '0') ;
  ------------------
  |  Branch (356:25): [True: 2.56M, False: 8.26M]
  ------------------
  357|  10.8M|						shift -= 4 ;
  358|  10.8M|						} ;
  359|  4.16M|					break ;
  360|       |
  361|  1.39M|			case 'M': /* int2str */
  ------------------
  |  Branch (361:4): [True: 1.39M, False: 25.4M]
  ------------------
  362|  1.39M|					d = va_arg (ap, int) ;
  363|  1.39M|					if (CPU_IS_LITTLE_ENDIAN)
  ------------------
  |  |   14|  1.39M|#define CPU_IS_LITTLE_ENDIAN 1
  |  |  ------------------
  |  |  |  Branch (14:30): [True: 1.39M, Folded]
  |  |  ------------------
  ------------------
  364|  1.39M|					{	istr [0] = d & 0xFF ;
  365|  1.39M|						istr [1] = (d >> 8) & 0xFF ;
  366|  1.39M|						istr [2] = (d >> 16) & 0xFF ;
  367|  1.39M|						istr [3] = (d >> 24) & 0xFF ;
  368|  1.39M|						}
  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.39M|					istr [4] = 0 ;
  376|  1.39M|					strptr = istr ;
  377|  6.19M|					while (*strptr)
  ------------------
  |  Branch (377:13): [True: 4.80M, False: 1.39M]
  ------------------
  378|  4.80M|					{	c = *strptr++ ;
  379|  4.80M|						log_putchar (psf, psf_isprint (c) ? c : '.') ;
  ------------------
  |  Branch (379:25): [True: 4.11M, False: 688k]
  ------------------
  380|  4.80M|						} ;
  381|  1.39M|					break ;
  382|       |
  383|      0|			default :
  ------------------
  |  Branch (383:4): [True: 0, False: 26.8M]
  ------------------
  384|      0|					log_putchar (psf, '*') ;
  385|      0|					log_putchar (psf, c) ;
  386|      0|					log_putchar (psf, '*') ;
  387|      0|					break ;
  388|  26.8M|			} /* switch */
  389|  26.8M|		} /* while */
  390|       |
  391|  15.0M|	va_end (ap) ;
  392|  15.0M|	return ;
  393|  15.0M|} /* psf_log_printf */
psf_binheader_readf:
 1015|  4.49M|{	va_list			argptr ;
 1016|  4.49M|	sf_count_t		*countptr, countdata ;
 1017|  4.49M|	unsigned char	sixteen_bytes [16] = { 0 } ;
 1018|  4.49M|	unsigned int 	*intptr, intdata ;
 1019|  4.49M|	unsigned short	*shortptr ;
 1020|  4.49M|	char			*charptr ;
 1021|  4.49M|	float			*floatptr ;
 1022|  4.49M|	double			*doubleptr ;
 1023|  4.49M|	char			c ;
 1024|  4.49M|	int				byte_count = 0, count = 0 ;
 1025|  4.49M|	int				read_bytes = 0 ;
 1026|       |
 1027|  4.49M|	if (! format)
  ------------------
  |  Branch (1027:6): [True: 0, False: 4.49M]
  ------------------
 1028|      0|		return psf_ftell (psf) ;
 1029|       |
 1030|  4.49M|	va_start (argptr, format) ;
 1031|       |
 1032|  13.5M|	while ((c = *format++))
  ------------------
  |  Branch (1032:9): [True: 9.18M, False: 4.34M]
  ------------------
 1033|  9.18M|	{
 1034|  9.18M|		read_bytes = 0 ;
 1035|  9.18M|		if (psf->header.indx + 16 >= psf->header.len && psf_bump_header_allocation (psf, 16))
  ------------------
  |  Branch (1035:7): [True: 162k, False: 9.02M]
  |  Branch (1035:51): [True: 158k, False: 3.25k]
  ------------------
 1036|   158k|			break ;
 1037|       |
 1038|  9.02M|		switch (c)
 1039|  9.02M|		{	case 'e' : /* All conversions are now from LE to host. */
  ------------------
  |  Branch (1039:5): [True: 605k, False: 8.42M]
  ------------------
 1040|   605k|					psf->rwf_endian = SF_ENDIAN_LITTLE ;
 1041|   605k|					break ;
 1042|       |
 1043|  1.15M|			case 'E' : /* All conversions are now from BE to host. */
  ------------------
  |  Branch (1043:4): [True: 1.15M, False: 7.87M]
  ------------------
 1044|  1.15M|					psf->rwf_endian = SF_ENDIAN_BIG ;
 1045|  1.15M|					break ;
 1046|       |
 1047|  1.64M|			case 'm' : /* 4 byte marker value eg 'RIFF' */
  ------------------
  |  Branch (1047:4): [True: 1.64M, False: 7.38M]
  ------------------
 1048|  1.64M|					intptr = va_arg (argptr, unsigned int*) ;
 1049|  1.64M|					store_uint (intptr, 0) ;
 1050|  1.64M|					read_bytes = header_read (psf, sixteen_bytes, sizeof (int)) ;
 1051|  1.64M|					store_uint (intptr, GET_MARKER (sixteen_bytes)) ;
  ------------------
  |  |  833|  1.64M|#define	GET_MARKER(ptr)	(	((ptr) [0])			| ((ptr) [1] << 8) |	\
  |  |  834|  1.64M|							((ptr) [2] << 16)	| (((uint32_t) (ptr) [3]) << 24))
  ------------------
 1052|  1.64M|					break ;
 1053|       |
 1054|   107k|			case 'h' :
  ------------------
  |  Branch (1054:4): [True: 107k, False: 8.91M]
  ------------------
 1055|   107k|					intptr = va_arg (argptr, unsigned int*) ;
 1056|   107k|					store_uint (intptr, 0) ;
 1057|   107k|					read_bytes = header_read (psf, sixteen_bytes, sizeof (sixteen_bytes)) ;
 1058|   107k|					{	int k ;
 1059|   107k|						intdata = 0 ;
 1060|  1.83M|						for (k = 0 ; k < 16 ; k++)
  ------------------
  |  Branch (1060:20): [True: 1.72M, False: 107k]
  ------------------
 1061|  1.72M|							intdata ^= sixteen_bytes [k] << k ;
 1062|   107k|						}
 1063|   107k|					store_uint (intptr, intdata) ;
 1064|   107k|					break ;
 1065|       |
 1066|   113k|			case '1' :
  ------------------
  |  Branch (1066:4): [True: 113k, False: 8.91M]
  ------------------
 1067|   113k|					charptr = va_arg (argptr, char*) ;
 1068|   113k|					*charptr = 0 ;
 1069|   113k|					read_bytes = header_read (psf, charptr, sizeof (char)) ;
 1070|   113k|					break ;
 1071|       |
 1072|  1.56M|			case '2' : /* 2 byte value with the current endian-ness */
  ------------------
  |  Branch (1072:4): [True: 1.56M, False: 7.45M]
  ------------------
 1073|  1.56M|					shortptr = va_arg (argptr, unsigned short*) ;
 1074|  1.56M|					store_ushort (shortptr, 0) ;
 1075|  1.56M|					read_bytes = header_read (psf, sixteen_bytes, sizeof (short)) ;
 1076|  1.56M|					if (psf->rwf_endian == SF_ENDIAN_BIG)
  ------------------
  |  Branch (1076:10): [True: 1.54M, False: 25.0k]
  ------------------
 1077|  1.54M|						store_ushort (shortptr, GET_BE_SHORT (sixteen_bytes)) ;
  ------------------
  |  |  841|  1.54M|#define	GET_BE_SHORT(ptr)	(((ptr) [0] << 8) | ((ptr) [1]))
  ------------------
 1078|  25.0k|					else
 1079|  25.0k|						store_ushort (shortptr, GET_LE_SHORT (sixteen_bytes)) ;
  ------------------
  |  |  840|  25.0k|#define	GET_LE_SHORT(ptr)	(((ptr) [1] << 8) | ((ptr) [0]))
  ------------------
 1080|  1.56M|					break ;
 1081|       |
 1082|  4.81k|			case '3' : /* 3 byte value with the current endian-ness */
  ------------------
  |  Branch (1082:4): [True: 4.81k, False: 9.02M]
  ------------------
 1083|  4.81k|					intptr = va_arg (argptr, unsigned int*) ;
 1084|  4.81k|					store_uint (intptr, 0) ;
 1085|  4.81k|					read_bytes = header_read (psf, sixteen_bytes, 3) ;
 1086|  4.81k|					if (psf->rwf_endian == SF_ENDIAN_BIG)
  ------------------
  |  Branch (1086:10): [True: 0, False: 4.81k]
  ------------------
 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|  4.81k|					else
 1089|  4.81k|						store_uint (intptr, GET_LE_3BYTE (sixteen_bytes)) ;
  ------------------
  |  |  843|  4.81k|#define	GET_LE_3BYTE(ptr)	(	((ptr) [2] << 16) | ((ptr) [1] << 8) | ((ptr) [0]))
  ------------------
 1090|  4.81k|					break ;
 1091|       |
 1092|  2.13M|			case '4' : /* 4 byte value with the current endian-ness */
  ------------------
  |  Branch (1092:4): [True: 2.13M, False: 6.89M]
  ------------------
 1093|  2.13M|					intptr = va_arg (argptr, unsigned int*) ;
 1094|  2.13M|					store_uint (intptr, 0) ;
 1095|  2.13M|					read_bytes = header_read (psf, sixteen_bytes, sizeof (int)) ;
 1096|  2.13M|					if (psf->rwf_endian == SF_ENDIAN_BIG)
  ------------------
  |  Branch (1096:10): [True: 1.25M, False: 879k]
  ------------------
 1097|  1.25M|						store_uint (intptr, psf_get_be32 (sixteen_bytes, 0)) ;
 1098|   879k|					else
 1099|   879k|						store_uint (intptr, psf_get_le32 (sixteen_bytes, 0)) ;
 1100|  2.13M|					break ;
 1101|       |
 1102|   137k|			case '8' : /* 8 byte value with the current endian-ness */
  ------------------
  |  Branch (1102:4): [True: 137k, False: 8.89M]
  ------------------
 1103|   137k|					countptr = va_arg (argptr, sf_count_t *) ;
 1104|   137k|					store_count (countptr, 0) ;
 1105|   137k|					read_bytes = header_read (psf, sixteen_bytes, 8) ;
 1106|   137k|					if (psf->rwf_endian == SF_ENDIAN_BIG)
  ------------------
  |  Branch (1106:10): [True: 26.8k, False: 110k]
  ------------------
 1107|  26.8k|						countdata = psf_get_be64 (sixteen_bytes, 0) ;
 1108|   110k|					else
 1109|   110k|						countdata = psf_get_le64 (sixteen_bytes, 0) ;
 1110|   137k|					store_count (countptr, countdata) ;
 1111|   137k|					break ;
 1112|       |
 1113|  38.9k|			case 'f' : /* Float conversion */
  ------------------
  |  Branch (1113:4): [True: 38.9k, False: 8.98M]
  ------------------
 1114|  38.9k|					floatptr = va_arg (argptr, float *) ;
 1115|  38.9k|					store_float (floatptr, 0.0) ;
 1116|  38.9k|					read_bytes = header_read (psf, sixteen_bytes, sizeof (float)) ;
 1117|  38.9k|					if (psf->rwf_endian == SF_ENDIAN_BIG)
  ------------------
  |  Branch (1117:10): [True: 8.75k, False: 30.2k]
  ------------------
 1118|  8.75k|						store_float (floatptr, float32_be_read (sixteen_bytes)) ;
 1119|  30.2k|					else
 1120|  30.2k|						store_float (floatptr, float32_le_read (sixteen_bytes)) ;
 1121|  38.9k|					break ;
 1122|       |
 1123|    603|			case 'd' : /* double conversion */
  ------------------
  |  Branch (1123:4): [True: 603, False: 9.02M]
  ------------------
 1124|    603|					doubleptr = va_arg (argptr, double *) ;
 1125|    603|					store_double (doubleptr, 0.0) ;
 1126|    603|					read_bytes = header_read (psf, sixteen_bytes, sizeof (double)) ;
 1127|    603|					if (psf->rwf_endian == SF_ENDIAN_BIG)
  ------------------
  |  Branch (1127:10): [True: 104, False: 499]
  ------------------
 1128|    104|						store_double (doubleptr, double64_be_read (sixteen_bytes)) ;
 1129|    499|					else
 1130|    499|						store_double (doubleptr, double64_le_read (sixteen_bytes)) ;
 1131|    603|					break ;
 1132|       |
 1133|      0|			case 's' :
  ------------------
  |  Branch (1133:4): [True: 0, False: 9.02M]
  ------------------
 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|   874k|			case 'b' : /* Raw bytes */
  ------------------
  |  Branch (1146:4): [True: 874k, False: 8.15M]
  ------------------
 1147|   874k|					charptr = va_arg (argptr, char*) ;
 1148|   874k|					count = va_arg (argptr, size_t) ;
 1149|   874k|					memset (charptr, 0, count) ;
 1150|   874k|					read_bytes = header_read (psf, charptr, count) ;
 1151|   874k|					break ;
 1152|       |
 1153|    124|			case 'G' :
  ------------------
  |  Branch (1153:4): [True: 124, False: 9.02M]
  ------------------
 1154|    124|					charptr = va_arg (argptr, char*) ;
 1155|    124|					count = va_arg (argptr, size_t) ;
 1156|    124|					memset (charptr, 0, count) ;
 1157|       |
 1158|    124|					if (psf->header.indx + count >= psf->header.len && psf_bump_header_allocation (psf, count))
  ------------------
  |  Branch (1158:10): [True: 0, False: 124]
  |  Branch (1158:57): [True: 0, False: 0]
  ------------------
 1159|      0|						break ;
 1160|       |
 1161|    124|					read_bytes = header_gets (psf, charptr, count) ;
 1162|    124|					break ;
 1163|       |
 1164|      0|			case 'z' :
  ------------------
  |  Branch (1164:4): [True: 0, False: 9.02M]
  ------------------
 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|  20.5k|			case 'p' :	/* Seek to position from start. */
  ------------------
  |  Branch (1176:4): [True: 20.5k, False: 9.00M]
  ------------------
 1177|  20.5k|					count = va_arg (argptr, size_t) ;
 1178|  20.5k|					header_seek (psf, count, SEEK_SET) ;
 1179|  20.5k|					byte_count = count ;
 1180|  20.5k|					break ;
 1181|       |
 1182|   624k|			case 'j' :	/* Seek to position from current position. */
  ------------------
  |  Branch (1182:4): [True: 624k, False: 8.40M]
  ------------------
 1183|   624k|					count = va_arg (argptr, size_t) ;
 1184|   624k|					header_seek (psf, count, SEEK_CUR) ;
 1185|   624k|					read_bytes = count ;
 1186|   624k|					break ;
 1187|       |
 1188|  1.94k|			case '!' : /* Clear buffer, forcing re-read. */
  ------------------
  |  Branch (1188:4): [True: 1.94k, False: 9.02M]
  ------------------
 1189|  1.94k|					psf->header.end = psf->header.indx = 0 ;
 1190|  1.94k|					break ;
 1191|       |
 1192|      0|			default :
  ------------------
  |  Branch (1192:4): [True: 0, False: 9.02M]
  ------------------
 1193|      0|				psf_log_printf (psf, "*** Invalid format specifier `%c'\n", c) ;
 1194|      0|				psf->error = SFE_INTERNAL ;
 1195|      0|				break ;
 1196|  9.02M|			} ;
 1197|       |
 1198|  9.02M|		if (read_bytes > 0 && byte_count > (INT_MAX - read_bytes))
  ------------------
  |  Branch (1198:7): [True: 3.95M, False: 5.07M]
  |  Branch (1198:25): [True: 1, False: 3.95M]
  ------------------
 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|  9.02M|		{	byte_count += read_bytes ;
 1204|  9.02M|		} ;
 1205|       |
 1206|  9.02M|		} ;	/*end while*/
 1207|       |
 1208|  4.49M|	va_end (argptr) ;
 1209|       |
 1210|  4.49M|	return byte_count ;
 1211|  4.49M|} /* psf_binheader_readf */
psf_log_SF_INFO:
 1276|  1.09k|{	psf_log_printf (psf, "---------------------------------\n") ;
 1277|       |
 1278|  1.09k|	psf_log_printf (psf, " Sample rate :   %d\n", psf->sf.samplerate) ;
 1279|  1.09k|	if (psf->sf.frames == SF_COUNT_MAX)
  ------------------
  |  |  370|  1.09k|#define SF_COUNT_MAX	INT64_MAX
  ------------------
  |  Branch (1279:6): [True: 1, False: 1.09k]
  ------------------
 1280|      1|		psf_log_printf (psf, " Frames      :   unknown\n") ;
 1281|  1.09k|	else
 1282|  1.09k|		psf_log_printf (psf, " Frames      :   %D\n", psf->sf.frames) ;
 1283|  1.09k|	psf_log_printf (psf, " Channels    :   %d\n", psf->sf.channels) ;
 1284|       |
 1285|  1.09k|	psf_log_printf (psf, " Format      :   0x%X\n", psf->sf.format) ;
 1286|  1.09k|	psf_log_printf (psf, " Sections    :   %d\n", psf->sf.sections) ;
 1287|  1.09k|	psf_log_printf (psf, " Seekable    :   %s\n", psf->sf.seekable ? "TRUE" : "FALSE") ;
  ------------------
  |  Branch (1287:48): [True: 905, False: 193]
  ------------------
 1288|       |
 1289|  1.09k|	psf_log_printf (psf, "---------------------------------\n") ;
 1290|  1.09k|} /* psf_dump_SFINFO */
psf_isprint:
 1297|  5.48M|{	return (ch >= ' ' && ch <= '~') ;
  ------------------
  |  Branch (1297:11): [True: 4.71M, False: 768k]
  |  Branch (1297:24): [True: 4.70M, False: 11.9k]
  ------------------
 1298|  5.48M|} /* psf_isprint */
psf_strlcpy:
 1308|  31.3k|{	strncpy (dest, src, n - 1) ;
 1309|  31.3k|	dest [n - 1] = 0 ;
 1310|  31.3k|} /* psf_strlcpy */
psf_memset:
 1328|  1.97k|{	char	*ptr ;
 1329|  1.97k|	int 	setcount ;
 1330|       |
 1331|  1.97k|	ptr = (char *) s ;
 1332|       |
 1333|  3.94k|	while (len > 0)
  ------------------
  |  Branch (1333:9): [True: 1.97k, False: 1.97k]
  ------------------
 1334|  1.97k|	{	setcount = (len > 0x10000000) ? 0x10000000 : (int) len ;
  ------------------
  |  Branch (1334:15): [True: 0, False: 1.97k]
  ------------------
 1335|       |
 1336|  1.97k|		memset (ptr, c, setcount) ;
 1337|       |
 1338|  1.97k|		ptr += setcount ;
 1339|  1.97k|		len -= setcount ;
 1340|  1.97k|		} ;
 1341|       |
 1342|  1.97k|	return s ;
 1343|  1.97k|} /* psf_memset */
psf_cues_alloc:
 1365|  1.13k|{	SF_CUES *pcues = calloc (1, SF_CUES_VAR_SIZE (cue_count)) ;
  ------------------
  |  | 1358|  1.13k|#define SF_CUES_VAR_SIZE(count)	(sizeof (SF_CUES_0) + count * sizeof (SF_CUE_POINT))
  ------------------
 1366|  1.13k|	if (pcues)
  ------------------
  |  Branch (1366:6): [True: 1.13k, False: 0]
  ------------------
 1367|  1.13k|	{	pcues->cue_count = cue_count ;
 1368|  1.13k|		} ;
 1369|  1.13k|	return pcues ;
 1370|  1.13k|} /* psf_cues_alloc */
psf_instrument_alloc:
 1403|  1.31k|{	SF_INSTRUMENT *instr ;
 1404|       |
 1405|  1.31k|	instr = calloc (1, sizeof (SF_INSTRUMENT)) ;
 1406|       |
 1407|  1.31k|	if (instr == NULL)
  ------------------
  |  Branch (1407:6): [True: 0, False: 1.31k]
  ------------------
 1408|      0|		return NULL ;
 1409|       |
 1410|       |	/* Set non-zero default values. */
 1411|  1.31k|	instr->basenote = -1 ;
 1412|  1.31k|	instr->velocity_lo = -1 ;
 1413|  1.31k|	instr->velocity_hi = -1 ;
 1414|  1.31k|	instr->key_lo = -1 ;
 1415|  1.31k|	instr->key_hi = -1 ;
 1416|       |
 1417|  1.31k|	return instr ;
 1418|  1.31k|} /* psf_instrument_alloc */
psf_sanitize_string:
 1422|    175|{
 1423|    175|	do
 1424|  86.0k|	{
 1425|  86.0k|		len -- ;
 1426|  86.0k|		cptr [len] = psf_isprint (cptr [len]) ? cptr [len] : '.' ;
  ------------------
  |  Branch (1426:16): [True: 14.3k, False: 71.6k]
  ------------------
 1427|  86.0k|	}
 1428|  86.0k|	while (len > 0) ;
  ------------------
  |  Branch (1428:9): [True: 85.8k, False: 175]
  ------------------
 1429|    175|} /* psf_sanitize_string */
s_bitwidth_to_subformat:
 1482|  8.57k|{	static int array [] =
 1483|  8.57k|	{	SF_FORMAT_PCM_S8, SF_FORMAT_PCM_16, SF_FORMAT_PCM_24, SF_FORMAT_PCM_32
 1484|  8.57k|		} ;
 1485|       |
 1486|  8.57k|	if (bits < 8 || bits > 32)
  ------------------
  |  Branch (1486:6): [True: 1.08k, False: 7.48k]
  |  Branch (1486:18): [True: 4.62k, False: 2.86k]
  ------------------
 1487|  5.71k|		return 0 ;
 1488|       |
 1489|  2.86k|	return array [((bits + 7) / 8) - 1] ;
 1490|  8.57k|} /* bitwidth_to_subformat */
u_bitwidth_to_subformat:
 1494|    199|{	static int array [] =
 1495|    199|	{	SF_FORMAT_PCM_U8, SF_FORMAT_PCM_16, SF_FORMAT_PCM_24, SF_FORMAT_PCM_32
 1496|    199|		} ;
 1497|       |
 1498|    199|	if (bits < 8 || bits > 32)
  ------------------
  |  Branch (1498:6): [True: 11, False: 188]
  |  Branch (1498:18): [True: 48, False: 140]
  ------------------
 1499|     59|		return 0 ;
 1500|       |
 1501|    140|	return array [((bits + 7) / 8) - 1] ;
 1502|    199|} /* bitwidth_to_subformat */
psf_rand_int32:
 1512|  18.1k|{	static uint64_t value = 0 ;
 1513|  18.1k|	int k, count ;
 1514|       |
 1515|  18.1k|	if (value == 0)
  ------------------
  |  Branch (1515:6): [True: 1, False: 18.1k]
  ------------------
 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.1k|	count = 4 + (value & 7) ;
 1527|   163k|	for (k = 0 ; k < count ; k++)
  ------------------
  |  Branch (1527:15): [True: 145k, False: 18.1k]
  ------------------
 1528|   145k|		value = (11117 * value + 211231) & 0x7fffffff ;
 1529|       |
 1530|  18.1k|	return (int32_t) value ;
 1531|  18.1k|} /* psf_rand_int32 */
append_snprintf:
 1535|  1.19k|{	size_t len = strlen (dest) ;
 1536|       |
 1537|  1.19k|	if (len < maxlen)
  ------------------
  |  Branch (1537:6): [True: 1.19k, False: 0]
  ------------------
 1538|  1.19k|	{	va_list ap ;
 1539|       |
 1540|  1.19k|		va_start (ap, fmt) ;
 1541|  1.19k|		vsnprintf (dest + len, maxlen - len, fmt, ap) ;
 1542|  1.19k|		va_end (ap) ;
 1543|  1.19k|		} ;
 1544|       |
 1545|  1.19k|	return ;
 1546|  1.19k|} /* append_snprintf */
psf_decode_frame_count:
 1586|    235|{	sf_count_t count, readlen, total = 0 ;
 1587|    235|	BUF_UNION	ubuf ;
 1588|       |
 1589|       |	/* If we're reading from a pipe or the file is too long, just return SF_COUNT_MAX. */
 1590|    235|	if (psf_is_pipe (psf) || psf->datalength > 0x1000000)
  ------------------
  |  Branch (1590:6): [True: 0, False: 235]
  |  Branch (1590:27): [True: 0, False: 235]
  ------------------
 1591|      0|		return SF_COUNT_MAX ;
  ------------------
  |  |  370|      0|#define SF_COUNT_MAX	INT64_MAX
  ------------------
 1592|       |
 1593|    235|	psf_fseek (psf, psf->dataoffset, SEEK_SET) ;
 1594|       |
 1595|    235|	readlen = ARRAY_LEN (ubuf.ibuf) / psf->sf.channels ;
  ------------------
  |  |   93|    235|#define		ARRAY_LEN(x)	((int) (sizeof (x) / sizeof ((x) [0])))
  ------------------
 1596|    235|	readlen *= psf->sf.channels ;
 1597|       |
 1598|  9.61k|	while ((count = psf->read_int (psf, ubuf.ibuf, readlen)) > 0)
  ------------------
  |  Branch (1598:9): [True: 9.38k, False: 235]
  ------------------
 1599|  9.38k|		total += count ;
 1600|       |
 1601|    235|	psf_fseek (psf, psf->dataoffset, SEEK_SET) ;
 1602|       |
 1603|    235|	return total / psf->sf.channels ;
 1604|    235|} /* psf_decode_frame_count */
common.c:log_putchar:
   97|   542M|{	if (psf->parselog.indx < SIGNED_SIZEOF (psf->parselog.buf) - 1)
  ------------------
  |  |   91|   542M|#define		SIGNED_SIZEOF(x)	((int) sizeof (x))
  ------------------
  |  Branch (97:7): [True: 9.56M, False: 533M]
  ------------------
   98|  9.56M|	{	psf->parselog.buf [psf->parselog.indx++] = ch ;
   99|  9.56M|		psf->parselog.buf [psf->parselog.indx] = 0 ;
  100|  9.56M|		} ;
  101|   542M|	return ;
  102|   542M|} /* log_putchar */
common.c:psf_bump_header_allocation:
   60|   171k|{
   61|   171k|	sf_count_t newlen, smallest = INITIAL_HEADER_SIZE ;
  ------------------
  |  |   39|   171k|#define	INITIAL_HEADER_SIZE	256
  ------------------
   62|   171k|	void * ptr ;
   63|       |
   64|   171k|	newlen = (needed > psf->header.len) ? 2 * SF_MAX (needed, smallest) : 2 * psf->header.len ;
  ------------------
  |  |   95|  3.83k|#define		SF_MAX(a, b)	((a) > (b) ? (a) : (b))
  |  |  ------------------
  |  |  |  Branch (95:24): [True: 3.83k, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (64:11): [True: 3.83k, False: 167k]
  ------------------
   65|       |
   66|   171k|	if (newlen > 100 * 1024)
  ------------------
  |  Branch (66:6): [True: 165k, False: 6.03k]
  ------------------
   67|   165k|	{	psf_log_printf (psf, "Request for header allocation of %D denied.\n", newlen) ;
   68|   165k|		return 1 ;
   69|   165k|		}
   70|       |
   71|  6.03k|	if ((ptr = realloc (psf->header.ptr, newlen)) == NULL)
  ------------------
  |  Branch (71:6): [True: 0, False: 6.03k]
  ------------------
   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.03k|		} ;
   76|       |
   77|       |	/* Always zero-out new header memory to avoid un-initializer memory accesses. */
   78|  6.03k|	if (newlen > psf->header.len)
  ------------------
  |  Branch (78:6): [True: 6.03k, False: 0]
  ------------------
   79|  6.03k|		memset ((char *) ptr + psf->header.len, 0, newlen - psf->header.len) ;
   80|       |
   81|  6.03k|	psf->header.ptr = ptr ;
   82|  6.03k|	psf->header.len = newlen ;
   83|  6.03k|	return 0 ;
   84|  6.03k|} /* psf_bump_header_allocation */
common.c:store_uint:
  990|  7.78M|{	memcpy (ptr, &value, sizeof (value)) ;
  991|  7.78M|} /* store_uint */
common.c:header_read:
  866|  6.62M|{	int count = 0 ;
  867|       |
  868|  6.62M|	if (psf->header.indx + bytes >= psf->header.len && psf_bump_header_allocation (psf, bytes))
  ------------------
  |  Branch (868:6): [True: 2.62k, False: 6.62M]
  |  Branch (868:53): [True: 1.46k, False: 1.15k]
  ------------------
  869|  1.46k|		return count ;
  870|       |
  871|  6.62M|	if (psf->header.indx + bytes > psf->header.end)
  ------------------
  |  Branch (871:6): [True: 4.98M, False: 1.64M]
  ------------------
  872|  4.98M|	{	count = psf_fread (psf->header.ptr + psf->header.end, 1, bytes - (psf->header.end - psf->header.indx), psf) ;
  873|  4.98M|		if (count != bytes - (int) (psf->header.end - psf->header.indx))
  ------------------
  |  Branch (873:7): [True: 2.37M, False: 2.60M]
  ------------------
  874|  2.37M|		{	psf_log_printf (psf, "Error : psf_fread returned short count.\n") ;
  875|  2.37M|			return count ;
  876|  2.60M|			} ;
  877|  2.60M|		psf->header.end += count ;
  878|  4.24M|		} ;
  879|       |
  880|  4.24M|	memcpy (ptr, psf->header.ptr + psf->header.indx, bytes) ;
  881|  4.24M|	psf->header.indx += bytes ;
  882|       |
  883|  4.24M|	return bytes ;
  884|  6.62M|} /* header_read */
common.c:store_ushort:
  995|  3.13M|{	memcpy (ptr, &value, sizeof (value)) ;
  996|  3.13M|} /* store_ushort */
common.c:store_count:
 1000|   274k|{	memcpy (ptr, &value, sizeof (value)) ;
 1001|   274k|} /* store_count */
common.c:store_float:
 1005|  77.9k|{	memcpy (ptr, &value, sizeof (value)) ;
 1006|  77.9k|} /* store_float */
common.c:store_double:
 1010|  1.20k|{	memcpy (ptr, &value, sizeof (value)) ;
 1011|  1.20k|} /* store_double */
common.c:header_gets:
  957|    124|{	int		k ;
  958|       |
  959|    124|	if (psf->header.indx + bufsize >= psf->header.len && psf_bump_header_allocation (psf, bufsize))
  ------------------
  |  Branch (959:6): [True: 0, False: 124]
  |  Branch (959:55): [True: 0, False: 0]
  ------------------
  960|      0|		return 0 ;
  961|       |
  962|  3.06k|	for (k = 0 ; k < bufsize - 1 ; k++)
  ------------------
  |  Branch (962:15): [True: 2.98k, False: 88]
  ------------------
  963|  2.98k|	{	if (psf->header.indx < psf->header.end)
  ------------------
  |  Branch (963:8): [True: 848, False: 2.13k]
  ------------------
  964|    848|		{	ptr [k] = psf->header.ptr [psf->header.indx] ;
  965|    848|			psf->header.indx ++ ;
  966|    848|			}
  967|  2.13k|		else
  968|  2.13k|		{	psf->header.end += psf_fread (psf->header.ptr + psf->header.end, 1, 1, psf) ;
  969|  2.13k|			ptr [k] = psf->header.ptr [psf->header.indx] ;
  970|  2.13k|			psf->header.indx = psf->header.end ;
  971|  2.13k|			} ;
  972|       |
  973|  2.98k|		if (ptr [k] == '\n')
  ------------------
  |  Branch (973:7): [True: 36, False: 2.94k]
  ------------------
  974|     36|			break ;
  975|  2.98k|		} ;
  976|       |
  977|    124|	ptr [k] = 0 ;
  978|       |
  979|    124|	return k ;
  980|    124|} /* header_gets */
common.c:header_seek:
  888|   644k|{
  889|   644k|	switch (whence)
  890|   644k|	{	case SEEK_SET :
  ------------------
  |  Branch (890:4): [True: 20.5k, False: 624k]
  ------------------
  891|  20.5k|			if (psf->header.indx + position >= psf->header.len)
  ------------------
  |  Branch (891:8): [True: 200, False: 20.3k]
  ------------------
  892|    200|				psf_bump_header_allocation (psf, position) ;
  893|  20.5k|			if (position > psf->header.len)
  ------------------
  |  Branch (893:8): [True: 5, False: 20.5k]
  ------------------
  894|      5|			{	/* Too much header to cache so just seek instead. */
  895|      5|				psf->header.indx = psf->header.end = 0 ;
  896|      5|				psf_fseek (psf, position, whence) ;
  897|      5|				return ;
  898|  20.5k|				} ;
  899|  20.5k|			if (position > psf->header.end)
  ------------------
  |  Branch (899:8): [True: 912, False: 19.6k]
  ------------------
  900|    912|				psf->header.end += psf_fread (psf->header.ptr + psf->header.end, 1, position - psf->header.end, psf) ;
  901|  20.5k|			psf->header.indx = position ;
  902|  20.5k|			break ;
  903|       |
  904|   624k|		case SEEK_CUR :
  ------------------
  |  Branch (904:3): [True: 624k, False: 20.5k]
  ------------------
  905|   624k|			if (psf->header.indx + position >= psf->header.len)
  ------------------
  |  Branch (905:8): [True: 6.30k, False: 617k]
  ------------------
  906|  6.30k|				psf_bump_header_allocation (psf, position) ;
  907|       |
  908|   624k|			if (psf->header.indx + position < 0)
  ------------------
  |  Branch (908:8): [True: 37.8k, False: 586k]
  ------------------
  909|  37.8k|				break ;
  910|       |
  911|   586k|			if (psf->header.indx >= psf->header.len)
  ------------------
  |  Branch (911:8): [True: 0, False: 586k]
  ------------------
  912|      0|			{	psf_fseek (psf, position, whence) ;
  913|      0|				return ;
  914|   586k|				} ;
  915|       |
  916|   586k|			if (psf->header.indx + position <= psf->header.end)
  ------------------
  |  Branch (916:8): [True: 314k, False: 271k]
  ------------------
  917|   314k|			{	psf->header.indx += position ;
  918|   314k|				break ;
  919|   314k|				} ;
  920|       |
  921|   271k|			if (psf->header.indx + position > psf->header.len)
  ------------------
  |  Branch (921:8): [True: 4.87k, False: 266k]
  ------------------
  922|  4.87k|			{	/* Need to jump this without caching it. */
  923|  4.87k|				position -= (psf->header.end - psf->header.indx) ;
  924|  4.87k|				psf->header.indx = psf->header.end ;
  925|  4.87k|				if (psf->is_pipe)
  ------------------
  |  Branch (925:9): [True: 0, False: 4.87k]
  ------------------
  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.87k|				else
  937|  4.87k|				{	psf_fseek (psf, position, SEEK_CUR) ;
  938|  4.87k|					}
  939|  4.87k|				break ;
  940|   266k|				} ;
  941|       |
  942|   266k|			psf->header.end += psf_fread (psf->header.ptr + psf->header.end, 1, position - (psf->header.end - psf->header.indx), psf) ;
  943|   266k|			psf->header.indx = psf->header.end ;
  944|   266k|			break ;
  945|       |
  946|      0|		case SEEK_END :
  ------------------
  |  Branch (946:3): [True: 0, False: 644k]
  ------------------
  947|      0|		default :
  ------------------
  |  Branch (947:3): [True: 0, False: 644k]
  ------------------
  948|      0|			psf_log_printf (psf, "Bad whence param in header_seek().\n") ;
  949|      0|			break ;
  950|   644k|		} ;
  951|       |
  952|   644k|	return ;
  953|   644k|} /* header_seek */

aiff.c:peak_info_calloc:
  233|  5.20k|{	return calloc (1, sizeof (PEAK_INFO) + channels * sizeof (PEAK_POS)) ;
  234|  5.20k|} /* peak_info_calloc */
aiff.c:make_size_t:
  279|  2.60k|{	return (size_t) x ;
  280|  2.60k|} /* make_size_t */
avr.c:arith_shift_left:
 1086|     73|{	return (int32_t) (((uint32_t) x) << shift) ;
 1087|     73|} /* arith_shift_left */
caf.c:peak_info_calloc:
  233|    493|{	return calloc (1, sizeof (PEAK_INFO) + channels * sizeof (PEAK_POS)) ;
  234|    493|} /* peak_info_calloc */
caf.c:psf_lrint:
  974|  2.30k|{
  975|  2.30k|	#ifdef USE_SSE2
  976|  2.30k|		return _mm_cvtsd_si32 (_mm_load_sd (&x)) ;
  977|       |	#else
  978|       |		return lrint (x) ;
  979|       |	#endif
  980|  2.30k|} /* psf_lrintf */
ircam.c:psf_lrintf:
  965|    285|{
  966|    285|	#ifdef USE_SSE2
  967|    285|		return _mm_cvtss_si32 (_mm_load_ss (&x)) ;
  968|       |	#else
  969|       |		return lrintf (x) ;
  970|       |	#endif
  971|    285|} /* psf_lrintf */
mat4.c:psf_lrint:
  974|    602|{
  975|    602|	#ifdef USE_SSE2
  976|    602|		return _mm_cvtsd_si32 (_mm_load_sd (&x)) ;
  977|       |	#else
  978|       |		return lrint (x) ;
  979|       |	#endif
  980|    602|} /* psf_lrintf */
mat5.c:psf_lrint:
  974|      1|{
  975|      1|	#ifdef USE_SSE2
  976|      1|		return _mm_cvtsd_si32 (_mm_load_sd (&x)) ;
  977|       |	#else
  978|       |		return lrint (x) ;
  979|       |	#endif
  980|      1|} /* psf_lrintf */
sds.c:arith_shift_left:
 1086|   106M|{	return (int32_t) (((uint32_t) x) << shift) ;
 1087|   106M|} /* arith_shift_left */
wavlike.c:make_size_t:
  279|  1.99k|{	return (size_t) x ;
  280|  1.99k|} /* make_size_t */
wavlike.c:peak_info_calloc:
  233|  8.89k|{	return calloc (1, sizeof (PEAK_INFO) + channels * sizeof (PEAK_POS)) ;
  234|  8.89k|} /* peak_info_calloc */
xi.c:arith_shift_left:
 1086|  1.14k|{	return (int32_t) (((uint32_t) x) << shift) ;
 1087|  1.14k|} /* arith_shift_left */
mpc2k.c:make_size_t:
  279|     12|{	return (size_t) x ;
  280|     12|} /* make_size_t */
dwvw.c:arith_shift_left:
 1086|  31.3M|{	return (int32_t) (((uint32_t) x) << shift) ;
 1087|  31.3M|} /* arith_shift_left */

double64_init:
   92|    275|{	static int double64_caps ;
   93|       |
   94|    275|	if (psf->sf.channels < 1 || psf->sf.channels > SF_MAX_CHANNELS)
  ------------------
  |  |  102|    202|#define		SF_MAX_CHANNELS		1024
  ------------------
  |  Branch (94:6): [True: 73, False: 202]
  |  Branch (94:30): [True: 1, False: 201]
  ------------------
   95|     74|	{	psf_log_printf (psf, "double64_init : internal error : channels = %d\n", psf->sf.channels) ;
   96|     74|		return SFE_INTERNAL ;
   97|    201|		} ;
   98|       |
   99|    201|	double64_caps = double64_get_capability (psf) ;
  100|       |
  101|    201|	psf->blockwidth = sizeof (double) * psf->sf.channels ;
  102|       |
  103|    201|	if (psf->file.mode == SFM_READ || psf->file.mode == SFM_RDWR)
  ------------------
  |  Branch (103:6): [True: 201, False: 0]
  |  Branch (103:36): [True: 0, False: 0]
  ------------------
  104|    201|	{	switch (psf->endian + double64_caps)
  105|    201|		{	case (SF_ENDIAN_BIG + DOUBLE_CAN_RW_BE) :
  ------------------
  |  Branch (105:5): [True: 0, False: 201]
  ------------------
  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|    106|			case (SF_ENDIAN_LITTLE + DOUBLE_CAN_RW_LE) :
  ------------------
  |  Branch (113:4): [True: 106, False: 95]
  ------------------
  114|    106|					psf->data_endswap = SF_FALSE ;
  115|    106|					psf->read_short		= host_read_d2s ;
  116|    106|					psf->read_int		= host_read_d2i ;
  117|    106|					psf->read_float		= host_read_d2f ;
  118|    106|					psf->read_double	= host_read_d ;
  119|    106|					break ;
  120|       |
  121|     95|			case (SF_ENDIAN_BIG + DOUBLE_CAN_RW_LE) :
  ------------------
  |  Branch (121:4): [True: 95, False: 106]
  ------------------
  122|     95|					psf->data_endswap = SF_TRUE ;
  123|     95|					psf->read_short		= host_read_d2s ;
  124|     95|					psf->read_int		= host_read_d2i ;
  125|     95|					psf->read_float		= host_read_d2f ;
  126|     95|					psf->read_double	= host_read_d ;
  127|     95|					break ;
  128|       |
  129|      0|			case (SF_ENDIAN_LITTLE + DOUBLE_CAN_RW_BE) :
  ------------------
  |  Branch (129:4): [True: 0, False: 201]
  ------------------
  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: 201]
  ------------------
  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: 201]
  ------------------
  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: 201]
  ------------------
  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: 201]
  ------------------
  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: 201]
  ------------------
  171|    201|			} ;
  172|    201|		} ;
  173|       |
  174|    201|	if (psf->file.mode == SFM_WRITE || psf->file.mode == SFM_RDWR)
  ------------------
  |  Branch (174:6): [True: 0, False: 201]
  |  Branch (174:37): [True: 0, False: 201]
  ------------------
  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|    201|		} ;
  244|       |
  245|    201|	if (psf->filelength > psf->dataoffset)
  ------------------
  |  Branch (245:6): [True: 145, False: 56]
  ------------------
  246|    145|	{	psf->datalength = (psf->dataend > 0) ? psf->dataend - psf->dataoffset :
  ------------------
  |  Branch (246:22): [True: 1, False: 144]
  ------------------
  247|    145|							psf->filelength - psf->dataoffset ;
  248|    145|		}
  249|     56|	else
  250|     56|		psf->datalength = 0 ;
  251|       |
  252|    201|	psf->sf.frames = psf->datalength / psf->blockwidth ;
  253|       |
  254|    201|	return 0 ;
  255|    201|} /* double64_init */
double64_be_read:
  285|  2.47k|{	int		exponent, negative, upper, lower ;
  286|  2.47k|	double	dvalue ;
  287|       |
  288|  2.47k|	negative = (cptr [0] & 0x80) ? 1 : 0 ;
  ------------------
  |  Branch (288:13): [True: 262, False: 2.21k]
  ------------------
  289|  2.47k|	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.47k|	upper = (((cptr [1] & 0xF) << 24) | (cptr [2] << 16) | (cptr [3] << 8) | cptr [4]) ;
  293|  2.47k|	lower = (cptr [5] << 16) | (cptr [6] << 8) | cptr [7] ;
  294|       |
  295|  2.47k|	if (exponent == 0 && upper == 0 && lower == 0)
  ------------------
  |  Branch (295:6): [True: 289, False: 2.18k]
  |  Branch (295:23): [True: 159, False: 130]
  |  Branch (295:37): [True: 150, False: 9]
  ------------------
  296|    150|		return 0.0 ;
  297|       |
  298|  2.32k|	dvalue = upper + lower / ((double) 0x1000000) ;
  299|  2.32k|	dvalue += 0x10000000 ;
  300|       |
  301|  2.32k|	exponent = exponent - 0x3FF ;
  302|       |
  303|  2.32k|	dvalue = dvalue / ((double) 0x10000000) ;
  304|       |
  305|  2.32k|	if (negative)
  ------------------
  |  Branch (305:6): [True: 262, False: 2.06k]
  ------------------
  306|    262|		dvalue *= -1 ;
  307|       |
  308|  2.32k|	if (exponent > 0)
  ------------------
  |  Branch (308:6): [True: 1.72k, False: 603]
  ------------------
  309|  1.72k|		dvalue *= pow (2.0, exponent) ;
  310|    603|	else if (exponent < 0)
  ------------------
  |  Branch (310:11): [True: 542, False: 61]
  ------------------
  311|    542|		dvalue /= pow (2.0, abs (exponent)) ;
  312|       |
  313|  2.32k|	return dvalue ;
  314|  2.47k|} /* double64_be_read */
double64_le_read:
  318|    499|{	int		exponent, negative, upper, lower ;
  319|    499|	double	dvalue ;
  320|       |
  321|    499|	negative = (cptr [7] & 0x80) ? 1 : 0 ;
  ------------------
  |  Branch (321:13): [True: 128, False: 371]
  ------------------
  322|    499|	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|    499|	upper = ((cptr [6] & 0xF) << 24) | (cptr [5] << 16) | (cptr [4] << 8) | cptr [3] ;
  326|    499|	lower = (cptr [2] << 16) | (cptr [1] << 8) | cptr [0] ;
  327|       |
  328|    499|	if (exponent == 0 && upper == 0 && lower == 0)
  ------------------
  |  Branch (328:6): [True: 196, False: 303]
  |  Branch (328:23): [True: 102, False: 94]
  |  Branch (328:37): [True: 55, False: 47]
  ------------------
  329|     55|		return 0.0 ;
  330|       |
  331|    444|	dvalue = upper + lower / ((double) 0x1000000) ;
  332|    444|	dvalue += 0x10000000 ;
  333|       |
  334|    444|	exponent = exponent - 0x3FF ;
  335|       |
  336|    444|	dvalue = dvalue / ((double) 0x10000000) ;
  337|       |
  338|    444|	if (negative)
  ------------------
  |  Branch (338:6): [True: 128, False: 316]
  ------------------
  339|    128|		dvalue *= -1 ;
  340|       |
  341|    444|	if (exponent > 0)
  ------------------
  |  Branch (341:6): [True: 132, False: 312]
  ------------------
  342|    132|		dvalue *= pow (2.0, exponent) ;
  343|    312|	else if (exponent < 0)
  ------------------
  |  Branch (343:11): [True: 310, False: 2]
  ------------------
  344|    310|		dvalue /= pow (2.0, abs (exponent)) ;
  345|       |
  346|    444|	return dvalue ;
  347|    499|} /* double64_le_read */
double64.c:double64_get_capability:
  459|    201|{	union
  460|    201|	{	double			d ;
  461|    201|		unsigned char	c [8] ;
  462|    201|	} data ;
  463|       |
  464|    201|	data.d = 1.234567890123456789 ; /* Some arbitrary value. */
  465|       |
  466|    201|	if (! psf->ieee_replace)
  ------------------
  |  Branch (466:6): [True: 201, False: 0]
  ------------------
  467|    201|	{	/* If this test is true ints and floats are compatible and little endian. */
  468|    201|		if (data.c [0] == 0xfb && data.c [1] == 0x59 && data.c [2] == 0x8c && data.c [3] == 0x42 &&
  ------------------
  |  Branch (468:7): [True: 201, False: 0]
  |  Branch (468:29): [True: 201, False: 0]
  |  Branch (468:51): [True: 201, False: 0]
  |  Branch (468:73): [True: 201, False: 0]
  ------------------
  469|    201|			data.c [4] == 0xca && data.c [5] == 0xc0 && data.c [6] == 0xf3 && data.c [7] == 0x3f)
  ------------------
  |  Branch (469:4): [True: 201, False: 0]
  |  Branch (469:26): [True: 201, False: 0]
  |  Branch (469:48): [True: 201, False: 0]
  |  Branch (469:70): [True: 201, False: 0]
  ------------------
  470|    201|			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|    201|} /* double64_get_capability */
double64.c:host_read_d2f:
  622|    640|{	BUF_UNION	ubuf ;
  623|    640|	int			bufferlen, readcount ;
  624|    640|	sf_count_t	total = 0 ;
  625|       |
  626|    640|	bufferlen = ARRAY_LEN (ubuf.dbuf) ;
  ------------------
  |  |   93|    640|#define		ARRAY_LEN(x)	((int) (sizeof (x) / sizeof ((x) [0])))
  ------------------
  627|       |
  628|  1.24k|	while (len > 0)
  ------------------
  |  Branch (628:9): [True: 640, False: 606]
  ------------------
  629|    640|	{	if (len < bufferlen)
  ------------------
  |  Branch (629:8): [True: 445, False: 195]
  ------------------
  630|    445|			bufferlen = (int) len ;
  631|    640|		readcount = (int) psf_fread (ubuf.dbuf, sizeof (double), bufferlen, psf) ;
  632|       |
  633|    640|		if (psf->data_endswap == SF_TRUE)
  ------------------
  |  Branch (633:7): [True: 420, False: 220]
  ------------------
  634|    420|			endswap_double_array (ubuf.dbuf, readcount) ;
  635|       |
  636|    640|		d2f_array (ubuf.dbuf, readcount, ptr + total) ;
  637|    640|		total += readcount ;
  638|    640|		len -= readcount ;
  639|    640|		if (readcount < bufferlen)
  ------------------
  |  Branch (639:7): [True: 34, False: 606]
  ------------------
  640|     34|			break ;
  641|    640|		} ;
  642|       |
  643|    640|	return total ;
  644|    640|} /* host_read_d2f */
double64.c:d2f_array:
  531|   194k|{	for (int i = 0 ; i < count ; i++)
  ------------------
  |  Branch (531:20): [True: 193k, False: 640]
  ------------------
  532|   193k|	{	dest [i] = src [i] ;
  533|   193k|		} ;
  534|    640|} /* 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|    235|{	DWVW_PRIVATE	*pdwvw ;
   81|       |
   82|    235|	if (psf->codec_data != NULL)
  ------------------
  |  Branch (82:6): [True: 0, False: 235]
  ------------------
   83|      0|	{	psf_log_printf (psf, "*** psf->codec_data is not NULL.\n") ;
   84|      0|		return SFE_INTERNAL ;
   85|    235|		} ;
   86|       |
   87|    235|	if (bitwidth > 24)
  ------------------
  |  Branch (87:6): [True: 0, False: 235]
  ------------------
   88|      0|		return SFE_DWVW_BAD_BITWIDTH ;
   89|       |
   90|    235|	if (psf->file.mode == SFM_RDWR)
  ------------------
  |  Branch (90:6): [True: 0, False: 235]
  ------------------
   91|      0|		return SFE_BAD_MODE_RW ;
   92|       |
   93|    235|	if ((pdwvw = calloc (1, sizeof (DWVW_PRIVATE))) == NULL)
  ------------------
  |  Branch (93:6): [True: 0, False: 235]
  ------------------
   94|      0|		return SFE_MALLOC_FAILED ;
   95|       |
   96|    235|	psf->codec_data = (void*) pdwvw ;
   97|    235|	pdwvw->bit_width 	= bitwidth ;
   98|    235|	dwvw_read_reset (pdwvw) ;
   99|       |
  100|    235|	if (psf->file.mode == SFM_READ)
  ------------------
  |  Branch (100:6): [True: 235, False: 0]
  ------------------
  101|    235|	{	psf->read_short		= dwvw_read_s ;
  102|    235|		psf->read_int		= dwvw_read_i ;
  103|    235|		psf->read_float		= dwvw_read_f ;
  104|    235|		psf->read_double	= dwvw_read_d ;
  105|    235|		} ;
  106|       |
  107|    235|	if (psf->file.mode == SFM_WRITE)
  ------------------
  |  Branch (107:6): [True: 0, False: 235]
  ------------------
  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|    235|	psf->codec_close = dwvw_close ;
  115|    235|	psf->seek = dwvw_seek ;
  116|    235|	psf->byterate = dwvw_byterate ;
  117|       |
  118|    235|	if (psf->file.mode == SFM_READ)
  ------------------
  |  Branch (118:6): [True: 235, False: 0]
  ------------------
  119|    235|	{	psf->sf.frames = psf_decode_frame_count (psf) ;
  120|    235|		dwvw_read_reset (pdwvw) ;
  121|    235|		} ;
  122|       |
  123|    235|	return 0 ;
  124|    235|} /* dwvw_init */
dwvw.c:dwvw_close:
  131|    235|{	DWVW_PRIVATE *pdwvw ;
  132|       |
  133|    235|	if (psf->codec_data == NULL)
  ------------------
  |  Branch (133:6): [True: 0, False: 235]
  ------------------
  134|      0|		return 0 ;
  135|    235|	pdwvw = (DWVW_PRIVATE*) psf->codec_data ;
  136|       |
  137|    235|	if (psf->file.mode == SFM_WRITE)
  ------------------
  |  Branch (137:6): [True: 0, False: 235]
  ------------------
  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|    235|	return 0 ;
  151|    235|} /* dwvw_close */
dwvw.c:dwvw_decode_data:
  306|  13.1k|{	int	count ;
  307|  13.1k|	int delta_width_modifier, delta_width, delta_negative, delta, sample ;
  308|       |
  309|       |	/* Restore state from last decode call. */
  310|  13.1k|	delta_width = pdwvw->last_delta_width ;
  311|  13.1k|	sample = pdwvw->last_sample ;
  312|       |
  313|  19.4M|	for (count = 0 ; count < len ; count++)
  ------------------
  |  Branch (313:19): [True: 19.4M, False: 12.7k]
  ------------------
  314|  19.4M|	{	/* If bit_count parameter is zero get the delta_width_modifier. */
  315|  19.4M|		delta_width_modifier = dwvw_decode_load_bits (psf, pdwvw, -1) ;
  316|       |
  317|       |		/* Check for end of input bit stream. Break loop if end. */
  318|  19.4M|		if (delta_width_modifier < 0 || (pdwvw->b.end == 0 && count == 0))
  ------------------
  |  Branch (318:7): [True: 171, False: 19.4M]
  |  Branch (318:36): [True: 60.8k, False: 19.3M]
  |  Branch (318:57): [True: 141, False: 60.6k]
  ------------------
  319|    312|			break ;
  320|       |
  321|  19.4M|		if (delta_width_modifier && dwvw_decode_load_bits (psf, pdwvw, 1))
  ------------------
  |  Branch (321:7): [True: 4.27M, False: 15.1M]
  |  Branch (321:31): [True: 1.81M, False: 2.46M]
  ------------------
  322|  1.81M|			delta_width_modifier = - delta_width_modifier ;
  323|       |
  324|       |		/* Calculate the current word width. */
  325|  19.4M|		delta_width = (delta_width + delta_width_modifier + pdwvw->bit_width) % pdwvw->bit_width ;
  326|       |
  327|       |		/* Load the delta. */
  328|  19.4M|		delta = 0 ;
  329|  19.4M|		if (delta_width)
  ------------------
  |  Branch (329:7): [True: 16.8M, False: 2.63M]
  ------------------
  330|  16.8M|		{	delta = dwvw_decode_load_bits (psf, pdwvw, delta_width - 1) | (1 << (delta_width - 1)) ;
  331|  16.8M|			delta_negative = dwvw_decode_load_bits (psf, pdwvw, 1) ;
  332|  16.8M|			if (delta == pdwvw->max_delta - 1)
  ------------------
  |  Branch (332:8): [True: 512k, False: 16.3M]
  ------------------
  333|   512k|				delta += dwvw_decode_load_bits (psf, pdwvw, 1) ;
  334|  16.8M|			if (delta_negative)
  ------------------
  |  Branch (334:8): [True: 12.8M, False: 3.99M]
  ------------------
  335|  12.8M|				delta = -delta ;
  336|  16.8M|			} ;
  337|       |
  338|       |		/* Calculate the sample */
  339|  19.4M|		sample += delta ;
  340|       |
  341|  19.4M|		if (sample >= pdwvw->max_delta)
  ------------------
  |  Branch (341:7): [True: 341k, False: 19.1M]
  ------------------
  342|   341k|			sample -= pdwvw->span ;
  343|  19.1M|		else if (sample < - pdwvw->max_delta)
  ------------------
  |  Branch (343:12): [True: 1.07M, False: 18.0M]
  ------------------
  344|  1.07M|			sample += pdwvw->span ;
  345|       |
  346|       |		/* Store the sample justifying to the most significant bit. */
  347|  19.4M|		ptr [count] = arith_shift_left (sample, 32 - pdwvw->bit_width) ;
  348|       |
  349|  19.4M|		if (pdwvw->b.end == 0 && pdwvw->bit_count == 0)
  ------------------
  |  Branch (349:7): [True: 60.7k, False: 19.3M]
  |  Branch (349:28): [True: 88, False: 60.6k]
  ------------------
  350|     88|			break ;
  351|  19.4M|		} ;
  352|       |
  353|  13.1k|	pdwvw->last_delta_width = delta_width ;
  354|  13.1k|	pdwvw->last_sample = sample ;
  355|       |
  356|  13.1k|	pdwvw->samplecount += count ;
  357|       |
  358|  13.1k|	return count ;
  359|  13.1k|} /* dwvw_decode_data */
dwvw.c:dwvw_decode_load_bits:
  363|  57.8M|{	int output = 0, get_dwm = SF_FALSE ;
  364|       |
  365|       |	/*
  366|       |	**	Depending on the value of parameter bit_count, either get the
  367|       |	**	required number of bits (ie bit_count > 0) or the
  368|       |	**	delta_width_modifier (otherwise).
  369|       |	*/
  370|       |
  371|  57.8M|	if (bit_count < 0)
  ------------------
  |  Branch (371:6): [True: 19.4M, False: 38.4M]
  ------------------
  372|  19.4M|	{	get_dwm = SF_TRUE ;
  373|       |		/* modify bit_count to ensure we have enough bits for finding dwm. */
  374|  19.4M|		bit_count = pdwvw->dwm_maxsize ;
  375|  19.4M|		} ;
  376|       |
  377|       |	/* Load bits in bit reseviour. */
  378|  69.8M|	while (pdwvw->bit_count < bit_count)
  ------------------
  |  Branch (378:9): [True: 11.9M, False: 57.8M]
  ------------------
  379|  11.9M|	{	if (pdwvw->b.index >= pdwvw->b.end)
  ------------------
  |  Branch (379:8): [True: 224k, False: 11.7M]
  ------------------
  380|   224k|		{	pdwvw->b.end = (int) psf_fread (pdwvw->b.buffer, 1, sizeof (pdwvw->b.buffer), psf) ;
  381|   224k|			pdwvw->b.index = 0 ;
  382|   224k|			} ;
  383|       |
  384|       |		/* Check for end of input stream. */
  385|  11.9M|		if (bit_count < 8 && pdwvw->b.end == 0)
  ------------------
  |  Branch (385:7): [True: 9.61M, False: 2.33M]
  |  Branch (385:24): [True: 20.8k, False: 9.59M]
  ------------------
  386|  20.8k|			return -1 ;
  387|       |
  388|  11.9M|		pdwvw->bits = arith_shift_left (pdwvw->bits, 8) ;
  389|       |
  390|  11.9M|		if (pdwvw->b.index < pdwvw->b.end)
  ------------------
  |  Branch (390:7): [True: 11.7M, False: 157k]
  ------------------
  391|  11.7M|		{	pdwvw->bits |= pdwvw->b.buffer [pdwvw->b.index] ;
  392|  11.7M|			pdwvw->b.index ++ ;
  393|  11.7M|			} ;
  394|  11.9M|		pdwvw->bit_count += 8 ;
  395|  57.8M|		} ;
  396|       |
  397|       |	/* If asked to get bits do so. */
  398|  57.8M|	if (! get_dwm)
  ------------------
  |  Branch (398:6): [True: 38.4M, False: 19.4M]
  ------------------
  399|  38.4M|	{	output = (pdwvw->bits >> (pdwvw->bit_count - bit_count)) & ((1 << bit_count) - 1) ;
  400|  38.4M|		pdwvw->bit_count -= bit_count ;
  401|  38.4M|		return output ;
  402|  38.4M|		} ;
  403|       |
  404|       |	/* Otherwise must have been asked to get delta_width_modifier. */
  405|  27.0M|	while (output < (pdwvw->dwm_maxsize))
  ------------------
  |  Branch (405:9): [True: 26.6M, False: 475k]
  ------------------
  406|  26.6M|	{	pdwvw->bit_count -= 1 ;
  407|  26.6M|		if (pdwvw->bits & (1 << pdwvw->bit_count))
  ------------------
  |  Branch (407:7): [True: 18.9M, False: 7.64M]
  ------------------
  408|  18.9M|			break ;
  409|  7.64M|		output += 1 ;
  410|  7.64M|		} ;
  411|       |
  412|  19.4M|	return output ;
  413|  57.8M|} /* dwvw_decode_load_bits */
dwvw.c:dwvw_read_i:
  217|  9.61k|{	DWVW_PRIVATE *pdwvw ;
  218|  9.61k|	int			readcount, count ;
  219|  9.61k|	sf_count_t	total = 0 ;
  220|       |
  221|  9.61k|	if (! psf->codec_data)
  ------------------
  |  Branch (221:6): [True: 0, False: 9.61k]
  ------------------
  222|      0|		return 0 ;
  223|  9.61k|	pdwvw = (DWVW_PRIVATE*) psf->codec_data ;
  224|       |
  225|  18.8k|	while (len > 0)
  ------------------
  |  Branch (225:9): [True: 9.61k, False: 9.22k]
  ------------------
  226|  9.61k|	{	readcount = (len > 0x10000000) ? 0x10000000 : (int) len ;
  ------------------
  |  Branch (226:16): [True: 0, False: 9.61k]
  ------------------
  227|       |
  228|  9.61k|		count = dwvw_decode_data (psf, pdwvw, ptr, readcount) ;
  229|       |
  230|  9.61k|		total += count ;
  231|  9.61k|		len -= count ;
  232|       |
  233|  9.61k|		if (count != readcount)
  ------------------
  |  Branch (233:7): [True: 389, False: 9.22k]
  ------------------
  234|    389|			break ;
  235|  9.61k|		} ;
  236|       |
  237|  9.61k|	return total ;
  238|  9.61k|} /* dwvw_read_i */
dwvw.c:dwvw_read_f:
  242|  3.54k|{	DWVW_PRIVATE *pdwvw ;
  243|  3.54k|	BUF_UNION	ubuf ;
  244|  3.54k|	int			*iptr ;
  245|  3.54k|	int			k, bufferlen, readcount = 0, count ;
  246|  3.54k|	sf_count_t	total = 0 ;
  247|  3.54k|	float	normfact ;
  248|       |
  249|  3.54k|	if (! psf->codec_data)
  ------------------
  |  Branch (249:6): [True: 0, False: 3.54k]
  ------------------
  250|      0|		return 0 ;
  251|  3.54k|	pdwvw = (DWVW_PRIVATE*) psf->codec_data ;
  252|       |
  253|  3.54k|	normfact = (psf->norm_float == SF_TRUE) ? 1.0 / ((float) 0x80000000) : 1.0 ;
  ------------------
  |  Branch (253:13): [True: 3.54k, False: 0]
  ------------------
  254|       |
  255|  3.54k|	iptr = ubuf.ibuf ;
  256|  3.54k|	bufferlen = ARRAY_LEN (ubuf.ibuf) ;
  ------------------
  |  |   93|  3.54k|#define		ARRAY_LEN(x)	((int) (sizeof (x) / sizeof ((x) [0])))
  ------------------
  257|  7.07k|	while (len > 0)
  ------------------
  |  Branch (257:9): [True: 3.54k, False: 3.53k]
  ------------------
  258|  3.54k|	{	readcount = (len >= bufferlen) ? bufferlen : (int) len ;
  ------------------
  |  Branch (258:16): [True: 0, False: 3.54k]
  ------------------
  259|  3.54k|		count = dwvw_decode_data (psf, pdwvw, iptr, readcount) ;
  260|   948k|		for (k = 0 ; k < readcount ; k++)
  ------------------
  |  Branch (260:16): [True: 944k, False: 3.54k]
  ------------------
  261|   944k|			ptr [total + k] = normfact * (float) (iptr [k]) ;
  262|       |
  263|  3.54k|		total += count ;
  264|  3.54k|		len -= readcount ;
  265|  3.54k|		if (count != readcount)
  ------------------
  |  Branch (265:7): [True: 11, False: 3.53k]
  ------------------
  266|     11|			break ;
  267|  3.54k|		} ;
  268|       |
  269|  3.54k|	return total ;
  270|  3.54k|} /* dwvw_read_f */
dwvw.c:dwvw_read_reset:
  417|    470|{	int bitwidth = pdwvw->bit_width ;
  418|       |
  419|    470|	memset (pdwvw, 0, sizeof (DWVW_PRIVATE)) ;
  420|       |
  421|    470|	pdwvw->bit_width	= bitwidth ;
  422|    470|	pdwvw->dwm_maxsize	= bitwidth / 2 ;
  423|    470|	pdwvw->max_delta	= 1 << (bitwidth - 1) ;
  424|    470|	pdwvw->span			= 1 << bitwidth ;
  425|    470|} /* dwvw_read_reset */

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

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

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

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

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

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

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

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

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

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

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

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

nms_adpcm_init:
 1026|    230|{	NMS_ADPCM_PRIVATE	*pnms ;
 1027|       |
 1028|    230|	if (psf->codec_data != NULL)
  ------------------
  |  Branch (1028:6): [True: 0, False: 230]
  ------------------
 1029|      0|	{	psf_log_printf (psf, "*** psf->codec_data is not NULL.\n") ;
 1030|      0|		return SFE_INTERNAL ;
 1031|    230|		} ;
 1032|       |
 1033|    230|	psf->sf.seekable = SF_FALSE ;
 1034|       |
 1035|    230|	if (psf->sf.channels != 1)
  ------------------
  |  Branch (1035:6): [True: 0, False: 230]
  ------------------
 1036|      0|		return SFE_NMS_ADPCM_NOT_MONO ;
 1037|       |
 1038|    230|	if ((pnms = calloc (1, sizeof (NMS_ADPCM_PRIVATE))) == NULL)
  ------------------
  |  Branch (1038:6): [True: 0, False: 230]
  ------------------
 1039|      0|		return SFE_MALLOC_FAILED ;
 1040|       |
 1041|    230|	psf->codec_data = (void*) pnms ;
 1042|       |
 1043|    230|	pnms->block_curr = 0 ;
 1044|    230|	pnms->sample_curr = 0 ;
 1045|       |
 1046|    230|	switch (SF_CODEC (psf->sf.format))
  ------------------
  |  |  109|    230|#define SF_CODEC(x)			((x) & SF_FORMAT_SUBMASK)
  ------------------
 1047|    230|	{	case SF_FORMAT_NMS_ADPCM_16 :
  ------------------
  |  Branch (1047:4): [True: 176, False: 54]
  ------------------
 1048|    176|					pnms->type = NMS16 ;
 1049|    176|					pnms->shortsperblock = NMS_BLOCK_SHORTS_16 ;
  ------------------
  |  |   46|    176|#define NMS_BLOCK_SHORTS_16 21
  ------------------
 1050|    176|					break ;
 1051|     28|		case SF_FORMAT_NMS_ADPCM_24 :
  ------------------
  |  Branch (1051:3): [True: 28, False: 202]
  ------------------
 1052|     28|					pnms->type = NMS24 ;
 1053|     28|					pnms->shortsperblock = NMS_BLOCK_SHORTS_24 ;
  ------------------
  |  |   45|     28|#define NMS_BLOCK_SHORTS_24 31
  ------------------
 1054|     28|					break ;
 1055|     26|		case SF_FORMAT_NMS_ADPCM_32 :
  ------------------
  |  Branch (1055:3): [True: 26, False: 204]
  ------------------
 1056|     26|					pnms->type = NMS32 ;
 1057|     26|					pnms->shortsperblock = NMS_BLOCK_SHORTS_32 ;
  ------------------
  |  |   44|     26|#define NMS_BLOCK_SHORTS_32 41
  ------------------
 1058|     26|					break ;
 1059|       |
 1060|      0|		default : return SFE_UNIMPLEMENTED ;
  ------------------
  |  Branch (1060:3): [True: 0, False: 230]
  ------------------
 1061|    230|	} ;
 1062|    230|	nms_adpcm_codec_init (&pnms->state, pnms->type) ;
 1063|       |
 1064|    230|	psf->filelength = psf_get_filelen (psf) ;
 1065|    230|	if (psf->filelength < psf->dataoffset)
  ------------------
  |  Branch (1065:6): [True: 0, False: 230]
  ------------------
 1066|      0|		psf->filelength = psf->dataoffset ;
 1067|       |
 1068|    230|	psf->datalength = psf->filelength - psf->dataoffset ;
 1069|    230|	if (psf->dataend > 0)
  ------------------
  |  Branch (1069:6): [True: 1, False: 229]
  ------------------
 1070|      1|		psf->datalength -= psf->filelength - psf->dataend ;
 1071|       |
 1072|    230|	if (psf->file.mode == SFM_READ)
  ------------------
  |  Branch (1072:6): [True: 230, False: 0]
  ------------------
 1073|    230|	{	psf->read_short		= nms_adpcm_read_s ;
 1074|    230|		psf->read_int		= nms_adpcm_read_i ;
 1075|    230|		psf->read_float		= nms_adpcm_read_f ;
 1076|    230|		psf->read_double	= nms_adpcm_read_d ;
 1077|    230|		}
 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|    230|	if (psf->datalength % (pnms->shortsperblock * sizeof (short)))
  ------------------
  |  Branch (1085:6): [True: 216, False: 14]
  ------------------
 1086|    216|	{	psf_log_printf (psf, "*** Odd psf->datalength (%D) should be a multiple of %d\n",
 1087|    216|						psf->datalength, pnms->shortsperblock * sizeof (short)) ;
 1088|    216|		pnms->blocks_total = (psf->datalength / (pnms->shortsperblock * sizeof (short))) + 1 ;
 1089|    216|		}
 1090|     14|	else
 1091|     14|		pnms->blocks_total = psf->datalength / (pnms->shortsperblock * sizeof (short)) ;
 1092|       |
 1093|    230|	psf->sf.frames		= (sf_count_t) pnms->blocks_total * NMS_SAMPLES_PER_BLOCK ;
  ------------------
  |  |   43|    230|#define NMS_SAMPLES_PER_BLOCK 160
  ------------------
 1094|    230|	psf->codec_close	= nms_adpcm_close ;
 1095|    230|	psf->seek			= nms_adpcm_seek ;
 1096|       |
 1097|    230|	return 0 ;
 1098|    230|} /* nms_adpcm_init */
nms_adpcm.c:nms_adpcm_codec_init:
  303|    230|{	memset (s, 0, sizeof (struct nms_adpcm_state)) ;
  304|    230|	s->t_off = (type == NMS32) ? 16 : (type == NMS24) ? 8 : 0 ;
  ------------------
  |  Branch (304:13): [True: 26, False: 204]
  |  Branch (304:36): [True: 28, False: 176]
  ------------------
  305|    230|} /* nms_adpcm_codec_init */
nms_adpcm.c:nms_adpcm_read_block:
  719|   567k|{	int	count, indx = 0 ;
  720|       |
  721|  1.13M|	while (indx < len)
  ------------------
  |  Branch (721:9): [True: 567k, False: 567k]
  ------------------
  722|   567k|	{	if (pnms->sample_curr >= NMS_SAMPLES_PER_BLOCK)
  ------------------
  |  |   43|   567k|#define NMS_SAMPLES_PER_BLOCK 160
  ------------------
  |  Branch (722:8): [True: 3.32k, False: 564k]
  ------------------
  723|  3.32k|		{	pnms->block_curr ++ ;
  724|  3.32k|			pnms->sample_curr = 0 ;
  725|  3.32k|			} ;
  726|       |
  727|   567k|		if (pnms->block_curr > pnms->blocks_total)
  ------------------
  |  Branch (727:7): [True: 0, False: 567k]
  ------------------
  728|      0|		{	memset (&(ptr [indx]), 0, (len - indx) * sizeof (short)) ;
  729|      0|			return indx ;
  730|   567k|			} ;
  731|       |
  732|   567k|		if (pnms->sample_curr == 0)
  ------------------
  |  Branch (732:7): [True: 3.54k, False: 563k]
  ------------------
  733|  3.54k|			psf_nms_adpcm_decode_block (psf, pnms) ;
  734|       |
  735|   567k|		count = NMS_SAMPLES_PER_BLOCK - pnms->sample_curr ;
  ------------------
  |  |   43|   567k|#define NMS_SAMPLES_PER_BLOCK 160
  ------------------
  736|   567k|		if (len - indx < count)
  ------------------
  |  Branch (736:7): [True: 563k, False: 3.54k]
  ------------------
  737|   563k|			count = len - indx ;
  738|       |
  739|   567k|		memcpy (&(ptr [indx]), &(pnms->samples [pnms->sample_curr]), count * sizeof (short)) ;
  740|   567k|		indx += count ;
  741|   567k|		pnms->sample_curr += count ;
  742|   567k|		} ;
  743|       |
  744|   567k|	return indx ;
  745|   567k|} /* nms_adpcm_read_block */
nms_adpcm.c:psf_nms_adpcm_decode_block:
  702|  3.54k|{	int k ;
  703|       |
  704|  3.54k|	if ((k = (int) psf_fread (pnms->block, sizeof (short), pnms->shortsperblock, psf)) != pnms->shortsperblock)
  ------------------
  |  Branch (704:6): [True: 215, False: 3.33k]
  ------------------
  705|    215|	{	psf_log_printf (psf, "*** Warning : short read (%d != %d).\n", k, pnms->shortsperblock) ;
  706|    215|		memset (pnms->block + k, 0, (pnms->shortsperblock - k) * sizeof (short)) ;
  707|    215|		} ;
  708|       |
  709|  3.54k|	if (CPU_IS_BIG_ENDIAN)
  ------------------
  |  |   11|  3.54k|#define CPU_IS_BIG_ENDIAN 0
  |  |  ------------------
  |  |  |  Branch (11:27): [Folded, False: 3.54k]
  |  |  ------------------
  ------------------
  710|      0|		endswap_short_array ((signed short *) pnms->block, pnms->shortsperblock) ;
  711|       |
  712|  3.54k|	nms_adpcm_decode_block (psf, pnms, pnms->block, pnms->samples) ;
  713|       |
  714|  3.54k|	return 1 ;
  715|  3.54k|} /* nms_adpcm_decode_block */
nms_adpcm.c:nms_adpcm_decode_block:
  638|  3.54k|{	int k ;
  639|       |
  640|  3.54k|	switch (pnms->type)
  641|  3.54k|	{	case NMS16 :
  ------------------
  |  Branch (641:4): [True: 1.84k, False: 1.70k]
  ------------------
  642|  1.84k|			nms_adpcm_block_unpack_16 (block, samples, NULL) ;
  643|  1.84k|			break ;
  644|  1.03k|		case NMS24 :
  ------------------
  |  Branch (644:3): [True: 1.03k, False: 2.50k]
  ------------------
  645|  1.03k|			nms_adpcm_block_unpack_24 (block, samples, NULL) ;
  646|  1.03k|			break ;
  647|    663|		case NMS32 :
  ------------------
  |  Branch (647:3): [True: 663, False: 2.88k]
  ------------------
  648|    663|			nms_adpcm_block_unpack_32 (block, samples, NULL) ;
  649|    663|			break ;
  650|       |
  651|      0|		default :
  ------------------
  |  Branch (651:3): [True: 0, False: 3.54k]
  ------------------
  652|      0|			psf_log_printf (psf, "*** Error : Unhandled NMS ADPCM type %d.\n", pnms->type) ;
  653|      0|			return 0 ;
  654|  3.54k|		} ;
  655|       |
  656|   571k|	for (k = 0 ; k < NMS_SAMPLES_PER_BLOCK ; k++)
  ------------------
  |  |   43|   571k|#define NMS_SAMPLES_PER_BLOCK 160
  ------------------
  |  Branch (656:15): [True: 567k, False: 3.54k]
  ------------------
  657|   567k|		samples [k] = nms_adpcm_decode_sample (&pnms->state, samples [k]) ;
  658|       |
  659|  3.54k|	return NMS_SAMPLES_PER_BLOCK ;
  ------------------
  |  |   43|  3.54k|#define NMS_SAMPLES_PER_BLOCK 160
  ------------------
  660|  3.54k|} /* nms_adpcm_decode_block */
nms_adpcm.c:nms_adpcm_block_unpack_16:
  453|  1.84k|{	int k ;
  454|  1.84k|	uint16_t w = 0 ;
  455|       |
  456|  75.6k|	for (k = 0 ; k < NMS_SAMPLES_PER_BLOCK ; )
  ------------------
  |  |   43|  75.6k|#define NMS_SAMPLES_PER_BLOCK 160
  ------------------
  |  Branch (456:15): [True: 73.8k, False: 1.84k]
  ------------------
  457|  73.8k|	{	/*
  458|       |		** k % 8 == [0-3]: Top 2-bits of a nibble
  459|       |		** k % 8 == [4-7]: Bottom 2-bits of a nibble
  460|       |		*/
  461|  73.8k|		if ((k & 4) == 0)
  ------------------
  |  Branch (461:7): [True: 36.9k, False: 36.9k]
  ------------------
  462|  36.9k|			w = *(block++) ;
  463|  36.9k|		else
  464|  36.9k|			w <<= 2 ;
  465|  73.8k|		codewords [k++] = (w >> 12) & 0xc ;
  466|  73.8k|		codewords [k++] = (w >> 8) & 0xc ;
  467|  73.8k|		codewords [k++] = (w >> 4) & 0xc ;
  468|  73.8k|		codewords [k++] = w & 0xc ;
  469|  73.8k|		} ;
  470|       |
  471|       |	/*
  472|       |	** Every block ends with a short representing a RMS-approximation for the
  473|       |	** block.
  474|       |	**/
  475|  1.84k|	if (rms)
  ------------------
  |  Branch (475:6): [True: 0, False: 1.84k]
  ------------------
  476|      0|		*rms = *block ;
  477|  1.84k|} /* nms_adpcm_unpack_16 */
nms_adpcm.c:nms_adpcm_block_unpack_24:
  486|  1.03k|{	int k ;
  487|  1.03k|	uint16_t w = 0, residual = 0 ;
  488|       |
  489|  42.5k|	for (k = 0 ; k < NMS_SAMPLES_PER_BLOCK ; )
  ------------------
  |  |   43|  42.5k|#define NMS_SAMPLES_PER_BLOCK 160
  ------------------
  |  Branch (489:15): [True: 41.5k, False: 1.03k]
  ------------------
  490|  41.5k|	{		/*
  491|       |		** k % 16 == [0, 11]: Unpack new nibble, build residual
  492|       |		** k % 16 == [12, 15]: Unpack residual
  493|       |		*/
  494|  41.5k|		if ((k & 12) != 12)
  ------------------
  |  Branch (494:7): [True: 31.1k, False: 10.3k]
  ------------------
  495|  31.1k|		{	w = *(block++) ;
  496|  31.1k|			residual = (residual << 1) | (w & 0x1111) ;
  497|  31.1k|			}
  498|  10.3k|		else
  499|  10.3k|		{	w = residual << 1 ;
  500|  10.3k|			residual = 0 ;
  501|  10.3k|			} ;
  502|  41.5k|		codewords [k++] = (w >> 12) & 0xe ;
  503|  41.5k|		codewords [k++] = (w >> 8) & 0xe ;
  504|  41.5k|		codewords [k++] = (w >> 4) & 0xe ;
  505|  41.5k|		codewords [k++] = w & 0xe ;
  506|  41.5k|		} ;
  507|       |
  508|       |	/*
  509|       |	** Every block ends with a short representing a RMS-approximation for the
  510|       |	** block.
  511|       |	**/
  512|  1.03k|	if (rms)
  ------------------
  |  Branch (512:6): [True: 0, False: 1.03k]
  ------------------
  513|      0|		*rms = *block ;
  514|  1.03k|} /* nms_adpcm_unpack_24 */
nms_adpcm.c:nms_adpcm_block_unpack_32:
  523|    663|{	int k ;
  524|    663|	uint16_t w = 0 ;
  525|       |
  526|  27.1k|	for (k = 0 ; k < NMS_SAMPLES_PER_BLOCK ; )
  ------------------
  |  |   43|  27.1k|#define NMS_SAMPLES_PER_BLOCK 160
  ------------------
  |  Branch (526:15): [True: 26.5k, False: 663]
  ------------------
  527|  26.5k|	{	w = *(block++) ;
  528|  26.5k|		codewords [k++] = (w >> 12) & 0xf ;
  529|  26.5k|		codewords [k++] = (w >> 8) & 0xf ;
  530|  26.5k|		codewords [k++] = (w >> 4) & 0xf ;
  531|  26.5k|		codewords [k++] = w & 0xf ;
  532|  26.5k|		} ;
  533|       |	/*
  534|       |	** Every block ends with a short representing a RMS-approximation for the
  535|       |	** block.
  536|       |	**/
  537|    663|	if (rms)
  ------------------
  |  Branch (537:6): [True: 0, False: 663]
  ------------------
  538|      0|		*rms = *block ;
  539|    663|} /* nms_adpcm_unpack_32 */
nms_adpcm.c:nms_adpcm_decode_sample:
  409|   567k|{	int_fast32_t sl ;
  410|       |
  411|   567k|	nms_adpcm_update (s) ;
  412|   567k|	sl = nms_adpcm_reconstruct_sample (s, I) ;
  413|       |
  414|       |	/* Clamp to [-0x1fdf, 0x1fdf] (just under 14 bits resolution) */
  415|   567k|	if (sl < -0x1fdf)
  ------------------
  |  Branch (415:6): [True: 89.5k, False: 477k]
  ------------------
  416|  89.5k|		sl = -0x1fdf ;
  417|   477k|	else if (sl > 0x1fdf)
  ------------------
  |  Branch (417:11): [True: 100k, False: 377k]
  ------------------
  418|   100k|		sl = 0x1fdf ;
  419|       |
  420|       |	/* Expand from 14 to 16 bits */
  421|   567k|	sl = (sl * 0x7fff) / 0x1fdf ;
  422|       |
  423|   567k|	return (int16_t) sl ;
  424|   567k|} /* nms_adpcm_decode_sample */
nms_adpcm.c:nms_adpcm_update:
  196|   567k|{	/* Variable names from ITU G.726 spec */
  197|   567k|	short a1ul, fa1 ;
  198|   567k|	int_fast32_t se ;
  199|   567k|	int i ;
  200|       |
  201|       |	/* Decay and Modify the scale factor in the log domain based on the codeword. */
  202|   567k|	s->yl = ((s->yl *0xf8) >> 8) + table_scale_factor_step [s->t_off + (s->Ik & 7)] ;
  203|   567k|	if (s->yl < 2171)
  ------------------
  |  Branch (203:6): [True: 89.6k, False: 477k]
  ------------------
  204|  89.6k|		s->yl = 2171 ;
  205|   477k|	else if (s->yl > 20480)
  ------------------
  |  Branch (205:11): [True: 82.0k, False: 395k]
  ------------------
  206|  82.0k|		s->yl = 20480 ;
  207|   567k|	s->y = nms_adpcm_antilog (s->yl) ;
  208|       |
  209|       |	/* Update the zero predictor coefficients. */
  210|  3.97M|	for (i = 0 ; i < 6 ; i++)
  ------------------
  |  Branch (210:15): [True: 3.40M, False: 567k]
  ------------------
  211|  3.40M|	{	s->b [i] = (s->b [i] * 0xff) >> 8 ;
  212|  3.40M|		if ((s->d_q [0] ^ s->d_q [i + 1]) >= 0)
  ------------------
  |  Branch (212:7): [True: 2.62M, False: 777k]
  ------------------
  213|  2.62M|			s->b [i] += 128 ;
  214|   777k|		else
  215|   777k|			s->b [i] -= 128 ;
  216|  3.40M|		}
  217|       |
  218|       |	/* Update the pole predictor coefficients. */
  219|   567k|	fa1 = s->a [0] >> 5 ;
  220|   567k|	if (fa1 < -256)
  ------------------
  |  Branch (220:6): [True: 46.0k, False: 521k]
  ------------------
  221|  46.0k|		fa1 = -256 ;
  222|   521k|	else if (fa1 > 256)
  ------------------
  |  Branch (222:11): [True: 455k, False: 66.0k]
  ------------------
  223|   455k|		fa1 = 256 ;
  224|       |
  225|   567k|	s->a [0] = (s->a [0] * 0xff) >> 8 ;
  226|   567k|	if (s->p [0] != 0 && s->p [1] != 0 && ((s->p [0] ^ s->p [1]) < 0))
  ------------------
  |  Branch (226:6): [True: 476k, False: 90.8k]
  |  Branch (226:23): [True: 471k, False: 5.11k]
  |  Branch (226:40): [True: 99.9k, False: 371k]
  ------------------
  227|  99.9k|		s->a [0] -= 192 ;
  228|   467k|	else
  229|   467k|	{	s->a [0] += 192 ;
  230|   467k|		fa1 = -fa1 ;
  231|   467k|		}
  232|       |
  233|   567k|	s->a [1] = fa1 + ((s->a [1] * 0xfe) >> 8) ;
  234|   567k|	if (s->p [0] != 0 && s->p [2] != 0 && ((s->p [0] ^ s->p [2]) < 0))
  ------------------
  |  Branch (234:6): [True: 476k, False: 90.8k]
  |  Branch (234:23): [True: 469k, False: 6.77k]
  |  Branch (234:40): [True: 51.1k, False: 418k]
  ------------------
  235|  51.1k|		s->a [1] -= 128 ;
  236|   516k|	else
  237|   516k|		s->a [1] += 128 ;
  238|       |
  239|       |	/* Stability constraints. */
  240|   567k|	if (s->a [1] < -12288)
  ------------------
  |  Branch (240:6): [True: 301k, False: 266k]
  ------------------
  241|   301k|		s->a [1] = -12288 ;
  242|   266k|	else if (s->a [1] > 12288)
  ------------------
  |  Branch (242:11): [True: 4.18k, False: 262k]
  ------------------
  243|  4.18k|		s->a [1] = 12288 ;
  244|   567k|	a1ul = 15360 - s->a [1] ;
  245|   567k|	if (s->a [0] >= a1ul)
  ------------------
  |  Branch (245:6): [True: 322k, False: 245k]
  ------------------
  246|   322k|		s->a [0] = a1ul ;
  247|   245k|	else
  248|   245k|	{	a1ul = -a1ul ;
  249|   245k|		if (s->a [0] < a1ul)
  ------------------
  |  Branch (249:7): [True: 25.0k, False: 220k]
  ------------------
  250|  25.0k|			s->a [0] = a1ul ;
  251|   245k|		} ;
  252|       |
  253|       |	/* Compute the zero predictor estimate and rotate past deltas. */
  254|   567k|	se = 0 ;
  255|  3.97M|	for (i = 5 ; i >= 0 ; i--)
  ------------------
  |  Branch (255:15): [True: 3.40M, False: 567k]
  ------------------
  256|  3.40M|	{	se += (int_fast32_t) s->d_q [i] * s->b [i] ;
  257|  3.40M|		s->d_q [i + 1] = s->d_q [i] ;
  258|  3.40M|		} ;
  259|   567k|	s->s_ez = se >> 14 ;
  260|       |
  261|       |	/* Complete the signal estimate. */
  262|   567k|	se += (int_fast32_t) s->a [0] * s->s_r [0] ;
  263|   567k|	se += (int_fast32_t) s->a [1] * s->s_r [1] ;
  264|   567k|	s->s_e = se >> 14 ;
  265|       |
  266|       |	/* Rotate members to prepare for next iteration. */
  267|   567k|	s->s_r [1] = s->s_r [0] ;
  268|   567k|	s->p [2] = s->p [1] ;
  269|   567k|	s->p [1] = s->p [0] ;
  270|   567k|} /* nms_adpcm_update */
nms_adpcm.c:nms_adpcm_antilog:
  184|   567k|{	int_fast32_t r ;
  185|       |
  186|   567k|	r = 0x1000 ;
  187|   567k|	r += (((int_fast32_t) (exp & 0x3f) * 0x166b) >> 12) ;
  188|   567k|	r *= table_expn [(exp & 0x7c0) >> 6] ;
  189|   567k|	r >>= (26 - (exp >> 11)) ;
  190|       |
  191|   567k|	return (short) r ;
  192|   567k|} /* nms_adpcm_antilog */
nms_adpcm.c:nms_adpcm_reconstruct_sample:
  275|   567k|{	/* Variable names from ITU G.726 spec */
  276|   567k|	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|   567k|	dqx = table_step [s->t_off + (I & 7)] * s->y ;
  286|   567k|	if (I & 8)
  ------------------
  |  Branch (286:6): [True: 170k, False: 397k]
  ------------------
  287|   170k|		dqx = -dqx ;
  288|       |
  289|       |	/* Take from delta scale to actual scale. */
  290|   567k|	dqx >>= 12 ;
  291|       |
  292|       |	/* Set variables used as input for the next predictor update. */
  293|   567k|	s->d_q [0] = dqx ;
  294|   567k|	s->s_r [0] = s->s_e + dqx ;
  295|   567k|	s->Ik = I & 0xf ;
  296|   567k|	s->p [0] = s->s_ez + dqx ;
  297|       |
  298|   567k|	return s->s_r [0] ;
  299|   567k|} /* nms_adpcm_reconstruct_sample */
nms_adpcm.c:nms_adpcm_read_f:
  804|   567k|{	BUF_UNION	ubuf ;
  805|   567k|	NMS_ADPCM_PRIVATE *pnms ;
  806|   567k|	short		*sptr ;
  807|   567k|	int			k, bufferlen, readcount = 0, count ;
  808|   567k|	sf_count_t	total = 0 ;
  809|   567k|	float 		normfact ;
  810|       |
  811|   567k|	if (psf->codec_data == NULL)
  ------------------
  |  Branch (811:6): [True: 0, False: 567k]
  ------------------
  812|      0|		return 0 ;
  813|   567k|	pnms = (NMS_ADPCM_PRIVATE*) psf->codec_data ;
  814|       |
  815|   567k|	normfact = (psf->norm_float == SF_TRUE) ? 1.0 / ((float) 0x8000) : 1.0 ;
  ------------------
  |  Branch (815:13): [True: 567k, False: 0]
  ------------------
  816|       |
  817|   567k|	sptr = ubuf.sbuf ;
  818|   567k|	bufferlen = SF_BUFFER_LEN / sizeof (short) ;
  ------------------
  |  |   77|   567k|#define	SF_BUFFER_LEN			(8192)
  ------------------
  819|  1.13M|	while (len > 0)
  ------------------
  |  Branch (819:9): [True: 567k, False: 567k]
  ------------------
  820|   567k|	{	readcount = (len >= bufferlen) ? bufferlen : (int) len ;
  ------------------
  |  Branch (820:16): [True: 0, False: 567k]
  ------------------
  821|   567k|		count = nms_adpcm_read_block (psf, pnms, sptr, readcount) ;
  822|  1.13M|		for (k = 0 ; k < readcount ; k++)
  ------------------
  |  Branch (822:16): [True: 567k, False: 567k]
  ------------------
  823|   567k|			ptr [total + k] = normfact * sptr [k] ;
  824|       |
  825|   567k|		total += count ;
  826|   567k|		len -= readcount ;
  827|   567k|		if (count != readcount)
  ------------------
  |  Branch (827:7): [True: 0, False: 567k]
  ------------------
  828|      0|			break ;
  829|   567k|		} ;
  830|       |
  831|   567k|	return total ;
  832|   567k|} /* nms_adpcm_read_f */
nms_adpcm.c:nms_adpcm_close:
 1102|    230|{	NMS_ADPCM_PRIVATE *pnms ;
 1103|       |
 1104|    230|	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|    230|	if (psf->file.mode == SFM_WRITE)
  ------------------
  |  Branch (1110:6): [True: 0, False: 230]
  ------------------
 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|    230|	return 0 ;
 1121|    230|} /* 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|    131|{	int		subformat, error, endian ;
  104|       |
  105|    131| 	psf->dataoffset = PAF_HEADER_LENGTH ;
  ------------------
  |  |   43|    131|#define	PAF_HEADER_LENGTH 			2048
  ------------------
  106|       |
  107|    131|	if (psf->file.mode == SFM_READ || (psf->file.mode == SFM_RDWR && psf->filelength > 0))
  ------------------
  |  Branch (107:6): [True: 131, False: 0]
  |  Branch (107:37): [True: 0, False: 0]
  |  Branch (107:67): [True: 0, False: 0]
  ------------------
  108|    131|	{	if ((error = paf_read_header (psf)))
  ------------------
  |  Branch (108:8): [True: 55, False: 76]
  ------------------
  109|     55|			return error ;
  110|    131|		} ;
  111|       |
  112|     76|	subformat = SF_CODEC (psf->sf.format) ;
  ------------------
  |  |  109|     76|#define SF_CODEC(x)			((x) & SF_FORMAT_SUBMASK)
  ------------------
  113|       |
  114|     76|	if (psf->file.mode == SFM_WRITE || psf->file.mode == SFM_RDWR)
  ------------------
  |  Branch (114:6): [True: 0, False: 76]
  |  Branch (114:37): [True: 0, False: 76]
  ------------------
  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|     76|		} ;
  131|       |
  132|     76|	switch (subformat)
  133|     76|	{	case SF_FORMAT_PCM_S8 :
  ------------------
  |  Branch (133:4): [True: 1, False: 75]
  ------------------
  134|      1|					psf->bytewidth = 1 ;
  135|      1|					error = pcm_init (psf) ;
  136|      1|					break ;
  137|       |
  138|      5|		case SF_FORMAT_PCM_16 :
  ------------------
  |  Branch (138:3): [True: 5, False: 71]
  ------------------
  139|      5|					psf->bytewidth = 2 ;
  140|      5|					error = pcm_init (psf) ;
  141|      5|					break ;
  142|       |
  143|     70|		case SF_FORMAT_PCM_24 :
  ------------------
  |  Branch (143:3): [True: 70, False: 6]
  ------------------
  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: 76]
  ------------------
  149|     76|		} ;
  150|       |
  151|     76|	return error ;
  152|     76|} /* paf_open */
paf.c:paf_read_header:
  159|    131|{	PAF_FMT		paf_fmt ;
  160|    131|	int			marker ;
  161|       |
  162|    131|	if (psf->filelength < PAF_HEADER_LENGTH)
  ------------------
  |  |   43|    131|#define	PAF_HEADER_LENGTH 			2048
  ------------------
  |  Branch (162:6): [True: 2, False: 129]
  ------------------
  163|      2|		return SFE_PAF_SHORT_HEADER ;
  164|       |
  165|    129|	memset (&paf_fmt, 0, sizeof (paf_fmt)) ;
  166|    129|	psf_binheader_readf (psf, "pm", 0, &marker) ;
  167|       |
  168|    129|	psf_log_printf (psf, "Signature   : '%M'\n", marker) ;
  169|       |
  170|    129|	if (marker == PAF_MARKER)
  ------------------
  |  |   37|    129|#define PAF_MARKER	(MAKE_MARKER (' ', 'p', 'a', 'f'))
  |  |  ------------------
  |  |  |  |  122|    129|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (170:6): [True: 116, False: 13]
  ------------------
  171|    116|	{	psf_binheader_readf (psf, "E444444", &(paf_fmt.version), &(paf_fmt.endianness),
  172|    116|			&(paf_fmt.samplerate), &(paf_fmt.format), &(paf_fmt.channels), &(paf_fmt.source)) ;
  173|    116|		}
  174|     13|	else if (marker == FAP_MARKER)
  ------------------
  |  |   36|     13|#define FAP_MARKER	(MAKE_MARKER ('f', 'a', 'p', ' '))
  |  |  ------------------
  |  |  |  |  122|     13|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (174:11): [True: 13, False: 0]
  ------------------
  175|     13|	{	psf_binheader_readf (psf, "e444444", &(paf_fmt.version), &(paf_fmt.endianness),
  176|     13|			&(paf_fmt.samplerate), &(paf_fmt.format), &(paf_fmt.channels), &(paf_fmt.source)) ;
  177|     13|		}
  178|      0|	else
  179|      0|		return SFE_PAF_NO_MARKER ;
  180|       |
  181|    129|	psf_log_printf (psf, "Version     : %d\n", paf_fmt.version) ;
  182|       |
  183|    129|	if (paf_fmt.version != 0)
  ------------------
  |  Branch (183:6): [True: 8, False: 121]
  ------------------
  184|      8|	{	psf_log_printf (psf, "*** Bad version number. should be zero.\n") ;
  185|      8|		return SFE_PAF_VERSION ;
  186|    121|		} ;
  187|       |
  188|    121|	psf_log_printf (psf, "Sample Rate : %d\n", paf_fmt.samplerate) ;
  189|    121|	psf_log_printf (psf, "Channels    : %d\n", paf_fmt.channels) ;
  190|       |
  191|    121|	psf_log_printf (psf, "Endianness  : %d => ", paf_fmt.endianness) ;
  192|    121|	if (paf_fmt.endianness)
  ------------------
  |  Branch (192:6): [True: 79, False: 42]
  ------------------
  193|     79|	{	psf_log_printf (psf, "Little\n", paf_fmt.endianness) ;
  194|     79|		psf->endian = SF_ENDIAN_LITTLE ;
  195|     79|		}
  196|     42|	else
  197|     42|	{	psf_log_printf (psf, "Big\n", paf_fmt.endianness) ;
  198|     42|		psf->endian = SF_ENDIAN_BIG ;
  199|     42|		} ;
  200|       |
  201|    121|	if (paf_fmt.channels < 1 || paf_fmt.channels > SF_MAX_CHANNELS)
  ------------------
  |  |  102|     98|#define		SF_MAX_CHANNELS		1024
  ------------------
  |  Branch (201:6): [True: 23, False: 98]
  |  Branch (201:30): [True: 17, False: 81]
  ------------------
  202|     40|		return SFE_PAF_BAD_CHANNELS ;
  203|       |
  204|     81|	psf->datalength = psf->filelength - psf->dataoffset ;
  205|       |
  206|     81|	psf_binheader_readf (psf, "p", (int) psf->dataoffset) ;
  207|       |
  208|     81|	psf->sf.samplerate	= paf_fmt.samplerate ;
  209|     81|	psf->sf.channels 	= paf_fmt.channels ;
  210|       |
  211|       |	/* Only fill in type major. */
  212|     81|	psf->sf.format = SF_FORMAT_PAF ;
  213|       |
  214|     81|	psf_log_printf (psf, "Format      : %d => ", paf_fmt.format) ;
  215|       |
  216|       |	/* PAF is by default big endian. */
  217|     81|	psf->sf.format |= paf_fmt.endianness ? SF_ENDIAN_LITTLE : SF_ENDIAN_BIG ;
  ------------------
  |  Branch (217:20): [True: 44, False: 37]
  ------------------
  218|       |
  219|     81|	switch (paf_fmt.format)
  220|     81|	{	case PAF_PCM_S8 :
  ------------------
  |  Branch (220:4): [True: 1, False: 80]
  ------------------
  221|      1|					psf_log_printf (psf, "8 bit linear PCM\n") ;
  222|      1|					psf->bytewidth = 1 ;
  223|       |
  224|      1|					psf->sf.format |= SF_FORMAT_PCM_S8 ;
  225|       |
  226|      1|					psf->blockwidth = (sf_count_t) psf->bytewidth * psf->sf.channels ;
  227|      1|					psf->sf.frames = psf->datalength / psf->blockwidth ;
  228|      1|					break ;
  229|       |
  230|      5|		case PAF_PCM_16 :
  ------------------
  |  Branch (230:3): [True: 5, False: 76]
  ------------------
  231|      5|					psf_log_printf (psf, "16 bit linear PCM\n") ;
  232|      5|					psf->bytewidth = 2 ;
  233|       |
  234|      5|					psf->sf.format |= SF_FORMAT_PCM_16 ;
  235|       |
  236|      5|					psf->blockwidth = (sf_count_t) psf->bytewidth * psf->sf.channels ;
  237|      5|					psf->sf.frames = psf->datalength / psf->blockwidth ;
  238|      5|					break ;
  239|       |
  240|     70|		case PAF_PCM_24 :
  ------------------
  |  Branch (240:3): [True: 70, False: 11]
  ------------------
  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: 76]
  ------------------
  252|      5|					return SFE_PAF_UNKNOWN_FORMAT ;
  253|      0|					break ;
  254|     81|		} ;
  255|       |
  256|     76|	psf_log_printf (psf, "Source      : %d => ", paf_fmt.source) ;
  257|       |
  258|     76|	switch (paf_fmt.source)
  259|     76|	{	case 1 : psf_log_printf (psf, "Analog Recording\n") ;
  ------------------
  |  Branch (259:4): [True: 9, False: 67]
  ------------------
  260|      9|					break ;
  261|      1|		case 2 : psf_log_printf (psf, "Digital Transfer\n") ;
  ------------------
  |  Branch (261:3): [True: 1, False: 75]
  ------------------
  262|      1|					break ;
  263|      3|		case 3 : psf_log_printf (psf, "Multi-track Mixdown\n") ;
  ------------------
  |  Branch (263:3): [True: 3, False: 73]
  ------------------
  264|      3|					break ;
  265|      4|		case 5 : psf_log_printf (psf, "Audio Resulting From DSP Processing\n") ;
  ------------------
  |  Branch (265:3): [True: 4, False: 72]
  ------------------
  266|      4|					break ;
  267|     59|		default : psf_log_printf (psf, "Unknown\n") ;
  ------------------
  |  Branch (267:3): [True: 59, False: 17]
  ------------------
  268|     59|					break ;
  269|     76|		} ;
  270|       |
  271|     76|	return 0 ;
  272|     76|} /* 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|  59.7k|{	int				k, channel ;
  485|  59.7k|	unsigned char	*cptr ;
  486|       |
  487|  59.7k|	ppaf24->read_block ++ ;
  488|  59.7k|	ppaf24->read_count = 0 ;
  489|       |
  490|  59.7k|	if (ppaf24->read_block * PAF24_SAMPLES_PER_BLOCK > ppaf24->sample_count)
  ------------------
  |  |   45|  59.7k|#define	PAF24_SAMPLES_PER_BLOCK		10
  ------------------
  |  Branch (490:6): [True: 70, False: 59.7k]
  ------------------
  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|  59.7k|		} ;
  494|       |
  495|       |	/* Read the block. */
  496|  59.7k|	if ((k = (int) psf_fread (ppaf24->block, 1, ppaf24->blocksize, psf)) != ppaf24->blocksize)
  ------------------
  |  Branch (496:6): [True: 57, False: 59.6k]
  ------------------
  497|     57|		psf_log_printf (psf, "*** Warning : short read (%d != %d).\n", k, ppaf24->blocksize) ;
  498|       |
  499|       |	/* Do endian swapping if necessary. */
  500|  59.7k|	if ((CPU_IS_BIG_ENDIAN && psf->endian == SF_ENDIAN_LITTLE) || (CPU_IS_LITTLE_ENDIAN && psf->endian == SF_ENDIAN_BIG))
  ------------------
  |  |   11|   119k|#define CPU_IS_BIG_ENDIAN 0
  |  |  ------------------
  |  |  |  Branch (11:27): [Folded, False: 59.7k]
  |  |  ------------------
  ------------------
              	if ((CPU_IS_BIG_ENDIAN && psf->endian == SF_ENDIAN_LITTLE) || (CPU_IS_LITTLE_ENDIAN && psf->endian == SF_ENDIAN_BIG))
  ------------------
  |  |   14|   119k|#define CPU_IS_LITTLE_ENDIAN 1
  |  |  ------------------
  |  |  |  Branch (14:30): [True: 59.7k, Folded]
  |  |  ------------------
  ------------------
  |  Branch (500:28): [True: 0, False: 0]
  |  Branch (500:89): [True: 2.51k, False: 57.1k]
  ------------------
  501|  2.51k|		endswap_int_array (ppaf24->block, 8 * ppaf24->channels) ;
  502|       |
  503|       |	/* Unpack block. */
  504|   708k|	for (k = 0 ; k < PAF24_SAMPLES_PER_BLOCK * ppaf24->channels ; k++)
  ------------------
  |  |   45|   708k|#define	PAF24_SAMPLES_PER_BLOCK		10
  ------------------
  |  Branch (504:15): [True: 649k, False: 59.7k]
  ------------------
  505|   649k|	{	channel = k % ppaf24->channels ;
  506|   649k|		cptr = ((unsigned char *) ppaf24->block) + PAF24_BLOCK_SIZE * channel + 3 * (k / ppaf24->channels) ;
  ------------------
  |  |   46|   649k|#define	PAF24_BLOCK_SIZE			32
  ------------------
  507|   649k|		ppaf24->samples [k] = (cptr [0] << 8) | (cptr [1] << 16) | (((unsigned) cptr [2]) << 24) ;
  508|   649k|		} ;
  509|       |
  510|  59.7k|	return 1 ;
  511|  59.7k|} /* paf24_read_block */
paf.c:paf24_read:
  515|   596k|{	int	count, total = 0 ;
  516|       |
  517|  1.19M|	while (total < len)
  ------------------
  |  Branch (517:9): [True: 596k, False: 596k]
  ------------------
  518|   596k|	{	if (ppaf24->read_block * PAF24_SAMPLES_PER_BLOCK >= ppaf24->sample_count)
  ------------------
  |  |   45|   596k|#define	PAF24_SAMPLES_PER_BLOCK		10
  ------------------
  |  Branch (518:8): [True: 62, False: 596k]
  ------------------
  519|     62|		{	memset (&(ptr [total]), 0, (len - total) * sizeof (int)) ;
  520|     62|			return total ;
  521|   596k|			} ;
  522|       |
  523|   596k|		if (ppaf24->read_count >= PAF24_SAMPLES_PER_BLOCK)
  ------------------
  |  |   45|   596k|#define	PAF24_SAMPLES_PER_BLOCK		10
  ------------------
  |  Branch (523:7): [True: 59.6k, False: 536k]
  ------------------
  524|  59.6k|			paf24_read_block (psf, ppaf24) ;
  525|       |
  526|   596k|		count = (PAF24_SAMPLES_PER_BLOCK - ppaf24->read_count) * ppaf24->channels ;
  ------------------
  |  |   45|   596k|#define	PAF24_SAMPLES_PER_BLOCK		10
  ------------------
  527|   596k|		count = (len - total > count) ? count : len - total ;
  ------------------
  |  Branch (527:11): [True: 0, False: 596k]
  ------------------
  528|       |
  529|   596k|		memcpy (&(ptr [total]), &(ppaf24->samples [ppaf24->read_count * ppaf24->channels]), count * sizeof (int)) ;
  530|   596k|		total += count ;
  531|   596k|		ppaf24->read_count += count / ppaf24->channels ;
  532|   596k|		} ;
  533|       |
  534|   596k|	return total ;
  535|   596k|} /* paf24_read */
paf.c:paf24_read_f:
  578|   596k|{	BUF_UNION		ubuf ;
  579|   596k|	PAF24_PRIVATE 	*ppaf24 ;
  580|   596k|	int				*iptr ;
  581|   596k|	int				k, bufferlen, readcount, count ;
  582|   596k|	sf_count_t		total = 0 ;
  583|   596k|	float			normfact ;
  584|       |
  585|   596k|	if (psf->codec_data == NULL)
  ------------------
  |  Branch (585:6): [True: 0, False: 596k]
  ------------------
  586|      0|		return 0 ;
  587|   596k|	ppaf24 = (PAF24_PRIVATE*) psf->codec_data ;
  588|       |
  589|   596k|	normfact = (psf->norm_float == SF_TRUE) ? (1.0 / 0x80000000) : (1.0 / 0x100) ;
  ------------------
  |  Branch (589:13): [True: 596k, False: 0]
  ------------------
  590|       |
  591|   596k|	iptr = ubuf.ibuf ;
  592|   596k|	bufferlen = ARRAY_LEN (ubuf.ibuf) ;
  ------------------
  |  |   93|   596k|#define		ARRAY_LEN(x)	((int) (sizeof (x) / sizeof ((x) [0])))
  ------------------
  593|  1.19M|	while (len > 0)
  ------------------
  |  Branch (593:9): [True: 596k, False: 596k]
  ------------------
  594|   596k|	{	readcount = (len >= bufferlen) ? bufferlen : (int) len ;
  ------------------
  |  Branch (594:16): [True: 0, False: 596k]
  ------------------
  595|   596k|		count = paf24_read (psf, ppaf24, iptr, readcount) ;
  596|  1.20M|		for (k = 0 ; k < readcount ; k++)
  ------------------
  |  Branch (596:16): [True: 610k, False: 596k]
  ------------------
  597|   610k|			ptr [total + k] = normfact * iptr [k] ;
  598|   596k|		total += count ;
  599|   596k|		len -= readcount ;
  600|   596k|		} ;
  601|   596k|	return total ;
  602|   596k|} /* paf24_read_f */
paf.c:paf24_seek:
  413|     62|{	PAF24_PRIVATE	*ppaf24 ;
  414|     62|	int				newblock, newsample ;
  415|       |
  416|     62|	if (psf->codec_data == NULL)
  ------------------
  |  Branch (416:6): [True: 0, False: 62]
  ------------------
  417|      0|	{	psf->error = SFE_INTERNAL ;
  418|      0|		return PSF_SEEK_ERROR ;
  ------------------
  |  |   83|      0|#define	PSF_SEEK_ERROR			((sf_count_t) -1)
  ------------------
  419|     62|		} ;
  420|       |
  421|     62|	ppaf24 = (PAF24_PRIVATE*) psf->codec_data ;
  422|       |
  423|     62|	if (mode == SFM_READ && ppaf24->write_count > 0)
  ------------------
  |  Branch (423:6): [True: 62, False: 0]
  |  Branch (423:26): [True: 0, False: 62]
  ------------------
  424|      0|		paf24_write_block (psf, ppaf24) ;
  425|       |
  426|     62|	newblock	= offset / PAF24_SAMPLES_PER_BLOCK ;
  ------------------
  |  |   45|     62|#define	PAF24_SAMPLES_PER_BLOCK		10
  ------------------
  427|     62|	newsample	= offset % PAF24_SAMPLES_PER_BLOCK ;
  ------------------
  |  |   45|     62|#define	PAF24_SAMPLES_PER_BLOCK		10
  ------------------
  428|       |
  429|     62|	switch (mode)
  430|     62|	{	case SFM_READ :
  ------------------
  |  Branch (430:4): [True: 62, False: 0]
  ------------------
  431|     62|				if (psf->last_op == SFM_WRITE && ppaf24->write_count)
  ------------------
  |  Branch (431:9): [True: 0, False: 62]
  |  Branch (431:38): [True: 0, False: 0]
  ------------------
  432|      0|					paf24_write_block (psf, ppaf24) ;
  433|       |
  434|     62|				psf_fseek (psf, psf->dataoffset + newblock * ppaf24->blocksize, SEEK_SET) ;
  435|     62|				ppaf24->read_block = newblock ;
  436|     62|				paf24_read_block (psf, ppaf24) ;
  437|     62|				ppaf24->read_count = newsample ;
  438|     62|				break ;
  439|       |
  440|      0|		case SFM_WRITE :
  ------------------
  |  Branch (440:3): [True: 0, False: 62]
  ------------------
  441|      0|				if (offset > ppaf24->sample_count)
  ------------------
  |  Branch (441:9): [True: 0, False: 0]
  ------------------
  442|      0|				{	psf->error = SFE_BAD_SEEK ;
  443|      0|					return PSF_SEEK_ERROR ;
  ------------------
  |  |   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: 62]
  ------------------
  456|      0|				psf->error = SFE_BAD_SEEK ;
  457|      0|				return PSF_SEEK_ERROR ;
  ------------------
  |  |   83|      0|#define	PSF_SEEK_ERROR			((sf_count_t) -1)
  ------------------
  458|     62|		} ;
  459|       |
  460|     62|	return newblock * PAF24_SAMPLES_PER_BLOCK + newsample ;
  ------------------
  |  |   45|     62|#define	PAF24_SAMPLES_PER_BLOCK		10
  ------------------
  461|     62|} /* paf24_seek */
paf.c:paf24_close:
  465|     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|    796|{	int chars = 0 ;
  124|       |
  125|    796|	if (psf->bytewidth == 0 || psf->sf.channels == 0)
  ------------------
  |  Branch (125:6): [True: 4, False: 792]
  |  Branch (125:29): [True: 25, False: 767]
  ------------------
  126|     29|	{	psf_log_printf (psf, "pcm_init : internal error : bytewitdh = %d, channels = %d\n", psf->bytewidth, psf->sf.channels) ;
  127|     29|		return SFE_INTERNAL ;
  128|    767|		} ;
  129|       |
  130|    767|	psf->blockwidth = (sf_count_t) psf->bytewidth * psf->sf.channels ;
  131|       |
  132|    767|	if ((SF_CODEC (psf->sf.format)) == SF_FORMAT_PCM_S8)
  ------------------
  |  |  109|    767|#define SF_CODEC(x)			((x) & SF_FORMAT_SUBMASK)
  ------------------
  |  Branch (132:6): [True: 147, False: 620]
  ------------------
  133|    147|		chars = SF_CHARS_SIGNED ;
  134|    620|	else if ((SF_CODEC (psf->sf.format)) == SF_FORMAT_PCM_U8)
  ------------------
  |  |  109|    620|#define SF_CODEC(x)			((x) & SF_FORMAT_SUBMASK)
  ------------------
  |  Branch (134:11): [True: 110, False: 510]
  ------------------
  135|    110|		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|    767|	psf->data_endswap = (psf->endian == SF_ENDIAN_LITTLE) ? SF_FALSE : SF_TRUE ;
  ------------------
  |  Branch (140:22): [True: 408, False: 359]
  ------------------
  141|    767|#endif
  142|       |
  143|    767|	if (psf->file.mode == SFM_READ || psf->file.mode == SFM_RDWR)
  ------------------
  |  Branch (143:6): [True: 767, False: 0]
  |  Branch (143:36): [True: 0, False: 0]
  ------------------
  144|    767|	{	switch (psf->bytewidth * 0x10000 + psf->endian + chars)
  145|    767|		{	case (0x10000 + SF_ENDIAN_BIG + SF_CHARS_SIGNED) :
  ------------------
  |  Branch (145:5): [True: 118, False: 649]
  ------------------
  146|    147|			case (0x10000 + SF_ENDIAN_LITTLE + SF_CHARS_SIGNED) :
  ------------------
  |  Branch (146:4): [True: 29, False: 738]
  ------------------
  147|    147|					psf->read_short		= pcm_read_sc2s ;
  148|    147|					psf->read_int		= pcm_read_sc2i ;
  149|    147|					psf->read_float		= pcm_read_sc2f ;
  150|    147|					psf->read_double	= pcm_read_sc2d ;
  151|    147|					break ;
  152|     13|			case (0x10000 + SF_ENDIAN_BIG + SF_CHARS_UNSIGNED) :
  ------------------
  |  Branch (152:4): [True: 13, False: 754]
  ------------------
  153|     79|			case (0x10000 + SF_ENDIAN_LITTLE + SF_CHARS_UNSIGNED) :
  ------------------
  |  Branch (153:4): [True: 66, False: 701]
  ------------------
  154|     79|					psf->read_short		= pcm_read_uc2s ;
  155|     79|					psf->read_int		= pcm_read_uc2i ;
  156|     79|					psf->read_float		= pcm_read_uc2f ;
  157|     79|					psf->read_double	= pcm_read_uc2d ;
  158|     79|					break ;
  159|       |
  160|    121|			case (2 * 0x10000 + SF_ENDIAN_BIG) :
  ------------------
  |  Branch (160:4): [True: 121, False: 646]
  ------------------
  161|    121|					psf->read_short		= pcm_read_bes2s ;
  162|    121|					psf->read_int		= pcm_read_bes2i ;
  163|    121|					psf->read_float		= pcm_read_bes2f ;
  164|    121|					psf->read_double	= pcm_read_bes2d ;
  165|    121|					break ;
  166|     33|			case (3 * 0x10000 + SF_ENDIAN_BIG) :
  ------------------
  |  Branch (166:4): [True: 33, False: 734]
  ------------------
  167|     33|					psf->read_short		= pcm_read_bet2s ;
  168|     33|					psf->read_int		= pcm_read_bet2i ;
  169|     33|					psf->read_float		= pcm_read_bet2f ;
  170|     33|					psf->read_double	= pcm_read_bet2d ;
  171|     33|					break ;
  172|     43|			case (4 * 0x10000 + SF_ENDIAN_BIG) :
  ------------------
  |  Branch (172:4): [True: 43, False: 724]
  ------------------
  173|       |
  174|     43|					psf->read_short		= pcm_read_bei2s ;
  175|     43|					psf->read_int		= pcm_read_bei2i ;
  176|     43|					psf->read_float		= pcm_read_bei2f ;
  177|     43|					psf->read_double	= pcm_read_bei2d ;
  178|     43|					break ;
  179|       |
  180|    120|			case (2 * 0x10000 + SF_ENDIAN_LITTLE) :
  ------------------
  |  Branch (180:4): [True: 120, False: 647]
  ------------------
  181|    120|					psf->read_short		= pcm_read_les2s ;
  182|    120|					psf->read_int		= pcm_read_les2i ;
  183|    120|					psf->read_float		= pcm_read_les2f ;
  184|    120|					psf->read_double	= pcm_read_les2d ;
  185|    120|					break ;
  186|    108|			case (3 * 0x10000 + SF_ENDIAN_LITTLE) :
  ------------------
  |  Branch (186:4): [True: 108, False: 659]
  ------------------
  187|    108|					psf->read_short		= pcm_read_let2s ;
  188|    108|					psf->read_int		= pcm_read_let2i ;
  189|    108|					psf->read_float		= pcm_read_let2f ;
  190|    108|					psf->read_double	= pcm_read_let2d ;
  191|    108|					break ;
  192|     85|			case (4 * 0x10000 + SF_ENDIAN_LITTLE) :
  ------------------
  |  Branch (192:4): [True: 85, False: 682]
  ------------------
  193|     85|					psf->read_short		= pcm_read_lei2s ;
  194|     85|					psf->read_int		= pcm_read_lei2i ;
  195|     85|					psf->read_float		= pcm_read_lei2f ;
  196|     85|					psf->read_double	= pcm_read_lei2d ;
  197|     85|					break ;
  198|     31|			default :
  ------------------
  |  Branch (198:4): [True: 31, False: 736]
  ------------------
  199|     31|				psf_log_printf (psf, "pcm.c returning SFE_UNIMPLEMENTED\nbytewidth %d    endian %d\n", psf->bytewidth, psf->endian) ;
  200|     31|				return SFE_UNIMPLEMENTED ;
  201|    767|			} ;
  202|    736|		} ;
  203|       |
  204|    736|	if (psf->file.mode == SFM_WRITE || psf->file.mode == SFM_RDWR)
  ------------------
  |  Branch (204:6): [True: 0, False: 736]
  |  Branch (204:37): [True: 0, False: 736]
  ------------------
  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|    736|		} ;
  269|       |
  270|    736|	if (psf->filelength > psf->dataoffset)
  ------------------
  |  Branch (270:6): [True: 463, False: 273]
  ------------------
  271|    463|	{	psf->datalength = (psf->dataend > 0) ? psf->dataend - psf->dataoffset :
  ------------------
  |  Branch (271:22): [True: 27, False: 436]
  ------------------
  272|    463|							psf->filelength - psf->dataoffset ;
  273|    463|		}
  274|    273|	else
  275|    273|		psf->datalength = 0 ;
  276|       |
  277|    736|	psf->sf.frames = psf->blockwidth > 0 ? psf->datalength / psf->blockwidth : 0 ;
  ------------------
  |  Branch (277:19): [True: 598, False: 138]
  ------------------
  278|       |
  279|    736|	return 0 ;
  280|    736|} /* pcm_init */
pcm.c:pcm_read_sc2f:
  981|    301|{	BUF_UNION	ubuf ;
  982|    301|	int			bufferlen, readcount ;
  983|    301|	sf_count_t	total = 0 ;
  984|    301|	float	normfact ;
  985|       |
  986|    301|	normfact = (psf->norm_float == SF_TRUE) ? 1.0 / ((float) 0x80) : 1.0 ;
  ------------------
  |  Branch (986:13): [True: 301, False: 0]
  ------------------
  987|       |
  988|    301|	bufferlen = ARRAY_LEN (ubuf.scbuf) ;
  ------------------
  |  |   93|    301|#define		ARRAY_LEN(x)	((int) (sizeof (x) / sizeof ((x) [0])))
  ------------------
  989|       |
  990|    584|	while (len > 0)
  ------------------
  |  Branch (990:9): [True: 301, False: 283]
  ------------------
  991|    301|	{	if (len < bufferlen)
  ------------------
  |  Branch (991:8): [True: 301, False: 0]
  ------------------
  992|    301|			bufferlen = (int) len ;
  993|    301|		readcount = (int) psf_fread (ubuf.scbuf, sizeof (signed char), bufferlen, psf) ;
  994|    301|		sc2f_array (ubuf.scbuf, readcount, ptr + total, normfact) ;
  995|    301|		total += readcount ;
  996|    301|		if (readcount < bufferlen)
  ------------------
  |  Branch (996:7): [True: 18, False: 283]
  ------------------
  997|     18|			break ;
  998|    283|		len -= readcount ;
  999|    283|		} ;
 1000|       |
 1001|    301|	return total ;
 1002|    301|} /* pcm_read_sc2f */
pcm.c:sc2f_array:
  385|  1.98k|{	for (int i = 0 ; i < count ; i++)
  ------------------
  |  Branch (385:20): [True: 1.68k, False: 301]
  ------------------
  386|  1.68k|		dest [i] = ((float) src [i]) * normfact ;
  387|    301|} /* sc2f_array */
pcm.c:pcm_read_uc2f:
 1006|  2.63k|{	BUF_UNION	ubuf ;
 1007|  2.63k|	int			bufferlen, readcount ;
 1008|  2.63k|	sf_count_t	total = 0 ;
 1009|  2.63k|	float	normfact ;
 1010|       |
 1011|  2.63k|	normfact = (psf->norm_float == SF_TRUE) ? 1.0 / ((float) 0x80) : 1.0 ;
  ------------------
  |  Branch (1011:13): [True: 2.63k, False: 0]
  ------------------
 1012|       |
 1013|  2.63k|	bufferlen = ARRAY_LEN (ubuf.ucbuf) ;
  ------------------
  |  |   93|  2.63k|#define		ARRAY_LEN(x)	((int) (sizeof (x) / sizeof ((x) [0])))
  ------------------
 1014|       |
 1015|  5.26k|	while (len > 0)
  ------------------
  |  Branch (1015:9): [True: 2.63k, False: 2.63k]
  ------------------
 1016|  2.63k|	{	if (len < bufferlen)
  ------------------
  |  Branch (1016:8): [True: 2.63k, False: 0]
  ------------------
 1017|  2.63k|			bufferlen = (int) len ;
 1018|  2.63k|		readcount = (int) psf_fread (ubuf.ucbuf, sizeof (unsigned char), bufferlen, psf) ;
 1019|  2.63k|		uc2f_array (ubuf.ucbuf, readcount, ptr + total, normfact) ;
 1020|  2.63k|		total += readcount ;
 1021|  2.63k|		if (readcount < bufferlen)
  ------------------
  |  Branch (1021:7): [True: 0, False: 2.63k]
  ------------------
 1022|      0|			break ;
 1023|  2.63k|		len -= readcount ;
 1024|  2.63k|		} ;
 1025|       |
 1026|  2.63k|	return total ;
 1027|  2.63k|} /* pcm_read_uc2f */
pcm.c:uc2f_array:
  391|  1.05M|{	for (int i = 0 ; i < count ; i++)
  ------------------
  |  Branch (391:20): [True: 1.05M, False: 2.63k]
  ------------------
  392|  1.05M|		dest [i] = (((int) src [i]) - 128) * normfact ;
  393|  2.63k|} /* uc2f_array */
pcm.c:pcm_read_bes2f:
 1031|  8.99k|{	BUF_UNION	ubuf ;
 1032|  8.99k|	int			bufferlen, readcount ;
 1033|  8.99k|	sf_count_t	total = 0 ;
 1034|  8.99k|	float	normfact ;
 1035|       |
 1036|  8.99k|	normfact = (psf->norm_float == SF_TRUE) ? 1.0 / ((float) 0x8000) : 1.0 ;
  ------------------
  |  Branch (1036:13): [True: 8.99k, False: 0]
  ------------------
 1037|       |
 1038|  8.99k|	bufferlen = ARRAY_LEN (ubuf.sbuf) ;
  ------------------
  |  |   93|  8.99k|#define		ARRAY_LEN(x)	((int) (sizeof (x) / sizeof ((x) [0])))
  ------------------
 1039|       |
 1040|  17.9k|	while (len > 0)
  ------------------
  |  Branch (1040:9): [True: 8.99k, False: 8.98k]
  ------------------
 1041|  8.99k|	{	if (len < bufferlen)
  ------------------
  |  Branch (1041:8): [True: 8.99k, False: 0]
  ------------------
 1042|  8.99k|			bufferlen = (int) len ;
 1043|  8.99k|		readcount = (int) psf_fread (ubuf.sbuf, sizeof (short), bufferlen, psf) ;
 1044|  8.99k|		bes2f_array (ubuf.sbuf, readcount, ptr + total, normfact) ;
 1045|  8.99k|		total += readcount ;
 1046|  8.99k|		if (readcount < bufferlen)
  ------------------
  |  Branch (1046:7): [True: 11, False: 8.98k]
  ------------------
 1047|     11|			break ;
 1048|  8.98k|		len -= readcount ;
 1049|  8.98k|		} ;
 1050|       |
 1051|  8.99k|	return total ;
 1052|  8.99k|} /* pcm_read_bes2f */
pcm.c:bes2f_array:
  408|  8.99k|{	short			value ;
  409|       |
  410|  18.2k|	for (int i = 0 ; i < count ; i++)
  ------------------
  |  Branch (410:19): [True: 9.20k, False: 8.99k]
  ------------------
  411|  9.20k|	{	value = src [i] ;
  412|       |		value = BE2H_16 (value) ;
  ------------------
  |  |  140|  9.20k|	#define BE2H_16(x)			ENDSWAP_16 (x)
  |  |  ------------------
  |  |  |  |   34|  9.20k|#define	ENDSWAP_16(x)		(bswap_16 (x))
  |  |  ------------------
  ------------------
  413|  9.20k|		dest [i] = ((float) value) * normfact ;
  414|  9.20k|		} ;
  415|  8.99k|} /* bes2f_array */
pcm.c:pcm_read_les2f:
 1056|    276|{	BUF_UNION	ubuf ;
 1057|    276|	int			bufferlen, readcount ;
 1058|    276|	sf_count_t	total = 0 ;
 1059|    276|	float	normfact ;
 1060|       |
 1061|    276|	normfact = (psf->norm_float == SF_TRUE) ? 1.0 / ((float) 0x8000) : 1.0 ;
  ------------------
  |  Branch (1061:13): [True: 276, False: 0]
  ------------------
 1062|       |
 1063|    276|	bufferlen = ARRAY_LEN (ubuf.sbuf) ;
  ------------------
  |  |   93|    276|#define		ARRAY_LEN(x)	((int) (sizeof (x) / sizeof ((x) [0])))
  ------------------
 1064|       |
 1065|    532|	while (len > 0)
  ------------------
  |  Branch (1065:9): [True: 276, False: 256]
  ------------------
 1066|    276|	{	if (len < bufferlen)
  ------------------
  |  Branch (1066:8): [True: 276, False: 0]
  ------------------
 1067|    276|			bufferlen = (int) len ;
 1068|    276|		readcount = (int) psf_fread (ubuf.sbuf, sizeof (short), bufferlen, psf) ;
 1069|    276|		les2f_array (ubuf.sbuf, readcount, ptr + total, normfact) ;
 1070|    276|		total += readcount ;
 1071|    276|		if (readcount < bufferlen)
  ------------------
  |  Branch (1071:7): [True: 20, False: 256]
  ------------------
 1072|     20|			break ;
 1073|    256|		len -= readcount ;
 1074|    256|		} ;
 1075|       |
 1076|    276|	return total ;
 1077|    276|} /* pcm_read_les2f */
pcm.c:les2f_array:
  397|    276|{	short	value ;
  398|       |
  399|    744|	for (int i = 0 ; i < count ; i++)
  ------------------
  |  Branch (399:19): [True: 468, False: 276]
  ------------------
  400|    468|	{	value = src [i] ;
  401|    468|		value = LE2H_16 (value) ;
  ------------------
  |  |  137|    468|	#define LE2H_16(x)			(x)
  ------------------
  402|    468|		dest [i] = ((float) value) * normfact ;
  403|    468|		} ;
  404|    276|} /* les2f_array */
pcm.c:pcm_read_bet2f:
 1081|    409|{	BUF_UNION	ubuf ;
 1082|    409|	int			bufferlen, readcount ;
 1083|    409|	sf_count_t	total = 0 ;
 1084|    409|	float	normfact ;
 1085|       |
 1086|       |	/* Special normfactor because tribyte value is read into an int. */
 1087|    409|	normfact = (psf->norm_float == SF_TRUE) ? 1.0 / ((float) 0x80000000) : 1.0 / 256.0 ;
  ------------------
  |  Branch (1087:13): [True: 409, False: 0]
  ------------------
 1088|       |
 1089|    409|	bufferlen = sizeof (ubuf.ucbuf) / SIZEOF_TRIBYTE ;
  ------------------
  |  |   35|    409|#define	SIZEOF_TRIBYTE	3
  ------------------
 1090|       |
 1091|    796|	while (len > 0)
  ------------------
  |  Branch (1091:9): [True: 409, False: 387]
  ------------------
 1092|    409|	{	if (len < bufferlen)
  ------------------
  |  Branch (1092:8): [True: 409, False: 0]
  ------------------
 1093|    409|			bufferlen = (int) len ;
 1094|    409|		readcount = (int) psf_fread (ubuf.ucbuf, SIZEOF_TRIBYTE, bufferlen, psf) ;
  ------------------
  |  |   35|    409|#define	SIZEOF_TRIBYTE	3
  ------------------
 1095|    409|		bet2f_array ((tribyte*) (ubuf.ucbuf), readcount, ptr + total, normfact) ;
 1096|    409|		total += readcount ;
 1097|    409|		if (readcount < bufferlen)
  ------------------
  |  Branch (1097:7): [True: 22, False: 387]
  ------------------
 1098|     22|			break ;
 1099|    387|		len -= readcount ;
 1100|    387|		} ;
 1101|       |
 1102|    409|	return total ;
 1103|    409|} /* pcm_read_bet2f */
pcm.c:bet2f_array:
  429|    409|{	int value ;
  430|       |
  431|  1.02k|	for (int i = 0 ; i < count ; i++)
  ------------------
  |  Branch (431:19): [True: 617, False: 409]
  ------------------
  432|    617|	{	value = psf_get_be24 (src [i].bytes, 0) ;
  433|    617|		dest [i] = ((float) value) * normfact ;
  434|    617|		} ;
  435|    409|} /* bet2f_array */
pcm.c:pcm_read_let2f:
 1107|   685k|{	BUF_UNION	ubuf ;
 1108|   685k|	int			bufferlen, readcount ;
 1109|   685k|	sf_count_t	total = 0 ;
 1110|   685k|	float	normfact ;
 1111|       |
 1112|       |	/* Special normfactor because tribyte value is read into an int. */
 1113|   685k|	normfact = (psf->norm_float == SF_TRUE) ? 1.0 / ((float) 0x80000000) : 1.0 / 256.0 ;
  ------------------
  |  Branch (1113:13): [True: 685k, False: 0]
  ------------------
 1114|       |
 1115|   685k|	bufferlen = sizeof (ubuf.ucbuf) / SIZEOF_TRIBYTE ;
  ------------------
  |  |   35|   685k|#define	SIZEOF_TRIBYTE	3
  ------------------
 1116|       |
 1117|  1.37M|	while (len > 0)
  ------------------
  |  Branch (1117:9): [True: 685k, False: 685k]
  ------------------
 1118|   685k|	{	if (len < bufferlen)
  ------------------
  |  Branch (1118:8): [True: 685k, False: 0]
  ------------------
 1119|   685k|			bufferlen = (int) len ;
 1120|   685k|		readcount = (int) psf_fread (ubuf.ucbuf, SIZEOF_TRIBYTE, bufferlen, psf) ;
  ------------------
  |  |   35|   685k|#define	SIZEOF_TRIBYTE	3
  ------------------
 1121|   685k|		let2f_array ((tribyte*) (ubuf.ucbuf), readcount, ptr + total, normfact) ;
 1122|   685k|		total += readcount ;
 1123|   685k|		if (readcount < bufferlen)
  ------------------
  |  Branch (1123:7): [True: 23, False: 685k]
  ------------------
 1124|     23|			break ;
 1125|   685k|		len -= readcount ;
 1126|   685k|		} ;
 1127|       |
 1128|   685k|	return total ;
 1129|   685k|} /* pcm_read_let2f */
pcm.c:let2f_array:
  419|   685k|{	int value ;
  420|       |
  421|  3.42M|	for (int i = 0 ; i < count ; i++)
  ------------------
  |  Branch (421:19): [True: 2.74M, False: 685k]
  ------------------
  422|  2.74M|	{	value = psf_get_le24 (src [i].bytes, 0) ;
  423|  2.74M|		dest [i] = ((float) value) * normfact ;
  424|  2.74M|		} ;
  425|   685k|} /* let2f_array */
pcm.c:pcm_read_bei2f:
 1133|    378|{	BUF_UNION	ubuf ;
 1134|    378|	int			bufferlen, readcount ;
 1135|    378|	sf_count_t	total = 0 ;
 1136|    378|	float	normfact ;
 1137|       |
 1138|    378|	normfact = (psf->norm_float == SF_TRUE) ? 1.0 / ((float) 0x80000000) : 1.0 ;
  ------------------
  |  Branch (1138:13): [True: 378, False: 0]
  ------------------
 1139|       |
 1140|    378|	bufferlen = ARRAY_LEN (ubuf.ibuf) ;
  ------------------
  |  |   93|    378|#define		ARRAY_LEN(x)	((int) (sizeof (x) / sizeof ((x) [0])))
  ------------------
 1141|       |
 1142|    744|	while (len > 0)
  ------------------
  |  Branch (1142:9): [True: 378, False: 366]
  ------------------
 1143|    378|	{	if (len < bufferlen)
  ------------------
  |  Branch (1143:8): [True: 378, False: 0]
  ------------------
 1144|    378|			bufferlen = (int) len ;
 1145|    378|		readcount = (int) psf_fread (ubuf.ibuf, sizeof (int), bufferlen, psf) ;
 1146|    378|		bei2f_array (ubuf.ibuf, readcount, ptr + total, normfact) ;
 1147|    378|		total += readcount ;
 1148|    378|		if (readcount < bufferlen)
  ------------------
  |  Branch (1148:7): [True: 12, False: 366]
  ------------------
 1149|     12|			break ;
 1150|    366|		len -= readcount ;
 1151|    366|		} ;
 1152|       |
 1153|    378|	return total ;
 1154|    378|} /* pcm_read_bei2f */
pcm.c:bei2f_array:
  450|    378|{	int 			value ;
  451|       |
  452|    942|	for (int i = 0 ; i < count ; i++)
  ------------------
  |  Branch (452:19): [True: 564, False: 378]
  ------------------
  453|    564|	{	value = src [i] ;
  454|       |		value = BE2H_32 (value) ;
  ------------------
  |  |  141|    564|	#define BE2H_32(x)			ENDSWAP_32 (x)
  |  |  ------------------
  |  |  |  |   35|    564|#define	ENDSWAP_32(x)		(bswap_32 (x))
  |  |  ------------------
  ------------------
  455|    564|		dest [i] = ((float) value) * normfact ;
  456|    564|		} ;
  457|    378|} /* bei2f_array */
pcm.c:pcm_read_lei2f:
 1158|  6.06k|{	BUF_UNION	ubuf ;
 1159|  6.06k|	int			bufferlen, readcount ;
 1160|  6.06k|	sf_count_t	total = 0 ;
 1161|  6.06k|	float	normfact ;
 1162|       |
 1163|  6.06k|	normfact = (psf->norm_float == SF_TRUE) ? 1.0 / ((float) 0x80000000) : 1.0 ;
  ------------------
  |  Branch (1163:13): [True: 6.06k, False: 0]
  ------------------
 1164|       |
 1165|  6.06k|	bufferlen = ARRAY_LEN (ubuf.ibuf) ;
  ------------------
  |  |   93|  6.06k|#define		ARRAY_LEN(x)	((int) (sizeof (x) / sizeof ((x) [0])))
  ------------------
 1166|       |
 1167|  12.0k|	while (len > 0)
  ------------------
  |  Branch (1167:9): [True: 6.06k, False: 6.03k]
  ------------------
 1168|  6.06k|	{	if (len < bufferlen)
  ------------------
  |  Branch (1168:8): [True: 6.06k, False: 0]
  ------------------
 1169|  6.06k|			bufferlen = (int) len ;
 1170|  6.06k|		readcount = (int) psf_fread (ubuf.ibuf, sizeof (int), bufferlen, psf) ;
 1171|  6.06k|		lei2f_array (ubuf.ibuf, readcount, ptr + total, normfact) ;
 1172|  6.06k|		total += readcount ;
 1173|  6.06k|		if (readcount < bufferlen)
  ------------------
  |  Branch (1173:7): [True: 24, False: 6.03k]
  ------------------
 1174|     24|			break ;
 1175|  6.03k|		len -= readcount ;
 1176|  6.03k|		} ;
 1177|       |
 1178|  6.06k|	return total ;
 1179|  6.06k|} /* pcm_read_lei2f */
pcm.c:lei2f_array:
  439|  6.06k|{	int 			value ;
  440|       |
  441|  47.7k|	for (int i = 0 ; i < count ; i++)
  ------------------
  |  Branch (441:19): [True: 41.6k, False: 6.06k]
  ------------------
  442|  41.6k|	{	value = src [i] ;
  443|  41.6k|		value = LE2H_32 (value) ;
  ------------------
  |  |  138|  41.6k|	#define LE2H_32(x)			(x)
  ------------------
  444|  41.6k|		dest [i] = ((float) value) * normfact ;
  445|  41.6k|		} ;
  446|  6.06k|} /* lei2f_array */

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

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

paf.c:endswap_int_array:
  301|  2.51k|{
  302|  44.2k|	for (int i = 0 ; i < len ; i++)
  ------------------
  |  Branch (302:19): [True: 41.6k, False: 2.51k]
  ------------------
  303|  41.6k|	{	int temp = ptr [i] ;
  304|       |		ptr [i] = ENDSWAP_32 (temp) ;
  ------------------
  |  |   35|  41.6k|#define	ENDSWAP_32(x)		(bswap_32 (x))
  ------------------
  305|  41.6k|		} ;
  306|  2.51k|} /* endswap_int_array */
common.c:psf_get_be32:
  241|  1.25M|{	int32_t value = ((uint32_t) ptr [offset]) << 24 ;
  242|  1.25M|	value += ptr [offset + 1] << 16 ;
  243|  1.25M|	value += ptr [offset + 2] << 8 ;
  244|  1.25M|	value += ptr [offset + 3] ;
  245|  1.25M|	return value ;
  246|  1.25M|} /* psf_get_be32 */
common.c:psf_get_le32:
  250|   879k|{	int32_t value = ((uint32_t) ptr [offset + 3]) << 24 ;
  251|   879k|	value += ptr [offset + 2] << 16 ;
  252|   879k|	value += ptr [offset + 1] << 8 ;
  253|   879k|	value += ptr [offset] ;
  254|   879k|	return value ;
  255|   879k|} /* psf_get_le32 */
common.c:psf_get_be64:
  207|  26.8k|{	int64_t value ;
  208|       |
  209|  26.8k|	value = (int64_t) ((uint64_t) ptr [offset] << 24) ;
  210|  26.8k|	value += (int64_t) ((uint64_t) ptr [offset + 1] << 16) ;
  211|  26.8k|	value += (int64_t) ((uint64_t) ptr [offset + 2] << 8) ;
  212|  26.8k|	value += ptr [offset + 3] ;
  213|       |
  214|  26.8k|	value = (int64_t) (((uint64_t) value) << 32) ;
  215|       |
  216|  26.8k|	value += (int64_t) ((uint64_t) ptr [offset + 4] << 24) ;
  217|  26.8k|	value += (int64_t) ((uint64_t) ptr [offset + 5] << 16) ;
  218|  26.8k|	value += (int64_t) ((uint64_t) ptr [offset + 6] << 8) ;
  219|  26.8k|	value += ptr [offset + 7] ;
  220|  26.8k|	return value ;
  221|  26.8k|} /* psf_get_be64 */
common.c:psf_get_le64:
  225|   110k|{	int64_t value = (int64_t) ((uint64_t) ptr [offset + 7] << 24) ;
  226|   110k|	value += (int64_t) ((uint64_t) ptr [offset + 6] << 16) ;
  227|   110k|	value += (int64_t) ((uint64_t) ptr [offset + 5] << 8) ;
  228|   110k|	value += ptr [offset + 4] ;
  229|       |
  230|   110k|	value = (int64_t) (((uint64_t) value) << 32) ;
  231|       |
  232|   110k|	value += (int64_t) ((uint64_t) ptr [offset + 3] << 24) ;
  233|   110k|	value += (int64_t) ((uint64_t) ptr [offset + 2] << 16) ;
  234|   110k|	value += (int64_t) ((uint64_t) ptr [offset + 1] << 8) ;
  235|   110k|	value += ptr [offset] ;
  236|   110k|	return value ;
  237|   110k|} /* 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|   193k|	for (int i = 0 ; i < len ; i++)
  ------------------
  |  Branch (322:19): [True: 193k, False: 420]
  ------------------
  323|   193k|	{	int64_t value = ptr [i] ;
  324|       |		ptr [i] = ENDSWAP_64 (value) ;
  ------------------
  |  |   36|   193k|#define	ENDSWAP_64(x)		(bswap_64 (x))
  ------------------
  325|   193k|		} ;
  326|    420|} /* endswap_int64_t_array */
float32.c:endswap_int_copy:
  310|    247|{
  311|    696|	for (int i = 0 ; i < len ; i++)
  ------------------
  |  Branch (311:19): [True: 449, False: 247]
  ------------------
  312|    449|	{	dest [i] = ENDSWAP_32 (src [i]) ;
  ------------------
  |  |   35|    449|#define	ENDSWAP_32(x)		(bswap_32 (x))
  ------------------
  313|    449|		} ;
  314|    247|} /* endswap_int_copy */
pcm.c:psf_get_be24:
  259|    617|{	int32_t value = ((uint32_t) ptr [offset]) << 24 ;
  260|    617|	value += ptr [offset + 1] << 16 ;
  261|    617|	value += ptr [offset + 2] << 8 ;
  262|    617|	return value ;
  263|    617|} /* psf_get_be24 */
pcm.c:psf_get_le24:
  267|  2.74M|{	int32_t value = ((uint32_t) ptr [offset + 2]) << 24 ;
  268|  2.74M|	value += ptr [offset + 1] << 16 ;
  269|  2.74M|	value += ptr [offset] << 8 ;
  270|  2.74M|	return value ;
  271|  2.74M|} /* psf_get_le24 */
alac_decoder.c:psf_get_be32:
  241|  3.73k|{	int32_t value = ((uint32_t) ptr [offset]) << 24 ;
  242|  3.73k|	value += ptr [offset + 1] << 16 ;
  243|  3.73k|	value += ptr [offset + 2] << 8 ;
  244|  3.73k|	value += ptr [offset + 3] ;
  245|  3.73k|	return value ;
  246|  3.73k|} /* psf_get_be32 */
alac_decoder.c:psf_get_be16:
  275|    930|{	return (int16_t) (ptr [offset] << 8) + ptr [offset + 1] ;
  276|    930|} /* psf_get_be16 */

sf_open_virtual:
  473|  18.1k|{	SF_PRIVATE 	*psf ;
  474|       |
  475|       |	/* Make sure we have a valid set of virtual pointers. */
  476|  18.1k|	if (sfvirtual->get_filelen == NULL)
  ------------------
  |  Branch (476:6): [True: 0, False: 18.1k]
  ------------------
  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.1k|		} ;
  481|       |
  482|  18.1k|	if ((sfvirtual->seek == NULL || sfvirtual->tell == NULL) && sfinfo->seekable)
  ------------------
  |  Branch (482:7): [True: 0, False: 18.1k]
  |  Branch (482:34): [True: 0, False: 18.1k]
  |  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.1k|		} ;
  487|       |
  488|  18.1k|	if ((mode == SFM_READ || mode == SFM_RDWR) && sfvirtual->read == NULL)
  ------------------
  |  Branch (488:7): [True: 18.1k, False: 0]
  |  Branch (488:27): [True: 0, False: 0]
  |  Branch (488:48): [True: 0, False: 18.1k]
  ------------------
  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.1k|		} ;
  493|       |
  494|  18.1k|	if ((mode == SFM_WRITE || mode == SFM_RDWR) && sfvirtual->write == NULL)
  ------------------
  |  Branch (494:7): [True: 0, False: 18.1k]
  |  Branch (494:28): [True: 0, False: 18.1k]
  |  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.1k|		} ;
  499|       |
  500|  18.1k|	if ((psf = psf_allocate ()) == NULL)
  ------------------
  |  Branch (500:6): [True: 0, False: 18.1k]
  ------------------
  501|      0|	{	sf_errno = SFE_MALLOC_FAILED ;
  502|      0|		return	NULL ;
  503|  18.1k|		} ;
  504|       |
  505|  18.1k|	psf_init_files (psf) ;
  506|       |
  507|  18.1k|	psf->virtual_io = SF_TRUE ;
  508|  18.1k|	psf->vio = *sfvirtual ;
  509|  18.1k|	psf->vio_user_data = user_data ;
  510|       |
  511|  18.1k|	psf->file.mode = mode ;
  512|       |
  513|  18.1k|	return psf_open_file (psf, sfinfo) ;
  514|  18.1k|} /* sf_open_virtual */
sf_close:
  518|  3.10k|{	SF_PRIVATE	*psf ;
  519|       |
  520|  3.10k|	VALIDATE_SNDFILE_AND_ASSIGN_PSF (sndfile, psf, 1) ;
  ------------------
  |  |  326|  3.10k|		{	if ((a) == NULL)						\
  |  |  ------------------
  |  |  |  Branch (326:9): [True: 0, False: 3.10k]
  |  |  ------------------
  |  |  327|  3.10k|			{	sf_errno = SFE_BAD_SNDFILE_PTR ;	\
  |  |  328|      0|				return 0 ;							\
  |  |  329|  3.10k|				} ;									\
  |  |  330|  3.10k|			(b) = (SF_PRIVATE*) (a) ;				\
  |  |  331|  3.10k|			if ((b)->virtual_io == SF_FALSE &&		\
  |  |  ------------------
  |  |  |  Branch (331:8): [True: 0, False: 3.10k]
  |  |  ------------------
  |  |  332|  3.10k|				psf_file_valid (b) == 0)			\
  |  |  ------------------
  |  |  |  Branch (332:5): [True: 0, False: 0]
  |  |  ------------------
  |  |  333|  3.10k|			{	(b)->error = SFE_BAD_FILE_PTR ;		\
  |  |  334|      0|				return 0 ;							\
  |  |  335|  3.10k|				} ;									\
  |  |  336|  3.10k|			if ((b)->Magick != SNDFILE_MAGICK)		\
  |  |  ------------------
  |  |  |  |   41|  3.10k|#define		SNDFILE_MAGICK	0x1234C0DE
  |  |  ------------------
  |  |  |  Branch (336:8): [True: 0, False: 3.10k]
  |  |  ------------------
  |  |  337|  3.10k|			{	(b)->error = SFE_BAD_SNDFILE_PTR ;	\
  |  |  338|      0|				return 0 ;							\
  |  |  339|  3.10k|				} ;									\
  |  |  340|  3.10k|			if (c) (b)->error = 0 ;					\
  |  |  ------------------
  |  |  |  Branch (340:8): [True: 3.10k, Folded]
  |  |  ------------------
  |  |  341|  3.10k|			}
  ------------------
  521|       |
  522|  3.10k|	return psf_close (psf) ;
  523|  6.20k|} /* sf_close */
sf_error_number:
  542|  13.5k|{	static const char *bad_errnum =
  543|  13.5k|		"No error defined for this error number. This is a bug in libsndfile." ;
  544|  13.5k|	int	k ;
  545|       |
  546|  13.5k|	if (errnum == SFE_MAX_ERROR)
  ------------------
  |  Branch (546:6): [True: 0, False: 13.5k]
  ------------------
  547|      0|		return SndfileErrors [0].str ;
  548|       |
  549|  13.5k|	if (errnum < 0 || errnum > SFE_MAX_ERROR)
  ------------------
  |  Branch (549:6): [True: 0, False: 13.5k]
  |  Branch (549:20): [True: 0, False: 13.5k]
  ------------------
  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|  13.5k|		} ;
  554|       |
  555|   819k|	for (k = 0 ; SndfileErrors [k].str ; k++)
  ------------------
  |  Branch (555:15): [True: 819k, False: 0]
  ------------------
  556|   819k|		if (errnum == SndfileErrors [k].error)
  ------------------
  |  Branch (556:7): [True: 13.5k, False: 805k]
  ------------------
  557|  13.5k|			return SndfileErrors [k].str ;
  558|       |
  559|      0|	return bad_errnum ;
  560|  13.5k|} /* sf_error_number */
sf_readf_float:
 2020|   214M|{	SF_PRIVATE 	*psf ;
 2021|   214M|	sf_count_t	count, extra ;
 2022|       |
 2023|   214M|	if (frames == 0)
  ------------------
  |  Branch (2023:6): [True: 0, False: 214M]
  ------------------
 2024|      0|		return 0 ;
 2025|       |
 2026|   856M|	VALIDATE_SNDFILE_AND_ASSIGN_PSF (sndfile, psf, 1) ;
  ------------------
  |  |  326|   214M|		{	if ((a) == NULL)						\
  |  |  ------------------
  |  |  |  Branch (326:9): [True: 0, False: 214M]
  |  |  ------------------
  |  |  327|   214M|			{	sf_errno = SFE_BAD_SNDFILE_PTR ;	\
  |  |  328|      0|				return 0 ;							\
  |  |  329|   214M|				} ;									\
  |  |  330|   214M|			(b) = (SF_PRIVATE*) (a) ;				\
  |  |  331|   214M|			if ((b)->virtual_io == SF_FALSE &&		\
  |  |  ------------------
  |  |  |  Branch (331:8): [True: 0, False: 214M]
  |  |  ------------------
  |  |  332|   214M|				psf_file_valid (b) == 0)			\
  |  |  ------------------
  |  |  |  Branch (332:5): [True: 0, False: 0]
  |  |  ------------------
  |  |  333|   214M|			{	(b)->error = SFE_BAD_FILE_PTR ;		\
  |  |  334|      0|				return 0 ;							\
  |  |  335|   214M|				} ;									\
  |  |  336|   214M|			if ((b)->Magick != SNDFILE_MAGICK)		\
  |  |  ------------------
  |  |  |  |   41|   214M|#define		SNDFILE_MAGICK	0x1234C0DE
  |  |  ------------------
  |  |  |  Branch (336:8): [True: 0, False: 214M]
  |  |  ------------------
  |  |  337|   214M|			{	(b)->error = SFE_BAD_SNDFILE_PTR ;	\
  |  |  338|      0|				return 0 ;							\
  |  |  339|   214M|				} ;									\
  |  |  340|   214M|			if (c) (b)->error = 0 ;					\
  |  |  ------------------
  |  |  |  Branch (340:8): [True: 214M, Folded]
  |  |  ------------------
  |  |  341|   214M|			}
  ------------------
 2027|       |
 2028|   856M|	if (frames <= 0)
  ------------------
  |  Branch (2028:6): [True: 0, False: 214M]
  ------------------
 2029|      0|	{	psf->error = SFE_NEGATIVE_RW_LEN ;
 2030|      0|		return 0 ;
 2031|   214M|		} ;
 2032|       |
 2033|   214M|	if (psf->file.mode == SFM_WRITE)
  ------------------
  |  Branch (2033:6): [True: 0, False: 214M]
  ------------------
 2034|      0|	{	psf->error = SFE_NOT_READMODE ;
 2035|      0|		return 0 ;
 2036|   214M|		} ;
 2037|       |
 2038|   214M|	if (psf->read_current >= psf->sf.frames)
  ------------------
  |  Branch (2038:6): [True: 1.97k, False: 214M]
  ------------------
 2039|  1.97k|	{	psf_memset (ptr, 0, frames * psf->sf.channels * sizeof (float)) ;
 2040|  1.97k|		return 0 ;
 2041|   214M|		} ;
 2042|       |
 2043|   214M|	if (psf->read_float == NULL || psf->seek == NULL)
  ------------------
  |  Branch (2043:6): [True: 1, False: 214M]
  |  Branch (2043:33): [True: 0, False: 214M]
  ------------------
 2044|      1|	{	psf->error = SFE_UNIMPLEMENTED ;
 2045|      1|		return	0 ;
 2046|   214M|		} ;
 2047|       |
 2048|   214M|	if (psf->last_op != SFM_READ)
  ------------------
  |  Branch (2048:6): [True: 62, False: 214M]
  ------------------
 2049|     62|		if (psf->seek (psf, SFM_READ, psf->read_current) < 0)
  ------------------
  |  Branch (2049:7): [True: 0, False: 62]
  ------------------
 2050|      0|			return 0 ;
 2051|       |
 2052|   214M|	count = psf->read_float (psf, ptr, frames * psf->sf.channels) ;
 2053|       |
 2054|   214M|	if (psf->read_current + count / psf->sf.channels <= psf->sf.frames)
  ------------------
  |  Branch (2054:6): [True: 214M, False: 0]
  ------------------
 2055|   214M|		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|   214M|	psf->last_op = SFM_READ ;
 2064|       |
 2065|   214M|	return count / psf->sf.channels ;
 2066|   214M|} /* sf_readf_float */
psf_open_file:
 3010|  18.1k|{	int		error, format ;
 3011|       |
 3012|  18.1k|	sf_errno = error = 0 ;
 3013|  18.1k|	sf_parselog [0] = 0 ;
 3014|       |
 3015|  18.1k|	if (psf->error)
  ------------------
  |  Branch (3015:6): [True: 0, False: 18.1k]
  ------------------
 3016|      0|	{	error = psf->error ;
 3017|      0|		goto error_exit ;
 3018|  18.1k|		} ;
 3019|       |
 3020|  18.1k|	if (psf->file.mode != SFM_READ && psf->file.mode != SFM_WRITE && psf->file.mode != SFM_RDWR)
  ------------------
  |  Branch (3020:6): [True: 0, False: 18.1k]
  |  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.1k|		} ;
 3024|       |
 3025|  18.1k|	if (sfinfo == NULL)
  ------------------
  |  Branch (3025:6): [True: 0, False: 18.1k]
  ------------------
 3026|      0|	{	error = SFE_BAD_SF_INFO_PTR ;
 3027|      0|		goto error_exit ;
 3028|  18.1k|		} ;
 3029|       |
 3030|  18.1k|	if (psf->file.mode == SFM_READ)
  ------------------
  |  Branch (3030:6): [True: 18.1k, False: 0]
  ------------------
 3031|  18.1k|	{	if ((SF_CONTAINER (sfinfo->format)) == SF_FORMAT_RAW)
  ------------------
  |  |  108|  18.1k|#define SF_CONTAINER(x)		((x) & SF_FORMAT_TYPEMASK)
  ------------------
  |  Branch (3031:8): [True: 0, False: 18.1k]
  ------------------
 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.1k|		else
 3038|  18.1k|			memset (sfinfo, 0, sizeof (SF_INFO)) ;
 3039|  18.1k|		} ;
 3040|       |
 3041|  18.1k|	memcpy (&psf->sf, sfinfo, sizeof (SF_INFO)) ;
 3042|       |
 3043|  18.1k|	psf->Magick 		= SNDFILE_MAGICK ;
  ------------------
  |  |   41|  18.1k|#define		SNDFILE_MAGICK	0x1234C0DE
  ------------------
 3044|  18.1k|	psf->norm_float 	= SF_TRUE ;
 3045|  18.1k|	psf->norm_double	= SF_TRUE ;
 3046|  18.1k|	psf->dataoffset		= -1 ;
 3047|  18.1k|	psf->datalength		= -1 ;
 3048|  18.1k|	psf->read_current	= -1 ;
 3049|  18.1k|	psf->write_current	= -1 ;
 3050|  18.1k|	psf->auto_header 	= SF_FALSE ;
 3051|  18.1k|	psf->rwf_endian		= SF_ENDIAN_LITTLE ;
 3052|  18.1k|	psf->seek			= psf_default_seek ;
 3053|  18.1k|	psf->float_int_mult = 0 ;
 3054|  18.1k|	psf->float_max		= -1.0 ;
 3055|       |
 3056|       |	/* An attempt at a per SF_PRIVATE unique id. */
 3057|  18.1k|	psf->unique_id		= psf_rand_int32 () ;
 3058|       |
 3059|  18.1k|	psf->sf.sections = 1 ;
 3060|       |
 3061|  18.1k|	psf->is_pipe = psf_is_pipe (psf) ;
 3062|       |
 3063|  18.1k|	if (psf->is_pipe)
  ------------------
  |  Branch (3063:6): [True: 0, False: 18.1k]
  ------------------
 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.1k|	else
 3068|  18.1k|	{	psf->sf.seekable = SF_TRUE ;
 3069|       |
 3070|       |		/* File is open, so get the length. */
 3071|  18.1k|		psf->filelength = psf_get_filelen (psf) ;
 3072|  18.1k|		} ;
 3073|       |
 3074|  18.1k|	if (psf->fileoffset > 0)
  ------------------
  |  Branch (3074:6): [True: 0, False: 18.1k]
  ------------------
 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.1k|		} ;
 3097|       |
 3098|  18.1k|	if (psf->filelength == SF_COUNT_MAX)
  ------------------
  |  |  370|  18.1k|#define SF_COUNT_MAX	INT64_MAX
  ------------------
  |  Branch (3098:6): [True: 0, False: 18.1k]
  ------------------
 3099|      0|		psf_log_printf (psf, "Length : unknown\n") ;
 3100|  18.1k|	else
 3101|  18.1k|		psf_log_printf (psf, "Length : %D\n", psf->filelength) ;
 3102|       |
 3103|  18.1k|	if (psf->file.mode == SFM_WRITE || (psf->file.mode == SFM_RDWR && psf->filelength == 0))
  ------------------
  |  Branch (3103:6): [True: 0, False: 18.1k]
  |  Branch (3103:38): [True: 0, False: 18.1k]
  |  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.1k|	else if ((SF_CONTAINER (psf->sf.format)) != SF_FORMAT_RAW)
  ------------------
  |  |  108|  18.1k|#define SF_CONTAINER(x)		((x) & SF_FORMAT_TYPEMASK)
  ------------------
  |  Branch (3121:11): [True: 18.1k, False: 0]
  ------------------
 3122|  18.1k|	{	/* If type RAW has not been specified then need to figure out file type. */
 3123|  18.1k|		psf->sf.format = guess_file_type (psf) ;
 3124|       |
 3125|  18.1k|		if (psf->sf.format == 0)
  ------------------
  |  Branch (3125:7): [True: 1.84k, False: 16.3k]
  ------------------
 3126|  1.84k|			psf->sf.format = format_from_extension (psf) ;
 3127|  18.1k|		} ;
 3128|       |
 3129|       |	/* Prevent unnecessary seeks */
 3130|  18.1k|	psf->last_op = psf->file.mode ;
 3131|       |
 3132|       |	/* Set bytewidth if known. */
 3133|  18.1k|	switch (SF_CODEC (psf->sf.format))
  ------------------
  |  |  109|  18.1k|#define SF_CODEC(x)			((x) & SF_FORMAT_SUBMASK)
  |  |  ------------------
  |  |  |  Branch (109:23): [True: 0, False: 18.1k]
  |  |  ------------------
  ------------------
 3134|  18.1k|	{	case SF_FORMAT_PCM_S8 :
  ------------------
  |  Branch (3134:4): [True: 0, False: 18.1k]
  ------------------
 3135|      0|		case SF_FORMAT_PCM_U8 :
  ------------------
  |  Branch (3135:3): [True: 0, False: 18.1k]
  ------------------
 3136|      0|		case SF_FORMAT_ULAW :
  ------------------
  |  Branch (3136:3): [True: 0, False: 18.1k]
  ------------------
 3137|      0|		case SF_FORMAT_ALAW :
  ------------------
  |  Branch (3137:3): [True: 0, False: 18.1k]
  ------------------
 3138|      0|		case SF_FORMAT_DPCM_8 :
  ------------------
  |  Branch (3138:3): [True: 0, False: 18.1k]
  ------------------
 3139|      0|				psf->bytewidth = 1 ;
 3140|      0|				break ;
 3141|       |
 3142|      0|		case SF_FORMAT_PCM_16 :
  ------------------
  |  Branch (3142:3): [True: 0, False: 18.1k]
  ------------------
 3143|      0|		case SF_FORMAT_DPCM_16 :
  ------------------
  |  Branch (3143:3): [True: 0, False: 18.1k]
  ------------------
 3144|      0|				psf->bytewidth = 2 ;
 3145|      0|				break ;
 3146|       |
 3147|      0|		case SF_FORMAT_PCM_24 :
  ------------------
  |  Branch (3147:3): [True: 0, False: 18.1k]
  ------------------
 3148|      0|				psf->bytewidth = 3 ;
 3149|      0|				break ;
 3150|       |
 3151|      0|		case SF_FORMAT_PCM_32 :
  ------------------
  |  Branch (3151:3): [True: 0, False: 18.1k]
  ------------------
 3152|      0|		case SF_FORMAT_FLOAT :
  ------------------
  |  Branch (3152:3): [True: 0, False: 18.1k]
  ------------------
 3153|      0|				psf->bytewidth = 4 ;
 3154|      0|				break ;
 3155|       |
 3156|      0|		case SF_FORMAT_DOUBLE :
  ------------------
  |  Branch (3156:3): [True: 0, False: 18.1k]
  ------------------
 3157|      0|				psf->bytewidth = 8 ;
 3158|      0|				break ;
 3159|  18.1k|		} ;
 3160|       |
 3161|       |	/* Call the initialisation function for the relevant file type. */
 3162|  18.1k|	switch (SF_CONTAINER (psf->sf.format))
  ------------------
  |  |  108|  18.1k|#define SF_CONTAINER(x)		((x) & SF_FORMAT_TYPEMASK)
  ------------------
 3163|  18.1k|	{	case	SF_FORMAT_WAV :
  ------------------
  |  Branch (3163:4): [True: 4.10k, False: 14.0k]
  ------------------
 3164|  4.10k|		case	SF_FORMAT_WAVEX :
  ------------------
  |  Branch (3164:3): [True: 0, False: 18.1k]
  ------------------
 3165|  4.10k|				error = wav_open (psf) ;
 3166|  4.10k|				break ;
 3167|       |
 3168|  2.88k|		case	SF_FORMAT_AIFF :
  ------------------
  |  Branch (3168:3): [True: 2.88k, False: 15.3k]
  ------------------
 3169|  2.88k|				error = aiff_open (psf) ;
 3170|  2.88k|				break ;
 3171|       |
 3172|  1.26k|		case	SF_FORMAT_AU :
  ------------------
  |  Branch (3172:3): [True: 1.26k, False: 16.9k]
  ------------------
 3173|  1.26k|				error = au_open (psf) ;
 3174|  1.26k|				break ;
 3175|       |
 3176|      0|		case	SF_FORMAT_RAW :
  ------------------
  |  Branch (3176:3): [True: 0, False: 18.1k]
  ------------------
 3177|      0|				error = raw_open (psf) ;
 3178|      0|				break ;
 3179|       |
 3180|    691|		case	SF_FORMAT_W64 :
  ------------------
  |  Branch (3180:3): [True: 691, False: 17.4k]
  ------------------
 3181|    691|				error = w64_open (psf) ;
 3182|    691|				break ;
 3183|       |
 3184|  1.98k|		case	SF_FORMAT_RF64 :
  ------------------
  |  Branch (3184:3): [True: 1.98k, False: 16.2k]
  ------------------
 3185|  1.98k|				error = rf64_open (psf) ;
 3186|  1.98k|				break ;
 3187|       |
 3188|       |		/* Lite remove start */
 3189|    131|		case	SF_FORMAT_PAF :
  ------------------
  |  Branch (3189:3): [True: 131, False: 18.0k]
  ------------------
 3190|    131|				error = paf_open (psf) ;
 3191|    131|				break ;
 3192|       |
 3193|    495|		case	SF_FORMAT_SVX :
  ------------------
  |  Branch (3193:3): [True: 495, False: 17.6k]
  ------------------
 3194|    495|				error = svx_open (psf) ;
 3195|    495|				break ;
 3196|       |
 3197|    102|		case	SF_FORMAT_NIST :
  ------------------
  |  Branch (3197:3): [True: 102, False: 18.0k]
  ------------------
 3198|    102|				error = nist_open (psf) ;
 3199|    102|				break ;
 3200|       |
 3201|    293|		case	SF_FORMAT_IRCAM :
  ------------------
  |  Branch (3201:3): [True: 293, False: 17.8k]
  ------------------
 3202|    293|				error = ircam_open (psf) ;
 3203|    293|				break ;
 3204|       |
 3205|    246|		case	SF_FORMAT_VOC :
  ------------------
  |  Branch (3205:3): [True: 246, False: 17.9k]
  ------------------
 3206|    246|				error = voc_open (psf) ;
 3207|    246|				break ;
 3208|       |
 3209|    354|		case	SF_FORMAT_SDS :
  ------------------
  |  Branch (3209:3): [True: 354, False: 17.8k]
  ------------------
 3210|    354|				error = sds_open (psf) ;
 3211|    354|				break ;
 3212|       |
 3213|      1|		case	SF_FORMAT_OGG :
  ------------------
  |  Branch (3213:3): [True: 1, False: 18.1k]
  ------------------
 3214|      1|				error = ogg_open (psf) ;
 3215|      1|				break ;
 3216|       |
 3217|      2|		case	SF_FORMAT_TXW :
  ------------------
  |  Branch (3217:3): [True: 2, False: 18.1k]
  ------------------
 3218|      2|				error = txw_open (psf) ;
 3219|      2|				break ;
 3220|       |
 3221|     76|		case	SF_FORMAT_WVE :
  ------------------
  |  Branch (3221:3): [True: 76, False: 18.1k]
  ------------------
 3222|     76|				error = wve_open (psf) ;
 3223|     76|				break ;
 3224|       |
 3225|      1|		case	SF_FORMAT_DWD :
  ------------------
  |  Branch (3225:3): [True: 1, False: 18.1k]
  ------------------
 3226|      1|				error = dwd_open (psf) ;
 3227|      1|				break ;
 3228|       |
 3229|    638|		case	SF_FORMAT_MAT4 :
  ------------------
  |  Branch (3229:3): [True: 638, False: 17.5k]
  ------------------
 3230|    638|				error = mat4_open (psf) ;
 3231|    638|				break ;
 3232|       |
 3233|    247|		case	SF_FORMAT_MAT5 :
  ------------------
  |  Branch (3233:3): [True: 247, False: 17.9k]
  ------------------
 3234|    247|				error = mat5_open (psf) ;
 3235|    247|				break ;
 3236|       |
 3237|    124|		case	SF_FORMAT_PVF :
  ------------------
  |  Branch (3237:3): [True: 124, False: 18.0k]
  ------------------
 3238|    124|				error = pvf_open (psf) ;
 3239|    124|				break ;
 3240|       |
 3241|    184|		case	SF_FORMAT_XI :
  ------------------
  |  Branch (3241:3): [True: 184, False: 18.0k]
  ------------------
 3242|    184|				error = xi_open (psf) ;
 3243|    184|				break ;
 3244|       |
 3245|     50|		case	SF_FORMAT_HTK :
  ------------------
  |  Branch (3245:3): [True: 50, False: 18.1k]
  ------------------
 3246|     50|				error = htk_open (psf) ;
 3247|     50|				break ;
 3248|       |
 3249|      0|		case	SF_FORMAT_SD2 :
  ------------------
  |  Branch (3249:3): [True: 0, False: 18.1k]
  ------------------
 3250|      0|				error = sd2_open (psf) ;
 3251|      0|				break ;
 3252|       |
 3253|      1|		case	SF_FORMAT_REX2 :
  ------------------
  |  Branch (3253:3): [True: 1, False: 18.1k]
  ------------------
 3254|      1|				error = rx2_open (psf) ;
 3255|      1|				break ;
 3256|       |
 3257|     73|		case	SF_FORMAT_AVR :
  ------------------
  |  Branch (3257:3): [True: 73, False: 18.1k]
  ------------------
 3258|     73|				error = avr_open (psf) ;
 3259|     73|				break ;
 3260|       |
 3261|      1|		case	SF_FORMAT_FLAC :
  ------------------
  |  Branch (3261:3): [True: 1, False: 18.1k]
  ------------------
 3262|      1|				error = flac_open (psf) ;
 3263|      1|				break ;
 3264|       |
 3265|  2.37k|		case	SF_FORMAT_CAF :
  ------------------
  |  Branch (3265:3): [True: 2.37k, False: 15.8k]
  ------------------
 3266|  2.37k|				error = caf_open (psf) ;
 3267|  2.37k|				break ;
 3268|       |
 3269|     12|		case	SF_FORMAT_MPC2K :
  ------------------
  |  Branch (3269:3): [True: 12, False: 18.1k]
  ------------------
 3270|     12|				error = mpc2k_open (psf) ;
 3271|     12|				break ;
 3272|       |
 3273|     14|		case	SF_FORMAT_MPEG :
  ------------------
  |  Branch (3273:3): [True: 14, False: 18.1k]
  ------------------
 3274|     14|				error = mpeg_open (psf) ;
 3275|     14|				break ;
 3276|       |
 3277|       |		/* Lite remove end */
 3278|       |
 3279|  1.84k|		default :
  ------------------
  |  Branch (3279:3): [True: 1.84k, False: 16.3k]
  ------------------
 3280|  1.84k|				error = SF_ERR_UNRECOGNISED_FORMAT ;
 3281|  18.1k|		} ;
 3282|       |
 3283|  18.1k|	if (error)
  ------------------
  |  Branch (3283:6): [True: 13.1k, False: 5.04k]
  ------------------
 3284|  13.1k|		goto error_exit ;
 3285|       |
 3286|       |	/* For now, check whether embedding is supported. */
 3287|  5.04k|	format = SF_CONTAINER (psf->sf.format) ;
  ------------------
  |  |  108|  5.04k|#define SF_CONTAINER(x)		((x) & SF_FORMAT_TYPEMASK)
  ------------------
 3288|  5.04k|	if (psf->fileoffset > 0)
  ------------------
  |  Branch (3288:6): [True: 132, False: 4.91k]
  ------------------
 3289|    132|	{	switch (format)
 3290|    132|		{	case SF_FORMAT_WAV :
  ------------------
  |  Branch (3290:5): [True: 24, False: 108]
  ------------------
 3291|     25|			case SF_FORMAT_WAVEX :
  ------------------
  |  Branch (3291:4): [True: 1, False: 131]
  ------------------
 3292|     27|			case SF_FORMAT_AIFF :
  ------------------
  |  Branch (3292:4): [True: 2, False: 130]
  ------------------
 3293|     79|			case SF_FORMAT_AU :
  ------------------
  |  Branch (3293:4): [True: 52, False: 80]
  ------------------
 3294|       |				/* Actual embedded files. */
 3295|     79|				break ;
 3296|       |
 3297|      0|			case SF_FORMAT_MPEG :
  ------------------
  |  Branch (3297:4): [True: 0, False: 132]
  ------------------
 3298|      0|			case SF_FORMAT_FLAC :
  ------------------
  |  Branch (3298:4): [True: 0, False: 132]
  ------------------
 3299|       |				/* Flac with an ID3v2 header? */
 3300|      0|				break ;
 3301|       |
 3302|     53|			default :
  ------------------
  |  Branch (3302:4): [True: 53, False: 79]
  ------------------
 3303|     53|				error = SFE_NO_EMBED_SUPPORT ;
 3304|     53|				goto error_exit ;
 3305|    132|			} ;
 3306|  4.98k|		} ;
 3307|       |
 3308|  4.98k|	if (psf->fileoffset > 0)
  ------------------
  |  Branch (3308:6): [True: 79, False: 4.91k]
  ------------------
 3309|     79|		psf_log_printf (psf, "Embedded file length : %D\n", psf->filelength) ;
 3310|       |
 3311|  4.98k|	if (psf->file.mode == SFM_RDWR && sf_format_check (&psf->sf) == 0)
  ------------------
  |  Branch (3311:6): [True: 0, False: 4.98k]
  |  Branch (3311:36): [True: 0, False: 0]
  ------------------
 3312|      0|	{	error = SFE_BAD_MODE_RW ;
 3313|      0|		goto error_exit ;
 3314|  4.98k|		} ;
 3315|       |
 3316|  4.98k|	if (validate_sfinfo (&psf->sf) == 0)
  ------------------
  |  Branch (3316:6): [True: 1.09k, False: 3.89k]
  ------------------
 3317|  1.09k|	{	psf_log_SF_INFO (psf) ;
 3318|  1.09k|		save_header_info (psf) ;
 3319|  1.09k|		error = SFE_BAD_SF_INFO ;
 3320|  1.09k|		goto error_exit ;
 3321|  3.89k|		} ;
 3322|       |
 3323|  3.89k|	if (validate_psf (psf) == 0)
  ------------------
  |  Branch (3323:6): [True: 787, False: 3.10k]
  ------------------
 3324|    787|	{	save_header_info (psf) ;
 3325|    787|		error = SFE_INTERNAL ;
 3326|    787|		goto error_exit ;
 3327|  3.10k|		} ;
 3328|       |
 3329|  3.10k|	psf->read_current = 0 ;
 3330|  3.10k|	psf->write_current = 0 ;
 3331|  3.10k|	if (psf->file.mode == SFM_RDWR)
  ------------------
  |  Branch (3331:6): [True: 0, False: 3.10k]
  ------------------
 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.10k|	memcpy (sfinfo, &psf->sf, sizeof (SF_INFO)) ;
 3337|       |
 3338|  3.10k|	if (psf->file.mode == SFM_WRITE)
  ------------------
  |  Branch (3338:6): [True: 0, False: 3.10k]
  ------------------
 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.10k|	return (SNDFILE *) psf ;
 3346|       |
 3347|  15.0k|error_exit :
 3348|  15.0k|	sf_errno = error ;
 3349|       |
 3350|  15.0k|	if (error == SFE_SYSTEM)
  ------------------
  |  Branch (3350:6): [True: 0, False: 15.0k]
  ------------------
 3351|      0|		snprintf (sf_syserr, sizeof (sf_syserr), "%s", psf->syserr) ;
 3352|  15.0k|	snprintf (sf_parselog, sizeof (sf_parselog), "%s", psf->parselog.buf) ;
 3353|       |
 3354|  15.0k|	switch (error)
 3355|  15.0k|	{	case SF_ERR_SYSTEM :
  ------------------
  |  Branch (3355:4): [True: 0, False: 15.0k]
  ------------------
 3356|    267|		case SF_ERR_UNSUPPORTED_ENCODING :
  ------------------
  |  Branch (3356:3): [True: 267, False: 14.8k]
  ------------------
 3357|  1.50k|		case SFE_UNIMPLEMENTED :
  ------------------
  |  Branch (3357:3): [True: 1.23k, False: 13.8k]
  ------------------
 3358|  1.50k|			break ;
 3359|       |
 3360|      0|		case SFE_RAW_BAD_FORMAT :
  ------------------
  |  Branch (3360:3): [True: 0, False: 15.0k]
  ------------------
 3361|      0|			break ;
 3362|       |
 3363|  13.5k|		default :
  ------------------
  |  Branch (3363:3): [True: 13.5k, False: 1.50k]
  ------------------
 3364|  13.5k|			if (psf->file.mode == SFM_READ)
  ------------------
  |  Branch (3364:8): [True: 13.5k, False: 0]
  ------------------
 3365|  13.5k|			{	psf_log_printf (psf, "Parse error : %s\n", sf_error_number (error)) ;
 3366|  13.5k|				error = SF_ERR_MALFORMED_FILE ;
 3367|  13.5k|				} ;
 3368|  15.0k|		} ;
 3369|       |
 3370|  15.0k|	psf_close (psf) ;
 3371|       |	return NULL ;
 3372|  15.0k|} /* psf_open_file */
sndfile.c:psf_close:
 2965|  18.1k|{	uint32_t k ;
 2966|  18.1k|	int	error = 0 ;
 2967|       |
 2968|  18.1k|	if (psf->codec_close)
  ------------------
  |  Branch (2968:6): [True: 2.98k, False: 15.2k]
  ------------------
 2969|  2.98k|	{	error = psf->codec_close (psf) ;
 2970|       |		/* To prevent it being called in psf->container_close(). */
 2971|  2.98k|		psf->codec_close = NULL ;
 2972|  2.98k|		} ;
 2973|       |
 2974|  18.1k|	if (psf->container_close)
  ------------------
  |  Branch (2974:6): [True: 7.74k, False: 10.4k]
  ------------------
 2975|  7.74k|		error = psf->container_close (psf) ;
 2976|       |
 2977|  18.1k|	error = psf_fclose (psf) ;
 2978|  18.1k|	psf_close_rsrc (psf) ;
 2979|       |
 2980|       |	/* For an ISO C compliant implementation it is ok to free a NULL pointer. */
 2981|  18.1k|	free (psf->header.ptr) ;
 2982|  18.1k|	free (psf->container_data) ;
 2983|  18.1k|	free (psf->codec_data) ;
 2984|  18.1k|	free (psf->interleave) ;
 2985|  18.1k|	free (psf->dither) ;
 2986|  18.1k|	free (psf->peak_info) ;
 2987|  18.1k|	free (psf->broadcast_16k) ;
 2988|  18.1k|	free (psf->loop_info) ;
 2989|  18.1k|	free (psf->instrument) ;
 2990|  18.1k|	free (psf->cues) ;
 2991|  18.1k|	free (psf->channel_map) ;
 2992|  18.1k|	free (psf->format_desc) ;
 2993|  18.1k|	free (psf->strings.storage) ;
 2994|       |
 2995|  18.1k|	if (psf->wchunks.chunks)
  ------------------
  |  Branch (2995:6): [True: 0, False: 18.1k]
  ------------------
 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.1k|	free (psf->rchunks.chunks) ;
 2999|  18.1k|	free (psf->wchunks.chunks) ;
 3000|  18.1k|	free (psf->iterator) ;
 3001|  18.1k|	free (psf->cart_16k) ;
 3002|       |
 3003|  18.1k|	free (psf) ;
 3004|       |
 3005|  18.1k|	return error ;
 3006|  18.1k|} /* psf_close */
sndfile.c:guess_file_type:
 2783|  18.1k|{	uint32_t buffer [3], format ;
 2784|       |
 2785|  20.1k|retry:
 2786|  20.1k|	if (psf_binheader_readf (psf, "b", &buffer, SIGNED_SIZEOF (buffer)) != SIGNED_SIZEOF (buffer))
  ------------------
  |  |   91|  20.1k|#define		SIGNED_SIZEOF(x)	((int) sizeof (x))
  ------------------
              	if (psf_binheader_readf (psf, "b", &buffer, SIGNED_SIZEOF (buffer)) != SIGNED_SIZEOF (buffer))
  ------------------
  |  |   91|  20.1k|#define		SIGNED_SIZEOF(x)	((int) sizeof (x))
  ------------------
  |  Branch (2786:6): [True: 60, False: 20.0k]
  ------------------
 2787|     60|	{	psf->error = SFE_BAD_FILE_READ ;
 2788|     60|		return 0 ;
 2789|  20.0k|		} ;
 2790|       |
 2791|  20.0k|	if ((buffer [0] == MAKE_MARKER ('R', 'I', 'F', 'F') || buffer [0] == MAKE_MARKER ('R', 'I', 'F', 'X'))
  ------------------
  |  |  122|  40.1k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
              	if ((buffer [0] == MAKE_MARKER ('R', 'I', 'F', 'F') || buffer [0] == MAKE_MARKER ('R', 'I', 'F', 'X'))
  ------------------
  |  |  122|  16.1k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
  |  Branch (2791:7): [True: 3.96k, False: 16.1k]
  |  Branch (2791:57): [True: 190, False: 15.9k]
  ------------------
 2792|  4.15k|			&& buffer [2] == MAKE_MARKER ('W', 'A', 'V', 'E'))
  ------------------
  |  |  122|  4.15k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
  |  Branch (2792:7): [True: 4.10k, False: 53]
  ------------------
 2793|  4.10k|		return SF_FORMAT_WAV ;
 2794|       |
 2795|  15.9k|	if (buffer [0] == MAKE_MARKER ('F', 'O', 'R', 'M'))
  ------------------
  |  |  122|  15.9k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
  |  Branch (2795:6): [True: 3.50k, False: 12.4k]
  ------------------
 2796|  3.50k|	{	if (buffer [2] == MAKE_MARKER ('A', 'I', 'F', 'F') || buffer [2] == MAKE_MARKER ('A', 'I', 'F', 'C'))
  ------------------
  |  |  122|  7.01k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
              	{	if (buffer [2] == MAKE_MARKER ('A', 'I', 'F', 'F') || buffer [2] == MAKE_MARKER ('A', 'I', 'F', 'C'))
  ------------------
  |  |  122|  2.92k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
  |  Branch (2796:8): [True: 579, False: 2.92k]
  |  Branch (2796:58): [True: 2.30k, False: 625]
  ------------------
 2797|  2.88k|			return SF_FORMAT_AIFF ;
 2798|    625|		if (buffer [2] == MAKE_MARKER ('8', 'S', 'V', 'X') || buffer [2] == MAKE_MARKER ('1', '6', 'S', 'V'))
  ------------------
  |  |  122|  1.25k|	#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|    542|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
  |  Branch (2798:7): [True: 83, False: 542]
  |  Branch (2798:57): [True: 412, False: 130]
  ------------------
 2799|    495|			return SF_FORMAT_SVX ;
 2800|    130|		return 0 ;
 2801|  12.4k|		} ;
 2802|       |
 2803|  12.4k|	if (buffer [0] == MAKE_MARKER ('.', 's', 'n', 'd') || buffer [0] == MAKE_MARKER ('d', 'n', 's', '.'))
  ------------------
  |  |  122|  24.9k|	#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|  11.9k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
  |  Branch (2803:6): [True: 528, False: 11.9k]
  |  Branch (2803:56): [True: 739, False: 11.1k]
  ------------------
 2804|  1.26k|		return SF_FORMAT_AU ;
 2805|       |
 2806|  11.1k|	if ((buffer [0] == MAKE_MARKER ('f', 'a', 'p', ' ') || buffer [0] == MAKE_MARKER (' ', 'p', 'a', 'f')))
  ------------------
  |  |  122|  22.3k|	#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.1k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
  |  Branch (2806:7): [True: 14, False: 11.1k]
  |  Branch (2806:57): [True: 117, False: 11.0k]
  ------------------
 2807|    131|		return SF_FORMAT_PAF ;
 2808|       |
 2809|  11.0k|	if (buffer [0] == MAKE_MARKER ('N', 'I', 'S', 'T'))
  ------------------
  |  |  122|  11.0k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
  |  Branch (2809:6): [True: 102, False: 10.9k]
  ------------------
 2810|    102|		return SF_FORMAT_NIST ;
 2811|       |
 2812|  10.9k|	if (buffer [0] == MAKE_MARKER ('C', 'r', 'e', 'a') && buffer [1] == MAKE_MARKER ('t', 'i', 'v', 'e'))
  ------------------
  |  |  122|  21.9k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
              	if (buffer [0] == MAKE_MARKER ('C', 'r', 'e', 'a') && buffer [1] == MAKE_MARKER ('t', 'i', 'v', 'e'))
  ------------------
  |  |  122|    281|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
  |  Branch (2812:6): [True: 281, False: 10.6k]
  |  Branch (2812:56): [True: 246, False: 35]
  ------------------
 2813|    246|		return SF_FORMAT_VOC ;
 2814|       |
 2815|  10.7k|	if ((buffer [0] & MAKE_MARKER (0xFF, 0xFF, 0xF8, 0xFF)) == MAKE_MARKER (0x64, 0xA3, 0x00, 0x00) ||
  ------------------
  |  |  122|  10.7k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
              	if ((buffer [0] & MAKE_MARKER (0xFF, 0xFF, 0xF8, 0xFF)) == MAKE_MARKER (0x64, 0xA3, 0x00, 0x00) ||
  ------------------
  |  |  122|  21.4k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
  |  Branch (2815:6): [True: 196, False: 10.5k]
  ------------------
 2816|  10.5k|		(buffer [0] & MAKE_MARKER (0xFF, 0xF8, 0xFF, 0xFF)) == MAKE_MARKER (0x00, 0x00, 0xA3, 0x64))
  ------------------
  |  |  122|  10.5k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
              		(buffer [0] & MAKE_MARKER (0xFF, 0xF8, 0xFF, 0xFF)) == MAKE_MARKER (0x00, 0x00, 0xA3, 0x64))
  ------------------
  |  |  122|  10.5k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
  |  Branch (2816:3): [True: 97, False: 10.4k]
  ------------------
 2817|    293|		return SF_FORMAT_IRCAM ;
 2818|       |
 2819|  10.4k|	if (buffer [0] == MAKE_MARKER ('r', 'i', 'f', 'f'))
  ------------------
  |  |  122|  10.4k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
  |  Branch (2819:6): [True: 691, False: 9.72k]
  ------------------
 2820|    691|		return SF_FORMAT_W64 ;
 2821|       |
 2822|  9.72k|	if (buffer [0] == MAKE_MARKER (0, 0, 0x03, 0xE8) && buffer [1] == MAKE_MARKER (0, 0, 0, 1) &&
  ------------------
  |  |  122|  19.4k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
              	if (buffer [0] == MAKE_MARKER (0, 0, 0x03, 0xE8) && buffer [1] == MAKE_MARKER (0, 0, 0, 1) &&
  ------------------
  |  |  122|  9.91k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
  |  Branch (2822:6): [True: 190, False: 9.53k]
  |  Branch (2822:54): [True: 143, False: 47]
  ------------------
 2823|    143|								buffer [2] == MAKE_MARKER (0, 0, 0, 1))
  ------------------
  |  |  122|    143|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
  |  Branch (2823:9): [True: 107, False: 36]
  ------------------
 2824|    107|		return SF_FORMAT_MAT4 ;
 2825|       |
 2826|  9.62k|	if (buffer [0] == MAKE_MARKER (0, 0, 0, 0) && buffer [1] == MAKE_MARKER (1, 0, 0, 0) &&
  ------------------
  |  |  122|  19.2k|	#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.2k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
  |  Branch (2826:6): [True: 656, False: 8.96k]
  |  Branch (2826:48): [True: 580, False: 76]
  ------------------
 2827|    580|								buffer [2] == MAKE_MARKER (1, 0, 0, 0))
  ------------------
  |  |  122|    580|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
  |  Branch (2827:9): [True: 531, False: 49]
  ------------------
 2828|    531|		return SF_FORMAT_MAT4 ;
 2829|       |
 2830|  9.09k|	if (buffer [0] == MAKE_MARKER ('M', 'A', 'T', 'L') && buffer [1] == MAKE_MARKER ('A', 'B', ' ', '5'))
  ------------------
  |  |  122|  18.1k|	#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|    274|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
  |  Branch (2830:6): [True: 274, False: 8.81k]
  |  Branch (2830:56): [True: 247, False: 27]
  ------------------
 2831|    247|		return SF_FORMAT_MAT5 ;
 2832|       |
 2833|  8.84k|	if (buffer [0] == MAKE_MARKER ('P', 'V', 'F', '1'))
  ------------------
  |  |  122|  8.84k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
  |  Branch (2833:6): [True: 124, False: 8.71k]
  ------------------
 2834|    124|		return SF_FORMAT_PVF ;
 2835|       |
 2836|  8.71k|	if (buffer [0] == MAKE_MARKER ('E', 'x', 't', 'e') && buffer [1] == MAKE_MARKER ('n', 'd', 'e', 'd') &&
  ------------------
  |  |  122|  17.4k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
              	if (buffer [0] == MAKE_MARKER ('E', 'x', 't', 'e') && buffer [1] == MAKE_MARKER ('n', 'd', 'e', 'd') &&
  ------------------
  |  |  122|  8.96k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
  |  Branch (2836:6): [True: 250, False: 8.46k]
  |  Branch (2836:56): [True: 204, False: 46]
  ------------------
 2837|    204|								buffer [2] == MAKE_MARKER (' ', 'I', 'n', 's'))
  ------------------
  |  |  122|    204|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
  |  Branch (2837:9): [True: 184, False: 20]
  ------------------
 2838|    184|		return SF_FORMAT_XI ;
 2839|       |
 2840|  8.53k|	if (buffer [0] == MAKE_MARKER ('c', 'a', 'f', 'f') && buffer [2] == MAKE_MARKER ('d', 'e', 's', 'c'))
  ------------------
  |  |  122|  17.0k|	#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.42k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
  |  Branch (2840:6): [True: 2.42k, False: 6.11k]
  |  Branch (2840:56): [True: 2.37k, False: 48]
  ------------------
 2841|  2.37k|		return SF_FORMAT_CAF ;
 2842|       |
 2843|  6.16k|	if (buffer [0] == MAKE_MARKER ('O', 'g', 'g', 'S'))
  ------------------
  |  |  122|  6.16k|	#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.16k]
  ------------------
 2844|      1|		return SF_FORMAT_OGG ;
 2845|       |
 2846|  6.16k|	if (buffer [0] == MAKE_MARKER ('A', 'L', 'a', 'w') && buffer [1] == MAKE_MARKER ('S', 'o', 'u', 'n')
  ------------------
  |  |  122|  12.3k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
              	if (buffer [0] == MAKE_MARKER ('A', 'L', 'a', 'w') && buffer [1] == MAKE_MARKER ('S', 'o', 'u', 'n')
  ------------------
  |  |  122|  6.32k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
  |  Branch (2846:6): [True: 158, False: 6.00k]
  |  Branch (2846:56): [True: 113, False: 45]
  ------------------
 2847|    113|			&& buffer [2] == MAKE_MARKER ('d', 'F', 'i', 'l'))
  ------------------
  |  |  122|    113|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
  |  Branch (2847:7): [True: 76, False: 37]
  ------------------
 2848|     76|		return SF_FORMAT_WVE ;
 2849|       |
 2850|  6.08k|	if (buffer [0] == MAKE_MARKER ('D', 'i', 'a', 'm') && buffer [1] == MAKE_MARKER ('o', 'n', 'd', 'W')
  ------------------
  |  |  122|  12.1k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
              	if (buffer [0] == MAKE_MARKER ('D', 'i', 'a', 'm') && buffer [1] == MAKE_MARKER ('o', 'n', 'd', 'W')
  ------------------
  |  |  122|  6.16k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
  |  Branch (2850:6): [True: 80, False: 6.00k]
  |  Branch (2850:56): [True: 39, False: 41]
  ------------------
 2851|     39|			&& buffer [2] == MAKE_MARKER ('a', 'r', 'e', ' '))
  ------------------
  |  |  122|     39|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
  |  Branch (2851:7): [True: 1, False: 38]
  ------------------
 2852|      1|		return SF_FORMAT_DWD ;
 2853|       |
 2854|  6.08k|	if (buffer [0] == MAKE_MARKER ('L', 'M', '8', '9') || buffer [0] == MAKE_MARKER ('5', '3', 0, 0))
  ------------------
  |  |  122|  12.1k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
              	if (buffer [0] == MAKE_MARKER ('L', 'M', '8', '9') || buffer [0] == MAKE_MARKER ('5', '3', 0, 0))
  ------------------
  |  |  122|  6.08k|	#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.08k]
  |  Branch (2854:56): [True: 1, False: 6.08k]
  ------------------
 2855|      2|		return SF_FORMAT_TXW ;
 2856|       |
 2857|  6.08k|	if ((buffer [0] & MAKE_MARKER (0xFF, 0xFF, 0x80, 0xFF)) == MAKE_MARKER (0xF0, 0x7E, 0, 0x01))
  ------------------
  |  |  122|  6.08k|	#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.08k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
  |  Branch (2857:6): [True: 354, False: 5.72k]
  ------------------
 2858|    354|		return SF_FORMAT_SDS ;
 2859|       |
 2860|  5.72k|	if ((buffer [0] & MAKE_MARKER (0xFF, 0xFF, 0, 0)) == MAKE_MARKER (1, 4, 0, 0))
  ------------------
  |  |  122|  5.72k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
              	if ((buffer [0] & MAKE_MARKER (0xFF, 0xFF, 0, 0)) == MAKE_MARKER (1, 4, 0, 0))
  ------------------
  |  |  122|  5.72k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
  |  Branch (2860:6): [True: 12, False: 5.71k]
  ------------------
 2861|     12|		return SF_FORMAT_MPC2K ;
 2862|       |
 2863|  5.71k|	if (buffer [0] == MAKE_MARKER ('C', 'A', 'T', ' ') && buffer [2] == MAKE_MARKER ('R', 'E', 'X', '2'))
  ------------------
  |  |  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 ('C', 'A', 'T', ' ') && buffer [2] == MAKE_MARKER ('R', 'E', 'X', '2'))
  ------------------
  |  |  122|     21|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
  |  Branch (2863:6): [True: 21, False: 5.69k]
  |  Branch (2863:56): [True: 1, False: 20]
  ------------------
 2864|      1|		return SF_FORMAT_REX2 ;
 2865|       |
 2866|  5.71k|	if (buffer [0] == MAKE_MARKER (0x30, 0x26, 0xB2, 0x75) && buffer [1] == MAKE_MARKER (0x8E, 0x66, 0xCF, 0x11))
  ------------------
  |  |  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 (0x30, 0x26, 0xB2, 0x75) && buffer [1] == MAKE_MARKER (0x8E, 0x66, 0xCF, 0x11))
  ------------------
  |  |  122|     29|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
  |  Branch (2866:6): [True: 29, False: 5.68k]
  |  Branch (2866:60): [True: 1, False: 28]
  ------------------
 2867|      1|		return 0 /*-SF_FORMAT_WMA-*/ ;
 2868|       |
 2869|       |	/* HMM (Hidden Markov Model) Tool Kit. */
 2870|  5.71k|	if (buffer [2] == MAKE_MARKER (0, 2, 0, 0) && 2 * ((int64_t) BE2H_32 (buffer [0])) + 12 == psf->filelength)
  ------------------
  |  |  122|  11.4k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
              	if (buffer [2] == MAKE_MARKER (0, 2, 0, 0) && 2 * ((int64_t) BE2H_32 (buffer [0])) + 12 == psf->filelength)
  ------------------
  |  |  141|    487|	#define BE2H_32(x)			ENDSWAP_32 (x)
  |  |  ------------------
  |  |  |  |   35|    487|#define	ENDSWAP_32(x)		(bswap_32 (x))
  |  |  ------------------
  ------------------
  |  Branch (2870:6): [True: 487, False: 5.22k]
  |  Branch (2870:48): [True: 50, False: 437]
  ------------------
 2871|     50|		return SF_FORMAT_HTK ;
 2872|       |
 2873|  5.66k|	if (buffer [0] == MAKE_MARKER ('f', 'L', 'a', 'C'))
  ------------------
  |  |  122|  5.66k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
  |  Branch (2873:6): [True: 1, False: 5.66k]
  ------------------
 2874|      1|		return SF_FORMAT_FLAC ;
 2875|       |
 2876|  5.66k|	if (buffer [0] == MAKE_MARKER ('2', 'B', 'I', 'T'))
  ------------------
  |  |  122|  5.66k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
  |  Branch (2876:6): [True: 73, False: 5.59k]
  ------------------
 2877|     73|		return SF_FORMAT_AVR ;
 2878|       |
 2879|  5.59k|	if (buffer [0] == MAKE_MARKER ('R', 'F', '6', '4') && buffer [2] == MAKE_MARKER ('W', 'A', 'V', 'E'))
  ------------------
  |  |  122|  11.1k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
              	if (buffer [0] == MAKE_MARKER ('R', 'F', '6', '4') && buffer [2] == MAKE_MARKER ('W', 'A', 'V', 'E'))
  ------------------
  |  |  122|  2.01k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
  |  Branch (2879:6): [True: 2.01k, False: 3.57k]
  |  Branch (2879:56): [True: 1.98k, False: 34]
  ------------------
 2880|  1.98k|		return SF_FORMAT_RF64 ;
 2881|       |
 2882|  3.60k|	if (buffer [0] == MAKE_MARKER ('I', 'D', '3', 2) || buffer [0] == MAKE_MARKER ('I', 'D', '3', 3)
  ------------------
  |  |  122|  7.21k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
              	if (buffer [0] == MAKE_MARKER ('I', 'D', '3', 2) || buffer [0] == MAKE_MARKER ('I', 'D', '3', 3)
  ------------------
  |  |  122|  6.85k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
  |  Branch (2882:6): [True: 364, False: 3.24k]
  |  Branch (2882:54): [True: 806, False: 2.43k]
  ------------------
 2883|  2.43k|			|| buffer [0] == MAKE_MARKER ('I', 'D', '3', 4))
  ------------------
  |  |  122|  2.43k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
  |  Branch (2883:7): [True: 827, False: 1.61k]
  ------------------
 2884|  1.99k|	{	psf_log_printf (psf, "Found 'ID3' marker.\n") ;
 2885|  1.99k|		if (id3_skip (psf))
  ------------------
  |  Branch (2885:7): [True: 1.94k, False: 53]
  ------------------
 2886|  1.94k|			goto retry ;
 2887|     53|		return 0 ;
 2888|  1.99k|		} ;
 2889|       |
 2890|       |	/* ID3v2 tags + MPEG */
 2891|  1.61k|	if (psf->id3_header.len > 0 && (format = identify_mpeg (buffer [0])) != 0)
  ------------------
  |  Branch (2891:6): [True: 39, False: 1.57k]
  |  Branch (2891:33): [True: 3, False: 36]
  ------------------
 2892|      3|		return format ;
 2893|       |
 2894|       |	/* Turtle Beach SMP 16-bit */
 2895|  1.60k|	if (buffer [0] == MAKE_MARKER ('S', 'O', 'U', 'N') && buffer [1] == MAKE_MARKER ('D', ' ', 'S', 'A'))
  ------------------
  |  |  122|  3.21k|	#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|     35|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
  |  Branch (2895:6): [True: 35, False: 1.57k]
  |  Branch (2895:56): [True: 1, False: 34]
  ------------------
 2896|      1|		return 0 ;
 2897|       |
 2898|       |	/* Yamaha sampler format. */
 2899|  1.60k|	if (buffer [0] == MAKE_MARKER ('S', 'Y', '8', '0') || buffer [0] == MAKE_MARKER ('S', 'Y', '8', '5'))
  ------------------
  |  |  122|  3.21k|	#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.60k|	#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.60k]
  |  Branch (2899:56): [True: 1, False: 1.60k]
  ------------------
 2900|      2|		return 0 ;
 2901|       |
 2902|  1.60k|	if (buffer [0] == MAKE_MARKER ('a', 'j', 'k', 'g'))
  ------------------
  |  |  122|  1.60k|	#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.60k]
  ------------------
 2903|      1|		return 0 /*-SF_FORMAT_SHN-*/ ;
 2904|       |
 2905|       |	/* This must be (almost) the last one. */
 2906|  1.60k|	if (psf->filelength > 0 && (format = try_resource_fork (psf)) != 0)
  ------------------
  |  Branch (2906:6): [True: 1.60k, False: 0]
  |  Branch (2906:29): [True: 0, False: 1.60k]
  ------------------
 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.60k|	if (psf->id3_header.len == 0 && (format = identify_mpeg (buffer [0])) != 0)
  ------------------
  |  Branch (2912:6): [True: 1.56k, False: 36]
  |  Branch (2912:34): [True: 11, False: 1.55k]
  ------------------
 2913|     11|		return format ;
 2914|       |
 2915|  1.59k|	return 0 ;
 2916|  1.60k|} /* guess_file_type */
sndfile.c:identify_mpeg:
 2772|  1.60k|{	if ((marker & MAKE_MARKER (0xFF, 0xE0, 0, 0)) == MAKE_MARKER (0xFF, 0xE0, 0, 0) && /* Frame sync */
  ------------------
  |  |  122|  1.60k|	#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.21k|	#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.56k]
  ------------------
 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.65k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
  |  Branch (2773:3): [True: 44, False: 2]
  ------------------
 2774|     44|		(marker & MAKE_MARKER (0, 0x06, 0, 0)) != MAKE_MARKER (0, 0, 0, 0) && /* Valid layer description */
  ------------------
  |  |  122|     44|	#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.65k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
  |  Branch (2774:3): [True: 40, False: 4]
  ------------------
 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.64k|	#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.59k|	return 0 ;
 2779|  1.60k|} /* identify_mpeg */
sndfile.c:try_resource_fork:
 2689|  1.60k|{	int old_error = psf->error ;
 2690|       |
 2691|       |	/* Set READ mode now, to see if resource fork exists. */
 2692|  1.60k|	psf->rsrc.mode = SFM_READ ;
 2693|  1.60k|	if (psf_open_rsrc (psf) != 0)
  ------------------
  |  Branch (2693:6): [True: 1.60k, False: 0]
  ------------------
 2694|  1.60k|	{	psf->error = old_error ;
 2695|  1.60k|		return 0 ;
 2696|  1.60k|		} ;
 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.60k|} /* try_resource_fork */
sndfile.c:format_from_extension:
 2706|  1.84k|{	char *cptr ;
 2707|  1.84k|	char buffer [16] ;
 2708|  1.84k|	int format = 0 ;
 2709|       |
 2710|  1.84k|	if ((cptr = strrchr (psf->file.name, '.')) == NULL)
  ------------------
  |  Branch (2710:6): [True: 1.84k, False: 0]
  ------------------
 2711|  1.84k|		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.98k|{	if (sfinfo->samplerate < 1)
  ------------------
  |  Branch (2921:7): [True: 802, False: 4.18k]
  ------------------
 2922|    802|		return 0 ;
 2923|  4.18k|	if (sfinfo->frames < 0)
  ------------------
  |  Branch (2923:6): [True: 175, False: 4.01k]
  ------------------
 2924|    175|		return 0 ;
 2925|  4.01k|	if ((sfinfo->channels < 1) || (sfinfo->channels > SF_MAX_CHANNELS))
  ------------------
  |  |  102|  3.94k|#define		SF_MAX_CHANNELS		1024
  ------------------
  |  Branch (2925:6): [True: 71, False: 3.94k]
  |  Branch (2925:32): [True: 32, False: 3.90k]
  ------------------
 2926|    103|		return 0 ;
 2927|  3.90k|	if ((SF_CONTAINER (sfinfo->format)) == 0)
  ------------------
  |  |  108|  3.90k|#define SF_CONTAINER(x)		((x) & SF_FORMAT_TYPEMASK)
  ------------------
  |  Branch (2927:6): [True: 0, False: 3.90k]
  ------------------
 2928|      0|		return 0 ;
 2929|  3.90k|	if ((SF_CODEC (sfinfo->format)) == 0)
  ------------------
  |  |  109|  3.90k|#define SF_CODEC(x)			((x) & SF_FORMAT_SUBMASK)
  ------------------
  |  Branch (2929:6): [True: 18, False: 3.89k]
  ------------------
 2930|     18|		return 0 ;
 2931|  3.89k|	if (sfinfo->sections < 1)
  ------------------
  |  Branch (2931:6): [True: 0, False: 3.89k]
  ------------------
 2932|      0|		return 0 ;
 2933|  3.89k|	return 1 ;
 2934|  3.89k|} /* validate_sfinfo */
sndfile.c:save_header_info:
 2957|  1.88k|{	snprintf (sf_parselog, sizeof (sf_parselog), "%s", psf->parselog.buf) ;
 2958|  1.88k|} /* save_header_info */
sndfile.c:validate_psf:
 2938|  3.89k|{
 2939|  3.89k|	if (psf->datalength < 0)
  ------------------
  |  Branch (2939:6): [True: 255, False: 3.63k]
  ------------------
 2940|    255|	{	psf_log_printf (psf, "Invalid SF_PRIVATE field : datalength == %D.\n", psf->datalength) ;
 2941|    255|		return 0 ;
 2942|  3.63k|		} ;
 2943|  3.63k|	if (psf->dataoffset < 0)
  ------------------
  |  Branch (2943:6): [True: 470, False: 3.16k]
  ------------------
 2944|    470|	{	psf_log_printf (psf, "Invalid SF_PRIVATE field : dataoffset == %D.\n", psf->dataoffset) ;
 2945|    470|		return 0 ;
 2946|  3.16k|		} ;
 2947|  3.16k|	if (psf->blockwidth && psf->blockwidth != psf->sf.channels * psf->bytewidth)
  ------------------
  |  Branch (2947:6): [True: 885, False: 2.28k]
  |  Branch (2947:25): [True: 62, False: 823]
  ------------------
 2948|     62|	{	psf_log_printf (psf, "Invalid SF_PRIVATE field : channels * bytewidth == %d.\n",
 2949|     62|								psf->sf.channels * psf->bytewidth) ;
 2950|     62|		return 0 ;
 2951|  3.10k|		} ;
 2952|  3.10k|	return 1 ;
 2953|  3.16k|} /* validate_psf */

psf_store_string:
   32|  25.4k|{	char	new_str [128] ;
   33|  25.4k|	size_t	str_len ;
   34|  25.4k|	int		k, str_flags ;
   35|       |
   36|  25.4k|	if (str == NULL)
  ------------------
  |  Branch (36:6): [True: 0, False: 25.4k]
  ------------------
   37|      0|		return SFE_STR_BAD_STRING ;
   38|       |
   39|  25.4k|	str_len = strlen (str) ;
   40|       |
   41|       |	/* A few extra checks for write mode. */
   42|  25.4k|	if (psf->file.mode == SFM_WRITE || psf->file.mode == SFM_RDWR)
  ------------------
  |  Branch (42:6): [True: 0, False: 25.4k]
  |  Branch (42:37): [True: 0, False: 25.4k]
  ------------------
   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|  25.4k|		} ;
   51|       |
   52|       |	/* Find the next free slot in table. */
   53|   751k|	for (k = 0 ; k < SF_MAX_STRINGS ; k++)
  ------------------
  |  |   80|   751k|#define SF_MAX_STRINGS			(32)
  ------------------
  |  Branch (53:15): [True: 730k, False: 21.1k]
  ------------------
   54|   730k|	{	/* If we find a matching entry clear it. */
   55|   730k|		if (psf->strings.data [k].type == str_type)
  ------------------
  |  Branch (55:7): [True: 3.75k, False: 726k]
  ------------------
   56|  3.75k|			psf->strings.data [k].type = -1 ;
   57|       |
   58|   730k|		if (psf->strings.data [k].type == 0)
  ------------------
  |  Branch (58:7): [True: 4.30k, False: 725k]
  ------------------
   59|  4.30k|			break ;
   60|   730k|		} ;
   61|       |
   62|       |	/* Determine flags */
   63|  25.4k|	str_flags = SF_STR_LOCATE_START ;
   64|  25.4k|	if (psf->file.mode == SFM_RDWR || psf->have_written)
  ------------------
  |  Branch (64:6): [True: 0, False: 25.4k]
  |  Branch (64:36): [True: 0, False: 25.4k]
  ------------------
   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|  25.4k|		} ;
   69|       |
   70|       |	/* More sanity checking. */
   71|  25.4k|	if (k >= SF_MAX_STRINGS)
  ------------------
  |  |   80|  25.4k|#define SF_MAX_STRINGS			(32)
  ------------------
  |  Branch (71:6): [True: 21.1k, False: 4.30k]
  ------------------
   72|  21.1k|		return SFE_STR_MAX_COUNT ;
   73|       |
   74|  4.30k|	if (k == 0 && psf->strings.storage_used != 0)
  ------------------
  |  Branch (74:6): [True: 496, False: 3.80k]
  |  Branch (74:16): [True: 0, False: 496]
  ------------------
   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.30k|		} ;
   78|       |
   79|  4.30k|	if (k != 0 && psf->strings.storage_used == 0)
  ------------------
  |  Branch (79:6): [True: 3.80k, False: 496]
  |  Branch (79:16): [True: 0, False: 3.80k]
  ------------------
   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.30k|		} ;
   83|       |
   84|       |	/* Special case for the first string. */
   85|  4.30k|	if (k == 0)
  ------------------
  |  Branch (85:6): [True: 496, False: 3.80k]
  ------------------
   86|    496|		psf->strings.storage_used = 0 ;
   87|       |
   88|  4.30k|	switch (str_type)
   89|  4.30k|	{	case SF_STR_SOFTWARE :
  ------------------
  |  Branch (89:4): [True: 729, False: 3.57k]
  ------------------
   90|       |				/* In write mode, want to append libsndfile-version to string. */
   91|    729|				if (psf->file.mode == SFM_WRITE || psf->file.mode == SFM_RDWR)
  ------------------
  |  Branch (91:9): [True: 0, False: 729]
  |  Branch (91:40): [True: 0, False: 729]
  ------------------
   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|    729|				break ;
  108|       |
  109|    733|		case SF_STR_TITLE :
  ------------------
  |  Branch (109:3): [True: 733, False: 3.56k]
  ------------------
  110|  1.22k|		case SF_STR_COPYRIGHT :
  ------------------
  |  Branch (110:3): [True: 488, False: 3.81k]
  ------------------
  111|  1.68k|		case SF_STR_ARTIST :
  ------------------
  |  Branch (111:3): [True: 467, False: 3.83k]
  ------------------
  112|  2.33k|		case SF_STR_COMMENT :
  ------------------
  |  Branch (112:3): [True: 648, False: 3.65k]
  ------------------
  113|  2.59k|		case SF_STR_DATE :
  ------------------
  |  Branch (113:3): [True: 258, False: 4.04k]
  ------------------
  114|  2.91k|		case SF_STR_ALBUM :
  ------------------
  |  Branch (114:3): [True: 319, False: 3.98k]
  ------------------
  115|  3.01k|		case SF_STR_LICENSE :
  ------------------
  |  Branch (115:3): [True: 106, False: 4.19k]
  ------------------
  116|  3.24k|		case SF_STR_TRACKNUMBER :
  ------------------
  |  Branch (116:3): [True: 227, False: 4.07k]
  ------------------
  117|  3.57k|		case SF_STR_GENRE :
  ------------------
  |  Branch (117:3): [True: 326, False: 3.97k]
  ------------------
  118|  3.57k|				break ;
  119|       |
  120|      0|		default :
  ------------------
  |  Branch (120:3): [True: 0, False: 4.30k]
  ------------------
  121|      0|			psf_log_printf (psf, "%s : SFE_STR_BAD_TYPE\n", __func__) ;
  122|      0|			return SFE_STR_BAD_TYPE ;
  123|  4.30k|		} ;
  124|       |
  125|       |	/* Plus one to catch string terminator. */
  126|  4.30k|	str_len = strlen (str) + 1 ;
  127|       |
  128|  4.30k|	if (psf->strings.storage_used + str_len + 1 > psf->strings.storage_len)
  ------------------
  |  Branch (128:6): [True: 531, False: 3.77k]
  ------------------
  129|    531|	{	char * temp = psf->strings.storage ;
  130|    531|		size_t newlen = 2 * psf->strings.storage_len + str_len + 1 ;
  131|       |
  132|    531|		newlen = newlen < 256 ? 256 : newlen ;
  ------------------
  |  Branch (132:12): [True: 479, False: 52]
  ------------------
  133|       |
  134|    531|		char * new_storage = realloc(temp, newlen);
  135|    531|		if (new_storage == NULL)
  ------------------
  |  Branch (135:7): [True: 0, False: 531]
  ------------------
  136|      0|		{
  137|      0|			return SFE_MALLOC_FAILED ;
  138|    531|			} else {
  139|    531|			psf->strings.storage = new_storage;
  140|    531|			} ;
  141|       |
  142|    531|		psf->strings.storage_len = newlen ;
  143|  4.30k|		} ;
  144|       |
  145|  4.30k|	psf->strings.data [k].type = str_type ;
  146|  4.30k|	psf->strings.data [k].offset = psf->strings.storage_used ;
  147|  4.30k|	psf->strings.data [k].flags = str_flags ;
  148|       |
  149|  4.30k|	memcpy (psf->strings.storage + psf->strings.storage_used, str, str_len) ;
  150|  4.30k|	psf->strings.storage_used += str_len ;
  151|       |
  152|  4.30k|	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.30k|	return 0 ;
  160|  4.30k|} /* psf_store_string */

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

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

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

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

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

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

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

