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

Side by Side Diff: talk/app/webrtc/java/android/org/webrtc/RendererCommon.java

Issue 1314163008: Android video rendering: Fix texture matrix multiplication order (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 5 years, 3 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 | « no previous file | 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 * libjingle 2 * libjingle
3 * Copyright 2015 Google Inc. 3 * Copyright 2015 Google Inc.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met: 6 * modification, are permitted provided that the following conditions are met:
7 * 7 *
8 * 1. Redistributions of source code must retain the above copyright notice, 8 * 1. Redistributions of source code must retain the above copyright notice,
9 * this list of conditions and the following disclaimer. 9 * this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright notice, 10 * 2. Redistributions in binary form must reproduce the above copyright notice,
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 if (surfaceTexture == null) { 79 if (surfaceTexture == null) {
80 // For ByteBuffers, row 0 specifies the top row, but for a texture, row 0 specifies the 80 // For ByteBuffers, row 0 specifies the top row, but for a texture, row 0 specifies the
81 // bottom row. Flip the image vertically to compensate for this. 81 // bottom row. Flip the image vertically to compensate for this.
82 samplingMatrix = VERTICAL_FLIP; 82 samplingMatrix = VERTICAL_FLIP;
83 } else { 83 } else {
84 samplingMatrix = new float[16]; 84 samplingMatrix = new float[16];
85 surfaceTexture.getTransformMatrix(samplingMatrix); 85 surfaceTexture.getTransformMatrix(samplingMatrix);
86 } 86 }
87 // Clockwise rotation matrix in the XY-plane (around the Z-axis). 87 // Clockwise rotation matrix in the XY-plane (around the Z-axis).
88 final float[] rotationMatrix = new float[16]; 88 final float[] rotationMatrix = new float[16];
89 Matrix.setRotateM(rotationMatrix, 0, -rotationDegree, 0, 0, 1); 89 Matrix.setRotateM(rotationMatrix, 0, rotationDegree, 0, 0, 1);
90 adjustOrigin(rotationMatrix); 90 adjustOrigin(rotationMatrix);
91 // Multiply matrices together. 91 // Multiply matrices together.
92 final float[] tmpMatrix = new float[16]; 92 final float[] tmpMatrix = new float[16];
93 Matrix.multiplyMM(tmpMatrix, 0, rotationMatrix, 0, samplingMatrix, 0); 93 Matrix.multiplyMM(tmpMatrix, 0, samplingMatrix, 0, rotationMatrix, 0);
94 return tmpMatrix; 94 return tmpMatrix;
95 } 95 }
96 96
97 /** 97 /**
98 * Returns layout transformation matrix that applies an optional mirror effect and compensates 98 * Returns layout transformation matrix that applies an optional mirror effect and compensates
99 * for video vs display aspect ratio. 99 * for video vs display aspect ratio.
100 */ 100 */
101 public static float[] getLayoutMatrix( 101 public static float[] getLayoutMatrix(
102 boolean mirror, float videoAspectRatio, float displayAspectRatio) { 102 boolean mirror, float videoAspectRatio, float displayAspectRatio) {
103 float scaleX = 1; 103 float scaleX = 1;
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
170 return new Point(maxDisplayWidth, maxDisplayHeight); 170 return new Point(maxDisplayWidth, maxDisplayHeight);
171 } 171 }
172 // Each dimension is constrained on max display size and how much we are all owed to crop. 172 // Each dimension is constrained on max display size and how much we are all owed to crop.
173 final int width = Math.min(maxDisplayWidth, 173 final int width = Math.min(maxDisplayWidth,
174 (int) (maxDisplayHeight / minVisibleFraction * videoAspectRatio)); 174 (int) (maxDisplayHeight / minVisibleFraction * videoAspectRatio));
175 final int height = Math.min(maxDisplayHeight, 175 final int height = Math.min(maxDisplayHeight,
176 (int) (maxDisplayWidth / minVisibleFraction / videoAspectRatio)); 176 (int) (maxDisplayWidth / minVisibleFraction / videoAspectRatio));
177 return new Point(width, height); 177 return new Point(width, height);
178 } 178 }
179 } 179 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698