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 724 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
735 return COLOR_SPACE_UNSPECIFIED; | 735 return COLOR_SPACE_UNSPECIFIED; |
736 } | 736 } |
737 | 737 |
738 int32_t HashCodecName(const char* codec_name) { | 738 int32_t HashCodecName(const char* codec_name) { |
739 // Use the first 32-bits from the SHA1 hash as the identifier. | 739 // Use the first 32-bits from the SHA1 hash as the identifier. |
740 int32_t hash; | 740 int32_t hash; |
741 memcpy(&hash, base::SHA1HashString(codec_name).substr(0, 4).c_str(), 4); | 741 memcpy(&hash, base::SHA1HashString(codec_name).substr(0, 4).c_str(), 4); |
742 return hash; | 742 return hash; |
743 } | 743 } |
744 | 744 |
745 #define TEST_PRIMARY(P) \ | |
746 static_assert( \ | |
747 static_cast<int>(gfx::ColorSpace::PrimaryID::P) == AVCOL_PRI_##P, \ | |
748 "gfx::ColorSpace::PrimaryID::" #P " does not match AVCOL_PRI_" #P); | |
749 | |
750 #define TEST_TRANSFER(T) \ | |
751 static_assert( \ | |
752 static_cast<int>(gfx::ColorSpace::TransferID::T) == AVCOL_TRC_##T, \ | |
753 "gfx::ColorSpace::TransferID::" #T " does not match AVCOL_TRC_" #T); | |
754 | |
755 #define TEST_COLORSPACE(C) \ | |
756 static_assert( \ | |
757 static_cast<int>(gfx::ColorSpace::MatrixID::C) == AVCOL_SPC_##C, \ | |
758 "gfx::ColorSpace::MatrixID::" #C " does not match AVCOL_SPC_" #C); | |
759 | |
760 TEST_PRIMARY(RESERVED0); | |
761 TEST_PRIMARY(BT709); | |
762 TEST_PRIMARY(UNSPECIFIED); | |
763 TEST_PRIMARY(RESERVED); | |
764 TEST_PRIMARY(BT470M); | |
765 TEST_PRIMARY(BT470BG); | |
766 TEST_PRIMARY(SMPTE170M); | |
767 TEST_PRIMARY(SMPTE240M); | |
768 TEST_PRIMARY(FILM); | |
769 TEST_PRIMARY(BT2020); | |
770 TEST_PRIMARY(SMPTEST428_1); | |
771 | |
772 TEST_TRANSFER(RESERVED0); | |
773 TEST_TRANSFER(BT709); | |
774 TEST_TRANSFER(UNSPECIFIED); | |
775 TEST_TRANSFER(RESERVED); | |
776 TEST_TRANSFER(GAMMA22); | |
777 TEST_TRANSFER(GAMMA28); | |
778 TEST_TRANSFER(SMPTE170M); | |
779 TEST_TRANSFER(SMPTE240M); | |
780 TEST_TRANSFER(LINEAR); | |
781 TEST_TRANSFER(LOG); | |
782 TEST_TRANSFER(LOG_SQRT); | |
783 TEST_TRANSFER(IEC61966_2_4); | |
784 TEST_TRANSFER(BT1361_ECG); | |
785 TEST_TRANSFER(IEC61966_2_1); | |
786 TEST_TRANSFER(BT2020_10); | |
787 TEST_TRANSFER(BT2020_12); | |
788 TEST_TRANSFER(SMPTEST2084); | |
789 TEST_TRANSFER(SMPTEST428_1); | |
790 | |
791 TEST_COLORSPACE(RGB); | |
792 TEST_COLORSPACE(BT709); | |
793 TEST_COLORSPACE(UNSPECIFIED); | |
794 TEST_COLORSPACE(RESERVED); | |
795 TEST_COLORSPACE(FCC); | |
796 TEST_COLORSPACE(BT470BG); | |
797 TEST_COLORSPACE(SMPTE170M); | |
798 TEST_COLORSPACE(SMPTE240M); | |
799 TEST_COLORSPACE(YCOCG); | |
800 TEST_COLORSPACE(BT2020_NCL); | |
801 TEST_COLORSPACE(BT2020_CL); | |
802 | |
803 } // namespace media | 745 } // namespace media |
OLD | NEW |