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

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

Issue 88403004: Add plumbing for video pixel formats with JPEG color range. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add YV12J to a DCHECK Created 7 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
« no previous file with comments | « no previous file | 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 "base/bind.h" 7 #include "base/bind.h"
8 #include "cc/output/gl_renderer.h" 8 #include "cc/output/gl_renderer.h"
9 #include "cc/resources/resource_provider.h" 9 #include "cc/resources/resource_provider.h"
10 #include "gpu/GLES2/gl2extchromium.h" 10 #include "gpu/GLES2/gl2extchromium.h"
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
62 // UVs. For now, just expect (0, 0) offset, since all our decoders so far 62 // UVs. For now, just expect (0, 0) offset, since all our decoders so far
63 // don't offset. 63 // don't offset.
64 DCHECK_EQ(video_frame->visible_rect().x(), 0); 64 DCHECK_EQ(video_frame->visible_rect().x(), 0);
65 DCHECK_EQ(video_frame->visible_rect().y(), 0); 65 DCHECK_EQ(video_frame->visible_rect().y(), 0);
66 66
67 switch (video_frame->format()) { 67 switch (video_frame->format()) {
68 // Acceptable inputs. 68 // Acceptable inputs.
69 case media::VideoFrame::YV12: 69 case media::VideoFrame::YV12:
70 case media::VideoFrame::YV12A: 70 case media::VideoFrame::YV12A:
71 case media::VideoFrame::YV16: 71 case media::VideoFrame::YV16:
72 case media::VideoFrame::YV12J:
72 case media::VideoFrame::NATIVE_TEXTURE: 73 case media::VideoFrame::NATIVE_TEXTURE:
73 #if defined(GOOGLE_TV) 74 #if defined(GOOGLE_TV)
74 case media::VideoFrame::HOLE: 75 case media::VideoFrame::HOLE:
75 #endif 76 #endif
76 return true; 77 return true;
77 78
78 // Unacceptable inputs. ¯\(°_o)/¯ 79 // Unacceptable inputs. ¯\(°_o)/¯
79 case media::VideoFrame::UNKNOWN: 80 case media::VideoFrame::UNKNOWN:
80 case media::VideoFrame::HISTOGRAM_MAX: 81 case media::VideoFrame::HISTOGRAM_MAX:
81 case media::VideoFrame::I420: 82 case media::VideoFrame::I420:
(...skipping 10 matching lines...) Expand all
92 ResourceFormat output_resource_format, 93 ResourceFormat output_resource_format,
93 int plane_index) { 94 int plane_index) {
94 if (output_resource_format == kYUVResourceFormat) { 95 if (output_resource_format == kYUVResourceFormat) {
95 if (plane_index == media::VideoFrame::kYPlane || 96 if (plane_index == media::VideoFrame::kYPlane ||
96 plane_index == media::VideoFrame::kAPlane) 97 plane_index == media::VideoFrame::kAPlane)
97 return coded_size; 98 return coded_size;
98 99
99 switch (input_frame_format) { 100 switch (input_frame_format) {
100 case media::VideoFrame::YV12: 101 case media::VideoFrame::YV12:
101 case media::VideoFrame::YV12A: 102 case media::VideoFrame::YV12A:
103 case media::VideoFrame::YV12J:
102 return gfx::ToFlooredSize(gfx::ScaleSize(coded_size, 0.5f, 0.5f)); 104 return gfx::ToFlooredSize(gfx::ScaleSize(coded_size, 0.5f, 0.5f));
103 case media::VideoFrame::YV16: 105 case media::VideoFrame::YV16:
104 return gfx::ToFlooredSize(gfx::ScaleSize(coded_size, 0.5f, 1.f)); 106 return gfx::ToFlooredSize(gfx::ScaleSize(coded_size, 0.5f, 1.f));
105 107
106 case media::VideoFrame::UNKNOWN: 108 case media::VideoFrame::UNKNOWN:
107 case media::VideoFrame::I420: 109 case media::VideoFrame::I420:
108 case media::VideoFrame::NATIVE_TEXTURE: 110 case media::VideoFrame::NATIVE_TEXTURE:
109 case media::VideoFrame::HISTOGRAM_MAX: 111 case media::VideoFrame::HISTOGRAM_MAX:
110 #if defined(GOOGLE_TV) 112 #if defined(GOOGLE_TV)
111 case media::VideoFrame::HOLE: 113 case media::VideoFrame::HOLE:
(...skipping 14 matching lines...) Expand all
126 if (input_frame_format == media::VideoFrame::HOLE) { 128 if (input_frame_format == media::VideoFrame::HOLE) {
127 VideoFrameExternalResources external_resources; 129 VideoFrameExternalResources external_resources;
128 external_resources.type = VideoFrameExternalResources::HOLE; 130 external_resources.type = VideoFrameExternalResources::HOLE;
129 return external_resources; 131 return external_resources;
130 } 132 }
131 #endif 133 #endif
132 134
133 // Only YUV software video frames are supported. 135 // Only YUV software video frames are supported.
134 DCHECK(input_frame_format == media::VideoFrame::YV12 || 136 DCHECK(input_frame_format == media::VideoFrame::YV12 ||
135 input_frame_format == media::VideoFrame::YV12A || 137 input_frame_format == media::VideoFrame::YV12A ||
138 input_frame_format == media::VideoFrame::YV12J ||
136 input_frame_format == media::VideoFrame::YV16); 139 input_frame_format == media::VideoFrame::YV16);
137 if (input_frame_format != media::VideoFrame::YV12 && 140 if (input_frame_format != media::VideoFrame::YV12 &&
138 input_frame_format != media::VideoFrame::YV12A && 141 input_frame_format != media::VideoFrame::YV12A &&
142 input_frame_format != media::VideoFrame::YV12J &&
139 input_frame_format != media::VideoFrame::YV16) 143 input_frame_format != media::VideoFrame::YV16)
140 return VideoFrameExternalResources(); 144 return VideoFrameExternalResources();
141 145
142 bool software_compositor = context_provider_ == NULL; 146 bool software_compositor = context_provider_ == NULL;
143 147
144 ResourceFormat output_resource_format = kYUVResourceFormat; 148 ResourceFormat output_resource_format = kYUVResourceFormat;
145 size_t output_plane_count = 149 size_t output_plane_count =
146 (input_frame_format == media::VideoFrame::YV12A) ? 4 : 3; 150 (input_frame_format == media::VideoFrame::YV12A) ? 4 : 3;
147 151
148 // TODO(skaslev): If we're in software compositing mode, we do the YUV -> RGB 152 // TODO(skaslev): If we're in software compositing mode, we do the YUV -> RGB
(...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after
398 } 402 }
399 403
400 PlaneResource recycled_resource(data.resource_id, 404 PlaneResource recycled_resource(data.resource_id,
401 data.resource_size, 405 data.resource_size,
402 data.resource_format, 406 data.resource_format,
403 data.mailbox); 407 data.mailbox);
404 updater->recycled_resources_.push_back(recycled_resource); 408 updater->recycled_resources_.push_back(recycled_resource);
405 } 409 }
406 410
407 } // namespace cc 411 } // namespace cc
OLDNEW
« no previous file with comments | « no previous file | media/base/video_frame.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698