Samsung S9 + y RenderScript intrínseco

TheScribbler2019:

Yo uso este script para convertir YUV_420_888 imágenes de mapa de bits. Todo funciona muy bien en mi Samsung S8. Probé la RenderScript en mi S9 + y el resultado es un mapa de bits de color negro. Sin errores, sin previo aviso sólo un mapa de bits de color negro. He actualizado el S9 + Pie para Android, pero todo sigue siendo negro. Realmente `t explicar lo que está mal con los dispositivos S9 + ...

        int W = mImage.getWidth();
        int H = mImage.getHeight();

        Image.Plane Y = mImage.getPlanes()[0];
        Image.Plane U = mImage.getPlanes()[1];
        Image.Plane V = mImage.getPlanes()[2];

        int Yb = Y.getBuffer().remaining();
        int Ub = U.getBuffer().remaining();
        int Vb = V.getBuffer().remaining();

        byte[] data = new byte[Yb + Ub + Vb];

        Y.getBuffer().get(data, 0, Yb);
        V.getBuffer().get(data, Yb, Vb);
        U.getBuffer().get(data, Yb + Vb, Ub);

        RenderScript rs = RenderScript.create(Main2Activity.this);
        ScriptIntrinsicYuvToRGB yuvToRgbIntrinsic = ScriptIntrinsicYuvToRGB.create(rs, Element.U8_4(rs));

        Type.Builder yuvType = new Type.Builder(rs, Element.U8(rs)).setX(data.length);
        Allocation in = Allocation.createTyped(rs, yuvType.create(), Allocation.USAGE_SCRIPT);

        Type.Builder rgbaType = new Type.Builder(rs, Element.RGBA_8888(rs)).setX(W).setY(H);
        Allocation out = Allocation.createTyped(rs, rgbaType.create(), Allocation.USAGE_SCRIPT);

        final Bitmap bmpout = Bitmap.createBitmap(W, H, Bitmap.Config.ARGB_8888);

        in.copyFromUnchecked(data);

        yuvToRgbIntrinsic.setInput(in);
        yuvToRgbIntrinsic.forEach(out);
        out.copyTo(bmpout);

** Edición: ** He cambiado la resolución de mi Mimage a 2.960 x 1.440 píxeles y recibió algunos fallos. Mientras que la aplicación se colgaba He instalado la aplicación de nuevo y mientras estrellarse la App mostró los mapas de bits. Creo que el problema no es el código. Creo que el S9 + tiene algún problema renderScript funcionando correctamente.

TheScribbler2019:

Parece que el S9 + tuvo problemas con un TextureView cual coloqué sobre una ImagView. Después de retirar el TextureView la App funcionaba bien.

Supongo que te gusta

Origin http://43.154.161.224:23101/article/api/json?id=331445&siteId=1
Recomendado
Clasificación