From patchwork Tue Sep 29 15:52:44 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 22657 Return-Path: X-Original-To: patchwork@ffaux-bg.ffmpeg.org Delivered-To: patchwork@ffaux-bg.ffmpeg.org Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by ffaux.localdomain (Postfix) with ESMTP id F171E44B79E for ; Tue, 29 Sep 2020 18:53:27 +0300 (EEST) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id D875B68A98A; Tue, 29 Sep 2020 18:53:27 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-wr1-f44.google.com (mail-wr1-f44.google.com [209.85.221.44]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id DB7BE6805A5 for ; Tue, 29 Sep 2020 18:53:21 +0300 (EEST) Received: by mail-wr1-f44.google.com with SMTP id o5so5952286wrn.13 for ; Tue, 29 Sep 2020 08:53:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=/bn9qBfOfqgVMmMMazO3O+1J+Q+uJDavABGPOW/92lk=; b=u0Vn71imA870SwcfNIlo1tKUJOa78zG3tcBV4g7fO2EqPIqWHiV3KOscfVYvkSpuWa wz5+GduJOFlbCwNEUxDLhof7kXpFtvwh9pHsdaI93uRvb8d++QaMZ5X2GSjUiPRt/e4a SNVOzCIl7/XHZlLeFAR33Fn09NDgHYl0ulc2z4HZNuIh0tQC/4jfnGDsoIpu+ZUzHV8D RdNI1Q2xBDEwhCq6OfBap66lXQR68mwvMrOcD4L8Og7v8KNU+uf5afaRDn23M2KEpcJc Qsfj+3BQ4ZTJZ+d5qldjHSYyir3hWPsDBP/B9uuIRFxa2vNB50sfVQTY0kIXo1QNheAg koVw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=/bn9qBfOfqgVMmMMazO3O+1J+Q+uJDavABGPOW/92lk=; b=LzrnUT9MHE4Co9A51AjeaALKMiD0/a5MMUyszw7dyfG+iWakL9sT0sSgtQjphY+NGG 3H8mXWC3qy4rI8h5lva0t3FYeudeZlzi8ZP9TR9kefkthOP0rUPe9et+yUiWrZCRsM0V lUYtfEOhHnUbG0MpnABk7/e7o4TILNAq4aBxaib/pmoj0H63xIXGY5NO9Fc4cNtLOJCi nVH8LZDqZts5hrWg8jHYEhr+/uZAInJJEgwFaaZaEfAy2W98Utm8DQFm6ApFNuUPatRN yv1cIBJutynMInY0UemHZFCjr7MrVwqMGeWqouezlIl8NtPNObmnRGrrw3htIzunUW4V whNw== X-Gm-Message-State: AOAM530qmPG7bFdt0tFk74bKJIyHFtPB/BM8t7YrP2nb5iSwr70+TsCF YpAbmWcvZXWom/0l/5lHIxdf51uv0ZI= X-Google-Smtp-Source: ABdhPJwnl7+XbsV1mvzT4VHchAMoMwSshOLa+e+FSFjecOs9E4WrHIz8EtRW7s8KvcQSzNiwon/p6w== X-Received: by 2002:adf:f885:: with SMTP id u5mr4959024wrp.382.1601394801127; Tue, 29 Sep 2020 08:53:21 -0700 (PDT) Received: from sblaptop.fritz.box (ipbcc1aa4b.dynamic.kabel-deutschland.de. [188.193.170.75]) by smtp.gmail.com with ESMTPSA id m4sm7286674wro.18.2020.09.29.08.53.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 29 Sep 2020 08:53:20 -0700 (PDT) From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Tue, 29 Sep 2020 17:52:44 +0200 Message-Id: <20200929155244.924968-2-andreas.rheinhardt@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200929155244.924968-1-andreas.rheinhardt@gmail.com> References: <20200929155244.924968-1-andreas.rheinhardt@gmail.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 2/2] swresample/audioconvert: Fix left shift of negative value 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 Cc: Andreas Rheinhardt Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Fixes ticket #8219. Signed-off-by: Andreas Rheinhardt --- libswresample/audioconvert.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libswresample/audioconvert.c b/libswresample/audioconvert.c index d21fc8ef42..89ee7bfae3 100644 --- a/libswresample/audioconvert.c +++ b/libswresample/audioconvert.c @@ -59,7 +59,7 @@ CONV_FUNC(AV_SAMPLE_FMT_FLT, float , AV_SAMPLE_FMT_U8 , (*(const uint8_t*)pi - CONV_FUNC(AV_SAMPLE_FMT_DBL, double , AV_SAMPLE_FMT_U8 , (*(const uint8_t*)pi - 0x80)*(1.0 / (1<<7))) CONV_FUNC(AV_SAMPLE_FMT_U8 , uint8_t, AV_SAMPLE_FMT_S16, (*(const int16_t*)pi>>8) + 0x80) CONV_FUNC(AV_SAMPLE_FMT_S16, int16_t, AV_SAMPLE_FMT_S16, *(const int16_t*)pi) -CONV_FUNC(AV_SAMPLE_FMT_S32, int32_t, AV_SAMPLE_FMT_S16, *(const int16_t*)pi<<16) +CONV_FUNC(AV_SAMPLE_FMT_S32, int32_t, AV_SAMPLE_FMT_S16, *(const int16_t*)pi * (1 << 16)) CONV_FUNC(AV_SAMPLE_FMT_S64, int64_t, AV_SAMPLE_FMT_S16, (uint64_t)(*(const int16_t*)pi)<<48) CONV_FUNC(AV_SAMPLE_FMT_FLT, float , AV_SAMPLE_FMT_S16, *(const int16_t*)pi*(1.0f/ (1<<15))) CONV_FUNC(AV_SAMPLE_FMT_DBL, double , AV_SAMPLE_FMT_S16, *(const int16_t*)pi*(1.0 / (1<<15)))