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

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

Issue 1221903003: Change the video color space default. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Disable the JPEG blackwhite test 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 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
377 switch (frame->format()) { 391 switch (frame->format()) {
378 case media::VideoFrame::YV12: // 420 392 case media::VideoFrame::YV12: // 420
379 case media::VideoFrame::YV12A: 393 case media::VideoFrame::YV12A:
380 case media::VideoFrame::I420: 394 case media::VideoFrame::I420:
381 uv_height_divisor_ = 2; 395 uv_height_divisor_ = 2;
382 uv_width_divisor_ = 2; 396 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 }
396 break; 397 break;
397 case media::VideoFrame::YV16: // 422 398 case media::VideoFrame::YV16: // 422
398 uv_width_divisor_ = 2; 399 uv_width_divisor_ = 2;
399 uv_height_divisor_ = 1; 400 uv_height_divisor_ = 1;
400 yuv_matrix = yuv_to_rgb_rec601;
401 yuv_adjust = yuv_adjust_constrained;
402 break; 401 break;
403 case media::VideoFrame::YV24: // 444 402 case media::VideoFrame::YV24: // 444
404 uv_width_divisor_ = 1; 403 uv_width_divisor_ = 1;
405 uv_height_divisor_ = 1; 404 uv_height_divisor_ = 1;
406 yuv_matrix = yuv_to_rgb_rec601;
407 yuv_adjust = yuv_adjust_constrained;
408 break; 405 break;
409 406
410 default: 407 default:
411 NOTREACHED(); 408 NOTREACHED();
412 } 409 }
413 410
414 video_format_ = frame->format(); 411 video_format_ = frame->format();
415 412
416 // Zero these so everything is reset below. 413 // Zero these so everything is reset below.
417 y_width_ = y_height_ = 0; 414 y_width_ = y_height_ = 0;
(...skipping 439 matching lines...) Expand 10 before | Expand all | Expand 10 after
857 DCHECK_NE(codec, media::kUnknownVideoCodec); 854 DCHECK_NE(codec, media::kUnknownVideoCodec);
858 855
859 if (!yuv_converter_->Initialize()) { 856 if (!yuv_converter_->Initialize()) {
860 return false; 857 return false;
861 } 858 }
862 859
863 media::VideoDecoderConfig config( 860 media::VideoDecoderConfig config(
864 codec, 861 codec,
865 profile, 862 profile,
866 media::VideoFrame::YV12, 863 media::VideoFrame::YV12,
864 // XXX: Should we change this default too?
DaleCurtis 2015/07/06 22:36:14 Maybe bbudge@ knows.
865 media::VideoFrame::COLOR_SPACE_UNSPECIFIED,
867 gfx::Size(32, 24), // Small sizes that won't fail. 866 gfx::Size(32, 24), // Small sizes that won't fail.
868 gfx::Rect(32, 24), 867 gfx::Rect(32, 24),
869 gfx::Size(32, 24), 868 gfx::Size(32, 24),
870 NULL /* extra_data */, // TODO(bbudge) Verify this isn't needed. 869 NULL /* extra_data */, // TODO(bbudge) Verify this isn't needed.
871 0 /* extra_data_size */, 870 0 /* extra_data_size */,
872 false /* decryption */); 871 false /* decryption */);
873 872
874 media_task_runner_->PostTask( 873 media_task_runner_->PostTask(
875 FROM_HERE, 874 FROM_HERE,
876 base::Bind(&VideoDecoderShim::DecoderImpl::Initialize, 875 base::Bind(&VideoDecoderShim::DecoderImpl::Initialize,
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after
1094 void VideoDecoderShim::DeleteTexture(uint32_t texture_id) { 1093 void VideoDecoderShim::DeleteTexture(uint32_t texture_id) {
1095 gpu::gles2::GLES2Interface* gles2 = context_provider_->ContextGL(); 1094 gpu::gles2::GLES2Interface* gles2 = context_provider_->ContextGL();
1096 gles2->DeleteTextures(1, &texture_id); 1095 gles2->DeleteTextures(1, &texture_id);
1097 } 1096 }
1098 1097
1099 void VideoDecoderShim::FlushCommandBuffer() { 1098 void VideoDecoderShim::FlushCommandBuffer() {
1100 context_provider_->ContextGL()->Flush(); 1099 context_provider_->ContextGL()->Flush();
1101 } 1100 }
1102 1101
1103 } // namespace content 1102 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698