mirror of https://github.com/mstorsjo/fdk-aac.git
Merge "Prevent undefined values for CODING_SCHEME type in huff_decode()." into sc-dev
This commit is contained in:
commit
af61f20a8d
|
@ -1,7 +1,7 @@
|
||||||
/* -----------------------------------------------------------------------------
|
/* -----------------------------------------------------------------------------
|
||||||
Software License for The Fraunhofer FDK AAC Codec Library for Android
|
Software License for The Fraunhofer FDK AAC Codec Library for Android
|
||||||
|
|
||||||
© Copyright 1995 - 2018 Fraunhofer-Gesellschaft zur Förderung der angewandten
|
© Copyright 1995 - 2020 Fraunhofer-Gesellschaft zur Förderung der angewandten
|
||||||
Forschung e.V. All rights reserved.
|
Forschung e.V. All rights reserved.
|
||||||
|
|
||||||
1. INTRODUCTION
|
1. INTRODUCTION
|
||||||
|
@ -159,9 +159,6 @@ typedef enum {
|
||||||
#ifndef HUFFDEC_PARAMS
|
#ifndef HUFFDEC_PARAMS
|
||||||
#define HUFFDEC_PARMS
|
#define HUFFDEC_PARMS
|
||||||
|
|
||||||
#define PAIR_SHIFT 4
|
|
||||||
#define PAIR_MASK 0xf
|
|
||||||
|
|
||||||
#define MAX_ENTRIES 168
|
#define MAX_ENTRIES 168
|
||||||
#define HANDLE_HUFF_NODE const SHORT(*)[MAX_ENTRIES][2]
|
#define HANDLE_HUFF_NODE const SHORT(*)[MAX_ENTRIES][2]
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/* -----------------------------------------------------------------------------
|
/* -----------------------------------------------------------------------------
|
||||||
Software License for The Fraunhofer FDK AAC Codec Library for Android
|
Software License for The Fraunhofer FDK AAC Codec Library for Android
|
||||||
|
|
||||||
© Copyright 1995 - 2018 Fraunhofer-Gesellschaft zur Förderung der angewandten
|
© Copyright 1995 - 2020 Fraunhofer-Gesellschaft zur Förderung der angewandten
|
||||||
Forschung e.V. All rights reserved.
|
Forschung e.V. All rights reserved.
|
||||||
|
|
||||||
1. INTRODUCTION
|
1. INTRODUCTION
|
||||||
|
@ -568,12 +568,12 @@ bail:
|
||||||
static ERROR_t huff_decode(HANDLE_FDK_BITSTREAM strm, SCHAR* out_data_1,
|
static ERROR_t huff_decode(HANDLE_FDK_BITSTREAM strm, SCHAR* out_data_1,
|
||||||
SCHAR* out_data_2, DATA_TYPE data_type,
|
SCHAR* out_data_2, DATA_TYPE data_type,
|
||||||
DIFF_TYPE diff_type_1, DIFF_TYPE diff_type_2,
|
DIFF_TYPE diff_type_1, DIFF_TYPE diff_type_2,
|
||||||
int num_val, CODING_SCHEME* cdg_scheme, int ldMode) {
|
int num_val, PAIRING* pairing_scheme, int ldMode) {
|
||||||
ERROR_t err = HUFFDEC_OK;
|
ERROR_t err = HUFFDEC_OK;
|
||||||
|
CODING_SCHEME coding_scheme = HUFF_1D;
|
||||||
DIFF_TYPE diff_type;
|
DIFF_TYPE diff_type;
|
||||||
|
|
||||||
int i = 0;
|
int i = 0;
|
||||||
ULONG data = 0;
|
|
||||||
|
|
||||||
SCHAR pair_vec[28][2];
|
SCHAR pair_vec[28][2];
|
||||||
|
|
||||||
|
@ -596,15 +596,13 @@ static ERROR_t huff_decode(HANDLE_FDK_BITSTREAM strm, SCHAR* out_data_1,
|
||||||
int hufYY;
|
int hufYY;
|
||||||
|
|
||||||
/* Coding scheme */
|
/* Coding scheme */
|
||||||
data = FDKreadBits(strm, 1);
|
coding_scheme = (CODING_SCHEME)FDKreadBits(strm, 1);
|
||||||
*cdg_scheme = (CODING_SCHEME)(data << PAIR_SHIFT);
|
|
||||||
|
|
||||||
if (*cdg_scheme >> PAIR_SHIFT == HUFF_2D) {
|
if (coding_scheme == HUFF_2D) {
|
||||||
if ((out_data_1 != NULL) && (out_data_2 != NULL) && (ldMode == 0)) {
|
if ((out_data_1 != NULL) && (out_data_2 != NULL) && (ldMode == 0)) {
|
||||||
data = FDKreadBits(strm, 1);
|
*pairing_scheme = (PAIRING)FDKreadBits(strm, 1);
|
||||||
*cdg_scheme = (CODING_SCHEME)(*cdg_scheme | data);
|
|
||||||
} else {
|
} else {
|
||||||
*cdg_scheme = (CODING_SCHEME)(*cdg_scheme | FREQ_PAIR);
|
*pairing_scheme = FREQ_PAIR;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -613,7 +611,7 @@ static ERROR_t huff_decode(HANDLE_FDK_BITSTREAM strm, SCHAR* out_data_1,
|
||||||
hufYY2 = diff_type_2;
|
hufYY2 = diff_type_2;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (*cdg_scheme >> PAIR_SHIFT) {
|
switch (coding_scheme) {
|
||||||
case HUFF_1D:
|
case HUFF_1D:
|
||||||
p0_flag[0] = (diff_type_1 == DIFF_FREQ);
|
p0_flag[0] = (diff_type_1 == DIFF_FREQ);
|
||||||
p0_flag[1] = (diff_type_2 == DIFF_FREQ);
|
p0_flag[1] = (diff_type_2 == DIFF_FREQ);
|
||||||
|
@ -634,7 +632,7 @@ static ERROR_t huff_decode(HANDLE_FDK_BITSTREAM strm, SCHAR* out_data_1,
|
||||||
|
|
||||||
case HUFF_2D:
|
case HUFF_2D:
|
||||||
|
|
||||||
switch (*cdg_scheme & PAIR_MASK) {
|
switch (*pairing_scheme) {
|
||||||
case FREQ_PAIR:
|
case FREQ_PAIR:
|
||||||
|
|
||||||
if (out_data_1 != NULL) {
|
if (out_data_1 != NULL) {
|
||||||
|
@ -843,7 +841,7 @@ ERROR_t EcDataPairDec(DECODER_TYPE DECODER, HANDLE_FDK_BITSTREAM strm,
|
||||||
SCHAR* pDataVec[2] = {NULL, NULL};
|
SCHAR* pDataVec[2] = {NULL, NULL};
|
||||||
|
|
||||||
DIFF_TYPE diff_type[2] = {DIFF_FREQ, DIFF_FREQ};
|
DIFF_TYPE diff_type[2] = {DIFF_FREQ, DIFF_FREQ};
|
||||||
CODING_SCHEME cdg_scheme = HUFF_1D;
|
PAIRING pairing = FREQ_PAIR;
|
||||||
DIRECTION direction = BACKWARDS;
|
DIRECTION direction = BACKWARDS;
|
||||||
|
|
||||||
switch (data_type) {
|
switch (data_type) {
|
||||||
|
@ -959,7 +957,7 @@ ERROR_t EcDataPairDec(DECODER_TYPE DECODER, HANDLE_FDK_BITSTREAM strm,
|
||||||
}
|
}
|
||||||
/* Huffman decoding */
|
/* Huffman decoding */
|
||||||
err = huff_decode(strm, pDataVec[0], pDataVec[1], data_type, diff_type[0],
|
err = huff_decode(strm, pDataVec[0], pDataVec[1], data_type, diff_type[0],
|
||||||
diff_type[1], dataBands, &cdg_scheme,
|
diff_type[1], dataBands, &pairing,
|
||||||
(DECODER == SAOC_DECODER));
|
(DECODER == SAOC_DECODER));
|
||||||
if (err != HUFFDEC_OK) {
|
if (err != HUFFDEC_OK) {
|
||||||
return HUFFDEC_NOTOK;
|
return HUFFDEC_NOTOK;
|
||||||
|
@ -986,8 +984,8 @@ ERROR_t EcDataPairDec(DECODER_TYPE DECODER, HANDLE_FDK_BITSTREAM strm,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
mixed_time_pair = (diff_type[0] != diff_type[1]) &&
|
mixed_time_pair =
|
||||||
((cdg_scheme & PAIR_MASK) == TIME_PAIR);
|
(diff_type[0] != diff_type[1]) && (pairing == TIME_PAIR);
|
||||||
|
|
||||||
if (direction == BACKWARDS) {
|
if (direction == BACKWARDS) {
|
||||||
if (diff_type[0] == DIFF_FREQ) {
|
if (diff_type[0] == DIFF_FREQ) {
|
||||||
|
|
Loading…
Reference in New Issue