public inbox for linux-media@vger.kernel.org
 help / color / mirror / Atom feed
* [w_scan PATCH] Add Brazil support on w_scan
@ 2011-03-28 14:29 Mauro Carvalho Chehab
  2011-03-28 17:20 ` handygewinnspiel
  0 siblings, 1 reply; 9+ messages in thread
From: Mauro Carvalho Chehab @ 2011-03-28 14:29 UTC (permalink / raw)
  To: wk; +Cc: Linux Media Mailing List

While w_scan Country table has entries for Brazil, they're currently
not handled.

Brazil uses ISDB-T standard (also called SBTVD) for terrestrial
transmissions. Thanks to the way DVB drivers implement ISDB-T,
DVB API v3 calls are handled as if it were DVB-T, and this works
fine for broadcast TV. However, it uses a 6MHz frequency table
close to the one used in US. However, ISDB-T requires a frequency
shift of 142,857 Hz in order to get the central OFTM carrier.

Cable operators use DVB-C, but as they migrated from a PAL/M 6MHz
frequency table identical to NTSC IRC one, DVB-C channels are also
spaced with 6MHz, and the symbol rate is lower than what's found
with 7/8MHz.

For Satellite, Brazil uses DVB-S/DVB-S2 standards on both C and Ku
bands, but, as I currently don't have a Satellite dish, I couldn't 
test if w_scan works for it, but I suspect that no changes are needed
for DVB-S.

This patch adds support for both ISDB-T and DVB-C @6MHz used in
Brazil, and adds a new bit rate of 5.2170 MSymbol/s, found on QAM256
transmissions at some Brazilian cable operators.

While here, fix compilation with kernels 2.6.39 and later, where the
old V4L1 API were removed (so, linux/videodev.h doesn't exist anymore).
This is needed to compile it on Fedora 15 beta.

Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>

diff -r 1bd9736b45fe w_scan-20110206/countries.c
--- a/w_scan-20110206/countries.c	Tue Mar 22 23:19:49 2011 -0300
+++ b/w_scan-20110206/countries.c	Mon Mar 28 11:11:28 2011 -0300
@@ -31,7 +31,7 @@
 #include <string.h>
 #include <unistd.h>
 #include <stdlib.h>
-#include <linux/videodev.h>
+#include <linux/videodev2.h>
 #include <linux/dvb/frontend.h>
 
 #ifdef VDRVERSNUM
@@ -136,6 +136,20 @@
                                 }
                         break;
                 
+		case	BR:	// Brazil
+                        switch(*dvb) {    
+                                case FE_QAM:
+                                        *frontend_type = FE_QAM;
+                                        info("DVB cable\n");
+                                        break;
+                                default:
+                                        *frontend_type = FE_OFDM;
+                                        info("ISDB-T (SBTVD)\n");
+                                        break;               
+                                }
+                        break;
+
+
                 case    US:     //      UNITED STATES
                 case    CA:     //      CANADA
                         *frontend_type = FE_ATSC;
@@ -245,6 +259,18 @@
                                 info("QAM US/CA\n");    
                                 }
                         break;
+		case	BR:
+                        switch(*dvb) {    
+                                case FE_QAM:
+					*channellist = DVBC_BR;
+                                        info("Brazil, cable\n");
+                                        break;
+                                default:
+					*channellist = ISDBT_6MHZ;
+                                        info("Brazil, terrestrial\n");
+                                        break;               
+                                }
+                        break;
                 //******************************************************************//    
                 default:
                         info("Country identifier %s not defined. Using default freq lists.\n", country);
@@ -278,6 +304,23 @@
                         case 14 ... 69: return  389000000;
                         default:        return  SKIP_CHANNEL;
                         }
+        case ISDBT_6MHZ: // ISDB-T, 6 MHz central frequencies
+                switch (channel) {
+			// Channels 7-13 are reserved but aren't used yet
+                        case 14 ... 69: return  389000000 + 142857;
+                        default:        return  SKIP_CHANNEL;
+                        }
+	case DVBC_BR: //BRAZIL - same range as ATSC IRC
+                switch (channel) {
+                        case 02 ... 04:   return   45000000;
+                        case 05 ... 06:   return   49000000;
+                        case 07 ... 13:   return  135000000;
+                        case 14 ... 22:   return   39000000;
+                        case 23 ... 94:   return   81000000;
+                        case 95 ... 99:   return -477000000;
+                        case 100 ... 133: return   51000000;
+                        default:          return SKIP_CHANNEL; 
+                        }
         case DVBT_AU: //AUSTRALIA, 7MHz step list
                 switch (channel) {
                         case 05 ... 12: return  142500000;
@@ -321,6 +364,8 @@
  */
 int freq_step(int channel, int channellist) {
 switch (channellist) {
+        case ISDBT_6MHZ:
+        case DVBC_BR:
         case ATSC_QAM:
         case ATSC_VSB: return  6000000; // atsc, 6MHz step
         case DVBT_AU:  return  7000000; // dvb-t australia, 7MHz step
diff -r 1bd9736b45fe w_scan-20110206/countries.h
--- a/w_scan-20110206/countries.h	Tue Mar 22 23:19:49 2011 -0300
+++ b/w_scan-20110206/countries.h	Mon Mar 28 11:11:28 2011 -0300
@@ -43,6 +43,8 @@
         DVBC_QAM                = 7,
         DVBC_FI                 = 8,
         DVBC_FR                 = 9,
+	DVBC_BR			= 10,
+	ISDBT_6MHZ		= 11,
         USERLIST                = 999
 };
 
diff -r 1bd9736b45fe w_scan-20110206/scan.c
--- a/w_scan-20110206/scan.c	Tue Mar 22 23:19:49 2011 -0300
+++ b/w_scan-20110206/scan.c	Mon Mar 28 11:11:28 2011 -0300
@@ -1914,6 +1914,7 @@
 		case 14:		return 5483000;
 		case 15:		return 6956000;
 		case 16:		return 6956500;
+		case 17:		return 5217000;		// Used in Brazil DVB-C @ 6MHz Bandwidth
 		default:		return 0;
 		}
 }
@@ -1985,6 +1986,10 @@
 		dvbc_symbolrate_min=dvbc_symbolrate_max=0;
 		break;
 	case FE_QAM:
+		// 6MHz DVB-C uses lower symbol rates
+		if (freq_step(channel, this_channellist) == 6000000) {
+			dvbc_symbolrate_min=dvbc_symbolrate_max=17;
+		}
 		break;
 	case FE_QPSK:
 		// channel means here: transponder,
@@ -2555,7 +2560,7 @@
 	"			enables scan of symbolrates\n"
 	"			6111, 6250, 6790, 6811, 5900,\n"
 	"			5000, 3450, 4000, 6950, 7000,\n"
-	"			6952, 6956, 6956.5\n"
+	"			6952, 6956, 6956.5, 5.217\n"
 	"		2 = extended QAM scan (enable QAM128)\n"
 	"			recommended for Nethterlands and Finland\n"
 	"		NOTE: extended scan will be *slow*\n"
@@ -2577,6 +2582,7 @@
 	"			14 = 5.4830 MSymbol/s\n"
 	"			15 = 6.9560 MSymbol/s\n"
 	"			16 = 6.9565 MSymbol/s\n"
+	"			17 = 5.2170 MSymbol/s\n"
 	"		NOTE: for experienced users only!!\n"
 	".................DVB-S/S2................\n"
 	"	-l <LNB type>\n"
@@ -2657,7 +2663,7 @@
 		case 'e': //extended scan flags
 			ext = strtoul(optarg, NULL, 0);
 			if (ext & 0x01)
-				dvbc_symbolrate_max = 16;
+				dvbc_symbolrate_max = 17;
 			if (ext & 0x02) {
 				modulation_max = 2;
 				modulation_flags |= MOD_OVERRIDE_MAX;

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [w_scan PATCH] Add Brazil support on w_scan
  2011-03-28 14:29 [w_scan PATCH] Add Brazil support on w_scan Mauro Carvalho Chehab
@ 2011-03-28 17:20 ` handygewinnspiel
  2011-03-28 18:46   ` Mauro Carvalho Chehab
  0 siblings, 1 reply; 9+ messages in thread
From: handygewinnspiel @ 2011-03-28 17:20 UTC (permalink / raw)
  To: Mauro Carvalho Chehab; +Cc: linux-media

Hi Mauro,

> This patch adds support for both ISDB-T and DVB-C @6MHz used in
> Brazil, and adds a new bit rate of 5.2170 MSymbol/s, found on QAM256
> transmissions at some Brazilian cable operators.

Good. :)

> While here, fix compilation with kernels 2.6.39 and later, where the
> old V4L1 API were removed (so, linux/videodev.h doesn't exist anymore).
> This is needed to compile it on Fedora 15 beta.

videodev.h should have never been in there. Was already reported and will be removed instead.

> @@ -1985,6 +1986,10 @@
>  		dvbc_symbolrate_min=dvbc_symbolrate_max=0;
>  		break;
>  	case FE_QAM:
> +		// 6MHz DVB-C uses lower symbol rates
> +		if (freq_step(channel, this_channellist) == 6000000) {
> +			dvbc_symbolrate_min=dvbc_symbolrate_max=17;
> +		}
>  		break;
>  	case FE_QPSK:
>  		// channel means here: transponder,

This one causes me headache, because this one has side-effects to all other DVB-C cases using 6MHz bandwidth.
Are there *any cases* around, where some country may use DVB-C with symbolrates other than 5.217Mbit/s? I know that for Europe there are many cases where low symbolrates are used, even if higher would be possible.

If there are any doubts, i would prefer a solution like this and add all countries know to use this srate:

  		dvbc_symbolrate_min=dvbc_symbolrate_max=0;
  		break;
  	case FE_QAM:
 +		// 6MHz DVB-C uses lower symbol rates
 +		switch (this_channellist) {
 +                       case DVBC_BR:
 +			      dvbc_symbolrate_min=dvbc_symbolrate_max=17;
 +                            break;
 +                       default:; 
 +		}
  		break;
  	case FE_QPSK:
  		// channel means here: transponder,


I need an valid answer which solution is better to accept this patch.

cheers,
Winfried
-- 
NEU: FreePhone - kostenlos mobil telefonieren und surfen!			
Jetzt informieren: http://www.gmx.net/de/go/freephone

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [w_scan PATCH] Add Brazil support on w_scan
  2011-03-28 17:20 ` handygewinnspiel
@ 2011-03-28 18:46   ` Mauro Carvalho Chehab
  2011-03-29 20:11     ` handygewinnspiel
  0 siblings, 1 reply; 9+ messages in thread
From: Mauro Carvalho Chehab @ 2011-03-28 18:46 UTC (permalink / raw)
  To: handygewinnspiel; +Cc: linux-media

Em 28-03-2011 14:20, handygewinnspiel@gmx.de escreveu:
> Hi Mauro,
> 
>> This patch adds support for both ISDB-T and DVB-C @6MHz used in
>> Brazil, and adds a new bit rate of 5.2170 MSymbol/s, found on QAM256
>> transmissions at some Brazilian cable operators.
> 
> Good. :)
> 
>> While here, fix compilation with kernels 2.6.39 and later, where the
>> old V4L1 API were removed (so, linux/videodev.h doesn't exist anymore).
>> This is needed to compile it on Fedora 15 beta.
> 
> videodev.h should have never been in there. Was already reported and will be removed instead.
> 
>> @@ -1985,6 +1986,10 @@
>>  		dvbc_symbolrate_min=dvbc_symbolrate_max=0;
>>  		break;
>>  	case FE_QAM:
>> +		// 6MHz DVB-C uses lower symbol rates
>> +		if (freq_step(channel, this_channellist) == 6000000) {
>> +			dvbc_symbolrate_min=dvbc_symbolrate_max=17;
>> +		}
>>  		break;
>>  	case FE_QPSK:
>>  		// channel means here: transponder,
> 
> This one causes me headache, because this one has side-effects to all other DVB-C cases using 6MHz bandwidth.
> Are there *any cases* around, where some country may use DVB-C with symbolrates other than 5.217Mbit/s?

If you take a look at EN 300 429[1], The DVB-C roll-off factor (alpha) is defined as 0.15.

	[1] EN 300 429 V1.2.1 (1998-04), chapter 9, page 16, and table B.1

So, the amount of the needed bandwidth (e. g. the Nyquist cut-off frequency) is given by:
  Bw = Symbol_rate * (1 + 0.15)

E. g. the maximum symbol rate is given by:

	Symbol_rate(6MHz) = 6000000/1.15 = 5217391.30434782608695652173
	Symbol_rate(7MHz) = 7000000/1.15 = 6086956.52173913043478260869
	Symbol_rate(8MHz) = 8000000/1.15 = 6956521.73913043478260869565

As you see, for Countries using 6MHz bandwidth, the maximum value is about 5.127 Mbauds.
With the current w_scan logic of assuming 6.9 or 6.875 Mbauds by default for DVB-C, 
w_scan will never find any channel, if the channel bandwidth fits into a 6MHz (or 7MHz)
channel spacing.

So, the above change won't cause regressions, although it could be improved.

IMHO, a different logic could be used instead, if the user doesn't use the -S parameter, like:

int dvbc_symbolrate[] = {
	7000000,
	6956500,		/* Max Symbol rate for 8 MHz channel bandwidth */
	6956000,
	6952000,
	6950000,
	6900000,
	6875000,
	6811000,
	6790000,
	6250000,
	6111000,

	/* Weird: I would expect 6086 or 6086.5 here, as the max rate for 7MHz spacing */
			
	5900000,		/* Require at least 7 MHz channel bandwidth */
	5483000,
	5217000,		/* Max Symbol rate for 6 MHz channel bandwidth */
	5156000,
	5000000,
	4000000,
	3450000,
};

for (i = 0; i < ARRAY_SIZE(dvbc_symbolrate)) {
	if (freq_step(channel, this_channellist) / 1.15 > dvbc_symbolrate[i])
		next;

	/* Scan channel */
...
}

Btw, this looks weird to me:
static int dvbc_symbolrate(int index)
{
       	switch(index) {
...
		case 11:                return 7000000;
...

While it might work, the amount of bandwidth is 8.050 MHz. Yet, as tuner low-pass filter 
will probably not attenuate too much the extra 50kHz, I don't doubt that someone would
be tempted to use this rate, but probably some boards will have troubles with that.

> I know that for Europe there are many cases where low symbolrates are used, even if higher would be possible.
> 
> If there are any doubts, i would prefer a solution like this and add all countries know to use this srate:
> 
>   		dvbc_symbolrate_min=dvbc_symbolrate_max=0;
>   		break;
>   	case FE_QAM:
>  +		// 6MHz DVB-C uses lower symbol rates
>  +		switch (this_channellist) {
>  +                       case DVBC_BR:
>  +			      dvbc_symbolrate_min=dvbc_symbolrate_max=17;
>  +                            break;
>  +                       default:; 
>  +		}
>   		break;

Yeah, this would work for Brazil, provided that we won't find any other operator
here using a Symbol rate bellow the maximum allowed.

>   	case FE_QPSK:
>   		// channel means here: transponder,
> 
> 
> I need an valid answer which solution is better to accept this patch.
> 
> cheers,
> Winfried


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [w_scan PATCH] Add Brazil support on w_scan
  2011-03-28 18:46   ` Mauro Carvalho Chehab
@ 2011-03-29 20:11     ` handygewinnspiel
  2011-03-29 23:21       ` Mauro Carvalho Chehab
  0 siblings, 1 reply; 9+ messages in thread
From: handygewinnspiel @ 2011-03-29 20:11 UTC (permalink / raw)
  To: Mauro Carvalho Chehab; +Cc: linux-media

> Em 28-03-2011 14:20, handygewinnspiel@gmx.de escreveu:
> > Hi Mauro,
> > 
> >> This patch adds support for both ISDB-T and DVB-C @6MHz used in
> >> Brazil, and adds a new bit rate of 5.2170 MSymbol/s, found on QAM256
> >> transmissions at some Brazilian cable operators.
> > 
> > Good. :)
> > 
> >> While here, fix compilation with kernels 2.6.39 and later, where the
> >> old V4L1 API were removed (so, linux/videodev.h doesn't exist anymore).
> >> This is needed to compile it on Fedora 15 beta.
> > 
> > videodev.h should have never been in there. Was already reported and
> will be removed instead.
> > 
> >> @@ -1985,6 +1986,10 @@
> >>  		dvbc_symbolrate_min=dvbc_symbolrate_max=0;
> >>  		break;
> >>  	case FE_QAM:
> >> +		// 6MHz DVB-C uses lower symbol rates
> >> +		if (freq_step(channel, this_channellist) == 6000000) {
> >> +			dvbc_symbolrate_min=dvbc_symbolrate_max=17;
> >> +		}
> >>  		break;
> >>  	case FE_QPSK:
> >>  		// channel means here: transponder,
> > 
> > This one causes me headache, because this one has side-effects to all
> other DVB-C cases using 6MHz bandwidth.
> > Are there *any cases* around, where some country may use DVB-C with
> symbolrates other than 5.217Mbit/s?
> 
> If you take a look at EN 300 429[1], The DVB-C roll-off factor (alpha) is
> defined as 0.15.
> 
> 	[1] EN 300 429 V1.2.1 (1998-04), chapter 9, page 16, and table B.1
> 
> So, the amount of the needed bandwidth (e. g. the Nyquist cut-off
> frequency) is given by:
>   Bw = Symbol_rate * (1 + 0.15)
> 
> E. g. the maximum symbol rate is given by:
> 
> 	Symbol_rate(6MHz) = 6000000/1.15 = 5217391.30434782608695652173
> 	Symbol_rate(7MHz) = 7000000/1.15 = 6086956.52173913043478260869
> 	Symbol_rate(8MHz) = 8000000/1.15 = 6956521.73913043478260869565
> 
> As you see, for Countries using 6MHz bandwidth, the maximum value is about
> 5.127 Mbauds.
> With the current w_scan logic of assuming 6.9 or 6.875 Mbauds by default
> for DVB-C, 
> w_scan will never find any channel, if the channel bandwidth fits into a
> 6MHz (or 7MHz)
> channel spacing.
> 
> So, the above change won't cause regressions, although it could be
> improved.



If w_scan assumes that every 6MHz cable network, also outside Brazil, will use it's maximum theoretical symbol rate *only* like your patch was implemented, it will probably fail as well, because in practice lower values are used.

Your patch disabled the looping through different symbol rates for any 6MHz network; therefore i was asking.

So I changed it now to scan any srate for 6MHz networks, but skip over those which are unsupported by bandwidth limitation.


> 
> IMHO, a different logic could be used instead, if the user doesn't use the
> -S parameter, like:
> 
> int dvbc_symbolrate[] = {
> 	7000000,
> 	6956500,		/* Max Symbol rate for 8 MHz channel bandwidth */
> 	6956000,
> 	6952000,
> 	6950000,
> 	6900000,
> 	6875000,
> 	6811000,
> 	6790000,
> 	6250000,
> 	6111000,
> 
> 	/* Weird: I would expect 6086 or 6086.5 here, as the max rate for 7MHz
> spacing */
> 			
> 	5900000,		/* Require at least 7 MHz channel bandwidth */
> 	5483000,
> 	5217000,		/* Max Symbol rate for 6 MHz channel bandwidth */
> 	5156000,
> 	5000000,
> 	4000000,
> 	3450000,
> };
> 
> for (i = 0; i < ARRAY_SIZE(dvbc_symbolrate)) {
> 	if (freq_step(channel, this_channellist) / 1.15 > dvbc_symbolrate[i])
> 		next;
> 
> 	/* Scan channel */
> ...
> }
> 

Doesnt look reasonable, since every DVB-C scan would take easily several hours this way.

Sorting into groups makes sense, one per bandwidth, but with the widely used first for each group is better. And still limit to common used srates -> done.


So, it's included now, but i changed the whole stuff a little. 
-- 
GMX DSL Doppel-Flat ab 19,99 Euro/mtl.! Jetzt mit 
gratis Handy-Flat! http://portal.gmx.net/de/go/dsl

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [w_scan PATCH] Add Brazil support on w_scan
  2011-03-29 20:11     ` handygewinnspiel
@ 2011-03-29 23:21       ` Mauro Carvalho Chehab
  2011-03-31 10:45         ` Mauro Carvalho Chehab
  0 siblings, 1 reply; 9+ messages in thread
From: Mauro Carvalho Chehab @ 2011-03-29 23:21 UTC (permalink / raw)
  To: handygewinnspiel; +Cc: linux-media

Em 29-03-2011 17:11, handygewinnspiel@gmx.de escreveu:
>> Em 28-03-2011 14:20, handygewinnspiel@gmx.de escreveu:
>>> Hi Mauro,
>>>
>>>> This patch adds support for both ISDB-T and DVB-C @6MHz used in
>>>> Brazil, and adds a new bit rate of 5.2170 MSymbol/s, found on QAM256
>>>> transmissions at some Brazilian cable operators.
>>>
>>> Good. :)
>>>
>>>> While here, fix compilation with kernels 2.6.39 and later, where the
>>>> old V4L1 API were removed (so, linux/videodev.h doesn't exist anymore).
>>>> This is needed to compile it on Fedora 15 beta.
>>>
>>> videodev.h should have never been in there. Was already reported and
>> will be removed instead.
>>>
>>>> @@ -1985,6 +1986,10 @@
>>>>  		dvbc_symbolrate_min=dvbc_symbolrate_max=0;
>>>>  		break;
>>>>  	case FE_QAM:
>>>> +		// 6MHz DVB-C uses lower symbol rates
>>>> +		if (freq_step(channel, this_channellist) == 6000000) {
>>>> +			dvbc_symbolrate_min=dvbc_symbolrate_max=17;
>>>> +		}
>>>>  		break;
>>>>  	case FE_QPSK:
>>>>  		// channel means here: transponder,
>>>
>>> This one causes me headache, because this one has side-effects to all
>> other DVB-C cases using 6MHz bandwidth.
>>> Are there *any cases* around, where some country may use DVB-C with
>> symbolrates other than 5.217Mbit/s?
>>
>> If you take a look at EN 300 429[1], The DVB-C roll-off factor (alpha) is
>> defined as 0.15.
>>
>> 	[1] EN 300 429 V1.2.1 (1998-04), chapter 9, page 16, and table B.1
>>
>> So, the amount of the needed bandwidth (e. g. the Nyquist cut-off
>> frequency) is given by:
>>   Bw = Symbol_rate * (1 + 0.15)
>>
>> E. g. the maximum symbol rate is given by:
>>
>> 	Symbol_rate(6MHz) = 6000000/1.15 = 5217391.30434782608695652173
>> 	Symbol_rate(7MHz) = 7000000/1.15 = 6086956.52173913043478260869
>> 	Symbol_rate(8MHz) = 8000000/1.15 = 6956521.73913043478260869565
>>
>> As you see, for Countries using 6MHz bandwidth, the maximum value is about
>> 5.127 Mbauds.
>> With the current w_scan logic of assuming 6.9 or 6.875 Mbauds by default
>> for DVB-C, 
>> w_scan will never find any channel, if the channel bandwidth fits into a
>> 6MHz (or 7MHz)
>> channel spacing.
>>
>> So, the above change won't cause regressions, although it could be
>> improved.
> 
> 
> 
> If w_scan assumes that every 6MHz cable network, also outside Brazil, will use it's maximum theoretical symbol
> rate *only* like your patch was implemented, it will probably fail as well, because in practice lower values are used.

True. I suspect, however, that there aren't many Countries using 6MHz for DVB-C. The bandwidth usage
for cable generally follows the analog broadcast standard. There are two standards used for 6MHz
analog: NTSC/M (North/Central America, Japan, Korea) and PAL/M (used only in Brazil and Laos, AFAIK - 
never had the opportunity to talk with anyone from Laos to double check it). The Countries that use 
NTSC generally follow US choice for Digital (Except for Japan: I think ISDB-C is used there).

> 
> Your patch disabled the looping through different symbol rates for any 6MHz network; therefore i was asking.
> 
> So I changed it now to scan any srate for 6MHz networks, but skip over those which are unsupported by bandwidth limitation.

Thanks for appling the fix for Brazil!

I look your implementation. It looks sane, although it will increase a lot
the scanning time. IMO, for now, except if the user uses -e or -S parameters,
I would just seek for 5127 symbol rate, to speed up scanning.

> 
> 
>>
>> IMHO, a different logic could be used instead, if the user doesn't use the
>> -S parameter, like:
>>
>> int dvbc_symbolrate[] = {
>> 	7000000,
>> 	6956500,		/* Max Symbol rate for 8 MHz channel bandwidth */
>> 	6956000,
>> 	6952000,
>> 	6950000,
>> 	6900000,
>> 	6875000,
>> 	6811000,
>> 	6790000,
>> 	6250000,
>> 	6111000,
>>
>> 	/* Weird: I would expect 6086 or 6086.5 here, as the max rate for 7MHz
>> spacing */
>> 			
>> 	5900000,		/* Require at least 7 MHz channel bandwidth */
>> 	5483000,
>> 	5217000,		/* Max Symbol rate for 6 MHz channel bandwidth */
>> 	5156000,
>> 	5000000,
>> 	4000000,
>> 	3450000,
>> };
>>
>> for (i = 0; i < ARRAY_SIZE(dvbc_symbolrate)) {
>> 	if (freq_step(channel, this_channellist) / 1.15 > dvbc_symbolrate[i])
>> 		next;
>>
>> 	/* Scan channel */
>> ...
>> }
>>
> 
> Doesnt look reasonable, since every DVB-C scan would take easily several hours this way.

True. One way to speed up would be to assume that all DVB-C channels have the same symbol rate,
by default (and provide a parameter to override it). Something like:


Probably, the easiest way to do it is:

+static int assume_all_channels_use_same_symbolrate = 1;
...
                if (__tune_to_transponder (frontend_fd, ptest,0) < 0)
                        continue;

+		if ((test.type ==  FE_QAM) && assume_all_channels_use_same_symbolrate) {
+			info("Assuming that all channels use %.04f Msymbols/s symbol rate.\n"
+			     "Use -A parameter to force testing for all symbol rates on all channels\n",
+			     sr_parm/1000000.0);
+			dvbc_symbolrate_min = dvbc_symbolrate_max = sr_parm;
+			assume_all_channels_use_same_symbolrate = 0;
+		}
...
+                switch (opt) {
+               	case 'A':
+				assume_all_channels_use_same_symbolrate = 0;
+				break;

(code untested)

Another optimization for speeding it up for DVB-C would be to have the symbolrate at the external loop.

> 
> Sorting into groups makes sense, one per bandwidth, but with the widely used first for each group is better. And still limit to common used srates -> done.
> 
> 
> So, it's included now, but i changed the whole stuff a little. 


Anyway, I'll test the today's version and reply if I detect any troubles on it.

Thanks!
Mauro


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [w_scan PATCH] Add Brazil support on w_scan
  2011-03-29 23:21       ` Mauro Carvalho Chehab
@ 2011-03-31 10:45         ` Mauro Carvalho Chehab
  2011-03-31 17:15           ` handygewinnspiel
  0 siblings, 1 reply; 9+ messages in thread
From: Mauro Carvalho Chehab @ 2011-03-31 10:45 UTC (permalink / raw)
  To: handygewinnspiel; +Cc: linux-media

Em 29-03-2011 20:21, Mauro Carvalho Chehab escreveu:
> Em 29-03-2011 17:11, handygewinnspiel@gmx.de escreveu:
>> So I changed it now to scan any srate for 6MHz networks, but skip over those which are unsupported by bandwidth limitation.
...
> Anyway, I'll test the today's version and reply if I detect any troubles on it.

Test results:

	$ ./w_scan -c BR -fc 
Took about 30 mins for scan. As the board I'm using doesn't support QAM_AUTO
for DVB-C, it seek only QAM_64. No channels detected.

	$ ./w_scan -c BR -fc -Q1
Took about 30 mins for scan. Channels were properly detected.

	$ ./w_scan -c BR -fc -Q1 -S13
Took about 10 mins for scan. Channels were properly detected.

IMHO, the default, if QAM_AUTO is not supported and -Q parameter is not used,
sould be to test for the most common QAM types, and not for just 64-QAM.
A search at dvb-apps transponders files (upstream + Net Digital Brazil DVB-C freq)
show:

$ grep -l QAM64 /home/v4l/dvb-apps/util/scan/dvb-c/*|wc
     31      31    1087
$ grep -l QAM256 /home/v4l/dvb-apps/util/scan/dvb-c/*|wc
     18      18     859
$ grep -l QAM128 /home/v4l/dvb-apps/util/scan/dvb-c/*|wc
      8       8     249
$ grep QAM /home/v4l/dvb-apps/util/scan/dvb-c/*|cut -d' ' -f 5|sort|uniq -c|sort -n -r
    372 QAM64
    179 QAM256
     72 QAM128

So, starting with QAM64 makes sense, but it makes sense also to test for
QAM256 and QAM128, if QAM_AUTO is not supported.

Cheers,
Mauro

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [w_scan PATCH] Add Brazil support on w_scan
  2011-03-31 10:45         ` Mauro Carvalho Chehab
@ 2011-03-31 17:15           ` handygewinnspiel
  2011-03-31 19:50             ` Mauro Carvalho Chehab
  0 siblings, 1 reply; 9+ messages in thread
From: handygewinnspiel @ 2011-03-31 17:15 UTC (permalink / raw)
  To: Mauro Carvalho Chehab; +Cc: linux-media


> Em 29-03-2011 20:21, Mauro Carvalho Chehab escreveu:
> > Em 29-03-2011 17:11, handygewinnspiel@gmx.de escreveu:
> >> So I changed it now to scan any srate for 6MHz networks, but skip over
> those which are unsupported by bandwidth limitation.
> ...
> > Anyway, I'll test the today's version and reply if I detect any troubles
> on it.
> 
> Test results:
> 
> 	$ ./w_scan -c BR -fc 
> Took about 30 mins for scan. As the board I'm using doesn't support
> QAM_AUTO
> for DVB-C, it seek only QAM_64

This is unexpected && should be fixed to fit to w_scan's default behaviour: first QAM_64, then QAM_256.

Can you pls re-check with the following change in countries.c line 500ff

/*
 * start/stop values for dvbc qam loop
 * 0 == QAM_64, 1 == QAM_256, 2 == QAM_128
 */
int dvbc_qam_max(int channel, int channellist) {
switch(channellist) {
       case DVBC_FI:    return 2; //QAM128
+      case DVBC_BR:
       case DVBC_FR:
       case DVBC_QAM:   return 1; //QAM256
       default:         return 0; //no qam loop
       }
}

    
int dvbc_qam_min(int channel, int channellist) {
switch(channellist) {
       case DVBC_FI:
+      case DVBC_BR:
       case DVBC_FR:
       case DVBC_QAM:   return 0; //QAM64
       default:         return 0; //no qam loop
       }
}

I don't think that adding QAM_128 makes sense. Later, if i have more reports from 6MHz network users, i will reduce the number of symbol rates.
-- 
Empfehlen Sie GMX DSL Ihren Freunden und Bekannten und wir
belohnen Sie mit bis zu 50,- Euro! https://freundschaftswerbung.gmx.de

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [w_scan PATCH] Add Brazil support on w_scan
  2011-03-31 17:15           ` handygewinnspiel
@ 2011-03-31 19:50             ` Mauro Carvalho Chehab
  2011-03-31 19:52               ` Mauro Carvalho Chehab
  0 siblings, 1 reply; 9+ messages in thread
From: Mauro Carvalho Chehab @ 2011-03-31 19:50 UTC (permalink / raw)
  To: handygewinnspiel; +Cc: linux-media

Em 31-03-2011 14:15, handygewinnspiel@gmx.de escreveu:
> 
>> Em 29-03-2011 20:21, Mauro Carvalho Chehab escreveu:
>>> Em 29-03-2011 17:11, handygewinnspiel@gmx.de escreveu:
>>>> So I changed it now to scan any srate for 6MHz networks, but skip over
>> those which are unsupported by bandwidth limitation.
>> ...
>>> Anyway, I'll test the today's version and reply if I detect any troubles
>> on it.
>>
>> Test results:
>>
>> 	$ ./w_scan -c BR -fc 
>> Took about 30 mins for scan. As the board I'm using doesn't support
>> QAM_AUTO
>> for DVB-C, it seek only QAM_64
> 
> This is unexpected && should be fixed to fit to w_scan's default behaviour: first QAM_64, then QAM_256.
> 
> Can you pls re-check with the following change in countries.c line 500ff
> 
> /*
>  * start/stop values for dvbc qam loop
>  * 0 == QAM_64, 1 == QAM_256, 2 == QAM_128
>  */
> int dvbc_qam_max(int channel, int channellist) {
> switch(channellist) {
>        case DVBC_FI:    return 2; //QAM128
> +      case DVBC_BR:
>        case DVBC_FR:
>        case DVBC_QAM:   return 1; //QAM256
>        default:         return 0; //no qam loop
>        }
> }
> 
>     
> int dvbc_qam_min(int channel, int channellist) {
> switch(channellist) {
>        case DVBC_FI:
> +      case DVBC_BR:
>        case DVBC_FR:
>        case DVBC_QAM:   return 0; //QAM64
>        default:         return 0; //no qam loop
>        }
> }
> 
> I don't think that adding QAM_128 makes sense.

Agreed
> Later, if i have more reports from 6MHz network users, i will reduce the number of symbol rates.

Ok.

Worked. Thanks!
Mauro.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [w_scan PATCH] Add Brazil support on w_scan
  2011-03-31 19:50             ` Mauro Carvalho Chehab
@ 2011-03-31 19:52               ` Mauro Carvalho Chehab
  0 siblings, 0 replies; 9+ messages in thread
From: Mauro Carvalho Chehab @ 2011-03-31 19:52 UTC (permalink / raw)
  To: handygewinnspiel; +Cc: linux-media

Em 31-03-2011 16:50, Mauro Carvalho Chehab escreveu:
> Em 31-03-2011 14:15, handygewinnspiel@gmx.de escreveu:
>>
>>> Em 29-03-2011 20:21, Mauro Carvalho Chehab escreveu:
>>>> Em 29-03-2011 17:11, handygewinnspiel@gmx.de escreveu:
>>>>> So I changed it now to scan any srate for 6MHz networks, but skip over
>>> those which are unsupported by bandwidth limitation.
>>> ...
>>>> Anyway, I'll test the today's version and reply if I detect any troubles
>>> on it.
>>>
>>> Test results:
>>>
>>> 	$ ./w_scan -c BR -fc 
>>> Took about 30 mins for scan. As the board I'm using doesn't support
>>> QAM_AUTO
>>> for DVB-C, it seek only QAM_64
>>
>> This is unexpected && should be fixed to fit to w_scan's default behaviour: first QAM_64, then QAM_256.
>>
>> Can you pls re-check with the following change in countries.c line 500ff
>>
>> /*
>>  * start/stop values for dvbc qam loop
>>  * 0 == QAM_64, 1 == QAM_256, 2 == QAM_128
>>  */
>> int dvbc_qam_max(int channel, int channellist) {
>> switch(channellist) {
>>        case DVBC_FI:    return 2; //QAM128
>> +      case DVBC_BR:
>>        case DVBC_FR:
>>        case DVBC_QAM:   return 1; //QAM256
>>        default:         return 0; //no qam loop
>>        }
>> }
>>
>>     
>> int dvbc_qam_min(int channel, int channellist) {
>> switch(channellist) {
>>        case DVBC_FI:
>> +      case DVBC_BR:
>>        case DVBC_FR:
>>        case DVBC_QAM:   return 0; //QAM64
>>        default:         return 0; //no qam loop
>>        }
>> }

Forgot to comment: the above fixed w_scan probe with default parameters.

Thanks!
Mauro

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2011-03-31 19:52 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-03-28 14:29 [w_scan PATCH] Add Brazil support on w_scan Mauro Carvalho Chehab
2011-03-28 17:20 ` handygewinnspiel
2011-03-28 18:46   ` Mauro Carvalho Chehab
2011-03-29 20:11     ` handygewinnspiel
2011-03-29 23:21       ` Mauro Carvalho Chehab
2011-03-31 10:45         ` Mauro Carvalho Chehab
2011-03-31 17:15           ` handygewinnspiel
2011-03-31 19:50             ` Mauro Carvalho Chehab
2011-03-31 19:52               ` Mauro Carvalho Chehab

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox