in lib/blockmap.c,v 1.5 2003/12/03 func CreateMapping, inner loop code: if ( i<2 ){ MB = ( j<2 ? 0 : 1 ); }else{ MB = ( j<2 ? 2 : 3 ); } if ( i%2 ){ B = ( j%2 ? 3 : 2 ); }else{ B = ( j%2 ? 1 : 0 ); } wouldn't this do better: MB = (i >> 1) * 2 + (j >> 1); B = (i % 2) * 2 + j % 2; ? P.S.: I believe it could be optimized even further, but... <p>--- >8 ---- List archives: http://www.xiph.org/archives/ Ogg project homepage: http://www.xiph.org/ogg/ To unsubscribe from this list, send a message to 'theora-dev-request@xiph.org' containing only the word 'unsubscribe' in the body. No subject is needed. Unsubscribe messages sent to the list will be ignored/filtered.
> in lib/blockmap.c,v 1.5 2003/12/03 > func CreateMapping, inner loop code: > if ( i<2 ){ > MB = ( j<2 ? 0 : 1 ); > }else{ > MB = ( j<2 ? 2 : 3 ); > } > > > if ( i%2 ){ > B = ( j%2 ? 3 : 2 ); > }else{ > B = ( j%2 ? 1 : 0 ); > } > wouldn't this do better: > MB = (i >> 1) * 2 + (j >> 1); > B = (i % 2) * 2 + j % 2; > ? > > > P.S.: I believe it could be optimized even further, but...For that line: MB = (i >>1) *2 + (j >> 1); It should be noted that the following are equivalent: i*2; i << 1; So, you can simplify the first term with a bitwise mask: MB = (i & ~1) + (j >>1); Considering that ~1 is a constant (data size dependent), the compiler should reduce that term to one operation. Likewise, that second line could read: B = ((i & 1) << 1) + j & 1; taking advantage of what should be lower computational overhead for bitwise operators than integer arithmetic (especially multiplication). This is all assuming that these are unsigned integers, or at least never negative. Sean --- >8 ---- List archives: http://www.xiph.org/archives/ Ogg project homepage: http://www.xiph.org/ogg/ To unsubscribe from this list, send a message to 'theora-dev-request@xiph.org' containing only the word 'unsubscribe' in the body. No subject is needed. Unsubscribe messages sent to the list will be ignored/filtered.
Much of the indexing in the current libtheora is grossly inefficient. However, it contributes only a minor amount to the total decoding time. You could probably do better to spend your time optimizing something else. That said, I think the experimental decoder I wrote in /experimental/derf/theora-exp is probably a better base to start applying optimizations to. Assuming I get a couple of hours to track down that motion vector problem, that is. It gave me as much as 10% speed improvements (though I was just talking with someone who said it was much slower with gcc3.3... we still haven't debugged why). --- >8 ---- List archives: http://www.xiph.org/archives/ Ogg project homepage: http://www.xiph.org/ogg/ To unsubscribe from this list, send a message to 'theora-dev-request@xiph.org' containing only the word 'unsubscribe' in the body. No subject is needed. Unsubscribe messages sent to the list will be ignored/filtered.