[XviD-devel] 10% speedup in decoder

Christoph Lampert xvid-devel@xvid.org
Wed, 25 Dec 2002 15:22:58 +0100 (CET)


On Wed, 25 Dec 2002, Jim Hauxwell wrote:

> Hi,
> 
> I've been doing some profiling with Rational Quantify to see what needs
> doing whilst I'm off work.
> 
> Anyway, the first thing I have found is in decoder.c
> 
> 			case MODE_DIRECT_NONE_MV:
> 				{
> 					const int64_t TRB = dec->time_pp - dec->time_bp, TRD = dec->time_pp;
> 					int i;
> 
> If you change the type from int64_t to int32_t you get a 10% speedup, as the
> 64bit types are not being emulated.
> 
> I have tried with a few test sequences and all seems OK, as well as a read
> through looks like it shouldn't overflow/underflow with this reduced data
> type.  The encoder uses 32bit representation for TRB so I think its safe to
> change.

The reference code uses 64bit, I guess that's why it's in the decoder. 
The timestamps themselves are unsigned 16bit (and really use that range if
you have non-integer FPS), so for operations on them (including
multiplication) 32 should be sufficient, agreed. But I'm not sure about
signs, maybe 33 bits can occur. I'll check when I find time... 

gruel