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

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

Issue 1221903003: Change the video color space default. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 5 years, 5 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 <algorithm> 7 #include <algorithm>
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 444 matching lines...) Expand 10 before | Expand all | Expand 10 after
455 const struct vpx_image* vpx_image_alpha, 455 const struct vpx_image* vpx_image_alpha,
456 scoped_refptr<VideoFrame>* video_frame) { 456 scoped_refptr<VideoFrame>* video_frame) {
457 CHECK(vpx_image); 457 CHECK(vpx_image);
458 CHECK(vpx_image->fmt == VPX_IMG_FMT_I420 || 458 CHECK(vpx_image->fmt == VPX_IMG_FMT_I420 ||
459 vpx_image->fmt == VPX_IMG_FMT_YV12 || 459 vpx_image->fmt == VPX_IMG_FMT_YV12 ||
460 vpx_image->fmt == VPX_IMG_FMT_I444); 460 vpx_image->fmt == VPX_IMG_FMT_I444);
461 461
462 VideoFrame::Format codec_format = VideoFrame::YV12; 462 VideoFrame::Format codec_format = VideoFrame::YV12;
463 int uv_rows = (vpx_image->d_h + 1) / 2; 463 int uv_rows = (vpx_image->d_h + 1) / 2;
464 464
465 VideoFrame::ColorSpace color_space = VideoFrame::COLOR_SPACE_UNSPECIFIED;
466 if (vpx_image->fmt == VPX_IMG_FMT_I444) { 465 if (vpx_image->fmt == VPX_IMG_FMT_I444) {
467 CHECK(!vpx_codec_alpha_); 466 CHECK(!vpx_codec_alpha_);
468 codec_format = VideoFrame::YV24; 467 codec_format = VideoFrame::YV24;
469 uv_rows = vpx_image->d_h; 468 uv_rows = vpx_image->d_h;
470 } else if (vpx_codec_alpha_) { 469 } else if (vpx_codec_alpha_) {
471 codec_format = VideoFrame::YV12A; 470 codec_format = VideoFrame::YV12A;
472 } 471 }
472
473 // Default to the color space from the config, but if the bistream specifies
474 // one, prefer that instead.
475 VideoFrame::ColorSpace color_space = config_.color_space();
473 if (vpx_image->cs == VPX_CS_BT_709) 476 if (vpx_image->cs == VPX_CS_BT_709)
474 color_space = VideoFrame::COLOR_SPACE_HD_REC709; 477 color_space = VideoFrame::COLOR_SPACE_HD_REC709;
478 else if (vpx_image->cs == VPX_CS_BT_601)
479 color_space = VideoFrame::COLOR_SPACE_SD_REC601;
475 480
476 // The mixed |w|/|d_h| in |coded_size| is intentional. Setting the correct 481 // The mixed |w|/|d_h| in |coded_size| is intentional. Setting the correct
477 // coded width is necessary to allow coalesced memory access, which may avoid 482 // coded width is necessary to allow coalesced memory access, which may avoid
478 // frame copies. Setting the correct coded height however does not have any 483 // frame copies. Setting the correct coded height however does not have any
479 // benefit, and only risk copying too much data. 484 // benefit, and only risk copying too much data.
480 const gfx::Size coded_size(vpx_image->w, vpx_image->d_h); 485 const gfx::Size coded_size(vpx_image->w, vpx_image->d_h);
481 const gfx::Size visible_size(vpx_image->d_w, vpx_image->d_h); 486 const gfx::Size visible_size(vpx_image->d_w, vpx_image->d_h);
482 487
483 if (!vpx_codec_alpha_ && memory_pool_.get()) { 488 if (!vpx_codec_alpha_ && memory_pool_.get()) {
484 *video_frame = VideoFrame::WrapExternalYuvData( 489 *video_frame = VideoFrame::WrapExternalYuvData(
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
526 vpx_image->stride[VPX_PLANE_Y], vpx_image->d_h, video_frame->get()); 531 vpx_image->stride[VPX_PLANE_Y], vpx_image->d_h, video_frame->get());
527 return; 532 return;
528 } 533 }
529 CopyAPlane(vpx_image_alpha->planes[VPX_PLANE_Y], 534 CopyAPlane(vpx_image_alpha->planes[VPX_PLANE_Y],
530 vpx_image_alpha->stride[VPX_PLANE_Y], 535 vpx_image_alpha->stride[VPX_PLANE_Y],
531 vpx_image_alpha->d_h, 536 vpx_image_alpha->d_h,
532 video_frame->get()); 537 video_frame->get());
533 } 538 }
534 539
535 } // namespace media 540 } // namespace media
OLDNEW
« no previous file with comments | « media/filters/ffmpeg_video_decoder_unittest.cc ('k') | media/formats/mp2t/es_adapter_video_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698