You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-22 15:06:45 +00:00
Update Opus driver to 1.1.2
And opusfile to 0.7.
This commit is contained in:
@@ -24,10 +24,7 @@ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
***********************************************************************/
|
||||
|
||||
#ifdef OPUS_ENABLED
|
||||
#include "opus/opus_config.h"
|
||||
#endif
|
||||
#include "opus/silk/define.h"
|
||||
#include "opus/silk/API.h"
|
||||
#include "opus/silk/control.h"
|
||||
@@ -165,7 +162,7 @@ opus_int silk_Encode( /* O Returns error co
|
||||
psEnc->state_Fxx[ 0 ].sCmn.nFramesEncoded = psEnc->state_Fxx[ 1 ].sCmn.nFramesEncoded = 0;
|
||||
|
||||
/* Check values in encoder control structure */
|
||||
if( ( ret = check_control_input( encControl ) != 0 ) ) {
|
||||
if( ( ret = check_control_input( encControl ) ) != 0 ) {
|
||||
silk_assert( 0 );
|
||||
RESTORE_STACK;
|
||||
return ret;
|
||||
@@ -376,26 +373,33 @@ opus_int silk_Encode( /* O Returns error co
|
||||
for( n = 0; n < encControl->nChannelsInternal; n++ ) {
|
||||
silk_memset( psEnc->state_Fxx[ n ].sCmn.LBRR_flags, 0, sizeof( psEnc->state_Fxx[ n ].sCmn.LBRR_flags ) );
|
||||
}
|
||||
|
||||
psEnc->nBitsUsedLBRR = ec_tell( psRangeEnc );
|
||||
}
|
||||
|
||||
silk_HP_variable_cutoff( psEnc->state_Fxx );
|
||||
|
||||
/* Total target bits for packet */
|
||||
nBits = silk_DIV32_16( silk_MUL( encControl->bitRate, encControl->payloadSize_ms ), 1000 );
|
||||
/* Subtract half of the bits already used */
|
||||
/* Subtract bits used for LBRR */
|
||||
if( !prefillFlag ) {
|
||||
nBits -= ec_tell( psRangeEnc ) >> 1;
|
||||
nBits -= psEnc->nBitsUsedLBRR;
|
||||
}
|
||||
/* Divide by number of uncoded frames left in packet */
|
||||
nBits = silk_DIV32_16( nBits, psEnc->state_Fxx[ 0 ].sCmn.nFramesPerPacket - psEnc->state_Fxx[ 0 ].sCmn.nFramesEncoded );
|
||||
nBits = silk_DIV32_16( nBits, psEnc->state_Fxx[ 0 ].sCmn.nFramesPerPacket );
|
||||
/* Convert to bits/second */
|
||||
if( encControl->payloadSize_ms == 10 ) {
|
||||
TargetRate_bps = silk_SMULBB( nBits, 100 );
|
||||
} else {
|
||||
TargetRate_bps = silk_SMULBB( nBits, 50 );
|
||||
}
|
||||
/* Subtract fraction of bits in excess of target in previous packets */
|
||||
/* Subtract fraction of bits in excess of target in previous frames and packets */
|
||||
TargetRate_bps -= silk_DIV32_16( silk_MUL( psEnc->nBitsExceeded, 1000 ), BITRESERVOIR_DECAY_TIME_MS );
|
||||
if( !prefillFlag && psEnc->state_Fxx[ 0 ].sCmn.nFramesEncoded > 0 ) {
|
||||
/* Compare actual vs target bits so far in this packet */
|
||||
opus_int32 bitsBalance = ec_tell( psRangeEnc ) - psEnc->nBitsUsedLBRR - nBits * psEnc->state_Fxx[ 0 ].sCmn.nFramesEncoded;
|
||||
TargetRate_bps -= silk_DIV32_16( silk_MUL( bitsBalance, 1000 ), BITRESERVOIR_DECAY_TIME_MS );
|
||||
}
|
||||
/* Never exceed input bitrate */
|
||||
TargetRate_bps = silk_LIMIT( TargetRate_bps, encControl->bitRate, 5000 );
|
||||
|
||||
|
||||
Reference in New Issue
Block a user