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

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

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

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

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

unpc_block:
   56|  6.81k|{
   57|  6.81k|	register int16_t	a0, a1, a2, a3 ;
   58|  6.81k|	register int32_t	b0, b1, b2, b3 ;
   59|  6.81k|	int32_t					j, k, lim ;
   60|  6.81k|	int32_t				sum1, sg, sgn, top, dd ;
   61|  6.81k|	int32_t *			pout ;
   62|  6.81k|	int32_t				del, del0 ;
   63|  6.81k|	uint32_t			chanshift = 32 - chanbits ;
   64|  6.81k|	int32_t				denhalf = denshift ? 1 << (denshift - 1) : 0 ;
  ------------------
  |  Branch (64:23): [True: 1.22k, False: 5.59k]
  ------------------
   65|       |
   66|  6.81k|	out [0] = pc1 [0] ;
   67|  6.81k|	if (numactive == 0)
  ------------------
  |  Branch (67:6): [True: 4.35k, False: 2.46k]
  ------------------
   68|  4.35k|	{
   69|       |		// just copy if numactive == 0 (but don't bother if in/out pointers the same)
   70|  4.35k|		if ((num > 1) && (pc1 != out))
  ------------------
  |  Branch (70:7): [True: 1.82k, False: 2.53k]
  |  Branch (70:20): [True: 1.82k, False: 0]
  ------------------
   71|  1.82k|			memcpy (&out [1], &pc1 [1], (num - 1) * sizeof (int32_t)) ;
   72|  4.35k|		return ;
   73|  4.35k|	}
   74|  2.46k|	if (numactive == 31)
  ------------------
  |  Branch (74:6): [True: 1.34k, False: 1.11k]
  ------------------
   75|  1.34k|	{
   76|       |		// short-circuit if numactive == 31
   77|  1.34k|		int32_t		prev ;
   78|       |
   79|       |		/*	this code is written such that the in/out buffers can be the same
   80|       |			to conserve buffer space on embedded devices like the iPod
   81|       |
   82|       |			(original code)
   83|       |			for (j = 1 ; j < num ; j++)
   84|       |				del = pc1 [j] + out [j-1] ;
   85|       |				out [j] = (del << chanshift) >> chanshift ;
   86|       |		*/
   87|  1.34k|		prev = out [0] ;
   88|  53.6k|		for (j = 1 ; j < num ; j++)
  ------------------
  |  Branch (88:16): [True: 52.3k, False: 1.34k]
  ------------------
   89|  52.3k|		{
   90|  52.3k|			del = pc1 [j] + prev ;
   91|  52.3k|			prev = (del << chanshift) >> chanshift ;
   92|  52.3k|			out [j] = prev ;
   93|  52.3k|		}
   94|  1.34k|		return ;
   95|  1.34k|	}
   96|       |
   97|  9.99k|	for (j = 1 ; j <= numactive ; j++)
  ------------------
  |  Branch (97:15): [True: 8.87k, False: 1.11k]
  ------------------
   98|  8.87k|	{
   99|  8.87k|		del = pc1 [j] + out [j-1] ;
  100|  8.87k|		out [j] = arith_shift_left (del, chanshift) >> chanshift ;
  101|  8.87k|	}
  102|       |
  103|  1.11k|	lim = numactive + 1 ;
  104|       |
  105|  1.11k|	if (numactive == 4)
  ------------------
  |  Branch (105:6): [True: 194, False: 924]
  ------------------
  106|    194|	{
  107|       |		// optimization for numactive == 4
  108|    194|		register int16_t	ia0, ia1, ia2, ia3 ;
  109|    194|		register int32_t	ib0, ib1, ib2, ib3 ;
  110|       |
  111|    194|		ia0 = coefs [0] ;
  112|    194|		ia1 = coefs [1] ;
  113|    194|		ia2 = coefs [2] ;
  114|    194|		ia3 = coefs [3] ;
  115|       |
  116|  9.35k|		for (j = lim ; j < num ; j++)
  ------------------
  |  Branch (116:18): [True: 9.16k, False: 194]
  ------------------
  117|  9.16k|		{
  118|  9.16k|			LOOP_ALIGN
  119|       |
  120|  9.16k|			top = out [j - lim] ;
  121|  9.16k|			pout = out + j - 1 ;
  122|       |
  123|  9.16k|			ib0 = top - pout [0] ;
  124|  9.16k|			ib1 = top - pout [-1] ;
  125|  9.16k|			ib2 = top - pout [-2] ;
  126|  9.16k|			ib3 = top - pout [-3] ;
  127|       |
  128|  9.16k|			sum1 = (denhalf - ia0 * ib0 - ia1 * ib1 - ia2 * ib2 - ia3 * ib3) >> denshift ;
  129|       |
  130|  9.16k|			del = pc1 [j] ;
  131|  9.16k|			del0 = del ;
  132|  9.16k|			sg = sign_of_int (del) ;
  133|  9.16k|			del += top + sum1 ;
  134|       |
  135|  9.16k|			out [j] = arith_shift_left (del, chanshift) >> chanshift ;
  136|       |
  137|  9.16k|			if (sg > 0)
  ------------------
  |  Branch (137:8): [True: 3.07k, False: 6.08k]
  ------------------
  138|  3.07k|			{
  139|  3.07k|				sgn = sign_of_int (ib3) ;
  140|  3.07k|				ia3 -= sgn ;
  141|  3.07k|				del0 -= (4 - 3) * ((sgn * ib3) >> denshift) ;
  142|  3.07k|				if (del0 <= 0)
  ------------------
  |  Branch (142:9): [True: 668, False: 2.40k]
  ------------------
  143|    668|					continue ;
  144|       |
  145|  2.40k|				sgn = sign_of_int (ib2) ;
  146|  2.40k|				ia2 -= sgn ;
  147|  2.40k|				del0 -= (4 - 2) * ((sgn * ib2) >> denshift) ;
  148|  2.40k|				if (del0 <= 0)
  ------------------
  |  Branch (148:9): [True: 643, False: 1.76k]
  ------------------
  149|    643|					continue ;
  150|       |
  151|  1.76k|				sgn = sign_of_int (ib1) ;
  152|  1.76k|				ia1 -= sgn ;
  153|  1.76k|				del0 -= (4 - 1) * ((sgn * ib1) >> denshift) ;
  154|  1.76k|				if (del0 <= 0)
  ------------------
  |  Branch (154:9): [True: 427, False: 1.33k]
  ------------------
  155|    427|					continue ;
  156|       |
  157|  1.33k|				ia0 -= sign_of_int (ib0) ;
  158|  1.33k|			}
  159|  6.08k|			else if (sg < 0)
  ------------------
  |  Branch (159:13): [True: 4.81k, False: 1.27k]
  ------------------
  160|  4.81k|			{
  161|       |				// note: to avoid unnecessary negations, we flip the value of "sgn"
  162|  4.81k|				sgn = -sign_of_int (ib3) ;
  163|  4.81k|				ia3 -= sgn ;
  164|  4.81k|				del0 -= (4 - 3) * ((sgn * ib3) >> denshift) ;
  165|  4.81k|				if (del0 >= 0)
  ------------------
  |  Branch (165:9): [True: 2.95k, False: 1.85k]
  ------------------
  166|  2.95k|					continue ;
  167|       |
  168|  1.85k|				sgn = -sign_of_int (ib2) ;
  169|  1.85k|				ia2 -= sgn ;
  170|  1.85k|				del0 -= (4 - 2) * ((sgn * ib2) >> denshift) ;
  171|  1.85k|				if (del0 >= 0)
  ------------------
  |  Branch (171:9): [True: 607, False: 1.25k]
  ------------------
  172|    607|					continue ;
  173|       |
  174|  1.25k|				sgn = -sign_of_int (ib1) ;
  175|  1.25k|				ia1 -= sgn ;
  176|  1.25k|				del0 -= (4 - 1) * ((sgn * ib1) >> denshift) ;
  177|  1.25k|				if (del0 >= 0)
  ------------------
  |  Branch (177:9): [True: 422, False: 830]
  ------------------
  178|    422|					continue ;
  179|       |
  180|    830|				ia0 += sign_of_int (ib0) ;
  181|    830|			}
  182|  9.16k|		}
  183|       |
  184|    194|		coefs [0] = ia0 ;
  185|    194|		coefs [1] = ia1 ;
  186|    194|		coefs [2] = ia2 ;
  187|    194|		coefs [3] = ia3 ;
  188|    194|	}
  189|    924|	else if (numactive == 8)
  ------------------
  |  Branch (189:11): [True: 181, False: 743]
  ------------------
  190|    181|	{
  191|    181|		register int16_t	a4, a5, a6, a7 ;
  192|    181|		register int32_t	b4, b5, b6, b7 ;
  193|       |
  194|       |		// optimization for numactive == 8
  195|    181|		a0 = coefs [0] ;
  196|    181|		a1 = coefs [1] ;
  197|    181|		a2 = coefs [2] ;
  198|    181|		a3 = coefs [3] ;
  199|    181|		a4 = coefs [4] ;
  200|    181|		a5 = coefs [5] ;
  201|    181|		a6 = coefs [6] ;
  202|    181|		a7 = coefs [7] ;
  203|       |
  204|  14.1k|		for (j = lim ; j < num ; j++)
  ------------------
  |  Branch (204:18): [True: 14.0k, False: 181]
  ------------------
  205|  14.0k|		{
  206|  14.0k|			LOOP_ALIGN
  207|       |
  208|  14.0k|			top = out [j - lim] ;
  209|  14.0k|			pout = out + j - 1 ;
  210|       |
  211|  14.0k|			b0 = top - (*pout--) ;
  212|  14.0k|			b1 = top - (*pout--) ;
  213|  14.0k|			b2 = top - (*pout--) ;
  214|  14.0k|			b3 = top - (*pout--) ;
  215|  14.0k|			b4 = top - (*pout--) ;
  216|  14.0k|			b5 = top - (*pout--) ;
  217|  14.0k|			b6 = top - (*pout--) ;
  218|  14.0k|			b7 = top - (*pout) ;
  219|  14.0k|			pout += 8 ;
  220|       |
  221|  14.0k|			sum1 = (denhalf - a0 * b0 - a1 * b1 - a2 * b2 - a3 * b3
  222|  14.0k|					- a4 * b4 - a5 * b5 - a6 * b6 - a7 * b7) >> denshift ;
  223|       |
  224|  14.0k|			del = pc1 [j] ;
  225|  14.0k|			del0 = del ;
  226|  14.0k|			sg = sign_of_int (del) ;
  227|  14.0k|			del += top + sum1 ;
  228|       |
  229|  14.0k|			out [j] = arith_shift_left (del, chanshift) >> chanshift ;
  230|       |
  231|  14.0k|			if (sg > 0)
  ------------------
  |  Branch (231:8): [True: 5.13k, False: 8.87k]
  ------------------
  232|  5.13k|			{
  233|  5.13k|				sgn = sign_of_int (b7) ;
  234|  5.13k|				a7 -= sgn ;
  235|  5.13k|				del0 -= 1 * ((sgn * b7) >> denshift) ;
  236|  5.13k|				if (del0 <= 0)
  ------------------
  |  Branch (236:9): [True: 656, False: 4.48k]
  ------------------
  237|    656|					continue ;
  238|       |
  239|  4.48k|				sgn = sign_of_int (b6) ;
  240|  4.48k|				a6 -= sgn ;
  241|  4.48k|				del0 -= 2 * ((sgn * b6) >> denshift) ;
  242|  4.48k|				if (del0 <= 0)
  ------------------
  |  Branch (242:9): [True: 416, False: 4.06k]
  ------------------
  243|    416|					continue ;
  244|       |
  245|  4.06k|				sgn = sign_of_int (b5) ;
  246|  4.06k|				a5 -= sgn ;
  247|  4.06k|				del0 -= 3 * ((sgn * b5) >> denshift) ;
  248|  4.06k|				if (del0 <= 0)
  ------------------
  |  Branch (248:9): [True: 410, False: 3.65k]
  ------------------
  249|    410|					continue ;
  250|       |
  251|  3.65k|				sgn = sign_of_int (b4) ;
  252|  3.65k|				a4 -= sgn ;
  253|  3.65k|				del0 -= 4 * ((sgn * b4) >> denshift) ;
  254|  3.65k|				if (del0 <= 0)
  ------------------
  |  Branch (254:9): [True: 467, False: 3.18k]
  ------------------
  255|    467|					continue ;
  256|       |
  257|  3.18k|				sgn = sign_of_int (b3) ;
  258|  3.18k|				a3 -= sgn ;
  259|  3.18k|				del0 -= 5 * ((sgn * b3) >> denshift) ;
  260|  3.18k|				if (del0 <= 0)
  ------------------
  |  Branch (260:9): [True: 598, False: 2.59k]
  ------------------
  261|    598|					continue ;
  262|       |
  263|  2.59k|				sgn = sign_of_int (b2) ;
  264|  2.59k|				a2 -= sgn ;
  265|  2.59k|				del0 -= 6 * ((sgn * b2) >> denshift) ;
  266|  2.59k|				if (del0 <= 0)
  ------------------
  |  Branch (266:9): [True: 403, False: 2.18k]
  ------------------
  267|    403|					continue ;
  268|       |
  269|  2.18k|				sgn = sign_of_int (b1) ;
  270|  2.18k|				a1 -= sgn ;
  271|  2.18k|				del0 -= 7 * ((sgn * b1) >> denshift) ;
  272|  2.18k|				if (del0 <= 0)
  ------------------
  |  Branch (272:9): [True: 384, False: 1.80k]
  ------------------
  273|    384|					continue ;
  274|       |
  275|  1.80k|				a0 -= sign_of_int (b0) ;
  276|  1.80k|			}
  277|  8.87k|			else if (sg < 0)
  ------------------
  |  Branch (277:13): [True: 7.94k, False: 936]
  ------------------
  278|  7.94k|			{
  279|       |				// note: to avoid unnecessary negations, we flip the value of "sgn"
  280|  7.94k|				sgn = -sign_of_int (b7) ;
  281|  7.94k|				a7 -= sgn ;
  282|  7.94k|				del0 -= 1 * ((sgn * b7) >> denshift) ;
  283|  7.94k|				if (del0 >= 0)
  ------------------
  |  Branch (283:9): [True: 2.96k, False: 4.97k]
  ------------------
  284|  2.96k|					continue ;
  285|       |
  286|  4.97k|				sgn = -sign_of_int (b6) ;
  287|  4.97k|				a6 -= sgn ;
  288|  4.97k|				del0 -= 2 * ((sgn * b6) >> denshift) ;
  289|  4.97k|				if (del0 >= 0)
  ------------------
  |  Branch (289:9): [True: 420, False: 4.55k]
  ------------------
  290|    420|					continue ;
  291|       |
  292|  4.55k|				sgn = -sign_of_int (b5) ;
  293|  4.55k|				a5 -= sgn ;
  294|  4.55k|				del0 -= 3 * ((sgn * b5) >> denshift) ;
  295|  4.55k|				if (del0 >= 0)
  ------------------
  |  Branch (295:9): [True: 567, False: 3.99k]
  ------------------
  296|    567|					continue ;
  297|       |
  298|  3.99k|				sgn = -sign_of_int (b4) ;
  299|  3.99k|				a4 -= sgn ;
  300|  3.99k|				del0 -= 4 * ((sgn * b4) >> denshift) ;
  301|  3.99k|				if (del0 >= 0)
  ------------------
  |  Branch (301:9): [True: 513, False: 3.47k]
  ------------------
  302|    513|					continue ;
  303|       |
  304|  3.47k|				sgn = -sign_of_int (b3) ;
  305|  3.47k|				a3 -= sgn ;
  306|  3.47k|				del0 -= 5 * ((sgn * b3) >> denshift) ;
  307|  3.47k|				if (del0 >= 0)
  ------------------
  |  Branch (307:9): [True: 477, False: 3.00k]
  ------------------
  308|    477|					continue ;
  309|       |
  310|  3.00k|				sgn = -sign_of_int (b2) ;
  311|  3.00k|				a2 -= sgn ;
  312|  3.00k|				del0 -= 6 * ((sgn * b2) >> denshift) ;
  313|  3.00k|				if (del0 >= 0)
  ------------------
  |  Branch (313:9): [True: 563, False: 2.43k]
  ------------------
  314|    563|					continue ;
  315|       |
  316|  2.43k|				sgn = -sign_of_int (b1) ;
  317|  2.43k|				a1 -= sgn ;
  318|  2.43k|				del0 -= 7 * ((sgn * b1) >> denshift) ;
  319|  2.43k|				if (del0 >= 0)
  ------------------
  |  Branch (319:9): [True: 441, False: 1.99k]
  ------------------
  320|    441|					continue ;
  321|       |
  322|  1.99k|				a0 += sign_of_int (b0) ;
  323|  1.99k|			}
  324|  14.0k|		}
  325|       |
  326|    181|		coefs [0] = a0 ;
  327|    181|		coefs [1] = a1 ;
  328|    181|		coefs [2] = a2 ;
  329|    181|		coefs [3] = a3 ;
  330|    181|		coefs [4] = a4 ;
  331|    181|		coefs [5] = a5 ;
  332|    181|		coefs [6] = a6 ;
  333|    181|		coefs [7] = a7 ;
  334|    181|	}
  335|    743|	else
  336|    743|	{
  337|       |		// general case
  338|  20.1k|		for (j = lim ; j < num ; j++)
  ------------------
  |  Branch (338:18): [True: 19.4k, False: 743]
  ------------------
  339|  19.4k|		{
  340|  19.4k|			LOOP_ALIGN
  341|       |
  342|  19.4k|			sum1 = 0 ;
  343|  19.4k|			pout = out + j - 1 ;
  344|  19.4k|			top = out [j-lim] ;
  345|       |
  346|   332k|			for (k = 0 ; k < numactive ; k++)
  ------------------
  |  Branch (346:17): [True: 313k, False: 19.4k]
  ------------------
  347|   313k|				sum1 += coefs [k] * (pout [-k] - top) ;
  348|       |
  349|  19.4k|			del = pc1 [j] ;
  350|  19.4k|			del0 = del ;
  351|  19.4k|			sg = sign_of_int (del) ;
  352|  19.4k|			del += top + ((sum1 + denhalf) >> denshift) ;
  353|  19.4k|			out [j] = (del << chanshift) >> chanshift ;
  354|       |
  355|  19.4k|			if (sg > 0)
  ------------------
  |  Branch (355:8): [True: 10.6k, False: 8.75k]
  ------------------
  356|  10.6k|			{
  357|   206k|				for (k = (numactive - 1) ; k >= 0 ; k--)
  ------------------
  |  Branch (357:32): [True: 196k, False: 9.38k]
  ------------------
  358|   196k|				{
  359|   196k|					dd = top - pout [-k] ;
  360|   196k|					sgn = sign_of_int (dd) ;
  361|   196k|					coefs [k] -= sgn ;
  362|   196k|					del0 -= (numactive - k) * ((sgn * dd) >> denshift) ;
  363|   196k|					if (del0 <= 0)
  ------------------
  |  Branch (363:10): [True: 1.28k, False: 195k]
  ------------------
  364|  1.28k|						break ;
  365|   196k|				}
  366|  10.6k|			}
  367|  8.75k|			else if (sg < 0)
  ------------------
  |  Branch (367:13): [True: 6.76k, False: 1.98k]
  ------------------
  368|  6.76k|			{
  369|  89.4k|				for (k = (numactive - 1) ; k >= 0 ; k--)
  ------------------
  |  Branch (369:32): [True: 85.5k, False: 3.88k]
  ------------------
  370|  85.5k|				{
  371|  85.5k|					dd = top - pout [-k] ;
  372|  85.5k|					sgn = sign_of_int (dd) ;
  373|  85.5k|					coefs [k] += sgn ;
  374|  85.5k|					del0 -= (numactive - k) * ((-sgn * dd) >> denshift) ;
  375|  85.5k|					if (del0 >= 0)
  ------------------
  |  Branch (375:10): [True: 2.88k, False: 82.6k]
  ------------------
  376|  2.88k|						break ;
  377|  85.5k|				}
  378|  6.76k|			}
  379|  19.4k|		}
  380|    743|	}
  381|  1.11k|}
dp_dec.c:sign_of_int:
   47|   401k|{
   48|   401k|	int32_t negishift ;
   49|       |
   50|   401k|	negishift = ((uint32_t) - i) >> 31 ;
   51|   401k|	return negishift | (i >> 31) ;
   52|   401k|}

unmix16:
   66|    114|{
   67|    114|	int32_t 	j ;
   68|       |
   69|    114|	if (mixres != 0)
  ------------------
  |  Branch (69:6): [True: 53, False: 61]
  ------------------
   70|     53|	{
   71|       |		/* matrixed stereo */
   72|    776|		for (j = 0 ; j < numSamples ; j++)
  ------------------
  |  Branch (72:16): [True: 723, False: 53]
  ------------------
   73|    723|		{
   74|    723|			int32_t		l, r ;
   75|       |
   76|    723|			l = u [j] + v [j] - ((mixres * v [j]) >> mixbits) ;
   77|    723|			r = l - v [j] ;
   78|       |
   79|    723|			out [0] = arith_shift_left (l, 16) ;
   80|    723|			out [1] = arith_shift_left (r, 16) ;
   81|    723|			out += stride ;
   82|    723|		}
   83|     53|	}
   84|     61|	else
   85|     61|	{
   86|       |		/* Conventional separated stereo. */
   87|  2.67k|		for (j = 0 ; j < numSamples ; j++)
  ------------------
  |  Branch (87:16): [True: 2.61k, False: 61]
  ------------------
   88|  2.61k|		{
   89|  2.61k|			out [0] = arith_shift_left (u [j], 16) ;
   90|  2.61k|			out [1] = arith_shift_left (v [j], 16) ;
   91|  2.61k|			out += stride ;
   92|  2.61k|		}
   93|     61|	}
   94|    114|}
unmix20:
  101|     67|{
  102|     67|	int32_t 	j ;
  103|       |
  104|     67|	if (mixres != 0)
  ------------------
  |  Branch (104:6): [True: 34, False: 33]
  ------------------
  105|     34|	{
  106|       |		/* matrixed stereo */
  107|    650|		for (j = 0 ; j < numSamples ; j++)
  ------------------
  |  Branch (107:16): [True: 616, False: 34]
  ------------------
  108|    616|		{
  109|    616|			int32_t		l, r ;
  110|       |
  111|    616|			l = u [j] + v [j] - ((mixres * v [j]) >> mixbits) ;
  112|    616|			r = l - v [j] ;
  113|       |
  114|    616|			out [0] = arith_shift_left (l, 12) ;
  115|    616|			out [1] = arith_shift_left (r, 12) ;
  116|    616|			out += stride ;
  117|    616|		}
  118|     34|	}
  119|     33|	else
  120|     33|	{
  121|       |		/* Conventional separated stereo. */
  122|  1.04k|		for (j = 0 ; j < numSamples ; j++)
  ------------------
  |  Branch (122:16): [True: 1.01k, False: 33]
  ------------------
  123|  1.01k|		{
  124|  1.01k|			out [0] = arith_shift_left (u [j], 12) ;
  125|  1.01k|			out [1] = arith_shift_left (v [j], 12) ;
  126|  1.01k|			out += stride ;
  127|  1.01k|		}
  128|     33|	}
  129|     67|}
unmix24:
  137|    164|{
  138|    164|	int32_t		shift = bytesShifted * 8 ;
  139|    164|	int32_t		l, r ;
  140|    164|	int32_t 		j, k ;
  141|       |
  142|    164|	if (mixres != 0)
  ------------------
  |  Branch (142:6): [True: 75, False: 89]
  ------------------
  143|     75|	{
  144|       |		/* matrixed stereo */
  145|     75|		if (bytesShifted != 0)
  ------------------
  |  Branch (145:7): [True: 40, False: 35]
  ------------------
  146|     40|		{
  147|    390|			for (j = 0, k = 0 ; j < numSamples ; j++, k += 2)
  ------------------
  |  Branch (147:24): [True: 350, False: 40]
  ------------------
  148|    350|			{
  149|    350|				l = u [j] + v [j] - ((mixres * v [j]) >> mixbits) ;
  150|    350|				r = l - v [j] ;
  151|       |
  152|    350|				l = arith_shift_left (l, shift) | (uint32_t) shiftUV [k + 0] ;
  153|    350|				r = arith_shift_left (r, shift) | (uint32_t) shiftUV [k + 1] ;
  154|       |
  155|    350|				out [0] = arith_shift_left (l, 8) ;
  156|    350|				out [1] = arith_shift_left (r, 8) ;
  157|    350|				out += stride ;
  158|    350|			}
  159|     40|		}
  160|     35|		else
  161|     35|		{
  162|    391|			for (j = 0 ; j < numSamples ; j++)
  ------------------
  |  Branch (162:17): [True: 356, False: 35]
  ------------------
  163|    356|			{
  164|    356|				l = u [j] + v [j] - ((mixres * v [j]) >> mixbits) ;
  165|    356|				r = l - v [j] ;
  166|       |
  167|    356|				out [0] = arith_shift_left (l, 8) ;
  168|    356|				out [1] = arith_shift_left (r, 8) ;
  169|    356|				out += stride ;
  170|    356|			}
  171|     35|		}
  172|     75|	}
  173|     89|	else
  174|     89|	{
  175|       |		/* Conventional separated stereo. */
  176|     89|		if (bytesShifted != 0)
  ------------------
  |  Branch (176:7): [True: 46, False: 43]
  ------------------
  177|     46|		{
  178|    463|			for (j = 0, k = 0 ; j < numSamples ; j++, k += 2)
  ------------------
  |  Branch (178:24): [True: 417, False: 46]
  ------------------
  179|    417|			{
  180|    417|				l = u [j] ;
  181|    417|				r = v [j] ;
  182|       |
  183|    417|				l = arith_shift_left (l, shift) | (uint32_t) shiftUV [k + 0] ;
  184|    417|				r = arith_shift_left (r, shift) | (uint32_t) shiftUV [k + 1] ;
  185|       |
  186|    417|				out [0] = arith_shift_left (l, 8) ;
  187|    417|				out [1] = arith_shift_left (r, 8) ;
  188|    417|				out += stride ;
  189|    417|			}
  190|     46|		}
  191|     43|		else
  192|     43|		{
  193|    627|			for (j = 0 ; j < numSamples ; j++)
  ------------------
  |  Branch (193:17): [True: 584, False: 43]
  ------------------
  194|    584|			{
  195|    584|				out [0] = arith_shift_left (u [j], 8) ;
  196|    584|				out [1] = arith_shift_left (v [j], 8) ;
  197|    584|				out += stride ;
  198|    584|			}
  199|     43|		}
  200|     89|	}
  201|    164|}
unmix32:
  211|    108|{
  212|    108|	int32_t		shift = bytesShifted * 8 ;
  213|    108|	int32_t		l, r ;
  214|    108|	int32_t 	j, k ;
  215|       |
  216|    108|	if (mixres != 0)
  ------------------
  |  Branch (216:6): [True: 37, False: 71]
  ------------------
  217|     37|	{
  218|       |		//Assert (bytesShifted != 0) ;
  219|       |
  220|       |		/* matrixed stereo with shift */
  221|    424|		for (j = 0, k = 0 ; j < numSamples ; j++, k += 2)
  ------------------
  |  Branch (221:23): [True: 387, False: 37]
  ------------------
  222|    387|		{
  223|    387|			int32_t		lt, rt ;
  224|       |
  225|    387|			lt = u [j] ;
  226|    387|			rt = v [j] ;
  227|       |
  228|    387|			l = lt + rt - ((mixres * rt) >> mixbits) ;
  229|    387|			r = l - rt ;
  230|       |
  231|    387|			out [0] = arith_shift_left (l, shift) | (uint32_t) shiftUV [k + 0] ;
  232|    387|			out [1] = arith_shift_left (r, shift) | (uint32_t) shiftUV [k + 1] ;
  233|    387|			out += stride ;
  234|    387|		}
  235|     37|	}
  236|     71|	else
  237|     71|	{
  238|     71|		if (bytesShifted == 0)
  ------------------
  |  Branch (238:7): [True: 42, False: 29]
  ------------------
  239|     42|		{
  240|       |			/* interleaving w/o shift */
  241|  5.77k|			for (j = 0 ; j < numSamples ; j++)
  ------------------
  |  Branch (241:17): [True: 5.72k, False: 42]
  ------------------
  242|  5.72k|			{
  243|  5.72k|				out [0] = u [j] ;
  244|  5.72k|				out [1] = v [j] ;
  245|  5.72k|				out += stride ;
  246|  5.72k|			}
  247|     42|		}
  248|     29|		else
  249|     29|		{
  250|       |			/* interleaving with shift */
  251|    339|			for (j = 0, k = 0 ; j < numSamples ; j++, k += 2)
  ------------------
  |  Branch (251:24): [True: 310, False: 29]
  ------------------
  252|    310|			{
  253|    310|				out [0] = arith_shift_left (u [j], shift) | (uint32_t) shiftUV [k + 0] ;
  254|    310|				out [1] = arith_shift_left (v [j], shift) | (uint32_t) shiftUV [k + 1] ;
  255|    310|				out += stride ;
  256|    310|			}
  257|     29|		}
  258|     71|	}
  259|    108|}
copyPredictorTo24:
  265|  1.43k|{
  266|  1.43k|	int32_t		j ;
  267|       |
  268|   261k|	for (j = 0 ; j < numSamples ; j++)
  ------------------
  |  Branch (268:15): [True: 260k, False: 1.43k]
  ------------------
  269|   260k|	{
  270|   260k|		out [0] = arith_shift_left (in [j], 8) ;
  271|   260k|		out += stride ;
  272|   260k|	}
  273|  1.43k|}
copyPredictorTo24Shift:
  277|     94|{
  278|     94|	int32_t		shiftVal = bytesShifted * 8 ;
  279|     94|	int32_t		j ;
  280|       |
  281|       |	//Assert (bytesShifted != 0) ;
  282|       |
  283|    462|	for (j = 0 ; j < numSamples ; j++)
  ------------------
  |  Branch (283:15): [True: 368, False: 94]
  ------------------
  284|    368|	{
  285|    368|		int32_t		val = in [j] ;
  286|       |
  287|    368|		val = arith_shift_left (val, shiftVal) | (uint32_t) shift [j] ;
  288|    368|		out [0] = arith_shift_left (val, 8) ;
  289|    368|		out += stride ;
  290|    368|	}
  291|     94|}
copyPredictorTo20:
  295|    882|{
  296|    882|	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|  12.7k|	for (j = 0 ; j < numSamples ; j++)
  ------------------
  |  Branch (300:15): [True: 11.8k, False: 882]
  ------------------
  301|  11.8k|	{
  302|  11.8k|		out [0] = arith_shift_left (in [j], 12) ;
  303|  11.8k|		out += stride ;
  304|  11.8k|	}
  305|    882|}
copyPredictorTo32:
  309|    971|{
  310|    971|	int32_t			i, j ;
  311|       |
  312|       |	// this is only a subroutine to abstract the "iPod can only output 16-bit data" problem
  313|  15.8k|	for (i = 0, j = 0 ; i < numSamples ; i++, j += stride)
  ------------------
  |  Branch (313:22): [True: 14.8k, False: 971]
  ------------------
  314|  14.8k|		out [j] = arith_shift_left (in [i], 8) ;
  315|    971|}
copyPredictorTo32Shift:
  319|    105|{
  320|    105|	int32_t *		op = out ;
  321|    105|	uint32_t		shiftVal = bytesShifted * 8 ;
  322|    105|	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|    515|	for (j = 0 ; j < numSamples ; j++)
  ------------------
  |  Branch (327:15): [True: 410, False: 105]
  ------------------
  328|    410|	{
  329|    410|		op [0] = arith_shift_left (in [j], shiftVal) | (uint32_t) shift [j] ;
  330|    410|		op += stride ;
  331|    410|	}
  332|    105|}

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

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

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

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

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

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

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

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

decode.c:GSM_MULT_R:
  118|  4.74M|{	return (((int32_t) (a)) * ((int32_t) (b)) + 16384) >> 15 ;
  119|  4.74M|} /* GSM_MULT_R */
decode.c:GSM_ADD:
  150|  9.48M|{	int32_t ltmp ;
  151|       |
  152|  9.48M|	ltmp = ((int32_t) a) + ((int32_t) b) ;
  153|       |
  154|  9.48M|	if (ltmp >= MAX_WORD)
  ------------------
  |  |   52|  9.48M|#define	MAX_WORD	32767
  ------------------
  |  Branch (154:6): [True: 522k, False: 8.95M]
  ------------------
  155|   522k|		return MAX_WORD ;
  ------------------
  |  |   52|   522k|#define	MAX_WORD	32767
  ------------------
  156|  8.95M|	if (ltmp <= MIN_WORD)
  ------------------
  |  |   51|  8.95M|#define	MIN_WORD	(-32767 - 1)
  ------------------
  |  Branch (156:6): [True: 3.21M, False: 5.74M]
  ------------------
  157|  3.21M|		return MIN_WORD ;
  ------------------
  |  |   51|  3.21M|#define	MIN_WORD	(-32767 - 1)
  ------------------
  158|       |
  159|  5.74M|	return ltmp ;
  160|  8.95M|} /* GSM_ADD */
long_term.c:GSM_MULT_R:
  118|  4.74M|{	return (((int32_t) (a)) * ((int32_t) (b)) + 16384) >> 15 ;
  119|  4.74M|} /* GSM_MULT_R */
long_term.c:GSM_ADD:
  150|  4.74M|{	int32_t ltmp ;
  151|       |
  152|  4.74M|	ltmp = ((int32_t) a) + ((int32_t) b) ;
  153|       |
  154|  4.74M|	if (ltmp >= MAX_WORD)
  ------------------
  |  |   52|  4.74M|#define	MAX_WORD	32767
  ------------------
  |  Branch (154:6): [True: 72.0k, False: 4.66M]
  ------------------
  155|  72.0k|		return MAX_WORD ;
  ------------------
  |  |   52|  72.0k|#define	MAX_WORD	32767
  ------------------
  156|  4.66M|	if (ltmp <= MIN_WORD)
  ------------------
  |  |   51|  4.66M|#define	MIN_WORD	(-32767 - 1)
  ------------------
  |  Branch (156:6): [True: 2.36k, False: 4.66M]
  ------------------
  157|  2.36k|		return MIN_WORD ;
  ------------------
  |  |   51|  2.36k|#define	MIN_WORD	(-32767 - 1)
  ------------------
  158|       |
  159|  4.66M|	return ltmp ;
  160|  4.66M|} /* GSM_ADD */
rpe.c:SASR_W:
   60|  73.2k|{	if (x >= 0)
  ------------------
  |  Branch (60:7): [True: 73.2k, False: 0]
  ------------------
   61|  73.2k|		return x >> by ;
   62|      0|	return ~ ((~x) >> by) ;
   63|  73.2k|} /* SASR_W */
rpe.c:arith_shift_left:
  306|  1.54M|{	return (int32_t) (((uint32_t) x) << shift) ;
  307|  1.54M|} /* arith_shift_left */
rpe.c:GSM_MULT_R:
  118|  1.54M|{	return (((int32_t) (a)) * ((int32_t) (b)) + 16384) >> 15 ;
  119|  1.54M|} /* GSM_MULT_R */
rpe.c:GSM_ADD:
  150|  1.54M|{	int32_t ltmp ;
  151|       |
  152|  1.54M|	ltmp = ((int32_t) a) + ((int32_t) b) ;
  153|       |
  154|  1.54M|	if (ltmp >= MAX_WORD)
  ------------------
  |  |   52|  1.54M|#define	MAX_WORD	32767
  ------------------
  |  Branch (154:6): [True: 0, False: 1.54M]
  ------------------
  155|      0|		return MAX_WORD ;
  ------------------
  |  |   52|      0|#define	MAX_WORD	32767
  ------------------
  156|  1.54M|	if (ltmp <= MIN_WORD)
  ------------------
  |  |   51|  1.54M|#define	MIN_WORD	(-32767 - 1)
  ------------------
  |  Branch (156:6): [True: 0, False: 1.54M]
  ------------------
  157|      0|		return MIN_WORD ;
  ------------------
  |  |   51|      0|#define	MIN_WORD	(-32767 - 1)
  ------------------
  158|       |
  159|  1.54M|	return ltmp ;
  160|  1.54M|} /* GSM_ADD */
short_term.c:arith_shift_left:
  306|   237k|{	return (int32_t) (((uint32_t) x) << shift) ;
  307|   237k|} /* arith_shift_left */
short_term.c:GSM_ADD:
  150|  39.6M|{	int32_t ltmp ;
  151|       |
  152|  39.6M|	ltmp = ((int32_t) a) + ((int32_t) b) ;
  153|       |
  154|  39.6M|	if (ltmp >= MAX_WORD)
  ------------------
  |  |   52|  39.6M|#define	MAX_WORD	32767
  ------------------
  |  Branch (154:6): [True: 151k, False: 39.5M]
  ------------------
  155|   151k|		return MAX_WORD ;
  ------------------
  |  |   52|   151k|#define	MAX_WORD	32767
  ------------------
  156|  39.5M|	if (ltmp <= MIN_WORD)
  ------------------
  |  |   51|  39.5M|#define	MIN_WORD	(-32767 - 1)
  ------------------
  |  Branch (156:6): [True: 9.34k, False: 39.5M]
  ------------------
  157|  9.34k|		return MIN_WORD ;
  ------------------
  |  |   51|  9.34k|#define	MIN_WORD	(-32767 - 1)
  ------------------
  158|       |
  159|  39.5M|	return ltmp ;
  160|  39.5M|} /* GSM_ADD */
short_term.c:GSM_SUB:
  164|  38.1M|{	int32_t ltmp ;
  165|       |
  166|  38.1M|	ltmp = ((int32_t) a) - ((int32_t) b) ;
  167|       |
  168|  38.1M|	if (ltmp >= MAX_WORD)
  ------------------
  |  |   52|  38.1M|#define	MAX_WORD	32767
  ------------------
  |  Branch (168:6): [True: 304k, False: 37.8M]
  ------------------
  169|   304k|		ltmp = MAX_WORD ;
  ------------------
  |  |   52|   304k|#define	MAX_WORD	32767
  ------------------
  170|  37.8M|	else if (ltmp <= MIN_WORD)
  ------------------
  |  |   51|  37.8M|#define	MIN_WORD	(-32767 - 1)
  ------------------
  |  Branch (170:11): [True: 273k, False: 37.5M]
  ------------------
  171|   273k|		ltmp = MIN_WORD ;
  ------------------
  |  |   51|   273k|#define	MIN_WORD	(-32767 - 1)
  ------------------
  172|       |
  173|  38.1M|	return ltmp ;
  174|  38.1M|} /* GSM_SUB */
short_term.c:GSM_MULT_R:
  118|   237k|{	return (((int32_t) (a)) * ((int32_t) (b)) + 16384) >> 15 ;
  119|   237k|} /* GSM_MULT_R */
short_term.c:SASR_W:
   60|  1.89M|{	if (x >= 0)
  ------------------
  |  Branch (60:7): [True: 805k, False: 1.09M]
  ------------------
   61|   805k|		return x >> by ;
   62|  1.09M|	return ~ ((~x) >> by) ;
   63|  1.89M|} /* SASR_W */
add.c:SASR_W:
   60|  1.55M|{	if (x >= 0)
  ------------------
  |  Branch (60:7): [True: 570k, False: 981k]
  ------------------
   61|   570k|		return x >> by ;
   62|   981k|	return ~ ((~x) >> by) ;
   63|  1.55M|} /* SASR_W */

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

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

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

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

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

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

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

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

alac_init:
  112|    978|{	int error ;
  113|       |
  114|    978|	if ((psf->codec_data = calloc (1, sizeof (ALAC_PRIVATE) + psf->sf.channels * sizeof (int) * ALAC_MAX_FRAME_SIZE)) == NULL)
  ------------------
  |  |   33|    978|#define		ALAC_MAX_FRAME_SIZE		8192
  ------------------
  |  Branch (114:6): [True: 0, False: 978]
  ------------------
  115|      0|		return SFE_MALLOC_FAILED ;
  116|       |
  117|    978|	psf->codec_close = alac_close ;
  118|       |
  119|    978|	switch (psf->file.mode)
  120|    978|	{	case SFM_RDWR :
  ------------------
  |  Branch (120:4): [True: 0, False: 978]
  ------------------
  121|      0|			return SFE_BAD_MODE_RW ;
  122|       |
  123|    978|		case SFM_READ :
  ------------------
  |  Branch (123:3): [True: 978, False: 0]
  ------------------
  124|    978|			if ((error = alac_reader_init (psf, info)))
  ------------------
  |  Branch (124:8): [True: 227, False: 751]
  ------------------
  125|    227|				return error ;
  126|    751|			break ;
  127|       |
  128|    751|		case SFM_WRITE :
  ------------------
  |  Branch (128:3): [True: 0, False: 978]
  ------------------
  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: 978]
  ------------------
  134|      0|			psf_log_printf (psf, "%s : Bad psf->file.mode.\n", __func__) ;
  135|      0|			return SFE_INTERNAL ;
  136|    978|		} ;
  137|       |
  138|    751|	psf->byterate = alac_byterate ;
  139|       |
  140|    751|	return 0 ;
  141|    978|} /* aiff_alac_init */
alac.c:alac_close:
  166|    978|{	ALAC_PRIVATE *plac ;
  167|    978|	BUF_UNION	ubuf ;
  168|       |
  169|    978|	plac = psf->codec_data ;
  170|       |
  171|    978|	if (psf->file.mode == SFM_WRITE)
  ------------------
  |  Branch (171:6): [True: 0, False: 978]
  ------------------
  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|    978|	if (plac->pakt_info)
  ------------------
  |  Branch (216:6): [True: 932, False: 46]
  ------------------
  217|    932|		free (plac->pakt_info) ;
  218|    978|	plac->pakt_info = NULL ;
  219|       |
  220|    978|	return 0 ;
  221|    978|} /* alac_close */
alac.c:alac_pakt_append:
  794|  6.65k|{
  795|  6.65k|	if (info->count >= info->allocated)
  ------------------
  |  Branch (795:6): [True: 132, False: 6.52k]
  ------------------
  796|    132|	{	PAKT_INFO * temp ;
  797|    132|		uint32_t newcount = info->allocated + info->allocated / 2 ;
  798|       |
  799|    132|		if ((temp = realloc (info, sizeof (PAKT_INFO) + newcount * sizeof (info->packet_size [0]))) == NULL)
  ------------------
  |  Branch (799:7): [True: 0, False: 132]
  ------------------
  800|      0|			return NULL ;
  801|       |
  802|    132|		info = temp ;
  803|    132|		info->allocated = newcount ;
  804|  6.65k|		} ;
  805|       |
  806|  6.65k|	info->packet_size [info->count++] = value ;
  807|  6.65k|	return info ;
  808|  6.65k|} /* alac_pakt_append */
alac.c:alac_reader_init:
  238|    978|{	ALAC_PRIVATE	*plac ;
  239|    978|	uint32_t		kuki_size ;
  240|    978|	int				error ;
  241|    978|	union			{ uint8_t kuki [512] ; uint32_t alignment ; } u ;
  242|       |
  243|    978|	if (info == NULL)
  ------------------
  |  Branch (243:6): [True: 0, False: 978]
  ------------------
  244|      0|	{	psf_log_printf (psf, "%s : ALAC_DECODER_INFO is NULL.\n", __func__) ;
  245|      0|		return SFE_INTERNAL ;
  246|    978|		} ;
  247|       |
  248|    978|	if (info->frames_per_packet > ALAC_FRAME_LENGTH)
  ------------------
  |  |   33|    978|#define		ALAC_FRAME_LENGTH	4096
  ------------------
  |  Branch (248:6): [True: 20, False: 958]
  ------------------
  249|     20|	{	psf_log_printf (psf, "*** Error : frames_per_packet (%u) is too big. ***\n", info->frames_per_packet) ;
  250|     20|		return SFE_INTERNAL ;
  251|    958|		} ;
  252|       |
  253|    958|	plac = psf->codec_data ;
  254|       |
  255|    958|	plac->channels			= psf->sf.channels ;
  256|    958|	plac->frames_per_block	= info->frames_per_packet ;
  257|    958|	plac->bits_per_sample	= info->bits_per_sample ;
  258|       |
  259|    958|	if (plac->pakt_info != NULL)
  ------------------
  |  Branch (259:6): [True: 0, False: 958]
  ------------------
  260|      0|		free (plac->pakt_info) ;
  261|    958|	plac->pakt_info = alac_pakt_read_decode (psf, info->pakt_offset) ;
  262|       |
  263|    958|	if (plac->pakt_info == NULL)
  ------------------
  |  Branch (263:6): [True: 26, False: 932]
  ------------------
  264|     26|	{	psf_log_printf (psf, "%s : alac_pkt_read() returns NULL.\n", __func__) ;
  265|     26|		return SFE_INTERNAL ;
  266|    932|		} ;
  267|       |
  268|       |	/* Read in the ALAC cookie data and pass it to the init function. */
  269|    932|	kuki_size = alac_kuki_read (psf, info->kuki_offset, u.kuki, sizeof (u.kuki)) ;
  270|       |
  271|    932|	if ((error = alac_decoder_init (&plac->u.decoder, u.kuki, kuki_size)) != ALAC_noErr)
  ------------------
  |  Branch (271:6): [True: 180, False: 752]
  ------------------
  272|    180|	{	psf_log_printf (psf, "*** alac_decoder_init() returned %s. ***\n", alac_error_string (error)) ;
  273|    180|		return SFE_INTERNAL ;
  274|    752|		} ;
  275|       |
  276|       |
  277|    752|	if (plac->u.decoder.mNumChannels != (unsigned) psf->sf.channels)
  ------------------
  |  Branch (277:6): [True: 1, False: 751]
  ------------------
  278|      1|	{	psf_log_printf (psf, "*** Initialized decoder has %u channels, but it should be %d. ***\n", plac->u.decoder.mNumChannels, psf->sf.channels) ;
  279|      1|		return SFE_INTERNAL ;
  280|    751|		} ;
  281|       |
  282|    751|	switch (info->bits_per_sample)
  283|    751|	{	case 16 :
  ------------------
  |  Branch (283:4): [True: 52, False: 699]
  ------------------
  284|    325|		case 20 :
  ------------------
  |  Branch (284:3): [True: 273, False: 478]
  ------------------
  285|    658|		case 24 :
  ------------------
  |  Branch (285:3): [True: 333, False: 418]
  ------------------
  286|    751|		case 32 :
  ------------------
  |  Branch (286:3): [True: 93, False: 658]
  ------------------
  287|    751|			psf->read_short		= alac_read_s ;
  288|    751|			psf->read_int		= alac_read_i ;
  289|    751|			psf->read_float		= alac_read_f ;
  290|    751|			psf->read_double	= alac_read_d ;
  291|    751|			break ;
  292|       |
  293|      0|		default :
  ------------------
  |  Branch (293:3): [True: 0, False: 751]
  ------------------
  294|      0|			printf ("%s : info->bits_per_sample %u\n", __func__, info->bits_per_sample) ;
  295|      0|			return SFE_UNSUPPORTED_ENCODING ;
  296|    751|		} ;
  297|       |
  298|    751|	psf->codec_close	= alac_close ;
  299|    751|	psf->seek			= alac_seek ;
  300|       |
  301|    751|	psf->sf.frames		= alac_reader_calc_frames (psf, plac) ;
  302|    751|	alac_seek (psf, SFM_READ, 0) ;
  303|       |
  304|    751|	return 0 ;
  305|    751|} /* alac_reader_init */
alac.c:alac_pakt_read_decode:
  812|    958|{	SF_CHUNK_INFO chunk_info ;
  813|    958|	PAKT_INFO * info = NULL, * temp ;
  814|    958|	uint8_t *pakt_data = NULL ;
  815|    958|	uint32_t bcount, value = 1, pakt_size ;
  816|    958|	SF_CHUNK_ITERATOR * chunk_iterator ;
  817|       |
  818|       |
  819|    958|	memset (&chunk_info, 0, sizeof (chunk_info)) ;
  820|    958|	snprintf (chunk_info.id, sizeof (chunk_info.id), "pakt") ;
  821|    958|	chunk_info.id_size = 4 ;
  822|       |
  823|    958|	if ((chunk_iterator = psf_get_chunk_iterator (psf, chunk_info.id)) == NULL)
  ------------------
  |  Branch (823:6): [True: 26, False: 932]
  ------------------
  824|     26|	{	psf_log_printf (psf, "%s : no chunk iterator found\n", __func__) ;
  825|     26|		free (chunk_info.data) ;
  826|     26|		chunk_info.data = NULL ;
  827|     26|		return NULL ;
  828|    932|		} ;
  829|       |
  830|    932|	psf->get_chunk_size (psf, chunk_iterator, &chunk_info) ;
  831|       |
  832|    932|	pakt_size = chunk_info.datalen ;
  833|    932|	if (pakt_size > UINT32_MAX-5 )
  ------------------
  |  Branch (833:6): [True: 0, False: 932]
  ------------------
  834|      0|		return NULL;
  835|    932|	chunk_info.data = pakt_data = malloc (pakt_size + 5) ;
  836|    932|	if (!chunk_info.data)
  ------------------
  |  Branch (836:6): [True: 0, False: 932]
  ------------------
  837|      0|		return NULL ;
  838|       |
  839|    932|	if ((bcount = psf->get_chunk_data (psf, chunk_iterator, &chunk_info)) != SF_ERR_NO_ERROR)
  ------------------
  |  Branch (839:6): [True: 0, False: 932]
  ------------------
  840|      0|	{	while (chunk_iterator)
  ------------------
  |  Branch (840:11): [True: 0, False: 0]
  ------------------
  841|      0|			chunk_iterator = psf->next_chunk_iterator (psf, chunk_iterator) ;
  842|      0|		free (chunk_info.data) ;
  843|      0|		chunk_info.data = NULL ;
  844|      0|		return NULL ;
  845|    932|		} ;
  846|       |
  847|  2.24k|	while (chunk_iterator)
  ------------------
  |  Branch (847:9): [True: 1.31k, False: 932]
  ------------------
  848|  1.31k|		chunk_iterator = psf->next_chunk_iterator (psf, chunk_iterator) ;
  849|       |
  850|    932|	info = alac_pakt_alloc (pakt_size / 4) ;
  851|       |
  852|       |	/* Start at 24 bytes in, skipping over the 'pakt' chunks header. */
  853|  7.58k|	for (bcount = 24 ; bcount < pakt_size && value != 0 ; )
  ------------------
  |  Branch (853:21): [True: 6.81k, False: 770]
  |  Branch (853:43): [True: 6.65k, False: 162]
  ------------------
  854|  6.65k|	{	uint8_t byte ;
  855|  6.65k|		int32_t count = 0 ;
  856|       |
  857|  6.65k|		value = 0 ;
  858|  6.65k|		do
  859|  7.49k|		{	byte = pakt_data [bcount + count] ;
  860|  7.49k|			value = (value << 7) + (byte & 0x7F) ;
  861|       |
  862|  7.49k|			count ++ ;
  863|  7.49k|			if (count > 5 || bcount + count > pakt_size)
  ------------------
  |  Branch (863:8): [True: 17, False: 7.47k]
  |  Branch (863:21): [True: 38, False: 7.43k]
  ------------------
  864|     55|			{	printf ("%s %d : Ooops! count %" PRIi32 "    bcount %" PRIu32 "\n", __func__, __LINE__, count, bcount) ;
  865|     55|				value = 0 ;
  866|     55|				break ;
  867|  7.43k|				} ;
  868|  7.43k|			}
  869|  7.43k|			while (byte & 0x80) ;
  ------------------
  |  Branch (869:11): [True: 834, False: 6.60k]
  ------------------
  870|       |
  871|  6.65k|		bcount += count ;
  872|       |
  873|  6.65k|		if ((temp = alac_pakt_append (info, value)) == NULL)
  ------------------
  |  Branch (873:7): [True: 0, False: 6.65k]
  ------------------
  874|      0|			goto FreeExit ;
  875|  6.65k|		info = temp ;
  876|  6.65k|		} ;
  877|       |
  878|    932|	free (pakt_data) ;
  879|       |
  880|    932|	return info ;
  881|       |
  882|      0|FreeExit :
  883|      0|	free (pakt_data) ;
  884|      0|	free (info) ;
  885|       |	return NULL ;
  886|    932|} /* alac_pakt_read_decode */
alac.c:alac_pakt_alloc:
  780|    932|{	PAKT_INFO * info ;
  781|       |
  782|    932|	if ((info = calloc (1, sizeof (PAKT_INFO) + initial_count * sizeof (info->packet_size [0]))) == NULL)
  ------------------
  |  Branch (782:6): [True: 0, False: 932]
  ------------------
  783|      0|		return NULL ;
  784|       |
  785|    932|	info->allocated = initial_count ;
  786|    932|	info->current = 0 ;
  787|    932|	info->count = 0 ;
  788|       |
  789|    932|	return info ;
  790|    932|} /* alac_pakt_alloc */
alac.c:alac_kuki_read:
  960|    932|{	uint32_t marker ;
  961|    932|	uint64_t kuki_size ;
  962|       |
  963|    932|	if (psf_fseek (psf, kuki_offset, SEEK_SET) != kuki_offset)
  ------------------
  |  Branch (963:6): [True: 0, False: 932]
  ------------------
  964|      0|		return 0 ;
  965|       |
  966|    932|	psf_fread (&marker, 1, sizeof (marker), psf) ;
  967|    932|	if (marker != MAKE_MARKER ('k', 'u', 'k', 'i'))
  ------------------
  |  |  122|    932|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
  |  Branch (967:6): [True: 99, False: 833]
  ------------------
  968|     99|		return 0 ;
  969|       |
  970|    833|	psf_fread (&kuki_size, 1, sizeof (kuki_size), psf) ;
  971|    833|	kuki_size = BE2H_64 (kuki_size) ;
  ------------------
  |  |  142|    833|	#define BE2H_64(x)			ENDSWAP_64 (x)
  |  |  ------------------
  |  |  |  |   36|    833|#define	ENDSWAP_64(x)		(bswap_64 (x))
  |  |  ------------------
  ------------------
  972|       |
  973|    833|	if (kuki_size == 0 || kuki_size > kuki_maxlen)
  ------------------
  |  Branch (973:6): [True: 1, False: 832]
  |  Branch (973:24): [True: 1, False: 831]
  ------------------
  974|      2|	{	psf_log_printf (psf, "%s : Bad size (%D) of 'kuki' chunk.\n", __func__, kuki_size) ;
  975|      2|		return 0 ;
  976|    831|		} ;
  977|       |
  978|    831|	psf_fread (kuki, 1, kuki_size, psf) ;
  979|       |
  980|    831|	return kuki_size ;
  981|    833|} /* alac_kuki_read */
alac.c:alac_error_string:
  987|    877|{	static char errstr [128] ;
  988|    877|	switch (error)
  989|    877|	{	CASE_NAME (kALAC_UnimplementedError) ;
  ------------------
  |  |  983|      0|#define CASE_NAME(x)	case x : return #x ; break ;
  |  |  ------------------
  |  |  |  Branch (983:22): [True: 0, False: 877]
  |  |  ------------------
  ------------------
  990|      0|		CASE_NAME (kALAC_FileNotFoundError) ;
  ------------------
  |  |  983|      0|#define CASE_NAME(x)	case x : return #x ; break ;
  |  |  ------------------
  |  |  |  Branch (983:22): [True: 0, False: 877]
  |  |  ------------------
  ------------------
  991|    556|		CASE_NAME (kALAC_ParamError) ;
  ------------------
  |  |  983|    556|#define CASE_NAME(x)	case x : return #x ; break ;
  |  |  ------------------
  |  |  |  Branch (983:22): [True: 556, False: 321]
  |  |  ------------------
  ------------------
  992|      0|		CASE_NAME (kALAC_MemFullError) ;
  ------------------
  |  |  983|      0|#define CASE_NAME(x)	case x : return #x ; break ;
  |  |  ------------------
  |  |  |  Branch (983:22): [True: 0, False: 877]
  |  |  ------------------
  ------------------
  993|     47|		CASE_NAME (fALAC_FrameLengthError) ;
  ------------------
  |  |  983|     47|#define CASE_NAME(x)	case x : return #x ; break ;
  |  |  ------------------
  |  |  |  Branch (983:22): [True: 47, False: 830]
  |  |  ------------------
  ------------------
  994|       |
  995|       |		/* Added for libsndfile */
  996|     11|		CASE_NAME (kALAC_BadBitWidth) ;
  ------------------
  |  |  983|     11|#define CASE_NAME(x)	case x : return #x ; break ;
  |  |  ------------------
  |  |  |  Branch (983:22): [True: 11, False: 866]
  |  |  ------------------
  ------------------
  997|     11|		CASE_NAME (kALAC_IncompatibleVersion) ;
  ------------------
  |  |  983|     11|#define CASE_NAME(x)	case x : return #x ; break ;
  |  |  ------------------
  |  |  |  Branch (983:22): [True: 11, False: 866]
  |  |  ------------------
  ------------------
  998|    106|		CASE_NAME (kALAC_BadSpecificConfigSize) ;
  ------------------
  |  |  983|    106|#define CASE_NAME(x)	case x : return #x ; break ;
  |  |  ------------------
  |  |  |  Branch (983:22): [True: 106, False: 771]
  |  |  ------------------
  ------------------
  999|      1|		CASE_NAME (kALAC_ZeroChannelCount) ;
  ------------------
  |  |  983|      1|#define CASE_NAME(x)	case x : return #x ; break ;
  |  |  ------------------
  |  |  |  Branch (983:22): [True: 1, False: 876]
  |  |  ------------------
  ------------------
 1000|     73|		CASE_NAME (kALAC_NumSamplesTooBig) ;
  ------------------
  |  |  983|     73|#define CASE_NAME(x)	case x : return #x ; break ;
  |  |  ------------------
  |  |  |  Branch (983:22): [True: 73, False: 804]
  |  |  ------------------
  ------------------
 1001|     72|		CASE_NAME (kALAC_UnsupportedElement) ;
  ------------------
  |  |  983|     72|#define CASE_NAME(x)	case x : return #x ; break ;
  |  |  ------------------
  |  |  |  Branch (983:22): [True: 72, False: 805]
  |  |  ------------------
  ------------------
 1002|      0|		default :
  ------------------
  |  Branch (1002:3): [True: 0, False: 877]
  ------------------
 1003|      0|			break ;
 1004|    877|		} ;
 1005|       |
 1006|      0|	snprintf (errstr, sizeof (errstr), "Unknown error %d", error) ;
 1007|      0|	return errstr ;
 1008|    877|} /* alac_error_string */
alac.c:alac_decode_block:
  405|  3.55k|{	ALAC_DECODER *pdec = &plac->u.decoder ;
  406|  3.55k|	uint32_t	packet_size ;
  407|  3.55k|	BitBuffer	bit_buffer ;
  408|  3.55k|	int32_t		error ;
  409|       |
  410|  3.55k|	packet_size = alac_reader_next_packet_size (plac->pakt_info) ;
  411|  3.55k|	if (packet_size == 0)
  ------------------
  |  Branch (411:6): [True: 270, False: 3.28k]
  ------------------
  412|    270|	{	if (plac->pakt_info->current < plac->pakt_info->count)
  ------------------
  |  Branch (412:8): [True: 0, False: 270]
  ------------------
  413|      0|			psf_log_printf (psf, "packet_size is 0 (%d of %d)\n", plac->pakt_info->current, plac->pakt_info->count) ;
  414|    270|		return 0 ;
  415|  3.28k|		} ;
  416|       |
  417|  3.28k|	psf_fseek (psf, plac->input_data_pos, SEEK_SET) ;
  418|       |
  419|  3.28k|	if (packet_size > sizeof (plac->byte_buffer))
  ------------------
  |  Branch (419:6): [True: 22, False: 3.25k]
  ------------------
  420|     22|	{	psf_log_printf (psf, "%s : bad packet_size (%u)\n", __func__, packet_size) ;
  421|     22|		return 0 ;
  422|  3.25k|		} ;
  423|       |
  424|  3.25k|	if ((packet_size != psf_fread (plac->byte_buffer, 1, packet_size, psf)))
  ------------------
  |  Branch (424:6): [True: 178, False: 3.08k]
  ------------------
  425|    178|		return 0 ;
  426|       |
  427|  3.08k|	BitBufferInit (&bit_buffer, plac->byte_buffer, packet_size) ;
  428|       |
  429|  3.08k|	plac->input_data_pos += packet_size ;
  430|  3.08k|	plac->frames_this_block = 0 ;
  431|  3.08k|	if ((error = alac_decode (pdec, &bit_buffer, plac->buffer, plac->frames_per_block, &plac->frames_this_block)) != ALAC_noErr)
  ------------------
  |  Branch (431:6): [True: 697, False: 2.38k]
  ------------------
  432|    697|	{	psf_log_printf (psf, "*** alac_decode() returned %s. ***\n", alac_error_string (error)) ;
  433|    697|		plac->frames_this_block = 0 ;
  434|    697|		return 0 ;
  435|  2.38k|		} ;
  436|       |
  437|  2.38k|	plac->partial_block_frames = 0 ;
  438|       |
  439|  2.38k|	return 1 ;
  440|  3.08k|} /* alac_decode_block */
alac.c:alac_reader_next_packet_size:
  371|  9.00k|{	if (info->current >= info->count)
  ------------------
  |  Branch (371:7): [True: 795, False: 8.20k]
  ------------------
  372|    795|		return 0 ;
  373|  8.20k|	return info->packet_size [info->current++] ;
  374|  9.00k|} /* alac_reader_next_packet_size */
alac.c:alac_read_f:
  528|  1.54M|{	ALAC_PRIVATE *plac ;
  529|  1.54M|	int			*iptr ;
  530|  1.54M|	int			k, readcount ;
  531|  1.54M|	sf_count_t	total = 0 ;
  532|  1.54M|	float		normfact ;
  533|       |
  534|  1.54M|	if ((plac = (ALAC_PRIVATE*) psf->codec_data) == NULL)
  ------------------
  |  Branch (534:6): [True: 0, False: 1.54M]
  ------------------
  535|      0|		return 0 ;
  536|       |
  537|  1.54M|	normfact = (psf->norm_float == SF_TRUE) ? 1.0 / ((float) 0x80000000) : 1.0 ;
  ------------------
  |  Branch (537:13): [True: 1.54M, False: 0]
  ------------------
  538|       |
  539|  3.08M|	while (len > 0)
  ------------------
  |  Branch (539:9): [True: 1.54M, False: 1.54M]
  ------------------
  540|  1.54M|	{	if (plac->partial_block_frames >= plac->frames_this_block && alac_decode_block (psf, plac) == 0)
  ------------------
  |  Branch (540:8): [True: 2.49k, False: 1.54M]
  |  Branch (540:65): [True: 274, False: 2.22k]
  ------------------
  541|    274|			break ;
  542|       |
  543|  1.54M|		readcount = (plac->frames_this_block - plac->partial_block_frames) * plac->channels ;
  544|  1.54M|		readcount = readcount > len ? (int) len : readcount ;
  ------------------
  |  Branch (544:15): [True: 1.54M, False: 2.22k]
  ------------------
  545|       |
  546|  1.54M|		iptr = plac->buffer + plac->partial_block_frames * plac->channels ;
  547|       |
  548|  3.81M|		for (k = 0 ; k < readcount ; k++)
  ------------------
  |  Branch (548:16): [True: 2.27M, False: 1.54M]
  ------------------
  549|  2.27M|			ptr [total + k] = normfact * iptr [k] ;
  550|       |
  551|  1.54M|		plac->partial_block_frames += readcount / plac->channels ;
  552|  1.54M|		total += readcount ;
  553|  1.54M|		len -= readcount ;
  554|  1.54M|		} ;
  555|       |
  556|  1.54M|	return total ;
  557|  1.54M|} /* alac_read_f */
alac.c:alac_seek:
  597|  1.50k|{	ALAC_PRIVATE *plac ;
  598|  1.50k|	int			newblock, newsample ;
  599|       |
  600|  1.50k|	if (! psf->codec_data)
  ------------------
  |  Branch (600:6): [True: 0, False: 1.50k]
  ------------------
  601|      0|		return 0 ;
  602|  1.50k|	plac = (ALAC_PRIVATE*) psf->codec_data ;
  603|       |
  604|  1.50k|	if (psf->datalength < 0 || psf->dataoffset < 0)
  ------------------
  |  Branch (604:6): [True: 6, False: 1.49k]
  |  Branch (604:29): [True: 0, False: 1.49k]
  ------------------
  605|      6|	{	psf->error = SFE_BAD_SEEK ;
  606|      6|		return PSF_SEEK_ERROR ;
  ------------------
  |  |   78|      6|#define	PSF_SEEK_ERROR			((sf_count_t) -1)
  ------------------
  607|  1.49k|		} ;
  608|       |
  609|  1.49k|	if (offset == 0)
  ------------------
  |  Branch (609:6): [True: 1.18k, False: 306]
  ------------------
  610|  1.18k|	{	psf_fseek (psf, psf->dataoffset, SEEK_SET) ;
  611|       |
  612|  1.18k|		plac->frames_this_block = 0 ;
  613|  1.18k|		plac->input_data_pos = psf->dataoffset ;
  614|  1.18k|		plac->pakt_info->current = 0 ;
  615|  1.18k|		return 0 ;
  616|  1.18k|		} ;
  617|       |
  618|    306|	if (offset < 0 || offset > plac->pakt_info->count * plac->frames_per_block)
  ------------------
  |  Branch (618:6): [True: 0, False: 306]
  |  Branch (618:20): [True: 0, False: 306]
  ------------------
  619|      0|	{	psf->error = SFE_BAD_SEEK ;
  620|      0|		return	PSF_SEEK_ERROR ;
  ------------------
  |  |   78|      0|#define	PSF_SEEK_ERROR			((sf_count_t) -1)
  ------------------
  621|    306|		} ;
  622|       |
  623|    306|	newblock	= offset / plac->frames_per_block ;
  624|    306|	newsample	= offset % plac->frames_per_block ;
  625|       |
  626|    306|	if (mode == SFM_READ)
  ------------------
  |  Branch (626:6): [True: 306, False: 0]
  ------------------
  627|    306|	{	plac->input_data_pos = psf->dataoffset + alac_pakt_block_offset (plac->pakt_info, newblock) ;
  628|       |
  629|    306|		plac->pakt_info->current = newblock ;
  630|    306|		alac_decode_block (psf, plac) ;
  631|    306|		plac->partial_block_frames = newsample ;
  632|    306|		}
  633|      0|	else
  634|      0|	{	/* What to do about write??? */
  635|      0|		psf->error = SFE_BAD_SEEK ;
  636|      0|		return	PSF_SEEK_ERROR ;
  ------------------
  |  |   78|      0|#define	PSF_SEEK_ERROR			((sf_count_t) -1)
  ------------------
  637|    306|		} ;
  638|       |
  639|    306|	return newblock * plac->frames_per_block + newsample ;
  640|    306|} /* alac_seek */
alac.c:alac_pakt_block_offset:
  949|    306|{	sf_count_t offset = 0 ;
  950|    306|	uint32_t k ;
  951|       |
  952|  4.32k|	for (k = 0 ; k < block ; k++)
  ------------------
  |  Branch (952:15): [True: 4.01k, False: 306]
  ------------------
  953|  4.01k|		offset += info->packet_size [k] ;
  954|       |
  955|    306|	return offset ;
  956|    306|} /* alac_pakt_block_offset */
alac.c:alac_reader_calc_frames:
  378|    751|{	sf_count_t	frames = 0 ;
  379|    751|	uint32_t	current_pos = 1, blocks = 0 ;
  380|       |
  381|    751|	plac->pakt_info->current = 0 ;
  382|       |
  383|  6.20k|	while (current_pos < psf->filelength && current_pos > 0)
  ------------------
  |  Branch (383:9): [True: 6.12k, False: 73]
  |  Branch (383:42): [True: 5.45k, False: 678]
  ------------------
  384|  5.45k|	{	current_pos = alac_reader_next_packet_size (plac->pakt_info) ;
  385|  5.45k|		blocks = current_pos > 0 ? blocks + 1 : blocks ;
  ------------------
  |  Branch (385:12): [True: 4.77k, False: 678]
  ------------------
  386|  5.45k|		} ;
  387|       |
  388|    751|	if (blocks == 0)
  ------------------
  |  Branch (388:6): [True: 2, False: 749]
  ------------------
  389|      2|		return 0 ;
  390|       |
  391|       |	/* Only count full blocks. */
  392|    749|	frames = plac->frames_per_block * (blocks - 1) ;
  393|       |
  394|    749|	alac_seek (psf, SFM_READ, frames) ;
  395|    749|	alac_decode_block (psf, plac) ;
  396|    749|	frames += plac->frames_this_block ;
  397|       |
  398|    749|	plac->pakt_info->current = 0 ;
  399|       |
  400|    749|	return frames ;
  401|    751|} /* alac_reader_calc_frames */

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

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

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

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

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

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

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

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

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

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

aiff.c:peak_info_calloc:
  226|  1.17k|{	return calloc (1, sizeof (PEAK_INFO) + channels * sizeof (PEAK_POS)) ;
  227|  1.17k|} /* peak_info_calloc */
aiff.c:psf_cues_points:
  983|    641|{	return cues->cue_points ;
  984|    641|} /* psf_cues_points */
aiff.c:make_size_t:
  272|  3.08k|{	return (size_t) x ;
  273|  3.08k|} /* make_size_t */
avr.c:arith_shift_left:
 1080|     91|{	return (int32_t) (((uint32_t) x) << shift) ;
 1081|     91|} /* arith_shift_left */
caf.c:peak_info_calloc:
  226|    358|{	return calloc (1, sizeof (PEAK_INFO) + channels * sizeof (PEAK_POS)) ;
  227|    358|} /* peak_info_calloc */
caf.c:psf_lrint:
  958|  2.46k|{
  959|  2.46k|	#ifdef USE_SSE2
  960|  2.46k|		return _mm_cvtsd_si32 (_mm_load_sd (&x)) ;
  961|       |	#else
  962|       |		return lrint (x) ;
  963|       |	#endif
  964|  2.46k|} /* psf_lrintf */
ircam.c:psf_lrintf:
  949|    377|{
  950|    377|	#ifdef USE_SSE2
  951|    377|		return _mm_cvtss_si32 (_mm_load_ss (&x)) ;
  952|       |	#else
  953|       |		return lrintf (x) ;
  954|       |	#endif
  955|    377|} /* psf_lrintf */
mat4.c:psf_lrint:
  958|    579|{
  959|    579|	#ifdef USE_SSE2
  960|    579|		return _mm_cvtsd_si32 (_mm_load_sd (&x)) ;
  961|       |	#else
  962|       |		return lrint (x) ;
  963|       |	#endif
  964|    579|} /* psf_lrintf */
mat5.c:psf_lrint:
  958|      2|{
  959|      2|	#ifdef USE_SSE2
  960|      2|		return _mm_cvtsd_si32 (_mm_load_sd (&x)) ;
  961|       |	#else
  962|       |		return lrint (x) ;
  963|       |	#endif
  964|      2|} /* psf_lrintf */
sds.c:arith_shift_left:
 1080|   102M|{	return (int32_t) (((uint32_t) x) << shift) ;
 1081|   102M|} /* arith_shift_left */
wavlike.c:make_size_t:
  272|  2.20k|{	return (size_t) x ;
  273|  2.20k|} /* make_size_t */
wavlike.c:psf_cues_points:
  983|    705|{	return cues->cue_points ;
  984|    705|} /* psf_cues_points */
wavlike.c:peak_info_calloc:
  226|  10.7k|{	return calloc (1, sizeof (PEAK_INFO) + channels * sizeof (PEAK_POS)) ;
  227|  10.7k|} /* peak_info_calloc */
wav.c:psf_cues_points:
  983|    901|{	return cues->cue_points ;
  984|    901|} /* psf_cues_points */
xi.c:arith_shift_left:
 1080|    194|{	return (int32_t) (((uint32_t) x) << shift) ;
 1081|    194|} /* arith_shift_left */
mpc2k.c:make_size_t:
  272|     15|{	return (size_t) x ;
  273|     15|} /* make_size_t */
dwvw.c:arith_shift_left:
 1080|  14.8M|{	return (int32_t) (((uint32_t) x) << shift) ;
 1081|  14.8M|} /* arith_shift_left */

double64_init:
   92|    351|{	static int double64_caps ;
   93|       |
   94|    351|	if (psf->sf.channels < 1 || psf->sf.channels > SF_MAX_CHANNELS)
  ------------------
  |  |   95|    319|#define		SF_MAX_CHANNELS		1024
  ------------------
  |  Branch (94:6): [True: 32, False: 319]
  |  Branch (94:30): [True: 11, False: 308]
  ------------------
   95|     43|	{	psf_log_printf (psf, "double64_init : internal error : channels = %d\n", psf->sf.channels) ;
   96|     43|		return SFE_INTERNAL ;
   97|    308|		} ;
   98|       |
   99|    308|	double64_caps = double64_get_capability (psf) ;
  100|       |
  101|    308|	psf->blockwidth = sizeof (double) * psf->sf.channels ;
  102|       |
  103|    308|	if (psf->file.mode == SFM_READ || psf->file.mode == SFM_RDWR)
  ------------------
  |  Branch (103:6): [True: 308, False: 0]
  |  Branch (103:36): [True: 0, False: 0]
  ------------------
  104|    308|	{	switch (psf->endian + double64_caps)
  105|    308|		{	case (SF_ENDIAN_BIG + DOUBLE_CAN_RW_BE) :
  ------------------
  |  Branch (105:5): [True: 0, False: 308]
  ------------------
  106|      0|					psf->data_endswap = SF_FALSE ;
  107|      0|					psf->read_short		= host_read_d2s ;
  108|      0|					psf->read_int		= host_read_d2i ;
  109|      0|					psf->read_float		= host_read_d2f ;
  110|      0|					psf->read_double	= host_read_d ;
  111|      0|					break ;
  112|       |
  113|    189|			case (SF_ENDIAN_LITTLE + DOUBLE_CAN_RW_LE) :
  ------------------
  |  Branch (113:4): [True: 189, False: 119]
  ------------------
  114|    189|					psf->data_endswap = SF_FALSE ;
  115|    189|					psf->read_short		= host_read_d2s ;
  116|    189|					psf->read_int		= host_read_d2i ;
  117|    189|					psf->read_float		= host_read_d2f ;
  118|    189|					psf->read_double	= host_read_d ;
  119|    189|					break ;
  120|       |
  121|    119|			case (SF_ENDIAN_BIG + DOUBLE_CAN_RW_LE) :
  ------------------
  |  Branch (121:4): [True: 119, False: 189]
  ------------------
  122|    119|					psf->data_endswap = SF_TRUE ;
  123|    119|					psf->read_short		= host_read_d2s ;
  124|    119|					psf->read_int		= host_read_d2i ;
  125|    119|					psf->read_float		= host_read_d2f ;
  126|    119|					psf->read_double	= host_read_d ;
  127|    119|					break ;
  128|       |
  129|      0|			case (SF_ENDIAN_LITTLE + DOUBLE_CAN_RW_BE) :
  ------------------
  |  Branch (129:4): [True: 0, False: 308]
  ------------------
  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: 308]
  ------------------
  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: 308]
  ------------------
  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: 308]
  ------------------
  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: 308]
  ------------------
  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: 308]
  ------------------
  171|    308|			} ;
  172|    308|		} ;
  173|       |
  174|    308|	if (psf->file.mode == SFM_WRITE || psf->file.mode == SFM_RDWR)
  ------------------
  |  Branch (174:6): [True: 0, False: 308]
  |  Branch (174:37): [True: 0, False: 308]
  ------------------
  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|    308|		} ;
  244|       |
  245|    308|	if (psf->filelength > psf->dataoffset)
  ------------------
  |  Branch (245:6): [True: 179, False: 129]
  ------------------
  246|    179|	{	psf->datalength = (psf->dataend > 0) ? psf->dataend - psf->dataoffset :
  ------------------
  |  Branch (246:22): [True: 4, False: 175]
  ------------------
  247|    179|							psf->filelength - psf->dataoffset ;
  248|    179|		}
  249|    129|	else
  250|    129|		psf->datalength = 0 ;
  251|       |
  252|    308|	psf->sf.frames = psf->datalength / psf->blockwidth ;
  253|       |
  254|    308|	return 0 ;
  255|    308|} /* double64_init */
double64_be_read:
  285|  2.64k|{	int		exponent, negative, upper, lower ;
  286|  2.64k|	double	dvalue ;
  287|       |
  288|  2.64k|	negative = (cptr [0] & 0x80) ? 1 : 0 ;
  ------------------
  |  Branch (288:13): [True: 282, False: 2.36k]
  ------------------
  289|  2.64k|	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.64k|	upper = (((cptr [1] & 0xF) << 24) | (cptr [2] << 16) | (cptr [3] << 8) | cptr [4]) ;
  293|  2.64k|	lower = (cptr [5] << 16) | (cptr [6] << 8) | cptr [7] ;
  294|       |
  295|  2.64k|	if (exponent == 0 && upper == 0 && lower == 0)
  ------------------
  |  Branch (295:6): [True: 533, False: 2.11k]
  |  Branch (295:23): [True: 242, False: 291]
  |  Branch (295:37): [True: 206, False: 36]
  ------------------
  296|    206|		return 0.0 ;
  297|       |
  298|  2.43k|	dvalue = upper + lower / ((double) 0x1000000) ;
  299|  2.43k|	dvalue += 0x10000000 ;
  300|       |
  301|  2.43k|	exponent = exponent - 0x3FF ;
  302|       |
  303|  2.43k|	dvalue = dvalue / ((double) 0x10000000) ;
  304|       |
  305|  2.43k|	if (negative)
  ------------------
  |  Branch (305:6): [True: 282, False: 2.15k]
  ------------------
  306|    282|		dvalue *= -1 ;
  307|       |
  308|  2.43k|	if (exponent > 0)
  ------------------
  |  Branch (308:6): [True: 1.62k, False: 814]
  ------------------
  309|  1.62k|		dvalue *= pow (2.0, exponent) ;
  310|    814|	else if (exponent < 0)
  ------------------
  |  Branch (310:11): [True: 785, False: 29]
  ------------------
  311|    785|		dvalue /= pow (2.0, abs (exponent)) ;
  312|       |
  313|  2.43k|	return dvalue ;
  314|  2.64k|} /* double64_be_read */
double64_le_read:
  318|    471|{	int		exponent, negative, upper, lower ;
  319|    471|	double	dvalue ;
  320|       |
  321|    471|	negative = (cptr [7] & 0x80) ? 1 : 0 ;
  ------------------
  |  Branch (321:13): [True: 125, False: 346]
  ------------------
  322|    471|	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|    471|	upper = ((cptr [6] & 0xF) << 24) | (cptr [5] << 16) | (cptr [4] << 8) | cptr [3] ;
  326|    471|	lower = (cptr [2] << 16) | (cptr [1] << 8) | cptr [0] ;
  327|       |
  328|    471|	if (exponent == 0 && upper == 0 && lower == 0)
  ------------------
  |  Branch (328:6): [True: 198, False: 273]
  |  Branch (328:23): [True: 108, False: 90]
  |  Branch (328:37): [True: 55, False: 53]
  ------------------
  329|     55|		return 0.0 ;
  330|       |
  331|    416|	dvalue = upper + lower / ((double) 0x1000000) ;
  332|    416|	dvalue += 0x10000000 ;
  333|       |
  334|    416|	exponent = exponent - 0x3FF ;
  335|       |
  336|    416|	dvalue = dvalue / ((double) 0x10000000) ;
  337|       |
  338|    416|	if (negative)
  ------------------
  |  Branch (338:6): [True: 125, False: 291]
  ------------------
  339|    125|		dvalue *= -1 ;
  340|       |
  341|    416|	if (exponent > 0)
  ------------------
  |  Branch (341:6): [True: 141, False: 275]
  ------------------
  342|    141|		dvalue *= pow (2.0, exponent) ;
  343|    275|	else if (exponent < 0)
  ------------------
  |  Branch (343:11): [True: 274, False: 1]
  ------------------
  344|    274|		dvalue /= pow (2.0, abs (exponent)) ;
  345|       |
  346|    416|	return dvalue ;
  347|    471|} /* double64_le_read */
double64.c:double64_get_capability:
  459|    308|{	union
  460|    308|	{	double			d ;
  461|    308|		unsigned char	c [8] ;
  462|    308|	} data ;
  463|       |
  464|    308|	data.d = 1.234567890123456789 ; /* Some arbitrary value. */
  465|       |
  466|    308|	if (! psf->ieee_replace)
  ------------------
  |  Branch (466:6): [True: 308, False: 0]
  ------------------
  467|    308|	{	/* If this test is true ints and floats are compatible and little endian. */
  468|    308|		if (data.c [0] == 0xfb && data.c [1] == 0x59 && data.c [2] == 0x8c && data.c [3] == 0x42 &&
  ------------------
  |  Branch (468:7): [True: 308, False: 0]
  |  Branch (468:29): [True: 308, False: 0]
  |  Branch (468:51): [True: 308, False: 0]
  |  Branch (468:73): [True: 308, False: 0]
  ------------------
  469|    308|			data.c [4] == 0xca && data.c [5] == 0xc0 && data.c [6] == 0xf3 && data.c [7] == 0x3f)
  ------------------
  |  Branch (469:4): [True: 308, False: 0]
  |  Branch (469:26): [True: 308, False: 0]
  |  Branch (469:48): [True: 308, False: 0]
  |  Branch (469:70): [True: 308, False: 0]
  ------------------
  470|    308|			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|    308|} /* double64_get_capability */
double64.c:host_read_d2f:
  622|    615|{	BUF_UNION	ubuf ;
  623|    615|	int			bufferlen, readcount ;
  624|    615|	sf_count_t	total = 0 ;
  625|       |
  626|    615|	bufferlen = ARRAY_LEN (ubuf.dbuf) ;
  ------------------
  |  |   88|    615|#define		ARRAY_LEN(x)	((int) (sizeof (x) / sizeof ((x) [0])))
  ------------------
  627|       |
  628|  1.20k|	while (len > 0)
  ------------------
  |  Branch (628:9): [True: 615, False: 586]
  ------------------
  629|    615|	{	if (len < bufferlen)
  ------------------
  |  Branch (629:8): [True: 420, False: 195]
  ------------------
  630|    420|			bufferlen = (int) len ;
  631|    615|		readcount = (int) psf_fread (ubuf.dbuf, sizeof (double), bufferlen, psf) ;
  632|       |
  633|    615|		if (psf->data_endswap == SF_TRUE)
  ------------------
  |  Branch (633:7): [True: 406, False: 209]
  ------------------
  634|    406|			endswap_double_array (ubuf.dbuf, readcount) ;
  635|       |
  636|    615|		d2f_array (ubuf.dbuf, readcount, ptr + total) ;
  637|    615|		total += readcount ;
  638|    615|		len -= readcount ;
  639|    615|		if (readcount < bufferlen)
  ------------------
  |  Branch (639:7): [True: 29, False: 586]
  ------------------
  640|     29|			break ;
  641|    615|		} ;
  642|       |
  643|    615|	return total ;
  644|    615|} /* host_read_d2f */
double64.c:d2f_array:
  531|   191k|{	for (int i = 0 ; i < count ; i++)
  ------------------
  |  Branch (531:20): [True: 191k, False: 615]
  ------------------
  532|   191k|	{	dest [i] = src [i] ;
  533|   191k|		} ;
  534|    615|} /* 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|    259|{	DWVW_PRIVATE	*pdwvw ;
   81|       |
   82|    259|	if (psf->codec_data != NULL)
  ------------------
  |  Branch (82:6): [True: 0, False: 259]
  ------------------
   83|      0|	{	psf_log_printf (psf, "*** psf->codec_data is not NULL.\n") ;
   84|      0|		return SFE_INTERNAL ;
   85|    259|		} ;
   86|       |
   87|    259|	if (bitwidth > 24)
  ------------------
  |  Branch (87:6): [True: 0, False: 259]
  ------------------
   88|      0|		return SFE_DWVW_BAD_BITWIDTH ;
   89|       |
   90|    259|	if (psf->file.mode == SFM_RDWR)
  ------------------
  |  Branch (90:6): [True: 0, False: 259]
  ------------------
   91|      0|		return SFE_BAD_MODE_RW ;
   92|       |
   93|    259|	if ((pdwvw = calloc (1, sizeof (DWVW_PRIVATE))) == NULL)
  ------------------
  |  Branch (93:6): [True: 0, False: 259]
  ------------------
   94|      0|		return SFE_MALLOC_FAILED ;
   95|       |
   96|    259|	psf->codec_data = (void*) pdwvw ;
   97|    259|	pdwvw->bit_width 	= bitwidth ;
   98|    259|	dwvw_read_reset (pdwvw) ;
   99|       |
  100|    259|	if (psf->file.mode == SFM_READ)
  ------------------
  |  Branch (100:6): [True: 259, False: 0]
  ------------------
  101|    259|	{	psf->read_short		= dwvw_read_s ;
  102|    259|		psf->read_int		= dwvw_read_i ;
  103|    259|		psf->read_float		= dwvw_read_f ;
  104|    259|		psf->read_double	= dwvw_read_d ;
  105|    259|		} ;
  106|       |
  107|    259|	if (psf->file.mode == SFM_WRITE)
  ------------------
  |  Branch (107:6): [True: 0, False: 259]
  ------------------
  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|    259|	psf->codec_close = dwvw_close ;
  115|    259|	psf->seek = dwvw_seek ;
  116|    259|	psf->byterate = dwvw_byterate ;
  117|       |
  118|    259|	if (psf->file.mode == SFM_READ)
  ------------------
  |  Branch (118:6): [True: 259, False: 0]
  ------------------
  119|    259|	{	psf->sf.frames = psf_decode_frame_count (psf) ;
  120|    259|		dwvw_read_reset (pdwvw) ;
  121|    259|		} ;
  122|       |
  123|    259|	return 0 ;
  124|    259|} /* dwvw_init */
dwvw.c:dwvw_close:
  131|    259|{	DWVW_PRIVATE *pdwvw ;
  132|       |
  133|    259|	if (psf->codec_data == NULL)
  ------------------
  |  Branch (133:6): [True: 0, False: 259]
  ------------------
  134|      0|		return 0 ;
  135|    259|	pdwvw = (DWVW_PRIVATE*) psf->codec_data ;
  136|       |
  137|    259|	if (psf->file.mode == SFM_WRITE)
  ------------------
  |  Branch (137:6): [True: 0, False: 259]
  ------------------
  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|    259|	return 0 ;
  151|    259|} /* dwvw_close */
dwvw.c:dwvw_decode_data:
  306|  10.6k|{	int	count ;
  307|  10.6k|	int delta_width_modifier, delta_width, delta_negative, delta, sample ;
  308|       |
  309|       |	/* Restore state from last decode call. */
  310|  10.6k|	delta_width = pdwvw->last_delta_width ;
  311|  10.6k|	sample = pdwvw->last_sample ;
  312|       |
  313|  7.27M|	for (count = 0 ; count < len ; count++)
  ------------------
  |  Branch (313:19): [True: 7.26M, False: 10.2k]
  ------------------
  314|  7.26M|	{	/* If bit_count parameter is zero get the delta_width_modifier. */
  315|  7.26M|		delta_width_modifier = dwvw_decode_load_bits (psf, pdwvw, -1) ;
  316|       |
  317|       |		/* Check for end of input bit stream. Break loop if end. */
  318|  7.26M|		if (delta_width_modifier < 0 || (pdwvw->b.end == 0 && count == 0))
  ------------------
  |  Branch (318:7): [True: 120, False: 7.26M]
  |  Branch (318:36): [True: 123k, False: 7.14M]
  |  Branch (318:57): [True: 208, False: 122k]
  ------------------
  319|    328|			break ;
  320|       |
  321|  7.26M|		if (delta_width_modifier && dwvw_decode_load_bits (psf, pdwvw, 1))
  ------------------
  |  Branch (321:7): [True: 1.93M, False: 5.33M]
  |  Branch (321:31): [True: 485k, False: 1.44M]
  ------------------
  322|   485k|			delta_width_modifier = - delta_width_modifier ;
  323|       |
  324|       |		/* Calculate the current word width. */
  325|  7.26M|		delta_width = (delta_width + delta_width_modifier + pdwvw->bit_width) % pdwvw->bit_width ;
  326|       |
  327|       |		/* Load the delta. */
  328|  7.26M|		delta = 0 ;
  329|  7.26M|		if (delta_width)
  ------------------
  |  Branch (329:7): [True: 5.45M, False: 1.80M]
  ------------------
  330|  5.45M|		{	delta = dwvw_decode_load_bits (psf, pdwvw, delta_width - 1) | (1 << (delta_width - 1)) ;
  331|  5.45M|			delta_negative = dwvw_decode_load_bits (psf, pdwvw, 1) ;
  332|  5.45M|			if (delta == pdwvw->max_delta - 1)
  ------------------
  |  Branch (332:8): [True: 289k, False: 5.16M]
  ------------------
  333|   289k|				delta += dwvw_decode_load_bits (psf, pdwvw, 1) ;
  334|  5.45M|			if (delta_negative)
  ------------------
  |  Branch (334:8): [True: 3.37M, False: 2.07M]
  ------------------
  335|  3.37M|				delta = -delta ;
  336|  5.45M|			} ;
  337|       |
  338|       |		/* Calculate the sample */
  339|  7.26M|		sample += delta ;
  340|       |
  341|  7.26M|		if (sample >= pdwvw->max_delta)
  ------------------
  |  Branch (341:7): [True: 181k, False: 7.08M]
  ------------------
  342|   181k|			sample -= pdwvw->span ;
  343|  7.08M|		else if (sample < - pdwvw->max_delta)
  ------------------
  |  Branch (343:12): [True: 301k, False: 6.78M]
  ------------------
  344|   301k|			sample += pdwvw->span ;
  345|       |
  346|       |		/* Store the sample justifying to the most significant bit. */
  347|  7.26M|		ptr [count] = arith_shift_left (sample, 32 - pdwvw->bit_width) ;
  348|       |
  349|  7.26M|		if (pdwvw->b.end == 0 && pdwvw->bit_count == 0)
  ------------------
  |  Branch (349:7): [True: 122k, False: 7.14M]
  |  Branch (349:28): [True: 100, False: 122k]
  ------------------
  350|    100|			break ;
  351|  7.26M|		} ;
  352|       |
  353|  10.6k|	pdwvw->last_delta_width = delta_width ;
  354|  10.6k|	pdwvw->last_sample = sample ;
  355|       |
  356|  10.6k|	pdwvw->samplecount += count ;
  357|       |
  358|  10.6k|	return count ;
  359|  10.6k|} /* dwvw_decode_data */
dwvw.c:dwvw_decode_load_bits:
  363|  20.4M|{	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|  20.4M|	if (bit_count < 0)
  ------------------
  |  Branch (371:6): [True: 7.26M, False: 13.1M]
  ------------------
  372|  7.26M|	{	get_dwm = SF_TRUE ;
  373|       |		/* modify bit_count to ensure we have enough bits for finding dwm. */
  374|  7.26M|		bit_count = pdwvw->dwm_maxsize ;
  375|  7.26M|		} ;
  376|       |
  377|       |	/* Load bits in bit reseviour. */
  378|  27.9M|	while (pdwvw->bit_count < bit_count)
  ------------------
  |  Branch (378:9): [True: 7.63M, False: 20.3M]
  ------------------
  379|  7.63M|	{	if (pdwvw->b.index >= pdwvw->b.end)
  ------------------
  |  Branch (379:8): [True: 422k, False: 7.21M]
  ------------------
  380|   422k|		{	pdwvw->b.end = (int) psf_fread (pdwvw->b.buffer, 1, sizeof (pdwvw->b.buffer), psf) ;
  381|   422k|			pdwvw->b.index = 0 ;
  382|   422k|			} ;
  383|       |
  384|       |		/* Check for end of input stream. */
  385|  7.63M|		if (bit_count < 8 && pdwvw->b.end == 0)
  ------------------
  |  Branch (385:7): [True: 1.82M, False: 5.80M]
  |  Branch (385:24): [True: 40.8k, False: 1.78M]
  ------------------
  386|  40.8k|			return -1 ;
  387|       |
  388|  7.59M|		pdwvw->bits = arith_shift_left (pdwvw->bits, 8) ;
  389|       |
  390|  7.59M|		if (pdwvw->b.index < pdwvw->b.end)
  ------------------
  |  Branch (390:7): [True: 7.24M, False: 353k]
  ------------------
  391|  7.24M|		{	pdwvw->bits |= pdwvw->b.buffer [pdwvw->b.index] ;
  392|  7.24M|			pdwvw->b.index ++ ;
  393|  7.24M|			} ;
  394|  7.59M|		pdwvw->bit_count += 8 ;
  395|  20.3M|		} ;
  396|       |
  397|       |	/* If asked to get bits do so. */
  398|  20.3M|	if (! get_dwm)
  ------------------
  |  Branch (398:6): [True: 13.0M, False: 7.26M]
  ------------------
  399|  13.0M|	{	output = (pdwvw->bits >> (pdwvw->bit_count - bit_count)) & ((1 << bit_count) - 1) ;
  400|  13.0M|		pdwvw->bit_count -= bit_count ;
  401|  13.0M|		return output ;
  402|  13.0M|		} ;
  403|       |
  404|       |	/* Otherwise must have been asked to get delta_width_modifier. */
  405|  14.4M|	while (output < (pdwvw->dwm_maxsize))
  ------------------
  |  Branch (405:9): [True: 14.0M, False: 371k]
  ------------------
  406|  14.0M|	{	pdwvw->bit_count -= 1 ;
  407|  14.0M|		if (pdwvw->bits & (1 << pdwvw->bit_count))
  ------------------
  |  Branch (407:7): [True: 6.89M, False: 7.19M]
  ------------------
  408|  6.89M|			break ;
  409|  7.19M|		output += 1 ;
  410|  7.19M|		} ;
  411|       |
  412|  7.26M|	return output ;
  413|  20.3M|} /* dwvw_decode_load_bits */
dwvw.c:dwvw_read_i:
  217|  3.23k|{	DWVW_PRIVATE *pdwvw ;
  218|  3.23k|	int			readcount, count ;
  219|  3.23k|	sf_count_t	total = 0 ;
  220|       |
  221|  3.23k|	if (! psf->codec_data)
  ------------------
  |  Branch (221:6): [True: 0, False: 3.23k]
  ------------------
  222|      0|		return 0 ;
  223|  3.23k|	pdwvw = (DWVW_PRIVATE*) psf->codec_data ;
  224|       |
  225|  6.06k|	while (len > 0)
  ------------------
  |  Branch (225:9): [True: 3.23k, False: 2.83k]
  ------------------
  226|  3.23k|	{	readcount = (len > 0x10000000) ? 0x10000000 : (int) len ;
  ------------------
  |  Branch (226:16): [True: 0, False: 3.23k]
  ------------------
  227|       |
  228|  3.23k|		count = dwvw_decode_data (psf, pdwvw, ptr, readcount) ;
  229|       |
  230|  3.23k|		total += count ;
  231|  3.23k|		len -= count ;
  232|       |
  233|  3.23k|		if (count != readcount)
  ------------------
  |  Branch (233:7): [True: 405, False: 2.83k]
  ------------------
  234|    405|			break ;
  235|  3.23k|		} ;
  236|       |
  237|  3.23k|	return total ;
  238|  3.23k|} /* dwvw_read_i */
dwvw.c:dwvw_read_f:
  242|  7.41k|{	DWVW_PRIVATE *pdwvw ;
  243|  7.41k|	BUF_UNION	ubuf ;
  244|  7.41k|	int			*iptr ;
  245|  7.41k|	int			k, bufferlen, readcount = 0, count ;
  246|  7.41k|	sf_count_t	total = 0 ;
  247|  7.41k|	float	normfact ;
  248|       |
  249|  7.41k|	if (! psf->codec_data)
  ------------------
  |  Branch (249:6): [True: 0, False: 7.41k]
  ------------------
  250|      0|		return 0 ;
  251|  7.41k|	pdwvw = (DWVW_PRIVATE*) psf->codec_data ;
  252|       |
  253|  7.41k|	normfact = (psf->norm_float == SF_TRUE) ? 1.0 / ((float) 0x80000000) : 1.0 ;
  ------------------
  |  Branch (253:13): [True: 7.41k, False: 0]
  ------------------
  254|       |
  255|  7.41k|	iptr = ubuf.ibuf ;
  256|  7.41k|	bufferlen = ARRAY_LEN (ubuf.ibuf) ;
  ------------------
  |  |   88|  7.41k|#define		ARRAY_LEN(x)	((int) (sizeof (x) / sizeof ((x) [0])))
  ------------------
  257|  14.8k|	while (len > 0)
  ------------------
  |  Branch (257:9): [True: 7.41k, False: 7.39k]
  ------------------
  258|  7.41k|	{	readcount = (len >= bufferlen) ? bufferlen : (int) len ;
  ------------------
  |  Branch (258:16): [True: 0, False: 7.41k]
  ------------------
  259|  7.41k|		count = dwvw_decode_data (psf, pdwvw, iptr, readcount) ;
  260|  2.63M|		for (k = 0 ; k < readcount ; k++)
  ------------------
  |  Branch (260:16): [True: 2.62M, False: 7.41k]
  ------------------
  261|  2.62M|			ptr [total + k] = normfact * (float) (iptr [k]) ;
  262|       |
  263|  7.41k|		total += count ;
  264|  7.41k|		len -= readcount ;
  265|  7.41k|		if (count != readcount)
  ------------------
  |  Branch (265:7): [True: 23, False: 7.39k]
  ------------------
  266|     23|			break ;
  267|  7.41k|		} ;
  268|       |
  269|  7.41k|	return total ;
  270|  7.41k|} /* dwvw_read_f */
dwvw.c:dwvw_read_reset:
  417|    518|{	int bitwidth = pdwvw->bit_width ;
  418|       |
  419|    518|	memset (pdwvw, 0, sizeof (DWVW_PRIVATE)) ;
  420|       |
  421|    518|	pdwvw->bit_width	= bitwidth ;
  422|    518|	pdwvw->dwm_maxsize	= bitwidth / 2 ;
  423|    518|	pdwvw->max_delta	= 1 << (bitwidth - 1) ;
  424|    518|	pdwvw->span			= 1 << bitwidth ;
  425|    518|} /* dwvw_read_reset */

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

sf_open_virtual:
  473|  20.2k|{	SF_PRIVATE 	*psf ;
  474|       |
  475|       |	/* Make sure we have a valid set of virtual pointers. */
  476|  20.2k|	if (sfvirtual->get_filelen == NULL)
  ------------------
  |  Branch (476:6): [True: 0, False: 20.2k]
  ------------------
  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|  20.2k|		} ;
  481|       |
  482|  20.2k|	if ((sfvirtual->seek == NULL || sfvirtual->tell == NULL) && sfinfo->seekable)
  ------------------
  |  Branch (482:7): [True: 0, False: 20.2k]
  |  Branch (482:34): [True: 0, False: 20.2k]
  |  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|  20.2k|		} ;
  487|       |
  488|  20.2k|	if ((mode == SFM_READ || mode == SFM_RDWR) && sfvirtual->read == NULL)
  ------------------
  |  Branch (488:7): [True: 20.2k, False: 0]
  |  Branch (488:27): [True: 0, False: 0]
  |  Branch (488:48): [True: 0, False: 20.2k]
  ------------------
  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|  20.2k|		} ;
  493|       |
  494|  20.2k|	if ((mode == SFM_WRITE || mode == SFM_RDWR) && sfvirtual->write == NULL)
  ------------------
  |  Branch (494:7): [True: 0, False: 20.2k]
  |  Branch (494:28): [True: 0, False: 20.2k]
  |  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|  20.2k|		} ;
  499|       |
  500|  20.2k|	if ((psf = psf_allocate ()) == NULL)
  ------------------
  |  Branch (500:6): [True: 0, False: 20.2k]
  ------------------
  501|      0|	{	sf_errno = SFE_MALLOC_FAILED ;
  502|      0|		return	NULL ;
  503|  20.2k|		} ;
  504|       |
  505|  20.2k|	psf_init_files (psf) ;
  506|       |
  507|  20.2k|	psf->virtual_io = SF_TRUE ;
  508|  20.2k|	psf->vio = *sfvirtual ;
  509|  20.2k|	psf->vio_user_data = user_data ;
  510|       |
  511|  20.2k|	psf->file.mode = mode ;
  512|       |
  513|  20.2k|	return psf_open_file (psf, sfinfo) ;
  514|  20.2k|} /* sf_open_virtual */
sf_close:
  518|  3.03k|{	SF_PRIVATE	*psf ;
  519|       |
  520|  3.03k|	VALIDATE_SNDFILE_AND_ASSIGN_PSF (sndfile, psf, 1) ;
  ------------------
  |  |  326|  3.03k|		{	if ((a) == NULL)						\
  |  |  ------------------
  |  |  |  Branch (326:9): [True: 0, False: 3.03k]
  |  |  ------------------
  |  |  327|  3.03k|			{	sf_errno = SFE_BAD_SNDFILE_PTR ;	\
  |  |  328|      0|				return 0 ;							\
  |  |  329|  3.03k|				} ;									\
  |  |  330|  3.03k|			(b) = (SF_PRIVATE*) (a) ;				\
  |  |  331|  3.03k|			if ((b)->virtual_io == SF_FALSE &&		\
  |  |  ------------------
  |  |  |  Branch (331:8): [True: 0, False: 3.03k]
  |  |  ------------------
  |  |  332|  3.03k|				psf_file_valid (b) == 0)			\
  |  |  ------------------
  |  |  |  Branch (332:5): [True: 0, False: 0]
  |  |  ------------------
  |  |  333|  3.03k|			{	(b)->error = SFE_BAD_FILE_PTR ;		\
  |  |  334|      0|				return 0 ;							\
  |  |  335|  3.03k|				} ;									\
  |  |  336|  3.03k|			if ((b)->Magick != SNDFILE_MAGICK)		\
  |  |  ------------------
  |  |  |  |   41|  3.03k|#define		SNDFILE_MAGICK	0x1234C0DE
  |  |  ------------------
  |  |  |  Branch (336:8): [True: 0, False: 3.03k]
  |  |  ------------------
  |  |  337|  3.03k|			{	(b)->error = SFE_BAD_SNDFILE_PTR ;	\
  |  |  338|      0|				return 0 ;							\
  |  |  339|  3.03k|				} ;									\
  |  |  340|  3.03k|			if (c) (b)->error = 0 ;					\
  |  |  ------------------
  |  |  |  Branch (340:8): [True: 3.03k, Folded]
  |  |  ------------------
  |  |  341|  3.03k|			}
  ------------------
  521|       |
  522|  3.03k|	return psf_close (psf) ;
  523|  6.06k|} /* sf_close */
sf_error_number:
  542|  15.9k|{	static const char *bad_errnum =
  543|  15.9k|		"No error defined for this error number. This is a bug in libsndfile." ;
  544|  15.9k|	int	k ;
  545|       |
  546|  15.9k|	if (errnum == SFE_MAX_ERROR)
  ------------------
  |  Branch (546:6): [True: 0, False: 15.9k]
  ------------------
  547|      0|		return SndfileErrors [0].str ;
  548|       |
  549|  15.9k|	if (errnum < 0 || errnum > SFE_MAX_ERROR)
  ------------------
  |  Branch (549:6): [True: 0, False: 15.9k]
  |  Branch (549:20): [True: 0, False: 15.9k]
  ------------------
  550|      0|	{	/* This really shouldn't happen in release versions. */
  551|      0|		printf ("Not a valid error number (%d).\n", errnum) ;
  552|      0|		return bad_errnum ;
  553|  15.9k|		} ;
  554|       |
  555|   946k|	for (k = 0 ; SndfileErrors [k].str ; k++)
  ------------------
  |  Branch (555:15): [True: 946k, False: 0]
  ------------------
  556|   946k|		if (errnum == SndfileErrors [k].error)
  ------------------
  |  Branch (556:7): [True: 15.9k, False: 930k]
  ------------------
  557|  15.9k|			return SndfileErrors [k].str ;
  558|       |
  559|      0|	return bad_errnum ;
  560|  15.9k|} /* sf_error_number */
sf_readf_float:
 2026|   168M|{	SF_PRIVATE 	*psf ;
 2027|   168M|	sf_count_t	count, extra ;
 2028|       |
 2029|   168M|	if (frames == 0)
  ------------------
  |  Branch (2029:6): [True: 0, False: 168M]
  ------------------
 2030|      0|		return 0 ;
 2031|       |
 2032|   674M|	VALIDATE_SNDFILE_AND_ASSIGN_PSF (sndfile, psf, 1) ;
  ------------------
  |  |  326|   168M|		{	if ((a) == NULL)						\
  |  |  ------------------
  |  |  |  Branch (326:9): [True: 0, False: 168M]
  |  |  ------------------
  |  |  327|   168M|			{	sf_errno = SFE_BAD_SNDFILE_PTR ;	\
  |  |  328|      0|				return 0 ;							\
  |  |  329|   168M|				} ;									\
  |  |  330|   168M|			(b) = (SF_PRIVATE*) (a) ;				\
  |  |  331|   168M|			if ((b)->virtual_io == SF_FALSE &&		\
  |  |  ------------------
  |  |  |  Branch (331:8): [True: 0, False: 168M]
  |  |  ------------------
  |  |  332|   168M|				psf_file_valid (b) == 0)			\
  |  |  ------------------
  |  |  |  Branch (332:5): [True: 0, False: 0]
  |  |  ------------------
  |  |  333|   168M|			{	(b)->error = SFE_BAD_FILE_PTR ;		\
  |  |  334|      0|				return 0 ;							\
  |  |  335|   168M|				} ;									\
  |  |  336|   168M|			if ((b)->Magick != SNDFILE_MAGICK)		\
  |  |  ------------------
  |  |  |  |   41|   168M|#define		SNDFILE_MAGICK	0x1234C0DE
  |  |  ------------------
  |  |  |  Branch (336:8): [True: 0, False: 168M]
  |  |  ------------------
  |  |  337|   168M|			{	(b)->error = SFE_BAD_SNDFILE_PTR ;	\
  |  |  338|      0|				return 0 ;							\
  |  |  339|   168M|				} ;									\
  |  |  340|   168M|			if (c) (b)->error = 0 ;					\
  |  |  ------------------
  |  |  |  Branch (340:8): [True: 168M, Folded]
  |  |  ------------------
  |  |  341|   168M|			}
  ------------------
 2033|       |
 2034|   674M|	if (frames <= 0)
  ------------------
  |  Branch (2034:6): [True: 0, False: 168M]
  ------------------
 2035|      0|	{	psf->error = SFE_NEGATIVE_RW_LEN ;
 2036|      0|		return 0 ;
 2037|   168M|		} ;
 2038|       |
 2039|   168M|	if (psf->file.mode == SFM_WRITE)
  ------------------
  |  Branch (2039:6): [True: 0, False: 168M]
  ------------------
 2040|      0|	{	psf->error = SFE_NOT_READMODE ;
 2041|      0|		return 0 ;
 2042|   168M|		} ;
 2043|       |
 2044|   168M|	if (psf->read_current >= psf->sf.frames)
  ------------------
  |  Branch (2044:6): [True: 2.09k, False: 168M]
  ------------------
 2045|  2.09k|	{	psf_memset (ptr, 0, frames * psf->sf.channels * sizeof (float)) ;
 2046|  2.09k|		return 0 ;
 2047|   168M|		} ;
 2048|       |
 2049|   168M|	if (psf->read_float == NULL || psf->seek == NULL)
  ------------------
  |  Branch (2049:6): [True: 1, False: 168M]
  |  Branch (2049:33): [True: 0, False: 168M]
  ------------------
 2050|      1|	{	psf->error = SFE_UNIMPLEMENTED ;
 2051|      1|		return	0 ;
 2052|   168M|		} ;
 2053|       |
 2054|   168M|	if (psf->last_op != SFM_READ)
  ------------------
  |  Branch (2054:6): [True: 62, False: 168M]
  ------------------
 2055|     62|		if (psf->seek (psf, SFM_READ, psf->read_current) < 0)
  ------------------
  |  Branch (2055:7): [True: 0, False: 62]
  ------------------
 2056|      0|			return 0 ;
 2057|       |
 2058|   168M|	count = psf->read_float (psf, ptr, frames * psf->sf.channels) ;
 2059|       |
 2060|   168M|	if (psf->read_current + count / psf->sf.channels <= psf->sf.frames)
  ------------------
  |  Branch (2060:6): [True: 168M, False: 0]
  ------------------
 2061|   168M|		psf->read_current += count / psf->sf.channels ;
 2062|      0|	else
 2063|      0|	{	count = (psf->sf.frames - psf->read_current) * psf->sf.channels ;
 2064|      0|		extra = frames * psf->sf.channels - count ;
 2065|      0|		psf_memset (ptr + count, 0, extra * sizeof (float)) ;
 2066|      0|		psf->read_current = psf->sf.frames ;
 2067|      0|		} ;
 2068|       |
 2069|   168M|	psf->last_op = SFM_READ ;
 2070|       |
 2071|   168M|	return count / psf->sf.channels ;
 2072|   168M|} /* sf_readf_float */
psf_open_file:
 3016|  20.2k|{	int		error, format ;
 3017|       |
 3018|  20.2k|	sf_errno = error = 0 ;
 3019|  20.2k|	sf_parselog [0] = 0 ;
 3020|       |
 3021|  20.2k|	if (psf->error)
  ------------------
  |  Branch (3021:6): [True: 0, False: 20.2k]
  ------------------
 3022|      0|	{	error = psf->error ;
 3023|      0|		goto error_exit ;
 3024|  20.2k|		} ;
 3025|       |
 3026|  20.2k|	if (psf->file.mode != SFM_READ && psf->file.mode != SFM_WRITE && psf->file.mode != SFM_RDWR)
  ------------------
  |  Branch (3026:6): [True: 0, False: 20.2k]
  |  Branch (3026:36): [True: 0, False: 0]
  |  Branch (3026:67): [True: 0, False: 0]
  ------------------
 3027|      0|	{	error = SFE_BAD_OPEN_MODE ;
 3028|      0|		goto error_exit ;
 3029|  20.2k|		} ;
 3030|       |
 3031|  20.2k|	if (sfinfo == NULL)
  ------------------
  |  Branch (3031:6): [True: 0, False: 20.2k]
  ------------------
 3032|      0|	{	error = SFE_BAD_SF_INFO_PTR ;
 3033|      0|		goto error_exit ;
 3034|  20.2k|		} ;
 3035|       |
 3036|  20.2k|	if (psf->file.mode == SFM_READ)
  ------------------
  |  Branch (3036:6): [True: 20.2k, False: 0]
  ------------------
 3037|  20.2k|	{	if ((SF_CONTAINER (sfinfo->format)) == SF_FORMAT_RAW)
  ------------------
  |  |  101|  20.2k|#define SF_CONTAINER(x)		((x) & SF_FORMAT_TYPEMASK)
  ------------------
  |  Branch (3037:8): [True: 0, False: 20.2k]
  ------------------
 3038|      0|		{	if (sf_format_check (sfinfo) == 0)
  ------------------
  |  Branch (3038:9): [True: 0, False: 0]
  ------------------
 3039|      0|			{	error = SFE_RAW_BAD_FORMAT ;
 3040|      0|				goto error_exit ;
 3041|      0|				} ;
 3042|      0|			}
 3043|  20.2k|		else
 3044|  20.2k|			memset (sfinfo, 0, sizeof (SF_INFO)) ;
 3045|  20.2k|		} ;
 3046|       |
 3047|  20.2k|	memcpy (&psf->sf, sfinfo, sizeof (SF_INFO)) ;
 3048|       |
 3049|  20.2k|	psf->Magick 		= SNDFILE_MAGICK ;
  ------------------
  |  |   41|  20.2k|#define		SNDFILE_MAGICK	0x1234C0DE
  ------------------
 3050|  20.2k|	psf->norm_float 	= SF_TRUE ;
 3051|  20.2k|	psf->norm_double	= SF_TRUE ;
 3052|  20.2k|	psf->dataoffset		= -1 ;
 3053|  20.2k|	psf->datalength		= -1 ;
 3054|  20.2k|	psf->read_current	= -1 ;
 3055|  20.2k|	psf->write_current	= -1 ;
 3056|  20.2k|	psf->auto_header 	= SF_FALSE ;
 3057|  20.2k|	psf->rwf_endian		= SF_ENDIAN_LITTLE ;
 3058|  20.2k|	psf->seek			= psf_default_seek ;
 3059|  20.2k|	psf->float_int_mult = 0 ;
 3060|  20.2k|	psf->float_max		= -1.0 ;
 3061|       |
 3062|       |	/* An attempt at a per SF_PRIVATE unique id. */
 3063|  20.2k|	psf->unique_id		= psf_rand_int32 () ;
 3064|       |
 3065|  20.2k|	psf->sf.sections = 1 ;
 3066|       |
 3067|  20.2k|	psf->is_pipe = psf_is_pipe (psf) ;
 3068|       |
 3069|  20.2k|	if (psf->is_pipe)
  ------------------
  |  Branch (3069:6): [True: 0, False: 20.2k]
  ------------------
 3070|      0|	{	psf->sf.seekable = SF_FALSE ;
 3071|      0|		psf->filelength = SF_COUNT_MAX ;
  ------------------
  |  |  371|      0|#define SF_COUNT_MAX	INT64_MAX
  ------------------
 3072|      0|		}
 3073|  20.2k|	else
 3074|  20.2k|	{	psf->sf.seekable = SF_TRUE ;
 3075|       |
 3076|       |		/* File is open, so get the length. */
 3077|  20.2k|		psf->filelength = psf_get_filelen (psf) ;
 3078|  20.2k|		} ;
 3079|       |
 3080|  20.2k|	if (psf->fileoffset > 0)
  ------------------
  |  Branch (3080:6): [True: 0, False: 20.2k]
  ------------------
 3081|      0|	{	switch (psf->file.mode)
  ------------------
  |  Branch (3081:12): [True: 0, False: 0]
  ------------------
 3082|      0|		{	case SFM_READ :
  ------------------
  |  Branch (3082:5): [True: 0, False: 0]
  ------------------
 3083|      0|				if (psf->filelength < 44)
  ------------------
  |  Branch (3083:9): [True: 0, False: 0]
  ------------------
 3084|      0|				{	psf_log_printf (psf, "Short filelength: %D (fileoffset: %D)\n", psf->filelength, psf->fileoffset) ;
 3085|      0|					error = SFE_BAD_OFFSET ;
 3086|      0|					goto error_exit ;
 3087|      0|					} ;
 3088|      0|				break ;
 3089|       |
 3090|      0|			case SFM_WRITE :
  ------------------
  |  Branch (3090:4): [True: 0, False: 0]
  ------------------
 3091|      0|				psf->fileoffset = 0 ;
 3092|      0|				psf_fseek (psf, 0, SEEK_END) ;
 3093|      0|				psf->fileoffset = psf_ftell (psf) ;
 3094|      0|				break ;
 3095|       |
 3096|      0|			case SFM_RDWR :
  ------------------
  |  Branch (3096:4): [True: 0, False: 0]
  ------------------
 3097|      0|				error = SFE_NO_EMBEDDED_RDWR ;
 3098|      0|				goto error_exit ;
 3099|      0|			} ;
 3100|       |
 3101|      0|		psf_log_printf (psf, "Embedded file offset : %D\n", psf->fileoffset) ;
 3102|  20.2k|		} ;
 3103|       |
 3104|  20.2k|	if (psf->filelength == SF_COUNT_MAX)
  ------------------
  |  |  371|  20.2k|#define SF_COUNT_MAX	INT64_MAX
  ------------------
  |  Branch (3104:6): [True: 0, False: 20.2k]
  ------------------
 3105|      0|		psf_log_printf (psf, "Length : unknown\n") ;
 3106|  20.2k|	else
 3107|  20.2k|		psf_log_printf (psf, "Length : %D\n", psf->filelength) ;
 3108|       |
 3109|  20.2k|	if (psf->file.mode == SFM_WRITE || (psf->file.mode == SFM_RDWR && psf->filelength == 0))
  ------------------
  |  Branch (3109:6): [True: 0, False: 20.2k]
  |  Branch (3109:38): [True: 0, False: 20.2k]
  |  Branch (3109:68): [True: 0, False: 0]
  ------------------
 3110|      0|	{	/* If the file is being opened for write or RDWR and the file is currently
 3111|       |		** empty, then the SF_INFO struct must contain valid data.
 3112|       |		*/
 3113|      0|		if ((SF_CONTAINER (psf->sf.format)) == 0)
  ------------------
  |  |  101|      0|#define SF_CONTAINER(x)		((x) & SF_FORMAT_TYPEMASK)
  ------------------
  |  Branch (3113:7): [True: 0, False: 0]
  ------------------
 3114|      0|		{	error = SFE_ZERO_MAJOR_FORMAT ;
 3115|      0|			goto error_exit ;
 3116|      0|			} ;
 3117|      0|		if ((SF_CODEC (psf->sf.format)) == 0)
  ------------------
  |  |  102|      0|#define SF_CODEC(x)			((x) & SF_FORMAT_SUBMASK)
  ------------------
  |  Branch (3117:7): [True: 0, False: 0]
  ------------------
 3118|      0|		{	error = SFE_ZERO_MINOR_FORMAT ;
 3119|      0|			goto error_exit ;
 3120|      0|			} ;
 3121|       |
 3122|      0|		if (sf_format_check (&psf->sf) == 0)
  ------------------
  |  Branch (3122:7): [True: 0, False: 0]
  ------------------
 3123|      0|		{	error = SFE_BAD_OPEN_FORMAT ;
 3124|      0|			goto error_exit ;
 3125|      0|			} ;
 3126|       |
 3127|       |		/* Header writers divide by the sample rate (htk.c, sds.c, voc.c). */
 3128|      0|		if (psf->sf.samplerate < 1)
  ------------------
  |  Branch (3128:7): [True: 0, False: 0]
  ------------------
 3129|      0|		{	error = SFE_BAD_SF_INFO ;
 3130|      0|			goto error_exit ;
 3131|      0|			} ;
 3132|      0|		}
 3133|  20.2k|	else if ((SF_CONTAINER (psf->sf.format)) != SF_FORMAT_RAW)
  ------------------
  |  |  101|  20.2k|#define SF_CONTAINER(x)		((x) & SF_FORMAT_TYPEMASK)
  ------------------
  |  Branch (3133:11): [True: 20.2k, False: 0]
  ------------------
 3134|  20.2k|	{	/* If type RAW has not been specified then need to figure out file type. */
 3135|  20.2k|		psf->sf.format = guess_file_type (psf) ;
 3136|       |
 3137|  20.2k|		if (psf->sf.format == 0)
  ------------------
  |  Branch (3137:7): [True: 1.93k, False: 18.2k]
  ------------------
 3138|  1.93k|			psf->sf.format = format_from_extension (psf) ;
 3139|  20.2k|		} ;
 3140|       |
 3141|       |	/* Prevent unnecessary seeks */
 3142|  20.2k|	psf->last_op = psf->file.mode ;
 3143|       |
 3144|       |	/* Set bytewidth if known. */
 3145|  20.2k|	switch (SF_CODEC (psf->sf.format))
  ------------------
  |  |  102|  20.2k|#define SF_CODEC(x)			((x) & SF_FORMAT_SUBMASK)
  |  |  ------------------
  |  |  |  Branch (102:23): [True: 0, False: 20.2k]
  |  |  ------------------
  ------------------
 3146|  20.2k|	{	case SF_FORMAT_PCM_S8 :
  ------------------
  |  Branch (3146:4): [True: 0, False: 20.2k]
  ------------------
 3147|      0|		case SF_FORMAT_PCM_U8 :
  ------------------
  |  Branch (3147:3): [True: 0, False: 20.2k]
  ------------------
 3148|      0|		case SF_FORMAT_ULAW :
  ------------------
  |  Branch (3148:3): [True: 0, False: 20.2k]
  ------------------
 3149|      0|		case SF_FORMAT_ALAW :
  ------------------
  |  Branch (3149:3): [True: 0, False: 20.2k]
  ------------------
 3150|      0|		case SF_FORMAT_DPCM_8 :
  ------------------
  |  Branch (3150:3): [True: 0, False: 20.2k]
  ------------------
 3151|      0|				psf->bytewidth = 1 ;
 3152|      0|				break ;
 3153|       |
 3154|      0|		case SF_FORMAT_PCM_16 :
  ------------------
  |  Branch (3154:3): [True: 0, False: 20.2k]
  ------------------
 3155|      0|		case SF_FORMAT_DPCM_16 :
  ------------------
  |  Branch (3155:3): [True: 0, False: 20.2k]
  ------------------
 3156|      0|				psf->bytewidth = 2 ;
 3157|      0|				break ;
 3158|       |
 3159|      0|		case SF_FORMAT_PCM_24 :
  ------------------
  |  Branch (3159:3): [True: 0, False: 20.2k]
  ------------------
 3160|      0|				psf->bytewidth = 3 ;
 3161|      0|				break ;
 3162|       |
 3163|      0|		case SF_FORMAT_PCM_32 :
  ------------------
  |  Branch (3163:3): [True: 0, False: 20.2k]
  ------------------
 3164|      0|		case SF_FORMAT_FLOAT :
  ------------------
  |  Branch (3164:3): [True: 0, False: 20.2k]
  ------------------
 3165|      0|				psf->bytewidth = 4 ;
 3166|      0|				break ;
 3167|       |
 3168|      0|		case SF_FORMAT_DOUBLE :
  ------------------
  |  Branch (3168:3): [True: 0, False: 20.2k]
  ------------------
 3169|      0|				psf->bytewidth = 8 ;
 3170|      0|				break ;
 3171|  20.2k|		} ;
 3172|       |
 3173|       |	/* Call the initialisation function for the relevant file type. */
 3174|  20.2k|	switch (SF_CONTAINER (psf->sf.format))
  ------------------
  |  |  101|  20.2k|#define SF_CONTAINER(x)		((x) & SF_FORMAT_TYPEMASK)
  ------------------
 3175|  20.2k|	{	case	SF_FORMAT_WAV :
  ------------------
  |  Branch (3175:4): [True: 4.94k, False: 15.2k]
  ------------------
 3176|  4.94k|		case	SF_FORMAT_WAVEX :
  ------------------
  |  Branch (3176:3): [True: 0, False: 20.2k]
  ------------------
 3177|  4.94k|				error = wav_open (psf) ;
 3178|  4.94k|				break ;
 3179|       |
 3180|  2.98k|		case	SF_FORMAT_AIFF :
  ------------------
  |  Branch (3180:3): [True: 2.98k, False: 17.2k]
  ------------------
 3181|  2.98k|				error = aiff_open (psf) ;
 3182|  2.98k|				break ;
 3183|       |
 3184|  1.49k|		case	SF_FORMAT_AU :
  ------------------
  |  Branch (3184:3): [True: 1.49k, False: 18.7k]
  ------------------
 3185|  1.49k|				error = au_open (psf) ;
 3186|  1.49k|				break ;
 3187|       |
 3188|      0|		case	SF_FORMAT_RAW :
  ------------------
  |  Branch (3188:3): [True: 0, False: 20.2k]
  ------------------
 3189|      0|				error = raw_open (psf) ;
 3190|      0|				break ;
 3191|       |
 3192|    698|		case	SF_FORMAT_W64 :
  ------------------
  |  Branch (3192:3): [True: 698, False: 19.5k]
  ------------------
 3193|    698|				error = w64_open (psf) ;
 3194|    698|				break ;
 3195|       |
 3196|  2.19k|		case	SF_FORMAT_RF64 :
  ------------------
  |  Branch (3196:3): [True: 2.19k, False: 18.0k]
  ------------------
 3197|  2.19k|				error = rf64_open (psf) ;
 3198|  2.19k|				break ;
 3199|       |
 3200|       |		/* Lite remove start */
 3201|    147|		case	SF_FORMAT_PAF :
  ------------------
  |  Branch (3201:3): [True: 147, False: 20.0k]
  ------------------
 3202|    147|				error = paf_open (psf) ;
 3203|    147|				break ;
 3204|       |
 3205|    579|		case	SF_FORMAT_SVX :
  ------------------
  |  Branch (3205:3): [True: 579, False: 19.6k]
  ------------------
 3206|    579|				error = svx_open (psf) ;
 3207|    579|				break ;
 3208|       |
 3209|    141|		case	SF_FORMAT_NIST :
  ------------------
  |  Branch (3209:3): [True: 141, False: 20.0k]
  ------------------
 3210|    141|				error = nist_open (psf) ;
 3211|    141|				break ;
 3212|       |
 3213|    407|		case	SF_FORMAT_IRCAM :
  ------------------
  |  Branch (3213:3): [True: 407, False: 19.8k]
  ------------------
 3214|    407|				error = ircam_open (psf) ;
 3215|    407|				break ;
 3216|       |
 3217|    260|		case	SF_FORMAT_VOC :
  ------------------
  |  Branch (3217:3): [True: 260, False: 19.9k]
  ------------------
 3218|    260|				error = voc_open (psf) ;
 3219|    260|				break ;
 3220|       |
 3221|    342|		case	SF_FORMAT_SDS :
  ------------------
  |  Branch (3221:3): [True: 342, False: 19.8k]
  ------------------
 3222|    342|				error = sds_open (psf) ;
 3223|    342|				break ;
 3224|       |
 3225|      1|		case	SF_FORMAT_OGG :
  ------------------
  |  Branch (3225:3): [True: 1, False: 20.2k]
  ------------------
 3226|      1|				error = ogg_open (psf) ;
 3227|      1|				break ;
 3228|       |
 3229|      2|		case	SF_FORMAT_TXW :
  ------------------
  |  Branch (3229:3): [True: 2, False: 20.2k]
  ------------------
 3230|      2|				error = txw_open (psf) ;
 3231|      2|				break ;
 3232|       |
 3233|    114|		case	SF_FORMAT_WVE :
  ------------------
  |  Branch (3233:3): [True: 114, False: 20.0k]
  ------------------
 3234|    114|				error = wve_open (psf) ;
 3235|    114|				break ;
 3236|       |
 3237|      1|		case	SF_FORMAT_DWD :
  ------------------
  |  Branch (3237:3): [True: 1, False: 20.2k]
  ------------------
 3238|      1|				error = dwd_open (psf) ;
 3239|      1|				break ;
 3240|       |
 3241|    599|		case	SF_FORMAT_MAT4 :
  ------------------
  |  Branch (3241:3): [True: 599, False: 19.6k]
  ------------------
 3242|    599|				error = mat4_open (psf) ;
 3243|    599|				break ;
 3244|       |
 3245|    287|		case	SF_FORMAT_MAT5 :
  ------------------
  |  Branch (3245:3): [True: 287, False: 19.9k]
  ------------------
 3246|    287|				error = mat5_open (psf) ;
 3247|    287|				break ;
 3248|       |
 3249|    154|		case	SF_FORMAT_PVF :
  ------------------
  |  Branch (3249:3): [True: 154, False: 20.0k]
  ------------------
 3250|    154|				error = pvf_open (psf) ;
 3251|    154|				break ;
 3252|       |
 3253|    175|		case	SF_FORMAT_XI :
  ------------------
  |  Branch (3253:3): [True: 175, False: 20.0k]
  ------------------
 3254|    175|				error = xi_open (psf) ;
 3255|    175|				break ;
 3256|       |
 3257|     95|		case	SF_FORMAT_HTK :
  ------------------
  |  Branch (3257:3): [True: 95, False: 20.1k]
  ------------------
 3258|     95|				error = htk_open (psf) ;
 3259|     95|				break ;
 3260|       |
 3261|      0|		case	SF_FORMAT_SD2 :
  ------------------
  |  Branch (3261:3): [True: 0, False: 20.2k]
  ------------------
 3262|      0|				error = sd2_open (psf) ;
 3263|      0|				break ;
 3264|       |
 3265|      1|		case	SF_FORMAT_REX2 :
  ------------------
  |  Branch (3265:3): [True: 1, False: 20.2k]
  ------------------
 3266|      1|				error = rx2_open (psf) ;
 3267|      1|				break ;
 3268|       |
 3269|     91|		case	SF_FORMAT_AVR :
  ------------------
  |  Branch (3269:3): [True: 91, False: 20.1k]
  ------------------
 3270|     91|				error = avr_open (psf) ;
 3271|     91|				break ;
 3272|       |
 3273|      1|		case	SF_FORMAT_FLAC :
  ------------------
  |  Branch (3273:3): [True: 1, False: 20.2k]
  ------------------
 3274|      1|				error = flac_open (psf) ;
 3275|      1|				break ;
 3276|       |
 3277|  2.53k|		case	SF_FORMAT_CAF :
  ------------------
  |  Branch (3277:3): [True: 2.53k, False: 17.6k]
  ------------------
 3278|  2.53k|				error = caf_open (psf) ;
 3279|  2.53k|				break ;
 3280|       |
 3281|     15|		case	SF_FORMAT_MPC2K :
  ------------------
  |  Branch (3281:3): [True: 15, False: 20.1k]
  ------------------
 3282|     15|				error = mpc2k_open (psf) ;
 3283|     15|				break ;
 3284|       |
 3285|      9|		case	SF_FORMAT_MPEG :
  ------------------
  |  Branch (3285:3): [True: 9, False: 20.2k]
  ------------------
 3286|      9|				error = mpeg_open (psf) ;
 3287|      9|				break ;
 3288|       |
 3289|       |		/* Lite remove end */
 3290|       |
 3291|  1.93k|		default :
  ------------------
  |  Branch (3291:3): [True: 1.93k, False: 18.2k]
  ------------------
 3292|  1.93k|				error = SF_ERR_UNRECOGNISED_FORMAT ;
 3293|  20.2k|		} ;
 3294|       |
 3295|  20.2k|	if (error)
  ------------------
  |  Branch (3295:6): [True: 14.8k, False: 5.39k]
  ------------------
 3296|  14.8k|		goto error_exit ;
 3297|       |
 3298|       |	/* For now, check whether embedding is supported. */
 3299|  5.39k|	format = SF_CONTAINER (psf->sf.format) ;
  ------------------
  |  |  101|  5.39k|#define SF_CONTAINER(x)		((x) & SF_FORMAT_TYPEMASK)
  ------------------
 3300|  5.39k|	if (psf->fileoffset > 0)
  ------------------
  |  Branch (3300:6): [True: 102, False: 5.28k]
  ------------------
 3301|    102|	{	switch (format)
 3302|    102|		{	case SF_FORMAT_WAV :
  ------------------
  |  Branch (3302:5): [True: 9, False: 93]
  ------------------
 3303|     10|			case SF_FORMAT_WAVEX :
  ------------------
  |  Branch (3303:4): [True: 1, False: 101]
  ------------------
 3304|     11|			case SF_FORMAT_AIFF :
  ------------------
  |  Branch (3304:4): [True: 1, False: 101]
  ------------------
 3305|     65|			case SF_FORMAT_AU :
  ------------------
  |  Branch (3305:4): [True: 54, False: 48]
  ------------------
 3306|       |				/* Actual embedded files. */
 3307|     65|				break ;
 3308|       |
 3309|      0|			case SF_FORMAT_MPEG :
  ------------------
  |  Branch (3309:4): [True: 0, False: 102]
  ------------------
 3310|      0|			case SF_FORMAT_FLAC :
  ------------------
  |  Branch (3310:4): [True: 0, False: 102]
  ------------------
 3311|       |				/* Flac with an ID3v2 header? */
 3312|      0|				break ;
 3313|       |
 3314|     37|			default :
  ------------------
  |  Branch (3314:4): [True: 37, False: 65]
  ------------------
 3315|     37|				error = SFE_NO_EMBED_SUPPORT ;
 3316|     37|				goto error_exit ;
 3317|    102|			} ;
 3318|  5.35k|		} ;
 3319|       |
 3320|  5.35k|	if (psf->fileoffset > 0)
  ------------------
  |  Branch (3320:6): [True: 65, False: 5.28k]
  ------------------
 3321|     65|		psf_log_printf (psf, "Embedded file length : %D\n", psf->filelength) ;
 3322|       |
 3323|  5.35k|	if (psf->file.mode == SFM_RDWR && sf_format_check (&psf->sf) == 0)
  ------------------
  |  Branch (3323:6): [True: 0, False: 5.35k]
  |  Branch (3323:36): [True: 0, False: 0]
  ------------------
 3324|      0|	{	error = SFE_BAD_MODE_RW ;
 3325|      0|		goto error_exit ;
 3326|  5.35k|		} ;
 3327|       |
 3328|  5.35k|	if (validate_sfinfo (&psf->sf) == 0)
  ------------------
  |  Branch (3328:6): [True: 1.29k, False: 4.06k]
  ------------------
 3329|  1.29k|	{	psf_log_SF_INFO (psf) ;
 3330|  1.29k|		save_header_info (psf) ;
 3331|  1.29k|		error = SFE_BAD_SF_INFO ;
 3332|  1.29k|		goto error_exit ;
 3333|  4.06k|		} ;
 3334|       |
 3335|  4.06k|	if (validate_psf (psf) == 0)
  ------------------
  |  Branch (3335:6): [True: 1.03k, False: 3.03k]
  ------------------
 3336|  1.03k|	{	save_header_info (psf) ;
 3337|  1.03k|		error = SFE_INTERNAL ;
 3338|  1.03k|		goto error_exit ;
 3339|  3.03k|		} ;
 3340|       |
 3341|  3.03k|	psf->read_current = 0 ;
 3342|  3.03k|	psf->write_current = 0 ;
 3343|  3.03k|	if (psf->file.mode == SFM_RDWR)
  ------------------
  |  Branch (3343:6): [True: 0, False: 3.03k]
  ------------------
 3344|      0|	{	psf->write_current = psf->sf.frames ;
 3345|      0|		psf->have_written = psf->sf.frames > 0 ? SF_TRUE : SF_FALSE ;
  ------------------
  |  Branch (3345:23): [True: 0, False: 0]
  ------------------
 3346|      0|		} ;
 3347|       |
 3348|  3.03k|	memcpy (sfinfo, &psf->sf, sizeof (SF_INFO)) ;
 3349|       |
 3350|  3.03k|	if (psf->file.mode == SFM_WRITE)
  ------------------
  |  Branch (3350:6): [True: 0, False: 3.03k]
  ------------------
 3351|      0|	{	/* Zero out these fields. */
 3352|      0|		sfinfo->frames = 0 ;
 3353|      0|		sfinfo->sections = 0 ;
 3354|      0|		sfinfo->seekable = 0 ;
 3355|      0|		} ;
 3356|       |
 3357|  3.03k|	return (SNDFILE *) psf ;
 3358|       |
 3359|  17.1k|error_exit :
 3360|  17.1k|	sf_errno = error ;
 3361|       |
 3362|  17.1k|	if (error == SFE_SYSTEM)
  ------------------
  |  Branch (3362:6): [True: 0, False: 17.1k]
  ------------------
 3363|      0|		snprintf (sf_syserr, sizeof (sf_syserr), "%s", psf->syserr) ;
 3364|  17.1k|	snprintf (sf_parselog, sizeof (sf_parselog), "%s", psf->parselog.buf) ;
 3365|       |
 3366|  17.1k|	switch (error)
 3367|  17.1k|	{	case SF_ERR_SYSTEM :
  ------------------
  |  Branch (3367:4): [True: 0, False: 17.1k]
  ------------------
 3368|    263|		case SF_ERR_UNSUPPORTED_ENCODING :
  ------------------
  |  Branch (3368:3): [True: 263, False: 16.9k]
  ------------------
 3369|  1.26k|		case SFE_UNIMPLEMENTED :
  ------------------
  |  Branch (3369:3): [True: 997, False: 16.1k]
  ------------------
 3370|  1.26k|			break ;
 3371|       |
 3372|      0|		case SFE_RAW_BAD_FORMAT :
  ------------------
  |  Branch (3372:3): [True: 0, False: 17.1k]
  ------------------
 3373|      0|			break ;
 3374|       |
 3375|  15.9k|		default :
  ------------------
  |  Branch (3375:3): [True: 15.9k, False: 1.26k]
  ------------------
 3376|  15.9k|			if (psf->file.mode == SFM_READ)
  ------------------
  |  Branch (3376:8): [True: 15.9k, False: 0]
  ------------------
 3377|  15.9k|			{	psf_log_printf (psf, "Parse error : %s\n", sf_error_number (error)) ;
 3378|  15.9k|				error = SF_ERR_MALFORMED_FILE ;
 3379|  15.9k|				} ;
 3380|  17.1k|		} ;
 3381|       |
 3382|  17.1k|	psf_close (psf) ;
 3383|       |	return NULL ;
 3384|  17.1k|} /* psf_open_file */
