PCM DAC: fix possible overflow in linear interpola
This commit is contained in:
parent
4e333787ff
commit
5ab70ff91f
|
|
@ -67,7 +67,7 @@ void DivPlatformPCMDAC::acquire(short** buf, size_t len) {
|
||||||
|
|
||||||
switch (interp) {
|
switch (interp) {
|
||||||
case 1: // linear
|
case 1: // linear
|
||||||
output=s6+((s7-s6)*(chan[0].audSub&0xffff)>>16);
|
output=s6+(((int)((int)s7-(int)s6)*((chan[0].audSub>>1)&0x7fff))>>15);
|
||||||
break;
|
break;
|
||||||
case 2: { // cubic
|
case 2: { // cubic
|
||||||
float* cubicTable=DivFilterTables::getCubicTable();
|
float* cubicTable=DivFilterTables::getCubicTable();
|
||||||
|
|
@ -188,7 +188,7 @@ void DivPlatformPCMDAC::acquire(short** buf, size_t len) {
|
||||||
|
|
||||||
switch (interp) {
|
switch (interp) {
|
||||||
case 1: // linear
|
case 1: // linear
|
||||||
output=s6+((s7-s6)*(chan[0].audSub&0xffff)>>16);
|
output=s6+(((int)((int)s7-(int)s6)*((chan[0].audSub>>1)&0x7fff))>>15);
|
||||||
break;
|
break;
|
||||||
case 2: { // cubic
|
case 2: { // cubic
|
||||||
float* cubicTable=DivFilterTables::getCubicTable();
|
float* cubicTable=DivFilterTables::getCubicTable();
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue