| OLD | NEW |
| 1 /*********************************************************************** | 1 /*********************************************************************** |
| 2 Copyright (c) 2006-2011, Skype Limited. All rights reserved. | 2 Copyright (c) 2006-2011, Skype Limited. All rights reserved. |
| 3 Redistribution and use in source and binary forms, with or without | 3 Redistribution and use in source and binary forms, with or without |
| 4 modification, are permitted provided that the following conditions | 4 modification, are permitted provided that the following conditions |
| 5 are met: | 5 are met: |
| 6 - Redistributions of source code must retain the above copyright notice, | 6 - Redistributions of source code must retain the above copyright notice, |
| 7 this list of conditions and the following disclaimer. | 7 this list of conditions and the following disclaimer. |
| 8 - Redistributions in binary form must reproduce the above copyright | 8 - Redistributions in binary form must reproduce the above copyright |
| 9 notice, this list of conditions and the following disclaimer in the | 9 notice, this list of conditions and the following disclaimer in the |
| 10 documentation and/or other materials provided with the distribution. | 10 documentation and/or other materials provided with the distribution. |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 73 } | 73 } |
| 74 if( encControl->opusCanSwitch ) { | 74 if( encControl->opusCanSwitch ) { |
| 75 /* Stop transition phase */ | 75 /* Stop transition phase */ |
| 76 psEncC->sLP.mode = 0; | 76 psEncC->sLP.mode = 0; |
| 77 | 77 |
| 78 /* Switch to a lower sample frequency */ | 78 /* Switch to a lower sample frequency */ |
| 79 fs_kHz = psEncC->fs_kHz == 16 ? 12 : 8; | 79 fs_kHz = psEncC->fs_kHz == 16 ? 12 : 8; |
| 80 } else { | 80 } else { |
| 81 if( psEncC->sLP.transition_frame_no <= 0 ) { | 81 if( psEncC->sLP.transition_frame_no <= 0 ) { |
| 82 encControl->switchReady = 1; | 82 encControl->switchReady = 1; |
| 83 /* Make room for redundancy */ |
| 84 encControl->maxBits -= encControl->maxBits * 5 / ( encCon
trol->payloadSize_ms + 5 ); |
| 83 } else { | 85 } else { |
| 84 /* Direction: down (at double speed) */ | 86 /* Direction: down (at double speed) */ |
| 85 psEncC->sLP.mode = -2; | 87 psEncC->sLP.mode = -2; |
| 86 } | 88 } |
| 87 } | 89 } |
| 88 } | 90 } |
| 89 else | 91 else |
| 90 /* Check if we should switch up */ | 92 /* Check if we should switch up */ |
| 91 if( silk_SMULBB( psEncC->fs_kHz, 1000 ) < psEncC->desiredInternal_fs
_Hz ) | 93 if( silk_SMULBB( psEncC->fs_kHz, 1000 ) < psEncC->desiredInternal_fs
_Hz ) |
| 92 { | 94 { |
| 93 /* Switch up */ | 95 /* Switch up */ |
| 94 if( encControl->opusCanSwitch ) { | 96 if( encControl->opusCanSwitch ) { |
| 95 /* Switch to a higher sample frequency */ | 97 /* Switch to a higher sample frequency */ |
| 96 fs_kHz = psEncC->fs_kHz == 8 ? 12 : 16; | 98 fs_kHz = psEncC->fs_kHz == 8 ? 12 : 16; |
| 97 | 99 |
| 98 /* New transition */ | 100 /* New transition */ |
| 99 psEncC->sLP.transition_frame_no = 0; | 101 psEncC->sLP.transition_frame_no = 0; |
| 100 | 102 |
| 101 /* Reset transition filter state */ | 103 /* Reset transition filter state */ |
| 102 silk_memset( psEncC->sLP.In_LP_State, 0, sizeof( psEncC->sLP
.In_LP_State ) ); | 104 silk_memset( psEncC->sLP.In_LP_State, 0, sizeof( psEncC->sLP
.In_LP_State ) ); |
| 103 | 105 |
| 104 /* Direction: up */ | 106 /* Direction: up */ |
| 105 psEncC->sLP.mode = 1; | 107 psEncC->sLP.mode = 1; |
| 106 } else { | 108 } else { |
| 107 if( psEncC->sLP.mode == 0 ) { | 109 if( psEncC->sLP.mode == 0 ) { |
| 108 encControl->switchReady = 1; | 110 encControl->switchReady = 1; |
| 111 /* Make room for redundancy */ |
| 112 encControl->maxBits -= encControl->maxBits * 5 / ( encCon
trol->payloadSize_ms + 5 ); |
| 109 } else { | 113 } else { |
| 110 /* Direction: up */ | 114 /* Direction: up */ |
| 111 psEncC->sLP.mode = 1; | 115 psEncC->sLP.mode = 1; |
| 112 } | 116 } |
| 113 } | 117 } |
| 114 } | 118 } |
| 115 } | 119 } |
| 116 } | 120 } |
| 117 | 121 |
| 118 return fs_kHz; | 122 return fs_kHz; |
| 119 } | 123 } |
| OLD | NEW |