Skip to content

Commit

Permalink
Use shift right arithmetic macro.
Browse files Browse the repository at this point in the history
  • Loading branch information
Masatomo Aiki committed Sep 13, 2019
1 parent 69c64e6 commit e163408
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions ala_predictor.c
Original file line number Diff line number Diff line change
Expand Up @@ -494,7 +494,7 @@ ALAPredictorApiResult ALAChannelDecorrelator_LRtoMSInt32(int32_t **data,
/* サンプル単位でLR -> MS処理 */
for (smpl = 0; smpl < num_samples; smpl++) {
/* 注意: 除算は右シフト必須(/2ではだめ。0方向に丸められる) */
mid = (data[0][smpl] + data[1][smpl]) >> 1;
mid = (int32_t)ALAUTILITY_SHIFT_RIGHT_ARITHMETIC(data[0][smpl] + data[1][smpl], 1);
side = data[0][smpl] - data[1][smpl];
data[0][smpl] = mid;
data[1][smpl] = side;
Expand All @@ -521,8 +521,8 @@ ALAPredictorApiResult ALAChannelDecorrelator_MStoLRInt32(int32_t **data,
for (smpl = 0; smpl < num_samples; smpl++) {
side = data[1][smpl];
mid = (data[0][smpl] << 1) | (side & 1);
data[0][smpl] = (mid + side) >> 1;
data[1][smpl] = (mid - side) >> 1;
data[0][smpl] = (int32_t)ALAUTILITY_SHIFT_RIGHT_ARITHMETIC(mid + side, 1);
data[1][smpl] = (int32_t)ALAUTILITY_SHIFT_RIGHT_ARITHMETIC(mid - side, 1);
}

return ALAPREDICTOR_APIRESULT_OK;
Expand Down

0 comments on commit e163408

Please sign in to comment.