sndfile.c:psf_close:
 2971|  20.2k|{	uint32_t k ;
 2972|  20.2k|	int	error = 0 ;
 2973|       |
 2974|  20.2k|	if (psf->codec_close)
  ------------------
  |  Branch (2974:6): [True: 2.90k, False: 17.3k]
  ------------------
 2975|  2.90k|	{	error = psf->codec_close (psf) ;
 2976|       |		/* To prevent it being called in psf->container_close(). */
 2977|  2.90k|		psf->codec_close = NULL ;
 2978|  2.90k|		} ;
 2979|       |
 2980|  20.2k|	if (psf->container_close)
  ------------------
  |  Branch (2980:6): [True: 8.18k, False: 12.0k]
  ------------------
 2981|  8.18k|		error = psf->container_close (psf) ;
 2982|       |
 2983|  20.2k|	error = psf_fclose (psf) ;
 2984|  20.2k|	psf_close_rsrc (psf) ;
 2985|       |
 2986|       |	/* For an ISO C compliant implementation it is ok to free a NULL pointer. */
 2987|  20.2k|	free (psf->header.ptr) ;
 2988|  20.2k|	free (psf->container_data) ;
 2989|  20.2k|	free (psf->codec_data) ;
 2990|  20.2k|	free (psf->interleave) ;
 2991|  20.2k|	free (psf->dither) ;
 2992|  20.2k|	free (psf->peak_info) ;
 2993|  20.2k|	free (psf->broadcast_16k) ;
 2994|  20.2k|	free (psf->loop_info) ;
 2995|  20.2k|	free (psf->instrument) ;
 2996|  20.2k|	free (psf->cues) ;
 2997|  20.2k|	free (psf->channel_map) ;
 2998|  20.2k|	free (psf->format_desc) ;
 2999|  20.2k|	free (psf->strings.storage) ;
 3000|       |
 3001|  20.2k|	if (psf->wchunks.chunks)
  ------------------
  |  Branch (3001:6): [True: 0, False: 20.2k]
  ------------------
 3002|      0|		for (k = 0 ; k < psf->wchunks.used ; k++)
  ------------------
  |  Branch (3002:16): [True: 0, False: 0]
  ------------------
 3003|      0|			free (psf->wchunks.chunks [k].data) ;
 3004|  20.2k|	free (psf->rchunks.chunks) ;
 3005|  20.2k|	free (psf->wchunks.chunks) ;
 3006|  20.2k|	free (psf->iterator) ;
 3007|  20.2k|	free (psf->cart_16k) ;
 3008|       |
 3009|  20.2k|	free (psf) ;
 3010|       |
 3011|  20.2k|	return error ;
 3012|  20.2k|} /* psf_close */
sndfile.c:guess_file_type:
 2789|  20.2k|{	uint32_t buffer [3], format ;
 2790|       |
 2791|  22.2k|retry:
 2792|  22.2k|	if (psf_binheader_readf (psf, "b", &buffer, SIGNED_SIZEOF (buffer)) != SIGNED_SIZEOF (buffer))
  ------------------
  |  |   86|  22.2k|#define		SIGNED_SIZEOF(x)	((int) sizeof (x))
  ------------------
              	if (psf_binheader_readf (psf, "b", &buffer, SIGNED_SIZEOF (buffer)) != SIGNED_SIZEOF (buffer))
  ------------------
  |  |   86|  22.2k|#define		SIGNED_SIZEOF(x)	((int) sizeof (x))
  ------------------
  |  Branch (2792:6): [True: 52, False: 22.1k]
  ------------------
 2793|     52|	{	psf->error = SFE_BAD_FILE_READ ;
 2794|     52|		return 0 ;
 2795|  22.1k|		} ;
 2796|       |
 2797|  22.1k|	if ((buffer [0] == MAKE_MARKER ('R', 'I', 'F', 'F') || buffer [0] == MAKE_MARKER ('R', 'I', 'F', 'X'))
  ------------------
  |  |  122|  44.3k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
              	if ((buffer [0] == MAKE_MARKER ('R', 'I', 'F', 'F') || buffer [0] == MAKE_MARKER ('R', 'I', 'F', 'X'))
  ------------------
  |  |  122|  17.4k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
  |  Branch (2797:7): [True: 4.72k, False: 17.4k]
  |  Branch (2797:57): [True: 275, False: 17.1k]
  ------------------
 2798|  4.99k|			&& buffer [2] == MAKE_MARKER ('W', 'A', 'V', 'E'))
  ------------------
  |  |  122|  4.99k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
  |  Branch (2798:7): [True: 4.94k, False: 52]
  ------------------
 2799|  4.94k|		return SF_FORMAT_WAV ;
 2800|       |
 2801|  17.2k|	if (buffer [0] == MAKE_MARKER ('F', 'O', 'R', 'M'))
  ------------------
  |  |  122|  17.2k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
  |  Branch (2801:6): [True: 3.69k, False: 13.5k]
  ------------------
 2802|  3.69k|	{	if (buffer [2] == MAKE_MARKER ('A', 'I', 'F', 'F') || buffer [2] == MAKE_MARKER ('A', 'I', 'F', 'C'))
  ------------------
  |  |  122|  7.39k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
              	{	if (buffer [2] == MAKE_MARKER ('A', 'I', 'F', 'F') || buffer [2] == MAKE_MARKER ('A', 'I', 'F', 'C'))
  ------------------
  |  |  122|  2.95k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
  |  Branch (2802:8): [True: 740, False: 2.95k]
  |  Branch (2802:58): [True: 2.24k, False: 713]
  ------------------
 2803|  2.98k|			return SF_FORMAT_AIFF ;
 2804|    713|		if (buffer [2] == MAKE_MARKER ('8', 'S', 'V', 'X') || buffer [2] == MAKE_MARKER ('1', '6', 'S', 'V'))
  ------------------
  |  |  122|  1.42k|	#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|    647|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
  |  Branch (2804:7): [True: 66, False: 647]
  |  Branch (2804:57): [True: 513, False: 134]
  ------------------
 2805|    579|			return SF_FORMAT_SVX ;
 2806|    134|		return 0 ;
 2807|  13.5k|		} ;
 2808|       |
 2809|  13.5k|	if (buffer [0] == MAKE_MARKER ('.', 's', 'n', 'd') || buffer [0] == MAKE_MARKER ('d', 'n', 's', '.'))
  ------------------
  |  |  122|  27.0k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
              	if (buffer [0] == MAKE_MARKER ('.', 's', 'n', 'd') || buffer [0] == MAKE_MARKER ('d', 'n', 's', '.'))
  ------------------
  |  |  122|  12.7k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
  |  Branch (2809:6): [True: 776, False: 12.7k]
  |  Branch (2809:56): [True: 723, False: 12.0k]
  ------------------
 2810|  1.49k|		return SF_FORMAT_AU ;
 2811|       |
 2812|  12.0k|	if ((buffer [0] == MAKE_MARKER ('f', 'a', 'p', ' ') || buffer [0] == MAKE_MARKER (' ', 'p', 'a', 'f')))
  ------------------
  |  |  122|  24.0k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
              	if ((buffer [0] == MAKE_MARKER ('f', 'a', 'p', ' ') || buffer [0] == MAKE_MARKER (' ', 'p', 'a', 'f')))
  ------------------
  |  |  122|  11.9k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
  |  Branch (2812:7): [True: 15, False: 11.9k]
  |  Branch (2812:57): [True: 132, False: 11.8k]
  ------------------
 2813|    147|		return SF_FORMAT_PAF ;
 2814|       |
 2815|  11.8k|	if (buffer [0] == MAKE_MARKER ('N', 'I', 'S', 'T'))
  ------------------
  |  |  122|  11.8k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
  |  Branch (2815:6): [True: 141, False: 11.7k]
  ------------------
 2816|    141|		return SF_FORMAT_NIST ;
 2817|       |
 2818|  11.7k|	if (buffer [0] == MAKE_MARKER ('C', 'r', 'e', 'a') && buffer [1] == MAKE_MARKER ('t', 'i', 'v', 'e'))
  ------------------
  |  |  122|  23.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', 'r', 'e', 'a') && buffer [1] == MAKE_MARKER ('t', 'i', 'v', 'e'))
  ------------------
  |  |  122|    307|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
  |  Branch (2818:6): [True: 307, False: 11.4k]
  |  Branch (2818:56): [True: 260, False: 47]
  ------------------
 2819|    260|		return SF_FORMAT_VOC ;
 2820|       |
 2821|  11.4k|	if ((buffer [0] & MAKE_MARKER (0xFF, 0xFF, 0xF8, 0xFF)) == MAKE_MARKER (0x64, 0xA3, 0x00, 0x00) ||
  ------------------
  |  |  122|  11.4k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
              	if ((buffer [0] & MAKE_MARKER (0xFF, 0xFF, 0xF8, 0xFF)) == MAKE_MARKER (0x64, 0xA3, 0x00, 0x00) ||
  ------------------
  |  |  122|  22.9k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
  |  Branch (2821:6): [True: 258, False: 11.2k]
  ------------------
 2822|  11.2k|		(buffer [0] & MAKE_MARKER (0xFF, 0xF8, 0xFF, 0xFF)) == MAKE_MARKER (0x00, 0x00, 0xA3, 0x64))
  ------------------
  |  |  122|  11.2k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
              		(buffer [0] & MAKE_MARKER (0xFF, 0xF8, 0xFF, 0xFF)) == MAKE_MARKER (0x00, 0x00, 0xA3, 0x64))
  ------------------
  |  |  122|  11.2k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
  |  Branch (2822:3): [True: 149, False: 11.0k]
  ------------------
 2823|    407|		return SF_FORMAT_IRCAM ;
 2824|       |
 2825|  11.0k|	if (buffer [0] == MAKE_MARKER ('r', 'i', 'f', 'f'))
  ------------------
  |  |  122|  11.0k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
  |  Branch (2825:6): [True: 698, False: 10.3k]
  ------------------
 2826|    698|		return SF_FORMAT_W64 ;
 2827|       |
 2828|  10.3k|	if (buffer [0] == MAKE_MARKER (0, 0, 0x03, 0xE8) && buffer [1] == MAKE_MARKER (0, 0, 0, 1) &&
  ------------------
  |  |  122|  20.7k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
              	if (buffer [0] == MAKE_MARKER (0, 0, 0x03, 0xE8) && buffer [1] == MAKE_MARKER (0, 0, 0, 1) &&
  ------------------
  |  |  122|  10.5k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
  |  Branch (2828:6): [True: 200, False: 10.1k]
  |  Branch (2828:54): [True: 154, False: 46]
  ------------------
 2829|    154|								buffer [2] == MAKE_MARKER (0, 0, 0, 1))
  ------------------
  |  |  122|    154|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
  |  Branch (2829:9): [True: 111, False: 43]
  ------------------
 2830|    111|		return SF_FORMAT_MAT4 ;
 2831|       |
 2832|  10.2k|	if (buffer [0] == MAKE_MARKER (0, 0, 0, 0) && buffer [1] == MAKE_MARKER (1, 0, 0, 0) &&
  ------------------
  |  |  122|  20.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, 0, 0) && buffer [1] == MAKE_MARKER (1, 0, 0, 0) &&
  ------------------
  |  |  122|  10.8k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
  |  Branch (2832:6): [True: 630, False: 9.61k]
  |  Branch (2832:48): [True: 529, False: 101]
  ------------------
 2833|    529|								buffer [2] == MAKE_MARKER (1, 0, 0, 0))
  ------------------
  |  |  122|    529|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
  |  Branch (2833:9): [True: 488, False: 41]
  ------------------
 2834|    488|		return SF_FORMAT_MAT4 ;
 2835|       |
 2836|  9.76k|	if (buffer [0] == MAKE_MARKER ('M', 'A', 'T', 'L') && buffer [1] == MAKE_MARKER ('A', 'B', ' ', '5'))
  ------------------
  |  |  122|  19.5k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
              	if (buffer [0] == MAKE_MARKER ('M', 'A', 'T', 'L') && buffer [1] == MAKE_MARKER ('A', 'B', ' ', '5'))
  ------------------
  |  |  122|    321|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
  |  Branch (2836:6): [True: 321, False: 9.44k]
  |  Branch (2836:56): [True: 287, False: 34]
  ------------------
 2837|    287|		return SF_FORMAT_MAT5 ;
 2838|       |
 2839|  9.47k|	if (buffer [0] == MAKE_MARKER ('P', 'V', 'F', '1'))
  ------------------
  |  |  122|  9.47k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
  |  Branch (2839:6): [True: 154, False: 9.32k]
  ------------------
 2840|    154|		return SF_FORMAT_PVF ;
 2841|       |
 2842|  9.32k|	if (buffer [0] == MAKE_MARKER ('E', 'x', 't', 'e') && buffer [1] == MAKE_MARKER ('n', 'd', 'e', 'd') &&
  ------------------
  |  |  122|  18.6k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
              	if (buffer [0] == MAKE_MARKER ('E', 'x', 't', 'e') && buffer [1] == MAKE_MARKER ('n', 'd', 'e', 'd') &&
  ------------------
  |  |  122|  9.57k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
  |  Branch (2842:6): [True: 250, False: 9.07k]
  |  Branch (2842:56): [True: 201, False: 49]
  ------------------
 2843|    201|								buffer [2] == MAKE_MARKER (' ', 'I', 'n', 's'))
  ------------------
  |  |  122|    201|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
  |  Branch (2843:9): [True: 175, False: 26]
  ------------------
 2844|    175|		return SF_FORMAT_XI ;
 2845|       |
 2846|  9.14k|	if (buffer [0] == MAKE_MARKER ('c', 'a', 'f', 'f') && buffer [2] == MAKE_MARKER ('d', 'e', 's', 'c'))
  ------------------
  |  |  122|  18.2k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
              	if (buffer [0] == MAKE_MARKER ('c', 'a', 'f', 'f') && buffer [2] == MAKE_MARKER ('d', 'e', 's', 'c'))
  ------------------
  |  |  122|  2.58k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
  |  Branch (2846:6): [True: 2.58k, False: 6.56k]
  |  Branch (2846:56): [True: 2.53k, False: 45]
  ------------------
 2847|  2.53k|		return SF_FORMAT_CAF ;
 2848|       |
 2849|  6.61k|	if (buffer [0] == MAKE_MARKER ('O', 'g', 'g', 'S'))
  ------------------
  |  |  122|  6.61k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
  |  Branch (2849:6): [True: 1, False: 6.60k]
  ------------------
 2850|      1|		return SF_FORMAT_OGG ;
 2851|       |
 2852|  6.60k|	if (buffer [0] == MAKE_MARKER ('A', 'L', 'a', 'w') && buffer [1] == MAKE_MARKER ('S', 'o', 'u', 'n')
  ------------------
  |  |  122|  13.2k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
              	if (buffer [0] == MAKE_MARKER ('A', 'L', 'a', 'w') && buffer [1] == MAKE_MARKER ('S', 'o', 'u', 'n')
  ------------------
  |  |  122|  6.82k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
  |  Branch (2852:6): [True: 211, False: 6.39k]
  |  Branch (2852:56): [True: 162, False: 49]
  ------------------
 2853|    162|			&& buffer [2] == MAKE_MARKER ('d', 'F', 'i', 'l'))
  ------------------
  |  |  122|    162|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
  |  Branch (2853:7): [True: 114, False: 48]
  ------------------
 2854|    114|		return SF_FORMAT_WVE ;
 2855|       |
 2856|  6.49k|	if (buffer [0] == MAKE_MARKER ('D', 'i', 'a', 'm') && buffer [1] == MAKE_MARKER ('o', 'n', 'd', 'W')
  ------------------
  |  |  122|  12.9k|	#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.56k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
  |  Branch (2856:6): [True: 74, False: 6.42k]
  |  Branch (2856:56): [True: 26, False: 48]
  ------------------
 2857|     26|			&& buffer [2] == MAKE_MARKER ('a', 'r', 'e', ' '))
  ------------------
  |  |  122|     26|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
  |  Branch (2857:7): [True: 1, False: 25]
  ------------------
 2858|      1|		return SF_FORMAT_DWD ;
 2859|       |
 2860|  6.49k|	if (buffer [0] == MAKE_MARKER ('L', 'M', '8', '9') || buffer [0] == MAKE_MARKER ('5', '3', 0, 0))
  ------------------
  |  |  122|  12.9k|	#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.49k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
  |  Branch (2860:6): [True: 1, False: 6.49k]
  |  Branch (2860:56): [True: 1, False: 6.49k]
  ------------------
 2861|      2|		return SF_FORMAT_TXW ;
 2862|       |
 2863|  6.49k|	if ((buffer [0] & MAKE_MARKER (0xFF, 0xFF, 0x80, 0xFF)) == MAKE_MARKER (0xF0, 0x7E, 0, 0x01))
  ------------------
  |  |  122|  6.49k|	#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.49k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
  |  Branch (2863:6): [True: 342, False: 6.15k]
  ------------------
 2864|    342|		return SF_FORMAT_SDS ;
 2865|       |
 2866|  6.15k|	if ((buffer [0] & MAKE_MARKER (0xFF, 0xFF, 0, 0)) == MAKE_MARKER (1, 4, 0, 0))
  ------------------
  |  |  122|  6.15k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
              	if ((buffer [0] & MAKE_MARKER (0xFF, 0xFF, 0, 0)) == MAKE_MARKER (1, 4, 0, 0))
  ------------------
  |  |  122|  6.15k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
  |  Branch (2866:6): [True: 15, False: 6.13k]
  ------------------
 2867|     15|		return SF_FORMAT_MPC2K ;
 2868|       |
 2869|  6.13k|	if (buffer [0] == MAKE_MARKER ('C', 'A', 'T', ' ') && buffer [2] == MAKE_MARKER ('R', 'E', 'X', '2'))
  ------------------
  |  |  122|  12.2k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
              	if (buffer [0] == MAKE_MARKER ('C', 'A', 'T', ' ') && buffer [2] == MAKE_MARKER ('R', 'E', 'X', '2'))
  ------------------
  |  |  122|     20|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
  |  Branch (2869:6): [True: 20, False: 6.11k]
  |  Branch (2869:56): [True: 1, False: 19]
  ------------------
 2870|      1|		return SF_FORMAT_REX2 ;
 2871|       |
 2872|  6.13k|	if (buffer [0] == MAKE_MARKER (0x30, 0x26, 0xB2, 0x75) && buffer [1] == MAKE_MARKER (0x8E, 0x66, 0xCF, 0x11))
  ------------------
  |  |  122|  12.2k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
              	if (buffer [0] == MAKE_MARKER (0x30, 0x26, 0xB2, 0x75) && buffer [1] == MAKE_MARKER (0x8E, 0x66, 0xCF, 0x11))
  ------------------
  |  |  122|     37|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
  |  Branch (2872:6): [True: 37, False: 6.09k]
  |  Branch (2872:60): [True: 1, False: 36]
  ------------------
 2873|      1|		return 0 /*-SF_FORMAT_WMA-*/ ;
 2874|       |
 2875|       |	/* HMM (Hidden Markov Model) Tool Kit. */
 2876|  6.13k|	if (buffer [2] == MAKE_MARKER (0, 2, 0, 0) && 2 * ((int64_t) BE2H_32 (buffer [0])) + 12 == psf->filelength)
  ------------------
  |  |  122|  12.2k|	#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|    587|	#define BE2H_32(x)			ENDSWAP_32 (x)
  |  |  ------------------
  |  |  |  |   35|    587|#define	ENDSWAP_32(x)		(bswap_32 (x))
  |  |  ------------------
  ------------------
  |  Branch (2876:6): [True: 587, False: 5.54k]
  |  Branch (2876:48): [True: 95, False: 492]
  ------------------
 2877|     95|		return SF_FORMAT_HTK ;
 2878|       |
 2879|  6.03k|	if (buffer [0] == MAKE_MARKER ('f', 'L', 'a', 'C'))
  ------------------
  |  |  122|  6.03k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
  |  Branch (2879:6): [True: 1, False: 6.03k]
  ------------------
 2880|      1|		return SF_FORMAT_FLAC ;
 2881|       |
 2882|  6.03k|	if (buffer [0] == MAKE_MARKER ('2', 'B', 'I', 'T'))
  ------------------
  |  |  122|  6.03k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
  |  Branch (2882:6): [True: 91, False: 5.94k]
  ------------------
 2883|     91|		return SF_FORMAT_AVR ;
 2884|       |
 2885|  5.94k|	if (buffer [0] == MAKE_MARKER ('R', 'F', '6', '4') && buffer [2] == MAKE_MARKER ('W', 'A', 'V', 'E'))
  ------------------
  |  |  122|  11.8k|	#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.23k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
  |  Branch (2885:6): [True: 2.23k, False: 3.70k]
  |  Branch (2885:56): [True: 2.19k, False: 45]
  ------------------
 2886|  2.19k|		return SF_FORMAT_RF64 ;
 2887|       |
 2888|  3.75k|	if (buffer [0] == MAKE_MARKER ('I', 'D', '3', 2) || buffer [0] == MAKE_MARKER ('I', 'D', '3', 3)
  ------------------
  |  |  122|  7.50k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
              	if (buffer [0] == MAKE_MARKER ('I', 'D', '3', 2) || buffer [0] == MAKE_MARKER ('I', 'D', '3', 3)
  ------------------
  |  |  122|  7.03k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
  |  Branch (2888:6): [True: 476, False: 3.27k]
  |  Branch (2888:54): [True: 818, False: 2.45k]
  ------------------
 2889|  2.45k|			|| buffer [0] == MAKE_MARKER ('I', 'D', '3', 4))
  ------------------
  |  |  122|  2.45k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
  |  Branch (2889:7): [True: 711, False: 1.74k]
  ------------------
 2890|  2.00k|	{	psf_log_printf (psf, "Found 'ID3' marker.\n") ;
 2891|  2.00k|		if (id3_skip (psf))
  ------------------
  |  Branch (2891:7): [True: 1.99k, False: 13]
  ------------------
 2892|  1.99k|			goto retry ;
 2893|     13|		return 0 ;
 2894|  2.00k|		} ;
 2895|       |
 2896|       |	/* ID3v2 tags + MPEG */
 2897|  1.74k|	if (psf->id3_header.len > 0 && (format = identify_mpeg (buffer [0])) != 0)
  ------------------
  |  Branch (2897:6): [True: 30, False: 1.71k]
  |  Branch (2897:33): [True: 3, False: 27]
  ------------------
 2898|      3|		return format ;
 2899|       |
 2900|       |	/* Turtle Beach SMP 16-bit */
 2901|  1.74k|	if (buffer [0] == MAKE_MARKER ('S', 'O', 'U', 'N') && buffer [1] == MAKE_MARKER ('D', ' ', 'S', 'A'))
  ------------------
  |  |  122|  3.49k|	#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|     49|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
  |  Branch (2901:6): [True: 49, False: 1.69k]
  |  Branch (2901:56): [True: 1, False: 48]
  ------------------
 2902|      1|		return 0 ;
 2903|       |
 2904|       |	/* Yamaha sampler format. */
 2905|  1.74k|	if (buffer [0] == MAKE_MARKER ('S', 'Y', '8', '0') || buffer [0] == MAKE_MARKER ('S', 'Y', '8', '5'))
  ------------------
  |  |  122|  3.48k|	#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.74k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
  |  Branch (2905:6): [True: 1, False: 1.74k]
  |  Branch (2905:56): [True: 1, False: 1.74k]
  ------------------
 2906|      2|		return 0 ;
 2907|       |
 2908|  1.74k|	if (buffer [0] == MAKE_MARKER ('a', 'j', 'k', 'g'))
  ------------------
  |  |  122|  1.74k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
  |  Branch (2908:6): [True: 1, False: 1.74k]
  ------------------
 2909|      1|		return 0 /*-SF_FORMAT_SHN-*/ ;
 2910|       |
 2911|       |	/* This must be (almost) the last one. */
 2912|  1.74k|	if (psf->filelength > 0 && (format = try_resource_fork (psf)) != 0)
  ------------------
  |  Branch (2912:6): [True: 1.74k, False: 0]
  |  Branch (2912:29): [True: 0, False: 1.74k]
  ------------------
 2913|      0|		return format ;
 2914|       |
 2915|       |	/* MPEG with no ID3v2 tags. Only have the MPEG sync header for
 2916|       |	 * identification and it is quite brief, and prone to false positives.
 2917|       |	 * Check for this last, even after resource forks. */
 2918|  1.74k|	if (psf->id3_header.len == 0 && (format = identify_mpeg (buffer [0])) != 0)
  ------------------
  |  Branch (2918:6): [True: 1.71k, False: 27]
  |  Branch (2918:34): [True: 6, False: 1.70k]
  ------------------
 2919|      6|		return format ;
 2920|       |
 2921|  1.73k|	return 0 ;
 2922|  1.74k|} /* guess_file_type */
sndfile.c:identify_mpeg:
 2778|  1.74k|{	if ((marker & MAKE_MARKER (0xFF, 0xE0, 0, 0)) == MAKE_MARKER (0xFF, 0xE0, 0, 0) && /* Frame sync */
  ------------------
  |  |  122|  1.74k|	#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.48k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
  |  Branch (2778:7): [True: 38, False: 1.70k]
  ------------------
 2779|     38|		(marker & MAKE_MARKER (0, 0x18, 0, 0)) != MAKE_MARKER (0, 0x08, 0, 0) && /* Valid MPEG version */
  ------------------
  |  |  122|     38|	#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.78k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
  |  Branch (2779:3): [True: 36, False: 2]
  ------------------
 2780|     36|		(marker & MAKE_MARKER (0, 0x06, 0, 0)) != MAKE_MARKER (0, 0, 0, 0) && /* Valid layer description */
  ------------------
  |  |  122|     36|	#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.78k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
  |  Branch (2780:3): [True: 33, False: 3]
  ------------------
 2781|     33|		(marker & MAKE_MARKER (0, 0, 0xF0, 0)) != MAKE_MARKER (0, 0, 0xF0, 0) && /* Valid bitrate */
  ------------------
  |  |  122|     33|	#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.77k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
  |  Branch (2781:3): [True: 18, False: 15]
  ------------------
 2782|     18|		(marker & MAKE_MARKER (0, 0, 0x0C, 0)) != MAKE_MARKER (0, 0, 0x0C, 0)) /* Valid samplerate */
  ------------------
  |  |  122|     18|	#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|     18|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
  |  Branch (2782:3): [True: 9, False: 9]
  ------------------
 2783|      9|		return SF_FORMAT_MPEG ;
 2784|  1.73k|	return 0 ;
 2785|  1.74k|} /* identify_mpeg */
sndfile.c:try_resource_fork:
 2695|  1.74k|{	int old_error = psf->error ;
 2696|       |
 2697|       |	/* Set READ mode now, to see if resource fork exists. */
 2698|  1.74k|	psf->rsrc.mode = SFM_READ ;
 2699|  1.74k|	if (psf_open_rsrc (psf) != 0)
  ------------------
  |  Branch (2699:6): [True: 1.74k, False: 0]
  ------------------
 2700|  1.74k|	{	psf->error = old_error ;
 2701|  1.74k|		return 0 ;
 2702|  1.74k|		} ;
 2703|       |
 2704|       |	/* More checking here. */
 2705|      0|	psf_log_printf (psf, "Resource fork : %s\n", psf->rsrc.path) ;
 2706|       |
 2707|      0|	return SF_FORMAT_SD2 ;
 2708|  1.74k|} /* try_resource_fork */
sndfile.c:format_from_extension:
 2712|  1.93k|{	char *cptr ;
 2713|  1.93k|	char buffer [16] ;
 2714|  1.93k|	int format = 0 ;
 2715|       |
 2716|  1.93k|	if ((cptr = strrchr (psf->file.name, '.')) == NULL)
  ------------------
  |  Branch (2716:6): [True: 1.93k, False: 0]
  ------------------
 2717|  1.93k|		return 0 ;
 2718|       |
 2719|      0|	cptr ++ ;
 2720|      0|	if (strlen (cptr) > sizeof (buffer) - 1)
  ------------------
  |  Branch (2720:6): [True: 0, False: 0]
  ------------------
 2721|      0|		return 0 ;
 2722|       |
 2723|      0|	psf_strlcpy (buffer, sizeof (buffer), cptr) ;
 2724|      0|	buffer [sizeof (buffer) - 1] = 0 ;
 2725|       |
 2726|       |	/* Convert everything in the buffer to lower case. */
 2727|      0|	cptr = buffer ;
 2728|      0|	while (*cptr)
  ------------------
  |  Branch (2728:9): [True: 0, False: 0]
  ------------------
 2729|      0|	{	*cptr = tolower ((unsigned char) *cptr) ;
  ------------------
  |  Branch (2729:12): [True: 0, False: 0]
  |  Branch (2729:12): [True: 0, False: 0]
  |  Branch (2729:12): [Folded, False: 0]
  ------------------
 2730|      0|		cptr ++ ;
 2731|      0|		} ;
 2732|       |
 2733|      0|	cptr = buffer ;
 2734|       |
 2735|      0|	if (strcmp (cptr, "au") == 0)
  ------------------
  |  Branch (2735:6): [True: 0, False: 0]
  ------------------
 2736|      0|	{	psf->sf.channels = 1 ;
 2737|      0|		psf->sf.samplerate = 8000 ;
 2738|      0|		format = SF_FORMAT_RAW | SF_FORMAT_ULAW ;
 2739|      0|		}
 2740|      0|	else if (strcmp (cptr, "snd") == 0)
  ------------------
  |  Branch (2740:11): [True: 0, False: 0]
  ------------------
 2741|      0|	{	psf->sf.channels = 1 ;
 2742|      0|		psf->sf.samplerate = 8000 ;
 2743|      0|		format = SF_FORMAT_RAW | SF_FORMAT_ULAW ;
 2744|      0|		}
 2745|       |
 2746|      0|	else if (strcmp (cptr, "vox") == 0 || strcmp (cptr, "vox8") == 0)
  ------------------
  |  Branch (2746:11): [True: 0, False: 0]
  |  Branch (2746:40): [True: 0, False: 0]
  ------------------
 2747|      0|	{	psf->sf.channels = 1 ;
 2748|      0|		psf->sf.samplerate = 8000 ;
 2749|      0|		format = SF_FORMAT_RAW | SF_FORMAT_VOX_ADPCM ;
 2750|      0|		}
 2751|      0|	else if (strcmp (cptr, "vox6") == 0)
  ------------------
  |  Branch (2751:11): [True: 0, False: 0]
  ------------------
 2752|      0|	{	psf->sf.channels = 1 ;
 2753|      0|		psf->sf.samplerate = 6000 ;
 2754|      0|		format = SF_FORMAT_RAW | SF_FORMAT_VOX_ADPCM ;
 2755|      0|		}
 2756|      0|	else if (strcmp (cptr, "gsm") == 0)
  ------------------
  |  Branch (2756:11): [True: 0, False: 0]
  ------------------
 2757|      0|	{	psf->sf.channels = 1 ;
 2758|      0|		psf->sf.samplerate = 8000 ;
 2759|      0|		format = SF_FORMAT_RAW | SF_FORMAT_GSM610 ;
 2760|      0|		}
 2761|      0|	else if (strcmp (cptr, "mp3") == 0)
  ------------------
  |  Branch (2761:11): [True: 0, False: 0]
  ------------------
 2762|      0|	{	/*
 2763|       |		 * MPEG streams are quite tollerate of crap. If we couldn't identify a
 2764|       |		 * MP3 stream, but it has a .mp3 extension, let libmpg123 have a try.
 2765|       |		 */
 2766|      0|		format = SF_FORMAT_MPEG ;
 2767|      0|		}
 2768|       |
 2769|       |	/* For RAW files, make sure the dataoffset if set correctly. */
 2770|      0|	if ((SF_CONTAINER (format)) == SF_FORMAT_RAW)
  ------------------
  |  |  101|      0|#define SF_CONTAINER(x)		((x) & SF_FORMAT_TYPEMASK)
  ------------------
  |  Branch (2770:6): [True: 0, False: 0]
  ------------------
 2771|      0|		psf->dataoffset = 0 ;
 2772|       |
 2773|      0|	return format ;
 2774|      0|} /* format_from_extension */
sndfile.c:validate_sfinfo:
 2927|  5.35k|{	if (sfinfo->samplerate < 1)
  ------------------
  |  Branch (2927:7): [True: 953, False: 4.40k]
  ------------------
 2928|    953|		return 0 ;
 2929|  4.40k|	if (sfinfo->frames < 0)
  ------------------
  |  Branch (2929:6): [True: 204, False: 4.19k]
  ------------------
 2930|    204|		return 0 ;
 2931|  4.19k|	if ((sfinfo->channels < 1) || (sfinfo->channels > SF_MAX_CHANNELS))
  ------------------
  |  |   95|  4.11k|#define		SF_MAX_CHANNELS		1024
  ------------------
  |  Branch (2931:6): [True: 84, False: 4.11k]
  |  Branch (2931:32): [True: 30, False: 4.08k]
  ------------------
 2932|    114|		return 0 ;
 2933|  4.08k|	if ((SF_CONTAINER (sfinfo->format)) == 0)
  ------------------
  |  |  101|  4.08k|#define SF_CONTAINER(x)		((x) & SF_FORMAT_TYPEMASK)
  ------------------
  |  Branch (2933:6): [True: 0, False: 4.08k]
  ------------------
 2934|      0|		return 0 ;
 2935|  4.08k|	if ((SF_CODEC (sfinfo->format)) == 0)
  ------------------
  |  |  102|  4.08k|#define SF_CODEC(x)			((x) & SF_FORMAT_SUBMASK)
  ------------------
  |  Branch (2935:6): [True: 19, False: 4.06k]
  ------------------
 2936|     19|		return 0 ;
 2937|  4.06k|	if (sfinfo->sections < 1)
  ------------------
  |  Branch (2937:6): [True: 0, False: 4.06k]
  ------------------
 2938|      0|		return 0 ;
 2939|  4.06k|	return 1 ;
 2940|  4.06k|} /* validate_sfinfo */
sndfile.c:save_header_info:
 2963|  2.32k|{	snprintf (sf_parselog, sizeof (sf_parselog), "%s", psf->parselog.buf) ;
 2964|  2.32k|} /* save_header_info */
sndfile.c:validate_psf:
 2944|  4.06k|{
 2945|  4.06k|	if (psf->datalength < 0)
  ------------------
  |  Branch (2945:6): [True: 268, False: 3.79k]
  ------------------
 2946|    268|	{	psf_log_printf (psf, "Invalid SF_PRIVATE field : datalength == %D.\n", psf->datalength) ;
 2947|    268|		return 0 ;
 2948|  3.79k|		} ;
 2949|  3.79k|	if (psf->dataoffset < 0)
  ------------------
  |  Branch (2949:6): [True: 703, False: 3.09k]
  ------------------
 2950|    703|	{	psf_log_printf (psf, "Invalid SF_PRIVATE field : dataoffset == %D.\n", psf->dataoffset) ;
 2951|    703|		return 0 ;
 2952|  3.09k|		} ;
 2953|  3.09k|	if (psf->blockwidth && psf->blockwidth != psf->sf.channels * psf->bytewidth)
  ------------------
  |  Branch (2953:6): [True: 1.11k, False: 1.97k]
  |  Branch (2953:25): [True: 59, False: 1.05k]
  ------------------
 2954|     59|	{	psf_log_printf (psf, "Invalid SF_PRIVATE field : channels * bytewidth == %d.\n",
 2955|     59|								psf->sf.channels * psf->bytewidth) ;
 2956|     59|		return 0 ;
 2957|  3.03k|		} ;
 2958|  3.03k|	return 1 ;
 2959|  3.09k|} /* 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|   756k|	for (k = 0 ; k < SF_MAX_STRINGS ; k++)
  ------------------
  |  |   75|   756k|#define SF_MAX_STRINGS			(32)
  ------------------
  |  Branch (53:15): [True: 735k, False: 21.4k]
  ------------------
   54|   735k|	{	/* If we find a matching entry clear it. */
   55|   735k|		if (psf->strings.data [k].type == str_type)
  ------------------
  |  Branch (55:7): [True: 3.51k, False: 732k]
  ------------------
   56|  3.51k|			psf->strings.data [k].type = -1 ;
   57|       |
   58|   735k|		if (psf->strings.data [k].type == 0)
  ------------------
  |  Branch (58:7): [True: 4.05k, False: 731k]
  ------------------
   59|  4.05k|			break ;
   60|   735k|		} ;
   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)
  ------------------
  |  |   75|  25.4k|#define SF_MAX_STRINGS			(32)
  ------------------
  |  Branch (71:6): [True: 21.4k, False: 4.05k]
  ------------------
   72|  21.4k|		return SFE_STR_MAX_COUNT ;
   73|       |
   74|  4.05k|	if (k == 0 && psf->strings.storage_used != 0)
  ------------------
  |  Branch (74:6): [True: 480, False: 3.57k]
  |  Branch (74:16): [True: 0, False: 480]
  ------------------
   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.05k|		} ;
   78|       |
   79|  4.05k|	if (k != 0 && psf->strings.storage_used == 0)
  ------------------
  |  Branch (79:6): [True: 3.57k, False: 480]
  |  Branch (79:16): [True: 0, False: 3.57k]
  ------------------
   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.05k|		} ;
   83|       |
   84|       |	/* Special case for the first string. */
   85|  4.05k|	if (k == 0)
  ------------------
  |  Branch (85:6): [True: 480, False: 3.57k]
  ------------------
   86|    480|		psf->strings.storage_used = 0 ;
   87|       |
   88|  4.05k|	switch (str_type)
   89|  4.05k|	{	case SF_STR_SOFTWARE :
  ------------------
  |  Branch (89:4): [True: 568, False: 3.48k]
  ------------------
   90|       |				/* In write mode, want to append libsndfile-version to string. */
   91|    568|				if (psf->file.mode == SFM_WRITE || psf->file.mode == SFM_RDWR)
  ------------------
  |  Branch (91:9): [True: 0, False: 568]
  |  Branch (91:40): [True: 0, False: 568]
  ------------------
   92|      0|				{	if (strstr (str, PACKAGE_NAME) == NULL)
  ------------------
  |  |  170|      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) ;
  ------------------
  |  |  170|      0|#define PACKAGE_NAME "libsndfile"
  ------------------
              							snprintf (new_str, sizeof (new_str), "%s-%s", PACKAGE_NAME, PACKAGE_VERSION) ;
  ------------------
  |  |  182|      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) ;
  ------------------
  |  |  170|      0|#define PACKAGE_NAME "libsndfile"
  ------------------
              							snprintf (new_str, sizeof (new_str), "%s (%s-%s)", str, PACKAGE_NAME, PACKAGE_VERSION) ;
  ------------------
  |  |  182|      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|    568|				break ;
  108|       |
  109|    624|		case SF_STR_TITLE :
  ------------------
  |  Branch (109:3): [True: 624, False: 3.43k]
  ------------------
  110|  1.22k|		case SF_STR_COPYRIGHT :
  ------------------
  |  Branch (110:3): [True: 598, False: 3.45k]
  ------------------
  111|  1.57k|		case SF_STR_ARTIST :
  ------------------
  |  Branch (111:3): [True: 349, False: 3.70k]
  ------------------
  112|  2.22k|		case SF_STR_COMMENT :
  ------------------
  |  Branch (112:3): [True: 655, False: 3.40k]
  ------------------
  113|  2.56k|		case SF_STR_DATE :
  ------------------
  |  Branch (113:3): [True: 335, False: 3.72k]
  ------------------
  114|  2.82k|		case SF_STR_ALBUM :
  ------------------
  |  Branch (114:3): [True: 263, False: 3.79k]
  ------------------
  115|  2.94k|		case SF_STR_LICENSE :
  ------------------
  |  Branch (115:3): [True: 122, False: 3.93k]
  ------------------
  116|  3.25k|		case SF_STR_TRACKNUMBER :
  ------------------
  |  Branch (116:3): [True: 304, False: 3.75k]
  ------------------
  117|  3.48k|		case SF_STR_GENRE :
  ------------------
  |  Branch (117:3): [True: 237, False: 3.81k]
  ------------------
  118|  3.48k|				break ;
  119|       |
  120|      0|		default :
  ------------------
  |  Branch (120:3): [True: 0, False: 4.05k]
  ------------------
  121|      0|			psf_log_printf (psf, "%s : SFE_STR_BAD_TYPE\n", __func__) ;
  122|      0|			return SFE_STR_BAD_TYPE ;
  123|  4.05k|		} ;
  124|       |
  125|       |	/* Plus one to catch string terminator. */
  126|  4.05k|	str_len = strlen (str) + 1 ;
  127|       |
  128|  4.05k|	if (psf->strings.storage_used + str_len + 1 > psf->strings.storage_len)
  ------------------
  |  Branch (128:6): [True: 507, False: 3.54k]
  ------------------
  129|    507|	{	char * temp = psf->strings.storage ;
  130|    507|		size_t newlen = 2 * psf->strings.storage_len + str_len + 1 ;
  131|       |
  132|    507|		newlen = newlen < 256 ? 256 : newlen ;
  ------------------
  |  Branch (132:12): [True: 463, False: 44]
  ------------------
  133|       |
  134|    507|		char * new_storage = realloc(temp, newlen);
  135|    507|		if (new_storage == NULL)
  ------------------
  |  Branch (135:7): [True: 0, False: 507]
  ------------------
  136|      0|		{
  137|      0|			return SFE_MALLOC_FAILED ;
  138|    507|			} else {
  139|    507|			psf->strings.storage = new_storage;
  140|    507|			} ;
  141|       |
  142|    507|		psf->strings.storage_len = newlen ;
  143|  4.05k|		} ;
  144|       |
  145|  4.05k|	psf->strings.data [k].type = str_type ;
  146|  4.05k|	psf->strings.data [k].offset = psf->strings.storage_used ;
  147|  4.05k|	psf->strings.data [k].flags = str_flags ;
  148|       |
  149|  4.05k|	memcpy (psf->strings.storage + psf->strings.storage_used, str, str_len) ;
  150|  4.05k|	psf->strings.storage_used += str_len ;
  151|       |
  152|  4.05k|	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.05k|	return 0 ;
  160|  4.05k|} /* psf_store_string */

