OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2011 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2011 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 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
123 } | 123 } |
124 | 124 |
125 // Size of luminance component. | 125 // Size of luminance component. |
126 const uint32_t y_size = height * width; | 126 const uint32_t y_size = height * width; |
127 | 127 |
128 const uint32_t y_sub_size = | 128 const uint32_t y_sub_size = |
129 width * (((height - 1) >> kLog2OfDownsamplingFactor) + 1); | 129 width * (((height - 1) >> kLog2OfDownsamplingFactor) + 1); |
130 uint8_t* y_sorted = new uint8_t[y_sub_size]; | 130 uint8_t* y_sorted = new uint8_t[y_sub_size]; |
131 uint32_t sort_row_idx = 0; | 131 uint32_t sort_row_idx = 0; |
132 for (int i = 0; i < height; i += kDownsamplingFactor) { | 132 for (int i = 0; i < height; i += kDownsamplingFactor) { |
133 memcpy(y_sorted + sort_row_idx * width, frame->buffer(kYPlane) + i * width, | 133 memcpy(y_sorted + sort_row_idx * width, |
134 width); | 134 frame->video_frame_buffer()->DataY() + i * width, width); |
135 sort_row_idx++; | 135 sort_row_idx++; |
136 } | 136 } |
137 | 137 |
138 webrtc::Sort(y_sorted, y_sub_size, webrtc::TYPE_UWord8); | 138 webrtc::Sort(y_sorted, y_sub_size, webrtc::TYPE_UWord8); |
139 | 139 |
140 uint32_t prob_idx_uw32 = 0; | 140 uint32_t prob_idx_uw32 = 0; |
141 quant_uw8[0] = 0; | 141 quant_uw8[0] = 0; |
142 quant_uw8[kNumQuants - 1] = 255; | 142 quant_uw8[kNumQuants - 1] = 255; |
143 | 143 |
144 // Ensure we won't get an overflow below. | 144 // Ensure we won't get an overflow below. |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
220 | 220 |
221 mapUW16 = target_quant_uw16[i - 1]; | 221 mapUW16 = target_quant_uw16[i - 1]; |
222 for (uint32_t j = quant_uw8[i - 1]; j < (uint32_t)(quant_uw8[i] + 1); j++) { | 222 for (uint32_t j = quant_uw8[i - 1]; j < (uint32_t)(quant_uw8[i] + 1); j++) { |
223 // Unsigned round. <Q0> | 223 // Unsigned round. <Q0> |
224 map_uw8[j] = (uint8_t)((mapUW16 + (1 << 6)) >> 7); | 224 map_uw8[j] = (uint8_t)((mapUW16 + (1 << 6)) >> 7); |
225 mapUW16 += increment_uw16; | 225 mapUW16 += increment_uw16; |
226 } | 226 } |
227 } | 227 } |
228 | 228 |
229 // Map to the output frame. | 229 // Map to the output frame. |
230 uint8_t* buffer = frame->buffer(kYPlane); | 230 uint8_t* buffer = frame->video_frame_buffer()->MutableDataY(); |
231 for (uint32_t i = 0; i < y_size; i++) { | 231 for (uint32_t i = 0; i < y_size; i++) { |
232 buffer[i] = map_uw8[buffer[i]]; | 232 buffer[i] = map_uw8[buffer[i]]; |
233 } | 233 } |
234 | 234 |
235 // Frame was altered, so reset stats. | 235 // Frame was altered, so reset stats. |
236 VideoProcessing::ClearFrameStats(stats); | 236 VideoProcessing::ClearFrameStats(stats); |
237 | 237 |
238 return VPM_OK; | 238 return VPM_OK; |
239 } | 239 } |
240 | 240 |
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
393 ret_val = 1; | 393 ret_val = 1; |
394 } else if (freqState == 0) { | 394 } else if (freqState == 0) { |
395 ret_val = 2; | 395 ret_val = 2; |
396 } else { | 396 } else { |
397 ret_val = 0; | 397 ret_val = 0; |
398 } | 398 } |
399 return ret_val; | 399 return ret_val; |
400 } | 400 } |
401 | 401 |
402 } // namespace webrtc | 402 } // namespace webrtc |
OLD | NEW |