aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLoren Merritt <lorenm@u.washington.edu>2007-03-30 19:16:41 +0000
committerLoren Merritt <lorenm@u.washington.edu>2007-03-30 19:16:41 +0000
commite62b3dd210f19c337fc541758079fceeadabc208 (patch)
tree7cad93e1c9577e35458a99410686ebb9d177de76
parent5900637219ccccdd39ddafa4e7181da20b8e1f1b (diff)
downloadffmpeg-e62b3dd210f19c337fc541758079fceeadabc208.tar.gz
move some stuff out of an inner loop. 12% faster svq1 encoding.
Originally committed as revision 8560 to svn://svn.ffmpeg.org/ffmpeg/trunk
-rw-r--r--libavcodec/svq1.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/libavcodec/svq1.c b/libavcodec/svq1.c
index 9337dc1897..5087ba8cc9 100644
--- a/libavcodec/svq1.c
+++ b/libavcodec/svq1.c
@@ -992,17 +992,16 @@ static int encode_block(SVQ1Context *s, uint8_t *src, uint8_t *ref, uint8_t *dec
for(i=0; i<16; i++){
int sum= codebook_sum[stage*16 + i];
- int sqr, diff, mean, score;
+ int sqr, diff, score;
vector = codebook + stage*size*16 + i*size;
sqr = s->dsp.ssd_int8_vs_int16(vector, block[stage], size);
diff= block_sum[stage] - sum;
- mean= (diff + (size>>1)) >> (level+3);
- assert(mean >-300 && mean<300);
- if(intra) mean= av_clip(mean, 0, 255);
- else mean= av_clip(mean, -256, 255);
score= sqr - ((diff*(int64_t)diff)>>(level+3)); //FIXME 64bit slooow
if(score < best_vector_score){
+ int mean= (diff + (size>>1)) >> (level+3);
+ assert(mean >-300 && mean<300);
+ mean= av_clip(mean, intra?0:-256, 255);
best_vector_score= score;
best_vector[stage]= i;
best_vector_sum= sum;