diff mbox

[FFmpeg-devel] avcodec/aacenc_ltp: fix use of uninitialized values

Message ID 20170412021813.1172-1-jamrial@gmail.com
State Accepted
Commit 8cd8c8331730fbaac5066bfd66e15b39a85ce537
Headers show

Commit Message

James Almer April 12, 2017, 2:18 a.m. UTC
Fixes some valgrind warnings.

Signed-off-by: James Almer <jamrial@gmail.com>
---
 libavcodec/aacenc_ltp.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Rostislav Pehlivanov April 12, 2017, 1:06 p.m. UTC | #1
On 12 April 2017 at 03:18, James Almer <jamrial@gmail.com> wrote:

> Fixes some valgrind warnings.
>
> Signed-off-by: James Almer <jamrial@gmail.com>
> ---
>  libavcodec/aacenc_ltp.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/libavcodec/aacenc_ltp.c b/libavcodec/aacenc_ltp.c
> index 1bec85b9e3..674a2a0680 100644
> --- a/libavcodec/aacenc_ltp.c
> +++ b/libavcodec/aacenc_ltp.c
> @@ -74,8 +74,8 @@ void ff_aac_ltp_insert_new_frame(AACEncContext *s)
>
>  static void get_lag(float *buf, const float *new, LongTermPrediction *ltp)
>  {
> -    int i, j, lag, max_corr = 0;
> -    float max_ratio;
> +    int i, j, lag = 0, max_corr = 0;
> +    float max_ratio = 0.0f;
>      for (i = 0; i < 2048; i++) {
>          float corr, s0 = 0.0f, s1 = 0.0f;
>          const int start = FFMAX(0, i - 1024);
> --
> 2.12.1
>
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>

LGTM, thanks
James Almer April 12, 2017, 10:39 p.m. UTC | #2
On 4/12/2017 10:06 AM, Rostislav Pehlivanov wrote:
> On 12 April 2017 at 03:18, James Almer <jamrial@gmail.com> wrote:
> 
>> Fixes some valgrind warnings.
>>
>> Signed-off-by: James Almer <jamrial@gmail.com>
>> ---
>>  libavcodec/aacenc_ltp.c | 4 ++--
>>  1 file changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/libavcodec/aacenc_ltp.c b/libavcodec/aacenc_ltp.c
>> index 1bec85b9e3..674a2a0680 100644
>> --- a/libavcodec/aacenc_ltp.c
>> +++ b/libavcodec/aacenc_ltp.c
>> @@ -74,8 +74,8 @@ void ff_aac_ltp_insert_new_frame(AACEncContext *s)
>>
>>  static void get_lag(float *buf, const float *new, LongTermPrediction *ltp)
>>  {
>> -    int i, j, lag, max_corr = 0;
>> -    float max_ratio;
>> +    int i, j, lag = 0, max_corr = 0;
>> +    float max_ratio = 0.0f;
>>      for (i = 0; i < 2048; i++) {
>>          float corr, s0 = 0.0f, s1 = 0.0f;
>>          const int start = FFMAX(0, i - 1024);
>> --
>> 2.12.1
>>
>> _______________________________________________
>> ffmpeg-devel mailing list
>> ffmpeg-devel@ffmpeg.org
>> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>>
> 
> LGTM, thanks

Pushed.
diff mbox

Patch

diff --git a/libavcodec/aacenc_ltp.c b/libavcodec/aacenc_ltp.c
index 1bec85b9e3..674a2a0680 100644
--- a/libavcodec/aacenc_ltp.c
+++ b/libavcodec/aacenc_ltp.c
@@ -74,8 +74,8 @@  void ff_aac_ltp_insert_new_frame(AACEncContext *s)
 
 static void get_lag(float *buf, const float *new, LongTermPrediction *ltp)
 {
-    int i, j, lag, max_corr = 0;
-    float max_ratio;
+    int i, j, lag = 0, max_corr = 0;
+    float max_ratio = 0.0f;
     for (i = 0; i < 2048; i++) {
         float corr, s0 = 0.0f, s1 = 0.0f;
         const int start = FFMAX(0, i - 1024);