changeset 3897:11caa885c449 libavcodec

Original Commit: r98 | ods15 | 2006-10-01 10:15:33 +0200 (Sun, 01 Oct 2006) | 2 lines switch to int8_t for residue codebook numbers, use memcpy in residue init
author ods15
date Mon, 02 Oct 2006 06:09:12 +0000
parents 46ab70354691
children c8b9218c3458
files vorbis_enc.c
diffstat 1 files changed, 5 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/vorbis_enc.c	Mon Oct 02 06:09:10 2006 +0000
+++ b/vorbis_enc.c	Mon Oct 02 06:09:12 2006 +0000
@@ -81,7 +81,7 @@
     int partition_size;
     int classifications;
     int classbook;
-    int (*books)[8];
+    int8_t (*books)[8];
     float (*maxes)[2];
 } residue_t;
 
@@ -466,9 +466,9 @@
     rc->partition_size = 32;
     rc->classifications = 10;
     rc->classbook = 15;
-    rc->books = av_malloc(sizeof(int[8]) * rc->classifications);
-    for (i = 0; i < rc->classifications; i++) {
-        int a[10][8] = {
+    rc->books = av_malloc(sizeof(*rc->books) * rc->classifications);
+    {
+        static const int8_t a[10][8] = {
             { -1, -1, -1, -1, -1, -1, -1, -1, },
             { -1, -1, 16, -1, -1, -1, -1, -1, },
             { -1, -1, 17, -1, -1, -1, -1, -1, },
@@ -480,8 +480,7 @@
             { 24, 25, -1, -1, -1, -1, -1, -1, },
             { 26, 27, 28, -1, -1, -1, -1, -1, },
         };
-        int j;
-        for (j = 0; j < 8; j++) rc->books[i][j] = a[i][j];
+        memcpy(rc->books, a, sizeof a);
     }
     ready_residue(rc, venc);