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

Unified Diff: media/base/video_frame.cc

Issue 56713002: Remove RGB32 from VideoFrame::Format. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@vframe_invalid
Patch Set: Created 7 years, 1 month 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 side-by-side diff with in-line comments
Download patch
Index: media/base/video_frame.cc
diff --git a/media/base/video_frame.cc b/media/base/video_frame.cc
index 9c07251e5979662d11a837f83ce44423b11c2c68..f706cde75e60e1d408b50814411eaae087d6df5f 100644
--- a/media/base/video_frame.cc
+++ b/media/base/video_frame.cc
@@ -28,9 +28,6 @@ scoped_refptr<VideoFrame> VideoFrame::CreateFrame(
scoped_refptr<VideoFrame> frame(new VideoFrame(
format, coded_size, visible_rect, natural_size, timestamp));
switch (format) {
- case VideoFrame::RGB32:
- frame->AllocateRGB(4u);
- break;
case VideoFrame::YV12:
case VideoFrame::YV12A:
case VideoFrame::YV16:
@@ -48,8 +45,6 @@ std::string VideoFrame::FormatToString(VideoFrame::Format format) {
switch (format) {
case VideoFrame::UNKNOWN:
return "UNKNOWN";
- case VideoFrame::RGB32:
- return "RGB32";
case VideoFrame::YV12:
return "YV12";
case VideoFrame::YV16:
@@ -231,8 +226,6 @@ size_t VideoFrame::NumPlanes(Format format) {
case VideoFrame::HOLE:
#endif
return 0;
- case VideoFrame::RGB32:
- return 1;
case VideoFrame::YV12:
case VideoFrame::YV16:
case VideoFrame::I420:
@@ -256,8 +249,6 @@ static inline size_t RoundUp(size_t value, size_t alignment) {
// static
size_t VideoFrame::AllocationSize(Format format, const gfx::Size& coded_size) {
switch (format) {
- case VideoFrame::RGB32:
- return coded_size.GetArea() * 4;
case VideoFrame::YV12:
case VideoFrame::I420: {
const size_t rounded_size =
@@ -286,27 +277,12 @@ size_t VideoFrame::AllocationSize(Format format, const gfx::Size& coded_size) {
return 0;
}
-// Release data allocated by AllocateRGB() or AllocateYUV().
+// Release data allocated by AllocateYUV().
static void ReleaseData(uint8* data) {
DCHECK(data);
base::AlignedFree(data);
}
-void VideoFrame::AllocateRGB(size_t bytes_per_pixel) {
- // Round up to align at least at a 16-byte boundary for each row.
- // This is sufficient for MMX and SSE2 reads (movq/movdqa).
- size_t bytes_per_row = RoundUp(coded_size_.width(),
- kFrameSizeAlignment) * bytes_per_pixel;
- size_t aligned_height = RoundUp(coded_size_.height(), kFrameSizeAlignment);
- strides_[VideoFrame::kRGBPlane] = bytes_per_row;
- data_[VideoFrame::kRGBPlane] = reinterpret_cast<uint8*>(
- base::AlignedAlloc(bytes_per_row * aligned_height + kFrameSizePadding,
- kFrameAddressAlignment));
- no_longer_needed_cb_ = base::Bind(&ReleaseData, data_[VideoFrame::kRGBPlane]);
- DCHECK(!(reinterpret_cast<intptr_t>(data_[VideoFrame::kRGBPlane]) & 7));
- COMPILE_ASSERT(0 == VideoFrame::kRGBPlane, RGB_data_must_be_index_0);
-}
-
void VideoFrame::AllocateYUV() {
DCHECK(format_ == VideoFrame::YV12 || format_ == VideoFrame::YV16 ||
format_ == VideoFrame::YV12A || format_ == VideoFrame::I420);
@@ -394,10 +370,6 @@ int VideoFrame::row_bytes(size_t plane) const {
DCHECK(IsValidPlane(plane));
int width = coded_size_.width();
switch (format_) {
- // 32bpp.
- case RGB32:
- return width * 4;
-
// Planar, 8bpp.
case YV12A:
if (plane == kAPlane)
@@ -423,7 +395,6 @@ int VideoFrame::rows(size_t plane) const {
DCHECK(IsValidPlane(plane));
int height = coded_size_.height();
switch (format_) {
- case RGB32:
case YV16:
return height;

Powered by Google App Engine
This is Rietveld 408576698