From: Antti Palosaari <crope@iki.fi>
To: Thomas Mair <thomas.mair86@googlemail.com>
Cc: linux-media@vger.kernel.org
Subject: Re: [PATCH 1/5] rtl2832 ver 0.3: suport for RTL2832 demodulator revised version
Date: Fri, 18 May 2012 22:16:36 +0300 [thread overview]
Message-ID: <4FB6A014.8000706@iki.fi> (raw)
In-Reply-To: <4FB061C2.90006@iki.fi>
On 14.05.2012 04:37, Antti Palosaari wrote:
>
>> + else {
>> + /* if_agc is read as a 10bit binary */
>> + ret = rtl2832_rd_demod_reg(priv, DVBT_IF_AGC_VAL,&if_agc_raw);
>> + if (ret)
>> + goto err;
>> +
>> + if (if_agc_raw< (1<< 9))
>> + if_agc = if_agc_raw;
>> + else
>> + if_agc = -(~(if_agc_raw-1)& 0x1ff);
>> +
>> + *strength = 55 - if_agc / 182;
>> + *strength |= *strength<< 8;
>
> That calculation shows doubtful. Why not to scale directly to the
> counter. Now you divide it by 182 and after that multiply 256 (<< 8
> means same as multiply by 256). It is stupid calculation.
I was playing with RTL2830 statistics and thus it is quite similar I
ended up looking that again. It is not so wrong as I commented. The idea
of whole calculation is to underflow unsigned 8 bit value to the
*strength. But it goes wrong here because you don't cast it as unsigned
char (this should be *strength = (u8) (55 - if_agc / 182);.
I implemented that rather similarly for the RTL2830. But it is very poor
resolution for some reason... :-(
regards
Antti
--
http://palosaari.fi/
next prev parent reply other threads:[~2012-05-18 19:16 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-05-12 18:08 [PATCH 0/5] support rtl2832 demodulator Thomas Mair
2012-05-12 18:08 ` [PATCH 1/5] rtl2832 ver 0.3: suport for RTL2832 demodulator revised version Thomas Mair
2012-05-12 22:07 ` poma
2012-05-13 18:53 ` Antti Palosaari
2012-05-13 20:56 ` Thomas Mair
2012-05-14 1:37 ` Antti Palosaari
2012-05-14 1:46 ` Antti Palosaari
2012-05-15 15:41 ` Antti Palosaari
2012-05-16 5:10 ` poma
2012-05-18 19:16 ` Antti Palosaari [this message]
2012-05-12 18:08 ` [PATCH 2/5] rtl28xxu: support for the rtl2832 demod driver Thomas Mair
2012-05-12 18:08 ` [PATCH 3/5] rtl28xxu: renamed rtl2831_rd/rtl2831_wr to rtl28xx_rd/rtl28xx_wr Thomas Mair
2012-05-12 18:08 ` [PATCH 4/5] rtl28xxu: support G-Tek Electronics Group Lifeview LV5TDLX DVB-T Thomas Mair
2012-05-12 18:08 ` [PATCH 5/5] rtl28xxu: support Terratec Noxon DAB/DAB+ stick Thomas Mair
2012-05-12 20:47 ` Thomas Mair
2012-05-13 21:18 ` [PATCH] rtl28xxu: removed newlines from info strings Thomas Mair
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4FB6A014.8000706@iki.fi \
--to=crope@iki.fi \
--cc=linux-media@vger.kernel.org \
--cc=thomas.mair86@googlemail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).