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

Side by Side Diff: media/base/video_frame.cc

Issue 2088273003: Video Color Managament (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: log color space Created 4 years, 4 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
« no previous file with comments | « media/base/video_frame.h ('k') | media/media.gyp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/base/video_frame.h" 5 #include "media/base/video_frame.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <climits> 8 #include <climits>
9 9
10 #include "base/atomic_sequence_num.h" 10 #include "base/atomic_sequence_num.h"
(...skipping 635 matching lines...) Expand 10 before | Expand all | Expand 10 after
646 646
647 bool VideoFrame::IsMappable() const { 647 bool VideoFrame::IsMappable() const {
648 return IsStorageTypeMappable(storage_type_); 648 return IsStorageTypeMappable(storage_type_);
649 } 649 }
650 650
651 bool VideoFrame::HasTextures() const { 651 bool VideoFrame::HasTextures() const {
652 return !mailbox_holders_[0].mailbox.IsZero(); 652 return !mailbox_holders_[0].mailbox.IsZero();
653 } 653 }
654 654
655 gfx::ColorSpace VideoFrame::ColorSpace() const { 655 gfx::ColorSpace VideoFrame::ColorSpace() const {
656 int videoframe_color_space; 656 if (color_space_ == gfx::ColorSpace()) {
657 if (metadata()->GetInteger(media::VideoFrameMetadata::COLOR_SPACE, 657 int videoframe_color_space;
658 &videoframe_color_space)) { 658 if (metadata()->GetInteger(media::VideoFrameMetadata::COLOR_SPACE,
659 switch (videoframe_color_space) { 659 &videoframe_color_space)) {
660 case media::COLOR_SPACE_JPEG: 660 switch (videoframe_color_space) {
661 return gfx::ColorSpace::CreateJpeg(); 661 case media::COLOR_SPACE_JPEG:
662 case media::COLOR_SPACE_HD_REC709: 662 return gfx::ColorSpace::CreateJpeg();
663 return gfx::ColorSpace::CreateREC709(); 663 case media::COLOR_SPACE_HD_REC709:
664 case media::COLOR_SPACE_SD_REC601: 664 return gfx::ColorSpace::CreateREC709();
665 return gfx::ColorSpace::CreateREC601(); 665 case media::COLOR_SPACE_SD_REC601:
666 default: 666 return gfx::ColorSpace::CreateREC601();
667 break; 667 default:
668 break;
669 }
668 } 670 }
669 } 671 }
670 return gfx::ColorSpace(); 672 return color_space_;
673 }
674
675 void VideoFrame::set_color_space(const gfx::ColorSpace& color_space) {
676 color_space_ = color_space;
671 } 677 }
672 678
673 int VideoFrame::stride(size_t plane) const { 679 int VideoFrame::stride(size_t plane) const {
674 DCHECK(IsValidPlane(plane, format_)); 680 DCHECK(IsValidPlane(plane, format_));
675 return strides_[plane]; 681 return strides_[plane];
676 } 682 }
677 683
678 int VideoFrame::row_bytes(size_t plane) const { 684 int VideoFrame::row_bytes(size_t plane) const {
679 return RowBytes(plane, format_, coded_size_.width()); 685 return RowBytes(plane, format_, coded_size_.width());
680 } 686 }
(...skipping 467 matching lines...) Expand 10 before | Expand all | Expand 10 after
1148 if (zero_initialize_memory) 1154 if (zero_initialize_memory)
1149 memset(data, 0, data_size); 1155 memset(data, 0, data_size);
1150 1156
1151 for (size_t plane = 0; plane < NumPlanes(format_); ++plane) 1157 for (size_t plane = 0; plane < NumPlanes(format_); ++plane)
1152 data_[plane] = data + offset[plane]; 1158 data_[plane] = data + offset[plane];
1153 1159
1154 AddDestructionObserver(base::Bind(&base::AlignedFree, data)); 1160 AddDestructionObserver(base::Bind(&base::AlignedFree, data));
1155 } 1161 }
1156 1162
1157 } // namespace media 1163 } // namespace media
OLDNEW
« no previous file with comments | « media/base/video_frame.h ('k') | media/media.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698