⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 aac_dec_api_fp.c

📁 这是在PCA下的基于IPP库示例代码例子,在网上下了IPP的库之后,设置相关参数就可以编译该代码.
💻 C
📖 第 1 页 / 共 2 页
字号:
      ics_apply_scale_factors(&(state_com->m_cpe).streams[1],                              state->m_spectrum_data[ch + 1]);      /* Joint stereo */      cpe_apply_ms(&(state_com->m_cpe), state->m_spectrum_data[ch],                    state->m_spectrum_data[ch + 1]);      apply_pns(&(state_com->m_cpe).streams[0], &(state_com->m_cpe).streams[1],                state->m_spectrum_data[ch], state->m_spectrum_data[ch + 1], 2,                (state_com->m_cpe).ms_mask_present, (state_com->m_cpe).ms_used,                &(state_com->noiseState));      cpe_apply_intensity(&(state_com->m_cpe), state->m_spectrum_data[ch],                          state->m_spectrum_data[ch + 1]);      ics_calc_tns_data(&(state_com->m_cpe).streams[0], &tns_data0);      ics_calc_tns_data(&(state_com->m_cpe).streams[1], &tns_data1);      if (AOT_AAC_LTP == state_com->m_audio_object_type) {        state->m_ltp.p_samples_1st_part = state->m_ltp_buf[ch][state_com->m_index_1st];        state->m_ltp.p_samples_2nd_part = state->m_ltp_buf[ch][state_com->m_index_2nd];        state->m_ltp.p_samples_3rd_part = state->m_ltp_buf[ch][state_com->m_index_3rd];        state->m_ltp.prev_windows_shape = state_com->m_prev_win_shape[ch];        state->m_ltp.p_filterbank_data = &(state->m_filterbank);        state->m_ltp.p_tns_data = &tns_data0;        ics_apply_ltp_I(&(state->m_ltp), &(state_com->m_cpe).streams[0],                        state->m_spectrum_data[ch]);        state->m_ltp.p_samples_1st_part = state->m_ltp_buf[ch + 1][state_com->m_index_1st];        state->m_ltp.p_samples_2nd_part = state->m_ltp_buf[ch + 1][state_com->m_index_2nd];        state->m_ltp.p_samples_3rd_part = state->m_ltp_buf[ch + 1][state_com->m_index_3rd];        state->m_ltp.prev_windows_shape = state_com->m_prev_win_shape[ch + 1];        state->m_ltp.p_tns_data = &tns_data1;        ics_apply_ltp_I(&(state->m_ltp), &(state_com->m_cpe).streams[1],                        state->m_spectrum_data[ch + 1]);      }      if (0 != (state_com->m_cpe).streams[0].tns_data_present) {        ics_apply_tns_dec_I(&tns_data0, state->m_spectrum_data[ch]);      }      if (0 != (state_com->m_cpe).streams[1].tns_data_present) {        ics_apply_tns_dec_I(&tns_data1, state->m_spectrum_data[ch + 1]);      }      break;    case ID_CCE:      break;    case ID_LFE:      state_com->m_curr_win_shape[ch] = (state_com->m_lfe).stream.window_shape;      state_com->m_curr_win_sequence[ch] = (state_com->m_lfe).stream.window_sequence;      if (0 != (state_com->m_lfe).stream.pulse_data_present) {        ics_apply_pulse_I(&(state_com->m_lfe).stream);      }      ics_apply_scale_factors(&(state_com->m_lfe).stream, state->m_spectrum_data[ch]);      break;    default:      break;    }    GET_BITS(pBS, id, 3)  }  if (0 == state_com->m_is_chmap_valid) {    if (el_num <= 0)      RETURN_AAC_BAD_STREAM    state_com->m_is_chmap_valid = 1;    if (1 == state_com->m_is_pce_valid) {      chmap_create_by_pce(&(state_com->m_pce), state_com->m_chmap);      ch_num = chmap_order(state_com->m_chmap, state_com->m_elmap,                           el_num, state_com->m_order);    } else if (state_com->adts_channel_configuration >= 0) {      chmap_create_by_adts(state_com->adts_channel_configuration,                           state_com->m_chmap, state_com->m_elmap, el_num,                           state_com->m_order);      ch_num = chmap_order(state_com->m_chmap, state_com->m_elmap,                           el_num, state_com->m_order);    }    for (i = 0; i < ch_num; i++) {      ch = state_com->m_order[i];      state->m_ordered_samples[i] = state->m_curr_samples[ch];    }    if (ch_num <= 0)      RETURN_AAC_BAD_STREAM    state_com->m_channel_number = ch_num;  }  if (AOT_AAC_LTP == state_com->m_audio_object_type) {    state_com->m_index_1st++;    state_com->m_index_1st %= 3;    state_com->m_index_2nd++;    state_com->m_index_2nd %= 3;    state_com->m_index_3rd++;    state_com-> m_index_3rd %= 3;  }  for (ch_counter = 0; ch_counter < state_com->m_channel_number; ch_counter++) {    ch = state_com->m_order[ch_counter];    FilterbankDec(&(state->m_filterbank), state->m_spectrum_data[ch],                  state->m_prev_samples[ch], state_com->m_curr_win_sequence[ch],                  state_com->m_curr_win_shape[ch], state_com->m_prev_win_shape[ch],                  state->m_curr_samples[ch], state->m_prev_samples[ch]);    state_com->m_prev_win_shape[ch] = state_com->m_curr_win_shape[ch];    /* Update buffers for LTP */    if (AOT_AAC_LTP == state_com->m_audio_object_type) {      for (i = 0; i < 1024; i++) {        float   tmp;        tmp = state->m_curr_samples[ch][i];        if (tmp > 0) tmp += 0.5f;        else         tmp -= 0.5f;        if (tmp > 32767)  tmp = 32767;        if (tmp < -32768) tmp = -32768;        state->m_ltp_buf[ch][state_com->m_index_2nd][i] = (float)(int)tmp;        tmp = state->m_prev_samples[ch][i];        if (tmp > 0) tmp += 0.5f;        else tmp -= 0.5f;        if (tmp > 32767)  tmp = 32767;        if (tmp < -32768) tmp = -32768;        state->m_ltp_buf[ch][state_com->m_index_3rd][i] = (float)(int)tmp;      }    }  }  /* HE-AAC patch */  if ((sbrFlagPresentLFE) && (cnt_fill_sbr_element)) {    /* we passed LFE if ER AAC mode is used */    if (cnt_fill_sbr_element != cnt_idaac_sbr_element) {      cnt_fill_sbr_element++;    }    /* may be error? if yes then we isn't doing sbr process */    if (cnt_fill_sbr_element != cnt_idaac_sbr_element) {      cnt_fill_sbr_element = 0;    }  }  for (i = 0, j = 0; i < cnt_fill_sbr_element; i++) {    sbrGetFrame(state->m_curr_samples[j], state->m_curr_samples[j],      state->sbrBlock[i], state->sbr_filter[i], 0,                 state_com->ModeDecodeHEAACprofile, state_com->ModeDwnmxHEAACprofile, state->pWorkBuffer );    j++;    if (state->sbrBlock[i]->sbr_com.id_aac == ID_CPE) {      sbrGetFrame(state->m_curr_samples[j], state->m_curr_samples[j],                  state->sbrBlock[i], state->sbr_filter[i],                  1, state_com->ModeDecodeHEAACprofile, state_com->ModeDwnmxHEAACprofile, state->pWorkBuffer );      j++;    }  }  if (cnt_fill_sbr_element) {    if (state_com->ModeDwnmxHEAACprofile == HEAAC_DWNSMPL_OFF) {      state->com.m_up_sample  = 2;    }    state_com->SbrFlagPresent = 1;  }  ippsJoin_32f16s_D2L((const float **)(state->m_ordered_samples),                      state_com->m_channel_number, state->com.m_up_sample * 1024, outPointer);  Byte_alignment(pBS);  GET_BITS_COUNT(pBS, (*decodedBytes))  *decodedBytes >>= 3;  state_com->m_frame_number++;  state_com->m_channel_number_save = state_com->m_channel_number;  return AAC_OK;}/********************************************************************/AACStatus aacdecSetSamplingFrequency(int sampling_frequency_index,                                     AACDec *state){  return aacdecSetSamplingFrequencyCom(sampling_frequency_index,                                       &(state->com));}/********************************************************************/AACStatus aacdecSetSBRModeDecode(int ModeDecodeHEAAC,                                 AACDec *state){  if (!state)    return AAC_NULL_PTR;  state->com.ModeDecodeHEAACprofile = ModeDecodeHEAAC;  return AAC_OK;}/********************************************************************/AACStatus aacdecSetSBRModeDwnmx(int ModeDwnsmplHEAAC,                                AACDec *state){  if (!state)    return AAC_NULL_PTR;  state->com.ModeDwnmxHEAACprofile = ModeDwnsmplHEAAC;  return AAC_OK;}/********************************************************************/AACStatus aacdecSetAudioObjectType(enum AudioObjectType audio_object_type,                                   AACDec *state){  if (!state)    return AAC_NULL_PTR;  state->com.m_audio_object_type = audio_object_type;  return AAC_OK;}/********************************************************************/AACStatus aacdecSetPCE(sProgram_config_element *pce,                       AACDec *state){  if (!state)    return AAC_NULL_PTR;  ippsCopy_8u((Ipp8u*)pce, (Ipp8u*)(&(state->com.m_pce)),              sizeof(sProgram_config_element));  state->com.m_is_pce_valid = 1;  return AAC_OK;}/********************************************************************/AACStatus aacdecSetAdtsChannelConfiguration(int adts_channel_configuration,                                            AACDec *state){  if (!state)    return AAC_NULL_PTR;  if ((adts_channel_configuration < 0) || (adts_channel_configuration > 7))    return AAC_BAD_PARAMETER;  state->com.adts_channel_configuration = adts_channel_configuration;  return AAC_OK;}/********************************************************************/AACStatus aacdecGetSbrFlagPresent(int *SbrFlagPresent,                                  AACDec *state){  if (!state)    return AAC_NULL_PTR;  *SbrFlagPresent = state->com.SbrFlagPresent;  return AAC_OK;}/********************************************************************/AACStatus aacdecGetFrameSize(int *frameSize,                             AACDec *state){  if (!state)    return AAC_NULL_PTR;  *frameSize = state->com.m_frame_size * state->com.m_up_sample;  return AAC_OK;}/********************************************************************/AACStatus aacdecGetSampleFrequency(int *freq,                                   AACDec *state){  if (!state)    return AAC_NULL_PTR;  *freq = state->com.m_sampling_frequency * state->com.m_up_sample;  return AAC_OK;}/********************************************************************/AACStatus aacdecGetChannels(int *ch,                            AACDec *state){  if (!state)    return AAC_NULL_PTR;  *ch = state->com.m_channel_number;  return AAC_OK;}/********************************************************************/AACStatus aacdecClose(AACDec *state){  int     i;  if (state == NULL)    return AAC_OK;  FreeFilterbank(&(state->m_filterbank));  for (i = 0; i < 16; i++) {    if (state->com.huffman_tables[i]) {      ippsVLCDecodeFree_32s((IppsVLCDecodeSpec_32s *) (state->com.huffman_tables[i]));    }  }  sbrdecFreeFilter( state->sbr_filter );  for (i = 0; i < CH_MAX; i++)    sbrFreeDecoder(state->sbrBlock[i]);  for (i = 0; i < 10; i++)    ippsVLCDecodeFree_32s((IppsVLCDecodeSpec_32s *) (state->com.sbrHuffTables[i])); if( state->pWorkBuffer )   ippsFree( state->pWorkBuffer );  ippsFree(state);  return AAC_OK;}/********************************************************************/AACStatus aacdecGetInfo(cAudioCodecParams *a_info,                        AACDec *state){  if (!a_info)    return AAC_NULL_PTR;  a_info->m_SuggestedInputSize = 6 * 1024;  if (state->com.m_frame_number > 0) {    a_info->m_info_in.bitPerSample = 0;    a_info->m_info_out.bitPerSample = 16;    a_info->m_info_in.bitrate = 0;    a_info->m_info_out.bitrate = 0;    a_info->m_info_in.channels = state->com.m_channel_number;    a_info->m_info_out.channels = state->com.m_channel_number;    a_info->m_info_in.sample_frequency = state->com.m_sampling_frequency;    a_info->m_info_out.sample_frequency = state->com.m_sampling_frequency * state->com.m_up_sample ;    a_info->m_info_in.stream_type = AAC_AUD;    a_info->m_info_out.stream_type = PCM_AUD;    a_info->m_frame_num = state->com.m_frame_number;    a_info->is_valid = 1;    return AAC_OK;  }  a_info->is_valid = 0;  return AAC_OK;}/********************************************************************/AACStatus aacdecGetDuration(float *p_duration,                            AACDec *state){  float   duration;  duration = (float)(state->com.m_frame_number) * 1024;  *p_duration = duration / (float)(state->com.m_sampling_frequency);  return AAC_OK;}/********************************************************************/

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -