| OLD | NEW |
| 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 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 71 case media::VideoFrame::YV16: | 71 case media::VideoFrame::YV16: |
| 72 case media::VideoFrame::YV12J: | 72 case media::VideoFrame::YV12J: |
| 73 case media::VideoFrame::NATIVE_TEXTURE: | 73 case media::VideoFrame::NATIVE_TEXTURE: |
| 74 #if defined(VIDEO_HOLE) | 74 #if defined(VIDEO_HOLE) |
| 75 case media::VideoFrame::HOLE: | 75 case media::VideoFrame::HOLE: |
| 76 #endif // defined(VIDEO_HOLE) | 76 #endif // defined(VIDEO_HOLE) |
| 77 return true; | 77 return true; |
| 78 | 78 |
| 79 // Unacceptable inputs. ¯\(°_o)/¯ | 79 // Unacceptable inputs. ¯\(°_o)/¯ |
| 80 case media::VideoFrame::UNKNOWN: | 80 case media::VideoFrame::UNKNOWN: |
| 81 case media::VideoFrame::HISTOGRAM_MAX: | |
| 82 case media::VideoFrame::I420: | 81 case media::VideoFrame::I420: |
| 83 break; | 82 break; |
| 84 } | 83 } |
| 85 return false; | 84 return false; |
| 86 } | 85 } |
| 87 | 86 |
| 88 // For frames that we receive in software format, determine the dimensions of | 87 // For frames that we receive in software format, determine the dimensions of |
| 89 // each plane in the frame. | 88 // each plane in the frame. |
| 90 static gfx::Size SoftwarePlaneDimension( | 89 static gfx::Size SoftwarePlaneDimension( |
| 91 media::VideoFrame::Format input_frame_format, | 90 media::VideoFrame::Format input_frame_format, |
| 92 const gfx::Size& coded_size, | 91 const gfx::Size& coded_size, |
| 93 ResourceFormat output_resource_format, | 92 ResourceFormat output_resource_format, |
| 94 int plane_index) { | 93 int plane_index) { |
| 95 if (output_resource_format == kYUVResourceFormat) { | 94 if (output_resource_format == kYUVResourceFormat) { |
| 96 if (plane_index == media::VideoFrame::kYPlane || | 95 if (plane_index == media::VideoFrame::kYPlane || |
| 97 plane_index == media::VideoFrame::kAPlane) | 96 plane_index == media::VideoFrame::kAPlane) |
| 98 return coded_size; | 97 return coded_size; |
| 99 | 98 |
| 100 switch (input_frame_format) { | 99 switch (input_frame_format) { |
| 101 case media::VideoFrame::YV12: | 100 case media::VideoFrame::YV12: |
| 102 case media::VideoFrame::YV12A: | 101 case media::VideoFrame::YV12A: |
| 103 case media::VideoFrame::YV12J: | 102 case media::VideoFrame::YV12J: |
| 104 return gfx::ToFlooredSize(gfx::ScaleSize(coded_size, 0.5f, 0.5f)); | 103 return gfx::ToFlooredSize(gfx::ScaleSize(coded_size, 0.5f, 0.5f)); |
| 105 case media::VideoFrame::YV16: | 104 case media::VideoFrame::YV16: |
| 106 return gfx::ToFlooredSize(gfx::ScaleSize(coded_size, 0.5f, 1.f)); | 105 return gfx::ToFlooredSize(gfx::ScaleSize(coded_size, 0.5f, 1.f)); |
| 107 | 106 |
| 108 case media::VideoFrame::UNKNOWN: | 107 case media::VideoFrame::UNKNOWN: |
| 109 case media::VideoFrame::I420: | 108 case media::VideoFrame::I420: |
| 110 case media::VideoFrame::NATIVE_TEXTURE: | 109 case media::VideoFrame::NATIVE_TEXTURE: |
| 111 case media::VideoFrame::HISTOGRAM_MAX: | |
| 112 #if defined(VIDEO_HOLE) | 110 #if defined(VIDEO_HOLE) |
| 113 case media::VideoFrame::HOLE: | 111 case media::VideoFrame::HOLE: |
| 114 #endif // defined(VIDEO_HOLE) | 112 #endif // defined(VIDEO_HOLE) |
| 115 NOTREACHED(); | 113 NOTREACHED(); |
| 116 } | 114 } |
| 117 } | 115 } |
| 118 | 116 |
| 119 DCHECK_EQ(output_resource_format, kRGBResourceFormat); | 117 DCHECK_EQ(output_resource_format, kRGBResourceFormat); |
| 120 return coded_size; | 118 return coded_size; |
| 121 } | 119 } |
| (...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 385 } | 383 } |
| 386 | 384 |
| 387 PlaneResource recycled_resource(data.resource_id, | 385 PlaneResource recycled_resource(data.resource_id, |
| 388 data.resource_size, | 386 data.resource_size, |
| 389 data.resource_format, | 387 data.resource_format, |
| 390 data.mailbox); | 388 data.mailbox); |
| 391 updater->recycled_resources_.push_back(recycled_resource); | 389 updater->recycled_resources_.push_back(recycled_resource); |
| 392 } | 390 } |
| 393 | 391 |
| 394 } // namespace cc | 392 } // namespace cc |
| OLD | NEW |