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

Side by Side Diff: content/renderer/pepper/video_decoder_shim.cc

Issue 1228843003: Revert of Change the video color space default. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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
« no previous file with comments | « content/browser/media/media_browsertest.cc ('k') | media/base/test_helpers.cc » ('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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "content/renderer/pepper/video_decoder_shim.h" 5 #include "content/renderer/pepper/video_decoder_shim.h"
6 6
7 #include <GLES2/gl2.h> 7 #include <GLES2/gl2.h>
8 #include <GLES2/gl2ext.h> 8 #include <GLES2/gl2ext.h>
9 #include <GLES2/gl2extchromium.h> 9 #include <GLES2/gl2extchromium.h>
10 10
(...skipping 356 matching lines...) Expand 10 before | Expand all | Expand 10 after
367 // U - 128 : Turns unsigned U into signed U [-128,127] 367 // U - 128 : Turns unsigned U into signed U [-128,127]
368 // V - 128 : Turns unsigned V into signed V [-128,127] 368 // V - 128 : Turns unsigned V into signed V [-128,127]
369 const float yuv_adjust_constrained[3] = { 369 const float yuv_adjust_constrained[3] = {
370 -0.0625f, -0.5f, -0.5f, 370 -0.0625f, -0.5f, -0.5f,
371 }; 371 };
372 // Same as above, but without the head and footroom. 372 // Same as above, but without the head and footroom.
373 const float yuv_adjust_full[3] = { 373 const float yuv_adjust_full[3] = {
374 0.0f, -0.5f, -0.5f, 374 0.0f, -0.5f, -0.5f,
375 }; 375 };
376 376
377 yuv_adjust = yuv_adjust_constrained;
378 yuv_matrix = yuv_to_rgb_rec601;
379
380 int result;
381 if (frame->metadata()->GetInteger(
382 media::VideoFrameMetadata::COLOR_SPACE, &result)) {
383 if (result == media::VideoFrame::COLOR_SPACE_JPEG) {
384 yuv_matrix = yuv_to_rgb_jpeg;
385 yuv_adjust = yuv_adjust_full;
386 } else if (result == media::VideoFrame::COLOR_SPACE_HD_REC709) {
387 yuv_matrix = yuv_to_rgb_rec709;
388 }
389 }
390
391 switch (frame->format()) { 377 switch (frame->format()) {
392 case media::VideoFrame::YV12: // 420 378 case media::VideoFrame::YV12: // 420
393 case media::VideoFrame::YV12A: 379 case media::VideoFrame::YV12A:
394 case media::VideoFrame::I420: 380 case media::VideoFrame::I420:
395 uv_height_divisor_ = 2; 381 uv_height_divisor_ = 2;
396 uv_width_divisor_ = 2; 382 uv_width_divisor_ = 2;
383 yuv_adjust = yuv_adjust_constrained;
384 int result;
385 if (frame->metadata()->GetInteger(
386 media::VideoFrameMetadata::COLOR_SPACE, &result)) {
387 if (result == media::VideoFrame::COLOR_SPACE_JPEG) {
388 yuv_matrix = yuv_to_rgb_jpeg;
389 yuv_adjust = yuv_adjust_full;
390 } else {
391 yuv_matrix = yuv_to_rgb_rec709;
392 }
393 } else {
394 yuv_matrix = yuv_to_rgb_rec601;
395 }
397 break; 396 break;
398 case media::VideoFrame::YV16: // 422 397 case media::VideoFrame::YV16: // 422
399 uv_width_divisor_ = 2; 398 uv_width_divisor_ = 2;
400 uv_height_divisor_ = 1; 399 uv_height_divisor_ = 1;
400 yuv_matrix = yuv_to_rgb_rec601;
401 yuv_adjust = yuv_adjust_constrained;
401 break; 402 break;
402 case media::VideoFrame::YV24: // 444 403 case media::VideoFrame::YV24: // 444
403 uv_width_divisor_ = 1; 404 uv_width_divisor_ = 1;
404 uv_height_divisor_ = 1; 405 uv_height_divisor_ = 1;
406 yuv_matrix = yuv_to_rgb_rec601;
407 yuv_adjust = yuv_adjust_constrained;
405 break; 408 break;
406 409
407 default: 410 default:
408 NOTREACHED(); 411 NOTREACHED();
409 } 412 }
410 413
411 video_format_ = frame->format(); 414 video_format_ = frame->format();
412 415
413 // Zero these so everything is reset below. 416 // Zero these so everything is reset below.
414 y_width_ = y_height_ = 0; 417 y_width_ = y_height_ = 0;
(...skipping 439 matching lines...) Expand 10 before | Expand all | Expand 10 after
854 DCHECK_NE(codec, media::kUnknownVideoCodec); 857 DCHECK_NE(codec, media::kUnknownVideoCodec);
855 858
856 if (!yuv_converter_->Initialize()) { 859 if (!yuv_converter_->Initialize()) {
857 return false; 860 return false;
858 } 861 }
859 862
860 media::VideoDecoderConfig config( 863 media::VideoDecoderConfig config(
861 codec, 864 codec,
862 profile, 865 profile,
863 media::VideoFrame::YV12, 866 media::VideoFrame::YV12,
864 media::VideoFrame::COLOR_SPACE_UNSPECIFIED,
865 gfx::Size(32, 24), // Small sizes that won't fail. 867 gfx::Size(32, 24), // Small sizes that won't fail.
866 gfx::Rect(32, 24), 868 gfx::Rect(32, 24),
867 gfx::Size(32, 24), 869 gfx::Size(32, 24),
868 NULL /* extra_data */, // TODO(bbudge) Verify this isn't needed. 870 NULL /* extra_data */, // TODO(bbudge) Verify this isn't needed.
869 0 /* extra_data_size */, 871 0 /* extra_data_size */,
870 false /* decryption */); 872 false /* decryption */);
871 873
872 media_task_runner_->PostTask( 874 media_task_runner_->PostTask(
873 FROM_HERE, 875 FROM_HERE,
874 base::Bind(&VideoDecoderShim::DecoderImpl::Initialize, 876 base::Bind(&VideoDecoderShim::DecoderImpl::Initialize,
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after
1092 void VideoDecoderShim::DeleteTexture(uint32_t texture_id) { 1094 void VideoDecoderShim::DeleteTexture(uint32_t texture_id) {
1093 gpu::gles2::GLES2Interface* gles2 = context_provider_->ContextGL(); 1095 gpu::gles2::GLES2Interface* gles2 = context_provider_->ContextGL();
1094 gles2->DeleteTextures(1, &texture_id); 1096 gles2->DeleteTextures(1, &texture_id);
1095 } 1097 }
1096 1098
1097 void VideoDecoderShim::FlushCommandBuffer() { 1099 void VideoDecoderShim::FlushCommandBuffer() {
1098 context_provider_->ContextGL()->Flush(); 1100 context_provider_->ContextGL()->Flush();
1099 } 1101 }
1100 1102
1101 } // namespace content 1103 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/media/media_browsertest.cc ('k') | media/base/test_helpers.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698