<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Hello, in Intel® Integrated Performance Primitives</title>
    <link>https://community.intel.com/t5/Intel-Integrated-Performance/Distorted-sound-in-AAC-encoder-output/m-p/1005701#M23188</link>
    <description>&lt;P&gt;Hello,&lt;/P&gt;

&lt;P&gt;Thanks for submitting this questions.&amp;nbsp; As you may you know, the sample code in the IPP is&amp;nbsp; the&amp;nbsp;legacy one, and users are suggested to move to the &lt;A href="https://software.intel.com/en-us/forums/intel-media-sdk"&gt;Intel® Media SDK&lt;/A&gt;&amp;nbsp; product for some Codec related code.&lt;BR /&gt;
	Do you have a check to the &lt;A href="https://software.intel.com/en-us/forums/intel-media-sdk"&gt;&lt;U&gt;&lt;FONT color="#0066cc"&gt;Intel® Media SDK&lt;/FONT&gt;&lt;/U&gt;&lt;/A&gt;&amp;nbsp;for the AAC encoder?&lt;/P&gt;

&lt;P&gt;Thanks,&lt;BR /&gt;
	Chao&lt;/P&gt;</description>
    <pubDate>Sun, 28 Sep 2014 03:30:11 GMT</pubDate>
    <dc:creator>Chao_Y_Intel</dc:creator>
    <dc:date>2014-09-28T03:30:11Z</dc:date>
    <item>
      <title>Distorted sound in AAC encoder output</title>
      <link>https://community.intel.com/t5/Intel-Integrated-Performance/Distorted-sound-in-AAC-encoder-output/m-p/1005700#M23187</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;

&lt;P&gt;I try to encode PCM mu-law audio (8000Hz, 16 bits per sample, 1 channel) from IP-camera with UMC AACEncoder (ipp-samples.8.0.0.005). The output audio is very distorted (see in attachment). I guess I use wrong parameters while encoder initialising. Please check my code and tell me where I am wrong?&lt;/P&gt;

&lt;PRE class="brush:cpp;"&gt;#include "AACEncoder.h"

#include &amp;lt;ipps.h&amp;gt;
#include &amp;lt;umc_linear_buffer.h&amp;gt;

using namespace NVeedo;

CAACEncoder::CAACEncoder(void)
    :   m_pMediaBuffer(0)
{
}


CAACEncoder::~CAACEncoder(void)
{
    m_Encoder.Close();

    UMC_DELETE(m_pMediaBuffer);
}


bool CAACEncoder::Init()
{
    m_pMediaBuffer = (UMC::MediaBuffer*) new UMC::LinearBuffer();

    // Input data parameters
    m_AACEncParams.m_info.streamType                    = UMC::MULAW_AUDIO;
//    m_AACEncParams.m_info.audioInfo.m_iChannelMask      = 0;
    m_AACEncParams.m_info.audioInfo.m_iChannels         = 1;
    m_AACEncParams.m_info.audioInfo.m_iBitPerSample     = 16;
    m_AACEncParams.m_info.audioInfo.m_iSampleFrequency  = 8000;

    m_AACEncParams.m_info.iBitrate                      = 32000; //48000;

    // Output stream parameters
    m_AACEncParams.audioObjectType                      = AOT_AAC_LC;
    m_AACEncParams.auxAudioObjectType                   = AOT_UNDEF;
    m_AACEncParams.outputFormat                         = UMC_AAC_ADTS;
    m_AACEncParams.stereo_mode                          = UMC_AAC_MONO;
    m_AACEncParams.ns_mode                              = 0;

    m_AACEncParams.m_pData                              = 0;

    if(UMC::UMC_OK != m_Encoder.Init(&amp;amp;m_AACEncParams))
    {
        std::cerr &amp;lt;&amp;lt; "Audio codec init failed" &amp;lt;&amp;lt; std::endl;
        return false;
    }

    UMC::Status             nStatus = UMC::UMC_OK;
    UMC::AACEncoderParams   CodecParams;

    nStatus = m_Encoder.GetInfo(&amp;amp;CodecParams);
    if(nStatus &amp;lt; 0)
    {
        std::cerr &amp;lt;&amp;lt; "Audio codec GetInfo() failed" &amp;lt;&amp;lt; std::endl;
        return false;
    }

    m_OutData.Alloc(CodecParams.m_iSuggestedOutputSize);

    m_MediaBufferParams.m_numberOfFrames        = 10;
    m_MediaBufferParams.m_prefInputBufferSize   = CodecParams.m_iSuggestedInputSize  * m_MediaBufferParams.m_numberOfFrames;
    m_MediaBufferParams.m_prefOutputBufferSize  = CodecParams.m_iSuggestedOutputSize * m_MediaBufferParams.m_numberOfFrames;

    if (UMC::UMC_OK != m_pMediaBuffer-&amp;gt;Init(&amp;amp;m_MediaBufferParams))
    {
        std::cerr &amp;lt;&amp;lt; "Media buffer init failed" &amp;lt;&amp;lt; std::endl;
        return false;
    }

    std::cout &amp;lt;&amp;lt; "AAC codec initialized successfully" &amp;lt;&amp;lt; std::endl;

    m_AACEncParams.m_info.streamType                    = UMC::AAC_AUDIO;

    return true;
}

bool CAACEncoder::Encode(void* pBuffer, int nLength)
{
    UMC::Status nStatus = m_pMediaBuffer-&amp;gt;LockInputBuffer(&amp;amp;m_InMediaBuffer);
    if(UMC::UMC_OK != nStatus)
        return false;

    int nMediaBufferSize = m_InMediaBuffer.GetBufferSize();
    if (nMediaBufferSize &amp;lt; nLength)
    {
        int nBreak = 1;
    }

    // Copy audio data
    ippsCopy_8u((Ipp8u*) pBuffer, (Ipp8u*) m_InMediaBuffer.GetBufferPointer(), nLength);
    m_InMediaBuffer.SetDataSize(nLength);

    m_pMediaBuffer-&amp;gt;UnLockInputBuffer(&amp;amp;m_InMediaBuffer);

    nStatus = m_pMediaBuffer-&amp;gt;LockOutputBuffer(&amp;amp;m_OutMediaBuffer);
    if(UMC::UMC_OK != nStatus)
        return false;

    nStatus = m_Encoder.GetFrame(&amp;amp;m_OutMediaBuffer, &amp;amp;m_OutData);
    m_pMediaBuffer-&amp;gt;UnLockOutputBuffer(&amp;amp;m_OutMediaBuffer);

    if(UMC::UMC_OK != nStatus)
    {
        return false;
    }

    return true;
}

UMC::MediaData* CAACEncoder::GetFrame()
{
    return &amp;amp;m_OutData;
}
&lt;/PRE&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 26 Sep 2014 11:39:14 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Integrated-Performance/Distorted-sound-in-AAC-encoder-output/m-p/1005700#M23187</guid>
      <dc:creator>Artem_O_</dc:creator>
      <dc:date>2014-09-26T11:39:14Z</dc:date>
    </item>
    <item>
      <title>Hello,</title>
      <link>https://community.intel.com/t5/Intel-Integrated-Performance/Distorted-sound-in-AAC-encoder-output/m-p/1005701#M23188</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;

&lt;P&gt;Thanks for submitting this questions.&amp;nbsp; As you may you know, the sample code in the IPP is&amp;nbsp; the&amp;nbsp;legacy one, and users are suggested to move to the &lt;A href="https://software.intel.com/en-us/forums/intel-media-sdk"&gt;Intel® Media SDK&lt;/A&gt;&amp;nbsp; product for some Codec related code.&lt;BR /&gt;
	Do you have a check to the &lt;A href="https://software.intel.com/en-us/forums/intel-media-sdk"&gt;&lt;U&gt;&lt;FONT color="#0066cc"&gt;Intel® Media SDK&lt;/FONT&gt;&lt;/U&gt;&lt;/A&gt;&amp;nbsp;for the AAC encoder?&lt;/P&gt;

&lt;P&gt;Thanks,&lt;BR /&gt;
	Chao&lt;/P&gt;</description>
      <pubDate>Sun, 28 Sep 2014 03:30:11 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Integrated-Performance/Distorted-sound-in-AAC-encoder-output/m-p/1005701#M23188</guid>
      <dc:creator>Chao_Y_Intel</dc:creator>
      <dc:date>2014-09-28T03:30:11Z</dc:date>
    </item>
  </channel>
</rss>

