mirror of
https://github.com/xiph/opus.git
synced 2025-06-01 08:07:41 +00:00
Remove redundant code
frame_size_select() ensures that frame_size is a valid size or -1, !st->variable_duration is always false, and delay_compensation is no longer needed to choose the frame size.
This commit is contained in:
parent
d74fa2785a
commit
d73c5a9618
2 changed files with 3 additions and 26 deletions
|
@ -1105,12 +1105,7 @@ opus_int32 opus_encode_native(OpusEncoder *st, const opus_val16 *pcm, int frame_
|
|||
max_data_bytes = IMIN(1276, out_data_bytes);
|
||||
|
||||
st->rangeFinal = 0;
|
||||
if ((!st->variable_duration && 400*frame_size != st->Fs && 200*frame_size != st->Fs && 100*frame_size != st->Fs &&
|
||||
50*frame_size != st->Fs && 25*frame_size != st->Fs && 50*frame_size != 3*st->Fs && 50*frame_size != 4*st->Fs &&
|
||||
50*frame_size != 5*st->Fs && 50*frame_size != 6*st->Fs)
|
||||
|| (400*frame_size < st->Fs)
|
||||
|| max_data_bytes<=0
|
||||
)
|
||||
if (frame_size <= 0 || max_data_bytes <= 0)
|
||||
{
|
||||
RESTORE_STACK;
|
||||
return OPUS_BAD_ARG;
|
||||
|
|
|
@ -864,26 +864,8 @@ static int opus_multistream_encode_native
|
|||
opus_encoder_ctl((OpusEncoder*)ptr, OPUS_GET_VBR(&vbr));
|
||||
opus_encoder_ctl((OpusEncoder*)ptr, CELT_GET_MODE(&celt_mode));
|
||||
|
||||
{
|
||||
opus_int32 delay_compensation;
|
||||
|
||||
opus_encoder_ctl((OpusEncoder*)ptr, OPUS_GET_LOOKAHEAD(&delay_compensation));
|
||||
delay_compensation -= Fs/400;
|
||||
frame_size = frame_size_select(analysis_frame_size, st->variable_duration, Fs);
|
||||
}
|
||||
|
||||
if (400*frame_size < Fs)
|
||||
{
|
||||
RESTORE_STACK;
|
||||
return OPUS_BAD_ARG;
|
||||
}
|
||||
/* Validate frame_size before using it to allocate stack space.
|
||||
This mirrors the checks in opus_encode[_float](). */
|
||||
if (400*frame_size != Fs && 200*frame_size != Fs &&
|
||||
100*frame_size != Fs && 50*frame_size != Fs &&
|
||||
25*frame_size != Fs && 50*frame_size != 3*Fs &&
|
||||
50*frame_size != 4*Fs && 50*frame_size != 5*Fs &&
|
||||
50*frame_size != 6*Fs)
|
||||
frame_size = frame_size_select(analysis_frame_size, st->variable_duration, Fs);
|
||||
if (frame_size <= 0)
|
||||
{
|
||||
RESTORE_STACK;
|
||||
return OPUS_BAD_ARG;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue