[vdr] VDR-1.3.41: speedup for cVideoRepacker
Jon Burgess
jburgess at uklinux.net
Tue Jan 31 23:13:25 CET 2006
Reinhard Nissl wrote:
> +bool cVideoRepacker::ScanDataForStartCodeFast(const uchar *&Data, const uchar *Limit)
> +{
> + Limit--;
> +
> + while (Data < Limit) {
> + if (*Data > 0x01)
> + Data += 3;
> + else if (*Data == 0x00)
> + Data++;
> + else if (Data[-2] != 0x00 || Data[-1] != 0x00)
> + Data += 3;
> + else {
> + scanner = 0x00000100 | *++Data;
> + return true;
> + }
> + }
Did you consider using memchr()? e.g. something like
...
while (Data < Limit) {
Data = memchr(Data, 0x01, Limit - Data);
if (Data == NULL)
break;
if (Data[-2] != 0x00 || Data[-1] != 0x00)
Data += 3;
...
It makes no noticeable difference on my AMD64 machine (<1%), but maybe
it is worth trying on your EPIA?
Jon
More information about the vdr
mailing list