VDR-1.3.41: speedup for cVideoRepacker

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

 



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



[Index of Archives]     [Linux Media]     [Asterisk]     [DCCP]     [Netdev]     [Xorg]     [Util Linux NG]     [Xfree86]     [Big List of Linux Books]     [Fedora Users]     [Fedora Women]     [ALSA Devel]     [Linux USB]

  Powered by Linux