summaryrefslogtreecommitdiff
path: root/libavcodec/vorbis_enc.c
diff options
context:
space:
mode:
authorOded Shimon <ods15@ods15.dyndns.org>2006-10-02 06:08:11 +0000
committerOded Shimon <ods15@ods15.dyndns.org>2006-10-02 06:08:11 +0000
commite3df7fc64c1cbadc9462b7dd8adaf811070d3086 (patch)
tree478e3f2b14f80ed4fa0751501cfccf00985592d4 /libavcodec/vorbis_enc.c
parent9d74ff0e55114a5b811fe31fe1f1d9ff4f2c3afa (diff)
Original Commit: r71 | ods15 | 2006-09-28 21:00:24 +0300 (Thu, 28 Sep 2006) | 2 lines
residue type 2 Originally committed as revision 6476 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec/vorbis_enc.c')
-rw-r--r--libavcodec/vorbis_enc.c17
1 files changed, 16 insertions, 1 deletions
diff --git a/libavcodec/vorbis_enc.c b/libavcodec/vorbis_enc.c
index 53fb848f37..2366840d56 100644
--- a/libavcodec/vorbis_enc.c
+++ b/libavcodec/vorbis_enc.c
@@ -807,6 +807,9 @@ static void residue_encode(venc_context_t * venc, residue_t * rc, PutBitContext
int partitions = (rc->end - rc->begin) / psize;
int classes[channels][partitions];
int classwords = venc->codebooks[rc->classbook].ndimentions;
+ int real_ch = channels;
+
+ if (rc->type == 2) channels = 1;
for (pass = 0; pass < 8; pass++) {
p = 0;
@@ -827,14 +830,26 @@ static void residue_encode(venc_context_t * venc, residue_t * rc, PutBitContext
float * buf = coeffs + samples*j + rc->begin + p*psize;
if (nbook == -1) continue;
- assert(rc->type == 0);
+ assert(rc->type == 0 || rc->type == 2);
assert(!(psize % book->ndimentions));
+ if (rc->type == 0) {
for (k = 0; k < psize; k += book->ndimentions) {
float * a = put_vector(book, pb, &buf[k]);
int l;
for (l = 0; l < book->ndimentions; l++) buf[k + l] -= a[l];
}
+ } else {
+ for (k = 0; k < psize; k += book->ndimentions) {
+ int dim = book->ndimentions, s = rc->begin + p * psize, l;
+ float vec[dim], * pvec = vec, * a;
+ for (l = s + k; l < s + k + dim; l++)
+ *pvec++ = coeffs[(l % real_ch) * samples + l / real_ch];
+ a = put_vector(book, pb, vec);
+ for (l = s + k; l < s + k + dim; l++)
+ coeffs[(l % real_ch) * samples + l / real_ch] -= *a++;
+ }
+ }
}
}
}