From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by master.gitmailbox.com (Postfix) with ESMTP id 8D11F4C2AE for ; Wed, 24 Jul 2024 06:51:44 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 4E21668D47C; Wed, 24 Jul 2024 09:51:42 +0300 (EEST) Received: from mx.sdf.org (mx.sdf.org [205.166.94.24]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 0A19468CC49 for ; Wed, 24 Jul 2024 09:51:35 +0300 (EEST) Received: from 7ba90722f570c2b0104f5b8afe4fa274 ([1.145.233.243]) (authenticated (0 bits)) by mx.sdf.org (8.18.1/8.14.3) with ESMTPSA id 46O6pS5i002008 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256 bits) verified NO) for ; Wed, 24 Jul 2024 06:51:32 GMT Date: Wed, 24 Jul 2024 16:51:22 +1000 From: Peter Ross To: ffmpeg-devel@ffmpeg.org Message-ID: MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH] avcodec/adpcm: only process right samples when decoding stereo X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 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 Content-Type: multipart/mixed; boundary="===============4350261368014672512==" Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: --===============4350261368014672512== Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="5GW4ouurHfPino6M" Content-Disposition: inline --5GW4ouurHfPino6M Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Fixes Coverity issue #1610760. --- libavcodec/adpcm.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/libavcodec/adpcm.c b/libavcodec/adpcm.c index afdbeaa15e..58f2ef0dfb 100644 --- a/libavcodec/adpcm.c +++ b/libavcodec/adpcm.c @@ -1684,22 +1684,24 @@ static int adpcm_decode_frame(AVCodecContext *avctx= , AVFrame *frame, for (int count2 =3D 0; count2 < (channels =3D=3D 2 ? 28 : 14);= count2++) { byte =3D bytestream2_get_byteu(&gb); next_left_sample =3D sign_extend(byte >> 4, 4) * (1 << sh= ift_left); - next_right_sample =3D sign_extend(byte, 4) * (1 << sh= ift_right); =20 next_left_sample =3D (next_left_sample + (current_left_sample * coeff1l) + (previous_left_sample * coeff2l) + 0x80) >> 8; - next_right_sample =3D (next_right_sample + - (current_right_sample * coeff1r) + - (previous_right_sample * coeff2r) + 0x80) >> 8; =20 previous_left_sample =3D current_left_sample; current_left_sample =3D av_clip_int16(next_left_sample); - previous_right_sample =3D current_right_sample; - current_right_sample =3D av_clip_int16(next_right_sample); *samples++ =3D current_left_sample; =20 if (channels =3D=3D 2){ + next_right_sample =3D sign_extend(byte, 4) * (1 << shi= ft_right); + + next_right_sample =3D (next_right_sample + + (current_right_sample * coeff1r) + + (previous_right_sample * coeff2r) + 0x80) >> 8; + + previous_right_sample =3D current_right_sample; + current_right_sample =3D av_clip_int16(next_right_samp= le); *samples++ =3D current_right_sample; } else { next_left_sample =3D sign_extend(byte, 4) * (1 << shi= ft_left); --=20 2.43.0 -- Peter (A907 E02F A6E5 0CD2 34CD 20D2 6760 79C5 AC40 DD6B) --5GW4ouurHfPino6M Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iF0EABECAB0WIQSpB+AvpuUM0jTNINJnYHnFrEDdawUCZqCkZgAKCRBnYHnFrEDd az0YAKCPOPOl6nPOQO/CyiEGADYYIzjrwgCgrjS7dmW2XjvzaM0xIEQJ/wDnWUI= =OWHt -----END PGP SIGNATURE----- --5GW4ouurHfPino6M-- --===============4350261368014672512== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe". --===============4350261368014672512==--