From patchwork Mon Jun 19 23:04:22 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Niedermayer X-Patchwork-Id: 42232 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:be15:b0:121:b37c:e101 with SMTP id ge21csp992103pzb; Mon, 19 Jun 2023 16:04:38 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4crHc6+JstEmHHwRjn0WviHDd9Oz6IxoHsy3dBR7Xxi4ngVqbrRZ3KK0dE2i1nRoWCsF0l X-Received: by 2002:a17:906:7943:b0:987:e23f:6d7a with SMTP id l3-20020a170906794300b00987e23f6d7amr6364454ejo.25.1687215878392; Mon, 19 Jun 2023 16:04:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1687215878; cv=none; d=google.com; s=arc-20160816; b=a1mCLEhK9P6ATJ1S0nQd40Mb9nSNxy5g+G8botmIzj4LN9P+1fLG/YJ2ilyTTRK9cu GY7U/UQ98sUHvWHrpGPVqXueciGFEChWlQ+PUCuDi1PreHbxg5bgB1qtNxfnLBKdPtFm MfhwMftAUHLn6PKTKeqqgBgxUKVTK+8/Sn0Vph0kZoNNoQtokAqwJC00phVObYzne8xE 3C/qvi5Mn2iGJNDq8EU+F4453Fa4FE63+2dgZ6qtLNMm+OgEFXSOsU/kRKbaYTPHfy6G JxSeOl9fNq/SZFTlyexeKFZsBMltoKvzsS8FgkLw423BJ81PEEOLoutjjJ3AbqAew2yH q8Hg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version:reply-to :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:message-id:date:to:from:delivered-to; bh=MbNCBKdE93CF23t9u8/xx7cEXw/JycbLKthURK4DRZE=; b=HWp7oOToSXBEmPE+V0VUxFfhtNbvy+osNLOCr2JUlkFoc8mb78pmZLzjcWbpLPVbBw Sj8rG0F/oVS+RUdR/U+T+HIL6iGATWRYzWeyRRzG7lY6oP7JFTA9nN6RJlX1Az/QharC TUjIpk5C1yBQ5Oz782gFW9jS2cVTzsbY1ho0LL7qKiFqoBEKD4TSgXlIq1WzHTtotAuM jDIqsEIh9+zBPr9okgyO5WEE+EkFwwpOO3PkTgw2JG2vKlJyl4gpq+A740Epnu4r3MUh k/hO38wxzCxS/yvAcbcHNip5z3VyH7WXmbskcU3ljZJ9xLKzeN348anZVA5l57DE55oP qyvA== ARC-Authentication-Results: i=1; mx.google.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 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id j5-20020a1709066dc500b009880dc6b9b3si288268ejt.326.2023.06.19.16.04.37; Mon, 19 Jun 2023 16:04:38 -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; 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 Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 84D3068AAB3; Tue, 20 Jun 2023 02:04:33 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-01-1.mymagenta.at (mail-01-1.mymagenta.at [80.109.253.246]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id DAD9368AAB3 for ; Tue, 20 Jun 2023 02:04:26 +0300 (EEST) Received: from [192.168.232.136] (helo=ren-mail-psmtp-mg02.) by mail-01.mymagenta.at with esmtp (Exim 4.93) (envelope-from ) id 1qBNv7-00Efch-57 for ffmpeg-devel@ffmpeg.org; Tue, 20 Jun 2023 01:04:25 +0200 Received: from localhost ([84.115.40.24]) by ren-mail-psmtp-mg02. with ESMTP id BNv8q1jN7bZLDBNv8qup9v; Tue, 20 Jun 2023 01:04:26 +0200 X-Env-Mailfrom: michael@niedermayer.cc X-Env-Rcptto: ffmpeg-devel@ffmpeg.org X-SourceIP: 84.115.40.24 X-CNFS-Analysis: v=2.4 cv=Ufwy9IeN c=1 sm=1 tr=0 ts=6490defa a=4thelYDX6rwh+ygQwvsI+Q==:117 a=4thelYDX6rwh+ygQwvsI+Q==:17 a=MKtGQD3n3ToA:10 a=1oJP67jkp3AA:10 a=GEAsPZ9sns4A:10 a=NEAV23lmAAAA:8 a=IAIIEyv82i-gi4R8DAoA:9 From: Michael Niedermayer To: FFmpeg development discussions and patches Date: Tue, 20 Jun 2023 01:04:22 +0200 Message-Id: <20230619230424.30270-1-michael@niedermayer.cc> X-Mailer: git-send-email 2.17.1 X-CMAE-Envelope: MS4xfK68d2bRh0p05P1NP/p4nKlrtHsUGSB0lGq8ADu4k6bL84CZwD2mVPXL6WDi0JP2kAzGjuvsGX+fKtNqo+RSsou3EWiCOw9xttY1rJ3FD56oEH0ma/L/ o9Erhs6BsNEO95xmrtOyXq6McSN7Q3qpGTZq/QzTs81U7o4Mli5DLxdRV4kxVp73FrWOW9u0DeRKoA== Subject: [FFmpeg-devel] [PATCH 1/3] avcodec/huffyuvdec: avoid undefined behavior with get_vlc2() failure 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 MIME-Version: 1.0 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: HhbnEONKUk6d Fixes: left shift of negative value -1 Fixes: 59889/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_HUFFYUV_fuzzer-5472742275940352 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer --- libavcodec/huffyuvdec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/huffyuvdec.c b/libavcodec/huffyuvdec.c index 8ba67bbdeb..1a7690da94 100644 --- a/libavcodec/huffyuvdec.c +++ b/libavcodec/huffyuvdec.c @@ -755,7 +755,7 @@ static void decode_plane_bitstream(HYuvDecContext *s, int width, int plane) } } if( width&1 && get_bits_left(&s->gb)>0 ) { - int dst = get_vlc2(&s->gb, s->vlc[plane].table, VLC_BITS, 3)<<2; + int dst = (unsigned)get_vlc2(&s->gb, s->vlc[plane].table, VLC_BITS, 3)<<2; s->temp16[0][width-1] = dst + get_bits(&s->gb, 2); } } From patchwork Mon Jun 19 23:04:23 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Niedermayer X-Patchwork-Id: 42233 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:be15:b0:121:b37c:e101 with SMTP id ge21csp992189pzb; Mon, 19 Jun 2023 16:04:49 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5mW3D/ouV6VkF+EH9FTSEbMP3sca8aUIAE8+TH6ztoIFkY4hth6na1TDypU6YaMg/5J444 X-Received: by 2002:a50:ee14:0:b0:51a:4d20:3b1c with SMTP id g20-20020a50ee14000000b0051a4d203b1cmr5855165eds.18.1687215888977; Mon, 19 Jun 2023 16:04:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1687215888; cv=none; d=google.com; s=arc-20160816; b=gqxI/UNyWOdlYzRlFW4fAR+IAhD08qY9EJiQAZorIBD5VLTC2d7TAjK2X/9luUbpgX L7qLoOXQT4QqFrcgNbRMCtatUJyMDMs8Kk0jWEdIIbiRYfMfw4tLmSJMHFe4Dptiw8uT m31u/V+5oriQIXWjqlZA8XWdwcV/afFhxlI4gIceiu0X76mZMxFUbQGQFoN5CLNYhqIl M2NZBmSx01tRrkfn5XC2f/9Zv/xQkNznc0aM1/SxoxC9ypDwXy5b5mn3o39TeQxorlh2 ELTZkvi+5h99GzoUAEc0DOB4F2A6H+DPgt3oNZaZcQnXGo15lapNU1lUoa0MGEt1QN+r HtVQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version:reply-to :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:references:in-reply-to:message-id:date :to:from:delivered-to; bh=Ran+gQgm/meUjdyv0Uwgtohvk0ygWTd7umodVFr1Jjo=; b=BWnaOymv+J1I9uHBX3MpwzFd3piaMYLLfLWGfxhgdI178TqPZyTI8teCqXzYsUgQ2J k6NLZX8MUqRTSATmffJzpFHgQ+e6AxsI1CEGQP6wgEeCizgUsloSSI/8PiuwUIb49Zol IvGKLOC15H4N4zwsg/NWyh44ag22uJ15/slBHCHVjVxsDtFWNgtXUi/aa86Gh7L5OA7A 9GFKhxm5noywkN6sghVeMoyrFJeNVZJjrq1avDLv5habxN/R09bjJnX2gYQFnHglcqme HJHUpjYZ/IymEgt49e2aLK8/eb4eeB+mH9Z1KAsDzCTYK53R/UbEvs0iqbYWg7Jq/P5H 2gSA== ARC-Authentication-Results: i=1; mx.google.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 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id w24-20020a056402129800b0051a2044649bsi253321edv.223.2023.06.19.16.04.48; Mon, 19 Jun 2023 16:04:48 -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; 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 Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id C179668C089; Tue, 20 Jun 2023 02:04:34 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-01-1.mymagenta.at (mail-01-1.mymagenta.at [80.109.253.246]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id E635768B838 for ; Tue, 20 Jun 2023 02:04:26 +0300 (EEST) Received: from [192.168.232.136] (helo=ren-mail-psmtp-mg02.) by mail-01.mymagenta.at with esmtp (Exim 4.93) (envelope-from ) id 1qBNv7-00Efcm-GC for ffmpeg-devel@ffmpeg.org; Tue, 20 Jun 2023 01:04:25 +0200 Received: from localhost ([84.115.40.24]) by ren-mail-psmtp-mg02. with ESMTP id BNv9q1jNJbZLDBNv9qup9w; Tue, 20 Jun 2023 01:04:27 +0200 X-Env-Mailfrom: michael@niedermayer.cc X-Env-Rcptto: ffmpeg-devel@ffmpeg.org X-SourceIP: 84.115.40.24 X-CNFS-Analysis: v=2.4 cv=Ufwy9IeN c=1 sm=1 tr=0 ts=6490defb a=4thelYDX6rwh+ygQwvsI+Q==:117 a=4thelYDX6rwh+ygQwvsI+Q==:17 a=MKtGQD3n3ToA:10 a=1oJP67jkp3AA:10 a=GEAsPZ9sns4A:10 a=NEAV23lmAAAA:8 a=-IR0vuWKQ8UIoPaB34MA:9 From: Michael Niedermayer To: FFmpeg development discussions and patches Date: Tue, 20 Jun 2023 01:04:23 +0200 Message-Id: <20230619230424.30270-2-michael@niedermayer.cc> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20230619230424.30270-1-michael@niedermayer.cc> References: <20230619230424.30270-1-michael@niedermayer.cc> X-CMAE-Envelope: MS4xfOInTfB652qIJTu5qqjsXyxjF++QTCoXYCMN6hYdWTg36+65tDSswqLftnQMPP0hTsKBJn0MFzEWUd92zq2zSVLlIxc92qPqEnFa+GIckoyY/yPan4kZ yUJmyTT0cn87YQuCxsEArlLL+/rdfJdZC12tVGkVN9iS7moyIiM4sXkwssNJxVEccCNbiJFKPqaPSg== Subject: [FFmpeg-devel] [PATCH 2/3] tools/target_dec_fuzzer: Adjust threshold for speex 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 MIME-Version: 1.0 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: Io7eTjW6NeeT Fixes: Timeout Fixes: 59731/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_SPEEX_fuzzer-4809436670328832 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer --- tools/target_dec_fuzzer.c | 1 + 1 file changed, 1 insertion(+) diff --git a/tools/target_dec_fuzzer.c b/tools/target_dec_fuzzer.c index 42de479829..165951dc9d 100644 --- a/tools/target_dec_fuzzer.c +++ b/tools/target_dec_fuzzer.c @@ -278,6 +278,7 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) { case AV_CODEC_ID_SCPR: maxpixels /= 32; break; case AV_CODEC_ID_SCREENPRESSO:maxpixels /= 64; break; case AV_CODEC_ID_SIMBIOSIS_IMX:maxpixels /= 16384; break; + case AV_CODEC_ID_SPEEX: maxsamples /= 128; break; case AV_CODEC_ID_SMACKAUDIO: maxsamples /= 4096; break; case AV_CODEC_ID_SMACKVIDEO: maxpixels /= 64; break; case AV_CODEC_ID_SNOW: maxpixels /= 128; break; From patchwork Mon Jun 19 23:04:24 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Niedermayer X-Patchwork-Id: 42234 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:be15:b0:121:b37c:e101 with SMTP id ge21csp992253pzb; Mon, 19 Jun 2023 16:04:57 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6OBmmex4BvyRGjKCJM16T6NBvgoF32K/TSsXbjFGShtAoioA8VX6asTew8d9ooiVn89BRO X-Received: by 2002:a17:907:7ba4:b0:977:ecff:3367 with SMTP id ne36-20020a1709077ba400b00977ecff3367mr11427038ejc.40.1687215896987; Mon, 19 Jun 2023 16:04:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1687215896; cv=none; d=google.com; s=arc-20160816; b=soGU1JXX0keVtw4JRa3laUubJBykWX/eB4+14MrSGj1NaZD8kkD6GGBWgPWH5NCN0p fL1TD1FXSL7AhhboQr/7ASPl4qbY3oANd7H0grc49T9LrOMzlzdUooPAOjL4wHeS3Tqa SQb8pHMYkCwmO8PGxjy+bsOhuTi+mTyLNHYWjHCfm0axo7It4A2eFoPq8732x2RhRl6Y DTdffZifsMZ/qsmoAUTCGuijFE7RanfWqeIy6USX6kOGQqTYRR50XrS7/hHuOTcIVAl9 /SlOWoyj9jjaG8dCwFdmtK5zc2eCTgKtmRqOKDBWvwRFHlD/M+n0dE76bqkVWtAQDpCe T4JQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version:reply-to :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:references:in-reply-to:message-id:date :to:from:delivered-to; bh=TIn1ItT/ZB/uINq1N8eiqLiVxbkJiI/7jAglSsSFYVI=; b=nP1gv8WjcHCmI77CsSrAZz4rwXpNA0WhtKQ1kZp1slc8MGUhswWl3FhToa/n5O2a8E WMcfngmrXGP6zDbPKdI5+pfl+1axIu3qGrWTnT/szOqBwiqPay2dGVWGkGzqZfuMma/S rWvehtPNxAESgau1xqPyH7YENKH50iFapS3EfO9VIs1zW9mgn55CkXXnhejLzR954Ge2 /wnKFD4enLV0eAQA5oyp1W1niwILAHAB4tQO8KybSJllgrfNcqXgqYoTEY+aeEBZI2FN 5mnsbDXwvjevO5NSFZCnc+TdDifoDiQg2IpviGxiEy41fbzMYDHX/kvOGxbMC14KzZRW kwsg== ARC-Authentication-Results: i=1; mx.google.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 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id lc15-20020a170906f90f00b009883d37f9fbsi272740ejb.954.2023.06.19.16.04.56; Mon, 19 Jun 2023 16:04:56 -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; 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 Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 2496968C09A; Tue, 20 Jun 2023 02:04:36 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-02-2.mymagenta.at (mail-02-2.mymagenta.at [80.109.253.249]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 0A7C068AAB3 for ; Tue, 20 Jun 2023 02:04:27 +0300 (EEST) Received: from [192.168.232.135] (helo=ren-mail-psmtp-mg01.) by mail-02.mymagenta.at with esmtp (Exim 4.93) (envelope-from ) id 1qBNv8-002cPq-Hr for ffmpeg-devel@ffmpeg.org; Tue, 20 Jun 2023 01:04:26 +0200 Received: from localhost ([84.115.40.24]) by ren-mail-psmtp-mg01. with ESMTP id BNv6qHTJVOG5ZBNv6qPHLu; Tue, 20 Jun 2023 01:04:24 +0200 X-Env-Mailfrom: michael@niedermayer.cc X-Env-Rcptto: ffmpeg-devel@ffmpeg.org X-SourceIP: 84.115.40.24 X-CNFS-Analysis: v=2.4 cv=KJo5sHJo c=1 sm=1 tr=0 ts=6490def8 a=4thelYDX6rwh+ygQwvsI+Q==:117 a=4thelYDX6rwh+ygQwvsI+Q==:17 a=MKtGQD3n3ToA:10 a=1oJP67jkp3AA:10 a=GEAsPZ9sns4A:10 a=VsWyEgZ-WJsrnXd58aoA:9 From: Michael Niedermayer To: FFmpeg development discussions and patches Date: Tue, 20 Jun 2023 01:04:24 +0200 Message-Id: <20230619230424.30270-3-michael@niedermayer.cc> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20230619230424.30270-1-michael@niedermayer.cc> References: <20230619230424.30270-1-michael@niedermayer.cc> X-CMAE-Envelope: MS4xfDZLMx3BfJkRM8NCy4sjVvgdjJkcB8CL+XWDv12aPc3MNny4NVNUEaGmy0pa3bE7skqFgsfzSEaLMgAc01P+pRyjda4OpB7tCtX3hXj4UKu3RMOog/Wy dcooQfqLbOwE+iFpwJXGmtWyZFMHysS5hTSwfa0nfJ3FEGOsp/lf2sdbJmf6ckoVBobcYrtQaD1JOQ== Subject: [FFmpeg-devel] [PATCH 3/3] avutil/softfloat: fix av_sincos_sf() 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 MIME-Version: 1.0 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: g06mJsL1gwlA Signed-off-by: Michael Niedermayer --- libavutil/softfloat.h | 2 +- libavutil/tests/softfloat.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/libavutil/softfloat.h b/libavutil/softfloat.h index a651406f74..1520027ddc 100644 --- a/libavutil/softfloat.h +++ b/libavutil/softfloat.h @@ -281,7 +281,7 @@ static av_unused void av_sincos_sf(int a, int *s, int *c) (int64_t)av_sintbl_4_sf[(idx & 0x1f) + 1] * (a & 0x7ff) + 0x400) >> 11); - *c = (int)(((int64_t)cv * ct + (int64_t)sv * st + 0x20000000) >> 30); + *c = (int)(((int64_t)cv * ct - (int64_t)sv * st + 0x20000000) >> 30); *s = (int)(((int64_t)cv * st + (int64_t)sv * ct + 0x20000000) >> 30); } diff --git a/libavutil/tests/softfloat.c b/libavutil/tests/softfloat.c index c06de44933..a2e628fe81 100644 --- a/libavutil/tests/softfloat.c +++ b/libavutil/tests/softfloat.c @@ -148,7 +148,7 @@ int main(void){ av_sincos_sf(i*(1ULL<<32)/36/4, &s, &c); errs = (double)s/ (1<<30) - sin(i*M_PI/36); errc = (double)c/ (1<<30) - cos(i*M_PI/36); - if (fabs(errs) > 0.00000002 || fabs(errc) >0.001) { + if (fabs(errs) > 0.000000004 || fabs(errc) >0.000000004) { printf("sincos FAIL %d %f %f %f %f\n", i, (float)s/ (1<<30), (float)c/ (1<<30), sin(i*M_PI/36), cos(i*M_PI/36)); }