| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "media/gpu/vaapi_video_encode_accelerator.h" | 5 #include "media/gpu/vaapi_video_encode_accelerator.h" |
| 6 | 6 |
| 7 #include <string.h> | 7 #include <string.h> |
| 8 | 8 |
| 9 #include <memory> | 9 #include <memory> |
| 10 #include <utility> | 10 #include <utility> |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 67 // All Intel codecs can do at least 4.1. | 67 // All Intel codecs can do at least 4.1. |
| 68 const int kDefaultLevelIDC = 41; | 68 const int kDefaultLevelIDC = 41; |
| 69 const int kChromaFormatIDC = 1; // 4:2:0 | 69 const int kChromaFormatIDC = 1; // 4:2:0 |
| 70 | 70 |
| 71 // Arbitrarily chosen bitrate window size for rate control, in ms. | 71 // Arbitrarily chosen bitrate window size for rate control, in ms. |
| 72 const int kCPBWindowSizeMs = 1500; | 72 const int kCPBWindowSizeMs = 1500; |
| 73 | 73 |
| 74 // UMA errors that the VaapiVideoEncodeAccelerator class reports. | 74 // UMA errors that the VaapiVideoEncodeAccelerator class reports. |
| 75 enum VAVEAEncoderFailure { | 75 enum VAVEAEncoderFailure { |
| 76 VAAPI_ERROR = 0, | 76 VAAPI_ERROR = 0, |
| 77 // UMA requires that max passed to UMA_HISTOGRAM_ENUMERATION must be greater |
| 78 // than 1. |
| 77 VAVEA_ENCODER_FAILURES_MAX, | 79 VAVEA_ENCODER_FAILURES_MAX, |
| 78 }; | 80 }; |
| 79 } | 81 } |
| 80 | 82 |
| 81 // Round |value| up to |alignment|, which must be a power of 2. | 83 // Round |value| up to |alignment|, which must be a power of 2. |
| 82 static inline size_t RoundUpToPowerOf2(size_t value, size_t alignment) { | 84 static inline size_t RoundUpToPowerOf2(size_t value, size_t alignment) { |
| 83 // Check that |alignment| is a power of 2. | 85 // Check that |alignment| is a power of 2. |
| 84 DCHECK((alignment + (alignment - 1)) == (alignment | (alignment - 1))); | 86 DCHECK((alignment + (alignment - 1)) == (alignment | (alignment - 1))); |
| 85 return ((value + (alignment - 1)) & ~(alignment - 1)); | 87 return ((value + (alignment - 1)) & ~(alignment - 1)); |
| 86 } | 88 } |
| (...skipping 965 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1052 client_ptr_factory_.reset(); | 1054 client_ptr_factory_.reset(); |
| 1053 } | 1055 } |
| 1054 } | 1056 } |
| 1055 | 1057 |
| 1056 VaapiVideoEncodeAccelerator::EncodeJob::EncodeJob() | 1058 VaapiVideoEncodeAccelerator::EncodeJob::EncodeJob() |
| 1057 : coded_buffer(VA_INVALID_ID), keyframe(false) {} | 1059 : coded_buffer(VA_INVALID_ID), keyframe(false) {} |
| 1058 | 1060 |
| 1059 VaapiVideoEncodeAccelerator::EncodeJob::~EncodeJob() {} | 1061 VaapiVideoEncodeAccelerator::EncodeJob::~EncodeJob() {} |
| 1060 | 1062 |
| 1061 } // namespace media | 1063 } // namespace media |
| OLD | NEW |