[FFmpeg-devel] [Patch] nellymoser encoder

Benjamin Larsson banan
Thu Feb 5 15:47:42 CET 2009


When running under valgrind and activating trellis and compiling with
gcc 4.3 or 4.1 these messages occur (no messages with gcc 2.95):

==673==    at 0x82C96E3: encode_frame (nellymoserenc.c:266)
==673==
==673== Use of uninitialised value of size 4
==673==    at 0x82C9A42: encode_frame (nellymoserenc.c:314)
==673==
==673== Use of uninitialised value of size 4
==673==    at 0x82C9747: encode_frame (nellymoserenc.c:311)

It has something to do with trellis paths that doesn't get written to
but used anyway. So while the following patch silences the warnings, I
think it just cover up the problem.

MvH
Benjamin Larsson

Index: libavcodec/nellymoserenc.c
===================================================================
--- libavcodec/nellymoserenc.c	(revision 16987)
+++ libavcodec/nellymoserenc.c	(working copy)
@@ -44,7 +44,7 @@

 #define POW_TABLE_SIZE (1<<11)
 #define POW_TABLE_OFFSET 3
-#define OPT_SIZE ((1<<15) + 3000)
+#define OPT_SIZE ((1<<16) + 3000)

 typedef struct NellyMoserEncodeContext {
     AVCodecContext  *avctx;
@@ -153,8 +153,8 @@
         pow_table[i] = -pow(2, -i / 2048.0 - 3.0 + POW_TABLE_OFFSET);

     if (s->avctx->trellis) {
-        s->opt  = av_malloc(NELLY_BANDS * OPT_SIZE * sizeof(float  ));
-        s->path = av_malloc(NELLY_BANDS * OPT_SIZE * sizeof(uint8_t));
+        s->opt  = av_mallocz(NELLY_BANDS * OPT_SIZE * sizeof(float  ));
+        s->path = av_mallocz(NELLY_BANDS * OPT_SIZE * sizeof(uint8_t));
     }

     return 0;




More information about the ffmpeg-devel mailing list