[SCM] libav/experimental: Original Commit: r58 | ods15 | 2006-09-24 17:35:28 +0300 (Sun, 24 Sep 2006) | 2 lines

siretart at users.alioth.debian.org siretart at users.alioth.debian.org
Sun Jun 30 15:51:29 UTC 2013


The following commit has been merged in the experimental branch:
commit 8a202cb3a73cbc816a414974e21c5ac7ce0bb3e6
Author: Oded Shimon <ods15 at ods15.dyndns.org>
Date:   Mon Oct 2 06:07:42 2006 +0000

    Original Commit: r58 | ods15 | 2006-09-24 17:35:28 +0300 (Sun, 24 Sep 2006) | 2 lines
    
    add ability to use codebook dimentions in residue
    
    Originally committed as revision 6463 to svn://svn.ffmpeg.org/ffmpeg/trunk

diff --git a/libavcodec/vorbis_enc.c b/libavcodec/vorbis_enc.c
index adbebc0..ca0d595 100644
--- a/libavcodec/vorbis_enc.c
+++ b/libavcodec/vorbis_enc.c
@@ -667,21 +667,25 @@ static int window(venc_context_t * venc, signed short * audio, int samples) {
     return 1;
 }
 
-static float put_vector(codebook_t * book, PutBitContext * pb, float num) {
+static float * put_vector(codebook_t * book, PutBitContext * pb, float * num) {
     int i;
     int entry = -1;
     float distance = 0;
     assert(book->dimentions);
-    assert(book->ndimentions == 1);
     for (i = 0; i < book->nentries; i++) {
-        float d = (book->dimentions[i] - num)*(book->dimentions[i] - num);
+        float d = 0.;
+        int j;
+        for (j = 0; j < book->ndimentions; j++) {
+            float a = (book->dimentions[i * book->ndimentions + j] - num[j]);
+            d += a*a;
+        }
         if (entry == -1 || distance > d) {
             entry = i;
             distance = d;
         }
     }
     put_bits(pb, book->entries[entry].len, book->entries[entry].codeword);
-    return book->dimentions[entry];
+    return &book->dimentions[entry * book->ndimentions];
 }
 
 static void residue_encode(venc_context_t * venc, residue_t * rc, PutBitContext * pb, float * coeffs, int samples, int channels) {
@@ -711,10 +715,12 @@ static void residue_encode(venc_context_t * venc, residue_t * rc, PutBitContext
                     if (nbook == -1) continue;
 
                     assert(rc->type == 0);
-                    assert(book->ndimentions == 1);
+                    assert(!(psize % book->ndimentions));
 
-                    for (k = 0; k < psize; k++) {
-                        buf[k] -= put_vector(book, pb, buf[k]);
+                    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];
                     }
                 }
             }

-- 
Libav/FFmpeg packaging



More information about the pkg-multimedia-commits mailing list