Reduce OpusFile RAM by only allowing mono/stereo (#295)

This commit is contained in:
Earle F. Philhower, III authored and GitHub committed 2020-08-11 22:04:41 -07:00
1 parent fae26d4010
commit a0a06a9832
2 files changed
+6 -3

No files matched your search

+1 -1
View File
@@ -109,7 +109,7 @@ void op_fatal_impl(const char *_str,const char *_file,int _line);
(OP_MIN(_offset,OP_INT64_MAX-(_amount))+(_amount))
/*The maximum channel count for any mapping we'll actually decode.*/
# define OP_NCHANNELS_MAX (8)
# define OP_NCHANNELS_MAX (2)
/*Initial state.*/
# define OP_NOTOPEN (0)
+5 -2
View File
@@ -3001,7 +3001,7 @@ static const float OP_STEREO_DOWNMIX[OP_NCHANNELS_MAX-2][OP_NCHANNELS_MAX][2]={
#endif
#if defined(OP_FIXED_POINT)
#if 0
/*Matrices for downmixing from the supported channel counts to stereo.
The matrices with 5 or more channels are normalized to a total volume of 2.0,
since most mixes sound too quiet if normalized to 1.0 (as there is generally
@@ -3037,7 +3037,7 @@ static const opus_int16 OP_STEREO_DOWNMIX_Q14
{3183,5515},{4502,4502}
}
};
#endif
int op_read(OggOpusFile *_of,opus_int16 *_pcm,int _buf_size,int *_li){
return op_read_native(_of,_pcm,_buf_size,_li);
}
@@ -3055,6 +3055,7 @@ static int op_stereo_filter(OggOpusFile *_of,void *_dst,int _dst_sz,
for(i=0;i<_nsamples;i++)dst[2*i+0]=dst[2*i+1]=_src[i];
}
else{
#if 0
for(i=0;i<_nsamples;i++){
opus_int32 l;
opus_int32 r;
@@ -3070,6 +3071,8 @@ static int op_stereo_filter(OggOpusFile *_of,void *_dst,int _dst_sz,
dst[2*i+0]=(opus_int16)OP_CLAMP(-32768,l+8192>>14,32767);
dst[2*i+1]=(opus_int16)OP_CLAMP(-32768,r+8192>>14,32767);
}
#endif
// noop, removed for RAM savings
}
}
return _nsamples;