Compare commits
2 commits
main
...
bits-align
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0c98de6d2c | ||
|
|
502adb6f1f |
5 changed files with 44 additions and 2 deletions
|
|
@ -940,6 +940,7 @@ IA_ERRORCODE ixheaacd_dec_api(pVOID p_ia_xheaac_dec_obj, WORD32 i_cmd,
|
|||
} else {
|
||||
*pui_value = p_obj_exhaacplus_dec->p_state_aac->audio_object_type;
|
||||
}
|
||||
if (*pui_value == AOT_AAC_LC) *pui_value = p_obj_exhaacplus_dec->p_state_aac->init_sbr_flag ? (p_obj_exhaacplus_dec->p_state_aac->init_ps_flag ? AOT_PS : AOT_SBR) : AOT_AAC_LC;
|
||||
} else {
|
||||
*pui_value = AOT_AAC_LC;
|
||||
}
|
||||
|
|
@ -2530,6 +2531,8 @@ IA_ERRORCODE ixheaacd_dec_init(
|
|||
p_obj_exhaacplus_dec->aac_config.ui_n_channels = num_channels_1;
|
||||
p_obj_exhaacplus_dec->aac_config.ui_samp_freq = sample_rate;
|
||||
p_state_enhaacplus_dec->ui_init_done = 1;
|
||||
p_state_enhaacplus_dec->init_sbr_flag = sbr_present_flag;
|
||||
p_state_enhaacplus_dec->init_ps_flag = p_obj_exhaacplus_dec->aac_config.ui_sbr_mode == 1;
|
||||
|
||||
memcpy(it_bit_buff, &temp_bit_buff, sizeof(struct ia_bit_buf_struct));
|
||||
|
||||
|
|
|
|||
|
|
@ -162,6 +162,8 @@ typedef struct ia_aac_dec_state_struct {
|
|||
UWORD32 ui_input_over;
|
||||
UWORD32 header_dec_done;
|
||||
WORD32 frame_counter;
|
||||
WORD32 init_sbr_flag;
|
||||
WORD32 init_ps_flag;
|
||||
ia_aac_decoder_struct *pstr_aac_dec_info[MAX_BS_ELEMENT];
|
||||
|
||||
UWORD32 ch_config;
|
||||
|
|
|
|||
|
|
@ -34,6 +34,7 @@ typedef struct {
|
|||
write bits to bitstream buffer => increment cnt_bits
|
||||
read bits from bitstream buffer => decrement cnt_bits */
|
||||
WORD32 size; /* size of bitbuffer in bits */
|
||||
WORD32 padding_offset; /* padding data offset */
|
||||
} ixheaace_bit_buf;
|
||||
|
||||
/* Define pointer to bit buffer structure */
|
||||
|
|
@ -65,3 +66,4 @@ VOID ia_enhaacplus_enc_wind_bitbuffer_bidirectional(ixheaace_bit_buf_handle pstr
|
|||
WORD32 ia_enhaacplus_enc_get_bits_available(ixheaace_bit_buf_handle pstr_bit_buf_handle);
|
||||
|
||||
UWORD32 ixheaace_byte_align_buffer(ixheaace_bit_buf_handle pstr_it_bit_buff);
|
||||
UWORD32 ixheaace_byte_align_buffer_codebook(ixheaace_bit_buf_handle pstr_it_bit_buff);
|
||||
|
|
|
|||
|
|
@ -30,6 +30,13 @@
|
|||
#include "ixheaace_bitbuffer.h"
|
||||
#include "ixheaace_common_utils.h"
|
||||
|
||||
const UWORD32 aac_pad_bits[22] = {
|
||||
0xB7A50050, 0xD62353EA, 0x7AA78655, 0xEAFB51ED, 0x313CA8E1,
|
||||
0x39A2E1BE, 0xD64272CE, 0xF2114960, 0x26B0CFCA, 0xAC02917B, 0xFC6EE713,
|
||||
0x43B0163C, 0x6302EBFA, 0x2F1E1F33, 0x26BA3B22, 0x8D0C7ABC, 0x7ECC65DF,
|
||||
0xD304FAEA, 0xB0BAF083, 0x78625459, 0xD45F869F, 0x0140D316
|
||||
};
|
||||
|
||||
UWORD8
|
||||
ixheaace_write_bits(ixheaace_bit_buf_handle pstr_bit_buf, UWORD32 write_value,
|
||||
UWORD8 num_bits_to_write) {
|
||||
|
|
@ -93,4 +100,33 @@ UWORD32 ixheaace_byte_align_buffer(ixheaace_bit_buf_handle pstr_it_bit_buff) {
|
|||
return (8 - alignment);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
WORD ixheaace_get_align_bits(ixheaace_bit_buf_handle pstr_it_bit_buff, WORD count) {
|
||||
WORD temp = 0;
|
||||
WORD padOffset;
|
||||
WORD padBitOffset;
|
||||
|
||||
while (count--) {
|
||||
padOffset = pstr_it_bit_buff->padding_offset >> 5;
|
||||
padBitOffset = pstr_it_bit_buff->padding_offset & 0x1f;
|
||||
|
||||
temp <<= 1;
|
||||
temp |= (aac_pad_bits[padOffset] >> (0x1f - padBitOffset)) & 1;
|
||||
|
||||
pstr_it_bit_buff->padding_offset = (pstr_it_bit_buff->padding_offset + 1) % 0x2c0;
|
||||
}
|
||||
|
||||
return temp;
|
||||
}
|
||||
|
||||
UWORD32 ixheaace_byte_align_buffer_codebook(ixheaace_bit_buf_handle pstr_it_bit_buff) {
|
||||
WORD alignment;
|
||||
alignment = (WORD)((pstr_it_bit_buff->cnt_bits) & 0x07);
|
||||
|
||||
if (alignment) {
|
||||
ixheaace_write_bits(pstr_it_bit_buff, ixheaace_get_align_bits(pstr_it_bit_buff, (8 - alignment)), (UWORD8)(8 - alignment));
|
||||
return (8 - alignment);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -807,8 +807,7 @@ IA_ERRORCODE ia_enhaacplus_enc_write_bitstream(
|
|||
}
|
||||
/* byte alignement */
|
||||
|
||||
ixheaace_write_bits(pstr_bit_stream_handle, 0,
|
||||
(UWORD8)((8 - (pstr_bit_stream_handle->cnt_bits % 8)) % 8));
|
||||
ixheaace_byte_align_buffer_codebook(pstr_bit_stream_handle);
|
||||
}
|
||||
|
||||
*glob_used_bits -= bit_markup;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue