From patchwork Wed Apr 8 20:36:53 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Marton Balint X-Patchwork-Id: 17266 Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id n38KbscG024588 for ; Wed, 8 Apr 2009 20:37:54 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1763427AbZDHUhJ (ORCPT ); Wed, 8 Apr 2009 16:37:09 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1763108AbZDHUhH (ORCPT ); Wed, 8 Apr 2009 16:37:07 -0400 Received: from cinke.fazekas.hu ([195.199.244.225]:40900 "EHLO cinke.fazekas.hu" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757122AbZDHUhF (ORCPT ); Wed, 8 Apr 2009 16:37:05 -0400 Received: from localhost (localhost [127.0.0.1]) by cinke.fazekas.hu (Postfix) with ESMTP id 9BC1F33CC6; Wed, 8 Apr 2009 22:37:00 +0200 (CEST) X-Virus-Scanned: amavisd-new at fazekas.hu Received: from cinke.fazekas.hu ([127.0.0.1]) by localhost (cinke.fazekas.hu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id AWeo992mpkwK; Wed, 8 Apr 2009 22:36:53 +0200 (CEST) Received: from cinke.fazekas.hu (cinke.fazekas.hu [195.199.244.225]) by cinke.fazekas.hu (Postfix) with ESMTP id A229933CC4; Wed, 8 Apr 2009 22:36:53 +0200 (CEST) Date: Wed, 8 Apr 2009 22:36:53 +0200 (CEST) From: Marton Balint To: Miroslav =?utf-8?b?xaB1c3Rlaw==?= cc: linux-media@vger.kernel.org, mchehab@infradead.org Subject: Re: [PATCH] Re: cx88-dsp.c: missing =?utf-8?b?X19kaXZkaTM=?= on 32bit kernel In-Reply-To: Message-ID: References: <200904062233.30966@centrum.cz> <200904062234.8192@centrum.cz> <200904062235.15206@centrum.cz> <200904062236.31983@centrum.cz> <200904062237.27161@centrum.cz> <200904062238.10335@centrum.cz> <200904062239.877@centrum.cz> <200904062240.9520@centrum.cz> <200904062240.1773@centrum.cz> MIME-Version: 1.0 Content-ID: Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org On Tue, 7 Apr 2009, Marton Balint wrote: > On Mon, 6 Apr 2009, Miroslav Å ustek wrote: > > > Well this patch should solve it. > > > > I don't know how many samples are processed so: > > First patch is for situation when N*N fits in s32. > > Second one uses two divisions, but doesn't have any abnormal restrictions for N. > > Both patches are fine, beacuse in the current implementation N is not > bigger than 576. Thanks for fixing this problem. It seems that an #include is missing to math64.h. Below is a patch that adds the missing include. Regards, Marton # HG changeset patch # User Marton Balint # Date 1239222228 -7200 # Node ID c07293f1b5e44a8614f8f84c6b4fc586a02e69eb # Parent 202a1c7ec37968f35678980b5f3d9812e5961ef0 cx88: dsp: add missing include to math64.h From: Marton Balint This patch adds a missing include to math64.h and replaces div_s64_rem with div_s64 since the remainder is not used anyway. Priority: normal Signed-off-by: Marton Balint diff -r 202a1c7ec379 -r c07293f1b5e4 linux/drivers/media/video/cx88/cx88-dsp.c --- a/linux/drivers/media/video/cx88/cx88-dsp.c Mon Apr 06 23:07:04 2009 +0000 +++ b/linux/drivers/media/video/cx88/cx88-dsp.c Wed Apr 08 22:23:48 2009 +0200 @@ -22,6 +22,7 @@ #include #include #include +#include #include "cx88.h" #include "cx88-reg.h" @@ -100,9 +101,7 @@ s32 s_prev2 = 0; s32 coeff = 2*int_cos(freq); u32 i; - s64 tmp; - u32 remainder; for (i = 0; i < N; i++) { s32 s = x[i] + ((s64)coeff*s_prev/32768) - s_prev2; @@ -113,9 +112,8 @@ tmp = (s64)s_prev2*s_prev2 + (s64)s_prev*s_prev - (s64)coeff*s_prev2*s_prev/32768; - /* XXX: N must be low enough so that N*N fits in s32. - * Else we need two divisions. */ - return (u32) div_s64_rem(tmp, N*N, &remainder); + /* N is low enough so N*N fits in s32. */ + return (u32) div_s64(tmp, N*N); } static u32 freq_magnitude(s16 x[], u32 N, u32 freq)