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

Side by Side Diff: media/renderers/skcanvas_video_renderer.cc

Issue 2571163002: Add PIXEL_FORMAT_I422. (Closed)
Patch Set: move switch cases to align with the enum value order Created 4 years 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/renderers/skcanvas_video_renderer.h" 5 #include "media/renderers/skcanvas_video_renderer.h"
6 6
7 #include <limits> 7 #include <limits>
8 8
9 #include "base/macros.h" 9 #include "base/macros.h"
10 #include "gpu/GLES2/gl2extchromium.h" 10 #include "gpu/GLES2/gl2extchromium.h"
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
80 private: 80 private:
81 gpu::gles2::GLES2Interface* gl_; 81 gpu::gles2::GLES2Interface* gl_;
82 82
83 DISALLOW_IMPLICIT_CONSTRUCTORS(SyncTokenClientImpl); 83 DISALLOW_IMPLICIT_CONSTRUCTORS(SyncTokenClientImpl);
84 }; 84 };
85 85
86 sk_sp<SkImage> NewSkImageFromVideoFrameYUVTextures( 86 sk_sp<SkImage> NewSkImageFromVideoFrameYUVTextures(
87 const VideoFrame* video_frame, 87 const VideoFrame* video_frame,
88 const Context3D& context_3d) { 88 const Context3D& context_3d) {
89 DCHECK(video_frame->HasTextures()); 89 DCHECK(video_frame->HasTextures());
90 // TODO: We should compare the DCHECK vs when UpdateLastImage calls this
91 // function. (crbug.com/674185)
90 DCHECK(video_frame->format() == PIXEL_FORMAT_I420 || 92 DCHECK(video_frame->format() == PIXEL_FORMAT_I420 ||
91 video_frame->format() == PIXEL_FORMAT_NV12); 93 video_frame->format() == PIXEL_FORMAT_NV12);
92 94
93 gpu::gles2::GLES2Interface* gl = context_3d.gl; 95 gpu::gles2::GLES2Interface* gl = context_3d.gl;
94 DCHECK(gl); 96 DCHECK(gl);
95 gfx::Size ya_tex_size = video_frame->coded_size(); 97 gfx::Size ya_tex_size = video_frame->coded_size();
96 gfx::Size uv_tex_size((ya_tex_size.width() + 1) / 2, 98 gfx::Size uv_tex_size((ya_tex_size.width() + 1) / 2,
97 (ya_tex_size.height() + 1) / 2); 99 (ya_tex_size.height() + 1) / 2);
98 100
99 GrGLTextureInfo source_textures[] = {{0, 0}, {0, 0}, {0, 0}}; 101 GrGLTextureInfo source_textures[] = {{0, 0}, {0, 0}, {0, 0}};
(...skipping 547 matching lines...) Expand 10 before | Expand all | Expand 10 after
647 video_frame->visible_data(VideoFrame::kUPlane), 649 video_frame->visible_data(VideoFrame::kUPlane),
648 video_frame->stride(VideoFrame::kUPlane), 650 video_frame->stride(VideoFrame::kUPlane),
649 video_frame->visible_data(VideoFrame::kVPlane), 651 video_frame->visible_data(VideoFrame::kVPlane),
650 video_frame->stride(VideoFrame::kVPlane), 652 video_frame->stride(VideoFrame::kVPlane),
651 static_cast<uint8_t*>(rgb_pixels), row_bytes, 653 static_cast<uint8_t*>(rgb_pixels), row_bytes,
652 video_frame->visible_rect().width(), 654 video_frame->visible_rect().width(),
653 video_frame->visible_rect().height()); 655 video_frame->visible_rect().height());
654 } 656 }
655 break; 657 break;
656 case PIXEL_FORMAT_YV16: 658 case PIXEL_FORMAT_YV16:
659 case PIXEL_FORMAT_I422:
657 LIBYUV_I422_TO_ARGB(video_frame->visible_data(VideoFrame::kYPlane), 660 LIBYUV_I422_TO_ARGB(video_frame->visible_data(VideoFrame::kYPlane),
658 video_frame->stride(VideoFrame::kYPlane), 661 video_frame->stride(VideoFrame::kYPlane),
659 video_frame->visible_data(VideoFrame::kUPlane), 662 video_frame->visible_data(VideoFrame::kUPlane),
660 video_frame->stride(VideoFrame::kUPlane), 663 video_frame->stride(VideoFrame::kUPlane),
661 video_frame->visible_data(VideoFrame::kVPlane), 664 video_frame->visible_data(VideoFrame::kVPlane),
662 video_frame->stride(VideoFrame::kVPlane), 665 video_frame->stride(VideoFrame::kVPlane),
663 static_cast<uint8_t*>(rgb_pixels), row_bytes, 666 static_cast<uint8_t*>(rgb_pixels), row_bytes,
664 video_frame->visible_rect().width(), 667 video_frame->visible_rect().width(),
665 video_frame->visible_rect().height()); 668 video_frame->visible_rect().height());
666 break; 669 break;
(...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after
932 last_image_->bounds().contains(visible_rect)) { 935 last_image_->bounds().contains(visible_rect)) {
933 last_image_ = last_image_->makeSubset(visible_rect); 936 last_image_ = last_image_->makeSubset(visible_rect);
934 } 937 }
935 } 938 }
936 939
937 SkISize SkCanvasVideoRenderer::LastImageDimensionsForTesting() { 940 SkISize SkCanvasVideoRenderer::LastImageDimensionsForTesting() {
938 return last_image_dimensions_for_testing_; 941 return last_image_dimensions_for_testing_;
939 } 942 }
940 943
941 } // namespace media 944 } // namespace media
OLDNEW
« no previous file with comments | « media/remoting/rpc/proto_enum_utils.cc ('k') | media/video/gpu_memory_buffer_video_frame_pool.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698