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

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

Issue 978483002: Support VP9 video in the BT709 color space. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Move comment Created 5 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 | « no previous file | media/test/data/bear-vp9-bt709.webm » ('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 <algorithm> 7 #include <algorithm>
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 447 matching lines...) Expand 10 before | Expand all | Expand 10 after
458 vpx_image->fmt == VPX_IMG_FMT_I444); 458 vpx_image->fmt == VPX_IMG_FMT_I444);
459 459
460 VideoFrame::Format codec_format = VideoFrame::YV12; 460 VideoFrame::Format codec_format = VideoFrame::YV12;
461 int uv_rows = (vpx_image->d_h + 1) / 2; 461 int uv_rows = (vpx_image->d_h + 1) / 2;
462 462
463 if (vpx_image->fmt == VPX_IMG_FMT_I444) { 463 if (vpx_image->fmt == VPX_IMG_FMT_I444) {
464 CHECK(!vpx_codec_alpha_); 464 CHECK(!vpx_codec_alpha_);
465 codec_format = VideoFrame::YV24; 465 codec_format = VideoFrame::YV24;
466 uv_rows = vpx_image->d_h; 466 uv_rows = vpx_image->d_h;
467 } else if (vpx_codec_alpha_) { 467 } else if (vpx_codec_alpha_) {
468 // TODO(watk): A limitation of conflating color space with pixel format is
469 // that it's not possible to have BT709 with alpha.
470 // Until color space is separated from format, prefer YV12A over YV12HD.
468 codec_format = VideoFrame::YV12A; 471 codec_format = VideoFrame::YV12A;
472 } else if (vpx_image->cs == VPX_CS_BT_709) {
473 codec_format = VideoFrame::YV12HD;
469 } 474 }
470 475
471 gfx::Size size(vpx_image->d_w, vpx_image->d_h); 476 gfx::Size size(vpx_image->d_w, vpx_image->d_h);
472 477
473 if (!vpx_codec_alpha_ && memory_pool_.get()) { 478 if (!vpx_codec_alpha_ && memory_pool_.get()) {
474 *video_frame = VideoFrame::WrapExternalYuvData( 479 *video_frame = VideoFrame::WrapExternalYuvData(
475 codec_format, 480 codec_format,
476 size, gfx::Rect(size), config_.natural_size(), 481 size, gfx::Rect(size), config_.natural_size(),
477 vpx_image->stride[VPX_PLANE_Y], 482 vpx_image->stride[VPX_PLANE_Y],
478 vpx_image->stride[VPX_PLANE_U], 483 vpx_image->stride[VPX_PLANE_U],
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
511 vpx_image->stride[VPX_PLANE_Y], vpx_image->d_h, video_frame->get()); 516 vpx_image->stride[VPX_PLANE_Y], vpx_image->d_h, video_frame->get());
512 return; 517 return;
513 } 518 }
514 CopyAPlane(vpx_image_alpha->planes[VPX_PLANE_Y], 519 CopyAPlane(vpx_image_alpha->planes[VPX_PLANE_Y],
515 vpx_image_alpha->stride[VPX_PLANE_Y], 520 vpx_image_alpha->stride[VPX_PLANE_Y],
516 vpx_image_alpha->d_h, 521 vpx_image_alpha->d_h,
517 video_frame->get()); 522 video_frame->get());
518 } 523 }
519 524
520 } // namespace media 525 } // namespace media
OLDNEW
« no previous file with comments | « no previous file | media/test/data/bear-vp9-bt709.webm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698