comparison dsputil.c @ 1201:e0fc95a6eb4e libavcodec

fixed static init
author bellard
date Sun, 20 Apr 2003 16:16:52 +0000
parents 5af9aeadbdc3
children e8c3884f2c7e
comparison
equal deleted inserted replaced
1200:b448d7c17215 1201:e0fc95a6eb4e
2487 { 2487 {
2488 j_rev_dct (block); 2488 j_rev_dct (block);
2489 add_pixels_clamped_c(block, dest, line_size); 2489 add_pixels_clamped_c(block, dest, line_size);
2490 } 2490 }
2491 2491
2492 /* init static data */
2493 void dsputil_static_init(void)
2494 {
2495 int i;
2496
2497 for(i=0;i<256;i++) cropTbl[i + MAX_NEG_CROP] = i;
2498 for(i=0;i<MAX_NEG_CROP;i++) {
2499 cropTbl[i] = 0;
2500 cropTbl[i + MAX_NEG_CROP + 256] = 255;
2501 }
2502
2503 for(i=0;i<512;i++) {
2504 squareTbl[i] = (i - 256) * (i - 256);
2505 }
2506
2507 for(i=0; i<64; i++) inv_zigzag_direct16[ff_zigzag_direct[i]]= i+1;
2508 }
2509
2510
2492 void dsputil_init(DSPContext* c, AVCodecContext *avctx) 2511 void dsputil_init(DSPContext* c, AVCodecContext *avctx)
2493 { 2512 {
2494 static int init_done = 0;
2495 int i; 2513 int i;
2496
2497 if (!init_done) {
2498 for(i=0;i<256;i++) cropTbl[i + MAX_NEG_CROP] = i;
2499 for(i=0;i<MAX_NEG_CROP;i++) {
2500 cropTbl[i] = 0;
2501 cropTbl[i + MAX_NEG_CROP + 256] = 255;
2502 }
2503
2504 for(i=0;i<512;i++) {
2505 squareTbl[i] = (i - 256) * (i - 256);
2506 }
2507
2508 for(i=0; i<64; i++) inv_zigzag_direct16[ff_zigzag_direct[i]]= i+1;
2509
2510 init_done = 1;
2511 }
2512 2514
2513 #ifdef CONFIG_ENCODERS 2515 #ifdef CONFIG_ENCODERS
2514 if(avctx->dct_algo==FF_DCT_FASTINT) 2516 if(avctx->dct_algo==FF_DCT_FASTINT)
2515 c->fdct = fdct_ifast; 2517 c->fdct = fdct_ifast;
2516 else 2518 else