From 0d394f3609e039db3c4168bf3f8273b3a1e02acb Mon Sep 17 00:00:00 2001 From: "bjornv@webrtc.org" Date: Mon, 8 Sep 2014 11:19:39 +0000 Subject: [PATCH] video_processing: Removed usage of WEBRTC_SPL_UMUL_16_16 The trivial macro WEBRTC_SPL_UMUL_16_16 is nothing but plain mutliplication of casted values. This CL explicitly use "*" at place and casts if necessary. BUG=3348,3353 TESTED=locally on linux and trybots R=henrik.lundin@webrtc.org Review URL: https://webrtc-codereview.appspot.com/23499004 git-svn-id: http://webrtc.googlecode.com/svn/trunk@7100 4adac7df-926f-26a2-2b94-8c16560cd09d --- .../video_processing/main/source/deflickering.cc | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/webrtc/modules/video_processing/main/source/deflickering.cc b/webrtc/modules/video_processing/main/source/deflickering.cc index cdc6174883..95755c22ef 100644 --- a/webrtc/modules/video_processing/main/source/deflickering.cc +++ b/webrtc/modules/video_processing/main/source/deflickering.cc @@ -75,8 +75,9 @@ void VPMDeflickering::Reset() { quant_hist_uw8_[0][0] = 0; quant_hist_uw8_[0][kNumQuants - 1] = 255; for (int32_t i = 0; i < kNumProbs; i++) { - quant_hist_uw8_[0][i + 1] = static_cast((WEBRTC_SPL_UMUL_16_16( - prob_uw16_[i], 255) + (1 << 10)) >> 11); // Unsigned round. + // Unsigned round. + quant_hist_uw8_[0][i + 1] = static_cast( + (prob_uw16_[i] * 255 + (1 << 10)) >> 11); } for (int32_t i = 1; i < kFrameHistory_size; i++) { @@ -191,9 +192,12 @@ int32_t VPMDeflickering::ProcessFrame(I420VideoFrame* frame, // Get target quantiles. for (int32_t i = 0; i < kNumQuants - kMaxOnlyLength; i++) { - target_quant_uw16[i] = static_cast((WEBRTC_SPL_UMUL_16_16( - weight_uw16_[i], maxquant_uw8[i]) + WEBRTC_SPL_UMUL_16_16((1 << 15) - - weight_uw16_[i], minquant_uw8[i])) >> 8); // + // target = w * maxquant_uw8 + (1 - w) * minquant_uw8 + // Weights w = |weight_uw16_| are in Q15, hence the final output has to be + // right shifted by 8 to end up in Q7. + target_quant_uw16[i] = static_cast(( + weight_uw16_[i] * maxquant_uw8[i] + + ((1 << 15) - weight_uw16_[i]) * minquant_uw8[i]) >> 8); // } for (int32_t i = kNumQuants - kMaxOnlyLength; i < kNumQuants; i++) {