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

Side by Side Diff: webrtc/modules/video_processing/video_processing_impl.cc

Issue 1900673002: Delete webrtc::VideoFrame methods buffer and stride. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Update H.264 video_toolbox encoder. Created 4 years, 8 months 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) 2012 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2012 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 10
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 FrameStats* stats) { 44 FrameStats* stats) {
45 ClearFrameStats(stats); // The histogram needs to be zeroed out. 45 ClearFrameStats(stats); // The histogram needs to be zeroed out.
46 if (frame.IsZeroSize()) { 46 if (frame.IsZeroSize()) {
47 return; 47 return;
48 } 48 }
49 49
50 int width = frame.width(); 50 int width = frame.width();
51 int height = frame.height(); 51 int height = frame.height();
52 stats->sub_sampling_factor = GetSubSamplingFactor(width, height); 52 stats->sub_sampling_factor = GetSubSamplingFactor(width, height);
53 53
54 const uint8_t* buffer = frame.buffer(kYPlane); 54 const uint8_t* buffer = frame.video_frame_buffer()->DataY();
55 // Compute histogram and sum of frame 55 // Compute histogram and sum of frame
56 for (int i = 0; i < height; i += (1 << stats->sub_sampling_factor)) { 56 for (int i = 0; i < height; i += (1 << stats->sub_sampling_factor)) {
57 int k = i * width; 57 int k = i * width;
58 for (int j = 0; j < width; j += (1 << stats->sub_sampling_factor)) { 58 for (int j = 0; j < width; j += (1 << stats->sub_sampling_factor)) {
59 stats->hist[buffer[k + j]]++; 59 stats->hist[buffer[k + j]]++;
60 stats->sum += buffer[k + j]; 60 stats->sum += buffer[k + j];
61 } 61 }
62 } 62 }
63 63
64 stats->num_pixels = (width * height) / ((1 << stats->sub_sampling_factor) * 64 stats->num_pixels = (width * height) / ((1 << stats->sub_sampling_factor) *
(...skipping 26 matching lines...) Expand all
91 RTC_DCHECK(frame->height() > 0); 91 RTC_DCHECK(frame->height() > 0);
92 92
93 int num_pixels = frame->width() * frame->height(); 93 int num_pixels = frame->width() * frame->height();
94 94
95 int look_up[256]; 95 int look_up[256];
96 for (int i = 0; i < 256; i++) { 96 for (int i = 0; i < 256; i++) {
97 int val = i + delta; 97 int val = i + delta;
98 look_up[i] = ((((val < 0) ? 0 : val) > 255) ? 255 : val); 98 look_up[i] = ((((val < 0) ? 0 : val) > 255) ? 255 : val);
99 } 99 }
100 100
101 uint8_t* temp_ptr = frame->buffer(kYPlane); 101 uint8_t* temp_ptr = frame->video_frame_buffer()->MutableDataY();
102 for (int i = 0; i < num_pixels; i++) { 102 for (int i = 0; i < num_pixels; i++) {
103 *temp_ptr = static_cast<uint8_t>(look_up[*temp_ptr]); 103 *temp_ptr = static_cast<uint8_t>(look_up[*temp_ptr]);
104 temp_ptr++; 104 temp_ptr++;
105 } 105 }
106 } 106 }
107 107
108 int32_t VideoProcessingImpl::Deflickering(VideoFrame* frame, 108 int32_t VideoProcessingImpl::Deflickering(VideoFrame* frame,
109 FrameStats* stats) { 109 FrameStats* stats) {
110 rtc::CritScope mutex(&mutex_); 110 rtc::CritScope mutex(&mutex_);
111 return deflickering_.ProcessFrame(frame, stats); 111 return deflickering_.ProcessFrame(frame, stats);
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
170 rtc::CritScope mutex(&mutex_); 170 rtc::CritScope mutex(&mutex_);
171 return frame_pre_processor_.GetContentMetrics(); 171 return frame_pre_processor_.GetContentMetrics();
172 } 172 }
173 173
174 void VideoProcessingImpl::EnableContentAnalysis(bool enable) { 174 void VideoProcessingImpl::EnableContentAnalysis(bool enable) {
175 rtc::CritScope mutex(&mutex_); 175 rtc::CritScope mutex(&mutex_);
176 frame_pre_processor_.EnableContentAnalysis(enable); 176 frame_pre_processor_.EnableContentAnalysis(enable);
177 } 177 }
178 178
179 } // namespace webrtc 179 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698