Commit 94df098d authored by Miguel Casas-Sanchez's avatar Miguel Casas-Sanchez Committed by Commit Bot

vaapi cleanup: a few s/const/constexpr/

This CL s/const/constexpr/ in a few locations in vaapi/ folder.
No new code intended, just that substitution.

TBR=dcastagna@chromium.org

Cq-Include-Trybots: luci.chromium.try:android_optional_gpu_tests_rel;luci.chromium.try:linux_optional_gpu_tests_rel;luci.chromium.try:mac_optional_gpu_tests_rel;luci.chromium.try:win_optional_gpu_tests_rel
Change-Id: I4ec733806feff58a70e8e9ab1c0d7f4565f1733c
Reviewed-on: https://chromium-review.googlesource.com/1012949
Commit-Queue: Miguel Casas <mcasas@chromium.org>
Reviewed-by: default avatarMiguel Casas <mcasas@chromium.org>
Cr-Commit-Position: refs/heads/master@{#551403}
parent dee803ed
...@@ -24,12 +24,12 @@ namespace { ...@@ -24,12 +24,12 @@ namespace {
// from ITU-T REC H.264 spec // from ITU-T REC H.264 spec
// section 8.5.6 // section 8.5.6
// "Inverse scanning process for 4x4 transform coefficients and scaling lists" // "Inverse scanning process for 4x4 transform coefficients and scaling lists"
static const int kZigzagScan4x4[16] = {0, 1, 4, 8, 5, 2, 3, 6, static constexpr int kZigzagScan4x4[16] = {0, 1, 4, 8, 5, 2, 3, 6,
9, 12, 13, 10, 7, 11, 14, 15}; 9, 12, 13, 10, 7, 11, 14, 15};
// section 8.5.7 // section 8.5.7
// "Inverse scanning process for 8x8 transform coefficients and scaling lists" // "Inverse scanning process for 8x8 transform coefficients and scaling lists"
static const uint8_t kZigzagScan8x8[64] = { static constexpr uint8_t kZigzagScan8x8[64] = {
0, 1, 8, 16, 9, 2, 3, 10, 17, 24, 32, 25, 18, 11, 4, 5, 0, 1, 8, 16, 9, 2, 3, 10, 17, 24, 32, 25, 18, 11, 4, 5,
12, 19, 26, 33, 40, 48, 41, 34, 27, 20, 13, 6, 7, 14, 21, 28, 12, 19, 26, 33, 40, 48, 41, 34, 27, 20, 13, 6, 7, 14, 21, 28,
35, 42, 49, 56, 57, 50, 43, 36, 29, 22, 15, 23, 30, 37, 44, 51, 35, 42, 49, 56, 57, 50, 43, 36, 29, 22, 15, 23, 30, 37, 44, 51,
......
...@@ -26,8 +26,8 @@ ...@@ -26,8 +26,8 @@
namespace media { namespace media {
namespace { namespace {
const char* kTestFilename = "pixel-1280x720.jpg"; constexpr char* kTestFilename = "pixel-1280x720.jpg";
const char* kExpectedMd5Sum = "6e9e1716073c9a9a1282e3f0e0dab743"; constexpr char* kExpectedMd5Sum = "6e9e1716073c9a9a1282e3f0e0dab743";
void LogOnError() { void LogOnError() {
LOG(FATAL) << "Oh noes! Decoder failed"; LOG(FATAL) << "Oh noes! Decoder failed";
......
...@@ -30,7 +30,7 @@ namespace { ...@@ -30,7 +30,7 @@ namespace {
// JPEG format uses 2 bytes to denote the size of a segment, and the size // JPEG format uses 2 bytes to denote the size of a segment, and the size
// includes the 2 bytes used for specifying it. Therefore, maximum data size // includes the 2 bytes used for specifying it. Therefore, maximum data size
// allowed is: 65535 - 2 = 65533. // allowed is: 65535 - 2 = 65533.
const size_t kMaxExifSizeAllowed = 65533; constexpr size_t kMaxExifSizeAllowed = 65533;
// UMA results that the VaapiJpegEncodeAccelerator class reports. // UMA results that the VaapiJpegEncodeAccelerator class reports.
// These values are persisted to logs, and should therefore never be renumbered // These values are persisted to logs, and should therefore never be renumbered
......
...@@ -26,25 +26,25 @@ namespace media { ...@@ -26,25 +26,25 @@ namespace media {
namespace { namespace {
// JPEG header only uses 2 bytes to represent width and height. // JPEG header only uses 2 bytes to represent width and height.
const int kMaxDimension = 65535; constexpr int kMaxDimension = 65535;
const size_t kDctSize2 = 64; constexpr size_t kDctSize2 = 64;
const size_t kNumDcRunSizeBits = 16; constexpr size_t kNumDcRunSizeBits = 16;
const size_t kNumAcRunSizeBits = 16; constexpr size_t kNumAcRunSizeBits = 16;
const size_t kNumDcCodeWordsHuffVal = 12; constexpr size_t kNumDcCodeWordsHuffVal = 12;
const size_t kNumAcCodeWordsHuffVal = 162; constexpr size_t kNumAcCodeWordsHuffVal = 162;
const size_t kJpegDefaultHeaderSize = constexpr size_t kJpegDefaultHeaderSize =
67 + (kDctSize2 * 2) + (kNumDcRunSizeBits * 2) + 67 + (kDctSize2 * 2) + (kNumDcRunSizeBits * 2) +
(kNumDcCodeWordsHuffVal * 2) + (kNumAcRunSizeBits * 2) + (kNumDcCodeWordsHuffVal * 2) + (kNumAcRunSizeBits * 2) +
(kNumAcCodeWordsHuffVal * 2); (kNumAcCodeWordsHuffVal * 2);
const size_t kJFIFApp0Size = 16; constexpr size_t kJFIFApp0Size = 16;
const uint8_t kZigZag8x8[64] = { constexpr uint8_t kZigZag8x8[64] = {
0, 1, 8, 16, 9, 2, 3, 10, 17, 24, 32, 25, 18, 11, 4, 5, 0, 1, 8, 16, 9, 2, 3, 10, 17, 24, 32, 25, 18, 11, 4, 5,
12, 19, 26, 33, 40, 48, 41, 34, 27, 20, 13, 6, 7, 14, 21, 28, 12, 19, 26, 33, 40, 48, 41, 34, 27, 20, 13, 6, 7, 14, 21, 28,
35, 42, 49, 56, 57, 50, 43, 36, 29, 22, 15, 23, 30, 37, 44, 51, 35, 42, 49, 56, 57, 50, 43, 36, 29, 22, 15, 23, 30, 37, 44, 51,
58, 59, 52, 45, 38, 31, 39, 46, 53, 60, 61, 54, 47, 55, 62, 63}; 58, 59, 52, 45, 38, 31, 39, 46, 53, 60, 61, 54, 47, 55, 62, 63};
const JpegQuantizationTable kDefaultQuantTable[2] = { constexpr JpegQuantizationTable kDefaultQuantTable[2] = {
// Table K.1 Luminance quantization table values. // Table K.1 Luminance quantization table values.
{ {
true, true,
......
...@@ -39,14 +39,14 @@ namespace media { ...@@ -39,14 +39,14 @@ namespace media {
namespace { namespace {
// Need 2 surfaces for each frame: one for input data and one for // Need 2 surfaces for each frame: one for input data and one for
// reconstructed picture, which is later used for reference. // reconstructed picture, which is later used for reference.
const size_t kMinSurfacesToEncode = 2; constexpr size_t kMinSurfacesToEncode = 2;
// Subjectively chosen. // Subjectively chosen.
const size_t kNumInputBuffers = 4; constexpr size_t kNumInputBuffers = 4;
const size_t kMaxNumReferenceFrames = 4; constexpr size_t kMaxNumReferenceFrames = 4;
// TODO(owenlin): Adjust the value after b/71367113 is fixed // TODO(owenlin): Adjust the value after b/71367113 is fixed
const size_t kExtraOutputBufferSize = 32768; // bytes constexpr size_t kExtraOutputBufferSize = 32768; // bytes
// We need up to kMaxNumReferenceFrames surfaces for reference, plus one // We need up to kMaxNumReferenceFrames surfaces for reference, plus one
// for input and one for encode (which will be added to the set of reference // for input and one for encode (which will be added to the set of reference
...@@ -56,28 +56,28 @@ const size_t kExtraOutputBufferSize = 32768; // bytes ...@@ -56,28 +56,28 @@ const size_t kExtraOutputBufferSize = 32768; // bytes
// encode surfaces (i.e. kMaxNumReferenceFrames + kMinSurfacesToEncode), and // encode surfaces (i.e. kMaxNumReferenceFrames + kMinSurfacesToEncode), and
// (kNumInputBuffers - 1) of kMinSurfacesToEncode for the remaining frames // (kNumInputBuffers - 1) of kMinSurfacesToEncode for the remaining frames
// in flight. // in flight.
const size_t kNumSurfaces = kMaxNumReferenceFrames + kMinSurfacesToEncode + constexpr size_t kNumSurfaces = kMaxNumReferenceFrames + kMinSurfacesToEncode +
kMinSurfacesToEncode * (kNumInputBuffers - 1); kMinSurfacesToEncode * (kNumInputBuffers - 1);
// An IDR every 2048 frames, an I frame every 256 and no B frames. // An IDR every 2048 frames, an I frame every 256 and no B frames.
// We choose IDR period to equal MaxFrameNum so it must be a power of 2. // We choose IDR period to equal MaxFrameNum so it must be a power of 2.
const int kIDRPeriod = 2048; constexpr int kIDRPeriod = 2048;
const int kIPeriod = 256; constexpr int kIPeriod = 256;
const int kIPPeriod = 1; constexpr int kIPPeriod = 1;
const int kDefaultFramerate = 30; constexpr int kDefaultFramerate = 30;
// HRD parameters (ch. E.2.2 in spec). // HRD parameters (ch. E.2.2 in spec).
const int kBitRateScale = 0; // bit_rate_scale for SPS HRD parameters. constexpr int kBitRateScale = 0; // bit_rate_scale for SPS HRD parameters.
const int kCPBSizeScale = 0; // cpb_size_scale for SPS HRD parameters. constexpr int kCPBSizeScale = 0; // cpb_size_scale for SPS HRD parameters.
const int kDefaultQP = 26; constexpr int kDefaultQP = 26;
// All Intel codecs can do at least 4.1. // All Intel codecs can do at least 4.1.
const int kDefaultLevelIDC = 41; constexpr int kDefaultLevelIDC = 41;
const int kChromaFormatIDC = 1; // 4:2:0 constexpr int kChromaFormatIDC = 1; // 4:2:0
// Arbitrarily chosen bitrate window size for rate control, in ms. // Arbitrarily chosen bitrate window size for rate control, in ms.
const int kCPBWindowSizeMs = 1500; constexpr int kCPBWindowSizeMs = 1500;
// UMA errors that the VaapiVideoEncodeAccelerator class reports. // UMA errors that the VaapiVideoEncodeAccelerator class reports.
enum VAVEAEncoderFailure { enum VAVEAEncoderFailure {
......
...@@ -124,7 +124,7 @@ namespace { ...@@ -124,7 +124,7 @@ namespace {
// Maximum framerate of encoded profile. This value is an arbitary limit // Maximum framerate of encoded profile. This value is an arbitary limit
// and not taken from HW documentation. // and not taken from HW documentation.
const int kMaxEncoderFramerate = 30; constexpr int kMaxEncoderFramerate = 30;
// A map between VideoCodecProfile and VAProfile. // A map between VideoCodecProfile and VAProfile.
static const struct { static const struct {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment