mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-05-31 12:33:12 +01:00
Simplify excessively convoluted camera logic
1) QuickCamera logic moved into CameraView 2) The strategies for texture vs. surface view were too complex with no observed gain. Better to remove and have to re-add if necessary than assume it to be necessary. 3) Drop CWAC-Camera dependency - the device profiles weren't being used very much and even that is deprecated so we'd be left on our own with new hardware. Not worth it. 4) Selfies first. 5) Layout/orientation mathy logic from CWAC moved into CameraUtils, with the hopes that most of it might be further simplified or rendered unnecessary in the future. Closes #4326 // FREEBIE
This commit is contained in:
committed by
Moxie Marlinspike
parent
08be47c03e
commit
8fd0ea39aa
@@ -166,14 +166,24 @@ public class BitmapUtil {
|
||||
return bytes;
|
||||
}
|
||||
|
||||
/*
|
||||
* NV21 a.k.a. YUV420sp
|
||||
* YUV 4:2:0 planar image, with 8 bit Y samples, followed by interleaved V/U plane with 8bit 2x2
|
||||
* subsampled chroma samples.
|
||||
*
|
||||
* http://www.fourcc.org/yuv.php#NV21
|
||||
*/
|
||||
public static byte[] rotateNV21(@NonNull final byte[] yuv,
|
||||
final int width,
|
||||
final int height,
|
||||
final int rotation)
|
||||
throws IOException
|
||||
{
|
||||
if (rotation == 0) return yuv;
|
||||
if (rotation % 90 != 0 || rotation < 0 || rotation > 270) {
|
||||
throw new IllegalArgumentException("0 <= rotation < 360, rotation % 90 == 0");
|
||||
} else if ((width * height * 3) / 2 != yuv.length) {
|
||||
throw new IOException("provided width and height don't jive with the data length");
|
||||
}
|
||||
|
||||
final byte[] output = new byte[yuv.length];
|
||||
|
||||
Reference in New Issue
Block a user