X-Git-Url: http://git.asbjorn.biz/?p=swftools.git;a=blobdiff_plain;f=lib%2Fbladeenc%2Fcommon.c;fp=lib%2Fbladeenc%2Fcommon.c;h=0ffddc2cbca616068f7e9c5c2d3f2bfb560f0e8b;hp=0000000000000000000000000000000000000000;hb=5a762d689ec34ff8320b37cc1945985d9a0a12b2;hpb=22a49dfc00af6fc1b43057b44790f2087a09b6f2 diff --git a/lib/bladeenc/common.c b/lib/bladeenc/common.c new file mode 100644 index 0000000..0ffddc2 --- /dev/null +++ b/lib/bladeenc/common.c @@ -0,0 +1,105 @@ +/* + (c) Copyright 1998-2000 - Tord Jansson + ====================================== + + This file is part of the BladeEnc MP3 Encoder, based on + ISO's reference code for MPEG Layer 3 compression, and might + contain smaller or larger sections that are directly taken + from ISO's reference code. + + All changes to the ISO reference code herein are either + copyrighted by Tord Jansson (tord.jansson@swipnet.se) + or sublicensed to Tord Jansson by a third party. + + BladeEnc is free software; you can redistribute this file + and/or modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + + + ------------ Changes ------------ + + 2000-11-22 Andre Piotrowski + + - bug fix: mem_alloc() - no lomger a need to allocate block*2 bytes +*/ + +/*********************************************************************** +* +* Global Include Files +* +***********************************************************************/ + +#include /* 1995-07-11 shn */ +#include +#include + +#include "common.h" + + + + + +/*********************************************************************** +* +* Global Variable Definitions +* +***********************************************************************/ + +/* 1: MPEG-1, 0: MPEG-2 LSF, 1995-07-11 shn */ +double s_freq[2][4] = +{ + {22.05, 24, 16, 0}, + {44.1 , 48, 32, 0} +}; + +/* 1: MPEG-1, 0: MPEG-2 LSF, 1995-07-11 shn */ +int bitratex[2][15] = +{ + { 0, 8, 16, 24, 32, 40, 48, 56, 64, 80, 96,112,128,144,160}, + { 0, 32, 40, 48, 56, 64, 80, 96,112,128,160,192,224,256,320} +}; + + + + + +/******************************************************************************* +* +* Allocate number of bytes of memory equal to "block". +* +*******************************************************************************/ + +void *mem_alloc (unsigned int block, char *item) +{ + void *ptr; + + ptr = (void *) malloc (block); + + memset (ptr, 0, block); + + return ptr; +} + + + + + +/**************************************************************************** +* +* Free memory pointed to by "*ptr_addr". +* +*****************************************************************************/ + +void mem_free (void **ptr_addr) +{ + if (*ptr_addr != NULL) + { + free (*ptr_addr); + *ptr_addr = NULL; + } +} + + +