diff options
author | Changyeon Lee <cyeon.lee@samsung.com> | 2019-12-19 17:54:50 +0900 |
---|---|---|
committer | Changyeon Lee <cyeon.lee@samsung.com> | 2019-12-19 19:41:09 +0900 |
commit | a8a83ca533528ff5424cb2e9b49a0fea64c8c743 (patch) | |
tree | 1e0e7d2cbe87917f2055f78db52a62ced076cefc | |
parent | 48f21021f2dea0e4b2aeeab732a0ba1e2364eb0b (diff) | |
download | libtbm-exynos-tgm-a8a83ca533528ff5424cb2e9b49a0fea64c8c743.tar.gz libtbm-exynos-tgm-a8a83ca533528ff5424cb2e9b49a0fea64c8c743.tar.bz2 libtbm-exynos-tgm-a8a83ca533528ff5424cb2e9b49a0fea64c8c743.zip |
fix pitch and offset of NV format
Change-Id: Ifefe3a52f15ec31a0a0c2d41facb2c50a25a3c29
-rw-r--r-- | src/tbm_bufmgr_exynos.c | 56 |
1 files changed, 21 insertions, 35 deletions
diff --git a/src/tbm_bufmgr_exynos.c b/src/tbm_bufmgr_exynos.c index 33a4c0d..96529ce 100644 --- a/src/tbm_bufmgr_exynos.c +++ b/src/tbm_bufmgr_exynos.c @@ -919,21 +919,6 @@ _exynos_bo_handle(tbm_bo_exynos bo_exynos, int device) } static int -_new_calc_plane_nv12(int width, int height) -{ - int mbX, mbY; - - mbX = DIV_ROUND_UP(width, S5P_FIMV_NUM_PIXELS_IN_MB_ROW); - mbY = DIV_ROUND_UP(height, S5P_FIMV_NUM_PIXELS_IN_MB_COL); - - if (width * height < S5P_FIMV_MAX_FRAME_SIZE) - mbY = (mbY + 1) / 2 * 2; - - return ((mbX * S5P_FIMV_NUM_PIXELS_IN_MB_COL) * (mbY * - S5P_FIMV_NUM_PIXELS_IN_MB_ROW)); -} - -static int _calc_yplane_nv12(int width, int height) { int mbX, mbY; @@ -956,6 +941,21 @@ _calc_uvplane_nv12(int width, int height) } static int +_new_calc_plane_nv12(int width, int height) +{ + int mbX, mbY; + + mbX = DIV_ROUND_UP(width, S5P_FIMV_NUM_PIXELS_IN_MB_ROW); + mbY = DIV_ROUND_UP(height, S5P_FIMV_NUM_PIXELS_IN_MB_COL); + + if (width * height < S5P_FIMV_MAX_FRAME_SIZE) + mbY = (mbY + 1) / 2 * 2; + + return ((mbX * S5P_FIMV_NUM_PIXELS_IN_MB_COL) * (mbY * + S5P_FIMV_NUM_PIXELS_IN_MB_ROW)); +} + +static int _new_calc_yplane_nv12(int width, int height) { return SIZE_ALIGN(_new_calc_plane_nv12(width, @@ -1110,36 +1110,22 @@ tbm_exynos_bufmgr_get_plane_data(tbm_backend_bufmgr_data *bufmgr_data, * index 1 = Cb:Cr plane, [15:0] Cb:Cr little endian */ case TBM_FORMAT_NV12: + case TBM_FORMAT_NV21: bpp = 12; if (plane_idx == 0) { _offset = 0; _pitch = SIZE_ALIGN(width, TBM_SURFACE_ALIGNMENT_PITCH_YUV); _size = MAX(_calc_yplane_nv12(width, height), - _new_calc_yplane_nv12(width, height)); + _new_calc_yplane_nv12(width, height)); _bo_idx = 0; } else if (plane_idx == 1) { - _offset = MAX(_calc_yplane_nv12(width, height), - _new_calc_yplane_nv12(width, height)); - _pitch = SIZE_ALIGN(width, TBM_SURFACE_ALIGNMENT_PITCH_YUV / 2); + _offset = 0; + _pitch = SIZE_ALIGN(width, TBM_SURFACE_ALIGNMENT_PITCH_YUV); _size = MAX(_calc_uvplane_nv12(width, height), - _new_calc_uvplane_nv12(width, height)); + _new_calc_uvplane_nv12(width, height)); _bo_idx = 1; } break; - case TBM_FORMAT_NV21: - bpp = 12; - _bo_idx = 0; - _pitch = SIZE_ALIGN(width, TBM_SURFACE_ALIGNMENT_PITCH_YUV); - if (plane_idx == 0) { - _offset = 0; - _size = SIZE_ALIGN(_pitch * height, TBM_SURFACE_ALIGNMENT_PLANE); - } else if (plane_idx == 1) { - _offset = SIZE_ALIGN(_pitch * height, TBM_SURFACE_ALIGNMENT_PLANE); - _pitch = SIZE_ALIGN(width, TBM_SURFACE_ALIGNMENT_PITCH_YUV / 2); - _size = SIZE_ALIGN(_pitch * (height / 2), TBM_SURFACE_ALIGNMENT_PLANE); - } - break; - case TBM_FORMAT_NV16: case TBM_FORMAT_NV61: bpp = 16; @@ -1155,7 +1141,7 @@ tbm_exynos_bufmgr_get_plane_data(tbm_backend_bufmgr_data *bufmgr_data, /*else if( plane_idx ==1 )*/ { _offset += _size; - _pitch = SIZE_ALIGN(width, TBM_SURFACE_ALIGNMENT_PITCH_YUV / 2); + _pitch = SIZE_ALIGN(width, TBM_SURFACE_ALIGNMENT_PITCH_YUV); _size = SIZE_ALIGN(_pitch * height, TBM_SURFACE_ALIGNMENT_PLANE); _bo_idx = 0; } |