From patchwork Mon May 23 16:06:16 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vardan Margaryan X-Patchwork-Id: 35900 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:6914:b0:82:6b11:2509 with SMTP id q20csp91337pzj; Mon, 23 May 2022 09:06:35 -0700 (PDT) X-Google-Smtp-Source: ABdhPJws7LBl+otSCsQf67RHc8PDhwtsq+MwxYqP85NJ+8x4KEsiZVdey0E+aMSQ7HRptD5OLjSB X-Received: by 2002:a05:6402:3209:b0:42a:e817:1437 with SMTP id g9-20020a056402320900b0042ae8171437mr24858780eda.168.1653321994714; Mon, 23 May 2022 09:06:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1653321994; cv=none; d=google.com; s=arc-20160816; b=QbjlX+2PyLhgoW74AyvZrc5vRZu7y0MruxARylYf0zqVfv8RCAIUQjb68x3/c74V8x QQJ5i00Cg4VvX0dqOgBfjMonShsMrZXQ43o4NxwHpxwbRqiowZGgnB/9TMBElYXDs762 +2nZKg9yFchtZsLbCc8sL1CLSdn9b+DzdAdtZ5j0fpxlrN7FEmWgoCMImxWAWClJSDmE bQI/+p/FEKiD0Wmpd6ce07Hrlv4pRKlGOOkxUFuGLJSXo+oB2iiV+bnKEDpH9QJj71gd cyTfUpRZTMcA9A4pbWFPRBpSe3OdMqfogsJevg8EhwPVmi6r7O3VOrsXJV8+GPx0Ew/B bKOA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:reply-to:list-subscribe :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:subject:content-language:to:from:user-agent:mime-version :date:message-id:dkim-signature:delivered-to; bh=3lUxMMROgnWCa8DOTqYyGcTi4lIhGmN6doCfT3xOm+I=; b=XrlMQCX+h0OSH0ywGiZMaPcQzCPf3KeiP+lLozhEkcmF7ioivygGfSzPShAi65nVtm eEV6RA9iViEAkfkWfMCDpRYmaS1VikRUpvF0FTfKtDwVQjHVralOGt3RD6BggVDuyEIx yegrLxuAxuxfMMh0dAONcVVtQwK6MYZq2WaJo781zPRxfLiXhT+bRQH5Z+J4wv/+6ibZ i65NT0viLKLE4kmf1vBRoht6Uun0TpetDn7sDD2SZUC/Jn+7sT2kXeMFz+fWFuigytNB hJUxnuQc5Mh4VQBjXYkyC25Wd6mHIyS31qRM5ASlJ1MxFiQLP9HYJxv/gMAKSeduPuPI M7eQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20210112 header.b=nTsWHIg3; 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 sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id i11-20020a1709064fcb00b006f3b8834625si12671799ejw.423.2022.05.23.09.06.29; Mon, 23 May 2022 09:06: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 header.s=20210112 header.b=nTsWHIg3; 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 sp=QUARANTINE 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 C777668B4A3; Mon, 23 May 2022 19:06:25 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-lf1-f43.google.com (mail-lf1-f43.google.com [209.85.167.43]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 9B08868B0A6 for ; Mon, 23 May 2022 19:06:19 +0300 (EEST) Received: by mail-lf1-f43.google.com with SMTP id u23so26414357lfc.1 for ; Mon, 23 May 2022 09:06:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=message-id:date:mime-version:user-agent:from:subject:to :content-language:content-transfer-encoding; bh=AQXrYdE0/g+0QI/SqxdSbUxi5E5ZEpvdl3GMpVU3FV0=; b=nTsWHIg3orrNy3i+vI7UDZzdIE3de3EKOR8+cbqqVerrPKRLB4+xOyArZ0jrVRzcVK R54396YmBQyfLf/sg68JghZ5noGJ5EdINpGy0xkwDcBtZ39K/skB6fPPX21oXFZX3Br2 sbdHb5BcoLvfHE/xVb/TC7TVy9fyCHs0XcQzlo5j0m7Ve0di+Ot6BP5esEQnKKbPtLXA 4G21V7NVEbXWHduQWcjPdy9Mt7kgw2PWSaqgJyL4Ro4JdyDoYIJwdbXBBU5rxpBsgQn/ 8iKQ98GjhN/O9pbfx7zgNCfxj8aSfNE6Tv6bOTskjTvQBnw+LHmbIn9Z/JsatkdYIh4w myGA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:date:mime-version:user-agent:from :subject:to:content-language:content-transfer-encoding; bh=AQXrYdE0/g+0QI/SqxdSbUxi5E5ZEpvdl3GMpVU3FV0=; b=7ku0h0PS3HSunr+zldA4jdhSZSoP/ck6ugT1aCG9Q/XwMFom8S+GHF0JPBjBOL8VAv thGu3U/ew3I34Qp8+fgkAdpztBn604rw1aI2UX6FoIa8fqWd+dCbX8m/X7kculrM06RL OWdchK159sVrlkz+CZch7jjZC609YtLtSZ5F6VmNQ6zRZLwvBSeait3O1qPhpiQwchHB aA81rrC9RR63XVsIvUZe/Mtc7Y+ibL3XfCmecq92VI97Dzl2t2Y1Zp7mgzKfVp8vGe0a 8KBcrN1//eULEx0xrt+dQSz3gCiItAitp5ARZdn5M+Np3Cs7pu4qeenVOqo65SZ67+8g NwVw== X-Gm-Message-State: AOAM53392luc6b3oNMRUMX+OLC6/CZcSVChKKC8HXb0hf2TvzzLM23qr +Ng1wDaISglosYRgS0msa/7TUIWMV+KT3HFN X-Received: by 2002:a19:770e:0:b0:478:6df3:a56a with SMTP id s14-20020a19770e000000b004786df3a56amr4412758lfc.419.1653321978486; Mon, 23 May 2022 09:06:18 -0700 (PDT) Received: from [10.0.45.52] ([83.239.225.50]) by smtp.gmail.com with ESMTPSA id o5-20020a2e9445000000b00253da399907sm1906918ljh.114.2022.05.23.09.06.17 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 23 May 2022 09:06:17 -0700 (PDT) Message-ID: <6c55b4a0-4c84-a1b9-cdf3-ae3e7e527f68@gmail.com> Date: Mon, 23 May 2022 19:06:16 +0300 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Thunderbird/91.9.0 From: Vardan Margaryan To: ffmpeg-devel@ffmpeg.org Content-Language: ru Subject: [FFmpeg-devel] [PATCH] swscale/x86/yuv_2_rgb: fix access to memory past the frame data in yuv to rgb conversion 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 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: B7gzf7F7HD9Q Y, U, V data is loaded at the end of the current iteration for the next iteration. It results in memory access past the frame data on the last iteration (that data is never used after the loading). So load data at the start of the iteration, so that only useful data is loaded. Signed-off-by: Vardan Margaryan --- libswscale/x86/yuv_2_rgb.asm | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) punpcklbw m0, m4 @@ -347,9 +347,6 @@ cglobal %1_420_%2%3, GPR_num, GPR_num, reg_num, parameters %endif ; PACK RGB15/16 %endif ; PACK RGB15/16/32 -movu m_y, [py_2indexq + 2 * indexq + 8 * time_num] -movh m_v, [pv_indexq + indexq + 4 * time_num] -movh m_u, [pu_indexq + indexq + 4 * time_num] add imageq, 8 * depth * time_num add indexq, 4 * time_num js .loop0 diff --git a/libswscale/x86/yuv_2_rgb.asm b/libswscale/x86/yuv_2_rgb.asm index 2f0b4130df..f968b3a0a2 100644 --- a/libswscale/x86/yuv_2_rgb.asm +++ b/libswscale/x86/yuv_2_rgb.asm @@ -139,10 +139,10 @@ cglobal %1_420_%2%3, GPR_num, GPR_num, reg_num, parameters VBROADCASTSD vr_coff, [pointer_c_ditherq + 4 * 8] %endif %endif +.loop0: movu m_y, [py_2indexq + 2 * indexq] movh m_u, [pu_indexq + indexq] movh m_v, [pv_indexq + indexq] -.loop0: pxor m4, m4 mova m7, m6