MBOOL
Mhal_facebeauty::
doCapture()
{
    MBOOL ret = MFALSE;
    CPTLog(Event_FBShot_Utility, CPTFlagStart);    
    //MINT8 TargetColor = NSCamCustom::get_FB_ColorTarget();
    //MINT8 BlurLevel = NSCamCustom::get_FB_BlurLevel();
    MINT8 TargetColor =0;
    MINT8 BlurLevel =4;

    ret =
        //  ()  Request Buffers.
        requestBufs()
        &&  InitialAlgorithm(mu4W_yuv, mu4H_yuv, BlurLevel, TargetColor)
        &&  createFullFrame(mpSource)
        &&  STEP1(mpSource, mu4W_yuv, mu4H_yuv, mpBlurImg, mpAmap, (void*) &msFaceBeautyResultInfo)
        &&  STEP2(mpSource, mu4W_yuv, mu4H_yuv,mpAmap, &FBmetadata,(void*) &msFaceBeautyResultInfo)
        &&  STEP3(mpAmap,(void*) &msFaceBeautyResultInfo)
        &&  STEP4(mpSource, mu4W_yuv, mu4H_yuv, mpBlurImg, mpAmap, (void*) &msFaceBeautyResultInfo)
        &&  STEP5(mpSource, mu4W_yuv, mu4H_yuv, mpAmap, (void*) &msFaceBeautyResultInfo)
        &&  STEP6(mpSource, mu4W_yuv, mu4H_yuv, mpBlurImg, (void*) &msFaceBeautyResultInfo)
        ;
    if  ( ! ret )
    {
        MY_LOGI("[FBCapture] Capture fail \n");
    }
    sem_post(&semFBthread);

    return ret;
}
示例#2
0
void ws2812_push( uint8_t * buffer, uint16_t buffersize )
{
	uint16_t place;

//	while( !ws2812_dma_complete );

#ifdef WS2812_THREE_SAMPLE
	uint8_t * bufferpl = (uint8_t*)&i2sBlock[0];

//	buffersize += 3;
//	if( buffersize * 4 + 1 > WS_BLOCKSIZE ) return;

	int pl = 0;
	int quit = 0;

	//Once for each led.
	for( place = 0; !quit; place++ )
	{
		uint8_t b;
		b = buffer[pl++]; uint16_t c1a = bitpatterns[(b&0x0f)]; uint16_t c1b = bitpatterns[(b>>4)];
		b = buffer[pl++]; uint16_t c2a = bitpatterns[(b&0x0f)]; uint16_t c2b = bitpatterns[(b>>4)];
		b = buffer[pl++]; uint16_t c3a = bitpatterns[(b&0x0f)]; uint16_t c3b = bitpatterns[(b>>4)];
		b = buffer[pl++]; uint16_t c4a = bitpatterns[(b&0x0f)]; uint16_t c4b = bitpatterns[(b>>4)];

		if( pl >= buffersize )
		{
			quit = 1;
			if( pl-1 >= buffersize ) c4a = c4b = 0;
			if( pl-2 >= buffersize ) c3a = c3b = 0;
			if( pl-3 >= buffersize ) c2a = c2b = 0;
			if( pl-4 >= buffersize ) c1a = c1b = 0;
		}

		//Order of bits on wire: Reverse from how they appear here.
#define STEP1(x) (c##x##b >> 4 )
#define STEP2(x) ((c##x##b << 4 ) | ( c##x##a>>8 ))
#define STEP3(x) (c##x##a & 0xff )

		*(bufferpl++) = STEP1(2);
		*(bufferpl++) = STEP3(1);
		*(bufferpl++) = STEP2(1);
		*(bufferpl++) = STEP1(1);

		*(bufferpl++) = STEP2(3);
		*(bufferpl++) = STEP1(3);
		*(bufferpl++) = STEP3(2);
		*(bufferpl++) = STEP2(2);

		*(bufferpl++) = STEP3(4);
		*(bufferpl++) = STEP2(4);
		*(bufferpl++) = STEP1(4);
		*(bufferpl++) = STEP3(3);
	}

	while( bufferpl < &((uint8_t*)i2sBlock)[WS_BLOCKSIZE] ) *(bufferpl++) = 0;

#elif defined(WS2812_FOUR_SAMPLE)
	uint16_t * bufferpl = (uint16_t*)&i2sBlock[0];

	if( buffersize * 4 > WS_BLOCKSIZE ) return;

	for( place = 0; place < buffersize; place++ )
	{
		uint8_t btosend = buffer[place];
		*(bufferpl++) = bitpatterns[(btosend&0x0f)];
		*(bufferpl++) = bitpatterns[(btosend>>4)&0x0f];
	}
#endif

#ifdef USE_2812_INTERRUPTS

	uint16_t leftover = buffersize & 0x1f;
	if( leftover ) leftover = 32 - leftover;
	for( place = 0; place < leftover; place++ )
	{
		*(bufferpl++) = 0;
		*(bufferpl++) = 0;
	}

	buffersize += leftover;

	uint16_t sizeout_words = buffersize * 2;

	i2sBufDescOut.owner = 1;
	i2sBufDescOut.eof = 1;
	i2sBufDescOut.sub_sof = 0;
	i2sBufDescOut.datalen = sizeout_words*2;  //Size (in bytes)
	i2sBufDescOut.blocksize = sizeout_words*2; //Size (in bytes)
	i2sBufDescOut.buf_ptr = (uint32_t)&i2sBlock[0];
	i2sBufDescOut.unused = 0;
	i2sBufDescOut.next_link_ptr=(uint32_t)&i2sBufDescZeroes; //At the end, just redirect the DMA to the zero buffer.

	SET_PERI_REG_MASK(SLC_RX_LINK, SLC_RXLINK_STOP);
	CLEAR_PERI_REG_MASK(SLC_RX_LINK,SLC_RXLINK_DESCADDR_MASK);
	SET_PERI_REG_MASK(SLC_RX_LINK, ((uint32)&i2sBufDescOut) & SLC_RXLINK_DESCADDR_MASK);
	SET_PERI_REG_MASK(SLC_RX_LINK, SLC_RXLINK_START);

#endif

}