[FFmpeg-cvslog] avcodec/aaccoder: Add minimal bias in search_for_ms()

2021-09-08 Thread Michael Niedermayer
ffmpeg | branch: release/4.4 | Michael Niedermayer  | 
Mon May 31 21:00:32 2021 +0200| [3a67e33368c45cf767a7aedf60e025135589e144] | 
committer: Michael Niedermayer

avcodec/aaccoder: Add minimal bias in search_for_ms()

Fixes: floating point division by 0
Fixes: Ticket8218

Signed-off-by: Michael Niedermayer 
(cherry picked from commit 75a099fc734a4ee2b1347d0a3d8c53d883b95174)
Signed-off-by: Michael Niedermayer 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=3a67e33368c45cf767a7aedf60e025135589e144
---

 libavcodec/aaccoder.c | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/libavcodec/aaccoder.c b/libavcodec/aaccoder.c
index baa82489b1..11b0559e1c 100644
--- a/libavcodec/aaccoder.c
+++ b/libavcodec/aaccoder.c
@@ -843,25 +843,25 @@ static void search_for_ms(AACEncContext *s, 
ChannelElement *cpe)
 sce0->ics.swb_sizes[g],
 sce0->sf_idx[w*16+g],
 sce0->band_type[w*16+g],
-lambda / band0->threshold, 
INFINITY, , NULL, 0);
+lambda / (band0->threshold 
+ FLT_MIN), INFINITY, , NULL, 0);
 dist1 += quantize_band_cost(s, >coeffs[start + 
(w+w2)*128],
 R34,
 sce1->ics.swb_sizes[g],
 sce1->sf_idx[w*16+g],
 sce1->band_type[w*16+g],
-lambda / band1->threshold, 
INFINITY, , NULL, 0);
+lambda / (band1->threshold 
+ FLT_MIN), INFINITY, , NULL, 0);
 dist2 += quantize_band_cost(s, M,
 M34,
 sce0->ics.swb_sizes[g],
 mididx,
 midcb,
-lambda / minthr, INFINITY, 
, NULL, 0);
+lambda / (minthr + 
FLT_MIN), INFINITY, , NULL, 0);
 dist2 += quantize_band_cost(s, S,
 S34,
 sce1->ics.swb_sizes[g],
 sididx,
 sidcb,
-mslambda / (minthr * 
bmax), INFINITY, , NULL, 0);
+mslambda / (minthr * bmax 
+ FLT_MIN), INFINITY, , NULL, 0);
 B0 += b1+b2;
 B1 += b3+b4;
 dist1 -= b1+b2;

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog

To unsubscribe, visit link above, or email
ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-cvslog] avcodec/aaccoder: Add minimal bias in search_for_ms()

2021-07-31 Thread Michael Niedermayer
ffmpeg | branch: master | Michael Niedermayer  | Mon 
May 31 21:00:32 2021 +0200| [75a099fc734a4ee2b1347d0a3d8c53d883b95174] | 
committer: Michael Niedermayer

avcodec/aaccoder: Add minimal bias in search_for_ms()

Fixes: floating point division by 0
Fixes: Ticket8218

Signed-off-by: Michael Niedermayer 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=75a099fc734a4ee2b1347d0a3d8c53d883b95174
---

 libavcodec/aaccoder.c | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/libavcodec/aaccoder.c b/libavcodec/aaccoder.c
index baa82489b1..11b0559e1c 100644
--- a/libavcodec/aaccoder.c
+++ b/libavcodec/aaccoder.c
@@ -843,25 +843,25 @@ static void search_for_ms(AACEncContext *s, 
ChannelElement *cpe)
 sce0->ics.swb_sizes[g],
 sce0->sf_idx[w*16+g],
 sce0->band_type[w*16+g],
-lambda / band0->threshold, 
INFINITY, , NULL, 0);
+lambda / (band0->threshold 
+ FLT_MIN), INFINITY, , NULL, 0);
 dist1 += quantize_band_cost(s, >coeffs[start + 
(w+w2)*128],
 R34,
 sce1->ics.swb_sizes[g],
 sce1->sf_idx[w*16+g],
 sce1->band_type[w*16+g],
-lambda / band1->threshold, 
INFINITY, , NULL, 0);
+lambda / (band1->threshold 
+ FLT_MIN), INFINITY, , NULL, 0);
 dist2 += quantize_band_cost(s, M,
 M34,
 sce0->ics.swb_sizes[g],
 mididx,
 midcb,
-lambda / minthr, INFINITY, 
, NULL, 0);
+lambda / (minthr + 
FLT_MIN), INFINITY, , NULL, 0);
 dist2 += quantize_band_cost(s, S,
 S34,
 sce1->ics.swb_sizes[g],
 sididx,
 sidcb,
-mslambda / (minthr * 
bmax), INFINITY, , NULL, 0);
+mslambda / (minthr * bmax 
+ FLT_MIN), INFINITY, , NULL, 0);
 B0 += b1+b2;
 B1 += b3+b4;
 dist1 -= b1+b2;

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog

To unsubscribe, visit link above, or email
ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".