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

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

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

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

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

unpc_block:
   56|  24.2k|{
   57|  24.2k|	register int16_t	a0, a1, a2, a3 ;
   58|  24.2k|	register int32_t	b0, b1, b2, b3 ;
   59|  24.2k|	int32_t					j, k, lim ;
   60|  24.2k|	int32_t				sum1, sg, sgn, top, dd ;
   61|  24.2k|	int32_t *			pout ;
   62|  24.2k|	int32_t				del, del0 ;
   63|  24.2k|	uint32_t			chanshift = 32 - chanbits ;
   64|  24.2k|	int32_t				denhalf = 1 << (denshift - 1) ;
   65|       |
   66|  24.2k|	out [0] = pc1 [0] ;
   67|  24.2k|	if (numactive == 0)
  ------------------
  |  Branch (67:6): [True: 13.7k, False: 10.4k]
  ------------------
   68|  13.7k|	{
   69|       |		// just copy if numactive == 0 (but don't bother if in/out pointers the same)
   70|  13.7k|		if ((num > 1) && (pc1 != out))
  ------------------
  |  Branch (70:7): [True: 11.2k, False: 2.53k]
  |  Branch (70:20): [True: 11.2k, False: 0]
  ------------------
   71|  11.2k|			memcpy (&out [1], &pc1 [1], (num - 1) * sizeof (int32_t)) ;
   72|  13.7k|		return ;
   73|  13.7k|	}
   74|  10.4k|	if (numactive == 31)
  ------------------
  |  Branch (74:6): [True: 5.77k, False: 4.68k]
  ------------------
   75|  5.77k|	{
   76|       |		// short-circuit if numactive == 31
   77|  5.77k|		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|  5.77k|		prev = out [0] ;
   88|   836k|		for (j = 1 ; j < num ; j++)
  ------------------
  |  Branch (88:16): [True: 830k, False: 5.77k]
  ------------------
   89|   830k|		{
   90|   830k|			del = pc1 [j] + prev ;
   91|   830k|			prev = (del << chanshift) >> chanshift ;
   92|   830k|			out [j] = prev ;
   93|   830k|		}
   94|  5.77k|		return ;
   95|  5.77k|	}
   96|       |
   97|  30.1k|	for (j = 1 ; j <= numactive ; j++)
  ------------------
  |  Branch (97:15): [True: 25.4k, False: 4.68k]
  ------------------
   98|  25.4k|	{
   99|  25.4k|		del = pc1 [j] + out [j-1] ;
  100|  25.4k|		out [j] = arith_shift_left (del, chanshift) >> chanshift ;
  101|  25.4k|	}
  102|       |
  103|  4.68k|	lim = numactive + 1 ;
  104|       |
  105|  4.68k|	if (numactive == 4)
  ------------------
  |  Branch (105:6): [True: 1.06k, False: 3.62k]
  ------------------
  106|  1.06k|	{
  107|       |		// optimization for numactive == 4
  108|  1.06k|		register int16_t	ia0, ia1, ia2, ia3 ;
  109|  1.06k|		register int32_t	ib0, ib1, ib2, ib3 ;
  110|       |
  111|  1.06k|		ia0 = coefs [0] ;
  112|  1.06k|		ia1 = coefs [1] ;
  113|  1.06k|		ia2 = coefs [2] ;
  114|  1.06k|		ia3 = coefs [3] ;
  115|       |
  116|   395k|		for (j = lim ; j < num ; j++)
  ------------------
  |  Branch (116:18): [True: 394k, False: 1.06k]
  ------------------
  117|   394k|		{
  118|   394k|			LOOP_ALIGN
  119|       |
  120|   394k|			top = out [j - lim] ;
  121|   394k|			pout = out + j - 1 ;
  122|       |
  123|   394k|			ib0 = top - pout [0] ;
  124|   394k|			ib1 = top - pout [-1] ;
  125|   394k|			ib2 = top - pout [-2] ;
  126|   394k|			ib3 = top - pout [-3] ;
  127|       |
  128|   394k|			sum1 = (denhalf - ia0 * ib0 - ia1 * ib1 - ia2 * ib2 - ia3 * ib3) >> denshift ;
  129|       |
  130|   394k|			del = pc1 [j] ;
  131|   394k|			del0 = del ;
  132|   394k|			sg = sign_of_int (del) ;
  133|   394k|			del += top + sum1 ;
  134|       |
  135|   394k|			out [j] = arith_shift_left (del, chanshift) >> chanshift ;
  136|       |
  137|   394k|			if (sg > 0)
  ------------------
  |  Branch (137:8): [True: 16.4k, False: 377k]
  ------------------
  138|  16.4k|			{
  139|  16.4k|				sgn = sign_of_int (ib3) ;
  140|  16.4k|				ia3 -= sgn ;
  141|  16.4k|				del0 -= (4 - 3) * ((sgn * ib3) >> denshift) ;
  142|  16.4k|				if (del0 <= 0)
  ------------------
  |  Branch (142:9): [True: 3.58k, False: 12.8k]
  ------------------
  143|  3.58k|					continue ;
  144|       |
  145|  12.8k|				sgn = sign_of_int (ib2) ;
  146|  12.8k|				ia2 -= sgn ;
  147|  12.8k|				del0 -= (4 - 2) * ((sgn * ib2) >> denshift) ;
  148|  12.8k|				if (del0 <= 0)
  ------------------
  |  Branch (148:9): [True: 3.29k, False: 9.56k]
  ------------------
  149|  3.29k|					continue ;
  150|       |
  151|  9.56k|				sgn = sign_of_int (ib1) ;
  152|  9.56k|				ia1 -= sgn ;
  153|  9.56k|				del0 -= (4 - 1) * ((sgn * ib1) >> denshift) ;
  154|  9.56k|				if (del0 <= 0)
  ------------------
  |  Branch (154:9): [True: 2.79k, False: 6.76k]
  ------------------
  155|  2.79k|					continue ;
  156|       |
  157|  6.76k|				ia0 -= sign_of_int (ib0) ;
  158|  6.76k|			}
  159|   377k|			else if (sg < 0)
  ------------------
  |  Branch (159:13): [True: 35.8k, False: 341k]
  ------------------
  160|  35.8k|			{
  161|       |				// note: to avoid unnecessary negations, we flip the value of "sgn"
  162|  35.8k|				sgn = -sign_of_int (ib3) ;
  163|  35.8k|				ia3 -= sgn ;
  164|  35.8k|				del0 -= (4 - 3) * ((sgn * ib3) >> denshift) ;
  165|  35.8k|				if (del0 >= 0)
  ------------------
  |  Branch (165:9): [True: 8.29k, False: 27.5k]
  ------------------
  166|  8.29k|					continue ;
  167|       |
  168|  27.5k|				sgn = -sign_of_int (ib2) ;
  169|  27.5k|				ia2 -= sgn ;
  170|  27.5k|				del0 -= (4 - 2) * ((sgn * ib2) >> denshift) ;
  171|  27.5k|				if (del0 >= 0)
  ------------------
  |  Branch (171:9): [True: 5.41k, False: 22.1k]
  ------------------
  172|  5.41k|					continue ;
  173|       |
  174|  22.1k|				sgn = -sign_of_int (ib1) ;
  175|  22.1k|				ia1 -= sgn ;
  176|  22.1k|				del0 -= (4 - 1) * ((sgn * ib1) >> denshift) ;
  177|  22.1k|				if (del0 >= 0)
  ------------------
  |  Branch (177:9): [True: 4.55k, False: 17.6k]
  ------------------
  178|  4.55k|					continue ;
  179|       |
  180|  17.6k|				ia0 += sign_of_int (ib0) ;
  181|  17.6k|			}
  182|   394k|		}
  183|       |
  184|  1.06k|		coefs [0] = ia0 ;
  185|  1.06k|		coefs [1] = ia1 ;
  186|  1.06k|		coefs [2] = ia2 ;
  187|  1.06k|		coefs [3] = ia3 ;
  188|  1.06k|	}
  189|  3.62k|	else if (numactive == 8)
  ------------------
  |  Branch (189:11): [True: 875, False: 2.74k]
  ------------------
  190|    875|	{
  191|    875|		register int16_t	a4, a5, a6, a7 ;
  192|    875|		register int32_t	b4, b5, b6, b7 ;
  193|       |
  194|       |		// optimization for numactive == 8
  195|    875|		a0 = coefs [0] ;
  196|    875|		a1 = coefs [1] ;
  197|    875|		a2 = coefs [2] ;
  198|    875|		a3 = coefs [3] ;
  199|    875|		a4 = coefs [4] ;
  200|    875|		a5 = coefs [5] ;
  201|    875|		a6 = coefs [6] ;
  202|    875|		a7 = coefs [7] ;
  203|       |
  204|   422k|		for (j = lim ; j < num ; j++)
  ------------------
  |  Branch (204:18): [True: 421k, False: 875]
  ------------------
  205|   421k|		{
  206|   421k|			LOOP_ALIGN
  207|       |
  208|   421k|			top = out [j - lim] ;
  209|   421k|			pout = out + j - 1 ;
  210|       |
  211|   421k|			b0 = top - (*pout--) ;
  212|   421k|			b1 = top - (*pout--) ;
  213|   421k|			b2 = top - (*pout--) ;
  214|   421k|			b3 = top - (*pout--) ;
  215|   421k|			b4 = top - (*pout--) ;
  216|   421k|			b5 = top - (*pout--) ;
  217|   421k|			b6 = top - (*pout--) ;
  218|   421k|			b7 = top - (*pout) ;
  219|   421k|			pout += 8 ;
  220|       |
  221|   421k|			sum1 = (denhalf - a0 * b0 - a1 * b1 - a2 * b2 - a3 * b3
  222|   421k|					- a4 * b4 - a5 * b5 - a6 * b6 - a7 * b7) >> denshift ;
  223|       |
  224|   421k|			del = pc1 [j] ;
  225|   421k|			del0 = del ;
  226|   421k|			sg = sign_of_int (del) ;
  227|   421k|			del += top + sum1 ;
  228|       |
  229|   421k|			out [j] = arith_shift_left (del, chanshift) >> chanshift ;
  230|       |
  231|   421k|			if (sg > 0)
  ------------------
  |  Branch (231:8): [True: 78.0k, False: 343k]
  ------------------
  232|  78.0k|			{
  233|  78.0k|				sgn = sign_of_int (b7) ;
  234|  78.0k|				a7 -= sgn ;
  235|  78.0k|				del0 -= 1 * ((sgn * b7) >> denshift) ;
  236|  78.0k|				if (del0 <= 0)
  ------------------
  |  Branch (236:9): [True: 15.5k, False: 62.5k]
  ------------------
  237|  15.5k|					continue ;
  238|       |
  239|  62.5k|				sgn = sign_of_int (b6) ;
  240|  62.5k|				a6 -= sgn ;
  241|  62.5k|				del0 -= 2 * ((sgn * b6) >> denshift) ;
  242|  62.5k|				if (del0 <= 0)
  ------------------
  |  Branch (242:9): [True: 9.55k, False: 53.0k]
  ------------------
  243|  9.55k|					continue ;
  244|       |
  245|  53.0k|				sgn = sign_of_int (b5) ;
  246|  53.0k|				a5 -= sgn ;
  247|  53.0k|				del0 -= 3 * ((sgn * b5) >> denshift) ;
  248|  53.0k|				if (del0 <= 0)
  ------------------
  |  Branch (248:9): [True: 9.56k, False: 43.4k]
  ------------------
  249|  9.56k|					continue ;
  250|       |
  251|  43.4k|				sgn = sign_of_int (b4) ;
  252|  43.4k|				a4 -= sgn ;
  253|  43.4k|				del0 -= 4 * ((sgn * b4) >> denshift) ;
  254|  43.4k|				if (del0 <= 0)
  ------------------
  |  Branch (254:9): [True: 9.25k, False: 34.2k]
  ------------------
  255|  9.25k|					continue ;
  256|       |
  257|  34.2k|				sgn = sign_of_int (b3) ;
  258|  34.2k|				a3 -= sgn ;
  259|  34.2k|				del0 -= 5 * ((sgn * b3) >> denshift) ;
  260|  34.2k|				if (del0 <= 0)
  ------------------
  |  Branch (260:9): [True: 9.37k, False: 24.8k]
  ------------------
  261|  9.37k|					continue ;
  262|       |
  263|  24.8k|				sgn = sign_of_int (b2) ;
  264|  24.8k|				a2 -= sgn ;
  265|  24.8k|				del0 -= 6 * ((sgn * b2) >> denshift) ;
  266|  24.8k|				if (del0 <= 0)
  ------------------
  |  Branch (266:9): [True: 7.47k, False: 17.3k]
  ------------------
  267|  7.47k|					continue ;
  268|       |
  269|  17.3k|				sgn = sign_of_int (b1) ;
  270|  17.3k|				a1 -= sgn ;
  271|  17.3k|				del0 -= 7 * ((sgn * b1) >> denshift) ;
  272|  17.3k|				if (del0 <= 0)
  ------------------
  |  Branch (272:9): [True: 4.82k, False: 12.5k]
  ------------------
  273|  4.82k|					continue ;
  274|       |
  275|  12.5k|				a0 -= sign_of_int (b0) ;
  276|  12.5k|			}
  277|   343k|			else if (sg < 0)
  ------------------
  |  Branch (277:13): [True: 81.6k, False: 262k]
  ------------------
  278|  81.6k|			{
  279|       |				// note: to avoid unnecessary negations, we flip the value of "sgn"
  280|  81.6k|				sgn = -sign_of_int (b7) ;
  281|  81.6k|				a7 -= sgn ;
  282|  81.6k|				del0 -= 1 * ((sgn * b7) >> denshift) ;
  283|  81.6k|				if (del0 >= 0)
  ------------------
  |  Branch (283:9): [True: 9.55k, False: 72.0k]
  ------------------
  284|  9.55k|					continue ;
  285|       |
  286|  72.0k|				sgn = -sign_of_int (b6) ;
  287|  72.0k|				a6 -= sgn ;
  288|  72.0k|				del0 -= 2 * ((sgn * b6) >> denshift) ;
  289|  72.0k|				if (del0 >= 0)
  ------------------
  |  Branch (289:9): [True: 7.25k, False: 64.8k]
  ------------------
  290|  7.25k|					continue ;
  291|       |
  292|  64.8k|				sgn = -sign_of_int (b5) ;
  293|  64.8k|				a5 -= sgn ;
  294|  64.8k|				del0 -= 3 * ((sgn * b5) >> denshift) ;
  295|  64.8k|				if (del0 >= 0)
  ------------------
  |  Branch (295:9): [True: 10.2k, False: 54.6k]
  ------------------
  296|  10.2k|					continue ;
  297|       |
  298|  54.6k|				sgn = -sign_of_int (b4) ;
  299|  54.6k|				a4 -= sgn ;
  300|  54.6k|				del0 -= 4 * ((sgn * b4) >> denshift) ;
  301|  54.6k|				if (del0 >= 0)
  ------------------
  |  Branch (301:9): [True: 12.4k, False: 42.1k]
  ------------------
  302|  12.4k|					continue ;
  303|       |
  304|  42.1k|				sgn = -sign_of_int (b3) ;
  305|  42.1k|				a3 -= sgn ;
  306|  42.1k|				del0 -= 5 * ((sgn * b3) >> denshift) ;
  307|  42.1k|				if (del0 >= 0)
  ------------------
  |  Branch (307:9): [True: 11.6k, False: 30.4k]
  ------------------
  308|  11.6k|					continue ;
  309|       |
  310|  30.4k|				sgn = -sign_of_int (b2) ;
  311|  30.4k|				a2 -= sgn ;
  312|  30.4k|				del0 -= 6 * ((sgn * b2) >> denshift) ;
  313|  30.4k|				if (del0 >= 0)
  ------------------
  |  Branch (313:9): [True: 9.81k, False: 20.6k]
  ------------------
  314|  9.81k|					continue ;
  315|       |
  316|  20.6k|				sgn = -sign_of_int (b1) ;
  317|  20.6k|				a1 -= sgn ;
  318|  20.6k|				del0 -= 7 * ((sgn * b1) >> denshift) ;
  319|  20.6k|				if (del0 >= 0)
  ------------------
  |  Branch (319:9): [True: 6.87k, False: 13.7k]
  ------------------
  320|  6.87k|					continue ;
  321|       |
  322|  13.7k|				a0 += sign_of_int (b0) ;
  323|  13.7k|			}
  324|   421k|		}
  325|       |
  326|    875|		coefs [0] = a0 ;
  327|    875|		coefs [1] = a1 ;
  328|    875|		coefs [2] = a2 ;
  329|    875|		coefs [3] = a3 ;
  330|    875|		coefs [4] = a4 ;
  331|    875|		coefs [5] = a5 ;
  332|    875|		coefs [6] = a6 ;
  333|    875|		coefs [7] = a7 ;
  334|    875|	}
  335|  2.74k|	else
  336|  2.74k|	{
  337|       |		// general case
  338|   413k|		for (j = lim ; j < num ; j++)
  ------------------
  |  Branch (338:18): [True: 410k, False: 2.74k]
  ------------------
  339|   410k|		{
  340|   410k|			LOOP_ALIGN
  341|       |
  342|   410k|			sum1 = 0 ;
  343|   410k|			pout = out + j - 1 ;
  344|   410k|			top = out [j-lim] ;
  345|       |
  346|  4.65M|			for (k = 0 ; k < numactive ; k++)
  ------------------
  |  Branch (346:17): [True: 4.24M, False: 410k]
  ------------------
  347|  4.24M|				sum1 += coefs [k] * (pout [-k] - top) ;
  348|       |
  349|   410k|			del = pc1 [j] ;
  350|   410k|			del0 = del ;
  351|   410k|			sg = sign_of_int (del) ;
  352|   410k|			del += top + ((sum1 + denhalf) >> denshift) ;
  353|   410k|			out [j] = (del << chanshift) >> chanshift ;
  354|       |
  355|   410k|			if (sg > 0)
  ------------------
  |  Branch (355:8): [True: 96.6k, False: 313k]
  ------------------
  356|  96.6k|			{
  357|   725k|				for (k = (numactive - 1) ; k >= 0 ; k--)
  ------------------
  |  Branch (357:32): [True: 663k, False: 62.0k]
  ------------------
  358|   663k|				{
  359|   663k|					dd = top - pout [-k] ;
  360|   663k|					sgn = sign_of_int (dd) ;
  361|   663k|					coefs [k] -= sgn ;
  362|   663k|					del0 -= (numactive - k) * ((sgn * dd) >> denshift) ;
  363|   663k|					if (del0 <= 0)
  ------------------
  |  Branch (363:10): [True: 34.6k, False: 628k]
  ------------------
  364|  34.6k|						break ;
  365|   663k|				}
  366|  96.6k|			}
  367|   313k|			else if (sg < 0)
  ------------------
  |  Branch (367:13): [True: 244k, False: 69.7k]
  ------------------
  368|   244k|			{
  369|  2.24M|				for (k = (numactive - 1) ; k >= 0 ; k--)
  ------------------
  |  Branch (369:32): [True: 2.04M, False: 197k]
  ------------------
  370|  2.04M|				{
  371|  2.04M|					dd = top - pout [-k] ;
  372|  2.04M|					sgn = sign_of_int (dd) ;
  373|  2.04M|					coefs [k] += sgn ;
  374|  2.04M|					del0 -= (numactive - k) * ((-sgn * dd) >> denshift) ;
  375|  2.04M|					if (del0 >= 0)
  ------------------
  |  Branch (375:10): [True: 46.2k, False: 1.99M]
  ------------------
  376|  46.2k|						break ;
  377|  2.04M|				}
  378|   244k|			}
  379|   410k|		}
  380|  2.74k|	}
  381|  4.68k|}
dp_dec.c:sign_of_int:
   47|  4.78M|{
   48|  4.78M|	int32_t negishift ;
   49|       |
   50|  4.78M|	negishift = ((uint32_t) - i) >> 31 ;
   51|  4.78M|	return negishift | (i >> 31) ;
   52|  4.78M|}

unmix16:
   66|  1.13k|{
   67|  1.13k|	int32_t 	j ;
   68|       |
   69|  1.13k|	if (mixres != 0)
  ------------------
  |  Branch (69:6): [True: 552, False: 579]
  ------------------
   70|    552|	{
   71|       |		/* matrixed stereo */
   72|  1.79k|		for (j = 0 ; j < numSamples ; j++)
  ------------------
  |  Branch (72:16): [True: 1.24k, False: 552]
  ------------------
   73|  1.24k|		{
   74|  1.24k|			int32_t		l, r ;
   75|       |
   76|  1.24k|			l = u [j] + v [j] - ((mixres * v [j]) >> mixbits) ;
   77|  1.24k|			r = l - v [j] ;
   78|       |
   79|  1.24k|			out [0] = arith_shift_left (l, 16) ;
   80|  1.24k|			out [1] = arith_shift_left (r, 16) ;
   81|  1.24k|			out += stride ;
   82|  1.24k|		}
   83|    552|	}
   84|    579|	else
   85|    579|	{
   86|       |		/* Conventional separated stereo. */
   87|  20.7k|		for (j = 0 ; j < numSamples ; j++)
  ------------------
  |  Branch (87:16): [True: 20.1k, False: 579]
  ------------------
   88|  20.1k|		{
   89|  20.1k|			out [0] = u [j] << 16 ;
   90|  20.1k|			out [1] = v [j] << 16 ;
   91|  20.1k|			out += stride ;
   92|  20.1k|		}
   93|    579|	}
   94|  1.13k|}
unmix20:
  101|    818|{
  102|    818|	int32_t 	j ;
  103|       |
  104|    818|	if (mixres != 0)
  ------------------
  |  Branch (104:6): [True: 331, False: 487]
  ------------------
  105|    331|	{
  106|       |		/* matrixed stereo */
  107|  1.88k|		for (j = 0 ; j < numSamples ; j++)
  ------------------
  |  Branch (107:16): [True: 1.55k, False: 331]
  ------------------
  108|  1.55k|		{
  109|  1.55k|			int32_t		l, r ;
  110|       |
  111|  1.55k|			l = u [j] + v [j] - ((mixres * v [j]) >> mixbits) ;
  112|  1.55k|			r = l - v [j] ;
  113|       |
  114|  1.55k|			out [0] = arith_shift_left (l, 12) ;
  115|  1.55k|			out [1] = arith_shift_left (r, 12) ;
  116|  1.55k|			out += stride ;
  117|  1.55k|		}
  118|    331|	}
  119|    487|	else
  120|    487|	{
  121|       |		/* Conventional separated stereo. */
  122|  21.9k|		for (j = 0 ; j < numSamples ; j++)
  ------------------
  |  Branch (122:16): [True: 21.5k, False: 487]
  ------------------
  123|  21.5k|		{
  124|  21.5k|			out [0] = arith_shift_left (u [j], 12) ;
  125|  21.5k|			out [1] = arith_shift_left (v [j], 12) ;
  126|  21.5k|			out += stride ;
  127|  21.5k|		}
  128|    487|	}
  129|    818|}
unmix24:
  137|  1.50k|{
  138|  1.50k|	int32_t		shift = bytesShifted * 8 ;
  139|  1.50k|	int32_t		l, r ;
  140|  1.50k|	int32_t 		j, k ;
  141|       |
  142|  1.50k|	if (mixres != 0)
  ------------------
  |  Branch (142:6): [True: 750, False: 759]
  ------------------
  143|    750|	{
  144|       |		/* matrixed stereo */
  145|    750|		if (bytesShifted != 0)
  ------------------
  |  Branch (145:7): [True: 71, False: 679]
  ------------------
  146|     71|		{
  147|    582|			for (j = 0, k = 0 ; j < numSamples ; j++, k += 2)
  ------------------
  |  Branch (147:24): [True: 511, False: 71]
  ------------------
  148|    511|			{
  149|    511|				l = u [j] + v [j] - ((mixres * v [j]) >> mixbits) ;
  150|    511|				r = l - v [j] ;
  151|       |
  152|    511|				l = arith_shift_left (l, shift) | (uint32_t) shiftUV [k + 0] ;
  153|    511|				r = arith_shift_left (r, shift) | (uint32_t) shiftUV [k + 1] ;
  154|       |
  155|    511|				out [0] = arith_shift_left (l, 8) ;
  156|    511|				out [1] = arith_shift_left (r, 8) ;
  157|    511|				out += stride ;
  158|    511|			}
  159|     71|		}
  160|    679|		else
  161|    679|		{
  162|  4.67k|			for (j = 0 ; j < numSamples ; j++)
  ------------------
  |  Branch (162:17): [True: 3.99k, False: 679]
  ------------------
  163|  3.99k|			{
  164|  3.99k|				l = u [j] + v [j] - ((mixres * v [j]) >> mixbits) ;
  165|  3.99k|				r = l - v [j] ;
  166|       |
  167|  3.99k|				out [0] = l << 8 ;
  168|  3.99k|				out [1] = r << 8 ;
  169|  3.99k|				out += stride ;
  170|  3.99k|			}
  171|    679|		}
  172|    750|	}
  173|    759|	else
  174|    759|	{
  175|       |		/* Conventional separated stereo. */
  176|    759|		if (bytesShifted != 0)
  ------------------
  |  Branch (176:7): [True: 158, False: 601]
  ------------------
  177|    158|		{
  178|    785|			for (j = 0, k = 0 ; j < numSamples ; j++, k += 2)
  ------------------
  |  Branch (178:24): [True: 627, False: 158]
  ------------------
  179|    627|			{
  180|    627|				l = u [j] ;
  181|    627|				r = v [j] ;
  182|       |
  183|    627|				l = (l << shift) | (uint32_t) shiftUV [k + 0] ;
  184|    627|				r = (r << shift) | (uint32_t) shiftUV [k + 1] ;
  185|       |
  186|    627|				out [0] = l << 8 ;
  187|    627|				out [1] = r << 8 ;
  188|    627|				out += stride ;
  189|    627|			}
  190|    158|		}
  191|    601|		else
  192|    601|		{
  193|  19.0k|			for (j = 0 ; j < numSamples ; j++)
  ------------------
  |  Branch (193:17): [True: 18.4k, False: 601]
  ------------------
  194|  18.4k|			{
  195|  18.4k|				out [0] = u [j] << 8 ;
  196|  18.4k|				out [1] = v [j] << 8 ;
  197|  18.4k|				out += stride ;
  198|  18.4k|			}
  199|    601|		}
  200|    759|	}
  201|  1.50k|}
unmix32:
  211|  1.24k|{
  212|  1.24k|	int32_t		shift = bytesShifted * 8 ;
  213|  1.24k|	int32_t		l, r ;
  214|  1.24k|	int32_t 	j, k ;
  215|       |
  216|  1.24k|	if (mixres != 0)
  ------------------
  |  Branch (216:6): [True: 568, False: 681]
  ------------------
  217|    568|	{
  218|       |		//Assert (bytesShifted != 0) ;
  219|       |
  220|       |		/* matrixed stereo with shift */
  221|  6.00k|		for (j = 0, k = 0 ; j < numSamples ; j++, k += 2)
  ------------------
  |  Branch (221:23): [True: 5.43k, False: 568]
  ------------------
  222|  5.43k|		{
  223|  5.43k|			int32_t		lt, rt ;
  224|       |
  225|  5.43k|			lt = u [j] ;
  226|  5.43k|			rt = v [j] ;
  227|       |
  228|  5.43k|			l = lt + rt - ((mixres * rt) >> mixbits) ;
  229|  5.43k|			r = l - rt ;
  230|       |
  231|  5.43k|			out [0] = arith_shift_left (l, shift) | (uint32_t) shiftUV [k + 0] ;
  232|  5.43k|			out [1] = arith_shift_left (r, shift) | (uint32_t) shiftUV [k + 1] ;
  233|  5.43k|			out += stride ;
  234|  5.43k|		}
  235|    568|	}
  236|    681|	else
  237|    681|	{
  238|    681|		if (bytesShifted == 0)
  ------------------
  |  Branch (238:7): [True: 558, False: 123]
  ------------------
  239|    558|		{
  240|       |			/* interleaving w/o shift */
  241|  67.2k|			for (j = 0 ; j < numSamples ; j++)
  ------------------
  |  Branch (241:17): [True: 66.7k, False: 558]
  ------------------
  242|  66.7k|			{
  243|  66.7k|				out [0] = u [j] ;
  244|  66.7k|				out [1] = v [j] ;
  245|  66.7k|				out += stride ;
  246|  66.7k|			}
  247|    558|		}
  248|    123|		else
  249|    123|		{
  250|       |			/* interleaving with shift */
  251|    842|			for (j = 0, k = 0 ; j < numSamples ; j++, k += 2)
  ------------------
  |  Branch (251:24): [True: 719, False: 123]
  ------------------
  252|    719|			{
  253|    719|				out [0] = (u [j] << shift) | (uint32_t) shiftUV [k + 0] ;
  254|    719|				out [1] = (v [j] << shift) | (uint32_t) shiftUV [k + 1] ;
  255|    719|				out += stride ;
  256|    719|			}
  257|    123|		}
  258|    681|	}
  259|  1.24k|}
copyPredictorTo24:
  265|  4.10k|{
  266|  4.10k|	int32_t		j ;
  267|       |
  268|   845k|	for (j = 0 ; j < numSamples ; j++)
  ------------------
  |  Branch (268:15): [True: 841k, False: 4.10k]
  ------------------
  269|   841k|	{
  270|   841k|		out [0] = in [j] << 8 ;
  271|   841k|		out += stride ;
  272|   841k|	}
  273|  4.10k|}
copyPredictorTo24Shift:
  277|  1.19k|{
  278|  1.19k|	int32_t		shiftVal = bytesShifted * 8 ;
  279|  1.19k|	int32_t		j ;
  280|       |
  281|       |	//Assert (bytesShifted != 0) ;
  282|       |
  283|  4.40k|	for (j = 0 ; j < numSamples ; j++)
  ------------------
  |  Branch (283:15): [True: 3.20k, False: 1.19k]
  ------------------
  284|  3.20k|	{
  285|  3.20k|		int32_t		val = in [j] ;
  286|       |
  287|  3.20k|		val = arith_shift_left (val, shiftVal) | (uint32_t) shift [j] ;
  288|  3.20k|		out [0] = arith_shift_left (val, 8) ;
  289|  3.20k|		out += stride ;
  290|  3.20k|	}
  291|  1.19k|}
copyPredictorTo20:
  295|  1.57k|{
  296|  1.57k|	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|   125k|	for (j = 0 ; j < numSamples ; j++)
  ------------------
  |  Branch (300:15): [True: 123k, False: 1.57k]
  ------------------
  301|   123k|	{
  302|   123k|		out [0] = arith_shift_left (in [j], 12) ;
  303|   123k|		out += stride ;
  304|   123k|	}
  305|  1.57k|}
copyPredictorTo32:
  309|  2.85k|{
  310|  2.85k|	int32_t			i, j ;
  311|       |
  312|       |	// this is only a subroutine to abstract the "iPod can only output 16-bit data" problem
  313|   161k|	for (i = 0, j = 0 ; i < numSamples ; i++, j += stride)
  ------------------
  |  Branch (313:22): [True: 158k, False: 2.85k]
  ------------------
  314|   158k|		out [j] = arith_shift_left (in [i], 8) ;
  315|  2.85k|}
copyPredictorTo32Shift:
  319|  1.42k|{
  320|  1.42k|	int32_t *		op = out ;
  321|  1.42k|	uint32_t		shiftVal = bytesShifted * 8 ;
  322|  1.42k|	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|  3.96k|	for (j = 0 ; j < numSamples ; j++)
  ------------------
  |  Branch (327:15): [True: 2.54k, False: 1.42k]
  ------------------
  328|  2.54k|	{
  329|  2.54k|		op [0] = arith_shift_left (in [j], shiftVal) | (uint32_t) shift [j] ;
  330|  2.54k|		op += stride ;
  331|  2.54k|	}
  332|  1.42k|}

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

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

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

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

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

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

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

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

decode.c:GSM_MULT_R:
  118|   664k|{	return (((int32_t) (a)) * ((int32_t) (b)) + 16384) >> 15 ;
  119|   664k|} /* GSM_MULT_R */
decode.c:GSM_ADD:
  150|  1.32M|{	int32_t ltmp ;
  151|       |
  152|  1.32M|	ltmp = ((int32_t) a) + ((int32_t) b) ;
  153|       |
  154|  1.32M|	if (ltmp >= MAX_WORD)
  ------------------
  |  |   52|  1.32M|#define	MAX_WORD	32767
  ------------------
  |  Branch (154:6): [True: 246k, False: 1.08M]
  ------------------
  155|   246k|		return MAX_WORD ;
  ------------------
  |  |   52|   246k|#define	MAX_WORD	32767
  ------------------
  156|  1.08M|	if (ltmp <= MIN_WORD)
  ------------------
  |  |   51|  1.08M|#define	MIN_WORD	(-32767 - 1)
  ------------------
  |  Branch (156:6): [True: 268k, False: 813k]
  ------------------
  157|   268k|		return MIN_WORD ;
  ------------------
  |  |   51|   268k|#define	MIN_WORD	(-32767 - 1)
  ------------------
  158|       |
  159|   813k|	return ltmp ;
  160|  1.08M|} /* GSM_ADD */
long_term.c:GSM_MULT_R:
  118|   664k|{	return (((int32_t) (a)) * ((int32_t) (b)) + 16384) >> 15 ;
  119|   664k|} /* GSM_MULT_R */
long_term.c:GSM_ADD:
  150|   664k|{	int32_t ltmp ;
  151|       |
  152|   664k|	ltmp = ((int32_t) a) + ((int32_t) b) ;
  153|       |
  154|   664k|	if (ltmp >= MAX_WORD)
  ------------------
  |  |   52|   664k|#define	MAX_WORD	32767
  ------------------
  |  Branch (154:6): [True: 44.9k, False: 619k]
  ------------------
  155|  44.9k|		return MAX_WORD ;
  ------------------
  |  |   52|  44.9k|#define	MAX_WORD	32767
  ------------------
  156|   619k|	if (ltmp <= MIN_WORD)
  ------------------
  |  |   51|   619k|#define	MIN_WORD	(-32767 - 1)
  ------------------
  |  Branch (156:6): [True: 853, False: 618k]
  ------------------
  157|    853|		return MIN_WORD ;
  ------------------
  |  |   51|    853|#define	MIN_WORD	(-32767 - 1)
  ------------------
  158|       |
  159|   618k|	return ltmp ;
  160|   619k|} /* GSM_ADD */
rpe.c:SASR_W:
   60|  9.15k|{	if (x >= 0)
  ------------------
  |  Branch (60:7): [True: 9.15k, False: 0]
  ------------------
   61|  9.15k|		return x >> by ;
   62|      0|	return ~ ((~x) >> by) ;
   63|  9.15k|} /* SASR_W */
rpe.c:arith_shift_left:
  306|   216k|{	return (int32_t) (((uint32_t) x) << shift) ;
  307|   216k|} /* arith_shift_left */
rpe.c:GSM_MULT_R:
  118|   216k|{	return (((int32_t) (a)) * ((int32_t) (b)) + 16384) >> 15 ;
  119|   216k|} /* GSM_MULT_R */
rpe.c:GSM_ADD:
  150|   216k|{	int32_t ltmp ;
  151|       |
  152|   216k|	ltmp = ((int32_t) a) + ((int32_t) b) ;
  153|       |
  154|   216k|	if (ltmp >= MAX_WORD)
  ------------------
  |  |   52|   216k|#define	MAX_WORD	32767
  ------------------
  |  Branch (154:6): [True: 0, False: 216k]
  ------------------
  155|      0|		return MAX_WORD ;
  ------------------
  |  |   52|      0|#define	MAX_WORD	32767
  ------------------
  156|   216k|	if (ltmp <= MIN_WORD)
  ------------------
  |  |   51|   216k|#define	MIN_WORD	(-32767 - 1)
  ------------------
  |  Branch (156:6): [True: 0, False: 216k]
  ------------------
  157|      0|		return MIN_WORD ;
  ------------------
  |  |   51|      0|#define	MIN_WORD	(-32767 - 1)
  ------------------
  158|       |
  159|   216k|	return ltmp ;
  160|   216k|} /* GSM_ADD */
short_term.c:arith_shift_left:
  306|  33.2k|{	return (int32_t) (((uint32_t) x) << shift) ;
  307|  33.2k|} /* arith_shift_left */
short_term.c:GSM_ADD:
  150|  5.56M|{	int32_t ltmp ;
  151|       |
  152|  5.56M|	ltmp = ((int32_t) a) + ((int32_t) b) ;
  153|       |
  154|  5.56M|	if (ltmp >= MAX_WORD)
  ------------------
  |  |   52|  5.56M|#define	MAX_WORD	32767
  ------------------
  |  Branch (154:6): [True: 81.9k, False: 5.48M]
  ------------------
  155|  81.9k|		return MAX_WORD ;
  ------------------
  |  |   52|  81.9k|#define	MAX_WORD	32767
  ------------------
  156|  5.48M|	if (ltmp <= MIN_WORD)
  ------------------
  |  |   51|  5.48M|#define	MIN_WORD	(-32767 - 1)
  ------------------
  |  Branch (156:6): [True: 11.8k, False: 5.47M]
  ------------------
  157|  11.8k|		return MIN_WORD ;
  ------------------
  |  |   51|  11.8k|#define	MIN_WORD	(-32767 - 1)
  ------------------
  158|       |
  159|  5.47M|	return ltmp ;
  160|  5.48M|} /* GSM_ADD */
short_term.c:GSM_SUB:
  164|  5.35M|{	int32_t ltmp ;
  165|       |
  166|  5.35M|	ltmp = ((int32_t) a) - ((int32_t) b) ;
  167|       |
  168|  5.35M|	if (ltmp >= MAX_WORD)
  ------------------
  |  |   52|  5.35M|#define	MAX_WORD	32767
  ------------------
  |  Branch (168:6): [True: 197k, False: 5.15M]
  ------------------
  169|   197k|		ltmp = MAX_WORD ;
  ------------------
  |  |   52|   197k|#define	MAX_WORD	32767
  ------------------
  170|  5.15M|	else if (ltmp <= MIN_WORD)
  ------------------
  |  |   51|  5.15M|#define	MIN_WORD	(-32767 - 1)
  ------------------
  |  Branch (170:11): [True: 111k, False: 5.04M]
  ------------------
  171|   111k|		ltmp = MIN_WORD ;
  ------------------
  |  |   51|   111k|#define	MIN_WORD	(-32767 - 1)
  ------------------
  172|       |
  173|  5.35M|	return ltmp ;
  174|  5.35M|} /* GSM_SUB */
short_term.c:GSM_MULT_R:
  118|  33.2k|{	return (((int32_t) (a)) * ((int32_t) (b)) + 16384) >> 15 ;
  119|  33.2k|} /* GSM_MULT_R */
short_term.c:SASR_W:
   60|   265k|{	if (x >= 0)
  ------------------
  |  Branch (60:7): [True: 128k, False: 136k]
  ------------------
   61|   128k|		return x >> by ;
   62|   136k|	return ~ ((~x) >> by) ;
   63|   265k|} /* SASR_W */
add.c:SASR_W:
   60|   222k|{	if (x >= 0)
  ------------------
  |  Branch (60:7): [True: 103k, False: 118k]
  ------------------
   61|   103k|		return x >> by ;
   62|   118k|	return ~ ((~x) >> by) ;
   63|   222k|} /* SASR_W */

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

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

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

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

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

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

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

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

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

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

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

audio_detect:
   48|  3.19k|{	VOTE vote ;
   49|       |
   50|  3.19k|	if (psf == NULL)
  ------------------
  |  Branch (50:6): [True: 0, False: 3.19k]
  ------------------
   51|      0|		return 0 ;
   52|       |
   53|  3.19k|	if (ad == NULL || datalen < 256)
  ------------------
  |  Branch (53:6): [True: 0, False: 3.19k]
  |  Branch (53:20): [True: 0, False: 3.19k]
  ------------------
   54|      0|		return 0 ;
   55|       |
   56|  3.19k|	vote_for_format (&vote, data, datalen) ;
   57|       |
   58|  3.19k|	psf_log_printf (psf, "audio_detect :\n"
   59|  3.19k|			"    le_float     : %d\n"
   60|  3.19k|			"    be_float     : %d\n"
   61|  3.19k|			"    le_int_24_32 : %d\n"
   62|  3.19k|			"    be_int_24_32 : %d\n",
   63|  3.19k|			vote.le_float, vote.be_float, vote.le_int_24_32, vote.be_int_24_32) ;
   64|       |
   65|  3.19k|	if (0) puts (psf->parselog.buf) ;
  ------------------
  |  Branch (65:6): [Folded, False: 3.19k]
  ------------------
   66|       |
   67|  3.19k|	if (ad->endianness == SF_ENDIAN_LITTLE && vote.le_float > (3 * datalen) / 4)
  ------------------
  |  Branch (67:6): [True: 3.19k, False: 0]
  |  Branch (67:44): [True: 2, False: 3.19k]
  ------------------
   68|      2|	{	/* Almost certainly 32 bit floats. */
   69|      2|		return SF_FORMAT_FLOAT ;
   70|  3.19k|		} ;
   71|       |
   72|  3.19k|	if (ad->endianness == SF_ENDIAN_LITTLE && vote.le_int_24_32 > (3 * datalen) / 4)
  ------------------
  |  Branch (72:6): [True: 3.19k, False: 0]
  |  Branch (72:44): [True: 4, False: 3.18k]
  ------------------
   73|      4|	{	/* Almost certainly 24 bit data stored in 32 bit ints. */
   74|      4|		return SF_FORMAT_PCM_32 ;
   75|  3.18k|		} ;
   76|       |
   77|  3.18k|	return 0 ;
   78|  3.19k|} /* data_detect */
audio_detect.c:vote_for_format:
   82|  3.19k|{
   83|  3.19k|	int k ;
   84|       |
   85|  3.19k|	memset (vote, 0, sizeof (VOTE)) ;
   86|       |
   87|  3.19k|	datalen -= datalen % 4 ;
   88|       |
   89|  13.0M|	for (k = 0 ; k < datalen ; k ++)
  ------------------
  |  Branch (89:15): [True: 13.0M, False: 3.19k]
  ------------------
   90|  13.0M|	{	if ((k % 4) == 0)
  ------------------
  |  Branch (90:8): [True: 3.26M, False: 9.80M]
  ------------------
   91|  3.26M|		{	if (data [k] == 0 && data [k + 1] != 0)
  ------------------
  |  Branch (91:9): [True: 2.62M, False: 638k]
  |  Branch (91:26): [True: 13.7k, False: 2.61M]
  ------------------
   92|  13.7k|				vote->le_int_24_32 += 4 ;
   93|       |
   94|  3.26M|			if (data [2] != 0 && data [3] == 0)
  ------------------
  |  Branch (94:8): [True: 657k, False: 2.61M]
  |  Branch (94:25): [True: 4.09k, False: 653k]
  ------------------
   95|  4.09k|				vote->le_int_24_32 += 4 ;
   96|       |
   97|  3.26M|			if (data [0] != 0 && data [3] > 0x43 && data [3] < 0x4B)
  ------------------
  |  Branch (97:8): [True: 660k, False: 2.60M]
  |  Branch (97:25): [True: 623k, False: 36.8k]
  |  Branch (97:44): [True: 2.04k, False: 621k]
  ------------------
   98|  2.04k|				vote->le_float += 4 ;
   99|       |
  100|  3.26M|			if (data [3] != 0 && data [0] > 0x43 && data [0] < 0x4B)
  ------------------
  |  Branch (100:8): [True: 667k, False: 2.60M]
  |  Branch (100:25): [True: 623k, False: 44.0k]
  |  Branch (100:44): [True: 14.3k, False: 609k]
  ------------------
  101|  14.3k|				vote->be_float += 4 ;
  102|  3.26M|			} ;
  103|  13.0M|		} ;
  104|       |
  105|  3.19k|	return ;
  106|  3.19k|} /* 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: 39, False: 52]
  ------------------
   83|     39|			return error ;
   84|     91|		} ;
   85|       |
   86|     52|	if ((SF_CONTAINER (psf->sf.format)) != SF_FORMAT_AVR)
  ------------------
  |  |  108|     52|#define SF_CONTAINER(x)		((x) & SF_FORMAT_TYPEMASK)
  ------------------
  |  Branch (86:6): [True: 0, False: 52]
  ------------------
   87|      0|		return	SFE_BAD_OPEN_FORMAT ;
   88|       |
   89|     52|	if (psf->file.mode == SFM_WRITE || psf->file.mode == SFM_RDWR)
  ------------------
  |  Branch (89:6): [True: 0, False: 52]
  |  Branch (89:37): [True: 0, False: 52]
  ------------------
   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|     52|		} ;
   97|       |
   98|     52|	psf->container_close = avr_close ;
   99|       |
  100|     52|	psf->blockwidth = psf->bytewidth * psf->sf.channels ;
  101|       |
  102|     52|	error = pcm_init (psf) ;
  103|       |
  104|     52|	return error ;
  105|     52|} /* 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: 62, False: 29]
  ------------------
  127|       |
  128|     91|	switch (arith_shift_left (hdr.rez, 16) + (hdr.sign & 1))
  129|     91|	{	case ((8 << 16) + 0) :
  ------------------
  |  Branch (129:4): [True: 16, False: 75]
  ------------------
  130|     16|			psf->sf.format = SF_FORMAT_AVR | SF_FORMAT_PCM_U8 ;
  131|     16|			psf->bytewidth = 1 ;
  132|     16|			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|     13|		case ((16 << 16) + 1) :
  ------------------
  |  Branch (139:3): [True: 13, False: 78]
  ------------------
  140|     13|			psf->sf.format = SF_FORMAT_AVR | SF_FORMAT_PCM_16 ;
  141|     13|			psf->bytewidth = 2 ;
  142|     13|			break ;
  143|       |
  144|     39|		default :
  ------------------
  |  Branch (144:3): [True: 39, False: 52]
  ------------------
  145|     39|			psf_log_printf (psf, "Error : bad rez/sign combination.\n") ;
  146|     39|			return SFE_AVR_BAD_REZ_SIGN ;
  147|     91|		} ;
  148|       |
  149|     52|	psf_binheader_readf (psf, "E4444", &hdr.srate, &hdr.frames, &hdr.lbeg, &hdr.lend) ;
  150|       |
  151|     52|	psf->sf.frames = hdr.frames ;
  152|     52|	psf->sf.samplerate = hdr.srate ;
  153|       |
  154|     52|	psf_log_printf (psf, "  Frames      : %D\n", psf->sf.frames) ;
  155|     52|	psf_log_printf (psf, "  Sample rate : %d\n", psf->sf.samplerate) ;
  156|       |
  157|     52|	psf_binheader_readf (psf, "E222", &hdr.res1, &hdr.res2, &hdr.res3) ;
  158|     52|	psf_binheader_readf (psf, "bb", hdr.ext, sizeof (hdr.ext), hdr.user, sizeof (hdr.user)) ;
  159|       |
  160|     52|	psf_log_printf (psf, "  Ext         : %s\n  User        : %s\n", hdr.ext, hdr.user) ;
  161|       |
  162|     52|	psf->endian = SF_ENDIAN_BIG ;
  163|       |
  164|     52| 	psf->dataoffset = AVR_HDR_SIZE ;
  ------------------
  |  |   29|     52|#define	AVR_HDR_SIZE	128
  ------------------
  165|     52|	psf->datalength = (sf_count_t) hdr.frames * (hdr.rez / 8) ;
  166|       |
  167|     52|	if (psf->fileoffset > 0)
  ------------------
  |  Branch (167:6): [True: 5, False: 47]
  ------------------
  168|      5|		psf->filelength = AVR_HDR_SIZE + psf->datalength ;
  ------------------
  |  |   29|      5|#define	AVR_HDR_SIZE	128
  ------------------
  169|       |
  170|     52|	if (psf_ftell (psf) != psf->dataoffset)
  ------------------
  |  Branch (170:6): [True: 50, False: 2]
  ------------------
  171|     50|		psf_binheader_readf (psf, "j", psf->dataoffset - psf_ftell (psf)) ;
  172|       |
  173|     52|	psf->blockwidth = psf->sf.channels * psf->bytewidth ;
  174|       |
  175|     52|	if (psf->sf.frames == 0 && psf->blockwidth)
  ------------------
  |  Branch (175:6): [True: 5, False: 47]
  |  Branch (175:29): [True: 5, False: 0]
  ------------------
  176|      5|		psf->sf.frames = (psf->filelength - psf->dataoffset) / psf->blockwidth ;
  177|       |
  178|     52|	return 0 ;
  179|     91|} /* avr_read_header */
avr.c:avr_close:
  238|     52|{
  239|     52|	if (psf->file.mode == SFM_WRITE || psf->file.mode == SFM_RDWR)
  ------------------
  |  Branch (239:6): [True: 0, False: 52]
  |  Branch (239:37): [True: 0, False: 52]
  ------------------
  240|      0|		avr_write_header (psf, SF_TRUE) ;
  241|       |
  242|     52|	return 0 ;
  243|     52|} /* avr_close */

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

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

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

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

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

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

aiff.c:peak_info_calloc:
  233|    696|{	return calloc (1, sizeof (PEAK_INFO) + channels * sizeof (PEAK_POS)) ;
  234|    696|} /* peak_info_calloc */
aiff.c:make_size_t:
  279|  2.54k|{	return (size_t) x ;
  280|  2.54k|} /* make_size_t */
avr.c:arith_shift_left:
 1086|     91|{	return (int32_t) (((uint32_t) x) << shift) ;
 1087|     91|} /* arith_shift_left */
caf.c:peak_info_calloc:
  233|    144|{	return calloc (1, sizeof (PEAK_INFO) + channels * sizeof (PEAK_POS)) ;
  234|    144|} /* peak_info_calloc */
caf.c:psf_lrint:
  974|  2.23k|{
  975|  2.23k|	#ifdef USE_SSE2
  976|  2.23k|		return _mm_cvtsd_si32 (_mm_load_sd (&x)) ;
  977|       |	#else
  978|       |		return lrint (x) ;
  979|       |	#endif
  980|  2.23k|} /* psf_lrintf */
mat4.c:psf_lrint:
  974|    565|{
  975|    565|	#ifdef USE_SSE2
  976|    565|		return _mm_cvtsd_si32 (_mm_load_sd (&x)) ;
  977|       |	#else
  978|       |		return lrint (x) ;
  979|       |	#endif
  980|    565|} /* psf_lrintf */
mat5.c:psf_lrint:
  974|      1|{
  975|      1|	#ifdef USE_SSE2
  976|      1|		return _mm_cvtsd_si32 (_mm_load_sd (&x)) ;
  977|       |	#else
  978|       |		return lrint (x) ;
  979|       |	#endif
  980|      1|} /* psf_lrintf */
sds.c:arith_shift_left:
 1086|  87.9M|{	return (int32_t) (((uint32_t) x) << shift) ;
 1087|  87.9M|} /* arith_shift_left */
wavlike.c:make_size_t:
  279|  2.49k|{	return (size_t) x ;
  280|  2.49k|} /* make_size_t */
wavlike.c:peak_info_calloc:
  233|  7.79k|{	return calloc (1, sizeof (PEAK_INFO) + channels * sizeof (PEAK_POS)) ;
  234|  7.79k|} /* peak_info_calloc */
xi.c:arith_shift_left:
 1086|    506|{	return (int32_t) (((uint32_t) x) << shift) ;
 1087|    506|} /* arith_shift_left */
mpc2k.c:make_size_t:
  279|     11|{	return (size_t) x ;
  280|     11|} /* make_size_t */
dwvw.c:arith_shift_left:
 1086|  33.1M|{	return (int32_t) (((uint32_t) x) << shift) ;
 1087|  33.1M|} /* arith_shift_left */

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

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

flac_open:
 1458|      1|{
 1459|      1|	psf_log_printf (psf, "This version of libsndfile was compiled without FLAC support.\n") ;
 1460|      1|	return SFE_UNIMPLEMENTED ;
 1461|      1|} /* flac_open */

float32_init:
   89|    257|{	static int float_caps ;
   90|       |
   91|    257|	if (psf->sf.channels < 1)
  ------------------
  |  Branch (91:6): [True: 12, False: 245]
  ------------------
   92|     12|	{	psf_log_printf (psf, "float32_init : internal error : channels = %d\n", psf->sf.channels) ;
   93|     12|		return SFE_INTERNAL ;
   94|    245|		} ;
   95|       |
   96|    245|	float_caps = float32_get_capability (psf) ;
   97|       |
   98|    245|	psf->blockwidth = sizeof (float) * psf->sf.channels ;
   99|       |
  100|    245|	if (psf->file.mode == SFM_READ || psf->file.mode == SFM_RDWR)
  ------------------
  |  Branch (100:6): [True: 245, False: 0]
  |  Branch (100:36): [True: 0, False: 0]
  ------------------
  101|    245|	{	switch (psf->endian + float_caps)
  102|    245|		{	case (SF_ENDIAN_BIG + FLOAT_CAN_RW_BE) :
  ------------------
  |  Branch (102:5): [True: 0, False: 245]
  ------------------
  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: 98]
  ------------------
  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|     98|			case (SF_ENDIAN_BIG + FLOAT_CAN_RW_LE) :
  ------------------
  |  Branch (118:4): [True: 98, False: 147]
  ------------------
  119|     98|					psf->data_endswap = SF_TRUE ;
  120|     98|					psf->read_short		= host_read_f2s ;
  121|     98|					psf->read_int		= host_read_f2i ;
  122|     98|					psf->read_float		= host_read_f ;
  123|     98|					psf->read_double	= host_read_f2d ;
  124|     98|					break ;
  125|       |
  126|      0|			case (SF_ENDIAN_LITTLE + FLOAT_CAN_RW_BE) :
  ------------------
  |  Branch (126:4): [True: 0, False: 245]
  ------------------
  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: 245]
  ------------------
  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: 245]
  ------------------
  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: 245]
  ------------------
  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: 245]
  ------------------
  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: 245]
  ------------------
  168|    245|			} ;
  169|    245|		} ;
  170|       |
  171|    245|	if (psf->file.mode == SFM_WRITE || psf->file.mode == SFM_RDWR)
  ------------------
  |  Branch (171:6): [True: 0, False: 245]
  |  Branch (171:37): [True: 0, False: 245]
  ------------------
  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|    245|		} ;
  241|       |
  242|    245|	if (psf->filelength > psf->dataoffset)
  ------------------
  |  Branch (242:6): [True: 193, False: 52]
  ------------------
  243|    193|	{	psf->datalength = (psf->dataend > 0) ? psf->dataend - psf->dataoffset :
  ------------------
  |  Branch (243:22): [True: 6, False: 187]
  ------------------
  244|    193|							psf->filelength - psf->dataoffset ;
  245|    193|		}
  246|     52|	else
  247|     52|		psf->datalength = 0 ;
  248|       |
  249|    245|	psf->sf.frames = psf->blockwidth > 0 ? psf->datalength / psf->blockwidth : 0 ;
  ------------------
  |  Branch (249:19): [True: 245, False: 0]
  ------------------
  250|       |
  251|    245|	return 0 ;
  252|    245|} /* float32_init */
float32_be_read:
  256|  2.84k|{	int		exponent, mantissa, negative ;
  257|  2.84k|	float	fvalue ;
  258|       |
  259|  2.84k|	negative = cptr [0] & 0x80 ;
  260|  2.84k|	exponent = ((cptr [0] & 0x7F) << 1) | ((cptr [1] & 0x80) ? 1 : 0) ;
  ------------------
  |  Branch (260:41): [True: 342, False: 2.49k]
  ------------------
  261|  2.84k|	mantissa = ((cptr [1] & 0x7F) << 16) | (cptr [2] << 8) | (cptr [3]) ;
  262|       |
  263|  2.84k|	if (! (exponent || mantissa))
  ------------------
  |  Branch (263:9): [True: 951, False: 1.89k]
  |  Branch (263:21): [True: 1.03k, False: 858]
  ------------------
  264|    858|		return 0.0 ;
  265|       |
  266|  1.98k|	mantissa |= 0x800000 ;
  267|  1.98k|	exponent = exponent ? exponent - 127 : 0 ;
  ------------------
  |  Branch (267:13): [True: 951, False: 1.03k]
  ------------------
  268|       |
  269|  1.98k|	fvalue = mantissa ? ((float) mantissa) / ((float) 0x800000) : 0.0 ;
  ------------------
  |  Branch (269:11): [True: 1.98k, False: 0]
  ------------------
  270|       |
  271|  1.98k|	if (negative)
  ------------------
  |  Branch (271:6): [True: 427, False: 1.55k]
  ------------------
  272|    427|		fvalue *= -1 ;
  273|       |
  274|  1.98k|	if (exponent > 0)
  ------------------
  |  Branch (274:6): [True: 450, False: 1.53k]
  ------------------
  275|    450|		fvalue *= pow (2.0, exponent) ;
  276|  1.53k|	else if (exponent < 0)
  ------------------
  |  Branch (276:11): [True: 501, False: 1.03k]
  ------------------
  277|    501|		fvalue /= pow (2.0, abs (exponent)) ;
  278|       |
  279|  1.98k|	return fvalue ;
  280|  2.84k|} /* float32_be_read */
float32_le_read:
  284|  26.1k|{	int		exponent, mantissa, negative ;
  285|  26.1k|	float	fvalue ;
  286|       |
  287|  26.1k|	negative = cptr [3] & 0x80 ;
  288|  26.1k|	exponent = ((cptr [3] & 0x7F) << 1) | ((cptr [2] & 0x80) ? 1 : 0) ;
  ------------------
  |  Branch (288:41): [True: 8.13k, False: 18.0k]
  ------------------
  289|  26.1k|	mantissa = ((cptr [2] & 0x7F) << 16) | (cptr [1] << 8) | (cptr [0]) ;
  290|       |
  291|  26.1k|	if (! (exponent || mantissa))
  ------------------
  |  Branch (291:9): [True: 17.3k, False: 8.80k]
  |  Branch (291:21): [True: 6.11k, False: 2.69k]
  ------------------
  292|  2.69k|		return 0.0 ;
  293|       |
  294|  23.4k|	mantissa |= 0x800000 ;
  295|  23.4k|	exponent = exponent ? exponent - 127 : 0 ;
  ------------------
  |  Branch (295:13): [True: 17.3k, False: 6.11k]
  ------------------
  296|       |
  297|  23.4k|	fvalue = mantissa ? ((float) mantissa) / ((float) 0x800000) : 0.0 ;
  ------------------
  |  Branch (297:11): [True: 23.4k, False: 0]
  ------------------
  298|       |
  299|  23.4k|	if (negative)
  ------------------
  |  Branch (299:6): [True: 10.1k, False: 13.2k]
  ------------------
  300|  10.1k|		fvalue *= -1 ;
  301|       |
  302|  23.4k|	if (exponent > 0)
  ------------------
  |  Branch (302:6): [True: 10.2k, False: 13.1k]
  ------------------
  303|  10.2k|		fvalue *= pow (2.0, exponent) ;
  304|  13.1k|	else if (exponent < 0)
  ------------------
  |  Branch (304:11): [True: 7.07k, False: 6.11k]
  ------------------
  305|  7.07k|		fvalue /= pow (2.0, abs (exponent)) ;
  306|       |
  307|  23.4k|	return fvalue ;
  308|  26.1k|} /* float32_le_read */
