Commit ac0057f3 authored by Oded Shimon's avatar Oded Shimon

Original Commit: r108 | ods15 | 2006-10-01 18:46:06 +0200 (Sun, 01 Oct 2006) | 2 lines

prevent division/modulo

Originally committed as revision 6512 to svn://svn.ffmpeg.org/ffmpeg/trunk
parent 0c4630f2
...@@ -1292,14 +1292,22 @@ static void residue_encode(venc_context_t * venc, residue_t * rc, PutBitContext ...@@ -1292,14 +1292,22 @@ static void residue_encode(venc_context_t * venc, residue_t * rc, PutBitContext
for (l = 0; l < book->ndimentions; l++) buf[k + l] -= a[l]; for (l = 0; l < book->ndimentions; l++) buf[k + l] -= a[l];
} }
} else { } else {
int s = rc->begin + p * psize, a1, b1;
a1 = (s % real_ch) * samples;
b1 = s / real_ch;
s = real_ch * samples;
for (k = 0; k < psize; k += book->ndimentions) { for (k = 0; k < psize; k += book->ndimentions) {
int dim = book->ndimentions, s = rc->begin + p * psize + k, l; int dim, a2 = a1, b2 = b1;
float vec[dim], * a = vec; float vec[book->ndimentions], * pv = vec;
for (l = s; l < s + dim; l++) for (dim = book->ndimentions; dim--; ) {
*a++ = coeffs[(l % real_ch) * samples + l / real_ch]; *pv++ = coeffs[a2 + b2];
a = put_vector(book, pb, vec); if ((a2 += samples) == s) { a2=0; b2++; }
for (l = s; l < s + dim; l++) }
coeffs[(l % real_ch) * samples + l / real_ch] -= *a++; pv = put_vector(book, pb, vec);
for (dim = book->ndimentions; dim--; ) {
coeffs[a1 + b1] -= *pv++;
if ((a1 += samples) == s) { a1=0; b1++; }
}
} }
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment