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

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

Issue 2746013006: use VideoColorSpace in decoder configuration (Closed)
Patch Set: oops, win compile fix reapplied Created 3 years, 9 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/filters/h264_parser.cc ('k') | media/formats/webm/webm_colour_parser.h » ('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/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 580 matching lines...) Expand 10 before | Expand all | Expand 10 after
591 // one, prefer that instead. 591 // one, prefer that instead.
592 ColorSpace color_space = config_.color_space(); 592 ColorSpace color_space = config_.color_space();
593 if (vpx_image->cs == VPX_CS_BT_709) 593 if (vpx_image->cs == VPX_CS_BT_709)
594 color_space = COLOR_SPACE_HD_REC709; 594 color_space = COLOR_SPACE_HD_REC709;
595 else if (vpx_image->cs == VPX_CS_BT_601 || vpx_image->cs == VPX_CS_SMPTE_170) 595 else if (vpx_image->cs == VPX_CS_BT_601 || vpx_image->cs == VPX_CS_SMPTE_170)
596 color_space = COLOR_SPACE_SD_REC601; 596 color_space = COLOR_SPACE_SD_REC601;
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() != VideoColorSpace()) {
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)
606 ->set_color_space(config_.color_space_info().ToGfxColorSpace());
606 } else { 607 } else {
607 gfx::ColorSpace::PrimaryID primaries = gfx::ColorSpace::PrimaryID::INVALID; 608 gfx::ColorSpace::PrimaryID primaries = gfx::ColorSpace::PrimaryID::INVALID;
608 gfx::ColorSpace::TransferID transfer = gfx::ColorSpace::TransferID::INVALID; 609 gfx::ColorSpace::TransferID transfer = gfx::ColorSpace::TransferID::INVALID;
609 gfx::ColorSpace::MatrixID matrix = gfx::ColorSpace::MatrixID::INVALID; 610 gfx::ColorSpace::MatrixID matrix = gfx::ColorSpace::MatrixID::INVALID;
610 gfx::ColorSpace::RangeID range = vpx_image->range == VPX_CR_FULL_RANGE 611 gfx::ColorSpace::RangeID range = vpx_image->range == VPX_CR_FULL_RANGE
611 ? gfx::ColorSpace::RangeID::FULL 612 ? gfx::ColorSpace::RangeID::FULL
612 : gfx::ColorSpace::RangeID::LIMITED; 613 : gfx::ColorSpace::RangeID::LIMITED;
613 614
614 switch (vpx_image->cs) { 615 switch (vpx_image->cs) {
615 case VPX_CS_BT_601: 616 case VPX_CS_BT_601:
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after
845 (*video_frame)->visible_data(VideoFrame::kUPlane), 846 (*video_frame)->visible_data(VideoFrame::kUPlane),
846 (*video_frame)->stride(VideoFrame::kUPlane), 847 (*video_frame)->stride(VideoFrame::kUPlane),
847 (*video_frame)->visible_data(VideoFrame::kVPlane), 848 (*video_frame)->visible_data(VideoFrame::kVPlane),
848 (*video_frame)->stride(VideoFrame::kVPlane), coded_size.width(), 849 (*video_frame)->stride(VideoFrame::kVPlane), coded_size.width(),
849 coded_size.height()); 850 coded_size.height());
850 851
851 return true; 852 return true;
852 } 853 }
853 854
854 } // namespace media 855 } // namespace media
OLDNEW
« no previous file with comments | « media/filters/h264_parser.cc ('k') | media/formats/webm/webm_colour_parser.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698