Skip to content

Speedup in Java code #4

@rrahmati

Description

@rrahmati

Instead of the for loop to create the bitmap in the java code, use this:
IntBuffer intBuf = ByteBuffer.wrap(frame).order(ByteOrder.BIG_ENDIAN).asIntBuffer(); int[] pixels = new int[intBuf.remaining()]; intBuf.get(pixels); bmp = Bitmap.createBitmap(pixels, width, height, Bitmap.Config.ARGB_8888); ivPreview.setImageBitmap(bmp);

It makes the code an order of magnitude faster!
Also, in the C++ code, change AV_PIX_FMT_RGB to AV_PIX_FMT_ARGB.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions