Pedro Becerra
2013-Jul-08 23:23 UTC
[opus] patch to fix error in src/opus_multistream_encoder.c when DISABLE_FLOAT_API is defined
Hello, for your consideration. The following patch moves the channel_pos() function from within the #if !defined(DISABLE_FLOAT_API). This change is required when compiling with FIXED_POINT and DISABLE_FLOAT_API defined. #### ### diff --git a/src/opus_multistream_encoder.c b/src/opus_multistream_encoder.c index 3efab53..6f3eb53 100644 --- a/src/opus_multistream_encoder.c +++ b/src/opus_multistream_encoder.c @@ -454,7 +454,9 @@ static int opus_multistream_encode_native unsigned char tmp_data[MS_FRAME_TMP]; OpusRepacketizer rp; opus_int32 complexity; +#ifndef FIXED_POINT AnalysisInfo analysis_info; +#endif const CELTMode *celt_mode; opus_int32 bitrates[256]; opus_val16 bandLogE[42]; @@ -629,27 +631,6 @@ static int opus_multistream_encode_native } -#if !defined(DISABLE_FLOAT_API) -static void opus_copy_channel_in_float( - opus_val16 *dst, - int dst_stride, - const void *src, - int src_stride, - int src_channel, - int frame_size -) -{ - const float *float_src; - opus_int32 i; - float_src = (const float *)src; - for (i=0;i<frame_size;i++) -#if defined(FIXED_POINT) - dst[i*dst_stride] = FLOAT2INT16(float_src[i*src_stride+src_channel]); -#else - dst[i*dst_stride] = float_src[i*src_stride+src_channel]; -#endif -} - static void channel_pos(int channels, int pos[8]) { /* Position in the mix: 0 don't mix, 1: left, 2: center, 3:right */ @@ -689,6 +670,27 @@ static void channel_pos(int channels, int pos[8]) } } +#if !defined(DISABLE_FLOAT_API) +static void opus_copy_channel_in_float( + opus_val16 *dst, + int dst_stride, + const void *src, + int src_stride, + int src_channel, + int frame_size +) +{ + const float *float_src; + opus_int32 i; + float_src = (const float *)src; + for (i=0;i<frame_size;i++) +#if defined(FIXED_POINT) + dst[i*dst_stride] = FLOAT2INT16(float_src[i*src_stride+src_channel]); +#else + dst[i*dst_stride] = float_src[i*src_stride+src_channel]; +#endif +} + static void opus_surround_downmix_float( opus_val16 *dst, const void *src,
Jean-Marc Valin
2013-Jul-12 00:28 UTC
[opus] patch to fix error in src/opus_multistream_encoder.c when DISABLE_FLOAT_API is defined
Thanks for noticing. It's fixed now. Jean-Marc On 07/08/2013 07:23 PM, Pedro Becerra wrote:> Hello, > for your consideration. > The following patch moves the channel_pos() > function from within the #if !defined(DISABLE_FLOAT_API). > This change is required when compiling with FIXED_POINT > and DISABLE_FLOAT_API defined. > > #### ### > > diff --git a/src/opus_multistream_encoder.c b/src/opus_multistream_encoder.c > index 3efab53..6f3eb53 100644 > --- a/src/opus_multistream_encoder.c > +++ b/src/opus_multistream_encoder.c > @@ -454,7 +454,9 @@ static int opus_multistream_encode_native > unsigned char tmp_data[MS_FRAME_TMP]; > OpusRepacketizer rp; > opus_int32 complexity; > +#ifndef FIXED_POINT > AnalysisInfo analysis_info; > +#endif > const CELTMode *celt_mode; > opus_int32 bitrates[256]; > opus_val16 bandLogE[42]; > @@ -629,27 +631,6 @@ static int opus_multistream_encode_native > > } > > -#if !defined(DISABLE_FLOAT_API) > -static void opus_copy_channel_in_float( > - opus_val16 *dst, > - int dst_stride, > - const void *src, > - int src_stride, > - int src_channel, > - int frame_size > -) > -{ > - const float *float_src; > - opus_int32 i; > - float_src = (const float *)src; > - for (i=0;i<frame_size;i++) > -#if defined(FIXED_POINT) > - dst[i*dst_stride] = FLOAT2INT16(float_src[i*src_stride+src_channel]); > -#else > - dst[i*dst_stride] = float_src[i*src_stride+src_channel]; > -#endif > -} > - > static void channel_pos(int channels, int pos[8]) > { > /* Position in the mix: 0 don't mix, 1: left, 2: center, 3:right */ > @@ -689,6 +670,27 @@ static void channel_pos(int channels, int pos[8]) > } > } > > +#if !defined(DISABLE_FLOAT_API) > +static void opus_copy_channel_in_float( > + opus_val16 *dst, > + int dst_stride, > + const void *src, > + int src_stride, > + int src_channel, > + int frame_size > +) > +{ > + const float *float_src; > + opus_int32 i; > + float_src = (const float *)src; > + for (i=0;i<frame_size;i++) > +#if defined(FIXED_POINT) > + dst[i*dst_stride] = FLOAT2INT16(float_src[i*src_stride+src_channel]); > +#else > + dst[i*dst_stride] = float_src[i*src_stride+src_channel]; > +#endif > +} > + > static void opus_surround_downmix_float( > opus_val16 *dst, > const void *src, > _______________________________________________ > opus mailing list > opus at xiph.org > http://lists.xiph.org/mailman/listinfo/opus >