Skip to content
This repository has been archived by the owner on Dec 23, 2021. It is now read-only.

rendering failure with hardware decoder #1

Open
yohhoy opened this issue Aug 15, 2017 · 5 comments
Open

rendering failure with hardware decoder #1

yohhoy opened this issue Aug 15, 2017 · 5 comments

Comments

@yohhoy
Copy link
Owner

yohhoy commented Aug 15, 2017

Xperia X Performance, Android 7.0

HeifReader#initialize choose hardware decoder.

D/HeifReader: HEVC decoder="OMX.qcom.video.decoder.hevc" supported-size=4096x2160
              color-formats=[2141391878, 2135033992, 2141391876, 19, 21, 2141391877]
D/HeifReader: HEVC decoder="OMX.google.hevc.decoder" supported-size=2048x2048
              color-formats=[2135033992, 19]
I/HeifReader: HEVC decoder="OMX.qcom.video.decoder.hevc" supported-size=4096x2160

MediaCodec output surface which format is 0x7fa30c06.

D/HeifReader: HEVC output-format={crop-top=0, crop-right=511, color-format=2141391878, height=512, color-standard=2, crop-left=0, color-transfer=3, stride=512, mime=video/raw, slice-height=512, width=512, color-range=2, crop-bottom=511}
I/HeifReader: HEVC decoding elapsed=136.88573[msec]
E/ImageReader_JNI: Producer output buffer format: 0x7fa30c06,
                   ImageReader configured format: 0x32315659
W/HeifReader: rendering YV12 format failure; fallback to RGB565

D/HeifReader: HEVC output-format={crop-top=0, crop-right=511, color-format=2141391878, height=512, color-standard=2, crop-left=0, color-transfer=3, stride=512, mime=video/raw, slice-height=512, width=512, color-range=2, crop-bottom=511}
I/HeifReader: HEVC decoding elapsed=132.25766[msec]
E/ImageReader_JNI: Producer output buffer format: 0x7fa30c06,
                   ImageReader configured format: 0x4
E/HeifReader: rendering RGB565 format failure
              jp.yohhoy.heifreader.HeifReader$FormatFallbackException:
                java.lang.UnsupportedOperationException:
                  The producer output buffer format 0x7fa30c06 doesn't match the ImageReader's configured buffer format 0x4.

Galaxy S7 edge, Android 6.0.1 also report same error message.

@yohhoy
Copy link
Owner Author

yohhoy commented Aug 15, 2017

  • 2135033992 (0x7f420888) == MediaCodecInfo.CodecCapabilities.COLOR_FormatYUV420Flexible
  • 2141391878 (0x7FA30C06) == HAL_PIXEL_FORMAT_YCbCr_420_SP_VENUS_UBWC
  • 2141391876 (0x7FA30C04) == OMX_QCOM_COLOR_FormatYUV420PackedSemiPlanar32m
  • 2141391877 (0x7FA30C05) ?
  • 842094169 (0x32315659) == ImageFormat.YV12
  • 4 (0x00000004) == ImageFormat.RGB_565

@yohhoy yohhoy changed the title rendering failure on Xperia X Performance rendering failure with hardware decoder Aug 16, 2017
@msureshmewara
Copy link

[ImageReader-1440x960f4m1-31732-3] Failed to release buffer: Unknown error -1 (1)
10-26 07:41:38.943 31732-2027/jp.yohhoy.heifreader E/ImageReader_JNI: Producer output buffer format: 0x7fa30c06, ImageReader configured format: 0x4
10-26 07:41:38.958 31732-2027/jp.yohhoy.heifreader E/HeifReader: rendering RGB565 format failure
jp.yohhoy.heifreader.HeifReader$FormatFallbackException: java.lang.UnsupportedOperationException: The producer output buffer format 0x7fa30c06 doesn't match the ImageReader's configured buffer format 0x4.
at jp.yohhoy.heifreader.HeifReader.renderHevcImageWithFormat(HeifReader.java:394)
at jp.yohhoy.heifreader.HeifReader.decodeByteArray(HeifReader.java:149)
at jp.yohhoy.heifreader.HeifReader.decodeFile(HeifReader.java:180)
at jp.yohhoy.heifreader.HeifReader.decodeStream(HeifReader.java:243)
at jp.yohhoy.heifreader.MainActivity$1$1.doInBackground(MainActivity.java:76)
at jp.yohhoy.heifreader.MainActivity$1$1.doInBackground(MainActivity.java:72)
at android.os.AsyncTask$2.call(AsyncTask.java:333)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:245)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1162)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:636)
at java.lang.Thread.run(Thread.java:764)
Caused by: java.lang.UnsupportedOperationException: The producer output buffer format 0x7fa30c06 doesn't match the ImageReader's configured buffer format 0x4.
at android.media.ImageReader.nativeImageSetup(Native Method)
at android.media.ImageReader.acquireNextSurfaceImage(ImageReader.java:439)
at android.media.ImageReader.acquireNextImage(ImageReader.java:493)
at jp.yohhoy.heifreader.HeifReader.renderHevcImageWithFormat(HeifReader.java:392)
at jp.yohhoy.heifreader.HeifReader.decodeByteArray(HeifReader.java:149) 
at jp.yohhoy.heifreader.HeifReader.decodeFile(HeifReader.java:180) 
at jp.yohhoy.heifreader.HeifReader.decodeStream(HeifReader.java:243) 
at jp.yohhoy.heifreader.MainActivity$1$1.doInBackground(MainActivity.java:76) 
at jp.yohhoy.heifreader.MainActivity$1$1.doInBackground(MainActivity.java:72) 
at android.os.AsyncTask$2.call(AsyncTask.java:333) 
at java.util.concurrent.FutureTask.run(FutureTask.java:266) 
at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:245) 
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1162) 
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:636) 
at java.lang.Thread.run(Thread.java:764) 

@yohhoy yohhoy mentioned this issue Oct 28, 2017
@kendgin
Copy link

kendgin commented Jun 5, 2019

i have same error on it !
what we can do ?

@yohhoy
Copy link
Owner Author

yohhoy commented Aug 6, 2020

candidate patch?

diff --git a/app/src/main/java/jp/yohhoy/heifreader/HeifReader.java b/app/src/main/java/jp/yohhoy/heifreader/HeifReader.java
index 364b12a..aca364e 100644
--- a/app/src/main/java/jp/yohhoy/heifreader/HeifReader.java
+++ b/app/src/main/java/jp/yohhoy/heifreader/HeifReader.java
@@ -368,6 +368,7 @@ public class HeifReader {
             MediaCodec decoder = MediaCodec.createByCodecName(mDecoderName);
             MediaFormat inputFormat = MediaFormat.createVideoFormat(
                     MediaFormat.MIMETYPE_VIDEO_HEVC, info.size.getWidth(), info.size.getHeight());
+            inputFormat.setInteger(MediaFormat.KEY_COLOR_FORMAT, MediaCodecInfo.CodecCapabilities.COLOR_FormatYUV420Flexible);
             inputFormat.setInteger(MediaFormat.KEY_MAX_INPUT_SIZE, maxInputSize);
             inputFormat.setByteBuffer("csd-0", info.paramset);
             Log.d(TAG, "HEVC input-format=" + inputFormat);

@yohhoy
Copy link
Owner Author

yohhoy commented Aug 20, 2020

Above patch doesn't work on Xperia X Performance. 😢

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants