Re[2]: [XviD-devel] Quality optimization

Christoph Lampert xvid-devel@xvid.org
Thu, 23 Jan 2003 14:16:51 +0100 (CET)


On Thu, 23 Jan 2003, Radek Czyz wrote:

> Hi,
> 
> > [...] or by adding better
> > prefetch. We're not doing streaming dot product, we know in advance
> > what memory locations we'll most likely need for the next block.
> 
> I'm only guessing what prefetch is.
> Would it be possible to write a macro, in inline assembler (defined in
> portab.h as needed) looking like this
> 
> PREFETCH(void *);
> 
> which would perform the prefetch?

Yes. MMX has an instruction for that, other CPU ASMs might as well. 
If not, prefetch using C is possible, too. There are also other basic
operations which always should be tried before immediately going to ASM:  

http://cdrom.amd.com/devconn/events/gdc_2002_amd.pdf

> Compiler cannnot know in advance that, for example, a SAD will use the
> memory locations it's using. By doing some prefetch's before calling
> SAD, the time spent for calling the function could be used to catch
> the function's data.
>
> Sometimes it would be possible to do that in a big advance. For
> example, we could prefetch chroma data when ChromaME is on, before the
> luma SAD is called... correct me if Im talking nonsense...

> 
> Nice tool for experiments.
>
> What do you think? Is it possible at all?

Yes, and any time-critical software should do it. 

gruel