mirror of https://github.com/mstorsjo/fdk-aac.git
Merge "Improve error robustness in arithmetic decoder"
am: ecdec651da
Change-Id: I8e119ac863c88ba9e341716a48ae2717cffe5ae5
This commit is contained in:
commit
485d02df73
|
@ -609,13 +609,16 @@ static inline ULONG get_pk_v2(ULONG s) {
|
||||||
return (j & 0x3F);
|
return (j & 0x3F);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void decode2(HANDLE_FDK_BITSTREAM bbuf, UCHAR *RESTRICT c_prev,
|
static ARITH_CODING_ERROR decode2(HANDLE_FDK_BITSTREAM bbuf,
|
||||||
FIXP_DBL *RESTRICT pSpectralCoefficient, INT n, INT nt) {
|
UCHAR *RESTRICT c_prev,
|
||||||
|
FIXP_DBL *RESTRICT pSpectralCoefficient,
|
||||||
|
INT n, INT nt) {
|
||||||
Tastat as;
|
Tastat as;
|
||||||
int i, l, r;
|
int i, l, r;
|
||||||
INT lev, esc_nb, pki;
|
INT lev, esc_nb, pki;
|
||||||
USHORT state_inc;
|
USHORT state_inc;
|
||||||
UINT s;
|
UINT s;
|
||||||
|
ARITH_CODING_ERROR ErrorStatus = ARITH_CODER_OK;
|
||||||
|
|
||||||
int c_3 = 0; /* context of current frame 3 time steps ago */
|
int c_3 = 0; /* context of current frame 3 time steps ago */
|
||||||
int c_2 = 0; /* context of current frame 2 time steps ago */
|
int c_2 = 0; /* context of current frame 2 time steps ago */
|
||||||
|
@ -655,6 +658,8 @@ static void decode2(HANDLE_FDK_BITSTREAM bbuf, UCHAR *RESTRICT c_prev,
|
||||||
|
|
||||||
lev++;
|
lev++;
|
||||||
|
|
||||||
|
if (lev > 23) return ARITH_CODER_ERROR;
|
||||||
|
|
||||||
if (esc_nb < 7) {
|
if (esc_nb < 7) {
|
||||||
esc_nb++;
|
esc_nb++;
|
||||||
}
|
}
|
||||||
|
@ -721,6 +726,8 @@ static void decode2(HANDLE_FDK_BITSTREAM bbuf, UCHAR *RESTRICT c_prev,
|
||||||
}
|
}
|
||||||
|
|
||||||
FDKmemset(&c_prev[i], 1, sizeof(c_prev[0]) * (nt - i));
|
FDKmemset(&c_prev[i], 1, sizeof(c_prev[0]) * (nt - i));
|
||||||
|
|
||||||
|
return ErrorStatus;
|
||||||
}
|
}
|
||||||
|
|
||||||
CArcoData *CArco_Create(void) { return GetArcoData(); }
|
CArcoData *CArco_Create(void) { return GetArcoData(); }
|
||||||
|
@ -763,7 +770,8 @@ ARITH_CODING_ERROR CArco_DecodeArithData(CArcoData *pArcoData,
|
||||||
pArcoData->m_numberLinesPrev = lg_max;
|
pArcoData->m_numberLinesPrev = lg_max;
|
||||||
|
|
||||||
if (lg > 0) {
|
if (lg > 0) {
|
||||||
decode2(hBs, pArcoData->c_prev + 2, mdctSpectrum, lg >> 1, lg_max >> 1);
|
ErrorStatus =
|
||||||
|
decode2(hBs, pArcoData->c_prev + 2, mdctSpectrum, lg >> 1, lg_max >> 1);
|
||||||
} else {
|
} else {
|
||||||
FDKmemset(&pArcoData->c_prev[2], 1,
|
FDKmemset(&pArcoData->c_prev[2], 1,
|
||||||
sizeof(pArcoData->c_prev[2]) * (lg_max >> 1));
|
sizeof(pArcoData->c_prev[2]) * (lg_max >> 1));
|
||||||
|
|
Loading…
Reference in New Issue