float32.c:float32_get_capability:
  410|    245|{	union
  411|    245|	{	float			f ;
  412|    245|		int				i ;
  413|    245|		unsigned char	c [4] ;
  414|    245|	} data ;
  415|       |
  416|    245|	data.f = (float) 1.23456789 ; /* Some arbitrary value. */
  417|       |
  418|    245|	if (! psf->ieee_replace)
  ------------------
  |  Branch (418:6): [True: 245, False: 0]
  ------------------
  419|    245|	{	/* If this test is true ints and floats are compatible and little endian. */
  420|    245|		if (data.c [0] == 0x52 && data.c [1] == 0x06 && data.c [2] == 0x9e && data.c [3] == 0x3f)
  ------------------
  |  Branch (420:7): [True: 245, False: 0]
  |  Branch (420:29): [True: 245, False: 0]
  |  Branch (420:51): [True: 245, False: 0]
  |  Branch (420:73): [True: 245, False: 0]
  ------------------
  421|    245|			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|    245|} /* float32_get_capability */
float32.c:host_read_f:
  574|    673|{	BUF_UNION	ubuf ;
  575|    673|	int			bufferlen, readcount ;
  576|    673|	sf_count_t	total = 0 ;
  577|       |
  578|    673|	if (psf->data_endswap != SF_TRUE)
  ------------------
  |  Branch (578:6): [True: 264, False: 409]
  ------------------
  579|    264|		return psf_fread (ptr, sizeof (float), len, psf) ;
  580|       |
  581|    409|	bufferlen = ARRAY_LEN (ubuf.fbuf) ;
  ------------------
  |  |   93|    409|#define		ARRAY_LEN(x)	((int) (sizeof (x) / sizeof ((x) [0])))
  ------------------
  582|       |
  583|    786|	while (len > 0)
  ------------------
  |  Branch (583:9): [True: 409, False: 377]
  ------------------
  584|    409|	{	if (len < bufferlen)
  ------------------
  |  Branch (584:8): [True: 409, False: 0]
  ------------------
  585|    409|			bufferlen = (int) len ;
  586|    409|		readcount = (int) psf_fread (ubuf.fbuf, sizeof (float), bufferlen, psf) ;
  587|       |
  588|    409|		endswap_int_copy ((int*) (ptr + total), ubuf.ibuf, readcount) ;
  589|       |
  590|    409|		total += readcount ;
  591|    409|		if (readcount < bufferlen)
  ------------------
  |  Branch (591:7): [True: 32, False: 377]
  ------------------
  592|     32|			break ;
  593|    377|		len -= readcount ;
  594|    377|		} ;
  595|       |
  596|    409|	return total ;
  597|    673|} /* host_read_f */

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

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

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

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

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

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

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

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

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

wavlike_msadpcm_init:
  119|    199|{	MSADPCM_PRIVATE	*pms ;
  120|    199|	unsigned int	pmssize ;
  121|    199|	int				count ;
  122|       |
  123|    199|	if (psf->codec_data != NULL)
  ------------------
  |  Branch (123:6): [True: 0, False: 199]
  ------------------
  124|      0|	{	psf_log_printf (psf, "*** psf->codec_data is not NULL.\n") ;
  125|      0|		return SFE_INTERNAL ;
  126|    199|		} ;
  127|       |
  128|    199|	if (psf->file.mode == SFM_WRITE)
  ------------------
  |  Branch (128:6): [True: 0, False: 199]
  ------------------
  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|    199|	if (samplesperblock < 7 * psf->sf.channels)
  ------------------
  |  Branch (132:6): [True: 3, False: 196]
  ------------------
  133|      3|	{	psf_log_printf (psf, "*** Error samplesperblock (%d) should be >= %d.\n", samplesperblock, 7 * psf->sf.channels) ;
  134|      3|		return SFE_INTERNAL ;
  135|    196|		} ;
  136|       |
  137|    196|	if (2 * blockalign < samplesperblock * psf->sf.channels)
  ------------------
  |  Branch (137:6): [True: 9, False: 187]
  ------------------
  138|      9|	{	psf_log_printf (psf, "*** Error blockalign (%d) should be >= %d.\n", blockalign, samplesperblock * psf->sf.channels / 2) ;
  139|      9|		return SFE_INTERNAL ;
  140|    187|		} ;
  141|       |
  142|    187|	pmssize = sizeof (MSADPCM_PRIVATE) + blockalign + 3 * psf->sf.channels * samplesperblock ;
  143|       |
  144|    187|	if (! (psf->codec_data = calloc (1, pmssize)))
  ------------------
  |  Branch (144:6): [True: 0, False: 187]
  ------------------
  145|      0|		return SFE_MALLOC_FAILED ;
  146|    187|	pms = (MSADPCM_PRIVATE*) psf->codec_data ;
  147|       |
  148|    187|	pms->sync_error = 0 ;
  149|    187|	pms->samples	= pms->dummydata ;
  150|    187|	pms->block		= (unsigned char*) (pms->dummydata + psf->sf.channels * samplesperblock) ;
  151|       |
  152|    187|	pms->channels	= psf->sf.channels ;
  153|    187|	pms->blocksize	= blockalign ;
  154|    187|	pms->samplesperblock = samplesperblock ;
  155|       |
  156|    187|	if (pms->blocksize <= 0)
  ------------------
  |  Branch (156:6): [True: 0, False: 187]
  ------------------
  157|      0|	{	psf_log_printf (psf, "*** Error : pms->blocksize should be > 0.\n") ;
  158|      0|		return SFE_INTERNAL ;
  159|    187|		} ;
  160|       |
  161|    187|	if (psf->file.mode == SFM_READ)
  ------------------
  |  Branch (161:6): [True: 187, False: 0]
  ------------------
  162|    187|	{	pms->dataremaining = psf->datalength ;
  163|       |
  164|    187|		if (psf->datalength % pms->blocksize)
  ------------------
  |  Branch (164:7): [True: 121, False: 66]
  ------------------
  165|    121|			pms->blocks = psf->datalength / pms->blocksize + 1 ;
  166|     66|		else
  167|     66|			pms->blocks = psf->datalength / pms->blocksize ;
  168|       |
  169|    187|		count = 2 * (pms->blocksize - 6 * pms->channels) / pms->channels ;
  170|    187|		if (pms->samplesperblock != count)
  ------------------
  |  Branch (170:7): [True: 54, False: 133]
  ------------------
  171|     54|		{	psf_log_printf (psf, "*** Error : samplesperblock should be %d.\n", count) ;
  172|     54|			return SFE_INTERNAL ;
  173|    133|			} ;
  174|       |
  175|    133|		psf->sf.frames = (psf->datalength / pms->blocksize) * pms->samplesperblock ;
  176|       |
  177|    133|		msadpcm_decode_block (psf, pms) ;
  178|       |
  179|    133|		psf->read_short		= msadpcm_read_s ;
  180|    133|		psf->read_int		= msadpcm_read_i ;
  181|    133|		psf->read_float		= msadpcm_read_f ;
  182|    133|		psf->read_double	= msadpcm_read_d ;
  183|    133|		} ;
  184|       |
  185|    133|	if (psf->file.mode == SFM_WRITE)
  ------------------
  |  Branch (185:6): [True: 0, False: 133]
  ------------------
  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|    133|	psf->codec_close = msadpcm_close ;
  197|    133|	psf->seek = msadpcm_seek ;
  198|       |
  199|    133|	return 0 ;
  200|    187|} /* wavlike_msadpcm_init */
ms_adpcm.c:msadpcm_decode_block:
  218|  2.24k|{	int		chan, k, blockindx, sampleindx ;
  219|  2.24k|	short	bytecode, bpred [2], chan_idelta [2] ;
  220|       |
  221|  2.24k|	int predict ;
  222|  2.24k|	int current ;
  223|  2.24k|	int idelta ;
  224|       |
  225|  2.24k|	pms->blockcount ++ ;
  226|  2.24k|	pms->samplecount = 0 ;
  227|       |
  228|  2.24k|	if (pms->blockcount > pms->blocks)
  ------------------
  |  Branch (228:6): [True: 4, False: 2.23k]
  ------------------
  229|      4|	{	memset (pms->samples, 0, pms->samplesperblock * pms->channels) ;
  230|      4|		return 1 ;
  231|  2.23k|		} ;
  232|       |
  233|  2.23k|	if ((k = (int) psf_fread (pms->block, 1, pms->blocksize, psf)) != pms->blocksize)
  ------------------
  |  Branch (233:6): [True: 81, False: 2.15k]
  ------------------
  234|     81|	{	psf_log_printf (psf, "*** Warning : short read (%d != %d).\n", k, pms->blocksize) ;
  235|     81|		if (k <= 0)
  ------------------
  |  Branch (235:7): [True: 2, False: 79]
  ------------------
  236|      2|			return 1 ;
  237|  2.23k|		} ;
  238|       |
  239|       |	/* Read and check the block header. */
  240|       |
  241|  2.23k|	if (pms->channels == 1)
  ------------------
  |  Branch (241:6): [True: 1.54k, False: 691]
  ------------------
  242|  1.54k|	{	bpred [0] = msadpcm_get_bpred (psf, pms, pms->block [0]) ;
  243|       |
  244|  1.54k|		chan_idelta [0] = pms->block [1] | (pms->block [2] << 8) ;
  245|  1.54k|		chan_idelta [1] = 0 ;
  246|       |
  247|  1.54k|		pms->samples [1] = pms->block [3] | (pms->block [4] << 8) ;
  248|  1.54k|		pms->samples [0] = pms->block [5] | (pms->block [6] << 8) ;
  249|  1.54k|		blockindx = 7 ;
  250|  1.54k|		}
  251|    691|	else
  252|    691|	{	bpred [0] = msadpcm_get_bpred (psf, pms, pms->block [0]) ;
  253|    691|		bpred [1] = msadpcm_get_bpred (psf, pms, pms->block [1]) ;
  254|       |
  255|    691|		chan_idelta [0] = pms->block [2] | (pms->block [3] << 8) ;
  256|    691|		chan_idelta [1] = pms->block [4] | (pms->block [5] << 8) ;
  257|       |
  258|    691|		pms->samples [2] = pms->block [6] | (pms->block [7] << 8) ;
  259|    691|		pms->samples [3] = pms->block [8] | (pms->block [9] << 8) ;
  260|       |
  261|    691|		pms->samples [0] = pms->block [10] | (pms->block [11] << 8) ;
  262|    691|		pms->samples [1] = pms->block [12] | (pms->block [13] << 8) ;
  263|       |
  264|    691|		blockindx = 14 ;
  265|    691|		} ;
  266|       |
  267|       |	/*--------------------------------------------------------
  268|       |	This was left over from a time when calculations were done
  269|       |	as ints rather than shorts. Keep this around as a reminder
  270|       |	in case I ever find a file which decodes incorrectly.
  271|       |
  272|       |    if (chan_idelta [0] & 0x8000)
  273|       |		chan_idelta [0] -= 0x10000 ;
  274|       |    if (chan_idelta [1] & 0x8000)
  275|       |		chan_idelta [1] -= 0x10000 ;
  276|       |	--------------------------------------------------------*/
  277|       |
  278|       |	/* Pull apart the packed 4 bit samples and store them in their
  279|       |	** correct sample positions.
  280|       |	*/
  281|       |
  282|  2.23k|	sampleindx = 2 * pms->channels ;
  283|  27.4k|	while (blockindx < pms->blocksize)
  ------------------
  |  Branch (283:9): [True: 25.2k, False: 2.23k]
  ------------------
  284|  25.2k|	{	bytecode = pms->block [blockindx++] ;
  285|  25.2k|		pms->samples [sampleindx++] = (bytecode >> 4) & 0x0F ;
  286|  25.2k|		pms->samples [sampleindx++] = bytecode & 0x0F ;
  287|  25.2k|		} ;
  288|       |
  289|       |	/* Decode the encoded 4 bit samples. */
  290|       |
  291|  52.7k|	for (k = 2 * pms->channels ; k < (pms->samplesperblock * pms->channels) ; k ++)
  ------------------
  |  Branch (291:31): [True: 50.5k, False: 2.23k]
  ------------------
  292|  50.5k|	{	chan = (pms->channels > 1) ? (k % 2) : 0 ;
  ------------------
  |  Branch (292:11): [True: 30.0k, False: 20.4k]
  ------------------
  293|       |
  294|  50.5k|		bytecode = pms->samples [k] & 0xF ;
  295|       |
  296|       |		/* Compute next Adaptive Scale Factor (ASF) */
  297|  50.5k|		idelta = chan_idelta [chan] ;
  298|  50.5k|		chan_idelta [chan] = (AdaptationTable [bytecode] * idelta) >> 8 ;	/* => / 256 => FIXED_POINT_ADAPTATION_BASE == 256 */
  299|  50.5k|		if (chan_idelta [chan] < 16)
  ------------------
  |  Branch (299:7): [True: 22.2k, False: 28.2k]
  ------------------
  300|  22.2k|			chan_idelta [chan] = 16 ;
  301|  50.5k|		if (bytecode & 0x8)
  ------------------
  |  Branch (301:7): [True: 10.5k, False: 40.0k]
  ------------------
  302|  10.5k|			bytecode -= 0x10 ;
  303|       |
  304|  50.5k|		predict = ((pms->samples [k - pms->channels] * AdaptCoeff1 [bpred [chan]])
  305|  50.5k|					+ (pms->samples [k - 2 * pms->channels] * AdaptCoeff2 [bpred [chan]])) >> 8 ; /* => / 256 => FIXED_POINT_COEFF_BASE == 256 */
  306|  50.5k|		current = (bytecode * idelta) + predict ;
  307|       |
  308|  50.5k|		if (current > 32767)
  ------------------
  |  Branch (308:7): [True: 7.69k, False: 42.8k]
  ------------------
  309|  7.69k|			current = 32767 ;
  310|  42.8k|		else if (current < -32768)
  ------------------
  |  Branch (310:12): [True: 2.08k, False: 40.7k]
  ------------------
  311|  2.08k|			current = -32768 ;
  312|       |
  313|  50.5k|		pms->samples [k] = current ;
  314|  50.5k|		} ;
  315|       |
  316|  2.23k|	return 0 ;
  317|  2.23k|} /* msadpcm_decode_block */
ms_adpcm.c:msadpcm_get_bpred:
  205|  2.92k|{	if (value >= WAVLIKE_MSADPCM_ADAPT_COEFF_COUNT)
  ------------------
  |  |  343|  2.92k|#define	WAVLIKE_MSADPCM_ADAPT_COEFF_COUNT	7
  ------------------
  |  Branch (205:7): [True: 1.63k, False: 1.29k]
  ------------------
  206|  1.63k|	{	if (pms->sync_error == 0)
  ------------------
  |  Branch (206:8): [True: 109, False: 1.52k]
  ------------------
  207|    109|		{	pms->sync_error = 1 ;
  208|    109|			psf_log_printf (psf, "MS ADPCM synchronisation error (%u should be < %u).\n", value, WAVLIKE_MSADPCM_ADAPT_COEFF_COUNT) ;
  ------------------
  |  |  343|    109|#define	WAVLIKE_MSADPCM_ADAPT_COEFF_COUNT	7
  ------------------
  209|    109|			} ;
  210|  1.63k|		return 0 ;
  211|  1.63k|		} ;
  212|  1.29k|	return value ;
  213|  2.92k|} /* msadpcm_get_bpred */
ms_adpcm.c:msadpcm_read_block:
  321|  29.7k|{	int	count, total = 0, indx = 0 ;
  322|       |
  323|  59.5k|	while (indx < len)
  ------------------
  |  Branch (323:9): [True: 29.7k, False: 29.7k]
  ------------------
  324|  29.7k|	{	if (pms->blockcount >= pms->blocks && pms->samplecount >= pms->samplesperblock)
  ------------------
  |  Branch (324:8): [True: 1.02k, False: 28.7k]
  |  Branch (324:42): [True: 0, False: 1.02k]
  ------------------
  325|      0|		{	memset (&(ptr [indx]), 0, (size_t) ((len - indx) * sizeof (short))) ;
  326|      0|			return total ;
  327|  29.7k|			} ;
  328|       |
  329|  29.7k|		if (pms->samplecount >= pms->samplesperblock)
  ------------------
  |  Branch (329:7): [True: 2.10k, False: 27.6k]
  ------------------
  330|  2.10k|			if (msadpcm_decode_block (psf, pms) != 0)
  ------------------
  |  Branch (330:8): [True: 0, False: 2.10k]
  ------------------
  331|      0|				return total ;
  332|       |
  333|  29.7k|		count = (pms->samplesperblock - pms->samplecount) * pms->channels ;
  334|  29.7k|		count = (len - indx > count) ? count : len - indx ;
  ------------------
  |  Branch (334:11): [True: 0, False: 29.7k]
  ------------------
  335|       |
  336|  29.7k|		memcpy (&(ptr [indx]), &(pms->samples [pms->samplecount * pms->channels]), count * sizeof (short)) ;
  337|  29.7k|		indx += count ;
  338|  29.7k|		pms->samplecount += count / pms->channels ;
  339|  29.7k|		total = indx ;
  340|  29.7k|		} ;
  341|       |
  342|  29.7k|	return total ;
  343|  29.7k|} /* msadpcm_read_block */
ms_adpcm.c:msadpcm_read_f:
  402|  29.7k|{	MSADPCM_PRIVATE *pms ;
  403|  29.7k|	BUF_UNION	ubuf ;
  404|  29.7k|	short		*sptr ;
  405|  29.7k|	int			k, bufferlen, readcount = 0, count ;
  406|  29.7k|	sf_count_t	total = 0 ;
  407|  29.7k|	float		normfact ;
  408|       |
  409|  29.7k|	if (! psf->codec_data)
  ------------------
  |  Branch (409:6): [True: 0, False: 29.7k]
  ------------------
  410|      0|		return 0 ;
  411|  29.7k|	pms = (MSADPCM_PRIVATE*) psf->codec_data ;
  412|       |
  413|  29.7k|	normfact = (psf->norm_float == SF_TRUE) ? 1.0 / ((float) 0x8000) : 1.0 ;
  ------------------
  |  Branch (413:13): [True: 29.7k, False: 0]
  ------------------
  414|  29.7k|	sptr = ubuf.sbuf ;
  415|  29.7k|	bufferlen = ARRAY_LEN (ubuf.sbuf) ;
  ------------------
  |  |   93|  29.7k|#define		ARRAY_LEN(x)	((int) (sizeof (x) / sizeof ((x) [0])))
  ------------------
  416|  59.5k|	while (len > 0)
  ------------------
  |  Branch (416:9): [True: 29.7k, False: 29.7k]
  ------------------
  417|  29.7k|	{	readcount = (len >= bufferlen) ? bufferlen : (int) len ;
  ------------------
  |  Branch (417:16): [True: 0, False: 29.7k]
  ------------------
  418|       |
  419|  29.7k|		if ((count = (int) msadpcm_read_block (psf, pms, sptr, readcount)) <= 0)
  ------------------
  |  Branch (419:7): [True: 0, False: 29.7k]
  ------------------
  420|      0|			return -1 ;
  421|       |
  422|  73.5k|		for (k = 0 ; k < readcount ; k++)
  ------------------
  |  Branch (422:16): [True: 43.7k, False: 29.7k]
  ------------------
  423|  43.7k|			ptr [total + k] = normfact * (float) (sptr [k]) ;
  424|  29.7k|		total += count ;
  425|  29.7k|		len -= readcount ;
  426|  29.7k|		if (count != readcount)
  ------------------
  |  Branch (426:7): [True: 0, False: 29.7k]
  ------------------
  427|      0|			break ;
  428|  29.7k|		} ;
  429|  29.7k|	return total ;
  430|  29.7k|} /* msadpcm_read_f */
ms_adpcm.c:msadpcm_close:
  785|    133|{	MSADPCM_PRIVATE *pms ;
  786|       |
  787|    133|	pms = (MSADPCM_PRIVATE*) psf->codec_data ;
  788|       |
  789|    133|	if (psf->file.mode == SFM_WRITE)
  ------------------
  |  Branch (789:6): [True: 0, False: 133]
  ------------------
  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|    133|	return 0 ;
  799|    133|} /* msadpcm_close */

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

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

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

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

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

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

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

psf_store_string:
   32|  21.8k|{	char	new_str [128] ;
   33|  21.8k|	size_t	str_len ;
   34|  21.8k|	int		k, str_flags ;
   35|       |
   36|  21.8k|	if (str == NULL)
  ------------------
  |  Branch (36:6): [True: 0, False: 21.8k]
  ------------------
   37|      0|		return SFE_STR_BAD_STRING ;
   38|       |
   39|  21.8k|	str_len = strlen (str) ;
   40|       |
   41|       |	/* A few extra checks for write mode. */
   42|  21.8k|	if (psf->file.mode == SFM_WRITE || psf->file.mode == SFM_RDWR)
  ------------------
  |  Branch (42:6): [True: 0, False: 21.8k]
  |  Branch (42:37): [True: 0, False: 21.8k]
  ------------------
   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|  21.8k|		} ;
   51|       |
   52|       |	/* Find the next free slot in table. */
   53|   646k|	for (k = 0 ; k < SF_MAX_STRINGS ; k++)
  ------------------
  |  |   80|   646k|#define SF_MAX_STRINGS			(32)
  ------------------
  |  Branch (53:15): [True: 628k, False: 18.1k]
  ------------------
   54|   628k|	{	/* If we find a matching entry clear it. */
   55|   628k|		if (psf->strings.data [k].type == str_type)
  ------------------
  |  Branch (55:7): [True: 3.20k, False: 625k]
  ------------------
   56|  3.20k|			psf->strings.data [k].type = -1 ;
   57|       |
   58|   628k|		if (psf->strings.data [k].type == 0)
  ------------------
  |  Branch (58:7): [True: 3.67k, False: 624k]
  ------------------
   59|  3.67k|			break ;
   60|   628k|		} ;
   61|       |
   62|       |	/* Determine flags */
   63|  21.8k|	str_flags = SF_STR_LOCATE_START ;
   64|  21.8k|	if (psf->file.mode == SFM_RDWR || psf->have_written)
  ------------------
  |  Branch (64:6): [True: 0, False: 21.8k]
  |  Branch (64:36): [True: 0, False: 21.8k]
  ------------------
   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|  21.8k|		} ;
   69|       |
   70|       |	/* More sanity checking. */
   71|  21.8k|	if (k >= SF_MAX_STRINGS)
  ------------------
  |  |   80|  21.8k|#define SF_MAX_STRINGS			(32)
  ------------------
  |  Branch (71:6): [True: 18.1k, False: 3.67k]
  ------------------
   72|  18.1k|		return SFE_STR_MAX_COUNT ;
   73|       |
   74|  3.67k|	if (k == 0 && psf->strings.storage_used != 0)
  ------------------
  |  Branch (74:6): [True: 431, False: 3.24k]
  |  Branch (74:16): [True: 0, False: 431]
  ------------------
   75|      0|	{	psf_log_printf (psf, "SFE_STR_WEIRD : k == 0 && psf->strings.storage_used != 0\n") ;
   76|      0|		return SFE_STR_WEIRD ;
   77|  3.67k|		} ;
   78|       |
   79|  3.67k|	if (k != 0 && psf->strings.storage_used == 0)
  ------------------
  |  Branch (79:6): [True: 3.24k, False: 431]
  |  Branch (79:16): [True: 0, False: 3.24k]
  ------------------
   80|      0|	{	psf_log_printf (psf, "SFE_STR_WEIRD : k != 0 && psf->strings.storage_used == 0\n") ;
   81|      0|		return SFE_STR_WEIRD ;
   82|  3.67k|		} ;
   83|       |
   84|       |	/* Special case for the first string. */
   85|  3.67k|	if (k == 0)
  ------------------
  |  Branch (85:6): [True: 431, False: 3.24k]
  ------------------
   86|    431|		psf->strings.storage_used = 0 ;
   87|       |
   88|  3.67k|	switch (str_type)
   89|  3.67k|	{	case SF_STR_SOFTWARE :
  ------------------
  |  Branch (89:4): [True: 678, False: 2.99k]
  ------------------
   90|       |				/* In write mode, want to append libsndfile-version to string. */
   91|    678|				if (psf->file.mode == SFM_WRITE || psf->file.mode == SFM_RDWR)
  ------------------
  |  Branch (91:9): [True: 0, False: 678]
  |  Branch (91:40): [True: 0, False: 678]
  ------------------
   92|      0|				{	if (strstr (str, PACKAGE_NAME) == NULL)
  ------------------
  |  |  200|      0|#define PACKAGE_NAME "libsndfile"
  ------------------
  |  Branch (92:11): [True: 0, False: 0]
  ------------------
   93|      0|					{	/*
   94|       |						** If the supplied string does not already contain a
   95|       |						** libsndfile-X.Y.Z component, then add it.
   96|       |						*/
   97|      0|						if (strlen (str) == 0)
  ------------------
  |  Branch (97:11): [True: 0, False: 0]
  ------------------
   98|      0|							snprintf (new_str, sizeof (new_str), "%s-%s", PACKAGE_NAME, PACKAGE_VERSION) ;
  ------------------
  |  |  200|      0|#define PACKAGE_NAME "libsndfile"
  ------------------
              							snprintf (new_str, sizeof (new_str), "%s-%s", PACKAGE_NAME, PACKAGE_VERSION) ;
  ------------------
  |  |  212|      0|#define PACKAGE_VERSION "1.2.2"
  ------------------
   99|      0|						else
  100|      0|							snprintf (new_str, sizeof (new_str), "%s (%s-%s)", str, PACKAGE_NAME, PACKAGE_VERSION) ;
  ------------------
  |  |  200|      0|#define PACKAGE_NAME "libsndfile"
  ------------------
              							snprintf (new_str, sizeof (new_str), "%s (%s-%s)", str, PACKAGE_NAME, PACKAGE_VERSION) ;
  ------------------
  |  |  212|      0|#define PACKAGE_VERSION "1.2.2"
  ------------------
  101|      0|						}
  102|      0|					else
  103|      0|						snprintf (new_str, sizeof (new_str), "%s", str) ;
  104|       |
  105|      0|					str = new_str ;
  106|      0|					} ;
  107|    678|				break ;
  108|       |
  109|    490|		case SF_STR_TITLE :
  ------------------
  |  Branch (109:3): [True: 490, False: 3.18k]
  ------------------
  110|    914|		case SF_STR_COPYRIGHT :
  ------------------
  |  Branch (110:3): [True: 424, False: 3.24k]
  ------------------
  111|  1.29k|		case SF_STR_ARTIST :
  ------------------
  |  Branch (111:3): [True: 378, False: 3.29k]
  ------------------
  112|  1.83k|		case SF_STR_COMMENT :
  ------------------
  |  Branch (112:3): [True: 541, False: 3.13k]
  ------------------
  113|  2.21k|		case SF_STR_DATE :
  ------------------
  |  Branch (113:3): [True: 386, False: 3.28k]
  ------------------
  114|  2.47k|		case SF_STR_ALBUM :
  ------------------
  |  Branch (114:3): [True: 251, False: 3.42k]
  ------------------
  115|  2.59k|		case SF_STR_LICENSE :
  ------------------
  |  Branch (115:3): [True: 121, False: 3.55k]
  ------------------
  116|  2.86k|		case SF_STR_TRACKNUMBER :
  ------------------
  |  Branch (116:3): [True: 275, False: 3.39k]
  ------------------
  117|  2.99k|		case SF_STR_GENRE :
  ------------------
  |  Branch (117:3): [True: 128, False: 3.54k]
  ------------------
  118|  2.99k|				break ;
  119|       |
  120|      0|		default :
  ------------------
  |  Branch (120:3): [True: 0, False: 3.67k]
  ------------------
  121|      0|			psf_log_printf (psf, "%s : SFE_STR_BAD_TYPE\n", __func__) ;
  122|      0|			return SFE_STR_BAD_TYPE ;
  123|  3.67k|		} ;
  124|       |
  125|       |	/* Plus one to catch string terminator. */
  126|  3.67k|	str_len = strlen (str) + 1 ;
  127|       |
  128|  3.67k|	if (psf->strings.storage_used + str_len + 1 > psf->strings.storage_len)
  ------------------
  |  Branch (128:6): [True: 462, False: 3.21k]
  ------------------
  129|    462|	{	char * temp = psf->strings.storage ;
  130|    462|		size_t newlen = 2 * psf->strings.storage_len + str_len + 1 ;
  131|       |
  132|    462|		newlen = newlen < 256 ? 256 : newlen ;
  ------------------
  |  Branch (132:12): [True: 417, False: 45]
  ------------------
  133|       |
  134|    462|		char * new_storage = realloc(temp, newlen);
  135|    462|		if (new_storage == NULL)
  ------------------
  |  Branch (135:7): [True: 0, False: 462]
  ------------------
  136|      0|		{
  137|      0|			return SFE_MALLOC_FAILED ;
  138|    462|			} else {
  139|    462|			psf->strings.storage = new_storage;
  140|    462|			} ;
  141|       |
  142|    462|		psf->strings.storage_len = newlen ;
  143|  3.67k|		} ;
  144|       |
  145|  3.67k|	psf->strings.data [k].type = str_type ;
  146|  3.67k|	psf->strings.data [k].offset = psf->strings.storage_used ;
  147|  3.67k|	psf->strings.data [k].flags = str_flags ;
  148|       |
  149|  3.67k|	memcpy (psf->strings.storage + psf->strings.storage_used, str, str_len) ;
  150|  3.67k|	psf->strings.storage_used += str_len ;
  151|       |
  152|  3.67k|	psf->strings.flags |= str_flags ;
  153|       |
  154|       |#if STRINGS_DEBUG
  155|       |	printf ("storage_used         : %zd / %zd\n", psf->strings.storage_used, psf->strings.storage_len) ;
  156|       |	psf_hexdump (psf->strings.storage, psf->strings.storage_used) ;
  157|       |#endif
  158|       |
  159|  3.67k|	return 0 ;
  160|  3.67k|} /* psf_store_string */

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

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

ulaw_init:
   39|    254|{
   40|    254|	if (psf->file.mode == SFM_READ || psf->file.mode == SFM_RDWR)
  ------------------
  |  Branch (40:6): [True: 254, False: 0]
  |  Branch (40:36): [True: 0, False: 0]
  ------------------
   41|    254|	{	psf->read_short		= ulaw_read_ulaw2s ;
   42|    254|		psf->read_int		= ulaw_read_ulaw2i ;
   43|    254|		psf->read_float		= ulaw_read_ulaw2f ;
   44|    254|		psf->read_double	= ulaw_read_ulaw2d ;
   45|    254|		} ;
   46|       |
   47|    254|	if (psf->file.mode == SFM_WRITE || psf->file.mode == SFM_RDWR)
  ------------------
  |  Branch (47:6): [True: 0, False: 254]
  |  Branch (47:37): [True: 0, False: 254]
  ------------------
   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|    254|	psf->bytewidth = 1 ;
   55|    254|	psf->blockwidth = psf->sf.channels ;
   56|       |
   57|    254|	if (psf->filelength > psf->dataoffset)
  ------------------
  |  Branch (57:6): [True: 186, False: 68]
  ------------------
   58|    186|		psf->datalength = (psf->dataend) ? psf->dataend - psf->dataoffset :
  ------------------
  |  Branch (58:21): [True: 92, False: 94]
  ------------------
   59|    186|							psf->filelength - psf->dataoffset ;
   60|     68|	else
   61|     68|		psf->datalength = 0 ;
   62|       |
   63|    254|	psf->sf.frames = psf->blockwidth > 0 ? psf->datalength / psf->blockwidth : 0 ;
  ------------------
  |  Branch (63:19): [True: 213, False: 41]
  ------------------
   64|       |
   65|    254|	return 0 ;
   66|    254|} /* ulaw_init */
ulaw.c:ulaw_read_ulaw2f:
  911|    613|{	BUF_UNION	ubuf ;
  912|    613|	int			bufferlen, readcount ;
  913|    613|	sf_count_t	total = 0 ;
  914|    613|	float	normfact ;
  915|       |
  916|    613|	normfact = (psf->norm_float == SF_TRUE) ? 1.0 / ((float) 0x8000) : 1.0 ;
  ------------------
  |  Branch (916:13): [True: 613, False: 0]
  ------------------
  917|       |
  918|    613|	bufferlen = ARRAY_LEN (ubuf.ucbuf) ;
  ------------------
  |  |   93|    613|#define		ARRAY_LEN(x)	((int) (sizeof (x) / sizeof ((x) [0])))
  ------------------
  919|       |
  920|  1.19k|	while (len > 0)
  ------------------
  |  Branch (920:9): [True: 613, False: 583]
  ------------------
  921|    613|	{	if (len < bufferlen)
  ------------------
  |  Branch (921:8): [True: 613, False: 0]
  ------------------
  922|    613|			bufferlen = (int) len ;
  923|    613|		readcount = (int) psf_fread (ubuf.ucbuf, 1, bufferlen, psf) ;
  924|    613|		ulaw2f_array (ubuf.ucbuf, readcount, ptr + total, normfact) ;
  925|    613|		total += readcount ;
  926|    613|		if (readcount < bufferlen)
  ------------------
  |  Branch (926:7): [True: 30, False: 583]
  ------------------
  927|     30|			break ;
  928|    583|		len -= readcount ;
  929|    583|		} ;
  930|       |
  931|    613|	return total ;
  932|    613|} /* ulaw_read_ulaw2f */
ulaw.c:ulaw2f_array:
  808|  7.55k|{	for (int i = 0 ; i < count ; i++)
  ------------------
  |  Branch (808:20): [True: 6.94k, False: 613]
  ------------------
  809|  6.94k|		ptr [i] = normfact * ulaw_decode [(int) buffer [i]] ;
  810|    613|} /* ulaw2f_array */

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

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

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

wavlike_read_fmt_chunk:
  125|   126k|{	WAVLIKE_PRIVATE * wpriv ;
  126|   126k|	WAV_FMT *wav_fmt ;
  127|   126k|	int	bytesread, k, bytespersec = 0 ;
  128|       |
  129|   126k|	if ((wpriv = psf->container_data) == NULL)
  ------------------
  |  Branch (129:6): [True: 0, False: 126k]
  ------------------
  130|      0|		return SFE_INTERNAL ;
  131|   126k|	wav_fmt = &wpriv->wav_fmt ;
  132|       |
  133|   126k|	memset (wav_fmt, 0, sizeof (WAV_FMT)) ;
  134|       |
  135|   126k|	if (fmtsize < 16)
  ------------------
  |  Branch (135:6): [True: 54, False: 126k]
  ------------------
  136|     54|		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|   126k|	bytesread = psf_binheader_readf (psf, "224422",
  142|   126k|					&(wav_fmt->format), &(wav_fmt->min.channels),
  143|   126k|					&(wav_fmt->min.samplerate), &(wav_fmt->min.bytespersec),
  144|   126k|					&(wav_fmt->min.blockalign), &(wav_fmt->min.bitwidth)) ;
  145|       |
  146|   126k|	psf_log_printf (psf, "  Format        : 0x%X => %s\n", wav_fmt->format, wavlike_format_str (wav_fmt->format)) ;
  147|   126k|	psf_log_printf (psf, "  Channels      : %d\n", wav_fmt->min.channels) ;
  148|   126k|	psf_log_printf (psf, "  Sample Rate   : %d\n", wav_fmt->min.samplerate) ;
  149|       |
  150|   126k|	if (wav_fmt->format == WAVE_FORMAT_PCM && wav_fmt->min.blockalign == 0
  ------------------
  |  Branch (150:6): [True: 18.8k, False: 107k]
  |  Branch (150:44): [True: 10.4k, False: 8.37k]
  ------------------
  151|  10.4k|		&& wav_fmt->min.bitwidth > 0 && wav_fmt->min.channels > 0)
  ------------------
  |  Branch (151:6): [True: 6.80k, False: 3.66k]
  |  Branch (151:35): [True: 3.91k, False: 2.89k]
  ------------------
  152|  3.91k|	{	wav_fmt->min.blockalign = wav_fmt->min.bitwidth / 8 + (wav_fmt->min.bitwidth % 8 > 0 ? 1 : 0) ;
  ------------------
  |  Branch (152:59): [True: 2.25k, False: 1.65k]
  ------------------
  153|  3.91k|		wav_fmt->min.blockalign *= wav_fmt->min.channels ;
  154|  3.91k|		psf_log_printf (psf, "  Block Align   : 0 (should be %d)\n", wav_fmt->min.blockalign) ;
  155|  3.91k|		}
  156|   122k|	else
  157|   122k|		psf_log_printf (psf, "  Block Align   : %d\n", wav_fmt->min.blockalign) ;
  158|       |
  159|   126k|	if (wav_fmt->format == WAVE_FORMAT_PCM && wav_fmt->min.bitwidth == 24 &&
  ------------------
  |  Branch (159:6): [True: 18.8k, False: 107k]
  |  Branch (159:44): [True: 4.97k, False: 13.8k]
  ------------------
  160|  4.97k|			wav_fmt->min.blockalign == 4 * wav_fmt->min.channels)
  ------------------
  |  Branch (160:4): [True: 879, False: 4.10k]
  ------------------
  161|    879|	{	psf_log_printf (psf, "  Bit Width     : 24\n") ;
  162|       |
  163|    879|		psf_log_printf (psf, "\n"
  164|    879|			"  Ambiguous information in 'fmt ' chunk. Possible file types:\n"
  165|    879|			"    0) Invalid IEEE float file generated by Syntrillium's Cooledit!\n"
  166|    879|			"    1) File generated by ALSA's arecord containing 24 bit samples in 32 bit containers.\n"
  167|    879|			"    2) 24 bit file with incorrect Block Align value.\n"
  168|    879|			"\n") ;
  169|       |
  170|    879|		wpriv->fmt_is_broken = 1 ;
  171|    879|		}
  172|   125k|	else if (wav_fmt->min.bitwidth == 0)
  ------------------
  |  Branch (172:11): [True: 22.8k, False: 102k]
  ------------------
  173|  22.8k|	{	switch (wav_fmt->format)
  174|  22.8k|		{	case WAVE_FORMAT_GSM610 :
  ------------------
  |  Branch (174:5): [True: 2.84k, False: 19.9k]
  ------------------
  175|  2.84k|			case WAVE_FORMAT_IPP_ITU_G_723_1 :
  ------------------
  |  Branch (175:4): [True: 1, False: 22.8k]
  ------------------
  176|  6.24k|			case WAVE_FORMAT_MPEGLAYER3 :
  ------------------
  |  Branch (176:4): [True: 3.40k, False: 19.4k]
  ------------------
  177|  6.24k|					psf_log_printf (psf, "  Bit Width     : %d\n", wav_fmt->min.bitwidth) ;
  178|  6.24k|					break ;
  179|  16.5k|			default :
  ------------------
  |  Branch (179:4): [True: 16.5k, False: 6.24k]
  ------------------
  180|  16.5k|					psf_log_printf (psf, "  Bit Width     : %d (should not be 0)\n", wav_fmt->min.bitwidth) ;
  181|  22.8k|			}
  182|  22.8k|		}
  183|   102k|	else
  184|   102k|	{	switch (wav_fmt->format)
  185|   102k|		{	case WAVE_FORMAT_GSM610 :
  ------------------
  |  Branch (185:5): [True: 3.87k, False: 98.7k]
  ------------------
  186|  3.87k|			case WAVE_FORMAT_IPP_ITU_G_723_1 :
  ------------------
  |  Branch (186:4): [True: 1, False: 102k]
  ------------------
  187|  9.59k|			case WAVE_FORMAT_MPEGLAYER3 :
  ------------------
  |  Branch (187:4): [True: 5.71k, False: 96.9k]
  ------------------
  188|  9.59k|					psf_log_printf (psf, "  Bit Width     : %d (should be 0)\n", wav_fmt->min.bitwidth) ;
  189|  9.59k|					break ;
  190|  93.0k|			default :
  ------------------
  |  Branch (190:4): [True: 93.0k, False: 9.59k]
  ------------------
  191|  93.0k|					psf_log_printf (psf, "  Bit Width     : %d\n", wav_fmt->min.bitwidth) ;
  192|   102k|			}
  193|   126k|		} ;
  194|       |
  195|   126k|	psf->sf.samplerate	= wav_fmt->min.samplerate ;
  196|   126k|	psf->sf.frames 		= 0 ;					/* Correct this when reading data chunk. */
  197|   126k|	psf->sf.channels	= wav_fmt->min.channels ;
  198|       |
  199|   126k|	switch (wav_fmt->format)
  200|   126k|	{	case WAVE_FORMAT_PCM :
  ------------------
  |  Branch (200:4): [True: 18.8k, False: 107k]
  ------------------
  201|  24.3k|		case WAVE_FORMAT_IEEE_FLOAT :
  ------------------
  |  Branch (201:3): [True: 5.52k, False: 120k]
  ------------------
  202|  24.3k|				bytespersec = wav_fmt->min.samplerate * wav_fmt->min.blockalign ;
  203|  24.3k|				if (wav_fmt->min.bytespersec != (unsigned) bytespersec)
  ------------------
  |  Branch (203:9): [True: 20.7k, False: 3.60k]
  ------------------
  204|  20.7k|					psf_log_printf (psf, "  Bytes/sec     : %d (should be %d)\n", wav_fmt->min.bytespersec, bytespersec) ;
  205|  3.60k|				else
  206|  3.60k|					psf_log_printf (psf, "  Bytes/sec     : %d\n", wav_fmt->min.bytespersec) ;
  207|       |
  208|  24.3k|				psf->bytewidth = BITWIDTH2BYTES (wav_fmt->min.bitwidth) ;
  ------------------
  |  |   85|  24.3k|#define	BITWIDTH2BYTES(x)	(((x) + 7) / 8)
  ------------------
  209|  24.3k|				break ;
  210|       |
  211|  10.3k|		case WAVE_FORMAT_ALAW :
  ------------------
  |  Branch (211:3): [True: 10.3k, False: 115k]
  ------------------
  212|  16.5k|		case WAVE_FORMAT_MULAW :
  ------------------
  |  Branch (212:3): [True: 6.18k, False: 120k]
  ------------------
  213|  16.5k|				if (wav_fmt->min.bytespersec != wav_fmt->min.samplerate * wav_fmt->min.blockalign)
  ------------------
  |  Branch (213:9): [True: 13.7k, False: 2.86k]
  ------------------
  214|  13.7k|					psf_log_printf (psf, "  Bytes/sec     : %d (should be %d)\n", wav_fmt->min.bytespersec, wav_fmt->min.samplerate * wav_fmt->min.blockalign) ;
  215|  2.86k|				else
  216|  2.86k|					psf_log_printf (psf, "  Bytes/sec     : %d\n", wav_fmt->min.bytespersec) ;
  217|       |
  218|  16.5k|				psf->bytewidth = 1 ;
  219|  16.5k|				if (fmtsize >= 18)
  ------------------
  |  Branch (219:9): [True: 12.4k, False: 4.13k]
  ------------------
  220|  12.4k|				{	bytesread += psf_binheader_readf (psf, "2", &(wav_fmt->size20.extrabytes)) ;
  221|  12.4k|					psf_log_printf (psf, "  Extra Bytes   : %d\n", wav_fmt->size20.extrabytes) ;
  222|  12.4k|					} ;
  223|  16.5k|				break ;
  224|       |
  225|  6.49k|		case WAVE_FORMAT_IMA_ADPCM :
  ------------------
  |  Branch (225:3): [True: 6.49k, False: 119k]
  ------------------
  226|  6.49k|				if (wav_fmt->min.bitwidth != 4)
  ------------------
  |  Branch (226:9): [True: 17, False: 6.47k]
  ------------------
  227|     17|					return SFE_WAV_ADPCM_NOT4BIT ;
  228|  6.47k|				if (wav_fmt->min.channels < 1 || wav_fmt->min.channels > 2)
  ------------------
  |  Branch (228:9): [True: 1, False: 6.47k]
  |  Branch (228:38): [True: 5, False: 6.47k]
  ------------------
  229|      6|					return SFE_WAV_ADPCM_CHANNELS ;
  230|       |
  231|  6.47k|				bytesread += psf_binheader_readf (psf, "22", &(wav_fmt->ima.extrabytes), &(wav_fmt->ima.samplesperblock)) ;
  232|  6.47k|				psf_log_printf (psf, "  Extra Bytes   : %d\n", wav_fmt->ima.extrabytes) ;
  233|  6.47k|				if (wav_fmt->ima.samplesperblock < 1)
  ------------------
  |  Branch (233:9): [True: 2, False: 6.47k]
  ------------------
  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|  6.47k|				else
  238|  6.47k|					psf_log_printf (psf, "  Samples/Block : %d\n", wav_fmt->ima.samplesperblock) ;
  239|       |
  240|  6.47k|				bytespersec = (wav_fmt->ima.samplerate * wav_fmt->ima.blockalign) / wav_fmt->ima.samplesperblock ;
  241|  6.47k|				if (wav_fmt->ima.bytespersec != (unsigned) bytespersec)
  ------------------
  |  Branch (241:9): [True: 4.11k, False: 2.35k]
  ------------------
  242|  4.11k|					psf_log_printf (psf, "  Bytes/sec     : %d (should be %d)\n", wav_fmt->ima.bytespersec, bytespersec) ;
  243|  2.35k|				else
  244|  2.35k|					psf_log_printf (psf, "  Bytes/sec     : %d\n", wav_fmt->ima.bytespersec) ;
  245|       |
  246|  6.47k|				break ;
  247|       |
  248|  11.2k|		case WAVE_FORMAT_MS_ADPCM :
  ------------------
  |  Branch (248:3): [True: 11.2k, False: 115k]
  ------------------
  249|  11.2k|				if (wav_fmt->msadpcm.bitwidth != 4)
  ------------------
  |  Branch (249:9): [True: 22, False: 11.2k]
  ------------------
  250|     22|					return SFE_WAV_ADPCM_NOT4BIT ;
  251|  11.2k|				if (wav_fmt->msadpcm.channels < 1 || wav_fmt->msadpcm.channels > 2)
  ------------------
  |  Branch (251:9): [True: 1, False: 11.2k]
  |  Branch (251:42): [True: 3, False: 11.2k]
  ------------------
  252|      4|					return SFE_WAV_ADPCM_CHANNELS ;
  253|       |
  254|  11.2k|				bytesread += psf_binheader_readf (psf, "222", &(wav_fmt->msadpcm.extrabytes),
  255|  11.2k|								&(wav_fmt->msadpcm.samplesperblock), &(wav_fmt->msadpcm.numcoeffs)) ;
  256|       |
  257|  11.2k|				psf_log_printf (psf, "  Extra Bytes   : %d\n", wav_fmt->msadpcm.extrabytes) ;
  258|  11.2k|				if (wav_fmt->ima.samplesperblock < 1)
  ------------------
  |  Branch (258:9): [True: 1, False: 11.2k]
  ------------------
  259|      1|				{	psf_log_printf (psf, "  Samples/Block : %d (should be > 0)\n", wav_fmt->ima.samplesperblock) ;
  260|      1|					return SFE_WAV_ADPCM_SAMPLES ;
  261|      1|					}
  262|  11.2k|				else
  263|  11.2k|					psf_log_printf (psf, "  Samples/Block : %d\n", wav_fmt->ima.samplesperblock) ;
  264|       |
  265|  11.2k|				bytespersec = (wav_fmt->min.samplerate * wav_fmt->min.blockalign) / wav_fmt->msadpcm.samplesperblock ;
  266|  11.2k|				if (wav_fmt->min.bytespersec == (unsigned) bytespersec)
  ------------------
  |  Branch (266:9): [True: 3.49k, False: 7.73k]
  ------------------
  267|  3.49k|					psf_log_printf (psf, "  Bytes/sec     : %d\n", wav_fmt->min.bytespersec) ;
  268|  7.73k|				else if (wav_fmt->min.bytespersec == (wav_fmt->min.samplerate / wav_fmt->msadpcm.samplesperblock) * wav_fmt->min.blockalign)
  ------------------
  |  Branch (268:14): [True: 2.96k, False: 4.76k]
  ------------------
  269|  2.96k|					psf_log_printf (psf, "  Bytes/sec     : %d (should be %d (MS BUG!))\n", wav_fmt->min.bytespersec, bytespersec) ;
  270|  4.76k|				else
  271|  4.76k|					psf_log_printf (psf, "  Bytes/sec     : %d (should be %d)\n", wav_fmt->min.bytespersec, bytespersec) ;
  272|       |
  273|  11.2k|				if (wav_fmt->msadpcm.numcoeffs > ARRAY_LEN (wav_fmt->msadpcm.coeffs))
  ------------------
  |  |   93|  11.2k|#define		ARRAY_LEN(x)	((int) (sizeof (x) / sizeof ((x) [0])))
  ------------------
  |  Branch (273:9): [True: 4.30k, False: 6.92k]
  ------------------
  274|  4.30k|				{	psf_log_printf (psf, "  No. of Coeffs : %d (should be <= %d)\n", wav_fmt->msadpcm.numcoeffs, ARRAY_LEN (wav_fmt->msadpcm.coeffs)) ;
  ------------------
  |  |   93|  4.30k|#define		ARRAY_LEN(x)	((int) (sizeof (x) / sizeof ((x) [0])))
  ------------------
  275|  4.30k|					wav_fmt->msadpcm.numcoeffs = ARRAY_LEN (wav_fmt->msadpcm.coeffs) ;
  ------------------
  |  |   93|  4.30k|#define		ARRAY_LEN(x)	((int) (sizeof (x) / sizeof ((x) [0])))
  ------------------
  276|  4.30k|					}
  277|  6.92k|				else
  278|  6.92k|					psf_log_printf (psf, "  No. of Coeffs : %d\n", wav_fmt->msadpcm.numcoeffs) ;
  279|       |
  280|  11.2k|				psf_log_printf (psf, "    Index   Coeffs1   Coeffs2\n") ;
  281|  41.3k|				for (k = 0 ; k < wav_fmt->msadpcm.numcoeffs ; k++)
  ------------------
  |  Branch (281:18): [True: 30.1k, False: 11.2k]
  ------------------
  282|  30.1k|				{	char buffer [128] ;
  283|       |
  284|  30.1k|					bytesread +=
  285|  30.1k|						psf_binheader_readf (psf, "22", &(wav_fmt->msadpcm.coeffs [k].coeff1), &(wav_fmt->msadpcm.coeffs [k].coeff2)) ;
  286|  30.1k|					snprintf (buffer, sizeof (buffer), "     %2d     %7d   %7d\n", k, wav_fmt->msadpcm.coeffs [k].coeff1, wav_fmt->msadpcm.coeffs [k].coeff2) ;
  287|  30.1k|					psf_log_printf (psf, buffer) ;
  288|  30.1k|					} ;
  289|  11.2k|				break ;
  290|       |
  291|  6.72k|		case WAVE_FORMAT_GSM610 :
  ------------------
  |  Branch (291:3): [True: 6.72k, False: 119k]
  ------------------
  292|  6.72k|				if (wav_fmt->gsm610.channels != 1 || wav_fmt->gsm610.blockalign != 65)
  ------------------
  |  Branch (292:9): [True: 4, False: 6.72k]
  |  Branch (292:42): [True: 10, False: 6.71k]
  ------------------
  293|     14|					return SFE_WAV_GSM610_FORMAT ;
  294|       |
  295|  6.71k|				bytesread +=
  296|  6.71k|				psf_binheader_readf (psf, "22", &(wav_fmt->gsm610.extrabytes), &(wav_fmt->gsm610.samplesperblock)) ;
  297|       |
  298|  6.71k|				if (wav_fmt->gsm610.samplesperblock != 320)
  ------------------
  |  Branch (298:9): [True: 3, False: 6.70k]
  ------------------
  299|      3|					return SFE_WAV_GSM610_FORMAT ;
  300|       |
  301|  6.70k|				bytespersec = (wav_fmt->gsm610.samplerate * wav_fmt->gsm610.blockalign) / wav_fmt->gsm610.samplesperblock ;
  302|  6.70k|				if (wav_fmt->gsm610.bytespersec != (unsigned) bytespersec)
  ------------------
  |  Branch (302:9): [True: 4.56k, False: 2.14k]
  ------------------
  303|  4.56k|					psf_log_printf (psf, "  Bytes/sec     : %d (should be %d)\n", wav_fmt->gsm610.bytespersec, bytespersec) ;
  304|  2.14k|				else
  305|  2.14k|					psf_log_printf (psf, "  Bytes/sec     : %d\n", wav_fmt->gsm610.bytespersec) ;
  306|       |
  307|  6.70k|				psf_log_printf (psf, "  Extra Bytes   : %d\n", wav_fmt->gsm610.extrabytes) ;
  308|  6.70k|				psf_log_printf (psf, "  Samples/Block : %d\n", wav_fmt->gsm610.samplesperblock) ;
  309|  6.70k|				break ;
  310|       |
  311|  9.11k|		case WAVE_FORMAT_MPEGLAYER3 :
  ------------------
  |  Branch (311:3): [True: 9.11k, False: 117k]
  ------------------
  312|  9.11k|				bytesread += psf_binheader_readf (psf, "24222", &(wav_fmt->mpeg3.extrabytes),
  313|  9.11k|					&(wav_fmt->mpeg3.id), &(wav_fmt->mpeg3.flags), &(wav_fmt->mpeg3.blocksize),
  314|  9.11k|					&(wav_fmt->mpeg3.samplesperblock), &(wav_fmt->mpeg3.codecdelay)) ;
  315|       |
  316|  9.11k|				psf_log_printf (psf, "  Bytes/sec     : %d\n", wav_fmt->mpeg3.bytespersec) ;
  317|  9.11k|				psf_log_printf (psf, "  Extra Bytes   : %d\n", wav_fmt->mpeg3.extrabytes) ;
  318|  9.11k|				if (wav_fmt->mpeg3.id != 1)
  ------------------
  |  Branch (318:9): [True: 5.20k, False: 3.90k]
  ------------------
  319|  5.20k|					psf_log_printf (psf, "  ID            : %d (unknown, should be 1)\n", wav_fmt->mpeg3.id) ;
  320|  3.90k|				else
  321|  3.90k|					psf_log_printf (psf, "  ID            : MPEGLAYER3_ID_MPEG\n") ;
  322|  9.11k|				psf_log_printf (psf, "  Flags         : 0x%08x\n", wav_fmt->mpeg3.flags) ;
  323|  9.11k|				psf_log_printf (psf, "  Block Size    : %d\n", wav_fmt->mpeg3.blocksize) ;
  324|  9.11k|				psf_log_printf (psf, "  Samples/Block : %d\n", wav_fmt->mpeg3.samplesperblock) ;
  325|  9.11k|				psf_log_printf (psf, "  Codec Delay   : %d samples\n", wav_fmt->mpeg3.codecdelay) ;
  326|  9.11k|				break ;
  327|       |
  328|  27.7k|		case WAVE_FORMAT_EXTENSIBLE :
  ------------------
  |  Branch (328:3): [True: 27.7k, False: 98.6k]
  ------------------
  329|  27.7k|				if (wav_fmt->ext.bytespersec != wav_fmt->ext.samplerate * wav_fmt->ext.blockalign)
  ------------------
  |  Branch (329:9): [True: 22.7k, False: 4.98k]
  ------------------
  330|  22.7k|					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.98k|				else
  332|  4.98k|					psf_log_printf (psf, "  Bytes/sec     : %d\n", wav_fmt->ext.bytespersec) ;
  333|       |
  334|  27.7k|				bytesread +=
  335|  27.7k|				psf_binheader_readf (psf, "224", &(wav_fmt->ext.extrabytes), &(wav_fmt->ext.validbits),
  336|  27.7k|						&(wav_fmt->ext.channelmask)) ;
  337|       |
  338|  27.7k|				psf_log_printf (psf, "  Valid Bits    : %d\n", wav_fmt->ext.validbits) ;
  339|       |
  340|  27.7k|				if (wav_fmt->ext.channelmask == 0)
  ------------------
  |  Branch (340:9): [True: 4.09k, False: 23.6k]
  ------------------
  341|  4.09k|					psf_log_printf (psf, "  Channel Mask  : 0x0 (should not be zero)\n") ;
  342|  23.6k|				else
  343|  23.6k|				{	char buffer [512] ;
  344|  23.6k|					unsigned bit ;
  345|       |
  346|  23.6k|					wpriv->wavex_channelmask = wav_fmt->ext.channelmask ;
  347|       |
  348|       |					/* It's probably wise to ignore the channel mask if it is all zero */
  349|  23.6k|					free (psf->channel_map) ;
  350|       |
  351|  23.6k|					if ((psf->channel_map = calloc (psf->sf.channels, sizeof (psf->channel_map [0]))) == NULL)
  ------------------
  |  Branch (351:10): [True: 0, False: 23.6k]
  ------------------
  352|      0|						return SFE_MALLOC_FAILED ;
  353|       |
  354|       |					/* Terminate the buffer we're going to append_snprintf into. */
  355|  23.6k|					buffer [0] = 0 ;
  356|       |
  357|   346k|					for (bit = k = 0 ; bit < ARRAY_LEN (channel_mask_bits) && k < psf->sf.channels ; bit++)
  ------------------
  |  |   93|   692k|#define		ARRAY_LEN(x)	((int) (sizeof (x) / sizeof ((x) [0])))
  ------------------
  |  Branch (357:25): [True: 329k, False: 16.3k]
  |  Branch (357:64): [True: 322k, False: 7.26k]
  ------------------
  358|   322k|					{
  359|   322k|						if (wav_fmt->ext.channelmask & (1 << bit))
  ------------------
  |  Branch (359:11): [True: 118k, False: 204k]
  ------------------
  360|   118k|						{	if (k > psf->sf.channels)
  ------------------
  |  Branch (360:13): [True: 0, False: 118k]
  ------------------
  361|      0|							{	psf_log_printf (psf, "*** More channel map bits than there are channels.\n") ;
  362|      0|								break ;
  363|   118k|								} ;
  364|       |
  365|   118k|							psf->channel_map [k++] = channel_mask_bits [bit].id ;
  366|   118k|							append_snprintf (buffer, sizeof (buffer), "%s, ", channel_mask_bits [bit].name) ;
  367|   322k|							} ;
  368|   322k|						} ;
  369|       |
  370|       |					/* Remove trailing ", ". */
  371|  23.6k|					bit = strlen (buffer) ;
  372|  23.6k|					if (bit >= 2)
  ------------------
  |  Branch (372:10): [True: 18.2k, False: 5.36k]
  ------------------
  373|  18.2k|					{	buffer [--bit] = 0 ;
  374|  18.2k|						buffer [--bit] = 0 ;
  375|  18.2k|						} ;
  376|       |
  377|  23.6k|					if (k != psf->sf.channels)
  ------------------
  |  Branch (377:10): [True: 15.4k, False: 8.14k]
  ------------------
  378|  15.4k|					{	psf_log_printf (psf, "  Channel Mask  : 0x%X\n", wav_fmt->ext.channelmask) ;
  379|  15.4k|						psf_log_printf (psf, "*** Less channel map bits than there are channels.\n") ;
  380|  15.4k|						}
  381|  8.14k|					else
  382|  8.14k|						psf_log_printf (psf, "  Channel Mask  : 0x%X (%s)\n", wav_fmt->ext.channelmask, buffer) ;
  383|  27.7k|					} ;
  384|       |
  385|  27.7k|				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|  27.7k|				psf_log_printf (psf, "  Subformat\n") ;
  389|  27.7k|				psf_log_printf (psf, "    esf_field1 : 0x%X\n", wav_fmt->ext.esf.esf_field1) ;
  390|  27.7k|				psf_log_printf (psf, "    esf_field2 : 0x%X\n", wav_fmt->ext.esf.esf_field2) ;
  391|  27.7k|				psf_log_printf (psf, "    esf_field3 : 0x%X\n", wav_fmt->ext.esf.esf_field3) ;
  392|  27.7k|				psf_log_printf (psf, "    esf_field4 : ") ;
  393|   249k|				for (k = 0 ; k < 8 ; k++)
  ------------------
  |  Branch (393:18): [True: 221k, False: 27.7k]
  ------------------
  394|   221k|				{	bytesread += psf_binheader_readf (psf, "1", &(wav_fmt->ext.esf.esf_field4 [k])) ;
  395|   221k|					psf_log_printf (psf, "0x%X ", wav_fmt->ext.esf.esf_field4 [k] & 0xFF) ;
  396|   221k|					} ;
  397|  27.7k|				psf_log_printf (psf, "\n") ;
  398|  27.7k|				psf->bytewidth = BITWIDTH2BYTES (wav_fmt->ext.bitwidth) ;
  ------------------
  |  |   85|  27.7k|#define	BITWIDTH2BYTES(x)	(((x) + 7) / 8)
  ------------------
  399|       |
  400|       |				/* Compare GUIDs for known ones. */
  401|  27.7k|				if (wavex_guid_equal (&wav_fmt->ext.esf, &MSGUID_SUBTYPE_PCM))
  ------------------
  |  Branch (401:9): [True: 5.07k, False: 22.6k]
  ------------------
  402|  5.07k|				{	psf->sf.format = SF_FORMAT_WAVEX | u_bitwidth_to_subformat (psf->bytewidth * 8) ;
  403|  5.07k|					psf_log_printf (psf, "    format : pcm\n") ;
  404|  5.07k|					}
  405|  22.6k|				else if (wavex_guid_equal (&wav_fmt->ext.esf, &MSGUID_SUBTYPE_MS_ADPCM))
  ------------------
  |  Branch (405:14): [True: 2.10k, False: 20.5k]
  ------------------
  406|  2.10k|				{	psf->sf.format = (SF_FORMAT_WAVEX | SF_FORMAT_MS_ADPCM) ;
  407|  2.10k|					psf_log_printf (psf, "    format : ms adpcm\n") ;
  408|  2.10k|					}
  409|  20.5k|				else if (wavex_guid_equal (&wav_fmt->ext.esf, &MSGUID_SUBTYPE_IEEE_FLOAT))
  ------------------
  |  Branch (409:14): [True: 4.20k, False: 16.3k]
  ------------------
  410|  4.20k|				{	psf->sf.format = SF_FORMAT_WAVEX | ((psf->bytewidth == 8) ? SF_FORMAT_DOUBLE : SF_FORMAT_FLOAT) ;
  ------------------
  |  Branch (410:43): [True: 1.06k, False: 3.14k]
  ------------------
  411|  4.20k|					psf_log_printf (psf, "    format : IEEE float\n") ;
  412|  4.20k|					}
  413|  16.3k|				else if (wavex_guid_equal (&wav_fmt->ext.esf, &MSGUID_SUBTYPE_ALAW))
  ------------------
  |  Branch (413:14): [True: 3.39k, False: 12.9k]
  ------------------
  414|  3.39k|				{	psf->sf.format = (SF_FORMAT_WAVEX | SF_FORMAT_ALAW) ;
  415|  3.39k|					psf_log_printf (psf, "    format : A-law\n") ;
  416|  3.39k|					}
  417|  12.9k|				else if (wavex_guid_equal (&wav_fmt->ext.esf, &MSGUID_SUBTYPE_MULAW))
  ------------------
  |  Branch (417:14): [True: 2.89k, False: 10.0k]
  ------------------
  418|  2.89k|				{	psf->sf.format = (SF_FORMAT_WAVEX | SF_FORMAT_ULAW) ;
  419|  2.89k|					psf_log_printf (psf, "    format : u-law\n") ;
  420|  2.89k|					}
  421|  10.0k|				else if (wavex_guid_equal (&wav_fmt->ext.esf, &MSGUID_SUBTYPE_AMBISONIC_B_FORMAT_PCM))
  ------------------
  |  Branch (421:14): [True: 6.37k, False: 3.68k]
  ------------------
  422|  6.37k|				{	psf->sf.format = SF_FORMAT_WAVEX | u_bitwidth_to_subformat (psf->bytewidth * 8) ;
  423|  6.37k|					psf_log_printf (psf, "    format : pcm (Ambisonic B)\n") ;
  424|  6.37k|					wpriv->wavex_ambisonic = SF_AMBISONIC_B_FORMAT ;
  425|  6.37k|					}
  426|  3.68k|				else if (wavex_guid_equal (&wav_fmt->ext.esf, &MSGUID_SUBTYPE_AMBISONIC_B_FORMAT_IEEE_FLOAT))
  ------------------
  |  Branch (426:14): [True: 3.54k, False: 139]
  ------------------
  427|  3.54k|				{	psf->sf.format = SF_FORMAT_WAVEX | ((psf->bytewidth == 8) ? SF_FORMAT_DOUBLE : SF_FORMAT_FLOAT) ;
  ------------------
  |  Branch (427:43): [True: 1.09k, False: 2.45k]
  ------------------
  428|  3.54k|					psf_log_printf (psf, "    format : IEEE float (Ambisonic B)\n") ;
  429|  3.54k|					wpriv->wavex_ambisonic = SF_AMBISONIC_B_FORMAT ;
  430|  3.54k|					}
  431|    139|				else
  432|    139|					return SFE_UNIMPLEMENTED ;
  433|       |
  434|  27.5k|				break ;
  435|       |
  436|  27.5k|		case WAVE_FORMAT_G721_ADPCM :
  ------------------
  |  Branch (436:3): [True: 17.2k, False: 109k]
  ------------------
  437|  17.2k|				psf_log_printf (psf, "  Bytes/sec     : %d\n", wav_fmt->g72x.bytespersec) ;
  438|  17.2k|				if (fmtsize >= 20)
  ------------------
  |  Branch (438:9): [True: 7.64k, False: 9.56k]
  ------------------
  439|  7.64k|				{	bytesread += psf_binheader_readf (psf, "22", &(wav_fmt->g72x.extrabytes), &(wav_fmt->g72x.auxblocksize)) ;
  440|  7.64k|					if (wav_fmt->g72x.extrabytes == 0)
  ------------------
  |  Branch (440:10): [True: 3.38k, False: 4.26k]
  ------------------
  441|  3.38k|						psf_log_printf (psf, "  Extra Bytes   : %d (should be 2)\n", wav_fmt->g72x.extrabytes) ;
  442|  4.26k|					else
  443|  4.26k|						psf_log_printf (psf, "  Extra Bytes   : %d\n", wav_fmt->g72x.extrabytes) ;
  444|  7.64k|					psf_log_printf (psf, "  Aux Blk Size  : %d\n", wav_fmt->g72x.auxblocksize) ;
  445|  7.64k|					}
  446|  9.56k|				else if (fmtsize == 18)
  ------------------
  |  Branch (446:14): [True: 6.61k, False: 2.94k]
  ------------------
  447|  6.61k|				{	bytesread += psf_binheader_readf (psf, "2", &(wav_fmt->g72x.extrabytes)) ;
  448|  6.61k|					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.06k, False: 1.55k]
  ------------------
  449|  6.61k|					}
  450|  2.94k|				else
  451|  2.94k|					psf_log_printf (psf, "*** 'fmt ' chunk should be bigger than this!\n") ;
  452|  17.2k|				break ;
  453|       |
  454|  6.81k|		case WAVE_FORMAT_NMS_VBXADPCM :
  ------------------
  |  Branch (454:3): [True: 6.81k, False: 119k]
  ------------------
  455|  6.81k|				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: 3, False: 6.80k]
  |  Branch (455:39): [True: 5, False: 6.80k]
  |  Branch (455:68): [True: 23, False: 6.78k]
  ------------------
  456|     31|					return SFE_WAV_NMS_FORMAT ;
  457|       |
  458|  6.78k|				bytespersec = (wav_fmt->min.samplerate * wav_fmt->min.blockalign) / 160 ;
  459|  6.78k|				if (wav_fmt->min.bytespersec == (unsigned) bytespersec)
  ------------------
  |  Branch (459:9): [True: 2.42k, False: 4.35k]
  ------------------
  460|  2.42k|					psf_log_printf (psf, "  Bytes/sec     : %d\n", wav_fmt->min.bytespersec) ;
  461|  4.35k|				else
  462|  4.35k|					psf_log_printf (psf, "  Bytes/sec     : %d (should be %d)\n", wav_fmt->min.bytespersec, bytespersec) ;
  463|  6.78k|				if (fmtsize >= 18)
  ------------------
  |  Branch (463:9): [True: 3.37k, False: 3.40k]
  ------------------
  464|  3.37k|				{	bytesread += psf_binheader_readf (psf, "2", &(wav_fmt->size20.extrabytes)) ;
  465|  3.37k|					psf_log_printf (psf, "  Extra Bytes   : %d\n", wav_fmt->size20.extrabytes) ;
  466|  3.37k|					} ;
  467|  6.78k|				break ;
  468|       |
  469|     68|		default :
  ------------------
  |  Branch (469:3): [True: 68, False: 126k]
  ------------------
  470|     68|				psf_log_printf (psf, "*** No 'fmt ' chunk dumper for this format!\n") ;
  471|     68|				return SFE_WAV_BAD_FMT ;
  472|   126k|		} ;
  473|       |
  474|   126k|	if (bytesread > fmtsize)
  ------------------
  |  Branch (474:6): [True: 23, False: 126k]
  ------------------
  475|     23|	{	psf_log_printf (psf, "*** wavlike_read_fmt_chunk (bytesread > fmtsize)\n") ;
  476|     23|		return SFE_WAV_BAD_FMT ;
  477|     23|		}
  478|   126k|	else
  479|   126k|		psf_binheader_readf (psf, "j", fmtsize - bytesread) ;
  480|       |
  481|   126k|	psf->blockwidth = wav_fmt->min.channels * psf->bytewidth ;
  482|       |
  483|   126k|	return 0 ;
  484|   126k|} /* wavlike_read_fmt_chunk */
