19 lines
942 B
Java
19 lines
942 B
Java
import java.nio.ByteBuffer;
|
|
import java.util.Arrays;
|
|
|
|
public class YuvFrameTest {
|
|
public static void main(String[] args) throws Exception {
|
|
Class<?> type;
|
|
try { type = Class.forName("br.carinha.rosto.YuvFrame"); }
|
|
catch (ClassNotFoundException e) { throw new AssertionError("Conversão YUV ainda não implementada"); }
|
|
ByteBuffer[] planes = {ByteBuffer.wrap(new byte[]{16,32,0,0,48,64}),
|
|
ByteBuffer.wrap(new byte[]{100,0}), ByteBuffer.wrap(new byte[]{(byte)150,0})};
|
|
byte[] actual = (byte[]) type.getMethod("nv21", int.class, int.class,
|
|
ByteBuffer[].class, int[].class, int[].class).invoke(null, 2, 2, planes,
|
|
new int[]{4,2,2}, new int[]{1,2,2});
|
|
byte[] expected = {16,32,48,64,(byte)150,100};
|
|
if (!Arrays.equals(actual, expected)) throw new AssertionError(Arrays.toString(actual));
|
|
System.out.println("YUV strides -> NV21: OK");
|
|
}
|
|
}
|