From patchwork Tue Sep 27 18:46:22 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adriano Pallavicino X-Patchwork-Id: 751 Delivered-To: ffmpegpatchwork@gmail.com Received: by 10.103.140.66 with SMTP id o63csp18921vsd; Tue, 27 Sep 2016 11:58:34 -0700 (PDT) X-Received: by 10.194.147.229 with SMTP id tn5mr8723828wjb.127.1475002714782; Tue, 27 Sep 2016 11:58:34 -0700 (PDT) Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id r133si15241210wmb.73.2016.09.27.11.58.23; Tue, 27 Sep 2016 11:58:34 -0700 (PDT) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org; dmarc=fail (p=NONE dis=NONE) header.from=gmail.com Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 317DB689CA8; Tue, 27 Sep 2016 21:58:07 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-wm0-f67.google.com (mail-wm0-f67.google.com [74.125.82.67]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 1E9D7689AFB for ; Tue, 27 Sep 2016 21:58:00 +0300 (EEST) Received: by mail-wm0-f67.google.com with SMTP id b4so2533703wmb.2 for ; Tue, 27 Sep 2016 11:58:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:from:date:message-id:subject:to; bh=5iF3FhvtcNOBHDTgSpfsSuIZhxF0FpCJ5JPszG9nXRM=; b=zIiTcWG2AAV+KZ7VxaEwQuSBWIfh8I71YGMkNLhhyJh0bE0wG3uVT6/TXVM4SRCfjm oCEWNL2u5Iwgz76lvZGdgJ9bQlRcLJTp3gkfVCJaS+QUTtY6mGE0q5qTLYEt9TAOaygO 188TE7RctXHdNUpXDrfsmo92uZQBXVwa/TK+RMk997yzncW/VGKgdhhi+766zw13cSzR pwEllXXfH0p3bTKJltl8DZAKf3bSn5U2qF/yJNEJmuW1kNBK2oYDMGFNqhxFPsCjBzTp qIFGJ2PaozKReqJlKXI+tKfPzNwtVGWTSZEBBpA85pp7QVvM/qTPigAjsVy7Y3m7vaAu B01A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:sender:from:date:message-id:subject :to; bh=5iF3FhvtcNOBHDTgSpfsSuIZhxF0FpCJ5JPszG9nXRM=; b=OTtYJJlNb26kPbk0peOwUvOsX0G44v8T4pWWhgOfG+O3vOS1AWckyxXB6qsB5klXqj IFU7yjd9PTlP7mi906+Ra4qNQwDkH8Ru7Ch/QscODuECAB7tRqATuWrpmbFbsJOtE1sN zTHVrMt6Vbh2KNvzG5CLnWdNu+AC9fZF4V5CXYGotInrbJ5oQJcG/LDw31NX1/2cc0Ss kqNZO2c+vAWeL8c6m73OD0oocsgAgHCqxC/6p/6lcLt6RWNaM0hgu4QDBZQAeqFtc60b yNV2Ob+bMsemacN4z8E02cgLvrFHATOHFYE1GQDWITlXBn84B4VzXAcBEeJ0z1L4T3Iv FL4A== X-Gm-Message-State: AA6/9Rl7xBQmNHVDKyOrqhaBNIZCBg1AFQRoJJQbEqin+4y/ayRhtZkOKqv9eLEHvh/ILHPuZ8oHa4COmkPlHg== X-Received: by 10.28.10.138 with SMTP id 132mr4487789wmk.1.1475001983256; Tue, 27 Sep 2016 11:46:23 -0700 (PDT) MIME-Version: 1.0 Received: by 10.28.69.84 with HTTP; Tue, 27 Sep 2016 11:46:22 -0700 (PDT) From: Adriano Pallavicino Date: Tue, 27 Sep 2016 20:46:22 +0200 X-Google-Sender-Auth: IYt-hLJZl21KWZXPEYd8l18LyD0 Message-ID: To: ffmpeg-devel@ffmpeg.org X-Content-Filtered-By: Mailman/MimeDel 2.1.20 Subject: [FFmpeg-devel] [PATCH] libavcodec/qdm2.c: fix warning due to misleading indentation X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" --- libavcodec/qdm2.c | 117 +++++++++++++++++++++++++++--------------------------- 1 file changed, 59 insertions(+), 58 deletions(-) 63 so the code doesn't overflow the buffer add1 = tone_level_idx[ch][sb][j] - 10; @@ -566,67 +566,68 @@ static void fill_coding_method_array(sb_int8_array tone_level_idx, } tone_level_idx_temp[ch][sb][0] = tone_level_idx_temp[ch][sb][1]; } - acc = 0; - for (ch = 0; ch < nb_channels; ch++) - for (sb = 0; sb < 30; sb++) - for (j = 0; j < 64; j++) - acc += tone_level_idx_temp[ch][sb][j]; - - multres = 0x66666667LL * (acc * 10); - esp_40 = (multres >> 32) / 8 + ((multres & 0xffffffff) >> 31); - for (ch = 0; ch < nb_channels; ch++) - for (sb = 0; sb < 30; sb++) - for (j = 0; j < 64; j++) { - comp = tone_level_idx_temp[ch][sb][j]* esp_40 * 10; - if (comp < 0) - comp += 0xff; - comp /= 256; // signed shift - switch(sb) { - case 0: - if (comp < 30) - comp = 30; - comp += 15; - break; - case 1: - if (comp < 24) - comp = 24; - comp += 10; - break; - case 2: - case 3: - case 4: - if (comp < 16) - comp = 16; - } - if (comp <= 5) - tmp = 0; - else if (comp <= 10) - tmp = 10; - else if (comp <= 16) - tmp = 16; - else if (comp <= 24) - tmp = -1; - else - tmp = 0; - coding_method[ch][sb][j] = ((tmp & 0xfffa) + 30 )& 0xff; + } + acc = 0; + for (ch = 0; ch < nb_channels; ch++) + for (sb = 0; sb < 30; sb++) + for (j = 0; j < 64; j++) + acc += tone_level_idx_temp[ch][sb][j]; + + multres = 0x66666667LL * (acc * 10); + esp_40 = (multres >> 32) / 8 + ((multres & 0xffffffff) >> 31); + for (ch = 0; ch < nb_channels; ch++) + for (sb = 0; sb < 30; sb++) + for (j = 0; j < 64; j++) { + comp = tone_level_idx_temp[ch][sb][j]* esp_40 * 10; + if (comp < 0) + comp += 0xff; + comp /= 256; // signed shift + switch(sb) { + case 0: + if (comp < 30) + comp = 30; + comp += 15; + break; + case 1: + if (comp < 24) + comp = 24; + comp += 10; + break; + case 2: + case 3: + case 4: + if (comp < 16) + comp = 16; } + if (comp <= 5) + tmp = 0; + else if (comp <= 10) + tmp = 10; + else if (comp <= 16) + tmp = 16; + else if (comp <= 24) + tmp = -1; + else + tmp = 0; + coding_method[ch][sb][j] = ((tmp & 0xfffa) + 30 )& 0xff; + } + for (sb = 0; sb < 30; sb++) + fix_coding_method_array(sb, nb_channels, coding_method); + for (ch = 0; ch < nb_channels; ch++) for (sb = 0; sb < 30; sb++) - fix_coding_method_array(sb, nb_channels, coding_method); - for (ch = 0; ch < nb_channels; ch++) - for (sb = 0; sb < 30; sb++) - for (j = 0; j < 64; j++) - if (sb >= 10) { - if (coding_method[ch][sb][j] < 10) - coding_method[ch][sb][j] = 10; + for (j = 0; j < 64; j++) + if (sb >= 10) { + if (coding_method[ch][sb][j] < 10) + coding_method[ch][sb][j] = 10; + } else { + if (sb >= 2) { + if (coding_method[ch][sb][j] < 16) + coding_method[ch][sb][j] = 16; } else { - if (sb >= 2) { - if (coding_method[ch][sb][j] < 16) - coding_method[ch][sb][j] = 16; - } else { - if (coding_method[ch][sb][j] < 30) - coding_method[ch][sb][j] = 30; - } + if (coding_method[ch][sb][j] < 30) + coding_method[ch][sb][j] = 30; } + } } else { // superblocktype_2_3 != 0 for (ch = 0; ch < nb_channels; ch++) for (sb = 0; sb < 30; sb++) diff --git a/libavcodec/qdm2.c b/libavcodec/qdm2.c index dd8b257..e3cc902 100644 --- a/libavcodec/qdm2.c +++ b/libavcodec/qdm2.c @@ -537,7 +537,7 @@ static void fill_coding_method_array(sb_int8_array tone_level_idx, /* This case is untested, no samples available */ avpriv_request_sample(NULL, "!superblocktype_2_3"); return; - for (ch = 0; ch < nb_channels; ch++) + for (ch = 0; ch < nb_channels; ch++) { for (sb = 0; sb < 30; sb++) { for (j = 1; j < 63; j++) { // The loop only iterates to