summaryrefslogtreecommitdiffstats
path: root/media/libstagefright/OMXCodec.cpp
diff options
context:
space:
mode:
authorcodeworkx <codeworkx@cyanogenmod.org>2012-12-06 01:48:56 +0100
committercodeworkx <codeworkx@cyanogenmod.org>2012-12-06 01:48:56 +0100
commit4e5350799c058af24649f3f790ac990b9314711e (patch)
treeac10dea994f3c8a6d4f797f0b4fe921a06631f5f /media/libstagefright/OMXCodec.cpp
parent16be9b2826de9eb129c090b0e8edb75c6c63aad3 (diff)
downloadframeworks_av-4e5350799c058af24649f3f790ac990b9314711e.zip
frameworks_av-4e5350799c058af24649f3f790ac990b9314711e.tar.gz
frameworks_av-4e5350799c058af24649f3f790ac990b9314711e.tar.bz2
omx: exynos4: bring inline with jellybean
Change-Id: Ic275fd30a721f8161dcc44c2706b86ab5ea213ba
Diffstat (limited to 'media/libstagefright/OMXCodec.cpp')
-rwxr-xr-xmedia/libstagefright/OMXCodec.cpp62
1 files changed, 20 insertions, 42 deletions
diff --git a/media/libstagefright/OMXCodec.cpp b/media/libstagefright/OMXCodec.cpp
index 81f45f4..a1b97e8 100755
--- a/media/libstagefright/OMXCodec.cpp
+++ b/media/libstagefright/OMXCodec.cpp
@@ -715,7 +715,10 @@ status_t OMXCodec::setVideoPortFormatType(
}
#ifdef USE_SAMSUNG_COLORFORMAT
-#define ALIGN(x, a) (((x) + (a) - 1) & ~((a) - 1))
+#define ALIGN_TO_8KB(x) ((((x) + (1 << 13) - 1) >> 13) << 13)
+#define ALIGN_TO_32B(x) ((((x) + (1 << 5) - 1) >> 5) << 5)
+#define ALIGN_TO_128B(x) ((((x) + (1 << 7) - 1) >> 7) << 7)
+#define ALIGN(x, a) (((x) + (a) - 1) & ~((a) - 1))
#endif
static size_t getFrameSize(
@@ -743,12 +746,11 @@ static size_t getFrameSize(
#endif
return (width * height * 3) / 2;
#ifdef USE_SAMSUNG_COLORFORMAT
-
case OMX_SEC_COLOR_FormatNV12LVirtualAddress:
return ALIGN((ALIGN(width, 16) * ALIGN(height, 16)), 2048) + ALIGN((ALIGN(width, 16) * ALIGN(height >> 1, 8)), 2048);
case OMX_SEC_COLOR_FormatNV12Tiled:
- static unsigned int frameBufferYSise = calc_plane(width, height);
- static unsigned int frameBufferUVSise = calc_plane(width, height >> 1);
+ static unsigned int frameBufferYSise = ALIGN_TO_8KB(ALIGN_TO_128B(width) * ALIGN_TO_32B(height));
+ static unsigned int frameBufferUVSise = ALIGN_TO_8KB(ALIGN_TO_128B(width) * ALIGN_TO_32B(height/2));
return (frameBufferYSise + frameBufferUVSise);
#endif
default:
@@ -1269,7 +1271,7 @@ status_t OMXCodec::setVideoOutputFormat(
if (mNativeWindow == NULL)
format.eColorFormat = OMX_COLOR_FormatYUV420Planar;
else
- format.eColorFormat = (OMX_COLOR_FORMATTYPE)OMX_SEC_COLOR_FormatNV12Tiled;
+ format.eColorFormat = OMX_COLOR_FormatYUV420SemiPlanar;
}
#endif
@@ -1773,14 +1775,20 @@ status_t OMXCodec::allocateOutputBuffersFromNativeWindow() {
def.format.video.nFrameHeight,
def.format.video.eColorFormat);
#else
- OMX_COLOR_FORMATTYPE eNativeColorFormat = def.format.video.eColorFormat;
- setNativeWindowColorFormat(eNativeColorFormat);
+ OMX_COLOR_FORMATTYPE eColorFormat;
- err = native_window_set_buffers_geometry(
- mNativeWindow.get(),
- def.format.video.nFrameWidth,
- def.format.video.nFrameHeight,
- eNativeColorFormat);
+ switch (def.format.video.eColorFormat) {
+ case OMX_SEC_COLOR_FormatNV12TPhysicalAddress:
+ eColorFormat = (OMX_COLOR_FORMATTYPE)HAL_PIXEL_FORMAT_CUSTOM_YCbCr_420_SP_TILED;
+ break;
+ case OMX_COLOR_FormatYUV420SemiPlanar:
+ eColorFormat = (OMX_COLOR_FORMATTYPE)HAL_PIXEL_FORMAT_YCbCr_420_SP;
+ break;
+ case OMX_COLOR_FormatYUV420Planar:
+ default:
+ eColorFormat = (OMX_COLOR_FORMATTYPE)HAL_PIXEL_FORMAT_YCbCr_420_P;
+ break;
+ }
#endif
if (err != 0) {
@@ -1827,14 +1835,8 @@ status_t OMXCodec::allocateOutputBuffersFromNativeWindow() {
ALOGV("native_window_set_usage usage=0x%lx", usage);
-#ifdef EXYNOS4_ENHANCEMENTS
- err = native_window_set_usage(
- mNativeWindow.get(), usage | GRALLOC_USAGE_HW_TEXTURE | GRALLOC_USAGE_EXTERNAL_DISP
- | GRALLOC_USAGE_HW_FIMC1 | GRALLOC_USAGE_HWC_HWOVERLAY);
-#else
err = native_window_set_usage(
mNativeWindow.get(), usage | GRALLOC_USAGE_HW_TEXTURE | GRALLOC_USAGE_EXTERNAL_DISP);
-#endif
if (err != 0) {
ALOGE("native_window_set_usage failed: %s (%d)", strerror(-err), -err);
@@ -1931,30 +1933,6 @@ status_t OMXCodec::allocateOutputBuffersFromNativeWindow() {
return err;
}
-#ifdef USE_SAMSUNG_COLORFORMAT
-void OMXCodec::setNativeWindowColorFormat(OMX_COLOR_FORMATTYPE &eNativeColorFormat)
-{
- // Convert OpenMAX color format to native color format
- switch (eNativeColorFormat) {
- // In case of SAMSUNG color format
- case OMX_SEC_COLOR_FormatNV12TPhysicalAddress:
- eNativeColorFormat = (OMX_COLOR_FORMATTYPE)HAL_PIXEL_FORMAT_CUSTOM_YCbCr_420_SP_TILED;
- break;
- case OMX_SEC_COLOR_FormatNV12Tiled:
- eNativeColorFormat = (OMX_COLOR_FORMATTYPE)HAL_PIXEL_FORMAT_YCbCr_420_SP_TILED;
- break;
- // In case of OpenMAX color formats
- case OMX_COLOR_FormatYUV420SemiPlanar:
- eNativeColorFormat = (OMX_COLOR_FORMATTYPE)HAL_PIXEL_FORMAT_YCbCr_420_SP;
- break;
- case OMX_COLOR_FormatYUV420Planar:
- default:
- eNativeColorFormat = (OMX_COLOR_FORMATTYPE)HAL_PIXEL_FORMAT_YCbCr_420_P;
- break;
- }
-}
-#endif // USE_SAMSUNG_COLORFORMAT
-
status_t OMXCodec::cancelBufferToNativeWindow(BufferInfo *info) {
CHECK_EQ((int)info->mStatus, (int)OWNED_BY_US);
CODEC_LOGV("Calling cancelBuffer on buffer %p", info->mBuffer);