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

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

Issue 1608113002: Revert of media/vpx: Add support for VP9 alpha channel (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 11 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/bind.h" 10 #include "base/bind.h"
(...skipping 357 matching lines...) Expand 10 before | Expand all | Expand 10 after
368 frame->strides_[kVPlane] = v_stride; 368 frame->strides_[kVPlane] = v_stride;
369 frame->data_[kYPlane] = y_data; 369 frame->data_[kYPlane] = y_data;
370 frame->data_[kUPlane] = u_data; 370 frame->data_[kUPlane] = u_data;
371 frame->data_[kVPlane] = v_data; 371 frame->data_[kVPlane] = v_data;
372 frame->gpu_memory_buffer_handles_.push_back(y_handle); 372 frame->gpu_memory_buffer_handles_.push_back(y_handle);
373 frame->gpu_memory_buffer_handles_.push_back(u_handle); 373 frame->gpu_memory_buffer_handles_.push_back(u_handle);
374 frame->gpu_memory_buffer_handles_.push_back(v_handle); 374 frame->gpu_memory_buffer_handles_.push_back(v_handle);
375 return frame; 375 return frame;
376 } 376 }
377 377
378 // static
379 scoped_refptr<VideoFrame> VideoFrame::WrapExternalYuvaData(
380 VideoPixelFormat format,
381 const gfx::Size& coded_size,
382 const gfx::Rect& visible_rect,
383 const gfx::Size& natural_size,
384 int32_t y_stride,
385 int32_t u_stride,
386 int32_t v_stride,
387 int32_t a_stride,
388 uint8_t* y_data,
389 uint8_t* u_data,
390 uint8_t* v_data,
391 uint8_t* a_data,
392 base::TimeDelta timestamp) {
393 const StorageType storage = STORAGE_UNOWNED_MEMORY;
394 if (!IsValidConfig(format, storage, coded_size, visible_rect, natural_size)) {
395 LOG(DFATAL) << __FUNCTION__ << " Invalid config."
396 << ConfigToString(format, storage, coded_size, visible_rect,
397 natural_size);
398 return nullptr;
399 }
400
401 if (NumPlanes(format) != 4) {
402 LOG(DFATAL) << "Expecting Y, U, V and A planes to be present for the video"
403 << " format.";
404 return nullptr;
405 }
406
407 scoped_refptr<VideoFrame> frame(new VideoFrame(
408 format, storage, coded_size, visible_rect, natural_size, timestamp));
409 frame->strides_[kYPlane] = y_stride;
410 frame->strides_[kUPlane] = u_stride;
411 frame->strides_[kVPlane] = v_stride;
412 frame->strides_[kAPlane] = a_stride;
413 frame->data_[kYPlane] = y_data;
414 frame->data_[kUPlane] = u_data;
415 frame->data_[kVPlane] = v_data;
416 frame->data_[kAPlane] = a_data;
417 return frame;
418 }
419
420 #if defined(OS_LINUX) 378 #if defined(OS_LINUX)
421 // static 379 // static
422 scoped_refptr<VideoFrame> VideoFrame::WrapExternalDmabufs( 380 scoped_refptr<VideoFrame> VideoFrame::WrapExternalDmabufs(
423 VideoPixelFormat format, 381 VideoPixelFormat format,
424 const gfx::Size& coded_size, 382 const gfx::Size& coded_size,
425 const gfx::Rect& visible_rect, 383 const gfx::Rect& visible_rect,
426 const gfx::Size& natural_size, 384 const gfx::Size& natural_size,
427 const std::vector<int>& dmabuf_fds, 385 const std::vector<int>& dmabuf_fds,
428 base::TimeDelta timestamp) { 386 base::TimeDelta timestamp) {
429 #if defined(OS_CHROMEOS) 387 #if defined(OS_CHROMEOS)
(...skipping 631 matching lines...) Expand 10 before | Expand all | Expand 10 after
1061 if (zero_initialize_memory) 1019 if (zero_initialize_memory)
1062 memset(data, 0, data_size); 1020 memset(data, 0, data_size);
1063 1021
1064 for (size_t plane = 0; plane < NumPlanes(format_); ++plane) 1022 for (size_t plane = 0; plane < NumPlanes(format_); ++plane)
1065 data_[plane] = data + offset[plane]; 1023 data_[plane] = data + offset[plane];
1066 1024
1067 AddDestructionObserver(base::Bind(&base::AlignedFree, data)); 1025 AddDestructionObserver(base::Bind(&base::AlignedFree, data));
1068 } 1026 }
1069 1027
1070 } // namespace media 1028 } // 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