OLD | NEW |
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 |
11 #include "webrtc/video_frame.h" | 11 #include "webrtc/video_frame.h" |
12 | 12 |
13 #include <string.h> | 13 #include <string.h> |
14 | 14 |
15 #include <algorithm> // swap | 15 #include <algorithm> // swap |
16 | 16 |
17 #include "webrtc/base/bind.h" | 17 #include "webrtc/base/bind.h" |
18 #include "webrtc/base/checks.h" | 18 #include "webrtc/base/checks.h" |
| 19 #include "webrtc/modules/video_coding/codecs/h264/include/h264.h" |
19 | 20 |
20 namespace webrtc { | 21 namespace webrtc { |
21 | 22 |
22 bool EqualPlane(const uint8_t* data1, | 23 bool EqualPlane(const uint8_t* data1, |
23 const uint8_t* data2, | 24 const uint8_t* data2, |
24 int stride, | 25 int stride, |
25 int width, | 26 int width, |
26 int height) { | 27 int height) { |
27 for (int y = 0; y < height; ++y) { | 28 for (int y = 0; y < height; ++y) { |
28 if (memcmp(data1, data2, width) != 0) | 29 if (memcmp(data1, data2, width) != 0) |
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
235 const int half_width = (width() + 1) / 2; | 236 const int half_width = (width() + 1) / 2; |
236 const int half_height = (height() + 1) / 2; | 237 const int half_height = (height() + 1) / 2; |
237 return EqualPlane(buffer(kYPlane), frame.buffer(kYPlane), | 238 return EqualPlane(buffer(kYPlane), frame.buffer(kYPlane), |
238 stride(kYPlane), width(), height()) && | 239 stride(kYPlane), width(), height()) && |
239 EqualPlane(buffer(kUPlane), frame.buffer(kUPlane), | 240 EqualPlane(buffer(kUPlane), frame.buffer(kUPlane), |
240 stride(kUPlane), half_width, half_height) && | 241 stride(kUPlane), half_width, half_height) && |
241 EqualPlane(buffer(kVPlane), frame.buffer(kVPlane), | 242 EqualPlane(buffer(kVPlane), frame.buffer(kVPlane), |
242 stride(kVPlane), half_width, half_height); | 243 stride(kVPlane), half_width, half_height); |
243 } | 244 } |
244 | 245 |
| 246 size_t EncodedImage::GetBufferPadding(VideoCodecType codec_type) { |
| 247 switch (codec_type) { |
| 248 case kVideoCodecVP8: |
| 249 case kVideoCodecVP9: |
| 250 return 0; |
| 251 case kVideoCodecH264: |
| 252 return kEncodedImagePaddingH264; |
| 253 case kVideoCodecI420: |
| 254 case kVideoCodecRED: |
| 255 case kVideoCodecULPFEC: |
| 256 case kVideoCodecGeneric: |
| 257 case kVideoCodecUnknown: |
| 258 return 0; |
| 259 } |
| 260 RTC_NOTREACHED(); |
| 261 return 0; |
| 262 } |
| 263 |
245 } // namespace webrtc | 264 } // namespace webrtc |
OLD | NEW |