LLVMFuzzerTestOneInput:
   28|  19.8k|{   VIO_DATA vio_data ;
   29|  19.8k|    SF_VIRTUAL_IO vio ;
   30|  19.8k|    SF_INFO sndfile_info ;
   31|  19.8k|    SNDFILE *sndfile = NULL ;
   32|  19.8k|    short *read_buffer = NULL ;
   33|       |
   34|  19.8k|    if (size < 1)
  ------------------
  |  Branch (34:9): [True: 0, False: 19.8k]
  ------------------
   35|      0|      return 0 ;
   36|       |
   37|  19.8k|    int fmt = formats[data[0] % (sizeof(formats) / sizeof(formats[0]))] ;
   38|  19.8k|    data += 1 ; size -= 1 ;
   39|       |
   40|  19.8k|    vio.get_filelen = vfget_filelen ;
   41|  19.8k|    vio.seek = vfseek ;
   42|  19.8k|    vio.read = vfread ;
   43|  19.8k|    vio.write = vfwrite ;
   44|  19.8k|    vio.tell = vftell ;
   45|       |
   46|  19.8k|    vio_data.data = data ;
   47|  19.8k|    vio_data.length = size ;
   48|  19.8k|    vio_data.offset = 0 ;
   49|       |
   50|  19.8k|    memset(&sndfile_info, 0, sizeof(SF_INFO)) ;
   51|  19.8k|    sndfile_info.format = fmt ;
   52|  19.8k|    sndfile_info.channels = 1 ;
   53|  19.8k|    sndfile_info.samplerate = 8000 ;
   54|       |
   55|  19.8k|    sndfile = sf_open_virtual(&vio, SFM_READ, &sndfile_info, &vio_data) ;
   56|  19.8k|    if (sndfile == NULL)
  ------------------
  |  Branch (56:9): [True: 16.1k, False: 3.63k]
  ------------------
   57|  16.1k|      return 0 ;
   58|       |
   59|  3.63k|    if (sndfile_info.channels < 1 || sndfile_info.channels > 1024)
  ------------------
  |  Branch (59:9): [True: 0, False: 3.63k]
  |  Branch (59:38): [True: 0, False: 3.63k]
  ------------------
   60|      0|      goto EXIT_LABEL ;
   61|       |
   62|  3.63k|    read_buffer = (short *) malloc(sizeof(short) * sndfile_info.channels) ;
   63|  3.63k|    if (read_buffer == NULL)
  ------------------
  |  Branch (63:9): [True: 0, False: 3.63k]
  ------------------
   64|      0|      goto EXIT_LABEL ;
   65|       |
   66|       |    // Cap the read loop: some headerless RAW sub-formats can otherwise decode
   67|       |    // far more frames than the input bytes (e.g. via back-seeks), which reads
   68|       |    // as a fuzzing timeout rather than a finding.
   69|   103M|    for (long i = 0 ; i < (1L << 20) ; i++)
  ------------------
  |  Branch (69:23): [True: 103M, False: 34]
  ------------------
   70|   103M|    {
   71|   103M|      if (sf_readf_short(sndfile, read_buffer, 1) == 0)
  ------------------
  |  Branch (71:11): [True: 3.59k, False: 103M]
  ------------------
   72|  3.59k|        break ;
   73|   103M|    }
   74|       |
   75|  3.63k|EXIT_LABEL:
   76|       |
   77|  3.63k|    if (sndfile != NULL)
  ------------------
  |  Branch (77:9): [True: 3.63k, False: 0]
  ------------------
   78|  3.63k|      sf_close(sndfile) ;
   79|       |
   80|  3.63k|    free(read_buffer) ;
   81|       |
   82|  3.63k|    return 0 ;
   83|  3.63k|}

sndfile_fmt_fuzzer.cc:_ZL13vfget_filelenPv:
   14|  21.5k|{  VIO_DATA *vf = (VIO_DATA *)user_data ;
   15|  21.5k|   return vf->length ;
   16|  21.5k|}
sndfile_fmt_fuzzer.cc:_ZL6vfseekliPv:
   19|   172k|{
   20|   172k|  VIO_DATA *vf = (VIO_DATA *)user_data ;
   21|   172k|  sf_count_t new_offset ;
   22|       |
   23|   172k|  switch (whence)
   24|   172k|  {   case SEEK_SET :
  ------------------
  |  Branch (24:7): [True: 15.6k, False: 156k]
  ------------------
   25|  15.6k|        new_offset = offset ;
   26|  15.6k|        break ;
   27|       |
   28|   156k|    case SEEK_CUR :
  ------------------
  |  Branch (28:5): [True: 156k, False: 15.6k]
  ------------------
   29|   156k|        new_offset = vf->offset + offset ;
   30|   156k|        break ;
   31|       |
   32|      0|    case SEEK_END :
  ------------------
  |  Branch (32:5): [True: 0, False: 172k]
  ------------------
   33|      0|        new_offset = vf->length + offset ;
   34|      0|        break ;
   35|       |
   36|      0|    default :
  ------------------
  |  Branch (36:5): [True: 0, False: 172k]
  ------------------
   37|       |        // SEEK_DATA and SEEK_HOLE are not supported by this function.
   38|      0|        errno = EINVAL ;
   39|      0|        return -1 ;
   40|      0|        break ;
   41|   172k|  }
   42|       |
   43|       |  /* Ensure you can't seek outside the data */
   44|   172k|  if (new_offset > vf->length)
  ------------------
  |  Branch (44:7): [True: 3.99k, False: 168k]
  ------------------
   45|  3.99k|  {  /* Trying to seek past the end of the data */
   46|  3.99k|     printf("vf overseek: new_offset(%" PRId64 ") > vf->length(%" PRId64 ");"
   47|  3.99k|            "  whence(%d), vf->offset(%" PRId64 "), offset(%" PRId64 ")\n",
   48|  3.99k|            new_offset, vf->length, whence, vf->offset, offset) ;
   49|  3.99k|     new_offset = vf->length ;
   50|  3.99k|  }
   51|   168k|  else if (new_offset < 0)
  ------------------
  |  Branch (51:12): [True: 61.1k, False: 107k]
  ------------------
   52|  61.1k|  {  /* Trying to seek before the start of the data */
   53|  61.1k|     printf("vf underseek: new_offset(%" PRId64 ") < 0;  whence(%d), vf->offset"
   54|  61.1k|            "(%" PRId64 "), vf->length(%" PRId64 "), offset(%" PRId64 ")\n",
   55|  61.1k|            new_offset, whence, vf->offset, vf->length, offset) ;
   56|  61.1k|     new_offset = 0 ;
   57|  61.1k|  }
   58|   172k|  vf->offset = new_offset ;
   59|       |
   60|   172k|  return vf->offset ;
   61|   172k|}
sndfile_fmt_fuzzer.cc:_ZL6vfreadPvlS_:
   64|  10.3M|{  VIO_DATA *vf = (VIO_DATA *)user_data ;
   65|       |
   66|  10.3M|   if (vf->offset + count > vf->length)
  ------------------
  |  Branch (66:8): [True: 6.23M, False: 4.15M]
  ------------------
   67|  6.23M|     count = vf->length - vf->offset ;
   68|       |
   69|  10.3M|   memcpy(ptr, vf->data + vf->offset, count) ;
   70|  10.3M|   vf->offset += count ;
   71|       |
   72|  10.3M|   return count ;
   73|  10.3M|}
sndfile_fmt_fuzzer.cc:_ZL6vftellPv:
   86|  1.09M|{ VIO_DATA *vf = (VIO_DATA *)user_data ;
   87|       |
   88|  1.09M|  return vf->offset ;
   89|  1.09M|}

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

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

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

unpc_block:
   56|  7.05k|{
   57|  7.05k|	register int16_t	a0, a1, a2, a3 ;
   58|  7.05k|	register int32_t	b0, b1, b2, b3 ;
   59|  7.05k|	int32_t					j, k, lim ;
   60|  7.05k|	int32_t				sum1, sg, sgn, top, dd ;
   61|  7.05k|	int32_t *			pout ;
   62|  7.05k|	int32_t				del, del0 ;
   63|  7.05k|	uint32_t			chanshift = 32 - chanbits ;
   64|  7.05k|	int32_t				denhalf = denshift ? 1 << (denshift - 1) : 0 ;
  ------------------
  |  Branch (64:23): [True: 1.64k, False: 5.41k]
  ------------------
   65|       |
   66|  7.05k|	out [0] = pc1 [0] ;
   67|  7.05k|	if (numactive == 0)
  ------------------
  |  Branch (67:6): [True: 3.60k, False: 3.44k]
  ------------------
   68|  3.60k|	{
   69|       |		// just copy if numactive == 0 (but don't bother if in/out pointers the same)
   70|  3.60k|		if ((num > 1) && (pc1 != out))
  ------------------
  |  Branch (70:7): [True: 1.51k, False: 2.09k]
  |  Branch (70:20): [True: 1.51k, False: 0]
  ------------------
   71|  1.51k|			memcpy (&out [1], &pc1 [1], (num - 1) * sizeof (int32_t)) ;
   72|  3.60k|		return ;
   73|  3.60k|	}
   74|  3.44k|	if (numactive == 31)
  ------------------
  |  Branch (74:6): [True: 1.70k, False: 1.73k]
  ------------------
   75|  1.70k|	{
   76|       |		// short-circuit if numactive == 31
   77|  1.70k|		int32_t		prev ;
   78|       |
   79|       |		/*	this code is written such that the in/out buffers can be the same
   80|       |			to conserve buffer space on embedded devices like the iPod
   81|       |
   82|       |			(original code)
   83|       |			for (j = 1 ; j < num ; j++)
   84|       |				del = pc1 [j] + out [j-1] ;
   85|       |				out [j] = (del << chanshift) >> chanshift ;
   86|       |		*/
   87|  1.70k|		prev = out [0] ;
   88|   129k|		for (j = 1 ; j < num ; j++)
  ------------------
  |  Branch (88:16): [True: 127k, False: 1.70k]
  ------------------
   89|   127k|		{
   90|   127k|			del = pc1 [j] + prev ;
   91|   127k|			prev = (del << chanshift) >> chanshift ;
   92|   127k|			out [j] = prev ;
   93|   127k|		}
   94|  1.70k|		return ;
   95|  1.70k|	}
   96|       |
   97|  20.8k|	for (j = 1 ; j <= numactive ; j++)
  ------------------
  |  Branch (97:15): [True: 19.0k, False: 1.73k]
  ------------------
   98|  19.0k|	{
   99|  19.0k|		del = pc1 [j] + out [j-1] ;
  100|  19.0k|		out [j] = arith_shift_left (del, chanshift) >> chanshift ;
  101|  19.0k|	}
  102|       |
  103|  1.73k|	lim = numactive + 1 ;
  104|       |
  105|  1.73k|	if (numactive == 4)
  ------------------
  |  Branch (105:6): [True: 315, False: 1.42k]
  ------------------
  106|    315|	{
  107|       |		// optimization for numactive == 4
  108|    315|		register int16_t	ia0, ia1, ia2, ia3 ;
  109|    315|		register int32_t	ib0, ib1, ib2, ib3 ;
  110|       |
  111|    315|		ia0 = coefs [0] ;
  112|    315|		ia1 = coefs [1] ;
  113|    315|		ia2 = coefs [2] ;
  114|    315|		ia3 = coefs [3] ;
  115|       |
  116|  59.3k|		for (j = lim ; j < num ; j++)
  ------------------
  |  Branch (116:18): [True: 59.0k, False: 315]
  ------------------
  117|  59.0k|		{
  118|  59.0k|			LOOP_ALIGN
  119|       |
  120|  59.0k|			top = out [j - lim] ;
  121|  59.0k|			pout = out + j - 1 ;
  122|       |
  123|  59.0k|			ib0 = top - pout [0] ;
  124|  59.0k|			ib1 = top - pout [-1] ;
  125|  59.0k|			ib2 = top - pout [-2] ;
  126|  59.0k|			ib3 = top - pout [-3] ;
  127|       |
  128|  59.0k|			sum1 = (denhalf - ia0 * ib0 - ia1 * ib1 - ia2 * ib2 - ia3 * ib3) >> denshift ;
  129|       |
  130|  59.0k|			del = pc1 [j] ;
  131|  59.0k|			del0 = del ;
  132|  59.0k|			sg = sign_of_int (del) ;
  133|  59.0k|			del += top + sum1 ;
  134|       |
  135|  59.0k|			out [j] = arith_shift_left (del, chanshift) >> chanshift ;
  136|       |
  137|  59.0k|			if (sg > 0)
  ------------------
  |  Branch (137:8): [True: 11.4k, False: 47.5k]
  ------------------
  138|  11.4k|			{
  139|  11.4k|				sgn = sign_of_int (ib3) ;
  140|  11.4k|				ia3 -= sgn ;
  141|  11.4k|				del0 -= (4 - 3) * ((sgn * ib3) >> denshift) ;
  142|  11.4k|				if (del0 <= 0)
  ------------------
  |  Branch (142:9): [True: 6.55k, False: 4.86k]
  ------------------
  143|  6.55k|					continue ;
  144|       |
  145|  4.86k|				sgn = sign_of_int (ib2) ;
  146|  4.86k|				ia2 -= sgn ;
  147|  4.86k|				del0 -= (4 - 2) * ((sgn * ib2) >> denshift) ;
  148|  4.86k|				if (del0 <= 0)
  ------------------
  |  Branch (148:9): [True: 1.36k, False: 3.49k]
  ------------------
  149|  1.36k|					continue ;
  150|       |
  151|  3.49k|				sgn = sign_of_int (ib1) ;
  152|  3.49k|				ia1 -= sgn ;
  153|  3.49k|				del0 -= (4 - 1) * ((sgn * ib1) >> denshift) ;
  154|  3.49k|				if (del0 <= 0)
  ------------------
  |  Branch (154:9): [True: 939, False: 2.56k]
  ------------------
  155|    939|					continue ;
  156|       |
  157|  2.56k|				ia0 -= sign_of_int (ib0) ;
  158|  2.56k|			}
  159|  47.5k|			else if (sg < 0)
  ------------------
  |  Branch (159:13): [True: 20.5k, False: 27.0k]
  ------------------
  160|  20.5k|			{
  161|       |				// note: to avoid unnecessary negations, we flip the value of "sgn"
  162|  20.5k|				sgn = -sign_of_int (ib3) ;
  163|  20.5k|				ia3 -= sgn ;
  164|  20.5k|				del0 -= (4 - 3) * ((sgn * ib3) >> denshift) ;
  165|  20.5k|				if (del0 >= 0)
  ------------------
  |  Branch (165:9): [True: 13.0k, False: 7.53k]
  ------------------
  166|  13.0k|					continue ;
  167|       |
  168|  7.53k|				sgn = -sign_of_int (ib2) ;
  169|  7.53k|				ia2 -= sgn ;
  170|  7.53k|				del0 -= (4 - 2) * ((sgn * ib2) >> denshift) ;
  171|  7.53k|				if (del0 >= 0)
  ------------------
  |  Branch (171:9): [True: 1.93k, False: 5.60k]
  ------------------
  172|  1.93k|					continue ;
  173|       |
  174|  5.60k|				sgn = -sign_of_int (ib1) ;
  175|  5.60k|				ia1 -= sgn ;
  176|  5.60k|				del0 -= (4 - 1) * ((sgn * ib1) >> denshift) ;
  177|  5.60k|				if (del0 >= 0)
  ------------------
  |  Branch (177:9): [True: 1.66k, False: 3.94k]
  ------------------
  178|  1.66k|					continue ;
  179|       |
  180|  3.94k|				ia0 += sign_of_int (ib0) ;
  181|  3.94k|			}
  182|  59.0k|		}
  183|       |
  184|    315|		coefs [0] = ia0 ;
  185|    315|		coefs [1] = ia1 ;
  186|    315|		coefs [2] = ia2 ;
  187|    315|		coefs [3] = ia3 ;
  188|    315|	}
  189|  1.42k|	else if (numactive == 8)
  ------------------
  |  Branch (189:11): [True: 308, False: 1.11k]
  ------------------
  190|    308|	{
  191|    308|		register int16_t	a4, a5, a6, a7 ;
  192|    308|		register int32_t	b4, b5, b6, b7 ;
  193|       |
  194|       |		// optimization for numactive == 8
  195|    308|		a0 = coefs [0] ;
  196|    308|		a1 = coefs [1] ;
  197|    308|		a2 = coefs [2] ;
  198|    308|		a3 = coefs [3] ;
  199|    308|		a4 = coefs [4] ;
  200|    308|		a5 = coefs [5] ;
  201|    308|		a6 = coefs [6] ;
  202|    308|		a7 = coefs [7] ;
  203|       |
  204|  65.1k|		for (j = lim ; j < num ; j++)
  ------------------
  |  Branch (204:18): [True: 64.8k, False: 308]
  ------------------
  205|  64.8k|		{
  206|  64.8k|			LOOP_ALIGN
  207|       |
  208|  64.8k|			top = out [j - lim] ;
  209|  64.8k|			pout = out + j - 1 ;
  210|       |
  211|  64.8k|			b0 = top - (*pout--) ;
  212|  64.8k|			b1 = top - (*pout--) ;
  213|  64.8k|			b2 = top - (*pout--) ;
  214|  64.8k|			b3 = top - (*pout--) ;
  215|  64.8k|			b4 = top - (*pout--) ;
  216|  64.8k|			b5 = top - (*pout--) ;
  217|  64.8k|			b6 = top - (*pout--) ;
  218|  64.8k|			b7 = top - (*pout) ;
  219|  64.8k|			pout += 8 ;
  220|       |
  221|  64.8k|			sum1 = (denhalf - a0 * b0 - a1 * b1 - a2 * b2 - a3 * b3
  222|  64.8k|					- a4 * b4 - a5 * b5 - a6 * b6 - a7 * b7) >> denshift ;
  223|       |
  224|  64.8k|			del = pc1 [j] ;
  225|  64.8k|			del0 = del ;
  226|  64.8k|			sg = sign_of_int (del) ;
  227|  64.8k|			del += top + sum1 ;
  228|       |
  229|  64.8k|			out [j] = arith_shift_left (del, chanshift) >> chanshift ;
  230|       |
  231|  64.8k|			if (sg > 0)
  ------------------
  |  Branch (231:8): [True: 22.8k, False: 42.0k]
  ------------------
  232|  22.8k|			{
  233|  22.8k|				sgn = sign_of_int (b7) ;
  234|  22.8k|				a7 -= sgn ;
  235|  22.8k|				del0 -= 1 * ((sgn * b7) >> denshift) ;
  236|  22.8k|				if (del0 <= 0)
  ------------------
  |  Branch (236:9): [True: 7.89k, False: 14.9k]
  ------------------
  237|  7.89k|					continue ;
  238|       |
  239|  14.9k|				sgn = sign_of_int (b6) ;
  240|  14.9k|				a6 -= sgn ;
  241|  14.9k|				del0 -= 2 * ((sgn * b6) >> denshift) ;
  242|  14.9k|				if (del0 <= 0)
  ------------------
  |  Branch (242:9): [True: 4.28k, False: 10.6k]
  ------------------
  243|  4.28k|					continue ;
  244|       |
  245|  10.6k|				sgn = sign_of_int (b5) ;
  246|  10.6k|				a5 -= sgn ;
  247|  10.6k|				del0 -= 3 * ((sgn * b5) >> denshift) ;
  248|  10.6k|				if (del0 <= 0)
  ------------------
  |  Branch (248:9): [True: 2.73k, False: 7.90k]
  ------------------
  249|  2.73k|					continue ;
  250|       |
  251|  7.90k|				sgn = sign_of_int (b4) ;
  252|  7.90k|				a4 -= sgn ;
  253|  7.90k|				del0 -= 4 * ((sgn * b4) >> denshift) ;
  254|  7.90k|				if (del0 <= 0)
  ------------------
  |  Branch (254:9): [True: 1.26k, False: 6.64k]
  ------------------
  255|  1.26k|					continue ;
  256|       |
  257|  6.64k|				sgn = sign_of_int (b3) ;
  258|  6.64k|				a3 -= sgn ;
  259|  6.64k|				del0 -= 5 * ((sgn * b3) >> denshift) ;
  260|  6.64k|				if (del0 <= 0)
  ------------------
  |  Branch (260:9): [True: 1.35k, False: 5.29k]
  ------------------
  261|  1.35k|					continue ;
  262|       |
  263|  5.29k|				sgn = sign_of_int (b2) ;
  264|  5.29k|				a2 -= sgn ;
  265|  5.29k|				del0 -= 6 * ((sgn * b2) >> denshift) ;
  266|  5.29k|				if (del0 <= 0)
  ------------------
  |  Branch (266:9): [True: 881, False: 4.41k]
  ------------------
  267|    881|					continue ;
  268|       |
  269|  4.41k|				sgn = sign_of_int (b1) ;
  270|  4.41k|				a1 -= sgn ;
  271|  4.41k|				del0 -= 7 * ((sgn * b1) >> denshift) ;
  272|  4.41k|				if (del0 <= 0)
  ------------------
  |  Branch (272:9): [True: 584, False: 3.82k]
  ------------------
  273|    584|					continue ;
  274|       |
  275|  3.82k|				a0 -= sign_of_int (b0) ;
  276|  3.82k|			}
  277|  42.0k|			else if (sg < 0)
  ------------------
  |  Branch (277:13): [True: 33.2k, False: 8.79k]
  ------------------
  278|  33.2k|			{
  279|       |				// note: to avoid unnecessary negations, we flip the value of "sgn"
  280|  33.2k|				sgn = -sign_of_int (b7) ;
  281|  33.2k|				a7 -= sgn ;
  282|  33.2k|				del0 -= 1 * ((sgn * b7) >> denshift) ;
  283|  33.2k|				if (del0 >= 0)
  ------------------
  |  Branch (283:9): [True: 15.4k, False: 17.8k]
  ------------------
  284|  15.4k|					continue ;
  285|       |
  286|  17.8k|				sgn = -sign_of_int (b6) ;
  287|  17.8k|				a6 -= sgn ;
  288|  17.8k|				del0 -= 2 * ((sgn * b6) >> denshift) ;
  289|  17.8k|				if (del0 >= 0)
  ------------------
  |  Branch (289:9): [True: 6.08k, False: 11.7k]
  ------------------
  290|  6.08k|					continue ;
  291|       |
  292|  11.7k|				sgn = -sign_of_int (b5) ;
  293|  11.7k|				a5 -= sgn ;
  294|  11.7k|				del0 -= 3 * ((sgn * b5) >> denshift) ;
  295|  11.7k|				if (del0 >= 0)
  ------------------
  |  Branch (295:9): [True: 3.68k, False: 8.04k]
  ------------------
  296|  3.68k|					continue ;
  297|       |
  298|  8.04k|				sgn = -sign_of_int (b4) ;
  299|  8.04k|				a4 -= sgn ;
  300|  8.04k|				del0 -= 4 * ((sgn * b4) >> denshift) ;
  301|  8.04k|				if (del0 >= 0)
  ------------------
  |  Branch (301:9): [True: 2.46k, False: 5.57k]
  ------------------
  302|  2.46k|					continue ;
  303|       |
  304|  5.57k|				sgn = -sign_of_int (b3) ;
  305|  5.57k|				a3 -= sgn ;
  306|  5.57k|				del0 -= 5 * ((sgn * b3) >> denshift) ;
  307|  5.57k|				if (del0 >= 0)
  ------------------
  |  Branch (307:9): [True: 1.63k, False: 3.93k]
  ------------------
  308|  1.63k|					continue ;
  309|       |
  310|  3.93k|				sgn = -sign_of_int (b2) ;
  311|  3.93k|				a2 -= sgn ;
  312|  3.93k|				del0 -= 6 * ((sgn * b2) >> denshift) ;
  313|  3.93k|				if (del0 >= 0)
  ------------------
  |  Branch (313:9): [True: 895, False: 3.04k]
  ------------------
  314|    895|					continue ;
  315|       |
  316|  3.04k|				sgn = -sign_of_int (b1) ;
  317|  3.04k|				a1 -= sgn ;
  318|  3.04k|				del0 -= 7 * ((sgn * b1) >> denshift) ;
  319|  3.04k|				if (del0 >= 0)
  ------------------
  |  Branch (319:9): [True: 733, False: 2.31k]
  ------------------
  320|    733|					continue ;
  321|       |
  322|  2.31k|				a0 += sign_of_int (b0) ;
  323|  2.31k|			}
  324|  64.8k|		}
  325|       |
  326|    308|		coefs [0] = a0 ;
  327|    308|		coefs [1] = a1 ;
  328|    308|		coefs [2] = a2 ;
  329|    308|		coefs [3] = a3 ;
  330|    308|		coefs [4] = a4 ;
  331|    308|		coefs [5] = a5 ;
  332|    308|		coefs [6] = a6 ;
  333|    308|		coefs [7] = a7 ;
  334|    308|	}
  335|  1.11k|	else
  336|  1.11k|	{
  337|       |		// general case
  338|  45.0k|		for (j = lim ; j < num ; j++)
  ------------------
  |  Branch (338:18): [True: 43.9k, False: 1.11k]
  ------------------
  339|  43.9k|		{
  340|  43.9k|			LOOP_ALIGN
  341|       |
  342|  43.9k|			sum1 = 0 ;
  343|  43.9k|			pout = out + j - 1 ;
  344|  43.9k|			top = out [j-lim] ;
  345|       |
  346|   542k|			for (k = 0 ; k < numactive ; k++)
  ------------------
  |  Branch (346:17): [True: 498k, False: 43.9k]
  ------------------
  347|   498k|				sum1 += coefs [k] * (pout [-k] - top) ;
  348|       |
  349|  43.9k|			del = pc1 [j] ;
  350|  43.9k|			del0 = del ;
  351|  43.9k|			sg = sign_of_int (del) ;
  352|  43.9k|			del += top + ((sum1 + denhalf) >> denshift) ;
  353|  43.9k|			out [j] = (del << chanshift) >> chanshift ;
  354|       |
  355|  43.9k|			if (sg > 0)
  ------------------
  |  Branch (355:8): [True: 10.2k, False: 33.6k]
  ------------------
  356|  10.2k|			{
  357|   100k|				for (k = (numactive - 1) ; k >= 0 ; k--)
  ------------------
  |  Branch (357:32): [True: 94.1k, False: 6.39k]
  ------------------
  358|  94.1k|				{
  359|  94.1k|					dd = top - pout [-k] ;
  360|  94.1k|					sgn = sign_of_int (dd) ;
  361|  94.1k|					coefs [k] -= sgn ;
  362|  94.1k|					del0 -= (numactive - k) * ((sgn * dd) >> denshift) ;
  363|  94.1k|					if (del0 <= 0)
  ------------------
  |  Branch (363:10): [True: 3.87k, False: 90.2k]
  ------------------
  364|  3.87k|						break ;
  365|  94.1k|				}
  366|  10.2k|			}
  367|  33.6k|			else if (sg < 0)
  ------------------
  |  Branch (367:13): [True: 18.8k, False: 14.7k]
  ------------------
  368|  18.8k|			{
  369|  70.3k|				for (k = (numactive - 1) ; k >= 0 ; k--)
  ------------------
  |  Branch (369:32): [True: 65.8k, False: 4.57k]
  ------------------
  370|  65.8k|				{
  371|  65.8k|					dd = top - pout [-k] ;
  372|  65.8k|					sgn = sign_of_int (dd) ;
  373|  65.8k|					coefs [k] += sgn ;
  374|  65.8k|					del0 -= (numactive - k) * ((-sgn * dd) >> denshift) ;
  375|  65.8k|					if (del0 >= 0)
  ------------------
  |  Branch (375:10): [True: 14.2k, False: 51.5k]
  ------------------
  376|  14.2k|						break ;
  377|  65.8k|				}
  378|  18.8k|			}
  379|  43.9k|		}
  380|  1.11k|	}
  381|  1.73k|}
dp_dec.c:sign_of_int:
   47|   549k|{
   48|   549k|	int32_t negishift ;
   49|       |
   50|   549k|	negishift = ((uint32_t) - i) >> 31 ;
   51|   549k|	return negishift | (i >> 31) ;
   52|   549k|}

unmix16:
   66|    138|{
   67|    138|	int32_t 	j ;
   68|       |
   69|    138|	if (mixres != 0)
  ------------------
  |  Branch (69:6): [True: 64, False: 74]
  ------------------
   70|     64|	{
   71|       |		/* matrixed stereo */
   72|  1.85k|		for (j = 0 ; j < numSamples ; j++)
  ------------------
  |  Branch (72:16): [True: 1.78k, False: 64]
  ------------------
   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|     64|	}
   84|     74|	else
   85|     74|	{
   86|       |		/* Conventional separated stereo. */
   87|  4.43k|		for (j = 0 ; j < numSamples ; j++)
  ------------------
  |  Branch (87:16): [True: 4.36k, False: 74]
  ------------------
   88|  4.36k|		{
   89|  4.36k|			out [0] = arith_shift_left (u [j], 16) ;
   90|  4.36k|			out [1] = arith_shift_left (v [j], 16) ;
   91|  4.36k|			out += stride ;
   92|  4.36k|		}
   93|     74|	}
   94|    138|}
unmix20:
  101|    157|{
  102|    157|	int32_t 	j ;
  103|       |
  104|    157|	if (mixres != 0)
  ------------------
  |  Branch (104:6): [True: 89, False: 68]
  ------------------
  105|     89|	{
  106|       |		/* matrixed stereo */
  107|  1.63k|		for (j = 0 ; j < numSamples ; j++)
  ------------------
  |  Branch (107:16): [True: 1.54k, False: 89]
  ------------------
  108|  1.54k|		{
  109|  1.54k|			int32_t		l, r ;
  110|       |
  111|  1.54k|			l = u [j] + v [j] - ((mixres * v [j]) >> mixbits) ;
  112|  1.54k|			r = l - v [j] ;
  113|       |
  114|  1.54k|			out [0] = arith_shift_left (l, 12) ;
  115|  1.54k|			out [1] = arith_shift_left (r, 12) ;
  116|  1.54k|			out += stride ;
  117|  1.54k|		}
  118|     89|	}
  119|     68|	else
  120|     68|	{
  121|       |		/* Conventional separated stereo. */
  122|  3.20k|		for (j = 0 ; j < numSamples ; j++)
  ------------------
  |  Branch (122:16): [True: 3.13k, False: 68]
  ------------------
  123|  3.13k|		{
  124|  3.13k|			out [0] = arith_shift_left (u [j], 12) ;
  125|  3.13k|			out [1] = arith_shift_left (v [j], 12) ;
  126|  3.13k|			out += stride ;
  127|  3.13k|		}
  128|     68|	}
  129|    157|}
unmix24:
  137|    201|{
  138|    201|	int32_t		shift = bytesShifted * 8 ;
  139|    201|	int32_t		l, r ;
  140|    201|	int32_t 		j, k ;
  141|       |
  142|    201|	if (mixres != 0)
  ------------------
  |  Branch (142:6): [True: 99, False: 102]
  ------------------
  143|     99|	{
  144|       |		/* matrixed stereo */
  145|     99|		if (bytesShifted != 0)
  ------------------
  |  Branch (145:7): [True: 45, False: 54]
  ------------------
  146|     45|		{
  147|  1.87k|			for (j = 0, k = 0 ; j < numSamples ; j++, k += 2)
  ------------------
  |  Branch (147:24): [True: 1.83k, False: 45]
  ------------------
  148|  1.83k|			{
  149|  1.83k|				l = u [j] + v [j] - ((mixres * v [j]) >> mixbits) ;
  150|  1.83k|				r = l - v [j] ;
  151|       |
  152|  1.83k|				l = arith_shift_left (l, shift) | (uint32_t) shiftUV [k + 0] ;
  153|  1.83k|				r = arith_shift_left (r, shift) | (uint32_t) shiftUV [k + 1] ;
  154|       |
  155|  1.83k|				out [0] = arith_shift_left (l, 8) ;
  156|  1.83k|				out [1] = arith_shift_left (r, 8) ;
  157|  1.83k|				out += stride ;
  158|  1.83k|			}
  159|     45|		}
  160|     54|		else
  161|     54|		{
  162|  2.75k|			for (j = 0 ; j < numSamples ; j++)
  ------------------
  |  Branch (162:17): [True: 2.69k, False: 54]
  ------------------
  163|  2.69k|			{
  164|  2.69k|				l = u [j] + v [j] - ((mixres * v [j]) >> mixbits) ;
  165|  2.69k|				r = l - v [j] ;
  166|       |
  167|  2.69k|				out [0] = arith_shift_left (l, 8) ;
  168|  2.69k|				out [1] = arith_shift_left (r, 8) ;
  169|  2.69k|				out += stride ;
  170|  2.69k|			}
  171|     54|		}
  172|     99|	}
  173|    102|	else
  174|    102|	{
  175|       |		/* Conventional separated stereo. */
  176|    102|		if (bytesShifted != 0)
  ------------------
  |  Branch (176:7): [True: 42, False: 60]
  ------------------
  177|     42|		{
  178|  6.02k|			for (j = 0, k = 0 ; j < numSamples ; j++, k += 2)
  ------------------
  |  Branch (178:24): [True: 5.98k, False: 42]
  ------------------
  179|  5.98k|			{
  180|  5.98k|				l = u [j] ;
  181|  5.98k|				r = v [j] ;
  182|       |
  183|  5.98k|				l = arith_shift_left (l, shift) | (uint32_t) shiftUV [k + 0] ;
  184|  5.98k|				r = arith_shift_left (r, shift) | (uint32_t) shiftUV [k + 1] ;
  185|       |
  186|  5.98k|				out [0] = arith_shift_left (l, 8) ;
  187|  5.98k|				out [1] = arith_shift_left (r, 8) ;
  188|  5.98k|				out += stride ;
  189|  5.98k|			}
  190|     42|		}
  191|     60|		else
  192|     60|		{
  193|  4.46k|			for (j = 0 ; j < numSamples ; j++)
  ------------------
  |  Branch (193:17): [True: 4.40k, False: 60]
  ------------------
  194|  4.40k|			{
  195|  4.40k|				out [0] = arith_shift_left (u [j], 8) ;
  196|  4.40k|				out [1] = arith_shift_left (v [j], 8) ;
  197|  4.40k|				out += stride ;
  198|  4.40k|			}
  199|     60|		}
  200|    102|	}
  201|    201|}
unmix32:
  211|    107|{
  212|    107|	int32_t		shift = bytesShifted * 8 ;
  213|    107|	int32_t		l, r ;
  214|    107|	int32_t 	j, k ;
  215|       |
  216|    107|	if (mixres != 0)
  ------------------
  |  Branch (216:6): [True: 34, False: 73]
  ------------------
  217|     34|	{
  218|       |		//Assert (bytesShifted != 0) ;
  219|       |
  220|       |		/* matrixed stereo with shift */
  221|  1.73k|		for (j = 0, k = 0 ; j < numSamples ; j++, k += 2)
  ------------------
  |  Branch (221:23): [True: 1.70k, False: 34]
  ------------------
  222|  1.70k|		{
  223|  1.70k|			int32_t		lt, rt ;
  224|       |
  225|  1.70k|			lt = u [j] ;
  226|  1.70k|			rt = v [j] ;
  227|       |
  228|  1.70k|			l = lt + rt - ((mixres * rt) >> mixbits) ;
  229|  1.70k|			r = l - rt ;
  230|       |
  231|  1.70k|			out [0] = arith_shift_left (l, shift) | (uint32_t) shiftUV [k + 0] ;
  232|  1.70k|			out [1] = arith_shift_left (r, shift) | (uint32_t) shiftUV [k + 1] ;
  233|  1.70k|			out += stride ;
  234|  1.70k|		}
  235|     34|	}
  236|     73|	else
  237|     73|	{
  238|     73|		if (bytesShifted == 0)
  ------------------
  |  Branch (238:7): [True: 46, False: 27]
  ------------------
  239|     46|		{
  240|       |			/* interleaving w/o shift */
  241|  1.46k|			for (j = 0 ; j < numSamples ; j++)
  ------------------
  |  Branch (241:17): [True: 1.41k, False: 46]
  ------------------
  242|  1.41k|			{
  243|  1.41k|				out [0] = u [j] ;
  244|  1.41k|				out [1] = v [j] ;
  245|  1.41k|				out += stride ;
  246|  1.41k|			}
  247|     46|		}
  248|     27|		else
  249|     27|		{
  250|       |			/* interleaving with shift */
  251|  1.46k|			for (j = 0, k = 0 ; j < numSamples ; j++, k += 2)
  ------------------
  |  Branch (251:24): [True: 1.43k, False: 27]
  ------------------
  252|  1.43k|			{
  253|  1.43k|				out [0] = arith_shift_left (u [j], shift) | (uint32_t) shiftUV [k + 0] ;
  254|  1.43k|				out [1] = arith_shift_left (v [j], shift) | (uint32_t) shiftUV [k + 1] ;
  255|  1.43k|				out += stride ;
  256|  1.43k|			}
  257|     27|		}
  258|     73|	}
  259|    107|}
copyPredictorTo24:
  265|  1.58k|{
  266|  1.58k|	int32_t		j ;
  267|       |
  268|  83.0k|	for (j = 0 ; j < numSamples ; j++)
  ------------------
  |  Branch (268:15): [True: 81.4k, False: 1.58k]
  ------------------
  269|  81.4k|	{
  270|  81.4k|		out [0] = arith_shift_left (in [j], 8) ;
  271|  81.4k|		out += stride ;
  272|  81.4k|	}
  273|  1.58k|}
copyPredictorTo24Shift:
  277|     99|{
  278|     99|	int32_t		shiftVal = bytesShifted * 8 ;
  279|     99|	int32_t		j ;
  280|       |
  281|       |	//Assert (bytesShifted != 0) ;
  282|       |
  283|    723|	for (j = 0 ; j < numSamples ; j++)
  ------------------
  |  Branch (283:15): [True: 624, False: 99]
  ------------------
  284|    624|	{
  285|    624|		int32_t		val = in [j] ;
  286|       |
  287|    624|		val = arith_shift_left (val, shiftVal) | (uint32_t) shift [j] ;
  288|    624|		out [0] = arith_shift_left (val, 8) ;
  289|    624|		out += stride ;
  290|    624|	}
  291|     99|}
copyPredictorTo20:
  295|  1.16k|{
  296|  1.16k|	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|  39.5k|	for (j = 0 ; j < numSamples ; j++)
  ------------------
  |  Branch (300:15): [True: 38.4k, False: 1.16k]
  ------------------
  301|  38.4k|	{
  302|  38.4k|		out [0] = arith_shift_left (in [j], 12) ;
  303|  38.4k|		out += stride ;
  304|  38.4k|	}
  305|  1.16k|}
copyPredictorTo32:
  309|    967|{
  310|    967|	int32_t			i, j ;
  311|       |
  312|       |	// this is only a subroutine to abstract the "iPod can only output 16-bit data" problem
  313|  65.3k|	for (i = 0, j = 0 ; i < numSamples ; i++, j += stride)
  ------------------
  |  Branch (313:22): [True: 64.3k, False: 967]
  ------------------
  314|  64.3k|		out [j] = arith_shift_left (in [i], 8) ;
  315|    967|}
copyPredictorTo32Shift:
  319|     35|{
  320|     35|	int32_t *		op = out ;
  321|     35|	uint32_t		shiftVal = bytesShifted * 8 ;
  322|     35|	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|    355|	for (j = 0 ; j < numSamples ; j++)
  ------------------
  |  Branch (327:15): [True: 320, False: 35]
  ------------------
  328|    320|	{
  329|    320|		op [0] = arith_shift_left (in [j], shiftVal) | (uint32_t) shift [j] ;
  330|    320|		op += stride ;
  331|    320|	}
  332|     35|}

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

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

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

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

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

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

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

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

decode.c:GSM_MULT_R:
  118|   694k|{	return (((int32_t) (a)) * ((int32_t) (b)) + 16384) >> 15 ;
  119|   694k|} /* GSM_MULT_R */
decode.c:GSM_ADD:
  150|  1.38M|{	int32_t ltmp ;
  151|       |
  152|  1.38M|	ltmp = ((int32_t) a) + ((int32_t) b) ;
  153|       |
  154|  1.38M|	if (ltmp >= MAX_WORD)
  ------------------
  |  |   52|  1.38M|#define	MAX_WORD	32767
  ------------------
  |  Branch (154:6): [True: 261k, False: 1.12M]
  ------------------
  155|   261k|		return MAX_WORD ;
  ------------------
  |  |   52|   261k|#define	MAX_WORD	32767
  ------------------
  156|  1.12M|	if (ltmp <= MIN_WORD)
  ------------------
  |  |   51|  1.12M|#define	MIN_WORD	(-32767 - 1)
  ------------------
  |  Branch (156:6): [True: 256k, False: 871k]
  ------------------
  157|   256k|		return MIN_WORD ;
  ------------------
  |  |   51|   256k|#define	MIN_WORD	(-32767 - 1)
  ------------------
  158|       |
  159|   871k|	return ltmp ;
  160|  1.12M|} /* GSM_ADD */
long_term.c:GSM_MULT_R:
  118|   694k|{	return (((int32_t) (a)) * ((int32_t) (b)) + 16384) >> 15 ;
  119|   694k|} /* GSM_MULT_R */
long_term.c:GSM_ADD:
  150|   694k|{	int32_t ltmp ;
  151|       |
  152|   694k|	ltmp = ((int32_t) a) + ((int32_t) b) ;
  153|       |
  154|   694k|	if (ltmp >= MAX_WORD)
  ------------------
  |  |   52|   694k|#define	MAX_WORD	32767
  ------------------
  |  Branch (154:6): [True: 35.8k, False: 658k]
  ------------------
  155|  35.8k|		return MAX_WORD ;
  ------------------
  |  |   52|  35.8k|#define	MAX_WORD	32767
  ------------------
  156|   658k|	if (ltmp <= MIN_WORD)
  ------------------
  |  |   51|   658k|#define	MIN_WORD	(-32767 - 1)
  ------------------
  |  Branch (156:6): [True: 5.94k, False: 652k]
  ------------------
  157|  5.94k|		return MIN_WORD ;
  ------------------
  |  |   51|  5.94k|#define	MIN_WORD	(-32767 - 1)
  ------------------
  158|       |
  159|   652k|	return ltmp ;
  160|   658k|} /* GSM_ADD */
rpe.c:SASR_W:
   60|  13.4k|{	if (x >= 0)
  ------------------
  |  Branch (60:7): [True: 13.4k, False: 0]
  ------------------
   61|  13.4k|		return x >> by ;
   62|      0|	return ~ ((~x) >> by) ;
   63|  13.4k|} /* SASR_W */
rpe.c:arith_shift_left:
  306|   225k|{	return (int32_t) (((uint32_t) x) << shift) ;
  307|   225k|} /* arith_shift_left */
rpe.c:GSM_MULT_R:
  118|   225k|{	return (((int32_t) (a)) * ((int32_t) (b)) + 16384) >> 15 ;
  119|   225k|} /* GSM_MULT_R */
rpe.c:GSM_ADD:
  150|   225k|{	int32_t ltmp ;
  151|       |
  152|   225k|	ltmp = ((int32_t) a) + ((int32_t) b) ;
  153|       |
  154|   225k|	if (ltmp >= MAX_WORD)
  ------------------
  |  |   52|   225k|#define	MAX_WORD	32767
  ------------------
  |  Branch (154:6): [True: 0, False: 225k]
  ------------------
  155|      0|		return MAX_WORD ;
  ------------------
  |  |   52|      0|#define	MAX_WORD	32767
  ------------------
  156|   225k|	if (ltmp <= MIN_WORD)
  ------------------
  |  |   51|   225k|#define	MIN_WORD	(-32767 - 1)
  ------------------
  |  Branch (156:6): [True: 0, False: 225k]
  ------------------
  157|      0|		return MIN_WORD ;
  ------------------
  |  |   51|      0|#define	MIN_WORD	(-32767 - 1)
  ------------------
  158|       |
  159|   225k|	return ltmp ;
  160|   225k|} /* GSM_ADD */
short_term.c:arith_shift_left:
  306|  34.7k|{	return (int32_t) (((uint32_t) x) << shift) ;
  307|  34.7k|} /* arith_shift_left */
short_term.c:GSM_ADD:
  150|  5.80M|{	int32_t ltmp ;
  151|       |
  152|  5.80M|	ltmp = ((int32_t) a) + ((int32_t) b) ;
  153|       |
  154|  5.80M|	if (ltmp >= MAX_WORD)
  ------------------
  |  |   52|  5.80M|#define	MAX_WORD	32767
  ------------------
  |  Branch (154:6): [True: 82.5k, False: 5.72M]
  ------------------
  155|  82.5k|		return MAX_WORD ;
  ------------------
  |  |   52|  82.5k|#define	MAX_WORD	32767
  ------------------
  156|  5.72M|	if (ltmp <= MIN_WORD)
  ------------------
  |  |   51|  5.72M|#define	MIN_WORD	(-32767 - 1)
  ------------------
  |  Branch (156:6): [True: 19.8k, False: 5.70M]
  ------------------
  157|  19.8k|		return MIN_WORD ;
  ------------------
  |  |   51|  19.8k|#define	MIN_WORD	(-32767 - 1)
  ------------------
  158|       |
  159|  5.70M|	return ltmp ;
  160|  5.72M|} /* GSM_ADD */
short_term.c:GSM_SUB:
  164|  5.59M|{	int32_t ltmp ;
  165|       |
  166|  5.59M|	ltmp = ((int32_t) a) - ((int32_t) b) ;
  167|       |
  168|  5.59M|	if (ltmp >= MAX_WORD)
  ------------------
  |  |   52|  5.59M|#define	MAX_WORD	32767
  ------------------
  |  Branch (168:6): [True: 273k, False: 5.31M]
  ------------------
  169|   273k|		ltmp = MAX_WORD ;
  ------------------
  |  |   52|   273k|#define	MAX_WORD	32767
  ------------------
  170|  5.31M|	else if (ltmp <= MIN_WORD)
  ------------------
  |  |   51|  5.31M|#define	MIN_WORD	(-32767 - 1)
  ------------------
  |  Branch (170:11): [True: 157k, False: 5.15M]
  ------------------
  171|   157k|		ltmp = MIN_WORD ;
  ------------------
  |  |   51|   157k|#define	MIN_WORD	(-32767 - 1)
  ------------------
  172|       |
  173|  5.59M|	return ltmp ;
  174|  5.59M|} /* GSM_SUB */
short_term.c:GSM_MULT_R:
  118|  34.7k|{	return (((int32_t) (a)) * ((int32_t) (b)) + 16384) >> 15 ;
  119|  34.7k|} /* GSM_MULT_R */
short_term.c:SASR_W:
   60|   277k|{	if (x >= 0)
  ------------------
  |  Branch (60:7): [True: 149k, False: 128k]
  ------------------
   61|   149k|		return x >> by ;
   62|   128k|	return ~ ((~x) >> by) ;
   63|   277k|} /* SASR_W */
add.c:SASR_W:
   60|   230k|{	if (x >= 0)
  ------------------
  |  Branch (60:7): [True: 126k, False: 104k]
  ------------------
   61|   126k|		return x >> by ;
   62|   104k|	return ~ ((~x) >> by) ;
   63|   230k|} /* SASR_W */

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

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

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

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

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

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

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

alac_init:
  112|    995|{	int error ;
  113|       |
  114|    995|	if ((psf->codec_data = calloc (1, sizeof (ALAC_PRIVATE) + psf->sf.channels * sizeof (int) * ALAC_MAX_FRAME_SIZE)) == NULL)
  ------------------
  |  |   33|    995|#define		ALAC_MAX_FRAME_SIZE		8192
  ------------------
  |  Branch (114:6): [True: 0, False: 995]
  ------------------
  115|      0|		return SFE_MALLOC_FAILED ;
  116|       |
  117|    995|	psf->codec_close = alac_close ;
  118|       |
  119|    995|	switch (psf->file.mode)
  120|    995|	{	case SFM_RDWR :
  ------------------
  |  Branch (120:4): [True: 0, False: 995]
  ------------------
  121|      0|			return SFE_BAD_MODE_RW ;
  122|       |
  123|    995|		case SFM_READ :
  ------------------
  |  Branch (123:3): [True: 995, False: 0]
  ------------------
  124|    995|			if ((error = alac_reader_init (psf, info)))
  ------------------
  |  Branch (124:8): [True: 222, False: 773]
  ------------------
  125|    222|				return error ;
  126|    773|			break ;
  127|       |
  128|    773|		case SFM_WRITE :
  ------------------
  |  Branch (128:3): [True: 0, False: 995]
  ------------------
  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: 995]
  ------------------
  134|      0|			psf_log_printf (psf, "%s : Bad psf->file.mode.\n", __func__) ;
  135|      0|			return SFE_INTERNAL ;
  136|    995|		} ;
  137|       |
  138|    773|	psf->byterate = alac_byterate ;
  139|       |
  140|    773|	return 0 ;
  141|    995|} /* aiff_alac_init */
alac.c:alac_close:
  166|    995|{	ALAC_PRIVATE *plac ;
  167|    995|	BUF_UNION	ubuf ;
  168|       |
  169|    995|	plac = psf->codec_data ;
  170|       |
  171|    995|	if (psf->file.mode == SFM_WRITE)
  ------------------
  |  Branch (171:6): [True: 0, False: 995]
  ------------------
  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|    995|	if (plac->pakt_info)
  ------------------
  |  Branch (216:6): [True: 931, False: 64]
  ------------------
  217|    931|		free (plac->pakt_info) ;
  218|    995|	plac->pakt_info = NULL ;
  219|       |
  220|    995|	return 0 ;
  221|    995|} /* alac_close */
alac.c:alac_pakt_append:
  794|  13.6k|{
  795|  13.6k|	if (info->count >= info->allocated)
  ------------------
  |  Branch (795:6): [True: 159, False: 13.5k]
  ------------------
  796|    159|	{	PAKT_INFO * temp ;
  797|    159|		uint32_t newcount = info->allocated + info->allocated / 2 ;
  798|       |
  799|    159|		if ((temp = realloc (info, sizeof (PAKT_INFO) + newcount * sizeof (info->packet_size [0]))) == NULL)
  ------------------
  |  Branch (799:7): [True: 0, False: 159]
  ------------------
  800|      0|			return NULL ;
  801|       |
  802|    159|		info = temp ;
  803|    159|		info->allocated = newcount ;
  804|  13.6k|		} ;
  805|       |
  806|  13.6k|	info->packet_size [info->count++] = value ;
  807|  13.6k|	return info ;
  808|  13.6k|} /* alac_pakt_append */
alac.c:alac_reader_init:
  238|    995|{	ALAC_PRIVATE	*plac ;
  239|    995|	uint32_t		kuki_size ;
  240|    995|	int				error ;
  241|    995|	union			{ uint8_t kuki [512] ; uint32_t alignment ; } u ;
  242|       |
  243|    995|	if (info == NULL)
  ------------------
  |  Branch (243:6): [True: 0, False: 995]
  ------------------
  244|      0|	{	psf_log_printf (psf, "%s : ALAC_DECODER_INFO is NULL.\n", __func__) ;
  245|      0|		return SFE_INTERNAL ;
  246|    995|		} ;
  247|       |
  248|    995|	if (info->frames_per_packet > ALAC_FRAME_LENGTH)
  ------------------
  |  |   33|    995|#define		ALAC_FRAME_LENGTH	4096
  ------------------
  |  Branch (248:6): [True: 25, False: 970]
  ------------------
  249|     25|	{	psf_log_printf (psf, "*** Error : frames_per_packet (%u) is too big. ***\n", info->frames_per_packet) ;
  250|     25|		return SFE_INTERNAL ;
  251|    970|		} ;
  252|       |
  253|    970|	plac = psf->codec_data ;
  254|       |
  255|    970|	plac->channels			= psf->sf.channels ;
  256|    970|	plac->frames_per_block	= info->frames_per_packet ;
  257|    970|	plac->bits_per_sample	= info->bits_per_sample ;
  258|       |
  259|    970|	if (plac->pakt_info != NULL)
  ------------------
  |  Branch (259:6): [True: 0, False: 970]
  ------------------
  260|      0|		free (plac->pakt_info) ;
  261|    970|	plac->pakt_info = alac_pakt_read_decode (psf, info->pakt_offset) ;
  262|       |
  263|    970|	if (plac->pakt_info == NULL)
  ------------------
  |  Branch (263:6): [True: 39, False: 931]
  ------------------
  264|     39|	{	psf_log_printf (psf, "%s : alac_pkt_read() returns NULL.\n", __func__) ;
  265|     39|		return SFE_INTERNAL ;
  266|    931|		} ;
  267|       |
  268|       |	/* Read in the ALAC cookie data and pass it to the init function. */
  269|    931|	kuki_size = alac_kuki_read (psf, info->kuki_offset, u.kuki, sizeof (u.kuki)) ;
  270|       |
  271|    931|	if ((error = alac_decoder_init (&plac->u.decoder, u.kuki, kuki_size)) != ALAC_noErr)
  ------------------
  |  Branch (271:6): [True: 157, False: 774]
  ------------------
  272|    157|	{	psf_log_printf (psf, "*** alac_decoder_init() returned %s. ***\n", alac_error_string (error)) ;
  273|    157|		return SFE_INTERNAL ;
  274|    774|		} ;
  275|       |
  276|       |
  277|    774|	if (plac->u.decoder.mNumChannels != (unsigned) psf->sf.channels)
  ------------------
  |  Branch (277:6): [True: 1, False: 773]
  ------------------
  278|      1|	{	psf_log_printf (psf, "*** Initialized decoder has %u channels, but it should be %d. ***\n", plac->u.decoder.mNumChannels, psf->sf.channels) ;
  279|      1|		return SFE_INTERNAL ;
  280|    773|		} ;
  281|       |
  282|    773|	switch (info->bits_per_sample)
  283|    773|	{	case 16 :
  ------------------
  |  Branch (283:4): [True: 752, False: 21]
  ------------------
  284|    763|		case 20 :
  ------------------
  |  Branch (284:3): [True: 11, False: 762]
  ------------------
  285|    768|		case 24 :
  ------------------
  |  Branch (285:3): [True: 5, False: 768]
  ------------------
  286|    773|		case 32 :
  ------------------
  |  Branch (286:3): [True: 5, False: 768]
  ------------------
  287|    773|			psf->read_short		= alac_read_s ;
  288|    773|			psf->read_int		= alac_read_i ;
  289|    773|			psf->read_float		= alac_read_f ;
  290|    773|			psf->read_double	= alac_read_d ;
  291|    773|			break ;
  292|       |
  293|      0|		default :
  ------------------
  |  Branch (293:3): [True: 0, False: 773]
  ------------------
  294|      0|			printf ("%s : info->bits_per_sample %u\n", __func__, info->bits_per_sample) ;
  295|      0|			return SFE_UNSUPPORTED_ENCODING ;
  296|    773|		} ;
  297|       |
  298|    773|	psf->codec_close	= alac_close ;
  299|    773|	psf->seek			= alac_seek ;
  300|       |
  301|    773|	psf->sf.frames		= alac_reader_calc_frames (psf, plac) ;
  302|    773|	alac_seek (psf, SFM_READ, 0) ;
  303|       |
  304|    773|	return 0 ;
  305|    773|} /* alac_reader_init */
alac.c:alac_pakt_read_decode:
  812|    970|{	SF_CHUNK_INFO chunk_info ;
  813|    970|	PAKT_INFO * info = NULL, * temp ;
  814|    970|	uint8_t *pakt_data = NULL ;
  815|    970|	uint32_t bcount, value = 1, pakt_size ;
  816|    970|	SF_CHUNK_ITERATOR * chunk_iterator ;
  817|       |
  818|       |
  819|    970|	memset (&chunk_info, 0, sizeof (chunk_info)) ;
  820|    970|	snprintf (chunk_info.id, sizeof (chunk_info.id), "pakt") ;
  821|    970|	chunk_info.id_size = 4 ;
  822|       |
  823|    970|	if ((chunk_iterator = psf_get_chunk_iterator (psf, chunk_info.id)) == NULL)
  ------------------
  |  Branch (823:6): [True: 39, False: 931]
  ------------------
  824|     39|	{	psf_log_printf (psf, "%s : no chunk iterator found\n", __func__) ;
  825|     39|		free (chunk_info.data) ;
  826|     39|		chunk_info.data = NULL ;
  827|     39|		return NULL ;
  828|    931|		} ;
  829|       |
  830|    931|	psf->get_chunk_size (psf, chunk_iterator, &chunk_info) ;
  831|       |
  832|    931|	pakt_size = chunk_info.datalen ;
  833|    931|	if (pakt_size > UINT32_MAX-5 )
  ------------------
  |  Branch (833:6): [True: 0, False: 931]
  ------------------
  834|      0|		return NULL;
  835|    931|	chunk_info.data = pakt_data = malloc (pakt_size + 5) ;
  836|    931|	if (!chunk_info.data)
  ------------------
  |  Branch (836:6): [True: 0, False: 931]
  ------------------
  837|      0|		return NULL ;
  838|       |
  839|    931|	if ((bcount = psf->get_chunk_data (psf, chunk_iterator, &chunk_info)) != SF_ERR_NO_ERROR)
  ------------------
  |  Branch (839:6): [True: 0, False: 931]
  ------------------
  840|      0|	{	while (chunk_iterator)
  ------------------
  |  Branch (840:11): [True: 0, False: 0]
  ------------------
  841|      0|			chunk_iterator = psf->next_chunk_iterator (psf, chunk_iterator) ;
  842|      0|		free (chunk_info.data) ;
  843|      0|		chunk_info.data = NULL ;
  844|      0|		return NULL ;
  845|    931|		} ;
  846|       |
  847|  2.82k|	while (chunk_iterator)
  ------------------
  |  Branch (847:9): [True: 1.89k, False: 931]
  ------------------
  848|  1.89k|		chunk_iterator = psf->next_chunk_iterator (psf, chunk_iterator) ;
  849|       |
  850|    931|	info = alac_pakt_alloc (pakt_size / 4) ;
  851|       |
  852|       |	/* Start at 24 bytes in, skipping over the 'pakt' chunks header. */
  853|  14.6k|	for (bcount = 24 ; bcount < pakt_size && value != 0 ; )
  ------------------
  |  Branch (853:21): [True: 14.5k, False: 75]
  |  Branch (853:43): [True: 13.6k, False: 856]
  ------------------
  854|  13.6k|	{	uint8_t byte ;
  855|  13.6k|		int32_t count = 0 ;
  856|       |
  857|  13.6k|		value = 0 ;
  858|  13.6k|		do
  859|  16.3k|		{	byte = pakt_data [bcount + count] ;
  860|  16.3k|			value = (value << 7) + (byte & 0x7F) ;
  861|       |
  862|  16.3k|			count ++ ;
  863|  16.3k|			if (count > 5 || bcount + count > pakt_size)
  ------------------
  |  Branch (863:8): [True: 76, False: 16.3k]
  |  Branch (863:21): [True: 11, False: 16.2k]
  ------------------
  864|     87|			{	printf ("%s %d : Ooops! count %" PRIi32 "    bcount %" PRIu32 "\n", __func__, __LINE__, count, bcount) ;
  865|     87|				value = 0 ;
  866|     87|				break ;
  867|  16.2k|				} ;
  868|  16.2k|			}
  869|  16.2k|			while (byte & 0x80) ;
  ------------------
  |  Branch (869:11): [True: 2.69k, False: 13.5k]
  ------------------
  870|       |
  871|  13.6k|		bcount += count ;
  872|       |
  873|  13.6k|		if ((temp = alac_pakt_append (info, value)) == NULL)
  ------------------
  |  Branch (873:7): [True: 0, False: 13.6k]
  ------------------
  874|      0|			goto FreeExit ;
  875|  13.6k|		info = temp ;
  876|  13.6k|		} ;
  877|       |
  878|    931|	free (pakt_data) ;
  879|       |
  880|    931|	return info ;
  881|       |
  882|      0|FreeExit :
  883|      0|	free (pakt_data) ;
  884|      0|	free (info) ;
  885|       |	return NULL ;
  886|    931|} /* alac_pakt_read_decode */
alac.c:alac_pakt_alloc:
  780|    931|{	PAKT_INFO * info ;
  781|       |
  782|    931|	if ((info = calloc (1, sizeof (PAKT_INFO) + initial_count * sizeof (info->packet_size [0]))) == NULL)
  ------------------
  |  Branch (782:6): [True: 0, False: 931]
  ------------------
  783|      0|		return NULL ;
  784|       |
  785|    931|	info->allocated = initial_count ;
  786|    931|	info->current = 0 ;
  787|    931|	info->count = 0 ;
  788|       |
  789|    931|	return info ;
  790|    931|} /* alac_pakt_alloc */
alac.c:alac_kuki_read:
  960|    931|{	uint32_t marker ;
  961|    931|	uint64_t kuki_size ;
  962|       |
  963|    931|	if (psf_fseek (psf, kuki_offset, SEEK_SET) != kuki_offset)
  ------------------
  |  Branch (963:6): [True: 0, False: 931]
  ------------------
  964|      0|		return 0 ;
  965|       |
  966|    931|	psf_fread (&marker, 1, sizeof (marker), psf) ;
  967|    931|	if (marker != MAKE_MARKER ('k', 'u', 'k', 'i'))
  ------------------
  |  |  122|    931|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
  |  Branch (967:6): [True: 87, False: 844]
  ------------------
  968|     87|		return 0 ;
  969|       |
  970|    844|	psf_fread (&kuki_size, 1, sizeof (kuki_size), psf) ;
  971|    844|	kuki_size = BE2H_64 (kuki_size) ;
  ------------------
  |  |  142|    844|	#define BE2H_64(x)			ENDSWAP_64 (x)
  |  |  ------------------
  |  |  |  |   36|    844|#define	ENDSWAP_64(x)		(bswap_64 (x))
  |  |  ------------------
  ------------------
  972|       |
  973|    844|	if (kuki_size == 0 || kuki_size > kuki_maxlen)
  ------------------
  |  Branch (973:6): [True: 6, False: 838]
  |  Branch (973:24): [True: 2, False: 836]
  ------------------
  974|      8|	{	psf_log_printf (psf, "%s : Bad size (%D) of 'kuki' chunk.\n", __func__, kuki_size) ;
  975|      8|		return 0 ;
  976|    836|		} ;
  977|       |
  978|    836|	psf_fread (kuki, 1, kuki_size, psf) ;
  979|       |
  980|    836|	return kuki_size ;
  981|    844|} /* alac_kuki_read */
alac.c:alac_error_string:
  987|  1.07k|{	static char errstr [128] ;
  988|  1.07k|	switch (error)
  989|  1.07k|	{	CASE_NAME (kALAC_UnimplementedError) ;
  ------------------
  |  |  983|      0|#define CASE_NAME(x)	case x : return #x ; break ;
  |  |  ------------------
  |  |  |  Branch (983:22): [True: 0, False: 1.07k]
  |  |  ------------------
  ------------------
  990|      0|		CASE_NAME (kALAC_FileNotFoundError) ;
  ------------------
  |  |  983|      0|#define CASE_NAME(x)	case x : return #x ; break ;
  |  |  ------------------
  |  |  |  Branch (983:22): [True: 0, False: 1.07k]
  |  |  ------------------
  ------------------
  991|    728|		CASE_NAME (kALAC_ParamError) ;
  ------------------
  |  |  983|    728|#define CASE_NAME(x)	case x : return #x ; break ;
  |  |  ------------------
  |  |  |  Branch (983:22): [True: 728, False: 348]
  |  |  ------------------
  ------------------
  992|      0|		CASE_NAME (kALAC_MemFullError) ;
  ------------------
  |  |  983|      0|#define CASE_NAME(x)	case x : return #x ; break ;
  |  |  ------------------
  |  |  |  Branch (983:22): [True: 0, False: 1.07k]
  |  |  ------------------
  ------------------
  993|     49|		CASE_NAME (fALAC_FrameLengthError) ;
  ------------------
  |  |  983|     49|#define CASE_NAME(x)	case x : return #x ; break ;
  |  |  ------------------
  |  |  |  Branch (983:22): [True: 49, False: 1.02k]
  |  |  ------------------
  ------------------
  994|       |
  995|       |		/* Added for libsndfile */
  996|      4|		CASE_NAME (kALAC_BadBitWidth) ;
  ------------------
  |  |  983|      4|#define CASE_NAME(x)	case x : return #x ; break ;
  |  |  ------------------
  |  |  |  Branch (983:22): [True: 4, False: 1.07k]
  |  |  ------------------
  ------------------
  997|      4|		CASE_NAME (kALAC_IncompatibleVersion) ;
  ------------------
  |  |  983|      4|#define CASE_NAME(x)	case x : return #x ; break ;
  |  |  ------------------
  |  |  |  Branch (983:22): [True: 4, False: 1.07k]
  |  |  ------------------
  ------------------
  998|     98|		CASE_NAME (kALAC_BadSpecificConfigSize) ;
  ------------------
  |  |  983|     98|#define CASE_NAME(x)	case x : return #x ; break ;
  |  |  ------------------
  |  |  |  Branch (983:22): [True: 98, False: 978]
  |  |  ------------------
  ------------------
  999|      5|		CASE_NAME (kALAC_ZeroChannelCount) ;
  ------------------
  |  |  983|      5|#define CASE_NAME(x)	case x : return #x ; break ;
  |  |  ------------------
  |  |  |  Branch (983:22): [True: 5, False: 1.07k]
  |  |  ------------------
  ------------------
 1000|     60|		CASE_NAME (kALAC_NumSamplesTooBig) ;
  ------------------
  |  |  983|     60|#define CASE_NAME(x)	case x : return #x ; break ;
  |  |  ------------------
  |  |  |  Branch (983:22): [True: 60, False: 1.01k]
  |  |  ------------------
  ------------------
 1001|    128|		CASE_NAME (kALAC_UnsupportedElement) ;
  ------------------
  |  |  983|    128|#define CASE_NAME(x)	case x : return #x ; break ;
  |  |  ------------------
  |  |  |  Branch (983:22): [True: 128, False: 948]
  |  |  ------------------
  ------------------
 1002|      0|		default :
  ------------------
  |  Branch (1002:3): [True: 0, False: 1.07k]
  ------------------
 1003|      0|			break ;
 1004|  1.07k|		} ;
 1005|       |
 1006|      0|	snprintf (errstr, sizeof (errstr), "Unknown error %d", error) ;
 1007|      0|	return errstr ;
 1008|  1.07k|} /* alac_error_string */
alac.c:alac_read_s:
  468|   245k|{	ALAC_PRIVATE *plac ;
  469|   245k|	int			*iptr ;
  470|   245k|	int			k, readcount ;
  471|   245k|	sf_count_t	total = 0 ;
  472|       |
  473|   245k|	if ((plac = (ALAC_PRIVATE*) psf->codec_data) == NULL)
  ------------------
  |  Branch (473:6): [True: 0, False: 245k]
  ------------------
  474|      0|		return 0 ;
  475|       |
  476|   490k|	while (len > 0)
  ------------------
  |  Branch (476:9): [True: 245k, False: 245k]
  ------------------
  477|   245k|	{	if (plac->partial_block_frames >= plac->frames_this_block && alac_decode_block (psf, plac) == 0)
  ------------------
  |  Branch (477:8): [True: 3.99k, False: 241k]
  |  Branch (477:65): [True: 542, False: 3.45k]
  ------------------
  478|    542|			break ;
  479|       |
  480|   245k|		readcount = (plac->frames_this_block - plac->partial_block_frames) * plac->channels ;
  481|   245k|		readcount = readcount > len ? (int) len : readcount ;
  ------------------
  |  Branch (481:15): [True: 241k, False: 3.45k]
  ------------------
  482|       |
  483|   245k|		iptr = plac->buffer + plac->partial_block_frames * plac->channels ;
  484|       |
  485|  19.8M|		for (k = 0 ; k < readcount ; k++)
  ------------------
  |  Branch (485:16): [True: 19.5M, False: 245k]
  ------------------
  486|  19.5M|			ptr [total + k] = iptr [k] >> 16 ;
  487|       |
  488|   245k|		plac->partial_block_frames += readcount / plac->channels ;
  489|   245k|		total += readcount ;
  490|   245k|		len -= readcount ;
  491|   245k|		} ;
  492|       |
  493|   245k|	return total ;
  494|   245k|} /* alac_read_s */
alac.c:alac_decode_block:
  405|  5.38k|{	ALAC_DECODER *pdec = &plac->u.decoder ;
  406|  5.38k|	uint32_t	packet_size ;
  407|  5.38k|	BitBuffer	bit_buffer ;
  408|  5.38k|	int32_t		error ;
  409|       |
  410|  5.38k|	packet_size = alac_reader_next_packet_size (plac->pakt_info) ;
  411|  5.38k|	if (packet_size == 0)
  ------------------
  |  Branch (411:6): [True: 304, False: 5.08k]
  ------------------
  412|    304|	{	if (plac->pakt_info->current < plac->pakt_info->count)
  ------------------
  |  Branch (412:8): [True: 0, False: 304]
  ------------------
  413|      0|			psf_log_printf (psf, "packet_size is 0 (%d of %d)\n", plac->pakt_info->current, plac->pakt_info->count) ;
  414|    304|		return 0 ;
  415|  5.08k|		} ;
  416|       |
  417|  5.08k|	psf_fseek (psf, plac->input_data_pos, SEEK_SET) ;
  418|       |
  419|  5.08k|	if (packet_size > sizeof (plac->byte_buffer))
  ------------------
  |  Branch (419:6): [True: 289, False: 4.79k]
  ------------------
  420|    289|	{	psf_log_printf (psf, "%s : bad packet_size (%u)\n", __func__, packet_size) ;
  421|    289|		return 0 ;
  422|  4.79k|		} ;
  423|       |
  424|  4.79k|	if ((packet_size != psf_fread (plac->byte_buffer, 1, packet_size, psf)))
  ------------------
  |  Branch (424:6): [True: 264, False: 4.52k]
  ------------------
  425|    264|		return 0 ;
  426|       |
  427|  4.52k|	BitBufferInit (&bit_buffer, plac->byte_buffer, packet_size) ;
  428|       |
  429|  4.52k|	plac->input_data_pos += packet_size ;
  430|  4.52k|	plac->frames_this_block = 0 ;
  431|  4.52k|	if ((error = alac_decode (pdec, &bit_buffer, plac->buffer, plac->frames_per_block, &plac->frames_this_block)) != ALAC_noErr)
  ------------------
  |  Branch (431:6): [True: 919, False: 3.60k]
  ------------------
  432|    919|	{	psf_log_printf (psf, "*** alac_decode() returned %s. ***\n", alac_error_string (error)) ;
  433|    919|		plac->frames_this_block = 0 ;
  434|    919|		return 0 ;
  435|  3.60k|		} ;
  436|       |
  437|  3.60k|	plac->partial_block_frames = 0 ;
  438|       |
  439|  3.60k|	return 1 ;
  440|  4.52k|} /* alac_decode_block */
alac.c:alac_reader_next_packet_size:
  371|  14.6k|{	if (info->current >= info->count)
  ------------------
  |  Branch (371:7): [True: 12, False: 14.5k]
  ------------------
  372|     12|		return 0 ;
  373|  14.5k|	return info->packet_size [info->current++] ;
  374|  14.6k|} /* alac_reader_next_packet_size */
alac.c:alac_seek:
  597|  1.54k|{	ALAC_PRIVATE *plac ;
  598|  1.54k|	int			newblock, newsample ;
  599|       |
  600|  1.54k|	if (! psf->codec_data)
  ------------------
  |  Branch (600:6): [True: 0, False: 1.54k]
  ------------------
  601|      0|		return 0 ;
  602|  1.54k|	plac = (ALAC_PRIVATE*) psf->codec_data ;
  603|       |
  604|  1.54k|	if (psf->datalength < 0 || psf->dataoffset < 0)
  ------------------
  |  Branch (604:6): [True: 8, False: 1.53k]
  |  Branch (604:29): [True: 0, False: 1.53k]
  ------------------
  605|      8|	{	psf->error = SFE_BAD_SEEK ;
  606|      8|		return PSF_SEEK_ERROR ;
  ------------------
  |  |   78|      8|#define	PSF_SEEK_ERROR			((sf_count_t) -1)
  ------------------
  607|  1.53k|		} ;
  608|       |
  609|  1.53k|	if (offset == 0)
  ------------------
  |  Branch (609:6): [True: 918, False: 617]
  ------------------
  610|    918|	{	psf_fseek (psf, psf->dataoffset, SEEK_SET) ;
  611|       |
  612|    918|		plac->frames_this_block = 0 ;
  613|    918|		plac->input_data_pos = psf->dataoffset ;
  614|    918|		plac->pakt_info->current = 0 ;
  615|    918|		return 0 ;
  616|    918|		} ;
  617|       |
  618|    617|	if (offset < 0 || offset > plac->pakt_info->count * plac->frames_per_block)
  ------------------
  |  Branch (618:6): [True: 0, False: 617]
  |  Branch (618:20): [True: 0, False: 617]
  ------------------
  619|      0|	{	psf->error = SFE_BAD_SEEK ;
  620|      0|		return	PSF_SEEK_ERROR ;
  ------------------
  |  |   78|      0|#define	PSF_SEEK_ERROR			((sf_count_t) -1)
  ------------------
  621|    617|		} ;
  622|       |
  623|    617|	newblock	= offset / plac->frames_per_block ;
  624|    617|	newsample	= offset % plac->frames_per_block ;
  625|       |
  626|    617|	if (mode == SFM_READ)
  ------------------
  |  Branch (626:6): [True: 617, False: 0]
  ------------------
  627|    617|	{	plac->input_data_pos = psf->dataoffset + alac_pakt_block_offset (plac->pakt_info, newblock) ;
  628|       |
  629|    617|		plac->pakt_info->current = newblock ;
  630|    617|		alac_decode_block (psf, plac) ;
  631|    617|		plac->partial_block_frames = newsample ;
  632|    617|		}
  633|      0|	else
  634|      0|	{	/* What to do about write??? */
  635|      0|		psf->error = SFE_BAD_SEEK ;
  636|      0|		return	PSF_SEEK_ERROR ;
  ------------------
  |  |   78|      0|#define	PSF_SEEK_ERROR			((sf_count_t) -1)
  ------------------
  637|    617|		} ;
  638|       |
  639|    617|	return newblock * plac->frames_per_block + newsample ;
  640|    617|} /* alac_seek */
alac.c:alac_pakt_block_offset:
  949|    617|{	sf_count_t offset = 0 ;
  950|    617|	uint32_t k ;
  951|       |
  952|  8.49k|	for (k = 0 ; k < block ; k++)
  ------------------
  |  Branch (952:15): [True: 7.87k, False: 617]
  ------------------
  953|  7.87k|		offset += info->packet_size [k] ;
  954|       |
  955|    617|	return offset ;
  956|    617|} /* alac_pakt_block_offset */
alac.c:alac_reader_calc_frames:
  378|    773|{	sf_count_t	frames = 0 ;
  379|    773|	uint32_t	current_pos = 1, blocks = 0 ;
  380|       |
  381|    773|	plac->pakt_info->current = 0 ;
  382|       |
  383|  9.98k|	while (current_pos < psf->filelength && current_pos > 0)
  ------------------
  |  Branch (383:9): [True: 9.57k, False: 413]
  |  Branch (383:42): [True: 9.21k, False: 360]
  ------------------
  384|  9.21k|	{	current_pos = alac_reader_next_packet_size (plac->pakt_info) ;
  385|  9.21k|		blocks = current_pos > 0 ? blocks + 1 : blocks ;
  ------------------
  |  Branch (385:12): [True: 8.85k, False: 360]
  ------------------
  386|  9.21k|		} ;
  387|       |
  388|    773|	if (blocks == 0)
  ------------------
  |  Branch (388:6): [True: 3, False: 770]
  ------------------
  389|      3|		return 0 ;
  390|       |
  391|       |	/* Only count full blocks. */
  392|    770|	frames = plac->frames_per_block * (blocks - 1) ;
  393|       |
  394|    770|	alac_seek (psf, SFM_READ, frames) ;
  395|    770|	alac_decode_block (psf, plac) ;
  396|    770|	frames += plac->frames_this_block ;
  397|       |
  398|    770|	plac->pakt_info->current = 0 ;
  399|       |
  400|    770|	return frames ;
  401|    773|} /* alac_reader_calc_frames */

alaw_init:
   50|    342|{
   51|    342|	if (psf->file.mode == SFM_READ || psf->file.mode == SFM_RDWR)
  ------------------
  |  Branch (51:6): [True: 342, False: 0]
  |  Branch (51:36): [True: 0, False: 0]
  ------------------
   52|    342|	{	psf->read_short		= alaw_read_alaw2s ;
   53|    342|		psf->read_int		= alaw_read_alaw2i ;
   54|    342|		psf->read_float		= alaw_read_alaw2f ;
   55|    342|		psf->read_double	= alaw_read_alaw2d ;
   56|    342|		} ;
   57|       |
   58|    342|	if (psf->file.mode == SFM_WRITE || psf->file.mode == SFM_RDWR)
  ------------------
  |  Branch (58:6): [True: 0, False: 342]
  |  Branch (58:37): [True: 0, False: 342]
  ------------------
   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|    342|	psf->bytewidth = 1 ;
   66|    342|	psf->blockwidth = psf->sf.channels ;
   67|       |
   68|    342|	if (psf->filelength > psf->dataoffset)
  ------------------
  |  Branch (68:6): [True: 202, False: 140]
  ------------------
   69|    202|		psf->datalength = (psf->dataend) ? psf->dataend - psf->dataoffset : psf->filelength - psf->dataoffset ;
  ------------------
  |  Branch (69:21): [True: 106, False: 96]
  ------------------
   70|    140|	else
   71|    140|		psf->datalength = 0 ;
   72|       |
   73|    342|	psf->sf.frames = psf->blockwidth > 0 ? psf->datalength / psf->blockwidth : 0 ;
  ------------------
  |  Branch (73:19): [True: 317, False: 25]
  ------------------
   74|       |
   75|    342|	return 0 ;
   76|    342|} /* alaw_init */
alaw.c:alaw_read_alaw2s:
  372|  1.50M|{	BUF_UNION	ubuf ;
  373|  1.50M|	int			bufferlen, readcount ;
  374|  1.50M|	sf_count_t	total = 0 ;
  375|       |
  376|  1.50M|	bufferlen = ARRAY_LEN (ubuf.ucbuf) ;
  ------------------
  |  |   88|  1.50M|#define		ARRAY_LEN(x)	((int) (sizeof (x) / sizeof ((x) [0])))
  ------------------
  377|       |
  378|  3.01M|	while (len > 0)
  ------------------
  |  Branch (378:9): [True: 1.50M, False: 1.50M]
  ------------------
  379|  1.50M|	{	if (len < bufferlen)
  ------------------
  |  Branch (379:8): [True: 1.50M, False: 0]
  ------------------
  380|  1.50M|			bufferlen = (int) len ;
  381|  1.50M|		readcount = (int) psf_fread (ubuf.ucbuf, 1, bufferlen, psf) ;
  382|  1.50M|		alaw2s_array (ubuf.ucbuf, readcount, ptr + total) ;
  383|  1.50M|		total += readcount ;
  384|  1.50M|		if (readcount < bufferlen)
  ------------------
  |  Branch (384:7): [True: 35, False: 1.50M]
  ------------------
  385|     35|			break ;
  386|  1.50M|		len -= readcount ;
  387|  1.50M|		} ;
  388|       |
  389|  1.50M|	return total ;
  390|  1.50M|} /* alaw_read_alaw2s */
alaw.c:alaw2s_array:
  295|  4.55M|{	for (int i = 0 ; i < count ; i++)
  ------------------
  |  Branch (295:20): [True: 3.04M, False: 1.50M]
  ------------------
  296|  3.04M|		ptr [i] = alaw_decode [(int) buffer [i]] ;
  297|  1.50M|} /* alaw2s_array */

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

audio_detect:
   48|  2.56k|{	VOTE vote ;
   49|       |
   50|  2.56k|	if (psf == NULL)
  ------------------
  |  Branch (50:6): [True: 0, False: 2.56k]
  ------------------
   51|      0|		return 0 ;
   52|       |
   53|  2.56k|	if (ad == NULL || datalen < 256)
  ------------------
  |  Branch (53:6): [True: 0, False: 2.56k]
  |  Branch (53:20): [True: 0, False: 2.56k]
  ------------------
   54|      0|		return 0 ;
   55|       |
   56|  2.56k|	vote_for_format (&vote, data, datalen) ;
   57|       |
   58|  2.56k|	psf_log_printf (psf, "audio_detect :\n"
   59|  2.56k|			"    le_float     : %d\n"
   60|  2.56k|			"    be_float     : %d\n"
   61|  2.56k|			"    le_int_24_32 : %d\n"
   62|  2.56k|			"    be_int_24_32 : %d\n",
   63|  2.56k|			vote.le_float, vote.be_float, vote.le_int_24_32, vote.be_int_24_32) ;
   64|       |
   65|  2.56k|	if (0) puts (psf->parselog.buf) ;
  ------------------
  |  Branch (65:6): [Folded, False: 2.56k]
  ------------------
   66|       |
   67|  2.56k|	if (ad->endianness == SF_ENDIAN_LITTLE && vote.le_float > (3 * datalen) / 4)
  ------------------
  |  Branch (67:6): [True: 2.56k, False: 0]
  |  Branch (67:44): [True: 6, False: 2.56k]
  ------------------
   68|      6|	{	/* Almost certainly 32 bit floats. */
   69|      6|		return SF_FORMAT_FLOAT ;
   70|  2.56k|		} ;
   71|       |
   72|  2.56k|	if (ad->endianness == SF_ENDIAN_LITTLE && vote.le_int_24_32 > (3 * datalen) / 4)
  ------------------
  |  Branch (72:6): [True: 2.56k, False: 0]
  |  Branch (72:44): [True: 4, False: 2.55k]
  ------------------
   73|      4|	{	/* Almost certainly 24 bit data stored in 32 bit ints. */
   74|      4|		return SF_FORMAT_PCM_32 ;
   75|  2.55k|		} ;
   76|       |
   77|  2.55k|	return 0 ;
   78|  2.56k|} /* data_detect */
audio_detect.c:vote_for_format:
   82|  2.56k|{
   83|  2.56k|	int k ;
   84|       |
   85|  2.56k|	memset (vote, 0, sizeof (VOTE)) ;
   86|       |
   87|  2.56k|	datalen -= datalen % 4 ;
   88|       |
   89|  10.5M|	for (k = 0 ; k < datalen ; k ++)
  ------------------
  |  Branch (89:15): [True: 10.5M, False: 2.56k]
  ------------------
   90|  10.5M|	{	if ((k % 4) == 0)
  ------------------
  |  Branch (90:8): [True: 2.63M, False: 7.89M]
  ------------------
   91|  2.63M|		{	if (data [k] == 0 && data [k + 1] != 0)
  ------------------
  |  Branch (91:9): [True: 2.54M, False: 88.2k]
  |  Branch (91:26): [True: 1.38k, False: 2.54M]
  ------------------
   92|  1.38k|				vote->le_int_24_32 += 4 ;
   93|       |
   94|  2.63M|			if (data [2] != 0 && data [3] == 0)
  ------------------
  |  Branch (94:8): [True: 92.1k, False: 2.53M]
  |  Branch (94:25): [True: 4.09k, False: 88.0k]
  ------------------
   95|  4.09k|				vote->le_int_24_32 += 4 ;
   96|       |
   97|  2.63M|			if (data [0] != 0 && data [3] > 0x43 && data [3] < 0x4B)
  ------------------
  |  Branch (97:8): [True: 92.1k, False: 2.53M]
  |  Branch (97:25): [True: 68.6k, False: 23.5k]
  |  Branch (97:44): [True: 6.14k, False: 62.4k]
  ------------------
   98|  6.14k|				vote->le_float += 4 ;
   99|       |
  100|  2.63M|			if (data [3] != 0 && data [0] > 0x43 && data [0] < 0x4B)
  ------------------
  |  Branch (100:8): [True: 88.0k, False: 2.54M]
  |  Branch (100:25): [True: 69.6k, False: 18.4k]
  |  Branch (100:44): [True: 6.14k, False: 63.4k]
  ------------------
  101|  6.14k|				vote->be_float += 4 ;
  102|  2.63M|			} ;
  103|  10.5M|		} ;
  104|       |
  105|  2.56k|	return ;
  106|  2.56k|} /* vote_for_format */

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

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

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

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

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

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

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

aiff.c:peak_info_calloc:
  226|    334|{	return calloc (1, sizeof (PEAK_INFO) + channels * sizeof (PEAK_POS)) ;
  227|    334|} /* peak_info_calloc */
aiff.c:psf_cues_points:
  983|    737|{	return cues->cue_points ;
  984|    737|} /* psf_cues_points */
aiff.c:make_size_t:
  272|  4.09k|{	return (size_t) x ;
  273|  4.09k|} /* make_size_t */
avr.c:arith_shift_left:
 1080|     90|{	return (int32_t) (((uint32_t) x) << shift) ;
 1081|     90|} /* arith_shift_left */
caf.c:peak_info_calloc:
  226|    431|{	return calloc (1, sizeof (PEAK_INFO) + channels * sizeof (PEAK_POS)) ;
  227|    431|} /* peak_info_calloc */
caf.c:psf_lrint:
  958|  2.48k|{
  959|  2.48k|	#ifdef USE_SSE2
  960|  2.48k|		return _mm_cvtsd_si32 (_mm_load_sd (&x)) ;
  961|       |	#else
  962|       |		return lrint (x) ;
  963|       |	#endif
  964|  2.48k|} /* psf_lrintf */
ircam.c:psf_lrintf:
  949|    359|{
  950|    359|	#ifdef USE_SSE2
  951|    359|		return _mm_cvtss_si32 (_mm_load_ss (&x)) ;
  952|       |	#else
  953|       |		return lrintf (x) ;
  954|       |	#endif
  955|    359|} /* psf_lrintf */
mat4.c:psf_lrint:
  958|    573|{
  959|    573|	#ifdef USE_SSE2
  960|    573|		return _mm_cvtsd_si32 (_mm_load_sd (&x)) ;
  961|       |	#else
  962|       |		return lrint (x) ;
  963|       |	#endif
  964|    573|} /* psf_lrintf */
mat5.c:psf_lrint:
  958|    104|{
  959|    104|	#ifdef USE_SSE2
  960|    104|		return _mm_cvtsd_si32 (_mm_load_sd (&x)) ;
  961|       |	#else
  962|       |		return lrint (x) ;
  963|       |	#endif
  964|    104|} /* psf_lrintf */
sds.c:arith_shift_left:
 1080|  66.5M|{	return (int32_t) (((uint32_t) x) << shift) ;
 1081|  66.5M|} /* arith_shift_left */
wavlike.c:make_size_t:
  272|    642|{	return (size_t) x ;
  273|    642|} /* make_size_t */
wavlike.c:psf_cues_points:
  983|    457|{	return cues->cue_points ;
  984|    457|} /* psf_cues_points */
wavlike.c:peak_info_calloc:
  226|    655|{	return calloc (1, sizeof (PEAK_INFO) + channels * sizeof (PEAK_POS)) ;
  227|    655|} /* peak_info_calloc */
wav.c:psf_cues_points:
  983|  1.54k|{	return cues->cue_points ;
  984|  1.54k|} /* psf_cues_points */
xi.c:arith_shift_left:
 1080|    388|{	return (int32_t) (((uint32_t) x) << shift) ;
 1081|    388|} /* arith_shift_left */
mpc2k.c:make_size_t:
  272|      6|{	return (size_t) x ;
  273|      6|} /* make_size_t */
double64.c:psf_lrint:
  958|  61.2k|{
  959|  61.2k|	#ifdef USE_SSE2
  960|  61.2k|		return _mm_cvtsd_si32 (_mm_load_sd (&x)) ;
  961|       |	#else
  962|       |		return lrint (x) ;
  963|       |	#endif
  964|  61.2k|} /* psf_lrintf */
dwvw.c:arith_shift_left:
 1080|  11.7M|{	return (int32_t) (((uint32_t) x) << shift) ;
 1081|  11.7M|} /* arith_shift_left */
float32.c:psf_lrintf:
  949|    649|{
  950|    649|	#ifdef USE_SSE2
  951|    649|		return _mm_cvtss_si32 (_mm_load_ss (&x)) ;
  952|       |	#else
  953|       |		return lrintf (x) ;
  954|       |	#endif
  955|    649|} /* psf_lrintf */
ima_oki_adpcm.c:arith_shift_left:
 1080|    249|{	return (int32_t) (((uint32_t) x) << shift) ;
 1081|    249|} /* arith_shift_left */

double64_init:
   92|    352|{	static int double64_caps ;
   93|       |
   94|    352|	if (psf->sf.channels < 1 || psf->sf.channels > SF_MAX_CHANNELS)
  ------------------
  |  |   95|    315|#define		SF_MAX_CHANNELS		1024
  ------------------
  |  Branch (94:6): [True: 37, False: 315]
  |  Branch (94:30): [True: 19, False: 296]
  ------------------
   95|     56|	{	psf_log_printf (psf, "double64_init : internal error : channels = %d\n", psf->sf.channels) ;
   96|     56|		return SFE_INTERNAL ;
   97|    296|		} ;
   98|       |
   99|    296|	double64_caps = double64_get_capability (psf) ;
  100|       |
  101|    296|	psf->blockwidth = sizeof (double) * psf->sf.channels ;
  102|       |
  103|    296|	if (psf->file.mode == SFM_READ || psf->file.mode == SFM_RDWR)
  ------------------
  |  Branch (103:6): [True: 296, False: 0]
  |  Branch (103:36): [True: 0, False: 0]
  ------------------
  104|    296|	{	switch (psf->endian + double64_caps)
  105|    296|		{	case (SF_ENDIAN_BIG + DOUBLE_CAN_RW_BE) :
  ------------------
  |  Branch (105:5): [True: 0, False: 296]
  ------------------
  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|    233|			case (SF_ENDIAN_LITTLE + DOUBLE_CAN_RW_LE) :
  ------------------
  |  Branch (113:4): [True: 233, False: 63]
  ------------------
  114|    233|					psf->data_endswap = SF_FALSE ;
  115|    233|					psf->read_short		= host_read_d2s ;
  116|    233|					psf->read_int		= host_read_d2i ;
  117|    233|					psf->read_float		= host_read_d2f ;
  118|    233|					psf->read_double	= host_read_d ;
  119|    233|					break ;
  120|       |
  121|     63|			case (SF_ENDIAN_BIG + DOUBLE_CAN_RW_LE) :
  ------------------
  |  Branch (121:4): [True: 63, False: 233]
  ------------------
  122|     63|					psf->data_endswap = SF_TRUE ;
  123|     63|					psf->read_short		= host_read_d2s ;
  124|     63|					psf->read_int		= host_read_d2i ;
  125|     63|					psf->read_float		= host_read_d2f ;
  126|     63|					psf->read_double	= host_read_d ;
  127|     63|					break ;
  128|       |
  129|      0|			case (SF_ENDIAN_LITTLE + DOUBLE_CAN_RW_BE) :
  ------------------
  |  Branch (129:4): [True: 0, False: 296]
  ------------------
  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: 296]
  ------------------
  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: 296]
  ------------------
  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: 296]
  ------------------
  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: 296]
  ------------------
  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: 296]
  ------------------
  171|    296|			} ;
  172|    296|		} ;
  173|       |
  174|    296|	if (psf->file.mode == SFM_WRITE || psf->file.mode == SFM_RDWR)
  ------------------
  |  Branch (174:6): [True: 0, False: 296]
  |  Branch (174:37): [True: 0, False: 296]
  ------------------
  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|    296|		} ;
  244|       |
  245|    296|	if (psf->filelength > psf->dataoffset)
  ------------------
  |  Branch (245:6): [True: 184, False: 112]
  ------------------
  246|    184|	{	psf->datalength = (psf->dataend > 0) ? psf->dataend - psf->dataoffset :
  ------------------
  |  Branch (246:22): [True: 6, False: 178]
  ------------------
  247|    184|							psf->filelength - psf->dataoffset ;
  248|    184|		}
  249|    112|	else
  250|    112|		psf->datalength = 0 ;
  251|       |
  252|    296|	psf->sf.frames = psf->datalength / psf->blockwidth ;
  253|       |
  254|    296|	return 0 ;
  255|    296|} /* double64_init */
double64_be_read:
  285|  2.69k|{	int		exponent, negative, upper, lower ;
  286|  2.69k|	double	dvalue ;
  287|       |
  288|  2.69k|	negative = (cptr [0] & 0x80) ? 1 : 0 ;
  ------------------
  |  Branch (288:13): [True: 237, False: 2.45k]
  ------------------
  289|  2.69k|	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.69k|	upper = (((cptr [1] & 0xF) << 24) | (cptr [2] << 16) | (cptr [3] << 8) | cptr [4]) ;
  293|  2.69k|	lower = (cptr [5] << 16) | (cptr [6] << 8) | cptr [7] ;
  294|       |
  295|  2.69k|	if (exponent == 0 && upper == 0 && lower == 0)
  ------------------
  |  Branch (295:6): [True: 448, False: 2.24k]
  |  Branch (295:23): [True: 228, False: 220]
  |  Branch (295:37): [True: 190, False: 38]
  ------------------
  296|    190|		return 0.0 ;
  297|       |
  298|  2.50k|	dvalue = upper + lower / ((double) 0x1000000) ;
  299|  2.50k|	dvalue += 0x10000000 ;
  300|       |
  301|  2.50k|	exponent = exponent - 0x3FF ;
  302|       |
  303|  2.50k|	dvalue = dvalue / ((double) 0x10000000) ;
  304|       |
  305|  2.50k|	if (negative)
  ------------------
  |  Branch (305:6): [True: 237, False: 2.26k]
  ------------------
  306|    237|		dvalue *= -1 ;
  307|       |
  308|  2.50k|	if (exponent > 0)
  ------------------
  |  Branch (308:6): [True: 1.72k, False: 781]
  ------------------
  309|  1.72k|		dvalue *= pow (2.0, exponent) ;
  310|    781|	else if (exponent < 0)
  ------------------
  |  Branch (310:11): [True: 778, False: 3]
  ------------------
  311|    778|		dvalue /= pow (2.0, abs (exponent)) ;
  312|       |
  313|  2.50k|	return dvalue ;
  314|  2.69k|} /* double64_be_read */
double64_le_read:
  318|    538|{	int		exponent, negative, upper, lower ;
  319|    538|	double	dvalue ;
  320|       |
  321|    538|	negative = (cptr [7] & 0x80) ? 1 : 0 ;
  ------------------
  |  Branch (321:13): [True: 116, False: 422]
  ------------------
  322|    538|	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|    538|	upper = ((cptr [6] & 0xF) << 24) | (cptr [5] << 16) | (cptr [4] << 8) | cptr [3] ;
  326|    538|	lower = (cptr [2] << 16) | (cptr [1] << 8) | cptr [0] ;
  327|       |
  328|    538|	if (exponent == 0 && upper == 0 && lower == 0)
  ------------------
  |  Branch (328:6): [True: 263, False: 275]
  |  Branch (328:23): [True: 135, False: 128]
  |  Branch (328:37): [True: 67, False: 68]
  ------------------
  329|     67|		return 0.0 ;
  330|       |
  331|    471|	dvalue = upper + lower / ((double) 0x1000000) ;
  332|    471|	dvalue += 0x10000000 ;
  333|       |
  334|    471|	exponent = exponent - 0x3FF ;
  335|       |
  336|    471|	dvalue = dvalue / ((double) 0x10000000) ;
  337|       |
  338|    471|	if (negative)
  ------------------
  |  Branch (338:6): [True: 116, False: 355]
  ------------------
  339|    116|		dvalue *= -1 ;
  340|       |
  341|    471|	if (exponent > 0)
  ------------------
  |  Branch (341:6): [True: 160, False: 311]
  ------------------
  342|    160|		dvalue *= pow (2.0, exponent) ;
  343|    311|	else if (exponent < 0)
  ------------------
  |  Branch (343:11): [True: 308, False: 3]
  ------------------
  344|    308|		dvalue /= pow (2.0, abs (exponent)) ;
  345|       |
  346|    471|	return dvalue ;
  347|    538|} /* double64_le_read */
double64.c:double64_get_capability:
  459|    296|{	union
  460|    296|	{	double			d ;
  461|    296|		unsigned char	c [8] ;
  462|    296|	} data ;
  463|       |
  464|    296|	data.d = 1.234567890123456789 ; /* Some arbitrary value. */
  465|       |
  466|    296|	if (! psf->ieee_replace)
  ------------------
  |  Branch (466:6): [True: 296, False: 0]
  ------------------
  467|    296|	{	/* If this test is true ints and floats are compatible and little endian. */
  468|    296|		if (data.c [0] == 0xfb && data.c [1] == 0x59 && data.c [2] == 0x8c && data.c [3] == 0x42 &&
  ------------------
  |  Branch (468:7): [True: 296, False: 0]
  |  Branch (468:29): [True: 296, False: 0]
  |  Branch (468:51): [True: 296, False: 0]
  |  Branch (468:73): [True: 296, False: 0]
  ------------------
  469|    296|			data.c [4] == 0xca && data.c [5] == 0xc0 && data.c [6] == 0xf3 && data.c [7] == 0x3f)
  ------------------
  |  Branch (469:4): [True: 296, False: 0]
  |  Branch (469:26): [True: 296, False: 0]
  |  Branch (469:48): [True: 296, False: 0]
  |  Branch (469:70): [True: 296, False: 0]
  ------------------
  470|    296|			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|    296|} /* double64_get_capability */
double64.c:host_read_d2s:
  562|    516|{	BUF_UNION	ubuf ;
  563|    516|	void		(*convert) (const double *, int, short *, double) ;
  564|    516|	int			bufferlen, readcount ;
  565|    516|	sf_count_t	total = 0 ;
  566|    516|	double		scale ;
  567|       |
  568|    516|	convert = (psf->add_clipping) ? d2s_clip_array : d2s_array ;
  ------------------
  |  Branch (568:12): [True: 0, False: 516]
  ------------------
  569|    516|	bufferlen = ARRAY_LEN (ubuf.dbuf) ;
  ------------------
  |  |   88|    516|#define		ARRAY_LEN(x)	((int) (sizeof (x) / sizeof ((x) [0])))
  ------------------
  570|    516|	scale = (psf->float_int_mult == 0) ? 1.0 : 0x7FFF / psf->float_max ;
  ------------------
  |  Branch (570:10): [True: 516, False: 0]
  ------------------
  571|       |
  572|    992|	while (len > 0)
  ------------------
  |  Branch (572:9): [True: 516, False: 476]
  ------------------
  573|    516|	{	if (len < bufferlen)
  ------------------
  |  Branch (573:8): [True: 450, False: 66]
  ------------------
  574|    450|			bufferlen = (int) len ;
  575|    516|		readcount = (int) psf_fread (ubuf.dbuf, sizeof (double), bufferlen, psf) ;
  576|       |
  577|    516|		if (psf->data_endswap == SF_TRUE)
  ------------------
  |  Branch (577:7): [True: 214, False: 302]
  ------------------
  578|    214|			endswap_double_array (ubuf.dbuf, readcount) ;
  579|       |
  580|    516|		convert (ubuf.dbuf, readcount, ptr + total, scale) ;
  581|    516|		total += readcount ;
  582|    516|		len -= readcount ;
  583|    516|		if (readcount < bufferlen)
  ------------------
  |  Branch (583:7): [True: 40, False: 476]
  ------------------
  584|     40|			break ;
  585|    516|		} ;
  586|       |
  587|    516|	return total ;
  588|    516|} /* host_read_d2s */
double64.c:d2s_array:
  489|  61.7k|{	for (int i = 0 ; i < count ; i++)
  ------------------
  |  Branch (489:20): [True: 61.2k, False: 516]
  ------------------
  490|  61.2k|	{	dest [i] = psf_lrint (scale * src [i]) ;
  491|  61.2k|		} ;
  492|    516|} /* d2s_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|    333|{	DWVW_PRIVATE	*pdwvw ;
   81|       |
   82|    333|	if (psf->codec_data != NULL)
  ------------------
  |  Branch (82:6): [True: 0, False: 333]
  ------------------
   83|      0|	{	psf_log_printf (psf, "*** psf->codec_data is not NULL.\n") ;
   84|      0|		return SFE_INTERNAL ;
   85|    333|		} ;
   86|       |
   87|    333|	if (bitwidth > 24)
  ------------------
  |  Branch (87:6): [True: 0, False: 333]
  ------------------
   88|      0|		return SFE_DWVW_BAD_BITWIDTH ;
   89|       |
   90|    333|	if (psf->file.mode == SFM_RDWR)
  ------------------
  |  Branch (90:6): [True: 0, False: 333]
  ------------------
   91|      0|		return SFE_BAD_MODE_RW ;
   92|       |
   93|    333|	if ((pdwvw = calloc (1, sizeof (DWVW_PRIVATE))) == NULL)
  ------------------
  |  Branch (93:6): [True: 0, False: 333]
  ------------------
   94|      0|		return SFE_MALLOC_FAILED ;
   95|       |
   96|    333|	psf->codec_data = (void*) pdwvw ;
   97|    333|	pdwvw->bit_width 	= bitwidth ;
   98|    333|	dwvw_read_reset (pdwvw) ;
   99|       |
  100|    333|	if (psf->file.mode == SFM_READ)
  ------------------
  |  Branch (100:6): [True: 333, False: 0]
  ------------------
  101|    333|	{	psf->read_short		= dwvw_read_s ;
  102|    333|		psf->read_int		= dwvw_read_i ;
  103|    333|		psf->read_float		= dwvw_read_f ;
  104|    333|		psf->read_double	= dwvw_read_d ;
  105|    333|		} ;
  106|       |
  107|    333|	if (psf->file.mode == SFM_WRITE)
  ------------------
  |  Branch (107:6): [True: 0, False: 333]
  ------------------
  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|    333|	psf->codec_close = dwvw_close ;
  115|    333|	psf->seek = dwvw_seek ;
  116|    333|	psf->byterate = dwvw_byterate ;
  117|       |
  118|    333|	if (psf->file.mode == SFM_READ)
  ------------------
  |  Branch (118:6): [True: 333, False: 0]
  ------------------
  119|    333|	{	psf->sf.frames = psf_decode_frame_count (psf) ;
  120|    333|		dwvw_read_reset (pdwvw) ;
  121|    333|		} ;
  122|       |
  123|    333|	return 0 ;
  124|    333|} /* dwvw_init */
dwvw.c:dwvw_close:
  131|    333|{	DWVW_PRIVATE *pdwvw ;
  132|       |
  133|    333|	if (psf->codec_data == NULL)
  ------------------
  |  Branch (133:6): [True: 0, False: 333]
  ------------------
  134|      0|		return 0 ;
  135|    333|	pdwvw = (DWVW_PRIVATE*) psf->codec_data ;
  136|       |
  137|    333|	if (psf->file.mode == SFM_WRITE)
  ------------------
  |  Branch (137:6): [True: 0, False: 333]
  ------------------
  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|    333|	return 0 ;
  151|    333|} /* dwvw_close */
dwvw.c:dwvw_read_s:
  188|  2.68M|{	DWVW_PRIVATE *pdwvw ;
  189|  2.68M|	BUF_UNION	ubuf ;
  190|  2.68M|	int		*iptr ;
  191|  2.68M|	int		k, bufferlen, readcount = 0, count ;
  192|  2.68M|	sf_count_t	total = 0 ;
  193|       |
  194|  2.68M|	if (! psf->codec_data)
  ------------------
  |  Branch (194:6): [True: 0, False: 2.68M]
  ------------------
  195|      0|		return 0 ;
  196|  2.68M|	pdwvw = (DWVW_PRIVATE*) psf->codec_data ;
  197|       |
  198|  2.68M|	iptr = ubuf.ibuf ;
  199|  2.68M|	bufferlen = ARRAY_LEN (ubuf.ibuf) ;
  ------------------
  |  |   88|  2.68M|#define		ARRAY_LEN(x)	((int) (sizeof (x) / sizeof ((x) [0])))
  ------------------
  200|  5.36M|	while (len > 0)
  ------------------
  |  Branch (200:9): [True: 2.68M, False: 2.68M]
  ------------------
  201|  2.68M|	{	readcount = (len >= bufferlen) ? bufferlen : (int) len ;
  ------------------
  |  Branch (201:16): [True: 0, False: 2.68M]
  ------------------
  202|  2.68M|		count = dwvw_decode_data (psf, pdwvw, iptr, readcount) ;
  203|  5.59M|		for (k = 0 ; k < readcount ; k++)
  ------------------
  |  Branch (203:16): [True: 2.91M, False: 2.68M]
  ------------------
  204|  2.91M|			ptr [total + k] = iptr [k] >> 16 ;
  205|       |
  206|  2.68M|		total += count ;
  207|  2.68M|		len -= readcount ;
  208|  2.68M|		if (count != readcount)
  ------------------
  |  Branch (208:7): [True: 142, False: 2.68M]
  ------------------
  209|    142|			break ;
  210|  2.68M|		} ;
  211|       |
  212|  2.68M|	return total ;
  213|  2.68M|} /* dwvw_read_s */
dwvw.c:dwvw_decode_data:
  306|  2.68M|{	int	count ;
  307|  2.68M|	int delta_width_modifier, delta_width, delta_negative, delta, sample ;
  308|       |
  309|       |	/* Restore state from last decode call. */
  310|  2.68M|	delta_width = pdwvw->last_delta_width ;
  311|  2.68M|	sample = pdwvw->last_sample ;
  312|       |
  313|  8.84M|	for (count = 0 ; count < len ; count++)
  ------------------
  |  Branch (313:19): [True: 6.15M, False: 2.68M]
  ------------------
  314|  6.15M|	{	/* If bit_count parameter is zero get the delta_width_modifier. */
  315|  6.15M|		delta_width_modifier = dwvw_decode_load_bits (psf, pdwvw, -1) ;
  316|       |
  317|       |		/* Check for end of input bit stream. Break loop if end. */
  318|  6.15M|		if (delta_width_modifier < 0 || (pdwvw->b.end == 0 && count == 0))
  ------------------
  |  Branch (318:7): [True: 114, False: 6.15M]
  |  Branch (318:36): [True: 86.6k, False: 6.07M]
  |  Branch (318:57): [True: 389, False: 86.2k]
  ------------------
  319|    503|			break ;
  320|       |
  321|  6.15M|		if (delta_width_modifier && dwvw_decode_load_bits (psf, pdwvw, 1))
  ------------------
  |  Branch (321:7): [True: 1.07M, False: 5.07M]
  |  Branch (321:31): [True: 137k, False: 940k]
  ------------------
  322|   137k|			delta_width_modifier = - delta_width_modifier ;
  323|       |
  324|       |		/* Calculate the current word width. */
  325|  6.15M|		delta_width = (delta_width + delta_width_modifier + pdwvw->bit_width) % pdwvw->bit_width ;
  326|       |
  327|       |		/* Load the delta. */
  328|  6.15M|		delta = 0 ;
  329|  6.15M|		if (delta_width)
  ------------------
  |  Branch (329:7): [True: 4.02M, False: 2.13M]
  ------------------
  330|  4.02M|		{	delta = dwvw_decode_load_bits (psf, pdwvw, delta_width - 1) | (1 << (delta_width - 1)) ;
  331|  4.02M|			delta_negative = dwvw_decode_load_bits (psf, pdwvw, 1) ;
  332|  4.02M|			if (delta == pdwvw->max_delta - 1)
  ------------------
  |  Branch (332:8): [True: 307k, False: 3.72M]
  ------------------
  333|   307k|				delta += dwvw_decode_load_bits (psf, pdwvw, 1) ;
  334|  4.02M|			if (delta_negative)
  ------------------
  |  Branch (334:8): [True: 2.95M, False: 1.07M]
  ------------------
  335|  2.95M|				delta = -delta ;
  336|  4.02M|			} ;
  337|       |
  338|       |		/* Calculate the sample */
  339|  6.15M|		sample += delta ;
  340|       |
  341|  6.15M|		if (sample >= pdwvw->max_delta)
  ------------------
  |  Branch (341:7): [True: 85.4k, False: 6.07M]
  ------------------
  342|  85.4k|			sample -= pdwvw->span ;
  343|  6.07M|		else if (sample < - pdwvw->max_delta)
  ------------------
  |  Branch (343:12): [True: 175k, False: 5.89M]
  ------------------
  344|   175k|			sample += pdwvw->span ;
  345|       |
  346|       |		/* Store the sample justifying to the most significant bit. */
  347|  6.15M|		ptr [count] = arith_shift_left (sample, 32 - pdwvw->bit_width) ;
  348|       |
  349|  6.15M|		if (pdwvw->b.end == 0 && pdwvw->bit_count == 0)
  ------------------
  |  Branch (349:7): [True: 86.4k, False: 6.07M]
  |  Branch (349:28): [True: 206, False: 86.2k]
  ------------------
  350|    206|			break ;
  351|  6.15M|		} ;
  352|       |
  353|  2.68M|	pdwvw->last_delta_width = delta_width ;
  354|  2.68M|	pdwvw->last_sample = sample ;
  355|       |
  356|  2.68M|	pdwvw->samplecount += count ;
  357|       |
  358|  2.68M|	return count ;
  359|  2.68M|} /* dwvw_decode_data */
dwvw.c:dwvw_decode_load_bits:
  363|  15.6M|{	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|  15.6M|	if (bit_count < 0)
  ------------------
  |  Branch (371:6): [True: 6.15M, False: 9.44M]
  ------------------
  372|  6.15M|	{	get_dwm = SF_TRUE ;
  373|       |		/* modify bit_count to ensure we have enough bits for finding dwm. */
  374|  6.15M|		bit_count = pdwvw->dwm_maxsize ;
  375|  6.15M|		} ;
  376|       |
  377|       |	/* Load bits in bit reseviour. */
  378|  21.2M|	while (pdwvw->bit_count < bit_count)
  ------------------
  |  Branch (378:9): [True: 5.65M, False: 15.5M]
  ------------------
  379|  5.65M|	{	if (pdwvw->b.index >= pdwvw->b.end)
  ------------------
  |  Branch (379:8): [True: 245k, False: 5.41M]
  ------------------
  380|   245k|		{	pdwvw->b.end = (int) psf_fread (pdwvw->b.buffer, 1, sizeof (pdwvw->b.buffer), psf) ;
  381|   245k|			pdwvw->b.index = 0 ;
  382|   245k|			} ;
  383|       |
  384|       |		/* Check for end of input stream. */
  385|  5.65M|		if (bit_count < 8 && pdwvw->b.end == 0)
  ------------------
  |  Branch (385:7): [True: 1.10M, False: 4.55M]
  |  Branch (385:24): [True: 30.3k, False: 1.07M]
  ------------------
  386|  30.3k|			return -1 ;
  387|       |
  388|  5.62M|		pdwvw->bits = arith_shift_left (pdwvw->bits, 8) ;
  389|       |
  390|  5.62M|		if (pdwvw->b.index < pdwvw->b.end)
  ------------------
  |  Branch (390:7): [True: 5.43M, False: 193k]
  ------------------
  391|  5.43M|		{	pdwvw->bits |= pdwvw->b.buffer [pdwvw->b.index] ;
  392|  5.43M|			pdwvw->b.index ++ ;
  393|  5.43M|			} ;
  394|  5.62M|		pdwvw->bit_count += 8 ;
  395|  15.5M|		} ;
  396|       |
  397|       |	/* If asked to get bits do so. */
  398|  15.5M|	if (! get_dwm)
  ------------------
  |  Branch (398:6): [True: 9.41M, False: 6.15M]
  ------------------
  399|  9.41M|	{	output = (pdwvw->bits >> (pdwvw->bit_count - bit_count)) & ((1 << bit_count) - 1) ;
  400|  9.41M|		pdwvw->bit_count -= bit_count ;
  401|  9.41M|		return output ;
  402|  9.41M|		} ;
  403|       |
  404|       |	/* Otherwise must have been asked to get delta_width_modifier. */
  405|  13.5M|	while (output < (pdwvw->dwm_maxsize))
  ------------------
  |  Branch (405:9): [True: 12.6M, False: 877k]
  ------------------
  406|  12.6M|	{	pdwvw->bit_count -= 1 ;
  407|  12.6M|		if (pdwvw->bits & (1 << pdwvw->bit_count))
  ------------------
  |  Branch (407:7): [True: 5.28M, False: 7.35M]
  ------------------
  408|  5.28M|			break ;
  409|  7.35M|		output += 1 ;
  410|  7.35M|		} ;
  411|       |
  412|  6.15M|	return output ;
  413|  15.5M|} /* dwvw_decode_load_bits */
dwvw.c:dwvw_read_i:
  217|  2.17k|{	DWVW_PRIVATE *pdwvw ;
  218|  2.17k|	int			readcount, count ;
  219|  2.17k|	sf_count_t	total = 0 ;
  220|       |
  221|  2.17k|	if (! psf->codec_data)
  ------------------
  |  Branch (221:6): [True: 0, False: 2.17k]
  ------------------
  222|      0|		return 0 ;
  223|  2.17k|	pdwvw = (DWVW_PRIVATE*) psf->codec_data ;
  224|       |
  225|  3.78k|	while (len > 0)
  ------------------
  |  Branch (225:9): [True: 2.17k, False: 1.61k]
  ------------------
  226|  2.17k|	{	readcount = (len > 0x10000000) ? 0x10000000 : (int) len ;
  ------------------
  |  Branch (226:16): [True: 0, False: 2.17k]
  ------------------
  227|       |
  228|  2.17k|		count = dwvw_decode_data (psf, pdwvw, ptr, readcount) ;
  229|       |
  230|  2.17k|		total += count ;
  231|  2.17k|		len -= count ;
  232|       |
  233|  2.17k|		if (count != readcount)
  ------------------
  |  Branch (233:7): [True: 567, False: 1.61k]
  ------------------
  234|    567|			break ;
  235|  2.17k|		} ;
  236|       |
  237|  2.17k|	return total ;
  238|  2.17k|} /* dwvw_read_i */
dwvw.c:dwvw_read_reset:
  417|    666|{	int bitwidth = pdwvw->bit_width ;
  418|       |
  419|    666|	memset (pdwvw, 0, sizeof (DWVW_PRIVATE)) ;
  420|       |
  421|    666|	pdwvw->bit_width	= bitwidth ;
  422|    666|	pdwvw->dwm_maxsize	= bitwidth / 2 ;
  423|    666|	pdwvw->max_delta	= 1 << (bitwidth - 1) ;
  424|    666|	pdwvw->span			= 1 << bitwidth ;
  425|    666|} /* dwvw_read_reset */

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

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

float32_init:
   89|    339|{	static int float_caps ;
   90|       |
   91|    339|	if (psf->sf.channels < 1)
  ------------------
  |  Branch (91:6): [True: 34, False: 305]
  ------------------
   92|     34|	{	psf_log_printf (psf, "float32_init : internal error : channels = %d\n", psf->sf.channels) ;
   93|     34|		return SFE_INTERNAL ;
   94|    305|		} ;
   95|       |
   96|    305|	float_caps = float32_get_capability (psf) ;
   97|       |
   98|    305|	psf->blockwidth = sizeof (float) * psf->sf.channels ;
   99|       |
  100|    305|	if (psf->file.mode == SFM_READ || psf->file.mode == SFM_RDWR)
  ------------------
  |  Branch (100:6): [True: 305, False: 0]
  |  Branch (100:36): [True: 0, False: 0]
  ------------------
  101|    305|	{	switch (psf->endian + float_caps)
  102|    305|		{	case (SF_ENDIAN_BIG + FLOAT_CAN_RW_BE) :
  ------------------
  |  Branch (102:5): [True: 0, False: 305]
  ------------------
  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|    248|			case (SF_ENDIAN_LITTLE + FLOAT_CAN_RW_LE) :
  ------------------
  |  Branch (110:4): [True: 248, False: 57]
  ------------------
  111|    248|					psf->data_endswap = SF_FALSE ;
  112|    248|					psf->read_short		= host_read_f2s ;
  113|    248|					psf->read_int		= host_read_f2i ;
  114|    248|					psf->read_float		= host_read_f ;
  115|    248|					psf->read_double	= host_read_f2d ;
  116|    248|					break ;
  117|       |
  118|     57|			case (SF_ENDIAN_BIG + FLOAT_CAN_RW_LE) :
  ------------------
  |  Branch (118:4): [True: 57, False: 248]
  ------------------
  119|     57|					psf->data_endswap = SF_TRUE ;
  120|     57|					psf->read_short		= host_read_f2s ;
  121|     57|					psf->read_int		= host_read_f2i ;
  122|     57|					psf->read_float		= host_read_f ;
  123|     57|					psf->read_double	= host_read_f2d ;
  124|     57|					break ;
  125|       |
  126|      0|			case (SF_ENDIAN_LITTLE + FLOAT_CAN_RW_BE) :
  ------------------
  |  Branch (126:4): [True: 0, False: 305]
  ------------------
  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: 305]
  ------------------
  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: 305]
  ------------------
  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: 305]
  ------------------
  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: 305]
  ------------------
  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: 305]
  ------------------
  168|    305|			} ;
  169|    305|		} ;
  170|       |
  171|    305|	if (psf->file.mode == SFM_WRITE || psf->file.mode == SFM_RDWR)
  ------------------
  |  Branch (171:6): [True: 0, False: 305]
  |  Branch (171:37): [True: 0, False: 305]
  ------------------
  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|    305|		} ;
  241|       |
  242|    305|	if (psf->filelength > psf->dataoffset)
  ------------------
  |  Branch (242:6): [True: 202, False: 103]
  ------------------
  243|    202|	{	psf->datalength = (psf->dataend > 0) ? psf->dataend - psf->dataoffset :
  ------------------
  |  Branch (243:22): [True: 20, False: 182]
  ------------------
  244|    202|							psf->filelength - psf->dataoffset ;
  245|    202|		}
  246|    103|	else
  247|    103|		psf->datalength = 0 ;
  248|       |
  249|    305|	psf->sf.frames = psf->blockwidth > 0 ? psf->datalength / psf->blockwidth : 0 ;
  ------------------
  |  Branch (249:19): [True: 305, False: 0]
  ------------------
  250|       |
  251|    305|	return 0 ;
  252|    305|} /* float32_init */
float32_be_read:
  256|  16.7k|{	int		exponent, mantissa, negative ;
  257|  16.7k|	float	fvalue ;
  258|       |
  259|  16.7k|	negative = cptr [0] & 0x80 ;
  260|  16.7k|	exponent = ((cptr [0] & 0x7F) << 1) | ((cptr [1] & 0x80) ? 1 : 0) ;
  ------------------
  |  Branch (260:41): [True: 4.13k, False: 12.6k]
  ------------------
  261|  16.7k|	mantissa = ((cptr [1] & 0x7F) << 16) | (cptr [2] << 8) | (cptr [3]) ;
  262|       |
  263|  16.7k|	if (! (exponent || mantissa))
  ------------------
  |  Branch (263:9): [True: 9.40k, False: 7.33k]
  |  Branch (263:21): [True: 2.68k, False: 4.65k]
  ------------------
  264|  4.65k|		return 0.0 ;
  265|       |
  266|  12.0k|	mantissa |= 0x800000 ;
  267|  12.0k|	exponent = exponent ? exponent - 127 : 0 ;
  ------------------
  |  Branch (267:13): [True: 9.40k, False: 2.68k]
  ------------------
  268|       |
  269|  12.0k|	fvalue = mantissa ? ((float) mantissa) / ((float) 0x800000) : 0.0 ;
  ------------------
  |  Branch (269:11): [True: 12.0k, False: 0]
  ------------------
  270|       |
  271|  12.0k|	if (negative)
  ------------------
  |  Branch (271:6): [True: 3.77k, False: 8.31k]
  ------------------
  272|  3.77k|		fvalue *= -1 ;
  273|       |
  274|  12.0k|	if (exponent > 0)
  ------------------
  |  Branch (274:6): [True: 5.39k, False: 6.69k]
  ------------------
  275|  5.39k|		fvalue *= pow (2.0, exponent) ;
  276|  6.69k|	else if (exponent < 0)
  ------------------
  |  Branch (276:11): [True: 4.01k, False: 2.68k]
  ------------------
  277|  4.01k|		fvalue /= pow (2.0, abs (exponent)) ;
  278|       |
  279|  12.0k|	return fvalue ;
  280|  16.7k|} /* float32_be_read */
float32_le_read:
  284|  53.7k|{	int		exponent, mantissa, negative ;
  285|  53.7k|	float	fvalue ;
  286|       |
  287|  53.7k|	negative = cptr [3] & 0x80 ;
  288|  53.7k|	exponent = ((cptr [3] & 0x7F) << 1) | ((cptr [2] & 0x80) ? 1 : 0) ;
  ------------------
  |  Branch (288:41): [True: 3.22k, False: 50.5k]
  ------------------
  289|  53.7k|	mantissa = ((cptr [2] & 0x7F) << 16) | (cptr [1] << 8) | (cptr [0]) ;
  290|       |
  291|  53.7k|	if (! (exponent || mantissa))
  ------------------
  |  Branch (291:9): [True: 7.64k, False: 46.0k]
  |  Branch (291:21): [True: 1.24k, False: 44.8k]
  ------------------
  292|  44.8k|		return 0.0 ;
  293|       |
  294|  8.89k|	mantissa |= 0x800000 ;
  295|  8.89k|	exponent = exponent ? exponent - 127 : 0 ;
  ------------------
  |  Branch (295:13): [True: 7.64k, False: 1.24k]
  ------------------
  296|       |
  297|  8.89k|	fvalue = mantissa ? ((float) mantissa) / ((float) 0x800000) : 0.0 ;
  ------------------
  |  Branch (297:11): [True: 8.89k, False: 0]
  ------------------
  298|       |
  299|  8.89k|	if (negative)
  ------------------
  |  Branch (299:6): [True: 3.30k, False: 5.58k]
  ------------------
  300|  3.30k|		fvalue *= -1 ;
  301|       |
  302|  8.89k|	if (exponent > 0)
  ------------------
  |  Branch (302:6): [True: 5.90k, False: 2.98k]
  ------------------
  303|  5.90k|		fvalue *= pow (2.0, exponent) ;
  304|  2.98k|	else if (exponent < 0)
  ------------------
  |  Branch (304:11): [True: 1.73k, False: 1.25k]
  ------------------
  305|  1.73k|		fvalue /= pow (2.0, abs (exponent)) ;
  306|       |
  307|  8.89k|	return fvalue ;
  308|  53.7k|} /* float32_le_read */
float32.c:float32_get_capability:
  410|    305|{	union
  411|    305|	{	float			f ;
  412|    305|		int				i ;
  413|    305|		unsigned char	c [4] ;
  414|    305|	} data ;
  415|       |
  416|    305|	data.f = (float) 1.23456789 ; /* Some arbitrary value. */
  417|       |
  418|    305|	if (! psf->ieee_replace)
  ------------------
  |  Branch (418:6): [True: 305, False: 0]
  ------------------
  419|    305|	{	/* If this test is true ints and floats are compatible and little endian. */
  420|    305|		if (data.c [0] == 0x52 && data.c [1] == 0x06 && data.c [2] == 0x9e && data.c [3] == 0x3f)
  ------------------
  |  Branch (420:7): [True: 305, False: 0]
  |  Branch (420:29): [True: 305, False: 0]
  |  Branch (420:51): [True: 305, False: 0]
  |  Branch (420:73): [True: 305, False: 0]
  ------------------
  421|    305|			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|    305|} /* float32_get_capability */
float32.c:host_read_f2s:
  513|    445|{	BUF_UNION	ubuf ;
  514|    445|	void		(*convert) (const float *, int, short *, float) ;
  515|    445|	int			bufferlen, readcount ;
  516|    445|	sf_count_t	total = 0 ;
  517|    445|	float		scale ;
  518|       |
  519|    445|	convert = (psf->add_clipping) ? f2s_clip_array : f2s_array ;
  ------------------
  |  Branch (519:12): [True: 0, False: 445]
  ------------------
  520|    445|	bufferlen = ARRAY_LEN (ubuf.fbuf) ;
  ------------------
  |  |   88|    445|#define		ARRAY_LEN(x)	((int) (sizeof (x) / sizeof ((x) [0])))
  ------------------
  521|    445|	scale = (psf->float_int_mult == 0) ? 1.0 : 0x7FFF / psf->float_max ;
  ------------------
  |  Branch (521:10): [True: 445, False: 0]
  ------------------
  522|       |
  523|    858|	while (len > 0)
  ------------------
  |  Branch (523:9): [True: 445, False: 413]
  ------------------
  524|    445|	{	if (len < bufferlen)
  ------------------
  |  Branch (524:8): [True: 445, False: 0]
  ------------------
  525|    445|			bufferlen = (int) len ;
  526|    445|		readcount = (int) psf_fread (ubuf.fbuf, sizeof (float), bufferlen, psf) ;
  527|       |
  528|       |/* Fix me : Need lef2s_array */
  529|    445|		if (psf->data_endswap == SF_TRUE)
  ------------------
  |  Branch (529:7): [True: 213, False: 232]
  ------------------
  530|    213|			endswap_int_array (ubuf.ibuf, readcount) ;
  531|       |
  532|    445|		convert (ubuf.fbuf, readcount, ptr + total, scale) ;
  533|    445|		total += readcount ;
  534|    445|		if (readcount < bufferlen)
  ------------------
  |  Branch (534:7): [True: 32, False: 413]
  ------------------
  535|     32|			break ;
  536|    413|		len -= readcount ;
  537|    413|		} ;
  538|       |
  539|    445|	return total ;
  540|    445|} /* host_read_f2s */
float32.c:f2s_array:
  439|    445|{
  440|  1.09k|	for (int i = 0 ; i < count ; i++)
  ------------------
  |  Branch (440:19): [True: 649, False: 445]
  ------------------
  441|    649|	{	dest [i] = psf_lrintf (scale * src [i]) ;
  442|    649|		} ;
  443|    445|} /* f2s_array */

g72x_init:
   72|    634|{	G72x_PRIVATE	*pg72x ;
   73|    634|	int	bitspersample, bytesperblock, codec ;
   74|       |
   75|    634|	if (psf->codec_data != NULL)
  ------------------
  |  Branch (75:6): [True: 0, False: 634]
  ------------------
   76|      0|	{	psf_log_printf (psf, "*** psf->codec_data is not NULL.\n") ;
   77|      0|		return SFE_INTERNAL ;
   78|    634|		} ;
   79|       |
   80|    634|	psf->sf.seekable = SF_FALSE ;
   81|       |
   82|    634|	if (psf->sf.channels != 1)
  ------------------
  |  Branch (82:6): [True: 10, False: 624]
  ------------------
   83|     10|		return SFE_G72X_NOT_MONO ;
   84|       |
   85|    624|	if ((pg72x = calloc (1, sizeof (G72x_PRIVATE))) == NULL)
  ------------------
  |  Branch (85:6): [True: 0, False: 624]
  ------------------
   86|      0|		return SFE_MALLOC_FAILED ;
   87|       |
   88|    624|	psf->codec_data = (void*) pg72x ;
   89|       |
   90|    624|	pg72x->block_curr = 0 ;
   91|    624|	pg72x->sample_curr = 0 ;
   92|       |
   93|    624|	switch (SF_CODEC (psf->sf.format))
  ------------------
  |  |  102|    624|#define SF_CODEC(x)			((x) & SF_FORMAT_SUBMASK)
  ------------------
   94|    624|	{	case SF_FORMAT_G721_32 :
  ------------------
  |  Branch (94:4): [True: 204, False: 420]
  ------------------
   95|    204|				codec = G721_32_BITS_PER_SAMPLE ;
   96|    204|				bytesperblock = G721_32_BYTES_PER_BLOCK ;
   97|    204|				bitspersample = G721_32_BITS_PER_SAMPLE ;
   98|    204|				break ;
   99|       |
  100|    347|		case SF_FORMAT_G723_24:
  ------------------
  |  Branch (100:3): [True: 347, False: 277]
  ------------------
  101|    347|				codec = G723_24_BITS_PER_SAMPLE ;
  102|    347|				bytesperblock = G723_24_BYTES_PER_BLOCK ;
  103|    347|				bitspersample = G723_24_BITS_PER_SAMPLE ;
  104|    347|				break ;
  105|       |
  106|     73|		case SF_FORMAT_G723_40:
  ------------------
  |  Branch (106:3): [True: 73, False: 551]
  ------------------
  107|     73|				codec = G723_40_BITS_PER_SAMPLE ;
  108|     73|				bytesperblock = G723_40_BYTES_PER_BLOCK ;
  109|     73|				bitspersample = G723_40_BITS_PER_SAMPLE ;
  110|     73|				break ;
  111|       |
  112|      0|		default : return SFE_UNIMPLEMENTED ;
  ------------------
  |  Branch (112:3): [True: 0, False: 624]
  ------------------
  113|    624|		} ;
  114|       |
  115|    624|	psf->filelength = psf_get_filelen (psf) ;
  116|    624|	if (psf->filelength < psf->dataoffset)
  ------------------
  |  Branch (116:6): [True: 21, False: 603]
  ------------------
  117|     21|		psf->filelength = psf->dataoffset ;
  118|       |
  119|    624|	psf->datalength = psf->filelength - psf->dataoffset ;
  120|    624|	if (psf->dataend > 0)
  ------------------
  |  Branch (120:6): [True: 14, False: 610]
  ------------------
  121|     14|		psf->datalength -= psf->filelength - psf->dataend ;
  122|       |
  123|    624|	if (psf->file.mode == SFM_READ)
  ------------------
  |  Branch (123:6): [True: 624, False: 0]
  ------------------
  124|    624|	{	pg72x->private = g72x_reader_init (codec, &(pg72x->blocksize), &(pg72x->samplesperblock)) ;
  125|    624|		if (pg72x->private == NULL)
  ------------------
  |  Branch (125:7): [True: 0, False: 624]
  ------------------
  126|      0|			return SFE_MALLOC_FAILED ;
  127|       |
  128|    624|		pg72x->bytesperblock = bytesperblock ;
  129|       |
  130|    624|		psf->read_short		= g72x_read_s ;
  131|    624|		psf->read_int		= g72x_read_i ;
  132|    624|		psf->read_float		= g72x_read_f ;
  133|    624|		psf->read_double	= g72x_read_d ;
  134|       |
  135|    624|		psf->seek = g72x_seek ;
  136|       |
  137|    624|		if (psf->datalength % pg72x->blocksize)
  ------------------
  |  Branch (137:7): [True: 595, False: 29]
  ------------------
  138|    595|		{	psf_log_printf (psf, "*** Odd psf->datalength (%D) should be a multiple of %d\n", psf->datalength, pg72x->blocksize) ;
  139|    595|			pg72x->blocks_total = (psf->datalength / pg72x->blocksize) + 1 ;
  140|    595|			}
  141|     29|		else
  142|     29|			pg72x->blocks_total = psf->datalength / pg72x->blocksize ;
  143|       |
  144|    624|		psf->sf.frames = (sf_count_t) pg72x->blocks_total * pg72x->samplesperblock ;
  145|       |
  146|    624|		psf_g72x_decode_block (psf, pg72x) ;
  147|    624|		}
  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|    624|		} ;
  171|       |
  172|    624|	psf->codec_close	= g72x_close ;
  173|       |
  174|    624|	return 0 ;
  175|    624|} /* g72x_init */
g72x.c:psf_g72x_decode_block:
  183|  22.1k|{	int	k ;
  184|       |
  185|  22.1k|	pg72x->block_curr ++ ;
  186|  22.1k|	pg72x->sample_curr = 0 ;
  187|       |
  188|  22.1k|	if (pg72x->block_curr > pg72x->blocks_total)
  ------------------
  |  Branch (188:6): [True: 29, False: 22.1k]
  ------------------
  189|     29|	{	memset (pg72x->samples, 0, G72x_BLOCK_SIZE * sizeof (short)) ;
  ------------------
  |  |   32|     29|#define	G72x_BLOCK_SIZE		(3 * 5 * 8)
  ------------------
  190|     29|		return 1 ;
  191|  22.1k|		} ;
  192|       |
  193|  22.1k|	if ((k = psf_fread (pg72x->block, 1, pg72x->bytesperblock, psf)) != pg72x->bytesperblock)
  ------------------
  |  Branch (193:6): [True: 1.01k, False: 21.0k]
  ------------------
  194|  1.01k|		psf_log_printf (psf, "*** Warning : short read (%d != %d).\n", k, pg72x->bytesperblock) ;
  195|       |
  196|  22.1k|	pg72x->blocksize = k ;
  197|  22.1k|	g72x_decode_block (pg72x->private, pg72x->block, pg72x->samples) ;
  198|       |
  199|  22.1k|	return 1 ;
  200|  22.1k|} /* psf_g72x_decode_block */
g72x.c:g72x_read_s:
  229|  2.62M|{	G72x_PRIVATE 	*pg72x ;
  230|  2.62M|	int			readcount, count ;
  231|  2.62M|	sf_count_t	total = 0 ;
  232|       |
  233|  2.62M|	if (psf->codec_data == NULL)
  ------------------
  |  Branch (233:6): [True: 0, False: 2.62M]
  ------------------
  234|      0|		return 0 ;
  235|  2.62M|	pg72x = (G72x_PRIVATE*) psf->codec_data ;
  236|       |
  237|  5.24M|	while (len > 0)
  ------------------
  |  Branch (237:9): [True: 2.62M, False: 2.62M]
  ------------------
  238|  2.62M|	{	readcount = (len > 0x10000000) ? 0x10000000 : (int) len ;
  ------------------
  |  Branch (238:16): [True: 0, False: 2.62M]
  ------------------
  239|       |
  240|  2.62M|		count = g72x_read_block (psf, pg72x, ptr, readcount) ;
  241|       |
  242|  2.62M|		total += count ;
  243|  2.62M|		len -= count ;
  244|       |
  245|  2.62M|		if (count != readcount)
  ------------------
  |  Branch (245:7): [True: 0, False: 2.62M]
  ------------------
  246|      0|			break ;
  247|  2.62M|		} ;
  248|       |
  249|  2.62M|	return total ;
  250|  2.62M|} /* g72x_read_s */
g72x.c:g72x_read_block:
  204|  2.62M|{	int	count, total = 0, indx = 0 ;
  205|       |
  206|  5.24M|	while (indx < len)
  ------------------
  |  Branch (206:9): [True: 2.62M, False: 2.62M]
  ------------------
  207|  2.62M|	{	if (pg72x->block_curr > pg72x->blocks_total)
  ------------------
  |  Branch (207:8): [True: 0, False: 2.62M]
  ------------------
  208|      0|		{	memset (&(ptr [indx]), 0, (len - indx) * sizeof (short)) ;
  209|      0|			return total ;
  210|  2.62M|			} ;
  211|       |
  212|  2.62M|		if (pg72x->sample_curr >= pg72x->samplesperblock)
  ------------------
  |  Branch (212:7): [True: 21.5k, False: 2.60M]
  ------------------
  213|  21.5k|			psf_g72x_decode_block (psf, pg72x) ;
  214|       |
  215|  2.62M|		count = pg72x->samplesperblock - pg72x->sample_curr ;
  216|  2.62M|		count = (len - indx > count) ? count : len - indx ;
  ------------------
  |  Branch (216:11): [True: 0, False: 2.62M]
  ------------------
  217|       |
  218|  2.62M|		memcpy (&(ptr [indx]), &(pg72x->samples [pg72x->sample_curr]), count * sizeof (short)) ;
  219|  2.62M|		indx += count ;
  220|  2.62M|		pg72x->sample_curr += count ;
  221|  2.62M|		total = indx ;
  222|  2.62M|		} ;
  223|       |
  224|  2.62M|	return total ;
  225|  2.62M|} /* g72x_read_block */
g72x.c:g72x_close:
  587|    624|{	G72x_PRIVATE *pg72x ;
  588|       |
  589|    624|	pg72x = (G72x_PRIVATE*) psf->codec_data ;
  590|       |
  591|    624|	if (psf->file.mode == SFM_WRITE)
  ------------------
  |  Branch (591:6): [True: 0, False: 624]
  ------------------
  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|    624|	free (pg72x->private) ;
  605|       |
  606|    624|	return 0 ;
  607|    624|} /* g72x_close */

gsm610_init:
   79|    585|{	GSM610_PRIVATE	*pgsm610 ;
   80|    585|	int		true_flag = 1 ;
   81|       |
   82|    585|	if (psf->codec_data != NULL)
  ------------------
  |  Branch (82:6): [True: 0, False: 585]
  ------------------
   83|      0|	{	psf_log_printf (psf, "*** psf->codec_data is not NULL.\n") ;
   84|      0|		return SFE_INTERNAL ;
   85|    585|		} ;
   86|       |
   87|    585|	if (psf->file.mode == SFM_RDWR)
  ------------------
  |  Branch (87:6): [True: 0, False: 585]
  ------------------
   88|      0|		return SFE_BAD_MODE_RW ;
   89|       |
   90|    585|	psf->sf.seekable = SF_FALSE ;
   91|       |
   92|    585|	if ((pgsm610 = calloc (1, sizeof (GSM610_PRIVATE))) == NULL)
  ------------------
  |  Branch (92:6): [True: 0, False: 585]
  ------------------
   93|      0|		return SFE_MALLOC_FAILED ;
   94|       |
   95|    585|	psf->codec_data = pgsm610 ;
   96|       |
   97|    585|	memset (pgsm610, 0, sizeof (GSM610_PRIVATE)) ;
   98|       |
   99|       |/*============================================================
  100|       |
  101|       |Need separate gsm_data structs for encode and decode.
  102|       |
  103|       |============================================================*/
  104|       |
  105|    585|	if ((pgsm610->gsm_data = gsm_create ()) == NULL)
  ------------------
  |  Branch (105:6): [True: 0, False: 585]
  ------------------
  106|      0|		return SFE_MALLOC_FAILED ;
  107|       |
  108|    585|	switch (SF_CONTAINER (psf->sf.format))
  ------------------
  |  |  101|    585|#define SF_CONTAINER(x)		((x) & SF_FORMAT_TYPEMASK)
  ------------------
  109|    585|	{	case SF_FORMAT_WAV :
  ------------------
  |  Branch (109:4): [True: 0, False: 585]
  ------------------
  110|      0|		case SF_FORMAT_WAVEX :
  ------------------
  |  Branch (110:3): [True: 0, False: 585]
  ------------------
  111|      0|		case SF_FORMAT_W64 :
  ------------------
  |  Branch (111:3): [True: 0, False: 585]
  ------------------
  112|      0|			gsm_option (pgsm610->gsm_data, GSM_OPT_WAV49, &true_flag) ;
  ------------------
  |  |   30|      0|#define	GSM_OPT_WAV49		4
  ------------------
  113|       |
  114|      0|			pgsm610->encode_block = gsm610_wav_encode_block ;
  115|      0|			pgsm610->decode_block = gsm610_wav_decode_block ;
  116|       |
  117|      0|			pgsm610->samplesperblock = WAVLIKE_GSM610_SAMPLES ;
  ------------------
  |  |  335|      0|#define		WAVLIKE_GSM610_SAMPLES		320
  ------------------
  118|      0|			pgsm610->blocksize = WAVLIKE_GSM610_BLOCKSIZE ;
  ------------------
  |  |  334|      0|#define		WAVLIKE_GSM610_BLOCKSIZE	65
  ------------------
  119|      0|			break ;
  120|       |
  121|    116|		case SF_FORMAT_AIFF :
  ------------------
  |  Branch (121:3): [True: 116, False: 469]
  ------------------
  122|    585|		case SF_FORMAT_RAW :
  ------------------
  |  Branch (122:3): [True: 469, False: 116]
  ------------------
  123|    585|			pgsm610->encode_block = gsm610_encode_block ;
  124|    585|			pgsm610->decode_block = gsm610_decode_block ;
  125|       |
  126|    585|			pgsm610->samplesperblock = GSM610_SAMPLES ;
  ------------------
  |  |   33|    585|#define	GSM610_SAMPLES			160
  ------------------
  127|    585|			pgsm610->blocksize = GSM610_BLOCKSIZE ;
  ------------------
  |  |   32|    585|#define	GSM610_BLOCKSIZE		33
  ------------------
  128|    585|			break ;
  129|       |
  130|      0|		default :
  ------------------
  |  Branch (130:3): [True: 0, False: 585]
  ------------------
  131|      0|			return SFE_INTERNAL ;
  132|      0|			break ;
  133|    585|		} ;
  134|       |
  135|    585|	if (psf->file.mode == SFM_READ)
  ------------------
  |  Branch (135:6): [True: 585, False: 0]
  ------------------
  136|    585|	{	if (psf->datalength % pgsm610->blocksize == 0)
  ------------------
  |  Branch (136:8): [True: 13, False: 572]
  ------------------
  137|     13|			pgsm610->blocks = psf->datalength / pgsm610->blocksize ;
  138|    572|		else if (psf->datalength % pgsm610->blocksize == 1 && pgsm610->blocksize == GSM610_BLOCKSIZE)
  ------------------
  |  |   32|      2|#define	GSM610_BLOCKSIZE		33
  ------------------
  |  Branch (138:12): [True: 2, False: 570]
  |  Branch (138:57): [True: 2, False: 0]
  ------------------
  139|      2|		{	/*
  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|      2|			pgsm610->blocks = psf->datalength / pgsm610->blocksize ;
  147|      2|			}
  148|    570|		else
  149|    570|		{	psf_log_printf (psf, "*** Warning : data chunk seems to be truncated.\n") ;
  150|    570|			pgsm610->blocks = psf->datalength / pgsm610->blocksize + 1 ;
  151|    570|			} ;
  152|       |
  153|    585|		psf->sf.frames = (sf_count_t) pgsm610->samplesperblock * pgsm610->blocks ;
  154|       |
  155|    585|		psf_fseek (psf, psf->dataoffset, SEEK_SET) ;
  156|       |
  157|    585|		pgsm610->decode_block (psf, pgsm610) ;	/* Read first block. */
  158|       |
  159|    585|		psf->read_short		= gsm610_read_s ;
  160|    585|		psf->read_int		= gsm610_read_i ;
  161|    585|		psf->read_float		= gsm610_read_f ;
  162|    585|		psf->read_double	= gsm610_read_d ;
  163|    585|		} ;
  164|       |
  165|    585|	if (psf->file.mode == SFM_WRITE)
  ------------------
  |  Branch (165:6): [True: 0, False: 585]
  ------------------
  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|    585|	psf->codec_close = gsm610_close ;
  176|       |
  177|    585|	psf->seek = gsm610_seek ;
  178|       |
  179|    585|	psf->filelength = psf_get_filelen (psf) ;
  180|    585|	psf->datalength = psf->filelength - psf->dataoffset ;
  181|       |
  182|    585|	return 0 ;
  183|    585|} /* gsm610_init */
gsm610.c:gsm610_decode_block:
  219|  51.6k|{	int	k ;
  220|       |
  221|  51.6k|	pgsm610->blockcount ++ ;
  222|  51.6k|	pgsm610->samplecount = 0 ;
  223|       |
  224|  51.6k|	if (pgsm610->blockcount > pgsm610->blocks)
  ------------------
  |  Branch (224:6): [True: 37, False: 51.6k]
  ------------------
  225|     37|	{	memset (pgsm610->samples, 0, sizeof (pgsm610->samples)) ;
  226|     37|		return 1 ;
  227|  51.6k|		} ;
  228|       |
  229|  51.6k|	if ((k = (int) psf_fread (pgsm610->block, 1, GSM610_BLOCKSIZE, psf)) != GSM610_BLOCKSIZE)
  ------------------
  |  |   32|  51.6k|#define	GSM610_BLOCKSIZE		33
  ------------------
              	if ((k = (int) psf_fread (pgsm610->block, 1, GSM610_BLOCKSIZE, psf)) != GSM610_BLOCKSIZE)
  ------------------
  |  |   32|  51.6k|#define	GSM610_BLOCKSIZE		33
  ------------------
  |  Branch (229:6): [True: 478, False: 51.1k]
  ------------------
  230|    478|		psf_log_printf (psf, "*** Warning : short read (%d != %d).\n", k, GSM610_BLOCKSIZE) ;
  ------------------
  |  |   32|    478|#define	GSM610_BLOCKSIZE		33
  ------------------
  231|       |
  232|  51.6k|	if (gsm_decode (pgsm610->gsm_data, pgsm610->block, pgsm610->samples) < 0)
  ------------------
  |  Branch (232:6): [True: 47.2k, False: 4.34k]
  ------------------
  233|  47.2k|	{	psf_log_printf (psf, "Error from standard gsm_decode() on frame : %d\n", pgsm610->blockcount) ;
  234|  47.2k|		return 0 ;
  235|  47.2k|		} ;
  236|       |
  237|  4.34k|	return 1 ;
  238|  51.6k|} /* gsm610_decode_block */
gsm610.c:gsm610_read_s:
  267|  1.81M|{	GSM610_PRIVATE 	*pgsm610 ;
  268|  1.81M|	int			readcount, count ;
  269|  1.81M|	sf_count_t	total = 0 ;
  270|       |
  271|  1.81M|	if (psf->codec_data == NULL)
  ------------------
  |  Branch (271:6): [True: 0, False: 1.81M]
  ------------------
  272|      0|		return 0 ;
  273|  1.81M|	pgsm610 = (GSM610_PRIVATE*) psf->codec_data ;
  274|       |
  275|  3.63M|	while (len > 0)
  ------------------
  |  Branch (275:9): [True: 1.81M, False: 1.81M]
  ------------------
  276|  1.81M|	{	readcount = (len > 0x10000000) ? 0x1000000 : (int) len ;
  ------------------
  |  Branch (276:16): [True: 0, False: 1.81M]
  ------------------
  277|       |
  278|  1.81M|		count = gsm610_read_block (psf, pgsm610, ptr, readcount) ;
  279|       |
  280|  1.81M|		total += count ;
  281|  1.81M|		len -= count ;
  282|       |
  283|  1.81M|		if (count != readcount)
  ------------------
  |  Branch (283:7): [True: 20, False: 1.81M]
  ------------------
  284|     20|			break ;
  285|  1.81M|		} ;
  286|       |
  287|  1.81M|	return total ;
  288|  1.81M|} /* gsm610_read_s */
gsm610.c:gsm610_read_block:
  242|  1.81M|{	int	count, total = 0, indx = 0 ;
  243|       |
  244|  3.67M|	while (indx < len)
  ------------------
  |  Branch (244:9): [True: 1.85M, False: 1.81M]
  ------------------
  245|  1.85M|	{	if (pgsm610->blockcount >= pgsm610->blocks && pgsm610->samplecount >= pgsm610->samplesperblock)
  ------------------
  |  Branch (245:8): [True: 74.5k, False: 1.78M]
  |  Branch (245:50): [True: 20, False: 74.5k]
  ------------------
  246|     20|		{	memset (ptr + indx, 0, (len - indx) * sizeof (short)) ;
  247|     20|			return total ;
  248|  1.85M|			} ;
  249|       |
  250|  1.85M|		if (pgsm610->samplecount >= pgsm610->samplesperblock)
  ------------------
  |  Branch (250:7): [True: 51.0k, False: 1.80M]
  ------------------
  251|  51.0k|			pgsm610->decode_block (psf, pgsm610) ;
  252|       |
  253|  1.85M|		count = pgsm610->samplesperblock - pgsm610->samplecount ;
  254|  1.85M|		count = (len - indx > count) ? count : len - indx ;
  ------------------
  |  Branch (254:11): [True: 40.1k, False: 1.81M]
  ------------------
  255|       |
  256|  1.85M|		memcpy (&(ptr [indx]), &(pgsm610->samples [pgsm610->samplecount]), count * sizeof (short)) ;
  257|  1.85M|		indx += count ;
  258|  1.85M|		pgsm610->samplecount += count ;
  259|  1.85M|		total = indx ;
  260|  1.85M|		} ;
  261|       |
  262|  1.81M|	return total ;
  263|  1.81M|} /* gsm610_read_block */
gsm610.c:gsm610_close:
  608|    585|{	GSM610_PRIVATE *pgsm610 ;
  609|       |
  610|    585|	if (psf->codec_data == NULL)
  ------------------
  |  Branch (610:6): [True: 0, False: 585]
  ------------------
  611|      0|		return 0 ;
  612|       |
  613|    585|	pgsm610 = (GSM610_PRIVATE*) psf->codec_data ;
  614|       |
  615|    585|	if (psf->file.mode == SFM_WRITE)
  ------------------
  |  Branch (615:6): [True: 0, False: 585]
  ------------------
  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|    585|	if (pgsm610->gsm_data)
  ------------------
  |  Branch (624:6): [True: 585, False: 0]
  ------------------
  625|    585|		gsm_destroy (pgsm610->gsm_data) ;
  626|       |
  627|    585|	return 0 ;
  628|    585|} /* gsm610_close */

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

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

wavlike_ima_init:
  109|    168|{	int error ;
  110|       |
  111|    168|	if (psf->codec_data != NULL)
  ------------------
  |  Branch (111:6): [True: 0, False: 168]
  ------------------
  112|      0|	{	psf_log_printf (psf, "*** psf->codec_data is not NULL.\n") ;
  113|      0|		return SFE_INTERNAL ;
  114|    168|		} ;
  115|       |
  116|    168|	if (psf->file.mode == SFM_RDWR)
  ------------------
  |  Branch (116:6): [True: 0, False: 168]
  ------------------
  117|      0|		return SFE_BAD_MODE_RW ;
  118|       |
  119|    168|	if (psf->file.mode == SFM_READ)
  ------------------
  |  Branch (119:6): [True: 168, False: 0]
  ------------------
  120|    168|		if ((error = ima_reader_init (psf, blockalign, samplesperblock)))
  ------------------
  |  Branch (120:7): [True: 48, False: 120]
  ------------------
  121|     48|			return error ;
  122|       |
  123|    120|	if (psf->file.mode == SFM_WRITE)
  ------------------
  |  Branch (123:6): [True: 0, False: 120]
  ------------------
  124|      0|		if ((error = ima_writer_init (psf, blockalign)))
  ------------------
  |  Branch (124:7): [True: 0, False: 0]
  ------------------
  125|      0|			return error ;
  126|       |
  127|    120|	psf->codec_close = ima_close ;
  128|    120|	psf->seek = wavlike_ima_seek ;
  129|       |
  130|    120|	return 0 ;
  131|    120|} /* wavlike_ima_init */
aiff_ima_init:
  135|    182|{	int error ;
  136|       |
  137|    182|	if (psf->file.mode == SFM_RDWR)
  ------------------
  |  Branch (137:6): [True: 0, False: 182]
  ------------------
  138|      0|		return SFE_BAD_MODE_RW ;
  139|       |
  140|    182|	if (psf->file.mode == SFM_READ)
  ------------------
  |  Branch (140:6): [True: 182, False: 0]
  ------------------
  141|    182|		if ((error = ima_reader_init (psf, blockalign, samplesperblock)))
  ------------------
  |  Branch (141:7): [True: 0, False: 182]
  ------------------
  142|      0|			return error ;
  143|       |
  144|    182|	if (psf->file.mode == SFM_WRITE)
  ------------------
  |  Branch (144:6): [True: 0, False: 182]
  ------------------
  145|      0|		if ((error = ima_writer_init (psf, blockalign)))
  ------------------
  |  Branch (145:7): [True: 0, False: 0]
  ------------------
  146|      0|			return error ;
  147|       |
  148|    182|	psf->codec_close = ima_close ;
  149|    182|	psf->seek = aiff_ima_seek ;
  150|       |
  151|    182|	return 0 ;
  152|    182|} /* aiff_ima_init */
ima_adpcm.c:ima_close:
  156|    302|{	IMA_ADPCM_PRIVATE *pima ;
  157|       |
  158|    302|	pima = (IMA_ADPCM_PRIVATE*) psf->codec_data ;
  159|       |
  160|    302|	if (psf->file.mode == SFM_WRITE)
  ------------------
  |  Branch (160:6): [True: 0, False: 302]
  ------------------
  161|      0|	{	/*	If a block has been partially assembled, write it out
  162|       |		**	as the final block.
  163|       |		*/
  164|      0|		if (pima->samplecount && pima->samplecount < pima->samplesperblock)
  ------------------
  |  Branch (164:7): [True: 0, False: 0]
  |  Branch (164:28): [True: 0, False: 0]
  ------------------
  165|      0|			pima->encode_block (psf, pima) ;
  166|       |
  167|      0|		psf->sf.frames = (sf_count_t) pima->samplesperblock * pima->blockcount / psf->sf.channels ;
  168|      0|		} ;
  169|       |
  170|    302|	return 0 ;
  171|    302|} /* ima_close */
ima_adpcm.c:ima_reader_init:
  179|    350|{	IMA_ADPCM_PRIVATE	*pima ;
  180|    350|	int		pimasize, count ;
  181|       |
  182|    350|	if (psf->file.mode != SFM_READ)
  ------------------
  |  Branch (182:6): [True: 0, False: 350]
  ------------------
  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|    350|	count = ((samplesperblock - 2) | 7) + 2 ;
  190|    350|	pimasize = sizeof (IMA_ADPCM_PRIVATE) + psf->sf.channels * (blockalign + samplesperblock + sizeof (short) * count) ;
  191|       |
  192|    350|	if (! (pima = calloc (1, pimasize)))
  ------------------
  |  Branch (192:6): [True: 0, False: 350]
  ------------------
  193|      0|		return SFE_MALLOC_FAILED ;
  194|       |
  195|    350|	psf->codec_data = (void*) pima ;
  196|       |
  197|    350|	pima->samples	= pima->data ;
  198|    350|	pima->block		= (unsigned char*) (pima->data + samplesperblock * psf->sf.channels) ;
  199|       |
  200|    350|	pima->channels			= psf->sf.channels ;
  201|    350|	pima->blocksize			= blockalign ;
  202|    350|	pima->samplesperblock	= samplesperblock ;
  203|       |
  204|    350|	psf->filelength = psf_get_filelen (psf) ;
  205|    350|	psf->datalength = (psf->dataend) ? psf->dataend - psf->dataoffset :
  ------------------
  |  Branch (205:20): [True: 55, False: 295]
  ------------------
  206|    350|							psf->filelength - psf->dataoffset ;
  207|       |
  208|    350|	if (pima->blocksize <= 0)
  ------------------
  |  Branch (208:6): [True: 2, False: 348]
  ------------------
  209|      2|	{	psf_log_printf (psf, "*** Error : pima->blocksize should be > 0.\n") ;
  210|      2|		return SFE_INTERNAL ;
  211|    348|		} ;
  212|       |
  213|    348|	if (pima->samplesperblock <= 0)
  ------------------
  |  Branch (213:6): [True: 0, False: 348]
  ------------------
  214|      0|	{	psf_log_printf (psf, "*** Error : pima->samplesperblock should be > 0.\n") ;
  215|      0|		return SFE_INTERNAL ;
  216|    348|		} ;
  217|       |
  218|    348|	if (psf->datalength % pima->blocksize)
  ------------------
  |  Branch (218:6): [True: 308, False: 40]
  ------------------
  219|    308|		pima->blocks = psf->datalength / pima->blocksize + 1 ;
  220|     40|	else
  221|     40|		pima->blocks = psf->datalength / pima->blocksize ;
  222|       |
  223|    348|	switch (SF_CONTAINER (psf->sf.format))
  ------------------
  |  |  101|    348|#define SF_CONTAINER(x)		((x) & SF_FORMAT_TYPEMASK)
  ------------------
  224|    348|	{	case SF_FORMAT_WAV :
  ------------------
  |  Branch (224:4): [True: 165, False: 183]
  ------------------
  225|    166|		case SF_FORMAT_W64 :
  ------------------
  |  Branch (225:3): [True: 1, False: 347]
  ------------------
  226|    166|				count = 2 * (pima->blocksize - 4 * pima->channels) / pima->channels + 1 ;
  227|       |
  228|    166|				if (pima->samplesperblock != count)
  ------------------
  |  Branch (228:9): [True: 46, False: 120]
  ------------------
  229|     46|				{	psf_log_printf (psf, "*** Error : samplesperblock should be %d.\n", count) ;
  230|     46|					return SFE_INTERNAL ;
  231|    120|					} ;
  232|       |
  233|    120|				pima->decode_block = wavlike_ima_decode_block ;
  234|       |
  235|    120|				psf->sf.frames = (sf_count_t) pima->samplesperblock * pima->blocks ;
  236|    120|				break ;
  237|       |
  238|    182|		case SF_FORMAT_AIFF :
  ------------------
  |  Branch (238:3): [True: 182, False: 166]
  ------------------
  239|    182|				psf_log_printf (psf, "still need to check block count\n") ;
  240|    182|				pima->decode_block = aiff_ima_decode_block ;
  241|    182|				psf->sf.frames = (sf_count_t) pima->samplesperblock * pima->blocks / pima->channels ;
  242|    182|				break ;
  243|       |
  244|      0|		default :
  ------------------
  |  Branch (244:3): [True: 0, False: 348]
  ------------------
  245|      0|				psf_log_printf (psf, "ima_reader_init: bad psf->sf.format\n") ;
  246|      0|				return SFE_INTERNAL ;
  247|    348|		} ;
  248|       |
  249|    302|	pima->decode_block (psf, pima) ;	/* Read first block. */
  250|       |
  251|    302|	psf->read_short		= ima_read_s ;
  252|    302|	psf->read_int		= ima_read_i ;
  253|    302|	psf->read_float		= ima_read_f ;
  254|    302|	psf->read_double	= ima_read_d ;
  255|       |
  256|    302|	return 0 ;
  257|    348|} /* ima_reader_init */
ima_adpcm.c:wavlike_ima_decode_block:
  390|  70.1k|{	int		chan, k, predictor, blockindx, indx, indxstart, diff ;
  391|  70.1k|	short	step, bytecode, stepindx [2] = { 0 } ;
  392|       |
  393|  70.1k|	pima->blockcount ++ ;
  394|  70.1k|	pima->samplecount = 0 ;
  395|       |
  396|  70.1k|	if (pima->blockcount > pima->blocks)
  ------------------
  |  Branch (396:6): [True: 3, False: 70.1k]
  ------------------
  397|      3|	{	memset (pima->samples, 0, pima->samplesperblock * pima->channels * sizeof (short)) ;
  398|      3|		return 1 ;
  399|  70.1k|		} ;
  400|       |
  401|  70.1k|	if ((k = (int) psf_fread (pima->block, 1, pima->blocksize, psf)) != pima->blocksize)
  ------------------
  |  Branch (401:6): [True: 105, False: 69.9k]
  ------------------
  402|    105|		psf_log_printf (psf, "*** Warning : short read (%d != %d).\n", k, pima->blocksize) ;
  403|       |
  404|       |	/* Read and check the block header. */
  405|       |
  406|   141k|	for (chan = 0 ; chan < pima->channels ; chan++)
  ------------------
  |  Branch (406:18): [True: 71.0k, False: 70.1k]
  ------------------
  407|  71.0k|	{	predictor = pima->block [chan*4] | (pima->block [chan*4+1] << 8) ;
  408|  71.0k|		if (predictor & 0x8000)
  ------------------
  |  Branch (408:7): [True: 1.52k, False: 69.5k]
  ------------------
  409|  1.52k|			predictor -= 0x10000 ;
  410|       |
  411|  71.0k|		stepindx [chan] = pima->block [chan*4+2] ;
  412|  71.0k|		stepindx [chan] = clamp_ima_step_index (stepindx [chan]) ;
  413|       |
  414|       |
  415|  71.0k|		if (pima->block [chan*4+3] != 0)
  ------------------
  |  Branch (415:7): [True: 2.74k, False: 68.3k]
  ------------------
  416|  2.74k|			psf_log_printf (psf, "IMA ADPCM synchronisation error.\n") ;
  417|       |
  418|  71.0k|		pima->samples [chan] = predictor ;
  419|  71.0k|		} ;
  420|       |
  421|       |	/*
  422|       |	**	Pull apart the packed 4 bit samples and store them in their
  423|       |	**	correct sample positions.
  424|       |	*/
  425|       |
  426|  70.1k|	blockindx = 4 * pima->channels ;
  427|       |
  428|  70.1k|	indxstart = pima->channels ;
  429|   274k|	while (blockindx < pima->blocksize)
  ------------------
  |  Branch (429:9): [True: 204k, False: 70.1k]
  ------------------
  430|   536k|	{	for (chan = 0 ; chan < pima->channels ; chan++)
  ------------------
  |  Branch (430:20): [True: 331k, False: 204k]
  ------------------
  431|   331k|		{	indx = indxstart + chan ;
  432|  1.65M|			for (k = 0 ; k < 4 ; k++)
  ------------------
  |  Branch (432:17): [True: 1.32M, False: 331k]
  ------------------
  433|  1.32M|			{	bytecode = pima->block [blockindx++] ;
  434|  1.32M|				pima->samples [indx] = bytecode & 0x0F ;
  435|  1.32M|				indx += pima->channels ;
  436|  1.32M|				pima->samples [indx] = (bytecode >> 4) & 0x0F ;
  437|  1.32M|				indx += pima->channels ;
  438|  1.32M|				} ;
  439|   331k|			} ;
  440|   204k|		indxstart += 8 * pima->channels ;
  441|   204k|		} ;
  442|       |
  443|       |	/* Decode the encoded 4 bit samples. */
  444|       |
  445|  2.72M|	for (k = pima->channels ; k < (pima->samplesperblock * pima->channels) ; k ++)
  ------------------
  |  Branch (445:28): [True: 2.65M, False: 70.1k]
  ------------------
  446|  2.65M|	{	chan = (pima->channels > 1) ? (k % 2) : 0 ;
  ------------------
  |  Branch (446:11): [True: 2.03M, False: 619k]
  ------------------
  447|       |
  448|  2.65M|		bytecode = pima->samples [k] & 0xF ;
  449|       |
  450|  2.65M|		step = ima_step_size [stepindx [chan]] ;
  451|  2.65M|		predictor = pima->samples [k - pima->channels] ;
  452|       |
  453|  2.65M|		diff = step >> 3 ;
  454|  2.65M|		if (bytecode & 1)
  ------------------
  |  Branch (454:7): [True: 182k, False: 2.46M]
  ------------------
  455|   182k|			diff += step >> 2 ;
  456|  2.65M|		if (bytecode & 2)
  ------------------
  |  Branch (456:7): [True: 180k, False: 2.47M]
  ------------------
  457|   180k|			diff += step >> 1 ;
  458|  2.65M|		if (bytecode & 4)
  ------------------
  |  Branch (458:7): [True: 180k, False: 2.47M]
  ------------------
  459|   180k|			diff += step ;
  460|  2.65M|		if (bytecode & 8)
  ------------------
  |  Branch (460:7): [True: 181k, False: 2.47M]
  ------------------
  461|   181k|			diff = -diff ;
  462|       |
  463|  2.65M|		predictor += diff ;
  464|       |
  465|  2.65M|		if (predictor > 32767)
  ------------------
  |  Branch (465:7): [True: 30.1k, False: 2.62M]
  ------------------
  466|  30.1k|			predictor = 32767 ;
  467|  2.62M|		else if (predictor < -32768)
  ------------------
  |  Branch (467:12): [True: 156k, False: 2.46M]
  ------------------
  468|   156k|			predictor = -32768 ;
  469|       |
  470|  2.65M|		stepindx [chan] += ima_indx_adjust [bytecode] ;
  471|  2.65M|		stepindx [chan] = clamp_ima_step_index (stepindx [chan]) ;
  472|       |
  473|  2.65M|		pima->samples [k] = predictor ;
  474|  2.65M|		} ;
  475|       |
  476|  70.1k|	return 1 ;
  477|  70.1k|} /* wavlike_ima_decode_block */
ima_adpcm.c:clamp_ima_step_index:
   95|  2.99M|{	if (indx < 0)
  ------------------
  |  Branch (95:7): [True: 2.45M, False: 538k]
  ------------------
   96|  2.45M|		return 0 ;
   97|   538k|	if (indx >= ARRAY_LEN (ima_step_size))
  ------------------
  |  |   88|   538k|#define		ARRAY_LEN(x)	((int) (sizeof (x) / sizeof ((x) [0])))
  ------------------
  |  Branch (97:6): [True: 261k, False: 277k]
  ------------------
   98|   261k|		return ARRAY_LEN (ima_step_size) - 1 ;
  ------------------
  |  |   88|   261k|#define		ARRAY_LEN(x)	((int) (sizeof (x) / sizeof ((x) [0])))
  ------------------
   99|       |
  100|   277k|	return indx ;
  101|   538k|} /* clamp_ima_step_index */
ima_adpcm.c:aiff_ima_decode_block:
  261|  1.53k|{	unsigned char *blockdata ;
  262|  1.53k|	int		chan, k, diff, bytecode, predictor ;
  263|  1.53k|	short	step, stepindx, *sampledata ;
  264|       |
  265|  1.53k|	pima->blockcount += pima->channels ;
  266|  1.53k|	pima->samplecount = 0 ;
  267|       |
  268|  1.53k|	if (pima->blockcount > pima->blocks)
  ------------------
  |  Branch (268:6): [True: 68, False: 1.46k]
  ------------------
  269|     68|	{	memset (pima->samples, 0, pima->samplesperblock * pima->channels * sizeof (short)) ;
  270|     68|		return 1 ;
  271|  1.46k|		} ;
  272|       |
  273|  1.46k|	if ((k = (int) psf_fread (pima->block, 1, pima->blocksize * pima->channels, psf)) != pima->blocksize * pima->channels)
  ------------------
  |  Branch (273:6): [True: 92, False: 1.37k]
  ------------------
  274|     92|		psf_log_printf (psf, "*** Warning : short read (%d != %d).\n", k, pima->blocksize) ;
  275|       |
  276|       |	/* Read and check the block header. */
  277|  5.60k|	for (chan = 0 ; chan < pima->channels ; chan++)
  ------------------
  |  Branch (277:18): [True: 4.14k, False: 1.46k]
  ------------------
  278|  4.14k|	{	blockdata = pima->block + chan * 34 ;
  279|  4.14k|		sampledata = pima->samples + chan ;
  280|       |
  281|       |		/* Sign-extend from 16 bits to 32. */
  282|  4.14k|		predictor = (int) ((short) ((blockdata [0] << 8) | (blockdata [1] & 0x80))) ;
  283|       |
  284|  4.14k|		stepindx = blockdata [1] & 0x7F ;
  285|  4.14k|		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|   136k|		for (k = 0 ; k < pima->blocksize - 2 ; k++)
  ------------------
  |  Branch (291:16): [True: 132k, False: 4.14k]
  ------------------
  292|   132k|		{	bytecode = blockdata [k + 2] ;
  293|   132k|			sampledata [pima->channels * (2 * k + 0)] = bytecode & 0xF ;
  294|   132k|			sampledata [pima->channels * (2 * k + 1)] = (bytecode >> 4) & 0xF ;
  295|   132k|			} ;
  296|       |
  297|       |		/* Decode the encoded 4 bit samples. */
  298|   269k|		for (k = 0 ; k < pima->samplesperblock ; k ++)
  ------------------
  |  Branch (298:16): [True: 264k, False: 4.14k]
  ------------------
  299|   264k|		{	step = ima_step_size [stepindx] ;
  300|       |
  301|   264k|			bytecode = pima->samples [pima->channels * k + chan] ;
  302|       |
  303|   264k|			stepindx += ima_indx_adjust [bytecode] ;
  304|   264k|			stepindx = clamp_ima_step_index (stepindx) ;
  305|       |
  306|   264k|			diff = step >> 3 ;
  307|   264k|			if (bytecode & 1)	diff += step >> 2 ;
  ------------------
  |  Branch (307:8): [True: 103k, False: 161k]
  ------------------
  308|   264k|			if (bytecode & 2)	diff += step >> 1 ;
  ------------------
  |  Branch (308:8): [True: 89.4k, False: 175k]
  ------------------
  309|   264k|			if (bytecode & 4)	diff += step ;
  ------------------
  |  Branch (309:8): [True: 113k, False: 151k]
  ------------------
  310|   264k|			if (bytecode & 8)	diff = -diff ;
  ------------------
  |  Branch (310:8): [True: 75.8k, False: 189k]
  ------------------
  311|       |
  312|   264k|			predictor += diff ;
  313|   264k|			if (predictor < -32768)
  ------------------
  |  Branch (313:8): [True: 53.5k, False: 211k]
  ------------------
  314|  53.5k|				predictor = -32768 ;
  315|   211k|			else if (predictor > 32767)
  ------------------
  |  Branch (315:13): [True: 71.4k, False: 139k]
  ------------------
  316|  71.4k|				predictor = 32767 ;
  317|       |
  318|   264k|			pima->samples [pima->channels * k + chan] = predictor ;
  319|   264k|			} ;
  320|  4.14k|		} ;
  321|       |
  322|  1.46k|	return 1 ;
  323|  1.53k|} /* aiff_ima_decode_block */
ima_adpcm.c:ima_read_s:
  594|  1.79M|{	IMA_ADPCM_PRIVATE 	*pima ;
  595|  1.79M|	int			readcount, count ;
  596|  1.79M|	sf_count_t	total = 0 ;
  597|       |
  598|  1.79M|	if (! psf->codec_data)
  ------------------
  |  Branch (598:6): [True: 0, False: 1.79M]
  ------------------
  599|      0|		return 0 ;
  600|  1.79M|	pima = (IMA_ADPCM_PRIVATE*) psf->codec_data ;
  601|       |
  602|  3.59M|	while (len > 0)
  ------------------
  |  Branch (602:9): [True: 1.79M, False: 1.79M]
  ------------------
  603|  1.79M|	{	readcount = (len > 0x10000000) ? 0x10000000 : (int) len ;
  ------------------
  |  Branch (603:16): [True: 0, False: 1.79M]
  ------------------
  604|       |
  605|  1.79M|		count = ima_read_block (psf, pima, ptr, readcount) ;
  606|       |
  607|  1.79M|		total += count ;
  608|  1.79M|		len -= count ;
  609|  1.79M|		if (count != readcount)
  ------------------
  |  Branch (609:7): [True: 0, False: 1.79M]
  ------------------
  610|      0|			break ;
  611|  1.79M|		} ;
  612|       |
  613|  1.79M|	return total ;
  614|  1.79M|} /* ima_read_s */
ima_adpcm.c:ima_read_block:
  569|  1.79M|{	int		count, total = 0, indx = 0 ;
  570|       |
  571|  3.59M|	while (indx < len)
  ------------------
  |  Branch (571:9): [True: 1.79M, False: 1.79M]
  ------------------
  572|  1.79M|	{	if (pima->blockcount >= pima->blocks && pima->samplecount >= pima->samplesperblock)
  ------------------
  |  Branch (572:8): [True: 1.08M, False: 713k]
  |  Branch (572:44): [True: 0, False: 1.08M]
  ------------------
  573|      0|		{	memset (&(ptr [indx]), 0, (size_t) ((len - indx) * sizeof (short))) ;
  574|      0|			return total ;
  575|  1.79M|			} ;
  576|       |
  577|  1.79M|		if (pima->samplecount >= pima->samplesperblock)
  ------------------
  |  Branch (577:7): [True: 71.3k, False: 1.72M]
  ------------------
  578|  71.3k|			pima->decode_block (psf, pima) ;
  579|       |
  580|  1.79M|		count = (pima->samplesperblock - pima->samplecount) * pima->channels ;
  581|  1.79M|		count = (len - indx > count) ? count : len - indx ;
  ------------------
  |  Branch (581:11): [True: 0, False: 1.79M]
  ------------------
  582|       |
  583|  1.79M|		memcpy (&(ptr [indx]), &(pima->samples [pima->samplecount * pima->channels]), count * sizeof (short)) ;
  584|  1.79M|		indx += count ;
  585|  1.79M|		pima->samplecount += count / pima->channels ;
  586|  1.79M|		total = indx ;
  587|  1.79M|		} ;
  588|       |
  589|  1.79M|	return total ;
  590|  1.79M|} /* ima_read_block */

ima_oki_adpcm_init:
   55|    249|{
   56|    249|	memset (state, 0, sizeof (*state)) ;
   57|       |
   58|    249|	if (type == IMA_OKI_ADPCM_TYPE_IMA)
  ------------------
  |  Branch (58:6): [True: 0, False: 249]
  ------------------
   59|      0|	{	state->max_step_index = ARRAY_LEN (ima_steps) - 1 ;
  ------------------
  |  |   88|      0|#define		ARRAY_LEN(x)	((int) (sizeof (x) / sizeof ((x) [0])))
  ------------------
   60|      0|		state->steps = ima_steps ;
   61|      0|		state->mask = (~0) ;
   62|      0|		}
   63|    249|	else
   64|    249|	{	state->max_step_index = ARRAY_LEN (oki_steps) - 1 ;
  ------------------
  |  |   88|    249|#define		ARRAY_LEN(x)	((int) (sizeof (x) / sizeof ((x) [0])))
  ------------------
   65|    249|		state->steps = oki_steps ;
   66|    249|		state->mask = arith_shift_left (~0, 4) ;
   67|    249|		} ;
   68|       |
   69|    249|} /* ima_oki_adpcm_init */
adpcm_decode:
   74|  7.70k|{	int s ;
   75|       |
   76|  7.70k|	s = ((code & 7) << 1) | 1 ;
   77|  7.70k|	s = ((state->steps [state->step_index] * s) >> 3) & state->mask ;
   78|       |
   79|  7.70k|	if (code & 8)
  ------------------
  |  Branch (79:6): [True: 3.78k, False: 3.92k]
  ------------------
   80|  3.78k|		s = -s ;
   81|  7.70k|	s += state->last_output ;
   82|       |
   83|  7.70k|	if (s < MIN_SAMPLE || s > MAX_SAMPLE)
  ------------------
  |  |   31|  15.4k|#define MIN_SAMPLE	-0x8000
  ------------------
              	if (s < MIN_SAMPLE || s > MAX_SAMPLE)
  ------------------
  |  |   32|  5.65k|#define MAX_SAMPLE	0x7fff
  ------------------
  |  Branch (83:6): [True: 2.05k, False: 5.65k]
  |  Branch (83:24): [True: 2.02k, False: 3.62k]
  ------------------
   84|  4.08k|	{	int grace ;
   85|       |
   86|  4.08k|		grace = (state->steps [state->step_index] >> 3) & state->mask ;
   87|       |
   88|  4.08k|		if (s < MIN_SAMPLE - grace || s > MAX_SAMPLE + grace)
  ------------------
  |  |   31|  4.08k|#define MIN_SAMPLE	-0x8000
  ------------------
              		if (s < MIN_SAMPLE - grace || s > MAX_SAMPLE + grace)
  ------------------
  |  |   32|  2.23k|#define MAX_SAMPLE	0x7fff
  ------------------
  |  Branch (88:7): [True: 1.84k, False: 2.23k]
  |  Branch (88:33): [True: 1.31k, False: 913]
  ------------------
   89|  3.16k|			state->errors ++ ;
   90|       |
   91|  4.08k|		s = s < MIN_SAMPLE ? MIN_SAMPLE : MAX_SAMPLE ;
  ------------------
  |  |   31|  4.08k|#define MIN_SAMPLE	-0x8000
  ------------------
              		s = s < MIN_SAMPLE ? MIN_SAMPLE : MAX_SAMPLE ;
  ------------------
  |  |   31|  2.05k|#define MIN_SAMPLE	-0x8000
  ------------------
              		s = s < MIN_SAMPLE ? MIN_SAMPLE : MAX_SAMPLE ;
  ------------------
  |  |   32|  6.10k|#define MAX_SAMPLE	0x7fff
  ------------------
  |  Branch (91:7): [True: 2.05k, False: 2.02k]
  ------------------
   92|  4.08k|		} ;
   93|       |
   94|  7.70k|	state->step_index += step_changes [code & 7] ;
   95|  7.70k|	state->step_index = SF_MIN (SF_MAX (state->step_index, 0), state->max_step_index) ;
  ------------------
  |  |   91|  15.4k|#define		SF_MIN(a, b)	((a) < (b) ? (a) : (b))
  |  |  ------------------
  |  |  |  Branch (91:24): [True: 5.26k, False: 2.44k]
  |  |  |  Branch (91:25): [True: 6.49k, False: 1.21k]
  |  |  |  Branch (91:37): [True: 4.05k, False: 1.21k]
  |  |  ------------------
  ------------------
   96|  7.70k|	state->last_output = s ;
   97|       |
   98|  7.70k|	return s ;
   99|  7.70k|} /* adpcm_decode */
ima_oki_adpcm_decode_block:
  122|  3.85k|{	unsigned char code ;
  123|  3.85k|	int k ;
  124|       |
  125|  7.70k|	for (k = 0 ; k < state->code_count ; k++)
  ------------------
  |  Branch (125:15): [True: 3.85k, False: 3.85k]
  ------------------
  126|  3.85k|	{	code = state->codes [k] ;
  127|  3.85k|		state->pcm [2 * k] = adpcm_decode (state, code >> 4) ;
  128|  3.85k|		state->pcm [2 * k + 1] = adpcm_decode (state, code) ;
  129|  3.85k|		} ;
  130|       |
  131|  3.85k|	state->pcm_count = 2 * k ;
  132|  3.85k|} /* ima_oki_adpcm_decode_block */

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

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

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

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

wavlike_msadpcm_init:
  119|    139|{	MSADPCM_PRIVATE	*pms ;
  120|    139|	unsigned int	pmssize ;
  121|    139|	int				count ;
  122|       |
  123|    139|	if (psf->codec_data != NULL)
  ------------------
  |  Branch (123:6): [True: 0, False: 139]
  ------------------
  124|      0|	{	psf_log_printf (psf, "*** psf->codec_data is not NULL.\n") ;
  125|      0|		return SFE_INTERNAL ;
  126|    139|		} ;
  127|       |
  128|    139|	if (psf->file.mode == SFM_WRITE)
  ------------------
  |  Branch (128:6): [True: 0, False: 139]
  ------------------
  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|    139|	if (samplesperblock < 7 * psf->sf.channels)
  ------------------
  |  Branch (132:6): [True: 1, False: 138]
  ------------------
  133|      1|	{	psf_log_printf (psf, "*** Error samplesperblock (%d) should be >= %d.\n", samplesperblock, 7 * psf->sf.channels) ;
  134|      1|		return SFE_INTERNAL ;
  135|    138|		} ;
  136|       |
  137|    138|	if (2 * blockalign < samplesperblock * psf->sf.channels)
  ------------------
  |  Branch (137:6): [True: 7, False: 131]
  ------------------
  138|      7|	{	psf_log_printf (psf, "*** Error blockalign (%d) should be >= %d.\n", blockalign, samplesperblock * psf->sf.channels / 2) ;
  139|      7|		return SFE_INTERNAL ;
  140|    131|		} ;
  141|       |
  142|    131|	pmssize = sizeof (MSADPCM_PRIVATE) + blockalign + 3 * psf->sf.channels * samplesperblock ;
  143|       |
  144|    131|	if (! (psf->codec_data = calloc (1, pmssize)))
  ------------------
  |  Branch (144:6): [True: 0, False: 131]
  ------------------
  145|      0|		return SFE_MALLOC_FAILED ;
  146|    131|	pms = (MSADPCM_PRIVATE*) psf->codec_data ;
  147|       |
  148|    131|	pms->sync_error = 0 ;
  149|    131|	pms->samples	= pms->dummydata ;
  150|    131|	pms->block		= (unsigned char*) (pms->dummydata + psf->sf.channels * samplesperblock) ;
  151|       |
  152|    131|	pms->channels	= psf->sf.channels ;
  153|    131|	pms->blocksize	= blockalign ;
  154|    131|	pms->samplesperblock = samplesperblock ;
  155|       |
  156|    131|	if (pms->blocksize <= 0)
  ------------------
  |  Branch (156:6): [True: 0, False: 131]
  ------------------
  157|      0|	{	psf_log_printf (psf, "*** Error : pms->blocksize should be > 0.\n") ;
  158|      0|		return SFE_INTERNAL ;
  159|    131|		} ;
  160|       |
  161|    131|	if (psf->file.mode == SFM_READ)
  ------------------
  |  Branch (161:6): [True: 131, False: 0]
  ------------------
  162|    131|	{	pms->dataremaining = psf->datalength ;
  163|       |
  164|    131|		if (psf->datalength % pms->blocksize)
  ------------------
  |  Branch (164:7): [True: 85, False: 46]
  ------------------
  165|     85|			pms->blocks = psf->datalength / pms->blocksize + 1 ;
  166|     46|		else
  167|     46|			pms->blocks = psf->datalength / pms->blocksize ;
  168|       |
  169|    131|		count = 2 * (pms->blocksize - 6 * pms->channels) / pms->channels ;
  170|    131|		if (pms->samplesperblock != count)
  ------------------
  |  Branch (170:7): [True: 1, False: 130]
  ------------------
  171|      1|		{	psf_log_printf (psf, "*** Error : samplesperblock should be %d.\n", count) ;
  172|      1|			return SFE_INTERNAL ;
  173|    130|			} ;
  174|       |
  175|    130|		psf->sf.frames = (psf->datalength / pms->blocksize) * pms->samplesperblock ;
  176|       |
  177|    130|		msadpcm_decode_block (psf, pms) ;
  178|       |
  179|    130|		psf->read_short		= msadpcm_read_s ;
  180|    130|		psf->read_int		= msadpcm_read_i ;
  181|    130|		psf->read_float		= msadpcm_read_f ;
  182|    130|		psf->read_double	= msadpcm_read_d ;
  183|    130|		} ;
  184|       |
  185|    130|	if (psf->file.mode == SFM_WRITE)
  ------------------
  |  Branch (185:6): [True: 0, False: 130]
  ------------------
  186|      0|	{	pms->samples = pms->dummydata ;
  187|       |
  188|      0|		pms->samplecount = 0 ;
  189|       |
  190|      0|		psf->write_short	= msadpcm_write_s ;
  191|      0|		psf->write_int		= msadpcm_write_i ;
  192|      0|		psf->write_float	= msadpcm_write_f ;
  193|      0|		psf->write_double	= msadpcm_write_d ;
  194|      0|		} ;
  195|       |
  196|    130|	psf->codec_close = msadpcm_close ;
  197|    130|	psf->seek = msadpcm_seek ;
  198|       |
  199|    130|	return 0 ;
  200|    131|} /* wavlike_msadpcm_init */
ms_adpcm.c:msadpcm_decode_block:
  218|  44.6k|{	int		chan, k, blockindx, sampleindx ;
  219|  44.6k|	short	bytecode, bpred [2], chan_idelta [2] ;
  220|       |
  221|  44.6k|	int predict ;
  222|  44.6k|	int current ;
  223|  44.6k|	int idelta ;
  224|       |
  225|  44.6k|	pms->blockcount ++ ;
  226|  44.6k|	pms->samplecount = 0 ;
  227|       |
  228|  44.6k|	if (pms->blockcount > pms->blocks)
  ------------------
  |  Branch (228:6): [True: 1, False: 44.6k]
  ------------------
  229|      1|	{	memset (pms->samples, 0, pms->samplesperblock * pms->channels) ;
  230|      1|		return 1 ;
  231|  44.6k|		} ;
  232|       |
  233|  44.6k|	if ((k = (int) psf_fread (pms->block, 1, pms->blocksize, psf)) != pms->blocksize)
  ------------------
  |  Branch (233:6): [True: 70, False: 44.5k]
  ------------------
  234|     70|	{	psf_log_printf (psf, "*** Warning : short read (%d != %d).\n", k, pms->blocksize) ;
  235|     70|		if (k <= 0)
  ------------------
  |  Branch (235:7): [True: 1, False: 69]
  ------------------
  236|      1|			return 1 ;
  237|  44.6k|		} ;
  238|       |
  239|       |	/* Read and check the block header. */
  240|       |
  241|  44.6k|	if (pms->channels == 1)
  ------------------
  |  Branch (241:6): [True: 36.2k, False: 8.41k]
  ------------------
  242|  36.2k|	{	bpred [0] = msadpcm_get_bpred (psf, pms, pms->block [0]) ;
  243|       |
  244|  36.2k|		chan_idelta [0] = pms->block [1] | (pms->block [2] << 8) ;
  245|  36.2k|		chan_idelta [1] = 0 ;
  246|       |
  247|  36.2k|		pms->samples [1] = pms->block [3] | (pms->block [4] << 8) ;
  248|  36.2k|		pms->samples [0] = pms->block [5] | (pms->block [6] << 8) ;
  249|  36.2k|		blockindx = 7 ;
  250|  36.2k|		}
  251|  8.41k|	else
  252|  8.41k|	{	bpred [0] = msadpcm_get_bpred (psf, pms, pms->block [0]) ;
  253|  8.41k|		bpred [1] = msadpcm_get_bpred (psf, pms, pms->block [1]) ;
  254|       |
  255|  8.41k|		chan_idelta [0] = pms->block [2] | (pms->block [3] << 8) ;
  256|  8.41k|		chan_idelta [1] = pms->block [4] | (pms->block [5] << 8) ;
  257|       |
  258|  8.41k|		pms->samples [2] = pms->block [6] | (pms->block [7] << 8) ;
  259|  8.41k|		pms->samples [3] = pms->block [8] | (pms->block [9] << 8) ;
  260|       |
  261|  8.41k|		pms->samples [0] = pms->block [10] | (pms->block [11] << 8) ;
  262|  8.41k|		pms->samples [1] = pms->block [12] | (pms->block [13] << 8) ;
  263|       |
  264|  8.41k|		blockindx = 14 ;
  265|  8.41k|		} ;
  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|  44.6k|	sampleindx = 2 * pms->channels ;
  283|  1.40M|	while (blockindx < pms->blocksize)
  ------------------
  |  Branch (283:9): [True: 1.36M, False: 44.6k]
  ------------------
  284|  1.36M|	{	bytecode = pms->block [blockindx++] ;
  285|  1.36M|		pms->samples [sampleindx++] = (bytecode >> 4) & 0x0F ;
  286|  1.36M|		pms->samples [sampleindx++] = bytecode & 0x0F ;
  287|  1.36M|		} ;
  288|       |
  289|       |	/* Decode the encoded 4 bit samples. */
  290|       |
  291|  2.76M|	for (k = 2 * pms->channels ; k < (pms->samplesperblock * pms->channels) ; k ++)
  ------------------
  |  Branch (291:31): [True: 2.72M, False: 44.6k]
  ------------------
  292|  2.72M|	{	chan = (pms->channels > 1) ? (k % 2) : 0 ;
  ------------------
  |  Branch (292:11): [True: 2.06M, False: 653k]
  ------------------
  293|       |
  294|  2.72M|		bytecode = pms->samples [k] & 0xF ;
  295|       |
  296|       |		/* Compute next Adaptive Scale Factor (ASF) */
  297|  2.72M|		idelta = chan_idelta [chan] ;
  298|  2.72M|		chan_idelta [chan] = (AdaptationTable [bytecode] * idelta) >> 8 ;	/* => / 256 => FIXED_POINT_ADAPTATION_BASE == 256 */
  299|  2.72M|		if (chan_idelta [chan] < 16)
  ------------------
  |  Branch (299:7): [True: 2.08M, False: 634k]
  ------------------
  300|  2.08M|			chan_idelta [chan] = 16 ;
  301|  2.72M|		if (bytecode & 0x8)
  ------------------
  |  Branch (301:7): [True: 628k, False: 2.09M]
  ------------------
  302|   628k|			bytecode -= 0x10 ;
  303|       |
  304|  2.72M|		predict = ((pms->samples [k - pms->channels] * AdaptCoeff1 [bpred [chan]])
  305|  2.72M|					+ (pms->samples [k - 2 * pms->channels] * AdaptCoeff2 [bpred [chan]])) >> 8 ; /* => / 256 => FIXED_POINT_COEFF_BASE == 256 */
  306|  2.72M|		current = (bytecode * idelta) + predict ;
  307|       |
  308|  2.72M|		if (current > 32767)
  ------------------
  |  Branch (308:7): [True: 68.0k, False: 2.65M]
  ------------------
  309|  68.0k|			current = 32767 ;
  310|  2.65M|		else if (current < -32768)
  ------------------
  |  Branch (310:12): [True: 344k, False: 2.30M]
  ------------------
  311|   344k|			current = -32768 ;
  312|       |
  313|  2.72M|		pms->samples [k] = current ;
  314|  2.72M|		} ;
  315|       |
  316|  44.6k|	return 0 ;
  317|  44.6k|} /* msadpcm_decode_block */
ms_adpcm.c:msadpcm_get_bpred:
  205|  53.0k|{	if (value >= WAVLIKE_MSADPCM_ADAPT_COEFF_COUNT)
  ------------------
  |  |  343|  53.0k|#define	WAVLIKE_MSADPCM_ADAPT_COEFF_COUNT	7
  ------------------
  |  Branch (205:7): [True: 35.9k, False: 17.1k]
  ------------------
  206|  35.9k|	{	if (pms->sync_error == 0)
  ------------------
  |  Branch (206:8): [True: 113, False: 35.7k]
  ------------------
  207|    113|		{	pms->sync_error = 1 ;
  208|    113|			psf_log_printf (psf, "MS ADPCM synchronisation error (%u should be < %u).\n", value, WAVLIKE_MSADPCM_ADAPT_COEFF_COUNT) ;
  ------------------
  |  |  343|    113|#define	WAVLIKE_MSADPCM_ADAPT_COEFF_COUNT	7
  ------------------
  209|    113|			} ;
  210|  35.9k|		return 0 ;
  211|  35.9k|		} ;
  212|  17.1k|	return value ;
  213|  53.0k|} /* msadpcm_get_bpred */
ms_adpcm.c:msadpcm_read_s:
  347|  1.76M|{	MSADPCM_PRIVATE 	*pms ;
  348|  1.76M|	int			readcount, count ;
  349|  1.76M|	sf_count_t	total = 0 ;
  350|       |
  351|  1.76M|	if (! psf->codec_data)
  ------------------
  |  Branch (351:6): [True: 0, False: 1.76M]
  ------------------
  352|      0|		return 0 ;
  353|  1.76M|	pms = (MSADPCM_PRIVATE*) psf->codec_data ;
  354|       |
  355|  3.52M|	while (len > 0)
  ------------------
  |  Branch (355:9): [True: 1.76M, False: 1.76M]
  ------------------
  356|  1.76M|	{	readcount = (len > 0x10000000) ? 0x10000000 : (int) len ;
  ------------------
  |  Branch (356:16): [True: 0, False: 1.76M]
  ------------------
  357|       |
  358|  1.76M|		if ((count = (int) msadpcm_read_block (psf, pms, ptr, readcount)) <= 0)
  ------------------
  |  Branch (358:7): [True: 0, False: 1.76M]
  ------------------
  359|      0|			return -1 ;
  360|       |
  361|  1.76M|		total += count ;
  362|  1.76M|		len -= count ;
  363|  1.76M|		if (count != readcount)
  ------------------
  |  Branch (363:7): [True: 0, False: 1.76M]
  ------------------
  364|      0|			break ;
  365|  1.76M|		} ;
  366|       |
  367|  1.76M|	return total ;
  368|  1.76M|} /* msadpcm_read_s */
ms_adpcm.c:msadpcm_read_block:
  321|  1.76M|{	int	count, total = 0, indx = 0 ;
  322|       |
  323|  3.52M|	while (indx < len)
  ------------------
  |  Branch (323:9): [True: 1.76M, False: 1.76M]
  ------------------
  324|  1.76M|	{	if (pms->blockcount >= pms->blocks && pms->samplecount >= pms->samplesperblock)
  ------------------
  |  Branch (324:8): [True: 2.59k, False: 1.75M]
  |  Branch (324:42): [True: 0, False: 2.59k]
  ------------------
  325|      0|		{	memset (&(ptr [indx]), 0, (size_t) ((len - indx) * sizeof (short))) ;
  326|      0|			return total ;
  327|  1.76M|			} ;
  328|       |
  329|  1.76M|		if (pms->samplecount >= pms->samplesperblock)
  ------------------
  |  Branch (329:7): [True: 44.4k, False: 1.71M]
  ------------------
  330|  44.4k|			if (msadpcm_decode_block (psf, pms) != 0)
  ------------------
  |  Branch (330:8): [True: 0, False: 44.4k]
  ------------------
  331|      0|				return total ;
  332|       |
  333|  1.76M|		count = (pms->samplesperblock - pms->samplecount) * pms->channels ;
  334|  1.76M|		count = (len - indx > count) ? count : len - indx ;
  ------------------
  |  Branch (334:11): [True: 0, False: 1.76M]
  ------------------
  335|       |
  336|  1.76M|		memcpy (&(ptr [indx]), &(pms->samples [pms->samplecount * pms->channels]), count * sizeof (short)) ;
  337|  1.76M|		indx += count ;
  338|  1.76M|		pms->samplecount += count / pms->channels ;
  339|  1.76M|		total = indx ;
  340|  1.76M|		} ;
  341|       |
  342|  1.76M|	return total ;
  343|  1.76M|} /* msadpcm_read_block */
ms_adpcm.c:msadpcm_close:
  785|    130|{	MSADPCM_PRIVATE *pms ;
  786|       |
  787|    130|	pms = (MSADPCM_PRIVATE*) psf->codec_data ;
  788|       |
  789|    130|	if (psf->file.mode == SFM_WRITE)
  ------------------
  |  Branch (789:6): [True: 0, False: 130]
  ------------------
  790|      0|	{	/*  Now we know static int for certain the length of the file we can
  791|       |		**  re-write the header.
  792|       |		*/
  793|       |
  794|      0|		if (pms->samplecount && pms->samplecount < pms->samplesperblock)
  ------------------
  |  Branch (794:7): [True: 0, False: 0]
  |  Branch (794:27): [True: 0, False: 0]
  ------------------
  795|      0|			msadpcm_encode_block (psf, pms) ;
  796|      0|		} ;
  797|       |
  798|    130|	return 0 ;
  799|    130|} /* msadpcm_close */

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

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

paf_open:
  103|    142|{	int		subformat, error, endian ;
  104|       |
  105|    142| 	psf->dataoffset = PAF_HEADER_LENGTH ;
  ------------------
  |  |   43|    142|#define	PAF_HEADER_LENGTH 			2048
  ------------------
  106|       |
  107|    142|	if (psf->file.mode == SFM_READ || (psf->file.mode == SFM_RDWR && psf->filelength > 0))
  ------------------
  |  Branch (107:6): [True: 142, False: 0]
  |  Branch (107:37): [True: 0, False: 0]
  |  Branch (107:67): [True: 0, False: 0]
  ------------------
  108|    142|	{	if ((error = paf_read_header (psf)))
  ------------------
  |  Branch (108:8): [True: 58, False: 84]
  ------------------
  109|     58|			return error ;
  110|    142|		} ;
  111|       |
  112|     84|	subformat = SF_CODEC (psf->sf.format) ;
  ------------------
  |  |  102|     84|#define SF_CODEC(x)			((x) & SF_FORMAT_SUBMASK)
  ------------------
  113|       |
  114|     84|	if (psf->file.mode == SFM_WRITE || psf->file.mode == SFM_RDWR)
  ------------------
  |  Branch (114:6): [True: 0, False: 84]
  |  Branch (114:37): [True: 0, False: 84]
  ------------------
  115|      0|	{	if ((SF_CONTAINER (psf->sf.format)) != SF_FORMAT_PAF)
  ------------------
  |  |  101|      0|#define SF_CONTAINER(x)		((x) & SF_FORMAT_TYPEMASK)
  ------------------
  |  Branch (115:8): [True: 0, False: 0]
  ------------------
  116|      0|			return	SFE_BAD_OPEN_FORMAT ;
  117|       |
  118|      0|		endian = SF_ENDIAN (psf->sf.format) ;
  ------------------
  |  |  103|      0|#define SF_ENDIAN(x)		((x) & SF_FORMAT_ENDMASK)
  ------------------
  119|       |
  120|       |		/* PAF is by default big endian. */
  121|      0|		psf->endian = SF_ENDIAN_BIG ;
  122|       |
  123|      0|		if (endian == SF_ENDIAN_LITTLE || (CPU_IS_LITTLE_ENDIAN && (endian == SF_ENDIAN_CPU)))
  ------------------
  |  |   14|      0|#define CPU_IS_LITTLE_ENDIAN 1
  |  |  ------------------
  |  |  |  Branch (14:30): [True: 0, Folded]
  |  |  ------------------
  ------------------
  |  Branch (123:7): [True: 0, False: 0]
  |  Branch (123:62): [True: 0, False: 0]
  ------------------
  124|      0|			psf->endian = SF_ENDIAN_LITTLE ;
  125|       |
  126|      0|		if ((error = paf_write_header (psf, SF_FALSE)))
  ------------------
  |  Branch (126:7): [True: 0, False: 0]
  ------------------
  127|      0|			return error ;
  128|       |
  129|      0|		psf->write_header = paf_write_header ;
  130|     84|		} ;
  131|       |
  132|     84|	switch (subformat)
  133|     84|	{	case SF_FORMAT_PCM_S8 :
  ------------------
  |  Branch (133:4): [True: 3, False: 81]
  ------------------
  134|      3|					psf->bytewidth = 1 ;
  135|      3|					error = pcm_init (psf) ;
  136|      3|					break ;
  137|       |
  138|      1|		case SF_FORMAT_PCM_16 :
  ------------------
  |  Branch (138:3): [True: 1, False: 83]
  ------------------
  139|      1|					psf->bytewidth = 2 ;
  140|      1|					error = pcm_init (psf) ;
  141|      1|					break ;
  142|       |
  143|     80|		case SF_FORMAT_PCM_24 :
  ------------------
  |  Branch (143:3): [True: 80, False: 4]
  ------------------
  144|       |					/* No bytewidth because of whacky 24 bit encoding. */
  145|     80|					error = paf24_init (psf) ;
  146|     80|					break ;
  147|       |
  148|      0|		default : return SFE_PAF_UNKNOWN_FORMAT ;
  ------------------
  |  Branch (148:3): [True: 0, False: 84]
  ------------------
  149|     84|		} ;
  150|       |
  151|     84|	return error ;
  152|     84|} /* paf_open */
paf.c:paf_read_header:
  159|    142|{	PAF_FMT		paf_fmt ;
  160|    142|	int			marker ;
  161|       |
  162|    142|	if (psf->filelength < PAF_HEADER_LENGTH)
  ------------------
  |  |   43|    142|#define	PAF_HEADER_LENGTH 			2048
  ------------------
  |  Branch (162:6): [True: 2, False: 140]
  ------------------
  163|      2|		return SFE_PAF_SHORT_HEADER ;
  164|       |
  165|    140|	memset (&paf_fmt, 0, sizeof (paf_fmt)) ;
  166|    140|	psf_binheader_readf (psf, "pm", 0, &marker) ;
  167|       |
  168|    140|	psf_log_printf (psf, "Signature   : '%M'\n", marker) ;
  169|       |
  170|    140|	if (marker == PAF_MARKER)
  ------------------
  |  |   37|    140|#define PAF_MARKER	(MAKE_MARKER (' ', 'p', 'a', 'f'))
  |  |  ------------------
  |  |  |  |  122|    140|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (170:6): [True: 3, False: 137]
  ------------------
  171|      3|	{	psf_binheader_readf (psf, "E444444", &(paf_fmt.version), &(paf_fmt.endianness),
  172|      3|			&(paf_fmt.samplerate), &(paf_fmt.format), &(paf_fmt.channels), &(paf_fmt.source)) ;
  173|      3|		}
  174|    137|	else if (marker == FAP_MARKER)
  ------------------
  |  |   36|    137|#define FAP_MARKER	(MAKE_MARKER ('f', 'a', 'p', ' '))
  |  |  ------------------
  |  |  |  |  122|    137|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (174:11): [True: 137, False: 0]
  ------------------
  175|    137|	{	psf_binheader_readf (psf, "e444444", &(paf_fmt.version), &(paf_fmt.endianness),
  176|    137|			&(paf_fmt.samplerate), &(paf_fmt.format), &(paf_fmt.channels), &(paf_fmt.source)) ;
  177|    137|		}
  178|      0|	else
  179|      0|		return SFE_PAF_NO_MARKER ;
  180|       |
  181|    140|	psf_log_printf (psf, "Version     : %d\n", paf_fmt.version) ;
  182|       |
  183|    140|	if (paf_fmt.version != 0)
  ------------------
  |  Branch (183:6): [True: 1, False: 139]
  ------------------
  184|      1|	{	psf_log_printf (psf, "*** Bad version number. should be zero.\n") ;
  185|      1|		return SFE_PAF_VERSION ;
  186|    139|		} ;
  187|       |
  188|    139|	psf_log_printf (psf, "Sample Rate : %d\n", paf_fmt.samplerate) ;
  189|    139|	psf_log_printf (psf, "Channels    : %d\n", paf_fmt.channels) ;
  190|       |
  191|    139|	psf_log_printf (psf, "Endianness  : %d => ", paf_fmt.endianness) ;
  192|    139|	if (paf_fmt.endianness)
  ------------------
  |  Branch (192:6): [True: 97, False: 42]
  ------------------
  193|     97|	{	psf_log_printf (psf, "Little\n", paf_fmt.endianness) ;
  194|     97|		psf->endian = SF_ENDIAN_LITTLE ;
  195|     97|		}
  196|     42|	else
  197|     42|	{	psf_log_printf (psf, "Big\n", paf_fmt.endianness) ;
  198|     42|		psf->endian = SF_ENDIAN_BIG ;
  199|     42|		} ;
  200|       |
  201|    139|	if (paf_fmt.channels < 1 || paf_fmt.channels > SF_MAX_CHANNELS)
  ------------------
  |  |   95|    108|#define		SF_MAX_CHANNELS		1024
  ------------------
  |  Branch (201:6): [True: 31, False: 108]
  |  Branch (201:30): [True: 17, False: 91]
  ------------------
  202|     48|		return SFE_PAF_BAD_CHANNELS ;
  203|       |
  204|     91|	psf->datalength = psf->filelength - psf->dataoffset ;
  205|       |
  206|     91|	psf_binheader_readf (psf, "p", (int) psf->dataoffset) ;
  207|       |
  208|     91|	psf->sf.samplerate	= paf_fmt.samplerate ;
  209|     91|	psf->sf.channels 	= paf_fmt.channels ;
  210|       |
  211|       |	/* Only fill in type major. */
  212|     91|	psf->sf.format = SF_FORMAT_PAF ;
  213|       |
  214|     91|	psf_log_printf (psf, "Format      : %d => ", paf_fmt.format) ;
  215|       |
  216|       |	/* PAF is by default big endian. */
  217|     91|	psf->sf.format |= paf_fmt.endianness ? SF_ENDIAN_LITTLE : SF_ENDIAN_BIG ;
  ------------------
  |  Branch (217:20): [True: 62, False: 29]
  ------------------
  218|       |
  219|     91|	switch (paf_fmt.format)
  220|     91|	{	case PAF_PCM_S8 :
  ------------------
  |  Branch (220:4): [True: 3, False: 88]
  ------------------
  221|      3|					psf_log_printf (psf, "8 bit linear PCM\n") ;
  222|      3|					psf->bytewidth = 1 ;
  223|       |
  224|      3|					psf->sf.format |= SF_FORMAT_PCM_S8 ;
  225|       |
  226|      3|					psf->blockwidth = (sf_count_t) psf->bytewidth * psf->sf.channels ;
  227|      3|					psf->sf.frames = psf->datalength / psf->blockwidth ;
  228|      3|					break ;
  229|       |
  230|      1|		case PAF_PCM_16 :
  ------------------
  |  Branch (230:3): [True: 1, False: 90]
  ------------------
  231|      1|					psf_log_printf (psf, "16 bit linear PCM\n") ;
  232|      1|					psf->bytewidth = 2 ;
  233|       |
  234|      1|					psf->sf.format |= SF_FORMAT_PCM_16 ;
  235|       |
  236|      1|					psf->blockwidth = (sf_count_t) psf->bytewidth * psf->sf.channels ;
  237|      1|					psf->sf.frames = psf->datalength / psf->blockwidth ;
  238|      1|					break ;
  239|       |
  240|     80|		case PAF_PCM_24 :
  ------------------
  |  Branch (240:3): [True: 80, False: 11]
  ------------------
  241|     80|					psf_log_printf (psf, "24 bit linear PCM\n") ;
  242|     80|					psf->bytewidth = 3 ;
  243|       |
  244|     80|					psf->sf.format |= SF_FORMAT_PCM_24 ;
  245|       |
  246|     80|					psf->blockwidth = 0 ;
  247|     80|					psf->sf.frames = PAF24_SAMPLES_PER_BLOCK * psf->datalength /
  ------------------
  |  |   45|     80|#define	PAF24_SAMPLES_PER_BLOCK		10
  ------------------
  248|     80|											(PAF24_BLOCK_SIZE * psf->sf.channels) ;
  ------------------
  |  |   46|     80|#define	PAF24_BLOCK_SIZE			32
  ------------------
  249|     80|					break ;
  250|       |
  251|      7|		default :	psf_log_printf (psf, "Unknown\n") ;
  ------------------
  |  Branch (251:3): [True: 7, False: 84]
  ------------------
  252|      7|					return SFE_PAF_UNKNOWN_FORMAT ;
  253|      0|					break ;
  254|     91|		} ;
  255|       |
  256|     84|	psf_log_printf (psf, "Source      : %d => ", paf_fmt.source) ;
  257|       |
  258|     84|	switch (paf_fmt.source)
  259|     84|	{	case 1 : psf_log_printf (psf, "Analog Recording\n") ;
  ------------------
  |  Branch (259:4): [True: 8, False: 76]
  ------------------
  260|      8|					break ;
  261|     10|		case 2 : psf_log_printf (psf, "Digital Transfer\n") ;
  ------------------
  |  Branch (261:3): [True: 10, False: 74]
  ------------------
  262|     10|					break ;
  263|      2|		case 3 : psf_log_printf (psf, "Multi-track Mixdown\n") ;
  ------------------
  |  Branch (263:3): [True: 2, False: 82]
  ------------------
  264|      2|					break ;
  265|     22|		case 5 : psf_log_printf (psf, "Audio Resulting From DSP Processing\n") ;
  ------------------
  |  Branch (265:3): [True: 22, False: 62]
  ------------------
  266|     22|					break ;
  267|     42|		default : psf_log_printf (psf, "Unknown\n") ;
  ------------------
  |  Branch (267:3): [True: 42, False: 42]
  ------------------
  268|     42|					break ;
  269|     84|		} ;
  270|       |
  271|     84|	return 0 ;
  272|     84|} /* paf_read_header */
paf.c:paf24_init:
  346|     80|{	PAF24_PRIVATE	*ppaf24 ;
  347|     80|	int	paf24size ;
  348|       |
  349|     80|	paf24size = sizeof (PAF24_PRIVATE) + psf->sf.channels *
  350|     80|					(PAF24_BLOCK_SIZE + PAF24_SAMPLES_PER_BLOCK * sizeof (int)) ;
  ------------------
  |  |   46|     80|#define	PAF24_BLOCK_SIZE			32
  ------------------
              					(PAF24_BLOCK_SIZE + PAF24_SAMPLES_PER_BLOCK * sizeof (int)) ;
  ------------------
  |  |   45|     80|#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|     80|	psf->last_op = 0 ;
  357|       |
  358|     80|	if (! (psf->codec_data = calloc (1, paf24size)))
  ------------------
  |  Branch (358:6): [True: 0, False: 80]
  ------------------
  359|      0|		return SFE_MALLOC_FAILED ;
  360|       |
  361|     80|	ppaf24 = (PAF24_PRIVATE*) psf->codec_data ;
  362|       |
  363|     80|	ppaf24->channels	= psf->sf.channels ;
  364|     80|	ppaf24->samples		= ppaf24->data ;
  365|     80|	ppaf24->block		= ppaf24->data + PAF24_SAMPLES_PER_BLOCK * ppaf24->channels ;
  ------------------
  |  |   45|     80|#define	PAF24_SAMPLES_PER_BLOCK		10
  ------------------
  366|       |
  367|     80|	ppaf24->blocksize = PAF24_BLOCK_SIZE * ppaf24->channels ;
  ------------------
  |  |   46|     80|#define	PAF24_BLOCK_SIZE			32
  ------------------
  368|       |
  369|     80|	if (psf->file.mode == SFM_READ || psf->file.mode == SFM_RDWR)
  ------------------
  |  Branch (369:6): [True: 80, False: 0]
  |  Branch (369:36): [True: 0, False: 0]
  ------------------
  370|     80|	{	paf24_read_block (psf, ppaf24) ;	/* Read first block. */
  371|       |
  372|     80|		psf->read_short		= paf24_read_s ;
  373|     80|		psf->read_int		= paf24_read_i ;
  374|     80|		psf->read_float		= paf24_read_f ;
  375|     80|		psf->read_double	= paf24_read_d ;
  376|     80|		} ;
  377|       |
  378|     80|	if (psf->file.mode == SFM_WRITE || psf->file.mode == SFM_RDWR)
  ------------------
  |  Branch (378:6): [True: 0, False: 80]
  |  Branch (378:37): [True: 0, False: 80]
  ------------------
  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|     80|	psf->seek	= paf24_seek ;
  386|     80|	psf->container_close	= paf24_close ;
  387|       |
  388|     80|	psf->filelength = psf_get_filelen (psf) ;
  389|     80|	psf->datalength = psf->filelength - psf->dataoffset ;
  390|       |
  391|     80|	if (psf->datalength % PAF24_BLOCK_SIZE)
  ------------------
  |  |   46|     80|#define	PAF24_BLOCK_SIZE			32
  ------------------
  |  Branch (391:6): [True: 57, False: 23]
  ------------------
  392|     57|	{	if (psf->file.mode == SFM_READ)
  ------------------
  |  Branch (392:8): [True: 57, False: 0]
  ------------------
  393|     57|			psf_log_printf (psf, "*** Warning : file seems to be truncated.\n") ;
  394|     57|		ppaf24->max_blocks = psf->datalength / ppaf24->blocksize + 1 ;
  395|     57|		}
  396|     23|	else
  397|     23|		ppaf24->max_blocks = psf->datalength / ppaf24->blocksize ;
  398|       |
  399|     80|	ppaf24->read_block = 0 ;
  400|     80|	if (psf->file.mode == SFM_RDWR)
  ------------------
  |  Branch (400:6): [True: 0, False: 80]
  ------------------
  401|      0|		ppaf24->write_block = ppaf24->max_blocks ;
  402|     80|	else
  403|     80|		ppaf24->write_block = 0 ;
  404|       |
  405|     80|	psf->sf.frames = PAF24_SAMPLES_PER_BLOCK * ppaf24->max_blocks ;
  ------------------
  |  |   45|     80|#define	PAF24_SAMPLES_PER_BLOCK		10
  ------------------
  406|     80|	ppaf24->sample_count = psf->sf.frames ;
  407|       |
  408|     80|	return 0 ;
  409|     80|} /* paf24_init */
paf.c:paf24_read_block:
  484|  4.92k|{	int				k, channel ;
  485|  4.92k|	unsigned char	*cptr ;
  486|       |
  487|  4.92k|	ppaf24->read_block ++ ;
  488|  4.92k|	ppaf24->read_count = 0 ;
  489|       |
  490|  4.92k|	if (ppaf24->read_block * PAF24_SAMPLES_PER_BLOCK > ppaf24->sample_count)
  ------------------
  |  |   45|  4.92k|#define	PAF24_SAMPLES_PER_BLOCK		10
  ------------------
  |  Branch (490:6): [True: 80, False: 4.84k]
  ------------------
  491|     80|	{	memset (ppaf24->samples, 0, PAF24_SAMPLES_PER_BLOCK * ppaf24->channels) ;
  ------------------
  |  |   45|     80|#define	PAF24_SAMPLES_PER_BLOCK		10
  ------------------
  492|     80|		return 1 ;
  493|  4.84k|		} ;
  494|       |
  495|       |	/* Read the block. */
  496|  4.84k|	if ((k = (int) psf_fread (ppaf24->block, 1, ppaf24->blocksize, psf)) != ppaf24->blocksize)
  ------------------
  |  Branch (496:6): [True: 57, False: 4.78k]
  ------------------
  497|     57|		psf_log_printf (psf, "*** Warning : short read (%d != %d).\n", k, ppaf24->blocksize) ;
  498|       |
  499|       |	/* Do endian swapping if necessary. */
  500|  4.84k|	if ((CPU_IS_BIG_ENDIAN && psf->endian == SF_ENDIAN_LITTLE) || (CPU_IS_LITTLE_ENDIAN && psf->endian == SF_ENDIAN_BIG))
  ------------------
  |  |   11|  9.69k|#define CPU_IS_BIG_ENDIAN 0
  |  |  ------------------
  |  |  |  Branch (11:27): [Folded, False: 4.84k]
  |  |  ------------------
  ------------------
              	if ((CPU_IS_BIG_ENDIAN && psf->endian == SF_ENDIAN_LITTLE) || (CPU_IS_LITTLE_ENDIAN && psf->endian == SF_ENDIAN_BIG))
  ------------------
  |  |   14|  9.69k|#define CPU_IS_LITTLE_ENDIAN 1
  |  |  ------------------
  |  |  |  Branch (14:30): [True: 4.84k, Folded]
  |  |  ------------------
  ------------------
  |  Branch (500:28): [True: 0, False: 0]
  |  Branch (500:89): [True: 1.42k, False: 3.42k]
  ------------------
  501|  1.42k|		endswap_int_array (ppaf24->block, 8 * ppaf24->channels) ;
  502|       |
  503|       |	/* Unpack block. */
  504|  99.7k|	for (k = 0 ; k < PAF24_SAMPLES_PER_BLOCK * ppaf24->channels ; k++)
  ------------------
  |  |   45|  99.7k|#define	PAF24_SAMPLES_PER_BLOCK		10
  ------------------
  |  Branch (504:15): [True: 94.8k, False: 4.84k]
  ------------------
  505|  94.8k|	{	channel = k % ppaf24->channels ;
  506|  94.8k|		cptr = ((unsigned char *) ppaf24->block) + PAF24_BLOCK_SIZE * channel + 3 * (k / ppaf24->channels) ;
  ------------------
  |  |   46|  94.8k|#define	PAF24_BLOCK_SIZE			32
  ------------------
  507|  94.8k|		ppaf24->samples [k] = (cptr [0] << 8) | (cptr [1] << 16) | (((unsigned) cptr [2]) << 24) ;
  508|  94.8k|		} ;
  509|       |
  510|  4.84k|	return 1 ;
  511|  4.92k|} /* paf24_read_block */
paf.c:paf24_read_s:
  539|  47.9k|{	BUF_UNION		ubuf ;
  540|  47.9k|	PAF24_PRIVATE 	*ppaf24 ;
  541|  47.9k|	int				*iptr ;
  542|  47.9k|	int				k, bufferlen, readcount, count ;
  543|  47.9k|	sf_count_t		total = 0 ;
  544|       |
  545|  47.9k|	if (psf->codec_data == NULL)
  ------------------
  |  Branch (545:6): [True: 0, False: 47.9k]
  ------------------
  546|      0|		return 0 ;
  547|  47.9k|	ppaf24 = (PAF24_PRIVATE*) psf->codec_data ;
  548|       |
  549|  47.9k|	iptr = ubuf.ibuf ;
  550|  47.9k|	bufferlen = ARRAY_LEN (ubuf.ibuf) ;
  ------------------
  |  |   88|  47.9k|#define		ARRAY_LEN(x)	((int) (sizeof (x) / sizeof ((x) [0])))
  ------------------
  551|  95.8k|	while (len > 0)
  ------------------
  |  Branch (551:9): [True: 47.9k, False: 47.9k]
  ------------------
  552|  47.9k|	{	readcount = (len >= bufferlen) ? bufferlen : (int) len ;
  ------------------
  |  Branch (552:16): [True: 0, False: 47.9k]
  ------------------
  553|  47.9k|		count = paf24_read (psf, ppaf24, iptr, readcount) ;
  554|   102k|		for (k = 0 ; k < readcount ; k++)
  ------------------
  |  Branch (554:16): [True: 54.5k, False: 47.9k]
  ------------------
  555|  54.5k|			ptr [total + k] = iptr [k] >> 16 ;
  556|  47.9k|		total += count ;
  557|  47.9k|		len -= readcount ;
  558|  47.9k|		} ;
  559|  47.9k|	return total ;
  560|  47.9k|} /* paf24_read_s */
paf.c:paf24_read:
  515|  47.9k|{	int	count, total = 0 ;
  516|       |
  517|  95.7k|	while (total < len)
  ------------------
  |  Branch (517:9): [True: 47.9k, False: 47.8k]
  ------------------
  518|  47.9k|	{	if (ppaf24->read_block * PAF24_SAMPLES_PER_BLOCK >= ppaf24->sample_count)
  ------------------
  |  |   45|  47.9k|#define	PAF24_SAMPLES_PER_BLOCK		10
  ------------------
  |  Branch (518:8): [True: 65, False: 47.8k]
  ------------------
  519|     65|		{	memset (&(ptr [total]), 0, (len - total) * sizeof (int)) ;
  520|     65|			return total ;
  521|  47.8k|			} ;
  522|       |
  523|  47.8k|		if (ppaf24->read_count >= PAF24_SAMPLES_PER_BLOCK)
  ------------------
  |  |   45|  47.8k|#define	PAF24_SAMPLES_PER_BLOCK		10
  ------------------
  |  Branch (523:7): [True: 4.78k, False: 43.0k]
  ------------------
  524|  4.78k|			paf24_read_block (psf, ppaf24) ;
  525|       |
  526|  47.8k|		count = (PAF24_SAMPLES_PER_BLOCK - ppaf24->read_count) * ppaf24->channels ;
  ------------------
  |  |   45|  47.8k|#define	PAF24_SAMPLES_PER_BLOCK		10
  ------------------
  527|  47.8k|		count = (len - total > count) ? count : len - total ;
  ------------------
  |  Branch (527:11): [True: 0, False: 47.8k]
  ------------------
  528|       |
  529|  47.8k|		memcpy (&(ptr [total]), &(ppaf24->samples [ppaf24->read_count * ppaf24->channels]), count * sizeof (int)) ;
  530|  47.8k|		total += count ;
  531|  47.8k|		ppaf24->read_count += count / ppaf24->channels ;
  532|  47.8k|		} ;
  533|       |
  534|  47.8k|	return total ;
  535|  47.9k|} /* paf24_read */
paf.c:paf24_seek:
  413|     65|{	PAF24_PRIVATE	*ppaf24 ;
  414|     65|	int				newblock, newsample ;
  415|       |
  416|     65|	if (psf->codec_data == NULL)
  ------------------
  |  Branch (416:6): [True: 0, False: 65]
  ------------------
  417|      0|	{	psf->error = SFE_INTERNAL ;
  418|      0|		return PSF_SEEK_ERROR ;
  ------------------
  |  |   78|      0|#define	PSF_SEEK_ERROR			((sf_count_t) -1)
  ------------------
  419|     65|		} ;
  420|       |
  421|     65|	ppaf24 = (PAF24_PRIVATE*) psf->codec_data ;
  422|       |
  423|     65|	if (mode == SFM_READ && ppaf24->write_count > 0)
  ------------------
  |  Branch (423:6): [True: 65, False: 0]
  |  Branch (423:26): [True: 0, False: 65]
  ------------------
  424|      0|		paf24_write_block (psf, ppaf24) ;
  425|       |
  426|     65|	newblock	= offset / PAF24_SAMPLES_PER_BLOCK ;
  ------------------
  |  |   45|     65|#define	PAF24_SAMPLES_PER_BLOCK		10
  ------------------
  427|     65|	newsample	= offset % PAF24_SAMPLES_PER_BLOCK ;
  ------------------
  |  |   45|     65|#define	PAF24_SAMPLES_PER_BLOCK		10
  ------------------
  428|       |
  429|     65|	switch (mode)
  430|     65|	{	case SFM_READ :
  ------------------
  |  Branch (430:4): [True: 65, False: 0]
  ------------------
  431|     65|				if (psf->last_op == SFM_WRITE && ppaf24->write_count)
  ------------------
  |  Branch (431:9): [True: 0, False: 65]
  |  Branch (431:38): [True: 0, False: 0]
  ------------------
  432|      0|					paf24_write_block (psf, ppaf24) ;
  433|       |
  434|     65|				psf_fseek (psf, psf->dataoffset + newblock * ppaf24->blocksize, SEEK_SET) ;
  435|     65|				ppaf24->read_block = newblock ;
  436|     65|				paf24_read_block (psf, ppaf24) ;
  437|     65|				ppaf24->read_count = newsample ;
  438|     65|				break ;
  439|       |
  440|      0|		case SFM_WRITE :
  ------------------
  |  Branch (440:3): [True: 0, False: 65]
  ------------------
  441|      0|				if (offset > ppaf24->sample_count)
  ------------------
  |  Branch (441:9): [True: 0, False: 0]
  ------------------
  442|      0|				{	psf->error = SFE_BAD_SEEK ;
  443|      0|					return PSF_SEEK_ERROR ;
  ------------------
  |  |   78|      0|#define	PSF_SEEK_ERROR			((sf_count_t) -1)
  ------------------
  444|      0|					} ;
  445|       |
  446|      0|				if (psf->last_op == SFM_WRITE && ppaf24->write_count)
  ------------------
  |  Branch (446:9): [True: 0, False: 0]
  |  Branch (446:38): [True: 0, False: 0]
  ------------------
  447|      0|					paf24_write_block (psf, ppaf24) ;
  448|       |
  449|      0|				psf_fseek (psf, psf->dataoffset + newblock * ppaf24->blocksize, SEEK_SET) ;
  450|      0|				ppaf24->write_block = newblock ;
  451|      0|				paf24_read_block (psf, ppaf24) ;
  452|      0|				ppaf24->write_count = newsample ;
  453|      0|				break ;
  454|       |
  455|      0|		default :
  ------------------
  |  Branch (455:3): [True: 0, False: 65]
  ------------------
  456|      0|				psf->error = SFE_BAD_SEEK ;
  457|      0|				return PSF_SEEK_ERROR ;
  ------------------
  |  |   78|      0|#define	PSF_SEEK_ERROR			((sf_count_t) -1)
  ------------------
  458|     65|		} ;
  459|       |
  460|     65|	return newblock * PAF24_SAMPLES_PER_BLOCK + newsample ;
  ------------------
  |  |   45|     65|#define	PAF24_SAMPLES_PER_BLOCK		10
  ------------------
  461|     65|} /* paf24_seek */
paf.c:paf24_close:
  465|     80|{	PAF24_PRIVATE *ppaf24 ;
  466|       |
  467|     80|	if (psf->codec_data == NULL)
  ------------------
  |  Branch (467:6): [True: 0, False: 80]
  ------------------
  468|      0|		return 0 ;
  469|       |
  470|     80|	ppaf24 = (PAF24_PRIVATE*) psf->codec_data ;
  471|       |
  472|     80|	if (psf->file.mode == SFM_WRITE || psf->file.mode == SFM_RDWR)
  ------------------
  |  Branch (472:6): [True: 0, False: 80]
  |  Branch (472:37): [True: 0, False: 80]
  ------------------
  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|     80|	return 0 ;
  478|     80|} /* paf24_close */

pcm_init:
  131|    849|{	int chars = 0 ;
  132|       |
  133|    849|	if (psf->bytewidth == 0 || psf->sf.channels == 0)
  ------------------
  |  Branch (133:6): [True: 2, False: 847]
  |  Branch (133:29): [True: 24, False: 823]
  ------------------
  134|     26|	{	psf_log_printf (psf, "pcm_init : internal error : bytewitdh = %d, channels = %d\n", psf->bytewidth, psf->sf.channels) ;
  135|     26|		return SFE_INTERNAL ;
  136|    823|		} ;
  137|       |
  138|    823|	psf->blockwidth = (sf_count_t) psf->bytewidth * psf->sf.channels ;
  139|       |
  140|    823|	if ((SF_CODEC (psf->sf.format)) == SF_FORMAT_PCM_S8)
  ------------------
  |  |  102|    823|#define SF_CODEC(x)			((x) & SF_FORMAT_SUBMASK)
  ------------------
  |  Branch (140:6): [True: 135, False: 688]
  ------------------
  141|    135|		chars = SF_CHARS_SIGNED ;
  142|    688|	else if ((SF_CODEC (psf->sf.format)) == SF_FORMAT_PCM_U8)
  ------------------
  |  |  102|    688|#define SF_CODEC(x)			((x) & SF_FORMAT_SUBMASK)
  ------------------
  |  Branch (142:11): [True: 110, False: 578]
  ------------------
  143|    110|		chars = SF_CHARS_UNSIGNED ;
  144|       |
  145|       |#if CPU_IS_BIG_ENDIAN
  146|       |	psf->data_endswap = (psf->endian == SF_ENDIAN_BIG) ? SF_FALSE : SF_TRUE ;
  147|       |#else
  148|    823|	psf->data_endswap = (psf->endian == SF_ENDIAN_LITTLE) ? SF_FALSE : SF_TRUE ;
  ------------------
  |  Branch (148:22): [True: 373, False: 450]
  ------------------
  149|    823|#endif
  150|       |
  151|    823|	if (psf->file.mode == SFM_READ || psf->file.mode == SFM_RDWR)
  ------------------
  |  Branch (151:6): [True: 823, False: 0]
  |  Branch (151:36): [True: 0, False: 0]
  ------------------
  152|    823|	{	switch (psf->bytewidth * 0x10000 + psf->endian + chars)
  153|    823|		{	case (0x10000 + SF_ENDIAN_BIG + SF_CHARS_SIGNED) :
  ------------------
  |  Branch (153:5): [True: 77, False: 746]
  ------------------
  154|    135|			case (0x10000 + SF_ENDIAN_LITTLE + SF_CHARS_SIGNED) :
  ------------------
  |  Branch (154:4): [True: 58, False: 765]
  ------------------
  155|    135|					psf->read_short		= pcm_read_sc2s ;
  156|    135|					psf->read_int		= pcm_read_sc2i ;
  157|    135|					psf->read_float		= pcm_read_sc2f ;
  158|    135|					psf->read_double	= pcm_read_sc2d ;
  159|    135|					break ;
  160|     24|			case (0x10000 + SF_ENDIAN_BIG + SF_CHARS_UNSIGNED) :
  ------------------
  |  Branch (160:4): [True: 24, False: 799]
  ------------------
  161|     79|			case (0x10000 + SF_ENDIAN_LITTLE + SF_CHARS_UNSIGNED) :
  ------------------
  |  Branch (161:4): [True: 55, False: 768]
  ------------------
  162|     79|					psf->read_short		= pcm_read_uc2s ;
  163|     79|					psf->read_int		= pcm_read_uc2i ;
  164|     79|					psf->read_float		= pcm_read_uc2f ;
  165|     79|					psf->read_double	= pcm_read_uc2d ;
  166|     79|					break ;
  167|       |
  168|    168|			case (2 * 0x10000 + SF_ENDIAN_BIG) :
  ------------------
  |  Branch (168:4): [True: 168, False: 655]
  ------------------
  169|    168|					psf->read_short		= pcm_read_bes2s ;
  170|    168|					psf->read_int		= pcm_read_bes2i ;
  171|    168|					psf->read_float		= pcm_read_bes2f ;
  172|    168|					psf->read_double	= pcm_read_bes2d ;
  173|    168|					break ;
  174|     48|			case (3 * 0x10000 + SF_ENDIAN_BIG) :
  ------------------
  |  Branch (174:4): [True: 48, False: 775]
  ------------------
  175|     48|					psf->read_short		= pcm_read_bet2s ;
  176|     48|					psf->read_int		= pcm_read_bet2i ;
  177|     48|					psf->read_float		= pcm_read_bet2f ;
  178|     48|					psf->read_double	= pcm_read_bet2d ;
  179|     48|					break ;
  180|    101|			case (4 * 0x10000 + SF_ENDIAN_BIG) :
  ------------------
  |  Branch (180:4): [True: 101, False: 722]
  ------------------
  181|       |
  182|    101|					psf->read_short		= pcm_read_bei2s ;
  183|    101|					psf->read_int		= pcm_read_bei2i ;
  184|    101|					psf->read_float		= pcm_read_bei2f ;
  185|    101|					psf->read_double	= pcm_read_bei2d ;
  186|    101|					break ;
  187|       |
  188|     76|			case (2 * 0x10000 + SF_ENDIAN_LITTLE) :
  ------------------
  |  Branch (188:4): [True: 76, False: 747]
  ------------------
  189|     76|					psf->read_short		= pcm_read_les2s ;
  190|     76|					psf->read_int		= pcm_read_les2i ;
  191|     76|					psf->read_float		= pcm_read_les2f ;
  192|     76|					psf->read_double	= pcm_read_les2d ;
  193|     76|					break ;
  194|     92|			case (3 * 0x10000 + SF_ENDIAN_LITTLE) :
  ------------------
  |  Branch (194:4): [True: 92, False: 731]
  ------------------
  195|     92|					psf->read_short		= pcm_read_let2s ;
  196|     92|					psf->read_int		= pcm_read_let2i ;
  197|     92|					psf->read_float		= pcm_read_let2f ;
  198|     92|					psf->read_double	= pcm_read_let2d ;
  199|     92|					break ;
  200|     93|			case (4 * 0x10000 + SF_ENDIAN_LITTLE) :
  ------------------
  |  Branch (200:4): [True: 93, False: 730]
  ------------------
  201|     93|					psf->read_short		= pcm_read_lei2s ;
  202|     93|					psf->read_int		= pcm_read_lei2i ;
  203|     93|					psf->read_float		= pcm_read_lei2f ;
  204|     93|					psf->read_double	= pcm_read_lei2d ;
  205|     93|					break ;
  206|     31|			default :
  ------------------
  |  Branch (206:4): [True: 31, False: 792]
  ------------------
  207|     31|				psf_log_printf (psf, "pcm.c returning SFE_UNIMPLEMENTED\nbytewidth %d    endian %d\n", psf->bytewidth, psf->endian) ;
  208|     31|				return SFE_UNIMPLEMENTED ;
  209|    823|			} ;
  210|    792|		} ;
  211|       |
  212|    792|	if (psf->file.mode == SFM_WRITE || psf->file.mode == SFM_RDWR)
  ------------------
  |  Branch (212:6): [True: 0, False: 792]
  |  Branch (212:37): [True: 0, False: 792]
  ------------------
  213|      0|	{	switch (psf->bytewidth * 0x10000 + psf->endian + chars)
  214|      0|		{	case (0x10000 + SF_ENDIAN_BIG + SF_CHARS_SIGNED) :
  ------------------
  |  Branch (214:5): [True: 0, False: 0]
  ------------------
  215|      0|			case (0x10000 + SF_ENDIAN_LITTLE + SF_CHARS_SIGNED) :
  ------------------
  |  Branch (215:4): [True: 0, False: 0]
  ------------------
  216|      0|					psf->write_short	= pcm_write_s2sc ;
  217|      0|					psf->write_int		= pcm_write_i2sc ;
  218|      0|					psf->write_float	= pcm_write_f2sc ;
  219|      0|					psf->write_double	= pcm_write_d2sc ;
  220|      0|					break ;
  221|      0|			case (0x10000 + SF_ENDIAN_BIG + SF_CHARS_UNSIGNED) :
  ------------------
  |  Branch (221:4): [True: 0, False: 0]
  ------------------
  222|      0|			case (0x10000 + SF_ENDIAN_LITTLE + SF_CHARS_UNSIGNED) :
  ------------------
  |  Branch (222:4): [True: 0, False: 0]
  ------------------
  223|      0|					psf->write_short	= pcm_write_s2uc ;
  224|      0|					psf->write_int		= pcm_write_i2uc ;
  225|      0|					psf->write_float	= pcm_write_f2uc ;
  226|      0|					psf->write_double	= pcm_write_d2uc ;
  227|      0|					break ;
  228|       |
  229|      0|			case (2 * 0x10000 + SF_ENDIAN_BIG) :
  ------------------
  |  Branch (229:4): [True: 0, False: 0]
  ------------------
  230|      0|					psf->write_short	= pcm_write_s2bes ;
  231|      0|					psf->write_int		= pcm_write_i2bes ;
  232|      0|					psf->write_float	= pcm_write_f2bes ;
  233|      0|					psf->write_double	= pcm_write_d2bes ;
  234|      0|					break ;
  235|       |
  236|      0|			case (3 * 0x10000 + SF_ENDIAN_BIG) :
  ------------------
  |  Branch (236:4): [True: 0, False: 0]
  ------------------
  237|      0|					psf->write_short	= pcm_write_s2bet ;
  238|      0|					psf->write_int		= pcm_write_i2bet ;
  239|      0|					psf->write_float	= pcm_write_f2bet ;
  240|      0|					psf->write_double	= pcm_write_d2bet ;
  241|      0|					break ;
  242|       |
  243|      0|			case (4 * 0x10000 + SF_ENDIAN_BIG) :
  ------------------
  |  Branch (243:4): [True: 0, False: 0]
  ------------------
  244|      0|					psf->write_short	= pcm_write_s2bei ;
  245|      0|					psf->write_int		= pcm_write_i2bei ;
  246|      0|					psf->write_float	= pcm_write_f2bei ;
  247|      0|					psf->write_double	= pcm_write_d2bei ;
  248|      0|					break ;
  249|       |
  250|      0|			case (2 * 0x10000 + SF_ENDIAN_LITTLE) :
  ------------------
  |  Branch (250:4): [True: 0, False: 0]
  ------------------
  251|      0|					psf->write_short	= pcm_write_s2les ;
  252|      0|					psf->write_int		= pcm_write_i2les ;
  253|      0|					psf->write_float	= pcm_write_f2les ;
  254|      0|					psf->write_double	= pcm_write_d2les ;
  255|      0|					break ;
  256|       |
  257|      0|			case (3 * 0x10000 + SF_ENDIAN_LITTLE) :
  ------------------
  |  Branch (257:4): [True: 0, False: 0]
  ------------------
  258|      0|					psf->write_short	= pcm_write_s2let ;
  259|      0|					psf->write_int		= pcm_write_i2let ;
  260|      0|					psf->write_float	= pcm_write_f2let ;
  261|      0|					psf->write_double	= pcm_write_d2let ;
  262|      0|					break ;
  263|       |
  264|      0|			case (4 * 0x10000 + SF_ENDIAN_LITTLE) :
  ------------------
  |  Branch (264:4): [True: 0, False: 0]
  ------------------
  265|      0|					psf->write_short	= pcm_write_s2lei ;
  266|      0|					psf->write_int		= pcm_write_i2lei ;
  267|      0|					psf->write_float	= pcm_write_f2lei ;
  268|      0|					psf->write_double	= pcm_write_d2lei ;
  269|      0|					break ;
  270|       |
  271|      0|			default :
  ------------------
  |  Branch (271:4): [True: 0, False: 0]
  ------------------
  272|      0|				psf_log_printf (psf, "pcm.c returning SFE_UNIMPLEMENTED\nbytewidth %d    endian %d\n", psf->bytewidth, psf->endian) ;
  273|      0|				return SFE_UNIMPLEMENTED ;
  274|      0|			} ;
  275|       |
  276|    792|		} ;
  277|       |
  278|    792|	if (psf->filelength > psf->dataoffset)
  ------------------
  |  Branch (278:6): [True: 436, False: 356]
  ------------------
  279|    436|	{	psf->datalength = (psf->dataend > 0) ? psf->dataend - psf->dataoffset :
  ------------------
  |  Branch (279:22): [True: 60, False: 376]
  ------------------
  280|    436|							psf->filelength - psf->dataoffset ;
  281|    436|		}
  282|    356|	else
  283|    356|		psf->datalength = 0 ;
  284|       |
  285|    792|	psf->sf.frames = psf->blockwidth > 0 ? psf->datalength / psf->blockwidth : 0 ;
  ------------------
  |  Branch (285:19): [True: 703, False: 89]
  ------------------
  286|       |
  287|    792|	return 0 ;
  288|    792|} /* pcm_init */
pcm.c:pcm_read_sc2s:
  671|    222|{	BUF_UNION	ubuf ;
  672|    222|	int			bufferlen, readcount ;
  673|    222|	sf_count_t	total = 0 ;
  674|       |
  675|    222|	bufferlen = ARRAY_LEN (ubuf.scbuf) ;
  ------------------
  |  |   88|    222|#define		ARRAY_LEN(x)	((int) (sizeof (x) / sizeof ((x) [0])))
  ------------------
  676|       |
  677|    430|	while (len > 0)
  ------------------
  |  Branch (677:9): [True: 222, False: 208]
  ------------------
  678|    222|	{	if (len < bufferlen)
  ------------------
  |  Branch (678:8): [True: 222, False: 0]
  ------------------
  679|    222|			bufferlen = (int) len ;
  680|    222|		readcount = (int) psf_fread (ubuf.scbuf, sizeof (signed char), bufferlen, psf) ;
  681|    222|		sc2s_array (ubuf.scbuf, readcount, ptr + total) ;
  682|    222|		total += readcount ;
  683|    222|		if (readcount < bufferlen)
  ------------------
  |  Branch (683:7): [True: 14, False: 208]
  ------------------
  684|     14|			break ;
  685|    208|		len -= readcount ;
  686|    208|		} ;
  687|       |
  688|    222|	return total ;
  689|    222|} /* pcm_read_sc2s */
pcm.c:sc2s_array:
  295|    675|{	for (int i = 0 ; i < count ; i++)
  ------------------
  |  Branch (295:20): [True: 453, False: 222]
  ------------------
  296|    453|	{	dest [i] = ((uint16_t) src [i]) << 8 ;
  297|    453|		} ;
  298|    222|} /* sc2s_array */
pcm.c:pcm_read_uc2s:
  693|    456|{	BUF_UNION	ubuf ;
  694|    456|	int			bufferlen, readcount ;
  695|    456|	sf_count_t	total = 0 ;
  696|       |
  697|    456|	bufferlen = ARRAY_LEN (ubuf.ucbuf) ;
  ------------------
  |  |   88|    456|#define		ARRAY_LEN(x)	((int) (sizeof (x) / sizeof ((x) [0])))
  ------------------
  698|       |
  699|    912|	while (len > 0)
  ------------------
  |  Branch (699:9): [True: 456, False: 456]
  ------------------
  700|    456|	{	if (len < bufferlen)
  ------------------
  |  Branch (700:8): [True: 456, False: 0]
  ------------------
  701|    456|			bufferlen = (int) len ;
  702|    456|		readcount = (int) psf_fread (ubuf.ucbuf, sizeof (unsigned char), bufferlen, psf) ;
  703|    456|		uc2s_array (ubuf.ucbuf, readcount, ptr + total) ;
  704|    456|		total += readcount ;
  705|    456|		if (readcount < bufferlen)
  ------------------
  |  Branch (705:7): [True: 0, False: 456]
  ------------------
  706|      0|			break ;
  707|    456|		len -= readcount ;
  708|    456|		} ;
  709|       |
  710|    456|	return total ;
  711|    456|} /* pcm_read_uc2s */
pcm.c:uc2s_array:
  302|  7.51k|{	for (int i = 0 ; i < count ; i++)
  ------------------
  |  Branch (302:20): [True: 7.06k, False: 456]
  ------------------
  303|  7.06k|	{	dest [i] = (((uint32_t) src [i]) - 0x80) << 8 ;
  304|  7.06k|		} ;
  305|    456|} /* uc2s_array */
pcm.c:pcm_read_bes2s:
  715|    207|{	int		total ;
  716|       |
  717|    207|	total = (int) psf_fread (ptr, sizeof (short), len, psf) ;
  718|    207|#if CPU_IS_LITTLE_ENDIAN
  719|    207|	endswap_short_array (ptr, len) ;
  720|    207|#endif
  721|       |
  722|    207|	return total ;
  723|    207|} /* pcm_read_bes2s */
pcm.c:pcm_read_les2s:
  727|  3.48k|{	int		total ;
  728|       |
  729|  3.48k|	total = psf_fread (ptr, sizeof (short), len, psf) ;
  730|       |#if CPU_IS_BIG_ENDIAN
  731|       |	endswap_short_array (ptr, len) ;
  732|       |#endif
  733|       |
  734|  3.48k|	return total ;
  735|  3.48k|} /* pcm_read_les2s */
pcm.c:pcm_read_bet2s:
  739|    399|{	BUF_UNION	ubuf ;
  740|    399|	int			bufferlen, readcount ;
  741|    399|	sf_count_t	total = 0 ;
  742|       |
  743|    399|	bufferlen = sizeof (ubuf.ucbuf) / SIZEOF_TRIBYTE ;
  ------------------
  |  |   41|    399|#define	SIZEOF_TRIBYTE	3
  ------------------
  744|       |
  745|    778|	while (len > 0)
  ------------------
  |  Branch (745:9): [True: 399, False: 379]
  ------------------
  746|    399|	{	if (len < bufferlen)
  ------------------
  |  Branch (746:8): [True: 399, False: 0]
  ------------------
  747|    399|			bufferlen = (int) len ;
  748|    399|		readcount = (int) psf_fread (ubuf.ucbuf, SIZEOF_TRIBYTE, bufferlen, psf) ;
  ------------------
  |  |   41|    399|#define	SIZEOF_TRIBYTE	3
  ------------------
  749|    399|		bet2s_array ((tribyte*) (ubuf.ucbuf), readcount, ptr + total) ;
  750|    399|		total += readcount ;
  751|    399|		if (readcount < bufferlen)
  ------------------
  |  Branch (751:7): [True: 20, False: 379]
  ------------------
  752|     20|			break ;
  753|    379|		len -= readcount ;
  754|    379|		} ;
  755|       |
  756|    399|	return total ;
  757|    399|} /* pcm_read_bet2s */
pcm.c:bet2s_array:
  315|    984|{	for (int i = 0 ; i < count ; i++)
  ------------------
  |  Branch (315:20): [True: 585, False: 399]
  ------------------
  316|    585|		dest [i] = BET2H_16_PTR (src [i].bytes) ;
  ------------------
  |  |  173|    585|#define BET2H_16_PTR(x)			(((x) [0] << 8) + (x) [1])
  ------------------
  317|    399|} /* bet2s_array */
pcm.c:pcm_read_let2s:
  761|    407|{	BUF_UNION	ubuf ;
  762|    407|	int			bufferlen, readcount ;
  763|    407|	sf_count_t	total = 0 ;
  764|       |
  765|    407|	bufferlen = sizeof (ubuf.ucbuf) / SIZEOF_TRIBYTE ;
  ------------------
  |  |   41|    407|#define	SIZEOF_TRIBYTE	3
  ------------------
  766|       |
  767|    786|	while (len > 0)
  ------------------
  |  Branch (767:9): [True: 407, False: 379]
  ------------------
  768|    407|	{	if (len < bufferlen)
  ------------------
  |  Branch (768:8): [True: 407, False: 0]
  ------------------
  769|    407|			bufferlen = (int) len ;
  770|    407|		readcount = (int) psf_fread (ubuf.ucbuf, SIZEOF_TRIBYTE, bufferlen, psf) ;
  ------------------
  |  |   41|    407|#define	SIZEOF_TRIBYTE	3
  ------------------
  771|    407|		let2s_array ((tribyte*) (ubuf.ucbuf), readcount, ptr + total) ;
  772|    407|		total += readcount ;
  773|    407|		if (readcount < bufferlen)
  ------------------
  |  Branch (773:7): [True: 28, False: 379]
  ------------------
  774|     28|			break ;
  775|    379|		len -= readcount ;
  776|    379|		} ;
  777|       |
  778|    407|	return total ;
  779|    407|} /* pcm_read_let2s */
pcm.c:let2s_array:
  309|  2.02k|{	for (int i = 0 ; i < count ; i++)
  ------------------
  |  Branch (309:20): [True: 1.61k, False: 407]
  ------------------
  310|  1.61k|		dest [i] = LET2H_16_PTR (src [i].bytes) ;
  ------------------
  |  |  170|  1.61k|#define LET2H_16_PTR(x)			((x) [1] + ((x) [2] << 8))
  ------------------
  311|    407|} /* let2s_array */
pcm.c:pcm_read_bei2s:
  783|    341|{	BUF_UNION	ubuf ;
  784|    341|	int			bufferlen, readcount ;
  785|    341|	sf_count_t	total = 0 ;
  786|       |
  787|    341|	bufferlen = ARRAY_LEN (ubuf.ibuf) ;
  ------------------
  |  |   88|    341|#define		ARRAY_LEN(x)	((int) (sizeof (x) / sizeof ((x) [0])))
  ------------------
  788|       |
  789|    673|	while (len > 0)
  ------------------
  |  Branch (789:9): [True: 341, False: 332]
  ------------------
  790|    341|	{	if (len < bufferlen)
  ------------------
  |  Branch (790:8): [True: 341, False: 0]
  ------------------
  791|    341|			bufferlen = (int) len ;
  792|    341|		readcount = (int) psf_fread (ubuf.ibuf, sizeof (int), bufferlen, psf) ;
  793|    341|		bei2s_array (ubuf.ibuf, readcount, ptr + total) ;
  794|    341|		total += readcount ;
  795|    341|		if (readcount < bufferlen)
  ------------------
  |  Branch (795:7): [True: 9, False: 332]
  ------------------
  796|      9|			break ;
  797|    332|		len -= readcount ;
  798|    332|		} ;
  799|       |
  800|    341|	return total ;
  801|    341|} /* pcm_read_bei2s */
pcm.c:bei2s_array:
  331|    341|{	int value ;
  332|       |
  333|  1.47k|	for (int i = 0 ; i < count ; i++)
  ------------------
  |  Branch (333:19): [True: 1.13k, False: 341]
  ------------------
  334|  1.13k|	{	value = BE2H_32 (src [i]) ;
  ------------------
  |  |  141|  1.13k|	#define BE2H_32(x)			ENDSWAP_32 (x)
  |  |  ------------------
  |  |  |  |   35|  1.13k|#define	ENDSWAP_32(x)		(bswap_32 (x))
  |  |  ------------------
  ------------------
  335|  1.13k|		dest [i] = value >> 16 ;
  336|  1.13k|		} ;
  337|    341|} /* bei2s_array */
pcm.c:pcm_read_lei2s:
  805|    397|{	BUF_UNION	ubuf ;
  806|    397|	int			bufferlen, readcount ;
  807|    397|	sf_count_t	total = 0 ;
  808|       |
  809|    397|	bufferlen = ARRAY_LEN (ubuf.ibuf) ;
  ------------------
  |  |   88|    397|#define		ARRAY_LEN(x)	((int) (sizeof (x) / sizeof ((x) [0])))
  ------------------
  810|       |
  811|    775|	while (len > 0)
  ------------------
  |  Branch (811:9): [True: 397, False: 378]
  ------------------
  812|    397|	{	if (len < bufferlen)
  ------------------
  |  Branch (812:8): [True: 397, False: 0]
  ------------------
  813|    397|			bufferlen = (int) len ;
  814|    397|		readcount = (int) psf_fread (ubuf.ibuf, sizeof (int), bufferlen, psf) ;
  815|    397|		lei2s_array (ubuf.ibuf, readcount, ptr + total) ;
  816|    397|		total += readcount ;
  817|    397|		if (readcount < bufferlen)
  ------------------
  |  Branch (817:7): [True: 19, False: 378]
  ------------------
  818|     19|			break ;
  819|    378|		len -= readcount ;
  820|    378|		} ;
  821|       |
  822|    397|	return total ;
  823|    397|} /* pcm_read_lei2s */
pcm.c:lei2s_array:
  321|    397|{	int value ;
  322|       |
  323|    974|	for (int i = 0 ; i < count ; i++)
  ------------------
  |  Branch (323:19): [True: 577, False: 397]
  ------------------
  324|    577|	{	value = LE2H_32 (src [i]) ;
  ------------------
  |  |  138|    577|	#define LE2H_32(x)			(x)
  ------------------
  325|    577|		dest [i] = value >> 16 ;
  326|    577|		} ;
  327|    397|} /* lei2s_array */

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

raw_open:
   32|    969|{	int	subformat, error = SFE_NO_ERROR ;
   33|       |
   34|    969|	subformat = SF_CODEC (psf->sf.format) ;
  ------------------
  |  |  102|    969|#define SF_CODEC(x)			((x) & SF_FORMAT_SUBMASK)
  ------------------
   35|       |
   36|    969|	psf->endian = SF_ENDIAN (psf->sf.format) ;
  ------------------
  |  |  103|    969|#define SF_ENDIAN(x)		((x) & SF_FORMAT_ENDMASK)
  ------------------
   37|       |
   38|    969|	if (CPU_IS_BIG_ENDIAN && (psf->endian == 0 || psf->endian == SF_ENDIAN_CPU))
  ------------------
  |  |   11|  1.93k|#define CPU_IS_BIG_ENDIAN 0
  |  |  ------------------
  |  |  |  Branch (11:27): [Folded, False: 969]
  |  |  ------------------
  ------------------
  |  Branch (38:28): [True: 0, False: 0]
  |  Branch (38:48): [True: 0, False: 0]
  ------------------
   39|      0|		psf->endian = SF_ENDIAN_BIG ;
   40|    969|	else if (CPU_IS_LITTLE_ENDIAN && (psf->endian == 0 || psf->endian == SF_ENDIAN_CPU))
  ------------------
  |  |   14|  1.93k|#define CPU_IS_LITTLE_ENDIAN 1
  |  |  ------------------
  |  |  |  Branch (14:30): [True: 969, Folded]
  |  |  ------------------
  ------------------
  |  Branch (40:36): [True: 969, False: 0]
  |  Branch (40:56): [True: 0, False: 0]
  ------------------
   41|    969|		psf->endian = SF_ENDIAN_LITTLE ;
   42|       |
   43|    969|	psf->blockwidth = (sf_count_t) psf->bytewidth * psf->sf.channels ;
   44|    969|	psf->dataoffset = 0 ;
   45|    969|	psf->datalength = psf->filelength ;
   46|       |
   47|    969|	switch (subformat)
   48|    969|	{	case SF_FORMAT_PCM_S8 :
  ------------------
  |  Branch (48:4): [True: 0, False: 969]
  ------------------
   49|      0|				error = pcm_init (psf) ;
   50|      0|				break ;
   51|       |
   52|     13|		case SF_FORMAT_PCM_U8 :
  ------------------
  |  Branch (52:3): [True: 13, False: 956]
  ------------------
   53|     13|				error = pcm_init (psf) ;
   54|     13|				break ;
   55|       |
   56|     10|		case SF_FORMAT_PCM_16 :
  ------------------
  |  Branch (56:3): [True: 10, False: 959]
  ------------------
   57|     10|		case SF_FORMAT_PCM_24 :
  ------------------
  |  Branch (57:3): [True: 0, False: 969]
  ------------------
   58|     10|		case SF_FORMAT_PCM_32 :
  ------------------
  |  Branch (58:3): [True: 0, False: 969]
  ------------------
   59|     10|				error = pcm_init (psf) ;
   60|     10|				break ;
   61|       |
   62|     14|		case SF_FORMAT_ULAW :
  ------------------
  |  Branch (62:3): [True: 14, False: 955]
  ------------------
   63|     14|				error = ulaw_init (psf) ;
   64|     14|				break ;
   65|       |
   66|     12|		case SF_FORMAT_ALAW :
  ------------------
  |  Branch (66:3): [True: 12, False: 957]
  ------------------
   67|     12|				error = alaw_init (psf) ;
   68|     12|				break ;
   69|       |
   70|    469|		case SF_FORMAT_GSM610 :
  ------------------
  |  Branch (70:3): [True: 469, False: 500]
  ------------------
   71|    469|				error = gsm610_init (psf) ;
   72|    469|				break ;
   73|       |
   74|       |		/* Lite remove start */
   75|       |
   76|      0|		case SF_FORMAT_NMS_ADPCM_16 :
  ------------------
  |  Branch (76:3): [True: 0, False: 969]
  ------------------
   77|      0|		case SF_FORMAT_NMS_ADPCM_24 :
  ------------------
  |  Branch (77:3): [True: 0, False: 969]
  ------------------
   78|      0|		case SF_FORMAT_NMS_ADPCM_32 :
  ------------------
  |  Branch (78:3): [True: 0, False: 969]
  ------------------
   79|      0|				error = nms_adpcm_init (psf) ;
   80|      0|				break ;
   81|       |
   82|      0|		case SF_FORMAT_FLOAT :
  ------------------
  |  Branch (82:3): [True: 0, False: 969]
  ------------------
   83|      0|				error = float32_init (psf) ;
   84|      0|				break ;
   85|       |
   86|      0|		case SF_FORMAT_DOUBLE :
  ------------------
  |  Branch (86:3): [True: 0, False: 969]
  ------------------
   87|      0|				error = double64_init (psf) ;
   88|      0|				break ;
   89|       |
   90|      0|		case SF_FORMAT_DWVW_12 :
  ------------------
  |  Branch (90:3): [True: 0, False: 969]
  ------------------
   91|      0|				error = dwvw_init (psf, 12) ;
   92|      0|				break ;
   93|       |
   94|    202|		case SF_FORMAT_DWVW_16 :
  ------------------
  |  Branch (94:3): [True: 202, False: 767]
  ------------------
   95|    202|				error = dwvw_init (psf, 16) ;
   96|    202|				break ;
   97|       |
   98|      0|		case SF_FORMAT_DWVW_24 :
  ------------------
  |  Branch (98:3): [True: 0, False: 969]
  ------------------
   99|      0|				error = dwvw_init (psf, 24) ;
  100|      0|				break ;
  101|       |
  102|    249|		case SF_FORMAT_VOX_ADPCM :
  ------------------
  |  Branch (102:3): [True: 249, False: 720]
  ------------------
  103|    249|				error = vox_adpcm_init (psf) ;
  104|    249|				break ;
  105|       |		/* Lite remove end */
  106|       |
  107|      0|		default : return SFE_BAD_OPEN_FORMAT ;
  ------------------
  |  Branch (107:3): [True: 0, False: 969]
  ------------------
  108|    969|		} ;
  109|       |
  110|    969|	return error ;
  111|    969|} /* raw_open */

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

paf.c:endswap_int_array:
  301|  1.42k|{
  302|  26.8k|	for (int i = 0 ; i < len ; i++)
  ------------------
  |  Branch (302:19): [True: 25.4k, False: 1.42k]
  ------------------
  303|  25.4k|	{	int temp = ptr [i] ;
  304|       |		ptr [i] = ENDSWAP_32 (temp) ;
  ------------------
  |  |   35|  25.4k|#define	ENDSWAP_32(x)		(bswap_32 (x))
  ------------------
  305|  25.4k|		} ;
  306|  1.42k|} /* endswap_int_array */
common.c:psf_get_be32:
  241|  1.32M|{	int32_t value = ((uint32_t) ptr [offset]) << 24 ;
  242|  1.32M|	value += ptr [offset + 1] << 16 ;
  243|  1.32M|	value += ptr [offset + 2] << 8 ;
  244|  1.32M|	value += ptr [offset + 3] ;
  245|  1.32M|	return value ;
  246|  1.32M|} /* psf_get_be32 */
common.c:psf_get_le32:
  250|   471k|{	int32_t value = ((uint32_t) ptr [offset + 3]) << 24 ;
  251|   471k|	value += ptr [offset + 2] << 16 ;
  252|   471k|	value += ptr [offset + 1] << 8 ;
  253|   471k|	value += ptr [offset] ;
  254|   471k|	return value ;
  255|   471k|} /* psf_get_le32 */
common.c:psf_get_be64:
  207|  32.7k|{	int64_t value ;
  208|       |
  209|  32.7k|	value = (int64_t) ((uint64_t) ptr [offset] << 24) ;
  210|  32.7k|	value += (int64_t) ((uint64_t) ptr [offset + 1] << 16) ;
  211|  32.7k|	value += (int64_t) ((uint64_t) ptr [offset + 2] << 8) ;
  212|  32.7k|	value += ptr [offset + 3] ;
  213|       |
  214|  32.7k|	value = (int64_t) (((uint64_t) value) << 32) ;
  215|       |
  216|  32.7k|	value += (int64_t) ((uint64_t) ptr [offset + 4] << 24) ;
  217|  32.7k|	value += (int64_t) ((uint64_t) ptr [offset + 5] << 16) ;
  218|  32.7k|	value += (int64_t) ((uint64_t) ptr [offset + 6] << 8) ;
  219|  32.7k|	value += ptr [offset + 7] ;
  220|  32.7k|	return value ;
  221|  32.7k|} /* psf_get_be64 */
common.c:psf_get_le64:
  225|  92.7k|{	int64_t value = (int64_t) ((uint64_t) ptr [offset + 7] << 24) ;
  226|  92.7k|	value += (int64_t) ((uint64_t) ptr [offset + 6] << 16) ;
  227|  92.7k|	value += (int64_t) ((uint64_t) ptr [offset + 5] << 8) ;
  228|  92.7k|	value += ptr [offset + 4] ;
  229|       |
  230|  92.7k|	value = (int64_t) (((uint64_t) value) << 32) ;
  231|       |
  232|  92.7k|	value += (int64_t) ((uint64_t) ptr [offset + 3] << 24) ;
  233|  92.7k|	value += (int64_t) ((uint64_t) ptr [offset + 2] << 16) ;
  234|  92.7k|	value += (int64_t) ((uint64_t) ptr [offset + 1] << 8) ;
  235|  92.7k|	value += ptr [offset] ;
  236|  92.7k|	return value ;
  237|  92.7k|} /* psf_get_le64 */
double64.c:endswap_double_array:
  346|    214|{	endswap_int64_t_array ((int64_t *) ptr, len) ;
  347|    214|} /* endswap_double_array */
double64.c:endswap_int64_t_array:
  321|    214|{
  322|    614|	for (int i = 0 ; i < len ; i++)
  ------------------
  |  Branch (322:19): [True: 400, False: 214]
  ------------------
  323|    400|	{	int64_t value = ptr [i] ;
  324|       |		ptr [i] = ENDSWAP_64 (value) ;
  ------------------
  |  |   36|    400|#define	ENDSWAP_64(x)		(bswap_64 (x))
  ------------------
  325|    400|		} ;
  326|    214|} /* endswap_int64_t_array */
float32.c:endswap_int_array:
  301|    213|{
  302|    610|	for (int i = 0 ; i < len ; i++)
  ------------------
  |  Branch (302:19): [True: 397, False: 213]
  ------------------
  303|    397|	{	int temp = ptr [i] ;
  304|       |		ptr [i] = ENDSWAP_32 (temp) ;
  ------------------
  |  |   35|    397|#define	ENDSWAP_32(x)		(bswap_32 (x))
  ------------------
  305|    397|		} ;
  306|    213|} /* endswap_int_array */
pcm.c:endswap_short_array:
  284|    207|{
  285|  1.40k|	for (int i = 0 ; i < len ; i++)
  ------------------
  |  Branch (285:19): [True: 1.20k, False: 207]
  ------------------
  286|  1.20k|	{	short temp = ptr [i] ;
  287|       |		ptr [i] = ENDSWAP_16 (temp) ;
  ------------------
  |  |   34|  1.20k|#define	ENDSWAP_16(x)		(bswap_16 (x))
  ------------------
  288|  1.20k|		} ;
  289|    207|} /* endswap_short_array */
alac_decoder.c:psf_get_be32:
  241|  3.18k|{	int32_t value = ((uint32_t) ptr [offset]) << 24 ;
  242|  3.18k|	value += ptr [offset + 1] << 16 ;
  243|  3.18k|	value += ptr [offset + 2] << 8 ;
  244|  3.18k|	value += ptr [offset + 3] ;
  245|  3.18k|	return value ;
  246|  3.18k|} /* psf_get_be32 */
alac_decoder.c:psf_get_be16:
  275|    784|{	return (int16_t) (ptr [offset] << 8) + ptr [offset + 1] ;
  276|    784|} /* psf_get_be16 */

sf_open_virtual:
  473|  19.8k|{	SF_PRIVATE 	*psf ;
  474|       |
  475|       |	/* Make sure we have a valid set of virtual pointers. */
  476|  19.8k|	if (sfvirtual->get_filelen == NULL)
  ------------------
  |  Branch (476:6): [True: 0, False: 19.8k]
  ------------------
  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|  19.8k|		} ;
  481|       |
  482|  19.8k|	if ((sfvirtual->seek == NULL || sfvirtual->tell == NULL) && sfinfo->seekable)
  ------------------
  |  Branch (482:7): [True: 0, False: 19.8k]
  |  Branch (482:34): [True: 0, False: 19.8k]
  |  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|  19.8k|		} ;
  487|       |
  488|  19.8k|	if ((mode == SFM_READ || mode == SFM_RDWR) && sfvirtual->read == NULL)
  ------------------
  |  Branch (488:7): [True: 19.8k, False: 0]
  |  Branch (488:27): [True: 0, False: 0]
  |  Branch (488:48): [True: 0, False: 19.8k]
  ------------------
  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|  19.8k|		} ;
  493|       |
  494|  19.8k|	if ((mode == SFM_WRITE || mode == SFM_RDWR) && sfvirtual->write == NULL)
  ------------------
  |  Branch (494:7): [True: 0, False: 19.8k]
  |  Branch (494:28): [True: 0, False: 19.8k]
  |  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|  19.8k|		} ;
  499|       |
  500|  19.8k|	if ((psf = psf_allocate ()) == NULL)
  ------------------
  |  Branch (500:6): [True: 0, False: 19.8k]
  ------------------
  501|      0|	{	sf_errno = SFE_MALLOC_FAILED ;
  502|      0|		return	NULL ;
  503|  19.8k|		} ;
  504|       |
  505|  19.8k|	psf_init_files (psf) ;
  506|       |
  507|  19.8k|	psf->virtual_io = SF_TRUE ;
  508|  19.8k|	psf->vio = *sfvirtual ;
  509|  19.8k|	psf->vio_user_data = user_data ;
  510|       |
  511|  19.8k|	psf->file.mode = mode ;
  512|       |
  513|  19.8k|	return psf_open_file (psf, sfinfo) ;
  514|  19.8k|} /* sf_open_virtual */
sf_close:
  518|  3.63k|{	SF_PRIVATE	*psf ;
  519|       |
  520|  3.63k|	VALIDATE_SNDFILE_AND_ASSIGN_PSF (sndfile, psf, 1) ;
  ------------------
  |  |  326|  3.63k|		{	if ((a) == NULL)						\
  |  |  ------------------
  |  |  |  Branch (326:9): [True: 0, False: 3.63k]
  |  |  ------------------
  |  |  327|  3.63k|			{	sf_errno = SFE_BAD_SNDFILE_PTR ;	\
  |  |  328|      0|				return 0 ;							\
  |  |  329|  3.63k|				} ;									\
  |  |  330|  3.63k|			(b) = (SF_PRIVATE*) (a) ;				\
  |  |  331|  3.63k|			if ((b)->virtual_io == SF_FALSE &&		\
  |  |  ------------------
  |  |  |  Branch (331:8): [True: 0, False: 3.63k]
  |  |  ------------------
  |  |  332|  3.63k|				psf_file_valid (b) == 0)			\
  |  |  ------------------
  |  |  |  Branch (332:5): [True: 0, False: 0]
  |  |  ------------------
  |  |  333|  3.63k|			{	(b)->error = SFE_BAD_FILE_PTR ;		\
  |  |  334|      0|				return 0 ;							\
  |  |  335|  3.63k|				} ;									\
  |  |  336|  3.63k|			if ((b)->Magick != SNDFILE_MAGICK)		\
  |  |  ------------------
  |  |  |  |   41|  3.63k|#define		SNDFILE_MAGICK	0x1234C0DE
  |  |  ------------------
  |  |  |  Branch (336:8): [True: 0, False: 3.63k]
  |  |  ------------------
  |  |  337|  3.63k|			{	(b)->error = SFE_BAD_SNDFILE_PTR ;	\
  |  |  338|      0|				return 0 ;							\
  |  |  339|  3.63k|				} ;									\
  |  |  340|  3.63k|			if (c) (b)->error = 0 ;					\
  |  |  ------------------
  |  |  |  Branch (340:8): [True: 3.63k, Folded]
  |  |  ------------------
  |  |  341|  3.63k|			}
  ------------------
  521|       |
  522|  3.63k|	return psf_close (psf) ;
  523|  7.26k|} /* sf_close */
sf_error_number:
  542|  14.8k|{	static const char *bad_errnum =
  543|  14.8k|		"No error defined for this error number. This is a bug in libsndfile." ;
  544|  14.8k|	int	k ;
  545|       |
  546|  14.8k|	if (errnum == SFE_MAX_ERROR)
  ------------------
  |  Branch (546:6): [True: 0, False: 14.8k]
  ------------------
  547|      0|		return SndfileErrors [0].str ;
  548|       |
  549|  14.8k|	if (errnum < 0 || errnum > SFE_MAX_ERROR)
  ------------------
  |  Branch (549:6): [True: 0, False: 14.8k]
  |  Branch (549:20): [True: 0, False: 14.8k]
  ------------------
  550|      0|	{	/* This really shouldn't happen in release versions. */
  551|      0|		printf ("Not a valid error number (%d).\n", errnum) ;
  552|      0|		return bad_errnum ;
  553|  14.8k|		} ;
  554|       |
  555|   913k|	for (k = 0 ; SndfileErrors [k].str ; k++)
  ------------------
  |  Branch (555:15): [True: 913k, False: 0]
  ------------------
  556|   913k|		if (errnum == SndfileErrors [k].error)
  ------------------
  |  Branch (556:7): [True: 14.8k, False: 898k]
  ------------------
  557|  14.8k|			return SndfileErrors [k].str ;
  558|       |
  559|      0|	return bad_errnum ;
  560|  14.8k|} /* sf_error_number */
sf_format_check:
  654|    969|{	int	subformat, endian ;
  655|       |
  656|    969|	subformat = SF_CODEC (info->format) ;
  ------------------
  |  |  102|    969|#define SF_CODEC(x)			((x) & SF_FORMAT_SUBMASK)
  ------------------
  657|    969|	endian = SF_ENDIAN (info->format) ;
  ------------------
  |  |  103|    969|#define SF_ENDIAN(x)		((x) & SF_FORMAT_ENDMASK)
  ------------------
  658|       |
  659|       |	/* This is the place where each file format can check if the supplied
  660|       |	** SF_INFO struct is valid.
  661|       |	** Return 0 on failure, 1 on success.
  662|       |	*/
  663|       |
  664|    969|	if (info->channels < 1 || info->channels > SF_MAX_CHANNELS)
  ------------------
  |  |   95|    969|#define		SF_MAX_CHANNELS		1024
  ------------------
  |  Branch (664:6): [True: 0, False: 969]
  |  Branch (664:28): [True: 0, False: 969]
  ------------------
  665|      0|		return 0 ;
  666|       |
  667|    969|	if (info->samplerate < 0)
  ------------------
  |  Branch (667:6): [True: 0, False: 969]
  ------------------
  668|      0|		return 0 ;
  669|       |
  670|    969|	switch (SF_CONTAINER (info->format))
  ------------------
  |  |  101|    969|#define SF_CONTAINER(x)		((x) & SF_FORMAT_TYPEMASK)
  ------------------
  671|    969|	{	case SF_FORMAT_WAV :
  ------------------
  |  Branch (671:4): [True: 0, False: 969]
  ------------------
  672|       |				/* WAV now allows both endian, RIFF or RIFX (little or big respectively) */
  673|      0|				if (subformat == SF_FORMAT_PCM_U8 || subformat == SF_FORMAT_PCM_16)
  ------------------
  |  Branch (673:9): [True: 0, False: 0]
  |  Branch (673:42): [True: 0, False: 0]
  ------------------
  674|      0|					return 1 ;
  675|      0|				if (subformat == SF_FORMAT_PCM_24 || subformat == SF_FORMAT_PCM_32)
  ------------------
  |  Branch (675:9): [True: 0, False: 0]
  |  Branch (675:42): [True: 0, False: 0]
  ------------------
  676|      0|					return 1 ;
  677|      0|				if ((subformat == SF_FORMAT_IMA_ADPCM || subformat == SF_FORMAT_MS_ADPCM) && info->channels <= 2)
  ------------------
  |  Branch (677:10): [True: 0, False: 0]
  |  Branch (677:46): [True: 0, False: 0]
  |  Branch (677:82): [True: 0, False: 0]
  ------------------
  678|      0|					return 1 ;
  679|      0|				if (subformat == SF_FORMAT_GSM610 && info->channels == 1)
  ------------------
  |  Branch (679:9): [True: 0, False: 0]
  |  Branch (679:42): [True: 0, False: 0]
  ------------------
  680|      0|					return 1 ;
  681|      0|				if (subformat == SF_FORMAT_G721_32 && info->channels == 1)
  ------------------
  |  Branch (681:9): [True: 0, False: 0]
  |  Branch (681:43): [True: 0, False: 0]
  ------------------
  682|      0|					return 1 ;
  683|      0|				if (subformat == SF_FORMAT_ULAW || subformat == SF_FORMAT_ALAW)
  ------------------
  |  Branch (683:9): [True: 0, False: 0]
  |  Branch (683:40): [True: 0, False: 0]
  ------------------
  684|      0|					return 1 ;
  685|      0|				if (subformat == SF_FORMAT_FLOAT || subformat == SF_FORMAT_DOUBLE)
  ------------------
  |  Branch (685:9): [True: 0, False: 0]
  |  Branch (685:41): [True: 0, False: 0]
  ------------------
  686|      0|					return 1 ;
  687|      0|				if ((subformat == SF_FORMAT_NMS_ADPCM_16 || subformat == SF_FORMAT_NMS_ADPCM_24 ||
  ------------------
  |  Branch (687:10): [True: 0, False: 0]
  |  Branch (687:49): [True: 0, False: 0]
  ------------------
  688|      0|							subformat == SF_FORMAT_NMS_ADPCM_32) && info->channels == 1)
  ------------------
  |  Branch (688:8): [True: 0, False: 0]
  |  Branch (688:48): [True: 0, False: 0]
  ------------------
  689|      0|					return 1 ;
  690|      0|				if (subformat == SF_FORMAT_MPEG_LAYER_III && info->channels <= 2)
  ------------------
  |  Branch (690:9): [True: 0, False: 0]
  |  Branch (690:50): [True: 0, False: 0]
  ------------------
  691|      0|					return 1 ;
  692|      0|				break ;
  693|       |
  694|      0|		case SF_FORMAT_WAVEX :
  ------------------
  |  Branch (694:3): [True: 0, False: 969]
  ------------------
  695|      0|				if (endian == SF_ENDIAN_BIG || endian == SF_ENDIAN_CPU)
  ------------------
  |  Branch (695:9): [True: 0, False: 0]
  |  Branch (695:36): [True: 0, False: 0]
  ------------------
  696|      0|					return 0 ;
  697|      0|				if (subformat == SF_FORMAT_PCM_U8 || subformat == SF_FORMAT_PCM_16)
  ------------------
  |  Branch (697:9): [True: 0, False: 0]
  |  Branch (697:42): [True: 0, False: 0]
  ------------------
  698|      0|					return 1 ;
  699|      0|				if (subformat == SF_FORMAT_PCM_24 || subformat == SF_FORMAT_PCM_32)
  ------------------
  |  Branch (699:9): [True: 0, False: 0]
  |  Branch (699:42): [True: 0, False: 0]
  ------------------
  700|      0|					return 1 ;
  701|      0|				if (subformat == SF_FORMAT_ULAW || subformat == SF_FORMAT_ALAW)
  ------------------
  |  Branch (701:9): [True: 0, False: 0]
  |  Branch (701:40): [True: 0, False: 0]
  ------------------
  702|      0|					return 1 ;
  703|      0|				if (subformat == SF_FORMAT_FLOAT || subformat == SF_FORMAT_DOUBLE)
  ------------------
  |  Branch (703:9): [True: 0, False: 0]
  |  Branch (703:41): [True: 0, False: 0]
  ------------------
  704|      0|					return 1 ;
  705|      0|				break ;
  706|       |
  707|      0|		case SF_FORMAT_AIFF :
  ------------------
  |  Branch (707:3): [True: 0, False: 969]
  ------------------
  708|       |				/* AIFF does allow both endian-nesses for PCM data.*/
  709|      0|				if (subformat == SF_FORMAT_PCM_16 || subformat == SF_FORMAT_PCM_24 || subformat == SF_FORMAT_PCM_32)
  ------------------
  |  Branch (709:9): [True: 0, False: 0]
  |  Branch (709:42): [True: 0, False: 0]
  |  Branch (709:75): [True: 0, False: 0]
  ------------------
  710|      0|					return 1 ;
  711|       |				/* For other encodings reject any endian-ness setting. */
  712|      0|				if (endian != 0)
  ------------------
  |  Branch (712:9): [True: 0, False: 0]
  ------------------
  713|      0|					return 0 ;
  714|      0|				if (subformat == SF_FORMAT_PCM_U8 || subformat == SF_FORMAT_PCM_S8)
  ------------------
  |  Branch (714:9): [True: 0, False: 0]
  |  Branch (714:42): [True: 0, False: 0]
  ------------------
  715|      0|					return 1 ;
  716|      0|				if (subformat == SF_FORMAT_FLOAT || subformat == SF_FORMAT_DOUBLE)
  ------------------
  |  Branch (716:9): [True: 0, False: 0]
  |  Branch (716:41): [True: 0, False: 0]
  ------------------
  717|      0|					return 1 ;
  718|      0|				if (subformat == SF_FORMAT_ULAW || subformat == SF_FORMAT_ALAW)
  ------------------
  |  Branch (718:9): [True: 0, False: 0]
  |  Branch (718:40): [True: 0, False: 0]
  ------------------
  719|      0|					return 1 ;
  720|      0|				if ((subformat == SF_FORMAT_DWVW_12 || subformat == SF_FORMAT_DWVW_16 ||
  ------------------
  |  Branch (720:10): [True: 0, False: 0]
  |  Branch (720:44): [True: 0, False: 0]
  ------------------
  721|      0|							subformat == SF_FORMAT_DWVW_24) && info-> channels == 1)
  ------------------
  |  Branch (721:8): [True: 0, False: 0]
  |  Branch (721:43): [True: 0, False: 0]
  ------------------
  722|      0|					return 1 ;
  723|      0|				if (subformat == SF_FORMAT_GSM610 && info->channels == 1)
  ------------------
  |  Branch (723:9): [True: 0, False: 0]
  |  Branch (723:42): [True: 0, False: 0]
  ------------------
  724|      0|					return 1 ;
  725|      0|				if (subformat == SF_FORMAT_IMA_ADPCM && (info->channels == 1 || info->channels == 2))
  ------------------
  |  Branch (725:9): [True: 0, False: 0]
  |  Branch (725:46): [True: 0, False: 0]
  |  Branch (725:69): [True: 0, False: 0]
  ------------------
  726|      0|					return 1 ;
  727|      0|				break ;
  728|       |
  729|      0|		case SF_FORMAT_AU :
  ------------------
  |  Branch (729:3): [True: 0, False: 969]
  ------------------
  730|      0|				if (subformat == SF_FORMAT_PCM_S8 || subformat == SF_FORMAT_PCM_16)
  ------------------
  |  Branch (730:9): [True: 0, False: 0]
  |  Branch (730:42): [True: 0, False: 0]
  ------------------
  731|      0|					return 1 ;
  732|      0|				if (subformat == SF_FORMAT_PCM_24 || subformat == SF_FORMAT_PCM_32)
  ------------------
  |  Branch (732:9): [True: 0, False: 0]
  |  Branch (732:42): [True: 0, False: 0]
  ------------------
  733|      0|					return 1 ;
  734|      0|				if (subformat == SF_FORMAT_ULAW || subformat == SF_FORMAT_ALAW)
  ------------------
  |  Branch (734:9): [True: 0, False: 0]
  |  Branch (734:40): [True: 0, False: 0]
  ------------------
  735|      0|					return 1 ;
  736|      0|				if (subformat == SF_FORMAT_FLOAT || subformat == SF_FORMAT_DOUBLE)
  ------------------
  |  Branch (736:9): [True: 0, False: 0]
  |  Branch (736:41): [True: 0, False: 0]
  ------------------
  737|      0|					return 1 ;
  738|      0|				if (subformat == SF_FORMAT_G721_32 && info->channels == 1)
  ------------------
  |  Branch (738:9): [True: 0, False: 0]
  |  Branch (738:43): [True: 0, False: 0]
  ------------------
  739|      0|					return 1 ;
  740|      0|				if (subformat == SF_FORMAT_G723_24 && info->channels == 1)
  ------------------
  |  Branch (740:9): [True: 0, False: 0]
  |  Branch (740:43): [True: 0, False: 0]
  ------------------
  741|      0|					return 1 ;
  742|      0|				if (subformat == SF_FORMAT_G723_40 && info->channels == 1)
  ------------------
  |  Branch (742:9): [True: 0, False: 0]
  |  Branch (742:43): [True: 0, False: 0]
  ------------------
  743|      0|					return 1 ;
  744|      0|				break ;
  745|       |
  746|      0|		case SF_FORMAT_CAF :
  ------------------
  |  Branch (746:3): [True: 0, False: 969]
  ------------------
  747|      0|				if (subformat == SF_FORMAT_PCM_S8 || subformat == SF_FORMAT_PCM_16)
  ------------------
  |  Branch (747:9): [True: 0, False: 0]
  |  Branch (747:42): [True: 0, False: 0]
  ------------------
  748|      0|					return 1 ;
  749|      0|				if (subformat == SF_FORMAT_PCM_24 || subformat == SF_FORMAT_PCM_32)
  ------------------
  |  Branch (749:9): [True: 0, False: 0]
  |  Branch (749:42): [True: 0, False: 0]
  ------------------
  750|      0|					return 1 ;
  751|      0|				if (subformat == SF_FORMAT_ULAW || subformat == SF_FORMAT_ALAW)
  ------------------
  |  Branch (751:9): [True: 0, False: 0]
  |  Branch (751:40): [True: 0, False: 0]
  ------------------
  752|      0|					return 1 ;
  753|      0|				if (subformat == SF_FORMAT_ALAC_16 || subformat == SF_FORMAT_ALAC_20)
  ------------------
  |  Branch (753:9): [True: 0, False: 0]
  |  Branch (753:43): [True: 0, False: 0]
  ------------------
  754|      0|					return 1 ;
  755|      0|				if (subformat == SF_FORMAT_ALAC_24 || subformat == SF_FORMAT_ALAC_32)
  ------------------
  |  Branch (755:9): [True: 0, False: 0]
  |  Branch (755:43): [True: 0, False: 0]
  ------------------
  756|      0|					return 1 ;
  757|      0|				if (subformat == SF_FORMAT_FLOAT || subformat == SF_FORMAT_DOUBLE)
  ------------------
  |  Branch (757:9): [True: 0, False: 0]
  |  Branch (757:41): [True: 0, False: 0]
  ------------------
  758|      0|					return 1 ;
  759|      0|				break ;
  760|       |
  761|    969|		case SF_FORMAT_RAW :
  ------------------
  |  Branch (761:3): [True: 969, False: 0]
  ------------------
  762|    969|				if (subformat == SF_FORMAT_PCM_U8 || subformat == SF_FORMAT_PCM_S8 || subformat == SF_FORMAT_PCM_16)
  ------------------
  |  Branch (762:9): [True: 13, False: 956]
  |  Branch (762:42): [True: 0, False: 956]
  |  Branch (762:75): [True: 10, False: 946]
  ------------------
  763|     23|					return 1 ;
  764|    946|				if (subformat == SF_FORMAT_PCM_24 || subformat == SF_FORMAT_PCM_32)
  ------------------
  |  Branch (764:9): [True: 0, False: 946]
  |  Branch (764:42): [True: 0, False: 946]
  ------------------
  765|      0|					return 1 ;
  766|    946|				if (subformat == SF_FORMAT_FLOAT || subformat == SF_FORMAT_DOUBLE)
  ------------------
  |  Branch (766:9): [True: 0, False: 946]
  |  Branch (766:41): [True: 0, False: 946]
  ------------------
  767|      0|					return 1 ;
  768|    946|				if (subformat == SF_FORMAT_ALAW || subformat == SF_FORMAT_ULAW)
  ------------------
  |  Branch (768:9): [True: 12, False: 934]
  |  Branch (768:40): [True: 14, False: 920]
  ------------------
  769|     26|					return 1 ;
  770|    920|				if ((subformat == SF_FORMAT_DWVW_12 || subformat == SF_FORMAT_DWVW_16 ||
  ------------------
  |  Branch (770:10): [True: 0, False: 920]
  |  Branch (770:44): [True: 202, False: 718]
  ------------------
  771|    718|							subformat == SF_FORMAT_DWVW_24) && info-> channels == 1)
  ------------------
  |  Branch (771:8): [True: 0, False: 718]
  |  Branch (771:43): [True: 202, False: 0]
  ------------------
  772|    202|					return 1 ;
  773|    718|				if (subformat == SF_FORMAT_GSM610 && info->channels == 1)
  ------------------
  |  Branch (773:9): [True: 469, False: 249]
  |  Branch (773:42): [True: 469, False: 0]
  ------------------
  774|    469|					return 1 ;
  775|    249|				if (subformat == SF_FORMAT_VOX_ADPCM && info->channels == 1)
  ------------------
  |  Branch (775:9): [True: 249, False: 0]
  |  Branch (775:45): [True: 249, False: 0]
  ------------------
  776|    249|					return 1 ;
  777|      0|				if ((subformat == SF_FORMAT_NMS_ADPCM_16 || subformat == SF_FORMAT_NMS_ADPCM_24 ||
  ------------------
  |  Branch (777:10): [True: 0, False: 0]
  |  Branch (777:49): [True: 0, False: 0]
  ------------------
  778|      0|							subformat == SF_FORMAT_NMS_ADPCM_32) && info->channels == 1)
  ------------------
  |  Branch (778:8): [True: 0, False: 0]
  |  Branch (778:48): [True: 0, False: 0]
  ------------------
  779|      0|					return 1 ;
  780|      0|				break ;
  781|       |
  782|      0|		case SF_FORMAT_PAF :
  ------------------
  |  Branch (782:3): [True: 0, False: 969]
  ------------------
  783|      0|				if (subformat == SF_FORMAT_PCM_S8 || subformat == SF_FORMAT_PCM_16 || subformat == SF_FORMAT_PCM_24)
  ------------------
  |  Branch (783:9): [True: 0, False: 0]
  |  Branch (783:42): [True: 0, False: 0]
  |  Branch (783:75): [True: 0, False: 0]
  ------------------
  784|      0|					return 1 ;
  785|      0|				break ;
  786|       |
  787|      0|		case SF_FORMAT_SVX :
  ------------------
  |  Branch (787:3): [True: 0, False: 969]
  ------------------
  788|       |				/* SVX only supports writing mono SVX files. */
  789|      0|				if (info->channels > 1)
  ------------------
  |  Branch (789:9): [True: 0, False: 0]
  ------------------
  790|      0|					return 0 ;
  791|       |				/* Always big endian. */
  792|      0|				if (endian == SF_ENDIAN_LITTLE || endian == SF_ENDIAN_CPU)
  ------------------
  |  Branch (792:9): [True: 0, False: 0]
  |  Branch (792:39): [True: 0, False: 0]
  ------------------
  793|      0|					return 0 ;
  794|       |
  795|      0|				if (subformat == SF_FORMAT_PCM_S8 || subformat == SF_FORMAT_PCM_16)
  ------------------
  |  Branch (795:9): [True: 0, False: 0]
  |  Branch (795:42): [True: 0, False: 0]
  ------------------
  796|      0|					return 1 ;
  797|      0|				break ;
  798|       |
  799|      0|		case SF_FORMAT_NIST :
  ------------------
  |  Branch (799:3): [True: 0, False: 969]
  ------------------
  800|      0|				if (subformat == SF_FORMAT_PCM_S8 || subformat == SF_FORMAT_PCM_16)
  ------------------
  |  Branch (800:9): [True: 0, False: 0]
  |  Branch (800:42): [True: 0, False: 0]
  ------------------
  801|      0|					return 1 ;
  802|      0|				if (subformat == SF_FORMAT_PCM_24 || subformat == SF_FORMAT_PCM_32)
  ------------------
  |  Branch (802:9): [True: 0, False: 0]
  |  Branch (802:42): [True: 0, False: 0]
  ------------------
  803|      0|					return 1 ;
  804|      0|				if (subformat == SF_FORMAT_ULAW || subformat == SF_FORMAT_ALAW)
  ------------------
  |  Branch (804:9): [True: 0, False: 0]
  |  Branch (804:40): [True: 0, False: 0]
  ------------------
  805|      0|					return 1 ;
  806|      0|				break ;
  807|       |
  808|      0|		case SF_FORMAT_IRCAM :
  ------------------
  |  Branch (808:3): [True: 0, False: 969]
  ------------------
  809|      0|				if (info->channels > 256)
  ------------------
  |  Branch (809:9): [True: 0, False: 0]
  ------------------
  810|      0|					return 0 ;
  811|      0|				if (subformat == SF_FORMAT_PCM_16 || subformat == SF_FORMAT_PCM_32)
  ------------------
  |  Branch (811:9): [True: 0, False: 0]
  |  Branch (811:42): [True: 0, False: 0]
  ------------------
  812|      0|					return 1 ;
  813|      0|				if (subformat == SF_FORMAT_ULAW || subformat == SF_FORMAT_ALAW || subformat == SF_FORMAT_FLOAT)
  ------------------
  |  Branch (813:9): [True: 0, False: 0]
  |  Branch (813:40): [True: 0, False: 0]
  |  Branch (813:71): [True: 0, False: 0]
  ------------------
  814|      0|					return 1 ;
  815|      0|				break ;
  816|       |
  817|      0|		case SF_FORMAT_VOC :
  ------------------
  |  Branch (817:3): [True: 0, False: 969]
  ------------------
  818|      0|				if (info->channels > 2)
  ------------------
  |  Branch (818:9): [True: 0, False: 0]
  ------------------
  819|      0|					return 0 ;
  820|       |				/* VOC is strictly little endian. */
  821|      0|				if (endian == SF_ENDIAN_BIG || endian == SF_ENDIAN_CPU)
  ------------------
  |  Branch (821:9): [True: 0, False: 0]
  |  Branch (821:36): [True: 0, False: 0]
  ------------------
  822|      0|					return 0 ;
  823|      0|				if (subformat == SF_FORMAT_PCM_U8 || subformat == SF_FORMAT_PCM_16)
  ------------------
  |  Branch (823:9): [True: 0, False: 0]
  |  Branch (823:42): [True: 0, False: 0]
  ------------------
  824|      0|					return 1 ;
  825|      0|				if (subformat == SF_FORMAT_ULAW || subformat == SF_FORMAT_ALAW)
  ------------------
  |  Branch (825:9): [True: 0, False: 0]
  |  Branch (825:40): [True: 0, False: 0]
  ------------------
  826|      0|					return 1 ;
  827|      0|				break ;
  828|       |
  829|      0|		case SF_FORMAT_W64 :
  ------------------
  |  Branch (829:3): [True: 0, False: 969]
  ------------------
  830|       |				/* W64 is strictly little endian. */
  831|      0|				if (endian == SF_ENDIAN_BIG || endian == SF_ENDIAN_CPU)
  ------------------
  |  Branch (831:9): [True: 0, False: 0]
  |  Branch (831:36): [True: 0, False: 0]
  ------------------
  832|      0|					return 0 ;
  833|      0|				if (subformat == SF_FORMAT_PCM_U8 || subformat == SF_FORMAT_PCM_16)
  ------------------
  |  Branch (833:9): [True: 0, False: 0]
  |  Branch (833:42): [True: 0, False: 0]
  ------------------
  834|      0|					return 1 ;
  835|      0|				if (subformat == SF_FORMAT_PCM_24 || subformat == SF_FORMAT_PCM_32)
  ------------------
  |  Branch (835:9): [True: 0, False: 0]
  |  Branch (835:42): [True: 0, False: 0]
  ------------------
  836|      0|					return 1 ;
  837|      0|				if ((subformat == SF_FORMAT_IMA_ADPCM || subformat == SF_FORMAT_MS_ADPCM) && info->channels <= 2)
  ------------------
  |  Branch (837:10): [True: 0, False: 0]
  |  Branch (837:46): [True: 0, False: 0]
  |  Branch (837:82): [True: 0, False: 0]
  ------------------
  838|      0|					return 1 ;
  839|      0|				if (subformat == SF_FORMAT_GSM610 && info->channels == 1)
  ------------------
  |  Branch (839:9): [True: 0, False: 0]
  |  Branch (839:42): [True: 0, False: 0]
  ------------------
  840|      0|					return 1 ;
  841|      0|				if (subformat == SF_FORMAT_ULAW || subformat == SF_FORMAT_ALAW)
  ------------------
  |  Branch (841:9): [True: 0, False: 0]
  |  Branch (841:40): [True: 0, False: 0]
  ------------------
  842|      0|					return 1 ;
  843|      0|				if (subformat == SF_FORMAT_FLOAT || subformat == SF_FORMAT_DOUBLE)
  ------------------
  |  Branch (843:9): [True: 0, False: 0]
  |  Branch (843:41): [True: 0, False: 0]
  ------------------
  844|      0|					return 1 ;
  845|      0|				break ;
  846|       |
  847|      0|		case SF_FORMAT_MAT4 :
  ------------------
  |  Branch (847:3): [True: 0, False: 969]
  ------------------
  848|      0|				if (subformat == SF_FORMAT_PCM_16 || subformat == SF_FORMAT_PCM_32)
  ------------------
  |  Branch (848:9): [True: 0, False: 0]
  |  Branch (848:42): [True: 0, False: 0]
  ------------------
  849|      0|					return 1 ;
  850|      0|				if (subformat == SF_FORMAT_FLOAT || subformat == SF_FORMAT_DOUBLE)
  ------------------
  |  Branch (850:9): [True: 0, False: 0]
  |  Branch (850:41): [True: 0, False: 0]
  ------------------
  851|      0|					return 1 ;
  852|      0|				break ;
  853|       |
  854|      0|		case SF_FORMAT_MAT5 :
  ------------------
  |  Branch (854:3): [True: 0, False: 969]
  ------------------
  855|      0|				if (subformat == SF_FORMAT_PCM_U8 || subformat == SF_FORMAT_PCM_16 || subformat == SF_FORMAT_PCM_32)
  ------------------
  |  Branch (855:9): [True: 0, False: 0]
  |  Branch (855:42): [True: 0, False: 0]
  |  Branch (855:75): [True: 0, False: 0]
  ------------------
  856|      0|					return 1 ;
  857|      0|				if (subformat == SF_FORMAT_FLOAT || subformat == SF_FORMAT_DOUBLE)
  ------------------
  |  Branch (857:9): [True: 0, False: 0]
  |  Branch (857:41): [True: 0, False: 0]
  ------------------
  858|      0|					return 1 ;
  859|      0|				break ;
  860|       |
  861|      0|		case SF_FORMAT_PVF :
  ------------------
  |  Branch (861:3): [True: 0, False: 969]
  ------------------
  862|      0|				if (subformat == SF_FORMAT_PCM_S8 || subformat == SF_FORMAT_PCM_16 || subformat == SF_FORMAT_PCM_32)
  ------------------
  |  Branch (862:9): [True: 0, False: 0]
  |  Branch (862:42): [True: 0, False: 0]
  |  Branch (862:75): [True: 0, False: 0]
  ------------------
  863|      0|					return 1 ;
  864|      0|				break ;
  865|       |
  866|      0|		case SF_FORMAT_XI :
  ------------------
  |  Branch (866:3): [True: 0, False: 969]
  ------------------
  867|      0|				if (info->channels != 1)
  ------------------
  |  Branch (867:9): [True: 0, False: 0]
  ------------------
  868|      0|					return 0 ;
  869|      0|				if (subformat == SF_FORMAT_DPCM_8 || subformat == SF_FORMAT_DPCM_16)
  ------------------
  |  Branch (869:9): [True: 0, False: 0]
  |  Branch (869:42): [True: 0, False: 0]
  ------------------
  870|      0|					return 1 ;
  871|      0|				break ;
  872|       |
  873|      0|		case SF_FORMAT_HTK :
  ------------------
  |  Branch (873:3): [True: 0, False: 969]
  ------------------
  874|      0|				if (info->channels != 1)
  ------------------
  |  Branch (874:9): [True: 0, False: 0]
  ------------------
  875|      0|					return 0 ;
  876|       |				/* HTK is strictly big endian. */
  877|      0|				if (endian == SF_ENDIAN_LITTLE || endian == SF_ENDIAN_CPU)
  ------------------
  |  Branch (877:9): [True: 0, False: 0]
  |  Branch (877:39): [True: 0, False: 0]
  ------------------
  878|      0|					return 0 ;
  879|      0|				if (subformat == SF_FORMAT_PCM_16)
  ------------------
  |  Branch (879:9): [True: 0, False: 0]
  ------------------
  880|      0|					return 1 ;
  881|      0|				break ;
  882|       |
  883|      0|		case SF_FORMAT_SDS :
  ------------------
  |  Branch (883:3): [True: 0, False: 969]
  ------------------
  884|      0|				if (info->channels != 1)
  ------------------
  |  Branch (884:9): [True: 0, False: 0]
  ------------------
  885|      0|					return 0 ;
  886|       |				/* SDS is strictly big endian. */
  887|      0|				if (endian == SF_ENDIAN_LITTLE || endian == SF_ENDIAN_CPU)
  ------------------
  |  Branch (887:9): [True: 0, False: 0]
  |  Branch (887:39): [True: 0, False: 0]
  ------------------
  888|      0|					return 0 ;
  889|      0|				if (subformat == SF_FORMAT_PCM_S8 || subformat == SF_FORMAT_PCM_16 || subformat == SF_FORMAT_PCM_24)
  ------------------
  |  Branch (889:9): [True: 0, False: 0]
  |  Branch (889:42): [True: 0, False: 0]
  |  Branch (889:75): [True: 0, False: 0]
  ------------------
  890|      0|					return 1 ;
  891|      0|				break ;
  892|       |
  893|      0|		case SF_FORMAT_AVR :
  ------------------
  |  Branch (893:3): [True: 0, False: 969]
  ------------------
  894|      0|				if (info->channels > 2)
  ------------------
  |  Branch (894:9): [True: 0, False: 0]
  ------------------
  895|      0|					return 0 ;
  896|       |				/* SDS is strictly big endian. */
  897|      0|				if (endian == SF_ENDIAN_LITTLE || endian == SF_ENDIAN_CPU)
  ------------------
  |  Branch (897:9): [True: 0, False: 0]
  |  Branch (897:39): [True: 0, False: 0]
  ------------------
  898|      0|					return 0 ;
  899|      0|				if (subformat == SF_FORMAT_PCM_U8 || subformat == SF_FORMAT_PCM_S8 || subformat == SF_FORMAT_PCM_16)
  ------------------
  |  Branch (899:9): [True: 0, False: 0]
  |  Branch (899:42): [True: 0, False: 0]
  |  Branch (899:75): [True: 0, False: 0]
  ------------------
  900|      0|					return 1 ;
  901|      0|				break ;
  902|       |
  903|      0|		case SF_FORMAT_FLAC :
  ------------------
  |  Branch (903:3): [True: 0, False: 969]
  ------------------
  904|       |				/* FLAC can't do more than 8 channels. */
  905|      0|				if (info->channels > 8)
  ------------------
  |  Branch (905:9): [True: 0, False: 0]
  ------------------
  906|      0|					return 0 ;
  907|      0|				if (endian != SF_ENDIAN_FILE)
  ------------------
  |  Branch (907:9): [True: 0, False: 0]
  ------------------
  908|      0|					return 0 ;
  909|      0|				if (subformat == SF_FORMAT_PCM_S8 || subformat == SF_FORMAT_PCM_16 || subformat == SF_FORMAT_PCM_24)
  ------------------
  |  Branch (909:9): [True: 0, False: 0]
  |  Branch (909:42): [True: 0, False: 0]
  |  Branch (909:75): [True: 0, False: 0]
  ------------------
  910|      0|					return 1 ;
  911|      0|				if (subformat == SF_FORMAT_PCM_32 && flac_supports_pcm32 ())
  ------------------
  |  Branch (911:9): [True: 0, False: 0]
  |  Branch (911:42): [True: 0, False: 0]
  ------------------
  912|      0|					return 1 ;
  913|      0|				break ;
  914|       |
  915|      0|		case SF_FORMAT_SD2 :
  ------------------
  |  Branch (915:3): [True: 0, False: 969]
  ------------------
  916|       |				/* SD2 is strictly big endian. */
  917|      0|				if (endian == SF_ENDIAN_LITTLE || endian == SF_ENDIAN_CPU)
  ------------------
  |  Branch (917:9): [True: 0, False: 0]
  |  Branch (917:39): [True: 0, False: 0]
  ------------------
  918|      0|					return 0 ;
  919|      0|				if (subformat == SF_FORMAT_PCM_S8 || subformat == SF_FORMAT_PCM_16 || subformat == SF_FORMAT_PCM_24 || subformat == SF_FORMAT_PCM_32)
  ------------------
  |  Branch (919:9): [True: 0, False: 0]
  |  Branch (919:42): [True: 0, False: 0]
  |  Branch (919:75): [True: 0, False: 0]
  |  Branch (919:108): [True: 0, False: 0]
  ------------------
  920|      0|					return 1 ;
  921|      0|				break ;
  922|       |
  923|      0|		case SF_FORMAT_WVE :
  ------------------
  |  Branch (923:3): [True: 0, False: 969]
  ------------------
  924|      0|				if (info->channels > 1)
  ------------------
  |  Branch (924:9): [True: 0, False: 0]
  ------------------
  925|      0|					return 0 ;
  926|       |				/* WVE is strictly big endian. */
  927|      0|				if (endian == SF_ENDIAN_BIG || endian == SF_ENDIAN_CPU)
  ------------------
  |  Branch (927:9): [True: 0, False: 0]
  |  Branch (927:36): [True: 0, False: 0]
  ------------------
  928|      0|					return 0 ;
  929|      0|				if (subformat == SF_FORMAT_ALAW)
  ------------------
  |  Branch (929:9): [True: 0, False: 0]
  ------------------
  930|      0|					return 1 ;
  931|      0|				break ;
  932|       |
  933|      0|		case SF_FORMAT_OGG :
  ------------------
  |  Branch (933:3): [True: 0, False: 969]
  ------------------
  934|      0|				if (endian != SF_ENDIAN_FILE)
  ------------------
  |  Branch (934:9): [True: 0, False: 0]
  ------------------
  935|      0|					return 0 ;
  936|      0|				if (subformat == SF_FORMAT_VORBIS)
  ------------------
  |  Branch (936:9): [True: 0, False: 0]
  ------------------
  937|      0|					return 1 ;
  938|      0|				if (subformat == SF_FORMAT_OPUS)
  ------------------
  |  Branch (938:9): [True: 0, False: 0]
  ------------------
  939|      0|					return 1 ;
  940|      0|				break ;
  941|       |
  942|      0|		case SF_FORMAT_MPC2K :
  ------------------
  |  Branch (942:3): [True: 0, False: 969]
  ------------------
  943|      0|				if (info->channels > 2)
  ------------------
  |  Branch (943:9): [True: 0, False: 0]
  ------------------
  944|      0|					return 0 ;
  945|       |				/* MPC2000 is strictly little endian. */
  946|      0|				if (endian == SF_ENDIAN_BIG || endian == SF_ENDIAN_CPU)
  ------------------
  |  Branch (946:9): [True: 0, False: 0]
  |  Branch (946:36): [True: 0, False: 0]
  ------------------
  947|      0|					return 0 ;
  948|      0|				if (subformat == SF_FORMAT_PCM_16)
  ------------------
  |  Branch (948:9): [True: 0, False: 0]
  ------------------
  949|      0|					return 1 ;
  950|      0|				break ;
  951|       |
  952|      0|		case SF_FORMAT_RF64 :
  ------------------
  |  Branch (952:3): [True: 0, False: 969]
  ------------------
  953|      0|				if (endian == SF_ENDIAN_BIG || endian == SF_ENDIAN_CPU)
  ------------------
  |  Branch (953:9): [True: 0, False: 0]
  |  Branch (953:36): [True: 0, False: 0]
  ------------------
  954|      0|					return 0 ;
  955|      0|				if (subformat == SF_FORMAT_PCM_U8 || subformat == SF_FORMAT_PCM_16)
  ------------------
  |  Branch (955:9): [True: 0, False: 0]
  |  Branch (955:42): [True: 0, False: 0]
  ------------------
  956|      0|					return 1 ;
  957|      0|				if (subformat == SF_FORMAT_PCM_24 || subformat == SF_FORMAT_PCM_32)
  ------------------
  |  Branch (957:9): [True: 0, False: 0]
  |  Branch (957:42): [True: 0, False: 0]
  ------------------
  958|      0|					return 1 ;
  959|      0|				if (subformat == SF_FORMAT_ULAW || subformat == SF_FORMAT_ALAW)
  ------------------
  |  Branch (959:9): [True: 0, False: 0]
  |  Branch (959:40): [True: 0, False: 0]
  ------------------
  960|      0|					return 1 ;
  961|      0|				if (subformat == SF_FORMAT_FLOAT || subformat == SF_FORMAT_DOUBLE)
  ------------------
  |  Branch (961:9): [True: 0, False: 0]
  |  Branch (961:41): [True: 0, False: 0]
  ------------------
  962|      0|					return 1 ;
  963|      0|				break ;
  964|       |
  965|      0|		case SF_FORMAT_MPEG :
  ------------------
  |  Branch (965:3): [True: 0, False: 969]
  ------------------
  966|      0|				if (info->channels > 2)
  ------------------
  |  Branch (966:9): [True: 0, False: 0]
  ------------------
  967|      0|					return 0 ;
  968|      0|				if (endian != SF_ENDIAN_FILE)
  ------------------
  |  Branch (968:9): [True: 0, False: 0]
  ------------------
  969|      0|					return 0 ;
  970|      0|				if (subformat == SF_FORMAT_MPEG_LAYER_I || subformat == SF_FORMAT_MPEG_LAYER_II || subformat == SF_FORMAT_MPEG_LAYER_III)
  ------------------
  |  Branch (970:9): [True: 0, False: 0]
  |  Branch (970:48): [True: 0, False: 0]
  |  Branch (970:88): [True: 0, False: 0]
  ------------------
  971|      0|					return 1 ;
  972|      0|				break ;
  973|      0|		default : break ;
  ------------------
  |  Branch (973:3): [True: 0, False: 969]
  ------------------
  974|    969|		} ;
  975|       |
  976|      0|	return 0 ;
  977|    969|} /* sf_format_check */
sf_readf_short:
 1810|   103M|{	SF_PRIVATE 	*psf ;
 1811|   103M|	sf_count_t	count, extra ;
 1812|       |
 1813|   103M|	if (frames == 0)
  ------------------
  |  Branch (1813:6): [True: 0, False: 103M]
  ------------------
 1814|      0|		return 0 ;
 1815|       |
 1816|   413M|	VALIDATE_SNDFILE_AND_ASSIGN_PSF (sndfile, psf, 1) ;
  ------------------
  |  |  326|   103M|		{	if ((a) == NULL)						\
  |  |  ------------------
  |  |  |  Branch (326:9): [True: 0, False: 103M]
  |  |  ------------------
  |  |  327|   103M|			{	sf_errno = SFE_BAD_SNDFILE_PTR ;	\
  |  |  328|      0|				return 0 ;							\
  |  |  329|   103M|				} ;									\
  |  |  330|   103M|			(b) = (SF_PRIVATE*) (a) ;				\
  |  |  331|   103M|			if ((b)->virtual_io == SF_FALSE &&		\
  |  |  ------------------
  |  |  |  Branch (331:8): [True: 0, False: 103M]
  |  |  ------------------
  |  |  332|   103M|				psf_file_valid (b) == 0)			\
  |  |  ------------------
  |  |  |  Branch (332:5): [True: 0, False: 0]
  |  |  ------------------
  |  |  333|   103M|			{	(b)->error = SFE_BAD_FILE_PTR ;		\
  |  |  334|      0|				return 0 ;							\
  |  |  335|   103M|				} ;									\
  |  |  336|   103M|			if ((b)->Magick != SNDFILE_MAGICK)		\
  |  |  ------------------
  |  |  |  |   41|   103M|#define		SNDFILE_MAGICK	0x1234C0DE
  |  |  ------------------
  |  |  |  Branch (336:8): [True: 0, False: 103M]
  |  |  ------------------
  |  |  337|   103M|			{	(b)->error = SFE_BAD_SNDFILE_PTR ;	\
  |  |  338|      0|				return 0 ;							\
  |  |  339|   103M|				} ;									\
  |  |  340|   103M|			if (c) (b)->error = 0 ;					\
  |  |  ------------------
  |  |  |  Branch (340:8): [True: 103M, Folded]
  |  |  ------------------
  |  |  341|   103M|			}
  ------------------
 1817|       |
 1818|   413M|	if (frames <= 0)
  ------------------
  |  Branch (1818:6): [True: 0, False: 103M]
  ------------------
 1819|      0|	{	psf->error = SFE_NEGATIVE_RW_LEN ;
 1820|      0|		return 0 ;
 1821|   103M|		} ;
 1822|       |
 1823|   103M|	if (psf->file.mode == SFM_WRITE)
  ------------------
  |  Branch (1823:6): [True: 0, False: 103M]
  ------------------
 1824|      0|	{	psf->error = SFE_NOT_READMODE ;
 1825|      0|		return 0 ;
 1826|   103M|		} ;
 1827|       |
 1828|   103M|	if (psf->read_current >= psf->sf.frames)
  ------------------
  |  Branch (1828:6): [True: 2.15k, False: 103M]
  ------------------
 1829|  2.15k|	{	psf_memset (ptr, 0, frames * psf->sf.channels * sizeof (short)) ;
 1830|  2.15k|		return 0 ; /* End of file. */
 1831|   103M|		} ;
 1832|       |
 1833|   103M|	if (psf->read_short == NULL || psf->seek == NULL)
  ------------------
  |  Branch (1833:6): [True: 1, False: 103M]
  |  Branch (1833:33): [True: 0, False: 103M]
  ------------------
 1834|      1|	{	psf->error = SFE_UNIMPLEMENTED ;
 1835|      1|		return 0 ;
 1836|   103M|		} ;
 1837|       |
 1838|   103M|	if (psf->last_op != SFM_READ)
  ------------------
  |  Branch (1838:6): [True: 65, False: 103M]
  ------------------
 1839|     65|		if (psf->seek (psf, SFM_READ, psf->read_current) < 0)
  ------------------
  |  Branch (1839:7): [True: 0, False: 65]
  ------------------
 1840|      0|			return 0 ;
 1841|       |
 1842|   103M|	count = psf->read_short (psf, ptr, frames * psf->sf.channels) ;
 1843|       |
 1844|   103M|	if (psf->read_current + count / psf->sf.channels <= psf->sf.frames)
  ------------------
  |  Branch (1844:6): [True: 103M, False: 0]
  ------------------
 1845|   103M|		psf->read_current += count / psf->sf.channels ;
 1846|      0|	else
 1847|      0|	{	count = (psf->sf.frames - psf->read_current) * psf->sf.channels ;
 1848|      0|		extra = frames * psf->sf.channels - count ;
 1849|      0|		psf_memset (ptr + count, 0, extra * sizeof (short)) ;
 1850|      0|		psf->read_current = psf->sf.frames ;
 1851|      0|		} ;
 1852|       |
 1853|   103M|	psf->last_op = SFM_READ ;
 1854|       |
 1855|   103M|	return count / psf->sf.channels ;
 1856|   103M|} /* sf_readf_short */
psf_open_file:
 3016|  19.8k|{	int		error, format ;
 3017|       |
 3018|  19.8k|	sf_errno = error = 0 ;
 3019|  19.8k|	sf_parselog [0] = 0 ;
 3020|       |
 3021|  19.8k|	if (psf->error)
  ------------------
  |  Branch (3021:6): [True: 0, False: 19.8k]
  ------------------
 3022|      0|	{	error = psf->error ;
 3023|      0|		goto error_exit ;
 3024|  19.8k|		} ;
 3025|       |
 3026|  19.8k|	if (psf->file.mode != SFM_READ && psf->file.mode != SFM_WRITE && psf->file.mode != SFM_RDWR)
  ------------------
  |  Branch (3026:6): [True: 0, False: 19.8k]
  |  Branch (3026:36): [True: 0, False: 0]
  |  Branch (3026:67): [True: 0, False: 0]
  ------------------
 3027|      0|	{	error = SFE_BAD_OPEN_MODE ;
 3028|      0|		goto error_exit ;
 3029|  19.8k|		} ;
 3030|       |
 3031|  19.8k|	if (sfinfo == NULL)
  ------------------
  |  Branch (3031:6): [True: 0, False: 19.8k]
  ------------------
 3032|      0|	{	error = SFE_BAD_SF_INFO_PTR ;
 3033|      0|		goto error_exit ;
 3034|  19.8k|		} ;
 3035|       |
 3036|  19.8k|	if (psf->file.mode == SFM_READ)
  ------------------
  |  Branch (3036:6): [True: 19.8k, False: 0]
  ------------------
 3037|  19.8k|	{	if ((SF_CONTAINER (sfinfo->format)) == SF_FORMAT_RAW)
  ------------------
  |  |  101|  19.8k|#define SF_CONTAINER(x)		((x) & SF_FORMAT_TYPEMASK)
  ------------------
  |  Branch (3037:8): [True: 969, False: 18.8k]
  ------------------
 3038|    969|		{	if (sf_format_check (sfinfo) == 0)
  ------------------
  |  Branch (3038:9): [True: 0, False: 969]
  ------------------
 3039|      0|			{	error = SFE_RAW_BAD_FORMAT ;
 3040|      0|				goto error_exit ;
 3041|    969|				} ;
 3042|    969|			}
 3043|  18.8k|		else
 3044|  18.8k|			memset (sfinfo, 0, sizeof (SF_INFO)) ;
 3045|  19.8k|		} ;
 3046|       |
 3047|  19.8k|	memcpy (&psf->sf, sfinfo, sizeof (SF_INFO)) ;
 3048|       |
 3049|  19.8k|	psf->Magick 		= SNDFILE_MAGICK ;
  ------------------
  |  |   41|  19.8k|#define		SNDFILE_MAGICK	0x1234C0DE
  ------------------
 3050|  19.8k|	psf->norm_float 	= SF_TRUE ;
 3051|  19.8k|	psf->norm_double	= SF_TRUE ;
 3052|  19.8k|	psf->dataoffset		= -1 ;
 3053|  19.8k|	psf->datalength		= -1 ;
 3054|  19.8k|	psf->read_current	= -1 ;
 3055|  19.8k|	psf->write_current	= -1 ;
 3056|  19.8k|	psf->auto_header 	= SF_FALSE ;
 3057|  19.8k|	psf->rwf_endian		= SF_ENDIAN_LITTLE ;
 3058|  19.8k|	psf->seek			= psf_default_seek ;
 3059|  19.8k|	psf->float_int_mult = 0 ;
 3060|  19.8k|	psf->float_max		= -1.0 ;
 3061|       |
 3062|       |	/* An attempt at a per SF_PRIVATE unique id. */
 3063|  19.8k|	psf->unique_id		= psf_rand_int32 () ;
 3064|       |
 3065|  19.8k|	psf->sf.sections = 1 ;
 3066|       |
 3067|  19.8k|	psf->is_pipe = psf_is_pipe (psf) ;
 3068|       |
 3069|  19.8k|	if (psf->is_pipe)
  ------------------
  |  Branch (3069:6): [True: 0, False: 19.8k]
  ------------------
 3070|      0|	{	psf->sf.seekable = SF_FALSE ;
 3071|      0|		psf->filelength = SF_COUNT_MAX ;
  ------------------
  |  |  371|      0|#define SF_COUNT_MAX	INT64_MAX
  ------------------
 3072|      0|		}
 3073|  19.8k|	else
 3074|  19.8k|	{	psf->sf.seekable = SF_TRUE ;
 3075|       |
 3076|       |		/* File is open, so get the length. */
 3077|  19.8k|		psf->filelength = psf_get_filelen (psf) ;
 3078|  19.8k|		} ;
 3079|       |
 3080|  19.8k|	if (psf->fileoffset > 0)
  ------------------
  |  Branch (3080:6): [True: 0, False: 19.8k]
  ------------------
 3081|      0|	{	switch (psf->file.mode)
  ------------------
  |  Branch (3081:12): [True: 0, False: 0]
  ------------------
 3082|      0|		{	case SFM_READ :
  ------------------
  |  Branch (3082:5): [True: 0, False: 0]
  ------------------
 3083|      0|				if (psf->filelength < 44)
  ------------------
  |  Branch (3083:9): [True: 0, False: 0]
  ------------------
 3084|      0|				{	psf_log_printf (psf, "Short filelength: %D (fileoffset: %D)\n", psf->filelength, psf->fileoffset) ;
 3085|      0|					error = SFE_BAD_OFFSET ;
 3086|      0|					goto error_exit ;
 3087|      0|					} ;
 3088|      0|				break ;
 3089|       |
 3090|      0|			case SFM_WRITE :
  ------------------
  |  Branch (3090:4): [True: 0, False: 0]
  ------------------
 3091|      0|				psf->fileoffset = 0 ;
 3092|      0|				psf_fseek (psf, 0, SEEK_END) ;
 3093|      0|				psf->fileoffset = psf_ftell (psf) ;
 3094|      0|				break ;
 3095|       |
 3096|      0|			case SFM_RDWR :
  ------------------
  |  Branch (3096:4): [True: 0, False: 0]
  ------------------
 3097|      0|				error = SFE_NO_EMBEDDED_RDWR ;
 3098|      0|				goto error_exit ;
 3099|      0|			} ;
 3100|       |
 3101|      0|		psf_log_printf (psf, "Embedded file offset : %D\n", psf->fileoffset) ;
 3102|  19.8k|		} ;
 3103|       |
 3104|  19.8k|	if (psf->filelength == SF_COUNT_MAX)
  ------------------
  |  |  371|  19.8k|#define SF_COUNT_MAX	INT64_MAX
  ------------------
  |  Branch (3104:6): [True: 0, False: 19.8k]
  ------------------
 3105|      0|		psf_log_printf (psf, "Length : unknown\n") ;
 3106|  19.8k|	else
 3107|  19.8k|		psf_log_printf (psf, "Length : %D\n", psf->filelength) ;
 3108|       |
 3109|  19.8k|	if (psf->file.mode == SFM_WRITE || (psf->file.mode == SFM_RDWR && psf->filelength == 0))
  ------------------
  |  Branch (3109:6): [True: 0, False: 19.8k]
  |  Branch (3109:38): [True: 0, False: 19.8k]
  |  Branch (3109:68): [True: 0, False: 0]
  ------------------
 3110|      0|	{	/* If the file is being opened for write or RDWR and the file is currently
 3111|       |		** empty, then the SF_INFO struct must contain valid data.
 3112|       |		*/
 3113|      0|		if ((SF_CONTAINER (psf->sf.format)) == 0)
  ------------------
  |  |  101|      0|#define SF_CONTAINER(x)		((x) & SF_FORMAT_TYPEMASK)
  ------------------
  |  Branch (3113:7): [True: 0, False: 0]
  ------------------
 3114|      0|		{	error = SFE_ZERO_MAJOR_FORMAT ;
 3115|      0|			goto error_exit ;
 3116|      0|			} ;
 3117|      0|		if ((SF_CODEC (psf->sf.format)) == 0)
  ------------------
  |  |  102|      0|#define SF_CODEC(x)			((x) & SF_FORMAT_SUBMASK)
  ------------------
  |  Branch (3117:7): [True: 0, False: 0]
  ------------------
 3118|      0|		{	error = SFE_ZERO_MINOR_FORMAT ;
 3119|      0|			goto error_exit ;
 3120|      0|			} ;
 3121|       |
 3122|      0|		if (sf_format_check (&psf->sf) == 0)
  ------------------
  |  Branch (3122:7): [True: 0, False: 0]
  ------------------
 3123|      0|		{	error = SFE_BAD_OPEN_FORMAT ;
 3124|      0|			goto error_exit ;
 3125|      0|			} ;
 3126|       |
 3127|       |		/* Header writers divide by the sample rate (htk.c, sds.c, voc.c). */
 3128|      0|		if (psf->sf.samplerate < 1)
  ------------------
  |  Branch (3128:7): [True: 0, False: 0]
  ------------------
 3129|      0|		{	error = SFE_BAD_SF_INFO ;
 3130|      0|			goto error_exit ;
 3131|      0|			} ;
 3132|      0|		}
 3133|  19.8k|	else if ((SF_CONTAINER (psf->sf.format)) != SF_FORMAT_RAW)
  ------------------
  |  |  101|  19.8k|#define SF_CONTAINER(x)		((x) & SF_FORMAT_TYPEMASK)
  ------------------
  |  Branch (3133:11): [True: 18.8k, False: 969]
  ------------------
 3134|  18.8k|	{	/* If type RAW has not been specified then need to figure out file type. */
 3135|  18.8k|		psf->sf.format = guess_file_type (psf) ;
 3136|       |
 3137|  18.8k|		if (psf->sf.format == 0)
  ------------------
  |  Branch (3137:7): [True: 1.80k, False: 17.0k]
  ------------------
 3138|  1.80k|			psf->sf.format = format_from_extension (psf) ;
 3139|  19.8k|		} ;
 3140|       |
 3141|       |	/* Prevent unnecessary seeks */
 3142|  19.8k|	psf->last_op = psf->file.mode ;
 3143|       |
 3144|       |	/* Set bytewidth if known. */
 3145|  19.8k|	switch (SF_CODEC (psf->sf.format))
  ------------------
  |  |  102|  19.8k|#define SF_CODEC(x)			((x) & SF_FORMAT_SUBMASK)
  |  |  ------------------
  |  |  |  Branch (102:23): [True: 49, False: 19.7k]
  |  |  ------------------
  ------------------
 3146|  19.8k|	{	case SF_FORMAT_PCM_S8 :
  ------------------
  |  Branch (3146:4): [True: 0, False: 19.8k]
  ------------------
 3147|     13|		case SF_FORMAT_PCM_U8 :
  ------------------
  |  Branch (3147:3): [True: 13, False: 19.7k]
  ------------------
 3148|     27|		case SF_FORMAT_ULAW :
  ------------------
  |  Branch (3148:3): [True: 14, False: 19.7k]
  ------------------
 3149|     39|		case SF_FORMAT_ALAW :
  ------------------
  |  Branch (3149:3): [True: 12, False: 19.7k]
  ------------------
 3150|     39|		case SF_FORMAT_DPCM_8 :
  ------------------
  |  Branch (3150:3): [True: 0, False: 19.8k]
  ------------------
 3151|     39|				psf->bytewidth = 1 ;
 3152|     39|				break ;
 3153|       |
 3154|     10|		case SF_FORMAT_PCM_16 :
  ------------------
  |  Branch (3154:3): [True: 10, False: 19.7k]
  ------------------
 3155|     10|		case SF_FORMAT_DPCM_16 :
  ------------------
  |  Branch (3155:3): [True: 0, False: 19.8k]
  ------------------
 3156|     10|				psf->bytewidth = 2 ;
 3157|     10|				break ;
 3158|       |
 3159|      0|		case SF_FORMAT_PCM_24 :
  ------------------
  |  Branch (3159:3): [True: 0, False: 19.8k]
  ------------------
 3160|      0|				psf->bytewidth = 3 ;
 3161|      0|				break ;
 3162|       |
 3163|      0|		case SF_FORMAT_PCM_32 :
  ------------------
  |  Branch (3163:3): [True: 0, False: 19.8k]
  ------------------
 3164|      0|		case SF_FORMAT_FLOAT :
  ------------------
  |  Branch (3164:3): [True: 0, False: 19.8k]
  ------------------
 3165|      0|				psf->bytewidth = 4 ;
 3166|      0|				break ;
 3167|       |
 3168|      0|		case SF_FORMAT_DOUBLE :
  ------------------
  |  Branch (3168:3): [True: 0, False: 19.8k]
  ------------------
 3169|      0|				psf->bytewidth = 8 ;
 3170|      0|				break ;
 3171|  19.8k|		} ;
 3172|       |
 3173|       |	/* Call the initialisation function for the relevant file type. */
 3174|  19.8k|	switch (SF_CONTAINER (psf->sf.format))
  ------------------
  |  |  101|  19.8k|#define SF_CONTAINER(x)		((x) & SF_FORMAT_TYPEMASK)
  ------------------
 3175|  19.8k|	{	case	SF_FORMAT_WAV :
  ------------------
  |  Branch (3175:4): [True: 3.90k, False: 15.9k]
  ------------------
 3176|  3.90k|		case	SF_FORMAT_WAVEX :
  ------------------
  |  Branch (3176:3): [True: 0, False: 19.8k]
  ------------------
 3177|  3.90k|				error = wav_open (psf) ;
 3178|  3.90k|				break ;
 3179|       |
 3180|  2.82k|		case	SF_FORMAT_AIFF :
  ------------------
  |  Branch (3180:3): [True: 2.82k, False: 16.9k]
  ------------------
 3181|  2.82k|				error = aiff_open (psf) ;
 3182|  2.82k|				break ;
 3183|       |
 3184|  1.43k|		case	SF_FORMAT_AU :
  ------------------
  |  Branch (3184:3): [True: 1.43k, False: 18.3k]
  ------------------
 3185|  1.43k|				error = au_open (psf) ;
 3186|  1.43k|				break ;
 3187|       |
 3188|    969|		case	SF_FORMAT_RAW :
  ------------------
  |  Branch (3188:3): [True: 969, False: 18.8k]
  ------------------
 3189|    969|				error = raw_open (psf) ;
 3190|    969|				break ;
 3191|       |
 3192|    615|		case	SF_FORMAT_W64 :
  ------------------
  |  Branch (3192:3): [True: 615, False: 19.1k]
  ------------------
 3193|    615|				error = w64_open (psf) ;
 3194|    615|				break ;
 3195|       |
 3196|  2.08k|		case	SF_FORMAT_RF64 :
  ------------------
  |  Branch (3196:3): [True: 2.08k, False: 17.7k]
  ------------------
 3197|  2.08k|				error = rf64_open (psf) ;
 3198|  2.08k|				break ;
 3199|       |
 3200|       |		/* Lite remove start */
 3201|    142|		case	SF_FORMAT_PAF :
  ------------------
  |  Branch (3201:3): [True: 142, False: 19.6k]
  ------------------
 3202|    142|				error = paf_open (psf) ;
 3203|    142|				break ;
 3204|       |
 3205|    586|		case	SF_FORMAT_SVX :
  ------------------
  |  Branch (3205:3): [True: 586, False: 19.2k]
  ------------------
 3206|    586|				error = svx_open (psf) ;
 3207|    586|				break ;
 3208|       |
 3209|    214|		case	SF_FORMAT_NIST :
  ------------------
  |  Branch (3209:3): [True: 214, False: 19.5k]
  ------------------
 3210|    214|				error = nist_open (psf) ;
 3211|    214|				break ;
 3212|       |
 3213|    377|		case	SF_FORMAT_IRCAM :
  ------------------
  |  Branch (3213:3): [True: 377, False: 19.4k]
  ------------------
 3214|    377|				error = ircam_open (psf) ;
 3215|    377|				break ;
 3216|       |
 3217|    295|		case	SF_FORMAT_VOC :
  ------------------
  |  Branch (3217:3): [True: 295, False: 19.5k]
  ------------------
 3218|    295|				error = voc_open (psf) ;
 3219|    295|				break ;
 3220|       |
 3221|    350|		case	SF_FORMAT_SDS :
  ------------------
  |  Branch (3221:3): [True: 350, False: 19.4k]
  ------------------
 3222|    350|				error = sds_open (psf) ;
 3223|    350|				break ;
 3224|       |
 3225|      1|		case	SF_FORMAT_OGG :
  ------------------
  |  Branch (3225:3): [True: 1, False: 19.8k]
  ------------------
 3226|      1|				error = ogg_open (psf) ;
 3227|      1|				break ;
 3228|       |
 3229|      2|		case	SF_FORMAT_TXW :
  ------------------
  |  Branch (3229:3): [True: 2, False: 19.8k]
  ------------------
 3230|      2|				error = txw_open (psf) ;
 3231|      2|				break ;
 3232|       |
 3233|    114|		case	SF_FORMAT_WVE :
  ------------------
  |  Branch (3233:3): [True: 114, False: 19.6k]
  ------------------
 3234|    114|				error = wve_open (psf) ;
 3235|    114|				break ;
 3236|       |
 3237|      1|		case	SF_FORMAT_DWD :
  ------------------
  |  Branch (3237:3): [True: 1, False: 19.8k]
  ------------------
 3238|      1|				error = dwd_open (psf) ;
 3239|      1|				break ;
 3240|       |
 3241|    594|		case	SF_FORMAT_MAT4 :
  ------------------
  |  Branch (3241:3): [True: 594, False: 19.2k]
  ------------------
 3242|    594|				error = mat4_open (psf) ;
 3243|    594|				break ;
 3244|       |
 3245|    409|		case	SF_FORMAT_MAT5 :
  ------------------
  |  Branch (3245:3): [True: 409, False: 19.3k]
  ------------------
 3246|    409|				error = mat5_open (psf) ;
 3247|    409|				break ;
 3248|       |
 3249|    136|		case	SF_FORMAT_PVF :
  ------------------
  |  Branch (3249:3): [True: 136, False: 19.6k]
  ------------------
 3250|    136|				error = pvf_open (psf) ;
 3251|    136|				break ;
 3252|       |
 3253|    196|		case	SF_FORMAT_XI :
  ------------------
  |  Branch (3253:3): [True: 196, False: 19.6k]
  ------------------
 3254|    196|				error = xi_open (psf) ;
 3255|    196|				break ;
 3256|       |
 3257|     87|		case	SF_FORMAT_HTK :
  ------------------
  |  Branch (3257:3): [True: 87, False: 19.7k]
  ------------------
 3258|     87|				error = htk_open (psf) ;
 3259|     87|				break ;
 3260|       |
 3261|      0|		case	SF_FORMAT_SD2 :
  ------------------
  |  Branch (3261:3): [True: 0, False: 19.8k]
  ------------------
 3262|      0|				error = sd2_open (psf) ;
 3263|      0|				break ;
 3264|       |
 3265|      1|		case	SF_FORMAT_REX2 :
  ------------------
  |  Branch (3265:3): [True: 1, False: 19.8k]
  ------------------
 3266|      1|				error = rx2_open (psf) ;
 3267|      1|				break ;
 3268|       |
 3269|     90|		case	SF_FORMAT_AVR :
  ------------------
  |  Branch (3269:3): [True: 90, False: 19.7k]
  ------------------
 3270|     90|				error = avr_open (psf) ;
 3271|     90|				break ;
 3272|       |
 3273|      1|		case	SF_FORMAT_FLAC :
  ------------------
  |  Branch (3273:3): [True: 1, False: 19.8k]
  ------------------
 3274|      1|				error = flac_open (psf) ;
 3275|      1|				break ;
 3276|       |
 3277|  2.55k|		case	SF_FORMAT_CAF :
  ------------------
  |  Branch (3277:3): [True: 2.55k, False: 17.2k]
  ------------------
 3278|  2.55k|				error = caf_open (psf) ;
 3279|  2.55k|				break ;
 3280|       |
 3281|      6|		case	SF_FORMAT_MPC2K :
  ------------------
  |  Branch (3281:3): [True: 6, False: 19.7k]
  ------------------
 3282|      6|				error = mpc2k_open (psf) ;
 3283|      6|				break ;
 3284|       |
 3285|     13|		case	SF_FORMAT_MPEG :
  ------------------
  |  Branch (3285:3): [True: 13, False: 19.7k]
  ------------------
 3286|     13|				error = mpeg_open (psf) ;
 3287|     13|				break ;
 3288|       |
 3289|       |		/* Lite remove end */
 3290|       |
 3291|  1.80k|		default :
  ------------------
  |  Branch (3291:3): [True: 1.80k, False: 18.0k]
  ------------------
 3292|  1.80k|				error = SF_ERR_UNRECOGNISED_FORMAT ;
 3293|  19.8k|		} ;
 3294|       |
 3295|  19.8k|	if (error)
  ------------------
  |  Branch (3295:6): [True: 14.2k, False: 5.55k]
  ------------------
 3296|  14.2k|		goto error_exit ;
 3297|       |
 3298|       |	/* For now, check whether embedding is supported. */
 3299|  5.55k|	format = SF_CONTAINER (psf->sf.format) ;
  ------------------
  |  |  101|  5.55k|#define SF_CONTAINER(x)		((x) & SF_FORMAT_TYPEMASK)
  ------------------
 3300|  5.55k|	if (psf->fileoffset > 0)
  ------------------
  |  Branch (3300:6): [True: 69, False: 5.49k]
  ------------------
 3301|     69|	{	switch (format)
 3302|     69|		{	case SF_FORMAT_WAV :
  ------------------
  |  Branch (3302:5): [True: 1, False: 68]
  ------------------
 3303|      1|			case SF_FORMAT_WAVEX :
  ------------------
  |  Branch (3303:4): [True: 0, False: 69]
  ------------------
 3304|      2|			case SF_FORMAT_AIFF :
  ------------------
  |  Branch (3304:4): [True: 1, False: 68]
  ------------------
 3305|     53|			case SF_FORMAT_AU :
  ------------------
  |  Branch (3305:4): [True: 51, False: 18]
  ------------------
 3306|       |				/* Actual embedded files. */
 3307|     53|				break ;
 3308|       |
 3309|      0|			case SF_FORMAT_MPEG :
  ------------------
  |  Branch (3309:4): [True: 0, False: 69]
  ------------------
 3310|      0|			case SF_FORMAT_FLAC :
  ------------------
  |  Branch (3310:4): [True: 0, False: 69]
  ------------------
 3311|       |				/* Flac with an ID3v2 header? */
 3312|      0|				break ;
 3313|       |
 3314|     16|			default :
  ------------------
  |  Branch (3314:4): [True: 16, False: 53]
  ------------------
 3315|     16|				error = SFE_NO_EMBED_SUPPORT ;
 3316|     16|				goto error_exit ;
 3317|     69|			} ;
 3318|  5.54k|		} ;
 3319|       |
 3320|  5.54k|	if (psf->fileoffset > 0)
  ------------------
  |  Branch (3320:6): [True: 53, False: 5.49k]
  ------------------
 3321|     53|		psf_log_printf (psf, "Embedded file length : %D\n", psf->filelength) ;
 3322|       |
 3323|  5.54k|	if (psf->file.mode == SFM_RDWR && sf_format_check (&psf->sf) == 0)
  ------------------
  |  Branch (3323:6): [True: 0, False: 5.54k]
  |  Branch (3323:36): [True: 0, False: 0]
  ------------------
 3324|      0|	{	error = SFE_BAD_MODE_RW ;
 3325|      0|		goto error_exit ;
 3326|  5.54k|		} ;
 3327|       |
 3328|  5.54k|	if (validate_sfinfo (&psf->sf) == 0)
  ------------------
  |  Branch (3328:6): [True: 993, False: 4.55k]
  ------------------
 3329|    993|	{	psf_log_SF_INFO (psf) ;
 3330|    993|		save_header_info (psf) ;
 3331|    993|		error = SFE_BAD_SF_INFO ;
 3332|    993|		goto error_exit ;
 3333|  4.55k|		} ;
 3334|       |
 3335|  4.55k|	if (validate_psf (psf) == 0)
  ------------------
  |  Branch (3335:6): [True: 920, False: 3.63k]
  ------------------
 3336|    920|	{	save_header_info (psf) ;
 3337|    920|		error = SFE_INTERNAL ;
 3338|    920|		goto error_exit ;
 3339|  3.63k|		} ;
 3340|       |
 3341|  3.63k|	psf->read_current = 0 ;
 3342|  3.63k|	psf->write_current = 0 ;
 3343|  3.63k|	if (psf->file.mode == SFM_RDWR)
  ------------------
  |  Branch (3343:6): [True: 0, False: 3.63k]
  ------------------
 3344|      0|	{	psf->write_current = psf->sf.frames ;
 3345|      0|		psf->have_written = psf->sf.frames > 0 ? SF_TRUE : SF_FALSE ;
  ------------------
  |  Branch (3345:23): [True: 0, False: 0]
  ------------------
 3346|      0|		} ;
 3347|       |
 3348|  3.63k|	memcpy (sfinfo, &psf->sf, sizeof (SF_INFO)) ;
 3349|       |
 3350|  3.63k|	if (psf->file.mode == SFM_WRITE)
  ------------------
  |  Branch (3350:6): [True: 0, False: 3.63k]
  ------------------
 3351|      0|	{	/* Zero out these fields. */
 3352|      0|		sfinfo->frames = 0 ;
 3353|      0|		sfinfo->sections = 0 ;
 3354|      0|		sfinfo->seekable = 0 ;
 3355|      0|		} ;
 3356|       |
 3357|  3.63k|	return (SNDFILE *) psf ;
 3358|       |
 3359|  16.1k|error_exit :
 3360|  16.1k|	sf_errno = error ;
 3361|       |
 3362|  16.1k|	if (error == SFE_SYSTEM)
  ------------------
  |  Branch (3362:6): [True: 0, False: 16.1k]
  ------------------
 3363|      0|		snprintf (sf_syserr, sizeof (sf_syserr), "%s", psf->syserr) ;
 3364|  16.1k|	snprintf (sf_parselog, sizeof (sf_parselog), "%s", psf->parselog.buf) ;
 3365|       |
 3366|  16.1k|	switch (error)
 3367|  16.1k|	{	case SF_ERR_SYSTEM :
  ------------------
  |  Branch (3367:4): [True: 0, False: 16.1k]
  ------------------
 3368|    286|		case SF_ERR_UNSUPPORTED_ENCODING :
  ------------------
  |  Branch (3368:3): [True: 286, False: 15.8k]
  ------------------
 3369|  1.30k|		case SFE_UNIMPLEMENTED :
  ------------------
  |  Branch (3369:3): [True: 1.01k, False: 15.1k]
  ------------------
 3370|  1.30k|			break ;
 3371|       |
 3372|      0|		case SFE_RAW_BAD_FORMAT :
  ------------------
  |  Branch (3372:3): [True: 0, False: 16.1k]
  ------------------
 3373|      0|			break ;
 3374|       |
 3375|  14.8k|		default :
  ------------------
  |  Branch (3375:3): [True: 14.8k, False: 1.30k]
  ------------------
 3376|  14.8k|			if (psf->file.mode == SFM_READ)
  ------------------
  |  Branch (3376:8): [True: 14.8k, False: 0]
  ------------------
 3377|  14.8k|			{	psf_log_printf (psf, "Parse error : %s\n", sf_error_number (error)) ;
 3378|  14.8k|				error = SF_ERR_MALFORMED_FILE ;
 3379|  14.8k|				} ;
 3380|  16.1k|		} ;
 3381|       |
 3382|  16.1k|	psf_close (psf) ;
 3383|       |	return NULL ;
 3384|  16.1k|} /* psf_open_file */
sndfile.c:psf_close:
 2971|  19.8k|{	uint32_t k ;
 2972|  19.8k|	int	error = 0 ;
 2973|       |
 2974|  19.8k|	if (psf->codec_close)
  ------------------
  |  Branch (2974:6): [True: 3.21k, False: 16.5k]
  ------------------
 2975|  3.21k|	{	error = psf->codec_close (psf) ;
 2976|       |		/* To prevent it being called in psf->container_close(). */
 2977|  3.21k|		psf->codec_close = NULL ;
 2978|  3.21k|		} ;
 2979|       |
 2980|  19.8k|	if (psf->container_close)
  ------------------
  |  Branch (2980:6): [True: 7.37k, False: 12.4k]
  ------------------
 2981|  7.37k|		error = psf->container_close (psf) ;
 2982|       |
 2983|  19.8k|	error = psf_fclose (psf) ;
 2984|  19.8k|	psf_close_rsrc (psf) ;
 2985|       |
 2986|       |	/* For an ISO C compliant implementation it is ok to free a NULL pointer. */
 2987|  19.8k|	free (psf->header.ptr) ;
 2988|  19.8k|	free (psf->container_data) ;
 2989|  19.8k|	free (psf->codec_data) ;
 2990|  19.8k|	free (psf->interleave) ;
 2991|  19.8k|	free (psf->dither) ;
 2992|  19.8k|	free (psf->peak_info) ;
 2993|  19.8k|	free (psf->broadcast_16k) ;
 2994|  19.8k|	free (psf->loop_info) ;
 2995|  19.8k|	free (psf->instrument) ;
 2996|  19.8k|	free (psf->cues) ;
 2997|  19.8k|	free (psf->channel_map) ;
 2998|  19.8k|	free (psf->format_desc) ;
 2999|  19.8k|	free (psf->strings.storage) ;
 3000|       |
 3001|  19.8k|	if (psf->wchunks.chunks)
  ------------------
  |  Branch (3001:6): [True: 0, False: 19.8k]
  ------------------
 3002|      0|		for (k = 0 ; k < psf->wchunks.used ; k++)
  ------------------
  |  Branch (3002:16): [True: 0, False: 0]
  ------------------
 3003|      0|			free (psf->wchunks.chunks [k].data) ;
 3004|  19.8k|	free (psf->rchunks.chunks) ;
 3005|  19.8k|	free (psf->wchunks.chunks) ;
 3006|  19.8k|	free (psf->iterator) ;
 3007|  19.8k|	free (psf->cart_16k) ;
 3008|       |
 3009|  19.8k|	free (psf) ;
 3010|       |
 3011|  19.8k|	return error ;
 3012|  19.8k|} /* psf_close */
sndfile.c:guess_file_type:
 2789|  18.8k|{	uint32_t buffer [3], format ;
 2790|       |
 2791|  20.4k|retry:
 2792|  20.4k|	if (psf_binheader_readf (psf, "b", &buffer, SIGNED_SIZEOF (buffer)) != SIGNED_SIZEOF (buffer))
  ------------------
  |  |   86|  20.4k|#define		SIGNED_SIZEOF(x)	((int) sizeof (x))
  ------------------
              	if (psf_binheader_readf (psf, "b", &buffer, SIGNED_SIZEOF (buffer)) != SIGNED_SIZEOF (buffer))
  ------------------
  |  |   86|  20.4k|#define		SIGNED_SIZEOF(x)	((int) sizeof (x))
  ------------------
  |  Branch (2792:6): [True: 30, False: 20.4k]
  ------------------
 2793|     30|	{	psf->error = SFE_BAD_FILE_READ ;
 2794|     30|		return 0 ;
 2795|  20.4k|		} ;
 2796|       |
 2797|  20.4k|	if ((buffer [0] == MAKE_MARKER ('R', 'I', 'F', 'F') || buffer [0] == MAKE_MARKER ('R', 'I', 'F', 'X'))
  ------------------
  |  |  122|  40.8k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
              	if ((buffer [0] == MAKE_MARKER ('R', 'I', 'F', 'F') || buffer [0] == MAKE_MARKER ('R', 'I', 'F', 'X'))
  ------------------
  |  |  122|  18.1k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
  |  Branch (2797:7): [True: 2.30k, False: 18.1k]
  |  Branch (2797:57): [True: 1.61k, False: 16.5k]
  ------------------
 2798|  3.92k|			&& buffer [2] == MAKE_MARKER ('W', 'A', 'V', 'E'))
  ------------------
  |  |  122|  3.92k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
  |  Branch (2798:7): [True: 3.90k, False: 22]
  ------------------
 2799|  3.90k|		return SF_FORMAT_WAV ;
 2800|       |
 2801|  16.5k|	if (buffer [0] == MAKE_MARKER ('F', 'O', 'R', 'M'))
  ------------------
  |  |  122|  16.5k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
  |  Branch (2801:6): [True: 3.55k, False: 12.9k]
  ------------------
 2802|  3.55k|	{	if (buffer [2] == MAKE_MARKER ('A', 'I', 'F', 'F') || buffer [2] == MAKE_MARKER ('A', 'I', 'F', 'C'))
  ------------------
  |  |  122|  7.10k|	#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|  1.02k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
  |  Branch (2802:8): [True: 2.53k, False: 1.02k]
  |  Branch (2802:58): [True: 295, False: 728]
  ------------------
 2803|  2.82k|			return SF_FORMAT_AIFF ;
 2804|    728|		if (buffer [2] == MAKE_MARKER ('8', 'S', 'V', 'X') || buffer [2] == MAKE_MARKER ('1', '6', 'S', 'V'))
  ------------------
  |  |  122|  1.45k|	#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|    445|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
  |  Branch (2804:7): [True: 283, False: 445]
  |  Branch (2804:57): [True: 303, False: 142]
  ------------------
 2805|    586|			return SF_FORMAT_SVX ;
 2806|    142|		return 0 ;
 2807|  12.9k|		} ;
 2808|       |
 2809|  12.9k|	if (buffer [0] == MAKE_MARKER ('.', 's', 'n', 'd') || buffer [0] == MAKE_MARKER ('d', 'n', 's', '.'))
  ------------------
  |  |  122|  25.9k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
              	if (buffer [0] == MAKE_MARKER ('.', 's', 'n', 'd') || buffer [0] == MAKE_MARKER ('d', 'n', 's', '.'))
  ------------------
  |  |  122|  12.8k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
  |  Branch (2809:6): [True: 185, False: 12.8k]
  |  Branch (2809:56): [True: 1.25k, False: 11.5k]
  ------------------
 2810|  1.43k|		return SF_FORMAT_AU ;
 2811|       |
 2812|  11.5k|	if ((buffer [0] == MAKE_MARKER ('f', 'a', 'p', ' ') || buffer [0] == MAKE_MARKER (' ', 'p', 'a', 'f')))
  ------------------
  |  |  122|  23.0k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
              	if ((buffer [0] == MAKE_MARKER ('f', 'a', 'p', ' ') || buffer [0] == MAKE_MARKER (' ', 'p', 'a', 'f')))
  ------------------
  |  |  122|  11.4k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
  |  Branch (2812:7): [True: 138, False: 11.4k]
  |  Branch (2812:57): [True: 4, False: 11.4k]
  ------------------
 2813|    142|		return SF_FORMAT_PAF ;
 2814|       |
 2815|  11.4k|	if (buffer [0] == MAKE_MARKER ('N', 'I', 'S', 'T'))
  ------------------
  |  |  122|  11.4k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
  |  Branch (2815:6): [True: 214, False: 11.1k]
  ------------------
 2816|    214|		return SF_FORMAT_NIST ;
 2817|       |
 2818|  11.1k|	if (buffer [0] == MAKE_MARKER ('C', 'r', 'e', 'a') && buffer [1] == MAKE_MARKER ('t', 'i', 'v', 'e'))
  ------------------
  |  |  122|  22.3k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
              	if (buffer [0] == MAKE_MARKER ('C', 'r', 'e', 'a') && buffer [1] == MAKE_MARKER ('t', 'i', 'v', 'e'))
  ------------------
  |  |  122|    342|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
  |  Branch (2818:6): [True: 342, False: 10.8k]
  |  Branch (2818:56): [True: 295, False: 47]
  ------------------
 2819|    295|		return SF_FORMAT_VOC ;
 2820|       |
 2821|  10.8k|	if ((buffer [0] & MAKE_MARKER (0xFF, 0xFF, 0xF8, 0xFF)) == MAKE_MARKER (0x64, 0xA3, 0x00, 0x00) ||
  ------------------
  |  |  122|  10.8k|	#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.7k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
  |  Branch (2821:6): [True: 315, False: 10.5k]
  ------------------
 2822|  10.5k|		(buffer [0] & MAKE_MARKER (0xFF, 0xF8, 0xFF, 0xFF)) == MAKE_MARKER (0x00, 0x00, 0xA3, 0x64))
  ------------------
  |  |  122|  10.5k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
              		(buffer [0] & MAKE_MARKER (0xFF, 0xF8, 0xFF, 0xFF)) == MAKE_MARKER (0x00, 0x00, 0xA3, 0x64))
  ------------------
  |  |  122|  10.5k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
  |  Branch (2822:3): [True: 62, False: 10.5k]
  ------------------
 2823|    377|		return SF_FORMAT_IRCAM ;
 2824|       |
 2825|  10.5k|	if (buffer [0] == MAKE_MARKER ('r', 'i', 'f', 'f'))
  ------------------
  |  |  122|  10.5k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
  |  Branch (2825:6): [True: 615, False: 9.90k]
  ------------------
 2826|    615|		return SF_FORMAT_W64 ;
 2827|       |
 2828|  9.90k|	if (buffer [0] == MAKE_MARKER (0, 0, 0x03, 0xE8) && buffer [1] == MAKE_MARKER (0, 0, 0, 1) &&
  ------------------
  |  |  122|  19.8k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
              	if (buffer [0] == MAKE_MARKER (0, 0, 0x03, 0xE8) && buffer [1] == MAKE_MARKER (0, 0, 0, 1) &&
  ------------------
  |  |  122|  10.0k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
  |  Branch (2828:6): [True: 123, False: 9.78k]
  |  Branch (2828:54): [True: 78, False: 45]
  ------------------
 2829|     78|								buffer [2] == MAKE_MARKER (0, 0, 0, 1))
  ------------------
  |  |  122|     78|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
  |  Branch (2829:9): [True: 35, False: 43]
  ------------------
 2830|     35|		return SF_FORMAT_MAT4 ;
 2831|       |
 2832|  9.86k|	if (buffer [0] == MAKE_MARKER (0, 0, 0, 0) && buffer [1] == MAKE_MARKER (1, 0, 0, 0) &&
  ------------------
  |  |  122|  19.7k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
              	if (buffer [0] == MAKE_MARKER (0, 0, 0, 0) && buffer [1] == MAKE_MARKER (1, 0, 0, 0) &&
  ------------------
  |  |  122|  10.5k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
  |  Branch (2832:6): [True: 703, False: 9.16k]
  |  Branch (2832:48): [True: 603, False: 100]
  ------------------
 2833|    603|								buffer [2] == MAKE_MARKER (1, 0, 0, 0))
  ------------------
  |  |  122|    603|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
  |  Branch (2833:9): [True: 559, False: 44]
  ------------------
 2834|    559|		return SF_FORMAT_MAT4 ;
 2835|       |
 2836|  9.31k|	if (buffer [0] == MAKE_MARKER ('M', 'A', 'T', 'L') && buffer [1] == MAKE_MARKER ('A', 'B', ' ', '5'))
  ------------------
  |  |  122|  18.6k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
              	if (buffer [0] == MAKE_MARKER ('M', 'A', 'T', 'L') && buffer [1] == MAKE_MARKER ('A', 'B', ' ', '5'))
  ------------------
  |  |  122|    444|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
  |  Branch (2836:6): [True: 444, False: 8.86k]
  |  Branch (2836:56): [True: 409, False: 35]
  ------------------
 2837|    409|		return SF_FORMAT_MAT5 ;
 2838|       |
 2839|  8.90k|	if (buffer [0] == MAKE_MARKER ('P', 'V', 'F', '1'))
  ------------------
  |  |  122|  8.90k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
  |  Branch (2839:6): [True: 136, False: 8.76k]
  ------------------
 2840|    136|		return SF_FORMAT_PVF ;
 2841|       |
 2842|  8.76k|	if (buffer [0] == MAKE_MARKER ('E', 'x', 't', 'e') && buffer [1] == MAKE_MARKER ('n', 'd', 'e', 'd') &&
  ------------------
  |  |  122|  17.5k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
              	if (buffer [0] == MAKE_MARKER ('E', 'x', 't', 'e') && buffer [1] == MAKE_MARKER ('n', 'd', 'e', 'd') &&
  ------------------
  |  |  122|  9.04k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
  |  Branch (2842:6): [True: 276, False: 8.48k]
  |  Branch (2842:56): [True: 227, False: 49]
  ------------------
 2843|    227|								buffer [2] == MAKE_MARKER (' ', 'I', 'n', 's'))
  ------------------
  |  |  122|    227|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
  |  Branch (2843:9): [True: 196, False: 31]
  ------------------
 2844|    196|		return SF_FORMAT_XI ;
 2845|       |
 2846|  8.56k|	if (buffer [0] == MAKE_MARKER ('c', 'a', 'f', 'f') && buffer [2] == MAKE_MARKER ('d', 'e', 's', 'c'))
  ------------------
  |  |  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 ('c', 'a', 'f', 'f') && buffer [2] == MAKE_MARKER ('d', 'e', 's', 'c'))
  ------------------
  |  |  122|  2.60k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
  |  Branch (2846:6): [True: 2.60k, False: 5.96k]
  |  Branch (2846:56): [True: 2.55k, False: 46]
  ------------------
 2847|  2.55k|		return SF_FORMAT_CAF ;
 2848|       |
 2849|  6.01k|	if (buffer [0] == MAKE_MARKER ('O', 'g', 'g', 'S'))
  ------------------
  |  |  122|  6.01k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
  |  Branch (2849:6): [True: 1, False: 6.01k]
  ------------------
 2850|      1|		return SF_FORMAT_OGG ;
 2851|       |
 2852|  6.01k|	if (buffer [0] == MAKE_MARKER ('A', 'L', 'a', 'w') && buffer [1] == MAKE_MARKER ('S', 'o', 'u', 'n')
  ------------------
  |  |  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 ('A', 'L', 'a', 'w') && buffer [1] == MAKE_MARKER ('S', 'o', 'u', 'n')
  ------------------
  |  |  122|  6.19k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
  |  Branch (2852:6): [True: 182, False: 5.83k]
  |  Branch (2852:56): [True: 164, False: 18]
  ------------------
 2853|    164|			&& buffer [2] == MAKE_MARKER ('d', 'F', 'i', 'l'))
  ------------------
  |  |  122|    164|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
  |  Branch (2853:7): [True: 114, False: 50]
  ------------------
 2854|    114|		return SF_FORMAT_WVE ;
 2855|       |
 2856|  5.90k|	if (buffer [0] == MAKE_MARKER ('D', 'i', 'a', 'm') && buffer [1] == MAKE_MARKER ('o', 'n', 'd', 'W')
  ------------------
  |  |  122|  11.8k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
              	if (buffer [0] == MAKE_MARKER ('D', 'i', 'a', 'm') && buffer [1] == MAKE_MARKER ('o', 'n', 'd', 'W')
  ------------------
  |  |  122|  5.94k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
  |  Branch (2856:6): [True: 43, False: 5.85k]
  |  Branch (2856:56): [True: 5, False: 38]
  ------------------
 2857|      5|			&& buffer [2] == MAKE_MARKER ('a', 'r', 'e', ' '))
  ------------------
  |  |  122|      5|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
  |  Branch (2857:7): [True: 1, False: 4]
  ------------------
 2858|      1|		return SF_FORMAT_DWD ;
 2859|       |
 2860|  5.89k|	if (buffer [0] == MAKE_MARKER ('L', 'M', '8', '9') || buffer [0] == MAKE_MARKER ('5', '3', 0, 0))
  ------------------
  |  |  122|  11.7k|	#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|  5.89k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
  |  Branch (2860:6): [True: 1, False: 5.89k]
  |  Branch (2860:56): [True: 1, False: 5.89k]
  ------------------
 2861|      2|		return SF_FORMAT_TXW ;
 2862|       |
 2863|  5.89k|	if ((buffer [0] & MAKE_MARKER (0xFF, 0xFF, 0x80, 0xFF)) == MAKE_MARKER (0xF0, 0x7E, 0, 0x01))
  ------------------
  |  |  122|  5.89k|	#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|  5.89k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
  |  Branch (2863:6): [True: 350, False: 5.54k]
  ------------------
 2864|    350|		return SF_FORMAT_SDS ;
 2865|       |
 2866|  5.54k|	if ((buffer [0] & MAKE_MARKER (0xFF, 0xFF, 0, 0)) == MAKE_MARKER (1, 4, 0, 0))
  ------------------
  |  |  122|  5.54k|	#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.54k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
  |  Branch (2866:6): [True: 6, False: 5.54k]
  ------------------
 2867|      6|		return SF_FORMAT_MPC2K ;
 2868|       |
 2869|  5.54k|	if (buffer [0] == MAKE_MARKER ('C', 'A', 'T', ' ') && buffer [2] == MAKE_MARKER ('R', 'E', 'X', '2'))
  ------------------
  |  |  122|  11.0k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
              	if (buffer [0] == MAKE_MARKER ('C', 'A', 'T', ' ') && buffer [2] == MAKE_MARKER ('R', 'E', 'X', '2'))
  ------------------
  |  |  122|     14|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
  |  Branch (2869:6): [True: 14, False: 5.52k]
  |  Branch (2869:56): [True: 1, False: 13]
  ------------------
 2870|      1|		return SF_FORMAT_REX2 ;
 2871|       |
 2872|  5.54k|	if (buffer [0] == MAKE_MARKER (0x30, 0x26, 0xB2, 0x75) && buffer [1] == MAKE_MARKER (0x8E, 0x66, 0xCF, 0x11))
  ------------------
  |  |  122|  11.0k|	#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|     38|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
  |  Branch (2872:6): [True: 38, False: 5.50k]
  |  Branch (2872:60): [True: 1, False: 37]
  ------------------
 2873|      1|		return 0 /*-SF_FORMAT_WMA-*/ ;
 2874|       |
 2875|       |	/* HMM (Hidden Markov Model) Tool Kit. */
 2876|  5.53k|	if (buffer [2] == MAKE_MARKER (0, 2, 0, 0) && 2 * ((int64_t) BE2H_32 (buffer [0])) + 12 == psf->filelength)
  ------------------
  |  |  122|  11.0k|	#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|    375|	#define BE2H_32(x)			ENDSWAP_32 (x)
  |  |  ------------------
  |  |  |  |   35|    375|#define	ENDSWAP_32(x)		(bswap_32 (x))
  |  |  ------------------
  ------------------
  |  Branch (2876:6): [True: 375, False: 5.16k]
  |  Branch (2876:48): [True: 87, False: 288]
  ------------------
 2877|     87|		return SF_FORMAT_HTK ;
 2878|       |
 2879|  5.45k|	if (buffer [0] == MAKE_MARKER ('f', 'L', 'a', 'C'))
  ------------------
  |  |  122|  5.45k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
  |  Branch (2879:6): [True: 1, False: 5.45k]
  ------------------
 2880|      1|		return SF_FORMAT_FLAC ;
 2881|       |
 2882|  5.45k|	if (buffer [0] == MAKE_MARKER ('2', 'B', 'I', 'T'))
  ------------------
  |  |  122|  5.45k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
  |  Branch (2882:6): [True: 90, False: 5.36k]
  ------------------
 2883|     90|		return SF_FORMAT_AVR ;
 2884|       |
 2885|  5.36k|	if (buffer [0] == MAKE_MARKER ('R', 'F', '6', '4') && buffer [2] == MAKE_MARKER ('W', 'A', 'V', 'E'))
  ------------------
  |  |  122|  10.7k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
              	if (buffer [0] == MAKE_MARKER ('R', 'F', '6', '4') && buffer [2] == MAKE_MARKER ('W', 'A', 'V', 'E'))
  ------------------
  |  |  122|  2.12k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
  |  Branch (2885:6): [True: 2.12k, False: 3.23k]
  |  Branch (2885:56): [True: 2.08k, False: 43]
  ------------------
 2886|  2.08k|		return SF_FORMAT_RF64 ;
 2887|       |
 2888|  3.27k|	if (buffer [0] == MAKE_MARKER ('I', 'D', '3', 2) || buffer [0] == MAKE_MARKER ('I', 'D', '3', 3)
  ------------------
  |  |  122|  6.55k|	#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|  5.58k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
  |  Branch (2888:6): [True: 971, False: 2.30k]
  |  Branch (2888:54): [True: 365, False: 1.94k]
  ------------------
 2889|  1.94k|			|| buffer [0] == MAKE_MARKER ('I', 'D', '3', 4))
  ------------------
  |  |  122|  1.94k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
  |  Branch (2889:7): [True: 311, False: 1.63k]
  ------------------
 2890|  1.64k|	{	psf_log_printf (psf, "Found 'ID3' marker.\n") ;
 2891|  1.64k|		if (id3_skip (psf))
  ------------------
  |  Branch (2891:7): [True: 1.63k, False: 14]
  ------------------
 2892|  1.63k|			goto retry ;
 2893|     14|		return 0 ;
 2894|  1.64k|		} ;
 2895|       |
 2896|       |	/* ID3v2 tags + MPEG */
 2897|  1.63k|	if (psf->id3_header.len > 0 && (format = identify_mpeg (buffer [0])) != 0)
  ------------------
  |  Branch (2897:6): [True: 33, False: 1.59k]
  |  Branch (2897:33): [True: 4, False: 29]
  ------------------
 2898|      4|		return format ;
 2899|       |
 2900|       |	/* Turtle Beach SMP 16-bit */
 2901|  1.62k|	if (buffer [0] == MAKE_MARKER ('S', 'O', 'U', 'N') && buffer [1] == MAKE_MARKER ('D', ' ', 'S', 'A'))
  ------------------
  |  |  122|  3.25k|	#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|     47|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
  |  Branch (2901:6): [True: 47, False: 1.58k]
  |  Branch (2901:56): [True: 1, False: 46]
  ------------------
 2902|      1|		return 0 ;
 2903|       |
 2904|       |	/* Yamaha sampler format. */
 2905|  1.62k|	if (buffer [0] == MAKE_MARKER ('S', 'Y', '8', '0') || buffer [0] == MAKE_MARKER ('S', 'Y', '8', '5'))
  ------------------
  |  |  122|  3.25k|	#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.62k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
  |  Branch (2905:6): [True: 1, False: 1.62k]
  |  Branch (2905:56): [True: 1, False: 1.62k]
  ------------------
 2906|      2|		return 0 ;
 2907|       |
 2908|  1.62k|	if (buffer [0] == MAKE_MARKER ('a', 'j', 'k', 'g'))
  ------------------
  |  |  122|  1.62k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
  |  Branch (2908:6): [True: 1, False: 1.62k]
  ------------------
 2909|      1|		return 0 /*-SF_FORMAT_SHN-*/ ;
 2910|       |
 2911|       |	/* This must be (almost) the last one. */
 2912|  1.62k|	if (psf->filelength > 0 && (format = try_resource_fork (psf)) != 0)
  ------------------
  |  Branch (2912:6): [True: 1.62k, False: 0]
  |  Branch (2912:29): [True: 0, False: 1.62k]
  ------------------
 2913|      0|		return format ;
 2914|       |
 2915|       |	/* MPEG with no ID3v2 tags. Only have the MPEG sync header for
 2916|       |	 * identification and it is quite brief, and prone to false positives.
 2917|       |	 * Check for this last, even after resource forks. */
 2918|  1.62k|	if (psf->id3_header.len == 0 && (format = identify_mpeg (buffer [0])) != 0)
  ------------------
  |  Branch (2918:6): [True: 1.59k, False: 29]
  |  Branch (2918:34): [True: 9, False: 1.58k]
  ------------------
 2919|      9|		return format ;
 2920|       |
 2921|  1.61k|	return 0 ;
 2922|  1.62k|} /* guess_file_type */
sndfile.c:identify_mpeg:
 2778|  1.62k|{	if ((marker & MAKE_MARKER (0xFF, 0xE0, 0, 0)) == MAKE_MARKER (0xFF, 0xE0, 0, 0) && /* Frame sync */
  ------------------
  |  |  122|  1.62k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
              {	if ((marker & MAKE_MARKER (0xFF, 0xE0, 0, 0)) == MAKE_MARKER (0xFF, 0xE0, 0, 0) && /* Frame sync */
  ------------------
  |  |  122|  3.25k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
  |  Branch (2778:7): [True: 47, False: 1.58k]
  ------------------
 2779|     47|		(marker & MAKE_MARKER (0, 0x18, 0, 0)) != MAKE_MARKER (0, 0x08, 0, 0) && /* Valid MPEG version */
  ------------------
  |  |  122|     47|	#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.67k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
  |  Branch (2779:3): [True: 44, False: 3]
  ------------------
 2780|     44|		(marker & MAKE_MARKER (0, 0x06, 0, 0)) != MAKE_MARKER (0, 0, 0, 0) && /* Valid layer description */
  ------------------
  |  |  122|     44|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
              		(marker & MAKE_MARKER (0, 0x06, 0, 0)) != MAKE_MARKER (0, 0, 0, 0) && /* Valid layer description */
  ------------------
  |  |  122|  1.67k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
  |  Branch (2780:3): [True: 40, False: 4]
  ------------------
 2781|     40|		(marker & MAKE_MARKER (0, 0, 0xF0, 0)) != MAKE_MARKER (0, 0, 0xF0, 0) && /* Valid bitrate */
  ------------------
  |  |  122|     40|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
              		(marker & MAKE_MARKER (0, 0, 0xF0, 0)) != MAKE_MARKER (0, 0, 0xF0, 0) && /* Valid bitrate */
  ------------------
  |  |  122|  1.66k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  ------------------
  |  Branch (2781:3): [True: 21, False: 19]
  ------------------
 2782|     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 (2782:3): [True: 13, False: 8]
  ------------------
 2783|     13|		return SF_FORMAT_MPEG ;
 2784|  1.61k|	return 0 ;
 2785|  1.62k|} /* identify_mpeg */
sndfile.c:try_resource_fork:
 2695|  1.62k|{	int old_error = psf->error ;
 2696|       |
 2697|       |	/* Set READ mode now, to see if resource fork exists. */
 2698|  1.62k|	psf->rsrc.mode = SFM_READ ;
 2699|  1.62k|	if (psf_open_rsrc (psf) != 0)
  ------------------
  |  Branch (2699:6): [True: 1.62k, False: 0]
  ------------------
 2700|  1.62k|	{	psf->error = old_error ;
 2701|  1.62k|		return 0 ;
 2702|  1.62k|		} ;
 2703|       |
 2704|       |	/* More checking here. */
 2705|      0|	psf_log_printf (psf, "Resource fork : %s\n", psf->rsrc.path) ;
 2706|       |
 2707|      0|	return SF_FORMAT_SD2 ;
 2708|  1.62k|} /* try_resource_fork */
sndfile.c:format_from_extension:
 2712|  1.80k|{	char *cptr ;
 2713|  1.80k|	char buffer [16] ;
 2714|  1.80k|	int format = 0 ;
 2715|       |
 2716|  1.80k|	if ((cptr = strrchr (psf->file.name, '.')) == NULL)
  ------------------
  |  Branch (2716:6): [True: 1.80k, False: 0]
  ------------------
 2717|  1.80k|		return 0 ;
 2718|       |
 2719|      0|	cptr ++ ;
 2720|      0|	if (strlen (cptr) > sizeof (buffer) - 1)
  ------------------
  |  Branch (2720:6): [True: 0, False: 0]
  ------------------
 2721|      0|		return 0 ;
 2722|       |
 2723|      0|	psf_strlcpy (buffer, sizeof (buffer), cptr) ;
 2724|      0|	buffer [sizeof (buffer) - 1] = 0 ;
 2725|       |
 2726|       |	/* Convert everything in the buffer to lower case. */
 2727|      0|	cptr = buffer ;
 2728|      0|	while (*cptr)
  ------------------
  |  Branch (2728:9): [True: 0, False: 0]
  ------------------
 2729|      0|	{	*cptr = tolower ((unsigned char) *cptr) ;
  ------------------
  |  Branch (2729:12): [True: 0, False: 0]
  |  Branch (2729:12): [True: 0, False: 0]
  |  Branch (2729:12): [Folded, False: 0]
  ------------------
 2730|      0|		cptr ++ ;
 2731|      0|		} ;
 2732|       |
 2733|      0|	cptr = buffer ;
 2734|       |
 2735|      0|	if (strcmp (cptr, "au") == 0)
  ------------------
  |  Branch (2735:6): [True: 0, False: 0]
  ------------------
 2736|      0|	{	psf->sf.channels = 1 ;
 2737|      0|		psf->sf.samplerate = 8000 ;
 2738|      0|		format = SF_FORMAT_RAW | SF_FORMAT_ULAW ;
 2739|      0|		}
 2740|      0|	else if (strcmp (cptr, "snd") == 0)
  ------------------
  |  Branch (2740:11): [True: 0, False: 0]
  ------------------
 2741|      0|	{	psf->sf.channels = 1 ;
 2742|      0|		psf->sf.samplerate = 8000 ;
 2743|      0|		format = SF_FORMAT_RAW | SF_FORMAT_ULAW ;
 2744|      0|		}
 2745|       |
 2746|      0|	else if (strcmp (cptr, "vox") == 0 || strcmp (cptr, "vox8") == 0)
  ------------------
  |  Branch (2746:11): [True: 0, False: 0]
  |  Branch (2746:40): [True: 0, False: 0]
  ------------------
 2747|      0|	{	psf->sf.channels = 1 ;
 2748|      0|		psf->sf.samplerate = 8000 ;
 2749|      0|		format = SF_FORMAT_RAW | SF_FORMAT_VOX_ADPCM ;
 2750|      0|		}
 2751|      0|	else if (strcmp (cptr, "vox6") == 0)
  ------------------
  |  Branch (2751:11): [True: 0, False: 0]
  ------------------
 2752|      0|	{	psf->sf.channels = 1 ;
 2753|      0|		psf->sf.samplerate = 6000 ;
 2754|      0|		format = SF_FORMAT_RAW | SF_FORMAT_VOX_ADPCM ;
 2755|      0|		}
 2756|      0|	else if (strcmp (cptr, "gsm") == 0)
  ------------------
  |  Branch (2756:11): [True: 0, False: 0]
  ------------------
 2757|      0|	{	psf->sf.channels = 1 ;
 2758|      0|		psf->sf.samplerate = 8000 ;
 2759|      0|		format = SF_FORMAT_RAW | SF_FORMAT_GSM610 ;
 2760|      0|		}
 2761|      0|	else if (strcmp (cptr, "mp3") == 0)
  ------------------
  |  Branch (2761:11): [True: 0, False: 0]
  ------------------
 2762|      0|	{	/*
 2763|       |		 * MPEG streams are quite tollerate of crap. If we couldn't identify a
 2764|       |		 * MP3 stream, but it has a .mp3 extension, let libmpg123 have a try.
 2765|       |		 */
 2766|      0|		format = SF_FORMAT_MPEG ;
 2767|      0|		}
 2768|       |
 2769|       |	/* For RAW files, make sure the dataoffset if set correctly. */
 2770|      0|	if ((SF_CONTAINER (format)) == SF_FORMAT_RAW)
  ------------------
  |  |  101|      0|#define SF_CONTAINER(x)		((x) & SF_FORMAT_TYPEMASK)
  ------------------
  |  Branch (2770:6): [True: 0, False: 0]
  ------------------
 2771|      0|		psf->dataoffset = 0 ;
 2772|       |
 2773|      0|	return format ;
 2774|      0|} /* format_from_extension */
sndfile.c:validate_sfinfo:
 2927|  5.54k|{	if (sfinfo->samplerate < 1)
  ------------------
  |  Branch (2927:7): [True: 627, False: 4.91k]
  ------------------
 2928|    627|		return 0 ;
 2929|  4.91k|	if (sfinfo->frames < 0)
  ------------------
  |  Branch (2929:6): [True: 225, False: 4.69k]
  ------------------
 2930|    225|		return 0 ;
 2931|  4.69k|	if ((sfinfo->channels < 1) || (sfinfo->channels > SF_MAX_CHANNELS))
  ------------------
  |  |   95|  4.59k|#define		SF_MAX_CHANNELS		1024
  ------------------
  |  Branch (2931:6): [True: 92, False: 4.59k]
  |  Branch (2931:32): [True: 31, False: 4.56k]
  ------------------
 2932|    123|		return 0 ;
 2933|  4.56k|	if ((SF_CONTAINER (sfinfo->format)) == 0)
  ------------------
  |  |  101|  4.56k|#define SF_CONTAINER(x)		((x) & SF_FORMAT_TYPEMASK)
  ------------------
  |  Branch (2933:6): [True: 0, False: 4.56k]
  ------------------
 2934|      0|		return 0 ;
 2935|  4.56k|	if ((SF_CODEC (sfinfo->format)) == 0)
  ------------------
  |  |  102|  4.56k|#define SF_CODEC(x)			((x) & SF_FORMAT_SUBMASK)
  ------------------
  |  Branch (2935:6): [True: 18, False: 4.55k]
  ------------------
 2936|     18|		return 0 ;
 2937|  4.55k|	if (sfinfo->sections < 1)
  ------------------
  |  Branch (2937:6): [True: 0, False: 4.55k]
  ------------------
 2938|      0|		return 0 ;
 2939|  4.55k|	return 1 ;
 2940|  4.55k|} /* validate_sfinfo */
sndfile.c:save_header_info:
 2963|  1.91k|{	snprintf (sf_parselog, sizeof (sf_parselog), "%s", psf->parselog.buf) ;
 2964|  1.91k|} /* save_header_info */
sndfile.c:validate_psf:
 2944|  4.55k|{
 2945|  4.55k|	if (psf->datalength < 0)
  ------------------
  |  Branch (2945:6): [True: 212, False: 4.33k]
  ------------------
 2946|    212|	{	psf_log_printf (psf, "Invalid SF_PRIVATE field : datalength == %D.\n", psf->datalength) ;
 2947|    212|		return 0 ;
 2948|  4.33k|		} ;
 2949|  4.33k|	if (psf->dataoffset < 0)
  ------------------
  |  Branch (2949:6): [True: 624, False: 3.71k]
  ------------------
 2950|    624|	{	psf_log_printf (psf, "Invalid SF_PRIVATE field : dataoffset == %D.\n", psf->dataoffset) ;
 2951|    624|		return 0 ;
 2952|  3.71k|		} ;
 2953|  3.71k|	if (psf->blockwidth && psf->blockwidth != psf->sf.channels * psf->bytewidth)
  ------------------
  |  Branch (2953:6): [True: 1.06k, False: 2.65k]
  |  Branch (2953:25): [True: 84, False: 976]
  ------------------
 2954|     84|	{	psf_log_printf (psf, "Invalid SF_PRIVATE field : channels * bytewidth == %d.\n",
 2955|     84|								psf->sf.channels * psf->bytewidth) ;
 2956|     84|		return 0 ;
 2957|  3.63k|		} ;
 2958|  3.63k|	return 1 ;
 2959|  3.71k|} /* validate_psf */

psf_store_string:
   32|  4.05k|{	char	new_str [128] ;
   33|  4.05k|	size_t	str_len ;
   34|  4.05k|	int		k, str_flags ;
   35|       |
   36|  4.05k|	if (str == NULL)
  ------------------
  |  Branch (36:6): [True: 0, False: 4.05k]
  ------------------
   37|      0|		return SFE_STR_BAD_STRING ;
   38|       |
   39|  4.05k|	str_len = strlen (str) ;
   40|       |
   41|       |	/* A few extra checks for write mode. */
   42|  4.05k|	if (psf->file.mode == SFM_WRITE || psf->file.mode == SFM_RDWR)
  ------------------
  |  Branch (42:6): [True: 0, False: 4.05k]
  |  Branch (42:37): [True: 0, False: 4.05k]
  ------------------
   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|  4.05k|		} ;
   51|       |
   52|       |	/* Find the next free slot in table. */
   53|  78.9k|	for (k = 0 ; k < SF_MAX_STRINGS ; k++)
  ------------------
  |  |   75|  78.9k|#define SF_MAX_STRINGS			(32)
  ------------------
  |  Branch (53:15): [True: 77.3k, False: 1.58k]
  ------------------
   54|  77.3k|	{	/* If we find a matching entry clear it. */
   55|  77.3k|		if (psf->strings.data [k].type == str_type)
  ------------------
  |  Branch (55:7): [True: 1.97k, False: 75.3k]
  ------------------
   56|  1.97k|			psf->strings.data [k].type = -1 ;
   57|       |
   58|  77.3k|		if (psf->strings.data [k].type == 0)
  ------------------
  |  Branch (58:7): [True: 2.46k, False: 74.8k]
  ------------------
   59|  2.46k|			break ;
   60|  77.3k|		} ;
   61|       |
   62|       |	/* Determine flags */
   63|  4.05k|	str_flags = SF_STR_LOCATE_START ;
   64|  4.05k|	if (psf->file.mode == SFM_RDWR || psf->have_written)
  ------------------
  |  Branch (64:6): [True: 0, False: 4.05k]
  |  Branch (64:36): [True: 0, False: 4.05k]
  ------------------
   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|  4.05k|		} ;
   69|       |
   70|       |	/* More sanity checking. */
   71|  4.05k|	if (k >= SF_MAX_STRINGS)
  ------------------
  |  |   75|  4.05k|#define SF_MAX_STRINGS			(32)
  ------------------
  |  Branch (71:6): [True: 1.58k, False: 2.46k]
  ------------------
   72|  1.58k|		return SFE_STR_MAX_COUNT ;
   73|       |
   74|  2.46k|	if (k == 0 && psf->strings.storage_used != 0)
  ------------------
  |  Branch (74:6): [True: 397, False: 2.07k]
  |  Branch (74:16): [True: 0, False: 397]
  ------------------
   75|      0|	{	psf_log_printf (psf, "SFE_STR_WEIRD : k == 0 && psf->strings.storage_used != 0\n") ;
   76|      0|		return SFE_STR_WEIRD ;
   77|  2.46k|		} ;
   78|       |
   79|  2.46k|	if (k != 0 && psf->strings.storage_used == 0)
  ------------------
  |  Branch (79:6): [True: 2.07k, False: 397]
  |  Branch (79:16): [True: 0, False: 2.07k]
  ------------------
   80|      0|	{	psf_log_printf (psf, "SFE_STR_WEIRD : k != 0 && psf->strings.storage_used == 0\n") ;
   81|      0|		return SFE_STR_WEIRD ;
   82|  2.46k|		} ;
   83|       |
   84|       |	/* Special case for the first string. */
   85|  2.46k|	if (k == 0)
  ------------------
  |  Branch (85:6): [True: 397, False: 2.07k]
  ------------------
   86|    397|		psf->strings.storage_used = 0 ;
   87|       |
   88|  2.46k|	switch (str_type)
   89|  2.46k|	{	case SF_STR_SOFTWARE :
  ------------------
  |  Branch (89:4): [True: 457, False: 2.01k]
  ------------------
   90|       |				/* In write mode, want to append libsndfile-version to string. */
   91|    457|				if (psf->file.mode == SFM_WRITE || psf->file.mode == SFM_RDWR)
  ------------------
  |  Branch (91:9): [True: 0, False: 457]
  |  Branch (91:40): [True: 0, False: 457]
  ------------------
   92|      0|				{	if (strstr (str, PACKAGE_NAME) == NULL)
  ------------------
  |  |  170|      0|#define PACKAGE_NAME "libsndfile"
  ------------------
  |  Branch (92:11): [True: 0, False: 0]
  ------------------
   93|      0|					{	/*
   94|       |						** If the supplied string does not already contain a
   95|       |						** libsndfile-X.Y.Z component, then add it.
   96|       |						*/
   97|      0|						if (strlen (str) == 0)
  ------------------
  |  Branch (97:11): [True: 0, False: 0]
  ------------------
   98|      0|							snprintf (new_str, sizeof (new_str), "%s-%s", PACKAGE_NAME, PACKAGE_VERSION) ;
  ------------------
  |  |  170|      0|#define PACKAGE_NAME "libsndfile"
  ------------------
              							snprintf (new_str, sizeof (new_str), "%s-%s", PACKAGE_NAME, PACKAGE_VERSION) ;
  ------------------
  |  |  182|      0|#define PACKAGE_VERSION "1.2.2"
  ------------------
   99|      0|						else
  100|      0|							snprintf (new_str, sizeof (new_str), "%s (%s-%s)", str, PACKAGE_NAME, PACKAGE_VERSION) ;
  ------------------
  |  |  170|      0|#define PACKAGE_NAME "libsndfile"
  ------------------
              							snprintf (new_str, sizeof (new_str), "%s (%s-%s)", str, PACKAGE_NAME, PACKAGE_VERSION) ;
  ------------------
  |  |  182|      0|#define PACKAGE_VERSION "1.2.2"
  ------------------
  101|      0|						}
  102|      0|					else
  103|      0|						snprintf (new_str, sizeof (new_str), "%s", str) ;
  104|       |
  105|      0|					str = new_str ;
  106|      0|					} ;
  107|    457|				break ;
  108|       |
  109|    347|		case SF_STR_TITLE :
  ------------------
  |  Branch (109:3): [True: 347, False: 2.12k]
  ------------------
  110|    683|		case SF_STR_COPYRIGHT :
  ------------------
  |  Branch (110:3): [True: 336, False: 2.13k]
  ------------------
  111|    927|		case SF_STR_ARTIST :
  ------------------
  |  Branch (111:3): [True: 244, False: 2.22k]
  ------------------
  112|  1.25k|		case SF_STR_COMMENT :
  ------------------
  |  Branch (112:3): [True: 325, False: 2.14k]
  ------------------
  113|  1.42k|		case SF_STR_DATE :
  ------------------
  |  Branch (113:3): [True: 169, False: 2.29k]
  ------------------
  114|  1.86k|		case SF_STR_ALBUM :
  ------------------
  |  Branch (114:3): [True: 440, False: 2.02k]
  ------------------
  115|  1.86k|		case SF_STR_LICENSE :
  ------------------
  |  Branch (115:3): [True: 0, False: 2.46k]
  ------------------
  116|  1.93k|		case SF_STR_TRACKNUMBER :
  ------------------
  |  Branch (116:3): [True: 77, False: 2.39k]
  ------------------
  117|  2.01k|		case SF_STR_GENRE :
  ------------------
  |  Branch (117:3): [True: 72, False: 2.39k]
  ------------------
  118|  2.01k|				break ;
  119|       |
  120|      0|		default :
  ------------------
  |  Branch (120:3): [True: 0, False: 2.46k]
  ------------------
  121|      0|			psf_log_printf (psf, "%s : SFE_STR_BAD_TYPE\n", __func__) ;
  122|      0|			return SFE_STR_BAD_TYPE ;
  123|  2.46k|		} ;
  124|       |
  125|       |	/* Plus one to catch string terminator. */
  126|  2.46k|	str_len = strlen (str) + 1 ;
  127|       |
  128|  2.46k|	if (psf->strings.storage_used + str_len + 1 > psf->strings.storage_len)
  ------------------
  |  Branch (128:6): [True: 408, False: 2.05k]
  ------------------
  129|    408|	{	char * temp = psf->strings.storage ;
  130|    408|		size_t newlen = 2 * psf->strings.storage_len + str_len + 1 ;
  131|       |
  132|    408|		newlen = newlen < 256 ? 256 : newlen ;
  ------------------
  |  Branch (132:12): [True: 372, False: 36]
  ------------------
  133|       |
  134|    408|		char * new_storage = realloc(temp, newlen);
  135|    408|		if (new_storage == NULL)
  ------------------
  |  Branch (135:7): [True: 0, False: 408]
  ------------------
  136|      0|		{
  137|      0|			return SFE_MALLOC_FAILED ;
  138|    408|			} else {
  139|    408|			psf->strings.storage = new_storage;
  140|    408|			} ;
  141|       |
  142|    408|		psf->strings.storage_len = newlen ;
  143|  2.46k|		} ;
  144|       |
  145|  2.46k|	psf->strings.data [k].type = str_type ;
  146|  2.46k|	psf->strings.data [k].offset = psf->strings.storage_used ;
  147|  2.46k|	psf->strings.data [k].flags = str_flags ;
  148|       |
  149|  2.46k|	memcpy (psf->strings.storage + psf->strings.storage_used, str, str_len) ;
  150|  2.46k|	psf->strings.storage_used += str_len ;
  151|       |
  152|  2.46k|	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|  2.46k|	return 0 ;
  160|  2.46k|} /* psf_store_string */

svx_open:
   83|    586|{	int error ;
   84|       |
   85|    586|	if (psf->file.mode == SFM_READ || (psf->file.mode == SFM_RDWR && psf->filelength > 0))
  ------------------
  |  Branch (85:6): [True: 586, False: 0]
  |  Branch (85:37): [True: 0, False: 0]
  |  Branch (85:67): [True: 0, False: 0]
  ------------------
   86|    586|	{	if ((error = svx_read_header (psf)))
  ------------------
  |  Branch (86:8): [True: 584, False: 2]
  ------------------
   87|    584|			return error ;
   88|       |
   89|      2|		psf->endian = SF_ENDIAN_BIG ;			/* All SVX files are big endian. */
   90|       |
   91|      2|		psf->blockwidth = (sf_count_t) psf->sf.channels * psf->bytewidth ;
   92|      2|		if (psf->blockwidth)
  ------------------
  |  Branch (92:7): [True: 2, False: 0]
  ------------------
   93|      2|			psf->sf.frames = psf->datalength / psf->blockwidth ;
   94|       |
   95|      2|		psf_fseek (psf, psf->dataoffset, SEEK_SET) ;
   96|      2|		} ;
   97|       |
   98|      2|	if (psf->file.mode == SFM_WRITE || psf->file.mode == SFM_RDWR)
  ------------------
  |  Branch (98:6): [True: 0, False: 2]
  |  Branch (98:37): [True: 0, False: 2]
  ------------------
   99|      0|	{	if (psf->is_pipe)
  ------------------
  |  Branch (99:8): [True: 0, False: 0]
  ------------------
  100|      0|			return SFE_NO_PIPE_WRITE ;
  101|       |
  102|      0|		if ((SF_CONTAINER (psf->sf.format)) != SF_FORMAT_SVX)
  ------------------
  |  |  101|      0|#define SF_CONTAINER(x)		((x) & SF_FORMAT_TYPEMASK)
  ------------------
  |  Branch (102:7): [True: 0, False: 0]
  ------------------
  103|      0|			return	SFE_BAD_OPEN_FORMAT ;
  104|       |
  105|      0|		psf->endian = SF_ENDIAN (psf->sf.format) ;
  ------------------
  |  |  103|      0|#define SF_ENDIAN(x)		((x) & SF_FORMAT_ENDMASK)
  ------------------
  106|       |
  107|      0|		if (psf->endian == SF_ENDIAN_LITTLE || (CPU_IS_LITTLE_ENDIAN && psf->endian == SF_ENDIAN_CPU))
  ------------------
  |  |   14|      0|#define CPU_IS_LITTLE_ENDIAN 1
  |  |  ------------------
  |  |  |  Branch (14:30): [True: 0, Folded]
  |  |  ------------------
  ------------------
  |  Branch (107:7): [True: 0, False: 0]
  |  Branch (107:67): [True: 0, False: 0]
  ------------------
  108|      0|			return SFE_BAD_ENDIAN ;
  109|       |
  110|      0|		psf->endian = SF_ENDIAN_BIG ;			/* All SVX files are big endian. */
  111|       |
  112|      0|		error = svx_write_header (psf, SF_FALSE) ;
  113|      0|		if (error)
  ------------------
  |  Branch (113:7): [True: 0, False: 0]
  ------------------
  114|      0|			return error ;
  115|       |
  116|      0|		psf->write_header = svx_write_header ;
  117|      2|		} ;
  118|       |
  119|      2|	psf->container_close = svx_close ;
  120|       |
  121|      2|	if ((error = pcm_init (psf)))
  ------------------
  |  Branch (121:6): [True: 0, False: 2]
  ------------------
  122|      0|		return error ;
  123|       |
  124|      2|	return 0 ;
  125|      2|} /* svx_open */
svx.c:svx_read_header:
  132|    586|{	VHDR_CHUNK		vhdr ;
  133|    586|	uint32_t		chunk_size, marker ;
  134|    586|	int				filetype = 0, parsestage = 0, done = 0 ;
  135|    586|	int 			bytecount = 0, channels ;
  136|       |
  137|    586|	if (psf->filelength > 0xFFFFFFFFLL)
  ------------------
  |  Branch (137:6): [True: 0, False: 586]
  ------------------
  138|      0|		psf_log_printf (psf, "Warning : filelength > 0xffffffff. This is bad!!!!\n") ;
  139|       |
  140|    586|	memset (&vhdr, 0, sizeof (vhdr)) ;
  141|    586|	psf_binheader_readf (psf, "p", 0) ;
  142|       |
  143|       |	/* Set default number of channels. Modify later if necessary */
  144|    586|	psf->sf.channels = 1 ;
  145|       |
  146|    586|	psf->sf.format = SF_FORMAT_SVX ;
  147|       |
  148|  10.0k|	while (! done)
  ------------------
  |  Branch (148:9): [True: 10.0k, False: 42]
  ------------------
  149|  10.0k|	{	psf_binheader_readf (psf, "Em4", &marker, &chunk_size) ;
  150|       |
  151|  10.0k|		switch (marker)
  152|  10.0k|		{	case FORM_MARKER :
  ------------------
  |  |   35|    587|#define FORM_MARKER	(MAKE_MARKER ('F', 'O', 'R', 'M'))
  |  |  ------------------
  |  |  |  |  122|    587|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (152:5): [True: 587, False: 9.44k]
  ------------------
  153|    587|					if (parsestage)
  ------------------
  |  Branch (153:10): [True: 1, False: 586]
  ------------------
  154|      1|						return SFE_SVX_NO_FORM ;
  155|       |
  156|    586|					if (chunk_size != psf->filelength - 2 * sizeof (chunk_size))
  ------------------
  |  Branch (156:10): [True: 585, False: 1]
  ------------------
  157|    585|						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|    586|					parsestage |= HAVE_FORM ;
  161|       |
  162|    586|					psf_binheader_readf (psf, "m", &marker) ;
  163|       |
  164|    586|					filetype = marker ;
  165|    586|					psf_log_printf (psf, " %M\n", marker) ;
  166|    586|					parsestage |= HAVE_SVX ;
  167|    586|					break ;
  168|       |
  169|    832|			case VHDR_MARKER :
  ------------------
  |  |   38|    832|#define VHDR_MARKER	(MAKE_MARKER ('V', 'H', 'D', 'R'))
  |  |  ------------------
  |  |  |  |  122|    832|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (169:4): [True: 832, False: 9.20k]
  ------------------
  170|    832|					if (! (parsestage & (HAVE_FORM | HAVE_SVX)))
  ------------------
  |  Branch (170:10): [True: 0, False: 832]
  ------------------
  171|      0|						return SFE_SVX_NO_FORM ;
  172|       |
  173|    832|					psf_log_printf (psf, " VHDR : %d\n", chunk_size) ;
  174|       |
  175|    832|					psf_binheader_readf (psf, "E4442114", &(vhdr.oneShotHiSamples), &(vhdr.repeatHiSamples),
  176|    832|						&(vhdr.samplesPerHiCycle), &(vhdr.samplesPerSec), &(vhdr.octave), &(vhdr.compression),
  177|    832|						&(vhdr.volume)) ;
  178|       |
  179|    832|					psf_log_printf (psf, "  OneShotHiSamples  : %d\n", vhdr.oneShotHiSamples) ;
  180|    832|					psf_log_printf (psf, "  RepeatHiSamples   : %d\n", vhdr.repeatHiSamples) ;
  181|    832|					psf_log_printf (psf, "  samplesPerHiCycle : %d\n", vhdr.samplesPerHiCycle) ;
  182|    832|					psf_log_printf (psf, "  Sample Rate       : %d\n", vhdr.samplesPerSec) ;
  183|    832|					psf_log_printf (psf, "  Octave            : %d\n", vhdr.octave) ;
  184|       |
  185|    832|					psf_log_printf (psf, "  Compression       : %d => ", vhdr.compression) ;
  186|       |
  187|    832|					switch (vhdr.compression)
  ------------------
  |  Branch (187:14): [True: 378, False: 454]
  ------------------
  188|    832|					{	case 0 : psf_log_printf (psf, "None.\n") ;
  ------------------
  |  Branch (188:8): [True: 241, False: 591]
  ------------------
  189|    241|								break ;
  190|     80|						case 1 : psf_log_printf (psf, "Fibonacci delta\n") ;
  ------------------
  |  Branch (190:7): [True: 80, False: 752]
  ------------------
  191|     80|								break ;
  192|     57|						case 2 : psf_log_printf (psf, "Exponential delta\n") ;
  ------------------
  |  Branch (192:7): [True: 57, False: 775]
  ------------------
  193|     57|								break ;
  194|    832|						} ;
  195|       |
  196|    832|					psf_log_printf (psf, "  Volume            : %d\n", vhdr.volume) ;
  197|       |
  198|    832|					psf->sf.samplerate 	= vhdr.samplesPerSec ;
  199|       |
  200|    832|					if (filetype == SVX8_MARKER)
  ------------------
  |  |   36|    832|#define SVX8_MARKER	(MAKE_MARKER ('8', 'S', 'V', 'X'))
  |  |  ------------------
  |  |  |  |  122|    832|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (200:10): [True: 327, False: 505]
  ------------------
  201|    327|					{	psf->sf.format |= SF_FORMAT_PCM_S8 ;
  202|    327|						psf->bytewidth = 1 ;
  203|    327|						}
  204|    505|					else if (filetype == SV16_MARKER)
  ------------------
  |  |   37|    505|#define SV16_MARKER	(MAKE_MARKER ('1', '6', 'S', 'V'))
  |  |  ------------------
  |  |  |  |  122|    505|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (204:15): [True: 505, False: 0]
  ------------------
  205|    505|					{	psf->sf.format |= SF_FORMAT_PCM_16 ;
  206|    505|						psf->bytewidth = 2 ;
  207|    505|						} ;
  208|       |
  209|    832|					parsestage |= HAVE_VHDR ;
  210|    832|					break ;
  211|       |
  212|    255|			case BODY_MARKER :
  ------------------
  |  |   39|    255|#define BODY_MARKER	(MAKE_MARKER ('B', 'O', 'D', 'Y'))
  |  |  ------------------
  |  |  |  |  122|    255|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (212:4): [True: 255, False: 9.78k]
  ------------------
  213|    255|					if (! (parsestage & HAVE_VHDR))
  ------------------
  |  Branch (213:10): [True: 1, False: 254]
  ------------------
  214|      1|						return SFE_SVX_NO_BODY ;
  215|       |
  216|    254|					psf->datalength = chunk_size ;
  217|       |
  218|    254|					psf->dataoffset = psf_ftell (psf) ;
  219|    254|					if (psf->dataoffset < 0)
  ------------------
  |  Branch (219:10): [True: 0, False: 254]
  ------------------
  220|      0|						return SFE_SVX_NO_BODY ;
  221|       |
  222|    254|					if (psf->datalength > psf->filelength - psf->dataoffset)
  ------------------
  |  Branch (222:10): [True: 7, False: 247]
  ------------------
  223|      7|					{	psf_log_printf (psf, " BODY : %D (should be %D)\n", psf->datalength, psf->filelength - psf->dataoffset) ;
  224|      7|						psf->datalength = psf->filelength - psf->dataoffset ;
  225|      7|						}
  226|    247|					else
  227|    247|						psf_log_printf (psf, " BODY : %D\n", psf->datalength) ;
  228|       |
  229|    254|					parsestage |= HAVE_BODY ;
  230|       |
  231|    254|					if (! psf->sf.seekable)
  ------------------
  |  Branch (231:10): [True: 0, False: 254]
  ------------------
  232|      0|						break ;
  233|       |
  234|    254|					psf_fseek (psf, psf->datalength, SEEK_CUR) ;
  235|    254|					break ;
  236|       |
  237|  1.13k|			case NAME_MARKER :
  ------------------
  |  |   45|  1.13k|#define NAME_MARKER	(MAKE_MARKER ('N', 'A', 'M', 'E'))
  |  |  ------------------
  |  |  |  |  122|  1.13k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (237:4): [True: 1.13k, False: 8.90k]
  ------------------
  238|  1.13k|					if (! (parsestage & HAVE_SVX))
  ------------------
  |  Branch (238:10): [True: 0, False: 1.13k]
  ------------------
  239|      0|						return SFE_SVX_NO_FORM ;
  240|       |
  241|  1.13k|					psf_log_printf (psf, " %M : %u\n", marker, chunk_size) ;
  242|       |
  243|  1.13k|					if (strlen (psf->file.name) != chunk_size)
  ------------------
  |  Branch (243:10): [True: 474, False: 656]
  ------------------
  244|    474|					{	if (chunk_size > sizeof (psf->file.name) - 1)
  ------------------
  |  Branch (244:12): [True: 15, False: 459]
  ------------------
  245|     15|							return SFE_SVX_BAD_NAME_LENGTH ;
  246|       |
  247|    459|						psf_binheader_readf (psf, "b", psf->file.name, chunk_size) ;
  248|    459|						psf->file.name [chunk_size] = 0 ;
  249|    459|						}
  250|    656|					else
  251|    656|						psf_binheader_readf (psf, "j", chunk_size) ;
  252|  1.11k|					break ;
  253|       |
  254|  1.11k|			case ANNO_MARKER :
  ------------------
  |  |   47|    218|#define ANNO_MARKER	(MAKE_MARKER ('A', 'N', 'N', 'O'))
  |  |  ------------------
  |  |  |  |  122|    218|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (254:4): [True: 218, False: 9.81k]
  ------------------
  255|    218|					if (! (parsestage & HAVE_SVX))
  ------------------
  |  Branch (255:10): [True: 0, False: 218]
  ------------------
  256|      0|						return SFE_SVX_NO_FORM ;
  257|       |
  258|    218|					psf_log_printf (psf, " %M : %u\n", marker, chunk_size) ;
  259|       |
  260|    218|					psf_binheader_readf (psf, "j", chunk_size) ;
  261|    218|					break ;
  262|       |
  263|  1.78k|			case CHAN_MARKER :
  ------------------
  |  |   48|  1.78k|#define CHAN_MARKER	(MAKE_MARKER ('C', 'H', 'A', 'N'))
  |  |  ------------------
  |  |  |  |  122|  1.78k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (263:4): [True: 1.78k, False: 8.25k]
  ------------------
  264|  1.78k|					if (! (parsestage & HAVE_SVX))
  ------------------
  |  Branch (264:10): [True: 0, False: 1.78k]
  ------------------
  265|      0|						return SFE_SVX_NO_FORM ;
  266|       |
  267|  1.78k|					psf_log_printf (psf, " %M : %u\n", marker, chunk_size) ;
  268|       |
  269|  1.78k|					bytecount += psf_binheader_readf (psf, "E4", &channels) ;
  270|       |
  271|  1.78k|					if (channels == 2 || channels == 4)
  ------------------
  |  Branch (271:10): [True: 362, False: 1.41k]
  |  Branch (271:27): [True: 443, False: 975]
  ------------------
  272|    805|						psf_log_printf (psf, "  Channels : %d => mono\n", channels) ;
  273|    975|					else if (channels == 6)
  ------------------
  |  Branch (273:15): [True: 67, False: 908]
  ------------------
  274|     67|					{	psf->sf.channels = 2 ;
  275|     67|						psf_log_printf (psf, "  Channels : %d => stereo\n", channels) ;
  276|     67|						}
  277|    908|					else
  278|    908|						psf_log_printf (psf, "  Channels : %d *** assuming mono\n", channels) ;
  279|       |
  280|  1.78k|					psf_binheader_readf (psf, "j", chunk_size - bytecount) ;
  281|  1.78k|					break ;
  282|       |
  283|       |
  284|    200|			case AUTH_MARKER :
  ------------------
  |  |   46|    200|#define AUTH_MARKER	(MAKE_MARKER ('A', 'U', 'T', 'H'))
  |  |  ------------------
  |  |  |  |  122|    200|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (284:4): [True: 200, False: 9.83k]
  ------------------
  285|    767|			case c_MARKER :
  ------------------
  |  |   44|    767|#define c_MARKER	(MAKE_MARKER ('(', 'c', ')', ' '))
  |  |  ------------------
  |  |  |  |  122|    767|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (285:4): [True: 567, False: 9.46k]
  ------------------
  286|    767|					if (! (parsestage & HAVE_SVX))
  ------------------
  |  Branch (286:10): [True: 0, False: 767]
  ------------------
  287|      0|						return SFE_SVX_NO_FORM ;
  288|       |
  289|    767|					psf_log_printf (psf, " %M : %u\n", marker, chunk_size) ;
  290|       |
  291|    767|					psf_binheader_readf (psf, "j", chunk_size) ;
  292|    767|					break ;
  293|       |
  294|  4.46k|			default :
  ------------------
  |  Branch (294:4): [True: 4.46k, False: 5.56k]
  ------------------
  295|  4.46k|					if (chunk_size >= 0xffff0000)
  ------------------
  |  Branch (295:10): [True: 15, False: 4.45k]
  ------------------
  296|     15|					{	done = SF_TRUE ;
  297|     15|						psf_log_printf (psf, "*** Unknown chunk marker (%X) at position %D with length %u. Exiting parser.\n", marker, psf_ftell (psf) - 8, chunk_size) ;
  298|     15|						break ;
  299|  4.45k|						} ;
  300|       |
  301|  4.45k|					if (psf_isprint ((marker >> 24) & 0xFF) && psf_isprint ((marker >> 16) & 0xFF)
  ------------------
  |  Branch (301:10): [True: 3.58k, False: 865]
  |  Branch (301:49): [True: 3.00k, False: 585]
  ------------------
  302|  3.00k|						&& psf_isprint ((marker >> 8) & 0xFF) && psf_isprint (marker & 0xFF))
  ------------------
  |  Branch (302:10): [True: 2.19k, False: 807]
  |  Branch (302:48): [True: 1.79k, False: 396]
  ------------------
  303|  1.79k|					{	psf_log_printf (psf, "%M : %u (unknown marker)\n", marker, chunk_size) ;
  304|  1.79k|						psf_binheader_readf (psf, "j", chunk_size) ;
  305|  1.79k|						break ;
  306|  2.65k|						} ;
  307|  2.65k|					if ((chunk_size = psf_ftell (psf)) & 0x03)
  ------------------
  |  Branch (307:10): [True: 2.57k, False: 76]
  ------------------
  308|  2.57k|					{	psf_log_printf (psf, "  Unknown chunk marker at position %d. Resynching.\n", chunk_size - 4) ;
  309|       |
  310|  2.57k|						chunk_size = chunk_size & 3 ;
  311|  2.57k|						psf_binheader_readf (psf, "j", 4 - chunk_size) ;
  312|  2.57k|						break ;
  313|  2.57k|						} ;
  314|     76|					psf_log_printf (psf, "*** Unknown chunk marker (%X) at position %D. Exiting parser.\n", marker, psf_ftell (psf) - 8) ;
  315|     76|					done = SF_TRUE ;
  316|  10.0k|			} ;	/* switch (marker) */
  317|       |
  318|  10.0k|		if (! psf->sf.seekable && (parsestage & HAVE_BODY))
  ------------------
  |  Branch (318:7): [True: 0, False: 10.0k]
  |  Branch (318:29): [True: 0, False: 0]
  ------------------
  319|      0|			break ;
  320|       |
  321|  10.0k|		if (psf_ftell (psf) >= psf->filelength - SIGNED_SIZEOF (chunk_size))
  ------------------
  |  |   86|  10.0k|#define		SIGNED_SIZEOF(x)	((int) sizeof (x))
  ------------------
  |  Branch (321:7): [True: 527, False: 9.49k]
  ------------------
  322|    527|			break ;
  323|  10.0k|		} ; /* while (1) */
  324|       |
  325|    569|	if (vhdr.compression)
  ------------------
  |  Branch (325:6): [True: 34, False: 535]
  ------------------
  326|     34|		return SFE_SVX_BAD_COMP ;
  327|       |
  328|    535|	if (psf->dataoffset <= 0)
  ------------------
  |  Branch (328:6): [True: 533, False: 2]
  ------------------
  329|    533|		return SFE_SVX_NO_DATA ;
  330|       |
  331|      2|	return 0 ;
  332|    535|} /* svx_read_header */
svx.c:svx_close:
  336|      2|{
  337|      2|	if (psf->file.mode == SFM_WRITE || psf->file.mode == SFM_RDWR)
  ------------------
  |  Branch (337:6): [True: 0, False: 2]
  |  Branch (337:37): [True: 0, False: 2]
  ------------------
  338|      0|		svx_write_header (psf, SF_TRUE) ;
  339|       |
  340|      2|	return 0 ;
  341|      2|} /* 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|    312|{
   40|    312|	if (psf->file.mode == SFM_READ || psf->file.mode == SFM_RDWR)
  ------------------
  |  Branch (40:6): [True: 312, False: 0]
  |  Branch (40:36): [True: 0, False: 0]
  ------------------
   41|    312|	{	psf->read_short		= ulaw_read_ulaw2s ;
   42|    312|		psf->read_int		= ulaw_read_ulaw2i ;
   43|    312|		psf->read_float		= ulaw_read_ulaw2f ;
   44|    312|		psf->read_double	= ulaw_read_ulaw2d ;
   45|    312|		} ;
   46|       |
   47|    312|	if (psf->file.mode == SFM_WRITE || psf->file.mode == SFM_RDWR)
  ------------------
  |  Branch (47:6): [True: 0, False: 312]
  |  Branch (47:37): [True: 0, False: 312]
  ------------------
   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|    312|	psf->bytewidth = 1 ;
   55|    312|	psf->blockwidth = psf->sf.channels ;
   56|       |
   57|    312|	if (psf->filelength > psf->dataoffset)
  ------------------
  |  Branch (57:6): [True: 227, False: 85]
  ------------------
   58|    227|		psf->datalength = (psf->dataend) ? psf->dataend - psf->dataoffset :
  ------------------
  |  Branch (58:21): [True: 114, False: 113]
  ------------------
   59|    227|							psf->filelength - psf->dataoffset ;
   60|     85|	else
   61|     85|		psf->datalength = 0 ;
   62|       |
   63|    312|	psf->sf.frames = psf->blockwidth > 0 ? psf->datalength / psf->blockwidth : 0 ;
  ------------------
  |  Branch (63:19): [True: 271, False: 41]
  ------------------
   64|       |
   65|    312|	return 0 ;
   66|    312|} /* ulaw_init */
ulaw.c:ulaw_read_ulaw2s:
  873|  1.06M|{	BUF_UNION	ubuf ;
  874|  1.06M|	int			bufferlen, readcount ;
  875|  1.06M|	sf_count_t	total = 0 ;
  876|       |
  877|  1.06M|	bufferlen = ARRAY_LEN (ubuf.ucbuf) ;
  ------------------
  |  |   88|  1.06M|#define		ARRAY_LEN(x)	((int) (sizeof (x) / sizeof ((x) [0])))
  ------------------
  878|       |
  879|  2.12M|	while (len > 0)
  ------------------
  |  Branch (879:9): [True: 1.06M, False: 1.06M]
  ------------------
  880|  1.06M|	{	if (len < bufferlen)
  ------------------
  |  Branch (880:8): [True: 1.06M, False: 0]
  ------------------
  881|  1.06M|			bufferlen = (int) len ;
  882|  1.06M|		readcount = (int) psf_fread (ubuf.ucbuf, 1, bufferlen, psf) ;
  883|  1.06M|		ulaw2s_array (ubuf.ucbuf, readcount, ptr + total) ;
  884|  1.06M|		total += readcount ;
  885|  1.06M|		if (readcount < bufferlen)
  ------------------
  |  Branch (885:7): [True: 29, False: 1.06M]
  ------------------
  886|     29|			break ;
  887|  1.06M|		len -= readcount ;
  888|  1.06M|		} ;
  889|       |
  890|  1.06M|	return total ;
  891|  1.06M|} /* ulaw_read_ulaw2s */
ulaw.c:ulaw2s_array:
  796|  2.16M|{	for (int i = 0 ; i < count ; i++)
  ------------------
  |  Branch (796:20): [True: 1.10M, False: 1.06M]
  ------------------
  797|  1.10M|		ptr [i] = ulaw_decode [(int) buffer [i]] ;
  798|  1.06M|} /* ulaw2s_array */

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

vox_adpcm_init:
   72|    249|{	IMA_OKI_ADPCM *pvox = NULL ;
   73|       |
   74|    249|	if (psf->file.mode == SFM_RDWR)
  ------------------
  |  Branch (74:6): [True: 0, False: 249]
  ------------------
   75|      0|		return SFE_BAD_MODE_RW ;
   76|       |
   77|    249|	if (psf->file.mode == SFM_WRITE && psf->sf.channels != 1)
  ------------------
  |  Branch (77:6): [True: 0, False: 249]
  |  Branch (77:37): [True: 0, False: 0]
  ------------------
   78|      0|		return SFE_CHANNEL_COUNT ;
   79|       |
   80|    249|	if ((pvox = malloc (sizeof (IMA_OKI_ADPCM))) == NULL)
  ------------------
  |  Branch (80:6): [True: 0, False: 249]
  ------------------
   81|      0|		return SFE_MALLOC_FAILED ;
   82|       |
   83|    249|	psf->codec_data = (void*) pvox ;
   84|    249|	memset (pvox, 0, sizeof (IMA_OKI_ADPCM)) ;
   85|       |
   86|    249|	if (psf->file.mode == SFM_WRITE)
  ------------------
  |  Branch (86:6): [True: 0, False: 249]
  ------------------
   87|      0|	{	psf->write_short	= vox_write_s ;
   88|      0|		psf->write_int		= vox_write_i ;
   89|      0|		psf->write_float	= vox_write_f ;
   90|      0|		psf->write_double	= vox_write_d ;
   91|      0|		}
   92|    249|	else
   93|    249|	{	psf_log_printf (psf, "Header-less OKI Dialogic ADPCM encoded file.\n") ;
   94|    249|		psf_log_printf (psf, "Setting up for 8kHz, mono, Vox ADPCM.\n") ;
   95|       |
   96|    249|		psf->read_short		= vox_read_s ;
   97|    249|		psf->read_int		= vox_read_i ;
   98|    249|		psf->read_float		= vox_read_f ;
   99|    249|		psf->read_double	= vox_read_d ;
  100|    249|		} ;
  101|       |
  102|       |	/* Standard sample rate chennels etc. */
  103|    249|	if (psf->sf.samplerate < 1)
  ------------------
  |  Branch (103:6): [True: 0, False: 249]
  ------------------
  104|      0|		psf->sf.samplerate	= 8000 ;
  105|    249|	psf->sf.channels	= 1 ;
  106|       |
  107|    249|	psf->sf.frames = psf->filelength * 2 ;
  108|       |
  109|    249|	psf->sf.seekable = SF_FALSE ;
  110|    249|	psf->codec_close = codec_close ;
  111|       |
  112|       |	/* Seek back to start of data. */
  113|    249|	if (psf_fseek (psf, 0 , SEEK_SET) == -1)
  ------------------
  |  Branch (113:6): [True: 0, False: 249]
  ------------------
  114|      0|		return SFE_BAD_SEEK ;
  115|       |
  116|    249|	ima_oki_adpcm_init (pvox, IMA_OKI_ADPCM_TYPE_OKI) ;
  117|       |
  118|    249|	return 0 ;
  119|    249|} /* vox_adpcm_init */
vox_adpcm.c:codec_close:
   62|    249|{
   63|    249|	IMA_OKI_ADPCM * p = (IMA_OKI_ADPCM *) psf->codec_data ;
   64|       |
   65|    249|	if (p->errors)
  ------------------
  |  Branch (65:6): [True: 163, False: 86]
  ------------------
   66|    163|		psf_log_printf (psf, "*** Warning : ADPCM state errors: %d\n", p->errors) ;
   67|    249|	return p->errors ;
   68|    249|} /* code_close */
vox_adpcm.c:vox_read_s:
  153|  4.10k|{	IMA_OKI_ADPCM 	*pvox ;
  154|  4.10k|	int			readcount, count ;
  155|  4.10k|	sf_count_t	total = 0 ;
  156|       |
  157|  4.10k|	if (! psf->codec_data)
  ------------------
  |  Branch (157:6): [True: 0, False: 4.10k]
  ------------------
  158|      0|		return 0 ;
  159|  4.10k|	pvox = (IMA_OKI_ADPCM*) psf->codec_data ;
  160|       |
  161|  7.95k|	while (len > 0)
  ------------------
  |  Branch (161:9): [True: 4.10k, False: 3.85k]
  ------------------
  162|  4.10k|	{	readcount = (len > 0x10000000) ? 0x10000000 : (int) len ;
  ------------------
  |  Branch (162:16): [True: 0, False: 4.10k]
  ------------------
  163|       |
  164|  4.10k|		count = vox_read_block (psf, pvox, ptr, readcount) ;
  165|       |
  166|  4.10k|		total += count ;
  167|  4.10k|		len -= count ;
  168|  4.10k|		if (count != readcount)
  ------------------
  |  Branch (168:7): [True: 247, False: 3.85k]
  ------------------
  169|    247|			break ;
  170|  4.10k|		} ;
  171|       |
  172|  4.10k|	return total ;
  173|  4.10k|} /* vox_read_s */
vox_adpcm.c:vox_read_block:
  126|  4.10k|{	int	indx = 0, k ;
  127|       |
  128|  7.95k|	while (indx < len)
  ------------------
  |  Branch (128:9): [True: 4.10k, False: 3.85k]
  ------------------
  129|  4.10k|	{	pvox->code_count = (len - indx > IMA_OKI_ADPCM_PCM_LEN) ? IMA_OKI_ADPCM_CODE_LEN : (len - indx + 1) / 2 ;
  ------------------
  |  |   24|  4.10k|#define		IMA_OKI_ADPCM_PCM_LEN	(IMA_OKI_ADPCM_CODE_LEN *2)
  |  |  ------------------
  |  |  |  |   23|  4.10k|#define		IMA_OKI_ADPCM_CODE_LEN	256
  |  |  ------------------
  ------------------
              	{	pvox->code_count = (len - indx > IMA_OKI_ADPCM_PCM_LEN) ? IMA_OKI_ADPCM_CODE_LEN : (len - indx + 1) / 2 ;
  ------------------
  |  |   23|      0|#define		IMA_OKI_ADPCM_CODE_LEN	256
  ------------------
  |  Branch (129:23): [True: 0, False: 4.10k]
  ------------------
  130|       |
  131|  4.10k|		if ((k = (int) psf_fread (pvox->codes, 1, pvox->code_count, psf)) != pvox->code_count)
  ------------------
  |  Branch (131:7): [True: 247, False: 3.85k]
  ------------------
  132|    247|		{	if (psf_ftell (psf) != psf->filelength)
  ------------------
  |  Branch (132:9): [True: 0, False: 247]
  ------------------
  133|      0|				psf_log_printf (psf, "*** Warning : short read (%d != %d).\n", k, pvox->code_count) ;
  134|    247|			if (k == 0)
  ------------------
  |  Branch (134:8): [True: 247, False: 0]
  ------------------
  135|    247|				break ;
  136|  3.85k|			} ;
  137|       |
  138|  3.85k|		pvox->code_count = k ;
  139|       |
  140|  3.85k|		ima_oki_adpcm_decode_block (pvox) ;
  141|       |
  142|  3.85k|		pvox->pcm_count = SF_MIN (pvox->pcm_count, len - indx) ;
  ------------------
  |  |   91|  3.85k|#define		SF_MIN(a, b)	((a) < (b) ? (a) : (b))
  |  |  ------------------
  |  |  |  Branch (91:24): [True: 0, False: 3.85k]
  |  |  ------------------
  ------------------
  143|  3.85k|		memcpy (&(ptr [indx]), pvox->pcm, pvox->pcm_count * sizeof (short)) ;
  144|  3.85k|		indx += pvox->pcm_count ;
  145|  3.85k|		} ;
  146|       |
  147|  4.10k|	return indx ;
  148|  4.10k|} /* vox_read_block */

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

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

wavlike_read_fmt_chunk:
  125|  1.71k|{	WAVLIKE_PRIVATE * wpriv ;
  126|  1.71k|	WAV_FMT *wav_fmt ;
  127|  1.71k|	int	bytesread, k, bytespersec = 0 ;
  128|       |
  129|  1.71k|	if ((wpriv = psf->container_data) == NULL)
  ------------------
  |  Branch (129:6): [True: 0, False: 1.71k]
  ------------------
  130|      0|		return SFE_INTERNAL ;
  131|  1.71k|	wav_fmt = &wpriv->wav_fmt ;
  132|       |
  133|  1.71k|	memset (wav_fmt, 0, sizeof (WAV_FMT)) ;
  134|       |
  135|  1.71k|	if (fmtsize < 16)
  ------------------
  |  Branch (135:6): [True: 36, False: 1.67k]
  ------------------
  136|     36|		return SFE_WAV_FMT_SHORT ;
  137|       |
  138|       |	/* assume psf->rwf_endian is already properly set */
  139|       |
  140|       |	/* Read the minimal WAV file header here. */
  141|  1.67k|	bytesread = psf_binheader_readf (psf, "224422",
  142|  1.67k|					&(wav_fmt->format), &(wav_fmt->min.channels),
  143|  1.67k|					&(wav_fmt->min.samplerate), &(wav_fmt->min.bytespersec),
  144|  1.67k|					&(wav_fmt->min.blockalign), &(wav_fmt->min.bitwidth)) ;
  145|       |
  146|  1.67k|	psf_log_printf (psf, "  Format        : 0x%X => %s\n", wav_fmt->format, wavlike_format_str (wav_fmt->format)) ;
  147|  1.67k|	psf_log_printf (psf, "  Channels      : %d\n", wav_fmt->min.channels) ;
  148|  1.67k|	psf_log_printf (psf, "  Sample Rate   : %d\n", wav_fmt->min.samplerate) ;
  149|       |
  150|  1.67k|	if (wav_fmt->format == WAVE_FORMAT_PCM && wav_fmt->min.blockalign == 0
  ------------------
  |  Branch (150:6): [True: 314, False: 1.36k]
  |  Branch (150:44): [True: 77, False: 237]
  ------------------
  151|     77|		&& wav_fmt->min.bitwidth > 0 && wav_fmt->min.channels > 0)
  ------------------
  |  Branch (151:6): [True: 52, False: 25]
  |  Branch (151:35): [True: 45, False: 7]
  ------------------
  152|     45|	{	wav_fmt->min.blockalign = wav_fmt->min.bitwidth / 8 + (wav_fmt->min.bitwidth % 8 > 0 ? 1 : 0) ;
  ------------------
  |  Branch (152:59): [True: 21, False: 24]
  ------------------
  153|     45|		wav_fmt->min.blockalign *= wav_fmt->min.channels ;
  154|     45|		psf_log_printf (psf, "  Block Align   : 0 (should be %d)\n", wav_fmt->min.blockalign) ;
  155|     45|		}
  156|  1.63k|	else
  157|  1.63k|		psf_log_printf (psf, "  Block Align   : %d\n", wav_fmt->min.blockalign) ;
  158|       |
  159|  1.67k|	if (wav_fmt->format == WAVE_FORMAT_PCM && wav_fmt->min.bitwidth == 24 &&
  ------------------
  |  Branch (159:6): [True: 314, False: 1.36k]
  |  Branch (159:44): [True: 50, False: 264]
  ------------------
  160|     50|			wav_fmt->min.blockalign == 4 * wav_fmt->min.channels)
  ------------------
  |  Branch (160:4): [True: 43, False: 7]
  ------------------
  161|     43|	{	psf_log_printf (psf, "  Bit Width     : 24\n") ;
  162|       |
  163|     43|		psf_log_printf (psf, "\n"
  164|     43|			"  Ambiguous information in 'fmt ' chunk. Possible file types:\n"
  165|     43|			"    0) Invalid IEEE float file generated by Syntrillium's Cooledit!\n"
  166|     43|			"    1) File generated by ALSA's arecord containing 24 bit samples in 32 bit containers.\n"
  167|     43|			"    2) 24 bit file with incorrect Block Align value.\n"
  168|     43|			"\n") ;
  169|       |
  170|     43|		wpriv->fmt_is_broken = 1 ;
  171|     43|		}
  172|  1.63k|	else if (wav_fmt->min.bitwidth == 0)
  ------------------
  |  Branch (172:11): [True: 163, False: 1.47k]
  ------------------
  173|    163|	{	switch (wav_fmt->format)
  174|    163|		{	case WAVE_FORMAT_GSM610 :
  ------------------
  |  Branch (174:5): [True: 14, False: 149]
  ------------------
  175|     15|			case WAVE_FORMAT_IPP_ITU_G_723_1 :
  ------------------
  |  Branch (175:4): [True: 1, False: 162]
  ------------------
  176|     16|			case WAVE_FORMAT_MPEGLAYER3 :
  ------------------
  |  Branch (176:4): [True: 1, False: 162]
  ------------------
  177|     16|					psf_log_printf (psf, "  Bit Width     : %d\n", wav_fmt->min.bitwidth) ;
  178|     16|					break ;
  179|    147|			default :
  ------------------
  |  Branch (179:4): [True: 147, False: 16]
  ------------------
  180|    147|					psf_log_printf (psf, "  Bit Width     : %d (should not be 0)\n", wav_fmt->min.bitwidth) ;
  181|    163|			}
  182|    163|		}
  183|  1.47k|	else
  184|  1.47k|	{	switch (wav_fmt->format)
  185|  1.47k|		{	case WAVE_FORMAT_GSM610 :
  ------------------
  |  Branch (185:5): [True: 8, False: 1.46k]
  ------------------
  186|      9|			case WAVE_FORMAT_IPP_ITU_G_723_1 :
  ------------------
  |  Branch (186:4): [True: 1, False: 1.47k]
  ------------------
  187|     17|			case WAVE_FORMAT_MPEGLAYER3 :
  ------------------
  |  Branch (187:4): [True: 8, False: 1.46k]
  ------------------
  188|     17|					psf_log_printf (psf, "  Bit Width     : %d (should be 0)\n", wav_fmt->min.bitwidth) ;
  189|     17|					break ;
  190|  1.45k|			default :
  ------------------
  |  Branch (190:4): [True: 1.45k, False: 17]
  ------------------
  191|  1.45k|					psf_log_printf (psf, "  Bit Width     : %d\n", wav_fmt->min.bitwidth) ;
  192|  1.47k|			}
  193|  1.67k|		} ;
  194|       |
  195|  1.67k|	psf->sf.samplerate	= wav_fmt->min.samplerate ;
  196|  1.67k|	psf->sf.frames 		= 0 ;					/* Correct this when reading data chunk. */
  197|  1.67k|	psf->sf.channels	= wav_fmt->min.channels ;
  198|       |
  199|  1.67k|	switch (wav_fmt->format)
  200|  1.67k|	{	case WAVE_FORMAT_PCM :
  ------------------
  |  Branch (200:4): [True: 314, False: 1.36k]
  ------------------
  201|    456|		case WAVE_FORMAT_IEEE_FLOAT :
  ------------------
  |  Branch (201:3): [True: 142, False: 1.53k]
  ------------------
  202|    456|				bytespersec = wav_fmt->min.samplerate * wav_fmt->min.blockalign ;
  203|    456|				if (wav_fmt->min.bytespersec != (unsigned) bytespersec)
  ------------------
  |  Branch (203:9): [True: 428, False: 28]
  ------------------
  204|    428|					psf_log_printf (psf, "  Bytes/sec     : %d (should be %d)\n", wav_fmt->min.bytespersec, bytespersec) ;
  205|     28|				else
  206|     28|					psf_log_printf (psf, "  Bytes/sec     : %d\n", wav_fmt->min.bytespersec) ;
  207|       |
  208|    456|				psf->bytewidth = BITWIDTH2BYTES (wav_fmt->min.bitwidth) ;
  ------------------
  |  |   80|    456|#define	BITWIDTH2BYTES(x)	(((x) + 7) / 8)
  ------------------
  209|    456|				break ;
  210|       |
  211|    161|		case WAVE_FORMAT_ALAW :
  ------------------
  |  Branch (211:3): [True: 161, False: 1.51k]
  ------------------
  212|    343|		case WAVE_FORMAT_MULAW :
  ------------------
  |  Branch (212:3): [True: 182, False: 1.49k]
  ------------------
  213|    343|				if (wav_fmt->min.bytespersec != wav_fmt->min.samplerate * wav_fmt->min.blockalign)
  ------------------
  |  Branch (213:9): [True: 331, False: 12]
  ------------------
  214|    331|					psf_log_printf (psf, "  Bytes/sec     : %d (should be %d)\n", wav_fmt->min.bytespersec, wav_fmt->min.samplerate * wav_fmt->min.blockalign) ;
  215|     12|				else
  216|     12|					psf_log_printf (psf, "  Bytes/sec     : %d\n", wav_fmt->min.bytespersec) ;
  217|       |
  218|    343|				psf->bytewidth = 1 ;
  219|    343|				if (fmtsize >= 18)
  ------------------
  |  Branch (219:9): [True: 90, False: 253]
  ------------------
  220|     90|				{	bytesread += psf_binheader_readf (psf, "2", &(wav_fmt->size20.extrabytes)) ;
  221|     90|					psf_log_printf (psf, "  Extra Bytes   : %d\n", wav_fmt->size20.extrabytes) ;
  222|     90|					} ;
  223|    343|				break ;
  224|       |
  225|    222|		case WAVE_FORMAT_IMA_ADPCM :
  ------------------
  |  Branch (225:3): [True: 222, False: 1.45k]
  ------------------
  226|    222|				if (wav_fmt->min.bitwidth != 4)
  ------------------
  |  Branch (226:9): [True: 1, False: 221]
  ------------------
  227|      1|					return SFE_WAV_ADPCM_NOT4BIT ;
  228|    221|				if (wav_fmt->min.channels < 1 || wav_fmt->min.channels > 2)
  ------------------
  |  Branch (228:9): [True: 1, False: 220]
  |  Branch (228:38): [True: 3, False: 217]
  ------------------
  229|      4|					return SFE_WAV_ADPCM_CHANNELS ;
  230|       |
  231|    217|				bytesread += psf_binheader_readf (psf, "22", &(wav_fmt->ima.extrabytes), &(wav_fmt->ima.samplesperblock)) ;
  232|    217|				psf_log_printf (psf, "  Extra Bytes   : %d\n", wav_fmt->ima.extrabytes) ;
  233|    217|				if (wav_fmt->ima.samplesperblock < 1)
  ------------------
  |  Branch (233:9): [True: 1, False: 216]
  ------------------
  234|      1|				{	psf_log_printf (psf, "  Samples/Block : %d (should be > 0)\n", wav_fmt->ima.samplesperblock) ;
  235|      1|					return SFE_WAV_ADPCM_SAMPLES ;
  236|      1|					}
  237|    216|				else
  238|    216|					psf_log_printf (psf, "  Samples/Block : %d\n", wav_fmt->ima.samplesperblock) ;
  239|       |
  240|    216|				bytespersec = (wav_fmt->ima.samplerate * wav_fmt->ima.blockalign) / wav_fmt->ima.samplesperblock ;
  241|    216|				if (wav_fmt->ima.bytespersec != (unsigned) bytespersec)
  ------------------
  |  Branch (241:9): [True: 213, False: 3]
  ------------------
  242|    213|					psf_log_printf (psf, "  Bytes/sec     : %d (should be %d)\n", wav_fmt->ima.bytespersec, bytespersec) ;
  243|      3|				else
  244|      3|					psf_log_printf (psf, "  Bytes/sec     : %d\n", wav_fmt->ima.bytespersec) ;
  245|       |
  246|    216|				break ;
  247|       |
  248|    208|		case WAVE_FORMAT_MS_ADPCM :
  ------------------
  |  Branch (248:3): [True: 208, False: 1.47k]
  ------------------
  249|    208|				if (wav_fmt->msadpcm.bitwidth != 4)
  ------------------
  |  Branch (249:9): [True: 16, False: 192]
  ------------------
  250|     16|					return SFE_WAV_ADPCM_NOT4BIT ;
  251|    192|				if (wav_fmt->msadpcm.channels < 1 || wav_fmt->msadpcm.channels > 2)
  ------------------
  |  Branch (251:9): [True: 1, False: 191]
  |  Branch (251:42): [True: 12, False: 179]
  ------------------
  252|     13|					return SFE_WAV_ADPCM_CHANNELS ;
  253|       |
  254|    179|				bytesread += psf_binheader_readf (psf, "222", &(wav_fmt->msadpcm.extrabytes),
  255|    179|								&(wav_fmt->msadpcm.samplesperblock), &(wav_fmt->msadpcm.numcoeffs)) ;
  256|       |
  257|    179|				psf_log_printf (psf, "  Extra Bytes   : %d\n", wav_fmt->msadpcm.extrabytes) ;
  258|    179|				if (wav_fmt->ima.samplesperblock < 1)
  ------------------
  |  Branch (258:9): [True: 2, False: 177]
  ------------------
  259|      2|				{	psf_log_printf (psf, "  Samples/Block : %d (should be > 0)\n", wav_fmt->ima.samplesperblock) ;
  260|      2|					return SFE_WAV_ADPCM_SAMPLES ;
  261|      2|					}
  262|    177|				else
  263|    177|					psf_log_printf (psf, "  Samples/Block : %d\n", wav_fmt->ima.samplesperblock) ;
  264|       |
  265|    177|				bytespersec = (wav_fmt->min.samplerate * wav_fmt->min.blockalign) / wav_fmt->msadpcm.samplesperblock ;
  266|    177|				if (wav_fmt->min.bytespersec == (unsigned) bytespersec)
  ------------------
  |  Branch (266:9): [True: 1, False: 176]
  ------------------
  267|      1|					psf_log_printf (psf, "  Bytes/sec     : %d\n", wav_fmt->min.bytespersec) ;
  268|    176|				else if (wav_fmt->min.bytespersec == (wav_fmt->min.samplerate / wav_fmt->msadpcm.samplesperblock) * wav_fmt->min.blockalign)
  ------------------
  |  Branch (268:14): [True: 1, False: 175]
  ------------------
  269|      1|					psf_log_printf (psf, "  Bytes/sec     : %d (should be %d (MS BUG!))\n", wav_fmt->min.bytespersec, bytespersec) ;
  270|    175|				else
  271|    175|					psf_log_printf (psf, "  Bytes/sec     : %d (should be %d)\n", wav_fmt->min.bytespersec, bytespersec) ;
  272|       |
  273|    177|				if (wav_fmt->msadpcm.numcoeffs > ARRAY_LEN (wav_fmt->msadpcm.coeffs))
  ------------------
  |  |   88|    177|#define		ARRAY_LEN(x)	((int) (sizeof (x) / sizeof ((x) [0])))
  ------------------
  |  Branch (273:9): [True: 166, False: 11]
  ------------------
  274|    166|				{	psf_log_printf (psf, "  No. of Coeffs : %d (should be <= %d)\n", wav_fmt->msadpcm.numcoeffs, ARRAY_LEN (wav_fmt->msadpcm.coeffs)) ;
  ------------------
  |  |   88|    166|#define		ARRAY_LEN(x)	((int) (sizeof (x) / sizeof ((x) [0])))
  ------------------
  275|    166|					wav_fmt->msadpcm.numcoeffs = ARRAY_LEN (wav_fmt->msadpcm.coeffs) ;
  ------------------
  |  |   88|    166|#define		ARRAY_LEN(x)	((int) (sizeof (x) / sizeof ((x) [0])))
  ------------------
  276|    166|					}
  277|     11|				else
  278|     11|					psf_log_printf (psf, "  No. of Coeffs : %d\n", wav_fmt->msadpcm.numcoeffs) ;
  279|       |
  280|    177|				psf_log_printf (psf, "    Index   Coeffs1   Coeffs2\n") ;
  281|  1.35k|				for (k = 0 ; k < wav_fmt->msadpcm.numcoeffs ; k++)
  ------------------
  |  Branch (281:18): [True: 1.17k, False: 177]
  ------------------
  282|  1.17k|				{	char buffer [128] ;
  283|       |
  284|  1.17k|					bytesread +=
  285|  1.17k|						psf_binheader_readf (psf, "22", &(wav_fmt->msadpcm.coeffs [k].coeff1), &(wav_fmt->msadpcm.coeffs [k].coeff2)) ;
  286|  1.17k|					snprintf (buffer, sizeof (buffer), "     %2d     %7d   %7d\n", k, wav_fmt->msadpcm.coeffs [k].coeff1, wav_fmt->msadpcm.coeffs [k].coeff2) ;
  287|  1.17k|					psf_log_printf (psf, buffer) ;
  288|  1.17k|					} ;
  289|    177|				break ;
  290|       |
  291|     22|		case WAVE_FORMAT_GSM610 :
  ------------------
  |  Branch (291:3): [True: 22, False: 1.65k]
  ------------------
  292|     22|				if (wav_fmt->gsm610.channels != 1 || wav_fmt->gsm610.blockalign != 65)
  ------------------
  |  Branch (292:9): [True: 2, False: 20]
  |  Branch (292:42): [True: 3, False: 17]
  ------------------
  293|      5|					return SFE_WAV_GSM610_FORMAT ;
  294|       |
  295|     17|				bytesread +=
  296|     17|				psf_binheader_readf (psf, "22", &(wav_fmt->gsm610.extrabytes), &(wav_fmt->gsm610.samplesperblock)) ;
  297|       |
  298|     17|				if (wav_fmt->gsm610.samplesperblock != 320)
  ------------------
  |  Branch (298:9): [True: 1, False: 16]
  ------------------
  299|      1|					return SFE_WAV_GSM610_FORMAT ;
  300|       |
  301|     16|				bytespersec = (wav_fmt->gsm610.samplerate * wav_fmt->gsm610.blockalign) / wav_fmt->gsm610.samplesperblock ;
  302|     16|				if (wav_fmt->gsm610.bytespersec != (unsigned) bytespersec)
  ------------------
  |  Branch (302:9): [True: 15, False: 1]
  ------------------
  303|     15|					psf_log_printf (psf, "  Bytes/sec     : %d (should be %d)\n", wav_fmt->gsm610.bytespersec, bytespersec) ;
  304|      1|				else
  305|      1|					psf_log_printf (psf, "  Bytes/sec     : %d\n", wav_fmt->gsm610.bytespersec) ;
  306|       |
  307|     16|				psf_log_printf (psf, "  Extra Bytes   : %d\n", wav_fmt->gsm610.extrabytes) ;
  308|     16|				psf_log_printf (psf, "  Samples/Block : %d\n", wav_fmt->gsm610.samplesperblock) ;
  309|     16|				break ;
  310|       |
  311|      9|		case WAVE_FORMAT_MPEGLAYER3 :
  ------------------
  |  Branch (311:3): [True: 9, False: 1.66k]
  ------------------
  312|      9|				bytesread += psf_binheader_readf (psf, "24222", &(wav_fmt->mpeg3.extrabytes),
  313|      9|					&(wav_fmt->mpeg3.id), &(wav_fmt->mpeg3.flags), &(wav_fmt->mpeg3.blocksize),
  314|      9|					&(wav_fmt->mpeg3.samplesperblock), &(wav_fmt->mpeg3.codecdelay)) ;
  315|       |
  316|      9|				psf_log_printf (psf, "  Bytes/sec     : %d\n", wav_fmt->mpeg3.bytespersec) ;
  317|      9|				psf_log_printf (psf, "  Extra Bytes   : %d\n", wav_fmt->mpeg3.extrabytes) ;
  318|      9|				if (wav_fmt->mpeg3.id != 1)
  ------------------
  |  Branch (318:9): [True: 8, False: 1]
  ------------------
  319|      8|					psf_log_printf (psf, "  ID            : %d (unknown, should be 1)\n", wav_fmt->mpeg3.id) ;
  320|      1|				else
  321|      1|					psf_log_printf (psf, "  ID            : MPEGLAYER3_ID_MPEG\n") ;
  322|      9|				psf_log_printf (psf, "  Flags         : 0x%08x\n", wav_fmt->mpeg3.flags) ;
  323|      9|				psf_log_printf (psf, "  Block Size    : %d\n", wav_fmt->mpeg3.blocksize) ;
  324|      9|				psf_log_printf (psf, "  Samples/Block : %d\n", wav_fmt->mpeg3.samplesperblock) ;
  325|      9|				psf_log_printf (psf, "  Codec Delay   : %d samples\n", wav_fmt->mpeg3.codecdelay) ;
  326|      9|				break ;
  327|       |
  328|    141|		case WAVE_FORMAT_EXTENSIBLE :
  ------------------
  |  Branch (328:3): [True: 141, False: 1.53k]
  ------------------
  329|    141|				if (wav_fmt->ext.bytespersec != wav_fmt->ext.samplerate * wav_fmt->ext.blockalign)
  ------------------
  |  Branch (329:9): [True: 137, False: 4]
  ------------------
  330|    137|					psf_log_printf (psf, "  Bytes/sec     : %d (should be %d)\n", wav_fmt->ext.bytespersec, wav_fmt->ext.samplerate * wav_fmt->ext.blockalign) ;
  331|      4|				else
  332|      4|					psf_log_printf (psf, "  Bytes/sec     : %d\n", wav_fmt->ext.bytespersec) ;
  333|       |
  334|    141|				bytesread +=
  335|    141|				psf_binheader_readf (psf, "224", &(wav_fmt->ext.extrabytes), &(wav_fmt->ext.validbits),
  336|    141|						&(wav_fmt->ext.channelmask)) ;
  337|       |
  338|    141|				psf_log_printf (psf, "  Valid Bits    : %d\n", wav_fmt->ext.validbits) ;
  339|       |
  340|    141|				if (wav_fmt->ext.channelmask == 0)
  ------------------
  |  Branch (340:9): [True: 38, False: 103]
  ------------------
  341|     38|					psf_log_printf (psf, "  Channel Mask  : 0x0 (should not be zero)\n") ;
  342|    103|				else
  343|    103|				{	char buffer [512] ;
  344|    103|					unsigned bit ;
  345|       |
  346|    103|					wpriv->wavex_channelmask = wav_fmt->ext.channelmask ;
  347|       |
  348|       |					/* It's probably wise to ignore the channel mask if it is all zero */
  349|    103|					free (psf->channel_map) ;
  350|       |
  351|    103|					if ((psf->channel_map = calloc (psf->sf.channels, sizeof (psf->channel_map [0]))) == NULL)
  ------------------
  |  Branch (351:10): [True: 0, False: 103]
  ------------------
  352|      0|						return SFE_MALLOC_FAILED ;
  353|       |
  354|       |					/* Terminate the buffer we're going to append_snprintf into. */
  355|    103|					buffer [0] = 0 ;
  356|       |
  357|  1.76k|					for (bit = k = 0 ; bit < ARRAY_LEN (channel_mask_bits) && k < psf->sf.channels ; bit++)
  ------------------
  |  |   88|  3.52k|#define		ARRAY_LEN(x)	((int) (sizeof (x) / sizeof ((x) [0])))
  ------------------
  |  Branch (357:25): [True: 1.67k, False: 90]
  |  Branch (357:64): [True: 1.66k, False: 13]
  ------------------
  358|  1.66k|					{
  359|  1.66k|						if (wav_fmt->ext.channelmask & (1 << bit))
  ------------------
  |  Branch (359:11): [True: 597, False: 1.06k]
  ------------------
  360|    597|						{	if (k > psf->sf.channels)
  ------------------
  |  Branch (360:13): [True: 0, False: 597]
  ------------------
  361|      0|							{	psf_log_printf (psf, "*** More channel map bits than there are channels.\n") ;
  362|      0|								break ;
  363|    597|								} ;
  364|       |
  365|    597|							psf->channel_map [k++] = channel_mask_bits [bit].id ;
  366|    597|							append_snprintf (buffer, sizeof (buffer), "%s, ", channel_mask_bits [bit].name) ;
  367|  1.66k|							} ;
  368|  1.66k|						} ;
  369|       |
  370|       |					/* Remove trailing ", ". */
  371|    103|					bit = strlen (buffer) ;
  372|    103|					if (bit >= 2)
  ------------------
  |  Branch (372:10): [True: 86, False: 17]
  ------------------
  373|     86|					{	buffer [--bit] = 0 ;
  374|     86|						buffer [--bit] = 0 ;
  375|     86|						} ;
  376|       |
  377|    103|					if (k != psf->sf.channels)
  ------------------
  |  Branch (377:10): [True: 90, False: 13]
  ------------------
  378|     90|					{	psf_log_printf (psf, "  Channel Mask  : 0x%X\n", wav_fmt->ext.channelmask) ;
  379|     90|						psf_log_printf (psf, "*** Less channel map bits than there are channels.\n") ;
  380|     90|						}
  381|     13|					else
  382|     13|						psf_log_printf (psf, "  Channel Mask  : 0x%X (%s)\n", wav_fmt->ext.channelmask, buffer) ;
  383|    141|					} ;
  384|       |
  385|    141|				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|    141|				psf_log_printf (psf, "  Subformat\n") ;
  389|    141|				psf_log_printf (psf, "    esf_field1 : 0x%X\n", wav_fmt->ext.esf.esf_field1) ;
  390|    141|				psf_log_printf (psf, "    esf_field2 : 0x%X\n", wav_fmt->ext.esf.esf_field2) ;
  391|    141|				psf_log_printf (psf, "    esf_field3 : 0x%X\n", wav_fmt->ext.esf.esf_field3) ;
  392|    141|				psf_log_printf (psf, "    esf_field4 : ") ;
  393|  1.26k|				for (k = 0 ; k < 8 ; k++)
  ------------------
  |  Branch (393:18): [True: 1.12k, False: 141]
  ------------------
  394|  1.12k|				{	bytesread += psf_binheader_readf (psf, "1", &(wav_fmt->ext.esf.esf_field4 [k])) ;
  395|  1.12k|					psf_log_printf (psf, "0x%X ", wav_fmt->ext.esf.esf_field4 [k] & 0xFF) ;
  396|  1.12k|					} ;
  397|    141|				psf_log_printf (psf, "\n") ;
  398|    141|				psf->bytewidth = BITWIDTH2BYTES (wav_fmt->ext.bitwidth) ;
  ------------------
  |  |   80|    141|#define	BITWIDTH2BYTES(x)	(((x) + 7) / 8)
  ------------------
  399|       |
  400|       |				/* Compare GUIDs for known ones. */
  401|    141|				if (wavex_guid_equal (&wav_fmt->ext.esf, &MSGUID_SUBTYPE_PCM))
  ------------------
  |  Branch (401:9): [True: 1, False: 140]
  ------------------
  402|      1|				{	psf->sf.format = SF_FORMAT_WAVEX | u_bitwidth_to_subformat (psf->bytewidth * 8) ;
  403|      1|					psf_log_printf (psf, "    format : pcm\n") ;
  404|      1|					}
  405|    140|				else if (wavex_guid_equal (&wav_fmt->ext.esf, &MSGUID_SUBTYPE_MS_ADPCM))
  ------------------
  |  Branch (405:14): [True: 1, False: 139]
  ------------------
  406|      1|				{	psf->sf.format = (SF_FORMAT_WAVEX | SF_FORMAT_MS_ADPCM) ;
  407|      1|					psf_log_printf (psf, "    format : ms adpcm\n") ;
  408|      1|					}
  409|    139|				else if (wavex_guid_equal (&wav_fmt->ext.esf, &MSGUID_SUBTYPE_IEEE_FLOAT))
  ------------------
  |  Branch (409:14): [True: 5, False: 134]
  ------------------
  410|      5|				{	psf->sf.format = SF_FORMAT_WAVEX | ((psf->bytewidth == 8) ? SF_FORMAT_DOUBLE : SF_FORMAT_FLOAT) ;
  ------------------
  |  Branch (410:43): [True: 1, False: 4]
  ------------------
  411|      5|					psf_log_printf (psf, "    format : IEEE float\n") ;
  412|      5|					}
  413|    134|				else if (wavex_guid_equal (&wav_fmt->ext.esf, &MSGUID_SUBTYPE_ALAW))
  ------------------
  |  Branch (413:14): [True: 1, False: 133]
  ------------------
  414|      1|				{	psf->sf.format = (SF_FORMAT_WAVEX | SF_FORMAT_ALAW) ;
  415|      1|					psf_log_printf (psf, "    format : A-law\n") ;
  416|      1|					}
  417|    133|				else if (wavex_guid_equal (&wav_fmt->ext.esf, &MSGUID_SUBTYPE_MULAW))
  ------------------
  |  Branch (417:14): [True: 1, False: 132]
  ------------------
  418|      1|				{	psf->sf.format = (SF_FORMAT_WAVEX | SF_FORMAT_ULAW) ;
  419|      1|					psf_log_printf (psf, "    format : u-law\n") ;
  420|      1|					}
  421|    132|				else if (wavex_guid_equal (&wav_fmt->ext.esf, &MSGUID_SUBTYPE_AMBISONIC_B_FORMAT_PCM))
  ------------------
  |  Branch (421:14): [True: 1, False: 131]
  ------------------
  422|      1|				{	psf->sf.format = SF_FORMAT_WAVEX | u_bitwidth_to_subformat (psf->bytewidth * 8) ;
  423|      1|					psf_log_printf (psf, "    format : pcm (Ambisonic B)\n") ;
  424|      1|					wpriv->wavex_ambisonic = SF_AMBISONIC_B_FORMAT ;
  425|      1|					}
  426|    131|				else if (wavex_guid_equal (&wav_fmt->ext.esf, &MSGUID_SUBTYPE_AMBISONIC_B_FORMAT_IEEE_FLOAT))
  ------------------
  |  Branch (426:14): [True: 2, False: 129]
  ------------------
  427|      2|				{	psf->sf.format = SF_FORMAT_WAVEX | ((psf->bytewidth == 8) ? SF_FORMAT_DOUBLE : SF_FORMAT_FLOAT) ;
  ------------------
  |  Branch (427:43): [True: 1, False: 1]
  ------------------
  428|      2|					psf_log_printf (psf, "    format : IEEE float (Ambisonic B)\n") ;
  429|      2|					wpriv->wavex_ambisonic = SF_AMBISONIC_B_FORMAT ;
  430|      2|					}
  431|    129|				else
  432|    129|					return SFE_UNIMPLEMENTED ;
  433|       |
  434|     12|				break ;
  435|       |
  436|    135|		case WAVE_FORMAT_G721_ADPCM :
  ------------------
  |  Branch (436:3): [True: 135, False: 1.54k]
  ------------------
  437|    135|				psf_log_printf (psf, "  Bytes/sec     : %d\n", wav_fmt->g72x.bytespersec) ;
  438|    135|				if (fmtsize >= 20)
  ------------------
  |  Branch (438:9): [True: 79, False: 56]
  ------------------
  439|     79|				{	bytesread += psf_binheader_readf (psf, "22", &(wav_fmt->g72x.extrabytes), &(wav_fmt->g72x.auxblocksize)) ;
  440|     79|					if (wav_fmt->g72x.extrabytes == 0)
  ------------------
  |  Branch (440:10): [True: 25, False: 54]
  ------------------
  441|     25|						psf_log_printf (psf, "  Extra Bytes   : %d (should be 2)\n", wav_fmt->g72x.extrabytes) ;
  442|     54|					else
  443|     54|						psf_log_printf (psf, "  Extra Bytes   : %d\n", wav_fmt->g72x.extrabytes) ;
  444|     79|					psf_log_printf (psf, "  Aux Blk Size  : %d\n", wav_fmt->g72x.auxblocksize) ;
  445|     79|					}
  446|     56|				else if (fmtsize == 18)
  ------------------
  |  Branch (446:14): [True: 7, False: 49]
  ------------------
  447|      7|				{	bytesread += psf_binheader_readf (psf, "2", &(wav_fmt->g72x.extrabytes)) ;
  448|      7|					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: 6, False: 1]
  ------------------
  449|      7|					}
  450|     49|				else
  451|     49|					psf_log_printf (psf, "*** 'fmt ' chunk should be bigger than this!\n") ;
  452|    135|				break ;
  453|       |
  454|     67|		case WAVE_FORMAT_NMS_VBXADPCM :
  ------------------
  |  Branch (454:3): [True: 67, False: 1.61k]
  ------------------
  455|     67|				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: 1, False: 66]
  |  Branch (455:39): [True: 1, False: 65]
  |  Branch (455:68): [True: 8, False: 57]
  ------------------
  456|     10|					return SFE_WAV_NMS_FORMAT ;
  457|       |
  458|     57|				bytespersec = (wav_fmt->min.samplerate * wav_fmt->min.blockalign) / 160 ;
  459|     57|				if (wav_fmt->min.bytespersec == (unsigned) bytespersec)
  ------------------
  |  Branch (459:9): [True: 1, False: 56]
  ------------------
  460|      1|					psf_log_printf (psf, "  Bytes/sec     : %d\n", wav_fmt->min.bytespersec) ;
  461|     56|				else
  462|     56|					psf_log_printf (psf, "  Bytes/sec     : %d (should be %d)\n", wav_fmt->min.bytespersec, bytespersec) ;
  463|     57|				if (fmtsize >= 18)
  ------------------
  |  Branch (463:9): [True: 53, False: 4]
  ------------------
  464|     53|				{	bytesread += psf_binheader_readf (psf, "2", &(wav_fmt->size20.extrabytes)) ;
  465|     53|					psf_log_printf (psf, "  Extra Bytes   : %d\n", wav_fmt->size20.extrabytes) ;
  466|     53|					} ;
  467|     57|				break ;
  468|       |
  469|     75|		default :
  ------------------
  |  Branch (469:3): [True: 75, False: 1.60k]
  ------------------
  470|     75|				psf_log_printf (psf, "*** No 'fmt ' chunk dumper for this format!\n") ;
  471|     75|				return SFE_WAV_BAD_FMT ;
  472|  1.67k|		} ;
  473|       |
  474|  1.42k|	if (bytesread > fmtsize)
  ------------------
  |  Branch (474:6): [True: 6, False: 1.41k]
  ------------------
  475|      6|	{	psf_log_printf (psf, "*** wavlike_read_fmt_chunk (bytesread > fmtsize)\n") ;
  476|      6|		return SFE_WAV_BAD_FMT ;
  477|      6|		}
  478|  1.41k|	else
  479|  1.41k|		psf_binheader_readf (psf, "j", fmtsize - bytesread) ;
  480|       |
  481|  1.41k|	psf->blockwidth = wav_fmt->min.channels * psf->bytewidth ;
  482|       |
  483|  1.41k|	return 0 ;
  484|  1.42k|} /* wavlike_read_fmt_chunk */
wavlike_analyze:
  524|     42|{	unsigned char buffer [4096] ;
  525|     42|	AUDIO_DETECT ad ;
  526|     42|	int format = 0 ;
  527|       |
  528|     42|	if (psf->is_pipe)
  ------------------
  |  Branch (528:6): [True: 0, False: 42]
  ------------------
  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|     42|		} ;
  532|       |
  533|     42|	psf_log_printf (psf, "---------------------------------------------------\n"
  534|     42|						"Format is known to be broken. Using detection code.\n") ;
  535|       |
  536|       |	/* Code goes here. */
  537|     42|	ad.endianness = SF_ENDIAN_LITTLE ;
  538|     42|	ad.channels = psf->sf.channels ;
  539|       |
  540|     42|	psf_fseek (psf, 3 * 4 * 50, SEEK_SET) ;
  541|       |
  542|  2.60k|	while (psf_fread (buffer, 1, sizeof (buffer), psf) == sizeof (buffer))
  ------------------
  |  Branch (542:9): [True: 2.56k, False: 32]
  ------------------
  543|  2.56k|	{	format = audio_detect (psf, &ad, buffer, sizeof (buffer)) ;
  544|  2.56k|		if (format != 0)
  ------------------
  |  Branch (544:7): [True: 10, False: 2.55k]
  ------------------
  545|     10|			break ;
  546|  2.56k|		} ;
  547|       |
  548|       |	/* Seek to start of DATA section. */
  549|     42|	psf_fseek (psf, psf->dataoffset, SEEK_SET) ;
  550|       |
  551|     42|	if (format == 0)
  ------------------
  |  Branch (551:6): [True: 32, False: 10]
  ------------------
  552|     32|	{	psf_log_printf (psf, "wavlike_analyze : detection failed.\n") ;
  553|     32|		return ;
  554|     32|		} ;
  555|       |
  556|     10|	switch (format)
  557|     10|	{	case SF_FORMAT_PCM_32 :
  ------------------
  |  Branch (557:4): [True: 4, False: 6]
  ------------------
  558|     10|		case SF_FORMAT_FLOAT :
  ------------------
  |  Branch (558:3): [True: 6, False: 4]
  ------------------
  559|     10|			psf_log_printf (psf, "wavlike_analyze : found format : 0x%X\n", format) ;
  560|     10|			psf->sf.format = (psf->sf.format & ~SF_FORMAT_SUBMASK) + format ;
  561|     10|			psf->bytewidth = 4 ;
  562|     10|			psf->blockwidth = (sf_count_t) psf->sf.channels * psf->bytewidth ;
  563|     10|			break ;
  564|       |
  565|      0|		case SF_FORMAT_PCM_24 :
  ------------------
  |  Branch (565:3): [True: 0, False: 10]
  ------------------
  566|      0|			psf_log_printf (psf, "wavlike_analyze : found format : 0x%X\n", format) ;
  567|      0|			psf->sf.format = (psf->sf.format & ~SF_FORMAT_SUBMASK) + format ;
  568|      0|			psf->bytewidth = 3 ;
  569|      0|			psf->blockwidth = (sf_count_t) psf->sf.channels * psf->bytewidth ;
  570|      0|			break ;
  571|       |
  572|      0|		default :
  ------------------
  |  Branch (572:3): [True: 0, False: 10]
  ------------------
  573|      0|			psf_log_printf (psf, "wavlike_analyze : unhandled format : 0x%X\n", format) ;
  574|      0|			break ;
  575|     10|		} ;
  576|       |
  577|     10|	return ;
  578|     10|} /* wavlike_analyze */
wavlike_format_str:
  702|  1.67k|{	int lower, upper, mid ;
  703|       |
  704|  1.67k|	lower = -1 ;
  705|  1.67k|	upper = sizeof (wave_descs) / sizeof (WAV_FORMAT_DESC) ;
  706|       |
  707|       |	/* binary search */
  708|  1.67k|	if ((wave_descs [0].ID <= k) && (k <= wave_descs [upper - 1].ID))
  ------------------
  |  Branch (708:6): [True: 1.67k, False: 8]
  |  Branch (708:34): [True: 1.66k, False: 2]
  ------------------
  709|  1.66k|	{
  710|  9.87k|		while (lower + 1 < upper)
  ------------------
  |  Branch (710:10): [True: 9.81k, False: 59]
  ------------------
  711|  9.81k|		{	mid = (upper + lower) / 2 ;
  712|       |
  713|  9.81k|			if (k == wave_descs [mid].ID)
  ------------------
  |  Branch (713:8): [True: 1.60k, False: 8.20k]
  ------------------
  714|  1.60k|				return wave_descs [mid].name ;
  715|  8.20k|			if (k < wave_descs [mid].ID)
  ------------------
  |  Branch (715:8): [True: 5.78k, False: 2.42k]
  ------------------
  716|  5.78k|				upper = mid ;
  717|  2.42k|			else
  718|  2.42k|				lower = mid ;
  719|  8.20k|			} ;
  720|     69|		} ;
  721|       |
  722|     69|	return "Unknown format" ;
  723|  1.67k|} /* wavlike_format_str */
wavlike_read_bext_chunk:
  738|    601|{
  739|    601|	SF_BROADCAST_INFO_16K * b ;
  740|    601|	uint32_t bytes = 0 ;
  741|       |
  742|    601|	if (chunksize < WAV_BEXT_MIN_CHUNK_SIZE)
  ------------------
  |  |   33|    601|#define WAV_BEXT_MIN_CHUNK_SIZE		602
  ------------------
  |  Branch (742:6): [True: 416, False: 185]
  ------------------
  743|    416|	{	psf_log_printf (psf, "bext : %u (should be >= %d)\n", chunksize, WAV_BEXT_MIN_CHUNK_SIZE) ;
  ------------------
  |  |   33|    416|#define WAV_BEXT_MIN_CHUNK_SIZE		602
  ------------------
  744|    416|		psf_binheader_readf (psf, "j", chunksize) ;
  745|    416|		return 0 ;
  746|    416|		} ;
  747|       |
  748|    185|	if (chunksize > WAV_BEXT_MAX_CHUNK_SIZE)
  ------------------
  |  |   34|    185|#define WAV_BEXT_MAX_CHUNK_SIZE		(10 * 1024)
  ------------------
  |  Branch (748:6): [True: 55, False: 130]
  ------------------
  749|     55|	{	psf_log_printf (psf, "bext : %u (should be < %d)\n", chunksize, WAV_BEXT_MAX_CHUNK_SIZE) ;
  ------------------
  |  |   34|     55|#define WAV_BEXT_MAX_CHUNK_SIZE		(10 * 1024)
  ------------------
  750|     55|		psf_binheader_readf (psf, "j", chunksize) ;
  751|     55|		return 0 ;
  752|    130|		} ;
  753|       |
  754|    130|	if (chunksize >= sizeof (SF_BROADCAST_INFO_16K))
  ------------------
  |  Branch (754:6): [True: 0, False: 130]
  ------------------
  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|    130|		} ;
  759|       |
  760|    130|	psf_log_printf (psf, "bext : %u\n", chunksize) ;
  761|       |
  762|    130|	if (!psf->broadcast_16k)
  ------------------
  |  Branch (762:6): [True: 40, False: 90]
  ------------------
  763|     40|	{	psf->broadcast_16k = broadcast_var_alloc () ;
  764|     40|		if (!psf->broadcast_16k)
  ------------------
  |  Branch (764:7): [True: 0, False: 40]
  ------------------
  765|      0|		{	psf->error = SFE_MALLOC_FAILED ;
  766|      0|			return psf->error ;
  767|      0|			}
  768|     40|		}
  769|     90|	else
  770|     90|	{	psf_log_printf (psf, "bext : found more than one bext chunk, using last one.\n") ;
  771|     90|		memset (psf->broadcast_16k, 0, sizeof (SF_BROADCAST_INFO_16K)) ;
  772|     90|		}
  773|       |
  774|    130|	b = psf->broadcast_16k ;
  775|       |
  776|    130|	bytes += psf_binheader_readf (psf, "b", b->description, sizeof (b->description)) ;
  777|    130|	bytes += psf_binheader_readf (psf, "b", b->originator, sizeof (b->originator)) ;
  778|    130|	bytes += psf_binheader_readf (psf, "b", b->originator_reference, sizeof (b->originator_reference)) ;
  779|    130|	bytes += psf_binheader_readf (psf, "b", b->origination_date, sizeof (b->origination_date)) ;
  780|    130|	bytes += psf_binheader_readf (psf, "b", b->origination_time, sizeof (b->origination_time)) ;
  781|    130|	bytes += psf_binheader_readf (psf, "442", &b->time_reference_low, &b->time_reference_high, &b->version) ;
  782|    130|	bytes += psf_binheader_readf (psf, "b", &b->umid, sizeof (b->umid)) ;
  783|    130|	bytes += psf_binheader_readf (psf, "22", &b->loudness_value, &b->loudness_range) ;
  784|    130|	bytes += psf_binheader_readf (psf, "222", &b->max_true_peak_level, &b->max_momentary_loudness, &b->max_shortterm_loudness) ;
  785|    130|	bytes += psf_binheader_readf (psf, "j", 180) ;
  786|       |
  787|    130|	if (chunksize > WAV_BEXT_MIN_CHUNK_SIZE)
  ------------------
  |  |   33|    130|#define WAV_BEXT_MIN_CHUNK_SIZE		602
  ------------------
  |  Branch (787:6): [True: 30, False: 100]
  ------------------
  788|     30|	{	/* File has coding history data. */
  789|       |
  790|     30|		b->coding_history_size = chunksize - WAV_BEXT_MIN_CHUNK_SIZE ;
  ------------------
  |  |   33|     30|#define WAV_BEXT_MIN_CHUNK_SIZE		602
  ------------------
  791|       |
  792|       |		/* We do not parse the coding history */
  793|     30|		bytes += psf_binheader_readf (psf, "b", BHWv (b->coding_history), BHWz (b->coding_history_size)) ;
  ------------------
  |  |  126|     30|#define BHWv(x) ((const void *) (x))
  ------------------
              		bytes += psf_binheader_readf (psf, "b", BHWv (b->coding_history), BHWz (b->coding_history_size)) ;
  ------------------
  |  |  127|     30|#define BHWz(x) ((size_t) (x))
  ------------------
  794|     30|		} ;
  795|       |
  796|    130|	if (bytes < chunksize)
  ------------------
  |  Branch (796:6): [True: 33, False: 97]
  ------------------
  797|     33|		psf_binheader_readf (psf, "j", BHWj (chunksize - bytes)) ;
  ------------------
  |  |  122|     33|#define BHWj(x) ((size_t) (x))
  ------------------
  798|       |
  799|    130|	return 0 ;
  800|    130|} /* wavlike_read_bext_chunk */
wavlike_read_cart_chunk:
  837|  1.67k|{	SF_CART_INFO_16K *c ;
  838|  1.67k|	uint32_t bytes = 0 ;
  839|  1.67k|	int k ;
  840|       |
  841|  1.67k|	if (chunksize < WAV_CART_MIN_CHUNK_SIZE)
  ------------------
  |  |   36|  1.67k|#define WAV_CART_MIN_CHUNK_SIZE		2048
  ------------------
  |  Branch (841:6): [True: 1.56k, False: 116]
  ------------------
  842|  1.56k|	{	psf_log_printf (psf, "cart : %u (should be >= %d)\n", chunksize, WAV_CART_MIN_CHUNK_SIZE) ;
  ------------------
  |  |   36|  1.56k|#define WAV_CART_MIN_CHUNK_SIZE		2048
  ------------------
  843|  1.56k|		psf_binheader_readf (psf, "j", chunksize) ;
  844|  1.56k|		return 0 ;
  845|  1.56k|		} ;
  846|    116|	if (chunksize > WAV_CART_MAX_CHUNK_SIZE)
  ------------------
  |  |   37|    116|#define WAV_CART_MAX_CHUNK_SIZE		0xffffffff
  ------------------
  |  Branch (846:6): [True: 0, False: 116]
  ------------------
  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|    116|		} ;
  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|    116|	if (chunksize >= sizeof (SF_CART_INFO_16K) - 4)
  ------------------
  |  Branch (856:6): [True: 39, False: 77]
  ------------------
  857|     39|	{	psf_log_printf (psf, "cart : %u too big to be handled\n", chunksize) ;
  858|     39|		psf_binheader_readf (psf, "j", chunksize) ;
  859|     39|		return 0 ;
  860|     77|		} ;
  861|       |
  862|     77|	psf_log_printf (psf, "cart : %u\n", chunksize) ;
  863|       |
  864|     77|	if (psf->cart_16k)
  ------------------
  |  Branch (864:6): [True: 44, False: 33]
  ------------------
  865|     44|	{	psf_log_printf (psf, "  Found more than one cart chunk, using last one.\n") ;
  866|     44|		free (psf->cart_16k) ;
  867|     44|		psf->cart_16k = NULL ;
  868|     44|		} ;
  869|       |
  870|     77|	if ((psf->cart_16k = cart_var_alloc ()) == NULL)
  ------------------
  |  Branch (870:6): [True: 0, False: 77]
  ------------------
  871|      0|	{	psf->error = SFE_MALLOC_FAILED ;
  872|      0|		return psf->error ;
  873|     77|		} ;
  874|       |
  875|     77|	c = psf->cart_16k ;
  876|     77|	bytes += psf_binheader_readf (psf, "b", c->version, sizeof (c->version)) ;
  877|     77|	bytes += psf_binheader_readf (psf, "b", c->title, sizeof (c->title)) ;
  878|     77|	bytes += psf_binheader_readf (psf, "b", c->artist, sizeof (c->artist)) ;
  879|     77|	bytes += psf_binheader_readf (psf, "b", c->cut_id, sizeof (c->cut_id)) ;
  880|     77|	bytes += psf_binheader_readf (psf, "b", c->client_id, sizeof (c->client_id)) ;
  881|     77|	bytes += psf_binheader_readf (psf, "b", c->category, sizeof (c->category)) ;
  882|     77|	bytes += psf_binheader_readf (psf, "b", c->classification, sizeof (c->classification)) ;
  883|     77|	bytes += psf_binheader_readf (psf, "b", c->out_cue, sizeof (c->out_cue)) ;
  884|     77|	bytes += psf_binheader_readf (psf, "b", c->start_date, sizeof (c->start_date)) ;
  885|     77|	bytes += psf_binheader_readf (psf, "b", c->start_time, sizeof (c->start_time)) ;
  886|     77|	bytes += psf_binheader_readf (psf, "b", c->end_date, sizeof (c->end_date)) ;
  887|     77|	bytes += psf_binheader_readf (psf, "b", c->end_time, sizeof (c->end_time)) ;
  888|     77|	bytes += psf_binheader_readf (psf, "b", c->producer_app_id, sizeof (c->producer_app_id)) ;
  889|     77|	bytes += psf_binheader_readf (psf, "b", c->producer_app_version, sizeof (c->producer_app_version)) ;
  890|     77|	bytes += psf_binheader_readf (psf, "b", c->user_def, sizeof (c->user_def)) ;
  891|     77|	bytes += psf_binheader_readf (psf, "e4", &c->level_reference, sizeof (c->level_reference)) ;
  892|       |
  893|    693|	for (k = 0 ; k < ARRAY_LEN (c->post_timers) ; k++)
  ------------------
  |  |   88|    693|#define		ARRAY_LEN(x)	((int) (sizeof (x) / sizeof ((x) [0])))
  ------------------
  |  Branch (893:15): [True: 616, False: 77]
  ------------------
  894|    616|		bytes += psf_binheader_readf (psf, "b4", &c->post_timers [k].usage, make_size_t (4), &c->post_timers [k].value) ;
  895|       |
  896|     77|	bytes += psf_binheader_readf (psf, "b", c->reserved, sizeof (c->reserved)) ;
  897|     77|	bytes += psf_binheader_readf (psf, "b", c->url, sizeof (c->url)) ;
  898|       |
  899|     77|	if (chunksize > WAV_CART_MIN_CHUNK_SIZE)
  ------------------
  |  |   36|     77|#define WAV_CART_MIN_CHUNK_SIZE		2048
  ------------------
  |  Branch (899:6): [True: 26, False: 51]
  ------------------
  900|     26|	{	/* File has tag text. */
  901|     26|		c->tag_text_size = chunksize - WAV_CART_MIN_CHUNK_SIZE ;
  ------------------
  |  |   36|     26|#define WAV_CART_MIN_CHUNK_SIZE		2048
  ------------------
  902|     26|		bytes += psf_binheader_readf (psf, "b", c->tag_text, make_size_t (c->tag_text_size)) ;
  903|     26|		} ;
  904|       |
  905|     77|	if (bytes < chunksize)
  ------------------
  |  Branch (905:6): [True: 27, False: 50]
  ------------------
  906|     27|		psf_log_printf (psf, "  %d trailing bytes in cart chunk.\n", chunksize - bytes) ;
  907|       |
  908|     77|	return 0 ;
  909|     77|} /* wavlike_read_cart_chunk */
wavlike_subchunk_parse:
  956|  4.78k|{	sf_count_t	current_pos ;
  957|  4.78k|	char		buffer [2048] ;
  958|  4.78k|	uint32_t 	chunk_size, bytesread = 0 ;
  959|       |
  960|  4.78k|	current_pos = psf_fseek (psf, 0, SEEK_CUR) ;
  961|       |
  962|  4.78k|	if (chunk_length <= 8)
  ------------------
  |  Branch (962:6): [True: 916, False: 3.87k]
  ------------------
  963|    916|	{	/* This case is for broken files generated by PEAK. */
  964|    916|		psf_log_printf (psf, "%M : %u (weird length)\n", chunk, chunk_length) ;
  965|    916|		psf_binheader_readf (psf, "mj", &chunk, chunk_length - 4) ;
  966|    916|		psf_log_printf (psf, "  %M\n", chunk) ;
  967|    916|		return 0 ;
  968|  3.87k|		} ;
  969|       |
  970|  3.87k|	if (current_pos + chunk_length > psf->filelength)
  ------------------
  |  Branch (970:6): [True: 1.84k, False: 2.02k]
  ------------------
  971|  1.84k|	{	psf_log_printf (psf, "%M : %u (should be %d)\n", chunk, chunk_length, (int) (psf->filelength - current_pos)) ;
  972|  1.84k|		chunk_length = psf->filelength - current_pos ;
  973|  1.84k|		}
  974|  2.02k|	else
  975|  2.02k|		psf_log_printf (psf, "%M : %u\n", chunk, chunk_length) ;
  976|       |
  977|  10.5k|	while (bytesread < chunk_length)
  ------------------
  |  Branch (977:9): [True: 9.53k, False: 1.00k]
  ------------------
  978|  9.53k|	{	uint32_t thisread ;
  979|       |
  980|  9.53k|		if ((thisread = psf_binheader_readf (psf, "m", &chunk)) == 0)
  ------------------
  |  Branch (980:7): [True: 5, False: 9.52k]
  ------------------
  981|      5|			break ;
  982|  9.52k|		bytesread += thisread ;
  983|       |
  984|  9.52k|		switch (chunk)
  985|  9.52k|		{	case adtl_MARKER :
  ------------------
  |  |   29|     67|#define adtl_MARKER		MAKE_MARKER ('a', 'd', 't', 'l')
  |  |  ------------------
  |  |  |  |  122|     67|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (985:5): [True: 67, False: 9.46k]
  ------------------
  986|    268|			case INFO_MARKER :
  ------------------
  |  |   37|    268|#define INFO_MARKER		MAKE_MARKER ('I', 'N', 'F', 'O')
  |  |  ------------------
  |  |  |  |  122|    268|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (986:4): [True: 201, False: 9.32k]
  ------------------
  987|       |					/* These markers don't contain anything, not even a chunk length. */
  988|    268|					psf_log_printf (psf, "  %M\n", chunk) ;
  989|    268|					continue ;
  990|       |
  991|      0|			case exif_MARKER :
  ------------------
  |  |   58|      0|#define exif_MARKER		MAKE_MARKER ('e', 'x', 'i', 'f')
  |  |  ------------------
  |  |  |  |  122|      0|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (991:4): [True: 0, False: 9.52k]
  ------------------
  992|      0|					psf_log_printf (psf, "  %M\n", chunk) ;
  993|      0|					if (chunk_length > bytesread)
  ------------------
  |  Branch (993:10): [True: 0, False: 0]
  ------------------
  994|      0|						bytesread += exif_subchunk_parse (psf, chunk_length - bytesread) ;
  995|      0|					continue ;
  996|       |
  997|    798|			case data_MARKER :
  ------------------
  |  |   32|    798|#define data_MARKER		MAKE_MARKER ('d', 'a', 't', 'a')
  |  |  ------------------
  |  |  |  |  122|    798|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (997:4): [True: 798, False: 8.73k]
  ------------------
  998|    798|					psf_log_printf (psf, "  %M inside a LIST block??? Backing out.\n", chunk) ;
  999|       |					/* Jump back four bytes and return to caller. */
 1000|    798|					psf_binheader_readf (psf, "j", -4) ;
 1001|    798|					return 0 ;
 1002|       |
 1003|    457|			case 0 :
  ------------------
  |  Branch (1003:4): [True: 457, False: 9.07k]
  ------------------
 1004|       |					/*
 1005|       |					**	Four zero bytes where a marker was expected. Assume this means
 1006|       |					**	the rest of the chunk is garbage.
 1007|       |					*/
 1008|    457|					psf_log_printf (psf, "    *** Found weird-ass zero marker. Jumping to end of chunk.\n") ;
 1009|    457|					goto cleanup_subchunk_parse ;
 1010|       |
 1011|  8.00k|			default :
  ------------------
  |  Branch (1011:4): [True: 8.00k, False: 1.52k]
  ------------------
 1012|  8.00k|					break ;
 1013|  9.52k|			} ;
 1014|       |
 1015|  8.00k|		switch (chunk)
 1016|  8.00k|		{	case ISFT_MARKER :
  ------------------
  |  |   42|     68|#define ISFT_MARKER		MAKE_MARKER ('I', 'S', 'F', 'T')
  |  |  ------------------
  |  |  |  |  122|     68|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (1016:5): [True: 68, False: 7.93k]
  ------------------
 1017|    230|			case ICOP_MARKER :
  ------------------
  |  |   50|    230|#define ICOP_MARKER		MAKE_MARKER ('I', 'C', 'O', 'P')
  |  |  ------------------
  |  |  |  |  122|    230|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (1017:4): [True: 162, False: 7.84k]
  ------------------
 1018|    296|			case IARL_MARKER :
  ------------------
  |  |   45|    296|#define IARL_MARKER		MAKE_MARKER ('I', 'A', 'R', 'L')
  |  |  ------------------
  |  |  |  |  122|    296|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (1018:4): [True: 66, False: 7.93k]
  ------------------
 1019|    411|			case IART_MARKER :
  ------------------
  |  |   46|    411|#define IART_MARKER		MAKE_MARKER ('I', 'A', 'R', 'T')
  |  |  ------------------
  |  |  |  |  122|    411|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (1019:4): [True: 115, False: 7.89k]
  ------------------
 1020|    498|			case ICMT_MARKER :
  ------------------
  |  |   54|    498|#define ICMT_MARKER		MAKE_MARKER ('I', 'C', 'M', 'T')
  |  |  ------------------
  |  |  |  |  122|    498|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (1020:4): [True: 87, False: 7.91k]
  ------------------
 1021|    579|			case ICRD_MARKER :
  ------------------
  |  |   43|    579|#define ICRD_MARKER		MAKE_MARKER ('I', 'C', 'R', 'D')
  |  |  ------------------
  |  |  |  |  122|    579|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (1021:4): [True: 81, False: 7.92k]
  ------------------
 1022|  1.00k|			case IENG_MARKER :
  ------------------
  |  |   48|  1.00k|#define IENG_MARKER		MAKE_MARKER ('I', 'E', 'N', 'G')
  |  |  ------------------
  |  |  |  |  122|  1.00k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (1022:4): [True: 421, False: 7.58k]
  ------------------
 1023|  1.07k|			case IGNR_MARKER :
  ------------------
  |  |   49|  1.07k|#define IGNR_MARKER		MAKE_MARKER ('I', 'G', 'N', 'R')
  |  |  ------------------
  |  |  |  |  122|  1.07k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (1023:4): [True: 79, False: 7.92k]
  ------------------
 1024|  1.31k|			case INAM_MARKER :
  ------------------
  |  |   47|  1.31k|#define INAM_MARKER		MAKE_MARKER ('I', 'N', 'A', 'M')
  |  |  ------------------
  |  |  |  |  122|  1.31k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (1024:4): [True: 231, False: 7.77k]
  ------------------
 1025|  1.97k|			case IPRD_MARKER :
  ------------------
  |  |   51|  1.97k|#define IPRD_MARKER		MAKE_MARKER ('I', 'P', 'R', 'D')
  |  |  ------------------
  |  |  |  |  122|  1.97k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (1025:4): [True: 667, False: 7.33k]
  ------------------
 1026|  2.04k|			case ISBJ_MARKER :
  ------------------
  |  |   53|  2.04k|#define ISBJ_MARKER		MAKE_MARKER ('I', 'S', 'B', 'J')
  |  |  ------------------
  |  |  |  |  122|  2.04k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (1026:4): [True: 68, False: 7.93k]
  ------------------
 1027|  2.28k|			case ISRC_MARKER :
  ------------------
  |  |   52|  2.28k|#define ISRC_MARKER		MAKE_MARKER ('I', 'S', 'R', 'C')
  |  |  ------------------
  |  |  |  |  122|  2.28k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (1027:4): [True: 243, False: 7.76k]
  ------------------
 1028|  2.35k|			case IAUT_MARKER :
  ------------------
  |  |   55|  2.35k|#define IAUT_MARKER		MAKE_MARKER ('I', 'A', 'U', 'T')
  |  |  ------------------
  |  |  |  |  122|  2.35k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (1028:4): [True: 70, False: 7.93k]
  ------------------
 1029|  2.43k|			case ITRK_MARKER :
  ------------------
  |  |   56|  2.43k|#define ITRK_MARKER		MAKE_MARKER ('I', 'T', 'R', 'K')
  |  |  ------------------
  |  |  |  |  122|  2.43k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (1029:4): [True: 80, False: 7.92k]
  ------------------
 1030|  2.43k|					bytesread += psf_binheader_readf (psf, "4", &chunk_size) ;
 1031|  2.43k|					chunk_size += (chunk_size & 1) ;
 1032|  2.43k|					if (chunk_size >= SIGNED_SIZEOF (buffer) || bytesread + chunk_size > chunk_length)
  ------------------
  |  |   86|  4.87k|#define		SIGNED_SIZEOF(x)	((int) sizeof (x))
  ------------------
  |  Branch (1032:10): [True: 288, False: 2.15k]
  |  Branch (1032:50): [True: 55, False: 2.09k]
  ------------------
 1033|    343|					{	psf_log_printf (psf, "  *** %M : %u (too big)\n", chunk, chunk_size) ;
 1034|    343|						goto cleanup_subchunk_parse ;
 1035|  2.09k|						} ;
 1036|       |
 1037|  2.09k|					bytesread += psf_binheader_readf (psf, "b", buffer, chunk_size) ;
 1038|  2.09k|					buffer [chunk_size] = 0 ;
 1039|  2.09k|					psf_log_printf (psf, "    %M : %s\n", chunk, buffer) ;
 1040|  2.09k|					break ;
 1041|       |
 1042|  1.17k|			case labl_MARKER :
  ------------------
  |  |   33|  1.17k|#define labl_MARKER		MAKE_MARKER ('l', 'a', 'b', 'l')
  |  |  ------------------
  |  |  |  |  122|  1.17k|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (1042:4): [True: 1.17k, False: 6.83k]
  ------------------
 1043|  1.17k|					{	int mark_id ;
 1044|       |
 1045|  1.17k|						bytesread += psf_binheader_readf (psf, "44", &chunk_size, &mark_id) ;
 1046|  1.17k|						chunk_size -= 4 ;
 1047|  1.17k|						chunk_size += (chunk_size & 1) ;
 1048|  1.17k|						if (chunk_size < 1 || chunk_size >= SIGNED_SIZEOF (buffer) || bytesread + chunk_size > chunk_length)
  ------------------
  |  |   86|  2.34k|#define		SIGNED_SIZEOF(x)	((int) sizeof (x))
  ------------------
  |  Branch (1048:11): [True: 1, False: 1.17k]
  |  Branch (1048:29): [True: 116, False: 1.05k]
  |  Branch (1048:69): [True: 103, False: 952]
  ------------------
 1049|    220|						{	psf_log_printf (psf, "  *** %M : %u (too big)\n", chunk, chunk_size) ;
 1050|    220|							goto cleanup_subchunk_parse ;
 1051|    952|							} ;
 1052|       |
 1053|    952|						bytesread += psf_binheader_readf (psf, "b", buffer, chunk_size) ;
 1054|    952|						buffer [chunk_size] = 0 ;
 1055|       |
 1056|    952|						if (mark_id < 10) /* avoid swamping log buffer with labels */
  ------------------
  |  Branch (1056:11): [True: 747, False: 205]
  ------------------
 1057|    747|							psf_log_printf (psf, "    %M : %u : %s\n", chunk, mark_id, buffer) ;
 1058|    205|						else if (mark_id == 10)
  ------------------
  |  Branch (1058:16): [True: 99, False: 106]
  ------------------
 1059|     99|							psf_log_printf (psf, "    (Skipping)\n") ;
 1060|       |
 1061|    952|						if (psf->cues)
  ------------------
  |  Branch (1061:11): [True: 457, False: 495]
  ------------------
 1062|    457| 						{	unsigned int i = 0 ;
 1063|    457|							SF_CUE_POINT *cue_points = psf_cues_points (psf->cues) ;
 1064|       |
 1065|       |							/* find id to store label */
 1066|  5.29k|							while (i < psf->cues->cue_count && cue_points [i].indx != mark_id)
  ------------------
  |  Branch (1066:15): [True: 5.03k, False: 259]
  |  Branch (1066:43): [True: 4.83k, False: 198]
  ------------------
 1067|  4.83k|								i++ ;
 1068|       |
 1069|    457|							if (i < psf->cues->cue_count)
  ------------------
  |  Branch (1069:12): [True: 198, False: 259]
  ------------------
 1070|    198|								psf_strlcpy (cue_points [i].name, sizeof (cue_points [i].name), buffer) ;
 1071|    457|							} ;
 1072|    952|						} ;
 1073|    952|					break ;
 1074|       |
 1075|     23|			case DISP_MARKER :
  ------------------
  |  |   36|     23|#define DISP_MARKER		MAKE_MARKER ('D', 'I', 'S', 'P')
  |  |  ------------------
  |  |  |  |  122|     23|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (1075:4): [True: 23, False: 7.98k]
  ------------------
 1076|    157|			case ltxt_MARKER :
  ------------------
  |  |   34|    157|#define ltxt_MARKER		MAKE_MARKER ('l', 't', 'x', 't')
  |  |  ------------------
  |  |  |  |  122|    157|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (1076:4): [True: 134, False: 7.87k]
  ------------------
 1077|    158|			case note_MARKER :
  ------------------
  |  |   35|    158|#define note_MARKER		MAKE_MARKER ('n', 'o', 't', 'e')
  |  |  ------------------
  |  |  |  |  122|    158|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (1077:4): [True: 1, False: 8.00k]
  ------------------
 1078|    158|					bytesread += psf_binheader_readf (psf, "4", &chunk_size) ;
 1079|    158|					chunk_size += (chunk_size & 1) ;
 1080|    158|					if (chunk_size >= SIGNED_SIZEOF (buffer) || bytesread + chunk_size > chunk_length)
  ------------------
  |  |   86|    316|#define		SIGNED_SIZEOF(x)	((int) sizeof (x))
  ------------------
  |  Branch (1080:10): [True: 128, False: 30]
  |  Branch (1080:50): [True: 10, False: 20]
  ------------------
 1081|    138|					{	psf_log_printf (psf, "  *** %M : %u (too big)\n", chunk, chunk_size) ;
 1082|    138|						goto cleanup_subchunk_parse ;
 1083|    138|						} ;
 1084|       |
 1085|     20|					psf_log_printf (psf, "    %M : %u\n", chunk, chunk_size) ;
 1086|     20|					goto cleanup_subchunk_parse ;
 1087|       |
 1088|  4.23k|			default :
  ------------------
  |  Branch (1088:4): [True: 4.23k, False: 3.76k]
  ------------------
 1089|  4.23k|					bytesread += psf_binheader_readf (psf, "4", &chunk_size) ;
 1090|  4.23k|					chunk_size += (chunk_size & 1) ;
 1091|  4.23k|					if (bytesread + chunk_size > chunk_length)
  ------------------
  |  Branch (1091:10): [True: 883, False: 3.35k]
  ------------------
 1092|    883|					{	psf_log_printf (psf, "  *** %M : %u (too big)\n", chunk, chunk_size) ;
 1093|    883|						goto cleanup_subchunk_parse ;
 1094|    883|						}
 1095|  3.35k|					else
 1096|  3.35k|					{	psf_log_printf (psf, "    %M : %u\n", chunk, chunk_size) ;
 1097|  3.35k|						bytesread += psf_binheader_readf (psf, "j", chunk_size) ;
 1098|  3.35k|						} ;
 1099|  3.35k|					break ;
 1100|  8.00k|			} ;
 1101|       |
 1102|  6.40k|		switch (chunk)
  ------------------
  |  Branch (1102:11): [True: 1.51k, False: 4.88k]
  ------------------
 1103|  6.40k|		{	case ISFT_MARKER :
  ------------------
  |  |   42|     66|#define ISFT_MARKER		MAKE_MARKER ('I', 'S', 'F', 'T')
  |  |  ------------------
  |  |  |  |  122|     66|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (1103:5): [True: 66, False: 6.33k]
  ------------------
 1104|     66|					psf_store_string (psf, SF_STR_SOFTWARE, buffer) ;
 1105|     66|					break ;
 1106|    138|			case ICOP_MARKER :
  ------------------
  |  |   50|    138|#define ICOP_MARKER		MAKE_MARKER ('I', 'C', 'O', 'P')
  |  |  ------------------
  |  |  |  |  122|    138|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (1106:4): [True: 138, False: 6.26k]
  ------------------
 1107|    138|					psf_store_string (psf, SF_STR_COPYRIGHT, buffer) ;
 1108|    138|					break ;
 1109|    229|			case INAM_MARKER :
  ------------------
  |  |   47|    229|#define INAM_MARKER		MAKE_MARKER ('I', 'N', 'A', 'M')
  |  |  ------------------
  |  |  |  |  122|    229|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (1109:4): [True: 229, False: 6.17k]
  ------------------
 1110|    229|					psf_store_string (psf, SF_STR_TITLE, buffer) ;
 1111|    229|					break ;
 1112|    105|			case IART_MARKER :
  ------------------
  |  |   46|    105|#define IART_MARKER		MAKE_MARKER ('I', 'A', 'R', 'T')
  |  |  ------------------
  |  |  |  |  122|    105|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (1112:4): [True: 105, False: 6.29k]
  ------------------
 1113|    105|					psf_store_string (psf, SF_STR_ARTIST, buffer) ;
 1114|    105|					break ;
 1115|     83|			case ICMT_MARKER :
  ------------------
  |  |   54|     83|#define ICMT_MARKER		MAKE_MARKER ('I', 'C', 'M', 'T')
  |  |  ------------------
  |  |  |  |  122|     83|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (1115:4): [True: 83, False: 6.31k]
  ------------------
 1116|     83|					psf_store_string (psf, SF_STR_COMMENT, buffer) ;
 1117|     83|					break ;
 1118|     80|			case ICRD_MARKER :
  ------------------
  |  |   43|     80|#define ICRD_MARKER		MAKE_MARKER ('I', 'C', 'R', 'D')
  |  |  ------------------
  |  |  |  |  122|     80|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (1118:4): [True: 80, False: 6.32k]
  ------------------
 1119|     80|					psf_store_string (psf, SF_STR_DATE, buffer) ;
 1120|     80|					break ;
 1121|     72|			case IGNR_MARKER :
  ------------------
  |  |   49|     72|#define IGNR_MARKER		MAKE_MARKER ('I', 'G', 'N', 'R')
  |  |  ------------------
  |  |  |  |  122|     72|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (1121:4): [True: 72, False: 6.32k]
  ------------------
 1122|     72|					psf_store_string (psf, SF_STR_GENRE, buffer) ;
 1123|     72|					break ;
 1124|    664|			case IPRD_MARKER :
  ------------------
  |  |   51|    664|#define IPRD_MARKER		MAKE_MARKER ('I', 'P', 'R', 'D')
  |  |  ------------------
  |  |  |  |  122|    664|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (1124:4): [True: 664, False: 5.73k]
  ------------------
 1125|    664|					psf_store_string (psf, SF_STR_ALBUM, buffer) ;
 1126|    664|					break ;
 1127|     77|			case ITRK_MARKER :
  ------------------
  |  |   56|     77|#define ITRK_MARKER		MAKE_MARKER ('I', 'T', 'R', 'K')
  |  |  ------------------
  |  |  |  |  122|     77|	#define	MAKE_MARKER(a, b, c, d)		((uint32_t) ((a) | ((b) << 8) | ((c) << 16) | (((uint32_t) (d)) << 24)))
  |  |  ------------------
  ------------------
  |  Branch (1127:4): [True: 77, False: 6.32k]
  ------------------
 1128|     77|					psf_store_string (psf, SF_STR_TRACKNUMBER, buffer) ;
 1129|     77|					break ;
 1130|  6.40k|			} ;
 1131|  6.40k|		} ;
 1132|       |
 1133|  3.07k|cleanup_subchunk_parse :
 1134|       |
 1135|  3.07k|	if (chunk_length > bytesread)
  ------------------
  |  Branch (1135:6): [True: 1.67k, False: 1.39k]
  ------------------
 1136|  1.67k|		bytesread += psf_binheader_readf (psf, "j", chunk_length - bytesread) ;
 1137|       |
 1138|  3.07k|	return 0 ;
 1139|  1.01k|} /* wavlike_subchunk_parse */
wavlike_read_peak_chunk:
 1209|  1.15k|{	char		buffer [256] ;
 1210|  1.15k|	uint32_t uk ;
 1211|       |
 1212|  1.15k|	if (chunk_size != WAVLIKE_PEAK_CHUNK_SIZE (psf->sf.channels))
  ------------------
  |  |  337|  1.15k|#define		WAVLIKE_PEAK_CHUNK_SIZE(ch) (2 * sizeof (int) + ch * (sizeof (float) + sizeof (int)))
  ------------------
  |  Branch (1212:6): [True: 498, False: 655]
  ------------------
 1213|    498|	{	/* Some writers (e.g. Adobe Audition) write a PEAK chunk holding a
 1214|       |		** single peak value for the whole file instead of one value per
 1215|       |		** channel. The chunk is optional metadata, so skip it and continue
 1216|       |		** reading the file instead of failing to open it.
 1217|       |		*/
 1218|    498|		psf_binheader_readf (psf, "j", chunk_size) ;
 1219|    498|		psf_log_printf (psf, "*** File PEAK chunk size doesn't fit with number of channels (%d), skipping PEAK information.\n", psf->sf.channels) ;
 1220|    498|		return 0 ;
 1221|    655|		} ;
 1222|       |
 1223|    655|	if (psf->peak_info)
  ------------------
  |  Branch (1223:6): [True: 564, False: 91]
  ------------------
 1224|    564|	{	psf_log_printf (psf, "*** Found existing peak info, using last one.\n") ;
 1225|    564|		free (psf->peak_info) ;
 1226|    564|		psf->peak_info = NULL ;
 1227|    564|		} ;
 1228|    655|	if ((psf->peak_info = peak_info_calloc (psf->sf.channels)) == NULL)
  ------------------
  |  Branch (1228:6): [True: 0, False: 655]
  ------------------
 1229|      0|		return SFE_MALLOC_FAILED ;
 1230|       |
 1231|       |	/* read in rest of PEAK chunk. */
 1232|    655|	psf_binheader_readf (psf, "44", & (psf->peak_info->version), & (psf->peak_info->timestamp)) ;
 1233|       |
 1234|    655|	if (psf->peak_info->version != 1)
  ------------------
  |  Branch (1234:6): [True: 614, False: 41]
  ------------------
 1235|    614|		psf_log_printf (psf, "  version    : %d *** (should be version 1)\n", psf->peak_info->version) ;
 1236|     41|	else
 1237|     41|		psf_log_printf (psf, "  version    : %d\n", psf->peak_info->version) ;
 1238|       |
 1239|    655|	psf_log_printf (psf, "  time stamp : %d\n", psf->peak_info->timestamp) ;
 1240|    655|	psf_log_printf (psf, "    Ch   Position       Value\n") ;
 1241|       |
 1242|  50.4k|	for (uk = 0 ; uk < (uint32_t) psf->sf.channels ; uk++)
  ------------------
  |  Branch (1242:16): [True: 49.7k, False: 655]
  ------------------
 1243|  49.7k|	{	float value ;
 1244|  49.7k|		uint32_t position ;
 1245|       |
 1246|  49.7k|		psf_binheader_readf (psf, "f4", &value, &position) ;
 1247|  49.7k|		psf->peak_info->peaks [uk].value = value ;
 1248|  49.7k|		psf->peak_info->peaks [uk].position = position ;
 1249|       |
 1250|  49.7k|		snprintf (buffer, sizeof (buffer), "    %2d   %-12" PRId64 "   %g\n",
 1251|  49.7k|				uk, psf->peak_info->peaks [uk].position, psf->peak_info->peaks [uk].value) ;
 1252|  49.7k|		buffer [sizeof (buffer) - 1] = 0 ;
 1253|  49.7k|		psf_log_printf (psf, "%s", buffer) ;
 1254|  49.7k|		} ;
 1255|       |
 1256|    655|	return 0 ;
 1257|    655|} /* wavlike_read_peak_chunk */
wavlike.c:wavex_guid_equal:
  118|    950|{	return !memcmp (first, second, sizeof (EXT_SUBFORMAT)) ;
  119|    950|} /* wavex_guid_equal */

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

xi_open:
   65|    196|{	XI_PRIVATE *pxi ;
   66|    196|	int		subformat, error = 0 ;
   67|       |
   68|    196|	if (psf->is_pipe)
  ------------------
  |  Branch (68:6): [True: 0, False: 196]
  ------------------
   69|      0|		return SFE_XI_NO_PIPE ;
   70|       |
   71|    196|	if (psf->codec_data)
  ------------------
  |  Branch (71:6): [True: 0, False: 196]
  ------------------
   72|      0|		pxi = psf->codec_data ;
   73|    196|	else if ((pxi = calloc (1, sizeof (XI_PRIVATE))) == NULL)
  ------------------
  |  Branch (73:11): [True: 0, False: 196]
  ------------------
   74|      0|		return SFE_MALLOC_FAILED ;
   75|       |
   76|    196|	psf->codec_data = pxi ;
   77|       |
   78|    196|	if (psf->file.mode == SFM_READ || (psf->file.mode == SFM_RDWR && psf->filelength > 0))
  ------------------
  |  Branch (78:6): [True: 196, False: 0]
  |  Branch (78:37): [True: 0, False: 0]
  |  Branch (78:67): [True: 0, False: 0]
  ------------------
   79|    196|	{	if ((error = xi_read_header (psf)))
  ------------------
  |  Branch (79:8): [True: 96, False: 100]
  ------------------
   80|     96|			return error ;
   81|    196|		} ;
   82|       |
   83|    100|	subformat = SF_CODEC (psf->sf.format) ;
  ------------------
  |  |  102|    100|#define SF_CODEC(x)			((x) & SF_FORMAT_SUBMASK)
  ------------------
   84|       |
   85|    100|	if (psf->file.mode == SFM_WRITE || psf->file.mode == SFM_RDWR)
  ------------------
  |  Branch (85:6): [True: 0, False: 100]
  |  Branch (85:37): [True: 0, False: 100]
  ------------------
   86|      0|	{	if ((SF_CONTAINER (psf->sf.format)) != SF_FORMAT_XI)
  ------------------
  |  |  101|      0|#define SF_CONTAINER(x)		((x) & SF_FORMAT_TYPEMASK)
  ------------------
  |  Branch (86:8): [True: 0, False: 0]
  ------------------
   87|      0|			return	SFE_BAD_OPEN_FORMAT ;
   88|       |
   89|      0|		psf->endian = SF_ENDIAN_LITTLE ;
   90|      0|		psf->sf.channels = 1 ; /* Always mono */
   91|      0|		psf->sf.samplerate = 44100 ; /* Always */
   92|       |
   93|       |		/* Set up default instrument and software name. */
   94|      0|		memcpy (pxi->filename, "Default Name            ", sizeof (pxi->filename)) ;
   95|      0|		memcpy (pxi->software, PACKAGE_NAME "-" PACKAGE_VERSION "               ", sizeof (pxi->software)) ;
  ------------------
  |  |  170|      0|#define PACKAGE_NAME "libsndfile"
  ------------------
   96|       |
   97|      0|		memset (pxi->sample_name, 0, sizeof (pxi->sample_name)) ;
   98|      0|		snprintf (pxi->sample_name, sizeof (pxi->sample_name), "%s", "Sample #1") ;
   99|       |
  100|      0|		pxi->sample_flags = (subformat == SF_FORMAT_DPCM_16) ? 16 : 0 ;
  ------------------
  |  Branch (100:23): [True: 0, False: 0]
  ------------------
  101|       |
  102|      0|		if (xi_write_header (psf, SF_FALSE))
  ------------------
  |  Branch (102:7): [True: 0, False: 0]
  ------------------
  103|      0|			return psf->error ;
  104|       |
  105|      0|		psf->write_header = xi_write_header ;
  106|    100|		} ;
  107|       |
  108|    100|	psf->container_close = xi_close ;
  109|    100|	psf->seek = dpcm_seek ;
  110|       |
  111|    100|	psf->sf.seekable = SF_FALSE ;
  112|       |
  113|    100|	psf->blockwidth = (sf_count_t) psf->bytewidth * psf->sf.channels ;
  114|       |
  115|    100|	switch (subformat)
  116|    100|	{	case SF_FORMAT_DPCM_8 :		/* 8-bit differential PCM. */
  ------------------
  |  Branch (116:4): [True: 59, False: 41]
  ------------------
  117|     80|		case SF_FORMAT_DPCM_16 :	/* 16-bit differential PCM. */
  ------------------
  |  Branch (117:3): [True: 21, False: 79]
  ------------------
  118|     80|				error = dpcm_init (psf) ;
  119|     80|				break ;
  120|       |
  121|     20|		default : break ;
  ------------------
  |  Branch (121:3): [True: 20, False: 80]
  ------------------
  122|    100|		} ;
  123|       |
  124|    100|	return error ;
  125|    100|} /* xi_open */
xi.c:xi_close:
  132|    100|{
  133|    100|	return 0 ;
  134|    100|} /* xi_close */
xi.c:dpcm_init:
  161|     80|{	if (psf->bytewidth == 0 || psf->sf.channels == 0)
  ------------------
  |  Branch (161:7): [True: 0, False: 80]
  |  Branch (161:30): [True: 0, False: 80]
  ------------------
  162|      0|		return SFE_INTERNAL ;
  163|       |
  164|     80|	psf->blockwidth = (sf_count_t) psf->bytewidth * psf->sf.channels ;
  165|       |
  166|     80|	if (psf->file.mode == SFM_READ || psf->file.mode == SFM_RDWR)
  ------------------
  |  Branch (166:6): [True: 80, False: 0]
  |  Branch (166:36): [True: 0, False: 0]
  ------------------
  167|     80|	{	switch (psf->bytewidth)
  168|     80|		{	case 1 :
  ------------------
  |  Branch (168:5): [True: 59, False: 21]
  ------------------
  169|     59|					psf->read_short		= dpcm_read_dsc2s ;
  170|     59|					psf->read_int		= dpcm_read_dsc2i ;
  171|     59|					psf->read_float		= dpcm_read_dsc2f ;
  172|     59|					psf->read_double	= dpcm_read_dsc2d ;
  173|     59|					break ;
  174|     21|			case 2 :
  ------------------
  |  Branch (174:4): [True: 21, False: 59]
  ------------------
  175|     21|					psf->read_short		= dpcm_read_dles2s ;
  176|     21|					psf->read_int		= dpcm_read_dles2i ;
  177|     21|					psf->read_float		= dpcm_read_dles2f ;
  178|     21|					psf->read_double	= dpcm_read_dles2d ;
  179|     21|					break ;
  180|      0|			default :
  ------------------
  |  Branch (180:4): [True: 0, False: 80]
  ------------------
  181|      0|				psf_log_printf (psf, "dpcm_init() returning SFE_UNIMPLEMENTED\n") ;
  182|      0|				return SFE_UNIMPLEMENTED ;
  183|     80|			} ;
  184|     80|		} ;
  185|       |
  186|     80|	if (psf->file.mode == SFM_WRITE || psf->file.mode == SFM_RDWR)
  ------------------
  |  Branch (186:6): [True: 0, False: 80]
  |  Branch (186:37): [True: 0, False: 80]
  ------------------
  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|     80|		} ;
  205|       |
  206|     80|	psf->filelength = psf_get_filelen (psf) ;
  207|     80|	psf->datalength = (psf->dataend) ? psf->dataend - psf->dataoffset :
  ------------------
  |  Branch (207:20): [True: 0, False: 80]
  ------------------
  208|     80|							psf->filelength - psf->dataoffset ;
  209|     80|	psf->sf.frames = psf->datalength / psf->blockwidth ;
  210|       |
  211|     80|	return 0 ;
  212|     80|} /* dpcm_init */
xi.c:dpcm_read_dsc2s:
  506|    194|{	BUF_UNION	ubuf ;
  507|    194|	XI_PRIVATE	*pxi ;
  508|    194|	int			bufferlen, readcount ;
  509|    194|	sf_count_t	total = 0 ;
  510|       |
  511|    194|	if ((pxi = psf->codec_data) == NULL)
  ------------------
  |  Branch (511:6): [True: 0, False: 194]
  ------------------
  512|      0|		return 0 ;
  513|       |
  514|    194|	bufferlen = ARRAY_LEN (ubuf.ucbuf) ;
  ------------------
  |  |   88|    194|#define		ARRAY_LEN(x)	((int) (sizeof (x) / sizeof ((x) [0])))
  ------------------
  515|       |
  516|    388|	while (len > 0)
  ------------------
  |  Branch (516:9): [True: 194, False: 194]
  ------------------
  517|    194|	{	if (len < bufferlen)
  ------------------
  |  Branch (517:8): [True: 194, False: 0]
  ------------------
  518|    194|			bufferlen = (int) len ;
  519|    194|		readcount = (int) psf_fread (ubuf.scbuf, sizeof (signed char), bufferlen, psf) ;
  520|    194|		dsc2s_array (pxi, ubuf.scbuf, readcount, ptr + total) ;
  521|    194|		total += readcount ;
  522|    194|		if (readcount < bufferlen)
  ------------------
  |  Branch (522:7): [True: 0, False: 194]
  ------------------
  523|      0|			break ;
  524|    194|		len -= readcount ;
  525|    194|		} ;
  526|       |
  527|    194|	return total ;
  528|    194|} /* dpcm_read_dsc2s */
xi.c:dsc2s_array:
  968|    194|{	signed char	last_val ;
  969|    194|	int			k ;
  970|       |
  971|    194|	last_val = pxi->last_16 >> 8 ;
  972|       |
  973|    388|	for (k = 0 ; k < count ; k++)
  ------------------
  |  Branch (973:15): [True: 194, False: 194]
  ------------------
  974|    194|	{	last_val += src [k] ;
  975|    194|		dest [k] = arith_shift_left (last_val, 8) ;
  976|    194|		} ;
  977|       |
  978|    194|	pxi->last_16 = arith_shift_left (last_val, 8) ;
  979|    194|} /* dsc2s_array */
xi.c:dpcm_read_dles2s:
  619|    371|{	BUF_UNION	ubuf ;
  620|    371|	XI_PRIVATE	*pxi ;
  621|    371|	int			bufferlen, readcount ;
  622|    371|	sf_count_t	total = 0 ;
  623|       |
  624|    371|	if ((pxi = psf->codec_data) == NULL)
  ------------------
  |  Branch (624:6): [True: 0, False: 371]
  ------------------
  625|      0|		return 0 ;
  626|       |
  627|    371|	bufferlen = ARRAY_LEN (ubuf.sbuf) ;
  ------------------
  |  |   88|    371|#define		ARRAY_LEN(x)	((int) (sizeof (x) / sizeof ((x) [0])))
  ------------------
  628|       |
  629|    742|	while (len > 0)
  ------------------
  |  Branch (629:9): [True: 371, False: 371]
  ------------------
  630|    371|	{	if (len < bufferlen)
  ------------------
  |  Branch (630:8): [True: 371, False: 0]
  ------------------
  631|    371|			bufferlen = (int) len ;
  632|    371|		readcount = (int) psf_fread (ubuf.sbuf, sizeof (short), bufferlen, psf) ;
  633|    371|		dles2s_array (pxi, ubuf.sbuf, readcount, ptr + total) ;
  634|    371|		total += readcount ;
  635|    371|		if (readcount < bufferlen)
  ------------------
  |  Branch (635:7): [True: 0, False: 371]
  ------------------
  636|      0|			break ;
  637|    371|		len -= readcount ;
  638|    371|		} ;
  639|       |
  640|    371|	return total ;
  641|    371|} /* dpcm_read_dles2s */
xi.c:dles2s_array:
 1098|    371|{	short	last_val ;
 1099|    371|	int		k ;
 1100|       |
 1101|    371|	last_val = pxi->last_16 ;
 1102|       |
 1103|    742|	for (k = 0 ; k < count ; k++)
  ------------------
  |  Branch (1103:15): [True: 371, False: 371]
  ------------------
 1104|    371|	{	last_val += LE2H_16 (src [k]) ;
  ------------------
  |  |  137|    371|	#define LE2H_16(x)			(x)
  ------------------
 1105|    371|		dest [k] = last_val ;
 1106|    371|		} ;
 1107|       |
 1108|    371|	pxi->last_16 = last_val ;
 1109|    371|} /* dles2s_array */
xi.c:xi_read_header:
  331|    196|{	char	buffer [64], name [32] ;
  332|    196|	short	version, fade_out, sample_count ;
  333|    196|	int		k, loop_begin, loop_end ;
  334|    196|	int 	sample_sizes [MAX_XI_SAMPLES] ;
  335|       |
  336|    196|	psf_binheader_readf (psf, "pb", 0, buffer, 21) ;
  337|       |
  338|    196|	memset (sample_sizes, 0, sizeof (sample_sizes)) ;
  339|       |
  340|    196|	buffer [20] = 0 ;
  341|    196|	if (strcmp (buffer, "Extended Instrument:") != 0)
  ------------------
  |  Branch (341:6): [True: 73, False: 123]
  ------------------
  342|     73|		return SFE_XI_BAD_HEADER ;
  343|       |
  344|    123|	memset (buffer, 0, sizeof (buffer)) ;
  345|    123|	psf_binheader_readf (psf, "b", buffer, 23) ;
  346|       |
  347|    123|	if (buffer [22] != 0x1A)
  ------------------
  |  Branch (347:6): [True: 6, False: 117]
  ------------------
  348|      6|		return SFE_XI_BAD_HEADER ;
  349|       |
  350|    117|	buffer [22] = 0 ;
  351|    423|	for (k = 21 ; k >= 0 && buffer [k] == ' ' ; k --)
  ------------------
  |  Branch (351:16): [True: 422, False: 1]
  |  Branch (351:26): [True: 306, False: 116]
  ------------------
  352|    306|		buffer [k] = 0 ;
  353|       |
  354|    117|	psf_log_printf (psf, "Extended Instrument : %s\n", buffer) ;
  355|    117|	psf_store_string (psf, SF_STR_TITLE, buffer) ;
  356|       |
  357|    117|	psf_binheader_readf (psf, "be2", buffer, 20, &version) ;
  358|    117|	buffer [19] = 0 ;
  359|    248|	for (k = 18 ; k >= 0 && buffer [k] == ' ' ; k --)
  ------------------
  |  Branch (359:16): [True: 247, False: 1]
  |  Branch (359:26): [True: 131, False: 116]
  ------------------
  360|    131|		buffer [k] = 0 ;
  361|       |
  362|    117|	psf_log_printf (psf, "Software : %s\nVersion  : %d.%02d\n", buffer, version / 256, version % 256) ;
  363|    117|	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|    117|	psf_binheader_readf (psf, "j", 96 + 48 + 48 + 1 + 1) ;
  369|       |
  370|    117|	psf_binheader_readf (psf, "b", buffer, 12) ;
  371|    117|	psf_log_printf (psf, "Volume Loop\n  sustain : %u\n  begin   : %u\n  end     : %u\n",
  372|    117|						buffer [0], buffer [1], buffer [2]) ;
  373|    117|	psf_log_printf (psf, "Pan Loop\n  sustain : %u\n  begin   : %u\n  end     : %u\n",
  374|    117|						buffer [3], buffer [4], buffer [5]) ;
  375|    117|	psf_log_printf (psf, "Envelope Flags\n  volume  : 0x%X\n  pan     : 0x%X\n",
  376|    117|				buffer [6] & 0xFF, buffer [7] & 0xFF) ;
  377|       |
  378|    117|	psf_log_printf (psf, "Vibrato\n  type    : %u\n  sweep   : %u\n  depth   : %u\n  rate    : %u\n",
  379|    117|				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|    117|	psf_binheader_readf (psf, "e2j2", &fade_out, 2 + 20, &sample_count) ;
  386|    117|	psf_log_printf (psf, "Fade out  : %d\n", fade_out) ;
  387|       |
  388|       |	/* XI file can contain up to 16 samples. */
  389|    117|	if (sample_count > MAX_XI_SAMPLES)
  ------------------
  |  |   32|    117|#define	MAX_XI_SAMPLES	16
  ------------------
  |  Branch (389:6): [True: 1, False: 116]
  ------------------
  390|      1|		return SFE_XI_EXCESS_SAMPLES ;
  391|       |
  392|    116|	if (psf->instrument == NULL && (psf->instrument = psf_instrument_alloc ()) == NULL)
  ------------------
  |  Branch (392:6): [True: 116, False: 0]
  |  Branch (392:33): [True: 0, False: 116]
  ------------------
  393|      0|		return SFE_MALLOC_FAILED ;
  394|       |
  395|    116|	psf->instrument->basenote = 0 ;
  396|       |	/* Log all data for each sample. */
  397|    706|	for (k = 0 ; k < sample_count ; k++)
  ------------------
  |  Branch (397:15): [True: 590, False: 116]
  ------------------
  398|    590|	{	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|    590|		psf_binheader_readf (psf, "bb", buffer, 6, name, 22) ;
  402|    590|		name [21] = 0 ;
  403|       |
  404|    590|		psf_log_printf (psf, "Sample #%d\n  name    : %s\n", k + 1, name) ;
  405|       |
  406|    590|		psf_log_printf (psf, "  size    : %d\n", sample_sizes [k]) ;
  407|       |
  408|    590|		psf_log_printf (psf, "  loop\n    begin : %d\n    end   : %d\n", loop_begin, loop_end) ;
  409|       |
  410|    590|		psf_log_printf (psf, "  volume  : %u\n  f. tune : %d\n  flags   : 0x%02X ",
  411|    590|					buffer [0] & 0xFF, buffer [1] & 0xFF, buffer [2] & 0xFF) ;
  412|       |
  413|    590|		psf_log_printf (psf, " (") ;
  414|    590|		if (buffer [2] & 1)
  ------------------
  |  Branch (414:7): [True: 100, False: 490]
  ------------------
  415|    100|			psf_log_printf (psf, " Loop") ;
  416|    590|		if (buffer [2] & 2)
  ------------------
  |  Branch (416:7): [True: 77, False: 513]
  ------------------
  417|     77|			psf_log_printf (psf, " PingPong") ;
  418|    590|		psf_log_printf (psf, (buffer [2] & 16) ? " 16bit" : " 8bit") ;
  ------------------
  |  Branch (418:24): [True: 77, False: 513]
  ------------------
  419|    590|		psf_log_printf (psf, " )\n") ;
  420|       |
  421|    590|		psf_log_printf (psf, "  pan     : %u\n  note    : %d\n  namelen : %d\n",
  422|    590|					buffer [3] & 0xFF, buffer [4], buffer [5]) ;
  423|       |
  424|    590|		psf->instrument->basenote = buffer [4] ;
  425|    590|		if (buffer [2] & 1)
  ------------------
  |  Branch (425:7): [True: 100, False: 490]
  ------------------
  426|    100|		{	psf->instrument->loop_count = 1 ;
  427|    100|			psf->instrument->loops [0].mode = (buffer [2] & 2) ? SF_LOOP_ALTERNATING : SF_LOOP_FORWARD ;
  ------------------
  |  Branch (427:38): [True: 62, False: 38]
  ------------------
  428|    100|			psf->instrument->loops [0].start = loop_begin ;
  429|    100|			psf->instrument->loops [0].end = loop_end ;
  430|    100|			} ;
  431|       |
  432|    590|		if (k != 0)
  ------------------
  |  Branch (432:7): [True: 494, False: 96]
  ------------------
  433|    494|			continue ;
  434|       |
  435|     96|		if (buffer [2] & 16)
  ------------------
  |  Branch (435:7): [True: 28, False: 68]
  ------------------
  436|     28|		{	psf->sf.format = SF_FORMAT_XI | SF_FORMAT_DPCM_16 ;
  437|     28|			psf->bytewidth = 2 ;
  438|     28|			}
  439|     68|		else
  440|     68|		{	psf->sf.format = SF_FORMAT_XI | SF_FORMAT_DPCM_8 ;
  441|     68|			psf->bytewidth = 1 ;
  442|     68|			} ;
  443|     96|		} ;
  444|       |
  445|    507|	while (sample_count > 1 && sample_sizes [sample_count - 1] == 0)
  ------------------
  |  Branch (445:9): [True: 431, False: 76]
  |  Branch (445:29): [True: 391, False: 40]
  ------------------
  446|    391|		sample_count -- ;
  447|       |
  448|       |	/* Currently, we can only handle 1 sample per file. */
  449|       |
  450|    116|	if (sample_count > 2)
  ------------------
  |  Branch (450:6): [True: 16, False: 100]
  ------------------
  451|     16|	{	psf_log_printf (psf, "*** Sample count is less than 16 but more than 1.\n") ;
  452|     16|		psf_log_printf (psf, "  sample count : %d    sample_sizes [%d] : %d\n",
  453|     16|						sample_count, sample_count - 1, sample_sizes [sample_count - 1]) ;
  454|     16|		return SFE_XI_EXCESS_SAMPLES ;
  455|    100|		} ;
  456|       |
  457|    100|	psf->datalength = sample_sizes [0] ;
  458|       |
  459|    100|	psf->dataoffset = psf_ftell (psf) ;
  460|    100|	if (psf->dataoffset < 0)
  ------------------
  |  Branch (460:6): [True: 0, False: 100]
  ------------------
  461|      0|	{	psf_log_printf (psf, "*** Bad Data Offset : %D\n", psf->dataoffset) ;
  462|      0|		return SFE_BAD_OFFSET ;
  463|    100|		} ;
  464|    100|	psf_log_printf (psf, "Data Offset : %D\n", psf->dataoffset) ;
  465|       |
  466|    100|	if (psf->dataoffset + psf->datalength > psf->filelength)
  ------------------
  |  Branch (466:6): [True: 23, False: 77]
  ------------------
  467|     23|	{	psf_log_printf (psf, "*** File seems to be truncated. Should be at least %D bytes long.\n",
  468|     23|				psf->dataoffset + sample_sizes [0]) ;
  469|     23|		psf->datalength = psf->filelength - psf->dataoffset ;
  470|     23|		} ;
  471|       |
  472|    100|	if (psf_fseek (psf, psf->dataoffset, SEEK_SET) != psf->dataoffset)
  ------------------
  |  Branch (472:6): [True: 0, False: 100]
  ------------------
  473|      0|		return SFE_BAD_SEEK ;
  474|       |
  475|    100|	psf->endian = SF_ENDIAN_LITTLE ;
  476|    100|	psf->sf.channels = 1 ; /* Always mono */
  477|    100|	psf->sf.samplerate = 44100 ; /* Always */
  478|       |
  479|    100|	psf->blockwidth = (sf_count_t) psf->sf.channels * psf->bytewidth ;
  480|       |
  481|    100|	if (! psf->sf.frames && psf->blockwidth)
  ------------------
  |  Branch (481:6): [True: 100, False: 0]
  |  Branch (481:26): [True: 80, False: 20]
  ------------------
  482|     80|		psf->sf.frames = (psf->filelength - psf->dataoffset) / psf->blockwidth ;
  483|       |
  484|    100|	psf->instrument->gain = 1 ;
  485|    100|	psf->instrument->velocity_lo = psf->instrument->key_lo = 0 ;
  486|    100|	psf->instrument->velocity_hi = psf->instrument->key_hi = 127 ;
  487|       |
  488|    100|	return 0 ;
  489|    100|} /* xi_read_header */

