| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/ffmpeg/ffmpeg_common.h" | 5 #include "media/ffmpeg/ffmpeg_common.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/sha1.h" | 8 #include "base/sha1.h" |
| 9 #include "base/strings/string_number_conversions.h" | 9 #include "base/strings/string_number_conversions.h" |
| 10 #include "base/strings/string_split.h" | 10 #include "base/strings/string_split.h" |
| (...skipping 743 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 754 return false; | 754 return false; |
| 755 } | 755 } |
| 756 | 756 |
| 757 int32_t HashCodecName(const char* codec_name) { | 757 int32_t HashCodecName(const char* codec_name) { |
| 758 // Use the first 32-bits from the SHA1 hash as the identifier. | 758 // Use the first 32-bits from the SHA1 hash as the identifier. |
| 759 int32_t hash; | 759 int32_t hash; |
| 760 memcpy(&hash, base::SHA1HashString(codec_name).substr(0, 4).c_str(), 4); | 760 memcpy(&hash, base::SHA1HashString(codec_name).substr(0, 4).c_str(), 4); |
| 761 return hash; | 761 return hash; |
| 762 } | 762 } |
| 763 | 763 |
| 764 #define TEST_PRIMARY(P) \ |
| 765 static_assert( \ |
| 766 static_cast<int>(gfx::ColorSpace::PrimaryID::P) == AVCOL_PRI_##P, \ |
| 767 "gfx::ColorSpace::PrimaryID::" #P " does not match AVCOL_PRI_" #P); |
| 768 |
| 769 #define TEST_TRANSFER(T) \ |
| 770 static_assert( \ |
| 771 static_cast<int>(gfx::ColorSpace::TransferID::T) == AVCOL_TRC_##T, \ |
| 772 "gfx::ColorSpace::TransferID::" #T " does not match AVCOL_TRC_" #T); |
| 773 |
| 774 #define TEST_COLORSPACE(C) \ |
| 775 static_assert( \ |
| 776 static_cast<int>(gfx::ColorSpace::MatrixID::C) == AVCOL_SPC_##C, \ |
| 777 "gfx::ColorSpace::MatrixID::" #C " does not match AVCOL_SPC_" #C); |
| 778 |
| 779 TEST_PRIMARY(RESERVED0); |
| 780 TEST_PRIMARY(BT709); |
| 781 TEST_PRIMARY(UNSPECIFIED); |
| 782 TEST_PRIMARY(RESERVED); |
| 783 TEST_PRIMARY(BT470M); |
| 784 TEST_PRIMARY(BT470BG); |
| 785 TEST_PRIMARY(SMPTE170M); |
| 786 TEST_PRIMARY(SMPTE240M); |
| 787 TEST_PRIMARY(FILM); |
| 788 TEST_PRIMARY(BT2020); |
| 789 TEST_PRIMARY(SMPTEST428_1); |
| 790 |
| 791 TEST_TRANSFER(RESERVED0); |
| 792 TEST_TRANSFER(BT709); |
| 793 TEST_TRANSFER(UNSPECIFIED); |
| 794 TEST_TRANSFER(RESERVED); |
| 795 TEST_TRANSFER(GAMMA22); |
| 796 TEST_TRANSFER(GAMMA28); |
| 797 TEST_TRANSFER(SMPTE170M); |
| 798 TEST_TRANSFER(SMPTE240M); |
| 799 TEST_TRANSFER(LINEAR); |
| 800 TEST_TRANSFER(LOG); |
| 801 TEST_TRANSFER(LOG_SQRT); |
| 802 TEST_TRANSFER(IEC61966_2_4); |
| 803 TEST_TRANSFER(BT1361_ECG); |
| 804 TEST_TRANSFER(IEC61966_2_1); |
| 805 TEST_TRANSFER(BT2020_10); |
| 806 TEST_TRANSFER(BT2020_12); |
| 807 TEST_TRANSFER(SMPTEST2084); |
| 808 TEST_TRANSFER(SMPTEST428_1); |
| 809 |
| 810 TEST_COLORSPACE(RGB); |
| 811 TEST_COLORSPACE(BT709); |
| 812 TEST_COLORSPACE(UNSPECIFIED); |
| 813 TEST_COLORSPACE(RESERVED); |
| 814 TEST_COLORSPACE(FCC); |
| 815 TEST_COLORSPACE(BT470BG); |
| 816 TEST_COLORSPACE(SMPTE170M); |
| 817 TEST_COLORSPACE(SMPTE240M); |
| 818 TEST_COLORSPACE(YCOCG); |
| 819 TEST_COLORSPACE(BT2020_NCL); |
| 820 TEST_COLORSPACE(BT2020_CL); |
| 821 |
| 764 } // namespace media | 822 } // namespace media |
| OLD | NEW |