Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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_jpeg_decode_accelerator.h" | 5 #include "media/gpu/vaapi_jpeg_decode_accelerator.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <string.h> | 8 #include <string.h> |
| 9 | 9 |
| 10 #include <memory> | 10 #include <memory> |
| (...skipping 10 matching lines...) Expand all Loading... | |
| 21 #include "media/gpu/shared_memory_region.h" | 21 #include "media/gpu/shared_memory_region.h" |
| 22 #include "media/gpu/vaapi_picture.h" | 22 #include "media/gpu/vaapi_picture.h" |
| 23 #include "third_party/libyuv/include/libyuv.h" | 23 #include "third_party/libyuv/include/libyuv.h" |
| 24 | 24 |
| 25 namespace media { | 25 namespace media { |
| 26 | 26 |
| 27 namespace { | 27 namespace { |
| 28 // UMA errors that the VaapiJpegDecodeAccelerator class reports. | 28 // UMA errors that the VaapiJpegDecodeAccelerator class reports. |
| 29 enum VAJDADecoderFailure { | 29 enum VAJDADecoderFailure { |
| 30 VAAPI_ERROR = 0, | 30 VAAPI_ERROR = 0, |
| 31 // UMA requires that max passed to UMA_HISTOGRAM_ENUMERATION must be greater | |
| 32 // than 1. | |
|
Mark Dittmer
2016/05/12 14:13:51
I still don't understand this comment. We have:
V
Pawel Osciak
2016/05/13 06:07:22
Please see below.
| |
| 31 VAJDA_DECODER_FAILURES_MAX, | 33 VAJDA_DECODER_FAILURES_MAX, |
| 32 }; | 34 }; |
| 33 | 35 |
| 34 static void ReportToUMA(VAJDADecoderFailure failure) { | 36 static void ReportToUMA(VAJDADecoderFailure failure) { |
| 35 UMA_HISTOGRAM_ENUMERATION("Media.VAJDA.DecoderFailure", failure, | 37 UMA_HISTOGRAM_ENUMERATION("Media.VAJDA.DecoderFailure", failure, |
| 36 VAJDA_DECODER_FAILURES_MAX + 1); | 38 VAJDA_DECODER_FAILURES_MAX + 1); |
|
Mark Dittmer
2016/05/12 14:13:51
Should the above-mentioned comment go here instead
Pawel Osciak
2016/05/13 06:07:22
Yeah, sorry, the reason is that it's gotten a bit
| |
| 37 } | 39 } |
| 38 | 40 |
| 39 static unsigned int VaSurfaceFormatForJpeg( | 41 static unsigned int VaSurfaceFormatForJpeg( |
| 40 const media::JpegFrameHeader& frame_header) { | 42 const media::JpegFrameHeader& frame_header) { |
| 41 // The range of sampling factor is [1, 4]. Pack them into integer to make the | 43 // The range of sampling factor is [1, 4]. Pack them into integer to make the |
| 42 // matching code simpler. For example, 0x211 means the sampling factor are 2, | 44 // matching code simpler. For example, 0x211 means the sampling factor are 2, |
| 43 // 1, 1 for 3 components. | 45 // 1, 1 for 3 components. |
| 44 unsigned int h = 0, v = 0; | 46 unsigned int h = 0, v = 0; |
| 45 for (int i = 0; i < frame_header.num_components; i++) { | 47 for (int i = 0; i < frame_header.num_components; i++) { |
| 46 DCHECK_LE(frame_header.components[i].horizontal_sampling_factor, 4); | 48 DCHECK_LE(frame_header.components[i].horizontal_sampling_factor, 4); |
| (...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 313 decoder_task_runner_->PostTask( | 315 decoder_task_runner_->PostTask( |
| 314 FROM_HERE, base::Bind(&VaapiJpegDecodeAccelerator::DecodeTask, | 316 FROM_HERE, base::Bind(&VaapiJpegDecodeAccelerator::DecodeTask, |
| 315 base::Unretained(this), base::Passed(&request))); | 317 base::Unretained(this), base::Passed(&request))); |
| 316 } | 318 } |
| 317 | 319 |
| 318 bool VaapiJpegDecodeAccelerator::IsSupported() { | 320 bool VaapiJpegDecodeAccelerator::IsSupported() { |
| 319 return VaapiWrapper::IsJpegDecodeSupported(); | 321 return VaapiWrapper::IsJpegDecodeSupported(); |
| 320 } | 322 } |
| 321 | 323 |
| 322 } // namespace media | 324 } // namespace media |
| OLD | NEW |