[FFmpeg-cvslog] 8svx: remove useless rounding code.

Nicolas George git at videolan.org
Tue Jul 31 17:35:57 CEST 2012


ffmpeg | branch: master | Nicolas George <nicolas.george at normalesup.org> | Sun Jul 29 12:45:31 2012 +0200| [5caea648d40dd7a85304b8ca1257a3a9a729bbb4] | committer: Nicolas George

8svx: remove useless rounding code.

samples_size and samples_idx are supposed to be multiple of
channels at all time. If they are, the division is exact;
if they are not, something is very wrong in the code.

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

 libavcodec/8svx.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/libavcodec/8svx.c b/libavcodec/8svx.c
index 3bece41..967b8c9 100644
--- a/libavcodec/8svx.c
+++ b/libavcodec/8svx.c
@@ -37,6 +37,7 @@
  * http://aminet.net/mods/smpl/
  */
 
+#include "libavutil/avassert.h"
 #include "avcodec.h"
 
 /** decoder context */
@@ -150,7 +151,8 @@ static int eightsvx_decode_frame(AVCodecContext *avctx, void *data,
     }
 
     /* get output buffer */
-    esc->frame.nb_samples = (FFMIN(MAX_FRAME_SIZE, esc->samples_size - esc->samples_idx) +avctx->channels-1)  / avctx->channels;
+    av_assert1(!(esc->samples_size % avctx->channels || esc->samples_idx % avctx->channels));
+    esc->frame.nb_samples = FFMIN(MAX_FRAME_SIZE, esc->samples_size - esc->samples_idx)  / avctx->channels;
     if ((ret = avctx->get_buffer(avctx, &esc->frame)) < 0) {
         av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
         return ret;



More information about the ffmpeg-cvslog mailing list