wavlike_analyze:
  524|     58|{	unsigned char buffer [4096] ;
  525|     58|	AUDIO_DETECT ad ;
  526|     58|	int format = 0 ;
  527|       |
  528|     58|	if (psf->is_pipe)
  ------------------
  |  Branch (528:6): [True: 0, False: 58]
  ------------------
  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|     58|		} ;
  532|       |
  533|     58|	psf_log_printf (psf, "---------------------------------------------------\n"
  534|     58|						"Format is known to be broken. Using detection code.\n") ;
  535|       |
  536|       |	/* Code goes here. */
  537|     58|	ad.endianness = SF_ENDIAN_LITTLE ;
  538|     58|	ad.channels = psf->sf.channels ;
  539|       |
  540|     58|	psf_fseek (psf, 3 * 4 * 50, SEEK_SET) ;
  541|       |
  542|  3.24k|	while (psf_fread (buffer, 1, sizeof (buffer), psf) == sizeof (buffer))
  ------------------
  |  Branch (542:9): [True: 3.19k, False: 52]
  ------------------
  543|  3.19k|	{	format = audio_detect (psf, &ad, buffer, sizeof (buffer)) ;
  544|  3.19k|		if (format != 0)
  ------------------
  |  Branch (544:7): [True: 6, False: 3.18k]
  ------------------
  545|      6|			break ;
  546|  3.19k|		} ;
  547|       |
  548|       |	/* Seek to start of DATA section. */
  549|     58|	psf_fseek (psf, psf->dataoffset, SEEK_SET) ;
  550|       |
  551|     58|	if (format == 0)
  ------------------
  |  Branch (551:6): [True: 52, False: 6]
  ------------------
  552|     52|	{	psf_log_printf (psf, "wavlike_analyze : detection failed.\n") ;
  553|     52|		return ;
  554|     52|		} ;
  555|       |
  556|      6|	switch (format)
  557|      6|	{	case SF_FORMAT_PCM_32 :
  ------------------
  |  Branch (557:4): [True: 4, False: 2]
  ------------------
  558|      6|		case SF_FORMAT_FLOAT :
  ------------------
  |  Branch (558:3): [True: 2, False: 4]
  ------------------
  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 = 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 = 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|   126k|{	int lower, upper, mid ;
  703|       |
  704|   126k|	lower = -1 ;
  705|   126k|	upper = sizeof (wave_descs) / sizeof (WAV_FORMAT_DESC) ;
  706|       |
  707|       |	/* binary search */
  708|   126k|	if ((wave_descs [0].ID <= k) && (k <= wave_descs [upper - 1].ID))
  ------------------
  |  Branch (708:6): [True: 126k, False: 13]
  |  Branch (708:34): [True: 126k, False: 1]
  ------------------
  709|   126k|	{
  710|   781k|		while (lower + 1 < upper)
  ------------------
  |  Branch (710:10): [True: 781k, False: 47]
  ------------------
  711|   781k|		{	mid = (upper + lower) / 2 ;
  712|       |
  713|   781k|			if (k == wave_descs [mid].ID)
  ------------------
  |  Branch (713:8): [True: 126k, False: 655k]
  ------------------
  714|   126k|				return wave_descs [mid].name ;
  715|   655k|			if (k < wave_descs [mid].ID)
  ------------------
  |  Branch (715:8): [True: 358k, False: 296k]
  ------------------
  716|   358k|				upper = mid ;
  717|   296k|			else
  718|   296k|				lower = mid ;
  719|   655k|			} ;
  720|     61|		} ;
  721|       |
  722|     61|	return "Unknown format" ;
  723|   126k|} /* wavlike_format_str */
wavlike_read_bext_chunk:
  738|  5.50k|{
  739|  5.50k|	SF_BROADCAST_INFO_16K * b ;
  740|  5.50k|	uint32_t bytes = 0 ;
  741|       |
  742|  5.50k|	if (chunksize < WAV_BEXT_MIN_CHUNK_SIZE)
  ------------------
  |  |   33|  5.50k|#define WAV_BEXT_MIN_CHUNK_SIZE		602
  ------------------
  |  Branch (742:6): [True: 4.89k, False: 610]
  ------------------
  743|  4.89k|	{	psf_log_printf (psf, "bext : %u (should be >= %d)\n", chunksize, WAV_BEXT_MIN_CHUNK_SIZE) ;
  ------------------
  |  |   33|  4.89k|#define WAV_BEXT_MIN_CHUNK_SIZE		602
  ------------------
  744|  4.89k|		psf_binheader_readf (psf, "j", chunksize) ;
  745|  4.89k|		return 0 ;
  746|  4.89k|		} ;
  747|       |
  748|    610|	if (chunksize > WAV_BEXT_MAX_CHUNK_SIZE)
  ------------------
  |  |   34|    610|#define WAV_BEXT_MAX_CHUNK_SIZE		(10 * 1024)
  ------------------
  |  Branch (748:6): [True: 382, False: 228]
  ------------------
  749|    382|	{	psf_log_printf (psf, "bext : %u (should be < %d)\n", chunksize, WAV_BEXT_MAX_CHUNK_SIZE) ;
  ------------------
  |  |   34|    382|#define WAV_BEXT_MAX_CHUNK_SIZE		(10 * 1024)
  ------------------
  750|    382|		psf_binheader_readf (psf, "j", chunksize) ;
  751|    382|		return 0 ;
  752|    382|		} ;
  753|       |
  754|    228|	if (chunksize >= sizeof (SF_BROADCAST_INFO_16K))
  ------------------
  |  Branch (754:6): [True: 0, False: 228]
  ------------------
  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|    228|		} ;
  759|       |
  760|    228|	psf_log_printf (psf, "bext : %u\n", chunksize) ;
  761|       |
  762|    228|	if (!psf->broadcast_16k)
  ------------------
  |  Branch (762:6): [True: 35, False: 193]
  ------------------
  763|     35|	{	psf->broadcast_16k = broadcast_var_alloc () ;
  764|     35|		if (!psf->broadcast_16k)
  ------------------
  |  Branch (764:7): [True: 0, False: 35]
  ------------------
  765|      0|		{	psf->error = SFE_MALLOC_FAILED ;
  766|      0|			return psf->error ;
  767|      0|			}
  768|     35|		}
  769|    193|	else
  770|    193|	{	psf_log_printf (psf, "bext : found more than one bext chunk, using last one.\n") ;
  771|    193|		memset (psf->broadcast_16k, 0, sizeof (SF_BROADCAST_INFO_16K)) ;
  772|    193|		}
  773|       |
  774|    228|	b = psf->broadcast_16k ;
  775|       |
  776|    228|	bytes += psf_binheader_readf (psf, "b", b->description, sizeof (b->description)) ;
  777|    228|	bytes += psf_binheader_readf (psf, "b", b->originator, sizeof (b->originator)) ;
  778|    228|	bytes += psf_binheader_readf (psf, "b", b->originator_reference, sizeof (b->originator_reference)) ;
  779|    228|	bytes += psf_binheader_readf (psf, "b", b->origination_date, sizeof (b->origination_date)) ;
  780|    228|	bytes += psf_binheader_readf (psf, "b", b->origination_time, sizeof (b->origination_time)) ;
  781|    228|	bytes += psf_binheader_readf (psf, "442", &b->time_reference_low, &b->time_reference_high, &b->version) ;
  782|    228|	bytes += psf_binheader_readf (psf, "b", &b->umid, sizeof (b->umid)) ;
  783|    228|	bytes += psf_binheader_readf (psf, "22", &b->loudness_value, &b->loudness_range) ;
  784|    228|	bytes += psf_binheader_readf (psf, "222", &b->max_true_peak_level, &b->max_momentary_loudness, &b->max_shortterm_loudness) ;
  785|    228|	bytes += psf_binheader_readf (psf, "j", 180) ;
  786|       |
  787|    228|	if (chunksize > WAV_BEXT_MIN_CHUNK_SIZE)
  ------------------
  |  |   33|    228|#define WAV_BEXT_MIN_CHUNK_SIZE		602
  ------------------
  |  Branch (787:6): [True: 207, False: 21]
  ------------------
  788|    207|	{	/* File has coding history data. */
  789|       |
  790|    207|		b->coding_history_size = chunksize - WAV_BEXT_MIN_CHUNK_SIZE ;
  ------------------
  |  |   33|    207|#define WAV_BEXT_MIN_CHUNK_SIZE		602
  ------------------
  791|       |
  792|       |		/* We do not parse the coding history */
  793|    207|		bytes += psf_binheader_readf (psf, "b", BHWv (b->coding_history), BHWz (b->coding_history_size)) ;
  ------------------
  |  |  133|    207|#define BHWv(x) ((const void *) (x))
  ------------------
              		bytes += psf_binheader_readf (psf, "b", BHWv (b->coding_history), BHWz (b->coding_history_size)) ;
  ------------------
  |  |  134|    207|#define BHWz(x) ((size_t) (x))
  ------------------
  794|    207|		} ;
  795|       |
  796|    228|	if (bytes < chunksize)
  ------------------
  |  Branch (796:6): [True: 41, False: 187]
  ------------------
  797|     41|		psf_binheader_readf (psf, "j", BHWj (chunksize - bytes)) ;
  ------------------
  |  |  129|     41|#define BHWj(x) ((size_t) (x))
  ------------------
  798|       |
  799|    228|	return 0 ;
  800|    228|} /* wavlike_read_bext_chunk */
wavlike_read_cart_chunk:
  837|  2.18k|{	SF_CART_INFO_16K *c ;
  838|  2.18k|	uint32_t bytes = 0 ;
  839|  2.18k|	int k ;
  840|       |
  841|  2.18k|	if (chunksize < WAV_CART_MIN_CHUNK_SIZE)
  ------------------
  |  |   36|  2.18k|#define WAV_CART_MIN_CHUNK_SIZE		2048
  ------------------
  |  Branch (841:6): [True: 841, False: 1.34k]
  ------------------
  842|    841|	{	psf_log_printf (psf, "cart : %u (should be >= %d)\n", chunksize, WAV_CART_MIN_CHUNK_SIZE) ;
  ------------------
  |  |   36|    841|#define WAV_CART_MIN_CHUNK_SIZE		2048
  ------------------
  843|    841|		psf_binheader_readf (psf, "j", chunksize) ;
  844|    841|		return 0 ;
  845|  1.34k|		} ;
  846|  1.34k|	if (chunksize > WAV_CART_MAX_CHUNK_SIZE)
  ------------------
  |  |   37|  1.34k|#define WAV_CART_MAX_CHUNK_SIZE		0xffffffff
  ------------------
  |  Branch (846:6): [True: 0, False: 1.34k]
  ------------------
  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.34k|		} ;
  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.34k|	if (chunksize >= sizeof (SF_CART_INFO_16K) - 4)
  ------------------
  |  Branch (856:6): [True: 1.04k, False: 295]
  ------------------
  857|  1.04k|	{	psf_log_printf (psf, "cart : %u too big to be handled\n", chunksize) ;
  858|  1.04k|		psf_binheader_readf (psf, "j", chunksize) ;
  859|  1.04k|		return 0 ;
  860|  1.04k|		} ;
  861|       |
  862|    295|	psf_log_printf (psf, "cart : %u\n", chunksize) ;
  863|       |
  864|    295|	if (psf->cart_16k)
  ------------------
  |  Branch (864:6): [True: 266, False: 29]
  ------------------
  865|    266|	{	psf_log_printf (psf, "  Found more than one cart chunk, using last one.\n") ;
  866|    266|		free (psf->cart_16k) ;
  867|    266|		psf->cart_16k = NULL ;
  868|    266|		} ;
  869|       |
  870|    295|	if ((psf->cart_16k = cart_var_alloc ()) == NULL)
  ------------------
  |  Branch (870:6): [True: 0, False: 295]
  ------------------
  871|      0|	{	psf->error = SFE_MALLOC_FAILED ;
  872|      0|		return psf->error ;
  873|    295|		} ;
  874|       |
  875|    295|	c = psf->cart_16k ;
  876|    295|	bytes += psf_binheader_readf (psf, "b", c->version, sizeof (c->version)) ;
  877|    295|	bytes += psf_binheader_readf (psf, "b", c->title, sizeof (c->title)) ;
  878|    295|	bytes += psf_binheader_readf (psf, "b", c->artist, sizeof (c->artist)) ;
  879|    295|	bytes += psf_binheader_readf (psf, "b", c->cut_id, sizeof (c->cut_id)) ;
  880|    295|	bytes += psf_binheader_readf (psf, "b", c->client_id, sizeof (c->client_id)) ;
  881|    295|	bytes += psf_binheader_readf (psf, "b", c->category, sizeof (c->category)) ;
  882|    295|	bytes += psf_binheader_readf (psf, "b", c->classification, sizeof (c->classification)) ;
  883|    295|	bytes += psf_binheader_readf (psf, "b", c->out_cue, sizeof (c->out_cue)) ;
  884|    295|	bytes += psf_binheader_readf (psf, "b", c->start_date, sizeof (c->start_date)) ;
  885|    295|	bytes += psf_binheader_readf (psf, "b", c->start_time, sizeof (c->start_time)) ;
  886|    295|	bytes += psf_binheader_readf (psf, "b", c->end_date, sizeof (c->end_date)) ;
  887|    295|	bytes += psf_binheader_readf (psf, "b", c->end_time, sizeof (c->end_time)) ;
  888|    295|	bytes += psf_binheader_readf (psf, "b", c->producer_app_id, sizeof (c->producer_app_id)) ;
  889|    295|	bytes += psf_binheader_readf (psf, "b", c->producer_app_version, sizeof (c->producer_app_version)) ;
  890|    295|	bytes += psf_binheader_readf (psf, "b", c->user_def, sizeof (c->user_def)) ;
  891|    295|	bytes += psf_binheader_readf (psf, "e4", &c->level_reference, sizeof (c->level_reference)) ;
  892|       |
  893|  2.65k|	for (k = 0 ; k < ARRAY_LEN (c->post_timers) ; k++)
  ------------------
  |  |   93|  2.65k|#define		ARRAY_LEN(x)	((int) (sizeof (x) / sizeof ((x) [0])))
  ------------------
  |  Branch (893:15): [True: 2.36k, False: 295]
  ------------------
  894|  2.36k|		bytes += psf_binheader_readf (psf, "b4", &c->post_timers [k].usage, make_size_t (4), &c->post_timers [k].value) ;
  895|       |
  896|    295|	bytes += psf_binheader_readf (psf, "b", c->reserved, sizeof (c->reserved)) ;
  897|    295|	bytes += psf_binheader_readf (psf, "b", c->url, sizeof (c->url)) ;
  898|       |
  899|    295|	if (chunksize > WAV_CART_MIN_CHUNK_SIZE)
  ------------------
  |  |   36|    295|#define WAV_CART_MIN_CHUNK_SIZE		2048
  ------------------
  |  Branch (899:6): [True: 132, False: 163]
  ------------------
  900|    132|	{	/* File has tag text. */
  901|    132|		c->tag_text_size = chunksize - WAV_CART_MIN_CHUNK_SIZE ;
  ------------------
  |  |   36|    132|#define WAV_CART_MIN_CHUNK_SIZE		2048
  ------------------
  902|    132|		bytes += psf_binheader_readf (psf, "b", c->tag_text, make_size_t (c->tag_text_size)) ;
  903|    132|		} ;
  904|       |
  905|    295|	if (bytes < chunksize)
  ------------------
  |  Branch (905:6): [True: 38, False: 257]
  ------------------
  906|     38|		psf_log_printf (psf, "  %d trailing bytes in cart chunk.\n", chunksize - bytes) ;
  907|       |
  908|    295|	return 0 ;
  909|    295|} /* wavlike_read_cart_chunk */
wavlike_subchunk_parse:
  956|  69.8k|{	sf_count_t	current_pos ;
  957|  69.8k|	char		buffer [2048] ;
  958|  69.8k|	uint32_t 	chunk_size, bytesread = 0 ;
  959|       |
  960|  69.8k|	current_pos = psf_fseek (psf, 0, SEEK_CUR) ;
  961|       |
  962|  69.8k|	if (chunk_length <= 8)
  ------------------
  |  Branch (962:6): [True: 2.72k, False: 67.1k]
  ------------------
  963|  2.72k|	{	/* This case is for broken files generated by PEAK. */
  964|  2.72k|		psf_log_printf (psf, "%M : %u (weird length)\n", chunk, chunk_length) ;
  965|  2.72k|		psf_binheader_readf (psf, "mj", &chunk, chunk_length - 4) ;
  966|  2.72k|		psf_log_printf (psf, "  %M\n", chunk) ;
  967|  2.72k|		return 0 ;
  968|  67.1k|		} ;
  969|       |
  970|  67.1k|	if (current_pos + chunk_length > psf->filelength)
  ------------------
  |  Branch (970:6): [True: 37.4k, False: 29.6k]
  ------------------
  971|  37.4k|	{	psf_log_printf (psf, "%M : %u (should be %d)\n", chunk, chunk_length, (int) (psf->filelength - current_pos)) ;
  972|  37.4k|		chunk_length = psf->filelength - current_pos ;
  973|  37.4k|		}
  974|  29.6k|	else
  975|  29.6k|		psf_log_printf (psf, "%M : %u\n", chunk, chunk_length) ;
  976|       |
  977|   173k|	while (bytesread < chunk_length)
  ------------------
  |  Branch (977:9): [True: 165k, False: 8.35k]
  ------------------
  978|   165k|	{	uint32_t thisread ;
  979|       |
  980|   165k|		if ((thisread = psf_binheader_readf (psf, "m", &chunk)) == 0)
  ------------------
  |  Branch (980:7): [True: 248, False: 164k]
  ------------------
  981|    248|			break ;
  982|   164k|		bytesread += thisread ;
  983|       |
  984|   164k|		switch (chunk)
  985|   164k|		{	case adtl_MARKER :
  ------------------
  |  |   29|    215|#define adtl_MARKER		MAKE_MARKER ('a', 'd', 't', 'l')
  |  |  ------------------
  |  |  |  |  122|    215|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (985:5): [True: 215, False: 164k]
  ------------------
  986|  1.06k|			case INFO_MARKER :
  ------------------
  |  |   37|  1.06k|#define INFO_MARKER		MAKE_MARKER ('I', 'N', 'F', 'O')
  |  |  ------------------
  |  |  |  |  122|  1.06k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (986:4): [True: 848, False: 164k]
  ------------------
  987|       |					/* These markers don't contain anything, not even a chunk length. */
  988|  1.06k|					psf_log_printf (psf, "  %M\n", chunk) ;
  989|  1.06k|					continue ;
  990|       |
  991|  41.0k|			case exif_MARKER :
  ------------------
  |  |   58|  41.0k|#define exif_MARKER		MAKE_MARKER ('e', 'x', 'i', 'f')
  |  |  ------------------
  |  |  |  |  122|  41.0k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (991:4): [True: 41.0k, False: 123k]
  ------------------
  992|  41.0k|					psf_log_printf (psf, "  %M\n", chunk) ;
  993|  41.0k|					if (chunk_length > bytesread)
  ------------------
  |  Branch (993:10): [True: 40.2k, False: 856]
  ------------------
  994|  40.2k|						bytesread += exif_subchunk_parse (psf, chunk_length - bytesread) ;
  995|  41.0k|					continue ;
  996|       |
  997|  7.01k|			case data_MARKER :
  ------------------
  |  |   32|  7.01k|#define data_MARKER		MAKE_MARKER ('d', 'a', 't', 'a')
  |  |  ------------------
  |  |  |  |  122|  7.01k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (997:4): [True: 7.01k, False: 157k]
  ------------------
  998|  7.01k|					psf_log_printf (psf, "  %M inside a LIST block??? Backing out.\n", chunk) ;
  999|       |					/* Jump back four bytes and return to caller. */
 1000|  7.01k|					psf_binheader_readf (psf, "j", -4) ;
 1001|  7.01k|					return 0 ;
 1002|       |
 1003|  6.85k|			case 0 :
  ------------------
  |  Branch (1003:4): [True: 6.85k, False: 158k]
  ------------------
 1004|       |					/*
 1005|       |					**	Four zero bytes where a marker was expected. Assume this means
 1006|       |					**	the rest of the chunk is garbage.
 1007|       |					*/
 1008|  6.85k|					psf_log_printf (psf, "    *** Found weird-ass zero marker. Jumping to end of chunk.\n") ;
 1009|  6.85k|					goto cleanup_subchunk_parse ;
 1010|       |
 1011|   108k|			default :
  ------------------
  |  Branch (1011:4): [True: 108k, False: 56.0k]
  ------------------
 1012|   108k|					break ;
 1013|   164k|			} ;
 1014|       |
 1015|   108k|		switch (chunk)
 1016|   108k|		{	case ISFT_MARKER :
  ------------------
  |  |   42|  1.33k|#define ISFT_MARKER		MAKE_MARKER ('I', 'S', 'F', 'T')
  |  |  ------------------
  |  |  |  |  122|  1.33k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (1016:5): [True: 1.33k, False: 107k]
  ------------------
 1017|  3.94k|			case ICOP_MARKER :
  ------------------
  |  |   50|  3.94k|#define ICOP_MARKER		MAKE_MARKER ('I', 'C', 'O', 'P')
  |  |  ------------------
  |  |  |  |  122|  3.94k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (1017:4): [True: 2.60k, False: 106k]
  ------------------
 1018|  4.23k|			case IARL_MARKER :
  ------------------
  |  |   45|  4.23k|#define IARL_MARKER		MAKE_MARKER ('I', 'A', 'R', 'L')
  |  |  ------------------
  |  |  |  |  122|  4.23k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (1018:4): [True: 292, False: 108k]
  ------------------
 1019|  5.40k|			case IART_MARKER :
  ------------------
  |  |   46|  5.40k|#define IART_MARKER		MAKE_MARKER ('I', 'A', 'R', 'T')
  |  |  ------------------
  |  |  |  |  122|  5.40k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (1019:4): [True: 1.16k, False: 107k]
  ------------------
 1020|  13.7k|			case ICMT_MARKER :
  ------------------
  |  |   54|  13.7k|#define ICMT_MARKER		MAKE_MARKER ('I', 'C', 'M', 'T')
  |  |  ------------------
  |  |  |  |  122|  13.7k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (1020:4): [True: 8.32k, False: 100k]
  ------------------
 1021|  15.7k|			case ICRD_MARKER :
  ------------------
  |  |   43|  15.7k|#define ICRD_MARKER		MAKE_MARKER ('I', 'C', 'R', 'D')
  |  |  ------------------
  |  |  |  |  122|  15.7k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (1021:4): [True: 2.06k, False: 106k]
  ------------------
 1022|  19.1k|			case IENG_MARKER :
  ------------------
  |  |   48|  19.1k|#define IENG_MARKER		MAKE_MARKER ('I', 'E', 'N', 'G')
  |  |  ------------------
  |  |  |  |  122|  19.1k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (1022:4): [True: 3.38k, False: 105k]
  ------------------
 1023|  19.2k|			case IGNR_MARKER :
  ------------------
  |  |   49|  19.2k|#define IGNR_MARKER		MAKE_MARKER ('I', 'G', 'N', 'R')
  |  |  ------------------
  |  |  |  |  122|  19.2k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (1023:4): [True: 88, False: 108k]
  ------------------
 1024|  22.8k|			case INAM_MARKER :
  ------------------
  |  |   47|  22.8k|#define INAM_MARKER		MAKE_MARKER ('I', 'N', 'A', 'M')
  |  |  ------------------
  |  |  |  |  122|  22.8k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (1024:4): [True: 3.62k, False: 105k]
  ------------------
 1025|  24.9k|			case IPRD_MARKER :
  ------------------
  |  |   51|  24.9k|#define IPRD_MARKER		MAKE_MARKER ('I', 'P', 'R', 'D')
  |  |  ------------------
  |  |  |  |  122|  24.9k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (1025:4): [True: 2.03k, False: 106k]
  ------------------
 1026|  26.9k|			case ISBJ_MARKER :
  ------------------
  |  |   53|  26.9k|#define ISBJ_MARKER		MAKE_MARKER ('I', 'S', 'B', 'J')
  |  |  ------------------
  |  |  |  |  122|  26.9k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (1026:4): [True: 2.02k, False: 106k]
  ------------------
 1027|  29.0k|			case ISRC_MARKER :
  ------------------
  |  |   52|  29.0k|#define ISRC_MARKER		MAKE_MARKER ('I', 'S', 'R', 'C')
  |  |  ------------------
  |  |  |  |  122|  29.0k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (1027:4): [True: 2.12k, False: 106k]
  ------------------
 1028|  29.2k|			case IAUT_MARKER :
  ------------------
  |  |   55|  29.2k|#define IAUT_MARKER		MAKE_MARKER ('I', 'A', 'U', 'T')
  |  |  ------------------
  |  |  |  |  122|  29.2k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (1028:4): [True: 217, False: 108k]
  ------------------
 1029|  30.7k|			case ITRK_MARKER :
  ------------------
  |  |   56|  30.7k|#define ITRK_MARKER		MAKE_MARKER ('I', 'T', 'R', 'K')
  |  |  ------------------
  |  |  |  |  122|  30.7k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (1029:4): [True: 1.44k, False: 107k]
  ------------------
 1030|  30.7k|					bytesread += psf_binheader_readf (psf, "4", &chunk_size) ;
 1031|  30.7k|					chunk_size += (chunk_size & 1) ;
 1032|  30.7k|					if (chunk_size >= SIGNED_SIZEOF (buffer) || bytesread + chunk_size > chunk_length)
  ------------------
  |  |   91|  61.4k|#define		SIGNED_SIZEOF(x)	((int) sizeof (x))
  ------------------
  |  Branch (1032:10): [True: 7.11k, False: 23.6k]
  |  Branch (1032:50): [True: 5.28k, False: 18.3k]
  ------------------
 1033|  12.3k|					{	psf_log_printf (psf, "  *** %M : %u (too big)\n", chunk, chunk_size) ;
 1034|  12.3k|						goto cleanup_subchunk_parse ;
 1035|  18.3k|						} ;
 1036|       |
 1037|  18.3k|					bytesread += psf_binheader_readf (psf, "b", buffer, chunk_size) ;
 1038|  18.3k|					buffer [chunk_size] = 0 ;
 1039|  18.3k|					psf_log_printf (psf, "    %M : %s\n", chunk, buffer) ;
 1040|  18.3k|					break ;
 1041|       |
 1042|  12.6k|			case labl_MARKER :
  ------------------
  |  |   33|  12.6k|#define labl_MARKER		MAKE_MARKER ('l', 'a', 'b', 'l')
  |  |  ------------------
  |  |  |  |  122|  12.6k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (1042:4): [True: 12.6k, False: 96.3k]
  ------------------
 1043|  12.6k|					{	int mark_id ;
 1044|       |
 1045|  12.6k|						bytesread += psf_binheader_readf (psf, "44", &chunk_size, &mark_id) ;
 1046|  12.6k|						chunk_size -= 4 ;
 1047|  12.6k|						chunk_size += (chunk_size & 1) ;
 1048|  12.6k|						if (chunk_size < 1 || chunk_size >= SIGNED_SIZEOF (buffer) || bytesread + chunk_size > chunk_length)
  ------------------
  |  |   91|  24.6k|#define		SIGNED_SIZEOF(x)	((int) sizeof (x))
  ------------------
  |  Branch (1048:11): [True: 575, False: 12.0k]
  |  Branch (1048:29): [True: 3.45k, False: 8.57k]
  |  Branch (1048:69): [True: 3.42k, False: 5.15k]
  ------------------
 1049|  7.45k|						{	psf_log_printf (psf, "  *** %M : %u (too big)\n", chunk, chunk_size) ;
 1050|  7.45k|							goto cleanup_subchunk_parse ;
 1051|  7.45k|							} ;
 1052|       |
 1053|  5.15k|						bytesread += psf_binheader_readf (psf, "b", buffer, chunk_size) ;
 1054|  5.15k|						buffer [chunk_size] = 0 ;
 1055|       |
 1056|  5.15k|						if (mark_id < 10) /* avoid swamping log buffer with labels */
  ------------------
  |  Branch (1056:11): [True: 1.73k, False: 3.41k]
  ------------------
 1057|  1.73k|							psf_log_printf (psf, "    %M : %u : %s\n", chunk, mark_id, buffer) ;
 1058|  3.41k|						else if (mark_id == 10)
  ------------------
  |  Branch (1058:16): [True: 1.80k, False: 1.61k]
  ------------------
 1059|  1.80k|							psf_log_printf (psf, "    (Skipping)\n") ;
 1060|       |
 1061|  5.15k|						if (psf->cues)
  ------------------
  |  Branch (1061:11): [True: 571, False: 4.58k]
  ------------------
 1062|    571| 						{	unsigned int i = 0 ;
 1063|       |
 1064|       |							/* find id to store label */
 1065|  1.93k|							while (i < psf->cues->cue_count && psf->cues->cue_points [i].indx != mark_id)
  ------------------
  |  Branch (1065:15): [True: 1.56k, False: 368]
  |  Branch (1065:43): [True: 1.36k, False: 203]
  ------------------
 1066|  1.36k|								i++ ;
 1067|       |
 1068|    571|							if (i < psf->cues->cue_count)
  ------------------
  |  Branch (1068:12): [True: 203, False: 368]
  ------------------
 1069|    203|								memcpy (psf->cues->cue_points [i].name, buffer, sizeof (psf->cues->cue_points [i].name)) ;
 1070|    571|							} ;
 1071|  5.15k|						} ;
 1072|  5.15k|					break ;
 1073|       |
 1074|  5.36k|			case DISP_MARKER :
  ------------------
  |  |   36|  5.36k|#define DISP_MARKER		MAKE_MARKER ('D', 'I', 'S', 'P')
  |  |  ------------------
  |  |  |  |  122|  5.36k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (1074:4): [True: 5.36k, False: 103k]
  ------------------
 1075|  6.53k|			case ltxt_MARKER :
  ------------------
  |  |   34|  6.53k|#define ltxt_MARKER		MAKE_MARKER ('l', 't', 'x', 't')
  |  |  ------------------
  |  |  |  |  122|  6.53k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (1075:4): [True: 1.17k, False: 107k]
  ------------------
 1076|  7.36k|			case note_MARKER :
  ------------------
  |  |   35|  7.36k|#define note_MARKER		MAKE_MARKER ('n', 'o', 't', 'e')
  |  |  ------------------
  |  |  |  |  122|  7.36k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (1076:4): [True: 829, False: 108k]
  ------------------
 1077|  7.36k|					bytesread += psf_binheader_readf (psf, "4", &chunk_size) ;
 1078|  7.36k|					chunk_size += (chunk_size & 1) ;
 1079|  7.36k|					if (chunk_size >= SIGNED_SIZEOF (buffer) || bytesread + chunk_size > chunk_length)
  ------------------
  |  |   91|  14.7k|#define		SIGNED_SIZEOF(x)	((int) sizeof (x))
  ------------------
  |  Branch (1079:10): [True: 3.03k, False: 4.33k]
  |  Branch (1079:50): [True: 1.66k, False: 2.67k]
  ------------------
 1080|  4.69k|					{	psf_log_printf (psf, "  *** %M : %u (too big)\n", chunk, chunk_size) ;
 1081|  4.69k|						goto cleanup_subchunk_parse ;
 1082|  4.69k|						} ;
 1083|       |
 1084|  2.67k|					psf_log_printf (psf, "    %M : %u\n", chunk, chunk_size) ;
 1085|  2.67k|					goto cleanup_subchunk_parse ;
 1086|       |
 1087|  58.2k|			default :
  ------------------
  |  Branch (1087:4): [True: 58.2k, False: 50.7k]
  ------------------
 1088|  58.2k|					bytesread += psf_binheader_readf (psf, "4", &chunk_size) ;
 1089|  58.2k|					chunk_size += (chunk_size & 1) ;
 1090|  58.2k|					if (bytesread + chunk_size > chunk_length)
  ------------------
  |  Branch (1090:10): [True: 17.4k, False: 40.8k]
  ------------------
 1091|  17.4k|					{	psf_log_printf (psf, "  *** %M : %u (too big)\n", chunk, chunk_size) ;
 1092|  17.4k|						goto cleanup_subchunk_parse ;
 1093|  17.4k|						}
 1094|  40.8k|					else
 1095|  40.8k|					{	psf_log_printf (psf, "    %M : %u\n", chunk, chunk_size) ;
 1096|  40.8k|						bytesread += psf_binheader_readf (psf, "j", chunk_size) ;
 1097|  40.8k|						} ;
 1098|  40.8k|					break ;
 1099|   108k|			} ;
 1100|       |
 1101|  64.3k|		switch (chunk)
  ------------------
  |  Branch (1101:11): [True: 17.8k, False: 46.4k]
  ------------------
 1102|  64.3k|		{	case ISFT_MARKER :
  ------------------
  |  |   42|  1.33k|#define ISFT_MARKER		MAKE_MARKER ('I', 'S', 'F', 'T')
  |  |  ------------------
  |  |  |  |  122|  1.33k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (1102:5): [True: 1.33k, False: 62.9k]
  ------------------
 1103|  1.33k|					psf_store_string (psf, SF_STR_SOFTWARE, buffer) ;
 1104|  1.33k|					break ;
 1105|  2.32k|			case ICOP_MARKER :
  ------------------
  |  |   50|  2.32k|#define ICOP_MARKER		MAKE_MARKER ('I', 'C', 'O', 'P')
  |  |  ------------------
  |  |  |  |  122|  2.32k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (1105:4): [True: 2.32k, False: 61.9k]
  ------------------
 1106|  2.32k|					psf_store_string (psf, SF_STR_COPYRIGHT, buffer) ;
 1107|  2.32k|					break ;
 1108|  3.22k|			case INAM_MARKER :
  ------------------
  |  |   47|  3.22k|#define INAM_MARKER		MAKE_MARKER ('I', 'N', 'A', 'M')
  |  |  ------------------
  |  |  |  |  122|  3.22k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (1108:4): [True: 3.22k, False: 61.0k]
  ------------------
 1109|  3.22k|					psf_store_string (psf, SF_STR_TITLE, buffer) ;
 1110|  3.22k|					break ;
 1111|    319|			case IART_MARKER :
  ------------------
  |  |   46|    319|#define IART_MARKER		MAKE_MARKER ('I', 'A', 'R', 'T')
  |  |  ------------------
  |  |  |  |  122|    319|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (1111:4): [True: 319, False: 63.9k]
  ------------------
 1112|    319|					psf_store_string (psf, SF_STR_ARTIST, buffer) ;
 1113|    319|					break ;
 1114|  5.27k|			case ICMT_MARKER :
  ------------------
  |  |   54|  5.27k|#define ICMT_MARKER		MAKE_MARKER ('I', 'C', 'M', 'T')
  |  |  ------------------
  |  |  |  |  122|  5.27k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (1114:4): [True: 5.27k, False: 59.0k]
  ------------------
 1115|  5.27k|					psf_store_string (psf, SF_STR_COMMENT, buffer) ;
 1116|  5.27k|					break ;
 1117|  2.05k|			case ICRD_MARKER :
  ------------------
  |  |   43|  2.05k|#define ICRD_MARKER		MAKE_MARKER ('I', 'C', 'R', 'D')
  |  |  ------------------
  |  |  |  |  122|  2.05k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (1117:4): [True: 2.05k, False: 62.2k]
  ------------------
 1118|  2.05k|					psf_store_string (psf, SF_STR_DATE, buffer) ;
 1119|  2.05k|					break ;
 1120|     84|			case IGNR_MARKER :
  ------------------
  |  |   49|     84|#define IGNR_MARKER		MAKE_MARKER ('I', 'G', 'N', 'R')
  |  |  ------------------
  |  |  |  |  122|     84|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (1120:4): [True: 84, False: 64.2k]
  ------------------
 1121|     84|					psf_store_string (psf, SF_STR_GENRE, buffer) ;
 1122|     84|					break ;
 1123|  1.77k|			case IPRD_MARKER :
  ------------------
  |  |   51|  1.77k|#define IPRD_MARKER		MAKE_MARKER ('I', 'P', 'R', 'D')
  |  |  ------------------
  |  |  |  |  122|  1.77k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (1123:4): [True: 1.77k, False: 62.5k]
  ------------------
 1124|  1.77k|					psf_store_string (psf, SF_STR_ALBUM, buffer) ;
 1125|  1.77k|					break ;
 1126|  1.44k|			case ITRK_MARKER :
  ------------------
  |  |   56|  1.44k|#define ITRK_MARKER		MAKE_MARKER ('I', 'T', 'R', 'K')
  |  |  ------------------
  |  |  |  |  122|  1.44k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (1126:4): [True: 1.44k, False: 62.8k]
  ------------------
 1127|  1.44k|					psf_store_string (psf, SF_STR_TRACKNUMBER, buffer) ;
 1128|  1.44k|					break ;
 1129|  64.3k|			} ;
 1130|  64.3k|		} ;
 1131|       |
 1132|  60.0k|cleanup_subchunk_parse :
 1133|       |
 1134|  60.0k|	if (chunk_length > bytesread)
  ------------------
  |  Branch (1134:6): [True: 43.1k, False: 16.8k]
  ------------------
 1135|  43.1k|		bytesread += psf_binheader_readf (psf, "j", chunk_length - bytesread) ;
 1136|       |
 1137|  60.0k|	return 0 ;
 1138|  8.60k|} /* wavlike_subchunk_parse */
wavlike_read_peak_chunk:
 1208|  7.82k|{	char		buffer [256] ;
 1209|  7.82k|	uint32_t uk ;
 1210|       |
 1211|  7.82k|	if (chunk_size != WAVLIKE_PEAK_CHUNK_SIZE (psf->sf.channels))
  ------------------
  |  |  337|  7.82k|#define		WAVLIKE_PEAK_CHUNK_SIZE(ch) (2 * sizeof (int) + ch * (sizeof (float) + sizeof (int)))
  ------------------
  |  Branch (1211:6): [True: 31, False: 7.79k]
  ------------------
 1212|     31|	{	psf_binheader_readf (psf, "j", chunk_size) ;
 1213|     31|		psf_log_printf (psf, "*** File PEAK chunk size doesn't fit with number of channels (%d).\n", psf->sf.channels) ;
 1214|     31|		return SFE_WAV_BAD_PEAK ;
 1215|  7.79k|		} ;
 1216|       |
 1217|  7.79k|	if (psf->peak_info)
  ------------------
  |  Branch (1217:6): [True: 7.74k, False: 45]
  ------------------
 1218|  7.74k|	{	psf_log_printf (psf, "*** Found existing peak info, using last one.\n") ;
 1219|  7.74k|		free (psf->peak_info) ;
 1220|  7.74k|		psf->peak_info = NULL ;
 1221|  7.74k|		} ;
 1222|  7.79k|	if ((psf->peak_info = peak_info_calloc (psf->sf.channels)) == NULL)
  ------------------
  |  Branch (1222:6): [True: 0, False: 7.79k]
  ------------------
 1223|      0|		return SFE_MALLOC_FAILED ;
 1224|       |
 1225|       |	/* read in rest of PEAK chunk. */
 1226|  7.79k|	psf_binheader_readf (psf, "44", & (psf->peak_info->version), & (psf->peak_info->timestamp)) ;
 1227|       |
 1228|  7.79k|	if (psf->peak_info->version != 1)
  ------------------
  |  Branch (1228:6): [True: 5.64k, False: 2.14k]
  ------------------
 1229|  5.64k|		psf_log_printf (psf, "  version    : %d *** (should be version 1)\n", psf->peak_info->version) ;
 1230|  2.14k|	else
 1231|  2.14k|		psf_log_printf (psf, "  version    : %d\n", psf->peak_info->version) ;
 1232|       |
 1233|  7.79k|	psf_log_printf (psf, "  time stamp : %d\n", psf->peak_info->timestamp) ;
 1234|  7.79k|	psf_log_printf (psf, "    Ch   Position       Value\n") ;
 1235|       |
 1236|  30.4k|	for (uk = 0 ; uk < (uint32_t) psf->sf.channels ; uk++)
  ------------------
  |  Branch (1236:16): [True: 22.6k, False: 7.79k]
  ------------------
 1237|  22.6k|	{	float value ;
 1238|  22.6k|		uint32_t position ;
 1239|       |
 1240|  22.6k|		psf_binheader_readf (psf, "f4", &value, &position) ;
 1241|  22.6k|		psf->peak_info->peaks [uk].value = value ;
 1242|  22.6k|		psf->peak_info->peaks [uk].position = position ;
 1243|       |
 1244|  22.6k|		snprintf (buffer, sizeof (buffer), "    %2d   %-12" PRId64 "   %g\n",
 1245|  22.6k|				uk, psf->peak_info->peaks [uk].position, psf->peak_info->peaks [uk].value) ;
 1246|  22.6k|		buffer [sizeof (buffer) - 1] = 0 ;
 1247|  22.6k|		psf_log_printf (psf, "%s", buffer) ;
 1248|  22.6k|		} ;
 1249|       |
 1250|  7.79k|	return 0 ;
 1251|  7.79k|} /* wavlike_read_peak_chunk */
wavlike.c:wavex_guid_equal:
  118|   114k|{	return !memcmp (first, second, sizeof (EXT_SUBFORMAT)) ;
  119|   114k|} /* wavex_guid_equal */
wavlike.c:exif_subchunk_parse:
 1293|  40.2k|{	uint32_t marker, dword = 0, vmajor = -1, vminor = -1, bytesread = 0 ;
 1294|  40.2k|	char buf [4096] ;
 1295|  40.2k|	int thisread ;
 1296|       |
 1297|   475k|	while (bytesread < length)
  ------------------
  |  Branch (1297:9): [True: 473k, False: 2.63k]
  ------------------
 1298|   473k|	{
 1299|   473k|		if ((thisread = psf_binheader_readf (psf, "m", &marker)) == 0)
  ------------------
  |  Branch (1299:7): [True: 131, False: 473k]
  ------------------
 1300|    131|			break ;
 1301|   473k|		bytesread += thisread ;
 1302|       |
 1303|   473k|		switch (marker)
 1304|   473k|		{
 1305|  61.1k|			case 0 : /* camera padding? */
  ------------------
  |  Branch (1305:4): [True: 61.1k, False: 411k]
  ------------------
 1306|  61.1k|				break ;
 1307|       |
 1308|  1.35k|			case ever_MARKER :
  ------------------
  |  |   59|  1.35k|#define ever_MARKER		MAKE_MARKER ('e', 'v', 'e', 'r')
  |  |  ------------------
  |  |  |  |  122|  1.35k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (1308:4): [True: 1.35k, False: 471k]
  ------------------
 1309|  1.35k|				bytesread += psf_binheader_readf (psf, "j4", 4, &dword) ;
 1310|  1.35k|				vmajor = 10 * (((dword >> 24) & 0xff) - '0') + (((dword >> 16) & 0xff) - '0') ;
 1311|  1.35k|				vminor = 10 * (((dword >> 8) & 0xff) - '0') + ((dword & 0xff) - '0') ;
 1312|  1.35k|				psf_log_printf (psf, "    EXIF Version : %u.%02u\n", vmajor, vminor) ;
 1313|  1.35k|				break ;
 1314|       |
 1315|  4.40k|			case olym_MARKER :
  ------------------
  |  |   66|  4.40k|#define olym_MARKER		MAKE_MARKER ('o', 'l', 'y', 'm')
  |  |  ------------------
  |  |  |  |  122|  4.40k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (1315:4): [True: 4.40k, False: 468k]
  ------------------
 1316|  4.40k|				bytesread += psf_binheader_readf (psf, "4", &dword) ;
 1317|  4.40k|				psf_log_printf (psf, "%M : %u\n", marker, dword) ;
 1318|  4.40k|				if (dword > length || bytesread + dword > length)
  ------------------
  |  Branch (1318:9): [True: 1.42k, False: 2.97k]
  |  Branch (1318:27): [True: 1.68k, False: 1.29k]
  ------------------
 1319|  3.11k|					break ;
 1320|  1.29k|				dword += (dword & 1) ;
 1321|  1.29k|				bytesread += psf_binheader_readf (psf, "j", dword) ;
 1322|  1.29k|				break ;
 1323|       |
 1324|  6.40k|			case emnt_MARKER : /* design information: null-terminated string */
  ------------------
  |  |   63|  6.40k|#define emnt_MARKER		MAKE_MARKER ('e', 'm', 'n', 't')
  |  |  ------------------
  |  |  |  |  122|  6.40k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (1324:4): [True: 6.40k, False: 466k]
  ------------------
 1325|  74.4k|			case emdl_MARKER : /* model name ; null-terminated string */
  ------------------
  |  |   62|  74.4k|#define emdl_MARKER		MAKE_MARKER ('e', 'm', 'd', 'l')
  |  |  ------------------
  |  |  |  |  122|  74.4k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (1325:4): [True: 68.0k, False: 405k]
  ------------------
 1326|  74.9k|			case ecor_MARKER : /* manufacturer: null-terminated string */
  ------------------
  |  |   61|  74.9k|#define ecor_MARKER		MAKE_MARKER ('e', 'c', 'o', 'r')
  |  |  ------------------
  |  |  |  |  122|  74.9k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (1326:4): [True: 511, False: 472k]
  ------------------
 1327|  75.4k|			case etim_MARKER : /* creation time: null-terminated string in the format "hour:minute:second.subsecond" */
  ------------------
  |  |   60|  75.4k|#define etim_MARKER		MAKE_MARKER ('e', 't', 'i', 'm')
  |  |  ------------------
  |  |  |  |  122|  75.4k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (1327:4): [True: 475, False: 472k]
  ------------------
 1328|  75.9k|			case erel_MARKER : /* relation info: null-terminated string (filename) */
  ------------------
  |  |   64|  75.9k|#define erel_MARKER		MAKE_MARKER ('e', 'r', 'e', 'l')
  |  |  ------------------
  |  |  |  |  122|  75.9k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (1328:4): [True: 568, False: 472k]
  ------------------
 1329|  76.3k|			case eucm_MARKER : /* user comment: 4-byte size follows, then possibly unicode data */
  ------------------
  |  |   65|  76.3k|#define eucm_MARKER		MAKE_MARKER ('e', 'u', 'c', 'm')
  |  |  ------------------
  |  |  |  |  122|  76.3k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (1329:4): [True: 333, False: 472k]
  ------------------
 1330|  76.3k|				bytesread += psf_binheader_readf (psf, "4", &dword) ;
 1331|  76.3k|				bytesread += sizeof (dword) ;
 1332|  76.3k|				dword += (dword & 1) ;
 1333|       |
 1334|  76.3k|				if (dword >= sizeof (buf))
  ------------------
  |  Branch (1334:9): [True: 36.1k, False: 40.2k]
  ------------------
 1335|  36.1k|				{	psf_log_printf (psf, "*** Marker '%M' is too big %u\n\n", marker, dword) ;
 1336|  36.1k|					return bytesread ;
 1337|  40.2k|					} ;
 1338|       |
 1339|  40.2k|				bytesread += exif_fill_and_sink (psf, buf, sizeof (buf), dword) ;
 1340|       |
 1341|       |				/* BAD - don't know what's going on here -- maybe a bug in the camera */
 1342|       |				/* field should be NULL-terminated but there's no room for it with the reported number */
 1343|       |				/*  example output:     emdl : 8 (EX-Z1050) */
 1344|  40.2k|				if (marker == emdl_MARKER && dword == strlen (buf) /* should be >= strlen+1*/)
  ------------------
  |  |   62|  40.2k|#define emdl_MARKER		MAKE_MARKER ('e', 'm', 'd', 'l')
  |  |  ------------------
  |  |  |  |  122|  80.4k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (1344:9): [True: 38.9k, False: 1.26k]
  |  Branch (1344:34): [True: 12.1k, False: 26.8k]
  ------------------
 1345|  12.1k|				{	psf_log_printf (psf, "    *** field size too small for string (sinking 2 bytes)\n") ;
 1346|  12.1k|					bytesread += psf_binheader_readf (psf, "j", 2) ;
 1347|  12.1k|					} ;
 1348|       |
 1349|  40.2k|				psf_log_printf (psf, "    %M : %u (%s)\n", marker, dword, buf) ;
 1350|  40.2k|				if (dword > length)
  ------------------
  |  Branch (1350:9): [True: 1.36k, False: 38.8k]
  ------------------
 1351|  1.36k|					return bytesread ;
 1352|  38.8k|				break ;
 1353|       |
 1354|   329k|			default :
  ------------------
  |  Branch (1354:4): [True: 329k, False: 143k]
  ------------------
 1355|   329k|				psf_log_printf (psf, "    *** %M (%u): -- ignored --\n", marker, marker) ;
 1356|   329k|				break ;
 1357|   473k|			} ;
 1358|   435k|		} ;
 1359|       |
 1360|  2.76k|	return bytesread ;
 1361|  40.2k|} /* exif_subchunk_parse */
wavlike.c:exif_fill_and_sink:
 1271|  40.2k|{
 1272|  40.2k|	size_t bytesread = 0 ;
 1273|       |
 1274|  40.2k|	buf [0] = 0 ;
 1275|  40.2k|	bufsz -= 1 ;
 1276|  40.2k|	if (toread < bufsz)
  ------------------
  |  Branch (1276:6): [True: 40.2k, False: 0]
  ------------------
 1277|  40.2k|		bufsz = toread ;
 1278|  40.2k|	bytesread = psf_binheader_readf (psf, "b", buf, bufsz) ;
 1279|  40.2k|	buf [bufsz] = 0 ;
 1280|       |
 1281|  40.2k|	if (bytesread == bufsz && toread > bufsz)
  ------------------
  |  Branch (1281:6): [True: 40.1k, False: 32]
  |  Branch (1281:28): [True: 0, False: 40.1k]
  ------------------
 1282|      0|		bytesread += psf_binheader_readf (psf, "j", toread - bufsz) ;
 1283|       |
 1284|  40.2k|	return bytesread ;
 1285|  40.2k|} /* exif_fill_and_sink */

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

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

