aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlistair Strachan <alistair.strachan@imgtec.com>2016-06-02 20:48:24 +0000
committerandroid-build-merger <android-build-merger@google.com>2016-06-02 20:48:24 +0000
commit14f5e4d93a83a73d0ee8e7cbb20c9f99fa76654a (patch)
tree7b299f689b2df2e7633c2d34e31ed900fe169778
parent35784c5275efc5a92a3f541a98da4b77c1bed922 (diff)
parent7caaf88cf45abd06d6c8d99b40bf5cb8c0fbc0ff (diff)
downloadomx-components-14f5e4d93a83a73d0ee8e7cbb20c9f99fa76654a.tar.gz
Introduce independent hstride and vstride, and use them.
am: 7caaf88cf4 * commit '7caaf88cf45abd06d6c8d99b40bf5cb8c0fbc0ff': Introduce independent hstride and vstride, and use them. Change-Id: Ie0639debed0e920ab3045a2451029bf931b7845e
-rwxr-xr-xvideocodec/Android.mk2
-rwxr-xr-xvideocodec/OMXVideoDecoderBase.cpp14
-rwxr-xr-xvideocodec/OMXVideoDecoderBase.h3
-rw-r--r--videocodec/OMXVideoDecoderVP9HWR.cpp19
-rw-r--r--videocodec/OMXVideoDecoderVP9Hybrid.cpp74
5 files changed, 66 insertions, 46 deletions
diff --git a/videocodec/Android.mk b/videocodec/Android.mk
index 07fbc2a..2c5a9ef 100755
--- a/videocodec/Android.mk
+++ b/videocodec/Android.mk
@@ -228,6 +228,8 @@ LOCAL_C_INCLUDES := \
ifeq ($(TARGET_BOARD_PLATFORM),baytrail)
LOCAL_C_INCLUDES += $(TARGET_OUT_HEADERS)/ufo
+else
+ LOCAL_C_INCLUDES += $(TARGET_OUT_HEADERS)/pvr/hal
endif
LOCAL_SRC_FILES := \
diff --git a/videocodec/OMXVideoDecoderBase.cpp b/videocodec/OMXVideoDecoderBase.cpp
index 97ea7ca..31c6a48 100755
--- a/videocodec/OMXVideoDecoderBase.cpp
+++ b/videocodec/OMXVideoDecoderBase.cpp
@@ -499,9 +499,10 @@ OMX_ERRORTYPE OMXVideoDecoderBase::PrepareConfigBuffer(VideoConfigBuffer *p) {
mOMXBufferHeaderTypePtrNum = 0;
mGraphicBufferParam.graphicBufferColorFormat = def_output->format.video.eColorFormat;
- mGraphicBufferParam.graphicBufferStride = getStride(def_output->format.video.nFrameWidth);
+ mGraphicBufferParam.graphicBufferHStride = getStride(def_output->format.video.nFrameWidth);
+ mGraphicBufferParam.graphicBufferVStride = (def_output->format.video.nFrameHeight + 0x1f) & ~0x1f;
mGraphicBufferParam.graphicBufferWidth = def_output->format.video.nFrameWidth;
- mGraphicBufferParam.graphicBufferHeight = (def_output->format.video.nFrameHeight + 0xf) & ~0xf;
+ mGraphicBufferParam.graphicBufferHeight = def_output->format.video.nFrameHeight;
p->surfaceNumber = mMetaDataBuffersNum;
for (int i = 0; i < MAX_GRAPHIC_BUFFER_NUM; i++) {
@@ -517,10 +518,11 @@ OMX_ERRORTYPE OMXVideoDecoderBase::PrepareConfigBuffer(VideoConfigBuffer *p) {
}
}
p->flag |= USE_NATIVE_GRAPHIC_BUFFER;
- p->graphicBufferStride = mGraphicBufferParam.graphicBufferStride;
- p->graphicBufferColorFormat = mGraphicBufferParam.graphicBufferColorFormat;
+ p->graphicBufferHStride = mGraphicBufferParam.graphicBufferHStride;
+ p->graphicBufferVStride = mGraphicBufferParam.graphicBufferVStride;
p->graphicBufferWidth = mGraphicBufferParam.graphicBufferWidth;
p->graphicBufferHeight = mGraphicBufferParam.graphicBufferHeight;
+ p->graphicBufferColorFormat = mGraphicBufferParam.graphicBufferColorFormat;
if (p->graphicBufferColorFormat == OMX_INTEL_COLOR_FormatYUV420PackedSemiPlanar_Tiled
#ifdef USE_GEN_HW
|| p->graphicBufferColorFormat == HAL_PIXEL_FORMAT_NV12_X_TILED_INTEL
@@ -1031,7 +1033,9 @@ OMX_ERRORTYPE OMXVideoDecoderBase::SetNativeBuffer(OMX_PTR pStructure) {
if (mOMXBufferHeaderTypePtrNum == 1) {
mGraphicBufferParam.graphicBufferColorFormat = param->nativeBuffer->format;
- mGraphicBufferParam.graphicBufferStride = param->nativeBuffer->stride;
+ mGraphicBufferParam.graphicBufferHStride = param->nativeBuffer->stride;
+ // FIXME: use IMG_native_handle_t->aiVStride[0] instead..
+ mGraphicBufferParam.graphicBufferVStride = param->nativeBuffer->height;
mGraphicBufferParam.graphicBufferWidth = param->nativeBuffer->width;
mGraphicBufferParam.graphicBufferHeight = param->nativeBuffer->height;
}
diff --git a/videocodec/OMXVideoDecoderBase.h b/videocodec/OMXVideoDecoderBase.h
index a9b2cdf..2cd60ad 100755
--- a/videocodec/OMXVideoDecoderBase.h
+++ b/videocodec/OMXVideoDecoderBase.h
@@ -105,7 +105,8 @@ private:
};
struct GraphicBufferParam {
- uint32_t graphicBufferStride;
+ uint32_t graphicBufferHStride;
+ uint32_t graphicBufferVStride;
uint32_t graphicBufferWidth;
uint32_t graphicBufferHeight;
uint32_t graphicBufferColorFormat;
diff --git a/videocodec/OMXVideoDecoderVP9HWR.cpp b/videocodec/OMXVideoDecoderVP9HWR.cpp
index 4482c37..684993d 100644
--- a/videocodec/OMXVideoDecoderVP9HWR.cpp
+++ b/videocodec/OMXVideoDecoderVP9HWR.cpp
@@ -256,11 +256,12 @@ OMX_ERRORTYPE OMXVideoDecoderVP9HWR::ProcessorInit(void)
int surfaceWidth = mGraphicBufferParam.graphicBufferWidth;
int surfaceHeight = mGraphicBufferParam.graphicBufferHeight;
- int surfaceStride = mGraphicBufferParam.graphicBufferStride;
- extNativeBufferSize = mGraphicBufferParam.graphicBufferStride *
- mGraphicBufferParam.graphicBufferHeight * 1.5;
- extActualBufferStride = surfaceStride;
- extActualBufferHeightStride = surfaceHeight;
+ int surfaceHStride = mGraphicBufferParam.graphicBufferHStride;
+ int surfaceVStride = mGraphicBufferParam.graphicBufferVStride;
+ extNativeBufferSize = mGraphicBufferParam.graphicBufferHStride *
+ mGraphicBufferParam.graphicBufferVStride * 1.5;
+ extActualBufferStride = surfaceHStride;
+ extActualBufferHeightStride = surfaceVStride;
for (i = 0; i < mOMXBufferHeaderTypePtrNum; i++) {
OMX_BUFFERHEADERTYPE *buf_hdr = mOMXBufferHeaderTypePtrArray[i];
@@ -280,14 +281,14 @@ OMX_ERRORTYPE OMXVideoDecoderVP9HWR::ProcessorInit(void)
surfExtBuf->pixel_format = VA_FOURCC_NV12;
surfExtBuf->width = surfaceWidth;
surfExtBuf->height = surfaceHeight;
- surfExtBuf->data_size = surfaceStride * surfaceHeight * 1.5;
+ surfExtBuf->data_size = surfaceHStride * surfaceVStride * 1.5;
surfExtBuf->num_planes = 2;
- surfExtBuf->pitches[0] = surfaceStride;
- surfExtBuf->pitches[1] = surfaceStride;
+ surfExtBuf->pitches[0] = surfaceHStride;
+ surfExtBuf->pitches[1] = surfaceHStride;
surfExtBuf->pitches[2] = 0;
surfExtBuf->pitches[3] = 0;
surfExtBuf->offsets[0] = 0;
- surfExtBuf->offsets[1] = surfaceStride * surfaceHeight;
+ surfExtBuf->offsets[1] = surfaceHStride * surfaceVStride;
surfExtBuf->offsets[2] = 0;
surfExtBuf->offsets[3] = 0;
surfExtBuf->flags = VA_SURFACE_ATTRIB_MEM_TYPE_ANDROID_GRALLOC;
diff --git a/videocodec/OMXVideoDecoderVP9Hybrid.cpp b/videocodec/OMXVideoDecoderVP9Hybrid.cpp
index 1360ca2..f6211f7 100644
--- a/videocodec/OMXVideoDecoderVP9Hybrid.cpp
+++ b/videocodec/OMXVideoDecoderVP9Hybrid.cpp
@@ -25,6 +25,8 @@
#include <hardware/gralloc.h>
#include <system/graphics.h>
+#include <hal_public.h>
+
#define VP9_YV12_ALIGN (128-1)
static const char* VP9_MIME_TYPE = "video/x-vnd.on2.vp9";
@@ -70,12 +72,12 @@ OMX_ERRORTYPE OMXVideoDecoderVP9Hybrid::ProcessorInit(void) {
uint32_t buff[MAX_GRAPHIC_BUFFER_NUM];
uint32_t i, bufferCount;
bool gralloc_mode = (mWorkingMode == GRAPHICBUFFER_MODE);
- uint32_t bufferSize, bufferStride, bufferHeight, bufferWidth;
+ uint32_t bufferSize, bufferHStride, bufferVStride, bufferWidth;
if (!gralloc_mode) {
- bufferSize = 1920 * 1088 * 1.5;
- bufferStride = 1920;
+ bufferHStride = 1920;
+ bufferVStride = 1088;
bufferWidth = 1920;
- bufferHeight = 1088;
+ //bufferHeight = 1080;
bufferCount = 12;
} else {
if (mAPMode == METADATA_MODE) {
@@ -87,9 +89,10 @@ OMX_ERRORTYPE OMXVideoDecoderVP9Hybrid::ProcessorInit(void) {
mOMXBufferHeaderTypePtrNum = 0;
mGraphicBufferParam.graphicBufferColorFormat = def_output->format.video.eColorFormat;
- mGraphicBufferParam.graphicBufferStride = (def_output->format.video.nFrameWidth + VP9_YV12_ALIGN) & ~VP9_YV12_ALIGN;
+ mGraphicBufferParam.graphicBufferHStride = (def_output->format.video.nFrameWidth + VP9_YV12_ALIGN) & ~VP9_YV12_ALIGN;
+ mGraphicBufferParam.graphicBufferVStride = (def_output->format.video.nFrameHeight + 0x1f) & ~0x1f;
mGraphicBufferParam.graphicBufferWidth = def_output->format.video.nFrameWidth;
- mGraphicBufferParam.graphicBufferHeight = (def_output->format.video.nFrameHeight + 0x1f) & ~0x1f;
+ mGraphicBufferParam.graphicBufferHeight = def_output->format.video.nFrameHeight;
mDecodedImageWidth = def_output->format.video.nFrameWidth;
mDecodedImageHeight = def_output->format.video.nFrameHeight;
} else{
@@ -101,12 +104,14 @@ OMX_ERRORTYPE OMXVideoDecoderVP9Hybrid::ProcessorInit(void) {
}
}
- bufferSize = mGraphicBufferParam.graphicBufferStride *
- mGraphicBufferParam.graphicBufferHeight * 1.5;
- bufferStride = mGraphicBufferParam.graphicBufferStride;
- bufferHeight = mGraphicBufferParam.graphicBufferHeight;
+ bufferHStride = mGraphicBufferParam.graphicBufferHStride;
+ bufferVStride = mGraphicBufferParam.graphicBufferVStride;
bufferWidth = mGraphicBufferParam.graphicBufferWidth;
+ //bufferHeight = mGraphicBufferParam.graphicBufferHeight;
}
+
+ bufferSize = bufferHStride * bufferVStride * 1.5;
+
mLibHandle = dlopen("libDecoderVP9Hybrid.so", RTLD_NOW);
if (mLibHandle == NULL) {
LOGE("dlopen libDecoderVP9Hybrid.so fail\n");
@@ -137,7 +142,11 @@ OMX_ERRORTYPE OMXVideoDecoderVP9Hybrid::ProcessorInit(void) {
return OMX_ErrorBadParameter;
}
- mInitDecoder(mHybridCtx,bufferSize,bufferStride,bufferWidth, bufferHeight,bufferCount,gralloc_mode, buff, (uint32_t)mAPMode);
+ // FIXME: The proprietary part of the vp9hybrid decoder should be updated
+ // to take VStride as well as Height. For now it's convenient to
+ // use VStride as that was effectively what was done before..
+ mInitDecoder(mHybridCtx, bufferSize, bufferHStride, bufferWidth,
+ bufferVStride, bufferCount, gralloc_mode, buff, (uint32_t)mAPMode);
return OMX_ErrorNone;
}
@@ -146,12 +155,13 @@ OMX_ERRORTYPE OMXVideoDecoderVP9Hybrid::ProcessorReset(void)
uint32_t buff[MAX_GRAPHIC_BUFFER_NUM];
uint32_t i, bufferCount;
bool gralloc_mode = (mWorkingMode == GRAPHICBUFFER_MODE);
- uint32_t bufferSize, bufferStride, bufferHeight, bufferWidth;
+ uint32_t bufferSize, bufferHStride, bufferVStride, bufferWidth;
if (!gralloc_mode) {
- bufferSize = mDecodedImageWidth * mDecodedImageHeight * 1.5;
- bufferStride = mDecodedImageWidth;
+ bufferHStride = mDecodedImageWidth;
+ bufferVStride = mDecodedImageHeight;
bufferWidth = mDecodedImageWidth;
- bufferHeight = mDecodedImageHeight;
+ //bufferHeight = mDecodedImageHeight;
+ bufferSize = bufferHStride * bufferVStride * 1.5;
bufferCount = 12;
} else {
if (mAPMode == METADATA_MODE) {
@@ -163,9 +173,10 @@ OMX_ERRORTYPE OMXVideoDecoderVP9Hybrid::ProcessorReset(void)
mOMXBufferHeaderTypePtrNum = 0;
mGraphicBufferParam.graphicBufferColorFormat = def_output->format.video.eColorFormat;
- mGraphicBufferParam.graphicBufferStride = (def_output->format.video.nFrameWidth + VP9_YV12_ALIGN) & ~VP9_YV12_ALIGN;
+ mGraphicBufferParam.graphicBufferHStride = (def_output->format.video.nFrameWidth + VP9_YV12_ALIGN) & ~VP9_YV12_ALIGN;
+ mGraphicBufferParam.graphicBufferVStride = (def_output->format.video.nFrameHeight + 0x1f) & ~0x1f;
mGraphicBufferParam.graphicBufferWidth = def_output->format.video.nFrameWidth;
- mGraphicBufferParam.graphicBufferHeight = (def_output->format.video.nFrameHeight + 0x1f) & ~0x1f;
+ mGraphicBufferParam.graphicBufferHeight = def_output->format.video.nFrameHeight;
} else{
bufferCount = mOMXBufferHeaderTypePtrNum;
@@ -174,14 +185,19 @@ OMX_ERRORTYPE OMXVideoDecoderVP9Hybrid::ProcessorReset(void)
buff[i] = (uint32_t)(buf_hdr->pBuffer);
}
}
- bufferSize = mGraphicBufferParam.graphicBufferStride *
- mGraphicBufferParam.graphicBufferHeight * 1.5;
- bufferStride = mGraphicBufferParam.graphicBufferStride;
- bufferHeight = mGraphicBufferParam.graphicBufferHeight;
+ bufferHStride = mGraphicBufferParam.graphicBufferHStride;
+ bufferVStride = mGraphicBufferParam.graphicBufferVStride;
bufferWidth = mGraphicBufferParam.graphicBufferWidth;
+ //bufferHeight = mGraphicBufferParam.graphicBufferHeight;
}
- mInitDecoder(mHybridCtx,bufferSize,bufferStride,bufferWidth,bufferHeight,bufferCount,gralloc_mode, buff, (uint32_t)mAPMode);
+ bufferSize = bufferHStride * bufferVStride * 1.5;
+
+ // FIXME: The proprietary part of the vp9hybrid decoder should be updated
+ // to take VStride as well as Height. For now it's convenient to
+ // use VStride as that was effectively what was done before..
+ mInitDecoder(mHybridCtx, bufferSize, bufferHStride, bufferWidth,
+ bufferVStride, bufferCount, gralloc_mode, buff, (uint32_t)mAPMode);
mFormatChanged = false;
return OMX_ErrorNone;
}
@@ -475,7 +491,7 @@ OMX_ERRORTYPE OMXVideoDecoderVP9Hybrid::SetParamVideoVp9(OMX_PTR) {
OMX_ERRORTYPE OMXVideoDecoderVP9Hybrid::HandleFormatChange(void)
{
- ALOGI("handle format change from %dx%d to %dx%d",
+ ALOGE("handle format change from %dx%d to %dx%d",
mDecodedImageWidth,mDecodedImageHeight,mDecodedImageNewWidth,mDecodedImageNewHeight);
mDecodedImageWidth = mDecodedImageNewWidth;
mDecodedImageHeight = mDecodedImageNewHeight;
@@ -540,10 +556,7 @@ OMX_ERRORTYPE OMXVideoDecoderVP9Hybrid::HandleFormatChange(void)
// for graphic buffer reallocation
// when the width and height parsed from ES are larger than allocated graphic buffer in outport,
paramPortDefinitionOutput.format.video.nFrameWidth = width;
- if (mAPMode == METADATA_MODE)
- paramPortDefinitionOutput.format.video.nFrameHeight = (height + 0x1f) & ~0x1f;
- else
- paramPortDefinitionOutput.format.video.nFrameHeight = (height + 0x1f) & ~0x1f;
+ paramPortDefinitionOutput.format.video.nFrameHeight = height;
paramPortDefinitionOutput.format.video.eColorFormat = GetOutputColorFormat(
paramPortDefinitionOutput.format.video.nFrameWidth);
paramPortDefinitionOutput.format.video.nStride = stride;
@@ -566,8 +579,8 @@ OMX_ERRORTYPE OMXVideoDecoderVP9Hybrid::HandleFormatChange(void)
OMX_COLOR_FORMATTYPE OMXVideoDecoderVP9Hybrid::GetOutputColorFormat(int) {
- LOGV("Output color format is HAL_PIXEL_FORMAT_YV12.");
- return (OMX_COLOR_FORMATTYPE)HAL_PIXEL_FORMAT_YV12;
+ LOGV("Output color format is HAL_PIXEL_FORMAT_INTEL_YV12.");
+ return (OMX_COLOR_FORMATTYPE)HAL_PIXEL_FORMAT_INTEL_YV12;
}
OMX_ERRORTYPE OMXVideoDecoderVP9Hybrid::GetDecoderOutputCropSpecific(OMX_PTR pStructure) {
@@ -628,10 +641,9 @@ OMX_ERRORTYPE OMXVideoDecoderVP9Hybrid::SetNativeBufferModeSpecific(OMX_PTR pStr
port_def.format.video.cMIMEType = (OMX_STRING)VA_VED_RAW_MIME_TYPE;
// add borders for libvpx decode need.
port_def.format.video.nFrameWidth += VPX_DECODE_BORDER * 2;
+ port_def.format.video.nFrameHeight += VPX_DECODE_BORDER * 2;
mDecodedImageWidth = port_def.format.video.nFrameWidth;
mDecodedImageHeight = port_def.format.video.nFrameHeight;
- // make heigth 32bit align
- port_def.format.video.nFrameHeight = (port_def.format.video.nFrameHeight + 0x1f) & ~0x1f;
port_def.format.video.eColorFormat = GetOutputColorFormat(port_def.format.video.nFrameWidth);
port->SetPortDefinition(&port_def,true);