Reduce OpusFile RAM by only allowing mono/stereo (#295)
This commit is contained in:
1 parent
fae26d4010
commit
a0a06a9832
2 files changed
+6
-3
No files matched your search
@@ -109,7 +109,7 @@ void op_fatal_impl(const char *_str,const char *_file,int _line);
|
|||||||
(OP_MIN(_offset,OP_INT64_MAX-(_amount))+(_amount))
|
(OP_MIN(_offset,OP_INT64_MAX-(_amount))+(_amount))
|
||||||
|
|
||||||
/*The maximum channel count for any mapping we'll actually decode.*/
|
/*The maximum channel count for any mapping we'll actually decode.*/
|
||||||
# define OP_NCHANNELS_MAX (8)
|
# define OP_NCHANNELS_MAX (2)
|
||||||
|
|
||||||
/*Initial state.*/
|
/*Initial state.*/
|
||||||
# define OP_NOTOPEN (0)
|
# define OP_NOTOPEN (0)
|
||||||
|
|||||||
@@ -3001,7 +3001,7 @@ static const float OP_STEREO_DOWNMIX[OP_NCHANNELS_MAX-2][OP_NCHANNELS_MAX][2]={
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(OP_FIXED_POINT)
|
#if defined(OP_FIXED_POINT)
|
||||||
|
#if 0
|
||||||
/*Matrices for downmixing from the supported channel counts to stereo.
|
/*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,
|
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
|
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}
|
{3183,5515},{4502,4502}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
#endif
|
||||||
int op_read(OggOpusFile *_of,opus_int16 *_pcm,int _buf_size,int *_li){
|
int op_read(OggOpusFile *_of,opus_int16 *_pcm,int _buf_size,int *_li){
|
||||||
return op_read_native(_of,_pcm,_buf_size,_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];
|
for(i=0;i<_nsamples;i++)dst[2*i+0]=dst[2*i+1]=_src[i];
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
|
#if 0
|
||||||
for(i=0;i<_nsamples;i++){
|
for(i=0;i<_nsamples;i++){
|
||||||
opus_int32 l;
|
opus_int32 l;
|
||||||
opus_int32 r;
|
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+0]=(opus_int16)OP_CLAMP(-32768,l+8192>>14,32767);
|
||||||
dst[2*i+1]=(opus_int16)OP_CLAMP(-32768,r+8192>>14,32767);
|
dst[2*i+1]=(opus_int16)OP_CLAMP(-32768,r+8192>>14,32767);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
// noop, removed for RAM savings
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return _nsamples;
|
return _nsamples;
|
||||||
|
|||||||
Reference in new issue
Block a user