| 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/filters/vpx_video_decoder.h" | 5 #include "media/filters/vpx_video_decoder.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <algorithm> | 10 #include <algorithm> |
| (...skipping 586 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 597 (*video_frame) | 597 (*video_frame) |
| 598 ->metadata() | 598 ->metadata() |
| 599 ->SetInteger(VideoFrameMetadata::COLOR_SPACE, color_space); | 599 ->SetInteger(VideoFrameMetadata::COLOR_SPACE, color_space); |
| 600 | 600 |
| 601 if (config_.color_space_info() != gfx::ColorSpace()) { | 601 if (config_.color_space_info() != gfx::ColorSpace()) { |
| 602 // config_.color_space_info() comes from the color tag which is | 602 // config_.color_space_info() comes from the color tag which is |
| 603 // more expressive than the bitstream, so prefer it over the | 603 // more expressive than the bitstream, so prefer it over the |
| 604 // bitstream data below. | 604 // bitstream data below. |
| 605 (*video_frame)->set_color_space(config_.color_space_info()); | 605 (*video_frame)->set_color_space(config_.color_space_info()); |
| 606 } else { | 606 } else { |
| 607 gfx::ColorSpace::PrimaryID primaries = | 607 gfx::ColorSpace::PrimaryID primaries = gfx::ColorSpace::PrimaryID::INVALID; |
| 608 gfx::ColorSpace::PrimaryID::UNSPECIFIED; | 608 gfx::ColorSpace::TransferID transfer = gfx::ColorSpace::TransferID::INVALID; |
| 609 gfx::ColorSpace::TransferID transfer = | 609 gfx::ColorSpace::MatrixID matrix = gfx::ColorSpace::MatrixID::INVALID; |
| 610 gfx::ColorSpace::TransferID::UNSPECIFIED; | |
| 611 gfx::ColorSpace::MatrixID matrix = gfx::ColorSpace::MatrixID::UNSPECIFIED; | |
| 612 gfx::ColorSpace::RangeID range = vpx_image->range == VPX_CR_FULL_RANGE | 610 gfx::ColorSpace::RangeID range = vpx_image->range == VPX_CR_FULL_RANGE |
| 613 ? gfx::ColorSpace::RangeID::FULL | 611 ? gfx::ColorSpace::RangeID::FULL |
| 614 : gfx::ColorSpace::RangeID::LIMITED; | 612 : gfx::ColorSpace::RangeID::LIMITED; |
| 615 | 613 |
| 616 switch (vpx_image->cs) { | 614 switch (vpx_image->cs) { |
| 617 case VPX_CS_BT_601: | 615 case VPX_CS_BT_601: |
| 618 case VPX_CS_SMPTE_170: | 616 case VPX_CS_SMPTE_170: |
| 619 primaries = gfx::ColorSpace::PrimaryID::SMPTE170M; | 617 primaries = gfx::ColorSpace::PrimaryID::SMPTE170M; |
| 620 transfer = gfx::ColorSpace::TransferID::SMPTE170M; | 618 transfer = gfx::ColorSpace::TransferID::SMPTE170M; |
| 621 matrix = gfx::ColorSpace::MatrixID::SMPTE170M; | 619 matrix = gfx::ColorSpace::MatrixID::SMPTE170M; |
| (...skipping 22 matching lines...) Expand all Loading... |
| 644 case VPX_CS_SRGB: | 642 case VPX_CS_SRGB: |
| 645 primaries = gfx::ColorSpace::PrimaryID::BT709; | 643 primaries = gfx::ColorSpace::PrimaryID::BT709; |
| 646 transfer = gfx::ColorSpace::TransferID::IEC61966_2_1; | 644 transfer = gfx::ColorSpace::TransferID::IEC61966_2_1; |
| 647 matrix = gfx::ColorSpace::MatrixID::BT709; | 645 matrix = gfx::ColorSpace::MatrixID::BT709; |
| 648 break; | 646 break; |
| 649 | 647 |
| 650 default: | 648 default: |
| 651 break; | 649 break; |
| 652 } | 650 } |
| 653 | 651 |
| 654 if (primaries != gfx::ColorSpace::PrimaryID::UNSPECIFIED) { | 652 // TODO(ccameron): Set a color space even for unspecified values. |
| 653 if (primaries != gfx::ColorSpace::PrimaryID::INVALID) { |
| 655 (*video_frame) | 654 (*video_frame) |
| 656 ->set_color_space( | 655 ->set_color_space( |
| 657 gfx::ColorSpace(primaries, transfer, matrix, range)); | 656 gfx::ColorSpace(primaries, transfer, matrix, range)); |
| 658 } | 657 } |
| 659 } | 658 } |
| 660 | 659 |
| 661 return true; | 660 return true; |
| 662 } | 661 } |
| 663 | 662 |
| 664 VpxVideoDecoder::AlphaDecodeStatus VpxVideoDecoder::DecodeAlphaPlane( | 663 VpxVideoDecoder::AlphaDecodeStatus VpxVideoDecoder::DecodeAlphaPlane( |
| (...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 846 (*video_frame)->visible_data(VideoFrame::kUPlane), | 845 (*video_frame)->visible_data(VideoFrame::kUPlane), |
| 847 (*video_frame)->stride(VideoFrame::kUPlane), | 846 (*video_frame)->stride(VideoFrame::kUPlane), |
| 848 (*video_frame)->visible_data(VideoFrame::kVPlane), | 847 (*video_frame)->visible_data(VideoFrame::kVPlane), |
| 849 (*video_frame)->stride(VideoFrame::kVPlane), coded_size.width(), | 848 (*video_frame)->stride(VideoFrame::kVPlane), coded_size.width(), |
| 850 coded_size.height()); | 849 coded_size.height()); |
| 851 | 850 |
| 852 return true; | 851 return true; |
| 853 } | 852 } |
| 854 | 853 |
| 855 } // namespace media | 854 } // namespace media |
| OLD | NEW |