Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(281)

Side by Side Diff: media/filters/vpx_video_decoder.cc

Issue 2697863003: color: Clarify default behaviors (Closed)
Patch Set: color: Remove redundant PrimaryID/TransferID/MatrixID values Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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::BT709;
608 gfx::ColorSpace::PrimaryID::UNSPECIFIED; 608 gfx::ColorSpace::TransferID transfer = gfx::ColorSpace::TransferID::BT709;
609 gfx::ColorSpace::TransferID transfer = 609 gfx::ColorSpace::MatrixID matrix = gfx::ColorSpace::MatrixID::BT709;
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 21 matching lines...) Expand all
643 break; 641 break;
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
ccameron 2017/02/15 21:57:23 This is a behavior change. The decision of how to
654 if (primaries != gfx::ColorSpace::PrimaryID::UNSPECIFIED) { 652 (*video_frame)
655 (*video_frame) 653 ->set_color_space(gfx::ColorSpace(primaries, transfer, matrix, range));
656 ->set_color_space(
657 gfx::ColorSpace(primaries, transfer, matrix, range));
658 }
659 } 654 }
660 655
661 return true; 656 return true;
662 } 657 }
663 658
664 VpxVideoDecoder::AlphaDecodeStatus VpxVideoDecoder::DecodeAlphaPlane( 659 VpxVideoDecoder::AlphaDecodeStatus VpxVideoDecoder::DecodeAlphaPlane(
665 const struct vpx_image* vpx_image, 660 const struct vpx_image* vpx_image,
666 const struct vpx_image** vpx_image_alpha, 661 const struct vpx_image** vpx_image_alpha,
667 const scoped_refptr<DecoderBuffer>& buffer) { 662 const scoped_refptr<DecoderBuffer>& buffer) {
668 if (!vpx_codec_alpha_ || buffer->side_data_size() < 8) { 663 if (!vpx_codec_alpha_ || buffer->side_data_size() < 8) {
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after
846 (*video_frame)->visible_data(VideoFrame::kUPlane), 841 (*video_frame)->visible_data(VideoFrame::kUPlane),
847 (*video_frame)->stride(VideoFrame::kUPlane), 842 (*video_frame)->stride(VideoFrame::kUPlane),
848 (*video_frame)->visible_data(VideoFrame::kVPlane), 843 (*video_frame)->visible_data(VideoFrame::kVPlane),
849 (*video_frame)->stride(VideoFrame::kVPlane), coded_size.width(), 844 (*video_frame)->stride(VideoFrame::kVPlane), coded_size.width(),
850 coded_size.height()); 845 coded_size.height());
851 846
852 return true; 847 return true;
853 } 848 }
854 849
855 } // namespace media 850 } // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698