Commit 0e36a14a authored by Andreas Cadhalpun's avatar Andreas Cadhalpun

aacsbr_fixed: check for envelope scalefactors overflowing

This prevents various values from getting an insanely huge exponent.
If someone knows a cleaner solution, thats welcome!

This is similar to commit 8978c743 for aacsbr.
Reviewed-by: 's avatarMichael Niedermayer <michael@niedermayer.cc>
Signed-off-by: 's avatarAndreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
parent 2ec18db7
...@@ -169,6 +169,10 @@ static void sbr_dequant(SpectralBandReplication *sbr, int id_aac) ...@@ -169,6 +169,10 @@ static void sbr_dequant(SpectralBandReplication *sbr, int id_aac)
else else
temp1.mant = 0x20000000; temp1.mant = 0x20000000;
temp1.exp = (temp1.exp >> 1) + 1; temp1.exp = (temp1.exp >> 1) + 1;
if (temp1.exp > 66) { // temp1 > 1E20
av_log(NULL, AV_LOG_ERROR, "envelope scalefactor overflow in dequant\n");
temp1 = FLOAT_1;
}
temp2.exp = (pan_offset - sbr->data[1].env_facs[e][k].mant) * alpha; temp2.exp = (pan_offset - sbr->data[1].env_facs[e][k].mant) * alpha;
if (temp2.exp & 1) if (temp2.exp & 1)
...@@ -188,6 +192,10 @@ static void sbr_dequant(SpectralBandReplication *sbr, int id_aac) ...@@ -188,6 +192,10 @@ static void sbr_dequant(SpectralBandReplication *sbr, int id_aac)
temp1.exp = NOISE_FLOOR_OFFSET - \ temp1.exp = NOISE_FLOOR_OFFSET - \
sbr->data[0].noise_facs[e][k].mant + 2; sbr->data[0].noise_facs[e][k].mant + 2;
temp1.mant = 0x20000000; temp1.mant = 0x20000000;
if (temp1.exp > 66) { // temp1 > 1E20
av_log(NULL, AV_LOG_ERROR, "envelope scalefactor overflow in dequant\n");
temp1 = FLOAT_1;
}
temp2.exp = 12 - sbr->data[1].noise_facs[e][k].mant + 1; temp2.exp = 12 - sbr->data[1].noise_facs[e][k].mant + 1;
temp2.mant = 0x20000000; temp2.mant = 0x20000000;
fac = av_div_sf(temp1, av_add_sf(FLOAT_1, temp2)); fac = av_div_sf(temp1, av_add_sf(FLOAT_1, temp2));
...@@ -208,7 +216,10 @@ static void sbr_dequant(SpectralBandReplication *sbr, int id_aac) ...@@ -208,7 +216,10 @@ static void sbr_dequant(SpectralBandReplication *sbr, int id_aac)
else else
temp1.mant = 0x20000000; temp1.mant = 0x20000000;
temp1.exp = (temp1.exp >> 1) + 1; temp1.exp = (temp1.exp >> 1) + 1;
if (temp1.exp > 66) { // temp1 > 1E20
av_log(NULL, AV_LOG_ERROR, "envelope scalefactor overflow in dequant\n");
temp1 = FLOAT_1;
}
sbr->data[ch].env_facs[e][k] = temp1; sbr->data[ch].env_facs[e][k] = temp1;
} }
for (e = 1; e <= sbr->data[ch].bs_num_noise; e++) for (e = 1; e <= sbr->data[ch].bs_num_noise; e++)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment