/**************************************************************************************
 * Function:    DecodeFillElement
 *
 * Description: decode one fill element
 *
 * Inputs:      BitStreamInfo struct pointing to start of fill element
 *                (14496-3, table 4.4.11) 
 *
 * Outputs:     updated element instance tag
 *              unpacked extension payload
 *
 * Return:      0 if successful, -1 if error
 **************************************************************************************/
static int DecodeFillElement(AACDecInfo *aacDecInfo, BitStreamInfo *bsi)
{
	unsigned int fillCount;
	unsigned char *fillBuf;
	PSInfoBase *psi;

	/* validate pointers */
	if (!aacDecInfo || !aacDecInfo->psInfoBase)
		return -1;
	psi = (PSInfoBase *)(aacDecInfo->psInfoBase);

	fillCount = GetBits(bsi, 4);
	if (fillCount == 15)
		fillCount += (GetBits(bsi, 8) - 1);

	psi->fillCount = fillCount;
	fillBuf = psi->fillBuf;
	while (fillCount--)
		*fillBuf++ = GetBits(bsi, 8);

	aacDecInfo->currInstTag = -1;	/* fill elements don't have instance tag */
	aacDecInfo->fillExtType = 0;

#ifdef AAC_ENABLE_SBR
	/* check for SBR 
	 * aacDecInfo->sbrEnabled is sticky (reset each raw_data_block), so for multichannel 
	 *    need to verify that all SCE/CPE/ICCE have valid SBR fill element following, and 
	 *    must upsample by 2 for LFE
	 */
	if (psi->fillCount > 0) {
		aacDecInfo->fillExtType = (int)((psi->fillBuf[0] >> 4) & 0x0f);
		if (aacDecInfo->fillExtType == EXT_SBR_DATA || aacDecInfo->fillExtType == EXT_SBR_DATA_CRC)
			aacDecInfo->sbrEnabled = 1;
	}
void AVRStudioXMLParser::Parse(QString configDirPath, Part *pPart)
{
    QXmlQuery query;
    QString result;
    query.bindVariable("partName", QVariant(configDirPath));
    query.setQuery(GetXQuery());
    query.evaluateTo(&result);

    // for future use
    QString errorMsg;
    int line;
    int col;

    QDomDocument doc;
    if(!doc.setContent(result, &errorMsg, &line, &col))
        return;

    QDomNode root = doc.firstChild();
    QDomNode fuses = root.firstChild();
    QDomNode locks = fuses.nextSibling();
    QDomNode interfaces = locks.nextSibling();

    pPart->SetFuseBits(GetBits(fuses.firstChild()));
    pPart->SetLockBits(GetBits(locks.firstChild()));
    pPart->SetProgrammingInterfaces(GetInterfaces(interfaces.firstChild()));
}
Exemplo n.º 3
0
/*
  The function reads the elements for pulse data from
  the bitstream.
*/
void CPulseData_Read(HANDLE_BIT_BUF bs,     /*!< pointer to bitstream */
                     CPulseData *PulseData) /*!< pointer to pulse data side info */
{
  int i;

  FLC_sub_start("CPulseData_Read");

  FUNC(2); INDIRECT(1); STORE(1); BRANCH(1);
  if ((PulseData->PulseDataPresent = (char) GetBits(bs,1)))
  {
    FUNC(2); INDIRECT(2); STORE(1);
    PulseData->NumberPulse = (char) GetBits(bs,2);

    FUNC(2); INDIRECT(2); STORE(1);
    PulseData->PulseStartBand = (char) GetBits(bs,6);

    PTR_INIT(2); /* PulseData->PulseOffset[i]
                    PulseData->PulseAmp[i]
                 */
    LOOP(1);
    for (i=0; i<=PulseData->NumberPulse; i++)
    {
      FUNC(2); STORE(1);
      PulseData->PulseOffset[i] = (char) GetBits(bs,5);

      FUNC(2); STORE(1);
      PulseData->PulseAmp[i] = (char) GetBits(bs,4);
    }
  }

  FLC_sub_end();
}
/**************************************************************************************
 * Function:    DecodeDataStreamElement
 *
 * Description: decode one DSE
 *
 * Inputs:      BitStreamInfo struct pointing to start of DSE (14496-3, table 4.4.10) 
 *
 * Outputs:     updated element instance tag
 *              filled in data stream buffer
 *
 * Return:      0 if successful, -1 if error
 **************************************************************************************/
static int DecodeDataStreamElement(AACDecInfo *aacDecInfo, BitStreamInfo *bsi)
{
	unsigned int byteAlign, dataCount;
	unsigned char *dataBuf;
	PSInfoBase *psi;

	/* validate pointers */
	if (!aacDecInfo || !aacDecInfo->psInfoBase)
		return -1;
	psi = (PSInfoBase *)(aacDecInfo->psInfoBase);

	aacDecInfo->currInstTag = GetBits(bsi, NUM_INST_TAG_BITS);
	byteAlign = GetBits(bsi, 1);
	dataCount = GetBits(bsi, 8);
	if (dataCount == 255)
		dataCount += GetBits(bsi, 8);

	if (byteAlign)
		ByteAlignBitstream(bsi);

	psi->dataCount = dataCount;
	dataBuf = psi->dataBuf;
	while (dataCount--)
		*dataBuf++ = GetBits(bsi, 8);

	return 0;
}
Exemplo n.º 5
0
static uint32
rfx_rlgr_get_gr_code(RFX_BITSTREAM * bs, int * krp, int * kr)
{
	int vk;
	uint32 mag;

	/* chew up/count leading 1s and escape 0 */
	for (vk = 0; GetBits(1) == 1;)
		vk++;

	/* get next *kr bits, and combine with leading 1s */
	mag = (vk << *kr) | GetBits(*kr);

	/* adjust krp and kr based on vk */
	if (!vk)
	{
		UpdateParam(*krp, -2, *kr);
	}
	else if (vk != 1)
	{
		/* at 1, no change! */
		UpdateParam(*krp, vk, *kr);
	}

	return mag;
}
Exemplo n.º 6
0
//把出现过的字符编码表经过压缩写进文件
short CodeToFile(FILE *fp,char **hc,short n,SeqQueue *Q,MyType *length)
{
    int i;
    char *p;
    MyType j,bits;
    short count=0;

    for(i = 0;i < n;i++)// 将n个叶子压缩并写入文件
    {
        for(p = hc[i]; '\0' != *p; p++)
            In_seqQueue( Q,*p );

        while(Q->length > 8)
        {
            bits = GetBits(Q);//出队8个元素
            fputc(bits,fp);
            count++;
        }
    }

    *length = Q->length;
    i = 8 - *length;
    bits = GetBits(Q);//取8个如果队不空
    for(j = 0;j < i;j++)
        bits = bits << 1;
    fputc(bits,fp);
    count++;

    InitQueue(Q);
    return count;
}
Exemplo n.º 7
0
bool CxImageSKA::Decode(CxFile *hFile)
{
	if (hFile==NULL)
		return false;

	// read the  header
	SKAHEADER ska_header;
	hFile->Read(&ska_header,sizeof(SKAHEADER),1);

    ska_header.Width = ntohs(ska_header.Width);
    ska_header.Height = ntohs(ska_header.Height);
    ska_header.dwUnknown = ntohl(ska_header.dwUnknown);

	// check header
	if (ska_header.dwUnknown != 0x01000000 ||
		ska_header.Width > 0x7FFF || ska_header.Height > 0x7FFF ||
		ska_header.BppExp != 3)
		return false;

	if (info.nEscape == -1){
		head.biWidth = ska_header.Width ;
		head.biHeight= ska_header.Height;
		info.dwType = CXIMAGE_FORMAT_SKA;
		return true;
	}

	int bpp = 1<<ska_header.BppExp;

	Create(ska_header.Width,ska_header.Height,bpp,CXIMAGE_FORMAT_SKA);
	if (!IsValid())
		return false;

	// read the palette
	int nColors = 1<<bpp;
	rgb_color* ppal = (rgb_color*)malloc(nColors*sizeof(rgb_color));
	if (!ppal) return false;
	hFile->Read(ppal,nColors*sizeof(rgb_color),1);
	SetPalette(ppal,nColors);
	free(ppal);

	//read the image
	hFile->Read(GetBits(),ska_header.Width*ska_header.Height,1);

	//reorder rows
	if (GetEffWidth() != ska_header.Width){
		BYTE *src,*dst;
		src = GetBits() + ska_header.Width*(ska_header.Height-1);
		dst = GetBits(ska_header.Height-1);
		for(int y=0;y<ska_header.Height;y++){
			memcpy(dst,src,ska_header.Width);
			src -= ska_header.Width;
			dst -= GetEffWidth();
		}
	}

	Flip();

	return true;
}
Exemplo n.º 8
0
DWORD
UninstDbgBreakfromThrd( DWORD dwThreadId, DWORD dwLineAddr,  DWORD dwAccessType)
{
	HANDLE hThread;
	hThread = OpenThread( THREAD_SET_CONTEXT|THREAD_GET_CONTEXT|THREAD_SUSPEND_RESUME, 
		FALSE, dwThreadId );
	if ( hThread == NULL )
		return GetLastError();

	if ( -1 == SuspendThread( hThread ))
		return GetLastError();

	CONTEXT cxt = {0};
	cxt.ContextFlags = CONTEXT_DEBUG_REGISTERS|CONTEXT_FULL;
	if (!GetThreadContext( hThread, &cxt ))
		return GetLastError();

	if (cxt.Dr0 == dwLineAddr)
	{
		if (dwAccessType == GetBits(cxt.Dr7, 16, 2))
		{
			SetBits(cxt.Dr7, DR7_L0, 1, 0);
		}
	}
	if (cxt.Dr1 == dwLineAddr)
	{
		if (dwAccessType == GetBits(cxt.Dr7, 20, 2))
		{
			SetBits(cxt.Dr7, DR7_L1, 1, 0);
		}
	}
	if (cxt.Dr2 == dwLineAddr)
	{
		if (dwAccessType == GetBits(cxt.Dr7, 24, 2))
		{
			SetBits(cxt.Dr7, DR7_L2, 1, 0);
		}
	}
	if (cxt.Dr3 == dwLineAddr)
	{
		if (dwAccessType == GetBits(cxt.Dr7, 28, 2))
		{
			SetBits(cxt.Dr7, DR7_L3, 1, 0);
		}
	}
	
	cxt.ContextFlags = CONTEXT_DEBUG_REGISTERS;
	if(!SetThreadContext( hThread, &cxt ))
		return GetLastError();
	if(-1 == ResumeThread( hThread ))
		return GetLastError();
	return 0;
}
Exemplo n.º 9
0
/*  
 *  GetDCFCounter
 *
 *  Description:
 *      This function will read a counter from a specified 
 *      position in a dynamic count filter.
 *
 *  Parameters:
 *      dcf: [in]
 *          The dynamic count filter whose counter is to be read.
 *      index: [in]
 *          The index of the counter to be read.
 *
 *  Returns:
 *      The counter in the specified position.
 *
 *  Comments:
 *
 */
unsigned GetDCFCounter(DynamicCountFilter *dcf, unsigned index)
{
	unsigned ofvCounter;
	unsigned cbfvCounter = GetBits((unsigned *)dcf->CBFV, 
			                       index * dcf->CBFV_Counter_Size, 
			                       dcf->CBFV_Counter_Size);
	if (dcf->OFV == NULL)
		return cbfvCounter;

	ofvCounter = GetBits((unsigned *)dcf->OFV, 
			             index * dcf->OFV_Counter_Size, 
			             dcf->OFV_Counter_Size);
	return (ofvCounter << dcf->CBFV_Counter_Size) | cbfvCounter;
}
Exemplo n.º 10
0
/**************************************************************************************
 * Function:    DecodeChannelPairElement
 *
 * Description: decode one CPE
 *
 * Inputs:      BitStreamInfo struct pointing to start of CPE (14496-3, table 4.4.5) 
 *
 * Outputs:     updated element instance tag
 *              updated commonWin
 *              updated ICS info, if commonWin == 1
 *              updated mid-side stereo info, if commonWin == 1
 *
 * Return:      0 if successful, -1 if error
 *
 * Notes:       doesn't decode individual channel stream (part of DecodeNoiselessData)
 **************************************************************************************/
static int DecodeChannelPairElement(AACDecInfo *aacDecInfo, BitStreamInfo *bsi)
{
	int sfb, gp, maskOffset;
	unsigned char currBit, *maskPtr;
	PSInfoBase *psi;
	ICSInfo *icsInfo;

	/* validate pointers */
	if (!aacDecInfo || !aacDecInfo->psInfoBase)
		return -1;
	psi = (PSInfoBase *)(aacDecInfo->psInfoBase);
	icsInfo = psi->icsInfo;

	/* read instance tag */
	aacDecInfo->currInstTag = GetBits(bsi, NUM_INST_TAG_BITS);

	/* read common window flag and mid-side info (if present) 
	 * store msMask bits in psi->msMaskBits[] as follows:
	 *  long blocks -  pack bits for each SFB in range [0, maxSFB) starting with lsb of msMaskBits[0]
	 *  short blocks - pack bits for each SFB in range [0, maxSFB), for each group [0, 7]
	 * msMaskPresent = 0 means no M/S coding
	 *               = 1 means psi->msMaskBits contains 1 bit per SFB to toggle M/S coding
	 *               = 2 means all SFB's are M/S coded (so psi->msMaskBits is not needed)
	 */
	psi->commonWin = GetBits(bsi, 1);
	if (psi->commonWin) {
		DecodeICSInfo(bsi, icsInfo, psi->sampRateIdx);
		psi->msMaskPresent = GetBits(bsi, 2);
		if (psi->msMaskPresent == 1) {
			maskPtr = psi->msMaskBits;
			*maskPtr = 0;
			maskOffset = 0;
			for (gp = 0; gp < icsInfo->numWinGroup; gp++) {
				for (sfb = 0; sfb < icsInfo->maxSFB; sfb++) {
					currBit = (unsigned char)GetBits(bsi, 1);
					*maskPtr |= currBit << maskOffset;
					if (++maskOffset == 8) {
						maskPtr++;
						*maskPtr = 0;
						maskOffset = 0;
					}
				}		
			}
		}
	}

	return 0;
}
Exemplo n.º 11
0
bool CImageEx::SetGray()
{
	int nWidth = GetWidth();
	int nHeight = GetHeight();

	BYTE* pArray = (BYTE*)GetBits();
	int nPitch = GetPitch();
	int nBitCount = GetBPP() / 8;

	for (int i = 0; i < nHeight; i++) 
	{
		for (int j = 0; j < nWidth; j++) 
		{
			int grayVal = (BYTE)(((*(pArray + nPitch * i + j * nBitCount) * 306)
				+ (*(pArray + nPitch * i + j * nBitCount + 1) * 601)
				+ (*(pArray + nPitch * i + j * nBitCount + 2) * 117) + 512 ) >> 10);	// ¼ÆËã»Ò¶ÈÖµ

			*(pArray + nPitch * i + j * nBitCount) = grayVal;							// ¸³»Ò¶ÈÖµ
			*(pArray + nPitch * i + j * nBitCount + 1) = grayVal;
			*(pArray + nPitch * i + j * nBitCount + 2) = grayVal;
		}
	}

	return true;
}
Exemplo n.º 12
0
oexINT CImage::GetBits( oexPVOID x_buf, oexINT x_nSize )
{
#if !defined( OEX_ENABLE_XIMAGE )
	return 0;
#else

	// Sanity checks
	if ( !x_buf || !x_nSize )
		return 0;

	// Get image size
	oexINT nSize = GetImageSize();
	if ( nSize > x_nSize )
		nSize = x_nSize;

	// Get destination buffer
	oexPVOID pBits = GetBits();
	if ( !pBits )
		return 0;

	// Copy the data
	memcpy( x_buf, pBits, nSize );

	return nSize;
#endif
}
Exemplo n.º 13
0
BYTE CxDib::GetPixelIndex(long x,long y)
{
	if ((hDib==NULL)||(m_nColors==0)||
		(x<0)||(y<0)||(x>=m_bi.biWidth)||(y>=m_bi.biHeight)) return 0;
	BYTE* iDst = GetBits();
	return iDst[(m_bi.biHeight - y)*m_LineWidth + x];
}
Exemplo n.º 14
0
/**************************************************************************************
 * Function:    DecodeEnvelope
 *
 * Description: decode the power envelope
 *
 * Inputs:      pointer to initialized Gecko2Info struct
 *              number of bits remaining in bitstream for this frame
 *              index of current channel
 *
 * Outputs:     rmsIndex[0, ..., cregsions-1] has power index for each region
 *              updated rmsMax with largest value of rmsImdex for this channel
 *
 * Return:      number of bits remaining in bitstream, -1 if out-of-bits
 **************************************************************************************/
int DecodeEnvelope(Gecko2Info *gi, int availbits, int ch)
{
	int r, code, nbits, rprime, cache, rmsMax;
	int *rmsIndex = gi->db.rmsIndex;
	BitStreamInfo *bsi = &(gi->bsi);

	if (availbits < RMS0BITS)
		return -1;

	/* unpack first index */
	code = GetBits(bsi, RMS0BITS, 1); 
	availbits -= RMS0BITS;
	rmsIndex[0] = CODE2RMS(code);

	/* check for escape code */
	/* ASSERT(rmsIndex[0] != 0); */

	rmsMax = rmsIndex[0];
	for (r = 1; r < gi->cRegions; r++) {

		/* for interleaved regions, choose a reasonable table */
		if (r < 2 * gi->cplStart) {
			rprime = r >> 1;
			if (rprime < 1) 
				rprime = 1;
		} else {
Exemplo n.º 15
0
void
Dib::Render (/*[in]*/ HDC	hdc,
	     /*[in]*/ int	x,
	     /*[in]*/ int	y,
	     /*[in]*/ int	cx,
	     /*[in]*/ int	cy)
{
  if (cx < 0)
  {
    cx = GetWidth();
  }
  if (cy < 0)
  {
    cy = GetHeight();
  }
  SetStretchBltMode (hdc, COLORONCOLOR);
  if (StretchDIBits(hdc,
    x,
    y,
    cx,
    cy,
    0,
    0,
    GetWidth(),
    GetHeight(),
    GetBits(),
    GetBitmapInfo(),
    DIB_RGB_COLORS,
    SRCCOPY)
      == GDI_ERROR)
  {
    FATAL_WINDOWS_ERROR ("StretchDIBits", 0);
  }
}
Exemplo n.º 16
0
/*  
 *  RebuildOFV
 *
 *  Description:
 *      This function will rebuild the overflow vector of the 
 *      specified dynamic count filter with a new counter size.
 *
 *  Parameters:
 *      dcf: [in/out]
 *          The dynamic count filter whose overflow vector is 
 *          to be rebuilt.
 *      counterSize: [in]
 *          The new counter size of the overflow vector.
 *
 *  Returns:
 *      Nothing.
 *
 *  Comments:
 *
 */
void RebuildOFV(DynamicCountFilter *dcf, unsigned counterSize)
{
	if (counterSize == 0)  /* delete OFV */
	{
		free(dcf->OFV);
		dcf->OFV = NULL;
	}
	else if (counterSize == 1 && dcf->OFV_Counter_Size == 0)  /* create OFV */
	{
		dcf->OFV = (char *)calloc(dcf->Length / 8, 1);
	}
	else  /* rebuild OFV */
	{
		unsigned i, counter;
		char *newOFV = (char *)calloc(dcf->Length / 8 * counterSize, 1);
		for (i = 0; i < dcf->Length; i++)
		{
			counter = GetBits((unsigned *)dcf->OFV, 
				              i * dcf->OFV_Counter_Size, 
							  dcf->OFV_Counter_Size);
			if (counter > 0)
				SetBits((unsigned *)newOFV, i * counterSize, 
				        counterSize, counter);
		}
		free(dcf->OFV);
		dcf->OFV = newOFV;
	}

	dcf->OFV_Counter_Size = counterSize;
}
Exemplo n.º 17
0
/*  
 *  BFMembershipQuery
 *
 *  Description:
 *      This function will query whether a specified element 
 *      is a member of the set represented by the specified 
 *      bloom filter.
 *
 *  Parameters:
 *      bf: [in]
 *          The bloom filter on which the query is done.
 *      element: [in]
 *          The element to be checked.
 *      length: [in]
 *          The bytes of the element.
 *
 *  Returns:
 *      1 if the element is a member of the set, otherwise 0.
 *
 *  Comments:
 *
 */
int BFMembershipQuery(BloomFilter *bf, const unsigned char *element, unsigned length)
{
	int result = 1, i;

	/*
	 * generate k hash addresses
	 */
	unsigned *hashAddress = (unsigned *)malloc(sizeof(unsigned) * bf->Hash_Num);
	if (!GenerateHashAddress(element, length, bf->Length, bf->Hash_Num, hashAddress))
	{
		free(hashAddress);
		return 0;
	}

	/*
	 * check the bit in each hash address
	 */
	for (i = 0; i < bf->Hash_Num; i++)
	{
		if (!GetBits((unsigned *)bf->Bit_Array, hashAddress[i], 1))
		{
			result = 0;
			break;
		}
	}

	free(hashAddress);
	return result;
}
Exemplo n.º 18
0
void CCeXDib::Draw(HDC hDC, DWORD dwX, DWORD dwY)
{
	HBITMAP	hBitmap = NULL;
	HBITMAP	hOldBitmap = NULL;
	HDC		hMemDC = NULL;

	if (m_hBitmap == NULL)
	{
		m_hBitmap = CreateDIBSection(hDC, (BITMAPINFO*)m_hDib, DIB_RGB_COLORS, &m_lpBits, NULL, 0);
		if (m_hBitmap == NULL)	return;
		if (m_lpBits == NULL)
		{
			::DeleteObject(m_hBitmap);
			m_hBitmap = NULL;
			return;
		} // if
	} // if

    memcpy(m_lpBits, GetBits(), m_bi.biSizeImage);

	if (m_hMemDC == NULL)
	{
		m_hMemDC = CreateCompatibleDC(hDC);
		if (m_hMemDC == NULL)	return;
	} // if

	hOldBitmap = (HBITMAP)SelectObject(m_hMemDC, m_hBitmap);

	BitBlt(hDC, dwX, dwY, m_bi.biWidth, m_bi.biHeight, m_hMemDC, 0, 0, SRCCOPY);

	SelectObject(m_hMemDC, hOldBitmap);
} // End of Draw
Exemplo n.º 19
0
/* Expand group-4 data */
void
g4expand(struct pagenode *pn, drawfunc df)
{
    int RunLength;		/* Length of current run */
    int a0;			/* reference element */
    int b1;			/* next change on previous line */
    int lastx = pn->size.width();/* copy line width to register */
    pixnum *run0, *run1;	/* run length arrays */
    pixnum *thisrun, *pa, *pb;	/* pointers into runs */
    t16bits *sp;		/* pointer into compressed data */
    t32bits BitAcc;		/* bit accumulator */
    int BitsAvail;		/* # valid bits in BitAcc */
    int	LineNum;		/* line number */
    int EOLcnt;
    struct tabent *TabEnt;

    sp = pn->data;
    BitAcc = 0;
    BitsAvail = 0;
    /* allocate space for 2 runlength arrays */
    run0 = (pixnum *) malloc(2 * ((lastx+5)&~1) * sizeof(pixnum));
    run1 = run0 + ((lastx+5)&~1);
    run1[0] = lastx;		/* initial reference line */
    run1[1] = 0;

    for (LineNum = 0; LineNum < pn->rowsperstrip; ) {
#ifdef DEBUG_FAX
	printf("\nBitAcc=%08lX, BitsAvail = %d\n", BitAcc, BitsAvail);
	printf("-------------------- %d\n", LineNum);
	fflush(stdout);
#endif
	RunLength = 0;
	if (LineNum & 1) {
	    pa = run1;
	    pb = run0;
	}
	else {
	    pa = run0;
	    pb = run1;
	}
	thisrun = pa;
	a0 = 0;
	b1 = *pb++;
	expand2d(EOFB);
	if (a0 < lastx) {
	    if ((pa - run0) & 1)
		SETVAL(0);
	    SETVAL(lastx - a0);
	}
	SETVAL(0);	/* imaginary change at end of line for reference */
	(*df)(thisrun, LineNum++, pn);
	continue;
    EOFB:
	NeedBits(13);
	if (GetBits(13) != 0x1001 && verbose)
            kError() << "Bad RTC\n";
	break;
    }
    free(run0);
}
Exemplo n.º 20
0
wxSoundStream& wxSoundStreamG72X::Write(const void *buffer, wxUint32 len)
{
    wxUint16 *old_linear;
    register wxUint16 *linear_buffer;
    register wxUint32 countdown = len;
    register wxUint32 real_len;
    
    // Compute the real length (PCM format) to sendt to the sound card
    real_len = (len * m_n_bits / 8);
    
    // Allocate a temporary buffer
    old_linear = linear_buffer = new wxUint16[real_len];
    
    // Bad, we override the const
    m_io_buffer = (wxUint8 *)buffer;
    m_current_b_pos = 0;
    
    // Decode the datas
    while (countdown != 0) {
        *linear_buffer++ = m_decoder(GetBits(), AUDIO_ENCODING_LINEAR, m_state);
        countdown--;
    }
    m_lastcount = len;
    
    // Send them to the sound card
    m_router->Write(old_linear, real_len);
    
    // Destroy the temporary buffer
    delete[] old_linear;
    
    return *m_router;
}
Exemplo n.º 21
0
void CxDib::SetPixelIndex(long x,long y,BYTE i)
{
	if ((hDib==NULL)||(m_nColors==0)||
		(x<0)||(y<0)||(x>=m_bi.biWidth)||(y>=m_bi.biHeight)) return ;
	BYTE* iDst = GetBits();
	iDst[(m_bi.biHeight - y)*m_LineWidth + x]=i;
	return;
}
Exemplo n.º 22
0
	int Buffer::GetBits() const
	{
	    #ifdef HAS_AUDIO_BUFFER
		return impl->GetBits();
		#else
		throw System::PunkException(L"Audio buffer not supported");
		#endif
	}
Exemplo n.º 23
0
void CCeXDib::SetPixelIndex(DWORD dwX, DWORD dwY, BYTE byI)
{
	if ((m_hDib == NULL) || (m_wColors == 0) ||
		((long)dwX < 0) || ((long)dwY < 0) || (dwX >= (DWORD)m_bi.biWidth) || (dwY >= (DWORD)m_bi.biHeight)) return;

	LPBYTE iDst = GetBits();
	iDst[(m_bi.biHeight - dwY - 1) * m_dwLineWidth + dwX] = byI;
} // End of SetPixelIndex
Exemplo n.º 24
0
void cal_init(void)
{
	big_ids = cal_get_ids();
	dynimic_ema_big1 = GetBits(CHIPID_ASV_TBL_BASE + 0x000C, 24, 0x7);
	dynimic_ema_big2 = GetBits(CHIPID_ASV_TBL_BASE + 0x000C, 28, 0x7);
	pop_type = GetBits(PKG_ID, 4, 3);
	group_fused = GetBits(CHIPID_ASV_TBL_BASE+0x000C, 16, 0x1);

	use_dynimic_abb[SYSC_DVFS_BIG] = true;
	use_dynimic_abb[SYSC_DVFS_LIT] = true;
	use_dynimic_abb[SYSC_DVFS_G3D] = true;
	use_dynimic_abb[SYSC_DVFS_INT] = true;
	use_dynimic_abb[SYSC_DVFS_MIF] = true;
	use_dynimic_abb[SYSC_DVFS_CAM] = false;

	otp_tmu_read();
	otp_tmu_print_info();
}
Exemplo n.º 25
0
// program configuration element 
static int get_ele_list(BitData *bf, EleList *p, int enable_cpe)
{  
    int i, j, nChannels = 0;
    for (i = 0, j = p->num_ele; i<j; i++) 
	{
		if (enable_cpe)		
		{
			if ((p->ele_is_cpe[i] = GetBits(bf, 1)))
				nChannels++;
		}		
		else
			p->ele_is_cpe[i] = 0; // sdb 

		p->ele_tag[i] = GetBits(bf, 4);
		nChannels++;
    }

	return nChannels;
}
Exemplo n.º 26
0
int32 Int64ToBit( int64 i, uint8 bits, char *file, uint32 line )
{
  const int32 result = GetBits( (uint64)i, bits );

  if ( (int64)result != (int64)i ) {
    MSG_4
      ( MSG_SSID_DFLT, MSG_LEGACY_ERROR,
        "Value truncated from %lli to %i (%s, %u)\n", i, result, file, line);
  }
  return result;
}
Exemplo n.º 27
0
/**************************************************************************************
 * Function:    DecodeSingleChannelElement
 *
 * Description: decode one SCE
 *
 * Inputs:      BitStreamInfo struct pointing to start of SCE (14496-3, table 4.4.4) 
 *
 * Outputs:     updated element instance tag
 *
 * Return:      0 if successful, -1 if error
 *
 * Notes:       doesn't decode individual channel stream (part of DecodeNoiselessData)
 **************************************************************************************/
static int DecodeSingleChannelElement(AACDecInfo *aacDecInfo, BitStreamInfo *bsi)
{
	/* validate pointers */
	if (!aacDecInfo || !aacDecInfo->psInfoBase)
		return -1;

	/* read instance tag */
	aacDecInfo->currInstTag = GetBits(bsi, NUM_INST_TAG_BITS);

	return 0;
}
Exemplo n.º 28
0
u32 cal_get_ids(void)
{
	u32 fused_data;
	fused_data = CHIPID_IsFused_KEY3_IdsATLAS();

	if (fused_data != 0)
		return fused_data;
	else if(GetBits(CHIPID_ASV_TBL_BASE + 0x003C, 28, 0xF) == 0)
		return __raw_readl(CHIPID_ABB_TBL_BASE) & 0xff;
	else
		return __raw_readl(CHIPID_ASV_TBL_BASE + 0x0030) & 0xff;
}
Exemplo n.º 29
0
void CxDib::SetPixelColor(long x,long y,RGBQUAD c)
{
	if ((hDib==NULL)||(x<0)||(y<0)||
		(x>=m_bi.biWidth)||(y>=m_bi.biHeight)) return;
	if (m_nColors)
		SetPixelIndex(x,y,GetNearestIndex(c));
	else {
		BYTE* iDst = GetBits()+(m_bi.biHeight - y)*m_LineWidth + x*sizeof(RGBQUAD);
		*(RGBQUAD*)iDst = c;
	}
	return;
}
Exemplo n.º 30
0
sF32 RangeModel::Encode(RangeCoder &coder,sInt symbol)
{
  sF32 size;

  size = GetBits(symbol);
  SymCount++;
  BitsOut += size;

  coder.Encode(Freq[symbol*2+0],Freq[symbol*2+1],TotFreq);
  Update(symbol);

  return size;
}