Skip to content

Commit

Permalink
clean up
Browse files Browse the repository at this point in the history
  • Loading branch information
mthrok committed Mar 8, 2021
1 parent 0513b94 commit ef0f465
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions torchaudio/csrc/sox/effects_chain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ int tensor_input_drain(sox_effect_t* effp, sox_sample_t* obuf, size_t* osamp) {
// Need to convert to 64-bit precision so that
// values around INT32_MIN/MAX are handled correctly.
chunk = chunk.to(c10::ScalarType::Double);
chunk *= 2147483648.;
chunk *= (int)1<<31;
chunk.clamp_(INT32_MIN, INT32_MAX);
chunk = chunk.to(c10::ScalarType::Int);
break;
Expand All @@ -95,13 +95,13 @@ int tensor_input_drain(sox_effect_t* effp, sox_sample_t* obuf, size_t* osamp) {
}
case c10::ScalarType::Short: {
chunk = chunk.to(c10::ScalarType::Int);
chunk *= 65536;
chunk *= (int)1<<16;
break;
}
case c10::ScalarType::Byte: {
chunk = chunk.to(c10::ScalarType::Int);
chunk -= 128;
chunk *= 16777216;
chunk *= (int)1<<24;
break;
}
default:
Expand Down

0 comments on commit ef0f465

Please sign in to comment.