History

Merge pull request #38 from hlef/master

Fabian Greffrath committed 7 years ago

Commit 4cf97af2 parents 19b81b0 6823e662 files · +23 −9Browse files

Unified · Split

2 files
  1. libfaad/ps_dec.c +14 −0
  2. libfaad/specrec.c +9 −9
libfaad/ps_dec.c+14−0
@@ -1508,6 +1508,20 @@ static void ps_mix_phase(ps_info *ps, qmf_t X_left[38][64], qmf_t X_right[38][64 · 1507 unmodified lines
15081508
15091509 //printf("%d\n", ps->iid_index[env][bk]);
15101510
1511+ /* index range is supposed to be -7...7 or -15...15 depending on iid_mode
1512+ (Table 8.24, ISO/IEC 14496-3:2005).
1513+ if it is outside these boundaries, this is most likely an error. sanitize
1514+ it and try to process further. */
1515+ if (ps->iid_index[env][bk] < -no_iid_steps) {
1516+ fprintf(stderr, "Warning: invalid iid_index: %d < %d\n", ps->iid_index[env][bk],
1517+ -no_iid_steps);
1518+ ps->iid_index[env][bk] = -no_iid_steps;
1519+ } else if (ps->iid_index[env][bk] > no_iid_steps) {
1520+ fprintf(stderr, "Warning: invalid iid_index: %d > %d\n", ps->iid_index[env][bk],
1521+ no_iid_steps);
1522+ ps->iid_index[env][bk] = no_iid_steps;
1523+ }
1524+
15111525 /* calculate the scalefactors c_1 and c_2 from the intensity differences */
15121526 c_1 = sf_iid[no_iid_steps + ps->iid_index[env][bk]];
15131527 c_2 = sf_iid[no_iid_steps - ps->iid_index[env][bk]];
libfaad/specrec.c+9−9
@@ -915,18 +915,18 @@ uint8_t reconstruct_single_channel(NeAACDecStruct *hDecoder, ic_stream *ics, · 914 unmodified lines
915915 /* element_output_channels not set yet */
916916 hDecoder->element_output_channels[hDecoder->fr_ch_ele] = output_channels;
917917 } else if (hDecoder->element_output_channels[hDecoder->fr_ch_ele] != output_channels) {
918− /* element inconsistency */
919−
920− /* this only happens if PS is actually found but not in the first frame
918+ /* element inconsistency
919+ * this only happens if PS is actually found but not in the first frame
921920 * this means that there is only 1 bitstream element!
922921 */
923922
924− /* reset the allocation */
925− hDecoder->element_alloced[hDecoder->fr_ch_ele] = 0;
926−
927− hDecoder->element_output_channels[hDecoder->fr_ch_ele] = output_channels;
928−
929− //return 21;
923+ if (hDecoder->fr_channels == 1) {
924+ /* reset the allocation */
925+ hDecoder->element_alloced[hDecoder->fr_ch_ele] = 0;
926+ hDecoder->element_output_channels[hDecoder->fr_ch_ele] = output_channels;
927+ } else {
928+ return 21;
929+ }
930930 }
931931
932932 if (hDecoder->element_alloced[hDecoder->fr_ch_ele] == 0)

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t