Update of /cvsroot/dvbtools/dvbstream
In directory sc8-pr-cvs12.sourceforge.net:/tmp/cvs-serv12256
Modified Files:
dvbstream.c
Log Message:
redefined SI_PIDS as a 8192 bits bitmap: it's smaller and has much higher chances to fit in the cache of the cpu; added setbit(), getbit() and clearbits() macros
Index: dvbstream.c
===================================================================
RCS file: /cvsroot/dvbtools/dvbstream/dvbstream.c,v
retrieving revision 1.43
retrieving revision 1.44
diff -C2 -d -r1.43 -r1.44
*** dvbstream.c 17 Mar 2007 00:45:37 -0000 1.43
--- dvbstream.c 17 Mar 2007 10:36:17 -0000 1.44
***************
*** 451,455 ****
} PMT;
! static unsigned char SI_PIDS[8192];
static int collect_section(section_t *section, int pusi, unsigned char *buf, unsigned int len)
--- 451,461 ----
} PMT;
! typedef unsigned int PID_BIT_MAP[1024];
!
! #define getbit(buf, pid) (buf[(pid)/8] & (1 << ((pid) % 8)))
! #define setbit(buf, pid) buf[(pid)/8] |= (1 << ((pid) % 8))
! #define clearbits(buf) memset(buf, 0, sizeof(PID_BIT_MAP))
!
! static PID_BIT_MAP SI_PIDS;
static int collect_section(section_t *section, int pusi, unsigned char *buf, unsigned int len)
***************
*** 502,507 ****
return 1;
! memset(&SI_PIDS, 0, sizeof(SI_PIDS));
! SI_PIDS[0] = 1;
seclen = ((buf[1] & 0x0F) << 8) | buf[2];
num = (seclen - 9) / 4;
--- 508,513 ----
return 1;
! clearbits(SI_PIDS);
! setbit(SI_PIDS, 0);
seclen = ((buf[1] & 0x0F) << 8) | buf[2];
num = (seclen - 9) / 4;
***************
*** 521,525 ****
PAT.entries[j].program = (buf[i] << 8) | buf[i+1];
PAT.entries[j].pmt_pid = ((buf[i+2] & 0x1F) << 8) | buf[i+3];
! SI_PIDS[PAT.entries[j].pmt_pid] = 1;
i += 4;
//fprintf(stderr, "PROGRAM: %d, pmt_pid: %d\n", PAT.entries[j].program, PAT.entries[j].pmt_pid);
--- 527,531 ----
PAT.entries[j].program = (buf[i] << 8) | buf[i+1];
PAT.entries[j].pmt_pid = ((buf[i+2] & 0x1F) << 8) | buf[i+3];
! setbit(SI_PIDS, PAT.entries[j].pmt_pid);
i += 4;
//fprintf(stderr, "PROGRAM: %d, pmt_pid: %d\n", PAT.entries[j].program, PAT.entries[j].pmt_pid);
***************
*** 659,664 ****
PAT.section.pos = SECTION_LEN+1;
memset(&PMT, 0, sizeof(PMT));
! memset(&SI_PIDS, 0, sizeof(SI_PIDS));
! SI_PIDS[0] = 1;
/* Set default IP and port */
--- 665,670 ----
PAT.section.pos = SECTION_LEN+1;
memset(&PMT, 0, sizeof(PMT));
! clearbits(SI_PIDS);
! setbit(SI_PIDS, 0);
/* Set default IP and port */
|