[xiph-commits] r11689 - trunk/speex/libspeex
jm at svn.xiph.org
jm at svn.xiph.org
Mon Jul 3 03:15:37 PDT 2006
Author: jm
Date: 2006-07-03 03:15:26 -0700 (Mon, 03 Jul 2006)
New Revision: 11689
Modified:
trunk/speex/libspeex/nb_celp.c
trunk/speex/libspeex/nb_celp.h
trunk/speex/libspeex/sb_celp.c
trunk/speex/libspeex/sb_celp.h
Log:
changed a few parameter definitions from int to spx_int32_t. Should by more
16-bit friendly.
Modified: trunk/speex/libspeex/nb_celp.c
===================================================================
--- trunk/speex/libspeex/nb_celp.c 2006-07-02 18:29:54 UTC (rev 11688)
+++ trunk/speex/libspeex/nb_celp.c 2006-07-03 10:15:26 UTC (rev 11689)
@@ -1795,12 +1795,14 @@
(*(int*)ptr) = st->dtx_enabled;
break;
case SPEEX_SET_ABR:
- st->abr_enabled = (*(int*)ptr);
- st->vbr_enabled = 1;
+ st->abr_enabled = (*(spx_int32_t*)ptr);
+ st->vbr_enabled = st->abr_enabled!=0;
+ if (st->vbr_enabled)
{
- int i=10, rate, target;
+ int i=10;
+ spx_int32_t rate, target;
float vbr_qual;
- target = (*(int*)ptr);
+ target = (*(spx_int32_t*)ptr);
while (i>=0)
{
speex_encoder_ctl(st, SPEEX_SET_QUALITY, &i);
@@ -1820,7 +1822,7 @@
break;
case SPEEX_GET_ABR:
- (*(int*)ptr) = st->abr_enabled;
+ (*(spx_int32_t*)ptr) = st->abr_enabled;
break;
case SPEEX_SET_VBR_QUALITY:
st->vbr_quality = (*(float*)ptr);
@@ -1863,15 +1865,15 @@
break;
case SPEEX_GET_BITRATE:
if (st->submodes[st->submodeID])
- (*(int*)ptr) = st->sampling_rate*SUBMODE(bits_per_frame)/st->frameSize;
+ (*(spx_int32_t*)ptr) = st->sampling_rate*SUBMODE(bits_per_frame)/st->frameSize;
else
- (*(int*)ptr) = st->sampling_rate*(NB_SUBMODE_BITS+1)/st->frameSize;
+ (*(spx_int32_t*)ptr) = st->sampling_rate*(NB_SUBMODE_BITS+1)/st->frameSize;
break;
case SPEEX_SET_SAMPLING_RATE:
- st->sampling_rate = (*(int*)ptr);
+ st->sampling_rate = (*(spx_int32_t*)ptr);
break;
case SPEEX_GET_SAMPLING_RATE:
- (*(int*)ptr)=st->sampling_rate;
+ (*(spx_int32_t*)ptr)=st->sampling_rate;
break;
case SPEEX_RESET_STATE:
{
@@ -1968,15 +1970,15 @@
break;
case SPEEX_GET_BITRATE:
if (st->submodes[st->submodeID])
- (*(int*)ptr) = st->sampling_rate*SUBMODE(bits_per_frame)/st->frameSize;
+ (*(spx_int32_t*)ptr) = st->sampling_rate*SUBMODE(bits_per_frame)/st->frameSize;
else
- (*(int*)ptr) = st->sampling_rate*(NB_SUBMODE_BITS+1)/st->frameSize;
+ (*(spx_int32_t*)ptr) = st->sampling_rate*(NB_SUBMODE_BITS+1)/st->frameSize;
break;
case SPEEX_SET_SAMPLING_RATE:
- st->sampling_rate = (*(int*)ptr);
+ st->sampling_rate = (*(spx_int32_t*)ptr);
break;
case SPEEX_GET_SAMPLING_RATE:
- (*(int*)ptr)=st->sampling_rate;
+ (*(spx_int32_t*)ptr)=st->sampling_rate;
break;
case SPEEX_SET_HANDLER:
{
Modified: trunk/speex/libspeex/nb_celp.h
===================================================================
--- trunk/speex/libspeex/nb_celp.h 2006-07-02 18:29:54 UTC (rev 11688)
+++ trunk/speex/libspeex/nb_celp.h 2006-07-03 10:15:26 UTC (rev 11689)
@@ -110,7 +110,7 @@
float abr_drift2;
float abr_count;
int complexity; /**< Complexity setting (0-10 from least complex to most complex) */
- int sampling_rate;
+ spx_int32_t sampling_rate;
int plc_tuning;
int encode_submode;
const SpeexSubmode * const *submodes; /**< Sub-mode data */
@@ -129,7 +129,7 @@
int lpcSize; /**< LPC order */
int min_pitch; /**< Minimum pitch value allowed */
int max_pitch; /**< Maximum pitch value allowed */
- int sampling_rate;
+ spx_int32_t sampling_rate;
#ifdef EPIC_48K
int lbr_48k;
Modified: trunk/speex/libspeex/sb_celp.c
===================================================================
--- trunk/speex/libspeex/sb_celp.c 2006-07-02 18:29:54 UTC (rev 11688)
+++ trunk/speex/libspeex/sb_celp.c 2006-07-03 10:15:26 UTC (rev 11689)
@@ -1300,13 +1300,14 @@
(*(float*)ptr) = st->vbr_quality;
break;
case SPEEX_SET_ABR:
- st->abr_enabled = (*(int*)ptr);
- st->vbr_enabled = 1;
+ st->abr_enabled = (*(spx_int32_t*)ptr);
+ st->vbr_enabled = st->abr_enabled!=0;
speex_encoder_ctl(st->st_low, SPEEX_SET_VBR, &st->vbr_enabled);
+ if (st->vbr_enabled)
{
int i=10, rate, target;
float vbr_qual;
- target = (*(int*)ptr);
+ target = (*(spx_int32_t*)ptr);
while (i>=0)
{
speex_encoder_ctl(st, SPEEX_SET_QUALITY, &i);
@@ -1326,7 +1327,7 @@
break;
case SPEEX_GET_ABR:
- (*(int*)ptr) = st->abr_enabled;
+ (*(spx_int32_t*)ptr) = st->abr_enabled;
break;
case SPEEX_SET_QUALITY:
{
@@ -1354,7 +1355,7 @@
{
int i=10;
spx_int32_t rate, target;
- target = (*(int*)ptr);
+ target = (*(spx_int32_t*)ptr);
while (i>=0)
{
speex_encoder_ctl(st, SPEEX_SET_QUALITY, &i);
@@ -1369,21 +1370,21 @@
speex_encoder_ctl(st->st_low, request, ptr);
/*fprintf (stderr, "before: %d\n", (*(int*)ptr));*/
if (st->submodes[st->submodeID])
- (*(int*)ptr) += st->sampling_rate*SUBMODE(bits_per_frame)/st->full_frame_size;
+ (*(spx_int32_t*)ptr) += st->sampling_rate*SUBMODE(bits_per_frame)/st->full_frame_size;
else
- (*(int*)ptr) += st->sampling_rate*(SB_SUBMODE_BITS+1)/st->full_frame_size;
+ (*(spx_int32_t*)ptr) += st->sampling_rate*(SB_SUBMODE_BITS+1)/st->full_frame_size;
/*fprintf (stderr, "after: %d\n", (*(int*)ptr));*/
break;
case SPEEX_SET_SAMPLING_RATE:
{
- int tmp=(*(int*)ptr);
+ spx_int32_t tmp=(*(spx_int32_t*)ptr);
st->sampling_rate = tmp;
tmp>>=1;
speex_encoder_ctl(st->st_low, SPEEX_SET_SAMPLING_RATE, &tmp);
}
break;
case SPEEX_GET_SAMPLING_RATE:
- (*(int*)ptr)=st->sampling_rate;
+ (*(spx_int32_t*)ptr)=st->sampling_rate;
break;
case SPEEX_RESET_STATE:
{
@@ -1529,20 +1530,20 @@
case SPEEX_GET_BITRATE:
speex_decoder_ctl(st->st_low, request, ptr);
if (st->submodes[st->submodeID])
- (*(int*)ptr) += st->sampling_rate*SUBMODE(bits_per_frame)/st->full_frame_size;
+ (*(spx_int32_t*)ptr) += st->sampling_rate*SUBMODE(bits_per_frame)/st->full_frame_size;
else
- (*(int*)ptr) += st->sampling_rate*(SB_SUBMODE_BITS+1)/st->full_frame_size;
+ (*(spx_int32_t*)ptr) += st->sampling_rate*(SB_SUBMODE_BITS+1)/st->full_frame_size;
break;
case SPEEX_SET_SAMPLING_RATE:
{
- int tmp=(*(int*)ptr);
+ spx_int32_t tmp=(*(spx_int32_t*)ptr);
st->sampling_rate = tmp;
tmp>>=1;
speex_decoder_ctl(st->st_low, SPEEX_SET_SAMPLING_RATE, &tmp);
}
break;
case SPEEX_GET_SAMPLING_RATE:
- (*(int*)ptr)=st->sampling_rate;
+ (*(spx_int32_t*)ptr)=st->sampling_rate;
break;
case SPEEX_SET_HANDLER:
speex_decoder_ctl(st->st_low, SPEEX_SET_HANDLER, ptr);
Modified: trunk/speex/libspeex/sb_celp.h
===================================================================
--- trunk/speex/libspeex/sb_celp.h 2006-07-02 18:29:54 UTC (rev 11688)
+++ trunk/speex/libspeex/sb_celp.h 2006-07-03 10:15:26 UTC (rev 11689)
@@ -93,7 +93,7 @@
float vbr_quality; /**< Quality setting for VBR encoding */
int vbr_enabled; /**< 1 for enabling VBR, 0 otherwise */
spx_int32_t vbr_max; /**< Max bit-rate allowed in VBR mode */
- int abr_enabled; /**< ABR setting (in bps), 0 if off */
+ spx_int32_t abr_enabled; /**< ABR setting (in bps), 0 if off */
float abr_drift;
float abr_drift2;
float abr_count;
@@ -105,7 +105,7 @@
int submodeID;
int submodeSelect;
int complexity;
- int sampling_rate;
+ spx_int32_t sampling_rate;
} SBEncState;
@@ -120,7 +120,7 @@
int nbSubframes;
int lpcSize;
int first;
- int sampling_rate;
+ spx_int32_t sampling_rate;
int lpc_enh_enabled;
char *stack;
More information about the commits
mailing list