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

Side by Side Diff: media/base/video_frame.cc

Issue 2096813002: media/vpx: Add support for VP9 alpha channel (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: add test files for real Created 4 years, 6 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 | « media/base/video_frame.h ('k') | media/filters/vpx_video_decoder.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 (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/base/video_frame.h" 5 #include "media/base/video_frame.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <climits> 8 #include <climits>
9 9
10 #include "base/atomic_sequence_num.h" 10 #include "base/atomic_sequence_num.h"
(...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after
280 frame->strides_[kVPlane] = v_stride; 280 frame->strides_[kVPlane] = v_stride;
281 frame->data_[kYPlane] = y_data; 281 frame->data_[kYPlane] = y_data;
282 frame->data_[kUPlane] = u_data; 282 frame->data_[kUPlane] = u_data;
283 frame->data_[kVPlane] = v_data; 283 frame->data_[kVPlane] = v_data;
284 frame->gpu_memory_buffer_handles_.push_back(y_handle); 284 frame->gpu_memory_buffer_handles_.push_back(y_handle);
285 frame->gpu_memory_buffer_handles_.push_back(u_handle); 285 frame->gpu_memory_buffer_handles_.push_back(u_handle);
286 frame->gpu_memory_buffer_handles_.push_back(v_handle); 286 frame->gpu_memory_buffer_handles_.push_back(v_handle);
287 return frame; 287 return frame;
288 } 288 }
289 289
290 // static
291 scoped_refptr<VideoFrame> VideoFrame::WrapExternalYuvaData(
292 VideoPixelFormat format,
293 const gfx::Size& coded_size,
294 const gfx::Rect& visible_rect,
295 const gfx::Size& natural_size,
296 int32_t y_stride,
297 int32_t u_stride,
298 int32_t v_stride,
299 int32_t a_stride,
300 uint8_t* y_data,
301 uint8_t* u_data,
302 uint8_t* v_data,
303 uint8_t* a_data,
304 base::TimeDelta timestamp) {
305 const StorageType storage = STORAGE_UNOWNED_MEMORY;
306 if (!IsValidConfig(format, storage, coded_size, visible_rect, natural_size)) {
307 LOG(DFATAL) << __FUNCTION__ << " Invalid config."
308 << ConfigToString(format, storage, coded_size, visible_rect,
309 natural_size);
310 return nullptr;
311 }
312
313 if (NumPlanes(format) != 4) {
314 LOG(DFATAL) << "Expecting Y, U, V and A planes to be present for the video"
315 << " format.";
316 return nullptr;
317 }
318
319 scoped_refptr<VideoFrame> frame(new VideoFrame(
320 format, storage, coded_size, visible_rect, natural_size, timestamp));
321 frame->strides_[kYPlane] = y_stride;
322 frame->strides_[kUPlane] = u_stride;
323 frame->strides_[kVPlane] = v_stride;
324 frame->strides_[kAPlane] = a_stride;
325 frame->data_[kYPlane] = y_data;
326 frame->data_[kUPlane] = u_data;
327 frame->data_[kVPlane] = v_data;
328 frame->data_[kAPlane] = a_data;
329 return frame;
330 }
331
290 #if defined(OS_LINUX) 332 #if defined(OS_LINUX)
291 // static 333 // static
292 scoped_refptr<VideoFrame> VideoFrame::WrapExternalDmabufs( 334 scoped_refptr<VideoFrame> VideoFrame::WrapExternalDmabufs(
293 VideoPixelFormat format, 335 VideoPixelFormat format,
294 const gfx::Size& coded_size, 336 const gfx::Size& coded_size,
295 const gfx::Rect& visible_rect, 337 const gfx::Rect& visible_rect,
296 const gfx::Size& natural_size, 338 const gfx::Size& natural_size,
297 const std::vector<int>& dmabuf_fds, 339 const std::vector<int>& dmabuf_fds,
298 base::TimeDelta timestamp) { 340 base::TimeDelta timestamp) {
299 const StorageType storage = STORAGE_DMABUFS; 341 const StorageType storage = STORAGE_DMABUFS;
(...skipping 788 matching lines...) Expand 10 before | Expand all | Expand 10 after
1088 if (zero_initialize_memory) 1130 if (zero_initialize_memory)
1089 memset(data, 0, data_size); 1131 memset(data, 0, data_size);
1090 1132
1091 for (size_t plane = 0; plane < NumPlanes(format_); ++plane) 1133 for (size_t plane = 0; plane < NumPlanes(format_); ++plane)
1092 data_[plane] = data + offset[plane]; 1134 data_[plane] = data + offset[plane];
1093 1135
1094 AddDestructionObserver(base::Bind(&base::AlignedFree, data)); 1136 AddDestructionObserver(base::Bind(&base::AlignedFree, data));
1095 } 1137 }
1096 1138
1097 } // namespace media 1139 } // namespace media
OLDNEW
« no previous file with comments | « media/base/video_frame.h ('k') | media/filters/vpx_video_decoder.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698