Re: [PATCH 1/5] rtl2832 ver 0.3: suport for RTL2832 demodulator revised version

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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/
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Input]     [Video for Linux]     [Gstreamer Embedded]     [Mplayer Users]     [Linux USB Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux