From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ffbox0-bg.ffmpeg.org (ffbox0-bg.ffmpeg.org [79.124.17.100]) by master.gitmailbox.com (Postfix) with ESMTPS id 09A5A4A19A for ; Thu, 17 Jul 2025 09:42:06 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.ffmpeg.org (Postfix) with ESMTP id 03F9468ECE4; Thu, 17 Jul 2025 12:42:03 +0300 (EEST) Received: from haasn.dev (haasn.dev [78.46.187.166]) by ffbox0-bg.ffmpeg.org (Postfix) with ESMTP id 91AFA68E8EB for ; Thu, 17 Jul 2025 12:41:56 +0300 (EEST) Received: from haasn.dev (unknown [10.30.1.1]) by haasn.dev (Postfix) with UTF8SMTP id 5CD8B4293B for ; Thu, 17 Jul 2025 11:41:56 +0200 (CEST) Date: Thu, 17 Jul 2025 11:41:56 +0200 Message-ID: <20250717114156.GD6276@haasn.xyz> From: Niklas Haas To: ffmpeg-devel@ffmpeg.org In-Reply-To: <3e86076b-ca1f-47bc-afef-55f9f91ab9c6@gmail.com> References: <20250716162536.394049-1-ffmpeg@haasn.xyz> <20250716162536.394049-4-ffmpeg@haasn.xyz> <3e86076b-ca1f-47bc-afef-55f9f91ab9c6@gmail.com> MIME-Version: 1.0 Content-Disposition: inline Subject: Re: [FFmpeg-devel] [PATCH v2 3/3] avfilter/vf_colordetect: add x86 SIMD implementation 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: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: On Wed, 16 Jul 2025 17:25:12 -0300 James Almer wrote: > On 7/16/2025 1:24 PM, Niklas Haas wrote: > > +cglobal detect_alpha%1_%3, 6, 7, 6, color, color_stride, alpha, alpha_stride, width, height, x > > + pxor m0, m0 > > + add colorq, widthq > > + add alphaq, widthq > > + neg widthq > > +%ifidn %3, limited > > +%if ARCH_X86_64 > > + movq xm3, r6mp ; p > > + movq xm4, r7mp ; q > > + movq xm5, r8mp ; k > > They are int arguments, so no point using movq. > > > +%else > > + movd xm3, r6mp ; p > > + movd xm4, r7mp ; q > > + movd xm5, r8mp ; k > > +%endif > > + vpbroadcast%2 m3, xm3 > > + vpbroadcast%2 m4, xm4 > > + vpbroadcast%2 m5, xm5 > > +%endif > > +.lineloop: > > + mov xq, widthq > > + .loop: > > + %ifidn %3, full > > + movu m1, [colorq + xq] > > + movu m2, [alphaq + xq] > > + pmaxu%1 m1, m2 > > + %else > > + pmovzx%1%2 m1, [colorq + xq] > > + pmovzx%1%2 m2, [alphaq + xq] > > + pmull%2 m1, m3 > > + pmull%2 m2, m4 > > pmulld is painfully slow, so try to instead use pmaddwd. It should be > doable because the input are words. Wouldn't this add together adjacent pairs of words, which is not what we want? Or do you mean I should construct two intermediate registers like {p, 0, p, 0, p, 0, ...} and {0, p, 0, p, 0, p, ...} and then use two separate pmaddwd instructions to process a full register? > _______________________________________________ > 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". _______________________________________________ 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".