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

Side by Side Diff: cc/resources/video_resource_updater.cc

Issue 2745743002: Added BitsPerChannel method to video frame class. (Closed)
Patch Set: Added BitsPerChannel method to video frame class. 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 | « AUTHORS ('k') | media/base/video_frame.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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "cc/resources/video_resource_updater.h" 5 #include "cc/resources/video_resource_updater.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 367 matching lines...) Expand 10 before | Expand all | Expand 10 after
378 return std::unique_ptr<VideoResourceUpdater::HalfFloatMaker>( 378 return std::unique_ptr<VideoResourceUpdater::HalfFloatMaker>(
379 new HalfFloatMaker_libyuv(bits_per_channel)); 379 new HalfFloatMaker_libyuv(bits_per_channel));
380 } 380 }
381 } 381 }
382 382
383 VideoFrameExternalResources VideoResourceUpdater::CreateForSoftwarePlanes( 383 VideoFrameExternalResources VideoResourceUpdater::CreateForSoftwarePlanes(
384 scoped_refptr<media::VideoFrame> video_frame) { 384 scoped_refptr<media::VideoFrame> video_frame) {
385 TRACE_EVENT0("cc", "VideoResourceUpdater::CreateForSoftwarePlanes"); 385 TRACE_EVENT0("cc", "VideoResourceUpdater::CreateForSoftwarePlanes");
386 const media::VideoPixelFormat input_frame_format = video_frame->format(); 386 const media::VideoPixelFormat input_frame_format = video_frame->format();
387 387
388 // TODO(hubbe): Make this a video frame method. 388 int bits_per_channel = video_frame->BitsPerChannel(input_frame_format);
389 int bits_per_channel = 0;
390 switch (input_frame_format) {
391 case media::PIXEL_FORMAT_UNKNOWN:
392 NOTREACHED();
393 // Fall through!
394 case media::PIXEL_FORMAT_I420:
395 case media::PIXEL_FORMAT_YV12:
396 case media::PIXEL_FORMAT_YV16:
397 case media::PIXEL_FORMAT_YV12A:
398 case media::PIXEL_FORMAT_YV24:
399 case media::PIXEL_FORMAT_NV12:
400 case media::PIXEL_FORMAT_NV21:
401 case media::PIXEL_FORMAT_UYVY:
402 case media::PIXEL_FORMAT_YUY2:
403 case media::PIXEL_FORMAT_ARGB:
404 case media::PIXEL_FORMAT_XRGB:
405 case media::PIXEL_FORMAT_RGB24:
406 case media::PIXEL_FORMAT_RGB32:
407 case media::PIXEL_FORMAT_MJPEG:
408 case media::PIXEL_FORMAT_MT21:
409 case media::PIXEL_FORMAT_Y8:
410 case media::PIXEL_FORMAT_I422:
411 bits_per_channel = 8;
412 break;
413 case media::PIXEL_FORMAT_YUV420P9:
414 case media::PIXEL_FORMAT_YUV422P9:
415 case media::PIXEL_FORMAT_YUV444P9:
416 bits_per_channel = 9;
417 break;
418 case media::PIXEL_FORMAT_YUV420P10:
419 case media::PIXEL_FORMAT_YUV422P10:
420 case media::PIXEL_FORMAT_YUV444P10:
421 bits_per_channel = 10;
422 break;
423 case media::PIXEL_FORMAT_YUV420P12:
424 case media::PIXEL_FORMAT_YUV422P12:
425 case media::PIXEL_FORMAT_YUV444P12:
426 bits_per_channel = 12;
427 break;
428 case media::PIXEL_FORMAT_Y16:
429 bits_per_channel = 16;
430 break;
431 }
432 389
433 // Only YUV and Y16 software video frames are supported. 390 // Only YUV and Y16 software video frames are supported.
434 DCHECK(media::IsYuvPlanar(input_frame_format) || 391 DCHECK(media::IsYuvPlanar(input_frame_format) ||
435 input_frame_format == media::PIXEL_FORMAT_Y16); 392 input_frame_format == media::PIXEL_FORMAT_Y16);
436 393
437 const bool software_compositor = context_provider_ == NULL; 394 const bool software_compositor = context_provider_ == NULL;
438 395
439 ResourceFormat output_resource_format; 396 ResourceFormat output_resource_format;
440 if (input_frame_format == media::PIXEL_FORMAT_Y16) { 397 if (input_frame_format == media::PIXEL_FORMAT_Y16) {
441 // Unable to display directly as yuv planes so convert it to RGBA for 398 // Unable to display directly as yuv planes so convert it to RGBA for
(...skipping 370 matching lines...) Expand 10 before | Expand all | Expand 10 after
812 if (lost_resource) { 769 if (lost_resource) {
813 resource_it->clear_refs(); 770 resource_it->clear_refs();
814 updater->DeleteResource(resource_it); 771 updater->DeleteResource(resource_it);
815 return; 772 return;
816 } 773 }
817 774
818 resource_it->remove_ref(); 775 resource_it->remove_ref();
819 } 776 }
820 777
821 } // namespace cc 778 } // namespace cc
OLDNEW
« no previous file with comments | « AUTHORS ('k') | media/base/video_frame.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698