svx_open:
   83|    579|{	int error ;
   84|       |
   85|    579|	if (psf->file.mode == SFM_READ || (psf->file.mode == SFM_RDWR && psf->filelength > 0))
  ------------------
  |  Branch (85:6): [True: 579, False: 0]
  |  Branch (85:37): [True: 0, False: 0]
  |  Branch (85:67): [True: 0, False: 0]
  ------------------
   86|    579|	{	if ((error = svx_read_header (psf)))
  ------------------
  |  Branch (86:8): [True: 573, False: 6]
  ------------------
   87|    573|			return error ;
   88|       |
   89|      6|		psf->endian = SF_ENDIAN_BIG ;			/* All SVX files are big endian. */
   90|       |
   91|      6|		psf->blockwidth = (sf_count_t) psf->sf.channels * psf->bytewidth ;
   92|      6|		if (psf->blockwidth)
  ------------------
  |  Branch (92:7): [True: 6, False: 0]
  ------------------
   93|      6|			psf->sf.frames = psf->datalength / psf->blockwidth ;
   94|       |
   95|      6|		psf_fseek (psf, psf->dataoffset, SEEK_SET) ;
   96|      6|		} ;
   97|       |
   98|      6|	if (psf->file.mode == SFM_WRITE || psf->file.mode == SFM_RDWR)
  ------------------
  |  Branch (98:6): [True: 0, False: 6]
  |  Branch (98:37): [True: 0, False: 6]
  ------------------
   99|      0|	{	if (psf->is_pipe)
  ------------------
  |  Branch (99:8): [True: 0, False: 0]
  ------------------
  100|      0|			return SFE_NO_PIPE_WRITE ;
  101|       |
  102|      0|		if ((SF_CONTAINER (psf->sf.format)) != SF_FORMAT_SVX)
  ------------------
  |  |  101|      0|#define SF_CONTAINER(x)		((x) & SF_FORMAT_TYPEMASK)
  ------------------
  |  Branch (102:7): [True: 0, False: 0]
  ------------------
  103|      0|			return	SFE_BAD_OPEN_FORMAT ;
  104|       |
  105|      0|		psf->endian = SF_ENDIAN (psf->sf.format) ;
  ------------------
  |  |  103|      0|#define SF_ENDIAN(x)		((x) & SF_FORMAT_ENDMASK)
  ------------------
  106|       |
  107|      0|		if (psf->endian == SF_ENDIAN_LITTLE || (CPU_IS_LITTLE_ENDIAN && psf->endian == SF_ENDIAN_CPU))
  ------------------
  |  |   14|      0|#define CPU_IS_LITTLE_ENDIAN 1
  |  |  ------------------
  |  |  |  Branch (14:30): [True: 0, Folded]
  |  |  ------------------
  ------------------
  |  Branch (107:7): [True: 0, False: 0]
  |  Branch (107:67): [True: 0, False: 0]
  ------------------
  108|      0|			return SFE_BAD_ENDIAN ;
  109|       |
  110|      0|		psf->endian = SF_ENDIAN_BIG ;			/* All SVX files are big endian. */
  111|       |
  112|      0|		error = svx_write_header (psf, SF_FALSE) ;
  113|      0|		if (error)
  ------------------
  |  Branch (113:7): [True: 0, False: 0]
  ------------------
  114|      0|			return error ;
  115|       |
  116|      0|		psf->write_header = svx_write_header ;
  117|      6|		} ;
  118|       |
  119|      6|	psf->container_close = svx_close ;
  120|       |
  121|      6|	if ((error = pcm_init (psf)))
  ------------------
  |  Branch (121:6): [True: 0, False: 6]
  ------------------
  122|      0|		return error ;
  123|       |
  124|      6|	return 0 ;
  125|      6|} /* svx_open */
svx.c:svx_read_header:
  132|    579|{	VHDR_CHUNK		vhdr ;
  133|    579|	uint32_t		chunk_size, marker ;
  134|    579|	int				filetype = 0, parsestage = 0, done = 0 ;
  135|    579|	int 			bytecount = 0, channels ;
  136|       |
  137|    579|	if (psf->filelength > 0xFFFFFFFFLL)
  ------------------
  |  Branch (137:6): [True: 0, False: 579]
  ------------------
  138|      0|		psf_log_printf (psf, "Warning : filelength > 0xffffffff. This is bad!!!!\n") ;
  139|       |
  140|    579|	memset (&vhdr, 0, sizeof (vhdr)) ;
  141|    579|	psf_binheader_readf (psf, "p", 0) ;
  142|       |
  143|       |	/* Set default number of channels. Modify later if necessary */
  144|    579|	psf->sf.channels = 1 ;
  145|       |
  146|    579|	psf->sf.format = SF_FORMAT_SVX ;
  147|       |
  148|  28.6k|	while (! done)
  ------------------
  |  Branch (148:9): [True: 28.6k, False: 14]
  ------------------
  149|  28.6k|	{	psf_binheader_readf (psf, "Em4", &marker, &chunk_size) ;
  150|       |
  151|  28.6k|		switch (marker)
  152|  28.6k|		{	case FORM_MARKER :
  ------------------
  |  |   35|    580|#define FORM_MARKER	(MAKE_MARKER ('F', 'O', 'R', 'M'))
  |  |  ------------------
  |  |  |  |  122|    580|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (152:5): [True: 580, False: 28.0k]
  ------------------
  153|    580|					if (parsestage)
  ------------------
  |  Branch (153:10): [True: 1, False: 579]
  ------------------
  154|      1|						return SFE_SVX_NO_FORM ;
  155|       |
  156|    579|					if (chunk_size != psf->filelength - 2 * sizeof (chunk_size))
  ------------------
  |  Branch (156:10): [True: 578, False: 1]
  ------------------
  157|    578|						psf_log_printf (psf, "FORM : %u (should be %u)\n", chunk_size, (uint32_t) psf->filelength - 2 * sizeof (chunk_size)) ;
  158|      1|					else
  159|      1|						psf_log_printf (psf, "FORM : %u\n", chunk_size) ;
  160|    579|					parsestage |= HAVE_FORM ;
  161|       |
  162|    579|					psf_binheader_readf (psf, "m", &marker) ;
  163|       |
  164|    579|					filetype = marker ;
  165|    579|					psf_log_printf (psf, " %M\n", marker) ;
  166|    579|					parsestage |= HAVE_SVX ;
  167|    579|					break ;
  168|       |
  169|    986|			case VHDR_MARKER :
  ------------------
  |  |   38|    986|#define VHDR_MARKER	(MAKE_MARKER ('V', 'H', 'D', 'R'))
  |  |  ------------------
  |  |  |  |  122|    986|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (169:4): [True: 986, False: 27.6k]
  ------------------
  170|    986|					if (! (parsestage & (HAVE_FORM | HAVE_SVX)))
  ------------------
  |  Branch (170:10): [True: 0, False: 986]
  ------------------
  171|      0|						return SFE_SVX_NO_FORM ;
  172|       |
  173|    986|					psf_log_printf (psf, " VHDR : %d\n", chunk_size) ;
  174|       |
  175|    986|					psf_binheader_readf (psf, "E4442114", &(vhdr.oneShotHiSamples), &(vhdr.repeatHiSamples),
  176|    986|						&(vhdr.samplesPerHiCycle), &(vhdr.samplesPerSec), &(vhdr.octave), &(vhdr.compression),
  177|    986|						&(vhdr.volume)) ;
  178|       |
  179|    986|					psf_log_printf (psf, "  OneShotHiSamples  : %d\n", vhdr.oneShotHiSamples) ;
  180|    986|					psf_log_printf (psf, "  RepeatHiSamples   : %d\n", vhdr.repeatHiSamples) ;
  181|    986|					psf_log_printf (psf, "  samplesPerHiCycle : %d\n", vhdr.samplesPerHiCycle) ;
  182|    986|					psf_log_printf (psf, "  Sample Rate       : %d\n", vhdr.samplesPerSec) ;
  183|    986|					psf_log_printf (psf, "  Octave            : %d\n", vhdr.octave) ;
  184|       |
  185|    986|					psf_log_printf (psf, "  Compression       : %d => ", vhdr.compression) ;
  186|       |
  187|    986|					switch (vhdr.compression)
  ------------------
  |  Branch (187:14): [True: 668, False: 318]
  ------------------
  188|    986|					{	case 0 : psf_log_printf (psf, "None.\n") ;
  ------------------
  |  Branch (188:8): [True: 212, False: 774]
  ------------------
  189|    212|								break ;
  190|    221|						case 1 : psf_log_printf (psf, "Fibonacci delta\n") ;
  ------------------
  |  Branch (190:7): [True: 221, False: 765]
  ------------------
  191|    221|								break ;
  192|    235|						case 2 : psf_log_printf (psf, "Exponential delta\n") ;
  ------------------
  |  Branch (192:7): [True: 235, False: 751]
  ------------------
  193|    235|								break ;
  194|    986|						} ;
  195|       |
  196|    986|					psf_log_printf (psf, "  Volume            : %d\n", vhdr.volume) ;
  197|       |
  198|    986|					psf->sf.samplerate 	= vhdr.samplesPerSec ;
  199|       |
  200|    986|					if (filetype == SVX8_MARKER)
  ------------------
  |  |   36|    986|#define SVX8_MARKER	(MAKE_MARKER ('8', 'S', 'V', 'X'))
  |  |  ------------------
  |  |  |  |  122|    986|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (200:10): [True: 393, False: 593]
  ------------------
  201|    393|					{	psf->sf.format |= SF_FORMAT_PCM_S8 ;
  202|    393|						psf->bytewidth = 1 ;
  203|    393|						}
  204|    593|					else if (filetype == SV16_MARKER)
  ------------------
  |  |   37|    593|#define SV16_MARKER	(MAKE_MARKER ('1', '6', 'S', 'V'))
  |  |  ------------------
  |  |  |  |  122|    593|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (204:15): [True: 593, False: 0]
  ------------------
  205|    593|					{	psf->sf.format |= SF_FORMAT_PCM_16 ;
  206|    593|						psf->bytewidth = 2 ;
  207|    593|						} ;
  208|       |
  209|    986|					parsestage |= HAVE_VHDR ;
  210|    986|					break ;
  211|       |
  212|  1.17k|			case BODY_MARKER :
  ------------------
  |  |   39|  1.17k|#define BODY_MARKER	(MAKE_MARKER ('B', 'O', 'D', 'Y'))
  |  |  ------------------
  |  |  |  |  122|  1.17k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (212:4): [True: 1.17k, False: 27.4k]
  ------------------
  213|  1.17k|					if (! (parsestage & HAVE_VHDR))
  ------------------
  |  Branch (213:10): [True: 1, False: 1.17k]
  ------------------
  214|      1|						return SFE_SVX_NO_BODY ;
  215|       |
  216|  1.17k|					psf->datalength = chunk_size ;
  217|       |
  218|  1.17k|					psf->dataoffset = psf_ftell (psf) ;
  219|  1.17k|					if (psf->dataoffset < 0)
  ------------------
  |  Branch (219:10): [True: 0, False: 1.17k]
  ------------------
  220|      0|						return SFE_SVX_NO_BODY ;
  221|       |
  222|  1.17k|					if (psf->datalength > psf->filelength - psf->dataoffset)
  ------------------
  |  Branch (222:10): [True: 4, False: 1.17k]
  ------------------
  223|      4|					{	psf_log_printf (psf, " BODY : %D (should be %D)\n", psf->datalength, psf->filelength - psf->dataoffset) ;
  224|      4|						psf->datalength = psf->filelength - psf->dataoffset ;
  225|      4|						}
  226|  1.17k|					else
  227|  1.17k|						psf_log_printf (psf, " BODY : %D\n", psf->datalength) ;
  228|       |
  229|  1.17k|					parsestage |= HAVE_BODY ;
  230|       |
  231|  1.17k|					if (! psf->sf.seekable)
  ------------------
  |  Branch (231:10): [True: 0, False: 1.17k]
  ------------------
  232|      0|						break ;
  233|       |
  234|  1.17k|					psf_fseek (psf, psf->datalength, SEEK_CUR) ;
  235|  1.17k|					break ;
  236|       |
  237|    698|			case NAME_MARKER :
  ------------------
  |  |   45|    698|#define NAME_MARKER	(MAKE_MARKER ('N', 'A', 'M', 'E'))
  |  |  ------------------
  |  |  |  |  122|    698|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (237:4): [True: 698, False: 27.9k]
  ------------------
  238|    698|					if (! (parsestage & HAVE_SVX))
  ------------------
  |  Branch (238:10): [True: 0, False: 698]
  ------------------
  239|      0|						return SFE_SVX_NO_FORM ;
  240|       |
  241|    698|					psf_log_printf (psf, " %M : %u\n", marker, chunk_size) ;
  242|       |
  243|    698|					if (strlen (psf->file.name) != chunk_size)
  ------------------
  |  Branch (243:10): [True: 334, False: 364]
  ------------------
  244|    334|					{	if (chunk_size > sizeof (psf->file.name) - 1)
  ------------------
  |  Branch (244:12): [True: 18, False: 316]
  ------------------
  245|     18|							return SFE_SVX_BAD_NAME_LENGTH ;
  246|       |
  247|    316|						psf_binheader_readf (psf, "b", psf->file.name, chunk_size) ;
  248|    316|						psf->file.name [chunk_size] = 0 ;
  249|    316|						}
  250|    364|					else
  251|    364|						psf_binheader_readf (psf, "j", chunk_size) ;
  252|    680|					break ;
  253|       |
  254|    680|			case ANNO_MARKER :
  ------------------
  |  |   47|    228|#define ANNO_MARKER	(MAKE_MARKER ('A', 'N', 'N', 'O'))
  |  |  ------------------
  |  |  |  |  122|    228|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (254:4): [True: 228, False: 28.3k]
  ------------------
  255|    228|					if (! (parsestage & HAVE_SVX))
  ------------------
  |  Branch (255:10): [True: 0, False: 228]
  ------------------
  256|      0|						return SFE_SVX_NO_FORM ;
  257|       |
  258|    228|					psf_log_printf (psf, " %M : %u\n", marker, chunk_size) ;
  259|       |
  260|    228|					psf_binheader_readf (psf, "j", chunk_size) ;
  261|    228|					break ;
  262|       |
  263|  1.52k|			case CHAN_MARKER :
  ------------------
  |  |   48|  1.52k|#define CHAN_MARKER	(MAKE_MARKER ('C', 'H', 'A', 'N'))
  |  |  ------------------
  |  |  |  |  122|  1.52k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (263:4): [True: 1.52k, False: 27.0k]
  ------------------
  264|  1.52k|					if (! (parsestage & HAVE_SVX))
  ------------------
  |  Branch (264:10): [True: 0, False: 1.52k]
  ------------------
  265|      0|						return SFE_SVX_NO_FORM ;
  266|       |
  267|  1.52k|					psf_log_printf (psf, " %M : %u\n", marker, chunk_size) ;
  268|       |
  269|  1.52k|					bytecount += psf_binheader_readf (psf, "E4", &channels) ;
  270|       |
  271|  1.52k|					if (channels == 2 || channels == 4)
  ------------------
  |  Branch (271:10): [True: 215, False: 1.31k]
  |  Branch (271:27): [True: 243, False: 1.07k]
  ------------------
  272|    458|						psf_log_printf (psf, "  Channels : %d => mono\n", channels) ;
  273|  1.07k|					else if (channels == 6)
  ------------------
  |  Branch (273:15): [True: 208, False: 862]
  ------------------
  274|    208|					{	psf->sf.channels = 2 ;
  275|    208|						psf_log_printf (psf, "  Channels : %d => stereo\n", channels) ;
  276|    208|						}
  277|    862|					else
  278|    862|						psf_log_printf (psf, "  Channels : %d *** assuming mono\n", channels) ;
  279|       |
  280|  1.52k|					psf_binheader_readf (psf, "j", chunk_size - bytecount) ;
  281|  1.52k|					break ;
  282|       |
  283|       |
  284|    252|			case AUTH_MARKER :
  ------------------
  |  |   46|    252|#define AUTH_MARKER	(MAKE_MARKER ('A', 'U', 'T', 'H'))
  |  |  ------------------
  |  |  |  |  122|    252|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (284:4): [True: 252, False: 28.3k]
  ------------------
  285|  1.66k|			case c_MARKER :
  ------------------
  |  |   44|  1.66k|#define c_MARKER	(MAKE_MARKER ('(', 'c', ')', ' '))
  |  |  ------------------
  |  |  |  |  122|  1.66k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (285:4): [True: 1.41k, False: 27.2k]
  ------------------
  286|  1.66k|					if (! (parsestage & HAVE_SVX))
  ------------------
  |  Branch (286:10): [True: 0, False: 1.66k]
  ------------------
  287|      0|						return SFE_SVX_NO_FORM ;
  288|       |
  289|  1.66k|					psf_log_printf (psf, " %M : %u\n", marker, chunk_size) ;
  290|       |
  291|  1.66k|					psf_binheader_readf (psf, "j", chunk_size) ;
  292|  1.66k|					break ;
  293|       |
  294|  21.7k|			default :
  ------------------
  |  Branch (294:4): [True: 21.7k, False: 6.86k]
  ------------------
  295|  21.7k|					if (chunk_size >= 0xffff0000)
  ------------------
  |  Branch (295:10): [True: 11, False: 21.7k]
  ------------------
  296|     11|					{	done = SF_TRUE ;
  297|     11|						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|     11|						break ;
  299|  21.7k|						} ;
  300|       |
  301|  21.7k|					if (psf_isprint ((marker >> 24) & 0xFF) && psf_isprint ((marker >> 16) & 0xFF)
  ------------------
  |  Branch (301:10): [True: 10.0k, False: 11.6k]
  |  Branch (301:49): [True: 8.47k, False: 1.57k]
  ------------------
  302|  8.47k|						&& psf_isprint ((marker >> 8) & 0xFF) && psf_isprint (marker & 0xFF))
  ------------------
  |  Branch (302:10): [True: 6.84k, False: 1.63k]
  |  Branch (302:48): [True: 6.02k, False: 824]
  ------------------
  303|  6.02k|					{	psf_log_printf (psf, "%M : %u (unknown marker)\n", marker, chunk_size) ;
  304|  6.02k|						psf_binheader_readf (psf, "j", chunk_size) ;
  305|  6.02k|						break ;
  306|  15.7k|						} ;
  307|  15.7k|					if ((chunk_size = psf_ftell (psf)) & 0x03)
  ------------------
  |  Branch (307:10): [True: 15.6k, False: 29]
  ------------------
  308|  15.6k|					{	psf_log_printf (psf, "  Unknown chunk marker at position %d. Resynching.\n", chunk_size - 4) ;
  309|       |
  310|  15.6k|						chunk_size = chunk_size & 3 ;
  311|  15.6k|						psf_binheader_readf (psf, "j", 4 - chunk_size) ;
  312|  15.6k|						break ;
  313|  15.6k|						} ;
  314|     29|					psf_log_printf (psf, "*** Unknown chunk marker (%X) at position %D. Exiting parser.\n", marker, psf_ftell (psf) - 8) ;
  315|     29|					done = SF_TRUE ;
  316|  28.6k|			} ;	/* switch (marker) */
  317|       |
  318|  28.5k|		if (! psf->sf.seekable && (parsestage & HAVE_BODY))
  ------------------
  |  Branch (318:7): [True: 0, False: 28.5k]
  |  Branch (318:29): [True: 0, False: 0]
  ------------------
  319|      0|			break ;
  320|       |
  321|  28.5k|		if (psf_ftell (psf) >= psf->filelength - SIGNED_SIZEOF (chunk_size))
  ------------------
  |  |   86|  28.5k|#define		SIGNED_SIZEOF(x)	((int) sizeof (x))
  ------------------
  |  Branch (321:7): [True: 545, False: 28.0k]
  ------------------
  322|    545|			break ;
  323|  28.5k|		} ; /* while (1) */
  324|       |
  325|    559|	if (vhdr.compression)
  ------------------
  |  Branch (325:6): [True: 34, False: 525]
  ------------------
  326|     34|		return SFE_SVX_BAD_COMP ;
  327|       |
  328|    525|	if (psf->dataoffset <= 0)
  ------------------
  |  Branch (328:6): [True: 519, False: 6]
  ------------------
  329|    519|		return SFE_SVX_NO_DATA ;
  330|       |
  331|      6|	return 0 ;
  332|    525|} /* svx_read_header */
svx.c:svx_close:
  336|      6|{
  337|      6|	if (psf->file.mode == SFM_WRITE || psf->file.mode == SFM_RDWR)
  ------------------
  |  Branch (337:6): [True: 0, False: 6]
  |  Branch (337:37): [True: 0, False: 6]
  ------------------
  338|      0|		svx_write_header (psf, SF_TRUE) ;
  339|       |
  340|      6|	return 0 ;
  341|      6|} /* 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|    347|{
   40|    347|	if (psf->file.mode == SFM_READ || psf->file.mode == SFM_RDWR)
  ------------------
  |  Branch (40:6): [True: 347, False: 0]
  |  Branch (40:36): [True: 0, False: 0]
  ------------------
   41|    347|	{	psf->read_short		= ulaw_read_ulaw2s ;
   42|    347|		psf->read_int		= ulaw_read_ulaw2i ;
   43|    347|		psf->read_float		= ulaw_read_ulaw2f ;
   44|    347|		psf->read_double	= ulaw_read_ulaw2d ;
   45|    347|		} ;
   46|       |
   47|    347|	if (psf->file.mode == SFM_WRITE || psf->file.mode == SFM_RDWR)
  ------------------
  |  Branch (47:6): [True: 0, False: 347]
  |  Branch (47:37): [True: 0, False: 347]
  ------------------
   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|    347|	psf->bytewidth = 1 ;
   55|    347|	psf->blockwidth = psf->sf.channels ;
   56|       |
   57|    347|	if (psf->filelength > psf->dataoffset)
  ------------------
  |  Branch (57:6): [True: 271, False: 76]
  ------------------
   58|    271|		psf->datalength = (psf->dataend) ? psf->dataend - psf->dataoffset :
  ------------------
  |  Branch (58:21): [True: 102, False: 169]
  ------------------
   59|    271|							psf->filelength - psf->dataoffset ;
   60|     76|	else
   61|     76|		psf->datalength = 0 ;
   62|       |
   63|    347|	psf->sf.frames = psf->blockwidth > 0 ? psf->datalength / psf->blockwidth : 0 ;
  ------------------
  |  Branch (63:19): [True: 314, False: 33]
  ------------------
   64|       |
   65|    347|	return 0 ;
   66|    347|} /* ulaw_init */
ulaw.c:ulaw_read_ulaw2f:
  917|   109k|{	BUF_UNION	ubuf ;
  918|   109k|	int			bufferlen, readcount ;
  919|   109k|	sf_count_t	total = 0 ;
  920|   109k|	float	normfact ;
  921|       |
  922|   109k|	normfact = (psf->norm_float == SF_TRUE) ? 1.0 / ((float) 0x8000) : 1.0 ;
  ------------------
  |  Branch (922:13): [True: 109k, False: 0]
  ------------------
  923|       |
  924|   109k|	bufferlen = ARRAY_LEN (ubuf.ucbuf) ;
  ------------------
  |  |   88|   109k|#define		ARRAY_LEN(x)	((int) (sizeof (x) / sizeof ((x) [0])))
  ------------------
  925|       |
  926|   219k|	while (len > 0)
  ------------------
  |  Branch (926:9): [True: 109k, False: 109k]
  ------------------
  927|   109k|	{	if (len < bufferlen)
  ------------------
  |  Branch (927:8): [True: 109k, False: 0]
  ------------------
  928|   109k|			bufferlen = (int) len ;
  929|   109k|		readcount = (int) psf_fread (ubuf.ucbuf, 1, bufferlen, psf) ;
  930|   109k|		ulaw2f_array (ubuf.ucbuf, readcount, ptr + total, normfact) ;
  931|   109k|		total += readcount ;
  932|   109k|		if (readcount < bufferlen)
  ------------------
  |  Branch (932:7): [True: 48, False: 109k]
  ------------------
  933|     48|			break ;
  934|   109k|		len -= readcount ;
  935|   109k|		} ;
  936|       |
  937|   109k|	return total ;
  938|   109k|} /* ulaw_read_ulaw2f */
ulaw.c:ulaw2f_array:
  808|   443k|{	for (int i = 0 ; i < count ; i++)
  ------------------
  |  Branch (808:20): [True: 333k, False: 109k]
  ------------------
  809|   333k|		ptr [i] = normfact * ulaw_decode [(int) buffer [i]] ;
  810|   109k|} /* ulaw2f_array */

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

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

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

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

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

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

