_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.6k, False: 2.92k]
  ------------------
  115|  14.6k|		 return -1 ;
  116|       |
  117|  2.92k|   if (sndfile_info->channels > 1024 * 1024)
  ------------------
  |  Branch (117:8): [True: 0, False: 2.92k]
  ------------------
  118|      0|		 return -1 ;
  119|       |
  120|  2.92k|   return 0;
  121|  2.92k|}
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|   400k|{
   20|   400k|  VIO_DATA *vf = (VIO_DATA *)user_data ;
   21|   400k|  sf_count_t new_offset ;
   22|       |
   23|   400k|  switch (whence)
   24|   400k|  {   case SEEK_SET :
  ------------------
  |  Branch (24:7): [True: 40.1k, False: 360k]
  ------------------
   25|  40.1k|        new_offset = offset ;
   26|  40.1k|        break ;
   27|       |
   28|   360k|    case SEEK_CUR :
  ------------------
  |  Branch (28:5): [True: 360k, False: 40.1k]
  ------------------
   29|   360k|        new_offset = vf->offset + offset ;
   30|   360k|        break ;
   31|       |
   32|      0|    case SEEK_END :
  ------------------
  |  Branch (32:5): [True: 0, False: 400k]
  ------------------
   33|      0|        new_offset = vf->length + offset ;
   34|      0|        break ;
   35|       |
   36|      0|    default :
  ------------------
  |  Branch (36:5): [True: 0, False: 400k]
  ------------------
   37|       |        // SEEK_DATA and SEEK_HOLE are not supported by this function.
   38|      0|        errno = EINVAL ;
   39|      0|        return -1 ;
   40|      0|        break ;
   41|   400k|  }
   42|       |
   43|       |  /* Ensure you can't seek outside the data */
   44|   400k|  if (new_offset > vf->length)
  ------------------
  |  Branch (44:7): [True: 2.91k, False: 397k]
  ------------------
   45|  2.91k|  {  /* Trying to seek past the end of the data */
   46|  2.91k|     printf("vf overseek: new_offset(%" PRId64 ") > vf->length(%" PRId64 ");"
   47|  2.91k|            "  whence(%d), vf->offset(%" PRId64 "), offset(%" PRId64 ")\n",
   48|  2.91k|            new_offset, vf->length, whence, vf->offset, offset) ;
   49|  2.91k|     new_offset = vf->length ;
   50|  2.91k|  }
   51|   397k|  else if (new_offset < 0)
  ------------------
  |  Branch (51:12): [True: 217k, False: 179k]
  ------------------
   52|   217k|  {  /* Trying to seek before the start of the data */
   53|   217k|     printf("vf underseek: new_offset(%" PRId64 ") < 0;  whence(%d), vf->offset"
   54|   217k|            "(%" PRId64 "), vf->length(%" PRId64 "), offset(%" PRId64 ")\n",
   55|   217k|            new_offset, whence, vf->offset, vf->length, offset) ;
   56|   217k|     new_offset = 0 ;
   57|   217k|  }
   58|   400k|  vf->offset = new_offset ;
   59|       |
   60|   400k|  return vf->offset ;
   61|   400k|}
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.90M, False: 5.67M]
  ------------------
   67|  7.90M|     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.32M|{ VIO_DATA *vf = (VIO_DATA *)user_data ;
   87|       |
   88|  2.32M|  return vf->offset ;
   89|  2.32M|}

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.6k, False: 2.92k]
  ------------------
   19|  14.6k|     goto EXIT_LABEL ;
   20|       |
   21|       |   // Just the right number of channels. Create some buffer space for reading.
   22|  2.92k|   read_buffer = (float*)malloc(sizeof(float) * sndfile_info.channels);
   23|  2.92k|   if (read_buffer == NULL)
  ------------------
  |  Branch (23:8): [True: 0, False: 2.92k]
  ------------------
   24|      0|     abort() ;
   25|       |
   26|   168M|   while (sf_readf_float(sndfile, read_buffer, 1))
  ------------------
  |  Branch (26:11): [True: 168M, False: 2.92k]
  ------------------
   27|   168M|   {
   28|       |     // Do nothing with the data.
   29|   168M|   }
   30|       |
   31|  17.5k|EXIT_LABEL:
   32|       |
   33|  17.5k|   if (sndfile != NULL)
  ------------------
  |  Branch (33:8): [True: 2.92k, False: 14.6k]
  ------------------
   34|  2.92k|     sf_close(sndfile) ;
   35|       |
   36|  17.5k|   free(read_buffer) ;
   37|       |
   38|  17.5k|   return 0 ;
   39|  2.92k|}

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

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

alac_decoder_init:
   61|    948|{
   62|    948|	int32_t		status = ALAC_noErr ;
   63|    948|	ALACSpecificConfig theConfig ;
   64|    948|	uint8_t * theActualCookie = (uint8_t *) inMagicCookie ;
   65|    948|	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|    948|	if (theActualCookie [4] == 'f' && theActualCookie [5] == 'r' && theActualCookie [6] == 'm' && theActualCookie [7] == 'a')
  ------------------
  |  Branch (74:6): [True: 8, False: 940]
  |  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|    948|	if (theActualCookie [4] == 'a' && theActualCookie [5] == 'l' && theActualCookie [6] == 'a' && theActualCookie [7] == 'c')
  ------------------
  |  Branch (81:6): [True: 11, False: 937]
  |  Branch (81:36): [True: 6, False: 5]
  |  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|    948|	if (theCookieBytesRemaining >= sizeof (ALACSpecificConfig))
  ------------------
  |  Branch (88:6): [True: 888, False: 60]
  ------------------
   89|    888|	{
   90|    888|		theConfig.frameLength = psf_get_be32 (theActualCookie, offsetof (ALACSpecificConfig, frameLength)) ;
   91|       |
   92|    888|		if (theConfig.frameLength > ALAC_FRAME_LENGTH)
  ------------------
  |  |   33|    888|#define		ALAC_FRAME_LENGTH	4096
  ------------------
  |  Branch (92:7): [True: 34, False: 854]
  ------------------
   93|     34|			return fALAC_FrameLengthError ;
   94|       |
   95|    854|		theConfig.compatibleVersion = theActualCookie [offsetof (ALACSpecificConfig, compatibleVersion)] ;
   96|    854|		theConfig.bitDepth = theActualCookie [offsetof (ALACSpecificConfig, bitDepth)] ;
   97|    854|		theConfig.pb = theActualCookie [offsetof (ALACSpecificConfig, pb)] ;
   98|    854|		theConfig.mb = theActualCookie [offsetof (ALACSpecificConfig, mb)] ;
   99|    854|		theConfig.kb = theActualCookie [offsetof (ALACSpecificConfig, kb)] ;
  100|    854|		theConfig.numChannels = theActualCookie [offsetof (ALACSpecificConfig, numChannels)] ;
  101|    854|		theConfig.maxRun = psf_get_be16 (theActualCookie, offsetof (ALACSpecificConfig, maxRun)) ;
  102|    854|		theConfig.maxFrameBytes = psf_get_be32 (theActualCookie, offsetof (ALACSpecificConfig, maxFrameBytes)) ;
  103|    854|		theConfig.avgBitRate = psf_get_be32 (theActualCookie, offsetof (ALACSpecificConfig, avgBitRate)) ;
  104|    854|		theConfig.sampleRate = psf_get_be32 (theActualCookie, offsetof (ALACSpecificConfig, sampleRate)) ;
  105|       |
  106|    854|		p->mConfig = theConfig ;
  107|    854|		p->mNumChannels = theConfig.numChannels ;
  108|       |
  109|    854|		RequireAction (p->mConfig.compatibleVersion <= kALACVersion, return kALAC_IncompatibleVersion ;) ;
  ------------------
  |  |   39|    854|#define RequireAction(condition, action)		if (! (condition)) { action }
  |  |  ------------------
  |  |  |  Branch (39:47): [True: 8, False: 846]
  |  |  ------------------
  ------------------
  110|    846|		RequireAction ((p->mConfig.bitDepth >= 8 && p->mConfig.bitDepth <= 32), return kALAC_BadBitWidth ;) ;
  ------------------
  |  |   39|  1.68k|#define RequireAction(condition, action)		if (! (condition)) { action }
  |  |  ------------------
  |  |  |  Branch (39:50): [True: 840, False: 6]
  |  |  |  Branch (39:50): [True: 837, False: 3]
  |  |  ------------------
  ------------------
  111|    837|		RequireAction ((p->mMixBufferU != NULL) && (p->mMixBufferV != NULL) && (p->u.mPredictor != NULL),
  ------------------
  |  |   39|  3.34k|#define RequireAction(condition, action)		if (! (condition)) { action }
  |  |  ------------------
  |  |  |  Branch (39:50): [True: 837, False: 0]
  |  |  |  Branch (39:50): [True: 837, False: 0]
  |  |  |  Branch (39:50): [True: 837, False: 0]
  |  |  ------------------
  ------------------
  112|    837|						status = kALAC_MemFullError ; goto Exit ;) ;
  113|    837|	}
  114|     60|	else
  115|     60|	{
  116|     60|		status = kALAC_BadSpecificConfigSize ;
  117|     60|	}
  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|    897|Exit:
  126|    897|	return status ;
  127|    948|}
alac_decode:
  136|  27.3k|{
  137|  27.3k|	BitBuffer		shiftBits ;
  138|  27.3k|	uint32_t		bits1, bits2 ;
  139|  27.3k|	uint8_t			tag ;
  140|  27.3k|	uint8_t			elementInstanceTag ;
  141|  27.3k|	AGParamRec		agParams ;
  142|  27.3k|	uint32_t		channelIndex ;
  143|  27.3k|	int16_t			coefsU [32] ;		// max possible size is 32 although NUMCOEPAIRS is the current limit
  144|  27.3k|	int16_t			coefsV [32] ;
  145|  27.3k|	uint8_t			numU, numV ;
  146|  27.3k|	uint8_t			mixBits ;
  147|  27.3k|	int8_t			mixRes ;
  148|  27.3k|	uint16_t		unusedHeader ;
  149|  27.3k|	uint8_t			escapeFlag ;
  150|  27.3k|	uint32_t		chanBits ;
  151|  27.3k|	uint8_t			bytesShifted ;
  152|  27.3k|	uint32_t		shift ;
  153|  27.3k|	uint8_t			modeU, modeV ;
  154|  27.3k|	uint32_t		denShiftU, denShiftV ;
  155|  27.3k|	uint16_t		pbFactorU, pbFactorV ;
  156|  27.3k|	uint16_t		pb ;
  157|  27.3k|	int32_t *		out32 ;
  158|  27.3k|	uint8_t			headerByte ;
  159|  27.3k|	uint8_t			partialFrame ;
  160|  27.3k|	uint32_t		extraBits ;
  161|  27.3k|	int32_t			val ;
  162|  27.3k|	uint32_t		i, j ;
  163|  27.3k|	int32_t			status ;
  164|  27.3k|	uint32_t		numChannels = p->mNumChannels ;
  165|       |
  166|  27.3k|	RequireAction ((bits != NULL) && (sampleBuffer != NULL) && (outNumSamples != NULL), return kALAC_ParamError ;) ;
  ------------------
  |  |   39|   109k|#define RequireAction(condition, action)		if (! (condition)) { action }
  |  |  ------------------
  |  |  |  Branch (39:50): [True: 27.3k, False: 0]
  |  |  |  Branch (39:50): [True: 27.3k, False: 0]
  |  |  |  Branch (39:50): [True: 27.3k, False: 0]
  |  |  ------------------
  ------------------
  167|  27.3k|	RequireAction (p->mNumChannels > 0, return kALAC_ZeroChannelCount ;) ;
  ------------------
  |  |   39|  27.3k|#define RequireAction(condition, action)		if (! (condition)) { action }
  |  |  ------------------
  |  |  |  Branch (39:47): [True: 1, False: 27.3k]
  |  |  ------------------
  ------------------
  168|       |
  169|  27.3k|	p->mActiveElements = 0 ;
  170|  27.3k|	channelIndex	= 0 ;
  171|       |
  172|  27.3k|	status = ALAC_noErr ;
  173|  27.3k|	*outNumSamples = numSamples ;
  174|       |
  175|  55.7k|	while (status == ALAC_noErr)
  ------------------
  |  Branch (175:9): [True: 52.8k, False: 2.90k]
  ------------------
  176|  52.8k|	{
  177|       |		// bail if we ran off the end of the buffer
  178|  52.8k|		RequireAction (bits->cur < bits->end, status = kALAC_ParamError ; goto Exit ;) ;
  ------------------
  |  |   39|  52.8k|#define RequireAction(condition, action)		if (! (condition)) { action }
  |  |  ------------------
  |  |  |  Branch (39:47): [True: 4.22k, False: 48.6k]
  |  |  ------------------
  ------------------
  179|       |
  180|       |		// copy global decode params for this element
  181|  48.6k|		pb = p->mConfig.pb ;
  182|       |
  183|       |		// read element tag
  184|  48.6k|		tag = BitBufferReadSmall (bits, 3) ;
  185|  48.6k|		switch (tag)
  ------------------
  |  Branch (185:11): [True: 48.6k, False: 0]
  ------------------
  186|  48.6k|		{
  187|  31.7k|			case ID_SCE:
  ------------------
  |  Branch (187:4): [True: 31.7k, False: 16.9k]
  ------------------
  188|  33.2k|			case ID_LFE:
  ------------------
  |  Branch (188:4): [True: 1.49k, False: 47.1k]
  ------------------
  189|  33.2k|			{
  190|       |				// mono/LFE channel
  191|  33.2k|				elementInstanceTag = BitBufferReadSmall (bits, 4) ;
  192|  33.2k|				p->mActiveElements |= (1u << elementInstanceTag) ;
  193|       |
  194|       |				// read the 12 unused header bits
  195|  33.2k|				unusedHeader = (uint16_t) BitBufferRead (bits, 12) ;
  196|  33.2k|				RequireAction (unusedHeader == 0, status = kALAC_ParamError ; goto Exit ;) ;
  ------------------
  |  |   39|  33.2k|#define RequireAction(condition, action)		if (! (condition)) { action }
  |  |  ------------------
  |  |  |  Branch (39:47): [True: 10.6k, False: 22.5k]
  |  |  ------------------
  ------------------
  197|       |
  198|       |				// read the 1-bit "partial frame" flag, 2-bit "shift-off" flag & 1-bit "escape" flag
  199|  22.5k|				headerByte = (uint8_t) BitBufferRead (bits, 4) ;
  200|       |
  201|  22.5k|				partialFrame = headerByte >> 3 ;
  202|       |
  203|  22.5k|				bytesShifted = (headerByte >> 1) & 0x3u ;
  204|  22.5k|				RequireAction (bytesShifted != 3, status = kALAC_ParamError ; goto Exit ;) ;
  ------------------
  |  |   39|  22.5k|#define RequireAction(condition, action)		if (! (condition)) { action }
  |  |  ------------------
  |  |  |  Branch (39:47): [True: 259, False: 22.2k]
  |  |  ------------------
  ------------------
  205|       |
  206|  22.2k|				shift = bytesShifted * 8 ;
  207|       |
  208|  22.2k|				escapeFlag = headerByte & 0x1 ;
  209|       |
  210|  22.2k|				chanBits = p->mConfig.bitDepth - (bytesShifted * 8) ;
  211|       |
  212|       |				// check for partial frame to override requested numSamples
  213|  22.2k|				if (partialFrame != 0)
  ------------------
  |  Branch (213:9): [True: 2.37k, False: 19.9k]
  ------------------
  214|  2.37k|				{
  215|  2.37k|					numSamples = BitBufferRead (bits, 16) << 16 ;
  216|  2.37k|					numSamples |= BitBufferRead (bits, 16) ;
  217|       |
  218|  2.37k|					RequireAction (numSamples < kALACDefaultFramesPerPacket, return kALAC_NumSamplesTooBig ;) ;
  ------------------
  |  |   39|  2.37k|#define RequireAction(condition, action)		if (! (condition)) { action }
  |  |  ------------------
  |  |  |  Branch (39:47): [True: 320, False: 2.05k]
  |  |  ------------------
  ------------------
  219|  2.05k|				}
  220|       |
  221|  21.9k|				if (escapeFlag == 0)
  ------------------
  |  Branch (221:9): [True: 19.2k, False: 2.69k]
  ------------------
  222|  19.2k|				{
  223|       |					// compressed frame, read rest of parameters
  224|  19.2k|					mixBits	= (uint8_t) BitBufferRead (bits, 8) ;
  225|  19.2k|					mixRes	= (int8_t) BitBufferRead (bits, 8) ;
  226|       |					//Assert ((mixBits == 0) && (mixRes == 0)) ;		// no mixing for mono
  227|       |
  228|  19.2k|					headerByte	= (uint8_t) BitBufferRead (bits, 8) ;
  229|  19.2k|					modeU		= headerByte >> 4 ;
  230|  19.2k|					denShiftU	= headerByte & 0xfu ;
  231|       |
  232|  19.2k|					headerByte	= (uint8_t) BitBufferRead (bits, 8) ;
  233|  19.2k|					pbFactorU	= headerByte >> 5 ;
  234|  19.2k|					numU		= headerByte & 0x1fu ;
  235|       |
  236|  72.1k|					for (i = 0 ; i < numU ; i++)
  ------------------
  |  Branch (236:19): [True: 52.8k, False: 19.2k]
  ------------------
  237|  52.8k|						coefsU [i] = (int16_t) BitBufferRead (bits, 16) ;
  238|       |
  239|       |					// if shift active, skip the shift buffer but remember where it starts
  240|  19.2k|					if (bytesShifted != 0)
  ------------------
  |  Branch (240:10): [True: 4.03k, False: 15.2k]
  ------------------
  241|  4.03k|					{
  242|  4.03k|						shiftBits = *bits ;
  243|  4.03k|						BitBufferAdvance (bits, (bytesShifted * 8) * numSamples) ;
  244|  4.03k|					}
  245|       |
  246|       |					// decompress
  247|  19.2k|					set_ag_params (&agParams, p->mConfig.mb, (pb * pbFactorU) / 4, p->mConfig.kb, numSamples, numSamples, p->mConfig.maxRun) ;
  248|  19.2k|					status = dyn_decomp (&agParams, bits, p->u.mPredictor, numSamples, chanBits, &bits1) ;
  249|  19.2k|					RequireNoErr (status, goto Exit ;) ;
  ------------------
  |  |   41|  19.2k|#define RequireNoErr(condition, action)			if (condition) { action }
  |  |  ------------------
  |  |  |  Branch (41:47): [True: 3.07k, False: 16.2k]
  |  |  ------------------
  ------------------
  250|       |
  251|  16.2k|					if (modeU == 0)
  ------------------
  |  Branch (251:10): [True: 12.7k, False: 3.41k]
  ------------------
  252|  12.7k|					{
  253|  12.7k|						unpc_block (p->u.mPredictor, p->mMixBufferU, numSamples, &coefsU [0], numU, chanBits, denShiftU) ;
  254|  12.7k|					}
  255|  3.41k|					else
  256|  3.41k|					{
  257|       |						// the special "numActive == 31" mode can be done in-place
  258|  3.41k|						unpc_block (p->u.mPredictor, p->u.mPredictor, numSamples, NULL, 31, chanBits, 0) ;
  259|  3.41k|						unpc_block (p->u.mPredictor, p->mMixBufferU, numSamples, &coefsU [0], numU, chanBits, denShiftU) ;
  260|  3.41k|					}
  261|  16.2k|				}
  262|  2.69k|				else
  263|  2.69k|				{
  264|       |					//Assert (bytesShifted == 0) ;
  265|       |
  266|       |					// uncompressed frame, copy data into the mix buffer to use common output code
  267|  2.69k|					shift = 32 - chanBits ;
  268|  2.69k|					if (chanBits <= 16)
  ------------------
  |  Branch (268:10): [True: 1.65k, False: 1.03k]
  ------------------
  269|  1.65k|					{
  270|   409k|						for (i = 0 ; i < numSamples ; i++)
  ------------------
  |  Branch (270:20): [True: 408k, False: 1.65k]
  ------------------
  271|   408k|						{
  272|   408k|							val = (int32_t) BitBufferRead (bits, (uint8_t) chanBits) ;
  273|   408k|							val = (val << shift) >> shift ;
  274|   408k|							p->mMixBufferU [i] = val ;
  275|   408k|						}
  276|  1.65k|					}
  277|  1.03k|					else
  278|  1.03k|					{
  279|       |						// BitBufferRead () can't read more than 16 bits at a time so break up the reads
  280|  1.03k|						extraBits = chanBits - 16 ;
  281|   602k|						for (i = 0 ; i < numSamples ; i++)
  ------------------
  |  Branch (281:20): [True: 601k, False: 1.03k]
  ------------------
  282|   601k|						{
  283|   601k|							val = (int32_t) BitBufferRead (bits, 16) ;
  284|   601k|							val = arith_shift_left (val, 16) >> shift ;
  285|   601k|							p->mMixBufferU [i] = val | BitBufferRead (bits, (uint8_t) extraBits) ;
  286|   601k|						}
  287|  1.03k|					}
  288|       |
  289|  2.69k|					mixBits = mixRes = 0 ;
  290|  2.69k|					bits1 = chanBits * numSamples ;
  291|  2.69k|					bytesShifted = 0 ;
  292|  2.69k|				}
  293|       |
  294|       |				// now read the shifted values into the shift buffer
  295|  18.8k|				if (bytesShifted != 0)
  ------------------
  |  Branch (295:9): [True: 3.56k, False: 15.3k]
  ------------------
  296|  3.56k|				{
  297|  3.56k|					shift = bytesShifted * 8 ;
  298|       |					//Assert (shift <= 16) ;
  299|       |
  300|  12.1k|					for (i = 0 ; i < numSamples ; i++)
  ------------------
  |  Branch (300:19): [True: 8.54k, False: 3.56k]
  ------------------
  301|  8.54k|						p->u.mShiftBuffer [i] = (uint16_t) BitBufferRead (&shiftBits, (uint8_t) shift) ;
  302|  3.56k|				}
  303|       |
  304|       |				// convert 32-bit integers into output buffer
  305|  18.8k|				switch (p->mConfig.bitDepth)
  ------------------
  |  Branch (305:13): [True: 17.2k, False: 1.61k]
  ------------------
  306|  18.8k|				{
  307|  2.71k|					case 16:
  ------------------
  |  Branch (307:6): [True: 2.71k, False: 16.1k]
  ------------------
  308|  2.71k|						out32 = sampleBuffer + channelIndex ;
  309|  78.3k|						for (i = 0, j = 0 ; i < numSamples ; i++, j += numChannels)
  ------------------
  |  Branch (309:27): [True: 75.6k, False: 2.71k]
  ------------------
  310|  75.6k|							out32 [j] = arith_shift_left (p->mMixBufferU [i], 16) ;
  311|  2.71k|						break ;
  312|  1.91k|					case 20:
  ------------------
  |  Branch (312:6): [True: 1.91k, False: 16.9k]
  ------------------
  313|  1.91k|						out32 = sampleBuffer + channelIndex ;
  314|  1.91k|						copyPredictorTo20 (p->mMixBufferU, out32, numChannels, numSamples) ;
  315|  1.91k|						break ;
  316|  5.98k|					case 24:
  ------------------
  |  Branch (316:6): [True: 5.98k, False: 12.9k]
  ------------------
  317|  5.98k|						out32 = sampleBuffer + channelIndex ;
  318|  5.98k|						if (bytesShifted != 0)
  ------------------
  |  Branch (318:11): [True: 1.33k, False: 4.65k]
  ------------------
  319|  1.33k|							copyPredictorTo24Shift (p->mMixBufferU, p->u.mShiftBuffer, out32, numChannels, numSamples, bytesShifted) ;
  320|  4.65k|						else
  321|  4.65k|							copyPredictorTo24 (p->mMixBufferU, out32, numChannels, numSamples) ;
  322|  5.98k|						break ;
  323|  6.66k|					case 32:
  ------------------
  |  Branch (323:6): [True: 6.66k, False: 12.2k]
  ------------------
  324|  6.66k|						out32 = sampleBuffer + channelIndex ;
  325|  6.66k|						if (bytesShifted != 0)
  ------------------
  |  Branch (325:11): [True: 1.29k, False: 5.36k]
  ------------------
  326|  1.29k|							copyPredictorTo32Shift (p->mMixBufferU, p->u.mShiftBuffer, out32, numChannels, numSamples, bytesShifted) ;
  327|  5.36k|						else
  328|  5.36k|							copyPredictorTo32 (p->mMixBufferU, out32, numChannels, numSamples) ;
  329|  6.66k|						break ;
  330|  18.8k|				}
  331|       |
  332|  18.8k|				channelIndex += 1 ;
  333|  18.8k|				*outNumSamples = numSamples ;
  334|  18.8k|				break ;
  335|  18.8k|			}
  336|       |
  337|  9.18k|			case ID_CPE:
  ------------------
  |  Branch (337:4): [True: 9.18k, False: 39.4k]
  ------------------
  338|  9.18k|			{
  339|       |				// if decoding this pair would take us over the max channels limit, bail
  340|  9.18k|				if ((channelIndex + 2) > numChannels)
  ------------------
  |  Branch (340:9): [True: 354, False: 8.83k]
  ------------------
  341|    354|					goto NoMoreChannels ;
  342|       |
  343|       |				// stereo channel pair
  344|  8.83k|				elementInstanceTag = BitBufferReadSmall (bits, 4) ;
  345|  8.83k|				p->mActiveElements |= (1u << elementInstanceTag) ;
  346|       |
  347|       |				// read the 12 unused header bits
  348|  8.83k|				unusedHeader = (uint16_t) BitBufferRead (bits, 12) ;
  349|  8.83k|				RequireAction (unusedHeader == 0, status = kALAC_ParamError ; goto Exit ;) ;
  ------------------
  |  |   39|  8.83k|#define RequireAction(condition, action)		if (! (condition)) { action }
  |  |  ------------------
  |  |  |  Branch (39:47): [True: 1.86k, False: 6.97k]
  |  |  ------------------
  ------------------
  350|       |
  351|       |				// read the 1-bit "partial frame" flag, 2-bit "shift-off" flag & 1-bit "escape" flag
  352|  6.97k|				headerByte = (uint8_t) BitBufferRead (bits, 4) ;
  353|       |
  354|  6.97k|				partialFrame = headerByte >> 3 ;
  355|       |
  356|  6.97k|				bytesShifted = (headerByte >> 1) & 0x3u ;
  357|  6.97k|				RequireAction (bytesShifted != 3, status = kALAC_ParamError ; goto Exit ;) ;
  ------------------
  |  |   39|  6.97k|#define RequireAction(condition, action)		if (! (condition)) { action }
  |  |  ------------------
  |  |  |  Branch (39:47): [True: 277, False: 6.69k]
  |  |  ------------------
  ------------------
  358|       |
  359|  6.69k|				shift = bytesShifted * 8 ;
  360|       |
  361|  6.69k|				escapeFlag = headerByte & 0x1 ;
  362|       |
  363|  6.69k|				chanBits = p->mConfig.bitDepth - (bytesShifted * 8) + 1 ;
  364|       |
  365|       |				// check for partial frame length to override requested numSamples
  366|  6.69k|				if (partialFrame != 0)
  ------------------
  |  Branch (366:9): [True: 3.26k, False: 3.42k]
  ------------------
  367|  3.26k|				{
  368|  3.26k|					numSamples = BitBufferRead (bits, 16) << 16 ;
  369|  3.26k|					numSamples |= BitBufferRead (bits, 16) ;
  370|       |
  371|  3.26k|					RequireAction (numSamples < kALACDefaultFramesPerPacket, return kALAC_NumSamplesTooBig ;) ;
  ------------------
  |  |   39|  3.26k|#define RequireAction(condition, action)		if (! (condition)) { action }
  |  |  ------------------
  |  |  |  Branch (39:47): [True: 241, False: 3.02k]
  |  |  ------------------
  ------------------
  372|  3.02k|				}
  373|       |
  374|  6.45k|				if (escapeFlag == 0)
  ------------------
  |  Branch (374:9): [True: 4.17k, False: 2.27k]
  ------------------
  375|  4.17k|				{
  376|       |					// compressed frame, read rest of parameters
  377|  4.17k|					mixBits		= (uint8_t) BitBufferRead (bits, 8) ;
  378|  4.17k|					mixRes		= (int8_t) BitBufferRead (bits, 8) ;
  379|       |
  380|  4.17k|					headerByte	= (uint8_t) BitBufferRead (bits, 8) ;
  381|  4.17k|					modeU		= headerByte >> 4 ;
  382|  4.17k|					denShiftU	= headerByte & 0xfu ;
  383|       |
  384|  4.17k|					headerByte	= (uint8_t) BitBufferRead (bits, 8) ;
  385|  4.17k|					pbFactorU	= headerByte >> 5 ;
  386|  4.17k|					numU		= headerByte & 0x1fu ;
  387|  18.0k|					for (i = 0 ; i < numU ; i++)
  ------------------
  |  Branch (387:19): [True: 13.8k, False: 4.17k]
  ------------------
  388|  13.8k|						coefsU [i] = (int16_t) BitBufferRead (bits, 16) ;
  389|       |
  390|  4.17k|					headerByte	= (uint8_t) BitBufferRead (bits, 8) ;
  391|  4.17k|					modeV		= headerByte >> 4 ;
  392|  4.17k|					denShiftV	= headerByte & 0xfu ;
  393|       |
  394|  4.17k|					headerByte	= (uint8_t) BitBufferRead (bits, 8) ;
  395|  4.17k|					pbFactorV	= headerByte >> 5 ;
  396|  4.17k|					numV		= headerByte & 0x1fu ;
  397|  16.8k|					for (i = 0 ; i < numV ; i++)
  ------------------
  |  Branch (397:19): [True: 12.6k, False: 4.17k]
  ------------------
  398|  12.6k|						coefsV [i] = (int16_t) BitBufferRead (bits, 16) ;
  399|       |
  400|       |					// if shift active, skip the interleaved shifted values but remember where they start
  401|  4.17k|					if (bytesShifted != 0)
  ------------------
  |  Branch (401:10): [True: 663, False: 3.51k]
  ------------------
  402|    663|					{
  403|    663|						shiftBits = *bits ;
  404|    663|						BitBufferAdvance (bits, (bytesShifted * 8) * 2 * numSamples) ;
  405|    663|					}
  406|       |
  407|       |					// decompress and run predictor for "left" channel
  408|  4.17k|					set_ag_params (&agParams, p->mConfig.mb, (pb * pbFactorU) / 4, p->mConfig.kb, numSamples, numSamples, p->mConfig.maxRun) ;
  409|  4.17k|					status = dyn_decomp (&agParams, bits, p->u.mPredictor, numSamples, chanBits, &bits1) ;
  410|  4.17k|					RequireNoErr (status, goto Exit ;) ;
  ------------------
  |  |   41|  4.17k|#define RequireNoErr(condition, action)			if (condition) { action }
  |  |  ------------------
  |  |  |  Branch (41:47): [True: 978, False: 3.19k]
  |  |  ------------------
  ------------------
  411|       |
  412|  3.19k|					if (modeU == 0)
  ------------------
  |  Branch (412:10): [True: 2.43k, False: 762]
  ------------------
  413|  2.43k|					{
  414|  2.43k|						unpc_block (p->u.mPredictor, p->mMixBufferU, numSamples, &coefsU [0], numU, chanBits, denShiftU) ;
  415|  2.43k|					}
  416|    762|					else
  417|    762|					{
  418|       |						// the special "numActive == 31" mode can be done in-place
  419|    762|						unpc_block (p->u.mPredictor, p->u.mPredictor, numSamples, NULL, 31, chanBits, 0) ;
  420|    762|						unpc_block (p->u.mPredictor, p->mMixBufferU, numSamples, &coefsU [0], numU, chanBits, denShiftU) ;
  421|    762|					}
  422|       |
  423|       |					// decompress and run predictor for "right" channel
  424|  3.19k|					set_ag_params (&agParams, p->mConfig.mb, (pb * pbFactorV) / 4, p->mConfig.kb, numSamples, numSamples, p->mConfig.maxRun) ;
  425|  3.19k|					status = dyn_decomp (&agParams, bits, p->u.mPredictor, numSamples, chanBits, &bits2) ;
  426|  3.19k|					RequireNoErr (status, goto Exit ;) ;
  ------------------
  |  |   41|  3.19k|#define RequireNoErr(condition, action)			if (condition) { action }
  |  |  ------------------
  |  |  |  Branch (41:47): [True: 237, False: 2.96k]
  |  |  ------------------
  ------------------
  427|       |
  428|  2.96k|					if (modeV == 0)
  ------------------
  |  Branch (428:10): [True: 1.39k, False: 1.57k]
  ------------------
  429|  1.39k|					{
  430|  1.39k|						unpc_block (p->u.mPredictor, p->mMixBufferV, numSamples, &coefsV [0], numV, chanBits, denShiftV) ;
  431|  1.39k|					}
  432|  1.57k|					else
  433|  1.57k|					{
  434|       |						// the special "numActive == 31" mode can be done in-place
  435|  1.57k|						unpc_block (p->u.mPredictor, p->u.mPredictor, numSamples, NULL, 31, chanBits, 0) ;
  436|  1.57k|						unpc_block (p->u.mPredictor, p->mMixBufferV, numSamples, &coefsV [0], numV, chanBits, denShiftV) ;
  437|  1.57k|					}
  438|  2.96k|				}
  439|  2.27k|				else
  440|  2.27k|				{
  441|       |					//Assert (bytesShifted == 0) ;
  442|       |
  443|       |					// uncompressed frame, copy data into the mix buffers to use common output code
  444|  2.27k|					chanBits = p->mConfig.bitDepth ;
  445|  2.27k|					shift = 32 - chanBits ;
  446|  2.27k|					if (chanBits <= 16)
  ------------------
  |  Branch (446:10): [True: 586, False: 1.68k]
  ------------------
  447|    586|					{
  448|  28.9k|						for (i = 0 ; i < numSamples ; i++)
  ------------------
  |  Branch (448:20): [True: 28.3k, False: 586]
  ------------------
  449|  28.3k|						{
  450|  28.3k|							val = (int32_t) BitBufferRead (bits, (uint8_t) chanBits) ;
  451|  28.3k|							val = (val << shift) >> shift ;
  452|  28.3k|							p->mMixBufferU [i] = val ;
  453|       |
  454|  28.3k|							val = (int32_t) BitBufferRead (bits, (uint8_t) chanBits) ;
  455|  28.3k|							val = (val << shift) >> shift ;
  456|  28.3k|							p->mMixBufferV [i] = val ;
  457|  28.3k|						}
  458|    586|					}
  459|  1.68k|					else
  460|  1.68k|					{
  461|       |						// BitBufferRead () can't read more than 16 bits at a time so break up the reads
  462|  1.68k|						extraBits = chanBits - 16 ;
  463|   108k|						for (i = 0 ; i < numSamples ; i++)
  ------------------
  |  Branch (463:20): [True: 106k, False: 1.68k]
  ------------------
  464|   106k|						{
  465|   106k|							val = (int32_t) BitBufferRead (bits, 16) ;
  466|   106k|							val = (((uint32_t) val) << 16) >> shift ;
  467|   106k|							p->mMixBufferU [i] = val | BitBufferRead (bits, (uint8_t) extraBits) ;
  468|       |
  469|   106k|							val = (int32_t) BitBufferRead (bits, 16) ;
  470|   106k|							val = ((uint32_t) val) >> shift ;
  471|   106k|							p->mMixBufferV [i] = val | BitBufferRead (bits, (uint8_t) extraBits) ;
  472|   106k|						}
  473|  1.68k|					}
  474|       |
  475|  2.27k|					bits1 = chanBits * numSamples ;
  476|  2.27k|					bits2 = chanBits * numSamples ;
  477|  2.27k|					mixBits = mixRes = 0 ;
  478|  2.27k|					bytesShifted = 0 ;
  479|  2.27k|				}
  480|       |
  481|       |				// now read the shifted values into the shift buffer
  482|  5.23k|				if (bytesShifted != 0)
  ------------------
  |  Branch (482:9): [True: 428, False: 4.80k]
  ------------------
  483|    428|				{
  484|    428|					shift = bytesShifted * 8 ;
  485|       |					//Assert (shift <= 16) ;
  486|       |
  487|  2.45k|					for (i = 0 ; i < (numSamples * 2) ; i += 2)
  ------------------
  |  Branch (487:19): [True: 2.02k, False: 428]
  ------------------
  488|  2.02k|					{
  489|  2.02k|						p->u.mShiftBuffer [i + 0] = (uint16_t) BitBufferRead (&shiftBits, (uint8_t) shift) ;
  490|  2.02k|						p->u.mShiftBuffer [i + 1] = (uint16_t) BitBufferRead (&shiftBits, (uint8_t) shift) ;
  491|  2.02k|					}
  492|    428|				}
  493|       |
  494|       |				// un-mix the data and convert to output format
  495|       |				// - note that mixRes = 0 means just interleave so we use that path for uncompressed frames
  496|  5.23k|				switch (p->mConfig.bitDepth)
  ------------------
  |  Branch (496:13): [True: 4.97k, False: 267]
  ------------------
  497|  5.23k|				{
  498|  1.29k|					case 16:
  ------------------
  |  Branch (498:6): [True: 1.29k, False: 3.93k]
  ------------------
  499|  1.29k|						out32 = sampleBuffer + channelIndex ;
  500|  1.29k|						unmix16 (p->mMixBufferU, p->mMixBufferV, out32, numChannels, numSamples, mixBits, mixRes) ;
  501|  1.29k|						break ;
  502|    847|					case 20:
  ------------------
  |  Branch (502:6): [True: 847, False: 4.39k]
  ------------------
  503|    847|						out32 = sampleBuffer + channelIndex ;
  504|    847|						unmix20 (p->mMixBufferU, p->mMixBufferV, out32, numChannels, numSamples, mixBits, mixRes) ;
  505|    847|						break ;
  506|  1.57k|					case 24:
  ------------------
  |  Branch (506:6): [True: 1.57k, False: 3.65k]
  ------------------
  507|  1.57k|						out32 = sampleBuffer + channelIndex ;
  508|  1.57k|						unmix24 (p->mMixBufferU, p->mMixBufferV, out32, numChannels, numSamples,
  509|  1.57k|									mixBits, mixRes, p->u.mShiftBuffer, bytesShifted) ;
  510|  1.57k|						break ;
  511|  1.24k|					case 32:
  ------------------
  |  Branch (511:6): [True: 1.24k, False: 3.99k]
  ------------------
  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|  5.23k|				}
  517|       |
  518|  5.23k|				channelIndex += 2 ;
  519|  5.23k|				*outNumSamples = numSamples ;
  520|  5.23k|				break ;
  521|  5.23k|			}
  522|       |
  523|  1.02k|			case ID_CCE:
  ------------------
  |  Branch (523:4): [True: 1.02k, False: 47.6k]
  ------------------
  524|  1.52k|			case ID_PCE:
  ------------------
  |  Branch (524:4): [True: 498, False: 48.1k]
  ------------------
  525|  1.52k|			{
  526|       |				// unsupported element, bail
  527|       |				//AssertNoErr (tag) ;
  528|  1.52k|				status = kALAC_UnsupportedElement ;
  529|  1.52k|				break ;
  530|  1.02k|			}
  531|       |
  532|  1.80k|			case ID_DSE:
  ------------------
  |  Branch (532:4): [True: 1.80k, False: 46.8k]
  ------------------
  533|  1.80k|			{
  534|       |				// data stream element -- parse but ignore
  535|  1.80k|				status = alac_data_stream_element (bits) ;
  536|  1.80k|				break ;
  537|  1.02k|			}
  538|       |
  539|  1.37k|			case ID_FIL:
  ------------------
  |  Branch (539:4): [True: 1.37k, False: 47.2k]
  ------------------
  540|  1.37k|			{
  541|       |				// fill element -- parse but ignore
  542|  1.37k|				status = alac_fill_element (bits) ;
  543|  1.37k|				break ;
  544|  1.02k|			}
  545|       |
  546|  1.50k|			case ID_END:
  ------------------
  |  Branch (546:4): [True: 1.50k, False: 47.1k]
  ------------------
  547|  1.50k|			{
  548|       |				// frame end, all done so byte align the frame and check for overruns
  549|  1.50k|				BitBufferByteAlign (bits, false) ;
  550|       |				//Assert (bits->cur == bits->end) ;
  551|  1.50k|				goto Exit ;
  552|  1.02k|			}
  553|  48.6k|		}
  554|       |
  555|  28.8k|#if 1 // ! DEBUG
  556|       |		// if we've decoded all of our channels, bail (but not in debug b/c we want to know if we're seeing bad bits)
  557|       |		// - this also protects us if the config does not match the bitstream or crap data bits follow the audio bits
  558|  28.8k|		if (channelIndex >= numChannels)
  ------------------
  |  Branch (558:7): [True: 426, False: 28.4k]
  ------------------
  559|    426|			break ;
  560|  28.8k|#endif
  561|  28.8k|	}
  562|       |
  563|  3.68k|NoMoreChannels:
  564|       |
  565|       |	// if we get here and haven't decoded all of the requested channels, fill the remaining channels with zeros
  566|   164k|	for ( ; channelIndex < numChannels ; channelIndex++)
  ------------------
  |  Branch (566:10): [True: 161k, False: 3.68k]
  ------------------
  567|   161k|	{
  568|   161k|		int32_t *	fill32 = sampleBuffer + channelIndex ;
  569|   161k|		Zero32 (fill32, numSamples, numChannels) ;
  570|   161k|	}
  571|       |
  572|  26.7k|Exit:
  573|  26.7k|	return status ;
  574|  3.68k|}
alac_decoder.c:alac_fill_element:
  586|  1.37k|{
  587|  1.37k|	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.37k|	count = BitBufferReadSmall (bits, 4) ;
  592|  1.37k|	if (count == 15)
  ------------------
  |  Branch (592:6): [True: 219, False: 1.16k]
  ------------------
  593|    219|		count += (int16_t) BitBufferReadSmall (bits, 8) - 1 ;
  594|       |
  595|  1.37k|	BitBufferAdvance (bits, count * 8) ;
  596|       |
  597|  1.37k|	RequireAction (bits->cur <= bits->end, return kALAC_ParamError ;) ;
  ------------------
  |  |   39|  1.37k|#define RequireAction(condition, action)		if (! (condition)) { action }
  |  |  ------------------
  |  |  |  Branch (39:47): [True: 453, False: 926]
  |  |  ------------------
  ------------------
  598|       |
  599|    926|	return ALAC_noErr ;
  600|  1.37k|}
alac_decoder.c:alac_data_stream_element:
  608|  1.80k|{
  609|  1.80k|	int32_t		data_byte_align_flag ;
  610|  1.80k|	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.80k|	data_byte_align_flag = BitBufferReadOne (bits) ;
  617|       |
  618|       |	// 8-bit count or (8-bit + 8-bit count) if 8-bit count == 255
  619|  1.80k|	count = BitBufferReadSmall (bits, 8) ;
  620|  1.80k|	if (count == 255)
  ------------------
  |  Branch (620:6): [True: 243, False: 1.56k]
  ------------------
  621|    243|		count += BitBufferReadSmall (bits, 8) ;
  622|       |
  623|       |	// the align flag means the bitstream should be byte-aligned before reading the following data bytes
  624|  1.80k|	if (data_byte_align_flag)
  ------------------
  |  Branch (624:6): [True: 658, False: 1.15k]
  ------------------
  625|    658|		BitBufferByteAlign (bits, false) ;
  626|       |
  627|       |	// skip the data bytes
  628|  1.80k|	BitBufferAdvance (bits, count * 8) ;
  629|       |
  630|  1.80k|	RequireAction (bits->cur <= bits->end, return kALAC_ParamError ;) ;
  ------------------
  |  |   39|  1.80k|#define RequireAction(condition, action)		if (! (condition)) { action }
  |  |  ------------------
  |  |  |  Branch (39:47): [True: 926, False: 882]
  |  |  ------------------
  ------------------
  631|       |
  632|    882|	return ALAC_noErr ;
  633|  1.80k|}
alac_decoder.c:Zero32:
  640|   161k|{
  641|   161k|	if (stride == 1)
  ------------------
  |  Branch (641:6): [True: 658, False: 160k]
  ------------------
  642|    658|	{
  643|    658|		memset (buffer, 0, numItems * sizeof (int32_t)) ;
  644|    658|	}
  645|   160k|	else
  646|   160k|	{
  647|  25.3M|		for (uint32_t indx = 0 ; indx < (numItems * stride) ; indx += stride)
  ------------------
  |  Branch (647:28): [True: 25.2M, False: 160k]
  ------------------
  648|  25.2M|			buffer [indx] = 0 ;
  649|   160k|	}
  650|   161k|}

unpc_block:
   56|  28.1k|{
   57|  28.1k|	register int16_t	a0, a1, a2, a3 ;
   58|  28.1k|	register int32_t	b0, b1, b2, b3 ;
   59|  28.1k|	int32_t					j, k, lim ;
   60|  28.1k|	int32_t				sum1, sg, sgn, top, dd ;
   61|  28.1k|	int32_t *			pout ;
   62|  28.1k|	int32_t				del, del0 ;
   63|  28.1k|	uint32_t			chanshift = 32 - chanbits ;
   64|  28.1k|	int32_t				denhalf = 1 << (denshift - 1) ;
   65|       |
   66|  28.1k|	out [0] = pc1 [0] ;
   67|  28.1k|	if (numactive == 0)
  ------------------
  |  Branch (67:6): [True: 17.3k, False: 10.7k]
  ------------------
   68|  17.3k|	{
   69|       |		// just copy if numactive == 0 (but don't bother if in/out pointers the same)
   70|  17.3k|		if ((num > 1) && (pc1 != out))
  ------------------
  |  Branch (70:7): [True: 14.7k, False: 2.59k]
  |  Branch (70:20): [True: 14.7k, False: 0]
  ------------------
   71|  14.7k|			memcpy (&out [1], &pc1 [1], (num - 1) * sizeof (int32_t)) ;
   72|  17.3k|		return ;
   73|  17.3k|	}
   74|  10.7k|	if (numactive == 31)
  ------------------
  |  Branch (74:6): [True: 5.76k, False: 4.96k]
  ------------------
   75|  5.76k|	{
   76|       |		// short-circuit if numactive == 31
   77|  5.76k|		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.76k|		prev = out [0] ;
   88|   798k|		for (j = 1 ; j < num ; j++)
  ------------------
  |  Branch (88:16): [True: 792k, False: 5.76k]
  ------------------
   89|   792k|		{
   90|   792k|			del = pc1 [j] + prev ;
   91|   792k|			prev = (del << chanshift) >> chanshift ;
   92|   792k|			out [j] = prev ;
   93|   792k|		}
   94|  5.76k|		return ;
   95|  5.76k|	}
   96|       |
   97|  32.2k|	for (j = 1 ; j <= numactive ; j++)
  ------------------
  |  Branch (97:15): [True: 27.2k, False: 4.96k]
  ------------------
   98|  27.2k|	{
   99|  27.2k|		del = pc1 [j] + out [j-1] ;
  100|  27.2k|		out [j] = arith_shift_left (del, chanshift) >> chanshift ;
  101|  27.2k|	}
  102|       |
  103|  4.96k|	lim = numactive + 1 ;
  104|       |
  105|  4.96k|	if (numactive == 4)
  ------------------
  |  Branch (105:6): [True: 1.11k, False: 3.84k]
  ------------------
  106|  1.11k|	{
  107|       |		// optimization for numactive == 4
  108|  1.11k|		register int16_t	ia0, ia1, ia2, ia3 ;
  109|  1.11k|		register int32_t	ib0, ib1, ib2, ib3 ;
  110|       |
  111|  1.11k|		ia0 = coefs [0] ;
  112|  1.11k|		ia1 = coefs [1] ;
  113|  1.11k|		ia2 = coefs [2] ;
  114|  1.11k|		ia3 = coefs [3] ;
  115|       |
  116|   408k|		for (j = lim ; j < num ; j++)
  ------------------
  |  Branch (116:18): [True: 407k, False: 1.11k]
  ------------------
  117|   407k|		{
  118|   407k|			LOOP_ALIGN
  119|       |
  120|   407k|			top = out [j - lim] ;
  121|   407k|			pout = out + j - 1 ;
  122|       |
  123|   407k|			ib0 = top - pout [0] ;
  124|   407k|			ib1 = top - pout [-1] ;
  125|   407k|			ib2 = top - pout [-2] ;
  126|   407k|			ib3 = top - pout [-3] ;
  127|       |
  128|   407k|			sum1 = (denhalf - ia0 * ib0 - ia1 * ib1 - ia2 * ib2 - ia3 * ib3) >> denshift ;
  129|       |
  130|   407k|			del = pc1 [j] ;
  131|   407k|			del0 = del ;
  132|   407k|			sg = sign_of_int (del) ;
  133|   407k|			del += top + sum1 ;
  134|       |
  135|   407k|			out [j] = arith_shift_left (del, chanshift) >> chanshift ;
  136|       |
  137|   407k|			if (sg > 0)
  ------------------
  |  Branch (137:8): [True: 17.3k, False: 389k]
  ------------------
  138|  17.3k|			{
  139|  17.3k|				sgn = sign_of_int (ib3) ;
  140|  17.3k|				ia3 -= sgn ;
  141|  17.3k|				del0 -= (4 - 3) * ((sgn * ib3) >> denshift) ;
  142|  17.3k|				if (del0 <= 0)
  ------------------
  |  Branch (142:9): [True: 3.51k, False: 13.8k]
  ------------------
  143|  3.51k|					continue ;
  144|       |
  145|  13.8k|				sgn = sign_of_int (ib2) ;
  146|  13.8k|				ia2 -= sgn ;
  147|  13.8k|				del0 -= (4 - 2) * ((sgn * ib2) >> denshift) ;
  148|  13.8k|				if (del0 <= 0)
  ------------------
  |  Branch (148:9): [True: 2.63k, False: 11.2k]
  ------------------
  149|  2.63k|					continue ;
  150|       |
  151|  11.2k|				sgn = sign_of_int (ib1) ;
  152|  11.2k|				ia1 -= sgn ;
  153|  11.2k|				del0 -= (4 - 1) * ((sgn * ib1) >> denshift) ;
  154|  11.2k|				if (del0 <= 0)
  ------------------
  |  Branch (154:9): [True: 1.37k, False: 9.87k]
  ------------------
  155|  1.37k|					continue ;
  156|       |
  157|  9.87k|				ia0 -= sign_of_int (ib0) ;
  158|  9.87k|			}
  159|   389k|			else if (sg < 0)
  ------------------
  |  Branch (159:13): [True: 33.1k, False: 356k]
  ------------------
  160|  33.1k|			{
  161|       |				// note: to avoid unnecessary negations, we flip the value of "sgn"
  162|  33.1k|				sgn = -sign_of_int (ib3) ;
  163|  33.1k|				ia3 -= sgn ;
  164|  33.1k|				del0 -= (4 - 3) * ((sgn * ib3) >> denshift) ;
  165|  33.1k|				if (del0 >= 0)
  ------------------
  |  Branch (165:9): [True: 7.85k, False: 25.2k]
  ------------------
  166|  7.85k|					continue ;
  167|       |
  168|  25.2k|				sgn = -sign_of_int (ib2) ;
  169|  25.2k|				ia2 -= sgn ;
  170|  25.2k|				del0 -= (4 - 2) * ((sgn * ib2) >> denshift) ;
  171|  25.2k|				if (del0 >= 0)
  ------------------
  |  Branch (171:9): [True: 4.06k, False: 21.1k]
  ------------------
  172|  4.06k|					continue ;
  173|       |
  174|  21.1k|				sgn = -sign_of_int (ib1) ;
  175|  21.1k|				ia1 -= sgn ;
  176|  21.1k|				del0 -= (4 - 1) * ((sgn * ib1) >> denshift) ;
  177|  21.1k|				if (del0 >= 0)
  ------------------
  |  Branch (177:9): [True: 3.75k, False: 17.4k]
  ------------------
  178|  3.75k|					continue ;
  179|       |
  180|  17.4k|				ia0 += sign_of_int (ib0) ;
  181|  17.4k|			}
  182|   407k|		}
  183|       |
  184|  1.11k|		coefs [0] = ia0 ;
  185|  1.11k|		coefs [1] = ia1 ;
  186|  1.11k|		coefs [2] = ia2 ;
  187|  1.11k|		coefs [3] = ia3 ;
  188|  1.11k|	}
  189|  3.84k|	else if (numactive == 8)
  ------------------
  |  Branch (189:11): [True: 882, False: 2.96k]
  ------------------
  190|    882|	{
  191|    882|		register int16_t	a4, a5, a6, a7 ;
  192|    882|		register int32_t	b4, b5, b6, b7 ;
  193|       |
  194|       |		// optimization for numactive == 8
  195|    882|		a0 = coefs [0] ;
  196|    882|		a1 = coefs [1] ;
  197|    882|		a2 = coefs [2] ;
  198|    882|		a3 = coefs [3] ;
  199|    882|		a4 = coefs [4] ;
  200|    882|		a5 = coefs [5] ;
  201|    882|		a6 = coefs [6] ;
  202|    882|		a7 = coefs [7] ;
  203|       |
  204|   398k|		for (j = lim ; j < num ; j++)
  ------------------
  |  Branch (204:18): [True: 397k, False: 882]
  ------------------
  205|   397k|		{
  206|   397k|			LOOP_ALIGN
  207|       |
  208|   397k|			top = out [j - lim] ;
  209|   397k|			pout = out + j - 1 ;
  210|       |
  211|   397k|			b0 = top - (*pout--) ;
  212|   397k|			b1 = top - (*pout--) ;
  213|   397k|			b2 = top - (*pout--) ;
  214|   397k|			b3 = top - (*pout--) ;
  215|   397k|			b4 = top - (*pout--) ;
  216|   397k|			b5 = top - (*pout--) ;
  217|   397k|			b6 = top - (*pout--) ;
  218|   397k|			b7 = top - (*pout) ;
  219|   397k|			pout += 8 ;
  220|       |
  221|   397k|			sum1 = (denhalf - a0 * b0 - a1 * b1 - a2 * b2 - a3 * b3
  222|   397k|					- a4 * b4 - a5 * b5 - a6 * b6 - a7 * b7) >> denshift ;
  223|       |
  224|   397k|			del = pc1 [j] ;
  225|   397k|			del0 = del ;
  226|   397k|			sg = sign_of_int (del) ;
  227|   397k|			del += top + sum1 ;
  228|       |
  229|   397k|			out [j] = arith_shift_left (del, chanshift) >> chanshift ;
  230|       |
  231|   397k|			if (sg > 0)
  ------------------
  |  Branch (231:8): [True: 72.1k, False: 325k]
  ------------------
  232|  72.1k|			{
  233|  72.1k|				sgn = sign_of_int (b7) ;
  234|  72.1k|				a7 -= sgn ;
  235|  72.1k|				del0 -= 1 * ((sgn * b7) >> denshift) ;
  236|  72.1k|				if (del0 <= 0)
  ------------------
  |  Branch (236:9): [True: 17.0k, False: 55.1k]
  ------------------
  237|  17.0k|					continue ;
  238|       |
  239|  55.1k|				sgn = sign_of_int (b6) ;
  240|  55.1k|				a6 -= sgn ;
  241|  55.1k|				del0 -= 2 * ((sgn * b6) >> denshift) ;
  242|  55.1k|				if (del0 <= 0)
  ------------------
  |  Branch (242:9): [True: 7.08k, False: 48.0k]
  ------------------
  243|  7.08k|					continue ;
  244|       |
  245|  48.0k|				sgn = sign_of_int (b5) ;
  246|  48.0k|				a5 -= sgn ;
  247|  48.0k|				del0 -= 3 * ((sgn * b5) >> denshift) ;
  248|  48.0k|				if (del0 <= 0)
  ------------------
  |  Branch (248:9): [True: 6.76k, False: 41.2k]
  ------------------
  249|  6.76k|					continue ;
  250|       |
  251|  41.2k|				sgn = sign_of_int (b4) ;
  252|  41.2k|				a4 -= sgn ;
  253|  41.2k|				del0 -= 4 * ((sgn * b4) >> denshift) ;
  254|  41.2k|				if (del0 <= 0)
  ------------------
  |  Branch (254:9): [True: 9.14k, False: 32.1k]
  ------------------
  255|  9.14k|					continue ;
  256|       |
  257|  32.1k|				sgn = sign_of_int (b3) ;
  258|  32.1k|				a3 -= sgn ;
  259|  32.1k|				del0 -= 5 * ((sgn * b3) >> denshift) ;
  260|  32.1k|				if (del0 <= 0)
  ------------------
  |  Branch (260:9): [True: 9.90k, False: 22.2k]
  ------------------
  261|  9.90k|					continue ;
  262|       |
  263|  22.2k|				sgn = sign_of_int (b2) ;
  264|  22.2k|				a2 -= sgn ;
  265|  22.2k|				del0 -= 6 * ((sgn * b2) >> denshift) ;
  266|  22.2k|				if (del0 <= 0)
  ------------------
  |  Branch (266:9): [True: 6.58k, False: 15.6k]
  ------------------
  267|  6.58k|					continue ;
  268|       |
  269|  15.6k|				sgn = sign_of_int (b1) ;
  270|  15.6k|				a1 -= sgn ;
  271|  15.6k|				del0 -= 7 * ((sgn * b1) >> denshift) ;
  272|  15.6k|				if (del0 <= 0)
  ------------------
  |  Branch (272:9): [True: 3.58k, False: 12.0k]
  ------------------
  273|  3.58k|					continue ;
  274|       |
  275|  12.0k|				a0 -= sign_of_int (b0) ;
  276|  12.0k|			}
  277|   325k|			else if (sg < 0)
  ------------------
  |  Branch (277:13): [True: 67.5k, False: 257k]
  ------------------
  278|  67.5k|			{
  279|       |				// note: to avoid unnecessary negations, we flip the value of "sgn"
  280|  67.5k|				sgn = -sign_of_int (b7) ;
  281|  67.5k|				a7 -= sgn ;
  282|  67.5k|				del0 -= 1 * ((sgn * b7) >> denshift) ;
  283|  67.5k|				if (del0 >= 0)
  ------------------
  |  Branch (283:9): [True: 9.02k, False: 58.5k]
  ------------------
  284|  9.02k|					continue ;
  285|       |
  286|  58.5k|				sgn = -sign_of_int (b6) ;
  287|  58.5k|				a6 -= sgn ;
  288|  58.5k|				del0 -= 2 * ((sgn * b6) >> denshift) ;
  289|  58.5k|				if (del0 >= 0)
  ------------------
  |  Branch (289:9): [True: 6.51k, False: 52.0k]
  ------------------
  290|  6.51k|					continue ;
  291|       |
  292|  52.0k|				sgn = -sign_of_int (b5) ;
  293|  52.0k|				a5 -= sgn ;
  294|  52.0k|				del0 -= 3 * ((sgn * b5) >> denshift) ;
  295|  52.0k|				if (del0 >= 0)
  ------------------
  |  Branch (295:9): [True: 9.10k, False: 42.9k]
  ------------------
  296|  9.10k|					continue ;
  297|       |
  298|  42.9k|				sgn = -sign_of_int (b4) ;
  299|  42.9k|				a4 -= sgn ;
  300|  42.9k|				del0 -= 4 * ((sgn * b4) >> denshift) ;
  301|  42.9k|				if (del0 >= 0)
  ------------------
  |  Branch (301:9): [True: 9.40k, False: 33.5k]
  ------------------
  302|  9.40k|					continue ;
  303|       |
  304|  33.5k|				sgn = -sign_of_int (b3) ;
  305|  33.5k|				a3 -= sgn ;
  306|  33.5k|				del0 -= 5 * ((sgn * b3) >> denshift) ;
  307|  33.5k|				if (del0 >= 0)
  ------------------
  |  Branch (307:9): [True: 7.97k, False: 25.5k]
  ------------------
  308|  7.97k|					continue ;
  309|       |
  310|  25.5k|				sgn = -sign_of_int (b2) ;
  311|  25.5k|				a2 -= sgn ;
  312|  25.5k|				del0 -= 6 * ((sgn * b2) >> denshift) ;
  313|  25.5k|				if (del0 >= 0)
  ------------------
  |  Branch (313:9): [True: 7.26k, False: 18.2k]
  ------------------
  314|  7.26k|					continue ;
  315|       |
  316|  18.2k|				sgn = -sign_of_int (b1) ;
  317|  18.2k|				a1 -= sgn ;
  318|  18.2k|				del0 -= 7 * ((sgn * b1) >> denshift) ;
  319|  18.2k|				if (del0 >= 0)
  ------------------
  |  Branch (319:9): [True: 5.44k, False: 12.8k]
  ------------------
  320|  5.44k|					continue ;
  321|       |
  322|  12.8k|				a0 += sign_of_int (b0) ;
  323|  12.8k|			}
  324|   397k|		}
  325|       |
  326|    882|		coefs [0] = a0 ;
  327|    882|		coefs [1] = a1 ;
  328|    882|		coefs [2] = a2 ;
  329|    882|		coefs [3] = a3 ;
  330|    882|		coefs [4] = a4 ;
  331|    882|		coefs [5] = a5 ;
  332|    882|		coefs [6] = a6 ;
  333|    882|		coefs [7] = a7 ;
  334|    882|	}
  335|  2.96k|	else
  336|  2.96k|	{
  337|       |		// general case
  338|   403k|		for (j = lim ; j < num ; j++)
  ------------------
  |  Branch (338:18): [True: 400k, False: 2.96k]
  ------------------
  339|   400k|		{
  340|   400k|			LOOP_ALIGN
  341|       |
  342|   400k|			sum1 = 0 ;
  343|   400k|			pout = out + j - 1 ;
  344|   400k|			top = out [j-lim] ;
  345|       |
  346|  4.47M|			for (k = 0 ; k < numactive ; k++)
  ------------------
  |  Branch (346:17): [True: 4.07M, False: 400k]
  ------------------
  347|  4.07M|				sum1 += coefs [k] * (pout [-k] - top) ;
  348|       |
  349|   400k|			del = pc1 [j] ;
  350|   400k|			del0 = del ;
  351|   400k|			sg = sign_of_int (del) ;
  352|   400k|			del += top + ((sum1 + denhalf) >> denshift) ;
  353|   400k|			out [j] = (del << chanshift) >> chanshift ;
  354|       |
  355|   400k|			if (sg > 0)
  ------------------
  |  Branch (355:8): [True: 90.9k, False: 309k]
  ------------------
  356|  90.9k|			{
  357|   709k|				for (k = (numactive - 1) ; k >= 0 ; k--)
  ------------------
  |  Branch (357:32): [True: 648k, False: 61.1k]
  ------------------
  358|   648k|				{
  359|   648k|					dd = top - pout [-k] ;
  360|   648k|					sgn = sign_of_int (dd) ;
  361|   648k|					coefs [k] -= sgn ;
  362|   648k|					del0 -= (numactive - k) * ((sgn * dd) >> denshift) ;
  363|   648k|					if (del0 <= 0)
  ------------------
  |  Branch (363:10): [True: 29.7k, False: 618k]
  ------------------
  364|  29.7k|						break ;
  365|   648k|				}
  366|  90.9k|			}
  367|   309k|			else if (sg < 0)
  ------------------
  |  Branch (367:13): [True: 234k, False: 75.3k]
  ------------------
  368|   234k|			{
  369|  2.18M|				for (k = (numactive - 1) ; k >= 0 ; k--)
  ------------------
  |  Branch (369:32): [True: 1.99M, False: 194k]
  ------------------
  370|  1.99M|				{
  371|  1.99M|					dd = top - pout [-k] ;
  372|  1.99M|					sgn = sign_of_int (dd) ;
  373|  1.99M|					coefs [k] += sgn ;
  374|  1.99M|					del0 -= (numactive - k) * ((-sgn * dd) >> denshift) ;
  375|  1.99M|					if (del0 >= 0)
  ------------------
  |  Branch (375:10): [True: 40.0k, False: 1.95M]
  ------------------
  376|  40.0k|						break ;
  377|  1.99M|				}
  378|   234k|			}
  379|   400k|		}
  380|  2.96k|	}
  381|  4.96k|}
dp_dec.c:sign_of_int:
   47|  4.60M|{
   48|  4.60M|	int32_t negishift ;
   49|       |
   50|  4.60M|	negishift = ((uint32_t) - i) >> 31 ;
   51|  4.60M|	return negishift | (i >> 31) ;
   52|  4.60M|}

unmix16:
   66|  1.29k|{
   67|  1.29k|	int32_t 	j ;
   68|       |
   69|  1.29k|	if (mixres != 0)
  ------------------
  |  Branch (69:6): [True: 599, False: 700]
  ------------------
   70|    599|	{
   71|       |		/* matrixed stereo */
   72|  2.38k|		for (j = 0 ; j < numSamples ; j++)
  ------------------
  |  Branch (72:16): [True: 1.78k, False: 599]
  ------------------
   73|  1.78k|		{
   74|  1.78k|			int32_t		l, r ;
   75|       |
   76|  1.78k|			l = u [j] + v [j] - ((mixres * v [j]) >> mixbits) ;
   77|  1.78k|			r = l - v [j] ;
   78|       |
   79|  1.78k|			out [0] = arith_shift_left (l, 16) ;
   80|  1.78k|			out [1] = arith_shift_left (r, 16) ;
   81|  1.78k|			out += stride ;
   82|  1.78k|		}
   83|    599|	}
   84|    700|	else
   85|    700|	{
   86|       |		/* Conventional separated stereo. */
   87|  24.4k|		for (j = 0 ; j < numSamples ; j++)
  ------------------
  |  Branch (87:16): [True: 23.7k, False: 700]
  ------------------
   88|  23.7k|		{
   89|  23.7k|			out [0] = u [j] << 16 ;
   90|  23.7k|			out [1] = v [j] << 16 ;
   91|  23.7k|			out += stride ;
   92|  23.7k|		}
   93|    700|	}
   94|  1.29k|}
unmix20:
  101|    847|{
  102|    847|	int32_t 	j ;
  103|       |
  104|    847|	if (mixres != 0)
  ------------------
  |  Branch (104:6): [True: 309, False: 538]
  ------------------
  105|    309|	{
  106|       |		/* matrixed stereo */
  107|  2.00k|		for (j = 0 ; j < numSamples ; j++)
  ------------------
  |  Branch (107:16): [True: 1.69k, False: 309]
  ------------------
  108|  1.69k|		{
  109|  1.69k|			int32_t		l, r ;
  110|       |
  111|  1.69k|			l = u [j] + v [j] - ((mixres * v [j]) >> mixbits) ;
  112|  1.69k|			r = l - v [j] ;
  113|       |
  114|  1.69k|			out [0] = arith_shift_left (l, 12) ;
  115|  1.69k|			out [1] = arith_shift_left (r, 12) ;
  116|  1.69k|			out += stride ;
  117|  1.69k|		}
  118|    309|	}
  119|    538|	else
  120|    538|	{
  121|       |		/* Conventional separated stereo. */
  122|  26.3k|		for (j = 0 ; j < numSamples ; j++)
  ------------------
  |  Branch (122:16): [True: 25.7k, False: 538]
  ------------------
  123|  25.7k|		{
  124|  25.7k|			out [0] = arith_shift_left (u [j], 12) ;
  125|  25.7k|			out [1] = arith_shift_left (v [j], 12) ;
  126|  25.7k|			out += stride ;
  127|  25.7k|		}
  128|    538|	}
  129|    847|}
unmix24:
  137|  1.57k|{
  138|  1.57k|	int32_t		shift = bytesShifted * 8 ;
  139|  1.57k|	int32_t		l, r ;
  140|  1.57k|	int32_t 		j, k ;
  141|       |
  142|  1.57k|	if (mixres != 0)
  ------------------
  |  Branch (142:6): [True: 762, False: 817]
  ------------------
  143|    762|	{
  144|       |		/* matrixed stereo */
  145|    762|		if (bytesShifted != 0)
  ------------------
  |  Branch (145:7): [True: 63, False: 699]
  ------------------
  146|     63|		{
  147|    590|			for (j = 0, k = 0 ; j < numSamples ; j++, k += 2)
  ------------------
  |  Branch (147:24): [True: 527, False: 63]
  ------------------
  148|    527|			{
  149|    527|				l = u [j] + v [j] - ((mixres * v [j]) >> mixbits) ;
  150|    527|				r = l - v [j] ;
  151|       |
  152|    527|				l = arith_shift_left (l, shift) | (uint32_t) shiftUV [k + 0] ;
  153|    527|				r = arith_shift_left (r, shift) | (uint32_t) shiftUV [k + 1] ;
  154|       |
  155|    527|				out [0] = arith_shift_left (l, 8) ;
  156|    527|				out [1] = arith_shift_left (r, 8) ;
  157|    527|				out += stride ;
  158|    527|			}
  159|     63|		}
  160|    699|		else
  161|    699|		{
  162|  5.04k|			for (j = 0 ; j < numSamples ; j++)
  ------------------
  |  Branch (162:17): [True: 4.34k, False: 699]
  ------------------
  163|  4.34k|			{
  164|  4.34k|				l = u [j] + v [j] - ((mixres * v [j]) >> mixbits) ;
  165|  4.34k|				r = l - v [j] ;
  166|       |
  167|  4.34k|				out [0] = l << 8 ;
  168|  4.34k|				out [1] = r << 8 ;
  169|  4.34k|				out += stride ;
  170|  4.34k|			}
  171|    699|		}
  172|    762|	}
  173|    817|	else
  174|    817|	{
  175|       |		/* Conventional separated stereo. */
  176|    817|		if (bytesShifted != 0)
  ------------------
  |  Branch (176:7): [True: 170, False: 647]
  ------------------
  177|    170|		{
  178|    954|			for (j = 0, k = 0 ; j < numSamples ; j++, k += 2)
  ------------------
  |  Branch (178:24): [True: 784, False: 170]
  ------------------
  179|    784|			{
  180|    784|				l = u [j] ;
  181|    784|				r = v [j] ;
  182|       |
  183|    784|				l = (l << shift) | (uint32_t) shiftUV [k + 0] ;
  184|    784|				r = (r << shift) | (uint32_t) shiftUV [k + 1] ;
  185|       |
  186|    784|				out [0] = l << 8 ;
  187|    784|				out [1] = r << 8 ;
  188|    784|				out += stride ;
  189|    784|			}
  190|    170|		}
  191|    647|		else
  192|    647|		{
  193|  22.4k|			for (j = 0 ; j < numSamples ; j++)
  ------------------
  |  Branch (193:17): [True: 21.7k, False: 647]
  ------------------
  194|  21.7k|			{
  195|  21.7k|				out [0] = u [j] << 8 ;
  196|  21.7k|				out [1] = v [j] << 8 ;
  197|  21.7k|				out += stride ;
  198|  21.7k|			}
  199|    647|		}
  200|    817|	}
  201|  1.57k|}
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: 477, False: 768]
  ------------------
  217|    477|	{
  218|       |		//Assert (bytesShifted != 0) ;
  219|       |
  220|       |		/* matrixed stereo with shift */
  221|  10.2k|		for (j = 0, k = 0 ; j < numSamples ; j++, k += 2)
  ------------------
  |  Branch (221:23): [True: 9.76k, False: 477]
  ------------------
  222|  9.76k|		{
  223|  9.76k|			int32_t		lt, rt ;
  224|       |
  225|  9.76k|			lt = u [j] ;
  226|  9.76k|			rt = v [j] ;
  227|       |
  228|  9.76k|			l = lt + rt - ((mixres * rt) >> mixbits) ;
  229|  9.76k|			r = l - rt ;
  230|       |
  231|  9.76k|			out [0] = arith_shift_left (l, shift) | (uint32_t) shiftUV [k + 0] ;
  232|  9.76k|			out [1] = arith_shift_left (r, shift) | (uint32_t) shiftUV [k + 1] ;
  233|  9.76k|			out += stride ;
  234|  9.76k|		}
  235|    477|	}
  236|    768|	else
  237|    768|	{
  238|    768|		if (bytesShifted == 0)
  ------------------
  |  Branch (238:7): [True: 627, False: 141]
  ------------------
  239|    627|		{
  240|       |			/* interleaving w/o shift */
  241|  64.7k|			for (j = 0 ; j < numSamples ; j++)
  ------------------
  |  Branch (241:17): [True: 64.1k, False: 627]
  ------------------
  242|  64.1k|			{
  243|  64.1k|				out [0] = u [j] ;
  244|  64.1k|				out [1] = v [j] ;
  245|  64.1k|				out += stride ;
  246|  64.1k|			}
  247|    627|		}
  248|    141|		else
  249|    141|		{
  250|       |			/* interleaving with shift */
  251|    799|			for (j = 0, k = 0 ; j < numSamples ; j++, k += 2)
  ------------------
  |  Branch (251:24): [True: 658, False: 141]
  ------------------
  252|    658|			{
  253|    658|				out [0] = (u [j] << shift) | (uint32_t) shiftUV [k + 0] ;
  254|    658|				out [1] = (v [j] << shift) | (uint32_t) shiftUV [k + 1] ;
  255|    658|				out += stride ;
  256|    658|			}
  257|    141|		}
  258|    768|	}
  259|  1.24k|}
copyPredictorTo24:
  265|  4.65k|{
  266|  4.65k|	int32_t		j ;
  267|       |
  268|   893k|	for (j = 0 ; j < numSamples ; j++)
  ------------------
  |  Branch (268:15): [True: 888k, False: 4.65k]
  ------------------
  269|   888k|	{
  270|   888k|		out [0] = in [j] << 8 ;
  271|   888k|		out += stride ;
  272|   888k|	}
  273|  4.65k|}
copyPredictorTo24Shift:
  277|  1.33k|{
  278|  1.33k|	int32_t		shiftVal = bytesShifted * 8 ;
  279|  1.33k|	int32_t		j ;
  280|       |
  281|       |	//Assert (bytesShifted != 0) ;
  282|       |
  283|  5.49k|	for (j = 0 ; j < numSamples ; j++)
  ------------------
  |  Branch (283:15): [True: 4.15k, False: 1.33k]
  ------------------
  284|  4.15k|	{
  285|  4.15k|		int32_t		val = in [j] ;
  286|       |
  287|  4.15k|		val = arith_shift_left (val, shiftVal) | (uint32_t) shift [j] ;
  288|  4.15k|		out [0] = arith_shift_left (val, 8) ;
  289|  4.15k|		out += stride ;
  290|  4.15k|	}
  291|  1.33k|}
copyPredictorTo20:
  295|  1.91k|{
  296|  1.91k|	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|   153k|	for (j = 0 ; j < numSamples ; j++)
  ------------------
  |  Branch (300:15): [True: 151k, False: 1.91k]
  ------------------
  301|   151k|	{
  302|   151k|		out [0] = arith_shift_left (in [j], 12) ;
  303|   151k|		out += stride ;
  304|   151k|	}
  305|  1.91k|}
copyPredictorTo32:
  309|  5.36k|{
  310|  5.36k|	int32_t			i, j ;
  311|       |
  312|       |	// this is only a subroutine to abstract the "iPod can only output 16-bit data" problem
  313|   139k|	for (i = 0, j = 0 ; i < numSamples ; i++, j += stride)
  ------------------
  |  Branch (313:22): [True: 134k, False: 5.36k]
  ------------------
  314|   134k|		out [j] = arith_shift_left (in [i], 8) ;
  315|  5.36k|}
copyPredictorTo32Shift:
  319|  1.29k|{
  320|  1.29k|	int32_t *		op = out ;
  321|  1.29k|	uint32_t		shiftVal = bytesShifted * 8 ;
  322|  1.29k|	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.59k|	for (j = 0 ; j < numSamples ; j++)
  ------------------
  |  Branch (327:15): [True: 2.30k, False: 1.29k]
  ------------------
  328|  2.30k|	{
  329|  2.30k|		op [0] = arith_shift_left (in [j], shiftVal) | (uint32_t) shift [j] ;
  330|  2.30k|		op += stride ;
  331|  2.30k|	}
  332|  1.29k|}

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

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

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

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

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

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

gsm_sub:
   26|  74.1k|{
   27|  74.1k|	int32_t diff = (int32_t) a - (int32_t) b ;
   28|  74.1k|	return saturate (diff) ;
  ------------------
  |  |   17|  74.1k|	((x) < MIN_WORD ? MIN_WORD : (x) > MAX_WORD ? MAX_WORD: (x))
  |  |  ------------------
  |  |  |  |   51|  74.1k|#define	MIN_WORD	(-32767 - 1)
  |  |  ------------------
  |  |               	((x) < MIN_WORD ? MIN_WORD : (x) > MAX_WORD ? MAX_WORD: (x))
  |  |  ------------------
  |  |  |  |   51|      0|#define	MIN_WORD	(-32767 - 1)
  |  |  ------------------
  |  |               	((x) < MIN_WORD ? MIN_WORD : (x) > MAX_WORD ? MAX_WORD: (x))
  |  |  ------------------
  |  |  |  |   52|  74.1k|#define	MAX_WORD	32767
  |  |  ------------------
  |  |               	((x) < MIN_WORD ? MIN_WORD : (x) > MAX_WORD ? MAX_WORD: (x))
  |  |  ------------------
  |  |  |  |   52|      0|#define	MAX_WORD	32767
  |  |  ------------------
  |  |  |  Branch (17:3): [True: 0, False: 74.1k]
  |  |  |  Branch (17:31): [True: 0, False: 74.1k]
  |  |  ------------------
  ------------------
   29|  74.1k|}
gsm_asr:
  163|   492k|{
  164|   492k|	if (n >= 16) return - (a < 0) ;
  ------------------
  |  Branch (164:6): [True: 0, False: 492k]
  ------------------
  165|   492k|	if (n <= -16) return 0 ;
  ------------------
  |  Branch (165:6): [True: 0, False: 492k]
  ------------------
  166|   492k|	if (n < 0) return a << -n ;
  ------------------
  |  Branch (166:6): [True: 0, False: 492k]
  ------------------
  167|       |
  168|   492k|	return SASR_W (a, (int16_t) n) ;
  169|   492k|}
gsm_asl:
  172|  37.0k|{
  173|  37.0k|	if (n >= 16) return 0 ;
  ------------------
  |  Branch (173:6): [True: 0, False: 37.0k]
  ------------------
  174|  37.0k|	if (n <= -16) return - (a < 0) ;
  ------------------
  |  Branch (174:6): [True: 0, False: 37.0k]
  ------------------
  175|  37.0k|	if (n < 0) return gsm_asr (a, -n) ;
  ------------------
  |  Branch (175:6): [True: 10.4k, False: 26.6k]
  ------------------
  176|  26.6k|	return a << n ;
  177|  37.0k|}

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

decode.c:GSM_MULT_R:
  118|  1.48M|{	return (((int32_t) (a)) * ((int32_t) (b)) + 16384) >> 15 ;
  119|  1.48M|} /* GSM_MULT_R */
decode.c:GSM_ADD:
  150|  2.96M|{	int32_t ltmp ;
  151|       |
  152|  2.96M|	ltmp = ((int32_t) a) + ((int32_t) b) ;
  153|       |
  154|  2.96M|	if (ltmp >= MAX_WORD)
  ------------------
  |  |   52|  2.96M|#define	MAX_WORD	32767
  ------------------
  |  Branch (154:6): [True: 372k, False: 2.59M]
  ------------------
  155|   372k|		return MAX_WORD ;
  ------------------
  |  |   52|   372k|#define	MAX_WORD	32767
  ------------------
  156|  2.59M|	if (ltmp <= MIN_WORD)
  ------------------
  |  |   51|  2.59M|#define	MIN_WORD	(-32767 - 1)
  ------------------
  |  Branch (156:6): [True: 1.35M, False: 1.24M]
  ------------------
  157|  1.35M|		return MIN_WORD ;
  ------------------
  |  |   51|  1.35M|#define	MIN_WORD	(-32767 - 1)
  ------------------
  158|       |
  159|  1.24M|	return ltmp ;
  160|  2.59M|} /* GSM_ADD */
long_term.c:GSM_MULT_R:
  118|  1.48M|{	return (((int32_t) (a)) * ((int32_t) (b)) + 16384) >> 15 ;
  119|  1.48M|} /* GSM_MULT_R */
long_term.c:GSM_ADD:
  150|  1.48M|{	int32_t ltmp ;
  151|       |
  152|  1.48M|	ltmp = ((int32_t) a) + ((int32_t) b) ;
  153|       |
  154|  1.48M|	if (ltmp >= MAX_WORD)
  ------------------
  |  |   52|  1.48M|#define	MAX_WORD	32767
  ------------------
  |  Branch (154:6): [True: 72.7k, False: 1.41M]
  ------------------
  155|  72.7k|		return MAX_WORD ;
  ------------------
  |  |   52|  72.7k|#define	MAX_WORD	32767
  ------------------
  156|  1.41M|	if (ltmp <= MIN_WORD)
  ------------------
  |  |   51|  1.41M|#define	MIN_WORD	(-32767 - 1)
  ------------------
  |  Branch (156:6): [True: 2.47k, False: 1.40M]
  ------------------
  157|  2.47k|		return MIN_WORD ;
  ------------------
  |  |   51|  2.47k|#define	MIN_WORD	(-32767 - 1)
  ------------------
  158|       |
  159|  1.40M|	return ltmp ;
  160|  1.41M|} /* GSM_ADD */
rpe.c:SASR_W:
   60|  16.1k|{	if (x >= 0)
  ------------------
  |  Branch (60:7): [True: 16.1k, False: 0]
  ------------------
   61|  16.1k|		return x >> by ;
   62|      0|	return ~ ((~x) >> by) ;
   63|  16.1k|} /* SASR_W */
rpe.c:arith_shift_left:
  306|   482k|{	return (int32_t) (((uint32_t) x) << shift) ;
  307|   482k|} /* arith_shift_left */
rpe.c:GSM_MULT_R:
  118|   482k|{	return (((int32_t) (a)) * ((int32_t) (b)) + 16384) >> 15 ;
  119|   482k|} /* GSM_MULT_R */
rpe.c:GSM_ADD:
  150|   482k|{	int32_t ltmp ;
  151|       |
  152|   482k|	ltmp = ((int32_t) a) + ((int32_t) b) ;
  153|       |
  154|   482k|	if (ltmp >= MAX_WORD)
  ------------------
  |  |   52|   482k|#define	MAX_WORD	32767
  ------------------
  |  Branch (154:6): [True: 0, False: 482k]
  ------------------
  155|      0|		return MAX_WORD ;
  ------------------
  |  |   52|      0|#define	MAX_WORD	32767
  ------------------
  156|   482k|	if (ltmp <= MIN_WORD)
  ------------------
  |  |   51|   482k|#define	MIN_WORD	(-32767 - 1)
  ------------------
  |  Branch (156:6): [True: 0, False: 482k]
  ------------------
  157|      0|		return MIN_WORD ;
  ------------------
  |  |   51|      0|#define	MIN_WORD	(-32767 - 1)
  ------------------
  158|       |
  159|   482k|	return ltmp ;
  160|   482k|} /* GSM_ADD */
short_term.c:arith_shift_left:
  306|  74.1k|{	return (int32_t) (((uint32_t) x) << shift) ;
  307|  74.1k|} /* arith_shift_left */
short_term.c:GSM_ADD:
  150|  12.4M|{	int32_t ltmp ;
  151|       |
  152|  12.4M|	ltmp = ((int32_t) a) + ((int32_t) b) ;
  153|       |
  154|  12.4M|	if (ltmp >= MAX_WORD)
  ------------------
  |  |   52|  12.4M|#define	MAX_WORD	32767
  ------------------
  |  Branch (154:6): [True: 159k, False: 12.2M]
  ------------------
  155|   159k|		return MAX_WORD ;
  ------------------
  |  |   52|   159k|#define	MAX_WORD	32767
  ------------------
  156|  12.2M|	if (ltmp <= MIN_WORD)
  ------------------
  |  |   51|  12.2M|#define	MIN_WORD	(-32767 - 1)
  ------------------
  |  Branch (156:6): [True: 11.7k, False: 12.2M]
  ------------------
  157|  11.7k|		return MIN_WORD ;
  ------------------
  |  |   51|  11.7k|#define	MIN_WORD	(-32767 - 1)
  ------------------
  158|       |
  159|  12.2M|	return ltmp ;
  160|  12.2M|} /* GSM_ADD */
short_term.c:GSM_SUB:
  164|  11.9M|{	int32_t ltmp ;
  165|       |
  166|  11.9M|	ltmp = ((int32_t) a) - ((int32_t) b) ;
  167|       |
  168|  11.9M|	if (ltmp >= MAX_WORD)
  ------------------
  |  |   52|  11.9M|#define	MAX_WORD	32767
  ------------------
  |  Branch (168:6): [True: 283k, False: 11.6M]
  ------------------
  169|   283k|		ltmp = MAX_WORD ;
  ------------------
  |  |   52|   283k|#define	MAX_WORD	32767
  ------------------
  170|  11.6M|	else if (ltmp <= MIN_WORD)
  ------------------
  |  |   51|  11.6M|#define	MIN_WORD	(-32767 - 1)
  ------------------
  |  Branch (170:11): [True: 176k, False: 11.4M]
  ------------------
  171|   176k|		ltmp = MIN_WORD ;
  ------------------
  |  |   51|   176k|#define	MIN_WORD	(-32767 - 1)
  ------------------
  172|       |
  173|  11.9M|	return ltmp ;
  174|  11.9M|} /* GSM_SUB */
short_term.c:GSM_MULT_R:
  118|  74.1k|{	return (((int32_t) (a)) * ((int32_t) (b)) + 16384) >> 15 ;
  119|  74.1k|} /* GSM_MULT_R */
short_term.c:SASR_W:
   60|   593k|{	if (x >= 0)
  ------------------
  |  Branch (60:7): [True: 206k, False: 387k]
  ------------------
   61|   206k|		return x >> by ;
   62|   387k|	return ~ ((~x) >> by) ;
   63|   593k|} /* SASR_W */
add.c:SASR_W:
   60|   492k|{	if (x >= 0)
  ------------------
  |  Branch (60:7): [True: 174k, False: 318k]
  ------------------
   61|   174k|		return x >> by ;
   62|   318k|	return ~ ((~x) >> by) ;
   63|   492k|} /* SASR_W */

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

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

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

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

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

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

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

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

alac_init:
  112|  1.00k|{	int error ;
  113|       |
  114|  1.00k|	if ((psf->codec_data = calloc (1, sizeof (ALAC_PRIVATE) + psf->sf.channels * sizeof (int) * ALAC_MAX_FRAME_SIZE)) == NULL)
  ------------------
  |  |   33|  1.00k|#define		ALAC_MAX_FRAME_SIZE		8192
  ------------------
  |  Branch (114:6): [True: 0, False: 1.00k]
  ------------------
  115|      0|		return SFE_MALLOC_FAILED ;
  116|       |
  117|  1.00k|	psf->codec_close = alac_close ;
  118|       |
  119|  1.00k|	switch (psf->file.mode)
  120|  1.00k|	{	case SFM_RDWR :
  ------------------
  |  Branch (120:4): [True: 0, False: 1.00k]
  ------------------
  121|      0|			return SFE_BAD_MODE_RW ;
  122|       |
  123|  1.00k|		case SFM_READ :
  ------------------
  |  Branch (123:3): [True: 1.00k, False: 0]
  ------------------
  124|  1.00k|			if ((error = alac_reader_init (psf, info)))
  ------------------
  |  Branch (124:8): [True: 169, False: 833]
  ------------------
  125|    169|				return error ;
  126|    833|			break ;
  127|       |
  128|    833|		case SFM_WRITE :
  ------------------
  |  Branch (128:3): [True: 0, False: 1.00k]
  ------------------
  129|      0|			if ((error = alac_writer_init (psf)))
  ------------------
  |  Branch (129:8): [True: 0, False: 0]
  ------------------
  130|      0|				return error ;
  131|      0|			break ;
  132|       |
  133|      0|		default :
  ------------------
  |  Branch (133:3): [True: 0, False: 1.00k]
  ------------------
  134|      0|			psf_log_printf (psf, "%s : Bad psf->file.mode.\n", __func__) ;
  135|      0|			return SFE_INTERNAL ;
  136|  1.00k|		} ;
  137|       |
  138|    833|	psf->byterate = alac_byterate ;
  139|       |
  140|    833|	return 0 ;
  141|  1.00k|} /* aiff_alac_init */
alac.c:alac_close:
  166|  1.00k|{	ALAC_PRIVATE *plac ;
  167|  1.00k|	BUF_UNION	ubuf ;
  168|       |
  169|  1.00k|	plac = psf->codec_data ;
  170|       |
  171|  1.00k|	if (psf->file.mode == SFM_WRITE)
  ------------------
  |  Branch (171:6): [True: 0, False: 1.00k]
  ------------------
  172|      0|	{	ALAC_ENCODER *penc = &plac->u.encoder ;
  173|      0|		SF_CHUNK_INFO chunk_info ;
  174|      0|		sf_count_t readcount ;
  175|      0|		uint8_t kuki_data [1024] ;
  176|      0|		uint32_t pakt_size = 0, saved_partial_block_frames ;
  177|       |
  178|      0|		plac->final_write_block = 1 ;
  179|      0|		saved_partial_block_frames = plac->partial_block_frames ;
  180|       |
  181|       |		/*	If a block has been partially assembled, write it out as the final block. */
  182|      0|		if (plac->partial_block_frames && plac->partial_block_frames < plac->frames_per_block)
  ------------------
  |  Branch (182:7): [True: 0, False: 0]
  |  Branch (182:37): [True: 0, False: 0]
  ------------------
  183|      0|			alac_encode_block (plac) ;
  184|       |
  185|      0|		plac->partial_block_frames = saved_partial_block_frames ;
  186|       |
  187|      0|		alac_get_magic_cookie (penc, kuki_data, &plac->kuki_size) ;
  188|       |
  189|      0|		memset (&chunk_info, 0, sizeof (chunk_info)) ;
  190|      0|		chunk_info.id_size = snprintf (chunk_info.id, sizeof (chunk_info.id), "kuki") ;
  191|      0|		chunk_info.data = kuki_data ;
  192|      0|		chunk_info.datalen = plac->kuki_size ;
  193|      0|		psf_save_write_chunk (&psf->wchunks, &chunk_info) ;
  194|       |
  195|      0|		memset (&chunk_info, 0, sizeof (chunk_info)) ;
  196|      0|		chunk_info.id_size = snprintf (chunk_info.id, sizeof (chunk_info.id), "pakt") ;
  197|      0|		chunk_info.data = alac_pakt_encode (psf, &pakt_size) ;
  198|      0|		chunk_info.datalen = pakt_size ;
  199|      0|		psf_save_write_chunk (&psf->wchunks, &chunk_info) ;
  200|       |
  201|      0|		free (chunk_info.data) ;
  202|      0|		chunk_info.data = NULL ;
  203|       |
  204|      0|		psf->write_header (psf, 1) ;
  205|       |
  206|      0|		if (plac->enctmp != NULL)
  ------------------
  |  Branch (206:7): [True: 0, False: 0]
  ------------------
  207|      0|		{	fseek (plac->enctmp, 0, SEEK_SET) ;
  208|       |
  209|      0|			while ((readcount = fread (ubuf.ucbuf, 1, sizeof (ubuf.ucbuf), plac->enctmp)) > 0)
  ------------------
  |  Branch (209:11): [True: 0, False: 0]
  ------------------
  210|      0|				psf_fwrite (ubuf.ucbuf, 1, readcount, psf) ;
  211|      0|			fclose (plac->enctmp) ;
  212|      0|			remove (plac->enctmpname) ;
  213|      0|			} ;
  214|      0|		} ;
  215|       |
  216|  1.00k|	if (plac->pakt_info)
  ------------------
  |  Branch (216:6): [True: 948, False: 54]
  ------------------
  217|    948|		free (plac->pakt_info) ;
  218|  1.00k|	plac->pakt_info = NULL ;
  219|       |
  220|  1.00k|	return 0 ;
  221|  1.00k|} /* alac_close */
alac.c:alac_pakt_append:
  787|  43.7k|{
  788|  43.7k|	if (info->count >= info->allocated)
  ------------------
  |  Branch (788:6): [True: 537, False: 43.1k]
  ------------------
  789|    537|	{	PAKT_INFO * temp ;
  790|    537|		uint32_t newcount = info->allocated + info->allocated / 2 ;
  791|       |
  792|    537|		if ((temp = realloc (info, sizeof (PAKT_INFO) + newcount * sizeof (info->packet_size [0]))) == NULL)
  ------------------
  |  Branch (792:7): [True: 0, False: 537]
  ------------------
  793|      0|			return NULL ;
  794|       |
  795|    537|		info = temp ;
  796|    537|		info->allocated = newcount ;
  797|  43.7k|		} ;
  798|       |
  799|  43.7k|	info->packet_size [info->count++] = value ;
  800|  43.7k|	return info ;
  801|  43.7k|} /* alac_pakt_append */
alac.c:alac_reader_init:
  238|  1.00k|{	ALAC_PRIVATE	*plac ;
  239|  1.00k|	uint32_t		kuki_size ;
  240|  1.00k|	int				error ;
  241|  1.00k|	union			{ uint8_t kuki [512] ; uint32_t alignment ; } u ;
  242|       |
  243|  1.00k|	if (info == NULL)
  ------------------
  |  Branch (243:6): [True: 0, False: 1.00k]
  ------------------
  244|      0|	{	psf_log_printf (psf, "%s : ALAC_DECODER_INFO is NULL.\n", __func__) ;
  245|      0|		return SFE_INTERNAL ;
  246|  1.00k|		} ;
  247|       |
  248|  1.00k|	if (info->frames_per_packet > ALAC_FRAME_LENGTH)
  ------------------
  |  |   33|  1.00k|#define		ALAC_FRAME_LENGTH	4096
  ------------------
  |  Branch (248:6): [True: 4, False: 998]
  ------------------
  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|    998|		} ;
  252|       |
  253|    998|	plac = psf->codec_data ;
  254|       |
  255|    998|	plac->channels			= psf->sf.channels ;
  256|    998|	plac->frames_per_block	= info->frames_per_packet ;
  257|    998|	plac->bits_per_sample	= info->bits_per_sample ;
  258|       |
  259|    998|	if (plac->pakt_info != NULL)
  ------------------
  |  Branch (259:6): [True: 0, False: 998]
  ------------------
  260|      0|		free (plac->pakt_info) ;
  261|    998|	plac->pakt_info = alac_pakt_read_decode (psf, info->pakt_offset) ;
  262|       |
  263|    998|	if (plac->pakt_info == NULL)
  ------------------
  |  Branch (263:6): [True: 50, False: 948]
  ------------------
  264|     50|	{	psf_log_printf (psf, "%s : alac_pkt_read() returns NULL.\n", __func__) ;
  265|     50|		return SFE_INTERNAL ;
  266|    948|		} ;
  267|       |
  268|       |	/* Read in the ALAC cookie data and pass it to the init function. */
  269|    948|	kuki_size = alac_kuki_read (psf, info->kuki_offset, u.kuki, sizeof (u.kuki)) ;
  270|       |
  271|    948|	if ((error = alac_decoder_init (&plac->u.decoder, u.kuki, kuki_size)) != ALAC_noErr)
  ------------------
  |  Branch (271:6): [True: 111, False: 837]
  ------------------
  272|    111|	{	psf_log_printf (psf, "*** alac_decoder_init() returned %s. ***\n", alac_error_string (error)) ;
  273|    111|		return SFE_INTERNAL ;
  274|    837|		} ;
  275|       |
  276|       |
  277|    837|	if (plac->u.decoder.mNumChannels != (unsigned) psf->sf.channels)
  ------------------
  |  Branch (277:6): [True: 4, False: 833]
  ------------------
  278|      4|	{	psf_log_printf (psf, "*** Initialized decoder has %u channels, but it should be %d. ***\n", plac->u.decoder.mNumChannels, psf->sf.channels) ;
  279|      4|		return SFE_INTERNAL ;
  280|    833|		} ;
  281|       |
  282|    833|	switch (info->bits_per_sample)
  283|    833|	{	case 16 :
  ------------------
  |  Branch (283:4): [True: 195, False: 638]
  ------------------
  284|    377|		case 20 :
  ------------------
  |  Branch (284:3): [True: 182, False: 651]
  ------------------
  285|    816|		case 24 :
  ------------------
  |  Branch (285:3): [True: 439, False: 394]
  ------------------
  286|    833|		case 32 :
  ------------------
  |  Branch (286:3): [True: 17, False: 816]
  ------------------
  287|    833|			psf->read_short		= alac_read_s ;
  288|    833|			psf->read_int		= alac_read_i ;
  289|    833|			psf->read_float		= alac_read_f ;
  290|    833|			psf->read_double	= alac_read_d ;
  291|    833|			break ;
  292|       |
  293|      0|		default :
  ------------------
  |  Branch (293:3): [True: 0, False: 833]
  ------------------
  294|      0|			printf ("%s : info->bits_per_sample %u\n", __func__, info->bits_per_sample) ;
  295|      0|			return SFE_UNSUPPORTED_ENCODING ;
  296|    833|		} ;
  297|       |
  298|    833|	psf->codec_close	= alac_close ;
  299|    833|	psf->seek			= alac_seek ;
  300|       |
  301|    833|	psf->sf.frames		= alac_reader_calc_frames (psf, plac) ;
  302|    833|	alac_seek (psf, SFM_READ, 0) ;
  303|       |
  304|    833|	return 0 ;
  305|    833|} /* alac_reader_init */
alac.c:alac_pakt_read_decode:
  805|    998|{	SF_CHUNK_INFO chunk_info ;
  806|    998|	PAKT_INFO * info = NULL ;
  807|    998|	uint8_t *pakt_data = NULL ;
  808|    998|	uint32_t bcount, value = 1, pakt_size ;
  809|    998|	SF_CHUNK_ITERATOR * chunk_iterator ;
  810|       |
  811|       |
  812|    998|	memset (&chunk_info, 0, sizeof (chunk_info)) ;
  813|    998|	snprintf (chunk_info.id, sizeof (chunk_info.id), "pakt") ;
  814|    998|	chunk_info.id_size = 4 ;
  815|       |
  816|    998|	if ((chunk_iterator = psf_get_chunk_iterator (psf, chunk_info.id)) == NULL)
  ------------------
  |  Branch (816:6): [True: 50, False: 948]
  ------------------
  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|    948|		} ;
  822|       |
  823|    948|	psf->get_chunk_size (psf, chunk_iterator, &chunk_info) ;
  824|       |
  825|    948|	pakt_size = chunk_info.datalen ;
  826|    948|	chunk_info.data = pakt_data = malloc (pakt_size + 5) ;
  827|    948|	if (!chunk_info.data)
  ------------------
  |  Branch (827:6): [True: 0, False: 948]
  ------------------
  828|      0|		return NULL ;
  829|       |
  830|    948|	if ((bcount = psf->get_chunk_data (psf, chunk_iterator, &chunk_info)) != SF_ERR_NO_ERROR)
  ------------------
  |  Branch (830:6): [True: 0, False: 948]
  ------------------
  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|    948|		} ;
  837|       |
  838|  2.39k|	while (chunk_iterator)
  ------------------
  |  Branch (838:9): [True: 1.44k, False: 948]
  ------------------
  839|  1.44k|		chunk_iterator = psf->next_chunk_iterator (psf, chunk_iterator) ;
  840|       |
  841|    948|	info = alac_pakt_alloc (pakt_size / 4) ;
  842|       |
  843|       |	/* Start at 24 bytes in, skipping over the 'pakt' chunks header. */
  844|  44.6k|	for (bcount = 24 ; bcount < pakt_size && value != 0 ; )
  ------------------
  |  Branch (844:21): [True: 44.0k, False: 623]
  |  Branch (844:43): [True: 43.7k, False: 325]
  ------------------
  845|  43.7k|	{	uint8_t byte ;
  846|  43.7k|		int32_t count = 0 ;
  847|       |
  848|  43.7k|		value = 0 ;
  849|  43.7k|		do
  850|  44.7k|		{	byte = pakt_data [bcount + count] ;
  851|  44.7k|			value = (value << 7) + (byte & 0x7F) ;
  852|       |
  853|  44.7k|			count ++ ;
  854|  44.7k|			if (count > 5 || bcount + count > pakt_size)
  ------------------
  |  Branch (854:8): [True: 43, False: 44.6k]
  |  Branch (854:21): [True: 27, False: 44.6k]
  ------------------
  855|     70|			{	printf ("%s %d : Ooops! count %" PRIi32 "    bcount %" PRIu32 "\n", __func__, __LINE__, count, bcount) ;
  856|     70|				value = 0 ;
  857|     70|				break ;
  858|  44.6k|				} ;
  859|  44.6k|			}
  860|  44.6k|			while (byte & 0x80) ;
  ------------------
  |  Branch (860:11): [True: 1.01k, False: 43.6k]
  ------------------
  861|       |
  862|  43.7k|		bcount += count ;
  863|       |
  864|  43.7k|		if ((info = alac_pakt_append (info, value)) == NULL)
  ------------------
  |  Branch (864:7): [True: 0, False: 43.7k]
  ------------------
  865|      0|			goto FreeExit ;
  866|  43.7k|		} ;
  867|       |
  868|    948|	free (pakt_data) ;
  869|       |
  870|    948|	return info ;
  871|       |
  872|      0|FreeExit :
  873|      0|	free (pakt_data) ;
  874|      0|	free (info) ;
  875|       |	return NULL ;
  876|    948|} /* alac_pakt_read_decode */
alac.c:alac_pakt_alloc:
  773|    948|{	PAKT_INFO * info ;
  774|       |
  775|    948|	if ((info = calloc (1, sizeof (PAKT_INFO) + initial_count * sizeof (info->packet_size [0]))) == NULL)
  ------------------
  |  Branch (775:6): [True: 0, False: 948]
  ------------------
  776|      0|		return NULL ;
  777|       |
  778|    948|	info->allocated = initial_count ;
  779|    948|	info->current = 0 ;
  780|    948|	info->count = 0 ;
  781|       |
  782|    948|	return info ;
  783|    948|} /* alac_pakt_alloc */
alac.c:alac_kuki_read:
  950|    948|{	uint32_t marker ;
  951|    948|	uint64_t kuki_size ;
  952|       |
  953|    948|	if (psf_fseek (psf, kuki_offset, SEEK_SET) != kuki_offset)
  ------------------
  |  Branch (953:6): [True: 0, False: 948]
  ------------------
  954|      0|		return 0 ;
  955|       |
  956|    948|	psf_fread (&marker, 1, sizeof (marker), psf) ;
  957|    948|	if (marker != MAKE_MARKER ('k', 'u', 'k', 'i'))
  ------------------
  |  |  122|    948|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
  |  Branch (957:6): [True: 49, False: 899]
  ------------------
  958|     49|		return 0 ;
  959|       |
  960|    899|	psf_fread (&kuki_size, 1, sizeof (kuki_size), psf) ;
  961|    899|	kuki_size = BE2H_64 (kuki_size) ;
  ------------------
  |  |  142|    899|	#define BE2H_64(x)			ENDSWAP_64 (x)
  |  |  ------------------
  |  |  |  |   36|    899|#define	ENDSWAP_64(x)		(bswap_64 (x))
  |  |  ------------------
  ------------------
  962|       |
  963|    899|	if (kuki_size == 0 || kuki_size > kuki_maxlen)
  ------------------
  |  Branch (963:6): [True: 2, False: 897]
  |  Branch (963:24): [True: 4, False: 893]
  ------------------
  964|      6|	{	psf_log_printf (psf, "%s : Bad size (%D) of 'kuki' chunk.\n", __func__, kuki_size) ;
  965|      6|		return 0 ;
  966|    893|		} ;
  967|       |
  968|    893|	psf_fread (kuki, 1, kuki_size, psf) ;
  969|       |
  970|    893|	return kuki_size ;
  971|    899|} /* alac_kuki_read */
alac.c:alac_error_string:
  977|    111|{	static char errstr [128] ;
  978|    111|	switch (error)
  979|    111|	{	CASE_NAME (kALAC_UnimplementedError) ;
  ------------------
  |  |  973|      0|#define CASE_NAME(x)	case x : return #x ; break ;
  |  |  ------------------
  |  |  |  Branch (973:22): [True: 0, False: 111]
  |  |  ------------------
  ------------------
  980|      0|		CASE_NAME (kALAC_FileNotFoundError) ;
  ------------------
  |  |  973|      0|#define CASE_NAME(x)	case x : return #x ; break ;
  |  |  ------------------
  |  |  |  Branch (973:22): [True: 0, False: 111]
  |  |  ------------------
  ------------------
  981|      0|		CASE_NAME (kALAC_ParamError) ;
  ------------------
  |  |  973|      0|#define CASE_NAME(x)	case x : return #x ; break ;
  |  |  ------------------
  |  |  |  Branch (973:22): [True: 0, False: 111]
  |  |  ------------------
  ------------------
  982|      0|		CASE_NAME (kALAC_MemFullError) ;
  ------------------
  |  |  973|      0|#define CASE_NAME(x)	case x : return #x ; break ;
  |  |  ------------------
  |  |  |  Branch (973:22): [True: 0, False: 111]
  |  |  ------------------
  ------------------
  983|     34|		CASE_NAME (fALAC_FrameLengthError) ;
  ------------------
  |  |  973|     34|#define CASE_NAME(x)	case x : return #x ; break ;
  |  |  ------------------
  |  |  |  Branch (973:22): [True: 34, False: 77]
  |  |  ------------------
  ------------------
  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: 102]
  |  |  ------------------
  ------------------
  987|      8|		CASE_NAME (kALAC_IncompatibleVersion) ;
  ------------------
  |  |  973|      8|#define CASE_NAME(x)	case x : return #x ; break ;
  |  |  ------------------
  |  |  |  Branch (973:22): [True: 8, False: 103]
  |  |  ------------------
  ------------------
  988|     60|		CASE_NAME (kALAC_BadSpecificConfigSize) ;
  ------------------
  |  |  973|     60|#define CASE_NAME(x)	case x : return #x ; break ;
  |  |  ------------------
  |  |  |  Branch (973:22): [True: 60, False: 51]
  |  |  ------------------
  ------------------
  989|      0|		CASE_NAME (kALAC_ZeroChannelCount) ;
  ------------------
  |  |  973|      0|#define CASE_NAME(x)	case x : return #x ; break ;
  |  |  ------------------
  |  |  |  Branch (973:22): [True: 0, False: 111]
  |  |  ------------------
  ------------------
  990|      0|		CASE_NAME (kALAC_NumSamplesTooBig) ;
  ------------------
  |  |  973|      0|#define CASE_NAME(x)	case x : return #x ; break ;
  |  |  ------------------
  |  |  |  Branch (973:22): [True: 0, False: 111]
  |  |  ------------------
  ------------------
  991|      0|		CASE_NAME (kALAC_UnsupportedElement) ;
  ------------------
  |  |  973|      0|#define CASE_NAME(x)	case x : return #x ; break ;
  |  |  ------------------
  |  |  |  Branch (973:22): [True: 0, False: 111]
  |  |  ------------------
  ------------------
  992|      0|		default :
  ------------------
  |  Branch (992:3): [True: 0, False: 111]
  ------------------
  993|      0|			break ;
  994|    111|		} ;
  995|       |
  996|      0|	snprintf (errstr, sizeof (errstr), "Unknown error %d", error) ;
  997|      0|	return errstr ;
  998|    111|} /* alac_error_string */
alac.c:alac_decode_block:
  405|  28.5k|{	ALAC_DECODER *pdec = &plac->u.decoder ;
  406|  28.5k|	uint32_t	packet_size ;
  407|  28.5k|	BitBuffer	bit_buffer ;
  408|       |
  409|  28.5k|	packet_size = alac_reader_next_packet_size (plac->pakt_info) ;
  410|  28.5k|	if (packet_size == 0)
  ------------------
  |  Branch (410:6): [True: 466, False: 28.1k]
  ------------------
  411|    466|	{	if (plac->pakt_info->current < plac->pakt_info->count)
  ------------------
  |  Branch (411:8): [True: 0, False: 466]
  ------------------
  412|      0|			psf_log_printf (psf, "packet_size is 0 (%d of %d)\n", plac->pakt_info->current, plac->pakt_info->count) ;
  413|    466|		return 0 ;
  414|  28.1k|		} ;
  415|       |
  416|  28.1k|	psf_fseek (psf, plac->input_data_pos, SEEK_SET) ;
  417|       |
  418|  28.1k|	if (packet_size > sizeof (plac->byte_buffer))
  ------------------
  |  Branch (418:6): [True: 90, False: 28.0k]
  ------------------
  419|     90|	{	psf_log_printf (psf, "%s : bad packet_size (%u)\n", __func__, packet_size) ;
  420|     90|		return 0 ;
  421|  28.0k|		} ;
  422|       |
  423|  28.0k|	if ((packet_size != psf_fread (plac->byte_buffer, 1, packet_size, psf)))
  ------------------
  |  Branch (423:6): [True: 680, False: 27.3k]
  ------------------
  424|    680|		return 0 ;
  425|       |
  426|  27.3k|	BitBufferInit (&bit_buffer, plac->byte_buffer, packet_size) ;
  427|       |
  428|  27.3k|	plac->input_data_pos += packet_size ;
  429|  27.3k|	plac->frames_this_block = 0 ;
  430|  27.3k|	alac_decode (pdec, &bit_buffer, plac->buffer, plac->frames_per_block, &plac->frames_this_block) ;
  431|       |
  432|  27.3k|	plac->partial_block_frames = 0 ;
  433|       |
  434|  27.3k|	return 1 ;
  435|  28.0k|} /* alac_decode_block */
alac.c:alac_reader_next_packet_size:
  371|  68.9k|{	if (info->current >= info->count)
  ------------------
  |  Branch (371:7): [True: 697, False: 68.2k]
  ------------------
  372|    697|		return 0 ;
  373|  68.2k|	return info->packet_size [info->current++] ;
  374|  68.9k|} /* alac_reader_next_packet_size */
alac.c:alac_read_f:
  521|  8.85M|{	ALAC_PRIVATE *plac ;
  522|  8.85M|	int			*iptr ;
  523|  8.85M|	int			k, readcount ;
  524|  8.85M|	sf_count_t	total = 0 ;
  525|  8.85M|	float		normfact ;
  526|       |
  527|  8.85M|	if ((plac = (ALAC_PRIVATE*) psf->codec_data) == NULL)
  ------------------
  |  Branch (527:6): [True: 0, False: 8.85M]
  ------------------
  528|      0|		return 0 ;
  529|       |
  530|  8.85M|	normfact = (psf->norm_float == SF_TRUE) ? 1.0 / ((float) 0x80000000) : 1.0 ;
  ------------------
  |  Branch (530:13): [True: 8.85M, False: 0]
  ------------------
  531|       |
  532|  17.7M|	while (len > 0)
  ------------------
  |  Branch (532:9): [True: 8.86M, False: 8.85M]
  ------------------
  533|  8.86M|	{	if (plac->partial_block_frames >= plac->frames_this_block && alac_decode_block (psf, plac) == 0)
  ------------------
  |  Branch (533:8): [True: 27.2k, False: 8.83M]
  |  Branch (533:65): [True: 366, False: 26.8k]
  ------------------
  534|    366|			break ;
  535|       |
  536|  8.86M|		readcount = (plac->frames_this_block - plac->partial_block_frames) * plac->channels ;
  537|  8.86M|		readcount = readcount > len ? (int) len : readcount ;
  ------------------
  |  Branch (537:15): [True: 8.83M, False: 26.8k]
  ------------------
  538|       |
  539|  8.86M|		iptr = plac->buffer + plac->partial_block_frames * plac->channels ;
  540|       |
  541|   177M|		for (k = 0 ; k < readcount ; k++)
  ------------------
  |  Branch (541:16): [True: 168M, False: 8.86M]
  ------------------
  542|   168M|			ptr [total + k] = normfact * iptr [k] ;
  543|       |
  544|  8.86M|		plac->partial_block_frames += readcount / plac->channels ;
  545|  8.86M|		total += readcount ;
  546|  8.86M|		len -= readcount ;
  547|  8.86M|		} ;
  548|       |
  549|  8.85M|	return total ;
  550|  8.85M|} /* alac_read_f */
alac.c:alac_seek:
  590|  1.66k|{	ALAC_PRIVATE *plac ;
  591|  1.66k|	int			newblock, newsample ;
  592|       |
  593|  1.66k|	if (! psf->codec_data)
  ------------------
  |  Branch (593:6): [True: 0, False: 1.66k]
  ------------------
  594|      0|		return 0 ;
  595|  1.66k|	plac = (ALAC_PRIVATE*) psf->codec_data ;
  596|       |
  597|  1.66k|	if (psf->datalength < 0 || psf->dataoffset < 0)
  ------------------
  |  Branch (597:6): [True: 4, False: 1.66k]
  |  Branch (597:29): [True: 0, False: 1.66k]
  ------------------
  598|      4|	{	psf->error = SFE_BAD_SEEK ;
  599|      4|		return PSF_SEEK_ERROR ;
  ------------------
  |  |   83|      4|#define	PSF_SEEK_ERROR			((sf_count_t) -1)
  ------------------
  600|  1.66k|		} ;
  601|       |
  602|  1.66k|	if (offset == 0)
  ------------------
  |  Branch (602:6): [True: 1.13k, False: 526]
  ------------------
  603|  1.13k|	{	psf_fseek (psf, psf->dataoffset, SEEK_SET) ;
  604|       |
  605|  1.13k|		plac->frames_this_block = 0 ;
  606|  1.13k|		plac->input_data_pos = psf->dataoffset ;
  607|  1.13k|		plac->pakt_info->current = 0 ;
  608|  1.13k|		return 0 ;
  609|  1.13k|		} ;
  610|       |
  611|    526|	if (offset < 0 || offset > plac->pakt_info->count * plac->frames_per_block)
  ------------------
  |  Branch (611:6): [True: 0, False: 526]
  |  Branch (611:20): [True: 0, False: 526]
  ------------------
  612|      0|	{	psf->error = SFE_BAD_SEEK ;
  613|      0|		return	PSF_SEEK_ERROR ;
  ------------------
  |  |   83|      0|#define	PSF_SEEK_ERROR			((sf_count_t) -1)
  ------------------
  614|    526|		} ;
  615|       |
  616|    526|	newblock	= offset / plac->frames_per_block ;
  617|    526|	newsample	= offset % plac->frames_per_block ;
  618|       |
  619|    526|	if (mode == SFM_READ)
  ------------------
  |  Branch (619:6): [True: 526, False: 0]
  ------------------
  620|    526|	{	plac->input_data_pos = psf->dataoffset + alac_pakt_block_offset (plac->pakt_info, newblock) ;
  621|       |
  622|    526|		plac->pakt_info->current = newblock ;
  623|    526|		alac_decode_block (psf, plac) ;
  624|    526|		plac->partial_block_frames = newsample ;
  625|    526|		}
  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|    526|		} ;
  631|       |
  632|    526|	return newblock * plac->frames_per_block + newsample ;
  633|    526|} /* alac_seek */
alac.c:alac_pakt_block_offset:
  939|    526|{	sf_count_t offset = 0 ;
  940|    526|	uint32_t k ;
  941|       |
  942|  39.3k|	for (k = 0 ; k < block ; k++)
  ------------------
  |  Branch (942:15): [True: 38.8k, False: 526]
  ------------------
  943|  38.8k|		offset += info->packet_size [k] ;
  944|       |
  945|    526|	return offset ;
  946|    526|} /* alac_pakt_block_offset */
alac.c:alac_reader_calc_frames:
  378|    833|{	sf_count_t	frames = 0 ;
  379|    833|	uint32_t	current_pos = 1, blocks = 0 ;
  380|       |
  381|    833|	plac->pakt_info->current = 0 ;
  382|       |
  383|  41.2k|	while (current_pos < psf->filelength && current_pos > 0)
  ------------------
  |  Branch (383:9): [True: 41.0k, False: 154]
  |  Branch (383:42): [True: 40.3k, False: 679]
  ------------------
  384|  40.3k|	{	current_pos = alac_reader_next_packet_size (plac->pakt_info) ;
  385|  40.3k|		blocks = current_pos > 0 ? blocks + 1 : blocks ;
  ------------------
  |  Branch (385:12): [True: 39.7k, False: 679]
  ------------------
  386|  40.3k|		} ;
  387|       |
  388|    833|	if (blocks == 0)
  ------------------
  |  Branch (388:6): [True: 2, False: 831]
  ------------------
  389|      2|		return 0 ;
  390|       |
  391|       |	/* Only count full blocks. */
  392|    831|	frames = plac->frames_per_block * (blocks - 1) ;
  393|       |
  394|    831|	alac_seek (psf, SFM_READ, frames) ;
  395|    831|	alac_decode_block (psf, plac) ;
  396|    831|	frames += plac->frames_this_block ;
  397|       |
  398|    831|	plac->pakt_info->current = 0 ;
  399|       |
  400|    831|	return frames ;
  401|    833|} /* alac_reader_calc_frames */

alaw_init:
   50|    345|{
   51|    345|	if (psf->file.mode == SFM_READ || psf->file.mode == SFM_RDWR)
  ------------------
  |  Branch (51:6): [True: 345, False: 0]
  |  Branch (51:36): [True: 0, False: 0]
  ------------------
   52|    345|	{	psf->read_short		= alaw_read_alaw2s ;
   53|    345|		psf->read_int		= alaw_read_alaw2i ;
   54|    345|		psf->read_float		= alaw_read_alaw2f ;
   55|    345|		psf->read_double	= alaw_read_alaw2d ;
   56|    345|		} ;
   57|       |
   58|    345|	if (psf->file.mode == SFM_WRITE || psf->file.mode == SFM_RDWR)
  ------------------
  |  Branch (58:6): [True: 0, False: 345]
  |  Branch (58:37): [True: 0, False: 345]
  ------------------
   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|    345|	psf->bytewidth = 1 ;
   66|    345|	psf->blockwidth = psf->sf.channels ;
   67|       |
   68|    345|	if (psf->filelength > psf->dataoffset)
  ------------------
  |  Branch (68:6): [True: 216, False: 129]
  ------------------
   69|    216|		psf->datalength = (psf->dataend) ? psf->dataend - psf->dataoffset : psf->filelength - psf->dataoffset ;
  ------------------
  |  Branch (69:21): [True: 93, False: 123]
  ------------------
   70|    129|	else
   71|    129|		psf->datalength = 0 ;
   72|       |
   73|    345|	psf->sf.frames = psf->blockwidth > 0 ? psf->datalength / psf->blockwidth : 0 ;
  ------------------
  |  Branch (73:19): [True: 307, False: 38]
  ------------------
   74|       |
   75|    345|	return 0 ;
   76|    345|} /* alaw_init */
alaw.c:alaw_read_alaw2f:
  410|   168k|{	BUF_UNION	ubuf ;
  411|   168k|	int			bufferlen, readcount ;
  412|   168k|	sf_count_t	total = 0 ;
  413|   168k|	float	normfact ;
  414|       |
  415|   168k|	normfact = (psf->norm_float == SF_TRUE) ? 1.0 / ((float) 0x8000) : 1.0 ;
  ------------------
  |  Branch (415:13): [True: 168k, False: 0]
  ------------------
  416|       |
  417|   168k|	bufferlen = ARRAY_LEN (ubuf.ucbuf) ;
  ------------------
  |  |   93|   168k|#define		ARRAY_LEN(x)	((int) (sizeof (x) / sizeof ((x) [0])))
  ------------------
  418|       |
  419|   336k|	while (len > 0)
  ------------------
  |  Branch (419:9): [True: 168k, False: 168k]
  ------------------
  420|   168k|	{	if (len < bufferlen)
  ------------------
  |  Branch (420:8): [True: 168k, False: 0]
  ------------------
  421|   168k|			bufferlen = (int) len ;
  422|   168k|		readcount = (int) psf_fread (ubuf.ucbuf, 1, bufferlen, psf) ;
  423|   168k|		alaw2f_array (ubuf.ucbuf, readcount, ptr + total, normfact) ;
  424|   168k|		total += readcount ;
  425|   168k|		if (readcount < bufferlen)
  ------------------
  |  Branch (425:7): [True: 38, False: 168k]
  ------------------
  426|     38|			break ;
  427|   168k|		len -= readcount ;
  428|   168k|		} ;
  429|       |
  430|   168k|	return total ;
  431|   168k|} /* alaw_read_alaw2f */
alaw.c:alaw2f_array:
  307|  2.34M|{	for (int i = 0 ; i < count ; i++)
  ------------------
  |  Branch (307:20): [True: 2.18M, False: 168k]
  ------------------
  308|  2.18M|		ptr [i] = normfact * alaw_decode [(int) buffer [i]] ;
  309|   168k|} /* 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: 5, False: 998]
  ------------------
  115|      5|		return	SFE_BAD_OPEN_FORMAT ;
  116|       |
  117|    998|	subformat = SF_CODEC (psf->sf.format) ;
  ------------------
  |  |  109|    998|#define SF_CODEC(x)			((x) & SF_FORMAT_SUBMASK)
  ------------------
  118|       |
  119|    998|	if (psf->file.mode == SFM_WRITE || psf->file.mode == SFM_RDWR)
  ------------------
  |  Branch (119:6): [True: 0, False: 998]
  |  Branch (119:37): [True: 0, False: 998]
  ------------------
  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|    998|		} ;
  131|       |
  132|    998|	psf->container_close = au_close ;
  133|       |
  134|    998|	psf->blockwidth = psf->bytewidth * psf->sf.channels ;
  135|       |
  136|    998|	switch (subformat)
  137|    998|	{	case SF_FORMAT_ULAW :	/* 8-bit Ulaw encoding. */
  ------------------
  |  Branch (137:4): [True: 60, False: 938]
  ------------------
  138|     60|				ulaw_init (psf) ;
  139|     60|				break ;
  140|       |
  141|     35|		case SF_FORMAT_PCM_S8 :	/* 8-bit linear PCM. */
  ------------------
  |  Branch (141:3): [True: 35, False: 963]
  ------------------
  142|     35|				error = pcm_init (psf) ;
  143|     35|				break ;
  144|       |
  145|     44|		case SF_FORMAT_PCM_16 :	/* 16-bit linear PCM. */
  ------------------
  |  Branch (145:3): [True: 44, False: 954]
  ------------------
  146|    101|		case SF_FORMAT_PCM_24 :	/* 24-bit linear PCM */
  ------------------
  |  Branch (146:3): [True: 57, False: 941]
  ------------------
  147|    148|		case SF_FORMAT_PCM_32 :	/* 32-bit linear PCM. */
  ------------------
  |  Branch (147:3): [True: 47, False: 951]
  ------------------
  148|    148|				error = pcm_init (psf) ;
  149|    148|				break ;
  150|       |
  151|     80|		case SF_FORMAT_ALAW :	/* 8-bit Alaw encoding. */
  ------------------
  |  Branch (151:3): [True: 80, False: 918]
  ------------------
  152|     80|				alaw_init (psf) ;
  153|     80|				break ;
  154|       |
  155|       |		/* Lite remove start */
  156|     92|		case SF_FORMAT_FLOAT :	/* 32-bit floats. */
  ------------------
  |  Branch (156:3): [True: 92, False: 906]
  ------------------
  157|     92|				error = float32_init (psf) ;
  158|     92|				break ;
  159|       |
  160|     98|		case SF_FORMAT_DOUBLE :	/* 64-bit double precision floats. */
  ------------------
  |  Branch (160:3): [True: 98, False: 900]
  ------------------
  161|     98|				error = double64_init (psf) ;
  162|     98|				break ;
  163|       |
  164|     85|		case SF_FORMAT_G721_32 :
  ------------------
  |  Branch (164:3): [True: 85, False: 913]
  ------------------
  165|     85|				error = g72x_init (psf) ;
  166|     85|				psf->sf.seekable = SF_FALSE ;
  167|     85|				break ;
  168|       |
  169|    333|		case SF_FORMAT_G723_24 :
  ------------------
  |  Branch (169:3): [True: 333, False: 665]
  ------------------
  170|    333|				error = g72x_init (psf) ;
  171|    333|				psf->sf.seekable = SF_FALSE ;
  172|    333|				break ;
  173|       |
  174|     67|		case SF_FORMAT_G723_40 :
  ------------------
  |  Branch (174:3): [True: 67, False: 931]
  ------------------
  175|     67|				error = g72x_init (psf) ;
  176|     67|				psf->sf.seekable = SF_FALSE ;
  177|     67|				break ;
  178|       |		/* Lite remove end */
  179|       |
  180|      0|		default :	break ;
  ------------------
  |  Branch (180:3): [True: 0, False: 998]
  ------------------
  181|    998|		} ;
  182|       |
  183|    998|	return error ;
  184|    998|} /* au_open */
au.c:au_close:
  191|    998|{
  192|    998|	if (psf->file.mode == SFM_WRITE || psf->file.mode == SFM_RDWR)
  ------------------
  |  Branch (192:6): [True: 0, False: 998]
  |  Branch (192:37): [True: 0, False: 998]
  ------------------
  193|      0|		au_write_header (psf, SF_TRUE) ;
  194|       |
  195|    998|	return 0 ;
  196|    998|} /* 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: 584, False: 670]
  ------------------
  301|    584|	{	psf->endian = SF_ENDIAN_BIG ;
  302|       |
  303|    584|		psf_binheader_readf (psf, "E44444", &(au_fmt.dataoffset), &(au_fmt.datasize),
  304|    584|					&(au_fmt.encoding), &(au_fmt.samplerate), &(au_fmt.channels)) ;
  305|    584|		}
  306|    670|	else if (marker == DNSDOT_MARKER)
  ------------------
  |  |   35|    670|#define DNSDOT_MARKER	(MAKE_MARKER ('d', 'n', 's', '.'))
  |  |  ------------------
  |  |  |  |  122|    670|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (306:11): [True: 670, False: 0]
  ------------------
  307|    670|	{	psf->endian = SF_ENDIAN_LITTLE ;
  308|    670|		psf_binheader_readf (psf, "e44444", &(au_fmt.dataoffset), &(au_fmt.datasize),
  309|    670|					&(au_fmt.encoding), &(au_fmt.samplerate), &(au_fmt.channels)) ;
  310|    670|		}
  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: 69, False: 1.18k]
  |  Branch (316:29): [True: 1, False: 68]
  ------------------
  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: 68, False: 1.18k]
  ------------------
  323|     68|	{	psf->filelength = data_end ;
  324|     68|		psf_log_printf (psf, "  Data Size   : %d\n", au_fmt.datasize) ;
  325|     68|		}
  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: 3, False: 1.17k]
  ------------------
  327|     13|		psf_log_printf (psf, "  Data Size   : %d\n", au_fmt.datasize) ;
  328|  1.17k|	else if (data_end < psf->filelength)
  ------------------
  |  Branch (328:11): [True: 421, False: 751]
  ------------------
  329|    421|	{	psf->filelength = data_end ;
  330|    421|		psf_log_printf (psf, "  Data Size   : %d\n", au_fmt.datasize) ;
  331|    421|		}
  332|    751|	else
  333|    751|	{	dword = psf->filelength - au_fmt.dataoffset ;
  334|    751|		psf_log_printf (psf, "  Data Size   : %d (should be %d)\n", au_fmt.datasize, dword) ;
  335|    751|		au_fmt.datasize = dword ;
  336|    751|		} ;
  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: 260, False: 993]
  ------------------
  342|    260|		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: 583, False: 670]
  ------------------
  349|    583|		psf->sf.format = SF_FORMAT_AU ;
  350|    670|	else if (psf->endian == SF_ENDIAN_LITTLE)
  ------------------
  |  Branch (350:11): [True: 670, False: 0]
  ------------------
  351|    670|		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: 61, False: 1.19k]
  ------------------
  359|     61|				psf->sf.format |= SF_FORMAT_AU | SF_FORMAT_ULAW ;
  360|     61|				psf->bytewidth = 1 ;	/* Before decoding */
  361|     61|				psf_log_printf (psf, "8-bit ISDN u-law\n") ;
  362|     61|				break ;
  363|       |
  364|     36|		case AU_ENCODING_PCM_8 :
  ------------------
  |  Branch (364:3): [True: 36, False: 1.21k]
  ------------------
  365|     36|				psf->sf.format |= SF_FORMAT_AU | SF_FORMAT_PCM_S8 ;
  366|     36|				psf->bytewidth = 1 ;
  367|     36|				psf_log_printf (psf, "8-bit linear PCM\n") ;
  368|     36|				break ;
  369|       |
  370|     45|		case AU_ENCODING_PCM_16 :
  ------------------
  |  Branch (370:3): [True: 45, False: 1.20k]
  ------------------
  371|     45|				psf->sf.format |= SF_FORMAT_AU | SF_FORMAT_PCM_16 ;
  372|     45|				psf->bytewidth = 2 ;
  373|     45|				psf_log_printf (psf, "16-bit linear PCM\n") ;
  374|     45|				break ;
  375|       |
  376|     58|		case AU_ENCODING_PCM_24 :
  ------------------
  |  Branch (376:3): [True: 58, False: 1.19k]
  ------------------
  377|     58|				psf->sf.format |= SF_FORMAT_AU | SF_FORMAT_PCM_24 ;
  378|     58|				psf->bytewidth = 3 ;
  379|     58|				psf_log_printf (psf, "24-bit linear PCM\n") ;
  380|     58|				break ;
  381|       |
  382|     49|		case AU_ENCODING_PCM_32 :
  ------------------
  |  Branch (382:3): [True: 49, False: 1.20k]
  ------------------
  383|     49|				psf->sf.format |= SF_FORMAT_AU | SF_FORMAT_PCM_32 ;
  384|     49|				psf->bytewidth = 4 ;
  385|     49|				psf_log_printf (psf, "32-bit linear PCM\n") ;
  386|     49|				break ;
  387|       |
  388|     93|		case AU_ENCODING_FLOAT :
  ------------------
  |  Branch (388:3): [True: 93, False: 1.16k]
  ------------------
  389|     93|				psf->sf.format |= SF_FORMAT_AU | SF_FORMAT_FLOAT ;
  390|     93|				psf->bytewidth = 4 ;
  391|     93|				psf_log_printf (psf, "32-bit float\n") ;
  392|     93|				break ;
  393|       |
  394|    100|		case AU_ENCODING_DOUBLE :
  ------------------
  |  Branch (394:3): [True: 100, False: 1.15k]
  ------------------
  395|    100|				psf->sf.format |= SF_FORMAT_AU | SF_FORMAT_DOUBLE ;
  396|    100|				psf->bytewidth = 8 ;
  397|    100|				psf_log_printf (psf, "64-bit double precision float\n") ;
  398|    100|				break ;
  399|       |
  400|     81|		case AU_ENCODING_ALAW_8 :
  ------------------
  |  Branch (400:3): [True: 81, False: 1.17k]
  ------------------
  401|     81|				psf->sf.format |= SF_FORMAT_AU | SF_FORMAT_ALAW ;
  402|     81|				psf->bytewidth = 1 ;	/* Before decoding */
  403|     81|				psf_log_printf (psf, "8-bit ISDN A-law\n") ;
  404|     81|				break ;
  405|       |
  406|     86|		case AU_ENCODING_ADPCM_G721_32 :
  ------------------
  |  Branch (406:3): [True: 86, False: 1.16k]
  ------------------
  407|     86|				psf->sf.format |= SF_FORMAT_AU | SF_FORMAT_G721_32 ;
  408|     86|				psf->bytewidth = 0 ;
  409|     86|				psf_log_printf (psf, "G721 32kbs ADPCM\n") ;
  410|     86|				break ;
  411|       |
  412|    334|		case AU_ENCODING_ADPCM_G723_24 :
  ------------------
  |  Branch (412:3): [True: 334, False: 919]
  ------------------
  413|    334|				psf->sf.format |= SF_FORMAT_AU | SF_FORMAT_G723_24 ;
  414|    334|				psf->bytewidth = 0 ;
  415|    334|				psf_log_printf (psf, "G723 24kbs ADPCM\n") ;
  416|    334|				break ;
  417|       |
  418|     68|		case AU_ENCODING_ADPCM_G723_40 :
  ------------------
  |  Branch (418:3): [True: 68, False: 1.18k]
  ------------------
  419|     68|				psf->sf.format |= SF_FORMAT_AU | SF_FORMAT_G723_40 ;
  420|     68|				psf->bytewidth = 0 ;
  421|     68|				psf_log_printf (psf, "G723 40kbs ADPCM\n") ;
  422|     68|				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|    240|		default :
  ------------------
  |  Branch (432:3): [True: 240, False: 1.01k]
  ------------------
  433|    240|				psf_log_printf (psf, "Unknown!!\n") ;
  434|    240|				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: 236, False: 1.01k]
  ------------------
  439|    236|	{	psf_log_printf (psf, "  Channels    : %d  **** should be >= 1\n", au_fmt.channels) ;
  440|    236|		return SFE_CHANNEL_COUNT_ZERO ;
  441|    236|		}
  442|  1.01k|	else if (au_fmt.channels > SF_MAX_CHANNELS)
  ------------------
  |  |  102|  1.01k|#define		SF_MAX_CHANNELS		1024
  ------------------
  |  Branch (442:11): [True: 14, False: 1.00k]
  ------------------
  443|     14|	{	psf_log_printf (psf, "  Channels    : %d  **** should be <= %d\n", au_fmt.channels, SF_MAX_CHANNELS) ;
  ------------------
  |  |  102|     14|#define		SF_MAX_CHANNELS		1024
  ------------------
  444|     14|		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: 513, False: 490]
  ------------------
  452|    513|		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.07k|{	VOTE vote ;
   49|       |
   50|  3.07k|	if (psf == NULL)
  ------------------
  |  Branch (50:6): [True: 0, False: 3.07k]
  ------------------
   51|      0|		return 0 ;
   52|       |
   53|  3.07k|	if (ad == NULL || datalen < 256)
  ------------------
  |  Branch (53:6): [True: 0, False: 3.07k]
  |  Branch (53:20): [True: 0, False: 3.07k]
  ------------------
   54|      0|		return 0 ;
   55|       |
   56|  3.07k|	vote_for_format (&vote, data, datalen) ;
   57|       |
   58|  3.07k|	psf_log_printf (psf, "audio_detect :\n"
   59|  3.07k|			"    le_float     : %d\n"
   60|  3.07k|			"    be_float     : %d\n"
   61|  3.07k|			"    le_int_24_32 : %d\n"
   62|  3.07k|			"    be_int_24_32 : %d\n",
   63|  3.07k|			vote.le_float, vote.be_float, vote.le_int_24_32, vote.be_int_24_32) ;
   64|       |
   65|  3.07k|	if (0) puts (psf->parselog.buf) ;
  ------------------
  |  Branch (65:6): [Folded, False: 3.07k]
  ------------------
   66|       |
   67|  3.07k|	if (ad->endianness == SF_ENDIAN_LITTLE && vote.le_float > (3 * datalen) / 4)
  ------------------
  |  Branch (67:6): [True: 3.07k, False: 0]
  |  Branch (67:44): [True: 6, False: 3.06k]
  ------------------
   68|      6|	{	/* Almost certainly 32 bit floats. */
   69|      6|		return SF_FORMAT_FLOAT ;
   70|  3.06k|		} ;
   71|       |
   72|  3.06k|	if (ad->endianness == SF_ENDIAN_LITTLE && vote.le_int_24_32 > (3 * datalen) / 4)
  ------------------
  |  Branch (72:6): [True: 3.06k, False: 0]
  |  Branch (72:44): [True: 6, False: 3.06k]
  ------------------
   73|      6|	{	/* Almost certainly 24 bit data stored in 32 bit ints. */
   74|      6|		return SF_FORMAT_PCM_32 ;
   75|  3.06k|		} ;
   76|       |
   77|  3.06k|	return 0 ;
   78|  3.06k|} /* data_detect */
audio_detect.c:vote_for_format:
   82|  3.07k|{
   83|  3.07k|	int k ;
   84|       |
   85|  3.07k|	memset (vote, 0, sizeof (VOTE)) ;
   86|       |
   87|  3.07k|	datalen -= datalen % 4 ;
   88|       |
   89|  12.5M|	for (k = 0 ; k < datalen ; k ++)
  ------------------
  |  Branch (89:15): [True: 12.5M, False: 3.07k]
  ------------------
   90|  12.5M|	{	if ((k % 4) == 0)
  ------------------
  |  Branch (90:8): [True: 3.14M, False: 9.44M]
  ------------------
   91|  3.14M|		{	if (data [k] == 0 && data [k + 1] != 0)
  ------------------
  |  Branch (91:9): [True: 2.70M, False: 437k]
  |  Branch (91:26): [True: 18.0k, False: 2.69M]
  ------------------
   92|  18.0k|				vote->le_int_24_32 += 4 ;
   93|       |
   94|  3.14M|			if (data [2] != 0 && data [3] == 0)
  ------------------
  |  Branch (94:8): [True: 448k, False: 2.69M]
  |  Branch (94:25): [True: 6.14k, False: 442k]
  ------------------
   95|  6.14k|				vote->le_int_24_32 += 4 ;
   96|       |
   97|  3.14M|			if (data [0] != 0 && data [3] > 0x43 && data [3] < 0x4B)
  ------------------
  |  Branch (97:8): [True: 451k, False: 2.69M]
  |  Branch (97:25): [True: 414k, False: 36.8k]
  |  Branch (97:44): [True: 6.14k, False: 408k]
  ------------------
   98|  6.14k|				vote->le_float += 4 ;
   99|       |
  100|  3.14M|			if (data [3] != 0 && data [0] > 0x43 && data [0] < 0x4B)
  ------------------
  |  Branch (100:8): [True: 462k, False: 2.68M]
  |  Branch (100:25): [True: 408k, False: 54.2k]
  |  Branch (100:44): [True: 13.3k, False: 395k]
  ------------------
  101|  13.3k|				vote->be_float += 4 ;
  102|  3.14M|			} ;
  103|  12.5M|		} ;
  104|       |
  105|  3.07k|	return ;
  106|  3.07k|} /* vote_for_format */

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

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

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

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

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

psf_get_chunk_iterator:
   42|    998|{	const READ_CHUNKS * pchk = &psf->rchunks ;
   43|    998|	int idx ;
   44|       |
   45|    998|	if (marker_str)
  ------------------
  |  Branch (45:6): [True: 998, False: 0]
  ------------------
   46|    998|		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|    998|	if (idx < 0)
  ------------------
  |  Branch (50:6): [True: 50, False: 948]
  ------------------
   51|     50|		return NULL ;
   52|       |
   53|    948|	if (psf->iterator == NULL)
  ------------------
  |  Branch (53:6): [True: 948, False: 0]
  ------------------
   54|    948|	{	psf->iterator = calloc (1, sizeof (SF_CHUNK_ITERATOR)) ;
   55|    948|		if (psf->iterator == NULL)
  ------------------
  |  Branch (55:7): [True: 0, False: 948]
  ------------------
   56|      0|			return NULL ;
   57|    948|		} ;
   58|       |
   59|    948|	psf->iterator->sndfile = (SNDFILE *) psf ;
   60|       |
   61|    948|	if (marker_str)
  ------------------
  |  Branch (61:6): [True: 948, False: 0]
  ------------------
   62|    948|	{	int64_t hash ;
   63|    948|		size_t marker_len ;
   64|    948|		union
   65|    948|		{	uint32_t marker ;
   66|    948|			char str [5] ;
   67|    948|		} u ;
   68|       |
   69|    948|		snprintf (u.str, sizeof (u.str), "%s", marker_str) ;
   70|       |
   71|    948|		marker_len = strlen (marker_str) ;
   72|    948|		if (marker_len > 64)
  ------------------
  |  Branch (72:7): [True: 0, False: 948]
  ------------------
   73|      0|			marker_len = 64 ;
   74|       |
   75|    948|		hash = marker_len > 4 ? hash_of_str (marker_str) : u.marker ;
  ------------------
  |  Branch (75:10): [True: 0, False: 948]
  ------------------
   76|       |
   77|    948|		memcpy (psf->iterator->id, marker_str, marker_len) ;
   78|    948|		psf->iterator->id_size = (unsigned) marker_len ;
   79|    948|		psf->iterator->hash = hash ;
   80|    948|		}
   81|       |
   82|    948|	psf->iterator->current = idx ;
   83|       |
   84|    948|	return psf->iterator ;
   85|    948|} /* psf_get_chunk_iterator */
psf_next_chunk_iterator:
   89|  1.44k|{	uint64_t hash = iterator->hash ;
   90|  1.44k|	uint32_t k ;
   91|       |
   92|  1.44k|	iterator->current++ ;
   93|       |
   94|  1.44k|	if (hash)
  ------------------
  |  Branch (94:6): [True: 1.44k, False: 0]
  ------------------
   95|  2.71k|	{	for (k = iterator->current ; k < pchk->used ; k++)
  ------------------
  |  Branch (95:33): [True: 1.76k, False: 948]
  ------------------
   96|  1.76k|			if (pchk->chunks [k].hash == hash)
  ------------------
  |  Branch (96:8): [True: 497, False: 1.27k]
  ------------------
   97|    497|			{	iterator->current = k ;
   98|    497|				return iterator ;
   99|    497|				}
  100|  1.44k|		}
  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|    948|	memset (iterator, 0, sizeof (*iterator)) ;
  106|       |	return NULL ;
  107|  1.44k|} /* psf_next_chunk_iterator */
psf_store_read_chunk_u32:
  144|   765k|{	READ_CHUNK rchunk ;
  145|       |
  146|   765k|	memset (&rchunk, 0, sizeof (rchunk)) ;
  147|       |
  148|   765k|	rchunk.hash = marker ;
  149|   765k|	rchunk.mark32 = marker ;
  150|   765k|	rchunk.offset = offset ;
  151|   765k|	rchunk.len = len ;
  152|       |
  153|   765k|	rchunk.id_size = 4 ;
  154|   765k|	memcpy (rchunk.id, &marker, rchunk.id_size) ;
  155|       |
  156|   765k|	return psf_store_read_chunk (pchk, &rchunk) ;
  157|   765k|} /* psf_store_read_chunk_u32 */
psf_find_read_chunk_str:
  161|    998|{	uint64_t hash ;
  162|    998|	uint32_t k ;
  163|    998|	union
  164|    998|	{	uint32_t marker ;
  165|    998|		char str [5] ;
  166|    998|	} u ;
  167|       |
  168|    998|	snprintf (u.str, sizeof (u.str), "%s", marker_str) ;
  169|       |
  170|    998|	hash = strlen (marker_str) > 4 ? hash_of_str (marker_str) : u.marker ;
  ------------------
  |  Branch (170:9): [True: 0, False: 998]
  ------------------
  171|       |
  172|  2.58k|	for (k = 0 ; k < pchk->used ; k++)
  ------------------
  |  Branch (172:15): [True: 2.53k, False: 50]
  ------------------
  173|  2.53k|		if (pchk->chunks [k].hash == hash)
  ------------------
  |  Branch (173:7): [True: 948, False: 1.58k]
  ------------------
  174|    948|			return k ;
  175|       |
  176|     50|	return -1 ;
  177|    998|} /* psf_find_read_chunk_str */
psf_find_read_chunk_iterator:
  191|  1.89k|{	if (marker->current < pchk->used)
  ------------------
  |  Branch (191:7): [True: 1.89k, False: 0]
  ------------------
  192|  1.89k|		return marker->current ;
  193|       |
  194|      0|	return -1 ;
  195|  1.89k|} /* psf_find_read_chunk_iterator */
chunk.c:psf_store_read_chunk:
  111|   765k|{	if (pchk->count == 0)
  ------------------
  |  Branch (111:7): [True: 10.6k, False: 754k]
  ------------------
  112|  10.6k|	{	pchk->used = 0 ;
  113|  10.6k|		pchk->count = 20 ;
  114|  10.6k|		pchk->chunks = calloc (pchk->count, sizeof (READ_CHUNK)) ;
  115|  10.6k|		if (!pchk->chunks)
  ------------------
  |  Branch (115:7): [True: 0, False: 10.6k]
  ------------------
  116|      0|		{	return SFE_MALLOC_FAILED ;
  117|  10.6k|			} ;
  118|  10.6k|		}
  119|   754k|	else if (pchk->used > pchk->count)
  ------------------
  |  Branch (119:11): [True: 0, False: 754k]
  ------------------
  120|      0|		return SFE_INTERNAL ;
  121|   754k|	else if (pchk->used == pchk->count)
  ------------------
  |  Branch (121:11): [True: 5.50k, False: 749k]
  ------------------
  122|  5.50k|	{	READ_CHUNK * old_ptr = pchk->chunks ;
  123|  5.50k|		int new_count = 3 * (pchk->count + 1) / 2 ;
  124|       |
  125|  5.50k|		READ_CHUNK * new_chunks = realloc (old_ptr, new_count * sizeof (READ_CHUNK)) ;
  126|  5.50k|		if (new_chunks == NULL)
  ------------------
  |  Branch (126:7): [True: 0, False: 5.50k]
  ------------------
  127|      0|		{
  128|      0|			return SFE_MALLOC_FAILED ;
  129|  5.50k|			} else {
  130|  5.50k|			pchk->chunks = new_chunks;
  131|  5.50k|			} ;
  132|  5.50k|		pchk->count = new_count ;
  133|   765k|		} ;
  134|       |
  135|   765k|	pchk->chunks [pchk->used] = *rchunk ;
  136|       |
  137|   765k|	pchk->used ++ ;
  138|       |
  139|   765k|	return SFE_NO_ERROR ;
  140|   765k|} /* 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|  16.3M|{	va_list		ap ;
  107|  16.3M|	uint32_t	u, tens ;
  108|  16.3M|	int			d, shift, width, width_specifier, left_align, slen, precision ;
  109|  16.3M|	char		c, *strptr, istr [5], lead_char, sign_char ;
  110|       |
  111|  16.3M|	va_start (ap, format) ;
  112|       |
  113|   551M|	while ((c = *format++))
  ------------------
  |  Branch (113:9): [True: 535M, False: 16.3M]
  ------------------
  114|   535M|	{	if (c != '%')
  ------------------
  |  Branch (114:8): [True: 509M, False: 25.0M]
  ------------------
  115|   509M|		{	log_putchar (psf, c) ;
  116|   509M|			continue ;
  117|   509M|			} ;
  118|       |
  119|  25.0M|		if (format [0] == '%') /* Handle %% */
  ------------------
  |  Branch (119:7): [True: 0, False: 25.0M]
  ------------------
  120|      0|		{ 	log_putchar (psf, '%') ;
  121|      0|			format ++ ;
  122|      0|			continue ;
  123|  25.0M|			} ;
  124|       |
  125|  25.0M|		sign_char = 0 ;
  126|  25.0M|		left_align = SF_FALSE ;
  127|  25.2M|		while (1)
  ------------------
  |  Branch (127:10): [True: 25.2M, Folded]
  ------------------
  128|  25.2M|		{	switch (format [0])
  129|  25.2M|			{	case ' ' :
  ------------------
  |  Branch (129:6): [True: 0, False: 25.2M]
  ------------------
  130|      0|				case '+' :
  ------------------
  |  Branch (130:5): [True: 0, False: 25.2M]
  ------------------
  131|      0|					sign_char = format [0] ;
  132|      0|					format ++ ;
  133|      0|					continue ;
  134|       |
  135|   118k|				case '-' :
  ------------------
  |  Branch (135:5): [True: 118k, False: 25.0M]
  ------------------
  136|   118k|					left_align = SF_TRUE ;
  137|   118k|					format ++ ;
  138|   118k|					continue ;
  139|       |
  140|  25.0M|				default : break ;
  ------------------
  |  Branch (140:5): [True: 25.0M, False: 118k]
  ------------------
  141|  25.2M|				} ;
  142|       |
  143|  25.0M|			break ;
  144|  25.2M|			} ;
  145|       |
  146|  25.0M|		if (format [0] == 0)
  ------------------
  |  Branch (146:7): [True: 0, False: 25.0M]
  ------------------
  147|      0|			break ;
  148|       |
  149|  25.0M|		lead_char = ' ' ;
  150|  25.0M|		if (format [0] == '0')
  ------------------
  |  Branch (150:7): [True: 4.43M, False: 20.6M]
  ------------------
  151|  4.43M|			lead_char = '0' ;
  152|       |
  153|  25.0M|		width_specifier = 0 ;
  154|  34.2M|		while ((c = *format++) && isdigit (c))
  ------------------
  |  Branch (154:10): [True: 34.2M, False: 0]
  |  Branch (154:29): [True: 9.15M, False: 25.0M]
  ------------------
  155|  9.15M|			width_specifier = width_specifier * 10 + (c - '0') ;
  156|       |
  157|  25.0M|		precision = 0 ;
  158|  25.0M|		if (c == '.')
  ------------------
  |  Branch (158:7): [True: 0, False: 25.0M]
  ------------------
  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|  25.0M|		switch (c)
  164|  25.0M|		{	case 0 : /* NULL character. */
  ------------------
  |  Branch (164:5): [True: 0, False: 25.0M]
  ------------------
  165|      0|					va_end (ap) ;
  166|      0|					return ;
  167|       |
  168|  1.90M|			case 's': /* string */
  ------------------
  |  Branch (168:4): [True: 1.90M, False: 23.1M]
  ------------------
  169|  1.90M|					strptr = va_arg (ap, char *) ;
  170|  1.90M|					if (strptr == NULL)
  ------------------
  |  Branch (170:10): [True: 0, False: 1.90M]
  ------------------
  171|      0|						break ;
  172|  1.90M|					if (precision > 0)
  ------------------
  |  Branch (172:10): [True: 0, False: 1.90M]
  ------------------
  173|      0|						slen = strnlen (strptr, precision) ;
  174|  1.90M|					else
  175|  1.90M|						slen = strlen (strptr) ;
  176|  1.90M|					width_specifier = width_specifier >= slen ? width_specifier - slen : 0 ;
  ------------------
  |  Branch (176:24): [True: 1.63M, False: 273k]
  ------------------
  177|  1.90M|					if (left_align == SF_FALSE)
  ------------------
  |  Branch (177:10): [True: 1.78M, False: 118k]
  ------------------
  178|  1.78M|						while (width_specifier -- > 0)
  ------------------
  |  Branch (178:14): [True: 0, False: 1.78M]
  ------------------
  179|      0|							log_putchar (psf, ' ') ;
  180|  7.03M|					while (slen--)
  ------------------
  |  Branch (180:13): [True: 5.12M, False: 1.90M]
  ------------------
  181|  5.12M|						log_putchar (psf, *strptr++) ;
  182|  3.18M|					while (width_specifier -- > 0)
  ------------------
  |  Branch (182:13): [True: 1.27M, False: 1.90M]
  ------------------
  183|  1.27M|						log_putchar (psf, ' ') ;
  184|  1.90M|					break ;
  185|       |
  186|  12.5M|			case 'd': /* int */
  ------------------
  |  Branch (186:4): [True: 12.5M, False: 12.5M]
  ------------------
  187|  12.5M|					d = va_arg (ap, int) ;
  188|       |
  189|  12.5M|					if (d < 0)
  ------------------
  |  Branch (189:10): [True: 82.2k, False: 12.4M]
  ------------------
  190|  82.2k|					{	sign_char = '-' ;
  191|  82.2k|						if (lead_char != '0' && left_align == SF_FALSE)
  ------------------
  |  Branch (191:11): [True: 82.2k, False: 33]
  |  Branch (191:31): [True: 82.2k, False: 0]
  ------------------
  192|  82.2k|							width_specifier -- ;
  193|       |
  194|  82.2k|						u = - ((unsigned) d) ;
  195|  82.2k|						}
  196|  12.4M|					else
  197|  12.4M|					{	u = (unsigned) d ;
  198|  12.4M|						}
  199|       |
  200|  12.5M|					tens = 1 ;
  201|  12.5M|					width = 1 ;
  202|  24.8M|					while (u / tens >= 10)
  ------------------
  |  Branch (202:13): [True: 12.3M, False: 12.5M]
  ------------------
  203|  12.3M|					{	tens *= 10 ;
  204|  12.3M|						width ++ ;
  205|  12.3M|						} ;
  206|       |
  207|  12.5M|					width_specifier -= width ;
  208|       |
  209|  12.5M|					if (sign_char == ' ')
  ------------------
  |  Branch (209:10): [True: 0, False: 12.5M]
  ------------------
  210|      0|					{	log_putchar (psf, ' ') ;
  211|      0|						width_specifier -- ;
  212|      0|						} ;
  213|       |
  214|  12.5M|					if (left_align == SF_FALSE && lead_char != '0')
  ------------------
  |  Branch (214:10): [True: 12.5M, False: 0]
  |  Branch (214:36): [True: 12.5M, False: 119]
  ------------------
  215|  12.5M|					{	if (sign_char == '+')
  ------------------
  |  Branch (215:12): [True: 0, False: 12.5M]
  ------------------
  216|      0|							width_specifier -- ;
  217|       |
  218|  12.5M|						while (width_specifier -- > 0)
  ------------------
  |  Branch (218:14): [True: 3.55k, False: 12.5M]
  ------------------
  219|  3.55k|							log_putchar (psf, lead_char) ;
  220|  12.5M|						} ;
  221|       |
  222|  12.5M|					if (sign_char == '+' || sign_char == '-')
  ------------------
  |  Branch (222:10): [True: 0, False: 12.5M]
  |  Branch (222:30): [True: 82.2k, False: 12.4M]
  ------------------
  223|  82.2k|					{	log_putchar (psf, sign_char) ;
  224|  82.2k|						width_specifier -- ;
  225|  82.2k|						} ;
  226|       |
  227|  12.5M|					if (left_align == SF_FALSE)
  ------------------
  |  Branch (227:10): [True: 12.5M, False: 0]
  ------------------
  228|  12.5M|						while (width_specifier -- > 0)
  ------------------
  |  Branch (228:14): [True: 49, False: 12.5M]
  ------------------
  229|     49|							log_putchar (psf, lead_char) ;
  230|       |
  231|  37.3M|					while (tens > 0)
  ------------------
  |  Branch (231:13): [True: 24.8M, False: 12.5M]
  ------------------
  232|  24.8M|					{	log_putchar (psf, '0' + u / tens) ;
  233|  24.8M|						u %= tens ;
  234|  24.8M|						tens /= 10 ;
  235|  24.8M|						} ;
  236|       |
  237|  12.5M|					while (width_specifier -- > 0)
  ------------------
  |  Branch (237:13): [True: 0, False: 12.5M]
  ------------------
  238|      0|						log_putchar (psf, lead_char) ;
  239|  12.5M|					break ;
  240|       |
  241|   398k|			case 'D': /* sf_count_t */
  ------------------
  |  Branch (241:4): [True: 398k, False: 24.7M]
  ------------------
  242|   398k|					{	sf_count_t	D ;
  243|   398k|						uint64_t	U, Tens ;
  244|       |
  245|   398k|						D = va_arg (ap, sf_count_t) ;
  246|       |
  247|   398k|						if (D == 0)
  ------------------
  |  Branch (247:11): [True: 14.6k, False: 383k]
  ------------------
  248|  14.6k|						{	while (-- width_specifier > 0)
  ------------------
  |  Branch (248:16): [True: 0, False: 14.6k]
  ------------------
  249|      0|								log_putchar (psf, lead_char) ;
  250|  14.6k|							log_putchar (psf, '0') ;
  251|  14.6k|							break ;
  252|  14.6k|							}
  253|   383k|						else
  254|   383k|						{	if (D < 0)
  ------------------
  |  Branch (254:13): [True: 90.4k, False: 293k]
  ------------------
  255|  90.4k|							{	log_putchar (psf, '-') ;
  256|  90.4k|								U = - ((uint64_t) D) ;
  257|  90.4k|								}
  258|   293k|							else
  259|   293k|							{	U = (uint64_t) D ;
  260|   293k|								}
  261|   383k|							}
  262|       |
  263|   383k|						Tens = 1 ;
  264|   383k|						width = 1 ;
  265|  2.81M|						while (U / Tens >= 10)
  ------------------
  |  Branch (265:14): [True: 2.42M, False: 383k]
  ------------------
  266|  2.42M|						{	Tens *= 10 ;
  267|  2.42M|							width ++ ;
  268|  2.42M|							} ;
  269|       |
  270|   383k|						while (width_specifier > width)
  ------------------
  |  Branch (270:14): [True: 0, False: 383k]
  ------------------
  271|      0|						{	log_putchar (psf, lead_char) ;
  272|      0|							width_specifier-- ;
  273|      0|							} ;
  274|       |
  275|  3.19M|						while (Tens > 0)
  ------------------
  |  Branch (275:14): [True: 2.81M, False: 383k]
  ------------------
  276|  2.81M|						{	log_putchar (psf, '0' + U / Tens) ;
  277|  2.81M|							U %= Tens ;
  278|  2.81M|							Tens /= 10 ;
  279|  2.81M|							} ;
  280|   383k|						} ;
  281|   383k|					break ;
  282|       |
  283|  1.01M|			case 'u': /* unsigned int */
  ------------------
  |  Branch (283:4): [True: 1.01M, False: 24.0M]
  ------------------
  284|  1.01M|					u = va_arg (ap, unsigned int) ;
  285|       |
  286|  1.01M|					tens = 1 ;
  287|  1.01M|					width = 1 ;
  288|  5.81M|					while (u / tens >= 10)
  ------------------
  |  Branch (288:13): [True: 4.79M, False: 1.01M]
  ------------------
  289|  4.79M|					{	tens *= 10 ;
  290|  4.79M|						width ++ ;
  291|  4.79M|						} ;
  292|       |
  293|  1.01M|					width_specifier -= width ;
  294|       |
  295|  1.01M|					if (sign_char == ' ')
  ------------------
  |  Branch (295:10): [True: 0, False: 1.01M]
  ------------------
  296|      0|					{	log_putchar (psf, ' ') ;
  297|      0|						width_specifier -- ;
  298|      0|						} ;
  299|       |
  300|  1.01M|					if (left_align == SF_FALSE && lead_char != '0')
  ------------------
  |  Branch (300:10): [True: 1.01M, False: 0]
  |  Branch (300:36): [True: 1.01M, False: 1.21k]
  ------------------
  301|  1.01M|					{	if (sign_char == '+')
  ------------------
  |  Branch (301:12): [True: 0, False: 1.01M]
  ------------------
  302|      0|							width_specifier -- ;
  303|       |
  304|  1.05M|						while (width_specifier -- > 0)
  ------------------
  |  Branch (304:14): [True: 42.4k, False: 1.01M]
  ------------------
  305|  42.4k|							log_putchar (psf, lead_char) ;
  306|  1.01M|						} ;
  307|       |
  308|  1.01M|					if (sign_char == '+' || sign_char == '-')
  ------------------
  |  Branch (308:10): [True: 0, False: 1.01M]
  |  Branch (308:30): [True: 0, False: 1.01M]
  ------------------
  309|      0|					{	log_putchar (psf, sign_char) ;
  310|      0|						width_specifier -- ;
  311|      0|						} ;
  312|       |
  313|  1.01M|					if (left_align == SF_FALSE)
  ------------------
  |  Branch (313:10): [True: 1.01M, False: 0]
  ------------------
  314|  1.01M|						while (width_specifier -- > 0)
  ------------------
  |  Branch (314:14): [True: 1.15k, False: 1.01M]
  ------------------
  315|  1.15k|							log_putchar (psf, lead_char) ;
  316|       |
  317|  6.82M|					while (tens > 0)
  ------------------
  |  Branch (317:13): [True: 5.81M, False: 1.01M]
  ------------------
  318|  5.81M|					{	log_putchar (psf, '0' + u / tens) ;
  319|  5.81M|						u %= tens ;
  320|  5.81M|						tens /= 10 ;
  321|  5.81M|						} ;
  322|       |
  323|  1.01M|					while (width_specifier -- > 0)
  ------------------
  |  Branch (323:13): [True: 0, False: 1.01M]
  ------------------
  324|      0|						log_putchar (psf, lead_char) ;
  325|  1.01M|					break ;
  326|       |
  327|      0|			case 'c': /* char */
  ------------------
  |  Branch (327:4): [True: 0, False: 25.0M]
  ------------------
  328|      0|					c = va_arg (ap, int) & 0xFF ;
  329|      0|					log_putchar (psf, c) ;
  330|      0|					break ;
  331|       |
  332|  2.87M|			case 'x': /* hex */
  ------------------
  |  Branch (332:4): [True: 2.87M, False: 22.2M]
  ------------------
  333|  7.82M|			case 'X': /* hex */
  ------------------
  |  Branch (333:4): [True: 4.94M, False: 20.1M]
  ------------------
  334|  7.82M|					d = va_arg (ap, int) ;
  335|       |
  336|  7.82M|					if (d == 0)
  ------------------
  |  Branch (336:10): [True: 4.15M, False: 3.66M]
  ------------------
  337|  5.80M|					{	while (--width_specifier > 0)
  ------------------
  |  Branch (337:15): [True: 1.64M, False: 4.15M]
  ------------------
  338|  1.64M|							log_putchar (psf, lead_char) ;
  339|  4.15M|						log_putchar (psf, '0') ;
  340|  4.15M|						break ;
  341|  4.15M|						} ;
  342|  3.66M|					shift = 28 ;
  343|  3.66M|					width = (width_specifier < 8) ? 8 : width_specifier ;
  ------------------
  |  Branch (343:14): [True: 3.66M, False: 6.76k]
  ------------------
  344|  23.7M|					while (! ((((uint32_t) 0xF) << shift) & d))
  ------------------
  |  Branch (344:13): [True: 20.1M, False: 3.66M]
  ------------------
  345|  20.1M|					{	shift -= 4 ;
  346|  20.1M|						width -- ;
  347|  20.1M|						} ;
  348|       |
  349|  4.30M|					while (width > 0 && width_specifier > width)
  ------------------
  |  Branch (349:13): [True: 4.30M, False: 0]
  |  Branch (349:26): [True: 635k, False: 3.66M]
  ------------------
  350|   635k|					{	log_putchar (psf, lead_char) ;
  351|   635k|						width_specifier-- ;
  352|   635k|						} ;
  353|       |
  354|  12.9M|					while (shift >= 0)
  ------------------
  |  Branch (354:13): [True: 9.25M, False: 3.66M]
  ------------------
  355|  9.25M|					{	c = (d >> shift) & 0xF ;
  356|  9.25M|						log_putchar (psf, (c > 9) ? c + 'A' - 10 : c + '0') ;
  ------------------
  |  Branch (356:25): [True: 2.50M, False: 6.74M]
  ------------------
  357|  9.25M|						shift -= 4 ;
  358|  9.25M|						} ;
  359|  3.66M|					break ;
  360|       |
  361|  1.44M|			case 'M': /* int2str */
  ------------------
  |  Branch (361:4): [True: 1.44M, False: 23.6M]
  ------------------
  362|  1.44M|					d = va_arg (ap, int) ;
  363|  1.44M|					if (CPU_IS_LITTLE_ENDIAN)
  ------------------
  |  |   14|  1.44M|#define CPU_IS_LITTLE_ENDIAN 1
  |  |  ------------------
  |  |  |  Branch (14:30): [True: 1.44M, Folded]
  |  |  ------------------
  ------------------
  364|  1.44M|					{	istr [0] = d & 0xFF ;
  365|  1.44M|						istr [1] = (d >> 8) & 0xFF ;
  366|  1.44M|						istr [2] = (d >> 16) & 0xFF ;
  367|  1.44M|						istr [3] = (d >> 24) & 0xFF ;
  368|  1.44M|						}
  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.44M|					istr [4] = 0 ;
  376|  1.44M|					strptr = istr ;
  377|  6.52M|					while (*strptr)
  ------------------
  |  Branch (377:13): [True: 5.07M, False: 1.44M]
  ------------------
  378|  5.07M|					{	c = *strptr++ ;
  379|  5.07M|						log_putchar (psf, psf_isprint (c) ? c : '.') ;
  ------------------
  |  Branch (379:25): [True: 4.36M, False: 713k]
  ------------------
  380|  5.07M|						} ;
  381|  1.44M|					break ;
  382|       |
  383|      0|			default :
  ------------------
  |  Branch (383:4): [True: 0, False: 25.0M]
  ------------------
  384|      0|					log_putchar (psf, '*') ;
  385|      0|					log_putchar (psf, c) ;
  386|      0|					log_putchar (psf, '*') ;
  387|      0|					break ;
  388|  25.0M|			} /* switch */
  389|  25.0M|		} /* while */
  390|       |
  391|  16.3M|	va_end (ap) ;
  392|  16.3M|	return ;
  393|  16.3M|} /* psf_log_printf */
psf_binheader_readf:
  984|  5.76M|{	va_list			argptr ;
  985|  5.76M|	sf_count_t		*countptr, countdata ;
  986|  5.76M|	unsigned char	*ucptr, sixteen_bytes [16] = { 0 } ;
  987|  5.76M|	unsigned int 	*intptr, intdata ;
  988|  5.76M|	unsigned short	*shortptr ;
  989|  5.76M|	char			*charptr ;
  990|  5.76M|	float			*floatptr ;
  991|  5.76M|	double			*doubleptr ;
  992|  5.76M|	char			c ;
  993|  5.76M|	int				byte_count = 0, count = 0 ;
  994|  5.76M|	int				read_bytes = 0 ;
  995|       |
  996|  5.76M|	if (! format)
  ------------------
  |  Branch (996:6): [True: 0, False: 5.76M]
  ------------------
  997|      0|		return psf_ftell (psf) ;
  998|       |
  999|  5.76M|	va_start (argptr, format) ;
 1000|       |
 1001|  17.8M|	while ((c = *format++))
  ------------------
  |  Branch (1001:9): [True: 12.2M, False: 5.60M]
  ------------------
 1002|  12.2M|	{
 1003|  12.2M|		read_bytes = 0 ;
 1004|  12.2M|		if (psf->header.indx + 16 >= psf->header.len && psf_bump_header_allocation (psf, 16))
  ------------------
  |  Branch (1004:7): [True: 162k, False: 12.1M]
  |  Branch (1004:51): [True: 158k, False: 3.87k]
  ------------------
 1005|   158k|			break ;
 1006|       |
 1007|  12.1M|		switch (c)
 1008|  12.1M|		{	case 'e' : /* All conversions are now from LE to host. */
  ------------------
  |  Branch (1008:5): [True: 826k, False: 11.2M]
  ------------------
 1009|   826k|					psf->rwf_endian = SF_ENDIAN_LITTLE ;
 1010|   826k|					break ;
 1011|       |
 1012|  1.30M|			case 'E' : /* All conversions are now from BE to host. */
  ------------------
  |  Branch (1012:4): [True: 1.30M, False: 10.8M]
  ------------------
 1013|  1.30M|					psf->rwf_endian = SF_ENDIAN_BIG ;
 1014|  1.30M|					break ;
 1015|       |
 1016|  1.61M|			case 'm' : /* 4 byte marker value eg 'RIFF' */
  ------------------
  |  Branch (1016:4): [True: 1.61M, False: 10.4M]
  ------------------
 1017|  1.61M|					intptr = va_arg (argptr, unsigned int*) ;
 1018|  1.61M|					*intptr = 0 ;
 1019|  1.61M|					ucptr = (unsigned char*) intptr ;
 1020|  1.61M|					read_bytes = header_read (psf, ucptr, sizeof (int)) ;
 1021|  1.61M|					*intptr = GET_MARKER (ucptr) ;
  ------------------
  |  |  833|  1.61M|#define	GET_MARKER(ptr)	(	((ptr) [0])			| ((ptr) [1] << 8) |	\
  |  |  834|  1.61M|							((ptr) [2] << 16)	| (((uint32_t) (ptr) [3]) << 24))
  ------------------
 1022|  1.61M|					break ;
 1023|       |
 1024|   106k|			case 'h' :
  ------------------
  |  Branch (1024:4): [True: 106k, False: 11.9M]
  ------------------
 1025|   106k|					intptr = va_arg (argptr, unsigned int*) ;
 1026|   106k|					*intptr = 0 ;
 1027|   106k|					ucptr = (unsigned char*) intptr ;
 1028|   106k|					read_bytes = header_read (psf, sixteen_bytes, sizeof (sixteen_bytes)) ;
 1029|   106k|					{	int k ;
 1030|   106k|						intdata = 0 ;
 1031|  1.81M|						for (k = 0 ; k < 16 ; k++)
  ------------------
  |  Branch (1031:20): [True: 1.70M, False: 106k]
  ------------------
 1032|  1.70M|							intdata ^= sixteen_bytes [k] << k ;
 1033|   106k|						}
 1034|   106k|					*intptr = intdata ;
 1035|   106k|					break ;
 1036|       |
 1037|   273k|			case '1' :
  ------------------
  |  Branch (1037:4): [True: 273k, False: 11.8M]
  ------------------
 1038|   273k|					charptr = va_arg (argptr, char*) ;
 1039|   273k|					*charptr = 0 ;
 1040|   273k|					read_bytes = header_read (psf, charptr, sizeof (char)) ;
 1041|   273k|					break ;
 1042|       |
 1043|  3.20M|			case '2' : /* 2 byte value with the current endian-ness */
  ------------------
  |  Branch (1043:4): [True: 3.20M, False: 8.90M]
  ------------------
 1044|  3.20M|					shortptr = va_arg (argptr, unsigned short*) ;
 1045|  3.20M|					*shortptr = 0 ;
 1046|  3.20M|					ucptr = (unsigned char*) shortptr ;
 1047|  3.20M|					read_bytes = header_read (psf, ucptr, sizeof (short)) ;
 1048|  3.20M|					if (psf->rwf_endian == SF_ENDIAN_BIG)
  ------------------
  |  Branch (1048:10): [True: 2.39M, False: 805k]
  ------------------
 1049|  2.39M|						*shortptr = GET_BE_SHORT (ucptr) ;
  ------------------
  |  |  841|  2.39M|#define	GET_BE_SHORT(ptr)	(((ptr) [0] << 8) | ((ptr) [1]))
  ------------------
 1050|   805k|					else
 1051|   805k|						*shortptr = GET_LE_SHORT (ucptr) ;
  ------------------
  |  |  840|   805k|#define	GET_LE_SHORT(ptr)	(((ptr) [1] << 8) | ((ptr) [0]))
  ------------------
 1052|  3.20M|					break ;
 1053|       |
 1054|  3.23k|			case '3' : /* 3 byte value with the current endian-ness */
  ------------------
  |  Branch (1054:4): [True: 3.23k, False: 12.1M]
  ------------------
 1055|  3.23k|					intptr = va_arg (argptr, unsigned int*) ;
 1056|  3.23k|					*intptr = 0 ;
 1057|  3.23k|					read_bytes = header_read (psf, sixteen_bytes, 3) ;
 1058|  3.23k|					if (psf->rwf_endian == SF_ENDIAN_BIG)
  ------------------
  |  Branch (1058:10): [True: 0, False: 3.23k]
  ------------------
 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.23k|					else
 1061|  3.23k|						*intptr = GET_LE_3BYTE (sixteen_bytes) ;
  ------------------
  |  |  843|  3.23k|#define	GET_LE_3BYTE(ptr)	(	((ptr) [2] << 16) | ((ptr) [1] << 8) | ((ptr) [0]))
  ------------------
 1062|  3.23k|					break ;
 1063|       |
 1064|  2.68M|			case '4' : /* 4 byte value with the current endian-ness */
  ------------------
  |  Branch (1064:4): [True: 2.68M, False: 9.42M]
  ------------------
 1065|  2.68M|					intptr = va_arg (argptr, unsigned int*) ;
 1066|  2.68M|					*intptr = 0 ;
 1067|  2.68M|					ucptr = (unsigned char*) intptr ;
 1068|  2.68M|					read_bytes = header_read (psf, ucptr, sizeof (int)) ;
 1069|  2.68M|					if (psf->rwf_endian == SF_ENDIAN_BIG)
  ------------------
  |  Branch (1069:10): [True: 1.30M, False: 1.37M]
  ------------------
 1070|  1.30M|						*intptr = psf_get_be32 (ucptr, 0) ;
 1071|  1.37M|					else
 1072|  1.37M|						*intptr = psf_get_le32 (ucptr, 0) ;
 1073|  2.68M|					break ;
 1074|       |
 1075|   129k|			case '8' : /* 8 byte value with the current endian-ness */
  ------------------
  |  Branch (1075:4): [True: 129k, False: 11.9M]
  ------------------
 1076|   129k|					countptr = va_arg (argptr, sf_count_t *) ;
 1077|   129k|					*countptr = 0 ;
 1078|   129k|					read_bytes = header_read (psf, sixteen_bytes, 8) ;
 1079|   129k|					if (psf->rwf_endian == SF_ENDIAN_BIG)
  ------------------
  |  Branch (1079:10): [True: 19.2k, False: 110k]
  ------------------
 1080|  19.2k|						countdata = psf_get_be64 (sixteen_bytes, 0) ;
 1081|   110k|					else
 1082|   110k|						countdata = psf_get_le64 (sixteen_bytes, 0) ;
 1083|   129k|					*countptr = countdata ;
 1084|   129k|					break ;
 1085|       |
 1086|  25.7k|			case 'f' : /* Float conversion */
  ------------------
  |  Branch (1086:4): [True: 25.7k, False: 12.0M]
  ------------------
 1087|  25.7k|					floatptr = va_arg (argptr, float *) ;
 1088|  25.7k|					*floatptr = 0.0 ;
 1089|  25.7k|					read_bytes = header_read (psf, floatptr, sizeof (float)) ;
 1090|  25.7k|					if (psf->rwf_endian == SF_ENDIAN_BIG)
  ------------------
  |  Branch (1090:10): [True: 2.91k, False: 22.8k]
  ------------------
 1091|  2.91k|						*floatptr = float32_be_read ((unsigned char*) floatptr) ;
 1092|  22.8k|					else
 1093|  22.8k|						*floatptr = float32_le_read ((unsigned char*) floatptr) ;
 1094|  25.7k|					break ;
 1095|       |
 1096|    582|			case 'd' : /* double conversion */
  ------------------
  |  Branch (1096:4): [True: 582, False: 12.1M]
  ------------------
 1097|    582|					doubleptr = va_arg (argptr, double *) ;
 1098|    582|					*doubleptr = 0.0 ;
 1099|    582|					read_bytes = header_read (psf, doubleptr, sizeof (double)) ;
 1100|    582|					if (psf->rwf_endian == SF_ENDIAN_BIG)
  ------------------
  |  Branch (1100:10): [True: 68, False: 514]
  ------------------
 1101|     68|						*doubleptr = double64_be_read ((unsigned char*) doubleptr) ;
 1102|    514|					else
 1103|    514|						*doubleptr = double64_le_read ((unsigned char*) doubleptr) ;
 1104|    582|					break ;
 1105|       |
 1106|      0|			case 's' :
  ------------------
  |  Branch (1106:4): [True: 0, False: 12.1M]
  ------------------
 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.31M|			case 'b' : /* Raw bytes */
  ------------------
  |  Branch (1119:4): [True: 1.31M, False: 10.7M]
  ------------------
 1120|  1.31M|					charptr = va_arg (argptr, char*) ;
 1121|  1.31M|					count = va_arg (argptr, size_t) ;
 1122|  1.31M|					memset (charptr, 0, count) ;
 1123|  1.31M|					read_bytes = header_read (psf, charptr, count) ;
 1124|  1.31M|					break ;
 1125|       |
 1126|    122|			case 'G' :
  ------------------
  |  Branch (1126:4): [True: 122, False: 12.1M]
  ------------------
 1127|    122|					charptr = va_arg (argptr, char*) ;
 1128|    122|					count = va_arg (argptr, size_t) ;
 1129|    122|					memset (charptr, 0, count) ;
 1130|       |
 1131|    122|					if (psf->header.indx + count >= psf->header.len && psf_bump_header_allocation (psf, count))
  ------------------
  |  Branch (1131:10): [True: 0, False: 122]
  |  Branch (1131:57): [True: 0, False: 0]
  ------------------
 1132|      0|						break ;
 1133|       |
 1134|    122|					read_bytes = header_gets (psf, charptr, count) ;
 1135|    122|					break ;
 1136|       |
 1137|      0|			case 'z' :
  ------------------
  |  Branch (1137:4): [True: 0, False: 12.1M]
  ------------------
 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.4k|			case 'p' :	/* Seek to position from start. */
  ------------------
  |  Branch (1149:4): [True: 20.4k, False: 12.0M]
  ------------------
 1150|  20.4k|					count = va_arg (argptr, size_t) ;
 1151|  20.4k|					header_seek (psf, count, SEEK_SET) ;
 1152|  20.4k|					byte_count = count ;
 1153|  20.4k|					break ;
 1154|       |
 1155|   600k|			case 'j' :	/* Seek to position from current position. */
  ------------------
  |  Branch (1155:4): [True: 600k, False: 11.5M]
  ------------------
 1156|   600k|					count = va_arg (argptr, size_t) ;
 1157|   600k|					header_seek (psf, count, SEEK_CUR) ;
 1158|   600k|					read_bytes = count ;
 1159|   600k|					break ;
 1160|       |
 1161|  2.12k|			case '!' : /* Clear buffer, forcing re-read. */
  ------------------
  |  Branch (1161:4): [True: 2.12k, False: 12.1M]
  ------------------
 1162|  2.12k|					psf->header.end = psf->header.indx = 0 ;
 1163|  2.12k|					break ;
 1164|       |
 1165|      0|			default :
  ------------------
  |  Branch (1165:4): [True: 0, False: 12.1M]
  ------------------
 1166|      0|				psf_log_printf (psf, "*** Invalid format specifier `%c'\n", c) ;
 1167|      0|				psf->error = SFE_INTERNAL ;
 1168|      0|				break ;
 1169|  12.1M|			} ;
 1170|       |
 1171|  12.1M|		if (read_bytes > 0 && byte_count > (INT_MAX - read_bytes))
  ------------------
  |  Branch (1171:7): [True: 4.94M, False: 7.15M]
  |  Branch (1171:25): [True: 4, False: 4.94M]
  ------------------
 1172|      4|		{	psf_log_printf (psf, "Header size exceeds INT_MAX. Aborting.", c) ;
 1173|      4|			psf->error = SFE_INTERNAL ;
 1174|      4|			break ;
 1175|      4|		} else
 1176|  12.1M|		{	byte_count += read_bytes ;
 1177|  12.1M|		} ;
 1178|       |
 1179|  12.1M|		} ;	/*end while*/
 1180|       |
 1181|  5.76M|	va_end (argptr) ;
 1182|       |
 1183|  5.76M|	return byte_count ;
 1184|  5.76M|} /* psf_binheader_readf */
psf_log_SF_INFO:
 1249|  1.16k|{	psf_log_printf (psf, "---------------------------------\n") ;
 1250|       |
 1251|  1.16k|	psf_log_printf (psf, " Sample rate :   %d\n", psf->sf.samplerate) ;
 1252|  1.16k|	if (psf->sf.frames == SF_COUNT_MAX)
  ------------------
  |  |  370|  1.16k|#define SF_COUNT_MAX	INT64_MAX
  ------------------
  |  Branch (1252:6): [True: 1, False: 1.15k]
  ------------------
 1253|      1|		psf_log_printf (psf, " Frames      :   unknown\n") ;
 1254|  1.15k|	else
 1255|  1.15k|		psf_log_printf (psf, " Frames      :   %D\n", psf->sf.frames) ;
 1256|  1.16k|	psf_log_printf (psf, " Channels    :   %d\n", psf->sf.channels) ;
 1257|       |
 1258|  1.16k|	psf_log_printf (psf, " Format      :   0x%X\n", psf->sf.format) ;
 1259|  1.16k|	psf_log_printf (psf, " Sections    :   %d\n", psf->sf.sections) ;
 1260|  1.16k|	psf_log_printf (psf, " Seekable    :   %s\n", psf->sf.seekable ? "TRUE" : "FALSE") ;
  ------------------
  |  Branch (1260:48): [True: 970, False: 190]
  ------------------
 1261|       |
 1262|  1.16k|	psf_log_printf (psf, "---------------------------------\n") ;
 1263|  1.16k|} /* psf_dump_SFINFO */
psf_isprint:
 1270|  5.19M|{	return (ch >= ' ' && ch <= '~') ;
  ------------------
  |  Branch (1270:11): [True: 4.43M, False: 763k]
  |  Branch (1270:24): [True: 4.41M, False: 15.0k]
  ------------------
 1271|  5.19M|} /* psf_isprint */
psf_strlcpy:
 1281|  35.0k|{	strncpy (dest, src, n - 1) ;
 1282|  35.0k|	dest [n - 1] = 0 ;
 1283|  35.0k|} /* psf_strlcpy */
psf_memset:
 1301|  1.96k|{	char	*ptr ;
 1302|  1.96k|	int 	setcount ;
 1303|       |
 1304|  1.96k|	ptr = (char *) s ;
 1305|       |
 1306|  3.92k|	while (len > 0)
  ------------------
  |  Branch (1306:9): [True: 1.96k, False: 1.96k]
  ------------------
 1307|  1.96k|	{	setcount = (len > 0x10000000) ? 0x10000000 : (int) len ;
  ------------------
  |  Branch (1307:15): [True: 0, False: 1.96k]
  ------------------
 1308|       |
 1309|  1.96k|		memset (ptr, c, setcount) ;
 1310|       |
 1311|  1.96k|		ptr += setcount ;
 1312|  1.96k|		len -= setcount ;
 1313|  1.96k|		} ;
 1314|       |
 1315|  1.96k|	return s ;
 1316|  1.96k|} /* psf_memset */
psf_cues_alloc:
 1338|  1.22k|{	SF_CUES *pcues = calloc (1, SF_CUES_VAR_SIZE (cue_count)) ;
  ------------------
  |  | 1331|  1.22k|#define SF_CUES_VAR_SIZE(count)	(sizeof (SF_CUES_0) + count * sizeof (SF_CUE_POINT))
  ------------------
 1339|  1.22k|	if (pcues)
  ------------------
  |  Branch (1339:6): [True: 1.22k, False: 0]
  ------------------
 1340|  1.22k|	{	pcues->cue_count = cue_count ;
 1341|  1.22k|		} ;
 1342|  1.22k|	return pcues ;
 1343|  1.22k|} /* psf_cues_alloc */
psf_instrument_alloc:
 1376|  1.55k|{	SF_INSTRUMENT *instr ;
 1377|       |
 1378|  1.55k|	instr = calloc (1, sizeof (SF_INSTRUMENT)) ;
 1379|       |
 1380|  1.55k|	if (instr == NULL)
  ------------------
  |  Branch (1380:6): [True: 0, False: 1.55k]
  ------------------
 1381|      0|		return NULL ;
 1382|       |
 1383|       |	/* Set non-zero default values. */
 1384|  1.55k|	instr->basenote = -1 ;
 1385|  1.55k|	instr->velocity_lo = -1 ;
 1386|  1.55k|	instr->velocity_hi = -1 ;
 1387|  1.55k|	instr->key_lo = -1 ;
 1388|  1.55k|	instr->key_hi = -1 ;
 1389|       |
 1390|  1.55k|	return instr ;
 1391|  1.55k|} /* psf_instrument_alloc */
psf_sanitize_string:
 1395|    281|{
 1396|    281|	do
 1397|  47.2k|	{
 1398|  47.2k|		len -- ;
 1399|  47.2k|		cptr [len] = psf_isprint (cptr [len]) ? cptr [len] : '.' ;
  ------------------
  |  Branch (1399:16): [True: 2.99k, False: 44.2k]
  ------------------
 1400|  47.2k|	}
 1401|  47.2k|	while (len > 0) ;
  ------------------
  |  Branch (1401:9): [True: 46.9k, False: 281]
  ------------------
 1402|    281|} /* psf_sanitize_string */
s_bitwidth_to_subformat:
 1455|  7.30k|{	static int array [] =
 1456|  7.30k|	{	SF_FORMAT_PCM_S8, SF_FORMAT_PCM_16, SF_FORMAT_PCM_24, SF_FORMAT_PCM_32
 1457|  7.30k|		} ;
 1458|       |
 1459|  7.30k|	if (bits < 8 || bits > 32)
  ------------------
  |  Branch (1459:6): [True: 1.03k, False: 6.26k]
  |  Branch (1459:18): [True: 3.08k, False: 3.18k]
  ------------------
 1460|  4.12k|		return 0 ;
 1461|       |
 1462|  3.18k|	return array [((bits + 7) / 8) - 1] ;
 1463|  7.30k|} /* bitwidth_to_subformat */
u_bitwidth_to_subformat:
 1467|  12.1k|{	static int array [] =
 1468|  12.1k|	{	SF_FORMAT_PCM_U8, SF_FORMAT_PCM_16, SF_FORMAT_PCM_24, SF_FORMAT_PCM_32
 1469|  12.1k|		} ;
 1470|       |
 1471|  12.1k|	if (bits < 8 || bits > 32)
  ------------------
  |  Branch (1471:6): [True: 3.97k, False: 8.19k]
  |  Branch (1471:18): [True: 5.16k, False: 3.03k]
  ------------------
 1472|  9.14k|		return 0 ;
 1473|       |
 1474|  3.03k|	return array [((bits + 7) / 8) - 1] ;
 1475|  12.1k|} /* 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|   157k|	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|   115k|{	size_t len = strlen (dest) ;
 1509|       |
 1510|   115k|	if (len < maxlen)
  ------------------
  |  Branch (1510:6): [True: 115k, False: 0]
  ------------------
 1511|   115k|	{	va_list ap ;
 1512|       |
 1513|   115k|		va_start (ap, fmt) ;
 1514|   115k|		vsnprintf (dest + len, maxlen - len, fmt, ap) ;
 1515|   115k|		va_end (ap) ;
 1516|   115k|		} ;
 1517|       |
 1518|   115k|	return ;
 1519|   115k|} /* append_snprintf */
psf_decode_frame_count:
 1559|    269|{	sf_count_t count, readlen, total = 0 ;
 1560|    269|	BUF_UNION	ubuf ;
 1561|       |
 1562|       |	/* If we're reading from a pipe or the file is too long, just return SF_COUNT_MAX. */
 1563|    269|	if (psf_is_pipe (psf) || psf->datalength > 0x1000000)
  ------------------
  |  Branch (1563:6): [True: 0, False: 269]
  |  Branch (1563:27): [True: 0, False: 269]
  ------------------
 1564|      0|		return SF_COUNT_MAX ;
  ------------------
  |  |  370|      0|#define SF_COUNT_MAX	INT64_MAX
  ------------------
 1565|       |
 1566|    269|	psf_fseek (psf, psf->dataoffset, SEEK_SET) ;
 1567|       |
 1568|    269|	readlen = ARRAY_LEN (ubuf.ibuf) / psf->sf.channels ;
  ------------------
  |  |   93|    269|#define		ARRAY_LEN(x)	((int) (sizeof (x) / sizeof ((x) [0])))
  ------------------
 1569|    269|	readlen *= psf->sf.channels ;
 1570|       |
 1571|  11.0k|	while ((count = psf->read_int (psf, ubuf.ibuf, readlen)) > 0)
  ------------------
  |  Branch (1571:9): [True: 10.7k, False: 269]
  ------------------
 1572|  10.7k|		total += count ;
 1573|       |
 1574|    269|	psf_fseek (psf, psf->dataoffset, SEEK_SET) ;
 1575|       |
 1576|    269|	return total / psf->sf.channels ;
 1577|    269|} /* psf_decode_frame_count */
common.c:log_putchar:
   97|   570M|{	if (psf->parselog.indx < SIGNED_SIZEOF (psf->parselog.buf) - 1)
  ------------------
  |  |   91|   570M|#define		SIGNED_SIZEOF(x)	((int) sizeof (x))
  ------------------
  |  Branch (97:7): [True: 9.23M, False: 561M]
  ------------------
   98|  9.23M|	{	psf->parselog.buf [psf->parselog.indx++] = ch ;
   99|  9.23M|		psf->parselog.buf [psf->parselog.indx] = 0 ;
  100|  9.23M|		} ;
  101|   570M|	return ;
  102|   570M|} /* log_putchar */
common.c:psf_bump_header_allocation:
   60|   169k|{
   61|   169k|	sf_count_t newlen, smallest = INITIAL_HEADER_SIZE ;
  ------------------
  |  |   39|   169k|#define	INITIAL_HEADER_SIZE	256
  ------------------
   62|   169k|	void * ptr ;
   63|       |
   64|   169k|	newlen = (needed > psf->header.len) ? 2 * SF_MAX (needed, smallest) : 2 * psf->header.len ;
  ------------------
  |  |   95|  2.69k|#define		SF_MAX(a, b)	((a) > (b) ? (a) : (b))
  |  |  ------------------
  |  |  |  Branch (95:24): [True: 2.69k, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (64:11): [True: 2.69k, False: 166k]
  ------------------
   65|       |
   66|   169k|	if (newlen > 100 * 1024)
  ------------------
  |  Branch (66:6): [True: 162k, False: 6.84k]
  ------------------
   67|   162k|	{	psf_log_printf (psf, "Request for header allocation of %D denied.\n", newlen) ;
   68|   162k|		return 1 ;
   69|   162k|		}
   70|       |
   71|  6.84k|	if ((ptr = realloc (psf->header.ptr, newlen)) == NULL)
  ------------------
  |  Branch (71:6): [True: 0, False: 6.84k]
  ------------------
   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.84k|		} ;
   76|       |
   77|       |	/* Always zero-out new header memory to avoid un-initializer memory accesses. */
   78|  6.84k|	if (newlen > psf->header.len)
  ------------------
  |  Branch (78:6): [True: 6.84k, False: 0]
  ------------------
   79|  6.84k|		memset ((char *) ptr + psf->header.len, 0, newlen - psf->header.len) ;
   80|       |
   81|  6.84k|	psf->header.ptr = ptr ;
   82|  6.84k|	psf->header.len = newlen ;
   83|  6.84k|	return 0 ;
   84|  6.84k|} /* psf_bump_header_allocation */
common.c:header_read:
  866|  9.35M|{	int count = 0 ;
  867|       |
  868|  9.35M|	if (psf->header.indx + bytes >= psf->header.len && psf_bump_header_allocation (psf, bytes))
  ------------------
  |  Branch (868:6): [True: 3.06k, False: 9.34M]
  |  Branch (868:53): [True: 1.92k, False: 1.14k]
  ------------------
  869|  1.92k|		return count ;
  870|       |
  871|  9.34M|	if (psf->header.indx + bytes > psf->header.end)
  ------------------
  |  Branch (871:6): [True: 7.97M, False: 1.37M]
  ------------------
  872|  7.97M|	{	count = psf_fread (psf->header.ptr + psf->header.end, 1, bytes - (psf->header.end - psf->header.indx), psf) ;
  873|  7.97M|		if (count != bytes - (int) (psf->header.end - psf->header.indx))
  ------------------
  |  Branch (873:7): [True: 3.72M, False: 4.24M]
  ------------------
  874|  3.72M|		{	psf_log_printf (psf, "Error : psf_fread returned short count.\n") ;
  875|  3.72M|			return count ;
  876|  4.24M|			} ;
  877|  4.24M|		psf->header.end += count ;
  878|  5.61M|		} ;
  879|       |
  880|  5.61M|	memcpy (ptr, psf->header.ptr + psf->header.indx, bytes) ;
  881|  5.61M|	psf->header.indx += bytes ;
  882|       |
  883|  5.61M|	return bytes ;
  884|  9.34M|} /* header_read */
common.c:header_gets:
  957|    122|{	int		k ;
  958|       |
  959|    122|	if (psf->header.indx + bufsize >= psf->header.len && psf_bump_header_allocation (psf, bufsize))
  ------------------
  |  Branch (959:6): [True: 0, False: 122]
  |  Branch (959:55): [True: 0, False: 0]
  ------------------
  960|      0|		return 0 ;
  961|       |
  962|  2.76k|	for (k = 0 ; k < bufsize - 1 ; k++)
  ------------------
  |  Branch (962:15): [True: 2.69k, False: 76]
  ------------------
  963|  2.69k|	{	if (psf->header.indx < psf->header.end)
  ------------------
  |  Branch (963:8): [True: 830, False: 1.86k]
  ------------------
  964|    830|		{	ptr [k] = psf->header.ptr [psf->header.indx] ;
  965|    830|			psf->header.indx ++ ;
  966|    830|			}
  967|  1.86k|		else
  968|  1.86k|		{	psf->header.end += psf_fread (psf->header.ptr + psf->header.end, 1, 1, psf) ;
  969|  1.86k|			ptr [k] = psf->header.ptr [psf->header.indx] ;
  970|  1.86k|			psf->header.indx = psf->header.end ;
  971|  1.86k|			} ;
  972|       |
  973|  2.69k|		if (ptr [k] == '\n')
  ------------------
  |  Branch (973:7): [True: 46, False: 2.64k]
  ------------------
  974|     46|			break ;
  975|  2.69k|		} ;
  976|       |
  977|    122|	ptr [k] = 0 ;
  978|       |
  979|    122|	return k ;
  980|    122|} /* header_gets */
common.c:header_seek:
  888|   620k|{
  889|   620k|	switch (whence)
  890|   620k|	{	case SEEK_SET :
  ------------------
  |  Branch (890:4): [True: 20.4k, False: 600k]
  ------------------
  891|  20.4k|			if (psf->header.indx + position >= psf->header.len)
  ------------------
  |  Branch (891:8): [True: 229, False: 20.2k]
  ------------------
  892|    229|				psf_bump_header_allocation (psf, position) ;
  893|  20.4k|			if (position > psf->header.len)
  ------------------
  |  Branch (893:8): [True: 5, False: 20.4k]
  ------------------
  894|      5|			{	/* Too much header to cache so just seek instead. */
  895|      5|				psf->header.indx = psf->header.end = 0 ;
  896|      5|				psf_fseek (psf, position, whence) ;
  897|      5|				return ;
  898|  20.4k|				} ;
  899|  20.4k|			if (position > psf->header.end)
  ------------------
  |  Branch (899:8): [True: 643, False: 19.7k]
  ------------------
  900|    643|				psf->header.end += psf_fread (psf->header.ptr + psf->header.end, 1, position - psf->header.end, psf) ;
  901|  20.4k|			psf->header.indx = position ;
  902|  20.4k|			break ;
  903|       |
  904|   600k|		case SEEK_CUR :
  ------------------
  |  Branch (904:3): [True: 600k, False: 20.4k]
  ------------------
  905|   600k|			if (psf->header.indx + position >= psf->header.len)
  ------------------
  |  Branch (905:8): [True: 4.28k, False: 596k]
  ------------------
  906|  4.28k|				psf_bump_header_allocation (psf, position) ;
  907|       |
  908|   600k|			if (psf->header.indx + position < 0)
  ------------------
  |  Branch (908:8): [True: 5.26k, False: 595k]
  ------------------
  909|  5.26k|				break ;
  910|       |
  911|   595k|			if (psf->header.indx >= psf->header.len)
  ------------------
  |  Branch (911:8): [True: 0, False: 595k]
  ------------------
  912|      0|			{	psf_fseek (psf, position, whence) ;
  913|      0|				return ;
  914|   595k|				} ;
  915|       |
  916|   595k|			if (psf->header.indx + position <= psf->header.end)
  ------------------
  |  Branch (916:8): [True: 200k, False: 394k]
  ------------------
  917|   200k|			{	psf->header.indx += position ;
  918|   200k|				break ;
  919|   394k|				} ;
  920|       |
  921|   394k|			if (psf->header.indx + position > psf->header.len)
  ------------------
  |  Branch (921:8): [True: 2.68k, False: 392k]
  ------------------
  922|  2.68k|			{	/* Need to jump this without caching it. */
  923|  2.68k|				position -= (psf->header.end - psf->header.indx) ;
  924|  2.68k|				psf->header.indx = psf->header.end ;
  925|  2.68k|				if (psf->is_pipe)
  ------------------
  |  Branch (925:9): [True: 0, False: 2.68k]
  ------------------
  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.68k|				else
  937|  2.68k|				{	psf_fseek (psf, position, SEEK_CUR) ;
  938|  2.68k|					}
  939|  2.68k|				break ;
  940|   392k|				} ;
  941|       |
  942|   392k|			psf->header.end += psf_fread (psf->header.ptr + psf->header.end, 1, position - (psf->header.end - psf->header.indx), psf) ;
  943|   392k|			psf->header.indx = psf->header.end ;
  944|   392k|			break ;
  945|       |
  946|      0|		case SEEK_END :
  ------------------
  |  Branch (946:3): [True: 0, False: 620k]
  ------------------
  947|      0|		default :
  ------------------
  |  Branch (947:3): [True: 0, False: 620k]
  ------------------
  948|      0|			psf_log_printf (psf, "Bad whence param in header_seek().\n") ;
  949|      0|			break ;
  950|   620k|		} ;
  951|       |
  952|   620k|	return ;
  953|   620k|} /* header_seek */

aiff.c:peak_info_calloc:
  233|    772|{	return calloc (1, sizeof (PEAK_INFO) + channels * sizeof (PEAK_POS)) ;
  234|    772|} /* peak_info_calloc */
aiff.c:make_size_t:
  279|  2.51k|{	return (size_t) x ;
  280|  2.51k|} /* make_size_t */
avr.c:arith_shift_left:
 1086|    100|{	return (int32_t) (((uint32_t) x) << shift) ;
 1087|    100|} /* arith_shift_left */
caf.c:peak_info_calloc:
  233|    288|{	return calloc (1, sizeof (PEAK_INFO) + channels * sizeof (PEAK_POS)) ;
  234|    288|} /* peak_info_calloc */
caf.c:psf_lrint:
  974|  2.20k|{
  975|  2.20k|	#ifdef USE_SSE2
  976|  2.20k|		return _mm_cvtsd_si32 (_mm_load_sd (&x)) ;
  977|       |	#else
  978|       |		return lrint (x) ;
  979|       |	#endif
  980|  2.20k|} /* psf_lrintf */
mat4.c:psf_lrint:
  974|    581|{
  975|    581|	#ifdef USE_SSE2
  976|    581|		return _mm_cvtsd_si32 (_mm_load_sd (&x)) ;
  977|       |	#else
  978|       |		return lrint (x) ;
  979|       |	#endif
  980|    581|} /* 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|  75.4M|{	return (int32_t) (((uint32_t) x) << shift) ;
 1087|  75.4M|} /* arith_shift_left */
wavlike.c:make_size_t:
  279|  2.13k|{	return (size_t) x ;
  280|  2.13k|} /* make_size_t */
wavlike.c:peak_info_calloc:
  233|  6.78k|{	return calloc (1, sizeof (PEAK_INFO) + channels * sizeof (PEAK_POS)) ;
  234|  6.78k|} /* peak_info_calloc */
xi.c:arith_shift_left:
 1086|    662|{	return (int32_t) (((uint32_t) x) << shift) ;
 1087|    662|} /* arith_shift_left */
mpc2k.c:make_size_t:
  279|     13|{	return (size_t) x ;
  280|     13|} /* make_size_t */
dwvw.c:arith_shift_left:
 1086|  26.7M|{	return (int32_t) (((uint32_t) x) << shift) ;
 1087|  26.7M|} /* arith_shift_left */

double64_init:
   92|    297|{	static int double64_caps ;
   93|       |
   94|    297|	if (psf->sf.channels < 1 || psf->sf.channels > SF_MAX_CHANNELS)
  ------------------
  |  |  102|    217|#define		SF_MAX_CHANNELS		1024
  ------------------
  |  Branch (94:6): [True: 80, False: 217]
  |  Branch (94:30): [True: 13, False: 204]
  ------------------
   95|     93|	{	psf_log_printf (psf, "double64_init : internal error : channels = %d\n", psf->sf.channels) ;
   96|     93|		return SFE_INTERNAL ;
   97|    204|		} ;
   98|       |
   99|    204|	double64_caps = double64_get_capability (psf) ;
  100|       |
  101|    204|	psf->blockwidth = sizeof (double) * psf->sf.channels ;
  102|       |
  103|    204|	if (psf->file.mode == SFM_READ || psf->file.mode == SFM_RDWR)
  ------------------
  |  Branch (103:6): [True: 204, False: 0]
  |  Branch (103:36): [True: 0, False: 0]
  ------------------
  104|    204|	{	switch (psf->endian + double64_caps)
  105|    204|		{	case (SF_ENDIAN_BIG + DOUBLE_CAN_RW_BE) :
  ------------------
  |  Branch (105:5): [True: 0, False: 204]
  ------------------
  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|     99|			case (SF_ENDIAN_LITTLE + DOUBLE_CAN_RW_LE) :
  ------------------
  |  Branch (113:4): [True: 99, False: 105]
  ------------------
  114|     99|					psf->data_endswap = SF_FALSE ;
  115|     99|					psf->read_short		= host_read_d2s ;
  116|     99|					psf->read_int		= host_read_d2i ;
  117|     99|					psf->read_float		= host_read_d2f ;
  118|     99|					psf->read_double	= host_read_d ;
  119|     99|					break ;
  120|       |
  121|    105|			case (SF_ENDIAN_BIG + DOUBLE_CAN_RW_LE) :
  ------------------
  |  Branch (121:4): [True: 105, False: 99]
  ------------------
  122|    105|					psf->data_endswap = SF_TRUE ;
  123|    105|					psf->read_short		= host_read_d2s ;
  124|    105|					psf->read_int		= host_read_d2i ;
  125|    105|					psf->read_float		= host_read_d2f ;
  126|    105|					psf->read_double	= host_read_d ;
  127|    105|					break ;
  128|       |
  129|      0|			case (SF_ENDIAN_LITTLE + DOUBLE_CAN_RW_BE) :
  ------------------
  |  Branch (129:4): [True: 0, False: 204]
  ------------------
  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: 204]
  ------------------
  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: 204]
  ------------------
  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: 204]
  ------------------
  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: 204]
  ------------------
  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: 204]
  ------------------
  171|    204|			} ;
  172|    204|		} ;
  173|       |
  174|    204|	if (psf->file.mode == SFM_WRITE || psf->file.mode == SFM_RDWR)
  ------------------
  |  Branch (174:6): [True: 0, False: 204]
  |  Branch (174:37): [True: 0, False: 204]
  ------------------
  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|    204|		} ;
  244|       |
  245|    204|	if (psf->filelength > psf->dataoffset)
  ------------------
  |  Branch (245:6): [True: 148, False: 56]
  ------------------
  246|    148|	{	psf->datalength = (psf->dataend > 0) ? psf->dataend - psf->dataoffset :
  ------------------
  |  Branch (246:22): [True: 4, False: 144]
  ------------------
  247|    148|							psf->filelength - psf->dataoffset ;
  248|    148|		}
  249|     56|	else
  250|     56|		psf->datalength = 0 ;
  251|       |
  252|    204|	psf->sf.frames = psf->datalength / psf->blockwidth ;
  253|       |
  254|    204|	return 0 ;
  255|    204|} /* double64_init */
double64_be_read:
  285|  2.34k|{	int		exponent, negative, upper, lower ;
  286|  2.34k|	double	dvalue ;
  287|       |
  288|  2.34k|	negative = (cptr [0] & 0x80) ? 1 : 0 ;
  ------------------
  |  Branch (288:13): [True: 248, False: 2.09k]
  ------------------
  289|  2.34k|	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.34k|	upper = (((cptr [1] & 0xF) << 24) | (cptr [2] << 16) | (cptr [3] << 8) | cptr [4]) ;
  293|  2.34k|	lower = (cptr [5] << 16) | (cptr [6] << 8) | cptr [7] ;
  294|       |
  295|  2.34k|	if (exponent == 0 && upper == 0 && lower == 0)
  ------------------
  |  Branch (295:6): [True: 287, False: 2.05k]
  |  Branch (295:23): [True: 149, False: 138]
  |  Branch (295:37): [True: 139, False: 10]
  ------------------
  296|    139|		return 0.0 ;
  297|       |
  298|  2.20k|	dvalue = upper + lower / ((double) 0x1000000) ;
  299|  2.20k|	dvalue += 0x10000000 ;
  300|       |
  301|  2.20k|	exponent = exponent - 0x3FF ;
  302|       |
  303|  2.20k|	dvalue = dvalue / ((double) 0x10000000) ;
  304|       |
  305|  2.20k|	if (negative)
  ------------------
  |  Branch (305:6): [True: 248, False: 1.95k]
  ------------------
  306|    248|		dvalue *= -1 ;
  307|       |
  308|  2.20k|	if (exponent > 0)
  ------------------
  |  Branch (308:6): [True: 1.51k, False: 691]
  ------------------
  309|  1.51k|		dvalue *= pow (2.0, exponent) ;
  310|    691|	else if (exponent < 0)
  ------------------
  |  Branch (310:11): [True: 620, False: 71]
  ------------------
  311|    620|		dvalue /= pow (2.0, abs (exponent)) ;
  312|       |
  313|  2.20k|	return dvalue ;
  314|  2.34k|} /* double64_be_read */
double64_le_read:
  318|    514|{	int		exponent, negative, upper, lower ;
  319|    514|	double	dvalue ;
  320|       |
  321|    514|	negative = (cptr [7] & 0x80) ? 1 : 0 ;
  ------------------
  |  Branch (321:13): [True: 130, False: 384]
  ------------------
  322|    514|	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|    514|	upper = ((cptr [6] & 0xF) << 24) | (cptr [5] << 16) | (cptr [4] << 8) | cptr [3] ;
  326|    514|	lower = (cptr [2] << 16) | (cptr [1] << 8) | cptr [0] ;
  327|       |
  328|    514|	if (exponent == 0 && upper == 0 && lower == 0)
  ------------------
  |  Branch (328:6): [True: 205, False: 309]
  |  Branch (328:23): [True: 73, False: 132]
  |  Branch (328:37): [True: 31, False: 42]
  ------------------
  329|     31|		return 0.0 ;
  330|       |
  331|    483|	dvalue = upper + lower / ((double) 0x1000000) ;
  332|    483|	dvalue += 0x10000000 ;
  333|       |
  334|    483|	exponent = exponent - 0x3FF ;
  335|       |
  336|    483|	dvalue = dvalue / ((double) 0x10000000) ;
  337|       |
  338|    483|	if (negative)
  ------------------
  |  Branch (338:6): [True: 130, False: 353]
  ------------------
  339|    130|		dvalue *= -1 ;
  340|       |
  341|    483|	if (exponent > 0)
  ------------------
  |  Branch (341:6): [True: 150, False: 333]
  ------------------
  342|    150|		dvalue *= pow (2.0, exponent) ;
  343|    333|	else if (exponent < 0)
  ------------------
  |  Branch (343:11): [True: 330, False: 3]
  ------------------
  344|    330|		dvalue /= pow (2.0, abs (exponent)) ;
  345|       |
  346|    483|	return dvalue ;
  347|    514|} /* double64_le_read */
double64.c:double64_get_capability:
  459|    204|{	union
  460|    204|	{	double			d ;
  461|    204|		unsigned char	c [8] ;
  462|    204|	} data ;
  463|       |
  464|    204|	data.d = 1.234567890123456789 ; /* Some arbitrary value. */
  465|       |
  466|    204|	if (! psf->ieee_replace)
  ------------------
  |  Branch (466:6): [True: 204, False: 0]
  ------------------
  467|    204|	{	/* If this test is true ints and floats are compatible and little endian. */
  468|    204|		if (data.c [0] == 0xfb && data.c [1] == 0x59 && data.c [2] == 0x8c && data.c [3] == 0x42 &&
  ------------------
  |  Branch (468:7): [True: 204, False: 0]
  |  Branch (468:29): [True: 204, False: 0]
  |  Branch (468:51): [True: 204, False: 0]
  |  Branch (468:73): [True: 204, False: 0]
  ------------------
  469|    204|			data.c [4] == 0xca && data.c [5] == 0xc0 && data.c [6] == 0xf3 && data.c [7] == 0x3f)
  ------------------
  |  Branch (469:4): [True: 204, False: 0]
  |  Branch (469:26): [True: 204, False: 0]
  |  Branch (469:48): [True: 204, False: 0]
  |  Branch (469:70): [True: 204, False: 0]
  ------------------
  470|    204|			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|    204|} /* double64_get_capability */
double64.c:host_read_d2f:
  622|    489|{	BUF_UNION	ubuf ;
  623|    489|	int			bufferlen, readcount ;
  624|    489|	sf_count_t	total = 0 ;
  625|       |
  626|    489|	bufferlen = ARRAY_LEN (ubuf.dbuf) ;
  ------------------
  |  |   93|    489|#define		ARRAY_LEN(x)	((int) (sizeof (x) / sizeof ((x) [0])))
  ------------------
  627|       |
  628|    950|	while (len > 0)
  ------------------
  |  Branch (628:9): [True: 489, False: 461]
  ------------------
  629|    489|	{	if (len < bufferlen)
  ------------------
  |  Branch (629:8): [True: 422, False: 67]
  ------------------
  630|    422|			bufferlen = (int) len ;
  631|    489|		readcount = (int) psf_fread (ubuf.dbuf, sizeof (double), bufferlen, psf) ;
  632|       |
  633|    489|		if (psf->data_endswap == SF_TRUE)
  ------------------
  |  Branch (633:7): [True: 281, False: 208]
  ------------------
  634|    281|			endswap_double_array (ubuf.dbuf, readcount) ;
  635|       |
  636|    489|		d2f_array (ubuf.dbuf, readcount, ptr + total) ;
  637|    489|		total += readcount ;
  638|    489|		len -= readcount ;
  639|    489|		if (readcount < bufferlen)
  ------------------
  |  Branch (639:7): [True: 28, False: 461]
  ------------------
  640|     28|			break ;
  641|    489|		} ;
  642|       |
  643|    489|	return total ;
  644|    489|} /* host_read_d2f */
double64.c:d2f_array:
  531|  65.6k|{	for (int i = 0 ; i < count ; i++)
  ------------------
  |  Branch (531:20): [True: 65.1k, False: 489]
  ------------------
  532|  65.1k|	{	dest [i] = src [i] ;
  533|  65.1k|		} ;
  534|    489|} /* 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|    269|{	DWVW_PRIVATE	*pdwvw ;
   81|       |
   82|    269|	if (psf->codec_data != NULL)
  ------------------
  |  Branch (82:6): [True: 0, False: 269]
  ------------------
   83|      0|	{	psf_log_printf (psf, "*** psf->codec_data is not NULL.\n") ;
   84|      0|		return SFE_INTERNAL ;
   85|    269|		} ;
   86|       |
   87|    269|	if (bitwidth > 24)
  ------------------
  |  Branch (87:6): [True: 0, False: 269]
  ------------------
   88|      0|		return SFE_DWVW_BAD_BITWIDTH ;
   89|       |
   90|    269|	if (psf->file.mode == SFM_RDWR)
  ------------------
  |  Branch (90:6): [True: 0, False: 269]
  ------------------
   91|      0|		return SFE_BAD_MODE_RW ;
   92|       |
   93|    269|	if ((pdwvw = calloc (1, sizeof (DWVW_PRIVATE))) == NULL)
  ------------------
  |  Branch (93:6): [True: 0, False: 269]
  ------------------
   94|      0|		return SFE_MALLOC_FAILED ;
   95|       |
   96|    269|	psf->codec_data = (void*) pdwvw ;
   97|    269|	pdwvw->bit_width 	= bitwidth ;
   98|    269|	dwvw_read_reset (pdwvw) ;
   99|       |
  100|    269|	if (psf->file.mode == SFM_READ)
  ------------------
  |  Branch (100:6): [True: 269, False: 0]
  ------------------
  101|    269|	{	psf->read_short		= dwvw_read_s ;
  102|    269|		psf->read_int		= dwvw_read_i ;
  103|    269|		psf->read_float		= dwvw_read_f ;
  104|    269|		psf->read_double	= dwvw_read_d ;
  105|    269|		} ;
  106|       |
  107|    269|	if (psf->file.mode == SFM_WRITE)
  ------------------
  |  Branch (107:6): [True: 0, False: 269]
  ------------------
  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|    269|	psf->codec_close = dwvw_close ;
  115|    269|	psf->seek = dwvw_seek ;
  116|    269|	psf->byterate = dwvw_byterate ;
  117|       |
  118|    269|	if (psf->file.mode == SFM_READ)
  ------------------
  |  Branch (118:6): [True: 269, False: 0]
  ------------------
  119|    269|	{	psf->sf.frames = psf_decode_frame_count (psf) ;
  120|    269|		dwvw_read_reset (pdwvw) ;
  121|    269|		} ;
  122|       |
  123|    269|	return 0 ;
  124|    269|} /* dwvw_init */
dwvw.c:dwvw_close:
  131|    269|{	DWVW_PRIVATE *pdwvw ;
  132|       |
  133|    269|	if (psf->codec_data == NULL)
  ------------------
  |  Branch (133:6): [True: 0, False: 269]
  ------------------
  134|      0|		return 0 ;
  135|    269|	pdwvw = (DWVW_PRIVATE*) psf->codec_data ;
  136|       |
  137|    269|	if (psf->file.mode == SFM_WRITE)
  ------------------
  |  Branch (137:6): [True: 0, False: 269]
  ------------------
  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|    269|	return 0 ;
  151|    269|} /* dwvw_close */
dwvw.c:dwvw_decode_data:
  306|  15.5k|{	int	count ;
  307|  15.5k|	int delta_width_modifier, delta_width, delta_negative, delta, sample ;
  308|       |
  309|       |	/* Restore state from last decode call. */
  310|  15.5k|	delta_width = pdwvw->last_delta_width ;
  311|  15.5k|	sample = pdwvw->last_sample ;
  312|       |
  313|  21.8M|	for (count = 0 ; count < len ; count++)
  ------------------
  |  Branch (313:19): [True: 21.8M, False: 15.0k]
  ------------------
  314|  21.8M|	{	/* If bit_count parameter is zero get the delta_width_modifier. */
  315|  21.8M|		delta_width_modifier = dwvw_decode_load_bits (psf, pdwvw, -1) ;
  316|       |
  317|       |		/* Check for end of input bit stream. Break loop if end. */
  318|  21.8M|		if (delta_width_modifier < 0 || (pdwvw->b.end == 0 && count == 0))
  ------------------
  |  Branch (318:7): [True: 120, False: 21.8M]
  |  Branch (318:36): [True: 95.7k, False: 21.7M]
  |  Branch (318:57): [True: 202, False: 95.5k]
  ------------------
  319|    322|			break ;
  320|       |
  321|  21.8M|		if (delta_width_modifier && dwvw_decode_load_bits (psf, pdwvw, 1))
  ------------------
  |  Branch (321:7): [True: 582k, False: 21.2M]
  |  Branch (321:31): [True: 177k, False: 404k]
  ------------------
  322|   177k|			delta_width_modifier = - delta_width_modifier ;
  323|       |
  324|       |		/* Calculate the current word width. */
  325|  21.8M|		delta_width = (delta_width + delta_width_modifier + pdwvw->bit_width) % pdwvw->bit_width ;
  326|       |
  327|       |		/* Load the delta. */
  328|  21.8M|		delta = 0 ;
  329|  21.8M|		if (delta_width)
  ------------------
  |  Branch (329:7): [True: 3.09M, False: 18.7M]
  ------------------
  330|  3.09M|		{	delta = dwvw_decode_load_bits (psf, pdwvw, delta_width - 1) | (1 << (delta_width - 1)) ;
  331|  3.09M|			delta_negative = dwvw_decode_load_bits (psf, pdwvw, 1) ;
  332|  3.09M|			if (delta == pdwvw->max_delta - 1)
  ------------------
  |  Branch (332:8): [True: 226k, False: 2.87M]
  ------------------
  333|   226k|				delta += dwvw_decode_load_bits (psf, pdwvw, 1) ;
  334|  3.09M|			if (delta_negative)
  ------------------
  |  Branch (334:8): [True: 2.74M, False: 357k]
  ------------------
  335|  2.74M|				delta = -delta ;
  336|  3.09M|			} ;
  337|       |
  338|       |		/* Calculate the sample */
  339|  21.8M|		sample += delta ;
  340|       |
  341|  21.8M|		if (sample >= pdwvw->max_delta)
  ------------------
  |  Branch (341:7): [True: 21.2k, False: 21.7M]
  ------------------
  342|  21.2k|			sample -= pdwvw->span ;
  343|  21.7M|		else if (sample < - pdwvw->max_delta)
  ------------------
  |  Branch (343:12): [True: 195k, False: 21.6M]
  ------------------
  344|   195k|			sample += pdwvw->span ;
  345|       |
  346|       |		/* Store the sample justifying to the most significant bit. */
  347|  21.8M|		ptr [count] = arith_shift_left (sample, 32 - pdwvw->bit_width) ;
  348|       |
  349|  21.8M|		if (pdwvw->b.end == 0 && pdwvw->bit_count == 0)
  ------------------
  |  Branch (349:7): [True: 95.6k, False: 21.7M]
  |  Branch (349:28): [True: 133, False: 95.4k]
  ------------------
  350|    133|			break ;
  351|  21.8M|		} ;
  352|       |
  353|  15.5k|	pdwvw->last_delta_width = delta_width ;
  354|  15.5k|	pdwvw->last_sample = sample ;
  355|       |
  356|  15.5k|	pdwvw->samplecount += count ;
  357|       |
  358|  15.5k|	return count ;
  359|  15.5k|} /* dwvw_decode_data */
dwvw.c:dwvw_decode_load_bits:
  363|  28.8M|{	int output = 0, get_dwm = SF_FALSE ;
  364|       |
  365|       |	/*
  366|       |	**	Depending on the value of parameter bit_count, either get the
  367|       |	**	required number of bits (ie bit_count > 0) or the
  368|       |	**	delta_width_modifier (otherwise).
  369|       |	*/
  370|       |
  371|  28.8M|	if (bit_count < 0)
  ------------------
  |  Branch (371:6): [True: 21.8M, False: 7.00M]
  ------------------
  372|  21.8M|	{	get_dwm = SF_TRUE ;
  373|       |		/* modify bit_count to ensure we have enough bits for finding dwm. */
  374|  21.8M|		bit_count = pdwvw->dwm_maxsize ;
  375|  21.8M|		} ;
  376|       |
  377|       |	/* Load bits in bit reseviour. */
  378|  33.7M|	while (pdwvw->bit_count < bit_count)
  ------------------
  |  Branch (378:9): [True: 4.93M, False: 28.8M]
  ------------------
  379|  4.93M|	{	if (pdwvw->b.index >= pdwvw->b.end)
  ------------------
  |  Branch (379:8): [True: 302k, False: 4.63M]
  ------------------
  380|   302k|		{	pdwvw->b.end = (int) psf_fread (pdwvw->b.buffer, 1, sizeof (pdwvw->b.buffer), psf) ;
  381|   302k|			pdwvw->b.index = 0 ;
  382|   302k|			} ;
  383|       |
  384|       |		/* Check for end of input stream. */
  385|  4.93M|		if (bit_count < 8 && pdwvw->b.end == 0)
  ------------------
  |  Branch (385:7): [True: 1.71M, False: 3.21M]
  |  Branch (385:24): [True: 23.9k, False: 1.69M]
  ------------------
  386|  23.9k|			return -1 ;
  387|       |
  388|  4.91M|		pdwvw->bits = arith_shift_left (pdwvw->bits, 8) ;
  389|       |
  390|  4.91M|		if (pdwvw->b.index < pdwvw->b.end)
  ------------------
  |  Branch (390:7): [True: 4.65M, False: 260k]
  ------------------
  391|  4.65M|		{	pdwvw->bits |= pdwvw->b.buffer [pdwvw->b.index] ;
  392|  4.65M|			pdwvw->b.index ++ ;
  393|  4.65M|			} ;
  394|  4.91M|		pdwvw->bit_count += 8 ;
  395|  28.8M|		} ;
  396|       |
  397|       |	/* If asked to get bits do so. */
  398|  28.8M|	if (! get_dwm)
  ------------------
  |  Branch (398:6): [True: 6.98M, False: 21.8M]
  ------------------
  399|  6.98M|	{	output = (pdwvw->bits >> (pdwvw->bit_count - bit_count)) & ((1 << bit_count) - 1) ;
  400|  6.98M|		pdwvw->bit_count -= bit_count ;
  401|  6.98M|		return output ;
  402|  21.8M|		} ;
  403|       |
  404|       |	/* Otherwise must have been asked to get delta_width_modifier. */
  405|  24.0M|	while (output < (pdwvw->dwm_maxsize))
  ------------------
  |  Branch (405:9): [True: 23.7M, False: 262k]
  ------------------
  406|  23.7M|	{	pdwvw->bit_count -= 1 ;
  407|  23.7M|		if (pdwvw->bits & (1 << pdwvw->bit_count))
  ------------------
  |  Branch (407:7): [True: 21.5M, False: 2.23M]
  ------------------
  408|  21.5M|			break ;
  409|  2.23M|		output += 1 ;
  410|  2.23M|		} ;
  411|       |
  412|  21.8M|	return output ;
  413|  28.8M|} /* dwvw_decode_load_bits */
dwvw.c:dwvw_read_i:
  217|  11.0k|{	DWVW_PRIVATE *pdwvw ;
  218|  11.0k|	int			readcount, count ;
  219|  11.0k|	sf_count_t	total = 0 ;
  220|       |
  221|  11.0k|	if (! psf->codec_data)
  ------------------
  |  Branch (221:6): [True: 0, False: 11.0k]
  ------------------
  222|      0|		return 0 ;
  223|  11.0k|	pdwvw = (DWVW_PRIVATE*) psf->codec_data ;
  224|       |
  225|  21.6k|	while (len > 0)
  ------------------
  |  Branch (225:9): [True: 11.0k, False: 10.5k]
  ------------------
  226|  11.0k|	{	readcount = (len > 0x10000000) ? 0x10000000 : (int) len ;
  ------------------
  |  Branch (226:16): [True: 0, False: 11.0k]
  ------------------
  227|       |
  228|  11.0k|		count = dwvw_decode_data (psf, pdwvw, ptr, readcount) ;
  229|       |
  230|  11.0k|		total += count ;
  231|  11.0k|		len -= count ;
  232|       |
  233|  11.0k|		if (count != readcount)
  ------------------
  |  Branch (233:7): [True: 445, False: 10.5k]
  ------------------
  234|    445|			break ;
  235|  11.0k|		} ;
  236|       |
  237|  11.0k|	return total ;
  238|  11.0k|} /* dwvw_read_i */
dwvw.c:dwvw_read_f:
  242|  4.49k|{	DWVW_PRIVATE *pdwvw ;
  243|  4.49k|	BUF_UNION	ubuf ;
  244|  4.49k|	int			*iptr ;
  245|  4.49k|	int			k, bufferlen, readcount = 0, count ;
  246|  4.49k|	sf_count_t	total = 0 ;
  247|  4.49k|	float	normfact ;
  248|       |
  249|  4.49k|	if (! psf->codec_data)
  ------------------
  |  Branch (249:6): [True: 0, False: 4.49k]
  ------------------
  250|      0|		return 0 ;
  251|  4.49k|	pdwvw = (DWVW_PRIVATE*) psf->codec_data ;
  252|       |
  253|  4.49k|	normfact = (psf->norm_float == SF_TRUE) ? 1.0 / ((float) 0x80000000) : 1.0 ;
  ------------------
  |  Branch (253:13): [True: 4.49k, False: 0]
  ------------------
  254|       |
  255|  4.49k|	iptr = ubuf.ibuf ;
  256|  4.49k|	bufferlen = ARRAY_LEN (ubuf.ibuf) ;
  ------------------
  |  |   93|  4.49k|#define		ARRAY_LEN(x)	((int) (sizeof (x) / sizeof ((x) [0])))
  ------------------
  257|  8.97k|	while (len > 0)
  ------------------
  |  Branch (257:9): [True: 4.49k, False: 4.48k]
  ------------------
  258|  4.49k|	{	readcount = (len >= bufferlen) ? bufferlen : (int) len ;
  ------------------
  |  Branch (258:16): [True: 0, False: 4.49k]
  ------------------
  259|  4.49k|		count = dwvw_decode_data (psf, pdwvw, iptr, readcount) ;
  260|   201k|		for (k = 0 ; k < readcount ; k++)
  ------------------
  |  Branch (260:16): [True: 196k, False: 4.49k]
  ------------------
  261|   196k|			ptr [total + k] = normfact * (float) (iptr [k]) ;
  262|       |
  263|  4.49k|		total += count ;
  264|  4.49k|		len -= readcount ;
  265|  4.49k|		if (count != readcount)
  ------------------
  |  Branch (265:7): [True: 10, False: 4.48k]
  ------------------
  266|     10|			break ;
  267|  4.49k|		} ;
  268|       |
  269|  4.49k|	return total ;
  270|  4.49k|} /* dwvw_read_f */
dwvw.c:dwvw_read_reset:
  417|    538|{	int bitwidth = pdwvw->bit_width ;
  418|       |
  419|    538|	memset (pdwvw, 0, sizeof (DWVW_PRIVATE)) ;
  420|       |
  421|    538|	pdwvw->bit_width	= bitwidth ;
  422|    538|	pdwvw->dwm_maxsize	= bitwidth / 2 ;
  423|    538|	pdwvw->max_delta	= 1 << (bitwidth - 1) ;
  424|    538|	pdwvw->span			= 1 << bitwidth ;
  425|    538|} /* 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.47k|{	size_t count ;
  158|       |
  159|  1.47k|	if (psf->rsrc.filedes > 0)
  ------------------
  |  Branch (159:6): [True: 0, False: 1.47k]
  ------------------
  160|      0|		return 0 ;
  161|       |
  162|       |	/* Test for MacOSX style resource fork on HPFS or HPFS+ filesystems. */
  163|  1.47k|	count = snprintf (psf->rsrc.path, sizeof (psf->rsrc.path), "%s/..namedfork/rsrc", psf->file.path) ;
  164|  1.47k|	psf->error = SFE_NO_ERROR ;
  165|  1.47k|	if (count < sizeof (psf->rsrc.path))
  ------------------
  |  Branch (165:6): [True: 1.47k, False: 0]
  ------------------
  166|  1.47k|	{	if ((psf->rsrc.filedes = psf_open_fd (&psf->rsrc)) >= 0)
  ------------------
  |  Branch (166:8): [True: 0, False: 1.47k]
  ------------------
  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.47k|			} ;
  173|       |
  174|  1.47k|		if (psf->rsrc.filedes == - SFE_BAD_OPEN_MODE)
  ------------------
  |  Branch (174:7): [True: 0, False: 1.47k]
  ------------------
  175|      0|		{	psf->error = SFE_BAD_OPEN_MODE ;
  176|      0|			return psf->error ;
  177|  1.47k|			} ;
  178|  1.47k|		} ;
  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.47k|	count = snprintf (psf->rsrc.path, sizeof (psf->rsrc.path), "%s._%s", psf->file.dir, psf->file.name) ;
  185|  1.47k|	psf->error = SFE_NO_ERROR ;
  186|  1.47k|	if (count < sizeof (psf->rsrc.path) && (psf->rsrc.filedes = psf_open_fd (&psf->rsrc)) >= 0)
  ------------------
  |  Branch (186:6): [True: 1.47k, False: 0]
  |  Branch (186:41): [True: 0, False: 1.47k]
  ------------------
  187|      0|	{	psf->rsrclength = psf_get_filelen_fd (psf->rsrc.filedes) ;
  188|      0|		return SFE_NO_ERROR ;
  189|  1.47k|		} ;
  190|       |
  191|       |	/*
  192|       |	** Now try for a resource fork stored in a separate file in the
  193|       |	** .AppleDouble/ directory.
  194|       |	*/
  195|  1.47k|	count = snprintf (psf->rsrc.path, sizeof (psf->rsrc.path), "%s.AppleDouble/%s", psf->file.dir, psf->file.name) ;
  196|  1.47k|	psf->error = SFE_NO_ERROR ;
  197|  1.47k|	if (count < sizeof (psf->rsrc.path))
  ------------------
  |  Branch (197:6): [True: 1.47k, False: 0]
  ------------------
  198|  1.47k|	{	if ((psf->rsrc.filedes = psf_open_fd (&psf->rsrc)) >= 0)
  ------------------
  |  Branch (198:8): [True: 0, False: 1.47k]
  ------------------
  199|      0|		{	psf->rsrclength = psf_get_filelen_fd (psf->rsrc.filedes) ;
  200|      0|			return SFE_NO_ERROR ;
  201|  1.47k|			} ;
  202|       |
  203|       |		/* No resource file found. */
  204|  1.47k|		if (psf->rsrc.filedes == -1)
  ------------------
  |  Branch (204:7): [True: 1.47k, False: 0]
  ------------------
  205|  1.47k|			psf_log_syserr (psf, errno) ;
  206|  1.47k|		}
  207|      0|	else
  208|      0|	{	psf->error = SFE_OPEN_FAILED ;
  209|  1.47k|		} ;
  210|       |
  211|  1.47k|	psf->rsrc.filedes = -1 ;
  212|       |
  213|  1.47k|	return psf->error ;
  214|  1.47k|} /* 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|   400k|{	sf_count_t	absolute_position ;
  307|       |
  308|   400k|	if (psf->virtual_io)
  ------------------
  |  Branch (308:6): [True: 400k, False: 0]
  ------------------
  309|   400k|		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.32M|{	sf_count_t pos ;
  431|       |
  432|  2.32M|	if (psf->virtual_io)
  ------------------
  |  Branch (432:6): [True: 2.32M, False: 0]
  ------------------
  433|  2.32M|		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.7k|{	struct stat statbuf ;
  489|       |
  490|  17.7k|	if (psf->virtual_io)
  ------------------
  |  Branch (490:6): [True: 17.7k, False: 0]
  ------------------
  491|  17.7k|		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.41k|{	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.41k|	if (sizeof (sf_count_t) != 8)
  ------------------
  |  Branch (575:6): [Folded, False: 4.41k]
  ------------------
  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.41k|		} ;
  580|       |
  581|  4.41k|	switch (pfile->mode)
  582|  4.41k|	{	case SFM_READ :
  ------------------
  |  Branch (582:4): [True: 4.41k, False: 0]
  ------------------
  583|  4.41k|				oflag = O_RDONLY | O_BINARY ;
  ------------------
  |  |   74|  4.41k|#define O_BINARY 0
  ------------------
  584|  4.41k|				mode = 0 ;
  585|  4.41k|				break ;
  586|       |
  587|      0|		case SFM_WRITE :
  ------------------
  |  Branch (587:3): [True: 0, False: 4.41k]
  ------------------
  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.41k]
  ------------------
  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.41k]
  ------------------
  598|      0|				return - SFE_BAD_OPEN_MODE ;
  599|      0|				break ;
  600|  4.41k|		} ;
  601|       |
  602|  4.41k|	if (mode == 0)
  ------------------
  |  Branch (602:6): [True: 4.41k, False: 0]
  ------------------
  603|  4.41k|		fd = open (pfile->path, oflag) ;
  604|      0|	else
  605|      0|		fd = open (pfile->path, oflag, mode) ;
  606|       |
  607|  4.41k|	return fd ;
  608|  4.41k|} /* psf_open_fd */
file_io.c:psf_log_syserr:
  612|  1.47k|{
  613|       |	/* Only log an error if no error has been set yet. */
  614|  1.47k|	if (psf->error == 0)
  ------------------
  |  Branch (614:6): [True: 1.47k, False: 0]
  ------------------
  615|  1.47k|	{	psf->error = SFE_SYSTEM ;
  616|  1.47k|		snprintf (psf->syserr, sizeof (psf->syserr), "System error : %s.", strerror (error)) ;
  617|  1.47k|		} ;
  618|       |
  619|  1.47k|	return ;
  620|  1.47k|} /* 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|    258|{	static int float_caps ;
   90|       |
   91|    258|	if (psf->sf.channels < 1)
  ------------------
  |  Branch (91:6): [True: 10, False: 248]
  ------------------
   92|     10|	{	psf_log_printf (psf, "float32_init : internal error : channels = %d\n", psf->sf.channels) ;
   93|     10|		return SFE_INTERNAL ;
   94|    248|		} ;
   95|       |
   96|    248|	float_caps = float32_get_capability (psf) ;
   97|       |
   98|    248|	psf->blockwidth = sizeof (float) * psf->sf.channels ;
   99|       |
  100|    248|	if (psf->file.mode == SFM_READ || psf->file.mode == SFM_RDWR)
  ------------------
  |  Branch (100:6): [True: 248, False: 0]
  |  Branch (100:36): [True: 0, False: 0]
  ------------------
  101|    248|	{	switch (psf->endian + float_caps)
  102|    248|		{	case (SF_ENDIAN_BIG + FLOAT_CAN_RW_BE) :
  ------------------
  |  Branch (102:5): [True: 0, False: 248]
  ------------------
  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|    148|			case (SF_ENDIAN_LITTLE + FLOAT_CAN_RW_LE) :
  ------------------
  |  Branch (110:4): [True: 148, False: 100]
  ------------------
  111|    148|					psf->data_endswap = SF_FALSE ;
  112|    148|					psf->read_short		= host_read_f2s ;
  113|    148|					psf->read_int		= host_read_f2i ;
  114|    148|					psf->read_float		= host_read_f ;
  115|    148|					psf->read_double	= host_read_f2d ;
  116|    148|					break ;
  117|       |
  118|    100|			case (SF_ENDIAN_BIG + FLOAT_CAN_RW_LE) :
  ------------------
  |  Branch (118:4): [True: 100, False: 148]
  ------------------
  119|    100|					psf->data_endswap = SF_TRUE ;
  120|    100|					psf->read_short		= host_read_f2s ;
  121|    100|					psf->read_int		= host_read_f2i ;
  122|    100|					psf->read_float		= host_read_f ;
  123|    100|					psf->read_double	= host_read_f2d ;
  124|    100|					break ;
  125|       |
  126|      0|			case (SF_ENDIAN_LITTLE + FLOAT_CAN_RW_BE) :
  ------------------
  |  Branch (126:4): [True: 0, False: 248]
  ------------------
  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: 248]
  ------------------
  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: 248]
  ------------------
  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: 248]
  ------------------
  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: 248]
  ------------------
  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: 248]
  ------------------
  168|    248|			} ;
  169|    248|		} ;
  170|       |
  171|    248|	if (psf->file.mode == SFM_WRITE || psf->file.mode == SFM_RDWR)
  ------------------
  |  Branch (171:6): [True: 0, False: 248]
  |  Branch (171:37): [True: 0, False: 248]
  ------------------
  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|    248|		} ;
  241|       |
  242|    248|	if (psf->filelength > psf->dataoffset)
  ------------------
  |  Branch (242:6): [True: 192, False: 56]
  ------------------
  243|    192|	{	psf->datalength = (psf->dataend > 0) ? psf->dataend - psf->dataoffset :
  ------------------
  |  Branch (243:22): [True: 6, False: 186]
  ------------------
  244|    192|							psf->filelength - psf->dataoffset ;
  245|    192|		}
  246|     56|	else
  247|     56|		psf->datalength = 0 ;
  248|       |
  249|    248|	psf->sf.frames = psf->blockwidth > 0 ? psf->datalength / psf->blockwidth : 0 ;
  ------------------
  |  Branch (249:19): [True: 248, False: 0]
  ------------------
  250|       |
  251|    248|	return 0 ;
  252|    248|} /* float32_init */
float32_be_read:
  256|  2.91k|{	int		exponent, mantissa, negative ;
  257|  2.91k|	float	fvalue ;
  258|       |
  259|  2.91k|	negative = cptr [0] & 0x80 ;
  260|  2.91k|	exponent = ((cptr [0] & 0x7F) << 1) | ((cptr [1] & 0x80) ? 1 : 0) ;
  ------------------
  |  Branch (260:41): [True: 370, False: 2.54k]
  ------------------
  261|  2.91k|	mantissa = ((cptr [1] & 0x7F) << 16) | (cptr [2] << 8) | (cptr [3]) ;
  262|       |
  263|  2.91k|	if (! (exponent || mantissa))
  ------------------
  |  Branch (263:9): [True: 934, False: 1.98k]
  |  Branch (263:21): [True: 1.24k, False: 741]
  ------------------
  264|    741|		return 0.0 ;
  265|       |
  266|  2.17k|	mantissa |= 0x800000 ;
  267|  2.17k|	exponent = exponent ? exponent - 127 : 0 ;
  ------------------
  |  Branch (267:13): [True: 934, False: 1.24k]
  ------------------
  268|       |
  269|  2.17k|	fvalue = mantissa ? ((float) mantissa) / ((float) 0x800000) : 0.0 ;
  ------------------
  |  Branch (269:11): [True: 2.17k, False: 0]
  ------------------
  270|       |
  271|  2.17k|	if (negative)
  ------------------
  |  Branch (271:6): [True: 480, False: 1.69k]
  ------------------
  272|    480|		fvalue *= -1 ;
  273|       |
  274|  2.17k|	if (exponent > 0)
  ------------------
  |  Branch (274:6): [True: 366, False: 1.81k]
  ------------------
  275|    366|		fvalue *= pow (2.0, exponent) ;
  276|  1.81k|	else if (exponent < 0)
  ------------------
  |  Branch (276:11): [True: 568, False: 1.24k]
  ------------------
  277|    568|		fvalue /= pow (2.0, abs (exponent)) ;
  278|       |
  279|  2.17k|	return fvalue ;
  280|  2.91k|} /* float32_be_read */
float32_le_read:
  284|  22.8k|{	int		exponent, mantissa, negative ;
  285|  22.8k|	float	fvalue ;
  286|       |
  287|  22.8k|	negative = cptr [3] & 0x80 ;
  288|  22.8k|	exponent = ((cptr [3] & 0x7F) << 1) | ((cptr [2] & 0x80) ? 1 : 0) ;
  ------------------
  |  Branch (288:41): [True: 7.06k, False: 15.7k]
  ------------------
  289|  22.8k|	mantissa = ((cptr [2] & 0x7F) << 16) | (cptr [1] << 8) | (cptr [0]) ;
  290|       |
  291|  22.8k|	if (! (exponent || mantissa))
  ------------------
  |  Branch (291:9): [True: 15.1k, False: 7.64k]
  |  Branch (291:21): [True: 5.05k, False: 2.58k]
  ------------------
  292|  2.58k|		return 0.0 ;
  293|       |
  294|  20.2k|	mantissa |= 0x800000 ;
  295|  20.2k|	exponent = exponent ? exponent - 127 : 0 ;
  ------------------
  |  Branch (295:13): [True: 15.1k, False: 5.05k]
  ------------------
  296|       |
  297|  20.2k|	fvalue = mantissa ? ((float) mantissa) / ((float) 0x800000) : 0.0 ;
  ------------------
  |  Branch (297:11): [True: 20.2k, False: 0]
  ------------------
  298|       |
  299|  20.2k|	if (negative)
  ------------------
  |  Branch (299:6): [True: 8.61k, False: 11.5k]
  ------------------
  300|  8.61k|		fvalue *= -1 ;
  301|       |
  302|  20.2k|	if (exponent > 0)
  ------------------
  |  Branch (302:6): [True: 9.13k, False: 11.0k]
  ------------------
  303|  9.13k|		fvalue *= pow (2.0, exponent) ;
  304|  11.0k|	else if (exponent < 0)
  ------------------
  |  Branch (304:11): [True: 6.02k, False: 5.05k]
  ------------------
  305|  6.02k|		fvalue /= pow (2.0, abs (exponent)) ;
  306|       |
  307|  20.2k|	return fvalue ;
  308|  22.8k|} /* float32_le_read */
float32.c:float32_get_capability:
  410|    248|{	union
  411|    248|	{	float			f ;
  412|    248|		int				i ;
  413|    248|		unsigned char	c [4] ;
  414|    248|	} data ;
  415|       |
  416|    248|	data.f = (float) 1.23456789 ; /* Some arbitrary value. */
  417|       |
  418|    248|	if (! psf->ieee_replace)
  ------------------
  |  Branch (418:6): [True: 248, False: 0]
  ------------------
  419|    248|	{	/* If this test is true ints and floats are compatible and little endian. */
  420|    248|		if (data.c [0] == 0x52 && data.c [1] == 0x06 && data.c [2] == 0x9e && data.c [3] == 0x3f)
  ------------------
  |  Branch (420:7): [True: 248, False: 0]
  |  Branch (420:29): [True: 248, False: 0]
  |  Branch (420:51): [True: 248, False: 0]
  |  Branch (420:73): [True: 248, False: 0]
  ------------------
  421|    248|			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|    248|} /* float32_get_capability */
float32.c:host_read_f:
  574|  7.28k|{	BUF_UNION	ubuf ;
  575|  7.28k|	int			bufferlen, readcount ;
  576|  7.28k|	sf_count_t	total = 0 ;
  577|       |
  578|  7.28k|	if (psf->data_endswap != SF_TRUE)
  ------------------
  |  Branch (578:6): [True: 6.87k, False: 416]
  ------------------
  579|  6.87k|		return psf_fread (ptr, sizeof (float), len, psf) ;
  580|       |
  581|    416|	bufferlen = ARRAY_LEN (ubuf.fbuf) ;
  ------------------
  |  |   93|    416|#define		ARRAY_LEN(x)	((int) (sizeof (x) / sizeof ((x) [0])))
  ------------------
  582|       |
  583|    799|	while (len > 0)
  ------------------
  |  Branch (583:9): [True: 416, False: 383]
  ------------------
  584|    416|	{	if (len < bufferlen)
  ------------------
  |  Branch (584:8): [True: 416, False: 0]
  ------------------
  585|    416|			bufferlen = (int) len ;
  586|    416|		readcount = (int) psf_fread (ubuf.fbuf, sizeof (float), bufferlen, psf) ;
  587|       |
  588|    416|		endswap_int_copy ((int*) (ptr + total), ubuf.ibuf, readcount) ;
  589|       |
  590|    416|		total += readcount ;
  591|    416|		if (readcount < bufferlen)
  ------------------
  |  Branch (591:7): [True: 33, False: 383]
  ------------------
  592|     33|			break ;
  593|    383|		len -= readcount ;
  594|    383|		} ;
  595|       |
  596|    416|	return total ;
  597|  7.28k|} /* host_read_f */

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

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

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

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

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

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

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

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

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

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

nist_open:
   55|    139|{	int error ;
   56|       |
   57|    139|	if (psf->file.mode == SFM_READ || (psf->file.mode == SFM_RDWR && psf->filelength > 0))
  ------------------
  |  Branch (57:6): [True: 139, False: 0]
  |  Branch (57:37): [True: 0, False: 0]
  |  Branch (57:67): [True: 0, False: 0]
  ------------------
   58|    139|	{	if ((error = nist_read_header (psf)))
  ------------------
  |  Branch (58:8): [True: 124, False: 15]
  ------------------
   59|    124|			return error ;
   60|    139|		} ;
   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|      1|		case SF_FORMAT_ULAW :
  ------------------
  |  Branch (95:3): [True: 1, False: 14]
  ------------------
   96|      1|				error = ulaw_init (psf) ;
   97|      1|				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|      9|		default : error = SFE_UNIMPLEMENTED ;
  ------------------
  |  Branch (103:3): [True: 9, False: 6]
  ------------------
  104|      9|				break ;
  105|     15|		} ;
  106|       |
  107|     15|	return error ;
  108|     15|} /* nist_open */
nist.c:nist_read_header:
  121|    139|{	char	psf_header [NIST_HEADER_LENGTH + 2] ;
  122|    139|	int		bitwidth = 0, count, encoding ;
  123|    139|	unsigned bytes = 0 ;
  124|    139|	char 	str [64], *cptr ;
  125|    139|	long	samples ;
  126|       |
  127|       |	/* Go to start of file and read in the whole header. */
  128|    139|	psf_binheader_readf (psf, "pb", 0, psf_header, NIST_HEADER_LENGTH) ;
  ------------------
  |  |   40|    139|#define	NIST_HEADER_LENGTH	1024
  ------------------
  129|       |
  130|       |	/* Header is a string, so make sure it is null terminated. */
  131|    139|	psf_header [NIST_HEADER_LENGTH] = 0 ;
  ------------------
  |  |   40|    139|#define	NIST_HEADER_LENGTH	1024
  ------------------
  132|       |
  133|       |	/* Now trim the header after the end marker. */
  134|    139|	if ((cptr = strstr (psf_header, "end_head")))
  ------------------
  |  Branch (134:6): [True: 3, False: 136]
  ------------------
  135|      3|	{	cptr += strlen ("end_head") + 1 ;
  136|      3|		cptr [0] = 0 ;
  137|      3|		} ;
  138|       |
  139|    139|	if (strstr (psf_header, bad_header) == psf_header)
  ------------------
  |  Branch (139:6): [True: 1, False: 138]
  ------------------
  140|      1|		return SFE_NIST_CRLF_CONVERISON ;
  141|       |
  142|       |	/* Make sure its a NIST file. */
  143|    138|	if (strstr (psf_header, "NIST_1A\n") != psf_header)
  ------------------
  |  Branch (143:6): [True: 6, False: 132]
  ------------------
  144|      6|	{	psf_log_printf (psf, "Not a NIST file.\n") ;
  145|      6|		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: 100, False: 32]
  ------------------
  149|    100|		psf->dataoffset = count ;
  150|     32|	else
  151|     32|	{	psf_log_printf (psf, "*** Suspicious header length.\n") ;
  152|     32|		psf->dataoffset = NIST_HEADER_LENGTH ;
  ------------------
  |  |   40|     32|#define	NIST_HEADER_LENGTH	1024
  ------------------
  153|     32|		} ;
  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: 106, False: 26]
  ------------------
  158|    106|	{	sscanf (cptr, "sample_coding -s%d %63s", &count, str) ;
  159|       |
  160|    106|		if (strcmp (str, "pcm") == 0)
  ------------------
  |  Branch (160:7): [True: 1, False: 105]
  ------------------
  161|      1|		{	/* Correct this later when we find out the bitwidth. */
  162|      1|			encoding = SF_FORMAT_PCM_U8 ;
  163|      1|			}
  164|    105|		else if (strcmp (str, "alaw") == 0)
  ------------------
  |  Branch (164:12): [True: 1, False: 104]
  ------------------
  165|      1|			encoding = SF_FORMAT_ALAW ;
  166|    104|		else if ((strcmp (str, "ulaw") == 0) || (strcmp (str, "mu-law") == 0))
  ------------------
  |  Branch (166:12): [True: 1, False: 103]
  |  Branch (166:43): [True: 1, False: 102]
  ------------------
  167|      2|			encoding = SF_FORMAT_ULAW ;
  168|    102|		else
  169|    102|		{	psf_log_printf (psf, "*** Unknown encoding : %s\n", str) ;
  170|    102|			encoding = 0 ;
  171|    102|			} ;
  172|    106|		} ;
  173|       |
  174|    132|	if ((cptr = strstr (psf_header, "channel_count -i ")) != NULL)
  ------------------
  |  Branch (174:6): [True: 18, False: 114]
  ------------------
  175|     18|		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: 29, False: 103]
  ------------------
  181|     29|	{	sscanf (cptr, "sample_count -i %ld", &samples) ;
  182|     29|		psf->sf.frames = samples ;
  183|     29|		} ;
  184|       |
  185|    132|	if ((cptr = strstr (psf_header, "sample_n_bytes -i ")) != NULL)
  ------------------
  |  Branch (185:6): [True: 31, False: 101]
  ------------------
  186|     31|		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: 51, False: 2]
  ------------------
  196|     51|			psf_log_printf (psf, "Weird sample_byte_format : strlen '%s' != %d\n", str, bytes) ;
  197|       |
  198|     53|		if (bytes > 1)
  ------------------
  |  Branch (198:7): [True: 49, False: 4]
  ------------------
  199|     49|		{	if (psf->bytewidth == 0)
  ------------------
  |  Branch (199:9): [True: 36, False: 13]
  ------------------
  200|     36|				psf->bytewidth = bytes ;
  201|     13|			else if (psf->bytewidth - bytes != 0)
  ------------------
  |  Branch (201:13): [True: 8, False: 5]
  ------------------
  202|      8|			{	psf_log_printf (psf, "psf->bytewidth (%d) != bytes (%d)\n", psf->bytewidth, bytes) ;
  203|      8|				return SFE_NIST_BAD_ENCODING ;
  204|     41|				} ;
  205|       |
  206|     41|			if (strcmp (str, "01") == 0)
  ------------------
  |  Branch (206:8): [True: 3, False: 38]
  ------------------
  207|      3|				psf->endian = SF_ENDIAN_LITTLE ;
  208|     38|			else if (strcmp (str, "10") == 0)
  ------------------
  |  Branch (208:13): [True: 1, False: 37]
  ------------------
  209|      1|				psf->endian = SF_ENDIAN_BIG ;
  210|     37|			else
  211|     37|			{	psf_log_printf (psf, "Weird endian-ness : %s\n", str) ;
  212|     37|				return SFE_NIST_BAD_ENCODING ;
  213|     37|				} ;
  214|      8|			} ;
  215|       |
  216|      8|		psf->sf.format |= psf->endian ;
  217|     87|		} ;
  218|       |
  219|     87|	if ((cptr = strstr (psf_header, "sample_sig_bits -i ")))
  ------------------
  |  Branch (219:6): [True: 7, False: 80]
  ------------------
  220|      7|		sscanf (cptr, "sample_sig_bits -i %d", &bitwidth) ;
  221|       |
  222|     87|	if (strstr (psf_header, "channels_interleaved -s5 FALSE"))
  ------------------
  |  Branch (222:6): [True: 10, False: 77]
  ------------------
  223|     10|	{	psf_log_printf (psf, "Non-interleaved data unsupported.\n", str) ;
  224|     10|		return SFE_NIST_BAD_ENCODING ;
  225|     77|		} ;
  226|       |
  227|     77|	psf->blockwidth = psf->sf.channels * psf->bytewidth ;
  228|     77|	psf->datalength = psf->filelength - psf->dataoffset ;
  229|       |
  230|     77|	psf_fseek (psf, psf->dataoffset, SEEK_SET) ;
  231|       |
  232|     77|	if (encoding == SF_FORMAT_PCM_U8)
  ------------------
  |  Branch (232:6): [True: 13, False: 64]
  ------------------
  233|     13|	{	switch (psf->bytewidth)
  234|     13|		{	case 1 :
  ------------------
  |  Branch (234:5): [True: 1, False: 12]
  ------------------
  235|      1|					psf->sf.format |= SF_FORMAT_PCM_S8 ;
  236|      1|					break ;
  237|       |
  238|      1|			case 2 :
  ------------------
  |  Branch (238:4): [True: 1, False: 12]
  ------------------
  239|      1|					psf->sf.format |= SF_FORMAT_PCM_16 ;
  240|      1|					break ;
  241|       |
  242|      1|			case 3 :
  ------------------
  |  Branch (242:4): [True: 1, False: 12]
  ------------------
  243|      1|					psf->sf.format |= SF_FORMAT_PCM_24 ;
  244|      1|					break ;
  245|       |
  246|      1|			case 4 :
  ------------------
  |  Branch (246:4): [True: 1, False: 12]
  ------------------
  247|      1|					psf->sf.format |= SF_FORMAT_PCM_32 ;
  248|      1|					break ;
  249|       |
  250|      9|			default : break ;
  ------------------
  |  Branch (250:4): [True: 9, False: 4]
  ------------------
  251|     13|			} ;
  252|     13|		}
  253|     64|	else if (encoding != 0)
  ------------------
  |  Branch (253:11): [True: 2, False: 62]
  ------------------
  254|      2|		psf->sf.format |= encoding ;
  255|     62|	else
  256|     62|		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: 1, False: 14]
  ------------------
  261|      2|		case SF_FORMAT_ALAW :
  ------------------
  |  Branch (261:3): [True: 1, False: 14]
  ------------------
  262|      2|		case SF_FORMAT_PCM_U8 :
  ------------------
  |  Branch (262:3): [True: 0, False: 15]
  ------------------
  263|       |			/* Blank out endian bits. */
  264|      2|			psf->sf.format = SF_FORMAT_NIST | SF_CODEC (psf->sf.format) ;
  ------------------
  |  |  109|      2|#define SF_CODEC(x)			((x) & SF_FORMAT_SUBMASK)
  ------------------
  265|      2|			break ;
  266|       |
  267|     13|		default :
  ------------------
  |  Branch (267:3): [True: 13, False: 2]
  ------------------
  268|     13|			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|    213|{	NMS_ADPCM_PRIVATE	*pnms ;
 1027|       |
 1028|    213|	if (psf->codec_data != NULL)
  ------------------
  |  Branch (1028:6): [True: 0, False: 213]
  ------------------
 1029|      0|	{	psf_log_printf (psf, "*** psf->codec_data is not NULL.\n") ;
 1030|      0|		return SFE_INTERNAL ;
 1031|    213|		} ;
 1032|       |
 1033|    213|	psf->sf.seekable = SF_FALSE ;
 1034|       |
 1035|    213|	if (psf->sf.channels != 1)
  ------------------
  |  Branch (1035:6): [True: 0, False: 213]
  ------------------
 1036|      0|		return SFE_NMS_ADPCM_NOT_MONO ;
 1037|       |
 1038|    213|	if ((pnms = calloc (1, sizeof (NMS_ADPCM_PRIVATE))) == NULL)
  ------------------
  |  Branch (1038:6): [True: 0, False: 213]
  ------------------
 1039|      0|		return SFE_MALLOC_FAILED ;
 1040|       |
 1041|    213|	psf->codec_data = (void*) pnms ;
 1042|       |
 1043|    213|	pnms->block_curr = 0 ;
 1044|    213|	pnms->sample_curr = 0 ;
 1045|       |
 1046|    213|	switch (SF_CODEC (psf->sf.format))
  ------------------
  |  |  109|    213|#define SF_CODEC(x)			((x) & SF_FORMAT_SUBMASK)
  ------------------
 1047|    213|	{	case SF_FORMAT_NMS_ADPCM_16 :
  ------------------
  |  Branch (1047:4): [True: 167, False: 46]
  ------------------
 1048|    167|					pnms->type = NMS16 ;
 1049|    167|					pnms->shortsperblock = NMS_BLOCK_SHORTS_16 ;
  ------------------
  |  |   46|    167|#define NMS_BLOCK_SHORTS_16 21
  ------------------
 1050|    167|					break ;
 1051|     26|		case SF_FORMAT_NMS_ADPCM_24 :
  ------------------
  |  Branch (1051:3): [True: 26, False: 187]
  ------------------
 1052|     26|					pnms->type = NMS24 ;
 1053|     26|					pnms->shortsperblock = NMS_BLOCK_SHORTS_24 ;
  ------------------
  |  |   45|     26|#define NMS_BLOCK_SHORTS_24 31
  ------------------
 1054|     26|					break ;
 1055|     20|		case SF_FORMAT_NMS_ADPCM_32 :
  ------------------
  |  Branch (1055:3): [True: 20, False: 193]
  ------------------
 1056|     20|					pnms->type = NMS32 ;
 1057|     20|					pnms->shortsperblock = NMS_BLOCK_SHORTS_32 ;
  ------------------
  |  |   44|     20|#define NMS_BLOCK_SHORTS_32 41
  ------------------
 1058|     20|					break ;
 1059|       |
 1060|      0|		default : return SFE_UNIMPLEMENTED ;
  ------------------
  |  Branch (1060:3): [True: 0, False: 213]
  ------------------
 1061|    213|	} ;
 1062|    213|	nms_adpcm_codec_init (&pnms->state, pnms->type) ;
 1063|       |
 1064|    213|	psf->filelength = psf_get_filelen (psf) ;
 1065|    213|	if (psf->filelength < psf->dataoffset)
  ------------------
  |  Branch (1065:6): [True: 0, False: 213]
  ------------------
 1066|      0|		psf->filelength = psf->dataoffset ;
 1067|       |
 1068|    213|	psf->datalength = psf->filelength - psf->dataoffset ;
 1069|    213|	if (psf->dataend > 0)
  ------------------
  |  Branch (1069:6): [True: 5, False: 208]
  ------------------
 1070|      5|		psf->datalength -= psf->filelength - psf->dataend ;
 1071|       |
 1072|    213|	if (psf->file.mode == SFM_READ)
  ------------------
  |  Branch (1072:6): [True: 213, False: 0]
  ------------------
 1073|    213|	{	psf->read_short		= nms_adpcm_read_s ;
 1074|    213|		psf->read_int		= nms_adpcm_read_i ;
 1075|    213|		psf->read_float		= nms_adpcm_read_f ;
 1076|    213|		psf->read_double	= nms_adpcm_read_d ;
 1077|    213|		}
 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|    213|	if (psf->datalength % (pnms->shortsperblock * sizeof (short)))
  ------------------
  |  Branch (1085:6): [True: 198, False: 15]
  ------------------
 1086|    198|	{	psf_log_printf (psf, "*** Odd psf->datalength (%D) should be a multiple of %d\n",
 1087|    198|						psf->datalength, pnms->shortsperblock * sizeof (short)) ;
 1088|    198|		pnms->blocks_total = (psf->datalength / (pnms->shortsperblock * sizeof (short))) + 1 ;
 1089|    198|		}
 1090|     15|	else
 1091|     15|		pnms->blocks_total = psf->datalength / (pnms->shortsperblock * sizeof (short)) ;
 1092|       |
 1093|    213|	psf->sf.frames		= (sf_count_t) pnms->blocks_total * NMS_SAMPLES_PER_BLOCK ;
  ------------------
  |  |   43|    213|#define NMS_SAMPLES_PER_BLOCK 160
  ------------------
 1094|    213|	psf->codec_close	= nms_adpcm_close ;
 1095|    213|	psf->seek			= nms_adpcm_seek ;
 1096|       |
 1097|    213|	return 0 ;
 1098|    213|} /* nms_adpcm_init */
nms_adpcm.c:nms_adpcm_codec_init:
  303|    213|{	memset (s, 0, sizeof (struct nms_adpcm_state)) ;
  304|    213|	s->t_off = (type == NMS32) ? 16 : (type == NMS24) ? 8 : 0 ;
  ------------------
  |  Branch (304:13): [True: 20, False: 193]
  |  Branch (304:36): [True: 26, False: 167]
  ------------------
  305|    213|} /* nms_adpcm_codec_init */
nms_adpcm.c:nms_adpcm_read_block:
  719|  2.54M|{	int	count, indx = 0 ;
  720|       |
  721|  5.08M|	while (indx < len)
  ------------------
  |  Branch (721:9): [True: 2.54M, False: 2.54M]
  ------------------
  722|  2.54M|	{	if (pnms->sample_curr >= NMS_SAMPLES_PER_BLOCK)
  ------------------
  |  |   43|  2.54M|#define NMS_SAMPLES_PER_BLOCK 160
  ------------------
  |  Branch (722:8): [True: 15.6k, False: 2.52M]
  ------------------
  723|  15.6k|		{	pnms->block_curr ++ ;
  724|  15.6k|			pnms->sample_curr = 0 ;
  725|  15.6k|			} ;
  726|       |
  727|  2.54M|		if (pnms->block_curr > pnms->blocks_total)
  ------------------
  |  Branch (727:7): [True: 0, False: 2.54M]
  ------------------
  728|      0|		{	memset (&(ptr [indx]), 0, (len - indx) * sizeof (short)) ;
  729|      0|			return indx ;
  730|  2.54M|			} ;
  731|       |
  732|  2.54M|		if (pnms->sample_curr == 0)
  ------------------
  |  Branch (732:7): [True: 15.8k, False: 2.52M]
  ------------------
  733|  15.8k|			psf_nms_adpcm_decode_block (psf, pnms) ;
  734|       |
  735|  2.54M|		count = NMS_SAMPLES_PER_BLOCK - pnms->sample_curr ;
  ------------------
  |  |   43|  2.54M|#define NMS_SAMPLES_PER_BLOCK 160
  ------------------
  736|  2.54M|		if (len - indx < count)
  ------------------
  |  Branch (736:7): [True: 2.52M, False: 15.8k]
  ------------------
  737|  2.52M|			count = len - indx ;
  738|       |
  739|  2.54M|		memcpy (&(ptr [indx]), &(pnms->samples [pnms->sample_curr]), count * sizeof (short)) ;
  740|  2.54M|		indx += count ;
  741|  2.54M|		pnms->sample_curr += count ;
  742|  2.54M|		} ;
  743|       |
  744|  2.54M|	return indx ;
  745|  2.54M|} /* nms_adpcm_read_block */
nms_adpcm.c:psf_nms_adpcm_decode_block:
  702|  15.8k|{	int k ;
  703|       |
  704|  15.8k|	if ((k = (int) psf_fread (pnms->block, sizeof (short), pnms->shortsperblock, psf)) != pnms->shortsperblock)
  ------------------
  |  Branch (704:6): [True: 196, False: 15.6k]
  ------------------
  705|    196|	{	psf_log_printf (psf, "*** Warning : short read (%d != %d).\n", k, pnms->shortsperblock) ;
  706|    196|		memset (pnms->block + (k * sizeof (short)), 0, (pnms->shortsperblock - k) * sizeof (short)) ;
  707|    196|		} ;
  708|       |
  709|  15.8k|	if (CPU_IS_BIG_ENDIAN)
  ------------------
  |  |   11|  15.8k|#define CPU_IS_BIG_ENDIAN 0
  |  |  ------------------
  |  |  |  Branch (11:27): [Folded, False: 15.8k]
  |  |  ------------------
  ------------------
  710|      0|		endswap_short_array ((signed short *) pnms->block, pnms->shortsperblock) ;
  711|       |
  712|  15.8k|	nms_adpcm_decode_block (psf, pnms, pnms->block, pnms->samples) ;
  713|       |
  714|  15.8k|	return 1 ;
  715|  15.8k|} /* nms_adpcm_decode_block */
nms_adpcm.c:nms_adpcm_decode_block:
  638|  15.8k|{	int k ;
  639|       |
  640|  15.8k|	switch (pnms->type)
  641|  15.8k|	{	case NMS16 :
  ------------------
  |  Branch (641:4): [True: 14.3k, False: 1.53k]
  ------------------
  642|  14.3k|			nms_adpcm_block_unpack_16 (block, samples, NULL) ;
  643|  14.3k|			break ;
  644|    900|		case NMS24 :
  ------------------
  |  Branch (644:3): [True: 900, False: 14.9k]
  ------------------
  645|    900|			nms_adpcm_block_unpack_24 (block, samples, NULL) ;
  646|    900|			break ;
  647|    639|		case NMS32 :
  ------------------
  |  Branch (647:3): [True: 639, False: 15.2k]
  ------------------
  648|    639|			nms_adpcm_block_unpack_32 (block, samples, NULL) ;
  649|    639|			break ;
  650|       |
  651|      0|		default :
  ------------------
  |  Branch (651:3): [True: 0, False: 15.8k]
  ------------------
  652|      0|			psf_log_printf (psf, "*** Error : Unhandled NMS ADPCM type %d.\n", pnms->type) ;
  653|      0|			return 0 ;
  654|  15.8k|		} ;
  655|       |
  656|  2.55M|	for (k = 0 ; k < NMS_SAMPLES_PER_BLOCK ; k++)
  ------------------
  |  |   43|  2.55M|#define NMS_SAMPLES_PER_BLOCK 160
  ------------------
  |  Branch (656:15): [True: 2.54M, False: 15.8k]
  ------------------
  657|  2.54M|		samples [k] = nms_adpcm_decode_sample (&pnms->state, samples [k]) ;
  658|       |
  659|  15.8k|	return NMS_SAMPLES_PER_BLOCK ;
  ------------------
  |  |   43|  15.8k|#define NMS_SAMPLES_PER_BLOCK 160
  ------------------
  660|  15.8k|} /* nms_adpcm_decode_block */
nms_adpcm.c:nms_adpcm_block_unpack_16:
  453|  14.3k|{	int k ;
  454|  14.3k|	uint16_t w = 0 ;
  455|       |
  456|   588k|	for (k = 0 ; k < NMS_SAMPLES_PER_BLOCK ; )
  ------------------
  |  |   43|   588k|#define NMS_SAMPLES_PER_BLOCK 160
  ------------------
  |  Branch (456:15): [True: 574k, False: 14.3k]
  ------------------
  457|   574k|	{	/*
  458|       |		** k % 8 == [0-3]: Top 2-bits of a nibble
  459|       |		** k % 8 == [4-7]: Bottom 2-bits of a nibble
  460|       |		*/
  461|   574k|		if ((k & 4) == 0)
  ------------------
  |  Branch (461:7): [True: 287k, False: 287k]
  ------------------
  462|   287k|			w = *(block++) ;
  463|   287k|		else
  464|   287k|			w <<= 2 ;
  465|   574k|		codewords [k++] = (w >> 12) & 0xc ;
  466|   574k|		codewords [k++] = (w >> 8) & 0xc ;
  467|   574k|		codewords [k++] = (w >> 4) & 0xc ;
  468|   574k|		codewords [k++] = w & 0xc ;
  469|   574k|		} ;
  470|       |
  471|       |	/*
  472|       |	** Every block ends with a short representing a RMS-approximation for the
  473|       |	** block.
  474|       |	**/
  475|  14.3k|	if (rms)
  ------------------
  |  Branch (475:6): [True: 0, False: 14.3k]
  ------------------
  476|      0|		*rms = *block ;
  477|  14.3k|} /* nms_adpcm_unpack_16 */
nms_adpcm.c:nms_adpcm_block_unpack_24:
  486|    900|{	int k ;
  487|    900|	uint16_t w = 0, residual = 0 ;
  488|       |
  489|  36.9k|	for (k = 0 ; k < NMS_SAMPLES_PER_BLOCK ; )
  ------------------
  |  |   43|  36.9k|#define NMS_SAMPLES_PER_BLOCK 160
  ------------------
  |  Branch (489:15): [True: 36.0k, False: 900]
  ------------------
  490|  36.0k|	{		/*
  491|       |		** k % 16 == [0, 11]: Unpack new nibble, build residual
  492|       |		** k % 16 == [12, 15]: Unpack residual
  493|       |		*/
  494|  36.0k|		if ((k & 12) != 12)
  ------------------
  |  Branch (494:7): [True: 27.0k, False: 9.00k]
  ------------------
  495|  27.0k|		{	w = *(block++) ;
  496|  27.0k|			residual = (residual << 1) | (w & 0x1111) ;
  497|  27.0k|			}
  498|  9.00k|		else
  499|  9.00k|		{	w = residual << 1 ;
  500|  9.00k|			residual = 0 ;
  501|  9.00k|			} ;
  502|  36.0k|		codewords [k++] = (w >> 12) & 0xe ;
  503|  36.0k|		codewords [k++] = (w >> 8) & 0xe ;
  504|  36.0k|		codewords [k++] = (w >> 4) & 0xe ;
  505|  36.0k|		codewords [k++] = w & 0xe ;
  506|  36.0k|		} ;
  507|       |
  508|       |	/*
  509|       |	** Every block ends with a short representing a RMS-approximation for the
  510|       |	** block.
  511|       |	**/
  512|    900|	if (rms)
  ------------------
  |  Branch (512:6): [True: 0, False: 900]
  ------------------
  513|      0|		*rms = *block ;
  514|    900|} /* nms_adpcm_unpack_24 */
nms_adpcm.c:nms_adpcm_block_unpack_32:
  523|    639|{	int k ;
  524|    639|	uint16_t w = 0 ;
  525|       |
  526|  26.1k|	for (k = 0 ; k < NMS_SAMPLES_PER_BLOCK ; )
  ------------------
  |  |   43|  26.1k|#define NMS_SAMPLES_PER_BLOCK 160
  ------------------
  |  Branch (526:15): [True: 25.5k, False: 639]
  ------------------
  527|  25.5k|	{	w = *(block++) ;
  528|  25.5k|		codewords [k++] = (w >> 12) & 0xf ;
  529|  25.5k|		codewords [k++] = (w >> 8) & 0xf ;
  530|  25.5k|		codewords [k++] = (w >> 4) & 0xf ;
  531|  25.5k|		codewords [k++] = w & 0xf ;
  532|  25.5k|		} ;
  533|       |	/*
  534|       |	** Every block ends with a short representing a RMS-approximation for the
  535|       |	** block.
  536|       |	**/
  537|    639|	if (rms)
  ------------------
  |  Branch (537:6): [True: 0, False: 639]
  ------------------
  538|      0|		*rms = *block ;
  539|    639|} /* nms_adpcm_unpack_32 */
nms_adpcm.c:nms_adpcm_decode_sample:
  409|  2.54M|{	int_fast32_t sl ;
  410|       |
  411|  2.54M|	nms_adpcm_update (s) ;
  412|  2.54M|	sl = nms_adpcm_reconstruct_sample (s, I) ;
  413|       |
  414|       |	/* Clamp to [-0x1fdf, 0x1fdf] (just under 14 bits resolution) */
  415|  2.54M|	if (sl < -0x1fdf)
  ------------------
  |  Branch (415:6): [True: 761k, False: 1.78M]
  ------------------
  416|   761k|		sl = -0x1fdf ;
  417|  1.78M|	else if (sl > 0x1fdf)
  ------------------
  |  Branch (417:11): [True: 779k, False: 1.00M]
  ------------------
  418|   779k|		sl = 0x1fdf ;
  419|       |
  420|       |	/* Expand from 14 to 16 bits */
  421|  2.54M|	sl = (sl * 0x7fff) / 0x1fdf ;
  422|       |
  423|  2.54M|	return (int16_t) sl ;
  424|  2.54M|} /* nms_adpcm_decode_sample */
nms_adpcm.c:nms_adpcm_update:
  196|  2.54M|{	/* Variable names from ITU G.726 spec */
  197|  2.54M|	short a1ul, fa1 ;
  198|  2.54M|	int_fast32_t se ;
  199|  2.54M|	int i ;
  200|       |
  201|       |	/* Decay and Modify the scale factor in the log domain based on the codeword. */
  202|  2.54M|	s->yl = ((s->yl *0xf8) >> 8) + table_scale_factor_step [s->t_off + (s->Ik & 7)] ;
  203|  2.54M|	if (s->yl < 2171)
  ------------------
  |  Branch (203:6): [True: 41.6k, False: 2.50M]
  ------------------
  204|  41.6k|		s->yl = 2171 ;
  205|  2.50M|	else if (s->yl > 20480)
  ------------------
  |  Branch (205:11): [True: 2.11M, False: 387k]
  ------------------
  206|  2.11M|		s->yl = 20480 ;
  207|  2.54M|	s->y = nms_adpcm_antilog (s->yl) ;
  208|       |
  209|       |	/* Update the zero predictor coefficients. */
  210|  17.7M|	for (i = 0 ; i < 6 ; i++)
  ------------------
  |  Branch (210:15): [True: 15.2M, False: 2.54M]
  ------------------
  211|  15.2M|	{	s->b [i] = (s->b [i] * 0xff) >> 8 ;
  212|  15.2M|		if ((s->d_q [0] ^ s->d_q [i + 1]) >= 0)
  ------------------
  |  Branch (212:7): [True: 6.94M, False: 8.31M]
  ------------------
  213|  6.94M|			s->b [i] += 128 ;
  214|  8.31M|		else
  215|  8.31M|			s->b [i] -= 128 ;
  216|  15.2M|		}
  217|       |
  218|       |	/* Update the pole predictor coefficients. */
  219|  2.54M|	fa1 = s->a [0] >> 5 ;
  220|  2.54M|	if (fa1 < -256)
  ------------------
  |  Branch (220:6): [True: 21.4k, False: 2.52M]
  ------------------
  221|  21.4k|		fa1 = -256 ;
  222|  2.52M|	else if (fa1 > 256)
  ------------------
  |  Branch (222:11): [True: 2.44M, False: 74.2k]
  ------------------
  223|  2.44M|		fa1 = 256 ;
  224|       |
  225|  2.54M|	s->a [0] = (s->a [0] * 0xff) >> 8 ;
  226|  2.54M|	if (s->p [0] != 0 && s->p [1] != 0 && ((s->p [0] ^ s->p [1]) < 0))
  ------------------
  |  Branch (226:6): [True: 2.50M, False: 40.0k]
  |  Branch (226:23): [True: 2.49M, False: 4.00k]
  |  Branch (226:40): [True: 596k, False: 1.90M]
  ------------------
  227|   596k|		s->a [0] -= 192 ;
  228|  1.94M|	else
  229|  1.94M|	{	s->a [0] += 192 ;
  230|  1.94M|		fa1 = -fa1 ;
  231|  1.94M|		}
  232|       |
  233|  2.54M|	s->a [1] = fa1 + ((s->a [1] * 0xfe) >> 8) ;
  234|  2.54M|	if (s->p [0] != 0 && s->p [2] != 0 && ((s->p [0] ^ s->p [2]) < 0))
  ------------------
  |  Branch (234:6): [True: 2.50M, False: 40.0k]
  |  Branch (234:23): [True: 2.49M, False: 4.81k]
  |  Branch (234:40): [True: 1.06M, False: 1.43M]
  ------------------
  235|  1.06M|		s->a [1] -= 128 ;
  236|  1.47M|	else
  237|  1.47M|		s->a [1] += 128 ;
  238|       |
  239|       |	/* Stability constraints. */
  240|  2.54M|	if (s->a [1] < -12288)
  ------------------
  |  Branch (240:6): [True: 1.72M, False: 820k]
  ------------------
  241|  1.72M|		s->a [1] = -12288 ;
  242|   820k|	else if (s->a [1] > 12288)
  ------------------
  |  Branch (242:11): [True: 2.30k, False: 817k]
  ------------------
  243|  2.30k|		s->a [1] = 12288 ;
  244|  2.54M|	a1ul = 15360 - s->a [1] ;
  245|  2.54M|	if (s->a [0] >= a1ul)
  ------------------
  |  Branch (245:6): [True: 271k, False: 2.27M]
  ------------------
  246|   271k|		s->a [0] = a1ul ;
  247|  2.27M|	else
  248|  2.27M|	{	a1ul = -a1ul ;
  249|  2.27M|		if (s->a [0] < a1ul)
  ------------------
  |  Branch (249:7): [True: 5.33k, False: 2.26M]
  ------------------
  250|  5.33k|			s->a [0] = a1ul ;
  251|  2.27M|		} ;
  252|       |
  253|       |	/* Compute the zero predictor estimate and rotate past deltas. */
  254|  2.54M|	se = 0 ;
  255|  17.7M|	for (i = 5 ; i >= 0 ; i--)
  ------------------
  |  Branch (255:15): [True: 15.2M, False: 2.54M]
  ------------------
  256|  15.2M|	{	se += (int_fast32_t) s->d_q [i] * s->b [i] ;
  257|  15.2M|		s->d_q [i + 1] = s->d_q [i] ;
  258|  15.2M|		} ;
  259|  2.54M|	s->s_ez = se >> 14 ;
  260|       |
  261|       |	/* Complete the signal estimate. */
  262|  2.54M|	se += (int_fast32_t) s->a [0] * s->s_r [0] ;
  263|  2.54M|	se += (int_fast32_t) s->a [1] * s->s_r [1] ;
  264|  2.54M|	s->s_e = se >> 14 ;
  265|       |
  266|       |	/* Rotate members to prepare for next iteration. */
  267|  2.54M|	s->s_r [1] = s->s_r [0] ;
  268|  2.54M|	s->p [2] = s->p [1] ;
  269|  2.54M|	s->p [1] = s->p [0] ;
  270|  2.54M|} /* nms_adpcm_update */
nms_adpcm.c:nms_adpcm_antilog:
  184|  2.54M|{	int_fast32_t r ;
  185|       |
  186|  2.54M|	r = 0x1000 ;
  187|  2.54M|	r += (((int_fast32_t) (exp & 0x3f) * 0x166b) >> 12) ;
  188|  2.54M|	r *= table_expn [(exp & 0x7c0) >> 6] ;
  189|  2.54M|	r >>= (26 - (exp >> 11)) ;
  190|       |
  191|  2.54M|	return (short) r ;
  192|  2.54M|} /* nms_adpcm_antilog */
nms_adpcm.c:nms_adpcm_reconstruct_sample:
  275|  2.54M|{	/* Variable names from ITU G.726 spec */
  276|  2.54M|	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|  2.54M|	dqx = table_step [s->t_off + (I & 7)] * s->y ;
  286|  2.54M|	if (I & 8)
  ------------------
  |  Branch (286:6): [True: 1.22M, False: 1.31M]
  ------------------
  287|  1.22M|		dqx = -dqx ;
  288|       |
  289|       |	/* Take from delta scale to actual scale. */
  290|  2.54M|	dqx >>= 12 ;
  291|       |
  292|       |	/* Set variables used as input for the next predictor update. */
  293|  2.54M|	s->d_q [0] = dqx ;
  294|  2.54M|	s->s_r [0] = s->s_e + dqx ;
  295|  2.54M|	s->Ik = I & 0xf ;
  296|  2.54M|	s->p [0] = s->s_ez + dqx ;
  297|       |
  298|  2.54M|	return s->s_r [0] ;
  299|  2.54M|} /* nms_adpcm_reconstruct_sample */
nms_adpcm.c:nms_adpcm_read_f:
  804|  2.54M|{	BUF_UNION	ubuf ;
  805|  2.54M|	NMS_ADPCM_PRIVATE *pnms ;
  806|  2.54M|	short		*sptr ;
  807|  2.54M|	int			k, bufferlen, readcount = 0, count ;
  808|  2.54M|	sf_count_t	total = 0 ;
  809|  2.54M|	float 		normfact ;
  810|       |
  811|  2.54M|	if (psf->codec_data == NULL)
  ------------------
  |  Branch (811:6): [True: 0, False: 2.54M]
  ------------------
  812|      0|		return 0 ;
  813|  2.54M|	pnms = (NMS_ADPCM_PRIVATE*) psf->codec_data ;
  814|       |
  815|  2.54M|	normfact = (psf->norm_float == SF_TRUE) ? 1.0 / ((float) 0x8000) : 1.0 ;
  ------------------
  |  Branch (815:13): [True: 2.54M, False: 0]
  ------------------
  816|       |
  817|  2.54M|	sptr = ubuf.sbuf ;
  818|  2.54M|	bufferlen = SF_BUFFER_LEN / sizeof (short) ;
  ------------------
  |  |   77|  2.54M|#define	SF_BUFFER_LEN			(8192)
  ------------------
  819|  5.08M|	while (len > 0)
  ------------------
  |  Branch (819:9): [True: 2.54M, False: 2.54M]
  ------------------
  820|  2.54M|	{	readcount = (len >= bufferlen) ? bufferlen : (int) len ;
  ------------------
  |  Branch (820:16): [True: 0, False: 2.54M]
  ------------------
  821|  2.54M|		count = nms_adpcm_read_block (psf, pnms, sptr, readcount) ;
  822|  5.08M|		for (k = 0 ; k < readcount ; k++)
  ------------------
  |  Branch (822:16): [True: 2.54M, False: 2.54M]
  ------------------
  823|  2.54M|			ptr [total + k] = normfact * sptr [k] ;
  824|       |
  825|  2.54M|		total += count ;
  826|  2.54M|		len -= readcount ;
  827|  2.54M|		if (count != readcount)
  ------------------
  |  Branch (827:7): [True: 0, False: 2.54M]
  ------------------
  828|      0|			break ;
  829|  2.54M|		} ;
  830|       |
  831|  2.54M|	return total ;
  832|  2.54M|} /* nms_adpcm_read_f */
nms_adpcm.c:nms_adpcm_close:
 1102|    213|{	NMS_ADPCM_PRIVATE *pnms ;
 1103|       |
 1104|    213|	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|    213|	if (psf->file.mode == SFM_WRITE)
  ------------------
  |  Branch (1110:6): [True: 0, False: 213]
  ------------------
 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|    213|	return 0 ;
 1121|    213|} /* nms_adpcm_close */

ogg_open:
  920|      2|{
  921|      2|	psf_log_printf (psf, "This version of libsndfile was compiled without Ogg/Vorbis support.\n") ;
  922|      2|	return SFE_UNIMPLEMENTED ;
  923|      2|} /* ogg_open */

paf_open:
  103|    169|{	int		subformat, error, endian ;
  104|       |
  105|    169| 	psf->dataoffset = PAF_HEADER_LENGTH ;
  ------------------
  |  |   43|    169|#define	PAF_HEADER_LENGTH 			2048
  ------------------
  106|       |
  107|    169|	if (psf->file.mode == SFM_READ || (psf->file.mode == SFM_RDWR && psf->filelength > 0))
  ------------------
  |  Branch (107:6): [True: 169, False: 0]
  |  Branch (107:37): [True: 0, False: 0]
  |  Branch (107:67): [True: 0, False: 0]
  ------------------
  108|    169|	{	if ((error = paf_read_header (psf)))
  ------------------
  |  Branch (108:8): [True: 81, False: 88]
  ------------------
  109|     81|			return error ;
  110|    169|		} ;
  111|       |
  112|     88|	subformat = SF_CODEC (psf->sf.format) ;
  ------------------
  |  |  109|     88|#define SF_CODEC(x)			((x) & SF_FORMAT_SUBMASK)
  ------------------
  113|       |
  114|     88|	if (psf->file.mode == SFM_WRITE || psf->file.mode == SFM_RDWR)
  ------------------
  |  Branch (114:6): [True: 0, False: 88]
  |  Branch (114:37): [True: 0, False: 88]
  ------------------
  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|     88|		} ;
  131|       |
  132|     88|	switch (subformat)
  133|     88|	{	case SF_FORMAT_PCM_S8 :
  ------------------
  |  Branch (133:4): [True: 2, False: 86]
  ------------------
  134|      2|					psf->bytewidth = 1 ;
  135|      2|					error = pcm_init (psf) ;
  136|      2|					break ;
  137|       |
  138|      3|		case SF_FORMAT_PCM_16 :
  ------------------
  |  Branch (138:3): [True: 3, False: 85]
  ------------------
  139|      3|					psf->bytewidth = 2 ;
  140|      3|					error = pcm_init (psf) ;
  141|      3|					break ;
  142|       |
  143|     83|		case SF_FORMAT_PCM_24 :
  ------------------
  |  Branch (143:3): [True: 83, False: 5]
  ------------------
  144|       |					/* No bytewidth because of whacky 24 bit encoding. */
  145|     83|					error = paf24_init (psf) ;
  146|     83|					break ;
  147|       |
  148|      0|		default : return SFE_PAF_UNKNOWN_FORMAT ;
  ------------------
  |  Branch (148:3): [True: 0, False: 88]
  ------------------
  149|     88|		} ;
  150|       |
  151|     88|	return error ;
  152|     88|} /* paf_open */
paf.c:paf_read_header:
  159|    169|{	PAF_FMT		paf_fmt ;
  160|    169|	int			marker ;
  161|       |
  162|    169|	if (psf->filelength < PAF_HEADER_LENGTH)
  ------------------
  |  |   43|    169|#define	PAF_HEADER_LENGTH 			2048
  ------------------
  |  Branch (162:6): [True: 4, False: 165]
  ------------------
  163|      4|		return SFE_PAF_SHORT_HEADER ;
  164|       |
  165|    165|	memset (&paf_fmt, 0, sizeof (paf_fmt)) ;
  166|    165|	psf_binheader_readf (psf, "pm", 0, &marker) ;
  167|       |
  168|    165|	psf_log_printf (psf, "Signature   : '%M'\n", marker) ;
  169|       |
  170|    165|	if (marker == PAF_MARKER)
  ------------------
  |  |   37|    165|#define PAF_MARKER	(MAKE_MARKER (' ', 'p', 'a', 'f'))
  |  |  ------------------
  |  |  |  |  122|    165|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (170:6): [True: 142, False: 23]
  ------------------
  171|    142|	{	psf_binheader_readf (psf, "E444444", &(paf_fmt.version), &(paf_fmt.endianness),
  172|    142|			&(paf_fmt.samplerate), &(paf_fmt.format), &(paf_fmt.channels), &(paf_fmt.source)) ;
  173|    142|		}
  174|     23|	else if (marker == FAP_MARKER)
  ------------------
  |  |   36|     23|#define FAP_MARKER	(MAKE_MARKER ('f', 'a', 'p', ' '))
  |  |  ------------------
  |  |  |  |  122|     23|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (174:11): [True: 23, False: 0]
  ------------------
  175|     23|	{	psf_binheader_readf (psf, "e444444", &(paf_fmt.version), &(paf_fmt.endianness),
  176|     23|			&(paf_fmt.samplerate), &(paf_fmt.format), &(paf_fmt.channels), &(paf_fmt.source)) ;
  177|     23|		}
  178|      0|	else
  179|      0|		return SFE_PAF_NO_MARKER ;
  180|       |
  181|    165|	psf_log_printf (psf, "Version     : %d\n", paf_fmt.version) ;
  182|       |
  183|    165|	if (paf_fmt.version != 0)
  ------------------
  |  Branch (183:6): [True: 30, False: 135]
  ------------------
  184|     30|	{	psf_log_printf (psf, "*** Bad version number. should be zero.\n") ;
  185|     30|		return SFE_PAF_VERSION ;
  186|    135|		} ;
  187|       |
  188|    135|	psf_log_printf (psf, "Sample Rate : %d\n", paf_fmt.samplerate) ;
  189|    135|	psf_log_printf (psf, "Channels    : %d\n", paf_fmt.channels) ;
  190|       |
  191|    135|	psf_log_printf (psf, "Endianness  : %d => ", paf_fmt.endianness) ;
  192|    135|	if (paf_fmt.endianness)
  ------------------
  |  Branch (192:6): [True: 84, False: 51]
  ------------------
  193|     84|	{	psf_log_printf (psf, "Little\n", paf_fmt.endianness) ;
  194|     84|		psf->endian = SF_ENDIAN_LITTLE ;
  195|     84|		}
  196|     51|	else
  197|     51|	{	psf_log_printf (psf, "Big\n", paf_fmt.endianness) ;
  198|     51|		psf->endian = SF_ENDIAN_BIG ;
  199|     51|		} ;
  200|       |
  201|    135|	if (paf_fmt.channels < 1 || paf_fmt.channels > SF_MAX_CHANNELS)
  ------------------
  |  |  102|    108|#define		SF_MAX_CHANNELS		1024
  ------------------
  |  Branch (201:6): [True: 27, False: 108]
  |  Branch (201:30): [True: 18, False: 90]
  ------------------
  202|     45|		return SFE_PAF_BAD_CHANNELS ;
  203|       |
  204|     90|	psf->datalength = psf->filelength - psf->dataoffset ;
  205|       |
  206|     90|	psf_binheader_readf (psf, "p", (int) psf->dataoffset) ;
  207|       |
  208|     90|	psf->sf.samplerate	= paf_fmt.samplerate ;
  209|     90|	psf->sf.channels 	= paf_fmt.channels ;
  210|       |
  211|       |	/* Only fill in type major. */
  212|     90|	psf->sf.format = SF_FORMAT_PAF ;
  213|       |
  214|     90|	psf_log_printf (psf, "Format      : %d => ", paf_fmt.format) ;
  215|       |
  216|       |	/* PAF is by default big endian. */
  217|     90|	psf->sf.format |= paf_fmt.endianness ? SF_ENDIAN_LITTLE : SF_ENDIAN_BIG ;
  ------------------
  |  Branch (217:20): [True: 47, False: 43]
  ------------------
  218|       |
  219|     90|	switch (paf_fmt.format)
  220|     90|	{	case PAF_PCM_S8 :
  ------------------
  |  Branch (220:4): [True: 2, False: 88]
  ------------------
  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|      3|		case PAF_PCM_16 :
  ------------------
  |  Branch (230:3): [True: 3, False: 87]
  ------------------
  231|      3|					psf_log_printf (psf, "16 bit linear PCM\n") ;
  232|      3|					psf->bytewidth = 2 ;
  233|       |
  234|      3|					psf->sf.format |= SF_FORMAT_PCM_16 ;
  235|       |
  236|      3|					psf->blockwidth = psf->bytewidth * psf->sf.channels ;
  237|      3|					psf->sf.frames = psf->datalength / psf->blockwidth ;
  238|      3|					break ;
  239|       |
  240|     83|		case PAF_PCM_24 :
  ------------------
  |  Branch (240:3): [True: 83, False: 7]
  ------------------
  241|     83|					psf_log_printf (psf, "24 bit linear PCM\n") ;
  242|     83|					psf->bytewidth = 3 ;
  243|       |
  244|     83|					psf->sf.format |= SF_FORMAT_PCM_24 ;
  245|       |
  246|     83|					psf->blockwidth = 0 ;
  247|     83|					psf->sf.frames = PAF24_SAMPLES_PER_BLOCK * psf->datalength /
  ------------------
  |  |   45|     83|#define	PAF24_SAMPLES_PER_BLOCK		10
  ------------------
  248|     83|											(PAF24_BLOCK_SIZE * psf->sf.channels) ;
  ------------------
  |  |   46|     83|#define	PAF24_BLOCK_SIZE			32
  ------------------
  249|     83|					break ;
  250|       |
  251|      2|		default :	psf_log_printf (psf, "Unknown\n") ;
  ------------------
  |  Branch (251:3): [True: 2, False: 88]
  ------------------
  252|      2|					return SFE_PAF_UNKNOWN_FORMAT ;
  253|      0|					break ;
  254|     90|		} ;
  255|       |
  256|     88|	psf_log_printf (psf, "Source      : %d => ", paf_fmt.source) ;
  257|       |
  258|     88|	switch (paf_fmt.source)
  259|     88|	{	case 1 : psf_log_printf (psf, "Analog Recording\n") ;
  ------------------
  |  Branch (259:4): [True: 5, False: 83]
  ------------------
  260|      5|					break ;
  261|      2|		case 2 : psf_log_printf (psf, "Digital Transfer\n") ;
  ------------------
  |  Branch (261:3): [True: 2, False: 86]
  ------------------
  262|      2|					break ;
  263|      1|		case 3 : psf_log_printf (psf, "Multi-track Mixdown\n") ;
  ------------------
  |  Branch (263:3): [True: 1, False: 87]
  ------------------
  264|      1|					break ;
  265|      5|		case 5 : psf_log_printf (psf, "Audio Resulting From DSP Processing\n") ;
  ------------------
  |  Branch (265:3): [True: 5, False: 83]
  ------------------
  266|      5|					break ;
  267|     75|		default : psf_log_printf (psf, "Unknown\n") ;
  ------------------
  |  Branch (267:3): [True: 75, False: 13]
  ------------------
  268|     75|					break ;
  269|     88|		} ;
  270|       |
  271|     88|	return 0 ;
  272|     88|} /* paf_read_header */
paf.c:paf24_init:
  346|     83|{	PAF24_PRIVATE	*ppaf24 ;
  347|     83|	int	paf24size ;
  348|       |
  349|     83|	paf24size = sizeof (PAF24_PRIVATE) + psf->sf.channels *
  350|     83|					(PAF24_BLOCK_SIZE + PAF24_SAMPLES_PER_BLOCK * sizeof (int)) ;
  ------------------
  |  |   46|     83|#define	PAF24_BLOCK_SIZE			32
  ------------------
              					(PAF24_BLOCK_SIZE + PAF24_SAMPLES_PER_BLOCK * sizeof (int)) ;
  ------------------
  |  |   45|     83|#define	PAF24_SAMPLES_PER_BLOCK		10
  ------------------
  351|       |
  352|       |	/*
  353|       |	**	Not exactly sure why this needs to be here but the tests
  354|       |	**	fail without it.
  355|       |	*/
  356|     83|	psf->last_op = 0 ;
  357|       |
  358|     83|	if (! (psf->codec_data = calloc (1, paf24size)))
  ------------------
  |  Branch (358:6): [True: 0, False: 83]
  ------------------
  359|      0|		return SFE_MALLOC_FAILED ;
  360|       |
  361|     83|	ppaf24 = (PAF24_PRIVATE*) psf->codec_data ;
  362|       |
  363|     83|	ppaf24->channels	= psf->sf.channels ;
  364|     83|	ppaf24->samples		= ppaf24->data ;
  365|     83|	ppaf24->block		= ppaf24->data + PAF24_SAMPLES_PER_BLOCK * ppaf24->channels ;
  ------------------
  |  |   45|     83|#define	PAF24_SAMPLES_PER_BLOCK		10
  ------------------
  366|       |
  367|     83|	ppaf24->blocksize = PAF24_BLOCK_SIZE * ppaf24->channels ;
  ------------------
  |  |   46|     83|#define	PAF24_BLOCK_SIZE			32
  ------------------
  368|       |
  369|     83|	if (psf->file.mode == SFM_READ || psf->file.mode == SFM_RDWR)
  ------------------
  |  Branch (369:6): [True: 83, False: 0]
  |  Branch (369:36): [True: 0, False: 0]
  ------------------
  370|     83|	{	paf24_read_block (psf, ppaf24) ;	/* Read first block. */
  371|       |
  372|     83|		psf->read_short		= paf24_read_s ;
  373|     83|		psf->read_int		= paf24_read_i ;
  374|     83|		psf->read_float		= paf24_read_f ;
  375|     83|		psf->read_double	= paf24_read_d ;
  376|     83|		} ;
  377|       |
  378|     83|	if (psf->file.mode == SFM_WRITE || psf->file.mode == SFM_RDWR)
  ------------------
  |  Branch (378:6): [True: 0, False: 83]
  |  Branch (378:37): [True: 0, False: 83]
  ------------------
  379|      0|	{	psf->write_short	= paf24_write_s ;
  380|      0|		psf->write_int		= paf24_write_i ;
  381|      0|		psf->write_float	= paf24_write_f ;
  382|      0|		psf->write_double	= paf24_write_d ;
  383|      0|		} ;
  384|       |
  385|     83|	psf->seek	= paf24_seek ;
  386|     83|	psf->container_close	= paf24_close ;
  387|       |
  388|     83|	psf->filelength = psf_get_filelen (psf) ;
  389|     83|	psf->datalength = psf->filelength - psf->dataoffset ;
  390|       |
  391|     83|	if (psf->datalength % PAF24_BLOCK_SIZE)
  ------------------
  |  |   46|     83|#define	PAF24_BLOCK_SIZE			32
  ------------------
  |  Branch (391:6): [True: 68, False: 15]
  ------------------
  392|     68|	{	if (psf->file.mode == SFM_READ)
  ------------------
  |  Branch (392:8): [True: 68, False: 0]
  ------------------
  393|     68|			psf_log_printf (psf, "*** Warning : file seems to be truncated.\n") ;
  394|     68|		ppaf24->max_blocks = psf->datalength / ppaf24->blocksize + 1 ;
  395|     68|		}
  396|     15|	else
  397|     15|		ppaf24->max_blocks = psf->datalength / ppaf24->blocksize ;
  398|       |
  399|     83|	ppaf24->read_block = 0 ;
  400|     83|	if (psf->file.mode == SFM_RDWR)
  ------------------
  |  Branch (400:6): [True: 0, False: 83]
  ------------------
  401|      0|		ppaf24->write_block = ppaf24->max_blocks ;
  402|     83|	else
  403|     83|		ppaf24->write_block = 0 ;
  404|       |
  405|     83|	psf->sf.frames = PAF24_SAMPLES_PER_BLOCK * ppaf24->max_blocks ;
  ------------------
  |  |   45|     83|#define	PAF24_SAMPLES_PER_BLOCK		10
  ------------------
  406|     83|	ppaf24->sample_count = psf->sf.frames ;
  407|       |
  408|     83|	return 0 ;
  409|     83|} /* paf24_init */
paf.c:paf24_read_block:
  484|  83.6k|{	int				k, channel ;
  485|  83.6k|	unsigned char	*cptr ;
  486|       |
  487|  83.6k|	ppaf24->read_block ++ ;
  488|  83.6k|	ppaf24->read_count = 0 ;
  489|       |
  490|  83.6k|	if (ppaf24->read_block * PAF24_SAMPLES_PER_BLOCK > ppaf24->sample_count)
  ------------------
  |  |   45|  83.6k|#define	PAF24_SAMPLES_PER_BLOCK		10
  ------------------
  |  Branch (490:6): [True: 83, False: 83.5k]
  ------------------
  491|     83|	{	memset (ppaf24->samples, 0, PAF24_SAMPLES_PER_BLOCK * ppaf24->channels) ;
  ------------------
  |  |   45|     83|#define	PAF24_SAMPLES_PER_BLOCK		10
  ------------------
  492|     83|		return 1 ;
  493|  83.5k|		} ;
  494|       |
  495|       |	/* Read the block. */
  496|  83.5k|	if ((k = (int) psf_fread (ppaf24->block, 1, ppaf24->blocksize, psf)) != ppaf24->blocksize)
  ------------------
  |  Branch (496:6): [True: 67, False: 83.4k]
  ------------------
  497|     67|		psf_log_printf (psf, "*** Warning : short read (%d != %d).\n", k, ppaf24->blocksize) ;
  498|       |
  499|       |	/* Do endian swapping if necessary. */
  500|  83.5k|	if ((CPU_IS_BIG_ENDIAN && psf->endian == SF_ENDIAN_LITTLE) || (CPU_IS_LITTLE_ENDIAN && psf->endian == SF_ENDIAN_BIG))
  ------------------
  |  |   11|   167k|#define CPU_IS_BIG_ENDIAN 0
  |  |  ------------------
  |  |  |  Branch (11:27): [Folded, False: 83.5k]
  |  |  ------------------
  ------------------
              	if ((CPU_IS_BIG_ENDIAN && psf->endian == SF_ENDIAN_LITTLE) || (CPU_IS_LITTLE_ENDIAN && psf->endian == SF_ENDIAN_BIG))
  ------------------
  |  |   14|   167k|#define CPU_IS_LITTLE_ENDIAN 1
  |  |  ------------------
  |  |  |  Branch (14:30): [True: 83.5k, Folded]
  |  |  ------------------
  ------------------
  |  Branch (500:28): [True: 0, False: 0]
  |  Branch (500:89): [True: 53.0k, False: 30.5k]
  ------------------
  501|  53.0k|		endswap_int_array (ppaf24->block, 8 * ppaf24->channels) ;
  502|       |
  503|       |	/* Unpack block. */
  504|   956k|	for (k = 0 ; k < PAF24_SAMPLES_PER_BLOCK * ppaf24->channels ; k++)
  ------------------
  |  |   45|   956k|#define	PAF24_SAMPLES_PER_BLOCK		10
  ------------------
  |  Branch (504:15): [True: 873k, False: 83.5k]
  ------------------
  505|   873k|	{	channel = k % ppaf24->channels ;
  506|   873k|		cptr = ((unsigned char *) ppaf24->block) + PAF24_BLOCK_SIZE * channel + 3 * (k / ppaf24->channels) ;
  ------------------
  |  |   46|   873k|#define	PAF24_BLOCK_SIZE			32
  ------------------
  507|   873k|		ppaf24->samples [k] = (cptr [0] << 8) | (cptr [1] << 16) | (((unsigned) cptr [2]) << 24) ;
  508|   873k|		} ;
  509|       |
  510|  83.5k|	return 1 ;
  511|  83.6k|} /* paf24_read_block */
paf.c:paf24_read:
  515|   834k|{	int	count, total = 0 ;
  516|       |
  517|  1.66M|	while (total < len)
  ------------------
  |  Branch (517:9): [True: 834k, False: 834k]
  ------------------
  518|   834k|	{	if (ppaf24->read_block * PAF24_SAMPLES_PER_BLOCK >= ppaf24->sample_count)
  ------------------
  |  |   45|   834k|#define	PAF24_SAMPLES_PER_BLOCK		10
  ------------------
  |  Branch (518:8): [True: 70, False: 834k]
  ------------------
  519|     70|		{	memset (&(ptr [total]), 0, (len - total) * sizeof (int)) ;
  520|     70|			return total ;
  521|   834k|			} ;
  522|       |
  523|   834k|		if (ppaf24->read_count >= PAF24_SAMPLES_PER_BLOCK)
  ------------------
  |  |   45|   834k|#define	PAF24_SAMPLES_PER_BLOCK		10
  ------------------
  |  Branch (523:7): [True: 83.4k, False: 751k]
  ------------------
  524|  83.4k|			paf24_read_block (psf, ppaf24) ;
  525|       |
  526|   834k|		count = (PAF24_SAMPLES_PER_BLOCK - ppaf24->read_count) * ppaf24->channels ;
  ------------------
  |  |   45|   834k|#define	PAF24_SAMPLES_PER_BLOCK		10
  ------------------
  527|   834k|		count = (len - total > count) ? count : len - total ;
  ------------------
  |  Branch (527:11): [True: 0, False: 834k]
  ------------------
  528|       |
  529|   834k|		memcpy (&(ptr [total]), &(ppaf24->samples [ppaf24->read_count * ppaf24->channels]), count * sizeof (int)) ;
  530|   834k|		total += count ;
  531|   834k|		ppaf24->read_count += count / ppaf24->channels ;
  532|   834k|		} ;
  533|       |
  534|   834k|	return total ;
  535|   834k|} /* paf24_read */
paf.c:paf24_read_f:
  578|   834k|{	BUF_UNION		ubuf ;
  579|   834k|	PAF24_PRIVATE 	*ppaf24 ;
  580|   834k|	int				*iptr ;
  581|   834k|	int				k, bufferlen, readcount, count ;
  582|   834k|	sf_count_t		total = 0 ;
  583|   834k|	float			normfact ;
  584|       |
  585|   834k|	if (psf->codec_data == NULL)
  ------------------
  |  Branch (585:6): [True: 0, False: 834k]
  ------------------
  586|      0|		return 0 ;
  587|   834k|	ppaf24 = (PAF24_PRIVATE*) psf->codec_data ;
  588|       |
  589|   834k|	normfact = (psf->norm_float == SF_TRUE) ? (1.0 / 0x80000000) : (1.0 / 0x100) ;
  ------------------
  |  Branch (589:13): [True: 834k, False: 0]
  ------------------
  590|       |
  591|   834k|	iptr = ubuf.ibuf ;
  592|   834k|	bufferlen = ARRAY_LEN (ubuf.ibuf) ;
  ------------------
  |  |   93|   834k|#define		ARRAY_LEN(x)	((int) (sizeof (x) / sizeof ((x) [0])))
  ------------------
  593|  1.66M|	while (len > 0)
  ------------------
  |  Branch (593:9): [True: 834k, False: 834k]
  ------------------
  594|   834k|	{	readcount = (len >= bufferlen) ? bufferlen : (int) len ;
  ------------------
  |  Branch (594:16): [True: 0, False: 834k]
  ------------------
  595|   834k|		count = paf24_read (psf, ppaf24, iptr, readcount) ;
  596|  1.67M|		for (k = 0 ; k < readcount ; k++)
  ------------------
  |  Branch (596:16): [True: 842k, False: 834k]
  ------------------
  597|   842k|			ptr [total + k] = normfact * iptr [k] ;
  598|   834k|		total += count ;
  599|   834k|		len -= readcount ;
  600|   834k|		} ;
  601|   834k|	return total ;
  602|   834k|} /* paf24_read_f */
paf.c:paf24_seek:
  413|     70|{	PAF24_PRIVATE	*ppaf24 ;
  414|     70|	int				newblock, newsample ;
  415|       |
  416|     70|	if (psf->codec_data == NULL)
  ------------------
  |  Branch (416:6): [True: 0, False: 70]
  ------------------
  417|      0|	{	psf->error = SFE_INTERNAL ;
  418|      0|		return PSF_SEEK_ERROR ;
  ------------------
  |  |   83|      0|#define	PSF_SEEK_ERROR			((sf_count_t) -1)
  ------------------
  419|     70|		} ;
  420|       |
  421|     70|	ppaf24 = (PAF24_PRIVATE*) psf->codec_data ;
  422|       |
  423|     70|	if (mode == SFM_READ && ppaf24->write_count > 0)
  ------------------
  |  Branch (423:6): [True: 70, False: 0]
  |  Branch (423:26): [True: 0, False: 70]
  ------------------
  424|      0|		paf24_write_block (psf, ppaf24) ;
  425|       |
  426|     70|	newblock	= offset / PAF24_SAMPLES_PER_BLOCK ;
  ------------------
  |  |   45|     70|#define	PAF24_SAMPLES_PER_BLOCK		10
  ------------------
  427|     70|	newsample	= offset % PAF24_SAMPLES_PER_BLOCK ;
  ------------------
  |  |   45|     70|#define	PAF24_SAMPLES_PER_BLOCK		10
  ------------------
  428|       |
  429|     70|	switch (mode)
  430|     70|	{	case SFM_READ :
  ------------------
  |  Branch (430:4): [True: 70, False: 0]
  ------------------
  431|     70|				if (psf->last_op == SFM_WRITE && ppaf24->write_count)
  ------------------
  |  Branch (431:9): [True: 0, False: 70]
  |  Branch (431:38): [True: 0, False: 0]
  ------------------
  432|      0|					paf24_write_block (psf, ppaf24) ;
  433|       |
  434|     70|				psf_fseek (psf, psf->dataoffset + newblock * ppaf24->blocksize, SEEK_SET) ;
  435|     70|				ppaf24->read_block = newblock ;
  436|     70|				paf24_read_block (psf, ppaf24) ;
  437|     70|				ppaf24->read_count = newsample ;
  438|     70|				break ;
  439|       |
  440|      0|		case SFM_WRITE :
  ------------------
  |  Branch (440:3): [True: 0, False: 70]
  ------------------
  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: 70]
  ------------------
  456|      0|				psf->error = SFE_BAD_SEEK ;
  457|      0|				return PSF_SEEK_ERROR ;
  ------------------
  |  |   83|      0|#define	PSF_SEEK_ERROR			((sf_count_t) -1)
  ------------------
  458|     70|		} ;
  459|       |
  460|     70|	return newblock * PAF24_SAMPLES_PER_BLOCK + newsample ;
  ------------------
  |  |   45|     70|#define	PAF24_SAMPLES_PER_BLOCK		10
  ------------------
  461|     70|} /* paf24_seek */
paf.c:paf24_close:
  465|     83|{	PAF24_PRIVATE *ppaf24 ;
  466|       |
  467|     83|	if (psf->codec_data == NULL)
  ------------------
  |  Branch (467:6): [True: 0, False: 83]
  ------------------
  468|      0|		return 0 ;
  469|       |
  470|     83|	ppaf24 = (PAF24_PRIVATE*) psf->codec_data ;
  471|       |
  472|     83|	if (psf->file.mode == SFM_WRITE || psf->file.mode == SFM_RDWR)
  ------------------
  |  Branch (472:6): [True: 0, False: 83]
  |  Branch (472:37): [True: 0, False: 83]
  ------------------
  473|      0|	{	if (ppaf24->write_count > 0)
  ------------------
  |  Branch (473:8): [True: 0, False: 0]
  ------------------
  474|      0|			paf24_write_block (psf, ppaf24) ;
  475|      0|		} ;
  476|       |
  477|     83|	return 0 ;
  478|     83|} /* paf24_close */

pcm_init:
  123|    789|{	int chars = 0 ;
  124|       |
  125|    789|	if (psf->bytewidth == 0 || psf->sf.channels == 0)
  ------------------
  |  Branch (125:6): [True: 5, False: 784]
  |  Branch (125:29): [True: 42, False: 742]
  ------------------
  126|     47|	{	psf_log_printf (psf, "pcm_init : internal error : bytewitdh = %d, channels = %d\n", psf->bytewidth, psf->sf.channels) ;
  127|     47|		return SFE_INTERNAL ;
  128|    742|		} ;
  129|       |
  130|    742|	psf->blockwidth = (sf_count_t) psf->bytewidth * psf->sf.channels ;
  131|       |
  132|    742|	if ((SF_CODEC (psf->sf.format)) == SF_FORMAT_PCM_S8)
  ------------------
  |  |  109|    742|#define SF_CODEC(x)			((x) & SF_FORMAT_SUBMASK)
  ------------------
  |  Branch (132:6): [True: 162, False: 580]
  ------------------
  133|    162|		chars = SF_CHARS_SIGNED ;
  134|    580|	else if ((SF_CODEC (psf->sf.format)) == SF_FORMAT_PCM_U8)
  ------------------
  |  |  109|    580|#define SF_CODEC(x)			((x) & SF_FORMAT_SUBMASK)
  ------------------
  |  Branch (134:11): [True: 93, False: 487]
  ------------------
  135|     93|		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|    742|	psf->data_endswap = (psf->endian == SF_ENDIAN_LITTLE) ? SF_FALSE : SF_TRUE ;
  ------------------
  |  Branch (140:22): [True: 380, False: 362]
  ------------------
  141|    742|#endif
  142|       |
  143|    742|	if (psf->file.mode == SFM_READ || psf->file.mode == SFM_RDWR)
  ------------------
  |  Branch (143:6): [True: 742, False: 0]
  |  Branch (143:36): [True: 0, False: 0]
  ------------------
  144|    742|	{	switch (psf->bytewidth * 0x10000 + psf->endian + chars)
  145|    742|		{	case (0x10000 + SF_ENDIAN_BIG + SF_CHARS_SIGNED) :
  ------------------
  |  Branch (145:5): [True: 149, False: 593]
  ------------------
  146|    162|			case (0x10000 + SF_ENDIAN_LITTLE + SF_CHARS_SIGNED) :
  ------------------
  |  Branch (146:4): [True: 13, False: 729]
  ------------------
  147|    162|					psf->read_short		= pcm_read_sc2s ;
  148|    162|					psf->read_int		= pcm_read_sc2i ;
  149|    162|					psf->read_float		= pcm_read_sc2f ;
  150|    162|					psf->read_double	= pcm_read_sc2d ;
  151|    162|					break ;
  152|     15|			case (0x10000 + SF_ENDIAN_BIG + SF_CHARS_UNSIGNED) :
  ------------------
  |  Branch (152:4): [True: 15, False: 727]
  ------------------
  153|     69|			case (0x10000 + SF_ENDIAN_LITTLE + SF_CHARS_UNSIGNED) :
  ------------------
  |  Branch (153:4): [True: 54, False: 688]
  ------------------
  154|     69|					psf->read_short		= pcm_read_uc2s ;
  155|     69|					psf->read_int		= pcm_read_uc2i ;
  156|     69|					psf->read_float		= pcm_read_uc2f ;
  157|     69|					psf->read_double	= pcm_read_uc2d ;
  158|     69|					break ;
  159|       |
  160|    102|			case (2 * 0x10000 + SF_ENDIAN_BIG) :
  ------------------
  |  Branch (160:4): [True: 102, False: 640]
  ------------------
  161|    102|					psf->read_short		= pcm_read_bes2s ;
  162|    102|					psf->read_int		= pcm_read_bes2i ;
  163|    102|					psf->read_float		= pcm_read_bes2f ;
  164|    102|					psf->read_double	= pcm_read_bes2d ;
  165|    102|					break ;
  166|     31|			case (3 * 0x10000 + SF_ENDIAN_BIG) :
  ------------------
  |  Branch (166:4): [True: 31, False: 711]
  ------------------
  167|     31|					psf->read_short		= pcm_read_bet2s ;
  168|     31|					psf->read_int		= pcm_read_bet2i ;
  169|     31|					psf->read_float		= pcm_read_bet2f ;
  170|     31|					psf->read_double	= pcm_read_bet2d ;
  171|     31|					break ;
  172|     41|			case (4 * 0x10000 + SF_ENDIAN_BIG) :
  ------------------
  |  Branch (172:4): [True: 41, False: 701]
  ------------------
  173|       |
  174|     41|					psf->read_short		= pcm_read_bei2s ;
  175|     41|					psf->read_int		= pcm_read_bei2i ;
  176|     41|					psf->read_float		= pcm_read_bei2f ;
  177|     41|					psf->read_double	= pcm_read_bei2d ;
  178|     41|					break ;
  179|       |
  180|    122|			case (2 * 0x10000 + SF_ENDIAN_LITTLE) :
  ------------------
  |  Branch (180:4): [True: 122, False: 620]
  ------------------
  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|     99|			case (3 * 0x10000 + SF_ENDIAN_LITTLE) :
  ------------------
  |  Branch (186:4): [True: 99, False: 643]
  ------------------
  187|     99|					psf->read_short		= pcm_read_let2s ;
  188|     99|					psf->read_int		= pcm_read_let2i ;
  189|     99|					psf->read_float		= pcm_read_let2f ;
  190|     99|					psf->read_double	= pcm_read_let2d ;
  191|     99|					break ;
  192|     92|			case (4 * 0x10000 + SF_ENDIAN_LITTLE) :
  ------------------
  |  Branch (192:4): [True: 92, False: 650]
  ------------------
  193|     92|					psf->read_short		= pcm_read_lei2s ;
  194|     92|					psf->read_int		= pcm_read_lei2i ;
  195|     92|					psf->read_float		= pcm_read_lei2f ;
  196|     92|					psf->read_double	= pcm_read_lei2d ;
  197|     92|					break ;
  198|     24|			default :
  ------------------
  |  Branch (198:4): [True: 24, False: 718]
  ------------------
  199|     24|				psf_log_printf (psf, "pcm.c returning SFE_UNIMPLEMENTED\nbytewidth %d    endian %d\n", psf->bytewidth, psf->endian) ;
  200|     24|				return SFE_UNIMPLEMENTED ;
  201|    742|			} ;
  202|    718|		} ;
  203|       |
  204|    718|	if (psf->file.mode == SFM_WRITE || psf->file.mode == SFM_RDWR)
  ------------------
  |  Branch (204:6): [True: 0, False: 718]
  |  Branch (204:37): [True: 0, False: 718]
  ------------------
  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|    718|		} ;
  269|       |
  270|    718|	if (psf->filelength > psf->dataoffset)
  ------------------
  |  Branch (270:6): [True: 446, False: 272]
  ------------------
  271|    446|	{	psf->datalength = (psf->dataend > 0) ? psf->dataend - psf->dataoffset :
  ------------------
  |  Branch (271:22): [True: 58, False: 388]
  ------------------
  272|    446|							psf->filelength - psf->dataoffset ;
  273|    446|		}
  274|    272|	else
  275|    272|		psf->datalength = 0 ;
  276|       |
  277|    718|	psf->sf.frames = psf->blockwidth > 0 ? psf->datalength / psf->blockwidth : 0 ;
  ------------------
  |  Branch (277:19): [True: 589, False: 129]
  ------------------
  278|       |
  279|    718|	return 0 ;
  280|    718|} /* pcm_init */
pcm.c:pcm_read_sc2f:
  981|    182|{	BUF_UNION	ubuf ;
  982|    182|	int			bufferlen, readcount ;
  983|    182|	sf_count_t	total = 0 ;
  984|    182|	float	normfact ;
  985|       |
  986|    182|	normfact = (psf->norm_float == SF_TRUE) ? 1.0 / ((float) 0x80) : 1.0 ;
  ------------------
  |  Branch (986:13): [True: 182, False: 0]
  ------------------
  987|       |
  988|    182|	bufferlen = ARRAY_LEN (ubuf.scbuf) ;
  ------------------
  |  |   93|    182|#define		ARRAY_LEN(x)	((int) (sizeof (x) / sizeof ((x) [0])))
  ------------------
  989|       |
  990|    351|	while (len > 0)
  ------------------
  |  Branch (990:9): [True: 182, False: 169]
  ------------------
  991|    182|	{	if (len < bufferlen)
  ------------------
  |  Branch (991:8): [True: 182, False: 0]
  ------------------
  992|    182|			bufferlen = (int) len ;
  993|    182|		readcount = (int) psf_fread (ubuf.scbuf, sizeof (signed char), bufferlen, psf) ;
  994|    182|		sc2f_array (ubuf.scbuf, readcount, ptr + total, normfact) ;
  995|    182|		total += readcount ;
  996|    182|		if (readcount < bufferlen)
  ------------------
  |  Branch (996:7): [True: 13, False: 169]
  ------------------
  997|     13|			break ;
  998|    169|		len -= readcount ;
  999|    169|		} ;
 1000|       |
 1001|    182|	return total ;
 1002|    182|} /* pcm_read_sc2f */
pcm.c:sc2f_array:
  385|    874|{	for (int i = 0 ; i < count ; i++)
  ------------------
  |  Branch (385:20): [True: 692, False: 182]
  ------------------
  386|    692|		dest [i] = ((float) src [i]) * normfact ;
  387|    182|} /* sc2f_array */
pcm.c:pcm_read_uc2f:
 1006|   141k|{	BUF_UNION	ubuf ;
 1007|   141k|	int			bufferlen, readcount ;
 1008|   141k|	sf_count_t	total = 0 ;
 1009|   141k|	float	normfact ;
 1010|       |
 1011|   141k|	normfact = (psf->norm_float == SF_TRUE) ? 1.0 / ((float) 0x80) : 1.0 ;
  ------------------
  |  Branch (1011:13): [True: 141k, False: 0]
  ------------------
 1012|       |
 1013|   141k|	bufferlen = ARRAY_LEN (ubuf.ucbuf) ;
  ------------------
  |  |   93|   141k|#define		ARRAY_LEN(x)	((int) (sizeof (x) / sizeof ((x) [0])))
  ------------------
 1014|       |
 1015|   282k|	while (len > 0)
  ------------------
  |  Branch (1015:9): [True: 141k, False: 141k]
  ------------------
 1016|   141k|	{	if (len < bufferlen)
  ------------------
  |  Branch (1016:8): [True: 141k, False: 0]
  ------------------
 1017|   141k|			bufferlen = (int) len ;
 1018|   141k|		readcount = (int) psf_fread (ubuf.ucbuf, sizeof (unsigned char), bufferlen, psf) ;
 1019|   141k|		uc2f_array (ubuf.ucbuf, readcount, ptr + total, normfact) ;
 1020|   141k|		total += readcount ;
 1021|   141k|		if (readcount < bufferlen)
  ------------------
  |  Branch (1021:7): [True: 0, False: 141k]
  ------------------
 1022|      0|			break ;
 1023|   141k|		len -= readcount ;
 1024|   141k|		} ;
 1025|       |
 1026|   141k|	return total ;
 1027|   141k|} /* pcm_read_uc2f */
pcm.c:uc2f_array:
  391|  1.59M|{	for (int i = 0 ; i < count ; i++)
  ------------------
  |  Branch (391:20): [True: 1.45M, False: 141k]
  ------------------
  392|  1.45M|		dest [i] = (((int) src [i]) - 128) * normfact ;
  393|   141k|} /* uc2f_array */
pcm.c:pcm_read_bes2f:
 1031|    250|{	BUF_UNION	ubuf ;
 1032|    250|	int			bufferlen, readcount ;
 1033|    250|	sf_count_t	total = 0 ;
 1034|    250|	float	normfact ;
 1035|       |
 1036|    250|	normfact = (psf->norm_float == SF_TRUE) ? 1.0 / ((float) 0x8000) : 1.0 ;
  ------------------
  |  Branch (1036:13): [True: 250, False: 0]
  ------------------
 1037|       |
 1038|    250|	bufferlen = ARRAY_LEN (ubuf.sbuf) ;
  ------------------
  |  |   93|    250|#define		ARRAY_LEN(x)	((int) (sizeof (x) / sizeof ((x) [0])))
  ------------------
 1039|       |
 1040|    496|	while (len > 0)
  ------------------
  |  Branch (1040:9): [True: 250, False: 246]
  ------------------
 1041|    250|	{	if (len < bufferlen)
  ------------------
  |  Branch (1041:8): [True: 250, False: 0]
  ------------------
 1042|    250|			bufferlen = (int) len ;
 1043|    250|		readcount = (int) psf_fread (ubuf.sbuf, sizeof (short), bufferlen, psf) ;
 1044|    250|		bes2f_array (ubuf.sbuf, readcount, ptr + total, normfact) ;
 1045|    250|		total += readcount ;
 1046|    250|		if (readcount < bufferlen)
  ------------------
  |  Branch (1046:7): [True: 4, False: 246]
  ------------------
 1047|      4|			break ;
 1048|    246|		len -= readcount ;
 1049|    246|		} ;
 1050|       |
 1051|    250|	return total ;
 1052|    250|} /* pcm_read_bes2f */
pcm.c:bes2f_array:
  408|    250|{	short			value ;
  409|       |
  410|    689|	for (int i = 0 ; i < count ; i++)
  ------------------
  |  Branch (410:19): [True: 439, False: 250]
  ------------------
  411|    439|	{	value = src [i] ;
  412|       |		value = BE2H_16 (value) ;
  ------------------
  |  |  140|    439|	#define BE2H_16(x)			ENDSWAP_16 (x)
  |  |  ------------------
  |  |  |  |   34|    439|#define	ENDSWAP_16(x)		(bswap_16 (x))
  |  |  ------------------
  ------------------
  413|    439|		dest [i] = ((float) value) * normfact ;
  414|    439|		} ;
  415|    250|} /* bes2f_array */
pcm.c:pcm_read_les2f:
 1056|    460|{	BUF_UNION	ubuf ;
 1057|    460|	int			bufferlen, readcount ;
 1058|    460|	sf_count_t	total = 0 ;
 1059|    460|	float	normfact ;
 1060|       |
 1061|    460|	normfact = (psf->norm_float == SF_TRUE) ? 1.0 / ((float) 0x8000) : 1.0 ;
  ------------------
  |  Branch (1061:13): [True: 460, False: 0]
  ------------------
 1062|       |
 1063|    460|	bufferlen = ARRAY_LEN (ubuf.sbuf) ;
  ------------------
  |  |   93|    460|#define		ARRAY_LEN(x)	((int) (sizeof (x) / sizeof ((x) [0])))
  ------------------
 1064|       |
 1065|    891|	while (len > 0)
  ------------------
  |  Branch (1065:9): [True: 460, False: 431]
  ------------------
 1066|    460|	{	if (len < bufferlen)
  ------------------
  |  Branch (1066:8): [True: 460, False: 0]
  ------------------
 1067|    460|			bufferlen = (int) len ;
 1068|    460|		readcount = (int) psf_fread (ubuf.sbuf, sizeof (short), bufferlen, psf) ;
 1069|    460|		les2f_array (ubuf.sbuf, readcount, ptr + total, normfact) ;
 1070|    460|		total += readcount ;
 1071|    460|		if (readcount < bufferlen)
  ------------------
  |  Branch (1071:7): [True: 29, False: 431]
  ------------------
 1072|     29|			break ;
 1073|    431|		len -= readcount ;
 1074|    431|		} ;
 1075|       |
 1076|    460|	return total ;
 1077|    460|} /* pcm_read_les2f */
pcm.c:les2f_array:
  397|    460|{	short	value ;
  398|       |
  399|  1.65k|	for (int i = 0 ; i < count ; i++)
  ------------------
  |  Branch (399:19): [True: 1.19k, False: 460]
  ------------------
  400|  1.19k|	{	value = src [i] ;
  401|  1.19k|		value = LE2H_16 (value) ;
  ------------------
  |  |  137|  1.19k|	#define LE2H_16(x)			(x)
  ------------------
  402|  1.19k|		dest [i] = ((float) value) * normfact ;
  403|  1.19k|		} ;
  404|    460|} /* les2f_array */
pcm.c:pcm_read_bet2f:
 1081|    344|{	BUF_UNION	ubuf ;
 1082|    344|	int			bufferlen, readcount ;
 1083|    344|	sf_count_t	total = 0 ;
 1084|    344|	float	normfact ;
 1085|       |
 1086|       |	/* Special normfactor because tribyte value is read into an int. */
 1087|    344|	normfact = (psf->norm_float == SF_TRUE) ? 1.0 / ((float) 0x80000000) : 1.0 / 256.0 ;
  ------------------
  |  Branch (1087:13): [True: 344, False: 0]
  ------------------
 1088|       |
 1089|    344|	bufferlen = sizeof (ubuf.ucbuf) / SIZEOF_TRIBYTE ;
  ------------------
  |  |   35|    344|#define	SIZEOF_TRIBYTE	3
  ------------------
 1090|       |
 1091|    670|	while (len > 0)
  ------------------
  |  Branch (1091:9): [True: 344, False: 326]
  ------------------
 1092|    344|	{	if (len < bufferlen)
  ------------------
  |  Branch (1092:8): [True: 344, False: 0]
  ------------------
 1093|    344|			bufferlen = (int) len ;
 1094|    344|		readcount = (int) psf_fread (ubuf.ucbuf, SIZEOF_TRIBYTE, bufferlen, psf) ;
  ------------------
  |  |   35|    344|#define	SIZEOF_TRIBYTE	3
  ------------------
 1095|    344|		bet2f_array ((tribyte*) (ubuf.ucbuf), readcount, ptr + total, normfact) ;
 1096|    344|		total += readcount ;
 1097|    344|		if (readcount < bufferlen)
  ------------------
  |  Branch (1097:7): [True: 18, False: 326]
  ------------------
 1098|     18|			break ;
 1099|    326|		len -= readcount ;
 1100|    326|		} ;
 1101|       |
 1102|    344|	return total ;
 1103|    344|} /* pcm_read_bet2f */
pcm.c:bet2f_array:
  429|    344|{	int value ;
  430|       |
  431|    870|	for (int i = 0 ; i < count ; i++)
  ------------------
  |  Branch (431:19): [True: 526, False: 344]
  ------------------
  432|    526|	{	value = psf_get_be24 (src [i].bytes, 0) ;
  433|    526|		dest [i] = ((float) value) * normfact ;
  434|    526|		} ;
  435|    344|} /* bet2f_array */
pcm.c:pcm_read_let2f:
 1107|   446k|{	BUF_UNION	ubuf ;
 1108|   446k|	int			bufferlen, readcount ;
 1109|   446k|	sf_count_t	total = 0 ;
 1110|   446k|	float	normfact ;
 1111|       |
 1112|       |	/* Special normfactor because tribyte value is read into an int. */
 1113|   446k|	normfact = (psf->norm_float == SF_TRUE) ? 1.0 / ((float) 0x80000000) : 1.0 / 256.0 ;
  ------------------
  |  Branch (1113:13): [True: 446k, False: 0]
  ------------------
 1114|       |
 1115|   446k|	bufferlen = sizeof (ubuf.ucbuf) / SIZEOF_TRIBYTE ;
  ------------------
  |  |   35|   446k|#define	SIZEOF_TRIBYTE	3
  ------------------
 1116|       |
 1117|   893k|	while (len > 0)
  ------------------
  |  Branch (1117:9): [True: 446k, False: 446k]
  ------------------
 1118|   446k|	{	if (len < bufferlen)
  ------------------
  |  Branch (1118:8): [True: 446k, False: 0]
  ------------------
 1119|   446k|			bufferlen = (int) len ;
 1120|   446k|		readcount = (int) psf_fread (ubuf.ucbuf, SIZEOF_TRIBYTE, bufferlen, psf) ;
  ------------------
  |  |   35|   446k|#define	SIZEOF_TRIBYTE	3
  ------------------
 1121|   446k|		let2f_array ((tribyte*) (ubuf.ucbuf), readcount, ptr + total, normfact) ;
 1122|   446k|		total += readcount ;
 1123|   446k|		if (readcount < bufferlen)
  ------------------
  |  Branch (1123:7): [True: 19, False: 446k]
  ------------------
 1124|     19|			break ;
 1125|   446k|		len -= readcount ;
 1126|   446k|		} ;
 1127|       |
 1128|   446k|	return total ;
 1129|   446k|} /* pcm_read_let2f */
pcm.c:let2f_array:
  419|   446k|{	int value ;
  420|       |
  421|  2.24M|	for (int i = 0 ; i < count ; i++)
  ------------------
  |  Branch (421:19): [True: 1.80M, False: 446k]
  ------------------
  422|  1.80M|	{	value = psf_get_le24 (src [i].bytes, 0) ;
  423|  1.80M|		dest [i] = ((float) value) * normfact ;
  424|  1.80M|		} ;
  425|   446k|} /* let2f_array */
pcm.c:pcm_read_bei2f:
 1133|    209|{	BUF_UNION	ubuf ;
 1134|    209|	int			bufferlen, readcount ;
 1135|    209|	sf_count_t	total = 0 ;
 1136|    209|	float	normfact ;
 1137|       |
 1138|    209|	normfact = (psf->norm_float == SF_TRUE) ? 1.0 / ((float) 0x80000000) : 1.0 ;
  ------------------
  |  Branch (1138:13): [True: 209, False: 0]
  ------------------
 1139|       |
 1140|    209|	bufferlen = ARRAY_LEN (ubuf.ibuf) ;
  ------------------
  |  |   93|    209|#define		ARRAY_LEN(x)	((int) (sizeof (x) / sizeof ((x) [0])))
  ------------------
 1141|       |
 1142|    415|	while (len > 0)
  ------------------
  |  Branch (1142:9): [True: 209, False: 206]
  ------------------
 1143|    209|	{	if (len < bufferlen)
  ------------------
  |  Branch (1143:8): [True: 209, False: 0]
  ------------------
 1144|    209|			bufferlen = (int) len ;
 1145|    209|		readcount = (int) psf_fread (ubuf.ibuf, sizeof (int), bufferlen, psf) ;
 1146|    209|		bei2f_array (ubuf.ibuf, readcount, ptr + total, normfact) ;
 1147|    209|		total += readcount ;
 1148|    209|		if (readcount < bufferlen)
  ------------------
  |  Branch (1148:7): [True: 3, False: 206]
  ------------------
 1149|      3|			break ;
 1150|    206|		len -= readcount ;
 1151|    206|		} ;
 1152|       |
 1153|    209|	return total ;
 1154|    209|} /* pcm_read_bei2f */
pcm.c:bei2f_array:
  450|    209|{	int 			value ;
  451|       |
  452|    613|	for (int i = 0 ; i < count ; i++)
  ------------------
  |  Branch (452:19): [True: 404, False: 209]
  ------------------
  453|    404|	{	value = src [i] ;
  454|       |		value = BE2H_32 (value) ;
  ------------------
  |  |  141|    404|	#define BE2H_32(x)			ENDSWAP_32 (x)
  |  |  ------------------
  |  |  |  |   35|    404|#define	ENDSWAP_32(x)		(bswap_32 (x))
  |  |  ------------------
  ------------------
  455|    404|		dest [i] = ((float) value) * normfact ;
  456|    404|		} ;
  457|    209|} /* bei2f_array */
pcm.c:pcm_read_lei2f:
 1158|  10.9k|{	BUF_UNION	ubuf ;
 1159|  10.9k|	int			bufferlen, readcount ;
 1160|  10.9k|	sf_count_t	total = 0 ;
 1161|  10.9k|	float	normfact ;
 1162|       |
 1163|  10.9k|	normfact = (psf->norm_float == SF_TRUE) ? 1.0 / ((float) 0x80000000) : 1.0 ;
  ------------------
  |  Branch (1163:13): [True: 10.9k, False: 0]
  ------------------
 1164|       |
 1165|  10.9k|	bufferlen = ARRAY_LEN (ubuf.ibuf) ;
  ------------------
  |  |   93|  10.9k|#define		ARRAY_LEN(x)	((int) (sizeof (x) / sizeof ((x) [0])))
  ------------------
 1166|       |
 1167|  21.9k|	while (len > 0)
  ------------------
  |  Branch (1167:9): [True: 10.9k, False: 10.9k]
  ------------------
 1168|  10.9k|	{	if (len < bufferlen)
  ------------------
  |  Branch (1168:8): [True: 10.9k, False: 0]
  ------------------
 1169|  10.9k|			bufferlen = (int) len ;
 1170|  10.9k|		readcount = (int) psf_fread (ubuf.ibuf, sizeof (int), bufferlen, psf) ;
 1171|  10.9k|		lei2f_array (ubuf.ibuf, readcount, ptr + total, normfact) ;
 1172|  10.9k|		total += readcount ;
 1173|  10.9k|		if (readcount < bufferlen)
  ------------------
  |  Branch (1173:7): [True: 28, False: 10.9k]
  ------------------
 1174|     28|			break ;
 1175|  10.9k|		len -= readcount ;
 1176|  10.9k|		} ;
 1177|       |
 1178|  10.9k|	return total ;
 1179|  10.9k|} /* pcm_read_lei2f */
pcm.c:lei2f_array:
  439|  10.9k|{	int 			value ;
  440|       |
  441|  55.2k|	for (int i = 0 ; i < count ; i++)
  ------------------
  |  Branch (441:19): [True: 44.2k, False: 10.9k]
  ------------------
  442|  44.2k|	{	value = src [i] ;
  443|  44.2k|		value = LE2H_32 (value) ;
  ------------------
  |  |  138|  44.2k|	#define LE2H_32(x)			(x)
  ------------------
  444|  44.2k|		dest [i] = ((float) value) * normfact ;
  445|  44.2k|		} ;
  446|  10.9k|} /* lei2f_array */

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

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

paf.c:endswap_int_array:
  301|  53.0k|{
  302|   505k|	for (int i = 0 ; i < len ; i++)
  ------------------
  |  Branch (302:19): [True: 452k, False: 53.0k]
  ------------------
  303|   452k|	{	int temp = ptr [i] ;
  304|       |		ptr [i] = ENDSWAP_32 (temp) ;
  ------------------
  |  |   35|   452k|#define	ENDSWAP_32(x)		(bswap_32 (x))
  ------------------
  305|   452k|		} ;
  306|  53.0k|} /* endswap_int_array */
common.c:psf_get_be32:
  241|  1.30M|{	int32_t value = ((uint32_t) ptr [offset]) << 24 ;
  242|  1.30M|	value += ptr [offset + 1] << 16 ;
  243|  1.30M|	value += ptr [offset + 2] << 8 ;
  244|  1.30M|	value += ptr [offset + 3] ;
  245|  1.30M|	return value ;
  246|  1.30M|} /* psf_get_be32 */
common.c:psf_get_le32:
  250|  1.37M|{	int32_t value = ((uint32_t) ptr [offset + 3]) << 24 ;
  251|  1.37M|	value += ptr [offset + 2] << 16 ;
  252|  1.37M|	value += ptr [offset + 1] << 8 ;
  253|  1.37M|	value += ptr [offset] ;
  254|  1.37M|	return value ;
  255|  1.37M|} /* psf_get_le32 */
common.c:psf_get_be64:
  207|  19.2k|{	int64_t value ;
  208|       |
  209|  19.2k|	value = (int64_t) ((uint64_t) ptr [offset] << 24) ;
  210|  19.2k|	value += (int64_t) ((uint64_t) ptr [offset + 1] << 16) ;
  211|  19.2k|	value += (int64_t) ((uint64_t) ptr [offset + 2] << 8) ;
  212|  19.2k|	value += ptr [offset + 3] ;
  213|       |
  214|  19.2k|	value = (int64_t) (((uint64_t) value) << 32) ;
  215|       |
  216|  19.2k|	value += (int64_t) ((uint64_t) ptr [offset + 4] << 24) ;
  217|  19.2k|	value += (int64_t) ((uint64_t) ptr [offset + 5] << 16) ;
  218|  19.2k|	value += (int64_t) ((uint64_t) ptr [offset + 6] << 8) ;
  219|  19.2k|	value += ptr [offset + 7] ;
  220|  19.2k|	return value ;
  221|  19.2k|} /* psf_get_be64 */
common.c:psf_get_le64:
  225|   110k|{	int64_t value = (int64_t) ((uint64_t) ptr [offset + 7] << 24) ;
  226|   110k|	value += (int64_t) ((uint64_t) ptr [offset + 6] << 16) ;
  227|   110k|	value += (int64_t) ((uint64_t) ptr [offset + 5] << 8) ;
  228|   110k|	value += ptr [offset + 4] ;
  229|       |
  230|   110k|	value = (int64_t) (((uint64_t) value) << 32) ;
  231|       |
  232|   110k|	value += (int64_t) ((uint64_t) ptr [offset + 3] << 24) ;
  233|   110k|	value += (int64_t) ((uint64_t) ptr [offset + 2] << 16) ;
  234|   110k|	value += (int64_t) ((uint64_t) ptr [offset + 1] << 8) ;
  235|   110k|	value += ptr [offset] ;
  236|   110k|	return value ;
  237|   110k|} /* psf_get_le64 */
double64.c:endswap_double_array:
  346|    281|{	endswap_int64_t_array ((int64_t *) ptr, len) ;
  347|    281|} /* endswap_double_array */
double64.c:endswap_int64_t_array:
  321|    281|{
  322|  65.2k|	for (int i = 0 ; i < len ; i++)
  ------------------
  |  Branch (322:19): [True: 64.9k, False: 281]
  ------------------
  323|  64.9k|	{	int64_t value = ptr [i] ;
  324|       |		ptr [i] = ENDSWAP_64 (value) ;
  ------------------
  |  |   36|  64.9k|#define	ENDSWAP_64(x)		(bswap_64 (x))
  ------------------
  325|  64.9k|		} ;
  326|    281|} /* endswap_int64_t_array */
float32.c:endswap_int_copy:
  310|    416|{
  311|  1.10k|	for (int i = 0 ; i < len ; i++)
  ------------------
  |  Branch (311:19): [True: 689, False: 416]
  ------------------
  312|    689|	{	dest [i] = ENDSWAP_32 (src [i]) ;
  ------------------
  |  |   35|    689|#define	ENDSWAP_32(x)		(bswap_32 (x))
  ------------------
  313|    689|		} ;
  314|    416|} /* endswap_int_copy */
pcm.c:psf_get_be24:
  259|    526|{	int32_t value = ((uint32_t) ptr [offset]) << 24 ;
  260|    526|	value += ptr [offset + 1] << 16 ;
  261|    526|	value += ptr [offset + 2] << 8 ;
  262|    526|	return value ;
  263|    526|} /* psf_get_be24 */
pcm.c:psf_get_le24:
  267|  1.80M|{	int32_t value = ((uint32_t) ptr [offset + 2]) << 24 ;
  268|  1.80M|	value += ptr [offset + 1] << 16 ;
  269|  1.80M|	value += ptr [offset] << 8 ;
  270|  1.80M|	return value ;
  271|  1.80M|} /* psf_get_le24 */
alac_decoder.c:psf_get_be32:
  241|  3.45k|{	int32_t value = ((uint32_t) ptr [offset]) << 24 ;
  242|  3.45k|	value += ptr [offset + 1] << 16 ;
  243|  3.45k|	value += ptr [offset + 2] << 8 ;
  244|  3.45k|	value += ptr [offset + 3] ;
  245|  3.45k|	return value ;
  246|  3.45k|} /* psf_get_be32 */
alac_decoder.c:psf_get_be16:
  275|    854|{	return (int16_t) (ptr [offset] << 8) + ptr [offset + 1] ;
  276|    854|} /* 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.92k|{	SF_PRIVATE	*psf ;
  519|       |
  520|  2.92k|	VALIDATE_SNDFILE_AND_ASSIGN_PSF (sndfile, psf, 1) ;
  ------------------
  |  |  326|  2.92k|		{	if ((a) == NULL)						\
  |  |  ------------------
  |  |  |  Branch (326:9): [True: 0, False: 2.92k]
  |  |  ------------------
  |  |  327|  2.92k|			{	sf_errno = SFE_BAD_SNDFILE_PTR ;	\
  |  |  328|      0|				return 0 ;							\
  |  |  329|  2.92k|				} ;									\
  |  |  330|  2.92k|			(b) = (SF_PRIVATE*) (a) ;				\
  |  |  331|  2.92k|			if ((b)->virtual_io == SF_FALSE &&		\
  |  |  ------------------
  |  |  |  Branch (331:8): [True: 0, False: 2.92k]
  |  |  ------------------
  |  |  332|  2.92k|				psf_file_valid (b) == 0)			\
  |  |  ------------------
  |  |  |  Branch (332:5): [True: 0, False: 0]
  |  |  ------------------
  |  |  333|  2.92k|			{	(b)->error = SFE_BAD_FILE_PTR ;		\
  |  |  334|      0|				return 0 ;							\
  |  |  335|  2.92k|				} ;									\
  |  |  336|  2.92k|			if ((b)->Magick != SNDFILE_MAGICK)		\
  |  |  ------------------
  |  |  |  |   41|  2.92k|#define		SNDFILE_MAGICK	0x1234C0DE
  |  |  ------------------
  |  |  |  Branch (336:8): [True: 0, False: 2.92k]
  |  |  ------------------
  |  |  337|  2.92k|			{	(b)->error = SFE_BAD_SNDFILE_PTR ;	\
  |  |  338|      0|				return 0 ;							\
  |  |  339|  2.92k|				} ;									\
  |  |  340|  2.92k|			if (c) (b)->error = 0 ;					\
  |  |  ------------------
  |  |  |  Branch (340:8): [True: 2.92k, Folded]
  |  |  ------------------
  |  |  341|  2.92k|			}
  ------------------
  521|       |
  522|  2.92k|	return psf_close (psf) ;
  523|  5.84k|} /* sf_close */
sf_error_number:
  542|  13.2k|{	static const char *bad_errnum =
  543|  13.2k|		"No error defined for this error number. This is a bug in libsndfile." ;
  544|  13.2k|	int	k ;
  545|       |
  546|  13.2k|	if (errnum == SFE_MAX_ERROR)
  ------------------
  |  Branch (546:6): [True: 0, False: 13.2k]
  ------------------
  547|      0|		return SndfileErrors [0].str ;
  548|       |
  549|  13.2k|	if (errnum < 0 || errnum > SFE_MAX_ERROR)
  ------------------
  |  Branch (549:6): [True: 0, False: 13.2k]
  |  Branch (549:20): [True: 0, False: 13.2k]
  ------------------
  550|      0|	{	/* This really shouldn't happen in release versions. */
  551|      0|		printf ("Not a valid error number (%d).\n", errnum) ;
  552|      0|		return bad_errnum ;
  553|  13.2k|		} ;
  554|       |
  555|   775k|	for (k = 0 ; SndfileErrors [k].str ; k++)
  ------------------
  |  Branch (555:15): [True: 775k, False: 0]
  ------------------
  556|   775k|		if (errnum == SndfileErrors [k].error)
  ------------------
  |  Branch (556:7): [True: 13.2k, False: 761k]
  ------------------
  557|  13.2k|			return SndfileErrors [k].str ;
  558|       |
  559|      0|	return bad_errnum ;
  560|  13.2k|} /* sf_error_number */
sf_readf_float:
 2020|   168M|{	SF_PRIVATE 	*psf ;
 2021|   168M|	sf_count_t	count, extra ;
 2022|       |
 2023|   168M|	if (frames == 0)
  ------------------
  |  Branch (2023:6): [True: 0, False: 168M]
  ------------------
 2024|      0|		return 0 ;
 2025|       |
 2026|   672M|	VALIDATE_SNDFILE_AND_ASSIGN_PSF (sndfile, psf, 1) ;
  ------------------
  |  |  326|   168M|		{	if ((a) == NULL)						\
  |  |  ------------------
  |  |  |  Branch (326:9): [True: 0, False: 168M]
  |  |  ------------------
  |  |  327|   168M|			{	sf_errno = SFE_BAD_SNDFILE_PTR ;	\
  |  |  328|      0|				return 0 ;							\
  |  |  329|   168M|				} ;									\
  |  |  330|   168M|			(b) = (SF_PRIVATE*) (a) ;				\
  |  |  331|   168M|			if ((b)->virtual_io == SF_FALSE &&		\
  |  |  ------------------
  |  |  |  Branch (331:8): [True: 0, False: 168M]
  |  |  ------------------
  |  |  332|   168M|				psf_file_valid (b) == 0)			\
  |  |  ------------------
  |  |  |  Branch (332:5): [True: 0, False: 0]
  |  |  ------------------
  |  |  333|   168M|			{	(b)->error = SFE_BAD_FILE_PTR ;		\
  |  |  334|      0|				return 0 ;							\
  |  |  335|   168M|				} ;									\
  |  |  336|   168M|			if ((b)->Magick != SNDFILE_MAGICK)		\
  |  |  ------------------
  |  |  |  |   41|   168M|#define		SNDFILE_MAGICK	0x1234C0DE
  |  |  ------------------
  |  |  |  Branch (336:8): [True: 0, False: 168M]
  |  |  ------------------
  |  |  337|   168M|			{	(b)->error = SFE_BAD_SNDFILE_PTR ;	\
  |  |  338|      0|				return 0 ;							\
  |  |  339|   168M|				} ;									\
  |  |  340|   168M|			if (c) (b)->error = 0 ;					\
  |  |  ------------------
  |  |  |  Branch (340:8): [True: 168M, Folded]
  |  |  ------------------
  |  |  341|   168M|			}
  ------------------
 2027|       |
 2028|   672M|	if (frames <= 0)
  ------------------
  |  Branch (2028:6): [True: 0, False: 168M]
  ------------------
 2029|      0|	{	psf->error = SFE_NEGATIVE_RW_LEN ;
 2030|      0|		return 0 ;
 2031|   168M|		} ;
 2032|       |
 2033|   168M|	if (psf->file.mode == SFM_WRITE)
  ------------------
  |  Branch (2033:6): [True: 0, False: 168M]
  ------------------
 2034|      0|	{	psf->error = SFE_NOT_READMODE ;
 2035|      0|		return 0 ;
 2036|   168M|		} ;
 2037|       |
 2038|   168M|	if (psf->read_current >= psf->sf.frames)
  ------------------
  |  Branch (2038:6): [True: 1.96k, False: 168M]
  ------------------
 2039|  1.96k|	{	psf_memset (ptr, 0, frames * psf->sf.channels * sizeof (float)) ;
 2040|  1.96k|		return 0 ;
 2041|   168M|		} ;
 2042|       |
 2043|   168M|	if (psf->read_float == NULL || psf->seek == NULL)
  ------------------
  |  Branch (2043:6): [True: 1, False: 168M]
  |  Branch (2043:33): [True: 0, False: 168M]
  ------------------
 2044|      1|	{	psf->error = SFE_UNIMPLEMENTED ;
 2045|      1|		return	0 ;
 2046|   168M|		} ;
 2047|       |
 2048|   168M|	if (psf->last_op != SFM_READ)
  ------------------
  |  Branch (2048:6): [True: 70, False: 168M]
  ------------------
 2049|     70|		if (psf->seek (psf, SFM_READ, psf->read_current) < 0)
  ------------------
  |  Branch (2049:7): [True: 0, False: 70]
  ------------------
 2050|      0|			return 0 ;
 2051|       |
 2052|   168M|	count = psf->read_float (psf, ptr, frames * psf->sf.channels) ;
 2053|       |
 2054|   168M|	if (psf->read_current + count / psf->sf.channels <= psf->sf.frames)
  ------------------
  |  Branch (2054:6): [True: 168M, False: 0]
  ------------------
 2055|   168M|		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|   168M|	psf->last_op = SFM_READ ;
 2064|       |
 2065|   168M|	return count / psf->sf.channels ;
 2066|   168M|} /* 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.8k]
  ------------------
 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.07k, False: 13.4k]
  ------------------
 3164|  4.07k|		case	SF_FORMAT_WAVEX :
  ------------------
  |  Branch (3164:3): [True: 0, False: 17.5k]
  ------------------
 3165|  4.07k|				error = wav_open (psf) ;
 3166|  4.07k|				break ;
 3167|       |
 3168|  2.69k|		case	SF_FORMAT_AIFF :
  ------------------
  |  Branch (3168:3): [True: 2.69k, False: 14.8k]
  ------------------
 3169|  2.69k|				error = aiff_open (psf) ;
 3170|  2.69k|				break ;
 3171|       |
 3172|  1.25k|		case	SF_FORMAT_AU :
  ------------------
  |  Branch (3172:3): [True: 1.25k, False: 16.2k]
  ------------------
 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|    676|		case	SF_FORMAT_W64 :
  ------------------
  |  Branch (3180:3): [True: 676, False: 16.8k]
  ------------------
 3181|    676|				error = w64_open (psf) ;
 3182|    676|				break ;
 3183|       |
 3184|  1.94k|		case	SF_FORMAT_RF64 :
  ------------------
  |  Branch (3184:3): [True: 1.94k, False: 15.5k]
  ------------------
 3185|  1.94k|				error = rf64_open (psf) ;
 3186|  1.94k|				break ;
 3187|       |
 3188|       |		/* Lite remove start */
 3189|    169|		case	SF_FORMAT_PAF :
  ------------------
  |  Branch (3189:3): [True: 169, False: 17.3k]
  ------------------
 3190|    169|				error = paf_open (psf) ;
 3191|    169|				break ;
 3192|       |
 3193|    404|		case	SF_FORMAT_SVX :
  ------------------
  |  Branch (3193:3): [True: 404, False: 17.1k]
  ------------------
 3194|    404|				error = svx_open (psf) ;
 3195|    404|				break ;
 3196|       |
 3197|    139|		case	SF_FORMAT_NIST :
  ------------------
  |  Branch (3197:3): [True: 139, False: 17.3k]
  ------------------
 3198|    139|				error = nist_open (psf) ;
 3199|    139|				break ;
 3200|       |
 3201|    296|		case	SF_FORMAT_IRCAM :
  ------------------
  |  Branch (3201:3): [True: 296, False: 17.2k]
  ------------------
 3202|    296|				error = ircam_open (psf) ;
 3203|    296|				break ;
 3204|       |
 3205|    241|		case	SF_FORMAT_VOC :
  ------------------
  |  Branch (3205:3): [True: 241, False: 17.2k]
  ------------------
 3206|    241|				error = voc_open (psf) ;
 3207|    241|				break ;
 3208|       |
 3209|    299|		case	SF_FORMAT_SDS :
  ------------------
  |  Branch (3209:3): [True: 299, False: 17.2k]
  ------------------
 3210|    299|				error = sds_open (psf) ;
 3211|    299|				break ;
 3212|       |
 3213|      2|		case	SF_FORMAT_OGG :
  ------------------
  |  Branch (3213:3): [True: 2, False: 17.5k]
  ------------------
 3214|      2|				error = ogg_open (psf) ;
 3215|      2|				break ;
 3216|       |
 3217|      2|		case	SF_FORMAT_TXW :
  ------------------
  |  Branch (3217:3): [True: 2, False: 17.5k]
  ------------------
 3218|      2|				error = txw_open (psf) ;
 3219|      2|				break ;
 3220|       |
 3221|    101|		case	SF_FORMAT_WVE :
  ------------------
  |  Branch (3221:3): [True: 101, False: 17.4k]
  ------------------
 3222|    101|				error = wve_open (psf) ;
 3223|    101|				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|    613|		case	SF_FORMAT_MAT4 :
  ------------------
  |  Branch (3229:3): [True: 613, False: 16.9k]
  ------------------
 3230|    613|				error = mat4_open (psf) ;
 3231|    613|				break ;
 3232|       |
 3233|    236|		case	SF_FORMAT_MAT5 :
  ------------------
  |  Branch (3233:3): [True: 236, False: 17.2k]
  ------------------
 3234|    236|				error = mat5_open (psf) ;
 3235|    236|				break ;
 3236|       |
 3237|    122|		case	SF_FORMAT_PVF :
  ------------------
  |  Branch (3237:3): [True: 122, False: 17.3k]
  ------------------
 3238|    122|				error = pvf_open (psf) ;
 3239|    122|				break ;
 3240|       |
 3241|    153|		case	SF_FORMAT_XI :
  ------------------
  |  Branch (3241:3): [True: 153, False: 17.3k]
  ------------------
 3242|    153|				error = xi_open (psf) ;
 3243|    153|				break ;
 3244|       |
 3245|     45|		case	SF_FORMAT_HTK :
  ------------------
  |  Branch (3245:3): [True: 45, False: 17.4k]
  ------------------
 3246|     45|				error = htk_open (psf) ;
 3247|     45|				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|    100|		case	SF_FORMAT_AVR :
  ------------------
  |  Branch (3257:3): [True: 100, False: 17.4k]
  ------------------
 3258|    100|				error = avr_open (psf) ;
 3259|    100|				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.27k|		case	SF_FORMAT_CAF :
  ------------------
  |  Branch (3265:3): [True: 2.27k, False: 15.2k]
  ------------------
 3266|  2.27k|				error = caf_open (psf) ;
 3267|  2.27k|				break ;
 3268|       |
 3269|     13|		case	SF_FORMAT_MPC2K :
  ------------------
  |  Branch (3269:3): [True: 13, False: 17.5k]
  ------------------
 3270|     13|				error = mpc2k_open (psf) ;
 3271|     13|				break ;
 3272|       |
 3273|     14|		case	SF_FORMAT_MPEG :
  ------------------
  |  Branch (3273:3): [True: 14, False: 17.5k]
  ------------------
 3274|     14|				error = mpeg_open (psf) ;
 3275|     14|				break ;
 3276|       |
 3277|       |		/* Lite remove end */
 3278|       |
 3279|  1.65k|		default :
  ------------------
  |  Branch (3279:3): [True: 1.65k, False: 15.8k]
  ------------------
 3280|  1.65k|				error = SF_ERR_UNRECOGNISED_FORMAT ;
 3281|  17.5k|		} ;
 3282|       |
 3283|  17.5k|	if (error)
  ------------------
  |  Branch (3283:6): [True: 12.6k, False: 4.86k]
  ------------------
 3284|  12.6k|		goto error_exit ;
 3285|       |
 3286|       |	/* For now, check whether embedding is supported. */
 3287|  4.86k|	format = SF_CONTAINER (psf->sf.format) ;
  ------------------
  |  |  108|  4.86k|#define SF_CONTAINER(x)		((x) & SF_FORMAT_TYPEMASK)
  ------------------
 3288|  4.86k|	if (psf->fileoffset > 0)
  ------------------
  |  Branch (3288:6): [True: 132, False: 4.72k]
  ------------------
 3289|    132|	{	switch (format)
 3290|    132|		{	case SF_FORMAT_WAV :
  ------------------
  |  Branch (3290:5): [True: 11, False: 121]
  ------------------
 3291|     12|			case SF_FORMAT_WAVEX :
  ------------------
  |  Branch (3291:4): [True: 1, False: 131]
  ------------------
 3292|     13|			case SF_FORMAT_AIFF :
  ------------------
  |  Branch (3292:4): [True: 1, False: 131]
  ------------------
 3293|     63|			case SF_FORMAT_AU :
  ------------------
  |  Branch (3293:4): [True: 50, False: 82]
  ------------------
 3294|       |				/* Actual embedded files. */
 3295|     63|				break ;
 3296|       |
 3297|      0|			case SF_FORMAT_MPEG :
  ------------------
  |  Branch (3297:4): [True: 0, False: 132]
  ------------------
 3298|      0|			case SF_FORMAT_FLAC :
  ------------------
  |  Branch (3298:4): [True: 0, False: 132]
  ------------------
 3299|       |				/* Flac with an ID3v2 header? */
 3300|      0|				break ;
 3301|       |
 3302|     69|			default :
  ------------------
  |  Branch (3302:4): [True: 69, False: 63]
  ------------------
 3303|     69|				error = SFE_NO_EMBED_SUPPORT ;
 3304|     69|				goto error_exit ;
 3305|    132|			} ;
 3306|  4.79k|		} ;
 3307|       |
 3308|  4.79k|	if (psf->fileoffset > 0)
  ------------------
  |  Branch (3308:6): [True: 63, False: 4.72k]
  ------------------
 3309|     63|		psf_log_printf (psf, "Embedded file length : %D\n", psf->filelength) ;
 3310|       |
 3311|  4.79k|	if (psf->file.mode == SFM_RDWR && sf_format_check (&psf->sf) == 0)
  ------------------
  |  Branch (3311:6): [True: 0, False: 4.79k]
  |  Branch (3311:36): [True: 0, False: 0]
  ------------------
 3312|      0|	{	error = SFE_BAD_MODE_RW ;
 3313|      0|		goto error_exit ;
 3314|  4.79k|		} ;
 3315|       |
 3316|  4.79k|	if (validate_sfinfo (&psf->sf) == 0)
  ------------------
  |  Branch (3316:6): [True: 1.16k, False: 3.63k]
  ------------------
 3317|  1.16k|	{	psf_log_SF_INFO (psf) ;
 3318|  1.16k|		save_header_info (psf) ;
 3319|  1.16k|		error = SFE_BAD_SF_INFO ;
 3320|  1.16k|		goto error_exit ;
 3321|  3.63k|		} ;
 3322|       |
 3323|  3.63k|	if (validate_psf (psf) == 0)
  ------------------
  |  Branch (3323:6): [True: 710, False: 2.92k]
  ------------------
 3324|    710|	{	save_header_info (psf) ;
 3325|    710|		error = SFE_INTERNAL ;
 3326|    710|		goto error_exit ;
 3327|  2.92k|		} ;
 3328|       |
 3329|  2.92k|	psf->read_current = 0 ;
 3330|  2.92k|	psf->write_current = 0 ;
 3331|  2.92k|	if (psf->file.mode == SFM_RDWR)
  ------------------
  |  Branch (3331:6): [True: 0, False: 2.92k]
  ------------------
 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.92k|	memcpy (sfinfo, &psf->sf, sizeof (SF_INFO)) ;
 3337|       |
 3338|  2.92k|	if (psf->file.mode == SFM_WRITE)
  ------------------
  |  Branch (3338:6): [True: 0, False: 2.92k]
  ------------------
 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.92k|	return (SNDFILE *) psf ;
 3346|       |
 3347|  14.6k|error_exit :
 3348|  14.6k|	sf_errno = error ;
 3349|       |
 3350|  14.6k|	if (error == SFE_SYSTEM)
  ------------------
  |  Branch (3350:6): [True: 0, False: 14.6k]
  ------------------
 3351|      0|		snprintf (sf_syserr, sizeof (sf_syserr), "%s", psf->syserr) ;
 3352|  14.6k|	snprintf (sf_parselog, sizeof (sf_parselog), "%s", psf->parselog.buf) ;
 3353|       |
 3354|  14.6k|	switch (error)
 3355|  14.6k|	{	case SF_ERR_SYSTEM :
  ------------------
  |  Branch (3355:4): [True: 0, False: 14.6k]
  ------------------
 3356|    242|		case SF_ERR_UNSUPPORTED_ENCODING :
  ------------------
  |  Branch (3356:3): [True: 242, False: 14.3k]
  ------------------
 3357|  1.38k|		case SFE_UNIMPLEMENTED :
  ------------------
  |  Branch (3357:3): [True: 1.14k, False: 13.4k]
  ------------------
 3358|  1.38k|			break ;
 3359|       |
 3360|      0|		case SFE_RAW_BAD_FORMAT :
  ------------------
  |  Branch (3360:3): [True: 0, False: 14.6k]
  ------------------
 3361|      0|			break ;
 3362|       |
 3363|  13.2k|		default :
  ------------------
  |  Branch (3363:3): [True: 13.2k, False: 1.38k]
  ------------------
 3364|  13.2k|			if (psf->file.mode == SFM_READ)
  ------------------
  |  Branch (3364:8): [True: 13.2k, False: 0]
  ------------------
 3365|  13.2k|			{	psf_log_printf (psf, "Parse error : %s\n", sf_error_number (error)) ;
 3366|  13.2k|				error = SF_ERR_MALFORMED_FILE ;
 3367|  13.2k|				} ;
 3368|  14.6k|		} ;
 3369|       |
 3370|  14.6k|	psf_close (psf) ;
 3371|       |	return NULL ;
 3372|  14.6k|} /* 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.80k, False: 14.7k]
  ------------------
 2969|  2.80k|	{	error = psf->codec_close (psf) ;
 2970|       |		/* To prevent it being called in psf->container_close(). */
 2971|  2.80k|		psf->codec_close = NULL ;
 2972|  2.80k|		} ;
 2973|       |
 2974|  17.5k|	if (psf->container_close)
  ------------------
  |  Branch (2974:6): [True: 7.48k, False: 10.0k]
  ------------------
 2975|  7.48k|		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.6k|retry:
 2786|  19.6k|	if (psf_binheader_readf (psf, "b", &buffer, SIGNED_SIZEOF (buffer)) != SIGNED_SIZEOF (buffer))
  ------------------
  |  |   91|  19.6k|#define		SIGNED_SIZEOF(x)	((int) sizeof (x))
  ------------------
              	if (psf_binheader_readf (psf, "b", &buffer, SIGNED_SIZEOF (buffer)) != SIGNED_SIZEOF (buffer))
  ------------------
  |  |   91|  19.6k|#define		SIGNED_SIZEOF(x)	((int) sizeof (x))
  ------------------
  |  Branch (2786:6): [True: 59, False: 19.5k]
  ------------------
 2787|     59|	{	psf->error = SFE_BAD_FILE_READ ;
 2788|     59|		return 0 ;
 2789|  19.5k|		} ;
 2790|       |
 2791|  19.5k|	if ((buffer [0] == MAKE_MARKER ('R', 'I', 'F', 'F') || buffer [0] == MAKE_MARKER ('R', 'I', 'F', 'X'))
  ------------------
  |  |  122|  39.1k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
              	if ((buffer [0] == MAKE_MARKER ('R', 'I', 'F', 'F') || buffer [0] == MAKE_MARKER ('R', 'I', 'F', 'X'))
  ------------------
  |  |  122|  15.6k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
  |  Branch (2791:7): [True: 3.89k, False: 15.6k]
  |  Branch (2791:57): [True: 212, False: 15.4k]
  ------------------
 2792|  4.10k|			&& buffer [2] == MAKE_MARKER ('W', 'A', 'V', 'E'))
  ------------------
  |  |  122|  4.10k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
  |  Branch (2792:7): [True: 4.07k, False: 34]
  ------------------
 2793|  4.07k|		return SF_FORMAT_WAV ;
 2794|       |
 2795|  15.5k|	if (buffer [0] == MAKE_MARKER ('F', 'O', 'R', 'M'))
  ------------------
  |  |  122|  15.5k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
  |  Branch (2795:6): [True: 3.21k, False: 12.3k]
  ------------------
 2796|  3.21k|	{	if (buffer [2] == MAKE_MARKER ('A', 'I', 'F', 'F') || buffer [2] == MAKE_MARKER ('A', 'I', 'F', 'C'))
  ------------------
  |  |  122|  6.43k|	#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.70k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
  |  Branch (2796:8): [True: 510, False: 2.70k]
  |  Branch (2796:58): [True: 2.18k, False: 520]
  ------------------
 2797|  2.69k|			return SF_FORMAT_AIFF ;
 2798|    520|		if (buffer [2] == MAKE_MARKER ('8', 'S', 'V', 'X') || buffer [2] == MAKE_MARKER ('1', '6', 'S', 'V'))
  ------------------
  |  |  122|  1.04k|	#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|    484|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
  |  Branch (2798:7): [True: 36, False: 484]
  |  Branch (2798:57): [True: 368, False: 116]
  ------------------
 2799|    404|			return SF_FORMAT_SVX ;
 2800|    116|		return 0 ;
 2801|  12.3k|		} ;
 2802|       |
 2803|  12.3k|	if (buffer [0] == MAKE_MARKER ('.', 's', 'n', 'd') || buffer [0] == MAKE_MARKER ('d', 'n', 's', '.'))
  ------------------
  |  |  122|  24.6k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
              	if (buffer [0] == MAKE_MARKER ('.', 's', 'n', 'd') || buffer [0] == MAKE_MARKER ('d', 'n', 's', '.'))
  ------------------
  |  |  122|  11.7k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
  |  Branch (2803:6): [True: 584, False: 11.7k]
  |  Branch (2803:56): [True: 670, False: 11.0k]
  ------------------
 2804|  1.25k|		return SF_FORMAT_AU ;
 2805|       |
 2806|  11.0k|	if ((buffer [0] == MAKE_MARKER ('f', 'a', 'p', ' ') || buffer [0] == MAKE_MARKER (' ', 'p', 'a', 'f')))
  ------------------
  |  |  122|  22.1k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
              	if ((buffer [0] == MAKE_MARKER ('f', 'a', 'p', ' ') || buffer [0] == MAKE_MARKER (' ', 'p', 'a', 'f')))
  ------------------
  |  |  122|  11.0k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
  |  Branch (2806:7): [True: 24, False: 11.0k]
  |  Branch (2806:57): [True: 145, False: 10.8k]
  ------------------
 2807|    169|		return SF_FORMAT_PAF ;
 2808|       |
 2809|  10.8k|	if (buffer [0] == MAKE_MARKER ('N', 'I', 'S', 'T'))
  ------------------
  |  |  122|  10.8k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
  |  Branch (2809:6): [True: 139, False: 10.7k]
  ------------------
 2810|    139|		return SF_FORMAT_NIST ;
 2811|       |
 2812|  10.7k|	if (buffer [0] == MAKE_MARKER ('C', 'r', 'e', 'a') && buffer [1] == MAKE_MARKER ('t', 'i', 'v', 'e'))
  ------------------
  |  |  122|  21.4k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
              	if (buffer [0] == MAKE_MARKER ('C', 'r', 'e', 'a') && buffer [1] == MAKE_MARKER ('t', 'i', 'v', 'e'))
  ------------------
  |  |  122|    283|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
  |  Branch (2812:6): [True: 283, False: 10.4k]
  |  Branch (2812:56): [True: 241, False: 42]
  ------------------
 2813|    241|		return SF_FORMAT_VOC ;
 2814|       |
 2815|  10.5k|	if ((buffer [0] & MAKE_MARKER (0xFF, 0xFF, 0xF8, 0xFF)) == MAKE_MARKER (0x64, 0xA3, 0x00, 0x00) ||
  ------------------
  |  |  122|  10.5k|	#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.0k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
  |  Branch (2815:6): [True: 197, False: 10.3k]
  ------------------
 2816|  10.3k|		(buffer [0] & MAKE_MARKER (0xFF, 0xF8, 0xFF, 0xFF)) == MAKE_MARKER (0x00, 0x00, 0xA3, 0x64))
  ------------------
  |  |  122|  10.3k|	#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.3k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
  |  Branch (2816:3): [True: 99, False: 10.2k]
  ------------------
 2817|    296|		return SF_FORMAT_IRCAM ;
 2818|       |
 2819|  10.2k|	if (buffer [0] == MAKE_MARKER ('r', 'i', 'f', 'f'))
  ------------------
  |  |  122|  10.2k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
  |  Branch (2819:6): [True: 676, False: 9.52k]
  ------------------
 2820|    676|		return SF_FORMAT_W64 ;
 2821|       |
 2822|  9.52k|	if (buffer [0] == MAKE_MARKER (0, 0, 0x03, 0xE8) && buffer [1] == MAKE_MARKER (0, 0, 0, 1) &&
  ------------------
  |  |  122|  19.0k|	#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.66k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
  |  Branch (2822:6): [True: 137, False: 9.39k]
  |  Branch (2822:54): [True: 108, False: 29]
  ------------------
 2823|    108|								buffer [2] == MAKE_MARKER (0, 0, 0, 1))
  ------------------
  |  |  122|    108|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
  |  Branch (2823:9): [True: 72, False: 36]
  ------------------
 2824|     72|		return SF_FORMAT_MAT4 ;
 2825|       |
 2826|  9.45k|	if (buffer [0] == MAKE_MARKER (0, 0, 0, 0) && buffer [1] == MAKE_MARKER (1, 0, 0, 0) &&
  ------------------
  |  |  122|  18.9k|	#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.0k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
  |  Branch (2826:6): [True: 640, False: 8.81k]
  |  Branch (2826:48): [True: 573, False: 67]
  ------------------
 2827|    573|								buffer [2] == MAKE_MARKER (1, 0, 0, 0))
  ------------------
  |  |  122|    573|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
  |  Branch (2827:9): [True: 541, False: 32]
  ------------------
 2828|    541|		return SF_FORMAT_MAT4 ;
 2829|       |
 2830|  8.91k|	if (buffer [0] == MAKE_MARKER ('M', 'A', 'T', 'L') && buffer [1] == MAKE_MARKER ('A', 'B', ' ', '5'))
  ------------------
  |  |  122|  17.8k|	#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|    277|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
  |  Branch (2830:6): [True: 277, False: 8.63k]
  |  Branch (2830:56): [True: 236, False: 41]
  ------------------
 2831|    236|		return SF_FORMAT_MAT5 ;
 2832|       |
 2833|  8.68k|	if (buffer [0] == MAKE_MARKER ('P', 'V', 'F', '1'))
  ------------------
  |  |  122|  8.68k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
  |  Branch (2833:6): [True: 122, False: 8.55k]
  ------------------
 2834|    122|		return SF_FORMAT_PVF ;
 2835|       |
 2836|  8.55k|	if (buffer [0] == MAKE_MARKER ('E', 'x', 't', 'e') && buffer [1] == MAKE_MARKER ('n', 'd', 'e', 'd') &&
  ------------------
  |  |  122|  17.1k|	#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.76k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
  |  Branch (2836:6): [True: 203, False: 8.35k]
  |  Branch (2836:56): [True: 162, False: 41]
  ------------------
 2837|    162|								buffer [2] == MAKE_MARKER (' ', 'I', 'n', 's'))
  ------------------
  |  |  122|    162|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
  |  Branch (2837:9): [True: 153, False: 9]
  ------------------
 2838|    153|		return SF_FORMAT_XI ;
 2839|       |
 2840|  8.40k|	if (buffer [0] == MAKE_MARKER ('c', 'a', 'f', 'f') && buffer [2] == MAKE_MARKER ('d', 'e', 's', 'c'))
  ------------------
  |  |  122|  16.8k|	#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.32k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
  |  Branch (2840:6): [True: 2.32k, False: 6.08k]
  |  Branch (2840:56): [True: 2.27k, False: 44]
  ------------------
 2841|  2.27k|		return SF_FORMAT_CAF ;
 2842|       |
 2843|  6.12k|	if (buffer [0] == MAKE_MARKER ('O', 'g', 'g', 'S'))
  ------------------
  |  |  122|  6.12k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
  |  Branch (2843:6): [True: 2, False: 6.12k]
  ------------------
 2844|      2|		return SF_FORMAT_OGG ;
 2845|       |
 2846|  6.12k|	if (buffer [0] == MAKE_MARKER ('A', 'L', 'a', 'w') && buffer [1] == MAKE_MARKER ('S', 'o', 'u', 'n')
  ------------------
  |  |  122|  12.2k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
              	if (buffer [0] == MAKE_MARKER ('A', 'L', 'a', 'w') && buffer [1] == MAKE_MARKER ('S', 'o', 'u', 'n')
  ------------------
  |  |  122|  6.31k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
  |  Branch (2846:6): [True: 188, False: 5.93k]
  |  Branch (2846:56): [True: 142, False: 46]
  ------------------
 2847|    142|			&& buffer [2] == MAKE_MARKER ('d', 'F', 'i', 'l'))
  ------------------
  |  |  122|    142|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
  |  Branch (2847:7): [True: 101, False: 41]
  ------------------
 2848|    101|		return SF_FORMAT_WVE ;
 2849|       |
 2850|  6.02k|	if (buffer [0] == MAKE_MARKER ('D', 'i', 'a', 'm') && buffer [1] == MAKE_MARKER ('o', 'n', 'd', 'W')
  ------------------
  |  |  122|  12.0k|	#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.10k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
  |  Branch (2850:6): [True: 79, False: 5.94k]
  |  Branch (2850:56): [True: 39, False: 40]
  ------------------
 2851|     39|			&& buffer [2] == MAKE_MARKER ('a', 'r', 'e', ' '))
  ------------------
  |  |  122|     39|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
  |  Branch (2851:7): [True: 1, False: 38]
  ------------------
 2852|      1|		return SF_FORMAT_DWD ;
 2853|       |
 2854|  6.02k|	if (buffer [0] == MAKE_MARKER ('L', 'M', '8', '9') || buffer [0] == MAKE_MARKER ('5', '3', 0, 0))
  ------------------
  |  |  122|  12.0k|	#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.02k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
  |  Branch (2854:6): [True: 1, False: 6.02k]
  |  Branch (2854:56): [True: 1, False: 6.02k]
  ------------------
 2855|      2|		return SF_FORMAT_TXW ;
 2856|       |
 2857|  6.02k|	if ((buffer [0] & MAKE_MARKER (0xFF, 0xFF, 0x80, 0xFF)) == MAKE_MARKER (0xF0, 0x7E, 0, 0x01))
  ------------------
  |  |  122|  6.02k|	#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.02k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
  |  Branch (2857:6): [True: 299, False: 5.72k]
  ------------------
 2858|    299|		return SF_FORMAT_SDS ;
 2859|       |
 2860|  5.72k|	if ((buffer [0] & MAKE_MARKER (0xFF, 0xFF, 0, 0)) == MAKE_MARKER (1, 4, 0, 0))
  ------------------
  |  |  122|  5.72k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
              	if ((buffer [0] & MAKE_MARKER (0xFF, 0xFF, 0, 0)) == MAKE_MARKER (1, 4, 0, 0))
  ------------------
  |  |  122|  5.72k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
  |  Branch (2860:6): [True: 13, False: 5.70k]
  ------------------
 2861|     13|		return SF_FORMAT_MPC2K ;
 2862|       |
 2863|  5.70k|	if (buffer [0] == MAKE_MARKER ('C', 'A', 'T', ' ') && buffer [2] == MAKE_MARKER ('R', 'E', 'X', '2'))
  ------------------
  |  |  122|  11.4k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
              	if (buffer [0] == MAKE_MARKER ('C', 'A', 'T', ' ') && buffer [2] == MAKE_MARKER ('R', 'E', 'X', '2'))
  ------------------
  |  |  122|     16|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
  |  Branch (2863:6): [True: 16, False: 5.69k]
  |  Branch (2863:56): [True: 1, False: 15]
  ------------------
 2864|      1|		return SF_FORMAT_REX2 ;
 2865|       |
 2866|  5.70k|	if (buffer [0] == MAKE_MARKER (0x30, 0x26, 0xB2, 0x75) && buffer [1] == MAKE_MARKER (0x8E, 0x66, 0xCF, 0x11))
  ------------------
  |  |  122|  11.4k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
              	if (buffer [0] == MAKE_MARKER (0x30, 0x26, 0xB2, 0x75) && buffer [1] == MAKE_MARKER (0x8E, 0x66, 0xCF, 0x11))
  ------------------
  |  |  122|     35|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
  |  Branch (2866:6): [True: 35, False: 5.67k]
  |  Branch (2866:60): [True: 1, False: 34]
  ------------------
 2867|      1|		return 0 /*-SF_FORMAT_WMA-*/ ;
 2868|       |
 2869|       |	/* HMM (Hidden Markov Model) Tool Kit. */
 2870|  5.70k|	if (buffer [2] == MAKE_MARKER (0, 2, 0, 0) && 2 * ((int64_t) BE2H_32 (buffer [0])) + 12 == psf->filelength)
  ------------------
  |  |  122|  11.4k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
              	if (buffer [2] == MAKE_MARKER (0, 2, 0, 0) && 2 * ((int64_t) BE2H_32 (buffer [0])) + 12 == psf->filelength)
  ------------------
  |  |  141|    319|	#define BE2H_32(x)			ENDSWAP_32 (x)
  |  |  ------------------
  |  |  |  |   35|    319|#define	ENDSWAP_32(x)		(bswap_32 (x))
  |  |  ------------------
  ------------------
  |  Branch (2870:6): [True: 319, False: 5.38k]
  |  Branch (2870:48): [True: 45, False: 274]
  ------------------
 2871|     45|		return SF_FORMAT_HTK ;
 2872|       |
 2873|  5.66k|	if (buffer [0] == MAKE_MARKER ('f', 'L', 'a', 'C'))
  ------------------
  |  |  122|  5.66k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
  |  Branch (2873:6): [True: 1, False: 5.66k]
  ------------------
 2874|      1|		return SF_FORMAT_FLAC ;
 2875|       |
 2876|  5.66k|	if (buffer [0] == MAKE_MARKER ('2', 'B', 'I', 'T'))
  ------------------
  |  |  122|  5.66k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
  |  Branch (2876:6): [True: 100, False: 5.56k]
  ------------------
 2877|    100|		return SF_FORMAT_AVR ;
 2878|       |
 2879|  5.56k|	if (buffer [0] == MAKE_MARKER ('R', 'F', '6', '4') && buffer [2] == MAKE_MARKER ('W', 'A', 'V', 'E'))
  ------------------
  |  |  122|  11.1k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
              	if (buffer [0] == MAKE_MARKER ('R', 'F', '6', '4') && buffer [2] == MAKE_MARKER ('W', 'A', 'V', 'E'))
  ------------------
  |  |  122|  1.99k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
  |  Branch (2879:6): [True: 1.99k, False: 3.57k]
  |  Branch (2879:56): [True: 1.94k, False: 48]
  ------------------
 2880|  1.94k|		return SF_FORMAT_RF64 ;
 2881|       |
 2882|  3.61k|	if (buffer [0] == MAKE_MARKER ('I', 'D', '3', 2) || buffer [0] == MAKE_MARKER ('I', 'D', '3', 3)
  ------------------
  |  |  122|  7.23k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
              	if (buffer [0] == MAKE_MARKER ('I', 'D', '3', 2) || buffer [0] == MAKE_MARKER ('I', 'D', '3', 3)
  ------------------
  |  |  122|  6.68k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
  |  Branch (2882:6): [True: 556, False: 3.06k]
  |  Branch (2882:54): [True: 798, False: 2.26k]
  ------------------
 2883|  2.26k|			|| buffer [0] == MAKE_MARKER ('I', 'D', '3', 4))
  ------------------
  |  |  122|  2.26k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
  |  Branch (2883:7): [True: 786, False: 1.47k]
  ------------------
 2884|  2.14k|	{	psf_log_printf (psf, "Found 'ID3' marker.\n") ;
 2885|  2.14k|		if (id3_skip (psf))
  ------------------
  |  Branch (2885:7): [True: 2.12k, False: 11]
  ------------------
 2886|  2.12k|			goto retry ;
 2887|     11|		return 0 ;
 2888|  2.14k|		} ;
 2889|       |
 2890|       |	/* ID3v2 tags + MPEG */
 2891|  1.47k|	if (psf->id3_header.len > 0 && (format = identify_mpeg (buffer [0])) != 0)
  ------------------
  |  Branch (2891:6): [True: 34, False: 1.44k]
  |  Branch (2891:33): [True: 3, False: 31]
  ------------------
 2892|      3|		return format ;
 2893|       |
 2894|       |	/* Turtle Beach SMP 16-bit */
 2895|  1.47k|	if (buffer [0] == MAKE_MARKER ('S', 'O', 'U', 'N') && buffer [1] == MAKE_MARKER ('D', ' ', 'S', 'A'))
  ------------------
  |  |  122|  2.95k|	#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|     33|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
  |  Branch (2895:6): [True: 33, False: 1.44k]
  |  Branch (2895:56): [True: 1, False: 32]
  ------------------
 2896|      1|		return 0 ;
 2897|       |
 2898|       |	/* Yamaha sampler format. */
 2899|  1.47k|	if (buffer [0] == MAKE_MARKER ('S', 'Y', '8', '0') || buffer [0] == MAKE_MARKER ('S', 'Y', '8', '5'))
  ------------------
  |  |  122|  2.95k|	#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.47k|	#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.47k]
  |  Branch (2899:56): [True: 1, False: 1.47k]
  ------------------
 2900|      2|		return 0 ;
 2901|       |
 2902|  1.47k|	if (buffer [0] == MAKE_MARKER ('a', 'j', 'k', 'g'))
  ------------------
  |  |  122|  1.47k|	#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.47k]
  ------------------
 2903|      1|		return 0 /*-SF_FORMAT_SHN-*/ ;
 2904|       |
 2905|       |	/* This must be (almost) the last one. */
 2906|  1.47k|	if (psf->filelength > 0 && (format = try_resource_fork (psf)) != 0)
  ------------------
  |  Branch (2906:6): [True: 1.47k, False: 0]
  |  Branch (2906:29): [True: 0, False: 1.47k]
  ------------------
 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.47k|	if (psf->id3_header.len == 0 && (format = identify_mpeg (buffer [0])) != 0)
  ------------------
  |  Branch (2912:6): [True: 1.44k, False: 30]
  |  Branch (2912:34): [True: 11, False: 1.43k]
  ------------------
 2913|     11|		return format ;
 2914|       |
 2915|  1.46k|	return 0 ;
 2916|  1.47k|} /* guess_file_type */
sndfile.c:identify_mpeg:
 2772|  1.47k|{	if ((marker & MAKE_MARKER (0xFF, 0xE0, 0, 0)) == MAKE_MARKER (0xFF, 0xE0, 0, 0) && /* Frame sync */
  ------------------
  |  |  122|  1.47k|	#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.95k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
  |  Branch (2772:7): [True: 41, False: 1.43k]
  ------------------
 2773|     41|		(marker & MAKE_MARKER (0, 0x18, 0, 0)) != MAKE_MARKER (0, 0x08, 0, 0) && /* Valid MPEG version */
  ------------------
  |  |  122|     41|	#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.51k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
  |  Branch (2773:3): [True: 39, False: 2]
  ------------------
 2774|     39|		(marker & MAKE_MARKER (0, 0x06, 0, 0)) != MAKE_MARKER (0, 0, 0, 0) && /* Valid layer description */
  ------------------
  |  |  122|     39|	#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.51k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
  |  Branch (2774:3): [True: 36, False: 3]
  ------------------
 2775|     36|		(marker & MAKE_MARKER (0, 0, 0xF0, 0)) != MAKE_MARKER (0, 0, 0xF0, 0) && /* Valid bitrate */
  ------------------
  |  |  122|     36|	#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.51k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
  |  Branch (2775:3): [True: 21, False: 15]
  ------------------
 2776|     21|		(marker & MAKE_MARKER (0, 0, 0x0C, 0)) != MAKE_MARKER (0, 0, 0x0C, 0)) /* Valid samplerate */
  ------------------
  |  |  122|     21|	#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|     21|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
  |  Branch (2776:3): [True: 14, False: 7]
  ------------------
 2777|     14|		return SF_FORMAT_MPEG ;
 2778|  1.46k|	return 0 ;
 2779|  1.47k|} /* identify_mpeg */
sndfile.c:try_resource_fork:
 2689|  1.47k|{	int old_error = psf->error ;
 2690|       |
 2691|       |	/* Set READ mode now, to see if resource fork exists. */
 2692|  1.47k|	psf->rsrc.mode = SFM_READ ;
 2693|  1.47k|	if (psf_open_rsrc (psf) != 0)
  ------------------
  |  Branch (2693:6): [True: 1.47k, False: 0]
  ------------------
 2694|  1.47k|	{	psf->error = old_error ;
 2695|  1.47k|		return 0 ;
 2696|  1.47k|		} ;
 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.47k|} /* 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.79k|{	if (sfinfo->samplerate < 1)
  ------------------
  |  Branch (2921:7): [True: 914, False: 3.87k]
  ------------------
 2922|    914|		return 0 ;
 2923|  3.87k|	if (sfinfo->frames < 0)
  ------------------
  |  Branch (2923:6): [True: 137, False: 3.74k]
  ------------------
 2924|    137|		return 0 ;
 2925|  3.74k|	if ((sfinfo->channels < 1) || (sfinfo->channels > SF_MAX_CHANNELS))
  ------------------
  |  |  102|  3.67k|#define		SF_MAX_CHANNELS		1024
  ------------------
  |  Branch (2925:6): [True: 66, False: 3.67k]
  |  Branch (2925:32): [True: 26, False: 3.64k]
  ------------------
 2926|     92|		return 0 ;
 2927|  3.64k|	if ((SF_CONTAINER (sfinfo->format)) == 0)
  ------------------
  |  |  108|  3.64k|#define SF_CONTAINER(x)		((x) & SF_FORMAT_TYPEMASK)
  ------------------
  |  Branch (2927:6): [True: 0, False: 3.64k]
  ------------------
 2928|      0|		return 0 ;
 2929|  3.64k|	if ((SF_CODEC (sfinfo->format)) == 0)
  ------------------
  |  |  109|  3.64k|#define SF_CODEC(x)			((x) & SF_FORMAT_SUBMASK)
  ------------------
  |  Branch (2929:6): [True: 17, False: 3.63k]
  ------------------
 2930|     17|		return 0 ;
 2931|  3.63k|	if (sfinfo->sections < 1)
  ------------------
  |  Branch (2931:6): [True: 0, False: 3.63k]
  ------------------
 2932|      0|		return 0 ;
 2933|  3.63k|	return 1 ;
 2934|  3.63k|} /* validate_sfinfo */
sndfile.c:save_header_info:
 2957|  1.87k|{	snprintf (sf_parselog, sizeof (sf_parselog), "%s", psf->parselog.buf) ;
 2958|  1.87k|} /* save_header_info */
sndfile.c:validate_psf:
 2938|  3.63k|{
 2939|  3.63k|	if (psf->datalength < 0)
  ------------------
  |  Branch (2939:6): [True: 272, False: 3.35k]
  ------------------
 2940|    272|	{	psf_log_printf (psf, "Invalid SF_PRIVATE field : datalength == %D.\n", psf->datalength) ;
 2941|    272|		return 0 ;
 2942|  3.35k|		} ;
 2943|  3.35k|	if (psf->dataoffset < 0)
  ------------------
  |  Branch (2943:6): [True: 381, False: 2.97k]
  ------------------
 2944|    381|	{	psf_log_printf (psf, "Invalid SF_PRIVATE field : dataoffset == %D.\n", psf->dataoffset) ;
 2945|    381|		return 0 ;
 2946|  2.97k|		} ;
 2947|  2.97k|	if (psf->blockwidth && psf->blockwidth != psf->sf.channels * psf->bytewidth)
  ------------------
  |  Branch (2947:6): [True: 922, False: 2.05k]
  |  Branch (2947:25): [True: 57, False: 865]
  ------------------
 2948|     57|	{	psf_log_printf (psf, "Invalid SF_PRIVATE field : channels * bytewidth == %d.\n",
 2949|     57|								psf->sf.channels * psf->bytewidth) ;
 2950|     57|		return 0 ;
 2951|  2.92k|		} ;
 2952|  2.92k|	return 1 ;
 2953|  2.97k|} /* validate_psf */

psf_store_string:
   32|  25.9k|{	char	new_str [128] ;
   33|  25.9k|	size_t	str_len ;
   34|  25.9k|	int		k, str_flags ;
   35|       |
   36|  25.9k|	if (str == NULL)
  ------------------
  |  Branch (36:6): [True: 0, False: 25.9k]
  ------------------
   37|      0|		return SFE_STR_BAD_STRING ;
   38|       |
   39|  25.9k|	str_len = strlen (str) ;
   40|       |
   41|       |	/* A few extra checks for write mode. */
   42|  25.9k|	if (psf->file.mode == SFM_WRITE || psf->file.mode == SFM_RDWR)
  ------------------
  |  Branch (42:6): [True: 0, False: 25.9k]
  |  Branch (42:37): [True: 0, False: 25.9k]
  ------------------
   43|      0|	{	if ((psf->strings.flags & SF_STR_ALLOW_START) == 0)
  ------------------
  |  Branch (43:8): [True: 0, False: 0]
  ------------------
   44|      0|			return SFE_STR_NO_SUPPORT ;
   45|      0|		if (psf->have_written && (psf->strings.flags & SF_STR_ALLOW_END) == 0)
  ------------------
  |  Branch (45:7): [True: 0, False: 0]
  |  Branch (45:28): [True: 0, False: 0]
  ------------------
   46|      0|			return SFE_STR_NO_SUPPORT ;
   47|       |		/* Only allow zero length strings for software. */
   48|      0|		if (str_type != SF_STR_SOFTWARE && str_len == 0)
  ------------------
  |  Branch (48:7): [True: 0, False: 0]
  |  Branch (48:38): [True: 0, False: 0]
  ------------------
   49|      0|			return SFE_STR_BAD_STRING ;
   50|  25.9k|		} ;
   51|       |
   52|       |	/* Find the next free slot in table. */
   53|   770k|	for (k = 0 ; k < SF_MAX_STRINGS ; k++)
  ------------------
  |  |   80|   770k|#define SF_MAX_STRINGS			(32)
  ------------------
  |  Branch (53:15): [True: 748k, False: 21.6k]
  ------------------
   54|   748k|	{	/* If we find a matching entry clear it. */
   55|   748k|		if (psf->strings.data [k].type == str_type)
  ------------------
  |  Branch (55:7): [True: 3.84k, False: 744k]
  ------------------
   56|  3.84k|			psf->strings.data [k].type = -1 ;
   57|       |
   58|   748k|		if (psf->strings.data [k].type == 0)
  ------------------
  |  Branch (58:7): [True: 4.35k, False: 744k]
  ------------------
   59|  4.35k|			break ;
   60|   748k|		} ;
   61|       |
   62|       |	/* Determine flags */
   63|  25.9k|	str_flags = SF_STR_LOCATE_START ;
   64|  25.9k|	if (psf->file.mode == SFM_RDWR || psf->have_written)
  ------------------
  |  Branch (64:6): [True: 0, False: 25.9k]
  |  Branch (64:36): [True: 0, False: 25.9k]
  ------------------
   65|      0|	{	if ((psf->strings.flags & SF_STR_ALLOW_END) == 0)
  ------------------
  |  Branch (65:8): [True: 0, False: 0]
  ------------------
   66|      0|			return SFE_STR_NO_ADD_END ;
   67|      0|		str_flags = SF_STR_LOCATE_END ;
   68|  25.9k|		} ;
   69|       |
   70|       |	/* More sanity checking. */
   71|  25.9k|	if (k >= SF_MAX_STRINGS)
  ------------------
  |  |   80|  25.9k|#define SF_MAX_STRINGS			(32)
  ------------------
  |  Branch (71:6): [True: 21.6k, False: 4.35k]
  ------------------
   72|  21.6k|		return SFE_STR_MAX_COUNT ;
   73|       |
   74|  4.35k|	if (k == 0 && psf->strings.storage_used != 0)
  ------------------
  |  Branch (74:6): [True: 464, False: 3.88k]
  |  Branch (74:16): [True: 0, False: 464]
  ------------------
   75|      0|	{	psf_log_printf (psf, "SFE_STR_WEIRD : k == 0 && psf->strings.storage_used != 0\n") ;
   76|      0|		return SFE_STR_WEIRD ;
   77|  4.35k|		} ;
   78|       |
   79|  4.35k|	if (k != 0 && psf->strings.storage_used == 0)
  ------------------
  |  Branch (79:6): [True: 3.88k, False: 464]
  |  Branch (79:16): [True: 0, False: 3.88k]
  ------------------
   80|      0|	{	psf_log_printf (psf, "SFE_STR_WEIRD : k != 0 && psf->strings.storage_used == 0\n") ;
   81|      0|		return SFE_STR_WEIRD ;
   82|  4.35k|		} ;
   83|       |
   84|       |	/* Special case for the first string. */
   85|  4.35k|	if (k == 0)
  ------------------
  |  Branch (85:6): [True: 464, False: 3.88k]
  ------------------
   86|    464|		psf->strings.storage_used = 0 ;
   87|       |
   88|  4.35k|	switch (str_type)
   89|  4.35k|	{	case SF_STR_SOFTWARE :
  ------------------
  |  Branch (89:4): [True: 691, False: 3.66k]
  ------------------
   90|       |				/* In write mode, want to append libsndfile-version to string. */
   91|    691|				if (psf->file.mode == SFM_WRITE || psf->file.mode == SFM_RDWR)
  ------------------
  |  Branch (91:9): [True: 0, False: 691]
  |  Branch (91:40): [True: 0, False: 691]
  ------------------
   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|    691|				break ;
  108|       |
  109|    713|		case SF_STR_TITLE :
  ------------------
  |  Branch (109:3): [True: 713, False: 3.63k]
  ------------------
  110|  1.18k|		case SF_STR_COPYRIGHT :
  ------------------
  |  Branch (110:3): [True: 469, False: 3.88k]
  ------------------
  111|  1.72k|		case SF_STR_ARTIST :
  ------------------
  |  Branch (111:3): [True: 540, False: 3.81k]
  ------------------
  112|  2.28k|		case SF_STR_COMMENT :
  ------------------
  |  Branch (112:3): [True: 565, False: 3.78k]
  ------------------
  113|  2.60k|		case SF_STR_DATE :
  ------------------
  |  Branch (113:3): [True: 321, False: 4.03k]
  ------------------
  114|  2.94k|		case SF_STR_ALBUM :
  ------------------
  |  Branch (114:3): [True: 332, False: 4.02k]
  ------------------
  115|  3.12k|		case SF_STR_LICENSE :
  ------------------
  |  Branch (115:3): [True: 180, False: 4.17k]
  ------------------
  116|  3.52k|		case SF_STR_TRACKNUMBER :
  ------------------
  |  Branch (116:3): [True: 404, False: 3.94k]
  ------------------
  117|  3.66k|		case SF_STR_GENRE :
  ------------------
  |  Branch (117:3): [True: 137, False: 4.21k]
  ------------------
  118|  3.66k|				break ;
  119|       |
  120|      0|		default :
  ------------------
  |  Branch (120:3): [True: 0, False: 4.35k]
  ------------------
  121|      0|			psf_log_printf (psf, "%s : SFE_STR_BAD_TYPE\n", __func__) ;
  122|      0|			return SFE_STR_BAD_TYPE ;
  123|  4.35k|		} ;
  124|       |
  125|       |	/* Plus one to catch string terminator. */
  126|  4.35k|	str_len = strlen (str) + 1 ;
  127|       |
  128|  4.35k|	if (psf->strings.storage_used + str_len + 1 > psf->strings.storage_len)
  ------------------
  |  Branch (128:6): [True: 509, False: 3.84k]
  ------------------
  129|    509|	{	char * temp = psf->strings.storage ;
  130|    509|		size_t newlen = 2 * psf->strings.storage_len + str_len + 1 ;
  131|       |
  132|    509|		newlen = newlen < 256 ? 256 : newlen ;
  ------------------
  |  Branch (132:12): [True: 450, False: 59]
  ------------------
  133|       |
  134|    509|		char * new_storage = realloc(temp, newlen);
  135|    509|		if (new_storage == NULL)
  ------------------
  |  Branch (135:7): [True: 0, False: 509]
  ------------------
  136|      0|		{
  137|      0|			return SFE_MALLOC_FAILED ;
  138|    509|			} else {
  139|    509|			psf->strings.storage = new_storage;
  140|    509|			} ;
  141|       |
  142|    509|		psf->strings.storage_len = newlen ;
  143|  4.35k|		} ;
  144|       |
  145|  4.35k|	psf->strings.data [k].type = str_type ;
  146|  4.35k|	psf->strings.data [k].offset = psf->strings.storage_used ;
  147|  4.35k|	psf->strings.data [k].flags = str_flags ;
  148|       |
  149|  4.35k|	memcpy (psf->strings.storage + psf->strings.storage_used, str, str_len) ;
  150|  4.35k|	psf->strings.storage_used += str_len ;
  151|       |
  152|  4.35k|	psf->strings.flags |= str_flags ;
  153|       |
  154|       |#if STRINGS_DEBUG
  155|       |	printf ("storage_used         : %zd / %zd\n", psf->strings.storage_used, psf->strings.storage_len) ;
  156|       |	psf_hexdump (psf->strings.storage, psf->strings.storage_used) ;
  157|       |#endif
  158|       |
  159|  4.35k|	return 0 ;
  160|  4.35k|} /* psf_store_string */

svx_open:
   83|    404|{	int error ;
   84|       |
   85|    404|	if (psf->file.mode == SFM_READ || (psf->file.mode == SFM_RDWR && psf->filelength > 0))
  ------------------
  |  Branch (85:6): [True: 404, False: 0]
  |  Branch (85:37): [True: 0, False: 0]
  |  Branch (85:67): [True: 0, False: 0]
  ------------------
   86|    404|	{	if ((error = svx_read_header (psf)))
  ------------------
  |  Branch (86:8): [True: 388, False: 16]
  ------------------
   87|    388|			return error ;
   88|       |
   89|     16|		psf->endian = SF_ENDIAN_BIG ;			/* All SVX files are big endian. */
   90|       |
   91|     16|		psf->blockwidth = psf->sf.channels * psf->bytewidth ;
   92|     16|		if (psf->blockwidth)
  ------------------
  |  Branch (92:7): [True: 16, False: 0]
  ------------------
   93|     16|			psf->sf.frames = psf->datalength / psf->blockwidth ;
   94|       |
   95|     16|		psf_fseek (psf, psf->dataoffset, SEEK_SET) ;
   96|     16|		} ;
   97|       |
   98|     16|	if (psf->file.mode == SFM_WRITE || psf->file.mode == SFM_RDWR)
  ------------------
  |  Branch (98:6): [True: 0, False: 16]
  |  Branch (98:37): [True: 0, False: 16]
  ------------------
   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|     16|		} ;
  118|       |
  119|     16|	psf->container_close = svx_close ;
  120|       |
  121|     16|	if ((error = pcm_init (psf)))
  ------------------
  |  Branch (121:6): [True: 0, False: 16]
  ------------------
  122|      0|		return error ;
  123|       |
  124|     16|	return 0 ;
  125|     16|} /* svx_open */
svx.c:svx_read_header:
  132|    404|{	VHDR_CHUNK		vhdr ;
  133|    404|	uint32_t		chunk_size, marker ;
  134|    404|	int				filetype = 0, parsestage = 0, done = 0 ;
  135|    404|	int 			bytecount = 0, channels ;
  136|       |
  137|    404|	if (psf->filelength > 0xFFFFFFFFLL)
  ------------------
  |  Branch (137:6): [True: 0, False: 404]
  ------------------
  138|      0|		psf_log_printf (psf, "Warning : filelength > 0xffffffff. This is bad!!!!\n") ;
  139|       |
  140|    404|	memset (&vhdr, 0, sizeof (vhdr)) ;
  141|    404|	psf_binheader_readf (psf, "p", 0) ;
  142|       |
  143|       |	/* Set default number of channels. Modify later if necessary */
  144|    404|	psf->sf.channels = 1 ;
  145|       |
  146|    404|	psf->sf.format = SF_FORMAT_SVX ;
  147|       |
  148|  31.1k|	while (! done)
  ------------------
  |  Branch (148:9): [True: 31.0k, False: 24]
  ------------------
  149|  31.0k|	{	psf_binheader_readf (psf, "Em4", &marker, &chunk_size) ;
  150|       |
  151|  31.0k|		switch (marker)
  152|  31.0k|		{	case FORM_MARKER :
  ------------------
  |  |   35|    405|#define FORM_MARKER	(MAKE_MARKER ('F', 'O', 'R', 'M'))
  |  |  ------------------
  |  |  |  |  122|    405|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (152:5): [True: 405, False: 30.6k]
  ------------------
  153|    405|					if (parsestage)
  ------------------
  |  Branch (153:10): [True: 1, False: 404]
  ------------------
  154|      1|						return SFE_SVX_NO_FORM ;
  155|       |
  156|    404|					if (chunk_size != psf->filelength - 2 * sizeof (chunk_size))
  ------------------
  |  Branch (156:10): [True: 403, False: 1]
  ------------------
  157|    403|						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|    404|					parsestage |= HAVE_FORM ;
  161|       |
  162|    404|					psf_binheader_readf (psf, "m", &marker) ;
  163|       |
  164|    404|					filetype = marker ;
  165|    404|					psf_log_printf (psf, " %M\n", marker) ;
  166|    404|					parsestage |= HAVE_SVX ;
  167|    404|					break ;
  168|       |
  169|  1.01k|			case VHDR_MARKER :
  ------------------
  |  |   38|  1.01k|#define VHDR_MARKER	(MAKE_MARKER ('V', 'H', 'D', 'R'))
  |  |  ------------------
  |  |  |  |  122|  1.01k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (169:4): [True: 1.01k, False: 30.0k]
  ------------------
  170|  1.01k|					if (! (parsestage & (HAVE_FORM | HAVE_SVX)))
  ------------------
  |  Branch (170:10): [True: 0, False: 1.01k]
  ------------------
  171|      0|						return SFE_SVX_NO_FORM ;
  172|       |
  173|  1.01k|					psf_log_printf (psf, " VHDR : %d\n", chunk_size) ;
  174|       |
  175|  1.01k|					psf_binheader_readf (psf, "E4442114", &(vhdr.oneShotHiSamples), &(vhdr.repeatHiSamples),
  176|  1.01k|						&(vhdr.samplesPerHiCycle), &(vhdr.samplesPerSec), &(vhdr.octave), &(vhdr.compression),
  177|  1.01k|						&(vhdr.volume)) ;
  178|       |
  179|  1.01k|					psf_log_printf (psf, "  OneShotHiSamples  : %d\n", vhdr.oneShotHiSamples) ;
  180|  1.01k|					psf_log_printf (psf, "  RepeatHiSamples   : %d\n", vhdr.repeatHiSamples) ;
  181|  1.01k|					psf_log_printf (psf, "  samplesPerHiCycle : %d\n", vhdr.samplesPerHiCycle) ;
  182|  1.01k|					psf_log_printf (psf, "  Sample Rate       : %d\n", vhdr.samplesPerSec) ;
  183|  1.01k|					psf_log_printf (psf, "  Octave            : %d\n", vhdr.octave) ;
  184|       |
  185|  1.01k|					psf_log_printf (psf, "  Compression       : %d => ", vhdr.compression) ;
  186|       |
  187|  1.01k|					switch (vhdr.compression)
  ------------------
  |  Branch (187:14): [True: 676, False: 336]
  ------------------
  188|  1.01k|					{	case 0 : psf_log_printf (psf, "None.\n") ;
  ------------------
  |  Branch (188:8): [True: 349, False: 663]
  ------------------
  189|    349|								break ;
  190|    234|						case 1 : psf_log_printf (psf, "Fibonacci delta\n") ;
  ------------------
  |  Branch (190:7): [True: 234, False: 778]
  ------------------
  191|    234|								break ;
  192|     93|						case 2 : psf_log_printf (psf, "Exponential delta\n") ;
  ------------------
  |  Branch (192:7): [True: 93, False: 919]
  ------------------
  193|     93|								break ;
  194|  1.01k|						} ;
  195|       |
  196|  1.01k|					psf_log_printf (psf, "  Volume            : %d\n", vhdr.volume) ;
  197|       |
  198|  1.01k|					psf->sf.samplerate 	= vhdr.samplesPerSec ;
  199|       |
  200|  1.01k|					if (filetype == SVX8_MARKER)
  ------------------
  |  |   36|  1.01k|#define SVX8_MARKER	(MAKE_MARKER ('8', 'S', 'V', 'X'))
  |  |  ------------------
  |  |  |  |  122|  1.01k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (200:10): [True: 362, False: 650]
  ------------------
  201|    362|					{	psf->sf.format |= SF_FORMAT_PCM_S8 ;
  202|    362|						psf->bytewidth = 1 ;
  203|    362|						}
  204|    650|					else if (filetype == SV16_MARKER)
  ------------------
  |  |   37|    650|#define SV16_MARKER	(MAKE_MARKER ('1', '6', 'S', 'V'))
  |  |  ------------------
  |  |  |  |  122|    650|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (204:15): [True: 650, False: 0]
  ------------------
  205|    650|					{	psf->sf.format |= SF_FORMAT_PCM_16 ;
  206|    650|						psf->bytewidth = 2 ;
  207|    650|						} ;
  208|       |
  209|  1.01k|					parsestage |= HAVE_VHDR ;
  210|  1.01k|					break ;
  211|       |
  212|  1.10k|			case BODY_MARKER :
  ------------------
  |  |   39|  1.10k|#define BODY_MARKER	(MAKE_MARKER ('B', 'O', 'D', 'Y'))
  |  |  ------------------
  |  |  |  |  122|  1.10k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (212:4): [True: 1.10k, False: 29.9k]
  ------------------
  213|  1.10k|					if (! (parsestage & HAVE_VHDR))
  ------------------
  |  Branch (213:10): [True: 1, False: 1.09k]
  ------------------
  214|      1|						return SFE_SVX_NO_BODY ;
  215|       |
  216|  1.09k|					psf->datalength = chunk_size ;
  217|       |
  218|  1.09k|					psf->dataoffset = psf_ftell (psf) ;
  219|  1.09k|					if (psf->dataoffset < 0)
  ------------------
  |  Branch (219:10): [True: 0, False: 1.09k]
  ------------------
  220|      0|						return SFE_SVX_NO_BODY ;
  221|       |
  222|  1.09k|					if (psf->datalength > psf->filelength - psf->dataoffset)
  ------------------
  |  Branch (222:10): [True: 11, False: 1.08k]
  ------------------
  223|     11|					{	psf_log_printf (psf, " BODY : %D (should be %D)\n", psf->datalength, psf->filelength - psf->dataoffset) ;
  224|     11|						psf->datalength = psf->filelength - psf->dataoffset ;
  225|     11|						}
  226|  1.08k|					else
  227|  1.08k|						psf_log_printf (psf, " BODY : %D\n", psf->datalength) ;
  228|       |
  229|  1.09k|					parsestage |= HAVE_BODY ;
  230|       |
  231|  1.09k|					if (! psf->sf.seekable)
  ------------------
  |  Branch (231:10): [True: 0, False: 1.09k]
  ------------------
  232|      0|						break ;
  233|       |
  234|  1.09k|					psf_fseek (psf, psf->datalength, SEEK_CUR) ;
  235|  1.09k|					break ;
  236|       |
  237|    890|			case NAME_MARKER :
  ------------------
  |  |   45|    890|#define NAME_MARKER	(MAKE_MARKER ('N', 'A', 'M', 'E'))
  |  |  ------------------
  |  |  |  |  122|    890|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (237:4): [True: 890, False: 30.1k]
  ------------------
  238|    890|					if (! (parsestage & HAVE_SVX))
  ------------------
  |  Branch (238:10): [True: 0, False: 890]
  ------------------
  239|      0|						return SFE_SVX_NO_FORM ;
  240|       |
  241|    890|					psf_log_printf (psf, " %M : %u\n", marker, chunk_size) ;
  242|       |
  243|    890|					if (strlen (psf->file.name) != chunk_size)
  ------------------
  |  Branch (243:10): [True: 479, False: 411]
  ------------------
  244|    479|					{	if (chunk_size > sizeof (psf->file.name) - 1)
  ------------------
  |  Branch (244:12): [True: 32, False: 447]
  ------------------
  245|     32|							return SFE_SVX_BAD_NAME_LENGTH ;
  246|       |
  247|    447|						psf_binheader_readf (psf, "b", psf->file.name, chunk_size) ;
  248|    447|						psf->file.name [chunk_size] = 0 ;
  249|    447|						}
  250|    411|					else
  251|    411|						psf_binheader_readf (psf, "j", chunk_size) ;
  252|    858|					break ;
  253|       |
  254|    858|			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: 30.8k]
  ------------------
  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.47k|			case CHAN_MARKER :
  ------------------
  |  |   48|  1.47k|#define CHAN_MARKER	(MAKE_MARKER ('C', 'H', 'A', 'N'))
  |  |  ------------------
  |  |  |  |  122|  1.47k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (263:4): [True: 1.47k, False: 29.6k]
  ------------------
  264|  1.47k|					if (! (parsestage & HAVE_SVX))
  ------------------
  |  Branch (264:10): [True: 0, False: 1.47k]
  ------------------
  265|      0|						return SFE_SVX_NO_FORM ;
  266|       |
  267|  1.47k|					psf_log_printf (psf, " %M : %u\n", marker, chunk_size) ;
  268|       |
  269|  1.47k|					bytecount += psf_binheader_readf (psf, "E4", &channels) ;
  270|       |
  271|  1.47k|					if (channels == 2 || channels == 4)
  ------------------
  |  Branch (271:10): [True: 376, False: 1.09k]
  |  Branch (271:27): [True: 217, False: 878]
  ------------------
  272|    593|						psf_log_printf (psf, "  Channels : %d => mono\n", channels) ;
  273|    878|					else if (channels == 6)
  ------------------
  |  Branch (273:15): [True: 342, False: 536]
  ------------------
  274|    342|					{	psf->sf.channels = 2 ;
  275|    342|						psf_log_printf (psf, "  Channels : %d => stereo\n", channels) ;
  276|    342|						}
  277|    536|					else
  278|    536|						psf_log_printf (psf, "  Channels : %d *** assuming mono\n", channels) ;
  279|       |
  280|  1.47k|					psf_binheader_readf (psf, "j", chunk_size - bytecount) ;
  281|  1.47k|					break ;
  282|       |
  283|       |
  284|    379|			case AUTH_MARKER :
  ------------------
  |  |   46|    379|#define AUTH_MARKER	(MAKE_MARKER ('A', 'U', 'T', 'H'))
  |  |  ------------------
  |  |  |  |  122|    379|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (284:4): [True: 379, False: 30.7k]
  ------------------
  285|  1.58k|			case c_MARKER :
  ------------------
  |  |   44|  1.58k|#define c_MARKER	(MAKE_MARKER ('(', 'c', ')', ' '))
  |  |  ------------------
  |  |  |  |  122|  1.58k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (285:4): [True: 1.20k, False: 29.8k]
  ------------------
  286|  1.58k|					if (! (parsestage & HAVE_SVX))
  ------------------
  |  Branch (286:10): [True: 0, False: 1.58k]
  ------------------
  287|      0|						return SFE_SVX_NO_FORM ;
  288|       |
  289|  1.58k|					psf_log_printf (psf, " %M : %u\n", marker, chunk_size) ;
  290|       |
  291|  1.58k|					psf_binheader_readf (psf, "j", chunk_size) ;
  292|  1.58k|					break ;
  293|       |
  294|  24.3k|			default :
  ------------------
  |  Branch (294:4): [True: 24.3k, False: 6.73k]
  ------------------
  295|  24.3k|					if (chunk_size >= 0xffff0000)
  ------------------
  |  Branch (295:10): [True: 9, False: 24.3k]
  ------------------
  296|      9|					{	done = SF_TRUE ;
  297|      9|						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|      9|						break ;
  299|  24.3k|						} ;
  300|       |
  301|  24.3k|					if (psf_isprint ((marker >> 24) & 0xFF) && psf_isprint ((marker >> 16) & 0xFF)
  ------------------
  |  Branch (301:10): [True: 10.2k, False: 14.1k]
  |  Branch (301:49): [True: 8.57k, False: 1.64k]
  ------------------
  302|  8.57k|						&& psf_isprint ((marker >> 8) & 0xFF) && psf_isprint (marker & 0xFF))
  ------------------
  |  Branch (302:10): [True: 7.08k, False: 1.48k]
  |  Branch (302:48): [True: 6.48k, False: 601]
  ------------------
  303|  6.48k|					{	psf_log_printf (psf, "%M : %u (unknown marker)\n", marker, chunk_size) ;
  304|  6.48k|						psf_binheader_readf (psf, "j", chunk_size) ;
  305|  6.48k|						break ;
  306|  17.8k|						} ;
  307|  17.8k|					if ((chunk_size = psf_ftell (psf)) & 0x03)
  ------------------
  |  Branch (307:10): [True: 17.7k, False: 68]
  ------------------
  308|  17.7k|					{	psf_log_printf (psf, "  Unknown chunk marker at position %d. Resynching.\n", chunk_size - 4) ;
  309|       |
  310|  17.7k|						chunk_size = chunk_size & 3 ;
  311|  17.7k|						psf_binheader_readf (psf, "j", 4 - chunk_size) ;
  312|  17.7k|						break ;
  313|  17.7k|						} ;
  314|     68|					psf_log_printf (psf, "*** Unknown chunk marker (%X) at position %D. Exiting parser.\n", marker, psf_ftell (psf) - 8) ;
  315|     68|					done = SF_TRUE ;
  316|  31.0k|			} ;	/* switch (marker) */
  317|       |
  318|  31.0k|		if (! psf->sf.seekable && (parsestage & HAVE_BODY))
  ------------------
  |  Branch (318:7): [True: 0, False: 31.0k]
  |  Branch (318:29): [True: 0, False: 0]
  ------------------
  319|      0|			break ;
  320|       |
  321|  31.0k|		if (psf_ftell (psf) >= psf->filelength - SIGNED_SIZEOF (chunk_size))
  ------------------
  |  |   91|  31.0k|#define		SIGNED_SIZEOF(x)	((int) sizeof (x))
  ------------------
  |  Branch (321:7): [True: 346, False: 30.7k]
  ------------------
  322|    346|			break ;
  323|  31.0k|		} ; /* while (1) */
  324|       |
  325|    370|	if (vhdr.compression)
  ------------------
  |  Branch (325:6): [True: 43, False: 327]
  ------------------
  326|     43|		return SFE_SVX_BAD_COMP ;
  327|       |
  328|    327|	if (psf->dataoffset <= 0)
  ------------------
  |  Branch (328:6): [True: 311, False: 16]
  ------------------
  329|    311|		return SFE_SVX_NO_DATA ;
  330|       |
  331|     16|	return 0 ;
  332|    327|} /* svx_read_header */
svx.c:svx_close:
  336|     16|{
  337|     16|	if (psf->file.mode == SFM_WRITE || psf->file.mode == SFM_RDWR)
  ------------------
  |  Branch (337:6): [True: 0, False: 16]
  |  Branch (337:37): [True: 0, False: 16]
  ------------------
  338|      0|		svx_write_header (psf, SF_TRUE) ;
  339|       |
  340|     16|	return 0 ;
  341|     16|} /* svx_close */

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

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

voc_open:
  105|    241|{	int subformat, error = 0 ;
  106|       |
  107|    241|	if (psf->is_pipe)
  ------------------
  |  Branch (107:6): [True: 0, False: 241]
  ------------------
  108|      0|		return SFE_VOC_NO_PIPE ;
  109|       |
  110|    241|	if (psf->file.mode == SFM_READ || (psf->file.mode == SFM_RDWR && psf->filelength > 0))
  ------------------
  |  Branch (110:6): [True: 241, False: 0]
  |  Branch (110:37): [True: 0, False: 0]
  |  Branch (110:67): [True: 0, False: 0]
  ------------------
  111|    241|	{	if ((error = voc_read_header (psf)))
  ------------------
  |  Branch (111:8): [True: 150, False: 91]
  ------------------
  112|    150|			return error ;
  113|    241|		} ;
  114|       |
  115|     91|	subformat = SF_CODEC (psf->sf.format) ;
  ------------------
  |  |  109|     91|#define SF_CODEC(x)			((x) & SF_FORMAT_SUBMASK)
  ------------------
  116|       |
  117|     91|	if (psf->file.mode == SFM_WRITE || psf->file.mode == SFM_RDWR)
  ------------------
  |  Branch (117:6): [True: 0, False: 91]
  |  Branch (117:37): [True: 0, False: 91]
  ------------------
  118|      0|	{	if ((SF_CONTAINER (psf->sf.format)) != SF_FORMAT_VOC)
  ------------------
  |  |  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|     91|		} ;
  128|       |
  129|     91|	psf->blockwidth = psf->bytewidth * psf->sf.channels ;
  130|       |
  131|     91|	psf->container_close = voc_close ;
  132|       |
  133|     91|	switch (subformat)
  134|     91|	{	case SF_FORMAT_PCM_U8 :
  ------------------
  |  Branch (134:4): [True: 53, False: 38]
  ------------------
  135|     55|		case SF_FORMAT_PCM_16 :
  ------------------
  |  Branch (135:3): [True: 2, False: 89]
  ------------------
  136|     55|				error = pcm_init (psf) ;
  137|     55|				break ;
  138|       |
  139|      2|		case SF_FORMAT_ALAW :
  ------------------
  |  Branch (139:3): [True: 2, False: 89]
  ------------------
  140|      2|				error = alaw_init (psf) ;
  141|      2|				break ;
  142|       |
  143|      3|		case SF_FORMAT_ULAW :
  ------------------
  |  Branch (143:3): [True: 3, False: 88]
  ------------------
  144|      3|				error = ulaw_init (psf) ;
  145|      3|				break ;
  146|       |
  147|     31|		default : return SFE_UNIMPLEMENTED ;
  ------------------
  |  Branch (147:3): [True: 31, False: 60]
  ------------------
  148|     91|		} ;
  149|       |
  150|     60|	return error ;
  151|     91|} /* voc_open */
voc.c:voc_read_header:
  158|    241|{	VOC_DATA	*pvoc ;
  159|    241|	char	creative [20] ;
  160|    241|	unsigned char block_type, rate_byte ;
  161|    241|	short	version, checksum, encoding, dataoffset ;
  162|    241|	int		offset ;
  163|       |
  164|       |	/* Set position to start of file to begin reading header. */
  165|    241|	offset = psf_binheader_readf (psf, "pb", 0, creative, SIGNED_SIZEOF (creative)) ;
  ------------------
  |  |   91|    241|#define		SIGNED_SIZEOF(x)	((int) sizeof (x))
  ------------------
  166|       |
  167|    241|	if (creative [sizeof (creative) - 1] != 0x1A)
  ------------------
  |  Branch (167:6): [True: 5, False: 236]
  ------------------
  168|      5|		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: 92, False: 144]
  ------------------
  174|     92|		return SFE_VOC_NO_CREATIVE ;
  175|       |
  176|    144|	psf_log_printf (psf, "%s\n", creative) ;
  177|       |
  178|    144|	offset += psf_binheader_readf (psf, "e222", &dataoffset, &version, &checksum) ;
  179|       |
  180|    144|	psf->dataoffset = dataoffset ;
  181|       |
  182|    144|	psf_log_printf (psf, 	"dataoffset : %d\n"
  183|    144|							"version    : 0x%X\n"
  184|    144|							"checksum   : 0x%X\n", psf->dataoffset, version, checksum) ;
  185|       |
  186|    144|	if (version != 0x010A && version != 0x0114)
  ------------------
  |  Branch (186:6): [True: 134, False: 10]
  |  Branch (186:27): [True: 3, False: 131]
  ------------------
  187|      3|		return SFE_VOC_BAD_VERSION ;
  188|       |
  189|    141|	if (! (psf->codec_data = malloc (sizeof (VOC_DATA))))
  ------------------
  |  Branch (189:6): [True: 0, False: 141]
  ------------------
  190|      0|		return SFE_MALLOC_FAILED ;
  191|       |
  192|    141|	pvoc = (VOC_DATA*) psf->codec_data ;
  193|       |
  194|    141|	memset (pvoc, 0, sizeof (VOC_DATA)) ;
  195|       |
  196|       |	/* Set the default encoding now. */
  197|    141|	psf->sf.format = SF_FORMAT_VOC ; /* Major format */
  198|    141|	encoding = SF_FORMAT_PCM_U8 ; /* Minor format */
  199|    141|	psf->endian = SF_ENDIAN_LITTLE ;
  200|       |
  201|  2.06k|	while (1)
  ------------------
  |  Branch (201:9): [True: 2.06k, Folded]
  ------------------
  202|  2.06k|	{	char header [256] ;
  203|  2.06k|		unsigned size ;
  204|  2.06k|		short count ;
  205|       |
  206|  2.06k|		block_type = 0 ;
  207|  2.06k|		offset += psf_binheader_readf (psf, "1", &block_type) ;
  208|       |
  209|  2.06k|		switch (block_type)
  210|  2.06k|		{	case VOC_ASCII :
  ------------------
  |  Branch (210:5): [True: 1.69k, False: 375]
  ------------------
  211|  1.69k|					offset += psf_binheader_readf (psf, "e3", &size) ;
  212|       |
  213|  1.69k|					psf_log_printf (psf, " ASCII : %d\n", size) ;
  214|       |
  215|  1.69k|					if (size < sizeof (header) - 1)
  ------------------
  |  Branch (215:10): [True: 1.62k, False: 74]
  ------------------
  216|  1.62k|					{	offset += psf_binheader_readf (psf, "b", header, size) ;
  217|  1.62k|						header [size] = 0 ;
  218|  1.62k|						psf_log_printf (psf, "  text : %s\n", header) ;
  219|  1.62k|						continue ;
  220|  1.62k|						}
  221|       |
  222|     74|					offset += psf_binheader_readf (psf, "j", size) ;
  223|     74|					continue ;
  224|       |
  225|    234|			case VOC_REPEAT :
  ------------------
  |  Branch (225:4): [True: 234, False: 1.83k]
  ------------------
  226|    234|					offset += psf_binheader_readf (psf, "e32", &size, &count) ;
  227|    234|					psf_log_printf (psf, " Repeat : %d\n", count) ;
  228|    234|					continue ;
  229|       |
  230|     13|			case VOC_SOUND_DATA :
  ------------------
  |  Branch (230:4): [True: 13, False: 2.05k]
  ------------------
  231|     18|			case VOC_EXTENDED :
  ------------------
  |  Branch (231:4): [True: 5, False: 2.06k]
  ------------------
  232|    110|			case VOC_EXTENDED_II :
  ------------------
  |  Branch (232:4): [True: 92, False: 1.97k]
  ------------------
  233|    110|					break ;
  234|       |
  235|     31|			default : psf_log_printf (psf, "*** Weird block marker (%d)\n", block_type) ;
  ------------------
  |  Branch (235:4): [True: 31, False: 2.03k]
  ------------------
  236|  2.06k|			} ;
  237|       |
  238|    141|		break ;
  239|  2.06k|		} ;
  240|       |
  241|    141|	if (block_type == VOC_SOUND_DATA)
  ------------------
  |  Branch (241:6): [True: 13, False: 128]
  ------------------
  242|     13|	{	unsigned char compression ;
  243|     13|		int 	size ;
  244|       |
  245|     13|		offset += psf_binheader_readf (psf, "e311", &size, &rate_byte, &compression) ;
  246|       |
  247|     13|		psf->sf.samplerate = 1000000 / (256 - (rate_byte & 0xFF)) ;
  248|       |
  249|     13|		psf_log_printf (psf, " Sound Data : %d\n  sr   : %d => %dHz\n  comp : %d\n",
  250|     13|								size, rate_byte, psf->sf.samplerate, compression) ;
  251|       |
  252|     13|		if (offset + size - 1 > psf->filelength)
  ------------------
  |  Branch (252:7): [True: 2, False: 11]
  ------------------
  253|      2|		{	psf_log_printf (psf, "Seems to be a truncated file.\n") ;
  254|      2|			psf_log_printf (psf, "offset: %d    size: %d    sum: %d    filelength: %D\n", offset, size, offset + size, psf->filelength) ;
  255|      2|			return SFE_VOC_BAD_SECTIONS ;
  256|      2|			}
  257|     11|		else if (psf->filelength - offset - size > 4)
  ------------------
  |  Branch (257:12): [True: 4, False: 7]
  ------------------
  258|      4|		{	psf_log_printf (psf, "Seems to be a multi-segment file (#1).\n") ;
  259|      4|			psf_log_printf (psf, "offset: %d    size: %d    sum: %d    filelength: %D\n", offset, size, offset + size, psf->filelength) ;
  260|      4|			return SFE_VOC_BAD_SECTIONS ;
  261|      7|			} ;
  262|       |
  263|      7|		psf->dataoffset = offset ;
  264|      7|		psf->dataend	= psf->filelength - 1 ;
  265|       |
  266|      7|		psf->sf.channels = 1 ;
  267|      7|		psf->bytewidth = 1 ;
  268|       |
  269|      7|		psf->sf.format = SF_FORMAT_VOC | SF_FORMAT_PCM_U8 ;
  270|       |
  271|      7|		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: 92, False: 31]
  ------------------
  337|     92|	{	unsigned char bitwidth, channels ;
  338|     92|		int size, fourbytes ;
  339|       |
  340|     92|		offset += psf_binheader_readf (psf, "e341124", &size, &psf->sf.samplerate,
  341|     92|								&bitwidth, &channels, &encoding, &fourbytes) ;
  342|       |
  343|     92|		if (size * 2 == psf->filelength - 39)
  ------------------
  |  Branch (343:7): [True: 1, False: 91]
  ------------------
  344|      1|		{	int temp_size = psf->filelength - 31 ;
  345|       |
  346|      1|			psf_log_printf (psf, " Extended II : %d (SoX bug: should be %d)\n", size, temp_size) ;
  347|      1|			size = temp_size ;
  348|      1|			}
  349|     91|		else
  350|     91|			psf_log_printf (psf, " Extended II : %d\n", size) ;
  351|       |
  352|     92|		psf_log_printf (psf,	"  sample rate : %d\n"
  353|     92|								"  bit width   : %d\n"
  354|     92|								"  channels    : %d\n", psf->sf.samplerate, bitwidth, channels) ;
  355|       |
  356|     92|		if (bitwidth == 16 && encoding == 0)
  ------------------
  |  Branch (356:7): [True: 4, False: 88]
  |  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|     91|		else
  361|     91|			psf_log_printf (psf, "  encoding    : %d => %s\n", encoding, voc_encoding2str (encoding)) ;
  362|       |
  363|       |
  364|     92|		psf_log_printf (psf, "  fourbytes   : %X\n", fourbytes) ;
  365|       |
  366|     92|		psf->sf.channels = channels ;
  367|       |
  368|     92|		psf->dataoffset = offset ;
  369|     92|		psf->dataend	= psf->filelength - 1 ;
  370|       |
  371|     92|		if (size + 31 == psf->filelength + 1)
  ------------------
  |  Branch (371:7): [True: 3, False: 89]
  ------------------
  372|      3|		{	/* Hack for reading files produced using
  373|       |			** sf_command (SFC_UPDATE_HEADER_NOW).
  374|       |			*/
  375|      3|			psf_log_printf (psf, "Missing zero byte at end of file.\n") ;
  376|      3|			size = psf->filelength - 30 ;
  377|      3|			psf->dataend = 0 ;
  378|      3|			}
  379|     89|		else if (size + 31 > psf->filelength)
  ------------------
  |  Branch (379:12): [True: 54, False: 35]
  ------------------
  380|     54|		{	psf_log_printf (psf, "Seems to be a truncated file.\n") ;
  381|     54|			size = psf->filelength - 31 ;
  382|     54|			}
  383|     35|		else if (size + 31 < psf->filelength)
  ------------------
  |  Branch (383:12): [True: 33, False: 2]
  ------------------
  384|     33|			psf_log_printf (psf, "Seems to be a multi-segment file (#3).\n") ;
  385|       |
  386|     92|		switch (encoding)
  387|     92|		{	case 0 :
  ------------------
  |  Branch (387:5): [True: 45, False: 47]
  ------------------
  388|     45|					psf->sf.format = SF_FORMAT_VOC | SF_FORMAT_PCM_U8 ;
  389|     45|					psf->bytewidth = 1 ;
  390|     45|					break ;
  391|       |
  392|      2|			case 4 :
  ------------------
  |  Branch (392:4): [True: 2, False: 90]
  ------------------
  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: 90]
  ------------------
  398|      2|					psf->sf.format = SF_FORMAT_VOC | SF_FORMAT_ALAW ;
  399|      2|					psf->bytewidth = 1 ;
  400|      2|					break ;
  401|       |
  402|      3|			case 7 :
  ------------------
  |  Branch (402:4): [True: 3, False: 89]
  ------------------
  403|      3|					psf->sf.format = SF_FORMAT_VOC | SF_FORMAT_ULAW ;
  404|      3|					psf->bytewidth = 1 ;
  405|      3|					break ;
  406|       |
  407|     40|			default : /* Unknown */
  ------------------
  |  Branch (407:4): [True: 40, False: 52]
  ------------------
  408|     40|					return SFE_VOC_BAD_FORMAT ;
  409|      0|					break ;
  410|     92|			} ;
  411|       |
  412|     83|		} ;
  413|       |
  414|     83|	return 0 ;
  415|    123|} /* voc_read_header */
voc.c:voc_encoding2str:
  552|     91|{
  553|     91|	switch (encoding)
  554|     91|	{	case 0 :	return "8 bit unsigned PCM" ;
  ------------------
  |  Branch (554:4): [True: 45, False: 46]
  ------------------
  555|      1|		case 4 :	return "16 bit signed PCM" ;
  ------------------
  |  Branch (555:3): [True: 1, False: 90]
  ------------------
  556|      2|		case 6 :	return "A-law" ;
  ------------------
  |  Branch (556:3): [True: 2, False: 89]
  ------------------
  557|      3|		case 7 :	return "u-law" ;
  ------------------
  |  Branch (557:3): [True: 3, False: 88]
  ------------------
  558|     40|		default :	break ;
  ------------------
  |  Branch (558:3): [True: 40, False: 51]
  ------------------
  559|     91|		}
  560|     40|	return "*** Unknown ***" ;
  561|     91|} /* voc_encoding2str */
voc.c:voc_close:
  531|     91|{
  532|     91|	if (psf->file.mode == SFM_WRITE || psf->file.mode == SFM_RDWR)
  ------------------
  |  Branch (532:6): [True: 0, False: 91]
  |  Branch (532:37): [True: 0, False: 91]
  ------------------
  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|     91|	return 0 ;
  548|     91|} /* voc_close */

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

wav_open:
  163|  4.07k|{	WAVLIKE_PRIVATE * wpriv ;
  164|  4.07k|	int	format, subformat, error, blockalign = 0, framesperblock = 0 ;
  165|       |
  166|  4.07k|	if ((wpriv = calloc (1, sizeof (WAVLIKE_PRIVATE))) == NULL)
  ------------------
  |  Branch (166:6): [True: 0, False: 4.07k]
  ------------------
  167|      0|		return SFE_MALLOC_FAILED ;
  168|  4.07k|	psf->container_data = wpriv ;
  169|       |
  170|  4.07k|	wpriv->wavex_ambisonic = SF_AMBISONIC_NONE ;
  171|  4.07k|	psf->strings.flags = SF_STR_ALLOW_START | SF_STR_ALLOW_END ;
  172|       |
  173|  4.07k|	if (psf->file.mode == SFM_READ || (psf->file.mode == SFM_RDWR && psf->filelength > 0))
  ------------------
  |  Branch (173:6): [True: 4.07k, False: 0]
  |  Branch (173:37): [True: 0, False: 0]
  |  Branch (173:67): [True: 0, False: 0]
  ------------------
  174|  4.07k|	{	if ((error = wav_read_header (psf, &blockalign, &framesperblock)))
  ------------------
  |  Branch (174:8): [True: 3.12k, False: 950]
  ------------------
  175|  3.12k|			return error ;
  176|       |
  177|    950|		psf->next_chunk_iterator = wav_next_chunk_iterator ;
  178|    950|		psf->get_chunk_size = wav_get_chunk_size ;
  179|    950|		psf->get_chunk_data = wav_get_chunk_data ;
  180|    950|		} ;
  181|       |
  182|    950|	subformat = SF_CODEC (psf->sf.format) ;
  ------------------
  |  |  109|    950|#define SF_CODEC(x)			((x) & SF_FORMAT_SUBMASK)
  ------------------
  183|       |
  184|    950|	if (psf->file.mode == SFM_WRITE || psf->file.mode == SFM_RDWR)
  ------------------
  |  Branch (184:6): [True: 0, False: 950]
  |  Branch (184:37): [True: 0, False: 950]
  ------------------
  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|    950|		} ;
  235|       |
  236|    950|	psf->container_close = wav_close ;
  237|    950|	psf->command = wav_command ;
  238|       |
  239|    950|	switch (subformat)
  240|    950|	{	case SF_FORMAT_PCM_U8 :
  ------------------
  |  Branch (240:4): [True: 8, False: 942]
  ------------------
  241|     10|		case SF_FORMAT_PCM_16 :
  ------------------
  |  Branch (241:3): [True: 2, False: 948]
  ------------------
  242|     44|		case SF_FORMAT_PCM_24 :
  ------------------
  |  Branch (242:3): [True: 34, False: 916]
  ------------------
  243|     54|		case SF_FORMAT_PCM_32 :
  ------------------
  |  Branch (243:3): [True: 10, False: 940]
  ------------------
  244|     54|					error = pcm_init (psf) ;
  245|     54|					break ;
  246|       |
  247|      7|		case SF_FORMAT_ULAW :
  ------------------
  |  Branch (247:3): [True: 7, False: 943]
  ------------------
  248|      7|					error = ulaw_init (psf) ;
  249|      7|					break ;
  250|       |
  251|      8|		case SF_FORMAT_ALAW :
  ------------------
  |  Branch (251:3): [True: 8, False: 942]
  ------------------
  252|      8|					error = alaw_init (psf) ;
  253|      8|					break ;
  254|       |
  255|       |		/* Lite remove start */
  256|     30|		case SF_FORMAT_FLOAT :
  ------------------
  |  Branch (256:3): [True: 30, False: 920]
  ------------------
  257|     30|					error = float32_init (psf) ;
  258|     30|					break ;
  259|       |
  260|      4|		case SF_FORMAT_DOUBLE :
  ------------------
  |  Branch (260:3): [True: 4, False: 946]
  ------------------
  261|      4|					error = double64_init (psf) ;
  262|      4|					break ;
  263|       |
  264|    143|		case SF_FORMAT_IMA_ADPCM :
  ------------------
  |  Branch (264:3): [True: 143, False: 807]
  ------------------
  265|    143|					error = wavlike_ima_init (psf, blockalign, framesperblock) ;
  266|    143|					break ;
  267|       |
  268|    176|		case SF_FORMAT_MS_ADPCM :
  ------------------
  |  Branch (268:3): [True: 176, False: 774]
  ------------------
  269|    176|					error = wavlike_msadpcm_init (psf, blockalign, framesperblock) ;
  270|    176|					break ;
  271|       |
  272|     14|		case SF_FORMAT_G721_32 :
  ------------------
  |  Branch (272:3): [True: 14, False: 936]
  ------------------
  273|     14|					error = g72x_init (psf) ;
  274|     14|					break ;
  275|       |
  276|    167|		case SF_FORMAT_NMS_ADPCM_16 :
  ------------------
  |  Branch (276:3): [True: 167, False: 783]
  ------------------
  277|    193|		case SF_FORMAT_NMS_ADPCM_24 :
  ------------------
  |  Branch (277:3): [True: 26, False: 924]
  ------------------
  278|    213|		case SF_FORMAT_NMS_ADPCM_32 :
  ------------------
  |  Branch (278:3): [True: 20, False: 930]
  ------------------
  279|    213|					error = nms_adpcm_init (psf) ;
  280|    213|					break ;
  281|       |
  282|       |		/* Lite remove end */
  283|       |
  284|    276|		case SF_FORMAT_GSM610 :
  ------------------
  |  Branch (284:3): [True: 276, False: 674]
  ------------------
  285|    276|					error = gsm610_init (psf) ;
  286|    276|					break ;
  287|       |
  288|      2|		case SF_FORMAT_MPEG_LAYER_III :
  ------------------
  |  Branch (288:3): [True: 2, False: 948]
  ------------------
  289|      2|					error = mpeg_init (psf, SF_BITRATE_MODE_CONSTANT, SF_FALSE) ;
  290|      2|					break ;
  291|       |
  292|     23|		default : 	return SFE_UNIMPLEMENTED ;
  ------------------
  |  Branch (292:3): [True: 23, False: 927]
  ------------------
  293|    950|		} ;
  294|       |
  295|    927|	if (psf->file.mode == SFM_WRITE || (psf->file.mode == SFM_RDWR && psf->filelength == 0))
  ------------------
  |  Branch (295:6): [True: 0, False: 927]
  |  Branch (295:38): [True: 0, False: 927]
  |  Branch (295:68): [True: 0, False: 0]
  ------------------
  296|      0|		return psf->write_header (psf, SF_FALSE) ;
  297|       |
  298|    927|	return error ;
  299|    927|} /* wav_open */
wav.c:wav_read_header:
  307|  4.07k|{	WAVLIKE_PRIVATE	*wpriv ;
  308|  4.07k|	WAV_FMT		*wav_fmt ;
  309|  4.07k|	FACT_CHUNK	fact_chunk ;
  310|  4.07k|	uint32_t	marker, chunk_size = 0, RIFFsize = 0, done = 0 ;
  311|  4.07k|	int			parsestage = 0, error, format = 0 ;
  312|       |
  313|  4.07k|	if (psf->is_pipe == 0 && psf->filelength > 0xFFFFFFFFLL)
  ------------------
  |  Branch (313:6): [True: 4.07k, False: 0]
  |  Branch (313:27): [True: 0, False: 4.07k]
  ------------------
  314|      0|		psf_log_printf (psf, "Warning : filelength > 0xffffffff. This is bad!!!!\n") ;
  315|       |
  316|  4.07k|	if ((wpriv = psf->container_data) == NULL)
  ------------------
  |  Branch (316:6): [True: 0, False: 4.07k]
  ------------------
  317|      0|		return SFE_INTERNAL ;
  318|  4.07k|	wav_fmt = &wpriv->wav_fmt ;
  319|       |
  320|       |	/* Set position to start of file to begin reading header. */
  321|  4.07k|	psf_binheader_readf (psf, "pmj", 0, &marker, -4) ;
  322|  4.07k|	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.07k|	psf->rwf_endian = (marker == RIFF_MARKER) ? SF_ENDIAN_LITTLE : SF_ENDIAN_BIG ;
  ------------------
  |  |   38|  4.07k|#define RIFF_MARKER		(MAKE_MARKER ('R', 'I', 'F', 'F'))
  |  |  ------------------
  |  |  |  |  122|  4.07k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (328:20): [True: 3.86k, False: 203]
  ------------------
  329|       |
  330|  21.2k|	while (! done)
  ------------------
  |  Branch (330:9): [True: 21.2k, False: 29]
  ------------------
  331|  21.2k|	{	size_t jump = chunk_size & 1 ;
  332|       |
  333|  21.2k|		marker = chunk_size = 0 ;
  334|  21.2k|		psf_binheader_readf (psf, "jm4", jump, &marker, &chunk_size) ;
  335|  21.2k|		if (marker == 0)
  ------------------
  |  Branch (335:7): [True: 19, False: 21.2k]
  ------------------
  336|     19|		{	sf_count_t pos = psf_ftell (psf) ;
  337|     19|			psf_log_printf (psf, "Have 0 marker at position %D (0x%x).\n", pos, pos) ;
  338|     19|			break ;
  339|  21.2k|			} ;
  340|       |
  341|  21.2k|		psf_store_read_chunk_u32 (&psf->rchunks, marker, psf_ftell (psf), chunk_size) ;
  342|       |
  343|  21.2k|		switch (marker)
  344|  21.2k|		{	case RIFF_MARKER :
  ------------------
  |  |   38|  3.87k|#define RIFF_MARKER		(MAKE_MARKER ('R', 'I', 'F', 'F'))
  |  |  ------------------
  |  |  |  |  122|  3.87k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (344:5): [True: 3.87k, False: 17.3k]
  ------------------
  345|  4.07k|			case RIFX_MARKER :
  ------------------
  |  |   39|  4.07k|#define RIFX_MARKER		(MAKE_MARKER ('R', 'I', 'F', 'X'))
  |  |  ------------------
  |  |  |  |  122|  4.07k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (345:4): [True: 205, False: 21.0k]
  ------------------
  346|  4.07k|					if (parsestage)
  ------------------
  |  Branch (346:10): [True: 6, False: 4.07k]
  ------------------
  347|      6|						return SFE_WAV_NO_RIFF ;
  348|       |
  349|  4.07k|					parsestage |= HAVE_RIFF ;
  350|       |
  351|  4.07k|					RIFFsize = chunk_size ;
  352|       |
  353|  4.07k|					if (psf->fileoffset > 0 && psf->filelength > RIFFsize + 8)
  ------------------
  |  Branch (353:10): [True: 279, False: 3.79k]
  |  Branch (353:33): [True: 247, False: 32]
  ------------------
  354|    247|					{	/* Set file length. */
  355|    247|						psf->filelength = RIFFsize + 8 ;
  356|    247|						if (marker == RIFF_MARKER)
  ------------------
  |  |   38|    247|#define RIFF_MARKER		(MAKE_MARKER ('R', 'I', 'F', 'F'))
  |  |  ------------------
  |  |  |  |  122|    247|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (356:11): [True: 246, False: 1]
  ------------------
  357|    246|							psf_log_printf (psf, "RIFF : %u\n", RIFFsize) ;
  358|      1|						else
  359|      1|							psf_log_printf (psf, "RIFX : %u\n", RIFFsize) ;
  360|    247|						}
  361|  3.82k|					else if (psf->filelength < RIFFsize + 2 * SIGNED_SIZEOF (marker))
  ------------------
  |  |   91|  3.82k|#define		SIGNED_SIZEOF(x)	((int) sizeof (x))
  ------------------
  |  Branch (361:15): [True: 3.70k, False: 123]
  ------------------
  362|  3.70k|					{	if (marker == RIFF_MARKER)
  ------------------
  |  |   38|  3.70k|#define RIFF_MARKER		(MAKE_MARKER ('R', 'I', 'F', 'F'))
  |  |  ------------------
  |  |  |  |  122|  3.70k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (362:12): [True: 3.50k, False: 196]
  ------------------
  363|  3.50k|							psf_log_printf (psf, "RIFF : %u (should be %D)\n", RIFFsize, psf->filelength - 2 * SIGNED_SIZEOF (marker)) ;
  ------------------
  |  |   91|  3.50k|#define		SIGNED_SIZEOF(x)	((int) sizeof (x))
  ------------------
  364|    196|						else
  365|    196|							psf_log_printf (psf, "RIFX : %u (should be %D)\n", RIFFsize, psf->filelength - 2 * SIGNED_SIZEOF (marker)) ;
  ------------------
  |  |   91|    196|#define		SIGNED_SIZEOF(x)	((int) sizeof (x))
  ------------------
  366|       |
  367|  3.70k|						RIFFsize = psf->filelength - 2 * SIGNED_SIZEOF (RIFFsize) ;
  ------------------
  |  |   91|  3.70k|#define		SIGNED_SIZEOF(x)	((int) sizeof (x))
  ------------------
  368|  3.70k|						}
  369|    123|					else
  370|    123|					{	if (marker == RIFF_MARKER)
  ------------------
  |  |   38|    123|#define RIFF_MARKER		(MAKE_MARKER ('R', 'I', 'F', 'F'))
  |  |  ------------------
  |  |  |  |  122|    123|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (370:12): [True: 117, False: 6]
  ------------------
  371|    117|							psf_log_printf (psf, "RIFF : %u\n", RIFFsize) ;
  372|      6|						else
  373|      6|							psf_log_printf (psf, "RIFX : %u\n", RIFFsize) ;
  374|    123|					} ;
  375|       |
  376|  4.07k|					psf_binheader_readf (psf, "m", &marker) ;
  377|  4.07k|					if (marker != WAVE_MARKER)
  ------------------
  |  |   40|  4.07k|#define WAVE_MARKER		(MAKE_MARKER ('W', 'A', 'V', 'E'))
  |  |  ------------------
  |  |  |  |  122|  4.07k|	#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.07k]
  ------------------
  378|      0|						return SFE_WAV_NO_WAVE ;
  379|  4.07k|					parsestage |= HAVE_WAVE ;
  380|  4.07k|					psf_log_printf (psf, "WAVE\n") ;
  381|  4.07k|					chunk_size = 0 ;
  382|  4.07k|					break ;
  383|       |
  384|  1.63k|			case fmt_MARKER :
  ------------------
  |  |   41|  1.63k|#define fmt_MARKER		(MAKE_MARKER ('f', 'm', 't', ' '))
  |  |  ------------------
  |  |  |  |  122|  1.63k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (384:4): [True: 1.63k, False: 19.6k]
  ------------------
  385|  1.63k|					if ((parsestage & (HAVE_RIFF | HAVE_WAVE)) != (HAVE_RIFF | HAVE_WAVE))
  ------------------
  |  Branch (385:10): [True: 0, False: 1.63k]
  ------------------
  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.63k|					if (parsestage & HAVE_fmt)
  ------------------
  |  Branch (389:10): [True: 199, False: 1.43k]
  ------------------
  390|    199|						break ;
  391|       |
  392|  1.43k|					parsestage |= HAVE_fmt ;
  393|       |
  394|  1.43k|					psf_log_printf (psf, "fmt  : %d\n", chunk_size) ;
  395|       |
  396|  1.43k|					if ((error = wavlike_read_fmt_chunk (psf, chunk_size)))
  ------------------
  |  Branch (396:10): [True: 219, False: 1.21k]
  ------------------
  397|    219|						return error ;
  398|       |
  399|  1.21k|					format = wav_fmt->format ;
  400|  1.21k|					break ;
  401|       |
  402|  1.43k|			case data_MARKER :
  ------------------
  |  |   32|  1.43k|#define data_MARKER		MAKE_MARKER ('d', 'a', 't', 'a')
  |  |  ------------------
  |  |  |  |  122|  1.43k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (402:4): [True: 1.43k, False: 19.8k]
  ------------------
  403|  1.43k|					if ((parsestage & (HAVE_RIFF | HAVE_WAVE | HAVE_fmt)) != (HAVE_RIFF | HAVE_WAVE | HAVE_fmt))
  ------------------
  |  Branch (403:10): [True: 1, False: 1.43k]
  ------------------
  404|      1|						return SFE_WAV_NO_DATA ;
  405|       |
  406|  1.43k|					if (psf->file.mode == SFM_RDWR && (parsestage & HAVE_other) != 0)
  ------------------
  |  Branch (406:10): [True: 0, False: 1.43k]
  |  Branch (406:40): [True: 0, False: 0]
  ------------------
  407|      0|						return SFE_RDWR_BAD_HEADER ;
  408|       |
  409|  1.43k|					parsestage |= HAVE_data ;
  410|       |
  411|  1.43k|					psf->datalength = chunk_size ;
  412|  1.43k|					if (psf->datalength & 1)
  ------------------
  |  Branch (412:10): [True: 668, False: 766]
  ------------------
  413|    668|						psf_log_printf (psf, "*** 'data' chunk should be an even number of bytes in length.\n") ;
  414|       |
  415|  1.43k|					psf->dataoffset = psf_ftell (psf) ;
  416|       |
  417|  1.43k|					if (psf->dataoffset > 0)
  ------------------
  |  Branch (417:10): [True: 1.43k, False: 0]
  ------------------
  418|  1.43k|					{	if (chunk_size == 0 && RIFFsize == 8 && psf->filelength > 44)
  ------------------
  |  Branch (418:12): [True: 382, False: 1.05k]
  |  Branch (418:31): [True: 10, False: 372]
  |  Branch (418:48): [True: 5, False: 5]
  ------------------
  419|      5|						{	psf_log_printf (psf, "*** Looks like a WAV file which wasn't closed properly. Fixing it.\n") ;
  420|      5|							psf->datalength = psf->filelength - psf->dataoffset ;
  421|      5|							} ;
  422|       |
  423|  1.43k|						if (psf->datalength > psf->filelength - psf->dataoffset)
  ------------------
  |  Branch (423:11): [True: 884, False: 550]
  ------------------
  424|    884|						{	psf_log_printf (psf, "data : %D (should be %D)\n", psf->datalength, psf->filelength - psf->dataoffset) ;
  425|    884|							psf->datalength = psf->filelength - psf->dataoffset ;
  426|    884|							}
  427|    550|						else
  428|    550|							psf_log_printf (psf, "data : %D\n", psf->datalength) ;
  429|       |
  430|       |						/* Only set dataend if there really is data at the end. */
  431|  1.43k|						if (psf->datalength + psf->dataoffset < psf->filelength)
  ------------------
  |  Branch (431:11): [True: 493, False: 941]
  ------------------
  432|    493|							psf->dataend = psf->datalength + psf->dataoffset ;
  433|       |
  434|  1.43k|						psf->datalength += chunk_size & 1 ;
  435|  1.43k|						chunk_size = 0 ;
  436|  1.43k|						} ;
  437|       |
  438|  1.43k|					if (! psf->sf.seekable || psf->dataoffset < 0)
  ------------------
  |  Branch (438:10): [True: 0, False: 1.43k]
  |  Branch (438:32): [True: 0, False: 1.43k]
  ------------------
  439|      0|						break ;
  440|       |
  441|       |					/* Seek past data and continue reading header. */
  442|  1.43k|					psf_fseek (psf, psf->datalength, SEEK_CUR) ;
  443|       |
  444|  1.43k|					if (psf_ftell (psf) != psf->datalength + psf->dataoffset)
  ------------------
  |  Branch (444:10): [True: 569, False: 865]
  ------------------
  445|    569|						psf_log_printf (psf, "*** psf_fseek past end error ***\n") ;
  446|  1.43k|					break ;
  447|       |
  448|    959|			case fact_MARKER :
  ------------------
  |  |   42|    959|#define fact_MARKER		(MAKE_MARKER ('f', 'a', 'c', 't'))
  |  |  ------------------
  |  |  |  |  122|    959|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (448:4): [True: 959, False: 20.2k]
  ------------------
  449|    959|					if ((parsestage & (HAVE_RIFF | HAVE_WAVE)) != (HAVE_RIFF | HAVE_WAVE))
  ------------------
  |  Branch (449:10): [True: 0, False: 959]
  ------------------
  450|      0|						return SFE_WAV_BAD_FACT ;
  451|       |
  452|    959|					parsestage |= HAVE_fact ;
  453|       |
  454|    959|					if ((parsestage & HAVE_fmt) != HAVE_fmt)
  ------------------
  |  Branch (454:10): [True: 441, False: 518]
  ------------------
  455|    441|						psf_log_printf (psf, "*** Should have 'fmt ' chunk before 'fact'\n") ;
  456|       |
  457|    959|					psf_binheader_readf (psf, "4", & (fact_chunk.frames)) ;
  458|       |
  459|    959|					if (chunk_size > SIGNED_SIZEOF (fact_chunk))
  ------------------
  |  |   91|    959|#define		SIGNED_SIZEOF(x)	((int) sizeof (x))
  ------------------
  |  Branch (459:10): [True: 106, False: 853]
  ------------------
  460|    106|						psf_binheader_readf (psf, "j", (int) (chunk_size - SIGNED_SIZEOF (fact_chunk))) ;
  ------------------
  |  |   91|    106|#define		SIGNED_SIZEOF(x)	((int) sizeof (x))
  ------------------
  461|       |
  462|    959|					if (chunk_size)
  ------------------
  |  Branch (462:10): [True: 592, False: 367]
  ------------------
  463|    592|						psf_log_printf (psf, "%M : %u\n", marker, chunk_size) ;
  464|    367|					else
  465|    367|						psf_log_printf (psf, "%M : %u (should not be zero)\n", marker, chunk_size) ;
  466|       |
  467|    959|					psf_log_printf (psf, "  frames  : %d\n", fact_chunk.frames) ;
  468|    959|					break ;
  469|       |
  470|    334|			case PEAK_MARKER :
  ------------------
  |  |   40|    334|#define PEAK_MARKER		MAKE_MARKER ('P', 'E', 'A', 'K')
  |  |  ------------------
  |  |  |  |  122|    334|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (470:4): [True: 334, False: 20.9k]
  ------------------
  471|    334|					if ((parsestage & (HAVE_RIFF | HAVE_WAVE | HAVE_fmt)) != (HAVE_RIFF | HAVE_WAVE | HAVE_fmt))
  ------------------
  |  Branch (471:10): [True: 1, False: 333]
  ------------------
  472|      1|						return SFE_WAV_PEAK_B4_FMT ;
  473|       |
  474|    333|					parsestage |= HAVE_PEAK ;
  475|       |
  476|    333|					psf_log_printf (psf, "%M : %u\n", marker, chunk_size) ;
  477|    333|					if ((error = wavlike_read_peak_chunk (psf, chunk_size)) != 0)
  ------------------
  |  Branch (477:10): [True: 27, False: 306]
  ------------------
  478|     27|						return error ;
  479|    306|					psf->peak_info->peak_loc = ((parsestage & HAVE_data) == 0) ? SF_PEAK_START : SF_PEAK_END ;
  ------------------
  |  Branch (479:33): [True: 76, False: 230]
  ------------------
  480|    306|					break ;
  481|       |
  482|    898|			case cue_MARKER :
  ------------------
  |  |   44|    898|#define cue_MARKER		(MAKE_MARKER ('c', 'u', 'e', ' '))
  |  |  ------------------
  |  |  |  |  122|    898|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (482:4): [True: 898, False: 20.3k]
  ------------------
  483|    898|					parsestage |= HAVE_other ;
  484|       |
  485|    898|					{	uint32_t thisread, bytesread, cue_count, position, offset ;
  486|    898|						int id, chunk_id, chunk_start, block_start, cue_index ;
  487|       |
  488|    898|						bytesread = psf_binheader_readf (psf, "4", &cue_count) ;
  489|    898|						psf_log_printf (psf, "%M : %u\n", marker, chunk_size) ;
  490|       |
  491|    898|						if (cue_count > 2500) /* 2500 is close to the largest number of cues possible because of block sizes */
  ------------------
  |  Branch (491:11): [True: 240, False: 658]
  ------------------
  492|    240|						{	psf_log_printf (psf, "  Count : %u (skipping)\n", cue_count) ;
  493|    240|							psf_binheader_readf (psf, "j", chunk_size - bytesread) ;
  494|    240|							break ;
  495|    658|							} ;
  496|       |
  497|    658|						psf_log_printf (psf, "  Count : %d\n", cue_count) ;
  498|       |
  499|    658|						if (psf->cues)
  ------------------
  |  Branch (499:11): [True: 506, False: 152]
  ------------------
  500|    506|						{	free (psf->cues) ;
  501|    506|							psf->cues = NULL ;
  502|    506|							} ;
  503|       |
  504|    658|						if ((psf->cues = psf_cues_alloc (cue_count)) == NULL)
  ------------------
  |  Branch (504:11): [True: 0, False: 658]
  ------------------
  505|      0|							return SFE_MALLOC_FAILED ;
  506|       |
  507|    658|						cue_index = 0 ;
  508|       |
  509|  4.67k|						while (cue_count)
  ------------------
  |  Branch (509:14): [True: 4.07k, False: 606]
  ------------------
  510|  4.07k|						{
  511|  4.07k|							if ((thisread = psf_binheader_readf (psf, "e44m444", &id, &position, &chunk_id, &chunk_start, &block_start, &offset)) == 0)
  ------------------
  |  Branch (511:12): [True: 52, False: 4.01k]
  ------------------
  512|     52|								break ;
  513|  4.01k|							bytesread += thisread ;
  514|       |
  515|  4.01k|							if (cue_index < 10) /* avoid swamping log buffer with cues */
  ------------------
  |  Branch (515:12): [True: 2.57k, False: 1.44k]
  ------------------
  516|  2.57k|								psf_log_printf (psf,	"   Cue ID : %2d"
  517|  2.57k|											"  Pos : %5u  Chunk : %M"
  518|  2.57k|											"  Chk Start : %d  Blk Start : %d"
  519|  2.57k|											"  Offset : %5d\n",
  520|  2.57k|										id, position, chunk_id, chunk_start, block_start, offset) ;
  521|  1.44k|							else if (cue_index == 10)
  ------------------
  |  Branch (521:17): [True: 175, False: 1.26k]
  ------------------
  522|    175|								psf_log_printf (psf,	"   (Skipping)\n") ;
  523|       |
  524|  4.01k|							psf->cues->cue_points [cue_index].indx = id ;
  525|  4.01k|							psf->cues->cue_points [cue_index].position = position ;
  526|  4.01k|							psf->cues->cue_points [cue_index].fcc_chunk = chunk_id ;
  527|  4.01k|							psf->cues->cue_points [cue_index].chunk_start = chunk_start ;
  528|  4.01k|							psf->cues->cue_points [cue_index].block_start = block_start ;
  529|  4.01k|							psf->cues->cue_points [cue_index].sample_offset = offset ;
  530|  4.01k|							psf->cues->cue_points [cue_index].name [0] = '\0' ;
  531|  4.01k|							cue_count -- ;
  532|  4.01k|							cue_index ++ ;
  533|  4.01k|							} ;
  534|       |
  535|    658|						if (bytesread != chunk_size)
  ------------------
  |  Branch (535:11): [True: 446, False: 212]
  ------------------
  536|    446|						{	psf_log_printf (psf, "**** Chunk size weirdness (%d != %d)\n", chunk_size, bytesread) ;
  537|    446|							psf_binheader_readf (psf, "j", chunk_size - bytesread) ;
  538|    446|							} ;
  539|    658|						} ;
  540|    658|					break ;
  541|       |
  542|  1.71k|			case smpl_MARKER :
  ------------------
  |  |   48|  1.71k|#define smpl_MARKER		(MAKE_MARKER ('s', 'm', 'p', 'l'))
  |  |  ------------------
  |  |  |  |  122|  1.71k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (542:4): [True: 1.71k, False: 19.5k]
  ------------------
  543|  1.71k|					parsestage |= HAVE_other ;
  544|       |
  545|  1.71k|					psf_log_printf (psf, "smpl : %u\n", chunk_size) ;
  546|       |
  547|  1.71k|					if ((error = wav_read_smpl_chunk (psf, chunk_size)))
  ------------------
  |  Branch (547:10): [True: 0, False: 1.71k]
  ------------------
  548|      0|						return error ;
  549|  1.71k|					break ;
  550|       |
  551|  1.87k|			case acid_MARKER :
  ------------------
  |  |   52|  1.87k|#define acid_MARKER		(MAKE_MARKER ('a', 'c', 'i', 'd'))
  |  |  ------------------
  |  |  |  |  122|  1.87k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (551:4): [True: 1.87k, False: 19.3k]
  ------------------
  552|  1.87k|					parsestage |= HAVE_other ;
  553|       |
  554|  1.87k|					psf_log_printf (psf, "acid : %u\n", chunk_size) ;
  555|       |
  556|  1.87k|					if ((error = wav_read_acid_chunk (psf, chunk_size)))
  ------------------
  |  Branch (556:10): [True: 0, False: 1.87k]
  ------------------
  557|      0|						return error ;
  558|  1.87k|					break ;
  559|       |
  560|  1.87k|			case INFO_MARKER :
  ------------------
  |  |   37|  1.05k|#define INFO_MARKER		MAKE_MARKER ('I', 'N', 'F', 'O')
  |  |  ------------------
  |  |  |  |  122|  1.05k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (560:4): [True: 1.05k, False: 20.1k]
  ------------------
  561|  1.15k|			case LIST_MARKER :
  ------------------
  |  |   38|  1.15k|#define LIST_MARKER		MAKE_MARKER ('L', 'I', 'S', 'T')
  |  |  ------------------
  |  |  |  |  122|  1.15k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (561:4): [True: 99, False: 21.1k]
  ------------------
  562|  1.15k|					parsestage |= HAVE_other ;
  563|       |
  564|  1.15k|					if ((error = wavlike_subchunk_parse (psf, marker, chunk_size)) != 0)
  ------------------
  |  Branch (564:10): [True: 0, False: 1.15k]
  ------------------
  565|      0|						return error ;
  566|  1.15k|					break ;
  567|       |
  568|  1.15k|			case bext_MARKER :
  ------------------
  |  |   30|    387|#define bext_MARKER		MAKE_MARKER ('b', 'e', 'x', 't')
  |  |  ------------------
  |  |  |  |  122|    387|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (568:4): [True: 387, False: 20.8k]
  ------------------
  569|       |					/*
  570|       |					The 'bext' chunk can actually be updated, so don't need to set this.
  571|       |					parsestage |= HAVE_other ;
  572|       |					*/
  573|    387|					if ((error = wavlike_read_bext_chunk (psf, chunk_size)))
  ------------------
  |  Branch (573:10): [True: 0, False: 387]
  ------------------
  574|      0|						return error ;
  575|    387|					break ;
  576|       |
  577|    387|			case PAD_MARKER :
  ------------------
  |  |   39|    235|#define PAD_MARKER		MAKE_MARKER ('P', 'A', 'D', ' ')
  |  |  ------------------
  |  |  |  |  122|    235|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (577:4): [True: 235, False: 21.0k]
  ------------------
  578|       |					/*
  579|       |					We can eat into a 'PAD ' chunk if we need to.
  580|       |					parsestage |= HAVE_other ;
  581|       |					*/
  582|    235|					psf_log_printf (psf, "%M : %u\n", marker, chunk_size) ;
  583|    235|					psf_binheader_readf (psf, "j", chunk_size) ;
  584|    235|					break ;
  585|       |
  586|    335|			case cart_MARKER:
  ------------------
  |  |   31|    335|#define cart_MARKER		MAKE_MARKER ('c', 'a', 'r', 't')
  |  |  ------------------
  |  |  |  |  122|    335|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (586:4): [True: 335, False: 20.9k]
  ------------------
  587|    335|					if ((error = wavlike_read_cart_chunk (psf, chunk_size)))
  ------------------
  |  Branch (587:10): [True: 0, False: 335]
  ------------------
  588|      0|						return error ;
  589|    335|					break ;
  590|       |
  591|    335|			case iXML_MARKER : /* See http://en.wikipedia.org/wiki/IXML */
  ------------------
  |  |   49|    188|#define iXML_MARKER		(MAKE_MARKER ('i', 'X', 'M', 'L'))
  |  |  ------------------
  |  |  |  |  122|    188|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (591:4): [True: 188, False: 21.0k]
  ------------------
  592|    393|			case strc_MARKER : /* Multiple of 32 bytes. */
  ------------------
  |  |   53|    393|#define strc_MARKER		(MAKE_MARKER ('s', 't', 'r', 'c'))
  |  |  ------------------
  |  |  |  |  122|    393|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (592:4): [True: 205, False: 21.0k]
  ------------------
  593|    607|			case afsp_MARKER :
  ------------------
  |  |   54|    607|#define afsp_MARKER		(MAKE_MARKER ('a', 'f', 's', 'p'))
  |  |  ------------------
  |  |  |  |  122|    607|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (593:4): [True: 214, False: 21.0k]
  ------------------
  594|    679|			case clm_MARKER :
  ------------------
  |  |   55|    679|#define clm_MARKER		(MAKE_MARKER ('c', 'l', 'm', ' '))
  |  |  ------------------
  |  |  |  |  122|    679|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (594:4): [True: 72, False: 21.1k]
  ------------------
  595|    880|			case elmo_MARKER :
  ------------------
  |  |   56|    880|#define elmo_MARKER		(MAKE_MARKER ('e', 'l', 'm', 'o'))
  |  |  ------------------
  |  |  |  |  122|    880|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (595:4): [True: 201, False: 21.0k]
  ------------------
  596|  1.01k|			case levl_MARKER :
  ------------------
  |  |   50|  1.01k|#define levl_MARKER		(MAKE_MARKER ('l', 'e', 'v', 'l'))
  |  |  ------------------
  |  |  |  |  122|  1.01k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (596:4): [True: 134, False: 21.1k]
  ------------------
  597|  1.14k|			case plst_MARKER :
  ------------------
  |  |   47|  1.14k|#define plst_MARKER		(MAKE_MARKER ('p', 'l', 's', 't'))
  |  |  ------------------
  |  |  |  |  122|  1.14k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (597:4): [True: 130, False: 21.1k]
  ------------------
  598|  1.36k|			case minf_MARKER :
  ------------------
  |  |   59|  1.36k|#define minf_MARKER		(MAKE_MARKER ('m', 'i', 'n', 'f'))
  |  |  ------------------
  |  |  |  |  122|  1.36k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (598:4): [True: 223, False: 21.0k]
  ------------------
  599|  1.40k|			case elm1_MARKER :
  ------------------
  |  |   60|  1.40k|#define elm1_MARKER		(MAKE_MARKER ('e', 'l', 'm', '1'))
  |  |  ------------------
  |  |  |  |  122|  1.40k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (599:4): [True: 34, False: 21.2k]
  ------------------
  600|  1.68k|			case regn_MARKER :
  ------------------
  |  |   61|  1.68k|#define regn_MARKER		(MAKE_MARKER ('r', 'e', 'g', 'n'))
  |  |  ------------------
  |  |  |  |  122|  1.68k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (600:4): [True: 279, False: 20.9k]
  ------------------
  601|  1.87k|			case ovwf_MARKER :
  ------------------
  |  |   62|  1.87k|#define ovwf_MARKER		(MAKE_MARKER ('o', 'v', 'w', 'f'))
  |  |  ------------------
  |  |  |  |  122|  1.87k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (601:4): [True: 195, False: 21.0k]
  ------------------
  602|  1.91k|			case inst_MARKER :
  ------------------
  |  |   68|  1.91k|#define inst_MARKER		(MAKE_MARKER ('i', 'n', 's', 't'))
  |  |  ------------------
  |  |  |  |  122|  1.91k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (602:4): [True: 36, False: 21.2k]
  ------------------
  603|  1.96k|			case AFAn_MARKER :
  ------------------
  |  |   69|  1.96k|#define AFAn_MARKER		(MAKE_MARKER ('A', 'F', 'A', 'n'))
  |  |  ------------------
  |  |  |  |  122|  1.96k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (603:4): [True: 54, False: 21.1k]
  ------------------
  604|  2.03k|			case umid_MARKER :
  ------------------
  |  |   63|  2.03k|#define umid_MARKER		(MAKE_MARKER ('u', 'm', 'i', 'd'))
  |  |  ------------------
  |  |  |  |  122|  2.03k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (604:4): [True: 70, False: 21.1k]
  ------------------
  605|  2.24k|			case SyLp_MARKER :
  ------------------
  |  |   64|  2.24k|#define SyLp_MARKER		(MAKE_MARKER ('S', 'y', 'L', 'p'))
  |  |  ------------------
  |  |  |  |  122|  2.24k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (605:4): [True: 214, False: 21.0k]
  ------------------
  606|  2.31k|			case Cr8r_MARKER :
  ------------------
  |  |   65|  2.31k|#define Cr8r_MARKER		(MAKE_MARKER ('C', 'r', '8', 'r'))
  |  |  ------------------
  |  |  |  |  122|  2.31k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (606:4): [True: 63, False: 21.1k]
  ------------------
  607|  2.62k|			case JUNK_MARKER :
  ------------------
  |  |   66|  2.62k|#define JUNK_MARKER		(MAKE_MARKER ('J', 'U', 'N', 'K'))
  |  |  ------------------
  |  |  |  |  122|  2.62k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (607:4): [True: 310, False: 20.9k]
  ------------------
  608|  2.81k|			case PMX_MARKER :
  ------------------
  |  |   67|  2.81k|#define PMX_MARKER		(MAKE_MARKER ('_', 'P', 'M', 'X'))
  |  |  ------------------
  |  |  |  |  122|  2.81k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (608:4): [True: 195, False: 21.0k]
  ------------------
  609|  2.89k|			case DISP_MARKER :
  ------------------
  |  |   36|  2.89k|#define DISP_MARKER		MAKE_MARKER ('D', 'I', 'S', 'P')
  |  |  ------------------
  |  |  |  |  122|  2.89k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (609:4): [True: 81, False: 21.1k]
  ------------------
  610|  2.96k|			case MEXT_MARKER :
  ------------------
  |  |   51|  2.96k|#define MEXT_MARKER		(MAKE_MARKER ('M', 'E', 'X', 'T'))
  |  |  ------------------
  |  |  |  |  122|  2.96k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (610:4): [True: 70, False: 21.1k]
  ------------------
  611|  3.19k|			case FLLR_MARKER :
  ------------------
  |  |   57|  3.19k|#define FLLR_MARKER		(MAKE_MARKER ('F', 'L', 'L', 'R'))
  |  |  ------------------
  |  |  |  |  122|  3.19k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (611:4): [True: 222, False: 21.0k]
  ------------------
  612|  3.19k|					psf_log_printf (psf, "%M : %u\n", marker, chunk_size) ;
  613|  3.19k|					psf_binheader_readf (psf, "j", chunk_size) ;
  614|  3.19k|					break ;
  615|       |
  616|  3.03k|			default :
  ------------------
  |  Branch (616:4): [True: 3.03k, False: 18.2k]
  ------------------
  617|  3.03k|					if (chunk_size >= 0xffff0000)
  ------------------
  |  Branch (617:10): [True: 21, False: 3.01k]
  ------------------
  618|     21|					{	done = SF_TRUE ;
  619|     21|						psf_log_printf (psf, "*** Unknown chunk marker (%X) at position %D with length %u. Exiting parser.\n", marker, psf_ftell (psf) - 8, chunk_size) ;
  620|     21|						break ;
  621|  3.01k|						} ;
  622|       |
  623|  3.01k|					if ((marker & TAG__MARKER_MASK) == TAG__MARKER &&
  ------------------
  |  |   78|  3.01k|#define TAG__MARKER_MASK (MAKE_MARKER (0xff, 0xff, 0xff, 0))
  |  |  ------------------
  |  |  |  |  122|  3.01k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
              					if ((marker & TAG__MARKER_MASK) == TAG__MARKER &&
  ------------------
  |  |   77|  6.02k|#define TAG__MARKER (MAKE_MARKER ('T', 'A', 'G', 0))
  |  |  ------------------
  |  |  |  |  122|  3.01k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (623:10): [True: 198, False: 2.81k]
  ------------------
  624|    198|						psf_ftell (psf) - 8 + 128 == psf->filelength)
  ------------------
  |  Branch (624:7): [True: 1, False: 197]
  ------------------
  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.01k|						} ;
  631|       |
  632|  3.01k|					if (psf_isprint ((marker >> 24) & 0xFF) && psf_isprint ((marker >> 16) & 0xFF)
  ------------------
  |  Branch (632:10): [True: 2.64k, False: 361]
  |  Branch (632:49): [True: 2.19k, False: 450]
  ------------------
  633|  2.19k|						&& psf_isprint ((marker >> 8) & 0xFF) && psf_isprint (marker & 0xFF))
  ------------------
  |  Branch (633:10): [True: 1.65k, False: 548]
  |  Branch (633:48): [True: 1.37k, False: 281]
  ------------------
  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|  1.64k|						} ;
  638|  1.64k|					if (psf_ftell (psf) & 0x03)
  ------------------
  |  Branch (638:10): [True: 1.39k, False: 242]
  ------------------
  639|  1.39k|					{	psf_log_printf (psf, "  Unknown chunk marker at position %D. Resynching.\n", psf_ftell (psf) - 8) ;
  640|  1.39k|						psf_binheader_readf (psf, "j", -3) ;
  641|       |						/* File is too messed up so we prevent editing in RDWR mode here. */
  642|  1.39k|						parsestage |= HAVE_other ;
  643|  1.39k|						break ;
  644|  1.39k|						} ;
  645|    242|					psf_log_printf (psf, "*** Unknown chunk marker (%X) at position %D. Exiting parser.\n", marker, psf_ftell (psf) - 8) ;
  646|    242|					done = SF_TRUE ;
  647|    242|					break ;
  648|  21.2k|			} ;	/* switch (marker) */
  649|       |
  650|  20.9k|		if (chunk_size >= psf->filelength)
  ------------------
  |  Branch (650:7): [True: 1.81k, False: 19.1k]
  ------------------
  651|  1.81k|		{	psf_log_printf (psf, "*** Chunk size %u > file length %D. Exiting parser.\n", chunk_size, psf->filelength) ;
  652|  1.81k|			break ;
  653|  19.1k|			} ;
  654|       |
  655|  19.1k|		if (! psf->sf.seekable && (parsestage & HAVE_data))
  ------------------
  |  Branch (655:7): [True: 0, False: 19.1k]
  |  Branch (655:29): [True: 0, False: 0]
  ------------------
  656|      0|			break ;
  657|       |
  658|  19.1k|		if (psf_ftell (psf) >= psf->filelength - SIGNED_SIZEOF (chunk_size))
  ------------------
  |  |   91|  19.1k|#define		SIGNED_SIZEOF(x)	((int) sizeof (x))
  ------------------
  |  Branch (658:7): [True: 1.94k, False: 17.2k]
  ------------------
  659|  1.94k|		{	psf_log_printf (psf, "End\n") ;
  660|  1.94k|			break ;
  661|  17.2k|			} ;
  662|  17.2k|		} ; /* while (1) */
  663|       |
  664|  3.81k|	if (psf->dataoffset <= 0)
  ------------------
  |  Branch (664:6): [True: 2.81k, False: 997]
  ------------------
  665|  2.81k|		return SFE_WAV_NO_DATA ;
  666|       |
  667|    997|	if (psf->sf.channels < 1)
  ------------------
  |  Branch (667:6): [True: 7, False: 990]
  ------------------
  668|      7|		return SFE_CHANNEL_COUNT_ZERO ;
  669|       |
  670|    990|	if (psf->sf.channels > SF_MAX_CHANNELS)
  ------------------
  |  |  102|    990|#define		SF_MAX_CHANNELS		1024
  ------------------
  |  Branch (670:6): [True: 37, False: 953]
  ------------------
  671|     37|		return SFE_CHANNEL_COUNT ;
  672|       |
  673|    953|	if (format != WAVE_FORMAT_PCM && (parsestage & HAVE_fact) == 0)
  ------------------
  |  Branch (673:6): [True: 871, False: 82]
  |  Branch (673:35): [True: 869, False: 2]
  ------------------
  674|    869|		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|    953|	psf->endian = psf->rwf_endian ;
  678|       |
  679|    953|	psf_fseek (psf, psf->dataoffset, SEEK_SET) ;
  680|       |
  681|    953|	if (psf->is_pipe == 0)
  ------------------
  |  Branch (681:6): [True: 953, False: 0]
  ------------------
  682|    953|	{	/*
  683|       |		** Check for 'wvpk' at the start of the DATA section. Not able to
  684|       |		** handle this.
  685|       |		*/
  686|    953|		psf_binheader_readf (psf, "4", &marker) ;
  687|    953|		if (marker == wvpk_MARKER || marker == OggS_MARKER)
  ------------------
  |  |   73|  1.90k|#define wvpk_MARKER (MAKE_MARKER ('w', 'v', 'p', 'k'))
  |  |  ------------------
  |  |  |  |  122|    953|	#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|    952|#define OggS_MARKER (MAKE_MARKER ('O', 'g', 'g', 'S'))
  |  |  ------------------
  |  |  |  |  122|    952|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (687:7): [True: 1, False: 952]
  |  Branch (687:32): [True: 1, False: 951]
  ------------------
  688|      2|			return SFE_WAV_WVPK_DATA ;
  689|    953|		} ;
  690|       |
  691|       |	/* Seek to start of DATA section. */
  692|    951|	psf_fseek (psf, psf->dataoffset, SEEK_SET) ;
  693|       |
  694|    951|	if (psf->blockwidth)
  ------------------
  |  Branch (694:6): [True: 116, False: 835]
  ------------------
  695|    116|	{	if (psf->filelength - psf->dataoffset < psf->datalength)
  ------------------
  |  Branch (695:8): [True: 45, False: 71]
  ------------------
  696|     45|			psf->sf.frames = (psf->filelength - psf->dataoffset) / psf->blockwidth ;
  697|     71|		else
  698|     71|			psf->sf.frames = psf->datalength / psf->blockwidth ;
  699|    116|		} ;
  700|       |
  701|    951|	switch (format)
  702|    951|	{	case WAVE_FORMAT_EXTENSIBLE :
  ------------------
  |  Branch (702:4): [True: 10, False: 941]
  ------------------
  703|     10|			if (psf->sf.format == (SF_FORMAT_WAVEX | SF_FORMAT_MS_ADPCM))
  ------------------
  |  Branch (703:8): [True: 8, False: 2]
  ------------------
  704|      8|			{	*blockalign = wav_fmt->msadpcm.blockalign ;
  705|      8|				*framesperblock = wav_fmt->msadpcm.samplesperblock ;
  706|      8|				} ;
  707|     10|			break ;
  708|       |
  709|    214|		case WAVE_FORMAT_NMS_VBXADPCM :
  ------------------
  |  Branch (709:3): [True: 214, False: 737]
  ------------------
  710|    214|			switch (wav_fmt->min.bitwidth)
  711|    214|			{	case 2 :
  ------------------
  |  Branch (711:6): [True: 167, False: 47]
  ------------------
  712|    167|					psf->sf.format = SF_FORMAT_WAV | SF_FORMAT_NMS_ADPCM_16 ;
  713|    167|					break ;
  714|     26|				case 3 :
  ------------------
  |  Branch (714:5): [True: 26, False: 188]
  ------------------
  715|     26|					psf->sf.format = SF_FORMAT_WAV | SF_FORMAT_NMS_ADPCM_24 ;
  716|     26|					break ;
  717|     20|				case 4 :
  ------------------
  |  Branch (717:5): [True: 20, False: 194]
  ------------------
  718|     20|					psf->sf.format = SF_FORMAT_WAV | SF_FORMAT_NMS_ADPCM_32 ;
  719|     20|					break ;
  720|       |
  721|      1|				default :
  ------------------
  |  Branch (721:5): [True: 1, False: 213]
  ------------------
  722|      1|					return SFE_UNIMPLEMENTED ;
  723|    214|				}
  724|    213|				break ;
  725|       |
  726|    213|		case WAVE_FORMAT_PCM :
  ------------------
  |  Branch (726:3): [True: 80, False: 871]
  ------------------
  727|     80|					psf->sf.format = SF_FORMAT_WAV | u_bitwidth_to_subformat (psf->bytewidth * 8) ;
  728|     80|					break ;
  729|       |
  730|      7|		case WAVE_FORMAT_MULAW :
  ------------------
  |  Branch (730:3): [True: 7, False: 944]
  ------------------
  731|      7|		case IBM_FORMAT_MULAW :
  ------------------
  |  Branch (731:3): [True: 0, False: 951]
  ------------------
  732|      7|					psf->sf.format = (SF_FORMAT_WAV | SF_FORMAT_ULAW) ;
  733|      7|					break ;
  734|       |
  735|      8|		case WAVE_FORMAT_ALAW :
  ------------------
  |  Branch (735:3): [True: 8, False: 943]
  ------------------
  736|      8|		case IBM_FORMAT_ALAW :
  ------------------
  |  Branch (736:3): [True: 0, False: 951]
  ------------------
  737|      8|					psf->sf.format = (SF_FORMAT_WAV | SF_FORMAT_ALAW) ;
  738|      8|					break ;
  739|       |
  740|    168|		case WAVE_FORMAT_MS_ADPCM :
  ------------------
  |  Branch (740:3): [True: 168, False: 783]
  ------------------
  741|    168|					psf->sf.format = (SF_FORMAT_WAV | SF_FORMAT_MS_ADPCM) ;
  742|    168|					*blockalign = wav_fmt->msadpcm.blockalign ;
  743|    168|					*framesperblock = wav_fmt->msadpcm.samplesperblock ;
  744|    168|					break ;
  745|       |
  746|    143|		case WAVE_FORMAT_IMA_ADPCM :
  ------------------
  |  Branch (746:3): [True: 143, False: 808]
  ------------------
  747|    143|					psf->sf.format = (SF_FORMAT_WAV | SF_FORMAT_IMA_ADPCM) ;
  748|    143|					*blockalign = wav_fmt->ima.blockalign ;
  749|    143|					*framesperblock = wav_fmt->ima.samplesperblock ;
  750|    143|					break ;
  751|       |
  752|    276|		case WAVE_FORMAT_GSM610 :
  ------------------
  |  Branch (752:3): [True: 276, False: 675]
  ------------------
  753|    276|					psf->sf.format = (SF_FORMAT_WAV | SF_FORMAT_GSM610) ;
  754|    276|					break ;
  755|       |
  756|     29|		case WAVE_FORMAT_IEEE_FLOAT :
  ------------------
  |  Branch (756:3): [True: 29, False: 922]
  ------------------
  757|     29|					psf->sf.format = SF_FORMAT_WAV ;
  758|     29|					psf->sf.format |= (psf->bytewidth == 8) ? SF_FORMAT_DOUBLE : SF_FORMAT_FLOAT ;
  ------------------
  |  Branch (758:24): [True: 4, False: 25]
  ------------------
  759|     29|					break ;
  760|       |
  761|     14|		case WAVE_FORMAT_G721_ADPCM :
  ------------------
  |  Branch (761:3): [True: 14, False: 937]
  ------------------
  762|     14|					psf->sf.format = SF_FORMAT_WAV | SF_FORMAT_G721_32 ;
  763|     14|					break ;
  764|       |
  765|      2|		case WAVE_FORMAT_MPEGLAYER3 :
  ------------------
  |  Branch (765:3): [True: 2, False: 949]
  ------------------
  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: 951]
  ------------------
  772|    951|		} ;
  773|       |
  774|    950|	if (wpriv->fmt_is_broken)
  ------------------
  |  Branch (774:6): [True: 36, False: 914]
  ------------------
  775|     36|		wavlike_analyze (psf) ;
  776|       |
  777|       |	/* Only set the format endian-ness if its non-standard big-endian. */
  778|    950|	if (psf->endian == SF_ENDIAN_BIG)
  ------------------
  |  Branch (778:6): [True: 0, False: 950]
  ------------------
  779|      0|		psf->sf.format |= SF_ENDIAN_BIG ;
  780|       |
  781|    950|	return 0 ;
  782|    951|} /* wav_read_header */
wav.c:wav_read_smpl_chunk:
 1377|  1.71k|{	char buffer [512] ;
 1378|  1.71k|	uint32_t thisread, bytesread = 0, dword, sampler_data, loop_count, actually_loop_count = 0 ;
 1379|  1.71k|	uint32_t note, pitch, start, end, type = -1, count ;
 1380|  1.71k|	int j, k ;
 1381|       |
 1382|  1.71k|	chunklen += (chunklen & 1) ;
 1383|       |
 1384|  1.71k|	bytesread += psf_binheader_readf (psf, "4", &dword) ;
 1385|  1.71k|	psf_log_printf (psf, "  Manufacturer : %X\n", dword) ;
 1386|       |
 1387|  1.71k|	bytesread += psf_binheader_readf (psf, "4", &dword) ;
 1388|  1.71k|	psf_log_printf (psf, "  Product      : %u\n", dword) ;
 1389|       |
 1390|  1.71k|	bytesread += psf_binheader_readf (psf, "4", &dword) ;
 1391|  1.71k|	psf_log_printf (psf, "  Period       : %u nsec\n", dword) ;
 1392|       |
 1393|  1.71k|	bytesread += psf_binheader_readf (psf, "4", &note) ;
 1394|  1.71k|	psf_log_printf (psf, "  Midi Note    : %u\n", note) ;
 1395|       |
 1396|  1.71k|	bytesread += psf_binheader_readf (psf, "4", &pitch) ;
 1397|  1.71k|	if (pitch != 0)
  ------------------
  |  Branch (1397:6): [True: 1.13k, False: 582]
  ------------------
 1398|  1.13k|	{	snprintf (buffer, sizeof (buffer), "%f",
 1399|  1.13k|					(1.0 * 0x80000000) / ((uint32_t) pitch)) ;
 1400|  1.13k|		psf_log_printf (psf, "  Pitch Fract. : %s\n", buffer) ;
 1401|  1.13k|		}
 1402|    582|	else
 1403|    582|		psf_log_printf (psf, "  Pitch Fract. : 0\n") ;
 1404|       |
 1405|  1.71k|	bytesread += psf_binheader_readf (psf, "4", &dword) ;
 1406|  1.71k|	psf_log_printf (psf, "  SMPTE Format : %u\n", dword) ;
 1407|       |
 1408|  1.71k|	bytesread += psf_binheader_readf (psf, "4", &dword) ;
 1409|  1.71k|	snprintf (buffer, sizeof (buffer), "%02"PRIu32 ":%02"PRIu32 ":%02"PRIu32
 1410|  1.71k|				" %02"PRIu32 "", (dword >> 24) & 0x7F, (dword >> 16) & 0x7F,
 1411|  1.71k|				(dword >> 8) & 0x7F, dword & 0x7F) ;
 1412|  1.71k|	psf_log_printf (psf, "  SMPTE Offset : %s\n", buffer) ;
 1413|       |
 1414|  1.71k|	bytesread += psf_binheader_readf (psf, "4", &loop_count) ;
 1415|  1.71k|	psf_log_printf (psf, "  Loop Count   : %u\n", loop_count) ;
 1416|       |
 1417|  1.71k|	if (loop_count == 0 && chunklen == bytesread)
  ------------------
  |  Branch (1417:6): [True: 777, False: 935]
  |  Branch (1417:25): [True: 365, False: 412]
  ------------------
 1418|    365|		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.05k, False: 288]
  ------------------
 1426|  1.05k|	{	psf_log_printf (psf, "  Found more than one SMPL chunk, using last one.\n") ;
 1427|  1.05k|		free (psf->instrument) ;
 1428|  1.05k|		psf->instrument = NULL ;
 1429|  1.05k|		} ;
 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.60k|	for (j = 0 ; loop_count > 0 && chunklen - bytesread >= 24 ; j ++)
  ------------------
  |  Branch (1435:15): [True: 6.19k, False: 412]
  |  Branch (1435:33): [True: 5.38k, False: 811]
  ------------------
 1436|  5.38k|	{	if ((thisread = psf_binheader_readf (psf, "4", &dword)) == 0)
  ------------------
  |  Branch (1436:8): [True: 124, False: 5.26k]
  ------------------
 1437|    124|			break ;
 1438|  5.26k|		bytesread += thisread ;
 1439|  5.26k|		psf_log_printf (psf, "    Cue ID : %2u", dword) ;
 1440|       |
 1441|  5.26k|		bytesread += psf_binheader_readf (psf, "4", &type) ;
 1442|  5.26k|		psf_log_printf (psf, "  Type : %2u", type) ;
 1443|       |
 1444|  5.26k|		bytesread += psf_binheader_readf (psf, "4", &start) ;
 1445|  5.26k|		psf_log_printf (psf, "  Start : %5u", start) ;
 1446|       |
 1447|  5.26k|		bytesread += psf_binheader_readf (psf, "4", &end) ;
 1448|  5.26k|		psf_log_printf (psf, "  End : %5u", end) ;
 1449|       |
 1450|  5.26k|		bytesread += psf_binheader_readf (psf, "4", &dword) ;
 1451|  5.26k|		psf_log_printf (psf, "  Fraction : %5u", dword) ;
 1452|       |
 1453|  5.26k|		bytesread += psf_binheader_readf (psf, "4", &count) ;
 1454|  5.26k|		psf_log_printf (psf, "  Count : %5u\n", count) ;
 1455|       |
 1456|  5.26k|		if (j < ARRAY_LEN (psf->instrument->loops))
  ------------------
  |  |   93|  5.26k|#define		ARRAY_LEN(x)	((int) (sizeof (x) / sizeof ((x) [0])))
  ------------------
  |  Branch (1456:7): [True: 4.62k, False: 634]
  ------------------
 1457|  4.62k|		{	psf->instrument->loops [j].start = start ;
 1458|  4.62k|			psf->instrument->loops [j].end = end + 1 ;
 1459|  4.62k|			psf->instrument->loops [j].count = count ;
 1460|       |
 1461|  4.62k|			switch (type)
 1462|  4.62k|			{	case 0 :
  ------------------
  |  Branch (1462:6): [True: 1.63k, False: 2.98k]
  ------------------
 1463|  1.63k|					psf->instrument->loops [j].mode = SF_LOOP_FORWARD ;
 1464|  1.63k|					break ;
 1465|    260|				case 1 :
  ------------------
  |  Branch (1465:5): [True: 260, False: 4.36k]
  ------------------
 1466|    260|					psf->instrument->loops [j].mode = SF_LOOP_ALTERNATING ;
 1467|    260|					break ;
 1468|      3|				case 2 :
  ------------------
  |  Branch (1468:5): [True: 3, False: 4.62k]
  ------------------
 1469|      3|					psf->instrument->loops [j].mode = SF_LOOP_BACKWARD ;
 1470|      3|					break ;
 1471|  2.72k|				default:
  ------------------
  |  Branch (1471:5): [True: 2.72k, False: 1.90k]
  ------------------
 1472|  2.72k|					psf->instrument->loops [j].mode = SF_LOOP_NONE ;
 1473|  2.72k|					break ;
 1474|  4.62k|				} ;
 1475|  5.26k|			} ;
 1476|  5.26k|		actually_loop_count ++ ;
 1477|  5.26k|		} ;
 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: 273, False: 1.07k]
  ------------------
 1480|    273|	{
 1481|    273|		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|    273|#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|    273|#define		ARRAY_LEN(x)	((int) (sizeof (x) / sizeof ((x) [0])))
  ------------------
 1482|    273|		psf->instrument->loop_count = ARRAY_LEN (psf->instrument->loops) ;
  ------------------
  |  |   93|    273|#define		ARRAY_LEN(x)	((int) (sizeof (x) / sizeof ((x) [0])))
  ------------------
 1483|    273|		}
 1484|  1.07k|	else if (loop_count != actually_loop_count)
  ------------------
  |  Branch (1484:11): [True: 661, False: 413]
  ------------------
 1485|    661|	{	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|    661|		psf->instrument->loop_count = actually_loop_count ;
 1487|    661|		} ;
 1488|       |
 1489|  1.34k|	if (chunklen - bytesread == 0)
  ------------------
  |  Branch (1489:6): [True: 501, False: 846]
  ------------------
 1490|    501|	{	if (sampler_data != 0)
  ------------------
  |  Branch (1490:8): [True: 414, False: 87]
  ------------------
 1491|    414|			psf_log_printf (psf, "  Sampler Data : %u (should be 0)\n", sampler_data) ;
 1492|     87|		else
 1493|     87|			psf_log_printf (psf, "  Sampler Data : %u\n", sampler_data) ;
 1494|    501|		}
 1495|    846|	else
 1496|    846|	{	if (sampler_data != chunklen - bytesread)
  ------------------
  |  Branch (1496:8): [True: 732, False: 114]
  ------------------
 1497|    732|		{	psf_log_printf (psf, "  Sampler Data : %u (should have been %u)\n", sampler_data, chunklen - bytesread) ;
 1498|    732|			sampler_data = chunklen - bytesread ;
 1499|    732|			}
 1500|    114|		else
 1501|    114|			psf_log_printf (psf, "  Sampler Data : %u\n", sampler_data) ;
 1502|       |
 1503|    846|		psf_log_printf (psf, "      ") ;
 1504|  9.98k|		for (k = 0 ; k < (int) sampler_data ; k++)
  ------------------
  |  Branch (1504:16): [True: 9.29k, False: 692]
  ------------------
 1505|  9.29k|		{	char ch ;
 1506|       |
 1507|  9.29k|			if (k > 0 && (k % 20) == 0)
  ------------------
  |  Branch (1507:8): [True: 8.74k, False: 550]
  |  Branch (1507:17): [True: 226, False: 8.52k]
  ------------------
 1508|    226|				psf_log_printf (psf, "\n      ") ;
 1509|       |
 1510|  9.29k|			if ((thisread = psf_binheader_readf (psf, "1", &ch)) == 0)
  ------------------
  |  Branch (1510:8): [True: 154, False: 9.14k]
  ------------------
 1511|    154|				break ;
 1512|  9.14k|			bytesread += thisread ;
 1513|  9.14k|			psf_log_printf (psf, "%02X ", ch & 0xFF) ;
 1514|  9.14k|			} ;
 1515|       |
 1516|    846|		psf_log_printf (psf, "\n") ;
 1517|    846|		} ;
 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.87k|{	char buffer [512] ;
 1562|  1.87k|	uint32_t bytesread = 0 ;
 1563|  1.87k|	int	beats, flags ;
 1564|  1.87k|	short rootnote, q1, meter_denom, meter_numer ;
 1565|  1.87k|	float q2, tempo ;
 1566|       |
 1567|  1.87k|	chunklen += (chunklen & 1) ;
 1568|       |
 1569|  1.87k|	bytesread += psf_binheader_readf (psf, "422f", &flags, &rootnote, &q1, &q2) ;
 1570|       |
 1571|  1.87k|	snprintf (buffer, sizeof (buffer), "%f", q2) ;
 1572|       |
 1573|  1.87k|	psf_log_printf (psf, "  Flags     : 0x%04x (%s,%s,%s,%s,%s)\n", flags,
 1574|  1.87k|			(flags & 0x01) ? "OneShot" : "Loop",
  ------------------
  |  Branch (1574:4): [True: 1.68k, False: 194]
  ------------------
 1575|  1.87k|			(flags & 0x02) ? "RootNoteValid" : "RootNoteInvalid",
  ------------------
  |  Branch (1575:4): [True: 384, False: 1.49k]
  ------------------
 1576|  1.87k|			(flags & 0x04) ? "StretchOn" : "StretchOff",
  ------------------
  |  Branch (1576:4): [True: 328, False: 1.54k]
  ------------------
 1577|  1.87k|			(flags & 0x08) ? "DiskBased" : "RAMBased",
  ------------------
  |  Branch (1577:4): [True: 172, False: 1.70k]
  ------------------
 1578|  1.87k|			(flags & 0x10) ? "??On" : "??Off") ;
  ------------------
  |  Branch (1578:4): [True: 178, False: 1.69k]
  ------------------
 1579|       |
 1580|  1.87k|	psf_log_printf (psf, "  Root note : 0x%x\n  ????      : 0x%04x\n  ????      : %s\n",
 1581|  1.87k|				rootnote, q1, buffer) ;
 1582|       |
 1583|  1.87k|	bytesread += psf_binheader_readf (psf, "422f", &beats, &meter_denom, &meter_numer, &tempo) ;
 1584|  1.87k|	snprintf (buffer, sizeof (buffer), "%f", tempo) ;
 1585|  1.87k|	psf_log_printf (psf, "  Beats     : %d\n  Meter     : %d/%d\n  Tempo     : %s\n",
 1586|  1.87k|				beats, meter_numer, meter_denom, buffer) ;
 1587|       |
 1588|  1.87k|	psf_binheader_readf (psf, "j", chunklen - bytesread) ;
 1589|       |
 1590|  1.87k|	if (psf->loop_info)
  ------------------
  |  Branch (1590:6): [True: 1.80k, False: 67]
  ------------------
 1591|  1.80k|	{	psf_log_printf (psf, "  Found existing loop info, using last one.\n") ;
 1592|  1.80k|		free (psf->loop_info) ;
 1593|  1.80k|		psf->loop_info = NULL ;
 1594|  1.80k|		} ;
 1595|  1.87k|	if ((psf->loop_info = calloc (1, sizeof (SF_LOOP_INFO))) == NULL)
  ------------------
  |  Branch (1595:6): [True: 0, False: 1.87k]
  ------------------
 1596|      0|		return SFE_MALLOC_FAILED ;
 1597|       |
 1598|  1.87k|	psf->loop_info->time_sig_num	= meter_numer ;
 1599|  1.87k|	psf->loop_info->time_sig_den	= meter_denom ;
 1600|  1.87k|	psf->loop_info->loop_mode		= (flags & 0x01) ? SF_LOOP_NONE : SF_LOOP_FORWARD ;
  ------------------
  |  Branch (1600:31): [True: 1.68k, False: 194]
  ------------------
 1601|  1.87k|	psf->loop_info->num_beats		= beats ;
 1602|  1.87k|	psf->loop_info->bpm				= tempo ;
 1603|  1.87k|	psf->loop_info->root_key		= (flags & 0x02) ? rootnote : -1 ;
  ------------------
  |  Branch (1603:30): [True: 384, False: 1.49k]
  ------------------
 1604|       |
 1605|  1.87k|	return 0 ;
 1606|  1.87k|} /* wav_read_acid_chunk */
wav.c:wav_close:
 1318|    950|{
 1319|    950|	if (psf->file.mode == SFM_WRITE || psf->file.mode == SFM_RDWR)
  ------------------
  |  Branch (1319:6): [True: 0, False: 950]
  |  Branch (1319:37): [True: 0, False: 950]
  ------------------
 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|    950|	return 0 ;
 1340|    950|} /* wav_close */

wavlike_read_fmt_chunk:
  125|   121k|{	WAVLIKE_PRIVATE * wpriv ;
  126|   121k|	WAV_FMT *wav_fmt ;
  127|   121k|	int	bytesread, k, bytespersec = 0 ;
  128|       |
  129|   121k|	if ((wpriv = psf->container_data) == NULL)
  ------------------
  |  Branch (129:6): [True: 0, False: 121k]
  ------------------
  130|      0|		return SFE_INTERNAL ;
  131|   121k|	wav_fmt = &wpriv->wav_fmt ;
  132|       |
  133|   121k|	memset (wav_fmt, 0, sizeof (WAV_FMT)) ;
  134|       |
  135|   121k|	if (fmtsize < 16)
  ------------------
  |  Branch (135:6): [True: 52, False: 121k]
  ------------------
  136|     52|		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|   121k|	bytesread = psf_binheader_readf (psf, "224422",
  142|   121k|					&(wav_fmt->format), &(wav_fmt->min.channels),
  143|   121k|					&(wav_fmt->min.samplerate), &(wav_fmt->min.bytespersec),
  144|   121k|					&(wav_fmt->min.blockalign), &(wav_fmt->min.bitwidth)) ;
  145|       |
  146|   121k|	psf_log_printf (psf, "  Format        : 0x%X => %s\n", wav_fmt->format, wavlike_format_str (wav_fmt->format)) ;
  147|   121k|	psf_log_printf (psf, "  Channels      : %d\n", wav_fmt->min.channels) ;
  148|   121k|	psf_log_printf (psf, "  Sample Rate   : %d\n", wav_fmt->min.samplerate) ;
  149|       |
  150|   121k|	if (wav_fmt->format == WAVE_FORMAT_PCM && wav_fmt->min.blockalign == 0
  ------------------
  |  Branch (150:6): [True: 13.4k, False: 107k]
  |  Branch (150:44): [True: 8.29k, False: 5.11k]
  ------------------
  151|  8.29k|		&& wav_fmt->min.bitwidth > 0 && wav_fmt->min.channels > 0)
  ------------------
  |  Branch (151:6): [True: 5.17k, False: 3.12k]
  |  Branch (151:35): [True: 2.36k, False: 2.80k]
  ------------------
  152|  2.36k|	{	wav_fmt->min.blockalign = wav_fmt->min.bitwidth / 8 + (wav_fmt->min.bitwidth % 8 > 0 ? 1 : 0) ;
  ------------------
  |  Branch (152:59): [True: 1.48k, False: 880]
  ------------------
  153|  2.36k|		wav_fmt->min.blockalign *= wav_fmt->min.channels ;
  154|  2.36k|		psf_log_printf (psf, "  Block Align   : 0 (should be %d)\n", wav_fmt->min.blockalign) ;
  155|  2.36k|		}
  156|   118k|	else
  157|   118k|		psf_log_printf (psf, "  Block Align   : %d\n", wav_fmt->min.blockalign) ;
  158|       |
  159|   121k|	if (wav_fmt->format == WAVE_FORMAT_PCM && wav_fmt->min.bitwidth == 24 &&
  ------------------
  |  Branch (159:6): [True: 13.4k, False: 107k]
  |  Branch (159:44): [True: 4.02k, False: 9.37k]
  ------------------
  160|  4.02k|			wav_fmt->min.blockalign == 4 * wav_fmt->min.channels)
  ------------------
  |  Branch (160:4): [True: 1.66k, False: 2.35k]
  ------------------
  161|  1.66k|	{	psf_log_printf (psf, "  Bit Width     : 24\n") ;
  162|       |
  163|  1.66k|		psf_log_printf (psf, "\n"
  164|  1.66k|			"  Ambiguous information in 'fmt ' chunk. Possible file types:\n"
  165|  1.66k|			"    0) Invalid IEEE float file generated by Syntrillium's Cooledit!\n"
  166|  1.66k|			"    1) File generated by ALSA's arecord containing 24 bit samples in 32 bit containers.\n"
  167|  1.66k|			"    2) 24 bit file with incorrect Block Align value.\n"
  168|  1.66k|			"\n") ;
  169|       |
  170|  1.66k|		wpriv->fmt_is_broken = 1 ;
  171|  1.66k|		}
  172|   119k|	else if (wav_fmt->min.bitwidth == 0)
  ------------------
  |  Branch (172:11): [True: 22.6k, False: 96.9k]
  ------------------
  173|  22.6k|	{	switch (wav_fmt->format)
  174|  22.6k|		{	case WAVE_FORMAT_GSM610 :
  ------------------
  |  Branch (174:5): [True: 2.84k, False: 19.7k]
  ------------------
  175|  2.84k|			case WAVE_FORMAT_IPP_ITU_G_723_1 :
  ------------------
  |  Branch (175:4): [True: 1, False: 22.6k]
  ------------------
  176|  6.24k|			case WAVE_FORMAT_MPEGLAYER3 :
  ------------------
  |  Branch (176:4): [True: 3.39k, False: 19.2k]
  ------------------
  177|  6.24k|					psf_log_printf (psf, "  Bit Width     : %d\n", wav_fmt->min.bitwidth) ;
  178|  6.24k|					break ;
  179|  16.3k|			default :
  ------------------
  |  Branch (179:4): [True: 16.3k, False: 6.24k]
  ------------------
  180|  16.3k|					psf_log_printf (psf, "  Bit Width     : %d (should not be 0)\n", wav_fmt->min.bitwidth) ;
  181|  22.6k|			}
  182|  22.6k|		}
  183|  96.9k|	else
  184|  96.9k|	{	switch (wav_fmt->format)
  185|  96.9k|		{	case WAVE_FORMAT_GSM610 :
  ------------------
  |  Branch (185:5): [True: 4.66k, False: 92.2k]
  ------------------
  186|  4.66k|			case WAVE_FORMAT_IPP_ITU_G_723_1 :
  ------------------
  |  Branch (186:4): [True: 1, False: 96.9k]
  ------------------
  187|  10.0k|			case WAVE_FORMAT_MPEGLAYER3 :
  ------------------
  |  Branch (187:4): [True: 5.38k, False: 91.5k]
  ------------------
  188|  10.0k|					psf_log_printf (psf, "  Bit Width     : %d (should be 0)\n", wav_fmt->min.bitwidth) ;
  189|  10.0k|					break ;
  190|  86.9k|			default :
  ------------------
  |  Branch (190:4): [True: 86.9k, False: 10.0k]
  ------------------
  191|  86.9k|					psf_log_printf (psf, "  Bit Width     : %d\n", wav_fmt->min.bitwidth) ;
  192|  96.9k|			}
  193|   121k|		} ;
  194|       |
  195|   121k|	psf->sf.samplerate	= wav_fmt->min.samplerate ;
  196|   121k|	psf->sf.frames 		= 0 ;					/* Correct this when reading data chunk. */
  197|   121k|	psf->sf.channels	= wav_fmt->min.channels ;
  198|       |
  199|   121k|	switch (wav_fmt->format)
  200|   121k|	{	case WAVE_FORMAT_PCM :
  ------------------
  |  Branch (200:4): [True: 13.4k, False: 107k]
  ------------------
  201|  18.1k|		case WAVE_FORMAT_IEEE_FLOAT :
  ------------------
  |  Branch (201:3): [True: 4.73k, False: 116k]
  ------------------
  202|  18.1k|				bytespersec = wav_fmt->min.samplerate * wav_fmt->min.blockalign ;
  203|  18.1k|				if (wav_fmt->min.bytespersec != (unsigned) bytespersec)
  ------------------
  |  Branch (203:9): [True: 15.0k, False: 3.07k]
  ------------------
  204|  15.0k|					psf_log_printf (psf, "  Bytes/sec     : %d (should be %d)\n", wav_fmt->min.bytespersec, bytespersec) ;
  205|  3.07k|				else
  206|  3.07k|					psf_log_printf (psf, "  Bytes/sec     : %d\n", wav_fmt->min.bytespersec) ;
  207|       |
  208|  18.1k|				psf->bytewidth = BITWIDTH2BYTES (wav_fmt->min.bitwidth) ;
  ------------------
  |  |   85|  18.1k|#define	BITWIDTH2BYTES(x)	(((x) + 7) / 8)
  ------------------
  209|  18.1k|				break ;
  210|       |
  211|  9.27k|		case WAVE_FORMAT_ALAW :
  ------------------
  |  Branch (211:3): [True: 9.27k, False: 111k]
  ------------------
  212|  13.8k|		case WAVE_FORMAT_MULAW :
  ------------------
  |  Branch (212:3): [True: 4.61k, False: 116k]
  ------------------
  213|  13.8k|				if (wav_fmt->min.bytespersec != wav_fmt->min.samplerate * wav_fmt->min.blockalign)
  ------------------
  |  Branch (213:9): [True: 10.7k, False: 3.12k]
  ------------------
  214|  10.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|  3.12k|				else
  216|  3.12k|					psf_log_printf (psf, "  Bytes/sec     : %d\n", wav_fmt->min.bytespersec) ;
  217|       |
  218|  13.8k|				psf->bytewidth = 1 ;
  219|  13.8k|				if (fmtsize >= 18)
  ------------------
  |  Branch (219:9): [True: 10.0k, False: 3.87k]
  ------------------
  220|  10.0k|				{	bytesread += psf_binheader_readf (psf, "2", &(wav_fmt->size20.extrabytes)) ;
  221|  10.0k|					psf_log_printf (psf, "  Extra Bytes   : %d\n", wav_fmt->size20.extrabytes) ;
  222|  10.0k|					} ;
  223|  13.8k|				break ;
  224|       |
  225|  5.57k|		case WAVE_FORMAT_IMA_ADPCM :
  ------------------
  |  Branch (225:3): [True: 5.57k, False: 115k]
  ------------------
  226|  5.57k|				if (wav_fmt->min.bitwidth != 4)
  ------------------
  |  Branch (226:9): [True: 16, False: 5.56k]
  ------------------
  227|     16|					return SFE_WAV_ADPCM_NOT4BIT ;
  228|  5.56k|				if (wav_fmt->min.channels < 1 || wav_fmt->min.channels > 2)
  ------------------
  |  Branch (228:9): [True: 1, False: 5.56k]
  |  Branch (228:38): [True: 6, False: 5.55k]
  ------------------
  229|      7|					return SFE_WAV_ADPCM_CHANNELS ;
  230|       |
  231|  5.55k|				bytesread += psf_binheader_readf (psf, "22", &(wav_fmt->ima.extrabytes), &(wav_fmt->ima.samplesperblock)) ;
  232|  5.55k|				psf_log_printf (psf, "  Extra Bytes   : %d\n", wav_fmt->ima.extrabytes) ;
  233|  5.55k|				if (wav_fmt->ima.samplesperblock < 1)
  ------------------
  |  Branch (233:9): [True: 2, False: 5.55k]
  ------------------
  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|  5.55k|				else
  238|  5.55k|					psf_log_printf (psf, "  Samples/Block : %d\n", wav_fmt->ima.samplesperblock) ;
  239|       |
  240|  5.55k|				bytespersec = (wav_fmt->ima.samplerate * wav_fmt->ima.blockalign) / wav_fmt->ima.samplesperblock ;
  241|  5.55k|				if (wav_fmt->ima.bytespersec != (unsigned) bytespersec)
  ------------------
  |  Branch (241:9): [True: 3.19k, False: 2.35k]
  ------------------
  242|  3.19k|					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|  5.55k|				break ;
  247|       |
  248|  12.8k|		case WAVE_FORMAT_MS_ADPCM :
  ------------------
  |  Branch (248:3): [True: 12.8k, False: 108k]
  ------------------
  249|  12.8k|				if (wav_fmt->msadpcm.bitwidth != 4)
  ------------------
  |  Branch (249:9): [True: 23, False: 12.8k]
  ------------------
  250|     23|					return SFE_WAV_ADPCM_NOT4BIT ;
  251|  12.8k|				if (wav_fmt->msadpcm.channels < 1 || wav_fmt->msadpcm.channels > 2)
  ------------------
  |  Branch (251:9): [True: 1, False: 12.8k]
  |  Branch (251:42): [True: 3, False: 12.8k]
  ------------------
  252|      4|					return SFE_WAV_ADPCM_CHANNELS ;
  253|       |
  254|  12.8k|				bytesread += psf_binheader_readf (psf, "222", &(wav_fmt->msadpcm.extrabytes),
  255|  12.8k|								&(wav_fmt->msadpcm.samplesperblock), &(wav_fmt->msadpcm.numcoeffs)) ;
  256|       |
  257|  12.8k|				psf_log_printf (psf, "  Extra Bytes   : %d\n", wav_fmt->msadpcm.extrabytes) ;
  258|  12.8k|				if (wav_fmt->ima.samplesperblock < 1)
  ------------------
  |  Branch (258:9): [True: 1, False: 12.8k]
  ------------------
  259|      1|				{	psf_log_printf (psf, "  Samples/Block : %d (should be > 0)\n", wav_fmt->ima.samplesperblock) ;
  260|      1|					return SFE_WAV_ADPCM_SAMPLES ;
  261|      1|					}
  262|  12.8k|				else
  263|  12.8k|					psf_log_printf (psf, "  Samples/Block : %d\n", wav_fmt->ima.samplesperblock) ;
  264|       |
  265|  12.8k|				bytespersec = (wav_fmt->min.samplerate * wav_fmt->min.blockalign) / wav_fmt->msadpcm.samplesperblock ;
  266|  12.8k|				if (wav_fmt->min.bytespersec == (unsigned) bytespersec)
  ------------------
  |  Branch (266:9): [True: 4.03k, False: 8.78k]
  ------------------
  267|  4.03k|					psf_log_printf (psf, "  Bytes/sec     : %d\n", wav_fmt->min.bytespersec) ;
  268|  8.78k|				else if (wav_fmt->min.bytespersec == (wav_fmt->min.samplerate / wav_fmt->msadpcm.samplesperblock) * wav_fmt->min.blockalign)
  ------------------
  |  Branch (268:14): [True: 3.50k, False: 5.27k]
  ------------------
  269|  3.50k|					psf_log_printf (psf, "  Bytes/sec     : %d (should be %d (MS BUG!))\n", wav_fmt->min.bytespersec, bytespersec) ;
  270|  5.27k|				else
  271|  5.27k|					psf_log_printf (psf, "  Bytes/sec     : %d (should be %d)\n", wav_fmt->min.bytespersec, bytespersec) ;
  272|       |
  273|  12.8k|				if (wav_fmt->msadpcm.numcoeffs > ARRAY_LEN (wav_fmt->msadpcm.coeffs))
  ------------------
  |  |   93|  12.8k|#define		ARRAY_LEN(x)	((int) (sizeof (x) / sizeof ((x) [0])))
  ------------------
  |  Branch (273:9): [True: 4.30k, False: 8.50k]
  ------------------
  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|  8.50k|				else
  278|  8.50k|					psf_log_printf (psf, "  No. of Coeffs : %d\n", wav_fmt->msadpcm.numcoeffs) ;
  279|       |
  280|  12.8k|				psf_log_printf (psf, "    Index   Coeffs1   Coeffs2\n") ;
  281|  44.0k|				for (k = 0 ; k < wav_fmt->msadpcm.numcoeffs ; k++)
  ------------------
  |  Branch (281:18): [True: 31.2k, False: 12.8k]
  ------------------
  282|  31.2k|				{	char buffer [128] ;
  283|       |
  284|  31.2k|					bytesread +=
  285|  31.2k|						psf_binheader_readf (psf, "22", &(wav_fmt->msadpcm.coeffs [k].coeff1), &(wav_fmt->msadpcm.coeffs [k].coeff2)) ;
  286|  31.2k|					snprintf (buffer, sizeof (buffer), "     %2d     %7d   %7d\n", k, wav_fmt->msadpcm.coeffs [k].coeff1, wav_fmt->msadpcm.coeffs [k].coeff2) ;
  287|  31.2k|					psf_log_printf (psf, buffer) ;
  288|  31.2k|					} ;
  289|  12.8k|				break ;
  290|       |
  291|  7.50k|		case WAVE_FORMAT_GSM610 :
  ------------------
  |  Branch (291:3): [True: 7.50k, False: 113k]
  ------------------
  292|  7.50k|				if (wav_fmt->gsm610.channels != 1 || wav_fmt->gsm610.blockalign != 65)
  ------------------
  |  Branch (292:9): [True: 3, False: 7.50k]
  |  Branch (292:42): [True: 6, False: 7.49k]
  ------------------
  293|      9|					return SFE_WAV_GSM610_FORMAT ;
  294|       |
  295|  7.49k|				bytesread +=
  296|  7.49k|				psf_binheader_readf (psf, "22", &(wav_fmt->gsm610.extrabytes), &(wav_fmt->gsm610.samplesperblock)) ;
  297|       |
  298|  7.49k|				if (wav_fmt->gsm610.samplesperblock != 320)
  ------------------
  |  Branch (298:9): [True: 3, False: 7.49k]
  ------------------
  299|      3|					return SFE_WAV_GSM610_FORMAT ;
  300|       |
  301|  7.49k|				bytespersec = (wav_fmt->gsm610.samplerate * wav_fmt->gsm610.blockalign) / wav_fmt->gsm610.samplesperblock ;
  302|  7.49k|				if (wav_fmt->gsm610.bytespersec != (unsigned) bytespersec)
  ------------------
  |  Branch (302:9): [True: 4.83k, False: 2.66k]
  ------------------
  303|  4.83k|					psf_log_printf (psf, "  Bytes/sec     : %d (should be %d)\n", wav_fmt->gsm610.bytespersec, bytespersec) ;
  304|  2.66k|				else
  305|  2.66k|					psf_log_printf (psf, "  Bytes/sec     : %d\n", wav_fmt->gsm610.bytespersec) ;
  306|       |
  307|  7.49k|				psf_log_printf (psf, "  Extra Bytes   : %d\n", wav_fmt->gsm610.extrabytes) ;
  308|  7.49k|				psf_log_printf (psf, "  Samples/Block : %d\n", wav_fmt->gsm610.samplesperblock) ;
  309|  7.49k|				break ;
  310|       |
  311|  8.78k|		case WAVE_FORMAT_MPEGLAYER3 :
  ------------------
  |  Branch (311:3): [True: 8.78k, False: 112k]
  ------------------
  312|  8.78k|				bytesread += psf_binheader_readf (psf, "24222", &(wav_fmt->mpeg3.extrabytes),
  313|  8.78k|					&(wav_fmt->mpeg3.id), &(wav_fmt->mpeg3.flags), &(wav_fmt->mpeg3.blocksize),
  314|  8.78k|					&(wav_fmt->mpeg3.samplesperblock), &(wav_fmt->mpeg3.codecdelay)) ;
  315|       |
  316|  8.78k|				psf_log_printf (psf, "  Bytes/sec     : %d\n", wav_fmt->mpeg3.bytespersec) ;
  317|  8.78k|				psf_log_printf (psf, "  Extra Bytes   : %d\n", wav_fmt->mpeg3.extrabytes) ;
  318|  8.78k|				if (wav_fmt->mpeg3.id != 1)
  ------------------
  |  Branch (318:9): [True: 4.87k, False: 3.90k]
  ------------------
  319|  4.87k|					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|  8.78k|				psf_log_printf (psf, "  Flags         : 0x%08x\n", wav_fmt->mpeg3.flags) ;
  323|  8.78k|				psf_log_printf (psf, "  Block Size    : %d\n", wav_fmt->mpeg3.blocksize) ;
  324|  8.78k|				psf_log_printf (psf, "  Samples/Block : %d\n", wav_fmt->mpeg3.samplesperblock) ;
  325|  8.78k|				psf_log_printf (psf, "  Codec Delay   : %d samples\n", wav_fmt->mpeg3.codecdelay) ;
  326|  8.78k|				break ;
  327|       |
  328|  27.7k|		case WAVE_FORMAT_EXTENSIBLE :
  ------------------
  |  Branch (328:3): [True: 27.7k, False: 93.5k]
  ------------------
  329|  27.7k|				if (wav_fmt->ext.bytespersec != wav_fmt->ext.samplerate * wav_fmt->ext.blockalign)
  ------------------
  |  Branch (329:9): [True: 22.7k, False: 4.99k]
  ------------------
  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.99k|				else
  332|  4.99k|					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.59k, False: 23.1k]
  ------------------
  341|  4.59k|					psf_log_printf (psf, "  Channel Mask  : 0x0 (should not be zero)\n") ;
  342|  23.1k|				else
  343|  23.1k|				{	char buffer [512] ;
  344|  23.1k|					unsigned bit ;
  345|       |
  346|  23.1k|					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.1k|					free (psf->channel_map) ;
  350|       |
  351|  23.1k|					if ((psf->channel_map = calloc (psf->sf.channels, sizeof (psf->channel_map [0]))) == NULL)
  ------------------
  |  Branch (351:10): [True: 0, False: 23.1k]
  ------------------
  352|      0|						return SFE_MALLOC_FAILED ;
  353|       |
  354|       |					/* Terminate the buffer we're going to append_snprintf into. */
  355|  23.1k|					buffer [0] = 0 ;
  356|       |
  357|   330k|					for (bit = k = 0 ; bit < ARRAY_LEN (channel_mask_bits) && k < psf->sf.channels ; bit++)
  ------------------
  |  |   93|   660k|#define		ARRAY_LEN(x)	((int) (sizeof (x) / sizeof ((x) [0])))
  ------------------
  |  Branch (357:25): [True: 315k, False: 14.3k]
  |  Branch (357:64): [True: 306k, False: 8.81k]
  ------------------
  358|   306k|					{
  359|   306k|						if (wav_fmt->ext.channelmask & (1 << bit))
  ------------------
  |  Branch (359:11): [True: 115k, False: 190k]
  ------------------
  360|   115k|						{	if (k > psf->sf.channels)
  ------------------
  |  Branch (360:13): [True: 0, False: 115k]
  ------------------
  361|      0|							{	psf_log_printf (psf, "*** More channel map bits than there are channels.\n") ;
  362|      0|								break ;
  363|   115k|								} ;
  364|       |
  365|   115k|							psf->channel_map [k++] = channel_mask_bits [bit].id ;
  366|   115k|							append_snprintf (buffer, sizeof (buffer), "%s, ", channel_mask_bits [bit].name) ;
  367|   306k|							} ;
  368|   306k|						} ;
  369|       |
  370|       |					/* Remove trailing ", ". */
  371|  23.1k|					bit = strlen (buffer) ;
  372|  23.1k|					if (bit >= 2)
  ------------------
  |  Branch (372:10): [True: 18.5k, False: 4.58k]
  ------------------
  373|  18.5k|					{	buffer [--bit] = 0 ;
  374|  18.5k|						buffer [--bit] = 0 ;
  375|  18.5k|						} ;
  376|       |
  377|  23.1k|					if (k != psf->sf.channels)
  ------------------
  |  Branch (377:10): [True: 13.4k, False: 9.69k]
  ------------------
  378|  13.4k|					{	psf_log_printf (psf, "  Channel Mask  : 0x%X\n", wav_fmt->ext.channelmask) ;
  379|  13.4k|						psf_log_printf (psf, "*** Less channel map bits than there are channels.\n") ;
  380|  13.4k|						}
  381|  9.69k|					else
  382|  9.69k|						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: 222k, False: 27.7k]
  ------------------
  394|   222k|				{	bytesread += psf_binheader_readf (psf, "1", &(wav_fmt->ext.esf.esf_field4 [k])) ;
  395|   222k|					psf_log_printf (psf, "0x%X ", wav_fmt->ext.esf.esf_field4 [k] & 0xFF) ;
  396|   222k|					} ;
  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.16k, False: 22.5k]
  ------------------
  402|  5.16k|				{	psf->sf.format = SF_FORMAT_WAVEX | u_bitwidth_to_subformat (psf->bytewidth * 8) ;
  403|  5.16k|					psf_log_printf (psf, "    format : pcm\n") ;
  404|  5.16k|					}
  405|  22.5k|				else if (wavex_guid_equal (&wav_fmt->ext.esf, &MSGUID_SUBTYPE_MS_ADPCM))
  ------------------
  |  Branch (405:14): [True: 2.79k, False: 19.8k]
  ------------------
  406|  2.79k|				{	psf->sf.format = (SF_FORMAT_WAVEX | SF_FORMAT_MS_ADPCM) ;
  407|  2.79k|					psf_log_printf (psf, "    format : ms adpcm\n") ;
  408|  2.79k|					}
  409|  19.8k|				else if (wavex_guid_equal (&wav_fmt->ext.esf, &MSGUID_SUBTYPE_IEEE_FLOAT))
  ------------------
  |  Branch (409:14): [True: 3.94k, False: 15.8k]
  ------------------
  410|  3.94k|				{	psf->sf.format = SF_FORMAT_WAVEX | ((psf->bytewidth == 8) ? SF_FORMAT_DOUBLE : SF_FORMAT_FLOAT) ;
  ------------------
  |  Branch (410:43): [True: 520, False: 3.42k]
  ------------------
  411|  3.94k|					psf_log_printf (psf, "    format : IEEE float\n") ;
  412|  3.94k|					}
  413|  15.8k|				else if (wavex_guid_equal (&wav_fmt->ext.esf, &MSGUID_SUBTYPE_ALAW))
  ------------------
  |  Branch (413:14): [True: 2.21k, False: 13.6k]
  ------------------
  414|  2.21k|				{	psf->sf.format = (SF_FORMAT_WAVEX | SF_FORMAT_ALAW) ;
  415|  2.21k|					psf_log_printf (psf, "    format : A-law\n") ;
  416|  2.21k|					}
  417|  13.6k|				else if (wavex_guid_equal (&wav_fmt->ext.esf, &MSGUID_SUBTYPE_MULAW))
  ------------------
  |  Branch (417:14): [True: 2.33k, False: 11.3k]
  ------------------
  418|  2.33k|				{	psf->sf.format = (SF_FORMAT_WAVEX | SF_FORMAT_ULAW) ;
  419|  2.33k|					psf_log_printf (psf, "    format : u-law\n") ;
  420|  2.33k|					}
  421|  11.3k|				else if (wavex_guid_equal (&wav_fmt->ext.esf, &MSGUID_SUBTYPE_AMBISONIC_B_FORMAT_PCM))
  ------------------
  |  Branch (421:14): [True: 6.80k, False: 4.50k]
  ------------------
  422|  6.80k|				{	psf->sf.format = SF_FORMAT_WAVEX | u_bitwidth_to_subformat (psf->bytewidth * 8) ;
  423|  6.80k|					psf_log_printf (psf, "    format : pcm (Ambisonic B)\n") ;
  424|  6.80k|					wpriv->wavex_ambisonic = SF_AMBISONIC_B_FORMAT ;
  425|  6.80k|					}
  426|  4.50k|				else if (wavex_guid_equal (&wav_fmt->ext.esf, &MSGUID_SUBTYPE_AMBISONIC_B_FORMAT_IEEE_FLOAT))
  ------------------
  |  Branch (426:14): [True: 4.37k, False: 128]
  ------------------
  427|  4.37k|				{	psf->sf.format = SF_FORMAT_WAVEX | ((psf->bytewidth == 8) ? SF_FORMAT_DOUBLE : SF_FORMAT_FLOAT) ;
  ------------------
  |  Branch (427:43): [True: 884, False: 3.49k]
  ------------------
  428|  4.37k|					psf_log_printf (psf, "    format : IEEE float (Ambisonic B)\n") ;
  429|  4.37k|					wpriv->wavex_ambisonic = SF_AMBISONIC_B_FORMAT ;
  430|  4.37k|					}
  431|    128|				else
  432|    128|					return SFE_UNIMPLEMENTED ;
  433|       |
  434|  27.6k|				break ;
  435|       |
  436|  27.6k|		case WAVE_FORMAT_G721_ADPCM :
  ------------------
  |  Branch (436:3): [True: 18.9k, False: 102k]
  ------------------
  437|  18.9k|				psf_log_printf (psf, "  Bytes/sec     : %d\n", wav_fmt->g72x.bytespersec) ;
  438|  18.9k|				if (fmtsize >= 20)
  ------------------
  |  Branch (438:9): [True: 9.44k, False: 9.53k]
  ------------------
  439|  9.44k|				{	bytesread += psf_binheader_readf (psf, "22", &(wav_fmt->g72x.extrabytes), &(wav_fmt->g72x.auxblocksize)) ;
  440|  9.44k|					if (wav_fmt->g72x.extrabytes == 0)
  ------------------
  |  Branch (440:10): [True: 4.92k, False: 4.51k]
  ------------------
  441|  4.92k|						psf_log_printf (psf, "  Extra Bytes   : %d (should be 2)\n", wav_fmt->g72x.extrabytes) ;
  442|  4.51k|					else
  443|  4.51k|						psf_log_printf (psf, "  Extra Bytes   : %d\n", wav_fmt->g72x.extrabytes) ;
  444|  9.44k|					psf_log_printf (psf, "  Aux Blk Size  : %d\n", wav_fmt->g72x.auxblocksize) ;
  445|  9.44k|					}
  446|  9.53k|				else if (fmtsize == 18)
  ------------------
  |  Branch (446:14): [True: 7.12k, False: 2.41k]
  ------------------
  447|  7.12k|				{	bytesread += psf_binheader_readf (psf, "2", &(wav_fmt->g72x.extrabytes)) ;
  448|  7.12k|					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: 4.91k, False: 2.20k]
  ------------------
  449|  7.12k|					}
  450|  2.41k|				else
  451|  2.41k|					psf_log_printf (psf, "*** 'fmt ' chunk should be bigger than this!\n") ;
  452|  18.9k|				break ;
  453|       |
  454|  7.72k|		case WAVE_FORMAT_NMS_VBXADPCM :
  ------------------
  |  Branch (454:3): [True: 7.72k, False: 113k]
  ------------------
  455|  7.72k|				if (wav_fmt->min.channels != 1 || wav_fmt->min.bitwidth < 2 || wav_fmt->min.bitwidth * 20 + 2 != wav_fmt->min.blockalign)
  ------------------
  |  Branch (455:9): [True: 2, False: 7.72k]
  |  Branch (455:39): [True: 5, False: 7.72k]
  |  Branch (455:68): [True: 22, False: 7.69k]
  ------------------
  456|     29|					return SFE_WAV_NMS_FORMAT ;
  457|       |
  458|  7.69k|				bytespersec = (wav_fmt->min.samplerate * wav_fmt->min.blockalign) / 160 ;
  459|  7.69k|				if (wav_fmt->min.bytespersec == (unsigned) bytespersec)
  ------------------
  |  Branch (459:9): [True: 3.40k, False: 4.29k]
  ------------------
  460|  3.40k|					psf_log_printf (psf, "  Bytes/sec     : %d\n", wav_fmt->min.bytespersec) ;
  461|  4.29k|				else
  462|  4.29k|					psf_log_printf (psf, "  Bytes/sec     : %d (should be %d)\n", wav_fmt->min.bytespersec, bytespersec) ;
  463|  7.69k|				if (fmtsize >= 18)
  ------------------
  |  Branch (463:9): [True: 2.84k, False: 4.84k]
  ------------------
  464|  2.84k|				{	bytesread += psf_binheader_readf (psf, "2", &(wav_fmt->size20.extrabytes)) ;
  465|  2.84k|					psf_log_printf (psf, "  Extra Bytes   : %d\n", wav_fmt->size20.extrabytes) ;
  466|  2.84k|					} ;
  467|  7.69k|				break ;
  468|       |
  469|     61|		default :
  ------------------
  |  Branch (469:3): [True: 61, False: 121k]
  ------------------
  470|     61|				psf_log_printf (psf, "*** No 'fmt ' chunk dumper for this format!\n") ;
  471|     61|				return SFE_WAV_BAD_FMT ;
  472|   121k|		} ;
  473|       |
  474|   120k|	if (bytesread > fmtsize)
  ------------------
  |  Branch (474:6): [True: 19, False: 120k]
  ------------------
  475|     19|	{	psf_log_printf (psf, "*** wavlike_read_fmt_chunk (bytesread > fmtsize)\n") ;
  476|     19|		return SFE_WAV_BAD_FMT ;
  477|     19|		}
  478|   120k|	else
  479|   120k|		psf_binheader_readf (psf, "j", fmtsize - bytesread) ;
  480|       |
  481|   120k|	psf->blockwidth = wav_fmt->min.channels * psf->bytewidth ;
  482|       |
  483|   120k|	return 0 ;
  484|   120k|} /* wavlike_read_fmt_chunk */
wavlike_analyze:
  524|     71|{	unsigned char buffer [4096] ;
  525|     71|	AUDIO_DETECT ad ;
  526|     71|	int format = 0 ;
  527|       |
  528|     71|	if (psf->is_pipe)
  ------------------
  |  Branch (528:6): [True: 0, False: 71]
  ------------------
  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|     71|		} ;
  532|       |
  533|     71|	psf_log_printf (psf, "---------------------------------------------------\n"
  534|     71|						"Format is known to be broken. Using detection code.\n") ;
  535|       |
  536|       |	/* Code goes here. */
  537|     71|	ad.endianness = SF_ENDIAN_LITTLE ;
  538|     71|	ad.channels = psf->sf.channels ;
  539|       |
  540|     71|	psf_fseek (psf, 3 * 4 * 50, SEEK_SET) ;
  541|       |
  542|  3.13k|	while (psf_fread (buffer, 1, sizeof (buffer), psf) == sizeof (buffer))
  ------------------
  |  Branch (542:9): [True: 3.07k, False: 59]
  ------------------
  543|  3.07k|	{	format = audio_detect (psf, &ad, buffer, sizeof (buffer)) ;
  544|  3.07k|		if (format != 0)
  ------------------
  |  Branch (544:7): [True: 12, False: 3.06k]
  ------------------
  545|     12|			break ;
  546|  3.07k|		} ;
  547|       |
  548|       |	/* Seek to start of DATA section. */
  549|     71|	psf_fseek (psf, psf->dataoffset, SEEK_SET) ;
  550|       |
  551|     71|	if (format == 0)
  ------------------
  |  Branch (551:6): [True: 59, False: 12]
  ------------------
  552|     59|	{	psf_log_printf (psf, "wavlike_analyze : detection failed.\n") ;
  553|     59|		return ;
  554|     59|		} ;
  555|       |
  556|     12|	switch (format)
  557|     12|	{	case SF_FORMAT_PCM_32 :
  ------------------
  |  Branch (557:4): [True: 6, False: 6]
  ------------------
  558|     12|		case SF_FORMAT_FLOAT :
  ------------------
  |  Branch (558:3): [True: 6, False: 6]
  ------------------
  559|     12|			psf_log_printf (psf, "wavlike_analyze : found format : 0x%X\n", format) ;
  560|     12|			psf->sf.format = (psf->sf.format & ~SF_FORMAT_SUBMASK) + format ;
  561|     12|			psf->bytewidth = 4 ;
  562|     12|			psf->blockwidth = psf->sf.channels * psf->bytewidth ;
  563|     12|			break ;
  564|       |
  565|      0|		case SF_FORMAT_PCM_24 :
  ------------------
  |  Branch (565:3): [True: 0, False: 12]
  ------------------
  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: 12]
  ------------------
  573|      0|			psf_log_printf (psf, "wavlike_analyze : unhandled format : 0x%X\n", format) ;
  574|      0|			break ;
  575|     12|		} ;
  576|       |
  577|     12|	return ;
  578|     12|} /* wavlike_analyze */
wavlike_format_str:
  702|   121k|{	int lower, upper, mid ;
  703|       |
  704|   121k|	lower = -1 ;
  705|   121k|	upper = sizeof (wave_descs) / sizeof (WAV_FORMAT_DESC) ;
  706|       |
  707|       |	/* binary search */
  708|   121k|	if ((wave_descs [0].ID <= k) && (k <= wave_descs [upper - 1].ID))
  ------------------
  |  Branch (708:6): [True: 121k, False: 12]
  |  Branch (708:34): [True: 121k, False: 2]
  ------------------
  709|   121k|	{
  710|   758k|		while (lower + 1 < upper)
  ------------------
  |  Branch (710:10): [True: 758k, False: 40]
  ------------------
  711|   758k|		{	mid = (upper + lower) / 2 ;
  712|       |
  713|   758k|			if (k == wave_descs [mid].ID)
  ------------------
  |  Branch (713:8): [True: 121k, False: 636k]
  ------------------
  714|   121k|				return wave_descs [mid].name ;
  715|   636k|			if (k < wave_descs [mid].ID)
  ------------------
  |  Branch (715:8): [True: 333k, False: 303k]
  ------------------
  716|   333k|				upper = mid ;
  717|   303k|			else
  718|   303k|				lower = mid ;
  719|   636k|			} ;
  720|     54|		} ;
  721|       |
  722|     54|	return "Unknown format" ;
  723|   121k|} /* wavlike_format_str */
wavlike_read_bext_chunk:
  738|  4.38k|{
  739|  4.38k|	SF_BROADCAST_INFO_16K * b ;
  740|  4.38k|	uint32_t bytes = 0 ;
  741|       |
  742|  4.38k|	if (chunksize < WAV_BEXT_MIN_CHUNK_SIZE)
  ------------------
  |  |   33|  4.38k|#define WAV_BEXT_MIN_CHUNK_SIZE		602
  ------------------
  |  Branch (742:6): [True: 3.79k, False: 595]
  ------------------
  743|  3.79k|	{	psf_log_printf (psf, "bext : %u (should be >= %d)\n", chunksize, WAV_BEXT_MIN_CHUNK_SIZE) ;
  ------------------
  |  |   33|  3.79k|#define WAV_BEXT_MIN_CHUNK_SIZE		602
  ------------------
  744|  3.79k|		psf_binheader_readf (psf, "j", chunksize) ;
  745|  3.79k|		return 0 ;
  746|  3.79k|		} ;
  747|       |
  748|    595|	if (chunksize > WAV_BEXT_MAX_CHUNK_SIZE)
  ------------------
  |  |   34|    595|#define WAV_BEXT_MAX_CHUNK_SIZE		(10 * 1024)
  ------------------
  |  Branch (748:6): [True: 378, False: 217]
  ------------------
  749|    378|	{	psf_log_printf (psf, "bext : %u (should be < %d)\n", chunksize, WAV_BEXT_MAX_CHUNK_SIZE) ;
  ------------------
  |  |   34|    378|#define WAV_BEXT_MAX_CHUNK_SIZE		(10 * 1024)
  ------------------
  750|    378|		psf_binheader_readf (psf, "j", chunksize) ;
  751|    378|		return 0 ;
  752|    378|		} ;
  753|       |
  754|    217|	if (chunksize >= sizeof (SF_BROADCAST_INFO_16K))
  ------------------
  |  Branch (754:6): [True: 0, False: 217]
  ------------------
  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|    217|		} ;
  759|       |
  760|    217|	psf_log_printf (psf, "bext : %u\n", chunksize) ;
  761|       |
  762|    217|	if (!psf->broadcast_16k)
  ------------------
  |  Branch (762:6): [True: 28, False: 189]
  ------------------
  763|     28|	{	psf->broadcast_16k = broadcast_var_alloc () ;
  764|     28|		if (!psf->broadcast_16k)
  ------------------
  |  Branch (764:7): [True: 0, False: 28]
  ------------------
  765|      0|		{	psf->error = SFE_MALLOC_FAILED ;
  766|      0|			return psf->error ;
  767|      0|			}
  768|     28|		}
  769|    189|	else
  770|    189|	{	psf_log_printf (psf, "bext : found more than one bext chunk, using last one.\n") ;
  771|    189|		memset (psf->broadcast_16k, 0, sizeof (SF_BROADCAST_INFO_16K)) ;
  772|    189|		}
  773|       |
  774|    217|	b = psf->broadcast_16k ;
  775|       |
  776|    217|	bytes += psf_binheader_readf (psf, "b", b->description, sizeof (b->description)) ;
  777|    217|	bytes += psf_binheader_readf (psf, "b", b->originator, sizeof (b->originator)) ;
  778|    217|	bytes += psf_binheader_readf (psf, "b", b->originator_reference, sizeof (b->originator_reference)) ;
  779|    217|	bytes += psf_binheader_readf (psf, "b", b->origination_date, sizeof (b->origination_date)) ;
  780|    217|	bytes += psf_binheader_readf (psf, "b", b->origination_time, sizeof (b->origination_time)) ;
  781|    217|	bytes += psf_binheader_readf (psf, "442", &b->time_reference_low, &b->time_reference_high, &b->version) ;
  782|    217|	bytes += psf_binheader_readf (psf, "b", &b->umid, sizeof (b->umid)) ;
  783|    217|	bytes += psf_binheader_readf (psf, "22", &b->loudness_value, &b->loudness_range) ;
  784|    217|	bytes += psf_binheader_readf (psf, "222", &b->max_true_peak_level, &b->max_momentary_loudness, &b->max_shortterm_loudness) ;
  785|    217|	bytes += psf_binheader_readf (psf, "j", 180) ;
  786|       |
  787|    217|	if (chunksize > WAV_BEXT_MIN_CHUNK_SIZE)
  ------------------
  |  |   33|    217|#define WAV_BEXT_MIN_CHUNK_SIZE		602
  ------------------
  |  Branch (787:6): [True: 204, False: 13]
  ------------------
  788|    204|	{	/* File has coding history data. */
  789|       |
  790|    204|		b->coding_history_size = chunksize - WAV_BEXT_MIN_CHUNK_SIZE ;
  ------------------
  |  |   33|    204|#define WAV_BEXT_MIN_CHUNK_SIZE		602
  ------------------
  791|       |
  792|       |		/* We do not parse the coding history */
  793|    204|		bytes += psf_binheader_readf (psf, "b", BHWv (b->coding_history), BHWz (b->coding_history_size)) ;
  ------------------
  |  |  133|    204|#define BHWv(x) ((const void *) (x))
  ------------------
              		bytes += psf_binheader_readf (psf, "b", BHWv (b->coding_history), BHWz (b->coding_history_size)) ;
  ------------------
  |  |  134|    204|#define BHWz(x) ((size_t) (x))
  ------------------
  794|    204|		} ;
  795|       |
  796|    217|	if (bytes < chunksize)
  ------------------
  |  Branch (796:6): [True: 37, False: 180]
  ------------------
  797|     37|		psf_binheader_readf (psf, "j", BHWj (chunksize - bytes)) ;
  ------------------
  |  |  129|     37|#define BHWj(x) ((size_t) (x))
  ------------------
  798|       |
  799|    217|	return 0 ;
  800|    217|} /* wavlike_read_bext_chunk */
wavlike_read_cart_chunk:
  837|  2.57k|{	SF_CART_INFO_16K *c ;
  838|  2.57k|	uint32_t bytes = 0 ;
  839|  2.57k|	int k ;
  840|       |
  841|  2.57k|	if (chunksize < WAV_CART_MIN_CHUNK_SIZE)
  ------------------
  |  |   36|  2.57k|#define WAV_CART_MIN_CHUNK_SIZE		2048
  ------------------
  |  Branch (841:6): [True: 1.38k, False: 1.19k]
  ------------------
  842|  1.38k|	{	psf_log_printf (psf, "cart : %u (should be >= %d)\n", chunksize, WAV_CART_MIN_CHUNK_SIZE) ;
  ------------------
  |  |   36|  1.38k|#define WAV_CART_MIN_CHUNK_SIZE		2048
  ------------------
  843|  1.38k|		psf_binheader_readf (psf, "j", chunksize) ;
  844|  1.38k|		return 0 ;
  845|  1.38k|		} ;
  846|  1.19k|	if (chunksize > WAV_CART_MAX_CHUNK_SIZE)
  ------------------
  |  |   37|  1.19k|#define WAV_CART_MAX_CHUNK_SIZE		0xffffffff
  ------------------
  |  Branch (846:6): [True: 0, False: 1.19k]
  ------------------
  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.19k|		} ;
  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.19k|	if (chunksize >= sizeof (SF_CART_INFO_16K) - 4)
  ------------------
  |  Branch (856:6): [True: 939, False: 251]
  ------------------
  857|    939|	{	psf_log_printf (psf, "cart : %u too big to be handled\n", chunksize) ;
  858|    939|		psf_binheader_readf (psf, "j", chunksize) ;
  859|    939|		return 0 ;
  860|    939|		} ;
  861|       |
  862|    251|	psf_log_printf (psf, "cart : %u\n", chunksize) ;
  863|       |
  864|    251|	if (psf->cart_16k)
  ------------------
  |  Branch (864:6): [True: 222, False: 29]
  ------------------
  865|    222|	{	psf_log_printf (psf, "  Found more than one cart chunk, using last one.\n") ;
  866|    222|		free (psf->cart_16k) ;
  867|    222|		psf->cart_16k = NULL ;
  868|    222|		} ;
  869|       |
  870|    251|	if ((psf->cart_16k = cart_var_alloc ()) == NULL)
  ------------------
  |  Branch (870:6): [True: 0, False: 251]
  ------------------
  871|      0|	{	psf->error = SFE_MALLOC_FAILED ;
  872|      0|		return psf->error ;
  873|    251|		} ;
  874|       |
  875|    251|	c = psf->cart_16k ;
  876|    251|	bytes += psf_binheader_readf (psf, "b", c->version, sizeof (c->version)) ;
  877|    251|	bytes += psf_binheader_readf (psf, "b", c->title, sizeof (c->title)) ;
  878|    251|	bytes += psf_binheader_readf (psf, "b", c->artist, sizeof (c->artist)) ;
  879|    251|	bytes += psf_binheader_readf (psf, "b", c->cut_id, sizeof (c->cut_id)) ;
  880|    251|	bytes += psf_binheader_readf (psf, "b", c->client_id, sizeof (c->client_id)) ;
  881|    251|	bytes += psf_binheader_readf (psf, "b", c->category, sizeof (c->category)) ;
  882|    251|	bytes += psf_binheader_readf (psf, "b", c->classification, sizeof (c->classification)) ;
  883|    251|	bytes += psf_binheader_readf (psf, "b", c->out_cue, sizeof (c->out_cue)) ;
  884|    251|	bytes += psf_binheader_readf (psf, "b", c->start_date, sizeof (c->start_date)) ;
  885|    251|	bytes += psf_binheader_readf (psf, "b", c->start_time, sizeof (c->start_time)) ;
  886|    251|	bytes += psf_binheader_readf (psf, "b", c->end_date, sizeof (c->end_date)) ;
  887|    251|	bytes += psf_binheader_readf (psf, "b", c->end_time, sizeof (c->end_time)) ;
  888|    251|	bytes += psf_binheader_readf (psf, "b", c->producer_app_id, sizeof (c->producer_app_id)) ;
  889|    251|	bytes += psf_binheader_readf (psf, "b", c->producer_app_version, sizeof (c->producer_app_version)) ;
  890|    251|	bytes += psf_binheader_readf (psf, "b", c->user_def, sizeof (c->user_def)) ;
  891|    251|	bytes += psf_binheader_readf (psf, "e4", &c->level_reference, sizeof (c->level_reference)) ;
  892|       |
  893|  2.25k|	for (k = 0 ; k < ARRAY_LEN (c->post_timers) ; k++)
  ------------------
  |  |   93|  2.25k|#define		ARRAY_LEN(x)	((int) (sizeof (x) / sizeof ((x) [0])))
  ------------------
  |  Branch (893:15): [True: 2.00k, False: 251]
  ------------------
  894|  2.00k|		bytes += psf_binheader_readf (psf, "b4", &c->post_timers [k].usage, make_size_t (4), &c->post_timers [k].value) ;
  895|       |
  896|    251|	bytes += psf_binheader_readf (psf, "b", c->reserved, sizeof (c->reserved)) ;
  897|    251|	bytes += psf_binheader_readf (psf, "b", c->url, sizeof (c->url)) ;
  898|       |
  899|    251|	if (chunksize > WAV_CART_MIN_CHUNK_SIZE)
  ------------------
  |  |   36|    251|#define WAV_CART_MIN_CHUNK_SIZE		2048
  ------------------
  |  Branch (899:6): [True: 128, False: 123]
  ------------------
  900|    128|	{	/* File has tag text. */
  901|    128|		c->tag_text_size = chunksize - WAV_CART_MIN_CHUNK_SIZE ;
  ------------------
  |  |   36|    128|#define WAV_CART_MIN_CHUNK_SIZE		2048
  ------------------
  902|    128|		bytes += psf_binheader_readf (psf, "b", c->tag_text, make_size_t (c->tag_text_size)) ;
  903|    128|		} ;
  904|       |
  905|    251|	if (bytes < chunksize)
  ------------------
  |  Branch (905:6): [True: 36, False: 215]
  ------------------
  906|     36|		psf_log_printf (psf, "  %d trailing bytes in cart chunk.\n", chunksize - bytes) ;
  907|       |
  908|    251|	return 0 ;
  909|    251|} /* wavlike_read_cart_chunk */
wavlike_subchunk_parse:
  956|  71.3k|{	sf_count_t	current_pos ;
  957|  71.3k|	char		buffer [2048] ;
  958|  71.3k|	uint32_t 	chunk_size, bytesread = 0 ;
  959|       |
  960|  71.3k|	current_pos = psf_fseek (psf, 0, SEEK_CUR) ;
  961|       |
  962|  71.3k|	if (chunk_length <= 8)
  ------------------
  |  Branch (962:6): [True: 1.44k, False: 69.8k]
  ------------------
  963|  1.44k|	{	/* This case is for broken files generated by PEAK. */
  964|  1.44k|		psf_log_printf (psf, "%M : %u (weird length)\n", chunk, chunk_length) ;
  965|  1.44k|		psf_binheader_readf (psf, "mj", &chunk, chunk_length - 4) ;
  966|  1.44k|		psf_log_printf (psf, "  %M\n", chunk) ;
  967|  1.44k|		return 0 ;
  968|  69.8k|		} ;
  969|       |
  970|  69.8k|	if (current_pos + chunk_length > psf->filelength)
  ------------------
  |  Branch (970:6): [True: 40.7k, False: 29.1k]
  ------------------
  971|  40.7k|	{	psf_log_printf (psf, "%M : %u (should be %d)\n", chunk, chunk_length, (int) (psf->filelength - current_pos)) ;
  972|  40.7k|		chunk_length = psf->filelength - current_pos ;
  973|  40.7k|		}
  974|  29.1k|	else
  975|  29.1k|		psf_log_printf (psf, "%M : %u\n", chunk, chunk_length) ;
  976|       |
  977|   185k|	while (bytesread < chunk_length)
  ------------------
  |  Branch (977:9): [True: 177k, False: 8.11k]
  ------------------
  978|   177k|	{	uint32_t thisread ;
  979|       |
  980|   177k|		if ((thisread = psf_binheader_readf (psf, "m", &chunk)) == 0)
  ------------------
  |  Branch (980:7): [True: 264, False: 176k]
  ------------------
  981|    264|			break ;
  982|   176k|		bytesread += thisread ;
  983|       |
  984|   176k|		switch (chunk)
  985|   176k|		{	case adtl_MARKER :
  ------------------
  |  |   29|    232|#define adtl_MARKER		MAKE_MARKER ('a', 'd', 't', 'l')
  |  |  ------------------
  |  |  |  |  122|    232|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (985:5): [True: 232, False: 176k]
  ------------------
  986|    842|			case INFO_MARKER :
  ------------------
  |  |   37|    842|#define INFO_MARKER		MAKE_MARKER ('I', 'N', 'F', 'O')
  |  |  ------------------
  |  |  |  |  122|    842|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (986:4): [True: 610, False: 176k]
  ------------------
  987|       |					/* These markers don't contain anything, not even a chunk length. */
  988|    842|					psf_log_printf (psf, "  %M\n", chunk) ;
  989|    842|					continue ;
  990|       |
  991|  44.1k|			case exif_MARKER :
  ------------------
  |  |   58|  44.1k|#define exif_MARKER		MAKE_MARKER ('e', 'x', 'i', 'f')
  |  |  ------------------
  |  |  |  |  122|  44.1k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (991:4): [True: 44.1k, False: 132k]
  ------------------
  992|  44.1k|					psf_log_printf (psf, "  %M\n", chunk) ;
  993|  44.1k|					if (chunk_length > bytesread)
  ------------------
  |  Branch (993:10): [True: 43.2k, False: 851]
  ------------------
  994|  43.2k|						bytesread += exif_subchunk_parse (psf, chunk_length - bytesread) ;
  995|  44.1k|					continue ;
  996|       |
  997|  6.94k|			case data_MARKER :
  ------------------
  |  |   32|  6.94k|#define data_MARKER		MAKE_MARKER ('d', 'a', 't', 'a')
  |  |  ------------------
  |  |  |  |  122|  6.94k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (997:4): [True: 6.94k, False: 169k]
  ------------------
  998|  6.94k|					psf_log_printf (psf, "  %M inside a LIST block??? Backing out.\n", chunk) ;
  999|       |					/* Jump back four bytes and return to caller. */
 1000|  6.94k|					psf_binheader_readf (psf, "j", -4) ;
 1001|  6.94k|					return 0 ;
 1002|       |
 1003|  5.59k|			case 0 :
  ------------------
  |  Branch (1003:4): [True: 5.59k, False: 171k]
  ------------------
 1004|       |					/*
 1005|       |					**	Four zero bytes where a marker was expected. Assume this means
 1006|       |					**	the rest of the chunk is garbage.
 1007|       |					*/
 1008|  5.59k|					psf_log_printf (psf, "    *** Found weird-ass zero marker. Jumping to end of chunk.\n") ;
 1009|  5.59k|					goto cleanup_subchunk_parse ;
 1010|       |
 1011|   119k|			default :
  ------------------
  |  Branch (1011:4): [True: 119k, False: 57.4k]
  ------------------
 1012|   119k|					break ;
 1013|   176k|			} ;
 1014|       |
 1015|   119k|		switch (chunk)
 1016|   119k|		{	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: 117k]
  ------------------
 1017|  3.99k|			case ICOP_MARKER :
  ------------------
  |  |   50|  3.99k|#define ICOP_MARKER		MAKE_MARKER ('I', 'C', 'O', 'P')
  |  |  ------------------
  |  |  |  |  122|  3.99k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (1017:4): [True: 2.65k, False: 116k]
  ------------------
 1018|  4.33k|			case IARL_MARKER :
  ------------------
  |  |   45|  4.33k|#define IARL_MARKER		MAKE_MARKER ('I', 'A', 'R', 'L')
  |  |  ------------------
  |  |  |  |  122|  4.33k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (1018:4): [True: 338, False: 118k]
  ------------------
 1019|  6.38k|			case IART_MARKER :
  ------------------
  |  |   46|  6.38k|#define IART_MARKER		MAKE_MARKER ('I', 'A', 'R', 'T')
  |  |  ------------------
  |  |  |  |  122|  6.38k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (1019:4): [True: 2.05k, False: 117k]
  ------------------
 1020|  13.1k|			case ICMT_MARKER :
  ------------------
  |  |   54|  13.1k|#define ICMT_MARKER		MAKE_MARKER ('I', 'C', 'M', 'T')
  |  |  ------------------
  |  |  |  |  122|  13.1k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (1020:4): [True: 6.79k, False: 112k]
  ------------------
 1021|  15.9k|			case ICRD_MARKER :
  ------------------
  |  |   43|  15.9k|#define ICRD_MARKER		MAKE_MARKER ('I', 'C', 'R', 'D')
  |  |  ------------------
  |  |  |  |  122|  15.9k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (1021:4): [True: 2.81k, False: 116k]
  ------------------
 1022|  18.8k|			case IENG_MARKER :
  ------------------
  |  |   48|  18.8k|#define IENG_MARKER		MAKE_MARKER ('I', 'E', 'N', 'G')
  |  |  ------------------
  |  |  |  |  122|  18.8k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (1022:4): [True: 2.90k, False: 116k]
  ------------------
 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: 336, False: 118k]
  ------------------
 1024|  24.5k|			case INAM_MARKER :
  ------------------
  |  |   47|  24.5k|#define INAM_MARKER		MAKE_MARKER ('I', 'N', 'A', 'M')
  |  |  ------------------
  |  |  |  |  122|  24.5k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (1024:4): [True: 5.30k, False: 114k]
  ------------------
 1025|  26.8k|			case IPRD_MARKER :
  ------------------
  |  |   51|  26.8k|#define IPRD_MARKER		MAKE_MARKER ('I', 'P', 'R', 'D')
  |  |  ------------------
  |  |  |  |  122|  26.8k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (1025:4): [True: 2.34k, False: 116k]
  ------------------
 1026|  29.6k|			case ISBJ_MARKER :
  ------------------
  |  |   53|  29.6k|#define ISBJ_MARKER		MAKE_MARKER ('I', 'S', 'B', 'J')
  |  |  ------------------
  |  |  |  |  122|  29.6k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (1026:4): [True: 2.80k, False: 116k]
  ------------------
 1027|  31.8k|			case ISRC_MARKER :
  ------------------
  |  |   52|  31.8k|#define ISRC_MARKER		MAKE_MARKER ('I', 'S', 'R', 'C')
  |  |  ------------------
  |  |  |  |  122|  31.8k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (1027:4): [True: 2.14k, False: 117k]
  ------------------
 1028|  32.0k|			case IAUT_MARKER :
  ------------------
  |  |   55|  32.0k|#define IAUT_MARKER		MAKE_MARKER ('I', 'A', 'U', 'T')
  |  |  ------------------
  |  |  |  |  122|  32.0k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (1028:4): [True: 205, False: 119k]
  ------------------
 1029|  34.0k|			case ITRK_MARKER :
  ------------------
  |  |   56|  34.0k|#define ITRK_MARKER		MAKE_MARKER ('I', 'T', 'R', 'K')
  |  |  ------------------
  |  |  |  |  122|  34.0k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (1029:4): [True: 1.99k, False: 117k]
  ------------------
 1030|  34.0k|					bytesread += psf_binheader_readf (psf, "4", &chunk_size) ;
 1031|  34.0k|					chunk_size += (chunk_size & 1) ;
 1032|  34.0k|					if (chunk_size >= SIGNED_SIZEOF (buffer) || bytesread + chunk_size > chunk_length)
  ------------------
  |  |   91|  68.0k|#define		SIGNED_SIZEOF(x)	((int) sizeof (x))
  ------------------
  |  Branch (1032:10): [True: 6.26k, False: 27.7k]
  |  Branch (1032:50): [True: 5.81k, False: 21.9k]
  ------------------
 1033|  12.0k|					{	psf_log_printf (psf, "  *** %M : %u (too big)\n", chunk, chunk_size) ;
 1034|  12.0k|						goto cleanup_subchunk_parse ;
 1035|  21.9k|						} ;
 1036|       |
 1037|  21.9k|					bytesread += psf_binheader_readf (psf, "b", buffer, chunk_size) ;
 1038|  21.9k|					buffer [chunk_size] = 0 ;
 1039|  21.9k|					psf_log_printf (psf, "    %M : %s\n", chunk, buffer) ;
 1040|  21.9k|					break ;
 1041|       |
 1042|  13.5k|			case labl_MARKER :
  ------------------
  |  |   33|  13.5k|#define labl_MARKER		MAKE_MARKER ('l', 'a', 'b', 'l')
  |  |  ------------------
  |  |  |  |  122|  13.5k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (1042:4): [True: 13.5k, False: 105k]
  ------------------
 1043|  13.5k|					{	int mark_id ;
 1044|       |
 1045|  13.5k|						bytesread += psf_binheader_readf (psf, "44", &chunk_size, &mark_id) ;
 1046|  13.5k|						chunk_size -= 4 ;
 1047|  13.5k|						chunk_size += (chunk_size & 1) ;
 1048|  13.5k|						if (chunk_size < 1 || chunk_size >= SIGNED_SIZEOF (buffer) || bytesread + chunk_size > chunk_length)
  ------------------
  |  |   91|  26.6k|#define		SIGNED_SIZEOF(x)	((int) sizeof (x))
  ------------------
  |  Branch (1048:11): [True: 571, False: 13.0k]
  |  Branch (1048:29): [True: 4.77k, False: 8.25k]
  |  Branch (1048:69): [True: 2.90k, False: 5.34k]
  ------------------
 1049|  8.24k|						{	psf_log_printf (psf, "  *** %M : %u (too big)\n", chunk, chunk_size) ;
 1050|  8.24k|							goto cleanup_subchunk_parse ;
 1051|  8.24k|							} ;
 1052|       |
 1053|  5.34k|						bytesread += psf_binheader_readf (psf, "b", buffer, chunk_size) ;
 1054|  5.34k|						buffer [chunk_size] = 0 ;
 1055|       |
 1056|  5.34k|						if (mark_id < 10) /* avoid swamping log buffer with labels */
  ------------------
  |  Branch (1056:11): [True: 1.89k, False: 3.45k]
  ------------------
 1057|  1.89k|							psf_log_printf (psf, "    %M : %u : %s\n", chunk, mark_id, buffer) ;
 1058|  3.45k|						else if (mark_id == 10)
  ------------------
  |  Branch (1058:16): [True: 1.26k, False: 2.19k]
  ------------------
 1059|  1.26k|							psf_log_printf (psf, "    (Skipping)\n") ;
 1060|       |
 1061|  5.34k|						if (psf->cues)
  ------------------
  |  Branch (1061:11): [True: 781, False: 4.56k]
  ------------------
 1062|    781| 						{	unsigned int i = 0 ;
 1063|       |
 1064|       |							/* find id to store label */
 1065|  2.96k|							while (i < psf->cues->cue_count && psf->cues->cue_points [i].indx != mark_id)
  ------------------
  |  Branch (1065:15): [True: 2.40k, False: 567]
  |  Branch (1065:43): [True: 2.18k, False: 214]
  ------------------
 1066|  2.18k|								i++ ;
 1067|       |
 1068|    781|							if (i < psf->cues->cue_count)
  ------------------
  |  Branch (1068:12): [True: 214, False: 567]
  ------------------
 1069|    214|								memcpy (psf->cues->cue_points [i].name, buffer, sizeof (psf->cues->cue_points [i].name)) ;
 1070|    781|							} ;
 1071|  5.34k|						} ;
 1072|  5.34k|					break ;
 1073|       |
 1074|  4.78k|			case DISP_MARKER :
  ------------------
  |  |   36|  4.78k|#define DISP_MARKER		MAKE_MARKER ('D', 'I', 'S', 'P')
  |  |  ------------------
  |  |  |  |  122|  4.78k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (1074:4): [True: 4.78k, False: 114k]
  ------------------
 1075|  7.26k|			case ltxt_MARKER :
  ------------------
  |  |   34|  7.26k|#define ltxt_MARKER		MAKE_MARKER ('l', 't', 'x', 't')
  |  |  ------------------
  |  |  |  |  122|  7.26k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (1075:4): [True: 2.48k, False: 116k]
  ------------------
 1076|  8.62k|			case note_MARKER :
  ------------------
  |  |   35|  8.62k|#define note_MARKER		MAKE_MARKER ('n', 'o', 't', 'e')
  |  |  ------------------
  |  |  |  |  122|  8.62k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (1076:4): [True: 1.35k, False: 117k]
  ------------------
 1077|  8.62k|					bytesread += psf_binheader_readf (psf, "4", &chunk_size) ;
 1078|  8.62k|					chunk_size += (chunk_size & 1) ;
 1079|  8.62k|					if (chunk_size >= SIGNED_SIZEOF (buffer) || bytesread + chunk_size > chunk_length)
  ------------------
  |  |   91|  17.2k|#define		SIGNED_SIZEOF(x)	((int) sizeof (x))
  ------------------
  |  Branch (1079:10): [True: 3.84k, False: 4.77k]
  |  Branch (1079:50): [True: 1.69k, False: 3.08k]
  ------------------
 1080|  5.54k|					{	psf_log_printf (psf, "  *** %M : %u (too big)\n", chunk, chunk_size) ;
 1081|  5.54k|						goto cleanup_subchunk_parse ;
 1082|  5.54k|						} ;
 1083|       |
 1084|  3.08k|					psf_log_printf (psf, "    %M : %u\n", chunk, chunk_size) ;
 1085|  3.08k|					goto cleanup_subchunk_parse ;
 1086|       |
 1087|  63.0k|			default :
  ------------------
  |  Branch (1087:4): [True: 63.0k, False: 56.2k]
  ------------------
 1088|  63.0k|					bytesread += psf_binheader_readf (psf, "4", &chunk_size) ;
 1089|  63.0k|					chunk_size += (chunk_size & 1) ;
 1090|  63.0k|					if (bytesread + chunk_size > chunk_length)
  ------------------
  |  Branch (1090:10): [True: 20.0k, False: 43.0k]
  ------------------
 1091|  20.0k|					{	psf_log_printf (psf, "  *** %M : %u (too big)\n", chunk, chunk_size) ;
 1092|  20.0k|						goto cleanup_subchunk_parse ;
 1093|  20.0k|						}
 1094|  43.0k|					else
 1095|  43.0k|					{	psf_log_printf (psf, "    %M : %u\n", chunk, chunk_size) ;
 1096|  43.0k|						bytesread += psf_binheader_readf (psf, "j", chunk_size) ;
 1097|  43.0k|						} ;
 1098|  43.0k|					break ;
 1099|   119k|			} ;
 1100|       |
 1101|  70.3k|		switch (chunk)
  ------------------
  |  Branch (1101:11): [True: 21.1k, False: 49.1k]
  ------------------
 1102|  70.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: 68.9k]
  ------------------
 1103|  1.33k|					psf_store_string (psf, SF_STR_SOFTWARE, buffer) ;
 1104|  1.33k|					break ;
 1105|  2.64k|			case ICOP_MARKER :
  ------------------
  |  |   50|  2.64k|#define ICOP_MARKER		MAKE_MARKER ('I', 'C', 'O', 'P')
  |  |  ------------------
  |  |  |  |  122|  2.64k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (1105:4): [True: 2.64k, False: 67.6k]
  ------------------
 1106|  2.64k|					psf_store_string (psf, SF_STR_COPYRIGHT, buffer) ;
 1107|  2.64k|					break ;
 1108|  4.51k|			case INAM_MARKER :
  ------------------
  |  |   47|  4.51k|#define INAM_MARKER		MAKE_MARKER ('I', 'N', 'A', 'M')
  |  |  ------------------
  |  |  |  |  122|  4.51k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (1108:4): [True: 4.51k, False: 65.8k]
  ------------------
 1109|  4.51k|					psf_store_string (psf, SF_STR_TITLE, buffer) ;
 1110|  4.51k|					break ;
 1111|  1.20k|			case IART_MARKER :
  ------------------
  |  |   46|  1.20k|#define IART_MARKER		MAKE_MARKER ('I', 'A', 'R', 'T')
  |  |  ------------------
  |  |  |  |  122|  1.20k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (1111:4): [True: 1.20k, False: 69.1k]
  ------------------
 1112|  1.20k|					psf_store_string (psf, SF_STR_ARTIST, buffer) ;
 1113|  1.20k|					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: 65.0k]
  ------------------
 1115|  5.27k|					psf_store_string (psf, SF_STR_COMMENT, buffer) ;
 1116|  5.27k|					break ;
 1117|  1.78k|			case ICRD_MARKER :
  ------------------
  |  |   43|  1.78k|#define ICRD_MARKER		MAKE_MARKER ('I', 'C', 'R', 'D')
  |  |  ------------------
  |  |  |  |  122|  1.78k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (1117:4): [True: 1.78k, False: 68.5k]
  ------------------
 1118|  1.78k|					psf_store_string (psf, SF_STR_DATE, buffer) ;
 1119|  1.78k|					break ;
 1120|    333|			case IGNR_MARKER :
  ------------------
  |  |   49|    333|#define IGNR_MARKER		MAKE_MARKER ('I', 'G', 'N', 'R')
  |  |  ------------------
  |  |  |  |  122|    333|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (1120:4): [True: 333, False: 69.9k]
  ------------------
 1121|    333|					psf_store_string (psf, SF_STR_GENRE, buffer) ;
 1122|    333|					break ;
 1123|  2.05k|			case IPRD_MARKER :
  ------------------
  |  |   51|  2.05k|#define IPRD_MARKER		MAKE_MARKER ('I', 'P', 'R', 'D')
  |  |  ------------------
  |  |  |  |  122|  2.05k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (1123:4): [True: 2.05k, False: 68.2k]
  ------------------
 1124|  2.05k|					psf_store_string (psf, SF_STR_ALBUM, buffer) ;
 1125|  2.05k|					break ;
 1126|  1.99k|			case ITRK_MARKER :
  ------------------
  |  |   56|  1.99k|#define ITRK_MARKER		MAKE_MARKER ('I', 'T', 'R', 'K')
  |  |  ------------------
  |  |  |  |  122|  1.99k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (1126:4): [True: 1.99k, False: 68.3k]
  ------------------
 1127|  1.99k|					psf_store_string (psf, SF_STR_TRACKNUMBER, buffer) ;
 1128|  1.99k|					break ;
 1129|  70.3k|			} ;
 1130|  70.3k|		} ;
 1131|       |
 1132|  62.9k|cleanup_subchunk_parse :
 1133|       |
 1134|  62.9k|	if (chunk_length > bytesread)
  ------------------
  |  Branch (1134:6): [True: 46.9k, False: 16.0k]
  ------------------
 1135|  46.9k|		bytesread += psf_binheader_readf (psf, "j", chunk_length - bytesread) ;
 1136|       |
 1137|  62.9k|	return 0 ;
 1138|  8.37k|} /* wavlike_subchunk_parse */
wavlike_read_peak_chunk:
 1208|  6.81k|{	char		buffer [256] ;
 1209|  6.81k|	uint32_t uk ;
 1210|       |
 1211|  6.81k|	if (chunk_size != WAVLIKE_PEAK_CHUNK_SIZE (psf->sf.channels))
  ------------------
  |  |  337|  6.81k|#define		WAVLIKE_PEAK_CHUNK_SIZE(ch) (2 * sizeof (int) + ch * (sizeof (float) + sizeof (int)))
  ------------------
  |  Branch (1211:6): [True: 30, False: 6.78k]
  ------------------
 1212|     30|	{	psf_binheader_readf (psf, "j", chunk_size) ;
 1213|     30|		psf_log_printf (psf, "*** File PEAK chunk size doesn't fit with number of channels (%d).\n", psf->sf.channels) ;
 1214|     30|		return SFE_WAV_BAD_PEAK ;
 1215|  6.78k|		} ;
 1216|       |
 1217|  6.78k|	if (psf->peak_info)
  ------------------
  |  Branch (1217:6): [True: 6.74k, False: 46]
  ------------------
 1218|  6.74k|	{	psf_log_printf (psf, "*** Found existing peak info, using last one.\n") ;
 1219|  6.74k|		free (psf->peak_info) ;
 1220|  6.74k|		psf->peak_info = NULL ;
 1221|  6.74k|		} ;
 1222|  6.78k|	if ((psf->peak_info = peak_info_calloc (psf->sf.channels)) == NULL)
  ------------------
  |  Branch (1222:6): [True: 0, False: 6.78k]
  ------------------
 1223|      0|		return SFE_MALLOC_FAILED ;
 1224|       |
 1225|       |	/* read in rest of PEAK chunk. */
 1226|  6.78k|	psf_binheader_readf (psf, "44", & (psf->peak_info->version), & (psf->peak_info->timestamp)) ;
 1227|       |
 1228|  6.78k|	if (psf->peak_info->version != 1)
  ------------------
  |  Branch (1228:6): [True: 4.63k, False: 2.15k]
  ------------------
 1229|  4.63k|		psf_log_printf (psf, "  version    : %d *** (should be version 1)\n", psf->peak_info->version) ;
 1230|  2.15k|	else
 1231|  2.15k|		psf_log_printf (psf, "  version    : %d\n", psf->peak_info->version) ;
 1232|       |
 1233|  6.78k|	psf_log_printf (psf, "  time stamp : %d\n", psf->peak_info->timestamp) ;
 1234|  6.78k|	psf_log_printf (psf, "    Ch   Position       Value\n") ;
 1235|       |
 1236|  26.3k|	for (uk = 0 ; uk < (uint32_t) psf->sf.channels ; uk++)
  ------------------
  |  Branch (1236:16): [True: 19.5k, False: 6.78k]
  ------------------
 1237|  19.5k|	{	float value ;
 1238|  19.5k|		uint32_t position ;
 1239|       |
 1240|  19.5k|		psf_binheader_readf (psf, "f4", &value, &position) ;
 1241|  19.5k|		psf->peak_info->peaks [uk].value = value ;
 1242|  19.5k|		psf->peak_info->peaks [uk].position = position ;
 1243|       |
 1244|  19.5k|		snprintf (buffer, sizeof (buffer), "    %2d   %-12" PRId64 "   %g\n",
 1245|  19.5k|				uk, psf->peak_info->peaks [uk].position, psf->peak_info->peaks [uk].value) ;
 1246|  19.5k|		buffer [sizeof (buffer) - 1] = 0 ;
 1247|  19.5k|		psf_log_printf (psf, "%s", buffer) ;
 1248|  19.5k|		} ;
 1249|       |
 1250|  6.78k|	return 0 ;
 1251|  6.78k|} /* wavlike_read_peak_chunk */
wavlike.c:wavex_guid_equal:
  118|   115k|{	return !memcmp (first, second, sizeof (EXT_SUBFORMAT)) ;
  119|   115k|} /* wavex_guid_equal */
wavlike.c:exif_subchunk_parse:
 1293|  43.2k|{	uint32_t marker, dword = 0, vmajor = -1, vminor = -1, bytesread = 0 ;
 1294|  43.2k|	char buf [4096] ;
 1295|  43.2k|	int thisread ;
 1296|       |
 1297|   607k|	while (bytesread < length)
  ------------------
  |  Branch (1297:9): [True: 604k, False: 2.62k]
  ------------------
 1298|   604k|	{
 1299|   604k|		if ((thisread = psf_binheader_readf (psf, "m", &marker)) == 0)
  ------------------
  |  Branch (1299:7): [True: 133, False: 604k]
  ------------------
 1300|    133|			break ;
 1301|   604k|		bytesread += thisread ;
 1302|       |
 1303|   604k|		switch (marker)
 1304|   604k|		{
 1305|  87.1k|			case 0 : /* camera padding? */
  ------------------
  |  Branch (1305:4): [True: 87.1k, False: 517k]
  ------------------
 1306|  87.1k|				break ;
 1307|       |
 1308|  1.21k|			case ever_MARKER :
  ------------------
  |  |   59|  1.21k|#define ever_MARKER		MAKE_MARKER ('e', 'v', 'e', 'r')
  |  |  ------------------
  |  |  |  |  122|  1.21k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (1308:4): [True: 1.21k, False: 603k]
  ------------------
 1309|  1.21k|				bytesread += psf_binheader_readf (psf, "j4", 4, &dword) ;
 1310|  1.21k|				vmajor = 10 * (((dword >> 24) & 0xff) - '0') + (((dword >> 16) & 0xff) - '0') ;
 1311|  1.21k|				vminor = 10 * (((dword >> 8) & 0xff) - '0') + ((dword & 0xff) - '0') ;
 1312|  1.21k|				psf_log_printf (psf, "    EXIF Version : %u.%02u\n", vmajor, vminor) ;
 1313|  1.21k|				break ;
 1314|       |
 1315|  4.16k|			case olym_MARKER :
  ------------------
  |  |   66|  4.16k|#define olym_MARKER		MAKE_MARKER ('o', 'l', 'y', 'm')
  |  |  ------------------
  |  |  |  |  122|  4.16k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (1315:4): [True: 4.16k, False: 600k]
  ------------------
 1316|  4.16k|				bytesread += psf_binheader_readf (psf, "4", &dword) ;
 1317|  4.16k|				psf_log_printf (psf, "%M : %u\n", marker, dword) ;
 1318|  4.16k|				if (dword > length || bytesread + dword > length)
  ------------------
  |  Branch (1318:9): [True: 1.29k, False: 2.87k]
  |  Branch (1318:27): [True: 1.47k, False: 1.40k]
  ------------------
 1319|  2.76k|					break ;
 1320|  1.40k|				dword += (dword & 1) ;
 1321|  1.40k|				bytesread += psf_binheader_readf (psf, "j", dword) ;
 1322|  1.40k|				break ;
 1323|       |
 1324|  8.86k|			case emnt_MARKER : /* design information: null-terminated string */
  ------------------
  |  |   63|  8.86k|#define emnt_MARKER		MAKE_MARKER ('e', 'm', 'n', 't')
  |  |  ------------------
  |  |  |  |  122|  8.86k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (1324:4): [True: 8.86k, False: 595k]
  ------------------
 1325|  79.5k|			case emdl_MARKER : /* model name ; null-terminated string */
  ------------------
  |  |   62|  79.5k|#define emdl_MARKER		MAKE_MARKER ('e', 'm', 'd', 'l')
  |  |  ------------------
  |  |  |  |  122|  79.5k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (1325:4): [True: 70.6k, False: 533k]
  ------------------
 1326|  80.0k|			case ecor_MARKER : /* manufacturer: null-terminated string */
  ------------------
  |  |   61|  80.0k|#define ecor_MARKER		MAKE_MARKER ('e', 'c', 'o', 'r')
  |  |  ------------------
  |  |  |  |  122|  80.0k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (1326:4): [True: 536, False: 603k]
  ------------------
 1327|  80.5k|			case etim_MARKER : /* creation time: null-terminated string in the format "hour:minute:second.subsecond" */
  ------------------
  |  |   60|  80.5k|#define etim_MARKER		MAKE_MARKER ('e', 't', 'i', 'm')
  |  |  ------------------
  |  |  |  |  122|  80.5k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (1327:4): [True: 482, False: 603k]
  ------------------
 1328|  81.1k|			case erel_MARKER : /* relation info: null-terminated string (filename) */
  ------------------
  |  |   64|  81.1k|#define erel_MARKER		MAKE_MARKER ('e', 'r', 'e', 'l')
  |  |  ------------------
  |  |  |  |  122|  81.1k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (1328:4): [True: 620, False: 603k]
  ------------------
 1329|  81.4k|			case eucm_MARKER : /* user comment: 4-byte size follows, then possibly unicode data */
  ------------------
  |  |   65|  81.4k|#define eucm_MARKER		MAKE_MARKER ('e', 'u', 'c', 'm')
  |  |  ------------------
  |  |  |  |  122|  81.4k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (1329:4): [True: 325, False: 604k]
  ------------------
 1330|  81.4k|				bytesread += psf_binheader_readf (psf, "4", &dword) ;
 1331|  81.4k|				bytesread += sizeof (dword) ;
 1332|  81.4k|				dword += (dword & 1) ;
 1333|       |
 1334|  81.4k|				if (dword >= sizeof (buf))
  ------------------
  |  Branch (1334:9): [True: 39.1k, False: 42.3k]
  ------------------
 1335|  39.1k|				{	psf_log_printf (psf, "*** Marker '%M' is too big %u\n\n", marker, dword) ;
 1336|  39.1k|					return bytesread ;
 1337|  42.3k|					} ;
 1338|       |
 1339|  42.3k|				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|  42.3k|				if (marker == emdl_MARKER && dword == strlen (buf) /* should be >= strlen+1*/)
  ------------------
  |  |   62|  42.3k|#define emdl_MARKER		MAKE_MARKER ('e', 'm', 'd', 'l')
  |  |  ------------------
  |  |  |  |  122|  84.6k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (1344:9): [True: 40.9k, False: 1.33k]
  |  Branch (1344:34): [True: 12.6k, False: 28.3k]
  ------------------
 1345|  12.6k|				{	psf_log_printf (psf, "    *** field size too small for string (sinking 2 bytes)\n") ;
 1346|  12.6k|					bytesread += psf_binheader_readf (psf, "j", 2) ;
 1347|  12.6k|					} ;
 1348|       |
 1349|  42.3k|				psf_log_printf (psf, "    %M : %u (%s)\n", marker, dword, buf) ;
 1350|  42.3k|				if (dword > length)
  ------------------
  |  Branch (1350:9): [True: 1.35k, False: 40.9k]
  ------------------
 1351|  1.35k|					return bytesread ;
 1352|  40.9k|				break ;
 1353|       |
 1354|   430k|			default :
  ------------------
  |  Branch (1354:4): [True: 430k, False: 173k]
  ------------------
 1355|   430k|				psf_log_printf (psf, "    *** %M (%u): -- ignored --\n", marker, marker) ;
 1356|   430k|				break ;
 1357|   604k|			} ;
 1358|   563k|		} ;
 1359|       |
 1360|  2.75k|	return bytesread ;
 1361|  43.2k|} /* exif_subchunk_parse */
wavlike.c:exif_fill_and_sink:
 1271|  42.3k|{
 1272|  42.3k|	size_t bytesread = 0 ;
 1273|       |
 1274|  42.3k|	buf [0] = 0 ;
 1275|  42.3k|	bufsz -= 1 ;
 1276|  42.3k|	if (toread < bufsz)
  ------------------
  |  Branch (1276:6): [True: 42.3k, False: 0]
  ------------------
 1277|  42.3k|		bufsz = toread ;
 1278|  42.3k|	bytesread = psf_binheader_readf (psf, "b", buf, bufsz) ;
 1279|  42.3k|	buf [bufsz] = 0 ;
 1280|       |
 1281|  42.3k|	if (bytesread == bufsz && toread > bufsz)
  ------------------
  |  Branch (1281:6): [True: 42.2k, False: 37]
  |  Branch (1281:28): [True: 0, False: 42.2k]
  ------------------
 1282|      0|		bytesread += psf_binheader_readf (psf, "j", toread - bufsz) ;
 1283|       |
 1284|  42.3k|	return bytesread ;
 1285|  42.3k|} /* exif_fill_and_sink */

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

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

