Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Combining two YV12 image buffers into a single side-by-side image Java/Android

This question has answer in C++. Is there any way to do the same or to invoke the code from Java/Android side?

Combining two YV12 image buffers into a single side-by-side image

What is this code analogues in java/kotlin?

BYTE* source = buffer;
BYTE* destination = convertBuffer3D;

This memcpy function ( taken from c++ reference memcopy ) has any analogues?

void * memcpy ( void * destination, const void * source, size_t num );
like image 244
Kyryl Zotov Avatar asked Jun 18 '20 14:06

Kyryl Zotov


1 Answers

Why you dont use the one of the Java array copy, the System.arraycopy or the class method java.util.Arrays.copyOf.

 byte[] source_arr = {0,1,2};
 byte[] dest_arr = Arrays.copyOf(source_arr , source_arr.length);

arraycopy

u can use the arraycopy. see oracle docs arraycopy

public static void arraycopy(Object src,
                             int srcPos,
                             Object dest,
                             int destPos,
                             int length)

since java have no unsigned char or c++ byte data type like. the only way i know to achieve similar data type (BYTE) c++ like is by downcasting integer type to byte:

int var = 128;
byte _BYTE = (byte)128;
like image 148
Adam Avatar answered Oct 12 '22 20:10

Adam