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

Side by Side Diff: webrtc/api/android/jni/native_handle_impl.cc

Issue 2426023002: Android: Move YuvConverter to its own file (Closed)
Patch Set: Rebase and update VideoFileRenderer Created 4 years, 2 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 | « webrtc/api/android/java/src/org/webrtc/YuvConverter.java ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2015 The WebRTC project authors. All Rights Reserved. 2 * Copyright 2015 The WebRTC project authors. All Rights Reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source 5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
137 int stride = 8 * uv_width; 137 int stride = 8 * uv_width;
138 int uv_height = (height()+1)/2; 138 int uv_height = (height()+1)/2;
139 size_t size = stride * (height() + uv_height); 139 size_t size = stride * (height() + uv_height);
140 // The data is owned by the frame, and the normal case is that the 140 // The data is owned by the frame, and the normal case is that the
141 // data is deleted by the frame's destructor callback. 141 // data is deleted by the frame's destructor callback.
142 // 142 //
143 // TODO(nisse): Use an I420BufferPool. We then need to extend that 143 // TODO(nisse): Use an I420BufferPool. We then need to extend that
144 // class, and I420Buffer, to support our memory layout. 144 // class, and I420Buffer, to support our memory layout.
145 std::unique_ptr<uint8_t, webrtc::AlignedFreeDeleter> yuv_data( 145 std::unique_ptr<uint8_t, webrtc::AlignedFreeDeleter> yuv_data(
146 static_cast<uint8_t*>(webrtc::AlignedMalloc(size, kBufferAlignment))); 146 static_cast<uint8_t*>(webrtc::AlignedMalloc(size, kBufferAlignment)));
147 // See SurfaceTextureHelper.java for the required layout. 147 // See YuvConverter.java for the required layout.
148 uint8_t* y_data = yuv_data.get(); 148 uint8_t* y_data = yuv_data.get();
149 uint8_t* u_data = y_data + height() * stride; 149 uint8_t* u_data = y_data + height() * stride;
150 uint8_t* v_data = u_data + stride/2; 150 uint8_t* v_data = u_data + stride/2;
151 151
152 rtc::scoped_refptr<webrtc::VideoFrameBuffer> copy = 152 rtc::scoped_refptr<webrtc::VideoFrameBuffer> copy =
153 new rtc::RefCountedObject<webrtc::WrappedI420Buffer>( 153 new rtc::RefCountedObject<webrtc::WrappedI420Buffer>(
154 width(), height(), 154 width(), height(),
155 y_data, stride, 155 y_data, stride,
156 u_data, stride, 156 u_data, stride,
157 v_data, stride, 157 v_data, stride,
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
206 cropped_width / static_cast<float>(width()), 206 cropped_width / static_cast<float>(width()),
207 cropped_height / static_cast<float>(height()), 207 cropped_height / static_cast<float>(height()),
208 crop_x / static_cast<float>(width()), 208 crop_x / static_cast<float>(width()),
209 crop_y / static_cast<float>(height())); 209 crop_y / static_cast<float>(height()));
210 } 210 }
211 buffer->native_handle_.sampling_matrix.Rotate(rotation); 211 buffer->native_handle_.sampling_matrix.Rotate(rotation);
212 return buffer; 212 return buffer;
213 } 213 }
214 214
215 } // namespace webrtc_jni 215 } // namespace webrtc_jni
OLDNEW
« no previous file with comments | « webrtc/api/android/java/src/org/webrtc/YuvConverter.java ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698