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 | 19 |
20 namespace webrtc { | 20 namespace webrtc { |
21 | 21 |
| 22 // TODO(hbos): The FFmpeg video decoder will require up to 8 bytes, update this |
| 23 // when the FFmpeg decoder is added. |
| 24 const size_t EncodedImage::kBufferPaddingBytesH264 = 0; |
| 25 |
22 bool EqualPlane(const uint8_t* data1, | 26 bool EqualPlane(const uint8_t* data1, |
23 const uint8_t* data2, | 27 const uint8_t* data2, |
24 int stride, | 28 int stride, |
25 int width, | 29 int width, |
26 int height) { | 30 int height) { |
27 for (int y = 0; y < height; ++y) { | 31 for (int y = 0; y < height; ++y) { |
28 if (memcmp(data1, data2, width) != 0) | 32 if (memcmp(data1, data2, width) != 0) |
29 return false; | 33 return false; |
30 data1 += stride; | 34 data1 += stride; |
31 data2 += stride; | 35 data2 += stride; |
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
235 const int half_width = (width() + 1) / 2; | 239 const int half_width = (width() + 1) / 2; |
236 const int half_height = (height() + 1) / 2; | 240 const int half_height = (height() + 1) / 2; |
237 return EqualPlane(buffer(kYPlane), frame.buffer(kYPlane), | 241 return EqualPlane(buffer(kYPlane), frame.buffer(kYPlane), |
238 stride(kYPlane), width(), height()) && | 242 stride(kYPlane), width(), height()) && |
239 EqualPlane(buffer(kUPlane), frame.buffer(kUPlane), | 243 EqualPlane(buffer(kUPlane), frame.buffer(kUPlane), |
240 stride(kUPlane), half_width, half_height) && | 244 stride(kUPlane), half_width, half_height) && |
241 EqualPlane(buffer(kVPlane), frame.buffer(kVPlane), | 245 EqualPlane(buffer(kVPlane), frame.buffer(kVPlane), |
242 stride(kVPlane), half_width, half_height); | 246 stride(kVPlane), half_width, half_height); |
243 } | 247 } |
244 | 248 |
| 249 size_t EncodedImage::GetBufferPaddingBytes(VideoCodecType codec_type) { |
| 250 switch (codec_type) { |
| 251 case kVideoCodecVP8: |
| 252 case kVideoCodecVP9: |
| 253 return 0; |
| 254 case kVideoCodecH264: |
| 255 return kBufferPaddingBytesH264; |
| 256 case kVideoCodecI420: |
| 257 case kVideoCodecRED: |
| 258 case kVideoCodecULPFEC: |
| 259 case kVideoCodecGeneric: |
| 260 case kVideoCodecUnknown: |
| 261 return 0; |
| 262 } |
| 263 RTC_NOTREACHED(); |
| 264 return 0; |
| 265 } |
| 266 |
245 } // namespace webrtc | 267 } // namespace webrtc |
OLD | NEW |