Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(40)

Side by Side Diff: webrtc/modules/video_coding/utility/quality_scaler.cc

Issue 1470043002: Support texture scaling in Androids MediaEncoder (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Addressed pbos comments. Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2014 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2014 The WebRTC project authors. All Rights Reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source 5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 #include "webrtc/modules/video_coding/utility/quality_scaler.h" 10 #include "webrtc/modules/video_coding/utility/quality_scaler.h"
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
104 assert(downscale_shift_ >= 0); 104 assert(downscale_shift_ >= 0);
105 for (int shift = downscale_shift_; 105 for (int shift = downscale_shift_;
106 shift > 0 && (res_.width / 2 >= min_width_) && 106 shift > 0 && (res_.width / 2 >= min_width_) &&
107 (res_.height / 2 >= min_height_); 107 (res_.height / 2 >= min_height_);
108 --shift) { 108 --shift) {
109 res_.width /= 2; 109 res_.width /= 2;
110 res_.height /= 2; 110 res_.height /= 2;
111 } 111 }
112 } 112 }
113 113
114 QualityScaler::Resolution QualityScaler::GetScaledResolution() const { 114 const QualityScaler::Resolution& QualityScaler::GetScaledResolution() const {
115 return res_; 115 return res_;
116 } 116 }
117 117
118 int QualityScaler::GetTargetFramerate() const { 118 int QualityScaler::GetTargetFramerate() const {
119 return target_framerate_; 119 return target_framerate_;
120 } 120 }
121 121
122 const VideoFrame& QualityScaler::GetScaledFrame(const VideoFrame& frame) { 122 const VideoFrame& QualityScaler::GetScaledFrame(const VideoFrame& frame) {
123 Resolution res = GetScaledResolution(); 123 Resolution res = GetScaledResolution();
124 if (res.width == frame.width()) 124 if (res.width == frame.width())
(...skipping 22 matching lines...) Expand all
147 } 147 }
148 148
149 void QualityScaler::AdjustScale(bool up) { 149 void QualityScaler::AdjustScale(bool up) {
150 downscale_shift_ += up ? -1 : 1; 150 downscale_shift_ += up ? -1 : 1;
151 if (downscale_shift_ < 0) 151 if (downscale_shift_ < 0)
152 downscale_shift_ = 0; 152 downscale_shift_ = 0;
153 ClearSamples(); 153 ClearSamples();
154 } 154 }
155 155
156 } // namespace webrtc 156 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698