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

Side by Side Diff: webrtc/sdk/android/api/org/webrtc/RendererCommon.java

Issue 2977643002: Add texture support to HardwareVideoDecoder. (Closed)
Patch Set: Remove unused variables, add comments, and fix the matrix helper Created 3 years, 5 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
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 240 matching lines...) Expand 10 before | Expand all | Expand 10 after
251 if (mirror) { 251 if (mirror) {
252 scaleX *= -1; 252 scaleX *= -1;
253 } 253 }
254 final float matrix[] = new float[16]; 254 final float matrix[] = new float[16];
255 Matrix.setIdentityM(matrix, 0); 255 Matrix.setIdentityM(matrix, 0);
256 Matrix.scaleM(matrix, 0, scaleX, scaleY, 1); 256 Matrix.scaleM(matrix, 0, scaleX, scaleY, 1);
257 adjustOrigin(matrix); 257 adjustOrigin(matrix);
258 return matrix; 258 return matrix;
259 } 259 }
260 260
261 /** Converts a float[16] matrix array to android.graphics.Matrix. */
262 public static android.graphics.Matrix convertMatrixToAndroidGraphicsMatrix(flo at[] matrix4x4) {
263 // clang-format off
264 float[] values = {
265 matrix4x4[0 * 4 + 0], matrix4x4[1 * 4 + 0], matrix4x4[3 * 4 + 0],
266 matrix4x4[0 * 4 + 1], matrix4x4[1 * 4 + 1], matrix4x4[3 * 4 + 1],
267 matrix4x4[0 * 4 + 3], matrix4x4[1 * 4 + 3], matrix4x4[3 * 4 + 3],
268 };
269 // clang-format on
270
271 android.graphics.Matrix matrix = new android.graphics.Matrix();
272 matrix.setValues(values);
273 return matrix;
274 }
275
261 /** 276 /**
262 * Calculate display size based on scaling type, video aspect ratio, and maxim um display size. 277 * Calculate display size based on scaling type, video aspect ratio, and maxim um display size.
263 */ 278 */
264 public static Point getDisplaySize( 279 public static Point getDisplaySize(
265 ScalingType scalingType, float videoAspectRatio, int maxDisplayWidth, int maxDisplayHeight) { 280 ScalingType scalingType, float videoAspectRatio, int maxDisplayWidth, int maxDisplayHeight) {
266 return getDisplaySize(convertScalingTypeToVisibleFraction(scalingType), vide oAspectRatio, 281 return getDisplaySize(convertScalingTypeToVisibleFraction(scalingType), vide oAspectRatio,
267 maxDisplayWidth, maxDisplayHeight); 282 maxDisplayWidth, maxDisplayHeight);
268 } 283 }
269 284
270 /** 285 /**
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
309 return new Point(maxDisplayWidth, maxDisplayHeight); 324 return new Point(maxDisplayWidth, maxDisplayHeight);
310 } 325 }
311 // Each dimension is constrained on max display size and how much we are all owed to crop. 326 // Each dimension is constrained on max display size and how much we are all owed to crop.
312 final int width = Math.min( 327 final int width = Math.min(
313 maxDisplayWidth, Math.round(maxDisplayHeight / minVisibleFraction * vide oAspectRatio)); 328 maxDisplayWidth, Math.round(maxDisplayHeight / minVisibleFraction * vide oAspectRatio));
314 final int height = Math.min( 329 final int height = Math.min(
315 maxDisplayHeight, Math.round(maxDisplayWidth / minVisibleFraction / vide oAspectRatio)); 330 maxDisplayHeight, Math.round(maxDisplayWidth / minVisibleFraction / vide oAspectRatio));
316 return new Point(width, height); 331 return new Point(width, height);
317 } 332 }
318 } 333 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698