changeset 860:a5f228481000 libavcodec

* init table once
author kabi
date Tue, 12 Nov 2002 10:01:27 +0000
parents 9512471dec40
children 243cc33da3eb
files dsputil.c
diffstat 1 files changed, 11 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/dsputil.c	Tue Nov 12 09:47:14 2002 +0000
+++ b/dsputil.c	Tue Nov 12 10:01:27 2002 +0000
@@ -1344,16 +1344,20 @@
 
 void dsputil_init(DSPContext* c, unsigned mask)
 {
+    static int init_done = 0;
     int i;
 
-    for(i=0;i<256;i++) cropTbl[i + MAX_NEG_CROP] = i;
-    for(i=0;i<MAX_NEG_CROP;i++) {
-        cropTbl[i] = 0;
-        cropTbl[i + MAX_NEG_CROP + 256] = 255;
-    }
+    if (!init_done) {
+	for(i=0;i<256;i++) cropTbl[i + MAX_NEG_CROP] = i;
+	for(i=0;i<MAX_NEG_CROP;i++) {
+	    cropTbl[i] = 0;
+	    cropTbl[i + MAX_NEG_CROP + 256] = 255;
+	}
 
-    for(i=0;i<512;i++) {
-        squareTbl[i] = (i - 256) * (i - 256);
+	for(i=0;i<512;i++) {
+	    squareTbl[i] = (i - 256) * (i - 256);
+	}
+        init_done = 1;
     }
 
     c->get_pixels = get_pixels_c;