static int set_init( char *nn_dst_val, long long *dst_val, long long lb, long long ub, int ijoin_op ) { int status = 0; // Set nn value as default = false #ifdef ICC ippsSet_8u(0, nn_dst_val+lb, (ub-lb)); #else assign_const_I1(nn_dst_val+lb, FALSE, (ub-lb)); #endif //------------------------------------ if ( dst_val != NULL ) { long long *this_dst_val = dst_val; this_dst_val += lb; switch ( ijoin_op ) { case MJOIN_OP_REG : case MJOIN_OP_SUM : case MJOIN_OP_CNT : case MJOIN_OP_OR : assign_const_I8(this_dst_val, FALSE, (ub-lb)); break; /*---------------------------------------------------------*/ /* TODO: Need to deal with deafult values for AND, MIN, MAX */ case MJOIN_OP_AND : assign_const_I8(this_dst_val, 0xFFFFFFFFFFFFFFFF, (ub-lb)); break; /*---------------------------------------------------------*/ case MJOIN_OP_MIN : assign_const_I8(this_dst_val, LLONG_MAX, (ub-lb)); break; /*---------------------------------------------------------*/ case MJOIN_OP_MAX : assign_const_I8(this_dst_val, LLONG_MIN, (ub-lb)); break; /*---------------------------------------------------------*/ default : go_BYE(-1); break; } } BYE: return(status); }
OsStatus MpeIPPG729::encode(const short* pAudioSamples, const int numSamples, int& rSamplesConsumed, unsigned char* pCodeBuf, const int bytesLeft, int& rSizeInBytes, UtlBoolean& sendNow, MpSpeechType& speechType) { assert((codec->uscParams.pInfo->params.framesize / (codec->uscParams.pInfo->params.pcmType.bitPerSample / 8)) == numSamples); ippsSet_8u(0, (Ipp8u *)outputBuffer, codec->uscParams.pInfo->maxbitsize + 1); ippsCopy_8u((unsigned char *)pAudioSamples, (unsigned char *)inputBuffer, codec->uscParams.pInfo->params.framesize); int frmlen, infrmLen, FrmDataLen; USC_PCMStream PCMStream; USC_Bitstream Bitstream; // Do the pre-procession of the frame infrmLen = USCEncoderPreProcessFrame(&codec->uscParams , inputBuffer, (Ipp8s *)outputBuffer, &PCMStream, &Bitstream); // Encode one frame FrmDataLen = USCCodecEncode(&codec->uscParams, &PCMStream, &Bitstream, 0); if(FrmDataLen < 0) { return OS_FAILED; } infrmLen += FrmDataLen; // Do the post-procession of the frame frmlen = USCEncoderPostProcessFrame(&codec->uscParams, inputBuffer, (Ipp8s *)outputBuffer, &PCMStream, &Bitstream); ippsSet_8u(0, pCodeBuf, 10); if (Bitstream.nbytes == 10 || Bitstream.nbytes == 2) { for(int k = 0; k < Bitstream.nbytes; ++k) { pCodeBuf[k] = outputBuffer[6 + k]; } } else { frmlen = 0; } if (Bitstream.nbytes == 2 || Bitstream.nbytes == 0) { sendNow = TRUE; } else { sendNow = FALSE; } rSamplesConsumed = FrmDataLen / (codec->uscParams.pInfo->params.pcmType.bitPerSample / 8); if (Bitstream.nbytes <= 10) { rSizeInBytes = Bitstream.nbytes; } else { rSizeInBytes = 0; } return OS_SUCCESS; }
failed=1; } } } } #endif /* WITH_IPP */ if (!failed) printf("All set8u tests passed (%s).\n", testStr); return (failed > 0) ? FAILURE : SUCCESS; } /* ------------------------------------------------------------------------- */ STD_SPEED_TEST(set8u_speed_test, BYTE, BYTE, dst=dst, TRUE, memset(dst, constant, size), FALSE, PRIM_NOP, 0, FALSE, TRUE, ippsSet_8u(constant, dst, size)); int test_set8u_speed(void) { BYTE ALIGN(dst[MAX_TEST_SIZE]); set8u_speed_test("set8u", "aligned", NULL, NULL, 0xA5, dst, set_sizes, NUM_SET_SIZES, MEMSET8_PRETEST_ITERATIONS, TEST_TIME); return SUCCESS; } /* ------------------------------------------------------------------------- */ int test_set32s_func(void) { #if defined(WITH_SSE2) || defined(WITH_IPP) INT32 ALIGN(dest[512]); int off;
/* ------------------------------------------------------------------------- */ int test_set8u_func(void) { #if defined(WITH_SSE2) || defined(WITH_IPP) BYTE ALIGN(dest[48]); int off; #endif int failed = 0; char testStr[256]; testStr[0] = '\0'; #ifdef WITH_SSE2 /* Test SSE under various alignments */ if (IsProcessorFeaturePresent(PF_SSE2_INSTRUCTIONS_AVAILABLE)) { strcat(testStr, " SSE2"); for (off=0; off<16; ++off) { int len; for (len=1; len<48-off; ++len) { int i; memset(dest, 0, sizeof(dest)); sse2_set_8u(0xa5, dest+off, len); for (i=0; i<len; ++i) { if (dest[off+i] != 0xa5) { printf("SET8U-SSE FAILED: off=%d len=%d dest[%d]=0x%02x\n", off, len, i+off, dest[i+off]); failed=1; } } } } } #endif /* i386 */ #ifdef WITH_IPP /* Test IPP under various alignments */ strcat(testStr, " IPP"); for (off=0; off<16; ++off) { int len; for (len=1; len<48-off; ++len) { int i; memset(dest, 0, sizeof(dest)); ippsSet_8u(0xa5, dest+off, len); for (i=0; i<len; ++i) { if (dest[off+i] != 0xa5) { printf("SET8U-IPP FAILED: off=%d len=%d dest[%d]=0x%02x\n", off, len, i+off, dest[i+off]); failed=1; } } } } #endif /* WITH_IPP */ if (!failed) printf("All set8u tests passed (%s).\n", testStr); return (failed > 0) ? FAILURE : SUCCESS; }
OsStatus MpeIPPGAmr::encode(const short* pAudioSamples, const int numSamples, int& rSamplesConsumed, unsigned char* pCodeBuf, const int bytesLeft, int& rSizeInBytes, UtlBoolean& sendNow, MpSpeechType& speechType) { assert(numSamples == 80); if (m_storedFramesCount == 1) { ippsSet_8u(0, (Ipp8u *)m_pOutputBuffer, m_pCodec->uscParams.pInfo->maxbitsize); ippsCopy_8u((unsigned char *)pAudioSamples, (unsigned char *)m_pInputBuffer+m_storedFramesCount*160, numSamples * sizeof(MpAudioSample)); int infrmLen, FrmDataLen; USC_PCMStream PCMStream; USC_Bitstream Bitstream; // Do the pre-procession of the frame infrmLen = USCEncoderPreProcessFrame(&m_pCodec->uscParams , m_pInputBuffer, (Ipp8s *)m_pOutputBuffer, &PCMStream, &Bitstream); // Encode one frame FrmDataLen = USCCodecEncode(&m_pCodec->uscParams, &PCMStream, &Bitstream, 0); if(FrmDataLen < 0) { return OS_FAILED; } infrmLen += FrmDataLen; // Do the post-procession of the frame USCEncoderPostProcessFrame(&m_pCodec->uscParams, m_pInputBuffer, (Ipp8s *)m_pOutputBuffer, &PCMStream, &Bitstream); ippsSet_8u(0, pCodeBuf, Bitstream.nbytes); // store encoded frames in AMR format. Frames cannot go directly into RTP payload UMC::Status result; m_pMediaData->Reset(); result = m_pMediaData->SetBufferPointer(m_pOutputBuffer + 6, Bitstream.nbytes); m_pMediaData->SetDataSize(Bitstream.nbytes); m_pMediaData->SetFrameType(Bitstream.frametype); m_pMediaData->SetBitrate(Bitstream.bitrate); m_pMediaData->SetNBytes(Bitstream.nbytes); result = m_amrPacketizer->AddFrame(m_pMediaData); m_pAmrData->Reset(); result = m_pAmrData->SetBufferPointer(pCodeBuf, bytesLeft); result = m_amrPacketizer->GetPacket(m_pAmrData);// creates data in amr format in pCodeBuf assert(result == USC_NoError); rSizeInBytes = m_pAmrData->GetDataSize(); sendNow = TRUE; m_storedFramesCount = 0; } else { ippsCopy_8u((unsigned char *)pAudioSamples, (unsigned char *)m_pInputBuffer+m_storedFramesCount*160, numSamples * sizeof(MpAudioSample)); m_storedFramesCount++; sendNow = FALSE; rSizeInBytes = 0; } rSamplesConsumed = numSamples; return OS_SUCCESS; }